@xopcai/xopc 0.0.312 → 0.0.314
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/dist/assets/{auth-C3yV1y_l.js → auth-DKo-NMUY.js} +18 -1
- package/dist/browser-ext/dist/background.js +68 -2
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/src/inbound-processor.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +2 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BVIJMP8w.js → agent-avatar-dicebear-BFkjfurL.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BdOZ6q8Z.js +1 -0
- package/dist/gateway/static/root/assets/{agents-D6g_SeWI.js → agents-CCcavsHq.js} +1 -1
- package/dist/gateway/static/root/assets/{api-_aHQA8bd.js → api-BYhRsTAc.js} +1 -1
- package/dist/gateway/static/root/assets/{app-link-CKueEVbT.js → app-link-nL8iPwEr.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CLg_aXYG.js → app-management-settings-panel-B4kihr-A.js} +1 -1
- package/dist/gateway/static/root/assets/appearance-settings-N9sYmNOx.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-BMcy10_s.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CHO3heHX.js → archive-plugin-k_SuYWyV.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BsmsBCI2.js → attachment-load-DRv5QWUK.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CftigJlf.js → automations-page-CkJV3DN0.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BEa2doeR.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CRCLWBo2.js → binary-plugins-Dg3h3TA7.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-D0LDiOTT.js → block-editor-DVhdHntT.js} +29 -29
- package/dist/gateway/static/root/assets/{browser-automation-inputs-C611KRBx.js → browser-automation-inputs-BMRYUW8_.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-Djyv3vy-.js → browser-automations-page-Byv6-FY2.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-DRCHGFpO.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-D0S3DuAD.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-mxRP0gl0.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-DBt_6GsB.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CIsKqdET.js → chat-terminal-dock-D4AHa51o.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-C0YL9J7m.js → computer-settings-page-eXPe500D.js} +1 -1
- package/dist/gateway/static/root/assets/connector-service-page-BQTFlq_k.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-BKeBWwcI.js +2 -0
- package/dist/gateway/static/root/assets/conversation-identity-Cw0n9uzK.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-CDsfv8R0.js → date-picker-7MtovynY.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DvhPj3CZ.js → dependency-picker-Bj_xkXID.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Cyg8XMpL.js → desktop-pet-CTmba9zH.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DNM_BlWN.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-C2XE0QhT.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-D-AVJU3q.js → extension-debug-page-J_olaL7e.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DrFoQ9xt.js → extension-page-pK5RvqN8.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DxWjESC1.js → extension-settings-page-BwroEN08.js} +1 -1
- package/dist/gateway/static/root/assets/files-BK6enEvD.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-DUDX42qY.js → gateway-config-swr-FuJTIg_a.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-CLLDp23J.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-Cf8OxlvY.js → gateway-startup-retry-CKg_gu8_.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-B5Epb1PH.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-D2YorS--.js → image-generation-api-Bo6NZ7zb.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BKucJlXI.js → imports-page-C8-hX8gS.js} +1 -1
- package/dist/gateway/static/root/assets/index-14F1yGJI.js +89 -0
- package/dist/gateway/static/root/assets/index-cB7rWIDY.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BxLXD-yU.js → keyboard-shortcuts-settings-BkBEjUZD.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-6jC3vQpY.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BAsQJQKJ.js → local-apps-page-CrbKIixo.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DA0Z5jM_.js → locale-store-CvGwNbml.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DBHlZts9.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-DsUWLu5m.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DYGPxPee.js → markdown-view-nXo5nrsv.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CQtQzLyg.js → media-plugins-upxXJ-4l.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B_AwRroN.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-0Q9TOtJG.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-D0NmcwNw.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-DUyA-K4L.js +1 -0
- package/dist/gateway/static/root/assets/{page-tabs-B6DjkyMM.js → page-tabs-Cl-NFPNr.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Dn57uLhr.js → preview-open-alternatives-DX81PwJ3.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-chCjIpvu.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-H2YMk8TY.js → product-open-page-CrfIGwm8.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BVfVrYmn.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-nM9a9XNS.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-C0DCx3wv.js → registry-api-CHxgohY0.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C8b_k88G.js +1 -0
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-D3dLOW04.js +5 -0
- package/dist/gateway/static/root/assets/scenes-page-DEowreZV.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-CblI9WUA.js → schema-form-ZxuIvD2_.js} +1 -1
- package/dist/gateway/static/root/assets/schemas-88fK3zzl.js +64 -0
- package/dist/gateway/static/root/assets/sessions-page-B_nPhera.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BqhIOuus.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BAaVyxJH.js → settings-form-section-TZRfg4yo.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CKNPbm5q.js → settings-page-a8qcJpdZ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DqNCGKxQ.js → settings-page-layout-BfvlRT9q.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CRj5Ruqn.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BzMfp_HM.js → share-preview-page-DCt1pTWB.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BNbXPk--.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-CNMCLbav.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-DIht92q6.js → skills-page-BIOcg44X.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-DLYRiEn3.js → skills-page.utils-CgZdzT4I.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-yYs4YgYk.js → system-settings-panel-_YaRncA6.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-CAcfAG-c.js +1 -0
- package/dist/gateway/static/root/assets/tasks-CDR_RVbQ.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-BasDYxvx.js → tunnel-api-uOupJOoS.js} +1 -1
- package/dist/gateway/static/root/assets/turn-outcome-D0SnyZ3Z.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-CWAUHhcb.js → use-autosave-BezzHBLE.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-BFFeneDq.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-Kc4UlxZs.js → voice-api-key-field-BmYifdwL.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DTyMdGOR.js → voice-config-api-D_5Q2_A3.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BPC_c9dO.js → work-discovery-overlay-4DmyEckJ.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DBTciOrq.js → workflow-run-setup-panel-DeZe8bTZ.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Sv4hEc6W.js +6 -0
- package/dist/gateway/static/root/index.html +16 -16
- package/dist/package.js +1 -1
- package/dist/packages/computer-control-contract/src/index.js +10 -1
- package/dist/packages/gateway-contract/src/app-context.js +55 -0
- package/dist/packages/gateway-contract/src/automations.js +16 -17
- package/dist/packages/gateway-contract/src/capabilities.js +1078 -0
- package/dist/packages/gateway-contract/src/extension-capabilities.js +26 -0
- package/dist/packages/gateway-contract/src/home.js +3 -3
- package/dist/packages/gateway-contract/src/index.js +8 -0
- package/dist/packages/gateway-contract/src/product-delivery.js +19 -4
- package/dist/packages/gateway-contract/src/scenes.js +199 -0
- package/dist/packages/gateway-contract/src/task-runs.js +8 -4
- package/dist/packages/gateway-contract/src/tasks.js +5 -4
- package/dist/packages/realtime-client/src/index.js +17 -4
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +1 -0
- package/dist/src/agent/child-agent-factory.d.ts +2 -0
- package/dist/src/agent/child-agent-factory.js +5 -0
- package/dist/src/agent/commands/approved-verification.d.ts +14 -0
- package/dist/src/agent/commands/approved-verification.js +48 -0
- package/dist/src/agent/context/execution-scope.js +2 -1
- package/dist/src/agent/context/project-context.js +2 -1
- package/dist/src/agent/external-tools/cliProvider.js +123 -75
- package/dist/src/agent/external-tools/composio-provider.d.ts +1 -1
- package/dist/src/agent/external-tools/composio-provider.js +70 -12
- package/dist/src/agent/external-tools/endpoint-provider.js +14 -1
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +2 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +2 -1
- package/dist/src/agent/memory/compaction-chunks.d.ts +6 -1
- package/dist/src/agent/memory/compaction-chunks.js +16 -3
- package/dist/src/agent/memory/compaction-ledger.d.ts +3 -1
- package/dist/src/agent/memory/compaction-ledger.js +31 -18
- package/dist/src/agent/memory/compaction-request.d.ts +2 -0
- package/dist/src/agent/memory/compaction-request.js +6 -1
- package/dist/src/agent/memory/compaction.d.ts +19 -1
- package/dist/src/agent/memory/compaction.js +112 -30
- package/dist/src/agent/service/process-direct-streaming.d.ts +3 -0
- package/dist/src/agent/service/process-direct-streaming.js +19 -10
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +1 -0
- package/dist/src/agent/skills/config.js +2 -0
- package/dist/src/agent/skills/format-skills-prompt.js +14 -1
- package/dist/src/agent/skills/index.js +16 -8
- package/dist/src/agent/skills/types.d.ts +1 -1
- package/dist/src/agent/source-context/app-context.d.ts +4 -0
- package/dist/src/agent/source-context/app-context.js +36 -0
- package/dist/src/agent/source-context/injector.js +1 -0
- package/dist/src/agent/source-context/types.d.ts +5 -1
- package/dist/src/agent/tasks/task-judge-service.js +2 -1
- package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
- package/dist/src/agent/tool-manuals/computer.js +1 -1
- package/dist/src/agent/tools/automation-tool.d.ts +12 -1
- package/dist/src/agent/tools/automation-tool.js +106 -32
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +6 -1
- package/dist/src/agent/tools/scoped-workspace-tools.d.ts +8 -0
- package/dist/src/agent/tools/scoped-workspace-tools.js +81 -0
- package/dist/src/agent/tools/xopc-use-tool.d.ts +6 -3
- package/dist/src/agent/tools/xopc-use-tool.js +997 -908
- package/dist/src/agent/workflow/subagent-runner.js +1 -0
- package/dist/src/agent-config/index.js +2 -2
- package/dist/src/agent-config/schema.d.ts +5 -0
- package/dist/src/agent-config/schema.js +14 -10
- package/dist/src/automations/api/routes.js +244 -164
- package/dist/src/automations/capabilities/drafts.d.ts +4 -0
- package/dist/src/automations/capabilities/drafts.js +95 -0
- package/dist/src/automations/capabilities/read.d.ts +4 -0
- package/dist/src/automations/capabilities/read.js +119 -0
- package/dist/src/automations/capabilities/write.d.ts +349 -0
- package/dist/src/automations/capabilities/write.js +172 -0
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/domain/validation.d.ts +77 -77
- package/dist/src/automations/domain/validation.js +9 -6
- package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -2
- package/dist/src/automations/index.js +6 -6
- package/dist/src/automations/service/automation-service.d.ts +31 -0
- package/dist/src/automations/service/automation-service.js +213 -75
- package/dist/src/automations/service/index.js +2 -2
- package/dist/src/automations/storage/automation-repository.d.ts +2 -0
- package/dist/src/automations/storage/automation-repository.js +9 -1
- package/dist/src/automations/storage/automation-run-repository.d.ts +4 -1
- package/dist/src/automations/storage/automation-run-repository.js +16 -3
- package/dist/src/automations/storage/index.js +3 -3
- package/dist/src/browser/automations/schema.d.ts +1 -1
- package/dist/src/browser/automations/service.d.ts +1 -1
- package/dist/src/browser/observation/format.js +4 -0
- package/dist/src/capabilities/adapters/http.d.ts +4 -0
- package/dist/src/capabilities/adapters/http.js +44 -0
- package/dist/src/capabilities/readiness/from-config.js +11 -7
- package/dist/src/capabilities/runtime/app-context.d.ts +3 -0
- package/dist/src/capabilities/runtime/app-context.js +72 -0
- package/dist/src/capabilities/runtime/atomic-operations.d.ts +11 -0
- package/dist/src/capabilities/runtime/atomic-operations.js +34 -0
- package/dist/src/capabilities/runtime/dispatcher.d.ts +67 -0
- package/dist/src/capabilities/runtime/dispatcher.js +170 -0
- package/dist/src/capabilities/runtime/errors.d.ts +6 -0
- package/dist/src/capabilities/runtime/errors.js +11 -0
- package/dist/src/capabilities/runtime/external-operations.d.ts +16 -0
- package/dist/src/capabilities/runtime/external-operations.js +92 -0
- package/dist/src/capabilities/runtime/product.d.ts +12 -0
- package/dist/src/capabilities/runtime/product.js +69 -0
- package/dist/src/capabilities/runtime/settings.d.ts +3 -0
- package/dist/src/capabilities/runtime/settings.js +27 -0
- package/dist/src/channels/index.js +2 -2
- package/dist/src/channels/manager.js +1 -1
- package/dist/src/cli/cli-log-level-preset.d.ts +2 -0
- package/dist/src/cli/cli-log-level-preset.js +4 -0
- package/dist/src/cli/command-catalog.js +4 -0
- package/dist/src/cli/command-loaders.js +1 -0
- package/dist/src/cli/command-manifest.js +4 -0
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/mcp.d.ts +1 -0
- package/dist/src/cli/commands/mcp.js +51 -0
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/project.js +1 -1
- package/dist/src/computer/broker.d.ts +0 -1
- package/dist/src/computer/broker.js +4 -6
- package/dist/src/computer/evaluation-harness.d.ts +45 -0
- package/dist/src/computer/evaluation-harness.js +108 -0
- package/dist/src/computer/model-adapter.d.ts +37 -2
- package/dist/src/computer/model-adapter.js +333 -42
- package/dist/src/computer/model-policy.d.ts +4 -1
- package/dist/src/computer/model-policy.js +11 -3
- package/dist/src/computer/release-gate.d.ts +22 -0
- package/dist/src/computer/release-gate.js +19 -0
- package/dist/src/computer/runtime.js +14 -10
- package/dist/src/computer/task-state.d.ts +1 -0
- package/dist/src/computer/task-state.js +1 -0
- package/dist/src/config/models-json.d.ts +14 -8
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +4 -0
- package/dist/src/config/schema.js +3 -9
- package/dist/src/connectors/composio-sessions.d.ts +4 -2
- package/dist/src/connectors/composio-sessions.js +10 -9
- package/dist/src/connectors/composio.js +10 -8
- package/dist/src/discussions/action-tasks.js +2 -1
- package/dist/src/discussions/recording.js +1 -1
- package/dist/src/execution-environments/local-worktree-manager.d.ts +1 -0
- package/dist/src/execution-environments/local-worktree-manager.js +13 -2
- package/dist/src/extensions/activation-context.js +3 -3
- package/dist/src/extensions/api.js +1 -1
- package/dist/src/extensions/normalize-manifest.js +6 -1
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/extensions/sdk/media.js +1 -1
- package/dist/src/extensions/types/manifest.d.ts +3 -0
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -0
- package/dist/src/gateway/hono/middleware/scopes.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +5 -2
- package/dist/src/gateway/hono/routes/capability-operations.d.ts +3 -0
- package/dist/src/gateway/hono/routes/capability-operations.js +52 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +16 -0
- package/dist/src/gateway/hono/routes/local-app-capabilities.d.ts +4 -0
- package/dist/src/gateway/hono/routes/local-app-capabilities.js +41 -0
- package/dist/src/gateway/hono/routes/local-apps.js +41 -9
- package/dist/src/gateway/hono/routes/models.js +2 -2
- package/dist/src/gateway/hono/routes/notes.js +215 -146
- package/dist/src/gateway/hono/routes/projects.js +217 -374
- package/dist/src/gateway/hono/routes/scenes.js +188 -75
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +60 -16
- package/dist/src/gateway/hono/routes/session-input-handler.js +43 -1
- package/dist/src/gateway/hono/routes/sessions.js +17 -0
- package/dist/src/gateway/hono/routes/status.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +182 -326
- package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
- package/dist/src/gateway/hono/routes/voice.js +4 -4
- package/dist/src/gateway/hono/routes/workflows.js +1 -1
- package/dist/src/gateway/media-access.js +2 -1
- package/dist/src/gateway/mobile-privacy.js +2 -2
- package/dist/src/gateway/scenes/host.js +14 -3
- package/dist/src/gateway/scenes/mailContext.js +1 -1
- package/dist/src/gateway/scenes/slackThreadSource.d.ts +41 -0
- package/dist/src/gateway/scenes/slackThreadSource.js +168 -0
- package/dist/src/gateway/security/gateway-scopes.d.ts +1 -1
- package/dist/src/gateway/security/gateway-scopes.js +5 -0
- package/dist/src/gateway/service/app-context-access.d.ts +11 -0
- package/dist/src/gateway/service/app-context-access.js +70 -0
- package/dist/src/gateway/service/run-gateway-agent.js +11 -2
- package/dist/src/gateway/service/session-input-coordinator.js +54 -15
- package/dist/src/gateway/service/sessions-api.d.ts +1 -0
- package/dist/src/gateway/service/sessions-api.js +3 -0
- package/dist/src/gateway/service/task-conversation-query-service.d.ts +3 -1
- package/dist/src/gateway/service/task-conversation-query-service.js +32 -3
- package/dist/src/gateway/service.d.ts +3 -0
- package/dist/src/gateway/service.js +69 -15
- package/dist/src/gateway/session-context-summary.js +2 -1
- package/dist/src/{tasks/task-outbox-dispatcher.d.ts → infra/domain-outbox-dispatcher.d.ts} +2 -2
- package/dist/src/{tasks/task-outbox-dispatcher.js → infra/domain-outbox-dispatcher.js} +10 -9
- package/dist/src/infra/operation-context.d.ts +2 -0
- package/dist/src/infra/operation-context.js +16 -0
- package/dist/src/local-apps/capabilities/contracts.d.ts +2 -0
- package/dist/src/local-apps/capabilities/contracts.js +32 -0
- package/dist/src/local-apps/capabilities/read.d.ts +3 -0
- package/dist/src/local-apps/capabilities/read.js +48 -0
- package/dist/src/local-apps/capabilities/runtime.d.ts +16 -0
- package/dist/src/local-apps/capabilities/runtime.js +66 -0
- package/dist/src/local-apps/capabilities/write.d.ts +3 -0
- package/dist/src/local-apps/capabilities/write.js +35 -0
- package/dist/src/local-apps/release-lock.d.ts +2 -0
- package/dist/src/local-apps/release-lock.js +20 -0
- package/dist/src/local-apps/runtime-entry.d.ts +0 -2
- package/dist/src/local-apps/runtime-entry.js +1 -14
- package/dist/src/local-apps/scaffold.js +4 -1
- package/dist/src/local-apps/service.d.ts +24 -1
- package/dist/src/local-apps/service.js +186 -43
- package/dist/src/local-apps/store.js +0 -2
- package/dist/src/mcp/capability-server.d.ts +4 -0
- package/dist/src/mcp/capability-server.js +96 -0
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/mcp/gateway-http-client.d.ts +7 -0
- package/dist/src/mcp/gateway-http-client.js +27 -5
- package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
- package/dist/src/notes/agent-context.js +1 -1
- package/dist/src/notes/capabilities/read.d.ts +3 -0
- package/dist/src/notes/capabilities/read.js +96 -0
- package/dist/src/notes/capabilities/write.d.ts +7 -0
- package/dist/src/notes/capabilities/write.js +152 -0
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/service.d.ts +12 -4
- package/dist/src/notes/service.js +188 -175
- package/dist/src/notes/store.d.ts +14 -9
- package/dist/src/notes/store.js +81 -21
- package/dist/src/notifications/service.d.ts +1 -0
- package/dist/src/notifications/service.js +5 -0
- package/dist/src/platform/client.d.ts +1 -1
- package/dist/src/platform/contracts.d.ts +1 -1
- package/dist/src/projects/capabilities/read.d.ts +3 -0
- package/dist/src/projects/capabilities/read.js +81 -0
- package/dist/src/projects/capabilities/write.d.ts +9 -0
- package/dist/src/projects/capabilities/write.js +260 -0
- package/dist/src/projects/index.js +2 -2
- package/dist/src/projects/project-change-events.d.ts +2 -0
- package/dist/src/projects/project-change-events.js +18 -0
- package/dist/src/projects/project-service.d.ts +11 -0
- package/dist/src/projects/project-service.js +121 -42
- package/dist/src/projects/project-store.js +12 -2
- package/dist/src/projects/project-workspace-creation.d.ts +3 -0
- package/dist/src/projects/project-workspace-creation.js +45 -0
- package/dist/src/projects/workspace-project.js +6 -0
- package/dist/src/providers/model-catalog-types.d.ts +2 -1
- package/dist/src/providers/model-reference-auditor.js +4 -4
- package/dist/src/providers/model-supplements.js +13 -3
- package/dist/src/providers/presentation.js +3 -3
- package/dist/src/providers/xopc-cloud-model-source.js +4 -2
- package/dist/src/realtime/runtime.js +4 -0
- package/dist/src/scenes/capabilities/read.d.ts +3 -0
- package/dist/src/scenes/capabilities/read.js +187 -0
- package/dist/src/scenes/capabilities/write.d.ts +3 -0
- package/dist/src/scenes/capabilities/write.js +151 -0
- package/dist/src/scenes/contracts.d.ts +2 -105
- package/dist/src/scenes/contracts.js +3 -88
- package/dist/src/scenes/execution.d.ts +1 -1
- package/dist/src/scenes/httpServices.d.ts +2 -0
- package/dist/src/scenes/inbox.d.ts +1 -0
- package/dist/src/scenes/inbox.js +7 -7
- package/dist/src/scenes/preferences.d.ts +3 -24
- package/dist/src/scenes/preferences.js +8 -30
- package/dist/src/scenes/repository.d.ts +1 -0
- package/dist/src/scenes/repository.js +7 -3
- package/dist/src/scenes/resultNotifications.js +2 -2
- package/dist/src/scenes/schedule.d.ts +1 -8
- package/dist/src/scenes/schedule.js +3 -15
- package/dist/src/scenes/service.d.ts +6 -0
- package/dist/src/scenes/service.js +29 -25
- package/dist/src/scenes/taskFollowUp/agentExecutor.d.ts +36 -0
- package/dist/src/scenes/taskFollowUp/agentExecutor.js +149 -0
- package/dist/src/scenes/taskFollowUp/branchInventory.d.ts +38 -0
- package/dist/src/scenes/taskFollowUp/branchInventory.js +70 -0
- package/dist/src/scenes/taskFollowUp/contracts.d.ts +91 -0
- package/dist/src/scenes/taskFollowUp/contracts.js +100 -0
- package/dist/src/scenes/taskFollowUp/resources.d.ts +19 -0
- package/dist/src/scenes/taskFollowUp/resources.js +97 -0
- package/dist/src/scenes/taskFollowUp/service.d.ts +810 -0
- package/dist/src/scenes/taskFollowUp/service.js +710 -0
- package/dist/src/scenes/taskFollowUp/workspaceFingerprint.d.ts +2 -0
- package/dist/src/scenes/taskFollowUp/workspaceFingerprint.js +46 -0
- package/dist/src/scenes/templates.d.ts +2 -2
- package/dist/src/scenes/templates.js +1 -1
- package/dist/src/session/session-find.d.ts +17 -0
- package/dist/src/session/session-find.js +56 -0
- package/dist/src/session/store.d.ts +4 -0
- package/dist/src/session/store.js +43 -7
- package/dist/src/share/note-share-revocation.d.ts +3 -0
- package/dist/src/share/note-share-revocation.js +26 -0
- package/dist/src/storage/sqlite/migrations/190_scene_development.sql +37 -0
- package/dist/src/storage/sqlite/migrations/191_scene_task_follow_up.sql +27 -0
- package/dist/src/storage/sqlite/migrations/192_capability_operations.sql +20 -0
- package/dist/src/storage/sqlite/migrations/193_note_file_cleanup.sql +8 -0
- package/dist/src/storage/sqlite/migrations/194_capability_external_outcomes.sql +11 -0
- package/dist/src/storage/sqlite/migrations/195_automation_deleted_revisions.sql +4 -0
- package/dist/src/storage/sqlite/migrations/196_automation_run_requests.sql +23 -0
- package/dist/src/storage/sqlite/migrations/197_note_deletion_cleanup.sql +8 -0
- package/dist/src/storage/sqlite/migrations/198_project_workspace_creation.sql +7 -0
- package/dist/src/storage/sqlite/migrations/199_scene_resource_events.sql +488 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +6 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/transaction.d.ts +5 -0
- package/dist/src/storage/sqlite/transaction.js +34 -3
- package/dist/src/tasks/capabilities/management.d.ts +195 -0
- package/dist/src/tasks/capabilities/management.js +111 -0
- package/dist/src/tasks/capabilities/read.d.ts +2 -0
- package/dist/src/tasks/capabilities/read.js +141 -0
- package/dist/src/tasks/capabilities/relations.d.ts +204 -0
- package/dist/src/tasks/capabilities/relations.js +140 -0
- package/dist/src/tasks/capabilities/runs.d.ts +2 -0
- package/dist/src/tasks/capabilities/runs.js +89 -0
- package/dist/src/tasks/capabilities/write.d.ts +207 -0
- package/dist/src/tasks/capabilities/write.js +107 -0
- package/dist/src/tasks/home-query-service.js +3 -2
- package/dist/src/tasks/index.d.ts +0 -1
- package/dist/src/tasks/index.js +9 -9
- package/dist/src/tasks/project-operating-view-service.js +2 -1
- package/dist/src/tasks/task-application-service.d.ts +1 -0
- package/dist/src/tasks/task-application-service.js +3 -2
- package/dist/src/tasks/task-change-events.js +5 -3
- package/dist/src/tasks/task-context-assembler.js +2 -1
- package/dist/src/tasks/task-deletion-service.js +2 -1
- package/dist/src/tasks/task-dependency-service.js +2 -1
- package/dist/src/tasks/task-handoff-service.js +2 -1
- package/dist/src/tasks/task-read-model-projector.js +2 -1
- package/dist/src/tasks/task-repository.d.ts +12 -7
- package/dist/src/tasks/task-repository.js +175 -154
- package/dist/src/tasks/task-run-coordinator.js +2 -1
- package/dist/src/tasks/task-run-dispatcher.js +2 -1
- package/dist/src/tasks/task-run-repository.d.ts +1 -0
- package/dist/src/tasks/task-run-repository.js +29 -14
- package/dist/src/tasks/task-signal-service.js +2 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/user-context/config.d.ts +13 -0
- package/dist/src/user-context/config.js +2 -0
- package/dist/src/voice/platform-catalog.d.ts +1 -1
- package/dist/src/voice/realtime/runtime.js +3 -3
- package/dist/src/voice/stt/providers/alibaba-transcription.js +1 -1
- package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
- package/dist/src/work-discovery/incremental-repository.js +1 -1
- package/dist/src/work-discovery/index.js +1 -1
- package/dist/src/work-discovery/repository.d.ts +1 -1
- package/dist/src/work-discovery/repository.js +3 -2
- package/dist/src/work-discovery/service.d.ts +4 -0
- package/dist/src/work-discovery/service.js +36 -11
- package/dist/src/workflows/context/workflow-context.js +3 -2
- package/dist/src/workflows/service/workflow-run-service.js +2 -1
- package/package.json +6 -2
- package/skills/THIRD_PARTY_NOTICES.md +2 -2
- package/skills/documents/xlsx/SKILL.md +5 -0
- package/skills/engineering/build-xopc-local-app/SKILL.md +2 -0
- package/skills/tools/find-skills/SKILL.md +3 -0
- package/dist/gateway/static/root/assets/activity-store-DVUTs1fk.js +0 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-K3hTmu9d.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-CU52MfIT.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-ZpA1-6ad.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-IEAxKRME.js +0 -7
- package/dist/gateway/static/root/assets/browser-settings-page-CU4VWsmX.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C9XQk3HL.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-Bqlhjooi.js +0 -1
- package/dist/gateway/static/root/assets/connector-service-page-BmH17JnO.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-zkx8Q-e6.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-settings-CE4GOlMM.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-CdKJqnnw.js +0 -1
- package/dist/gateway/static/root/assets/files-Be5viEFY.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-CGOW0-b4.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-D4um_sV7.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CgXp2zq4.js +0 -1
- package/dist/gateway/static/root/assets/home-page-D6Idk732.js +0 -1
- package/dist/gateway/static/root/assets/index-1wIKA-kM.css +0 -1
- package/dist/gateway/static/root/assets/index-PFQHPGgi.js +0 -79
- package/dist/gateway/static/root/assets/local-app-workbench-page-BmAqTRb4.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-ZjVYXXyM.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-CSTkYVOZ.js +0 -1
- package/dist/gateway/static/root/assets/messages-4BtQKYlM.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-DuXCt-MM.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BjOgBVq5.js +0 -8
- package/dist/gateway/static/root/assets/product-delivery-CrAI8ZEa.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-0zi4-i9X.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B18OxmJj.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-z-DxbuaE.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-DGsBTbo6.js +0 -5
- package/dist/gateway/static/root/assets/scenes-page-Bgba03B_.js +0 -1
- package/dist/gateway/static/root/assets/schemas-BaskVM5g.js +0 -64
- package/dist/gateway/static/root/assets/sessions-page-B1t3bMsm.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CBX0Ezhf.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Bw71C2X3.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BoVDQolc.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DtTptpAt.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-vgkiGo-D.js +0 -1
- package/dist/gateway/static/root/assets/theme-store-CegIlB8d.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-CAGafNfP.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-CSxHVs1p.js +0 -6
- package/skills/creative/algorithmic-art/SKILL.md +0 -44
- package/skills/creative/algorithmic-art/templates/generator-template.js +0 -27
- package/skills/creative/algorithmic-art/templates/viewer.html +0 -27
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
-- Scene resource revisions cover the aggregate (notes, runs, results), not activation edit revisions.
|
|
2
|
+
-- Triggers keep background producers and capability calls on the same durable outbox path.
|
|
3
|
+
CREATE TABLE scene_resource_revisions (
|
|
4
|
+
resource_id TEXT PRIMARY KEY,
|
|
5
|
+
revision INTEGER NOT NULL CHECK(revision >= 0)
|
|
6
|
+
);
|
|
7
|
+
INSERT INTO scene_resource_revisions SELECT id, 0 FROM scene_activations;
|
|
8
|
+
|
|
9
|
+
CREATE TRIGGER scene_activations_resource_insert
|
|
10
|
+
AFTER INSERT ON scene_activations
|
|
11
|
+
BEGIN
|
|
12
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
13
|
+
SELECT NEW.id, 1 WHERE NEW.id IS NOT NULL
|
|
14
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
15
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
16
|
+
SELECT lower(hex(randomblob(16))), 'scene.created', 'scene', resource_id, resource_id,
|
|
17
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
18
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.id;
|
|
19
|
+
END;
|
|
20
|
+
|
|
21
|
+
CREATE TRIGGER scene_activations_resource_update
|
|
22
|
+
AFTER UPDATE ON scene_activations
|
|
23
|
+
WHEN OLD.revision IS NOT NEW.revision OR OLD.status IS NOT NEW.status OR OLD.goal IS NOT NEW.goal OR OLD.scope_json IS NOT NEW.scope_json OR OLD.permissions_json IS NOT NEW.permissions_json
|
|
24
|
+
BEGIN
|
|
25
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
26
|
+
SELECT NEW.id, 1 WHERE NEW.id IS NOT NULL
|
|
27
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
28
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
29
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
30
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
31
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.id;
|
|
32
|
+
END;
|
|
33
|
+
|
|
34
|
+
CREATE TRIGGER scene_activations_resource_delete
|
|
35
|
+
AFTER DELETE ON scene_activations
|
|
36
|
+
BEGIN
|
|
37
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
38
|
+
SELECT OLD.id, 1 WHERE OLD.id IS NOT NULL
|
|
39
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
40
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
41
|
+
SELECT lower(hex(randomblob(16))), 'scene.deleted', 'scene', resource_id, resource_id,
|
|
42
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
43
|
+
FROM scene_resource_revisions WHERE resource_id = OLD.id;
|
|
44
|
+
END;
|
|
45
|
+
|
|
46
|
+
CREATE TRIGGER scene_notes_resource_insert
|
|
47
|
+
AFTER INSERT ON scene_notes
|
|
48
|
+
BEGIN
|
|
49
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
50
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
51
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
52
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
53
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
54
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
55
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
56
|
+
END;
|
|
57
|
+
|
|
58
|
+
CREATE TRIGGER scene_notes_resource_update
|
|
59
|
+
AFTER UPDATE ON scene_notes
|
|
60
|
+
WHEN OLD.revision IS NOT NEW.revision
|
|
61
|
+
BEGIN
|
|
62
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
63
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
64
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
65
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
66
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
67
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
68
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
69
|
+
END;
|
|
70
|
+
|
|
71
|
+
CREATE TRIGGER scene_notes_resource_delete
|
|
72
|
+
AFTER DELETE ON scene_notes
|
|
73
|
+
BEGIN
|
|
74
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
75
|
+
SELECT OLD.activation_id, 1 WHERE OLD.activation_id IS NOT NULL
|
|
76
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
77
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
78
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
79
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
80
|
+
FROM scene_resource_revisions WHERE resource_id = OLD.activation_id;
|
|
81
|
+
END;
|
|
82
|
+
|
|
83
|
+
CREATE TRIGGER scene_work_items_resource_insert
|
|
84
|
+
AFTER INSERT ON scene_work_items
|
|
85
|
+
BEGIN
|
|
86
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
87
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
88
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
89
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
90
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
91
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
92
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
93
|
+
END;
|
|
94
|
+
|
|
95
|
+
CREATE TRIGGER scene_work_items_resource_update
|
|
96
|
+
AFTER UPDATE ON scene_work_items
|
|
97
|
+
WHEN OLD.revision IS NOT NEW.revision OR OLD.status IS NOT NEW.status OR OLD.due_at IS NOT NEW.due_at
|
|
98
|
+
BEGIN
|
|
99
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
100
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
101
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
102
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
103
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
104
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
105
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
106
|
+
END;
|
|
107
|
+
|
|
108
|
+
CREATE TRIGGER scene_work_items_resource_delete
|
|
109
|
+
AFTER DELETE ON scene_work_items
|
|
110
|
+
BEGIN
|
|
111
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
112
|
+
SELECT OLD.activation_id, 1 WHERE OLD.activation_id IS NOT NULL
|
|
113
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
114
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
115
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
116
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
117
|
+
FROM scene_resource_revisions WHERE resource_id = OLD.activation_id;
|
|
118
|
+
END;
|
|
119
|
+
|
|
120
|
+
CREATE TRIGGER scene_schedule_cursors_resource_insert
|
|
121
|
+
AFTER INSERT ON scene_schedule_cursors
|
|
122
|
+
BEGIN
|
|
123
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
124
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
125
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
126
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
127
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
128
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
129
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
130
|
+
END;
|
|
131
|
+
|
|
132
|
+
CREATE TRIGGER scene_schedule_cursors_resource_update
|
|
133
|
+
AFTER UPDATE ON scene_schedule_cursors
|
|
134
|
+
WHEN OLD.revision IS NOT NEW.revision OR OLD.next_due_at IS NOT NEW.next_due_at
|
|
135
|
+
BEGIN
|
|
136
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
137
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
138
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
139
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
140
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
141
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
142
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
143
|
+
END;
|
|
144
|
+
|
|
145
|
+
CREATE TRIGGER scene_schedule_cursors_resource_delete
|
|
146
|
+
AFTER DELETE ON scene_schedule_cursors
|
|
147
|
+
BEGIN
|
|
148
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
149
|
+
SELECT OLD.activation_id, 1 WHERE OLD.activation_id IS NOT NULL
|
|
150
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
151
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
152
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
153
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
154
|
+
FROM scene_resource_revisions WHERE resource_id = OLD.activation_id;
|
|
155
|
+
END;
|
|
156
|
+
|
|
157
|
+
CREATE TRIGGER scene_trigger_intents_resource_insert
|
|
158
|
+
AFTER INSERT ON scene_trigger_intents
|
|
159
|
+
BEGIN
|
|
160
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
161
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
162
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
163
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
164
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
165
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
166
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
167
|
+
END;
|
|
168
|
+
|
|
169
|
+
CREATE TRIGGER scene_trigger_intents_resource_update
|
|
170
|
+
AFTER UPDATE ON scene_trigger_intents
|
|
171
|
+
WHEN OLD.status IS NOT NEW.status OR OLD.due_at IS NOT NEW.due_at
|
|
172
|
+
BEGIN
|
|
173
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
174
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
175
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
176
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
177
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
178
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
179
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
180
|
+
END;
|
|
181
|
+
|
|
182
|
+
CREATE TRIGGER scene_trigger_intents_resource_delete
|
|
183
|
+
AFTER DELETE ON scene_trigger_intents
|
|
184
|
+
BEGIN
|
|
185
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
186
|
+
SELECT OLD.activation_id, 1 WHERE OLD.activation_id IS NOT NULL
|
|
187
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
188
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
189
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
190
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
191
|
+
FROM scene_resource_revisions WHERE resource_id = OLD.activation_id;
|
|
192
|
+
END;
|
|
193
|
+
|
|
194
|
+
CREATE TRIGGER scene_runs_resource_insert
|
|
195
|
+
AFTER INSERT ON scene_runs
|
|
196
|
+
BEGIN
|
|
197
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
198
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
199
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
200
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
201
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
202
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
203
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
204
|
+
END;
|
|
205
|
+
|
|
206
|
+
CREATE TRIGGER scene_runs_resource_update
|
|
207
|
+
AFTER UPDATE ON scene_runs
|
|
208
|
+
WHEN OLD.status IS NOT NEW.status OR OLD.attempt IS NOT NEW.attempt OR OLD.reason IS NOT NEW.reason OR OLD.retry_at IS NOT NEW.retry_at
|
|
209
|
+
BEGIN
|
|
210
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
211
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
212
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
213
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
214
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
215
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
216
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
217
|
+
END;
|
|
218
|
+
|
|
219
|
+
CREATE TRIGGER scene_runs_resource_delete
|
|
220
|
+
AFTER DELETE ON scene_runs
|
|
221
|
+
BEGIN
|
|
222
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
223
|
+
SELECT OLD.activation_id, 1 WHERE OLD.activation_id IS NOT NULL
|
|
224
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
225
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
226
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
227
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
228
|
+
FROM scene_resource_revisions WHERE resource_id = OLD.activation_id;
|
|
229
|
+
END;
|
|
230
|
+
|
|
231
|
+
CREATE TRIGGER scene_presentations_resource_insert
|
|
232
|
+
AFTER INSERT ON scene_presentations
|
|
233
|
+
BEGIN
|
|
234
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
235
|
+
SELECT (SELECT r.activation_id FROM scene_outcomes o JOIN scene_runs r ON r.id = o.run_id WHERE o.id = NEW.outcome_id), 1 WHERE (SELECT r.activation_id FROM scene_outcomes o JOIN scene_runs r ON r.id = o.run_id WHERE o.id = NEW.outcome_id) IS NOT NULL
|
|
236
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
237
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
238
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
239
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
240
|
+
FROM scene_resource_revisions WHERE resource_id = (SELECT r.activation_id FROM scene_outcomes o JOIN scene_runs r ON r.id = o.run_id WHERE o.id = NEW.outcome_id);
|
|
241
|
+
END;
|
|
242
|
+
|
|
243
|
+
CREATE TRIGGER scene_presentations_resource_update
|
|
244
|
+
AFTER UPDATE ON scene_presentations
|
|
245
|
+
WHEN OLD.status IS NOT NEW.status OR OLD.revision IS NOT NEW.revision OR OLD.withdrawn_at IS NOT NEW.withdrawn_at OR OLD.expires_at IS NOT NEW.expires_at OR OLD.snoozed_until IS NOT NEW.snoozed_until
|
|
246
|
+
BEGIN
|
|
247
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
248
|
+
SELECT (SELECT r.activation_id FROM scene_outcomes o JOIN scene_runs r ON r.id = o.run_id WHERE o.id = NEW.outcome_id), 1 WHERE (SELECT r.activation_id FROM scene_outcomes o JOIN scene_runs r ON r.id = o.run_id WHERE o.id = NEW.outcome_id) IS NOT NULL
|
|
249
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
250
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
251
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
252
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
253
|
+
FROM scene_resource_revisions WHERE resource_id = (SELECT r.activation_id FROM scene_outcomes o JOIN scene_runs r ON r.id = o.run_id WHERE o.id = NEW.outcome_id);
|
|
254
|
+
END;
|
|
255
|
+
|
|
256
|
+
CREATE TRIGGER scene_presentations_resource_delete
|
|
257
|
+
AFTER DELETE ON scene_presentations
|
|
258
|
+
BEGIN
|
|
259
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
260
|
+
SELECT (SELECT r.activation_id FROM scene_outcomes o JOIN scene_runs r ON r.id = o.run_id WHERE o.id = OLD.outcome_id), 1 WHERE (SELECT r.activation_id FROM scene_outcomes o JOIN scene_runs r ON r.id = o.run_id WHERE o.id = OLD.outcome_id) IS NOT NULL
|
|
261
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
262
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
263
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
264
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
265
|
+
FROM scene_resource_revisions WHERE resource_id = (SELECT r.activation_id FROM scene_outcomes o JOIN scene_runs r ON r.id = o.run_id WHERE o.id = OLD.outcome_id);
|
|
266
|
+
END;
|
|
267
|
+
|
|
268
|
+
CREATE TRIGGER scene_feedback_resource_insert
|
|
269
|
+
AFTER INSERT ON scene_feedback
|
|
270
|
+
BEGIN
|
|
271
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
272
|
+
SELECT (SELECT r.activation_id FROM scene_presentations p JOIN scene_outcomes o ON o.id = p.outcome_id JOIN scene_runs r ON r.id = o.run_id WHERE p.id = NEW.presentation_id), 1 WHERE (SELECT r.activation_id FROM scene_presentations p JOIN scene_outcomes o ON o.id = p.outcome_id JOIN scene_runs r ON r.id = o.run_id WHERE p.id = NEW.presentation_id) IS NOT NULL
|
|
273
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
274
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
275
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
276
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
277
|
+
FROM scene_resource_revisions WHERE resource_id = (SELECT r.activation_id FROM scene_presentations p JOIN scene_outcomes o ON o.id = p.outcome_id JOIN scene_runs r ON r.id = o.run_id WHERE p.id = NEW.presentation_id);
|
|
278
|
+
END;
|
|
279
|
+
|
|
280
|
+
CREATE TRIGGER scene_feedback_resource_update
|
|
281
|
+
AFTER UPDATE ON scene_feedback
|
|
282
|
+
WHEN OLD.revision IS NOT NEW.revision
|
|
283
|
+
BEGIN
|
|
284
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
285
|
+
SELECT (SELECT r.activation_id FROM scene_presentations p JOIN scene_outcomes o ON o.id = p.outcome_id JOIN scene_runs r ON r.id = o.run_id WHERE p.id = NEW.presentation_id), 1 WHERE (SELECT r.activation_id FROM scene_presentations p JOIN scene_outcomes o ON o.id = p.outcome_id JOIN scene_runs r ON r.id = o.run_id WHERE p.id = NEW.presentation_id) IS NOT NULL
|
|
286
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
287
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
288
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
289
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
290
|
+
FROM scene_resource_revisions WHERE resource_id = (SELECT r.activation_id FROM scene_presentations p JOIN scene_outcomes o ON o.id = p.outcome_id JOIN scene_runs r ON r.id = o.run_id WHERE p.id = NEW.presentation_id);
|
|
291
|
+
END;
|
|
292
|
+
|
|
293
|
+
CREATE TRIGGER scene_feedback_resource_delete
|
|
294
|
+
AFTER DELETE ON scene_feedback
|
|
295
|
+
BEGIN
|
|
296
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
297
|
+
SELECT (SELECT r.activation_id FROM scene_presentations p JOIN scene_outcomes o ON o.id = p.outcome_id JOIN scene_runs r ON r.id = o.run_id WHERE p.id = OLD.presentation_id), 1 WHERE (SELECT r.activation_id FROM scene_presentations p JOIN scene_outcomes o ON o.id = p.outcome_id JOIN scene_runs r ON r.id = o.run_id WHERE p.id = OLD.presentation_id) IS NOT NULL
|
|
298
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
299
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
300
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
301
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
302
|
+
FROM scene_resource_revisions WHERE resource_id = (SELECT r.activation_id FROM scene_presentations p JOIN scene_outcomes o ON o.id = p.outcome_id JOIN scene_runs r ON r.id = o.run_id WHERE p.id = OLD.presentation_id);
|
|
303
|
+
END;
|
|
304
|
+
|
|
305
|
+
CREATE TRIGGER scene_source_health_resource_insert
|
|
306
|
+
AFTER INSERT ON scene_source_health
|
|
307
|
+
BEGIN
|
|
308
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
309
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
310
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
311
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
312
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
313
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
314
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
315
|
+
END;
|
|
316
|
+
|
|
317
|
+
CREATE TRIGGER scene_source_health_resource_update
|
|
318
|
+
AFTER UPDATE ON scene_source_health
|
|
319
|
+
WHEN OLD.reason IS NOT NEW.reason OR OLD.retry_at IS NOT NEW.retry_at OR OLD.consecutive_failures IS NOT NEW.consecutive_failures
|
|
320
|
+
BEGIN
|
|
321
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
322
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
323
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
324
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
325
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
326
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
327
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
328
|
+
END;
|
|
329
|
+
|
|
330
|
+
CREATE TRIGGER scene_source_health_resource_delete
|
|
331
|
+
AFTER DELETE ON scene_source_health
|
|
332
|
+
BEGIN
|
|
333
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
334
|
+
SELECT OLD.activation_id, 1 WHERE OLD.activation_id IS NOT NULL
|
|
335
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
336
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
337
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
338
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
339
|
+
FROM scene_resource_revisions WHERE resource_id = OLD.activation_id;
|
|
340
|
+
END;
|
|
341
|
+
|
|
342
|
+
CREATE TRIGGER scene_task_bindings_resource_insert
|
|
343
|
+
AFTER INSERT ON scene_task_bindings
|
|
344
|
+
BEGIN
|
|
345
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
346
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
347
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
348
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
349
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
350
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
351
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
352
|
+
END;
|
|
353
|
+
|
|
354
|
+
CREATE TRIGGER scene_task_bindings_resource_update
|
|
355
|
+
AFTER UPDATE ON scene_task_bindings
|
|
356
|
+
WHEN OLD.observed_revision IS NOT NEW.observed_revision OR OLD.delivered_revision IS NOT NEW.delivered_revision OR OLD.processed_revision IS NOT NEW.processed_revision OR OLD.executing_run_id IS NOT NEW.executing_run_id OR OLD.last_error IS NOT NEW.last_error
|
|
357
|
+
BEGIN
|
|
358
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
359
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
360
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
361
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
362
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
363
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
364
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
365
|
+
END;
|
|
366
|
+
|
|
367
|
+
CREATE TRIGGER scene_task_bindings_resource_delete
|
|
368
|
+
AFTER DELETE ON scene_task_bindings
|
|
369
|
+
BEGIN
|
|
370
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
371
|
+
SELECT OLD.activation_id, 1 WHERE OLD.activation_id IS NOT NULL
|
|
372
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
373
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
374
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
375
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
376
|
+
FROM scene_resource_revisions WHERE resource_id = OLD.activation_id;
|
|
377
|
+
END;
|
|
378
|
+
|
|
379
|
+
CREATE TRIGGER scene_task_revisions_resource_insert
|
|
380
|
+
AFTER INSERT ON scene_task_revisions
|
|
381
|
+
BEGIN
|
|
382
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
383
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
384
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
385
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
386
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
387
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
388
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
389
|
+
END;
|
|
390
|
+
|
|
391
|
+
CREATE TRIGGER scene_task_revisions_resource_update
|
|
392
|
+
AFTER UPDATE ON scene_task_revisions
|
|
393
|
+
WHEN OLD.revision IS NOT NEW.revision
|
|
394
|
+
BEGIN
|
|
395
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
396
|
+
SELECT NEW.activation_id, 1 WHERE NEW.activation_id IS NOT NULL
|
|
397
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
398
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
399
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
400
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
401
|
+
FROM scene_resource_revisions WHERE resource_id = NEW.activation_id;
|
|
402
|
+
END;
|
|
403
|
+
|
|
404
|
+
CREATE TRIGGER scene_task_revisions_resource_delete
|
|
405
|
+
AFTER DELETE ON scene_task_revisions
|
|
406
|
+
BEGIN
|
|
407
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
408
|
+
SELECT OLD.activation_id, 1 WHERE OLD.activation_id IS NOT NULL
|
|
409
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
410
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
411
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
412
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
413
|
+
FROM scene_resource_revisions WHERE resource_id = OLD.activation_id;
|
|
414
|
+
END;
|
|
415
|
+
|
|
416
|
+
CREATE TRIGGER scene_preferences_resource_insert
|
|
417
|
+
AFTER INSERT ON scene_preferences
|
|
418
|
+
BEGIN
|
|
419
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
420
|
+
SELECT 'preferences', 1 WHERE 'preferences' IS NOT NULL
|
|
421
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
422
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
423
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
424
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
425
|
+
FROM scene_resource_revisions WHERE resource_id = 'preferences';
|
|
426
|
+
END;
|
|
427
|
+
|
|
428
|
+
CREATE TRIGGER scene_preferences_resource_update
|
|
429
|
+
AFTER UPDATE ON scene_preferences
|
|
430
|
+
WHEN OLD.revision IS NOT NEW.revision
|
|
431
|
+
BEGIN
|
|
432
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
433
|
+
SELECT 'preferences', 1 WHERE 'preferences' IS NOT NULL
|
|
434
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
435
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
436
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
437
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
438
|
+
FROM scene_resource_revisions WHERE resource_id = 'preferences';
|
|
439
|
+
END;
|
|
440
|
+
|
|
441
|
+
CREATE TRIGGER scene_preferences_resource_delete
|
|
442
|
+
AFTER DELETE ON scene_preferences
|
|
443
|
+
BEGIN
|
|
444
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
445
|
+
SELECT 'preferences', 1 WHERE 'preferences' IS NOT NULL
|
|
446
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
447
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
448
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
449
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
450
|
+
FROM scene_resource_revisions WHERE resource_id = 'preferences';
|
|
451
|
+
END;
|
|
452
|
+
|
|
453
|
+
CREATE TRIGGER scene_template_versions_resource_insert
|
|
454
|
+
AFTER INSERT ON scene_template_versions
|
|
455
|
+
BEGIN
|
|
456
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
457
|
+
SELECT 'templates', 1 WHERE 'templates' IS NOT NULL
|
|
458
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
459
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
460
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
461
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
462
|
+
FROM scene_resource_revisions WHERE resource_id = 'templates';
|
|
463
|
+
END;
|
|
464
|
+
|
|
465
|
+
CREATE TRIGGER scene_template_versions_resource_update
|
|
466
|
+
AFTER UPDATE ON scene_template_versions
|
|
467
|
+
WHEN OLD.content_hash IS NOT NEW.content_hash
|
|
468
|
+
BEGIN
|
|
469
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
470
|
+
SELECT 'templates', 1 WHERE 'templates' IS NOT NULL
|
|
471
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
472
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
473
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
474
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
475
|
+
FROM scene_resource_revisions WHERE resource_id = 'templates';
|
|
476
|
+
END;
|
|
477
|
+
|
|
478
|
+
CREATE TRIGGER scene_template_versions_resource_delete
|
|
479
|
+
AFTER DELETE ON scene_template_versions
|
|
480
|
+
BEGIN
|
|
481
|
+
INSERT INTO scene_resource_revisions(resource_id, revision)
|
|
482
|
+
SELECT 'templates', 1 WHERE 'templates' IS NOT NULL
|
|
483
|
+
ON CONFLICT(resource_id) DO UPDATE SET revision = revision + 1;
|
|
484
|
+
INSERT INTO domain_outbox(event_id, event_type, subject_kind, subject_id, correlation_id, payload_json, created_at, operation_id)
|
|
485
|
+
SELECT lower(hex(randomblob(16))), 'scene.changed', 'scene', resource_id, resource_id,
|
|
486
|
+
json_object('sceneId', resource_id, 'revision', revision), CAST(unixepoch('subsec') * 1000 AS INTEGER), xopc_operation_id()
|
|
487
|
+
FROM scene_resource_revisions WHERE resource_id = 'templates';
|
|
488
|
+
END;
|
|
@@ -3,7 +3,7 @@ import type { ApplyMigrationsOptions } from './types.js';
|
|
|
3
3
|
/** Baseline schema version applied from schema.sql on first open. */
|
|
4
4
|
export declare const XOPC_DB_BASELINE_SCHEMA_VERSION = 165;
|
|
5
5
|
/** Latest schema version this release supports (increment when adding migrations). */
|
|
6
|
-
export declare const XOPC_DB_SCHEMA_VERSION =
|
|
6
|
+
export declare const XOPC_DB_SCHEMA_VERSION = 199;
|
|
7
7
|
export declare function resolveMigrationsDir(override?: string): string;
|
|
8
8
|
/**
|
|
9
9
|
* Apply sequential SQL migrations from (currentVersion + 1) through targetVersion.
|
|
@@ -2,6 +2,7 @@ import { __esmMin } from "../../../../_virtual/_rolldown/runtime.js";
|
|
|
2
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
|
+
import { currentOperationId, init_operation_context } from "../../../infra/operation-context.js";
|
|
5
6
|
import { init_schema_version, readSchemaVersion, setSchemaVersion } from "../schema-version.js";
|
|
6
7
|
import { backupBeforeConversationCutover, init_conversation_backup } from "./conversation-backup.js";
|
|
7
8
|
import { init_conversation_uuid, migrateConversationUuids } from "./conversation-uuid.js";
|
|
@@ -55,7 +56,8 @@ function applySingleMigration(db, migration, discardOldScenes = false) {
|
|
|
55
56
|
* Each step runs in its own transaction and updates schema_meta on success.
|
|
56
57
|
*/
|
|
57
58
|
function applyPendingMigrations(db, options = {}) {
|
|
58
|
-
|
|
59
|
+
db.function("xopc_operation_id", () => currentOperationId() ?? null);
|
|
60
|
+
const targetVersion = options.targetVersion ?? 199;
|
|
59
61
|
let currentVersion = readSchemaVersion(db);
|
|
60
62
|
if (currentVersion > targetVersion) throw new DatabaseSchemaTooNewError(currentVersion, targetVersion);
|
|
61
63
|
if (!options.migrationsDir && currentVersion < 165) throw new DatabaseSchemaTooOldError(currentVersion, 165);
|
|
@@ -93,7 +95,7 @@ function applyPendingMigrations(db, options = {}) {
|
|
|
93
95
|
}
|
|
94
96
|
/** Inspect schema version without mutating the database. */
|
|
95
97
|
function inspectSchemaMigrationStatus(db, options = {}) {
|
|
96
|
-
const appVersion = options.targetVersion ??
|
|
98
|
+
const appVersion = options.targetVersion ?? 199;
|
|
97
99
|
const dbVersion = readSchemaVersion(db);
|
|
98
100
|
if (dbVersion > appVersion) return {
|
|
99
101
|
dbVersion,
|
|
@@ -125,6 +127,7 @@ function inspectSchemaMigrationStatus(db, options = {}) {
|
|
|
125
127
|
var log, XOPC_DB_BASELINE_SCHEMA_VERSION, XOPC_DB_SCHEMA_VERSION;
|
|
126
128
|
var init_runner = __esmMin((() => {
|
|
127
129
|
init_logger();
|
|
130
|
+
init_operation_context();
|
|
128
131
|
init_schema_version();
|
|
129
132
|
init_sql_assets();
|
|
130
133
|
init_conversation_backup();
|
|
@@ -134,7 +137,7 @@ var init_runner = __esmMin((() => {
|
|
|
134
137
|
init_errors();
|
|
135
138
|
log = createLogger("Sqlite:Migrations");
|
|
136
139
|
XOPC_DB_BASELINE_SCHEMA_VERSION = 165;
|
|
137
|
-
XOPC_DB_SCHEMA_VERSION =
|
|
140
|
+
XOPC_DB_SCHEMA_VERSION = 199;
|
|
138
141
|
}));
|
|
139
142
|
//#endregion
|
|
140
143
|
init_runner();
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
export declare class SqliteCommitEffectError extends Error {
|
|
3
|
+
constructor(cause: unknown);
|
|
4
|
+
}
|
|
5
|
+
/** Schedule a synchronous effect after an owned transaction commits. Persist its recovery intent first. */
|
|
6
|
+
export declare function afterSqliteCommit(effect: () => void): void;
|
|
2
7
|
/**
|
|
3
8
|
* Run an operation inside a `BEGIN IMMEDIATE` transaction with nested SAVEPOINT
|
|
4
9
|
* support and COMMIT retry on SQLITE_BUSY / SQLITE_LOCKED.
|