Add automation app-server API

This commit is contained in:
Andrei Eternal
2026-06-16 17:13:31 -07:00
parent 47d3ad7d8b
commit 5f17fb5cfe
13 changed files with 626 additions and 0 deletions
+6
View File
@@ -148,6 +148,12 @@ Example with notification opt-out:
- `thread/goal/clear` — clear the current persisted goal for a materialized thread; returns whether a goal was removed and emits `thread/goal/cleared` when state changes.
- `thread/goal/updated` — notification emitted whenever a thread goal changes; includes the full current goal.
- `thread/goal/cleared` — notification emitted whenever a thread goal is removed.
- `automation/list` — experimental; list recurring automations visible from the initialized client, with cursor pagination.
- `automation/read` — experimental; read one automation by id; returns `automation: null` when it is missing or not visible.
- `automation/create` — experimental; create a recurring cron automation or heartbeat. Cron targets provide `cwds` and spawn a new thread per cwd when dispatched. Heartbeat targets provide `threadId` and deliver to that existing thread.
- `automation/update` — experimental; update an automation's name, prompt, schedule, status, model, reasoning effort, or target when the target remains valid for the caller.
- `automation/delete` — experimental; delete an automation by id; returns `deleted: false` when it is missing or not visible.
- `automation/runNow` — experimental; immediately dispatch an automation once. Returns `{ found, startedCount }`; `found: true, startedCount: 0` means another app-server already owns an in-flight run.
- `thread/settings/updated` — experimental notification emitted to subscribed clients when a loaded thread’s effective next-turn settings change; includes `threadId` and the full `threadSettings`.
- `thread/status/changed` — notification emitted when a loaded thread’s status changes (`threadId` + new `status`).
- `thread/archive` — move a thread’s rollout file into the archived directory and attempt to move any spawned descendant thread rollout files; returns `{}` on success and emits `thread/archived` for each archived thread.
@@ -8,6 +8,7 @@ use crate::attestation::app_server_attestation_provider;
use crate::config_manager::ConfigManager;
use crate::connection_rpc_gate::ConnectionRpcGate;
use crate::error_code::invalid_request;
use crate::error_code::method_not_found;
use crate::extensions::ThreadExtensionDependencies;
use crate::extensions::app_server_extension_event_sink;
use crate::extensions::guardian_agent_spawner;
@@ -1183,6 +1184,24 @@ impl MessageProcessor {
ClientRequest::ThreadList { params, .. } => {
self.thread_processor.thread_list(params).await
}
ClientRequest::AutomationList { .. } => {
Err(automation_api_not_implemented("automation/list"))
}
ClientRequest::AutomationRead { .. } => {
Err(automation_api_not_implemented("automation/read"))
}
ClientRequest::AutomationCreate { .. } => {
Err(automation_api_not_implemented("automation/create"))
}
ClientRequest::AutomationUpdate { .. } => {
Err(automation_api_not_implemented("automation/update"))
}
ClientRequest::AutomationDelete { .. } => {
Err(automation_api_not_implemented("automation/delete"))
}
ClientRequest::AutomationRunNow { .. } => {
Err(automation_api_not_implemented("automation/runNow"))
}
ClientRequest::ThreadSearch { params, .. } => {
self.thread_processor.thread_search(params).await
}
@@ -1485,6 +1504,10 @@ impl MessageProcessor {
}
}
fn automation_api_not_implemented(method: &str) -> JSONRPCErrorError {
method_not_found(format!("{method} is not supported yet"))
}
#[cfg(test)]
#[path = "message_processor_tracing_tests.rs"]
mod message_processor_tracing_tests;