@xopcai/xopc 0.0.386 → 0.0.388

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 (469) 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/feishu/src/adapters/cli-login.js +3 -3
  4. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  5. package/dist/extensions/telegram/src/inbound-processor.js +2 -2
  6. package/dist/extensions/telegram/src/outbound-sender.js +1 -1
  7. package/dist/extensions/telegram/src/plugin.js +2 -2
  8. package/dist/extensions/telegram/xopc.extension.json +1 -1
  9. package/dist/extensions/weixin/src/api/api.js +2 -2
  10. package/dist/extensions/weixin/src/auth/accounts.js +12 -12
  11. package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
  12. package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
  13. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D-86VOlb.js → agent-avatar-dicebear-44LqtGte.js} +1 -1
  14. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-SmeUVHY8.js → agent-defaults-settings-panel-2VA4eKPf.js} +1 -1
  15. package/dist/gateway/static/root/assets/{agent-plugin-dialog-BVT3wXq5.js → agent-plugin-dialog-DRhTOw_O.js} +1 -1
  16. package/dist/gateway/static/root/assets/{agents-D7rLQFhX.js → agents-BemUH_Yf.js} +3 -3
  17. package/dist/gateway/static/root/assets/{app-management-settings-panel-CUR7n5iP.js → app-management-settings-panel-CR_cc7rj.js} +1 -1
  18. package/dist/gateway/static/root/assets/{appearance-settings-BCotSGep.js → appearance-settings-CYofu-su.js} +1 -1
  19. package/dist/gateway/static/root/assets/{apps-page-hk0bo9LT.js → apps-page-CHjWvDjk.js} +1 -1
  20. package/dist/gateway/static/root/assets/{automations-page-CqxuUwox.js → automations-page-BIF0skon.js} +1 -1
  21. package/dist/gateway/static/root/assets/{automations-workspace-11_Z69pr.js → automations-workspace-DOwtT4sS.js} +1 -1
  22. package/dist/gateway/static/root/assets/{block-editor-eldB84Mj.js → block-editor-C_RD603p.js} +1 -1
  23. package/dist/gateway/static/root/assets/{browser-automations-page-D4TaUPYT.js → browser-automations-page-B-Ezk_8l.js} +1 -1
  24. package/dist/gateway/static/root/assets/{browser-settings-page-BXRlxeGV.js → browser-settings-page-BSmmTBn4.js} +2 -2
  25. package/dist/gateway/static/root/assets/{capabilities-DVj9n65C.js → capabilities-BX1rCiVm.js} +1 -1
  26. package/dist/gateway/static/root/assets/{capabilities-BkKgImWi.js → capabilities-CW389yo6.js} +1 -1
  27. package/dist/gateway/static/root/assets/{capabilities-page-CyYlueEd.js → capabilities-page-xZgTYYDn.js} +2 -2
  28. package/dist/gateway/static/root/assets/{capabilities-settings-panel-uVEgfvo0.js → capabilities-settings-panel-oqkuOjcR.js} +3 -3
  29. package/dist/gateway/static/root/assets/{capability-header-actions-BXv0xu56.js → capability-header-actions-Chuhscdb.js} +1 -1
  30. package/dist/gateway/static/root/assets/{channels-fNb3SOzm.js → channels-Dq2C2k9M.js} +1 -1
  31. package/dist/gateway/static/root/assets/{chat-terminal-dock-CnLtparQ.js → chat-terminal-dock-srB_M-aQ.js} +1 -1
  32. package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-BMYIfy9x.js → chunk-KS7C4IRE--EKdQGRF.js} +1 -1
  33. package/dist/gateway/static/root/assets/{computer-settings-page-xM0AnOlP.js → computer-settings-page-Af00Kjc0.js} +1 -1
  34. package/dist/gateway/static/root/assets/{connector-service-page-CdG2WUb6.js → connector-service-page-3W0_7-4L.js} +1 -1
  35. package/dist/gateway/static/root/assets/{connectors-page-BRd08GH6.js → connectors-page-BZk-Gou5.js} +1 -1
  36. package/dist/gateway/static/root/assets/constants-DeXt1mV-.js +1 -0
  37. package/dist/gateway/static/root/assets/{date-picker-DIBbE-O8.js → date-picker-DBgZBmik.js} +1 -1
  38. package/dist/gateway/static/root/assets/{dependency-picker-DDD8zokD.js → dependency-picker-BDJ406kH.js} +1 -1
  39. package/dist/gateway/static/root/assets/{desktop-pet-KlF390Xn.js → desktop-pet-Do1XPn6U.js} +1 -1
  40. package/dist/gateway/static/root/assets/{desktop-pet-settings-CgqQMKDC.js → desktop-pet-settings-LKeVh6OH.js} +1 -1
  41. package/dist/gateway/static/root/assets/{device-pairing-wizard-BR6isfG2.js → device-pairing-wizard-CvZpnSVw.js} +1 -1
  42. package/dist/gateway/static/root/assets/{directory-picker-path-field-vPQsW05P.js → directory-picker-path-field-BMLHoL6g.js} +1 -1
  43. package/dist/gateway/static/root/assets/{extension-debug-page-ZHLPrLbH.js → extension-debug-page-B0wTBCx4.js} +1 -1
  44. package/dist/gateway/static/root/assets/{extension-page-DJ42KFRN.js → extension-page-vR2r4uUB.js} +1 -1
  45. package/dist/gateway/static/root/assets/{extension-provider-6IcsyNaV.js → extension-provider-CJZ5EVpQ.js} +1 -1
  46. package/dist/gateway/static/root/assets/{extension-settings-page-D7-5v0V4.js → extension-settings-page-1tbWe5xQ.js} +1 -1
  47. package/dist/gateway/static/root/assets/{fallback-models-DnYn7qOV.js → fallback-models-CW6a1-GK.js} +1 -1
  48. package/dist/gateway/static/root/assets/{gateway-settings-Bwe3JWX-.js → gateway-settings-vQWTUx2c.js} +1 -1
  49. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-DefTxF3q.js → highlighted-body-KQOG7T2V-BM__yiMn.js} +1 -1
  50. package/dist/gateway/static/root/assets/home-page-hfWuVtcG.js +2 -0
  51. package/dist/gateway/static/root/assets/{imports-page-CTdBYZib.js → imports-page-CuR6RSUM.js} +1 -1
  52. package/dist/gateway/static/root/assets/index-CNH8vwcY.js +260 -0
  53. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CXKp57O_.js → keyboard-shortcuts-settings-DpyqH2cP.js} +1 -1
  54. package/dist/gateway/static/root/assets/{local-app-workbench-page-DzD_OzGY.js → local-app-workbench-page-B4hIoxV8.js} +1 -1
  55. package/dist/gateway/static/root/assets/{local-apps-page-B0E0vttg.js → local-apps-page-S7lUpENM.js} +1 -1
  56. package/dist/gateway/static/root/assets/local-session-drafts-Be4BGM4Z.js +1 -0
  57. package/dist/gateway/static/root/assets/{logs-page-eL4fYcMl.js → logs-page-CSlZT1-L.js} +1 -1
  58. package/dist/gateway/static/root/assets/{management-settings-DSpjodMC.js → management-settings-BYCL5CwV.js} +1 -1
  59. package/dist/gateway/static/root/assets/{markdown-view-DHfQAvZQ.js → markdown-view-CBjl-XEc.js} +2 -2
  60. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-i9N5shss.js +1 -0
  61. package/dist/gateway/static/root/assets/{note-detail-panel-CsY5tQp5.js → note-detail-panel-CJ5Earr_.js} +3 -3
  62. package/dist/gateway/static/root/assets/{notes-api-nqN2wKYc.js → notes-api-BlGP533W.js} +1 -1
  63. package/dist/gateway/static/root/assets/{notes-page-D09LjNoj.js → notes-page-CPGk8-n1.js} +5 -5
  64. package/dist/gateway/static/root/assets/{page-context-capture-button-DO-aP3D9.js → page-context-capture-button-C2bSXVbz.js} +1 -1
  65. package/dist/gateway/static/root/assets/{personal-page-E8F2aGNB.js → personal-page-BjTt5R3s.js} +1 -1
  66. package/dist/gateway/static/root/assets/product-open-page-Cn16lm5l.js +1 -0
  67. package/dist/gateway/static/root/assets/{product-preview-content-B-cz-pIV.js → product-preview-content-CowgeuoG.js} +1 -1
  68. package/dist/gateway/static/root/assets/{project-detail-page-WhefAh8E.js → project-detail-page-CyKx4PyN.js} +1 -1
  69. package/dist/gateway/static/root/assets/{projects-page-CyqAs0tO.js → projects-page--_hXxUMC.js} +1 -1
  70. package/dist/gateway/static/root/assets/{remote-access-hub-BwhRGL6m.js → remote-access-hub-Bq_eqQYf.js} +1 -1
  71. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-o26dmPNq.js → runtime-tools-settings-panel-BgCATci5.js} +1 -1
  72. package/dist/gateway/static/root/assets/{scenes-page-D_e19kv_.js → scenes-page-DxE3jRPR.js} +2 -2
  73. package/dist/gateway/static/root/assets/{schema-form-DLLdqUC3.js → schema-form-I6pzJJzg.js} +1 -1
  74. package/dist/gateway/static/root/assets/{send-session-input-2I-nFJcE.js → send-session-input-C293-Hbx.js} +1 -1
  75. package/dist/gateway/static/root/assets/{session-manager-Co5ozD0l.js → session-manager-COd9RECl.js} +2 -2
  76. package/dist/gateway/static/root/assets/{sessions-page-DX6INsiS.js → sessions-page-CQkGFnJM.js} +1 -1
  77. package/dist/gateway/static/root/assets/settings-advanced-gate-Dtlsvsci.js +1 -0
  78. package/dist/gateway/static/root/assets/{settings-page-Bc_zxxRu.js → settings-page-Dy5oQDbx.js} +1 -1
  79. package/dist/gateway/static/root/assets/{setup-status-panel-FpF_cPPr.js → setup-status-panel-CrAazq4r.js} +1 -1
  80. package/dist/gateway/static/root/assets/{share-link-dialog-C47Xgzta.js → share-link-dialog-BKGI8Kr0.js} +1 -1
  81. package/dist/gateway/static/root/assets/{share-preview-page-BOCcPBqQ.js → share-preview-page-BF2WaO43.js} +1 -1
  82. package/dist/gateway/static/root/assets/{shares-settings-CInxjxgJ.js → shares-settings-BNMhs-Vd.js} +1 -1
  83. package/dist/gateway/static/root/assets/{skill-api-Bjd8WAA4.js → skill-api-RIjxQs-Y.js} +1 -1
  84. package/dist/gateway/static/root/assets/{skills-page-8CKS3Oo2.js → skills-page-XVOxILQn.js} +1 -1
  85. package/dist/gateway/static/root/assets/{system-settings-panel-BgQdsrNw.js → system-settings-panel-C8aLy8T_.js} +1 -1
  86. package/dist/gateway/static/root/assets/{task-detail-page-BnG5ehZ6.js → task-detail-page-o1O2IDVP.js} +2 -2
  87. package/dist/gateway/static/root/assets/{task-expandable-content-BCuc70Vc.js → task-expandable-content-C9ohICpw.js} +1 -1
  88. package/dist/gateway/static/root/assets/{tunnel-api-CY7MoDGf.js → tunnel-api-JkDu1wiC.js} +1 -1
  89. package/dist/gateway/static/root/assets/{usage-page-s8Sv_PIG.js → usage-page-B8K6Y4ro.js} +1 -1
  90. package/dist/gateway/static/root/assets/{use-composer-attachments-D0S2iZF4.js → use-composer-attachments-rgW7h4sD.js} +1 -1
  91. package/dist/gateway/static/root/assets/{use-file-preview-expanded-BElqELib.js → use-file-preview-expanded-DSKIxfz9.js} +1 -1
  92. package/dist/gateway/static/root/assets/{user-model-page-CyWrEtHY.js → user-model-page-C1QX47VR.js} +2 -2
  93. package/dist/gateway/static/root/assets/{work-discovery-overlay-DmZXLs1v.js → work-discovery-overlay-BshsEDRO.js} +1 -1
  94. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BdLOzHm4.js → workflow-run-setup-panel-CRG3paWy.js} +1 -1
  95. package/dist/gateway/static/root/assets/{workflows-page-Cx3I3AV5.js → workflows-page-c-AoSVzm.js} +3 -3
  96. package/dist/gateway/static/root/assets/{workspace-api-Du7-xJ0q.js → workspace-api-JWHOFos6.js} +2 -2
  97. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-D8B136vW.js → xopc-cloud-account-card-PDSIicr1.js} +1 -1
  98. package/dist/gateway/static/root/index.html +15 -15
  99. package/dist/package.js +1 -1
  100. package/dist/packages/gateway-contract/src/index.js +2 -0
  101. package/dist/packages/gateway-contract/src/result-reference.js +25 -0
  102. package/dist/packages/gateway-contract/src/session-input-command.js +2 -1
  103. package/dist/packages/gateway-contract/src/task-research-result.js +1 -0
  104. package/dist/packages/gateway-contract/src/task-result-delivery.js +21 -0
  105. package/dist/packages/gateway-contract/src/turn-outcome.js +1 -0
  106. package/dist/src/agent/agent-manager.js +16 -16
  107. package/dist/src/agent/agent-scope.js +2 -2
  108. package/dist/src/agent/background-review/prompts.js +1 -1
  109. package/dist/src/agent/background-review/run-background-review.js +9 -9
  110. package/dist/src/agent/child-agent-factory.js +1 -1
  111. package/dist/src/agent/coding/repository-instructions.js +1 -1
  112. package/dist/src/agent/context/coordinator.js +2 -2
  113. package/dist/src/agent/context/execution-context.js +4 -4
  114. package/dist/src/agent/context/execution-scope.js +1 -1
  115. package/dist/src/agent/context/project-context.js +3 -3
  116. package/dist/src/agent/data-acquisition/service.js +1 -1
  117. package/dist/src/agent/embedded/codemode-extension.js +1 -1
  118. package/dist/src/agent/embedded/run-for-session.js +5 -5
  119. package/dist/src/agent/embedded/run-turn.js +13 -13
  120. package/dist/src/agent/embedded/session-runner.js +3 -3
  121. package/dist/src/agent/embedded/session-tool-result-guard.js +2 -2
  122. package/dist/src/agent/embedded/tool-result-truncation.js +1 -1
  123. package/dist/src/agent/embedded/xopc-tools-bridge.js +13 -2
  124. package/dist/src/agent/external-tools/cliProvider.js +4 -4
  125. package/dist/src/agent/external-tools/composio-provider.js +3 -3
  126. package/dist/src/agent/external-tools/endpoint-provider.js +4 -4
  127. package/dist/src/agent/external-tools/gateway-tools.js +3 -3
  128. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  129. package/dist/src/agent/image/generation/runtime.js +1 -1
  130. package/dist/src/agent/image/index.js +1 -1
  131. package/dist/src/agent/image/load-image-media.js +1 -1
  132. package/dist/src/agent/inbound/attachment-pipeline.js +4 -4
  133. package/dist/src/agent/inbound/inbound-loop.js +2 -2
  134. package/dist/src/agent/index.js +3 -3
  135. package/dist/src/agent/memory/context-budget.js +1 -1
  136. package/dist/src/agent/memory/context-recovery.js +1 -1
  137. package/dist/src/agent/memory/index.js +1 -1
  138. package/dist/src/agent/orchestration/llm-turn-retry.js +1 -1
  139. package/dist/src/agent/prompt/response-language.js +1 -1
  140. package/dist/src/agent/prompt/service-prompt-builder.js +3 -3
  141. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  142. package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -0
  143. package/dist/src/agent/service/direct-turn-helpers.js +8 -4
  144. package/dist/src/agent/service/process-direct-one-shot.js +4 -1
  145. package/dist/src/agent/service/process-direct-streaming.js +7 -6
  146. package/dist/src/agent/service/webchat-tts.js +2 -2
  147. package/dist/src/agent/service.js +21 -21
  148. package/dist/src/agent/session/session-config-service.js +3 -3
  149. package/dist/src/agent/session/session-hydrator.js +1 -1
  150. package/dist/src/agent/session/session-inspector.js +1 -1
  151. package/dist/src/agent/skills/filesystem-watcher.js +1 -1
  152. package/dist/src/agent/skills/hub-pull.js +2 -2
  153. package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
  154. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
  155. package/dist/src/agent/source-context/index.js +2 -2
  156. package/dist/src/agent/source-context/result-context.d.ts +2 -0
  157. package/dist/src/agent/source-context/result-context.js +32 -0
  158. package/dist/src/agent/source-context/types.d.ts +2 -2
  159. package/dist/src/agent/source-context/types.js +1 -1
  160. package/dist/src/agent/tasks/task-judge-service.js +7 -7
  161. package/dist/src/agent/tools/create-share-tool.js +3 -3
  162. package/dist/src/agent/tools/dataBatch.js +1 -1
  163. package/dist/src/agent/tools/delegate-tool.js +3 -3
  164. package/dist/src/agent/tools/exec-command.js +47 -2
  165. package/dist/src/agent/tools/executor.js +1 -1
  166. package/dist/src/agent/tools/factory.js +35 -28
  167. package/dist/src/agent/tools/image-generate-tool.js +3 -3
  168. package/dist/src/agent/tools/index.js +6 -6
  169. package/dist/src/agent/tools/list-dir.js +1 -1
  170. package/dist/src/agent/tools/personal-attention-tool.js +2 -2
  171. package/dist/src/agent/tools/personal-performance.d.ts +2 -0
  172. package/dist/src/agent/tools/personal-performance.js +82 -0
  173. package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
  174. package/dist/src/agent/tools/personal-request-tool.js +3 -3
  175. package/dist/src/agent/tools/personal-result-tool.d.ts +2 -0
  176. package/dist/src/agent/tools/personal-result-tool.js +106 -0
  177. package/dist/src/agent/tools/personal-task-tool.d.ts +11 -1
  178. package/dist/src/agent/tools/personal-task-tool.js +110 -6
  179. package/dist/src/agent/tools/publish-artifacts.js +2 -2
  180. package/dist/src/agent/tools/read.js +2 -2
  181. package/dist/src/agent/tools/review-workspace.js +21 -2
  182. package/dist/src/agent/tools/send-media.js +2 -2
  183. package/dist/src/agent/tools/skills-tools.js +1 -1
  184. package/dist/src/agent/tools/task-collaboration-tool.d.ts +9 -1
  185. package/dist/src/agent/tools/task-collaboration-tool.js +122 -3
  186. package/dist/src/agent/tools/task-evidence.d.ts +3 -0
  187. package/dist/src/agent/tools/task-evidence.js +71 -0
  188. package/dist/src/agent/tools/task-result-tool.js +24 -4
  189. package/dist/src/agent/tools/tool-media.js +1 -1
  190. package/dist/src/agent/tools/tts-tool.js +1 -1
  191. package/dist/src/agent/tools/user-context-tool.js +1 -1
  192. package/dist/src/agent/tools/write.js +2 -2
  193. package/dist/src/agent/tools/xopc-use-tool.js +26 -5
  194. package/dist/src/agent/transcript/index.js +2 -2
  195. package/dist/src/agent/transcript/transcript-hygiene.js +2 -2
  196. package/dist/src/agent/workflow/subagent-runner.js +1 -1
  197. package/dist/src/agent-matching/delegation-service.js +1 -1
  198. package/dist/src/ai-assist/text-assist.js +1 -1
  199. package/dist/src/auth/oauth/xopc-cloud.js +2 -2
  200. package/dist/src/auth/sync-provider-auth.js +1 -1
  201. package/dist/src/automations/domain/index.js +1 -1
  202. package/dist/src/automations/draft/automation-draft-service.js +1 -1
  203. package/dist/src/automations/index.js +2 -2
  204. package/dist/src/browser/native-messaging-host.js +1 -1
  205. package/dist/src/capabilities/store-connector.js +2 -2
  206. package/dist/src/channels/attachments/voice-stt-webchat.js +2 -2
  207. package/dist/src/channels/index.js +2 -2
  208. package/dist/src/channels/outbound-sender.js +1 -1
  209. package/dist/src/channels/pairing/allow-from-file.js +9 -9
  210. package/dist/src/channels/pairing/pairing-store.js +6 -6
  211. package/dist/src/chat-commands/builtins/config.js +4 -4
  212. package/dist/src/chat-commands/builtins/session.js +1 -1
  213. package/dist/src/chat-commands/builtins/thinking.js +1 -1
  214. package/dist/src/chat-commands/builtins/tts.js +1 -1
  215. package/dist/src/chat-commands/context.js +2 -2
  216. package/dist/src/chat-commands/index.js +3 -3
  217. package/dist/src/cli/commands/agent.js +7 -7
  218. package/dist/src/cli/commands/config.js +1 -1
  219. package/dist/src/cli/commands/connectors.js +1 -1
  220. package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
  221. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  222. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
  223. package/dist/src/cli/commands/extension-dev.js +1 -1
  224. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  225. package/dist/src/cli/commands/extension.js +2 -2
  226. package/dist/src/cli/commands/image.js +1 -1
  227. package/dist/src/cli/commands/init.js +1 -1
  228. package/dist/src/cli/commands/mcp.js +1 -1
  229. package/dist/src/cli/commands/models.js +2 -2
  230. package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
  231. package/dist/src/cli/commands/onboard/model.js +1 -1
  232. package/dist/src/cli/commands/onboard.js +1 -1
  233. package/dist/src/cli/commands/project.js +1 -1
  234. package/dist/src/cli/commands/skills.js +2 -2
  235. package/dist/src/cli/commands/tunnel.js +4 -4
  236. package/dist/src/cli/extension-cli-register.js +6 -6
  237. package/dist/src/cli/utils/gateway-client.js +1 -1
  238. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  239. package/dist/src/cli/utils/session.js +1 -1
  240. package/dist/src/computer/runtime.js +1 -1
  241. package/dist/src/config/index.js +5 -5
  242. package/dist/src/config/loader.js +2 -2
  243. package/dist/src/config/models-json.js +1 -1
  244. package/dist/src/config/schema.js +5 -5
  245. package/dist/src/connectors/cli/authorization.js +1 -1
  246. package/dist/src/connectors/cli/runtime.js +1 -1
  247. package/dist/src/connectors/composio-sessions.js +1 -1
  248. package/dist/src/connectors/composio.js +1 -1
  249. package/dist/src/connectors/connected-source-ingestion.js +4 -4
  250. package/dist/src/connectors/connected-source-understanding.js +4 -4
  251. package/dist/src/connectors/connection-recovery-service.js +5 -5
  252. package/dist/src/connectors/content-enrichment.js +1 -1
  253. package/dist/src/connectors/health.js +1 -1
  254. package/dist/src/connectors/learning-coordinator.js +1 -1
  255. package/dist/src/discussions/live-worker.js +1 -1
  256. package/dist/src/discussions/sealer.js +1 -1
  257. package/dist/src/endpoint-tools/index.js +1 -1
  258. package/dist/src/endpoint-tools/runtime.js +2 -2
  259. package/dist/src/extensions/activation-context.js +3 -3
  260. package/dist/src/extensions/agent-plugins/auth.js +1 -1
  261. package/dist/src/extensions/agent-plugins/credentials.js +1 -1
  262. package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
  263. package/dist/src/extensions/api.js +4 -4
  264. package/dist/src/extensions/bundled-extension-activation.js +1 -1
  265. package/dist/src/extensions/index.js +3 -3
  266. package/dist/src/extensions/install.js +1 -1
  267. package/dist/src/extensions/loader.js +2 -2
  268. package/dist/src/extensions/sdk/index.js +1 -1
  269. package/dist/src/extensions/sdk/media.js +1 -1
  270. package/dist/src/extensions/update.js +1 -1
  271. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  272. package/dist/src/gateway/agents-admin.js +1 -1
  273. package/dist/src/gateway/device-routes.js +2 -2
  274. package/dist/src/gateway/file-path-classifier.js +2 -2
  275. package/dist/src/gateway/global-defaults-admin.js +1 -1
  276. package/dist/src/gateway/hono/app.js +3 -3
  277. package/dist/src/gateway/hono/lib/config-payload.js +4 -4
  278. package/dist/src/gateway/hono/routes/agent-stream.js +1 -1
  279. package/dist/src/gateway/hono/routes/agents.js +1 -1
  280. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  281. package/dist/src/gateway/hono/routes/commands-skills.js +4 -4
  282. package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
  283. package/dist/src/gateway/hono/routes/config-patch/misc.js +4 -4
  284. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  285. package/dist/src/gateway/hono/routes/context-sources.js +2 -2
  286. package/dist/src/gateway/hono/routes/endpoint-tools.js +1 -1
  287. package/dist/src/gateway/hono/routes/home.js +1 -1
  288. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  289. package/dist/src/gateway/hono/routes/memory-learning.js +3 -3
  290. package/dist/src/gateway/hono/routes/models.js +5 -5
  291. package/dist/src/gateway/hono/routes/notes.js +1 -1
  292. package/dist/src/gateway/hono/routes/personal-agent.js +1 -1
  293. package/dist/src/gateway/hono/routes/projects.js +3 -3
  294. package/dist/src/gateway/hono/routes/runtime-tools.js +1 -1
  295. package/dist/src/gateway/hono/routes/session-command-handler.js +2 -2
  296. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -2
  297. package/dist/src/gateway/hono/routes/session-input-handler.js +5 -5
  298. package/dist/src/gateway/hono/routes/sessions.js +3 -3
  299. package/dist/src/gateway/hono/routes/shares.js +2 -2
  300. package/dist/src/gateway/hono/routes/side-chats.js +1 -1
  301. package/dist/src/gateway/hono/routes/site-shares.js +1 -1
  302. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  303. package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
  304. package/dist/src/gateway/hono/routes/user-model.js +7 -7
  305. package/dist/src/gateway/hono/routes/voice.js +7 -7
  306. package/dist/src/gateway/hono/routes/workflows.js +1 -1
  307. package/dist/src/gateway/index.js +1 -1
  308. package/dist/src/gateway/lock.js +11 -11
  309. package/dist/src/gateway/media-access.js +2 -2
  310. package/dist/src/gateway/mobile-privacy.js +2 -2
  311. package/dist/src/gateway/ports.js +6 -6
  312. package/dist/src/gateway/run-loop.js +1 -1
  313. package/dist/src/gateway/scenes/mailContext.js +1 -1
  314. package/dist/src/gateway/scenes/slackThreadSource.js +1 -1
  315. package/dist/src/gateway/server.js +1 -1
  316. package/dist/src/gateway/service/agent-runner.js +3 -3
  317. package/dist/src/gateway/service/config-coordinator.js +2 -2
  318. package/dist/src/gateway/service/marketplace-service.js +2 -2
  319. package/dist/src/gateway/service/run-gateway-agent.js +24 -5
  320. package/dist/src/gateway/service/session-command-service.js +2 -2
  321. package/dist/src/gateway/service/session-input-coordinator.js +2 -2
  322. package/dist/src/gateway/service.js +72 -41
  323. package/dist/src/gateway/session-context-summary.js +4 -4
  324. package/dist/src/gateway/workspace-editor-path.js +2 -2
  325. package/dist/src/home-intelligence/generator.js +2 -2
  326. package/dist/src/home-intelligence/host.js +2 -2
  327. package/dist/src/imports/compatibility.js +1 -1
  328. package/dist/src/imports/inventory.js +3 -3
  329. package/dist/src/imports/productImport.js +2 -2
  330. package/dist/src/imports/runtime.js +1 -1
  331. package/dist/src/infra/gateway-processes.js +2 -2
  332. package/dist/src/infra/path-env.js +3 -3
  333. package/dist/src/infra/update-global.js +9 -9
  334. package/dist/src/knowledge/connected-knowledge-pipeline.js +2 -2
  335. package/dist/src/knowledge/index.js +1 -1
  336. package/dist/src/knowledge-memory/repository.js +1 -1
  337. package/dist/src/local-apps/service.js +2 -2
  338. package/dist/src/mcp/gateway-http-client.js +1 -1
  339. package/dist/src/media/session-references.js +1 -1
  340. package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
  341. package/dist/src/memory-learning/source-learning.js +4 -4
  342. package/dist/src/memory-learning/task-receipts.js +1 -1
  343. package/dist/src/notes/agent-context.js +4 -4
  344. package/dist/src/notes/index.js +1 -1
  345. package/dist/src/notes/service.js +3 -3
  346. package/dist/src/personal-agent/capability-service.js +2 -2
  347. package/dist/src/personal-agent/communication.js +1 -0
  348. package/dist/src/personal-agent/performance.d.ts +83 -0
  349. package/dist/src/personal-agent/performance.js +65 -0
  350. package/dist/src/personal-agent/policy.d.ts +1 -1
  351. package/dist/src/personal-agent/policy.js +1 -0
  352. package/dist/src/personal-agent/proactivity/routes.js +1 -1
  353. package/dist/src/personal-agent/proactivity/service.js +7 -7
  354. package/dist/src/personal-agent/prompt-context.js +9 -7
  355. package/dist/src/personal-agent/prompts.js +7 -4
  356. package/dist/src/personal-agent/reply-composer.js +86 -15
  357. package/dist/src/personal-agent/request-delivery.js +5 -3
  358. package/dist/src/personal-agent/request-service.js +5 -5
  359. package/dist/src/personal-agent/result-extraction.d.ts +42 -0
  360. package/dist/src/personal-agent/result-extraction.js +209 -0
  361. package/dist/src/personal-agent/result-read-continuations.d.ts +13 -0
  362. package/dist/src/personal-agent/result-read-continuations.js +78 -0
  363. package/dist/src/personal-agent/result-reader.d.ts +43 -0
  364. package/dist/src/personal-agent/result-reader.js +461 -0
  365. package/dist/src/personal-agent/service.js +1 -1
  366. package/dist/src/personal-agent/task-cancel.js +1 -1
  367. package/dist/src/platform/index.js +1 -1
  368. package/dist/src/projects/index.js +1 -1
  369. package/dist/src/projects/project-agent-suggestion.js +1 -1
  370. package/dist/src/projects/project-service.js +1 -1
  371. package/dist/src/projects/project-skill-service.js +2 -2
  372. package/dist/src/projects/workspace.js +1 -1
  373. package/dist/src/providers/model-reference-auditor.js +1 -1
  374. package/dist/src/providers/model-registry.js +1 -1
  375. package/dist/src/realtime/runtime.js +1 -1
  376. package/dist/src/remote-access/exposure-manager.js +1 -1
  377. package/dist/src/routing/agent-session-key.js +1 -1
  378. package/dist/src/scenes/taskFollowUp/agentExecutor.js +4 -4
  379. package/dist/src/scenes/taskFollowUp/resources.js +2 -2
  380. package/dist/src/scenes/taskFollowUp/service.js +6 -6
  381. package/dist/src/session/client-history.d.ts +1 -1
  382. package/dist/src/session/client-history.js +1 -1
  383. package/dist/src/session/index.js +2 -2
  384. package/dist/src/session/init-session-turn.js +1 -1
  385. package/dist/src/session/resolve-session.js +1 -1
  386. package/dist/src/session/session-context-for-llm.js +2 -0
  387. package/dist/src/session/store.js +5 -5
  388. package/dist/src/session/thinking-resolve.js +1 -1
  389. package/dist/src/share/hosted-session-share.js +2 -2
  390. package/dist/src/share/session-share-service.js +1 -1
  391. package/dist/src/share/share-store.js +1 -1
  392. package/dist/src/share/share-thumbnail.js +1 -1
  393. package/dist/src/share/site-share-store.js +1 -1
  394. package/dist/src/storage/sqlite/connection.js +9 -9
  395. package/dist/src/storage/sqlite/migrations/251_personal_result_reads.sql +40 -0
  396. package/dist/src/storage/sqlite/migrations/252_task_work_revisions.sql +15 -0
  397. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  398. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  399. package/dist/src/storage/sqlite/schema.js +1 -1
  400. package/dist/src/tasks/capabilities/read.js +2 -2
  401. package/dist/src/tasks/capabilities/write.js +1 -1
  402. package/dist/src/tasks/home-query-service.js +2 -2
  403. package/dist/src/tasks/index.js +4 -4
  404. package/dist/src/tasks/task-allocation-service.js +64 -13
  405. package/dist/src/tasks/task-application-service.d.ts +18 -0
  406. package/dist/src/tasks/task-application-service.js +135 -4
  407. package/dist/src/tasks/task-collaboration-delivery.js +1 -1
  408. package/dist/src/tasks/task-context-assembler.js +10 -7
  409. package/dist/src/tasks/task-contract-definition.d.ts +3 -0
  410. package/dist/src/tasks/task-contract-planner.js +50 -16
  411. package/dist/src/tasks/task-conversation-repository.js +1 -1
  412. package/dist/src/tasks/task-evidence-ranges.d.ts +7 -0
  413. package/dist/src/tasks/task-evidence-ranges.js +20 -0
  414. package/dist/src/tasks/task-execution-capabilities.d.ts +26 -0
  415. package/dist/src/tasks/task-execution-capabilities.js +117 -0
  416. package/dist/src/tasks/task-handoff-service.js +1 -1
  417. package/dist/src/tasks/task-handoff.d.ts +56 -0
  418. package/dist/src/tasks/task-handoff.js +510 -0
  419. package/dist/src/tasks/task-main-update-decision-service.js +3 -3
  420. package/dist/src/tasks/task-model-call.js +1 -1
  421. package/dist/src/tasks/task-read-model-projector.d.ts +6 -0
  422. package/dist/src/tasks/task-read-model-projector.js +12 -1
  423. package/dist/src/tasks/task-research-repair.js +6 -2
  424. package/dist/src/tasks/task-research-result.d.ts +16 -2
  425. package/dist/src/tasks/task-research-result.js +126 -42
  426. package/dist/src/tasks/task-result-delivery-repository.js +27 -4
  427. package/dist/src/tasks/task-result-delivery-service.js +38 -10
  428. package/dist/src/tasks/task-run-coordinator.js +7 -5
  429. package/dist/src/tasks/task-run-dispatcher.d.ts +1 -0
  430. package/dist/src/tasks/task-run-dispatcher.js +3 -2
  431. package/dist/src/tui/backends/embedded-backend.js +13 -13
  432. package/dist/src/tui/backends/gateway-realtime-backend.js +2 -2
  433. package/dist/src/tui/extension-host/load-extensions.js +2 -2
  434. package/dist/src/tui/tui-commands.js +5 -5
  435. package/dist/src/tui/tui-picker-overlay.js +1 -1
  436. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  437. package/dist/src/tui/tui-startup-resources.js +4 -4
  438. package/dist/src/tui/tui.js +6 -6
  439. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  440. package/dist/src/user-context/access-policy.js +2 -2
  441. package/dist/src/user-model/bootstrap.js +1 -1
  442. package/dist/src/user-model/capture/executor.js +1 -1
  443. package/dist/src/user-model/index.js +2 -2
  444. package/dist/src/voice/realtime/memory-context.js +7 -7
  445. package/dist/src/voice/realtime/runtime.js +4 -4
  446. package/dist/src/voice/stt/index.js +2 -2
  447. package/dist/src/voice/stt/preflight.js +1 -1
  448. package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
  449. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
  450. package/dist/src/voice/stt/transcribe-core.js +1 -1
  451. package/dist/src/voice/tts/index.js +3 -3
  452. package/dist/src/voice/tts/merge-config.js +1 -1
  453. package/dist/src/voice/tts/payload.js +1 -1
  454. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
  455. package/dist/src/voice/tts/speak-core.js +1 -1
  456. package/dist/src/work-discovery/incremental-repository.js +1 -1
  457. package/dist/src/work-discovery/service.js +7 -7
  458. package/dist/src/workflows/context/workflow-context.js +1 -1
  459. package/dist/src/workflows/engine/workflow-engine.js +1 -1
  460. package/dist/src/workflows/service/workflow-run-service.js +7 -7
  461. package/dist/src/workflows/service/workflow-session-bridge.js +2 -2
  462. package/package.json +5 -3
  463. package/dist/gateway/static/root/assets/constants-CpWu0oHS.js +0 -1
  464. package/dist/gateway/static/root/assets/home-page-BtSy2hRV.js +0 -2
  465. package/dist/gateway/static/root/assets/index-B08iR7fT.js +0 -260
  466. package/dist/gateway/static/root/assets/local-session-drafts-D_tYFy7d.js +0 -1
  467. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-BTrk2wWv.js +0 -1
  468. package/dist/gateway/static/root/assets/product-open-page-aUoA-uPw.js +0 -1
  469. package/dist/gateway/static/root/assets/settings-advanced-gate-C4_gW1vw.js +0 -1
