@xopcai/xopc 0.0.392 → 0.0.393

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 (422) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CZmaQbC9.js → agent-avatar-dicebear-1AF2KGju.js} +1 -1
  4. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CPJr7NRR.js +1 -0
  5. package/dist/gateway/static/root/assets/agent-plugin-dialog-cjJXJj_3.js +1 -0
  6. package/dist/gateway/static/root/assets/agents-DW3TlnIg.js +77 -0
  7. package/dist/gateway/static/root/assets/{agents-admin-api-znm6_dW_.js → agents-admin-api-B5aykqg_.js} +1 -1
  8. package/dist/gateway/static/root/assets/app-management-settings-panel-B_MFhXXU.js +1 -0
  9. package/dist/gateway/static/root/assets/appearance-settings-TYGidVnd.js +1 -0
  10. package/dist/gateway/static/root/assets/apps-page-DOkyvOF0.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-dSkmoISk.js → archive-plugin-BrFfEp0u.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-page-DhWRn0dZ.js → automations-page-B7OofUPF.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-workspace-DIod-bfm.js +6 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-BJlZrYym.js → binary-plugins-BfAWnYG8.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-OHBssIfN.js → block-editor-_Y-QwZ-3.js} +5 -5
  16. package/dist/gateway/static/root/assets/browser-automation-inputs-DH9QHI9m.js +1 -0
  17. package/dist/gateway/static/root/assets/browser-automations-page-B_SnD9B0.js +3 -0
  18. package/dist/gateway/static/root/assets/browser-settings-page-BPlqYpMM.js +3 -0
  19. package/dist/gateway/static/root/assets/capabilities-page-BtzZvMIK.js +2 -0
  20. package/dist/gateway/static/root/assets/{capabilities-CgDteXZH.js → capabilities-pt2M56-E.js} +1 -1
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel-WzoG3oBb.js +8 -0
  22. package/dist/gateway/static/root/assets/capability-header-actions-CFVx3iaZ.js +1 -0
  23. package/dist/gateway/static/root/assets/channels-BXA55GY2.js +1 -0
  24. package/dist/gateway/static/root/assets/chat-terminal-dock-D3GuiG3N.js +36 -0
  25. package/dist/gateway/static/root/assets/computer-settings-page-CIbHDlp8.js +1 -0
  26. package/dist/gateway/static/root/assets/connector-service-page-CDyCHkpK.js +1 -0
  27. package/dist/gateway/static/root/assets/connectors-page-DA2b6cJu.js +1 -0
  28. package/dist/gateway/static/root/assets/date-picker-C424c_g9.js +1 -0
  29. package/dist/gateway/static/root/assets/dependency-picker-BVJh9sYc.js +1 -0
  30. package/dist/gateway/static/root/assets/desktop-pet-Q52A8vjp.js +1 -0
  31. package/dist/gateway/static/root/assets/desktop-pet-settings-CZr1CXxu.js +1 -0
  32. package/dist/gateway/static/root/assets/desktop-pet-sprite-Bd-aOI7N.js +30 -0
  33. package/dist/gateway/static/root/assets/desktop-pet-sprite-BuB0g8zv.css +1 -0
  34. package/dist/gateway/static/root/assets/device-pairing-wizard-D_WWTsze.js +1 -0
  35. package/dist/gateway/static/root/assets/directory-picker-path-field-C6cUgrvg.js +1 -0
  36. package/dist/gateway/static/root/assets/extension-debug-page-DyyfC4gA.js +1 -0
  37. package/dist/gateway/static/root/assets/extension-page-Dho9o3ZZ.js +1 -0
  38. package/dist/gateway/static/root/assets/extension-settings-page-CdnIGyCH.js +1 -0
  39. package/dist/gateway/static/root/assets/{gateway-config-swr-BM__9Fws.js → gateway-config-swr-BEePO3Wl.js} +1 -1
  40. package/dist/gateway/static/root/assets/{gateway-realtime-DS_GDx-x.js → gateway-realtime-Dng_VOvI.js} +1 -1
  41. package/dist/gateway/static/root/assets/gateway-realtime-store-DtlBf7oH.js +1 -0
  42. package/dist/gateway/static/root/assets/gateway-settings-D0KSQRNZ.js +1 -0
  43. package/dist/gateway/static/root/assets/{gateway-startup-retry-DosoyMIH.js → gateway-startup-retry-CDCiy7Cd.js} +1 -1
  44. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-BYHXWIfK.js → highlighted-body-KQOG7T2V-BNpj_mIM.js} +1 -1
  45. package/dist/gateway/static/root/assets/home-page-CH_A0W29.js +2 -0
  46. package/dist/gateway/static/root/assets/image-generation-api-DwkO2y46.js +1 -0
  47. package/dist/gateway/static/root/assets/imports-page-BrYvomnU.js +1 -0
  48. package/dist/gateway/static/root/assets/index-CKdOZoVu.js +260 -0
  49. package/dist/gateway/static/root/assets/index-Rxjt-jc3.css +1 -0
  50. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-BveDYfYk.js +1 -0
  51. package/dist/gateway/static/root/assets/local-app-workbench-page-CcIi1BhT.js +1 -0
  52. package/dist/gateway/static/root/assets/local-apps-page-B1a69mlV.js +1 -0
  53. package/dist/gateway/static/root/assets/{local-session-drafts-Bye3ZtsW.js → local-session-drafts-CYEDUPH7.js} +1 -1
  54. package/dist/gateway/static/root/assets/{locale-store-BKyOF23r.js → locale-store-CE7L6MlS.js} +1 -1
  55. package/dist/gateway/static/root/assets/logs-page-Us1jv3C4.js +2 -0
  56. package/dist/gateway/static/root/assets/management-settings-C9RAM7-s.js +1 -0
  57. package/dist/gateway/static/root/assets/{markdown-view-D_7clISS.js → markdown-view-PrKvVpRh.js} +1 -1
  58. package/dist/gateway/static/root/assets/{media-plugins-B_4o8hac.js → media-plugins-CR1fp6IL.js} +1 -1
  59. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DQdcaMiu.js +1 -0
  60. package/dist/gateway/static/root/assets/messages-CaeL_miw.js +3 -0
  61. package/dist/gateway/static/root/assets/note-detail-panel-Q4yRx9iZ.js +5 -0
  62. package/dist/gateway/static/root/assets/notes-page-C9qu16IN.js +8 -0
  63. package/dist/gateway/static/root/assets/page-context-capture-button-Cn_WK68Y.js +1 -0
  64. package/dist/gateway/static/root/assets/personal-page-DrP6hEcg.js +1 -0
  65. package/dist/gateway/static/root/assets/preview-open-alternatives-3NbiWGRG.js +1 -0
  66. package/dist/gateway/static/root/assets/product-open-page-KKE5-V8k.js +1 -0
  67. package/dist/gateway/static/root/assets/product-preview-content-BM0oqNxi.js +1 -0
  68. package/dist/gateway/static/root/assets/project-detail-page-CPZrwf8n.js +1 -0
  69. package/dist/gateway/static/root/assets/projects-page-Besfx_07.js +1 -0
  70. package/dist/gateway/static/root/assets/{registry-api-DLHHYP_v.js → registry-api-BO2Ck3aA.js} +1 -1
  71. package/dist/gateway/static/root/assets/remote-access-hub-CTDghL5L.js +1 -0
  72. package/dist/gateway/static/root/assets/{runtime-tools-api-Dq_50s27.js → runtime-tools-api-B1sb8nlw.js} +1 -1
  73. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-W0X_Fy7b.js +1 -0
  74. package/dist/gateway/static/root/assets/schema-form-DNM2Zdyr.js +1 -0
  75. package/dist/gateway/static/root/assets/{session-api-Br11ih_M.js → session-api-CaAUJvu1.js} +1 -1
  76. package/dist/gateway/static/root/assets/session-manager-DoFTlgNz.js +16 -0
  77. package/dist/gateway/static/root/assets/sessions-page-Dxtablvd.js +1 -0
  78. package/dist/gateway/static/root/assets/settings-advanced-gate-C7zklouD.js +1 -0
  79. package/dist/gateway/static/root/assets/settings-form-section-DCSHPFAN.js +1 -0
  80. package/dist/gateway/static/root/assets/{settings-page-4odCW0_2.js → settings-page-B18UbbaJ.js} +1 -1
  81. package/dist/gateway/static/root/assets/setup-status-panel-JoSfluza.js +1 -0
  82. package/dist/gateway/static/root/assets/share-preview-page-BLnS3hoH.js +2 -0
  83. package/dist/gateway/static/root/assets/shares-settings-DcIuPJK3.js +1 -0
  84. package/dist/gateway/static/root/assets/skill-api-CcYGkRPL.js +1 -0
  85. package/dist/gateway/static/root/assets/skill-reload-api-PnUZjoPK.js +1 -0
  86. package/dist/gateway/static/root/assets/skills-page-D3JAw62U.js +2 -0
  87. package/dist/gateway/static/root/assets/style-BQqU-1pP.js +7 -0
  88. package/dist/gateway/static/root/assets/system-settings-panel-C974myUM.js +1 -0
  89. package/dist/gateway/static/root/assets/tab-completion-input-CxtEp0aP.js +1 -0
  90. package/dist/gateway/static/root/assets/task-detail-page-CiljFekC.js +2 -0
  91. package/dist/gateway/static/root/assets/{task-expandable-content-CmQt5uxa.js → task-expandable-content-DTEVoNrM.js} +1 -1
  92. package/dist/gateway/static/root/assets/tracing-settings-page-DEE75MUn.js +1 -0
  93. package/dist/gateway/static/root/assets/tunnel-api-DWyI3uA3.js +1 -0
  94. package/dist/gateway/static/root/assets/usage-page-DJYvbxk7.js +1 -0
  95. package/dist/gateway/static/root/assets/use-autosave-CY0YuljR.js +1 -0
  96. package/dist/gateway/static/root/assets/user-model-page-eHZJD6Fw.js +2 -0
  97. package/dist/gateway/static/root/assets/voice-api-key-field-BNG4ixJE.js +1 -0
  98. package/dist/gateway/static/root/assets/{voice-config-api-CmDtDA4g.js → voice-config-api-D0Wscn9W.js} +1 -1
  99. package/dist/gateway/static/root/assets/work-discovery-overlay-CohIoAre.js +1 -0
  100. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Czfs5XFH.js → workflow-run-setup-panel-BXI8eyYh.js} +2 -2
  101. package/dist/gateway/static/root/assets/workflows-page-CVti0u-l.js +6 -0
  102. package/dist/gateway/static/root/assets/xopc-cloud-account-card-C_COnY_B.js +1 -0
  103. package/dist/gateway/static/root/index.html +19 -69
  104. package/dist/package.js +1 -1
  105. package/dist/src/agent/agent-instance-gateway.d.ts +2 -0
  106. package/dist/src/agent/agent-manager.d.ts +1 -1
  107. package/dist/src/agent/agent-manager.js +11 -20
  108. package/dist/src/agent/background-review/run-background-review.js +1 -1
  109. package/dist/src/agent/child-agent-factory.d.ts +2 -1
  110. package/dist/src/agent/child-agent-factory.js +2 -1
  111. package/dist/src/agent/coding/projectEvidence.d.ts +9 -0
  112. package/dist/src/agent/coding/projectEvidence.js +177 -0
  113. package/dist/src/agent/coding/repository-instructions.d.ts +8 -1
  114. package/dist/src/agent/coding/repository-instructions.js +9 -4
  115. package/dist/src/agent/coding/run-verification.d.ts +17 -2
  116. package/dist/src/agent/coding/run-verification.js +82 -12
  117. package/dist/src/agent/embedded/codemode-extension.js +1 -1
  118. package/dist/src/agent/embedded/execution-context.d.ts +1 -0
  119. package/dist/src/agent/embedded/execution-context.js +4 -1
  120. package/dist/src/agent/embedded/external-tool-discovery.js +1 -1
  121. package/dist/src/agent/embedded/run-for-session.js +1 -0
  122. package/dist/src/agent/embedded/run-turn.js +41 -5
  123. package/dist/src/agent/embedded/session-runner.js +1 -1
  124. package/dist/src/agent/embedded/session-tool-result-guard.js +5 -0
  125. package/dist/src/agent/embedded/types.d.ts +2 -0
  126. package/dist/src/agent/embedded/xopc-tools-bridge.js +2 -1
  127. package/dist/src/agent/external-tools/cliProvider.js +2 -2
  128. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  129. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  130. package/dist/src/agent/external-tools/extension-provider.js +1 -1
  131. package/dist/src/agent/external-tools/gateway-tools.js +1 -1
  132. package/dist/src/agent/external-tools/memory-provider.js +1 -1
  133. package/dist/src/agent/independent-execution.d.ts +2 -0
  134. package/dist/src/agent/independent-execution.js +12 -0
  135. package/dist/src/agent/memory/compaction.js +1 -1
  136. package/dist/src/agent/orchestration/delegation-scope.d.ts +1 -0
  137. package/dist/src/agent/orchestration/delegation-scope.js +4 -1
  138. package/dist/src/agent/orchestration/loop-guard.js +6 -2
  139. package/dist/src/agent/prompt/sections/agent-identity.js +4 -6
  140. package/dist/src/agent/prompt/sections/behavior.d.ts +3 -2
  141. package/dist/src/agent/prompt/sections/behavior.js +34 -27
  142. package/dist/src/agent/prompt/sections/memory-skills.d.ts +1 -1
  143. package/dist/src/agent/prompt/sections/memory-skills.js +10 -11
  144. package/dist/src/agent/prompt/sections/messaging-runtime.d.ts +3 -2
  145. package/dist/src/agent/prompt/sections/messaging-runtime.js +21 -24
  146. package/dist/src/agent/prompt/sections/response-language.js +7 -6
  147. package/dist/src/agent/prompt/sections/tooling.js +11 -10
  148. package/dist/src/agent/prompt/service-prompt-builder.js +3 -1
  149. package/dist/src/agent/prompt/system-prompt-params.d.ts +2 -1
  150. package/dist/src/agent/prompt/system-prompt-params.js +2 -0
  151. package/dist/src/agent/prompt/system-prompt.d.ts +2 -1
  152. package/dist/src/agent/prompt/system-prompt.js +21 -18
  153. package/dist/src/agent/prompt/types.d.ts +2 -0
  154. package/dist/src/agent/service/process-direct-streaming.js +1 -1
  155. package/dist/src/agent/service.js +3 -2
  156. package/dist/src/agent/skills/format-skills-prompt.js +5 -2
  157. package/dist/src/agent/skills/index.js +1 -1
  158. package/dist/src/agent/skills/managed-store.js +1 -1
  159. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  160. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  161. package/dist/src/agent/tool-manuals/xopc-use.js +5 -0
  162. package/dist/src/agent/tools/dataBatch.d.ts +1 -0
  163. package/dist/src/agent/tools/dataBatch.js +4 -1
  164. package/dist/src/agent/tools/delegate-tool.d.ts +1 -0
  165. package/dist/src/agent/tools/delegate-tool.js +1 -0
  166. package/dist/src/agent/tools/error-tracker.js +4 -2
  167. package/dist/src/agent/tools/exec-command.js +4 -3
  168. package/dist/src/agent/tools/factory.d.ts +1 -0
  169. package/dist/src/agent/tools/factory.js +20 -21
  170. package/dist/src/agent/tools/{delegation-parent-policy.d.ts → noninteractive-tool-policy.d.ts} +1 -1
  171. package/dist/src/agent/tools/{delegation-parent-policy.js → noninteractive-tool-policy.js} +4 -4
  172. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  173. package/dist/src/agent/tools/personal-task-tool.js +1 -1
  174. package/dist/src/agent/tools/publish-artifacts.js +1 -1
  175. package/dist/src/agent/tools/search/cache.d.ts +3 -1
  176. package/dist/src/agent/tools/search/cache.js +4 -1
  177. package/dist/src/agent/tools/search/providers/deepseek-protocol.d.ts +9 -0
  178. package/dist/src/agent/tools/search/providers/deepseek-protocol.js +84 -0
  179. package/dist/src/agent/tools/search/providers/deepseek.d.ts +9 -0
  180. package/dist/src/agent/tools/search/providers/deepseek.js +55 -0
  181. package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +2 -1
  182. package/dist/src/agent/tools/search/providers/xopc-cloud.js +36 -1
  183. package/dist/src/agent/tools/search/registry.d.ts +1 -0
  184. package/dist/src/agent/tools/search/registry.js +32 -6
  185. package/dist/src/agent/tools/search/request-gate.d.ts +13 -0
  186. package/dist/src/agent/tools/search/request-gate.js +41 -0
  187. package/dist/src/agent/tools/search/resolve-config.js +1 -1
  188. package/dist/src/agent/tools/search/search-info.d.ts +8 -0
  189. package/dist/src/agent/tools/search/search-info.js +34 -0
  190. package/dist/src/agent/tools/search/types.d.ts +19 -1
  191. package/dist/src/agent/tools/toolExposure.d.ts +3 -0
  192. package/dist/src/agent/tools/toolExposure.js +25 -0
  193. package/dist/src/agent/tools/web.js +8 -1
  194. package/dist/src/agent/tools/xopc-use-tool.js +7 -3
  195. package/dist/src/agent/workflow/subagent-runner.d.ts +1 -0
  196. package/dist/src/agent/workflow/subagent-runner.js +3 -3
  197. package/dist/src/agent/workflow/workflow-child-tools.js +13 -8
  198. package/dist/src/agent/workspace-runtime/registry.js +1 -1
  199. package/dist/src/agent-catalog/capabilities.js +2 -2
  200. package/dist/src/automations/capabilities/drafts.js +1 -1
  201. package/dist/src/automations/service/action-executor.js +2 -2
  202. package/dist/src/bootstrap/application-state.js +1 -1
  203. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  204. package/dist/src/capabilities/runtime/product.js +1 -1
  205. package/dist/src/chat-commands/agent-edit.js +1 -1
  206. package/dist/src/cli/command-manifest.js +1 -1
  207. package/dist/src/cli/commands/agent.js +1 -1
  208. package/dist/src/cli/commands/agents.js +1 -1
  209. package/dist/src/cli/commands/models.js +1 -1
  210. package/dist/src/cli/commands/onboard/model.js +1 -1
  211. package/dist/src/cli/commands/search.d.ts +2 -2
  212. package/dist/src/cli/commands/search.js +8 -6
  213. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  214. package/dist/src/computer/model-adapter.d.ts +3 -0
  215. package/dist/src/computer/model-adapter.js +120 -3
  216. package/dist/src/computer/model-policy.d.ts +1 -1
  217. package/dist/src/computer/model-policy.js +13 -6
  218. package/dist/src/computer/runtime.js +1 -0
  219. package/dist/src/config/agent-model-intents.js +1 -1
  220. package/dist/src/config/agent-profile.js +2 -2
  221. package/dist/src/config/loader.js +1 -1
  222. package/dist/src/config/models-json.d.ts +14 -8
  223. package/dist/src/config/models-json.js +3 -1
  224. package/dist/src/config/outbound-proxy.d.ts +11 -0
  225. package/dist/src/config/outbound-proxy.js +30 -0
  226. package/dist/src/config/rules.js +5 -0
  227. package/dist/src/config/schema.d.ts +29 -6
  228. package/dist/src/config/schema.js +21 -4
  229. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  230. package/dist/src/gateway/agents-admin.js +2 -2
  231. package/dist/src/gateway/config-tools-web.js +15 -4
  232. package/dist/src/gateway/gateway-workflow-host.types.d.ts +3 -0
  233. package/dist/src/gateway/hono/lib/config-payload.d.ts +5 -0
  234. package/dist/src/gateway/hono/lib/config-payload.js +6 -1
  235. package/dist/src/gateway/hono/routes/config-patch/gateway.js +7 -0
  236. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  237. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  238. package/dist/src/gateway/hono/routes/context-sources.js +1 -1
  239. package/dist/src/gateway/hono/routes/models.js +5 -2
  240. package/dist/src/gateway/hono/routes/notes.js +2 -2
  241. package/dist/src/gateway/hono/routes/projects.js +2 -2
  242. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  243. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  244. package/dist/src/gateway/image-generation-setup.js +1 -1
  245. package/dist/src/gateway/lock.js +1 -1
  246. package/dist/src/gateway/service/config-coordinator.d.ts +8 -3
  247. package/dist/src/gateway/service.js +5 -3
  248. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  249. package/dist/src/infra/http-proxy-env.d.ts +3 -0
  250. package/dist/src/infra/http-proxy-env.js +22 -2
  251. package/dist/src/local-apps/service.js +1 -1
  252. package/dist/src/personal-agent/communication.d.ts +2 -1
  253. package/dist/src/personal-agent/communication.js +11 -2
  254. package/dist/src/personal-agent/persona.d.ts +2 -1
  255. package/dist/src/personal-agent/persona.js +3 -2
  256. package/dist/src/personal-agent/proactivity/service.js +1 -1
  257. package/dist/src/personal-agent/prompts.d.ts +2 -0
  258. package/dist/src/personal-agent/prompts.js +69 -7
  259. package/dist/src/personal-agent/reply-composer.js +2 -2
  260. package/dist/src/personal-agent/reply-style.d.ts +4 -2
  261. package/dist/src/personal-agent/reply-style.js +19 -3
  262. package/dist/src/personal-agent/request-service.js +14 -9
  263. package/dist/src/personal-agent/service.js +2 -2
  264. package/dist/src/pets/loopi-artwork.d.ts +2 -0
  265. package/dist/src/pets/loopi-artwork.js +36 -0
  266. package/dist/src/pets/pointer.d.ts +6 -0
  267. package/dist/src/pets/pointer.js +16 -0
  268. package/dist/src/project-trust/trust-store.d.ts +5 -0
  269. package/dist/src/project-trust/trust-store.js +7 -1
  270. package/dist/src/providers/index.js +3 -3
  271. package/dist/src/providers/model-catalog-persistence.js +1 -1
  272. package/dist/src/providers/model-registry.js +2 -0
  273. package/dist/src/providers/model-supplements.d.ts +0 -2
  274. package/dist/src/providers/model-supplements.js +2 -18
  275. package/dist/src/providers/xopc-cloud-credit-budget.d.ts +1 -0
  276. package/dist/src/providers/xopc-cloud-credit-budget.js +4 -1
  277. package/dist/src/routing/resolve-route.js +1 -1
  278. package/dist/src/routing/resolve-tui-session-key.js +1 -1
  279. package/dist/src/tasks/capabilities/read.js +2 -2
  280. package/dist/src/tasks/capabilities/write.js +1 -1
  281. package/dist/src/tasks/task-allocation-service.js +51 -40
  282. package/dist/src/tasks/task-application-service.js +5 -1
  283. package/dist/src/tasks/task-contract-planner.js +21 -6
  284. package/dist/src/tasks/task-handoff-service.js +1 -1
  285. package/dist/src/tasks/task-language.d.ts +2 -0
  286. package/dist/src/tasks/task-language.js +13 -2
  287. package/dist/src/tasks/task-run-coordinator.js +5 -1
  288. package/dist/src/tasks/task-run-dispatcher.js +2 -1
  289. package/dist/src/tui/backends/embedded-backend.js +2 -2
  290. package/dist/src/tui/tui.js +1 -1
  291. package/dist/src/voice/realtime/persona-context.js +1 -1
  292. package/dist/src/workflows/service/workflow-run-service.js +2 -3
  293. package/package.json +8 -4
  294. package/dist/gateway/static/root/assets/activity-YogQEteU.js +0 -1
  295. package/dist/gateway/static/root/assets/activity-store-DtTSRUyF.js +0 -1
  296. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-0GXoU7WL.js +0 -1
  297. package/dist/gateway/static/root/assets/agent-plugin-dialog-BxDqL7uc.js +0 -1
  298. package/dist/gateway/static/root/assets/agents-CYmRcXr-.js +0 -77
  299. package/dist/gateway/static/root/assets/app-chrome-BeB4KgOf.js +0 -1
  300. package/dist/gateway/static/root/assets/app-management-settings-panel-FhWeowCY.js +0 -1
  301. package/dist/gateway/static/root/assets/appearance-settings-DXin262V.js +0 -1
  302. package/dist/gateway/static/root/assets/apps-page-2M_l4Naz.js +0 -1
  303. package/dist/gateway/static/root/assets/automations-workspace-CVIWgoTx.js +0 -6
  304. package/dist/gateway/static/root/assets/browser-automation-inputs-uVEhZWHz.js +0 -1
  305. package/dist/gateway/static/root/assets/browser-automations-page-CEFnpvTO.js +0 -3
  306. package/dist/gateway/static/root/assets/browser-settings-page-sQpJic5b.js +0 -3
  307. package/dist/gateway/static/root/assets/button-aIC072nz.js +0 -1
  308. package/dist/gateway/static/root/assets/capabilities-BSB93QBR.js +0 -1
  309. package/dist/gateway/static/root/assets/capabilities-page-BKkN4sTh.js +0 -2
  310. package/dist/gateway/static/root/assets/capabilities-settings-panel-DCZTR8Hu.js +0 -8
  311. package/dist/gateway/static/root/assets/capability-header-actions-D0HwmxyW.js +0 -1
  312. package/dist/gateway/static/root/assets/channels-DRraXYSd.js +0 -1
  313. package/dist/gateway/static/root/assets/chat-terminal-dock-DpM489kK.js +0 -36
  314. package/dist/gateway/static/root/assets/chevron-left-DqFhpbvK.js +0 -1
  315. package/dist/gateway/static/root/assets/chevron-right-BweFrslA.js +0 -1
  316. package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +0 -1
  317. package/dist/gateway/static/root/assets/circle-dashed-8qMD7gHf.js +0 -1
  318. package/dist/gateway/static/root/assets/circle-dot-BAseJTrF.js +0 -1
  319. package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +0 -1
  320. package/dist/gateway/static/root/assets/computer-settings-page-D0ir9aA1.js +0 -1
  321. package/dist/gateway/static/root/assets/connector-service-page-Y5SYaiJO.js +0 -1
  322. package/dist/gateway/static/root/assets/connectors-page-DRSbj4gn.js +0 -1
  323. package/dist/gateway/static/root/assets/copy-text-row-C7egVuKr.js +0 -1
  324. package/dist/gateway/static/root/assets/date-formatters-CUZAyDEg.js +0 -1
  325. package/dist/gateway/static/root/assets/date-picker-DyUP-8hR.js +0 -1
  326. package/dist/gateway/static/root/assets/dependency-picker-QF9qLWIG.js +0 -1
  327. package/dist/gateway/static/root/assets/desktop-pet-Qfns4SO-.js +0 -1
  328. package/dist/gateway/static/root/assets/desktop-pet-settings-CuITd-Xa.js +0 -1
  329. package/dist/gateway/static/root/assets/desktop-pet-sprite-BP6iMVw1.js +0 -1
  330. package/dist/gateway/static/root/assets/device-pairing-wizard-C8RPqM_F.js +0 -1
  331. package/dist/gateway/static/root/assets/directory-picker-path-field-DnD9eyoU.js +0 -1
  332. package/dist/gateway/static/root/assets/dist-C3DSFZCi.js +0 -1
  333. package/dist/gateway/static/root/assets/electron-env-Dit0bHgy.js +0 -1
  334. package/dist/gateway/static/root/assets/extension-debug-page-B5ikNsSj.js +0 -1
  335. package/dist/gateway/static/root/assets/extension-page-D-PBMAtT.js +0 -1
  336. package/dist/gateway/static/root/assets/extension-provider-CdlACvkE.js +0 -1
  337. package/dist/gateway/static/root/assets/extension-settings-page-BPUYMNb0.js +0 -1
  338. package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +0 -1
  339. package/dist/gateway/static/root/assets/gateway-realtime-store-uEdmIROn.js +0 -1
  340. package/dist/gateway/static/root/assets/gateway-settings-BKj4PQs4.js +0 -1
  341. package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +0 -1
  342. package/dist/gateway/static/root/assets/home-page-D1ZBF3me.js +0 -2
  343. package/dist/gateway/static/root/assets/image-generation-api-BB3D6OV1.js +0 -1
  344. package/dist/gateway/static/root/assets/imports-page-BCcWIxOO.js +0 -1
  345. package/dist/gateway/static/root/assets/index-Bo70AuAq.js +0 -260
  346. package/dist/gateway/static/root/assets/index-BxoR4_xr.css +0 -1
  347. package/dist/gateway/static/root/assets/index.module-Cd9ENXfk.js +0 -1
  348. package/dist/gateway/static/root/assets/interaction-BdhHBbYa.js +0 -1
  349. package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +0 -1
  350. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-Bc9UWPqr.js +0 -1
  351. package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +0 -1
  352. package/dist/gateway/static/root/assets/local-app-workbench-page-jnK1j04U.js +0 -1
  353. package/dist/gateway/static/root/assets/local-apps-page-DpN8UN_Y.js +0 -1
  354. package/dist/gateway/static/root/assets/logs-page-DBR5mfxw.js +0 -2
  355. package/dist/gateway/static/root/assets/loopi-C09I2mNj.css +0 -1
  356. package/dist/gateway/static/root/assets/loopi-Djb8XU3l.js +0 -1
  357. package/dist/gateway/static/root/assets/management-settings-rs2cdb5f.js +0 -1
  358. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-Bl4kOOZT.js +0 -1
  359. package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +0 -1
  360. package/dist/gateway/static/root/assets/messages-B7VtMXec.js +0 -3
  361. package/dist/gateway/static/root/assets/mic-CuUb7zc-.js +0 -1
  362. package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +0 -1
  363. package/dist/gateway/static/root/assets/models-hub-cache-D0vR7vex.js +0 -1
  364. package/dist/gateway/static/root/assets/note-detail-panel-B7R-cZWE.js +0 -5
  365. package/dist/gateway/static/root/assets/notes-api-DZkezSIy.js +0 -2
  366. package/dist/gateway/static/root/assets/notes-page-DY9MNatd.js +0 -8
  367. package/dist/gateway/static/root/assets/page-context-capture-button-C-X8J1IO.js +0 -1
  368. package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +0 -1
  369. package/dist/gateway/static/root/assets/personal-page-CIZWUoUh.js +0 -1
  370. package/dist/gateway/static/root/assets/popover-select-DGKUpVsz.js +0 -1
  371. package/dist/gateway/static/root/assets/preview-open-alternatives-BJU2fmPn.js +0 -1
  372. package/dist/gateway/static/root/assets/product-open-page-CYV_8zRl.js +0 -1
  373. package/dist/gateway/static/root/assets/product-preview-content-DfQ9h_YX.js +0 -1
  374. package/dist/gateway/static/root/assets/project-detail-page-B_fYXcAW.js +0 -1
  375. package/dist/gateway/static/root/assets/projects-page-CHdeAtpp.js +0 -1
  376. package/dist/gateway/static/root/assets/remote-access-hub-CbJWGHW_.js +0 -1
  377. package/dist/gateway/static/root/assets/rotate-ccw-JM1TBLpp.js +0 -1
  378. package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +0 -1
  379. package/dist/gateway/static/root/assets/runtime-tools-settings-panel-jqYXsCuk.js +0 -1
  380. package/dist/gateway/static/root/assets/schema-form-DNXZLVqh.js +0 -1
  381. package/dist/gateway/static/root/assets/search-DA7gz22f.js +0 -1
  382. package/dist/gateway/static/root/assets/secret-input-BxWHx6J6.js +0 -1
  383. package/dist/gateway/static/root/assets/send-session-input-NpLYu1ip.js +0 -1
  384. package/dist/gateway/static/root/assets/session-manager-Bb9pevyM.js +0 -16
  385. package/dist/gateway/static/root/assets/sessions-page-DrGCnBhV.js +0 -1
  386. package/dist/gateway/static/root/assets/settings-2-D-csvaET.js +0 -1
  387. package/dist/gateway/static/root/assets/settings-advanced-gate-B61Eh7eB.js +0 -1
  388. package/dist/gateway/static/root/assets/settings-form-draft-Dy10ldo8.js +0 -1
  389. package/dist/gateway/static/root/assets/settings-form-section-num14vSv.js +0 -1
  390. package/dist/gateway/static/root/assets/settings-shell-dialog-layer-BU3UuiJr.js +0 -1
  391. package/dist/gateway/static/root/assets/setup-status-panel-DaU9o0Ll.js +0 -1
  392. package/dist/gateway/static/root/assets/share-link-dialog-BhjQPZbF.js +0 -1
  393. package/dist/gateway/static/root/assets/share-preview-page-LERhIwgz.js +0 -2
  394. package/dist/gateway/static/root/assets/shares-api-CgsiMdCX.js +0 -1
  395. package/dist/gateway/static/root/assets/shares-settings-DmvyqIyT.js +0 -1
  396. package/dist/gateway/static/root/assets/skeleton-BI5TyibZ.js +0 -1
  397. package/dist/gateway/static/root/assets/skill-api-plToSoFo.js +0 -1
  398. package/dist/gateway/static/root/assets/skill-api-utils-C7V4JVXM.js +0 -1
  399. package/dist/gateway/static/root/assets/skill-reload-api-BFw81Ar6.js +0 -1
  400. package/dist/gateway/static/root/assets/skill-wire-pattern-BPpeIcCi.js +0 -1
  401. package/dist/gateway/static/root/assets/skills-page-BLUsxGOo.js +0 -2
  402. package/dist/gateway/static/root/assets/style-1FPsMO2E.js +0 -7
  403. package/dist/gateway/static/root/assets/system-settings-panel-DL3WXRnL.js +0 -1
  404. package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +0 -1
  405. package/dist/gateway/static/root/assets/task-detail-page-DWM5xGbe.js +0 -2
  406. package/dist/gateway/static/root/assets/theme-store-CPdeCbZI.js +0 -1
  407. package/dist/gateway/static/root/assets/tracing-settings-page-m51enJFx.js +0 -1
  408. package/dist/gateway/static/root/assets/tunnel-api-B5I53jzk.js +0 -1
  409. package/dist/gateway/static/root/assets/usage-page-B7qyfnMN.js +0 -1
  410. package/dist/gateway/static/root/assets/use-async-resource-GrnWNwMZ.js +0 -1
  411. package/dist/gateway/static/root/assets/use-autosave-C2__K1-y.js +0 -1
  412. package/dist/gateway/static/root/assets/use-composer-attachments-61W-5Q6m.js +0 -2
  413. package/dist/gateway/static/root/assets/use-file-preview-expanded-DZUWxdhm.js +0 -2
  414. package/dist/gateway/static/root/assets/user-model-page-DkIuYpuf.js +0 -2
  415. package/dist/gateway/static/root/assets/voice-api-key-field-DB--pFJX.js +0 -1
  416. package/dist/gateway/static/root/assets/voice-transcribe-api-Cp2uDvFO.js +0 -1
  417. package/dist/gateway/static/root/assets/work-discovery-overlay-Blwp7T-_.js +0 -1
  418. package/dist/gateway/static/root/assets/workflows-page-RN_QXcGY.js +0 -6
  419. package/dist/gateway/static/root/assets/workspace-api-lHTRLje0.js +0 -2
  420. package/dist/gateway/static/root/assets/xopc-cloud-account-card-D31rz9OQ.js +0 -1
  421. package/dist/src/agent/bootstrap/project-agents-context.d.ts +0 -2
  422. package/dist/src/agent/bootstrap/project-agents-context.js +0 -30
