@xopcai/xopc 0.0.460 → 0.0.462

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 (264) hide show
  1. package/dist/browser-ext/dist/assets/{pcm-capture-worklet-CGN9Mlhg.js → pcm-capture-worklet-Df5TcFw4.js} +4 -2
  2. package/dist/browser-ext/dist/sidepanel.js +3 -2
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/extensions/telegram/xopc.extension.json +1 -1
  5. package/dist/gateway/static/root/assets/{agents-CGUdvmIT.js → agents-DC0lHtl5.js} +3 -3
  6. package/dist/gateway/static/root/assets/{apps-page-M2XD1Pzu.js → apps-page-QLOYw2QR.js} +1 -1
  7. package/dist/gateway/static/root/assets/{automation-task-card-CiJmJ7_h.js → automation-task-card-CJbIHRxN.js} +1 -1
  8. package/dist/gateway/static/root/assets/{automations-page-CVjgENMO.js → automations-page-DpKnqajR.js} +1 -1
  9. package/dist/gateway/static/root/assets/{automations-workspace-CGPWyL0P.js → automations-workspace-BXT_EDON.js} +2 -2
  10. package/dist/gateway/static/root/assets/{block-editor-CmnkluMF.js → block-editor-DrZyRQQ0.js} +5 -5
  11. package/dist/gateway/static/root/assets/{capabilities-DDqDvCBs.js → capabilities-Dr-vvMez.js} +1 -1
  12. package/dist/gateway/static/root/assets/capabilities-hSb-qEgL.js +1 -0
  13. package/dist/gateway/static/root/assets/capabilities-page-CnU0htlO.js +2 -0
  14. package/dist/gateway/static/root/assets/{capabilities-settings-panel-CvF8VRTv.js → capabilities-settings-panel-B08mjrGB.js} +1 -1
  15. package/dist/gateway/static/root/assets/{channels-BDVQ6Z7A.js → channels-B--IHNs4.js} +1 -1
  16. package/dist/gateway/static/root/assets/{chat-chart-block-stPJEZ90.js → chat-chart-block-ClCZyIi0.js} +1 -1
  17. package/dist/gateway/static/root/assets/chat-page-U2a7d6wP.js +71 -0
  18. package/dist/gateway/static/root/assets/{chat-terminal-dock-B4uA_W6R.js → chat-terminal-dock-eneTvxV3.js} +1 -1
  19. package/dist/gateway/static/root/assets/{connectors-page-DyzDVVfz.js → connectors-page-Bs29RvXz.js} +1 -1
  20. package/dist/gateway/static/root/assets/constants-Bg1wM2nv.js +1 -0
  21. package/dist/gateway/static/root/assets/diagnostics-Bo0Z42P_.js +1 -0
  22. package/dist/gateway/static/root/assets/{extension-debug-page-BPwRrP3L.js → extension-debug-page-Bn_5xu_M.js} +1 -1
  23. package/dist/gateway/static/root/assets/{extension-iframe-host-DIH4TcdH.js → extension-iframe-host-Vs6USa0c.js} +1 -1
  24. package/dist/gateway/static/root/assets/{extension-message-router-C9JDpo_7.js → extension-message-router-GIekDj_w.js} +1 -1
  25. package/dist/gateway/static/root/assets/{extension-page-CLDoL5N8.js → extension-page-C_3bIjSB.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-provider-BPIoHw4r.js → extension-provider-D-LolObs.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-settings-page-BO_UKeG8.js → extension-settings-page-BV51dk16.js} +1 -1
  28. package/dist/gateway/static/root/assets/home-page-DefKShSW.js +8 -0
  29. package/dist/gateway/static/root/assets/index-CChzK_5b.css +1 -0
  30. package/dist/gateway/static/root/assets/index-CEBDMkde.js +11 -0
  31. package/dist/gateway/static/root/assets/{local-app-workbench-page-D8oqDDAn.js → local-app-workbench-page-CfnixDO3.js} +1 -1
  32. package/dist/gateway/static/root/assets/{markdown-view-BlxIaCCQ.js → markdown-view-CNJaAdNN.js} +39 -39
  33. package/dist/gateway/static/root/assets/note-detail-panel-D_l5jkV9.js +7 -0
  34. package/dist/gateway/static/root/assets/note-image-lightbox-D6mvMSKr.js +1 -0
  35. package/dist/gateway/static/root/assets/{notes-api-CdXA-g9r.js → notes-api-BOIM9Q_D.js} +1 -1
  36. package/dist/gateway/static/root/assets/notes-page-R4uJroeD.js +8 -0
  37. package/dist/gateway/static/root/assets/{page-context-capture-button-Dibmspef.js → page-context-capture-button-B_Vdo2Ai.js} +1 -1
  38. package/dist/gateway/static/root/assets/pcm-capture-worklet-CpXsv44v.js +1 -0
  39. package/dist/gateway/static/root/assets/{personal-page-BwfyW7Hx.js → personal-page-BsONyPfQ.js} +1 -1
  40. package/dist/gateway/static/root/assets/{personal-profile-settings-CQhZjoK6.js → personal-profile-settings-C4CxmQLQ.js} +1 -1
  41. package/dist/gateway/static/root/assets/{personal-settings-panel-peD05ktj.js → personal-settings-panel-CnxI2TL0.js} +1 -1
  42. package/dist/gateway/static/root/assets/{product-automation-feedback-D51I7Lg3.js → product-automation-feedback-CGso8wGv.js} +1 -1
  43. package/dist/gateway/static/root/assets/{product-preview-content-WkF2j_c-.js → product-preview-content-Dgtb4LF7.js} +1 -1
  44. package/dist/gateway/static/root/assets/product-preview-modal-C35EWUps.js +2 -0
  45. package/dist/gateway/static/root/assets/project-detail-page-xNSy6SAv.js +7 -0
  46. package/dist/gateway/static/root/assets/recording-upload-CFX7CANT.js +1 -0
  47. package/dist/gateway/static/root/assets/route-preload-Dwb_N8L-.js +2 -0
  48. package/dist/gateway/static/root/assets/routine-panel-KH1VaEdC.js +2 -0
  49. package/dist/gateway/static/root/assets/session-manager-63NaXb1s.js +25 -0
  50. package/dist/gateway/static/root/assets/{settings-page-BHImcF1q.js → settings-page-8MiJzbbl.js} +1 -1
  51. package/dist/gateway/static/root/assets/{share-preview-page-fV5USZb1.js → share-preview-page-Cqy-7-rd.js} +1 -1
  52. package/dist/gateway/static/root/assets/{shares-settings-sl40lqND.js → shares-settings-BDr50uTV.js} +1 -1
  53. package/dist/gateway/static/root/assets/{skills-page-FTd0Z7Ey.js → skills-page-DReUQ4Ug.js} +1 -1
  54. package/dist/gateway/static/root/assets/star-CnYNmpLd.js +1 -0
  55. package/dist/gateway/static/root/assets/task-detail-page-DxKXoBbE.js +3 -0
  56. package/dist/gateway/static/root/assets/{task-result-evidence-CSJeB9AH.js → task-result-evidence-CW_tN93T.js} +1 -1
  57. package/dist/gateway/static/root/assets/{use-composer-attachments-CO7XLI4x.js → use-composer-attachments-Xn6eUus2.js} +1 -1
  58. package/dist/gateway/static/root/assets/{use-file-preview-expanded-BXXeXnT0.js → use-file-preview-expanded-D0IBFhM9.js} +1 -1
  59. package/dist/gateway/static/root/assets/use-realtime-voice-B5IsKrRW.js +1 -0
  60. package/dist/gateway/static/root/assets/{use-workspace-tree-D27u-eoX.js → use-workspace-tree-7X2ydgS8.js} +1 -1
  61. package/dist/gateway/static/root/assets/{voice-settings-BiqJ0tlf.js → voice-settings-57pwZeKD.js} +1 -1
  62. package/dist/gateway/static/root/assets/workspace-api-Dd_UDfeo.js +2 -0
  63. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-NffP-UXC.js → workspace-file-preview-dialog-Clj9hMj5.js} +1 -1
  64. package/dist/gateway/static/root/assets/{workspace-preview-store-Do31QQH5.js → workspace-preview-store-imhtuEIP.js} +1 -1
  65. package/dist/gateway/static/root/index.html +27 -26
  66. package/dist/package.js +1 -1
  67. package/dist/packages/gateway-contract/src/follow-ups.js +97 -0
  68. package/dist/packages/gateway-contract/src/home.js +1 -0
  69. package/dist/packages/gateway-contract/src/index.js +4 -0
  70. package/dist/packages/gateway-contract/src/observation-starters.js +95 -0
  71. package/dist/packages/gateway-contract/src/observation.js +7 -0
  72. package/dist/packages/gateway-contract/src/task-research-result.js +3 -0
  73. package/dist/src/agent/agent-manager.d.ts +1 -1
  74. package/dist/src/agent/background-review/prompts.d.ts +1 -0
  75. package/dist/src/agent/background-review/prompts.js +7 -1
  76. package/dist/src/agent/background-review/run-background-review.js +85 -7
  77. package/dist/src/agent/coding/run-verification.d.ts +14 -7
  78. package/dist/src/agent/coding/run-verification.js +28 -6
  79. package/dist/src/agent/context/coordinator.js +1 -1
  80. package/dist/src/agent/context/deep-recall.js +1 -1
  81. package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -0
  82. package/dist/src/agent/embedded/execution-tool-policy.js +4 -2
  83. package/dist/src/agent/embedded/run-for-session.d.ts +2 -0
  84. package/dist/src/agent/embedded/run-for-session.js +9 -0
  85. package/dist/src/agent/embedded/run-turn.js +63 -14
  86. package/dist/src/agent/embedded/types.d.ts +2 -0
  87. package/dist/src/agent/inbound/turn-dispatcher.d.ts +1 -0
  88. package/dist/src/agent/inbound/turn-dispatcher.js +1 -0
  89. package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
  90. package/dist/src/agent/service/direct-turn-helpers.js +17 -2
  91. package/dist/src/agent/service/process-direct-streaming.d.ts +1 -0
  92. package/dist/src/agent/service/process-direct-streaming.js +1 -0
  93. package/dist/src/agent/service.d.ts +1 -1
  94. package/dist/src/agent/tasks/task-judge-service.js +1 -0
  95. package/dist/src/agent/tool-manuals/browser.d.ts +1 -1
  96. package/dist/src/agent/tool-manuals/browser.js +3 -1
  97. package/dist/src/agent/tools/factory.d.ts +1 -1
  98. package/dist/src/agent/tools/factory.js +1 -1
  99. package/dist/src/agent/tools/personal-request-tool.js +36 -4
  100. package/dist/src/agent/tools/personal-task-tool.d.ts +7 -1
  101. package/dist/src/agent/tools/personal-task-tool.js +68 -3
  102. package/dist/src/agent/tools/session-search-tool.js +1 -1
  103. package/dist/src/agent/tools/task-collaboration-tool.d.ts +1 -1
  104. package/dist/src/agent/tools/task-collaboration-tool.js +54 -3
  105. package/dist/src/agent/tools/task-result-tool.js +31 -0
  106. package/dist/src/agent/tools/xopc-use-tool.js +50 -19
  107. package/dist/src/automations/capabilities/write.d.ts +2 -2
  108. package/dist/src/automations/domain/validation.d.ts +4 -4
  109. package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
  110. package/dist/src/browser/drivers/browser-driver.d.ts +1 -0
  111. package/dist/src/browser/drivers/create-driver.js +2 -11
  112. package/dist/src/browser/drivers/playwright-driver.d.ts +5 -2
  113. package/dist/src/browser/drivers/playwright-driver.js +83 -38
  114. package/dist/src/browser/runtime/browser-runtime.d.ts +5 -0
  115. package/dist/src/browser/runtime/browser-runtime.js +71 -9
  116. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  117. package/dist/src/computer/diagnostics.d.ts +4 -4
  118. package/dist/src/computer/errors.d.ts +4 -4
  119. package/dist/src/computer/evaluation.d.ts +3 -3
  120. package/dist/src/computer/flows.d.ts +1 -1
  121. package/dist/src/computer/runtime.d.ts +3 -3
  122. package/dist/src/config/schema.d.ts +6 -2
  123. package/dist/src/config/schema.js +3 -0
  124. package/dist/src/connectors/connected-source-understanding.js +11 -3
  125. package/dist/src/connectors/learning-coordinator.js +45 -11
  126. package/dist/src/discussions/recording.js +13 -6
  127. package/dist/src/endpoint-tools/device-host.d.ts +2 -2
  128. package/dist/src/gateway/hono/lib/config-payload.d.ts +4 -0
  129. package/dist/src/gateway/hono/routes/home.js +52 -1
  130. package/dist/src/gateway/hono/routes/projects.js +1 -1
  131. package/dist/src/gateway/hono/routes/session-command-handler.js +15 -1
  132. package/dist/src/gateway/hono/routes/user-model.js +1 -1
  133. package/dist/src/gateway/service/agent-runner.d.ts +2 -8
  134. package/dist/src/gateway/service/agent-runner.js +1 -0
  135. package/dist/src/gateway/service/config-coordinator.d.ts +5 -1
  136. package/dist/src/gateway/service/run-gateway-agent.d.ts +13 -8
  137. package/dist/src/gateway/service/run-gateway-agent.js +5 -2
  138. package/dist/src/gateway/service/session-input-coordinator.d.ts +4 -0
  139. package/dist/src/gateway/service/session-input-coordinator.js +6 -1
  140. package/dist/src/gateway/service.d.ts +1 -0
  141. package/dist/src/gateway/service.js +8 -1
  142. package/dist/src/home-intelligence/follow-ups.d.ts +36 -0
  143. package/dist/src/home-intelligence/follow-ups.js +496 -0
  144. package/dist/src/home-intelligence/host.d.ts +80 -4
  145. package/dist/src/home-intelligence/host.js +122 -2
  146. package/dist/src/home-intelligence/observation-starters.d.ts +3 -0
  147. package/dist/src/home-intelligence/observation-starters.js +27 -0
  148. package/dist/src/home-intelligence/observation.d.ts +1 -1
  149. package/dist/src/home-intelligence/observation.js +16 -4
  150. package/dist/src/local-apps/automation-proposals.d.ts +4 -4
  151. package/dist/src/local-apps/capabilities/projections.d.ts +38 -38
  152. package/dist/src/memory-learning/choice-observations.d.ts +9 -0
  153. package/dist/src/memory-learning/choice-observations.js +155 -0
  154. package/dist/src/memory-learning/evidence-repair.d.ts +12 -0
  155. package/dist/src/memory-learning/evidence-repair.js +31 -0
  156. package/dist/src/memory-learning/repository.d.ts +1 -0
  157. package/dist/src/memory-learning/repository.js +43 -5
  158. package/dist/src/memory-learning/source-learning.js +52 -7
  159. package/dist/src/memory-learning/task-receipts.js +19 -10
  160. package/dist/src/memory-learning/transcript-source.js +7 -0
  161. package/dist/src/memory-learning/work-candidate.d.ts +14 -0
  162. package/dist/src/memory-learning/work-candidate.js +17 -2
  163. package/dist/src/memory-learning/work-capture.d.ts +1 -0
  164. package/dist/src/memory-learning/work-capture.js +28 -10
  165. package/dist/src/memory-learning/work-review.d.ts +46 -0
  166. package/dist/src/memory-learning/work-review.js +209 -0
  167. package/dist/src/notes/agent-context.js +1 -1
  168. package/dist/src/personal-agent/communication.d.ts +1 -1
  169. package/dist/src/personal-agent/communication.js +1 -1
  170. package/dist/src/personal-agent/default-style.d.ts +1 -1
  171. package/dist/src/personal-agent/default-style.js +1 -1
  172. package/dist/src/personal-agent/proactivity/repository.d.ts +1 -1
  173. package/dist/src/personal-agent/prompts.js +4 -4
  174. package/dist/src/personal-agent/reply-composer.d.ts +1 -1
  175. package/dist/src/personal-agent/reply-composer.js +52 -34
  176. package/dist/src/personal-agent/reply-style.d.ts +2 -2
  177. package/dist/src/personal-agent/reply-style.js +3 -2
  178. package/dist/src/personal-agent/request-repository.d.ts +3 -0
  179. package/dist/src/personal-agent/request-service.d.ts +2 -0
  180. package/dist/src/personal-agent/request-service.js +8 -2
  181. package/dist/src/phone/contracts.d.ts +1 -1
  182. package/dist/src/projects/capabilities/write.js +1 -1
  183. package/dist/src/projects/index.js +1 -1
  184. package/dist/src/projects/project-service.js +1 -1
  185. package/dist/src/storage/sqlite/schema.d.ts +2 -2
  186. package/dist/src/storage/sqlite/schema.js +7 -7
  187. package/dist/src/storage/sqlite/schema.sql +22 -0
  188. package/dist/src/storage/sqlite/upgrades/274_home_followups.sql +21 -0
  189. package/dist/src/tasks/capabilities/management.d.ts +3 -3
  190. package/dist/src/tasks/capabilities/relations.d.ts +3 -3
  191. package/dist/src/tasks/capabilities/write.d.ts +4 -4
  192. package/dist/src/tasks/capabilities/write.js +2 -0
  193. package/dist/src/tasks/home-query-service.js +4 -2
  194. package/dist/src/tasks/task-allocation-service.js +10 -2
  195. package/dist/src/tasks/task-application-service.d.ts +4 -0
  196. package/dist/src/tasks/task-application-service.js +6 -1
  197. package/dist/src/tasks/task-context-assembler.js +7 -2
  198. package/dist/src/tasks/task-contract-planner.js +3 -3
  199. package/dist/src/tasks/task-conversation-summary.d.ts +64 -0
  200. package/dist/src/tasks/task-conversation-summary.js +105 -0
  201. package/dist/src/tasks/task-delay-notice.d.ts +4 -0
  202. package/dist/src/tasks/task-delay-notice.js +113 -0
  203. package/dist/src/tasks/task-deletion-service.js +6 -1
  204. package/dist/src/tasks/task-handoff.d.ts +21 -0
  205. package/dist/src/tasks/task-handoff.js +77 -1
  206. package/dist/src/tasks/task-json-acceptance.d.ts +22 -0
  207. package/dist/src/tasks/task-json-acceptance.js +96 -0
  208. package/dist/src/tasks/task-main-update-decision-service.js +17 -21
  209. package/dist/src/tasks/task-main-update-delivery.js +34 -7
  210. package/dist/src/tasks/task-notification-preference.d.ts +16 -0
  211. package/dist/src/tasks/task-notification-preference.js +42 -0
  212. package/dist/src/tasks/task-origin-repository.d.ts +1 -0
  213. package/dist/src/tasks/task-origin-repository.js +3 -0
  214. package/dist/src/tasks/task-read-model-projector.js +1 -1
  215. package/dist/src/tasks/task-repository.js +1 -0
  216. package/dist/src/tasks/task-research-repair.d.ts +19 -1
  217. package/dist/src/tasks/task-research-repair.js +14 -4
  218. package/dist/src/tasks/task-research-result.d.ts +12 -0
  219. package/dist/src/tasks/task-research-result.js +5 -0
  220. package/dist/src/tasks/task-result-delivery-repository.d.ts +4 -1
  221. package/dist/src/tasks/task-result-delivery-repository.js +8 -5
  222. package/dist/src/tasks/task-result-delivery-service.js +9 -1
  223. package/dist/src/tasks/task-run-coordinator.js +45 -10
  224. package/dist/src/usage/cloud-wire.d.ts +1 -0
  225. package/dist/src/user-context/config.d.ts +8 -0
  226. package/dist/src/user-context/config.js +10 -0
  227. package/dist/src/user-model/capture/evidence-policy.d.ts +2 -0
  228. package/dist/src/user-model/capture/evidence-policy.js +8 -1
  229. package/dist/src/user-model/capture/executor.js +16 -4
  230. package/dist/src/user-model/capture/semantic.d.ts +4 -0
  231. package/dist/src/user-model/capture/semantic.js +3 -0
  232. package/dist/src/user-model/index.js +1 -1
  233. package/dist/src/user-model/observation-repository.d.ts +6 -0
  234. package/dist/src/user-model/observation-repository.js +12 -0
  235. package/dist/src/user-model/repository.js +10 -1
  236. package/dist/src/voice/realtime/agentEngine.js +29 -7
  237. package/dist/src/voice/realtime/pcmPlaybackEcho.d.ts +10 -0
  238. package/dist/src/voice/realtime/pcmPlaybackEcho.js +56 -0
  239. package/dist/src/voice/realtime/playback-echo.d.ts +3 -0
  240. package/dist/src/voice/realtime/playback-echo.js +35 -5
  241. package/dist/src/voice/realtime/runtime.js +6 -1
  242. package/dist/src/voice/realtime/turnPolicy.js +1 -1
  243. package/package.json +14 -8
  244. package/dist/gateway/static/root/assets/capabilities-DB713nRi.js +0 -1
  245. package/dist/gateway/static/root/assets/capabilities-page-D2hq4cgE.js +0 -2
  246. package/dist/gateway/static/root/assets/chat-page-BhPw56Vc.js +0 -71
  247. package/dist/gateway/static/root/assets/constants-DpkUgykJ.js +0 -1
  248. package/dist/gateway/static/root/assets/discussion-annotation-sync-fwPPMPv9.js +0 -1
  249. package/dist/gateway/static/root/assets/home-page-BPPe4JXB.js +0 -7
  250. package/dist/gateway/static/root/assets/index-DjzrnmBA.js +0 -11
  251. package/dist/gateway/static/root/assets/index-YQxumvaS.css +0 -1
  252. package/dist/gateway/static/root/assets/note-detail-panel-BbHlfAju.js +0 -7
  253. package/dist/gateway/static/root/assets/note-image-lightbox-CqK_uJ6Y.js +0 -1
  254. package/dist/gateway/static/root/assets/notes-page-8w2Stfak.js +0 -8
  255. package/dist/gateway/static/root/assets/pcm-capture-worklet-uW_SEACy.js +0 -1
  256. package/dist/gateway/static/root/assets/product-preview-modal-DMHOKocl.js +0 -2
  257. package/dist/gateway/static/root/assets/project-detail-page-CNFuzmRr.js +0 -7
  258. package/dist/gateway/static/root/assets/recording-upload-CyZSl2DJ.js +0 -1
  259. package/dist/gateway/static/root/assets/route-preload-CuxNu-LB.js +0 -2
  260. package/dist/gateway/static/root/assets/routine-panel-CXs4PjW0.js +0 -2
  261. package/dist/gateway/static/root/assets/session-manager-D2LaQymu.js +0 -25
  262. package/dist/gateway/static/root/assets/task-detail-page-_5TEldtl.js +0 -3
  263. package/dist/gateway/static/root/assets/use-realtime-voice-C7iWQuUv.js +0 -1
  264. package/dist/gateway/static/root/assets/workspace-api-LghfbP5g.js +0 -2
