@0xmaxma/claude-gateway 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/README.md +1 -0
  2. package/config.template.json +1 -1
  3. package/dist/agent/dreaming/index.d.ts +6 -0
  4. package/dist/agent/dreaming/index.d.ts.map +1 -1
  5. package/dist/agent/dreaming/index.js +3 -3
  6. package/dist/agent/dreaming/index.js.map +1 -1
  7. package/dist/agent/runner.d.ts +10 -1
  8. package/dist/agent/runner.d.ts.map +1 -1
  9. package/dist/agent/runner.js +23 -12
  10. package/dist/agent/runner.js.map +1 -1
  11. package/dist/agent/workspace-loader.d.ts +40 -1
  12. package/dist/agent/workspace-loader.d.ts.map +1 -1
  13. package/dist/agent/workspace-loader.js +100 -6
  14. package/dist/agent/workspace-loader.js.map +1 -1
  15. package/dist/api/cron-router.d.ts.map +1 -1
  16. package/dist/api/cron-router.js +3 -2
  17. package/dist/api/cron-router.js.map +1 -1
  18. package/dist/api/gateway-router.d.ts.map +1 -1
  19. package/dist/api/gateway-router.js +11 -2
  20. package/dist/api/gateway-router.js.map +1 -1
  21. package/dist/api/router.d.ts.map +1 -1
  22. package/dist/api/router.js +40 -5
  23. package/dist/api/router.js.map +1 -1
  24. package/dist/api/share-router.d.ts +1 -1
  25. package/dist/api/share-router.d.ts.map +1 -1
  26. package/dist/api/share-router.js +14 -5
  27. package/dist/api/share-router.js.map +1 -1
  28. package/dist/api/voice-call-router.d.ts.map +1 -1
  29. package/dist/api/voice-call-router.js +8 -5
  30. package/dist/api/voice-call-router.js.map +1 -1
  31. package/dist/api/voice-router.js +1 -1
  32. package/dist/api/voice-router.js.map +1 -1
  33. package/dist/api/voice-settings-router.d.ts.map +1 -1
  34. package/dist/api/voice-settings-router.js +15 -0
  35. package/dist/api/voice-settings-router.js.map +1 -1
  36. package/dist/apps/agent-manager.d.ts +9 -0
  37. package/dist/apps/agent-manager.d.ts.map +1 -1
  38. package/dist/apps/agent-manager.js +38 -0
  39. package/dist/apps/agent-manager.js.map +1 -1
  40. package/dist/apps/compose-generator.d.ts +8 -0
  41. package/dist/apps/compose-generator.d.ts.map +1 -1
  42. package/dist/apps/compose-generator.js +9 -3
  43. package/dist/apps/compose-generator.js.map +1 -1
  44. package/dist/apps/conversation-sandbox.d.ts +78 -0
  45. package/dist/apps/conversation-sandbox.d.ts.map +1 -0
  46. package/dist/apps/conversation-sandbox.js +357 -0
  47. package/dist/apps/conversation-sandbox.js.map +1 -0
  48. package/dist/apps/installer.d.ts +2 -0
  49. package/dist/apps/installer.d.ts.map +1 -1
  50. package/dist/apps/installer.js +5 -0
  51. package/dist/apps/installer.js.map +1 -1
  52. package/dist/apps/registry.d.ts +2 -0
  53. package/dist/apps/registry.d.ts.map +1 -1
  54. package/dist/build-provenance.json +4 -4
  55. package/dist/config/agent-lifecycle.d.ts +4 -2
  56. package/dist/config/agent-lifecycle.d.ts.map +1 -1
  57. package/dist/config/agent-lifecycle.js +11 -3
  58. package/dist/config/agent-lifecycle.js.map +1 -1
  59. package/dist/config/loader.d.ts.map +1 -1
  60. package/dist/config/loader.js +13 -0
  61. package/dist/config/loader.js.map +1 -1
  62. package/dist/config/migrator.d.ts +2 -0
  63. package/dist/config/migrator.d.ts.map +1 -1
  64. package/dist/config/migrator.js +37 -1
  65. package/dist/config/migrator.js.map +1 -1
  66. package/dist/config/reload-policy.d.ts.map +1 -1
  67. package/dist/config/reload-policy.js +5 -0
  68. package/dist/config/reload-policy.js.map +1 -1
  69. package/dist/cron/manager.d.ts +15 -0
  70. package/dist/cron/manager.d.ts.map +1 -1
  71. package/dist/cron/manager.js +53 -1
  72. package/dist/cron/manager.js.map +1 -1
  73. package/dist/index.js +49 -9
  74. package/dist/index.js.map +1 -1
  75. package/dist/orchestration/bridge.d.ts +6 -0
  76. package/dist/orchestration/bridge.d.ts.map +1 -1
  77. package/dist/orchestration/bridge.js +32 -10
  78. package/dist/orchestration/bridge.js.map +1 -1
  79. package/dist/orchestration/capabilities.d.ts.map +1 -1
  80. package/dist/orchestration/capabilities.js +2 -0
  81. package/dist/orchestration/capabilities.js.map +1 -1
  82. package/dist/orchestration/config.js +1 -1
  83. package/dist/orchestration/config.js.map +1 -1
  84. package/dist/orchestration/container.d.ts.map +1 -1
  85. package/dist/orchestration/container.js +51 -2
  86. package/dist/orchestration/container.js.map +1 -1
  87. package/dist/orchestration/context-footprint.d.ts +8 -1
  88. package/dist/orchestration/context-footprint.d.ts.map +1 -1
  89. package/dist/orchestration/context-footprint.js +27 -9
  90. package/dist/orchestration/context-footprint.js.map +1 -1
  91. package/dist/orchestration/dashboard-reader-worker.js +1 -1
  92. package/dist/orchestration/dashboard-reader-worker.js.map +1 -1
  93. package/dist/orchestration/recovery.d.ts.map +1 -1
  94. package/dist/orchestration/recovery.js +30 -0
  95. package/dist/orchestration/recovery.js.map +1 -1
  96. package/dist/orchestration/report-promise.d.ts +9 -0
  97. package/dist/orchestration/report-promise.d.ts.map +1 -0
  98. package/dist/orchestration/report-promise.js +39 -0
  99. package/dist/orchestration/report-promise.js.map +1 -0
  100. package/dist/orchestration/restart-resume.d.ts +19 -0
  101. package/dist/orchestration/restart-resume.d.ts.map +1 -0
  102. package/dist/orchestration/restart-resume.js +53 -0
  103. package/dist/orchestration/restart-resume.js.map +1 -0
  104. package/dist/orchestration/runtime.d.ts +3 -0
  105. package/dist/orchestration/runtime.d.ts.map +1 -1
  106. package/dist/orchestration/runtime.js +35 -8
  107. package/dist/orchestration/runtime.js.map +1 -1
  108. package/dist/orchestration/source-policy.d.ts +2 -0
  109. package/dist/orchestration/source-policy.d.ts.map +1 -1
  110. package/dist/orchestration/source-policy.js +3 -1
  111. package/dist/orchestration/source-policy.js.map +1 -1
  112. package/dist/orchestration/task-files.d.ts +2 -0
  113. package/dist/orchestration/task-files.d.ts.map +1 -1
  114. package/dist/orchestration/task-files.js +17 -6
  115. package/dist/orchestration/task-files.js.map +1 -1
  116. package/dist/orchestration/tasks/driver.d.ts +1 -0
  117. package/dist/orchestration/tasks/driver.d.ts.map +1 -1
  118. package/dist/orchestration/tasks/driver.js +34 -4
  119. package/dist/orchestration/tasks/driver.js.map +1 -1
  120. package/dist/orchestration/tasks/failure.js +1 -1
  121. package/dist/orchestration/tasks/failure.js.map +1 -1
  122. package/dist/orchestration/tasks/scheduler.d.ts +2 -0
  123. package/dist/orchestration/tasks/scheduler.d.ts.map +1 -1
  124. package/dist/orchestration/tasks/scheduler.js +38 -27
  125. package/dist/orchestration/tasks/scheduler.js.map +1 -1
  126. package/dist/orchestration/tasks/service.d.ts +4 -0
  127. package/dist/orchestration/tasks/service.d.ts.map +1 -1
  128. package/dist/orchestration/tasks/service.js +53 -1
  129. package/dist/orchestration/tasks/service.js.map +1 -1
  130. package/dist/orchestration/types.d.ts +13 -0
  131. package/dist/orchestration/types.d.ts.map +1 -1
  132. package/dist/orchestration/types.js.map +1 -1
  133. package/dist/session/process.d.ts +37 -2
  134. package/dist/session/process.d.ts.map +1 -1
  135. package/dist/session/process.js +171 -31
  136. package/dist/session/process.js.map +1 -1
  137. package/dist/share/share-store.d.ts +10 -1
  138. package/dist/share/share-store.d.ts.map +1 -1
  139. package/dist/share/share-store.js +42 -1
  140. package/dist/share/share-store.js.map +1 -1
  141. package/dist/types.d.ts +15 -0
  142. package/dist/types.d.ts.map +1 -1
  143. package/dist/ui/voice-call-client.d.ts +27 -14
  144. package/dist/ui/voice-call-client.d.ts.map +1 -1
  145. package/dist/ui/voice-call-client.js +80 -24
  146. package/dist/ui/voice-call-client.js.map +1 -1
  147. package/dist/ui/voice-call-ui.d.ts +4 -1
  148. package/dist/ui/voice-call-ui.d.ts.map +1 -1
  149. package/dist/ui/voice-call-ui.js +65 -21
  150. package/dist/ui/voice-call-ui.js.map +1 -1
  151. package/dist/voice/errors.js +1 -1
  152. package/dist/voice/errors.js.map +1 -1
  153. package/dist/voice/notes.d.ts +4 -3
  154. package/dist/voice/notes.d.ts.map +1 -1
  155. package/dist/voice/notes.js +14 -11
  156. package/dist/voice/notes.js.map +1 -1
  157. package/dist/voice/telegram-avatar.d.ts +6 -2
  158. package/dist/voice/telegram-avatar.d.ts.map +1 -1
  159. package/dist/voice/telegram-avatar.js +23 -10
  160. package/dist/voice/telegram-avatar.js.map +1 -1
  161. package/dist/voice/turn-manager.d.ts.map +1 -1
  162. package/dist/voice/turn-manager.js +1 -1
  163. package/dist/voice/turn-manager.js.map +1 -1
  164. package/dist/voice/types.d.ts +3 -0
  165. package/dist/voice/types.d.ts.map +1 -1
  166. package/dist/voice/types.js +4 -0
  167. package/dist/voice/types.js.map +1 -1
  168. package/mcp/modules.ts +13 -1
  169. package/mcp/tools/agent/module.ts +3 -1
  170. package/mcp/tools/api/module.ts +9 -1
  171. package/mcp/tools/apps/module.ts +4 -2
  172. package/mcp/tools/apps/skills/create-app-yaml/SKILL.md +1 -1
  173. package/mcp/tools/apps/skills/install-app/SKILL.md +2 -1
  174. package/mcp/tools/cron/module.ts +3 -0
  175. package/mcp/tools/discord/module.ts +44 -11
  176. package/mcp/tools/line/module.ts +11 -0
  177. package/mcp/tools/memory/disable-archive.test.ts +47 -0
  178. package/mcp/tools/memory/isolate-memory.test.ts +95 -0
  179. package/mcp/tools/memory/module.ts +4 -1
  180. package/mcp/tools/shared/isolate.ts +77 -0
  181. package/mcp/tools/shared/share-client.ts +15 -1
  182. package/mcp/tools/skills/module.ts +4 -2
  183. package/mcp/tools/slack/module.ts +12 -5
  184. package/mcp/tools/tasks/module.ts +1 -1
  185. package/mcp/tools/telegram/attachment-log.ts +39 -0
  186. package/mcp/tools/telegram/module.ts +27 -11
  187. package/mcp/tools/telegram/receiver-server.ts +8 -0
  188. package/mcp/tools/wechat/module.ts +2 -0
  189. package/mcp/tools/whatsapp/module.ts +8 -1
  190. package/mcp/tools/whatsapp-cloud/module.ts +14 -7
  191. package/package.json +1 -1
