@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
@@ -34,6 +34,19 @@ function mediaTypeFromMimeType(mimeType) {
34
34
  if (mimeType.startsWith("audio/")) return "audio";
35
35
  return "document";
36
36
  }
37
+ function buildOutboundMediaMetadata(contextMetadata, mediaFileName) {
38
+ const out = {};
39
+ if (contextMetadata) {
40
+ if (contextMetadata.accountId !== void 0) out.accountId = contextMetadata.accountId;
41
+ if (contextMetadata.threadId !== void 0) out.threadId = contextMetadata.threadId;
42
+ if (contextMetadata.inboundMessageId !== void 0) out.inboundMessageId = contextMetadata.inboundMessageId;
43
+ if (typeof contextMetadata.channelReplyId === "string" && contextMetadata.channelReplyId) out.channelReplyId = contextMetadata.channelReplyId;
44
+ if (contextMetadata.sessionWebhook !== void 0) out.sessionWebhook = contextMetadata.sessionWebhook;
45
+ if (contextMetadata.conversationId !== void 0) out.conversationId = contextMetadata.conversationId;
46
+ }
47
+ if (mediaFileName) out.mediaFileName = mediaFileName;
48
+ return Object.keys(out).length > 0 ? out : void 0;
49
+ }
37
50
  async function persistToolMedia(params) {
38
51
  const name = basename(params.filePath);
39
52
  const mimeType = detectToolMediaMimeType(params.buffer, params.filePath);
@@ -56,4 +69,4 @@ async function persistToolMedia(params) {
56
69
  };
57
70
  }
58
71
  //#endregion
59
- export { detectToolMediaMimeType, mediaTypeFromMimeType, persistToolMedia };
72
+ export { buildOutboundMediaMetadata, detectToolMediaMimeType, mediaTypeFromMimeType, persistToolMedia };
@@ -1,7 +1,7 @@
1
- import { projectForgottenEvidence } from "../../memory-learning/forgotten-history.js";
2
- import { retrievalLexicalSimilarity } from "../../retrieval/textFeatures.js";
3
1
  import { deleteUserAssertion, getAssertionSlot, getUserAssertion, listUserAssertionSources, listUserAssertions, reconcileAssertion, setAssertionStatus } from "../../user-model/repository.js";
4
2
  import { canUseAssertion } from "../../user-model/usage-policy.js";
3
+ import { projectForgottenEvidence } from "../../memory-learning/forgotten-history.js";
4
+ import { retrievalLexicalSimilarity } from "../../retrieval/textFeatures.js";
5
5
  import "../../user-model/index.js";
6
6
  import "./local-read-budget.js";
7
7
  import { memoryVersion } from "../../user-context/memory-version.js";
@@ -1,8 +1,8 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
+ import { checkUrlSafety, checkWebsiteBlocklist, cleanBase64Images } from "./url-safety.js";
3
4
  import { getDefaultModelSync, init_providers, resolveModel } from "../../providers/index.js";
4
5
  import { completeWithResolvedCredentials } from "../../providers/model-call.js";
5
- import { checkUrlSafety, checkWebsiteBlocklist, cleanBase64Images } from "./url-safety.js";
6
6
  import { Type } from "@sinclair/typebox";
7
7
  //#region src/agent/tools/web-extract.ts
8
8
  init_providers();
@@ -1,9 +1,9 @@
1
+ import { checkFileSafety } from "../prompt/safety.js";
1
2
  import { appendProductDeliveryText } from "../../../packages/gateway-contract/src/product-delivery.js";
2
3
  import { init_src } from "../../../packages/gateway-contract/src/index.js";
3
4
  import { fileResourceId, fileSpaceId } from "../../files/file-service.js";
4
5
  import { isBareProfileMarkdownFileName, resolvePathUnderWorkspace, resolveProfileMarkdownPathIfBareName } from "./tool-paths.js";
5
6
  import { writeWorkspaceFile } from "../sandbox/fileAccess.js";
6
- import { checkFileSafety } from "../prompt/safety.js";
7
7
  import { basename, isAbsolute, relative, sep } from "path";
8
8
  import { realpath } from "fs/promises";
