@xopcai/xopc 0.0.391 → 0.0.393
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/sidepanel.js +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CzS0TUv9.js → agent-avatar-dicebear-1AF2KGju.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CPJr7NRR.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-cjJXJj_3.js +1 -0
- package/dist/gateway/static/root/assets/agents-DW3TlnIg.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-Bb3Kvz3X.js → agents-admin-api-B5aykqg_.js} +1 -1
- package/dist/gateway/static/root/assets/app-link-BV_eGr7l.js +1 -0
- package/dist/gateway/static/root/assets/app-management-settings-panel-B_MFhXXU.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-TYGidVnd.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-DOkyvOF0.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DFnHPNie.js → archive-plugin-BrFfEp0u.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CnBLPVNh.js → automations-page-B7OofUPF.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DIod-bfm.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BQC0Tzoi.js → binary-plugins-BfAWnYG8.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DSh5019z.js → block-editor-_Y-QwZ-3.js} +5 -5
- package/dist/gateway/static/root/assets/browser-automation-inputs-DH9QHI9m.js +1 -0
- package/dist/gateway/static/root/assets/browser-automations-page-B_SnD9B0.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-BPlqYpMM.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-page-BtzZvMIK.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-pt2M56-E.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-WzoG3oBb.js +8 -0
- package/dist/gateway/static/root/assets/capability-header-actions-CFVx3iaZ.js +1 -0
- package/dist/gateway/static/root/assets/channels-BXA55GY2.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-D3GuiG3N.js +36 -0
- package/dist/gateway/static/root/assets/{chunk-KS7C4IRE--EKdQGRF.js → chunk-KS7C4IRE-B2HK1psj.js} +2 -2
- package/dist/gateway/static/root/assets/computer-settings-page-CIbHDlp8.js +1 -0
- package/dist/gateway/static/root/assets/connector-service-page-CDyCHkpK.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-DA2b6cJu.js +1 -0
- package/dist/gateway/static/root/assets/date-picker-C424c_g9.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-BVJh9sYc.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-Q52A8vjp.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-settings-CZr1CXxu.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-sprite-Bd-aOI7N.js +30 -0
- package/dist/gateway/static/root/assets/desktop-pet-sprite-BuB0g8zv.css +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-D_WWTsze.js +1 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-C6cUgrvg.js +1 -0
- package/dist/gateway/static/root/assets/echarts-runtime-tcHc9TOS.js +18 -0
- package/dist/gateway/static/root/assets/extension-debug-page-DyyfC4gA.js +1 -0
- package/dist/gateway/static/root/assets/extension-page-Dho9o3ZZ.js +1 -0
- package/dist/gateway/static/root/assets/extension-settings-page-CdnIGyCH.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-Dv_A5FMu.js → gateway-config-swr-BEePO3Wl.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DghCGfY_.js → gateway-realtime-Dng_VOvI.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DtlBf7oH.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-D0KSQRNZ.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CkTVSESs.js → gateway-startup-retry-CDCiy7Cd.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-DV2wNqBn.js → highlighted-body-KQOG7T2V-BNpj_mIM.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-CH_A0W29.js +2 -0
- package/dist/gateway/static/root/assets/image-generation-api-DwkO2y46.js +1 -0
- package/dist/gateway/static/root/assets/imports-page-BrYvomnU.js +1 -0
- package/dist/gateway/static/root/assets/index-CKdOZoVu.js +260 -0
- package/dist/gateway/static/root/assets/index-Rxjt-jc3.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-BveDYfYk.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-CcIi1BhT.js +1 -0
- package/dist/gateway/static/root/assets/local-apps-page-B1a69mlV.js +1 -0
- package/dist/gateway/static/root/assets/local-session-drafts-CYEDUPH7.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-BpK9AiDq.js → locale-store-CE7L6MlS.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Us1jv3C4.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-C9RAM7-s.js +1 -0
- package/dist/gateway/static/root/assets/markdown-view-PrKvVpRh.js +324 -0
- package/dist/gateway/static/root/assets/{media-plugins-oSChWbcP.js → media-plugins-CR1fp6IL.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DQdcaMiu.js +1 -0
- package/dist/gateway/static/root/assets/messages-CaeL_miw.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-Q4yRx9iZ.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-C9qu16IN.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-Cn_WK68Y.js +1 -0
- package/dist/gateway/static/root/assets/personal-page-DrP6hEcg.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-3NbiWGRG.js +1 -0
- package/dist/gateway/static/root/assets/product-delivery-DwmnNJvk.js +1 -0
- package/dist/gateway/static/root/assets/product-open-page-KKE5-V8k.js +1 -0
- package/dist/gateway/static/root/assets/product-preview-content-BM0oqNxi.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-CPZrwf8n.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Besfx_07.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-Dsa2LvRt.js → registry-api-BO2Ck3aA.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CTDghL5L.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-C2Uw89eY.js → runtime-tools-api-B1sb8nlw.js} +1 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-W0X_Fy7b.js +1 -0
- package/dist/gateway/static/root/assets/schema-form-DNM2Zdyr.js +1 -0
- package/dist/gateway/static/root/assets/{session-api-ga-SUOq_.js → session-api-CaAUJvu1.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-DoFTlgNz.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-Dxtablvd.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-C7zklouD.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-DCSHPFAN.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-DPCgrICd.js → settings-page-B18UbbaJ.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-JoSfluza.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-BLnS3hoH.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-DcIuPJK3.js +1 -0
- package/dist/gateway/static/root/assets/skill-api-CcYGkRPL.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-PnUZjoPK.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-D3JAw62U.js +2 -0
- package/dist/gateway/static/root/assets/style-BQqU-1pP.js +7 -0
- package/dist/gateway/static/root/assets/system-settings-panel-C974myUM.js +1 -0
- package/dist/gateway/static/root/assets/tab-completion-input-CxtEp0aP.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-CiljFekC.js +2 -0
- package/dist/gateway/static/root/assets/{task-expandable-content-DAZGz5YC.js → task-expandable-content-DTEVoNrM.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-DEE75MUn.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-DWyI3uA3.js +1 -0
- package/dist/gateway/static/root/assets/usage-page-DJYvbxk7.js +1 -0
- package/dist/gateway/static/root/assets/use-autosave-CY0YuljR.js +1 -0
- package/dist/gateway/static/root/assets/user-model-page-eHZJD6Fw.js +2 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-BNG4ixJE.js +1 -0
- package/dist/gateway/static/root/assets/{voice-config-api-Dl39b27p.js → voice-config-api-D0Wscn9W.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-CohIoAre.js +1 -0
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BXI8eyYh.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-CVti0u-l.js +6 -0
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-C_COnY_B.js +1 -0
- package/dist/gateway/static/root/index.html +22 -72
- package/dist/gateway/static/root/notification-sw.js +0 -15
- package/dist/package.js +1 -1
- package/dist/packages/computer-control-contract/src/index.js +8 -0
- package/dist/packages/gateway-contract/src/app-context.js +0 -1
- package/dist/packages/gateway-contract/src/capabilities.js +2 -249
- package/dist/packages/gateway-contract/src/home.js +0 -5
- package/dist/packages/gateway-contract/src/index.js +0 -4
- package/dist/packages/gateway-contract/src/notifications.js +0 -11
- package/dist/packages/gateway-contract/src/product-delivery.js +0 -2
- package/dist/src/agent/agent-instance-gateway.d.ts +2 -0
- package/dist/src/agent/agent-manager.d.ts +1 -3
- package/dist/src/agent/agent-manager.js +8 -18
- package/dist/src/agent/child-agent-factory.d.ts +2 -1
- package/dist/src/agent/child-agent-factory.js +2 -1
- package/dist/src/agent/coding/projectEvidence.d.ts +9 -0
- package/dist/src/agent/coding/projectEvidence.js +177 -0
- package/dist/src/agent/coding/repository-instructions.d.ts +8 -1
- package/dist/src/agent/coding/repository-instructions.js +9 -4
- package/dist/src/agent/coding/run-verification.d.ts +17 -2
- package/dist/src/agent/coding/run-verification.js +82 -12
- package/dist/src/agent/coding/workspace-revision.js +1 -1
- package/dist/src/agent/embedded/codemode-extension.js +1 -1
- package/dist/src/agent/embedded/execution-context.d.ts +1 -0
- package/dist/src/agent/embedded/execution-context.js +4 -1
- package/dist/src/agent/embedded/external-tool-discovery.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -0
- package/dist/src/agent/embedded/run-turn.js +41 -5
- package/dist/src/agent/embedded/session-runner.js +1 -1
- package/dist/src/agent/embedded/session-tool-result-guard.js +5 -0
- package/dist/src/agent/embedded/types.d.ts +2 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +2 -1
- package/dist/src/agent/external-tools/extension-provider.js +1 -1
- package/dist/src/agent/external-tools/gateway-tools.js +1 -1
- package/dist/src/agent/external-tools/memory-provider.js +1 -1
- package/dist/src/agent/independent-execution.d.ts +2 -0
- package/dist/src/agent/independent-execution.js +12 -0
- package/dist/src/agent/mcp/connection-drafts.js +15 -10
- package/dist/src/agent/memory/compaction.js +1 -1
- package/dist/src/agent/orchestration/delegation-scope.d.ts +1 -0
- package/dist/src/agent/orchestration/delegation-scope.js +4 -1
- package/dist/src/agent/orchestration/loop-guard.js +6 -2
- package/dist/src/agent/prompt/sections/agent-identity.js +3 -2
- package/dist/src/agent/prompt/sections/behavior.d.ts +3 -2
- package/dist/src/agent/prompt/sections/behavior.js +35 -25
- package/dist/src/agent/prompt/sections/memory-skills.d.ts +1 -1
- package/dist/src/agent/prompt/sections/memory-skills.js +10 -11
- package/dist/src/agent/prompt/sections/messaging-runtime.d.ts +3 -2
- package/dist/src/agent/prompt/sections/messaging-runtime.js +21 -24
- package/dist/src/agent/prompt/sections/response-language.js +7 -5
- package/dist/src/agent/prompt/sections/tooling.js +11 -10
- package/dist/src/agent/prompt/service-prompt-builder.js +3 -1
- package/dist/src/agent/prompt/system-prompt-params.d.ts +2 -1
- package/dist/src/agent/prompt/system-prompt-params.js +2 -0
- package/dist/src/agent/prompt/system-prompt.d.ts +2 -1
- package/dist/src/agent/prompt/system-prompt.js +21 -18
- package/dist/src/agent/prompt/types.d.ts +2 -0
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/service.types.d.ts +0 -2
- package/dist/src/agent/skills/format-skills-prompt.js +5 -2
- package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
- package/dist/src/agent/tool-manuals/computer.js +9 -1
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +6 -48
- package/dist/src/agent/tools/computer-use-tool.js +17 -3
- package/dist/src/agent/tools/dataBatch.d.ts +1 -0
- package/dist/src/agent/tools/dataBatch.js +4 -1
- package/dist/src/agent/tools/delegate-tool.d.ts +1 -0
- package/dist/src/agent/tools/delegate-tool.js +1 -0
- package/dist/src/agent/tools/error-tracker.js +4 -2
- package/dist/src/agent/tools/exec-command.js +4 -3
- package/dist/src/agent/tools/factory.d.ts +1 -2
- package/dist/src/agent/tools/factory.js +20 -22
- package/dist/src/agent/tools/{delegation-parent-policy.d.ts → noninteractive-tool-policy.d.ts} +1 -1
- package/dist/src/agent/tools/{delegation-parent-policy.js → noninteractive-tool-policy.js} +4 -4
- package/dist/src/agent/tools/personal-task-tool.js +1 -1
- package/dist/src/agent/tools/publish-artifacts.js +1 -1
- package/dist/src/agent/tools/search/cache.d.ts +3 -1
- package/dist/src/agent/tools/search/cache.js +4 -1
- package/dist/src/agent/tools/search/providers/deepseek-protocol.d.ts +9 -0
- package/dist/src/agent/tools/search/providers/deepseek-protocol.js +84 -0
- package/dist/src/agent/tools/search/providers/deepseek.d.ts +9 -0
- package/dist/src/agent/tools/search/providers/deepseek.js +55 -0
- package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +2 -1
- package/dist/src/agent/tools/search/providers/xopc-cloud.js +36 -1
- package/dist/src/agent/tools/search/registry.d.ts +1 -0
- package/dist/src/agent/tools/search/registry.js +32 -6
- package/dist/src/agent/tools/search/request-gate.d.ts +13 -0
- package/dist/src/agent/tools/search/request-gate.js +41 -0
- package/dist/src/agent/tools/search/resolve-config.js +1 -1
- package/dist/src/agent/tools/search/search-info.d.ts +8 -0
- package/dist/src/agent/tools/search/search-info.js +34 -0
- package/dist/src/agent/tools/search/types.d.ts +19 -1
- package/dist/src/agent/tools/toolExposure.d.ts +3 -0
- package/dist/src/agent/tools/toolExposure.js +25 -0
- package/dist/src/agent/tools/web.js +8 -1
- package/dist/src/agent/tools/xopc-use-tool.d.ts +2 -4
- package/dist/src/agent/tools/xopc-use-tool.js +11 -135
- package/dist/src/agent/workflow/builtins/index.js +98 -0
- package/dist/src/agent/workflow/subagent-runner.d.ts +1 -0
- package/dist/src/agent/workflow/subagent-runner.js +3 -3
- package/dist/src/agent/workflow/types.d.ts +3 -2
- package/dist/src/agent/workflow/workflow-child-tools.js +13 -8
- package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +1 -2
- package/dist/src/automations/domain/validation.d.ts +8 -8
- package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -1
- package/dist/src/automations/events/event-catalog.js +0 -18
- package/dist/src/backup/archive.js +1 -2
- package/dist/src/capabilities/runtime/app-context.js +2 -6
- package/dist/src/capabilities/runtime/product.d.ts +1 -3
- package/dist/src/capabilities/runtime/product.js +0 -6
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/commands/search.d.ts +2 -2
- package/dist/src/cli/commands/search.js +8 -6
- package/dist/src/computer/config.d.ts +1 -0
- package/dist/src/computer/config.js +1 -0
- package/dist/src/computer/diagnostics.d.ts +223 -0
- package/dist/src/computer/diagnostics.js +360 -0
- package/dist/src/computer/errors.d.ts +1 -1
- package/dist/src/computer/errors.js +8 -1
- package/dist/src/computer/evaluation-comparison.d.ts +125 -0
- package/dist/src/computer/evaluation-comparison.js +65 -0
- package/dist/src/computer/evaluation-harness.d.ts +2 -1
- package/dist/src/computer/evaluation-harness.js +59 -8
- package/dist/src/computer/evaluation.d.ts +102 -7
- package/dist/src/computer/evaluation.js +64 -15
- package/dist/src/computer/flows.d.ts +62 -0
- package/dist/src/computer/flows.js +158 -0
- package/dist/src/computer/model-adapter.d.ts +11 -0
- package/dist/src/computer/model-adapter.js +156 -11
- package/dist/src/computer/model-policy.d.ts +1 -1
- package/dist/src/computer/model-policy.js +13 -6
- package/dist/src/computer/release-gate.d.ts +11 -0
- package/dist/src/computer/runtime.d.ts +27 -2
- package/dist/src/computer/runtime.js +261 -44
- package/dist/src/computer/semantic-actions.d.ts +3 -0
- package/dist/src/computer/semantic-actions.js +29 -0
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/models-json.d.ts +14 -8
- package/dist/src/config/models-json.js +2 -0
- package/dist/src/config/outbound-proxy.d.ts +11 -0
- package/dist/src/config/outbound-proxy.js +30 -0
- package/dist/src/config/rules.js +5 -0
- package/dist/src/config/schema.d.ts +25 -10
- package/dist/src/config/schema.js +21 -10
- package/dist/src/connectors/cli/authorization.d.ts +1 -1
- package/dist/src/connectors/cli/store.d.ts +1 -1
- package/dist/src/endpoint-tools/invocation-service.js +5 -0
- package/dist/src/gateway/config-tools-web.js +15 -4
- package/dist/src/gateway/gateway-workflow-host.types.d.ts +3 -0
- package/dist/src/gateway/hono/app.d.ts +0 -2
- package/dist/src/gateway/hono/app.js +1 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +6 -3
- package/dist/src/gateway/hono/lib/config-payload.js +5 -1
- package/dist/src/gateway/hono/routes/capability-operations.js +0 -7
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +7 -0
- package/dist/src/gateway/hono/routes/deps.d.ts +0 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +0 -8
- package/dist/src/gateway/hono/routes/models.js +5 -2
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +2 -2
- package/dist/src/gateway/service/config-coordinator.d.ts +8 -5
- package/dist/src/gateway/service/session-input-coordinator.js +1 -1
- package/dist/src/gateway/service.d.ts +0 -3
- package/dist/src/gateway/service.js +10 -44
- package/dist/src/home-intelligence/generator.js +1 -1
- package/dist/src/home-intelligence/policy.js +0 -5
- package/dist/src/home-intelligence/repository.d.ts +1 -1
- package/dist/src/infra/domain-outbox-dispatcher.js +1 -1
- package/dist/src/infra/http-proxy-env.d.ts +3 -0
- package/dist/src/infra/http-proxy-env.js +22 -2
- package/dist/src/notifications/service.d.ts +2 -18
- package/dist/src/notifications/service.js +8 -39
- package/dist/src/notifications/store.d.ts +0 -1
- package/dist/src/notifications/store.js +1 -4
- package/dist/src/personal-agent/communication.d.ts +2 -1
- package/dist/src/personal-agent/communication.js +11 -2
- package/dist/src/personal-agent/persona.d.ts +2 -1
- package/dist/src/personal-agent/persona.js +3 -2
- package/dist/src/personal-agent/prompts.d.ts +2 -0
- package/dist/src/personal-agent/prompts.js +69 -7
- package/dist/src/personal-agent/reply-composer.js +2 -2
- package/dist/src/personal-agent/reply-style.d.ts +4 -2
- package/dist/src/personal-agent/reply-style.js +19 -3
- package/dist/src/personal-agent/request-service.js +14 -9
- package/dist/src/pets/loopi-artwork.d.ts +2 -0
- package/dist/src/pets/loopi-artwork.js +36 -0
- package/dist/src/pets/pointer.d.ts +6 -0
- package/dist/src/pets/pointer.js +16 -0
- package/dist/src/platform/contracts.d.ts +3 -3
- package/dist/src/project-trust/trust-store.d.ts +5 -0
- package/dist/src/project-trust/trust-store.js +7 -1
- package/dist/src/providers/index.js +3 -3
- package/dist/src/providers/model-registry.js +2 -0
- package/dist/src/providers/model-supplements.d.ts +0 -2
- package/dist/src/providers/model-supplements.js +2 -18
- package/dist/src/providers/xopc-cloud-credit-budget.d.ts +1 -0
- package/dist/src/providers/xopc-cloud-credit-budget.js +4 -1
- package/dist/src/realtime/compact-run-event.js +17 -2
- package/dist/src/realtime/runtime.js +1 -1
- package/dist/src/routing/agent-session-key.js +1 -1
- package/dist/src/routing/resolve-route.js +1 -1
- package/dist/src/routing/session-key.js +1 -1
- package/dist/src/session/compact-history.js +16 -6
- package/dist/src/storage/sqlite/connection.js +2 -2
- package/dist/src/storage/sqlite/conversation-repository.js +1 -1
- package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +0 -2
- package/dist/src/storage/sqlite/migrations/conversation-backup.js +8 -18
- package/dist/src/storage/sqlite/migrations/conversation-windows-owners.js +28 -33
- package/dist/src/storage/sqlite/migrations/errors.js +1 -1
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +5 -40
- package/dist/src/storage/sqlite/migrations/types.d.ts +0 -2
- package/dist/src/storage/sqlite/schema.d.ts +1 -3
- package/dist/src/storage/sqlite/schema.js +4 -8
- package/dist/src/storage/sqlite/schema.sql +1356 -1282
- package/dist/src/tasks/capabilities/management.d.ts +2 -2
- package/dist/src/tasks/capabilities/relations.d.ts +4 -4
- package/dist/src/tasks/capabilities/write.d.ts +4 -4
- package/dist/src/tasks/task-allocation-service.js +51 -40
- package/dist/src/tasks/task-application-service.js +5 -1
- package/dist/src/tasks/task-contract-planner.js +21 -6
- package/dist/src/tasks/task-language.d.ts +2 -0
- package/dist/src/tasks/task-language.js +13 -2
- package/dist/src/tasks/task-research-result.d.ts +2 -2
- package/dist/src/tasks/task-run-coordinator.js +5 -1
- package/dist/src/tasks/task-run-dispatcher.js +2 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/usage/scenario-registry.js +0 -5
- package/dist/src/usage/types.d.ts +1 -1
- package/dist/src/work-discovery/probe.js +1 -1
- package/dist/src/workflows/domain/definition.d.ts +1 -0
- package/dist/src/workflows/service/workflow-run-service.js +2 -1
- package/package.json +10 -6
- package/skills/THIRD_PARTY_NOTICES.md +0 -6
- package/skills/creative/chat-charts/SKILL.md +26 -0
- package/skills/creative/chat-charts/references/bar-example.json +10 -0
- package/skills/creative/chat-charts/references/chart-spec.md +25 -0
- package/skills/creative/chat-charts/references/line-example.json +13 -0
- package/dist/gateway/static/root/assets/activity-YogQEteU.js +0 -1
- package/dist/gateway/static/root/assets/activity-store-DWQCDi8M.js +0 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DE910MyU.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-0SlvsYl7.js +0 -1
- package/dist/gateway/static/root/assets/agents-BZh28Qn1.js +0 -77
- package/dist/gateway/static/root/assets/app-chrome-BeB4KgOf.js +0 -1
- package/dist/gateway/static/root/assets/app-link-4gpFbdsr.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-9A7JN5V5.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-BPdLEo6L.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-Cz7LypV9.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BBjS-sk-.js +0 -6
- package/dist/gateway/static/root/assets/browser-automation-inputs-C5tIrIRL.js +0 -1
- package/dist/gateway/static/root/assets/browser-automations-page-CFCMNfJN.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-C__tyPwu.js +0 -3
- package/dist/gateway/static/root/assets/button-aIC072nz.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-D6RJG4QY.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-DGEmBQnF.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-B5AZa7ir.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Dskz2_bh.js +0 -8
- package/dist/gateway/static/root/assets/capability-header-actions-xzjWZVbg.js +0 -1
- package/dist/gateway/static/root/assets/channels-DRse_dD3.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-CQF0M4kE.js +0 -36
- package/dist/gateway/static/root/assets/chevron-left-DqFhpbvK.js +0 -1
- package/dist/gateway/static/root/assets/chevron-right-BweFrslA.js +0 -1
- package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +0 -1
- package/dist/gateway/static/root/assets/circle-dashed-8qMD7gHf.js +0 -1
- package/dist/gateway/static/root/assets/circle-dot-BAseJTrF.js +0 -1
- package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-ZfzCTS0N.js +0 -1
- package/dist/gateway/static/root/assets/connector-service-page-CwAeWVLK.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CanakKaj.js +0 -1
- package/dist/gateway/static/root/assets/copy-text-row-C7egVuKr.js +0 -1
- package/dist/gateway/static/root/assets/date-formatters-CUZAyDEg.js +0 -1
- package/dist/gateway/static/root/assets/date-picker-hmJlEAQZ.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-Us_Juz6I.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-CvOTI4uw.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DYg-Gb8t.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-sprite-BP6iMVw1.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-B1FbZ8C1.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-DZN9EDvM.js +0 -1
- package/dist/gateway/static/root/assets/dist-C3DSFZCi.js +0 -1
- package/dist/gateway/static/root/assets/electron-env-Dit0bHgy.js +0 -1
- package/dist/gateway/static/root/assets/extension-debug-page-YIibp6Kk.js +0 -1
- package/dist/gateway/static/root/assets/extension-page-DkcGyb28.js +0 -1
- package/dist/gateway/static/root/assets/extension-provider-B1PQGTtY.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-C_rJiSKo.js +0 -1
- package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CMJVSnvi.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CjCWPHNJ.js +0 -1
- package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +0 -1
- package/dist/gateway/static/root/assets/home-page-fAYsd7kG.js +0 -2
- package/dist/gateway/static/root/assets/image-generation-api-B98iXt6A.js +0 -1
- package/dist/gateway/static/root/assets/imports-page-DoBCBN8G.js +0 -1
- package/dist/gateway/static/root/assets/index-DFgXwLsv.js +0 -260
- package/dist/gateway/static/root/assets/index-a6ZvhclR.css +0 -1
- package/dist/gateway/static/root/assets/index.module-Cd9ENXfk.js +0 -1
- package/dist/gateway/static/root/assets/interaction-BdhHBbYa.js +0 -1
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +0 -1
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-DXVu4lqV.js +0 -1
- package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-B3fz6uRi.js +0 -1
- package/dist/gateway/static/root/assets/local-apps-page-BC6xhmUh.js +0 -1
- package/dist/gateway/static/root/assets/local-session-drafts-DFnZQu9A.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CSqSFDRU.js +0 -2
- package/dist/gateway/static/root/assets/loopi-C09I2mNj.css +0 -1
- package/dist/gateway/static/root/assets/loopi-Djb8XU3l.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-gq5L0THs.js +0 -1
- package/dist/gateway/static/root/assets/markdown-view-IsYTotu6.js +0 -324
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-C_QKwqDN.js +0 -1
- package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +0 -1
- package/dist/gateway/static/root/assets/messages-CKTo_sIF.js +0 -3
- package/dist/gateway/static/root/assets/mic-CuUb7zc-.js +0 -1
- package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-TjpL7hZ5.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-CdpNXre-.js +0 -5
- package/dist/gateway/static/root/assets/notes-api-CBb944yw.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-EGvGw8MN.js +0 -8
- package/dist/gateway/static/root/assets/page-context-capture-button-CoWb7BYP.js +0 -1
- package/dist/gateway/static/root/assets/page-tabs-HLrKIjXH.js +0 -1
- package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-DYzbNTyN.js +0 -1
- package/dist/gateway/static/root/assets/popover-select-DHC7J4lG.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-BJU2fmPn.js +0 -1
- package/dist/gateway/static/root/assets/product-delivery-BAks11S4.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-CTyy7H7-.js +0 -1
- package/dist/gateway/static/root/assets/product-preview-content-D4xqTaEy.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DIVCw0QQ.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B4L9VnBN.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-B8PvgLVz.js +0 -1
- package/dist/gateway/static/root/assets/rotate-ccw-JM1TBLpp.js +0 -1
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Bqnp3tyt.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-D50g4GM2.js +0 -2
- package/dist/gateway/static/root/assets/schema-form-h_RCNfiO.js +0 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +0 -1
- package/dist/gateway/static/root/assets/secret-input-BxWHx6J6.js +0 -1
- package/dist/gateway/static/root/assets/send-session-input-DypbVTT7.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-C_OiKblh.js +0 -16
- package/dist/gateway/static/root/assets/sessions-page-BsqDIbIr.js +0 -1
- package/dist/gateway/static/root/assets/settings-2-D-csvaET.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D3zJAW4p.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-draft-Dy10ldo8.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-num14vSv.js +0 -1
- package/dist/gateway/static/root/assets/settings-shell-dialog-layer-BU3UuiJr.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-jjSYJpDd.js +0 -1
- package/dist/gateway/static/root/assets/share-link-dialog-BGicglAS.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-BORe9rLB.js +0 -2
- package/dist/gateway/static/root/assets/shares-api-Dbx3z6-1.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-C13FgfWk.js +0 -1
- package/dist/gateway/static/root/assets/skeleton-BI5TyibZ.js +0 -1
- package/dist/gateway/static/root/assets/skill-api-Cq6O1DZK.js +0 -1
- package/dist/gateway/static/root/assets/skill-api-utils-C7V4JVXM.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Cq7QDjMA.js +0 -1
- package/dist/gateway/static/root/assets/skill-wire-pattern-BPpeIcCi.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BM1ShEjx.js +0 -2
- package/dist/gateway/static/root/assets/style-TIDOdKy0.js +0 -7
- package/dist/gateway/static/root/assets/system-settings-panel-BNCGFO1e.js +0 -1
- package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-4VG82wcF.js +0 -2
- package/dist/gateway/static/root/assets/theme-store-Db7hDESt.js +0 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-C6p2Mu92.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-Dw15EJp0.js +0 -1
- package/dist/gateway/static/root/assets/usage-page-DDrIqgGe.js +0 -1
- package/dist/gateway/static/root/assets/use-async-resource-GrnWNwMZ.js +0 -1
- package/dist/gateway/static/root/assets/use-autosave-DDjIdW4U.js +0 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-DNl7O3Vb.js +0 -2
- package/dist/gateway/static/root/assets/use-file-preview-expanded-DMHehhwG.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-CaS9dOIr.js +0 -2
- package/dist/gateway/static/root/assets/voice-api-key-field-ByAxHE4P.js +0 -1
- package/dist/gateway/static/root/assets/voice-transcribe-api-CVaU83Jc.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-BvVvPA1T.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BcFm9QcC.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-DMec_XZB.js +0 -6
- package/dist/gateway/static/root/assets/workspace-api-BpfKsrtP.js +0 -2
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-CU5lzzE9.js +0 -1
- package/dist/packages/gateway-contract/src/project-monitoring.js +0 -36
- package/dist/packages/gateway-contract/src/scenes.js +0 -200
- package/dist/src/agent/bootstrap/project-agents-context.d.ts +0 -2
- package/dist/src/agent/bootstrap/project-agents-context.js +0 -30
- package/dist/src/gateway/hono/routes/scenes.d.ts +0 -3
- package/dist/src/gateway/hono/routes/scenes.js +0 -271
- package/dist/src/gateway/scenes/browserNotifications.d.ts +0 -4
- package/dist/src/gateway/scenes/browserNotifications.js +0 -54
- package/dist/src/gateway/scenes/host.d.ts +0 -34
- package/dist/src/gateway/scenes/host.js +0 -154
- package/dist/src/gateway/scenes/mailContext.d.ts +0 -32
- package/dist/src/gateway/scenes/mailContext.js +0 -235
- package/dist/src/gateway/scenes/slackThreadSource.d.ts +0 -41
- package/dist/src/gateway/scenes/slackThreadSource.js +0 -168
- package/dist/src/notifications/browser-endpoint.d.ts +0 -2
- package/dist/src/notifications/browser-endpoint.js +0 -13
- package/dist/src/notifications/browserSubscriptions.d.ts +0 -20
- package/dist/src/notifications/browserSubscriptions.js +0 -59
- package/dist/src/notifications/browserTransport.d.ts +0 -9
- package/dist/src/notifications/browserTransport.js +0 -64
- package/dist/src/notifications/dispatch.d.ts +0 -46
- package/dist/src/notifications/dispatch.js +0 -109
- package/dist/src/notifications/domain-delivery.d.ts +0 -21
- package/dist/src/notifications/domain-delivery.js +0 -1
- package/dist/src/notifications/quietHours.d.ts +0 -6
- package/dist/src/notifications/quietHours.js +0 -23
- package/dist/src/notifications/resultOutbox.d.ts +0 -23
- package/dist/src/notifications/resultOutbox.js +0 -49
- package/dist/src/scenes/activationAdapter.d.ts +0 -19
- package/dist/src/scenes/activationAdapter.js +0 -1
- package/dist/src/scenes/agentExecutor.d.ts +0 -9
- package/dist/src/scenes/agentExecutor.js +0 -61
- package/dist/src/scenes/capabilities/read.d.ts +0 -3
- package/dist/src/scenes/capabilities/read.js +0 -187
- package/dist/src/scenes/capabilities/write.d.ts +0 -3
- package/dist/src/scenes/capabilities/write.js +0 -151
- package/dist/src/scenes/contracts.d.ts +0 -9
- package/dist/src/scenes/contracts.js +0 -61
- package/dist/src/scenes/execution.d.ts +0 -62
- package/dist/src/scenes/execution.js +0 -169
- package/dist/src/scenes/httpServices.d.ts +0 -39
- package/dist/src/scenes/httpServices.js +0 -1
- package/dist/src/scenes/inbox.d.ts +0 -17
- package/dist/src/scenes/inbox.js +0 -68
- package/dist/src/scenes/mailContext.d.ts +0 -24
- package/dist/src/scenes/mailContext.js +0 -115
- package/dist/src/scenes/mailObservations.d.ts +0 -20
- package/dist/src/scenes/mailObservations.js +0 -107
- package/dist/src/scenes/maintenance.d.ts +0 -3
- package/dist/src/scenes/maintenance.js +0 -20
- package/dist/src/scenes/metrics.d.ts +0 -31
- package/dist/src/scenes/metrics.js +0 -89
- package/dist/src/scenes/model.d.ts +0 -3
- package/dist/src/scenes/model.js +0 -10
- package/dist/src/scenes/notificationEligibility.d.ts +0 -17
- package/dist/src/scenes/notificationEligibility.js +0 -72
- package/dist/src/scenes/notificationPublication.d.ts +0 -7
- package/dist/src/scenes/notificationPublication.js +0 -43
- package/dist/src/scenes/preferences.d.ts +0 -19
- package/dist/src/scenes/preferences.js +0 -86
- package/dist/src/scenes/readiness.d.ts +0 -7
- package/dist/src/scenes/readiness.js +0 -20
- package/dist/src/scenes/registry.d.ts +0 -11
- package/dist/src/scenes/registry.js +0 -28
- package/dist/src/scenes/repository.d.ts +0 -178
- package/dist/src/scenes/repository.js +0 -782
- package/dist/src/scenes/resultNotifications.d.ts +0 -17
- package/dist/src/scenes/resultNotifications.js +0 -204
- package/dist/src/scenes/runtime.d.ts +0 -25
- package/dist/src/scenes/runtime.js +0 -101
- package/dist/src/scenes/schedule.d.ts +0 -2
- package/dist/src/scenes/schedule.js +0 -33
- package/dist/src/scenes/service.d.ts +0 -36
- package/dist/src/scenes/service.js +0 -122
- package/dist/src/scenes/taskFollowUp/agentExecutor.d.ts +0 -36
- package/dist/src/scenes/taskFollowUp/agentExecutor.js +0 -149
- package/dist/src/scenes/taskFollowUp/branchInventory.d.ts +0 -38
- package/dist/src/scenes/taskFollowUp/branchInventory.js +0 -70
- package/dist/src/scenes/taskFollowUp/contracts.d.ts +0 -121
- package/dist/src/scenes/taskFollowUp/contracts.js +0 -119
- package/dist/src/scenes/taskFollowUp/resources.d.ts +0 -19
- package/dist/src/scenes/taskFollowUp/resources.js +0 -97
- package/dist/src/scenes/taskFollowUp/service.d.ts +0 -848
- package/dist/src/scenes/taskFollowUp/service.js +0 -770
- package/dist/src/scenes/taskFollowUp/workspaceFingerprint.d.ts +0 -2
- package/dist/src/scenes/taskFollowUp/workspaceFingerprint.js +0 -46
- package/dist/src/scenes/templates.d.ts +0 -64
- package/dist/src/scenes/templates.js +0 -76
- package/dist/src/scenes/userNotes.d.ts +0 -13
- package/dist/src/scenes/userNotes.js +0 -40
- package/dist/src/storage/sqlite/migrations/166_remove_proactive_previews.sql +0 -1
- package/dist/src/storage/sqlite/migrations/167_discussion_recording_chunks.sql +0 -7
- package/dist/src/storage/sqlite/migrations/168_discussion_evidence.sql +0 -16
- package/dist/src/storage/sqlite/migrations/169_discussion_action_tasks.sql +0 -8
- package/dist/src/storage/sqlite/migrations/170_discussion_edits.sql +0 -8
- package/dist/src/storage/sqlite/migrations/171_discussion_recording_jobs.sql +0 -14
- package/dist/src/storage/sqlite/migrations/172_project_understanding.sql +0 -3
- package/dist/src/storage/sqlite/migrations/173_mobile_discussion_source.sql +0 -5
- package/dist/src/storage/sqlite/migrations/174_capability_imports.sql +0 -11
- package/dist/src/storage/sqlite/migrations/175_import_selections.sql +0 -8
- package/dist/src/storage/sqlite/migrations/176_proactive_quality.sql +0 -5
- package/dist/src/storage/sqlite/migrations/177_proactive_check_controls.sql +0 -25
- package/dist/src/storage/sqlite/migrations/178_conversation_uuid.sql +0 -2
- package/dist/src/storage/sqlite/migrations/179_harmonyos_devices.sql +0 -41
- package/dist/src/storage/sqlite/migrations/180_execution_environment_ownership.sql +0 -7
- package/dist/src/storage/sqlite/migrations/181_knowledge_item_status_events.sql +0 -12
- package/dist/src/storage/sqlite/migrations/182_connector_account_policies.sql +0 -92
- package/dist/src/storage/sqlite/migrations/183_connector_backend_consistency.sql +0 -20
- package/dist/src/storage/sqlite/migrations/184_memory_suppressions.sql +0 -12
- package/dist/src/storage/sqlite/migrations/185_understanding_refresh_batches.sql +0 -6
- package/dist/src/storage/sqlite/migrations/186_sidebar_layout.sql +0 -16
- package/dist/src/storage/sqlite/migrations/187_cli_connectors.sql +0 -34
- package/dist/src/storage/sqlite/migrations/188_scene_storage.sql +0 -2
- package/dist/src/storage/sqlite/migrations/189_scene_source_health.sql +0 -8
- package/dist/src/storage/sqlite/migrations/190_scene_development.sql +0 -37
- package/dist/src/storage/sqlite/migrations/191_scene_task_follow_up.sql +0 -27
- package/dist/src/storage/sqlite/migrations/192_capability_operations.sql +0 -20
- package/dist/src/storage/sqlite/migrations/193_note_file_cleanup.sql +0 -8
- package/dist/src/storage/sqlite/migrations/194_capability_external_outcomes.sql +0 -11
- package/dist/src/storage/sqlite/migrations/195_automation_deleted_revisions.sql +0 -4
- package/dist/src/storage/sqlite/migrations/196_automation_run_requests.sql +0 -23
- package/dist/src/storage/sqlite/migrations/197_note_deletion_cleanup.sql +0 -8
- package/dist/src/storage/sqlite/migrations/198_project_workspace_creation.sql +0 -7
- package/dist/src/storage/sqlite/migrations/199_scene_resource_events.sql +0 -488
- package/dist/src/storage/sqlite/migrations/200_connected_work_threads.sql +0 -92
- package/dist/src/storage/sqlite/migrations/201_connector_extraction_audit.sql +0 -127
- package/dist/src/storage/sqlite/migrations/202_chat_previews.sql +0 -26
- package/dist/src/storage/sqlite/migrations/203_remove_retired_proactive_contracts.sql +0 -70
- package/dist/src/storage/sqlite/migrations/204_home_intelligence.sql +0 -78
- package/dist/src/storage/sqlite/migrations/205_agent_catalog.sql +0 -66
- package/dist/src/storage/sqlite/migrations/206_home_advice_strategy_version.sql +0 -3
- package/dist/src/storage/sqlite/migrations/207_user_model_policy_contract.sql +0 -121
- package/dist/src/storage/sqlite/migrations/208_automation_management.sql +0 -2
- package/dist/src/storage/sqlite/migrations/209_automation_event_hub.sql +0 -48
- package/dist/src/storage/sqlite/migrations/210_remove_legacy_automation_timeout.sql +0 -14
- package/dist/src/storage/sqlite/migrations/211_automation_result_deliveries.sql +0 -16
- package/dist/src/storage/sqlite/migrations/212_automation_delivery_policy.sql +0 -30
- package/dist/src/storage/sqlite/migrations/213_automation_reliability_contract.sql +0 -188
- package/dist/src/storage/sqlite/migrations/214_ai_usage_ledger.sql +0 -41
- package/dist/src/storage/sqlite/migrations/215_scene_execution_adapters.sql +0 -6
- package/dist/src/storage/sqlite/migrations/216_remove_scene_model_usage.sql +0 -1
- package/dist/src/storage/sqlite/migrations/217_remove_legacy_memory_tables.sql +0 -4
- package/dist/src/storage/sqlite/migrations/conversation-key-decoder.d.ts +0 -8
- package/dist/src/storage/sqlite/migrations/conversation-key-decoder.js +0 -87
- package/dist/src/storage/sqlite/migrations/conversation-uuid.d.ts +0 -8
- package/dist/src/storage/sqlite/migrations/conversation-uuid.js +0 -366
- package/dist/src/storage/sqlite/migrations/scene-reset.d.ts +0 -5
- package/dist/src/storage/sqlite/migrations/scene-reset.js +0 -40
- package/dist/src/storage/sqlite/scenes-schema.d.ts +0 -8
- package/dist/src/storage/sqlite/scenes-schema.js +0 -60
- package/dist/src/storage/sqlite/schemas/notifications.sql +0 -65
- package/dist/src/storage/sqlite/schemas/scenes.sql +0 -205
- package/skills/engineering/design-recurring-work/SKILL.md +0 -75
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
key TEXT PRIMARY KEY,
|
|
3
|
-
value TEXT NOT NULL
|
|
4
|
-
);
|
|
1
|
+
-- Baseline schema v217.
|
|
5
2
|
|
|
6
3
|
CREATE TABLE sessions (
|
|
7
|
-
|
|
4
|
+
"conversation_id" TEXT PRIMARY KEY,
|
|
8
5
|
agent_id TEXT NOT NULL,
|
|
9
|
-
|
|
6
|
+
"active_transcript_id" TEXT NOT NULL UNIQUE,
|
|
10
7
|
status TEXT NOT NULL DEFAULT 'active',
|
|
11
8
|
name TEXT,
|
|
12
9
|
tags_json TEXT NOT NULL DEFAULT '[]',
|
|
@@ -19,7 +16,7 @@ CREATE TABLE sessions (
|
|
|
19
16
|
source_chat_id TEXT NOT NULL DEFAULT '',
|
|
20
17
|
session_type TEXT,
|
|
21
18
|
hidden_from_session_list INTEGER NOT NULL DEFAULT 0,
|
|
22
|
-
|
|
19
|
+
"parent_conversation_id" TEXT,
|
|
23
20
|
workflow_run_id TEXT,
|
|
24
21
|
workflow_definition_id TEXT,
|
|
25
22
|
workflow_agent_id TEXT,
|
|
@@ -35,30 +32,9 @@ CREATE TABLE sessions (
|
|
|
35
32
|
verbose_level TEXT
|
|
36
33
|
, project_id TEXT);
|
|
37
34
|
|
|
38
|
-
CREATE INDEX idx_sessions_agent_updated
|
|
39
|
-
ON sessions(agent_id, updated_at DESC);
|
|
40
|
-
|
|
41
|
-
CREATE INDEX idx_sessions_status
|
|
42
|
-
ON sessions(status);
|
|
43
|
-
|
|
44
|
-
CREATE INDEX idx_sessions_source_channel
|
|
45
|
-
ON sessions(source_channel);
|
|
46
|
-
|
|
47
|
-
CREATE INDEX idx_sessions_last_interaction
|
|
48
|
-
ON sessions(last_interaction_at DESC);
|
|
49
|
-
|
|
50
|
-
CREATE INDEX idx_sessions_type
|
|
51
|
-
ON sessions(session_type);
|
|
52
|
-
|
|
53
|
-
CREATE INDEX idx_sessions_workflow_run
|
|
54
|
-
ON sessions(workflow_run_id);
|
|
55
|
-
|
|
56
|
-
CREATE INDEX idx_sessions_parent
|
|
57
|
-
ON sessions(parent_session_key);
|
|
58
|
-
|
|
59
35
|
CREATE TABLE transcripts (
|
|
60
|
-
|
|
61
|
-
|
|
36
|
+
"transcript_id" TEXT PRIMARY KEY,
|
|
37
|
+
"conversation_id" TEXT NOT NULL,
|
|
62
38
|
status TEXT NOT NULL DEFAULT 'active',
|
|
63
39
|
archive_reason TEXT,
|
|
64
40
|
created_at INTEGER NOT NULL,
|
|
@@ -66,33 +42,16 @@ CREATE TABLE transcripts (
|
|
|
66
42
|
cwd TEXT NOT NULL
|
|
67
43
|
);
|
|
68
44
|
|
|
69
|
-
CREATE INDEX idx_transcripts_session
|
|
70
|
-
ON transcripts(session_key, status);
|
|
71
|
-
|
|
72
45
|
CREATE TABLE transcript_entries (
|
|
73
46
|
entry_id TEXT PRIMARY KEY,
|
|
74
|
-
|
|
47
|
+
"transcript_id" TEXT NOT NULL,
|
|
75
48
|
seq INTEGER NOT NULL,
|
|
76
49
|
entry_kind TEXT NOT NULL,
|
|
77
50
|
role TEXT,
|
|
78
51
|
payload_json TEXT NOT NULL,
|
|
79
52
|
created_at INTEGER NOT NULL,
|
|
80
|
-
UNIQUE(
|
|
81
|
-
FOREIGN KEY (
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
CREATE INDEX idx_entries_session_seq
|
|
85
|
-
ON transcript_entries(session_id, seq);
|
|
86
|
-
|
|
87
|
-
CREATE INDEX idx_entries_kind
|
|
88
|
-
ON transcript_entries(session_id, entry_kind);
|
|
89
|
-
|
|
90
|
-
CREATE VIRTUAL TABLE transcript_fts USING fts5(
|
|
91
|
-
content,
|
|
92
|
-
session_key UNINDEXED,
|
|
93
|
-
session_id UNINDEXED,
|
|
94
|
-
entry_id UNINDEXED,
|
|
95
|
-
tokenize='unicode61'
|
|
53
|
+
UNIQUE("transcript_id", seq),
|
|
54
|
+
FOREIGN KEY ("transcript_id") REFERENCES transcripts("transcript_id")
|
|
96
55
|
);
|
|
97
56
|
|
|
98
57
|
CREATE TABLE automations (
|
|
@@ -107,14 +66,8 @@ CREATE TABLE automations (
|
|
|
107
66
|
created_at_ms INTEGER NOT NULL,
|
|
108
67
|
updated_at_ms INTEGER NOT NULL
|
|
109
68
|
, safety_json TEXT, project_id TEXT, conversation_mode TEXT NOT NULL DEFAULT 'new_session'
|
|
110
|
-
CHECK (conversation_mode IN ('new_session', 'continuous')),
|
|
111
|
-
CHECK
|
|
112
|
-
|
|
113
|
-
CREATE INDEX idx_automations_enabled
|
|
114
|
-
ON automations(enabled, updated_at_ms DESC);
|
|
115
|
-
|
|
116
|
-
CREATE INDEX idx_automations_updated
|
|
117
|
-
ON automations(updated_at_ms DESC);
|
|
69
|
+
CHECK (conversation_mode IN ('new_session', 'continuous')), management_json TEXT
|
|
70
|
+
CHECK(management_json IS NULL OR json_valid(management_json)), delivery_json TEXT);
|
|
118
71
|
|
|
119
72
|
CREATE TABLE automation_runs (
|
|
120
73
|
run_id TEXT PRIMARY KEY,
|
|
@@ -130,20 +83,11 @@ CREATE TABLE automation_runs (
|
|
|
130
83
|
duration_ms INTEGER,
|
|
131
84
|
summary TEXT,
|
|
132
85
|
error TEXT,
|
|
133
|
-
|
|
86
|
+
"conversation_id" TEXT,
|
|
134
87
|
workflow_run_id TEXT,
|
|
135
88
|
model TEXT
|
|
136
89
|
, deadline_at_ms INTEGER, current_phase TEXT, cancel_requested_at_ms INTEGER, cancel_confirmed_at_ms INTEGER, termination_json TEXT, heartbeat_at_ms INTEGER, lease_owner TEXT, lease_expires_at_ms INTEGER, attempt_number INTEGER NOT NULL DEFAULT 1, root_run_id TEXT, read_at_ms INTEGER);
|
|
137
90
|
|
|
138
|
-
CREATE INDEX idx_automation_runs_automation_created
|
|
139
|
-
ON automation_runs(automation_id, created_at_ms DESC);
|
|
140
|
-
|
|
141
|
-
CREATE INDEX idx_automation_runs_created
|
|
142
|
-
ON automation_runs(created_at_ms DESC);
|
|
143
|
-
|
|
144
|
-
CREATE INDEX idx_automation_runs_status_created
|
|
145
|
-
ON automation_runs(status, created_at_ms DESC);
|
|
146
|
-
|
|
147
91
|
CREATE TABLE automation_run_events (
|
|
148
92
|
event_id TEXT PRIMARY KEY,
|
|
149
93
|
run_id TEXT NOT NULL,
|
|
@@ -154,12 +98,6 @@ CREATE TABLE automation_run_events (
|
|
|
154
98
|
created_at_ms INTEGER NOT NULL
|
|
155
99
|
);
|
|
156
100
|
|
|
157
|
-
CREATE INDEX idx_automation_run_events_run_created
|
|
158
|
-
ON automation_run_events(run_id, created_at_ms ASC);
|
|
159
|
-
|
|
160
|
-
CREATE INDEX idx_automation_run_events_automation_created
|
|
161
|
-
ON automation_run_events(automation_id, created_at_ms DESC);
|
|
162
|
-
|
|
163
101
|
CREATE TABLE home_attention_acknowledgements (
|
|
164
102
|
subject_kind TEXT NOT NULL CHECK (subject_kind IN ('automation_run', 'workflow_run')),
|
|
165
103
|
subject_id TEXT NOT NULL,
|
|
@@ -167,9 +105,6 @@ CREATE TABLE home_attention_acknowledgements (
|
|
|
167
105
|
PRIMARY KEY (subject_kind, subject_id)
|
|
168
106
|
);
|
|
169
107
|
|
|
170
|
-
CREATE INDEX idx_home_attention_acknowledged_at
|
|
171
|
-
ON home_attention_acknowledgements(acknowledged_at DESC);
|
|
172
|
-
|
|
173
108
|
CREATE TABLE notes (
|
|
174
109
|
note_id TEXT PRIMARY KEY,
|
|
175
110
|
title TEXT,
|
|
@@ -195,15 +130,6 @@ CREATE TABLE notes (
|
|
|
195
130
|
link_count INTEGER
|
|
196
131
|
);
|
|
197
132
|
|
|
198
|
-
CREATE INDEX idx_notes_status_updated
|
|
199
|
-
ON notes(status, updated_at DESC);
|
|
200
|
-
|
|
201
|
-
CREATE INDEX idx_notes_kind
|
|
202
|
-
ON notes(kind);
|
|
203
|
-
|
|
204
|
-
CREATE INDEX idx_notes_group
|
|
205
|
-
ON notes(group_id);
|
|
206
|
-
|
|
207
133
|
CREATE TABLE note_agent_contexts (
|
|
208
134
|
note_id TEXT PRIMARY KEY,
|
|
209
135
|
note_updated_at INTEGER NOT NULL,
|
|
@@ -212,9 +138,6 @@ CREATE TABLE note_agent_contexts (
|
|
|
212
138
|
payload_json TEXT NOT NULL
|
|
213
139
|
);
|
|
214
140
|
|
|
215
|
-
CREATE INDEX idx_note_agent_contexts_generated
|
|
216
|
-
ON note_agent_contexts(generated_at DESC);
|
|
217
|
-
|
|
218
141
|
CREATE VIRTUAL TABLE notes_fts USING fts5(
|
|
219
142
|
content,
|
|
220
143
|
note_id UNINDEXED,
|
|
@@ -236,12 +159,6 @@ CREATE TABLE activity_events (
|
|
|
236
159
|
created_at INTEGER NOT NULL
|
|
237
160
|
);
|
|
238
161
|
|
|
239
|
-
CREATE INDEX idx_activity_events_created
|
|
240
|
-
ON activity_events(created_at DESC);
|
|
241
|
-
|
|
242
|
-
CREATE INDEX idx_activity_events_object_created
|
|
243
|
-
ON activity_events(primary_object_kind, primary_object_id, created_at DESC);
|
|
244
|
-
|
|
245
162
|
CREATE TABLE activity_scopes (
|
|
246
163
|
activity_id TEXT NOT NULL,
|
|
247
164
|
scope_kind TEXT NOT NULL,
|
|
@@ -250,9 +167,6 @@ CREATE TABLE activity_scopes (
|
|
|
250
167
|
PRIMARY KEY (activity_id, scope_kind, scope_id, reason)
|
|
251
168
|
);
|
|
252
169
|
|
|
253
|
-
CREATE INDEX idx_activity_scopes_scope
|
|
254
|
-
ON activity_scopes(scope_kind, scope_id, activity_id);
|
|
255
|
-
|
|
256
170
|
CREATE TABLE object_links (
|
|
257
171
|
id TEXT PRIMARY KEY,
|
|
258
172
|
from_kind TEXT NOT NULL,
|
|
@@ -266,12 +180,6 @@ CREATE TABLE object_links (
|
|
|
266
180
|
created_at INTEGER NOT NULL
|
|
267
181
|
);
|
|
268
182
|
|
|
269
|
-
CREATE INDEX idx_object_links_from
|
|
270
|
-
ON object_links(from_kind, from_id);
|
|
271
|
-
|
|
272
|
-
CREATE INDEX idx_object_links_to
|
|
273
|
-
ON object_links(to_kind, to_id);
|
|
274
|
-
|
|
275
183
|
CREATE TABLE activity_related_projects (
|
|
276
184
|
activity_id TEXT NOT NULL,
|
|
277
185
|
project_id TEXT NOT NULL,
|
|
@@ -281,9 +189,6 @@ CREATE TABLE activity_related_projects (
|
|
|
281
189
|
PRIMARY KEY (activity_id, project_id, reason)
|
|
282
190
|
);
|
|
283
191
|
|
|
284
|
-
CREATE INDEX idx_activity_related_projects_project
|
|
285
|
-
ON activity_related_projects(project_id, activity_id);
|
|
286
|
-
|
|
287
192
|
CREATE TABLE browser_automations (
|
|
288
193
|
automation_id TEXT PRIMARY KEY,
|
|
289
194
|
revision INTEGER NOT NULL,
|
|
@@ -309,9 +214,6 @@ CREATE TABLE browser_automation_runs (
|
|
|
309
214
|
FOREIGN KEY (automation_id) REFERENCES browser_automations(automation_id) ON DELETE CASCADE
|
|
310
215
|
);
|
|
311
216
|
|
|
312
|
-
CREATE INDEX idx_browser_automation_runs_automation_created
|
|
313
|
-
ON browser_automation_runs(automation_id, created_at_ms DESC);
|
|
314
|
-
|
|
315
217
|
CREATE TABLE browser_action_audit (
|
|
316
218
|
event_id TEXT PRIMARY KEY,
|
|
317
219
|
run_id TEXT NOT NULL,
|
|
@@ -323,9 +225,6 @@ CREATE TABLE browser_action_audit (
|
|
|
323
225
|
FOREIGN KEY (run_id) REFERENCES browser_automation_runs(run_id) ON DELETE CASCADE
|
|
324
226
|
);
|
|
325
227
|
|
|
326
|
-
CREATE INDEX idx_browser_action_audit_run_seq
|
|
327
|
-
ON browser_action_audit(run_id, seq ASC);
|
|
328
|
-
|
|
329
228
|
CREATE TABLE projects (
|
|
330
229
|
project_id TEXT PRIMARY KEY,
|
|
331
230
|
name TEXT NOT NULL,
|
|
@@ -342,31 +241,12 @@ CREATE TABLE projects (
|
|
|
342
241
|
CHECK (health IN ('unknown', 'on_track', 'at_risk', 'off_track')), owner_id TEXT, target_at INTEGER, version INTEGER NOT NULL DEFAULT 1, execution_mode TEXT NOT NULL DEFAULT 'local_checkout'
|
|
343
242
|
CHECK (execution_mode IN ('local_checkout', 'managed_worktree')));
|
|
344
243
|
|
|
345
|
-
CREATE INDEX idx_projects_status
|
|
346
|
-
ON projects(status, updated_at DESC);
|
|
347
|
-
|
|
348
|
-
CREATE INDEX idx_projects_slug
|
|
349
|
-
ON projects(slug);
|
|
350
|
-
|
|
351
|
-
CREATE INDEX idx_projects_updated
|
|
352
|
-
ON projects(updated_at DESC);
|
|
353
|
-
|
|
354
|
-
CREATE INDEX idx_sessions_project
|
|
355
|
-
ON sessions(project_id, updated_at DESC);
|
|
356
|
-
|
|
357
|
-
CREATE INDEX idx_automations_project
|
|
358
|
-
ON automations(project_id, updated_at_ms DESC);
|
|
359
|
-
|
|
360
244
|
CREATE VIRTUAL TABLE projects_fts USING fts5(
|
|
361
245
|
content,
|
|
362
246
|
project_id UNINDEXED,
|
|
363
247
|
tokenize='unicode61'
|
|
364
248
|
);
|
|
365
249
|
|
|
366
|
-
CREATE INDEX idx_projects_pinned
|
|
367
|
-
ON projects(pinned_at DESC)
|
|
368
|
-
WHERE pinned_at IS NOT NULL;
|
|
369
|
-
|
|
370
250
|
CREATE TABLE knowledge_sync_runs (
|
|
371
251
|
run_id TEXT PRIMARY KEY,
|
|
372
252
|
source_instance_id TEXT NOT NULL,
|
|
@@ -380,13 +260,7 @@ CREATE TABLE knowledge_sync_runs (
|
|
|
380
260
|
error TEXT,
|
|
381
261
|
started_at INTEGER NOT NULL,
|
|
382
262
|
finished_at INTEGER
|
|
383
|
-
);
|
|
384
|
-
|
|
385
|
-
CREATE INDEX idx_knowledge_sync_runs_source_started
|
|
386
|
-
ON knowledge_sync_runs(source_instance_id, started_at DESC);
|
|
387
|
-
|
|
388
|
-
CREATE INDEX idx_knowledge_sync_runs_status_started
|
|
389
|
-
ON knowledge_sync_runs(status, started_at DESC);
|
|
263
|
+
, collection_scope TEXT);
|
|
390
264
|
|
|
391
265
|
CREATE TABLE connector_catalog_entries (
|
|
392
266
|
connector_id TEXT PRIMARY KEY,
|
|
@@ -396,9 +270,6 @@ CREATE TABLE connector_catalog_entries (
|
|
|
396
270
|
expires_at TEXT
|
|
397
271
|
);
|
|
398
272
|
|
|
399
|
-
CREATE INDEX idx_connector_catalog_provider
|
|
400
|
-
ON connector_catalog_entries(provider, fetched_at DESC);
|
|
401
|
-
|
|
402
273
|
CREATE TABLE connector_installations (
|
|
403
274
|
id TEXT PRIMARY KEY,
|
|
404
275
|
connector_id TEXT NOT NULL,
|
|
@@ -408,43 +279,12 @@ CREATE TABLE connector_installations (
|
|
|
408
279
|
max_scope TEXT NOT NULL DEFAULT 'read' CHECK (max_scope IN ('read', 'write', 'admin')),
|
|
409
280
|
confirmation_policy TEXT NOT NULL DEFAULT 'writes'
|
|
410
281
|
CHECK (confirmation_policy IN ('always', 'writes', 'admin', 'never')),
|
|
411
|
-
|
|
282
|
+
selected_account_ids_json TEXT NOT NULL DEFAULT '[]',
|
|
412
283
|
created_at TEXT NOT NULL,
|
|
413
284
|
updated_at TEXT NOT NULL,
|
|
414
285
|
UNIQUE(connector_id, principal_id)
|
|
415
286
|
);
|
|
416
287
|
|
|
417
|
-
CREATE INDEX idx_connector_installations_principal
|
|
418
|
-
ON connector_installations(principal_id, enabled, connector_id);
|
|
419
|
-
|
|
420
|
-
CREATE TABLE connector_connections (
|
|
421
|
-
id TEXT PRIMARY KEY,
|
|
422
|
-
installation_id TEXT REFERENCES connector_installations(id) ON DELETE SET NULL,
|
|
423
|
-
connector_id TEXT NOT NULL,
|
|
424
|
-
provider TEXT NOT NULL,
|
|
425
|
-
principal_id TEXT NOT NULL,
|
|
426
|
-
provider_connection_id TEXT NOT NULL,
|
|
427
|
-
alias TEXT,
|
|
428
|
-
identity_json TEXT NOT NULL DEFAULT '{}',
|
|
429
|
-
status TEXT NOT NULL DEFAULT 'unknown'
|
|
430
|
-
CHECK (status IN ('pending', 'active', 'expired', 'failed', 'revoked', 'disabled', 'unknown')),
|
|
431
|
-
is_default INTEGER NOT NULL DEFAULT 0 CHECK (is_default IN (0, 1)),
|
|
432
|
-
connected_at TEXT,
|
|
433
|
-
expires_at TEXT,
|
|
434
|
-
last_error TEXT,
|
|
435
|
-
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
436
|
-
created_at TEXT NOT NULL,
|
|
437
|
-
updated_at TEXT NOT NULL, account_id TEXT REFERENCES connector_accounts(id) ON DELETE CASCADE,
|
|
438
|
-
UNIQUE(provider, provider_connection_id)
|
|
439
|
-
);
|
|
440
|
-
|
|
441
|
-
CREATE INDEX idx_connector_connections_principal
|
|
442
|
-
ON connector_connections(principal_id, connector_id, status);
|
|
443
|
-
|
|
444
|
-
CREATE UNIQUE INDEX idx_connector_connections_default
|
|
445
|
-
ON connector_connections(principal_id, connector_id)
|
|
446
|
-
WHERE is_default = 1;
|
|
447
|
-
|
|
448
288
|
CREATE TABLE connector_action_metadata (
|
|
449
289
|
connector_id TEXT NOT NULL,
|
|
450
290
|
action_id TEXT NOT NULL,
|
|
@@ -457,9 +297,6 @@ CREATE TABLE connector_action_metadata (
|
|
|
457
297
|
PRIMARY KEY(connector_id, action_id)
|
|
458
298
|
);
|
|
459
299
|
|
|
460
|
-
CREATE INDEX idx_connector_action_scope
|
|
461
|
-
ON connector_action_metadata(connector_id, scope, curated);
|
|
462
|
-
|
|
463
300
|
CREATE TABLE connector_execution_audit (
|
|
464
301
|
id TEXT PRIMARY KEY,
|
|
465
302
|
installation_id TEXT REFERENCES connector_installations(id) ON DELETE SET NULL,
|
|
@@ -467,7 +304,7 @@ CREATE TABLE connector_execution_audit (
|
|
|
467
304
|
connector_id TEXT NOT NULL,
|
|
468
305
|
principal_id TEXT NOT NULL,
|
|
469
306
|
agent_id TEXT,
|
|
470
|
-
|
|
307
|
+
"conversation_id" TEXT,
|
|
471
308
|
action_id TEXT NOT NULL,
|
|
472
309
|
scope TEXT NOT NULL CHECK (scope IN ('read', 'write', 'admin')),
|
|
473
310
|
decision TEXT NOT NULL CHECK (decision IN ('allowed', 'denied', 'confirmation_required')),
|
|
@@ -477,19 +314,13 @@ CREATE TABLE connector_execution_audit (
|
|
|
477
314
|
created_at TEXT NOT NULL
|
|
478
315
|
);
|
|
479
316
|
|
|
480
|
-
CREATE INDEX idx_connector_audit_principal_time
|
|
481
|
-
ON connector_execution_audit(principal_id, created_at DESC);
|
|
482
|
-
|
|
483
|
-
CREATE INDEX idx_connector_audit_connector_time
|
|
484
|
-
ON connector_execution_audit(connector_id, created_at DESC);
|
|
485
|
-
|
|
486
317
|
CREATE TABLE connector_approvals (
|
|
487
318
|
id TEXT PRIMARY KEY,
|
|
488
319
|
principal_id TEXT NOT NULL,
|
|
489
320
|
connector_id TEXT NOT NULL,
|
|
490
321
|
connection_id TEXT REFERENCES connector_connections(id) ON DELETE SET NULL,
|
|
491
322
|
agent_id TEXT,
|
|
492
|
-
|
|
323
|
+
"conversation_id" TEXT,
|
|
493
324
|
action_id TEXT NOT NULL,
|
|
494
325
|
scope TEXT NOT NULL CHECK (scope IN ('read', 'write', 'admin')),
|
|
495
326
|
arguments_hash TEXT NOT NULL,
|
|
@@ -500,13 +331,7 @@ CREATE TABLE connector_approvals (
|
|
|
500
331
|
created_at TEXT NOT NULL,
|
|
501
332
|
decided_at TEXT,
|
|
502
333
|
consumed_at TEXT
|
|
503
|
-
);
|
|
504
|
-
|
|
505
|
-
CREATE INDEX idx_connector_approvals_pending
|
|
506
|
-
ON connector_approvals(principal_id, status, expires_at, created_at DESC);
|
|
507
|
-
|
|
508
|
-
CREATE INDEX idx_connector_approvals_session
|
|
509
|
-
ON connector_approvals(session_key, status, created_at DESC);
|
|
334
|
+
, wait_id TEXT);
|
|
510
335
|
|
|
511
336
|
CREATE TABLE connector_webhook_deliveries (
|
|
512
337
|
id TEXT PRIMARY KEY,
|
|
@@ -521,9 +346,6 @@ CREATE TABLE connector_webhook_deliveries (
|
|
|
521
346
|
last_error TEXT
|
|
522
347
|
);
|
|
523
348
|
|
|
524
|
-
CREATE INDEX idx_connector_webhook_deliveries_status
|
|
525
|
-
ON connector_webhook_deliveries(provider, status, received_at DESC);
|
|
526
|
-
|
|
527
349
|
CREATE TABLE "user_trust_policies" (
|
|
528
350
|
principal_id TEXT PRIMARY KEY,
|
|
529
351
|
default_action_level TEXT NOT NULL DEFAULT 'confirm'
|
|
@@ -558,10 +380,6 @@ CREATE TABLE local_apps (
|
|
|
558
380
|
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE CASCADE
|
|
559
381
|
);
|
|
560
382
|
|
|
561
|
-
CREATE INDEX idx_local_apps_updated_at ON local_apps(updated_at DESC);
|
|
562
|
-
|
|
563
|
-
CREATE INDEX idx_local_apps_status ON local_apps(status, updated_at DESC);
|
|
564
|
-
|
|
565
383
|
CREATE TABLE local_app_releases (
|
|
566
384
|
release_id TEXT PRIMARY KEY,
|
|
567
385
|
app_id TEXT NOT NULL,
|
|
@@ -573,11 +391,6 @@ CREATE TABLE local_app_releases (
|
|
|
573
391
|
FOREIGN KEY (app_id) REFERENCES local_apps(app_id) ON DELETE CASCADE
|
|
574
392
|
);
|
|
575
393
|
|
|
576
|
-
CREATE INDEX idx_local_app_releases_app ON local_app_releases(app_id, version DESC);
|
|
577
|
-
|
|
578
|
-
CREATE INDEX idx_local_app_releases_created
|
|
579
|
-
ON local_app_releases(app_id, created_at DESC);
|
|
580
|
-
|
|
581
394
|
CREATE TABLE work_discovery_onboarding (
|
|
582
395
|
singleton_id INTEGER PRIMARY KEY CHECK (singleton_id = 1),
|
|
583
396
|
status TEXT NOT NULL CHECK (status IN ('not_started', 'in_progress', 'completed', 'dismissed')),
|
|
@@ -598,12 +411,6 @@ CREATE TABLE local_app_acceptance_runs (
|
|
|
598
411
|
FOREIGN KEY (app_id) REFERENCES local_apps(app_id) ON DELETE CASCADE
|
|
599
412
|
);
|
|
600
413
|
|
|
601
|
-
CREATE INDEX idx_local_app_acceptance_runs_app_created
|
|
602
|
-
ON local_app_acceptance_runs(app_id, created_at DESC);
|
|
603
|
-
|
|
604
|
-
CREATE INDEX idx_local_app_acceptance_runs_source
|
|
605
|
-
ON local_app_acceptance_runs(app_id, source_hash, created_at DESC);
|
|
606
|
-
|
|
607
414
|
CREATE TABLE "work_discovery_runs" (
|
|
608
415
|
id TEXT PRIMARY KEY,
|
|
609
416
|
idempotency_key TEXT NOT NULL UNIQUE,
|
|
@@ -612,7 +419,7 @@ CREATE TABLE "work_discovery_runs" (
|
|
|
612
419
|
stage TEXT CHECK (stage IS NULL OR stage IN ('folder_structure', 'recent_progress', 'next_steps')),
|
|
613
420
|
root_path TEXT NOT NULL,
|
|
614
421
|
project_id TEXT NOT NULL,
|
|
615
|
-
|
|
422
|
+
"conversation_id" TEXT NOT NULL,
|
|
616
423
|
agent_id TEXT NOT NULL,
|
|
617
424
|
model_ref TEXT NOT NULL,
|
|
618
425
|
scan_policy_version INTEGER NOT NULL,
|
|
@@ -623,17 +430,12 @@ CREATE TABLE "work_discovery_runs" (
|
|
|
623
430
|
created_at INTEGER NOT NULL,
|
|
624
431
|
started_at INTEGER,
|
|
625
432
|
completed_at INTEGER,
|
|
626
|
-
canceled_at INTEGER,
|
|
433
|
+
canceled_at INTEGER, mode TEXT NOT NULL DEFAULT 'interactive'
|
|
434
|
+
CHECK (mode IN ('interactive', 'background')), attempts INTEGER NOT NULL DEFAULT 0,
|
|
627
435
|
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE CASCADE,
|
|
628
|
-
FOREIGN KEY (
|
|
436
|
+
FOREIGN KEY ("conversation_id") REFERENCES sessions("conversation_id") ON DELETE CASCADE
|
|
629
437
|
);
|
|
630
438
|
|
|
631
|
-
CREATE INDEX idx_work_discovery_runs_status_created
|
|
632
|
-
ON work_discovery_runs(status, created_at DESC);
|
|
633
|
-
|
|
634
|
-
CREATE INDEX idx_work_discovery_runs_project
|
|
635
|
-
ON work_discovery_runs(project_id, created_at DESC);
|
|
636
|
-
|
|
637
439
|
CREATE TABLE extension_ui_grants (
|
|
638
440
|
extension_id TEXT NOT NULL,
|
|
639
441
|
app_id TEXT,
|
|
@@ -645,9 +447,6 @@ CREATE TABLE extension_ui_grants (
|
|
|
645
447
|
FOREIGN KEY (app_id) REFERENCES local_apps(app_id) ON DELETE CASCADE
|
|
646
448
|
);
|
|
647
449
|
|
|
648
|
-
CREATE INDEX idx_extension_ui_grants_app_granted
|
|
649
|
-
ON extension_ui_grants(app_id, granted_at DESC);
|
|
650
|
-
|
|
651
450
|
CREATE TABLE work_discovery_feedback (
|
|
652
451
|
run_id TEXT PRIMARY KEY,
|
|
653
452
|
recognition_decision TEXT NOT NULL CHECK (
|
|
@@ -659,9 +458,6 @@ CREATE TABLE work_discovery_feedback (
|
|
|
659
458
|
FOREIGN KEY (run_id) REFERENCES work_discovery_runs(id) ON DELETE CASCADE
|
|
660
459
|
);
|
|
661
460
|
|
|
662
|
-
CREATE INDEX idx_work_discovery_feedback_updated
|
|
663
|
-
ON work_discovery_feedback(updated_at DESC);
|
|
664
|
-
|
|
665
461
|
CREATE TABLE work_understanding_investigations (
|
|
666
462
|
investigation_id TEXT PRIMARY KEY,
|
|
667
463
|
discovery_run_id TEXT NOT NULL UNIQUE,
|
|
@@ -678,19 +474,8 @@ CREATE TABLE work_understanding_investigations (
|
|
|
678
474
|
FOREIGN KEY (discovery_run_id) REFERENCES work_discovery_runs(id) ON DELETE CASCADE
|
|
679
475
|
);
|
|
680
476
|
|
|
681
|
-
CREATE TABLE relationship_settings (
|
|
682
|
-
owner_id TEXT PRIMARY KEY CHECK (owner_id = 'local-owner'),
|
|
683
|
-
support_mode TEXT NOT NULL CHECK (support_mode IN ('efficient', 'coach', 'companion', 'auto')),
|
|
684
|
-
proactive_enabled INTEGER NOT NULL CHECK (proactive_enabled IN (0, 1)),
|
|
685
|
-
quiet_start TEXT,
|
|
686
|
-
quiet_end TEXT,
|
|
687
|
-
allowed_topics_json TEXT NOT NULL,
|
|
688
|
-
blocked_topics_json TEXT NOT NULL,
|
|
689
|
-
updated_at INTEGER NOT NULL
|
|
690
|
-
);
|
|
691
|
-
|
|
692
477
|
CREATE TABLE interaction_states (
|
|
693
|
-
|
|
478
|
+
"conversation_id" TEXT PRIMARY KEY REFERENCES sessions("conversation_id") ON DELETE CASCADE,
|
|
694
479
|
support_need TEXT NOT NULL CHECK (support_need IN ('listen', 'clarify', 'advise', 'act', 'unknown')),
|
|
695
480
|
emotion_hypothesis TEXT,
|
|
696
481
|
confidence REAL NOT NULL CHECK (confidence >= 0 AND confidence <= 1),
|
|
@@ -707,9 +492,6 @@ CREATE TABLE composer_input_history (
|
|
|
707
492
|
created_at INTEGER NOT NULL
|
|
708
493
|
);
|
|
709
494
|
|
|
710
|
-
CREATE INDEX idx_composer_input_history_recent
|
|
711
|
-
ON composer_input_history(id DESC);
|
|
712
|
-
|
|
713
495
|
CREATE TABLE connector_learning_jobs (
|
|
714
496
|
job_id TEXT PRIMARY KEY,
|
|
715
497
|
idempotency_key TEXT NOT NULL UNIQUE,
|
|
@@ -733,12 +515,6 @@ CREATE TABLE connector_learning_jobs (
|
|
|
733
515
|
FOREIGN KEY(connection_id) REFERENCES connector_connections(id) ON DELETE CASCADE
|
|
734
516
|
);
|
|
735
517
|
|
|
736
|
-
CREATE INDEX idx_connector_learning_jobs_due
|
|
737
|
-
ON connector_learning_jobs(status, next_run_at, created_at);
|
|
738
|
-
|
|
739
|
-
CREATE INDEX idx_connector_learning_jobs_source
|
|
740
|
-
ON connector_learning_jobs(source_instance_id, created_at DESC);
|
|
741
|
-
|
|
742
518
|
CREATE TABLE knowledge_collection_state (
|
|
743
519
|
source_instance_id TEXT NOT NULL,
|
|
744
520
|
collection_scope TEXT NOT NULL,
|
|
@@ -775,21 +551,6 @@ CREATE TABLE "knowledge_source_items" (
|
|
|
775
551
|
UNIQUE(source_instance_id, collection_scope, external_id)
|
|
776
552
|
);
|
|
777
553
|
|
|
778
|
-
CREATE INDEX idx_knowledge_source_items_source_updated
|
|
779
|
-
ON knowledge_source_items(source_instance_id, updated_at DESC);
|
|
780
|
-
|
|
781
|
-
CREATE INDEX idx_knowledge_source_items_synthesis
|
|
782
|
-
ON knowledge_source_items(synthesis_status, updated_at);
|
|
783
|
-
|
|
784
|
-
CREATE INDEX idx_knowledge_source_items_hash
|
|
785
|
-
ON knowledge_source_items(content_hash);
|
|
786
|
-
|
|
787
|
-
CREATE INDEX idx_knowledge_source_items_synthesis_lease
|
|
788
|
-
ON knowledge_source_items(synthesis_pipeline, synthesis_status, synthesis_claimed_at, updated_at);
|
|
789
|
-
|
|
790
|
-
CREATE INDEX idx_knowledge_source_items_collection
|
|
791
|
-
ON knowledge_source_items(source_instance_id, collection_scope, updated_at DESC);
|
|
792
|
-
|
|
793
554
|
CREATE TABLE knowledge_source_changes (
|
|
794
555
|
sequence INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
795
556
|
change_id TEXT NOT NULL UNIQUE,
|
|
@@ -802,305 +563,40 @@ CREATE TABLE knowledge_source_changes (
|
|
|
802
563
|
FOREIGN KEY(source_item_id) REFERENCES knowledge_source_items(item_id) ON DELETE CASCADE
|
|
803
564
|
);
|
|
804
565
|
|
|
805
|
-
CREATE
|
|
806
|
-
|
|
566
|
+
CREATE TABLE discussion_capture_settings (
|
|
567
|
+
workspace_id TEXT PRIMARY KEY,
|
|
568
|
+
consent_policy_version INTEGER NOT NULL,
|
|
569
|
+
consent_acknowledged_at INTEGER,
|
|
570
|
+
updated_at INTEGER NOT NULL
|
|
571
|
+
);
|
|
807
572
|
|
|
808
|
-
CREATE
|
|
809
|
-
|
|
573
|
+
CREATE TABLE session_task_plans (
|
|
574
|
+
"transcript_id" TEXT NOT NULL,
|
|
575
|
+
plan_id TEXT NOT NULL,
|
|
576
|
+
items_json TEXT NOT NULL,
|
|
577
|
+
revision INTEGER NOT NULL DEFAULT 1,
|
|
578
|
+
updated_at INTEGER NOT NULL,
|
|
579
|
+
PRIMARY KEY ("transcript_id", plan_id),
|
|
580
|
+
FOREIGN KEY ("transcript_id") REFERENCES transcripts("transcript_id") ON DELETE CASCADE
|
|
581
|
+
);
|
|
810
582
|
|
|
811
|
-
CREATE TABLE
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
device_id TEXT,
|
|
818
|
-
subject_kind TEXT NOT NULL,
|
|
819
|
-
subject_id TEXT NOT NULL,
|
|
820
|
-
actor_kind TEXT NOT NULL CHECK (actor_kind IN ('user', 'agent', 'system', 'integration')),
|
|
821
|
-
actor_id TEXT,
|
|
822
|
-
workspace_id TEXT NOT NULL,
|
|
823
|
-
project_id TEXT,
|
|
824
|
-
agent_id TEXT,
|
|
825
|
-
occurred_at TEXT NOT NULL,
|
|
826
|
-
observed_at TEXT NOT NULL,
|
|
827
|
-
correlation_id TEXT NOT NULL,
|
|
828
|
-
causation_id TEXT,
|
|
829
|
-
dedupe_key TEXT NOT NULL UNIQUE,
|
|
830
|
-
sensitivity TEXT NOT NULL CHECK (sensitivity IN ('public', 'personal', 'confidential', 'restricted')),
|
|
831
|
-
payload_json TEXT NOT NULL,
|
|
832
|
-
routed_at TEXT
|
|
583
|
+
CREATE TABLE session_input_runtime (
|
|
584
|
+
"conversation_id" TEXT PRIMARY KEY,
|
|
585
|
+
active_run_id TEXT,
|
|
586
|
+
active_input_id TEXT,
|
|
587
|
+
revision INTEGER NOT NULL DEFAULT 0,
|
|
588
|
+
updated_at_ms INTEGER NOT NULL
|
|
833
589
|
);
|
|
834
590
|
|
|
835
|
-
CREATE TABLE
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
window_ends_at TEXT NOT NULL,
|
|
842
|
-
ready_at TEXT NOT NULL,
|
|
591
|
+
CREATE TABLE discussion_captures (
|
|
592
|
+
id TEXT PRIMARY KEY,
|
|
593
|
+
client_request_id TEXT NOT NULL UNIQUE,
|
|
594
|
+
note_id TEXT NOT NULL UNIQUE,
|
|
595
|
+
project_id TEXT,
|
|
596
|
+
audio_attachment_id TEXT,
|
|
843
597
|
status TEXT NOT NULL CHECK (status IN (
|
|
844
|
-
'
|
|
845
|
-
'
|
|
846
|
-
)),
|
|
847
|
-
event_count INTEGER NOT NULL DEFAULT 0 CHECK (event_count >= 0),
|
|
848
|
-
created_at TEXT NOT NULL,
|
|
849
|
-
updated_at TEXT NOT NULL
|
|
850
|
-
, subscription_id TEXT NOT NULL DEFAULT '');
|
|
851
|
-
|
|
852
|
-
CREATE TABLE proactive_batch_events (
|
|
853
|
-
batch_id TEXT NOT NULL,
|
|
854
|
-
event_id TEXT NOT NULL,
|
|
855
|
-
added_at TEXT NOT NULL,
|
|
856
|
-
PRIMARY KEY (batch_id, event_id),
|
|
857
|
-
FOREIGN KEY (batch_id) REFERENCES proactive_signal_batches(batch_id) ON DELETE CASCADE,
|
|
858
|
-
FOREIGN KEY (event_id) REFERENCES proactive_events(event_id) ON DELETE CASCADE
|
|
859
|
-
);
|
|
860
|
-
|
|
861
|
-
CREATE INDEX idx_proactive_events_type_observed
|
|
862
|
-
ON proactive_events(type, observed_at DESC);
|
|
863
|
-
|
|
864
|
-
CREATE INDEX idx_proactive_events_subject
|
|
865
|
-
ON proactive_events(subject_kind, subject_id, occurred_at DESC);
|
|
866
|
-
|
|
867
|
-
CREATE INDEX idx_proactive_events_project
|
|
868
|
-
ON proactive_events(project_id, occurred_at DESC) WHERE project_id IS NOT NULL;
|
|
869
|
-
|
|
870
|
-
CREATE INDEX idx_proactive_events_correlation
|
|
871
|
-
ON proactive_events(correlation_id);
|
|
872
|
-
|
|
873
|
-
CREATE INDEX idx_proactive_batches_ready
|
|
874
|
-
ON proactive_signal_batches(status, ready_at);
|
|
875
|
-
|
|
876
|
-
CREATE TABLE proactive_scenarios (
|
|
877
|
-
scenario_key TEXT PRIMARY KEY,
|
|
878
|
-
version INTEGER NOT NULL CHECK (version > 0),
|
|
879
|
-
title TEXT NOT NULL,
|
|
880
|
-
description TEXT NOT NULL,
|
|
881
|
-
base_prompt TEXT NOT NULL,
|
|
882
|
-
base_template_version INTEGER NOT NULL CHECK (base_template_version > 0),
|
|
883
|
-
event_types_json TEXT NOT NULL,
|
|
884
|
-
condition_json TEXT,
|
|
885
|
-
aggregation TEXT NOT NULL CHECK (aggregation IN ('subject', 'project', 'workspace')),
|
|
886
|
-
debounce_seconds INTEGER NOT NULL CHECK (debounce_seconds >= 0),
|
|
887
|
-
max_window_seconds INTEGER NOT NULL CHECK (max_window_seconds > 0),
|
|
888
|
-
created_at TEXT NOT NULL,
|
|
889
|
-
updated_at TEXT NOT NULL
|
|
890
|
-
, context_provider_ids_json TEXT NOT NULL DEFAULT '["event_batch"]', min_confidence REAL NOT NULL DEFAULT 0.65
|
|
891
|
-
CHECK (min_confidence >= 0 AND min_confidence <= 1), min_value_score REAL NOT NULL DEFAULT 0.6
|
|
892
|
-
CHECK (min_value_score >= 0 AND min_value_score <= 1), cooldown_seconds INTEGER NOT NULL DEFAULT 604800
|
|
893
|
-
CHECK (cooldown_seconds >= 0), max_runs_per_day INTEGER NOT NULL DEFAULT 30
|
|
894
|
-
CHECK (max_runs_per_day > 0));
|
|
895
|
-
|
|
896
|
-
CREATE TABLE proactive_scenario_subscriptions (
|
|
897
|
-
subscription_id TEXT PRIMARY KEY,
|
|
898
|
-
scenario_key TEXT NOT NULL,
|
|
899
|
-
workspace_id TEXT NOT NULL,
|
|
900
|
-
scope_kind TEXT NOT NULL CHECK (scope_kind IN ('workspace', 'project')),
|
|
901
|
-
scope_id TEXT NOT NULL,
|
|
902
|
-
enabled INTEGER NOT NULL DEFAULT 0 CHECK (enabled IN (0, 1)),
|
|
903
|
-
active_prompt_revision_id TEXT,
|
|
904
|
-
created_at TEXT NOT NULL,
|
|
905
|
-
updated_at TEXT NOT NULL,
|
|
906
|
-
UNIQUE (scenario_key, workspace_id, scope_kind, scope_id),
|
|
907
|
-
FOREIGN KEY (scenario_key) REFERENCES proactive_scenarios(scenario_key) ON DELETE CASCADE
|
|
908
|
-
);
|
|
909
|
-
|
|
910
|
-
CREATE TABLE proactive_prompt_revisions (
|
|
911
|
-
revision_id TEXT PRIMARY KEY,
|
|
912
|
-
subscription_id TEXT NOT NULL,
|
|
913
|
-
revision INTEGER NOT NULL CHECK (revision > 0),
|
|
914
|
-
status TEXT NOT NULL CHECK (status IN ('draft', 'published', 'retired')),
|
|
915
|
-
base_template_version INTEGER NOT NULL CHECK (base_template_version > 0),
|
|
916
|
-
user_instructions TEXT NOT NULL,
|
|
917
|
-
content_hash TEXT NOT NULL,
|
|
918
|
-
created_at TEXT NOT NULL,
|
|
919
|
-
published_at TEXT,
|
|
920
|
-
UNIQUE (subscription_id, revision),
|
|
921
|
-
FOREIGN KEY (subscription_id) REFERENCES proactive_scenario_subscriptions(subscription_id) ON DELETE CASCADE
|
|
922
|
-
);
|
|
923
|
-
|
|
924
|
-
CREATE INDEX idx_proactive_subscriptions_enabled
|
|
925
|
-
ON proactive_scenario_subscriptions(enabled, workspace_id, scenario_key);
|
|
926
|
-
|
|
927
|
-
CREATE INDEX idx_proactive_prompt_revisions_subscription
|
|
928
|
-
ON proactive_prompt_revisions(subscription_id, status, revision DESC);
|
|
929
|
-
|
|
930
|
-
CREATE UNIQUE INDEX idx_proactive_collecting_batch
|
|
931
|
-
ON proactive_signal_batches(subscription_id, scenario_key, aggregation_key)
|
|
932
|
-
WHERE status = 'collecting';
|
|
933
|
-
|
|
934
|
-
CREATE TABLE proactive_context_snapshots (
|
|
935
|
-
snapshot_id TEXT PRIMARY KEY,
|
|
936
|
-
batch_id TEXT NOT NULL,
|
|
937
|
-
content_json TEXT NOT NULL,
|
|
938
|
-
evidence_ids_json TEXT NOT NULL,
|
|
939
|
-
created_at TEXT NOT NULL,
|
|
940
|
-
FOREIGN KEY (batch_id) REFERENCES proactive_signal_batches(batch_id) ON DELETE CASCADE
|
|
941
|
-
);
|
|
942
|
-
|
|
943
|
-
CREATE TABLE proactive_runs (
|
|
944
|
-
run_id TEXT PRIMARY KEY,
|
|
945
|
-
batch_id TEXT NOT NULL UNIQUE,
|
|
946
|
-
subscription_id TEXT NOT NULL,
|
|
947
|
-
scenario_key TEXT NOT NULL,
|
|
948
|
-
scenario_version INTEGER NOT NULL,
|
|
949
|
-
prompt_revision_id TEXT,
|
|
950
|
-
context_snapshot_id TEXT,
|
|
951
|
-
status TEXT NOT NULL CHECK (status IN ('running', 'completed', 'discarded', 'retryable', 'failed')),
|
|
952
|
-
attempt INTEGER NOT NULL DEFAULT 1 CHECK (attempt > 0),
|
|
953
|
-
lease_owner TEXT,
|
|
954
|
-
lease_expires_at TEXT,
|
|
955
|
-
model_ref TEXT,
|
|
956
|
-
raw_output TEXT,
|
|
957
|
-
error_message TEXT,
|
|
958
|
-
next_attempt_at TEXT,
|
|
959
|
-
started_at TEXT NOT NULL,
|
|
960
|
-
completed_at TEXT,
|
|
961
|
-
updated_at TEXT NOT NULL, outcome_reason TEXT, policy_revision INTEGER NOT NULL DEFAULT 0, subscription_revision INTEGER NOT NULL DEFAULT 0, policy_snapshot_json TEXT, input_tokens INTEGER, output_tokens INTEGER, estimated_cost_usd REAL,
|
|
962
|
-
FOREIGN KEY (batch_id) REFERENCES proactive_signal_batches(batch_id) ON DELETE CASCADE,
|
|
963
|
-
FOREIGN KEY (subscription_id) REFERENCES proactive_scenario_subscriptions(subscription_id) ON DELETE CASCADE,
|
|
964
|
-
FOREIGN KEY (prompt_revision_id) REFERENCES proactive_prompt_revisions(revision_id),
|
|
965
|
-
FOREIGN KEY (context_snapshot_id) REFERENCES proactive_context_snapshots(snapshot_id)
|
|
966
|
-
);
|
|
967
|
-
|
|
968
|
-
CREATE TABLE proactive_insights (
|
|
969
|
-
insight_id TEXT PRIMARY KEY,
|
|
970
|
-
run_id TEXT NOT NULL UNIQUE,
|
|
971
|
-
subscription_id TEXT NOT NULL,
|
|
972
|
-
scenario_key TEXT NOT NULL,
|
|
973
|
-
title TEXT NOT NULL,
|
|
974
|
-
summary TEXT NOT NULL,
|
|
975
|
-
why_now TEXT NOT NULL,
|
|
976
|
-
impact TEXT NOT NULL,
|
|
977
|
-
recommendation TEXT NOT NULL,
|
|
978
|
-
urgency TEXT NOT NULL CHECK (urgency IN ('low', 'medium', 'high', 'critical')),
|
|
979
|
-
confidence REAL NOT NULL CHECK (confidence >= 0 AND confidence <= 1),
|
|
980
|
-
value_score REAL NOT NULL CHECK (value_score >= 0 AND value_score <= 1),
|
|
981
|
-
evidence_ids_json TEXT NOT NULL,
|
|
982
|
-
created_at TEXT NOT NULL, work_done TEXT NOT NULL DEFAULT '', decision_json TEXT, content_fingerprint TEXT, proposed_action_json TEXT, disposition TEXT
|
|
983
|
-
CHECK (disposition IN ('record_silently', 'show_in_work', 'request_approval', 'auto_execute')), disposition_reason TEXT, action_status TEXT
|
|
984
|
-
CHECK (action_status IN ('not_authorized', 'approval_required', 'pending', 'executing', 'completed', 'rejected', 'failed')), action_result_json TEXT, action_error TEXT, disposition_at TEXT, action_updated_at TEXT, artifact_json TEXT, artifact_edited_at TEXT,
|
|
985
|
-
FOREIGN KEY (run_id) REFERENCES proactive_runs(run_id) ON DELETE CASCADE,
|
|
986
|
-
FOREIGN KEY (subscription_id) REFERENCES proactive_scenario_subscriptions(subscription_id) ON DELETE CASCADE
|
|
987
|
-
);
|
|
988
|
-
|
|
989
|
-
CREATE INDEX idx_proactive_runs_status_lease ON proactive_runs(status, next_attempt_at, lease_expires_at, updated_at);
|
|
990
|
-
|
|
991
|
-
CREATE INDEX idx_proactive_insights_created ON proactive_insights(created_at DESC);
|
|
992
|
-
|
|
993
|
-
CREATE TABLE proactive_inbox_items (
|
|
994
|
-
inbox_item_id TEXT PRIMARY KEY,
|
|
995
|
-
insight_id TEXT NOT NULL UNIQUE,
|
|
996
|
-
status TEXT NOT NULL CHECK (status IN ('unread', 'read', 'snoozed', 'resolved')),
|
|
997
|
-
snoozed_until TEXT,
|
|
998
|
-
resolution TEXT,
|
|
999
|
-
created_at TEXT NOT NULL,
|
|
1000
|
-
updated_at TEXT NOT NULL, revision INTEGER NOT NULL DEFAULT 1, notification_revision INTEGER NOT NULL DEFAULT 1, expires_at TEXT, withdrawn_at TEXT, correlation_key TEXT,
|
|
1001
|
-
FOREIGN KEY (insight_id) REFERENCES proactive_insights(insight_id) ON DELETE CASCADE
|
|
1002
|
-
);
|
|
1003
|
-
|
|
1004
|
-
CREATE TABLE proactive_decisions (
|
|
1005
|
-
decision_id TEXT PRIMARY KEY,
|
|
1006
|
-
inbox_item_id TEXT NOT NULL,
|
|
1007
|
-
choice TEXT NOT NULL,
|
|
1008
|
-
note TEXT NOT NULL,
|
|
1009
|
-
created_at TEXT NOT NULL,
|
|
1010
|
-
FOREIGN KEY (inbox_item_id) REFERENCES proactive_inbox_items(inbox_item_id) ON DELETE CASCADE
|
|
1011
|
-
);
|
|
1012
|
-
|
|
1013
|
-
CREATE TABLE proactive_delivery_outbox (
|
|
1014
|
-
delivery_id TEXT PRIMARY KEY,
|
|
1015
|
-
inbox_item_id TEXT NOT NULL UNIQUE,
|
|
1016
|
-
status TEXT NOT NULL CHECK (status IN ('pending', 'delivering', 'delivered', 'retryable', 'failed')),
|
|
1017
|
-
attempt INTEGER NOT NULL DEFAULT 0 CHECK (attempt >= 0),
|
|
1018
|
-
next_attempt_at TEXT NOT NULL,
|
|
1019
|
-
lease_expires_at TEXT,
|
|
1020
|
-
error_message TEXT,
|
|
1021
|
-
created_at TEXT NOT NULL,
|
|
1022
|
-
delivered_at TEXT,
|
|
1023
|
-
updated_at TEXT NOT NULL,
|
|
1024
|
-
FOREIGN KEY (inbox_item_id) REFERENCES proactive_inbox_items(inbox_item_id) ON DELETE CASCADE
|
|
1025
|
-
);
|
|
1026
|
-
|
|
1027
|
-
CREATE TABLE proactive_feedback (
|
|
1028
|
-
feedback_id TEXT PRIMARY KEY,
|
|
1029
|
-
inbox_item_id TEXT NOT NULL,
|
|
1030
|
-
rating TEXT NOT NULL CHECK (rating IN ('useful', 'not_useful')),
|
|
1031
|
-
note TEXT NOT NULL,
|
|
1032
|
-
created_at TEXT NOT NULL,
|
|
1033
|
-
FOREIGN KEY (inbox_item_id) REFERENCES proactive_inbox_items(inbox_item_id) ON DELETE CASCADE
|
|
1034
|
-
);
|
|
1035
|
-
|
|
1036
|
-
CREATE INDEX idx_proactive_inbox_status ON proactive_inbox_items(status, updated_at DESC);
|
|
1037
|
-
|
|
1038
|
-
CREATE INDEX idx_proactive_outbox_ready ON proactive_delivery_outbox(status, next_attempt_at);
|
|
1039
|
-
|
|
1040
|
-
CREATE TABLE proactive_instruction_feedback (
|
|
1041
|
-
instruction_id TEXT PRIMARY KEY,
|
|
1042
|
-
inbox_item_id TEXT NOT NULL,
|
|
1043
|
-
prompt_revision_id TEXT NOT NULL,
|
|
1044
|
-
instruction TEXT NOT NULL,
|
|
1045
|
-
created_at TEXT NOT NULL,
|
|
1046
|
-
FOREIGN KEY (inbox_item_id) REFERENCES proactive_inbox_items(inbox_item_id) ON DELETE CASCADE,
|
|
1047
|
-
FOREIGN KEY (prompt_revision_id) REFERENCES proactive_prompt_revisions(revision_id)
|
|
1048
|
-
);
|
|
1049
|
-
|
|
1050
|
-
CREATE INDEX idx_proactive_instruction_item ON proactive_instruction_feedback(inbox_item_id, created_at DESC);
|
|
1051
|
-
|
|
1052
|
-
CREATE INDEX idx_proactive_insights_fingerprint
|
|
1053
|
-
ON proactive_insights(subscription_id, scenario_key, content_fingerprint, created_at DESC);
|
|
1054
|
-
|
|
1055
|
-
CREATE TABLE project_monitoring_policies (
|
|
1056
|
-
project_id TEXT PRIMARY KEY,
|
|
1057
|
-
mode TEXT NOT NULL CHECK (mode IN ('observe', 'ask_before_action', 'auto_low_risk')),
|
|
1058
|
-
quiet_hours_json TEXT,
|
|
1059
|
-
allowed_actions_json TEXT NOT NULL DEFAULT '[]',
|
|
1060
|
-
confidence_threshold REAL NOT NULL DEFAULT 0.75 CHECK (confidence_threshold >= 0 AND confidence_threshold <= 1),
|
|
1061
|
-
created_at INTEGER NOT NULL,
|
|
1062
|
-
updated_at INTEGER NOT NULL,
|
|
1063
|
-
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE CASCADE
|
|
1064
|
-
);
|
|
1065
|
-
|
|
1066
|
-
CREATE TABLE discussion_capture_settings (
|
|
1067
|
-
workspace_id TEXT PRIMARY KEY,
|
|
1068
|
-
consent_policy_version INTEGER NOT NULL,
|
|
1069
|
-
consent_acknowledged_at INTEGER,
|
|
1070
|
-
updated_at INTEGER NOT NULL
|
|
1071
|
-
);
|
|
1072
|
-
|
|
1073
|
-
CREATE TABLE session_task_plans (
|
|
1074
|
-
session_id TEXT NOT NULL,
|
|
1075
|
-
plan_id TEXT NOT NULL,
|
|
1076
|
-
items_json TEXT NOT NULL,
|
|
1077
|
-
revision INTEGER NOT NULL DEFAULT 1,
|
|
1078
|
-
updated_at INTEGER NOT NULL,
|
|
1079
|
-
PRIMARY KEY (session_id, plan_id),
|
|
1080
|
-
FOREIGN KEY (session_id) REFERENCES transcripts(session_id) ON DELETE CASCADE
|
|
1081
|
-
);
|
|
1082
|
-
|
|
1083
|
-
CREATE INDEX idx_automation_runs_lease
|
|
1084
|
-
ON automation_runs(status, lease_expires_at_ms);
|
|
1085
|
-
|
|
1086
|
-
CREATE TABLE session_input_runtime (
|
|
1087
|
-
session_key TEXT PRIMARY KEY,
|
|
1088
|
-
active_run_id TEXT,
|
|
1089
|
-
active_input_id TEXT,
|
|
1090
|
-
revision INTEGER NOT NULL DEFAULT 0,
|
|
1091
|
-
updated_at_ms INTEGER NOT NULL
|
|
1092
|
-
);
|
|
1093
|
-
|
|
1094
|
-
CREATE TABLE discussion_captures (
|
|
1095
|
-
id TEXT PRIMARY KEY,
|
|
1096
|
-
client_request_id TEXT NOT NULL UNIQUE,
|
|
1097
|
-
note_id TEXT NOT NULL UNIQUE,
|
|
1098
|
-
project_id TEXT,
|
|
1099
|
-
audio_attachment_id TEXT,
|
|
1100
|
-
source TEXT NOT NULL CHECK (source IN ('web', 'electron')),
|
|
1101
|
-
status TEXT NOT NULL CHECK (status IN (
|
|
1102
|
-
'recording', 'stopping', 'sealing', 'organizing',
|
|
1103
|
-
'completed', 'needs_attention', 'cancelled'
|
|
598
|
+
'recording', 'stopping', 'sealing', 'organizing',
|
|
599
|
+
'completed', 'needs_attention', 'cancelled'
|
|
1104
600
|
)),
|
|
1105
601
|
duration_ms INTEGER,
|
|
1106
602
|
expected_last_sequence INTEGER,
|
|
@@ -1127,17 +623,12 @@ CREATE TABLE discussion_captures (
|
|
|
1127
623
|
created_at INTEGER NOT NULL,
|
|
1128
624
|
updated_at INTEGER NOT NULL,
|
|
1129
625
|
completed_at INTEGER,
|
|
1130
|
-
audio_deleted_at INTEGER,
|
|
626
|
+
audio_deleted_at INTEGER, organization_template TEXT NOT NULL DEFAULT 'general', source TEXT NOT NULL DEFAULT 'web'
|
|
627
|
+
CHECK (source IN ('web', 'electron', 'mobile')),
|
|
1131
628
|
FOREIGN KEY (note_id) REFERENCES notes(note_id) ON DELETE CASCADE,
|
|
1132
629
|
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE SET NULL
|
|
1133
630
|
);
|
|
1134
631
|
|
|
1135
|
-
CREATE INDEX idx_discussion_captures_queue
|
|
1136
|
-
ON discussion_captures(status, work_lease_expires_at, updated_at);
|
|
1137
|
-
|
|
1138
|
-
CREATE INDEX idx_discussion_captures_project
|
|
1139
|
-
ON discussion_captures(project_id, updated_at DESC);
|
|
1140
|
-
|
|
1141
632
|
CREATE TABLE discussion_transcript_segments (
|
|
1142
633
|
discussion_id TEXT NOT NULL,
|
|
1143
634
|
sequence INTEGER NOT NULL,
|
|
@@ -1166,9 +657,6 @@ CREATE TABLE discussion_transcript_segments (
|
|
|
1166
657
|
FOREIGN KEY (discussion_id) REFERENCES discussion_captures(id) ON DELETE CASCADE
|
|
1167
658
|
);
|
|
1168
659
|
|
|
1169
|
-
CREATE INDEX idx_discussion_segments_queue
|
|
1170
|
-
ON discussion_transcript_segments(status, next_attempt_at, created_at);
|
|
1171
|
-
|
|
1172
660
|
CREATE TABLE discussion_organizations (
|
|
1173
661
|
id TEXT PRIMARY KEY,
|
|
1174
662
|
discussion_id TEXT NOT NULL,
|
|
@@ -1180,14 +668,11 @@ CREATE TABLE discussion_organizations (
|
|
|
1180
668
|
status TEXT NOT NULL CHECK (status IN ('running', 'completed', 'failed')),
|
|
1181
669
|
error_message TEXT,
|
|
1182
670
|
created_at INTEGER NOT NULL,
|
|
1183
|
-
completed_at INTEGER,
|
|
671
|
+
completed_at INTEGER, transcript_revision INTEGER NOT NULL DEFAULT 0,
|
|
1184
672
|
UNIQUE (discussion_id, revision),
|
|
1185
673
|
FOREIGN KEY (discussion_id) REFERENCES discussion_captures(id) ON DELETE CASCADE
|
|
1186
674
|
);
|
|
1187
675
|
|
|
1188
|
-
CREATE INDEX idx_discussion_organizations_latest
|
|
1189
|
-
ON discussion_organizations(discussion_id, revision DESC);
|
|
1190
|
-
|
|
1191
676
|
CREATE TABLE project_milestones (
|
|
1192
677
|
milestone_id TEXT PRIMARY KEY,
|
|
1193
678
|
project_id TEXT NOT NULL,
|
|
@@ -1202,9 +687,6 @@ CREATE TABLE project_milestones (
|
|
|
1202
687
|
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE CASCADE
|
|
1203
688
|
);
|
|
1204
689
|
|
|
1205
|
-
CREATE INDEX idx_project_milestones_project_sort
|
|
1206
|
-
ON project_milestones(project_id, sort_order, created_at);
|
|
1207
|
-
|
|
1208
690
|
CREATE TABLE project_updates (
|
|
1209
691
|
update_id TEXT PRIMARY KEY,
|
|
1210
692
|
project_id TEXT NOT NULL,
|
|
@@ -1218,9 +700,6 @@ CREATE TABLE project_updates (
|
|
|
1218
700
|
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE CASCADE
|
|
1219
701
|
);
|
|
1220
702
|
|
|
1221
|
-
CREATE INDEX idx_project_updates_project_created
|
|
1222
|
-
ON project_updates(project_id, created_at DESC);
|
|
1223
|
-
|
|
1224
703
|
CREATE TABLE tasks (
|
|
1225
704
|
task_id TEXT PRIMARY KEY,
|
|
1226
705
|
creation_idempotency_key TEXT,
|
|
@@ -1249,15 +728,6 @@ CREATE TABLE tasks (
|
|
|
1249
728
|
FOREIGN KEY (parent_task_id) REFERENCES tasks(task_id) ON DELETE SET NULL
|
|
1250
729
|
);
|
|
1251
730
|
|
|
1252
|
-
CREATE UNIQUE INDEX idx_tasks_creation_idempotency
|
|
1253
|
-
ON tasks(creation_idempotency_key) WHERE creation_idempotency_key IS NOT NULL;
|
|
1254
|
-
|
|
1255
|
-
CREATE INDEX idx_tasks_project_updated ON tasks(project_id, updated_at DESC);
|
|
1256
|
-
|
|
1257
|
-
CREATE INDEX idx_tasks_phase_updated ON tasks(phase, updated_at DESC);
|
|
1258
|
-
|
|
1259
|
-
CREATE INDEX idx_tasks_parent ON tasks(parent_task_id, updated_at DESC);
|
|
1260
|
-
|
|
1261
731
|
CREATE TABLE task_contracts (
|
|
1262
732
|
task_id TEXT NOT NULL,
|
|
1263
733
|
version INTEGER NOT NULL,
|
|
@@ -1301,25 +771,17 @@ CREATE TABLE task_dependencies (
|
|
|
1301
771
|
FOREIGN KEY (depends_on_task_id) REFERENCES tasks(task_id) ON DELETE CASCADE
|
|
1302
772
|
);
|
|
1303
773
|
|
|
1304
|
-
CREATE INDEX idx_task_dependencies_upstream
|
|
1305
|
-
ON task_dependencies(depends_on_task_id, task_id);
|
|
1306
|
-
|
|
1307
774
|
CREATE TABLE task_sessions (
|
|
1308
775
|
task_session_id TEXT PRIMARY KEY,
|
|
1309
776
|
task_id TEXT NOT NULL,
|
|
1310
|
-
|
|
777
|
+
"conversation_id" TEXT,
|
|
1311
778
|
role TEXT NOT NULL CHECK (role IN ('primary', 'discussion', 'execution')),
|
|
1312
779
|
created_at INTEGER NOT NULL, agent_id TEXT, run_id TEXT, assignment_epoch INTEGER NOT NULL DEFAULT 0, status TEXT NOT NULL DEFAULT 'completed'
|
|
1313
780
|
CHECK (status IN ('active', 'completed', 'superseded', 'failed')), started_at INTEGER, ended_at INTEGER,
|
|
1314
781
|
FOREIGN KEY (task_id) REFERENCES tasks(task_id) ON DELETE CASCADE,
|
|
1315
|
-
FOREIGN KEY (
|
|
782
|
+
FOREIGN KEY ("conversation_id") REFERENCES sessions("conversation_id") ON DELETE SET NULL
|
|
1316
783
|
);
|
|
1317
784
|
|
|
1318
|
-
CREATE UNIQUE INDEX idx_task_sessions_identity
|
|
1319
|
-
ON task_sessions(task_id, session_key, role) WHERE session_key IS NOT NULL;
|
|
1320
|
-
|
|
1321
|
-
CREATE INDEX idx_task_sessions_session ON task_sessions(session_key, created_at DESC);
|
|
1322
|
-
|
|
1323
785
|
CREATE TABLE task_waits (
|
|
1324
786
|
wait_id TEXT PRIMARY KEY,
|
|
1325
787
|
task_id TEXT NOT NULL,
|
|
@@ -1339,10 +801,6 @@ CREATE TABLE task_waits (
|
|
|
1339
801
|
FOREIGN KEY (task_id) REFERENCES tasks(task_id) ON DELETE CASCADE
|
|
1340
802
|
);
|
|
1341
803
|
|
|
1342
|
-
CREATE INDEX idx_task_waits_task_status ON task_waits(task_id, status, created_at DESC);
|
|
1343
|
-
|
|
1344
|
-
CREATE INDEX idx_task_waits_resume ON task_waits(status, resume_at);
|
|
1345
|
-
|
|
1346
804
|
CREATE TABLE task_authority_grants (
|
|
1347
805
|
grant_id TEXT PRIMARY KEY,
|
|
1348
806
|
task_id TEXT NOT NULL,
|
|
@@ -1355,9 +813,6 @@ CREATE TABLE task_authority_grants (
|
|
|
1355
813
|
FOREIGN KEY (task_id) REFERENCES tasks(task_id) ON DELETE CASCADE
|
|
1356
814
|
);
|
|
1357
815
|
|
|
1358
|
-
CREATE INDEX idx_task_authority_grants_task
|
|
1359
|
-
ON task_authority_grants(task_id, revoked_at, expires_at);
|
|
1360
|
-
|
|
1361
816
|
CREATE TABLE context_edges (
|
|
1362
817
|
edge_id TEXT PRIMARY KEY,
|
|
1363
818
|
owner_kind TEXT NOT NULL CHECK (owner_kind IN ('project', 'task')),
|
|
@@ -1375,37 +830,6 @@ CREATE TABLE context_edges (
|
|
|
1375
830
|
UNIQUE(owner_kind, owner_id, target_kind, target_id, role)
|
|
1376
831
|
);
|
|
1377
832
|
|
|
1378
|
-
CREATE INDEX idx_context_edges_owner
|
|
1379
|
-
ON context_edges(owner_kind, owner_id, role, created_at);
|
|
1380
|
-
|
|
1381
|
-
CREATE INDEX idx_context_edges_target
|
|
1382
|
-
ON context_edges(target_kind, target_id, created_at);
|
|
1383
|
-
|
|
1384
|
-
CREATE TABLE context_snapshots (
|
|
1385
|
-
snapshot_id TEXT PRIMARY KEY,
|
|
1386
|
-
trace_id TEXT NOT NULL UNIQUE,
|
|
1387
|
-
owner_kind TEXT NOT NULL CHECK (owner_kind IN ('task_run', 'task', 'session', 'proactive_run')),
|
|
1388
|
-
owner_id TEXT NOT NULL,
|
|
1389
|
-
session_key TEXT,
|
|
1390
|
-
query TEXT NOT NULL,
|
|
1391
|
-
selected_items_json TEXT NOT NULL DEFAULT '[]',
|
|
1392
|
-
rejected_items_json TEXT NOT NULL DEFAULT '[]',
|
|
1393
|
-
consent_requests_json TEXT NOT NULL DEFAULT '[]',
|
|
1394
|
-
relationship_policy_json TEXT NOT NULL DEFAULT '{}',
|
|
1395
|
-
estimated_tokens INTEGER NOT NULL DEFAULT 0,
|
|
1396
|
-
allocation_json TEXT,
|
|
1397
|
-
authorization_snapshot_json TEXT NOT NULL DEFAULT '{}',
|
|
1398
|
-
content_hash TEXT,
|
|
1399
|
-
created_at INTEGER NOT NULL,
|
|
1400
|
-
FOREIGN KEY (session_key) REFERENCES sessions(session_key) ON DELETE SET NULL
|
|
1401
|
-
);
|
|
1402
|
-
|
|
1403
|
-
CREATE INDEX idx_context_snapshots_owner
|
|
1404
|
-
ON context_snapshots(owner_kind, owner_id, created_at DESC);
|
|
1405
|
-
|
|
1406
|
-
CREATE INDEX idx_context_snapshots_session
|
|
1407
|
-
ON context_snapshots(session_key, created_at DESC);
|
|
1408
|
-
|
|
1409
833
|
CREATE TABLE task_runs (
|
|
1410
834
|
run_id TEXT PRIMARY KEY,
|
|
1411
835
|
task_id TEXT NOT NULL,
|
|
@@ -1424,7 +848,7 @@ CREATE TABLE task_runs (
|
|
|
1424
848
|
contract_version INTEGER NOT NULL,
|
|
1425
849
|
context_snapshot_id TEXT,
|
|
1426
850
|
policy_snapshot_json TEXT,
|
|
1427
|
-
|
|
851
|
+
"conversation_id" TEXT,
|
|
1428
852
|
queued_at INTEGER NOT NULL,
|
|
1429
853
|
scheduled_at INTEGER,
|
|
1430
854
|
started_at INTEGER,
|
|
@@ -1443,26 +867,10 @@ CREATE TABLE task_runs (
|
|
|
1443
867
|
FOREIGN KEY (parent_run_id) REFERENCES task_runs(run_id) ON DELETE CASCADE,
|
|
1444
868
|
FOREIGN KEY (retry_of_run_id) REFERENCES task_runs(run_id) ON DELETE SET NULL,
|
|
1445
869
|
FOREIGN KEY (context_snapshot_id) REFERENCES context_snapshots(snapshot_id) ON DELETE RESTRICT,
|
|
1446
|
-
FOREIGN KEY (
|
|
870
|
+
FOREIGN KEY ("conversation_id") REFERENCES sessions("conversation_id") ON DELETE SET NULL,
|
|
1447
871
|
FOREIGN KEY (task_id, contract_version) REFERENCES task_contracts(task_id, version) ON DELETE RESTRICT
|
|
1448
872
|
);
|
|
1449
873
|
|
|
1450
|
-
CREATE INDEX idx_task_runs_task_queued ON task_runs(task_id, queued_at DESC);
|
|
1451
|
-
|
|
1452
|
-
CREATE INDEX idx_task_runs_dispatch ON task_runs(status, scheduled_at, queued_at);
|
|
1453
|
-
|
|
1454
|
-
CREATE INDEX idx_task_runs_lease ON task_runs(lease_expires_at);
|
|
1455
|
-
|
|
1456
|
-
CREATE INDEX idx_task_runs_root ON task_runs(root_run_id, queued_at);
|
|
1457
|
-
|
|
1458
|
-
CREATE UNIQUE INDEX idx_task_runs_active_root
|
|
1459
|
-
ON task_runs(task_id)
|
|
1460
|
-
WHERE parent_run_id IS NULL
|
|
1461
|
-
AND status IN ('queued', 'running', 'waiting', 'verifying');
|
|
1462
|
-
|
|
1463
|
-
CREATE UNIQUE INDEX idx_task_runs_root_attempt
|
|
1464
|
-
ON task_runs(task_id, attempt) WHERE parent_run_id IS NULL;
|
|
1465
|
-
|
|
1466
874
|
CREATE TABLE task_run_events (
|
|
1467
875
|
event_id TEXT PRIMARY KEY,
|
|
1468
876
|
run_id TEXT NOT NULL,
|
|
@@ -1475,8 +883,6 @@ CREATE TABLE task_run_events (
|
|
|
1475
883
|
FOREIGN KEY (run_id) REFERENCES task_runs(run_id) ON DELETE CASCADE
|
|
1476
884
|
);
|
|
1477
885
|
|
|
1478
|
-
CREATE INDEX idx_task_run_events_run_sequence ON task_run_events(run_id, sequence);
|
|
1479
|
-
|
|
1480
886
|
CREATE TABLE task_run_receipts (
|
|
1481
887
|
run_id TEXT PRIMARY KEY,
|
|
1482
888
|
status TEXT NOT NULL CHECK (status IN ('succeeded', 'failed', 'cancelled')),
|
|
@@ -1527,9 +933,7 @@ CREATE TABLE domain_outbox (
|
|
|
1527
933
|
created_at INTEGER NOT NULL,
|
|
1528
934
|
published_at INTEGER,
|
|
1529
935
|
attempts INTEGER NOT NULL DEFAULT 0
|
|
1530
|
-
);
|
|
1531
|
-
|
|
1532
|
-
CREATE INDEX idx_domain_outbox_pending ON domain_outbox(published_at, created_at);
|
|
936
|
+
, operation_id TEXT);
|
|
1533
937
|
|
|
1534
938
|
CREATE TABLE workflow_runs (
|
|
1535
939
|
run_id TEXT PRIMARY KEY,
|
|
@@ -1537,8 +941,8 @@ CREATE TABLE workflow_runs (
|
|
|
1537
941
|
definition_id TEXT NOT NULL,
|
|
1538
942
|
definition_version TEXT NOT NULL,
|
|
1539
943
|
task_run_id TEXT,
|
|
1540
|
-
|
|
1541
|
-
|
|
944
|
+
"conversation_id" TEXT NOT NULL,
|
|
945
|
+
"parent_conversation_id" TEXT,
|
|
1542
946
|
status TEXT NOT NULL,
|
|
1543
947
|
source_kind TEXT NOT NULL,
|
|
1544
948
|
source_json TEXT NOT NULL,
|
|
@@ -1554,16 +958,6 @@ CREATE TABLE workflow_runs (
|
|
|
1554
958
|
FOREIGN KEY (task_run_id) REFERENCES task_runs(run_id) ON DELETE SET NULL
|
|
1555
959
|
);
|
|
1556
960
|
|
|
1557
|
-
CREATE INDEX idx_workflow_runs_created ON workflow_runs(agent_id, created_at_ms DESC);
|
|
1558
|
-
|
|
1559
|
-
CREATE INDEX idx_workflow_runs_status_created ON workflow_runs(agent_id, status, created_at_ms DESC);
|
|
1560
|
-
|
|
1561
|
-
CREATE INDEX idx_workflow_runs_definition_created ON workflow_runs(definition_id, created_at_ms DESC);
|
|
1562
|
-
|
|
1563
|
-
CREATE INDEX idx_workflow_runs_project ON workflow_runs(project_id, created_at_ms DESC);
|
|
1564
|
-
|
|
1565
|
-
CREATE INDEX idx_workflow_runs_task_run ON workflow_runs(task_run_id, created_at_ms DESC);
|
|
1566
|
-
|
|
1567
961
|
CREATE TABLE connector_accounts (
|
|
1568
962
|
id TEXT PRIMARY KEY,
|
|
1569
963
|
connector_id TEXT NOT NULL,
|
|
@@ -1573,34 +967,16 @@ CREATE TABLE connector_accounts (
|
|
|
1573
967
|
current_connection_id TEXT,
|
|
1574
968
|
created_at TEXT NOT NULL,
|
|
1575
969
|
updated_at TEXT NOT NULL
|
|
1576
|
-
);
|
|
1577
|
-
|
|
1578
|
-
CREATE UNIQUE INDEX idx_connector_accounts_identity
|
|
1579
|
-
ON connector_accounts(principal_id, connector_id, identity_key)
|
|
1580
|
-
WHERE identity_key IS NOT NULL;
|
|
1581
|
-
|
|
1582
|
-
CREATE UNIQUE INDEX idx_connector_connections_provider_identity
|
|
1583
|
-
ON connector_connections(provider, provider_connection_id);
|
|
1584
|
-
|
|
1585
|
-
CREATE INDEX idx_connector_connections_account
|
|
1586
|
-
ON connector_connections(account_id, status, updated_at DESC);
|
|
1587
|
-
|
|
1588
|
-
CREATE INDEX idx_connector_learning_jobs_account
|
|
1589
|
-
ON connector_learning_jobs(account_id, created_at DESC);
|
|
970
|
+
, label TEXT, enabled INTEGER NOT NULL DEFAULT 1, allowed_agent_ids_json TEXT, backend_id TEXT, runtime_instance_id TEXT);
|
|
1590
971
|
|
|
1591
972
|
CREATE TABLE connector_sync_policies (
|
|
1592
973
|
account_id TEXT PRIMARY KEY REFERENCES connector_accounts(id) ON DELETE CASCADE,
|
|
1593
974
|
scan_enabled INTEGER NOT NULL DEFAULT 1 CHECK(scan_enabled IN (0, 1)),
|
|
1594
|
-
proactive_enabled INTEGER NOT NULL DEFAULT 0 CHECK(proactive_enabled IN (0, 1)),
|
|
1595
975
|
interval_minutes INTEGER CHECK(interval_minutes IS NULL OR interval_minutes BETWEEN 5 AND 1440),
|
|
1596
|
-
allowed_scenario_keys_json TEXT NOT NULL DEFAULT '[]',
|
|
1597
976
|
revision INTEGER NOT NULL DEFAULT 1,
|
|
1598
977
|
updated_at INTEGER NOT NULL
|
|
1599
978
|
);
|
|
1600
979
|
|
|
1601
|
-
CREATE INDEX idx_connector_sync_policies_proactive
|
|
1602
|
-
ON connector_sync_policies(proactive_enabled, account_id);
|
|
1603
|
-
|
|
1604
980
|
CREATE TABLE endpoint_tool_invocations (
|
|
1605
981
|
id TEXT PRIMARY KEY,
|
|
1606
982
|
principal_id TEXT NOT NULL,
|
|
@@ -1617,24 +993,6 @@ CREATE TABLE endpoint_tool_invocations (
|
|
|
1617
993
|
completed_at INTEGER
|
|
1618
994
|
);
|
|
1619
995
|
|
|
1620
|
-
CREATE INDEX idx_endpoint_tool_invocations_endpoint_started
|
|
1621
|
-
ON endpoint_tool_invocations(endpoint_id, started_at DESC);
|
|
1622
|
-
|
|
1623
|
-
CREATE TABLE collaboration_rules (
|
|
1624
|
-
rule_id TEXT PRIMARY KEY,
|
|
1625
|
-
principal_id TEXT NOT NULL,
|
|
1626
|
-
category TEXT NOT NULL CHECK (category IN ('communication', 'execution', 'boundary', 'routine', 'proactive')),
|
|
1627
|
-
status TEXT NOT NULL CHECK (status IN ('active', 'disabled', 'archived')),
|
|
1628
|
-
priority INTEGER NOT NULL DEFAULT 100,
|
|
1629
|
-
scope_type TEXT NOT NULL CHECK (scope_type IN ('global', 'workspace', 'project', 'session')),
|
|
1630
|
-
scope_id TEXT,
|
|
1631
|
-
conditions_json TEXT NOT NULL DEFAULT '{}',
|
|
1632
|
-
current_revision_id TEXT NOT NULL REFERENCES collaboration_rule_revisions(revision_id)
|
|
1633
|
-
DEFERRABLE INITIALLY DEFERRED,
|
|
1634
|
-
created_at INTEGER NOT NULL,
|
|
1635
|
-
updated_at INTEGER NOT NULL
|
|
1636
|
-
);
|
|
1637
|
-
|
|
1638
996
|
CREATE TABLE collaboration_rule_revisions (
|
|
1639
997
|
revision_id TEXT PRIMARY KEY,
|
|
1640
998
|
rule_id TEXT NOT NULL REFERENCES collaboration_rules(rule_id) ON DELETE CASCADE,
|
|
@@ -1643,9 +1001,6 @@ CREATE TABLE collaboration_rule_revisions (
|
|
|
1643
1001
|
created_at INTEGER NOT NULL
|
|
1644
1002
|
);
|
|
1645
1003
|
|
|
1646
|
-
CREATE INDEX idx_collaboration_rules_principal_status
|
|
1647
|
-
ON collaboration_rules(principal_id, status, priority, updated_at DESC);
|
|
1648
|
-
|
|
1649
1004
|
CREATE TABLE context_evidence (
|
|
1650
1005
|
evidence_id TEXT PRIMARY KEY,
|
|
1651
1006
|
principal_id TEXT NOT NULL,
|
|
@@ -1656,10 +1011,7 @@ CREATE TABLE context_evidence (
|
|
|
1656
1011
|
trust_level TEXT NOT NULL CHECK (trust_level IN ('owner', 'trusted', 'untrusted')),
|
|
1657
1012
|
observed_at INTEGER NOT NULL,
|
|
1658
1013
|
created_at INTEGER NOT NULL
|
|
1659
|
-
, source_run_id TEXT, source_item_id TEXT,
|
|
1660
|
-
|
|
1661
|
-
CREATE UNIQUE INDEX idx_context_evidence_source
|
|
1662
|
-
ON context_evidence(principal_id, source_type, COALESCE(source_instance_id, ''), source_ref);
|
|
1014
|
+
, source_run_id TEXT, source_item_id TEXT, conversation_id TEXT, turn_id TEXT, message_id TEXT, content_hash TEXT, retention_policy TEXT, processing_policy TEXT, extractor_id TEXT, extractor_version TEXT, ingested_at INTEGER);
|
|
1663
1015
|
|
|
1664
1016
|
CREATE TABLE understanding_source_grants (
|
|
1665
1017
|
grant_id TEXT PRIMARY KEY,
|
|
@@ -1682,9 +1034,6 @@ CREATE TABLE understanding_source_grants (
|
|
|
1682
1034
|
updated_at INTEGER NOT NULL
|
|
1683
1035
|
);
|
|
1684
1036
|
|
|
1685
|
-
CREATE INDEX idx_understanding_source_grants_status
|
|
1686
|
-
ON understanding_source_grants(status, category, updated_at DESC);
|
|
1687
|
-
|
|
1688
1037
|
CREATE TABLE understanding_source_runs (
|
|
1689
1038
|
run_id TEXT PRIMARY KEY,
|
|
1690
1039
|
grant_id TEXT NOT NULL,
|
|
@@ -1696,16 +1045,10 @@ CREATE TABLE understanding_source_runs (
|
|
|
1696
1045
|
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1697
1046
|
error_message TEXT,
|
|
1698
1047
|
started_at INTEGER NOT NULL,
|
|
1699
|
-
completed_at INTEGER,
|
|
1048
|
+
completed_at INTEGER, connector_learning_job_id TEXT,
|
|
1700
1049
|
FOREIGN KEY (grant_id) REFERENCES understanding_source_grants(grant_id) ON DELETE CASCADE
|
|
1701
1050
|
);
|
|
1702
1051
|
|
|
1703
|
-
CREATE INDEX idx_understanding_source_runs_grant
|
|
1704
|
-
ON understanding_source_runs(grant_id, started_at DESC);
|
|
1705
|
-
|
|
1706
|
-
CREATE INDEX idx_understanding_source_runs_status
|
|
1707
|
-
ON understanding_source_runs(status, started_at ASC);
|
|
1708
|
-
|
|
1709
1052
|
CREATE TABLE "work_understanding_evidence" (
|
|
1710
1053
|
evidence_id TEXT PRIMARY KEY,
|
|
1711
1054
|
investigation_id TEXT NOT NULL,
|
|
@@ -1725,59 +1068,33 @@ CREATE TABLE "work_understanding_evidence" (
|
|
|
1725
1068
|
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE SET NULL
|
|
1726
1069
|
);
|
|
1727
1070
|
|
|
1728
|
-
CREATE
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
CREATE UNIQUE INDEX idx_task_sessions_active_execution
|
|
1741
|
-
ON task_sessions(task_id)
|
|
1742
|
-
WHERE role = 'execution' AND status = 'active';
|
|
1743
|
-
|
|
1744
|
-
CREATE UNIQUE INDEX idx_task_sessions_execution_owner
|
|
1745
|
-
ON task_sessions(session_key)
|
|
1746
|
-
WHERE role = 'execution' AND session_key IS NOT NULL;
|
|
1747
|
-
|
|
1748
|
-
CREATE TABLE task_conversation_state (
|
|
1749
|
-
task_id TEXT PRIMARY KEY,
|
|
1750
|
-
active_session_key TEXT,
|
|
1751
|
-
current_executor_agent_id TEXT,
|
|
1752
|
-
assignment_epoch INTEGER NOT NULL DEFAULT 0,
|
|
1753
|
-
status TEXT NOT NULL DEFAULT 'idle'
|
|
1754
|
-
CHECK (status IN ('idle', 'active')),
|
|
1755
|
-
updated_at INTEGER NOT NULL,
|
|
1756
|
-
FOREIGN KEY (task_id) REFERENCES tasks(task_id) ON DELETE CASCADE,
|
|
1757
|
-
FOREIGN KEY (active_session_key) REFERENCES sessions(session_key) ON DELETE SET NULL
|
|
1758
|
-
);
|
|
1071
|
+
CREATE TABLE task_conversation_state (
|
|
1072
|
+
task_id TEXT PRIMARY KEY,
|
|
1073
|
+
"active_conversation_id" TEXT,
|
|
1074
|
+
current_executor_agent_id TEXT,
|
|
1075
|
+
assignment_epoch INTEGER NOT NULL DEFAULT 0,
|
|
1076
|
+
status TEXT NOT NULL DEFAULT 'idle'
|
|
1077
|
+
CHECK (status IN ('idle', 'active')),
|
|
1078
|
+
updated_at INTEGER NOT NULL,
|
|
1079
|
+
FOREIGN KEY (task_id) REFERENCES tasks(task_id) ON DELETE CASCADE,
|
|
1080
|
+
FOREIGN KEY ("active_conversation_id") REFERENCES sessions("conversation_id") ON DELETE SET NULL
|
|
1081
|
+
);
|
|
1759
1082
|
|
|
1760
1083
|
CREATE TABLE task_handoff_snapshots (
|
|
1761
1084
|
snapshot_id TEXT PRIMARY KEY,
|
|
1762
1085
|
task_id TEXT NOT NULL,
|
|
1763
|
-
|
|
1764
|
-
|
|
1086
|
+
"from_conversation_id" TEXT,
|
|
1087
|
+
"to_conversation_id" TEXT NOT NULL,
|
|
1765
1088
|
from_agent_id TEXT,
|
|
1766
1089
|
to_agent_id TEXT NOT NULL,
|
|
1767
1090
|
assignment_epoch INTEGER NOT NULL,
|
|
1768
1091
|
payload_json TEXT NOT NULL,
|
|
1769
1092
|
created_at INTEGER NOT NULL,
|
|
1770
1093
|
FOREIGN KEY (task_id) REFERENCES tasks(task_id) ON DELETE CASCADE,
|
|
1771
|
-
FOREIGN KEY (
|
|
1772
|
-
FOREIGN KEY (
|
|
1094
|
+
FOREIGN KEY ("from_conversation_id") REFERENCES sessions("conversation_id") ON DELETE SET NULL,
|
|
1095
|
+
FOREIGN KEY ("to_conversation_id") REFERENCES sessions("conversation_id") ON DELETE CASCADE
|
|
1773
1096
|
);
|
|
1774
1097
|
|
|
1775
|
-
CREATE INDEX idx_task_handoffs_task
|
|
1776
|
-
ON task_handoff_snapshots(task_id, assignment_epoch DESC);
|
|
1777
|
-
|
|
1778
|
-
CREATE INDEX idx_automation_runs_unread_created
|
|
1779
|
-
ON automation_runs(read_at_ms, created_at_ms DESC);
|
|
1780
|
-
|
|
1781
1098
|
CREATE TABLE workflow_context_snapshots (
|
|
1782
1099
|
snapshot_id TEXT PRIMARY KEY,
|
|
1783
1100
|
trace_id TEXT NOT NULL UNIQUE,
|
|
@@ -1789,12 +1106,6 @@ CREATE TABLE workflow_context_snapshots (
|
|
|
1789
1106
|
created_at INTEGER NOT NULL
|
|
1790
1107
|
);
|
|
1791
1108
|
|
|
1792
|
-
CREATE INDEX idx_workflow_context_snapshots_run
|
|
1793
|
-
ON workflow_context_snapshots(run_id, created_at DESC);
|
|
1794
|
-
|
|
1795
|
-
CREATE INDEX idx_workflow_context_snapshots_project
|
|
1796
|
-
ON workflow_context_snapshots(project_id, created_at DESC);
|
|
1797
|
-
|
|
1798
1109
|
CREATE TABLE project_workflow_presets (
|
|
1799
1110
|
project_id TEXT NOT NULL,
|
|
1800
1111
|
definition_id TEXT NOT NULL,
|
|
@@ -1805,11 +1116,8 @@ CREATE TABLE project_workflow_presets (
|
|
|
1805
1116
|
FOREIGN KEY (project_id) REFERENCES projects(project_id) ON DELETE CASCADE
|
|
1806
1117
|
);
|
|
1807
1118
|
|
|
1808
|
-
CREATE INDEX idx_project_workflow_presets_updated
|
|
1809
|
-
ON project_workflow_presets(project_id, updated_at DESC);
|
|
1810
|
-
|
|
1811
1119
|
CREATE TABLE "session_config" (
|
|
1812
|
-
|
|
1120
|
+
"conversation_id" TEXT PRIMARY KEY,
|
|
1813
1121
|
thinking_level TEXT,
|
|
1814
1122
|
reasoning_level TEXT,
|
|
1815
1123
|
verbose_level TEXT,
|
|
@@ -1820,7 +1128,7 @@ CREATE TABLE "session_config" (
|
|
|
1820
1128
|
response_language TEXT,
|
|
1821
1129
|
user_context_mode TEXT CHECK (user_context_mode IN ('enabled', 'off', 'temporary')),
|
|
1822
1130
|
updated_at INTEGER NOT NULL, fixed_model INTEGER NOT NULL DEFAULT 0 CHECK (fixed_model IN (0, 1)),
|
|
1823
|
-
FOREIGN KEY (
|
|
1131
|
+
FOREIGN KEY ("conversation_id") REFERENCES sessions("conversation_id") ON DELETE CASCADE
|
|
1824
1132
|
);
|
|
1825
1133
|
|
|
1826
1134
|
CREATE TABLE context_extraction_runs (
|
|
@@ -1839,31 +1147,6 @@ CREATE TABLE context_extraction_runs (
|
|
|
1839
1147
|
UNIQUE (principal_id, source_ref, extractor_id, extractor_version)
|
|
1840
1148
|
);
|
|
1841
1149
|
|
|
1842
|
-
CREATE INDEX idx_context_extraction_runs_lookup
|
|
1843
|
-
ON context_extraction_runs(extractor_id, status, started_at DESC);
|
|
1844
|
-
|
|
1845
|
-
CREATE TABLE context_extraction_outputs (
|
|
1846
|
-
output_id TEXT PRIMARY KEY,
|
|
1847
|
-
extraction_run_id TEXT NOT NULL REFERENCES context_extraction_runs(extraction_run_id) ON DELETE CASCADE,
|
|
1848
|
-
ordinal INTEGER NOT NULL,
|
|
1849
|
-
candidate_key TEXT NOT NULL,
|
|
1850
|
-
object_type TEXT CHECK (object_type IN ('profile', 'rule', 'focus', 'understanding')),
|
|
1851
|
-
object_id TEXT,
|
|
1852
|
-
version_id TEXT,
|
|
1853
|
-
outcome TEXT NOT NULL CHECK (outcome IN ('created', 'deduplicated', 'rejected')),
|
|
1854
|
-
created_at INTEGER NOT NULL,
|
|
1855
|
-
UNIQUE (extraction_run_id, ordinal)
|
|
1856
|
-
);
|
|
1857
|
-
|
|
1858
|
-
CREATE INDEX idx_context_extraction_outputs_object
|
|
1859
|
-
ON context_extraction_outputs(object_type, object_id);
|
|
1860
|
-
|
|
1861
|
-
CREATE INDEX idx_context_evidence_run
|
|
1862
|
-
ON context_evidence(source_run_id, observed_at DESC);
|
|
1863
|
-
|
|
1864
|
-
CREATE INDEX idx_context_evidence_message
|
|
1865
|
-
ON context_evidence(session_id, turn_id, message_id);
|
|
1866
|
-
|
|
1867
1150
|
CREATE TABLE user_people (
|
|
1868
1151
|
person_id TEXT PRIMARY KEY,
|
|
1869
1152
|
principal_id TEXT NOT NULL,
|
|
@@ -1880,12 +1163,6 @@ CREATE TABLE user_people (
|
|
|
1880
1163
|
updated_at INTEGER NOT NULL
|
|
1881
1164
|
);
|
|
1882
1165
|
|
|
1883
|
-
CREATE INDEX idx_user_people_principal_kind
|
|
1884
|
-
ON user_people(principal_id, inferred_kind, last_observed_at DESC);
|
|
1885
|
-
|
|
1886
|
-
CREATE INDEX idx_user_people_merge_target
|
|
1887
|
-
ON user_people(merged_into_person_id);
|
|
1888
|
-
|
|
1889
1166
|
CREATE TABLE user_person_handles (
|
|
1890
1167
|
handle_id TEXT PRIMARY KEY,
|
|
1891
1168
|
person_id TEXT NOT NULL REFERENCES user_people(person_id) ON DELETE CASCADE,
|
|
@@ -1901,10 +1178,6 @@ CREATE TABLE user_person_handles (
|
|
|
1901
1178
|
UNIQUE(handle_type, normalized_value, source_instance_id)
|
|
1902
1179
|
);
|
|
1903
1180
|
|
|
1904
|
-
CREATE INDEX idx_user_person_handles_person ON user_person_handles(person_id);
|
|
1905
|
-
|
|
1906
|
-
CREATE INDEX idx_user_person_handles_lookup ON user_person_handles(handle_type, normalized_value);
|
|
1907
|
-
|
|
1908
1181
|
CREATE TABLE user_person_source_stats (
|
|
1909
1182
|
person_id TEXT NOT NULL REFERENCES user_people(person_id) ON DELETE CASCADE,
|
|
1910
1183
|
source_instance_id TEXT NOT NULL,
|
|
@@ -1916,9 +1189,6 @@ CREATE TABLE user_person_source_stats (
|
|
|
1916
1189
|
PRIMARY KEY(person_id, source_instance_id)
|
|
1917
1190
|
);
|
|
1918
1191
|
|
|
1919
|
-
CREATE INDEX idx_user_person_source_stats_source
|
|
1920
|
-
ON user_person_source_stats(source_instance_id, last_observed_at DESC);
|
|
1921
|
-
|
|
1922
1192
|
CREATE TABLE user_people_index_state (
|
|
1923
1193
|
principal_id TEXT PRIMARY KEY,
|
|
1924
1194
|
source_change_sequence INTEGER NOT NULL,
|
|
@@ -1940,9 +1210,6 @@ CREATE TABLE notification_events (
|
|
|
1940
1210
|
created_at INTEGER NOT NULL
|
|
1941
1211
|
);
|
|
1942
1212
|
|
|
1943
|
-
CREATE INDEX idx_notification_events_created
|
|
1944
|
-
ON notification_events(created_at, event_id);
|
|
1945
|
-
|
|
1946
1213
|
CREATE TABLE notification_acknowledgements (
|
|
1947
1214
|
event_id TEXT NOT NULL,
|
|
1948
1215
|
consumer_id TEXT NOT NULL,
|
|
@@ -1979,30 +1246,17 @@ CREATE TABLE execution_environments (
|
|
|
1979
1246
|
updated_at INTEGER NOT NULL,
|
|
1980
1247
|
last_used_at INTEGER,
|
|
1981
1248
|
deleted_at INTEGER
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
CREATE UNIQUE INDEX idx_execution_environments_active_root
|
|
1985
|
-
ON execution_environments(root_path)
|
|
1986
|
-
WHERE deleted_at IS NULL;
|
|
1987
|
-
|
|
1988
|
-
CREATE INDEX idx_execution_environments_project
|
|
1989
|
-
ON execution_environments(project_id, updated_at DESC);
|
|
1249
|
+
, ownership TEXT NOT NULL DEFAULT 'registered'
|
|
1250
|
+
CHECK (ownership IN ('registered', 'xopc_created')));
|
|
1990
1251
|
|
|
1991
1252
|
CREATE TABLE execution_environment_bindings (
|
|
1992
1253
|
binding_id TEXT PRIMARY KEY,
|
|
1993
|
-
|
|
1254
|
+
"conversation_id" TEXT NOT NULL,
|
|
1994
1255
|
environment_id TEXT NOT NULL REFERENCES execution_environments(environment_id) ON DELETE CASCADE,
|
|
1995
1256
|
created_at INTEGER NOT NULL,
|
|
1996
1257
|
released_at INTEGER
|
|
1997
1258
|
);
|
|
1998
1259
|
|
|
1999
|
-
CREATE UNIQUE INDEX idx_execution_environment_bindings_active_session
|
|
2000
|
-
ON execution_environment_bindings(session_key)
|
|
2001
|
-
WHERE released_at IS NULL;
|
|
2002
|
-
|
|
2003
|
-
CREATE INDEX idx_execution_environment_bindings_environment
|
|
2004
|
-
ON execution_environment_bindings(environment_id, created_at DESC);
|
|
2005
|
-
|
|
2006
1260
|
CREATE TABLE execution_environment_events (
|
|
2007
1261
|
event_id TEXT PRIMARY KEY,
|
|
2008
1262
|
environment_id TEXT NOT NULL REFERENCES execution_environments(environment_id) ON DELETE CASCADE,
|
|
@@ -2017,12 +1271,6 @@ CREATE TABLE execution_environment_events (
|
|
|
2017
1271
|
created_at INTEGER NOT NULL
|
|
2018
1272
|
);
|
|
2019
1273
|
|
|
2020
|
-
CREATE INDEX idx_execution_environment_events_environment
|
|
2021
|
-
ON execution_environment_events(environment_id, created_at DESC);
|
|
2022
|
-
|
|
2023
|
-
CREATE INDEX idx_projects_execution_mode
|
|
2024
|
-
ON projects(execution_mode, updated_at DESC);
|
|
2025
|
-
|
|
2026
1274
|
CREATE TABLE durable_state (
|
|
2027
1275
|
namespace TEXT NOT NULL,
|
|
2028
1276
|
scope TEXT NOT NULL,
|
|
@@ -2060,14 +1308,6 @@ CREATE TABLE durable_messages (
|
|
|
2060
1308
|
UNIQUE(queue, scope, id)
|
|
2061
1309
|
);
|
|
2062
1310
|
|
|
2063
|
-
CREATE INDEX durable_messages_pending ON durable_messages(queue, scope, processed_at, sequence);
|
|
2064
|
-
|
|
2065
|
-
CREATE UNIQUE INDEX durable_share_token ON durable_state(namespace, json_extract(payload, '$.token'))
|
|
2066
|
-
WHERE namespace IN ('shares', 'site-shares');
|
|
2067
|
-
|
|
2068
|
-
CREATE UNIQUE INDEX durable_site_subdomain ON durable_state(json_extract(payload, '$.subdomain'))
|
|
2069
|
-
WHERE namespace = 'site-shares' AND json_extract(payload, '$.subdomain') IS NOT NULL;
|
|
2070
|
-
|
|
2071
1311
|
CREATE TABLE user_assertion_slots (
|
|
2072
1312
|
slot_id TEXT PRIMARY KEY,
|
|
2073
1313
|
principal_id TEXT NOT NULL,
|
|
@@ -2080,17 +1320,6 @@ CREATE TABLE user_assertion_slots (
|
|
|
2080
1320
|
created_at INTEGER NOT NULL
|
|
2081
1321
|
);
|
|
2082
1322
|
|
|
2083
|
-
CREATE UNIQUE INDEX idx_user_assertion_slots_identity
|
|
2084
|
-
ON user_assertion_slots(
|
|
2085
|
-
principal_id, subject_type, subject_id, predicate, scope_type, COALESCE(scope_id, '')
|
|
2086
|
-
);
|
|
2087
|
-
|
|
2088
|
-
CREATE INDEX idx_user_assertion_slots_subject
|
|
2089
|
-
ON user_assertion_slots(principal_id, subject_type, subject_id, predicate);
|
|
2090
|
-
|
|
2091
|
-
CREATE INDEX idx_user_assertion_slots_scope
|
|
2092
|
-
ON user_assertion_slots(principal_id, scope_type, scope_id);
|
|
2093
|
-
|
|
2094
1323
|
CREATE TABLE user_assertions (
|
|
2095
1324
|
assertion_id TEXT PRIMARY KEY,
|
|
2096
1325
|
slot_id TEXT NOT NULL REFERENCES user_assertion_slots(slot_id) ON DELETE CASCADE,
|
|
@@ -2123,19 +1352,19 @@ CREATE TABLE user_assertions (
|
|
|
2123
1352
|
review_at INTEGER,
|
|
2124
1353
|
supersedes_assertion_id TEXT REFERENCES user_assertions(assertion_id) ON DELETE SET NULL,
|
|
2125
1354
|
created_by TEXT NOT NULL CHECK(created_by IN ('user', 'runtime', 'connector', 'maintenance', 'migration')),
|
|
2126
|
-
created_at INTEGER NOT NULL,
|
|
1355
|
+
created_at INTEGER NOT NULL, domain TEXT NOT NULL DEFAULT 'identity'
|
|
1356
|
+
CHECK(domain IN (
|
|
1357
|
+
'identity', 'life_history', 'health', 'emotion', 'personality', 'cognition',
|
|
1358
|
+
'values', 'motivation', 'goals', 'capabilities', 'behavior', 'preferences',
|
|
1359
|
+
'relationships', 'resources_constraints', 'environment', 'digital_life'
|
|
1360
|
+
)), model_layer TEXT NOT NULL DEFAULT 'fact'
|
|
1361
|
+
CHECK(model_layer IN ('fact', 'pattern', 'interpretation')), sensitivity_categories_json TEXT NOT NULL DEFAULT '[]'
|
|
1362
|
+
CHECK(json_valid(sensitivity_categories_json)), purpose_ids_json TEXT NOT NULL DEFAULT '["personalization"]'
|
|
1363
|
+
CHECK(json_valid(purpose_ids_json)), allowed_uses_json TEXT NOT NULL DEFAULT '["answer","rank","recommend"]'
|
|
1364
|
+
CHECK(json_valid(allowed_uses_json)), allowed_agent_ids_json TEXT CHECK(allowed_agent_ids_json IS NULL OR json_valid(allowed_agent_ids_json)), consent_receipt_id TEXT, support_count INTEGER NOT NULL DEFAULT 0 CHECK(support_count >= 0), independent_source_count INTEGER NOT NULL DEFAULT 0 CHECK(independent_source_count >= 0), last_supported_at INTEGER, delete_after INTEGER,
|
|
2127
1365
|
CHECK(valid_to IS NULL OR valid_from IS NULL OR valid_to >= valid_from)
|
|
2128
1366
|
);
|
|
2129
1367
|
|
|
2130
|
-
CREATE INDEX idx_user_assertions_slot_status
|
|
2131
|
-
ON user_assertions(slot_id, status, valid_from, valid_to);
|
|
2132
|
-
|
|
2133
|
-
CREATE INDEX idx_user_assertions_review
|
|
2134
|
-
ON user_assertions(status, review_at) WHERE review_at IS NOT NULL;
|
|
2135
|
-
|
|
2136
|
-
CREATE INDEX idx_user_assertions_recorded
|
|
2137
|
-
ON user_assertions(recorded_at DESC);
|
|
2138
|
-
|
|
2139
1368
|
CREATE VIRTUAL TABLE user_assertions_fts USING fts5(
|
|
2140
1369
|
statement,
|
|
2141
1370
|
assertion_id UNINDEXED,
|
|
@@ -2152,9 +1381,6 @@ CREATE TABLE user_assertion_evidence (
|
|
|
2152
1381
|
PRIMARY KEY(assertion_id, evidence_id, relation)
|
|
2153
1382
|
);
|
|
2154
1383
|
|
|
2155
|
-
CREATE INDEX idx_user_assertion_evidence_source
|
|
2156
|
-
ON user_assertion_evidence(evidence_id, relation);
|
|
2157
|
-
|
|
2158
1384
|
CREATE TABLE user_assertion_status_events (
|
|
2159
1385
|
event_id TEXT PRIMARY KEY,
|
|
2160
1386
|
assertion_id TEXT NOT NULL REFERENCES user_assertions(assertion_id) ON DELETE CASCADE,
|
|
@@ -2166,9 +1392,6 @@ CREATE TABLE user_assertion_status_events (
|
|
|
2166
1392
|
created_at INTEGER NOT NULL
|
|
2167
1393
|
);
|
|
2168
1394
|
|
|
2169
|
-
CREATE INDEX idx_user_assertion_status_events_assertion
|
|
2170
|
-
ON user_assertion_status_events(assertion_id, created_at DESC);
|
|
2171
|
-
|
|
2172
1395
|
CREATE TABLE user_goals (
|
|
2173
1396
|
goal_id TEXT PRIMARY KEY,
|
|
2174
1397
|
principal_id TEXT NOT NULL,
|
|
@@ -2200,12 +1423,6 @@ CREATE TABLE user_goal_revisions (
|
|
|
2200
1423
|
created_at INTEGER NOT NULL
|
|
2201
1424
|
);
|
|
2202
1425
|
|
|
2203
|
-
CREATE INDEX idx_user_goals_status
|
|
2204
|
-
ON user_goals(principal_id, status, updated_at DESC);
|
|
2205
|
-
|
|
2206
|
-
CREATE INDEX idx_user_goals_scope
|
|
2207
|
-
ON user_goals(principal_id, scope_type, scope_id, status);
|
|
2208
|
-
|
|
2209
1426
|
CREATE TABLE user_priority_windows (
|
|
2210
1427
|
priority_id TEXT PRIMARY KEY,
|
|
2211
1428
|
principal_id TEXT NOT NULL,
|
|
@@ -2226,74 +1443,12 @@ CREATE TABLE user_priority_windows (
|
|
|
2226
1443
|
CHECK(valid_to >= valid_from)
|
|
2227
1444
|
);
|
|
2228
1445
|
|
|
2229
|
-
CREATE INDEX idx_user_priority_windows_active
|
|
2230
|
-
ON user_priority_windows(principal_id, status, valid_from, valid_to);
|
|
2231
|
-
|
|
2232
|
-
CREATE INDEX idx_user_priority_windows_target
|
|
2233
|
-
ON user_priority_windows(target_type, target_id, status);
|
|
2234
|
-
|
|
2235
|
-
CREATE TABLE knowledge_items (
|
|
2236
|
-
knowledge_id TEXT PRIMARY KEY,
|
|
2237
|
-
principal_id TEXT NOT NULL,
|
|
2238
|
-
kind TEXT NOT NULL CHECK(kind IN (
|
|
2239
|
-
'work_thread', 'project_fact', 'workspace_fact', 'decision', 'task_lesson',
|
|
2240
|
-
'commitment', 'open_question', 'episode', 'note'
|
|
2241
|
-
)),
|
|
2242
|
-
scope_type TEXT NOT NULL CHECK(scope_type IN ('global', 'agent', 'workspace', 'project', 'session')),
|
|
2243
|
-
scope_id TEXT,
|
|
2244
|
-
content TEXT NOT NULL,
|
|
2245
|
-
canonical_key TEXT NOT NULL,
|
|
2246
|
-
status TEXT NOT NULL CHECK(status IN ('candidate', 'active', 'needs_review', 'stale', 'archived', 'rejected')),
|
|
2247
|
-
confidence REAL NOT NULL CHECK(confidence >= 0 AND confidence <= 1),
|
|
2248
|
-
importance REAL NOT NULL CHECK(importance >= 0 AND importance <= 1),
|
|
2249
|
-
valid_from INTEGER,
|
|
2250
|
-
valid_to INTEGER,
|
|
2251
|
-
expires_at INTEGER,
|
|
2252
|
-
review_at INTEGER,
|
|
2253
|
-
origin_class TEXT NOT NULL CHECK(origin_class IN ('owner', 'agent', 'system', 'untrusted')),
|
|
2254
|
-
source_agent_id TEXT,
|
|
2255
|
-
source_session_id TEXT,
|
|
2256
|
-
source_turn_id TEXT,
|
|
2257
|
-
derived_from_recalled_context INTEGER NOT NULL DEFAULT 0 CHECK(derived_from_recalled_context IN (0, 1)),
|
|
2258
|
-
source_json TEXT NOT NULL DEFAULT '{}' CHECK(json_valid(source_json)),
|
|
2259
|
-
created_at INTEGER NOT NULL,
|
|
2260
|
-
updated_at INTEGER NOT NULL, record_class TEXT NOT NULL DEFAULT 'memory'
|
|
2261
|
-
CHECK(record_class IN ('memory', 'source_index')),
|
|
2262
|
-
CHECK(valid_to IS NULL OR valid_from IS NULL OR valid_to >= valid_from)
|
|
2263
|
-
);
|
|
2264
|
-
|
|
2265
|
-
CREATE INDEX idx_knowledge_items_status
|
|
2266
|
-
ON knowledge_items(principal_id, status, updated_at DESC);
|
|
2267
|
-
|
|
2268
|
-
CREATE INDEX idx_knowledge_items_scope
|
|
2269
|
-
ON knowledge_items(principal_id, scope_type, scope_id, status);
|
|
2270
|
-
|
|
2271
|
-
CREATE INDEX idx_knowledge_items_lifecycle
|
|
2272
|
-
ON knowledge_items(status, expires_at, review_at);
|
|
2273
|
-
|
|
2274
|
-
CREATE UNIQUE INDEX idx_knowledge_items_canonical
|
|
2275
|
-
ON knowledge_items(principal_id, canonical_key, scope_type, COALESCE(scope_id, ''))
|
|
2276
|
-
WHERE status IN ('candidate', 'active', 'needs_review', 'stale');
|
|
2277
|
-
|
|
2278
1446
|
CREATE VIRTUAL TABLE knowledge_items_fts USING fts5(
|
|
2279
1447
|
content,
|
|
2280
1448
|
knowledge_id UNINDEXED,
|
|
2281
1449
|
tokenize='unicode61'
|
|
2282
1450
|
);
|
|
2283
1451
|
|
|
2284
|
-
CREATE TABLE knowledge_item_status_events (
|
|
2285
|
-
event_id TEXT PRIMARY KEY,
|
|
2286
|
-
knowledge_id TEXT NOT NULL REFERENCES knowledge_items(knowledge_id) ON DELETE CASCADE,
|
|
2287
|
-
from_status TEXT,
|
|
2288
|
-
to_status TEXT NOT NULL,
|
|
2289
|
-
actor_type TEXT NOT NULL CHECK(actor_type IN ('user', 'agent', 'runtime', 'maintenance', 'migration')),
|
|
2290
|
-
reason TEXT NOT NULL,
|
|
2291
|
-
created_at INTEGER NOT NULL
|
|
2292
|
-
);
|
|
2293
|
-
|
|
2294
|
-
CREATE INDEX idx_knowledge_item_status_events_item
|
|
2295
|
-
ON knowledge_item_status_events(knowledge_id, created_at DESC);
|
|
2296
|
-
|
|
2297
1452
|
CREATE TABLE memory_maintenance_runs (
|
|
2298
1453
|
run_id TEXT PRIMARY KEY,
|
|
2299
1454
|
principal_id TEXT NOT NULL,
|
|
@@ -2309,9 +1464,6 @@ CREATE TABLE memory_maintenance_runs (
|
|
|
2309
1464
|
finished_at INTEGER
|
|
2310
1465
|
);
|
|
2311
1466
|
|
|
2312
|
-
CREATE INDEX idx_memory_maintenance_runs_principal
|
|
2313
|
-
ON memory_maintenance_runs(principal_id, started_at DESC);
|
|
2314
|
-
|
|
2315
1467
|
CREATE TABLE memory_maintenance_decisions (
|
|
2316
1468
|
decision_id TEXT PRIMARY KEY,
|
|
2317
1469
|
run_id TEXT NOT NULL REFERENCES memory_maintenance_runs(run_id) ON DELETE CASCADE,
|
|
@@ -2324,14 +1476,11 @@ CREATE TABLE memory_maintenance_decisions (
|
|
|
2324
1476
|
created_at INTEGER NOT NULL
|
|
2325
1477
|
);
|
|
2326
1478
|
|
|
2327
|
-
CREATE INDEX idx_memory_maintenance_decisions_run
|
|
2328
|
-
ON memory_maintenance_decisions(run_id, created_at);
|
|
2329
|
-
|
|
2330
1479
|
CREATE TABLE execution_context_runs (
|
|
2331
1480
|
run_id TEXT PRIMARY KEY,
|
|
2332
1481
|
principal_id TEXT NOT NULL,
|
|
2333
1482
|
turn_id TEXT NOT NULL UNIQUE,
|
|
2334
|
-
|
|
1483
|
+
conversation_id TEXT NOT NULL,
|
|
2335
1484
|
query_hash TEXT NOT NULL,
|
|
2336
1485
|
as_of INTEGER NOT NULL,
|
|
2337
1486
|
budget_json TEXT NOT NULL CHECK(json_valid(budget_json)),
|
|
@@ -2358,120 +1507,21 @@ CREATE TABLE execution_context_feedback (
|
|
|
2358
1507
|
updated_at INTEGER NOT NULL
|
|
2359
1508
|
);
|
|
2360
1509
|
|
|
2361
|
-
CREATE INDEX idx_knowledge_items_class_status
|
|
2362
|
-
ON knowledge_items(principal_id, record_class, status, updated_at DESC);
|
|
2363
|
-
|
|
2364
1510
|
CREATE TABLE session_connection_waits (
|
|
2365
1511
|
id TEXT PRIMARY KEY,
|
|
2366
1512
|
principal_id TEXT NOT NULL,
|
|
2367
|
-
|
|
2368
|
-
|
|
1513
|
+
"conversation_id" TEXT NOT NULL,
|
|
1514
|
+
"transcript_id" TEXT NOT NULL,
|
|
2369
1515
|
status TEXT NOT NULL CHECK (status IN ('open','queued','closed')),
|
|
2370
1516
|
version INTEGER NOT NULL,
|
|
2371
1517
|
data_json TEXT NOT NULL
|
|
2372
1518
|
);
|
|
2373
1519
|
|
|
2374
|
-
CREATE UNIQUE INDEX idx_connection_wait_active ON session_connection_waits(principal_id,session_id)
|
|
2375
|
-
WHERE status IN ('open','queued');
|
|
2376
|
-
|
|
2377
|
-
CREATE INDEX idx_connection_wait_session ON session_connection_waits(session_key);
|
|
2378
|
-
|
|
2379
|
-
CREATE TABLE proactive_scenario_versions (
|
|
2380
|
-
scenario_key TEXT NOT NULL,
|
|
2381
|
-
version INTEGER NOT NULL CHECK (version > 0),
|
|
2382
|
-
title TEXT NOT NULL,
|
|
2383
|
-
description TEXT NOT NULL,
|
|
2384
|
-
base_prompt TEXT NOT NULL,
|
|
2385
|
-
base_template_version INTEGER NOT NULL CHECK (base_template_version > 0),
|
|
2386
|
-
event_types_json TEXT NOT NULL,
|
|
2387
|
-
condition_json TEXT,
|
|
2388
|
-
aggregation TEXT NOT NULL CHECK (aggregation IN ('subject', 'project', 'workspace')),
|
|
2389
|
-
debounce_seconds INTEGER NOT NULL CHECK (debounce_seconds >= 0),
|
|
2390
|
-
max_window_seconds INTEGER NOT NULL CHECK (max_window_seconds > 0),
|
|
2391
|
-
context_provider_ids_json TEXT NOT NULL,
|
|
2392
|
-
min_confidence REAL NOT NULL CHECK (min_confidence >= 0 AND min_confidence <= 1),
|
|
2393
|
-
min_value_score REAL NOT NULL CHECK (min_value_score >= 0 AND min_value_score <= 1),
|
|
2394
|
-
cooldown_seconds INTEGER NOT NULL CHECK (cooldown_seconds >= 0),
|
|
2395
|
-
max_runs_per_day INTEGER NOT NULL CHECK (max_runs_per_day > 0),
|
|
2396
|
-
created_at TEXT NOT NULL,
|
|
2397
|
-
PRIMARY KEY (scenario_key, version),
|
|
2398
|
-
FOREIGN KEY (scenario_key) REFERENCES proactive_scenarios(scenario_key) ON DELETE CASCADE
|
|
2399
|
-
);
|
|
2400
|
-
|
|
2401
|
-
CREATE TRIGGER proactive_scenario_version_after_insert
|
|
2402
|
-
AFTER INSERT ON proactive_scenarios
|
|
2403
|
-
BEGIN
|
|
2404
|
-
INSERT INTO proactive_scenario_versions (
|
|
2405
|
-
scenario_key, version, title, description, base_prompt, base_template_version,
|
|
2406
|
-
event_types_json, condition_json, aggregation, debounce_seconds,
|
|
2407
|
-
max_window_seconds, context_provider_ids_json, min_confidence,
|
|
2408
|
-
min_value_score, cooldown_seconds, max_runs_per_day, created_at
|
|
2409
|
-
) VALUES (
|
|
2410
|
-
NEW.scenario_key, NEW.version, NEW.title, NEW.description, NEW.base_prompt,
|
|
2411
|
-
NEW.base_template_version, NEW.event_types_json, NEW.condition_json,
|
|
2412
|
-
NEW.aggregation, NEW.debounce_seconds, NEW.max_window_seconds,
|
|
2413
|
-
NEW.context_provider_ids_json, NEW.min_confidence, NEW.min_value_score,
|
|
2414
|
-
NEW.cooldown_seconds, NEW.max_runs_per_day, NEW.updated_at
|
|
2415
|
-
);
|
|
2416
|
-
END;
|
|
2417
|
-
|
|
2418
|
-
CREATE TRIGGER proactive_scenario_contract_update_guard
|
|
2419
|
-
BEFORE UPDATE ON proactive_scenarios
|
|
2420
|
-
WHEN NEW.version = OLD.version AND (
|
|
2421
|
-
NEW.title IS NOT OLD.title
|
|
2422
|
-
OR NEW.description IS NOT OLD.description
|
|
2423
|
-
OR NEW.base_prompt IS NOT OLD.base_prompt
|
|
2424
|
-
OR NEW.base_template_version IS NOT OLD.base_template_version
|
|
2425
|
-
OR NEW.event_types_json IS NOT OLD.event_types_json
|
|
2426
|
-
OR NEW.condition_json IS NOT OLD.condition_json
|
|
2427
|
-
OR NEW.aggregation IS NOT OLD.aggregation
|
|
2428
|
-
OR NEW.debounce_seconds IS NOT OLD.debounce_seconds
|
|
2429
|
-
OR NEW.max_window_seconds IS NOT OLD.max_window_seconds
|
|
2430
|
-
OR NEW.context_provider_ids_json IS NOT OLD.context_provider_ids_json
|
|
2431
|
-
OR NEW.min_confidence IS NOT OLD.min_confidence
|
|
2432
|
-
OR NEW.min_value_score IS NOT OLD.min_value_score
|
|
2433
|
-
OR NEW.cooldown_seconds IS NOT OLD.cooldown_seconds
|
|
2434
|
-
OR NEW.max_runs_per_day IS NOT OLD.max_runs_per_day
|
|
2435
|
-
)
|
|
2436
|
-
BEGIN
|
|
2437
|
-
SELECT RAISE(ABORT, 'proactive scenario contract changes require a new version');
|
|
2438
|
-
END;
|
|
2439
|
-
|
|
2440
|
-
CREATE TRIGGER proactive_scenario_version_after_update
|
|
2441
|
-
AFTER UPDATE OF version ON proactive_scenarios
|
|
2442
|
-
WHEN NEW.version <> OLD.version
|
|
2443
|
-
BEGIN
|
|
2444
|
-
INSERT INTO proactive_scenario_versions (
|
|
2445
|
-
scenario_key, version, title, description, base_prompt, base_template_version,
|
|
2446
|
-
event_types_json, condition_json, aggregation, debounce_seconds,
|
|
2447
|
-
max_window_seconds, context_provider_ids_json, min_confidence,
|
|
2448
|
-
min_value_score, cooldown_seconds, max_runs_per_day, created_at
|
|
2449
|
-
) VALUES (
|
|
2450
|
-
NEW.scenario_key, NEW.version, NEW.title, NEW.description, NEW.base_prompt,
|
|
2451
|
-
NEW.base_template_version, NEW.event_types_json, NEW.condition_json,
|
|
2452
|
-
NEW.aggregation, NEW.debounce_seconds, NEW.max_window_seconds,
|
|
2453
|
-
NEW.context_provider_ids_json, NEW.min_confidence, NEW.min_value_score,
|
|
2454
|
-
NEW.cooldown_seconds, NEW.max_runs_per_day, NEW.updated_at
|
|
2455
|
-
);
|
|
2456
|
-
END;
|
|
2457
|
-
|
|
2458
|
-
CREATE TRIGGER proactive_scenario_versions_immutable_update
|
|
2459
|
-
BEFORE UPDATE ON proactive_scenario_versions
|
|
2460
|
-
BEGIN
|
|
2461
|
-
SELECT RAISE(ABORT, 'proactive scenario versions are immutable');
|
|
2462
|
-
END;
|
|
2463
|
-
|
|
2464
|
-
CREATE TRIGGER proactive_scenario_versions_immutable_delete
|
|
2465
|
-
BEFORE DELETE ON proactive_scenario_versions
|
|
2466
|
-
BEGIN
|
|
2467
|
-
SELECT RAISE(ABORT, 'proactive scenario versions are immutable');
|
|
2468
|
-
END;
|
|
2469
|
-
|
|
2470
1520
|
CREATE TABLE session_clarification_waits (
|
|
2471
1521
|
id TEXT PRIMARY KEY,
|
|
2472
1522
|
principal_id TEXT NOT NULL,
|
|
2473
|
-
|
|
2474
|
-
|
|
1523
|
+
"conversation_id" TEXT NOT NULL,
|
|
1524
|
+
"transcript_id" TEXT NOT NULL,
|
|
2475
1525
|
origin_run_id TEXT NOT NULL,
|
|
2476
1526
|
origin_tool_call_id TEXT NOT NULL,
|
|
2477
1527
|
status TEXT NOT NULL CHECK (status IN (
|
|
@@ -2479,19 +1529,12 @@ CREATE TABLE session_clarification_waits (
|
|
|
2479
1529
|
)),
|
|
2480
1530
|
version INTEGER NOT NULL,
|
|
2481
1531
|
data_json TEXT NOT NULL,
|
|
2482
|
-
UNIQUE(
|
|
1532
|
+
UNIQUE("transcript_id", origin_run_id, origin_tool_call_id)
|
|
2483
1533
|
);
|
|
2484
1534
|
|
|
2485
|
-
CREATE UNIQUE INDEX idx_clarification_wait_active
|
|
2486
|
-
ON session_clarification_waits(principal_id, session_id)
|
|
2487
|
-
WHERE status IN ('open', 'queued');
|
|
2488
|
-
|
|
2489
|
-
CREATE INDEX idx_clarification_wait_session
|
|
2490
|
-
ON session_clarification_waits(session_key, session_id, status);
|
|
2491
|
-
|
|
2492
1535
|
CREATE TABLE "session_inputs" (
|
|
2493
1536
|
id TEXT PRIMARY KEY,
|
|
2494
|
-
|
|
1537
|
+
"conversation_id" TEXT NOT NULL,
|
|
2495
1538
|
client_message_id TEXT NOT NULL,
|
|
2496
1539
|
requested_delivery TEXT NOT NULL CHECK (requested_delivery IN ('next', 'steer')),
|
|
2497
1540
|
effective_delivery TEXT NOT NULL CHECK (effective_delivery IN ('next', 'steer')),
|
|
@@ -2510,7 +1553,7 @@ CREATE TABLE "session_inputs" (
|
|
|
2510
1553
|
error TEXT,
|
|
2511
1554
|
created_at_ms INTEGER NOT NULL,
|
|
2512
1555
|
updated_at_ms INTEGER NOT NULL,
|
|
2513
|
-
|
|
1556
|
+
"expected_transcript_id" TEXT,
|
|
2514
1557
|
context_refs_json TEXT,
|
|
2515
1558
|
context_snapshots_json TEXT,
|
|
2516
1559
|
kind TEXT NOT NULL DEFAULT 'message' CHECK (
|
|
@@ -2518,23 +1561,7 @@ CREATE TABLE "session_inputs" (
|
|
|
2518
1561
|
),
|
|
2519
1562
|
payload_json TEXT,
|
|
2520
1563
|
task_run_id TEXT,
|
|
2521
|
-
UNIQUE(
|
|
2522
|
-
);
|
|
2523
|
-
|
|
2524
|
-
CREATE INDEX idx_session_inputs_pending
|
|
2525
|
-
ON session_inputs(session_key,status,position,created_at_ms);
|
|
2526
|
-
|
|
2527
|
-
CREATE TABLE devices (
|
|
2528
|
-
device_id TEXT PRIMARY KEY,
|
|
2529
|
-
display_name TEXT NOT NULL,
|
|
2530
|
-
platform TEXT NOT NULL CHECK (platform IN ('ios', 'android', 'chrome')),
|
|
2531
|
-
extension_id TEXT CHECK (extension_id IS NULL OR length(extension_id) = 32),
|
|
2532
|
-
public_key_jwk TEXT NOT NULL,
|
|
2533
|
-
scopes_json TEXT NOT NULL,
|
|
2534
|
-
created_at INTEGER NOT NULL,
|
|
2535
|
-
last_seen_at INTEGER,
|
|
2536
|
-
revoked_at INTEGER,
|
|
2537
|
-
CHECK ((platform = 'chrome') = (extension_id IS NOT NULL))
|
|
1564
|
+
UNIQUE("conversation_id", client_message_id)
|
|
2538
1565
|
);
|
|
2539
1566
|
|
|
2540
1567
|
CREATE TABLE device_refresh_credentials (
|
|
@@ -2558,21 +1585,6 @@ CREATE TABLE device_access_sessions (
|
|
|
2558
1585
|
revoked_at INTEGER
|
|
2559
1586
|
);
|
|
2560
1587
|
|
|
2561
|
-
CREATE TABLE device_push_endpoints (
|
|
2562
|
-
device_id TEXT PRIMARY KEY REFERENCES devices(device_id) ON DELETE CASCADE,
|
|
2563
|
-
platform TEXT NOT NULL CHECK (platform IN ('ios', 'android')),
|
|
2564
|
-
push_token TEXT NOT NULL UNIQUE,
|
|
2565
|
-
enabled INTEGER NOT NULL DEFAULT 1,
|
|
2566
|
-
permissions TEXT NOT NULL CHECK (permissions IN ('granted', 'denied', 'unknown')),
|
|
2567
|
-
preferences_json TEXT NOT NULL DEFAULT '{}',
|
|
2568
|
-
locale TEXT NOT NULL CHECK (locale IN ('en', 'zh')),
|
|
2569
|
-
app_version TEXT,
|
|
2570
|
-
lease_expires_at INTEGER NOT NULL,
|
|
2571
|
-
last_seen_at INTEGER NOT NULL,
|
|
2572
|
-
created_at INTEGER NOT NULL,
|
|
2573
|
-
updated_at INTEGER NOT NULL
|
|
2574
|
-
);
|
|
2575
|
-
|
|
2576
1588
|
CREATE TABLE notification_deliveries (
|
|
2577
1589
|
event_id TEXT NOT NULL,
|
|
2578
1590
|
device_id TEXT NOT NULL,
|
|
@@ -2587,18 +1599,9 @@ CREATE TABLE notification_deliveries (
|
|
|
2587
1599
|
FOREIGN KEY (device_id) REFERENCES device_push_endpoints(device_id) ON DELETE CASCADE
|
|
2588
1600
|
);
|
|
2589
1601
|
|
|
2590
|
-
CREATE INDEX idx_notification_deliveries_due
|
|
2591
|
-
ON notification_deliveries(status, next_attempt_at);
|
|
2592
|
-
|
|
2593
|
-
CREATE INDEX idx_device_refresh_credentials_device
|
|
2594
|
-
ON device_refresh_credentials(device_id, expires_at);
|
|
2595
|
-
|
|
2596
|
-
CREATE INDEX idx_device_access_sessions_device
|
|
2597
|
-
ON device_access_sessions(device_id, expires_at);
|
|
2598
|
-
|
|
2599
1602
|
CREATE TABLE browser_tab_bindings (
|
|
2600
1603
|
binding_id TEXT PRIMARY KEY,
|
|
2601
|
-
|
|
1604
|
+
"conversation_id" TEXT NOT NULL UNIQUE,
|
|
2602
1605
|
principal_id TEXT NOT NULL REFERENCES devices(device_id) ON DELETE CASCADE,
|
|
2603
1606
|
endpoint_id TEXT NOT NULL,
|
|
2604
1607
|
tab_id TEXT NOT NULL,
|
|
@@ -2610,8 +1613,6 @@ CREATE TABLE browser_tab_bindings (
|
|
|
2610
1613
|
expires_at INTEGER NOT NULL
|
|
2611
1614
|
);
|
|
2612
1615
|
|
|
2613
|
-
CREATE INDEX idx_browser_tab_bindings_expiry ON browser_tab_bindings(expires_at);
|
|
2614
|
-
|
|
2615
1616
|
CREATE TABLE endpoint_principals (
|
|
2616
1617
|
id TEXT PRIMARY KEY,
|
|
2617
1618
|
kind TEXT NOT NULL CHECK(kind IN ('web', 'desktop', 'mobile', 'browser')),
|
|
@@ -2630,259 +1631,1332 @@ CREATE TABLE endpoint_instance_bindings (
|
|
|
2630
1631
|
);
|
|
2631
1632
|
|
|
2632
1633
|
CREATE TABLE endpoint_session_bindings (
|
|
2633
|
-
|
|
1634
|
+
"conversation_id" TEXT PRIMARY KEY,
|
|
2634
1635
|
endpoint_id TEXT NOT NULL REFERENCES endpoint_instance_bindings(endpoint_id),
|
|
2635
1636
|
bound_at INTEGER NOT NULL
|
|
2636
1637
|
);
|
|
2637
1638
|
|
|
2638
|
-
CREATE
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
1639
|
+
CREATE TABLE browser_sessions (
|
|
1640
|
+
session_id TEXT PRIMARY KEY,
|
|
1641
|
+
token_hash TEXT NOT NULL UNIQUE,
|
|
1642
|
+
auth_fingerprint TEXT NOT NULL,
|
|
1643
|
+
created_at INTEGER NOT NULL,
|
|
1644
|
+
expires_at INTEGER NOT NULL
|
|
1645
|
+
);
|
|
2644
1646
|
|
|
2645
|
-
CREATE
|
|
2646
|
-
|
|
1647
|
+
CREATE TABLE device_pairing_sessions (
|
|
1648
|
+
pairing_id TEXT PRIMARY KEY,
|
|
1649
|
+
secret_hash TEXT NOT NULL,
|
|
1650
|
+
routes_json TEXT NOT NULL,
|
|
1651
|
+
expires_at INTEGER NOT NULL,
|
|
1652
|
+
attempts_remaining INTEGER NOT NULL CHECK (attempts_remaining >= 0),
|
|
1653
|
+
created_at INTEGER NOT NULL,
|
|
1654
|
+
consumed_at INTEGER,
|
|
1655
|
+
enrollment_issuer TEXT,
|
|
1656
|
+
enrollment_extension_id TEXT,
|
|
1657
|
+
enrollment_public_key_thumbprint TEXT,
|
|
1658
|
+
enrollment_nonce TEXT,
|
|
1659
|
+
target_kind TEXT NOT NULL CHECK (target_kind IN ('mobile', 'browser'))
|
|
1660
|
+
);
|
|
2647
1661
|
|
|
2648
|
-
CREATE TABLE
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
1662
|
+
CREATE TABLE device_pairing_requests (
|
|
1663
|
+
request_id TEXT PRIMARY KEY,
|
|
1664
|
+
pairing_id TEXT NOT NULL UNIQUE REFERENCES device_pairing_sessions(pairing_id) ON DELETE CASCADE,
|
|
1665
|
+
device_json TEXT NOT NULL,
|
|
1666
|
+
status TEXT NOT NULL CHECK (status IN ('pending', 'approved', 'completed', 'rejected', 'cancelled', 'expired')),
|
|
1667
|
+
revision INTEGER NOT NULL DEFAULT 1,
|
|
1668
|
+
confirmation_code TEXT NOT NULL,
|
|
1669
|
+
expires_at INTEGER NOT NULL,
|
|
1670
|
+
recovery_until INTEGER NOT NULL,
|
|
1671
|
+
completion_key TEXT,
|
|
1672
|
+
initial_token_hash TEXT,
|
|
1673
|
+
device_id TEXT REFERENCES devices(device_id),
|
|
1674
|
+
created_at INTEGER NOT NULL
|
|
2652
1675
|
);
|
|
2653
1676
|
|
|
2654
|
-
CREATE TABLE
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
1677
|
+
CREATE TABLE discussion_recording_chunks (
|
|
1678
|
+
discussion_id TEXT NOT NULL REFERENCES discussion_captures(id) ON DELETE CASCADE,
|
|
1679
|
+
sequence INTEGER NOT NULL CHECK(sequence >= 0),
|
|
1680
|
+
sha256 TEXT NOT NULL,
|
|
1681
|
+
bytes INTEGER NOT NULL CHECK(bytes > 0),
|
|
1682
|
+
PRIMARY KEY(discussion_id, sequence)
|
|
2658
1683
|
);
|
|
2659
1684
|
|
|
2660
|
-
CREATE TABLE
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
1685
|
+
CREATE TABLE discussion_transcript_revisions (
|
|
1686
|
+
discussion_id TEXT NOT NULL REFERENCES discussion_captures(id) ON DELETE CASCADE,
|
|
1687
|
+
revision INTEGER NOT NULL,
|
|
1688
|
+
segments_json TEXT NOT NULL,
|
|
1689
|
+
created_at INTEGER NOT NULL,
|
|
1690
|
+
PRIMARY KEY(discussion_id, revision)
|
|
2665
1691
|
);
|
|
2666
1692
|
|
|
2667
|
-
CREATE TABLE
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
1693
|
+
CREATE TABLE discussion_analysis_chunks (discussion_id TEXT NOT NULL REFERENCES discussion_captures(id) ON DELETE CASCADE, input_hash TEXT NOT NULL, result_json TEXT NOT NULL, PRIMARY KEY (discussion_id, input_hash));
|
|
1694
|
+
|
|
1695
|
+
CREATE TABLE discussion_action_tasks (
|
|
1696
|
+
discussion_id TEXT NOT NULL REFERENCES discussion_captures(id) ON DELETE CASCADE,
|
|
1697
|
+
action_id TEXT NOT NULL,
|
|
1698
|
+
task_id TEXT NOT NULL,
|
|
1699
|
+
organization_revision INTEGER NOT NULL,
|
|
1700
|
+
created_at INTEGER NOT NULL,
|
|
1701
|
+
PRIMARY KEY(discussion_id, action_id)
|
|
2672
1702
|
);
|
|
2673
1703
|
|
|
2674
|
-
CREATE
|
|
1704
|
+
CREATE TABLE discussion_edits (
|
|
1705
|
+
discussion_id TEXT NOT NULL REFERENCES discussion_captures(id) ON DELETE CASCADE,
|
|
1706
|
+
kind TEXT NOT NULL CHECK (kind IN ('summary', 'decisions', 'actionItems', 'risks', 'openQuestions')),
|
|
1707
|
+
item_id TEXT NOT NULL,
|
|
1708
|
+
value_json TEXT NOT NULL,
|
|
1709
|
+
updated_at INTEGER NOT NULL,
|
|
1710
|
+
PRIMARY KEY (discussion_id, kind, item_id)
|
|
1711
|
+
);
|
|
2675
1712
|
|
|
2676
|
-
CREATE TABLE
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
1713
|
+
CREATE TABLE discussion_recording_jobs (
|
|
1714
|
+
id TEXT PRIMARY KEY,
|
|
1715
|
+
discussion_id TEXT NOT NULL UNIQUE REFERENCES discussion_captures(id) ON DELETE CASCADE,
|
|
1716
|
+
input_json TEXT NOT NULL,
|
|
1717
|
+
manifest_hash TEXT NOT NULL,
|
|
1718
|
+
state TEXT NOT NULL CHECK(state IN ('queued', 'running', 'completed', 'failed', 'cancelled')),
|
|
1719
|
+
lease_owner TEXT,
|
|
1720
|
+
lease_until INTEGER,
|
|
1721
|
+
error TEXT,
|
|
1722
|
+
created_at INTEGER NOT NULL,
|
|
1723
|
+
updated_at INTEGER NOT NULL
|
|
2681
1724
|
);
|
|
2682
1725
|
|
|
2683
|
-
CREATE
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
1726
|
+
CREATE TABLE capability_imports (
|
|
1727
|
+
id TEXT PRIMARY KEY,
|
|
1728
|
+
owner TEXT NOT NULL,
|
|
1729
|
+
kind TEXT NOT NULL CHECK (kind IN ('scan', 'plan', 'job', 'run')),
|
|
1730
|
+
created_at INTEGER NOT NULL,
|
|
1731
|
+
idempotency_key TEXT,
|
|
1732
|
+
payload TEXT NOT NULL
|
|
1733
|
+
);
|
|
2687
1734
|
|
|
2688
|
-
CREATE
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
1735
|
+
CREATE TABLE import_selections (
|
|
1736
|
+
id TEXT PRIMARY KEY,
|
|
1737
|
+
owner TEXT NOT NULL,
|
|
1738
|
+
kind TEXT NOT NULL CHECK (kind IN ('inventory', 'run')),
|
|
1739
|
+
created_at INTEGER NOT NULL,
|
|
1740
|
+
payload TEXT NOT NULL
|
|
1741
|
+
);
|
|
2694
1742
|
|
|
2695
|
-
CREATE
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
1743
|
+
CREATE TABLE conversation_routes (
|
|
1744
|
+
route_key TEXT PRIMARY KEY,
|
|
1745
|
+
conversation_id TEXT NOT NULL REFERENCES sessions("conversation_id") ON DELETE CASCADE
|
|
1746
|
+
);
|
|
2699
1747
|
|
|
2700
|
-
CREATE
|
|
2701
|
-
|
|
2702
|
-
|
|
1748
|
+
CREATE VIRTUAL TABLE "transcript_fts" USING fts5(
|
|
1749
|
+
content, conversation_id UNINDEXED, transcript_id UNINDEXED, entry_id UNINDEXED, tokenize='unicode61'
|
|
1750
|
+
);
|
|
2703
1751
|
|
|
2704
|
-
CREATE TABLE
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
1752
|
+
CREATE TABLE "devices" (
|
|
1753
|
+
device_id TEXT PRIMARY KEY,
|
|
1754
|
+
display_name TEXT NOT NULL,
|
|
1755
|
+
platform TEXT NOT NULL CHECK (platform IN ('ios', 'android', 'harmonyos', 'chrome')),
|
|
1756
|
+
extension_id TEXT CHECK (extension_id IS NULL OR length(extension_id) = 32),
|
|
1757
|
+
public_key_jwk TEXT NOT NULL,
|
|
1758
|
+
scopes_json TEXT NOT NULL,
|
|
1759
|
+
created_at INTEGER NOT NULL,
|
|
1760
|
+
last_seen_at INTEGER,
|
|
1761
|
+
revoked_at INTEGER,
|
|
1762
|
+
CHECK ((platform = 'chrome') = (extension_id IS NOT NULL))
|
|
2709
1763
|
);
|
|
2710
1764
|
|
|
2711
|
-
CREATE
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
1765
|
+
CREATE TABLE "device_push_endpoints" (
|
|
1766
|
+
device_id TEXT PRIMARY KEY REFERENCES devices(device_id) ON DELETE CASCADE,
|
|
1767
|
+
platform TEXT NOT NULL CHECK (platform IN ('ios', 'android', 'harmonyos')),
|
|
1768
|
+
push_token TEXT NOT NULL UNIQUE,
|
|
1769
|
+
enabled INTEGER NOT NULL DEFAULT 1,
|
|
1770
|
+
permissions TEXT NOT NULL CHECK (permissions IN ('granted', 'denied', 'unknown')),
|
|
1771
|
+
preferences_json TEXT NOT NULL DEFAULT '{}',
|
|
1772
|
+
locale TEXT NOT NULL CHECK (locale IN ('en', 'zh')),
|
|
1773
|
+
app_version TEXT,
|
|
1774
|
+
lease_expires_at INTEGER NOT NULL,
|
|
1775
|
+
last_seen_at INTEGER NOT NULL,
|
|
1776
|
+
created_at INTEGER NOT NULL,
|
|
1777
|
+
updated_at INTEGER NOT NULL
|
|
2720
1778
|
);
|
|
2721
1779
|
|
|
2722
|
-
CREATE TABLE
|
|
1780
|
+
CREATE TABLE connector_backends (
|
|
2723
1781
|
id TEXT PRIMARY KEY,
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
1782
|
+
mode TEXT NOT NULL CHECK(mode IN ('managed', 'byok')),
|
|
1783
|
+
label TEXT NOT NULL,
|
|
1784
|
+
credential_ref TEXT,
|
|
1785
|
+
credential_source TEXT NOT NULL DEFAULT 'stored' CHECK(credential_source IN ('stored','environment')),
|
|
1786
|
+
verified_at TEXT,
|
|
1787
|
+
active INTEGER NOT NULL DEFAULT 0,
|
|
2728
1788
|
created_at TEXT NOT NULL
|
|
2729
1789
|
);
|
|
2730
1790
|
|
|
2731
|
-
CREATE TABLE
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
1791
|
+
CREATE TABLE connector_objective_accounts (
|
|
1792
|
+
conversation_id TEXT NOT NULL,
|
|
1793
|
+
transcript_id TEXT NOT NULL,
|
|
1794
|
+
objective_id TEXT NOT NULL,
|
|
1795
|
+
connector_id TEXT NOT NULL,
|
|
1796
|
+
account_id TEXT NOT NULL REFERENCES connector_accounts(id) ON DELETE CASCADE,
|
|
1797
|
+
PRIMARY KEY(conversation_id, transcript_id, objective_id, connector_id, account_id)
|
|
1798
|
+
);
|
|
1799
|
+
|
|
1800
|
+
CREATE TABLE "connector_connections" (
|
|
1801
|
+
id TEXT PRIMARY KEY,
|
|
1802
|
+
installation_id TEXT REFERENCES connector_installations(id) ON DELETE SET NULL,
|
|
1803
|
+
connector_id TEXT NOT NULL,
|
|
1804
|
+
provider TEXT NOT NULL,
|
|
1805
|
+
principal_id TEXT NOT NULL,
|
|
1806
|
+
provider_connection_id TEXT NOT NULL,
|
|
1807
|
+
alias TEXT,
|
|
1808
|
+
identity_json TEXT NOT NULL DEFAULT '{}',
|
|
1809
|
+
status TEXT NOT NULL DEFAULT 'unknown' CHECK(status IN ('pending','active','expired','failed','revoked','disabled','unknown')),
|
|
1810
|
+
is_default INTEGER NOT NULL DEFAULT 0 CHECK(is_default IN (0,1)),
|
|
1811
|
+
connected_at TEXT,
|
|
1812
|
+
expires_at TEXT,
|
|
2740
1813
|
last_error TEXT,
|
|
2741
|
-
|
|
1814
|
+
metadata_json TEXT NOT NULL DEFAULT '{}',
|
|
1815
|
+
created_at TEXT NOT NULL,
|
|
1816
|
+
updated_at TEXT NOT NULL,
|
|
1817
|
+
account_id TEXT REFERENCES connector_accounts(id) ON DELETE CASCADE
|
|
2742
1818
|
);
|
|
2743
1819
|
|
|
2744
|
-
CREATE
|
|
1820
|
+
CREATE TABLE connector_authorization_attempts (
|
|
1821
|
+
id TEXT PRIMARY KEY,
|
|
1822
|
+
principal_id TEXT NOT NULL,
|
|
1823
|
+
connector_id TEXT NOT NULL,
|
|
1824
|
+
backend_id TEXT,
|
|
1825
|
+
connection_id TEXT NOT NULL REFERENCES connector_connections(id) ON DELETE CASCADE,
|
|
1826
|
+
expected_account_id TEXT,
|
|
1827
|
+
authorization_url TEXT,
|
|
1828
|
+
status TEXT NOT NULL CHECK(status IN ('awaiting_user','succeeded','failed','expired')),
|
|
1829
|
+
expires_at INTEGER NOT NULL,
|
|
1830
|
+
created_at INTEGER NOT NULL
|
|
1831
|
+
);
|
|
2745
1832
|
|
|
2746
|
-
CREATE
|
|
1833
|
+
CREATE TABLE connector_runtime_identity (id INTEGER PRIMARY KEY CHECK(id = 1), installation_id TEXT NOT NULL);
|
|
2747
1834
|
|
|
2748
|
-
CREATE TABLE
|
|
2749
|
-
|
|
2750
|
-
|
|
1835
|
+
CREATE TABLE memory_suppressions (
|
|
1836
|
+
fingerprint TEXT PRIMARY KEY,
|
|
1837
|
+
created_at INTEGER NOT NULL
|
|
2751
1838
|
);
|
|
2752
1839
|
|
|
2753
|
-
CREATE TABLE
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
1840
|
+
CREATE TABLE understanding_refresh_batches (
|
|
1841
|
+
batch_id TEXT PRIMARY KEY,
|
|
1842
|
+
source_run_ids_json TEXT NOT NULL,
|
|
1843
|
+
created_at INTEGER NOT NULL
|
|
2757
1844
|
);
|
|
2758
1845
|
|
|
2759
|
-
CREATE
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
created_at TEXT NOT NULL, notification_id TEXT, UNIQUE(workspace_id, occurrence_key)
|
|
1846
|
+
CREATE TABLE sidebar_layouts (
|
|
1847
|
+
container_id TEXT PRIMARY KEY,
|
|
1848
|
+
revision INTEGER NOT NULL DEFAULT 0,
|
|
1849
|
+
updated_at INTEGER NOT NULL
|
|
2764
1850
|
);
|
|
2765
1851
|
|
|
2766
|
-
CREATE TABLE
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
1852
|
+
CREATE TABLE sidebar_positions (
|
|
1853
|
+
container_id TEXT NOT NULL REFERENCES sidebar_layouts(container_id) ON DELETE CASCADE,
|
|
1854
|
+
item_id TEXT NOT NULL,
|
|
1855
|
+
position INTEGER NOT NULL,
|
|
1856
|
+
PRIMARY KEY (container_id, item_id),
|
|
1857
|
+
UNIQUE (container_id, position)
|
|
2770
1858
|
);
|
|
2771
1859
|
|
|
2772
|
-
CREATE TABLE
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
1860
|
+
CREATE TABLE connector_cli_authorizations (
|
|
1861
|
+
id TEXT PRIMARY KEY,
|
|
1862
|
+
instance_id TEXT NOT NULL,
|
|
1863
|
+
connector_id TEXT NOT NULL,
|
|
1864
|
+
principal_id TEXT NOT NULL,
|
|
1865
|
+
expected_account_id TEXT,
|
|
1866
|
+
context_id TEXT NOT NULL,
|
|
1867
|
+
phase TEXT NOT NULL CHECK(phase IN ('preparing','awaiting_user','verifying','succeeded','failed','expired','cancelled')),
|
|
1868
|
+
challenge_json TEXT,
|
|
1869
|
+
error TEXT,
|
|
1870
|
+
account_id TEXT,
|
|
1871
|
+
owner_id TEXT NOT NULL,
|
|
1872
|
+
expires_at INTEGER NOT NULL,
|
|
1873
|
+
updated_at INTEGER NOT NULL
|
|
2777
1874
|
);
|
|
2778
1875
|
|
|
2779
|
-
CREATE TABLE
|
|
2780
|
-
id TEXT PRIMARY KEY,
|
|
2781
|
-
|
|
1876
|
+
CREATE TABLE connector_cli_executions (
|
|
1877
|
+
id TEXT PRIMARY KEY,
|
|
1878
|
+
instance_id TEXT NOT NULL,
|
|
1879
|
+
account_id TEXT NOT NULL,
|
|
1880
|
+
connection_id TEXT NOT NULL,
|
|
1881
|
+
action_id TEXT NOT NULL,
|
|
1882
|
+
revision TEXT NOT NULL,
|
|
1883
|
+
arguments_hash TEXT NOT NULL,
|
|
1884
|
+
status TEXT NOT NULL CHECK(status IN ('running','success','failed','unknown')),
|
|
1885
|
+
owner_id TEXT NOT NULL,
|
|
1886
|
+
error_kind TEXT,
|
|
1887
|
+
started_at INTEGER NOT NULL,
|
|
1888
|
+
finished_at INTEGER
|
|
2782
1889
|
);
|
|
2783
1890
|
|
|
2784
|
-
CREATE TABLE
|
|
2785
|
-
|
|
2786
|
-
|
|
1891
|
+
CREATE TABLE capability_operations (
|
|
1892
|
+
operation_id TEXT PRIMARY KEY,
|
|
1893
|
+
principal_id TEXT NOT NULL,
|
|
1894
|
+
capability_id TEXT NOT NULL,
|
|
1895
|
+
idempotency_key TEXT NOT NULL,
|
|
1896
|
+
request_digest TEXT NOT NULL,
|
|
1897
|
+
descriptor_digest TEXT NOT NULL,
|
|
1898
|
+
result_json TEXT NOT NULL CHECK (json_valid(result_json)),
|
|
1899
|
+
created_at INTEGER NOT NULL, state TEXT NOT NULL DEFAULT 'succeeded'
|
|
1900
|
+
CHECK (state IN ('running', 'succeeded', 'failed', 'unknown')), generation INTEGER NOT NULL DEFAULT 1, recovery_mode TEXT NOT NULL DEFAULT 'atomic'
|
|
1901
|
+
CHECK (recovery_mode IN ('atomic', 'manual', 'provider-idempotent')), lease_expires_at INTEGER, evidence_json TEXT CHECK (evidence_json IS NULL OR json_valid(evidence_json)),
|
|
1902
|
+
UNIQUE(principal_id, capability_id, idempotency_key)
|
|
1903
|
+
);
|
|
1904
|
+
|
|
1905
|
+
CREATE TABLE capability_invocations (
|
|
1906
|
+
invocation_id TEXT PRIMARY KEY,
|
|
1907
|
+
operation_id TEXT NOT NULL REFERENCES capability_operations(operation_id) ON DELETE CASCADE,
|
|
1908
|
+
surface TEXT NOT NULL,
|
|
1909
|
+
replayed INTEGER NOT NULL CHECK (replayed IN (0, 1)),
|
|
1910
|
+
created_at INTEGER NOT NULL
|
|
1911
|
+
, state TEXT NOT NULL DEFAULT 'succeeded'
|
|
1912
|
+
CHECK (state IN ('running', 'succeeded', 'failed', 'unknown')), finished_at INTEGER);
|
|
2787
1913
|
|
|
2788
|
-
CREATE TABLE
|
|
2789
|
-
|
|
2790
|
-
|
|
1914
|
+
CREATE TABLE note_file_cleanup (
|
|
1915
|
+
note_id TEXT NOT NULL,
|
|
1916
|
+
relative_path TEXT NOT NULL,
|
|
1917
|
+
created_at INTEGER NOT NULL,
|
|
1918
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
1919
|
+
next_attempt_at INTEGER NOT NULL DEFAULT 0,
|
|
1920
|
+
PRIMARY KEY (note_id, relative_path)
|
|
2791
1921
|
);
|
|
2792
1922
|
|
|
2793
|
-
CREATE TABLE
|
|
2794
|
-
|
|
2795
|
-
|
|
1923
|
+
CREATE TABLE automation_deleted_revisions (
|
|
1924
|
+
automation_id TEXT PRIMARY KEY,
|
|
1925
|
+
revision INTEGER NOT NULL CHECK (revision >= 0)
|
|
2796
1926
|
);
|
|
2797
1927
|
|
|
2798
|
-
CREATE
|
|
2799
|
-
|
|
2800
|
-
|
|
1928
|
+
CREATE TABLE automation_run_requests (
|
|
1929
|
+
run_id TEXT PRIMARY KEY,
|
|
1930
|
+
automation_json TEXT NOT NULL CHECK (json_valid(automation_json))
|
|
1931
|
+
);
|
|
2801
1932
|
|
|
2802
|
-
CREATE TABLE
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
due_at TEXT NOT NULL,
|
|
2810
|
-
status TEXT NOT NULL DEFAULT 'watching' CHECK(status IN ('watching', 'paused', 'completed')),
|
|
2811
|
-
revision INTEGER NOT NULL DEFAULT 1,
|
|
2812
|
-
last_fingerprint TEXT,
|
|
2813
|
-
last_checked_at TEXT,
|
|
2814
|
-
session_key TEXT REFERENCES sessions(session_key) ON DELETE SET NULL,
|
|
2815
|
-
created_at TEXT NOT NULL,
|
|
2816
|
-
updated_at TEXT NOT NULL,
|
|
2817
|
-
UNIQUE(workspace_id, thread_key)
|
|
1933
|
+
CREATE TABLE note_deletion_cleanup (
|
|
1934
|
+
kind TEXT NOT NULL CHECK(kind IN ('media', 'share')),
|
|
1935
|
+
object_id TEXT NOT NULL,
|
|
1936
|
+
created_at INTEGER NOT NULL,
|
|
1937
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
1938
|
+
next_attempt_at INTEGER NOT NULL DEFAULT 0,
|
|
1939
|
+
PRIMARY KEY(kind, object_id)
|
|
2818
1940
|
);
|
|
2819
1941
|
|
|
2820
|
-
CREATE
|
|
1942
|
+
CREATE TABLE project_workspace_creation (
|
|
1943
|
+
project_id TEXT PRIMARY KEY REFERENCES projects(project_id) ON DELETE CASCADE,
|
|
1944
|
+
workspace_root TEXT NOT NULL,
|
|
1945
|
+
created_at INTEGER NOT NULL,
|
|
1946
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
1947
|
+
next_attempt_at INTEGER NOT NULL DEFAULT 0
|
|
1948
|
+
);
|
|
2821
1949
|
|
|
2822
|
-
CREATE TABLE
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
1950
|
+
CREATE TABLE knowledge_items (
|
|
1951
|
+
knowledge_id TEXT PRIMARY KEY,
|
|
1952
|
+
principal_id TEXT NOT NULL,
|
|
1953
|
+
kind TEXT NOT NULL CHECK(kind IN (
|
|
1954
|
+
'work_thread', 'project_fact', 'workspace_fact', 'decision', 'task_lesson',
|
|
1955
|
+
'commitment', 'open_question', 'episode', 'note'
|
|
1956
|
+
)),
|
|
1957
|
+
scope_type TEXT NOT NULL CHECK(scope_type IN ('global', 'agent', 'workspace', 'project', 'session')),
|
|
1958
|
+
scope_id TEXT,
|
|
1959
|
+
content TEXT NOT NULL,
|
|
1960
|
+
canonical_key TEXT NOT NULL,
|
|
1961
|
+
status TEXT NOT NULL CHECK(status IN ('candidate', 'active', 'needs_review', 'stale', 'archived', 'rejected')),
|
|
1962
|
+
confidence REAL NOT NULL CHECK(confidence >= 0 AND confidence <= 1),
|
|
1963
|
+
importance REAL NOT NULL CHECK(importance >= 0 AND importance <= 1),
|
|
1964
|
+
valid_from INTEGER,
|
|
1965
|
+
valid_to INTEGER,
|
|
1966
|
+
expires_at INTEGER,
|
|
1967
|
+
review_at INTEGER,
|
|
1968
|
+
origin_class TEXT NOT NULL CHECK(origin_class IN ('owner', 'agent', 'system', 'untrusted')),
|
|
1969
|
+
source_agent_id TEXT,
|
|
1970
|
+
source_conversation_id TEXT,
|
|
1971
|
+
source_turn_id TEXT,
|
|
1972
|
+
derived_from_recalled_context INTEGER NOT NULL DEFAULT 0 CHECK(derived_from_recalled_context IN (0, 1)),
|
|
1973
|
+
source_json TEXT NOT NULL DEFAULT '{}' CHECK(json_valid(source_json)),
|
|
2826
1974
|
created_at INTEGER NOT NULL,
|
|
2827
|
-
|
|
1975
|
+
updated_at INTEGER NOT NULL,
|
|
1976
|
+
record_class TEXT NOT NULL DEFAULT 'memory' CHECK(record_class IN ('memory', 'source_index')),
|
|
1977
|
+
CHECK(valid_to IS NULL OR valid_from IS NULL OR valid_to >= valid_from)
|
|
2828
1978
|
);
|
|
2829
1979
|
|
|
2830
|
-
CREATE
|
|
1980
|
+
CREATE TABLE knowledge_item_status_events (
|
|
1981
|
+
event_id TEXT PRIMARY KEY,
|
|
1982
|
+
knowledge_id TEXT NOT NULL REFERENCES knowledge_items(knowledge_id) ON DELETE CASCADE,
|
|
1983
|
+
from_status TEXT,
|
|
1984
|
+
to_status TEXT NOT NULL,
|
|
1985
|
+
actor_type TEXT NOT NULL CHECK(actor_type IN ('user', 'agent', 'runtime', 'maintenance', 'migration')),
|
|
1986
|
+
reason TEXT NOT NULL,
|
|
1987
|
+
created_at INTEGER NOT NULL
|
|
1988
|
+
);
|
|
2831
1989
|
|
|
2832
|
-
CREATE TABLE
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
1990
|
+
CREATE TABLE context_extraction_outputs (
|
|
1991
|
+
output_id TEXT PRIMARY KEY,
|
|
1992
|
+
extraction_run_id TEXT NOT NULL REFERENCES context_extraction_runs(extraction_run_id) ON DELETE CASCADE,
|
|
1993
|
+
ordinal INTEGER NOT NULL,
|
|
1994
|
+
candidate_key TEXT NOT NULL,
|
|
1995
|
+
object_type TEXT CHECK (object_type IN ('assertion', 'rule', 'goal', 'knowledge')),
|
|
1996
|
+
object_id TEXT,
|
|
1997
|
+
version_id TEXT,
|
|
1998
|
+
outcome TEXT NOT NULL CHECK (outcome IN ('created', 'deduplicated', 'rejected')),
|
|
2838
1999
|
created_at INTEGER NOT NULL,
|
|
2839
|
-
|
|
2840
|
-
enrollment_issuer TEXT,
|
|
2841
|
-
enrollment_extension_id TEXT,
|
|
2842
|
-
enrollment_public_key_thumbprint TEXT,
|
|
2843
|
-
enrollment_nonce TEXT,
|
|
2844
|
-
target_kind TEXT NOT NULL CHECK (target_kind IN ('mobile', 'browser'))
|
|
2000
|
+
UNIQUE (extraction_run_id, ordinal)
|
|
2845
2001
|
);
|
|
2846
2002
|
|
|
2847
|
-
CREATE
|
|
2848
|
-
|
|
2003
|
+
CREATE TABLE chat_previews (
|
|
2004
|
+
preview_id TEXT PRIMARY KEY,
|
|
2005
|
+
conversation_id TEXT NOT NULL REFERENCES sessions(conversation_id) ON DELETE CASCADE,
|
|
2006
|
+
title TEXT NOT NULL,
|
|
2007
|
+
preferred_height INTEGER NOT NULL CHECK (preferred_height BETWEEN 240 AND 720),
|
|
2008
|
+
latest_revision TEXT NOT NULL CHECK (length(latest_revision) = 64),
|
|
2009
|
+
created_at INTEGER NOT NULL,
|
|
2010
|
+
updated_at INTEGER NOT NULL
|
|
2011
|
+
);
|
|
2849
2012
|
|
|
2850
|
-
CREATE TABLE
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
completion_key TEXT,
|
|
2860
|
-
initial_token_hash TEXT,
|
|
2861
|
-
device_id TEXT REFERENCES devices(device_id),
|
|
2862
|
-
created_at INTEGER NOT NULL
|
|
2013
|
+
CREATE TABLE chat_preview_revisions (
|
|
2014
|
+
preview_id TEXT NOT NULL REFERENCES chat_previews(preview_id) ON DELETE CASCADE,
|
|
2015
|
+
source_hash TEXT NOT NULL CHECK (length(source_hash) = 64),
|
|
2016
|
+
markup TEXT NOT NULL,
|
|
2017
|
+
styles TEXT NOT NULL,
|
|
2018
|
+
script TEXT NOT NULL,
|
|
2019
|
+
promoted_app_id TEXT UNIQUE REFERENCES local_apps(app_id) ON DELETE SET NULL,
|
|
2020
|
+
created_at INTEGER NOT NULL,
|
|
2021
|
+
PRIMARY KEY (preview_id, source_hash)
|
|
2863
2022
|
);
|
|
2864
2023
|
|
|
2865
|
-
CREATE
|
|
2866
|
-
|
|
2024
|
+
CREATE TABLE "context_snapshots" (
|
|
2025
|
+
snapshot_id TEXT PRIMARY KEY,
|
|
2026
|
+
trace_id TEXT NOT NULL UNIQUE,
|
|
2027
|
+
owner_kind TEXT NOT NULL CHECK (owner_kind IN ('task_run', 'task', 'session')),
|
|
2028
|
+
owner_id TEXT NOT NULL,
|
|
2029
|
+
conversation_id TEXT,
|
|
2030
|
+
query TEXT NOT NULL,
|
|
2031
|
+
selected_items_json TEXT NOT NULL DEFAULT '[]',
|
|
2032
|
+
rejected_items_json TEXT NOT NULL DEFAULT '[]',
|
|
2033
|
+
consent_requests_json TEXT NOT NULL DEFAULT '[]',
|
|
2034
|
+
relationship_policy_json TEXT NOT NULL DEFAULT '{}',
|
|
2035
|
+
estimated_tokens INTEGER NOT NULL DEFAULT 0,
|
|
2036
|
+
allocation_json TEXT,
|
|
2037
|
+
authorization_snapshot_json TEXT NOT NULL DEFAULT '{}',
|
|
2038
|
+
content_hash TEXT,
|
|
2039
|
+
created_at INTEGER NOT NULL,
|
|
2040
|
+
FOREIGN KEY (conversation_id) REFERENCES sessions(conversation_id) ON DELETE SET NULL
|
|
2041
|
+
);
|
|
2042
|
+
|
|
2043
|
+
CREATE TABLE "collaboration_rules" (
|
|
2044
|
+
rule_id TEXT PRIMARY KEY,
|
|
2045
|
+
principal_id TEXT NOT NULL,
|
|
2046
|
+
category TEXT NOT NULL CHECK (category IN ('communication', 'execution', 'boundary', 'routine', 'initiative')),
|
|
2047
|
+
status TEXT NOT NULL CHECK (status IN ('active', 'disabled', 'archived')),
|
|
2048
|
+
priority INTEGER NOT NULL DEFAULT 100,
|
|
2049
|
+
scope_type TEXT NOT NULL CHECK (scope_type IN ('global', 'workspace', 'project', 'session')),
|
|
2050
|
+
scope_id TEXT,
|
|
2051
|
+
conditions_json TEXT NOT NULL DEFAULT '{}',
|
|
2052
|
+
current_revision_id TEXT NOT NULL REFERENCES collaboration_rule_revisions(revision_id)
|
|
2053
|
+
DEFERRABLE INITIALLY DEFERRED,
|
|
2054
|
+
created_at INTEGER NOT NULL,
|
|
2055
|
+
updated_at INTEGER NOT NULL
|
|
2056
|
+
);
|
|
2057
|
+
|
|
2058
|
+
CREATE TABLE home_advice_generations (
|
|
2059
|
+
generation_id TEXT PRIMARY KEY,
|
|
2060
|
+
owner_id TEXT NOT NULL,
|
|
2061
|
+
workspace_id TEXT NOT NULL,
|
|
2062
|
+
idempotency_key TEXT NOT NULL,
|
|
2063
|
+
status TEXT NOT NULL CHECK(status IN ('queued', 'running', 'succeeded', 'skipped', 'retry_wait', 'failed', 'cancelled')),
|
|
2064
|
+
reasons_json TEXT NOT NULL DEFAULT '[]' CHECK(json_valid(reasons_json)),
|
|
2065
|
+
requested_at INTEGER NOT NULL,
|
|
2066
|
+
started_at INTEGER,
|
|
2067
|
+
completed_at INTEGER,
|
|
2068
|
+
retry_at INTEGER,
|
|
2069
|
+
lease_owner TEXT,
|
|
2070
|
+
lease_until INTEGER,
|
|
2071
|
+
lease_epoch INTEGER NOT NULL DEFAULT 0,
|
|
2072
|
+
attempt INTEGER NOT NULL DEFAULT 0,
|
|
2073
|
+
dirty_after_start INTEGER NOT NULL DEFAULT 0 CHECK(dirty_after_start IN (0, 1)),
|
|
2074
|
+
snapshot_hash TEXT,
|
|
2075
|
+
evidence_ids_json TEXT NOT NULL DEFAULT '[]' CHECK(json_valid(evidence_ids_json)),
|
|
2076
|
+
result_json TEXT CHECK(result_json IS NULL OR json_valid(result_json)),
|
|
2077
|
+
model_ref TEXT,
|
|
2078
|
+
input_tokens INTEGER,
|
|
2079
|
+
output_tokens INTEGER,
|
|
2080
|
+
estimated_cost_usd REAL,
|
|
2081
|
+
outcome_reason TEXT,
|
|
2082
|
+
error_code TEXT
|
|
2083
|
+
, strategy_version TEXT NOT NULL DEFAULT 'home-v1');
|
|
2084
|
+
|
|
2085
|
+
CREATE TABLE home_opportunity_projections (
|
|
2086
|
+
opportunity_id TEXT PRIMARY KEY,
|
|
2087
|
+
generation_id TEXT NOT NULL REFERENCES home_advice_generations(generation_id) ON DELETE CASCADE,
|
|
2088
|
+
owner_id TEXT NOT NULL,
|
|
2089
|
+
workspace_id TEXT NOT NULL,
|
|
2090
|
+
rank INTEGER NOT NULL CHECK(rank BETWEEN 0 AND 2),
|
|
2091
|
+
kind TEXT NOT NULL CHECK(kind IN ('project_next_step', 'delivery_risk', 'meeting_prep', 'commitment_follow_up', 'automation_candidate')),
|
|
2092
|
+
project_id TEXT,
|
|
2093
|
+
dedupe_key TEXT NOT NULL,
|
|
2094
|
+
content_json TEXT NOT NULL CHECK(json_valid(content_json)),
|
|
2095
|
+
evidence_refs_json TEXT NOT NULL DEFAULT '[]' CHECK(json_valid(evidence_refs_json)),
|
|
2096
|
+
snapshot_hash TEXT NOT NULL,
|
|
2097
|
+
state TEXT NOT NULL CHECK(state IN ('active', 'snoozed', 'accepted', 'discussing', 'dismissed', 'expired', 'superseded')),
|
|
2098
|
+
revision INTEGER NOT NULL DEFAULT 1 CHECK(revision > 0),
|
|
2099
|
+
created_at INTEGER NOT NULL,
|
|
2100
|
+
updated_at INTEGER NOT NULL,
|
|
2101
|
+
expires_at INTEGER NOT NULL,
|
|
2102
|
+
snoozed_until INTEGER,
|
|
2103
|
+
resolution_kind TEXT CHECK(resolution_kind IS NULL OR resolution_kind IN ('session', 'task')),
|
|
2104
|
+
resolution_ref TEXT
|
|
2105
|
+
);
|
|
2106
|
+
|
|
2107
|
+
CREATE TABLE home_opportunity_feedback (
|
|
2108
|
+
feedback_id TEXT PRIMARY KEY,
|
|
2109
|
+
opportunity_id TEXT NOT NULL REFERENCES home_opportunity_projections(opportunity_id) ON DELETE CASCADE,
|
|
2110
|
+
idempotency_key TEXT NOT NULL UNIQUE,
|
|
2111
|
+
kind TEXT NOT NULL CHECK(kind IN ('started', 'discussed', 'already_done', 'irrelevant', 'too_early', 'source_incorrect', 'less_like_this', 'snoozed')),
|
|
2112
|
+
reason_code TEXT,
|
|
2113
|
+
note TEXT,
|
|
2114
|
+
scope_json TEXT NOT NULL DEFAULT '{}' CHECK(json_valid(scope_json)),
|
|
2115
|
+
created_at INTEGER NOT NULL
|
|
2116
|
+
);
|
|
2117
|
+
|
|
2118
|
+
CREATE TABLE agent_catalog_settings (
|
|
2119
|
+
singleton_id INTEGER PRIMARY KEY CHECK(singleton_id = 1),
|
|
2120
|
+
default_agent_id TEXT NOT NULL REFERENCES agents(id),
|
|
2121
|
+
defaults_json TEXT NOT NULL CHECK(json_valid(defaults_json)),
|
|
2122
|
+
revision INTEGER NOT NULL CHECK(revision > 0),
|
|
2123
|
+
created_at INTEGER NOT NULL,
|
|
2124
|
+
updated_at INTEGER NOT NULL
|
|
2125
|
+
);
|
|
2126
|
+
|
|
2127
|
+
CREATE TABLE agents (
|
|
2128
|
+
id TEXT PRIMARY KEY,
|
|
2129
|
+
enabled INTEGER NOT NULL CHECK(enabled IN (0, 1)),
|
|
2130
|
+
workspace_override TEXT,
|
|
2131
|
+
profile_json TEXT CHECK(profile_json IS NULL OR json_valid(profile_json)),
|
|
2132
|
+
overrides_json TEXT NOT NULL CHECK(json_valid(overrides_json)),
|
|
2133
|
+
provisioning_state TEXT NOT NULL CHECK(provisioning_state IN ('pending', 'ready', 'error')),
|
|
2134
|
+
provisioning_error TEXT,
|
|
2135
|
+
revision INTEGER NOT NULL CHECK(revision > 0),
|
|
2136
|
+
created_at INTEGER NOT NULL,
|
|
2137
|
+
updated_at INTEGER NOT NULL,
|
|
2138
|
+
deleted_at INTEGER
|
|
2139
|
+
);
|
|
2140
|
+
|
|
2141
|
+
CREATE TABLE agent_bindings (
|
|
2142
|
+
id TEXT PRIMARY KEY,
|
|
2143
|
+
agent_id TEXT NOT NULL REFERENCES agents(id),
|
|
2144
|
+
position INTEGER NOT NULL CHECK(position >= 0),
|
|
2145
|
+
rule_json TEXT NOT NULL CHECK(json_valid(rule_json)),
|
|
2146
|
+
revision INTEGER NOT NULL CHECK(revision > 0),
|
|
2147
|
+
created_at INTEGER NOT NULL,
|
|
2148
|
+
updated_at INTEGER NOT NULL,
|
|
2149
|
+
UNIQUE(position)
|
|
2150
|
+
);
|
|
2151
|
+
|
|
2152
|
+
CREATE TABLE agent_surface_defaults (
|
|
2153
|
+
surface TEXT PRIMARY KEY,
|
|
2154
|
+
agent_id TEXT NOT NULL REFERENCES agents(id),
|
|
2155
|
+
revision INTEGER NOT NULL CHECK(revision > 0),
|
|
2156
|
+
updated_at INTEGER NOT NULL
|
|
2157
|
+
);
|
|
2158
|
+
|
|
2159
|
+
CREATE TABLE agent_provisioning_jobs (
|
|
2160
|
+
agent_id TEXT PRIMARY KEY REFERENCES agents(id) ON DELETE CASCADE,
|
|
2161
|
+
operation TEXT NOT NULL CHECK(operation IN ('provision', 'purge')),
|
|
2162
|
+
state TEXT NOT NULL CHECK(state IN ('pending', 'running', 'failed')),
|
|
2163
|
+
attempts INTEGER NOT NULL DEFAULT 0 CHECK(attempts >= 0),
|
|
2164
|
+
last_error TEXT,
|
|
2165
|
+
created_at INTEGER NOT NULL,
|
|
2166
|
+
updated_at INTEGER NOT NULL
|
|
2167
|
+
);
|
|
2168
|
+
|
|
2169
|
+
CREATE TABLE application_migrations (
|
|
2170
|
+
id TEXT PRIMARY KEY,
|
|
2171
|
+
state TEXT NOT NULL,
|
|
2172
|
+
source_digest TEXT,
|
|
2173
|
+
source_backup_path TEXT,
|
|
2174
|
+
database_backup_path TEXT,
|
|
2175
|
+
error_json TEXT CHECK(error_json IS NULL OR json_valid(error_json)),
|
|
2176
|
+
started_at INTEGER NOT NULL,
|
|
2177
|
+
completed_at INTEGER,
|
|
2178
|
+
updated_at INTEGER NOT NULL
|
|
2179
|
+
);
|
|
2180
|
+
|
|
2181
|
+
CREATE TABLE understanding_consent_receipts (
|
|
2182
|
+
receipt_id TEXT PRIMARY KEY,
|
|
2183
|
+
grant_id TEXT NOT NULL REFERENCES understanding_source_grants(grant_id) ON DELETE CASCADE,
|
|
2184
|
+
purposes_json TEXT NOT NULL CHECK(json_valid(purposes_json)),
|
|
2185
|
+
allowed_domains_json TEXT NOT NULL CHECK(json_valid(allowed_domains_json)),
|
|
2186
|
+
denied_domains_json TEXT NOT NULL DEFAULT '[]' CHECK(json_valid(denied_domains_json)),
|
|
2187
|
+
allowed_fields_json TEXT NOT NULL CHECK(json_valid(allowed_fields_json)),
|
|
2188
|
+
access_mode TEXT NOT NULL CHECK(access_mode IN ('once', 'continuous')),
|
|
2189
|
+
lookback_days INTEGER NOT NULL CHECK(lookback_days >= 0),
|
|
2190
|
+
raw_retention_days INTEGER NOT NULL CHECK(raw_retention_days >= 0),
|
|
2191
|
+
processing_policy TEXT NOT NULL CHECK(processing_policy IN ('local_only', 'remote_allowed')),
|
|
2192
|
+
allowed_agent_ids_json TEXT CHECK(allowed_agent_ids_json IS NULL OR json_valid(allowed_agent_ids_json)),
|
|
2193
|
+
disclosure_version TEXT NOT NULL,
|
|
2194
|
+
granted_at INTEGER NOT NULL,
|
|
2195
|
+
revoked_at INTEGER
|
|
2196
|
+
);
|
|
2197
|
+
|
|
2198
|
+
CREATE TABLE user_model_observations (
|
|
2199
|
+
observation_id TEXT PRIMARY KEY,
|
|
2200
|
+
principal_id TEXT NOT NULL,
|
|
2201
|
+
domain TEXT NOT NULL CHECK(domain IN (
|
|
2202
|
+
'identity', 'life_history', 'health', 'emotion', 'personality', 'cognition',
|
|
2203
|
+
'values', 'motivation', 'goals', 'capabilities', 'behavior', 'preferences',
|
|
2204
|
+
'relationships', 'resources_constraints', 'environment', 'digital_life'
|
|
2205
|
+
)),
|
|
2206
|
+
observation_type TEXT NOT NULL,
|
|
2207
|
+
subject_type TEXT NOT NULL CHECK(subject_type IN ('user', 'person', 'goal', 'project', 'topic')),
|
|
2208
|
+
subject_id TEXT NOT NULL,
|
|
2209
|
+
value_json TEXT NOT NULL CHECK(json_valid(value_json)),
|
|
2210
|
+
context_json TEXT NOT NULL DEFAULT '{}' CHECK(json_valid(context_json)),
|
|
2211
|
+
sensitivity_categories_json TEXT NOT NULL DEFAULT '[]' CHECK(json_valid(sensitivity_categories_json)),
|
|
2212
|
+
owner_attribution TEXT NOT NULL CHECK(owner_attribution IN ('user', 'other', 'shared', 'unknown')),
|
|
2213
|
+
observed_at INTEGER NOT NULL,
|
|
2214
|
+
valid_to INTEGER,
|
|
2215
|
+
delete_after INTEGER,
|
|
2216
|
+
source_grant_id TEXT REFERENCES understanding_source_grants(grant_id) ON DELETE CASCADE,
|
|
2217
|
+
source_item_id TEXT,
|
|
2218
|
+
evidence_id TEXT REFERENCES context_evidence(evidence_id) ON DELETE CASCADE,
|
|
2219
|
+
content_hash TEXT NOT NULL,
|
|
2220
|
+
created_at INTEGER NOT NULL,
|
|
2221
|
+
UNIQUE(principal_id, content_hash)
|
|
2222
|
+
);
|
|
2223
|
+
|
|
2224
|
+
CREATE TABLE user_assertion_edges (
|
|
2225
|
+
from_assertion_id TEXT NOT NULL REFERENCES user_assertions(assertion_id) ON DELETE CASCADE,
|
|
2226
|
+
to_assertion_id TEXT NOT NULL REFERENCES user_assertions(assertion_id) ON DELETE CASCADE,
|
|
2227
|
+
relation TEXT NOT NULL CHECK(relation IN ('supports', 'contradicts', 'derived_from', 'specializes')),
|
|
2228
|
+
confidence REAL NOT NULL CHECK(confidence >= 0 AND confidence <= 1),
|
|
2229
|
+
created_at INTEGER NOT NULL,
|
|
2230
|
+
PRIMARY KEY(from_assertion_id, to_assertion_id, relation),
|
|
2231
|
+
CHECK(from_assertion_id <> to_assertion_id)
|
|
2232
|
+
);
|
|
2233
|
+
|
|
2234
|
+
CREATE TABLE automation_events (
|
|
2235
|
+
event_id TEXT PRIMARY KEY,
|
|
2236
|
+
event_type TEXT NOT NULL,
|
|
2237
|
+
schema_version INTEGER NOT NULL DEFAULT 1,
|
|
2238
|
+
source TEXT NOT NULL,
|
|
2239
|
+
subject_kind TEXT,
|
|
2240
|
+
subject_id TEXT,
|
|
2241
|
+
occurred_at_ms INTEGER NOT NULL,
|
|
2242
|
+
ingested_at_ms INTEGER NOT NULL,
|
|
2243
|
+
correlation_id TEXT NOT NULL,
|
|
2244
|
+
causation_id TEXT,
|
|
2245
|
+
root_event_id TEXT NOT NULL,
|
|
2246
|
+
chain_depth INTEGER NOT NULL DEFAULT 0 CHECK(chain_depth BETWEEN 0 AND 32),
|
|
2247
|
+
dedupe_key TEXT,
|
|
2248
|
+
trust TEXT NOT NULL CHECK(trust IN ('system', 'user', 'connector', 'untrusted_webhook')),
|
|
2249
|
+
payload_json TEXT NOT NULL,
|
|
2250
|
+
projection_status TEXT NOT NULL DEFAULT 'pending'
|
|
2251
|
+
CHECK(projection_status IN ('pending', 'projecting', 'retrying', 'projected', 'dead_letter')),
|
|
2252
|
+
projected_at_ms INTEGER,
|
|
2253
|
+
projection_attempts INTEGER NOT NULL DEFAULT 0,
|
|
2254
|
+
projection_next_attempt_at_ms INTEGER NOT NULL DEFAULT 0,
|
|
2255
|
+
projection_error TEXT,
|
|
2256
|
+
projection_owner TEXT,
|
|
2257
|
+
projection_lease_until_ms INTEGER
|
|
2258
|
+
);
|
|
2259
|
+
|
|
2260
|
+
CREATE TABLE automation_event_deliveries (
|
|
2261
|
+
event_id TEXT NOT NULL,
|
|
2262
|
+
automation_id TEXT NOT NULL,
|
|
2263
|
+
status TEXT NOT NULL CHECK(status IN ('pending', 'retrying', 'queued', 'completed', 'failed', 'cancelled', 'skipped', 'dead_letter')),
|
|
2264
|
+
run_id TEXT,
|
|
2265
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
2266
|
+
next_attempt_at_ms INTEGER NOT NULL,
|
|
2267
|
+
last_error TEXT,
|
|
2268
|
+
lease_owner TEXT,
|
|
2269
|
+
lease_until_ms INTEGER,
|
|
2270
|
+
created_at_ms INTEGER NOT NULL,
|
|
2271
|
+
updated_at_ms INTEGER NOT NULL,
|
|
2272
|
+
PRIMARY KEY(event_id, automation_id),
|
|
2273
|
+
FOREIGN KEY(event_id) REFERENCES automation_events(event_id) ON DELETE CASCADE
|
|
2274
|
+
);
|
|
2275
|
+
|
|
2276
|
+
CREATE TABLE automation_results (
|
|
2277
|
+
run_id TEXT PRIMARY KEY,
|
|
2278
|
+
result_id TEXT NOT NULL UNIQUE,
|
|
2279
|
+
result_json TEXT NOT NULL CHECK(json_valid(result_json)),
|
|
2280
|
+
created_at_ms INTEGER NOT NULL,
|
|
2281
|
+
FOREIGN KEY(run_id) REFERENCES automation_runs(run_id) ON DELETE CASCADE
|
|
2282
|
+
);
|
|
2283
|
+
|
|
2284
|
+
CREATE TABLE automation_result_deliveries (
|
|
2285
|
+
delivery_id TEXT NOT NULL UNIQUE,
|
|
2286
|
+
run_id TEXT NOT NULL,
|
|
2287
|
+
destination_key TEXT NOT NULL,
|
|
2288
|
+
kind TEXT NOT NULL,
|
|
2289
|
+
status TEXT NOT NULL CHECK(status IN ('pending', 'delivering', 'retrying', 'delivered', 'dead_letter')),
|
|
2290
|
+
config_json TEXT NOT NULL,
|
|
2291
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
2292
|
+
next_attempt_at_ms INTEGER NOT NULL,
|
|
2293
|
+
last_error TEXT,
|
|
2294
|
+
lease_owner TEXT,
|
|
2295
|
+
lease_until_ms INTEGER,
|
|
2296
|
+
created_at_ms INTEGER NOT NULL,
|
|
2297
|
+
updated_at_ms INTEGER NOT NULL,
|
|
2298
|
+
PRIMARY KEY(run_id, destination_key),
|
|
2299
|
+
FOREIGN KEY(run_id) REFERENCES automation_results(run_id) ON DELETE CASCADE
|
|
2300
|
+
);
|
|
2301
|
+
|
|
2302
|
+
CREATE TABLE ai_usage_events (
|
|
2303
|
+
id TEXT PRIMARY KEY,
|
|
2304
|
+
trace_id TEXT NOT NULL,
|
|
2305
|
+
parent_event_id TEXT,
|
|
2306
|
+
conversation_id TEXT,
|
|
2307
|
+
run_id TEXT,
|
|
2308
|
+
agent_id TEXT,
|
|
2309
|
+
category TEXT NOT NULL,
|
|
2310
|
+
operation TEXT NOT NULL,
|
|
2311
|
+
trigger_kind TEXT NOT NULL,
|
|
2312
|
+
reason_key TEXT NOT NULL,
|
|
2313
|
+
provider TEXT NOT NULL,
|
|
2314
|
+
model TEXT NOT NULL,
|
|
2315
|
+
status TEXT NOT NULL CHECK(status IN ('running', 'succeeded', 'failed', 'aborted', 'unknown')),
|
|
2316
|
+
started_at INTEGER NOT NULL,
|
|
2317
|
+
finished_at INTEGER,
|
|
2318
|
+
duration_ms INTEGER,
|
|
2319
|
+
input_tokens INTEGER,
|
|
2320
|
+
output_tokens INTEGER,
|
|
2321
|
+
cache_read_tokens INTEGER,
|
|
2322
|
+
cache_write_tokens INTEGER,
|
|
2323
|
+
reasoning_tokens INTEGER,
|
|
2324
|
+
total_tokens INTEGER,
|
|
2325
|
+
estimated_cost_microusd INTEGER,
|
|
2326
|
+
cost_source TEXT NOT NULL CHECK(cost_source IN ('model_catalog', 'local', 'unknown')),
|
|
2327
|
+
pricing_snapshot_json TEXT,
|
|
2328
|
+
error_summary TEXT,
|
|
2329
|
+
created_at INTEGER NOT NULL,
|
|
2330
|
+
updated_at INTEGER NOT NULL
|
|
2331
|
+
);
|
|
2332
|
+
|
|
2333
|
+
INSERT INTO "work_discovery_onboarding" VALUES (1,'not_started',NULL,NULL,NULL,0);
|
|
2334
|
+
|
|
2335
|
+
INSERT INTO "discussion_capture_settings" VALUES ('default',1,NULL,1789567824603);
|
|
2336
|
+
|
|
2337
|
+
INSERT INTO "connector_runtime_identity" VALUES (1,'cf78f03b31a9f8df6becbbe12c9af630');
|
|
2338
|
+
|
|
2339
|
+
CREATE INDEX idx_sessions_agent_updated
|
|
2340
|
+
ON sessions(agent_id, updated_at DESC);
|
|
2341
|
+
|
|
2342
|
+
CREATE INDEX idx_sessions_status
|
|
2343
|
+
ON sessions(status);
|
|
2344
|
+
|
|
2345
|
+
CREATE INDEX idx_sessions_source_channel
|
|
2346
|
+
ON sessions(source_channel);
|
|
2347
|
+
|
|
2348
|
+
CREATE INDEX idx_sessions_last_interaction
|
|
2349
|
+
ON sessions(last_interaction_at DESC);
|
|
2350
|
+
|
|
2351
|
+
CREATE INDEX idx_sessions_type
|
|
2352
|
+
ON sessions(session_type);
|
|
2353
|
+
|
|
2354
|
+
CREATE INDEX idx_sessions_workflow_run
|
|
2355
|
+
ON sessions(workflow_run_id);
|
|
2356
|
+
|
|
2357
|
+
CREATE INDEX idx_sessions_parent
|
|
2358
|
+
ON sessions("parent_conversation_id");
|
|
2359
|
+
|
|
2360
|
+
CREATE INDEX idx_transcripts_session
|
|
2361
|
+
ON transcripts("conversation_id", status);
|
|
2362
|
+
|
|
2363
|
+
CREATE INDEX idx_entries_session_seq
|
|
2364
|
+
ON transcript_entries("transcript_id", seq);
|
|
2365
|
+
|
|
2366
|
+
CREATE INDEX idx_entries_kind
|
|
2367
|
+
ON transcript_entries("transcript_id", entry_kind);
|
|
2368
|
+
|
|
2369
|
+
CREATE INDEX idx_automations_enabled
|
|
2370
|
+
ON automations(enabled, updated_at_ms DESC);
|
|
2371
|
+
|
|
2372
|
+
CREATE INDEX idx_automations_updated
|
|
2373
|
+
ON automations(updated_at_ms DESC);
|
|
2374
|
+
|
|
2375
|
+
CREATE INDEX idx_automation_runs_automation_created
|
|
2376
|
+
ON automation_runs(automation_id, created_at_ms DESC);
|
|
2377
|
+
|
|
2378
|
+
CREATE INDEX idx_automation_runs_created
|
|
2379
|
+
ON automation_runs(created_at_ms DESC);
|
|
2380
|
+
|
|
2381
|
+
CREATE INDEX idx_automation_runs_status_created
|
|
2382
|
+
ON automation_runs(status, created_at_ms DESC);
|
|
2383
|
+
|
|
2384
|
+
CREATE INDEX idx_automation_run_events_run_created
|
|
2385
|
+
ON automation_run_events(run_id, created_at_ms ASC);
|
|
2386
|
+
|
|
2387
|
+
CREATE INDEX idx_automation_run_events_automation_created
|
|
2388
|
+
ON automation_run_events(automation_id, created_at_ms DESC);
|
|
2389
|
+
|
|
2390
|
+
CREATE INDEX idx_home_attention_acknowledged_at
|
|
2391
|
+
ON home_attention_acknowledgements(acknowledged_at DESC);
|
|
2392
|
+
|
|
2393
|
+
CREATE INDEX idx_notes_status_updated
|
|
2394
|
+
ON notes(status, updated_at DESC);
|
|
2395
|
+
|
|
2396
|
+
CREATE INDEX idx_notes_kind
|
|
2397
|
+
ON notes(kind);
|
|
2398
|
+
|
|
2399
|
+
CREATE INDEX idx_notes_group
|
|
2400
|
+
ON notes(group_id);
|
|
2401
|
+
|
|
2402
|
+
CREATE INDEX idx_note_agent_contexts_generated
|
|
2403
|
+
ON note_agent_contexts(generated_at DESC);
|
|
2404
|
+
|
|
2405
|
+
CREATE INDEX idx_activity_events_created
|
|
2406
|
+
ON activity_events(created_at DESC);
|
|
2407
|
+
|
|
2408
|
+
CREATE INDEX idx_activity_events_object_created
|
|
2409
|
+
ON activity_events(primary_object_kind, primary_object_id, created_at DESC);
|
|
2410
|
+
|
|
2411
|
+
CREATE INDEX idx_activity_scopes_scope
|
|
2412
|
+
ON activity_scopes(scope_kind, scope_id, activity_id);
|
|
2413
|
+
|
|
2414
|
+
CREATE INDEX idx_object_links_from
|
|
2415
|
+
ON object_links(from_kind, from_id);
|
|
2416
|
+
|
|
2417
|
+
CREATE INDEX idx_object_links_to
|
|
2418
|
+
ON object_links(to_kind, to_id);
|
|
2419
|
+
|
|
2420
|
+
CREATE INDEX idx_activity_related_projects_project
|
|
2421
|
+
ON activity_related_projects(project_id, activity_id);
|
|
2422
|
+
|
|
2423
|
+
CREATE INDEX idx_browser_automation_runs_automation_created
|
|
2424
|
+
ON browser_automation_runs(automation_id, created_at_ms DESC);
|
|
2425
|
+
|
|
2426
|
+
CREATE INDEX idx_browser_action_audit_run_seq
|
|
2427
|
+
ON browser_action_audit(run_id, seq ASC);
|
|
2428
|
+
|
|
2429
|
+
CREATE INDEX idx_projects_status
|
|
2430
|
+
ON projects(status, updated_at DESC);
|
|
2431
|
+
|
|
2432
|
+
CREATE INDEX idx_projects_slug
|
|
2433
|
+
ON projects(slug);
|
|
2434
|
+
|
|
2435
|
+
CREATE INDEX idx_projects_updated
|
|
2436
|
+
ON projects(updated_at DESC);
|
|
2437
|
+
|
|
2438
|
+
CREATE INDEX idx_sessions_project
|
|
2439
|
+
ON sessions(project_id, updated_at DESC);
|
|
2440
|
+
|
|
2441
|
+
CREATE INDEX idx_automations_project
|
|
2442
|
+
ON automations(project_id, updated_at_ms DESC);
|
|
2443
|
+
|
|
2444
|
+
CREATE INDEX idx_projects_pinned
|
|
2445
|
+
ON projects(pinned_at DESC)
|
|
2446
|
+
WHERE pinned_at IS NOT NULL;
|
|
2447
|
+
|
|
2448
|
+
CREATE INDEX idx_knowledge_sync_runs_source_started
|
|
2449
|
+
ON knowledge_sync_runs(source_instance_id, started_at DESC);
|
|
2450
|
+
|
|
2451
|
+
CREATE INDEX idx_knowledge_sync_runs_status_started
|
|
2452
|
+
ON knowledge_sync_runs(status, started_at DESC);
|
|
2453
|
+
|
|
2454
|
+
CREATE INDEX idx_connector_catalog_provider
|
|
2455
|
+
ON connector_catalog_entries(provider, fetched_at DESC);
|
|
2456
|
+
|
|
2457
|
+
CREATE INDEX idx_connector_installations_principal
|
|
2458
|
+
ON connector_installations(principal_id, enabled, connector_id);
|
|
2459
|
+
|
|
2460
|
+
CREATE INDEX idx_connector_action_scope
|
|
2461
|
+
ON connector_action_metadata(connector_id, scope, curated);
|
|
2462
|
+
|
|
2463
|
+
CREATE INDEX idx_connector_audit_principal_time
|
|
2464
|
+
ON connector_execution_audit(principal_id, created_at DESC);
|
|
2465
|
+
|
|
2466
|
+
CREATE INDEX idx_connector_audit_connector_time
|
|
2467
|
+
ON connector_execution_audit(connector_id, created_at DESC);
|
|
2468
|
+
|
|
2469
|
+
CREATE INDEX idx_connector_approvals_pending
|
|
2470
|
+
ON connector_approvals(principal_id, status, expires_at, created_at DESC);
|
|
2471
|
+
|
|
2472
|
+
CREATE INDEX idx_connector_approvals_session
|
|
2473
|
+
ON connector_approvals("conversation_id", status, created_at DESC);
|
|
2474
|
+
|
|
2475
|
+
CREATE INDEX idx_connector_webhook_deliveries_status
|
|
2476
|
+
ON connector_webhook_deliveries(provider, status, received_at DESC);
|
|
2477
|
+
|
|
2478
|
+
CREATE INDEX idx_local_apps_updated_at ON local_apps(updated_at DESC);
|
|
2479
|
+
|
|
2480
|
+
CREATE INDEX idx_local_apps_status ON local_apps(status, updated_at DESC);
|
|
2481
|
+
|
|
2482
|
+
CREATE INDEX idx_local_app_releases_app ON local_app_releases(app_id, version DESC);
|
|
2483
|
+
|
|
2484
|
+
CREATE INDEX idx_local_app_releases_created
|
|
2485
|
+
ON local_app_releases(app_id, created_at DESC);
|
|
2486
|
+
|
|
2487
|
+
CREATE INDEX idx_local_app_acceptance_runs_app_created
|
|
2488
|
+
ON local_app_acceptance_runs(app_id, created_at DESC);
|
|
2489
|
+
|
|
2490
|
+
CREATE INDEX idx_local_app_acceptance_runs_source
|
|
2491
|
+
ON local_app_acceptance_runs(app_id, source_hash, created_at DESC);
|
|
2492
|
+
|
|
2493
|
+
CREATE INDEX idx_work_discovery_runs_status_created
|
|
2494
|
+
ON work_discovery_runs(status, created_at DESC);
|
|
2495
|
+
|
|
2496
|
+
CREATE INDEX idx_work_discovery_runs_project
|
|
2497
|
+
ON work_discovery_runs(project_id, created_at DESC);
|
|
2498
|
+
|
|
2499
|
+
CREATE INDEX idx_extension_ui_grants_app_granted
|
|
2500
|
+
ON extension_ui_grants(app_id, granted_at DESC);
|
|
2501
|
+
|
|
2502
|
+
CREATE INDEX idx_work_discovery_feedback_updated
|
|
2503
|
+
ON work_discovery_feedback(updated_at DESC);
|
|
2504
|
+
|
|
2505
|
+
CREATE INDEX idx_composer_input_history_recent
|
|
2506
|
+
ON composer_input_history(id DESC);
|
|
2507
|
+
|
|
2508
|
+
CREATE INDEX idx_connector_learning_jobs_due
|
|
2509
|
+
ON connector_learning_jobs(status, next_run_at, created_at);
|
|
2510
|
+
|
|
2511
|
+
CREATE INDEX idx_connector_learning_jobs_source
|
|
2512
|
+
ON connector_learning_jobs(source_instance_id, created_at DESC);
|
|
2513
|
+
|
|
2514
|
+
CREATE INDEX idx_knowledge_source_items_source_updated
|
|
2515
|
+
ON knowledge_source_items(source_instance_id, updated_at DESC);
|
|
2516
|
+
|
|
2517
|
+
CREATE INDEX idx_knowledge_source_items_synthesis
|
|
2518
|
+
ON knowledge_source_items(synthesis_status, updated_at);
|
|
2519
|
+
|
|
2520
|
+
CREATE INDEX idx_knowledge_source_items_hash
|
|
2521
|
+
ON knowledge_source_items(content_hash);
|
|
2522
|
+
|
|
2523
|
+
CREATE INDEX idx_knowledge_source_items_synthesis_lease
|
|
2524
|
+
ON knowledge_source_items(synthesis_pipeline, synthesis_status, synthesis_claimed_at, updated_at);
|
|
2525
|
+
|
|
2526
|
+
CREATE INDEX idx_knowledge_source_items_collection
|
|
2527
|
+
ON knowledge_source_items(source_instance_id, collection_scope, updated_at DESC);
|
|
2528
|
+
|
|
2529
|
+
CREATE INDEX idx_knowledge_source_changes_source_sequence
|
|
2530
|
+
ON knowledge_source_changes(source_instance_id, sequence);
|
|
2531
|
+
|
|
2532
|
+
CREATE INDEX idx_knowledge_source_changes_changed_at
|
|
2533
|
+
ON knowledge_source_changes(changed_at DESC);
|
|
2534
|
+
|
|
2535
|
+
CREATE INDEX idx_automation_runs_lease
|
|
2536
|
+
ON automation_runs(status, lease_expires_at_ms);
|
|
2537
|
+
|
|
2538
|
+
CREATE INDEX idx_discussion_captures_queue
|
|
2539
|
+
ON discussion_captures(status, work_lease_expires_at, updated_at);
|
|
2540
|
+
|
|
2541
|
+
CREATE INDEX idx_discussion_captures_project
|
|
2542
|
+
ON discussion_captures(project_id, updated_at DESC);
|
|
2543
|
+
|
|
2544
|
+
CREATE INDEX idx_discussion_segments_queue
|
|
2545
|
+
ON discussion_transcript_segments(status, next_attempt_at, created_at);
|
|
2546
|
+
|
|
2547
|
+
CREATE INDEX idx_discussion_organizations_latest
|
|
2548
|
+
ON discussion_organizations(discussion_id, revision DESC);
|
|
2549
|
+
|
|
2550
|
+
CREATE INDEX idx_project_milestones_project_sort
|
|
2551
|
+
ON project_milestones(project_id, sort_order, created_at);
|
|
2552
|
+
|
|
2553
|
+
CREATE INDEX idx_project_updates_project_created
|
|
2554
|
+
ON project_updates(project_id, created_at DESC);
|
|
2555
|
+
|
|
2556
|
+
CREATE UNIQUE INDEX idx_tasks_creation_idempotency
|
|
2557
|
+
ON tasks(creation_idempotency_key) WHERE creation_idempotency_key IS NOT NULL;
|
|
2558
|
+
|
|
2559
|
+
CREATE INDEX idx_tasks_project_updated ON tasks(project_id, updated_at DESC);
|
|
2560
|
+
|
|
2561
|
+
CREATE INDEX idx_tasks_phase_updated ON tasks(phase, updated_at DESC);
|
|
2562
|
+
|
|
2563
|
+
CREATE INDEX idx_tasks_parent ON tasks(parent_task_id, updated_at DESC);
|
|
2564
|
+
|
|
2565
|
+
CREATE INDEX idx_task_dependencies_upstream
|
|
2566
|
+
ON task_dependencies(depends_on_task_id, task_id);
|
|
2567
|
+
|
|
2568
|
+
CREATE UNIQUE INDEX idx_task_sessions_identity
|
|
2569
|
+
ON task_sessions(task_id, "conversation_id", role) WHERE "conversation_id" IS NOT NULL;
|
|
2570
|
+
|
|
2571
|
+
CREATE INDEX idx_task_sessions_session ON task_sessions("conversation_id", created_at DESC);
|
|
2572
|
+
|
|
2573
|
+
CREATE INDEX idx_task_waits_task_status ON task_waits(task_id, status, created_at DESC);
|
|
2574
|
+
|
|
2575
|
+
CREATE INDEX idx_task_waits_resume ON task_waits(status, resume_at);
|
|
2576
|
+
|
|
2577
|
+
CREATE INDEX idx_task_authority_grants_task
|
|
2578
|
+
ON task_authority_grants(task_id, revoked_at, expires_at);
|
|
2579
|
+
|
|
2580
|
+
CREATE INDEX idx_context_edges_owner
|
|
2581
|
+
ON context_edges(owner_kind, owner_id, role, created_at);
|
|
2582
|
+
|
|
2583
|
+
CREATE INDEX idx_context_edges_target
|
|
2584
|
+
ON context_edges(target_kind, target_id, created_at);
|
|
2585
|
+
|
|
2586
|
+
CREATE INDEX idx_task_runs_task_queued ON task_runs(task_id, queued_at DESC);
|
|
2587
|
+
|
|
2588
|
+
CREATE INDEX idx_task_runs_dispatch ON task_runs(status, scheduled_at, queued_at);
|
|
2589
|
+
|
|
2590
|
+
CREATE INDEX idx_task_runs_lease ON task_runs(lease_expires_at);
|
|
2591
|
+
|
|
2592
|
+
CREATE INDEX idx_task_runs_root ON task_runs(root_run_id, queued_at);
|
|
2593
|
+
|
|
2594
|
+
CREATE UNIQUE INDEX idx_task_runs_active_root
|
|
2595
|
+
ON task_runs(task_id)
|
|
2596
|
+
WHERE parent_run_id IS NULL
|
|
2597
|
+
AND status IN ('queued', 'running', 'waiting', 'verifying');
|
|
2598
|
+
|
|
2599
|
+
CREATE UNIQUE INDEX idx_task_runs_root_attempt
|
|
2600
|
+
ON task_runs(task_id, attempt) WHERE parent_run_id IS NULL;
|
|
2601
|
+
|
|
2602
|
+
CREATE INDEX idx_task_run_events_run_sequence ON task_run_events(run_id, sequence);
|
|
2603
|
+
|
|
2604
|
+
CREATE INDEX idx_domain_outbox_pending ON domain_outbox(published_at, created_at);
|
|
2605
|
+
|
|
2606
|
+
CREATE INDEX idx_workflow_runs_created ON workflow_runs(agent_id, created_at_ms DESC);
|
|
2607
|
+
|
|
2608
|
+
CREATE INDEX idx_workflow_runs_status_created ON workflow_runs(agent_id, status, created_at_ms DESC);
|
|
2609
|
+
|
|
2610
|
+
CREATE INDEX idx_workflow_runs_definition_created ON workflow_runs(definition_id, created_at_ms DESC);
|
|
2611
|
+
|
|
2612
|
+
CREATE INDEX idx_workflow_runs_project ON workflow_runs(project_id, created_at_ms DESC);
|
|
2613
|
+
|
|
2614
|
+
CREATE INDEX idx_workflow_runs_task_run ON workflow_runs(task_run_id, created_at_ms DESC);
|
|
2615
|
+
|
|
2616
|
+
CREATE INDEX idx_connector_learning_jobs_account
|
|
2617
|
+
ON connector_learning_jobs(account_id, created_at DESC);
|
|
2618
|
+
|
|
2619
|
+
CREATE INDEX idx_endpoint_tool_invocations_endpoint_started
|
|
2620
|
+
ON endpoint_tool_invocations(endpoint_id, started_at DESC);
|
|
2621
|
+
|
|
2622
|
+
CREATE UNIQUE INDEX idx_context_evidence_source
|
|
2623
|
+
ON context_evidence(principal_id, source_type, COALESCE(source_instance_id, ''), source_ref);
|
|
2624
|
+
|
|
2625
|
+
CREATE INDEX idx_understanding_source_grants_status
|
|
2626
|
+
ON understanding_source_grants(status, category, updated_at DESC);
|
|
2627
|
+
|
|
2628
|
+
CREATE INDEX idx_understanding_source_runs_grant
|
|
2629
|
+
ON understanding_source_runs(grant_id, started_at DESC);
|
|
2630
|
+
|
|
2631
|
+
CREATE INDEX idx_understanding_source_runs_status
|
|
2632
|
+
ON understanding_source_runs(status, started_at ASC);
|
|
2633
|
+
|
|
2634
|
+
CREATE INDEX idx_work_understanding_evidence_investigation
|
|
2635
|
+
ON work_understanding_evidence(investigation_id, collected_at ASC);
|
|
2636
|
+
|
|
2637
|
+
CREATE INDEX idx_work_understanding_evidence_source
|
|
2638
|
+
ON work_understanding_evidence(source_grant_id, source_type, collected_at DESC);
|
|
2639
|
+
|
|
2640
|
+
CREATE INDEX idx_tasks_project_phase_rank
|
|
2641
|
+
ON tasks(project_id, phase, board_rank, created_at);
|
|
2642
|
+
|
|
2643
|
+
CREATE UNIQUE INDEX idx_task_sessions_active_execution
|
|
2644
|
+
ON task_sessions(task_id)
|
|
2645
|
+
WHERE role = 'execution' AND status = 'active';
|
|
2646
|
+
|
|
2647
|
+
CREATE UNIQUE INDEX idx_task_sessions_execution_owner
|
|
2648
|
+
ON task_sessions("conversation_id")
|
|
2649
|
+
WHERE role = 'execution' AND "conversation_id" IS NOT NULL;
|
|
2650
|
+
|
|
2651
|
+
CREATE INDEX idx_task_handoffs_task
|
|
2652
|
+
ON task_handoff_snapshots(task_id, assignment_epoch DESC);
|
|
2653
|
+
|
|
2654
|
+
CREATE INDEX idx_automation_runs_unread_created
|
|
2655
|
+
ON automation_runs(read_at_ms, created_at_ms DESC);
|
|
2656
|
+
|
|
2657
|
+
CREATE INDEX idx_workflow_context_snapshots_run
|
|
2658
|
+
ON workflow_context_snapshots(run_id, created_at DESC);
|
|
2659
|
+
|
|
2660
|
+
CREATE INDEX idx_workflow_context_snapshots_project
|
|
2661
|
+
ON workflow_context_snapshots(project_id, created_at DESC);
|
|
2662
|
+
|
|
2663
|
+
CREATE INDEX idx_project_workflow_presets_updated
|
|
2664
|
+
ON project_workflow_presets(project_id, updated_at DESC);
|
|
2665
|
+
|
|
2666
|
+
CREATE INDEX idx_context_extraction_runs_lookup
|
|
2667
|
+
ON context_extraction_runs(extractor_id, status, started_at DESC);
|
|
2668
|
+
|
|
2669
|
+
CREATE INDEX idx_context_evidence_run
|
|
2670
|
+
ON context_evidence(source_run_id, observed_at DESC);
|
|
2671
|
+
|
|
2672
|
+
CREATE INDEX idx_context_evidence_message
|
|
2673
|
+
ON context_evidence(conversation_id, turn_id, message_id);
|
|
2674
|
+
|
|
2675
|
+
CREATE INDEX idx_user_people_principal_kind
|
|
2676
|
+
ON user_people(principal_id, inferred_kind, last_observed_at DESC);
|
|
2677
|
+
|
|
2678
|
+
CREATE INDEX idx_user_people_merge_target
|
|
2679
|
+
ON user_people(merged_into_person_id);
|
|
2680
|
+
|
|
2681
|
+
CREATE INDEX idx_user_person_handles_person ON user_person_handles(person_id);
|
|
2682
|
+
|
|
2683
|
+
CREATE INDEX idx_user_person_handles_lookup ON user_person_handles(handle_type, normalized_value);
|
|
2684
|
+
|
|
2685
|
+
CREATE INDEX idx_user_person_source_stats_source
|
|
2686
|
+
ON user_person_source_stats(source_instance_id, last_observed_at DESC);
|
|
2687
|
+
|
|
2688
|
+
CREATE INDEX idx_notification_events_created
|
|
2689
|
+
ON notification_events(created_at, event_id);
|
|
2690
|
+
|
|
2691
|
+
CREATE UNIQUE INDEX idx_execution_environments_active_root
|
|
2692
|
+
ON execution_environments(root_path)
|
|
2693
|
+
WHERE deleted_at IS NULL;
|
|
2694
|
+
|
|
2695
|
+
CREATE INDEX idx_execution_environments_project
|
|
2696
|
+
ON execution_environments(project_id, updated_at DESC);
|
|
2697
|
+
|
|
2698
|
+
CREATE UNIQUE INDEX idx_execution_environment_bindings_active_session
|
|
2699
|
+
ON execution_environment_bindings("conversation_id")
|
|
2700
|
+
WHERE released_at IS NULL;
|
|
2701
|
+
|
|
2702
|
+
CREATE INDEX idx_execution_environment_bindings_environment
|
|
2703
|
+
ON execution_environment_bindings(environment_id, created_at DESC);
|
|
2704
|
+
|
|
2705
|
+
CREATE INDEX idx_execution_environment_events_environment
|
|
2706
|
+
ON execution_environment_events(environment_id, created_at DESC);
|
|
2707
|
+
|
|
2708
|
+
CREATE INDEX idx_projects_execution_mode
|
|
2709
|
+
ON projects(execution_mode, updated_at DESC);
|
|
2710
|
+
|
|
2711
|
+
CREATE INDEX durable_messages_pending ON durable_messages(queue, scope, processed_at, sequence);
|
|
2712
|
+
|
|
2713
|
+
CREATE UNIQUE INDEX durable_share_token ON durable_state(namespace, json_extract(payload, '$.token'))
|
|
2714
|
+
WHERE namespace IN ('shares', 'site-shares');
|
|
2715
|
+
|
|
2716
|
+
CREATE UNIQUE INDEX durable_site_subdomain ON durable_state(json_extract(payload, '$.subdomain'))
|
|
2717
|
+
WHERE namespace = 'site-shares' AND json_extract(payload, '$.subdomain') IS NOT NULL;
|
|
2718
|
+
|
|
2719
|
+
CREATE UNIQUE INDEX idx_user_assertion_slots_identity
|
|
2720
|
+
ON user_assertion_slots(
|
|
2721
|
+
principal_id, subject_type, subject_id, predicate, scope_type, COALESCE(scope_id, '')
|
|
2722
|
+
);
|
|
2723
|
+
|
|
2724
|
+
CREATE INDEX idx_user_assertion_slots_subject
|
|
2725
|
+
ON user_assertion_slots(principal_id, subject_type, subject_id, predicate);
|
|
2726
|
+
|
|
2727
|
+
CREATE INDEX idx_user_assertion_slots_scope
|
|
2728
|
+
ON user_assertion_slots(principal_id, scope_type, scope_id);
|
|
2729
|
+
|
|
2730
|
+
CREATE INDEX idx_user_assertions_slot_status
|
|
2731
|
+
ON user_assertions(slot_id, status, valid_from, valid_to);
|
|
2732
|
+
|
|
2733
|
+
CREATE INDEX idx_user_assertions_review
|
|
2734
|
+
ON user_assertions(status, review_at) WHERE review_at IS NOT NULL;
|
|
2735
|
+
|
|
2736
|
+
CREATE INDEX idx_user_assertions_recorded
|
|
2737
|
+
ON user_assertions(recorded_at DESC);
|
|
2738
|
+
|
|
2739
|
+
CREATE INDEX idx_user_assertion_evidence_source
|
|
2740
|
+
ON user_assertion_evidence(evidence_id, relation);
|
|
2741
|
+
|
|
2742
|
+
CREATE INDEX idx_user_assertion_status_events_assertion
|
|
2743
|
+
ON user_assertion_status_events(assertion_id, created_at DESC);
|
|
2744
|
+
|
|
2745
|
+
CREATE INDEX idx_user_goals_status
|
|
2746
|
+
ON user_goals(principal_id, status, updated_at DESC);
|
|
2747
|
+
|
|
2748
|
+
CREATE INDEX idx_user_goals_scope
|
|
2749
|
+
ON user_goals(principal_id, scope_type, scope_id, status);
|
|
2750
|
+
|
|
2751
|
+
CREATE INDEX idx_user_priority_windows_active
|
|
2752
|
+
ON user_priority_windows(principal_id, status, valid_from, valid_to);
|
|
2753
|
+
|
|
2754
|
+
CREATE INDEX idx_user_priority_windows_target
|
|
2755
|
+
ON user_priority_windows(target_type, target_id, status);
|
|
2756
|
+
|
|
2757
|
+
CREATE INDEX idx_memory_maintenance_runs_principal
|
|
2758
|
+
ON memory_maintenance_runs(principal_id, started_at DESC);
|
|
2759
|
+
|
|
2760
|
+
CREATE INDEX idx_memory_maintenance_decisions_run
|
|
2761
|
+
ON memory_maintenance_decisions(run_id, created_at);
|
|
2762
|
+
|
|
2763
|
+
CREATE UNIQUE INDEX idx_connection_wait_active ON session_connection_waits(principal_id,"transcript_id")
|
|
2764
|
+
WHERE status IN ('open','queued');
|
|
2765
|
+
|
|
2766
|
+
CREATE INDEX idx_connection_wait_session ON session_connection_waits("conversation_id");
|
|
2767
|
+
|
|
2768
|
+
CREATE UNIQUE INDEX idx_clarification_wait_active
|
|
2769
|
+
ON session_clarification_waits(principal_id, "transcript_id")
|
|
2770
|
+
WHERE status IN ('open', 'queued');
|
|
2771
|
+
|
|
2772
|
+
CREATE INDEX idx_clarification_wait_session
|
|
2773
|
+
ON session_clarification_waits("conversation_id", "transcript_id", status);
|
|
2774
|
+
|
|
2775
|
+
CREATE INDEX idx_session_inputs_pending
|
|
2776
|
+
ON session_inputs("conversation_id",status,position,created_at_ms);
|
|
2777
|
+
|
|
2778
|
+
CREATE INDEX idx_notification_deliveries_due
|
|
2779
|
+
ON notification_deliveries(status, next_attempt_at);
|
|
2780
|
+
|
|
2781
|
+
CREATE INDEX idx_device_refresh_credentials_device
|
|
2782
|
+
ON device_refresh_credentials(device_id, expires_at);
|
|
2783
|
+
|
|
2784
|
+
CREATE INDEX idx_device_access_sessions_device
|
|
2785
|
+
ON device_access_sessions(device_id, expires_at);
|
|
2786
|
+
|
|
2787
|
+
CREATE INDEX idx_browser_tab_bindings_expiry ON browser_tab_bindings(expires_at);
|
|
2788
|
+
|
|
2789
|
+
CREATE INDEX idx_endpoint_principals_active
|
|
2790
|
+
ON endpoint_principals(kind, last_seen_at DESC)
|
|
2791
|
+
WHERE revoked_at IS NULL;
|
|
2792
|
+
|
|
2793
|
+
CREATE INDEX idx_endpoint_instance_bindings_principal
|
|
2794
|
+
ON endpoint_instance_bindings(principal_id);
|
|
2795
|
+
|
|
2796
|
+
CREATE INDEX idx_endpoint_session_bindings_endpoint
|
|
2797
|
+
ON endpoint_session_bindings(endpoint_id);
|
|
2798
|
+
|
|
2799
|
+
CREATE INDEX idx_browser_sessions_expiry ON browser_sessions(expires_at);
|
|
2800
|
+
|
|
2801
|
+
CREATE INDEX idx_device_pairing_sessions_expiry
|
|
2802
|
+
ON device_pairing_sessions(expires_at);
|
|
2803
|
+
|
|
2804
|
+
CREATE INDEX idx_device_pairing_requests_expiry
|
|
2805
|
+
ON device_pairing_requests(recovery_until);
|
|
2806
|
+
|
|
2807
|
+
CREATE INDEX discussion_recording_jobs_pending ON discussion_recording_jobs(state, created_at);
|
|
2808
|
+
|
|
2809
|
+
CREATE INDEX capability_imports_owner_kind ON capability_imports(owner, kind, created_at DESC);
|
|
2810
|
+
|
|
2811
|
+
CREATE UNIQUE INDEX capability_imports_idempotency ON capability_imports(owner, idempotency_key)
|
|
2812
|
+
WHERE idempotency_key IS NOT NULL;
|
|
2813
|
+
|
|
2814
|
+
CREATE INDEX import_selections_owner_kind ON import_selections(owner, kind, created_at DESC);
|
|
2815
|
+
|
|
2816
|
+
CREATE INDEX knowledge_sync_source_scope ON knowledge_sync_runs(source_instance_id, collection_scope, started_at DESC);
|
|
2817
|
+
|
|
2818
|
+
CREATE UNIQUE INDEX idx_connector_backend_active ON connector_backends(active) WHERE active = 1;
|
|
2819
|
+
|
|
2820
|
+
CREATE UNIQUE INDEX idx_connector_accounts_identity
|
|
2821
|
+
ON connector_accounts(principal_id, backend_id, connector_id, identity_key)
|
|
2822
|
+
WHERE identity_key IS NOT NULL;
|
|
2823
|
+
|
|
2824
|
+
CREATE INDEX idx_connector_connections_principal ON connector_connections(principal_id, connector_id, status);
|
|
2825
|
+
|
|
2826
|
+
CREATE INDEX idx_connector_connections_account ON connector_connections(account_id);
|
|
2827
|
+
|
|
2828
|
+
CREATE UNIQUE INDEX idx_connector_connections_provider_backend
|
|
2829
|
+
ON connector_connections(provider, COALESCE(json_extract(metadata_json, '$.backendId'), ''), provider_connection_id);
|
|
2830
|
+
|
|
2831
|
+
CREATE INDEX idx_connector_authorization_attempt_scope ON connector_authorization_attempts(principal_id,connector_id,created_at);
|
|
2832
|
+
|
|
2833
|
+
CREATE INDEX idx_understanding_refresh_batches_created ON understanding_refresh_batches(created_at DESC);
|
|
2834
|
+
|
|
2835
|
+
CREATE INDEX idx_sidebar_positions_order
|
|
2836
|
+
ON sidebar_positions(container_id, position);
|
|
2837
|
+
|
|
2838
|
+
CREATE UNIQUE INDEX idx_cli_account_identity ON connector_accounts(principal_id, runtime_instance_id, identity_key)
|
|
2839
|
+
WHERE runtime_instance_id IS NOT NULL AND identity_key IS NOT NULL;
|
|
2840
|
+
|
|
2841
|
+
CREATE UNIQUE INDEX idx_cli_active_authorization ON connector_cli_authorizations(instance_id, principal_id)
|
|
2842
|
+
WHERE phase IN ('preparing','awaiting_user','verifying');
|
|
2843
|
+
|
|
2844
|
+
CREATE INDEX capability_invocations_operation ON capability_invocations(operation_id, created_at);
|
|
2845
|
+
|
|
2846
|
+
CREATE INDEX idx_knowledge_items_status
|
|
2847
|
+
ON knowledge_items(principal_id, status, updated_at DESC);
|
|
2848
|
+
|
|
2849
|
+
CREATE INDEX idx_knowledge_items_scope
|
|
2850
|
+
ON knowledge_items(principal_id, scope_type, scope_id, status);
|
|
2851
|
+
|
|
2852
|
+
CREATE INDEX idx_knowledge_items_lifecycle
|
|
2853
|
+
ON knowledge_items(status, expires_at, review_at);
|
|
2854
|
+
|
|
2855
|
+
CREATE INDEX idx_knowledge_items_class_status
|
|
2856
|
+
ON knowledge_items(principal_id, record_class, status, updated_at DESC);
|
|
2857
|
+
|
|
2858
|
+
CREATE UNIQUE INDEX idx_knowledge_items_canonical
|
|
2859
|
+
ON knowledge_items(principal_id, canonical_key, scope_type, COALESCE(scope_id, ''))
|
|
2860
|
+
WHERE status IN ('candidate', 'active', 'needs_review', 'stale');
|
|
2861
|
+
|
|
2862
|
+
CREATE INDEX idx_knowledge_item_status_events_item
|
|
2863
|
+
ON knowledge_item_status_events(knowledge_id, created_at DESC);
|
|
2864
|
+
|
|
2865
|
+
CREATE UNIQUE INDEX idx_understanding_source_runs_connector_job
|
|
2866
|
+
ON understanding_source_runs(connector_learning_job_id)
|
|
2867
|
+
WHERE connector_learning_job_id IS NOT NULL;
|
|
2868
|
+
|
|
2869
|
+
CREATE INDEX idx_context_extraction_outputs_object
|
|
2870
|
+
ON context_extraction_outputs(object_type, object_id);
|
|
2871
|
+
|
|
2872
|
+
CREATE INDEX idx_chat_previews_conversation_updated
|
|
2873
|
+
ON chat_previews(conversation_id, updated_at DESC);
|
|
2874
|
+
|
|
2875
|
+
CREATE INDEX idx_chat_preview_revisions_created
|
|
2876
|
+
ON chat_preview_revisions(preview_id, created_at DESC);
|
|
2877
|
+
|
|
2878
|
+
CREATE INDEX idx_context_snapshots_owner
|
|
2879
|
+
ON context_snapshots(owner_kind, owner_id, created_at DESC);
|
|
2880
|
+
|
|
2881
|
+
CREATE INDEX idx_context_snapshots_session
|
|
2882
|
+
ON context_snapshots(conversation_id, created_at DESC);
|
|
2883
|
+
|
|
2884
|
+
CREATE INDEX idx_collaboration_rules_principal_status
|
|
2885
|
+
ON collaboration_rules(principal_id, status, priority, updated_at DESC);
|
|
2886
|
+
|
|
2887
|
+
CREATE UNIQUE INDEX idx_home_advice_generation_idempotency
|
|
2888
|
+
ON home_advice_generations(owner_id, workspace_id, idempotency_key);
|
|
2889
|
+
|
|
2890
|
+
CREATE UNIQUE INDEX idx_home_advice_generation_active
|
|
2891
|
+
ON home_advice_generations(owner_id, workspace_id)
|
|
2892
|
+
WHERE status IN ('queued', 'running', 'retry_wait');
|
|
2893
|
+
|
|
2894
|
+
CREATE INDEX idx_home_advice_generation_claim
|
|
2895
|
+
ON home_advice_generations(status, retry_at, requested_at);
|
|
2896
|
+
|
|
2897
|
+
CREATE INDEX idx_home_advice_generation_latest
|
|
2898
|
+
ON home_advice_generations(owner_id, workspace_id, completed_at DESC);
|
|
2899
|
+
|
|
2900
|
+
CREATE UNIQUE INDEX idx_home_opportunity_active_dedupe
|
|
2901
|
+
ON home_opportunity_projections(owner_id, workspace_id, dedupe_key)
|
|
2902
|
+
WHERE state IN ('active', 'snoozed');
|
|
2903
|
+
|
|
2904
|
+
CREATE INDEX idx_home_opportunity_visible
|
|
2905
|
+
ON home_opportunity_projections(owner_id, workspace_id, state, rank, expires_at);
|
|
2906
|
+
|
|
2907
|
+
CREATE INDEX idx_home_opportunity_feedback_item
|
|
2908
|
+
ON home_opportunity_feedback(opportunity_id, created_at DESC);
|
|
2909
|
+
|
|
2910
|
+
CREATE INDEX idx_agents_available ON agents(enabled, provisioning_state, deleted_at, id);
|
|
2911
|
+
|
|
2912
|
+
CREATE INDEX idx_agent_bindings_agent ON agent_bindings(agent_id, position);
|
|
2913
|
+
|
|
2914
|
+
CREATE INDEX idx_understanding_consent_receipts_grant
|
|
2915
|
+
ON understanding_consent_receipts(grant_id, granted_at DESC);
|
|
2916
|
+
|
|
2917
|
+
CREATE UNIQUE INDEX idx_understanding_consent_receipts_active
|
|
2918
|
+
ON understanding_consent_receipts(grant_id) WHERE revoked_at IS NULL;
|
|
2919
|
+
|
|
2920
|
+
CREATE INDEX idx_user_model_observations_domain_time
|
|
2921
|
+
ON user_model_observations(principal_id, domain, observed_at DESC);
|
|
2922
|
+
|
|
2923
|
+
CREATE INDEX idx_user_model_observations_expiry
|
|
2924
|
+
ON user_model_observations(delete_after) WHERE delete_after IS NOT NULL;
|
|
2867
2925
|
|
|
2926
|
+
CREATE INDEX idx_user_model_observations_source
|
|
2927
|
+
ON user_model_observations(source_grant_id, source_item_id);
|
|
2868
2928
|
|
|
2929
|
+
CREATE INDEX idx_user_assertion_edges_to
|
|
2930
|
+
ON user_assertion_edges(to_assertion_id, relation);
|
|
2869
2931
|
|
|
2870
|
-
|
|
2932
|
+
CREATE UNIQUE INDEX idx_automation_events_source_dedupe
|
|
2933
|
+
ON automation_events(source, dedupe_key)
|
|
2934
|
+
WHERE dedupe_key IS NOT NULL;
|
|
2871
2935
|
|
|
2872
|
-
|
|
2936
|
+
CREATE INDEX idx_automation_events_projection
|
|
2937
|
+
ON automation_events(projection_status, projection_next_attempt_at_ms, ingested_at_ms);
|
|
2873
2938
|
|
|
2874
|
-
|
|
2939
|
+
CREATE UNIQUE INDEX idx_automation_event_deliveries_run
|
|
2940
|
+
ON automation_event_deliveries(run_id)
|
|
2941
|
+
WHERE run_id IS NOT NULL;
|
|
2875
2942
|
|
|
2876
|
-
|
|
2943
|
+
CREATE INDEX idx_automation_event_deliveries_pending
|
|
2944
|
+
ON automation_event_deliveries(status, next_attempt_at_ms, created_at_ms);
|
|
2877
2945
|
|
|
2878
|
-
|
|
2946
|
+
CREATE INDEX idx_automation_result_deliveries_pending
|
|
2947
|
+
ON automation_result_deliveries(status, next_attempt_at_ms, created_at_ms);
|
|
2879
2948
|
|
|
2880
|
-
|
|
2949
|
+
CREATE INDEX idx_ai_usage_events_started
|
|
2950
|
+
ON ai_usage_events(started_at DESC, id DESC);
|
|
2881
2951
|
|
|
2882
|
-
|
|
2952
|
+
CREATE INDEX idx_ai_usage_events_conversation
|
|
2953
|
+
ON ai_usage_events(conversation_id, started_at DESC);
|
|
2883
2954
|
|
|
2884
|
-
|
|
2955
|
+
CREATE INDEX idx_ai_usage_events_trace
|
|
2956
|
+
ON ai_usage_events(trace_id, started_at ASC);
|
|
2885
2957
|
|
|
2886
|
-
|
|
2958
|
+
CREATE INDEX idx_ai_usage_events_agent
|
|
2959
|
+
ON ai_usage_events(agent_id, started_at DESC);
|
|
2887
2960
|
|
|
2888
|
-
|
|
2961
|
+
CREATE INDEX idx_ai_usage_events_category
|
|
2962
|
+
ON ai_usage_events(category, started_at DESC);
|