@xopcai/xopc 0.0.385 → 0.0.387

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/dist/browser-ext/dist/sidepanel.js +1 -1
  2. package/dist/browser-ext/manifest.json +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Cb9eaXxR.js → agent-avatar-dicebear-Bv8M5ygD.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DEV-xtgm.js → agent-defaults-settings-panel-UBy01-65.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-plugin-dialog-DXKc3Luj.js → agent-plugin-dialog-Q9guA8kU.js} +1 -1
  7. package/dist/gateway/static/root/assets/{agents-DcNxwpJQ.js → agents-yfJFubD0.js} +3 -3
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-X5i0Tz7_.js → app-management-settings-panel-Cdyad8c1.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-CmHHzquT.js → appearance-settings-DPPvnKH_.js} +1 -1
  10. package/dist/gateway/static/root/assets/{apps-page-ChFA4Zp0.js → apps-page-Bn_jwaeA.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automations-page-BFqsIqOI.js → automations-page-CAB2sLJ5.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automations-workspace-Blfak-fT.js → automations-workspace-CYRUhhH4.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-CpOLG3Co.js → block-editor-B9DmMEa8.js} +1 -1
  14. package/dist/gateway/static/root/assets/{browser-automations-page-BSbTJ9j2.js → browser-automations-page-BHAWpZE2.js} +1 -1
  15. package/dist/gateway/static/root/assets/{browser-settings-page-BUlILJrB.js → browser-settings-page-BG_17NcQ.js} +2 -2
  16. package/dist/gateway/static/root/assets/{capabilities-2Do3eKMM.js → capabilities-BX1rCiVm.js} +1 -1
  17. package/dist/gateway/static/root/assets/{capabilities-XFwwUNU3.js → capabilities-CW389yo6.js} +1 -1
  18. package/dist/gateway/static/root/assets/{capabilities-page-CeRdkwRf.js → capabilities-page-BAnBYWlY.js} +2 -2
  19. package/dist/gateway/static/root/assets/{capabilities-settings-panel-S-cKsGja.js → capabilities-settings-panel-Ca-d6lXk.js} +3 -3
  20. package/dist/gateway/static/root/assets/{capability-header-actions-6w8pQhnn.js → capability-header-actions-B3TL8TcF.js} +1 -1
  21. package/dist/gateway/static/root/assets/{channels-DfNTGBmp.js → channels-BadpS-nq.js} +1 -1
  22. package/dist/gateway/static/root/assets/{chat-terminal-dock-DnoQHpDc.js → chat-terminal-dock-C_vntFpP.js} +1 -1
  23. package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-BMYIfy9x.js → chunk-KS7C4IRE--EKdQGRF.js} +1 -1
  24. package/dist/gateway/static/root/assets/{computer-settings-page-7yliE7sG.js → computer-settings-page-B-5kxk70.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connector-service-page-DOLAUFSW.js → connector-service-page-DTnfpLHL.js} +1 -1
  26. package/dist/gateway/static/root/assets/{connectors-page-DAsn97XG.js → connectors-page-CmJV7gqj.js} +1 -1
  27. package/dist/gateway/static/root/assets/constants-DeXt1mV-.js +1 -0
  28. package/dist/gateway/static/root/assets/{date-picker-DNDqr4Fk.js → date-picker-D5zYeC8q.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dependency-picker-B5oG7RgE.js → dependency-picker-D72vT-tb.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-K7kUCX1O.js → desktop-pet-DvoeVPf_.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-settings-KgOAuqSh.js → desktop-pet-settings-Dfb392hs.js} +1 -1
  32. package/dist/gateway/static/root/assets/{device-pairing-wizard-DvqniZDm.js → device-pairing-wizard-B06Sqn5D.js} +1 -1
  33. package/dist/gateway/static/root/assets/{directory-picker-path-field-BmOguLDl.js → directory-picker-path-field-CA3H3bc-.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-debug-page-DtHNy4TE.js → extension-debug-page-B0wTBCx4.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-page-DSSuMQxp.js → extension-page-BeHiXhB1.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-provider-nbgU7xBS.js → extension-provider-CJZ5EVpQ.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-settings-page-DSd__mNd.js → extension-settings-page-Q88-LFCJ.js} +1 -1
  38. package/dist/gateway/static/root/assets/{fallback-models-D7bjbiwZ.js → fallback-models-BXoPCvzq.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-settings-hSXGWumL.js → gateway-settings-IICLMGDI.js} +1 -1
  40. package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-C7xJwE61.js → highlighted-body-KQOG7T2V-D336so8z.js} +1 -1
  41. package/dist/gateway/static/root/assets/home-page--MvqsFhQ.js +2 -0
  42. package/dist/gateway/static/root/assets/{imports-page-BufZPzGE.js → imports-page-muV1SduS.js} +1 -1
  43. package/dist/gateway/static/root/assets/index-D0qMv3jf.js +260 -0
  44. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B8pPP5RF.js → keyboard-shortcuts-settings-i1sDWcwl.js} +1 -1
  45. package/dist/gateway/static/root/assets/{local-app-workbench-page-zEtvE7pJ.js → local-app-workbench-page-DY9tXEO6.js} +1 -1
  46. package/dist/gateway/static/root/assets/{local-apps-page-Bli7e_eg.js → local-apps-page-BHD73STy.js} +1 -1
  47. package/dist/gateway/static/root/assets/local-session-drafts-Be4BGM4Z.js +1 -0
  48. package/dist/gateway/static/root/assets/{logs-page-BimZk3R4.js → logs-page-DsPpe8Ws.js} +1 -1
  49. package/dist/gateway/static/root/assets/{management-settings-5Y4COyU9.js → management-settings-Buwi2wQE.js} +1 -1
  50. package/dist/gateway/static/root/assets/{markdown-view-DHfQAvZQ.js → markdown-view-CBjl-XEc.js} +2 -2
  51. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-D2mip-f9.js +1 -0
  52. package/dist/gateway/static/root/assets/{note-detail-panel-KLDPLVg7.js → note-detail-panel-D8n80Gbr.js} +3 -3
  53. package/dist/gateway/static/root/assets/{notes-api-nqN2wKYc.js → notes-api-BlGP533W.js} +1 -1
  54. package/dist/gateway/static/root/assets/{notes-page-DST0oPXD.js → notes-page-Btf-jSS_.js} +5 -5
  55. package/dist/gateway/static/root/assets/{page-context-capture-button-Bmed83-6.js → page-context-capture-button-97RL8Gc7.js} +1 -1
  56. package/dist/gateway/static/root/assets/{personal-page-BG4Ystrm.js → personal-page-B04L8Oz5.js} +1 -1
  57. package/dist/gateway/static/root/assets/product-open-page-9zEDvZa7.js +1 -0
  58. package/dist/gateway/static/root/assets/{product-preview-content-DjmupQSq.js → product-preview-content-DynBrIXq.js} +1 -1
  59. package/dist/gateway/static/root/assets/{project-detail-page-CzBmV0P6.js → project-detail-page-BM7MsoVA.js} +1 -1
  60. package/dist/gateway/static/root/assets/{projects-page-DByqe5Em.js → projects-page-pcyeEJnz.js} +1 -1
  61. package/dist/gateway/static/root/assets/{remote-access-hub-DTjj-odF.js → remote-access-hub-CphyTu22.js} +1 -1
  62. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-B_ptn3T8.js → runtime-tools-settings-panel-DPafoO0G.js} +1 -1
  63. package/dist/gateway/static/root/assets/{scenes-page-wkua4l5y.js → scenes-page-j97FrDRW.js} +2 -2
  64. package/dist/gateway/static/root/assets/{schema-form-VvOSM84Y.js → schema-form-CuJNwKHO.js} +1 -1
  65. package/dist/gateway/static/root/assets/{send-session-input-BCAF-Ikt.js → send-session-input-C293-Hbx.js} +1 -1
  66. package/dist/gateway/static/root/assets/session-manager-COd9RECl.js +16 -0
  67. package/dist/gateway/static/root/assets/{sessions-page-D06XwYAT.js → sessions-page-D8t_8fMl.js} +1 -1
  68. package/dist/gateway/static/root/assets/settings-advanced-gate-CDkitNHA.js +1 -0
  69. package/dist/gateway/static/root/assets/{settings-page-C-6BJdb1.js → settings-page-DS9DMYUe.js} +1 -1
  70. package/dist/gateway/static/root/assets/{setup-status-panel-L0JSG0K-.js → setup-status-panel-DRDvm9yZ.js} +1 -1
  71. package/dist/gateway/static/root/assets/{share-link-dialog-C47Xgzta.js → share-link-dialog-BKGI8Kr0.js} +1 -1
  72. package/dist/gateway/static/root/assets/{share-preview-page-nJ2FWAEP.js → share-preview-page-BF2WaO43.js} +1 -1
  73. package/dist/gateway/static/root/assets/{shares-settings-BbgAUM3v.js → shares-settings-DQTQZu6V.js} +1 -1
  74. package/dist/gateway/static/root/assets/{skill-api-BFU1tPyw.js → skill-api-DzVa7G-O.js} +1 -1
  75. package/dist/gateway/static/root/assets/{skills-page-DZw6el4o.js → skills-page-CfJIjRdS.js} +1 -1
  76. package/dist/gateway/static/root/assets/{system-settings-panel-DshSGWNg.js → system-settings-panel-Bzhqed-a.js} +1 -1
  77. package/dist/gateway/static/root/assets/task-detail-page-BYQFC0-U.js +2 -0
  78. package/dist/gateway/static/root/assets/task-expandable-content-C9ohICpw.js +1 -0
  79. package/dist/gateway/static/root/assets/{tasks-DJIeIk9C.js → tasks-PuIUgF9L.js} +1 -1
  80. package/dist/gateway/static/root/assets/{tunnel-api-DFDXwWnU.js → tunnel-api-DrgpZ81I.js} +1 -1
  81. package/dist/gateway/static/root/assets/{usage-page-2RJLg54s.js → usage-page-Drk8FWnj.js} +1 -1
  82. package/dist/gateway/static/root/assets/{use-composer-attachments-BFP3k6oC.js → use-composer-attachments-rgW7h4sD.js} +1 -1
  83. package/dist/gateway/static/root/assets/{use-file-preview-expanded-B1BiTQNS.js → use-file-preview-expanded-DSKIxfz9.js} +1 -1
  84. package/dist/gateway/static/root/assets/{user-model-page-y1gjGYPI.js → user-model-page-07t2-nFE.js} +2 -2
  85. package/dist/gateway/static/root/assets/{work-discovery-overlay-Ch-KfpCF.js → work-discovery-overlay-TQ5bjVot.js} +1 -1
  86. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CTu297Hc.js → workflow-run-setup-panel-C9HP2uGG.js} +1 -1
  87. package/dist/gateway/static/root/assets/{workflows-page-CRZXG_rm.js → workflows-page-DK01JRI1.js} +3 -3
  88. package/dist/gateway/static/root/assets/{workspace-api-Xr3wz8T3.js → workspace-api-JWHOFos6.js} +2 -2
  89. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-hEfjVjnc.js → xopc-cloud-account-card-B-BhQdAf.js} +1 -1
  90. package/dist/gateway/static/root/index.html +16 -16
  91. package/dist/package.js +1 -1
  92. package/dist/packages/gateway-contract/src/index.js +4 -0
  93. package/dist/packages/gateway-contract/src/result-reference.js +25 -0
  94. package/dist/packages/gateway-contract/src/session-input-command.js +2 -1
  95. package/dist/packages/gateway-contract/src/task-research-result.js +90 -0
  96. package/dist/packages/gateway-contract/src/task-result-delivery.js +21 -0
  97. package/dist/packages/gateway-contract/src/tasks.js +7 -1
  98. package/dist/packages/gateway-contract/src/turn-outcome.js +4 -0
  99. package/dist/src/agent/agent-manager.js +3 -3
  100. package/dist/src/agent/background-review/run-background-review.js +1 -1
  101. package/dist/src/agent/child-agent-factory.d.ts +4 -1
  102. package/dist/src/agent/child-agent-factory.js +86 -12
  103. package/dist/src/agent/context/connection-objective-context.d.ts +1 -0
  104. package/dist/src/agent/context/connection-objective-context.js +33 -0
  105. package/dist/src/agent/data-acquisition/service.js +41 -6
  106. package/dist/src/agent/data-acquisition/types.d.ts +2 -0
  107. package/dist/src/agent/embedded/agent-profile-context.d.ts +7 -0
  108. package/dist/src/agent/embedded/agent-profile-context.js +92 -0
  109. package/dist/src/agent/embedded/run-for-session.js +5 -2
  110. package/dist/src/agent/embedded/run-turn.js +19 -6
  111. package/dist/src/agent/embedded/runs.d.ts +9 -2
  112. package/dist/src/agent/embedded/runs.js +30 -7
  113. package/dist/src/agent/embedded/session-runner.js +5 -2
  114. package/dist/src/agent/embedded/types.d.ts +4 -0
  115. package/dist/src/agent/embedded/xopc-tools-bridge.js +13 -2
  116. package/dist/src/agent/external-tools/cliProvider.js +1 -1
  117. package/dist/src/agent/external-tools/composio-provider.js +2 -2
  118. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  119. package/dist/src/agent/external-tools/gateway-tools.js +8 -4
  120. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  121. package/dist/src/agent/orchestration/agent-run-supervisor.js +2 -1
  122. package/dist/src/agent/orchestration/agent-turn-policy.js +5 -1
  123. package/dist/src/agent/orchestration/delegation-budget.d.ts +7 -1
  124. package/dist/src/agent/orchestration/delegation-budget.js +17 -9
  125. package/dist/src/agent/orchestration/research-checkpoint.d.ts +56 -0
  126. package/dist/src/agent/orchestration/research-checkpoint.js +64 -0
  127. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +3 -1
  128. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +15 -2
  129. package/dist/src/agent/orchestration/run-termination.d.ts +12 -0
  130. package/dist/src/agent/orchestration/run-termination.js +24 -0
  131. package/dist/src/agent/orchestration/turn-recovery.d.ts +4 -1
  132. package/dist/src/agent/orchestration/turn-recovery.js +19 -3
  133. package/dist/src/agent/prompt/sections/agent-identity.js +12 -7
  134. package/dist/src/agent/prompt/sections/messaging-runtime.js +1 -1
  135. package/dist/src/agent/prompt/sections/project-context.js +1 -1
  136. package/dist/src/agent/prompt/sections/response-language.d.ts +1 -1
  137. package/dist/src/agent/prompt/sections/response-language.js +6 -2
  138. package/dist/src/agent/prompt/subagent-context.js +1 -1
  139. package/dist/src/agent/prompt/system-prompt.js +4 -6
  140. package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -0
  141. package/dist/src/agent/service/direct-turn-helpers.js +4 -0
  142. package/dist/src/agent/service/process-direct-one-shot.js +4 -1
  143. package/dist/src/agent/service/process-direct-streaming.js +3 -2
  144. package/dist/src/agent/service.js +2 -2
  145. package/dist/src/agent/skills/index.js +1 -1
  146. package/dist/src/agent/skills/managed-store.js +1 -1
  147. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  148. package/dist/src/agent/source-context/index.js +1 -1
  149. package/dist/src/agent/source-context/result-context.d.ts +2 -0
  150. package/dist/src/agent/source-context/result-context.js +32 -0
  151. package/dist/src/agent/source-context/types.d.ts +2 -2
  152. package/dist/src/agent/source-context/types.js +1 -1
  153. package/dist/src/agent/tasks/task-judge-service.js +3 -1
  154. package/dist/src/agent/tools/apply-patch.js +1 -1
  155. package/dist/src/agent/tools/delegate-tool.js +216 -121
  156. package/dist/src/agent/tools/delegation-policy.js +13 -1
  157. package/dist/src/agent/tools/exec-command.js +47 -2
  158. package/dist/src/agent/tools/factory.js +19 -10
  159. package/dist/src/agent/tools/index.d.ts +1 -0
  160. package/dist/src/agent/tools/index.js +2 -1
  161. package/dist/src/agent/tools/language-diagnostics.js +1 -1
  162. package/dist/src/agent/tools/personal-performance.d.ts +2 -0
  163. package/dist/src/agent/tools/personal-performance.js +82 -0
  164. package/dist/src/agent/tools/personal-read-tool.js +1 -1
  165. package/dist/src/agent/tools/personal-request-tool.js +9 -14
  166. package/dist/src/agent/tools/personal-result-tool.d.ts +2 -0
  167. package/dist/src/agent/tools/personal-result-tool.js +106 -0
  168. package/dist/src/agent/tools/personal-task-tool.d.ts +12 -3
  169. package/dist/src/agent/tools/personal-task-tool.js +115 -10
  170. package/dist/src/agent/tools/publish-artifacts.js +1 -1
  171. package/dist/src/agent/tools/research-checkpoint-tool.d.ts +3 -0
  172. package/dist/src/agent/tools/research-checkpoint-tool.js +28 -0
  173. package/dist/src/agent/tools/review-workspace.js +21 -2
  174. package/dist/src/agent/tools/search/cache.d.ts +20 -0
  175. package/dist/src/agent/tools/search/cache.js +19 -0
  176. package/dist/src/agent/tools/search/errors.d.ts +19 -0
  177. package/dist/src/agent/tools/search/errors.js +69 -0
  178. package/dist/src/agent/tools/search/providers/bing-api.js +2 -1
  179. package/dist/src/agent/tools/search/providers/bing-html.js +2 -1
  180. package/dist/src/agent/tools/search/providers/brave.js +2 -1
  181. package/dist/src/agent/tools/search/providers/duckduckgo-html.js +2 -1
  182. package/dist/src/agent/tools/search/providers/searxng.js +2 -1
  183. package/dist/src/agent/tools/search/providers/tavily.js +2 -1
  184. package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +1 -0
  185. package/dist/src/agent/tools/search/providers/xopc-cloud.js +7 -2
  186. package/dist/src/agent/tools/search/registry.d.ts +21 -5
  187. package/dist/src/agent/tools/search/registry.js +252 -25
  188. package/dist/src/agent/tools/search/types.d.ts +25 -0
  189. package/dist/src/agent/tools/send-media.js +1 -1
  190. package/dist/src/agent/tools/task-collaboration-tool.d.ts +9 -1
  191. package/dist/src/agent/tools/task-collaboration-tool.js +121 -2
  192. package/dist/src/agent/tools/task-evidence.d.ts +3 -0
  193. package/dist/src/agent/tools/task-evidence.js +71 -0
  194. package/dist/src/agent/tools/task-result-tool.d.ts +2 -0
  195. package/dist/src/agent/tools/task-result-tool.js +93 -0
  196. package/dist/src/agent/tools/tool-media.js +1 -1
  197. package/dist/src/agent/tools/web.d.ts +16 -2
  198. package/dist/src/agent/tools/web.js +74 -29
  199. package/dist/src/agent/tools/xopc-use-tool.js +27 -6
  200. package/dist/src/agent/workspace-runtime/registry.js +1 -1
  201. package/dist/src/agent-catalog/capabilities.js +2 -2
  202. package/dist/src/automations/capabilities/drafts.js +1 -1
  203. package/dist/src/automations/capabilities/write.d.ts +4 -4
  204. package/dist/src/automations/domain/validation.d.ts +8 -8
  205. package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -2
  206. package/dist/src/automations/service/action-executor.js +1 -1
  207. package/dist/src/bootstrap/application-state.js +1 -1
  208. package/dist/src/browser/automations/schema.d.ts +2 -2
  209. package/dist/src/browser/automations/service.d.ts +2 -2
  210. package/dist/src/capabilities/runtime/dispatcher.js +1 -1
  211. package/dist/src/capabilities/runtime/product.js +1 -1
  212. package/dist/src/chat-commands/agent-edit.js +1 -1
  213. package/dist/src/cli/commands/agent.js +1 -1
  214. package/dist/src/cli/commands/agents.js +1 -1
  215. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  216. package/dist/src/cli/commands/models.js +1 -1
  217. package/dist/src/cli/commands/onboard/model.js +1 -1
  218. package/dist/src/cli/utils/init-workspace-core.js +1 -1
  219. package/dist/src/config/agent-profile.js +2 -2
  220. package/dist/src/config/index.js +2 -2
  221. package/dist/src/config/loader.js +1 -1
  222. package/dist/src/config/models-json.js +1 -1
  223. package/dist/src/config/schema.d.ts +1 -0
  224. package/dist/src/config/schema.js +5 -2
  225. package/dist/src/connectors/connection-recovery-service.d.ts +3 -1
  226. package/dist/src/connectors/connection-recovery-service.js +67 -6
  227. package/dist/src/discussions/action-tasks.d.ts +2 -2
  228. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  229. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  230. package/dist/src/gateway/agents-admin.js +2 -2
  231. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  232. package/dist/src/gateway/hono/routes/agent-stream.js +1 -1
  233. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  234. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  235. package/dist/src/gateway/hono/routes/context-sources.js +1 -1
  236. package/dist/src/gateway/hono/routes/notes.js +2 -2
  237. package/dist/src/gateway/hono/routes/projects.js +3 -3
  238. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +18 -2
  239. package/dist/src/gateway/hono/routes/session-input-handler.js +2 -2
  240. package/dist/src/gateway/hono/routes/tasks.js +2 -2
  241. package/dist/src/gateway/image-generation-setup.js +1 -1
  242. package/dist/src/gateway/lock.js +1 -1
  243. package/dist/src/gateway/media-access.js +1 -1
  244. package/dist/src/gateway/service/agent-runner.d.ts +2 -0
  245. package/dist/src/gateway/service/agent-runner.js +30 -17
  246. package/dist/src/gateway/service/run-gateway-agent.js +32 -2
  247. package/dist/src/gateway/service/session-input-coordinator.d.ts +10 -1
  248. package/dist/src/gateway/service/session-input-coordinator.js +214 -27
  249. package/dist/src/gateway/service.d.ts +1 -0
  250. package/dist/src/gateway/service.js +49 -16
  251. package/dist/src/gateway/session-context-summary.js +1 -1
  252. package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
  253. package/dist/src/home-intelligence/host.js +2 -2
  254. package/dist/src/local-apps/service.js +1 -1
  255. package/dist/src/media/session-references.js +1 -1
  256. package/dist/src/personal-agent/communication.js +1 -0
  257. package/dist/src/personal-agent/performance.d.ts +83 -0
  258. package/dist/src/personal-agent/performance.js +65 -0
  259. package/dist/src/personal-agent/policy.d.ts +1 -1
  260. package/dist/src/personal-agent/policy.js +1 -0
  261. package/dist/src/personal-agent/proactivity/service.js +1 -1
  262. package/dist/src/personal-agent/prompt-context.js +3 -1
  263. package/dist/src/personal-agent/prompts.js +10 -4
  264. package/dist/src/personal-agent/reply-composer.d.ts +1 -0
  265. package/dist/src/personal-agent/reply-composer.js +149 -20
  266. package/dist/src/personal-agent/reply-style.d.ts +1 -1
  267. package/dist/src/personal-agent/reply-style.js +1 -0
  268. package/dist/src/personal-agent/repository.d.ts +1 -1
  269. package/dist/src/personal-agent/repository.js +1 -1
  270. package/dist/src/personal-agent/request-delivery.js +3 -1
  271. package/dist/src/personal-agent/request-repository.d.ts +2 -0
  272. package/dist/src/personal-agent/request-service.d.ts +4 -0
  273. package/dist/src/personal-agent/request-service.js +91 -20
  274. package/dist/src/personal-agent/result-extraction.d.ts +42 -0
  275. package/dist/src/personal-agent/result-extraction.js +209 -0
  276. package/dist/src/personal-agent/result-file-links.d.ts +3 -0
  277. package/dist/src/personal-agent/result-file-links.js +21 -0
  278. package/dist/src/personal-agent/result-read-continuations.d.ts +13 -0
  279. package/dist/src/personal-agent/result-read-continuations.js +78 -0
  280. package/dist/src/personal-agent/result-reader.d.ts +43 -0
  281. package/dist/src/personal-agent/result-reader.js +461 -0
  282. package/dist/src/personal-agent/service.js +2 -2
  283. package/dist/src/personal-agent/task-cancel.js +85 -35
  284. package/dist/src/providers/model-catalog-persistence.js +1 -1
  285. package/dist/src/routing/resolve-route.js +1 -1
  286. package/dist/src/routing/resolve-tui-session-key.js +1 -1
  287. package/dist/src/scenes/taskFollowUp/service.d.ts +15 -5
  288. package/dist/src/session/client-history.d.ts +1 -1
  289. package/dist/src/session/client-history.js +1 -1
  290. package/dist/src/session/session-context-for-llm.js +4 -2
  291. package/dist/src/session/store.d.ts +3 -1
  292. package/dist/src/session/store.js +13 -3
  293. package/dist/src/share/hosted-session-share.js +1 -1
  294. package/dist/src/storage/sqlite/connection-wait-repository.d.ts +5 -2
  295. package/dist/src/storage/sqlite/connection-wait-repository.js +42 -17
  296. package/dist/src/storage/sqlite/index.d.ts +1 -0
  297. package/dist/src/storage/sqlite/index.js +3 -1
  298. package/dist/src/storage/sqlite/migrations/250_research_checkpoints.sql +15 -0
  299. package/dist/src/storage/sqlite/migrations/251_personal_result_reads.sql +40 -0
  300. package/dist/src/storage/sqlite/migrations/252_task_work_revisions.sql +15 -0
  301. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  302. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  303. package/dist/src/storage/sqlite/research-checkpoint-repository.d.ts +24 -0
  304. package/dist/src/storage/sqlite/research-checkpoint-repository.js +91 -0
  305. package/dist/src/storage/sqlite/schema.js +1 -1
  306. package/dist/src/storage/sqlite/session-creation-repository.js +3 -2
  307. package/dist/src/storage/sqlite/session-input-repository.d.ts +16 -0
  308. package/dist/src/storage/sqlite/session-input-repository.js +41 -7
  309. package/dist/src/tasks/capabilities/management.d.ts +2 -2
  310. package/dist/src/tasks/capabilities/read.js +2 -2
  311. package/dist/src/tasks/capabilities/relations.d.ts +7 -7
  312. package/dist/src/tasks/capabilities/write.d.ts +2 -2
  313. package/dist/src/tasks/capabilities/write.js +1 -1
  314. package/dist/src/tasks/index.js +1 -1
  315. package/dist/src/tasks/task-allocation-service.d.ts +2 -0
  316. package/dist/src/tasks/task-allocation-service.js +100 -8
  317. package/dist/src/tasks/task-application-service.d.ts +18 -0
  318. package/dist/src/tasks/task-application-service.js +133 -2
  319. package/dist/src/tasks/task-context-assembler.js +13 -5
  320. package/dist/src/tasks/task-continuation.d.ts +1 -0
  321. package/dist/src/tasks/task-continuation.js +1 -0
  322. package/dist/src/tasks/task-contract-definition.d.ts +3 -0
  323. package/dist/src/tasks/task-contract-planner.d.ts +1 -0
  324. package/dist/src/tasks/task-contract-planner.js +61 -20
  325. package/dist/src/tasks/task-conversation-repository.js +1 -1
  326. package/dist/src/tasks/task-evidence-ranges.d.ts +7 -0
  327. package/dist/src/tasks/task-evidence-ranges.js +20 -0
  328. package/dist/src/tasks/task-execution-capabilities.d.ts +26 -0
  329. package/dist/src/tasks/task-execution-capabilities.js +117 -0
  330. package/dist/src/tasks/task-handoff-service.js +1 -1
  331. package/dist/src/tasks/task-handoff.d.ts +56 -0
  332. package/dist/src/tasks/task-handoff.js +510 -0
  333. package/dist/src/tasks/task-model-call.d.ts +7 -0
  334. package/dist/src/tasks/task-model-call.js +35 -0
  335. package/dist/src/tasks/task-read-model-projector.d.ts +6 -0
  336. package/dist/src/tasks/task-read-model-projector.js +12 -1
  337. package/dist/src/tasks/task-research-repair.d.ts +19 -0
  338. package/dist/src/tasks/task-research-repair.js +79 -0
  339. package/dist/src/tasks/task-research-result.d.ts +99 -0
  340. package/dist/src/tasks/task-research-result.js +478 -0
  341. package/dist/src/tasks/task-result-delivery-repository.js +37 -3
  342. package/dist/src/tasks/task-result-delivery-service.js +38 -10
  343. package/dist/src/tasks/task-run-coordinator.js +71 -15
  344. package/dist/src/tasks/task-run-dispatcher.d.ts +1 -0
  345. package/dist/src/tasks/task-run-dispatcher.js +3 -1
  346. package/dist/src/tasks/task-run-repository.d.ts +5 -0
  347. package/dist/src/tasks/task-run-repository.js +88 -1
  348. package/dist/src/tui/backends/embedded-backend.js +2 -2
  349. package/dist/src/voice/realtime/persona-context.js +1 -1
  350. package/package.json +12 -6
  351. package/dist/gateway/static/root/assets/constants-Dy8Gw0sF.js +0 -1
  352. package/dist/gateway/static/root/assets/home-page-DJNmlMfH.js +0 -2
  353. package/dist/gateway/static/root/assets/index-K8SXDtxr.js +0 -260
  354. package/dist/gateway/static/root/assets/local-session-drafts-D_tYFy7d.js +0 -1
  355. package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DBRj4-1-.js +0 -1
  356. package/dist/gateway/static/root/assets/product-open-page-CXkYP9xE.js +0 -1
  357. package/dist/gateway/static/root/assets/session-manager-_yy4bxhT.js +0 -16
  358. package/dist/gateway/static/root/assets/settings-advanced-gate-DoAHy1wj.js +0 -1
  359. package/dist/gateway/static/root/assets/task-detail-page-CfZhq4XZ.js +0 -2
  360. package/dist/gateway/static/root/assets/task-expandable-content-CF6Bj-Qa.js +0 -1
