@xopcai/xopc 0.0.308 → 0.0.311

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 (554) hide show
  1. package/dist/browser-ext/_locales/en/messages.json +8 -0
  2. package/dist/browser-ext/_locales/zh_CN/messages.json +8 -0
  3. package/dist/browser-ext/dist/assets/{sidepanel-BbSQr-6P.css → sidepanel-DD6GEMvc.css} +16 -0
  4. package/dist/browser-ext/dist/sidepanel.html +1 -1
  5. package/dist/browser-ext/dist/sidepanel.js +537 -96
  6. package/dist/browser-ext/manifest.json +1 -1
  7. package/dist/extensions/telegram/xopc.extension.json +1 -1
  8. package/dist/gateway/static/root/assets/{activity-store-wgSB2HYK.js → activity-store-DVUTs1fk.js} +1 -1
  9. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-dUotwUO6.js → agent-avatar-dicebear-zKINl7UH.js} +1 -1
  10. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D2ePZKdY.js +1 -0
  11. package/dist/gateway/static/root/assets/{agents-VPDIGRSS.js → agents-BiD9STyv.js} +1 -1
  12. package/dist/gateway/static/root/assets/{api-BKHmTb0w.js → api-_aHQA8bd.js} +1 -1
  13. package/dist/gateway/static/root/assets/{app-link-BiBXVEvp.js → app-link-wamYbNUl.js} +1 -1
  14. package/dist/gateway/static/root/assets/{app-management-settings-panel-zPz0rOND.js → app-management-settings-panel-C94LAxyt.js} +1 -1
  15. package/dist/gateway/static/root/assets/{appearance-settings-DhvhR43G.js → appearance-settings-CP01zHvC.js} +1 -1
  16. package/dist/gateway/static/root/assets/apps-page-B7DmSJQj.js +1 -0
  17. package/dist/gateway/static/root/assets/{archive-plugin-BQVZMreT.js → archive-plugin-SwWFt5MT.js} +1 -1
  18. package/dist/gateway/static/root/assets/{attachment-load-CPE-TMPf.js → attachment-load-DdTFml9l.js} +1 -1
  19. package/dist/gateway/static/root/assets/{automations-page-C4IAy_zF.js → automations-page-Kmr5WVFp.js} +1 -1
  20. package/dist/gateway/static/root/assets/automations-workspace-bkijiu-Y.js +7 -0
  21. package/dist/gateway/static/root/assets/{binary-plugins-DgTl7diZ.js → binary-plugins-47UTtDNq.js} +1 -1
  22. package/dist/gateway/static/root/assets/{block-editor-CcOVA-Gw.js → block-editor-DvzZkMG8.js} +3 -3
  23. package/dist/gateway/static/root/assets/{browser-automation-inputs-BzkJog8e.js → browser-automation-inputs-C611KRBx.js} +1 -1
  24. package/dist/gateway/static/root/assets/{browser-automations-page--zKAgj1k.js → browser-automations-page-DrUKNL9X.js} +2 -2
  25. package/dist/gateway/static/root/assets/browser-settings-page-Dhf_MWCf.js +3 -0
  26. package/dist/gateway/static/root/assets/capabilities-settings-panel-BCubrDf8.js +8 -0
  27. package/dist/gateway/static/root/assets/channels-settings-e4T1DEfN.js +1 -0
  28. package/dist/gateway/static/root/assets/{chat-terminal-dock-BfLd2rIJ.js → chat-terminal-dock-Bg_m7HUE.js} +2 -2
  29. package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-Cq1tE_3b.js → chunk-KS7C4IRE-BMYIfy9x.js} +2 -2
  30. package/dist/gateway/static/root/assets/computer-settings-page-CosCmVsT.js +1 -0
  31. package/dist/gateway/static/root/assets/{connector-service-page-BlC1OXX4.js → connector-service-page-BL-hSR7_.js} +1 -1
  32. package/dist/gateway/static/root/assets/connectors-page-C0WWxnxJ.js +2 -0
  33. package/dist/gateway/static/root/assets/date-picker-DqYFVasF.js +1 -0
  34. package/dist/gateway/static/root/assets/{dependency-picker-CF_zYzxX.js → dependency-picker-DCyyFLKp.js} +1 -1
  35. package/dist/gateway/static/root/assets/{desktop-pet-CDwtLR7Z.js → desktop-pet-CFnnpRA_.js} +1 -1
  36. package/dist/gateway/static/root/assets/desktop-pet-settings-U5wWRH4c.js +1 -0
  37. package/dist/gateway/static/root/assets/device-pairing-wizard-BhHxvFO1.js +1 -0
  38. package/dist/gateway/static/root/assets/{extension-debug-page-CX5OXxEU.js → extension-debug-page-DA8WJ3-E.js} +1 -1
  39. package/dist/gateway/static/root/assets/{extension-page-BytR1PaY.js → extension-page-C2BIB88m.js} +1 -1
  40. package/dist/gateway/static/root/assets/{extension-settings-page-CkaMJA5F.js → extension-settings-page-kpYo979N.js} +1 -1
  41. package/dist/gateway/static/root/assets/{gateway-config-swr-B6wHa6ZI.js → gateway-config-swr-DUDX42qY.js} +1 -1
  42. package/dist/gateway/static/root/assets/{gateway-realtime-B53R0CA4.js → gateway-realtime-CGOW0-b4.js} +1 -1
  43. package/dist/gateway/static/root/assets/gateway-realtime-store-D4um_sV7.js +1 -0
  44. package/dist/gateway/static/root/assets/gateway-settings-CE9t1yTa.js +1 -0
  45. package/dist/gateway/static/root/assets/{gateway-startup-retry-DRzGnEV-.js → gateway-startup-retry-Cf8OxlvY.js} +1 -1
  46. package/dist/gateway/static/root/assets/home-page-C7Ezx8Du.js +1 -0
  47. package/dist/gateway/static/root/assets/{image-generation-api-Ck_pyDom.js → image-generation-api-D2YorS--.js} +1 -1
  48. package/dist/gateway/static/root/assets/{imports-page-DrtbjL8O.js → imports-page-NPk698vI.js} +1 -1
  49. package/dist/gateway/static/root/assets/index-1wIKA-kM.css +1 -0
  50. package/dist/gateway/static/root/assets/index-DxYitLp8.js +79 -0
  51. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BlZh41Xq.js → keyboard-shortcuts-settings-BhreF0_O.js} +1 -1
  52. package/dist/gateway/static/root/assets/local-app-workbench-page-CPmynb3x.js +2 -0
  53. package/dist/gateway/static/root/assets/{local-apps-page-DbP7wWuh.js → local-apps-page-DOZZBdqj.js} +1 -1
  54. package/dist/gateway/static/root/assets/{locale-store-msTfRK8P.js → locale-store-DA0Z5jM_.js} +1 -1
  55. package/dist/gateway/static/root/assets/{logs-page-C0n66FiO.js → logs-page-M8kz26yo.js} +2 -2
  56. package/dist/gateway/static/root/assets/{management-settings-i6GhxpGV.js → management-settings-JLqHYQvY.js} +1 -1
  57. package/dist/gateway/static/root/assets/{markdown-view-BInabSKf.js → markdown-view-BDpcjR_Z.js} +1 -1
  58. package/dist/gateway/static/root/assets/markdown-view-DSjfHfaW.css +1 -0
  59. package/dist/gateway/static/root/assets/{media-plugins-CnWChQ3Y.js → media-plugins-B75SWUJd.js} +1 -1
  60. package/dist/gateway/static/root/assets/messages-4BtQKYlM.js +3 -0
  61. package/dist/gateway/static/root/assets/note-detail-panel-B_Ft0M32.js +5 -0
  62. package/dist/gateway/static/root/assets/notes-page-C32mxSD-.js +8 -0
  63. package/dist/gateway/static/root/assets/{page-tabs-BWitjb3e.js → page-tabs-CMlQUzT6.js} +1 -1
  64. package/dist/gateway/static/root/assets/{popover-select-9i-ZtHXL.js → popover-select-B-GDnZO9.js} +1 -1
  65. package/dist/gateway/static/root/assets/preview-open-alternatives-cZ2hszQT.js +1 -0
  66. package/dist/gateway/static/root/assets/{product-open-page-gmi5LLwM.js → product-open-page-CPoSbglF.js} +1 -1
  67. package/dist/gateway/static/root/assets/project-detail-page-DYttWua0.js +1 -0
  68. package/dist/gateway/static/root/assets/projects-page-D46drWbl.js +1 -0
  69. package/dist/gateway/static/root/assets/{registry-api-BSWtko7U.js → registry-api-C0DCx3wv.js} +1 -1
  70. package/dist/gateway/static/root/assets/remote-access-hub-C9n9Nuhi.js +1 -0
  71. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CtOjKGWg.js → runtime-tools-settings-panel-bMLWRApp.js} +2 -2
  72. package/dist/gateway/static/root/assets/scenes-page-Dw3hmHAr.js +1 -0
  73. package/dist/gateway/static/root/assets/{schema-form-DkyyDcl2.js → schema-form-UVJV_7AS.js} +1 -1
  74. package/dist/gateway/static/root/assets/sessions-page-C8P6ff91.js +1 -0
  75. package/dist/gateway/static/root/assets/settings-advanced-gate-whpUsAy3.js +1 -0
  76. package/dist/gateway/static/root/assets/{settings-form-section-C0JDGN_V.js → settings-form-section-BqzOqonM.js} +1 -1
  77. package/dist/gateway/static/root/assets/settings-page-DQ9RJ8-b.js +1 -0
  78. package/dist/gateway/static/root/assets/settings-page-layout-D3Spald3.js +1 -0
  79. package/dist/gateway/static/root/assets/{settings-shell-layer-context-DCp6ykjQ.js → settings-shell-layer-context-BTQUDoJ2.js} +1 -1
  80. package/dist/gateway/static/root/assets/setup-status-panel-C8u601m8.js +1 -0
  81. package/dist/gateway/static/root/assets/{share-preview-page-Bt1K657Y.js → share-preview-page-BcgYzA7y.js} +1 -1
  82. package/dist/gateway/static/root/assets/shares-settings-Bv-2rZ8e.js +1 -0
  83. package/dist/gateway/static/root/assets/skill-reload-api-LM-cgWUS.js +1 -0
  84. package/dist/gateway/static/root/assets/skills-page-ggmb7rCW.js +2 -0
  85. package/dist/gateway/static/root/assets/{skills-page.utils-vq5Ujm03.js → skills-page.utils-ADABzrtk.js} +1 -1
  86. package/dist/gateway/static/root/assets/system-settings-panel-DfkcW_Za.js +1 -0
  87. package/dist/gateway/static/root/assets/task-detail-page-DC4yqDFd.js +1 -0
  88. package/dist/gateway/static/root/assets/{theme-store-1SZ-HFHX.js → theme-store-CegIlB8d.js} +1 -1
  89. package/dist/gateway/static/root/assets/tunnel-api-CTuwTdMm.js +1 -0
  90. package/dist/gateway/static/root/assets/use-autosave-5ZDd9XKh.js +1 -0
  91. package/dist/gateway/static/root/assets/user-model-page-BFKFhdZ0.js +2 -0
  92. package/dist/gateway/static/root/assets/{voice-api-key-field-B2pZCcxY.js → voice-api-key-field-D3urfd-n.js} +1 -1
  93. package/dist/gateway/static/root/assets/{voice-config-api-DgJML_uM.js → voice-config-api-DTyMdGOR.js} +1 -1
  94. package/dist/gateway/static/root/assets/{work-discovery-overlay-Bptv7bEY.js → work-discovery-overlay-JzM3Ylbs.js} +1 -1
  95. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BijCrNc4.js → workflow-run-setup-panel-Bn2CtRdB.js} +2 -2
  96. package/dist/gateway/static/root/assets/workflows-page-BiCmt98A.js +6 -0
  97. package/dist/gateway/static/root/connector-icons/SOURCES.md +0 -2
  98. package/dist/gateway/static/root/index.html +17 -20
  99. package/dist/gateway/static/root/notification-sw.js +1 -1
  100. package/dist/package.js +1 -1
  101. package/dist/packages/gateway-contract/src/notifications.js +12 -11
  102. package/dist/packages/gateway-contract/src/proactive.js +6 -6
  103. package/dist/packages/gateway-contract/src/project-monitoring.js +4 -4
  104. package/dist/packages/gateway-contract/src/project-operating.js +1 -4
  105. package/dist/packages/gateway-contract/src/sessions.js +6 -1
  106. package/dist/src/agent/agent-manager.d.ts +2 -6
  107. package/dist/src/agent/agent-manager.js +31 -5
  108. package/dist/src/agent/background-review/run-background-review.js +1 -1
  109. package/dist/src/agent/child-agent-factory.d.ts +1 -0
  110. package/dist/src/agent/child-agent-factory.js +18 -4
  111. package/dist/src/agent/coding/repository-instructions.d.ts +4 -0
  112. package/dist/src/agent/coding/repository-instructions.js +46 -2
  113. package/dist/src/agent/commands/command-registry.js +1 -1
  114. package/dist/src/agent/context/execution-scope.js +1 -1
  115. package/dist/src/agent/data-acquisition/git.d.ts +17 -0
  116. package/dist/src/agent/data-acquisition/git.js +100 -0
  117. package/dist/src/agent/data-acquisition/render.d.ts +7 -0
  118. package/dist/src/agent/data-acquisition/render.js +79 -0
  119. package/dist/src/agent/data-acquisition/scheduler.d.ts +12 -0
  120. package/dist/src/agent/data-acquisition/scheduler.js +53 -0
  121. package/dist/src/agent/data-acquisition/schema.d.ts +75 -0
  122. package/dist/src/agent/data-acquisition/schema.js +206 -0
  123. package/dist/src/agent/data-acquisition/service.d.ts +10 -0
  124. package/dist/src/agent/data-acquisition/service.js +292 -0
  125. package/dist/src/agent/data-acquisition/types.d.ts +37 -0
  126. package/dist/src/agent/data-acquisition/types.js +5 -0
  127. package/dist/src/agent/embedded/run-turn.js +16 -4
  128. package/dist/src/agent/embedded/session-runner.d.ts +1 -0
  129. package/dist/src/agent/embedded/session-runner.js +3 -0
  130. package/dist/src/agent/embedded/tool-result-truncation.js +11 -0
  131. package/dist/src/agent/embedded/xopc-tools-bridge.js +2 -1
  132. package/dist/src/agent/external-tools/cliProvider.d.ts +47 -0
  133. package/dist/src/agent/external-tools/cliProvider.js +317 -0
  134. package/dist/src/agent/external-tools/composio-provider.js +15 -4
  135. package/dist/src/agent/external-tools/gateway-tools.js +10 -3
  136. package/dist/src/agent/external-tools/index.js +14 -1
  137. package/dist/src/agent/external-tools/read-policy.d.ts +6 -0
  138. package/dist/src/agent/external-tools/read-policy.js +21 -0
  139. package/dist/src/agent/external-tools/service.d.ts +1 -0
  140. package/dist/src/agent/external-tools/service.js +4 -1
  141. package/dist/src/agent/external-tools/types.d.ts +3 -1
  142. package/dist/src/agent/external-tools/types.js +1 -0
  143. package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
  144. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
  145. package/dist/src/agent/memory/turn-provenance.js +2 -1
  146. package/dist/src/agent/orchestration/agent-turn-policy.js +25 -10
  147. package/dist/src/agent/orchestration/delegation-scope.d.ts +9 -0
  148. package/dist/src/agent/orchestration/delegation-scope.js +11 -0
  149. package/dist/src/agent/prompt/sections/tooling.js +3 -1
  150. package/dist/src/agent/prompt/subagent-context.js +4 -2
  151. package/dist/src/agent/sandbox/fileAccess.d.ts +2 -0
  152. package/dist/src/agent/sandbox/fileAccess.js +31 -2
  153. package/dist/src/agent/service/parse-outbound-session-key.js +1 -1
  154. package/dist/src/agent/service.js +1 -0
  155. package/dist/src/agent/service.types.d.ts +2 -0
  156. package/dist/src/agent/tools/dataBatch.d.ts +4 -0
  157. package/dist/src/agent/tools/dataBatch.js +50 -0
  158. package/dist/src/agent/tools/delegate-tool.d.ts +6 -3
  159. package/dist/src/agent/tools/delegate-tool.js +65 -48
  160. package/dist/src/agent/tools/delegation-parent-policy.d.ts +7 -0
  161. package/dist/src/agent/tools/delegation-parent-policy.js +41 -0
  162. package/dist/src/agent/tools/delegation-policy.d.ts +16 -0
  163. package/dist/src/agent/tools/delegation-policy.js +93 -0
  164. package/dist/src/agent/tools/factory.d.ts +4 -0
  165. package/dist/src/agent/tools/factory.js +45 -5
  166. package/dist/src/agent/tools/fetch-text.d.ts +7 -0
  167. package/dist/src/agent/tools/fetch-text.js +86 -0
  168. package/dist/src/agent/tools/find.js +1 -1
  169. package/dist/src/agent/tools/grep.js +11 -23
  170. package/dist/src/agent/tools/index.d.ts +1 -0
  171. package/dist/src/agent/tools/index.js +2 -1
  172. package/dist/src/agent/tools/knowledge-memory-tool.js +10 -2
  173. package/dist/src/agent/tools/read.js +7 -5
  174. package/dist/src/agent/tools/repository-search.d.ts +12 -2
  175. package/dist/src/agent/tools/repository-search.js +127 -74
  176. package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +20 -0
  177. package/dist/src/agent/tools/search/providers/xopc-cloud.js +56 -0
  178. package/dist/src/agent/tools/search/registry.d.ts +4 -2
  179. package/dist/src/agent/tools/search/registry.js +5 -3
  180. package/dist/src/agent/tools/web.js +19 -28
  181. package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
  182. package/dist/src/agent/tools/xopc-use-tool.js +46 -43
  183. package/dist/src/agent/workflow/subagent-runner.js +25 -3
  184. package/dist/src/agent/workflow/workflow-child-tools.js +13 -8
  185. package/dist/src/agent-config/schema.d.ts +7 -0
  186. package/dist/src/agent-config/schema.js +2 -0
  187. package/dist/src/automations/service/automation-service.d.ts +0 -4
  188. package/dist/src/automations/service/automation-service.js +0 -31
  189. package/dist/src/capabilities/store-connector.js +46 -0
  190. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  191. package/dist/src/cli/commands/project.js +1 -1
  192. package/dist/src/config/schema.d.ts +8 -4
  193. package/dist/src/config/schema.js +2 -12
  194. package/dist/src/config/web-patch.js +0 -5
  195. package/dist/src/connectors/account-selection.d.ts +14 -0
  196. package/dist/src/connectors/account-selection.js +26 -0
  197. package/dist/src/connectors/china-catalog.js +93 -226
  198. package/dist/src/connectors/cli/adapterRegistry.d.ts +4 -0
  199. package/dist/src/connectors/cli/adapterRegistry.js +26 -0
  200. package/dist/src/connectors/cli/adapters/lark.d.ts +2 -0
  201. package/dist/src/connectors/cli/adapters/lark.js +143 -0
  202. package/dist/src/connectors/cli/adapters/larkShortcuts.d.ts +3 -0
  203. package/dist/src/connectors/cli/adapters/larkShortcuts.js +64 -0
  204. package/dist/src/connectors/cli/adapters/wecom.d.ts +2 -0
  205. package/dist/src/connectors/cli/adapters/wecom.js +97 -0
  206. package/dist/src/connectors/cli/adapters/wps365/bundle.js +575 -0
  207. package/dist/src/connectors/cli/adapters/wps365.d.ts +2 -0
  208. package/dist/src/connectors/cli/adapters/wps365.js +115 -0
  209. package/dist/src/connectors/cli/assets.d.ts +3 -0
  210. package/dist/src/connectors/cli/assets.js +44 -0
  211. package/dist/src/connectors/cli/authorization.d.ts +16 -0
  212. package/dist/src/connectors/cli/authorization.js +184 -0
  213. package/dist/src/connectors/cli/distributions.d.ts +4 -0
  214. package/dist/src/connectors/cli/distributions.js +69 -0
  215. package/dist/src/connectors/cli/installer.d.ts +5 -0
  216. package/dist/src/connectors/cli/installer.js +102 -0
  217. package/dist/src/connectors/cli/lifecycle.d.ts +1 -0
  218. package/dist/src/connectors/cli/lifecycle.js +19 -0
  219. package/dist/src/connectors/cli/process.d.ts +18 -0
  220. package/dist/src/connectors/cli/process.js +100 -0
  221. package/dist/src/connectors/cli/protocol.d.ts +10 -0
  222. package/dist/src/connectors/cli/protocol.js +63 -0
  223. package/dist/src/connectors/cli/runtime.d.ts +10 -0
  224. package/dist/src/connectors/cli/runtime.js +93 -0
  225. package/dist/src/connectors/cli/store.d.ts +35 -0
  226. package/dist/src/connectors/cli/store.js +121 -0
  227. package/dist/src/connectors/cli/types.d.ts +73 -0
  228. package/dist/src/connectors/composio-backends.js +1 -1
  229. package/dist/src/connectors/composio-sessions.d.ts +1 -0
  230. package/dist/src/connectors/composio-sessions.js +8 -3
  231. package/dist/src/connectors/composio.js +1 -1
  232. package/dist/src/connectors/connection-candidates.js +22 -3
  233. package/dist/src/connectors/connection-recovery-service.d.ts +1 -0
  234. package/dist/src/connectors/connection-recovery-service.js +53 -8
  235. package/dist/src/connectors/health.js +52 -0
  236. package/dist/src/connectors/instances.js +5 -1
  237. package/dist/src/connectors/lifecycle.js +2 -0
  238. package/dist/src/connectors/principal.js +2 -1
  239. package/dist/src/connectors/runtime-adapter-registry.js +31 -0
  240. package/dist/src/connectors/types.d.ts +13 -1
  241. package/dist/src/connectors/usage.js +1 -1
  242. package/dist/src/connectors/workflow-preflight.js +8 -4
  243. package/dist/src/extensions/install.js +1 -1
  244. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  245. package/dist/src/gateway/hono/app.d.ts +2 -0
  246. package/dist/src/gateway/hono/app.js +4 -2
  247. package/dist/src/gateway/hono/lib/config-payload.d.ts +2 -15
  248. package/dist/src/gateway/hono/lib/config-payload.js +0 -11
  249. package/dist/src/gateway/hono/routes/cli-connectors.d.ts +3 -0
  250. package/dist/src/gateway/hono/routes/cli-connectors.js +219 -0
  251. package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +2 -2
  252. package/dist/src/gateway/hono/routes/config-patch/gateway.js +0 -59
  253. package/dist/src/gateway/hono/routes/config.js +0 -16
  254. package/dist/src/gateway/hono/routes/connectors.js +21 -22
  255. package/dist/src/gateway/hono/routes/deps.d.ts +2 -0
  256. package/dist/src/gateway/hono/routes/lazy-bundles.js +4 -17
  257. package/dist/src/gateway/hono/routes/projects.js +1 -1
  258. package/dist/src/gateway/hono/routes/public-gateway.js +0 -1
  259. package/dist/src/gateway/hono/routes/scenes.d.ts +3 -0
  260. package/dist/src/gateway/hono/routes/scenes.js +142 -0
  261. package/dist/src/gateway/hono/routes/sessions.js +141 -13
  262. package/dist/src/gateway/hono/routes/tasks.js +0 -46
  263. package/dist/src/gateway/hono/routes/user-model.js +54 -1
  264. package/dist/src/gateway/scenes/browserNotifications.d.ts +4 -0
  265. package/dist/src/gateway/scenes/browserNotifications.js +54 -0
  266. package/dist/src/gateway/scenes/host.d.ts +34 -0
  267. package/dist/src/gateway/scenes/host.js +129 -0
  268. package/dist/src/gateway/scenes/mailContext.d.ts +32 -0
  269. package/dist/src/gateway/scenes/mailContext.js +235 -0
  270. package/dist/src/gateway/security/gateway-scopes.js +0 -4
  271. package/dist/src/gateway/security/index.js +1 -1
  272. package/dist/src/gateway/service/config-coordinator.d.ts +1 -10
  273. package/dist/src/gateway/service/config-coordinator.js +0 -16
  274. package/dist/src/gateway/service/run-gateway-agent.js +1 -1
  275. package/dist/src/gateway/service.d.ts +4 -25
  276. package/dist/src/gateway/service.js +44 -99
  277. package/dist/src/gateway/session-context-summary.js +2 -1
  278. package/dist/src/infra/unhandled-rejections.js +1 -1
  279. package/dist/src/migrations/runner.js +1 -4
  280. package/dist/src/notifications/browser-endpoint.d.ts +2 -0
  281. package/dist/src/notifications/browser-endpoint.js +13 -0
  282. package/dist/src/notifications/browserSubscriptions.d.ts +20 -0
  283. package/dist/src/notifications/browserSubscriptions.js +59 -0
  284. package/dist/src/notifications/browserTransport.d.ts +9 -0
  285. package/dist/src/notifications/browserTransport.js +64 -0
  286. package/dist/src/notifications/dispatch.d.ts +46 -0
  287. package/dist/src/notifications/dispatch.js +109 -0
  288. package/dist/src/notifications/domain-delivery.d.ts +21 -0
  289. package/dist/src/notifications/planner.js +0 -36
  290. package/dist/src/notifications/quietHours.d.ts +6 -0
  291. package/dist/src/notifications/quietHours.js +23 -0
  292. package/dist/src/notifications/resultOutbox.d.ts +23 -0
  293. package/dist/src/notifications/resultOutbox.js +49 -0
  294. package/dist/src/notifications/service.d.ts +18 -4
  295. package/dist/src/notifications/service.js +42 -61
  296. package/dist/src/notifications/store.d.ts +2 -1
  297. package/dist/src/notifications/store.js +7 -8
  298. package/dist/src/projects/project-service.d.ts +1 -4
  299. package/dist/src/projects/project-service.js +2 -30
  300. package/dist/src/projects/workspace.js +1 -1
  301. package/dist/src/providers/model-catalog-persistence.js +19 -1
  302. package/dist/src/providers/model-catalog-store.js +1 -0
  303. package/dist/src/providers/model-catalog-types.d.ts +17 -0
  304. package/dist/src/providers/xopc-cloud-model-source.js +27 -0
  305. package/dist/src/scenes/agentExecutor.d.ts +8 -0
  306. package/dist/src/scenes/agentExecutor.js +63 -0
  307. package/dist/src/scenes/contracts.d.ts +118 -0
  308. package/dist/src/scenes/contracts.js +145 -0
  309. package/dist/src/scenes/execution.d.ts +56 -0
  310. package/dist/src/scenes/execution.js +168 -0
  311. package/dist/src/scenes/httpServices.d.ts +34 -0
  312. package/dist/src/scenes/inbox.d.ts +16 -0
  313. package/dist/src/scenes/inbox.js +68 -0
  314. package/dist/src/scenes/mailContext.d.ts +20 -0
  315. package/dist/src/scenes/mailContext.js +106 -0
  316. package/dist/src/scenes/mailObservations.d.ts +20 -0
  317. package/dist/src/scenes/mailObservations.js +107 -0
  318. package/dist/src/scenes/maintenance.d.ts +3 -0
  319. package/dist/src/scenes/maintenance.js +24 -0
  320. package/dist/src/scenes/metrics.d.ts +35 -0
  321. package/dist/src/scenes/metrics.js +94 -0
  322. package/dist/src/scenes/notificationEligibility.d.ts +17 -0
  323. package/dist/src/scenes/notificationEligibility.js +72 -0
  324. package/dist/src/scenes/notificationPublication.d.ts +7 -0
  325. package/dist/src/scenes/notificationPublication.js +43 -0
  326. package/dist/src/scenes/preferences.d.ts +40 -0
  327. package/dist/src/scenes/preferences.js +108 -0
  328. package/dist/src/scenes/readiness.d.ts +7 -0
  329. package/dist/src/scenes/readiness.js +20 -0
  330. package/dist/src/scenes/repository.d.ts +174 -0
  331. package/dist/src/scenes/repository.js +740 -0
  332. package/dist/src/scenes/resultNotifications.d.ts +17 -0
  333. package/dist/src/scenes/resultNotifications.js +204 -0
  334. package/dist/src/scenes/runtime.d.ts +25 -0
  335. package/dist/src/scenes/runtime.js +101 -0
  336. package/dist/src/scenes/schedule.d.ts +9 -0
  337. package/dist/src/scenes/schedule.js +45 -0
  338. package/dist/src/scenes/service.d.ts +29 -0
  339. package/dist/src/scenes/service.js +116 -0
  340. package/dist/src/scenes/templates.d.ts +64 -0
  341. package/dist/src/scenes/templates.js +76 -0
  342. package/dist/src/scenes/userNotes.d.ts +10 -0
  343. package/dist/src/scenes/userNotes.js +34 -0
  344. package/dist/src/session/resolve-session.js +2 -1
  345. package/dist/src/session/store.js +2 -1
  346. package/dist/src/share/share-config.js +0 -5
  347. package/dist/src/share/site-share-config.js +0 -5
  348. package/dist/src/storage/sqlite/connection-wait-repository.js +20 -7
  349. package/dist/src/storage/sqlite/connection.js +1 -1
  350. package/dist/src/storage/sqlite/connector-account-repository.js +1 -0
  351. package/dist/src/storage/sqlite/connector-sync-policy-repository.d.ts +0 -4
  352. package/dist/src/storage/sqlite/connector-sync-policy-repository.js +3 -17
  353. package/dist/src/storage/sqlite/conversation-repository.js +2 -1
  354. package/dist/src/storage/sqlite/index.d.ts +1 -0
  355. package/dist/src/storage/sqlite/index.js +4 -2
  356. package/dist/src/storage/sqlite/migrations/186_sidebar_layout.sql +16 -0
  357. package/dist/src/storage/sqlite/migrations/187_cli_connectors.sql +34 -0
  358. package/dist/src/storage/sqlite/migrations/188_scene_storage.sql +2 -0
  359. package/dist/src/storage/sqlite/migrations/189_scene_source_health.sql +8 -0
  360. package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +2 -0
  361. package/dist/src/storage/sqlite/migrations/conversation-backup.js +7 -3
  362. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  363. package/dist/src/storage/sqlite/migrations/runner.js +20 -44
  364. package/dist/src/storage/sqlite/migrations/scene-reset.d.ts +5 -0
  365. package/dist/src/storage/sqlite/migrations/scene-reset.js +40 -0
  366. package/dist/src/storage/sqlite/scenes-schema.d.ts +8 -0
  367. package/dist/src/storage/sqlite/scenes-schema.js +61 -0
  368. package/dist/src/storage/sqlite/schema.js +4 -10
  369. package/dist/src/storage/sqlite/schemas/notifications.sql +65 -0
  370. package/dist/src/storage/sqlite/schemas/scenes.sql +212 -0
  371. package/dist/src/storage/sqlite/session-read-repository.d.ts +8 -0
  372. package/dist/src/storage/sqlite/session-read-repository.js +35 -0
  373. package/dist/src/storage/sqlite/session-repository.d.ts +1 -1
  374. package/dist/src/storage/sqlite/session-repository.js +2 -25
  375. package/dist/src/storage/sqlite/sidebar-layout-repository.d.ts +12 -0
  376. package/dist/src/storage/sqlite/sidebar-layout-repository.js +53 -0
  377. package/dist/src/storage/sqlite/sql-assets.d.ts +2 -0
  378. package/dist/src/storage/sqlite/sql-assets.js +18 -0
  379. package/dist/src/storage/sqlite/transaction.d.ts +2 -0
  380. package/dist/src/storage/sqlite/transaction.js +20 -1
  381. package/dist/src/tasks/home-query-service.d.ts +0 -2
  382. package/dist/src/tasks/home-query-service.js +13 -43
  383. package/dist/src/tasks/index.d.ts +0 -1
  384. package/dist/src/tasks/index.js +4 -5
  385. package/dist/src/tasks/project-operating-view-service.js +1 -4
  386. package/dist/src/tui/backends/embedded-backend.js +1 -1
  387. package/dist/src/tui/tui-commands.js +1 -1
  388. package/dist/src/user-model/goals.d.ts +10 -0
  389. package/dist/src/user-model/goals.js +29 -1
  390. package/dist/src/user-model/index.js +2 -2
  391. package/dist/src/voice/realtime/memory-context.js +2 -1
  392. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  393. package/package.json +5 -3
  394. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C6LflMXr.js +0 -1
  395. package/dist/gateway/static/root/assets/api-DFOlahZv.js +0 -1
  396. package/dist/gateway/static/root/assets/apps-page-Pmslbzzr.js +0 -1
  397. package/dist/gateway/static/root/assets/automations-workspace-Fx5VUJRu.js +0 -6
  398. package/dist/gateway/static/root/assets/browser-settings-page-DBms6d35.js +0 -3
  399. package/dist/gateway/static/root/assets/capabilities-settings-panel-epdDWIZy.js +0 -8
  400. package/dist/gateway/static/root/assets/channels-settings-B0bsDtmP.js +0 -1
  401. package/dist/gateway/static/root/assets/channels-status-swr-B2JwuTjG.js +0 -1
  402. package/dist/gateway/static/root/assets/computer-settings-page-Ckgc0Py-.js +0 -1
  403. package/dist/gateway/static/root/assets/connectors-page-By33-bF1.js +0 -2
  404. package/dist/gateway/static/root/assets/cron-expression-CqNE-nf6.js +0 -2
  405. package/dist/gateway/static/root/assets/date-picker-BS9ZjzYJ.js +0 -1
  406. package/dist/gateway/static/root/assets/desktop-pet-settings-C0djIc1J.js +0 -1
  407. package/dist/gateway/static/root/assets/device-pairing-wizard-CDKj9LQj.js +0 -1
  408. package/dist/gateway/static/root/assets/external-link-DjqjBmc3.js +0 -1
  409. package/dist/gateway/static/root/assets/gateway-realtime-store-BLDgrJ30.js +0 -1
  410. package/dist/gateway/static/root/assets/gateway-settings-_YU-1p0z.js +0 -1
  411. package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +0 -1
  412. package/dist/gateway/static/root/assets/heartbeat-settings-CVIvvm4x.js +0 -1
  413. package/dist/gateway/static/root/assets/home-page-COCHelcL.js +0 -1
  414. package/dist/gateway/static/root/assets/index-CDfcPiPb.js +0 -79
  415. package/dist/gateway/static/root/assets/index-CRu1p38D.css +0 -1
  416. package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +0 -1
  417. package/dist/gateway/static/root/assets/local-app-workbench-page-D7_Raxjw.js +0 -2
  418. package/dist/gateway/static/root/assets/markdown-view-Y68dCxuc.css +0 -1
  419. package/dist/gateway/static/root/assets/messages-F74LVAiU.js +0 -3
  420. package/dist/gateway/static/root/assets/note-detail-panel-C59d8vDW.js +0 -5
  421. package/dist/gateway/static/root/assets/notes-page-C1GBPrVI.js +0 -8
  422. package/dist/gateway/static/root/assets/preview-open-alternatives-UaCWCxZv.js +0 -1
  423. package/dist/gateway/static/root/assets/proactive-page-CtSFJxoM.js +0 -1
  424. package/dist/gateway/static/root/assets/project-detail-page-ILTmQ1YN.js +0 -1
  425. package/dist/gateway/static/root/assets/projects-page-snl4rOQZ.js +0 -1
  426. package/dist/gateway/static/root/assets/remote-access-hub-BbaAcEN3.js +0 -1
  427. package/dist/gateway/static/root/assets/sessions-page-DrWL71O8.js +0 -1
  428. package/dist/gateway/static/root/assets/settings-advanced-gate-BG0kl4HT.js +0 -1
  429. package/dist/gateway/static/root/assets/settings-page-DiIyMQ52.js +0 -1
  430. package/dist/gateway/static/root/assets/settings-page-layout-X1x-2Cp9.js +0 -1
  431. package/dist/gateway/static/root/assets/setup-status-panel-EPazhoZO.js +0 -1
  432. package/dist/gateway/static/root/assets/shares-settings-g2MdRXSZ.js +0 -1
  433. package/dist/gateway/static/root/assets/skill-reload-api-B1DPzu98.js +0 -1
  434. package/dist/gateway/static/root/assets/skills-page-Wd0uYSPG.js +0 -2
  435. package/dist/gateway/static/root/assets/system-settings-panel-Cz1P-HDH.js +0 -1
  436. package/dist/gateway/static/root/assets/task-detail-page-BG3A5gPZ.js +0 -1
  437. package/dist/gateway/static/root/assets/tunnel-api-DQGoFuZO.js +0 -1
  438. package/dist/gateway/static/root/assets/use-autosave-DVDlBb95.js +0 -1
  439. package/dist/gateway/static/root/assets/user-model-page-qM5UiTGx.js +0 -2
  440. package/dist/gateway/static/root/assets/workflows-page-DRy1RAYH.js +0 -6
  441. package/dist/gateway/static/root/connector-icons/wps-calendar.svg +0 -14
  442. package/dist/gateway/static/root/connector-icons/wps-mail.svg +0 -7
  443. package/dist/src/connectors/source-change-publisher.d.ts +0 -17
  444. package/dist/src/connectors/source-change-publisher.js +0 -151
  445. package/dist/src/gateway/heartbeat/check-store.d.ts +0 -18
  446. package/dist/src/gateway/heartbeat/check-store.js +0 -74
  447. package/dist/src/gateway/heartbeat/index.d.ts +0 -1
  448. package/dist/src/gateway/heartbeat/index.js +0 -2
  449. package/dist/src/gateway/heartbeat/service.d.ts +0 -55
  450. package/dist/src/gateway/heartbeat/service.js +0 -228
  451. package/dist/src/gateway/hono/routes/proactive-control.d.ts +0 -3
  452. package/dist/src/gateway/hono/routes/proactive-control.js +0 -135
  453. package/dist/src/gateway/hono/routes/proactive.d.ts +0 -4
  454. package/dist/src/gateway/hono/routes/proactive.js +0 -164
  455. package/dist/src/gateway/hono/routes/workspace.d.ts +0 -3
  456. package/dist/src/gateway/hono/routes/workspace.js +0 -62
  457. package/dist/src/gateway/workspace-heartbeat-path.d.ts +0 -3
  458. package/dist/src/gateway/workspace-heartbeat-path.js +0 -14
  459. package/dist/src/migrations/conversation-routing-config.d.ts +0 -2
  460. package/dist/src/migrations/conversation-routing-config.js +0 -42
  461. package/dist/src/notifications/proactive-channel.d.ts +0 -8
  462. package/dist/src/notifications/proactive-channel.js +0 -60
  463. package/dist/src/notifications/proactive-policy.d.ts +0 -3
  464. package/dist/src/notifications/proactive-policy.js +0 -35
  465. package/dist/src/notifications/web-push.d.ts +0 -19
  466. package/dist/src/notifications/web-push.js +0 -185
  467. package/dist/src/proactive/actions/service.d.ts +0 -1
  468. package/dist/src/proactive/actions/service.js +0 -82
  469. package/dist/src/proactive/events/envelope.d.ts +0 -2
  470. package/dist/src/proactive/events/envelope.js +0 -54
  471. package/dist/src/proactive/events/product-event-bridge.d.ts +0 -7
  472. package/dist/src/proactive/events/product-event-bridge.js +0 -87
  473. package/dist/src/proactive/events/publisher.d.ts +0 -4
  474. package/dist/src/proactive/events/repository.d.ts +0 -9
  475. package/dist/src/proactive/events/repository.js +0 -63
  476. package/dist/src/proactive/events/types.d.ts +0 -44
  477. package/dist/src/proactive/events/types.js +0 -15
  478. package/dist/src/proactive/execution/agent-executor.d.ts +0 -21
  479. package/dist/src/proactive/execution/agent-executor.js +0 -125
  480. package/dist/src/proactive/execution/authorization.d.ts +0 -7
  481. package/dist/src/proactive/execution/authorization.js +0 -71
  482. package/dist/src/proactive/execution/context.d.ts +0 -49
  483. package/dist/src/proactive/execution/context.js +0 -408
  484. package/dist/src/proactive/execution/insight.d.ts +0 -14
  485. package/dist/src/proactive/execution/insight.js +0 -132
  486. package/dist/src/proactive/execution/repository.d.ts +0 -28
  487. package/dist/src/proactive/execution/repository.js +0 -211
  488. package/dist/src/proactive/execution/types.d.ts +0 -80
  489. package/dist/src/proactive/execution/worker.d.ts +0 -15
  490. package/dist/src/proactive/execution/worker.js +0 -146
  491. package/dist/src/proactive/experience.d.ts +0 -89
  492. package/dist/src/proactive/experience.js +0 -195
  493. package/dist/src/proactive/follow-ups.d.ts +0 -128
  494. package/dist/src/proactive/follow-ups.js +0 -182
  495. package/dist/src/proactive/inbox/cards.d.ts +0 -21
  496. package/dist/src/proactive/inbox/cards.js +0 -276
  497. package/dist/src/proactive/inbox/delivery.d.ts +0 -6
  498. package/dist/src/proactive/inbox/delivery.js +0 -54
  499. package/dist/src/proactive/inbox/digest.d.ts +0 -8
  500. package/dist/src/proactive/inbox/digest.js +0 -123
  501. package/dist/src/proactive/inbox/lifecycle.d.ts +0 -4
  502. package/dist/src/proactive/inbox/lifecycle.js +0 -62
  503. package/dist/src/proactive/inbox/notification-policy.d.ts +0 -1
  504. package/dist/src/proactive/inbox/notification-policy.js +0 -25
  505. package/dist/src/proactive/inbox/repository.d.ts +0 -25
  506. package/dist/src/proactive/inbox/repository.js +0 -244
  507. package/dist/src/proactive/inbox/service.d.ts +0 -23
  508. package/dist/src/proactive/inbox/service.js +0 -46
  509. package/dist/src/proactive/inbox/types.d.ts +0 -64
  510. package/dist/src/proactive/inbox/worker.d.ts +0 -13
  511. package/dist/src/proactive/inbox/worker.js +0 -71
  512. package/dist/src/proactive/index.d.ts +0 -20
  513. package/dist/src/proactive/index.js +0 -14
  514. package/dist/src/proactive/mail-thread.d.ts +0 -13
  515. package/dist/src/proactive/mail-thread.js +0 -55
  516. package/dist/src/proactive/maintenance.d.ts +0 -4
  517. package/dist/src/proactive/maintenance.js +0 -28
  518. package/dist/src/proactive/metrics.d.ts +0 -10
  519. package/dist/src/proactive/metrics.js +0 -28
  520. package/dist/src/proactive/policy/presence.d.ts +0 -2
  521. package/dist/src/proactive/policy/presence.js +0 -30
  522. package/dist/src/proactive/policy/service.d.ts +0 -54
  523. package/dist/src/proactive/policy/service.js +0 -123
  524. package/dist/src/proactive/routing/batch-repository.d.ts +0 -27
  525. package/dist/src/proactive/routing/batch-repository.js +0 -57
  526. package/dist/src/proactive/routing/matcher.d.ts +0 -5
  527. package/dist/src/proactive/routing/matcher.js +0 -57
  528. package/dist/src/proactive/routing/types.d.ts +0 -44
  529. package/dist/src/proactive/routing/types.js +0 -1
  530. package/dist/src/proactive/scenarios/control.d.ts +0 -52
  531. package/dist/src/proactive/scenarios/control.js +0 -75
  532. package/dist/src/proactive/scenarios/prompt-composer.d.ts +0 -14
  533. package/dist/src/proactive/scenarios/prompt-composer.js +0 -26
  534. package/dist/src/proactive/scenarios/repository.d.ts +0 -23
  535. package/dist/src/proactive/scenarios/repository.js +0 -174
  536. package/dist/src/proactive/scenarios/service.d.ts +0 -15
  537. package/dist/src/proactive/scenarios/service.js +0 -26
  538. package/dist/src/proactive/scenarios/types.d.ts +0 -43
  539. package/dist/src/proactive/scenarios/types.js +0 -1
  540. package/dist/src/proactive/service.d.ts +0 -25
  541. package/dist/src/proactive/service.js +0 -78
  542. package/dist/src/proactive/source-freshness.d.ts +0 -8
  543. package/dist/src/proactive/source-freshness.js +0 -28
  544. package/dist/src/proactive/status.d.ts +0 -2
  545. package/dist/src/proactive/status.js +0 -22
  546. package/dist/src/proactive/temporal/schedule.d.ts +0 -3
  547. package/dist/src/proactive/temporal/schedule.js +0 -68
  548. package/dist/src/proactive/temporal/worker.d.ts +0 -17
  549. package/dist/src/proactive/temporal/worker.js +0 -129
  550. package/dist/src/tasks/project-monitoring-service.d.ts +0 -32
  551. package/dist/src/tasks/project-monitoring-service.js +0 -118
  552. /package/dist/src/{proactive/execution → connectors/cli}/types.js +0 -0
  553. /package/dist/src/{proactive/events/publisher.js → notifications/domain-delivery.js} +0 -0
  554. /package/dist/src/{proactive/inbox/types.js → scenes/httpServices.js} +0 -0
