@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,100 @@
1
+ //#region src/scenes/metrics.ts
2
+ /** Explicit feedback is a usefulness signal, not proof of adoption or saved time. */
3
+ var SceneMetrics = class {
4
+ constructor(db, clock = Date.now, modelRef = () => null) {
5
+ this.db = db;
6
+ this.clock = clock;
7
+ this.modelRef = modelRef;
8
+ }
9
+ diagnostics(principal) {
10
+ if (!principal.ownerId.trim() || !principal.workspaceId.trim()) throw new Error("Scene principal is required");
11
+ const now = this.clock();
12
+ const queue = this.db.prepare(`SELECT COUNT(*) AS depth, MIN(i.due_at) AS oldest
13
+ FROM scene_trigger_intents i JOIN scene_activations a ON a.id = i.activation_id
14
+ WHERE a.owner_id = ? AND a.workspace_id = ? AND i.status = 'pending'`).get(principal.ownerId, principal.workspaceId);
15
+ const usage = this.db.prepare(`SELECT COUNT(*) AS calls, COALESCE(SUM(u.total_tokens), 0) AS tokens,
16
+ COALESCE(SUM(u.estimated_cost), 0) AS cost FROM scene_model_usage u JOIN scene_runs r ON r.id = u.run_id
17
+ JOIN scene_activations a ON a.id = r.activation_id WHERE a.owner_id = ? AND a.workspace_id = ? AND u.recorded_at >= ?`).get(principal.ownerId, principal.workspaceId, now - 7 * 864e5);
18
+ const connectorReads = Number(this.db.prepare(`SELECT COALESCE(SUM(request_count), 0) AS count FROM scene_connector_usage
19
+ WHERE owner_id = ? AND workspace_id = ? AND utc_day >= ?`).get(principal.ownerId, principal.workspaceId, Math.floor(now / 864e5) - 6)?.count);
20
+ const notifications = this.db.prepare(`SELECT status, COUNT(*) AS count FROM notification_dispatches
21
+ WHERE owner_id = ? AND workspace_id = ? GROUP BY status`).all(principal.ownerId, principal.workspaceId);
22
+ const activations = this.db.prepare(`SELECT a.id, a.status,
23
+ (SELECT MAX(created_at) FROM scene_runs WHERE activation_id = a.id) AS last_check_at,
24
+ (SELECT reason FROM scene_runs WHERE activation_id = a.id ORDER BY created_at DESC, id DESC LIMIT 1) AS last_reason,
25
+ CASE WHEN a.status = 'active' THEN (SELECT MIN(next_due_at) FROM scene_schedule_cursors WHERE activation_id = a.id) END AS next_schedule_at,
26
+ (SELECT MIN(due_at) FROM scene_work_items WHERE activation_id = a.id AND status = 'watching') AS deadline_at,
27
+ CASE WHEN a.status = 'active' THEN (SELECT MIN(due_at) FROM scene_work_items WHERE activation_id = a.id AND status = 'watching' AND (last_triggered_revision IS NULL OR last_triggered_revision <> revision)) END AS next_deadline_check_at,
28
+ (SELECT MIN(retry_at) FROM scene_runs WHERE activation_id = a.id AND status = 'retry_wait') AS retry_at,
29
+ (SELECT reason FROM scene_source_health WHERE activation_id = a.id) AS source_reason,
30
+ (SELECT last_attempt_at FROM scene_source_health WHERE activation_id = a.id) AS source_attempt_at,
31
+ (SELECT consecutive_failures FROM scene_source_health WHERE activation_id = a.id) AS source_failures,
32
+ (SELECT last_success_at FROM scene_source_health WHERE activation_id = a.id) AS source_success_at,
33
+ (SELECT retry_at FROM scene_source_health WHERE activation_id = a.id) AS source_retry_at
34
+ FROM scene_activations a WHERE a.owner_id = ? AND a.workspace_id = ? ORDER BY a.id LIMIT 100`).all(principal.ownerId, principal.workspaceId);
35
+ const policyRow = this.db.prepare("SELECT preferences_json FROM scene_preferences WHERE owner_id = ? AND workspace_id = ?").get(principal.ownerId, principal.workspaceId);
36
+ const policy = policyRow ? JSON.parse(String(policyRow.preferences_json)) : {};
37
+ const checksPaused = policy.checksPaused === true || Date.parse(policy.checksPausedUntil ?? "") > now;
38
+ if (checksPaused) for (const activation of activations) {
39
+ activation.next_schedule_at = null;
40
+ activation.next_deadline_check_at = null;
41
+ activation.retry_at = null;
42
+ }
43
+ let currentModel = null;
44
+ try {
45
+ currentModel = this.modelRef();
46
+ } catch {}
47
+ return {
48
+ checksPaused,
49
+ currentModel,
50
+ pendingChecks: Number(queue.depth),
51
+ oldestDueWaitMs: queue.oldest == null ? 0 : Math.max(0, now - Number(queue.oldest)),
52
+ lastSevenDays: {
53
+ modelCalls: Number(usage.calls),
54
+ connectorReads,
55
+ tokens: Number(usage.tokens),
56
+ estimatedCost: Number(usage.cost)
57
+ },
58
+ notifications,
59
+ activations
60
+ };
61
+ }
62
+ forUser(principal, days = 7) {
63
+ if (!principal.ownerId?.trim() || !principal.workspaceId?.trim()) throw new Error("Scene principal is required");
64
+ if (!Number.isInteger(days) || days < 1 || days > 90) throw new Error("Scene metric window must be 1–90 days");
65
+ const until = this.clock();
66
+ const since = until - days * 864e5;
67
+ const feedback = this.db.prepare(`SELECT
68
+ COUNT(*) AS ratedOutcomes,
69
+ COALESCE(SUM(CASE WHEN f.rating = 'useful' THEN 1 ELSE 0 END), 0) AS usefulOutcomes,
70
+ COALESCE(SUM(CASE WHEN f.rating = 'not_useful' THEN 1 ELSE 0 END), 0) AS unhelpfulOutcomes,
71
+ COUNT(DISTINCT CASE WHEN f.rating = 'useful' THEN a.id END) AS scenesWithUsefulOutcomes
72
+ FROM scene_feedback_history f JOIN scene_feedback latest
73
+ ON latest.presentation_id = f.presentation_id AND latest.revision = f.revision
74
+ JOIN scene_presentations p ON p.id = f.presentation_id JOIN scene_outcomes o ON o.id = p.outcome_id
75
+ JOIN scene_runs r ON r.id = o.run_id JOIN scene_activations a ON a.id = r.activation_id
76
+ WHERE a.owner_id = ? AND a.workspace_id = ?
77
+ AND f.recorded_at >= ? AND f.recorded_at < ?`).get(principal.ownerId, principal.workspaceId, since, until);
78
+ const work = this.db.prepare(`SELECT COUNT(*) AS checks,
79
+ COALESCE(SUM(CASE WHEN r.status = 'failed' THEN 1 ELSE 0 END), 0) AS failedChecks,
80
+ COALESCE(SUM(CASE WHEN r.status = 'skipped' THEN 1 ELSE 0 END), 0) AS skippedChecks
81
+ FROM scene_runs r JOIN scene_activations a ON a.id = r.activation_id
82
+ WHERE a.owner_id = ? AND a.workspace_id = ? AND r.created_at >= ? AND r.created_at < ?`).get(principal.ownerId, principal.workspaceId, since, until);
83
+ return {
84
+ window: {
85
+ since,
86
+ until,
87
+ days
88
+ },
89
+ ratedOutcomes: Number(feedback.ratedOutcomes),
90
+ usefulOutcomes: Number(feedback.usefulOutcomes),
91
+ unhelpfulOutcomes: Number(feedback.unhelpfulOutcomes),
92
+ scenesWithUsefulOutcomes: Number(feedback.scenesWithUsefulOutcomes),
93
+ checks: Number(work.checks),
94
+ failedChecks: Number(work.failedChecks),
95
+ skippedChecks: Number(work.skippedChecks)
96
+ };
97
+ }
98
+ };
99
+ //#endregion
100
+ export { SceneMetrics };
@@ -0,0 +1,3 @@
1
+ import type { Config } from '../config/schema.js';
2
+ /** Scene reasoning follows the existing agent model policy and falls back to chat. */
3
+ export declare function resolveSceneModelRef(config: Config): string;
@@ -0,0 +1,10 @@
1
+ import { init_agent_scope, resolveDefaultAgentId } from "../agent/agent-scope.js";
2
+ import { resolveModelSelector } from "../config/agent-model-intents.js";
3
+ //#region src/scenes/model.ts
4
+ init_agent_scope();
5
+ /** Scene reasoning follows the existing agent model policy and falls back to chat. */
6
+ function resolveSceneModelRef(config) {
7
+ return resolveModelSelector(config, resolveDefaultAgentId(config), "@reasoning");
8
+ }
9
+ //#endregion
10
+ export { resolveSceneModelRef };
@@ -0,0 +1,17 @@
1
+ import type { DatabaseSync } from 'node:sqlite';
2
+ import type { NotificationResult } from '../notifications/resultOutbox.js';
3
+ export type SceneNotificationEligibility = {
4
+ action: 'cancel';
5
+ reason: string;
6
+ } | {
7
+ action: 'defer';
8
+ until: number;
9
+ } | {
10
+ action: 'eligible';
11
+ activationId: string;
12
+ presentationId: string;
13
+ revision: number;
14
+ kind: string;
15
+ };
16
+ /** Local result eligibility only. The host must still recheck connector authorization and attention policy. */
17
+ export declare function sceneNotificationEligibility(db: DatabaseSync, result: NotificationResult, now: number, expectedRevision?: number): SceneNotificationEligibility;
@@ -0,0 +1,72 @@
1
+ //#region src/scenes/notificationEligibility.ts
2
+ /** Local result eligibility only. The host must still recheck connector authorization and attention policy. */
3
+ function sceneNotificationEligibility(db, result, now, expectedRevision) {
4
+ if (!result.ownerId.trim() || !result.workspaceId.trim() || !result.subjectId.trim()) return {
5
+ action: "cancel",
6
+ reason: "invalid_scope"
7
+ };
8
+ const row = db.prepare(`SELECT p.id, p.status, p.notification_revision, p.withdrawn_at, p.expires_at, p.snoozed_until,
9
+ r.activation_id, r.activation_revision, a.revision, a.status AS activation_status, o.kind
10
+ FROM scene_presentations p JOIN scene_outcomes o ON o.id = p.outcome_id
11
+ JOIN scene_runs r ON r.id = o.run_id JOIN scene_activations a ON a.id = r.activation_id
12
+ WHERE p.id = ? AND p.destination = 'inbox' AND a.owner_id = ? AND a.workspace_id = ?`).get(result.subjectId, result.ownerId, result.workspaceId);
13
+ if (!row) return {
14
+ action: "cancel",
15
+ reason: "result_unavailable"
16
+ };
17
+ if (row.activation_status !== "active") return {
18
+ action: "cancel",
19
+ reason: "activation_inactive"
20
+ };
21
+ if (row.activation_revision !== row.revision) return {
22
+ action: "cancel",
23
+ reason: "activation_changed"
24
+ };
25
+ if (row.kind === "no_change") return {
26
+ action: "cancel",
27
+ reason: "no_change"
28
+ };
29
+ if (expectedRevision !== void 0 && row.notification_revision !== expectedRevision) return {
30
+ action: "cancel",
31
+ reason: "result_changed"
32
+ };
33
+ if (row.withdrawn_at !== null || row.status === "withdrawn") return {
34
+ action: "cancel",
35
+ reason: "result_withdrawn"
36
+ };
37
+ if (row.expires_at !== null && Number(row.expires_at) <= now) return {
38
+ action: "cancel",
39
+ reason: "result_expired"
40
+ };
41
+ if (row.status === "read" || row.status === "resolved") return {
42
+ action: "cancel",
43
+ reason: "result_reviewed"
44
+ };
45
+ if (row.status === "snoozed") {
46
+ if (row.snoozed_until === null) return {
47
+ action: "cancel",
48
+ reason: "invalid_snooze"
49
+ };
50
+ if (Number(row.snoozed_until) > now) return {
51
+ action: "defer",
52
+ until: Number(row.snoozed_until)
53
+ };
54
+ } else if (row.status !== "unread") return {
55
+ action: "cancel",
56
+ reason: "result_unavailable"
57
+ };
58
+ const health = db.prepare("SELECT reason, retry_at FROM scene_source_health WHERE activation_id = ?").get(row.activation_id);
59
+ if (health?.reason) return {
60
+ action: "defer",
61
+ until: Math.max(now + 6e4, Number(health.retry_at ?? 0))
62
+ };
63
+ return {
64
+ action: "eligible",
65
+ activationId: String(row.activation_id),
66
+ presentationId: String(row.id),
67
+ revision: Number(row.notification_revision),
68
+ kind: String(row.kind)
69
+ };
70
+ }
71
+ //#endregion
72
+ export { sceneNotificationEligibility };
@@ -0,0 +1,7 @@
1
+ import type { DatabaseSync } from 'node:sqlite';
2
+ import { NotificationResultOutbox, type NotificationResult, type PublicationDecision } from '../notifications/resultOutbox.js';
3
+ import { type SceneNotificationEligibility } from './notificationEligibility.js';
4
+ /** The required host callback applies attention policy and persists notification/dispatch records, without sending. */
5
+ export declare function createSceneNotificationOutbox(db: DatabaseSync, publish: (result: NotificationResult, eligible: Extract<SceneNotificationEligibility, {
6
+ action: 'eligible';
7
+ }>) => PublicationDecision, clock?: () => number): NotificationResultOutbox;
@@ -0,0 +1,43 @@
1
+ import { ScenePreferenceService, sceneChecksAllowed } from "./preferences.js";
2
+ import { notificationQuietUntil } from "../notifications/quietHours.js";
3
+ import { NotificationResultOutbox } from "../notifications/resultOutbox.js";
4
+ import { sceneNotificationEligibility } from "./notificationEligibility.js";
5
+ //#region src/scenes/notificationPublication.ts
6
+ /** The required host callback applies attention policy and persists notification/dispatch records, without sending. */
7
+ function createSceneNotificationOutbox(db, publish, clock = Date.now) {
8
+ return new NotificationResultOutbox(db, (result) => {
9
+ const now = clock();
10
+ const eligibility = sceneNotificationEligibility(db, result, now);
11
+ if (eligibility.action === "cancel") return {
12
+ action: "settle",
13
+ reason: eligibility.reason
14
+ };
15
+ if (eligibility.action === "defer") return {
16
+ ...eligibility,
17
+ reason: "result_snoozed"
18
+ };
19
+ const preferences = new ScenePreferenceService(db).get(result);
20
+ if (!sceneChecksAllowed(preferences, now)) return {
21
+ action: "settle",
22
+ reason: "checks_paused"
23
+ };
24
+ if (preferences.notificationsMuted || preferences.level === "quiet") return {
25
+ action: "settle",
26
+ reason: "notifications_muted"
27
+ };
28
+ if (preferences.suppressWhileViewing && db.prepare(`SELECT 1 FROM notification_presence
29
+ WHERE owner_id = ? AND workspace_id = ? AND subject_id = ? AND subject_revision = ? AND expires_at > ?`).get(result.ownerId, result.workspaceId, result.subjectId, eligibility.revision, now)) return {
30
+ action: "settle",
31
+ reason: "result_viewed"
32
+ };
33
+ const quietUntil = notificationQuietUntil(preferences, now);
34
+ if (quietUntil !== null) return {
35
+ action: "defer",
36
+ until: quietUntil,
37
+ reason: "quiet_hours"
38
+ };
39
+ return publish(result, eligibility);
40
+ }, clock);
41
+ }
42
+ //#endregion
43
+ export { createSceneNotificationOutbox };
@@ -0,0 +1,40 @@
1
+ import type { DatabaseSync } from 'node:sqlite';
2
+ import { z } from 'zod';
3
+ import type { ScenePrincipal } from './contracts.js';
4
+ export declare const scenePreferencesSchema: z.ZodObject<{
5
+ level: z.ZodDefault<z.ZodEnum<{
6
+ active: "active";
7
+ quiet: "quiet";
8
+ balanced: "balanced";
9
+ }>>;
10
+ timezone: z.ZodDefault<z.ZodString>;
11
+ quietStartHour: z.ZodDefault<z.ZodNumber>;
12
+ quietEndHour: z.ZodDefault<z.ZodNumber>;
13
+ dailyNotificationLimit: z.ZodDefault<z.ZodNumber>;
14
+ digestEnabled: z.ZodDefault<z.ZodBoolean>;
15
+ digestHour: z.ZodDefault<z.ZodNumber>;
16
+ digestMinute: z.ZodDefault<z.ZodNumber>;
17
+ preferredChannel: z.ZodDefault<z.ZodEnum<{
18
+ browser: "browser";
19
+ in_app: "in_app";
20
+ }>>;
21
+ suppressWhileViewing: z.ZodDefault<z.ZodBoolean>;
22
+ checksPaused: z.ZodDefault<z.ZodBoolean>;
23
+ checksPausedUntil: z.ZodDefault<z.ZodNullable<z.ZodString>>;
24
+ notificationsMuted: z.ZodDefault<z.ZodBoolean>;
25
+ }, z.core.$strict>;
26
+ export type ScenePreferences = z.infer<typeof scenePreferencesSchema>;
27
+ /** Owner-scoped choices. Muting presentation never changes check permissions or deletes work. */
28
+ export declare class ScenePreferenceService {
29
+ private readonly db;
30
+ constructor(db: DatabaseSync);
31
+ get(principal: ScenePrincipal): ScenePreferences & {
32
+ revision: number;
33
+ };
34
+ update(principal: ScenePrincipal, value: unknown): ScenePreferences & {
35
+ revision: number;
36
+ };
37
+ recordPresence(principal: ScenePrincipal, value: unknown, now?: number): void;
38
+ private assertPrincipal;
39
+ }
40
+ export declare function sceneChecksAllowed(preferences: ScenePreferences, now: number): boolean;
@@ -0,0 +1,108 @@
1
+ import { SceneConflictError, SceneNotFoundError } from "./repository.js";
2
+ import { z } from "zod";
3
+ //#region src/scenes/preferences.ts
4
+ const hour = z.number().int().min(0).max(23);
5
+ const scenePreferencesSchema = z.strictObject({
6
+ level: z.enum([
7
+ "quiet",
8
+ "balanced",
9
+ "active"
10
+ ]).default("balanced"),
11
+ timezone: z.string().min(1).max(100).refine((value) => {
12
+ try {
13
+ new Intl.DateTimeFormat("en", { timeZone: value });
14
+ return true;
15
+ } catch {
16
+ return false;
17
+ }
18
+ }).default("Asia/Shanghai"),
19
+ quietStartHour: hour.default(22),
20
+ quietEndHour: hour.default(8),
21
+ dailyNotificationLimit: z.number().int().min(0).max(30).default(3),
22
+ digestEnabled: z.boolean().default(false),
23
+ digestHour: hour.default(18),
24
+ digestMinute: z.number().int().min(0).max(59).default(0),
25
+ preferredChannel: z.enum(["in_app", "browser"]).default("browser"),
26
+ suppressWhileViewing: z.boolean().default(true),
27
+ checksPaused: z.boolean().default(false),
28
+ checksPausedUntil: z.string().datetime({ offset: true }).nullable().default(null),
29
+ notificationsMuted: z.boolean().default(false)
30
+ });
31
+ /** Owner-scoped choices. Muting presentation never changes check permissions or deletes work. */
32
+ var ScenePreferenceService = class {
33
+ constructor(db) {
34
+ this.db = db;
35
+ }
36
+ get(principal) {
37
+ this.assertPrincipal(principal);
38
+ const row = this.db.prepare("SELECT preferences_json, revision FROM scene_preferences WHERE owner_id = ? AND workspace_id = ?").get(principal.ownerId, principal.workspaceId);
39
+ return {
40
+ ...scenePreferencesSchema.parse(row ? JSON.parse(String(row.preferences_json)) : {}),
41
+ revision: row ? Number(row.revision) : 0
42
+ };
43
+ }
44
+ update(principal, value) {
45
+ this.assertPrincipal(principal);
46
+ const supplied = z.record(z.string(), z.unknown()).parse(value);
47
+ const { expectedRevision, ...parsed } = scenePreferencesSchema.partial().extend({ expectedRevision: z.number().int().nonnegative() }).parse(value);
48
+ const patch = Object.fromEntries(Object.entries(parsed).filter(([key]) => Object.hasOwn(supplied, key) && supplied[key] !== void 0));
49
+ this.db.exec("SAVEPOINT scene_preferences_write");
50
+ try {
51
+ const { revision, ...current } = this.get(principal);
52
+ if (revision !== expectedRevision) throw new SceneConflictError("Scene preferences changed");
53
+ const next = scenePreferencesSchema.parse({
54
+ ...current,
55
+ ...patch
56
+ });
57
+ this.db.prepare(`INSERT INTO scene_preferences(owner_id, workspace_id, preferences_json, revision) VALUES (?, ?, ?, ?)
58
+ ON CONFLICT(owner_id, workspace_id) DO UPDATE SET preferences_json = excluded.preferences_json, revision = excluded.revision`).run(principal.ownerId, principal.workspaceId, JSON.stringify(next), revision + 1);
59
+ if (next.checksPaused !== current.checksPaused || next.checksPausedUntil !== current.checksPausedUntil) {
60
+ this.db.prepare("UPDATE scene_activations SET revision = revision + 1 WHERE owner_id = ? AND workspace_id = ? AND status = 'active'").run(principal.ownerId, principal.workspaceId);
61
+ this.db.prepare(`UPDATE scene_runs SET status = 'cancelled', reason = 'check_policy_changed', lease_epoch = lease_epoch + 1,
62
+ lease_owner = NULL, lease_until = NULL WHERE status IN ('running', 'retry_wait') AND activation_id IN
63
+ (SELECT id FROM scene_activations WHERE owner_id = ? AND workspace_id = ?)`).run(principal.ownerId, principal.workspaceId);
64
+ this.db.prepare(`UPDATE scene_trigger_intents SET status = 'cancelled' WHERE status IN ('pending', 'claimed') AND activation_id IN
65
+ (SELECT id FROM scene_activations WHERE owner_id = ? AND workspace_id = ?)`).run(principal.ownerId, principal.workspaceId);
66
+ }
67
+ this.db.exec("RELEASE scene_preferences_write");
68
+ return {
69
+ ...next,
70
+ revision: revision + 1
71
+ };
72
+ } catch (error) {
73
+ this.db.exec("ROLLBACK TO scene_preferences_write");
74
+ this.db.exec("RELEASE scene_preferences_write");
75
+ throw error;
76
+ }
77
+ }
78
+ recordPresence(principal, value, now = Date.now()) {
79
+ this.assertPrincipal(principal);
80
+ const input = z.strictObject({
81
+ clientId: z.string().trim().min(1).max(100),
82
+ surface: z.enum(["web", "electron"]),
83
+ presentationId: z.string().min(1).max(200),
84
+ visible: z.boolean()
85
+ }).parse(value);
86
+ if (!input.visible) {
87
+ this.db.prepare("DELETE FROM notification_presence WHERE owner_id = ? AND workspace_id = ? AND client_id = ?").run(principal.ownerId, principal.workspaceId, input.clientId);
88
+ return;
89
+ }
90
+ const row = this.db.prepare(`SELECT p.notification_revision FROM scene_presentations p
91
+ JOIN scene_outcomes o ON o.id = p.outcome_id JOIN scene_runs r ON r.id = o.run_id
92
+ JOIN scene_activations a ON a.id = r.activation_id
93
+ WHERE p.id = ? AND a.owner_id = ? AND a.workspace_id = ? AND p.withdrawn_at IS NULL`).get(input.presentationId, principal.ownerId, principal.workspaceId);
94
+ if (!row) throw new SceneNotFoundError("Scene result not found");
95
+ this.db.prepare(`INSERT INTO notification_presence VALUES (?, ?, ?, ?, ?, ?, ?)
96
+ ON CONFLICT(owner_id, workspace_id, client_id) DO UPDATE SET surface = excluded.surface,
97
+ expires_at = excluded.expires_at, subject_id = excluded.subject_id, subject_revision = excluded.subject_revision`).run(principal.ownerId, principal.workspaceId, input.clientId, input.surface, now + 45e3, input.presentationId, row.notification_revision);
98
+ this.db.prepare("DELETE FROM notification_presence WHERE expires_at <= ?").run(now);
99
+ }
100
+ assertPrincipal(principal) {
101
+ if (!principal.ownerId.trim() || !principal.workspaceId.trim()) throw new Error("Scene principal is required");
102
+ }
103
+ };
104
+ function sceneChecksAllowed(preferences, now) {
105
+ return !preferences.checksPaused && !(preferences.checksPausedUntil && Date.parse(preferences.checksPausedUntil) > now);
106
+ }
107
+ //#endregion
108
+ export { ScenePreferenceService, sceneChecksAllowed, scenePreferencesSchema };
@@ -0,0 +1,7 @@
1
+ export type SceneSourceFailure = 'source_not_ready' | 'needs_permission' | 'source_rate_limited' | 'source_timeout';
2
+ /** A source failure is separate from a model execution failure. */
3
+ export declare class SceneSourceNotReady extends Error {
4
+ readonly reason: SceneSourceFailure;
5
+ constructor(reason?: SceneSourceFailure);
6
+ }
7
+ export declare function sceneSourceFailureReason(error: unknown): SceneSourceFailure;
@@ -0,0 +1,20 @@
1
+ //#region src/scenes/readiness.ts
2
+ /** A source failure is separate from a model execution failure. */
3
+ var SceneSourceNotReady = class extends Error {
4
+ constructor(reason = "source_not_ready") {
5
+ super("Scene source is stale or not synchronized yet");
6
+ this.reason = reason;
7
+ }
8
+ };
9
+ function sceneSourceFailureReason(error) {
10
+ if (error instanceof SceneSourceNotReady) return error.reason;
11
+ const value = error;
12
+ const status = Number(value?.statusCode ?? value?.status);
13
+ const message = typeof error === "string" ? error : value?.message ?? "";
14
+ if (status === 429 || /\b429\b|rate.?limit|too many requests/i.test(message)) return "source_rate_limited";
15
+ if (status === 401 || status === 403 || /\b401\b|\b403\b|permission|authorization|authorized|access|token.*expired|invalid.grant/i.test(message)) return "needs_permission";
16
+ if (value?.name === "AbortError" || value?.name === "TimeoutError" || /timed out|timeout/i.test(message)) return "source_timeout";
17
+ return "source_not_ready";
18
+ }
19
+ //#endregion
20
+ export { SceneSourceNotReady, sceneSourceFailureReason };
@@ -0,0 +1,174 @@
1
+ import type { SceneModelUsage } from './contracts.js';
2
+ import type { DatabaseSync } from 'node:sqlite';
3
+ import { type ActivationStatus, type SceneActivation, type ScenePrincipal, type SceneTemplate } from './contracts.js';
4
+ export interface SceneEventInput {
5
+ source: string;
6
+ sourceEventId: string;
7
+ eventType: string;
8
+ subjectId: string;
9
+ occurredAt: number;
10
+ accountId?: string;
11
+ }
12
+ export interface SceneRunClaim {
13
+ id: string;
14
+ intentId: string;
15
+ activationId: string;
16
+ activationRevision: number;
17
+ leaseOwner: string;
18
+ leaseEpoch: number;
19
+ attempt: number;
20
+ }
21
+ export interface SceneWorkItem {
22
+ id: string;
23
+ activationId: string;
24
+ subjectId: string;
25
+ accountId: string;
26
+ dueAt: number;
27
+ revision: number;
28
+ status: 'watching' | 'paused' | 'completed';
29
+ }
30
+ export declare class SceneConflictError extends Error {
31
+ }
32
+ export declare class SceneNotFoundError extends Error {
33
+ }
34
+ export declare class SceneInputError extends Error {
35
+ }
36
+ /** The caller supplies the database; storage is initialized by the normal database upgrade. */
37
+ export declare class SceneRepository {
38
+ private readonly db;
39
+ constructor(db: DatabaseSync);
40
+ private transaction;
41
+ installTemplate(value: unknown): SceneTemplate;
42
+ getTemplate(key: string, version: string): SceneTemplate;
43
+ listTemplates(): SceneTemplate[];
44
+ listRuns(principal: ScenePrincipal, activationId: string, limit?: number, afterId?: string): Record<string, import("node:sqlite").SQLOutputValue>[];
45
+ createActivation(principal: ScenePrincipal, value: unknown, requestId?: string): SceneActivation;
46
+ listActivations(principal: ScenePrincipal, limit?: number, afterId?: string): SceneActivation[];
47
+ getActivation(principal: ScenePrincipal, id: string): SceneActivation;
48
+ recordSourceHealth(activation: SceneActivation, reason: string | null, now: number, retryAt?: number | null): void;
49
+ getSourceHealth(activationId: string): Record<string, import("node:sqlite").SQLOutputValue>;
50
+ reuseUnchangedResult(claim: SceneRunClaim, hash: string, now: number, inspectOnly?: boolean): boolean;
51
+ /** Configuration edits require a fresh preflight before any execution resumes. */
52
+ configureActivation(principal: ScenePrincipal, id: string, revision: number, value: unknown): SceneActivation;
53
+ writeNotes(principal: ScenePrincipal, id: string, value: unknown, now: number): number;
54
+ readNotes(principal: ScenePrincipal, id: string): Record<string, import("node:sqlite").SQLOutputValue>;
55
+ listWorkItems(principal: ScenePrincipal, activationId: string, limit?: number, afterId?: string): Record<string, import("node:sqlite").SQLOutputValue>[];
56
+ listSchedules(principal: ScenePrincipal, activationId: string): {
57
+ triggerKey: string;
58
+ schedule: {
59
+ weekdays: number[];
60
+ hour: number;
61
+ minute: number;
62
+ timeZone: string;
63
+ };
64
+ revision: number;
65
+ nextDueAt: number;
66
+ }[];
67
+ createWorkItem(principal: ScenePrincipal, activationId: string, input: {
68
+ subjectId: string;
69
+ accountId: string;
70
+ dueAt: number;
71
+ }, now: number): SceneWorkItem;
72
+ /** Internal worker scan; identity comes from persisted ownership, never an event payload. */
73
+ recordModelUsage(claim: SceneRunClaim, usage: SceneModelUsage, now: number): void;
74
+ listMailObservationItems(afterId?: string, now?: number): Array<{
75
+ principal: ScenePrincipal;
76
+ item: SceneWorkItem;
77
+ }>;
78
+ isMailObservationCurrent(activation: SceneActivation, item: SceneWorkItem, now?: number): boolean;
79
+ observeMailWorkItem(principal: ScenePrincipal, item: SceneWorkItem, fingerprint: string, now: number): boolean;
80
+ /** Revision changes invalidate only this item's pending work and visible results. */
81
+ updateWorkItem(principal: ScenePrincipal, id: string, input: {
82
+ expectedRevision: number;
83
+ status?: SceneWorkItem['status'];
84
+ dueAt?: number;
85
+ }, now: number): SceneWorkItem;
86
+ /** Due dates are durable; restarting cannot generate a second occurrence. */
87
+ enqueueDueWorkItems(now: number): number;
88
+ transitionActivation(principal: ScenePrincipal, id: string, revision: number, status: ActivationStatus, now?: number): SceneActivation;
89
+ setSchedule(principal: ScenePrincipal, activationId: string, triggerKey: string, expectedRevision: number, value: unknown, now: number): number;
90
+ /** Coalesces missed occurrences into at most one bounded catch-up per schedule. */
91
+ enqueueDueSchedules(now: number): number;
92
+ /** Called by an authorized producer inside its domain transaction when applicable. */
93
+ acceptTrigger(principal: ScenePrincipal, activationId: string, input: {
94
+ event: SceneEventInput;
95
+ triggerKey: string;
96
+ occurrenceKey: string;
97
+ dueAt: number;
98
+ }, now: number): string;
99
+ acceptManualCheck(principal: ScenePrincipal, activationId: string, triggerKey: string, requestId: string, now: number): string;
100
+ claimNext(worker: string, now: number, leaseMs?: number): SceneRunClaim | null;
101
+ renewLease(claim: SceneRunClaim, now: number, leaseMs: number): boolean;
102
+ reserveModelCall(claim: SceneRunClaim, now: number, limits?: {
103
+ activation: number;
104
+ owner: number;
105
+ }): boolean;
106
+ deferRun(claim: SceneRunClaim, now: number, reason: 'source_not_ready' | 'daily_budget', retryAt: number): 'deferred' | 'failed' | 'discarded';
107
+ getRunInput(claim: SceneRunClaim, now: number): {
108
+ activation: SceneActivation;
109
+ subjectId: string;
110
+ accountId?: string;
111
+ notBefore?: number;
112
+ } | null;
113
+ saveSnapshot(claim: SceneRunClaim, hash: string, evidenceIds: string[], now: number): boolean;
114
+ finishReadOnlyRun(claim: SceneRunClaim, result: {
115
+ kind: 'no_change' | 'observation' | 'artifact' | 'decision';
116
+ summary: string;
117
+ evidenceIds: string[];
118
+ }, now: number): boolean;
119
+ listInbox(principal: ScenePrincipal, limit?: number, afterId?: string, activationId?: string | null): {
120
+ createdAt: number;
121
+ sources: {
122
+ kind: string;
123
+ title: string;
124
+ sender: string;
125
+ href: string;
126
+ }[];
127
+ sourceHealth: Record<string, import("node:sqlite").SQLOutputValue>;
128
+ id: string;
129
+ activationId: string;
130
+ outcomeId: string;
131
+ content: unknown;
132
+ status: string;
133
+ readOnly: boolean;
134
+ }[];
135
+ getPresentation(principal: ScenePrincipal, id: string): {
136
+ createdAt: number;
137
+ sources: {
138
+ kind: string;
139
+ title: string;
140
+ sender: string;
141
+ href: string;
142
+ }[];
143
+ sourceHealth: Record<string, import("node:sqlite").SQLOutputValue>;
144
+ id: string;
145
+ activationId: string;
146
+ outcomeId: string;
147
+ content: unknown;
148
+ status: string;
149
+ readOnly: boolean;
150
+ };
151
+ listDigestResults(principal: ScenePrincipal, digestId: string, limit?: number, afterId?: string): {
152
+ outcomes: {
153
+ createdAt: number;
154
+ sources: {
155
+ kind: string;
156
+ title: string;
157
+ sender: string;
158
+ href: string;
159
+ }[];
160
+ sourceHealth: Record<string, import("node:sqlite").SQLOutputValue>;
161
+ id: string;
162
+ activationId: string;
163
+ outcomeId: string;
164
+ content: unknown;
165
+ status: string;
166
+ readOnly: boolean;
167
+ }[];
168
+ nextCursor: string;
169
+ };
170
+ failRun(claim: SceneRunClaim, now: number, reason: string, retryAt?: number): boolean;
171
+ private isCurrentClaim;
172
+ private readClaim;
173
+ private assertPrincipal;
174
+ }