@@ -1,5 +1,5 @@
1
- import { init_paths, resolveSkillsDir } from "../../config/paths.js";
2
1
  import { parseFrontmatter } from "../../markdown/frontmatter.js";
2
+ import { init_paths, resolveSkillsDir } from "../../config/paths.js";
3
3
  import { resolveWorkspaceSkillsDir } from "./workspace-skills-dir.js";
4
4
  import { formatScanSummary, scanSkillDirectory } from "./scanner.js";
5
5
  import { fuzzyFindText, normalizeForFuzzyMatch, normalizeToLF, restoreLineEndings } from "../tools/edit-diff.js";
@@ -1 +1 @@
1
- export declare const xopcUseManual = "# XOPC Use Tool Manual\n\n## Purpose\n\n`xopc_use` operates first-class XOPC product objects without editing SQLite or product files directly.\nLoad this manual before a non-trivial mutation.\n\n```json\n{\n \"mode\": \"agent | project | automation | note | task | task_run | chat_preview | local_app | settings\",\n \"command\": \"...\",\n \"args\": {},\n \"dryRun\": false\n}\n```\n\nSend one object command per call. Inspect the returned JSON `ok` field; a tool call can\ncomplete successfully while the product command returns `ok: false`.\n\n## Object routing\n\n| Object | Tool |\n| --- | --- |\n| Agent definition and default Agent | `xopc_use` mode `agent` |\n| Project, milestone, project update | `xopc_use` mode `project` |\n| Automation | `xopc_use` mode `automation` |\n| Task intent and lifecycle | `xopc_use` mode `task` |\n| Task execution attempt, receipt, events and waits | `xopc_use` mode `task_run` |\n| Note | `xopc_use` mode `note` |\n| Lightweight UI preview | `xopc_use` mode `chat_preview` |\n| Local app | `xopc_use` mode `local_app` |\n| Settings jump target | `xopc_use` mode `settings` |\n| Workflow run | dedicated `workflow` tool; pass `taskId` to link it to a Task |\n| Session, memory, skill, connected app or workspace file | its dedicated tool |\n\nDo not emulate Workflow APIs through `xopc_use`. A Task is durable intent;\na TaskRun is one execution attempt; a WorkflowRun is a procedure execution and may belong\nto a TaskRun. Never treat these three objects as interchangeable.\n\n## Agents\n\nCommands: `list`, `get`, `create`, `update`, `set_default`, `disable`,\n`delete`, and `purge`.\n\nAn Agent profile stores `name` and optional `description`, `creature`, `style`, `language`,\n`emoji`, and `avatar` identity fields. Use `instructions` for short execution rules.\nPut personality in SOUL.md and ongoing work guidance in AGENTS.md.\n\n```json\n{\n \"mode\": \"agent\",\n \"command\": \"create\",\n \"args\": {\n \"id\": \"xiaomei\",\n \"profile\": {\n \"name\": \"\u5C0F\u7F8E\",\n \"description\": \"\u5E2E\u52A9\u6574\u7406\u65E5\u5E38\u4E8B\u9879\",\n \"language\": \"zh-CN\",\n \"style\": \"\u6E29\u67D4\u3001\u4EB2\u5207\",\n \"instructions\": \"\u7ED9\u51FA\u64CD\u4F5C\u5EFA\u8BAE\u524D\u5148\u6838\u5BF9\u5173\u952E\u4E8B\u5B9E\u3002\"\n },\n \"idempotencyKey\": \"create-agent-xiaomei\"\n }\n}\n```\n\nUse `list` before creating an Agent so an existing id is updated rather than duplicated.\nMutations other than `create` require the current `expectedRevision`; `set_default` uses\nthe catalog revision returned by `list`. `delete` preserves on-disk data, while `purge`\nalso removes it. Use `dryRun: true` to validate the exact same input contract without writing.\n\n## Reliable protocol\n\n1. Use `list` then `get` when an id is unknown.\n2. Read the current `version` before a Task mutation.\n3. Use `dryRun: true` for broad Project changes or uncertain mutations.\n4. Mutate once with the exact id and current concurrency token.\n5. Verify the returned object and preserve any \u201COpen in xopc\u201D delivery link.\n6. On a conflict, read again and reconsider the operation; do not blindly retry.\n\nTimestamps are Unix epoch milliseconds. Array fields are arrays of strings. Omission\npreserves a patchable field; an empty array intentionally clears it. Prefer explicit\n`projectId`, `taskId`, `runId`, `noteId`, and `localAppId` fields over `id`.\n\n## Projects\n\nCommands: `list`, `get`, `create`, `update`, `resolve_workspace`,\n`list_milestones`, `create_milestone`, `update_milestone`, `list_updates`,\nand `create_update`.\n\nProject statuses: `planned`, `active`, `paused`, `completed`, `cancelled`,\n`archived`. Health values: `unknown`, `on_track`, `at_risk`, `off_track`.\n\nA Project defines bounded shared context for related work. Its durable planning fields are `outcome`,\n`successCriteria`, `scope`, `nonGoals`, `ownerId`, `targetAt`, and `health`.\nUse `brief` for a concise description and `instructions` for durable operating guidance.\n\n### Create\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create\",\n \"args\": {\n \"name\": \"AI Product Research\",\n \"outcome\": \"Choose a validated product direction\",\n \"successCriteria\": [\"Ten customer interviews\", \"Decision recorded\"],\n \"scope\": { \"market\": \"developer tools\" },\n \"nonGoals\": [\"Build the production product\"],\n \"health\": \"on_track\",\n \"targetAt\": 1760000000000,\n \"workspaceRoot\": \"/path/to/repo\"\n }\n}\n```\n\n### Update\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"update\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"status\": \"active\",\n \"health\": \"at_risk\",\n \"successCriteria\": [\"Ten interviews\", \"Evidence-backed decision\"]\n }\n}\n```\n\n### Resolve a workspace\n\nUse `autoCreate: false` for lookup. Set it to true only when creating a Project is authorized.\n\n```json\n{ \"mode\": \"project\", \"command\": \"resolve_workspace\", \"args\": { \"workspacePath\": \"/path/to/repo\", \"autoCreate\": false } }\n```\n\n### Milestones\n\nMilestone statuses: `planned`, `active`, `completed`, `cancelled`.\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create_milestone\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"title\": \"Finish discovery\",\n \"status\": \"active\",\n \"targetAt\": 1760000000000,\n \"sortOrder\": 10\n }\n}\n```\n\nUse `list_milestones` with `projectId`. Use `update_milestone` with both\n`projectId` and `milestoneId`. Milestone deletion is intentionally not exposed.\n\n### Immutable project updates\n\nProject updates are append-only progress snapshots. They also update Project health.\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create_update\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"health\": \"on_track\",\n \"summary\": \"Discovery is complete\",\n \"progress\": [\"Interviewed ten users\"],\n \"risks\": [\"Pricing remains unvalidated\"],\n \"nextSteps\": [\"Run pricing tests\"]\n }\n}\n```\n\nUse `list_updates` with `projectId` and optional `limit`. Updates cannot be edited.\n\n## Automations\n\nCommands: `list`, `get`, `create`, `update`, `delete`, `run`, `pause`,\n`resume`, and `history`.\n\nAutomation `create` automatically uses the current session Project when `projectId` is\nomitted. An explicit `projectId` takes precedence and is validated before mutation. Use an\nexplicit id when creating for a Project other than the current session Project.\n\n### Create in the current Project\n\n`trigger` and `action` use the same shapes as the Automation product API.\n\n```json\n{\n \"mode\": \"automation\",\n \"command\": \"create\",\n \"args\": {\n \"name\": \"Daily project review\",\n \"trigger\": { \"kind\": \"schedule\", \"schedule\": { \"kind\": \"cron\", \"expr\": \"0 9 * * 1-5\", \"tz\": \"Asia/Shanghai\" } },\n \"action\": { \"kind\": \"agent\", \"instruction\": \"Review the current project and summarize risks.\" }\n }\n}\n```\n\nTo override the inherited Project, add `\"projectId\": \"project_id\"` to `args`.\nThe create payload may also be nested under `args.automation`; top-level `args.projectId`\nhas precedence.\n\n### List and history\n\n`list` and unqualified `history` inherit the current session Project. Pass an explicit\n`projectId` to query another Project. Pass `automationId` to `history` for one Automation.\n\n### Update and operate\n\nUse `automationId` for `get`, `update`, `delete`, `run`, `pause`, and `resume`.\nFor `update`, patch fields may be direct args or nested under `args.patch`. Supplying a new\n`projectId` reassigns the Automation after validating the target Project.\n\n## Tasks\n\nCommands: `list`, `get`, `create`, `delegated_tasks`, `collaboration`,\n`collaboration_post`, `update_dependencies`, `add_context`, `remove_context`,\n`command`, and `delete`.\n\nTask phases are `backlog`, `ready`, `active`, `review`, and `closed`.\nOperational state is projected separately as `idle`, `queued`, `running`, `waiting`,\n`verifying`, `succeeded`, `failed`, or `cancelled`. Never send either value as a\nfree-form status update.\n\n`task.get` returns the Task, its projected `model`, dependencies, dependents, context,\nauthority grants, TaskRuns, receipts, and waits.\nThe projected model is the correct source for current operational state and attention items.\n\n`delete` permanently removes the Task and its contracts, waits, context links, TaskRuns,\nreceipts, and Task-owned execution records. It does not delete linked Sessions, workspace files,\nor external artifacts. Cancel an active TaskRun before deletion, and use `dryRun: true` when\nthe user's intent is ambiguous.\n\n```json\n{ \"mode\": \"task\", \"command\": \"delete\", \"args\": { \"taskId\": \"task_id\" }, \"dryRun\": true }\n```\n\n### Capture or start\n\n`createMode` defaults to `capture`, which creates a backlog Task without executing it.\nUse `start` only when immediate execution is intended.\n\nFor an immediate delegated task, use the minimal call below. The objective can include the\nworker instructions and constraints; optional lists are unnecessary for a simple delegation.\n\n```json\n{ \"mode\": \"task\", \"command\": \"create\", \"args\": { \"objective\": \"Calculate the requested result and report progress\", \"createMode\": \"start\" } }\n```\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"create\",\n \"args\": {\n \"objective\": \"Complete the customer research report\",\n \"projectId\": \"project_id\",\n \"createMode\": \"capture\",\n \"priority\": \"high\",\n \"expectedOutputs\": [\"Research report\"],\n \"acceptanceCriteria\": [\"Sources are cited\"],\n \"constraints\": [\"Do not contact customers without approval\"],\n \"dependsOnTaskIds\": []\n }\n}\n```\n\n### Main Agent and worker collaboration\n\nThe user-facing Agent can call `delegated_tasks` to list Tasks created from this conversation,\nthen `collaboration` with `{ \"taskId\": \"...\", \"afterSequence\": 0 }` to read the ordered board.\nUse the Task and TaskRun receipt as the final source of execution status.\n\nUse `collaboration_post` with `taskId`, `kind`, `body`, and a stable `idempotencyKey`.\nThe main Agent may write `instruction`, `question`, or `answer`; answers include\n`causationId` of the worker's question. The worker may write `progress`, `question`,\nor `ack`; acknowledgements include `causationId` of the instruction. A worker question\npauses the active TaskRun. After posting it, stop the execution turn and wait for an answer.\nAn instruction is first recorded, then delivered to the worker conversation, and is only\nconfirmed when the worker acknowledges it. Ordinary progress does not interrupt the user.\n\n```json\n{ \"mode\": \"task\", \"command\": \"collaboration_post\", \"args\": { \"taskId\": \"task_id\", \"kind\": \"progress\", \"body\": \"Completed source review\", \"idempotencyKey\": \"stable-key\" } }\n```\n\n### Dependencies\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"update_dependencies\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"expectedVersion\": 3,\n \"dependsOnTaskIds\": [\"dependency_task_id\"]\n }\n}\n```\n\n### Context links\n\nUse `add_context` to link a document, file, URL, session, memory, Task, artifact, or source\nas `input`, `reference`, `constraint`, `deliverable`, or `evidence` context.\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"add_context\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"targetKind\": \"file\",\n \"targetId\": \"/path/to/spec.md\",\n \"role\": \"input\",\n \"title\": \"Product specification\",\n \"pinned\": true,\n \"retrievalPolicy\": {},\n \"metadata\": {}\n }\n}\n```\n\nUse `remove_context` with `taskId` and the exact `edgeId` returned by `task.get`.\nDo not add authority grants through this tool; an Agent must not authorize itself.\n\n### Typed lifecycle commands\n\nEvery command requires `taskId`, the Task's current `expectedVersion`, a `type`, and\ntype-specific fields inside `commandArgs`.\n\nSupported command types:\n\n- `mark_ready`\n- `start`: `{ \"executor\": { \"kind\": \"agent\", \"agentId\": \"main\" } }`\n- `request_review`\n- `close`: `{ \"resolution\": \"done | cancelled | duplicate | wont_do\" }`\n- `reopen`: `{ \"phase\": \"ready | active\" }`\n- `add_wait`: `{ \"wait\": { \"kind\": \"dependency | approval | input | schedule | external | paused\", \"reason\": \"...\", \"condition\": {} } }`\n- `resolve_wait`: `{ \"waitId\": \"wait_id\", \"resolution\": {} }`\n- `delegate`: `{ \"agentId\": \"agent_id\" }`\n- `revise_contract`: `{ \"contract\": { ...complete contract... } }`\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"command\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"expectedVersion\": 3,\n \"type\": \"start\",\n \"commandArgs\": {\n \"executor\": { \"kind\": \"agent\", \"agentId\": \"main\" }\n }\n }\n}\n```\n\nContract revision is replacement, not a patch. Read the Task and preserve all contract fields\nthe user did not ask to change. Resolve a wait through `resolve_wait`; do not directly mutate\na TaskRun or manufacture a phase transition.\n\n## TaskRuns\n\nTaskRun inspection is read-only except for explicit cancellation. Other execution state is\ncontrolled by Task commands and the runtime coordinator.\n\n### List attempts for a Task\n\n```json\n{ \"mode\": \"task_run\", \"command\": \"list\", \"args\": { \"taskId\": \"task_id\", \"limit\": 20 } }\n```\n\nThe result contains run attempts, finalized receipts, and active waits.\n\n### Inspect one attempt\n\n```json\n{ \"mode\": \"task_run\", \"command\": \"get\", \"args\": { \"runId\": \"run_id\" } }\n```\n\nThe result contains the TaskRun, its receipt when terminal, ordered events, and active Task waits.\n\n### Cancel an attempt\n\nRead the run first, then pass its current version. Cancellation creates a terminal receipt.\n\n```json\n{\n \"mode\": \"task_run\",\n \"command\": \"cancel\",\n \"args\": { \"runId\": \"run_id\", \"expectedVersion\": 2, \"reason\": \"User cancelled execution\" }\n}\n```\n\nDo not guess commands such as retry, force-complete, heartbeat, or transition; they are not Agent APIs.\n\n## Notes\n\nCommands: `list`, `get`, `create`, `append`, `preview_edit`, `update`, and `delete`.\nUse Notes for durable prose and reference material, not as a Task substitute. Prefer `append`\nwhen preserving user content. Use `preview_edit` before a canonical rewrite.\n\n```json\n{ \"mode\": \"note\", \"command\": \"create\", \"args\": { \"title\": \"Decision\", \"markdown\": \"...\", \"projectId\": \"project_id\" } }\n```\n\n```json\n{ \"mode\": \"note\", \"command\": \"append\", \"args\": { \"noteId\": \"note_id\", \"heading\": \"AI synthesis\", \"content\": \"...\" } }\n```\n\nUse `update` with `status: \"trashed\"` for a recoverable removal. `delete` permanently\nremoves the Note and its stored snapshots and media; use `dryRun: true` first when the\nuser's intent is ambiguous.\n\n```json\n{ \"mode\": \"note\", \"command\": \"delete\", \"args\": { \"noteId\": \"note_id\" }, \"dryRun\": true }\n```\n\n## Chat previews, local apps, and settings\n\nUse `chat_preview` by default when the user asks to design, mock up, or quickly show a UI in\nthe current conversation. It creates no Project and no Local App. Commands are `create`,\n`get`, and `revise`. Source consists of `markup`, `styles`, and optional `script`;\ndo not include a full HTML document or remote dependencies. Revision requires the exact\n`baseRevision` returned by the prior call.\n\nUse `local_app` only when the user explicitly asks for a durable, installable app or chooses\n\u201CSave as app\u201D on a chat preview. Do not create a Local App merely to render a UI draft.\n\nLocal app commands are `list`, `get`, `create`, and `validate`. Installation,\nactivation, rollback, and uninstall remain product runtime operations.\n\nSettings supports only `open` and returns an exact product jump target without changing config.\n\n## Error recovery\n\n| Result | Recovery |\n| --- | --- |\n| service unavailable | Stop retrying and report the unavailable capability. |\n| not found | Re-list in the intended scope; do not invent another id. |\n| conflict | Read the current object and reassess using its latest version. |\n| waiting | Inspect the Task projection and TaskRun waits; resolve only the real blocker. |\n| invalid command or state | Read the object and use only a documented transition. |\n| unsupported operation | Use the dedicated tool or product UI; never write storage directly. |\n\n## Deliberate boundaries\n\n- Project deletion and milestone deletion are not Agent APIs.\n- TaskRun mutation is internal to execution coordination except for optimistic cancellation.\n- Project updates are immutable.\n- Workflow and Automation operations remain in their dedicated tools.\n- Only the documented Task and TaskRun commands are valid; do not infer hidden aliases.\n";
1
+ export declare const xopcUseManual = "# XOPC Use Tool Manual\n\n## Purpose\n\n`xopc_use` operates first-class XOPC product objects without editing SQLite or product files directly.\nLoad this manual before a non-trivial mutation.\n\n```json\n{\n \"mode\": \"agent | project | automation | note | task | task_run | chat_preview | local_app | settings\",\n \"command\": \"...\",\n \"args\": {},\n \"dryRun\": false\n}\n```\n\nSend one object command per call. Inspect the returned JSON `ok` field; a tool call can\ncomplete successfully while the product command returns `ok: false`.\n\n## Object routing\n\n| Object | Tool |\n| --- | --- |\n| Agent definition and default Agent | `xopc_use` mode `agent` |\n| Project, milestone, project update | `xopc_use` mode `project` |\n| Automation | `xopc_use` mode `automation` |\n| Task intent and lifecycle | `xopc_use` mode `task` |\n| Task execution attempt, receipt, events and waits | `xopc_use` mode `task_run` |\n| Note | `xopc_use` mode `note` |\n| Lightweight UI preview | `xopc_use` mode `chat_preview` |\n| Local app | `xopc_use` mode `local_app` |\n| Settings jump target | `xopc_use` mode `settings` |\n| Workflow run | dedicated `workflow` tool; pass `taskId` to link it to a Task |\n| Session, memory, skill, connected app or workspace file | its dedicated tool |\n\nDo not emulate Workflow APIs through `xopc_use`. A Task is durable intent;\na TaskRun is one execution attempt; a WorkflowRun is a procedure execution and may belong\nto a TaskRun. Never treat these three objects as interchangeable.\n\n## Agents\n\nCommands: `list`, `get`, `create`, `update`, `set_default`, `disable`,\n`delete`, and `purge`.\n\nAn Agent profile stores `name` and optional `description`, `creature`, `style`, `language`,\n`emoji`, and `avatar` identity fields. Use `instructions` for short execution rules.\nPut personality in SOUL.md and ongoing work guidance in AGENTS.md.\n\n```json\n{\n \"mode\": \"agent\",\n \"command\": \"create\",\n \"args\": {\n \"id\": \"xiaomei\",\n \"profile\": {\n \"name\": \"\u5C0F\u7F8E\",\n \"description\": \"\u5E2E\u52A9\u6574\u7406\u65E5\u5E38\u4E8B\u9879\",\n \"language\": \"zh-CN\",\n \"style\": \"\u6E29\u67D4\u3001\u4EB2\u5207\",\n \"instructions\": \"\u7ED9\u51FA\u64CD\u4F5C\u5EFA\u8BAE\u524D\u5148\u6838\u5BF9\u5173\u952E\u4E8B\u5B9E\u3002\"\n },\n \"idempotencyKey\": \"create-agent-xiaomei\"\n }\n}\n```\n\nUse `list` before creating an Agent so an existing id is updated rather than duplicated.\nMutations other than `create` require the current `expectedRevision`; `set_default` uses\nthe catalog revision returned by `list`. `delete` preserves on-disk data, while `purge`\nalso removes it. Use `dryRun: true` to validate the exact same input contract without writing.\n\n## Reliable protocol\n\n1. Use `list` then `get` when an id is unknown.\n2. Read the current `version` before a Task mutation.\n3. Use `dryRun: true` for broad Project changes or uncertain mutations.\n4. Mutate once with the exact id and current concurrency token.\n5. Verify the returned object and preserve any \u201COpen in xopc\u201D delivery link.\n6. On a conflict, read again and reconsider the operation; do not blindly retry.\n\nTimestamps are Unix epoch milliseconds. Array fields are arrays of strings. Omission\npreserves a patchable field; an empty array intentionally clears it. Prefer explicit\n`projectId`, `taskId`, `runId`, `noteId`, and `localAppId` fields over `id`.\n\n## Projects\n\nCommands: `list`, `get`, `create`, `update`, `resolve_workspace`,\n`list_milestones`, `create_milestone`, `update_milestone`, `list_updates`,\nand `create_update`.\n\nProject statuses: `planned`, `active`, `paused`, `completed`, `cancelled`,\n`archived`. Health values: `unknown`, `on_track`, `at_risk`, `off_track`.\n\nA Project defines bounded shared context for related work. Its durable planning fields are `outcome`,\n`successCriteria`, `scope`, `nonGoals`, `ownerId`, `targetAt`, and `health`.\nUse `brief` for a concise description and `instructions` for durable operating guidance.\n\n### Create\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create\",\n \"args\": {\n \"name\": \"AI Product Research\",\n \"outcome\": \"Choose a validated product direction\",\n \"successCriteria\": [\"Ten customer interviews\", \"Decision recorded\"],\n \"scope\": { \"market\": \"developer tools\" },\n \"nonGoals\": [\"Build the production product\"],\n \"health\": \"on_track\",\n \"targetAt\": 1760000000000,\n \"workspaceRoot\": \"/path/to/repo\"\n }\n}\n```\n\n### Update\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"update\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"status\": \"active\",\n \"health\": \"at_risk\",\n \"successCriteria\": [\"Ten interviews\", \"Evidence-backed decision\"]\n }\n}\n```\n\n### Resolve a workspace\n\nUse `autoCreate: false` for lookup. Set it to true only when creating a Project is authorized.\n\n```json\n{ \"mode\": \"project\", \"command\": \"resolve_workspace\", \"args\": { \"workspacePath\": \"/path/to/repo\", \"autoCreate\": false } }\n```\n\n### Milestones\n\nMilestone statuses: `planned`, `active`, `completed`, `cancelled`.\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create_milestone\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"title\": \"Finish discovery\",\n \"status\": \"active\",\n \"targetAt\": 1760000000000,\n \"sortOrder\": 10\n }\n}\n```\n\nUse `list_milestones` with `projectId`. Use `update_milestone` with both\n`projectId` and `milestoneId`. Milestone deletion is intentionally not exposed.\n\n### Immutable project updates\n\nProject updates are append-only progress snapshots. They also update Project health.\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create_update\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"health\": \"on_track\",\n \"summary\": \"Discovery is complete\",\n \"progress\": [\"Interviewed ten users\"],\n \"risks\": [\"Pricing remains unvalidated\"],\n \"nextSteps\": [\"Run pricing tests\"]\n }\n}\n```\n\nUse `list_updates` with `projectId` and optional `limit`. Updates cannot be edited.\n\n## Automations\n\nCommands: `list`, `get`, `create`, `update`, `delete`, `run`, `pause`,\n`resume`, and `history`.\n\nAutomation `create` automatically uses the current session Project when `projectId` is\nomitted. An explicit `projectId` takes precedence and is validated before mutation. Use an\nexplicit id when creating for a Project other than the current session Project.\n\n### Create in the current Project\n\n`trigger` and `action` use the same shapes as the Automation product API.\n\n```json\n{\n \"mode\": \"automation\",\n \"command\": \"create\",\n \"args\": {\n \"name\": \"Daily project review\",\n \"trigger\": { \"kind\": \"schedule\", \"schedule\": { \"kind\": \"cron\", \"expr\": \"0 9 * * 1-5\", \"tz\": \"Asia/Shanghai\" } },\n \"action\": { \"kind\": \"agent\", \"instruction\": \"Review the current project and summarize risks.\" }\n }\n}\n```\n\nTo override the inherited Project, add `\"projectId\": \"project_id\"` to `args`.\nThe create payload may also be nested under `args.automation`; top-level `args.projectId`\nhas precedence.\n\n### List and history\n\n`list` and unqualified `history` inherit the current session Project. Pass an explicit\n`projectId` to query another Project. Pass `automationId` to `history` for one Automation.\n\n### Update and operate\n\nUse `automationId` for `get`, `update`, `delete`, `run`, `pause`, and `resume`.\nFor `update`, patch fields may be direct args or nested under `args.patch`. Supplying a new\n`projectId` reassigns the Automation after validating the target Project.\n\n## Tasks\n\nTask locale follows the conversation response language, then the user request and profile.\nKeep every user-facing contract field (criteria, expected outputs, constraints, assumptions and risks)\nin that language, even when attached source material is English. Preserve paths, URLs and proper nouns.\nAn explicit locale must reflect the user\u2019s language choice.\n\nCommands: `list`, `get`, `create`, `delegated_tasks`, `collaboration`,\n`collaboration_post`, `update_dependencies`, `add_context`, `remove_context`,\n`command`, and `delete`.\n\nTask phases are `backlog`, `ready`, `active`, `review`, and `closed`.\nOperational state is projected separately as `idle`, `queued`, `running`, `waiting`,\n`verifying`, `succeeded`, `failed`, or `cancelled`. Never send either value as a\nfree-form status update.\n\n`task.get` returns the Task, its projected `model`, dependencies, dependents, context,\nauthority grants, TaskRuns, receipts, and waits.\nThe projected model is the correct source for current operational state and attention items.\n\n`delete` permanently removes the Task and its contracts, waits, context links, TaskRuns,\nreceipts, and Task-owned execution records. It does not delete linked Sessions, workspace files,\nor external artifacts. Cancel an active TaskRun before deletion, and use `dryRun: true` when\nthe user's intent is ambiguous.\n\n```json\n{ \"mode\": \"task\", \"command\": \"delete\", \"args\": { \"taskId\": \"task_id\" }, \"dryRun\": true }\n```\n\n### Capture or start\n\n`createMode` defaults to `capture`, which creates a backlog Task without executing it.\nUse `start` only when immediate execution is intended.\n\nFor an immediate delegated task, use the minimal call below. The objective can include the\nworker instructions and constraints; optional lists are unnecessary for a simple delegation.\n\n```json\n{ \"mode\": \"task\", \"command\": \"create\", \"args\": { \"objective\": \"Calculate the requested result and report progress\", \"createMode\": \"start\" } }\n```\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"create\",\n \"args\": {\n \"objective\": \"Complete the customer research report\",\n \"projectId\": \"project_id\",\n \"createMode\": \"capture\",\n \"priority\": \"high\",\n \"expectedOutputs\": [\"Research report\"],\n \"acceptanceCriteria\": [\"Sources are cited\"],\n \"constraints\": [\"Do not contact customers without approval\"],\n \"dependsOnTaskIds\": []\n }\n}\n```\n\n### Main Agent and worker collaboration\n\nThe user-facing Agent can call `delegated_tasks` to list Tasks created from this conversation,\nthen `collaboration` with `{ \"taskId\": \"...\", \"afterSequence\": 0 }` to read the ordered board.\nUse the Task and TaskRun receipt as the final source of execution status.\n\nUse `collaboration_post` with `taskId`, `kind`, `body`, and a stable `idempotencyKey`.\nThe main Agent may write `instruction`, `question`, or `answer`; answers include\n`causationId` of the worker's question. The worker may write `progress`, `question`,\nor `ack`; acknowledgements include `causationId` of the instruction. A worker question\npauses the active TaskRun. After posting it, stop the execution turn and wait for an answer.\nAn instruction is first recorded, then delivered to the worker conversation, and is only\nconfirmed when the worker acknowledges it. Ordinary progress does not interrupt the user.\n\n```json\n{ \"mode\": \"task\", \"command\": \"collaboration_post\", \"args\": { \"taskId\": \"task_id\", \"kind\": \"progress\", \"body\": \"Completed source review\", \"idempotencyKey\": \"stable-key\" } }\n```\n\n### Dependencies\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"update_dependencies\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"expectedVersion\": 3,\n \"dependsOnTaskIds\": [\"dependency_task_id\"]\n }\n}\n```\n\n### Context links\n\nUse `add_context` to link a document, file, URL, session, memory, Task, artifact, or source\nas `input`, `reference`, `constraint`, `deliverable`, or `evidence` context.\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"add_context\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"targetKind\": \"file\",\n \"targetId\": \"/path/to/spec.md\",\n \"role\": \"input\",\n \"title\": \"Product specification\",\n \"pinned\": true,\n \"retrievalPolicy\": {},\n \"metadata\": {}\n }\n}\n```\n\nUse `remove_context` with `taskId` and the exact `edgeId` returned by `task.get`.\nDo not add authority grants through this tool; an Agent must not authorize itself.\n\n### Typed lifecycle commands\n\nEvery command requires `taskId`, the Task's current `expectedVersion`, a `type`, and\ntype-specific fields inside `commandArgs`.\n\nSupported command types:\n\n- `mark_ready`\n- `start`: `{ \"executor\": { \"kind\": \"agent\", \"agentId\": \"main\" } }`\n- `request_review`\n- `close`: `{ \"resolution\": \"done | cancelled | duplicate | wont_do\" }`\n- `reopen`: `{ \"phase\": \"ready | active\" }`\n- `add_wait`: `{ \"wait\": { \"kind\": \"dependency | approval | input | schedule | external | paused\", \"reason\": \"...\", \"condition\": {} } }`\n- `resolve_wait`: `{ \"waitId\": \"wait_id\", \"resolution\": {} }`\n- `delegate`: `{ \"agentId\": \"agent_id\" }`\n- `revise_contract`: `{ \"contract\": { ...complete contract... } }`\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"command\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"expectedVersion\": 3,\n \"type\": \"start\",\n \"commandArgs\": {\n \"executor\": { \"kind\": \"agent\", \"agentId\": \"main\" }\n }\n }\n}\n```\n\nContract revision is replacement, not a patch. Read the Task and preserve all contract fields\nthe user did not ask to change. Resolve a wait through `resolve_wait`; do not directly mutate\na TaskRun or manufacture a phase transition.\n\n## TaskRuns\n\nTaskRun inspection is read-only except for explicit cancellation. Other execution state is\ncontrolled by Task commands and the runtime coordinator.\n\n### List attempts for a Task\n\n```json\n{ \"mode\": \"task_run\", \"command\": \"list\", \"args\": { \"taskId\": \"task_id\", \"limit\": 20 } }\n```\n\nThe result contains run attempts, finalized receipts, and active waits.\n\n### Inspect one attempt\n\n```json\n{ \"mode\": \"task_run\", \"command\": \"get\", \"args\": { \"runId\": \"run_id\" } }\n```\n\nThe result contains the TaskRun, its receipt when terminal, ordered events, and active Task waits.\n\n### Cancel an attempt\n\nRead the run first, then pass its current version. Cancellation creates a terminal receipt.\n\n```json\n{\n \"mode\": \"task_run\",\n \"command\": \"cancel\",\n \"args\": { \"runId\": \"run_id\", \"expectedVersion\": 2, \"reason\": \"User cancelled execution\" }\n}\n```\n\nDo not guess commands such as retry, force-complete, heartbeat, or transition; they are not Agent APIs.\n\n## Notes\n\nCommands: `list`, `get`, `create`, `append`, `preview_edit`, `update`, and `delete`.\nUse Notes for durable prose and reference material, not as a Task substitute. Prefer `append`\nwhen preserving user content. Use `preview_edit` before a canonical rewrite.\n\n```json\n{ \"mode\": \"note\", \"command\": \"create\", \"args\": { \"title\": \"Decision\", \"markdown\": \"...\", \"projectId\": \"project_id\" } }\n```\n\n```json\n{ \"mode\": \"note\", \"command\": \"append\", \"args\": { \"noteId\": \"note_id\", \"heading\": \"AI synthesis\", \"content\": \"...\" } }\n```\n\nUse `update` with `status: \"trashed\"` for a recoverable removal. `delete` permanently\nremoves the Note and its stored snapshots and media; use `dryRun: true` first when the\nuser's intent is ambiguous.\n\n```json\n{ \"mode\": \"note\", \"command\": \"delete\", \"args\": { \"noteId\": \"note_id\" }, \"dryRun\": true }\n```\n\n## Chat previews, local apps, and settings\n\nUse `chat_preview` by default when the user asks to design, mock up, or quickly show a UI in\nthe current conversation. It creates no Project and no Local App. Commands are `create`,\n`get`, and `revise`. Source consists of `markup`, `styles`, and optional `script`;\ndo not include a full HTML document or remote dependencies. Revision requires the exact\n`baseRevision` returned by the prior call.\n\nUse `local_app` only when the user explicitly asks for a durable, installable app or chooses\n\u201CSave as app\u201D on a chat preview. Do not create a Local App merely to render a UI draft.\n\nLocal app commands are `list`, `get`, `create`, and `validate`. Installation,\nactivation, rollback, and uninstall remain product runtime operations.\n\nSettings supports only `open` and returns an exact product jump target without changing config.\n\n## Error recovery\n\n| Result | Recovery |\n| --- | --- |\n| service unavailable | Stop retrying and report the unavailable capability. |\n| not found | Re-list in the intended scope; do not invent another id. |\n| conflict | Read the current object and reassess using its latest version. |\n| waiting | Inspect the Task projection and TaskRun waits; resolve only the real blocker. |\n| invalid command or state | Read the object and use only a documented transition. |\n| unsupported operation | Use the dedicated tool or product UI; never write storage directly. |\n\n## Deliberate boundaries\n\n- Project deletion and milestone deletion are not Agent APIs.\n- TaskRun mutation is internal to execution coordination except for optimistic cancellation.\n- Project updates are immutable.\n- Workflow and Automation operations remain in their dedicated tools.\n- Only the documented Task and TaskRun commands are valid; do not infer hidden aliases.\n";
@@ -222,6 +222,11 @@ For \`update\`, patch fields may be direct args or nested under \`args.patch\`.
222
222
 
223
223
  ## Tasks
224
224
 
225
+ Task locale follows the conversation response language, then the user request and profile.
226
+ Keep every user-facing contract field (criteria, expected outputs, constraints, assumptions and risks)
227
+ in that language, even when attached source material is English. Preserve paths, URLs and proper nouns.
228
+ An explicit locale must reflect the user’s language choice.
229
+
225
230
  Commands: \`list\`, \`get\`, \`create\`, \`delegated_tasks\`, \`collaboration\`,
226
231
  \`collaboration_post\`, \`update_dependencies\`, \`add_context\`, \`remove_context\`,
227
232
  \`command\`, and \`delete\`.
@@ -1,4 +1,5 @@
1
1
  import type { AgentTool } from '@earendil-works/pi-agent-core';
2
2
  import { type DataSourceOptions } from '../data-acquisition/service.js';
3
+ export declare function withoutDataToolPermissions<T>(run: () => T): T;
3
4
  export declare function withDataToolPermissions<T>(names: ReadonlySet<string>, run: () => T): T;
4
5
  export declare function createDataBatchTool(workspace: string, getAllowedTools: () => ReadonlySet<string>, options?: DataSourceOptions): AgentTool;
@@ -8,6 +8,9 @@ import { AsyncLocalStorage } from "node:async_hooks";
8
8
  init_logger();
9
9
  const executionTools = new AsyncLocalStorage();
10
10
  const log = createLogger("DataAcquisition");
11
+ function withoutDataToolPermissions(run) {
12
+ return executionTools.exit(run);
13
+ }
11
14
  function withDataToolPermissions(names, run) {
12
15
  const parent = executionTools.getStore();
13
16
  const allowed = parent ? new Set([...names].filter((name) => parent.has(name))) : names;
@@ -49,4 +52,4 @@ function createDataBatchTool(workspace, getAllowedTools, options = {}) {
49
52
  };
50
53
  }
51
54
  //#endregion
52
- export { createDataBatchTool, withDataToolPermissions };
55
+ export { createDataBatchTool, withDataToolPermissions, withoutDataToolPermissions };
@@ -6,6 +6,7 @@ export declare const DEFAULT_DELEGATE_TOOLS: string[];
6
6
  /** Tools never passed to a delegated sub-agent (even if requested). */
7
7
  export declare const DELEGATE_BLOCKED_TOOLS: Set<string>;
8
8
  export interface DelegateToolDeps {
9
+ isWorkspaceTrusted?: (workspaceDir: string) => boolean | null | undefined;
9
10
  getParentTools: () => AgentTool<any, any>[];
10
11
  createParentPolicy?: () => AgentTurnPolicy;
11
12
  workspace: string;
@@ -155,6 +155,7 @@ function createDelegateTool(deps) {
155
155
  const abort = () => child?.abort(resolveAgentAbortReason(signal?.reason));
156
156
  try {
157
157
  child = createDelegateChildHandle({
158
+ isWorkspaceTrusted: deps.isWorkspaceTrusted,
158
159
  workspace,
159
160
  goal: mode === "review" ? `Independently review the actual changes. Inspect review_workspace and relevant source/tests. Report actionable defects with file and line evidence, severity and a concrete failure example. If there are no findings, state the checks and remaining uncertainty. Do not treat the parent's completion claim as evidence.\n\n${input.goal}` : input.goal,