9
9
  import { Type } from "@sinclair/typebox";
@@ -1,18 +1,20 @@
1
- import { runWithActivityContext } from "../../activity/context.js";
2
- import { init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
1
+ import { getDelegationScope } from "../orchestration/delegation-scope.js";
3
2
  import { ChatPreviewCreateInputSchema, ChatPreviewReviseInputSchema } from "../../../packages/gateway-contract/src/chat-previews.js";
4
3
  import { appendProductDeliveryText } from "../../../packages/gateway-contract/src/product-delivery.js";
5
4
  import { normalizeSpecialistRequirements } from "../../../packages/gateway-contract/src/specialists.js";
6
5
  import { TaskCommandSchema, TaskContextInputSchema, TaskWorkspaceDestinationSchema } from "../../../packages/gateway-contract/src/tasks.js";
7
6
  import { AutomationCancelOutputSchema, AutomationDeleteOutputSchema, AutomationMutationOutputSchema, AutomationReadAllInputSchema, AutomationReadAllOutputSchema, AutomationReadOutputSchema, AutomationRecoveryOutputSchema, AutomationRunMutationOutputSchema, CapabilityCallSchema, CapabilityResourceInputSchema, NoteDeleteOutputSchema, NoteGetOutputSchema, ProjectCreateInputSchema, ProjectDeleteInputSchema, ProjectDeleteOutputSchema, ProjectEditInputSchema, ProjectMilestoneCreateInputSchema, ProjectMilestoneDeleteInputSchema, ProjectMilestoneDeleteOutputSchema, ProjectMilestoneOutputSchema, ProjectMilestoneUpdateInputSchema, ProjectMutationOutputSchema, ProjectResolveWorkspaceInputSchema, ProjectResolveWorkspaceOutputSchema, ProjectSetPinnedInputSchema, ProjectUpdateCreateInputSchema, ProjectUpdateOutputSchema, TaskRunCancelInputSchema, TaskRunCancelOutputSchema, TaskRunFeedbackInputSchema, TaskRunFeedbackOutputSchema } from "../../../packages/gateway-contract/src/capabilities.js";
8
7
  import { init_src } from "../../../packages/gateway-contract/src/index.js";
8
+ import { init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
9
9
  import { TaskRepository } from "../../tasks/task-repository.js";
10
10
  import { TaskRunRepository, mcpDelegatedRunPrincipal } from "../../tasks/task-run-repository.js";
11
11
  import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
12
12
  import "../../storage/sqlite/index.js";
13
- import "../../activity/index.js";
14
- import { getDefaultAgentId, init_resolve_route } from "../../routing/resolve-route.js";
15
13
  import { isPersonalConversation } from "../../personal-agent/repository.js";
14
+ import { getDefaultAgentId, init_resolve_route } from "../../routing/resolve-route.js";
15
+ import { getEmbeddedExecutionRunId } from "../embedded/execution-context.js";
16
+ import { runWithActivityContext } from "../../activity/context.js";
17
+ import "../../activity/index.js";
16
18
  import { hasUnlocalizedTaskText, resolveTaskLocale } from "../../tasks/task-language.js";
17
19
  import { resolveProjectAgentId } from "../../projects/project-agent.js";
18
20
  import "../../projects/index.js";
@@ -21,7 +23,6 @@ import { TaskReadModelProjector } from "../../tasks/task-read-model-projector.js
21
23
  import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
22
24
  import { TaskCollaborationRepository } from "../../tasks/task-collaboration-repository.js";
23
25
  import { TaskOriginRepository } from "../../tasks/task-origin-repository.js";
24
- import { getEmbeddedExecutionRunId } from "../embedded/execution-context.js";
25
26
  import { CapabilityError } from "../../capabilities/runtime/errors.js";
26
27
  import { getAutomationSetup } from "../../automations/configuration-conversation.js";
27
28
  import "../../capabilities/runtime/dispatcher.js";
@@ -32,7 +33,6 @@ import { resolveResponseLanguageForSession } from "../prompt/response-language.j
32
33
  import { TaskMutationOutputSchema } from "../../tasks/capabilities/write.js";
33
34
  import { TaskDeletionService } from "../../tasks/task-deletion-service.js";
34
35
  import { TaskDeleteOutputSchema } from "../../tasks/capabilities/management.js";
35
- import { getDelegationScope } from "../orchestration/delegation-scope.js";
36
36
  import { localAppCapabilities } from "../../local-apps/capabilities/runtime.js";
37
37
  import { createProductDispatcher } from "../../capabilities/runtime/product.js";
38
38
  import { isTaskNotificationPreference, taskNotificationContext } from "../../tasks/task-notification-preference.js";
@@ -1,9 +1,9 @@
1
1
  import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
- import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
3
2
  import { DEFAULT_AGENT_ID, init_id, normalizeAgentId } from "./id.js";
4
3
  import { AgentDefaultsSchema, AgentEntrySchema, DEFAULT_AGENT_MODEL_REF, DEFAULT_SKILL_POLICY } from "../agent-config/schema.js";
5
4
  import { init_agent_config } from "../agent-config/index.js";
6
5
  import { BindingsSchema, init_binding_schema } from "../routing/binding-schema.js";
6
+ import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
7
7
  import { randomUUID } from "node:crypto";
8
8
  //#region src/agent-catalog/repository.ts
9
9
  function parseObject(value, label) {
@@ -1,8 +1,8 @@
1
1
  import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
2
  import { createLogger } from "../utils/logger/index.js";
3
3
  import { init_logger } from "../utils/logger.js";
4
- import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
5
4
  import { init_paths, resolveAgentAuthProfilesPath, resolveAuthProfilesPath, resolveCredentialsDir, resolveOAuthPath } from "../config/paths.js";
5
+ import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
6
6
  import { assertCurrentModelProvider, init_provider_policy, isRetiredModelProvider } from "../providers/provider-policy.js";
7
7
  import { getApiKeyFromEnv, init_env_keys } from "../providers/env-keys.js";
8
8
  import { init_oauth_provider_lock, withOAuthProviderLock } from "./oauth-provider-lock.js";
@@ -1,6 +1,6 @@
1
1
  import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
2
- import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
3
2
  import { init_paths, resolveCredentialsDir } from "../../config/paths.js";
3
+ import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
4
4
  import { init_register_bundled_oauth_flows, registerBundledOAuthFlows } from "../../providers/register-bundled-oauth-flows.js";
5
5
  import { init_oauth_provider_lock, withOAuthProviderLock } from "../oauth-provider-lock.js";
6
6
  import { join } from "node:path";
@@ -1,10 +1,10 @@
1
1
  import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
2
2
  import { generatePKCE, init_pkce } from "./pkce.js";
3
3
  import { init_resolution, resolveConnectedPlatformEndpoint } from "../../platform/resolution.js";
4
- import { hostname } from "node:os";
5
4
  import { randomBytes } from "node:crypto";
6
- import http from "node:http";
5
+ import { hostname } from "node:os";
7
6
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
7
+ import http from "node:http";
8
8
  //#region src/auth/oauth/xopc-cloud.ts
9
9
  function consoleUrl() {
10
10
  return (process.env.XOPC_CONSOLE_URL ?? resolveConnectedPlatformEndpoint("authorizationServer") ?? DEFAULT_CONSOLE_URL).replace(/\/+$/, "");
@@ -1,8 +1,8 @@
1
1
  import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
2
  import { init_paths, resolveOAuthPath } from "../config/paths.js";
3
- import { AsyncLocalStorage } from "node:async_hooks";
4
3
  import { dirname } from "node:path";
5
4
  import { randomUUID } from "node:crypto";
5
+ import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { mkdir, open, readFile, rm, stat } from "node:fs/promises";
7
7
  import { setTimeout } from "node:timers/promises";
8
8
  //#region src/auth/oauth-provider-lock.ts
@@ -1,5 +1,5 @@
1
- import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
2
1
  import { init_paths, resolveCredentialsDir } from "../../config/paths.js";
2
+ import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
3
3
  import path from "node:path";
4
4
  import { chmodSync, existsSync, mkdirSync, readFileSync } from "node:fs";
5
5
  //#region src/auth/profiles/store.ts
@@ -1,11 +1,11 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
+ import { assertUrlSafe } from "../../agent/tools/url-safety.js";
3
4
  import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
4
5
  import { getAutomationRun } from "../storage/automation-run-repository.js";
5
6
  import "../storage/index.js";
6
7
  import { getAutomationEventForRun } from "../events/event-repository.js";
7
8
  import { assertLocalAppDelivery } from "../../local-apps/execution-authority.js";
8
- import { assertUrlSafe } from "../../agent/tools/url-safety.js";
9
9
  import "../events/index.js";
10
10
  import { resolveAutomationWebhookSecret } from "../webhook-secrets.js";
11
11
  import { createHmac, randomUUID } from "node:crypto";
@@ -2,8 +2,8 @@ import { normalizeAgentId } from "../../agent-catalog/id.js";
2
2
  import { init_agent_scope } from "../../agent/agent-scope.js";
3
3
  import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
4
4
  import { init_session_repository } from "../../storage/sqlite/session-repository.js";
5
- import { init_model_usage, withModelUsageOrigin } from "../../providers/model-usage.js";
6
5
  import { init_session_key, resolveConversationId } from "../../routing/session-key.js";
6
+ import { init_model_usage, withModelUsageOrigin } from "../../providers/model-usage.js";
7
7
  import { getAutomationRunRequest, listAutomationRuns } from "../storage/automation-run-repository.js";
8
8
  import "../storage/index.js";
9
9
  import { withDeviceDelegation } from "../../endpoint-tools/delegation.js";
@@ -1,7 +1,7 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
- import { init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
4
3
  import { normalizeAgentId } from "../../agent-catalog/id.js";
4
+ import { init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
5
5
  import { init_agent_scope } from "../../agent/agent-scope.js";
6
6
  import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
7
7
  import { init_session_repository } from "../../storage/sqlite/session-repository.js";
@@ -1,13 +1,13 @@
1
- import { assertDatabaseOffline, init_offline_access } from "../storage/sqlite/offline-access.js";
2
1
  import { init_node_sqlite, requireNodeSqlite } from "../infra/node-sqlite.js";
2
+ import { assertDatabaseOffline, init_offline_access } from "../storage/sqlite/offline-access.js";
3
3
  import { expandWorkspacePathString, init_workspace_path } from "../config/workspace-path.js";
4
- import { tmpdir } from "node:os";
5
4
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
6
- import { constants, createReadStream, createWriteStream } from "node:fs";
7
5
  import { createCipheriv, createDecipheriv, createHash, randomBytes, randomUUID, scryptSync } from "node:crypto";
6
+ import { tmpdir } from "node:os";
7
+ import { constants, createReadStream, createWriteStream } from "node:fs";
8
8
  import { chmod, lstat, mkdir, mkdtemp, open, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
9
- import { pipeline } from "node:stream/promises";
10
9
  import { Transform } from "node:stream";
10
+ import { pipeline } from "node:stream/promises";
11
11
  //#region src/backup/archive.ts
12
12
  init_node_sqlite();
13
13
  init_offline_access();
@@ -0,0 +1,34 @@
1
+ import { type SessionInput } from '../storage/sqlite/session-input-repository.js';
2
+ export interface BrowserAssistanceCheckpoint {
3
+ browserSessionId: string;
4
+ reason: string;
5
+ url: string;
6
+ title: string;
7
+ }
8
+ export interface BrowserAssistance {
9
+ id: string;
10
+ conversationId: string;
11
+ transcriptId: string;
12
+ originRunId: string;
13
+ toolCallId: string;
14
+ checkpoint: BrowserAssistanceCheckpoint;
15
+ version: number;
16
+ createdAt: number;
17
+ status: 'open' | 'queued' | 'resuming' | 'completed' | 'cancelled';
18
+ queuedInputId?: string;
19
+ taskRunId?: string;
20
+ objectiveInputId?: string;
21
+ }
22
+ export declare class BrowserAssistanceError extends Error {
23
+ readonly code: string;
24
+ readonly status: number;
25
+ constructor(code: string, message: string, status?: number);
26
+ }
27
+ export declare function browserAssistance(conversationId: string): BrowserAssistance | undefined;
28
+ export declare function isBrowserAssistanceSuspended(conversationId: string, runId: string): boolean;
29
+ export declare function requireBrowserAssistance(conversationId: string, runId: string, toolCallId: string, checkpoint: BrowserAssistanceCheckpoint): BrowserAssistance;
30
+ export declare function cancelBrowserAssistance(conversationId: string): void;
31
+ export declare function queueBrowserAssistance(conversationId: string, waitId: string): BrowserAssistance;
32
+ export declare function consumeBrowserAssistance(input: SessionInput): boolean;
33
+ export declare function finishBrowserAssistance(input: SessionInput, succeeded: boolean): void;
34
+ export declare function reconcileBrowserAssistance(): string[];
@@ -0,0 +1,243 @@
1
+ import { init_connection, isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
2
+ import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
3
+ import { init_session_instance_repository, readCurrentTranscriptId } from "../storage/sqlite/session-instance-repository.js";
4
+ import { findSessionInputByRunId, getSessionInputById, init_session_input_repository, insertSessionInput } from "../storage/sqlite/session-input-repository.js";
5
+ import { DurableState, init_durable_state } from "../storage/sqlite/durable-state.js";
6
+ import { TaskRunRepository, init_task_run_repository } from "../tasks/task-run-repository.js";
7
+ import { randomUUID } from "node:crypto";
8
+ //#region src/browser/assistance.ts
9
+ init_durable_state();
10
+ init_connection();
11
+ init_transaction();
12
+ init_session_instance_repository();
13
+ init_session_input_repository();
14
+ init_task_run_repository();
15
+ var BrowserAssistanceError = class extends Error {
16
+ constructor(code, message, status = 409) {
17
+ super(message);
18
+ this.code = code;
19
+ this.status = status;
20
+ this.name = "BrowserAssistanceError";
21
+ }
22
+ };
23
+ const waits = new DurableState("browser.assistance");
24
+ function markTaskWaiting(wait) {
25
+ if (!wait.taskRunId) return;
26
+ const runs = new TaskRunRepository();
27
+ const run = runs.get(wait.taskRunId);
28
+ if (run?.status !== "running") return;
29
+ if (!runs.listActiveWaits(run.taskId).some((item) => item.taskRunId === run.id && item.condition.browserAssistanceId === wait.id)) runs.createWait({
30
+ taskId: run.taskId,
31
+ taskRunId: run.id,
32
+ kind: "user_input",
33
+ reason: wait.checkpoint.reason || "Browser requires manual operation",
34
+ condition: {
35
+ browserAssistanceId: wait.id,
36
+ browserSessionId: wait.checkpoint.browserSessionId
37
+ }
38
+ });
39
+ runs.setStatus({
40
+ runId: run.id,
41
+ expectedVersion: run.version,
42
+ from: ["running"],
43
+ to: "waiting",
44
+ actor: { kind: "system" }
45
+ });
46
+ }
47
+ function browserAssistance(conversationId) {
48
+ if (!isXopcDatabaseOpen()) return void 0;
49
+ const wait = waits.get(conversationId);
50
+ if (wait && readCurrentTranscriptId(getSqliteDatabase(), conversationId) !== wait.transcriptId) {
51
+ waits.delete(conversationId);
52
+ return;
53
+ }
54
+ return wait;
55
+ }
56
+ function isBrowserAssistanceSuspended(conversationId, runId) {
57
+ const wait = browserAssistance(conversationId);
58
+ return Boolean(wait && wait.originRunId === runId && wait.status === "open");
59
+ }
60
+ function requireBrowserAssistance(conversationId, runId, toolCallId, checkpoint) {
61
+ if (!isXopcDatabaseOpen()) throw new BrowserAssistanceError("BROWSER_ASSISTANCE_UNAVAILABLE", "Database is unavailable for browser assistance.", 503);
62
+ return runSqliteWriteTransaction((db) => {
63
+ const transcriptId = readCurrentTranscriptId(db, conversationId);
64
+ if (!transcriptId) throw new BrowserAssistanceError("BROWSER_CONVERSATION_NOT_FOUND", "Browser assistance requires a saved conversation.", 409);
65
+ const current = browserAssistance(conversationId);
66
+ if (current?.originRunId === runId && current.toolCallId === toolCallId && current.status === "open") return current;
67
+ const origin = findSessionInputByRunId(conversationId, runId);
68
+ const wait = {
69
+ id: randomUUID(),
70
+ conversationId,
71
+ transcriptId,
72
+ originRunId: runId,
73
+ toolCallId,
74
+ checkpoint,
75
+ status: "open",
76
+ version: (current?.version ?? 0) + 1,
77
+ createdAt: Date.now(),
78
+ taskRunId: origin?.taskRunId,
79
+ objectiveInputId: current?.queuedInputId === origin?.id ? current?.objectiveInputId : origin?.id
80
+ };
81
+ markTaskWaiting(wait);
82
+ waits.set(conversationId, wait);
83
+ return wait;
84
+ });
85
+ }
86
+ function cancelBrowserAssistance(conversationId) {
87
+ if (!isXopcDatabaseOpen()) return;
88
+ runSqliteWriteTransaction(() => {
89
+ const wait = isXopcDatabaseOpen() ? waits.get(conversationId) : void 0;
90
+ if (!wait || ["completed", "cancelled"].includes(wait.status)) return;
91
+ if (wait.taskRunId && [
92
+ "open",
93
+ "queued",
94
+ "resuming"
95
+ ].includes(wait.status)) {
96
+ const runs = new TaskRunRepository();
97
+ const run = runs.get(wait.taskRunId);
98
+ if (run && [
99
+ "queued",
100
+ "running",
101
+ "waiting",
102
+ "verifying"
103
+ ].includes(run.status)) {
104
+ for (const item of runs.listActiveWaits(run.taskId)) if (item.condition.browserAssistanceId === wait.id) runs.resolveWait({
105
+ waitId: item.id,
106
+ actor: { kind: "user" },
107
+ resolution: { cancelled: true }
108
+ });
109
+ runs.finalize({
110
+ runId: run.id,
111
+ expectedVersion: run.version,
112
+ actor: { kind: "user" },
113
+ terminalCode: "cancelled_by_user",
114
+ receipt: {
115
+ status: "cancelled",
116
+ summary: "Browser task cancelled",
117
+ changes: [],
118
+ evidence: [],
119
+ verification: {
120
+ status: "unverified",
121
+ checks: []
122
+ },
123
+ remainingWork: [],
124
+ needsUser: false,
125
+ completionVerdict: "not_achieved"
126
+ }
127
+ });
128
+ }
129
+ }
130
+ waits.set(conversationId, {
131
+ ...wait,
132
+ status: "cancelled",
133
+ version: wait.version + 1
134
+ });
135
+ });
136
+ }
137
+ function queueBrowserAssistance(conversationId, waitId) {
138
+ return runSqliteWriteTransaction(() => {
139
+ const wait = browserAssistance(conversationId);
140
+ if (!wait || wait.id !== waitId || wait.status === "cancelled") throw new BrowserAssistanceError("BROWSER_ASSISTANCE_CHANGED", "The browser task changed. Refresh before continuing.", 409);
141
+ if (wait.status !== "open") return wait;
142
+ const original = (wait.objectiveInputId ? getSessionInputById(conversationId, wait.objectiveInputId) : void 0) ?? findSessionInputByRunId(conversationId, wait.originRunId);
143
+ const input = insertSessionInput({
144
+ id: randomUUID(),
145
+ conversationId,
146
+ expectedTranscriptId: wait.transcriptId,
147
+ clientMessageId: `browser-assistance:${wait.id}`,
148
+ requestedDelivery: "next",
149
+ effectiveDelivery: "next",
150
+ status: "queued",
151
+ content: `用户已完成浏览器上的人工操作并交还控制权,请继续原任务。原请求时间:${new Date(original?.createdAtMs ?? wait.createdAt).toISOString()};原目标:${original?.content ?? wait.checkpoint.reason}。请先调用 browser_use 的 observe(sessionId: "${wait.checkpoint.browserSessionId}")读取当前最新页面状态,不要重复用户已经完成的登录或表单操作,然后继续完成原任务。`,
152
+ origin: {
153
+ type: "system",
154
+ source: "internal"
155
+ },
156
+ thinking: original?.thinking,
157
+ taskRunId: original?.taskRunId,
158
+ contextRefs: original?.contextRefs,
159
+ contextSnapshots: original?.contextSnapshots
160
+ });
161
+ if (input.origin.type !== "system" || input.origin.source !== "internal" || input.status !== "queued") throw new BrowserAssistanceError("BROWSER_ASSISTANCE_CHANGED", "The continuation request changed. Refresh before continuing.", 409);
162
+ const next = {
163
+ ...wait,
164
+ status: "queued",
165
+ queuedInputId: input.id,
166
+ version: wait.version + 1
167
+ };
168
+ waits.set(conversationId, next);
169
+ return next;
170
+ });
171
+ }
172
+ function consumeBrowserAssistance(input) {
173
+ if (!input.clientMessageId.startsWith("browser-assistance:")) return true;
174
+ return runSqliteWriteTransaction(() => {
175
+ const wait = browserAssistance(input.conversationId);
176
+ if (!wait || wait.queuedInputId !== input.id || wait.status !== "queued" || input.origin.type !== "system" || input.origin.source !== "internal") return false;
177
+ if (wait.taskRunId) {
178
+ const runs = new TaskRunRepository();
179
+ const run = runs.get(wait.taskRunId);
180
+ if (!run || run.status !== "waiting") return false;
181
+ const active = runs.listActiveWaits(run.taskId).filter((item) => item.taskRunId === run.id);
182
+ if (active.some((item) => item.condition.browserAssistanceId !== wait.id)) return false;
183
+ for (const item of active) runs.resolveWait({
184
+ waitId: item.id,
185
+ actor: { kind: "system" },
186
+ resolution: { browserAssistanceId: wait.id }
187
+ });
188
+ runs.setStatus({
189
+ runId: run.id,
190
+ expectedVersion: run.version,
191
+ from: ["waiting"],
192
+ to: "running",
193
+ actor: { kind: "system" }
194
+ });
195
+ }
196
+ waits.set(input.conversationId, {
197
+ ...wait,
198
+ status: "resuming",
199
+ version: wait.version + 1
200
+ });
201
+ return true;
202
+ });
203
+ }
204
+ function finishBrowserAssistance(input, succeeded) {
205
+ if (!isXopcDatabaseOpen()) return;
206
+ runSqliteWriteTransaction(() => {
207
+ const wait = browserAssistance(input.conversationId);
208
+ if (!wait || wait.queuedInputId !== input.id || !["queued", "resuming"].includes(wait.status)) return;
209
+ const next = {
210
+ ...wait,
211
+ status: succeeded ? "completed" : "open",
212
+ ...succeeded ? {} : {
213
+ id: randomUUID(),
214
+ queuedInputId: void 0
215
+ },
216
+ version: wait.version + 1
217
+ };
218
+ if (!succeeded) markTaskWaiting(next);
219
+ waits.set(input.conversationId, next);
220
+ });
221
+ }
222
+ function reconcileBrowserAssistance() {
223
+ if (!isXopcDatabaseOpen()) return [];
224
+ const conversations = [];
225
+ for (const wait of waits.values()) {
226
+ if (browserAssistance(wait.conversationId)?.id !== wait.id) continue;
227
+ const input = wait.queuedInputId ? getSessionInputById(wait.conversationId, wait.queuedInputId) : void 0;
228
+ if (wait.status === "resuming" || wait.status === "queued" && input?.status !== "queued") {
229
+ const next = {
230
+ ...wait,
231
+ status: "open",
232
+ queuedInputId: void 0,
233
+ id: randomUUID(),
234
+ version: wait.version + 1
235
+ };
236
+ markTaskWaiting(next);
237
+ waits.set(wait.conversationId, next);
238
+ } else if (wait.status === "queued") conversations.push(wait.conversationId);
239
+ }
240
+ return conversations;
241
+ }
242
+ //#endregion
243
+ export { BrowserAssistanceError, browserAssistance, cancelBrowserAssistance, consumeBrowserAssistance, finishBrowserAssistance, isBrowserAssistanceSuspended, queueBrowserAssistance, reconcileBrowserAssistance, requireBrowserAssistance };
@@ -1,5 +1,5 @@
1
- import { homedir } from "node:os";
2
1
  import { isAbsolute, relative, resolve, sep } from "node:path";
2
+ import { homedir } from "node:os";
3
3
  //#region src/browser/cache-dir-policy.ts
4
4
  function expandHome(input) {
5
5
  if (input === "~") return homedir();
@@ -4,10 +4,54 @@ export type BrowserPrimitiveInput = Exclude<BrowserActionInput, BrowserNavigateI
4
4
  } | {
5
5
  action: 'close';
6
6
  }>;
7
+ export type BrowserInteractiveKey = 'Enter' | 'Backspace' | 'Tab' | 'Escape' | 'Delete' | 'Home' | 'End' | 'PageUp' | 'PageDown' | 'Space' | 'ArrowUp' | 'ArrowDown' | 'ArrowLeft' | 'ArrowRight';
8
+ export type BrowserInteractiveInput = {
9
+ kind: 'pointer';
10
+ phase: 'down' | 'move' | 'up' | 'cancel' | 'click';
11
+ x: number;
12
+ y: number;
13
+ button?: 'left' | 'right' | 'middle';
14
+ } | {
15
+ kind: 'wheel';
16
+ x: number;
17
+ y: number;
18
+ deltaX: number;
19
+ deltaY: number;
20
+ } | {
21
+ kind: 'text';
22
+ text: string;
23
+ } | {
24
+ kind: 'key';
25
+ key: BrowserInteractiveKey;
26
+ } | {
27
+ kind: 'navigate';
28
+ action: 'back' | 'forward' | 'reload';
29
+ };
30
+ export interface ManagedBrowserFrame {
31
+ bytes: Uint8Array;
32
+ width: number;
33
+ height: number;
34
+ timestamp: number;
35
+ }
36
+ export interface ManagedBrowserViewport {
37
+ width: number;
38
+ height: number;
39
+ version: number;
40
+ }
41
+ export interface ManagedBrowserLiveHandle {
42
+ readonly sessionId: string;
43
+ getViewport(): ManagedBrowserViewport;
44
+ getUrl(): string;
45
+ getTitle(): Promise<string>;
46
+ startScreencast(onFrame: (frame: ManagedBrowserFrame) => void): Promise<() => Promise<void>>;
47
+ dispatchInput(input: BrowserInteractiveInput): Promise<void>;
48
+ invalidateRefs(): void;
49
+ }
7
50
  export interface BrowserDriver {
8
51
  readonly kind: 'playwright' | 'extension' | 'desktop';
9
52
  readonly abortClosesSession?: boolean;
10
53
  previewEndpoint?(sessionId: string): string | undefined;
54
+ getLiveHandle?(sessionId: string): ManagedBrowserLiveHandle | undefined;
11
55
  connect(): Promise<void>;
12
56
  disconnect(): Promise<void>;
13
57
  createSession(sessionId: string): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import type { BrowserControlResult, BrowserNavigateInput, BrowserObservation, BrowserObserveInput, BrowserTabsInput } from '@xopcai/browser-control-contract';
2
2
  import type { Browser, BrowserContext } from 'playwright-core';
3
- import type { BrowserDriver, BrowserPrimitiveInput } from './browser-driver.js';
3
+ import type { BrowserDriver, BrowserPrimitiveInput, ManagedBrowserLiveHandle } from './browser-driver.js';
4
4
  export interface PlaywrightConnection {
5
5
  browser: Browser;
6
6
  context?: BrowserContext;
@@ -21,6 +21,7 @@ export declare class PlaywrightDriver implements BrowserDriver {
21
21
  private sessions;
22
22
  constructor(options: PlaywrightDriverOptions);
23
23
  get abortClosesSession(): boolean;
24
+ getLiveHandle(sessionId: string): ManagedBrowserLiveHandle | undefined;
24
25
  connect(): Promise<void>;
25
26
  disconnect(): Promise<void>;
26
27
  createSession(sessionId: string): Promise<void>;