@xopcai/xopc 0.0.488 → 0.0.489

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 (499) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/dingtalk/src/index.js +54 -10
  3. package/dist/extensions/discord/src/index.js +39 -6
  4. package/dist/extensions/feishu/src/adapters/cli-login.js +1 -1
  5. package/dist/extensions/feishu/src/adapters/gateway-setup.js +1 -1
  6. package/dist/extensions/feishu/src/outbound/media-load.d.ts +1 -0
  7. package/dist/extensions/feishu/src/outbound/media-load.js +2 -2
  8. package/dist/extensions/feishu/src/outbound/outbound-adapter.js +2 -1
  9. package/dist/extensions/feishu/src/pairing/feishu-pairing-prompt.js +1 -1
  10. package/dist/extensions/feishu/src/plugin.js +1 -1
  11. package/dist/extensions/feishu/src/streaming/streaming-adapter.js +1 -1
  12. package/dist/extensions/feishu/src/transport/client/install-sdk.js +2 -2
  13. package/dist/extensions/feishu/src/transport/reliability/message-ingress.js +3 -3
  14. package/dist/extensions/feishu/src/transport/socket-mode/monitor.js +1 -1
  15. package/dist/extensions/slack/src/index.js +51 -1
  16. package/dist/extensions/slack/src/manifest.js +1 -0
  17. package/dist/extensions/telegram/src/adapters/outbound-adapter.js +6 -1
  18. package/dist/extensions/telegram/src/adapters/streaming-adapter.js +3 -3
  19. package/dist/extensions/telegram/src/doctor.js +2 -2
  20. package/dist/extensions/telegram/src/draft-stream.js +1 -1
  21. package/dist/extensions/telegram/src/exec-approval-handler.js +1 -1
  22. package/dist/extensions/telegram/src/focus-handler.js +1 -1
  23. package/dist/extensions/telegram/src/inbound-processor.js +7 -7
  24. package/dist/extensions/telegram/src/outbound-sender.js +6 -5
  25. package/dist/extensions/telegram/src/plugin.js +23 -23
  26. package/dist/extensions/telegram/xopc.extension.json +1 -1
  27. package/dist/extensions/wecom/src/index.js +82 -6
  28. package/dist/extensions/weixin/src/api/api.js +1 -1
  29. package/dist/extensions/weixin/src/auth/accounts.js +2 -2
  30. package/dist/extensions/weixin/src/auth/pairing.js +1 -1
  31. package/dist/extensions/weixin/src/cdn/upload.js +1 -1
  32. package/dist/extensions/weixin/src/cli/gateway-qr-login.js +1 -1
  33. package/dist/extensions/weixin/src/cli/qr-login.js +2 -2
  34. package/dist/extensions/weixin/src/media/data-url.d.ts +1 -0
  35. package/dist/extensions/weixin/src/media/data-url.js +5 -2
  36. package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
  37. package/dist/extensions/weixin/src/messaging/inbound.js +2 -2
  38. package/dist/extensions/weixin/src/messaging/process-message.js +5 -5
  39. package/dist/extensions/weixin/src/messaging/quote-cache.js +1 -1
  40. package/dist/extensions/weixin/src/messaging/send.js +1 -1
  41. package/dist/extensions/weixin/src/monitor/monitor.js +2 -2
  42. package/dist/extensions/weixin/src/outbound-send.js +18 -6
  43. package/dist/extensions/weixin/src/plugin.js +3 -3
  44. package/dist/gateway/server/chunks.bin +1560 -1521
  45. package/dist/gateway/server/chunks.json +1 -1
  46. package/dist/gateway/static/root/assets/{automations-page-DelDZorh.js → automations-page-B3i5x1Lc.js} +1 -1
  47. package/dist/gateway/static/root/assets/{automations-workspace-leY4yCvw.js → automations-workspace-D6-Kk33X.js} +2 -2
  48. package/dist/gateway/static/root/assets/{chat-page-XqG9aYBd.js → chat-page-oy4EGdO1.js} +2 -2
  49. package/dist/gateway/static/root/assets/{home-page-Bxr3V5lc.js → home-page-BmoT_EN4.js} +3 -3
  50. package/dist/gateway/static/root/assets/{home-task-actions-GAO06s1_.js → home-task-actions-Ck0AhcYe.js} +1 -1
  51. package/dist/gateway/static/root/assets/{index-BjU5H5hz.js → index-BiQP7-5r.js} +8 -8
  52. package/dist/gateway/static/root/assets/{note-detail-panel-BTNX68oO.js → note-detail-panel-CYNPJVVE.js} +2 -2
  53. package/dist/gateway/static/root/assets/{notes-page-FocipOyc.js → notes-page-Dpd98vQp.js} +1 -1
  54. package/dist/gateway/static/root/assets/{personal-page-CSc2n5UD.js → personal-page-BfljqOp5.js} +1 -1
  55. package/dist/gateway/static/root/assets/{project-detail-page-CK_EN6Jq.js → project-detail-page-CcnOT_aq.js} +1 -1
  56. package/dist/gateway/static/root/assets/right-workspace-store-DsVm6C0V.js +1 -0
  57. package/dist/gateway/static/root/assets/{route-preload-Ab7Zw-df.js → route-preload-CsBdFJHO.js} +2 -2
  58. package/dist/gateway/static/root/assets/{routine-panel-DzdJGicv.js → routine-panel-pVuJtctD.js} +2 -2
  59. package/dist/gateway/static/root/assets/{settings-page-CzW5GM5r.js → settings-page-BRAijVXZ.js} +1 -1
  60. package/dist/gateway/static/root/assets/{space-page-BCzDsNJd.js → space-page-CUwakPrj.js} +2 -2
  61. package/dist/gateway/static/root/assets/{task-detail-page-B_YXsT9W.js → task-detail-page-Cvx-XtFO.js} +1 -1
  62. package/dist/gateway/static/root/assets/{task-header-title-bZVPIbyR.js → task-header-title-DHb7z-hq.js} +1 -1
  63. package/dist/gateway/static/root/assets/{task-run-issue-notice-BXOES2t9.js → task-run-issue-notice-CqjS8_gi.js} +1 -1
  64. package/dist/gateway/static/root/assets/{use-composer-attachments-DWiIdMIi.js → use-composer-attachments-CQwCTKAp.js} +1 -1
  65. package/dist/gateway/static/root/assets/{use-personal-work-D0tMU1bP.js → use-personal-work-fvvZDK_7.js} +1 -1
  66. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-DPHnm_7A.js → workspace-file-preview-dialog-DdVyIRKm.js} +1 -1
  67. package/dist/gateway/static/root/index.html +9 -9
  68. package/dist/package.js +1 -1
  69. package/dist/src/activity/emitter.js +1 -1
  70. package/dist/src/agent/agent-manager.js +8 -8
  71. package/dist/src/agent/background-review/prompts.js +1 -1
  72. package/dist/src/agent/background-review/run-background-review.js +3 -3
  73. package/dist/src/agent/coding/repository-instructions.js +1 -1
  74. package/dist/src/agent/coding/workspace-revision.js +1 -1
  75. package/dist/src/agent/commands/command-isolation.js +1 -1
  76. package/dist/src/agent/commands/command-registry.js +1 -1
  77. package/dist/src/agent/context/execution-context.js +2 -2
  78. package/dist/src/agent/context/workspace-seed.js +1 -1
  79. package/dist/src/agent/data-acquisition/git.js +1 -1
  80. package/dist/src/agent/data-acquisition/service.js +1 -1
  81. package/dist/src/agent/embedded/codemode-output.js +2 -2
  82. package/dist/src/agent/embedded/execution-tool-policy.js +1 -1
  83. package/dist/src/agent/embedded/model-runtime.js +1 -1
  84. package/dist/src/agent/embedded/run-for-session.js +6 -6
  85. package/dist/src/agent/embedded/run-turn.js +76 -17
  86. package/dist/src/agent/embedded/runs.js +1 -1
  87. package/dist/src/agent/embedded/session-runner.js +2 -1
  88. package/dist/src/agent/embedded/types.d.ts +1 -1
  89. package/dist/src/agent/embedded/xopc-stream-bridge.js +3 -3
  90. package/dist/src/agent/external-tools/endpoint-provider.js +1 -1
  91. package/dist/src/agent/external-tools/index.js +1 -1
  92. package/dist/src/agent/image/generation/providers/xopc-cloud.js +2 -2
  93. package/dist/src/agent/image/load-image-media.js +2 -2
  94. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  95. package/dist/src/agent/inbound/inbound-loop.js +6 -1
  96. package/dist/src/agent/independent-execution.js +2 -2
  97. package/dist/src/agent/mcp/connection-drafts.js +2 -2
  98. package/dist/src/agent/mcp/connection-setup.js +1 -1
  99. package/dist/src/agent/mcp/conversation-setup.js +1 -1
  100. package/dist/src/agent/mcp/discovery.js +1 -1
  101. package/dist/src/agent/mcp/transport.js +1 -1
  102. package/dist/src/agent/mcp/weixin-setup-scope.js +2 -2
  103. package/dist/src/agent/messaging/command-handler.js +1 -1
  104. package/dist/src/agent/prompt/response-language.js +1 -1
  105. package/dist/src/agent/prompt/sections/tooling.d.ts +1 -0
  106. package/dist/src/agent/prompt/sections/tooling.js +7 -2
  107. package/dist/src/agent/prompt/service-prompt-builder.js +1 -1
  108. package/dist/src/agent/prompt/system-prompt-params.js +1 -1
  109. package/dist/src/agent/prompt/system-prompt.js +1 -0
  110. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  111. package/dist/src/agent/sandbox/native-command.js +1 -1
  112. package/dist/src/agent/sandbox/path-policy.js +1 -1
  113. package/dist/src/agent/service/direct-turn-helpers.js +3 -3
  114. package/dist/src/agent/service/process-direct-streaming.js +2 -2
  115. package/dist/src/agent/service.js +7 -5
  116. package/dist/src/agent/session/session-config-service.js +1 -1
  117. package/dist/src/agent/skills/hub-hash.js +1 -1
  118. package/dist/src/agent/skills/hub-lock.js +1 -1
  119. package/dist/src/agent/skills/hub-pull.js +3 -3
  120. package/dist/src/agent/skills/index.js +1 -1
  121. package/dist/src/agent/skills/managed-store.js +1 -1
  122. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  123. package/dist/src/agent/skills/skill-sources.js +1 -1
  124. package/dist/src/agent/tools/browser/tool/browser-use-tool.js +48 -2
  125. package/dist/src/agent/tools/browser/tool/schemas.d.ts +2 -1
  126. package/dist/src/agent/tools/browser/tool/schemas.js +6 -0
  127. package/dist/src/agent/tools/communication.d.ts +1 -0
  128. package/dist/src/agent/tools/communication.js +10 -3
  129. package/dist/src/agent/tools/delegate-tool.js +1 -1
  130. package/dist/src/agent/tools/exec-command.js +1 -1
  131. package/dist/src/agent/tools/executor.js +1 -1
  132. package/dist/src/agent/tools/factory.js +13 -4
  133. package/dist/src/agent/tools/fetch-text.js +1 -1
  134. package/dist/src/agent/tools/image-generate-tool.d.ts +7 -0
  135. package/dist/src/agent/tools/image-generate-tool.js +21 -1
  136. package/dist/src/agent/tools/managed-job-tool.js +1 -1
  137. package/dist/src/agent/tools/personal-attention-tool.js +1 -1
  138. package/dist/src/agent/tools/personal-memory-tool.js +3 -3
  139. package/dist/src/agent/tools/publish-artifacts.js +1 -1
  140. package/dist/src/agent/tools/read.js +1 -1
  141. package/dist/src/agent/tools/review-workspace.js +2 -2
  142. package/dist/src/agent/tools/scoped-workspace-tools.js +1 -1
  143. package/dist/src/agent/tools/send-media.d.ts +1 -0
  144. package/dist/src/agent/tools/send-media.js +7 -4
  145. package/dist/src/agent/tools/task-collaboration-tool.js +2 -2
  146. package/dist/src/agent/tools/tool-media.d.ts +1 -0
  147. package/dist/src/agent/tools/tool-media.js +14 -1
  148. package/dist/src/agent/tools/user-context-tool.js +2 -2
  149. package/dist/src/agent/tools/web-extract.js +1 -1
  150. package/dist/src/agent/tools/write.js +1 -1
  151. package/dist/src/agent/tools/xopc-use-tool.js +6 -6
  152. package/dist/src/agent-catalog/repository.js +1 -1
  153. package/dist/src/auth/credentials.js +1 -1
  154. package/dist/src/auth/oauth/openai.js +1 -1
  155. package/dist/src/auth/oauth/xopc-cloud.js +2 -2
  156. package/dist/src/auth/oauth-provider-lock.js +1 -1
  157. package/dist/src/auth/profiles/store.js +1 -1
  158. package/dist/src/automations/delivery/delivery-router.js +1 -1
  159. package/dist/src/automations/service/action-executor.js +1 -1
  160. package/dist/src/automations/service/automation-service.js +1 -1
  161. package/dist/src/backup/archive.js +4 -4
  162. package/dist/src/browser/assistance.d.ts +34 -0
  163. package/dist/src/browser/assistance.js +243 -0
  164. package/dist/src/browser/cache-dir-policy.js +1 -1
  165. package/dist/src/browser/drivers/browser-driver.d.ts +44 -0
  166. package/dist/src/browser/drivers/playwright-driver.d.ts +2 -1
  167. package/dist/src/browser/drivers/playwright-driver.js +161 -0
  168. package/dist/src/browser/managed-live-runtime.d.ts +79 -0
  169. package/dist/src/browser/managed-live-runtime.js +313 -0
  170. package/dist/src/browser/native-messaging-host.js +1 -1
  171. package/dist/src/browser/providers/browser-ext-install.js +4 -4
  172. package/dist/src/browser/runtime/browser-runtime.d.ts +18 -1
  173. package/dist/src/browser/runtime/browser-runtime.js +55 -4
  174. package/dist/src/capabilities/capability-catalog.js +2 -2
  175. package/dist/src/capabilities/readiness/from-config.js +2 -2
  176. package/dist/src/capabilities/store-connector.js +1 -1
  177. package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
  178. package/dist/src/channels/channel-domain.d.ts +1 -0
  179. package/dist/src/channels/enterprise/media.d.ts +14 -0
  180. package/dist/src/channels/enterprise/media.js +208 -0
  181. package/dist/src/channels/enterprise/plugin.d.ts +4 -0
  182. package/dist/src/channels/enterprise/plugin.js +40 -12
  183. package/dist/src/channels/format.js +1 -1
  184. package/dist/src/channels/index.js +2 -2
  185. package/dist/src/channels/internal-outbound.d.ts +2 -0
  186. package/dist/src/channels/internal-outbound.js +17 -1
  187. package/dist/src/channels/lifecycle-supervisor.js +1 -1
  188. package/dist/src/channels/outbound-sender.js +2 -2
  189. package/dist/src/channels/pairing/pairing-service.js +1 -1
  190. package/dist/src/channels/pairing/pairing-store.js +1 -1
  191. package/dist/src/chat-commands/builtins/config.js +2 -2
  192. package/dist/src/chat-commands/builtins/review.js +1 -1
  193. package/dist/src/chat-commands/builtins/session.js +1 -1
  194. package/dist/src/chat-commands/builtins/thinking.js +1 -1
  195. package/dist/src/chat-commands/builtins/tts.js +1 -1
  196. package/dist/src/chat-commands/builtins/understanding.js +1 -1
  197. package/dist/src/chat-commands/context.js +2 -2
  198. package/dist/src/chat-commands/index.js +1 -1
  199. package/dist/src/cli/commands/agent.js +2 -2
  200. package/dist/src/cli/commands/browser-cli-helpers.js +1 -1
  201. package/dist/src/cli/commands/connectors.js +1 -1
  202. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  203. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
  204. package/dist/src/cli/commands/doctor/checks/image-providers.js +1 -1
  205. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  206. package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +1 -1
  207. package/dist/src/cli/commands/extension-agent-plugin.js +2 -2
  208. package/dist/src/cli/commands/extension-marketplace.js +3 -3
  209. package/dist/src/cli/commands/extension-pack.js +1 -1
  210. package/dist/src/cli/commands/extension.js +1 -1
  211. package/dist/src/cli/commands/mcp.js +1 -1
  212. package/dist/src/cli/commands/models.js +3 -3
  213. package/dist/src/cli/commands/onboard/model.js +2 -2
  214. package/dist/src/cli/commands/onboard.js +1 -1
  215. package/dist/src/cli/commands/project.js +1 -1
  216. package/dist/src/cli/commands/runtime.js +1 -1
  217. package/dist/src/cli/commands/skills.js +1 -1
  218. package/dist/src/cli/commands/tunnel.js +1 -1
  219. package/dist/src/cli/utils/gateway-client.js +1 -1
  220. package/dist/src/cli/utils/init-workspace-core.js +2 -2
  221. package/dist/src/computer/broker.js +1 -1
  222. package/dist/src/computer/runtime.js +2 -2
  223. package/dist/src/config/index.js +3 -3
  224. package/dist/src/config/loader.js +2 -2
  225. package/dist/src/config/models-json.js +1 -1
  226. package/dist/src/config/paths-state.js +1 -1
  227. package/dist/src/config/schema.js +2 -2
  228. package/dist/src/config/workspace-path.js +1 -1
  229. package/dist/src/connectors/cli/installer.js +1 -1
  230. package/dist/src/connectors/connected-source-ingestion.js +1 -1
  231. package/dist/src/connectors/connected-source-understanding.js +1 -1
  232. package/dist/src/connectors/content-enrichment.js +1 -1
  233. package/dist/src/connectors/health.js +1 -1
  234. package/dist/src/daemon/constants.js +1 -1
  235. package/dist/src/daemon/install-plan.js +1 -1
  236. package/dist/src/daemon/launchd.js +1 -1
  237. package/dist/src/daemon/schtasks.js +1 -1
  238. package/dist/src/daemon/systemd.js +1 -1
  239. package/dist/src/discussions/action-tasks.js +1 -1
  240. package/dist/src/discussions/live-worker.js +2 -2
  241. package/dist/src/discussions/recording.js +2 -2
  242. package/dist/src/discussions/repository.js +1 -1
  243. package/dist/src/discussions/sealer.js +3 -3
  244. package/dist/src/discussions/service.js +1 -1
  245. package/dist/src/endpoint-tools/delegation.js +1 -1
  246. package/dist/src/endpoint-tools/upload-service.js +1 -1
  247. package/dist/src/execution-environments/local-worktree-manager.js +1 -1
  248. package/dist/src/execution-environments/worktree-safety.js +1 -1
  249. package/dist/src/extensions/activation-context.js +2 -2
  250. package/dist/src/extensions/agent-plugins/auth.js +3 -3
  251. package/dist/src/extensions/agent-plugins/branding.js +1 -1
  252. package/dist/src/extensions/agent-plugins/cli-authorization.js +3 -3
  253. package/dist/src/extensions/agent-plugins/credentials.js +1 -1
  254. package/dist/src/extensions/agent-plugins/mcp-adapter.js +2 -2
  255. package/dist/src/extensions/agent-plugins/resources.js +1 -1
  256. package/dist/src/extensions/agent-plugins/setup.js +1 -1
  257. package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
  258. package/dist/src/extensions/agent-plugins/source-catalog.js +2 -2
  259. package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
  260. package/dist/src/extensions/agent-plugins/sources.js +1 -1
  261. package/dist/src/extensions/agent-plugins/store.js +2 -2
  262. package/dist/src/extensions/agent-plugins/user-config.js +2 -2
  263. package/dist/src/extensions/agent-plugins/validation.js +3 -3
  264. package/dist/src/extensions/api.js +2 -2
  265. package/dist/src/extensions/install.js +1 -1
  266. package/dist/src/extensions/loader.js +2 -2
  267. package/dist/src/extensions/lockfile.js +1 -1
  268. package/dist/src/extensions/sdk/index.js +1 -1
  269. package/dist/src/extensions/update.js +2 -2
  270. package/dist/src/files/file-service.js +1 -1
  271. package/dist/src/gateway/agent-reactions/reaction.js +1 -1
  272. package/dist/src/gateway/file-path-classifier.js +1 -1
  273. package/dist/src/gateway/hono/lib/config-payload.js +3 -3
  274. package/dist/src/gateway/hono/lib/static-ui.js +1 -1
  275. package/dist/src/gateway/hono/routes/agent-plugins.js +1 -1
  276. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  277. package/dist/src/gateway/hono/routes/browser.js +261 -3
  278. package/dist/src/gateway/hono/routes/channels.js +1 -1
  279. package/dist/src/gateway/hono/routes/commands-skills.js +1 -1
  280. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  281. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  282. package/dist/src/gateway/hono/routes/device-connections.js +1 -1
  283. package/dist/src/gateway/hono/routes/files.js +1 -1
  284. package/dist/src/gateway/hono/routes/host-fs.js +1 -1
  285. package/dist/src/gateway/hono/routes/local-apps.js +1 -1
  286. package/dist/src/gateway/hono/routes/memory-learning.js +1 -1
  287. package/dist/src/gateway/hono/routes/mobile-capability-actions.js +3 -3
  288. package/dist/src/gateway/hono/routes/mobile-capability-panels.js +4 -4
  289. package/dist/src/gateway/hono/routes/mobile-model-settings.js +13 -5
  290. package/dist/src/gateway/hono/routes/models.js +6 -6
  291. package/dist/src/gateway/hono/routes/notes.js +1 -1
  292. package/dist/src/gateway/hono/routes/observability.js +1 -1
  293. package/dist/src/gateway/hono/routes/personal-agent.js +1 -1
  294. package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
  295. package/dist/src/gateway/hono/routes/phone.js +1 -1
  296. package/dist/src/gateway/hono/routes/session-command-handler.js +1 -1
  297. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  298. package/dist/src/gateway/hono/routes/sessions.js +2 -2
  299. package/dist/src/gateway/hono/routes/shares.js +1 -1
  300. package/dist/src/gateway/hono/routes/status.js +1 -1
  301. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  302. package/dist/src/gateway/hono/routes/user-model.js +3 -3
  303. package/dist/src/gateway/hono/routes/video-generation.js +1 -1
  304. package/dist/src/gateway/hono/routes/voice.js +4 -4
  305. package/dist/src/gateway/image-generation-setup.js +2 -2
  306. package/dist/src/gateway/lock.js +2 -2
  307. package/dist/src/gateway/mobile-privacy.js +1 -1
  308. package/dist/src/gateway/next-turn-suggestions/snapshot.js +1 -1
  309. package/dist/src/gateway/ports.js +1 -1
  310. package/dist/src/gateway/provider-model-setup.js +1 -1
  311. package/dist/src/gateway/security/device-request-proof.js +1 -1
  312. package/dist/src/gateway/security/gateway-scopes.js +2 -0
  313. package/dist/src/gateway/service/agent-runner.js +2 -2
  314. package/dist/src/gateway/service/config-coordinator.js +2 -2
  315. package/dist/src/gateway/service/run-gateway-agent.js +5 -3
  316. package/dist/src/gateway/service/session-command-service.js +1 -1
  317. package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -0
  318. package/dist/src/gateway/service/session-input-coordinator.js +13 -3
  319. package/dist/src/gateway/service.d.ts +4 -0
  320. package/dist/src/gateway/service.js +42 -17
  321. package/dist/src/gateway/xopc-cloud-capability-setup.js +2 -2
  322. package/dist/src/home-intelligence/follow-ups.js +1 -1
  323. package/dist/src/home-intelligence/host.js +1 -1
  324. package/dist/src/home-intelligence/repository.js +1 -1
  325. package/dist/src/home-intelligence/routines.js +1 -1
  326. package/dist/src/imports/files.js +1 -1
  327. package/dist/src/imports/importService.js +2 -2
  328. package/dist/src/imports/inventory.js +1 -1
  329. package/dist/src/imports/planner.js +1 -1
  330. package/dist/src/imports/productImport.js +1 -1
  331. package/dist/src/imports/scanner.js +1 -1
  332. package/dist/src/imports/sources.js +1 -1
  333. package/dist/src/infra/brew.js +1 -1
  334. package/dist/src/infra/bus/queue.js +1 -1
  335. package/dist/src/infra/package-runtime-check.js +1 -1
  336. package/dist/src/infra/path-env.js +1 -1
  337. package/dist/src/infra/ports.js +1 -1
  338. package/dist/src/infra/process-diagnostics.js +1 -1
  339. package/dist/src/infra/ssh-tunnel.js +1 -1
  340. package/dist/src/infra/update-startup.js +1 -1
  341. package/dist/src/infra/write-file-atomic.js +1 -1
  342. package/dist/src/knowledge-memory/repository.js +1 -1
  343. package/dist/src/knowledge-memory/usage-policy.js +1 -1
  344. package/dist/src/local-apps/artifact-files.js +1 -1
  345. package/dist/src/local-apps/execution-authority.js +1 -1
  346. package/dist/src/local-apps/p1-services.js +1 -1
  347. package/dist/src/local-apps/preview-sessions.js +1 -1
  348. package/dist/src/local-apps/preview-worker.js +1 -1
  349. package/dist/src/local-apps/public-assets.js +1 -1
  350. package/dist/src/local-apps/service.js +3 -3
  351. package/dist/src/local-apps/store.js +1 -1
  352. package/dist/src/markdown/index.js +1 -1
  353. package/dist/src/mcp/connection-grants.js +1 -1
  354. package/dist/src/mcp/delegation.js +3 -3
  355. package/dist/src/mcp/gateway-http-client.js +1 -1
  356. package/dist/src/media/session-references.js +1 -1
  357. package/dist/src/media-shared/http/provider-http.js +1 -1
  358. package/dist/src/media-understanding/runner.js +1 -1
  359. package/dist/src/memory-learning/choice-observations.js +1 -1
  360. package/dist/src/memory-learning/source-learning.js +2 -2
  361. package/dist/src/music-generation/artifact.js +2 -2
  362. package/dist/src/notes/agent-context.js +1 -1
  363. package/dist/src/notes/service.js +1 -1
  364. package/dist/src/notes/store.js +1 -1
  365. package/dist/src/notifications/store.js +1 -1
  366. package/dist/src/observability/runtime.js +1 -1
  367. package/dist/src/personal-agent/proactivity/repository.js +1 -1
  368. package/dist/src/personal-agent/proactivity/routes.js +1 -1
  369. package/dist/src/personal-agent/proactivity/service.js +3 -3
  370. package/dist/src/personal-agent/prompt-context.js +2 -2
  371. package/dist/src/personal-agent/reply-composer.js +4 -4
  372. package/dist/src/personal-agent/reply-style.d.ts +2 -2
  373. package/dist/src/personal-agent/reply-style.js +8 -7
  374. package/dist/src/personal-agent/request-delivery.js +1 -1
  375. package/dist/src/personal-agent/request-service.js +1 -1
  376. package/dist/src/personal-agent/result-reader.js +3 -3
  377. package/dist/src/personal-agent/service.js +1 -1
  378. package/dist/src/personal-agent/unread.js +1 -1
  379. package/dist/src/phone/adb-driver.js +2 -2
  380. package/dist/src/phone/cloud-adb-connection.js +1 -1
  381. package/dist/src/phone/execution-trace.js +1 -1
  382. package/dist/src/phone/hdc-driver.js +2 -2
  383. package/dist/src/phone/hdc-video-tools.js +1 -1
  384. package/dist/src/phone/model-adapter.js +1 -1
  385. package/dist/src/phone/ui-session.js +1 -1
  386. package/dist/src/platform/index.js +1 -1
  387. package/dist/src/project-trust/trust-store.js +1 -1
  388. package/dist/src/projects/workspace-project.js +1 -1
  389. package/dist/src/providers/extension-stream-bridge.js +2 -2
  390. package/dist/src/providers/index.js +4 -4
  391. package/dist/src/providers/model-call.js +3 -3
  392. package/dist/src/providers/model-catalog-persistence.js +2 -2
  393. package/dist/src/providers/model-registry.js +3 -3
  394. package/dist/src/providers/provider-disconnect-core.js +1 -1
  395. package/dist/src/providers/register-runtime-providers.js +1 -1
  396. package/dist/src/providers/setup/voice.js +1 -1
  397. package/dist/src/providers/xopc-cloud-catalog-coordinator.js +1 -1
  398. package/dist/src/providers/xopc-cloud-credit-budget.js +1 -1
  399. package/dist/src/providers/xopc-cloud-model-source.js +1 -1
  400. package/dist/src/review/review-git.js +1 -1
  401. package/dist/src/runtime-tools/downloader.js +1 -1
  402. package/dist/src/runtime-tools/harmony-dependencies.js +1 -1
  403. package/dist/src/runtime-tools/manager.js +2 -2
  404. package/dist/src/runtime-tools/phone-dependencies.js +1 -1
  405. package/dist/src/session/history-recall-policy.js +1 -1
  406. package/dist/src/session/init-session-turn.js +1 -1
  407. package/dist/src/session/resolve-session.js +1 -1
  408. package/dist/src/share/hosted-note-publication.js +1 -1
  409. package/dist/src/share/hosted-session-share.js +1 -1
  410. package/dist/src/share/hosted-static-site-publication.js +1 -1
  411. package/dist/src/share/session-share-service.js +1 -1
  412. package/dist/src/share/share-auto.js +1 -1
  413. package/dist/src/share/share-zip.js +1 -1
  414. package/dist/src/share/site-proxy.js +1 -1
  415. package/dist/src/space/budget-workbook.js +1 -1
  416. package/dist/src/space/ingest.js +1 -1
  417. package/dist/src/space/repository.js +2 -2
  418. package/dist/src/space/workbook-turn.js +1 -1
  419. package/dist/src/space/worker.js +1 -1
  420. package/dist/src/storage/sqlite/ai-usage-repository.js +1 -1
  421. package/dist/src/storage/sqlite/clarification-wait-repository.js +2 -2
  422. package/dist/src/storage/sqlite/connection.js +2 -2
  423. package/dist/src/storage/sqlite/conversation-repository.js +2 -2
  424. package/dist/src/storage/sqlite/desktop-execution-repository.js +1 -1
  425. package/dist/src/storage/sqlite/desktop-execution-stop-repository.js +1 -1
  426. package/dist/src/storage/sqlite/device-access-repository.js +1 -1
  427. package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
  428. package/dist/src/storage/sqlite/index.js +1 -1
  429. package/dist/src/storage/sqlite/schema-upgrade.js +3 -3
  430. package/dist/src/storage/sqlite/session-creation-repository.js +1 -1
  431. package/dist/src/storage/sqlite/session-input-control-repository.js +1 -1
  432. package/dist/src/storage/sqlite/session-repository.js +1 -1
  433. package/dist/src/support/collect-support-report.js +1 -1
  434. package/dist/src/tasks/capabilities/management.js +1 -1
  435. package/dist/src/tasks/capabilities/relations.js +1 -1
  436. package/dist/src/tasks/delegated-run-result.js +1 -1
  437. package/dist/src/tasks/task-allocation-service.js +2 -2
  438. package/dist/src/tasks/task-application-service.js +1 -1
  439. package/dist/src/tasks/task-context-assembler.js +2 -2
  440. package/dist/src/tasks/task-criterion-review-repository.js +1 -1
  441. package/dist/src/tasks/task-deliverables.js +1 -1
  442. package/dist/src/tasks/task-delivery-checks.js +1 -1
  443. package/dist/src/tasks/task-handoff-service.js +1 -1
  444. package/dist/src/tasks/task-handoff.js +4 -4
  445. package/dist/src/tasks/task-json-acceptance.js +1 -1
  446. package/dist/src/tasks/task-main-update-decision-service.js +1 -1
  447. package/dist/src/tasks/task-origin-repository.js +1 -1
  448. package/dist/src/tasks/task-read-model-projector.js +1 -1
  449. package/dist/src/tasks/task-research-repair.js +2 -2
  450. package/dist/src/tasks/task-research-result.js +3 -3
  451. package/dist/src/tasks/task-result-delivery-repository.js +1 -1
  452. package/dist/src/tasks/task-result-delivery-service.js +2 -2
  453. package/dist/src/tasks/task-run-coordinator.js +3 -3
  454. package/dist/src/tasks/task-run-repository.js +1 -1
  455. package/dist/src/tasks/task-signal-service.js +1 -1
  456. package/dist/src/tasks/task-workspace-verification.js +2 -2
  457. package/dist/src/tui/backends/embedded-backend.js +5 -5
  458. package/dist/src/tui/backends/embedded-drafts.js +1 -1
  459. package/dist/src/tui/clipboard-image.js +2 -2
  460. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  461. package/dist/src/tui/tui-capabilities.js +1 -1
  462. package/dist/src/tui/tui-commands.js +1 -1
  463. package/dist/src/tui/tui-skills-autocomplete.js +2 -2
  464. package/dist/src/tui/tui-startup-resources.js +1 -1
  465. package/dist/src/tui/tui.js +4 -4
  466. package/dist/src/tunnel/frpc-binary.js +2 -2
  467. package/dist/src/usage/cloud-capability.js +1 -1
  468. package/dist/src/usage/recorder.js +2 -2
  469. package/dist/src/user-context/access-policy.js +2 -2
  470. package/dist/src/user-model/bootstrap.js +1 -1
  471. package/dist/src/user-model/capture/executor.js +1 -1
  472. package/dist/src/user-model/index.js +2 -2
  473. package/dist/src/user-model/usage-policy.js +1 -1
  474. package/dist/src/utils/index.js +1 -1
  475. package/dist/src/utils/logger/index.js +2 -2
  476. package/dist/src/utils/logger.js +1 -1
  477. package/dist/src/video-generation/artifact.js +2 -2
  478. package/dist/src/video-generation/repository.js +1 -1
  479. package/dist/src/voice/audio/normalize.js +1 -1
  480. package/dist/src/voice/platform-settings.js +1 -1
  481. package/dist/src/voice/realtime/conversation-context.js +1 -1
  482. package/dist/src/voice/realtime/memory-context.js +2 -2
  483. package/dist/src/voice/realtime/runtime.js +2 -2
  484. package/dist/src/voice/realtime/user-context.js +1 -1
  485. package/dist/src/voice/stt/factory.js +1 -1
  486. package/dist/src/voice/stt/index.js +2 -2
  487. package/dist/src/voice/stt/preflight.js +2 -2
  488. package/dist/src/voice/stt/providers/bailian-plan-transcription.js +3 -3
  489. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +3 -3
  490. package/dist/src/voice/stt/transcribe-core.js +1 -1
  491. package/dist/src/voice/tts/factory.js +1 -1
  492. package/dist/src/voice/tts/providers/bailian-plan-speech.js +2 -2
  493. package/dist/src/voice/tts/providers/edge-speech.js +1 -1
  494. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +2 -2
  495. package/dist/src/work-discovery/candidate-discovery.js +2 -2
  496. package/dist/src/work-discovery/probe.js +2 -2
  497. package/dist/src/work-discovery/service.js +4 -4
  498. package/package.json +1 -1
  499. package/dist/gateway/static/root/assets/right-workspace-store-CcRApllu.js +0 -1