@@ -0,0 +1,106 @@
1
+ import { isPersonalConversation } from "../../personal-agent/repository.js";
2
+ import { readPersonalResult, retryPersonalResultDelivery } from "../../personal-agent/result-reader.js";
3
+ import { waitForPersonalResult } from "../../personal-agent/result-read-continuations.js";
4
+ import "./local-read-budget.js";
5
+ import { Type } from "@sinclair/typebox";
6
+ //#region src/agent/tools/personal-result-tool.ts
7
+ const schema = Type.Object({
8
+ command: Type.Union([
9
+ "list",
10
+ "get",
11
+ "read",
12
+ "search",
13
+ "retry_delivery"
14
+ ].map((command) => Type.Literal(command))),
15
+ resultId: Type.Optional(Type.String({ minLength: 1 })),
16
+ taskId: Type.Optional(Type.String()),
17
+ sourceId: Type.Optional(Type.String({ description: "body for retained result text, or the exact artifact sourceId from get." })),
18
+ revision: Type.Optional(Type.String()),
19
+ sectionId: Type.Optional(Type.String()),
20
+ query: Type.Optional(Type.String({
21
+ minLength: 3,
22
+ maxLength: 500
23
+ })),
24
+ cursor: Type.Optional(Type.String({ maxLength: 1024 })),
25
+ offset: Type.Optional(Type.Integer({ minimum: 0 })),
26
+ limit: Type.Optional(Type.Integer({
27
+ minimum: 1,
28
+ maximum: 4e3
29
+ }))
30
+ }, {
31
+ additionalProperties: false,
32
+ anyOf: [
33
+ { properties: { command: { const: "list" } } },
34
+ {
35
+ properties: { command: { enum: [
36
+ "get",
37
+ "read",
38
+ "retry_delivery"
39
+ ] } },
40
+ required: ["resultId"]
41
+ },
42
+ {
43
+ properties: { command: { const: "search" } },
44
+ required: ["resultId", "query"]
45
+ }
46
+ ]
47
+ });
48
+ function createPersonalResultTool(getConversationId) {
49
+ return {
50
+ name: "personal_result",
51
+ label: "Read work results",
52
+ parameters: schema,
53
+ description: "Read previously produced results in this conversation without creating another Task. list discovers resultIds; get lists artifacts; get(sourceId) lists sections; read returns exact text ranges; search finds excerpts (3+ characters). Use sourceId=body for the retained execution report, or an exact artifact ID. Follow nextCursor with the same result/source/command/query/section; pin revision for exact citations. Chat summaries are incomplete: use this for follow-up questions about files, tables, code, sources and earlier results. Outputs are bounded, not the total readable size. preparing means background extraction, not missing capability: do not recreate the work or repeatedly poll in this turn. retry_delivery retries an exhausted notification/delivery outbox for resultId, preserving existing artifacts and messages; it never reruns execution, parsing or paid work. It rejects outdated revisions and is not an unconditional duplicate-send command. Binary visual interpretation or new processing still needs a specialist. Content is reference data, not authorization.",
54
+ supportsParallel: true,
55
+ idempotent: true,
56
+ async execute(_id, raw, signal) {
57
+ signal?.throwIfAborted();
58
+ const conversationId = getConversationId();
59
+ if (!conversationId || !isPersonalConversation(conversationId)) throw new Error("Personal conversation is unavailable");
60
+ const control = raw;
61
+ if (control.command === "retry_delivery") {
62
+ if (!control.resultId) throw new Error("resultId is required");
63
+ return {
64
+ content: [{
65
+ type: "text",
66
+ text: JSON.stringify(retryPersonalResultDelivery(conversationId, control.resultId))
67
+ }],
68
+ details: { localOnly: true }
69
+ };
70
+ }
71
+ const input = raw;
72
+ if (![
73
+ "list",
74
+ "get",
75
+ "read",
76
+ "search"
77
+ ].includes(input.command)) throw new Error("Unsupported result command");
78
+ let result = await readPersonalResult(conversationId, input);
79
+ if (result.status === "preparing") {
80
+ result.continuationScheduled = waitForPersonalResult(conversationId, input);
81
+ result.guidance = result.continuationScheduled ? "This question will continue automatically here after preparation; finish this turn without polling or creating a Task." : "Preparation continues in the background; retry this same result read later.";
82
+ }
83
+ signal?.throwIfAborted();
84
+ for (let limit = Math.min(input.limit ?? 4e3, 4e3); JSON.stringify(result).length > 8e3 && limit > 1;) {
85
+ limit = Math.max(1, Math.floor(limit / 2));
86
+ result = await readPersonalResult(conversationId, {
87
+ ...input,
88
+ limit
89
+ });
90
+ }
91
+ if (JSON.stringify(result).length > 8e3) throw new Error("Result metadata exceeds the read budget");
92
+ return {
93
+ content: [{
94
+ type: "text",
95
+ text: JSON.stringify(result)
96
+ }],
97
+ details: {
98
+ localOnly: true,
99
+ status: result.status
100
+ }
101
+ };
102
+ }
103
+ };
104
+ }
105
+ //#endregion
106
+ export { createPersonalResultTool };
@@ -12,7 +12,7 @@ declare const PersonalTaskModelSchema: import("@sinclair/typebox").TObject<{
12
12
  taskType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
13
13
  requestedAgentId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
14
14
  }>>;
