@xopcai/xopc 0.0.178 → 0.0.179

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 (343) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-BzGX__8I.js → activity-store-A5FUMjeV.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BzxntcaZ.js → agent-avatar-dicebear-NghNiDWx.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-Baq8Shzy.js +2 -0
  6. package/dist/gateway/static/root/assets/{api-hi6f2Xtp.js → api-Bmzslx0Z.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-fTY1F7ac.js → app-management-settings-panel-DDWS_BBJ.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-BZ-IxQfB.js → appearance-settings-C6znvVtX.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-d-Y0Jbe1.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-ZSLLG8wB.js → archive-plugin-fvTZhPUr.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-D4YktqIF.js → attachment-load-BFEgvg-Q.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-page-CFYOCBlQ.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-BIkPxfxj.js → binary-plugins-CuI2bOc7.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-Q3v_YQom.js → block-editor-Z_k8W0al.js} +46 -46
  15. package/dist/gateway/static/root/assets/browser-settings-page-CGApoYPr.js +8 -0
  16. package/dist/gateway/static/root/assets/{browser-workflow-inputs-M5lTEW1I.js → browser-workflow-inputs-gs6b5e9-.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflows-page-B3T1KYk4.js → browser-workflows-page-Cq5qXStp.js} +2 -2
  18. package/dist/gateway/static/root/assets/capabilities-settings-panel-BC-8n4Hl.js +7 -0
  19. package/dist/gateway/static/root/assets/{capability-presets-api-DE09c0VB.js → capability-presets-api-BTKhPoDC.js} +1 -1
  20. package/dist/gateway/static/root/assets/capability-presets-settings-panel-D7WQ0oBN.js +1 -0
  21. package/dist/gateway/static/root/assets/{channel-recipient-api-CFR5FBfS.js → channel-recipient-api-TwMak0SE.js} +1 -1
  22. package/dist/gateway/static/root/assets/channels-settings-DysELlO_.js +1 -0
  23. package/dist/gateway/static/root/assets/channels-status-swr-BAC-R8IK.js +1 -0
  24. package/dist/gateway/static/root/assets/{connector-logo-B1mD-3pM.js → connector-logo-DBKotvNr.js} +1 -1
  25. package/dist/gateway/static/root/assets/connectors-page-QH-0WnOo.js +2 -0
  26. package/dist/gateway/static/root/assets/desktop-pet-Dwml8znf.js +1 -0
  27. package/dist/gateway/static/root/assets/desktop-pet-settings-CyIg2jJp.js +1 -0
  28. package/dist/gateway/static/root/assets/{directory-picker-path-field-BYQJ2XUS.js → directory-picker-path-field-B6fc_7SL.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dreaming-settings-BXcb8fwx.js → dreaming-settings-CUQxGnDf.js} +3 -3
  30. package/dist/gateway/static/root/assets/{extension-debug-page-O1Xu1r4Q.js → extension-debug-page-AbRNi2ON.js} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-page-C2Jraq8l.js → extension-page-ClYfiLXC.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-settings-page-DcXQDTpG.js → extension-settings-page-BGVP2hw1.js} +1 -1
  33. package/dist/gateway/static/root/assets/{gateway-config-api-DmPIZrvg.js → gateway-config-api-B7GqtklK.js} +1 -1
  34. package/dist/gateway/static/root/assets/gateway-settings-BMeK8igT.js +1 -0
  35. package/dist/gateway/static/root/assets/{gateway-startup-retry-BZEkOdPm.js → gateway-startup-retry-CKKL96r_.js} +1 -1
  36. package/dist/gateway/static/root/assets/goals-settings-Dj0ao2qA.js +1 -0
  37. package/dist/gateway/static/root/assets/{heartbeat-settings-BtKu2NWT.js → heartbeat-settings-CTI2nPKa.js} +1 -1
  38. package/dist/gateway/static/root/assets/{image-generation-api-05Gg8wsU.js → image-generation-api-BY3VQ5Mv.js} +1 -1
  39. package/dist/gateway/static/root/assets/index-B0Tdge_q.css +1 -0
  40. package/dist/gateway/static/root/assets/index-BDzspHrg.js +224 -0
  41. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CfmDR9Sc.js → keyboard-shortcuts-settings-CELtDFz3.js} +1 -1
  42. package/dist/gateway/static/root/assets/local-app-workbench-page-m8CTSGix.js +2 -0
  43. package/dist/gateway/static/root/assets/{local-apps-page-Df8BW1A_.js → local-apps-page-CF5uUd1n.js} +1 -1
  44. package/dist/gateway/static/root/assets/{locale-store-CTwSy7yW.js → locale-store-DIVc0AQs.js} +1 -1
  45. package/dist/gateway/static/root/assets/logs-page-DmH7Tk4k.js +7 -0
  46. package/dist/gateway/static/root/assets/{markdown-split-B3FvKbaP.js → markdown-split-CN85EdB8.js} +1 -1
  47. package/dist/gateway/static/root/assets/{media-plugins-DsjrvvB6.js → media-plugins-CxYEc-b8.js} +1 -1
  48. package/dist/gateway/static/root/assets/messages-DYqBwJAK.js +3 -0
  49. package/dist/gateway/static/root/assets/{notes-page-tuzIwy3c.js → notes-page-Goab4781.js} +1 -1
  50. package/dist/gateway/static/root/assets/notes-workbench-C4jDBVBN.js +4 -0
  51. package/dist/gateway/static/root/assets/outcome-detail-page-DNRfeLZp.js +1 -0
  52. package/dist/gateway/static/root/assets/{page-tabs-ke9s4nYi.js → page-tabs-tQNQcAts.js} +1 -1
  53. package/dist/gateway/static/root/assets/{preview-open-alternatives-Cp1eI4S9.js → preview-open-alternatives-BSTlgsDB.js} +1 -1
  54. package/dist/gateway/static/root/assets/product-delivery-BVG-eWQO.js +1 -0
  55. package/dist/gateway/static/root/assets/{product-open-page-dXQCMAtH.js → product-open-page-iQ5gTCip.js} +1 -1
  56. package/dist/gateway/static/root/assets/project-detail-page-D7anK-eu.js +1 -0
  57. package/dist/gateway/static/root/assets/projects-page-BePESKWy.js +1 -0
  58. package/dist/gateway/static/root/assets/remote-access-hub-CHrzBKIs.js +1 -0
  59. package/dist/gateway/static/root/assets/{save-bar-controls-Bl30zjHc.js → save-bar-controls-BsPf5Gkk.js} +1 -1
  60. package/dist/gateway/static/root/assets/{schedule-field-DqhmXQKo.js → schedule-field-kAytH7mq.js} +1 -1
  61. package/dist/gateway/static/root/assets/{schema-form-DkUCy6vf.js → schema-form-Bbw8l2ri.js} +1 -1
  62. package/dist/gateway/static/root/assets/{schemas-DgQq6Z5S.js → schemas-C6onAggk.js} +2 -2
  63. package/dist/gateway/static/root/assets/sessions-page-He5YAczL.js +1 -0
  64. package/dist/gateway/static/root/assets/settings-advanced-gate-2eAC9GCP.js +1 -0
  65. package/dist/gateway/static/root/assets/{settings-form-section-C6ZbNpdy.js → settings-form-section-BqbibcnJ.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-loading-skeleton-Bk58_cr7.js → settings-loading-skeleton-DNLNCEGT.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-page-k8iE_NdX.js → settings-page-BR6Ss0bK.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-page-layout-DgFSya2e.js → settings-page-layout-Cdb1e2Cz.js} +1 -1
  69. package/dist/gateway/static/root/assets/{setup-status-panel-B_KDlyZA.js → setup-status-panel-moT-D-ia.js} +1 -1
  70. package/dist/gateway/static/root/assets/{share-preview-page-CV7nL_J9.js → share-preview-page-CkrASny2.js} +1 -1
  71. package/dist/gateway/static/root/assets/shares-settings-X49zY21H.js +1 -0
  72. package/dist/gateway/static/root/assets/skill-reload-api-CjpnFfOH.js +1 -0
  73. package/dist/gateway/static/root/assets/skills-page-DEwfSOUE.js +2 -0
  74. package/dist/gateway/static/root/assets/{skills-page.utils-kahBIHg0.js → skills-page.utils-BG5dGkyA.js} +1 -1
  75. package/dist/gateway/static/root/assets/{system-settings-panel-JV3-MG5F.js → system-settings-panel-XdY8eyYf.js} +1 -1
  76. package/dist/gateway/static/root/assets/{theme-store-DFLyzoLO.js → theme-store-DtwI_VLT.js} +1 -1
  77. package/dist/gateway/static/root/assets/time-picker-UghsQu_I.js +1 -0
  78. package/dist/gateway/static/root/assets/{typed-models-lib-60Aqo-UJ.js → typed-models-lib-DOnpwsrE.js} +1 -1
  79. package/dist/gateway/static/root/assets/{use-channel-catalog-CnTkHDnw.js → use-channel-catalog-BWDtfNvQ.js} +1 -1
  80. package/dist/gateway/static/root/assets/user-context-page-BtNBEtKj.js +1 -0
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-CNa8qUgS.js → voice-api-key-field-DP80jW-W.js} +1 -1
  82. package/dist/gateway/static/root/assets/work-copy-hQmivDgT.js +1 -0
  83. package/dist/gateway/static/root/assets/work-discovery-page-CkDOVZBr.js +1 -0
  84. package/dist/gateway/static/root/assets/work-item-detail-page-CqvkcFcR.js +1 -0
  85. package/dist/gateway/static/root/assets/work-page-BL8TZW4Z.js +3 -0
  86. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-yV_x595t.js → workflow-run-setup-panel-BLlVqKdA.js} +2 -2
  87. package/dist/gateway/static/root/assets/workflows-page-BgsdRu3_.js +11 -0
  88. package/dist/gateway/static/root/index.html +9 -10
  89. package/dist/package.js +1 -1
  90. package/dist/packages/gateway-contract/src/outcomes.js +137 -0
  91. package/dist/packages/gateway-contract/src/product-delivery.js +1 -0
  92. package/dist/packages/gateway-contract/src/work-intake.js +85 -0
  93. package/dist/src/activity/service.d.ts +1 -0
  94. package/dist/src/activity/service.js +4 -1
  95. package/dist/src/agent/code-intelligence/binary.js +1 -1
  96. package/dist/src/agent/context/execution-scope.d.ts +1 -1
  97. package/dist/src/agent/context/execution-scope.js +6 -4
  98. package/dist/src/agent/goals/post-turn.js +6 -5
  99. package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
  100. package/dist/src/agent/memory/user-context-coordinator.d.ts +1 -0
  101. package/dist/src/agent/memory/user-context-coordinator.js +17 -1
  102. package/dist/src/agent/outcomes/{task-evaluation.d.ts → execution-evaluation.d.ts} +3 -3
  103. package/dist/src/agent/outcomes/{task-evaluation.js → execution-evaluation.js} +5 -5
  104. package/dist/src/agent/outcomes/execution-verifier.d.ts +29 -0
  105. package/dist/src/agent/outcomes/{task-verifier.js → execution-verifier.js} +4 -4
  106. package/dist/src/agent/service/process-direct-streaming.js +3 -1
  107. package/dist/src/agent/tools/factory.js +16 -1
  108. package/dist/src/agent/tools/goal-tool.js +5 -3
  109. package/dist/src/agent/tools/todo-tool.d.ts +5 -0
  110. package/dist/src/agent/tools/todo-tool.js +16 -4
  111. package/dist/src/agent/tools/update-plan-tool.d.ts +1 -0
  112. package/dist/src/agent/tools/update-plan-tool.js +6 -0
  113. package/dist/src/browser/providers/cloakbrowser.js +2 -2
  114. package/dist/src/channels/attachments/voice-stt-webchat.d.ts +0 -3
  115. package/dist/src/channels/attachments/voice-stt-webchat.js +1 -24
  116. package/dist/src/chat-commands/builtins/goal.js +5 -4
  117. package/dist/src/cli/commands/agents.js +1 -1
  118. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  119. package/dist/src/cli/commands/goal.js +6 -5
  120. package/dist/src/cli/commands/tunnel.js +3 -3
  121. package/dist/src/connectors/learning-coordinator.js +7 -1
  122. package/dist/src/connectors/source-change-publisher.d.ts +17 -0
  123. package/dist/src/connectors/source-change-publisher.js +148 -0
  124. package/dist/src/discussions/analyzer.d.ts +35 -0
  125. package/dist/src/discussions/analyzer.js +127 -0
  126. package/dist/src/discussions/index.d.ts +7 -0
  127. package/dist/src/discussions/index.js +7 -0
  128. package/dist/src/discussions/live-worker.d.ts +33 -0
  129. package/dist/src/discussions/live-worker.js +148 -0
  130. package/dist/src/discussions/pipeline.d.ts +33 -0
  131. package/dist/src/discussions/pipeline.js +205 -0
  132. package/dist/src/discussions/project-inference.d.ts +13 -0
  133. package/dist/src/discussions/project-inference.js +19 -0
  134. package/dist/src/discussions/repository.d.ts +29 -0
  135. package/dist/src/discussions/repository.js +255 -0
  136. package/dist/src/discussions/service.d.ts +51 -0
  137. package/dist/src/discussions/service.js +335 -0
  138. package/dist/src/discussions/transcript.d.ts +3 -0
  139. package/dist/src/discussions/transcript.js +15 -0
  140. package/dist/src/discussions/types.d.ts +116 -0
  141. package/dist/src/discussions/types.js +10 -0
  142. package/dist/src/discussions/worker.d.ts +18 -0
  143. package/dist/src/discussions/worker.js +74 -0
  144. package/dist/src/extensions/activation-context.js +2 -1
  145. package/dist/src/extensions/sdk/testing.js +1 -1
  146. package/dist/src/gateway/agents-admin.js +1 -1
  147. package/dist/src/gateway/chat-stream/mapper.js +53 -3
  148. package/dist/src/gateway/chat-stream/protocol.d.ts +17 -1
  149. package/dist/src/gateway/heartbeat/service.js +1 -1
  150. package/dist/src/gateway/hono/app.js +8 -3
  151. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  152. package/dist/src/gateway/hono/middleware/auth.js +2 -2
  153. package/dist/src/gateway/hono/middleware/logger.js +1 -1
  154. package/dist/src/gateway/hono/middleware/strict-rate-limit.js +1 -1
  155. package/dist/src/gateway/hono/routes/agents.js +1 -1
  156. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  157. package/dist/src/gateway/hono/routes/connectors.js +79 -0
  158. package/dist/src/gateway/hono/routes/discussions.d.ts +3 -0
  159. package/dist/src/gateway/hono/routes/discussions.js +177 -0
  160. package/dist/src/gateway/hono/routes/execution-receipts.d.ts +3 -0
  161. package/dist/src/gateway/hono/routes/execution-receipts.js +163 -0
  162. package/dist/src/gateway/hono/routes/exposure.js +1 -1
  163. package/dist/src/gateway/hono/routes/goals.js +3 -288
  164. package/dist/src/gateway/hono/routes/home.d.ts +2 -102
  165. package/dist/src/gateway/hono/routes/home.js +8 -424
  166. package/dist/src/gateway/hono/routes/index.js +6 -2
  167. package/dist/src/gateway/hono/routes/memory.js +7 -7
  168. package/dist/src/gateway/hono/routes/notes.js +30 -0
  169. package/dist/src/gateway/hono/routes/projects.js +8 -152
  170. package/dist/src/gateway/hono/routes/shares.js +1 -1
  171. package/dist/src/gateway/hono/routes/status.js +2 -2
  172. package/dist/src/gateway/hono/routes/tunnel.js +3 -3
  173. package/dist/src/gateway/hono/routes/voice.js +1 -1
  174. package/dist/src/gateway/hono/routes/work.d.ts +3 -0
  175. package/dist/src/gateway/hono/routes/work.js +207 -0
  176. package/dist/src/gateway/hono/routes/you.js +12 -14
  177. package/dist/src/gateway/index.js +2 -2
  178. package/dist/src/gateway/runtime-config.js +2 -2
  179. package/dist/src/gateway/security/audit.js +2 -2
  180. package/dist/src/gateway/security/index.js +1 -1
  181. package/dist/src/gateway/service/config-coordinator.js +1 -1
  182. package/dist/src/gateway/service/run-gateway-agent.js +46 -51
  183. package/dist/src/gateway/service.d.ts +8 -1
  184. package/dist/src/gateway/service.js +139 -12
  185. package/dist/src/goals/goal-queue-store.d.ts +1 -0
  186. package/dist/src/goals/goal-queue-store.js +5 -1
  187. package/dist/src/goals/goal-queue-types.d.ts +11 -1
  188. package/dist/src/goals/goal-runner.js +10 -6
  189. package/dist/src/goals/goal-service.d.ts +2 -15
  190. package/dist/src/goals/goal-service.js +9 -42
  191. package/dist/src/goals/goal-store.d.ts +1 -18
  192. package/dist/src/goals/goal-store.js +25 -231
  193. package/dist/src/goals/index.d.ts +0 -4
  194. package/dist/src/goals/index.js +1 -3
  195. package/dist/src/goals/types.d.ts +4 -66
  196. package/dist/src/heartbeat/index.js +1 -1
  197. package/dist/src/notes/agent-context.js +1 -1
  198. package/dist/src/notes/service.d.ts +1 -0
  199. package/dist/src/notes/service.js +9 -0
  200. package/dist/src/notes/types.d.ts +1 -0
  201. package/dist/src/proactive/events/product-event-bridge.d.ts +7 -0
  202. package/dist/src/proactive/events/product-event-bridge.js +84 -0
  203. package/dist/src/proactive/execution/context.d.ts +27 -11
  204. package/dist/src/proactive/execution/context.js +259 -25
  205. package/dist/src/proactive/execution/repository.js +18 -5
  206. package/dist/src/proactive/execution/types.d.ts +7 -1
  207. package/dist/src/proactive/execution/worker.js +7 -6
  208. package/dist/src/proactive/inbox/repository.js +8 -2
  209. package/dist/src/proactive/index.d.ts +4 -2
  210. package/dist/src/proactive/index.js +5 -3
  211. package/dist/src/proactive/temporal/worker.d.ts +16 -0
  212. package/dist/src/proactive/temporal/worker.js +110 -0
  213. package/dist/src/share/share-zip.js +1 -1
  214. package/dist/src/share/site-proxy.js +1 -1
  215. package/dist/src/storage/sqlite/activity-repository.d.ts +1 -0
  216. package/dist/src/storage/sqlite/activity-repository.js +4 -1
  217. package/dist/src/storage/sqlite/connector-sync-policy-repository.d.ts +20 -0
  218. package/dist/src/storage/sqlite/connector-sync-policy-repository.js +50 -0
  219. package/dist/src/storage/sqlite/execution-receipt-repository.d.ts +146 -0
  220. package/dist/src/storage/sqlite/execution-receipt-repository.js +235 -0
  221. package/dist/src/storage/sqlite/index.d.ts +4 -2
  222. package/dist/src/storage/sqlite/index.js +6 -4
  223. package/dist/src/storage/sqlite/knowledge-repository.d.ts +3 -0
  224. package/dist/src/storage/sqlite/knowledge-repository.js +9 -1
  225. package/dist/src/storage/sqlite/memory-records-repository.js +1 -1
  226. package/dist/src/storage/sqlite/migrations/075_connector_sync_policies.sql +13 -0
  227. package/dist/src/storage/sqlite/migrations/076_meeting_preparation_scenario.sql +29 -0
  228. package/dist/src/storage/sqlite/migrations/077_proactive_insight_fingerprints.sql +4 -0
  229. package/dist/src/storage/sqlite/migrations/078_discussion_captures.sql +64 -0
  230. package/dist/src/storage/sqlite/migrations/079_discussion_follow_up_scenario.sql +29 -0
  231. package/dist/src/storage/sqlite/migrations/080_task_outcome_context.sql +15 -0
  232. package/dist/src/storage/sqlite/migrations/081_project_monitoring_policies.sql +10 -0
  233. package/dist/src/storage/sqlite/migrations/082_one_click_live_discussions.sql +100 -0
  234. package/dist/src/storage/sqlite/migrations/083_session_task_plans.sql +9 -0
  235. package/dist/src/storage/sqlite/migrations/084_work_intake_lifecycle.sql +26 -0
  236. package/dist/src/storage/sqlite/migrations/085_task_outcome_projection.sql +19 -0
  237. package/dist/src/storage/sqlite/migrations/086_outcome_aggregates.sql +168 -0
  238. package/dist/src/storage/sqlite/migrations/087_context_snapshots.sql +21 -0
  239. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  240. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  241. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  242. package/dist/src/storage/sqlite/notes-repository.js +9 -0
  243. package/dist/src/storage/sqlite/schema.js +1 -1
  244. package/dist/src/storage/sqlite/schema.sql +89 -44
  245. package/dist/src/storage/sqlite/session-repository.js +1 -1
  246. package/dist/src/storage/sqlite/session-task-plan-repository.d.ts +20 -0
  247. package/dist/src/storage/sqlite/session-task-plan-repository.js +77 -0
  248. package/dist/src/tui/backends/embedded-backend.js +1 -1
  249. package/dist/src/tunnel/frpc-binary.js +1 -1
  250. package/dist/src/tunnel/frpc-extract.js +1 -1
  251. package/dist/src/tunnel/index.js +2 -2
  252. package/dist/src/user-context/context-compiler.d.ts +31 -0
  253. package/dist/src/user-context/context-compiler.js +51 -0
  254. package/dist/src/voice/local/model-files.js +1 -1
  255. package/dist/src/voice/stt/config.d.ts +4 -0
  256. package/dist/src/voice/stt/config.js +26 -0
  257. package/dist/src/voice/stt/index.d.ts +1 -0
  258. package/dist/src/voice/stt/index.js +2 -1
  259. package/dist/src/voice/stt/list-providers.js +1 -1
  260. package/dist/src/work/attention-governor.d.ts +20 -0
  261. package/dist/src/work/attention-governor.js +46 -0
  262. package/dist/src/work/execution-context.d.ts +16 -0
  263. package/dist/src/work/execution-context.js +66 -0
  264. package/dist/src/work/home-query-service.d.ts +118 -0
  265. package/dist/src/work/home-query-service.js +389 -0
  266. package/dist/src/work/index.d.ts +14 -0
  267. package/dist/src/work/index.js +15 -0
  268. package/dist/src/work/outcome-contract-definition.d.ts +8 -0
  269. package/dist/src/work/outcome-contract-definition.js +15 -0
  270. package/dist/src/work/outcome-execution-service.d.ts +27 -0
  271. package/dist/src/work/outcome-execution-service.js +60 -0
  272. package/dist/src/work/outcome-projection-service.d.ts +7 -0
  273. package/dist/src/work/outcome-projection-service.js +51 -0
  274. package/dist/src/work/outcome-receipt-service.d.ts +13 -0
  275. package/dist/src/work/outcome-receipt-service.js +55 -0
  276. package/dist/src/work/outcome-repository.d.ts +50 -0
  277. package/dist/src/work/outcome-repository.js +112 -0
  278. package/dist/src/work/outcome-run-coordinator.d.ts +25 -0
  279. package/dist/src/work/outcome-run-coordinator.js +117 -0
  280. package/dist/src/work/project-monitoring-service.d.ts +21 -0
  281. package/dist/src/work/project-monitoring-service.js +76 -0
  282. package/dist/src/work/project-operating-view-service.d.ts +10 -0
  283. package/dist/src/work/project-operating-view-service.js +46 -0
  284. package/dist/src/work/work-intake-repository.d.ts +49 -0
  285. package/dist/src/work/work-intake-repository.js +97 -0
  286. package/dist/src/work/work-intake-service.d.ts +26 -0
  287. package/dist/src/work/work-intake-service.js +171 -0
  288. package/dist/src/work/work-value-metrics-service.d.ts +4 -0
  289. package/dist/src/work/work-value-metrics-service.js +88 -0
  290. package/dist/src/work-items/work-item-service.d.ts +0 -2
  291. package/dist/src/work-items/work-item-service.js +0 -28
  292. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  293. package/dist/src/workflows/service/workflow-session-bridge.js +2 -2
  294. package/package.json +1 -1
  295. package/dist/gateway/static/root/assets/agents-DC9F12Kw.js +0 -2
  296. package/dist/gateway/static/root/assets/apps-page-5bKr05Fa.js +0 -1
  297. package/dist/gateway/static/root/assets/automation-suggestion-card-B7mxFRtf.js +0 -1
  298. package/dist/gateway/static/root/assets/automations-page-Dg6dmt5g.js +0 -6
  299. package/dist/gateway/static/root/assets/browser-settings-page-BHoo6Rpq.js +0 -8
  300. package/dist/gateway/static/root/assets/capabilities-settings-panel-BlsqN8Fu.js +0 -7
  301. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DJeT8_B4.js +0 -1
  302. package/dist/gateway/static/root/assets/channels-settings-C4VVjYEm.js +0 -1
  303. package/dist/gateway/static/root/assets/channels-status-swr-vdf8kB16.js +0 -1
  304. package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +0 -1
  305. package/dist/gateway/static/root/assets/connectors-page-DNcrDThX.js +0 -2
  306. package/dist/gateway/static/root/assets/desktop-pet-B1urphOZ.js +0 -1
  307. package/dist/gateway/static/root/assets/desktop-pet-settings-DTL6J3EP.js +0 -1
  308. package/dist/gateway/static/root/assets/gateway-settings-DmObBx9b.js +0 -1
  309. package/dist/gateway/static/root/assets/goal-create-dialog-BRhmmBe9.js +0 -1
  310. package/dist/gateway/static/root/assets/goal-detail-page-C1k7_s_O.js +0 -4
  311. package/dist/gateway/static/root/assets/goals-config-api-Fwu1wjEP.js +0 -1
  312. package/dist/gateway/static/root/assets/goals-page-hOu9uA3q.js +0 -2
  313. package/dist/gateway/static/root/assets/goals-settings-DY-JjvHz.js +0 -1
  314. package/dist/gateway/static/root/assets/index-C0CGebQ1.js +0 -212
  315. package/dist/gateway/static/root/assets/index-eqq25gvV.css +0 -1
  316. package/dist/gateway/static/root/assets/local-app-workbench-page-EjsNT7nJ.js +0 -2
  317. package/dist/gateway/static/root/assets/logs-page-Dswjlraa.js +0 -7
  318. package/dist/gateway/static/root/assets/messages-DP6tPKk-.js +0 -3
  319. package/dist/gateway/static/root/assets/notes-workbench-DSh3-hMY.js +0 -4
  320. package/dist/gateway/static/root/assets/product-delivery-BTRT9kCS.js +0 -1
  321. package/dist/gateway/static/root/assets/project-detail-page-D0QPRHR_.js +0 -1
  322. package/dist/gateway/static/root/assets/projects-page-CI5Vz62F.js +0 -1
  323. package/dist/gateway/static/root/assets/remote-access-hub-S1jpzBS5.js +0 -1
  324. package/dist/gateway/static/root/assets/sessions-page-CTm66k7h.js +0 -1
  325. package/dist/gateway/static/root/assets/settings-advanced-gate-CU52AUVD.js +0 -1
  326. package/dist/gateway/static/root/assets/shares-settings-DK6XK95e.js +0 -1
  327. package/dist/gateway/static/root/assets/skill-reload-api-Bvv_u4ii.js +0 -1
  328. package/dist/gateway/static/root/assets/skills-page-BGHvVbay.js +0 -2
  329. package/dist/gateway/static/root/assets/time-picker-XwpxdZFr.js +0 -1
  330. package/dist/gateway/static/root/assets/user-context-page-DBCMk-Vn.js +0 -1
  331. package/dist/gateway/static/root/assets/work-discovery-page-C1UIdsCl.js +0 -1
  332. package/dist/gateway/static/root/assets/work-item-detail-page-DEAQepB8.js +0 -1
  333. package/dist/gateway/static/root/assets/work-page-D5qYmCTq.js +0 -3
  334. package/dist/gateway/static/root/assets/workflows-page-yrK17ZZ5.js +0 -11
  335. package/dist/src/agent/outcomes/task-verifier.d.ts +0 -29
  336. package/dist/src/gateway/hono/routes/task-outcomes.d.ts +0 -3
  337. package/dist/src/gateway/hono/routes/task-outcomes.js +0 -109
  338. package/dist/src/goals/goal-contract-draft.d.ts +0 -15
  339. package/dist/src/goals/goal-contract-draft.js +0 -112
  340. package/dist/src/goals/goal-evidence-review.d.ts +0 -15
  341. package/dist/src/goals/goal-evidence-review.js +0 -89
  342. package/dist/src/storage/sqlite/task-outcome-repository.d.ts +0 -90
  343. package/dist/src/storage/sqlite/task-outcome-repository.js +0 -138
