@xopcai/xopc 0.0.383 → 0.0.384

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 (492) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/feishu/src/adapters/cli-login.js +3 -3
  3. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  4. package/dist/extensions/telegram/src/inbound-processor.js +2 -2
  5. package/dist/extensions/telegram/src/outbound-sender.js +1 -1
  6. package/dist/extensions/telegram/src/plugin.js +2 -2
  7. package/dist/extensions/telegram/xopc.extension.json +1 -1
  8. package/dist/extensions/weixin/src/api/api.js +2 -2
  9. package/dist/extensions/weixin/src/auth/accounts.js +12 -12
  10. package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
  11. package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
  12. package/dist/gateway/static/root/assets/{activity-store-qv0XyrXk.js → activity-store-CB2X4Gmu.js} +1 -1
  13. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-66HwhyEK.js → agent-avatar-dicebear-BSel9yf8.js} +1 -1
  14. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DgHMyhuY.js +1 -0
  15. package/dist/gateway/static/root/assets/{agent-plugin-dialog-CebTVaRM.js → agent-plugin-dialog-BosuN4dO.js} +1 -1
  16. package/dist/gateway/static/root/assets/agents-B-pw5RKI.js +77 -0
  17. package/dist/gateway/static/root/assets/{agents-admin-api-BGy9IvSr.js → agents-admin-api-BkULgC6Q.js} +1 -1
  18. package/dist/gateway/static/root/assets/{app-management-settings-panel-BKaU6sGT.js → app-management-settings-panel-DuOqKkfH.js} +1 -1
  19. package/dist/gateway/static/root/assets/{appearance-settings-E5WFcCdZ.js → appearance-settings-8JF9rXFr.js} +1 -1
  20. package/dist/gateway/static/root/assets/{apps-page-CExfOhRj.js → apps-page-Cuclpk0A.js} +1 -1
  21. package/dist/gateway/static/root/assets/{archive-plugin-BvhxzyLJ.js → archive-plugin-De0ND0oA.js} +1 -1
  22. package/dist/gateway/static/root/assets/{automations-page-CWcNFzvK.js → automations-page-D7NwNy2I.js} +1 -1
  23. package/dist/gateway/static/root/assets/automations-workspace-CSxW4wX0.js +6 -0
  24. package/dist/gateway/static/root/assets/{binary-plugins-CD0gYKR2.js → binary-plugins-Do535ZGW.js} +1 -1
  25. package/dist/gateway/static/root/assets/{block-editor-CBVXeGAt.js → block-editor-Dnb7CH_l.js} +2 -2
  26. package/dist/gateway/static/root/assets/{browser-automation-inputs-B-Qz_411.js → browser-automation-inputs-B9M1RYTm.js} +1 -1
  27. package/dist/gateway/static/root/assets/browser-automations-page-GBgDe21o.js +3 -0
  28. package/dist/gateway/static/root/assets/browser-settings-page-B2FXaO3n.js +3 -0
  29. package/dist/gateway/static/root/assets/{capabilities-w2GUuF7V.js → capabilities-2Do3eKMM.js} +1 -1
  30. package/dist/gateway/static/root/assets/{capabilities-CaL5RDm3.js → capabilities-XFwwUNU3.js} +1 -1
  31. package/dist/gateway/static/root/assets/capabilities-page-f2-MquJn.js +2 -0
  32. package/dist/gateway/static/root/assets/{capabilities-settings-panel-CIvwbZps.js → capabilities-settings-panel-D9F0mw16.js} +6 -6
  33. package/dist/gateway/static/root/assets/{capability-header-actions-DKaZAOWW.js → capability-header-actions-DVRxJPQP.js} +1 -1
  34. package/dist/gateway/static/root/assets/{channels-D82wgP8A.js → channels-CnDm5T1t.js} +1 -1
  35. package/dist/gateway/static/root/assets/{chat-terminal-dock-DuqWzcEq.js → chat-terminal-dock-BxSCDbK7.js} +2 -2
  36. package/dist/gateway/static/root/assets/{computer-settings-page-BiM0fCvO.js → computer-settings-page-DVAB-kQw.js} +1 -1
  37. package/dist/gateway/static/root/assets/{connector-service-page-o8kuXjVt.js → connector-service-page-D2EeLXei.js} +1 -1
  38. package/dist/gateway/static/root/assets/connectors-page-DK9n4hgZ.js +1 -0
  39. package/dist/gateway/static/root/assets/{date-picker-5tzjG3n1.js → date-picker-Cl9KfFj8.js} +1 -1
  40. package/dist/gateway/static/root/assets/{dependency-picker-DLcDUyep.js → dependency-picker-Ei6aX5WM.js} +1 -1
  41. package/dist/gateway/static/root/assets/{desktop-pet-D-w8487x.js → desktop-pet-4Evl4RKX.js} +1 -1
  42. package/dist/gateway/static/root/assets/{desktop-pet-settings-D-w7uF8Q.js → desktop-pet-settings-DAD_OWcX.js} +1 -1
  43. package/dist/gateway/static/root/assets/device-pairing-wizard-BA21epMn.js +1 -0
  44. package/dist/gateway/static/root/assets/{directory-picker-path-field-B7d2s14w.js → directory-picker-path-field-B_Zb5nNR.js} +1 -1
  45. package/dist/gateway/static/root/assets/{extension-debug-page-sntm2YRN.js → extension-debug-page-DtHNy4TE.js} +1 -1
  46. package/dist/gateway/static/root/assets/{extension-page-CPbWA4Oy.js → extension-page-8gWSThWP.js} +1 -1
  47. package/dist/gateway/static/root/assets/{extension-provider-CnDGKMN6.js → extension-provider-nbgU7xBS.js} +1 -1
  48. package/dist/gateway/static/root/assets/{extension-settings-page-PAHKn-Az.js → extension-settings-page-CunUbB09.js} +1 -1
  49. package/dist/gateway/static/root/assets/{fallback-models-BJaSQNiV.js → fallback-models-BSAfzXby.js} +1 -1
  50. package/dist/gateway/static/root/assets/{gateway-config-swr-DIhXgHH-.js → gateway-config-swr-D0tBjSgj.js} +1 -1
  51. package/dist/gateway/static/root/assets/{gateway-realtime-BkgWeVUQ.js → gateway-realtime-BnHraJ3O.js} +1 -1
  52. package/dist/gateway/static/root/assets/gateway-realtime-store-BVriF6Zj.js +1 -0
  53. package/dist/gateway/static/root/assets/gateway-settings-CN-2229W.js +1 -0
  54. package/dist/gateway/static/root/assets/{gateway-startup-retry-DnXc9GNb.js → gateway-startup-retry-C1DQsIH3.js} +1 -1
  55. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-Cw_HUlEk.js → highlighted-body-KQOG7T2V-DktBCtHF.js} +1 -1
  56. package/dist/gateway/static/root/assets/home-page-CUJcNW3H.js +2 -0
  57. package/dist/gateway/static/root/assets/{image-generation-api-4dtNAW64.js → image-generation-api-DodU6GNC.js} +1 -1
  58. package/dist/gateway/static/root/assets/{imports-page-DVvyrYUy.js → imports-page-DQm1MNNC.js} +1 -1
  59. package/dist/gateway/static/root/assets/{index-B-wZyMBY.js → index-BPNL54bv.js} +110 -110
  60. package/dist/gateway/static/root/assets/{index-BvOYtdnP.css → index-yseLAt9D.css} +1 -1
  61. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DywXmCvO.js → keyboard-shortcuts-settings-DaC5YjuJ.js} +1 -1
  62. package/dist/gateway/static/root/assets/{local-app-workbench-page-dBlBepLG.js → local-app-workbench-page-DwQyyo7a.js} +1 -1
  63. package/dist/gateway/static/root/assets/{local-apps-page-DdEXqsZw.js → local-apps-page-CpZhivpf.js} +1 -1
  64. package/dist/gateway/static/root/assets/{local-session-drafts-D-_OuGWH.js → local-session-drafts-D_tYFy7d.js} +1 -1
  65. package/dist/gateway/static/root/assets/{locale-store-BNDrBt2C.js → locale-store-uRu_DsWm.js} +1 -1
  66. package/dist/gateway/static/root/assets/{logs-page-DpSob5Id.js → logs-page-Db43nh1M.js} +2 -2
  67. package/dist/gateway/static/root/assets/{management-settings-10Vl7gLU.js → management-settings-DrKejBEZ.js} +1 -1
  68. package/dist/gateway/static/root/assets/markdown-view-Ct4sKkUf.css +1 -0
  69. package/dist/gateway/static/root/assets/{markdown-view-pEV4TIPK.js → markdown-view-DHfQAvZQ.js} +1 -1
  70. package/dist/gateway/static/root/assets/{media-plugins-DU1Ike3m.js → media-plugins-BombFqsX.js} +1 -1
  71. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-C4VzqE9z.js +1 -0
  72. package/dist/gateway/static/root/assets/messages-DTqbfje6.js +3 -0
  73. package/dist/gateway/static/root/assets/{models-hub-cache-Lp4PAH-A.js → models-hub-cache-Ct6X5zmB.js} +1 -1
  74. package/dist/gateway/static/root/assets/note-detail-panel-a8NSwmmW.js +5 -0
  75. package/dist/gateway/static/root/assets/{notes-api-B_LGV8Lh.js → notes-api-nqN2wKYc.js} +1 -1
  76. package/dist/gateway/static/root/assets/notes-page-BKRke43F.js +8 -0
  77. package/dist/gateway/static/root/assets/{page-context-capture-button-DzkU3HrQ.js → page-context-capture-button-DUaMkmxv.js} +1 -1
  78. package/dist/gateway/static/root/assets/page-tabs-HLrKIjXH.js +1 -0
  79. package/dist/gateway/static/root/assets/personal-page-BqF-HHw1.js +1 -0
  80. package/dist/gateway/static/root/assets/{product-open-page-Dbs3Xtis.js → product-open-page-GrhtTQIz.js} +1 -1
  81. package/dist/gateway/static/root/assets/{product-preview-content-x-EvUxt7.js → product-preview-content-zdP7gN0y.js} +1 -1
  82. package/dist/gateway/static/root/assets/project-detail-page-9Vd_AqDW.js +1 -0
  83. package/dist/gateway/static/root/assets/{projects-page-CSahay3I.js → projects-page-DGunhjoM.js} +1 -1
  84. package/dist/gateway/static/root/assets/{registry-api-DX5EhiBp.js → registry-api-CYqA7bfl.js} +1 -1
  85. package/dist/gateway/static/root/assets/remote-access-hub-BoRsF3Lx.js +1 -0
  86. package/dist/gateway/static/root/assets/{runtime-tools-api-DYeTxrEb.js → runtime-tools-api-zzoxjSuR.js} +1 -1
  87. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DbuAW7ky.js → runtime-tools-settings-panel-W0HDm--J.js} +1 -1
  88. package/dist/gateway/static/root/assets/{scenes-page-DVzrw6Q9.js → scenes-page-CYsFOfVJ.js} +2 -2
  89. package/dist/gateway/static/root/assets/{schema-form-Ch-wK0Os.js → schema-form-CBxEbBQq.js} +1 -1
  90. package/dist/gateway/static/root/assets/{send-session-input-BKIg9cjN.js → send-session-input-BCAF-Ikt.js} +1 -1
  91. package/dist/gateway/static/root/assets/{session-api-Cf3ACMv7.js → session-api-CzVTrG8n.js} +1 -1
  92. package/dist/gateway/static/root/assets/{session-manager-Djtcwo3n.js → session-manager-_yy4bxhT.js} +1 -1
  93. package/dist/gateway/static/root/assets/sessions-page-Dthfx_vc.js +1 -0
  94. package/dist/gateway/static/root/assets/settings-advanced-gate-O_0Lk38S.js +1 -0
  95. package/dist/gateway/static/root/assets/{settings-page-D-Uz-C5u.js → settings-page-CFs-WP_2.js} +1 -1
  96. package/dist/gateway/static/root/assets/setup-status-panel-D2-9fXYL.js +1 -0
  97. package/dist/gateway/static/root/assets/{share-link-dialog-Cke8qSIS.js → share-link-dialog-C47Xgzta.js} +1 -1
  98. package/dist/gateway/static/root/assets/{share-preview-page-CQjfWJVh.js → share-preview-page-nJ2FWAEP.js} +1 -1
  99. package/dist/gateway/static/root/assets/{shares-api-CQapohsa.js → shares-api-B0HlMAzi.js} +1 -1
  100. package/dist/gateway/static/root/assets/shares-settings-DTb88RHD.js +1 -0
  101. package/dist/gateway/static/root/assets/{skill-api-v1XR_zqL.js → skill-api-DJ8UBsxq.js} +1 -1
  102. package/dist/gateway/static/root/assets/{skill-reload-api-CPW9mIZH.js → skill-reload-api-CEJx5rPd.js} +1 -1
  103. package/dist/gateway/static/root/assets/{skills-page-Cu80KslP.js → skills-page-DjbBOikT.js} +1 -1
  104. package/dist/gateway/static/root/assets/specialists-4bkS5rZ4.js +1 -0
  105. package/dist/gateway/static/root/assets/{system-settings-panel-CbIHO53w.js → system-settings-panel-Dt5GkLhM.js} +1 -1
  106. package/dist/gateway/static/root/assets/{task-detail-page-DvRLEt8e.js → task-detail-page-88EShcbs.js} +2 -2
  107. package/dist/gateway/static/root/assets/{task-expandable-content-CQ9Y17UE.js → task-expandable-content-CF6Bj-Qa.js} +1 -1
  108. package/dist/gateway/static/root/assets/tasks-DJIeIk9C.js +1 -0
  109. package/dist/gateway/static/root/assets/{theme-store-BNDzgUPq.js → theme-store-BUfzeDvL.js} +1 -1
  110. package/dist/gateway/static/root/assets/{tracing-settings-page-DbbQg2I5.js → tracing-settings-page-C2q5B3Kp.js} +1 -1
  111. package/dist/gateway/static/root/assets/{tunnel-api-CQXrU_XI.js → tunnel-api-JHttXi63.js} +1 -1
  112. package/dist/gateway/static/root/assets/{usage-page-BdLt6u0c.js → usage-page-B3rUa0fW.js} +1 -1
  113. package/dist/gateway/static/root/assets/{use-autosave-CFn9aZYy.js → use-autosave-DgbCgsao.js} +1 -1
  114. package/dist/gateway/static/root/assets/{use-composer-attachments-DXCEME1D.js → use-composer-attachments-BFP3k6oC.js} +1 -1
  115. package/dist/gateway/static/root/assets/{use-file-preview-expanded-CEB7pfWq.js → use-file-preview-expanded-B1BiTQNS.js} +2 -2
  116. package/dist/gateway/static/root/assets/user-model-page-Cq1VSsZw.js +2 -0
  117. package/dist/gateway/static/root/assets/{voice-api-key-field-C9s0iBGA.js → voice-api-key-field-4AIkbm9R.js} +1 -1
  118. package/dist/gateway/static/root/assets/{voice-config-api-BIm_aTqX.js → voice-config-api-Kw1pYlLN.js} +1 -1
  119. package/dist/gateway/static/root/assets/{work-discovery-overlay-C3KsL1Ap.js → work-discovery-overlay-BAtG_JHv.js} +1 -1
  120. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CEx_jYPu.js → workflow-run-setup-panel-Cw12NFgx.js} +2 -2
  121. package/dist/gateway/static/root/assets/{workflows-page-BYGPnFEF.js → workflows-page-kR5ouOuM.js} +3 -3
  122. package/dist/gateway/static/root/assets/{workspace-api-uZFF1SlQ.js → workspace-api-Xr3wz8T3.js} +2 -2
  123. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DcPFuTIk.js → xopc-cloud-account-card-BTBVKpSg.js} +1 -1
  124. package/dist/gateway/static/root/index.html +30 -29
  125. package/dist/package.js +1 -1
  126. package/dist/packages/gateway-contract/src/index.js +1 -1
  127. package/dist/packages/gateway-contract/src/task-lifecycle.js +3 -0
  128. package/dist/packages/gateway-contract/src/tasks.js +41 -10
  129. package/dist/src/agent/agent-manager.d.ts +6 -0
  130. package/dist/src/agent/agent-manager.js +18 -15
  131. package/dist/src/agent/agent-scope.js +2 -2
  132. package/dist/src/agent/background-review/prompts.js +1 -1
  133. package/dist/src/agent/background-review/run-background-review.js +10 -10
  134. package/dist/src/agent/coding/repository-instructions.js +1 -1
  135. package/dist/src/agent/context/coordinator.js +2 -2
  136. package/dist/src/agent/context/execution-context.js +4 -4
  137. package/dist/src/agent/context/execution-scope.js +1 -1
  138. package/dist/src/agent/context/project-context.js +3 -3
  139. package/dist/src/agent/data-acquisition/service.js +1 -1
  140. package/dist/src/agent/embedded/codemode-extension.js +1 -1
  141. package/dist/src/agent/embedded/index.js +1 -1
  142. package/dist/src/agent/embedded/run-for-session.js +6 -6
  143. package/dist/src/agent/embedded/run-turn.js +12 -12
  144. package/dist/src/agent/embedded/session-runner.js +3 -3
  145. package/dist/src/agent/embedded/session-tool-result-guard.js +2 -2
  146. package/dist/src/agent/embedded/tool-result-truncation.js +1 -1
  147. package/dist/src/agent/external-tools/cliProvider.js +3 -3
  148. package/dist/src/agent/external-tools/composio-provider.js +3 -3
  149. package/dist/src/agent/external-tools/endpoint-provider.js +4 -4
  150. package/dist/src/agent/external-tools/gateway-tools.js +2 -2
  151. package/dist/src/agent/external-tools/index.js +1 -1
  152. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  153. package/dist/src/agent/image/generation/runtime.js +1 -1
  154. package/dist/src/agent/image/index.js +1 -1
  155. package/dist/src/agent/image/load-image-media.js +1 -1
  156. package/dist/src/agent/image/tool-model-config.js +1 -1
  157. package/dist/src/agent/inbound/attachment-pipeline.js +2 -2
  158. package/dist/src/agent/inbound/inbound-loop.js +2 -2
  159. package/dist/src/agent/index.js +3 -3
  160. package/dist/src/agent/mcp/config.js +1 -1
  161. package/dist/src/agent/memory/context-budget.js +1 -1
  162. package/dist/src/agent/memory/context-recovery.js +1 -1
  163. package/dist/src/agent/memory/index.js +1 -1
  164. package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
  165. package/dist/src/agent/prompt/response-language.js +1 -1
  166. package/dist/src/agent/prompt/sections/tooling.js +1 -1
  167. package/dist/src/agent/prompt/service-prompt-builder.js +3 -3
  168. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  169. package/dist/src/agent/service/direct-turn-helpers.js +5 -5
  170. package/dist/src/agent/service/process-direct-streaming.js +5 -5
  171. package/dist/src/agent/service/webchat-tts.js +2 -2
  172. package/dist/src/agent/service.d.ts +6 -0
  173. package/dist/src/agent/service.js +21 -18
  174. package/dist/src/agent/session/session-config-service.js +2 -2
  175. package/dist/src/agent/session/session-hydrator.js +1 -1
  176. package/dist/src/agent/session/session-inspector.js +1 -1
  177. package/dist/src/agent/source-context/index.js +2 -2
  178. package/dist/src/agent/starter-agents.d.ts +1 -0
  179. package/dist/src/agent/starter-agents.js +12 -0
  180. package/dist/src/agent/tasks/task-judge-service.js +5 -5
  181. package/dist/src/agent/tools/create-share-tool.js +3 -3
  182. package/dist/src/agent/tools/dataBatch.js +1 -1
  183. package/dist/src/agent/tools/delegate-tool.js +3 -3
  184. package/dist/src/agent/tools/error-pattern-matcher.js +1 -1
  185. package/dist/src/agent/tools/exec-command.js +3 -1
  186. package/dist/src/agent/tools/executor.js +1 -1
  187. package/dist/src/agent/tools/factory.d.ts +6 -0
  188. package/dist/src/agent/tools/factory.js +40 -39
  189. package/dist/src/agent/tools/fetch-text.js +1 -1
  190. package/dist/src/agent/tools/image-generate-tool.js +3 -3
  191. package/dist/src/agent/tools/index.js +6 -6
  192. package/dist/src/agent/tools/list-dir.js +1 -1
  193. package/dist/src/agent/tools/personal-attention-tool.d.ts +2 -0
  194. package/dist/src/agent/tools/personal-attention-tool.js +52 -18
  195. package/dist/src/agent/tools/personal-read-tool.js +16 -6
  196. package/dist/src/agent/tools/personal-request-tool.js +64 -12
  197. package/dist/src/agent/tools/personal-result-budget.d.ts +2 -0
  198. package/dist/src/agent/tools/personal-result-budget.js +57 -0
  199. package/dist/src/agent/tools/personal-task-tool.d.ts +13 -21
  200. package/dist/src/agent/tools/personal-task-tool.js +234 -24
  201. package/dist/src/agent/tools/publish-artifacts.js +2 -2
  202. package/dist/src/agent/tools/read.js +2 -2
  203. package/dist/src/agent/tools/review-workspace.js +1 -1
  204. package/dist/src/agent/tools/send-media.js +2 -2
  205. package/dist/src/agent/tools/skills-tools.js +1 -1
  206. package/dist/src/agent/tools/tts-tool.js +1 -1
  207. package/dist/src/agent/tools/user-context-tool.js +1 -1
  208. package/dist/src/agent/tools/write.js +2 -2
  209. package/dist/src/agent/tools/xopc-use-tool.js +24 -12
  210. package/dist/src/agent/transcript/index.js +2 -2
  211. package/dist/src/agent/transcript/transcript-hygiene.js +2 -2
  212. package/dist/src/agent/workflow/subagent-runner.js +1 -1
  213. package/dist/src/agent-config/resolver.js +2 -0
  214. package/dist/src/agent-config/schema.d.ts +8 -0
  215. package/dist/src/agent-config/schema.js +2 -0
  216. package/dist/src/agent-matching/delegation-service.js +1 -1
  217. package/dist/src/agent-matching/selection-repository.d.ts +1 -0
  218. package/dist/src/agent-matching/selection-repository.js +1 -1
  219. package/dist/src/agent-matching/service.js +2 -2
  220. package/dist/src/ai-assist/text-assist.js +1 -1
  221. package/dist/src/auth/sync-provider-auth.js +1 -1
  222. package/dist/src/automations/capabilities/write.d.ts +4 -0
  223. package/dist/src/automations/domain/index.js +2 -2
  224. package/dist/src/automations/domain/validation.d.ts +8 -0
  225. package/dist/src/automations/draft/automation-draft-service.js +1 -1
  226. package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -0
  227. package/dist/src/automations/index.js +4 -4
  228. package/dist/src/automations/service/automation-service.js +2 -2
  229. package/dist/src/backup/archive.js +1 -1
  230. package/dist/src/browser/native-messaging-host.js +1 -1
  231. package/dist/src/channels/attachments/voice-stt-webchat.js +2 -2
  232. package/dist/src/channels/index.js +2 -2
  233. package/dist/src/channels/outbound-sender.js +1 -1
  234. package/dist/src/channels/pairing/allow-from-file.js +9 -9
  235. package/dist/src/channels/pairing/pairing-store.js +6 -6
  236. package/dist/src/chat-commands/agent-edit.js +1 -1
  237. package/dist/src/chat-commands/builtins/config.js +3 -3
  238. package/dist/src/chat-commands/builtins/review.js +1 -1
  239. package/dist/src/chat-commands/builtins/session.js +1 -1
  240. package/dist/src/chat-commands/builtins/thinking.js +1 -1
  241. package/dist/src/chat-commands/builtins/tts.js +1 -1
  242. package/dist/src/chat-commands/builtins/understanding.js +1 -1
  243. package/dist/src/chat-commands/builtins/workflow.js +1 -1
  244. package/dist/src/chat-commands/context.js +4 -4
  245. package/dist/src/chat-commands/index.js +3 -3
  246. package/dist/src/cli/commands/agent.js +8 -8
  247. package/dist/src/cli/commands/channels.js +1 -1
  248. package/dist/src/cli/commands/config.js +1 -1
  249. package/dist/src/cli/commands/connectors.js +2 -2
  250. package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
  251. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  252. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
  253. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  254. package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +1 -1
  255. package/dist/src/cli/commands/extension-agent-plugin.js +1 -1
  256. package/dist/src/cli/commands/extension-dev.js +1 -1
  257. package/dist/src/cli/commands/extension-marketplace.js +4 -4
  258. package/dist/src/cli/commands/extension.js +4 -4
  259. package/dist/src/cli/commands/gateway/token.js +1 -1
  260. package/dist/src/cli/commands/image.js +1 -1
  261. package/dist/src/cli/commands/init.js +1 -1
  262. package/dist/src/cli/commands/mcp.js +1 -1
  263. package/dist/src/cli/commands/models.js +3 -3
  264. package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
  265. package/dist/src/cli/commands/onboard.js +2 -2
  266. package/dist/src/cli/commands/project.js +2 -2
  267. package/dist/src/cli/commands/runtime.js +1 -1
  268. package/dist/src/cli/commands/skills.js +2 -2
  269. package/dist/src/cli/commands/tunnel.js +4 -4
  270. package/dist/src/cli/extension-cli-register.js +6 -6
  271. package/dist/src/cli/utils/gateway-client.js +1 -1
  272. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  273. package/dist/src/cli/utils/session.js +1 -1
  274. package/dist/src/computer/runtime.js +2 -2
  275. package/dist/src/config/agent-model-intents.js +1 -1
  276. package/dist/src/config/index.js +5 -5
  277. package/dist/src/config/loader.js +1 -1
  278. package/dist/src/config/schema.js +5 -5
  279. package/dist/src/connectors/cli/authorization.js +1 -1
  280. package/dist/src/connectors/cli/runtime.js +1 -1
  281. package/dist/src/connectors/composio-sessions.js +1 -1
  282. package/dist/src/connectors/composio.js +1 -1
  283. package/dist/src/connectors/connected-source-ingestion.js +4 -4
  284. package/dist/src/connectors/connected-source-understanding.js +4 -4
  285. package/dist/src/connectors/connection-recovery-service.js +6 -6
  286. package/dist/src/connectors/content-enrichment.js +1 -1
  287. package/dist/src/connectors/health.js +1 -1
  288. package/dist/src/connectors/learning-coordinator.js +2 -2
  289. package/dist/src/discussions/live-worker.js +1 -1
  290. package/dist/src/discussions/recording.js +1 -1
  291. package/dist/src/discussions/sealer.js +1 -1
  292. package/dist/src/endpoint-tools/index.js +1 -1
  293. package/dist/src/endpoint-tools/runtime.js +2 -2
  294. package/dist/src/extensions/activation-context.js +3 -3
  295. package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
  296. package/dist/src/extensions/api.js +4 -4
  297. package/dist/src/extensions/bundled-extension-activation.js +1 -1
  298. package/dist/src/extensions/index.js +3 -3
  299. package/dist/src/extensions/install.js +1 -1
  300. package/dist/src/extensions/loader.js +2 -2
  301. package/dist/src/extensions/sdk/index.js +1 -1
  302. package/dist/src/extensions/sdk/media.js +1 -1
  303. package/dist/src/extensions/update.js +1 -1
  304. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  305. package/dist/src/gateway/agents-admin.js +1 -1
  306. package/dist/src/gateway/device-routes.js +2 -2
  307. package/dist/src/gateway/file-path-classifier.js +2 -2
  308. package/dist/src/gateway/global-defaults-admin.js +1 -1
  309. package/dist/src/gateway/hono/app.js +3 -3
  310. package/dist/src/gateway/hono/lib/config-payload.js +3 -3
  311. package/dist/src/gateway/hono/routes/agents.js +1 -1
  312. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  313. package/dist/src/gateway/hono/routes/commands-skills.js +4 -4
  314. package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
  315. package/dist/src/gateway/hono/routes/config-patch/misc.js +4 -4
  316. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  317. package/dist/src/gateway/hono/routes/context-sources.js +2 -2
  318. package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -1
  319. package/dist/src/gateway/hono/routes/home.js +1 -1
  320. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  321. package/dist/src/gateway/hono/routes/media.js +1 -1
  322. package/dist/src/gateway/hono/routes/memory-learning.js +3 -3
  323. package/dist/src/gateway/hono/routes/models.js +5 -5
  324. package/dist/src/gateway/hono/routes/notes.js +1 -1
  325. package/dist/src/gateway/hono/routes/personal-agent.js +2 -2
  326. package/dist/src/gateway/hono/routes/projects.js +4 -4
  327. package/dist/src/gateway/hono/routes/session-command-handler.js +2 -2
  328. package/dist/src/gateway/hono/routes/session-input-handler.js +4 -4
  329. package/dist/src/gateway/hono/routes/sessions.js +2 -2
  330. package/dist/src/gateway/hono/routes/shares.js +3 -3
  331. package/dist/src/gateway/hono/routes/side-chats.js +1 -1
  332. package/dist/src/gateway/hono/routes/site-shares.js +1 -1
  333. package/dist/src/gateway/hono/routes/tasks.js +3 -2
  334. package/dist/src/gateway/hono/routes/user-model.js +7 -7
  335. package/dist/src/gateway/hono/routes/voice.js +7 -7
  336. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  337. package/dist/src/gateway/image-generation-setup.js +1 -1
  338. package/dist/src/gateway/index.js +1 -1
  339. package/dist/src/gateway/lock.js +11 -11
  340. package/dist/src/gateway/media-access.js +1 -1
  341. package/dist/src/gateway/mobile-privacy.js +2 -2
  342. package/dist/src/gateway/ports.js +6 -6
  343. package/dist/src/gateway/run-loop.js +1 -1
  344. package/dist/src/gateway/scenes/mailContext.js +1 -1
  345. package/dist/src/gateway/scenes/slackThreadSource.js +1 -1
  346. package/dist/src/gateway/server.js +1 -1
  347. package/dist/src/gateway/service/agent-runner.js +2 -2
  348. package/dist/src/gateway/service/config-coordinator.js +2 -2
  349. package/dist/src/gateway/service/marketplace-service.js +1 -1
  350. package/dist/src/gateway/service/run-gateway-agent.js +3 -3
  351. package/dist/src/gateway/service/session-command-service.js +1 -1
  352. package/dist/src/gateway/service.d.ts +1 -0
  353. package/dist/src/gateway/service.js +59 -45
  354. package/dist/src/gateway/session-context-summary.js +3 -3
  355. package/dist/src/gateway/workspace-editor-path.js +2 -2
  356. package/dist/src/home-intelligence/generator.js +2 -2
  357. package/dist/src/home-intelligence/host.js +2 -2
  358. package/dist/src/imports/inventory.js +1 -1
  359. package/dist/src/infra/gateway-processes.js +2 -2
  360. package/dist/src/infra/path-env.js +3 -3
  361. package/dist/src/infra/update-global.js +10 -10
  362. package/dist/src/knowledge/connected-knowledge-pipeline.js +2 -2
  363. package/dist/src/knowledge/index.js +1 -1
  364. package/dist/src/knowledge-memory/repository.js +1 -1
  365. package/dist/src/local-apps/service.js +1 -1
  366. package/dist/src/mcp/gateway-http-client.js +1 -1
  367. package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
  368. package/dist/src/memory-learning/source-learning.js +5 -5
  369. package/dist/src/memory-learning/task-receipts.js +1 -1
  370. package/dist/src/notes/agent-context.js +4 -4
  371. package/dist/src/notes/index.js +1 -1
  372. package/dist/src/notes/store.js +1 -1
  373. package/dist/src/personal-agent/capability-service.js +4 -4
  374. package/dist/src/personal-agent/policy.js +2 -7
  375. package/dist/src/personal-agent/proactivity/repository.js +1 -1
  376. package/dist/src/personal-agent/proactivity/routes.js +1 -1
  377. package/dist/src/personal-agent/proactivity/service.js +5 -5
  378. package/dist/src/personal-agent/prompt-context.d.ts +1 -4
  379. package/dist/src/personal-agent/prompt-context.js +9 -34
  380. package/dist/src/personal-agent/prompts.js +31 -10
  381. package/dist/src/personal-agent/reply-composer.js +4 -4
  382. package/dist/src/personal-agent/request-delivery.js +1 -1
  383. package/dist/src/personal-agent/request-repository.d.ts +3 -2
  384. package/dist/src/personal-agent/request-repository.js +4 -4
  385. package/dist/src/personal-agent/request-service.d.ts +1 -1
  386. package/dist/src/personal-agent/request-service.js +100 -32
  387. package/dist/src/personal-agent/task-cancel.d.ts +7 -0
  388. package/dist/src/personal-agent/task-cancel.js +76 -0
  389. package/dist/src/providers/model-reference-auditor.js +1 -1
  390. package/dist/src/realtime/runtime.js +1 -1
  391. package/dist/src/remote-access/exposure-manager.js +1 -1
  392. package/dist/src/scenes/taskFollowUp/agentExecutor.js +4 -4
  393. package/dist/src/scenes/taskFollowUp/resources.js +1 -1
  394. package/dist/src/scenes/taskFollowUp/service.js +5 -5
  395. package/dist/src/session/client-history.js +1 -1
  396. package/dist/src/session/index.js +1 -1
  397. package/dist/src/session/store.js +5 -5
  398. package/dist/src/session/thinking-resolve.js +1 -1
  399. package/dist/src/share/share-store.js +1 -1
  400. package/dist/src/share/share-thumbnail.js +1 -1
  401. package/dist/src/share/share-zip.js +1 -1
  402. package/dist/src/share/site-proxy.js +1 -1
  403. package/dist/src/share/site-share-store.js +1 -1
  404. package/dist/src/storage/sqlite/connection.js +9 -9
  405. package/dist/src/storage/sqlite/migrations/249_task_allocations.sql +17 -0
  406. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  407. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  408. package/dist/src/storage/sqlite/schema.js +1 -1
  409. package/dist/src/tasks/capabilities/read.js +2 -2
  410. package/dist/src/tasks/capabilities/relations.d.ts +38 -2
  411. package/dist/src/tasks/capabilities/write.d.ts +40 -0
  412. package/dist/src/tasks/capabilities/write.js +7 -6
  413. package/dist/src/tasks/execution-context.js +1 -1
  414. package/dist/src/tasks/home-query-service.js +2 -2
  415. package/dist/src/tasks/index.js +5 -5
  416. package/dist/src/tasks/task-allocation-repository.d.ts +25 -0
  417. package/dist/src/tasks/task-allocation-repository.js +82 -0
  418. package/dist/src/tasks/task-allocation-service.d.ts +39 -0
  419. package/dist/src/tasks/task-allocation-service.js +310 -0
  420. package/dist/src/tasks/task-application-service.js +46 -3
  421. package/dist/src/tasks/task-collaboration-delivery.js +1 -1
  422. package/dist/src/tasks/task-context-assembler.js +2 -2
  423. package/dist/src/tasks/task-handoff-service.js +2 -2
  424. package/dist/src/tasks/task-main-update-decision-service.js +2 -2
  425. package/dist/src/tasks/task-main-update-delivery.js +2 -0
  426. package/dist/src/tasks/task-origin-repository.d.ts +2 -1
  427. package/dist/src/tasks/task-origin-repository.js +9 -5
  428. package/dist/src/tasks/task-read-model-projector.d.ts +2 -1
  429. package/dist/src/tasks/task-read-model-projector.js +21 -8
  430. package/dist/src/tasks/task-result-delivery-repository.js +1 -1
  431. package/dist/src/tasks/task-result-delivery-service.js +4 -4
  432. package/dist/src/tasks/task-run-coordinator.js +10 -2
  433. package/dist/src/tasks/task-run-dispatcher.d.ts +1 -1
  434. package/dist/src/tasks/task-run-dispatcher.js +5 -4
  435. package/dist/src/tui/backends/embedded-backend.js +11 -11
  436. package/dist/src/tui/backends/gateway-realtime-backend.js +2 -2
  437. package/dist/src/tui/extension-host/load-extensions.js +2 -2
  438. package/dist/src/tui/tui-commands.js +6 -6
  439. package/dist/src/tui/tui-picker-overlay.js +1 -1
  440. package/dist/src/tui/tui-skills-autocomplete.js +2 -2
  441. package/dist/src/tui/tui-startup-resources.js +5 -5
  442. package/dist/src/tui/tui.js +7 -7
  443. package/dist/src/tunnel/frpc-binary.js +1 -1
  444. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  445. package/dist/src/user-context/access-policy.js +1 -1
  446. package/dist/src/user-model/bootstrap.js +1 -1
  447. package/dist/src/user-model/capture/executor.js +1 -1
  448. package/dist/src/user-model/index.js +2 -2
  449. package/dist/src/voice/realtime/memory-context.js +6 -6
  450. package/dist/src/voice/realtime/runtime.js +4 -4
  451. package/dist/src/voice/stt/index.js +2 -2
  452. package/dist/src/voice/stt/preflight.js +1 -1
  453. package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
  454. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
  455. package/dist/src/voice/stt/transcribe-core.js +1 -1
  456. package/dist/src/voice/tts/index.js +3 -3
  457. package/dist/src/voice/tts/merge-config.js +1 -1
  458. package/dist/src/voice/tts/payload.js +1 -1
  459. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
  460. package/dist/src/voice/tts/speak-core.js +1 -1
  461. package/dist/src/work-discovery/index.js +1 -1
  462. package/dist/src/work-discovery/service.js +7 -7
  463. package/dist/src/workflows/engine/workflow-engine.js +1 -1
  464. package/dist/src/workflows/service/workflow-run-service.js +8 -8
  465. package/dist/src/workflows/service/workflow-session-bridge.js +2 -2
  466. package/package.json +3 -3
  467. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Bewx00VC.js +0 -1
  468. package/dist/gateway/static/root/assets/agents-ByJbzt3F.js +0 -77
  469. package/dist/gateway/static/root/assets/automations-workspace-DOJnSOJ7.js +0 -6
  470. package/dist/gateway/static/root/assets/browser-automations-page-DGcGOkIq.js +0 -3
  471. package/dist/gateway/static/root/assets/browser-settings-page-CHCWHtkG.js +0 -3
  472. package/dist/gateway/static/root/assets/capabilities-page-CVaH729t.js +0 -2
  473. package/dist/gateway/static/root/assets/connectors-page-BpCGV1Gg.js +0 -1
  474. package/dist/gateway/static/root/assets/device-pairing-wizard-CEfqb0dk.js +0 -1
  475. package/dist/gateway/static/root/assets/gateway-realtime-store-IK77lcix.js +0 -1
  476. package/dist/gateway/static/root/assets/gateway-settings-CnqeYLJI.js +0 -1
  477. package/dist/gateway/static/root/assets/home-page-CKUJdUkK.js +0 -2
  478. package/dist/gateway/static/root/assets/markdown-view-CZWff4bI.css +0 -1
  479. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-Bd0DNN_v.js +0 -1
  480. package/dist/gateway/static/root/assets/messages-CRy8QVkB.js +0 -3
  481. package/dist/gateway/static/root/assets/note-detail-panel-DiJ5O3Ga.js +0 -5
  482. package/dist/gateway/static/root/assets/notes-page-BEhxVwpX.js +0 -8
  483. package/dist/gateway/static/root/assets/page-tabs-BLGO2VIm.js +0 -1
  484. package/dist/gateway/static/root/assets/personal-page-Dpgj9Y5a.js +0 -1
  485. package/dist/gateway/static/root/assets/project-detail-page-CAM4Q3Kh.js +0 -1
  486. package/dist/gateway/static/root/assets/remote-access-hub-B6y0lXZc.js +0 -1
  487. package/dist/gateway/static/root/assets/sessions-page-DY0UP_lC.js +0 -1
  488. package/dist/gateway/static/root/assets/settings-advanced-gate-BLTR6Opb.js +0 -1
  489. package/dist/gateway/static/root/assets/setup-status-panel-DWAAlzV5.js +0 -1
  490. package/dist/gateway/static/root/assets/shares-settings-DPrpUIj7.js +0 -1
  491. package/dist/gateway/static/root/assets/tasks-DwKXgZ-I.js +0 -1
  492. package/dist/gateway/static/root/assets/user-model-page-BgIW4ITJ.js +0 -2
