@xopcai/xopc 0.0.386 → 0.0.387

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 (244) hide show
  1. package/dist/browser-ext/dist/sidepanel.js +1 -1
  2. package/dist/browser-ext/manifest.json +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D-86VOlb.js → agent-avatar-dicebear-Bv8M5ygD.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-SmeUVHY8.js → agent-defaults-settings-panel-UBy01-65.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-plugin-dialog-BVT3wXq5.js → agent-plugin-dialog-Q9guA8kU.js} +1 -1
  7. package/dist/gateway/static/root/assets/{agents-D7rLQFhX.js → agents-yfJFubD0.js} +3 -3
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-CUR7n5iP.js → app-management-settings-panel-Cdyad8c1.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-BCotSGep.js → appearance-settings-DPPvnKH_.js} +1 -1
  10. package/dist/gateway/static/root/assets/{apps-page-hk0bo9LT.js → apps-page-Bn_jwaeA.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-CqxuUwox.js → automations-page-CAB2sLJ5.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-workspace-11_Z69pr.js → automations-workspace-CYRUhhH4.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-eldB84Mj.js → block-editor-B9DmMEa8.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-automations-page-D4TaUPYT.js → browser-automations-page-BHAWpZE2.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-settings-page-BXRlxeGV.js → browser-settings-page-BG_17NcQ.js} +2 -2
  16. package/dist/gateway/static/root/assets/{capabilities-DVj9n65C.js → capabilities-BX1rCiVm.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capabilities-BkKgImWi.js → capabilities-CW389yo6.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capabilities-page-CyYlueEd.js → capabilities-page-BAnBYWlY.js} +2 -2
  19. package/dist/gateway/static/root/assets/{capabilities-settings-panel-uVEgfvo0.js → capabilities-settings-panel-Ca-d6lXk.js} +3 -3
  20. package/dist/gateway/static/root/assets/{capability-header-actions-BXv0xu56.js → capability-header-actions-B3TL8TcF.js} +1 -1
  21. package/dist/gateway/static/root/assets/{channels-fNb3SOzm.js → channels-BadpS-nq.js} +1 -1
  22. package/dist/gateway/static/root/assets/{chat-terminal-dock-CnLtparQ.js → chat-terminal-dock-C_vntFpP.js} +1 -1
  23. package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-BMYIfy9x.js → chunk-KS7C4IRE--EKdQGRF.js} +1 -1
  24. package/dist/gateway/static/root/assets/{computer-settings-page-xM0AnOlP.js → computer-settings-page-B-5kxk70.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connector-service-page-CdG2WUb6.js → connector-service-page-DTnfpLHL.js} +1 -1
  26. package/dist/gateway/static/root/assets/{connectors-page-BRd08GH6.js → connectors-page-CmJV7gqj.js} +1 -1
  27. package/dist/gateway/static/root/assets/constants-DeXt1mV-.js +1 -0
  28. package/dist/gateway/static/root/assets/{date-picker-DIBbE-O8.js → date-picker-D5zYeC8q.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dependency-picker-DDD8zokD.js → dependency-picker-D72vT-tb.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-KlF390Xn.js → desktop-pet-DvoeVPf_.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-settings-CgqQMKDC.js → desktop-pet-settings-Dfb392hs.js} +1 -1
  32. package/dist/gateway/static/root/assets/{device-pairing-wizard-BR6isfG2.js → device-pairing-wizard-B06Sqn5D.js} +1 -1
  33. package/dist/gateway/static/root/assets/{directory-picker-path-field-vPQsW05P.js → directory-picker-path-field-CA3H3bc-.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-debug-page-ZHLPrLbH.js → extension-debug-page-B0wTBCx4.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-page-DJ42KFRN.js → extension-page-BeHiXhB1.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-provider-6IcsyNaV.js → extension-provider-CJZ5EVpQ.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-settings-page-D7-5v0V4.js → extension-settings-page-Q88-LFCJ.js} +1 -1
  38. package/dist/gateway/static/root/assets/{fallback-models-DnYn7qOV.js → fallback-models-BXoPCvzq.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-settings-Bwe3JWX-.js → gateway-settings-IICLMGDI.js} +1 -1
  40. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-DefTxF3q.js → highlighted-body-KQOG7T2V-D336so8z.js} +1 -1
  41. package/dist/gateway/static/root/assets/home-page--MvqsFhQ.js +2 -0
  42. package/dist/gateway/static/root/assets/{imports-page-CTdBYZib.js → imports-page-muV1SduS.js} +1 -1
  43. package/dist/gateway/static/root/assets/index-D0qMv3jf.js +260 -0
  44. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CXKp57O_.js → keyboard-shortcuts-settings-i1sDWcwl.js} +1 -1
  45. package/dist/gateway/static/root/assets/{local-app-workbench-page-DzD_OzGY.js → local-app-workbench-page-DY9tXEO6.js} +1 -1
  46. package/dist/gateway/static/root/assets/{local-apps-page-B0E0vttg.js → local-apps-page-BHD73STy.js} +1 -1
  47. package/dist/gateway/static/root/assets/local-session-drafts-Be4BGM4Z.js +1 -0
  48. package/dist/gateway/static/root/assets/{logs-page-eL4fYcMl.js → logs-page-DsPpe8Ws.js} +1 -1
  49. package/dist/gateway/static/root/assets/{management-settings-DSpjodMC.js → management-settings-Buwi2wQE.js} +1 -1
  50. package/dist/gateway/static/root/assets/{markdown-view-DHfQAvZQ.js → markdown-view-CBjl-XEc.js} +2 -2
  51. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-D2mip-f9.js +1 -0
  52. package/dist/gateway/static/root/assets/{note-detail-panel-CsY5tQp5.js → note-detail-panel-D8n80Gbr.js} +3 -3
  53. package/dist/gateway/static/root/assets/{notes-api-nqN2wKYc.js → notes-api-BlGP533W.js} +1 -1
  54. package/dist/gateway/static/root/assets/{notes-page-D09LjNoj.js → notes-page-Btf-jSS_.js} +5 -5
  55. package/dist/gateway/static/root/assets/{page-context-capture-button-DO-aP3D9.js → page-context-capture-button-97RL8Gc7.js} +1 -1
  56. package/dist/gateway/static/root/assets/{personal-page-E8F2aGNB.js → personal-page-B04L8Oz5.js} +1 -1
  57. package/dist/gateway/static/root/assets/product-open-page-9zEDvZa7.js +1 -0
  58. package/dist/gateway/static/root/assets/{product-preview-content-B-cz-pIV.js → product-preview-content-DynBrIXq.js} +1 -1
  59. package/dist/gateway/static/root/assets/{project-detail-page-WhefAh8E.js → project-detail-page-BM7MsoVA.js} +1 -1
  60. package/dist/gateway/static/root/assets/{projects-page-CyqAs0tO.js → projects-page-pcyeEJnz.js} +1 -1
  61. package/dist/gateway/static/root/assets/{remote-access-hub-BwhRGL6m.js → remote-access-hub-CphyTu22.js} +1 -1
  62. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-o26dmPNq.js → runtime-tools-settings-panel-DPafoO0G.js} +1 -1
  63. package/dist/gateway/static/root/assets/{scenes-page-D_e19kv_.js → scenes-page-j97FrDRW.js} +2 -2
  64. package/dist/gateway/static/root/assets/{schema-form-DLLdqUC3.js → schema-form-CuJNwKHO.js} +1 -1
  65. package/dist/gateway/static/root/assets/{send-session-input-2I-nFJcE.js → send-session-input-C293-Hbx.js} +1 -1
  66. package/dist/gateway/static/root/assets/{session-manager-Co5ozD0l.js → session-manager-COd9RECl.js} +2 -2
  67. package/dist/gateway/static/root/assets/{sessions-page-DX6INsiS.js → sessions-page-D8t_8fMl.js} +1 -1
  68. package/dist/gateway/static/root/assets/settings-advanced-gate-CDkitNHA.js +1 -0
  69. package/dist/gateway/static/root/assets/{settings-page-Bc_zxxRu.js → settings-page-DS9DMYUe.js} +1 -1
  70. package/dist/gateway/static/root/assets/{setup-status-panel-FpF_cPPr.js → setup-status-panel-DRDvm9yZ.js} +1 -1
  71. package/dist/gateway/static/root/assets/{share-link-dialog-C47Xgzta.js → share-link-dialog-BKGI8Kr0.js} +1 -1
  72. package/dist/gateway/static/root/assets/{share-preview-page-BOCcPBqQ.js → share-preview-page-BF2WaO43.js} +1 -1
  73. package/dist/gateway/static/root/assets/{shares-settings-CInxjxgJ.js → shares-settings-DQTQZu6V.js} +1 -1
  74. package/dist/gateway/static/root/assets/{skill-api-Bjd8WAA4.js → skill-api-DzVa7G-O.js} +1 -1
  75. package/dist/gateway/static/root/assets/{skills-page-8CKS3Oo2.js → skills-page-CfJIjRdS.js} +1 -1
  76. package/dist/gateway/static/root/assets/{system-settings-panel-BgQdsrNw.js → system-settings-panel-Bzhqed-a.js} +1 -1
  77. package/dist/gateway/static/root/assets/{task-detail-page-BnG5ehZ6.js → task-detail-page-BYQFC0-U.js} +2 -2
  78. package/dist/gateway/static/root/assets/{task-expandable-content-BCuc70Vc.js → task-expandable-content-C9ohICpw.js} +1 -1
  79. package/dist/gateway/static/root/assets/{tunnel-api-CY7MoDGf.js → tunnel-api-DrgpZ81I.js} +1 -1
  80. package/dist/gateway/static/root/assets/{usage-page-s8Sv_PIG.js → usage-page-Drk8FWnj.js} +1 -1
  81. package/dist/gateway/static/root/assets/{use-composer-attachments-D0S2iZF4.js → use-composer-attachments-rgW7h4sD.js} +1 -1
  82. package/dist/gateway/static/root/assets/{use-file-preview-expanded-BElqELib.js → use-file-preview-expanded-DSKIxfz9.js} +1 -1
  83. package/dist/gateway/static/root/assets/{user-model-page-CyWrEtHY.js → user-model-page-07t2-nFE.js} +2 -2
  84. package/dist/gateway/static/root/assets/{work-discovery-overlay-DmZXLs1v.js → work-discovery-overlay-TQ5bjVot.js} +1 -1
  85. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BdLOzHm4.js → workflow-run-setup-panel-C9HP2uGG.js} +1 -1
  86. package/dist/gateway/static/root/assets/{workflows-page-Cx3I3AV5.js → workflows-page-DK01JRI1.js} +3 -3
  87. package/dist/gateway/static/root/assets/{workspace-api-Du7-xJ0q.js → workspace-api-JWHOFos6.js} +2 -2
  88. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-D8B136vW.js → xopc-cloud-account-card-B-BhQdAf.js} +1 -1
  89. package/dist/gateway/static/root/index.html +15 -15
  90. package/dist/package.js +1 -1
  91. package/dist/packages/gateway-contract/src/index.js +2 -0
  92. package/dist/packages/gateway-contract/src/result-reference.js +25 -0
  93. package/dist/packages/gateway-contract/src/session-input-command.js +2 -1
  94. package/dist/packages/gateway-contract/src/task-research-result.js +1 -0
  95. package/dist/packages/gateway-contract/src/task-result-delivery.js +21 -0
  96. package/dist/packages/gateway-contract/src/turn-outcome.js +1 -0
  97. package/dist/src/agent/agent-manager.js +3 -3
  98. package/dist/src/agent/background-review/run-background-review.js +1 -1
  99. package/dist/src/agent/embedded/xopc-tools-bridge.js +13 -2
  100. package/dist/src/agent/external-tools/cliProvider.js +1 -1
  101. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  102. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  103. package/dist/src/agent/external-tools/gateway-tools.js +1 -1
  104. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  105. package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -0
  106. package/dist/src/agent/service/direct-turn-helpers.js +4 -0
  107. package/dist/src/agent/service/process-direct-one-shot.js +4 -1
  108. package/dist/src/agent/service/process-direct-streaming.js +3 -2
  109. package/dist/src/agent/service.js +2 -2
  110. package/dist/src/agent/skills/index.js +1 -1
  111. package/dist/src/agent/skills/managed-store.js +1 -1
  112. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  113. package/dist/src/agent/source-context/index.js +1 -1
  114. package/dist/src/agent/source-context/result-context.d.ts +2 -0
  115. package/dist/src/agent/source-context/result-context.js +32 -0
  116. package/dist/src/agent/source-context/types.d.ts +2 -2
  117. package/dist/src/agent/source-context/types.js +1 -1
  118. package/dist/src/agent/tools/exec-command.js +47 -2
  119. package/dist/src/agent/tools/factory.js +17 -10
  120. package/dist/src/agent/tools/personal-performance.d.ts +2 -0
  121. package/dist/src/agent/tools/personal-performance.js +82 -0
  122. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  123. package/dist/src/agent/tools/personal-request-tool.js +1 -1
  124. package/dist/src/agent/tools/personal-result-tool.d.ts +2 -0
  125. package/dist/src/agent/tools/personal-result-tool.js +106 -0
  126. package/dist/src/agent/tools/personal-task-tool.d.ts +11 -1
  127. package/dist/src/agent/tools/personal-task-tool.js +106 -2
  128. package/dist/src/agent/tools/review-workspace.js +20 -1
  129. package/dist/src/agent/tools/send-media.js +1 -1
  130. package/dist/src/agent/tools/task-collaboration-tool.d.ts +9 -1
  131. package/dist/src/agent/tools/task-collaboration-tool.js +121 -2
  132. package/dist/src/agent/tools/task-evidence.d.ts +3 -0
  133. package/dist/src/agent/tools/task-evidence.js +71 -0
  134. package/dist/src/agent/tools/task-result-tool.js +24 -4
  135. package/dist/src/agent/tools/tool-media.js +1 -1
  136. package/dist/src/agent/tools/xopc-use-tool.js +25 -4
  137. package/dist/src/agent/workspace-runtime/registry.js +1 -1
  138. package/dist/src/agent-catalog/capabilities.js +2 -2
  139. package/dist/src/automations/capabilities/drafts.js +1 -1
  140. package/dist/src/automations/service/action-executor.js +1 -1
  141. package/dist/src/bootstrap/application-state.js +1 -1
  142. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  143. package/dist/src/capabilities/runtime/product.js +1 -1
  144. package/dist/src/chat-commands/agent-edit.js +1 -1
  145. package/dist/src/cli/commands/agent.js +1 -1
  146. package/dist/src/cli/commands/agents.js +1 -1
  147. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  148. package/dist/src/cli/commands/models.js +1 -1
  149. package/dist/src/cli/commands/onboard/model.js +1 -1
  150. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  151. package/dist/src/config/agent-profile.js +2 -2
  152. package/dist/src/config/loader.js +1 -1
  153. package/dist/src/config/models-json.js +1 -1
  154. package/dist/src/config/schema.js +1 -1
  155. package/dist/src/connectors/connection-recovery-service.js +1 -1
  156. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  157. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  158. package/dist/src/gateway/agents-admin.js +2 -2
  159. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  160. package/dist/src/gateway/hono/routes/agent-stream.js +1 -1
  161. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  162. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  163. package/dist/src/gateway/hono/routes/context-sources.js +1 -1
  164. package/dist/src/gateway/hono/routes/notes.js +2 -2
  165. package/dist/src/gateway/hono/routes/projects.js +2 -2
  166. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -2
  167. package/dist/src/gateway/hono/routes/session-input-handler.js +2 -2
  168. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  169. package/dist/src/gateway/image-generation-setup.js +1 -1
  170. package/dist/src/gateway/lock.js +1 -1
  171. package/dist/src/gateway/media-access.js +1 -1
  172. package/dist/src/gateway/service/run-gateway-agent.js +20 -1
  173. package/dist/src/gateway/service/session-input-coordinator.js +2 -2
  174. package/dist/src/gateway/service.js +40 -9
  175. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  176. package/dist/src/home-intelligence/host.js +2 -2
  177. package/dist/src/local-apps/service.js +1 -1
  178. package/dist/src/media/session-references.js +1 -1
  179. package/dist/src/personal-agent/communication.js +1 -0
  180. package/dist/src/personal-agent/performance.d.ts +83 -0
  181. package/dist/src/personal-agent/performance.js +65 -0
  182. package/dist/src/personal-agent/policy.d.ts +1 -1
  183. package/dist/src/personal-agent/policy.js +1 -0
  184. package/dist/src/personal-agent/proactivity/service.js +1 -1
  185. package/dist/src/personal-agent/prompt-context.js +3 -1
  186. package/dist/src/personal-agent/prompts.js +6 -3
  187. package/dist/src/personal-agent/reply-composer.js +79 -8
  188. package/dist/src/personal-agent/request-delivery.js +3 -1
  189. package/dist/src/personal-agent/request-service.js +1 -1
  190. package/dist/src/personal-agent/result-extraction.d.ts +42 -0
  191. package/dist/src/personal-agent/result-extraction.js +209 -0
  192. package/dist/src/personal-agent/result-read-continuations.d.ts +13 -0
  193. package/dist/src/personal-agent/result-read-continuations.js +78 -0
  194. package/dist/src/personal-agent/result-reader.d.ts +43 -0
  195. package/dist/src/personal-agent/result-reader.js +461 -0
  196. package/dist/src/personal-agent/service.js +2 -2
  197. package/dist/src/providers/model-catalog-persistence.js +1 -1
  198. package/dist/src/routing/resolve-route.js +1 -1
  199. package/dist/src/routing/resolve-tui-session-key.js +1 -1
  200. package/dist/src/session/client-history.d.ts +1 -1
  201. package/dist/src/session/client-history.js +1 -1
  202. package/dist/src/session/session-context-for-llm.js +2 -0
  203. package/dist/src/share/hosted-session-share.js +1 -1
  204. package/dist/src/storage/sqlite/migrations/251_personal_result_reads.sql +40 -0
  205. package/dist/src/storage/sqlite/migrations/252_task_work_revisions.sql +15 -0
  206. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  207. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  208. package/dist/src/storage/sqlite/schema.js +1 -1
  209. package/dist/src/tasks/capabilities/read.js +2 -2
  210. package/dist/src/tasks/capabilities/write.js +1 -1
  211. package/dist/src/tasks/task-allocation-service.js +61 -10
  212. package/dist/src/tasks/task-application-service.d.ts +18 -0
  213. package/dist/src/tasks/task-application-service.js +131 -0
  214. package/dist/src/tasks/task-context-assembler.js +8 -5
  215. package/dist/src/tasks/task-contract-definition.d.ts +3 -0
  216. package/dist/src/tasks/task-contract-planner.js +50 -16
  217. package/dist/src/tasks/task-conversation-repository.js +1 -1
  218. package/dist/src/tasks/task-evidence-ranges.d.ts +7 -0
  219. package/dist/src/tasks/task-evidence-ranges.js +20 -0
  220. package/dist/src/tasks/task-execution-capabilities.d.ts +26 -0
  221. package/dist/src/tasks/task-execution-capabilities.js +117 -0
  222. package/dist/src/tasks/task-handoff-service.js +1 -1
  223. package/dist/src/tasks/task-handoff.d.ts +56 -0
  224. package/dist/src/tasks/task-handoff.js +510 -0
  225. package/dist/src/tasks/task-read-model-projector.d.ts +6 -0
  226. package/dist/src/tasks/task-read-model-projector.js +12 -1
  227. package/dist/src/tasks/task-research-repair.js +6 -2
  228. package/dist/src/tasks/task-research-result.d.ts +16 -2
  229. package/dist/src/tasks/task-research-result.js +123 -39
  230. package/dist/src/tasks/task-result-delivery-repository.js +26 -3
  231. package/dist/src/tasks/task-result-delivery-service.js +37 -9
  232. package/dist/src/tasks/task-run-coordinator.js +3 -1
  233. package/dist/src/tasks/task-run-dispatcher.d.ts +1 -0
  234. package/dist/src/tasks/task-run-dispatcher.js +2 -1
  235. package/dist/src/tui/backends/embedded-backend.js +2 -2
  236. package/dist/src/voice/realtime/persona-context.js +1 -1
  237. package/package.json +6 -4
  238. package/dist/gateway/static/root/assets/constants-CpWu0oHS.js +0 -1
  239. package/dist/gateway/static/root/assets/home-page-BtSy2hRV.js +0 -2
  240. package/dist/gateway/static/root/assets/index-B08iR7fT.js +0 -260
  241. package/dist/gateway/static/root/assets/local-session-drafts-D_tYFy7d.js +0 -1
  242. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-BTrk2wWv.js +0 -1
  243. package/dist/gateway/static/root/assets/product-open-page-aUoA-uPw.js +0 -1
  244. package/dist/gateway/static/root/assets/settings-advanced-gate-C4_gW1vw.js +0 -1
