@xopcai/xopc 0.0.309 → 0.0.311
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-XKNYlFUI.js → activity-store-DVUTs1fk.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-1S2TFECE.js → agent-avatar-dicebear-zKINl7UH.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D2ePZKdY.js +1 -0
- package/dist/gateway/static/root/assets/{agents-CPqUMtCL.js → agents-BiD9STyv.js} +1 -1
- package/dist/gateway/static/root/assets/{api-BEUEE4f2.js → api-_aHQA8bd.js} +1 -1
- package/dist/gateway/static/root/assets/{app-link-BiBXVEvp.js → app-link-wamYbNUl.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CgVBSqzu.js → app-management-settings-panel-C94LAxyt.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CoWdCokb.js → appearance-settings-CP01zHvC.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-B7DmSJQj.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-C3ZA6LRS.js → archive-plugin-SwWFt5MT.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CdgS6_zy.js → attachment-load-DdTFml9l.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BtHL2hpg.js → automations-page-Kmr5WVFp.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-bkijiu-Y.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CiDhtq_H.js → binary-plugins-47UTtDNq.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Br00T83w.js → block-editor-DvzZkMG8.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-D2tILykA.js → browser-automation-inputs-C611KRBx.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BVuEmryB.js → browser-automations-page-DrUKNL9X.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-Dhf_MWCf.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BCubrDf8.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-e4T1DEfN.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-JsMtzDao.js → chat-terminal-dock-Bg_m7HUE.js} +2 -2
- package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-Cq1tE_3b.js → chunk-KS7C4IRE-BMYIfy9x.js} +2 -2
- package/dist/gateway/static/root/assets/computer-settings-page-CosCmVsT.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-DZFNUTiN.js → connector-service-page-BL-hSR7_.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-C0WWxnxJ.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-DqYFVasF.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-B-BcuG1y.js → dependency-picker-DCyyFLKp.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CdBBhhdY.js → desktop-pet-CFnnpRA_.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-U5wWRH4c.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-BhHxvFO1.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BFp5eKtY.js → extension-debug-page-DA8WJ3-E.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DL3vyyH6.js → extension-page-C2BIB88m.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BXtvdAsY.js → extension-settings-page-kpYo979N.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-xAOGtenO.js → gateway-config-swr-DUDX42qY.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-BuaTsMSi.js → gateway-realtime-CGOW0-b4.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-D4um_sV7.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CE9t1yTa.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BwDxKHd4.js → gateway-startup-retry-Cf8OxlvY.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-C7Ezx8Du.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-wGMeI_yW.js → image-generation-api-D2YorS--.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-zexFT5Rq.js → imports-page-NPk698vI.js} +1 -1
- package/dist/gateway/static/root/assets/index-1wIKA-kM.css +1 -0
- package/dist/gateway/static/root/assets/index-DxYitLp8.js +79 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CutG9zLh.js → keyboard-shortcuts-settings-BhreF0_O.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CPmynb3x.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CJy6I7Dt.js → local-apps-page-DOZZBdqj.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DPZ79W1-.js → locale-store-DA0Z5jM_.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-egGcPHNi.js → logs-page-M8kz26yo.js} +2 -2
- package/dist/gateway/static/root/assets/{management-settings-BQhIOELc.js → management-settings-JLqHYQvY.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-p2P5hP1U.js → markdown-view-BDpcjR_Z.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-DSjfHfaW.css +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-CsBylqlN.js → media-plugins-B75SWUJd.js} +1 -1
- package/dist/gateway/static/root/assets/messages-4BtQKYlM.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-B_Ft0M32.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-C32mxSD-.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-ChQ4jJFs.js → page-tabs-CMlQUzT6.js} +1 -1
- package/dist/gateway/static/root/assets/{popover-select-9i-ZtHXL.js → popover-select-B-GDnZO9.js} +1 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-cZ2hszQT.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-BADxWEdP.js → product-open-page-CPoSbglF.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DYttWua0.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-D46drWbl.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-B_e_nZSN.js → registry-api-C0DCx3wv.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C9n9Nuhi.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-D-pwiIyp.js → runtime-tools-settings-panel-bMLWRApp.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-Dw3hmHAr.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-IWmb05DX.js → schema-form-UVJV_7AS.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-C8P6ff91.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-whpUsAy3.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-B0veRBZs.js → settings-form-section-BqzOqonM.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-DQ9RJ8-b.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-layout-D3Spald3.js +1 -0
- package/dist/gateway/static/root/assets/{settings-shell-layer-context-DCp6ykjQ.js → settings-shell-layer-context-BTQUDoJ2.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C8u601m8.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-CirpgkfD.js → share-preview-page-BcgYzA7y.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Bv-2rZ8e.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-LM-cgWUS.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-ggmb7rCW.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-B42mpWKV.js → skills-page.utils-ADABzrtk.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-DfkcW_Za.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-DC4yqDFd.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-BFbj_2Tu.js → theme-store-CegIlB8d.js} +1 -1
- package/dist/gateway/static/root/assets/tunnel-api-CTuwTdMm.js +1 -0
- package/dist/gateway/static/root/assets/use-autosave-5ZDd9XKh.js +1 -0
- package/dist/gateway/static/root/assets/user-model-page-BFKFhdZ0.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BZbKQ8HT.js → voice-api-key-field-D3urfd-n.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-SKCeQLrH.js → voice-config-api-DTyMdGOR.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BRVTTXNG.js → work-discovery-overlay-JzM3Ylbs.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D2kuwv5e.js → workflow-run-setup-panel-Bn2CtRdB.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BiCmt98A.js +6 -0
- package/dist/gateway/static/root/connector-icons/SOURCES.md +0 -2
- package/dist/gateway/static/root/index.html +17 -20
- package/dist/gateway/static/root/notification-sw.js +1 -1
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/notifications.js +12 -11
- package/dist/packages/gateway-contract/src/proactive.js +6 -6
- package/dist/packages/gateway-contract/src/project-monitoring.js +4 -4
- package/dist/packages/gateway-contract/src/project-operating.js +1 -4
- package/dist/src/agent/agent-manager.d.ts +2 -6
- package/dist/src/agent/agent-manager.js +2 -1
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/commands/command-registry.js +1 -1
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/external-tools/cliProvider.d.ts +47 -0
- package/dist/src/agent/external-tools/cliProvider.js +317 -0
- package/dist/src/agent/external-tools/composio-provider.js +3 -3
- package/dist/src/agent/external-tools/gateway-tools.js +8 -2
- package/dist/src/agent/external-tools/index.js +6 -0
- package/dist/src/agent/external-tools/service.js +1 -1
- package/dist/src/agent/external-tools/types.d.ts +1 -1
- package/dist/src/agent/external-tools/types.js +1 -0
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
- package/dist/src/agent/memory/turn-provenance.js +2 -1
- package/dist/src/agent/service/parse-outbound-session-key.js +1 -1
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +3 -2
- package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +20 -0
- package/dist/src/agent/tools/search/providers/xopc-cloud.js +56 -0
- package/dist/src/agent/tools/search/registry.d.ts +4 -2
- package/dist/src/agent/tools/search/registry.js +5 -3
- package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
- package/dist/src/agent/tools/xopc-use-tool.js +46 -43
- package/dist/src/automations/service/automation-service.d.ts +0 -4
- package/dist/src/automations/service/automation-service.js +0 -31
- package/dist/src/capabilities/store-connector.js +46 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/project.js +1 -1
- package/dist/src/config/schema.d.ts +4 -4
- package/dist/src/config/schema.js +2 -12
- package/dist/src/config/web-patch.js +0 -5
- package/dist/src/connectors/account-selection.d.ts +14 -0
- package/dist/src/connectors/account-selection.js +26 -0
- package/dist/src/connectors/china-catalog.js +93 -226
- package/dist/src/connectors/cli/adapterRegistry.d.ts +4 -0
- package/dist/src/connectors/cli/adapterRegistry.js +26 -0
- package/dist/src/connectors/cli/adapters/lark.d.ts +2 -0
- package/dist/src/connectors/cli/adapters/lark.js +143 -0
- package/dist/src/connectors/cli/adapters/larkShortcuts.d.ts +3 -0
- package/dist/src/connectors/cli/adapters/larkShortcuts.js +64 -0
- package/dist/src/connectors/cli/adapters/wecom.d.ts +2 -0
- package/dist/src/connectors/cli/adapters/wecom.js +97 -0
- package/dist/src/connectors/cli/adapters/wps365/bundle.js +575 -0
- package/dist/src/connectors/cli/adapters/wps365.d.ts +2 -0
- package/dist/src/connectors/cli/adapters/wps365.js +115 -0
- package/dist/src/connectors/cli/assets.d.ts +3 -0
- package/dist/src/connectors/cli/assets.js +44 -0
- package/dist/src/connectors/cli/authorization.d.ts +16 -0
- package/dist/src/connectors/cli/authorization.js +184 -0
- package/dist/src/connectors/cli/distributions.d.ts +4 -0
- package/dist/src/connectors/cli/distributions.js +69 -0
- package/dist/src/connectors/cli/installer.d.ts +5 -0
- package/dist/src/connectors/cli/installer.js +102 -0
- package/dist/src/connectors/cli/lifecycle.d.ts +1 -0
- package/dist/src/connectors/cli/lifecycle.js +19 -0
- package/dist/src/connectors/cli/process.d.ts +18 -0
- package/dist/src/connectors/cli/process.js +100 -0
- package/dist/src/connectors/cli/protocol.d.ts +10 -0
- package/dist/src/connectors/cli/protocol.js +63 -0
- package/dist/src/connectors/cli/runtime.d.ts +10 -0
- package/dist/src/connectors/cli/runtime.js +93 -0
- package/dist/src/connectors/cli/store.d.ts +35 -0
- package/dist/src/connectors/cli/store.js +121 -0
- package/dist/src/connectors/cli/types.d.ts +73 -0
- package/dist/src/connectors/composio-backends.js +1 -1
- package/dist/src/connectors/composio-sessions.d.ts +1 -0
- package/dist/src/connectors/composio-sessions.js +8 -3
- package/dist/src/connectors/composio.js +1 -1
- package/dist/src/connectors/connection-candidates.js +22 -3
- package/dist/src/connectors/connection-recovery-service.d.ts +1 -0
- package/dist/src/connectors/connection-recovery-service.js +53 -8
- package/dist/src/connectors/health.js +52 -0
- package/dist/src/connectors/instances.js +5 -1
- package/dist/src/connectors/lifecycle.js +2 -0
- package/dist/src/connectors/principal.js +2 -1
- package/dist/src/connectors/runtime-adapter-registry.js +31 -0
- package/dist/src/connectors/types.d.ts +13 -1
- package/dist/src/connectors/usage.js +1 -1
- package/dist/src/connectors/workflow-preflight.js +8 -4
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/gateway/hono/app.d.ts +2 -0
- package/dist/src/gateway/hono/app.js +4 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +0 -15
- package/dist/src/gateway/hono/lib/config-payload.js +0 -11
- package/dist/src/gateway/hono/routes/cli-connectors.d.ts +3 -0
- package/dist/src/gateway/hono/routes/cli-connectors.js +219 -0
- package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +2 -2
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +0 -59
- package/dist/src/gateway/hono/routes/config.js +0 -16
- package/dist/src/gateway/hono/routes/connectors.js +21 -22
- package/dist/src/gateway/hono/routes/deps.d.ts +2 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +4 -17
- package/dist/src/gateway/hono/routes/projects.js +1 -1
- package/dist/src/gateway/hono/routes/public-gateway.js +0 -1
- package/dist/src/gateway/hono/routes/scenes.d.ts +3 -0
- package/dist/src/gateway/hono/routes/scenes.js +142 -0
- package/dist/src/gateway/hono/routes/tasks.js +0 -46
- package/dist/src/gateway/hono/routes/user-model.js +54 -1
- package/dist/src/gateway/scenes/browserNotifications.d.ts +4 -0
- package/dist/src/gateway/scenes/browserNotifications.js +54 -0
- package/dist/src/gateway/scenes/host.d.ts +34 -0
- package/dist/src/gateway/scenes/host.js +129 -0
- package/dist/src/gateway/scenes/mailContext.d.ts +32 -0
- package/dist/src/gateway/scenes/mailContext.js +235 -0
- package/dist/src/gateway/security/gateway-scopes.js +0 -4
- package/dist/src/gateway/security/index.js +1 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -10
- package/dist/src/gateway/service/config-coordinator.js +0 -16
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service.d.ts +4 -25
- package/dist/src/gateway/service.js +44 -99
- package/dist/src/gateway/session-context-summary.js +2 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/unhandled-rejections.js +1 -1
- package/dist/src/migrations/runner.js +1 -4
- package/dist/src/notifications/browser-endpoint.d.ts +2 -0
- package/dist/src/notifications/browser-endpoint.js +13 -0
- package/dist/src/notifications/browserSubscriptions.d.ts +20 -0
- package/dist/src/notifications/browserSubscriptions.js +59 -0
- package/dist/src/notifications/browserTransport.d.ts +9 -0
- package/dist/src/notifications/browserTransport.js +64 -0
- package/dist/src/notifications/dispatch.d.ts +46 -0
- package/dist/src/notifications/dispatch.js +109 -0
- package/dist/src/notifications/domain-delivery.d.ts +21 -0
- package/dist/src/notifications/planner.js +0 -36
- package/dist/src/notifications/quietHours.d.ts +6 -0
- package/dist/src/notifications/quietHours.js +23 -0
- package/dist/src/notifications/resultOutbox.d.ts +23 -0
- package/dist/src/notifications/resultOutbox.js +49 -0
- package/dist/src/notifications/service.d.ts +18 -4
- package/dist/src/notifications/service.js +42 -61
- package/dist/src/notifications/store.d.ts +2 -1
- package/dist/src/notifications/store.js +7 -8
- package/dist/src/projects/project-service.d.ts +1 -4
- package/dist/src/projects/project-service.js +2 -30
- package/dist/src/projects/workspace.js +1 -1
- package/dist/src/providers/model-catalog-persistence.js +19 -1
- package/dist/src/providers/model-catalog-store.js +1 -0
- package/dist/src/providers/model-catalog-types.d.ts +17 -0
- package/dist/src/providers/xopc-cloud-model-source.js +27 -0
- package/dist/src/scenes/agentExecutor.d.ts +8 -0
- package/dist/src/scenes/agentExecutor.js +63 -0
- package/dist/src/scenes/contracts.d.ts +118 -0
- package/dist/src/scenes/contracts.js +145 -0
- package/dist/src/scenes/execution.d.ts +56 -0
- package/dist/src/scenes/execution.js +168 -0
- package/dist/src/scenes/httpServices.d.ts +34 -0
- package/dist/src/scenes/inbox.d.ts +16 -0
- package/dist/src/scenes/inbox.js +68 -0
- package/dist/src/scenes/mailContext.d.ts +20 -0
- package/dist/src/scenes/mailContext.js +106 -0
- package/dist/src/scenes/mailObservations.d.ts +20 -0
- package/dist/src/scenes/mailObservations.js +107 -0
- package/dist/src/scenes/maintenance.d.ts +3 -0
- package/dist/src/scenes/maintenance.js +24 -0
- package/dist/src/scenes/metrics.d.ts +35 -0
- package/dist/src/scenes/metrics.js +94 -0
- package/dist/src/scenes/notificationEligibility.d.ts +17 -0
- package/dist/src/scenes/notificationEligibility.js +72 -0
- package/dist/src/scenes/notificationPublication.d.ts +7 -0
- package/dist/src/scenes/notificationPublication.js +43 -0
- package/dist/src/scenes/preferences.d.ts +40 -0
- package/dist/src/scenes/preferences.js +108 -0
- package/dist/src/scenes/readiness.d.ts +7 -0
- package/dist/src/scenes/readiness.js +20 -0
- package/dist/src/scenes/repository.d.ts +174 -0
- package/dist/src/scenes/repository.js +740 -0
- package/dist/src/scenes/resultNotifications.d.ts +17 -0
- package/dist/src/scenes/resultNotifications.js +204 -0
- package/dist/src/scenes/runtime.d.ts +25 -0
- package/dist/src/scenes/runtime.js +101 -0
- package/dist/src/scenes/schedule.d.ts +9 -0
- package/dist/src/scenes/schedule.js +45 -0
- package/dist/src/scenes/service.d.ts +29 -0
- package/dist/src/scenes/service.js +116 -0
- package/dist/src/scenes/templates.d.ts +64 -0
- package/dist/src/scenes/templates.js +76 -0
- package/dist/src/scenes/userNotes.d.ts +10 -0
- package/dist/src/scenes/userNotes.js +34 -0
- package/dist/src/session/resolve-session.js +2 -1
- package/dist/src/session/store.js +2 -1
- package/dist/src/share/share-config.js +0 -5
- package/dist/src/share/site-share-config.js +0 -5
- package/dist/src/storage/sqlite/connection-wait-repository.js +20 -7
- package/dist/src/storage/sqlite/connection.js +1 -1
- package/dist/src/storage/sqlite/connector-account-repository.js +1 -0
- package/dist/src/storage/sqlite/connector-sync-policy-repository.d.ts +0 -4
- package/dist/src/storage/sqlite/connector-sync-policy-repository.js +3 -17
- package/dist/src/storage/sqlite/conversation-repository.js +2 -1
- package/dist/src/storage/sqlite/index.js +2 -1
- package/dist/src/storage/sqlite/migrations/187_cli_connectors.sql +34 -0
- package/dist/src/storage/sqlite/migrations/188_scene_storage.sql +2 -0
- package/dist/src/storage/sqlite/migrations/189_scene_source_health.sql +8 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +2 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.js +7 -3
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +20 -44
- package/dist/src/storage/sqlite/migrations/scene-reset.d.ts +5 -0
- package/dist/src/storage/sqlite/migrations/scene-reset.js +40 -0
- package/dist/src/storage/sqlite/scenes-schema.d.ts +8 -0
- package/dist/src/storage/sqlite/scenes-schema.js +61 -0
- package/dist/src/storage/sqlite/schema.js +4 -10
- package/dist/src/storage/sqlite/schemas/notifications.sql +65 -0
- package/dist/src/storage/sqlite/schemas/scenes.sql +212 -0
- package/dist/src/storage/sqlite/session-read-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/session-read-repository.js +35 -0
- package/dist/src/storage/sqlite/session-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/session-repository.js +2 -25
- package/dist/src/storage/sqlite/sql-assets.d.ts +2 -0
- package/dist/src/storage/sqlite/sql-assets.js +18 -0
- package/dist/src/storage/sqlite/transaction.d.ts +2 -0
- package/dist/src/storage/sqlite/transaction.js +20 -1
- package/dist/src/tasks/home-query-service.d.ts +0 -2
- package/dist/src/tasks/home-query-service.js +13 -43
- package/dist/src/tasks/index.d.ts +0 -1
- package/dist/src/tasks/index.js +4 -5
- package/dist/src/tasks/project-operating-view-service.js +1 -4
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/user-model/goals.d.ts +10 -0
- package/dist/src/user-model/goals.js +29 -1
- package/dist/src/user-model/index.js +2 -2
- package/dist/src/voice/realtime/memory-context.js +2 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +4 -2
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-f0-YFMUz.js +0 -1
- package/dist/gateway/static/root/assets/api-CN4id43t.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-CexHOcWg.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-onJPfmO6.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BgVTyPFY.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Dra8wj1S.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-CkxiMDJ4.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-Dtder4G_.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-DHerePwo.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-cl9ZrV4D.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-DAhdv_Xv.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-PacO1m3a.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-Gy03NgMI.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-aV25nKag.js +0 -1
- package/dist/gateway/static/root/assets/external-link-DjqjBmc3.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BG95uGVW.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-Dcr2Ikeh.js +0 -1
- package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DOy3alvT.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CDm3dGVy.js +0 -1
- package/dist/gateway/static/root/assets/index-D-vczw_0.css +0 -1
- package/dist/gateway/static/root/assets/index-DJo4DimT.js +0 -79
- package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CwLvTwjn.js +0 -2
- package/dist/gateway/static/root/assets/markdown-view-Y68dCxuc.css +0 -1
- package/dist/gateway/static/root/assets/messages-BiYTyLJr.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-c2k5Uz6X.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BLQWJMhf.js +0 -8
- package/dist/gateway/static/root/assets/preview-open-alternatives-9B5W7nVE.js +0 -1
- package/dist/gateway/static/root/assets/proactive-page-iOjI0d_e.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-BcxbQn2M.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BuSvld0O.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CFS8LQKW.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DZjc__ok.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-C1SM5B93.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-CxRWyWYe.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-layout-X1x-2Cp9.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D9Rl7Tec.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-CwCThBs0.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DG6VGbOX.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BdRJ2vnL.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-DXIZpAvU.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-QXo9LJly.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-Db2guRdW.js +0 -1
- package/dist/gateway/static/root/assets/use-autosave-DDY9qoXZ.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-CzPmMkaO.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-CQXtiYtq.js +0 -6
- package/dist/gateway/static/root/connector-icons/wps-calendar.svg +0 -14
- package/dist/gateway/static/root/connector-icons/wps-mail.svg +0 -7
- package/dist/src/connectors/source-change-publisher.d.ts +0 -17
- package/dist/src/connectors/source-change-publisher.js +0 -151
- package/dist/src/gateway/heartbeat/check-store.d.ts +0 -18
- package/dist/src/gateway/heartbeat/check-store.js +0 -74
- package/dist/src/gateway/heartbeat/index.d.ts +0 -1
- package/dist/src/gateway/heartbeat/index.js +0 -2
- package/dist/src/gateway/heartbeat/service.d.ts +0 -55
- package/dist/src/gateway/heartbeat/service.js +0 -228
- package/dist/src/gateway/hono/routes/proactive-control.d.ts +0 -3
- package/dist/src/gateway/hono/routes/proactive-control.js +0 -135
- package/dist/src/gateway/hono/routes/proactive.d.ts +0 -4
- package/dist/src/gateway/hono/routes/proactive.js +0 -164
- package/dist/src/gateway/hono/routes/workspace.d.ts +0 -3
- package/dist/src/gateway/hono/routes/workspace.js +0 -62
- package/dist/src/gateway/workspace-heartbeat-path.d.ts +0 -3
- package/dist/src/gateway/workspace-heartbeat-path.js +0 -14
- package/dist/src/migrations/conversation-routing-config.d.ts +0 -2
- package/dist/src/migrations/conversation-routing-config.js +0 -42
- package/dist/src/notifications/proactive-channel.d.ts +0 -8
- package/dist/src/notifications/proactive-channel.js +0 -60
- package/dist/src/notifications/proactive-policy.d.ts +0 -3
- package/dist/src/notifications/proactive-policy.js +0 -35
- package/dist/src/notifications/web-push.d.ts +0 -19
- package/dist/src/notifications/web-push.js +0 -185
- package/dist/src/proactive/actions/service.d.ts +0 -1
- package/dist/src/proactive/actions/service.js +0 -82
- package/dist/src/proactive/events/envelope.d.ts +0 -2
- package/dist/src/proactive/events/envelope.js +0 -54
- package/dist/src/proactive/events/product-event-bridge.d.ts +0 -7
- package/dist/src/proactive/events/product-event-bridge.js +0 -87
- package/dist/src/proactive/events/publisher.d.ts +0 -4
- package/dist/src/proactive/events/repository.d.ts +0 -9
- package/dist/src/proactive/events/repository.js +0 -63
- package/dist/src/proactive/events/types.d.ts +0 -44
- package/dist/src/proactive/events/types.js +0 -15
- package/dist/src/proactive/execution/agent-executor.d.ts +0 -21
- package/dist/src/proactive/execution/agent-executor.js +0 -125
- package/dist/src/proactive/execution/authorization.d.ts +0 -7
- package/dist/src/proactive/execution/authorization.js +0 -71
- package/dist/src/proactive/execution/context.d.ts +0 -49
- package/dist/src/proactive/execution/context.js +0 -408
- package/dist/src/proactive/execution/insight.d.ts +0 -14
- package/dist/src/proactive/execution/insight.js +0 -132
- package/dist/src/proactive/execution/repository.d.ts +0 -28
- package/dist/src/proactive/execution/repository.js +0 -211
- package/dist/src/proactive/execution/types.d.ts +0 -80
- package/dist/src/proactive/execution/worker.d.ts +0 -15
- package/dist/src/proactive/execution/worker.js +0 -146
- package/dist/src/proactive/experience.d.ts +0 -89
- package/dist/src/proactive/experience.js +0 -195
- package/dist/src/proactive/follow-ups.d.ts +0 -128
- package/dist/src/proactive/follow-ups.js +0 -182
- package/dist/src/proactive/inbox/cards.d.ts +0 -21
- package/dist/src/proactive/inbox/cards.js +0 -276
- package/dist/src/proactive/inbox/delivery.d.ts +0 -6
- package/dist/src/proactive/inbox/delivery.js +0 -54
- package/dist/src/proactive/inbox/digest.d.ts +0 -8
- package/dist/src/proactive/inbox/digest.js +0 -123
- package/dist/src/proactive/inbox/lifecycle.d.ts +0 -4
- package/dist/src/proactive/inbox/lifecycle.js +0 -62
- package/dist/src/proactive/inbox/notification-policy.d.ts +0 -1
- package/dist/src/proactive/inbox/notification-policy.js +0 -25
- package/dist/src/proactive/inbox/repository.d.ts +0 -25
- package/dist/src/proactive/inbox/repository.js +0 -244
- package/dist/src/proactive/inbox/service.d.ts +0 -23
- package/dist/src/proactive/inbox/service.js +0 -46
- package/dist/src/proactive/inbox/types.d.ts +0 -64
- package/dist/src/proactive/inbox/worker.d.ts +0 -13
- package/dist/src/proactive/inbox/worker.js +0 -71
- package/dist/src/proactive/index.d.ts +0 -20
- package/dist/src/proactive/index.js +0 -14
- package/dist/src/proactive/mail-thread.d.ts +0 -13
- package/dist/src/proactive/mail-thread.js +0 -55
- package/dist/src/proactive/maintenance.d.ts +0 -4
- package/dist/src/proactive/maintenance.js +0 -28
- package/dist/src/proactive/metrics.d.ts +0 -10
- package/dist/src/proactive/metrics.js +0 -28
- package/dist/src/proactive/policy/presence.d.ts +0 -2
- package/dist/src/proactive/policy/presence.js +0 -30
- package/dist/src/proactive/policy/service.d.ts +0 -54
- package/dist/src/proactive/policy/service.js +0 -123
- package/dist/src/proactive/routing/batch-repository.d.ts +0 -27
- package/dist/src/proactive/routing/batch-repository.js +0 -57
- package/dist/src/proactive/routing/matcher.d.ts +0 -5
- package/dist/src/proactive/routing/matcher.js +0 -57
- package/dist/src/proactive/routing/types.d.ts +0 -44
- package/dist/src/proactive/routing/types.js +0 -1
- package/dist/src/proactive/scenarios/control.d.ts +0 -52
- package/dist/src/proactive/scenarios/control.js +0 -75
- package/dist/src/proactive/scenarios/prompt-composer.d.ts +0 -14
- package/dist/src/proactive/scenarios/prompt-composer.js +0 -26
- package/dist/src/proactive/scenarios/repository.d.ts +0 -23
- package/dist/src/proactive/scenarios/repository.js +0 -174
- package/dist/src/proactive/scenarios/service.d.ts +0 -15
- package/dist/src/proactive/scenarios/service.js +0 -26
- package/dist/src/proactive/scenarios/types.d.ts +0 -43
- package/dist/src/proactive/scenarios/types.js +0 -1
- package/dist/src/proactive/service.d.ts +0 -25
- package/dist/src/proactive/service.js +0 -78
- package/dist/src/proactive/source-freshness.d.ts +0 -8
- package/dist/src/proactive/source-freshness.js +0 -28
- package/dist/src/proactive/status.d.ts +0 -2
- package/dist/src/proactive/status.js +0 -22
- package/dist/src/proactive/temporal/schedule.d.ts +0 -3
- package/dist/src/proactive/temporal/schedule.js +0 -68
- package/dist/src/proactive/temporal/worker.d.ts +0 -17
- package/dist/src/proactive/temporal/worker.js +0 -129
- package/dist/src/tasks/project-monitoring-service.d.ts +0 -32
- package/dist/src/tasks/project-monitoring-service.js +0 -118
- /package/dist/src/{proactive/execution → connectors/cli}/types.js +0 -0
- /package/dist/src/{proactive/events/publisher.js → notifications/domain-delivery.js} +0 -0
- /package/dist/src/{proactive/inbox/types.js → scenes/httpServices.js} +0 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
export declare const NOTIFICATION_LEDGER_TABLES: readonly ["notification_browser_keys", "notification_browser_subscriptions", "notification_dispatches", "notification_result_outbox", "notification_attention_budget", "notification_digest_queue", "notification_digests", "notification_digest_members", "notification_dispatch_decisions", "notification_browser_probes", "notification_presence"];
|
|
3
|
+
export declare const SCENE_TABLES: readonly ["scene_source_health", "scene_activation_requests", "scene_activations", "scene_context_snapshots", "scene_events", "scene_feedback", "scene_feedback_history", "scene_intent_events", "scene_model_reservations", "scene_notes", "scene_outcomes", "scene_preferences", "scene_presentations", "scene_runs", "scene_schedule_cursors", "scene_template_versions", "scene_trigger_intents", "scene_work_items", "scene_mail_sources", "scene_model_usage", "scene_connector_usage"];
|
|
4
|
+
/** Installs fresh tables; the normal versioned upgrade owns existing databases. */
|
|
5
|
+
export declare function installSceneSchema(db: DatabaseSync): void;
|
|
6
|
+
export declare function installNotificationLedgerSchema(db: DatabaseSync): void;
|
|
7
|
+
export declare function installSceneStorage(db: DatabaseSync): void;
|
|
8
|
+
export declare function assertSceneStorageReady(db: DatabaseSync): void;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { init_sql_assets, readSqliteAsset } from "./sql-assets.js";
|
|
3
|
+
//#region src/storage/sqlite/scenes-schema.ts
|
|
4
|
+
/** Installs fresh tables; the normal versioned upgrade owns existing databases. */
|
|
5
|
+
function installSceneSchema(db) {
|
|
6
|
+
db.exec(readSqliteAsset("schemas/scenes.sql"));
|
|
7
|
+
}
|
|
8
|
+
function installNotificationLedgerSchema(db) {
|
|
9
|
+
db.exec(readSqliteAsset("schemas/notifications.sql"));
|
|
10
|
+
}
|
|
11
|
+
function installSceneStorage(db) {
|
|
12
|
+
installSceneSchema(db);
|
|
13
|
+
installNotificationLedgerSchema(db);
|
|
14
|
+
}
|
|
15
|
+
function assertSceneStorageReady(db) {
|
|
16
|
+
const tables = new Set(db.prepare("SELECT name FROM sqlite_master WHERE type = 'table'").all().map((row) => row.name));
|
|
17
|
+
if ([...SCENE_TABLES, ...NOTIFICATION_LEDGER_TABLES].some((name) => !tables.has(name))) throw new Error("Scene storage is not initialized");
|
|
18
|
+
}
|
|
19
|
+
var NOTIFICATION_LEDGER_TABLES, SCENE_TABLES;
|
|
20
|
+
var init_scenes_schema = __esmMin((() => {
|
|
21
|
+
init_sql_assets();
|
|
22
|
+
NOTIFICATION_LEDGER_TABLES = [
|
|
23
|
+
"notification_browser_keys",
|
|
24
|
+
"notification_browser_subscriptions",
|
|
25
|
+
"notification_dispatches",
|
|
26
|
+
"notification_result_outbox",
|
|
27
|
+
"notification_attention_budget",
|
|
28
|
+
"notification_digest_queue",
|
|
29
|
+
"notification_digests",
|
|
30
|
+
"notification_digest_members",
|
|
31
|
+
"notification_dispatch_decisions",
|
|
32
|
+
"notification_browser_probes",
|
|
33
|
+
"notification_presence"
|
|
34
|
+
];
|
|
35
|
+
SCENE_TABLES = [
|
|
36
|
+
"scene_source_health",
|
|
37
|
+
"scene_activation_requests",
|
|
38
|
+
"scene_activations",
|
|
39
|
+
"scene_context_snapshots",
|
|
40
|
+
"scene_events",
|
|
41
|
+
"scene_feedback",
|
|
42
|
+
"scene_feedback_history",
|
|
43
|
+
"scene_intent_events",
|
|
44
|
+
"scene_model_reservations",
|
|
45
|
+
"scene_notes",
|
|
46
|
+
"scene_outcomes",
|
|
47
|
+
"scene_preferences",
|
|
48
|
+
"scene_presentations",
|
|
49
|
+
"scene_runs",
|
|
50
|
+
"scene_schedule_cursors",
|
|
51
|
+
"scene_template_versions",
|
|
52
|
+
"scene_trigger_intents",
|
|
53
|
+
"scene_work_items",
|
|
54
|
+
"scene_mail_sources",
|
|
55
|
+
"scene_model_usage",
|
|
56
|
+
"scene_connector_usage"
|
|
57
|
+
];
|
|
58
|
+
}));
|
|
59
|
+
//#endregion
|
|
60
|
+
init_scenes_schema();
|
|
61
|
+
export { NOTIFICATION_LEDGER_TABLES, SCENE_TABLES, assertSceneStorageReady, init_scenes_schema, installNotificationLedgerSchema, installSceneSchema, installSceneStorage };
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { init_sql_assets, readSqliteAsset } from "./sql-assets.js";
|
|
2
3
|
import { SCHEMA_META_SCHEMA_VERSION_KEY, ensureSchemaMetaTable, init_schema_version, readSchemaVersion, readSchemaVersionForTest, setSchemaVersion } from "./schema-version.js";
|
|
3
4
|
import { XOPC_DB_BASELINE_SCHEMA_VERSION, XOPC_DB_SCHEMA_VERSION, applyPendingMigrations, init_runner } from "./migrations/runner.js";
|
|
4
|
-
import { dirname, join } from "node:path";
|
|
5
|
-
import { readFileSync } from "node:fs";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
5
|
//#region src/storage/sqlite/schema.ts
|
|
8
|
-
function readSchemaSql() {
|
|
9
|
-
return readFileSync(join(SCHEMA_DIR, "schema.sql"), "utf8");
|
|
10
|
-
}
|
|
11
6
|
function bootstrapFreshDatabase(db) {
|
|
12
7
|
db.exec("BEGIN IMMEDIATE");
|
|
13
8
|
try {
|
|
14
|
-
db.exec(
|
|
9
|
+
db.exec(readSqliteAsset("schema.sql"));
|
|
15
10
|
setSchemaVersion(db, 165);
|
|
16
11
|
db.exec("COMMIT");
|
|
17
12
|
} catch (error) {
|
|
@@ -33,15 +28,14 @@ function ensureXopcDatabaseSchema(db, options = {}) {
|
|
|
33
28
|
currentVersion = 165;
|
|
34
29
|
}
|
|
35
30
|
applyPendingMigrations(db, {
|
|
36
|
-
targetVersion:
|
|
31
|
+
targetVersion: 189,
|
|
37
32
|
databasePath: fresh ? void 0 : options.databasePath
|
|
38
33
|
});
|
|
39
34
|
}
|
|
40
|
-
var SCHEMA_DIR;
|
|
41
35
|
var init_schema = __esmMin((() => {
|
|
36
|
+
init_sql_assets();
|
|
42
37
|
init_runner();
|
|
43
38
|
init_schema_version();
|
|
44
|
-
SCHEMA_DIR = dirname(fileURLToPath(import.meta.url));
|
|
45
39
|
}));
|
|
46
40
|
//#endregion
|
|
47
41
|
init_schema();
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
CREATE TABLE notification_browser_keys (
|
|
2
|
+
id INTEGER PRIMARY KEY CHECK(id = 1), public_key TEXT NOT NULL, private_key TEXT NOT NULL
|
|
3
|
+
);
|
|
4
|
+
CREATE TABLE notification_browser_subscriptions (
|
|
5
|
+
id TEXT PRIMARY KEY, owner_id TEXT NOT NULL, workspace_id TEXT NOT NULL,
|
|
6
|
+
endpoint TEXT NOT NULL UNIQUE, auth_key TEXT NOT NULL, public_key TEXT NOT NULL,
|
|
7
|
+
expires_at INTEGER, language TEXT NOT NULL CHECK(language IN ('en', 'zh')), created_at INTEGER NOT NULL
|
|
8
|
+
);
|
|
9
|
+
CREATE INDEX notification_browser_owner ON notification_browser_subscriptions(owner_id, workspace_id);
|
|
10
|
+
CREATE TABLE notification_presence (
|
|
11
|
+
owner_id TEXT NOT NULL, workspace_id TEXT NOT NULL, client_id TEXT NOT NULL,
|
|
12
|
+
surface TEXT NOT NULL CHECK(surface IN ('web', 'electron', 'mobile')),
|
|
13
|
+
expires_at INTEGER NOT NULL, subject_id TEXT, subject_revision INTEGER,
|
|
14
|
+
PRIMARY KEY(owner_id, workspace_id, client_id)
|
|
15
|
+
);
|
|
16
|
+
CREATE TABLE notification_dispatches (
|
|
17
|
+
id TEXT PRIMARY KEY, notification_id TEXT NOT NULL REFERENCES notification_events(event_id),
|
|
18
|
+
owner_id TEXT NOT NULL, workspace_id TEXT NOT NULL,
|
|
19
|
+
channel TEXT NOT NULL CHECK(channel IN ('browser', 'telegram')),
|
|
20
|
+
destination_id TEXT NOT NULL, destination_json TEXT CHECK(destination_json IS NULL OR json_valid(destination_json)),
|
|
21
|
+
subject_id TEXT, subject_revision INTEGER NOT NULL CHECK(subject_revision > 0),
|
|
22
|
+
status TEXT NOT NULL CHECK(status IN ('pending', 'sending', 'accepted', 'failed', 'unknown', 'cancelled')),
|
|
23
|
+
attempt INTEGER NOT NULL CHECK(attempt >= 0), failure_count INTEGER NOT NULL DEFAULT 0 CHECK(failure_count >= 0),
|
|
24
|
+
next_attempt_at INTEGER NOT NULL,
|
|
25
|
+
lease_until INTEGER, provider_message_id TEXT, last_error TEXT,
|
|
26
|
+
UNIQUE(notification_id, channel, destination_id)
|
|
27
|
+
);
|
|
28
|
+
CREATE INDEX notification_dispatch_due ON notification_dispatches(status, next_attempt_at);
|
|
29
|
+
CREATE INDEX notification_dispatch_owner ON notification_dispatches(owner_id, workspace_id);
|
|
30
|
+
CREATE TABLE notification_result_outbox (
|
|
31
|
+
id TEXT PRIMARY KEY, owner_id TEXT NOT NULL, workspace_id TEXT NOT NULL, subject_id TEXT NOT NULL UNIQUE,
|
|
32
|
+
status TEXT NOT NULL CHECK(status IN ('pending', 'processing', 'settled', 'failed')),
|
|
33
|
+
attempt INTEGER NOT NULL CHECK(attempt >= 0), next_attempt_at INTEGER NOT NULL,
|
|
34
|
+
lease_until INTEGER, last_error TEXT, decision_reason TEXT,
|
|
35
|
+
created_at INTEGER NOT NULL, settled_at INTEGER, updated_at INTEGER NOT NULL
|
|
36
|
+
);
|
|
37
|
+
CREATE TABLE notification_attention_budget (
|
|
38
|
+
dedupe_key TEXT PRIMARY KEY, owner_id TEXT NOT NULL, workspace_id TEXT NOT NULL,
|
|
39
|
+
local_day TEXT NOT NULL, created_at INTEGER NOT NULL
|
|
40
|
+
);
|
|
41
|
+
CREATE INDEX notification_attention_day ON notification_attention_budget(owner_id, workspace_id, local_day);
|
|
42
|
+
CREATE TABLE notification_digest_queue (
|
|
43
|
+
subject_id TEXT PRIMARY KEY, owner_id TEXT NOT NULL, workspace_id TEXT NOT NULL,
|
|
44
|
+
subject_revision INTEGER NOT NULL CHECK(subject_revision > 0), mode TEXT NOT NULL CHECK(mode IN ('daily', 'quiet')),
|
|
45
|
+
due_at INTEGER NOT NULL, consumed_at INTEGER,
|
|
46
|
+
status TEXT NOT NULL CHECK(status IN ('held', 'pending', 'consumed'))
|
|
47
|
+
);
|
|
48
|
+
CREATE TABLE notification_digests (
|
|
49
|
+
id TEXT PRIMARY KEY, owner_id TEXT NOT NULL, workspace_id TEXT NOT NULL, occurrence_key TEXT NOT NULL,
|
|
50
|
+
created_at INTEGER NOT NULL, notification_id TEXT REFERENCES notification_events(event_id),
|
|
51
|
+
UNIQUE(owner_id, workspace_id, occurrence_key)
|
|
52
|
+
);
|
|
53
|
+
CREATE TABLE notification_digest_members (
|
|
54
|
+
digest_id TEXT NOT NULL REFERENCES notification_digests(id), subject_id TEXT NOT NULL,
|
|
55
|
+
subject_revision INTEGER NOT NULL CHECK(subject_revision > 0), PRIMARY KEY(digest_id, subject_id)
|
|
56
|
+
);
|
|
57
|
+
CREATE TABLE notification_dispatch_decisions (
|
|
58
|
+
dedupe_key TEXT PRIMARY KEY, owner_id TEXT NOT NULL, workspace_id TEXT NOT NULL,
|
|
59
|
+
disposition TEXT NOT NULL, created_at INTEGER NOT NULL
|
|
60
|
+
);
|
|
61
|
+
CREATE TABLE notification_browser_probes (
|
|
62
|
+
id TEXT PRIMARY KEY, owner_id TEXT NOT NULL, workspace_id TEXT NOT NULL, subscription_id TEXT NOT NULL,
|
|
63
|
+
status TEXT NOT NULL CHECK(status IN ('accepted', 'opened', 'failed', 'unknown')),
|
|
64
|
+
created_at INTEGER NOT NULL, opened_at INTEGER, error TEXT
|
|
65
|
+
);
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
-- Current scene storage. Historical experimental data is discarded.
|
|
2
|
+
CREATE TABLE scene_template_versions (
|
|
3
|
+
template_key TEXT NOT NULL,
|
|
4
|
+
version TEXT NOT NULL,
|
|
5
|
+
content_hash TEXT NOT NULL,
|
|
6
|
+
manifest_json TEXT NOT NULL CHECK(json_valid(manifest_json)),
|
|
7
|
+
PRIMARY KEY(template_key, version)
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
CREATE TABLE scene_activations (
|
|
11
|
+
id TEXT PRIMARY KEY,
|
|
12
|
+
owner_id TEXT NOT NULL,
|
|
13
|
+
workspace_id TEXT NOT NULL,
|
|
14
|
+
template_key TEXT NOT NULL,
|
|
15
|
+
template_version TEXT NOT NULL,
|
|
16
|
+
goal TEXT NOT NULL,
|
|
17
|
+
scope_json TEXT NOT NULL CHECK(json_valid(scope_json)),
|
|
18
|
+
permissions_json TEXT NOT NULL CHECK(json_valid(permissions_json)),
|
|
19
|
+
status TEXT NOT NULL CHECK(status IN ('needs_setup', 'active', 'paused', 'completed', 'archived')),
|
|
20
|
+
revision INTEGER NOT NULL CHECK(revision > 0),
|
|
21
|
+
FOREIGN KEY(template_key, template_version) REFERENCES scene_template_versions(template_key, version)
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
CREATE INDEX scene_activations_owner ON scene_activations(owner_id, workspace_id, status);
|
|
25
|
+
|
|
26
|
+
CREATE TABLE scene_preferences (
|
|
27
|
+
owner_id TEXT NOT NULL, workspace_id TEXT NOT NULL,
|
|
28
|
+
preferences_json TEXT NOT NULL CHECK(json_valid(preferences_json)), revision INTEGER NOT NULL CHECK(revision > 0),
|
|
29
|
+
PRIMARY KEY(owner_id, workspace_id)
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
CREATE TABLE scene_notes (
|
|
33
|
+
activation_id TEXT PRIMARY KEY REFERENCES scene_activations(id),
|
|
34
|
+
content TEXT NOT NULL,
|
|
35
|
+
revision INTEGER NOT NULL CHECK(revision > 0),
|
|
36
|
+
valid_until INTEGER,
|
|
37
|
+
updated_at INTEGER NOT NULL
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
CREATE TABLE scene_activation_requests (
|
|
41
|
+
owner_id TEXT NOT NULL,
|
|
42
|
+
workspace_id TEXT NOT NULL,
|
|
43
|
+
request_id TEXT NOT NULL,
|
|
44
|
+
content_hash TEXT NOT NULL,
|
|
45
|
+
activation_id TEXT NOT NULL REFERENCES scene_activations(id),
|
|
46
|
+
PRIMARY KEY(owner_id, workspace_id, request_id)
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
CREATE TABLE scene_work_items (
|
|
50
|
+
id TEXT PRIMARY KEY,
|
|
51
|
+
activation_id TEXT NOT NULL REFERENCES scene_activations(id),
|
|
52
|
+
subject_id TEXT NOT NULL,
|
|
53
|
+
account_id TEXT NOT NULL,
|
|
54
|
+
due_at INTEGER NOT NULL,
|
|
55
|
+
revision INTEGER NOT NULL CHECK(revision > 0),
|
|
56
|
+
status TEXT NOT NULL CHECK(status IN ('watching', 'paused', 'completed')),
|
|
57
|
+
last_triggered_revision INTEGER,
|
|
58
|
+
last_check_reason TEXT,
|
|
59
|
+
observed_fingerprint TEXT,
|
|
60
|
+
observation_sequence INTEGER NOT NULL DEFAULT 0,
|
|
61
|
+
UNIQUE(activation_id, account_id, subject_id)
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
CREATE TABLE scene_events (
|
|
65
|
+
id TEXT PRIMARY KEY,
|
|
66
|
+
owner_id TEXT NOT NULL,
|
|
67
|
+
workspace_id TEXT NOT NULL,
|
|
68
|
+
source TEXT NOT NULL,
|
|
69
|
+
source_event_id TEXT NOT NULL,
|
|
70
|
+
event_type TEXT NOT NULL,
|
|
71
|
+
subject_id TEXT NOT NULL,
|
|
72
|
+
occurred_at INTEGER NOT NULL,
|
|
73
|
+
received_at INTEGER NOT NULL,
|
|
74
|
+
account_id TEXT,
|
|
75
|
+
UNIQUE(owner_id, workspace_id, source, source_event_id)
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
CREATE TABLE scene_trigger_intents (
|
|
79
|
+
id TEXT PRIMARY KEY,
|
|
80
|
+
activation_id TEXT NOT NULL REFERENCES scene_activations(id),
|
|
81
|
+
activation_revision INTEGER NOT NULL,
|
|
82
|
+
trigger_key TEXT NOT NULL,
|
|
83
|
+
occurrence_key TEXT NOT NULL,
|
|
84
|
+
event_id TEXT REFERENCES scene_events(id),
|
|
85
|
+
due_at INTEGER NOT NULL,
|
|
86
|
+
status TEXT NOT NULL CHECK(status IN ('pending', 'claimed', 'resolved', 'cancelled')),
|
|
87
|
+
UNIQUE(activation_id, trigger_key, occurrence_key)
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
CREATE INDEX scene_intents_due ON scene_trigger_intents(status, due_at);
|
|
91
|
+
|
|
92
|
+
CREATE TABLE scene_schedule_cursors (
|
|
93
|
+
activation_id TEXT NOT NULL REFERENCES scene_activations(id),
|
|
94
|
+
trigger_key TEXT NOT NULL,
|
|
95
|
+
schedule_json TEXT NOT NULL CHECK(json_valid(schedule_json)),
|
|
96
|
+
revision INTEGER NOT NULL CHECK(revision > 0),
|
|
97
|
+
next_due_at INTEGER NOT NULL,
|
|
98
|
+
PRIMARY KEY(activation_id, trigger_key)
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
CREATE INDEX scene_schedules_due ON scene_schedule_cursors(next_due_at);
|
|
102
|
+
|
|
103
|
+
CREATE TABLE scene_runs (
|
|
104
|
+
id TEXT PRIMARY KEY,
|
|
105
|
+
intent_id TEXT NOT NULL UNIQUE REFERENCES scene_trigger_intents(id),
|
|
106
|
+
activation_id TEXT NOT NULL REFERENCES scene_activations(id),
|
|
107
|
+
activation_revision INTEGER NOT NULL,
|
|
108
|
+
status TEXT NOT NULL CHECK(status IN ('running', 'succeeded', 'skipped', 'retry_wait', 'failed', 'cancelled')),
|
|
109
|
+
attempt INTEGER NOT NULL CHECK(attempt > 0),
|
|
110
|
+
lease_epoch INTEGER NOT NULL CHECK(lease_epoch > 0),
|
|
111
|
+
lease_owner TEXT,
|
|
112
|
+
lease_until INTEGER,
|
|
113
|
+
retry_at INTEGER,
|
|
114
|
+
reason TEXT,
|
|
115
|
+
created_at INTEGER NOT NULL
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
CREATE INDEX scene_runs_lease ON scene_runs(status, lease_until);
|
|
119
|
+
|
|
120
|
+
CREATE TABLE scene_model_reservations (
|
|
121
|
+
run_id TEXT NOT NULL REFERENCES scene_runs(id),
|
|
122
|
+
lease_epoch INTEGER NOT NULL,
|
|
123
|
+
owner_id TEXT NOT NULL,
|
|
124
|
+
activation_id TEXT NOT NULL REFERENCES scene_activations(id),
|
|
125
|
+
reserved_at INTEGER NOT NULL,
|
|
126
|
+
PRIMARY KEY(run_id, lease_epoch)
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
CREATE INDEX scene_model_budget ON scene_model_reservations(owner_id, reserved_at);
|
|
130
|
+
|
|
131
|
+
CREATE UNIQUE INDEX scene_runs_single_active ON scene_runs(activation_id) WHERE status IN ('running', 'retry_wait');
|
|
132
|
+
|
|
133
|
+
CREATE TABLE scene_context_snapshots (
|
|
134
|
+
run_id TEXT NOT NULL REFERENCES scene_runs(id),
|
|
135
|
+
lease_epoch INTEGER NOT NULL,
|
|
136
|
+
content_hash TEXT NOT NULL,
|
|
137
|
+
evidence_ids_json TEXT NOT NULL CHECK(json_valid(evidence_ids_json)),
|
|
138
|
+
created_at INTEGER NOT NULL,
|
|
139
|
+
PRIMARY KEY(run_id, lease_epoch)
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
CREATE TABLE scene_outcomes (
|
|
143
|
+
id TEXT PRIMARY KEY,
|
|
144
|
+
run_id TEXT NOT NULL UNIQUE REFERENCES scene_runs(id),
|
|
145
|
+
kind TEXT NOT NULL CHECK(kind IN ('no_change', 'observation', 'artifact', 'decision', 'state_change', 'effect_proposal', 'receipt')),
|
|
146
|
+
content_json TEXT NOT NULL CHECK(json_valid(content_json)),
|
|
147
|
+
created_at INTEGER NOT NULL
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
CREATE TABLE scene_presentations (
|
|
151
|
+
id TEXT PRIMARY KEY,
|
|
152
|
+
outcome_id TEXT NOT NULL UNIQUE REFERENCES scene_outcomes(id),
|
|
153
|
+
destination TEXT NOT NULL CHECK(destination = 'inbox'),
|
|
154
|
+
status TEXT NOT NULL CHECK(status IN ('unread', 'read', 'snoozed', 'resolved', 'withdrawn')),
|
|
155
|
+
created_at INTEGER NOT NULL,
|
|
156
|
+
updated_at INTEGER, snoozed_until INTEGER, expires_at INTEGER, withdrawn_at INTEGER, actionable_until INTEGER,
|
|
157
|
+
resolution TEXT, revision INTEGER NOT NULL DEFAULT 1 CHECK(revision > 0),
|
|
158
|
+
notification_revision INTEGER NOT NULL DEFAULT 1 CHECK(notification_revision > 0), correlation_key TEXT
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
CREATE TABLE scene_feedback (
|
|
162
|
+
presentation_id TEXT PRIMARY KEY REFERENCES scene_presentations(id),
|
|
163
|
+
rating TEXT NOT NULL CHECK(rating IN ('useful', 'not_useful')),
|
|
164
|
+
note TEXT NOT NULL,
|
|
165
|
+
revision INTEGER NOT NULL CHECK(revision > 0),
|
|
166
|
+
updated_at INTEGER NOT NULL
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
CREATE TABLE scene_feedback_history (
|
|
170
|
+
id TEXT PRIMARY KEY,
|
|
171
|
+
presentation_id TEXT NOT NULL REFERENCES scene_presentations(id),
|
|
172
|
+
rating TEXT NOT NULL CHECK(rating IN ('useful', 'not_useful')),
|
|
173
|
+
note TEXT NOT NULL,
|
|
174
|
+
revision INTEGER NOT NULL CHECK(revision > 0),
|
|
175
|
+
recorded_at INTEGER NOT NULL,
|
|
176
|
+
UNIQUE(presentation_id, revision)
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
CREATE INDEX scene_feedback_history_time ON scene_feedback_history(recorded_at);
|
|
180
|
+
|
|
181
|
+
CREATE TABLE scene_intent_events (
|
|
182
|
+
intent_id TEXT NOT NULL REFERENCES scene_trigger_intents(id), event_id TEXT NOT NULL REFERENCES scene_events(id),
|
|
183
|
+
added_at INTEGER NOT NULL, PRIMARY KEY(intent_id, event_id)
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
CREATE TABLE scene_mail_sources (
|
|
187
|
+
id TEXT PRIMARY KEY, owner_id TEXT NOT NULL, workspace_id TEXT NOT NULL,
|
|
188
|
+
account_id TEXT NOT NULL, thread_id TEXT NOT NULL, subject TEXT NOT NULL, sender TEXT NOT NULL,
|
|
189
|
+
selected_at INTEGER NOT NULL,
|
|
190
|
+
UNIQUE(owner_id, workspace_id, account_id, thread_id)
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
CREATE TABLE scene_model_usage (
|
|
194
|
+
run_id TEXT NOT NULL REFERENCES scene_runs(id), lease_epoch INTEGER NOT NULL,
|
|
195
|
+
provider TEXT NOT NULL, model TEXT NOT NULL, input_tokens INTEGER NOT NULL,
|
|
196
|
+
output_tokens INTEGER NOT NULL, total_tokens INTEGER NOT NULL, estimated_cost REAL NOT NULL,
|
|
197
|
+
recorded_at INTEGER NOT NULL, PRIMARY KEY(run_id, lease_epoch)
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
CREATE TABLE scene_connector_usage (
|
|
201
|
+
owner_id TEXT NOT NULL, workspace_id TEXT NOT NULL, account_id TEXT NOT NULL,
|
|
202
|
+
utc_day INTEGER NOT NULL, request_count INTEGER NOT NULL,
|
|
203
|
+
PRIMARY KEY(owner_id, workspace_id, account_id, utc_day)
|
|
204
|
+
);
|
|
205
|
+
CREATE TABLE IF NOT EXISTS scene_source_health (
|
|
206
|
+
activation_id TEXT PRIMARY KEY REFERENCES scene_activations(id) ON DELETE CASCADE,
|
|
207
|
+
last_attempt_at INTEGER NOT NULL,
|
|
208
|
+
last_success_at INTEGER,
|
|
209
|
+
reason TEXT,
|
|
210
|
+
consecutive_failures INTEGER NOT NULL DEFAULT 0,
|
|
211
|
+
retry_at INTEGER
|
|
212
|
+
);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
import type { SessionMetadata } from '../../session/types.js';
|
|
3
|
+
import { type SessionRow } from './row-mappers.js';
|
|
4
|
+
export declare const SESSION_COLUMNS = "\n s.conversation_id, s.agent_id, s.active_transcript_id, s.status, s.name, s.tags_json,\n s.created_at, s.updated_at, s.last_accessed_at, s.session_started_at, s.last_interaction_at,\n s.source_channel, s.source_chat_id, s.session_type, s.hidden_from_session_list,\n s.parent_conversation_id, s.workflow_run_id, s.workflow_definition_id, s.workflow_agent_id, s.workflow_agent_label,\n s.project_id, s.routing_json, s.custom_data_json,\n s.message_count, s.estimated_tokens, s.compacted_count,\n s.last_flushed_at, s.flush_count,\n s.thinking_level, s.verbose_level,\n t.cwd AS cwd\n";
|
|
5
|
+
export declare const SESSION_FROM_JOIN = "\n FROM sessions s\n LEFT JOIN transcripts t ON t.transcript_id = s.active_transcript_id\n";
|
|
6
|
+
export declare function readSessionRow(db: DatabaseSync, conversationId: string): SessionRow | undefined;
|
|
7
|
+
/** Read metadata without importing session lifecycle operations. */
|
|
8
|
+
export declare function getSessionMetadata(conversationId: string): SessionMetadata | null;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { getSqliteDatabase, init_transaction } from "./transaction.js";
|
|
3
|
+
import { init_row_mappers, sessionRowToMetadata } from "./row-mappers.js";
|
|
4
|
+
//#region src/storage/sqlite/session-read-repository.ts
|
|
5
|
+
function readSessionRow(db, conversationId) {
|
|
6
|
+
return db.prepare(`SELECT ${SESSION_COLUMNS} ${SESSION_FROM_JOIN} WHERE s.conversation_id = ?`).get(conversationId);
|
|
7
|
+
}
|
|
8
|
+
/** Read metadata without importing session lifecycle operations. */
|
|
9
|
+
function getSessionMetadata(conversationId) {
|
|
10
|
+
const row = readSessionRow(getSqliteDatabase(), conversationId);
|
|
11
|
+
return row ? sessionRowToMetadata(conversationId, row) : null;
|
|
12
|
+
}
|
|
13
|
+
var SESSION_COLUMNS, SESSION_FROM_JOIN;
|
|
14
|
+
var init_session_read_repository = __esmMin((() => {
|
|
15
|
+
init_row_mappers();
|
|
16
|
+
init_transaction();
|
|
17
|
+
SESSION_COLUMNS = `
|
|
18
|
+
s.conversation_id, s.agent_id, s.active_transcript_id, s.status, s.name, s.tags_json,
|
|
19
|
+
s.created_at, s.updated_at, s.last_accessed_at, s.session_started_at, s.last_interaction_at,
|
|
20
|
+
s.source_channel, s.source_chat_id, s.session_type, s.hidden_from_session_list,
|
|
21
|
+
s.parent_conversation_id, s.workflow_run_id, s.workflow_definition_id, s.workflow_agent_id, s.workflow_agent_label,
|
|
22
|
+
s.project_id, s.routing_json, s.custom_data_json,
|
|
23
|
+
s.message_count, s.estimated_tokens, s.compacted_count,
|
|
24
|
+
s.last_flushed_at, s.flush_count,
|
|
25
|
+
s.thinking_level, s.verbose_level,
|
|
26
|
+
t.cwd AS cwd
|
|
27
|
+
`;
|
|
28
|
+
SESSION_FROM_JOIN = `
|
|
29
|
+
FROM sessions s
|
|
30
|
+
LEFT JOIN transcripts t ON t.transcript_id = s.active_transcript_id
|
|
31
|
+
`;
|
|
32
|
+
}));
|
|
33
|
+
//#endregion
|
|
34
|
+
init_session_read_repository();
|
|
35
|
+
export { SESSION_COLUMNS, SESSION_FROM_JOIN, getSessionMetadata, init_session_read_repository, readSessionRow };
|
|
@@ -2,10 +2,10 @@ import type { DatabaseSync } from 'node:sqlite';
|
|
|
2
2
|
import type { SessionListQuery, SessionMetadata, PaginatedResult } from '../../session/types.js';
|
|
3
3
|
import { type SessionMetadataSeed } from './session-metadata.js';
|
|
4
4
|
import { buildGlobalSessionStats } from './row-mappers.js';
|
|
5
|
+
export { getSessionMetadata } from './session-read-repository.js';
|
|
5
6
|
export declare function ensureSessionInTransaction(db: DatabaseSync, conversationId: string, cwd: string, seed?: SessionMetadataSeed): SessionMetadata;
|
|
6
7
|
export declare function ensureSessionRecord(conversationId: string, cwd: string, seed?: SessionMetadataSeed): SessionMetadata;
|
|
7
8
|
export { readCurrentTranscriptId } from './session-instance-repository.js';
|
|
8
|
-
export declare function getSessionMetadata(conversationId: string): SessionMetadata | null;
|
|
9
9
|
export declare function getCurrentTranscriptId(conversationId: string): string | null;
|
|
10
10
|
export declare function listSessionMetadata(query?: SessionListQuery): PaginatedResult<SessionMetadata>;
|
|
11
11
|
export declare function patchSessionMetadata(conversationId: string, updates: Partial<SessionMetadata>): SessionMetadata;
|
|
@@ -9,11 +9,9 @@ import { cancelConnectionObjective, init_connection_wait_repository } from "./co
|
|
|
9
9
|
import { init_changes, notifyUserContextChange } from "../../user-context/changes.js";
|
|
10
10
|
import { SESSION_PURPOSE_SQL, SESSION_SOURCE_SQL, init_session_identity_sql } from "./session-identity-sql.js";
|
|
11
11
|
import { buildFts5SearchQuery, init_fts } from "./fts.js";
|
|
12
|
+
import { SESSION_COLUMNS, SESSION_FROM_JOIN, getSessionMetadata, init_session_read_repository, readSessionRow } from "./session-read-repository.js";
|
|
12
13
|
import { randomUUID } from "node:crypto";
|
|
13
14
|
//#region src/storage/sqlite/session-repository.ts
|
|
14
|
-
function readSessionRow(db, conversationId) {
|
|
15
|
-
return db.prepare(SELECT_SESSION).get(conversationId);
|
|
16
|
-
}
|
|
17
15
|
function insertSessionAndTranscript(db, conversationId, transcriptId, cwd, metadata) {
|
|
18
16
|
const row = metadataToSessionInsert(conversationId, transcriptId, metadata);
|
|
19
17
|
db.prepare(`INSERT INTO sessions (
|
|
@@ -59,11 +57,6 @@ function ensureSessionInTransaction(db, conversationId, cwd, seed) {
|
|
|
59
57
|
function ensureSessionRecord(conversationId, cwd, seed) {
|
|
60
58
|
return runSqliteWriteTransaction((db) => ensureSessionInTransaction(db, conversationId, cwd, seed));
|
|
61
59
|
}
|
|
62
|
-
function getSessionMetadata(conversationId) {
|
|
63
|
-
const row = readSessionRow(getSqliteDatabase(), conversationId);
|
|
64
|
-
if (!row) return null;
|
|
65
|
-
return sessionRowToMetadata(conversationId, row);
|
|
66
|
-
}
|
|
67
60
|
function getCurrentTranscriptId(conversationId) {
|
|
68
61
|
return readCurrentTranscriptId(getSqliteDatabase(), conversationId);
|
|
69
62
|
}
|
|
@@ -335,7 +328,6 @@ function getGlobalSessionStats() {
|
|
|
335
328
|
function resolveSessionAgentId(conversationId) {
|
|
336
329
|
return getSessionMetadata(conversationId)?.routing?.agentId ?? "main";
|
|
337
330
|
}
|
|
338
|
-
var SESSION_COLUMNS, SESSION_FROM_JOIN, SELECT_SESSION;
|
|
339
331
|
var init_session_repository = __esmMin((() => {
|
|
340
332
|
init_connection_wait_repository();
|
|
341
333
|
init_src();
|
|
@@ -346,22 +338,7 @@ var init_session_repository = __esmMin((() => {
|
|
|
346
338
|
init_transaction();
|
|
347
339
|
init_session_identity_sql();
|
|
348
340
|
init_fts();
|
|
349
|
-
|
|
350
|
-
s.conversation_id, s.agent_id, s.active_transcript_id, s.status, s.name, s.tags_json,
|
|
351
|
-
s.created_at, s.updated_at, s.last_accessed_at, s.session_started_at, s.last_interaction_at,
|
|
352
|
-
s.source_channel, s.source_chat_id, s.session_type, s.hidden_from_session_list,
|
|
353
|
-
s.parent_conversation_id, s.workflow_run_id, s.workflow_definition_id, s.workflow_agent_id, s.workflow_agent_label,
|
|
354
|
-
s.project_id, s.routing_json, s.custom_data_json,
|
|
355
|
-
s.message_count, s.estimated_tokens, s.compacted_count,
|
|
356
|
-
s.last_flushed_at, s.flush_count,
|
|
357
|
-
s.thinking_level, s.verbose_level,
|
|
358
|
-
t.cwd AS cwd
|
|
359
|
-
`;
|
|
360
|
-
SESSION_FROM_JOIN = `
|
|
361
|
-
FROM sessions s
|
|
362
|
-
LEFT JOIN transcripts t ON t.transcript_id = s.active_transcript_id
|
|
363
|
-
`;
|
|
364
|
-
SELECT_SESSION = `SELECT ${SESSION_COLUMNS} ${SESSION_FROM_JOIN} WHERE s.conversation_id = ?`;
|
|
341
|
+
init_session_read_repository();
|
|
365
342
|
}));
|
|
366
343
|
//#endregion
|
|
367
344
|
init_session_repository();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
//#region src/storage/sqlite/sql-assets.ts
|
|
6
|
+
function resolveSqliteAssetPath(relativePath) {
|
|
7
|
+
return join(SQL_ASSET_ROOT, relativePath);
|
|
8
|
+
}
|
|
9
|
+
function readSqliteAsset(relativePath) {
|
|
10
|
+
return readFileSync(resolveSqliteAssetPath(relativePath), "utf8");
|
|
11
|
+
}
|
|
12
|
+
var SQL_ASSET_ROOT;
|
|
13
|
+
var init_sql_assets = __esmMin((() => {
|
|
14
|
+
SQL_ASSET_ROOT = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
}));
|
|
16
|
+
//#endregion
|
|
17
|
+
init_sql_assets();
|
|
18
|
+
export { init_sql_assets, readSqliteAsset, resolveSqliteAssetPath };
|
|
@@ -9,3 +9,5 @@ import type { DatabaseSync } from 'node:sqlite';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function runSqliteWriteTransaction<T>(fn: (db: DatabaseSync) => T): T;
|
|
11
11
|
export declare function getSqliteDatabase(): DatabaseSync;
|
|
12
|
+
/** Compose with domain-owned transactions on an explicitly supplied connection. */
|
|
13
|
+
export declare function runSqliteSavepoint<T>(db: DatabaseSync, operation: () => T): T;
|
|
@@ -106,6 +106,25 @@ function runSqliteWriteTransaction(fn) {
|
|
|
106
106
|
function getSqliteDatabase() {
|
|
107
107
|
return getXopcDatabase().db;
|
|
108
108
|
}
|
|
109
|
+
/** Compose with domain-owned transactions on an explicitly supplied connection. */
|
|
110
|
+
function runSqliteSavepoint(db, operation) {
|
|
111
|
+
const name = nextSavepointName();
|
|
112
|
+
const depth = getTransactionDepth(db);
|
|
113
|
+
db.exec(`SAVEPOINT ${name}`);
|
|
114
|
+
setTransactionDepth(db, depth + 1);
|
|
115
|
+
try {
|
|
116
|
+
const result = operation();
|
|
117
|
+
assertSyncTransactionResult(result);
|
|
118
|
+
db.exec(`RELEASE ${name}`);
|
|
119
|
+
return result;
|
|
120
|
+
} catch (error) {
|
|
121
|
+
db.exec(`ROLLBACK TO ${name}`);
|
|
122
|
+
db.exec(`RELEASE ${name}`);
|
|
123
|
+
throw error;
|
|
124
|
+
} finally {
|
|
125
|
+
setTransactionDepth(db, depth);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
109
128
|
var RETRYABLE_COMMIT_CODES, MAX_COMMIT_ATTEMPTS, nextSavepointId, transactionDepthByDatabase;
|
|
110
129
|
var init_transaction = __esmMin((() => {
|
|
111
130
|
init_connection();
|
|
@@ -116,4 +135,4 @@ var init_transaction = __esmMin((() => {
|
|
|
116
135
|
}));
|
|
117
136
|
//#endregion
|
|
118
137
|
init_transaction();
|
|
119
|
-
export { getSqliteDatabase, init_transaction, runSqliteWriteTransaction };
|
|
138
|
+
export { getSqliteDatabase, init_transaction, runSqliteSavepoint, runSqliteWriteTransaction };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { HomeAttention, HomeDecision, HomeResponse } from '@xopcai/gateway-contract';
|
|
2
2
|
import type { AutomationService } from '../automations/service/automation-service.js';
|
|
3
3
|
import type { Config } from '../config/schema.js';
|
|
4
|
-
import type { ProactiveInboxService } from '../proactive/inbox/service.js';
|
|
5
4
|
import type { ProjectService } from '../projects/project-service.js';
|
|
6
5
|
import type { WorkflowRunSummary } from '../workflows/domain/index.js';
|
|
7
6
|
import type { WorkflowRunService } from '../workflows/service/workflow-run-service.js';
|
|
@@ -29,7 +28,6 @@ interface HomeGatewayPort {
|
|
|
29
28
|
readonly currentConfig: Config;
|
|
30
29
|
readonly automationServiceInstance: AutomationService;
|
|
31
30
|
readonly projects: ProjectService;
|
|
32
|
-
readonly proactiveInbox: ProactiveInboxService;
|
|
33
31
|
readonly sessions: {
|
|
34
32
|
listActiveRuns(): Array<{
|
|
35
33
|
conversationId: string;
|
|
@@ -329,50 +329,20 @@ var HomeQueryService = class {
|
|
|
329
329
|
const upcomingAutomations = automations.filter((automation) => automation.notificationPolicy !== "none").map(toHomeAutomation).filter((automation) => Boolean(automation)).sort((a, b) => Date.parse(a.nextRunAt) - Date.parse(b.nextRunAt));
|
|
330
330
|
const latestAutomationRuns = [...automationRuns].sort((left, right) => right.createdAtMs - left.createdAtMs).filter((run, index, all) => all.findIndex((candidate) => candidate.automationId === run.automationId) === index);
|
|
331
331
|
const automationsById = new Map(automations.map((automation) => [automation.id, automation]));
|
|
332
|
-
const decisionCandidates = [
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
judgment: {
|
|
343
|
-
inboxItemId: item.id,
|
|
344
|
-
whyNow: item.insight.whyNow,
|
|
345
|
-
impact: item.insight.impact,
|
|
346
|
-
workDone: item.insight.workDone,
|
|
347
|
-
recommendation: item.insight.recommendation,
|
|
348
|
-
confidence: item.insight.confidence,
|
|
349
|
-
valueScore: item.insight.valueScore,
|
|
350
|
-
evidenceIds: item.insight.evidenceIds,
|
|
351
|
-
attentionKind: item.insight.attentionKind,
|
|
352
|
-
disposition: item.insight.disposition,
|
|
353
|
-
dispositionReason: item.insight.dispositionReason,
|
|
354
|
-
...item.insight.actionStatus ? { actionStatus: item.insight.actionStatus } : {},
|
|
355
|
-
...item.insight.proposedAction ? { proposedActionTitle: item.insight.proposedAction.input.title } : {},
|
|
356
|
-
...item.insight.actionError ? { actionError: item.insight.actionError } : {},
|
|
357
|
-
...item.insight.decision && (!item.insight.proposedAction || item.insight.actionStatus === "approval_required") ? { decision: item.insight.decision } : {}
|
|
358
|
-
}
|
|
359
|
-
})),
|
|
360
|
-
...activeTasks.map((task) => decisionFromTask(this.#projector.project(task), task.projectId ? projectsById.get(task.projectId)?.name : void 0, locale)).filter((item) => Boolean(item)),
|
|
361
|
-
...connectorApprovals.filter((approval) => Date.parse(approval.expiresAt) > nowMs).map((approval) => ({
|
|
362
|
-
id: `connector-approval:${approval.id}`,
|
|
332
|
+
const decisionCandidates = [...activeTasks.map((task) => decisionFromTask(this.#projector.project(task), task.projectId ? projectsById.get(task.projectId)?.name : void 0, locale)).filter((item) => Boolean(item)), ...connectorApprovals.filter((approval) => Date.parse(approval.expiresAt) > nowMs).map((approval) => ({
|
|
333
|
+
id: `connector-approval:${approval.id}`,
|
|
334
|
+
kind: "connector_approval",
|
|
335
|
+
title: approval.actionId,
|
|
336
|
+
detail: `${approval.connectorId} · ${approval.scope}\n${JSON.stringify(approval.argumentsPreview).slice(0, 1600)}`,
|
|
337
|
+
reason: "approval_required",
|
|
338
|
+
urgency: "now",
|
|
339
|
+
href: approval.conversationId ? `/chat/${encodeURIComponent(approval.conversationId)}` : "/connectors",
|
|
340
|
+
updatedAt: Date.parse(approval.createdAt),
|
|
341
|
+
response: {
|
|
363
342
|
kind: "connector_approval",
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
urgency: "now",
|
|
368
|
-
href: approval.conversationId ? `/chat/${encodeURIComponent(approval.conversationId)}` : "/connectors",
|
|
369
|
-
updatedAt: Date.parse(approval.createdAt),
|
|
370
|
-
response: {
|
|
371
|
-
kind: "connector_approval",
|
|
372
|
-
approvalId: approval.id
|
|
373
|
-
}
|
|
374
|
-
}))
|
|
375
|
-
];
|
|
343
|
+
approvalId: approval.id
|
|
344
|
+
}
|
|
345
|
+
}))];
|
|
376
346
|
const attentionCandidates = [...failedWorkflowRuns.filter((run) => !isHomeAttentionAcknowledged("workflow_run", run.id)).map((run) => ({
|
|
377
347
|
id: `workflow_run:${run.id}`,
|
|
378
348
|
kind: "workflow_run",
|
|
@@ -8,7 +8,6 @@ export * from './task-contract-planner.js';
|
|
|
8
8
|
export * from './task-context-assembler.js';
|
|
9
9
|
export * from './task-run-coordinator.js';
|
|
10
10
|
export * from './project-operating-view-service.js';
|
|
11
|
-
export * from './project-monitoring-service.js';
|
|
12
11
|
export * from './task-value-metrics-service.js';
|
|
13
12
|
export * from './task-application-service.js';
|
|
14
13
|
export * from './task-change-events.js';
|