@@ -1,84 +1,137 @@
1
1
  import { prepareSafeToolEnv } from "../sandbox/sanitize-env-vars.js";
2
2
  import { evaluateFilePolicy } from "../sandbox/exec-policy.js";
3
+ import { dataScheduler } from "../data-acquisition/scheduler.js";
3
4
  import { resolveRipgrepBinary } from "../../infra/ripgrep.js";
4
5
  import { lstatSync } from "node:fs";
5
6
  import { spawn } from "node:child_process";
7
+ import { StringDecoder } from "node:string_decoder";
6
8
  //#region src/agent/tools/repository-search.ts
7
- /** Bounded native search; unavailable tools and invalid regexes are explicit failures. */
8
- async function repositorySearch(cwd, args, signal) {
9
- signal?.throwIfAborted();
10
- const binary = await resolveRipgrepBinary();
11
- return new Promise((resolve, reject) => {
12
- const separator = args.indexOf("--");
13
- const options = separator < 0 ? args : args.slice(0, separator);
14
- const targets = separator < 0 ? [] : args.slice(separator);
15
- const excluded = [
16
- ".git",
17
- "node_modules",
18
- ".env",
19
- ".env.*",
20
- ".ssh",
21
- ".aws",
22
- ".gnupg",
23
- ".docker",
24
- ".config",
25
- ".netrc",
26
- ".npmrc",
27
- ".cargo/credentials",
28
- ".kube",
29
- ".xopc"
30
- ];
31
- const child = spawn(binary, [
32
- "--no-config",
33
- "--hidden",
34
- ...options,
35
- ...excluded.flatMap((path) => [
36
- "--glob",
37
- `!**/${path}`,
38
- "--glob",
39
- `!**/${path}/**`
40
- ]),
41
- "--no-follow",
42
- ...targets
43
- ], {
44
- cwd,
45
- env: prepareSafeToolEnv(process.env)
46
- });
47
- const chunks = [];
48
- let bytes = 0, truncated = false, stderr = "";
49
- const timer = setTimeout(() => child.kill("SIGKILL"), 1e4);
50
- const abort = () => child.kill("SIGKILL");
51
- signal?.addEventListener("abort", abort, { once: true });
52
- child.stdout.on("data", (chunk) => {
53
- const remaining = Math.max(0, 5e4 - bytes);
54
- chunks.push(chunk.subarray(0, remaining));
55
- bytes += chunk.length;
56
- if (bytes > 5e4) {
57
- truncated = true;
58
- child.kill("SIGKILL");
59
- }
60
- });
61
- child.stderr.on("data", (chunk) => {
62
- stderr = (stderr + String(chunk)).slice(-4e3);
63
- });
64
- child.on("error", reject);
65
- child.on("close", (code) => {
66
- clearTimeout(timer);
67
- signal?.removeEventListener("abort", abort);
68
- if (signal?.aborted) {
69
- reject(signal.reason ?? /* @__PURE__ */ new Error("Search aborted"));
70
- return;
71
- }
72
- if (code !== 0 && code !== 1 && !truncated) {
73
- reject(new Error(stderr || "Search did not complete; check ripgrep installation or narrow the search."));
74
- return;
75
- }
76
- resolve({
77
- output: Buffer.concat(chunks).toString("utf8"),
78
- truncated
9
+ function parseRepositoryMatch(workspace, line) {
10
+ if (!line) return void 0;
11
+ const event = JSON.parse(line);
12
+ if (event.type !== "match" && event.type !== "context") return void 0;
13
+ const data = event.data;
14
+ if (typeof data?.path?.text !== "string" || typeof data.lines?.text !== "string" || !Number.isInteger(data.line_number) || !isSearchFileAllowed(workspace, data.path.text)) return void 0;
15
+ return {
16
+ path: data.path.text,
17
+ line: data.line_number,
18
+ text: data.lines.text.replace(/\r?\n$/, ""),
19
+ match: event.type === "match"
20
+ };
21
+ }
22
+ /** One bounded process path for raw filename output and streamed JSON events. */
23
+ async function repositorySearch(cwd, args, signal, options = {}) {
24
+ const deadline = AbortSignal.any([...signal ? [signal] : [], AbortSignal.timeout(1e4)]);
25
+ return dataScheduler.run(cwd, deadline, async () => {
26
+ deadline.throwIfAborted();
27
+ const binary = await resolveRipgrepBinary();
28
+ deadline.throwIfAborted();
29
+ return new Promise((resolve, reject) => {
30
+ const separator = args.indexOf("--");
31
+ const searchOptions = separator < 0 ? args : args.slice(0, separator);
32
+ const targets = separator < 0 ? [] : args.slice(separator);
33
+ const excluded = [
34
+ ".git",
35
+ "node_modules",
36
+ ".env",
37
+ ".env.*",
38
+ ".ssh",
39
+ ".aws",
40
+ ".gnupg",
41
+ ".docker",
42
+ ".config",
43
+ ".netrc",
44
+ ".npmrc",
45
+ ".cargo/credentials",
46
+ ".kube",
47
+ ".xopc"
48
+ ];
49
+ const child = spawn(binary, [
50
+ "--no-config",
51
+ "--hidden",
52
+ ...searchOptions,
53
+ ...excluded.flatMap((path) => [
54
+ "--glob",
55
+ `!**/${path}`,
56
+ "--glob",
57
+ `!**/${path}/**`
58
+ ]),
59
+ "--no-follow",
60
+ ...targets
61
+ ], {
62
+ cwd,
63
+ env: prepareSafeToolEnv(process.env)
64
+ });
65
+ const chunks = [];
66
+ const decoder = new StringDecoder("utf8");
67
+ let bytes = 0, truncated = false, stderr = "", pending = "";
68
+ let failure;
69
+ const stop = () => child.kill("SIGKILL");
70
+ const consume = (text) => {
71
+ pending += text;
72
+ let newline;
73
+ while (!truncated && (newline = pending.indexOf("\n")) !== -1) {
74
+ const line = pending.slice(0, newline);
75
+ pending = pending.slice(newline + 1);
76
+ if (options.onLine?.(line) === false) {
77
+ truncated = true;
78
+ stop();
79
+ }
80
+ }
81
+ };
82
+ deadline.addEventListener("abort", stop, { once: true });
83
+ child.stdout.on("data", (chunk) => {
84
+ if (truncated || failure) return;
85
+ const remaining = Math.max(0, (options.maxBytes ?? 5e4) - bytes);
86
+ const selected = chunk.subarray(0, remaining);
87
+ bytes += chunk.length;
88
+ try {
89
+ if (options.onLine) consume(decoder.write(selected));
90
+ else chunks.push(selected);
91
+ } catch (error) {
92
+ failure = error instanceof Error ? error : new Error(String(error));
93
+ stop();
94
+ }
95
+ if (bytes > (options.maxBytes ?? 5e4)) {
96
+ truncated = true;
97
+ stop();
98
+ }
99
+ });
100
+ child.stderr.on("data", (chunk) => {
101
+ stderr = (stderr + String(chunk)).slice(-4e3);
102
+ });
103
+ child.on("error", (error) => {
104
+ failure = error;
105
+ });
106
+ child.on("close", (code) => {
107
+ deadline.removeEventListener("abort", stop);
108
+ if (deadline.aborted) {
109
+ reject(deadline.reason);
110
+ return;
111
+ }
112
+ if (failure) {
113
+ reject(failure);
114
+ return;
115
+ }
116
+ if (code !== 0 && code !== 1 && !truncated) {
117
+ reject(new Error(stderr || "Search did not complete; narrow the search."));
118
+ return;
119
+ }
120
+ try {
121
+ if (options.onLine && !truncated) {
122
+ consume(decoder.end());
123
+ if (pending && options.onLine(pending) === false) truncated = true;
124
+ }
125
+ resolve({
126
+ output: Buffer.concat(chunks).toString("utf8"),
127
+ truncated
128
+ });
129
+ } catch (error) {
130
+ reject(error);
131
+ }
79
132
  });
133
+ if (deadline.aborted) stop();
80
134
  });
81
- if (signal?.aborted) abort();
82
135
  });
83
136
  }
84
137
  /** Search results must satisfy the same policy as direct file reads. */
@@ -97,4 +150,4 @@ function isSearchFileAllowed(workspace, path) {
97
150
  }
98
151
  }
99
152
  //#endregion
100
- export { isSearchFileAllowed, repositorySearch };
153
+ export { isSearchFileAllowed, parseRepositoryMatch, repositorySearch };
@@ -0,0 +1,20 @@
1
+ import { type ModelCatalogStore } from '../../../../providers/model-catalog-store.js';
2
+ import { type ProviderAuthService } from '../../../../providers/provider-auth-service.js';
3
+ import type { SearchProvider, SearchResult } from '../types.js';
4
+ interface XopcCloudSearchProviderOptions {
5
+ region: 'cn' | 'global';
6
+ fetchImpl?: typeof fetch;
7
+ catalogStore?: Pick<ModelCatalogStore, 'getSource'>;
8
+ credentials?: Pick<ProviderAuthService, 'resolveApiKey'>;
9
+ }
10
+ export declare class XopcCloudSearchProvider implements SearchProvider {
11
+ private readonly options;
12
+ readonly name = "xopc-cloud";
13
+ private readonly fetchImpl;
14
+ private readonly catalogStore;
15
+ private readonly credentials;
16
+ constructor(options: XopcCloudSearchProviderOptions);
17
+ isAvailable(): boolean;
18
+ search(query: string, count: number, signal?: AbortSignal): Promise<SearchResult[]>;
19
+ }
20
+ export {};
@@ -0,0 +1,56 @@
1
+ import { getModelCatalogStore, init_model_catalog_store } from "../../../../providers/model-catalog-store.js";
2
+ import { getProviderAuthService, init_provider_auth_service } from "../../../../providers/provider-auth-service.js";
3
+ //#region src/agent/tools/search/providers/xopc-cloud.ts
4
+ init_model_catalog_store();
5
+ init_provider_auth_service();
6
+ var XopcCloudSearchProvider = class {
7
+ name = "xopc-cloud";
8
+ fetchImpl;
9
+ catalogStore;
10
+ credentials;
11
+ constructor(options) {
12
+ this.options = options;
13
+ this.fetchImpl = options.fetchImpl ?? fetch;
14
+ this.catalogStore = options.catalogStore ?? getModelCatalogStore();
15
+ this.credentials = options.credentials ?? getProviderAuthService();
16
+ }
17
+ isAvailable() {
18
+ return Boolean(this.catalogStore.getSource("xopc-cloud")?.search);
19
+ }
20
+ async search(query, count, signal) {
21
+ const source = this.catalogStore.getSource("xopc-cloud");
22
+ if (!source?.search) throw new Error("XOPC Cloud search is not available");
23
+ const requestSignal = signal ? AbortSignal.any([signal, AbortSignal.timeout(3e4)]) : AbortSignal.timeout(3e4);
24
+ const accessToken = await this.credentials.resolveApiKey("xopc-cloud", requestSignal);
25
+ if (!accessToken) throw new Error("XOPC Cloud is not connected");
26
+ const endpoint = `${source.baseUrl.replace(/\/+$/, "")}/${source.search.endpoint.replace(/^\/+/, "")}`;
27
+ const response = await this.fetchImpl(endpoint, {
28
+ method: "POST",
29
+ headers: {
30
+ authorization: `Bearer ${accessToken}`,
31
+ accept: "application/json",
32
+ "content-type": "application/json"
33
+ },
34
+ body: JSON.stringify({
35
+ query,
36
+ count: Math.max(1, Math.min(count, source.search.maxResults)),
37
+ region: this.options.region
38
+ }),
39
+ signal: requestSignal
40
+ });
41
+ const body = await response.json().catch(() => null);
42
+ if (!response.ok) throw new Error(typeof body?.error?.message === "string" ? body.error.message : `XOPC Cloud search failed (${response.status})`);
43
+ if (!Array.isArray(body?.results)) throw new Error("XOPC Cloud search returned an invalid response");
44
+ return body.results.flatMap((result) => {
45
+ if (typeof result.title !== "string" || typeof result.url !== "string" || typeof result.description !== "string") return [];
46
+ return [{
47
+ title: result.title,
48
+ url: result.url,
49
+ description: result.description,
50
+ source: this.name
51
+ }];
52
+ });
53
+ }
54
+ };
55
+ //#endregion
56
+ export { XopcCloudSearchProvider };
@@ -1,8 +1,10 @@
1
- import type { ResolvedWebSearchConfig, SearchResult } from './types.js';
1
+ import type { ResolvedWebSearchConfig, SearchProvider, SearchResult } from './types.js';
2
2
  export declare class SearchProviderRegistry {
3
3
  private readonly providers;
4
4
  private readonly fallbackProvider;
5
- constructor(config: ResolvedWebSearchConfig);
5
+ constructor(config: ResolvedWebSearchConfig, options?: {
6
+ cloudProvider?: SearchProvider;
7
+ });
6
8
  private buildProviders;
7
9
  hasConfiguredApiProvider(): boolean;
8
10
  search(query: string, count: number, signal?: AbortSignal): Promise<{
@@ -6,22 +6,24 @@ import { BingApiProvider } from "./providers/bing-api.js";
6
6
  import { BingHtmlProvider } from "./providers/bing-html.js";
7
7
  import { DuckDuckGoHtmlProvider } from "./providers/duckduckgo-html.js";
8
8
  import { SearXNGProvider } from "./providers/searxng.js";
9
+ import { XopcCloudSearchProvider } from "./providers/xopc-cloud.js";
9
10
  //#region src/agent/tools/search/registry.ts
10
11
  init_logger();
11
12
  const log = createLogger("Agent:WebSearch");
12
13
  var SearchProviderRegistry = class {
13
14
  providers;
14
15
  fallbackProvider;
15
- constructor(config) {
16
- this.providers = this.buildProviders(config);
16
+ constructor(config, options = {}) {
17
+ this.providers = this.buildProviders(config, options.cloudProvider);
17
18
  this.fallbackProvider = config.region === "cn" ? new BingHtmlProvider() : new DuckDuckGoHtmlProvider();
18
19
  log.debug({
19
20
  region: config.region,
20
21
  configuredCount: this.providers.filter((p) => p.isAvailable()).length
21
22
  }, "Web search registry ready");
22
23
  }
23
- buildProviders(config) {
24
+ buildProviders(config, cloudProvider) {
24
25
  const list = [];
26
+ if (config.providers.length === 0) list.push(cloudProvider ?? new XopcCloudSearchProvider({ region: config.region }));
25
27
  for (const p of config.providers) {
26
28
  if (p.disabled) continue;
27
29
  switch (p.type) {
@@ -1,6 +1,6 @@
1
1
  import { SearchProviderRegistry } from "./search/registry.js";
2
2
  import { resolveWebSearchConfig } from "./search/resolve-config.js";
3
- import { checkUrlSafety, checkWebsiteBlocklist } from "./url-safety.js";
3
+ import { fetchPublicText } from "./fetch-text.js";
4
4
  import { Type } from "@sinclair/typebox";
5
5
  //#region src/agent/tools/web.ts
6
6
  const WebSearchSchema = Type.Object({
@@ -16,6 +16,7 @@ function createWebSearchTool(getConfig) {
16
16
  description: "Search the web. Uses configured search APIs when set; otherwise falls back to a built-in HTML search (region-aware).",
17
17
  parameters: WebSearchSchema,
18
18
  label: "🔍 Web Search",
19
+ supportsParallel: true,
19
20
  async execute(_toolCallId, params, signal) {
20
21
  const p = params;
21
22
  const cfg = resolveWebSearchConfig(getConfig()?.tools?.web);
@@ -49,13 +50,15 @@ function createWebSearchTool(getConfig) {
49
50
  type: "text",
50
51
  text: `Search error: ${error instanceof Error ? error.message : String(error)}`
51
52
  }],
52
- details: { results: [] }
53
+ details: {
54
+ results: [],
55
+ error: error instanceof Error ? error.message : String(error)
56
+ }
53
57
  };
54
58
  }
55
59
  }
56
60
  };
57
61
  }
58
- const MAX_FETCH_CHARS = 6e6;
59
62
  const WebFetchSchema = Type.Object({
60
63
  url: Type.String({ description: "The URL to fetch" }),
61
64
  maxChars: Type.Optional(Type.Number({ description: "Maximum characters to return (default: 10000)" }))
@@ -76,47 +79,35 @@ function createWebFetchTool(getConfig) {
76
79
  description: "Fetch and extract readable content from a URL (HTML via Readability; plain text as-is).",
77
80
  parameters: WebFetchSchema,
78
81
  label: "🌐 Web Fetch",
82
+ supportsParallel: true,
79
83
  async execute(_toolCallId, params, signal) {
80
84
  try {
81
85
  const p = params;
82
- const safety = checkUrlSafety(p.url);
83
- if (!safety.safe) return {
84
- content: [{
85
- type: "text",
86
- text: `Blocked: ${safety.reason}`
87
- }],
88
- details: {}
89
- };
90
- const blocked = checkWebsiteBlocklist(p.url, getConfig()?.tools?.web?.blocklist);
91
- if (blocked) return {
92
- content: [{
93
- type: "text",
94
- text: `Blocked: ${blocked.message}`
95
- }],
96
- details: {}
97
- };
98
- const response = await fetch(p.url, { signal });
99
- if (!response.ok) throw new Error(`HTTP ${response.status}`);
100
- const html = await response.text();
101
- if (html.length > MAX_FETCH_CHARS) throw new Error("Response too large");
86
+ const fetched = await fetchPublicText(p.url, getConfig()?.tools?.web?.blocklist, signal);
87
+ const html = fetched.text;
102
88
  const maxChars = p.maxChars || 1e4;
103
- const contentType = response.headers.get("content-type") ?? "";
89
+ const contentType = fetched.contentType;
104
90
  const looksHtml = /html|xml/i.test(contentType) || /^[\s\n]*</.test(html.slice(0, Math.min(500, html.length)));
105
91
  let text;
106
92
  if (looksHtml) try {
107
- text = await extractReadableText(html, p.url);
93
+ text = await extractReadableText(html, fetched.url);
108
94
  if (!text || text.length < 40) text = stripHtmlFallback(html);
109
95
  } catch {
110
96
  text = stripHtmlFallback(html);
111
97
  }
112
98
  else text = html.trim();
113
- if (text.length > maxChars) text = text.substring(0, maxChars) + "\n\n[truncated...]";
99
+ const truncated = text.length > maxChars;
100
+ if (truncated) text = text.substring(0, maxChars) + "\n\n[truncated...]";
114
101
  return {
115
102
  content: [{
116
103
  type: "text",
117
104
  text
118
105
  }],
119
- details: {}
106
+ details: {
107
+ truncated,
108
+ complete: !truncated,
109
+ url: fetched.url
110
+ }
120
111
  };
121
112
  } catch (error) {
122
113
  return {
@@ -124,7 +115,7 @@ function createWebFetchTool(getConfig) {
124
115
  type: "text",
125
116
  text: `Fetch error: ${error instanceof Error ? error.message : String(error)}`
126
117
  }],
127
- details: {}
118
+ details: { error: error instanceof Error ? error.message : String(error) }
128
119
  };
129
120
  }
130
121
  }
@@ -1,3 +1,4 @@
1
+ import type { SceneAccess } from '../../scenes/httpServices.js';
1
2
  import type { AgentTool } from '@earendil-works/pi-agent-core';
2
3
  import { type ProductDeliveryEnvelope } from '@xopcai/gateway-contract';
3
4
  import { type AutomationService } from '../../automations/index.js';
@@ -6,12 +7,12 @@ import type { NotesService } from '../../notes/index.js';
6
7
  import { type ProjectService } from '../../projects/index.js';
7
8
  import type { LocalAppService } from '../../local-apps/index.js';
8
9
  declare const XopcUseToolSchema: import("@sinclair/typebox").TObject<{
9
- mode: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"proactive">, import("@sinclair/typebox").TLiteral<"project">, import("@sinclair/typebox").TLiteral<"automation">, import("@sinclair/typebox").TLiteral<"note">, import("@sinclair/typebox").TLiteral<"task">, import("@sinclair/typebox").TLiteral<"task_run">, import("@sinclair/typebox").TLiteral<"local_app">, import("@sinclair/typebox").TLiteral<"settings">]>;
10
+ mode: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"scene">, import("@sinclair/typebox").TLiteral<"project">, import("@sinclair/typebox").TLiteral<"automation">, import("@sinclair/typebox").TLiteral<"note">, import("@sinclair/typebox").TLiteral<"task">, import("@sinclair/typebox").TLiteral<"task_run">, import("@sinclair/typebox").TLiteral<"local_app">, import("@sinclair/typebox").TLiteral<"settings">]>;
10
11
  command: import("@sinclair/typebox").TString;
11
12
  args: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TAny>>;
12
13
  dryRun: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
13
14
  }>;
14
- export type XopcUseMode = 'proactive' | 'project' | 'automation' | 'note' | 'task' | 'task_run' | 'local_app' | 'settings';
15
+ export type XopcUseMode = 'scene' | 'project' | 'automation' | 'note' | 'task' | 'task_run' | 'local_app' | 'settings';
15
16
  export interface XopcUseToolInput {
16
17
  mode: XopcUseMode;
17
18
  command: string;
@@ -24,6 +25,7 @@ export interface XopcUseToolDeps {
24
25
  getCurrentAgentId?: () => string | undefined;
25
26
  getCurrentConversationId?: () => string | undefined;
26
27
  getAutomationService?: () => AutomationService | undefined;
28
+ getSceneAccess?: () => SceneAccess | undefined;
27
29
  getNotesService?: () => NotesService | undefined;
28
30
  getProjectService?: () => ProjectService | undefined;
29
31
  getLocalAppService?: () => LocalAppService | undefined;
@@ -5,7 +5,7 @@ import { appendProductDeliveryText } from "../../../packages/gateway-contract/sr
5
5
  import { init_src } from "../../../packages/gateway-contract/src/index.js";
6
6
  import { enqueueTaskChangedEvent } from "../../tasks/task-change-events.js";
7
7
  import { TaskRunRepository } from "../../tasks/task-run-repository.js";
8
- import { getSessionMetadata } from "../../storage/sqlite/session-repository.js";
8
+ import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
9
9
  import "../../storage/sqlite/index.js";
10
10
  import { ObjectLinkService } from "../../activity/service.js";
11
11
  import "../../activity/index.js";
@@ -14,15 +14,11 @@ import { TaskRepository } from "../../tasks/task-repository.js";
14
14
  import { TaskReadModelProjector } from "../../tasks/task-read-model-projector.js";
15
15
  import { isValidProjectAgentId, normalizeProjectAgentId, resolveProjectAgentId } from "../../projects/project-agent.js";
16
16
  import "../../projects/index.js";
17
- import { updateControlledSubscription } from "../../proactive/scenarios/control.js";
18
- import { continueMailFollowUp, mailFollowUpSources, startMailFollowUp, updateMailFollowUp } from "../../proactive/follow-ups.js";
17
+ import { CreateAutomationSchema, UpdateAutomationSchema } from "../../automations/domain/validation.js";
18
+ import "../../automations/index.js";
19
19
  import { TaskContextRepository } from "../../tasks/task-context-repository.js";
20
20
  import { TaskDependencyError, TaskDependencyService } from "../../tasks/task-dependency-service.js";
21
21
  import { TaskApplicationService } from "../../tasks/task-application-service.js";
22
- import { getCard } from "../../proactive/inbox/cards.js";
23
- import { checkDelegation, delegationOverview, startDelegation } from "../../proactive/experience.js";
24
- import { CreateAutomationSchema, UpdateAutomationSchema } from "../../automations/domain/validation.js";
25
- import "../../automations/index.js";
26
22
  import { defineTaskContract } from "../../tasks/task-contract-definition.js";
27
23
  import { TaskDeletionService } from "../../tasks/task-deletion-service.js";
28
24
  import "../../tasks/index.js";
@@ -34,7 +30,7 @@ init_resolve_route();
34
30
  init_transaction();
35
31
  const XopcUseToolSchema = Type.Object({
36
32
  mode: Type.Union([
37
- Type.Literal("proactive"),
33
+ Type.Literal("scene"),
38
34
  Type.Literal("project"),
39
35
  Type.Literal("automation"),
40
36
  Type.Literal("note"),
@@ -43,7 +39,7 @@ const XopcUseToolSchema = Type.Object({
43
39
  Type.Literal("local_app"),
44
40
  Type.Literal("settings")
45
41
  ]),
46
- command: Type.String({ description: "Object command. Proactive commands: list, get_card {id}, start {scenarioKey: project_delivery_risk|meeting_preparation|discussion_follow_up, projectId?: string, instructions: string}, update {id, expectedRevision, userInstructions?, enabled?, completedAt?}, check {id}. Also supports mail_sources, follow_up {sourceItemId, instructions, dueAt: ISO timestamp}, update_follow_up {id, expectedRevision, instructions?, dueAt?, status?: watching|paused|completed}, continue_card {id}. continue_card binds the current conversation and returns the exact email account; review the full draft and use connector confirmation before sending. Use proactive only for work the user explicitly delegates; inspect list first and update existing work instead of duplicating it. Supports project list/get/create/update/resolve_workspace/list_milestones/create_milestone/update_milestone/list_updates/create_update, automation list/get/create/update/delete/run/pause/resume/history, note list/get/create/append/update/preview_edit/delete, task list/get/create/update_dependencies/add_context/remove_context/command/delete, task_run list/get/cancel, local_app list/get/create/validate, and settings open." }),
42
+ command: Type.String({ description: "Object command. Scene commands: templates, list, get {id}, mail_accounts, mail_search {accountId, query}, mail_sources, preflight/start {templateKey, templateVersion, goal, scope, permissions}, configure {id, expectedRevision, goal, scope, permissions}, transition {id, expectedRevision, status: paused|active|completed|archived}, check {id}, notes {id, expectedRevision, content, validUntil?}, work_item {id, subjectId, accountId, dueAt}, schedule {id, triggerKey, expectedRevision, schedule}, results {id}. Start and check accept a stable requestId for retries. Scenes prepare read-only suggestions and drafts; never send mail. Only create a scene for work explicitly delegated by the user; inspect existing scenes first. Supports project list/get/create/update/resolve_workspace/list_milestones/create_milestone/update_milestone/list_updates/create_update, automation list/get/create/update/delete/run/pause/resume/history, note list/get/create/append/update/preview_edit/delete, task list/get/create/update_dependencies/add_context/remove_context/command/delete, task_run list/get/cancel, local_app list/get/create/validate, and settings open." }),
47
43
  args: Type.Optional(Type.Record(Type.String(), Type.Any())),
48
44
  dryRun: Type.Optional(Type.Boolean({ description: "Validate and preview the action without mutating xopc state." }))
49
45
  });
@@ -1801,7 +1797,7 @@ function createXopcUseTool(deps) {
1801
1797
  kind: "xopc_use",
1802
1798
  toolCallId
1803
1799
  }
1804
- }, async () => mode === "proactive" ? handleProactive(command, args, deps, dryRun) : mode === "project" ? await handleProject(command, args, deps, dryRun) : mode === "automation" ? await handleAutomation(command, args, deps, dryRun) : mode === "note" ? await handleNote(command, args, deps, dryRun) : mode === "task" ? await handleTask(command, args, deps, dryRun) : mode === "task_run" ? await handleTaskRun(command, args, dryRun, deps) : mode === "local_app" ? await handleLocalApp(command, args, deps, dryRun) : mode === "settings" ? handleSettings(command, args) : {
1800
+ }, async () => mode === "scene" ? await handleScene(command, args, deps, dryRun, toolCallId) : mode === "project" ? await handleProject(command, args, deps, dryRun) : mode === "automation" ? await handleAutomation(command, args, deps, dryRun) : mode === "note" ? await handleNote(command, args, deps, dryRun) : mode === "task" ? await handleTask(command, args, deps, dryRun) : mode === "task_run" ? await handleTaskRun(command, args, dryRun, deps) : mode === "local_app" ? await handleLocalApp(command, args, deps, dryRun) : mode === "settings" ? handleSettings(command, args) : {
1805
1801
  ok: false,
1806
1802
  error: `Unsupported mode: ${String(mode)}`
1807
1803
  });
@@ -1816,44 +1812,51 @@ function createXopcUseTool(deps) {
1816
1812
  }
1817
1813
  };
1818
1814
  }
1819
- function handleProactive(command, args, deps, dryRun) {
1820
- const workspace = deps.getWorkspace?.();
1821
- if (!workspace) throw new Error("Proactive workspace is unavailable");
1822
- if (command === "list") return delegationOverview(workspace);
1823
- if (command === "mail_sources") return { sources: mailFollowUpSources(workspace) };
1824
- if (command === "get_card") return { card: getCard(String(args.id ?? ""), workspace) };
1825
- if (dryRun) return {
1826
- requiresConfirmation: true,
1827
- command,
1828
- args,
1829
- scope: workspace
1815
+ async function handleScene(command, args, deps, dryRun, toolCallId) {
1816
+ const access = deps.getSceneAccess?.();
1817
+ if (!access) throw new Error("Scene service is unavailable");
1818
+ const { services, principal } = access;
1819
+ const { id, requestId, triggerKey, ...input } = args;
1820
+ const activationId = typeof id === "string" ? id : "";
1821
+ const request = typeof requestId === "string" && requestId.trim() ? requestId : toolCallId;
1822
+ if (command === "templates") return { templates: services.repository.listTemplates() };
1823
+ if (command === "list") return { activations: services.repository.listActivations(principal) };
1824
+ if (command === "get") return {
1825
+ activation: services.repository.getActivation(principal, activationId),
1826
+ runs: services.repository.listRuns(principal, activationId),
1827
+ schedules: services.repository.listSchedules(principal, activationId)
1830
1828
  };
1831
- if (command === "follow_up") return startMailFollowUp(workspace, args);
1832
- if (command === "update_follow_up") {
1833
- const { id, ...patch } = args;
1834
- return updateMailFollowUp(workspace, String(id ?? ""), patch);
1829
+ if (command === "mail_accounts") return { accounts: services.mailDiscovery?.listAccounts(principal) ?? [] };
1830
+ if (command === "mail_search") {
1831
+ if (!services.mailDiscovery) throw new Error("Mail search is unavailable");
1832
+ if (dryRun) return {
1833
+ preview: true,
1834
+ command,
1835
+ input
1836
+ };
1837
+ return { sources: await services.mailDiscovery.searchSources(principal, input, AbortSignal.timeout(15e3)) };
1835
1838
  }
1836
- if (command === "continue_card") {
1837
- const card = getCard(String(args.id ?? ""), workspace);
1838
- if (!card.communication || [
1839
- "withdrawn",
1840
- "expired",
1841
- "resolved"
1842
- ].includes(card.status)) throw new Error("Open a current communication card");
1843
- const conversationId = deps.getCurrentConversationId?.();
1844
- if (!conversationId) throw new Error("A conversation is required");
1839
+ if (command === "read_notes") return { notes: services.repository.readNotes(principal, activationId) };
1840
+ if (command === "mail_sources") return { sources: services.mail.listSources(principal) };
1841
+ if (command === "results") return { outcomes: services.repository.listInbox(principal, 50, "", activationId || null) };
1842
+ if (command === "preflight" || command === "start" && dryRun) return services.application.preflight(principal, input);
1843
+ if (dryRun) {
1844
+ services.repository.getActivation(principal, activationId);
1845
1845
  return {
1846
- card,
1847
- ...continueMailFollowUp(workspace, card.communication.id, conversationId)
1846
+ preview: true,
1847
+ command,
1848
+ activationId,
1849
+ input
1848
1850
  };
1849
1851
  }
1850
- if (command === "start") return startDelegation(workspace, args);
1851
- if (command === "update") {
1852
- const { id, ...patch } = args;
1853
- return updateControlledSubscription(workspace, String(id ?? ""), patch);
1854
- }
1855
- if (command === "check") return checkDelegation(workspace, String(args.id ?? ""));
1856
- throw new Error("Unsupported proactive command");
1852
+ if (command === "start") return { activation: await services.application.start(principal, input, request) };
1853
+ if (command === "configure") return { activation: services.application.configure(principal, activationId, input) };
1854
+ if (command === "transition") return { activation: await services.application.transition(principal, activationId, input) };
1855
+ if (command === "check") return { intentId: services.application.check(principal, activationId, request) };
1856
+ if (command === "notes") return { revision: services.application.writeNotes(principal, activationId, input) };
1857
+ if (command === "work_item") return { workItem: services.application.createWorkItem(principal, activationId, input) };
1858
+ if (command === "schedule") return { revision: services.application.setSchedule(principal, activationId, String(triggerKey ?? ""), input) };
1859
+ throw new Error("Unsupported scene command");
1857
1860
  }
1858
1861
  //#endregion
1859
1862
  export { createXopcUseTool };