Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(desktop): run desktop actions without approval by default

Steven Enamakele23d4264f8af
diff --git a/Cargo.lock b/Cargo.lock
index dd4dc8c709..ff98d4034d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6600,7 +6600,7 @@ dependencies = [
[[package]]
name = "tinydesktop-bus"
-version = "0.2.1"
+version = "0.3.0"
dependencies = [
"serde",
"serde_json",
diff --git a/app/src/components/desktop/DesktopConnectionPage.test.tsx b/app/src/components/desktop/DesktopConnectionPage.test.tsx
index d6f99ac60e..ddb6f6a589 100644
--- a/app/src/components/desktop/DesktopConnectionPage.test.tsx
+++ b/app/src/components/desktop/DesktopConnectionPage.test.tsx
@@ -22,6 +22,7 @@ const enabled: DesktopStatus = {
accessibility: 'granted',
screen_recording: 'denied',
jev_ready: true,
+ approvals_enabled: false,
};
describe('Desktop connection', () => {
@@ -48,6 +49,7 @@ describe('Desktop connection', () => {
fireEvent.click(screen.getByRole('button', { name: 'Test desktop access' }));
expect(await screen.findByText('Desktop access works.')).toBeInTheDocument();
expect(callCoreRpc).toHaveBeenCalledWith({ method: 'openhuman.desktop_probe' });
+ expect(callCoreRpc).not.toHaveBeenCalledWith({ method: 'openhuman.desktop_pending' });
});
it('keeps the switch off on a failed write and surfaces the failure', async () => {
@@ -90,7 +92,8 @@ describe('Desktop connection', () => {
it('sends a pending action approval through the trusted core RPC', async () => {
let approved = false;
vi.mocked(callCoreRpc).mockImplementation(async ({ method, params }) => {
- if (method === 'openhuman.desktop_status') return enabled as never;
+ if (method === 'openhuman.desktop_status')
+ return { ...enabled, approvals_enabled: true } as never;
if (method === 'openhuman.desktop_pending') {
return (
approved
@@ -130,7 +133,8 @@ describe('Desktop connection', () => {
it('surfaces a pending approval read failure instead of silently hiding it', async () => {
vi.mocked(callCoreRpc).mockImplementation(async ({ method }) => {
- if (method === 'openhuman.desktop_status') return enabled as never;
+ if (method === 'openhuman.desktop_status')
+ return { ...enabled, approvals_enabled: true } as never;
if (method === 'openhuman.desktop_pending') throw new Error('unavailable');
throw new Error(`Unexpected method: ${method}`);
});
diff --git a/app/src/components/desktop/DesktopConnectionPage.tsx b/app/src/components/desktop/DesktopConnectionPage.tsx
index 8a594999d9..fce8bdf9cf 100644
--- a/app/src/components/desktop/DesktopConnectionPage.tsx
+++ b/app/src/components/desktop/DesktopConnectionPage.tsx
@@ -16,6 +16,7 @@ export interface DesktopStatus {
accessibility: string;
screen_recording: string;
jev_ready: boolean;
+ approvals_enabled?: boolean;
reason?: string;
}
@@ -109,11 +110,11 @@ export default function DesktopConnectionPage() {
}, [refresh]);
useEffect(() => {
- if (!status?.enabled) return;
+ if (!status?.enabled || !status.approvals_enabled) return;
void Promise.resolve().then(refreshPending);
const timer = window.setInterval(() => void refreshPending(), 5000);
return () => window.clearInterval(timer);
- }, [status?.enabled, refreshPending]);
+ }, [status?.enabled, status?.approvals_enabled, refreshPending]);
const setEnabled = async () => {
if (!localHost || !status || busy) return;
@@ -207,7 +208,7 @@ export default function DesktopConnectionPage() {
size="sm"
onClick={() => {
void refresh();
- if (status?.enabled) void refreshPending();
+ if (status?.enabled && status.approvals_enabled) void refreshPending();
}}
disabled={loading}>
{t('common.refresh')}
@@ -252,7 +253,7 @@ export default function DesktopConnectionPage() {
{status?.supported && status.enabled && (
<>
- {pending.length > 0 && (
+ {status.approvals_enabled && pending.length > 0 && (
<Card title={t('chat.approval.title')} padded>
{pending.map(entry => (
<div key={entry.confirmation_id} className="space-y-2 py-3">
diff --git a/crates/openhuman-app/Cargo.lock b/crates/openhuman-app/Cargo.lock
index 6fabc18d9e..6e4a12263b 100644
--- a/crates/openhuman-app/Cargo.lock
+++ b/crates/openhuman-app/Cargo.lock
@@ -7304,7 +7304,7 @@ dependencies = [
[[package]]
name = "tinydesktop-bus"
-version = "0.2.1"
+version = "0.3.0"
dependencies = [
"serde",
"serde_json",
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
index b4550195b0..e0032cd3f0 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate.rs
@@ -391,6 +391,10 @@ impl SecurityGate for OpenHumanSecurityGate {
/// is carried forward so a later prompting stage does not ask twice.
async fn authorize_tool(&self, call: &ToolCallRequest) -> TaResult<GateDecision> {
let policy = self.effective_policy();
+ let desktop_approval_disabled = match self.resolve_tool(&call.tool_name) {
+ Some(tool) => crate::desktop::control::approvals_disabled_for(tool).await,
+ None => false,
+ };
tracing::debug!(
target: "tinyagents",
tool = %call.tool_name,
@@ -415,6 +419,10 @@ impl SecurityGate for OpenHumanSecurityGate {
);
return Ok(GateDecision::Deny { reason });
}
+ ToolPolicyVerdict::RequireApproval if desktop_approval_disabled => {
+ tracing::debug!(tool = %call.tool_name,
+ "[desktop] channel approval park skipped by desktop setting");
+ }
ToolPolicyVerdict::RequireApproval => {
// The channel says a human must approve. Unlike the shell and
// external-effect paths below, an absent approval gate must
@@ -566,7 +574,7 @@ impl SecurityGate for OpenHumanSecurityGate {
// 5. Everything else: the tool's own external-effect classification
// decides whether a human is asked.
- if tool.external_effect_with_args(&call.arguments) {
+ if tool.external_effect_with_args(&call.arguments) && !desktop_approval_disabled {
return Ok(self.park_once(call, channel_approved).await);
}
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_tests.rs
index 22a9256405..3a4c4b4140 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/security_gate_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/security_gate_tests.rs
@@ -336,6 +336,43 @@ async fn require_approval_never_silently_allows_a_plain_tool() {
);
}
+#[tokio::test]
+async fn desktop_default_skips_channel_and_external_approval_parks() {
+ let _guard = crate::config::TEST_ENV_LOCK.lock().unwrap();
+ let previous = std::env::var_os("OPENHUMAN_WORKSPACE");
+ let temp = tempfile::tempdir().unwrap();
+ std::fs::write(
+ temp.path().join("config.toml"),
+ "[desktop]\napprovals_enabled = false\n",
+ )
+ .unwrap();
+ unsafe {
+ std::env::set_var("OPENHUMAN_WORKSPACE", temp.path());
+ }
+ let desktop = Box::new(crate::desktop::control::tools::DesktopTool::new(
+ Arc::new(crate::config::Config::default()),
+ crate::desktop::control::tools::DesktopToolKind::Goal,
+ )) as Box<dyn Tool>;
+ let gate =
+ OpenHumanSecurityGate::new(policy(AutonomyLevel::Full), vec![Arc::new(vec![desktop])])
+ .with_tool_policy(policy_session(
+ "desktop_goal",
+ ToolPolicyAction::RequireApproval,
+ ));
+ let decision = gate
+ .authorize_tool(&req(
+ "desktop_goal",
+ json!({"app":"TextEdit","goal":"test"}),
+ ))
+ .await
+ .unwrap();
+ assert_eq!(decision, GateDecision::Allow);
+ match previous {
+ Some(value) => unsafe { std::env::set_var("OPENHUMAN_WORKSPACE", value) },
+ None => unsafe { std::env::remove_var("OPENHUMAN_WORKSPACE") },
+ }
+}
+
/// A channel `RequireApproval` must not become an autonomy-tier override.
///
/// With no approval gate installed the park denies, so this asserts the
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/approval.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/approval.rs
index 473ae17a46..c810bb5bff 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/approval.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/approval.rs
@@ -75,6 +75,19 @@ impl ApprovalSecurityMiddleware {
.map(|t| t.external_effect_with_args(args))
.unwrap_or(false)
}
+
+ pub(crate) async fn requires_approval(&self, name: &str, args: &serde_json::Value) -> bool {
+ let desktop_approval_disabled = match self
+ .tool_sets
+ .iter()
+ .flat_map(|set| set.iter())
+ .find(|tool| tool.name() == name)
+ {
+ Some(tool) => crate::desktop::control::approvals_disabled_for(tool.as_ref()).await,
+ None => false,
+ };
+ self.has_external_effect(name, args) && !desktop_approval_disabled
+ }
}
#[async_trait]
@@ -95,7 +108,7 @@ impl ToolMiddleware<(), crate::agent::tinyagents::host::OpenHumanRunContext>
// Resolve external-effect up front so no tool borrow is held across the
// approval await.
let mut audit_id: Option<String> = None;
- let has_ext = self.has_external_effect(&call.name, &call.arguments);
+ let has_ext = self.requires_approval(&call.name, &call.arguments).await;
tracing::debug!(
tool = %call.name,
has_external_effect = has_ext,
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
index 59805dcc06..3baa3c4d87 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware/tool_policy.rs
@@ -187,9 +187,18 @@ impl ToolPolicyMiddleware {
/// The channel-permission gate the engine ran before the builder policy: a
/// session-level deny, then a per-call permission-level ceiling check. Returns
/// the blocking message when the call must not execute.
- pub(crate) fn channel_permission_block(&self, call: &TaToolCall) -> Option<String> {
+ pub(crate) fn channel_permission_block(
+ &self,
+ call: &TaToolCall,
+ desktop_approval_disabled: bool,
+ ) -> Option<String> {
let decision = self.session.decision_for(&call.name);
- if decision.is_denied() {
+ let approval_only = desktop_approval_disabled
+ && matches!(
+ decision.action,
+ crate::tools::agent_policy::ToolPolicyAction::RequireApproval
+ );
+ if decision.is_denied() && !approval_only {
return Some(
PolicyDenial::SessionForbidden {
tool: &call.name,
@@ -316,7 +325,11 @@ impl ToolMiddleware<(), crate::agent::tinyagents::host::OpenHumanRunContext>
// Channel-permission ceiling first (session deny + per-call permission
// level), mirroring the engine order in `agent_tool_exec`.
- if let Some(message) = self.channel_permission_block(&call) {
+ let desktop_approval_disabled = match self.resolve_tool(&call.name) {
+ Some(tool) => crate::desktop::control::approvals_disabled_for(tool.as_ref()).await,
+ None => false,
+ };
+ if let Some(message) = self.channel_permission_block(&call, desktop_approval_disabled) {
tracing::debug!(
tool = call.name.as_str(),
channel = self.channel.as_str(),
@@ -339,7 +352,10 @@ impl ToolMiddleware<(), crate::agent::tinyagents::host::OpenHumanRunContext>
}
let decision = self.policy.check(&request).await;
- if let Some(reason) = decision.blocking_reason() {
+ if let Some(reason) = decision.blocking_reason().filter(|_| {
+ !(desktop_approval_disabled
+ && matches!(&decision, ToolPolicyDecision::RequireApproval { .. }))
+ }) {
let blocked_action = match &decision {
ToolPolicyDecision::RequireApproval { .. } => "requires approval",
ToolPolicyDecision::Deny { .. } => "denied",
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_loop_guard_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_loop_guard_tests.rs
index b22fad824a..fedaedc158 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_loop_guard_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_loop_guard_tests.rs
@@ -616,6 +616,59 @@ fn approval_external_effect_resolution_walks_the_tool_sets() {
assert!(!mw.has_external_effect("missing", &json!({})));
}
+#[test]
+fn desktop_external_effect_keeps_metadata_but_skips_approval_when_disabled() {
+ std::thread::Builder::new()
+ .stack_size(16 * 1024 * 1024)
+ .spawn(|| {
+ tokio::runtime::Builder::new_current_thread()
+ .enable_all()
+ .build()
+ .unwrap()
+ .block_on(desktop_external_effect_inner());
+ })
+ .unwrap()
+ .join()
+ .unwrap();
+}
+
+async fn desktop_external_effect_inner() {
+ let _guard = crate::config::TEST_ENV_LOCK.lock().unwrap();
+ let previous = std::env::var_os("OPENHUMAN_WORKSPACE");
+ let temp = tempfile::tempdir().unwrap();
+ std::fs::write(
+ temp.path().join("config.toml"),
+ "[desktop]\napprovals_enabled = false\n",
+ )
+ .unwrap();
+ unsafe {
+ std::env::set_var("OPENHUMAN_WORKSPACE", temp.path());
+ }
+ let tools: Arc<Vec<Box<dyn Tool>>> = Arc::new(vec![
+ Box::new(crate::desktop::control::tools::DesktopTool::new(
+ Arc::new(crate::config::Config::default()),
+ crate::desktop::control::tools::DesktopToolKind::Goal,
+ )),
+ Box::new(FakeTool {
+ name: "send_email",
+ cap: None,
+ external: true,
+ }),
+ ]);
+ let middleware = ApprovalSecurityMiddleware::new(vec![tools]);
+ assert!(middleware.has_external_effect("desktop_goal", &json!({})));
+ assert!(
+ !middleware
+ .requires_approval("desktop_goal", &json!({}))
+ .await
+ );
+ assert!(middleware.requires_approval("send_email", &json!({})).await);
+ match previous {
+ Some(value) => unsafe { std::env::set_var("OPENHUMAN_WORKSPACE", value) },
+ None => unsafe { std::env::remove_var("OPENHUMAN_WORKSPACE") },
+ }
+}
+
#[test]
fn approval_identity_scopes_composio_dispatcher_grants_to_one_action() {
assert_eq!(
diff --git a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_policy_tests.rs b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_policy_tests.rs
index c74a9068b0..973baf4bb4 100644
--- a/crates/openhuman-core/src/agent/tinyagents/middleware_tool_policy_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/middleware_tool_policy_tests.rs
@@ -110,6 +110,56 @@ fn non_owner_middleware_at(allowed: PermissionLevel) -> ToolPolicyMiddleware {
)
}
+#[test]
+fn desktop_approval_bypass_skips_only_require_approval_channel_verdict() {
+ fn middleware(action: ToolPolicyAction) -> ToolPolicyMiddleware {
+ let name = "desktop_goal";
+ let session = ToolPolicySession {
+ profile: TaskProfile {
+ agent_id: "orchestrator".to_owned(),
+ channel: "web_chat".to_owned(),
+ entrypoint: "chat".to_owned(),
+ risk_level: TaskRiskLevel::Low,
+ allowed_permission: PermissionLevel::Dangerous,
+ },
+ capabilities: Vec::new(),
+ allowed_tool_names: Default::default(),
+ blocked_tool_names: Default::default(),
+ hidden_tool_names: Default::default(),
+ decisions: [(
+ name.to_owned(),
+ ToolPolicyDecision {
+ tool_name: name.to_owned(),
+ action,
+ required_permission: Some(PermissionLevel::Write),
+ allowed_permission: PermissionLevel::Dangerous,
+ },
+ )]
+ .into_iter()
+ .collect(),
+ };
+ ToolPolicyMiddleware::new(
+ Arc::new(crate::agent::tool_policy::AllowAllToolPolicy::default()),
+ session,
+ vec![Arc::new(vec![Box::new(RoutingFakeTool(name))])],
+ "sess".to_owned(),
+ "web_chat".to_owned(),
+ "orchestrator".to_owned(),
+ )
+ }
+ let approval_middleware = middleware(ToolPolicyAction::RequireApproval);
+ let request = call("desktop_goal", json!({"app":"TextEdit","goal":"type"}));
+ assert!(approval_middleware
+ .channel_permission_block(&request, false)
+ .is_some());
+ assert!(approval_middleware
+ .channel_permission_block(&request, true)
+ .is_none());
+ assert!(middleware(ToolPolicyAction::Deny)
+ .channel_permission_block(&request, true)
+ .is_some());
+}
+
fn call(name: &str, args: serde_json::Value) -> TaToolCall {
TaToolCall {
id: "call-1".to_string(),
@@ -189,10 +239,13 @@ async fn a_use_skill_call_that_names_a_tool_is_not_rendered_as_a_listing() {
async fn a_use_skill_denial_names_a_delegate_this_session_can_call() {
let mw = non_owner_middleware();
let message = mw
- .channel_permission_block(&call(
- "use_skill",
- json!({ "skill": "workflows", "tool": "propose_workflow" }),
- ))
+ .channel_permission_block(
+ &call(
+ "use_skill",
+ json!({ "skill": "workflows", "tool": "propose_workflow" }),
+ ),
+ false,
+ )
.expect("propose_workflow is denied for a non-owner");
assert!(
@@ -243,10 +296,13 @@ async fn a_session_without_the_delegate_is_not_told_to_call_it() {
);
let message = mw
- .channel_permission_block(&call(
- "use_skill",
- json!({ "skill": "workflows", "tool": "propose_workflow" }),
- ))
+ .channel_permission_block(
+ &call(
+ "use_skill",
+ json!({ "skill": "workflows", "tool": "propose_workflow" }),
+ ),
+ false,
+ )
.expect("propose_workflow is denied");
assert!(
@@ -301,10 +357,10 @@ async fn use_skill_reaches_a_withheld_packed_tool() {
);
assert!(
- mw.channel_permission_block(&call(
- "use_skill",
- json!({ "skill": "goals", "tool": "goal_set" }),
- ))
+ mw.channel_permission_block(
+ &call("use_skill", json!({ "skill": "goals", "tool": "goal_set" }),),
+ false
+ )
.is_none(),
"a withheld packed tool must stay reachable through use_skill — that is \
the only route it has"
@@ -381,10 +437,13 @@ async fn a_prompt_hidden_delegate_is_not_offered_as_a_direct_route() {
async fn an_invented_tool_name_in_a_skill_is_not_reported_as_a_denial() {
let mw = non_owner_middleware();
let message = mw
- .channel_permission_block(&call(
- "use_skill",
- json!({ "skill": "workflows", "tool": "install_workflow" }),
- ))
+ .channel_permission_block(
+ &call(
+ "use_skill",
+ json!({ "skill": "workflows", "tool": "install_workflow" }),
+ ),
+ false,
+ )
.expect("an invented tool must be answered, not dispatched");
let workflows = crate::tools::toolpacks::pack("workflows").expect("workflows pack");
@@ -414,10 +473,13 @@ async fn an_invented_tool_name_in_a_skill_is_not_reported_as_a_denial() {
fn an_invented_tool_name_is_not_found_even_under_the_packs_permission_ceiling() {
let mw = non_owner_middleware_at(PermissionLevel::ReadOnly);
let message = mw
- .channel_permission_block(&call(
- "use_skill",
- json!({ "skill": "workflows", "tool": "install_workflow" }),
- ))
+ .channel_permission_block(
+ &call(
+ "use_skill",
+ json!({ "skill": "workflows", "tool": "install_workflow" }),
+ ),
+ false,
+ )
.expect("an invented tool must be answered, not dispatched");
assert!(
@@ -449,10 +511,13 @@ fn a_pack_member_this_session_never_registered_is_not_found_not_forbidden() {
);
let message = mw
- .channel_permission_block(&call(
- "use_skill",
- json!({ "skill": "workflows", "tool": "save_workflow" }),
- ))
+ .channel_permission_block(
+ &call(
+ "use_skill",
+ json!({ "skill": "workflows", "tool": "save_workflow" }),
+ ),
+ false,
+ )
.expect("an unregistered member must be answered, not dispatched");
assert_eq!(
diff --git a/crates/openhuman-core/src/config/schema/desktop.rs b/crates/openhuman-core/src/config/schema/desktop.rs
new file mode 100644
index 0000000000..af9e0f534e
--- /dev/null
+++ b/crates/openhuman-core/src/config/schema/desktop.rs
@@ -0,0 +1,26 @@
+//! Desktop automation confirmation policy.
+
+use schemars::JsonSchema;
+use serde::{Deserialize, Serialize};
+
+#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonSchema)]
+#[serde(default)]
+pub struct DesktopConfig {
+ /// When false, tinydesktop's one-use confirmation stop is continued by
+ /// the core after the module reobserves and validates the target. This is
+ /// the current product default. True enables the trusted Connections
+ /// approval card and explicit continuation RPC.
+ pub approvals_enabled: bool,
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn approvals_are_off_by_default_and_can_be_opted_in() {
+ assert!(!DesktopConfig::default().approvals_enabled);
+ let enabled: DesktopConfig = toml::from_str("approvals_enabled = true").unwrap();
+ assert!(enabled.approvals_enabled);
+ }
+}
diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rs
index a9c448bcd8..2e1a613ea6 100644
--- a/crates/openhuman-core/src/config/schema/mod.rs
+++ b/crates/openhuman-core/src/config/schema/mod.rs
@@ -22,6 +22,8 @@ mod cli_overrides;
pub use cli_overrides::AppliedInferenceOverride;
mod context;
mod dashboard;
+mod desktop;
+pub use desktop::DesktopConfig;
mod defaults;
mod dictation;
mod hooks;
diff --git a/crates/openhuman-core/src/config/schema/types/config.rs b/crates/openhuman-core/src/config/schema/types/config.rs
index 0211c43a2b..b03219f5d0 100644
--- a/crates/openhuman-core/src/config/schema/types/config.rs
+++ b/crates/openhuman-core/src/config/schema/types/config.rs
@@ -133,6 +133,9 @@ pub struct Config {
#[serde(default)]
pub autonomy: AutonomyConfig,
+ #[serde(default)]
+ pub desktop: DesktopConfig,
+
/// Host-level switches for the configurable hook system. The hooks
/// themselves live in `hooks.json` files, not here — see
/// [`HooksConfig`].
diff --git a/crates/openhuman-core/src/config/schema/types/defaults.rs b/crates/openhuman-core/src/config/schema/types/defaults.rs
index 3ddff843fa..649a8bda0a 100644
--- a/crates/openhuman-core/src/config/schema/types/defaults.rs
+++ b/crates/openhuman-core/src/config/schema/types/defaults.rs
@@ -43,6 +43,7 @@ impl Default for Config {
observability: ObservabilityConfig::default(),
dashboard: DashboardConfig::default(),
autonomy: AutonomyConfig::default(),
+ desktop: DesktopConfig::default(),
hooks: HooksConfig::default(),
privacy: PrivacyConfig::default(),
sandbox: SandboxConfig::default(),
diff --git a/crates/openhuman-core/src/core/runtime/builder.rs b/crates/openhuman-core/src/core/runtime/builder.rs
index 7ca064b574..9d4e7f5012 100644
--- a/crates/openhuman-core/src/core/runtime/builder.rs
+++ b/crates/openhuman-core/src/core/runtime/builder.rs
@@ -906,7 +906,9 @@ impl CoreRuntime {
let bind_addr = format!("{host}:{listen_port}");
let listener = pick.listener;
crate::desktop::control::set_listener_is_loopback(
- listener.local_addr().is_ok_and(|address| address.ip().is_loopback()),
+ listener
+ .local_addr()
+ .is_ok_and(|address| address.ip().is_loopback()),
);
// Synchronize OPENHUMAN_CORE_RPC_URL with the actual bound port so
diff --git a/crates/openhuman-core/src/desktop/control/WORKFLOW.md b/crates/openhuman-core/src/desktop/control/WORKFLOW.md
index 63f3eb4940..1132807a46 100644
--- a/crates/openhuman-core/src/desktop/control/WORKFLOW.md
+++ b/crates/openhuman-core/src/desktop/control/WORKFLOW.md
@@ -5,6 +5,6 @@ description: Inspect and control native desktop apps when Desktop is enabled in
# Desktop control
-Use `tool_search` to discover `desktop_*` tools. Begin with `desktop_list_apps` and `desktop_snapshot` (skeleton first); use `desktop_find` or a deeper snapshot to select a snapshot-qualified element ref. After an action, observe the app again and verify the visible result.
+Use `tool_search` to discover `desktop_*` tools. Begin with `desktop_list_apps` and `desktop_list_windows`; if the app has no visible window, use `desktop_launch` to activate it. Take a skeleton `desktop_snapshot`, then use `desktop_find` or a deeper snapshot to select a snapshot-qualified element ref. After an action, observe the app again and verify the visible result.
-If a ref is stale, take a fresh snapshot. If Accessibility is denied, ask the user to grant it to the process running OpenHuman. Desktop goals have small action and model-call limits. A confirmation stop names the proposed operation and target; wait for the user to approve it in Connections before continuing with the `confirmation_id`. Never claim an action succeeded from a timeout or a model decision alone.
+If a ref is stale, take a fresh snapshot. If Accessibility is denied, ask the user to grant it to the process running OpenHuman. Desktop goals have small action and model-call limits. With desktop approvals off (the default), the core continues a confirmation stop through the module's one-use handle; the module reobserves and validates the target before acting. If the operator enables desktop approvals, wait for their decision in Connections before using `desktop_continue_goal`. Never claim an action succeeded from a timeout or a model decision alone.
diff --git a/crates/openhuman-core/src/desktop/control/mod.rs b/crates/openhuman-core/src/desktop/control/mod.rs
index a11c163c07..7fc6c65852 100644
--- a/crates/openhuman-core/src/desktop/control/mod.rs
+++ b/crates/openhuman-core/src/desktop/control/mod.rs
@@ -6,6 +6,7 @@ mod schemas;
pub mod tools;
pub use confirmation::{confirm, pending};
+pub(crate) use ops::approvals_disabled_for;
pub use ops::listener_is_loopback;
pub(crate) use ops::set_listener_is_loopback;
pub use ops::{enabled, probe, set_enabled, status, DesktopProbe, DesktopStatus};
diff --git a/crates/openhuman-core/src/desktop/control/ops.rs b/crates/openhuman-core/src/desktop/control/ops.rs
index a0efa2037f..d9c35598a8 100644
--- a/crates/openhuman-core/src/desktop/control/ops.rs
+++ b/crates/openhuman-core/src/desktop/control/ops.rs
@@ -12,6 +12,34 @@ use tinydesktop_bus::{names, ListAppsRequest, SnapshotRequest};
use crate::config::Config;
+const DESKTOP_AGENT_TOOLS: &[&str] = &[
+ "desktop_list_apps",
+ "desktop_list_windows",
+ "desktop_launch",
+ "desktop_snapshot",
+ "desktop_find",
+ "desktop_goal",
+ "desktop_continue_goal",
+];
+
+/// A registered desktop tool skips only approval parks when its explicit
+/// desktop setting is off. Permission caps, denies, enabled state, OS grants,
+/// and the action budget still run at their normal gates.
+pub(crate) async fn approvals_disabled_for(tool: &dyn tinytools::Tool) -> bool {
+ if tool.family() != Some("desktop") || !DESKTOP_AGENT_TOOLS.contains(&tool.name()) {
+ return false;
+ }
+ crate::config::rpc::load_config_with_timeout()
+ .await
+ .is_ok_and(|config| approval_bypass_decision(&config, tool))
+}
+
+fn approval_bypass_decision(config: &Config, tool: &dyn tinytools::Tool) -> bool {
+ tool.family() == Some("desktop")
+ && DESKTOP_AGENT_TOOLS.contains(&tool.name())
+ && !config.desktop.approvals_enabled
+}
+
static STATE_LOCK: Mutex<()> = Mutex::new(());
static LOOPBACK_LISTENER: AtomicBool = AtomicBool::new(false);
@@ -28,6 +56,7 @@ pub fn listener_is_loopback() -> bool {
pub struct DesktopStatus {
pub supported: bool,
pub enabled: bool,
+ pub approvals_enabled: bool,
pub platform: &'static str,
pub module_state: String,
pub accessibility: String,
@@ -134,6 +163,7 @@ pub async fn status(config: &Config) -> DesktopStatus {
let mut result = DesktopStatus {
supported: supported(),
enabled: local_enabled,
+ approvals_enabled: config.desktop.approvals_enabled,
platform: std::env::consts::OS,
module_state,
accessibility: "unknown".to_owned(),
@@ -264,4 +294,17 @@ mod tests {
assert_eq!(permission(&data, "accessibility"), "granted");
assert_eq!(permission(&data, "screen_recording"), "unknown");
}
+
+ #[test]
+ fn approval_bypass_requires_a_registered_desktop_tool_and_disabled_setting() {
+ use super::super::tools::{DesktopTool, DesktopToolKind};
+ let mut config = Config::default();
+ let goal = DesktopTool::new(std::sync::Arc::new(config.clone()), DesktopToolKind::Goal);
+ let raw_action =
+ DesktopTool::new(std::sync::Arc::new(config.clone()), DesktopToolKind::Act);
+ assert!(approval_bypass_decision(&config, &goal));
+ assert!(!approval_bypass_decision(&config, &raw_action));
+ config.desktop.approvals_enabled = true;
+ assert!(!approval_bypass_decision(&config, &goal));
+ }
}
diff --git a/crates/openhuman-core/src/desktop/control/tools.rs b/crates/openhuman-core/src/desktop/control/tools.rs
index c7558da549..77f5a788ff 100644
--- a/crates/openhuman-core/src/desktop/control/tools.rs
+++ b/crates/openhuman-core/src/desktop/control/tools.rs
@@ -1,12 +1,13 @@
//! Deferred desktop tools. Only their names and descriptions enter discovery.
+use std::future::Future;
use std::sync::Arc;
use async_trait::async_trait;
use serde_json::{json, Value};
use tinydesktop_bus::{
- names, FindRequest, ListAppsRequest, ListWindowsRequest, RefRequest, SnapshotRequest,
- TypeRequest,
+ names, DesktopResponse, FindRequest, LaunchRequest, ListAppsRequest, ListWindowsRequest,
+ RefRequest, SnapshotRequest, TypeRequest,
};
use tinytools::{PermissionLevel, Tool, ToolExposure, ToolResult};
@@ -16,10 +17,12 @@ use crate::config::Config;
pub enum DesktopToolKind {
Apps,
Windows,
+ Launch,
Snapshot,
Find,
Act,
Goal,
+ ContinueGoal,
}
pub struct DesktopTool {
@@ -42,16 +45,86 @@ fn required(args: &Value, key: &str) -> anyhow::Result<String> {
.ok_or_else(|| anyhow::anyhow!("missing required parameter: {key}"))
}
+fn confirmation_id(response: &DesktopResponse) -> Result<Option<String>, String> {
+ if !response.ok {
+ return Ok(None);
+ }
+ let Some(data) = response.data.as_ref() else {
+ return Ok(None);
+ };
+ if data.get("stop").and_then(Value::as_str) != Some("confirmation_required") {
+ return Ok(None);
+ }
+ data.get("confirmation_id")
+ .and_then(Value::as_str)
+ .filter(|id| !id.is_empty())
+ .map(str::to_owned)
+ .map(Some)
+ .ok_or_else(|| {
+ "desktop goal requested confirmation without a continuation handle".to_owned()
+ })
+}
+
+/// The module owns remaining action/model budgets and revalidates a one-use
+/// target against a fresh snapshot on every continuation. The host adds a hard
+/// eight-confirmation ceiling so a module bug cannot hold this tool forever.
+async fn advance_goal_confirmations<F, Fut>(
+ mut response: DesktopResponse,
+ approvals_enabled: bool,
+ mut continue_with: F,
+) -> Result<DesktopResponse, String>
+where
+ F: FnMut(String, bool) -> Fut,
+ Fut: Future<Output = Result<DesktopResponse, String>>,
+{
+ if approvals_enabled {
+ return Ok(response);
+ }
+ for _ in 0..8 {
+ let Some(id) = confirmation_id(&response)? else {
+ return Ok(response);
+ };
+ tracing::info!(
+ "[desktop] continuing module-confirmed action under approvals-disabled policy"
+ );
+ response = continue_with(id, true).await?;
+ }
+ if let Some(id) = confirmation_id(&response)? {
+ let executed = response
+ .data
+ .as_ref()
+ .and_then(|data| data.get("turns"))
+ .and_then(Value::as_array)
+ .map_or(0, Vec::len);
+ let cancelled = continue_with(id, false).await.map_err(|error| {
+ format!(
+ "desktop goal reached the confirmation continuation limit after {executed} \
+ executed action(s); cancellation delivery is uncertain: {error}"
+ )
+ })?;
+ if !cancelled.ok {
+ return Err(format!(
+ "desktop goal reached the confirmation continuation limit after {executed} \
+ executed action(s); module refused cancellation"
+ ));
+ }
+ return Ok(cancelled);
+ }
+ Ok(response)
+}
+
#[async_trait]
impl Tool for DesktopTool {
fn name(&self) -> &str {
match self.kind {
DesktopToolKind::Apps => "desktop_list_apps",
DesktopToolKind::Windows => "desktop_list_windows",
+ DesktopToolKind::Launch => "desktop_launch",
DesktopToolKind::Snapshot => "desktop_snapshot",
DesktopToolKind::Find => "desktop_find",
DesktopToolKind::Act => "desktop_act",
DesktopToolKind::Goal => "desktop_goal",
+ DesktopToolKind::ContinueGoal => "desktop_continue_goal",
}
}
@@ -59,10 +132,12 @@ impl Tool for DesktopTool {
match self.kind {
DesktopToolKind::Apps => "List running desktop applications on this computer.",
DesktopToolKind::Windows => "List native windows for a running desktop app.",
+ DesktopToolKind::Launch => "Launch or activate a named desktop app so its window becomes available.",
DesktopToolKind::Snapshot => "Inspect an app's accessibility tree and obtain snapshot-qualified element refs.",
DesktopToolKind::Find => "Find a desktop accessibility element by role and name, returning a ref.",
DesktopToolKind::Act => "Act on a desktop element ref: click, focus, type, check, uncheck, expand, or collapse.",
DesktopToolKind::Goal => "Run a bounded Jev-guided desktop goal. Search for desktop tools before use; consequential actions require confirmation.",
+ DesktopToolKind::ContinueGoal => "Resume a desktop goal after the user approved its exact pending action in Connections.",
}
}
@@ -70,15 +145,28 @@ impl Tool for DesktopTool {
ToolExposure::Deferred
}
+ fn family(&self) -> Option<&str> {
+ Some("desktop")
+ }
+
fn permission_level(&self) -> PermissionLevel {
match self.kind {
- DesktopToolKind::Act | DesktopToolKind::Goal => PermissionLevel::Write,
+ DesktopToolKind::Act
+ | DesktopToolKind::Goal
+ | DesktopToolKind::ContinueGoal
+ | DesktopToolKind::Launch => PermissionLevel::Write,
_ => PermissionLevel::ReadOnly,
}
}
fn external_effect(&self) -> bool {
- matches!(self.kind, DesktopToolKind::Act | DesktopToolKind::Goal)
+ matches!(
+ self.kind,
+ DesktopToolKind::Act
+ | DesktopToolKind::Goal
+ | DesktopToolKind::ContinueGoal
+ | DesktopToolKind::Launch
+ )
}
fn parameters_schema(&self) -> Value {
@@ -86,6 +174,9 @@ impl Tool for DesktopTool {
DesktopToolKind::Apps => json!({"type":"object","properties":{}}),
DesktopToolKind::Windows => json!({"type":"object","properties":{
"app":{"type":"string","description":"Optional application name"}}}),
+ DesktopToolKind::Launch => json!({"type":"object","properties":{
+ "app":{"type":"string","description":"Application name, e.g. Spotify or TextEdit"}},
+ "required":["app"],"additionalProperties":false}),
DesktopToolKind::Snapshot => json!({"type":"object","properties":{
"app":{"type":"string"}, "skeleton":{"type":"boolean"},
"root_ref":{"type":"string"}, "max_depth":{"type":"integer","minimum":1,"maximum":12}}}),
@@ -101,8 +192,11 @@ impl Tool for DesktopTool {
"app":{"type":"string"},"goal":{"type":"string"},
"text":{"type":"array","items":{"type":"string"}},
"max_steps":{"type":"integer","minimum":1,"maximum":8},
- "max_model_calls":{"type":"integer","minimum":1,"maximum":16},
- "confirmation_id":{"type":"string","description":"Continue only after the user approved this pending action in the desktop confirmation UI"}}}),
+ "max_model_calls":{"type":"integer","minimum":1,"maximum":16}},
+ "required":["app","goal"]}),
+ DesktopToolKind::ContinueGoal => json!({"type":"object","properties":{
+ "confirmation_id":{"type":"string","description":"One-use handle approved by the user in Connections"}},
+ "required":["confirmation_id"]}),
}
}
@@ -133,7 +227,10 @@ impl Tool for DesktopTool {
.and_then(Value::as_str)
.unwrap_or("unknown");
if accessibility != "granted"
- && !matches!(self.kind, DesktopToolKind::Apps | DesktopToolKind::Windows)
+ && !matches!(
+ self.kind,
+ DesktopToolKind::Apps | DesktopToolKind::Windows | DesktopToolKind::Launch
+ )
{
return Ok(ToolResult::error("Desktop Accessibility permission is not granted. Enable it in system settings and retry."));
}
@@ -149,6 +246,12 @@ impl Tool for DesktopTool {
app: args.get("app").and_then(Value::as_str).map(str::to_owned),
})?,
),
+ DesktopToolKind::Launch => {
+ let mut request = LaunchRequest::new(required(&args, "app")?);
+ request.activate = true;
+ request.attach_if_running = Some(true);
+ (names::methods::LAUNCH, serde_json::to_value(request)?)
+ }
DesktopToolKind::Snapshot => {
let request = SnapshotRequest {
app: args.get("app").and_then(Value::as_str).map(str::to_owned),
@@ -210,11 +313,12 @@ impl Tool for DesktopTool {
(member, serde_json::to_value(RefRequest::new(reference))?)
}
}
- DesktopToolKind::Goal => {
+ DesktopToolKind::Goal | DesktopToolKind::ContinueGoal => {
let (app, goal, continuation) =
- if let Some(id) = args.get("confirmation_id").and_then(Value::as_str) {
+ if matches!(self.kind, DesktopToolKind::ContinueGoal) {
+ let id = required(&args, "confirmation_id")?;
let (app, goal) =
- super::confirmation::take_approved(id).map_err(anyhow::Error::msg)?;
+ super::confirmation::take_approved(&id).map_err(anyhow::Error::msg)?;
(app, goal, Some(json!({"id":id,"approve":true})))
} else {
(required(&args, "app")?, required(&args, "goal")?, None)
@@ -231,11 +335,50 @@ impl Tool for DesktopTool {
(names::methods::RUN_GOAL, request)
}
};
+ let goal_action = matches!(
+ self.kind,
+ DesktopToolKind::Goal | DesktopToolKind::ContinueGoal
+ );
+ let approvals_enabled = if goal_action {
+ let live_config = match crate::config::rpc::load_config_with_timeout().await {
+ Ok(config) => config,
+ Err(error) => {
+ return Ok(ToolResult::error(format!(
+ "Desktop approval setting is unavailable: {error}"
+ )))
+ }
+ };
+ live_config.desktop.approvals_enabled
+ } else {
+ true
+ };
let reply = crate::modules::desktop::call(&self.config, member, request).await;
+ let reply = if goal_action {
+ match reply {
+ Ok(response) => {
+ let config = Arc::clone(&self.config);
+ advance_goal_confirmations(response, approvals_enabled, move |id, approve| {
+ let config = Arc::clone(&config);
+ async move {
+ crate::modules::desktop::call(
+ &config,
+ names::methods::RUN_GOAL,
+ json!({"continuation":{"id":id,"approve":approve}}),
+ )
+ .await
+ }
+ })
+ .await
+ }
+ Err(error) => Err(error),
+ }
+ } else {
+ reply
+ };
match reply {
Ok(response) if response.ok => {
let data = response.data.unwrap_or(Value::Null);
- if let Some((app, goal)) = goal_identity {
+ if let Some((app, goal)) = goal_identity.filter(|_| approvals_enabled) {
super::confirmation::record(&app, &goal, &data);
}
let rendered = serde_json::to_string(&data)?;
@@ -267,4 +410,129 @@ mod tests {
let result = tool.execute(json!({})).await.unwrap();
assert!(result.output().contains("disabled in Connections"));
}
+
+ #[test]
+ fn launch_tool_cannot_accept_process_arguments_or_environment() {
+ let tool = DesktopTool::new(Arc::new(Config::default()), DesktopToolKind::Launch);
+ let schema = tool.parameters_schema();
+ assert_eq!(tool.exposure(), ToolExposure::Deferred);
+ assert_eq!(tool.permission_level(), PermissionLevel::Write);
+ assert!(tool.external_effect());
+ assert_eq!(schema["required"], json!(["app"]));
+ assert!(schema["properties"].get("args").is_none());
+ assert!(schema["properties"].get("env").is_none());
+ assert!(schema["properties"].get("cdp_port").is_none());
+ }
+
+ #[test]
+ fn goal_and_continuation_have_distinct_required_inputs() {
+ let config = Arc::new(Config::default());
+ let goal = DesktopTool::new(config.clone(), DesktopToolKind::Goal);
+ let continuation = DesktopTool::new(config, DesktopToolKind::ContinueGoal);
+ assert_eq!(goal.parameters_schema()["required"], json!(["app", "goal"]));
+ assert!(goal.parameters_schema()["properties"]
+ .get("confirmation_id")
+ .is_none());
+ assert_eq!(
+ continuation.parameters_schema()["required"],
+ json!(["confirmation_id"])
+ );
+ assert!(continuation.parameters_schema()["properties"]
+ .get("approve")
+ .is_none());
+ assert!(super::super::confirmation::take_approved("unknown").is_err());
+ }
+
+ #[tokio::test]
+ async fn approvals_off_continues_one_use_handle_and_reports_module_result() {
+ assert!(!Config::default().desktop.approvals_enabled);
+ let called = Arc::new(std::sync::atomic::AtomicUsize::new(0));
+ let observed = Arc::clone(&called);
+ let initial = DesktopResponse::ok(
+ "run-goal",
+ json!({
+ "stop":"confirmation_required", "confirmation_id":"once"
+ }),
+ );
+ let result = advance_goal_confirmations(initial, false, move |id, approve| {
+ let observed = Arc::clone(&observed);
+ async move {
+ assert_eq!(id, "once");
+ assert!(approve);
+ observed.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
+ Ok(DesktopResponse::ok(
+ "run-goal",
+ json!({
+ "stop":"stale_target", "turns":[], "metrics":{"calls":1}
+ }),
+ ))
+ }
+ })
+ .await
+ .unwrap();
+ assert_eq!(called.load(std::sync::atomic::Ordering::SeqCst), 1);
+ assert_eq!(result.data.unwrap()["stop"], "stale_target");
+ }
+
+ #[tokio::test]
+ async fn approvals_on_returns_pending_without_self_approval() {
+ let initial = DesktopResponse::ok(
+ "run-goal",
+ json!({
+ "stop":"confirmation_required", "confirmation_id":"once"
+ }),
+ );
+ let result = advance_goal_confirmations(initial, true, |_id, _approve| async {
+ panic!("manual approval mode must never auto-continue")
+ })
+ .await
+ .unwrap();
+ assert_eq!(result.data.unwrap()["confirmation_id"], "once");
+ }
+
+ #[tokio::test]
+ async fn continuation_ceiling_returns_cancelled_result_with_all_executed_turns() {
+ let calls = Arc::new(std::sync::atomic::AtomicUsize::new(0));
+ let seen = Arc::clone(&calls);
+ let initial = DesktopResponse::ok(
+ "run-goal",
+ json!({
+ "stop":"confirmation_required", "confirmation_id":"id-0", "turns":[]
+ }),
+ );
+ let result = advance_goal_confirmations(initial, false, move |id, approve| {
+ let seen = Arc::clone(&seen);
+ async move {
+ let index = seen.fetch_add(1, std::sync::atomic::Ordering::SeqCst);
+ assert_eq!(id, format!("id-{index}"));
+ if approve {
+ Ok(DesktopResponse::ok(
+ "run-goal",
+ json!({
+ "stop":"confirmation_required",
+ "confirmation_id":format!("id-{}", index + 1),
+ "turns":vec![Value::Null; index + 1],
+ "metrics":{"calls":index + 1}
+ }),
+ ))
+ } else {
+ assert_eq!(index, 8);
+ Ok(DesktopResponse::ok(
+ "run-goal",
+ json!({
+ "stop":"cancelled", "turns":vec![Value::Null; 8],
+ "metrics":{"calls":8}
+ }),
+ ))
+ }
+ }
+ })
+ .await
+ .unwrap();
+ assert_eq!(calls.load(std::sync::atomic::Ordering::SeqCst), 9);
+ let data = result.data.unwrap();
+ assert_eq!(data["stop"], "cancelled");
+ assert_eq!(data["turns"].as_array().unwrap().len(), 8);
+ assert_eq!(data["metrics"]["calls"], 8);
+ }
}
diff --git a/crates/openhuman-core/src/desktop/mod.rs b/crates/openhuman-core/src/desktop/mod.rs
index 1a732f177d..2827d75b33 100644
--- a/crates/openhuman-core/src/desktop/mod.rs
+++ b/crates/openhuman-core/src/desktop/mod.rs
@@ -18,8 +18,8 @@
pub mod accessibility;
pub mod app_state;
-pub mod dashboard;
pub mod control;
+pub mod dashboard;
pub mod notifications;
pub mod overlay;
pub mod provider_surfaces;
diff --git a/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch.rs b/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch.rs
index ddc6fbf255..c798a88387 100644
--- a/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch.rs
+++ b/crates/openhuman-core/src/integrations/composio/connected_integrations/fetch.rs
@@ -72,12 +72,13 @@ pub async fn fetch_connected_integrations_status(
// credential. Asking the hosted integrations endpoint with it yields 401,
// can race the scheduler gate into signed-out state, and cannot discover a
// real connection. An authoritative empty set keeps this session local.
- if crate::security::credentials::session_support::get_session_token(config)
- .ok()
- .flatten()
- .is_some_and(|token| {
- crate::security::credentials::session_support::is_local_session_token(&token)
- })
+ if config.composio.mode.trim() != crate::config::schema::COMPOSIO_MODE_DIRECT
+ && crate::security::credentials::session_support::get_session_token(config)
+ .ok()
+ .flatten()
+ .is_some_and(|token| {
+ crate::security::credentials::session_support::is_local_session_token(&token)
+ })
{
return FetchConnectedIntegrationsStatus::Authoritative(Vec::new());
}
diff --git a/crates/openhuman-core/src/modules/registry.rs b/crates/openhuman-core/src/modules/registry.rs
index a134771436..57346f91d7 100644
--- a/crates/openhuman-core/src/modules/registry.rs
+++ b/crates/openhuman-core/src/modules/registry.rs
@@ -34,8 +34,8 @@
#[path = "registry_tests.rs"]
mod tests;
-mod records_docs_wallet;
mod records_desktop;
+mod records_docs_wallet;
mod records_extra;
mod records_mcp_connectors;
mod records_memory_juice;
@@ -43,8 +43,8 @@ mod records_runtime;
mod records_voice;
use crate::modules::types::ModuleRecord;
-use records_docs_wallet::{TINYDOCS, TINYWALLET};
use records_desktop::TINYDESKTOP;
+use records_docs_wallet::{TINYDOCS, TINYWALLET};
use records_extra::{TINYBOX, TINYCHANNELS, TINYHOSTS};
use records_mcp_connectors::{TINYCONNECTORS, TINYMCP};
use records_memory_juice::{TINYJUICE, TINYMEMORY};
diff --git a/crates/openhuman-core/src/modules/registry/records_desktop.rs b/crates/openhuman-core/src/modules/registry/records_desktop.rs
index 80d0eca357..99440acbcf 100644
--- a/crates/openhuman-core/src/modules/registry/records_desktop.rs
+++ b/crates/openhuman-core/src/modules/registry/records_desktop.rs
@@ -1,6 +1,6 @@
//! Native desktop module. Published digests are added only from its release manifest.
-use crate::modules::types::{LoadPolicy, ModuleRecord};
+use crate::modules::types::{LoadPolicy, ModuleRecord, PlatformAsset};
use tinydesktop_bus::names;
pub(crate) const TINYDESKTOP: ModuleRecord = ModuleRecord {
@@ -10,8 +10,44 @@ pub(crate) const TINYDESKTOP: ModuleRecord = ModuleRecord {
object_path: names::OBJECT_PATH,
version: "0.3.0",
release_url: "https://github.com/tinyhumansai/tinydesktop/releases/tag/v0.3.0",
- // The local override may be tested before publication. Do not derive a
- // release pin from that debug build: use the published checksum.toml.
- assets: &[],
+ // Verbatim from the published v0.3.0 checksum.toml. Linux remains outside
+ // the initial product surface; this registry admits macOS and Windows.
+ assets: &[
+ PlatformAsset {
+ host_key: "macos-26-arm64",
+ archive: "tinydesktop-0.3.0-macos-26-arm64.tar.gz",
+ sha256: "83d245497c15ee7a385d53cbd0f9b251b7ddc90c76b6bc2ec96b77b76cc909b7",
+ },
+ PlatformAsset {
+ host_key: "macos-26-x86_64",
+ archive: "tinydesktop-0.3.0-macos-26-x86_64.tar.gz",
+ sha256: "4aec4734420246fe1f67cce49eeb29975b03451bc6616cd4cac8171f4d0283d6",
+ },
+ PlatformAsset {
+ host_key: "macos-15-arm64",
+ archive: "tinydesktop-0.3.0-macos-15-arm64.tar.gz",
+ sha256: "fc9449083fe4030c77f910d5ebb609b881e4c51429689b710ae3623dd67e2b03",
+ },
+ PlatformAsset {
+ host_key: "macos-15-x86_64",
+ archive: "tinydesktop-0.3.0-macos-15-x86_64.tar.gz",
+ sha256: "d319d8a491496f3da8d7f2df58c08665e61f09e28474f6d88ccc38a1cf37bd38",
+ },
+ PlatformAsset {
+ host_key: "windows-2025-x86_64",
+ archive: "tinydesktop-0.3.0-windows-2025-x86_64.zip",
+ sha256: "bbb48068c87fb1321bb3b8eefc652fc1d40045b80b9357fb43cbc0a4e9833334",
+ },
+ PlatformAsset {
+ host_key: "windows-2022-x86_64",
+ archive: "tinydesktop-0.3.0-windows-2022-x86_64.zip",
+ sha256: "11975cb1d964665af3e1b3baada61f552ca3c55e2e1b4e550ecb39443fad9f9f",
+ },
+ PlatformAsset {
+ host_key: "windows-11-arm64",
+ archive: "tinydesktop-0.3.0-windows-11-arm64.zip",
+ sha256: "ada3f5f05d7bc7a00c5df4cb671f1988e3b86b8bf0ebfe9fa6ae2af2092c6f64",
+ },
+ ],
load: LoadPolicy::Lazy,
};
diff --git a/crates/openhuman-core/src/modules/registry_tests.rs b/crates/openhuman-core/src/modules/registry_tests.rs
index 265a1bd6dd..84697a7f2d 100644
--- a/crates/openhuman-core/src/modules/registry_tests.rs
+++ b/crates/openhuman-core/src/modules/registry_tests.rs
@@ -1,6 +1,19 @@
use super::{find, ALL};
use crate::modules::platform::candidates_for;
+#[test]
+fn tinydesktop_registry_matches_bus_contract_and_published_release() {
+ let desktop = find("tinydesktop").expect("compiled desktop module");
+ assert_eq!(desktop.bus_name, tinydesktop_bus::names::INTERFACE);
+ assert_eq!(desktop.object_path, tinydesktop_bus::names::OBJECT_PATH);
+ assert_eq!(desktop.version, "0.3.0");
+ assert_eq!(desktop.assets.len(), 7);
+ assert_eq!(
+ desktop.asset_for("macos-26-arm64").unwrap().sha256,
+ "83d245497c15ee7a385d53cbd0f9b251b7ddc90c76b6bc2ec96b77b76cc909b7"
+ );
+}
+
#[test]
fn ids_and_bus_names_are_unique() {
// Two records claiming one bus name is a conflict tinybus would only
diff --git a/crates/openhuman-core/src/tools/mod.rs b/crates/openhuman-core/src/tools/mod.rs
index 3f9558b6ae..341ab7b0e1 100644
--- a/crates/openhuman-core/src/tools/mod.rs
+++ b/crates/openhuman-core/src/tools/mod.rs
@@ -23,8 +23,8 @@ pub use crate::agent::tools::*;
pub use crate::config::tools::*;
pub use crate::config::workspace::tools::*;
pub use crate::cron::tools::*;
-pub use crate::desktop::dashboard::tools::*;
pub use crate::desktop::control::tools::*;
+pub use crate::desktop::dashboard::tools::*;
#[cfg(feature = "flows")]
pub use crate::flows::builder_tools::*;
#[cfg(feature = "flows")]
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index 88985298de..92946372fd 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -561,9 +561,14 @@ pub fn all_tools_with_runtime(
Box::new(DashboardModelHealthTool::new(config.clone())),
Box::new(DesktopTool::new(config.clone(), DesktopToolKind::Apps)),
Box::new(DesktopTool::new(config.clone(), DesktopToolKind::Windows)),
+ Box::new(DesktopTool::new(config.clone(), DesktopToolKind::Launch)),
Box::new(DesktopTool::new(config.clone(), DesktopToolKind::Snapshot)),
Box::new(DesktopTool::new(config.clone(), DesktopToolKind::Find)),
Box::new(DesktopTool::new(config.clone(), DesktopToolKind::Goal)),
+ Box::new(DesktopTool::new(
+ config.clone(),
+ DesktopToolKind::ContinueGoal,
+ )),
Box::new(SecurityPolicyInfoTool::new(config.clone())),
Box::new(ServiceStatusTool::new(config.clone())),
Box::new(DaemonHostPrefsGetTool::new(config.clone())),
diff --git a/crates/openhuman-core/src/tools/ops_tests_domain_family_tests.rs b/crates/openhuman-core/src/tools/ops_tests_domain_family_tests.rs
index f8e464c2c4..34dba9f809 100644
--- a/crates/openhuman-core/src/tools/ops_tests_domain_family_tests.rs
+++ b/crates/openhuman-core/src/tools/ops_tests_domain_family_tests.rs
@@ -574,9 +574,12 @@ fn desktop_tools_are_registered() {
let names = tool_names(&expansion_tools_for(&tmp));
assert_contains_all(&names, DESKTOP_TOOLS);
assert!(names.iter().any(|name| name == "desktop_goal"));
+ assert!(names.iter().any(|name| name == "desktop_launch"));
assert!(names.iter().any(|name| name == "desktop_snapshot"));
- assert!(!names.iter().any(|name| name == "desktop_act"),
- "raw ref actions must not enter the agent/tool_search registry");
+ assert!(
+ !names.iter().any(|name| name == "desktop_act"),
+ "raw ref actions must not enter the agent/tool_search registry"
+ );
}
#[test]
diff --git a/scripts/debug/desktop-live.mjs b/scripts/debug/desktop-live.mjs
index a767862a86..ded3000977 100644
--- a/scripts/debug/desktop-live.mjs
+++ b/scripts/debug/desktop-live.mjs
@@ -2,7 +2,7 @@
/**
* Opt-in core-only desktop smoke test against an already-running local core.
*
- * Prepare an empty, unsaved TextEdit document first. Set
+ * Prepare a disposable TextEdit document first for the textedit scenario. Set
* `[agent] tool_dispatcher = "native"` in the isolated config for an OpenRouter
* model that supports structured tool calls. Start the core with an
* isolated OPENHUMAN_WORKSPACE, an operator-supplied OPENHUMAN_CORE_TOKEN (so it
@@ -15,8 +15,8 @@
* The script prints only method names and counts. It never prints a prompt,
* transcript body, credential, accessibility value, or the random test marker.
* It makes three bounded orchestrator turns: discover/list apps, type into the
- * unsaved document through Jev, and read the value back through accessibility.
- * Clean up by closing the unsaved document without saving after the run.
+ * disposable document through Jev, and read the value back through accessibility.
+ * Clean up the disposable document after the run.
*/
import { createHash, randomUUID } from 'node:crypto';
@@ -56,6 +56,8 @@ const token = process.env.OPENHUMAN_CORE_TOKEN;
const openRouterKey = process.env.OPENROUTER_API_KEY;
const approveDisposable = process.argv.includes('--approve-disposable');
const localOfflineSession = process.argv.includes('--local-offline-session');
+const scenario = option('--scenario', 'textedit');
+if (!['textedit', 'spotify', 'spotify_pause'].includes(scenario)) fail('--scenario must be textedit, spotify, or spotify_pause');
if (!workspace || !model || !token) {
fail('Set --workspace, --model, and OPENHUMAN_CORE_TOKEN.');
}
@@ -124,6 +126,28 @@ function calls(messages) {
return names;
}
+function toolOutput(messages, wanted) {
+ const targets = new Map();
+ let result = null;
+ for (const message of messages) {
+ for (const call of message.tool_calls ?? []) {
+ if (call.name !== 'tool_call') continue;
+ let args = call.arguments;
+ if (typeof args === 'string') {
+ try { args = JSON.parse(args); } catch { args = {}; }
+ }
+ targets.set(call.id, args?.name);
+ }
+ if (message.role !== 'tool') continue;
+ try {
+ const wrapper = JSON.parse(message.content);
+ if (targets.get(wrapper.tool_call_id) !== wanted) continue;
+ result = typeof wrapper.content === 'string' ? JSON.parse(wrapper.content) : wrapper.content;
+ } catch { /* Non-JSON tool output is not a structured result. */ }
+ }
+ return result;
+}
+
const threadId = `desktop-live-${randomUUID()}`;
const marker = `OH desktop live ${randomUUID()}`;
const route = openRouterKey ? {
@@ -149,15 +173,21 @@ if (localOfflineSession) {
});
console.log('auth: isolated offline local session installed');
}
-const status = await rpc('openhuman.desktop_set_enabled', { enabled: true });
+let status = await rpc('openhuman.desktop_set_enabled', { enabled: true });
+for (let attempt = 0; status.module_state === 'loading' && attempt < 15; attempt++) {
+ await new Promise((resolve) => setTimeout(resolve, 2000));
+ status = await rpc('openhuman.desktop_status');
+}
if (!status.supported) fail('Desktop control is unsupported on this host.');
if (status.module_state === 'failed') fail('Desktop module failed to load; inspect local core logs.');
if (status.accessibility !== 'granted') fail('Grant Accessibility to the core process, then retry.');
-console.log(`desktop: module=${status.module_state}, accessibility=${status.accessibility}, jev_ready=${status.jev_ready}`);
+console.log(`desktop: module=${status.module_state}, accessibility=${status.accessibility}, jev_ready=${status.jev_ready}, approvals_enabled=${status.approvals_enabled}`);
if (!status.jev_ready) fail('No Jev credential is available to the core.');
+if (status.approvals_enabled !== false) fail('Live no-prompt run requires desktop approvals disabled.');
+const appName = scenario === 'textedit' ? 'TextEdit' : 'Spotify';
let transcript = await turn('discover',
- 'List the running desktop applications on this computer. Discover desktop tools with tool_search first, then call the matching desktop tool. Report only whether TextEdit is running.');
+ `List the running desktop applications on this computer. Discover desktop tools with tool_search first, then call the matching desktop tool. Report only whether ${appName} is running.`);
let names = calls(transcript);
if (!names.includes('tool_search') || !names.includes('desktop_list_apps')) {
fail(`discover: expected tool_search then desktop_list_apps; saw ${names.join(', ')}`);
@@ -165,20 +195,32 @@ if (!names.includes('tool_search') || !names.includes('desktop_list_apps')) {
console.log('discover: tool_search -> desktop_list_apps observed');
transcript = await turn('windows',
- 'Use the desktop window listing tool to list windows belonging to TextEdit. Do not change any app.');
+ `Use tool_search to find desktop_launch. Call desktop_launch with app ${appName} to activate its window, then call desktop_list_windows for ${appName}. Do not change app content.`);
names = calls(transcript);
+if (!names.includes('desktop_launch')) fail(`windows: desktop_launch was not called; saw ${names.join(', ')}`);
if (!names.includes('desktop_list_windows')) fail(`windows: desktop_list_windows was not called; saw ${names.join(', ')}`);
-console.log('windows: desktop_list_windows observed');
+console.log('windows: desktop_launch -> desktop_list_windows observed');
-transcript = await turn('type',
- `In the already open, empty, unsaved TextEdit document, type this exact marker: ${marker}. ` +
- 'Use tool_search to find desktop_goal and run the bounded goal with max_steps 4 and max_model_calls 8. Do not save or close the document.');
+transcript = await turn('goal', scenario !== 'textedit'
+ ? `In the running Spotify desktop app, ${scenario === 'spotify_pause' ? 'pause playback' : 'play the current track if paused'}. Use tool_search to find desktop_goal and run it with max_steps 4 and max_model_calls 8. Verify the player shows a ${scenario === 'spotify_pause' ? 'Play' : 'Pause'} control. Do not change playlists or account settings.`
+ : `In the already open disposable TextEdit document, append this exact marker: ${marker}. ` +
+ 'Use tool_search to find desktop_goal. Pass the marker as the first value in its text array, and run the bounded goal with max_steps 4 and max_model_calls 8. Do not save or close the document.');
names = calls(transcript);
-if (!names.includes('desktop_goal')) fail(`type: desktop_goal was not called; saw ${names.join(', ')}`);
+if (!names.includes('desktop_goal')) fail(`goal: desktop_goal was not called; saw ${names.join(', ')}`);
+const goalResult = toolOutput(transcript, 'desktop_goal');
+if (!goalResult || goalResult.turns?.length < 1) {
+ fail('goal: no desktop action was executed; an observed app state alone is insufficient');
+}
+if (goalResult) console.log(`goal: stop=${goalResult.stop}, executed_steps=${goalResult.turns?.length ?? 0}, jev_calls=${goalResult.metrics?.calls ?? 0}`);
const pending = await rpc('openhuman.desktop_pending');
+const genericPending = await rpc('openhuman.approval_list_pending');
+const genericRows = Array.isArray(genericPending) ? genericPending : genericPending?.result;
+if (!Array.isArray(genericRows) || genericRows.length !== 0) {
+ fail('An OpenHuman generic approval request was left pending during the desktop goal.');
+}
if (Array.isArray(pending) && pending.length > 0) {
- console.log(`type: ${pending.length} action(s) paused for user confirmation`);
+ console.log(`goal: ${pending.length} action(s) paused for user confirmation`);
if (!approveDisposable) {
fail('Inspect the pending action in Connections. Rerun with --approve-disposable only for a disposable TextEdit document.');
}
@@ -190,17 +232,18 @@ if (Array.isArray(pending) && pending.length > 0) {
});
transcript = await turn('continue',
`Continue the previously paused TextEdit desktop goal using confirmation_id ${pending[0].confirmation_id}. ` +
- 'The user approved the action in the trusted connection UI. Call desktop_goal with only that confirmation_id; the core restores the original goal.');
- if (!calls(transcript).includes('desktop_goal')) fail('continue: desktop_goal was not called');
- console.log('continue: trusted confirmation consumed by agent desktop_goal call');
+ 'The user approved the action in the trusted connection UI. Use tool_search to find desktop_continue_goal and call it with only that confirmation_id; the core restores the original goal.');
+ if (!calls(transcript).includes('desktop_continue_goal')) fail('continue: desktop_continue_goal was not called');
+ console.log('continue: trusted confirmation consumed by agent desktop_continue_goal call');
}
-transcript = await turn('verify',
- 'Read the full accessibility snapshot of the current TextEdit document using desktop_snapshot with skeleton false. Do not change the document.');
+transcript = await turn('verify', scenario !== 'textedit'
+ ? `Read the full accessibility snapshot of the Spotify player using desktop_snapshot with skeleton false. Do not change playback. Report whether a ${scenario === 'spotify_pause' ? 'Play' : 'Pause'} control is visible.`
+ : 'Read the full accessibility snapshot of the current TextEdit document using desktop_snapshot with skeleton false. Do not change the document.');
names = calls(transcript);
if (!names.includes('desktop_snapshot')) fail(`verify: desktop_snapshot was not called; saw ${names.join(', ')}`);
const observed = transcript.some((message) => message.role === 'tool' &&
- JSON.stringify(message.content ?? '').includes(marker));
-if (!observed) fail('verify: marker was not observed in a desktop tool result');
-console.log('verify: marker observed in desktop_snapshot tool result');
-console.log('PASS: direct-core orchestrator discovered and used desktop tools; close the unsaved TextEdit document without saving.');
+ JSON.stringify(message.content ?? '').includes(scenario === 'textedit' ? marker : scenario === 'spotify_pause' ? 'Play' : 'Pause'));
+if (!observed) fail(`verify: ${scenario === 'textedit' ? 'marker' : scenario === 'spotify_pause' ? 'Play control' : 'Pause control'} was not observed in a desktop tool result`);
+console.log(`verify: ${scenario === 'textedit' ? 'marker' : scenario === 'spotify_pause' ? 'Play control' : 'Pause control'} observed in desktop_snapshot tool result`);
+console.log(`PASS: direct-core orchestrator discovered and used desktop tools${scenario === 'textedit' ? '; clean up the disposable TextEdit document' : ''}.`);