@xopcai/xopc 0.0.309 → 0.0.312

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 (500) hide show
  1. package/README.md +2 -1
  2. package/README.zh-CN.md +2 -1
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/extensions/telegram/xopc.extension.json +1 -1
  5. package/dist/gateway/static/root/assets/{activity-store-XKNYlFUI.js → activity-store-DVUTs1fk.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-1S2TFECE.js → agent-avatar-dicebear-BVIJMP8w.js} +1 -1
  7. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-K3hTmu9d.js +1 -0
  8. package/dist/gateway/static/root/assets/{agents-CPqUMtCL.js → agents-D6g_SeWI.js} +1 -1
  9. package/dist/gateway/static/root/assets/{api-BEUEE4f2.js → api-_aHQA8bd.js} +1 -1
  10. package/dist/gateway/static/root/assets/app-link-CKueEVbT.js +1 -0
  11. package/dist/gateway/static/root/assets/{app-management-settings-panel-CgVBSqzu.js → app-management-settings-panel-CLg_aXYG.js} +1 -1
  12. package/dist/gateway/static/root/assets/{appearance-settings-CoWdCokb.js → appearance-settings-CU52MfIT.js} +1 -1
  13. package/dist/gateway/static/root/assets/apps-page-ZpA1-6ad.js +1 -0
  14. package/dist/gateway/static/root/assets/{archive-plugin-C3ZA6LRS.js → archive-plugin-CHO3heHX.js} +1 -1
  15. package/dist/gateway/static/root/assets/{attachment-load-CdgS6_zy.js → attachment-load-BsmsBCI2.js} +1 -1
  16. package/dist/gateway/static/root/assets/{automations-page-BtHL2hpg.js → automations-page-CftigJlf.js} +1 -1
  17. package/dist/gateway/static/root/assets/automations-workspace-IEAxKRME.js +7 -0
  18. package/dist/gateway/static/root/assets/{binary-plugins-CiDhtq_H.js → binary-plugins-CRCLWBo2.js} +1 -1
  19. package/dist/gateway/static/root/assets/{block-editor-Br00T83w.js → block-editor-D0LDiOTT.js} +3 -3
  20. package/dist/gateway/static/root/assets/{browser-automation-inputs-D2tILykA.js → browser-automation-inputs-C611KRBx.js} +1 -1
  21. package/dist/gateway/static/root/assets/{browser-automations-page-BVuEmryB.js → browser-automations-page-Djyv3vy-.js} +2 -2
  22. package/dist/gateway/static/root/assets/browser-settings-page-CU4VWsmX.js +3 -0
  23. package/dist/gateway/static/root/assets/capabilities-settings-panel-C9XQk3HL.js +8 -0
  24. package/dist/gateway/static/root/assets/channels-settings-Bqlhjooi.js +1 -0
  25. package/dist/gateway/static/root/assets/{chat-terminal-dock-JsMtzDao.js → chat-terminal-dock-CIsKqdET.js} +2 -2
  26. package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-Cq1tE_3b.js → chunk-KS7C4IRE-BMYIfy9x.js} +2 -2
  27. package/dist/gateway/static/root/assets/computer-settings-page-C0YL9J7m.js +1 -0
  28. package/dist/gateway/static/root/assets/{connector-service-page-DZFNUTiN.js → connector-service-page-BmH17JnO.js} +1 -1
  29. package/dist/gateway/static/root/assets/connectors-page-zkx8Q-e6.js +2 -0
  30. package/dist/gateway/static/root/assets/date-picker-CDsfv8R0.js +1 -0
  31. package/dist/gateway/static/root/assets/{dependency-picker-B-BcuG1y.js → dependency-picker-DvhPj3CZ.js} +1 -1
  32. package/dist/gateway/static/root/assets/{desktop-pet-CdBBhhdY.js → desktop-pet-Cyg8XMpL.js} +1 -1
  33. package/dist/gateway/static/root/assets/desktop-pet-settings-CE4GOlMM.js +1 -0
  34. package/dist/gateway/static/root/assets/device-pairing-wizard-CdKJqnnw.js +1 -0
  35. package/dist/gateway/static/root/assets/{extension-debug-page-BFp5eKtY.js → extension-debug-page-D-AVJU3q.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-page-DL3vyyH6.js → extension-page-DrFoQ9xt.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-settings-page-BXtvdAsY.js → extension-settings-page-DxWjESC1.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-config-swr-xAOGtenO.js → gateway-config-swr-DUDX42qY.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-realtime-BuaTsMSi.js → gateway-realtime-CGOW0-b4.js} +1 -1
  40. package/dist/gateway/static/root/assets/gateway-realtime-store-D4um_sV7.js +1 -0
  41. package/dist/gateway/static/root/assets/gateway-settings-CgXp2zq4.js +1 -0
  42. package/dist/gateway/static/root/assets/{gateway-startup-retry-BwDxKHd4.js → gateway-startup-retry-Cf8OxlvY.js} +1 -1
  43. package/dist/gateway/static/root/assets/home-page-D6Idk732.js +1 -0
  44. package/dist/gateway/static/root/assets/{image-generation-api-wGMeI_yW.js → image-generation-api-D2YorS--.js} +1 -1
  45. package/dist/gateway/static/root/assets/{imports-page-zexFT5Rq.js → imports-page-BKucJlXI.js} +1 -1
  46. package/dist/gateway/static/root/assets/index-1wIKA-kM.css +1 -0
  47. package/dist/gateway/static/root/assets/index-PFQHPGgi.js +79 -0
  48. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CutG9zLh.js → keyboard-shortcuts-settings-BxLXD-yU.js} +1 -1
  49. package/dist/gateway/static/root/assets/local-app-workbench-page-BmAqTRb4.js +2 -0
  50. package/dist/gateway/static/root/assets/{local-apps-page-CJy6I7Dt.js → local-apps-page-BAsQJQKJ.js} +1 -1
  51. package/dist/gateway/static/root/assets/{locale-store-DPZ79W1-.js → locale-store-DA0Z5jM_.js} +1 -1
  52. package/dist/gateway/static/root/assets/{logs-page-egGcPHNi.js → logs-page-ZjVYXXyM.js} +2 -2
  53. package/dist/gateway/static/root/assets/{management-settings-BQhIOELc.js → management-settings-CSTkYVOZ.js} +1 -1
  54. package/dist/gateway/static/root/assets/markdown-view-DSjfHfaW.css +1 -0
  55. package/dist/gateway/static/root/assets/{markdown-view-p2P5hP1U.js → markdown-view-DYGPxPee.js} +1 -1
  56. package/dist/gateway/static/root/assets/{media-plugins-CsBylqlN.js → media-plugins-CQtQzLyg.js} +1 -1
  57. package/dist/gateway/static/root/assets/messages-4BtQKYlM.js +3 -0
  58. package/dist/gateway/static/root/assets/note-detail-panel-DuXCt-MM.js +5 -0
  59. package/dist/gateway/static/root/assets/notes-page-BjOgBVq5.js +8 -0
  60. package/dist/gateway/static/root/assets/{page-tabs-ChQ4jJFs.js → page-tabs-B6DjkyMM.js} +1 -1
  61. package/dist/gateway/static/root/assets/{popover-select-9i-ZtHXL.js → popover-select-B-GDnZO9.js} +1 -1
  62. package/dist/gateway/static/root/assets/preview-open-alternatives-Dn57uLhr.js +1 -0
  63. package/dist/gateway/static/root/assets/product-delivery-CrAI8ZEa.js +1 -0
  64. package/dist/gateway/static/root/assets/{product-open-page-BADxWEdP.js → product-open-page-H2YMk8TY.js} +1 -1
  65. package/dist/gateway/static/root/assets/project-detail-page-0zi4-i9X.js +1 -0
  66. package/dist/gateway/static/root/assets/projects-page-B18OxmJj.js +1 -0
  67. package/dist/gateway/static/root/assets/{registry-api-B_e_nZSN.js → registry-api-C0DCx3wv.js} +1 -1
  68. package/dist/gateway/static/root/assets/remote-access-hub-z-DxbuaE.js +1 -0
  69. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-D-pwiIyp.js → runtime-tools-settings-panel-DGsBTbo6.js} +2 -2
  70. package/dist/gateway/static/root/assets/scenes-page-Bgba03B_.js +1 -0
  71. package/dist/gateway/static/root/assets/{schema-form-IWmb05DX.js → schema-form-CblI9WUA.js} +1 -1
  72. package/dist/gateway/static/root/assets/sessions-page-B1t3bMsm.js +1 -0
  73. package/dist/gateway/static/root/assets/settings-advanced-gate-CBX0Ezhf.js +1 -0
  74. package/dist/gateway/static/root/assets/{settings-form-section-B0veRBZs.js → settings-form-section-BAaVyxJH.js} +1 -1
  75. package/dist/gateway/static/root/assets/settings-page-CKNPbm5q.js +1 -0
  76. package/dist/gateway/static/root/assets/settings-page-layout-DqNCGKxQ.js +1 -0
  77. package/dist/gateway/static/root/assets/{settings-shell-layer-context-DCp6ykjQ.js → settings-shell-layer-context-BTQUDoJ2.js} +1 -1
  78. package/dist/gateway/static/root/assets/setup-status-panel-Bw71C2X3.js +1 -0
  79. package/dist/gateway/static/root/assets/{share-preview-page-CirpgkfD.js → share-preview-page-BzMfp_HM.js} +1 -1
  80. package/dist/gateway/static/root/assets/shares-settings-BoVDQolc.js +1 -0
  81. package/dist/gateway/static/root/assets/skill-reload-api-DtTptpAt.js +1 -0
  82. package/dist/gateway/static/root/assets/skills-page-DIht92q6.js +2 -0
  83. package/dist/gateway/static/root/assets/{skills-page.utils-B42mpWKV.js → skills-page.utils-DLYRiEn3.js} +1 -1
  84. package/dist/gateway/static/root/assets/system-settings-panel-yYs4YgYk.js +1 -0
  85. package/dist/gateway/static/root/assets/task-detail-page-vgkiGo-D.js +1 -0
  86. package/dist/gateway/static/root/assets/{theme-store-BFbj_2Tu.js → theme-store-CegIlB8d.js} +1 -1
  87. package/dist/gateway/static/root/assets/tunnel-api-BasDYxvx.js +1 -0
  88. package/dist/gateway/static/root/assets/use-autosave-CWAUHhcb.js +1 -0
  89. package/dist/gateway/static/root/assets/user-model-page-CAGafNfP.js +2 -0
  90. package/dist/gateway/static/root/assets/{voice-api-key-field-BZbKQ8HT.js → voice-api-key-field-Kc4UlxZs.js} +1 -1
  91. package/dist/gateway/static/root/assets/{voice-config-api-SKCeQLrH.js → voice-config-api-DTyMdGOR.js} +1 -1
  92. package/dist/gateway/static/root/assets/{work-discovery-overlay-BRVTTXNG.js → work-discovery-overlay-BPC_c9dO.js} +1 -1
  93. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D2kuwv5e.js → workflow-run-setup-panel-DBTciOrq.js} +2 -2
  94. package/dist/gateway/static/root/assets/workflows-page-CSxHVs1p.js +6 -0
  95. package/dist/gateway/static/root/connector-icons/SOURCES.md +0 -2
  96. package/dist/gateway/static/root/index.html +18 -21
  97. package/dist/gateway/static/root/notification-sw.js +1 -1
  98. package/dist/package.js +1 -1
  99. package/dist/packages/gateway-contract/src/notifications.js +12 -11
  100. package/dist/packages/gateway-contract/src/proactive.js +6 -6
  101. package/dist/packages/gateway-contract/src/product-delivery.js +1 -0
  102. package/dist/packages/gateway-contract/src/project-monitoring.js +4 -4
  103. package/dist/packages/gateway-contract/src/project-operating.js +1 -4
  104. package/dist/src/agent/agent-manager.d.ts +2 -6
  105. package/dist/src/agent/agent-manager.js +2 -1
  106. package/dist/src/agent/background-review/run-background-review.js +1 -1
  107. package/dist/src/agent/commands/command-registry.js +1 -1
  108. package/dist/src/agent/context/execution-scope.js +1 -1
  109. package/dist/src/agent/external-tools/cliProvider.d.ts +47 -0
  110. package/dist/src/agent/external-tools/cliProvider.js +317 -0
  111. package/dist/src/agent/external-tools/composio-provider.js +3 -3
  112. package/dist/src/agent/external-tools/gateway-tools.js +8 -2
  113. package/dist/src/agent/external-tools/index.js +6 -0
  114. package/dist/src/agent/external-tools/service.js +1 -1
  115. package/dist/src/agent/external-tools/types.d.ts +1 -1
  116. package/dist/src/agent/external-tools/types.js +1 -0
  117. package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
  118. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
  119. package/dist/src/agent/memory/turn-provenance.js +2 -1
  120. package/dist/src/agent/service/parse-outbound-session-key.js +1 -1
  121. package/dist/src/agent/service.js +1 -0
  122. package/dist/src/agent/service.types.d.ts +2 -0
  123. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  124. package/dist/src/agent/tool-manuals/xopc-use.js +43 -16
  125. package/dist/src/agent/tools/factory.d.ts +2 -0
  126. package/dist/src/agent/tools/factory.js +3 -2
  127. package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +20 -0
  128. package/dist/src/agent/tools/search/providers/xopc-cloud.js +56 -0
  129. package/dist/src/agent/tools/search/registry.d.ts +4 -2
  130. package/dist/src/agent/tools/search/registry.js +5 -3
  131. package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
  132. package/dist/src/agent/tools/xopc-use-tool.js +104 -44
  133. package/dist/src/automations/service/automation-service.d.ts +0 -4
  134. package/dist/src/automations/service/automation-service.js +0 -31
  135. package/dist/src/capabilities/store-connector.js +46 -0
  136. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  137. package/dist/src/cli/commands/project.js +1 -1
  138. package/dist/src/config/index.js +2 -2
  139. package/dist/src/config/schema.d.ts +13 -4
  140. package/dist/src/config/schema.js +10 -14
  141. package/dist/src/config/web-patch.js +0 -5
  142. package/dist/src/connectors/account-selection.d.ts +14 -0
  143. package/dist/src/connectors/account-selection.js +26 -0
  144. package/dist/src/connectors/china-catalog.js +93 -226
  145. package/dist/src/connectors/cli/adapterRegistry.d.ts +4 -0
  146. package/dist/src/connectors/cli/adapterRegistry.js +26 -0
  147. package/dist/src/connectors/cli/adapters/lark.d.ts +2 -0
  148. package/dist/src/connectors/cli/adapters/lark.js +143 -0
  149. package/dist/src/connectors/cli/adapters/larkShortcuts.d.ts +3 -0
  150. package/dist/src/connectors/cli/adapters/larkShortcuts.js +64 -0
  151. package/dist/src/connectors/cli/adapters/wecom.d.ts +2 -0
  152. package/dist/src/connectors/cli/adapters/wecom.js +97 -0
  153. package/dist/src/connectors/cli/adapters/wps365/bundle.js +575 -0
  154. package/dist/src/connectors/cli/adapters/wps365.d.ts +2 -0
  155. package/dist/src/connectors/cli/adapters/wps365.js +115 -0
  156. package/dist/src/connectors/cli/assets.d.ts +3 -0
  157. package/dist/src/connectors/cli/assets.js +44 -0
  158. package/dist/src/connectors/cli/authorization.d.ts +16 -0
  159. package/dist/src/connectors/cli/authorization.js +184 -0
  160. package/dist/src/connectors/cli/distributions.d.ts +4 -0
  161. package/dist/src/connectors/cli/distributions.js +69 -0
  162. package/dist/src/connectors/cli/installer.d.ts +5 -0
  163. package/dist/src/connectors/cli/installer.js +102 -0
  164. package/dist/src/connectors/cli/lifecycle.d.ts +1 -0
  165. package/dist/src/connectors/cli/lifecycle.js +19 -0
  166. package/dist/src/connectors/cli/process.d.ts +18 -0
  167. package/dist/src/connectors/cli/process.js +100 -0
  168. package/dist/src/connectors/cli/protocol.d.ts +10 -0
  169. package/dist/src/connectors/cli/protocol.js +63 -0
  170. package/dist/src/connectors/cli/runtime.d.ts +10 -0
  171. package/dist/src/connectors/cli/runtime.js +93 -0
  172. package/dist/src/connectors/cli/store.d.ts +35 -0
  173. package/dist/src/connectors/cli/store.js +121 -0
  174. package/dist/src/connectors/cli/types.d.ts +73 -0
  175. package/dist/src/connectors/composio-backends.js +1 -1
  176. package/dist/src/connectors/composio-sessions.d.ts +1 -0
  177. package/dist/src/connectors/composio-sessions.js +8 -3
  178. package/dist/src/connectors/composio.js +1 -1
  179. package/dist/src/connectors/connection-candidates.js +22 -3
  180. package/dist/src/connectors/connection-recovery-service.d.ts +1 -0
  181. package/dist/src/connectors/connection-recovery-service.js +53 -8
  182. package/dist/src/connectors/health.js +52 -0
  183. package/dist/src/connectors/instances.js +5 -1
  184. package/dist/src/connectors/lifecycle.js +2 -0
  185. package/dist/src/connectors/principal.js +2 -1
  186. package/dist/src/connectors/runtime-adapter-registry.js +31 -0
  187. package/dist/src/connectors/types.d.ts +13 -1
  188. package/dist/src/connectors/usage.js +1 -1
  189. package/dist/src/connectors/workflow-preflight.js +8 -4
  190. package/dist/src/extensions/install.js +1 -1
  191. package/dist/src/gateway/hono/app.d.ts +2 -0
  192. package/dist/src/gateway/hono/app.js +4 -2
  193. package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -15
  194. package/dist/src/gateway/hono/lib/config-payload.js +1 -11
  195. package/dist/src/gateway/hono/routes/cli-connectors.d.ts +3 -0
  196. package/dist/src/gateway/hono/routes/cli-connectors.js +219 -0
  197. package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +2 -2
  198. package/dist/src/gateway/hono/routes/config-patch/gateway.js +0 -59
  199. package/dist/src/gateway/hono/routes/config.js +0 -16
  200. package/dist/src/gateway/hono/routes/connectors.js +21 -22
  201. package/dist/src/gateway/hono/routes/deps.d.ts +2 -0
  202. package/dist/src/gateway/hono/routes/lazy-bundles.js +4 -17
  203. package/dist/src/gateway/hono/routes/projects.js +1 -1
  204. package/dist/src/gateway/hono/routes/public-gateway.js +0 -1
  205. package/dist/src/gateway/hono/routes/scenes.d.ts +3 -0
  206. package/dist/src/gateway/hono/routes/scenes.js +142 -0
  207. package/dist/src/gateway/hono/routes/tasks.js +0 -46
  208. package/dist/src/gateway/hono/routes/user-model.js +54 -1
  209. package/dist/src/gateway/scenes/browserNotifications.d.ts +4 -0
  210. package/dist/src/gateway/scenes/browserNotifications.js +54 -0
  211. package/dist/src/gateway/scenes/host.d.ts +34 -0
  212. package/dist/src/gateway/scenes/host.js +130 -0
  213. package/dist/src/gateway/scenes/mailContext.d.ts +32 -0
  214. package/dist/src/gateway/scenes/mailContext.js +235 -0
  215. package/dist/src/gateway/security/gateway-scopes.js +0 -4
  216. package/dist/src/gateway/security/index.js +1 -1
  217. package/dist/src/gateway/service/config-coordinator.d.ts +1 -10
  218. package/dist/src/gateway/service/config-coordinator.js +0 -16
  219. package/dist/src/gateway/service/run-gateway-agent.js +1 -1
  220. package/dist/src/gateway/service.d.ts +4 -25
  221. package/dist/src/gateway/service.js +44 -99
  222. package/dist/src/gateway/session-context-summary.js +2 -1
  223. package/dist/src/heartbeat/index.js +1 -1
  224. package/dist/src/infra/unhandled-rejections.js +1 -1
  225. package/dist/src/migrations/runner.js +1 -4
  226. package/dist/src/notifications/browser-endpoint.d.ts +2 -0
  227. package/dist/src/notifications/browser-endpoint.js +13 -0
  228. package/dist/src/notifications/browserSubscriptions.d.ts +20 -0
  229. package/dist/src/notifications/browserSubscriptions.js +59 -0
  230. package/dist/src/notifications/browserTransport.d.ts +9 -0
  231. package/dist/src/notifications/browserTransport.js +64 -0
  232. package/dist/src/notifications/dispatch.d.ts +46 -0
  233. package/dist/src/notifications/dispatch.js +109 -0
  234. package/dist/src/notifications/domain-delivery.d.ts +21 -0
  235. package/dist/src/notifications/planner.js +0 -36
  236. package/dist/src/notifications/quietHours.d.ts +6 -0
  237. package/dist/src/notifications/quietHours.js +23 -0
  238. package/dist/src/notifications/resultOutbox.d.ts +23 -0
  239. package/dist/src/notifications/resultOutbox.js +49 -0
  240. package/dist/src/notifications/service.d.ts +18 -4
  241. package/dist/src/notifications/service.js +42 -61
  242. package/dist/src/notifications/store.d.ts +2 -1
  243. package/dist/src/notifications/store.js +7 -8
  244. package/dist/src/projects/project-service.d.ts +1 -4
  245. package/dist/src/projects/project-service.js +2 -30
  246. package/dist/src/projects/workspace.js +1 -1
  247. package/dist/src/providers/model-catalog-persistence.js +19 -1
  248. package/dist/src/providers/model-catalog-store.js +1 -0
  249. package/dist/src/providers/model-catalog-types.d.ts +17 -0
  250. package/dist/src/providers/xopc-cloud-model-source.js +27 -0
  251. package/dist/src/scenes/agentExecutor.d.ts +8 -0
  252. package/dist/src/scenes/agentExecutor.js +63 -0
  253. package/dist/src/scenes/contracts.d.ts +118 -0
  254. package/dist/src/scenes/contracts.js +145 -0
  255. package/dist/src/scenes/execution.d.ts +56 -0
  256. package/dist/src/scenes/execution.js +168 -0
  257. package/dist/src/scenes/httpServices.d.ts +34 -0
  258. package/dist/src/scenes/inbox.d.ts +16 -0
  259. package/dist/src/scenes/inbox.js +68 -0
  260. package/dist/src/scenes/mailContext.d.ts +20 -0
  261. package/dist/src/scenes/mailContext.js +106 -0
  262. package/dist/src/scenes/mailObservations.d.ts +20 -0
  263. package/dist/src/scenes/mailObservations.js +107 -0
  264. package/dist/src/scenes/maintenance.d.ts +3 -0
  265. package/dist/src/scenes/maintenance.js +24 -0
  266. package/dist/src/scenes/metrics.d.ts +37 -0
  267. package/dist/src/scenes/metrics.js +100 -0
  268. package/dist/src/scenes/model.d.ts +3 -0
  269. package/dist/src/scenes/model.js +10 -0
  270. package/dist/src/scenes/notificationEligibility.d.ts +17 -0
  271. package/dist/src/scenes/notificationEligibility.js +72 -0
  272. package/dist/src/scenes/notificationPublication.d.ts +7 -0
  273. package/dist/src/scenes/notificationPublication.js +43 -0
  274. package/dist/src/scenes/preferences.d.ts +40 -0
  275. package/dist/src/scenes/preferences.js +108 -0
  276. package/dist/src/scenes/readiness.d.ts +7 -0
  277. package/dist/src/scenes/readiness.js +20 -0
  278. package/dist/src/scenes/repository.d.ts +174 -0
  279. package/dist/src/scenes/repository.js +740 -0
  280. package/dist/src/scenes/resultNotifications.d.ts +17 -0
  281. package/dist/src/scenes/resultNotifications.js +204 -0
  282. package/dist/src/scenes/runtime.d.ts +25 -0
  283. package/dist/src/scenes/runtime.js +101 -0
  284. package/dist/src/scenes/schedule.d.ts +9 -0
  285. package/dist/src/scenes/schedule.js +45 -0
  286. package/dist/src/scenes/service.d.ts +29 -0
  287. package/dist/src/scenes/service.js +116 -0
  288. package/dist/src/scenes/templates.d.ts +64 -0
  289. package/dist/src/scenes/templates.js +76 -0
  290. package/dist/src/scenes/userNotes.d.ts +10 -0
  291. package/dist/src/scenes/userNotes.js +34 -0
  292. package/dist/src/session/resolve-session.js +2 -1
  293. package/dist/src/session/store.js +2 -1
  294. package/dist/src/share/share-config.js +0 -5
  295. package/dist/src/share/site-share-config.js +0 -5
  296. package/dist/src/storage/sqlite/connection-wait-repository.js +20 -7
  297. package/dist/src/storage/sqlite/connection.js +1 -1
  298. package/dist/src/storage/sqlite/connector-account-repository.js +1 -0
  299. package/dist/src/storage/sqlite/connector-sync-policy-repository.d.ts +0 -4
  300. package/dist/src/storage/sqlite/connector-sync-policy-repository.js +3 -17
  301. package/dist/src/storage/sqlite/conversation-repository.js +2 -1
  302. package/dist/src/storage/sqlite/index.js +2 -1
  303. package/dist/src/storage/sqlite/migrations/187_cli_connectors.sql +34 -0
  304. package/dist/src/storage/sqlite/migrations/188_scene_storage.sql +2 -0
  305. package/dist/src/storage/sqlite/migrations/189_scene_source_health.sql +8 -0
  306. package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +2 -0
  307. package/dist/src/storage/sqlite/migrations/conversation-backup.js +7 -3
  308. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  309. package/dist/src/storage/sqlite/migrations/runner.js +20 -44
  310. package/dist/src/storage/sqlite/migrations/scene-reset.d.ts +5 -0
  311. package/dist/src/storage/sqlite/migrations/scene-reset.js +40 -0
  312. package/dist/src/storage/sqlite/scenes-schema.d.ts +8 -0
  313. package/dist/src/storage/sqlite/scenes-schema.js +61 -0
  314. package/dist/src/storage/sqlite/schema.js +4 -10
  315. package/dist/src/storage/sqlite/schemas/notifications.sql +65 -0
  316. package/dist/src/storage/sqlite/schemas/scenes.sql +212 -0
  317. package/dist/src/storage/sqlite/session-read-repository.d.ts +8 -0
  318. package/dist/src/storage/sqlite/session-read-repository.js +35 -0
  319. package/dist/src/storage/sqlite/session-repository.d.ts +1 -1
  320. package/dist/src/storage/sqlite/session-repository.js +2 -25
  321. package/dist/src/storage/sqlite/sql-assets.d.ts +2 -0
  322. package/dist/src/storage/sqlite/sql-assets.js +18 -0
  323. package/dist/src/storage/sqlite/transaction.d.ts +2 -0
  324. package/dist/src/storage/sqlite/transaction.js +20 -1
  325. package/dist/src/tasks/home-query-service.d.ts +0 -2
  326. package/dist/src/tasks/home-query-service.js +13 -43
  327. package/dist/src/tasks/index.d.ts +0 -1
  328. package/dist/src/tasks/index.js +4 -5
  329. package/dist/src/tasks/project-operating-view-service.js +1 -4
  330. package/dist/src/tui/backends/embedded-backend.js +1 -1
  331. package/dist/src/tui/tui-commands.js +1 -1
  332. package/dist/src/user-model/goals.d.ts +10 -0
  333. package/dist/src/user-model/goals.js +29 -1
  334. package/dist/src/user-model/index.js +2 -2
  335. package/dist/src/voice/realtime/memory-context.js +2 -1
  336. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  337. package/package.json +5 -3
  338. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-f0-YFMUz.js +0 -1
  339. package/dist/gateway/static/root/assets/api-CN4id43t.js +0 -1
  340. package/dist/gateway/static/root/assets/app-link-BiBXVEvp.js +0 -1
  341. package/dist/gateway/static/root/assets/apps-page-CexHOcWg.js +0 -1
  342. package/dist/gateway/static/root/assets/automations-workspace-onJPfmO6.js +0 -6
  343. package/dist/gateway/static/root/assets/browser-settings-page-BgVTyPFY.js +0 -3
  344. package/dist/gateway/static/root/assets/capabilities-settings-panel-Dra8wj1S.js +0 -8
  345. package/dist/gateway/static/root/assets/channels-settings-CkxiMDJ4.js +0 -1
  346. package/dist/gateway/static/root/assets/channels-status-swr-Dtder4G_.js +0 -1
  347. package/dist/gateway/static/root/assets/computer-settings-page-DHerePwo.js +0 -1
  348. package/dist/gateway/static/root/assets/connectors-page-cl9ZrV4D.js +0 -2
  349. package/dist/gateway/static/root/assets/cron-expression-DAhdv_Xv.js +0 -2
  350. package/dist/gateway/static/root/assets/date-picker-PacO1m3a.js +0 -1
  351. package/dist/gateway/static/root/assets/desktop-pet-settings-Gy03NgMI.js +0 -1
  352. package/dist/gateway/static/root/assets/device-pairing-wizard-aV25nKag.js +0 -1
  353. package/dist/gateway/static/root/assets/external-link-DjqjBmc3.js +0 -1
  354. package/dist/gateway/static/root/assets/gateway-realtime-store-BG95uGVW.js +0 -1
  355. package/dist/gateway/static/root/assets/gateway-settings-Dcr2Ikeh.js +0 -1
  356. package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +0 -1
  357. package/dist/gateway/static/root/assets/heartbeat-settings-DOy3alvT.js +0 -1
  358. package/dist/gateway/static/root/assets/home-page-CDm3dGVy.js +0 -1
  359. package/dist/gateway/static/root/assets/index-D-vczw_0.css +0 -1
  360. package/dist/gateway/static/root/assets/index-DJo4DimT.js +0 -79
  361. package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +0 -1
  362. package/dist/gateway/static/root/assets/local-app-workbench-page-CwLvTwjn.js +0 -2
  363. package/dist/gateway/static/root/assets/markdown-view-Y68dCxuc.css +0 -1
  364. package/dist/gateway/static/root/assets/messages-BiYTyLJr.js +0 -3
  365. package/dist/gateway/static/root/assets/note-detail-panel-c2k5Uz6X.js +0 -5
  366. package/dist/gateway/static/root/assets/notes-page-BLQWJMhf.js +0 -8
  367. package/dist/gateway/static/root/assets/preview-open-alternatives-9B5W7nVE.js +0 -1
  368. package/dist/gateway/static/root/assets/proactive-page-iOjI0d_e.js +0 -1
  369. package/dist/gateway/static/root/assets/product-delivery-CCC4FJ3Y.js +0 -1
  370. package/dist/gateway/static/root/assets/project-detail-page-BcxbQn2M.js +0 -1
  371. package/dist/gateway/static/root/assets/projects-page-BuSvld0O.js +0 -1
  372. package/dist/gateway/static/root/assets/remote-access-hub-CFS8LQKW.js +0 -1
  373. package/dist/gateway/static/root/assets/sessions-page-DZjc__ok.js +0 -1
  374. package/dist/gateway/static/root/assets/settings-advanced-gate-C1SM5B93.js +0 -1
  375. package/dist/gateway/static/root/assets/settings-page-CxRWyWYe.js +0 -1
  376. package/dist/gateway/static/root/assets/settings-page-layout-X1x-2Cp9.js +0 -1
  377. package/dist/gateway/static/root/assets/setup-status-panel-D9Rl7Tec.js +0 -1
  378. package/dist/gateway/static/root/assets/shares-settings-CwCThBs0.js +0 -1
  379. package/dist/gateway/static/root/assets/skill-reload-api-DG6VGbOX.js +0 -1
  380. package/dist/gateway/static/root/assets/skills-page-BdRJ2vnL.js +0 -2
  381. package/dist/gateway/static/root/assets/system-settings-panel-DXIZpAvU.js +0 -1
  382. package/dist/gateway/static/root/assets/task-detail-page-QXo9LJly.js +0 -1
  383. package/dist/gateway/static/root/assets/tunnel-api-Db2guRdW.js +0 -1
  384. package/dist/gateway/static/root/assets/use-autosave-DDY9qoXZ.js +0 -1
  385. package/dist/gateway/static/root/assets/user-model-page-CzPmMkaO.js +0 -2
  386. package/dist/gateway/static/root/assets/workflows-page-CQXtiYtq.js +0 -6
  387. package/dist/gateway/static/root/connector-icons/wps-calendar.svg +0 -14
  388. package/dist/gateway/static/root/connector-icons/wps-mail.svg +0 -7
  389. package/dist/src/connectors/source-change-publisher.d.ts +0 -17
  390. package/dist/src/connectors/source-change-publisher.js +0 -151
  391. package/dist/src/gateway/heartbeat/check-store.d.ts +0 -18
  392. package/dist/src/gateway/heartbeat/check-store.js +0 -74
  393. package/dist/src/gateway/heartbeat/index.d.ts +0 -1
  394. package/dist/src/gateway/heartbeat/index.js +0 -2
  395. package/dist/src/gateway/heartbeat/service.d.ts +0 -55
  396. package/dist/src/gateway/heartbeat/service.js +0 -228
  397. package/dist/src/gateway/hono/routes/proactive-control.d.ts +0 -3
  398. package/dist/src/gateway/hono/routes/proactive-control.js +0 -135
  399. package/dist/src/gateway/hono/routes/proactive.d.ts +0 -4
  400. package/dist/src/gateway/hono/routes/proactive.js +0 -164
  401. package/dist/src/gateway/hono/routes/workspace.d.ts +0 -3
  402. package/dist/src/gateway/hono/routes/workspace.js +0 -62
  403. package/dist/src/gateway/workspace-heartbeat-path.d.ts +0 -3
  404. package/dist/src/gateway/workspace-heartbeat-path.js +0 -14
  405. package/dist/src/migrations/conversation-routing-config.d.ts +0 -2
  406. package/dist/src/migrations/conversation-routing-config.js +0 -42
  407. package/dist/src/notifications/proactive-channel.d.ts +0 -8
  408. package/dist/src/notifications/proactive-channel.js +0 -60
  409. package/dist/src/notifications/proactive-policy.d.ts +0 -3
  410. package/dist/src/notifications/proactive-policy.js +0 -35
  411. package/dist/src/notifications/web-push.d.ts +0 -19
  412. package/dist/src/notifications/web-push.js +0 -185
  413. package/dist/src/proactive/actions/service.d.ts +0 -1
  414. package/dist/src/proactive/actions/service.js +0 -82
  415. package/dist/src/proactive/events/envelope.d.ts +0 -2
  416. package/dist/src/proactive/events/envelope.js +0 -54
  417. package/dist/src/proactive/events/product-event-bridge.d.ts +0 -7
  418. package/dist/src/proactive/events/product-event-bridge.js +0 -87
  419. package/dist/src/proactive/events/publisher.d.ts +0 -4
  420. package/dist/src/proactive/events/repository.d.ts +0 -9
  421. package/dist/src/proactive/events/repository.js +0 -63
  422. package/dist/src/proactive/events/types.d.ts +0 -44
  423. package/dist/src/proactive/events/types.js +0 -15
  424. package/dist/src/proactive/execution/agent-executor.d.ts +0 -21
  425. package/dist/src/proactive/execution/agent-executor.js +0 -125
  426. package/dist/src/proactive/execution/authorization.d.ts +0 -7
  427. package/dist/src/proactive/execution/authorization.js +0 -71
  428. package/dist/src/proactive/execution/context.d.ts +0 -49
  429. package/dist/src/proactive/execution/context.js +0 -408
  430. package/dist/src/proactive/execution/insight.d.ts +0 -14
  431. package/dist/src/proactive/execution/insight.js +0 -132
  432. package/dist/src/proactive/execution/repository.d.ts +0 -28
  433. package/dist/src/proactive/execution/repository.js +0 -211
  434. package/dist/src/proactive/execution/types.d.ts +0 -80
  435. package/dist/src/proactive/execution/worker.d.ts +0 -15
  436. package/dist/src/proactive/execution/worker.js +0 -146
  437. package/dist/src/proactive/experience.d.ts +0 -89
  438. package/dist/src/proactive/experience.js +0 -195
  439. package/dist/src/proactive/follow-ups.d.ts +0 -128
  440. package/dist/src/proactive/follow-ups.js +0 -182
  441. package/dist/src/proactive/inbox/cards.d.ts +0 -21
  442. package/dist/src/proactive/inbox/cards.js +0 -276
  443. package/dist/src/proactive/inbox/delivery.d.ts +0 -6
  444. package/dist/src/proactive/inbox/delivery.js +0 -54
  445. package/dist/src/proactive/inbox/digest.d.ts +0 -8
  446. package/dist/src/proactive/inbox/digest.js +0 -123
  447. package/dist/src/proactive/inbox/lifecycle.d.ts +0 -4
  448. package/dist/src/proactive/inbox/lifecycle.js +0 -62
  449. package/dist/src/proactive/inbox/notification-policy.d.ts +0 -1
  450. package/dist/src/proactive/inbox/notification-policy.js +0 -25
  451. package/dist/src/proactive/inbox/repository.d.ts +0 -25
  452. package/dist/src/proactive/inbox/repository.js +0 -244
  453. package/dist/src/proactive/inbox/service.d.ts +0 -23
  454. package/dist/src/proactive/inbox/service.js +0 -46
  455. package/dist/src/proactive/inbox/types.d.ts +0 -64
  456. package/dist/src/proactive/inbox/worker.d.ts +0 -13
  457. package/dist/src/proactive/inbox/worker.js +0 -71
  458. package/dist/src/proactive/index.d.ts +0 -20
  459. package/dist/src/proactive/index.js +0 -14
  460. package/dist/src/proactive/mail-thread.d.ts +0 -13
  461. package/dist/src/proactive/mail-thread.js +0 -55
  462. package/dist/src/proactive/maintenance.d.ts +0 -4
  463. package/dist/src/proactive/maintenance.js +0 -28
  464. package/dist/src/proactive/metrics.d.ts +0 -10
  465. package/dist/src/proactive/metrics.js +0 -28
  466. package/dist/src/proactive/policy/presence.d.ts +0 -2
  467. package/dist/src/proactive/policy/presence.js +0 -30
  468. package/dist/src/proactive/policy/service.d.ts +0 -54
  469. package/dist/src/proactive/policy/service.js +0 -123
  470. package/dist/src/proactive/routing/batch-repository.d.ts +0 -27
  471. package/dist/src/proactive/routing/batch-repository.js +0 -57
  472. package/dist/src/proactive/routing/matcher.d.ts +0 -5
  473. package/dist/src/proactive/routing/matcher.js +0 -57
  474. package/dist/src/proactive/routing/types.d.ts +0 -44
  475. package/dist/src/proactive/routing/types.js +0 -1
  476. package/dist/src/proactive/scenarios/control.d.ts +0 -52
  477. package/dist/src/proactive/scenarios/control.js +0 -75
  478. package/dist/src/proactive/scenarios/prompt-composer.d.ts +0 -14
  479. package/dist/src/proactive/scenarios/prompt-composer.js +0 -26
  480. package/dist/src/proactive/scenarios/repository.d.ts +0 -23
  481. package/dist/src/proactive/scenarios/repository.js +0 -174
  482. package/dist/src/proactive/scenarios/service.d.ts +0 -15
  483. package/dist/src/proactive/scenarios/service.js +0 -26
  484. package/dist/src/proactive/scenarios/types.d.ts +0 -43
  485. package/dist/src/proactive/scenarios/types.js +0 -1
  486. package/dist/src/proactive/service.d.ts +0 -25
  487. package/dist/src/proactive/service.js +0 -78
  488. package/dist/src/proactive/source-freshness.d.ts +0 -8
  489. package/dist/src/proactive/source-freshness.js +0 -28
  490. package/dist/src/proactive/status.d.ts +0 -2
  491. package/dist/src/proactive/status.js +0 -22
  492. package/dist/src/proactive/temporal/schedule.d.ts +0 -3
  493. package/dist/src/proactive/temporal/schedule.js +0 -68
  494. package/dist/src/proactive/temporal/worker.d.ts +0 -17
  495. package/dist/src/proactive/temporal/worker.js +0 -129
  496. package/dist/src/tasks/project-monitoring-service.d.ts +0 -32
  497. package/dist/src/tasks/project-monitoring-service.js +0 -118
  498. /package/dist/src/{proactive/execution → connectors/cli}/types.js +0 -0
  499. /package/dist/src/{proactive/events/publisher.js → notifications/domain-delivery.js} +0 -0
  500. /package/dist/src/{proactive/inbox/types.js → scenes/httpServices.js} +0 -0