@@ -53,6 +53,7 @@ const telegram_voices_1 = require("./telegram-voices");
53
53
  const stop_controls_1 = require("./stop-controls");
54
54
  const config_1 = require("../agent/dreaming/config");
55
55
  const container_1 = require("./container");
56
+ const conversation_sandbox_1 = require("../apps/conversation-sandbox");
56
57
  const conversation_intake_1 = require("./conversation-intake");
57
58
  const agent_cli_session_1 = require("./agent-cli-session");
58
59
  const claude_settings_1 = require("../config/claude-settings");
@@ -88,6 +89,8 @@ const process_turn_1 = require("./process-turn");
88
89
  const types_2 = require("./types");
89
90
  const automation_session_1 = require("./tasks/automation-session");
90
91
  const recovery_1 = require("./recovery");
92
+ const restart_resume_1 = require("./restart-resume");
93
+ const report_promise_1 = require("./report-promise");
91
94
  const instance_lock_1 = require("./instance-lock");
92
95
  const delivery_1 = require("./delivery");
93
96
  const knowledge_1 = require("../agent/knowledge");
@@ -264,7 +267,7 @@ class AgentOrchestrationRuntime {
264
267
  };
265
268
  gatewayAdapters.set('browser', new browser_1.BrowserTaskAdapter({ agentId: agent.id, root: (0, path_1.join)(root, 'browser-requests'),
266
269
  stepMode: () => gateway.gateway.jev?.features?.browserSteps?.enabled === true, settled: () => gatewayTick.run(), userSteps,
267
- allowed: () => (0, jev_gateway_1.jevAllowed)(gateway, agent) && gateway.gateway.jev?.features?.browserTasks?.enabled === true,
270
+ allowed: () => !agent.isolateMemory && (0, jev_gateway_1.jevAllowed)(gateway, agent) && gateway.gateway.jev?.features?.browserTasks?.enabled === true,
268
271
  bindings: browserBindings,
269
272
  refreshBindings: async (context, signal) => { store.assertMember(context.conversationId, context.principalId); await automaticBrowsers.refresh(context.principalId, context.conversationId, context.execute, () => { try {
270
273
  store.assertMember(context.conversationId, context.principalId);
@@ -320,7 +323,9 @@ class AgentOrchestrationRuntime {
320
323
  return false;
321
324
  } }
322
325
  }) }));
323
- const computerAllowed = () => (0, jev_gateway_1.computerDecisions)(gateway, agent) !== undefined;
326
+ // Isolate mode (#609) is default-deny: one browser profile and one computer serve
327
+ // every conversation, so neither is offered to an isolated agent.
328
+ const computerAllowed = () => !agent.isolateMemory && (0, jev_gateway_1.computerDecisions)(gateway, agent) !== undefined;
324
329
  gatewayAdapters.set('computer', new computer_1.ComputerTaskAdapter({ agentId: agent.id, root: (0, path_1.join)(root, 'computer-requests'), connectors: new computer_connector_1.ComputerConnectors(gateway, agent), allowed: computerAllowed,
325
330
  stepMode: () => gateway.gateway.jev?.features?.computerSteps?.enabled === true, settled: () => gatewayTick.run(),
326
331
  userSteps,
@@ -363,7 +368,7 @@ class AgentOrchestrationRuntime {
363
368
  bridge.computerEnabled = computerAllowed;
364
369
  bridge.models = () => (0, model_registry_1.selectableModels)(gateway.gateway.models);
365
370
  bridge.jevEnabled = () => (0, jev_gateway_1.jevAllowed)(gateway, agent);
366
- bridge.browserEnabled = () => Boolean(gateway.gateway.jev?.browser) && (0, jev_gateway_1.jevAllowed)(gateway, agent) && gateway.gateway.jev?.features?.browserTasks?.enabled === true;
371
+ bridge.browserEnabled = () => !agent.isolateMemory && Boolean(gateway.gateway.jev?.browser) && (0, jev_gateway_1.jevAllowed)(gateway, agent) && gateway.gateway.jev?.features?.browserTasks?.enabled === true;
367
372
  bridge.jevCall = async (scope, args, actionId, signal) => {
368
373
  const current = scope.role === 'worker' ? files.scope(scope.attemptId, scope.generation) : undefined;
369
374
  const conversation = scope.role === 'agent' ? store.assertMember(scope.context.conversationId, scope.context.principalId) : current.conversation;
@@ -391,6 +396,8 @@ class AgentOrchestrationRuntime {
391
396
  const personalRetention = (0, config_1.resolveDreamingConfig)(agent.dreaming, gateway.gateway.dreaming, gateway.gateway.timezone).staleness;
392
397
  const sharedRetention = (0, knowledge_1.resolveSharedConfig)(agent.knowledge?.shared, gateway.gateway.knowledge?.shared).staleness;
393
398
  bridge.recordRetrievals = (personalRetention.enabled && personalRetention.recordRetrievals) || (sharedRetention.enabled && sharedRetention.recordRetrievals);
399
+ bridge.isolateMemory = files.isolateMemory = () => Boolean(agent.isolateMemory);
400
+ bridge.disableArchive = () => Boolean(agent.disableArchive);
394
401
  let admissionStore;
395
402
  try {
396
403
  (0, recovery_1.recoverOrchestration)(store);
@@ -675,6 +682,11 @@ class AgentOrchestrationRuntime {
675
682
  this.store.appendEvent(String(conversation.id), 'session.context_reset', { sessionId, historyLimit: 50 });
676
683
  });
677
684
  }
685
+ /** The container a conversation's Claude Code transcript lives in: its own sandbox
686
+ * for an isolated app agent (#609), whose HOME no other conversation shares. */
687
+ executionAgent(source, chatId, sessionId) {
688
+ return (0, conversation_sandbox_1.usesConversationSandbox)(this.agent) ? (0, conversation_sandbox_1.sandboxedAgent)(this.agent, { source, chatId, sessionId }) : Promise.resolve(this.agent);
689
+ }
678
690
  /** An exclusive maintenance operation on the existing CLI transcript, not a chat summary. */
679
691
  compactSession(sessionId, model) {
680
692
  if (this.closing || this.draining)
@@ -692,7 +704,7 @@ class AgentOrchestrationRuntime {
692
704
  let revoke;
693
705
  try {
694
706
  const cli = this.agent.type === 'app-agent'
695
- ? await this.cliSessions.resolveContainer(sessionId, this.agent, true)
707
+ ? await this.cliSessions.resolveContainer(sessionId, await this.executionAgent(String(conversation.source), String(conversation.chat_id), sessionId), true)
696
708
  : this.cliSessions.resolve(sessionId, this.agent.workspace, true);
697
709
  if (!cli.resume || cli.id !== stored.cli_session_id)
698
710
  throw new types_2.OrchestrationError('NO_CLI_SESSION', 'The previous Claude Code transcript is unavailable. Chat history was not changed.');
@@ -1237,7 +1249,7 @@ class AgentOrchestrationRuntime {
1237
1249
  const supervision = monitor ? `This task is due for a routine progress update. Inspect fresh task_status including workflow evidenceVersion, checks and open findings. Treat latestProgress as historical when newer tools or checkpoints exist; request a current checkpoint if phase/evidence is unknown. Never assert an old workaround is correct or prohibit investigation based only on an old report. Report only new completed steps, the current step and any concrete blocker. An idle tool snapshot only means no tool was observed executing; it does not reveal what the worker is thinking or prove health. Do not infer the cause of a tool error without its error evidence. Do not volunteer claims that it is not stuck, not frozen, or really running; discuss a stall only when the user asks or evidence establishes a specific problem. If useful, call task_update ONLY for task ${monitor.id}, mode=when_ready, with planning advice to improve the existing approach. On this reporting turn that tool appends advice; it cannot replace the original goal or authorize new work. Do not spawn, restart or cancel work automatically, and do not mistake normal polling for a proven stall. ` : '';
1238
1250
  this.store.acceptInput({ scope: { agentId: this.agent.id, agentSessionId: String(row.agent_session_id), source: row.source,
1239
1251
  accountId: String(row.account_id), chatId: String(row.chat_id), threadKey: String(row.thread_key), principalId: String(row.owner_principal_id) },
1240
- text: controlStep ? `You are controlling task ${controlStep.id} for the user. Its last action has settled. If Fresh computer control evidence is attached to this turn, inspect that image and state directly; do not make a duplicate task_status call unless the evidence is insufficient or has changed. Otherwise inspect task_status with browser_evidence=screenshot (computer_evidence=screenshot for a computer task). Use that evidence to choose and send ONE next concrete instruction with task_update mode=when_ready on the SAME task. Use one UI operation or one field edit per instruction, not a multi-field recipe. For a known text value, supply computer_inputs with the observed application, label, role and windowTitle so text does not need to be inferred again. The type operation REPLACES the entire editable field; it does not append at the caret. For an observed field that offers type, request the field edit directly: the native helper focuses and verifies the target before typing. Do not routinely add a separate press just to focus it. A separate press may be needed when the field does not offer type yet or a prior not-executed result reports unsupported focus; inspect fresh evidence first. For a multiline note or document, supply the complete desired contents in one field edit, preserving the other wanted lines. Do not build it by repeated type/Enter commands. For computer tasks, press means click/focus a control, NOT press Enter. Use a distinct key action to submit or navigate the current non-sensitive focus: enter, tab, escape, up, down, left, right. These keyboard actions are supported separately from the control actions and scroll/navigation capabilities in the observation. Typing a cell address or search text does not submit it; request key enter when appropriate after verifying focus. Use only observed control targets and supported actions. Keep reasoning short for routine steps: inspect current evidence, choose the next step, submit it. Keep the overall user objective from conversation; do not repeat completed steps. If the overall request is fulfilled, leave the session idle and report the supported result. If required information or consent is missing, ask. Do not merely announce that the loop is waiting, ask the user to say continue, or claim success from an action receipt alone. Unknown mutations must be reconciled before any action. TARGET_OCCLUDED means the intended pointer point was covered and no click was dispatched; inspect current evidence and move the target into an unobstructed part of the viewport (for example by scrolling) before retrying. Do not blame changing text or retry an unchanged covered point. After task_update succeeds, END THIS TURN immediately with an empty final response. Do not poll or issue another command in this turn: the next result schedules a fresh authorized notification. Routine intermediate steps can be silent.` : supervision + 'Report the persisted task status update as your own work, preserving your persona. Write a concise, natural first-person progress update in the existing persona: what you have completed, what you are doing now, and any concrete blocker. Use direct sentences such as "I have fixed both issues and the tests pass. I am now reviewing the PR diff." rather than labels such as "What is happening now:" or an outside observer account. Do not narrate receiving a worker report, forwarding instructions, or waiting for a summary to come back. Mention only meaningful new progress; do not repeat the entire root-cause analysis in every update unless asked. State the current action directly when supported by recent evidence. If an action is only planned, describe it as the next step, not as already happening; do not turn guesses into facts or claim a PR was opened or merged without confirmation. If a task was cancelled, briefly confirm which task stopped. Describe cancellation neutrally as the end of the task or session; for Computer Use, say the Computer Use session has ended. Do not tell the user they cancelled it, attribute blame, or repeat who requested the stop. Do not describe it as an execution failure. Summarize only observed actions, not unverified success. Do not retry or restart it. If cancellation is still pending, say stopping, not stopped. Do not start tasks or change their goal. A progress-alert turn may append scoped planning advice as described above. Browser exception: before reporting a low-confidence, stale-page, model-blocked, NO_PROGRESS, NO_SUPPORTED_ACTION, TEXT_BUDGET, OBSERVATION_TRUNCATED stop or completion candidate, call task_status(browser_evidence=fresh) for the assigned browser task. If fresh evidence proves completion, use task_update(mode=verify_browser); otherwise use task_update(mode=when_ready) with concrete guidance within the existing authorization and recovery budget. This is continuation of the same authorized goal, not permission to spawn new work or change the goal. Never replay an unknown mutation or retry a provider failure. Only report a blocker after inspecting it and exhausting the permitted recovery, or ask for genuinely missing facts/consent. Other tasks remain reporting-only by design, not an execution outage. OBSERVATION_TRUNCATED means some controls may be omitted, not that every observed control is unusable. Inspect fresh controls and guide the same task toward a visible search/filter/input or a different viewport. Do not infer anti-automation blocking from NO_PROGRESS, MODEL_BLOCKED or NO_SUPPORTED_ACTION alone; these describe loop decisions, not independently observed website denial. Before saying you will retry or asking the user to wait, commit task_update(mode=when_ready) successfully and check the returned task state. If it was rejected, handle the actual rejection; never claim a retry is pending. Do not promise an automatic future retry or claim the execution system is unavailable. When reporting completion, inspect current task states: distinguish the finished investigation from an implementation merely proposed in its result. If no follow-up task is queued or running, say that this stage is complete and the proposed next step has not started. Do not promise to continue or imply background work without a committed task receipt. Preserve the original user scope; a request to investigate does not itself authorize edits or deployment. If a genuinely new decision is needed, ask it clearly instead of ending with an ambiguous future-work statement. If a worker repeats an answered question, explain the specific unresolved discrepancy instead of asking the user to repeat the same approval.', storeUserMessage: false,
1252
+ text: controlStep ? `You are controlling task ${controlStep.id} for the user. Its last action has settled. If Fresh computer control evidence is attached to this turn, inspect that image and state directly; do not make a duplicate task_status call unless the evidence is insufficient or has changed. Otherwise inspect task_status with browser_evidence=screenshot (computer_evidence=screenshot for a computer task). Use that evidence to choose and send ONE next concrete instruction with task_update mode=when_ready on the SAME task. Use one UI operation or one field edit per instruction, not a multi-field recipe. For a known text value, supply computer_inputs with the observed application, label, role and windowTitle so text does not need to be inferred again. The type operation REPLACES the entire editable field; it does not append at the caret. For an observed field that offers type, request the field edit directly: the native helper focuses and verifies the target before typing. Do not routinely add a separate press just to focus it. A separate press may be needed when the field does not offer type yet or a prior not-executed result reports unsupported focus; inspect fresh evidence first. For a multiline note or document, supply the complete desired contents in one field edit, preserving the other wanted lines. Do not build it by repeated type/Enter commands. For computer tasks, press means click/focus a control, NOT press Enter. Use a distinct key action to submit or navigate the current non-sensitive focus: enter, tab, escape, up, down, left, right. These keyboard actions are supported separately from the control actions and scroll/navigation capabilities in the observation. Typing a cell address or search text does not submit it; request key enter when appropriate after verifying focus. Use only observed control targets and supported actions. Keep reasoning short for routine steps: inspect current evidence, choose the next step, submit it. Keep the overall user objective from conversation; do not repeat completed steps. If the overall request is fulfilled, leave the session idle and report the supported result. If required information or consent is missing, ask. Do not merely announce that the loop is waiting, ask the user to say continue, or claim success from an action receipt alone. Unknown mutations must be reconciled before any action. TARGET_OCCLUDED means the intended pointer point was covered and no click was dispatched; inspect current evidence and move the target into an unobstructed part of the viewport (for example by scrolling) before retrying. Do not blame changing text or retry an unchanged covered point. After task_update succeeds, END THIS TURN immediately with an empty final response. Do not poll or issue another command in this turn: the next result schedules a fresh authorized notification. Routine intermediate steps can be silent.` : supervision + 'Report the persisted task status update as your own work, preserving your persona. Write a concise, natural first-person progress update in the existing persona: what you have completed, what you are doing now, and any concrete blocker. Use direct sentences such as "I have fixed both issues and the tests pass. I am now reviewing the PR diff." rather than labels such as "What is happening now:" or an outside observer account. Do not narrate receiving a worker report, forwarding instructions, or waiting for a summary to come back. Mention only meaningful new progress; do not repeat the entire root-cause analysis in every update unless asked. State the current action directly when supported by recent evidence. If an action is only planned, describe it as the next step, not as already happening; do not turn guesses into facts or claim a PR was opened or merged without confirmation. If a task was cancelled, briefly confirm which task stopped. Describe cancellation neutrally as the end of the task or session; for Computer Use, say the Computer Use session has ended. Do not tell the user they cancelled it, attribute blame, or repeat who requested the stop. Do not describe it as an execution failure. Summarize only observed actions, not unverified success. Do not retry or restart it. If cancellation is still pending, say stopping, not stopped. Do not start tasks or change their goal. A progress-alert turn may append scoped planning advice as described above. Browser exception: before reporting a low-confidence, stale-page, model-blocked, NO_PROGRESS, NO_SUPPORTED_ACTION, TEXT_BUDGET, OBSERVATION_TRUNCATED stop or completion candidate, call task_status(browser_evidence=fresh) for the assigned browser task. If fresh evidence proves completion, use task_update(mode=verify_browser); otherwise use task_update(mode=when_ready) with concrete guidance within the existing authorization and recovery budget. This is continuation of the same authorized goal, not permission to spawn new work or change the goal. Never replay an unknown mutation or retry a provider failure. Only report a blocker after inspecting it and exhausting the permitted recovery, or ask for genuinely missing facts/consent. Other tasks remain reporting-only by design, not an execution outage. OBSERVATION_TRUNCATED means some controls may be omitted, not that every observed control is unusable. Inspect fresh controls and guide the same task toward a visible search/filter/input or a different viewport. Do not infer anti-automation blocking from NO_PROGRESS, MODEL_BLOCKED or NO_SUPPORTED_ACTION alone; these describe loop decisions, not independently observed website denial. Before saying you will retry or asking the user to wait, commit task_update(mode=when_ready) successfully and check the returned task state. If it was rejected, handle the actual rejection; never claim a retry is pending. Do not promise an automatic future retry or claim the execution system is unavailable. When reporting completion, inspect current task states: distinguish the finished investigation from an implementation merely proposed in its result. If no follow-up task is queued or running, say that this stage is complete and the proposed next step has not started. Do not promise to continue or imply background work without a committed task receipt. Preserve the original user scope; a request to investigate does not itself authorize edits or deployment. ' + restart_resume_1.INTERRUPTED_WORK_REPORT_RULE + ' If a genuinely new decision is needed, ask it clearly instead of ending with an ambiguous future-work statement. If a worker repeats an answered question, explain the specific unresolved discrepancy instead of asking the user to repeat the same approval.', storeUserMessage: false,
1241
1253
  modality: (this.voiceListeners.get(String(row.agent_session_id))?.principalId === row.owner_principal_id || new browser_voice_1.BrowserVoice(this.store).enabled(String(row.agent_session_id), String(row.owner_principal_id))) ? 'live_voice' : undefined,
1242
1254
  ingressKey: `notification:${row.notification_id}${row.previous_input_id ? `:retry:${row.previous_seq}` : ''}`, capabilities: { execute: false, writeMemory: false } }, this.config.conversation.maxPendingInputs);
1243
1255
  }
@@ -1390,6 +1402,9 @@ class AgentOrchestrationRuntime {
1390
1402
  // Retries and an incomplete credit check that still let the note through are traceable by reference.
1391
1403
  this.voiceLog('info', 'Voice note diagnostic', { ...trace, ...event });
1392
1404
  } });
1405
+ // Whatever transcribed it, a note without words is never sent to the agent as the user's message.
1406
+ if (!(0, types_1.hasSpokenWords)(text))
1407
+ throw new types_2.OrchestrationError('VOICE_NOTE_NO_TRANSCRIPT');
1393
1408
  this.store.run("UPDATE voice_note_transcripts SET state='completed',text=? WHERE input_id=?", text, receipt.inputId);
1394
1409
  }
1395
1410
  catch (error) {
@@ -1433,7 +1448,7 @@ class AgentOrchestrationRuntime {
1433
1448
  if (preparedRefs.length)
1434
1449
  input = { ...input, attachmentIds: [...new Set([...(input.attachmentIds ?? []), ...preparedRefs])] };
1435
1450
  const cliSession = this.agent.type === 'app-agent'
1436
- ? await this.cliSessions.resolveContainer(sessionId, this.agent)
1451
+ ? await this.cliSessions.resolveContainer(sessionId, await this.executionAgent(input.scope.source, input.scope.chatId, sessionId))
1437
1452
  : this.cliSessions.resolve(sessionId, this.agent.workspace);
1438
1453
  const contextPlan = this.contextDelivery.begin({ conversationId: receipt.conversationId,
1439
1454
  principalId: input.scope.principalId, bindingId: String(admitted.binding_id),
@@ -1719,7 +1734,7 @@ class AgentOrchestrationRuntime {
1719
1734
  if (cliSession.resume && this.agent.type !== 'app-agent')
1720
1735
  transcriptCheckpoint = await (0, transcript_checkpoint_1.checkpointTranscript)((0, claude_settings_1.transcriptPath)(this.agent.workspace, cliSession.id));
1721
1736
  if (cliSession.resume && this.agent.type === 'app-agent')
1722
- restoreContainerTranscript = await (0, agent_cli_session_1.containerTranscriptCheckpoint)(this.agent.container, cliSession.id);
1737
+ restoreContainerTranscript = await (0, agent_cli_session_1.containerTranscriptCheckpoint)((await this.executionAgent(input.scope.source, input.scope.chatId, sessionId)).container, cliSession.id);
1723
1738
  if (cliSession.fallback) {
1724
1739
  // No silent failure: a session we had already started could not be continued, so this
1725
1740
  // turn re-seeds history and pays a cache write. Record why before it happens.
@@ -1731,7 +1746,10 @@ class AgentOrchestrationRuntime {
1731
1746
  }
1732
1747
  ticket.profile.excludedHistoryOperationIds = this.store.all(`SELECT r.id FROM assistant_responses r
1733
1748
  JOIN conversation_decisions d ON d.id=r.decision_id WHERE d.session_id=? AND r.state='failed'`, sessionId)
1734
- .map(row => `response:${row.id}`);
1749
+ .map(row => `response:${row.id}`)
1750
+ // This turn's own inputs are already persisted, and the prompt delivers them as the current
1751
+ // message; seeding them too would end the history on an unanswered user turn.
1752
+ .concat(decision.inputIds.map(id => `input:${id}`));
1735
1753
  ticket.profile.responseId = decision.responseId;
1736
1754
  agentSession = await this.host.createAgentSession(sessionId, ticket.profile, options.model, input.scope);
1737
1755
  options.onMark?.('process_spawned');
@@ -2039,6 +2057,15 @@ class AgentOrchestrationRuntime {
2039
2057
  surfaces.spoken = '';
2040
2058
  this.store.transaction(() => this.store.appendEvent(receipt.conversationId, 'response.dispatch_unresolved', { responseId: decision.responseId, inputId: receipt.inputId }));
2041
2059
  }
2060
+ // A report turn cannot start or re-run work (#605). A reply that says it will, with nothing
2061
+ // committed or queued to do it, would leave the user waiting for work that never runs.
2062
+ if (active.notification && !capabilities.execute && !review && !controlSilent && !response.interrupted &&
2063
+ !dispatchCommitted && (0, report_promise_1.promisesWork)(surfaces.display) && !(0, report_promise_1.workPending)(this.store, receipt.conversationId)) {
2064
+ surfaces.display = `${surfaces.display}\n\n${(0, report_promise_1.unbackedPromiseNote)(surfaces.display)}`;
2065
+ if (surfaces.spoken)
2066
+ surfaces.spoken = `${surfaces.spoken} ${(0, report_promise_1.unbackedPromiseNote)(surfaces.spoken)}`;
2067
+ this.store.transaction(() => this.store.appendEvent(receipt.conversationId, 'response.unbacked_promise', { responseId: decision.responseId }));
2068
+ }
2042
2069
  const intakeSilent = !recoveryFailed && semantic && !uncommittedDispatch && (intakeChoice?.mode === 'wait' || intakeDeferred || (acknowledgementId && unresolved?.deferredDispatch && !dispatchCommitted) || (acknowledgementId && this.store.get("SELECT action_id FROM task_commands WHERE decision_id=? AND command_type IN ('spawn','update','answer') LIMIT 1", decision.decisionId)));
2043
2070
  if (intakeSilent) {
2044
2071
  // A receipt/preparation turn has not reported older task results. Keep