The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(task_sources): add filter, pipeline, and periodic task source modules
Steven Enamakel0165f7cb2bea
diff --git a/crates/openhuman-core/src/integrations/task_sources/filter.rs b/crates/openhuman-core/src/integrations/task_sources/filter.rsdeleted file mode 100644index 67dc0b984f..0000000000--- a/crates/openhuman-core/src/integrations/task_sources/filter.rs+++ /dev/null@@ -1,78 +0,0 @@-//! Translate a user-configured [`FilterSpec`] into the provider-agnostic-//! [`TaskFetchFilter`] consumed by `ComposioProvider::fetch_tasks`.-//!-//! Each provider's `fetch_tasks` impl reads only the fields relevant to-//! its toolkit, so this mapping just flattens the per-provider-//! `FilterSpec` variant into the shared filter envelope and stamps the-//! per-fetch cap.--use crate::integrations::composio::contract::TaskFetchFilter;--use super::types::FilterSpec;--/// Build the runtime [`TaskFetchFilter`] for a source's filter and a-/// per-fetch item cap.-pub fn to_fetch_filter(spec: &FilterSpec, max: u32) -> TaskFetchFilter {- match spec {- FilterSpec::Github {- repo,- labels,- assignee_is_me,- state,- fetch_mode,- extra,- } => TaskFetchFilter {- assignee_is_me: *assignee_is_me,- github_fetch_mode: *fetch_mode,- repo: repo.clone(),- labels: labels.clone(),- state: state.clone(),- extra: extra.clone(),- max,- ..Default::default()- },- FilterSpec::Notion {- database_id,- assigned_to_me,- status,- extra,- } => TaskFetchFilter {- assignee_is_me: *assigned_to_me,- database_id: database_id.clone(),- status: status.clone(),- extra: extra.clone(),- max,- ..Default::default()- },- FilterSpec::Linear {- team_id,- assignee_is_me,- state,- extra,- } => TaskFetchFilter {- assignee_is_me: *assignee_is_me,- team_id: team_id.clone(),- state: state.clone(),- extra: extra.clone(),- max,- ..Default::default()- },- FilterSpec::Clickup {- team_id,- list_id,- assignee_is_me,- extra,- } => TaskFetchFilter {- assignee_is_me: *assignee_is_me,- team_id: team_id.clone(),- list_id: list_id.clone(),- extra: extra.clone(),- max,- ..Default::default()- },- }-}--#[cfg(test)]-#[path = "filter_tests.rs"]-mod tests;diff --git a/crates/openhuman-core/src/integrations/task_sources/filter_tests.rs b/crates/openhuman-core/src/integrations/task_sources/filter_tests.rsdeleted file mode 100644index beae94deb3..0000000000--- a/crates/openhuman-core/src/integrations/task_sources/filter_tests.rs+++ /dev/null@@ -1,67 +0,0 @@-use super::*;-use serde_json::json;--#[test]-fn github_filter_maps_repo_labels_and_assignee() {- let spec = FilterSpec::Github {- repo: Some("tinyhumansai/openhuman".into()),- labels: vec!["bug".into(), "p1".into()],- assignee_is_me: true,- state: Some("open".into()),- fetch_mode: Default::default(),- extra: json!({"per_page": 10}),- };- let f = to_fetch_filter(&spec, 25);- assert_eq!(f.repo.as_deref(), Some("tinyhumansai/openhuman"));- assert_eq!(f.labels, vec!["bug".to_string(), "p1".to_string()]);- assert!(f.assignee_is_me);- assert_eq!(f.state.as_deref(), Some("open"));- assert_eq!(f.extra["per_page"], 10);- assert_eq!(f.max, 25);- // Fields that don't apply to github stay unset.- assert!(f.database_id.is_none());- assert!(f.team_id.is_none());-}--#[test]-fn notion_filter_maps_board_and_status() {- let spec = FilterSpec::Notion {- database_id: Some("board-xyz".into()),- assigned_to_me: true,- status: Some("Todo".into()),- extra: json!({}),- };- let f = to_fetch_filter(&spec, 5);- assert_eq!(f.database_id.as_deref(), Some("board-xyz"));- assert!(f.assignee_is_me, "assigned_to_me maps to assignee_is_me");- assert_eq!(f.status.as_deref(), Some("Todo"));- assert_eq!(f.max, 5);-}--#[test]-fn linear_filter_maps_team_and_state() {- let spec = FilterSpec::Linear {- team_id: Some("team-1".into()),- assignee_is_me: true,- state: Some("started".into()),- extra: json!({}),- };- let f = to_fetch_filter(&spec, 50);- assert_eq!(f.team_id.as_deref(), Some("team-1"));- assert!(f.assignee_is_me);- assert_eq!(f.state.as_deref(), Some("started"));-}--#[test]-fn clickup_filter_maps_team_and_list() {- let spec = FilterSpec::Clickup {- team_id: Some("ws-1".into()),- list_id: Some("list-9".into()),- assignee_is_me: true,- extra: json!({}),- };- let f = to_fetch_filter(&spec, 25);- assert_eq!(f.team_id.as_deref(), Some("ws-1"));- assert_eq!(f.list_id.as_deref(), Some("list-9"));- assert!(f.assignee_is_me);-}diff --git a/crates/openhuman-core/src/integrations/task_sources/mod.rs b/crates/openhuman-core/src/integrations/task_sources/mod.rsindex bb1597f681..ffc297d7f1 100644--- a/crates/openhuman-core/src/integrations/task_sources/mod.rs+++ b/crates/openhuman-core/src/integrations/task_sources/mod.rs@@ -17,7 +17,6 @@pub mod bus;pub mod enrich;-pub mod filter;pub mod ops;pub mod periodic;pub mod pipeline;diff --git a/crates/openhuman-core/src/integrations/task_sources/ops.rs b/crates/openhuman-core/src/integrations/task_sources/ops.rsindex a11a8d611c..b8004cd536 100644--- a/crates/openhuman-core/src/integrations/task_sources/ops.rs+++ b/crates/openhuman-core/src/integrations/task_sources/ops.rs@@ -154,7 +154,7 @@ pub async fn preview_filter(}let _ = connection_id;let max = max.unwrap_or(config.task_sources.max_tasks_per_fetch);- let _fetch_filter = filter::to_fetch_filter(&filter_spec, max);+ let _fetch_filter = filter_spec.to_fetch_filter(max);// `ComposioProvider::fetch_tasks` has no replacement — see// `pipeline::fetch_tasks_unavailable`'s doc comment for why.Err(format!(diff --git a/crates/openhuman-core/src/integrations/task_sources/periodic.rs b/crates/openhuman-core/src/integrations/task_sources/periodic.rsindex 718fe25e00..734a02df1c 100644--- a/crates/openhuman-core/src/integrations/task_sources/periodic.rs+++ b/crates/openhuman-core/src/integrations/task_sources/periodic.rs@@ -145,7 +145,7 @@ pub(crate) async fn run_one_tick() -> Result<(), String> {// gate: a user who presses Fetch is owed the explanation. Only the// timer is silenced, which is why the check lives here rather than// inside `run_source_once` (which both paths share).- if !source.provider.can_fetch() {+ if !super::types::provider_can_fetch(source.provider) {tracing::debug!(source_id = %source.id,provider = %source.provider.as_str(),diff --git a/crates/openhuman-core/src/integrations/task_sources/periodic_tests.rs b/crates/openhuman-core/src/integrations/task_sources/periodic_tests.rsindex ebad54b761..61fc0bf258 100644--- a/crates/openhuman-core/src/integrations/task_sources/periodic_tests.rs+++ b/crates/openhuman-core/src/integrations/task_sources/periodic_tests.rs@@ -83,7 +83,7 @@ fn no_provider_can_fetch_today() {ProviderSlug::Clickup,] {assert!(- !provider.can_fetch(),+ !provider_can_fetch(provider),"{} has no fetch path until the pipeline's fetch step is restored",provider.as_str());@@ -151,7 +151,7 @@ async fn a_tick_over_an_unfetchable_source_records_nothing() {assert!(stored.enabled, "precondition: the source is enabled");assert!(is_due(&stored), "precondition: the source is due");assert!(- !stored.provider.can_fetch(),+ !provider_can_fetch(stored.provider),"precondition: its provider has no fetch path, so the gate must skip it");diff --git a/crates/openhuman-core/src/integrations/task_sources/pipeline.rs b/crates/openhuman-core/src/integrations/task_sources/pipeline.rsindex 565aaa128b..4e3034a92f 100644--- a/crates/openhuman-core/src/integrations/task_sources/pipeline.rs+++ b/crates/openhuman-core/src/integrations/task_sources/pipeline.rs@@ -129,7 +129,7 @@ async fn run_inner(_reason: FetchReason,outcome: &mut FetchOutcome,) -> Result<(), String> {- let fetch_filter = filter::to_fetch_filter(&source.filter, source.max_tasks_per_fetch);+ let fetch_filter = source.filter.to_fetch_filter(source.max_tasks_per_fetch);let tasks = fetch_tasks_unavailable(source, &fetch_filter)?;outcome.fetched = tasks.len();// A fetch returns at most `fetch_filter.effective_max()` tasks (a harddiff --git a/crates/openhuman-core/src/integrations/task_sources/types.rs b/crates/openhuman-core/src/integrations/task_sources/types.rsindex 3b08b9c94b..d1474efdf6 100644--- a/crates/openhuman-core/src/integrations/task_sources/types.rs+++ b/crates/openhuman-core/src/integrations/task_sources/types.rs@@ -9,7 +9,6 @@use chrono::{DateTime, Utc};use serde::{Deserialize, Serialize};-use serde_json::Value;pub use tinyconnectors_bus::vocabulary::{FetchReason, FilterSpec, ProviderSlug, SourceTarget};