@@ -0,0 +1,109 @@
1
+ //#region src/notifications/dispatch.ts
2
+ /** Owns durable delivery only. The host supplies policy and transports; neither may widen the saved scope. */
3
+ var NotificationDispatcher = class {
4
+ active = null;
5
+ stopped = false;
6
+ constructor(db, dependencies) {
7
+ this.db = db;
8
+ this.dependencies = dependencies;
9
+ const timeout = dependencies.timeoutMs ?? 15e3;
10
+ if (!Number.isInteger(timeout) || timeout < 1 || timeout > 6e4) throw new Error("Invalid dispatch timeout");
11
+ }
12
+ /** Called by the host notification pump; overlapping passes never make a second claim. */
13
+ drainOne() {
14
+ if (this.stopped || this.active) return Promise.resolve(false);
15
+ const controller = new AbortController();
16
+ const work = Promise.resolve().then(() => this.deliver(controller)).finally(() => {
17
+ this.active = null;
18
+ });
19
+ this.active = {
20
+ controller,
21
+ work
22
+ };
23
+ return work;
24
+ }
25
+ async stop() {
26
+ this.stopped = true;
27
+ const active = this.active;
28
+ active?.controller.abort();
29
+ await active?.work;
30
+ }
31
+ now() {
32
+ return (this.dependencies.clock ?? Date.now)();
33
+ }
34
+ async deliver(controller) {
35
+ if (controller.signal.aborted) return false;
36
+ const now = this.now();
37
+ this.db.prepare(`UPDATE notification_dispatches SET status = 'unknown', lease_until = NULL, last_error = 'lease_expired'
38
+ WHERE status = 'sending' AND (lease_until IS NULL OR lease_until <= ?)`).run(now);
39
+ const row = this.db.prepare(`UPDATE notification_dispatches SET status = 'sending', attempt = attempt + 1, lease_until = ?
40
+ WHERE id = (SELECT id FROM notification_dispatches WHERE status = 'pending' AND next_attempt_at <= ?
41
+ ORDER BY next_attempt_at, id LIMIT 1) AND status = 'pending' RETURNING *`).get(now + (this.dependencies.timeoutMs ?? 15e3) + 1e3, now);
42
+ if (!row) return false;
43
+ const id = String(row.id);
44
+ const attempt = Number(row.attempt);
45
+ const failures = Number(row.failure_count);
46
+ const finish = (status, reason, retryAt = this.now(), receipt = null, failed = false) => this.db.prepare(`UPDATE notification_dispatches SET status = ?, last_error = ?, next_attempt_at = ?,
47
+ provider_message_id = ?, failure_count = failure_count + ?, lease_until = NULL
48
+ WHERE id = ? AND attempt = ? AND status = 'sending' AND lease_until > ?`).run(status, reason, retryAt, receipt, failed ? 1 : 0, id, attempt, this.now());
49
+ let sending = false;
50
+ let onAbort = () => {};
51
+ const cancelled = new Promise((_resolve, reject) => {
52
+ onAbort = () => reject(/* @__PURE__ */ new Error("Dispatch cancelled"));
53
+ });
54
+ controller.signal.addEventListener("abort", onAbort, { once: true });
55
+ const timer = setTimeout(() => controller.abort(), this.dependencies.timeoutMs ?? 15e3);
56
+ try {
57
+ const dispatch = {
58
+ id,
59
+ notificationId: String(row.notification_id),
60
+ ownerId: String(row.owner_id),
61
+ workspaceId: String(row.workspace_id),
62
+ channel: row.channel,
63
+ destinationId: String(row.destination_id),
64
+ destination: row.destination_json === null ? null : JSON.parse(String(row.destination_json)),
65
+ subjectId: row.subject_id === null ? null : String(row.subject_id),
66
+ subjectRevision: Number(row.subject_revision),
67
+ attempt
68
+ };
69
+ const policy = await Promise.race([this.dependencies.authorize(dispatch, controller.signal), cancelled]);
70
+ if (controller.signal.aborted) throw new Error("Dispatch cancelled");
71
+ if (policy.action === "cancel") {
72
+ finish("cancelled", "policy_cancelled");
73
+ return true;
74
+ }
75
+ if (policy.action === "defer") {
76
+ if (!Number.isSafeInteger(policy.until) || policy.until <= this.now()) throw new Error("Invalid notification deferral");
77
+ finish("pending", "policy_deferred", policy.until);
78
+ return true;
79
+ }
80
+ if (policy.action !== "send") throw new Error("Invalid dispatch policy");
81
+ if (!this.db.prepare("SELECT 1 FROM notification_dispatches WHERE id = ? AND attempt = ? AND status = 'sending' AND lease_until > ?").get(id, attempt, this.now())) return true;
82
+ sending = true;
83
+ const receipt = await Promise.race([this.dependencies.send(dispatch, controller.signal), cancelled]);
84
+ if (controller.signal.aborted) throw new Error("Dispatch cancelled");
85
+ if (receipt.status === "accepted") {
86
+ if (dispatch.channel === "telegram" && !receipt.providerMessageId?.trim()) {
87
+ finish("unknown", "missing_provider_receipt");
88
+ return true;
89
+ }
90
+ finish("accepted", null, this.now(), receipt.providerMessageId);
91
+ } else if (receipt.status === "rejected") {
92
+ const retryAt = receipt.retryAt;
93
+ if (retryAt !== void 0 && (!Number.isSafeInteger(retryAt) || retryAt <= this.now())) {
94
+ finish("failed", "invalid_retry_time");
95
+ return true;
96
+ }
97
+ finish(retryAt !== void 0 && failures + 1 < 5 ? "pending" : "failed", "provider_rejected", retryAt ?? this.now(), null, true);
98
+ } else finish("unknown", "invalid_provider_receipt");
99
+ } catch {
100
+ finish(sending ? "unknown" : failures + 1 < 5 ? "pending" : "failed", sending ? "transport_unconfirmed" : "policy_unavailable", this.now() + 3e4, null, true);
101
+ } finally {
102
+ clearTimeout(timer);
103
+ controller.signal.removeEventListener("abort", onAbort);
104
+ }
105
+ return true;
106
+ }
107
+ };
108
+ //#endregion
109
+ export { NotificationDispatcher };
@@ -0,0 +1,21 @@
1
+ import type { ProductNotification, ProductNotificationType } from '@xopcai/gateway-contract';
2
+ import type { NotificationPlan } from './planner.js';
3
+ import type { NotificationDevice, NotificationPreferences } from './types.js';
4
+ /** Domain decisions are injected by the host; transports never load domain runtimes. */
5
+ export interface NotificationDomainDelivery {
6
+ owns(type: ProductNotificationType): boolean;
7
+ allowsDevice(preferences: NotificationPreferences): boolean;
8
+ planEvent(type: string, payload: unknown): NotificationPlan | null;
9
+ prepare(plan: NotificationPlan, devices: NotificationDevice[]): {
10
+ plan: NotificationPlan;
11
+ deviceIds: string[];
12
+ enqueue(notification: ProductNotification): void;
13
+ };
14
+ flush(persist: (plan: NotificationPlan) => ProductNotification | null): ProductNotification[];
15
+ drain(): Promise<void>;
16
+ recheckMobile(notification: ProductNotification): 'send' | 'cancel' | Date;
17
+ mobilePreview(notification: ProductNotification, locale: string): {
18
+ title: string;
19
+ body: string;
20
+ };
21
+ }
@@ -122,41 +122,6 @@ function automationPlan(payload) {
122
122
  }
