@xopcai/xopc 0.0.177 → 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 (353) 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-Wu2ikfbM.js → activity-store-A5FUMjeV.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0_biISn.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-DljBt-N5.js → api-Bmzslx0Z.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-CKoZRi7Y.js → app-management-settings-panel-DDWS_BBJ.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-DOdXhNDo.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-D18gyP76.js → archive-plugin-fvTZhPUr.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-CZh9fc8u.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-DdSyGL6M.js → binary-plugins-CuI2bOc7.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-BOpNApiX.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-C0SnSj_R.js → browser-workflow-inputs-gs6b5e9-.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflows-page-CzlzH7HA.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-RM6S7ES5.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-B4sha-30.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-BPsKIyoM.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-BoZGualI.js → directory-picker-path-field-B6fc_7SL.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dreaming-settings-s3gn3f9h.js → dreaming-settings-CUQxGnDf.js} +3 -3
  30. package/dist/gateway/static/root/assets/{extension-debug-page-DIbMngCF.js → extension-debug-page-AbRNi2ON.js} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-page-D94f2bWQ.js → extension-page-ClYfiLXC.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-settings-page-B7TI13ex.js → extension-settings-page-BGVP2hw1.js} +1 -1
  33. package/dist/gateway/static/root/assets/{gateway-config-api-Do77rV8R.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-WaXTw3fi.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-C3kzg6ai.js → heartbeat-settings-CTI2nPKa.js} +1 -1
  38. package/dist/gateway/static/root/assets/{image-generation-api-BgISY8i-.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-0KSmaPu0.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-BMrU8u7w.js → local-apps-page-CF5uUd1n.js} +1 -1
  44. package/dist/gateway/static/root/assets/{locale-store-DVGhFXRz.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-BVqbtN9o.js → markdown-split-CN85EdB8.js} +1 -1
  47. package/dist/gateway/static/root/assets/{media-plugins-Dr_wtkNJ.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-BWZRXsq6.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-DWWgy0bF.js → page-tabs-tQNQcAts.js} +1 -1
  53. package/dist/gateway/static/root/assets/{preview-open-alternatives-Bnfs93ZP.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-BR7QFmT-.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-BzS-rRTP.js → save-bar-controls-BsPf5Gkk.js} +1 -1
  60. package/dist/gateway/static/root/assets/{schedule-field-Cl2IIDAN.js → schedule-field-kAytH7mq.js} +1 -1
  61. package/dist/gateway/static/root/assets/{schema-form-BjKjp5eZ.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-BSDNBfHn.js → settings-form-section-BqbibcnJ.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BD4peoAv.js → settings-loading-skeleton-DNLNCEGT.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-page-S-P3U7at.js → settings-page-BR6Ss0bK.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-page-layout-BQTLh-86.js → settings-page-layout-Cdb1e2Cz.js} +1 -1
  69. package/dist/gateway/static/root/assets/{setup-status-panel-W3p6kNyA.js → setup-status-panel-moT-D-ia.js} +1 -1
  70. package/dist/gateway/static/root/assets/{share-preview-page-DQjMxyvw.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-CXnpudm6.js → skills-page.utils-BG5dGkyA.js} +1 -1
  75. package/dist/gateway/static/root/assets/{system-settings-panel-BhFwdYJP.js → system-settings-panel-XdY8eyYf.js} +1 -1
  76. package/dist/gateway/static/root/assets/{theme-store-DQI-HPL-.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-C-M3Fv2N.js → typed-models-lib-DOnpwsrE.js} +1 -1
  79. package/dist/gateway/static/root/assets/{use-channel-catalog-Bndq4y4I.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-p_g4UI1-.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-CHEXVvhH.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/embedded/model-runtime.js +3 -0
  99. package/dist/src/agent/embedded/run-for-session.js +18 -5
  100. package/dist/src/agent/embedded/run-turn.js +6 -3
  101. package/dist/src/agent/embedded/types.d.ts +2 -0
  102. package/dist/src/agent/goals/post-turn.js +6 -5
  103. package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
  104. package/dist/src/agent/memory/user-context-coordinator.d.ts +1 -0
  105. package/dist/src/agent/memory/user-context-coordinator.js +17 -1
  106. package/dist/src/agent/outcomes/{task-evaluation.d.ts → execution-evaluation.d.ts} +3 -3
  107. package/dist/src/agent/outcomes/{task-evaluation.js → execution-evaluation.js} +5 -5
  108. package/dist/src/agent/outcomes/execution-verifier.d.ts +29 -0
  109. package/dist/src/agent/outcomes/{task-verifier.js → execution-verifier.js} +4 -4
  110. package/dist/src/agent/service/process-direct-streaming.js +3 -1
  111. package/dist/src/agent/tools/factory.js +16 -1
  112. package/dist/src/agent/tools/goal-tool.js +5 -3
  113. package/dist/src/agent/tools/todo-tool.d.ts +5 -0
  114. package/dist/src/agent/tools/todo-tool.js +16 -4
  115. package/dist/src/agent/tools/update-plan-tool.d.ts +1 -0
  116. package/dist/src/agent/tools/update-plan-tool.js +6 -0
  117. package/dist/src/browser/providers/cloakbrowser.js +2 -2
  118. package/dist/src/channels/attachments/voice-stt-webchat.d.ts +0 -3
  119. package/dist/src/channels/attachments/voice-stt-webchat.js +1 -24
  120. package/dist/src/chat-commands/builtins/goal.js +5 -4
  121. package/dist/src/cli/commands/agents.js +1 -1
  122. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  123. package/dist/src/cli/commands/goal.js +6 -5
  124. package/dist/src/cli/commands/tunnel.js +3 -3
  125. package/dist/src/config/agent-profile.js +1 -1
  126. package/dist/src/connectors/composio-sessions.js +1 -1
  127. package/dist/src/connectors/learning-coordinator.js +7 -1
  128. package/dist/src/connectors/source-change-publisher.d.ts +17 -0
  129. package/dist/src/connectors/source-change-publisher.js +148 -0
  130. package/dist/src/discussions/analyzer.d.ts +35 -0
  131. package/dist/src/discussions/analyzer.js +127 -0
  132. package/dist/src/discussions/index.d.ts +7 -0
  133. package/dist/src/discussions/index.js +7 -0
  134. package/dist/src/discussions/live-worker.d.ts +33 -0
  135. package/dist/src/discussions/live-worker.js +148 -0
  136. package/dist/src/discussions/pipeline.d.ts +33 -0
  137. package/dist/src/discussions/pipeline.js +205 -0
  138. package/dist/src/discussions/project-inference.d.ts +13 -0
  139. package/dist/src/discussions/project-inference.js +19 -0
  140. package/dist/src/discussions/repository.d.ts +29 -0
  141. package/dist/src/discussions/repository.js +255 -0
  142. package/dist/src/discussions/service.d.ts +51 -0
  143. package/dist/src/discussions/service.js +335 -0
  144. package/dist/src/discussions/transcript.d.ts +3 -0
  145. package/dist/src/discussions/transcript.js +15 -0
  146. package/dist/src/discussions/types.d.ts +116 -0
  147. package/dist/src/discussions/types.js +10 -0
  148. package/dist/src/discussions/worker.d.ts +18 -0
  149. package/dist/src/discussions/worker.js +74 -0
  150. package/dist/src/extensions/activation-context.js +2 -1
  151. package/dist/src/extensions/sdk/testing.js +1 -1
  152. package/dist/src/gateway/agents-admin.js +2 -2
  153. package/dist/src/gateway/chat-stream/mapper.js +53 -3
  154. package/dist/src/gateway/chat-stream/protocol.d.ts +17 -1
  155. package/dist/src/gateway/hono/app.js +8 -3
  156. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  157. package/dist/src/gateway/hono/middleware/auth.js +2 -2
  158. package/dist/src/gateway/hono/middleware/logger.js +1 -1
  159. package/dist/src/gateway/hono/middleware/strict-rate-limit.js +1 -1
  160. package/dist/src/gateway/hono/routes/agents.js +1 -1
  161. package/dist/src/gateway/hono/routes/browser-install.js +1 -1
  162. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  163. package/dist/src/gateway/hono/routes/connectors.js +79 -0
  164. package/dist/src/gateway/hono/routes/discussions.d.ts +3 -0
  165. package/dist/src/gateway/hono/routes/discussions.js +177 -0
  166. package/dist/src/gateway/hono/routes/execution-receipts.d.ts +3 -0
  167. package/dist/src/gateway/hono/routes/execution-receipts.js +163 -0
  168. package/dist/src/gateway/hono/routes/exposure.js +1 -1
  169. package/dist/src/gateway/hono/routes/goals.js +3 -288
  170. package/dist/src/gateway/hono/routes/home.d.ts +2 -102
  171. package/dist/src/gateway/hono/routes/home.js +8 -424
  172. package/dist/src/gateway/hono/routes/index.js +6 -2
  173. package/dist/src/gateway/hono/routes/memory.js +7 -7
  174. package/dist/src/gateway/hono/routes/notes.js +30 -0
  175. package/dist/src/gateway/hono/routes/projects.js +8 -152
  176. package/dist/src/gateway/hono/routes/shares.js +1 -1
  177. package/dist/src/gateway/hono/routes/status.js +2 -2
  178. package/dist/src/gateway/hono/routes/tunnel.js +3 -3
  179. package/dist/src/gateway/hono/routes/voice.js +1 -1
  180. package/dist/src/gateway/hono/routes/work.d.ts +3 -0
  181. package/dist/src/gateway/hono/routes/work.js +207 -0
  182. package/dist/src/gateway/hono/routes/you.js +12 -14
  183. package/dist/src/gateway/index.js +2 -2
  184. package/dist/src/gateway/runtime-config.js +2 -2
  185. package/dist/src/gateway/security/audit.js +2 -2
  186. package/dist/src/gateway/security/index.js +1 -1
  187. package/dist/src/gateway/service/config-coordinator.js +1 -1
  188. package/dist/src/gateway/service/run-gateway-agent.js +46 -51
  189. package/dist/src/gateway/service.d.ts +8 -1
  190. package/dist/src/gateway/service.js +139 -12
  191. package/dist/src/goals/goal-queue-store.d.ts +1 -0
  192. package/dist/src/goals/goal-queue-store.js +5 -1
  193. package/dist/src/goals/goal-queue-types.d.ts +11 -1
  194. package/dist/src/goals/goal-runner.js +10 -6
  195. package/dist/src/goals/goal-service.d.ts +2 -15
  196. package/dist/src/goals/goal-service.js +9 -42
  197. package/dist/src/goals/goal-store.d.ts +1 -18
  198. package/dist/src/goals/goal-store.js +25 -231
  199. package/dist/src/goals/index.d.ts +0 -4
  200. package/dist/src/goals/index.js +1 -3
  201. package/dist/src/goals/types.d.ts +4 -66
  202. package/dist/src/notes/agent-context.js +1 -1
  203. package/dist/src/notes/service.d.ts +1 -0
  204. package/dist/src/notes/service.js +9 -0
  205. package/dist/src/notes/types.d.ts +1 -0
  206. package/dist/src/proactive/events/product-event-bridge.d.ts +7 -0
  207. package/dist/src/proactive/events/product-event-bridge.js +84 -0
  208. package/dist/src/proactive/execution/context.d.ts +27 -11
  209. package/dist/src/proactive/execution/context.js +259 -25
  210. package/dist/src/proactive/execution/repository.js +18 -5
  211. package/dist/src/proactive/execution/types.d.ts +7 -1
  212. package/dist/src/proactive/execution/worker.js +7 -6
  213. package/dist/src/proactive/inbox/repository.js +8 -2
  214. package/dist/src/proactive/index.d.ts +4 -2
  215. package/dist/src/proactive/index.js +5 -3
  216. package/dist/src/proactive/temporal/worker.d.ts +16 -0
  217. package/dist/src/proactive/temporal/worker.js +110 -0
  218. package/dist/src/providers/provider-auth-service.js +3 -0
  219. package/dist/src/providers/register-bundled-oauth-flows.d.ts +2 -0
  220. package/dist/src/providers/register-bundled-oauth-flows.js +16 -0
  221. package/dist/src/session/store.d.ts +2 -0
  222. package/dist/src/session/store.js +30 -0
  223. package/dist/src/share/share-zip.js +1 -1
  224. package/dist/src/share/site-proxy.js +1 -1
  225. package/dist/src/storage/sqlite/activity-repository.d.ts +1 -0
  226. package/dist/src/storage/sqlite/activity-repository.js +4 -1
  227. package/dist/src/storage/sqlite/connector-sync-policy-repository.d.ts +20 -0
  228. package/dist/src/storage/sqlite/connector-sync-policy-repository.js +50 -0
  229. package/dist/src/storage/sqlite/execution-receipt-repository.d.ts +146 -0
  230. package/dist/src/storage/sqlite/execution-receipt-repository.js +235 -0
  231. package/dist/src/storage/sqlite/index.d.ts +4 -2
  232. package/dist/src/storage/sqlite/index.js +6 -4
  233. package/dist/src/storage/sqlite/knowledge-repository.d.ts +3 -0
  234. package/dist/src/storage/sqlite/knowledge-repository.js +9 -1
  235. package/dist/src/storage/sqlite/memory-records-repository.js +1 -1
  236. package/dist/src/storage/sqlite/migrations/075_connector_sync_policies.sql +13 -0
  237. package/dist/src/storage/sqlite/migrations/076_meeting_preparation_scenario.sql +29 -0
  238. package/dist/src/storage/sqlite/migrations/077_proactive_insight_fingerprints.sql +4 -0
  239. package/dist/src/storage/sqlite/migrations/078_discussion_captures.sql +64 -0
  240. package/dist/src/storage/sqlite/migrations/079_discussion_follow_up_scenario.sql +29 -0
  241. package/dist/src/storage/sqlite/migrations/080_task_outcome_context.sql +15 -0
  242. package/dist/src/storage/sqlite/migrations/081_project_monitoring_policies.sql +10 -0
  243. package/dist/src/storage/sqlite/migrations/082_one_click_live_discussions.sql +100 -0
  244. package/dist/src/storage/sqlite/migrations/083_session_task_plans.sql +9 -0
  245. package/dist/src/storage/sqlite/migrations/084_work_intake_lifecycle.sql +26 -0
  246. package/dist/src/storage/sqlite/migrations/085_task_outcome_projection.sql +19 -0
  247. package/dist/src/storage/sqlite/migrations/086_outcome_aggregates.sql +168 -0
  248. package/dist/src/storage/sqlite/migrations/087_context_snapshots.sql +21 -0
  249. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  250. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  251. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  252. package/dist/src/storage/sqlite/notes-repository.js +9 -0
  253. package/dist/src/storage/sqlite/schema.js +1 -1
  254. package/dist/src/storage/sqlite/schema.sql +89 -44
  255. package/dist/src/storage/sqlite/session-repository.js +1 -1
  256. package/dist/src/storage/sqlite/session-task-plan-repository.d.ts +20 -0
  257. package/dist/src/storage/sqlite/session-task-plan-repository.js +77 -0
  258. package/dist/src/tui/backends/embedded-backend.js +1 -1
  259. package/dist/src/tunnel/frpc-binary.js +1 -1
  260. package/dist/src/tunnel/frpc-extract.js +1 -1
  261. package/dist/src/tunnel/index.js +2 -2
  262. package/dist/src/user-context/context-compiler.d.ts +31 -0
  263. package/dist/src/user-context/context-compiler.js +51 -0
  264. package/dist/src/voice/local/model-files.js +1 -1
  265. package/dist/src/voice/stt/config.d.ts +4 -0
  266. package/dist/src/voice/stt/config.js +26 -0
  267. package/dist/src/voice/stt/index.d.ts +1 -0
  268. package/dist/src/voice/stt/index.js +2 -1
  269. package/dist/src/voice/stt/list-providers.js +1 -1
  270. package/dist/src/work/attention-governor.d.ts +20 -0
  271. package/dist/src/work/attention-governor.js +46 -0
  272. package/dist/src/work/execution-context.d.ts +16 -0
  273. package/dist/src/work/execution-context.js +66 -0
  274. package/dist/src/work/home-query-service.d.ts +118 -0
  275. package/dist/src/work/home-query-service.js +389 -0
  276. package/dist/src/work/index.d.ts +14 -0
  277. package/dist/src/work/index.js +15 -0
  278. package/dist/src/work/outcome-contract-definition.d.ts +8 -0
  279. package/dist/src/work/outcome-contract-definition.js +15 -0
  280. package/dist/src/work/outcome-execution-service.d.ts +27 -0
  281. package/dist/src/work/outcome-execution-service.js +60 -0
  282. package/dist/src/work/outcome-projection-service.d.ts +7 -0
  283. package/dist/src/work/outcome-projection-service.js +51 -0
  284. package/dist/src/work/outcome-receipt-service.d.ts +13 -0
  285. package/dist/src/work/outcome-receipt-service.js +55 -0
  286. package/dist/src/work/outcome-repository.d.ts +50 -0
  287. package/dist/src/work/outcome-repository.js +112 -0
  288. package/dist/src/work/outcome-run-coordinator.d.ts +25 -0
  289. package/dist/src/work/outcome-run-coordinator.js +117 -0
  290. package/dist/src/work/project-monitoring-service.d.ts +21 -0
  291. package/dist/src/work/project-monitoring-service.js +76 -0
  292. package/dist/src/work/project-operating-view-service.d.ts +10 -0
  293. package/dist/src/work/project-operating-view-service.js +46 -0
  294. package/dist/src/work/work-intake-repository.d.ts +49 -0
  295. package/dist/src/work/work-intake-repository.js +97 -0
  296. package/dist/src/work/work-intake-service.d.ts +26 -0
  297. package/dist/src/work/work-intake-service.js +171 -0
  298. package/dist/src/work/work-value-metrics-service.d.ts +4 -0
  299. package/dist/src/work/work-value-metrics-service.js +88 -0
  300. package/dist/src/work-items/work-item-service.d.ts +0 -2
  301. package/dist/src/work-items/work-item-service.js +0 -28
  302. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  303. package/dist/src/workflows/service/workflow-session-bridge.js +2 -2
  304. package/package.json +3 -11
  305. package/dist/gateway/static/root/assets/agents-TpIpJk59.js +0 -2
  306. package/dist/gateway/static/root/assets/apps-page-Cxbn5hy8.js +0 -1
  307. package/dist/gateway/static/root/assets/automation-suggestion-card-DKrVoiiK.js +0 -1
  308. package/dist/gateway/static/root/assets/automations-page-DYv16QMU.js +0 -6
  309. package/dist/gateway/static/root/assets/browser-settings-page-DlcqaGu1.js +0 -8
  310. package/dist/gateway/static/root/assets/capabilities-settings-panel-QPX4wsGZ.js +0 -7
  311. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DmCeusO8.js +0 -1
  312. package/dist/gateway/static/root/assets/channels-settings-HcKoP1wm.js +0 -1
  313. package/dist/gateway/static/root/assets/channels-status-swr-D3xr2enH.js +0 -1
  314. package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +0 -1
  315. package/dist/gateway/static/root/assets/connectors-page-DwbThFvd.js +0 -2
  316. package/dist/gateway/static/root/assets/desktop-pet-DjL1GWON.js +0 -1
  317. package/dist/gateway/static/root/assets/desktop-pet-settings-u_abAXh7.js +0 -1
  318. package/dist/gateway/static/root/assets/gateway-settings-Dt1PNJmb.js +0 -1
  319. package/dist/gateway/static/root/assets/goal-create-dialog-DEiOOLGU.js +0 -1
  320. package/dist/gateway/static/root/assets/goal-detail-page-C1Qj4o1K.js +0 -4
  321. package/dist/gateway/static/root/assets/goals-config-api-BL0fAEns.js +0 -1
  322. package/dist/gateway/static/root/assets/goals-page-qJDcEDzc.js +0 -2
  323. package/dist/gateway/static/root/assets/goals-settings-DV3ZlrdI.js +0 -1
  324. package/dist/gateway/static/root/assets/index-C1h0zkNo.js +0 -212
  325. package/dist/gateway/static/root/assets/index-Da36E3WH.css +0 -1
  326. package/dist/gateway/static/root/assets/local-app-workbench-page-DcD4mVId.js +0 -2
  327. package/dist/gateway/static/root/assets/logs-page-CW5m9Cov.js +0 -7
  328. package/dist/gateway/static/root/assets/messages-r8L6Ur3A.js +0 -3
  329. package/dist/gateway/static/root/assets/notes-workbench-DdnwNz9x.js +0 -4
  330. package/dist/gateway/static/root/assets/product-delivery-BTRT9kCS.js +0 -1
  331. package/dist/gateway/static/root/assets/project-detail-page-B8GeS4dl.js +0 -1
  332. package/dist/gateway/static/root/assets/projects-page-DOeu1Hk_.js +0 -1
  333. package/dist/gateway/static/root/assets/remote-access-hub-De94rxnE.js +0 -1
  334. package/dist/gateway/static/root/assets/sessions-page-A7p8G0OJ.js +0 -1
  335. package/dist/gateway/static/root/assets/settings-advanced-gate-BsGzjmqx.js +0 -1
  336. package/dist/gateway/static/root/assets/shares-settings-Xo3N99PO.js +0 -1
  337. package/dist/gateway/static/root/assets/skill-reload-api-ByPEG5t1.js +0 -1
  338. package/dist/gateway/static/root/assets/skills-page-C019Ml5q.js +0 -2
  339. package/dist/gateway/static/root/assets/time-picker-C0DCya4U.js +0 -1
  340. package/dist/gateway/static/root/assets/user-context-page-fYBzpus-.js +0 -1
  341. package/dist/gateway/static/root/assets/work-discovery-page-DI0gCZRw.js +0 -1
  342. package/dist/gateway/static/root/assets/work-item-detail-page-DnBRP2wI.js +0 -1
  343. package/dist/gateway/static/root/assets/work-page-Z-nUaS_n.js +0 -3
  344. package/dist/gateway/static/root/assets/workflows-page-BDfwnM-Y.js +0 -11
  345. package/dist/src/agent/outcomes/task-verifier.d.ts +0 -29
  346. package/dist/src/gateway/hono/routes/task-outcomes.d.ts +0 -3
  347. package/dist/src/gateway/hono/routes/task-outcomes.js +0 -109
  348. package/dist/src/goals/goal-contract-draft.d.ts +0 -15
  349. package/dist/src/goals/goal-contract-draft.js +0 -112
  350. package/dist/src/goals/goal-evidence-review.d.ts +0 -15
  351. package/dist/src/goals/goal-evidence-review.js +0 -89
  352. package/dist/src/storage/sqlite/task-outcome-repository.d.ts +0 -90
  353. package/dist/src/storage/sqlite/task-outcome-repository.js +0 -138
@@ -11,7 +11,7 @@
11
11
  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=20260713-1" />
12
12
  <link rel="manifest" href="/site.webmanifest?v=20260713-1" />
13
13
  <title>XOPC — Turn goals into loops. Keep what matters moving.</title>
14
- <script type="module" crossorigin src="/assets/index-C1h0zkNo.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-BDzspHrg.js"></script>
15
15
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-zJ_50EbN.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-BOUWij0V.js">
@@ -22,19 +22,18 @@
22
22
  <link rel="modulepreload" crossorigin href="/assets/vendor-swr-BIWyz7Rc.js">
23
23
  <link rel="modulepreload" crossorigin href="/assets/createLucideIcon-DPHK1VkS.js">
24
24
  <link rel="modulepreload" crossorigin href="/assets/check-DUBLcKHA.js">
25
- <link rel="modulepreload" crossorigin href="/assets/circle-alert-BEjgurr2.js">
26
25
  <link rel="modulepreload" crossorigin href="/assets/middleware-Pd0e8Igk.js">
27
- <link rel="modulepreload" crossorigin href="/assets/messages-r8L6Ur3A.js">
28
- <link rel="modulepreload" crossorigin href="/assets/locale-store-DVGhFXRz.js">
26
+ <link rel="modulepreload" crossorigin href="/assets/messages-DYqBwJAK.js">
27
+ <link rel="modulepreload" crossorigin href="/assets/locale-store-DIVc0AQs.js">
29
28
  <link rel="modulepreload" crossorigin href="/assets/cn-JdwAhgNB.js">
30
- <link rel="modulepreload" crossorigin href="/assets/schemas-DgQq6Z5S.js">
31
- <link rel="modulepreload" crossorigin href="/assets/product-delivery-BTRT9kCS.js">
29
+ <link rel="modulepreload" crossorigin href="/assets/schemas-C6onAggk.js">
30
+ <link rel="modulepreload" crossorigin href="/assets/product-delivery-BVG-eWQO.js">
32
31
  <link rel="modulepreload" crossorigin href="/assets/config-reload-event-Bjh2zoKp.js">
33
32
  <link rel="modulepreload" crossorigin href="/assets/copy-to-clipboard-HOJ79TWv.js">
34
- <link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-WaXTw3fi.js">
35
- <link rel="modulepreload" crossorigin href="/assets/activity-store-Wu2ikfbM.js">
36
- <link rel="modulepreload" crossorigin href="/assets/theme-store-DQI-HPL-.js">
37
- <link rel="stylesheet" crossorigin href="/assets/index-Da36E3WH.css">
33
+ <link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-CKKL96r_.js">
34
+ <link rel="modulepreload" crossorigin href="/assets/activity-store-A5FUMjeV.js">
35
+ <link rel="modulepreload" crossorigin href="/assets/theme-store-DtwI_VLT.js">
36
+ <link rel="stylesheet" crossorigin href="/assets/index-B0Tdge_q.css">
38
37
  </head>
39
38
  <body>
40
39
  <div id="root"></div>
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.0.177";
2
+ var version = "0.0.179";
3
3
  //#endregion
4
4
  export { version };
@@ -0,0 +1,137 @@
1
+ import { z } from "zod";
2
+ //#region packages/gateway-contract/src/outcomes.ts
3
+ const OutcomeUserStatusSchema = z.enum([
4
+ "running",
5
+ "needs_user",
6
+ "completed"
7
+ ]);
8
+ const OutcomeInternalStatusSchema = z.enum([
9
+ "captured",
10
+ "planning",
11
+ "running",
12
+ "verifying",
13
+ "continuing",
14
+ "needs_user",
15
+ "blocked",
16
+ "paused",
17
+ "completed",
18
+ "cancelled"
19
+ ]);
20
+ const OutcomeImportanceSchema = z.enum([
21
+ "low",
22
+ "normal",
23
+ "high",
24
+ "critical"
25
+ ]);
26
+ const OutcomeContractSchema = z.object({
27
+ outcomeId: z.string(),
28
+ version: z.number().int().positive(),
29
+ objective: z.string(),
30
+ deliverables: z.array(z.string()),
31
+ acceptanceCriteria: z.array(z.string()),
32
+ constraints: z.array(z.string()),
33
+ approvalRequired: z.array(z.string()),
34
+ contextSnapshotId: z.string().optional(),
35
+ createdBy: z.enum(["user", "system"]),
36
+ createdAt: z.number()
37
+ });
38
+ const OutcomeSchema = z.object({
39
+ id: z.string(),
40
+ objective: z.string(),
41
+ userStatus: OutcomeUserStatusSchema,
42
+ internalStatus: OutcomeInternalStatusSchema,
43
+ importance: OutcomeImportanceSchema,
44
+ dueAt: z.number().optional(),
45
+ latestContractVersion: z.number().int().positive(),
46
+ latestReceiptRunId: z.string().optional(),
47
+ contract: OutcomeContractSchema.optional(),
48
+ createdAt: z.number(),
49
+ updatedAt: z.number()
50
+ });
51
+ z.object({
52
+ ok: z.literal(true),
53
+ items: z.array(OutcomeSchema)
54
+ });
55
+ const OutcomeActionSchema = z.enum([
56
+ "run",
57
+ "pause",
58
+ "resume",
59
+ "cancel"
60
+ ]);
61
+ const OutcomeActionRequestSchema = z.object({ action: OutcomeActionSchema });
62
+ const OutcomeReceiptStatusSchema = z.enum([
63
+ "running",
64
+ "completed",
65
+ "partial",
66
+ "needs_user",
67
+ "failed",
68
+ "cancelled"
69
+ ]);
70
+ const OutcomeEvidenceSchema = z.object({
71
+ kind: z.enum([
72
+ "artifact",
73
+ "test",
74
+ "state",
75
+ "source"
76
+ ]),
77
+ title: z.string(),
78
+ summary: z.string(),
79
+ uri: z.string().optional(),
80
+ verifies: z.array(z.string()).optional()
81
+ });
82
+ const OutcomeReceiptSchema = z.object({
83
+ runId: z.string(),
84
+ outcomeId: z.string().optional(),
85
+ contractVersion: z.number().int().positive().optional(),
86
+ sessionKey: z.string(),
87
+ objective: z.string(),
88
+ status: OutcomeReceiptStatusSchema,
89
+ summary: z.string(),
90
+ projectId: z.string().optional(),
91
+ goalId: z.string().optional(),
92
+ workItemId: z.string().optional(),
93
+ origin: z.string().optional(),
94
+ triggerKind: z.string().optional(),
95
+ changes: z.array(OutcomeEvidenceSchema),
96
+ evidence: z.array(OutcomeEvidenceSchema),
97
+ verification: z.object({
98
+ status: z.enum([
99
+ "passed",
100
+ "failed",
101
+ "unverified"
102
+ ]),
103
+ checks: z.array(z.object({
104
+ criterion: z.string(),
105
+ status: z.enum([
106
+ "passed",
107
+ "failed",
108
+ "unverified"
109
+ ]),
110
+ evidenceTitles: z.array(z.string())
111
+ }))
112
+ }),
113
+ remainingWork: z.array(z.string()),
114
+ nextAction: z.string().optional(),
115
+ needsUser: z.boolean(),
116
+ completionVerdict: z.enum([
117
+ "achieved",
118
+ "partial",
119
+ "not_achieved"
120
+ ]).optional(),
121
+ correctionText: z.string().optional(),
122
+ contextTraceId: z.string().optional(),
123
+ startedAt: z.number(),
124
+ completedAt: z.number().optional(),
125
+ feedback: z.object({
126
+ outcome: z.enum(["helpful", "not_helpful"]),
127
+ reason: z.string().optional(),
128
+ needsCorrection: z.boolean().optional(),
129
+ supportFit: z.boolean().optional()
130
+ }).optional()
131
+ });
132
+ z.object({
133
+ ok: z.literal(true),
134
+ items: z.array(OutcomeReceiptSchema)
135
+ });
136
+ //#endregion
137
+ export { OutcomeActionRequestSchema, OutcomeUserStatusSchema };
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  const ProductReferenceKindSchema = z.enum([
3
+ "outcome",
3
4
  "project",
4
5
  "note",
5
6
  "work_item",
@@ -0,0 +1,85 @@
1
+ import { z } from "zod";
2
+ //#region packages/gateway-contract/src/work-intake.ts
3
+ const WorkExecutionModeSchema = z.enum(["create_only", "run_now"]);
4
+ const WorkExecutionStatusSchema = z.enum([
5
+ "not_started",
6
+ "queued",
7
+ "running",
8
+ "retry_waiting",
9
+ "succeeded",
10
+ "failed",
11
+ "skipped"
12
+ ]);
13
+ const MonitoringModeSchema = z.enum([
14
+ "observe",
15
+ "ask_before_action",
16
+ "auto_low_risk"
17
+ ]);
18
+ const QuietHoursSchema = z.object({
19
+ startHour: z.number().int().min(0).max(23),
20
+ endHour: z.number().int().min(0).max(23),
21
+ timezone: z.string().min(1)
22
+ });
23
+ z.object({
24
+ projectId: z.string(),
25
+ mode: MonitoringModeSchema,
26
+ quietHours: QuietHoursSchema.optional(),
27
+ allowedActions: z.array(z.string()),
28
+ confidenceThreshold: z.number().min(0).max(1),
29
+ scenarios: z.array(z.string()),
30
+ configured: z.boolean(),
31
+ updatedAt: z.number().optional()
32
+ });
33
+ const ProjectMonitoringUpdateSchema = z.object({
34
+ mode: MonitoringModeSchema.optional(),
35
+ quietHours: QuietHoursSchema.nullable().optional(),
36
+ allowedActions: z.array(z.string()).optional(),
37
+ confidenceThreshold: z.number().min(0).max(1).optional(),
38
+ scenarios: z.array(z.string()).optional()
39
+ });
40
+ z.object({
41
+ id: z.string(),
42
+ objective: z.string(),
43
+ projectId: z.string().optional(),
44
+ planningContext: z.object({
45
+ supportMode: z.enum([
46
+ "efficient",
47
+ "coach",
48
+ "companion",
49
+ "auto"
50
+ ]),
51
+ proactiveEnabled: z.boolean()
52
+ }),
53
+ outcomeContract: z.object({
54
+ objective: z.string(),
55
+ deliverables: z.array(z.string()),
56
+ acceptanceCriteria: z.array(z.string()),
57
+ constraints: z.array(z.string()),
58
+ approvalRequired: z.array(z.string())
59
+ }),
60
+ expiresAt: z.number()
61
+ });
62
+ const WorkIntakeCreateRequestSchema = z.object({
63
+ idempotencyKey: z.string().min(1).max(200),
64
+ objective: z.string().min(1).max(12e3),
65
+ projectId: z.string().min(1).optional(),
66
+ sessionKey: z.string().min(1).optional(),
67
+ agentId: z.string().min(1).optional()
68
+ });
69
+ const WorkIntakeConfirmRequestSchema = z.object({
70
+ executionMode: WorkExecutionModeSchema,
71
+ projectId: z.string().min(1).optional()
72
+ });
73
+ z.object({
74
+ outcomeId: z.string(),
75
+ projectId: z.string().optional(),
76
+ goalId: z.string(),
77
+ sessionKey: z.string().optional(),
78
+ execution: z.object({
79
+ mode: WorkExecutionModeSchema,
80
+ status: WorkExecutionStatusSchema,
81
+ queueId: z.string().optional()
82
+ })
83
+ });
84
+ //#endregion
85
+ export { ProjectMonitoringUpdateSchema, WorkIntakeConfirmRequestSchema, WorkIntakeCreateRequestSchema };
@@ -9,4 +9,5 @@ export declare class ActivityService {
9
9
  export declare class ObjectLinkService {
10
10
  create(input: CreateObjectLinkInput): ObjectLink;
11
11
  listForObject(object: ActivityObjectRef): ObjectLink[];
12
+ delete(id: string): boolean;
12
13
  }
@@ -1,4 +1,4 @@
1
- import { createObjectLinkRecord, getActivityEventRecord, listActivityRecords, listObjectActivityRecords, listObjectLinkRecords, listProjectActivityRecords, recordActivityEvent } from "../storage/sqlite/activity-repository.js";
1
+ import { createObjectLinkRecord, deleteObjectLinkRecord, getActivityEventRecord, listActivityRecords, listObjectActivityRecords, listObjectLinkRecords, listProjectActivityRecords, recordActivityEvent } from "../storage/sqlite/activity-repository.js";
2
2
  import "../storage/sqlite/index.js";
3
3
  import { randomUUID } from "node:crypto";
4
4
  //#region src/activity/service.ts
@@ -52,6 +52,9 @@ var ObjectLinkService = class {
52
52
  listForObject(object) {
53
53
  return listObjectLinkRecords(object);
54
54
  }
55
+ delete(id) {
56
+ return deleteObjectLinkRecord(id);
57
+ }
55
58
  };
56
59
  //#endregion
57
60
  export { ActivityService, ObjectLinkService };
@@ -9,8 +9,8 @@ import { accessSync, chmodSync, constants, copyFileSync, createReadStream, creat
9
9
  import { execFile } from "node:child_process";
10
10
  import { createHash, randomBytes } from "node:crypto";
11
11
  import { promisify } from "node:util";
12
- import { Readable } from "node:stream";
13
12
  import { pipeline } from "node:stream/promises";
13
+ import { Readable } from "node:stream";
14
14
  import lockfile from "proper-lockfile";
15
15
  //#region src/agent/code-intelligence/binary.ts
16
16
  init_paths();
@@ -6,7 +6,7 @@ export type ExecutionObjective = {
6
6
  status: string;
7
7
  scopeBoundary?: string;
8
8
  acceptanceCriteria: string[];
9
- evidencePlan: string[];
9
+ deliverables: string[];
10
10
  nextAction?: string;
11
11
  blockedReason?: string;
12
12
  } | {
@@ -2,6 +2,7 @@ import { isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
2
2
  import { getSessionMetadata } from "../../storage/sqlite/session-repository.js";
3
3
  import "../../storage/sqlite/index.js";
4
4
  import { GoalService } from "../../goals/goal-service.js";
5
+ import { OutcomeRepository } from "../../work/outcome-repository.js";
5
6
  import "../../goals/index.js";
6
7
  import { sanitizeForPromptLiteral } from "../prompt/sanitize-for-prompt.js";
7
8
  import { buildActiveProjectContextForPrompt } from "./project-context.js";
@@ -14,15 +15,16 @@ function bounded(value, max = MAX_OBJECTIVE_TEXT) {
14
15
  return text.length <= max ? text : `${text.slice(0, max - 1).trimEnd()}…`;
15
16
  }
16
17
  function goalObjective(goal) {
18
+ const contract = new OutcomeRepository().getContract(goal.outcomeId, goal.outcomeContractVersion);
17
19
  return {
18
20
  kind: "goal",
19
21
  id: goal.id,
20
22
  title: goal.title,
21
- objective: goal.contract?.objective?.trim() || goal.title,
23
+ objective: contract?.objective.trim() || goal.title,
22
24
  status: goal.status,
23
- scopeBoundary: bounded(goal.contract?.scopeBoundary),
25
+ scopeBoundary: bounded(contract?.constraints.join("\n")),
24
26
  acceptanceCriteria: goal.checklist.slice(0, MAX_CRITERIA).map((item) => item.text),
25
- evidencePlan: goal.contract?.evidencePlan.slice(0, MAX_CRITERIA) ?? [],
27
+ deliverables: contract?.deliverables.slice(0, MAX_CRITERIA) ?? [],
26
28
  nextAction: bounded(goal.nextAction),
27
29
  blockedReason: bounded(goal.blockedReason)
28
30
  };
@@ -69,7 +71,7 @@ function formatCurrentWorkForPrompt(scope) {
69
71
  if (objective.kind === "goal") {
70
72
  if (objective.scopeBoundary) lines.push("", "## Scope Boundary", sanitizeForPromptLiteral(objective.scopeBoundary));
71
73
  if (objective.acceptanceCriteria.length > 0) lines.push("", "## Acceptance Criteria", ...objective.acceptanceCriteria.map((item) => `- ${sanitizeForPromptLiteral(item)}`));
72
- if (objective.evidencePlan.length > 0) lines.push("", "## Completion Evidence", ...objective.evidencePlan.map((item) => `- ${sanitizeForPromptLiteral(item)}`));
74
+ if (objective.deliverables.length > 0) lines.push("", "## Deliverables", ...objective.deliverables.map((item) => `- ${sanitizeForPromptLiteral(item)}`));
73
75
  if (objective.nextAction) lines.push("", "Next action:", sanitizeForPromptLiteral(objective.nextAction));
74
76
  if (objective.blockedReason) lines.push("", "Blocked reason:", sanitizeForPromptLiteral(objective.blockedReason));
75
77
  }
@@ -2,6 +2,7 @@ import { init_paths, resolveModelsJsonPath } from "../../config/paths.js";
2
2
  import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
3
3
  import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
4
4
  import { XopcModelCredentialStore, init_model_credential_store } from "../../auth/model-credential-store.js";
5
+ import { init_register_bundled_oauth_flows, registerBundledOAuthFlows } from "../../providers/register-bundled-oauth-flows.js";
5
6
  import { init_register_runtime_providers, registerRuntimeProviders } from "../../providers/register-runtime-providers.js";
6
7
  import { getApiKeySync, init_providers } from "../../providers/index.js";
7
8
  import { InMemoryModelsStore } from "@earendil-works/pi-ai";
@@ -12,11 +13,13 @@ init_model_credential_store();
12
13
  init_sync_provider_auth();
13
14
  init_paths();
14
15
  init_providers();
16
+ init_register_bundled_oauth_flows();
15
17
  init_register_runtime_providers();
16
18
  function resolveEmbeddedProviderApiKeySync(providerId) {
17
19
  return resolveProviderApiKeySync(providerId) ?? getApiKeySync(providerId);
18
20
  }
19
21
  async function createEmbeddedModelRuntime(providerId) {
22
+ registerBundledOAuthFlows();
20
23
  const resolver = new CredentialResolver();
21
24
  const credentials = new XopcModelCredentialStore(resolver);
22
25
  const modelRuntime = await ModelRuntime.create({
@@ -91,13 +91,15 @@ async function runEmbeddedTurnForSession(params) {
91
91
  }, "Agent model fallback candidates resolved");
92
92
  let lastResult;
93
93
  let lastError;
94
+ let resumeLastUserMessage = false;
94
95
  const primaryModelRef = modelRef;
95
- const beforeLen = Array.isArray(agent.state?.messages) ? agent.state.messages.length : void 0;
96
96
  for (let i = 0; i < resolvedCandidates.length; i++) {
97
97
  const candidate = resolvedCandidates[i];
98
98
  const candidateModelRef = candidate.ref;
99
99
  const isFallbackAttempt = i > 0;
100
100
  const candidateModel = candidate.model;
101
+ const hasNextCandidate = i + 1 < resolvedCandidates.length;
102
+ const rowsBeforeAttempt = hasNextCandidate ? await sessionStore.loadTranscriptRows(sessionKey) : void 0;
101
103
  if (typeof mm.applyResolvedModel === "function") mm.applyResolvedModel(agent, candidateModel, candidateModelRef);
102
104
  agentManager.setModelForSession(sessionKey, candidateModelRef);
103
105
  if (isFallbackAttempt) log.info({
@@ -123,7 +125,8 @@ async function runEmbeddedTurnForSession(params) {
123
125
  sessionStore,
124
126
  timeoutMs: resolveAgentTurnTimeoutMs(config),
125
127
  abortSignal: params.abortSignal,
126
- onEvent: params.onEvent
128
+ onEvent: params.onEvent,
129
+ resumeLastUserMessage
127
130
  });
128
131
  if (turnResult.ok) {
129
132
  if (isFallbackAttempt) log.info({
@@ -137,7 +140,6 @@ async function runEmbeddedTurnForSession(params) {
137
140
  return turnResult;
138
141
  }
139
142
  lastResult = turnResult;
140
- const hasNextCandidate = i + 1 < resolvedCandidates.length;
141
143
  log.warn({
142
144
  sessionKey,
143
145
  runId,
@@ -150,7 +152,6 @@ async function runEmbeddedTurnForSession(params) {
150
152
  } catch (err) {
151
153
  lastError = err;
152
154
  if (err instanceof DOMException && err.name === "AbortError") throw err;
153
- const hasNextCandidate = i + 1 < resolvedCandidates.length;
154
155
  log.warn({
155
156
  err,
156
157
  sessionKey,
@@ -161,7 +162,19 @@ async function runEmbeddedTurnForSession(params) {
161
162
  hasNextCandidate
162
163
  }, hasNextCandidate ? "Agent model call threw, trying fallback" : "Agent model call threw, no fallback remains");
163
164
  }
164
- if (beforeLen !== void 0 && Array.isArray(agent.state?.messages)) agent.state.messages = agent.state.messages.slice(0, beforeLen);
165
+ if (hasNextCandidate && rowsBeforeAttempt) {
166
+ const preparation = await sessionStore.prepareModelFallback(sessionKey, rowsBeforeAttempt);
167
+ if (preparation === "unsafe") {
168
+ log.warn({
169
+ sessionKey,
170
+ runId,
171
+ modelRef: candidateModelRef,
172
+ attempt: i + 1
173
+ }, "Agent model fallback skipped because the failed attempt changed the transcript");
174
+ break;
175
+ }
176
+ resumeLastUserMessage = preparation === "resume";
177
+ }
165
178
  }
166
179
  if (lastResult) return lastResult;
167
180
  if (lastError instanceof Error) throw lastError;
@@ -206,9 +206,12 @@ async function runXopcEmbeddedTurn(params) {
206
206
  }
207
207
  try {
208
208
  await runAgentTurnWithTimeout(session.agent, async () => {
209
- const text = userMessageToPromptText(userMessage);
210
- const images = params.images ?? [];
211
- await session.prompt(text, images.length > 0 ? { images } : void 0);
209
+ if (params.resumeLastUserMessage) await session.agent.continue();
210
+ else {
211
+ const text = userMessageToPromptText(userMessage);
212
+ const images = params.images ?? [];
213
+ await session.prompt(text, images.length > 0 ? { images } : void 0);
214
+ }
212
215
  await session.agent.waitForIdle();
213
216
  await maybeRetryTurnAfterTransientLlmFailure(session.agent, {
214
217
  sessionKey,
@@ -89,6 +89,8 @@ export type RunXopcEmbeddedTurnParams = {
89
89
  abortSignal?: AbortSignal;
90
90
  onEvent?: (event: EmbeddedStreamEvent) => void;
91
91
  images?: ImageContent[];
92
+ /** Continue from the persisted trailing user row instead of appending it again. */
93
+ resumeLastUserMessage?: boolean;
92
94
  };
93
95
  export type RunXopcEmbeddedTurnResult = {
94
96
  ok: boolean;
@@ -3,6 +3,7 @@ import { init_logger } from "../../utils/logger.js";
3
3
  import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
4
4
  import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
5
5
  import { GoalService } from "../../goals/goal-service.js";
6
+ import { OutcomeRepository } from "../../work/outcome-repository.js";
6
7
  import { resolveGoalUiLocale } from "./goal-locale.js";
7
8
  import { evaluateAfterTurnHermesLike } from "./evaluate-turn.js";
8
9
  import "../../goals/index.js";
@@ -22,9 +23,10 @@ function buildHistoryExcerpt(messages, maxChars) {
22
23
  }
23
24
  }
24
25
  function buildGoalContextText(goal) {
25
- const lines = [`Title: ${goal.contract?.objective || goal.title}`];
26
- if (goal.contract?.scopeBoundary) lines.push(`Scope boundary:\n${goal.contract.scopeBoundary}`);
27
- if (goal.contract?.evidencePlan.length) lines.push(`Expected completion evidence:\n${goal.contract.evidencePlan.map((item) => `- ${item}`).join("\n")}`);
26
+ const contract = new OutcomeRepository().getContract(goal.outcomeId, goal.outcomeContractVersion);
27
+ const lines = [`Outcome: ${contract?.objective ?? goal.title}`];
28
+ if (contract?.constraints.length) lines.push(`Constraints:\n${contract.constraints.map((item) => `- ${item}`).join("\n")}`);
29
+ if (contract?.deliverables.length) lines.push(`Deliverables:\n${contract.deliverables.map((item) => `- ${item}`).join("\n")}`);
28
30
  if (goal.contextMessage?.text.trim()) lines.push(`Context:\n${goal.contextMessage.text.trim()}`);
29
31
  if (goal.contextMessage?.attachments.length) lines.push(["Attachments:", ...goal.contextMessage.attachments.map((attachment) => `- ${attachment.name} (${attachment.mimeType}, ${attachment.size} bytes) ${attachment.uri}`)].join("\n"));
30
32
  return lines.join("\n\n");
@@ -101,8 +103,7 @@ async function handlePersistentGoalPostTurn(opts) {
101
103
  goalContextExcerpt: buildGoalContextText(goal),
102
104
  uiLocale: resolveGoalUiLocale(state)
103
105
  });
104
- const completionReadiness = goalService.getCompletionReadiness(goal.id);
105
- const executionGaps = completionReadiness ? [...completionReadiness.missingEvidence, ...completionReadiness.pendingOutcome] : [];
106
+ const executionGaps = goalService.getCompletionReadiness(goal.id)?.pendingCriteria ?? [];
106
107
  if (decision.verdict === "done" && executionGaps.length > 0 && decision.newState) {
107
108
  const reason = `Completion evidence or outcome still needed: ${executionGaps.join("; ")}`;
108
109
  decision = {
@@ -1,7 +1,7 @@
1
1
  import { killProcessTree } from "../../process/kill-tree.js";
2
2
  import { spawn } from "node:child_process";
3
- import process from "node:process";
4
3
  import { PassThrough } from "node:stream";
4
+ import process from "node:process";
5
5
  import { getDefaultEnvironment } from "@modelcontextprotocol/sdk/client/stdio.js";
6
6
  import { ReadBuffer, serializeMessage } from "@modelcontextprotocol/sdk/shared/stdio.js";
7
7
  //#region src/agent/mcp/mcp-stdio-transport.ts
@@ -14,6 +14,7 @@ export declare class UserContextCoordinator {
14
14
  private readonly userTurn;
15
15
  private readonly correctionTargets;
16
16
  private readonly planner;
17
+ private readonly contextCompiler;
17
18
  constructor(options: UserContextCoordinatorOptions);
18
19
  forgetSession(sessionKey: string): void;
19
20
  clear(): void;
@@ -2,6 +2,7 @@ import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
3
  import { setLatestMemoryInjectFeedback } from "../../storage/sqlite/memory-records-repository.js";
4
4
  import "../../storage/sqlite/index.js";
5
+ import { ContextCompiler } from "../../user-context/context-compiler.js";
5
6
  import { shouldPlanUserContextThisTurn } from "./memory-config.js";
6
7
  import { UserContextPlanner } from "./context/planner.js";
7
8
  import { isExplicitUnderstandingCorrection } from "./understanding/correction.js";
@@ -13,6 +14,7 @@ var UserContextCoordinator = class {
13
14
  userTurn = /* @__PURE__ */ new Map();
14
15
  correctionTargets = /* @__PURE__ */ new Map();
15
16
  planner = new UserContextPlanner();
17
+ contextCompiler = new ContextCompiler();
16
18
  constructor(options) {
17
19
  this.options = options;
18
20
  }
@@ -61,7 +63,7 @@ var UserContextCoordinator = class {
61
63
  const turn = (this.userTurn.get(sessionKey) ?? 0) + 1;
62
64
  this.userTurn.set(sessionKey, turn);
63
65
  if (!shouldPlanUserContextThisTurn(config, turn)) return empty();
64
- return this.planner.plan({
66
+ const plan = await this.planner.plan({
65
67
  memoryManager: this.options.getMemoryManagerForSession(sessionKey),
66
68
  agentId: this.options.getAgentIdForSession(sessionKey),
67
69
  sessionKey,
@@ -69,6 +71,20 @@ var UserContextCoordinator = class {
69
71
  userMessage,
70
72
  excludedRecordIds
71
73
  });
74
+ if (plan.traceId) try {
75
+ this.contextCompiler.capture({
76
+ sessionKey,
77
+ query,
78
+ plan
79
+ });
80
+ } catch (err) {
81
+ log.debug({
82
+ err,
83
+ sessionKey,
84
+ traceId: plan.traceId
85
+ }, "Context snapshot was not persisted");
86
+ }
87
+ return plan;
72
88
  }
73
89
  async afterTurn(sessionKey, userPlainText) {
74
90
  if (!this.options.isEnabledForSession(sessionKey)) return void 0;
@@ -1,5 +1,5 @@
1
- import type { TaskOutcome } from '../../storage/sqlite/task-outcome-repository.js';
2
- export interface TaskEvaluationReplay {
1
+ import type { ExecutionReceipt } from '../../storage/sqlite/execution-receipt-repository.js';
2
+ export interface ExecutionEvaluationReplay {
3
3
  total: number;
4
4
  falseCompletions: number;
5
5
  verificationDrift: number;
@@ -17,4 +17,4 @@ export interface TaskEvaluationReplay {
17
17
  replayedVerification: string;
18
18
  }>;
19
19
  }
20
- export declare function replayTaskEvaluation(outcomes: TaskOutcome[]): TaskEvaluationReplay;
20
+ export declare function replayExecutionEvaluation(outcomes: ExecutionReceipt[]): ExecutionEvaluationReplay;
@@ -1,13 +1,13 @@
1
- import { verifyTaskCompletion } from "./task-verifier.js";
2
- //#region src/agent/outcomes/task-evaluation.ts
3
- function replayTaskEvaluation(outcomes) {
1
+ import { verifyExecutionCompletion } from "./execution-verifier.js";
2
+ //#region src/agent/outcomes/execution-evaluation.ts
3
+ function replayExecutionEvaluation(outcomes) {
4
4
  const completed = outcomes.filter((outcome) => outcome.status !== "running");
5
5
  const byChannel = {};
6
6
  const cases = [];
7
7
  let falseCompletions = 0;
8
8
  let supportMismatches = 0;
9
9
  for (const outcome of completed) {
10
- const replayed = verifyTaskCompletion({
10
+ const replayed = verifyExecutionCompletion({
11
11
  status: outcome.status,
12
12
  acceptanceCriteria: outcome.contract?.acceptanceCriteria ?? [],
13
13
  evidence: outcome.evidence
@@ -45,4 +45,4 @@ function replayTaskEvaluation(outcomes) {
45
45
  };
46
46
  }
47
47
  //#endregion
48
- export { replayTaskEvaluation };
48
+ export { replayExecutionEvaluation };
@@ -0,0 +1,29 @@
1
+ export type ExecutionVerificationStatus = 'passed' | 'failed' | 'unverified';
2
+ export type ExecutionFailurePhase = 'planning' | 'execution' | 'verification' | 'approval' | 'runtime';
3
+ export type ExecutionFailureCode = 'cancelled' | 'timeout' | 'tool_failed' | 'verification_failed' | 'approval_required' | 'conflict' | 'model_failed' | 'unknown';
4
+ export type ExecutionRecoveryAction = 'replan' | 'retry_with_changed_strategy' | 'request_user_input' | 'none';
5
+ export interface ExecutionVerification {
6
+ status: ExecutionVerificationStatus;
7
+ checks: Array<{
8
+ criterion: string;
9
+ status: ExecutionVerificationStatus;
10
+ evidenceTitles: string[];
11
+ }>;
12
+ }
13
+ export interface ExecutionFailureDiagnosis {
14
+ code: ExecutionFailureCode;
15
+ phase: ExecutionFailurePhase;
16
+ recoveryAction: ExecutionRecoveryAction;
17
+ }
18
+ export declare function verifyExecutionCompletion(input: {
19
+ status: 'succeeded' | 'failed' | 'cancelled';
20
+ acceptanceCriteria: string[];
21
+ evidence: Array<{
22
+ title: string;
23
+ verifies?: string[];
24
+ }>;
25
+ }): ExecutionVerification;
26
+ export declare function diagnoseExecutionFailure(input: {
27
+ status: 'failed' | 'cancelled';
28
+ summary: string;
29
+ }): ExecutionFailureDiagnosis;