@@ -1,5 +1,7 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
+ import { getExecutionAuthority } from "../../infra/execution-authority.js";
4
+ import { withDelegationScope } from "../orchestration/delegation-scope.js";
3
5
  import { isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
4
6
  import { findSessionInputByRunId, init_session_input_repository } from "../../storage/sqlite/session-input-repository.js";
5
7
  import { init_source_context_projection, projectSourceContextsForLlm } from "../source-context/source-context-projection.js";
@@ -11,26 +13,25 @@ import { projectContextForModel } from "../memory/context-budget.js";
11
13
  import { getActiveClarification, getClarification, getClarificationResumeInput, isClarificationSuspended } from "../../storage/sqlite/clarification-wait-repository.js";
12
14
  import "../../storage/sqlite/index.js";
13
15
  import { ProviderUsageScopeError, init_model_usage } from "../../providers/model-usage.js";
14
- import { originalReadAuthorizationNotice, projectForgottenHistoryMessages, projectSuppressedMemoryBlocks } from "../../memory-learning/forgotten-history.js";
15
- import { resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
16
- import { getExecutionAuthority } from "../../infra/execution-authority.js";
16
+ import { runWithEmbeddedExecutionSession } from "./execution-context.js";
17
17
  import { recordTraceLatency, setTraceIdentity, traceOperation, traceRun, traceTools } from "../../observability/runtime.js";
18
18
  import { continuesAfterTool, trackAiUsageStream } from "../../usage/recorder.js";
19
19
  import { cloudCreditBudgetStopMessage, isCloudCreditBudgetExhausted, reportCloudCreditError, withCloudCreditBudget } from "../../providers/xopc-cloud-credit-budget.js";
20
+ import { originalReadAuthorizationNotice, projectForgottenHistoryMessages, projectSuppressedMemoryBlocks } from "../../memory-learning/forgotten-history.js";
21
+ import { resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
20
22
  import { resolveAgentAbortReason } from "../orchestration/run-termination.js";
21
23
  import { isAgentTurnTimeoutError, isAgentTurnUnsettledError, resolveAgentTurnTimeoutMs, runAgentTurnWithTimeout } from "../orchestration/run-agent-turn-with-timeout.js";
22
24
  import { isContextOverflowError } from "../orchestration/context-overflow.js";
23
25
  import { ACCEPTANCE_REPAIR_READ_TOOLS, canResumeAfterModelFailure, completedRecoveryToolResult } from "../orchestration/turn-recovery.js";
24
26
  import { classifyLlmFailure, getAssistantTurnErrorMessage, isAssistantTurnAborted, isAssistantTurnFailed, maybeRetryTurnAfterTransientLlmFailure, recordLlmRetryOutcome, stripTrailingErrorAssistantMessages } from "../orchestration/llm-turn-retry.js";
25
27
  import { getActiveTranscriptUserText } from "../inbound/attachment-pipeline.js";
26
- import { runWithEmbeddedExecutionSession } from "./execution-context.js";
27
28
  import { EmbeddedRunConflictError, abortEmbeddedRun, acquireEmbeddedRunLease, queueEmbeddedSteer, restoreEmbeddedSteeringImages } from "./runs.js";
28
29
  import { getSessionInteractionPolicy } from "../session/interaction-policy-state.js";
29
30
  import { PLAN_MODE_INSTRUCTIONS } from "../session/interaction-policy.js";
30
31
  import { allowsExecutionTool, filterExecutionTools, resolveExecutionToolPolicy } from "./execution-tool-policy.js";
31
32
  import { isPhoneAssistanceSuspended, phoneAssistance, phoneResumeForRun } from "../../phone/assistance.js";
32
33
  import { externalPolicyContext, getXopcToolMetadata } from "./tool-metadata.js";
33
- import { withDelegationScope } from "../orchestration/delegation-scope.js";
34
+ import { browserAssistance, isBrowserAssistanceSuspended } from "../../browser/assistance.js";
34
35
  import { isComputerControlActive, isComputerLeaseTool, stopComputerControl } from "../../computer/control-guard.js";
35
36
  import { bindComputerAgentTurn, computerImagesForRequest, computerRequestFrameCleanup, endComputerAgentTurn, setComputerProgramAuthorization } from "../../computer/agent-context.js";
36
37
  import { resolvePromptCachePolicy } from "../../providers/prompt-cache-plan.js";
@@ -781,6 +782,8 @@ async function runXopcEmbeddedTurnInner(params) {
781
782
  let lengthRecoveryExhausted = false;
782
783
  let phoneStopped = false;
783
784
  let phoneNotice;
785
+ let browserStopped = false;
786
+ let browserNotice;
784
787
  let connectionStopped = false;
785
788
  let clarificationStopped = false;
786
789
  const pendingClarificationTools = /* @__PURE__ */ new Map();
@@ -801,7 +804,7 @@ async function runXopcEmbeddedTurnInner(params) {
801
804
  };
802
805
  let sentVisibleMessage = false;
803
806
  const needsVisibleReply = () => {
804
- if (!params.requireVisibleReply || sentVisibleMessage || connectionStopped || clarificationStopped || phoneStopped) return false;
807
+ if (!params.requireVisibleReply || sentVisibleMessage || connectionStopped || clarificationStopped || phoneStopped || browserStopped) return false;
805
808
  const reply = lastAssistantPlainText(session)?.trim();
806
809
  return lastAssistantMessage(session.agent.state.messages) === previousAssistant || !reply || reply === "NO_REPLY";
807
810
  };
@@ -838,6 +841,11 @@ async function runXopcEmbeddedTurnInner(params) {
838
841
  reason: "Waiting for the user to finish operating the phone.",
839
842
  terminate: true
840
843
  };
844
+ if (browserStopped) return {
845
+ block: true,
846
+ reason: "Waiting for the user to finish operating the browser.",
847
+ terminate: true
848
+ };
841
849
  if (connectionStopped) return {
842
850
  block: true,
843
851
  reason: "Waiting for the user to connect an app.",
@@ -923,6 +931,11 @@ async function runXopcEmbeddedTurnInner(params) {
923
931
  const details = context.result.details;
924
932
  if (typeof details?.message === "string") phoneNotice = details.message.slice(0, 500);
925
933
  }
934
+ browserStopped ||= isBrowserAssistanceSuspended(conversationId, runId);
935
+ if (browserStopped && context.toolCall.name === "browser_use") {
936
+ const details = context.result.details;
937
+ if (typeof details?.reason === "string") browserNotice = details.reason.slice(0, 500);
938
+ }
926
939
  connectionStopped ||= isConnectionSuspended(conversationId, runId);
927
940
  clarificationStopped ||= isClarificationSuspended(conversationId, runId);
928
941
  const scoped = context.toolCall.name === "read_file" ? await instructions.forTool(context.toolCall.name, context.args) : context.toolCall.name === "data_batch" ? await instructions.forDataResult(context.result.content) : "";
@@ -991,7 +1004,7 @@ async function runXopcEmbeddedTurnInner(params) {
991
1004
  if (!clarificationStopped) policyStopped ||= params.turnPolicy?.shouldStopAfterTurn(context) ?? false;
992
1005
  policyCompleted ||= policyStopped && params.turnPolicy?.stopReason?.() === "completed";
993
1006
  if (policyStopped) policyStopReason ??= "Agent execution policy stopped before completion";
994
- if (policyStopped || connectionStopped || clarificationStopped || phoneStopped) return { action: "end" };
1007
+ if (policyStopped || connectionStopped || clarificationStopped || phoneStopped || browserStopped) return { action: "end" };
995
1008
  const continuation = params.turnPolicy?.takeContinuationMessage?.();
996
1009
  if (continuation) {
997
1010
  session.agent.steer({
@@ -1186,7 +1199,7 @@ async function runXopcEmbeddedTurnInner(params) {
1186
1199
  if (params.resumeLastUserMessage || params.recoveryMessage || phoneResume || connectionResume || clarificationResume || session.agent.state.messages.some((message) => message.role === "user" && !messagesBeforeRequest.has(message))) await session.agent.continue();
1187
1200
  else await initialRequest();
1188
1201
  },
1189
- shouldRetry: () => !policyStopped && !connectionStopped && !clarificationStopped && !phoneStopped,
1202
+ shouldRetry: () => !policyStopped && !connectionStopped && !clarificationStopped && !phoneStopped && !browserStopped,
1190
1203
  onRetry: () => {
1191
1204
  recoveringModel = true;
1192
1205
  recoveryMessages = [...session.agent.state.messages];
@@ -1194,22 +1207,23 @@ async function runXopcEmbeddedTurnInner(params) {
1194
1207
  });
1195
1208
  }
1196
1209
  clarificationStopped ||= isClarificationSuspended(conversationId, runId);
1197
- if (connectionStopped || clarificationStopped || phoneStopped) return;
1210
+ browserStopped ||= isBrowserAssistanceSuspended(conversationId, runId);
1211
+ if (connectionStopped || clarificationStopped || phoneStopped || browserStopped) return;
1198
1212
  const recoverSettledTurn = async () => {
1199
- if (policyStopped || connectionStopped || clarificationStopped || phoneStopped) return;
1213
+ if (policyStopped || connectionStopped || clarificationStopped || phoneStopped || browserStopped) return;
1200
1214
  await maybeRetryTurnAfterTransientLlmFailure(session.agent, {
1201
1215
  conversationId,
1202
1216
  log,
1203
1217
  signal: runAbortSignal,
1204
1218
  budget: requestRetryBudget,
1205
1219
  onRetryScheduled,
1206
- shouldRetry: () => !policyStopped && !connectionStopped && !clarificationStopped && !phoneStopped,
1220
+ shouldRetry: () => !policyStopped && !connectionStopped && !clarificationStopped && !phoneStopped && !browserStopped,
1207
1221
  onRetry: () => {
1208
1222
  recoveringModel = true;
1209
1223
  recoveryMessages = [...session.agent.state.messages];
1210
1224
  }
1211
1225
  });
1212
- if (policyStopped || connectionStopped || clarificationStopped || phoneStopped) return;
1226
+ if (policyStopped || connectionStopped || clarificationStopped || phoneStopped || browserStopped) return;
1213
1227
  if (await maybeRecoverInterruptedContext({
1214
1228
  agent: session.agent,
1215
1229
  model: resolvedModel,
@@ -1234,7 +1248,7 @@ async function runXopcEmbeddedTurnInner(params) {
1234
1248
  signal: runAbortSignal,
1235
1249
  budget: requestRetryBudget,
1236
1250
  onRetryScheduled,
1237
- shouldRetry: () => !policyStopped && !connectionStopped && !clarificationStopped && !phoneStopped,
1251
+ shouldRetry: () => !policyStopped && !connectionStopped && !clarificationStopped && !phoneStopped && !browserStopped,
1238
1252
  onRetry: () => {
1239
1253
  recoveringModel = true;
1240
1254
  recoveryMessages = [...session.agent.state.messages];
@@ -1243,7 +1257,7 @@ async function runXopcEmbeddedTurnInner(params) {
1243
1257
  };
1244
1258
  await recoverSettledTurn();
1245
1259
  const capabilityCorrection = configurationCapabilityCorrection(session.getAllTools().filter((tool) => tool.exposure !== "hidden").map((tool) => tool.name), userMessageToPromptText(userMessage), lastAssistantPlainText(session), session.agent.state.messages.slice(configurationTurnStart));
1246
- if (capabilityCorrection && !policyStopped && !connectionStopped && !clarificationStopped && !phoneStopped && !runAbortSignal.aborted && !isAssistantTurnFailed(session.agent) && !isAssistantTurnAborted(session.agent)) {
1260
+ if (capabilityCorrection && !policyStopped && !connectionStopped && !clarificationStopped && !phoneStopped && !browserStopped && !runAbortSignal.aborted && !isAssistantTurnFailed(session.agent) && !isAssistantTurnAborted(session.agent)) {
1247
1261
  await session.sendCustomMessage({
1248
1262
  customType: "configuration_capability_current",
1249
1263
  content: capabilityCorrection,
@@ -1262,7 +1276,7 @@ async function runXopcEmbeddedTurnInner(params) {
1262
1276
  await recoverSettledTurn();
1263
1277
  }
1264
1278
  const recallCorrection = recallAnswerCorrection(systemPrompt, lastAssistantPlainText(session));
1265
- if (recallCorrection && !policyStopped && !connectionStopped && !clarificationStopped && !phoneStopped && !runAbortSignal.aborted && !isAssistantTurnFailed(session.agent) && !isAssistantTurnAborted(session.agent)) {
1279
+ if (recallCorrection && !policyStopped && !connectionStopped && !clarificationStopped && !phoneStopped && !browserStopped && !runAbortSignal.aborted && !isAssistantTurnFailed(session.agent) && !isAssistantTurnAborted(session.agent)) {
1266
1280
  await session.sendCustomMessage({
1267
1281
  customType: "recall_grounding_correction",
1268
1282
  content: recallCorrection,
@@ -1277,7 +1291,7 @@ async function runXopcEmbeddedTurnInner(params) {
1277
1291
  });
1278
1292
  }
1279
1293
  const memoryCorrection = implicitMemoryClaimCorrection(userMessageToPromptText(userMessage), lastAssistantPlainText(session), session.agent.state.messages.slice(configurationTurnStart));
1280
- if (memoryCorrection && !policyStopped && !connectionStopped && !clarificationStopped && !phoneStopped && !runAbortSignal.aborted && !isAssistantTurnFailed(session.agent) && !isAssistantTurnAborted(session.agent)) {
1294
+ if (memoryCorrection && !policyStopped && !connectionStopped && !clarificationStopped && !phoneStopped && !browserStopped && !runAbortSignal.aborted && !isAssistantTurnFailed(session.agent) && !isAssistantTurnAborted(session.agent)) {
1281
1295
  await session.sendCustomMessage({
1282
1296
  customType: "memory_claim_correction",
1283
1297
  content: memoryCorrection,
@@ -1305,6 +1319,51 @@ async function runXopcEmbeddedTurnInner(params) {
1305
1319
  timeoutExtensionMs: params.timeoutExtensionMs,
1306
1320
  onTimeout: (reason) => turnDeadline.abort(reason)
1307
1321
  });
1322
+ if (browserStopped) {
1323
+ const wait = browserAssistance(conversationId);
1324
+ const notice = {
1325
+ role: "assistant",
1326
+ content: [{
1327
+ type: "text",
1328
+ text: `需要你在浏览器中完成一步操作。${browserNotice ? ` ${browserNotice}\n` : "\n"}请点击“查看浏览器”并“接管浏览器”,完成后点击“完成,继续任务”,我会从当前页面继续原任务。`
1329
+ }],
1330
+ api: resolvedModel.api,
1331
+ provider: resolvedModel.provider,
1332
+ model: resolvedModel.id,
1333
+ usage: {
1334
+ input: 0,
1335
+ output: 0,
1336
+ cacheRead: 0,
1337
+ cacheWrite: 0,
1338
+ totalTokens: 0,
1339
+ cost: {
1340
+ input: 0,
1341
+ output: 0,
1342
+ cacheRead: 0,
1343
+ cacheWrite: 0,
1344
+ total: 0
1345
+ }
1346
+ },
1347
+ stopReason: "stop",
1348
+ timestamp: Date.now()
1349
+ };
1350
+ runner.piSm.appendMessage(notice);
1351
+ session.agent.state.messages = [...session.agent.state.messages, notice];
1352
+ onEvent?.({
1353
+ type: "message_start",
1354
+ runId,
1355
+ message: notice
1356
+ });
1357
+ onEvent?.({
1358
+ type: "message_end",
1359
+ runId,
1360
+ message: notice
1361
+ });
1362
+ runner.piSm.appendCustomEntry("browser_assistance_required", {
1363
+ runId,
1364
+ waitId: wait?.id
1365
+ });
1366
+ }
1308
1367
  if (phoneStopped) {
1309
1368
  const wait = phoneAssistance(conversationId);
1310
1369
  const notice = {
@@ -1416,7 +1475,7 @@ async function runXopcEmbeddedTurnInner(params) {
1416
1475
  });
1417
1476
  return {
1418
1477
  ok: true,
1419
- ...phoneStopped ? { stopReason: "phone_assistance_required" } : connectionStopped ? { stopReason: "connection_required" } : clarificationStopped ? { stopReason: "clarification_required" } : {},
1478
+ ...browserStopped ? { stopReason: "browser_assistance_required" } : phoneStopped ? { stopReason: "phone_assistance_required" } : connectionStopped ? { stopReason: "connection_required" } : clarificationStopped ? { stopReason: "clarification_required" } : {},
1420
1479
  lastAssistantText: lastAssistantPlainText(session)
1421
1480
  };
1422
1481
  } finally {
@@ -1,7 +1,7 @@
1
1
  import { VOICE_AGENT_INSTRUCTION_TYPE, init_voice_transcript } from "../../session/voice-transcript.js";
2
+ import { getEmbeddedExecutionRunId, getEmbeddedExecutionSession } from "./execution-context.js";
2
3
  import { AgentRunCancelledError } from "../orchestration/run-termination.js";
3
4
  import { registerSteeringTranscript } from "../inbound/attachment-pipeline.js";
4
- import { getEmbeddedExecutionRunId, getEmbeddedExecutionSession } from "./execution-context.js";
5
5
  //#region src/agent/embedded/runs.ts
6
6
  init_voice_transcript();
7
7
  var EmbeddedRunConflictError = class extends Error {
@@ -263,7 +263,8 @@ var EmbeddedSessionRunnerPool = class {
263
263
  AGENT_PROFILE_CONTEXT_STATE,
264
264
  "connection_required",
265
265
  "clarification_required",
266
- "phone_assistance_required"
266
+ "phone_assistance_required",
267
+ "browser_assistance_required"
267
268
  ],
268
269
  contextWindowTokens: model.contextWindow ?? 128e3,
269
270
  transformMessageForPersistence: params.transcriptRuntime.persistent ? (message) => transformUserMessageForPersistence(runtimeId, message) : void 0
@@ -113,7 +113,7 @@ export type RunXopcEmbeddedTurnParams = {
113
113
  export type RunXopcEmbeddedTurnResult = {
114
114
  terminationReason?: import('../orchestration/run-termination.js').AgentTerminationReason;
115
115
  ok: boolean;
116
- stopReason?: 'phone_assistance_required' | 'connection_required' | 'clarification_required' | 'policy_limit' | 'response_truncated';
116
+ stopReason?: 'browser_assistance_required' | 'phone_assistance_required' | 'connection_required' | 'clarification_required' | 'policy_limit' | 'response_truncated';
117
117
  /** False for harness failures that must not trigger another model attempt. */
118
118
  retryable?: boolean;
119
119
  errorMessage?: string;
@@ -1,10 +1,10 @@
1
- import { assertProviderUsage, init_model_usage } from "../../providers/model-usage.js";
2
1
  import "../../providers/constants.js";
3
- import { init_providers } from "../../providers/index.js";
2
+ import { assertProviderUsage, init_model_usage } from "../../providers/model-usage.js";
4
3
  import { withCloudUsageResponse } from "../../usage/cloud-receipts.js";
5
4
  import { cloudWireUsage } from "../../usage/cloud-wire.js";
6
- import { createExtensionAwareStreamFn } from "../../providers/extension-stream-bridge.js";
7
5
  import { assertCloudCreditBudgetActive, cloudCreditBudgetHeaders, hasCloudCreditBudget, reportCloudCreditError } from "../../providers/xopc-cloud-credit-budget.js";
6
+ import { init_providers } from "../../providers/index.js";
7
+ import { createExtensionAwareStreamFn } from "../../providers/extension-stream-bridge.js";
8
8
  import { preparePromptCacheContext, withPromptCachePayloadTransform } from "../../providers/prompt-cache-payload.js";
9
9
  import { getCurrentSystemPrompt, getCurrentTools, normalizeContext } from "@earendil-works/pi-ai";
10
10
  //#region src/agent/embedded/xopc-stream-bridge.ts
@@ -6,8 +6,8 @@ import { getSessionMetadata } from "../../storage/sqlite/session-read-repository
6
6
  import { init_session_repository } from "../../storage/sqlite/session-repository.js";
7
7
  import { getDeviceInteractionForRun } from "../../storage/sqlite/clarification-wait-repository.js";
8
8
  import { init_src as init_src$1 } from "../../../packages/computer-control-contract/src/index.js";
9
- import { prepareImageForModel } from "../image/prepare-image-for-model.js";
10
9
  import { getEmbeddedExecutionRunId } from "../embedded/execution-context.js";
10
+ import { prepareImageForModel } from "../image/prepare-image-for-model.js";
11
11
  import { CapabilityError } from "../../capabilities/runtime/errors.js";
12
12
  import "../../../packages/browser-control-contract/src/index.js";
13
13
  import { ExternalEffectNotAppliedError, executeExternalOperation } from "../../capabilities/runtime/external-operations.js";
@@ -1,5 +1,5 @@
1
- import { resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
2
1
  import { getEmbeddedExecutionSession } from "../embedded/execution-context.js";
2
+ import { resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
3
3
  import { parseExternalToolRef } from "./refs.js";
4
4
  import { CliToolProvider } from "./cliProvider.js";
5
5
  import { ComposioToolProvider } from "./composio-provider.js";
@@ -1,10 +1,10 @@
1
1
  import { getModelCatalogStore, init_model_catalog_store } from "../../../../providers/model-catalog-store.js";
2
+ import { compareCatalogModels } from "../../../../providers/model-catalog-ranking.js";
2
3
  import { init_xopc_cloud_config, resolveXopcModelRouterUrl } from "../../../../providers/xopc-cloud-config.js";
3
4
  import { getProviderAuthService, init_provider_auth_service } from "../../../../providers/provider-auth-service.js";
4
5
  import { captureCloudUsageResponse } from "../../../../usage/cloud-receipts.js";
5
- import { cloudCreditBudgetHeaders, reportCloudCreditError } from "../../../../providers/xopc-cloud-credit-budget.js";
6
- import { compareCatalogModels } from "../../../../providers/model-catalog-ranking.js";
7
6
  import { trackCloudCapabilityUsage } from "../../../../usage/cloud-capability.js";
7
+ import { cloudCreditBudgetHeaders, reportCloudCreditError } from "../../../../providers/xopc-cloud-credit-budget.js";
8
8
  import { createOpenAiImagesProvider } from "../openai-images-provider.js";
9
9
  //#region src/agent/image/generation/providers/xopc-cloud.ts
10
10
  init_model_catalog_store();
@@ -1,7 +1,7 @@
1
- import { decodeDataUrl } from "./image-helpers.js";
2
1
  import { checkFileSafety } from "../prompt/safety.js";
3
- import { homedir } from "node:os";
2
+ import { decodeDataUrl } from "./image-helpers.js";
4
3
  import path from "node:path";
4
+ import { homedir } from "node:os";
5
5
  import { promises } from "node:fs";
6
6
  //#region src/agent/image/load-image-media.ts
7
7
  function expandUser(p) {
@@ -3,11 +3,11 @@ import { SPACE_WORKBOOK_SELECTION_MAX_BYTES, SPACE_WORKBOOK_SELECTION_MIME } fro
3
3
  import { init_src } from "../../../packages/gateway-contract/src/index.js";
4
4
  import { mimeTypeFromMediaPath } from "../../media/store.js";
5
5
  import { readAgentMessageContent } from "../memory/agent-message-access.js";
6
- import { extractProfileAgentId } from "../../config/agent-profile.js";
7
6
  import { isPersonalConversation } from "../../personal-agent/repository.js";
8
7
  import { readMediaReference } from "../../media/media-reference.js";
9
8
  import { isImageInboundAttachment } from "../../channels/attachments/attachment-classifiers.js";
10
9
  import "../../channels/attachments/inbound-persist.js";
10
+ import { extractProfileAgentId } from "../../config/agent-profile.js";
11
11
  import { expandAtFileMentionsInPlainText } from "../context/expand-at-file-mentions.js";
12
12
  import { resolveImageHandlingStrategy } from "../image/vision-detection.js";
13
13
  import { resolveInboundImageContentParts } from "../image/inbound-image-handling.js";
@@ -109,7 +109,12 @@ var InboundLoop = class {
109
109
  },
110
110
  metadata: {
111
111
  accountId: msg.metadata?.accountId,
112
- transcribedVoice: msg.metadata?.transcribedVoice === true
112
+ threadId: msg.metadata?.threadId,
113
+ inboundMessageId: msg.metadata?.messageId,
114
+ ...typeof msg.metadata?.channelReplyId === "string" ? { channelReplyId: msg.metadata.channelReplyId } : {},
115
+ transcribedVoice: msg.metadata?.transcribedVoice === true,
116
+ sessionWebhook: msg.metadata?.sessionWebhook,
117
+ conversationId: context.conversationId
113
118
  }
114
119
  };
115
120
  const sessionMetadata = await this.cfg.sessionStore.getMetadata(sessionContext.conversationId).catch(() => null);
@@ -1,6 +1,6 @@
1
- import { withoutCloudCreditBudget } from "../providers/xopc-cloud-credit-budget.js";
2
- import { withoutEmbeddedExecutionSession } from "./embedded/execution-context.js";
3
1
  import { withoutDelegationScope } from "./orchestration/delegation-scope.js";
2
+ import { withoutEmbeddedExecutionSession } from "./embedded/execution-context.js";
3
+ import { withoutCloudCreditBudget } from "../providers/xopc-cloud-credit-budget.js";
4
4
  import { withoutDataToolPermissions } from "./tools/dataBatch.js";
5
5
  import { withoutSearchCache } from "./tools/search/cache.js";
6
6
  //#region src/agent/independent-execution.ts
@@ -1,6 +1,6 @@
1
- import { McpServerSchema, init_schema } from "../../config/schema.js";
2
- import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
3
1
  import { getWorkspacePath } from "../../config/workspace-path-helpers.js";
2
+ import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
3
+ import { McpServerSchema, init_schema } from "../../config/schema.js";
4
4
  import { createConnectorSecretReference } from "../../connectors/secret-store.js";
5
5
  import { isManagedConnectorServer } from "../../connectors/materialize.js";
6
6
  import { createNativeMcpCredentials } from "./credential-store.js";
@@ -7,8 +7,8 @@ import { prepareNativeMcpConfig } from "./native-mcp.js";
7
7
  import { McpAuthenticationRequiredError, discoverMcpTools, signInNativeMcp } from "./tool-catalog.js";
8
8
  import { isPrivateMcpIp, isPrivateMcpTarget, isPublicMcpIp, isPublicMcpTarget } from "./network-policy.js";
9
9
  import { createHash, randomUUID } from "node:crypto";
10
- import { lookup } from "node:dns";
11
10
  import { Agent } from "undici";
11
+ import { lookup } from "node:dns";
12
12
  //#region src/agent/mcp/connection-setup.ts
13
13
  init_logger();
14
14
  const log = createLogger("McpConnectionSetup");
@@ -1,12 +1,12 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
+ import { checkUrlSafety } from "../tools/url-safety.js";
3
4
  import { DurableState, init_durable_state } from "../../storage/sqlite/durable-state.js";
4
5
  import { getActiveConnectionWait, init_connection_wait_repository } from "../../storage/sqlite/connection-wait-repository.js";
5
6
  import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
6
7
  import { init_session_repository } from "../../storage/sqlite/session-repository.js";
7
8
  import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
8
9
  import { connectorPrincipalForSession } from "../../connectors/principal.js";
9
- import { checkUrlSafety } from "../tools/url-safety.js";
10
10
  import { connectorSecretProviderId } from "../../connectors/secret-store.js";
11
11
  import { isManagedConnectorServer } from "../../connectors/materialize.js";
12
12
  import { classifyMcpConnectionError } from "./connection-errors.js";
@@ -1,7 +1,7 @@
1
+ import { checkUrlSafety } from "../tools/url-safety.js";
1
2
  import { DurableState, init_durable_state } from "../../storage/sqlite/durable-state.js";
2
3
  import { getSessionMetadata, init_session_read_repository } from "../../storage/sqlite/session-read-repository.js";
3
4
  import { loadTranscriptRowsForSession } from "../../storage/sqlite/transcript-repository.js";
4
- import { checkUrlSafety } from "../tools/url-safety.js";
5
5
  import { SearchProviderRegistry } from "../tools/search/registry.js";
6
6
  import { resolveWebSearchConfig } from "../tools/search/resolve-config.js";
7
7
  import { fetchPublicText } from "../tools/fetch-text.js";
@@ -1,8 +1,8 @@
1
1
  import { isPrivateMcpIp, isPrivateMcpTarget, isPublicMcpIp, isPublicMcpTarget, mcpHostname } from "./network-policy.js";
2
2
  import { mcpStdioSupervisor } from "../../process/mcp-stdio-supervisor.js";
3
3
  import { resolve } from "node:path";
4
- import { lookup } from "node:dns";
5
4
  import { Agent, fetch } from "undici";
5
+ import { lookup } from "node:dns";
6
6
  import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
7
7
  import { StdioTransport, StreamableHttpTransport } from "@earendil-works/pi-mcp";
8
8
  //#region src/agent/mcp/transport.ts
@@ -1,8 +1,8 @@
1
+ import { resolveWeixinAllowFromPath } from "../../channels/pairing/paths.js";
2
+ import { readAllowFromIdsSync } from "../../channels/pairing/allow-from-file.js";
1
3
  import { getConversationRouting } from "../../storage/sqlite/conversation-repository.js";
2
4
  import { init_session_key } from "../../routing/session-key.js";
3
5
  import { weixinAccountIdentityRevision } from "../../channels/weixin/account-identity.js";
4
- import { resolveWeixinAllowFromPath } from "../../channels/pairing/paths.js";
5
- import { readAllowFromIdsSync } from "../../channels/pairing/allow-from-file.js";
6
6
  import { resolveReverseProxyPublicUrl } from "../../gateway/public-url.js";
7
7
  //#region src/agent/mcp/weixin-setup-scope.ts
8
8
  init_session_key();
@@ -1,7 +1,7 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
- import { getAllProviders, getModelsByProvider, getProviderDisplayName, init_providers, isProviderConfiguredSync } from "../../providers/index.js";
4
3
  import { commandRegistry } from "../../chat-commands/registry.js";
4
+ import { getAllProviders, getModelsByProvider, getProviderDisplayName, init_providers, isProviderConfiguredSync } from "../../providers/index.js";
5
5
  import { createCommandContext } from "../../chat-commands/context.js";
6
6
  import "../../chat-commands/index.js";
7
7
  //#region src/agent/messaging/command-handler.ts
@@ -3,8 +3,8 @@ import { TaskRepository, init_task_repository } from "../../tasks/task-repositor
3
3
  import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
4
4
  import { getSessionConfig } from "../../storage/sqlite/config-repository.js";
5
5
  import "../../storage/sqlite/index.js";
6
- import { init_response_language, resolveResponseLanguage } from "../../i18n/response-language.js";
7
6
  import { getUserProfileSnapshot } from "../../user-model/profile.js";
7
+ import { init_response_language, resolveResponseLanguage } from "../../i18n/response-language.js";
8
8
  import { resolveTaskLocale } from "../../tasks/task-language.js";
9
9
  import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
10
10
  //#region src/agent/prompt/response-language.ts
@@ -1,5 +1,6 @@
1
1
  export declare function buildToolingSection(params: {
2
2
  toolNames?: string[];
3
3
  toolSummaries?: Record<string, string>;
4
+ currentChannel?: string;
4
5
  }): string;
5
6
  export declare function hasSkillsTools(toolNames: string[]): boolean;
@@ -1,3 +1,4 @@
1
+ import { isExternalMessagingChannel } from "../../../channels/internal-outbound.js";
1
2
  //#region src/agent/prompt/sections/tooling.ts
2
3
  const CORE_TOOL_ORDER = [
3
4
  "read_file",
@@ -129,7 +130,11 @@ function buildToolingSection(params) {
129
130
  const hasExec = availableTools.has("exec_command");
130
131
  const hasPlan = availableTools.has("update_plan");
131
132
  const hasPublishArtifacts = availableTools.has("publish_artifacts");
133
+ const hasSendMedia = availableTools.has("send_media");
134
+ const hasImageGenerate = availableTools.has("image_generate");
132
135
  const hasXopcUse = availableTools.has("xopc_use");
136
+ const currentChannel = params.currentChannel?.trim().toLowerCase();
137
+ const isExternalChannel = isExternalMessagingChannel(currentChannel);
133
138
  const orchestrationLines = [];
134
139
  if (hasDelegate) orchestrationLines.push("- Sub-agent delegation → use `delegate_task(goal, context?, mode?, capabilities?, toolset?, budgetTier?, maxIterations?)`. Choose light for narrow lookups, standard for bounded research, and deep for broader investigations. Supply relevant facts and a clear stopping condition; search before reading targeted chunks. Default research inherits available read capabilities. Use implement for isolated worktree changes. Inspect stopReason, budget usage, handoff and rejectedTools; resume incomplete work from the handoff rather than repeating the investigation.");
135
140
  return [
@@ -138,7 +143,7 @@ function buildToolingSection(params) {
138
143
  "Use only case-sensitive names in current function schemas; prose/history examples grant no tool. Never probe invented names. Missing prerequisites: give a final blocker, without unrelated calls.",
139
144
  availableTools.has("tool_search") || availableTools.has("xopc_tool_execute") ? "Use tool_search as the single tool discovery entry. loadedTools can be called after their schemas load; externalTools require xopc_tool_describe then xopc_tool_execute. Connection candidates are recovery options, not proof of missing authorization. Respect the current execution scope." : "",
140
145
  hasPublishArtifacts && !hasRead && !hasWrite && !hasPatch && !hasExec ? "Only publication is available for workspace files. For a request to edit then publish, editing is blocked: make no publication call and explain the limitation. Publish an existing file only when the user requests that existing content without an outstanding edit." : "",
141
- "When a tool returns an xopc product link, reuse its exact URL in a Markdown link with a short descriptive label in the user's language (for example, [打开会话](url)). Do not invent link parameters, escape the link brackets/parentheses, or wrap a navigation link in a code span. Avoid repeating raw URLs or internal object metadata unless requested.",
146
+ !isExternalChannel ? "When a tool returns an xopc product link, reuse its exact URL in a Markdown link with a short descriptive label in the user's language (for example, [打开会话](url)). Do not invent link parameters, escape the link brackets/parentheses, or wrap a navigation link in a code span. Avoid repeating raw URLs or internal object metadata unless requested." : "",
142
147
  toolLines.length > 0 ? toolLines.join("\n") : "- No tools are registered for this session.",
143
148
  hasExec ? `For long waits, use \`${execToolName}\` with a sufficient timeout; avoid rapid polling.` : "",
144
149
  hasRead ? `Use \`${readToolName}\` for targeted file inspection before editing; do not rely on filenames alone. Reuse unchanged content already returned; read again only for changed files, truncation, a failed read, or an unresolved fact.` : "",
@@ -150,7 +155,7 @@ function buildToolingSection(params) {
150
155
  hasExec ? `Use \`${execToolName}\` for local engineering verification and safe workspace inspection. For web account tasks, use the selected browser or connector for reading and verification. Use the file editing tools for routine edits. Commands already start in the workspace; use its cwd argument for another directory. Run checks directly (for example, cmd="pnpm test"), without cd, shell chains, pipes, or output filters; set maxOutputChars to bound returned output.` : "",
151
156
  !hasExec && (hasWrite || hasPatch) ? "Without execution, inspect the named source and a public caller or data sample before selecting undocumented fields. If only file reading is available, use a bounded probe of conventional sibling input.json or package.json; a directory read failure does not mean sibling files are absent. Then make the bounded edit, inspect it once and deliver. Explicitly say tests could not be run because execution is unavailable; separately identify any unavailable review. Do not invent fields, expand the interface or repeatedly rewrite to compensate." : "",
152
157
  availableTools.has("review_workspace") ? `After code changes, use \`${resolveToolName("review_workspace")}\` to inspect the final diff.` : "",
153
- hasWrite || hasExec ? "When delivering a user-facing workspace file, include a clickable Markdown link in the final response using `xopc://workspace/file?path=<workspace-relative-path>`; URL-encode spaces and special characters, and do not invent an HTTP or `file://` URL." : "",
158
+ isExternalChannel ? hasSendMedia ? `You are replying in an external messaging channel (\`${currentChannel}\`). Do not output \`xopc://\` or \`file://\` links because users in external channels cannot open them. When delivering a workspace file or image to the user, send it directly with \`${resolveToolName("send_media")}\`${hasImageGenerate ? ` (newly generated images from \`${resolveToolName("image_generate")}\` are already delivered automatically; use \`${resolveToolName("send_media")}\` to send existing files or resend)` : ""}.` : `You are replying in an external messaging channel (\`${currentChannel}\`). Do not output \`xopc://\` or \`file://\` links because users in external channels cannot open them.` : hasWrite || hasExec ? "When delivering a user-facing workspace file, include a clickable Markdown link in the final response using `xopc://workspace/file?path=<workspace-relative-path>`; URL-encode spaces and special characters, and do not invent an HTTP or `file://` URL." : "",
154
159
  hasPublishArtifacts ? hasExec ? `Default delivery is a link to the completed workspace file. Only when downloadable copies are requested, declare those files in \`${execToolName}.outputs\`; use \`${resolveToolName("publish_artifacts")}\` only for requested downloads still missing a receipt. Keep source, tests and helpers in the workspace unless downloadable copies were explicitly requested. Publication requires a completed requested deliverable; never publish an original file when its requested edit is blocked. A successful receipt completes delivery: do not publish or rerun a check just to attach it again.` : `Publish completed user-facing files with \`${resolveToolName("publish_artifacts")}\`; exclude temporary files and source/test attachments unless downloadable copies were requested. This tool cannot create, edit, or verify content. If required editing is unavailable, report the blocker without publishing the original or probing publication.` : "",
155
160
  hasPlan ? `Use \`${planToolName}\` for multi-step coding work: keep exactly one active step when work is in progress, and update it after meaningful progress or review.` : "",
156
161
  hasToolManual ? "Some complex tools have built-in manuals. Use `tool_manual(tool)` before non-trivial use." : "",
@@ -7,8 +7,8 @@ import { getInteractionState } from "../../storage/sqlite/interaction-state-repo
7
7
  import { DEFAULT_USER_TRUST_LEVEL } from "../../user-context/trust-policy.js";
8
8
  import { getUserTrustPolicy } from "../../storage/sqlite/user-trust-repository.js";
9
9
  import "../../storage/sqlite/index.js";
10
- import { appendStablePromptSection } from "./cache-boundary.js";
11
10
  import { getUserTimezone } from "../../user-model/repository.js";
11
+ import { appendStablePromptSection } from "./cache-boundary.js";
12
12
  import "../../user-model/index.js";
13
13
  import { resolveResponseLanguageForSession } from "./response-language.js";
14
14
  import { buildTtsSystemPromptHint } from "../../voice/tts/directives.js";
@@ -2,8 +2,8 @@ import { PACKAGE_VERSION, init_package_version } from "../../package-version.js"
2
2
  import { getConversationRouting } from "../../storage/sqlite/conversation-repository.js";
3
3
  import { isCronConversationId, isSubagentConversationId } from "../../routing/agent-session-key.js";
4
4
  import { init_session_key } from "../../routing/session-key.js";
5
- import { normalizePromptSection } from "./cache-boundary.js";
6
5
  import { isPersonalConversation } from "../../personal-agent/repository.js";
6
+ import { normalizePromptSection } from "./cache-boundary.js";
7
7
  import { listChannelPlugins } from "../../channels/plugins/registry.js";
8
8
  //#region src/agent/prompt/system-prompt-params.ts
9
9
  init_package_version();
@@ -40,6 +40,7 @@ function buildSystemPrompt(workspaceDir, options = {}) {
40
40
  ...customInstructions?.trim() ? [`<custom_instructions>\n${customInstructions.trim()}\n</custom_instructions>`] : [],
41
41
  buildToolingSection({
42
42
  toolNames,
43
+ currentChannel: runtime?.channel,
43
44
  toolSummaries: isPersonal && toolSummaries ? Object.fromEntries(Object.entries(toolSummaries).map(([name, summary]) => [name, summary.split(/(?<=[.!?])\s+/)[0].slice(0, 300)])) : toolSummaries
44
45
  }),
45
46
  ...normalizedTools.size ? [buildOverridablePromptSection({
@@ -1,9 +1,9 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
3
  import { getExecutionAuthority } from "../../infra/execution-authority.js";
4
+ import { getDelegationScope } from "../orchestration/delegation-scope.js";
4
5
  import { prepareSafeToolEnv } from "./sanitize-env-vars.js";
5
6
  import { validatePath, validateWritePath } from "./path-policy.js";
6
- import { getDelegationScope } from "../orchestration/delegation-scope.js";
7
7
  import { auditCommand, validateCommand } from "./command-validator.js";
8
8
  import { DEFAULT_SANDBOX_CONFIG } from "./types.js";
9
9
  import { isAbsolute, resolve } from "node:path";
@@ -1,5 +1,5 @@
1
- import { tmpdir } from "node:os";
2
1
  import { delimiter } from "node:path";
2
+ import { tmpdir } from "node:os";
3
3
  import { access, realpath } from "node:fs/promises";
4
4
  //#region src/agent/sandbox/native-command.ts
5
5
  /** The selected OS boundary must be available; execution never falls back to an unrestricted host. */
@@ -1,5 +1,5 @@
1
- import { homedir } from "node:os";
2
1
  import { basename, dirname, isAbsolute, normalize, posix, resolve } from "node:path";
2
+ import { homedir } from "node:os";
3
3
  import { lstatSync, realpathSync } from "node:fs";
4
4
  //#region src/agent/sandbox/path-policy.ts
5
5
  /**
@@ -2,14 +2,14 @@ import { init_injector, injectSourceContextsIntoUserMessage } from "../source-co
2
2
  import { getConnectionResumeInput, init_connection_wait_repository } from "../../storage/sqlite/connection-wait-repository.js";
3
3
  import { getClarificationResumeInput } from "../../storage/sqlite/clarification-wait-repository.js";
4
4
  import { isPersonalConversation } from "../../personal-agent/repository.js";
5
+ import { personalCommandRejection } from "../../chat-commands/personal-command-policy.js";
6
+ import { commandRegistry } from "../../chat-commands/registry.js";
5
7
  import { resolveImageHandlingStrategy } from "../image/vision-detection.js";
6
8
  import { hydrateUserTurnForLlm } from "../inbound/attachment-pipeline.js";
7
9
  import { phoneResumeForRun } from "../../phone/assistance.js";
8
10
  import { buildDelegatedTaskDirective, buildTaskExecutionDirective } from "../../tasks/task-context-assembler.js";
9
11
  import { getMcpSetupResumeInput } from "../mcp/continuation-input.js";
10
12
  import { shouldSkipResetOverlapCommand } from "../../session/reset-triggers.js";
11
- import { personalCommandRejection } from "../../chat-commands/personal-command-policy.js";
12
- import { commandRegistry } from "../../chat-commands/registry.js";
13
13
  import { getTaskContinuation } from "../../tasks/task-continuation.js";
14
14
  import { runEmbeddedTurnForSession } from "../embedded/run-for-session.js";
15
15
  import crypto from "node:crypto";
@@ -152,7 +152,7 @@ async function runDirectAgentTurn(deps, input) {
152
152
  beforeTurn: isResume ? void 0 : () => deps.agentManager.beginBackgroundReviewUserTurn(input.conversationId),
153
153
  onEvent: input.onEvent
154
154
  });
155
- if (!isResume && result.stopReason !== "connection_required" && result.stopReason !== "clarification_required" && result.stopReason !== "phone_assistance_required") deps.agentManager.scheduleBackgroundReviewAfterUserTurn(input.conversationId);
155
+ if (!isResume && result.stopReason !== "connection_required" && result.stopReason !== "clarification_required" && result.stopReason !== "phone_assistance_required" && result.stopReason !== "browser_assistance_required") deps.agentManager.scheduleBackgroundReviewAfterUserTurn(input.conversationId);
156
156
  return result;
157
157
  }
158
158
  //#endregion
@@ -1,15 +1,15 @@
1
1
  import { stripRuntimeUserMessageEnvelope } from "../../../packages/gateway-contract/src/user-message-display.js";
2
2
  import { parseUserTurnDocument, renderUserTurnDocument } from "../../../packages/gateway-contract/src/user-turn-document.js";
3
3
  import { init_src } from "../../../packages/gateway-contract/src/index.js";
4
+ import { init_agent_scope, resolveDefaultAgentId } from "../agent-scope.js";
4
5
  import { init_session_input_repository, listTaskUpdateTriggers } from "../../storage/sqlite/session-input-repository.js";
5
6
  import { init_types, isSessionSourceBinding, summarizeSourceContext } from "../source-context/types.js";
6
7
  import { init_injector, injectSourceContextsIntoUserMessage } from "../source-context/injector.js";
7
- import { init_agent_scope, resolveDefaultAgentId } from "../agent-scope.js";
8
8
  import { getConnectionResumeInput, init_connection_wait_repository } from "../../storage/sqlite/connection-wait-repository.js";
9
9
  import { readAgentMessageContent } from "../memory/agent-message-access.js";
10
10
  import { getClarificationResumeInput } from "../../storage/sqlite/clarification-wait-repository.js";
11
- import { init_model_usage, modelUsageOriginFromTurn, withModelUsageOrigin } from "../../providers/model-usage.js";
12
11
  import { init_agent_session_key, resolveAgentMainConversationId } from "../../routing/agent-session-key.js";
12
+ import { init_model_usage, modelUsageOriginFromTurn, withModelUsageOrigin } from "../../providers/model-usage.js";
13
13
  import { onSessionTranscriptUpdate } from "../../session/transcript-events.js";
14
14
  import { clearPendingTranscriptUserMessage, setPendingTranscriptUserMessage } from "../inbound/attachment-pipeline.js";
15
15
  import { abortEmbeddedRun } from "../embedded/runs.js";