160
161
  context: [input.context, research ? researchResumeContext(research.checkpoint) : void 0].filter(Boolean).join("\n\n") || void 0,
@@ -36,11 +36,13 @@ var ToolErrorTracker = class {
36
36
  lastErrorTime: now
37
37
  });
38
38
  this.totalFailures++;
39
+ const errorMessage = error?.replace(/\s+/g, " ").trim().slice(0, 500) || void 0;
39
40
  log.warn({
40
41
  toolName,
41
42
  failures: this.getFailureCount(toolName),
42
- total: this.totalFailures
43
- }, "Tool failure recorded");
43
+ total: this.totalFailures,
44
+ errorMessage
45
+ }, errorMessage ? `Tool failure recorded (${toolName}): ${errorMessage}` : "Tool failure recorded");
44
46
  }
45
47
  /**
46
48
  * Get failure count for a specific tool
@@ -8,7 +8,7 @@ import { Type } from "@sinclair/typebox";
8
8
  //#region src/agent/tools/exec-command.ts
9
9
  const DEFAULT_MAX_OUTPUT_CHARS = 5e4;
10
10
  const ExecCommandSchema = Type.Object({
11
- cmd: Type.String({ description: "Command for the default platform shell: /bin/sh on Unix and in Docker; cmd.exe on Windows hosts. Use portable syntax, or invoke an installed shell explicitly for shell-specific features." }),
11
+ cmd: Type.String({ description: "Command for the default platform shell: /bin/sh on Unix and in Docker; cmd.exe on Windows hosts. Commands start in the workspace; use cwd instead of cd. For verification, invoke the existing test runner directly without shell chains, pipes, or output filters so its exit status and evidence remain unambiguous. Use maxOutputChars to limit output." }),
12
12
  cwd: Type.Optional(Type.String({ description: "Working directory. Relative paths are resolved under the agent workspace." })),
13
13
  timeoutMs: Type.Optional(Type.Number({ description: "Command timeout in milliseconds. Defaults to 1800000 (30m) and is capped at 14400000 (4h)." })),
14
14
  maxOutputChars: Type.Optional(Type.Number({ description: "Maximum characters returned to the model. UI streaming still receives output deltas." })),
@@ -19,7 +19,7 @@ const ExecCommandSchema = Type.Object({
19
19
  })),
20
20
  outputs: Type.Optional(Type.Array(Type.String({ minLength: 1 }), {
21
21
  maxItems: 50,
22
- description: "Final user-facing files created by this command. Relative paths resolve under the effective cwd and are persisted as chat deliverables after a successful command."
22
+ description: "Final user-facing files to persist after this command succeeds, including files written earlier in the task. Put all final paths on the final verification command to verify and publish in one call. Relative paths resolve under the effective cwd."
23
23
  }))
24
24
  });
25
25
  function clampMaxOutputChars(raw) {
@@ -60,7 +60,7 @@ function createExecCommandTool(workspaceCwd, options) {
60
60
  "Use apply_patch for file edits; do not edit files by shell redirection unless explicitly necessary.",
61
61
  "Relative cwd values resolve under the current agent workspace.",
62
62
  "Use a fresh output directory with mkdir -p. Avoid destructive cleanup such as rm -rf on variable paths; blocked cleanup should be removed, never disguised or moved to bypass policy. A syntax preflight on Unix host commands prevents partial writes from malformed shell syntax.",
63
- "When the command creates final user-facing files, declare all final paths in outputs so they are persisted with this command."
63
+ "Use outputs on the final verification command to persist all completed user-facing files together, including files written earlier. A successful artifact receipt needs no additional publish_artifacts call unless the file changes or capture failed."
64
64
  ].join(" "),
65
65
  parameters: ExecCommandSchema,
66
66
  label: "Run Command",
@@ -232,6 +232,7 @@ function createExecCommandTool(workspaceCwd, options) {
232
232
  const published = details.artifacts.filter((item) => item.availability === "available").length;
233
233
  const failed = details.artifacts.length - published;
234
234
  resultText += `\n\nArtifacts: ${published} published${failed > 0 ? `, ${failed} failed` : ""}.`;
235
+ resultText += `\n${details.artifacts.map((item) => `${JSON.stringify(item.title)}: ${item.availability}`).join("\n")}`;
235
236
  }
236
237
  return {
237
238
  content: [{
@@ -27,6 +27,7 @@ import type { WorkflowRunServiceLike } from '../../workflows/service/workflow-ru
27
27
  import type { SkillManager } from '../skills/skill-manager.js';
28
28
  import { type ToolExecutorConfig } from './executor.js';
29
29
  export interface ToolFactoryDeps {
30
+ isWorkspaceTrusted?: (workspaceDir: string) => boolean | null | undefined;
30
31
  workspace: string;
31
32
  extensionRegistry?: ExtensionRegistry;
32
33
  getCurrentContext: () => {
@@ -8,19 +8,19 @@ import { getSessionMetadata } from "../../storage/sqlite/session-read-repository
8
8
  import { patchSessionMetadata } from "../../storage/sqlite/session-repository.js";
9
9
  import { getSessionTaskPlan, setSessionTaskPlan } from "../../storage/sqlite/session-task-plan-repository.js";
10
10
  import { init_sqlite } from "../../storage/sqlite/index.js";
11
- import { resolveUserContextSessionAccess } from "../../user-context/access-policy.js";
12
11
  import { init_agent_scope, resolveDefaultAgentId } from "../agent-scope.js";
13
- import { resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
12
+ import { resolveUserContextSessionAccess } from "../../user-context/access-policy.js";
13
+ import { resolveEffectiveAgentConfigForAgent } from "../../config/agent-profile.js";
14
14
  import { PERSONAL_TOOL_DESCRIPTIONS } from "../../personal-agent/policy.js";
15
15
  import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
16
16
  import { PERSONAL_REQUEST_TOOL_IDS, TASK_EXECUTION_TOOL_IDS, filterExecutionTools, resolveExecutionToolPolicy } from "../embedded/execution-tool-policy.js";
17
17
  import { LOCAL_READ_MAX_CHARS } from "./local-read-budget.js";
18
18
  import { createPersonalAttentionTool } from "./personal-attention-tool.js";
19
+ import { withCoreToolExposure } from "./toolExposure.js";
19
20
  import { markCodemodeCoreRead } from "./codemode-permissions.js";
20
21
  import "../../../packages/browser-control-contract/src/index.js";
21
22
  import { getEmbeddedExecutionRunId, getEmbeddedExecutionSession } from "../embedded/execution-context.js";
22
23
  import { wrapToolsWithProtection } from "./executor.js";
23
- import { EXTERNAL_TOOL_NAMES } from "../external-tools/gateway-tools.js";
24
24
  import { createDefaultExternalToolGatewayTools } from "../external-tools/index.js";
25
25
  import { createReadFileTool } from "./read.js";
26
26
  import { createDataBatchTool } from "./dataBatch.js";
@@ -85,7 +85,7 @@ import { ComputerRuntime } from "../../computer/runtime.js";
85
85
  import { createComputerUseTool } from "./computer-use-tool.js";
86
86
  import { createReviewWorkspaceTool } from "./review-workspace.js";
87
87
  import { createLanguageDiagnosticsTool } from "./language-diagnostics.js";
88
- import { createDelegationParentPolicy } from "./delegation-parent-policy.js";
88
+ import { createNoninteractiveToolPolicy } from "./noninteractive-tool-policy.js";
89
89
  import { mergeTtsConfigFromAppConfig } from "../../voice/tts/merge-config.js";
90
90
  import { createTextToSpeechTool } from "./tts-tool.js";
91
91
  import { getAgentCapabilityToolNames } from "../capabilities/registry.js";
@@ -268,7 +268,7 @@ var AgentToolsFactory = class AgentToolsFactory {
268
268
  agentId: options?.agentId ?? (cfg ? resolveDefaultAgentId() : "main")
269
269
  });
270
270
  const agentId = options?.agentId;
271
- const resolvedAgentId = agentId ?? (cfg ? resolveDefaultAgentId() : "main");
271
+ const resolvedAgentId = agentId ?? (executionConversationId ? getSessionMetadata(executionConversationId)?.agentId : void 0) ?? (cfg ? resolveDefaultAgentId() : "main");
272
272
  const personalExecution = executionConversationId ? personalRequestForExecution(executionConversationId) : void 0;
273
273
  const personalExecutionMarker = executionConversationId && isXopcDatabaseOpen() ? getSessionMetadata(executionConversationId)?.customData?.personalReadRequestId : void 0;
274
274
  if (personalExecution && executionConversationId && personalExecutionMarker !== personalExecution.requestId) patchSessionMetadata(executionConversationId, { customData: {
@@ -292,7 +292,7 @@ var AgentToolsFactory = class AgentToolsFactory {
292
292
  return key ? getSessionMetadata(key)?.projectId : void 0;
293
293
  };
294
294
  const getCommandIsolation = () => {
295
- return this.deps.getConfig?.() ? (currentConversationId() ? resolveEffectiveAgentConfigForSession(currentConversationId()) : resolveEffectiveAgentConfigForAgent(resolvedAgentId)).config.runtime.commandIsolation : void 0;
295
+ return this.deps.getConfig?.() ? resolveEffectiveAgentConfigForAgent(resolvedAgentId).config.runtime.commandIsolation : void 0;
296
296
  };
297
297
  const externalTools = createDefaultExternalToolGatewayTools({
298
298
  workspace,
@@ -578,9 +578,10 @@ var AgentToolsFactory = class AgentToolsFactory {
578
578
  startWorkflowRun: this.deps.getWorkflowRunService ? (params) => this.deps.getWorkflowRunService().startWorkflowRun(params) : void 0
579
579
  })] : [],
580
580
  ...primary ? [createDelegateTool({
581
+ isWorkspaceTrusted: this.deps.isWorkspaceTrusted,
581
582
  workspace,
582
583
  getParentTools: () => options?.getParentTools?.() ?? filterToolsByDisabledSet(core, disabled),
583
- createParentPolicy: options?.createDelegationPolicy ?? (() => createDelegationParentPolicy({
584
+ createParentPolicy: options?.createDelegationPolicy ?? (() => createNoninteractiveToolPolicy({
584
585
  getConfig: () => this.deps.getConfig?.(),
585
586
  conversationId: currentConversationId(),
586
587
  agentId: resolvedAgentId
@@ -602,6 +603,8 @@ var AgentToolsFactory = class AgentToolsFactory {
602
603
  },
603
604
  toolExecutorConfig: this.deps.toolExecutorConfig,
604
605
  buildChildTools: (childOpts) => {
606
+ const childAgentId = childOpts.agentId ?? resolvedAgentId;
607
+ const childConfig = childOpts.getConfig() ? resolveEffectiveAgentConfigForAgent(childAgentId).config : void 0;
605
608
  return new AgentToolsFactory({
606
609
  workspace: childOpts.workspace,
607
610
  bus: childOpts.bus,
@@ -609,21 +612,17 @@ var AgentToolsFactory = class AgentToolsFactory {
609
612
  getConfig: childOpts.getConfig,
610
613
  getPrimaryModel: () => childOpts.model,
611
614
  endpointTools: childOpts.endpointTools ?? this.deps.endpointTools,
612
- toolExecutorConfig: childOpts.toolExecutorConfig
615
+ toolExecutorConfig: {
616
+ ...childOpts.toolExecutorConfig,
617
+ resolveTimeoutMs: (name) => childOpts.getConfig() ? resolveEffectiveAgentConfigForAgent(childAgentId).config.tools[name]?.timeoutMs : void 0
618
+ }
613
619
  }).createAllTools({
614
620
  workspace: childOpts.workspace,
615
621
  getPrimaryModel: () => childOpts.model,
616
- agentId: options?.agentId ?? childOpts.agentId,
617
- conversationId: childOpts.browserConversationId,
618
- toolAllowlist: options?.toolAllowlist,
619
- disabledTools: new Set([
620
- ...disabled ?? [],
621
- EXTERNAL_TOOL_NAMES.search,
622
- EXTERNAL_TOOL_NAMES.describe,
623
- EXTERNAL_TOOL_NAMES.execute,
624
- EXTERNAL_TOOL_NAMES.requireConnection,
625
- EXTERNAL_TOOL_NAMES.updateConnectionObjective
626
- ])
622
+ agentId: childAgentId,
623
+ conversationId: childOpts.conversationId,
624
+ toolAllowlist: childConfig?.toolAllowlist,
625
+ disabledTools: new Set(Object.entries(childConfig?.tools ?? {}).filter(([, policy]) => policy.mode === "deny").map(([name]) => name))
627
626
  });
628
627
  }
629
628
  })] : [],
@@ -641,7 +640,7 @@ var AgentToolsFactory = class AgentToolsFactory {
641
640
  "xopc_tool_execute"
642
641
  ].some((name) => !disabled?.has(name))) {
643
642
  const dataTools = () => {
644
- const policies = this.deps.getConfig?.() ? (currentConversationId() ? resolveEffectiveAgentConfigForSession(currentConversationId()) : resolveEffectiveAgentConfigForAgent(resolvedAgentId)).config.tools : void 0;
643
+ const policies = this.deps.getConfig?.() ? resolveEffectiveAgentConfigForAgent(resolvedAgentId).config.tools : void 0;
645
644
  if (policies?.data_batch?.mode === "deny") return [];
646
645
  return filterToolsByDisabledSet(core, disabled).filter((tool) => (!allowed || allowed.has(tool.name)) && policies?.[tool.name]?.mode !== "deny");
647
646
  };
@@ -654,7 +653,7 @@ var AgentToolsFactory = class AgentToolsFactory {
654
653
  return filterExecutionTools(executionToolPolicy, filterToolsByDisabledSet(core.map(markCodemodeCoreRead), disabled).filter((tool) => (!allowed || allowed.has(tool.name)) && !(personalToolsConfigured && tool.name === "clarify")).map((tool) => personalToolsConfigured && !tool.name.startsWith("personal_") && PERSONAL_TOOL_DESCRIPTIONS[tool.name] ? {
655
654
  ...tool,
656
655
  description: PERSONAL_TOOL_DESCRIPTIONS[tool.name]
657
- } : tool));
656
+ } : tool)).map((tool) => executionToolPolicy.discovery ? withCoreToolExposure(tool) : tool);
658
657
  }
659
658
  createCapabilityTools(capabilityNames, options) {
660
659
  const disabled = options?.disabledTools;
@@ -1,6 +1,6 @@
1
1
  import type { Config } from '../../config/schema.js';
2
2
  /** Noninteractive callers cannot silently turn an ask policy into an allow. */