@@ -8,6 +8,7 @@ import { init_session_repository } from "../../storage/sqlite/session-repository
8
8
  import { isPersonalConversation } from "../../personal-agent/repository.js";
9
9
  import { TaskAllocationRepository } from "../../tasks/task-allocation-repository.js";
10
10
  import { boundedPersonalResult } from "./personal-result-budget.js";
11
+ import { TASK_NOTIFICATION_PREFERENCES, getTaskNotificationPreference, isTaskNotificationPreference, setTaskNotificationPreference } from "../../tasks/task-notification-preference.js";
11
12
  import { personalCapabilities } from "../../personal-agent/capability-service.js";
12
13
  import { selectionRequestHash } from "../../agent-matching/selection-repository.js";
13
14
  import { createPersonalTaskTool } from "./personal-task-tool.js";
@@ -36,8 +37,15 @@ const RequestSchema = Type.Object({
36
37
  "answer",
37
38
  "instruct",
38
39
  "collaboration",
39
- "entry"
40
+ "entry",
41
+ "notifications"
40
42
  ].map((command) => Type.Literal(command))),
43
+ notificationPreference: Type.Optional(Type.Union(TASK_NOTIFICATION_PREFERENCES.map((value) => Type.Literal(value)), { description: "Only for explicit user preferences on submit or notifications. final_only suppresses progress; updates enables meaningful milestones; default restores normal behavior." })),
44
+ dueAt: Type.Optional(Type.Integer({
45
+ minimum: 0,
46
+ description: "User-provided deadline in epoch milliseconds, only on submit."
47
+ })),
48
+ section: Type.Optional(Type.Literal("status")),
41
49
  instruction: Type.Optional(Type.String({
42
50
  minLength: 1,
43
51
  maxLength: 8e3
@@ -94,6 +102,10 @@ const RequestSchema = Type.Object({
94
102
  ] } },
95
103
  required: ["requestId"]
96
104
  },
105
+ {
106
+ properties: { command: { const: "notifications" } },
107
+ required: ["requestId", "notificationPreference"]
108
+ },
97
109
  {
98
110
  properties: { command: { const: "entry" } },
99
111
  required: ["requestId", "entryId"]
@@ -136,6 +148,7 @@ function createPersonalRequestTools(deps) {
136
148
  connectorId: value.connectorId,
137
149
  accountId: value.accountId,
138
150
  executorAgentId: value.executorAgentId,
151
+ notificationPreference: value.taskId ? getTaskNotificationPreference(value.taskId, value.conversationId) : value.parameters.notificationPreference,
139
152
  ..."allocation" in value ? { allocation: value.allocation } : {},
140
153
  parameters: { timeRange: value.parameters.timeRange }
141
154
  };
@@ -163,9 +176,11 @@ function createPersonalRequestTools(deps) {
163
176
  name: "personal_request",
164
177
  label: "Connected app request",
165
178
  parameters: RequestSchema,
166
- description: "Submit a read-only connected-app request with a short objective and complete description using the exact connectorId from personal_capability. The background Task Router chooses an executor after account authorization. Preserves the objective, displays connection or account selection in this main chat, and starts a specialist Task automatically once connected. Return quickly after submission. Never claim data was read until the Task result arrives. Resolve absolute query dates and include timeRange. If mail has no user-specified range, the host returns an explicit last-7-days default; state that range and proceed without asking for confirmation. get includes complete Task coordination state; collaboration/entry read the same board and full questions. answer forwards the exact questionId; instruct forwards new requirements to the existing Task. Answers and instructions cannot change the connector/account, grant access or allow writes; reconnection stays in the existing connection UI. Saved, delivered, executor-confirmed and verified are distinct states. Use get/list for status without polling; preserve idempotencyKey on uncertain retries; cancel only when the user requests it.",
179
+ description: "Submit a read-only connected-app request with a short objective and complete description using the exact connectorId from personal_capability. The background Task Router chooses an executor after account authorization. Preserves the objective, displays connection or account selection in this main chat, and starts a specialist Task automatically once connected. Return quickly after submission. Never claim data was read until the Task result arrives. Resolve absolute query dates and include timeRange. If mail has no user-specified range, the host returns an explicit last-7-days default; state that range and proceed without asking for confirmation. notifications(requestId, notificationPreference) changes how this Request reports progress on explicit request. get(section=\"status\") returns concise current status; get without a section includes complete Task coordination state; collaboration/entry read the same board and full questions. answer forwards the exact questionId; instruct forwards new requirements to the existing Task. Answers and instructions cannot change the connector/account, grant access or allow writes; reconnection stays in the existing connection UI. Saved, delivered, executor-confirmed and verified are distinct states. Use get/list for status without polling; preserve idempotencyKey on uncertain retries; cancel only when the user requests it.",
167
180
  async execute(toolCallId, input) {
168
181
  const conversationId = conversation();
182
+ if (input.notificationPreference !== void 0 && (!isTaskNotificationPreference(input.notificationPreference) || !["submit", "notifications"].includes(input.command))) throw new Error("Invalid Request notification preference");
183
+ if (input.dueAt !== void 0 && input.command !== "submit") throw new Error("dueAt is supported only by submit");
169
184
  if (input.command === "list") {
170
185
  const offset = input.offset ?? 0;
171
186
  const items = listPersonalRequests(conversationId, input.limit ?? 10, offset).map((request) => {
@@ -193,6 +208,8 @@ function createPersonalRequestTools(deps) {
193
208
  description: input.description?.trim(),
194
209
  timeRange: input.timeRange,
195
210
  acceptancePolicy: input.acceptancePolicy,
211
+ notificationPreference: input.notificationPreference,
212
+ dueAt: input.dueAt,
196
213
  idempotencyKey: input.idempotencyKey ?? `personal-request-submit:${selectionRequestHash({
197
214
  inputId: getSessionInputState(conversationId).activeInputId ?? toolCallId,
198
215
  objective: input.objective.trim(),
@@ -200,7 +217,9 @@ function createPersonalRequestTools(deps) {
200
217
  connectorId: input.connectorId,
201
218
  accountId: input.accountId,
202
219
  timeRange: input.timeRange,
203
- acceptancePolicy: input.acceptancePolicy
220
+ acceptancePolicy: input.acceptancePolicy,
221
+ notificationPreference: input.notificationPreference,
222
+ dueAt: input.dueAt
204
223
  })}`
205
224
  });
206
225
  publishPersonalRequest(request);
@@ -212,6 +231,18 @@ function createPersonalRequestTools(deps) {
212
231
  }
213
232
  const request = input.requestId ? getPersonalRequest(input.requestId) : void 0;
214
233
  if (!request || request.conversationId !== conversationId) throw new Error("Request does not belong to this conversation");
234
+ if (input.command === "notifications") {
235
+ if (!input.notificationPreference) throw new Error("notificationPreference is required");
236
+ if (readCurrentTranscriptId(getSqliteDatabase(), conversationId) !== request.transcriptId) throw new Error("SESSION_CHANGED");
237
+ if (request.taskId) {
238
+ setTaskNotificationPreference(request.taskId, conversationId, input.notificationPreference);
239
+ return result(compactSnapshot(request));
240
+ }
241
+ return result(compactSnapshot(updatePersonalRequest(request, { parameters: {
242
+ ...request.parameters,
243
+ notificationPreference: input.notificationPreference
244
+ } })));
245
+ }
215
246
  if (input.command === "cancel") {
216
247
  if (["completed", "failed"].includes(personalRequestSnapshot(request).state)) return result(compactSnapshot(request));
217
248
  const cancelled = cancelPersonalRequest(request);
@@ -222,6 +253,7 @@ function createPersonalRequestTools(deps) {
222
253
  executionStopConfirmed: stop.executionStopConfirmed
223
254
  });
224
255
  }
256
+ if (input.command === "get" && input.section === "status" && !request.taskId) return result(compactSnapshot(request));
225
257
  const taskTool = createPersonalTaskTool({
226
258
  ...deps,
227
259
  getCurrentAgentId: () => deps.getCurrentAgentId?.() ?? getSessionMetadata(conversationId)?.agentId
@@ -287,7 +319,7 @@ function createPersonalRequestTools(deps) {
287
319
  });
288
320
  if (input.command !== "get") return coordinated;
289
321
  return result({
290
- ...snapshot(request),
322
+ ...input.section === "status" ? compactSnapshot(request) : snapshot(request),
291
323
  coordination: JSON.parse(coordinated.content[0].text)
292
324
  });
293
325
  }
@@ -17,10 +17,11 @@ declare const PersonalTaskModelSchema: import("@sinclair/typebox").TObject<{
17
17
  questionId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
18
18
  expectedVersion: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
19
19
  idempotencyKey: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
20
+ taskId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
20
21
  instruction: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
21
22
  title: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
22
- taskId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
23
23
  requiredSkills: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
24
+ dueAt: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
24
25
  objective: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
25
26
  expectedOutputs: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
26
27
  constraints: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
@@ -30,6 +31,7 @@ declare const PersonalTaskModelSchema: import("@sinclair/typebox").TObject<{
30
31
  section: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<string>[]>>;
31
32
  entryId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
32
33
  baselineVersion: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
34
+ notificationPreference: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<"default" | "final_only" | "updates">[]>>;
33
35
  afterSequence: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
34
36
  useOriginalRequest: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
35
37
  baselineResultId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -42,6 +44,10 @@ declare const PersonalTaskModelSchema: import("@sinclair/typebox").TObject<{
42
44
  resultId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
43
45
  expectedVersion: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
44
46
  }>>>;
47
+ conversationExcerpts: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
48
+ entryId: import("@sinclair/typebox").TString;
49
+ quote: import("@sinclair/typebox").TString;
50
+ }>>>;
45
51
  }>;
46
52
  export interface PersonalTaskToolDeps extends XopcUseToolDeps {
47
53
  getAgentToolAvailability?: MatchingContext['getAgentToolAvailability'];
@@ -16,6 +16,7 @@ import { TaskResultDeliveryRepository } from "../../tasks/task-result-delivery-r
16
16
  import { boundedPersonalResult } from "./personal-result-budget.js";
17
17
  import { parseTaskHandoffReferences } from "../../tasks/task-handoff.js";
18
18
  import { TaskApplicationService } from "../../tasks/task-application-service.js";
19
+ import { TASK_NOTIFICATION_PREFERENCES, isTaskNotificationPreference, setTaskNotificationPreference } from "../../tasks/task-notification-preference.js";
19
20
  import "../../personal-agent/communication.js";
20
21
  import { getAvailablePersonalAgentTools, personalAgentModelAvailability } from "../../personal-agent/specialist-capabilities.js";
21
22
  import { assessSpecialist, matchSpecialists } from "../../agent-matching/service.js";
@@ -23,6 +24,7 @@ import { createXopcUseTool } from "./xopc-use-tool.js";
23
24
  import { AgentSelectionRepository, selectionRequestHash } from "../../agent-matching/selection-repository.js";
24
25
  import { assertSpecialistEligible, createSelectedTask } from "../../agent-matching/delegation-service.js";
25
26
  import { cancelPersonalTask } from "../../personal-agent/task-cancel.js";
27
+ import { taskConversationSummary } from "../../tasks/task-conversation-summary.js";
26
28
  import { randomUUID } from "node:crypto";
27
29
  import { Type } from "@sinclair/typebox";
28
30
  //#region src/agent/tools/personal-task-tool.ts
@@ -44,7 +46,8 @@ const PersonalTaskSchema = Type.Object({
44
46
  Type.Literal("entry"),
45
47
  Type.Literal("instruct"),
46
48
  Type.Literal("answer"),
47
- Type.Literal("cancel")
49
+ Type.Literal("cancel"),
50
+ Type.Literal("notifications")
48
51
  ]),
49
52
  requirements: Type.Optional(Type.Object({
50
53
  version: Type.Optional(Type.Literal(1)),
@@ -87,6 +90,11 @@ const PersonalTaskSchema = Type.Object({
87
90
  })),
88
91
  agentId: Type.Optional(Type.String({ description: "Specialist Agent ID. Never use your own ID." })),
89
92
  taskId: Type.Optional(Type.String()),
93
+ notificationPreference: Type.Optional(Type.Union(TASK_NOTIFICATION_PREFERENCES.map((value) => Type.Literal(value)), { description: "For submit or notifications, only on explicit user request. final_only suppresses progress; updates enables meaningful milestones; default restores normal behavior. Results and required user decisions still arrive." })),
94
+ dueAt: Type.Optional(Type.Integer({
95
+ minimum: 0,
96
+ description: "Actual user-provided deadline in epoch milliseconds, only if explicit."
97
+ })),
90
98
  baselineResultId: Type.Optional(Type.String({ description: "Exact latest result ID from personal_result directory or Task revisionBaseline.resultId." })),
91
99
  baselineVersion: Type.Optional(Type.String({ description: "Opaque baselineVersion token returned by the host, copied exactly. Never use the numeric resultRevision or task version here." })),
92
100
  expectedVersion: Type.Optional(Type.Integer({ minimum: 1 })),
@@ -99,6 +107,7 @@ const PersonalTaskSchema = Type.Object({
99
107
  description: "Character offset for an entry body; follow nextBodyOffset until absent."
100
108
  })),
101
109
  section: Type.Optional(Type.Union([
110
+ "status",
102
111
  "revision",
103
112
  "task",
104
113
  "waits",
@@ -137,7 +146,8 @@ const PersonalTaskModelSchema = Type.Object({
137
146
  "answer",
138
147
  "retry_allocation",
139
148
  "selection",
140
- "cancel"
149
+ "cancel",
150
+ "notifications"
141
151
  ]],
142
152
  description: "Required. submit=new goal; instruct=new direction on running work; answer=worker question; revise=completed work with an exact returned result baseline only."
143
153
  }),
@@ -164,6 +174,19 @@ const PersonalTaskModelSchema = Type.Object({
164
174
  required: ["resultId"]
165
175
  }, { required: ["sourceId"] }]
166
176
  }), { maxItems: 5 })),
177
+ conversationExcerpts: Type.Optional(Type.Array(Type.Object({
178
+ entryId: Type.String({
179
+ minLength: 1,
180
+ maxLength: 100
181
+ }),
182
+ quote: Type.String({
183
+ minLength: 1,
184
+ maxLength: 800
185
+ })
186
+ }, { additionalProperties: false }), {
187
+ maxItems: 3,
188
+ description: "Only for submit that depends on prior decisions. Exact visible quotes and entry IDs from session_recall in this chat. Select only task-relevant passages that can be shared with its executor."
189
+ })),
167
190
  ...Type.Omit(PersonalTaskSchema, [
168
191
  "command",
169
192
  "agentId",
@@ -218,6 +241,10 @@ const PersonalTaskModelSchema = Type.Object({
218
241
  ] } },
219
242
  required: ["taskId"]
220
243
  },
244
+ {
245
+ properties: { command: { const: "notifications" } },
246
+ required: ["taskId", "notificationPreference"]
247
+ },
221
248
  {
222
249
  properties: { command: { const: "entry" } },
223
250
  required: ["taskId", "entryId"]
@@ -257,7 +284,7 @@ function createPersonalTaskTool(deps) {
257
284
  return {
258
285
  name: "personal_task",
259
286
  label: "Personal Task",
260
- description: "Coordinate ordinary Tasks. Always include command. New goal: submit objective plus useOriginalRequest=true for a self-contained active user message; the host preserves the complete original text. Otherwise supply a concise complete description. Include sourceRefs for required inputs without pre-reading files or planning the execution. Use requirements.requestedAgentId only for an explicitly named executor; preserve explicitly requested requiredSkills. The background Router chooses the executor. After successful persistence, give one short confirmation and finish; updates arrive automatically.\nRUNNING work: send {command:\"instruct\",taskId,instruction} for new direction, or {command:\"answer\",taskId,questionId,instruction} for an exact worker question. Reuse the SAME Task, without a baseline lookup. Never revise running work.\nCOMPLETED ordinary work only: get(section=\"revision\"), then revise with instruction and exact returned revisionBaseline.resultId, baselineVersion and expectedVersion. If revisionBaseline is absent, use instruct/answer; never invent placeholders. This saves a revision and queues background allocation atomically. Reuse idempotencyKey for uncertain retries. supersedesEntryIds names only earlier instruction/answer entries to replace; all other requirements remain. Independent goals use submit with pinned old-result sources; connected-app side effects require a newly authorized Request.\nsourceRefs: workspace input {kind:\"file\",sourceId:\"path\"}; prior result {kind:\"result\",resultId:\"exact result ID\",sourceId:\"exact artifact ID or unique file title\"}, omitting sourceId only for retained body; other prior inputs use stable sourceId and optional expectedVersion. The host authorizes and pins exact versions; workspace inputs are not executor cwd. Do not invent composite IDs.\nget/list/selection inspect state; get(section,limit,offset) pages details. collaboration(afterSequence) returns previews; entry(entryId,bodyOffset) reads full bodies through nextBodyOffset. Read complete questions before answering. cancel only on explicit user instruction; report executionStopConfirmed accurately. retry_allocation retries selection, not arbitrary execution. Saved, delivered, executor-confirmed and verified completion are distinct; report only confirmed states.",
287
+ description: "Coordinate ordinary Tasks. Always include command. New goal: submit objective plus useOriginalRequest=true for a self-contained active user message; the host preserves the complete original text. Otherwise supply a concise complete description. Include sourceRefs for required inputs without pre-reading files or planning the execution. Use requirements.requestedAgentId only for an explicitly named executor; preserve explicitly requested requiredSkills. The background Router chooses the executor. After successful persistence, give one short confirmation and finish; updates arrive automatically.\nRUNNING work: send {command:\"instruct\",taskId,instruction} for new direction, or {command:\"answer\",taskId,questionId,instruction} for an exact worker question. Reuse the SAME Task, without a baseline lookup. Never revise running work.\nCOMPLETED ordinary work only: get(section=\"revision\"), then revise with instruction and exact returned revisionBaseline.resultId, baselineVersion and expectedVersion. If revisionBaseline is absent, use instruct/answer; never invent placeholders. This saves a revision and queues background allocation atomically. Reuse idempotencyKey for uncertain retries. supersedesEntryIds names only earlier instruction/answer entries to replace; all other requirements remain. Independent goals use submit with pinned old-result sources; connected-app side effects require a newly authorized Request.\nsourceRefs: workspace input {kind:\"file\",sourceId:\"path\"}; prior result {kind:\"result\",resultId:\"exact result ID\",sourceId:\"exact artifact ID or unique file title\"}, omitting sourceId only for retained body; other prior inputs use stable sourceId and optional expectedVersion. The host authorizes and pins exact versions; workspace inputs are not executor cwd. Do not invent composite IDs.\nUse notifications(taskId, notificationPreference) to change an existing Task only when the user asks. Use get(section=\"status\") for a brief current status; list locates a Task and get(section,limit,offset) reads details. collaboration(afterSequence) returns previews; entry(entryId,bodyOffset) reads full bodies through nextBodyOffset. Read complete questions before answering. cancel only on explicit user instruction; report executionStopConfirmed accurately. retry_allocation retries selection, not arbitrary execution. Saved, delivered, executor-confirmed and verified completion are distinct; report only confirmed states.",
261
288
  parameters: PersonalTaskModelSchema,
262
289
  mutatesWorkspace: true,
263
290
  mutationScope: "external",
@@ -265,7 +292,10 @@ function createPersonalTaskTool(deps) {
265
292
  finalGuardRelevant: true,
266
293
  async execute(toolCallId, modelInput, signal) {
267
294
  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");
295
+ if (modelInput.conversationExcerpts?.length && modelInput.command !== "submit") throw new Error("conversationExcerpts are supported only by submit; use instruct or answer for a running Task");
268
296
  const input = modelInput;
297
+ if (input.notificationPreference !== void 0 && (!isTaskNotificationPreference(input.notificationPreference) || !["submit", "notifications"].includes(input.command))) throw new Error("Invalid Task notification preference");
298
+ if (input.dueAt !== void 0 && input.command !== "submit") throw new Error("dueAt is supported only by submit");
269
299
  if (modelInput.sourceRefs?.length && !["submit", "revise"].includes(input.command)) throw new Error("sourceRefs is supported only by submit/revise; it cannot be silently ignored by a coordination command");
270
300
  const conversationId = deps.getCurrentConversationId?.();
271
301
  const ownAgentId = deps.getCurrentAgentId?.();
@@ -361,9 +391,12 @@ function createPersonalTaskTool(deps) {
361
391
  brief,
362
392
  requirements,
363
393
  sourceRefs: modelInput.sourceRefs,
394
+ conversationExcerpts: modelInput.conversationExcerpts,
364
395
  expectedOutputs: input.expectedOutputs,
365
396
  acceptanceCriteria: input.acceptanceCriteria,
366
397
  acceptancePolicy: input.acceptancePolicy,
398
+ notificationPreference: input.notificationPreference,
399
+ dueAt: input.dueAt,
367
400
  constraints: input.constraints
368
401
  });
369
402
  command = "create";
@@ -371,7 +404,10 @@ function createPersonalTaskTool(deps) {
371
404
  ...brief,
372
405
  createMode: "allocate",
373
406
  requirements,
407
+ dueAt: input.dueAt,
408
+ notificationPreference: input.notificationPreference,
374
409
  sourceRefs: modelInput.sourceRefs,
410
+ conversationExcerpts: modelInput.conversationExcerpts,
375
411
  includeConversationContext: false,
376
412
  expectedOutputs: input.expectedOutputs,
377
413
  acceptanceCriteria: input.acceptanceCriteria,
@@ -473,6 +509,34 @@ function createPersonalTaskTool(deps) {
473
509
  const taskId = input.taskId?.trim();
474
510
  if (!taskId) throw new Error("taskId is required");
475
511
  if (!new TaskOriginRepository().owns(taskId, conversationId)) throw new Error("Task does not belong to this personal conversation");
512
+ if (command === "notifications") {
513
+ if (!input.notificationPreference) throw new Error("notificationPreference is required");
514
+ setTaskNotificationPreference(taskId, conversationId, input.notificationPreference);
515
+ return {
516
+ content: [{
517
+ type: "text",
518
+ text: JSON.stringify({
519
+ ok: true,
520
+ taskId,
521
+ notificationPreference: input.notificationPreference
522
+ })
523
+ }],
524
+ details: {}
525
+ };
526
+ }
527
+ if (command === "get" && input.section === "status") {
528
+ const summary = taskConversationSummary(taskId, conversationId);
529
+ return {
530
+ content: [{
531
+ type: "text",
532
+ text: JSON.stringify({
533
+ ok: Boolean(summary),
534
+ summary
535
+ })
536
+ }],
537
+ details: {}
538
+ };
539
+ }
476
540
  if (command === "get" && input.section === "revision") {
477
541
  const model = new TaskReadModelProjector().get(taskId);
478
542
  return {
@@ -652,6 +716,7 @@ function createPersonalTaskTool(deps) {
652
716
  operationalState: payload.operationalState,
653
717
  allocation: payload.allocation,
654
718
  runId: payload.runId,
719
+ notificationPreference: input.notificationPreference,
655
720
  coordination: "Use instruct on this taskId for new direction while work is running. Do not revise until a completed result baseline exists. Confirm submission briefly and finish."
656
721
  };
657
722
  return {
@@ -2,9 +2,9 @@ import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
3
  import { init_fts, sessionSearchTerms } from "../../storage/sqlite/fts.js";
4
4
  import { readAgentMessageContent } from "../memory/agent-message-access.js";
5
+ import { FORGOTTEN_HISTORY_EXCERPT, forgottenHistoryEntries, projectUnadmittedForgottenFields } from "../../memory-learning/forgotten-history.js";
5
6
  import { init_providers, resolveModel } from "../../providers/index.js";
6
7
  import { completeWithResolvedCredentials } from "../../providers/model-call.js";
7
- import { FORGOTTEN_HISTORY_EXCERPT, forgottenHistoryEntries, projectUnadmittedForgottenFields } from "../../memory-learning/forgotten-history.js";
8
8
  import { stripRuntimeContextFromUserMessage } from "../../session/user-message-display.js";
9
9
  import "./local-read-budget.js";
10
10
  import { Type } from "@sinclair/typebox";
@@ -2,7 +2,7 @@ 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">, import("@sinclair/typebox").TLiteral<"brief">, import("@sinclair/typebox").TLiteral<"handoff">, import("@sinclair/typebox").TLiteral<"source">, import("@sinclair/typebox").TLiteral<"evidence">]>>;
5
+ section: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"goal">, 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
6
  offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
7
7
  materialize: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
8
8
  sourceIndex: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
@@ -1,3 +1,4 @@
1
+ import { getSqliteDatabase, init_transaction } from "../../storage/sqlite/transaction.js";
1
2
  import { parseResultReferenceId } from "../../../packages/gateway-contract/src/result-reference.js";
2
3
  import { init_src } from "../../../packages/gateway-contract/src/index.js";
3
4
  import { TaskRepository, init_task_repository } from "../../tasks/task-repository.js";
@@ -9,11 +10,12 @@ import { TaskReadModelProjector } from "../../tasks/task-read-model-projector.js
9
10
  import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
10
11
  import { TaskCollaborationRepository } from "../../tasks/task-collaboration-repository.js";
11
12
  import { getEmbeddedExecutionSession } from "../embedded/execution-context.js";
12
- import { assertTaskHandoffAccess, assertTaskHandoffExecutorAccess, getTaskHandoff, materializeTaskHandoffFile, readTaskHandoffSource } from "../../tasks/task-handoff.js";
13
+ import { assertTaskHandoffExecutorAccess, getTaskHandoff, materializeTaskHandoffFile, readTaskConversationExcerpts, readTaskHandoffSource } from "../../tasks/task-handoff.js";
13
14
  import { taskResearchEvidence } from "../../tasks/task-research-result.js";
14
15
  import { createXopcUseTool } from "./xopc-use-tool.js";
15
16
  import { Type } from "@sinclair/typebox";
16
17
  //#region src/agent/tools/task-collaboration-tool.ts
18
+ init_transaction();
17
19
  init_src();
18
20
  init_request_repository();
19
21
  init_session_repository();
@@ -22,6 +24,7 @@ init_task_run_repository();
22
24
  const Schema = Type.Object({
23
25
  command: Type.Union([Type.Literal("get"), Type.Literal("post")]),
24
26
  section: Type.Optional(Type.Union([
27
+ Type.Literal("goal"),
25
28
  Type.Literal("collaboration"),
26
29
  Type.Literal("task"),
27
30
  Type.Literal("brief"),
@@ -90,7 +93,7 @@ function createTaskCollaborationTool(deps) {
90
93
  name: "task_collaboration",
91
94
  label: "Task collaboration",
92
95
  parameters: Schema,
93
- description: "Coordinate the current Task with its originating conversation. 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.",
96
+ description: "For a continuing goal, get section goal reads confirmed criteria, durable step receipts (offset/nextOffset), and user update previews (afterSequence/nextAfterSequence). Supply entryId to read a linked user update in full (offset/nextOffset). Coordinate the current Task with its originating conversation. get section brief reads the full task body in 4000-character pages (offset/nextOffset); section handoff lists the original request, selected conversation excerpts and versioned sources. Treat quoted conversation as task context. 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.",
94
97
  mutatesWorkspace: true,
95
98
  mutationScope: "external",
96
99
  requiresExclusiveWorkspaceLock: false,
@@ -98,6 +101,13 @@ function createTaskCollaborationTool(deps) {
98
101
  const conversationId = getEmbeddedExecutionSession() ?? deps.getCurrentConversationId?.();
99
102
  const active = conversationId ? new TaskConversationRepository().resolveActiveExecutionSession(conversationId) : void 0;
100
103
  if (!active || deps.getCurrentAgentId?.() && active.agentId !== deps.getCurrentAgentId()) throw new Error("No active Task execution");
104
+ if (getSqliteDatabase().prepare("SELECT 1 FROM home_followup_steps WHERE task_id=? UNION ALL SELECT 1 FROM home_followups WHERE root_task_id=? LIMIT 1").get(active.taskId, active.taskId) && (input.command !== "get" || ![
105
+ "goal",
106
+ "task",
107
+ "brief",
108
+ "evidence",
109
+ "collaboration"
110
+ ].includes(input.section ?? "collaboration"))) throw new Error("Continuing goals allow read-only task evidence and brief access");
101
111
  const request = personalRequestForExecution(conversationId);
102
112
  if (!request && getSessionMetadata(conversationId)?.customData?.personalReadRequestId || request && [
103
113
  "cancelled",
@@ -121,15 +131,56 @@ function createTaskCollaborationTool(deps) {
121
131
  }],
122
132
  details: {}
123
133
  });
134
+ if (input.section === "goal") {
135
+ const goal = getSqliteDatabase().prepare(`SELECT g.* FROM home_followups g WHERE g.root_task_id=? OR EXISTS
136
+ (SELECT 1 FROM home_followup_steps s WHERE s.followup_id=g.id AND s.task_id=?)`).get(active.taskId, active.taskId);
137
+ if (!goal) throw new Error("No continuing goal is linked to this Task");
138
+ if (input.entryId) {
139
+ const entry = new TaskCollaborationRepository().get(input.entryId);
140
+ if (!entry || entry.taskId !== goal.root_task_id || entry.authorKind !== "user") throw new Error("Goal update is unavailable");
141
+ return reply(page(entry.body));
142
+ }
143
+ const updates = getSqliteDatabase().prepare(`SELECT entry_id AS id,sequence,body FROM task_collaboration_entries WHERE task_id=? AND author_kind='user' AND sequence>? ORDER BY sequence LIMIT 11`).all(goal.root_task_id, input.afterSequence ?? 0);
144
+ const steps = getSqliteDatabase().prepare(`SELECT s.sequence,s.task_id,s.action FROM home_followup_steps s WHERE s.followup_id=? AND s.sequence>? ORDER BY s.sequence LIMIT 11`).all(goal.id, input.offset ?? 0);
145
+ return reply({
146
+ goal: goal.goal,
147
+ criteria: JSON.parse(goal.criteria_json),
148
+ status: goal.status,
149
+ updates: updates.slice(0, 10).map((u) => ({
150
+ id: u.id,
151
+ sequence: u.sequence,
152
+ preview: u.body.slice(0, 200)
153
+ })),
154
+ ...updates.length > 10 ? { nextAfterSequence: updates[9].sequence } : {},
155
+ steps: steps.slice(0, 10).map((s) => {
156
+ const run = new TaskRunRepository().getLatestRoot(s.task_id);
157
+ const receipt = run && new TaskRunRepository().getReceipt(run.id);
158
+ return {
159
+ number: s.sequence,
160
+ taskId: s.task_id,
161
+ action: s.action,
162
+ status: run?.status,
163
+ receipt: receipt ? {
164
+ summary: receipt.summary.slice(0, 1600),
165
+ verification: receipt.verification.status,
166
+ verdict: receipt.completionVerdict
167
+ } : void 0
168
+ };
169
+ }),
170
+ ...steps.length > 10 ? { nextOffset: steps[9].sequence } : {},
171
+ note: "Historical receipts report prior work; they are not independent proof of current external state."
172
+ });
173
+ }
124
174
  if (input.section === "brief") return reply(page(new TaskRepository().require(active.taskId).body ?? ""));
125
175
  if (input.section === "handoff") {
126
176
  const handoff = getTaskHandoff(active.taskId);
127
177
  if (!handoff) return reply({ available: false });
128
- assertTaskHandoffAccess(handoff);
178
+ const conversationExcerpts = readTaskConversationExcerpts(handoff, deps.getConfig?.());
129
179
  return reply({
130
180
  ...handoff,
131
181
  originalRequest: page(handoff.originalRequest ?? ""),
132
182
  interpretation: void 0,
183
+ ...handoff.conversationExcerpts ? { conversationExcerpts } : {},
133
184
  sources: handoff.sources.map(({ text: _text, ...source }, sourceIndex) => ({
134
185
  ...source,
135
186
  sourceIndex,
@@ -6,6 +6,37 @@ const id = Type.String({
6
6
  maxLength: 120
7
7
  });
8
8
  const schema = Type.Object({
9
+ followUp: Type.Optional(Type.Union([
10
+ Type.Object({
11
+ state: Type.Literal("next_step"),
12
+ nextStep: Type.String({
13
+ minLength: 1,
14
+ maxLength: 1e3
15
+ }),
16
+ reason: Type.String({
17
+ minLength: 1,
18
+ maxLength: 1e3
19
+ })
20
+ }, { additionalProperties: false }),
21
+ Type.Object({
22
+ state: Type.Literal("waiting"),
23
+ waitingFor: Type.String({
24
+ minLength: 1,
25
+ maxLength: 1e3
26
+ }),
27
+ nextStep: Type.Optional(Type.String({
28
+ minLength: 1,
29
+ maxLength: 1e3
30
+ }))
31
+ }, { additionalProperties: false }),
32
+ Type.Object({
33
+ state: Type.Literal("review_goal"),
34
+ reason: Type.String({
35
+ minLength: 1,
36
+ maxLength: 1e3
37
+ })
38
+ }, { additionalProperties: false })
39
+ ], { description: "For continuing-goal steps, propose the next bounded step, say exactly what input is missing, or request goal review. Never declare the parent goal complete." })),
9
40
  finalText: Type.Optional(Type.String({
10
41
  minLength: 1,
11
42
  maxLength: 16e3,
@@ -12,6 +12,7 @@ import { getSessionMetadata } from "../../storage/sqlite/session-read-repository
12
12
  import "../../storage/sqlite/index.js";
13
13
  import "../../activity/index.js";
14
14
  import { getDefaultAgentId, init_resolve_route } from "../../routing/resolve-route.js";
15
+ import { isPersonalConversation } from "../../personal-agent/repository.js";
15
16
  import { hasUnlocalizedTaskText, resolveTaskLocale } from "../../tasks/task-language.js";
16
17
  import { TaskReadModelProjector } from "../../tasks/task-read-model-projector.js";
17
18
  import { TaskOriginRepository } from "../../tasks/task-origin-repository.js";
@@ -25,7 +26,7 @@ import { AutomationMcpSourceInput, prepareAutomationMcpSource } from "../../auto
25
26
  import { AutomationCreateCapabilityInputSchema, AutomationUpdatePatchSchema } from "../../automations/capabilities/write.js";
26
27
  import { resolveProjectAgentId } from "../../projects/project-agent.js";
27
28
  import "../../projects/index.js";
28
- import { parseTaskHandoffReferences } from "../../tasks/task-handoff.js";
29
+ import { parseTaskConversationExcerpts, parseTaskHandoffReferences } from "../../tasks/task-handoff.js";
29
30
  import { TaskApplicationService } from "../../tasks/task-application-service.js";
30
31
  import { resolveResponseLanguageForSession } from "../prompt/response-language.js";
31
32
  import { TaskMutationOutputSchema } from "../../tasks/capabilities/write.js";
@@ -34,6 +35,7 @@ import { TaskDeleteOutputSchema } from "../../tasks/capabilities/management.js";
34
35
  import { localAppCapabilities } from "../../local-apps/capabilities/runtime.js";
35
36
  import { createProductDispatcher } from "../../capabilities/runtime/product.js";
36
37
  import { getDelegationScope } from "../orchestration/delegation-scope.js";
38
+ import { isTaskNotificationPreference, taskNotificationContext } from "../../tasks/task-notification-preference.js";
37
39
  import { defineTaskContract } from "../../tasks/task-contract-definition.js";
38
40
  import "../../tasks/index.js";
39
41
  import { randomUUID } from "node:crypto";
@@ -1488,6 +1490,20 @@ async function handleTask(command, args, deps, dryRun, capabilities) {
1488
1490
  ok: false,
1489
1491
  error: "Invalid selected task sourceRefs"
1490
1492
  };
1493
+ if (args.conversationExcerpts !== void 0 && (createMode !== "allocate" || !originConversationId || !isPersonalConversation(originConversationId))) return {
1494
+ ok: false,
1495
+ error: "Selected conversation excerpts require a Personal Task submission"
1496
+ };
1497
+ const notificationPreference = args.notificationPreference;
1498
+ if (notificationPreference !== void 0 && (!isTaskNotificationPreference(notificationPreference) || createMode !== "allocate" || !originConversationId || !isPersonalConversation(originConversationId))) return {
1499
+ ok: false,
1500
+ error: "Notification preferences require a Personal Task submission"
1501
+ };
1502
+ const conversationExcerpts = parseTaskConversationExcerpts(originConversationId, args.conversationExcerpts, config);
1503
+ if (!conversationExcerpts) return {
1504
+ ok: false,
1505
+ error: "Use exact visible passages and entry IDs from this conversation for selected excerpts"
1506
+ };
1491
1507
  const input = {
1492
1508
  idempotencyKey: trimString(args.idempotencyKey) ?? randomUUID(),
1493
1509
  title: trimString(args.title) ?? objective,
@@ -1504,24 +1520,39 @@ async function handleTask(command, args, deps, dryRun, capabilities) {
1504
1520
  outputDestinations: []
1505
1521
  },
1506
1522
  dependencies: dependsOnTaskIds,
1507
- context: [...args.includeConversationContext === false ? [] : conversationId ? [{
1508
- targetKind: "session",
1509
- targetId: conversationId,
1510
- role: "input",
1511
- pinned: false,
1512
- retrievalPolicy: {},
1513
- metadata: {}
1514
- }] : [], ...sourceRefs.map((ref) => ({
1515
- targetKind: "source",
1516
- targetId: `${ref.kind}:${ref.sourceId}`,
1517
- role: "input",
1518
- pinned: true,
1519
- retrievalPolicy: { currentAuthorizationRequired: true },
1520
- metadata: {
1521
- kind: "task_reference_request",
1522
- ref
1523
- }
1524
- }))],
1523
+ context: [
1524
+ ...args.includeConversationContext === false ? [] : conversationId ? [{
1525
+ targetKind: "session",
1526
+ targetId: conversationId,
1527
+ role: "input",
1528
+ pinned: false,
1529
+ retrievalPolicy: {},
1530
+ metadata: {}
1531
+ }] : [],
1532
+ ...sourceRefs.map((ref) => ({
1533
+ targetKind: "source",
1534
+ targetId: `${ref.kind}:${ref.sourceId}`,
1535
+ role: "input",
1536
+ pinned: true,
1537
+ retrievalPolicy: { currentAuthorizationRequired: true },
1538
+ metadata: {
1539
+ kind: "task_reference_request",
1540
+ ref
1541
+ }
1542
+ })),
1543
+ ...originConversationId && isTaskNotificationPreference(notificationPreference) ? [taskNotificationContext(originConversationId, notificationPreference)] : [],
1544
+ ...conversationExcerpts.map((excerpt) => ({
1545
+ targetKind: "source",
1546
+ targetId: `conversation-excerpt:${excerpt.entryId}`,
1547
+ role: "input",
1548
+ pinned: true,
1549
+ retrievalPolicy: { currentAuthorizationRequired: true },
1550
+ metadata: {
1551
+ kind: "task_conversation_excerpt",
1552
+ excerpt
1553
+ }
1554
+ }))
1555
+ ],
1525
1556
  authorityGrants: [],
1526
1557
  activation: createMode === "allocate" ? {
1527
1558
  mode: "allocate",
@@ -112,12 +112,12 @@ export declare const AutomationCreateCapabilityInputSchema: z.ZodObject<{
112
112
  wait: z.ZodObject<{
113
113
  kind: z.ZodEnum<{
114
114
  approval: "approval";
115
+ paused: "paused";
115
116
  dependency: "dependency";
116
117
  user_input: "user_input";
117
118
  external_event: "external_event";
118
119
  scheduled_time: "scheduled_time";
119
120
  retry_backoff: "retry_backoff";
120
- paused: "paused";
121
121
  }>;
122
122
  reason: z.ZodString;
123
123
  condition: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -346,12 +346,12 @@ export declare const AutomationUpdatePatchSchema: z.ZodObject<{
346
346
  wait: z.ZodObject<{
347
347
  kind: z.ZodEnum<{
348
348
  approval: "approval";
349
+ paused: "paused";
349
350
  dependency: "dependency";
350
351
  user_input: "user_input";
351
352
  external_event: "external_event";
352
353
  scheduled_time: "scheduled_time";
353
354
  retry_backoff: "retry_backoff";
354
- paused: "paused";
355
355
  }>;
356
356
  reason: z.ZodString;
357
357
  condition: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;