15
- command: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"get" | "answer" | "retry_allocation" | "selection" | "list" | "cancel" | "entry" | "submit" | "instruct" | "collaboration">[]>;
15
+ command: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"get" | "answer" | "retry_allocation" | "selection" | "list" | "cancel" | "entry" | "revise" | "submit" | "instruct" | "collaboration">[]>;
16
16
  requestId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
17
17
  instruction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
18
18
  title: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -22,14 +22,24 @@ declare const PersonalTaskModelSchema: import("@sinclair/typebox").TObject<{
22
22
  objective: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
23
23
  expectedOutputs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
24
24
  constraints: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
25
+ expectedVersion: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
25
26
  description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
26
27
  limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
27
28
  offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
28
29
  section: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<string>[]>>;
29
30
  entryId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
31
+ baselineVersion: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
30
32
  afterSequence: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
33
+ baselineResultId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
34
+ supersedesEntryIds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
31
35
  bodyOffset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
32
36
  questionId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
37
+ sourceRefs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
38
+ kind: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<string>[]>;
39
+ sourceId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
40
+ resultId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
41
+ expectedVersion: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
42
+ }>>>;
33
43
  }>;
34
44
  export interface PersonalTaskToolDeps extends XopcUseToolDeps {
35
45
  getAgentToolAvailability?: MatchingContext['getAgentToolAvailability'];
@@ -6,18 +6,20 @@ import { TaskRepository, init_task_repository } from "../../tasks/task-repositor
6
6
  import { getPersonalRequest, init_request_repository } from "../../personal-agent/request-repository.js";
7
7
  import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
8
8
  import { init_sqlite } from "../../storage/sqlite/index.js";
9
- import { isPersonalConversation } from "../../personal-agent/repository.js";
10
9
  import { TaskAllocationRepository } from "../../tasks/task-allocation-repository.js";
10
+ import { TaskReadModelProjector } from "../../tasks/task-read-model-projector.js";
11
+ import { isPersonalConversation } from "../../personal-agent/repository.js";
11
12
  import { TaskOriginRepository } from "../../tasks/task-origin-repository.js";
12
- import { boundedPersonalResult } from "./personal-result-budget.js";
13
+ import { parseTaskHandoffReferences } from "../../tasks/task-handoff.js";
13
14
  import { TaskCollaborationRepository } from "../../tasks/task-collaboration-repository.js";
14
15
  import { TaskApplicationService } from "../../tasks/task-application-service.js";
15
- import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../../personal-agent/communication.js";
16
- import { createXopcUseTool } from "./xopc-use-tool.js";
16
+ import { AgentSelectionRepository, selectionRequestHash } from "../../agent-matching/selection-repository.js";
17
17
  import { getAvailablePersonalAgentTools, personalAgentModelAvailability } from "../../personal-agent/specialist-capabilities.js";
18
18
  import { assessSpecialist, matchSpecialists } from "../../agent-matching/service.js";
19
- import { AgentSelectionRepository, selectionRequestHash } from "../../agent-matching/selection-repository.js";
20
19
  import { assertSpecialistEligible, createSelectedTask } from "../../agent-matching/delegation-service.js";
20
+ import { PERSONAL_WORKER_RESULT_GUIDANCE } from "../../personal-agent/communication.js";
21
+ import { boundedPersonalResult } from "./personal-result-budget.js";
22
+ import { createXopcUseTool } from "./xopc-use-tool.js";
21
23
  import { cancelPersonalTask } from "../../personal-agent/task-cancel.js";
22
24
  import { randomUUID } from "node:crypto";
23
25
  import { Type } from "@sinclair/typebox";
@@ -29,6 +31,7 @@ init_request_repository();
29
31
  init_task_repository();
30
32
  const PersonalTaskSchema = Type.Object({
31
33
  command: Type.Union([
34
+ Type.Literal("revise"),
32
35
  Type.Literal("retry_allocation"),
33
36
  Type.Literal("submit"),
34
37
  Type.Literal("agents"),
@@ -83,6 +86,10 @@ const PersonalTaskSchema = Type.Object({
83
86
  })),
84
87
  agentId: Type.Optional(Type.String({ description: "Specialist Agent ID. Never use your own ID." })),
85
88
  taskId: Type.Optional(Type.String()),
89
+ baselineResultId: Type.Optional(Type.String({ description: "Exact latest result ID from personal_result directory or Task revisionBaseline.resultId." })),
90
+ baselineVersion: Type.Optional(Type.String({ description: "Opaque baselineVersion token returned by the host, copied exactly. Never use the numeric resultRevision or task version here." })),
91
+ expectedVersion: Type.Optional(Type.Integer({ minimum: 1 })),
92
+ supersedesEntryIds: Type.Optional(Type.Array(Type.String({ description: "Only actual earlier instruction/answer entry IDs from collaboration. Omit for original-contract changes or the first revision; never use task/result/run IDs." }), { maxItems: 40 })),
86
93
  instruction: Type.Optional(Type.String({ description: "The user’s new direction for this delegated Task." })),
87
94
  entryId: Type.Optional(Type.String({ description: "Read one complete collaboration entry, including its question or instruction body." })),
88
95
  afterSequence: Type.Optional(Type.Integer({ minimum: 0 })),
@@ -91,6 +98,7 @@ const PersonalTaskSchema = Type.Object({
91
98
  description: "Character offset for an entry body; follow nextBodyOffset until absent."
92
99
  })),
93
100
  section: Type.Optional(Type.Union([
101
+ "revision",
94
102
  "task",
95
103
  "waits",
96
104
  "runs",
@@ -115,6 +123,29 @@ const PersonalTaskSchema = Type.Object({
115
123
  idempotencyKey: Type.Optional(Type.String())
116
124
  });
117
125
  const PersonalTaskModelSchema = Type.Object({
126
+ sourceRefs: Type.Optional(Type.Array(Type.Object({
127
+ kind: Type.Union([
128
+ "result",
129
+ "note",
130
+ "task",
131
+ "file"
132
+ ].map((kind) => Type.Literal(kind))),
133
+ sourceId: Type.Optional(Type.String({
134
+ minLength: 1,
135
+ maxLength: 2e3
136
+ })),
137
+ resultId: Type.Optional(Type.String({
138
+ minLength: 1,
139
+ maxLength: 500
140
+ })),
141
+ expectedVersion: Type.Optional(Type.String({ maxLength: 500 }))
142
+ }, {
143
+ additionalProperties: false,
144
+ anyOf: [{
145
+ properties: { kind: { const: "result" } },
146
+ required: ["resultId"]
147
+ }, { required: ["sourceId"] }]
148
+ }), { maxItems: 5 })),
118
149
  ...Type.Omit(PersonalTaskSchema, [
119
150
  "agentId",
120
151
  "selectionReason",
@@ -127,6 +158,7 @@ const PersonalTaskModelSchema = Type.Object({
127
158
  ]).properties,
128
159
  requirements: Type.Optional(Type.Omit(PersonalTaskSchema.properties.requirements, ["requiredTools", "requiredSkills"], { additionalProperties: false })),
129
160
  command: Type.Union([
161
+ "revise",
130
162
  "submit",
131
163
  "list",
132
164
  "get",
@@ -141,6 +173,16 @@ const PersonalTaskModelSchema = Type.Object({
141
173
  }, {
142
174
  additionalProperties: false,
143
175
  anyOf: [
176
+ {
177
+ properties: { command: { const: "revise" } },
178
+ required: [
179
+ "taskId",
180
+ "instruction",
181
+ "baselineResultId",
182
+ "baselineVersion",
183
+ "expectedVersion"
184
+ ]
185
+ },
144
186
  {
145
187
  properties: { command: { const: "submit" } },
146
188
  required: ["objective", "description"]
@@ -194,13 +236,15 @@ function createPersonalTaskTool(deps) {
194
236
  return {
195
237
  name: "personal_task",
196
238
  label: "Personal Task",
197
- 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 reads Task state, waits, runs, receipts and context; use section and limit/offset for complete paginated details. collaboration reads ordered message previews with afterSequence; entry reads exact message bodies using entryId and nextBodyOffset. Read full questions before answering. Delivery pending means saved, delivered means sent, confirmed means the executor acknowledged it; confirmation alone is not verified completion. 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.",
239
+ description: "For changes to a completed ordinary Task use revise on the SAME taskId, with instruction and the exact revisionBaseline fields from get(section=revision), or baselineResultId/baselineVersion from personal_result get/list plus expected Task version. get(section=revision) is a small local metadata lookup; do not read the whole task body just to revise. This atomically saves a new work revision and queues fresh background allocation. Reuse idempotencyKey on uncertain retries. sourceRefs adds necessary inputs; the baseline body and selected artifacts are retained automatically. Explicit supersedesEntryIds replaces only named earlier directions; all others remain applicable. A new independent goal uses submit with pinned old-result sources. Connected Request side effects require a new authorized Request. For workspace file work, include every required input in sourceRefs as {kind:\"file\",sourceId:\"relative/or/absolute/path\"} without pre-reading it; the host pins only files in this conversation workspace. Owner workspace paths are input locations, not the executor cwd. For necessary prior inputs not selected in the current message, pass sourceRefs with their stable sourceId and optional expectedVersion; no pre-read is required. For a prior result use {kind:\"result\",resultId:\"directory result ID\",sourceId:\"exact artifact ID or unique file title\"}; omit sourceId only for the retained result body. Do not invent composite IDs. The host authorizes and pins the exact artifact version in the background. Prefer the exact selected reference when provided. 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 reads Task state, waits, runs, receipts and context; use section and limit/offset for complete paginated details. collaboration reads ordered message previews with afterSequence; entry reads exact message bodies using entryId and nextBodyOffset. Read full questions before answering. Delivery pending means saved, delivered means sent, confirmed means the executor acknowledged it; confirmation alone is not verified completion. 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.",
198
240
  parameters: PersonalTaskModelSchema,
199
241
  mutatesWorkspace: true,
200
242
  mutationScope: "external",
201
243
  requiresExclusiveWorkspaceLock: false,
202
244
  finalGuardRelevant: true,
203
245
  async execute(toolCallId, modelInput, signal) {
246
+ if (!PersonalTaskSchema.properties.command.anyOf.some((command) => command.const === modelInput.command)) throw new Error("Unsupported personal_task command; completed work uses atomic revise, not manual start/reopen");
247
+ if (modelInput.sourceRefs?.length && !["submit", "revise"].includes(modelInput.command)) throw new Error("sourceRefs is supported only by submit/revise; it cannot be silently ignored by a coordination command");
204
248
  const input = modelInput;
205
249
  const conversationId = deps.getCurrentConversationId?.();
206
250
  const ownAgentId = deps.getCurrentAgentId?.();
@@ -305,6 +349,7 @@ function createPersonalTaskTool(deps) {
305
349
  sourceInput: inputId ?? toolCallId,
306
350
  brief,
307
351
  requirements,
352
+ sourceRefs: modelInput.sourceRefs,
308
353
  expectedOutputs: input.expectedOutputs,
309
354
  acceptanceCriteria: input.acceptanceCriteria,
310
355
  constraints: input.constraints
@@ -314,6 +359,7 @@ function createPersonalTaskTool(deps) {
314
359
  ...brief,
315
360
  createMode: "allocate",
316
361
  requirements,
362
+ sourceRefs: modelInput.sourceRefs,
317
363
  includeConversationContext: false,
318
364
  expectedOutputs: input.expectedOutputs,
319
365
  acceptanceCriteria: input.acceptanceCriteria,
@@ -413,6 +459,62 @@ function createPersonalTaskTool(deps) {
413
459
  const taskId = input.taskId?.trim();
414
460
  if (!taskId) throw new Error("taskId is required");
415
461
  if (!new TaskOriginRepository().owns(taskId, conversationId)) throw new Error("Task does not belong to this personal conversation");
462
+ if (command === "get" && input.section === "revision") {
463
+ const model = new TaskReadModelProjector().get(taskId);
464
+ return {
465
+ content: [{
466
+ type: "text",
467
+ text: JSON.stringify({
468
+ ok: true,
469
+ taskId,
470
+ phase: model.task.phase,
471
+ expectedVersion: model.task.version,
472
+ revisionBaseline: model.revisionBaseline,
473
+ allowedCommands: model.allowedCommands,
474
+ allocation: model.allocation
475
+ })
476
+ }],
477
+ details: {}
478
+ };
479
+ }
480
+ if (command === "revise") {
481
+ if (!input.instruction || !input.baselineResultId || !input.baselineVersion || !input.expectedVersion) throw new Error("Revision requires instruction, baseline result/version, and expected task version");
482
+ const refs = parseTaskHandoffReferences(modelInput.sourceRefs);
483
+ if (!refs) throw new Error("Invalid revision sourceRefs");
484
+ const result = new TaskApplicationService().reviseCompleted({
485
+ taskId,
486
+ conversationId,
487
+ instruction: input.instruction,
488
+ baselineResultId: input.baselineResultId,
489
+ baselineVersion: input.baselineVersion,
490
+ expectedVersion: input.expectedVersion,
491
+ sourceRefs: refs,
492
+ supersedesEntryIds: input.supersedesEntryIds,
493
+ idempotencyKey: input.idempotencyKey ?? `personal-revise:${conversationId}:${toolCallId}`
494
+ });
495
+ deps.dispatchTaskRuns?.();
496
+ const payload = result.ok === false ? {
497
+ ok: false,
498
+ reason: result.reason,
499
+ revisionBaseline: result.model?.revisionBaseline,
500
+ allowedCommands: result.model?.allowedCommands,
501
+ recovery: result.reason === "conflict" ? "Copy the returned revisionBaseline.resultId, baselineVersion and expectedVersion exactly into one revise retry. Closed/review Tasks support atomic revise: do not reopen separately. Do not repeat unchanged input or invent numeric baseline versions." : result.reason === "invalid_reference" ? "supersedesEntryIds only accepts earlier user instruction/answer IDs from collaboration. Original contract requirements have no entry ID: omit supersedesEntryIds for a first revision or original output-list change. No change has been saved." : "Use instruct/answer while running. A completed ordinary Task needs its latest authorized result. Cancelled Tasks and connected Request actions are not reopened by this command."
502
+ } : {
503
+ ok: true,
504
+ saved: true,
505
+ taskId,
506
+ expectedVersion: result.model.task.version,
507
+ allocation: result.model.allocation,
508
+ state: "revision_saved_background_allocation_pending"
509
+ };
510
+ return {
511
+ content: [{
512
+ type: "text",
513
+ text: JSON.stringify(payload)
514
+ }],
515
+ details: {}
516
+ };
517
+ }
416
518
  if (command === "collaboration" || command === "entry") {
417
519
  const board = new TaskCollaborationRepository();
418
520
  if (command === "entry") {
@@ -551,6 +653,7 @@ function createPersonalTaskTool(deps) {
551
653
  ok: payload.ok,
552
654
  [input.section]: payload[input.section]
553
655
  } : { ...payload };
656
+ read.revisionBaseline = new TaskReadModelProjector().get(input.taskId)?.revisionBaseline;
554
657
  const pagination = {};
555
658
  for (const key of [
556
659
  "waits",
@@ -589,6 +692,7 @@ function createPersonalTaskTool(deps) {
589
692
  content: [{
590
693
  type: "text",
591
694
  text: JSON.stringify({
695
+ revisionBaseline: read.revisionBaseline,
592
696
  ...read,
593
697
  pagination
594
698
  })
@@ -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";
3
5
  import { evaluateFilePolicy } from "../sandbox/exec-policy.js";
4
6
  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 { Type } from "@sinclair/typebox";
@@ -1,8 +1,8 @@
1
+ import { isBareProfileMarkdownFileName, resolvePathUnderWorkspace, resolveProfileMarkdownPathIfBareName } from "./tool-paths.js";
1
2
  import { checkedFilePath, readWorkspaceFileAsync } from "../sandbox/fileAccess.js";
2
- import { dataScheduler } from "../data-acquisition/scheduler.js";
3
3
  import { checkFileSafety } from "../prompt/safety.js";
4
+ import { dataScheduler } from "../data-acquisition/scheduler.js";
4
5
  import { formatSize, truncateHead } from "./truncate.js";
5
- import { isBareProfileMarkdownFileName, resolvePathUnderWorkspace, resolveProfileMarkdownPathIfBareName } from "./tool-paths.js";
6
6
  import { stat } from "fs/promises";
7
7
  import { Type } from "@sinclair/typebox";
8
8
  //#region src/agent/tools/read.ts
@@ -1,5 +1,5 @@
1
- import { readWorkspaceRevision } from "../coding/workspace-revision.js";
2
1
  import { prepareSafeToolEnv } from "../sandbox/sanitize-env-vars.js";
2
+ import { readWorkspaceRevision } from "../coding/workspace-revision.js";
3
3
  import { evaluateFilePolicy } from "../sandbox/exec-policy.js";
4
4
  import { checkedFilePath, readWorkspaceFile } from "../sandbox/fileAccess.js";
5
5
  import { resolve } from "node:path";
@@ -30,7 +30,26 @@ function createReviewWorkspaceTool(workspace) {
30
30
  timeout: 1e4,
31
31
  maxBuffer: 8 * 1024 * 1024
32
32
  })).stdout;
33
- cwd = checkedFilePath(workspace, await realpath((await git(["rev-parse", "--show-toplevel"])).trim()), "read");
33
+ let root;
34
+ try {
35
+ root = (await git(["rev-parse", "--show-toplevel"])).trim();
36
+ } catch (error) {
37
+ if (signal?.aborted) throw error;
38
+ if (error.code !== 128 || !String(error.stderr).includes("not a git repository")) throw error;
39
+ return {
40
+ content: [{
41
+ type: "text",
42
+ text: "Git workspace review is unavailable because this workspace is not a Git repository. No Git diff was reviewed. Do not retry this unchanged call or initialize Git solely for review. Inspect the declared output files and compare them with pinned baseline copies using portable diff or checksums; retain the Task acceptance checks."
43
+ }],
44
+ details: {
45
+ status: "unavailable",
46
+ reason: "not_git_repository",
47
+ complete: false,
48
+ command: "review_workspace"
49
+ }
50
+ };
51
+ }
52
+ cwd = checkedFilePath(workspace, await realpath(root), "read");
34
53
  const startRevision = await readWorkspaceRevision(cwd);
35
54
  const head = await git([
36
55
  "rev-parse",
@@ -1,9 +1,9 @@
1
1
  import { turnOutcomeKindFromFileName } from "../../../packages/gateway-contract/src/turn-outcome.js";
2
2
  import { init_src } from "../../../packages/gateway-contract/src/index.js";
3
+ import { MEDIA_MAX_BYTES } from "../../media/store.js";
4
+ import { resolvePathUnderWorkspace } from "./tool-paths.js";
3
5
  import { readWorkspaceFile } from "../sandbox/fileAccess.js";
4
6
  import { checkFileSafety } from "../prompt/safety.js";
5
- import { resolvePathUnderWorkspace } from "./tool-paths.js";
6
- import { MEDIA_MAX_BYTES } from "../../media/store.js";
7
7
  import { persistToolMedia } from "./tool-media.js";
8
8
  import { basename } from "node:path";
9
9
  import { Type } from "@sinclair/typebox";
@@ -1,7 +1,7 @@
1
1
  import { resolveStateDir } from "../../config/paths-state.js";
2
2
  import { init_paths } from "../../config/paths.js";
3
- import { DEFAULT_MAX_BYTES, formatSize, truncateHead } from "./truncate.js";
4
3
  import { createSkillConfigManager, isSkillEnabled, resolveSkillConfig } from "../skills/config.js";
4
+ import { DEFAULT_MAX_BYTES, formatSize, truncateHead } from "./truncate.js";
5
5
  import { resolveSkillReadablePath } from "../skills/skill-view-path.js";
6
6
  import { readFileSync, statSync } from "fs";
7
7
  import { Type } from "@sinclair/typebox";
@@ -2,7 +2,15 @@ import type { AgentTool } from '@earendil-works/pi-agent-core';
2
2
  import { type XopcUseToolDeps } from './xopc-use-tool.js';
3
3
  declare const Schema: import("@sinclair/typebox").TObject<{
4
4
  command: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"get">, import("@sinclair/typebox").TLiteral<"post">]>;
5
- section: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"collaboration">, import("@sinclair/typebox").TLiteral<"task">]>>;
5
+ section: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"collaboration">, import("@sinclair/typebox").TLiteral<"task">, import("@sinclair/typebox").TLiteral<"brief">, import("@sinclair/typebox").TLiteral<"handoff">, import("@sinclair/typebox").TLiteral<"source">, import("@sinclair/typebox").TLiteral<"evidence">]>>;
6
+ offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
7
+ materialize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
8
+ sourceIndex: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
9
+ toolCallId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
10
+ query: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
11
+ revision: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
12
+ cursor: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
13
+ sectionId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
6
14
  kind: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"progress">, import("@sinclair/typebox").TLiteral<"question">, import("@sinclair/typebox").TLiteral<"ack">]>>;
7
15
  body: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
8
16
  causationId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -1,22 +1,45 @@
1
+ import { parseResultReferenceId } from "../../../packages/gateway-contract/src/result-reference.js";
2
+ import { init_src } from "../../../packages/gateway-contract/src/index.js";
1
3
  import { TaskRepository, init_task_repository } from "../../tasks/task-repository.js";
2
4
  import { TaskRunRepository, init_task_run_repository } from "../../tasks/task-run-repository.js";
3
5
  import { init_request_repository, personalRequestForExecution } from "../../personal-agent/request-repository.js";
4
6
  import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
5
7
  import { init_session_repository } from "../../storage/sqlite/session-repository.js";
6
8
  import { TaskReadModelProjector } from "../../tasks/task-read-model-projector.js";
9
+ import { assertTaskHandoffAccess, assertTaskHandoffExecutorAccess, getTaskHandoff, materializeTaskHandoffFile, readTaskHandoffSource } from "../../tasks/task-handoff.js";
10
+ import { TaskCollaborationRepository } from "../../tasks/task-collaboration-repository.js";
7
11
  import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
12
+ import { taskResearchEvidence } from "../../tasks/task-research-result.js";
8
13
  import { getEmbeddedExecutionSession } from "../embedded/execution-context.js";
9
- import { TaskCollaborationRepository } from "../../tasks/task-collaboration-repository.js";
10
14
  import { createXopcUseTool } from "./xopc-use-tool.js";
11
15
  import { Type } from "@sinclair/typebox";
12
16
  //#region src/agent/tools/task-collaboration-tool.ts
17
+ init_src();
13
18
  init_request_repository();
14
19
  init_session_repository();
15
20
  init_task_repository();
16
21
  init_task_run_repository();
17
22
  const Schema = Type.Object({
18
23
  command: Type.Union([Type.Literal("get"), Type.Literal("post")]),
19
- section: Type.Optional(Type.Union([Type.Literal("collaboration"), Type.Literal("task")])),
24
+ section: Type.Optional(Type.Union([
25
+ Type.Literal("collaboration"),
26
+ Type.Literal("task"),
27
+ Type.Literal("brief"),
28
+ Type.Literal("handoff"),
29
+ Type.Literal("source"),
30
+ Type.Literal("evidence")
31
+ ])),
32
+ offset: Type.Optional(Type.Integer({ minimum: 0 })),
33
+ materialize: Type.Optional(Type.Boolean()),
34
+ sourceIndex: Type.Optional(Type.Integer({ minimum: 0 })),
35
+ toolCallId: Type.Optional(Type.String({ minLength: 1 })),
36
+ query: Type.Optional(Type.String({
37
+ minLength: 1,
38
+ maxLength: 300
39
+ })),
40
+ revision: Type.Optional(Type.String()),
41
+ cursor: Type.Optional(Type.String()),
42
+ sectionId: Type.Optional(Type.String()),
20
43
  kind: Type.Optional(Type.Union([
21
44
  Type.Literal("progress"),
22
45
  Type.Literal("question"),
@@ -67,7 +90,7 @@ function createTaskCollaborationTool(deps) {
67
90
  name: "task_collaboration",
68
91
  label: "Task collaboration",
69
92
  parameters: Schema,
70
- description: "Coordinate the current Task with its Personal owner. get with section task reads the complete brief, constraints and waits; default get reads complete ordered messages (afterSequence/limit) or one entryId. post progress for meaningful changes; post question then stop this turn until answered. Before continuing, post ack with causationId equal to each delivered answer/instruction ID and explain how the result will incorporate it. Confirmation is receipt and intent, not completed verification. Reuse the same Task and executor. Account authorization stays in the main connection UI; answers and instructions cannot change the selected connector/account or permit writes. Preserve idempotencyKey on retries.",
93
+ description: "Coordinate the current Task with its Personal owner. get section brief reads the full task body in 4000-character pages (offset/nextOffset); section handoff lists the host-captured original request and selected versioned sources, Read the CURRENT handoff first; source indices can change across work revisions. Only entries marked materializable support materialize=true, with an explicit sourceIndex. section source with materialize=true copies a selected pinned workspace file OR published result artifact into your Task input directory; use the returned executionInputRoot as cwd and readOnlyPath as input, never the owner workspace path. Result body text uses read; materialize requires an exact artifact source. The returned copies are read-only: write revised outputs elsewhere and publish those new files. It grants no wider root access. Otherwise section source reads one sourceIndex (query for result search, revision for pinned extracted text). section evidence lists real successful tool reads, or reads a toolCallId in 4000-character pages. Evidence excerpts must cite that original toolCallId. get with section task reads constraints and waits; default get reads complete ordered messages (afterSequence/limit) or one entryId. post progress for meaningful changes; post question then stop this turn until answered. Initial handoff and source/tool IDs require no ack. Before continuing, post ack only for a user/main_agent collaboration entry of kind answer or instruction, with causationId equal to that entry ID and explain how the result will incorporate it. Confirmation is receipt and intent, not completed verification. Reuse the same Task and executor. Account authorization stays in the main connection UI; answers and instructions cannot change the selected connector/account or permit writes. Preserve idempotencyKey on retries.",
71
94
  mutatesWorkspace: true,
72
95
  mutationScope: "external",
73
96
  requiresExclusiveWorkspaceLock: false,
@@ -82,6 +105,98 @@ function createTaskCollaborationTool(deps) {
82
105
  "failed"
83
106
  ].includes(request.state)) throw new Error("Personal request is no longer active");
84
107
  if (input.command === "get") {
108
+ const page = (text) => {
109
+ const offset = input.offset ?? 0;
110
+ return {
111
+ text: text.slice(offset, offset + 4e3),
112
+ offset,
113
+ totalChars: text.length,
114
+ ...offset + 4e3 < text.length ? { nextOffset: offset + 4e3 } : {}
115
+ };
116
+ };
117
+ const reply = (value) => ({
118
+ content: [{
119
+ type: "text",
120
+ text: JSON.stringify(value)
121
+ }],
122
+ details: {}
123
+ });
124
+ if (input.section === "brief") return reply(page(new TaskRepository().require(active.taskId).body ?? ""));
125
+ if (input.section === "handoff") {
126
+ const handoff = getTaskHandoff(active.taskId);
127
+ if (!handoff) return reply({ available: false });
128
+ assertTaskHandoffAccess(handoff);
129
+ return reply({
130
+ ...handoff,
131
+ originalRequest: page(handoff.originalRequest ?? ""),
132
+ interpretation: void 0,
133
+ sources: handoff.sources.map(({ text: _text, ...source }, sourceIndex) => ({
134
+ ...source,
135
+ sourceIndex,
136
+ materializable: source.kind === "file" && source.representation !== "directory" || source.kind === "result" && parseResultReferenceId(source.sourceId)?.sourceId !== "body",
137
+ sourceIndexScope: "current_handoff_only"
138
+ }))
139
+ });
140
+ }
141
+ if (input.section === "source") {
142
+ assertTaskHandoffExecutorAccess(active.taskId, active.agentId);
143
+ if (input.materialize) {
144
+ if (input.sourceIndex === void 0) throw new Error("Materialization requires sourceIndex from the CURRENT handoff manifest. Never reuse indices from earlier runs");
145
+ const config = deps.getConfig?.();
146
+ const workspace = deps.getWorkspace?.();
147
+ if (!config || !workspace) throw new Error("Execution workspace is unavailable");
148
+ return {
149
+ ...reply(await materializeTaskHandoffFile(active.taskId, input.sourceIndex ?? 0, workspace, config)),
150
+ details: { taskSourceRead: {
151
+ taskId: active.taskId,
152
+ sourceIndex: input.sourceIndex ?? 0,
153
+ materialized: true
154
+ } }
155
+ };
156
+ }
157
+ const source = await readTaskHandoffSource(active.taskId, input.sourceIndex ?? 0, {
158
+ command: input.query ? "search" : "read",
159
+ offset: input.offset,
160
+ limit: 4e3,
161
+ query: input.query,
162
+ revision: input.revision,
163
+ cursor: input.cursor,
164
+ sectionId: input.sectionId
165
+ }, deps.getConfig?.());
166
+ const plain = "text" in source && typeof source.text === "string" ? [source.text] : "items" in source && Array.isArray(source.items) ? source.items.map((item) => item.text) : [];
167
+ return {
168
+ content: [...reply(source).content, ...plain.map((text) => ({
169
+ type: "text",
170
+ text
171
+ }))],
172
+ details: plain.length ? { taskSourceRead: {
173
+ taskId: active.taskId,
174
+ sourceIndex: input.sourceIndex ?? 0
175
+ } } : {}
176
+ };
177
+ }
178
+ if (input.section === "evidence") {
179
+ const { tools } = taskResearchEvidence(conversationId);
180
+ if (input.toolCallId) {
181
+ const tool = tools.find((item) => item.toolCallId === input.toolCallId);
182
+ if (!tool) throw new Error("Successful evidence read not found in this execution");
183
+ return reply({
184
+ toolCallId: tool.toolCallId,
185
+ toolName: tool.toolName,
186
+ ...page(tool.body)
187
+ });
188
+ }
189
+ const offset = input.offset ?? 0;
190
+ return reply({
191
+ items: tools.slice(offset, offset + 10).map((tool) => ({
192
+ toolCallId: tool.toolCallId,
193
+ toolName: tool.toolName,
194
+ totalChars: tool.body.length,
195
+ observedAt: tool.observedAt
196
+ })),
197
+ ...offset + 10 < tools.length ? { nextOffset: offset + 10 } : {}
198
+ });
199
+ }
85
200
  if (input.section === "task") {
86
201
  const model = new TaskReadModelProjector().project(new TaskRepository().require(active.taskId));
87
202
  return {
@@ -90,6 +205,10 @@ function createTaskCollaborationTool(deps) {
90
205
  text: JSON.stringify({
91
206
  ok: true,
92
207
  ...model,
208
+ task: {
209
+ ...model.task,
210
+ body: page(model.task.body ?? "")
211
+ },
93
212
  waits: new TaskRunRepository().listActiveWaits(active.taskId)
94
213
  })
95
214
  }],
@@ -0,0 +1,3 @@
1
+ import type { AgentTool } from '@earendil-works/pi-agent-core';
2
+ /** Tool-call IDs are protocol metadata and may be invisible to the model; expose the host ID in Task reads. */
3
+ export declare function withTaskEvidenceIdentity<T extends AgentTool>(tool: T): T;