@xopcai/xopc 0.0.178 → 0.0.180

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 (450) 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-DFKtQDgE.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BzxntcaZ.js → agent-avatar-dicebear-CcTvB_4W.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-DgGj9bu6.js +2 -0
  6. package/dist/gateway/static/root/assets/{api-hi6f2Xtp.js → api-CUClAvuL.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-fTY1F7ac.js → app-management-settings-panel-Ib-cWKHM.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-BZ-IxQfB.js → appearance-settings-CRSN8WuA.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-B5xahuT-.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-ZSLLG8wB.js → archive-plugin-BBF9zspN.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-D4YktqIF.js → attachment-load-D3QQfA7w.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-page-BUYrvMmD.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-BIkPxfxj.js → binary-plugins-D78XOjJ3.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-Q3v_YQom.js → block-editor-D_VVXlYX.js} +46 -46
  15. package/dist/gateway/static/root/assets/browser-settings-page-Cjw07q9h.js +8 -0
  16. package/dist/gateway/static/root/assets/{browser-workflow-inputs-M5lTEW1I.js → browser-workflow-inputs-_gu08MA4.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflows-page-B3T1KYk4.js → browser-workflows-page-58DBMXgG.js} +2 -2
  18. package/dist/gateway/static/root/assets/capabilities-settings-panel-D_dfVxHY.js +7 -0
  19. package/dist/gateway/static/root/assets/{capability-presets-api-DE09c0VB.js → capability-presets-api-DhCn9rPv.js} +1 -1
  20. package/dist/gateway/static/root/assets/capability-presets-settings-panel-LWWIYUT7.js +1 -0
  21. package/dist/gateway/static/root/assets/{channel-recipient-api-CFR5FBfS.js → channel-recipient-api-DYtoNV5A.js} +1 -1
  22. package/dist/gateway/static/root/assets/channels-settings-Cyj5OunL.js +1 -0
  23. package/dist/gateway/static/root/assets/channels-status-swr-TEFnV0IG.js +1 -0
  24. package/dist/gateway/static/root/assets/{connector-logo-B1mD-3pM.js → connector-logo-CxIXnifA.js} +1 -1
  25. package/dist/gateway/static/root/assets/connectors-page-0TobCpBB.js +2 -0
  26. package/dist/gateway/static/root/assets/desktop-pet-CwVSLL6N.js +1 -0
  27. package/dist/gateway/static/root/assets/desktop-pet-settings-BOIp4q0Z.js +1 -0
  28. package/dist/gateway/static/root/assets/{directory-picker-path-field-BYQJ2XUS.js → directory-picker-path-field-C8_lsW6S.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dreaming-settings-BXcb8fwx.js → dreaming-settings-Da9FeWQl.js} +3 -3
  30. package/dist/gateway/static/root/assets/{extension-debug-page-O1Xu1r4Q.js → extension-debug-page-CMNnSJP6.js} +1 -1
  31. package/dist/gateway/static/root/assets/{extension-page-C2Jraq8l.js → extension-page-t0pJqLvM.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-settings-page-DcXQDTpG.js → extension-settings-page-aiR-tKnW.js} +1 -1
  33. package/dist/gateway/static/root/assets/{gateway-config-api-DmPIZrvg.js → gateway-config-api-CkyQBD6r.js} +1 -1
  34. package/dist/gateway/static/root/assets/gateway-settings-BIZfAgfB.js +1 -0
  35. package/dist/gateway/static/root/assets/{gateway-startup-retry-BZEkOdPm.js → gateway-startup-retry-CSU7UvzG.js} +1 -1
  36. package/dist/gateway/static/root/assets/goals-settings-Dx9uTyWF.js +1 -0
  37. package/dist/gateway/static/root/assets/{heartbeat-settings-BtKu2NWT.js → heartbeat-settings-Cnr5ORXL.js} +1 -1
  38. package/dist/gateway/static/root/assets/{image-generation-api-05Gg8wsU.js → image-generation-api-BR6Kb77X.js} +1 -1
  39. package/dist/gateway/static/root/assets/index-B0Tdge_q.css +1 -0
  40. package/dist/gateway/static/root/assets/index-BA56bQ68.js +224 -0
  41. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CfmDR9Sc.js → keyboard-shortcuts-settings-D76uYKeQ.js} +1 -1
  42. package/dist/gateway/static/root/assets/local-app-workbench-page-DSUNtLHg.js +2 -0
  43. package/dist/gateway/static/root/assets/{local-apps-page-Df8BW1A_.js → local-apps-page-BsLnojTh.js} +1 -1
  44. package/dist/gateway/static/root/assets/{locale-store-CTwSy7yW.js → locale-store-BNC8HUCI.js} +1 -1
  45. package/dist/gateway/static/root/assets/logs-page-yI8kpQtO.js +7 -0
  46. package/dist/gateway/static/root/assets/{markdown-split-B3FvKbaP.js → markdown-split-D6smTQWD.js} +1 -1
  47. package/dist/gateway/static/root/assets/{media-plugins-DsjrvvB6.js → media-plugins-D1TmMF0A.js} +1 -1
  48. package/dist/gateway/static/root/assets/messages-H_iJjnEM.js +3 -0
  49. package/dist/gateway/static/root/assets/{notes-page-tuzIwy3c.js → notes-page-Vt-diFf0.js} +1 -1
  50. package/dist/gateway/static/root/assets/notes-workbench-BD297EZt.js +4 -0
  51. package/dist/gateway/static/root/assets/outcome-detail-page-C5i_ZR9a.js +1 -0
  52. package/dist/gateway/static/root/assets/{page-tabs-ke9s4nYi.js → page-tabs-BnSzIjH0.js} +1 -1
  53. package/dist/gateway/static/root/assets/{preview-open-alternatives-Cp1eI4S9.js → preview-open-alternatives-CF12Eqi4.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-Du0TE_CU.js} +1 -1
  56. package/dist/gateway/static/root/assets/project-detail-page-D1HGz7Dy.js +1 -0
  57. package/dist/gateway/static/root/assets/projects-page-CqP2TnW-.js +1 -0
  58. package/dist/gateway/static/root/assets/remote-access-hub-BXdVJLS3.js +1 -0
  59. package/dist/gateway/static/root/assets/{save-bar-controls-Bl30zjHc.js → save-bar-controls-B53UNtDM.js} +1 -1
  60. package/dist/gateway/static/root/assets/{schedule-field-DqhmXQKo.js → schedule-field-C3dIMN5q.js} +1 -1
  61. package/dist/gateway/static/root/assets/{schema-form-DkUCy6vf.js → schema-form-BKvpxqof.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-CPAwDdl5.js +1 -0
  64. package/dist/gateway/static/root/assets/settings-advanced-gate-C-jGsoft.js +1 -0
  65. package/dist/gateway/static/root/assets/{settings-form-section-C6ZbNpdy.js → settings-form-section-kt6GIS32.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-loading-skeleton-Bk58_cr7.js → settings-loading-skeleton-85eUPcKz.js} +1 -1
  67. package/dist/gateway/static/root/assets/{settings-page-k8iE_NdX.js → settings-page-Di5x6Xrc.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-page-layout-DgFSya2e.js → settings-page-layout-CkkCee_x.js} +1 -1
  69. package/dist/gateway/static/root/assets/{setup-status-panel-B_KDlyZA.js → setup-status-panel-uxEE6gAB.js} +1 -1
  70. package/dist/gateway/static/root/assets/{share-preview-page-CV7nL_J9.js → share-preview-page-BtLEstaI.js} +1 -1
  71. package/dist/gateway/static/root/assets/shares-settings-2mcsMWgn.js +1 -0
  72. package/dist/gateway/static/root/assets/skill-reload-api-ocDwsrEt.js +1 -0
  73. package/dist/gateway/static/root/assets/skills-page-9_jfsFU5.js +2 -0
  74. package/dist/gateway/static/root/assets/{skills-page.utils-kahBIHg0.js → skills-page.utils-C2SHvq8V.js} +1 -1
  75. package/dist/gateway/static/root/assets/{system-settings-panel-JV3-MG5F.js → system-settings-panel-CIJ66cUy.js} +1 -1
  76. package/dist/gateway/static/root/assets/{theme-store-DFLyzoLO.js → theme-store-ClDa_Bci.js} +1 -1
  77. package/dist/gateway/static/root/assets/time-picker-D0zAsHOo.js +1 -0
  78. package/dist/gateway/static/root/assets/{typed-models-lib-60Aqo-UJ.js → typed-models-lib-GsmwmB40.js} +1 -1
  79. package/dist/gateway/static/root/assets/{use-channel-catalog-CnTkHDnw.js → use-channel-catalog-BQz3K7xj.js} +1 -1
  80. package/dist/gateway/static/root/assets/user-context-page-Bn4BLg4W.js +1 -0
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-CNa8qUgS.js → voice-api-key-field-Blaxsbb3.js} +1 -1
  82. package/dist/gateway/static/root/assets/work-copy-Cwyan9Sn.js +1 -0
  83. package/dist/gateway/static/root/assets/work-discovery-page-iJ9RBSpu.js +1 -0
  84. package/dist/gateway/static/root/assets/work-item-detail-page-CqTH7PQX.js +1 -0
  85. package/dist/gateway/static/root/assets/work-page-H3m99ccS.js +3 -0
  86. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-yV_x595t.js → workflow-run-setup-panel-CTG4RpRE.js} +2 -2
  87. package/dist/gateway/static/root/assets/workflows-page-BxZSKMfv.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/agent-manager.d.ts +4 -1
  96. package/dist/src/agent/agent-manager.js +21 -7
  97. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
  98. package/dist/src/agent/code-intelligence/binary.js +1 -1
  99. package/dist/src/agent/context/execution-scope.d.ts +1 -1
  100. package/dist/src/agent/context/execution-scope.js +6 -4
  101. package/dist/src/agent/embedded/model-runtime.js +1 -1
  102. package/dist/src/agent/embedded/run-for-session.d.ts +2 -0
  103. package/dist/src/agent/embedded/run-for-session.js +3 -1
  104. package/dist/src/agent/goals/post-turn.js +7 -6
  105. package/dist/src/agent/image/tool-model-config.js +1 -1
  106. package/dist/src/agent/inbound/turn-dispatcher.d.ts +6 -1
  107. package/dist/src/agent/inbound/turn-dispatcher.js +5 -2
  108. package/dist/src/agent/ipc/inbox.js +1 -1
  109. package/dist/src/agent/lifecycle/timeout-wrapper.d.ts +2 -0
  110. package/dist/src/agent/lifecycle/timeout-wrapper.js +39 -9
  111. package/dist/src/agent/mcp/bundle-mcp-materialize.js +2 -2
  112. package/dist/src/agent/mcp/bundle-mcp-runtime.js +6 -1
  113. package/dist/src/agent/mcp/bundle-mcp-types.d.ts +1 -1
  114. package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
  115. package/dist/src/agent/mcp/mcp-transport-config.d.ts +2 -0
  116. package/dist/src/agent/mcp/mcp-transport-config.js +10 -3
  117. package/dist/src/agent/mcp/mcp-transport.d.ts +1 -0
  118. package/dist/src/agent/mcp/mcp-transport.js +5 -2
  119. package/dist/src/agent/memory/dreaming/config.js +1 -1
  120. package/dist/src/agent/memory/user-context-coordinator.d.ts +1 -0
  121. package/dist/src/agent/memory/user-context-coordinator.js +17 -1
  122. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +1 -1
  123. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +6 -2
  124. package/dist/src/agent/outcomes/{task-evaluation.d.ts → execution-evaluation.d.ts} +3 -3
  125. package/dist/src/agent/outcomes/{task-evaluation.js → execution-evaluation.js} +5 -5
  126. package/dist/src/agent/outcomes/execution-verifier.d.ts +29 -0
  127. package/dist/src/agent/outcomes/{task-verifier.js → execution-verifier.js} +4 -4
  128. package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
  129. package/dist/src/agent/service/direct-turn-helpers.js +1 -0
  130. package/dist/src/agent/service/process-direct-one-shot.d.ts +3 -0
  131. package/dist/src/agent/service/process-direct-one-shot.js +4 -1
  132. package/dist/src/agent/service/process-direct-streaming.js +3 -1
  133. package/dist/src/agent/service.d.ts +1 -0
  134. package/dist/src/agent/service.js +5 -2
  135. package/dist/src/agent/session/session-inspector.js +1 -1
  136. package/dist/src/agent/skills/config.js +6 -0
  137. package/dist/src/agent/skills/filesystem-watcher.d.ts +4 -0
  138. package/dist/src/agent/skills/filesystem-watcher.js +16 -7
  139. package/dist/src/agent/skills/hub-lock.js +1 -1
  140. package/dist/src/agent/skills/index.d.ts +10 -7
  141. package/dist/src/agent/skills/index.js +56 -47
  142. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  143. package/dist/src/agent/skills/skill-manager.d.ts +5 -2
  144. package/dist/src/agent/skills/skill-manager.js +10 -5
  145. package/dist/src/agent/skills/skill-sources.d.ts +18 -0
  146. package/dist/src/agent/skills/skill-sources.js +143 -0
  147. package/dist/src/agent/skills/types.d.ts +25 -2
  148. package/dist/src/agent/tools/delegate-tool.js +2 -1
  149. package/dist/src/agent/tools/executor.d.ts +2 -0
  150. package/dist/src/agent/tools/executor.js +18 -11
  151. package/dist/src/agent/tools/factory.js +18 -1
  152. package/dist/src/agent/tools/goal-tool.js +5 -3
  153. package/dist/src/agent/tools/index.d.ts +1 -0
  154. package/dist/src/agent/tools/index.js +2 -1
  155. package/dist/src/agent/tools/managed-job-tool.d.ts +2 -0
  156. package/dist/src/agent/tools/managed-job-tool.js +160 -0
  157. package/dist/src/agent/tools/todo-tool.d.ts +5 -0
  158. package/dist/src/agent/tools/todo-tool.js +16 -4
  159. package/dist/src/agent/tools/update-plan-tool.d.ts +1 -0
  160. package/dist/src/agent/tools/update-plan-tool.js +6 -0
  161. package/dist/src/agent/workspace-runtime/registry.d.ts +3 -0
  162. package/dist/src/agent/workspace-runtime/registry.js +3 -1
  163. package/dist/src/agent-runtime/index.js +1 -1
  164. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  165. package/dist/src/auth/credentials.d.ts +9 -1
  166. package/dist/src/auth/credentials.js +112 -56
  167. package/dist/src/auth/model-credential-store.js +7 -22
  168. package/dist/src/auth/oauth-provider-lock.d.ts +5 -0
  169. package/dist/src/auth/oauth-provider-lock.js +91 -0
  170. package/dist/src/auth/profiles/store.js +1 -1
  171. package/dist/src/auth/sync-provider-auth.js +2 -2
  172. package/dist/src/automations/domain/defaults.d.ts +8 -1
  173. package/dist/src/automations/domain/defaults.js +9 -2
  174. package/dist/src/automations/domain/index.js +2 -2
  175. package/dist/src/automations/domain/types.d.ts +33 -7
  176. package/dist/src/automations/domain/validation.d.ts +8 -0
  177. package/dist/src/automations/domain/validation.js +2 -0
  178. package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -1
  179. package/dist/src/automations/index.js +2 -2
  180. package/dist/src/automations/service/action-executor.d.ts +2 -2
  181. package/dist/src/automations/service/action-executor.js +144 -34
  182. package/dist/src/automations/service/automation-service.d.ts +4 -0
  183. package/dist/src/automations/service/automation-service.js +197 -18
  184. package/dist/src/automations/storage/automation-run-repository.d.ts +1 -0
  185. package/dist/src/automations/storage/automation-run-repository.js +37 -7
  186. package/dist/src/automations/storage/index.js +2 -2
  187. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  188. package/dist/src/browser/providers/cloakbrowser.js +2 -2
  189. package/dist/src/channels/attachments/voice-stt-webchat.d.ts +0 -3
  190. package/dist/src/channels/attachments/voice-stt-webchat.js +1 -24
  191. package/dist/src/chat-commands/builtins/goal.js +5 -4
  192. package/dist/src/cli/commands/agents.js +1 -1
  193. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  194. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  195. package/dist/src/cli/commands/goal.js +6 -5
  196. package/dist/src/cli/commands/models.js +1 -1
  197. package/dist/src/cli/commands/tunnel.js +3 -3
  198. package/dist/src/cli/utils/oauth-login.js +1 -7
  199. package/dist/src/config/agent-profile.js +1 -1
  200. package/dist/src/config/index.js +4 -4
  201. package/dist/src/config/loader.js +1 -1
  202. package/dist/src/config/models-json.js +1 -1
  203. package/dist/src/config/schema.d.ts +3 -0
  204. package/dist/src/config/schema.js +2 -1
  205. package/dist/src/connectors/learning-coordinator.js +7 -1
  206. package/dist/src/connectors/source-change-publisher.d.ts +17 -0
  207. package/dist/src/connectors/source-change-publisher.js +148 -0
  208. package/dist/src/discussions/analyzer.d.ts +35 -0
  209. package/dist/src/discussions/analyzer.js +127 -0
  210. package/dist/src/discussions/index.d.ts +7 -0
  211. package/dist/src/discussions/index.js +7 -0
  212. package/dist/src/discussions/live-worker.d.ts +33 -0
  213. package/dist/src/discussions/live-worker.js +148 -0
  214. package/dist/src/discussions/pipeline.d.ts +33 -0
  215. package/dist/src/discussions/pipeline.js +205 -0
  216. package/dist/src/discussions/project-inference.d.ts +13 -0
  217. package/dist/src/discussions/project-inference.js +19 -0
  218. package/dist/src/discussions/repository.d.ts +29 -0
  219. package/dist/src/discussions/repository.js +255 -0
  220. package/dist/src/discussions/service.d.ts +51 -0
  221. package/dist/src/discussions/service.js +335 -0
  222. package/dist/src/discussions/transcript.d.ts +3 -0
  223. package/dist/src/discussions/transcript.js +15 -0
  224. package/dist/src/discussions/types.d.ts +116 -0
  225. package/dist/src/discussions/types.js +10 -0
  226. package/dist/src/discussions/worker.d.ts +18 -0
  227. package/dist/src/discussions/worker.js +74 -0
  228. package/dist/src/extensions/activation-context.js +2 -1
  229. package/dist/src/extensions/lockfile.js +1 -1
  230. package/dist/src/extensions/sdk/testing.js +1 -1
  231. package/dist/src/gateway/agents-admin.js +3 -3
  232. package/dist/src/gateway/chat-stream/mapper.js +53 -3
  233. package/dist/src/gateway/chat-stream/protocol.d.ts +17 -1
  234. package/dist/src/gateway/file-path-classifier.js +1 -1
  235. package/dist/src/gateway/hono/app.js +8 -3
  236. package/dist/src/gateway/hono/lib/config-payload.js +2 -2
  237. package/dist/src/gateway/hono/middleware/auth.js +2 -2
  238. package/dist/src/gateway/hono/middleware/logger.js +1 -1
  239. package/dist/src/gateway/hono/middleware/strict-rate-limit.js +1 -1
  240. package/dist/src/gateway/hono/oauth-async.js +1 -7
  241. package/dist/src/gateway/hono/oauth.js +1 -7
  242. package/dist/src/gateway/hono/routes/agents.js +1 -1
  243. package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
  244. package/dist/src/gateway/hono/routes/connectors.js +79 -0
  245. package/dist/src/gateway/hono/routes/discussions.d.ts +3 -0
  246. package/dist/src/gateway/hono/routes/discussions.js +177 -0
  247. package/dist/src/gateway/hono/routes/execution-receipts.d.ts +3 -0
  248. package/dist/src/gateway/hono/routes/execution-receipts.js +163 -0
  249. package/dist/src/gateway/hono/routes/exposure.js +1 -1
  250. package/dist/src/gateway/hono/routes/goals.js +3 -288
  251. package/dist/src/gateway/hono/routes/home.d.ts +2 -102
  252. package/dist/src/gateway/hono/routes/home.js +8 -424
  253. package/dist/src/gateway/hono/routes/index.js +6 -2
  254. package/dist/src/gateway/hono/routes/memory.js +7 -7
  255. package/dist/src/gateway/hono/routes/models.js +1 -1
  256. package/dist/src/gateway/hono/routes/notes.js +30 -0
  257. package/dist/src/gateway/hono/routes/projects.js +8 -152
  258. package/dist/src/gateway/hono/routes/shares.js +1 -1
  259. package/dist/src/gateway/hono/routes/status.js +2 -2
  260. package/dist/src/gateway/hono/routes/tunnel.js +3 -3
  261. package/dist/src/gateway/hono/routes/voice.js +1 -1
  262. package/dist/src/gateway/hono/routes/work.d.ts +3 -0
  263. package/dist/src/gateway/hono/routes/work.js +207 -0
  264. package/dist/src/gateway/hono/routes/you.js +13 -15
  265. package/dist/src/gateway/index.js +2 -2
  266. package/dist/src/gateway/runtime-config.js +2 -2
  267. package/dist/src/gateway/security/audit.js +2 -2
  268. package/dist/src/gateway/security/index.js +1 -1
  269. package/dist/src/gateway/service/config-coordinator.js +2 -2
  270. package/dist/src/gateway/service/run-gateway-agent.js +46 -51
  271. package/dist/src/gateway/service.d.ts +8 -1
  272. package/dist/src/gateway/service.js +142 -15
  273. package/dist/src/goals/goal-queue-store.d.ts +1 -0
  274. package/dist/src/goals/goal-queue-store.js +5 -1
  275. package/dist/src/goals/goal-queue-types.d.ts +11 -1
  276. package/dist/src/goals/goal-runner.js +10 -6
  277. package/dist/src/goals/goal-service.d.ts +2 -15
  278. package/dist/src/goals/goal-service.js +9 -42
  279. package/dist/src/goals/goal-store.d.ts +1 -18
  280. package/dist/src/goals/goal-store.js +25 -231
  281. package/dist/src/goals/goal-workflow-judge.js +1 -1
  282. package/dist/src/goals/index.d.ts +0 -4
  283. package/dist/src/goals/index.js +1 -3
  284. package/dist/src/goals/types.d.ts +4 -66
  285. package/dist/src/notes/agent-context.js +1 -1
  286. package/dist/src/notes/service.d.ts +1 -0
  287. package/dist/src/notes/service.js +10 -1
  288. package/dist/src/notes/types.d.ts +1 -0
  289. package/dist/src/proactive/events/product-event-bridge.d.ts +7 -0
  290. package/dist/src/proactive/events/product-event-bridge.js +84 -0
  291. package/dist/src/proactive/execution/context.d.ts +27 -11
  292. package/dist/src/proactive/execution/context.js +259 -25
  293. package/dist/src/proactive/execution/repository.js +18 -5
  294. package/dist/src/proactive/execution/types.d.ts +7 -1
  295. package/dist/src/proactive/execution/worker.js +7 -6
  296. package/dist/src/proactive/inbox/repository.js +8 -2
  297. package/dist/src/proactive/index.d.ts +4 -2
  298. package/dist/src/proactive/index.js +5 -3
  299. package/dist/src/proactive/temporal/worker.d.ts +16 -0
  300. package/dist/src/proactive/temporal/worker.js +110 -0
  301. package/dist/src/projects/project-loop.js +3 -3
  302. package/dist/src/providers/auth-runtime/oauth.js +12 -0
  303. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  304. package/dist/src/providers/index.js +2 -2
  305. package/dist/src/providers/model-registry.js +1 -1
  306. package/dist/src/providers/register-runtime-providers.js +1 -1
  307. package/dist/src/share/share-zip.js +1 -1
  308. package/dist/src/share/site-proxy.js +1 -1
  309. package/dist/src/storage/sqlite/activity-repository.d.ts +1 -0
  310. package/dist/src/storage/sqlite/activity-repository.js +4 -1
  311. package/dist/src/storage/sqlite/connector-sync-policy-repository.d.ts +20 -0
  312. package/dist/src/storage/sqlite/connector-sync-policy-repository.js +50 -0
  313. package/dist/src/storage/sqlite/execution-receipt-repository.d.ts +146 -0
  314. package/dist/src/storage/sqlite/execution-receipt-repository.js +235 -0
  315. package/dist/src/storage/sqlite/index.d.ts +4 -2
  316. package/dist/src/storage/sqlite/index.js +6 -4
  317. package/dist/src/storage/sqlite/knowledge-repository.d.ts +3 -0
  318. package/dist/src/storage/sqlite/knowledge-repository.js +9 -1
  319. package/dist/src/storage/sqlite/memory-records-repository.js +1 -1
  320. package/dist/src/storage/sqlite/migrations/075_connector_sync_policies.sql +13 -0
  321. package/dist/src/storage/sqlite/migrations/076_meeting_preparation_scenario.sql +29 -0
  322. package/dist/src/storage/sqlite/migrations/077_proactive_insight_fingerprints.sql +4 -0
  323. package/dist/src/storage/sqlite/migrations/078_discussion_captures.sql +64 -0
  324. package/dist/src/storage/sqlite/migrations/079_discussion_follow_up_scenario.sql +29 -0
  325. package/dist/src/storage/sqlite/migrations/080_task_outcome_context.sql +15 -0
  326. package/dist/src/storage/sqlite/migrations/081_project_monitoring_policies.sql +10 -0
  327. package/dist/src/storage/sqlite/migrations/082_one_click_live_discussions.sql +100 -0
  328. package/dist/src/storage/sqlite/migrations/083_session_task_plans.sql +9 -0
  329. package/dist/src/storage/sqlite/migrations/084_work_intake_lifecycle.sql +26 -0
  330. package/dist/src/storage/sqlite/migrations/085_task_outcome_projection.sql +19 -0
  331. package/dist/src/storage/sqlite/migrations/086_outcome_aggregates.sql +168 -0
  332. package/dist/src/storage/sqlite/migrations/087_context_snapshots.sql +21 -0
  333. package/dist/src/storage/sqlite/migrations/088_automation_execution_deadlines.sql +5 -0
  334. package/dist/src/storage/sqlite/migrations/089_automation_run_leases.sql +8 -0
  335. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  336. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  337. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  338. package/dist/src/storage/sqlite/notes-repository.js +9 -0
  339. package/dist/src/storage/sqlite/schema.js +1 -1
  340. package/dist/src/storage/sqlite/schema.sql +89 -44
  341. package/dist/src/storage/sqlite/session-repository.js +1 -1
  342. package/dist/src/storage/sqlite/session-task-plan-repository.d.ts +20 -0
  343. package/dist/src/storage/sqlite/session-task-plan-repository.js +77 -0
  344. package/dist/src/tui/backends/embedded-backend.d.ts +2 -0
  345. package/dist/src/tui/backends/embedded-backend.js +12 -8
  346. package/dist/src/tui/tui-backend.d.ts +2 -0
  347. package/dist/src/tui/tui-oauth-login.js +1 -7
  348. package/dist/src/tui/tui-picker-overlay.js +1 -0
  349. package/dist/src/tui/tui-picker-services.d.ts +1 -0
  350. package/dist/src/tui/tui-skills-autocomplete.d.ts +6 -2
  351. package/dist/src/tui/tui-skills-autocomplete.js +10 -6
  352. package/dist/src/tui/tui-startup-resources.d.ts +3 -1
  353. package/dist/src/tui/tui-startup-resources.js +4 -3
  354. package/dist/src/tui/tui.js +4 -1
  355. package/dist/src/tunnel/frpc-binary.js +1 -1
  356. package/dist/src/tunnel/frpc-extract.js +1 -1
  357. package/dist/src/tunnel/index.js +2 -2
  358. package/dist/src/user-context/context-compiler.d.ts +31 -0
  359. package/dist/src/user-context/context-compiler.js +51 -0
  360. package/dist/src/voice/local/model-files.js +1 -1
  361. package/dist/src/voice/stt/config.d.ts +4 -0
  362. package/dist/src/voice/stt/config.js +26 -0
  363. package/dist/src/voice/stt/index.d.ts +1 -0
  364. package/dist/src/voice/stt/index.js +2 -1
  365. package/dist/src/voice/stt/list-providers.js +1 -1
  366. package/dist/src/work/attention-governor.d.ts +20 -0
  367. package/dist/src/work/attention-governor.js +46 -0
  368. package/dist/src/work/execution-context.d.ts +16 -0
  369. package/dist/src/work/execution-context.js +66 -0
  370. package/dist/src/work/home-query-service.d.ts +147 -0
  371. package/dist/src/work/home-query-service.js +389 -0
  372. package/dist/src/work/index.d.ts +14 -0
  373. package/dist/src/work/index.js +15 -0
  374. package/dist/src/work/outcome-contract-definition.d.ts +8 -0
  375. package/dist/src/work/outcome-contract-definition.js +15 -0
  376. package/dist/src/work/outcome-execution-service.d.ts +27 -0
  377. package/dist/src/work/outcome-execution-service.js +60 -0
  378. package/dist/src/work/outcome-projection-service.d.ts +7 -0
  379. package/dist/src/work/outcome-projection-service.js +51 -0
  380. package/dist/src/work/outcome-receipt-service.d.ts +13 -0
  381. package/dist/src/work/outcome-receipt-service.js +55 -0
  382. package/dist/src/work/outcome-repository.d.ts +50 -0
  383. package/dist/src/work/outcome-repository.js +112 -0
  384. package/dist/src/work/outcome-run-coordinator.d.ts +25 -0
  385. package/dist/src/work/outcome-run-coordinator.js +117 -0
  386. package/dist/src/work/project-monitoring-service.d.ts +21 -0
  387. package/dist/src/work/project-monitoring-service.js +76 -0
  388. package/dist/src/work/project-operating-view-service.d.ts +10 -0
  389. package/dist/src/work/project-operating-view-service.js +46 -0
  390. package/dist/src/work/work-intake-repository.d.ts +49 -0
  391. package/dist/src/work/work-intake-repository.js +97 -0
  392. package/dist/src/work/work-intake-service.d.ts +26 -0
  393. package/dist/src/work/work-intake-service.js +171 -0
  394. package/dist/src/work/work-value-metrics-service.d.ts +4 -0
  395. package/dist/src/work/work-value-metrics-service.js +88 -0
  396. package/dist/src/work-items/work-item-service.d.ts +0 -2
  397. package/dist/src/work-items/work-item-service.js +0 -28
  398. package/dist/src/workflows/service/workflow-run-service.js +2 -2
  399. package/dist/src/workflows/service/workflow-run-service.types.d.ts +3 -1
  400. package/dist/src/workflows/service/workflow-session-bridge.js +2 -2
  401. package/package.json +1 -1
  402. package/dist/gateway/static/root/assets/agents-DC9F12Kw.js +0 -2
  403. package/dist/gateway/static/root/assets/apps-page-5bKr05Fa.js +0 -1
  404. package/dist/gateway/static/root/assets/automation-suggestion-card-B7mxFRtf.js +0 -1
  405. package/dist/gateway/static/root/assets/automations-page-Dg6dmt5g.js +0 -6
  406. package/dist/gateway/static/root/assets/browser-settings-page-BHoo6Rpq.js +0 -8
  407. package/dist/gateway/static/root/assets/capabilities-settings-panel-BlsqN8Fu.js +0 -7
  408. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DJeT8_B4.js +0 -1
  409. package/dist/gateway/static/root/assets/channels-settings-C4VVjYEm.js +0 -1
  410. package/dist/gateway/static/root/assets/channels-status-swr-vdf8kB16.js +0 -1
  411. package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +0 -1
  412. package/dist/gateway/static/root/assets/connectors-page-DNcrDThX.js +0 -2
  413. package/dist/gateway/static/root/assets/desktop-pet-B1urphOZ.js +0 -1
  414. package/dist/gateway/static/root/assets/desktop-pet-settings-DTL6J3EP.js +0 -1
  415. package/dist/gateway/static/root/assets/gateway-settings-DmObBx9b.js +0 -1
  416. package/dist/gateway/static/root/assets/goal-create-dialog-BRhmmBe9.js +0 -1
  417. package/dist/gateway/static/root/assets/goal-detail-page-C1k7_s_O.js +0 -4
  418. package/dist/gateway/static/root/assets/goals-config-api-Fwu1wjEP.js +0 -1
  419. package/dist/gateway/static/root/assets/goals-page-hOu9uA3q.js +0 -2
  420. package/dist/gateway/static/root/assets/goals-settings-DY-JjvHz.js +0 -1
  421. package/dist/gateway/static/root/assets/index-C0CGebQ1.js +0 -212
  422. package/dist/gateway/static/root/assets/index-eqq25gvV.css +0 -1
  423. package/dist/gateway/static/root/assets/local-app-workbench-page-EjsNT7nJ.js +0 -2
  424. package/dist/gateway/static/root/assets/logs-page-Dswjlraa.js +0 -7
  425. package/dist/gateway/static/root/assets/messages-DP6tPKk-.js +0 -3
  426. package/dist/gateway/static/root/assets/notes-workbench-DSh3-hMY.js +0 -4
  427. package/dist/gateway/static/root/assets/product-delivery-BTRT9kCS.js +0 -1
  428. package/dist/gateway/static/root/assets/project-detail-page-D0QPRHR_.js +0 -1
  429. package/dist/gateway/static/root/assets/projects-page-CI5Vz62F.js +0 -1
  430. package/dist/gateway/static/root/assets/remote-access-hub-S1jpzBS5.js +0 -1
  431. package/dist/gateway/static/root/assets/sessions-page-CTm66k7h.js +0 -1
  432. package/dist/gateway/static/root/assets/settings-advanced-gate-CU52AUVD.js +0 -1
  433. package/dist/gateway/static/root/assets/shares-settings-DK6XK95e.js +0 -1
  434. package/dist/gateway/static/root/assets/skill-reload-api-Bvv_u4ii.js +0 -1
  435. package/dist/gateway/static/root/assets/skills-page-BGHvVbay.js +0 -2
  436. package/dist/gateway/static/root/assets/time-picker-XwpxdZFr.js +0 -1
  437. package/dist/gateway/static/root/assets/user-context-page-DBCMk-Vn.js +0 -1
  438. package/dist/gateway/static/root/assets/work-discovery-page-C1UIdsCl.js +0 -1
  439. package/dist/gateway/static/root/assets/work-item-detail-page-DEAQepB8.js +0 -1
  440. package/dist/gateway/static/root/assets/work-page-D5qYmCTq.js +0 -3
  441. package/dist/gateway/static/root/assets/workflows-page-yrK17ZZ5.js +0 -11
  442. package/dist/src/agent/outcomes/task-verifier.d.ts +0 -29
  443. package/dist/src/gateway/hono/routes/task-outcomes.d.ts +0 -3
  444. package/dist/src/gateway/hono/routes/task-outcomes.js +0 -109
  445. package/dist/src/goals/goal-contract-draft.d.ts +0 -15
  446. package/dist/src/goals/goal-contract-draft.js +0 -112
  447. package/dist/src/goals/goal-evidence-review.d.ts +0 -15
  448. package/dist/src/goals/goal-evidence-review.js +0 -89
  449. package/dist/src/storage/sqlite/task-outcome-repository.d.ts +0 -90
  450. package/dist/src/storage/sqlite/task-outcome-repository.js +0 -138
