@xopcai/xopc 0.0.308 → 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/_locales/en/messages.json +8 -0
- package/dist/browser-ext/_locales/zh_CN/messages.json +8 -0
- package/dist/browser-ext/dist/assets/{sidepanel-BbSQr-6P.css → sidepanel-DD6GEMvc.css} +16 -0
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +537 -96
- 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-wgSB2HYK.js → activity-store-DVUTs1fk.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-dUotwUO6.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-VPDIGRSS.js → agents-BiD9STyv.js} +1 -1
- package/dist/gateway/static/root/assets/{api-BKHmTb0w.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-zPz0rOND.js → app-management-settings-panel-C94LAxyt.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DhvhR43G.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-BQVZMreT.js → archive-plugin-SwWFt5MT.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CPE-TMPf.js → attachment-load-DdTFml9l.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-C4IAy_zF.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-DgTl7diZ.js → binary-plugins-47UTtDNq.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CcOVA-Gw.js → block-editor-DvzZkMG8.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BzkJog8e.js → browser-automation-inputs-C611KRBx.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page--zKAgj1k.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-BfLd2rIJ.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-BlC1OXX4.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-CF_zYzxX.js → dependency-picker-DCyyFLKp.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CDwtLR7Z.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-CX5OXxEU.js → extension-debug-page-DA8WJ3-E.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BytR1PaY.js → extension-page-C2BIB88m.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CkaMJA5F.js → extension-settings-page-kpYo979N.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-B6wHa6ZI.js → gateway-config-swr-DUDX42qY.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-B53R0CA4.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-DRzGnEV-.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-Ck_pyDom.js → image-generation-api-D2YorS--.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-DrtbjL8O.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-BlZh41Xq.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-DbP7wWuh.js → local-apps-page-DOZZBdqj.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-msTfRK8P.js → locale-store-DA0Z5jM_.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-C0n66FiO.js → logs-page-M8kz26yo.js} +2 -2
- package/dist/gateway/static/root/assets/{management-settings-i6GhxpGV.js → management-settings-JLqHYQvY.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BInabSKf.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-CnWChQ3Y.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-BWitjb3e.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-gmi5LLwM.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-BSWtko7U.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-CtOjKGWg.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-DkyyDcl2.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-C0JDGN_V.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-Bt1K657Y.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-vq5Ujm03.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-1SZ-HFHX.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-B2pZCcxY.js → voice-api-key-field-D3urfd-n.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DgJML_uM.js → voice-config-api-DTyMdGOR.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Bptv7bEY.js → work-discovery-overlay-JzM3Ylbs.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BijCrNc4.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/packages/gateway-contract/src/sessions.js +6 -1
- package/dist/src/agent/agent-manager.d.ts +2 -6
- package/dist/src/agent/agent-manager.js +31 -5
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/child-agent-factory.d.ts +1 -0
- package/dist/src/agent/child-agent-factory.js +18 -4
- package/dist/src/agent/coding/repository-instructions.d.ts +4 -0
- package/dist/src/agent/coding/repository-instructions.js +46 -2
- package/dist/src/agent/commands/command-registry.js +1 -1
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/data-acquisition/git.d.ts +17 -0
- package/dist/src/agent/data-acquisition/git.js +100 -0
- package/dist/src/agent/data-acquisition/render.d.ts +7 -0
- package/dist/src/agent/data-acquisition/render.js +79 -0
- package/dist/src/agent/data-acquisition/scheduler.d.ts +12 -0
- package/dist/src/agent/data-acquisition/scheduler.js +53 -0
- package/dist/src/agent/data-acquisition/schema.d.ts +75 -0
- package/dist/src/agent/data-acquisition/schema.js +206 -0
- package/dist/src/agent/data-acquisition/service.d.ts +10 -0
- package/dist/src/agent/data-acquisition/service.js +292 -0
- package/dist/src/agent/data-acquisition/types.d.ts +37 -0
- package/dist/src/agent/data-acquisition/types.js +5 -0
- package/dist/src/agent/embedded/run-turn.js +16 -4
- package/dist/src/agent/embedded/session-runner.d.ts +1 -0
- package/dist/src/agent/embedded/session-runner.js +3 -0
- package/dist/src/agent/embedded/tool-result-truncation.js +11 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +2 -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 +15 -4
- package/dist/src/agent/external-tools/gateway-tools.js +10 -3
- package/dist/src/agent/external-tools/index.js +14 -1
- package/dist/src/agent/external-tools/read-policy.d.ts +6 -0
- package/dist/src/agent/external-tools/read-policy.js +21 -0
- package/dist/src/agent/external-tools/service.d.ts +1 -0
- package/dist/src/agent/external-tools/service.js +4 -1
- package/dist/src/agent/external-tools/types.d.ts +3 -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/orchestration/agent-turn-policy.js +25 -10
- package/dist/src/agent/orchestration/delegation-scope.d.ts +9 -0
- package/dist/src/agent/orchestration/delegation-scope.js +11 -0
- package/dist/src/agent/prompt/sections/tooling.js +3 -1
- package/dist/src/agent/prompt/subagent-context.js +4 -2
- package/dist/src/agent/sandbox/fileAccess.d.ts +2 -0
- package/dist/src/agent/sandbox/fileAccess.js +31 -2
- 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/dataBatch.d.ts +4 -0
- package/dist/src/agent/tools/dataBatch.js +50 -0
- package/dist/src/agent/tools/delegate-tool.d.ts +6 -3
- package/dist/src/agent/tools/delegate-tool.js +65 -48
- package/dist/src/agent/tools/delegation-parent-policy.d.ts +7 -0
- package/dist/src/agent/tools/delegation-parent-policy.js +41 -0
- package/dist/src/agent/tools/delegation-policy.d.ts +16 -0
- package/dist/src/agent/tools/delegation-policy.js +93 -0
- package/dist/src/agent/tools/factory.d.ts +4 -0
- package/dist/src/agent/tools/factory.js +45 -5
- package/dist/src/agent/tools/fetch-text.d.ts +7 -0
- package/dist/src/agent/tools/fetch-text.js +86 -0
- package/dist/src/agent/tools/find.js +1 -1
- package/dist/src/agent/tools/grep.js +11 -23
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/knowledge-memory-tool.js +10 -2
- package/dist/src/agent/tools/read.js +7 -5
- package/dist/src/agent/tools/repository-search.d.ts +12 -2
- package/dist/src/agent/tools/repository-search.js +127 -74
- 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/web.js +19 -28
- 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/agent/workflow/subagent-runner.js +25 -3
- package/dist/src/agent/workflow/workflow-child-tools.js +13 -8
- package/dist/src/agent-config/schema.d.ts +7 -0
- package/dist/src/agent-config/schema.js +2 -0
- 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 +8 -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/agent-builtin-tools.d.ts +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 +2 -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/sessions.js +141 -13
- 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/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.d.ts +1 -0
- package/dist/src/storage/sqlite/index.js +4 -2
- package/dist/src/storage/sqlite/migrations/186_sidebar_layout.sql +16 -0
- 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/sidebar-layout-repository.d.ts +12 -0
- package/dist/src/storage/sqlite/sidebar-layout-repository.js +53 -0
- 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 +5 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C6LflMXr.js +0 -1
- package/dist/gateway/static/root/assets/api-DFOlahZv.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-Pmslbzzr.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-Fx5VUJRu.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DBms6d35.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-epdDWIZy.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-B0bsDtmP.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-B2JwuTjG.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-Ckgc0Py-.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-By33-bF1.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-CqNE-nf6.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-BS9ZjzYJ.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-C0djIc1J.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-CDKj9LQj.js +0 -1
- package/dist/gateway/static/root/assets/external-link-DjqjBmc3.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BLDgrJ30.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-_YU-1p0z.js +0 -1
- package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CVIvvm4x.js +0 -1
- package/dist/gateway/static/root/assets/home-page-COCHelcL.js +0 -1
- package/dist/gateway/static/root/assets/index-CDfcPiPb.js +0 -79
- package/dist/gateway/static/root/assets/index-CRu1p38D.css +0 -1
- package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-D7_Raxjw.js +0 -2
- package/dist/gateway/static/root/assets/markdown-view-Y68dCxuc.css +0 -1
- package/dist/gateway/static/root/assets/messages-F74LVAiU.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-C59d8vDW.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-C1GBPrVI.js +0 -8
- package/dist/gateway/static/root/assets/preview-open-alternatives-UaCWCxZv.js +0 -1
- package/dist/gateway/static/root/assets/proactive-page-CtSFJxoM.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-ILTmQ1YN.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-snl4rOQZ.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BbaAcEN3.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DrWL71O8.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BG0kl4HT.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-DiIyMQ52.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-EPazhoZO.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-g2MdRXSZ.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B1DPzu98.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-Wd0uYSPG.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-Cz1P-HDH.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-BG3A5gPZ.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-DQGoFuZO.js +0 -1
- package/dist/gateway/static/root/assets/use-autosave-DVDlBb95.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-qM5UiTGx.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-DRy1RAYH.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
|
@@ -1,50 +1,42 @@
|
|
|
1
1
|
import { __esmMin } from "../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import {
|
|
2
|
+
import { init_sql_assets, resolveSqliteAssetPath } from "../sql-assets.js";
|
|
3
3
|
import { createLogger } from "../../../utils/logger/index.js";
|
|
4
4
|
import { init_logger } from "../../../utils/logger.js";
|
|
5
5
|
import { init_schema_version, readSchemaVersion, setSchemaVersion } from "../schema-version.js";
|
|
6
|
+
import { backupBeforeConversationCutover, init_conversation_backup } from "./conversation-backup.js";
|
|
6
7
|
import { init_conversation_uuid, migrateConversationUuids } from "./conversation-uuid.js";
|
|
8
|
+
import { discardExperimentalSceneData, init_scene_reset, resetExperimentalScenes } from "./scene-reset.js";
|
|
7
9
|
import { discoverSqlMigrations, init_discover } from "./discover.js";
|
|
8
10
|
import { DatabaseSchemaMigrationGapError, DatabaseSchemaTooNewError, DatabaseSchemaTooOldError, init_errors } from "./errors.js";
|
|
9
|
-
import {
|
|
10
|
-
import { chmodSync, existsSync, writeFileSync } from "node:fs";
|
|
11
|
-
import { fileURLToPath } from "node:url";
|
|
11
|
+
import { writeFileSync } from "node:fs";
|
|
12
12
|
//#region src/storage/sqlite/migrations/runner.ts
|
|
13
|
-
function backupBeforeTaskCutover(db, databasePath) {
|
|
14
|
-
db.exec("PRAGMA wal_checkpoint(FULL)");
|
|
15
|
-
const backupPath = `${databasePath}.pre-v100-${Date.now()}.bak`;
|
|
16
|
-
const quotedPath = backupPath.replaceAll("'", "''");
|
|
17
|
-
db.exec(`VACUUM INTO '${quotedPath}'`);
|
|
18
|
-
chmodSync(backupPath, 384);
|
|
19
|
-
return backupPath;
|
|
20
|
-
}
|
|
21
13
|
function writeMigrationReport(backupPath, report) {
|
|
22
14
|
writeFileSync(`${backupPath}.report.json`, `${JSON.stringify(report, null, 2)}\n`, { mode: 384 });
|
|
23
15
|
}
|
|
24
16
|
function resolveMigrationsDir(override) {
|
|
25
17
|
if (override) return override;
|
|
26
|
-
|
|
27
|
-
if (existsSync(siblingDir)) return siblingDir;
|
|
28
|
-
return MODULE_DIR;
|
|
18
|
+
return resolveSqliteAssetPath("migrations");
|
|
29
19
|
}
|
|
30
20
|
function migrationByTarget(migrations, targetVersion) {
|
|
31
21
|
return migrations.find((migration) => migration.targetVersion === targetVersion);
|
|
32
22
|
}
|
|
33
|
-
function applySingleMigration(db, migration) {
|
|
23
|
+
function applySingleMigration(db, migration, discardOldScenes = false) {
|
|
34
24
|
log.info({
|
|
35
25
|
targetVersion: migration.targetVersion,
|
|
36
26
|
file: migration.filename
|
|
37
27
|
}, "Applying SQLite migration");
|
|
38
|
-
const
|
|
28
|
+
const requiresForeignKeyPause = discardOldScenes || migration.targetVersion === 179 || migration.targetVersion === 182 || migration.targetVersion === 188;
|
|
39
29
|
const foreignKeysEnabled = Number(db.prepare("PRAGMA foreign_keys").get()?.foreign_keys) === 1;
|
|
40
|
-
if (
|
|
30
|
+
if (requiresForeignKeyPause) db.exec("PRAGMA foreign_keys = OFF");
|
|
41
31
|
let transactionStarted = false;
|
|
42
32
|
try {
|
|
43
33
|
db.exec("BEGIN IMMEDIATE");
|
|
44
34
|
transactionStarted = true;
|
|
35
|
+
if (discardOldScenes) discardExperimentalSceneData(db);
|
|
45
36
|
db.exec(migration.sql);
|
|
37
|
+
if (migration.targetVersion === 188) resetExperimentalScenes(db);
|
|
46
38
|
const summary = migration.targetVersion === 178 ? migrateConversationUuids(db) : void 0;
|
|
47
|
-
if (
|
|
39
|
+
if (requiresForeignKeyPause && db.prepare("PRAGMA foreign_key_check").all().length > 0) throw new Error("Schema migration would violate foreign key integrity");
|
|
48
40
|
setSchemaVersion(db, migration.targetVersion);
|
|
49
41
|
db.exec("COMMIT");
|
|
50
42
|
return summary;
|
|
@@ -55,7 +47,7 @@ function applySingleMigration(db, migration) {
|
|
|
55
47
|
const em = error instanceof Error ? error.message : String(error);
|
|
56
48
|
throw new Error(`SQLite migration to v${migration.targetVersion} (${migration.filename}) failed: ${em}`, { cause: error });
|
|
57
49
|
} finally {
|
|
58
|
-
if (
|
|
50
|
+
if (requiresForeignKeyPause && foreignKeysEnabled) db.exec("PRAGMA foreign_keys = ON");
|
|
59
51
|
}
|
|
60
52
|
}
|
|
61
53
|
/**
|
|
@@ -63,13 +55,12 @@ function applySingleMigration(db, migration) {
|
|
|
63
55
|
* Each step runs in its own transaction and updates schema_meta on success.
|
|
64
56
|
*/
|
|
65
57
|
function applyPendingMigrations(db, options = {}) {
|
|
66
|
-
const targetVersion = options.targetVersion ??
|
|
58
|
+
const targetVersion = options.targetVersion ?? 189;
|
|
67
59
|
let currentVersion = readSchemaVersion(db);
|
|
68
60
|
if (currentVersion > targetVersion) throw new DatabaseSchemaTooNewError(currentVersion, targetVersion);
|
|
69
61
|
if (!options.migrationsDir && currentVersion < 165) throw new DatabaseSchemaTooOldError(currentVersion, 165);
|
|
70
62
|
if (currentVersion >= targetVersion) return currentVersion;
|
|
71
63
|
const migrations = discoverSqlMigrations(resolveMigrationsDir(options.migrationsDir));
|
|
72
|
-
let cutoverBackupPath;
|
|
73
64
|
let conversationSummary;
|
|
74
65
|
const fromVersion = currentVersion;
|
|
75
66
|
const conversationBackup = currentVersion < 178 && targetVersion >= 178 && options.databasePath && options.databasePath !== ":memory:" ? backupBeforeConversationCutover(db, options.databasePath) : void 0;
|
|
@@ -77,18 +68,9 @@ function applyPendingMigrations(db, options = {}) {
|
|
|
77
68
|
const nextVersion = currentVersion + 1;
|
|
78
69
|
const migration = migrationByTarget(migrations, nextVersion);
|
|
79
70
|
if (!migration) throw new DatabaseSchemaMigrationGapError(currentVersion, targetVersion, nextVersion);
|
|
80
|
-
if (nextVersion === 100 && options.databasePath && options.databasePath !== ":memory:") cutoverBackupPath = backupBeforeTaskCutover(db, options.databasePath);
|
|
81
71
|
try {
|
|
82
|
-
conversationSummary = applySingleMigration(db, migration) ?? conversationSummary;
|
|
72
|
+
conversationSummary = applySingleMigration(db, migration, !options.migrationsDir && targetVersion >= 188 && fromVersion < 178 && currentVersion === fromVersion) ?? conversationSummary;
|
|
83
73
|
} catch (error) {
|
|
84
|
-
if (cutoverBackupPath && nextVersion === 100) writeMigrationReport(cutoverBackupPath, {
|
|
85
|
-
fromVersion: currentVersion,
|
|
86
|
-
targetVersion: nextVersion,
|
|
87
|
-
status: "failed",
|
|
88
|
-
rollback: "transaction",
|
|
89
|
-
error: error instanceof Error ? error.message : String(error),
|
|
90
|
-
occurredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
91
|
-
});
|
|
92
74
|
if (conversationBackup) writeMigrationReport(conversationBackup, {
|
|
93
75
|
fromVersion,
|
|
94
76
|
targetVersion,
|
|
@@ -99,13 +81,6 @@ function applyPendingMigrations(db, options = {}) {
|
|
|
99
81
|
throw error;
|
|
100
82
|
}
|
|
101
83
|
currentVersion = nextVersion;
|
|
102
|
-
if (cutoverBackupPath && currentVersion === 100) writeMigrationReport(cutoverBackupPath, {
|
|
103
|
-
fromVersion: 99,
|
|
104
|
-
targetVersion: 100,
|
|
105
|
-
status: "succeeded",
|
|
106
|
-
backupPath: cutoverBackupPath,
|
|
107
|
-
occurredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
108
|
-
});
|
|
109
84
|
}
|
|
110
85
|
if (conversationBackup) writeMigrationReport(conversationBackup, {
|
|
111
86
|
fromVersion,
|
|
@@ -118,7 +93,7 @@ function applyPendingMigrations(db, options = {}) {
|
|
|
118
93
|
}
|
|
119
94
|
/** Inspect schema version without mutating the database. */
|
|
120
95
|
function inspectSchemaMigrationStatus(db, options = {}) {
|
|
121
|
-
const appVersion = options.targetVersion ??
|
|
96
|
+
const appVersion = options.targetVersion ?? 189;
|
|
122
97
|
const dbVersion = readSchemaVersion(db);
|
|
123
98
|
if (dbVersion > appVersion) return {
|
|
124
99
|
dbVersion,
|
|
@@ -147,18 +122,19 @@ function inspectSchemaMigrationStatus(db, options = {}) {
|
|
|
147
122
|
missingVersion
|
|
148
123
|
};
|
|
149
124
|
}
|
|
150
|
-
var log, XOPC_DB_BASELINE_SCHEMA_VERSION, XOPC_DB_SCHEMA_VERSION
|
|
125
|
+
var log, XOPC_DB_BASELINE_SCHEMA_VERSION, XOPC_DB_SCHEMA_VERSION;
|
|
151
126
|
var init_runner = __esmMin((() => {
|
|
152
|
-
init_conversation_backup();
|
|
153
127
|
init_logger();
|
|
154
128
|
init_schema_version();
|
|
129
|
+
init_sql_assets();
|
|
130
|
+
init_conversation_backup();
|
|
155
131
|
init_conversation_uuid();
|
|
132
|
+
init_scene_reset();
|
|
156
133
|
init_discover();
|
|
157
134
|
init_errors();
|
|
158
135
|
log = createLogger("Sqlite:Migrations");
|
|
159
136
|
XOPC_DB_BASELINE_SCHEMA_VERSION = 165;
|
|
160
|
-
XOPC_DB_SCHEMA_VERSION =
|
|
161
|
-
MODULE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
137
|
+
XOPC_DB_SCHEMA_VERSION = 189;
|
|
162
138
|
}));
|
|
163
139
|
//#endregion
|
|
164
140
|
init_runner();
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
/** Discard obsolete payloads before historical migrations try to interpret them. */
|
|
3
|
+
export declare function discardExperimentalSceneData(db: DatabaseSync): void;
|
|
4
|
+
/** v188 installs current storage; the migration runner owns the transaction and FK checks. */
|
|
5
|
+
export declare function resetExperimentalScenes(db: DatabaseSync): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { __esmMin } from "../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { NOTIFICATION_LEDGER_TABLES, init_scenes_schema, installSceneStorage } from "../scenes-schema.js";
|
|
3
|
+
//#region src/storage/sqlite/migrations/scene-reset.ts
|
|
4
|
+
/** Discard obsolete payloads before historical migrations try to interpret them. */
|
|
5
|
+
function discardExperimentalSceneData(db) {
|
|
6
|
+
const triggers = db.prepare("SELECT name, sql FROM sqlite_master WHERE type = 'trigger' AND tbl_name GLOB 'proactive_*'").all();
|
|
7
|
+
for (const trigger of triggers) db.exec(`DROP TRIGGER ${quote(String(trigger.name))}`);
|
|
8
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND (name GLOB 'proactive_*' OR name = 'heartbeat_checks') AND name NOT IN ('proactive_scenarios', 'proactive_scenario_versions')").all();
|
|
9
|
+
for (const table of tables) db.exec(`DELETE FROM ${quote(String(table.name))}`);
|
|
10
|
+
for (const trigger of triggers) db.exec(String(trigger.sql));
|
|
11
|
+
const discarded = "SELECT event_id FROM notification_events WHERE event_type IN ('proactive.insight', 'scene.result', 'scene.digest')";
|
|
12
|
+
for (const table of ["notification_deliveries", "notification_acknowledgements"]) db.exec(`DELETE FROM ${table} WHERE event_id IN (${discarded})`);
|
|
13
|
+
db.exec(`DELETE FROM notification_events WHERE event_id IN (${discarded})`);
|
|
14
|
+
}
|
|
15
|
+
/** v188 installs current storage; the migration runner owns the transaction and FK checks. */
|
|
16
|
+
function resetExperimentalScenes(db) {
|
|
17
|
+
const ledger = new Set(NOTIFICATION_LEDGER_TABLES);
|
|
18
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type = 'table'").all();
|
|
19
|
+
for (const table of tables) {
|
|
20
|
+
const name = String(table.name);
|
|
21
|
+
if (name.startsWith("scene_") || ledger.has(name)) db.exec(`DROP TABLE ${quote(name)}`);
|
|
22
|
+
}
|
|
23
|
+
discardExperimentalSceneData(db);
|
|
24
|
+
for (const table of tables) {
|
|
25
|
+
const name = String(table.name);
|
|
26
|
+
if (name.startsWith("proactive_") || name === "heartbeat_checks" || name === "project_monitoring_policies") db.exec(`DROP TABLE ${quote(name)}`);
|
|
27
|
+
}
|
|
28
|
+
db.exec(`DROP INDEX IF EXISTS idx_connector_sync_policies_proactive;
|
|
29
|
+
ALTER TABLE connector_sync_policies DROP COLUMN proactive_enabled;
|
|
30
|
+
ALTER TABLE connector_sync_policies DROP COLUMN allowed_scenario_keys_json;`);
|
|
31
|
+
installSceneStorage(db);
|
|
32
|
+
}
|
|
33
|
+
var quote;
|
|
34
|
+
var init_scene_reset = __esmMin((() => {
|
|
35
|
+
init_scenes_schema();
|
|
36
|
+
quote = (name) => `"${name.replaceAll("\"", "\"\"")}"`;
|
|
37
|
+
}));
|
|
38
|
+
//#endregion
|
|
39
|
+
init_scene_reset();
|
|
40
|
+
export { discardExperimentalSceneData, init_scene_reset, resetExperimentalScenes };
|
|
@@ -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;
|