@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
@@ -0,0 +1,66 @@
1
+ //#region src/work/execution-context.ts
2
+ const ORIGINS = new Set([
3
+ "chat",
4
+ "goal",
5
+ "workflow",
6
+ "automation",
7
+ "browser",
8
+ "proactive"
9
+ ]);
10
+ const TRIGGERS = new Set([
11
+ "user",
12
+ "schedule",
13
+ "webhook",
14
+ "proactive",
15
+ "retry"
16
+ ]);
17
+ function optionalString(value) {
18
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
19
+ }
20
+ function metadataOrigin(metadata) {
21
+ const explicit = optionalString(metadata.customData?.origin);
22
+ if (explicit && ORIGINS.has(explicit)) return explicit;
23
+ if (optionalString(metadata.customData?.goalId)) return "goal";
24
+ if (metadata.sessionType === "workflow-run" || metadata.sessionType === "workflow-subagent") return "workflow";
25
+ if (metadata.sessionType === "cron") return "automation";
26
+ if (metadata.sessionType === "heartbeat") return "proactive";
27
+ if (optionalString(metadata.customData?.browserRecipeId)) return "browser";
28
+ return "chat";
29
+ }
30
+ function metadataTrigger(metadata) {
31
+ const explicit = optionalString(metadata.customData?.triggerKind);
32
+ if (explicit && TRIGGERS.has(explicit)) return explicit;
33
+ if (metadata.sessionType === "cron") return "schedule";
34
+ if (metadata.sessionType === "heartbeat") return "proactive";
35
+ return "user";
36
+ }
37
+ function resolveExecutionContext(input) {
38
+ return {
39
+ runId: input.runId,
40
+ sessionKey: input.sessionKey,
41
+ channel: input.channel,
42
+ agentId: input.agentId,
43
+ projectId: input.metadata.projectId,
44
+ outcomeId: optionalString(input.metadata.customData?.outcomeId),
45
+ goalId: optionalString(input.metadata.customData?.goalId),
46
+ workItemId: optionalString(input.metadata.customData?.workItemId),
47
+ origin: metadataOrigin(input.metadata),
48
+ triggerKind: metadataTrigger(input.metadata),
49
+ parentRunId: optionalString(input.metadata.customData?.parentRunId),
50
+ contextTraceId: optionalString(input.metadata.customData?.contextTraceId)
51
+ };
52
+ }
53
+ function executionReceiptContext(context) {
54
+ return {
55
+ outcomeId: context.outcomeId,
56
+ projectId: context.projectId,
57
+ goalId: context.goalId,
58
+ workItemId: context.workItemId,
59
+ origin: context.origin,
60
+ triggerKind: context.triggerKind,
61
+ parentRunId: context.parentRunId,
62
+ contextTraceId: context.contextTraceId
63
+ };
64
+ }
65
+ //#endregion
66
+ export { executionReceiptContext, resolveExecutionContext };
@@ -0,0 +1,118 @@
1
+ import type { WorkHomeResponse } from '@xopcai/gateway-contract';
2
+ import type { GatewayService } from '../gateway/service.js';
3
+ import { type AutomationRun } from '../automations/index.js';
4
+ type HomeDecision = WorkHomeResponse['decisions'][number];
5
+ type HomeAttention = WorkHomeResponse['attention'][number];
6
+ type HomeBriefingWin = WorkHomeResponse['briefing']['wins'][number];
7
+ type HomeAutomation = WorkHomeResponse['upcomingAutomations'][number];
8
+ type HomeAutomationRun = {
9
+ id: string;
10
+ automationId: string;
11
+ automationName?: string;
12
+ status: AutomationRun['status'];
13
+ createdAtMs: number;
14
+ startedAtMs?: number;
15
+ endedAtMs?: number;
16
+ error?: string;
17
+ summary?: string;
18
+ sessionKey?: string;
19
+ workflowRunId?: string;
20
+ };
21
+ type HomeSnapshot = WorkHomeResponse & {
22
+ recentlyOpened: unknown[];
23
+ inboxCount: number;
24
+ pendingTasks: unknown[];
25
+ pendingTaskCount: number;
26
+ recentSessions: unknown[];
27
+ activeAgent: {
28
+ id: string;
29
+ name?: string;
30
+ description?: string;
31
+ };
32
+ gateway: Record<string, unknown>;
33
+ recentAutomationRuns: HomeAutomationRun[];
34
+ };
35
+ export declare function workItemAttentionRank(item: {
36
+ status: string;
37
+ dueAt?: number;
38
+ priority: string;
39
+ updatedAt: number;
40
+ }, nowMs: number): number;
41
+ export declare function buildHomeBriefing(input: {
42
+ locale?: string;
43
+ decisions: HomeDecision[];
44
+ attention: HomeAttention[];
45
+ activeWorkCount: number;
46
+ activeWorkflowCount: number;
47
+ activeGoalCount: number;
48
+ wins: HomeBriefingWin[];
49
+ nextScheduled?: HomeAutomation;
50
+ nowMs: number;
51
+ }): {
52
+ generatedAt: number;
53
+ summary: string;
54
+ focus: {
55
+ id: string;
56
+ kind: "work_item" | "goal" | "agent_judgment" | "connector_approval" | "goal_evidence";
57
+ title: string;
58
+ reason: "approval_required" | "blocked" | "needs_input" | "in_review" | "overdue" | "due_soon" | "decision_needed";
59
+ urgency: "now" | "soon";
60
+ href: string;
61
+ updatedAt: number;
62
+ detail?: string;
63
+ projectId?: string;
64
+ projectName?: string;
65
+ judgment?: {
66
+ inboxItemId: string;
67
+ whyNow: string;
68
+ impact: string;
69
+ workDone: string;
70
+ recommendation: string;
71
+ confidence: number;
72
+ valueScore?: number;
73
+ decision?: {
74
+ question: string;
75
+ options: {
76
+ id: string;
77
+ label: string;
78
+ consequence: string;
79
+ }[];
80
+ };
81
+ };
82
+ response?: {
83
+ kind: "connector_approval";
84
+ approvalId: string;
85
+ } | {
86
+ kind: "goal_evidence";
87
+ goalId: string;
88
+ requirementId: string;
89
+ };
90
+ }[];
91
+ progress: {
92
+ activeWorkCount: number;
93
+ activeWorkflowCount: number;
94
+ activeGoalCount: number;
95
+ movingCount: number;
96
+ };
97
+ wins: {
98
+ id: string;
99
+ kind: "work_item" | "workflow_run" | "automation_run";
100
+ title: string;
101
+ href: string;
102
+ completedAt: number;
103
+ }[];
104
+ nextScheduled: {
105
+ id: string;
106
+ trigger: string;
107
+ action: string;
108
+ nextRunAt: string;
109
+ name?: string;
110
+ };
111
+ };
112
+ export declare class WorkHomeQueryService {
113
+ #private;
114
+ private readonly service;
115
+ constructor(service: GatewayService);
116
+ getSnapshot(locale?: string): Promise<HomeSnapshot>;
117
+ }
118
+ export {};
@@ -0,0 +1,389 @@
1
+ import { isHomeAttentionAcknowledged } from "../storage/sqlite/home-attention-repository.js";
2
+ import { getRelationshipSettings } from "../storage/sqlite/relationship-settings-repository.js";
3
+ import { listConnectorApprovals } from "../storage/sqlite/connector-repository.js";
4
+ import "../storage/sqlite/index.js";
5
+ import { GoalService } from "../goals/goal-service.js";
6
+ import { OutcomeRepository } from "./outcome-repository.js";
7
+ import "../goals/index.js";
8
+ import { AttentionGovernor } from "./attention-governor.js";
9
+ import { listGatewayAgents } from "../gateway/agents-admin.js";
10
+ import { getTunnelService } from "../tunnel/tunnel-service.js";
11
+ import "../tunnel/index.js";
12
+ import "../automations/domain/defaults.js";
13
+ import "../automations/index.js";
14
+ import { WorkItemService } from "../work-items/work-item-service.js";
15
+ import "../work-items/index.js";
16
+ import { OutcomeReceiptService } from "./outcome-receipt-service.js";
17
+ //#region src/work/home-query-service.ts
18
+ function workItemAttentionRank(item, nowMs) {
19
+ if (item.status === "needs_input" || item.status === "in_review" || item.status === "blocked") return 0;
20
+ if (item.dueAt != null && item.dueAt < nowMs) return 1;
21
+ if (item.dueAt != null && item.dueAt < nowMs + 1440 * 60 * 1e3) return 2;
22
+ if (item.priority === "urgent") return 3;
23
+ return 4;
24
+ }
25
+ function toHomeWorkItem(item, projectName) {
26
+ return {
27
+ ...item,
28
+ projectName
29
+ };
30
+ }
31
+ function toHomeWorkflowRun(run) {
32
+ return {
33
+ id: run.id,
34
+ definitionId: run.definitionId,
35
+ title: run.title,
36
+ status: run.status,
37
+ sessionKey: run.metadata?.sessionKey,
38
+ createdAtMs: run.createdAtMs,
39
+ startedAtMs: run.startedAtMs,
40
+ completedAtMs: run.completedAtMs,
41
+ metrics: run.metrics
42
+ };
43
+ }
44
+ function triggerLabel(automation) {
45
+ const trigger = automation.trigger;
46
+ if (trigger.kind === "manual") return "manual";
47
+ if (trigger.kind === "webhook") return "webhook";
48
+ if (trigger.kind === "event") return `event:${trigger.eventType}`;
49
+ const schedule = trigger.schedule;
50
+ if (schedule.kind === "once") return schedule.at;
51
+ if (schedule.kind === "interval") return `every ${Math.round(schedule.everyMs / 6e4)} minutes`;
52
+ return schedule.expr;
53
+ }
54
+ function actionLabel(automation) {
55
+ if (automation.action.kind === "workflow") return `workflow:${automation.action.workflowId}`;
56
+ if (automation.action.kind === "browser_recipe") return `browser-workflow:${automation.action.recipeId}`;
57
+ return automation.action.agentId ? `agent:${automation.action.agentId}` : "agent";
58
+ }
59
+ function toHomeAutomation(automation) {
60
+ if (!automation.enabled || !automation.state.nextRunAtMs) return null;
61
+ return {
62
+ id: automation.id,
63
+ name: automation.name,
64
+ trigger: triggerLabel(automation),
65
+ action: actionLabel(automation),
66
+ nextRunAt: new Date(automation.state.nextRunAtMs).toISOString()
67
+ };
68
+ }
69
+ function toHomeAutomationRun(run) {
70
+ return {
71
+ id: run.id,
72
+ automationId: run.automationId,
73
+ automationName: run.automationName,
74
+ status: run.status,
75
+ createdAtMs: run.createdAtMs,
76
+ startedAtMs: run.startedAtMs,
77
+ endedAtMs: run.endedAtMs,
78
+ error: run.error,
79
+ summary: run.summary,
80
+ sessionKey: run.sessionKey,
81
+ workflowRunId: run.workflowRunId
82
+ };
83
+ }
84
+ function effectiveAutomationTimeoutSeconds(run, automation) {
85
+ return run.actionSnapshot.timeoutSeconds ?? automation?.reliability?.timeoutSeconds ?? 300;
86
+ }
87
+ function attentionDetail(kind, status, locale, timeoutSeconds) {
88
+ const isChinese = locale?.toLowerCase().startsWith("zh") ?? false;
89
+ if (status === "timeout") {
90
+ const seconds = timeoutSeconds ?? 300;
91
+ const duration = seconds % 60 === 0 ? `${seconds / 60} ${isChinese ? "分钟" : seconds === 60 ? "minute" : "minutes"}` : `${seconds} ${isChinese ? "秒" : seconds === 1 ? "second" : "seconds"}`;
92
+ return isChinese ? `运行超过 ${duration},系统已停止本次执行。` : `The run exceeded ${duration} and was stopped.`;
93
+ }
94
+ if (isChinese) return kind === "automation_run" ? "自动化未能完成,请查看详情后重试。" : "工作流未能完成,请查看详情后重试。";
95
+ return kind === "automation_run" ? "The automation did not complete. Review the details and retry." : "The workflow did not complete. Review the details and retry.";
96
+ }
97
+ function decisionFromGoal(goal, projectName) {
98
+ if (goal.status !== "needs_input" && goal.status !== "blocked") return null;
99
+ return {
100
+ id: `goal:${goal.id}`,
101
+ kind: "goal",
102
+ title: goal.title,
103
+ detail: goal.blockedReason || goal.nextAction,
104
+ reason: goal.status,
105
+ urgency: "now",
106
+ href: `/goals/${encodeURIComponent(goal.id)}`,
107
+ projectId: goal.projectId,
108
+ projectName,
109
+ updatedAt: goal.updatedAt
110
+ };
111
+ }
112
+ function decisionFromWorkItem(item, projectName, nowMs) {
113
+ let reason;
114
+ let urgency = "now";
115
+ if (item.status === "needs_input" || item.status === "in_review" || item.status === "blocked") reason = item.status;
116
+ else if (item.dueAt != null && item.dueAt < nowMs) reason = "overdue";
117
+ else if (item.dueAt != null && item.dueAt < nowMs + 1440 * 60 * 1e3) {
118
+ reason = "due_soon";
119
+ urgency = "soon";
120
+ }
121
+ if (!reason) return null;
122
+ return {
123
+ id: `work:${item.id}`,
124
+ kind: "work_item",
125
+ title: item.title,
126
+ detail: item.blockedReason || item.nextAction,
127
+ reason,
128
+ urgency,
129
+ href: `/work-items/${encodeURIComponent(item.id)}`,
130
+ projectId: item.projectId,
131
+ projectName,
132
+ updatedAt: item.updatedAt
133
+ };
134
+ }
135
+ function buildHomeBriefing(input) {
136
+ const isChinese = input.locale?.toLowerCase().startsWith("zh") ?? false;
137
+ const movingCount = input.activeWorkCount + input.activeWorkflowCount + input.activeGoalCount;
138
+ const attentionCount = input.decisions.length + input.attention.length;
139
+ 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.";
140
+ return {
141
+ generatedAt: input.nowMs,
142
+ summary,
143
+ focus: input.decisions.slice(0, 3),
144
+ progress: {
145
+ activeWorkCount: input.activeWorkCount,
146
+ activeWorkflowCount: input.activeWorkflowCount,
147
+ activeGoalCount: input.activeGoalCount,
148
+ movingCount
149
+ },
150
+ wins: input.wins.slice(0, 5),
151
+ nextScheduled: input.nextScheduled
152
+ };
153
+ }
154
+ var WorkHomeQueryService = class {
155
+ #goals = new GoalService();
156
+ #receipts = new OutcomeReceiptService();
157
+ #outcomes = new OutcomeRepository();
158
+ #attentionGovernor = new AttentionGovernor();
159
+ constructor(service) {
160
+ this.service = service;
161
+ }
162
+ async getSnapshot(locale) {
163
+ const notes = this.service.notesServiceInstance;
164
+ const sessions = this.service.sessions;
165
+ const agents = await listGatewayAgents(this.service.currentConfig);
166
+ const defaultAgent = agents.agents.find((agent) => agent.id === agents.defaultId) ?? agents.agents[0];
167
+ const workflowRunStore = this.service.createWorkflowRunService().createRunStore(defaultAgent?.id ?? agents.defaultId);
168
+ const tunnel = getTunnelService().getStatus();
169
+ const health = this.service.getHealth();
170
+ const workItems = new WorkItemService();
171
+ const nowMs = Date.now();
172
+ const outcomes = this.#outcomes.list({ limit: 60 });
173
+ const [recentlyOpened, inbox, pendingTasks, recentSessions, workflowRuns, automations, automationRuns, projects, allWorkItems, activeGoals, connectorApprovals] = await Promise.all([
174
+ notes.listNotes({
175
+ sortBy: "lastOpenedAt",
176
+ sortOrder: "desc",
177
+ limit: 10
178
+ }),
179
+ notes.listNotes({
180
+ status: "inbox",
181
+ limit: 0
182
+ }),
183
+ notes.listNotes({
184
+ pendingTasksOnly: true,
185
+ sortBy: "createdAt",
186
+ sortOrder: "desc",
187
+ limit: 10
188
+ }),
189
+ sessions.listSessions({
190
+ channel: "webchat",
191
+ sortBy: "updatedAt",
192
+ sortOrder: "desc",
193
+ limit: 50
194
+ }),
195
+ workflowRunStore.listRunSummaries(20),
196
+ this.service.automationServiceInstance.list(),
197
+ this.service.automationServiceInstance.listRuns({ limit: 10 }),
198
+ this.service.projects.list({ limit: 500 }),
199
+ Promise.resolve(workItems.listWorkItems({ limit: 100 })),
200
+ Promise.resolve(this.#goals.list({
201
+ status: [
202
+ "active",
203
+ "blocked",
204
+ "needs_input",
205
+ "paused"
206
+ ],
207
+ limit: 100
208
+ })),
209
+ Promise.resolve(listConnectorApprovals({
210
+ principalId: "local-owner",
211
+ status: "pending",
212
+ limit: 100
213
+ }))
214
+ ]);
215
+ const projectsById = new Map(projects.items.map((project) => [project.id, project]));
216
+ const workChats = recentSessions.items.filter((session) => (session.messageCount ?? 0) > 0).map((session) => ({
217
+ key: session.key,
218
+ name: session.name || "Conversation",
219
+ updatedAt: session.updatedAt,
220
+ active: sessions.getActiveRun(session.key).active
221
+ }));
222
+ const activeWorkItems = allWorkItems.items.filter((item) => item.status !== "done" && item.status !== "cancelled").sort((left, right) => {
223
+ return workItemAttentionRank(left, nowMs) - workItemAttentionRank(right, nowMs) || right.updatedAt - left.updatedAt;
224
+ });
225
+ const attentionWorkItems = activeWorkItems.filter((item) => workItemAttentionRank(item, nowMs) < 4).slice(0, 8).map((item) => toHomeWorkItem(item, projectsById.get(item.projectId)?.name ?? "Project"));
226
+ const currentWorkItems = activeWorkItems.slice(0, 30).map((item) => toHomeWorkItem(item, projectsById.get(item.projectId)?.name ?? "Project"));
227
+ 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"));
228
+ const activeWorkflowRuns = workflowRuns.filter((run) => run.status === "queued" || run.status === "running").slice(0, 5).map(toHomeWorkflowRun);
229
+ const failedWorkflowRuns = workflowRuns.filter((run) => run.status === "failed" || run.status === "timeout").slice(0, 5).map(toHomeWorkflowRun);
230
+ const recentWorkflowRuns = workflowRuns.slice(0, 5).map(toHomeWorkflowRun);
231
+ const upcomingAutomations = automations.map(toHomeAutomation).filter((automation) => Boolean(automation)).sort((a, b) => Date.parse(a.nextRunAt) - Date.parse(b.nextRunAt)).slice(0, 5);
232
+ const latestAutomationRuns = [...automationRuns].sort((left, right) => right.createdAtMs - left.createdAtMs).filter((run, index, all) => all.findIndex((candidate) => candidate.automationId === run.automationId) === index);
233
+ const automationsById = new Map(automations.map((automation) => [automation.id, automation]));
234
+ const decisionCandidates = [
235
+ ...this.service.proactiveInbox.list({ limit: 20 }).filter((item) => item.status === "unread" || item.status === "read").map((item) => ({
236
+ id: `agent-judgment:${item.id}`,
237
+ kind: "agent_judgment",
238
+ title: item.insight.title,
239
+ detail: item.insight.summary,
240
+ reason: "decision_needed",
241
+ urgency: item.insight.urgency === "critical" || item.insight.urgency === "high" ? "now" : "soon",
242
+ href: `/work?judgment=${encodeURIComponent(item.id)}`,
243
+ updatedAt: Date.parse(item.updatedAt),
244
+ judgment: {
245
+ inboxItemId: item.id,
246
+ whyNow: item.insight.whyNow,
247
+ impact: item.insight.impact,
248
+ workDone: item.insight.workDone,
249
+ recommendation: item.insight.recommendation,
250
+ confidence: item.insight.confidence,
251
+ valueScore: item.insight.valueScore,
252
+ ...item.insight.decision ? { decision: item.insight.decision } : {}
253
+ }
254
+ })),
255
+ ...activeWorkItems.map((item) => decisionFromWorkItem(item, projectsById.get(item.projectId)?.name ?? "Project", nowMs)).filter((item) => Boolean(item)),
256
+ ...activeGoals.map((goal) => decisionFromGoal(goal, goal.projectId ? projectsById.get(goal.projectId)?.name : void 0)).filter((item) => Boolean(item)),
257
+ ...connectorApprovals.filter((approval) => Date.parse(approval.expiresAt) > nowMs).map((approval) => ({
258
+ id: `connector-approval:${approval.id}`,
259
+ kind: "connector_approval",
260
+ title: approval.actionId,
261
+ detail: `${approval.connectorId} · ${approval.scope}`,
262
+ reason: "approval_required",
263
+ urgency: "now",
264
+ href: "/connectors",
265
+ updatedAt: Date.parse(approval.createdAt),
266
+ response: {
267
+ kind: "connector_approval",
268
+ approvalId: approval.id
269
+ }
270
+ }))
271
+ ];
272
+ const attentionCandidates = [...failedWorkflowRuns.filter((run) => !isHomeAttentionAcknowledged("workflow_run", run.id)).map((run) => ({
273
+ id: `workflow_run:${run.id}`,
274
+ kind: "workflow_run",
275
+ runId: run.id,
276
+ title: run.title,
277
+ detail: attentionDetail("workflow_run", run.status === "timeout" ? "timeout" : "failed", locale),
278
+ reason: run.status === "timeout" ? "run_timeout" : "run_failed",
279
+ href: `/workflows?runId=${encodeURIComponent(run.id)}`,
280
+ updatedAt: run.completedAtMs ?? run.startedAtMs ?? run.createdAtMs,
281
+ sessionKey: run.sessionKey
282
+ })), ...latestAutomationRuns.filter((run) => run.status === "failed" || run.status === "timeout").filter((run) => !isHomeAttentionAcknowledged("automation_run", run.id)).map((run) => ({
283
+ id: `automation_run:${run.id}`,
284
+ kind: "automation_run",
285
+ runId: run.id,
286
+ title: run.automationName || run.automationId,
287
+ detail: attentionDetail("automation_run", run.status === "timeout" ? "timeout" : "failed", locale, effectiveAutomationTimeoutSeconds(run, automationsById.get(run.automationId))),
288
+ reason: run.status === "timeout" ? "run_timeout" : "run_failed",
289
+ href: `/automations?run=${encodeURIComponent(run.id)}`,
290
+ updatedAt: run.endedAtMs ?? run.startedAtMs ?? run.createdAtMs,
291
+ sessionKey: run.sessionKey
292
+ }))].sort((left, right) => right.updatedAt - left.updatedAt);
293
+ const governed = this.#attentionGovernor.project({
294
+ decisions: decisionCandidates,
295
+ attention: attentionCandidates,
296
+ proactiveEnabled: getRelationshipSettings().proactiveEnabled
297
+ });
298
+ const decisions = governed.decisions;
299
+ const attention = governed.attention;
300
+ const wins = [
301
+ ...recentlyCompletedWorkItems.map((item) => ({
302
+ id: `work:${item.id}`,
303
+ kind: "work_item",
304
+ title: item.title,
305
+ href: `/work-items/${encodeURIComponent(item.id)}`,
306
+ completedAt: item.completedAt ?? item.updatedAt
307
+ })),
308
+ ...workflowRuns.filter((run) => run.status === "succeeded").map((run) => ({
309
+ id: `workflow:${run.id}`,
310
+ kind: "workflow_run",
311
+ title: run.title,
312
+ href: `/workflows?runId=${encodeURIComponent(run.id)}`,
313
+ completedAt: run.completedAtMs ?? run.createdAtMs
314
+ })),
315
+ ...latestAutomationRuns.filter((run) => run.status === "succeeded").map((run) => ({
316
+ id: `automation:${run.id}`,
317
+ kind: "automation_run",
318
+ title: run.automationName || run.automationId,
319
+ href: "/automations",
320
+ completedAt: run.endedAtMs ?? run.createdAtMs
321
+ }))
322
+ ].sort((left, right) => right.completedAt - left.completedAt);
323
+ const briefing = buildHomeBriefing({
324
+ locale,
325
+ decisions,
326
+ attention,
327
+ activeWorkCount: activeWorkItems.filter((item) => item.status === "in_progress").length,
328
+ activeWorkflowCount: activeWorkflowRuns.length,
329
+ activeGoalCount: activeGoals.filter((goal) => goal.status === "active").length,
330
+ wins,
331
+ nextScheduled: upcomingAutomations[0],
332
+ nowMs
333
+ });
334
+ return {
335
+ recentlyOpened: recentlyOpened.items.filter((note) => note.lastOpenedAt),
336
+ inboxCount: inbox.total,
337
+ pendingTasks: pendingTasks.items,
338
+ pendingTaskCount: pendingTasks.total,
339
+ recentSessions: recentSessions.items.slice(0, 5),
340
+ activeAgent: defaultAgent ? {
341
+ id: defaultAgent.id,
342
+ name: defaultAgent.name,
343
+ description: defaultAgent.description
344
+ } : { id: agents.defaultId },
345
+ gateway: {
346
+ status: health.status,
347
+ ready: health.ready,
348
+ httpListening: health.httpListening,
349
+ version: health.version,
350
+ uptime: health.uptime,
351
+ tunnel: {
352
+ state: tunnel.state,
353
+ publicUrl: tunnel.publicUrl,
354
+ connected: tunnel.state === "connected"
355
+ }
356
+ },
357
+ workflowRuns: {
358
+ active: activeWorkflowRuns,
359
+ recent: recentWorkflowRuns
360
+ },
361
+ briefing,
362
+ decisions,
363
+ attention,
364
+ attentionPolicy: governed.policy,
365
+ chats: {
366
+ running: workChats.filter((chat) => chat.active),
367
+ recent: workChats.filter((chat) => !chat.active).slice(0, 8)
368
+ },
369
+ work: {
370
+ attentionCount: activeWorkItems.filter((item) => workItemAttentionRank(item, nowMs) < 3).length,
371
+ overdueCount: activeWorkItems.filter((item) => item.dueAt != null && item.dueAt < nowMs).length,
372
+ todayCount: activeWorkItems.filter((item) => item.dueAt != null && item.dueAt >= nowMs && item.dueAt < nowMs + 1440 * 60 * 1e3).length,
373
+ items: attentionWorkItems,
374
+ current: currentWorkItems,
375
+ recentlyCompleted: recentlyCompletedWorkItems
376
+ },
377
+ upcomingAutomations,
378
+ outcomes: {
379
+ running: outcomes.filter((outcome) => outcome.userStatus === "running").slice(0, 20),
380
+ needsUser: outcomes.filter((outcome) => outcome.userStatus === "needs_user").slice(0, 20),
381
+ recentlyCompleted: outcomes.filter((outcome) => outcome.userStatus === "completed").slice(0, 10)
382
+ },
383
+ recentOutcomes: this.#receipts.list({ limit: 20 }).filter((receipt) => receipt.status !== "running").slice(0, 8),
384
+ recentAutomationRuns: automationRuns.slice(0, 5).map(toHomeAutomationRun)
385
+ };
386
+ }
387
+ };
388
+ //#endregion
389
+ export { WorkHomeQueryService, buildHomeBriefing, workItemAttentionRank };
@@ -0,0 +1,14 @@
1
+ export * from './execution-context.js';
2
+ export * from './attention-governor.js';
3
+ export * from './home-query-service.js';
4
+ export * from './outcome-receipt-service.js';
5
+ export * from './outcome-projection-service.js';
6
+ export * from './outcome-repository.js';
7
+ export * from './outcome-execution-service.js';
8
+ export * from './outcome-contract-definition.js';
9
+ export * from './outcome-run-coordinator.js';
10
+ export * from './project-operating-view-service.js';
11
+ export * from './project-monitoring-service.js';
12
+ export * from './work-intake-service.js';
13
+ export * from './work-intake-repository.js';
14
+ export * from './work-value-metrics-service.js';
@@ -0,0 +1,15 @@
1
+ import { OutcomeRepository } from "./outcome-repository.js";
2
+ import { executionReceiptContext, resolveExecutionContext } from "./execution-context.js";
3
+ import { AttentionGovernor } from "./attention-governor.js";
4
+ import { OutcomeReceiptService, toOutcomeReceipt } from "./outcome-receipt-service.js";
5
+ import { WorkHomeQueryService, buildHomeBriefing, workItemAttentionRank } from "./home-query-service.js";
6
+ import { EXECUTION_RECEIPT_PROJECTION_VERSION, OutcomeProjectionService } from "./outcome-projection-service.js";
7
+ import { OutcomeExecutionService } from "./outcome-execution-service.js";
8
+ import { defineOutcomeContract } from "./outcome-contract-definition.js";
9
+ import { OutcomeRunCoordinator } from "./outcome-run-coordinator.js";
10
+ import { ProjectMonitoringService, decideProactiveDisposition } from "./project-monitoring-service.js";
11
+ import { ProjectOperatingViewService } from "./project-operating-view-service.js";
12
+ import { WorkIntakeRepository } from "./work-intake-repository.js";
13
+ import { WorkIntakeService } from "./work-intake-service.js";
14
+ import { WorkValueMetricsService } from "./work-value-metrics-service.js";
15
+ export { AttentionGovernor, EXECUTION_RECEIPT_PROJECTION_VERSION, OutcomeExecutionService, OutcomeProjectionService, OutcomeReceiptService, OutcomeRepository, OutcomeRunCoordinator, ProjectMonitoringService, ProjectOperatingViewService, WorkHomeQueryService, WorkIntakeRepository, WorkIntakeService, WorkValueMetricsService, buildHomeBriefing, decideProactiveDisposition, defineOutcomeContract, executionReceiptContext, resolveExecutionContext, toOutcomeReceipt, workItemAttentionRank };
@@ -0,0 +1,8 @@
1
+ export interface OutcomeContractDefinition {
2
+ objective: string;
3
+ deliverables: string[];
4
+ acceptanceCriteria: string[];
5
+ constraints: string[];
6
+ approvalRequired: string[];
7
+ }
8
+ export declare function defineOutcomeContract(objectiveInput: string): OutcomeContractDefinition;
@@ -0,0 +1,15 @@
1
+ //#region src/work/outcome-contract-definition.ts
2
+ function defineOutcomeContract(objectiveInput) {
3
+ const objective = objectiveInput.trim();
4
+ if (!objective) throw new Error("Objective is required");
5
+ const chinese = /[\u3400-\u9fff]/u.test(objective);
6
+ return {
7
+ objective,
8
+ deliverables: [objective],
9
+ acceptanceCriteria: chinese ? [`已交付:${objective}`, "结果有可检查的证据,并满足用户明确提出的约束。"] : [`Delivered: ${objective}`, "The result has inspectable evidence and satisfies the user-provided constraints."],
10
+ constraints: [],
11
+ approvalRequired: []
12
+ };
13
+ }
14
+ //#endregion
15
+ export { defineOutcomeContract };
@@ -0,0 +1,27 @@
1
+ import { type Goal, type GoalPriority, type GoalSource, type GoalUiLocale } from '../goals/index.js';
2
+ export interface CreateOutcomeExecutionInput {
3
+ objective: string;
4
+ description?: string;
5
+ deliverables?: string[];
6
+ acceptanceCriteria?: string[];
7
+ constraints?: string[];
8
+ approvalRequired?: string[];
9
+ projectId?: string;
10
+ sessionKey?: string;
11
+ agentId?: string;
12
+ priority?: GoalPriority;
13
+ deadlineAt?: number;
14
+ judgeModelRef?: string;
15
+ maxTurns?: number;
16
+ uiLocale?: GoalUiLocale;
17
+ source?: GoalSource;
18
+ }
19
+ export interface OutcomeExecution {
20
+ outcomeId: string;
21
+ contractVersion: number;
22
+ goal: Goal;
23
+ }
24
+ export declare class OutcomeExecutionService {
25
+ #private;
26
+ create(input: CreateOutcomeExecutionInput): OutcomeExecution;
27
+ }