3
- export declare function createDelegationParentPolicy(options: {
3
+ export declare function createNoninteractiveToolPolicy(options: {
4
4
  getConfig: () => Config | undefined;
5
5
  conversationId?: string;
6
6
  agentId?: string;
@@ -1,8 +1,8 @@
1
1
  import { resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
2
2
  import { createAgentTurnPolicy } from "../orchestration/agent-turn-policy.js";
3
- //#region src/agent/tools/delegation-parent-policy.ts
3
+ //#region src/agent/tools/noninteractive-tool-policy.ts
4
4
  /** Noninteractive callers cannot silently turn an ask policy into an allow. */
5
- function createDelegationParentPolicy(options) {
5
+ function createNoninteractiveToolPolicy(options) {
6
6
  const policies = (name, args) => {
7
7
  if (!options.getConfig()) return [];
8
8
  const resolved = options.conversationId ? resolveEffectiveAgentConfigForSession(options.conversationId) : options.agentId ? resolveEffectiveAgentConfigForAgent(options.agentId) : resolveEffectiveAgentConfigForSession(void 0);
@@ -23,7 +23,7 @@ function createDelegationParentPolicy(options) {
23
23
  const blocked = policies(context.toolCall.name, context.args).find((policy) => policy.mode !== "allow");
24
24
  return blocked ? {
25
25
  block: true,
26
- reason: `${blocked.id} requires parent authorization (${blocked.mode}).`
26
+ reason: `${blocked.id} requires authorization (${blocked.mode}).`
27
27
  } : void 0;
28
28
  },
29
29
  resolveToolLimit: (name, args) => {
@@ -36,4 +36,4 @@ function createDelegationParentPolicy(options) {
36
36
  });
37
37
  }
38
38
  //#endregion
39
- export { createDelegationParentPolicy };
39
+ export { createNoninteractiveToolPolicy };
@@ -1,7 +1,7 @@
1
+ import { CapabilityDispatcher } from "../../capabilities/runtime/dispatcher.js";
1
2
  import { isPersonalConversation } from "../../personal-agent/repository.js";
2
3
  import { LOCAL_READ_MAX_CHARS } from "./local-read-budget.js";
3
4
  import { getEmbeddedExecutionSession } from "../embedded/execution-context.js";
4
- import { CapabilityDispatcher } from "../../capabilities/runtime/dispatcher.js";
5
5
  import { registerNoteReadCapabilities } from "../../notes/capabilities/read.js";
6
6
  import { registerProjectReadCapabilities } from "../../projects/capabilities/read.js";
7
7
  import { registerAutomationReadCapabilities } from "../../automations/capabilities/read.js";
@@ -12,9 +12,9 @@ import { TaskReadModelProjector } from "../../tasks/task-read-model-projector.js
12
12
  import { TaskOriginRepository } from "../../tasks/task-origin-repository.js";
13
13
  import { boundedPersonalResult } from "./personal-result-budget.js";
14
14
  import { TaskCollaborationRepository } from "../../tasks/task-collaboration-repository.js";
15
+ import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../../personal-agent/communication.js";
15
16
  import { parseTaskHandoffReferences } from "../../tasks/task-handoff.js";
16
17
  import { TaskApplicationService } from "../../tasks/task-application-service.js";
17
- import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../../personal-agent/communication.js";
18
18
  import { getAvailablePersonalAgentTools, personalAgentModelAvailability } from "../../personal-agent/specialist-capabilities.js";
19
19
  import { assessSpecialist, matchSpecialists } from "../../agent-matching/service.js";
20
20
  import { createXopcUseTool } from "./xopc-use-tool.js";
@@ -75,7 +75,7 @@ function createPublishArtifactsTool(workspace) {
75
75
  return {
76
76
  name: "publish_artifacts",
77
77
  label: "Publish Artifacts",
78
- description: "Publish completed user-facing files into durable chat artifacts. Call this after exec_command or another runtime creates spreadsheets, presentations, PDFs, documents, archives, or other files. Pass every final deliverable together; do not publish temporary or source files.",
78
+ description: "Publish only completed requested user-facing files missing a current successful artifact receipt. This tool cannot read, edit, create files, or execute commands. If a required edit is blocked, report that limitation without publishing the original or probing this tool. Pass missing final paths together; exclude unchanged captured files, temporary files, and source edits.",
79
79
  parameters: PublishArtifactsSchema,
80
80
  mutationScope: "none",
81
81
  supportsParallel: false,
@@ -1,4 +1,4 @@
1
- import type { SearchResult } from './types.js';
1
+ import type { SearchMetadata, SearchResult } from './types.js';
2
2
  export declare const SEARCH_CACHE_TTL_MS: number;
3
3
  export interface SearchCacheEntry {
4
4
  key: string;
@@ -7,11 +7,13 @@ export interface SearchCacheEntry {
7
7
  results: SearchResult[];
8
8
  provider: string;
9
9
  capturedAt: number;
10
+ metadata?: SearchMetadata;
10
11
  }
11
12
  export interface SearchCache {
12
13
  get(key: string): SearchCacheEntry | undefined;
13
14
  set(entry: SearchCacheEntry): void;
14
15
  }
16
+ export declare function withoutSearchCache<T>(run: () => T): T;
15
17
  /** Research owns this scope. No account-wide or cross-conversation cache exists. */
16
18
  export declare function withSearchCache<T>(cache: SearchCache, run: () => T): T;
17
19
  export declare function currentSearchCache(): SearchCache | undefined;
@@ -2,6 +2,9 @@ import { AsyncLocalStorage } from "node:async_hooks";
2
2
  //#region src/agent/tools/search/cache.ts
3
3
  const SEARCH_CACHE_TTL_MS = 10 * 6e4;
4
4
  const searchCache = new AsyncLocalStorage();
5
+ function withoutSearchCache(run) {
6
+ return searchCache.exit(run);
7
+ }
5
8
  /** Research owns this scope. No account-wide or cross-conversation cache exists. */
6
9
  function withSearchCache(cache, run) {
7
10
  return searchCache.run(cache, run);
@@ -16,4 +19,4 @@ var SearchCacheWriteError = class extends Error {
16
19
  }
17
20
  };
18
21
  //#endregion
19
- export { SEARCH_CACHE_TTL_MS, SearchCacheWriteError, currentSearchCache, withSearchCache };
22
+ export { SEARCH_CACHE_TTL_MS, SearchCacheWriteError, currentSearchCache, withSearchCache, withoutSearchCache };
@@ -0,0 +1,9 @@
1
+ export declare function deepseekSearchEndpoint(baseUrl?: string): string;
2
+ export declare function deepseekSearchBody(query: string, count: number): string;
3
+ export declare function deepseekSearchResults(body: unknown): Array<{
4
+ title: string;
5
+ url: string;
6
+ description: string;
7
+ publishedAt?: string;
8
+ }>;
9
+ export declare function readDeepseekResponse(response: Response): Promise<unknown>;
@@ -0,0 +1,84 @@
1
+ import { __esmMin } from "../../../../../_virtual/_rolldown/runtime.js";
2
+ //#region src/agent/tools/search/providers/deepseek-protocol.ts
3
+ function deepseekSearchEndpoint(baseUrl = "https://api.deepseek.com") {
4
+ const url = new URL(baseUrl);
5
+ if (url.protocol !== "https:" || url.username || url.password || url.search || url.hash || ![
6
+ "",
7
+ "/",
8
+ "/v1",
9
+ "/v1/"
10
+ ].includes(url.pathname)) throw new Error("DeepSeek API base URL must be an HTTPS origin with optional /v1");
11
+ return `${url.origin}/v1/tools/search`;
12
+ }
13
+ function deepseekSearchBody(query, count) {
14
+ if (!query.trim() || Array.from(query).length > 128) throw new Error("DeepSeek search query must contain 1–128 Unicode characters");
15
+ return JSON.stringify({
16
+ query,
17
+ count: Math.max(1, Math.min(50, Math.floor(count))),
18
+ need_content: false
19
+ });
20
+ }
21
+ function deepseekSearchResults(body) {
22
+ if (!body || typeof body !== "object" || !("results" in body) || !Array.isArray(body.results)) throw new Error("DeepSeek search returned an invalid response");
23
+ const seen = /* @__PURE__ */ new Set();
24
+ return body.results.flatMap((item) => {
25
+ if (!item || typeof item !== "object") return [];
26
+ const row = item;
27
+ if (typeof row.title !== "string" || !row.title.trim() || typeof row.url !== "string") return [];
28
+ let url;
29
+ try {
30
+ url = new URL(row.url);
31
+ } catch {
32
+ return [];
33
+ }
34
+ if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || seen.has(url.href)) return [];
35
+ seen.add(url.href);
36
+ const description = typeof row.summary === "string" && row.summary.trim() ? row.summary : typeof row.snippet === "string" ? row.snippet : "";
37
+ return [{
38
+ title: row.title.trim().slice(0, 300),
39
+ url: url.href,
40
+ description: description.trim().slice(0, 800),
41
+ ...typeof row.date === "string" && row.date.length <= 100 ? { publishedAt: row.date } : {}
42
+ }];
43
+ });
44
+ }
45
+ async function readDeepseekResponse(response) {
46
+ const limit = 2 * 1024 * 1024;
47
+ if (Number(response.headers.get("content-length")) > limit) {
48
+ await response.body?.cancel();
49
+ throw new Error("DeepSeek search response is too large");
50
+ }
51
+ const reader = response.body?.getReader();
52
+ if (!reader) throw new Error("DeepSeek search returned an empty response");
53
+ const chunks = [];
54
+ let length = 0;
55
+ try {
56
+ while (true) {
57
+ const { value, done } = await reader.read();
58
+ if (done) break;
59
+ length += value.byteLength;
60
+ if (length > limit) {
61
+ await reader.cancel();
62
+ throw new Error("DeepSeek search response is too large");
63
+ }
64
+ chunks.push(value);
65
+ }
66
+ } finally {
67
+ reader.releaseLock();
68
+ }
69
+ const bytes = new Uint8Array(length);
70
+ let offset = 0;
71
+ for (const chunk of chunks) {
72
+ bytes.set(chunk, offset);
73
+ offset += chunk.byteLength;
74
+ }
75
+ try {
76
+ return JSON.parse(new TextDecoder().decode(bytes));
77
+ } catch {
78
+ throw new Error("DeepSeek search returned invalid JSON");
79
+ }
80
+ }
81
+ var init_deepseek_protocol = __esmMin((() => {}));
82
+ //#endregion
83
+ init_deepseek_protocol();
84
+ export { deepseekSearchBody, deepseekSearchEndpoint, deepseekSearchResults, init_deepseek_protocol, readDeepseekResponse };
@@ -0,0 +1,9 @@
1
+ import type { SearchProvider, SearchResult } from '../types.js';
2
+ export declare class DeepSeekProvider implements SearchProvider {
3
+ private readonly apiKey;
4
+ private readonly baseUrl?;
5
+ readonly name = "deepseek";
6
+ constructor(apiKey: string, baseUrl?: string);
7
+ isAvailable(): boolean;
8
+ search(query: string, count: number, signal?: AbortSignal): Promise<SearchResult[]>;
9
+ }
@@ -0,0 +1,55 @@
1
+ import { deepseekSearchBody, deepseekSearchEndpoint, deepseekSearchResults, init_deepseek_protocol, readDeepseekResponse } from "./deepseek-protocol.js";
2
+ import { searchHttpError } from "../errors.js";
3
+ import { SearchRateLimitError, SearchRequestGate } from "../request-gate.js";
4
+ //#region src/agent/tools/search/providers/deepseek.ts
5
+ init_deepseek_protocol();
6
+ const gate = new SearchRequestGate();
7
+ var DeepSeekProvider = class {
8
+ name = "deepseek";
9
+ constructor(apiKey, baseUrl) {
10
+ this.apiKey = apiKey;
11
+ this.baseUrl = baseUrl;
12
+ }
13
+ isAvailable() {
14
+ return Boolean(this.apiKey.trim());
15
+ }
16
+ async search(query, count, signal) {
17
+ const endpoint = deepseekSearchEndpoint(this.baseUrl);
18
+ const body = deepseekSearchBody(query, count);
19
+ try {
20
+ await gate.wait(signal);
21
+ } catch (error) {
22
+ if (error instanceof SearchRateLimitError) throw searchHttpError(new Response(null, {
23
+ status: 429,
24
+ headers: { "retry-after": String(error.retryAfterMs / 1e3) }
25
+ }));
26
+ throw error;
27
+ }
28
+ const response = await fetch(endpoint, {
29
+ method: "POST",
30
+ redirect: "error",
31
+ signal,
32
+ headers: {
33
+ authorization: `Bearer ${this.apiKey}`,
34
+ "content-type": "application/json",
35
+ accept: "application/json"
36
+ },
37
+ body
38
+ });
39
+ if (!response.ok) {
40
+ if (response.status === 429) {
41
+ const retryAfter = response.headers.get("retry-after");
42
+ const ms = retryAfter === null ? 1e3 : Number.isFinite(Number(retryAfter)) ? Number(retryAfter) * 1e3 : Date.parse(retryAfter) - Date.now();
43
+ gate.cooldown(Number.isFinite(ms) ? Math.max(1e3, ms) : 1e3);
44
+ }
45
+ await response.body?.cancel();
46
+ throw searchHttpError(response, response.status === 402 ? "DeepSeek search account balance is insufficient" : `DeepSeek search failed (${response.status})`);
47
+ }
48
+ return deepseekSearchResults(await readDeepseekResponse(response)).slice(0, count).map(({ publishedAt: _date, ...result }) => ({
49
+ ...result,
50
+ source: this.name
51
+ }));
52
+ }
53
+ };
54
+ //#endregion
55
+ export { DeepSeekProvider };
@@ -1,6 +1,6 @@
1
1
  import { type ModelCatalogStore } from '../../../../providers/model-catalog-store.js';
2
2
  import { type ProviderAuthService } from '../../../../providers/provider-auth-service.js';
3
- import type { SearchProvider, SearchResult } from '../types.js';
3
+ import type { SearchExecution, SearchProvider, SearchResult } from '../types.js';
4
4
  interface XopcCloudSearchProviderOptions {
5
5
  region: 'cn' | 'global';
6
6
  fetchImpl?: typeof fetch;
@@ -17,5 +17,6 @@ export declare class XopcCloudSearchProvider implements SearchProvider {
17
17
  cacheIdentity(): string;
18
18
  isAvailable(): boolean;
19
19
  search(query: string, count: number, signal?: AbortSignal): Promise<SearchResult[]>;
20
+ searchWithMetadata(query: string, count: number, signal?: AbortSignal): Promise<SearchExecution>;
20
21
  }
21
22
  export {};