@@ -1,10 +1,15 @@
1
+ import { getSqliteDatabase, init_transaction } from "../../storage/sqlite/transaction.js";
1
2
  import { getPersonalRequest, init_request_repository, listPersonalRequests } from "../../personal-agent/request-repository.js";
2
3
  import { isPersonalConversation } from "../../personal-agent/repository.js";
4
+ import { TaskAllocationRepository } from "../../tasks/task-allocation-repository.js";
5
+ import { boundedPersonalResult } from "./personal-result-budget.js";
6
+ import { cancelPersonalTask } from "../../personal-agent/task-cancel.js";
3
7
  import { personalCapabilities } from "../../personal-agent/capability-service.js";
4
8
  import { cancelPersonalRequest, personalRequestSnapshot, publishPersonalRequest, submitPersonalRequest } from "../../personal-agent/request-service.js";
5
9
  import { Type } from "@sinclair/typebox";
6
10
  //#region src/agent/tools/personal-request-tool.ts
7
11
  init_request_repository();
12
+ init_transaction();
8
13
  const CapabilitySchema = Type.Object({
9
14
  query: Type.String({
10
15
  minLength: 1,
@@ -20,8 +25,12 @@ const RequestSchema = Type.Object({
20
25
  "cancel"
21
26
  ].map((command) => Type.Literal(command))),
22
27
  requestId: Type.Optional(Type.String()),
28
+ offset: Type.Optional(Type.Integer({ minimum: 0 })),
29
+ limit: Type.Optional(Type.Integer({
30
+ minimum: 1,
31
+ maximum: 20
32
+ })),
23
33
  connectorId: Type.Optional(Type.String()),
24
- agentId: Type.Optional(Type.String()),
25
34
  accountId: Type.Optional(Type.String()),
26
35
  objective: Type.Optional(Type.String({
27
36
  minLength: 1,
@@ -31,13 +40,25 @@ const RequestSchema = Type.Object({
31
40
  minLength: 1,
32
41
  maxLength: 200
33
42
  })),
34
- selectionReason: Type.Optional(Type.String({ maxLength: 500 })),
35
43
  timeRange: Type.Optional(Type.Object({
36
44
  from: Type.String(),
37
45
  to: Type.String(),
38
46
  timezone: Type.String(),
39
47
  expression: Type.String()
40
48
  }))
49
+ }, {
50
+ additionalProperties: false,
51
+ anyOf: [
52
+ {
53
+ properties: { command: { const: "submit" } },
54
+ required: ["objective", "connectorId"]
55
+ },
56
+ { properties: { command: { const: "list" } } },
57
+ {
58
+ properties: { command: { enum: ["get", "cancel"] } },
59
+ required: ["requestId"]
60
+ }
61
+ ]
41
62
  });
42
63
  function createPersonalRequestTools(deps) {
43
64
  const conversation = () => {
@@ -45,6 +66,14 @@ function createPersonalRequestTools(deps) {
45
66
  if (!id || !isPersonalConversation(id)) throw new Error("Personal conversation is required");
46
67
  return id;
47
68
  };
69
+ const snapshot = (request) => {
70
+ const value = personalRequestSnapshot(request);
71
+ return {
72
+ ...value,
73
+ executorAgentId: value.parameters.allocate && value.executorAgentId === "task-router" ? void 0 : value.executorAgentId,
74
+ ...value.taskId ? { allocation: new TaskAllocationRepository().summary(value.taskId) } : {}
75
+ };
76
+ };
48
77
  const result = (value) => ({
49
78
  content: [{
50
79
  type: "text",
@@ -56,45 +85,68 @@ function createPersonalRequestTools(deps) {
56
85
  name: "personal_capability",
57
86
  label: "Connected app availability",
58
87
  parameters: CapabilitySchema,
59
- description: "Check connected-app capabilities, account connection state and specialist Agents locally. Compare executorProfiles for declared expertise; account executorAgentIds constrain eligibility. For Gmail or other supported apps, check here before delegating. ready is a local preflight; the worker still validates live tools. No remote search or authorization is performed.",
88
+ description: "Check connected-app capabilities, account connection state and specialist Agents locally. The background Task Router selects an executor within account permissions; do not compare executor profiles in the main conversation. For Gmail or other supported apps, check here before delegating. ready is a local preflight; the worker still validates live tools. No remote search or authorization is performed.",
60
89
  async execute(_id, input) {
61
- return result(personalCapabilities(conversation(), input.query, input.accountId));
90
+ return result(personalCapabilities(conversation(), input.query, input.accountId).map(({ executorProfiles: _profiles, executorAgentIds, accounts, ...capability }) => ({
91
+ ...capability,
92
+ eligibleExecutorCount: executorAgentIds.length,
93
+ accounts: accounts.map(({ executorAgentIds: _ids, ...account }) => account)
94
+ })));
62
95
  }
63
96
  }, {
64
97
  name: "personal_request",
65
98
  label: "Connected app request",
66
99
  parameters: RequestSchema,
67
- description: "Submit a read-only connected-app request using exact connectorId and agentId from personal_capability. Include a short selectionReason explaining the fit. Preserves the objective, displays connection or account selection in this main chat, and starts a specialist Task automatically once connected. Return quickly after submission. Never claim data was read until the Task result arrives. Resolve absolute query dates and include timeRange. If mail has no user-specified range, the host returns an explicit last-7-days default; mention that range in your confirmation. Use get/list for status, cancel only when the user requests it.",
100
+ description: "Submit a read-only connected-app request using the exact connectorId from personal_capability. The background Task Router chooses an executor after account authorization. Preserves the objective, displays connection or account selection in this main chat, and starts a specialist Task automatically once connected. Return quickly after submission. Never claim data was read until the Task result arrives. Resolve absolute query dates and include timeRange. If mail has no user-specified range, the host returns an explicit last-7-days default; mention that range in your confirmation. Use paginated get/list for status without polling; preserve idempotencyKey on uncertain retries; cancel only when the user requests it.",
68
101
  async execute(toolCallId, input) {
69
102
  const conversationId = conversation();
70
- if (input.command === "list") return result(listPersonalRequests(conversationId).map(personalRequestSnapshot));
103
+ if (input.command === "list") {
104
+ const offset = input.offset ?? 0;
105
+ const items = listPersonalRequests(conversationId, input.limit ?? 10, offset).map((request) => {
106
+ const { result: _result, ...summary } = snapshot(request);
107
+ return summary;
108
+ });
109
+ const total = getSqliteDatabase().prepare("SELECT count(*) AS count FROM personal_requests WHERE conversation_id = ?").get(conversationId).count;
110
+ return result(boundedPersonalResult({
111
+ items,
112
+ total,
113
+ offset
114
+ }));
115
+ }
71
116
  if (input.command === "submit") {
72
- if (!input.objective?.trim() || !input.connectorId || !input.agentId) throw new Error("objective, connectorId and agentId are required");
117
+ if (!input.objective?.trim() || !input.connectorId) throw new Error("objective and connectorId are required");
73
118
  const request = submitPersonalRequest({
74
119
  conversationId,
75
120
  connectorId: input.connectorId,
76
- agentId: input.agentId,
77
121
  accountId: input.accountId,
78
122
  objective: input.objective.trim(),
79
- selectionReason: input.selectionReason,
80
123
  timeRange: input.timeRange,
81
124
  idempotencyKey: input.idempotencyKey ?? toolCallId
82
125
  });
83
126
  publishPersonalRequest(request);
84
127
  deps.dispatchTaskRuns?.();
85
- return result(personalRequestSnapshot(request));
128
+ return result(boundedPersonalResult(snapshot(request)));
86
129
  }
87
130
  const request = input.requestId ? getPersonalRequest(input.requestId) : void 0;
88
131
  if (!request || request.conversationId !== conversationId) throw new Error("Request does not belong to this conversation");
89
132
  if (input.command === "cancel") {
133
+ if (["completed", "failed"].includes(personalRequestSnapshot(request).state)) return result(boundedPersonalResult(snapshot(request)));
134
+ if (request.state === "cancelled") {
135
+ const stop = request.taskId ? await cancelPersonalTask(request.taskId, conversationId, input.idempotencyKey ?? toolCallId) : { executionStopConfirmed: true };
136
+ return result({
137
+ ...snapshot(request),
138
+ executionStopConfirmed: stop.executionStopConfirmed
139
+ });
140
+ }
141
+ const stop = request.taskId ? await cancelPersonalTask(request.taskId, conversationId, input.idempotencyKey ?? toolCallId) : { executionStopConfirmed: true };
90
142
  const cancelled = cancelPersonalRequest(request);
91
143
  publishPersonalRequest(cancelled);
92
144
  return result({
93
145
  ...cancelled,
94
- executionStopConfirmed: false
146
+ executionStopConfirmed: stop.executionStopConfirmed
95
147
  });
96
148
  }
97
- return result(personalRequestSnapshot(request));
149
+ return result(boundedPersonalResult(snapshot(request)));
98
150
  }
99
151
  }];
100
152
  }
@@ -0,0 +1,2 @@
1
+ /** Bound model-visible reads and disclose every omitted field or list item. */
2
+ export declare function boundedPersonalResult(value: unknown): unknown;
@@ -0,0 +1,57 @@
1
+ import "./local-read-budget.js";
2
+ //#region src/agent/tools/personal-result-budget.ts
3
+ /** Bound model-visible reads and disclose every omitted field or list item. */
4
+ function boundedPersonalResult(value) {
5
+ let truncated = false;
6
+ const project = (entry, depth = 0) => {
7
+ if (typeof entry === "string") {
8
+ if (entry.length > 600) truncated = true;
9
+ return entry.slice(0, 600);
10
+ }
11
+ if (!entry || typeof entry !== "object") return entry;
12
+ if (depth > 6) {
13
+ truncated = true;
14
+ return "[omitted]";
15
+ }
16
+ if (Array.isArray(entry)) {
17
+ if (entry.length > 20) truncated = true;
18
+ return entry.slice(0, 20).map((item) => project(item, depth + 1));
19
+ }
20
+ return Object.fromEntries(Object.entries(entry).map(([key, item]) => [key, project(item, depth + 1)]));
21
+ };
22
+ const result = project(value);
23
+ if (!result || typeof result !== "object" || Array.isArray(result)) return result;
24
+ const payload = result;
25
+ let removedItems = false;
26
+ const items = payload.items;
27
+ if (Array.isArray(items)) {
28
+ while (items.length && JSON.stringify(payload).length > 7900) {
29
+ items.pop();
30
+ truncated = true;
31
+ removedItems = true;
32
+ }
33
+ if (!items.length && removedItems) return {
34
+ ...payload,
35
+ nextOffset: void 0,
36
+ truncated: true,
37
+ requiresSpecialist: true,
38
+ guidance: "A single item exceeds the local read budget."
39
+ };
40
+ if (typeof payload.offset === "number" && (removedItems || typeof payload.total === "number" && payload.offset + items.length < payload.total)) payload.nextOffset = payload.offset + items.length;
41
+ }
42
+ if (JSON.stringify(payload).length > 7900) return {
43
+ truncated: true,
44
+ requiresSpecialist: true,
45
+ guidance: "Complete details exceed the local read budget."
46
+ };
47
+ return {
48
+ ...payload,
49
+ ...truncated ? {
50
+ truncated: true,
51
+ excerpts: true,
52
+ ...!Array.isArray(items) ? { requiresSpecialist: true } : {}
53
+ } : {}
54
+ };
55
+ }
56
+ //#endregion
57
+ export { boundedPersonalResult };
@@ -2,39 +2,31 @@ import type { AgentTool } from '@earendil-works/pi-agent-core';
2
2
  import { type MatchingContext } from '../../agent-matching/service.js';
3
3
  export { getAvailablePersonalAgentTools, personalAgentModelAvailability } from '../../personal-agent/specialist-capabilities.js';
4
4
  import { type XopcUseToolDeps } from './xopc-use-tool.js';
5
- declare const PersonalTaskSchema: import("@sinclair/typebox").TObject<{
6
- command: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"agents">, import("@sinclair/typebox").TLiteral<"match">, import("@sinclair/typebox").TLiteral<"selection">, import("@sinclair/typebox").TLiteral<"create">, import("@sinclair/typebox").TLiteral<"list">, import("@sinclair/typebox").TLiteral<"get">, import("@sinclair/typebox").TLiteral<"instruct">, import("@sinclair/typebox").TLiteral<"answer">]>;
5
+ declare const PersonalTaskModelSchema: import("@sinclair/typebox").TObject<{
7
6
  requirements: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
8
7
  version: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TLiteral<1>>;
9
8
  summary: import("@sinclair/typebox").TString;
10
- domain: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
11
- taskType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
12
9
  inputKinds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
13
10
  outputKinds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
14
- requiredTools: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
15
- requiredSkills: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
11
+ domain: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
12
+ taskType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
16
13
  requestedAgentId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
17
14
  }>>;
18
- selectionReason: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
19
- selectionSource: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"snapshot">, import("@sinclair/typebox").TLiteral<"match">, import("@sinclair/typebox").TLiteral<"explicit">]>>;
20
- previousSelectionId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
21
- matchId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
15
+ command: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"get" | "answer" | "retry_allocation" | "selection" | "list" | "cancel" | "submit" | "instruct">[]>;
22
16
  requestId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
23
- cursor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
24
- offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
25
17
  title: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
26
- objective: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
27
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
28
- agentId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
29
18
  taskId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
30
- instruction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
31
- questionId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
19
+ requiredSkills: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
20
+ idempotencyKey: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
21
+ objective: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
32
22
  expectedOutputs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
33
23
  acceptanceCriteria: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
34
24
  constraints: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
35
- requiredSkills: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
36
- requiredTools: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
37
- idempotencyKey: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
25
+ description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
26
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
27
+ offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
28
+ instruction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
29
+ questionId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
38
30
  }>;
39
31
  export interface PersonalTaskToolDeps extends XopcUseToolDeps {
40
32
  getAgentToolAvailability?: MatchingContext['getAgentToolAvailability'];
@@ -56,4 +48,4 @@ export declare function buildPersonalTaskBrief(input: {
56
48
  body?: string;
57
49
  };
58
50
  /** A narrow Task surface for the fast personal conversation. */
59
- export declare function createPersonalTaskTool(deps: PersonalTaskToolDeps): AgentTool<typeof PersonalTaskSchema, Record<string, never>>;
51
+ export declare function createPersonalTaskTool(deps: PersonalTaskToolDeps): AgentTool<typeof PersonalTaskModelSchema, Record<string, never>>;
@@ -1,22 +1,35 @@
1
1
  import { normalizeSpecialistRequirements } from "../../../packages/gateway-contract/src/specialists.js";
2
+ import { appendProductDeliveryText } from "../../../packages/gateway-contract/src/product-delivery.js";
3
+ import { init_src } from "../../../packages/gateway-contract/src/index.js";
4
+ import { getSessionInputState, init_session_input_repository } from "../../storage/sqlite/session-input-repository.js";
5
+ import { TaskRepository, init_task_repository } from "../../tasks/task-repository.js";
2
6
  import { getPersonalRequest, init_request_repository } from "../../personal-agent/request-repository.js";
3
7
  import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
4
8
  import { init_sqlite } from "../../storage/sqlite/index.js";
5
- import { AgentSelectionRepository, selectionRequestHash } from "../../agent-matching/selection-repository.js";
9
+ import { isPersonalConversation } from "../../personal-agent/repository.js";
10
+ import { TaskAllocationRepository } from "../../tasks/task-allocation-repository.js";
11
+ import { TaskOriginRepository } from "../../tasks/task-origin-repository.js";
12
+ import { boundedPersonalResult } from "./personal-result-budget.js";
13
+ import { TaskApplicationService } from "../../tasks/task-application-service.js";
14
+ import { createXopcUseTool } from "./xopc-use-tool.js";
6
15
  import { getAvailablePersonalAgentTools, personalAgentModelAvailability } from "../../personal-agent/specialist-capabilities.js";
7
16
  import { assessSpecialist, matchSpecialists } from "../../agent-matching/service.js";
17
+ import { AgentSelectionRepository, selectionRequestHash } from "../../agent-matching/selection-repository.js";
8
18
  import { assertSpecialistEligible, createSelectedTask } from "../../agent-matching/delegation-service.js";
9
- import { isPersonalConversation } from "../../personal-agent/repository.js";
10
19
  import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../../personal-agent/communication.js";
11
- import { TaskOriginRepository } from "../../tasks/task-origin-repository.js";
12
- import { createXopcUseTool } from "./xopc-use-tool.js";
20
+ import { cancelPersonalTask } from "../../personal-agent/task-cancel.js";
13
21
  import { randomUUID } from "node:crypto";
14
22
  import { Type } from "@sinclair/typebox";
15
23
  //#region src/agent/tools/personal-task-tool.ts
24
+ init_src();
16
25
  init_sqlite();
26
+ init_session_input_repository();
17
27
  init_request_repository();
28
+ init_task_repository();
18
29
  const PersonalTaskSchema = Type.Object({
19
30
  command: Type.Union([
31
+ Type.Literal("retry_allocation"),
32
+ Type.Literal("submit"),
20
33
  Type.Literal("agents"),
21
34
  Type.Literal("match"),
22
35
  Type.Literal("selection"),
@@ -24,7 +37,8 @@ const PersonalTaskSchema = Type.Object({
24
37
  Type.Literal("list"),
25
38
  Type.Literal("get"),
26
39
  Type.Literal("instruct"),
27
- Type.Literal("answer")
40
+ Type.Literal("answer"),
41
+ Type.Literal("cancel")
28
42
  ]),
29
43
  requirements: Type.Optional(Type.Object({
30
44
  version: Type.Optional(Type.Literal(1)),
@@ -35,7 +49,10 @@ const PersonalTaskSchema = Type.Object({
35
49
  outputKinds: Type.Optional(Type.Array(Type.String())),
36
50
  requiredTools: Type.Optional(Type.Array(Type.String())),
37
51
  requiredSkills: Type.Optional(Type.Array(Type.String())),
38
- requestedAgentId: Type.Optional(Type.String())
52
+ requestedAgentId: Type.Optional(Type.String({
53
+ minLength: 1,
54
+ description: "Only an executor explicitly named by the human user. Omit this field when the background router should choose; never infer it from the specialist directory."
55
+ }))
39
56
  })),
40
57
  selectionReason: Type.Optional(Type.String({ maxLength: 500 })),
41
58
  selectionSource: Type.Optional(Type.Union([
@@ -48,9 +65,19 @@ const PersonalTaskSchema = Type.Object({
48
65
  requestId: Type.Optional(Type.String()),
49
66
  cursor: Type.Optional(Type.String()),
50
67
  offset: Type.Optional(Type.Integer({ minimum: 0 })),
68
+ limit: Type.Optional(Type.Integer({
69
+ minimum: 1,
70
+ maximum: 20
71
+ })),
51
72
  title: Type.Optional(Type.String({ description: "Short task title, ideally under 60 characters. Do not put the full instructions here." })),
52
- objective: Type.Optional(Type.String({ description: "One-sentence outcome for a new delegated Task." })),
53
- description: Type.Optional(Type.String({ description: "Full task brief in Markdown: background, specific requests, source material, and delivery expectations." })),
73
+ objective: Type.Optional(Type.String({
74
+ minLength: 1,
75
+ description: "One-sentence outcome for a new delegated Task."
76
+ })),
77
+ description: Type.Optional(Type.String({
78
+ minLength: 1,
79
+ description: "Complete Markdown brief preserving the user request, input references, and delivery expectations. Optional structured fields need not repeat it."
80
+ })),
54
81
  agentId: Type.Optional(Type.String({ description: "Specialist Agent ID. Never use your own ID." })),
55
82
  taskId: Type.Optional(Type.String()),
56
83
  instruction: Type.Optional(Type.String({ description: "The user’s new direction for this delegated Task." })),
@@ -60,11 +87,62 @@ const PersonalTaskSchema = Type.Object({
60
87
  constraints: Type.Optional(Type.Array(Type.String())),
61
88
  requiredSkills: Type.Optional(Type.Array(Type.String({
62
89
  minLength: 1,
63
- description: "Canonical Skill names explicitly requested by the user. Verify through agents before creation."
90
+ description: "Only Skill names explicitly requested by the user. Forward them to the background router for validation; omit otherwise."
64
91
  }))),
65
92
  requiredTools: Type.Optional(Type.Array(Type.String({ description: "Tool names needed for this Task. Use names returned by agents; omit when matching by role or expertise." }))),
66
93
  idempotencyKey: Type.Optional(Type.String())
67
94
  });
95
+ const PersonalTaskModelSchema = Type.Object({
96
+ ...Type.Omit(PersonalTaskSchema, [
97
+ "agentId",
98
+ "selectionReason",
99
+ "selectionSource",
100
+ "previousSelectionId",
101
+ "matchId",
102
+ "cursor",
103
+ "requiredTools"
104
+ ]).properties,
105
+ requirements: Type.Optional(Type.Omit(PersonalTaskSchema.properties.requirements, ["requiredTools", "requiredSkills"], { additionalProperties: false })),
106
+ command: Type.Union([
107
+ "submit",
108
+ "list",
109
+ "get",
110
+ "instruct",
111
+ "answer",
112
+ "retry_allocation",
113
+ "selection",
114
+ "cancel"
115
+ ].map((command) => Type.Literal(command)))
116
+ }, {
117
+ additionalProperties: false,
118
+ anyOf: [
119
+ {
120
+ properties: { command: { const: "submit" } },
121
+ required: ["objective", "description"]
122
+ },
123
+ { properties: { command: { enum: ["list", "selection"] } } },
124
+ {
125
+ properties: { command: { enum: [
126
+ "get",
127
+ "retry_allocation",
128
+ "cancel"
129
+ ] } },
130
+ required: ["taskId"]
131
+ },
132
+ {
133
+ properties: { command: { const: "instruct" } },
134
+ required: ["taskId", "instruction"]
135
+ },
136
+ {
137
+ properties: { command: { const: "answer" } },
138
+ required: [
139
+ "taskId",
140
+ "instruction",
141
+ "questionId"
142
+ ]
143
+ }
144
+ ]
145
+ });
68
146
  const MAX_PERSONAL_TASK_TITLE = 60;
69
147
  function buildPersonalTaskBrief(input) {
70
148
  const fullObjective = input.objective.trim();
@@ -86,18 +164,20 @@ function createPersonalTaskTool(deps) {
86
164
  return {
87
165
  name: "personal_task",
88
166
  label: "Personal Task",
89
- description: "Use match with structured requirements to compare specialist profiles and eligibility evidence. Profiles declare expertise; they never grant access. When the snapshot suffices, create directly with requirements, selectionReason and selectionSource. selection reads a Task’s allocation history. Preserve idempotencyKey on uncertain retries; link alternatives with previousSelectionId. Find specialist Agents by role, availableTools, and model.available; delegate work, inspect Tasks, send instructions, or answer worker questions. Choose an Agent whose model.available is true. Before saying you cannot do a request, inspect another Agent. If a candidate fails, retry alternatives within the user’s authorization only when the user has not required a particular Agent or Skill. For explicitly requested Skills, use requiredSkills in agents and create; creation validates availability and includes them in the worker brief. agents can filter by requiredTools or requiredSkills; if none match, inspect unfiltered Agents. Return to the user quickly after creation.",
90
- parameters: PersonalTaskSchema,
167
+ description: "Submit objective and a concise complete description, then return after local persistence. Preserve the user request and source references without inventing an execution plan or extra requirements. Omit optional structured fields when they merely repeat the description. Describe required capabilities in the brief; the background Task Router selects one executor and checks its tools. Do not read input files, select Agents or invent tool names before submit. Set requirements.requestedAgentId only for an executor explicitly named by the user, using their ID or display name; preserve explicitly requested requiredSkills. get/list inspect existing Tasks with limit/offset; cancel stops a Task on explicit user instruction and reports execution stop confirmation; instruct/answer send context; retry_allocation retries selection before execution; selection explains assignment. Status and results return automatically. Preserve idempotencyKey on uncertain retries. Report only confirmed states.",
168
+ parameters: PersonalTaskModelSchema,
91
169
  mutatesWorkspace: true,
92
170
  mutationScope: "external",
93
171
  requiresExclusiveWorkspaceLock: false,
94
172
  finalGuardRelevant: true,
95
- async execute(toolCallId, input, signal) {
173
+ async execute(toolCallId, modelInput, signal) {
174
+ const input = modelInput;
96
175
  const conversationId = deps.getCurrentConversationId?.();
97
176
  const ownAgentId = deps.getCurrentAgentId?.();
98
177
  if (!conversationId || !ownAgentId || !isPersonalConversation(conversationId)) throw new Error("Personal conversation context is unavailable");
99
178
  const requirements = normalizeSpecialistRequirements({
100
179
  ...input.requirements,
180
+ requestedAgentId: input.requirements?.requestedAgentId?.trim() || void 0,
101
181
  version: 1,
102
182
  summary: input.requirements?.summary ?? (input.objective?.trim() || "Specialist discovery").slice(0, 300),
103
183
  requiredTools: [...input.requirements?.requiredTools ?? [], ...input.requiredTools ?? []],
@@ -150,13 +230,28 @@ function createPersonalTaskTool(deps) {
150
230
  }
151
231
  if (input.command === "selection") {
152
232
  if (!(input.taskId ? new TaskOriginRepository().owns(input.taskId, conversationId) : input.requestId ? getPersonalRequest(input.requestId)?.conversationId === conversationId : true)) throw new Error("Task or Request does not belong to this personal conversation");
233
+ const offset = input.offset ?? 0;
234
+ const limit = input.limit ?? 10;
235
+ const rows = new AgentSelectionRepository().list(conversationId, {
236
+ taskId: input.taskId,
237
+ requestId: input.requestId,
238
+ offset,
239
+ limit: limit + 1
240
+ });
241
+ const items = rows.slice(0, limit).map(({ candidates: _candidates, assessment, ...record }) => ({
242
+ ...record,
243
+ executor: {
244
+ id: assessment.id,
245
+ name: assessment.name
246
+ }
247
+ }));
153
248
  return {
154
249
  content: [{
155
250
  type: "text",
156
- text: JSON.stringify(new AgentSelectionRepository().list(conversationId, {
157
- taskId: input.taskId,
158
- requestId: input.requestId,
159
- offset: input.offset
251
+ text: JSON.stringify(boundedPersonalResult({
252
+ items,
253
+ offset,
254
+ ...rows.length > limit ? { nextOffset: offset + items.length } : {}
160
255
  }))
161
256
  }],
162
257
  details: {}
@@ -166,7 +261,37 @@ function createPersonalTaskTool(deps) {
166
261
  let pendingSelection;
167
262
  let command = input.command;
168
263
  let args = {};
169
- if (command === "create") {
264
+ if (command === "submit") {
265
+ const objective = input.objective?.trim();
266
+ if (!objective || !input.description?.trim()) throw new Error("objective and a complete description are required");
267
+ if (input.agentId) throw new Error("Use requirements.requestedAgentId for an explicitly requested executor");
268
+ const brief = buildPersonalTaskBrief({
269
+ title: input.title,
270
+ objective,
271
+ description: input.description
272
+ });
273
+ const inputId = getSessionInputState(conversationId).activeInputId;
274
+ const submissionKey = input.idempotencyKey?.trim() || selectionRequestHash({
275
+ sourceInput: inputId ?? toolCallId,
276
+ brief,
277
+ requirements,
278
+ expectedOutputs: input.expectedOutputs,
279
+ acceptanceCriteria: input.acceptanceCriteria,
280
+ constraints: input.constraints
281
+ });
282
+ command = "create";
283
+ args = {
284
+ ...brief,
285
+ createMode: "allocate",
286
+ requirements,
287
+ includeConversationContext: false,
288
+ expectedOutputs: input.expectedOutputs ?? [],
289
+ acceptanceCriteria: input.acceptanceCriteria ?? [],
290
+ constraints: input.constraints ?? [],
291
+ idempotencyKey: `personal-submit:${conversationId}:${selectionRequestHash(submissionKey)}`
292
+ };
293
+ if (requirements.requiredSkills?.length) args.body = `${brief.body}\n\nRequired Skills: ${requirements.requiredSkills.join(", ")}. Read and follow these Skills before execution.`;
294
+ } else if (command === "create") {
170
295
  const objective = input.objective?.trim();
171
296
  const agentId = input.agentId?.trim();
172
297
  if (!objective || !agentId) throw new Error("objective and specialist agentId are required");
@@ -250,12 +375,33 @@ function createPersonalTaskTool(deps) {
250
375
  };
251
376
  } else if (command === "list") {
252
377
  command = "delegated_tasks";
253
- args = { limit: 20 };
378
+ args = {
379
+ limit: input.limit ?? 10,
380
+ offset: input.offset ?? 0
381
+ };
254
382
  } else {
255
383
  const taskId = input.taskId?.trim();
256
384
  if (!taskId) throw new Error("taskId is required");
257
385
  if (!new TaskOriginRepository().owns(taskId, conversationId)) throw new Error("Task does not belong to this personal conversation");
258
- if (command === "instruct" || command === "answer") {
386
+ if (command === "cancel") {
387
+ const result = await cancelPersonalTask(taskId, conversationId, input.idempotencyKey ?? toolCallId);
388
+ deps.dispatchTaskRuns?.();
389
+ return {
390
+ content: [{
391
+ type: "text",
392
+ text: JSON.stringify(result)
393
+ }],
394
+ details: {}
395
+ };
396
+ }
397
+ if (command === "retry_allocation") {
398
+ command = "command";
399
+ args = {
400
+ taskId,
401
+ type: "retry_allocation",
402
+ expectedVersion: new TaskRepository().require(taskId).version
403
+ };
404
+ } else if (command === "instruct" || command === "answer") {
259
405
  const body = input.instruction?.trim();
260
406
  if (!body) throw new Error("instruction is required");
261
407
  if (command === "answer" && !input.questionId?.trim()) throw new Error("questionId is required");
@@ -269,12 +415,76 @@ function createPersonalTaskTool(deps) {
269
415
  } else args = { taskId };
270
416
  }
271
417
  try {
418
+ const result = await selectedProductTool.execute(toolCallId, {
419
+ mode: "task",
420
+ command,
421
+ args
422
+ }, signal, void 0);
423
+ if ((input.command === "answer" || input.command === "instruct") && input.taskId && result.details.result && result.details.result.ok !== false) {
424
+ const allocation = new TaskAllocationRepository().get(input.taskId);
425
+ if (allocation && ["blocked", "failed"].includes(allocation.status)) {
426
+ new TaskApplicationService().execute({
427
+ taskId: input.taskId,
428
+ expectedVersion: new TaskRepository().require(input.taskId).version,
429
+ idempotencyKey: `allocation-answer:${toolCallId}`,
430
+ command: { type: "retry_allocation" },
431
+ actor: {
432
+ kind: "agent",
433
+ id: ownAgentId
434
+ }
435
+ });
436
+ deps.dispatchTaskRuns?.();
437
+ }
438
+ }
439
+ const payload = result.details.result;
440
+ if (payload?.ok === true && input.command === "submit") {
441
+ const task = payload.task;
442
+ const confirmation = {
443
+ ok: true,
444
+ task: {
445
+ id: task.id,
446
+ title: task.title,
447
+ phase: task.phase,
448
+ version: task.version
449
+ },
450
+ operationalState: payload.operationalState,
451
+ allocation: payload.allocation,
452
+ runId: payload.runId
453
+ };
454
+ return {
455
+ content: [{
456
+ type: "text",
457
+ text: appendProductDeliveryText(JSON.stringify(confirmation, null, 2), result.details.delivery)
458
+ }],
459
+ details: {}
460
+ };
461
+ }
462
+ if (payload && input.command === "get") return {
463
+ content: [{
464
+ type: "text",
465
+ text: JSON.stringify(boundedPersonalResult({
466
+ ok: payload.ok,
467
+ task: payload.task,
468
+ allocation: new TaskAllocationRepository().summary(input.taskId),
469
+ operationalState: payload.operationalState,
470
+ attention: payload.attention,
471
+ allowedCommands: payload.allowedCommands
472
+ }))
473
+ }],
474
+ details: {}
475
+ };
476
+ if (payload && input.command === "list") return {
477
+ content: [{
478
+ type: "text",
479
+ text: JSON.stringify(boundedPersonalResult({
480
+ ...payload,
481
+ offset: input.offset ?? 0
482
+ }))
483
+ }],
484
+ details: {}
485
+ };
272
486
  return {
273
- content: (await selectedProductTool.execute(toolCallId, {
274
- mode: "task",
275
- command,
276
- args
277
- }, signal, void 0)).content,
487
+ content: result.content,
278
488
  details: {}
279
489
  };
280
490
  } catch (error) {
@@ -1,9 +1,9 @@
1
1
  import { turnOutcomeKindFromFileName, turnOutcomeMimeTypeFromFileName } from "../../../packages/gateway-contract/src/turn-outcome.js";
2
2
  import { init_src } from "../../../packages/gateway-contract/src/index.js";
3
- import { fileResourceId, fileSpaceId } from "../../files/file-service.js";
4
- import { resolvePathUnderWorkspace } from "./tool-paths.js";
5
3
  import { evaluateFilePolicy } from "../sandbox/exec-policy.js";
6
4
  import { readWorkspaceFile } from "../sandbox/fileAccess.js";
5
+ import { resolvePathUnderWorkspace } from "./tool-paths.js";
6
+ import { fileResourceId, fileSpaceId } from "../../files/file-service.js";
7
7
  import { persistToolMedia } from "./tool-media.js";
8
8
  import { basename, isAbsolute, relative, sep } from "node:path";
9
9
  import { realpath } from "node:fs/promises";