@@ -19,7 +19,17 @@ function rowToRun(row) {
19
19
  error: row.error ?? void 0,
20
20
  sessionKey: row.session_key ?? void 0,
21
21
  workflowRunId: row.workflow_run_id ?? void 0,
22
- model: row.model ?? void 0
22
+ model: row.model ?? void 0,
23
+ deadlineAtMs: row.deadline_at_ms ?? void 0,
24
+ currentPhase: row.current_phase ?? void 0,
25
+ cancelRequestedAtMs: row.cancel_requested_at_ms ?? void 0,
26
+ cancelConfirmedAtMs: row.cancel_confirmed_at_ms ?? void 0,
27
+ termination: row.termination_json ? JSON.parse(row.termination_json) : void 0,
28
+ heartbeatAtMs: row.heartbeat_at_ms ?? void 0,
29
+ leaseOwner: row.lease_owner ?? void 0,
30
+ leaseExpiresAtMs: row.lease_expires_at_ms ?? void 0,
31
+ attemptNumber: row.attempt_number,
32
+ rootRunId: row.root_run_id ?? void 0
23
33
  };
24
34
  }
25
35
  function rowToEvent(row) {
@@ -55,11 +65,19 @@ function saveAutomationRun(run) {
55
65
  db.prepare(`INSERT OR REPLACE INTO automation_runs (
56
66
  run_id, automation_id, automation_name, status, trigger_snapshot_json,
57
67
  action_snapshot_json, manual, created_at_ms, started_at_ms, ended_at_ms,
58
- duration_ms, summary, error, session_key, workflow_run_id, model
59
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(run.id, run.automationId, run.automationName, run.status, JSON.stringify(run.triggerSnapshot), JSON.stringify(run.actionSnapshot), run.manual ? 1 : 0, run.createdAtMs, run.startedAtMs ?? null, run.endedAtMs ?? null, run.durationMs ?? null, run.summary ?? null, run.error ?? null, run.sessionKey ?? null, run.workflowRunId ?? null, run.model ?? null);
68
+ duration_ms, summary, error, session_key, workflow_run_id, model,
69
+ deadline_at_ms, current_phase, cancel_requested_at_ms, cancel_confirmed_at_ms,
70
+ termination_json, heartbeat_at_ms, lease_owner, lease_expires_at_ms,
71
+ attempt_number, root_run_id
72
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(run.id, run.automationId, run.automationName, run.status, JSON.stringify(run.triggerSnapshot), JSON.stringify(run.actionSnapshot), run.manual ? 1 : 0, run.createdAtMs, run.startedAtMs ?? null, run.endedAtMs ?? null, run.durationMs ?? null, run.summary ?? null, run.error ?? null, run.sessionKey ?? null, run.workflowRunId ?? null, run.model ?? null, run.deadlineAtMs ?? null, run.currentPhase ?? null, run.cancelRequestedAtMs ?? null, run.cancelConfirmedAtMs ?? null, run.termination ? JSON.stringify(run.termination) : null, run.heartbeatAtMs ?? null, run.leaseOwner ?? null, run.leaseExpiresAtMs ?? null, run.attemptNumber ?? 1, run.rootRunId ?? run.id);
60
73
  trimRuns(db, run.automationId);
61
74
  });
62
75
  }
76
+ function touchAutomationRunLease(runId, leaseOwner, heartbeatAtMs, leaseExpiresAtMs) {
77
+ getSqliteDatabase().prepare(`UPDATE automation_runs
78
+ SET heartbeat_at_ms = ?, lease_owner = ?, lease_expires_at_ms = ?
79
+ WHERE run_id = ? AND status IN ('queued', 'running', 'cancelling')`).run(heartbeatAtMs, leaseOwner, leaseExpiresAtMs, runId);
80
+ }
63
81
  function listAutomationRunEvents(runId) {
64
82
  return getSqliteDatabase().prepare(`SELECT event_id, run_id, automation_id, type, message, data_json, created_at_ms
65
83
  FROM automation_run_events
@@ -69,7 +87,10 @@ function listAutomationRunEvents(runId) {
69
87
  function getAutomationRun(runId) {
70
88
  const row = getSqliteDatabase().prepare(`SELECT run_id, automation_id, automation_name, status, trigger_snapshot_json,
71
89
  action_snapshot_json, manual, created_at_ms, started_at_ms, ended_at_ms,
72
- duration_ms, summary, error, session_key, workflow_run_id, model
90
+ duration_ms, summary, error, session_key, workflow_run_id, model,
91
+ deadline_at_ms, current_phase, cancel_requested_at_ms, cancel_confirmed_at_ms,
92
+ termination_json, heartbeat_at_ms, lease_owner, lease_expires_at_ms,
93
+ attempt_number, root_run_id
73
94
  FROM automation_runs
74
95
  WHERE run_id = ?`).get(runId);
75
96
  return row ? rowToRun(row) : null;
@@ -79,13 +100,19 @@ function listAutomationRuns(options) {
79
100
  const db = getSqliteDatabase();
80
101
  const base = `SELECT run_id, automation_id, automation_name, status, trigger_snapshot_json,
81
102
  action_snapshot_json, manual, created_at_ms, started_at_ms, ended_at_ms,
82
- duration_ms, summary, error, session_key, workflow_run_id, model
103
+ duration_ms, summary, error, session_key, workflow_run_id, model,
104
+ deadline_at_ms, current_phase, cancel_requested_at_ms, cancel_confirmed_at_ms,
105
+ termination_json, heartbeat_at_ms, lease_owner, lease_expires_at_ms,
106
+ attempt_number, root_run_id
83
107
  FROM automation_runs`;
84
108
  let rows;
85
109
  if (options?.automationId) rows = db.prepare(`${base} WHERE automation_id = ? ORDER BY created_at_ms DESC LIMIT ?`).all(options.automationId, limit);
86
110
  else if (options?.projectId) rows = db.prepare(`SELECT r.run_id, r.automation_id, r.automation_name, r.status, r.trigger_snapshot_json,
87
111
  r.action_snapshot_json, r.manual, r.created_at_ms, r.started_at_ms, r.ended_at_ms,
88
- r.duration_ms, r.summary, r.error, r.session_key, r.workflow_run_id, r.model
112
+ r.duration_ms, r.summary, r.error, r.session_key, r.workflow_run_id, r.model,
113
+ r.deadline_at_ms, r.current_phase, r.cancel_requested_at_ms, r.cancel_confirmed_at_ms,
114
+ r.termination_json, r.heartbeat_at_ms, r.lease_owner, r.lease_expires_at_ms,
115
+ r.attempt_number, r.root_run_id
89
116
  FROM automation_runs r
90
117
  JOIN automations a ON a.automation_id = r.automation_id
91
118
  WHERE a.project_id = ?
@@ -109,6 +136,9 @@ function listAutomationRunsForProductEvent(options) {
109
136
  return getSqliteDatabase().prepare(`SELECT r.run_id, r.automation_id, r.automation_name, r.status, r.trigger_snapshot_json,
110
137
  r.action_snapshot_json, r.manual, r.created_at_ms, r.started_at_ms, r.ended_at_ms,
111
138
  r.duration_ms, r.summary, r.error, r.session_key, r.workflow_run_id, r.model,
139
+ r.deadline_at_ms, r.current_phase, r.cancel_requested_at_ms, r.cancel_confirmed_at_ms,
140
+ r.termination_json, r.heartbeat_at_ms, r.lease_owner, r.lease_expires_at_ms,
141
+ r.attempt_number, r.root_run_id,
112
142
  e.event_id, e.run_id AS event_run_id, e.automation_id AS event_automation_id,
113
143
  e.type AS event_type, e.message AS event_message, e.data_json AS event_data_json,
114
144
  e.created_at_ms AS event_created_at_ms
@@ -136,4 +166,4 @@ function deleteAutomationRunsForAutomation(automationId) {
136
166
  });
137
167
  }
138
168
  //#endregion
139
- export { appendAutomationRunEvent, deleteAutomationRunsForAutomation, getAutomationRun, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, saveAutomationRun };
169
+ export { appendAutomationRunEvent, deleteAutomationRunsForAutomation, getAutomationRun, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, saveAutomationRun, touchAutomationRunLease };
@@ -1,3 +1,3 @@
1
1
  import { deleteAutomation, getAutomation, listAutomations, saveAutomation, saveAutomations } from "./automation-repository.js";
2
- import { appendAutomationRunEvent, deleteAutomationRunsForAutomation, getAutomationRun, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, saveAutomationRun } from "./automation-run-repository.js";
3
- export { appendAutomationRunEvent, deleteAutomation, deleteAutomationRunsForAutomation, getAutomation, getAutomationRun, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listAutomations, saveAutomation, saveAutomationRun, saveAutomations };
2
+ import { appendAutomationRunEvent, deleteAutomationRunsForAutomation, getAutomationRun, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, saveAutomationRun, touchAutomationRunLease } from "./automation-run-repository.js";
3
+ export { appendAutomationRunEvent, deleteAutomation, deleteAutomationRunsForAutomation, getAutomation, getAutomationRun, listAutomationRunEvents, listAutomationRuns, listAutomationRunsForProductEvent, listAutomations, saveAutomation, saveAutomationRun, saveAutomations, touchAutomationRunLease };
@@ -2,8 +2,8 @@ import { PACKAGE_VERSION, init_package_version } from "../../package-version.js"
2
2
  import { createLogger } from "../../utils/logger/index.js";
3
3
  import { init_logger } from "../../utils/logger.js";
4
4
  import { assertCacheDir, init_cache_dir_policy } from "../cache-dir-policy.js";
5
- import { init_paths, resolveBinDir } from "../../config/paths.js";
6
5
  import { init_write_file_atomic, writeTextAtomic } from "../../infra/write-file-atomic.js";
6
+ import { init_paths, resolveBinDir } from "../../config/paths.js";
7
7
  import { resolvePackageRoot } from "../../infra/update-check.js";
8
8
  import { dirname, join } from "node:path";
9
9
  import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
@@ -11,9 +11,9 @@ import { createReadStream, createWriteStream } from "node:fs";
11
11
  import { spawn } from "node:child_process";
12
12
  import { createHash } from "node:crypto";
13
13
  import { mkdir, mkdtemp, rm, stat } from "node:fs/promises";
14
- import AdmZip from "adm-zip";
15
- import { Readable, Transform } from "node:stream";
16
14
  import { pipeline } from "node:stream/promises";
15
+ import { Readable, Transform } from "node:stream";
16
+ import AdmZip from "adm-zip";
17
17
  //#region src/browser/providers/cloakbrowser.ts
18
18
  /**
19
19
  * CloakBrowser provider — anti-fingerprint Chromium with stealth capabilities.
@@ -3,9 +3,6 @@
3
3
  */
4
4
  import type { STTConfig } from '../../voice/stt/types.js';
5
5
  import { type InboundAttachmentInput, type MediaRef } from './inbound-persist.js';
6
- export declare function mergeSttConfigFromAppConfig(stt: Partial<STTConfig> | undefined, toolsMedia?: {
7
- models?: STTConfig['sharedModels'];
8
- }): STTConfig;
9
6
  export declare function isVoiceLikeAttachment(att: InboundAttachmentInput | MediaRef): boolean;
10
7
  export declare function mergeVoiceTranscriptsIntoUserText(prepared: (InboundAttachmentInput | MediaRef)[] | undefined, userText: string, sttConfig: STTConfig, opts?: {
11
8
  skipVoiceTranscription?: boolean;
@@ -1,32 +1,9 @@
1
1
  import { decodeInboundAttachmentBase64, readInboundAttachmentBuffer } from "./inbound-persist.js";
2
- import { DEFAULT_STT_CONFIG } from "../../voice/stt/types.js";
3
2
  import { transcribe } from "../../voice/stt/transcribe-core.js";
4
3
  import { isSTTAvailable } from "../../voice/stt/availability.js";
5
4
  import "../../voice/stt/index.js";
6
5
  //#region src/channels/attachments/voice-stt-webchat.ts
7
6
  const STT_MAX_BYTES = 25 * 1024 * 1024;
8
- function mergeSttProviders(base, patch) {
9
- if (!base && !patch) return void 0;
10
- const merged = { ...base ?? {} };
11
- for (const [id, slice] of Object.entries(patch ?? {})) merged[id] = {
12
- ...merged[id] ?? {},
13
- ...slice
14
- };
15
- return merged;
16
- }
17
- function mergeSttConfigFromAppConfig(stt, toolsMedia) {
18
- const p = stt ?? {};
19
- return {
20
- ...DEFAULT_STT_CONFIG,
21
- ...p,
22
- providers: mergeSttProviders(DEFAULT_STT_CONFIG.providers, p.providers),
23
- fallback: {
24
- ...DEFAULT_STT_CONFIG.fallback,
25
- ...p.fallback
26
- },
27
- ...toolsMedia?.models?.length ? { sharedModels: toolsMedia.models } : {}
28
- };
29
- }
30
7
  function isVoiceLikeAttachment(att) {
31
8
  if (att.type === "voice") return true;
32
9
  return (att.mimeType?.toLowerCase() ?? "").startsWith("audio/");
@@ -88,4 +65,4 @@ async function mergeVoiceTranscriptsIntoUserText(prepared, userText, sttConfig,
88
65
  };
89
66
  }
90
67
  //#endregion
91
- export { isVoiceLikeAttachment, mergeSttConfigFromAppConfig, mergeVoiceTranscriptsIntoUserText };
68
+ export { isVoiceLikeAttachment, mergeVoiceTranscriptsIntoUserText };
@@ -3,6 +3,8 @@ import "../../storage/sqlite/index.js";
3
3
  import { getDefaultAgentId, init_resolve_route } from "../../routing/resolve-route.js";
4
4
  import { GoalService } from "../../goals/goal-service.js";
5
5
  import "../../goals/index.js";
6
+ import { OutcomeExecutionService } from "../../work/outcome-execution-service.js";
7
+ import "../../work/index.js";
6
8
  import { commandRegistry } from "../registry.js";
7
9
  //#region src/chat-commands/builtins/goal.ts
8
10
  init_resolve_route();
@@ -98,14 +100,13 @@ const goalCommand = {
98
100
  content: "Agent is running — use /goal status / pause / clear mid-run, or wait for the current turn to finish before setting a new goal.",
99
101
  success: false
100
102
  };
101
- const goal = goals.create({
102
- title: t,
103
+ const goal = new OutcomeExecutionService().create({
104
+ objective: t,
103
105
  sessionKey: ctx.sessionKey,
104
106
  agentId: getDefaultAgentId(ctx.config),
105
- config: ctx.config,
106
107
  source: ctx.source === "cli" ? "cli" : ctx.source === "api" ? "api" : "channel",
107
108
  projectId: getSessionMetadata(ctx.sessionKey)?.projectId
108
- });
109
+ }).goal;
109
110
  ctx.persistentGoalApis?.scheduleContinuation(ctx.sessionKey, goal.title);
110
111
  return {
111
112
  content: `⊙ Goal set (${goal.maxTurns}-turn budget): ${goal.title}\nI'll keep working until the goal is done, you pause/archive it, or the budget is exhausted.
@@ -1,8 +1,8 @@
1
1
  import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, validateAgentIdForNewAgent } from "../../agent/agent-scope.js";
2
2
  import { init_paths, resolveConfigPath } from "../../config/paths.js";
3
3
  import { init_loader, loadConfig, saveConfig } from "../../config/loader.js";
4
- import { applyAgentConfig, findAgentEntryIndex, getAgentDeleteBlocker, pruneAgentConfig, removeAgentDirsFromDisk } from "../../commands/agents.config.js";
5
4
  import { seedAgentProfileMarkdownFiles } from "../../agent/context/workspace-seed.js";
5
+ import { applyAgentConfig, findAgentEntryIndex, getAgentDeleteBlocker, pruneAgentConfig, removeAgentDirsFromDisk } from "../../commands/agents.config.js";
6
6
  import { colors } from "../utils/colors.js";
7
7
  import { mkdir } from "node:fs/promises";
8
8
  //#region src/cli/commands/agents.ts
@@ -52,7 +52,7 @@ async function checkDatabaseSchema(ctx) {
52
52
  id: "database-schema",
53
53
  label: "Database schema",
54
54
  status: "pass",
55
- message: `SQLite schema v${status.dbVersion} (current release v74).`,
55
+ message: `SQLite schema v${status.dbVersion} (current release v89).`,
56
56
  hints: []
57
57
  };
58
58
  }
@@ -1,6 +1,6 @@
1
1
  import { getAgentDefaultModelRef, init_schema, parseModelRef } from "../../../../config/schema.js";
2
- import { init_loader, loadConfig } from "../../../../config/loader.js";
3
2
  import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "../../../../providers/env-keys.js";
3
+ import { init_loader, loadConfig } from "../../../../config/loader.js";
4
4
  import { existsSync } from "node:fs";
5
5
  //#region src/cli/commands/doctor/checks/provider-auth.ts
6
6
  init_loader();
@@ -3,9 +3,11 @@ import "../../storage/sqlite/index.js";
3
3
  import { init_loader, loadConfig } from "../../config/loader.js";
4
4
  import { GoalService } from "../../goals/goal-service.js";
5
5
  import "../../goals/index.js";
6
+ import { OutcomeExecutionService } from "../../work/outcome-execution-service.js";
6
7
  import { ProjectService } from "../../projects/project-service.js";
7
8
  import { resolveProjectAgentId } from "../../projects/project-agent.js";
8
9
  import "../../projects/index.js";
10
+ import "../../work/index.js";
9
11
  import { formatExamples, register } from "../registry.js";
10
12
  import { Command } from "commander";
11
13
  //#region src/cli/commands/goal.ts
@@ -81,7 +83,7 @@ function createGoalCommand(ctx) {
81
83
  }));
82
84
  cmd.addCommand(new Command("new").description("Create a goal").argument("<title>", "Goal title").option("--session-key <key>", "Link to a session key").option("--agent-id <id>", "Agent id").option("--max-turns <n>", "Turn budget").option("--priority <level>", "low, normal, or high", "normal").option("--project <id-or-slug>", "Attach the goal to a project").action(async (title, options) => {
83
85
  const cfg = loadConfig(ctx.configPath);
84
- await withGoals(ctx, async (goals) => {
86
+ await withGoals(ctx, async (_goals) => {
85
87
  const projectId = resolveProjectId(options.project);
86
88
  const agentId = options.sessionKey && !options.agentId ? void 0 : resolveProjectAgentId({
87
89
  config: cfg,
@@ -89,16 +91,15 @@ function createGoalCommand(ctx) {
89
91
  explicitAgentId: options.agentId,
90
92
  projectId
91
93
  });
92
- const goal = goals.create({
93
- title,
94
+ const goal = new OutcomeExecutionService().create({
95
+ objective: title,
94
96
  sessionKey: options.sessionKey,
95
97
  agentId,
96
98
  priority: options.priority === "low" || options.priority === "high" ? options.priority : "normal",
97
99
  maxTurns: options.maxTurns ? Number(options.maxTurns) : void 0,
98
- config: cfg,
99
100
  source: "cli",
100
101
  projectId
101
- });
102
+ }).goal;
102
103
  console.log(`Created goal ${goal.id}`);
103
104
  console.log(` ${goal.title}`);
104
105
  });
@@ -1,6 +1,6 @@
1
1
  import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
2
- import { loadConfig, saveConfig } from "../../config/loader.js";
3
2
  import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
3
+ import { loadConfig, saveConfig } from "../../config/loader.js";
4
4
  import { getAllModels, getAvailableModels, getConfiguredProviders, getProviderAuthState, getProviderDisplayName, init_providers, isProviderConfigured, providerSupportsApiKey, providerSupportsOAuth, resolveModel } from "../../providers/index.js";
5
5
  import { formatExamples, register } from "../registry.js";
6
6
  import { getContextWithOpts } from "../context.js";
@@ -3,15 +3,15 @@ import { init_logger } from "../../utils/logger.js";
3
3
  import { loadConfig, saveConfig } from "../../config/loader.js";
4
4
  import { resolveGatewayEffectiveHost } from "../../config/gateway-bind.js";
5
5
  import { loadTunnelState } from "../../tunnel/tunnel-state.js";
6
- import { formatExamples, register } from "../registry.js";
7
- import "../../config/index.js";
8
6
  import { TUNNEL_RISK_SUMMARY_LINES, TunnelConsentError, assertTunnelMayStart, hasValidTunnelConsent } from "../../tunnel/consent.js";
9
7
  import { resolveTunnelBrokerUrl, resolveTunnelRegistrationSecret } from "../../tunnel/env.js";
8
+ import { applyTunnelConsentToConfig, mergeTunnelConfigPatch, setTunnelEnabledInConfig } from "../../tunnel/tunnel-config.js";
10
9
  import { ensureFrpcBinary } from "../../tunnel/frpc-binary.js";
11
10
  import { getTunnelService } from "../../tunnel/tunnel-service.js";
12
11
  import { resolveFrpSubdomainHost } from "../../tunnel/frp-subdomain-host.js";
13
- import { applyTunnelConsentToConfig, mergeTunnelConfigPatch, setTunnelEnabledInConfig } from "../../tunnel/tunnel-config.js";
14
12
  import "../../tunnel/index.js";
13
+ import { formatExamples, register } from "../registry.js";
14
+ import "../../config/index.js";
15
15
  import { Command } from "commander";
16
16
  //#region src/cli/commands/tunnel.ts
17
17
  init_logger();
@@ -74,13 +74,7 @@ async function runCliOAuthLogin(options) {
74
74
  provider: config.provider,
75
75
  onProgress: options.onProgress
76
76
  }));
77
- await new CredentialResolver().saveOAuthToken(options.provider, {
78
- access: config.provider.getApiKey(credentials),
79
- refresh: credentials.refresh,
80
- expiresAt: credentials.expires,
81
- scope: Array.isArray(credentials.scope) ? credentials.scope.filter((value) => typeof value === "string") : void 0,
82
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
83
- });
77
+ await new CredentialResolver().saveOAuthCredentials(options.provider, credentials);
84
78
  return {
85
79
  provider: options.provider,
86
80
  credentials,
@@ -1,6 +1,6 @@
1
- import { init_agent_scope, normalizeAgentId, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
2
1
  import { resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
3
2
  import "../agent-manifest/index.js";
3
+ import { init_agent_scope, normalizeAgentId, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
4
4
  import { init_session_key, parseSessionKey } from "../routing/session-key.js";
5
5
  import { agentExists, getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
6
6
  //#region src/config/agent-profile.ts
@@ -2,15 +2,15 @@ import { ENV_VARS, XOPC_DB_FILENAME, resolveHomeDir, resolveStateDir, resolveXop
2
2
  import { TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema } from "../../extensions/telegram/src/config-schema.js";
3
3
  import { WeixinAccountConfigSchema, WeixinConfigSchema } from "../../extensions/weixin/src/config-schema.js";
4
4
  import { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CodeIntelligenceConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GatewayWebchatConfigSchema, GoalNotificationEventSchema, GoalNotificationTargetSchema, GoalNotificationsConfigSchema, GoalsConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "./schema.js";
5
- import { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride } from "./runtime-overrides.js";
5
+ import { clearConfigValueCache, getAllowedCommands, getCacheStats, init_resolve_config_value, resolveConfigValue, resolveHeaders, testApiKeyResolution } from "./resolve-config-value.js";
6
6
  import { expandWorkspacePathString, init_workspace_path, normalizeWorkspaceDir, resolveWorkspaceRoot } from "./workspace-path.js";
7
7
  import { resolveDefaultAgentWorkspaceDir } from "./workspace-defaults.js";
8
8
  import { resolveAgentDir as resolveAgentDir$1, resolveAgentHomeDir as resolveAgentHomeDir$1, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
9
- import { extractProfileAgentId, resolveEffectiveAgentManifestForAgent, resolveEffectiveAgentManifestForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
10
9
  import { FILENAMES, USER_MEMORY_FILENAME, USER_PROFILE_FILENAME, WORKSPACE_FILES, existsSync, hasBundledExtensionManifest, init_paths, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentHomeDir, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveCredentialsDir, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStatusPath, resolveToolsDir, resolveUserDir, resolveUserMemoryPath, resolveUserProfilePath, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath } from "./paths.js";
11
- import { init_loader, loadConfig, saveConfig } from "./loader.js";
12
- import { clearConfigValueCache, getAllowedCommands, getCacheStats, init_resolve_config_value, resolveConfigValue, resolveHeaders, testApiKeyResolution } from "./resolve-config-value.js";
13
10
  import { CustomModelSchema, ImageGenerationCapabilitiesSchema, ImageGenerationModelSchema, ImageGenerationProviderSchema, ModelOverrideSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProviderConfigSchema, VercelGatewayRoutingSchema, getDefaultModelValues, init_models_json, loadModelsJson, modelsJsonExists, saveModelsJson, validateModelsConfig } from "./models-json.js";
11
+ import { init_loader, loadConfig, saveConfig } from "./loader.js";
12
+ import { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride } from "./runtime-overrides.js";
13
+ import { extractProfileAgentId, resolveEffectiveAgentManifestForAgent, resolveEffectiveAgentManifestForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "./agent-profile.js";
14
14
  import { canonicalizeConfiguredMcpServer, isKnownCliMcpTypeAlias, normalizeConfiguredMcpServers, resolveXopcMcpTransportAlias } from "./mcp-config-normalize.js";
15
15
  import { formatThinkingLevels, listThinkingLevels, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, thinkLevelToNumber } from "../agent/transcript/thinking-types.js";
16
16
  import { getWorkspacePath } from "./workspace-path-helpers.js";
@@ -2,8 +2,8 @@ import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
2
  import { createLogger } from "../utils/logger/index.js";
3
3
  import { init_logger } from "../utils/logger.js";
4
4
  import { ConfigSchema, init_schema } from "./schema.js";
5
- import { init_paths, resolveConfigPath } from "./paths.js";
6
5
  import { init_write_file_atomic, writeTextAtomic } from "../infra/write-file-atomic.js";
6
+ import { init_paths, resolveConfigPath } from "./paths.js";
7
7
  import { assertChannelPluginConfigs, init_validate_channel_configs } from "./validate-channel-configs.js";
8
8
  import { dirname } from "path";
9
9
  import { existsSync, mkdirSync, promises, readFileSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
- import { init_paths, resolveModelsJsonPath } from "./paths.js";
3
2
  import { init_write_file_atomic, writeTextAtomicSync } from "../infra/write-file-atomic.js";
3
+ import { init_paths, resolveModelsJsonPath } from "./paths.js";
4
4
  import { existsSync, readFileSync } from "fs";
5
5
  import { z } from "zod";
6
6
  //#region src/config/models-json.ts
@@ -1471,6 +1471,7 @@ export declare const McpServerSchema: z.ZodObject<{
1471
1471
  }, z.core.$strip>;
1472
1472
  }, z.core.$strip>]>>>;
1473
1473
  connectionTimeoutMs: z.ZodOptional<z.ZodNumber>;
1474
+ requestTimeoutMs: z.ZodOptional<z.ZodNumber>;
1474
1475
  }, z.core.$catchall<z.ZodUnknown>>;
1475
1476
  export declare const McpConfigSchema: z.ZodOptional<z.ZodObject<{
1476
1477
  servers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -1496,6 +1497,7 @@ export declare const McpConfigSchema: z.ZodOptional<z.ZodObject<{
1496
1497
  }, z.core.$strip>;
1497
1498
  }, z.core.$strip>]>>>;
1498
1499
  connectionTimeoutMs: z.ZodOptional<z.ZodNumber>;
1500
+ requestTimeoutMs: z.ZodOptional<z.ZodNumber>;
1499
1501
  }, z.core.$catchall<z.ZodUnknown>>>>;
1500
1502
  sessionIdleTtlMs: z.ZodOptional<z.ZodNumber>;
1501
1503
  }, z.core.$strict>>;
@@ -2302,6 +2304,7 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
2302
2304
  }, z.core.$strip>;
2303
2305
  }, z.core.$strip>]>>>;
2304
2306
  connectionTimeoutMs: z.ZodOptional<z.ZodNumber>;
2307
+ requestTimeoutMs: z.ZodOptional<z.ZodNumber>;
2305
2308
  }, z.core.$catchall<z.ZodUnknown>>>>;
2306
2309
  sessionIdleTtlMs: z.ZodOptional<z.ZodNumber>;
2307
2310
  }, z.core.$strict>>;
@@ -967,7 +967,8 @@ defaultAgent: z.string().min(1).optional() }).strict().default({});
967
967
  url: McpHttpUrlSchema.optional(),
968
968
  transport: z.enum(["sse", "streamable-http"]).optional(),
969
969
  headers: z.record(z.string(), McpConfigScalarSchema).optional(),
970
- connectionTimeoutMs: z.number().finite().positive().optional()
970
+ connectionTimeoutMs: z.number().finite().positive().optional(),
971
+ requestTimeoutMs: z.number().finite().positive().optional()
971
972
  }).catchall(z.unknown()).superRefine((value, ctx) => {
972
973
  const hasCommand = typeof value.command === "string" && value.command.trim().length > 0;
973
974
  const hasUrl = typeof value.url === "string" && value.url.trim().length > 0;
@@ -3,6 +3,7 @@ import { init_logger } from "../utils/logger.js";
3
3
  import { claimNextConnectorLearningJob, enqueueConnectorLearningJob, listConnectorLearningJobs, recoverStaleConnectorLearningJobs, setConnectorLearningPaused, updateConnectorLearningJob } from "../storage/sqlite/connector-learning-repository.js";
4
4
  import { pruneBoundedKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
5
5
  import { getConnectorInstallation, listConnectorConnections, upsertConnectorConnection } from "../storage/sqlite/connector-repository.js";
6
+ import { getConnectorSyncPolicy } from "../storage/sqlite/connector-sync-policy-repository.js";
6
7
  import "../storage/sqlite/index.js";
7
8
  import { ComposioSessionsAdapter } from "./composio-sessions.js";
8
9
  import { getConnectorDefinition } from "./catalog.js";
@@ -34,6 +35,8 @@ function startConnectorLearningCoordinator(options) {
34
35
  if (!learningEnabled(options.getConfig())) return null;
35
36
  const connection = listConnectorConnections().find((item) => item.id === connectionId && item.status === "active");
36
37
  if (!connection) return null;
38
+ const syncPolicy = getConnectorSyncPolicy(connection.id);
39
+ if (request.reason !== "manual" && syncPolicy?.scanEnabled === false) return null;
37
40
  const definition = getConnectorDefinition(connection.connectorId);
38
41
  if (definition?.runtime.type !== "composio" || definition.runtime.role !== "toolkit") return null;
39
42
  if (!getConnectorLearningPlan(definition.runtime.toolkit)) return null;
@@ -141,7 +144,10 @@ function startConnectorLearningCoordinator(options) {
141
144
  finished: true
142
145
  }));
143
146
  pruneBoundedKnowledgeSourceItems(job.sourceInstanceId, Date.now() - plan.bootstrapWindowDays * 24 * 60 * 6e4);
144
- const nextRunAt = Date.now() + plan.intervalMinutes * 6e4;
147
+ const syncPolicy = getConnectorSyncPolicy(job.connectionId);
148
+ if (syncPolicy?.scanEnabled === false) return;
149
+ const intervalMinutes = syncPolicy?.intervalMinutes ?? plan.intervalMinutes;
150
+ const nextRunAt = Date.now() + intervalMinutes * 6e4;
145
151
  enqueueConnection(job.connectionId, {
146
152
  mode: "incremental",
147
153
  reason: "schedule",
@@ -0,0 +1,17 @@
1
+ import { ProactiveEventService } from '../proactive/service.js';
2
+ export type SourceChangePublishResult = {
3
+ published: number;
4
+ skipped: number;
5
+ sources: number;
6
+ };
7
+ export declare class ConnectedSourceChangePublisher {
8
+ private readonly eventService;
9
+ private readonly intervalMs;
10
+ private timer;
11
+ private running;
12
+ constructor(eventService: ProactiveEventService, intervalMs?: number);
13
+ start(): void;
14
+ stop(): void;
15
+ runNow(): Promise<SourceChangePublishResult>;
16
+ private publishSource;
17
+ }
@@ -0,0 +1,148 @@
1
+ import { createLogger } from "../utils/logger/index.js";
2
+ import { init_logger } from "../utils/logger.js";
3
+ import { getKnowledgeConsumerWatermark, getKnowledgeSourceItem, listKnowledgeSourceChanges, setKnowledgeConsumerWatermark } from "../storage/sqlite/knowledge-repository.js";
4
+ import { listConnectorConnections } from "../storage/sqlite/connector-repository.js";
5
+ import { getConnectorSyncPolicy } from "../storage/sqlite/connector-sync-policy-repository.js";
6
+ //#region src/connectors/source-change-publisher.ts
7
+ init_logger();
8
+ const log = createLogger("Connector:SourceChanges");
9
+ const CONSUMER_ID = "proactive-connected-source-v1";
10
+ function sensitivity(value) {
11
+ if (value === "regulated") return "restricted";
12
+ if (value === "secret") return "confidential";
13
+ return "personal";
14
+ }
15
+ function metadataString(metadata, key) {
16
+ const value = metadata[key];
17
+ return typeof value === "string" && value.trim() ? value : void 0;
18
+ }
19
+ var ConnectedSourceChangePublisher = class {
20
+ timer = null;
21
+ running = false;
22
+ constructor(eventService, intervalMs = 1e4) {
23
+ this.eventService = eventService;
24
+ this.intervalMs = intervalMs;
25
+ }
26
+ start() {
27
+ if (this.timer) return;
28
+ this.runNow();
29
+ this.timer = setInterval(() => void this.runNow(), Math.max(2e3, this.intervalMs));
30
+ this.timer.unref?.();
31
+ }
32
+ stop() {
33
+ if (this.timer) clearInterval(this.timer);
34
+ this.timer = null;
35
+ }
36
+ async runNow() {
37
+ if (this.running) return {
38
+ published: 0,
39
+ skipped: 0,
40
+ sources: 0
41
+ };
42
+ this.running = true;
43
+ const total = {
44
+ published: 0,
45
+ skipped: 0,
46
+ sources: 0
47
+ };
48
+ try {
49
+ const connections = listConnectorConnections({ principalId: "local-owner" }).filter((connection) => connection.status === "active");
50
+ for (const connection of connections) {
51
+ const sourceInstanceId = `composio:${connection.connectorId}:${connection.id}`;
52
+ try {
53
+ const result = this.publishSource(sourceInstanceId, connection.id);
54
+ total.published += result.published;
55
+ total.skipped += result.skipped;
56
+ total.sources += 1;
57
+ } catch (err) {
58
+ const em = err instanceof Error ? err.message : String(err);
59
+ log.warn({
60
+ err,
61
+ connectionId: connection.id,
62
+ sourceInstanceId
63
+ }, `Connected source change publication failed: ${em}`);
64
+ }
65
+ }
66
+ return total;
67
+ } finally {
68
+ this.running = false;
69
+ }
70
+ }
71
+ publishSource(sourceInstanceId, connectionId) {
72
+ const policy = getConnectorSyncPolicy(connectionId);
73
+ let watermark = getKnowledgeConsumerWatermark(CONSUMER_ID, sourceInstanceId);
74
+ const changes = listKnowledgeSourceChanges({
75
+ sourceInstanceId,
76
+ afterSequence: watermark,
77
+ limit: 250
78
+ });
79
+ let published = 0;
80
+ let skipped = 0;
81
+ for (const change of changes) {
82
+ const item = getKnowledgeSourceItem(change.sourceItemId);
83
+ if (!policy?.scanEnabled || !policy.proactiveEnabled || !item || item.sensitivity === "secret" || item.sensitivity === "regulated") {
84
+ skipped += 1;
85
+ watermark = change.sequence;
86
+ setKnowledgeConsumerWatermark(CONSUMER_ID, sourceInstanceId, watermark);
87
+ continue;
88
+ }
89
+ const workspaceId = metadataString(item.metadata, "workspaceId");
90
+ const connectorId = metadataString(item.metadata, "connectorId");
91
+ if (!workspaceId || !connectorId) {
92
+ skipped += 1;
93
+ watermark = change.sequence;
94
+ setKnowledgeConsumerWatermark(CONSUMER_ID, sourceInstanceId, watermark);
95
+ continue;
96
+ }
97
+ const eventType = change.kind === "added" ? "connected_source.item_created.v1" : change.kind === "deleted" ? "connected_source.item_deleted.v1" : "connected_source.item_updated.v1";
98
+ const agentId = metadataString(item.metadata, "agentId");
99
+ this.eventService.publish({
100
+ type: eventType,
101
+ schemaVersion: 1,
102
+ source: {
103
+ kind: "connector",
104
+ id: connectionId
105
+ },
106
+ subject: {
107
+ kind: "knowledge_source_item",
108
+ id: item.id
109
+ },
110
+ actor: {
111
+ kind: "integration",
112
+ id: connectorId
113
+ },
114
+ scope: {
115
+ workspaceId,
116
+ ...agentId ? { agentId } : {}
117
+ },
118
+ occurredAt: item.sourceUpdatedAt ?? item.occurredAt ?? change.changedAt,
119
+ dedupeKey: `knowledge-change:${change.sequence}`,
120
+ sensitivity: sensitivity(item.sensitivity),
121
+ payload: {
122
+ sourceInstanceId,
123
+ sourceItemId: item.id,
124
+ collectionScope: item.collectionScope,
125
+ itemType: item.itemType,
126
+ changeKind: change.kind,
127
+ contentHash: item.contentHash
128
+ }
129
+ });
130
+ published += 1;
131
+ watermark = change.sequence;
132
+ setKnowledgeConsumerWatermark(CONSUMER_ID, sourceInstanceId, watermark);
133
+ }
134
+ if (published > 0) log.info({
135
+ connectionId,
136
+ sourceInstanceId,
137
+ published,
138
+ skipped
139
+ }, "Connected source changes published");
140
+ return {
141
+ published,
142
+ skipped,
143
+ sources: 1
144
+ };
145
+ }
146
+ };
147
+ //#endregion
148
+ export { ConnectedSourceChangePublisher };