@@ -4,6 +4,7 @@ import { getAgentDefaultChatModelConfig, init_schema } from "../config/schema.js
4
4
  import { completeTaskModelCall } from "./task-model-call.js";
5
5
  import { defineTaskContract } from "./task-contract-definition.js";
6
6
  import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../personal-agent/communication.js";
7
+ import { EXECUTION_CAPABILITIES } from "./task-execution-capabilities.js";
7
8
  //#region src/tasks/task-contract-planner.ts
8
9
  init_schema();
9
10
  init_logger();
@@ -30,18 +31,36 @@ function strings(value, max) {
30
31
  function parseTaskContractResponse(raw) {
31
32
  const parsed = parseObject(raw);
32
33
  if (!parsed) return void 0;
34
+ if ([
35
+ "expectedOutputs",
36
+ "acceptanceCriteria",
37
+ "constraints",
38
+ "approvalRequired",
39
+ "assumptions",
40
+ "risks"
41
+ ].some((key) => parsed[key] !== void 0 && (!Array.isArray(parsed[key]) || parsed[key].some((value) => typeof value !== "string")))) return void 0;
33
42
  const objective = typeof parsed.objective === "string" ? parsed.objective.trim() : "";
34
43
  const expectedOutputs = strings(parsed.expectedOutputs, 8);
35
44
  const plannedCriteria = strings(parsed.acceptanceCriteria, 40);
36
45
  const writeBoundary = (criterion) => /(?:仅|只)(?:能)?写入|未(?:覆盖|修改).*其他文件|(?:write only|only write)|(?:not|never) (?:overwrite|modify).*other files/i.test(criterion);
37
- const acceptanceCriteria = plannedCriteria.filter((criterion) => !writeBoundary(criterion)).filter((criterion) => !(/publish_task_result/.test(criterion) && /调用|使用|提交|返回|检查|验收|call|submit|review/i.test(criterion) && !/报告.*(?:说明|描述)|文档.*(?:说明|描述)|(?:report|document).*describe/i.test(criterion)));
46
+ const deliveryPhrase = /最终(?:的)?(?:回复|答复)|交付说明(?:仅|只|中|不|未)|(?:final|future) (?:chat )?(?:reply|response)|(?:delivery|chat) (?:message|reply)/i;
47
+ const deliveryBoundary = (criterion) => deliveryPhrase.test(criterion);
48
+ const boundary = (criterion) => writeBoundary(criterion) || deliveryBoundary(criterion);
49
+ const acceptanceCriteria = plannedCriteria.filter((criterion) => !writeBoundary(criterion)).flatMap((criterion) => {
50
+ const position = criterion.search(deliveryPhrase);
51
+ if (position < 0) return [criterion];
52
+ const prefix = criterion.slice(0, position).replace(/[,,;;。\s]*(?:并且|且|并|and)?\s*$/i, "").trim();
53
+ return prefix && /运行|执行|发布|生成|校验|\b(?:run|execut|publish|generat|verif)/i.test(prefix) ? [prefix] : [];
54
+ }).filter((criterion) => !(/publish_task_result/.test(criterion) && /调用|使用|提交|返回|检查|验收|call|submit|review/i.test(criterion) && !/报告.*(?:说明|描述)|文档.*(?:说明|描述)|(?:report|document).*describe/i.test(criterion)));
38
55
  if (Array.isArray(parsed.acceptanceCriteria) && parsed.acceptanceCriteria.length > 40) return void 0;
39
56
  if (!objective || expectedOutputs.length === 0 || acceptanceCriteria.length === 0) return void 0;
57
+ if (parsed.requiredCapabilities !== void 0 && (!Array.isArray(parsed.requiredCapabilities) || parsed.requiredCapabilities.some((name) => typeof name !== "string" || !Object.hasOwn(EXECUTION_CAPABILITIES, name)))) return void 0;
40
58
  return {
41
59
  objective,
60
+ ...parsed.requiredCapabilities === void 0 ? {} : { requiredCapabilities: strings(parsed.requiredCapabilities, 6) },
42
61
  expectedOutputs,
43
62
  acceptanceCriteria,
44
- constraints: [...new Set([...strings(parsed.constraints, 10), ...plannedCriteria.filter(writeBoundary)])],
63
+ constraints: [...new Set([...strings(parsed.constraints, 10), ...plannedCriteria.filter(boundary)])],
45
64
  approvalRequired: strings(parsed.approvalRequired, 8),
46
65
  assumptions: strings(parsed.assumptions, 10),
47
66
  risks: strings(parsed.risks, 10)
@@ -51,9 +70,10 @@ var ModelTaskContractPlanner = class {
51
70
  async plan(input) {
52
71
  const fallback = defineTaskContract(input.objective, input.locale);
53
72
  try {
73
+ if ((input.taskContext?.length ?? 0) > 96e3) throw new Error("Task context exceeds planning budget");
54
74
  const models = getAgentDefaultChatModelConfig();
55
75
  if (!models) throw new Error("No default task planning model is configured");
56
- const planned = parseTaskContractResponse(extractText((await completeTaskModelCall(models, { messages: [{
76
+ const messages = [{
57
77
  role: "user",
58
78
  content: [
59
79
  "Define the smallest complete, verifiable contract for the user task.",
@@ -62,29 +82,43 @@ var ModelTaskContractPlanner = class {
62
82
  "Write boundaries and prohibitions on unrelated actions belong in constraints, not criteria requiring proof that no unobserved action ever occurred. Criteria may check the actual delivered output paths and unchanged supplied input bytes. Never remove an explicit scope restriction.",
63
83
  "Keep each criterion concise and concrete; do not repeat the full brief. Include all required deliverable conditions without splitting trivial wording into unnecessary items.",
64
84
  "Define criteria for the specialist deliverables only. Do not create self-referential criteria about calling publish_task_result, receiving this review, or what a future Personal Agent reply will say. Those are runtime delivery checks, evaluated after completion. Keep source support, calculations, completeness and requested limitations as separate criteria. User-specified files and content remain required.",
85
+ "requiredCapabilities is a minimal subset of read_input, execute_code, publish_files, web_research, browser, generate_image. Include only operations necessary for the requested inputs/outputs; this list selects registered tools and grants no permissions. Do not require browser when ordinary web fetch suffices. Preserve explicit executor/Skill and scope constraints.",
65
86
  "List assumptions explicitly. Put only irreversible, external, financial, privacy, or permission decisions in approvalRequired.",
66
- "Return one JSON object only with keys: objective, expectedOutputs, acceptanceCriteria, constraints, approvalRequired, assumptions, risks.",
87
+ "Return one JSON object only. Every array contains flat strings, never objects or nested arrays. Schema example: {\"objective\":\"Deliver the requested work\",\"expectedOutputs\":[\"report.md\"],\"acceptanceCriteria\":[\"report.md contains the requested evidence\"],\"constraints\":[],\"approvalRequired\":[],\"assumptions\":[],\"risks\":[],\"requiredCapabilities\":[\"read_input\",\"publish_files\"]}. Capabilities must use the allowed enum values.",
67
88
  input.locale ? `Write all user-facing JSON values in ${input.locale === "zh" ? "Simplified Chinese" : "English"}. Preserve schema keys, identifiers, paths, and proper nouns.` : "Write all user-facing JSON values in the language of the user request, regardless of the language of project or attached context. Preserve schema keys and identifiers.",
68
89
  "",
69
90
  `User request:\n${input.objective.trim()}`,
70
- input.taskContext ? `\nUser-provided task context:\n${input.taskContext.replace(PERSONAL_WORKER_RESULT_GUIDANCE, "").trim().slice(0, 16e3)}` : "",
91
+ input.taskContext ? `\nUser-provided task context:\n${input.taskContext.replace(PERSONAL_WORKER_RESULT_GUIDANCE, "").trim()}` : "",
71
92
  input.projectContext ? `\nProject context:\n${input.projectContext.slice(0, 8e3)}` : "",
72
93
  input.userContext ? `\nUser context:\n${input.userContext.slice(0, 8e3)}` : ""
73
94
  ].join("\n"),
74
95
  timestamp: Date.now()
75
- }] }, {
76
- maxTokens: 4e3,
77
- temperature: 0,
78
- signal: input.signal
79
- }, { operation: "task.plan_contract" })).content));
80
- if (!planned) throw new Error("Task planning response did not contain a verifiable contract");
81
- return {
82
- ...planned,
83
- objective: fallback.objective
84
- };
96
+ }];
97
+ for (let attempt = 0; attempt < 2; attempt++) {
98
+ input.signal?.throwIfAborted();
99
+ const planned = parseTaskContractResponse(extractText((await completeTaskModelCall(models, { messages }, {
100
+ maxTokens: 4e3,
101
+ temperature: 0,
102
+ signal: input.signal
103
+ }, { operation: "task.plan_contract" })).content));
104
+ if (planned?.requiredCapabilities) return {
105
+ ...planned,
106
+ objective: fallback.objective,
107
+ capabilityPlanning: "complete"
108
+ };
109
+ if (attempt === 0) messages.push({
110
+ role: "user",
111
+ timestamp: Date.now(),
112
+ content: "Your previous response did not match the required schema. Return the same task contract as one JSON object. expectedOutputs, acceptanceCriteria, constraints, approvalRequired, assumptions and risks must be flat string arrays, never objects. requiredCapabilities must be an array drawn only from read_input, execute_code, publish_files, web_research, browser, generate_image. Keep all user constraints; do not add criteria about a future chat reply. Return no commentary."
113
+ });
114
+ }
115
+ throw new Error("Task planning response did not contain a verifiable contract and operation requirements");
85
116
  } catch (err) {
86
117
  log.warn({ err }, "Task contract planning fell back to deterministic criteria");
87
- return fallback;
118
+ return {
119
+ ...fallback,
120
+ capabilityPlanning: "unavailable"
121
+ };
88
122
  }
89
123
  }
90
124
  };
@@ -91,7 +91,7 @@ var TaskConversationRepository = class {
91
91
  const existing = db.prepare("SELECT * FROM task_conversation_state WHERE task_id = ?").get(input.taskId);
92
92
  const current = db.prepare(`SELECT * FROM task_sessions
93
93
  WHERE task_id = ? AND role = 'execution' AND status = 'active'`).get(input.taskId);
94
- const sameSession = current?.conversation_id === input.conversationId;
94
+ const sameSession = current?.conversation_id === input.conversationId && (!input.runId || current.run_id === input.runId);
95
95
  const assignmentEpoch = sameSession ? current.assignment_epoch : (existing?.assignment_epoch ?? 0) + 1;
96
96
  if (!sameSession) db.prepare(`UPDATE task_sessions SET status = 'superseded', ended_at = ?
97
97
  WHERE task_id = ? AND role = 'execution' AND status = 'active'`).run(now, input.taskId);
@@ -0,0 +1,7 @@
1
+ export type EvidenceRange = {
2
+ start: number;
3
+ end: number;
4
+ };
5
+ /** Offsets are Unicode code points into a persisted successful tool result, never the input command. */
6
+ export declare function observedEvidenceExcerpt(body: string, range: EvidenceRange): string;
7
+ export declare function suggestedEvidenceRanges(body: string): EvidenceRange[];
@@ -0,0 +1,20 @@
1
+ //#region src/tasks/task-evidence-ranges.ts
2
+ /** Offsets are Unicode code points into a persisted successful tool result, never the input command. */
3
+ function observedEvidenceExcerpt(body, range) {
4
+ const points = Array.from(body);
5
+ if (!Number.isInteger(range.start) || !Number.isInteger(range.end) || range.start < 0 || range.end <= range.start || range.end > points.length || range.end - range.start > 1e3) throw new Error("Evidence range must select 1..1000 observed Unicode characters within the successful read");
6
+ return points.slice(range.start, range.end).join("");
7
+ }
8
+ function suggestedEvidenceRanges(body) {
9
+ const length = Array.from(body).length;
10
+ if (!length) return [];
11
+ return [{
12
+ start: 0,
13
+ end: Math.min(1e3, length)
14
+ }, ...length > 1e3 ? [{
15
+ start: Math.max(1e3, length - 1e3),
16
+ end: length
17
+ }] : []];
18
+ }
19
+ //#endregion
20
+ export { observedEvidenceExcerpt, suggestedEvidenceRanges };
@@ -0,0 +1,26 @@
1
+ import type { SpecialistTaskRequirements } from '@xopcai/gateway-contract';
2
+ import { type MatchingContext, type SpecialistAssessment } from '../agent-matching/service.js';
3
+ import { type TaskAggregate } from './task-repository.js';
4
+ export declare const EXECUTION_CAPABILITIES: {
5
+ readonly read_input: readonly ["read_file", "read_media", "exec_command"];
6
+ readonly execute_code: readonly ["exec_command"];
7
+ readonly publish_files: readonly ["publish_artifacts"];
8
+ readonly web_research: readonly ["web_fetch", "browser_use"];
9
+ readonly browser: readonly ["browser_use"];
10
+ readonly generate_image: readonly ["image_generate"];
11
+ };
12
+ export type ExecutionCapability = keyof typeof EXECUTION_CAPABILITIES;
13
+ export interface ExecutionRequirement {
14
+ capability: ExecutionCapability;
15
+ source: 'structured_input' | 'background_inference';
16
+ reason: string;
17
+ }
18
+ export declare function taskExecutionRequirements(task: TaskAggregate, requirements: SpecialistTaskRequirements, inferred?: ExecutionCapability[]): ExecutionRequirement[];
19
+ export declare function assessTaskExecutor(agentId: string, requirements: SpecialistTaskRequirements, needs: ExecutionRequirement[], context: MatchingContext, taskId?: string): SpecialistAssessment;
20
+ export declare function captureExecutionRequirements(task: TaskAggregate, requirements: SpecialistTaskRequirements, needs: ExecutionRequirement[]): void;
21
+ export declare function savedExecutionRequirements(taskId: string): {
22
+ requirements: SpecialistTaskRequirements;
23
+ needs: ExecutionRequirement[];
24
+ contractVersion: number;
25
+ } | undefined;
26
+ export declare function assertTaskExecutorReady(taskId: string, originConversationId: string, agentId: string, context: MatchingContext): void;
@@ -0,0 +1,117 @@
1
+ import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transaction.js";
2
+ import { TaskRepository, init_task_repository } from "./task-repository.js";
3
+ import { TaskContextRepository } from "./task-context-repository.js";
4
+ import { assertTaskHandoffExecutorAccess } from "./task-handoff.js";
5
+ import { assessSpecialist } from "../agent-matching/service.js";
6
+ import { personalCapabilities } from "../personal-agent/capability-service.js";
7
+ //#region src/tasks/task-execution-capabilities.ts
8
+ init_transaction();
9
+ init_task_repository();
10
+ const EXECUTION_CAPABILITIES = {
11
+ read_input: [
12
+ "read_file",
13
+ "read_media",
14
+ "exec_command"
15
+ ],
16
+ execute_code: ["exec_command"],
17
+ publish_files: ["publish_artifacts"],
18
+ web_research: ["web_fetch", "browser_use"],
19
+ browser: ["browser_use"],
20
+ generate_image: ["image_generate"]
21
+ };
22
+ function taskExecutionRequirements(task, requirements, inferred = []) {
23
+ const needs = /* @__PURE__ */ new Map();
24
+ const add = (capability, source, reason) => needs.set(capability, {
25
+ capability,
26
+ source,
27
+ reason
28
+ });
29
+ for (const capability of inferred) if (capability in EXECUTION_CAPABILITIES) add(capability, "background_inference", "Minimal operation inferred by the background contract planner; no authority granted");
30
+ if (requirements.inputKinds?.some((kind) => /^(csv|xlsx|pdf|docx|pptx|file|document|spreadsheet|text)$/.test(kind))) add("read_input", "structured_input", "Structured file input requires a registered reader or execution tool");
31
+ if (requirements.outputKinds?.some((kind) => /^(file|pdf|docx|pptx|xlsx|csv|spreadsheet|document)$/.test(kind))) add("publish_files", "structured_input", "Requested file output requires publication");
32
+ if (requirements.inputKinds?.some((kind) => /^(pdf|docx|pptx|xlsx)$/.test(kind))) add("execute_code", "structured_input", "Binary input requires an executable parser; text readers alone do not establish binary processing capability");
33
+ if (!requirements.connector && (task.body?.length ?? 0) > 12e3) requirements.requiredTools = [...new Set([...requirements.requiredTools ?? [], "task_collaboration"])];
34
+ return [...needs.values()];
35
+ }
36
+ function assessTaskExecutor(agentId, requirements, needs, context, taskId) {
37
+ const assessment = assessSpecialist(agentId, requirements, context);
38
+ for (const need of needs) {
39
+ const options = EXECUTION_CAPABILITIES[need.capability].map((tool) => assessSpecialist(agentId, {
40
+ ...requirements,
41
+ requiredSkills: [],
42
+ requiredTools: [tool]
43
+ }, context));
44
+ const available = options.find((option) => option.checks.some((check) => check.condition.startsWith("tool:") && check.state === "verified"));
45
+ assessment.checks.push({
46
+ condition: `capability:${need.capability}`,
47
+ state: available ? "verified" : "blocked",
48
+ reasonCode: available ? "registered_operation_available" : "required_operation_unavailable",
49
+ detail: available ? available.checks.find((check) => check.condition.startsWith("tool:"))?.condition : JSON.stringify(options.flatMap((option) => option.checks.filter((check) => check.condition.startsWith("tool:"))))
50
+ });
51
+ }
52
+ if (taskId) try {
53
+ assertTaskHandoffExecutorAccess(taskId, agentId);
54
+ } catch (error) {
55
+ assessment.checks.push({
56
+ condition: "source_authorization",
57
+ state: "blocked",
58
+ reasonCode: "selected_source_unavailable",
59
+ detail: error instanceof Error ? error.message : String(error)
60
+ });
61
+ }
62
+ assessment.eligibility = assessment.checks.some((check) => check.state === "blocked") ? "blocked" : assessment.checks.some((check) => check.state === "unknown") ? "needs_verification" : "eligible";
63
+ return assessment;
64
+ }
65
+ function captureExecutionRequirements(task, requirements, needs) {
66
+ new TaskContextRepository().captureSnapshot({
67
+ ownerKind: "task",
68
+ ownerId: task.id,
69
+ query: task.contract?.objective ?? task.title,
70
+ relationshipPolicy: {
71
+ kind: "task_execution_requirements",
72
+ contractVersion: task.latestContractVersion
73
+ },
74
+ selectedItems: [{
75
+ requirements,
76
+ needs,
77
+ contractVersion: task.latestContractVersion,
78
+ requirementOrigins: {
79
+ requestedAgentId: "provided_requirement",
80
+ requiredSkills: "provided_requirement",
81
+ requiredTools: "provided_requirement_or_host_bounded_reader",
82
+ acceptanceCriteria: "current_contract"
83
+ }
84
+ }],
85
+ authorizationSnapshot: {
86
+ expandsAuthority: false,
87
+ liveRecheckRequired: true
88
+ }
89
+ });
90
+ }
91
+ function savedExecutionRequirements(taskId) {
92
+ const row = getSqliteDatabase().prepare(`SELECT selected_items_json FROM context_snapshots
93
+ WHERE owner_kind = 'task' AND owner_id = ? AND json_extract(relationship_policy_json, '$.kind') = 'task_execution_requirements'
94
+ ORDER BY created_at DESC, rowid DESC LIMIT 1`).get(taskId);
95
+ return row ? JSON.parse(row.selected_items_json)[0] : void 0;
96
+ }
97
+ function assertTaskExecutorReady(taskId, originConversationId, agentId, context) {
98
+ const saved = savedExecutionRequirements(taskId);
99
+ if (!saved) return;
100
+ if (new TaskRepository().require(taskId).latestContractVersion !== saved.contractVersion) throw new Error("Task contract changed after capability validation; reallocate before execution");
101
+ const connector = saved.requirements.connector;
102
+ if (connector) {
103
+ const permitted = personalCapabilities(originConversationId, connector.connectorId, connector.accountId).some((capability) => capability.status === "ready" && capability.accounts.some((account) => account.accountId === connector.accountId && account.executorAgentIds.includes(agentId)));
104
+ context = {
105
+ ...context,
106
+ checkConnector: () => ({
107
+ condition: "connector",
108
+ state: permitted ? "verified" : "blocked",
109
+ reasonCode: permitted ? "account_authorized" : "account_unavailable"
110
+ })
111
+ };
112
+ }
113
+ const fresh = assessTaskExecutor(agentId, saved.requirements, saved.needs, context, taskId);
114
+ if (fresh.eligibility !== "eligible") throw new Error(`Task executor capability changed: ${JSON.stringify(fresh.checks.filter((check) => ["blocked", "unknown"].includes(check.state)))}`);
115
+ }
116
+ //#endregion
117
+ export { EXECUTION_CAPABILITIES, assertTaskExecutorReady, assessTaskExecutor, captureExecutionRequirements, savedExecutionRequirements, taskExecutionRequirements };
@@ -2,9 +2,9 @@ import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
3
  import { TaskRepository, init_task_repository } from "./task-repository.js";
4
4
  import { TaskRunRepository, init_task_run_repository } from "./task-run-repository.js";
5
+ import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
5
6
  import { normalizeAgentId } from "../agent-catalog/id.js";
6
7
  import { init_agent_scope, listAgentEntries } from "../agent/agent-scope.js";
7
- import { init_session_key, resolveConversationId, sanitizeSegment } from "../routing/session-key.js";
8
8
  import { TaskConversationRepository } from "./task-conversation-repository.js";
9
9
  import { TaskContextRepository } from "./task-context-repository.js";
10
10
  //#region src/tasks/task-handoff-service.ts
@@ -0,0 +1,56 @@
1
+ import { type TurnContextRef } from '../agent/source-context/types.js';
2
+ import type { Config } from '../config/schema.js';
3
+ import { type PersonalResultInput } from '../personal-agent/result-reader.js';
4
+ export interface TaskHandoff {
5
+ version: 1;
6
+ conversationId: string;
7
+ transcriptId: string;
8
+ inputId?: string;
9
+ originalRequest?: string;
10
+ interpretation: string;
11
+ baseline: {
12
+ contractVersion: number;
13
+ assignmentEpoch: number;
14
+ instructionSequence: number;
15
+ };
16
+ sources: Array<{
17
+ kind: string;
18
+ sourceId: string;
19
+ version: string;
20
+ title: string;
21
+ text: string;
22
+ truncated: boolean;
23
+ representation?: 'text' | 'metadata' | 'directory';
24
+ purpose: string;
25
+ contentHash: string;
26
+ }>;
27
+ requestedSources?: TurnContextRef[];
28
+ attachments: unknown[];
29
+ completeness: {
30
+ originalInput: 'captured' | 'unavailable';
31
+ omitted: string[];
32
+ unresolvedReferences: string[];
33
+ };
34
+ }
35
+ /** Normalize model-facing references without fetching any source on the submission path. */
36
+ export declare function parseTaskHandoffReferences(raw: unknown): TurnContextRef[] | null;
37
+ /** Called inside task.create's transaction; no discovery, parsing or remote IO. */
38
+ export declare function captureTaskHandoff(taskId: string, conversationId: string, interpretation: string, references?: TurnContextRef[]): void;
39
+ export declare function getTaskHandoff(taskId: string): TaskHandoff | undefined;
40
+ export declare function assertTaskHandoffAccess(handoff: TaskHandoff): void;
41
+ /** Selected result pointers delegate only the pinned source, never the owner's result directory. */
42
+ export declare function readTaskHandoffSource(taskId: string, sourceIndex: number, input: PersonalResultInput, config?: Config): Promise<Record<string, unknown>>;
43
+ /** Resolve the main Agent's selected history pointers only after the foreground commit. */
44
+ export declare function resolveTaskHandoffReferences(taskId: string, config?: Config): Promise<TaskHandoff | undefined>;
45
+ /** Copy only the selected pinned input into this executor's workspace, without granting access to the owner's root. */
46
+ export declare function materializeTaskHandoffFile(taskId: string, sourceIndex: number, workspace: string, config: Config): Promise<{
47
+ materialized: boolean;
48
+ sourceId: string;
49
+ version: string;
50
+ readOnlyPath: string;
51
+ executionInputRoot: string;
52
+ sha256: string;
53
+ bytes: number;
54
+ scope: string;
55
+ }>;
56
+ export declare function assertTaskHandoffExecutorAccess(taskId: string, agentId: string): void;