123
123
  };
124
124
  }
125
- function proactivePlan(payload) {
126
- if (!payload || typeof payload !== "object") return null;
127
- const item = payload;
128
- if (typeof item.id !== "string" || typeof item.insightId !== "string" || typeof item.insight?.title !== "string") return null;
129
- const requiresDecision = item.insight.attentionKind === "decision";
130
- const highUrgency = item.insight.urgency === "high" || item.insight.urgency === "critical";
131
- if (item.insight.attentionKind === "receipt") return null;
132
- if (!requiresDecision && !highUrgency) return null;
133
- const title = item.insight.title.trim().slice(0, 120);
134
- const summary = typeof item.insight.summary === "string" ? item.insight.summary.trim().slice(0, 180) : "";
135
- return {
136
- dedupeKey: `proactive.insight:${item.id}${item.notificationRevision && item.notificationRevision > 1 ? `:${item.notificationRevision}` : ""}`,
137
- notification: {
138
- type: "proactive.insight",
139
- target: {
140
- kind: "insight",
141
- inboxItemId: item.id
142
- },
143
- priority: requiresDecision || highUrgency ? "high" : "normal",
144
- title: {
145
- en: title,
146
- zh: title
147
- },
148
- ...summary ? { body: {
149
- en: summary,
150
- zh: summary
151
- } } : {},
152
- payload: {
153
- inboxItemId: item.id,
154
- insightId: item.insightId,
155
- notificationRevision: item.notificationRevision ?? 1
156
- }
157
- }
158
- };
159
- }
160
125
  function workDiscoveryPlan(eventType, payload) {
161
126
  if (!payload || typeof payload !== "object") return null;
162
127
  const event = payload;
@@ -195,7 +160,6 @@ function notificationPlanFromGatewayEvent(type, payload) {
195
160
  if (type === "agent.run.ended") return chatPlan(payload);
196
161
  if (type === "task.attention_required.v2" || type === "task.phase_changed.v2") return taskPlan(payload);
197
162
  if (type === "automation.run.completed") return automationPlan(payload);
198
- if (type === "proactive.inbox.created") return proactivePlan(payload);
199
163
  if (type === "work-discovery.completed" || type === "work-discovery.failed") return workDiscoveryPlan(type, payload);
200
164
  return null;
201
165
  }
@@ -0,0 +1,6 @@
1
+ /** Resolves a local-hour quiet window on the UTC timeline, including DST gaps and repeated hours. */
2
+ export declare function notificationQuietUntil(input: {
3
+ timezone: string;
4
+ quietStartHour: number;
5
+ quietEndHour: number;
6
+ }, now: number): number | null;
@@ -0,0 +1,23 @@
1
+ //#region src/notifications/quietHours.ts
2
+ /** Resolves a local-hour quiet window on the UTC timeline, including DST gaps and repeated hours. */
3
+ function notificationQuietUntil(input, now) {
4
+ if (!Number.isSafeInteger(now) || now < 0 || ![input.quietStartHour, input.quietEndHour].every((hour) => Number.isInteger(hour) && hour >= 0 && hour < 24)) throw new Error("Invalid quiet hours");
5
+ if (input.quietStartHour === input.quietEndHour) return null;
6
+ const formatter = new Intl.DateTimeFormat("en", {
7
+ timeZone: input.timezone,
8
+ hour: "2-digit",
9
+ hourCycle: "h23"
10
+ });
11
+ const quiet = (at) => {
12
+ const hour = Number(formatter.format(at));
13
+ return input.quietStartHour < input.quietEndHour ? hour >= input.quietStartHour && hour < input.quietEndHour : hour >= input.quietStartHour || hour < input.quietEndHour;
14
+ };
15
+ if (!quiet(now)) return null;
16
+ for (let minute = 1; minute <= 2880; minute++) {
17
+ const candidate = Math.floor(now / 6e4) * 6e4 + minute * 6e4;
18
+ if (!quiet(candidate)) return candidate;
19
+ }
20
+ throw new Error("Quiet hours did not resolve within two days");
21
+ }
22
+ //#endregion
23
+ export { notificationQuietUntil };
@@ -0,0 +1,23 @@
1
+ import type { DatabaseSync } from 'node:sqlite';
2
+ export interface NotificationResult {
3
+ id: string;
4
+ ownerId: string;
5
+ workspaceId: string;
6
+ subjectId: string;
7
+ }
8
+ export type PublicationDecision = ({
9
+ action: 'settle';
10
+ } | {
11
+ action: 'defer';
12
+ until: number;
13
+ }) & {
14
+ reason?: string;
15
+ };
16
+ /** Publishes only database work. Transport calls belong to NotificationDispatcher, outside this transaction. */
17
+ export declare class NotificationResultOutbox {
18
+ private readonly db;
19
+ private readonly publish;
20
+ private readonly clock;
21
+ constructor(db: DatabaseSync, publish: (result: NotificationResult) => PublicationDecision, clock?: () => number);
22
+ drainOne(): boolean;
23
+ }
@@ -0,0 +1,49 @@
1
+ //#region src/notifications/resultOutbox.ts
2
+ /** Publishes only database work. Transport calls belong to NotificationDispatcher, outside this transaction. */
3
+ var NotificationResultOutbox = class {
4
+ constructor(db, publish, clock = Date.now) {
5
+ this.db = db;
6
+ this.publish = publish;
7
+ this.clock = clock;
8
+ }
9
+ drainOne() {
10
+ const now = this.clock();
11
+ this.db.exec("SAVEPOINT notification_result_publication");
12
+ let id;
13
+ let attempt = 0;
14
+ try {
15
+ const row = this.db.prepare(`SELECT * FROM notification_result_outbox
16
+ WHERE (status = 'pending' AND next_attempt_at <= ?)
17
+ OR (status = 'processing' AND (lease_until IS NULL OR lease_until <= ?))
18
+ ORDER BY next_attempt_at, id LIMIT 1`).get(now, now);
19
+ if (!row) {
20
+ this.db.exec("RELEASE notification_result_publication");
21
+ return false;
22
+ }
23
+ id = String(row.id);
24
+ attempt = Number(row.attempt);
25
+ this.db.prepare(`UPDATE notification_result_outbox SET status = 'processing', lease_until = ?, updated_at = ? WHERE id = ?`).run(now + 3e4, now, id);
26
+ const decision = this.publish({
27
+ id,
28
+ ownerId: String(row.owner_id),
29
+ workspaceId: String(row.workspace_id),
30
+ subjectId: String(row.subject_id)
31
+ });
32
+ if (!decision || !["settle", "defer"].includes(decision.action) || decision.reason !== void 0 && !/^[a-z][a-z0-9_]{0,79}$/.test(decision.reason) || decision.action === "defer" && (!Number.isSafeInteger(decision.until) || decision.until <= now)) throw new Error("Notification publication must return a synchronous decision");
33
+ this.db.prepare(`UPDATE notification_result_outbox SET status = ?, next_attempt_at = ?, lease_until = NULL,
34
+ last_error = NULL, decision_reason = ?, settled_at = ?, updated_at = ? WHERE id = ?`).run(decision.action === "settle" ? "settled" : "pending", decision.action === "defer" ? decision.until : now, decision.reason ?? null, decision.action === "settle" ? now : null, now, id);
35
+ this.db.exec("RELEASE notification_result_publication");
36
+ return true;
37
+ } catch (error) {
38
+ this.db.exec("ROLLBACK TO notification_result_publication");
39
+ this.db.exec("RELEASE notification_result_publication");
40
+ if (!id) throw error;
41
+ this.db.prepare(`UPDATE notification_result_outbox SET status = ?, attempt = attempt + 1, next_attempt_at = ?,
42
+ lease_until = NULL, last_error = 'publication_failed', updated_at = ?
43
+ WHERE id = ? AND attempt = ? AND (status = 'pending' OR (status = 'processing' AND (lease_until IS NULL OR lease_until <= ?)))`).run(attempt + 1 >= 5 ? "failed" : "pending", now + 3e4, now, id, attempt, now);
44
+ return true;
45
+ }
46
+ }
47
+ };
48
+ //#endregion
49
+ export { NotificationResultOutbox };
@@ -1,5 +1,5 @@
1
- import { type ProactiveChannelSender } from './proactive-channel.js';
2
1
  import { type NotificationPlan } from './planner.js';
2
+ import type { NotificationDomainDelivery } from './domain-delivery.js';
3
3
  import { sendHarmonyPush } from './harmony-push.js';
4
4
  export declare class NotificationService {
5
5
  private readonly options;
@@ -9,7 +9,7 @@ export declare class NotificationService {
9
9
  constructor(options: {
10
10
  publish: (type: string, payload: unknown) => void;
11
11
  fetch?: typeof fetch;
12
- sendChannel?: ProactiveChannelSender;
12
+ domainDelivery?: NotificationDomainDelivery;
13
13
  sendHarmony?: typeof sendHarmonyPush;
14
14
  });
15
15
  start(): void;
@@ -19,7 +19,7 @@ export declare class NotificationService {
19
19
  persistGatewayEvent(type: string, payload: unknown): {
20
20
  schemaVersion: 1;
21
21
  id: string;
22
- type: "work_discovery.completed" | "work_discovery.failed" | "chat.completed" | "chat.failed" | "task.needs_input" | "task.blocked" | "task.failed" | "task.completed" | "automation.completed" | "automation.failed" | "proactive.insight";
22
+ type: "work_discovery.completed" | "work_discovery.failed" | "scene.result" | "scene.digest" | "chat.completed" | "chat.failed" | "task.needs_input" | "task.blocked" | "task.failed" | "task.completed" | "automation.completed" | "automation.failed" | "proactive.insight";
23
23
  priority: "normal" | "high";
24
24
  title: {
25
25
  en: string;
@@ -28,6 +28,13 @@ export declare class NotificationService {
28
28
  payload: Record<string, unknown>;
29
29
  createdAt: number;
30
30
  target?: {
31
+ kind: "scene_result";
32
+ activationId: string;
33
+ presentationId: string;
34
+ } | {
35
+ kind: "scene_digest";
36
+ digestId: string;
37
+ } | {
31
38
  kind: "chat";
32
39
  conversationId: string;
33
40
  } | {
@@ -56,7 +63,7 @@ export declare class NotificationService {
56
63
  persistPlan(plan: NotificationPlan): {
57
64
  schemaVersion: 1;
58
65
  id: string;
59
- type: "work_discovery.completed" | "work_discovery.failed" | "chat.completed" | "chat.failed" | "task.needs_input" | "task.blocked" | "task.failed" | "task.completed" | "automation.completed" | "automation.failed" | "proactive.insight";
66
+ type: "work_discovery.completed" | "work_discovery.failed" | "scene.result" | "scene.digest" | "chat.completed" | "chat.failed" | "task.needs_input" | "task.blocked" | "task.failed" | "task.completed" | "automation.completed" | "automation.failed" | "proactive.insight";
60
67
  priority: "normal" | "high";
61
68
  title: {
62
69
  en: string;
@@ -65,6 +72,13 @@ export declare class NotificationService {
65
72
  payload: Record<string, unknown>;
66
73
  createdAt: number;
67
74
  target?: {
75
+ kind: "scene_result";
76
+ activationId: string;
77
+ presentationId: string;
78
+ } | {
79
+ kind: "scene_digest";
80
+ digestId: string;
81
+ } | {
68
82
  kind: "chat";
69
83
  conversationId: string;
70
84
  } | {
@@ -1,17 +1,12 @@
1
1
  import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
- import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
3
+ import { init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
4
4
  import { localizeNotification } from "../../packages/gateway-contract/src/notifications.js";
5
5
  import { init_src } from "../../packages/gateway-contract/src/index.js";
6
6
  import { getOrCreateGatewayIdentity } from "../storage/sqlite/gateway-identity-repository.js";
7
- import { proactivePreferences } from "../proactive/policy/service.js";
8
- import { flushDueDigests } from "../proactive/inbox/digest.js";
7
+ import { disableNotificationDeviceForPushToken, listDeliverableNotificationDevices } from "./device-store.js";
9
8
  import { notificationPlanFromGatewayEvent } from "./planner.js";
10
- import { proactiveNotificationWorkspace, recheckNotificationDelivery } from "./proactive-policy.js";
11
9
  import { createNotificationEvent, deferNotificationDelivery, expireUndeliverableNotificationDeliveries, listDueNotificationDeliveries, markNotificationDeliveryAccepted, markNotificationDeliveryDead, markNotificationDeliveryDelivered, pruneNotificationEvents, rescheduleNotificationDelivery } from "./store.js";
12
- import { drainChannelNotifications, enqueueChannelNotification } from "./proactive-channel.js";
13
- import { drainBrowserPush, enqueueBrowserPush } from "./web-push.js";
14
- import { disableNotificationDeviceForPushToken, listDeliverableNotificationDevices } from "./device-store.js";
15
10
  import { sendHarmonyPush } from "./harmony-push.js";
16
11
  //#region src/notifications/service.ts
17
12
  init_transaction();
@@ -29,20 +24,21 @@ const RETRY_DELAYS_MS = [
29
24
  216e5
30
25
  ];
31
26
  const RECEIPT_DELAY_MS = 15 * 6e4;
27
+ const STANDARD_PREFERENCES = {
28
+ "chat.completed": "chatCompleted",
29
+ "chat.failed": "chatFailed",
30
+ "task.needs_input": "taskNeedsInput",
31
+ "task.blocked": "taskBlocked",
32
+ "task.failed": "taskFailed",
33
+ "task.completed": "taskCompleted",
34
+ "automation.completed": "automationCompleted",
35
+ "automation.failed": "automationFailed",
36
+ "work_discovery.completed": true,
37
+ "work_discovery.failed": true
38
+ };
32
39
  function preferenceAllows(type, preferences) {
33
- switch (type) {
34
- case "chat.completed": return preferences.chatCompleted;
35
- case "chat.failed": return preferences.chatFailed;
36
- case "task.needs_input": return preferences.taskNeedsInput;
37
- case "task.blocked": return preferences.taskBlocked;
38
- case "task.failed": return preferences.taskFailed;
39
- case "task.completed": return preferences.taskCompleted;
40
- case "automation.completed": return preferences.automationCompleted;
41
- case "automation.failed": return preferences.automationFailed;
42
- case "proactive.insight": return preferences.proactiveInsight;
43
- case "work_discovery.completed":
44
- case "work_discovery.failed": return true;
45
- }
40
+ const key = STANDARD_PREFERENCES[type];
41
+ return key === true || key !== void 0 && preferences[key];
46
42
  }
47
43
  function retryAt(attempts, now) {
48
44
  return now + RETRY_DELAYS_MS[Math.min(attempts, RETRY_DELAYS_MS.length - 1)];
@@ -82,44 +78,21 @@ var NotificationService = class {
82
78
  }
83
79
  /** Throws on persistence failure so durable producers can retry the handoff. */
84
80
  persistGatewayEvent(type, payload) {
85
- const plan = notificationPlanFromGatewayEvent(type, payload);
81
+ const plan = notificationPlanFromGatewayEvent(type, payload) ?? this.options.domainDelivery?.planEvent(type, payload);
86
82
  if (!plan) return null;
87
83
  return this.persistPlan(plan);
88
84
  }
89
85
  persistPlan(plan) {
90
- let devices = listDeliverableNotificationDevices().filter((device) => preferenceAllows(plan.notification.type, device.preferences));
91
- const workspace = proactiveNotificationWorkspace(plan.notification);
92
- let browserIds;
93
- let selectedChannel = "all";
94
- if (workspace) {
95
- const preferences = proactivePreferences(workspace);
96
- const browsers = getSqliteDatabase().prepare("SELECT id FROM proactive_web_push_subscriptions WHERE workspace_id = ? ORDER BY created_at DESC, id").all(workspace);
97
- selectedChannel = preferences.preferredChannel === "auto" ? browsers.length ? "browser" : devices.length ? "mobile" : "browser" : preferences.preferredChannel;
98
- if (!["all", "mobile"].includes(selectedChannel)) devices = [];
99
- else if (preferences.preferredChannel === "auto") devices = devices.slice(0, 1);
100
- browserIds = ["all", "browser"].includes(selectedChannel) ? browsers.map((row) => row.id) : [];
101
- if (preferences.preferredChannel === "auto") browserIds = browserIds.slice(0, 1);
102
- plan = {
103
- ...plan,
104
- notification: {
105
- ...plan.notification,
106
- payload: {
107
- ...plan.notification.payload,
108
- deliveryChannel: selectedChannel,
109
- deliveryMode: preferences.preferredChannel
110
- }
111
- }
112
- };
113
- }
86
+ const domain = this.options.domainDelivery?.owns(plan.notification.type) ? this.options.domainDelivery : void 0;
87
+ if (!domain && !Object.hasOwn(STANDARD_PREFERENCES, plan.notification.type)) throw new Error("Notification domain delivery is not installed");
88
+ const devices = listDeliverableNotificationDevices().filter((device) => domain ? domain.allowsDevice(device.preferences) : preferenceAllows(plan.notification.type, device.preferences));
114
89
  const result = runSqliteWriteTransaction(() => {
90
+ const selection = domain?.prepare(plan, devices);
115
91
  const created = createNotificationEvent({
116
- ...plan,
117
- deviceIds: devices.map((device) => device.id)
92
+ ...selection?.plan ?? plan,
93
+ deviceIds: selection?.deviceIds ?? devices.map((device) => device.id)
118
94
  });
119
- if (created.created) {
120
- enqueueBrowserPush(created.notification, browserIds);
121
- if (workspace && selectedChannel === "telegram") enqueueChannelNotification(created.notification, workspace);
122
- }
95
+ if (created.created) selection?.enqueue(created.notification);
123
96
  return created;
124
97
  });
125
98
  return result.created ? result.notification : null;
@@ -134,11 +107,10 @@ var NotificationService = class {
134
107
  pruneNotificationEvents(now - 720 * 60 * 60 * 1e3);
135
108
  this.lastMaintenanceAt = now;
136
109
  }
137
- for (const notification of flushDueDigests((plan) => this.persistPlan(plan))) this.options.publish("notification.created", notification);
110
+ for (const notification of this.options.domainDelivery?.flush((plan) => this.persistPlan(plan)) ?? []) this.options.publish("notification.created", notification);
138
111
  await this.deliverPending();
139
112
  await this.checkReceipts();
140
- await drainBrowserPush();
141
- if (this.options.sendChannel) await drainChannelNotifications(this.options.sendChannel);
113
+ await this.options.domainDelivery?.drain();
142
114
  } catch (err) {
143
115
  log.warn({ err }, "Notification delivery pass failed");
144
116
  } finally {
@@ -150,10 +122,15 @@ var NotificationService = class {
150
122
  await Promise.all(deliveries.map((delivery) => this.send(delivery)));
151
123
  }
152
124
  async send(delivery) {
153
- if (delivery.event.type === "proactive.insight") {
154
- const policy = recheckNotificationDelivery(delivery.event, "mobile");
125
+ const domain = this.options.domainDelivery?.owns(delivery.event.type) ? this.options.domainDelivery : void 0;
126
+ if (!domain && !Object.hasOwn(STANDARD_PREFERENCES, delivery.event.type)) {
127
+ markNotificationDeliveryDead(delivery.event.id, delivery.deviceId, "Notification domain delivery is not installed");
128
+ return;
129
+ }
130
+ if (domain) {
131
+ const policy = domain.recheckMobile(delivery.event);
155
132
  if (policy === "cancel") {
156
- markNotificationDeliveryDead(delivery.event.id, delivery.deviceId, "Proactive policy changed");
133
+ markNotificationDeliveryDead(delivery.event.id, delivery.deviceId, "Notification policy changed");
157
134
  return;
158
135
  }
159
136
  if (policy instanceof Date) {
@@ -163,6 +140,10 @@ var NotificationService = class {
163
140
  }
164
141
  const fetchImpl = this.options.fetch ?? fetch;
165
142
  const localized = localizeNotification(delivery.event, delivery.locale);
143
+ const preview = domain?.mobilePreview(delivery.event, delivery.locale) ?? {
144
+ title: localized.localizedTitle,
145
+ body: localized.localizedBody
146
+ };
166
147
  try {
167
148
  if (delivery.platform === "harmonyos") {
168
149
  const ticket = await (this.options.sendHarmony ?? sendHarmonyPush)({
@@ -170,8 +151,8 @@ var NotificationService = class {
170
151
  eventId: delivery.event.id,
171
152
  gatewayId: getOrCreateGatewayIdentity().id,
172
153
  target: delivery.event.target,
173
- title: delivery.event.type === "proactive.insight" ? delivery.locale === "zh" ? "有一项工作需要查看" : "A work update is ready" : localized.localizedTitle,
174
- body: delivery.event.type === "proactive.insight" ? delivery.locale === "zh" ? "打开 xopc 查看详情。" : "Open xopc to review it." : localized.localizedBody
154
+ title: preview.title,
155
+ body: preview.body
175
156
  }, fetchImpl);
176
157
  markNotificationDeliveryAccepted(delivery.event.id, delivery.deviceId, ticket, Number.MAX_SAFE_INTEGER);
177
158
  return;
@@ -185,8 +166,8 @@ var NotificationService = class {
185
166
  signal: AbortSignal.timeout(1e4),
186
167
  body: JSON.stringify({
187
168
  to: delivery.pushToken,
188
- title: delivery.event.type === "proactive.insight" ? delivery.locale.startsWith("zh") ? "有一项工作需要查看" : "A work update is ready" : localized.localizedTitle,
189
- body: delivery.event.type === "proactive.insight" ? delivery.locale.startsWith("zh") ? "打开 xopc 查看详情。" : "Open xopc to review it." : localized.localizedBody,
169
+ title: preview.title,
170
+ body: preview.body,
190
171
  sound: delivery.event.priority === "high" ? "default" : void 0,
191
172
  priority: delivery.event.priority,
192
173
  data: {
@@ -1,3 +1,4 @@
1
+ import type { DatabaseSync } from 'node:sqlite';
1
2
  import { type ProductNotification } from '@xopcai/gateway-contract';
2
3
  import type { NotificationDevicePlatform } from './types.js';
3
4
  export type NotificationDelivery = {
@@ -14,7 +15,7 @@ export declare function createNotificationEvent(input: {
14
15
  notification: Omit<ProductNotification, 'id' | 'createdAt' | 'schemaVersion'>;
15
16
  deviceIds: string[];
16
17
  createdAt?: number;
17
- }): {
18
+ }, db?: DatabaseSync): {
18
19
  notification: ProductNotification;
19
20
  created: boolean;
20
21
  };
@@ -1,4 +1,4 @@
1
- import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
1
+ import { getSqliteDatabase, init_transaction, runSqliteSavepoint, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
2
2
  import { ProductNotificationSchema } from "../../packages/gateway-contract/src/notifications.js";
3
3
  import { init_src } from "../../packages/gateway-contract/src/index.js";
4
4
  import { randomUUID } from "node:crypto";
@@ -42,10 +42,10 @@ function deliveryFromRow(row) {
42
42
  ...row.provider_ticket_id ? { providerTicketId: row.provider_ticket_id } : {}
43
43
  };
44
44
  }
45
- function createNotificationEvent(input) {
45
+ function createNotificationEvent(input, db = getSqliteDatabase()) {
46
46
  const id = randomUUID();
47
47
  const createdAt = input.createdAt ?? Date.now();
48
- const created = runSqliteWriteTransaction((db) => {
48
+ return runSqliteSavepoint(db, () => {
49
49
  const inserted = db.prepare(`INSERT OR IGNORE INTO notification_events (
50
50
  event_id, dedupe_key, event_type, target_json, priority,
51
51
  title_en, title_zh, body_en, body_zh, payload_json, created_at
@@ -56,12 +56,11 @@ function createNotificationEvent(input) {
56
56
  ) VALUES (?, ?, 'pending', ?, ?)`);
57
57
  for (const deviceId of input.deviceIds) enqueue.run(id, deviceId, createdAt, createdAt);
58
58
  }
59
- return inserted;
59
+ return {
60
+ notification: eventFromRow(db.prepare("SELECT * FROM notification_events WHERE dedupe_key = ?").get(input.dedupeKey)),
61
+ created: inserted
62
+ };
60
63
  });
61
- return {
62
- notification: eventFromRow(getSqliteDatabase().prepare("SELECT * FROM notification_events WHERE dedupe_key = ?").get(input.dedupeKey)),
63
- created
64
- };
65
64
  }
66
65
  function listNotificationEvents(options = {}) {
67
66
  const limit = Math.max(1, Math.min(100, options.limit ?? 50));
@@ -1,4 +1,3 @@
1
- import type { ProactiveSignalPublisher } from '../proactive/events/publisher.js';
2
1
  import { ProjectStore } from './project-store.js';
3
2
  import type { CreateProjectInput, Project, ProjectHealth, ProjectListQuery, ProjectListResult, ProjectMilestone, ProjectUpdate, ProjectWithDetails, SidebarProjectListQuery, UpdateProjectInput } from './types.js';
4
3
  import { type WorkspaceProjectMatch } from './workspace-project.js';
@@ -10,9 +9,7 @@ export type ProjectSuggestion = {
10
9
  };
11
10
  export declare class ProjectService {
12
11
  private readonly store;
13
- private readonly signals?;
14
- private readonly workspaceId;
15
- constructor(store?: ProjectStore, signals?: ProactiveSignalPublisher, workspaceId?: string);
12
+ constructor(store?: ProjectStore);
16
13
  private listAllProjects;
17
14
  create(input: CreateProjectInput): Project;
18
15
  get(id: string): Project | null;
@@ -1,19 +1,16 @@
1
1
  import { init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
2
- import { getSessionMetadata } from "../storage/sqlite/session-repository.js";
2
+ import { getSessionMetadata } from "../storage/sqlite/session-read-repository.js";
3
3
  import "../storage/sqlite/index.js";
4
4
  import { changedFieldsFromPatch, emitActivity, systemActivityActor, systemActivitySource } from "../activity/emitter.js";
5
5
  import { ProjectStore } from "./project-store.js";
6
6
  import { ProjectWorkspaceConflictError, ProjectWorkspaceMissingError, canonicalWorkspacePath, ensureWorkspaceDirectory, inferProjectNameFromWorkspaceRoot, isPathSameOrInsideWorkspace, isSafeAutoCreateWorkspaceRoot, resolveWorkspaceProjectRoot, workspaceDirectoryExists } from "./workspace-project.js";
7
7
  import { inferProjectExecutionMode } from "./project-kind.js";
8
8
  import { bindSessionToProject, listProjectConversationIds, unbindSessionFromProject } from "./session-bind.js";
9
- import { createHash } from "node:crypto";
10
9
  //#region src/projects/project-service.ts
11
10
  init_transaction();
12
11
  var ProjectService = class {
13
- constructor(store = new ProjectStore(), signals, workspaceId = "default") {
12
+ constructor(store = new ProjectStore()) {
14
13
  this.store = store;
15
- this.signals = signals;
16
- this.workspaceId = workspaceId;
17
14
  }
18
15
  listAllProjects() {
19
16
  const items = [];
@@ -188,31 +185,6 @@ var ProjectService = class {
188
185
  }],
189
186
  nowMs: project.updatedAt
190
187
  });
191
- this.signals?.publish({
192
- type: "project.updated.v1",
193
- schemaVersion: 1,
194
- source: {
195
- kind: "projects",
196
- id: "local"
197
- },
198
- subject: {
199
- kind: "project",
200
- id: project.id
201
- },
202
- actor: { kind: "system" },
203
- scope: {
204
- workspaceId: this.workspaceId,
205
- projectId: project.id
206
- },
207
- occurredAt: new Date(project.updatedAt).toISOString(),
208
- dedupeKey: `project:${project.id}:${project.updatedAt}:${createHash("sha256").update(JSON.stringify(patch)).digest("hex")}`,
209
- sensitivity: "personal",
210
- payload: {
211
- before,
212
- after: project,
213
- changes
214
- }
215
- });
216
188
  return project;
217
189
  });
218
190
  }
@@ -1,5 +1,5 @@
1
1
  import { isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
2
- import { getSessionMetadata } from "../storage/sqlite/session-repository.js";
2
+ import { getSessionMetadata } from "../storage/sqlite/session-read-repository.js";
3
3
  import "../storage/sqlite/index.js";
4
4
  import { resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
5
5
  import { projectWorkspacePath } from "../session/session-workspace.js";