@@ -1,3 +1,5 @@
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";
@@ -7,16 +9,37 @@ import { TaskReadModelProjector } from "../../tasks/task-read-model-projector.js
7
9
  import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
8
10
  import { getEmbeddedExecutionSession } from "../embedded/execution-context.js";
9
11
  import { TaskCollaborationRepository } from "../../tasks/task-collaboration-repository.js";
12
+ import { taskResearchEvidence } from "../../tasks/task-research-result.js";
13
+ import { assertTaskHandoffAccess, assertTaskHandoffExecutorAccess, getTaskHandoff, materializeTaskHandoffFile, readTaskHandoffSource } from "../../tasks/task-handoff.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;
@@ -0,0 +1,71 @@
1
+ import { suggestedEvidenceRanges } from "../../tasks/task-evidence-ranges.js";
2
+ //#region src/agent/tools/task-evidence.ts
3
+ /** Tool-call IDs are protocol metadata and may be invisible to the model; expose the host ID in Task reads. */
4
+ function withTaskEvidenceIdentity(tool) {
5
+ if (!new Set([
6
+ "read_file",
7
+ "read_media",
8
+ "web_fetch",
9
+ "web_search",
10
+ "web_extract",
11
+ "exec_command",
12
+ "managed_job",
13
+ "xopc_tool_execute",
14
+ "publish_artifacts",
15
+ "session_status",
16
+ "task_collaboration"
17
+ ]).has(tool.name)) return tool;
18
+ return {
19
+ ...tool,
20
+ execute: async (...args) => {
21
+ const result = await tool.execute(args[0], args[1], args[2], args[3]);
22
+ const artifacts = tool.name === "publish_artifacts" ? result.details?.artifacts : void 0;
23
+ const receipt = artifacts ? [{
24
+ type: "text",
25
+ text: JSON.stringify({
26
+ publishedArtifacts: artifacts.map(({ artifactId, title, availability }) => ({
27
+ artifactId,
28
+ title,
29
+ availability
30
+ })),
31
+ guidance: "Use exact artifactId values in publish_task_result.finalArtifactIds to select final deliverables."
32
+ })
33
+ }] : [];
34
+ const execution = result.details;
35
+ const body = result.content.filter((part) => part.type === "text").map((part) => part.text).join("\n");
36
+ const ranges = !result.isError && ![
37
+ "failed",
38
+ "blocked",
39
+ "running",
40
+ "timed_out",
41
+ "cancelled"
42
+ ].includes(execution?.status ?? "") && (tool.name !== "managed_job" || execution?.status === "success" && execution.exitCode === 0) ? [{
43
+ type: "text",
44
+ text: JSON.stringify({ evidence: {
45
+ toolCallId: args[0],
46
+ excerptRanges: suggestedEvidenceRanges(body),
47
+ guidance: "Prefer toolCallId plus excerptRange in publish_task_result.sources; omit excerpt. The host copies exact observed output. For a yielded command cite the successful managed_job completion ID, not the earlier running exec_command. Never rerun completed work merely to obtain evidence. Never reconstruct quoted code, escapes or input commands. This identifies provenance; claim support still requires review."
48
+ } })
49
+ }] : [];
50
+ const quote = tool.name === "exec_command" && execution?.status === "success" && execution.exitCode === 0 ? [{
51
+ type: "text",
52
+ text: "Evidence quoting: copy a short contiguous passage from the output above. The input command is not output; never prepend it to an excerpt. Successful execution and exitCode=0 are host metadata, not extra lines to invent in a quote."
53
+ }] : [];
54
+ return {
55
+ ...result,
56
+ content: [
57
+ ...result.content,
58
+ ...receipt,
59
+ ...quote,
60
+ ...ranges,
61
+ {
62
+ type: "text",
63
+ text: `Task source toolCallId: ${args[0]}`
64
+ }
65
+ ]
66
+ };
67
+ }
68
+ };
69
+ }
70
+ //#endregion
71
+ export { withTaskEvidenceIdentity };
@@ -0,0 +1,2 @@
1
+ import type { AgentTool } from '@earendil-works/pi-agent-core';
2
+ export declare function createTaskResultTool(getConversationId: () => string | undefined): AgentTool;
@@ -0,0 +1,93 @@
1
+ import { submitTaskResearchResult } from "../../tasks/task-research-result.js";
2
+ import { Type } from "@sinclair/typebox";
3
+ //#region src/agent/tools/task-result-tool.ts
4
+ const id = Type.String({
5
+ minLength: 1,
6
+ maxLength: 120
7
+ });
8
+ const schema = Type.Object({
9
+ finalArtifactIds: Type.Optional(Type.Array(Type.String({ minLength: 1 }), {
10
+ maxItems: 50,
11
+ uniqueItems: true
12
+ })),
13
+ mode: Type.Optional(Type.Union([Type.Literal("replace"), Type.Literal("amend")])),
14
+ retireClaimIds: Type.Optional(Type.Array(id, { maxItems: 40 })),
15
+ sources: Type.Array(Type.Object({
16
+ id,
17
+ toolCallId: Type.Optional(Type.String()),
18
+ excerpt: Type.Optional(Type.String({
19
+ minLength: 1,
20
+ maxLength: 2e3
21
+ })),
22
+ excerptRange: Type.Optional(Type.Object({
23
+ start: Type.Integer({ minimum: 0 }),
24
+ end: Type.Integer({ minimum: 1 })
25
+ }, { additionalProperties: false })),
26
+ url: Type.Optional(Type.String())
27
+ }, {
28
+ additionalProperties: false,
29
+ oneOf: [{
30
+ required: ["excerpt"],
31
+ not: { required: ["excerptRange"] }
32
+ }, {
33
+ required: ["toolCallId", "excerptRange"],
34
+ not: { required: ["excerpt"] }
35
+ }]
36
+ }), {
37
+ minItems: 1,
38
+ maxItems: 40
39
+ }),
40
+ claims: Type.Array(Type.Object({
41
+ id,
42
+ statement: Type.String({
43
+ minLength: 1,
44
+ maxLength: 2e3
45
+ }),
46
+ kind: Type.Union([
47
+ Type.Literal("fact"),
48
+ Type.Literal("inference"),
49
+ Type.Literal("recommendation")
50
+ ]),
51
+ sourceIds: Type.Array(id, {
52
+ minItems: 1,
53
+ maxItems: 8
54
+ })
55
+ }, { additionalProperties: false }), {
56
+ minItems: 1,
57
+ maxItems: 40
58
+ })
59
+ }, { additionalProperties: false });
60
+ function createTaskResultTool(getConversationId) {
61
+ return {
62
+ name: "publish_task_result",
63
+ label: "Publish research conclusions",
64
+ parameters: schema,
65
+ description: "For sources prefer toolCallId plus excerptRange {start,end} copied from evidence receipts, and OMIT excerpt. Ranges use Unicode character offsets, at most 1000 characters; the host extracts the original successful read exactly so code escapes and commands cannot corrupt quotes. Supply exactly one of excerptRange or a short exact excerpt. Never include the input command as output. When this execution published files, finalArtifactIds is required: explicitly select the exact artifact IDs from publication receipts for the final delivery. Exclude intermediate, failed, obsolete and unrelated files. [] explicitly selects a text-only final result. New submissions replace this final selection; no historical union. Submit Task research evidence for per-criterion review; publish required files first. Initial submission creates the ledger; subsequent submissions default to amend so earlier evidence is retained. Use explicit replace only for a complete replacement ledger. During repair retain stable source/claim IDs, update targeted claims and retire obsolete/wrong claim IDs with retireClaimIds. All retained claims are reviewed again. Reviewer support/note/checks fields are read-only; never send them back in sources or claims. Never drop valid calculation/input evidence merely to fix a file. Negative assertions such as \"never reran a script\" need an observable, scoped execution record; do not invent proof of absence or add an unnecessary absolute negative claim. Keep prohibitions as constraints, and retire unsupported optional claims while retaining required verified findings. Sources require short contiguous exact excerpts from successful read_file/read_media/web/exec/session_status results or publication receipts in this TaskRun. Never concatenate passages, invent call IDs, or cite an earlier review as factual evidence. Use task_collaboration get section evidence to list/read original toolCallIds. Your planned final reply is not evidence and should not become a claim about future delivery. On source_quote_mismatch follow the recovery instruction; never repeat unchanged sources. Prefer original inputs; the host reads published reports/scripts. URL is optional; actual web metadata is preserved. Claims reference source IDs and distinguish fact/inference/recommendation. Publication receipts prove availability, not prices. This binds provenance and runs model review, not independent fact certification. Resubmit changed evidence or adopted directions; do not endlessly repeat unchanged data when review is unavailable. Do not use outside a Task.",
66
+ supportsParallel: false,
67
+ mutationScope: "none",
68
+ idempotent: false,
69
+ async execute(toolCallId, input, signal) {
70
+ const conversationId = getConversationId();
71
+ if (!conversationId) throw new Error("Task conversation is required");
72
+ const research = await submitTaskResearchResult(conversationId, toolCallId, input, signal);
73
+ const readyForCompletion = research.checks.length > 0 && research.checks.every((check) => check.status === "passed") && (research.instructionChecks ?? []).every((check) => check.status === "passed") && research.claims.every((claim) => claim.support === "supported");
74
+ return {
75
+ content: [{
76
+ type: "text",
77
+ text: JSON.stringify({
78
+ saved: true,
79
+ readyForCompletion,
80
+ ...readyForCompletion ? {} : { nextAction: "The saved ledger is not fully verified. Before finishing, amend evidence for required unsupported findings; retire optional unsupported claims with retireClaimIds while preserving valid required evidence. Do not replay completed or uncertain operations just to change the ledger. If a required finding cannot be verified safely, retain an honest partial result." },
81
+ review: research.review,
82
+ claims: research.claims,
83
+ checks: research.checks,
84
+ instructionChecks: research.instructionChecks
85
+ })
86
+ }],
87
+ details: { research }
88
+ };
89
+ }
90
+ };
91
+ }
92
+ //#endregion
93
+ export { createTaskResultTool };
@@ -1,5 +1,5 @@
1
- import { sniffImageMimeType } from "../image/generation/image-assets.js";
2
1
  import { MEDIA_ARTIFACT_MAX_BYTES, mimeTypeFromMediaPath, saveMediaBuffer } from "../../media/store.js";