@@ -1,407 +1,14 @@
1
- import { acknowledgeHomeAttention, isHomeAttentionAcknowledged } from "../../../storage/sqlite/home-attention-repository.js";
2
- import { decideConnectorApproval, listConnectorApprovals } from "../../../storage/sqlite/connector-repository.js";
1
+ import { acknowledgeHomeAttention } from "../../../storage/sqlite/home-attention-repository.js";
2
+ import { decideConnectorApproval } from "../../../storage/sqlite/connector-repository.js";
3
3
  import "../../../storage/sqlite/index.js";
4
- import { GoalService } from "../../../goals/goal-service.js";
5
- import "../../../goals/index.js";
6
- import "../../../automations/domain/defaults.js";
7
- import "../../../automations/index.js";
8
4
  import { listGatewayAgents } from "../../agents-admin.js";
9
- import { WorkItemService } from "../../../work-items/work-item-service.js";
10
- import "../../../work-items/index.js";
11
- import { getTunnelService } from "../../../tunnel/tunnel-service.js";
12
- import "../../../tunnel/index.js";
5
+ import { WorkHomeQueryService, buildHomeBriefing } from "../../../work/home-query-service.js";
13
6
  //#region src/gateway/hono/routes/home.ts
14
- function workItemAttentionRank(item, nowMs) {
15
- if (item.status === "needs_input" || item.status === "in_review" || item.status === "blocked") return 0;
16
- if (item.dueAt != null && item.dueAt < nowMs) return 1;
17
- if (item.dueAt != null && item.dueAt < nowMs + 1440 * 60 * 1e3) return 2;
18
- if (item.priority === "urgent") return 3;
19
- return 4;
20
- }
21
- function toHomeWorkItem(item, projectName) {
22
- return {
23
- id: item.id,
24
- projectId: item.projectId,
25
- projectName,
26
- title: item.title,
27
- status: item.status,
28
- priority: item.priority,
29
- nextAction: item.nextAction,
30
- blockedReason: item.blockedReason,
31
- dueAt: item.dueAt,
32
- completedAt: item.completedAt,
33
- updatedAt: item.updatedAt
34
- };
35
- }
36
- function toHomeWorkflowRun(run) {
37
- return {
38
- id: run.id,
39
- definitionId: run.definitionId,
40
- title: run.title,
41
- status: run.status,
42
- sessionKey: run.metadata?.sessionKey,
43
- createdAtMs: run.createdAtMs,
44
- startedAtMs: run.startedAtMs,
45
- completedAtMs: run.completedAtMs,
46
- metrics: run.metrics
47
- };
48
- }
49
- function triggerLabel(automation) {
50
- const trigger = automation.trigger;
51
- if (trigger.kind === "manual") return "manual";
52
- if (trigger.kind === "webhook") return "webhook";
53
- if (trigger.kind === "event") return `event:${trigger.eventType}`;
54
- const schedule = trigger.schedule;
55
- if (schedule.kind === "once") return schedule.at;
56
- if (schedule.kind === "interval") return `every ${Math.round(schedule.everyMs / 6e4)} minutes`;
57
- return schedule.expr;
58
- }
59
- function actionLabel(automation) {
60
- if (automation.action.kind === "workflow") return `workflow:${automation.action.workflowId}`;
61
- if (automation.action.kind === "browser_recipe") return `browser-workflow:${automation.action.recipeId}`;
62
- return automation.action.agentId ? `agent:${automation.action.agentId}` : "agent";
63
- }
64
- function toHomeAutomation(automation) {
65
- if (!automation.enabled || !automation.state.nextRunAtMs) return null;
66
- return {
67
- id: automation.id,
68
- name: automation.name,
69
- trigger: triggerLabel(automation),
70
- action: actionLabel(automation),
71
- nextRunAt: new Date(automation.state.nextRunAtMs).toISOString()
72
- };
73
- }
74
- function toHomeAutomationRun(run) {
75
- return {
76
- id: run.id,
77
- automationId: run.automationId,
78
- automationName: run.automationName,
79
- status: run.status,
80
- createdAtMs: run.createdAtMs,
81
- startedAtMs: run.startedAtMs,
82
- endedAtMs: run.endedAtMs,
83
- error: run.error,
84
- summary: run.summary,
85
- sessionKey: run.sessionKey,
86
- workflowRunId: run.workflowRunId
87
- };
88
- }
89
- function effectiveAutomationTimeoutSeconds(run, automation) {
90
- return run.actionSnapshot.timeoutSeconds ?? automation?.reliability?.timeoutSeconds ?? 300;
91
- }
92
- function attentionDetail(kind, status, locale, timeoutSeconds) {
93
- const isChinese = locale?.toLowerCase().startsWith("zh") ?? false;
94
- if (status === "timeout") {
95
- const seconds = timeoutSeconds ?? 300;
96
- const duration = seconds % 60 === 0 ? `${seconds / 60} ${isChinese ? "分钟" : seconds === 60 ? "minute" : "minutes"}` : `${seconds} ${isChinese ? "秒" : seconds === 1 ? "second" : "seconds"}`;
97
- return isChinese ? `运行超过 ${duration},系统已停止本次执行。` : `The run exceeded ${duration} and was stopped.`;
98
- }
99
- if (isChinese) return kind === "automation_run" ? "自动化未能完成,请查看详情后重试。" : "工作流未能完成,请查看详情后重试。";
100
- return kind === "automation_run" ? "The automation did not complete. Review the details and retry." : "The workflow did not complete. Review the details and retry.";
101
- }
102
- function decisionFromGoal(goal, projectName) {
103
- if (goal.status !== "needs_input" && goal.status !== "blocked") return null;
104
- return {
105
- id: `goal:${goal.id}`,
106
- kind: "goal",
107
- title: goal.title,
108
- detail: goal.blockedReason || goal.nextAction,
109
- reason: goal.status,
110
- urgency: "now",
111
- href: `/goals/${encodeURIComponent(goal.id)}`,
112
- projectId: goal.projectId,
113
- projectName,
114
- updatedAt: goal.updatedAt
115
- };
116
- }
117
- function decisionFromWorkItem(item, projectName, nowMs) {
118
- let reason;
119
- let urgency = "now";
120
- if (item.status === "needs_input" || item.status === "in_review" || item.status === "blocked") reason = item.status;
121
- else if (item.dueAt != null && item.dueAt < nowMs) reason = "overdue";
122
- else if (item.dueAt != null && item.dueAt < nowMs + 1440 * 60 * 1e3) {
123
- reason = "due_soon";
124
- urgency = "soon";
125
- }
126
- if (!reason) return null;
127
- return {
128
- id: `work:${item.id}`,
129
- kind: "work_item",
130
- title: item.title,
131
- detail: item.blockedReason || item.nextAction,
132
- reason,
133
- urgency,
134
- href: `/work-items/${encodeURIComponent(item.id)}`,
135
- projectId: item.projectId,
136
- projectName,
137
- updatedAt: item.updatedAt
138
- };
139
- }
140
- function buildHomeBriefing(input) {
141
- const isChinese = input.locale?.toLowerCase().startsWith("zh") ?? false;
142
- const movingCount = input.activeWorkCount + input.activeWorkflowCount + input.activeGoalCount;
143
- const attentionCount = input.decisions.length + input.attention.length;
144
- const summary = attentionCount > 0 ? isChinese ? movingCount > 0 ? `有 ${attentionCount} 件事需要你处理;我正在继续推进 ${movingCount} 件工作。` : `有 ${attentionCount} 件事需要你处理。` : movingCount > 0 ? `${attentionCount} ${attentionCount === 1 ? "item needs" : "items need"} your attention; I’m continuing ${movingCount} in the background.` : `${attentionCount} ${attentionCount === 1 ? "item needs" : "items need"} your attention.` : movingCount > 0 ? isChinese ? `目前没有事情需要你处理;我正在继续推进 ${movingCount} 件工作。` : `Nothing needs you right now; I’m continuing ${movingCount} ${movingCount === 1 ? "item" : "items"} in the background.` : isChinese ? "今天还没有正在推进的事项。把想要的结果交给我,我会从这里开始。" : "Nothing is moving yet today. Hand me an outcome and I’ll take it from here.";
145
- return {
146
- generatedAt: input.nowMs,
147
- summary,
148
- focus: input.decisions.slice(0, 3),
149
- progress: {
150
- activeWorkCount: input.activeWorkCount,
151
- activeWorkflowCount: input.activeWorkflowCount,
152
- activeGoalCount: input.activeGoalCount,
153
- movingCount
154
- },
155
- wins: input.wins.slice(0, 5),
156
- nextScheduled: input.nextScheduled
157
- };
158
- }
159
- /**
160
- * GET /api/home — Aggregated data for the user's cross-project work home.
161
- *
162
- * Returns:
163
- * - recentlyOpened: notes sorted by lastOpenedAt (continue rail)
164
- * - inboxCount: number of notes with status === 'inbox'
165
- * - pendingTasks: task notes where done === false
166
- * - recentSessions: last 5 active AI sessions (threads)
167
- * - activeAgent: default agent identity for this gateway
168
- * - gateway: readiness + public tunnel status
169
- * - workflowRuns: active and recent workflow runs
170
- * - upcomingAutomations: upcoming enabled automations
171
- * - recentAutomationRuns: latest automation executions
172
- */
7
+ /** Register the unified work-home read model and its decision actions. */
173
8
  function registerHomeRoutes(authenticated, deps) {
174
9
  const { service } = deps;
175
- const goals = new GoalService();
176
- authenticated.get("/api/home", async (c) => {
177
- const notes = service.notesServiceInstance;
178
- const sessions = service.sessions;
179
- const agents = await listGatewayAgents(service.currentConfig);
180
- const defaultAgent = agents.agents.find((agent) => agent.id === agents.defaultId) ?? agents.agents[0];
181
- const workflowRunStore = service.createWorkflowRunService().createRunStore(defaultAgent?.id ?? agents.defaultId);
182
- const tunnel = getTunnelService().getStatus();
183
- const health = service.getHealth();
184
- const workItems = new WorkItemService();
185
- const nowMs = Date.now();
186
- const [recentlyOpened, inbox, pendingTasks, recentSessions, workflowRuns, automations, automationRuns, projects, allWorkItems, activeGoals, connectorApprovals] = await Promise.all([
187
- notes.listNotes({
188
- sortBy: "lastOpenedAt",
189
- sortOrder: "desc",
190
- limit: 10
191
- }),
192
- notes.listNotes({
193
- status: "inbox",
194
- limit: 0
195
- }),
196
- notes.listNotes({
197
- pendingTasksOnly: true,
198
- sortBy: "createdAt",
199
- sortOrder: "desc",
200
- limit: 10
201
- }),
202
- sessions.listSessions({
203
- channel: "webchat",
204
- sortBy: "updatedAt",
205
- sortOrder: "desc",
206
- limit: 50
207
- }),
208
- workflowRunStore.listRunSummaries(20),
209
- service.automationServiceInstance.list(),
210
- service.automationServiceInstance.listRuns({ limit: 10 }),
211
- service.projects.list({ limit: 500 }),
212
- Promise.resolve(workItems.listWorkItems({ limit: 100 })),
213
- Promise.resolve(goals.list({
214
- status: [
215
- "active",
216
- "blocked",
217
- "needs_input",
218
- "paused"
219
- ],
220
- limit: 100
221
- })),
222
- Promise.resolve(listConnectorApprovals({
223
- principalId: "local-owner",
224
- status: "pending",
225
- limit: 100
226
- }))
227
- ]);
228
- const projectsById = new Map(projects.items.map((project) => [project.id, project]));
229
- const workChats = recentSessions.items.filter((session) => (session.messageCount ?? 0) > 0).map((session) => ({
230
- key: session.key,
231
- name: session.name || "Conversation",
232
- updatedAt: session.updatedAt,
233
- active: sessions.getActiveRun(session.key).active
234
- }));
235
- const activeWorkItems = allWorkItems.items.filter((item) => item.status !== "done" && item.status !== "cancelled").sort((left, right) => {
236
- return workItemAttentionRank(left, nowMs) - workItemAttentionRank(right, nowMs) || right.updatedAt - left.updatedAt;
237
- });
238
- const attentionWorkItems = activeWorkItems.filter((item) => workItemAttentionRank(item, nowMs) < 4).slice(0, 8).map((item) => toHomeWorkItem(item, projectsById.get(item.projectId)?.name ?? "Project"));
239
- const currentWorkItems = activeWorkItems.slice(0, 30).map((item) => toHomeWorkItem(item, projectsById.get(item.projectId)?.name ?? "Project"));
240
- const recentlyCompletedWorkItems = allWorkItems.items.filter((item) => item.status === "done").sort((left, right) => (right.completedAt ?? right.updatedAt) - (left.completedAt ?? left.updatedAt)).slice(0, 8).map((item) => toHomeWorkItem(item, projectsById.get(item.projectId)?.name ?? "Project"));
241
- const activeWorkflowRuns = workflowRuns.filter((run) => run.status === "queued" || run.status === "running").slice(0, 5).map(toHomeWorkflowRun);
242
- const failedWorkflowRuns = workflowRuns.filter((run) => run.status === "failed" || run.status === "timeout").slice(0, 5).map(toHomeWorkflowRun);
243
- const recentWorkflowRuns = workflowRuns.slice(0, 5).map(toHomeWorkflowRun);
244
- const upcomingAutomations = automations.map(toHomeAutomation).filter((automation) => Boolean(automation)).sort((a, b) => Date.parse(a.nextRunAt) - Date.parse(b.nextRunAt)).slice(0, 5);
245
- const latestAutomationRuns = [...automationRuns].sort((left, right) => right.createdAtMs - left.createdAtMs).filter((run, index, all) => all.findIndex((candidate) => candidate.automationId === run.automationId) === index);
246
- const automationsById = new Map(automations.map((automation) => [automation.id, automation]));
247
- const decisions = [
248
- ...service.proactiveInbox.list({ limit: 20 }).filter((item) => item.status === "unread" || item.status === "read").map((item) => ({
249
- id: `agent-judgment:${item.id}`,
250
- kind: "agent_judgment",
251
- title: item.insight.title,
252
- detail: item.insight.summary,
253
- reason: "decision_needed",
254
- urgency: item.insight.urgency === "critical" || item.insight.urgency === "high" ? "now" : "soon",
255
- href: `/work?judgment=${encodeURIComponent(item.id)}`,
256
- updatedAt: Date.parse(item.updatedAt),
257
- judgment: {
258
- inboxItemId: item.id,
259
- whyNow: item.insight.whyNow,
260
- impact: item.insight.impact,
261
- workDone: item.insight.workDone,
262
- recommendation: item.insight.recommendation,
263
- confidence: item.insight.confidence,
264
- ...item.insight.decision ? { decision: item.insight.decision } : {}
265
- }
266
- })),
267
- ...activeWorkItems.map((item) => decisionFromWorkItem(item, projectsById.get(item.projectId)?.name ?? "Project", nowMs)).filter((item) => Boolean(item)),
268
- ...activeGoals.map((goal) => decisionFromGoal(goal, goal.projectId ? projectsById.get(goal.projectId)?.name : void 0)).filter((item) => Boolean(item)),
269
- ...connectorApprovals.filter((approval) => Date.parse(approval.expiresAt) > nowMs).map((approval) => ({
270
- id: `connector-approval:${approval.id}`,
271
- kind: "connector_approval",
272
- title: approval.actionId,
273
- detail: `${approval.connectorId} · ${approval.scope}`,
274
- reason: "approval_required",
275
- urgency: "now",
276
- href: "/connectors",
277
- updatedAt: Date.parse(approval.createdAt),
278
- response: {
279
- kind: "connector_approval",
280
- approvalId: approval.id
281
- }
282
- })),
283
- ...activeGoals.flatMap((goal) => goal.evidenceRequirements.filter((requirement) => requirement.requiresHumanApproval && requirement.evidenceIds.length > 0 && (requirement.status === "pending" || requirement.status === "ai_verified")).map((requirement) => ({
284
- id: `goal-evidence:${requirement.id}`,
285
- kind: "goal_evidence",
286
- title: goal.title,
287
- detail: requirement.text,
288
- reason: "approval_required",
289
- urgency: "now",
290
- href: `/goals/${encodeURIComponent(goal.id)}`,
291
- projectId: goal.projectId,
292
- projectName: goal.projectId ? projectsById.get(goal.projectId)?.name : void 0,
293
- updatedAt: requirement.updatedAt,
294
- response: {
295
- kind: "goal_evidence",
296
- goalId: goal.id,
297
- requirementId: requirement.id
298
- }
299
- })))
300
- ].sort((left, right) => {
301
- return (left.urgency === "now" ? 0 : 1) - (right.urgency === "now" ? 0 : 1) || right.updatedAt - left.updatedAt;
302
- }).slice(0, 20);
303
- const locale = c.req.query("locale");
304
- const attention = [...failedWorkflowRuns.filter((run) => !isHomeAttentionAcknowledged("workflow_run", run.id)).map((run) => ({
305
- id: `workflow_run:${run.id}`,
306
- kind: "workflow_run",
307
- runId: run.id,
308
- title: run.title,
309
- detail: attentionDetail("workflow_run", run.status === "timeout" ? "timeout" : "failed", locale),
310
- reason: run.status === "timeout" ? "run_timeout" : "run_failed",
311
- href: `/workflows?runId=${encodeURIComponent(run.id)}`,
312
- updatedAt: run.completedAtMs ?? run.startedAtMs ?? run.createdAtMs,
313
- sessionKey: run.sessionKey
314
- })), ...latestAutomationRuns.filter((run) => run.status === "failed" || run.status === "timeout").filter((run) => !isHomeAttentionAcknowledged("automation_run", run.id)).map((run) => ({
315
- id: `automation_run:${run.id}`,
316
- kind: "automation_run",
317
- runId: run.id,
318
- title: run.automationName || run.automationId,
319
- detail: attentionDetail("automation_run", run.status === "timeout" ? "timeout" : "failed", locale, effectiveAutomationTimeoutSeconds(run, automationsById.get(run.automationId))),
320
- reason: run.status === "timeout" ? "run_timeout" : "run_failed",
321
- href: `/automations?run=${encodeURIComponent(run.id)}`,
322
- updatedAt: run.endedAtMs ?? run.startedAtMs ?? run.createdAtMs,
323
- sessionKey: run.sessionKey
324
- }))].sort((left, right) => right.updatedAt - left.updatedAt).slice(0, 10);
325
- const wins = [
326
- ...recentlyCompletedWorkItems.map((item) => ({
327
- id: `work:${item.id}`,
328
- kind: "work_item",
329
- title: item.title,
330
- href: `/work-items/${encodeURIComponent(item.id)}`,
331
- completedAt: item.completedAt ?? item.updatedAt
332
- })),
333
- ...workflowRuns.filter((run) => run.status === "succeeded").map((run) => ({
334
- id: `workflow:${run.id}`,
335
- kind: "workflow_run",
336
- title: run.title,
337
- href: `/workflows?runId=${encodeURIComponent(run.id)}`,
338
- completedAt: run.completedAtMs ?? run.createdAtMs
339
- })),
340
- ...latestAutomationRuns.filter((run) => run.status === "succeeded").map((run) => ({
341
- id: `automation:${run.id}`,
342
- kind: "automation_run",
343
- title: run.automationName || run.automationId,
344
- href: "/automations",
345
- completedAt: run.endedAtMs ?? run.createdAtMs
346
- }))
347
- ].sort((left, right) => right.completedAt - left.completedAt);
348
- const briefing = buildHomeBriefing({
349
- locale,
350
- decisions,
351
- attention,
352
- activeWorkCount: activeWorkItems.filter((item) => item.status === "in_progress").length,
353
- activeWorkflowCount: activeWorkflowRuns.length,
354
- activeGoalCount: activeGoals.filter((goal) => goal.status === "active").length,
355
- wins,
356
- nextScheduled: upcomingAutomations[0],
357
- nowMs
358
- });
359
- return c.json({
360
- recentlyOpened: recentlyOpened.items.filter((n) => n.lastOpenedAt),
361
- inboxCount: inbox.total,
362
- pendingTasks: pendingTasks.items,
363
- pendingTaskCount: pendingTasks.total,
364
- recentSessions: recentSessions.items.slice(0, 5),
365
- activeAgent: defaultAgent ? {
366
- id: defaultAgent.id,
367
- name: defaultAgent.name,
368
- description: defaultAgent.description
369
- } : { id: agents.defaultId },
370
- gateway: {
371
- status: health.status,
372
- ready: health.ready,
373
- httpListening: health.httpListening,
374
- version: health.version,
375
- uptime: health.uptime,
376
- tunnel: {
377
- state: tunnel.state,
378
- publicUrl: tunnel.publicUrl,
379
- connected: tunnel.state === "connected"
380
- }
381
- },
382
- workflowRuns: {
383
- active: activeWorkflowRuns,
384
- recent: recentWorkflowRuns
385
- },
386
- briefing,
387
- decisions,
388
- attention,
389
- chats: {
390
- running: workChats.filter((chat) => chat.active),
391
- recent: workChats.filter((chat) => !chat.active).slice(0, 8)
392
- },
393
- work: {
394
- attentionCount: activeWorkItems.filter((item) => workItemAttentionRank(item, nowMs) < 3).length,
395
- overdueCount: activeWorkItems.filter((item) => item.dueAt != null && item.dueAt < nowMs).length,
396
- todayCount: activeWorkItems.filter((item) => item.dueAt != null && item.dueAt >= nowMs && item.dueAt < nowMs + 1440 * 60 * 1e3).length,
397
- items: attentionWorkItems,
398
- current: currentWorkItems,
399
- recentlyCompleted: recentlyCompletedWorkItems
400
- },
401
- upcomingAutomations,
402
- recentAutomationRuns: automationRuns.slice(0, 5).map(toHomeAutomationRun)
403
- });
404
- });
10
+ const home = new WorkHomeQueryService(service);
11
+ authenticated.get("/api/home", async (c) => c.json(await home.getSnapshot(c.req.query("locale"))));
405
12
  authenticated.post("/api/home/decisions/respond", deps.strictRateLimitMiddleware, async (c) => {
406
13
  const body = await c.req.json().catch(() => ({}));
407
14
  const decision = body.decision === "approve" ? "approve" : body.decision === "deny" ? "deny" : void 0;
@@ -424,29 +31,6 @@ function registerHomeRoutes(authenticated, deps) {
424
31
  status: approval.status
425
32
  });
426
33
  }
427
- if (body.kind === "goal_evidence" && typeof body.goalId === "string" && typeof body.requirementId === "string") {
428
- const goal = goals.get(body.goalId);
429
- const requirement = goal?.evidenceRequirements.find((item) => item.id === body.requirementId);
430
- if (!goal || !requirement) return c.json({
431
- ok: false,
432
- error: "Evidence approval not found"
433
- }, 404);
434
- if (requirement.evidenceIds.length === 0) return c.json({
435
- ok: false,
436
- error: "Evidence is missing"
437
- }, 409);
438
- const updated = goals.reviewEvidenceRequirement({
439
- goalId: goal.id,
440
- requirementId: requirement.id,
441
- status: decision === "approve" ? "approved" : "rejected",
442
- reason: decision === "approve" ? "Approved from the decision inbox." : "Rejected from the decision inbox.",
443
- reviewedBy: "user"
444
- });
445
- return c.json({
446
- ok: true,
447
- status: updated?.status
448
- });
449
- }
450
34
  return c.json({
451
35
  ok: false,
452
36
  error: "Unsupported decision kind"
@@ -487,9 +71,9 @@ function registerHomeRoutes(authenticated, deps) {
487
71
  error: error instanceof Error ? error.message : "Failed to retry automation"
488
72
  }, 400);
489
73
  }
490
- const agentId = (await listGatewayAgents(service.currentConfig)).defaultId;
74
+ const agents = await listGatewayAgents(service.currentConfig);
491
75
  const result = await service.createWorkflowRunService().retryWorkflowRun({
492
- agentId,
76
+ agentId: agents.defaultId,
493
77
  runId
494
78
  });
495
79
  if (result.ok === false) return c.json({
@@ -1,5 +1,6 @@
1
1
  import { registerActivityRoutes } from "./activity.js";
2
2
  import { registerAgentStreamRoutes } from "./agent-stream.js";
3
+ import { registerDiscussionRoutes } from "./discussions.js";
3
4
  import { registerSessionsRoutes } from "./sessions.js";
4
5
  import { registerStatusRoutes } from "./status.js";
5
6
  import { registerMemoryRoutes } from "./memory.js";
@@ -7,11 +8,12 @@ import { registerProjectsRoutes } from "./projects.js";
7
8
  import { registerProjectSkillRoutes } from "./project-skills.js";
8
9
  import { registerSearchRoutes } from "./search.js";
9
10
  import { registerMobileRoutes } from "./mobile.js";
10
- import { registerTaskOutcomeRoutes } from "./task-outcomes.js";
11
+ import { registerExecutionReceiptRoutes } from "./execution-receipts.js";
11
12
  import { registerInteractionStateRoutes } from "./interaction-state.js";
12
13
  import { registerComposerHistoryRoutes } from "./composer-history.js";
13
14
  import { registerLocalAppsRoutes } from "./local-apps.js";
14
15
  import { registerWorkDiscoveryRoutes } from "./work-discovery.js";
16
+ import { registerWorkRoutes } from "./work.js";
15
17
  import { registerProactiveRoutes } from "./proactive.js";
16
18
  import { mountAppLazyRoutePrefixes, registerAuthenticatedLazyRouteFallback } from "./lazy-fallback.js";
17
19
  //#region src/gateway/hono/routes/index.ts
@@ -21,14 +23,16 @@ function registerCoreAuthenticatedRoutes(authenticated, deps) {
21
23
  registerSessionsRoutes(authenticated, deps);
22
24
  registerMemoryRoutes(authenticated, deps);
23
25
  registerActivityRoutes(authenticated, deps);
26
+ registerDiscussionRoutes(authenticated, deps);
24
27
  registerProjectsRoutes(authenticated, deps);
25
28
  registerProjectSkillRoutes(authenticated, deps);
26
29
  registerLocalAppsRoutes(authenticated, deps);
27
30
  registerWorkDiscoveryRoutes(authenticated, deps);
31
+ registerWorkRoutes(authenticated, deps);
28
32
  registerProactiveRoutes(authenticated, deps);
29
33
  registerSearchRoutes(authenticated, deps);
30
34
  registerMobileRoutes(authenticated, deps);
31
- registerTaskOutcomeRoutes(authenticated, deps);
35
+ registerExecutionReceiptRoutes(authenticated, deps);
32
36
  registerInteractionStateRoutes(authenticated, deps);
33
37
  registerComposerHistoryRoutes(authenticated, deps);
34
38
  }
@@ -1,6 +1,6 @@
1
1
  import { setInteractionState } from "../../../storage/sqlite/interaction-state-repository.js";
2
2
  import { LOCAL_USER_ID } from "../../../user-context/owner.js";
3
- import { findTaskOutcomeForAssistant, setTaskOutcomeFeedback } from "../../../storage/sqlite/task-outcome-repository.js";
3
+ import { findExecutionReceiptForAssistant, setExecutionReceiptFeedback } from "../../../storage/sqlite/execution-receipt-repository.js";
4
4
  import { appendMemorySignal, appendMemoryTraceEvent, deleteMemoryRecord, findLatestMemoryInjectTrace, getMemoryRecord, listMemoryRecords, listMemorySignals, listMemoryTraceEvents, searchMemoryRecords, setLatestMemoryInjectFeedback, setMemoryTraceFeedback, summarizeMemoryRecallFeedback, summarizeUserUnderstandingQuality, upsertMemoryRecord } from "../../../storage/sqlite/memory-records-repository.js";
5
5
  import { listKnowledgeSourceChanges, listKnowledgeSourceItems, listKnowledgeSyncRuns } from "../../../storage/sqlite/knowledge-repository.js";
6
6
  import "../../../storage/sqlite/index.js";
@@ -363,7 +363,7 @@ function registerMemoryRoutes(authenticated, deps) {
363
363
  const outcome = body.outcome === "helpful" || body.outcome === "not_helpful" ? body.outcome : void 0;
364
364
  const reason = typeof body.reason === "string" ? body.reason.trim().slice(0, 160) : "";
365
365
  if (!sessionKey || !Number.isFinite(assistantTimestamp) || assistantTimestamp <= 0 || !outcome) return c.json({ error: "sessionKey, assistantTimestamp, and a valid outcome are required" }, 400);
366
- const taskOutcome = setTaskOutcomeFeedback({
366
+ const executionReceipt = setExecutionReceiptFeedback({
367
367
  sessionKey,
368
368
  assistantTimestamp,
369
369
  outcome,
@@ -391,10 +391,10 @@ function registerMemoryRoutes(authenticated, deps) {
391
391
  }
392
392
  });
393
393
  return c.json({
394
- matched: Boolean(taskOutcome),
394
+ matched: Boolean(executionReceipt),
395
395
  attributedRecordCount: trace?.selectedRecordIds.length ?? 0,
396
396
  personalContext: personalContextForTrace(trace),
397
- feedback: taskOutcome?.feedback ?? null,
397
+ feedback: executionReceipt?.feedback ?? null,
398
398
  remediation: trace?.remediation ?? null
399
399
  });
400
400
  });
@@ -402,16 +402,16 @@ function registerMemoryRoutes(authenticated, deps) {
402
402
  const sessionKey = c.req.query("sessionKey")?.trim() ?? "";
403
403
  const assistantTimestamp = Number(c.req.query("assistantTimestamp"));
404
404
  if (!sessionKey || !Number.isFinite(assistantTimestamp) || assistantTimestamp <= 0) return c.json({ error: "sessionKey and assistantTimestamp are required" }, 400);
405
- const taskOutcome = findTaskOutcomeForAssistant(sessionKey, assistantTimestamp);
405
+ const executionReceipt = findExecutionReceiptForAssistant(sessionKey, assistantTimestamp);
406
406
  const trace = findLatestMemoryInjectTrace({
407
407
  sessionKey,
408
408
  beforeMs: assistantTimestamp
409
409
  });
410
410
  return c.json({
411
- matched: Boolean(taskOutcome),
411
+ matched: Boolean(executionReceipt),
412
412
  attributedRecordCount: trace?.selectedRecordIds.length ?? 0,
413
413
  personalContext: personalContextForTrace(trace),
414
- feedback: taskOutcome?.feedback ?? null
414
+ feedback: executionReceipt?.feedback ?? null
415
415
  });
416
416
  });
417
417
  authenticated.post("/api/user-context/signals", async (c) => {
@@ -1,3 +1,4 @@
1
+ import { ObjectLinkService } from "../../../activity/service.js";
1
2
  import { buildSessionKey, init_session_key } from "../../../routing/session-key.js";
2
3
  import { agentExists, getDefaultAgentId, init_resolve_route } from "../../../routing/resolve-route.js";
3
4
  import { createReadStream } from "node:fs";
@@ -61,6 +62,27 @@ function noteThreadName(note) {
61
62
  }
62
63
  function registerNotesRoutes(authenticated, deps) {
63
64
  const { service } = deps;
65
+ const objectLinks = new ObjectLinkService();
66
+ const linkNoteToProject = (note, projectId) => {
67
+ if (!projectId) return;
68
+ const project = service.projects.get(projectId);
69
+ if (!project) return;
70
+ objectLinks.create({
71
+ id: `note:${note.id}:project:${project.id}`,
72
+ from: {
73
+ kind: "note",
74
+ id: note.id,
75
+ title: note.title
76
+ },
77
+ to: {
78
+ kind: "project",
79
+ id: project.id,
80
+ title: project.name
81
+ },
82
+ relation: "belongs_to",
83
+ source: "user"
84
+ });
85
+ };
64
86
  authenticated.post("/api/notes/quick-capture", async (c) => {
65
87
  const body = await c.req.json().catch(() => ({}));
66
88
  const text = typeof body.text === "string" ? body.text.trim() : "";
@@ -75,6 +97,7 @@ function registerNotesRoutes(authenticated, deps) {
75
97
  const status = c.req.query("status");
76
98
  const kind = c.req.query("kind");
77
99
  const tag = c.req.query("tag");
100
+ const projectId = c.req.query("projectId")?.trim();
78
101
  const search = c.req.query("search");
79
102
  const pinnedRaw = c.req.query("pinned");
80
103
  const limitRaw = c.req.query("limit");
@@ -85,6 +108,7 @@ function registerNotesRoutes(authenticated, deps) {
85
108
  status: status && VALID_STATUSES.has(status) ? status : void 0,
86
109
  kind: kind && VALID_KINDS.has(kind) ? kind : void 0,
87
110
  tag: tag || void 0,
111
+ projectId: projectId || void 0,
88
112
  search: search || void 0,
89
113
  pinned: pinnedRaw === "true" ? true : pinnedRaw === "false" ? false : void 0,
90
114
  limit: limitRaw ? parseInt(limitRaw, 10) : void 0,
@@ -106,12 +130,15 @@ function registerNotesRoutes(authenticated, deps) {
106
130
  const kindRaw = typeof body.kind === "string" ? body.kind : void 0;
107
131
  const tagsRaw = typeof body.tags === "string" ? body.tags : void 0;
108
132
  const source = parseCaptureSource(body);
133
+ const projectId = typeof body.projectId === "string" && body.projectId.trim() ? body.projectId.trim() : void 0;
134
+ if (projectId && !service.projects.get(projectId)) return c.json({ error: "Project not found" }, 400);
109
135
  const note = await service.notesServiceInstance.createNote({
110
136
  markdown,
111
137
  kind: kindRaw && VALID_KINDS.has(kindRaw) ? kindRaw : void 0,
112
138
  tags: tagsRaw ? tagsRaw.split(",").map((t) => t.trim()).filter(Boolean) : void 0,
113
139
  capturedVia: source
114
140
  });
141
+ linkNoteToProject(note, projectId);
115
142
  const file = body.file;
116
143
  if (file && typeof file === "object") {
117
144
  let buf = null;
@@ -142,6 +169,8 @@ function registerNotesRoutes(authenticated, deps) {
142
169
  const kindRaw = typeof body.kind === "string" ? body.kind : void 0;
143
170
  const tagsRaw = Array.isArray(body.tags) ? body.tags.filter((t) => typeof t === "string") : void 0;
144
171
  const source = parseCaptureSource(body);
172
+ const projectId = typeof body.projectId === "string" && body.projectId.trim() ? body.projectId.trim() : void 0;
173
+ if (projectId && !service.projects.get(projectId)) return c.json({ error: "Project not found" }, 400);
145
174
  const note = await service.notesServiceInstance.createNote({
146
175
  title,
147
176
  markdown,
@@ -150,6 +179,7 @@ function registerNotesRoutes(authenticated, deps) {
150
179
  capturedVia: source,
151
180
  pinned: body.pinned === true
152
181
  });
182
+ linkNoteToProject(note, projectId);
153
183
  return c.json({ note }, 201);
154
184
  });
155
185
  authenticated.post("/api/notes/sync", async (c) => {