2
+ import { sniffImageMimeType } from "../image/generation/image-assets.js";
3
3
  import { basename } from "node:path";
4
4
  //#region src/agent/tools/tool-media.ts
5
5
  function hasImageMagic(buffer) {
@@ -1,4 +1,18 @@
1
- import type { AgentTool } from '@earendil-works/pi-agent-core';
1
+ import type { AgentTool, AgentToolResult } from '@earendil-works/pi-agent-core';
2
2
  import type { Config } from '../../config/schema.js';
3
- export declare function createWebSearchTool(getConfig: () => Config | undefined): AgentTool;
3
+ export interface WebSearchBatchTool extends AgentTool {
4
+ executeSearchBatch(requests: Array<{
5
+ id: string;
6
+ query: string;
7
+ count?: number;
8
+ }>, signal?: AbortSignal, authorize?: () => void): Promise<{
9
+ items: Array<{
10
+ id: string;
11
+ result: AgentToolResult<any>;
12
+ }>;
13
+ sourceRequests: number;
14
+ }>;
15
+ }
16
+ export declare function createWebSearchTool(getConfig: () => Config | undefined): WebSearchBatchTool;
17
+ export declare function extractReadableText(html: string, pageUrl: string): Promise<string>;
4
18
  export declare function createWebFetchTool(getConfig: () => Config | undefined): AgentTool;
@@ -1,3 +1,4 @@
1
+ import { SearchError, classifySearchError, searchFailureInfo } from "./search/errors.js";
1
2
  import { SearchProviderRegistry } from "./search/registry.js";
2
3
  import { resolveWebSearchConfig } from "./search/resolve-config.js";
3
4
  import { fetchPublicText } from "./fetch-text.js";
@@ -10,52 +11,93 @@ const WebSearchSchema = Type.Object({
10
11
  function formatSearchResults(results) {
11
12
  return results.map((r, i) => `${i + 1}. ${r.title}\n ${r.url}\n ${r.description ? `${r.description}` : ""}`).join("\n\n");
12
13
  }
14
+ function searchToolResult(query, count, response) {
15
+ return {
16
+ content: [{
17
+ type: "text",
18
+ text: response.results.length ? formatSearchResults(response.results) : "No results found."
19
+ }],
20
+ details: {
21
+ results: response.results,
22
+ provider: response.provider,
23
+ query,
24
+ count,
25
+ cached: response.cached ?? false,
26
+ capturedAt: response.capturedAt
27
+ }
28
+ };
29
+ }
30
+ function searchToolError(error, signal) {
31
+ const failure = classifySearchError(error, signal);
32
+ return {
33
+ content: [{
34
+ type: "text",
35
+ text: `Search error (${failure.kind}): ${failure.message}`
36
+ }],
37
+ details: {
38
+ results: [],
39
+ error: failure.message,
40
+ failure: searchFailureInfo(failure),
41
+ status: failure.kind === "cancelled" ? "cancelled" : "failed"
42
+ }
43
+ };
44
+ }
13
45
  function createWebSearchTool(getConfig) {
14
46
  return {
15
47
  name: "web_search",
16
- description: "Search the web. Uses configured search APIs when set; otherwise falls back to a built-in HTML search (region-aware).",
48
+ description: "Search the web using authorized configured providers or the region-aware HTML fallback. Search failures retain permission, rate-limit and timeout reasons. Research reuses recent successful queries; permission refusals are not bypassed.",
17
49
  parameters: WebSearchSchema,
18
50
  label: "🔍 Web Search",
19
51
  supportsParallel: true,
20
- async execute(_toolCallId, params, signal) {
21
- const p = params;
52
+ async execute(_id, params, signal) {
22
53
  const cfg = resolveWebSearchConfig(getConfig()?.tools?.web);
23
54
  const registry = new SearchProviderRegistry(cfg);
24
- const count = p.count ?? cfg.maxResults ?? 5;
55
+ const count = Math.max(1, Math.min(20, Math.floor(params.count ?? cfg.maxResults ?? 5)));
25
56
  try {
26
- const { results, provider } = await registry.search(p.query, count, signal);
27
- if (results.length === 0) return {
28
- content: [{
29
- type: "text",
30
- text: "No results found."
31
- }],
32
- details: {
33
- results: [],
34
- provider
35
- }
36
- };
57
+ const response = await registry.search(params.query, count, signal);
58
+ const result = searchToolResult(params.query, count, response);
37
59
  return {
38
- content: [{
39
- type: "text",
40
- text: formatSearchResults(results)
41
- }],
60
+ ...result,
42
61
  details: {
43
- results,
44
- provider
62
+ ...result.details,
63
+ sourceRequests: registry.sourceRequests
45
64
  }
46
65
  };
47
66
  } catch (error) {
67
+ const result = searchToolError(error, signal);
48
68
  return {
49
- content: [{
50
- type: "text",
51
- text: `Search error: ${error instanceof Error ? error.message : String(error)}`
52
- }],
69
+ ...result,
53
70
  details: {
54
- results: [],
55
- error: error instanceof Error ? error.message : String(error)
71
+ ...result.details,
72
+ sourceRequests: registry.sourceRequests
56
73
  }
57
74
  };
58
75
  }
76
+ },
77
+ async executeSearchBatch(requests, signal, authorize = () => {}) {
78
+ const cfg = resolveWebSearchConfig(getConfig()?.tools?.web);
79
+ const registry = new SearchProviderRegistry(cfg);
80
+ const inputs = requests.map((request) => ({
81
+ ...request,
82
+ count: Math.max(1, Math.min(20, Math.floor(request.count ?? cfg.maxResults ?? 5)))
83
+ }));
84
+ const responses = await registry.searchBatch(inputs, signal, authorize);
85
+ return {
86
+ sourceRequests: registry.sourceRequests,
87
+ items: responses.map((item) => {
88
+ const result = item.response ? searchToolResult(item.query, item.count, item.response) : searchToolError(new SearchError(item.error), signal);
89
+ return {
90
+ id: item.id,
91
+ result: {
92
+ ...result,
93
+ details: {
94
+ ...result.details,
95
+ fallback: item.fallback
96
+ }
97
+ }
98
+ };
99
+ })
100
+ };
59
101
  }
60
102
  };
61
103
  }
@@ -70,8 +112,11 @@ async function extractReadableText(html, pageUrl) {
70
112
  const { parseHTML } = await import("linkedom");
71
113
  const { Readability } = await import("@mozilla/readability");
72
114
  const { document } = parseHTML(html);
115
+ const paragraphs = [...document.querySelector("main, [role=\"main\"]")?.querySelectorAll("p") ?? []].filter((element) => !element.closest("nav, aside, footer, header")).map((element) => element.textContent?.replace(/\s+/g, " ").trim() ?? "").filter((text) => text.length >= 40 && text.length <= 2e3);
73
116
  Object.defineProperty(document, "documentURI", { value: pageUrl });
74
- return new Readability(document).parse()?.textContent?.trim() ?? "";
117
+ const text = new Readability(document).parse()?.textContent?.trim() ?? "";
118
+ const normalized = text.replace(/\s+/g, " ");
119
+ return [...[...new Set(paragraphs)].filter((paragraph) => !normalized.includes(paragraph)), text].filter(Boolean).join("\n\n");
75
120
  }
76
121
  function createWebFetchTool(getConfig) {
77
122
  return {
@@ -122,4 +167,4 @@ function createWebFetchTool(getConfig) {
122
167
  };
123
168
  }
124
169
  //#endregion
125
- export { createWebFetchTool, createWebSearchTool };
170
+ export { createWebFetchTool, createWebSearchTool, extractReadableText };
@@ -11,25 +11,26 @@ import { TaskRunRepository } from "../../tasks/task-run-repository.js";
11
11
  import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
12
12
  import { init_sqlite } from "../../storage/sqlite/index.js";
13
13
  import "../../activity/index.js";
14
- import { CapabilityError } from "../../capabilities/runtime/errors.js";
15
- import "../../capabilities/runtime/dispatcher.js";
16
14
  import { getDefaultAgentId, init_resolve_route } from "../../routing/resolve-route.js";
17
15
  import { resolveTaskLocale } from "../../tasks/task-language.js";
18
16
  import { TaskReadModelProjector } from "../../tasks/task-read-model-projector.js";
19
17
  import { TaskOriginRepository } from "../../tasks/task-origin-repository.js";
20
18
  import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
19
+ import { CapabilityError } from "../../capabilities/runtime/errors.js";
20
+ import "../../capabilities/runtime/dispatcher.js";
21
21
  import { resolveProjectAgentId } from "../../projects/project-agent.js";
22
22
  import "../../projects/index.js";
23
+ import { TaskCollaborationRepository } from "../../tasks/task-collaboration-repository.js";
24
+ import { defineTaskContract } from "../../tasks/task-contract-definition.js";
23
25
  import { resolveResponseLanguageForSession } from "../prompt/response-language.js";
24
26
  import { TaskDeletionService } from "../../tasks/task-deletion-service.js";
25
27
  import { TaskDeleteOutputSchema } from "../../tasks/capabilities/management.js";
26
- import { TaskCollaborationRepository } from "../../tasks/task-collaboration-repository.js";
28
+ import { parseTaskHandoffReferences } from "../../tasks/task-handoff.js";
27
29
  import { TaskApplicationService } from "../../tasks/task-application-service.js";
28
30
  import { AutomationCreateCapabilityInputSchema, AutomationUpdatePatchSchema } from "../../automations/capabilities/write.js";
29
31
  import { TaskMutationOutputSchema } from "../../tasks/capabilities/write.js";
30
32
  import { createProductDispatcher } from "../../capabilities/runtime/product.js";
31
33
  import { localAppCapabilities } from "../../local-apps/capabilities/runtime.js";
32
- import { defineTaskContract } from "../../tasks/task-contract-definition.js";
33
34
  import "../../tasks/index.js";
34
35
  import { randomUUID } from "node:crypto";
35
36
  import { Type } from "@sinclair/typebox";
@@ -1472,6 +1473,16 @@ async function handleTask(command, args, deps, dryRun, capabilities) {
1472
1473
  explicitAgentId,
1473
1474
  projectId
1474
1475
  }) : explicitAgentId ?? (config ? getDefaultAgentId() : deps.getCurrentAgentId?.() ?? "main");
1476
+ const sourceRefs = parseTaskHandoffReferences(args.sourceRefs);
1477
+ if (!sourceRefs || sourceRefs.some((ref) => ![
1478
+ "result",
1479
+ "note",
1480
+ "task",
1481
+ "file"
1482
+ ].includes(ref.kind))) return {
1483
+ ok: false,
1484
+ error: "Invalid selected task sourceRefs"
1485
+ };
1475
1486
  const input = {
1476
1487
  idempotencyKey: trimString(args.idempotencyKey) ?? randomUUID(),
1477
1488
  title: trimString(args.title) ?? objective,
@@ -1488,14 +1499,24 @@ async function handleTask(command, args, deps, dryRun, capabilities) {
1488
1499
  outputDestinations: []
1489
1500
  },
1490
1501
  dependencies: dependsOnTaskIds,
1491
- context: args.includeConversationContext === false ? [] : conversationId ? [{
1502
+ context: [...args.includeConversationContext === false ? [] : conversationId ? [{
1492
1503
  targetKind: "session",
1493
1504
  targetId: conversationId,
1494
1505
  role: "input",
1495
1506
  pinned: false,
1496
1507
  retrievalPolicy: {},
1497
1508
  metadata: {}
1498
- }] : [],
1509
+ }] : [], ...sourceRefs.map((ref) => ({
1510
+ targetKind: "source",
1511
+ targetId: `${ref.kind}:${ref.sourceId}`,
1512
+ role: "input",
1513
+ pinned: true,
1514
+ retrievalPolicy: { currentAuthorizationRequired: true },
1515
+ metadata: {
1516
+ kind: "task_reference_request",
1517
+ ref
1518
+ }
1519
+ }))],
1499
1520
  authorityGrants: [],
1500
1521
  activation: createMode === "allocate" ? {
1501
1522
  mode: "allocate",
@@ -1,5 +1,5 @@
1
- import { init_agent_scope, resolveAgentIdForWorkspacePath } from "../agent-scope.js";
2
1
  import { init_agent_session_key, normalizeAgentId } from "../../routing/agent-session-key.js";
2
+ import { init_agent_scope, resolveAgentIdForWorkspacePath } from "../agent-scope.js";
3
3
  import { SkillManager } from "../skills/skill-manager.js";
4
4
  import { SystemPromptBuilder } from "../prompt/service-prompt-builder.js";
5
5
  import { UserContextRuntimeRegistry } from "../../user-context/runtime.js";
@@ -1,10 +1,10 @@
1
1
  import { AgentEntrySchema, EffectiveAgentConfigSchema } from "../agent-config/schema.js";
2
2
  import { resolveEffectiveAgentConfig } from "../agent-config/resolver.js";
3
3
  import { init_agent_config } from "../agent-config/index.js";
4
- import { CapabilityError } from "../capabilities/runtime/errors.js";
5
- import { defineAtomicCapability, defineReadCapability } from "../capabilities/runtime/dispatcher.js";
6
4
  import { AgentCatalogRepository, init_repository } from "./repository.js";
7
5
  import { init_agent_scope, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
6
+ import { CapabilityError } from "../capabilities/runtime/errors.js";
7
+ import { defineAtomicCapability, defineReadCapability } from "../capabilities/runtime/dispatcher.js";
8
8
  import { AgentCatalogService } from "./service.js";
9
9
  import { z } from "zod";
10
10
  //#region src/agent-catalog/capabilities.ts
@@ -3,10 +3,10 @@ import { init_src } from "../../../packages/gateway-contract/src/index.js";
3
3
  import { init_trust_policy, resolveAutomationSafetyForTrust } from "../../user-context/trust-policy.js";
4
4
  import { getUserTrustPolicy } from "../../storage/sqlite/user-trust-repository.js";
5
5
  import { init_sqlite } from "../../storage/sqlite/index.js";
6
+ import { init_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
6
7
  import { CapabilityError } from "../../capabilities/runtime/errors.js";
7
8
  import { ExternalEffectNotAppliedError } from "../../capabilities/runtime/external-operations.js";
8
9
  import { defineExternalCapability, defineReadCapability } from "../../capabilities/runtime/dispatcher.js";
9
- import { init_agent_scope, resolveDefaultAgentId } from "../../agent/agent-scope.js";
10
10
  import { AutomationCreateCapabilityInputSchema } from "./write.js";
11
11
  import { simulateAutomation } from "../draft/automation-draft-validator.js";
12
12
  import { AutomationDraftService } from "../draft/automation-draft-service.js";