@xopcai/xopc 0.0.286 → 0.0.291
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/README.md +16 -0
- package/README.zh-CN.md +16 -0
- package/dist/browser-ext/dist/assets/{auth-BXCWrPlg.js → auth-B2CDTr_F.js} +2 -1
- package/dist/browser-ext/dist/background.js +1 -1
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +36 -10
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-xOhV8FHx.js → activity-store-6lmzUBEr.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BzQbYWEj.js → agent-avatar-dicebear-BCtrkF15.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D2eYNelh.js +1 -0
- package/dist/gateway/static/root/assets/agents-BedA5XwI.js +1 -0
- package/dist/gateway/static/root/assets/{api-CVJQLBv9.js → api-D6yepxBp.js} +1 -1
- package/dist/gateway/static/root/assets/api-Dnfnl1Gd.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CTyuXkNC.js → app-management-settings-panel-Md562Fo-.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Tk-GJtvF.js → appearance-settings-BiBFI4BM.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BA-7OrhJ.js → apps-page-Corla83b.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-O49jeeXo.js → archive-plugin-A_Unp751.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-r9lBF2tW.js → attachment-load-D6idSUyP.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CFFLXYgS.js → automations-page-C6j71Lgs.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DjZdhLQ5.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BpM43vsn.js → binary-plugins-BkKYh-8v.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DFrfEcGw.js → block-editor-CDcMvaku.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-CyHGQwxQ.js → browser-automation-inputs-Cq4sIJt2.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CPkOWfM9.js → browser-automations-page-C64k4TBH.js} +2 -2
- package/dist/gateway/static/root/assets/{browser-settings-page-BOcseZxg.js → browser-settings-page-1k5rj_qR.js} +3 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B2NvoTYb.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-DExixzp4.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-BArPeImO.js → channels-status-swr-CVzEYBpX.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D5Aka4S8.js → chat-terminal-dock-B9eKFkbg.js} +2 -2
- package/dist/gateway/static/root/assets/computer-model-settings-DW6j2lsn.js +1 -0
- package/dist/gateway/static/root/assets/computer-settings-page-C2Qyw63Q.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-C3ubZz7K.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-DNtRu6EB.js → date-picker-BdxjXVKL.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Dng3dIQa.js → dependency-picker-CXOa4uh4.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BicYycxy.js → desktop-pet-CBWiAaSv.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BEse55eX.js → desktop-pet-settings-BX1aILDK.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-be30HuFI.js → device-pairing-wizard-bqm_Yf4i.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-YzhYyuay.js → extension-debug-page-B4MMerja.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CEXVIkDl.js → extension-page-B3ZtINak.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CrlbgK8g.js → extension-settings-page-8BkQVh0z.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BNuoHXiZ.js → gateway-config-swr-BBovMBQ1.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-ZyhacQX5.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-zMPfje0n.js → gateway-startup-retry-NXDtzZED.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-BtxitqZ3.js → heartbeat-settings-Bllcxm2A.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-Cv2e8XBR.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-B_Tyx74A.js → image-generation-api-D01ieqGC.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-eZciuLw_.js → imports-page-DJG1BJzd.js} +1 -1
- package/dist/gateway/static/root/assets/index-B7EieIE4.js +75 -0
- package/dist/gateway/static/root/assets/index-BD5uNzie.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B796W039.js → keyboard-shortcuts-settings-6A6JOHTI.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Cipj52Zq.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DXmY5jwM.js → local-apps-page-bD-m7YHJ.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-D0001I7p.js → locale-store-eliqUnBr.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-D5feO2yw.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-b1MG7s-3.js → management-settings-B7mz0_44.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-2txE_Blz.js → markdown-view-BIg7cei7.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CDEf3ksI.js → media-plugins-DQ2HfMeG.js} +1 -1
- package/dist/gateway/static/root/assets/messages-NYDOR8-j.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-DhYJigb3.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-Bg5NPUdf.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-Bi_-DA5J.js → page-tabs-DmG_Qjl8.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Dhfdf14p.js → preview-open-alternatives-Y9J1kjKC.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-BNouL7Tv.js → proactive-page-Duc_NQ8l.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BkbZBqBr.js → product-open-page-DtgWUAwT.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DVOiucVA.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Dr_kDoCJ.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-icwoEKYB.js → registry-api-Dpm3N2h0.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-hyJ2KKKK.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-bmgxwWpW.js → runtime-tools-settings-panel-DB7J9opJ.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DoZeepCg.js → schema-form-CMYuPOlE.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DGsnYcoh.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DuzZqQMn.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-sw2bbS2b.js → settings-form-section-BayJP08a.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BWF8uac0.js → settings-page-CWBqZtt6.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C97S5g5c.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BIHYD6-O.js → share-preview-page-Wn5bQA-5.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-pfVzP8F7.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DDJ0ZKx3.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DbDpLjDW.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-dvue6Ish.js → skills-page.utils-DCHY_kou.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DCyxPWCl.js → system-settings-panel-DhgITgId.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-UqwtiHYu.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-CZwYGpbY.js → theme-store-DUHPzKzv.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-__auf8Ww.js → tunnel-api-DJ3gz2tM.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-Iq83UDt3.js → use-autosave-htvgT192.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-xOsXY_2W.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-D-QssKik.js → voice-api-key-field-BviJF3Oa.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-B0wNN_tE.js → voice-config-api-Bjy8EFqi.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-5NRYg1iI.js → work-discovery-overlay-BOBVNEYZ.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Ds2SZjLG.js → workflow-run-setup-panel-D1N9uUyM.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-2ylzlgkG.js +6 -0
- package/dist/gateway/static/root/index.html +10 -10
- package/dist/package.js +1 -1
- package/dist/packages/computer-control-contract/src/index.js +178 -0
- package/dist/packages/realtime-protocol/src/voice-audio.js +15 -10
- package/dist/packages/realtime-protocol/src/voice-catalog.js +61 -0
- package/dist/packages/realtime-protocol/src/voice.js +257 -248
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +5 -4
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +9 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +4 -2
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/index.js +25 -15
- package/dist/src/agent/skills/parse-skill-metadata.d.ts +5 -1
- package/dist/src/agent/skills/parse-skill-metadata.js +21 -1
- package/dist/src/agent/skills/types.d.ts +7 -0
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tool-manuals/computer.d.ts +1 -0
- package/dist/src/agent/tool-manuals/computer.js +19 -0
- package/dist/src/agent/tool-manuals/index.js +7 -0
- package/dist/src/agent/tools/computer-use-tool.d.ts +11 -0
- package/dist/src/agent/tools/computer-use-tool.js +86 -0
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +30 -0
- package/dist/src/agent-config/index.js +2 -2
- package/dist/src/agent-config/resolver.js +5 -0
- package/dist/src/agent-config/schema.d.ts +32 -0
- package/dist/src/agent-config/schema.js +5 -2
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/capabilities/readiness/from-config.js +14 -2
- package/dist/src/capabilities/readiness/planner.js +3 -2
- package/dist/src/capabilities/readiness/types.d.ts +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +3 -3
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/computer/broker.d.ts +97 -0
- package/dist/src/computer/broker.js +337 -0
- package/dist/src/computer/config.d.ts +9 -0
- package/dist/src/computer/config.js +16 -0
- package/dist/src/computer/control-guard.d.ts +4 -0
- package/dist/src/computer/control-guard.js +17 -0
- package/dist/src/computer/errors.d.ts +7 -0
- package/dist/src/computer/errors.js +30 -0
- package/dist/src/computer/model-adapter.d.ts +44 -0
- package/dist/src/computer/model-adapter.js +273 -0
- package/dist/src/computer/model-config.d.ts +3 -0
- package/dist/src/computer/model-config.js +27 -0
- package/dist/src/computer/model-policy.d.ts +3 -0
- package/dist/src/computer/model-policy.js +20 -0
- package/dist/src/computer/runtime.d.ts +128 -0
- package/dist/src/computer/runtime.js +388 -0
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.d.ts +36 -0
- package/dist/src/config/models-json.js +15 -1
- package/dist/src/config/schema.d.ts +37 -0
- package/dist/src/config/schema.js +11 -2
- package/dist/src/config/voice.js +2 -2
- package/dist/src/endpoint-tools/invocation-service.d.ts +1 -0
- package/dist/src/endpoint-tools/invocation-service.js +5 -2
- package/dist/src/endpoint-tools/policy.js +7 -0
- package/dist/src/endpoint-tools/runtime.js +1 -0
- package/dist/src/endpoint-tools/upload-service.d.ts +13 -1
- package/dist/src/endpoint-tools/upload-service.js +73 -8
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +7 -1
- package/dist/src/gateway/agent-builtin-tools.js +7 -0
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/global-defaults-admin.js +16 -0
- package/dist/src/gateway/hono/lib/config-payload.d.ts +15 -0
- package/dist/src/gateway/hono/lib/config-payload.js +2 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +13 -2
- package/dist/src/gateway/hono/routes/endpoint-tools.js +3 -2
- package/dist/src/gateway/hono/routes/models.js +6 -3
- package/dist/src/gateway/hono/routes/voice.js +55 -1
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/security/gateway-scopes.d.ts +1 -1
- package/dist/src/gateway/security/gateway-scopes.js +3 -0
- package/dist/src/gateway/service/config-coordinator.js +4 -1
- package/dist/src/gateway/service.js +12 -12
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-catalog-persistence.js +11 -2
- package/dist/src/providers/model-catalog-store.js +1 -0
- package/dist/src/providers/model-catalog-types.d.ts +7 -2
- package/dist/src/providers/model-reference-auditor.js +6 -3
- package/dist/src/providers/model-registry.js +4 -1
- package/dist/src/providers/model-supplements.js +18 -2
- package/dist/src/providers/presentation.js +4 -2
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/providers/xopc-cloud-model-source.js +10 -4
- package/dist/src/storage/sqlite/index.d.ts +1 -1
- package/dist/src/storage/sqlite/index.js +2 -2
- package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +8 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.js +17 -7
- package/dist/src/storage/sqlite/migrations/conversation-windows-owners.js +5 -2
- package/dist/src/storage/sqlite/migrations/discover.js +2 -2
- package/dist/src/storage/sqlite/migrations/errors.d.ts +5 -0
- package/dist/src/storage/sqlite/migrations/errors.js +12 -2
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -2
- package/dist/src/storage/sqlite/schema.js +2 -2
- package/dist/src/storage/sqlite/schema.sql +2641 -526
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +2 -2
- package/dist/src/voice/platform-catalog.d.ts +81 -0
- package/dist/src/voice/platform-catalog.js +16 -0
- package/dist/src/voice/platform-settings.d.ts +4 -0
- package/dist/src/voice/platform-settings.js +120 -0
- package/dist/src/voice/platform-streams.d.ts +12 -0
- package/dist/src/voice/platform-streams.js +250 -0
- package/dist/src/voice/realtime/omniEngine.js +8 -5
- package/dist/src/voice/realtime/omniRoute.d.ts +1 -0
- package/dist/src/voice/realtime/omniRoute.js +11 -1
- package/dist/src/voice/realtime/runtime.js +14 -6
- package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +15 -8
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +12 -19
- package/dist/src/work-discovery/service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +7 -4
- package/skills/creative/algorithmic-art/SKILL.md +7 -0
- package/skills/creative/frontend-design/SKILL.md +8 -0
- package/skills/creative/hatch-pet/SKILL.md +7 -0
- package/skills/creative/theme-factory/SKILL.md +8 -0
- package/skills/documents/doc-coauthoring/SKILL.md +7 -0
- package/skills/documents/docx/SKILL.md +7 -0
- package/skills/documents/pdf/SKILL.md +7 -0
- package/skills/documents/pptx/SKILL.md +7 -0
- package/skills/documents/xlsx/SKILL.md +9 -1
- package/skills/engineering/build-xopc-local-app/SKILL.md +7 -0
- package/skills/engineering/define-task/SKILL.md +7 -0
- package/skills/engineering/diagnose/SKILL.md +8 -0
- package/skills/engineering/tdd/SKILL.md +8 -0
- package/skills/tools/find-skills/SKILL.md +8 -0
- package/skills/tools/github/SKILL.md +7 -0
- package/skills/tools/summarize/SKILL.md +8 -0
- package/skills/tools/webapp-testing/SKILL.md +8 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BxR5eog4.js +0 -1
- package/dist/gateway/static/root/assets/agents-Dx1om1eN.js +0 -1
- package/dist/gateway/static/root/assets/api-q1kIMCLW.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-DUZE1NOH.js +0 -6
- package/dist/gateway/static/root/assets/capabilities-settings-panel-ohEV64hG.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-UOf9mgqt.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BEQR0NRq.js +0 -2
- package/dist/gateway/static/root/assets/gateway-settings-CDJY1AOW.js +0 -1
- package/dist/gateway/static/root/assets/home-page-_oqo0pNR.js +0 -1
- package/dist/gateway/static/root/assets/index--YC42LAz.css +0 -2
- package/dist/gateway/static/root/assets/index-fVtuw2o9.js +0 -75
- package/dist/gateway/static/root/assets/local-app-workbench-page-Z8mpau9d.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-BGOO8ouT.js +0 -2
- package/dist/gateway/static/root/assets/messages-BWANv-N-.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-Bm33_3xJ.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-C32-xssK.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-CZ7glGYw.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DP3ZINZz.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-xqJcPdOO.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BaxIfjpm.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cy3Ab3Vg.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BuYto2mT.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DKtWUneq.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Dn7ElMUk.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-D-7UtJIc.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-efmH43Pq.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-DByIJcQq.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-BJv3eoKR.js +0 -6
- package/dist/src/storage/sqlite/migrations/002_add_flush_columns.sql +0 -3
- package/dist/src/storage/sqlite/migrations/003_add_note_markdown_meta.sql +0 -4
- package/dist/src/storage/sqlite/migrations/004_add_session_type_metadata.sql +0 -15
- package/dist/src/storage/sqlite/migrations/005_add_note_agent_contexts.sql +0 -10
- package/dist/src/storage/sqlite/migrations/006_add_goals.sql +0 -108
- package/dist/src/storage/sqlite/migrations/007_goal_run_judge_schema.sql +0 -4
- package/dist/src/storage/sqlite/migrations/008_goal_queue_workflow_runs.sql +0 -53
- package/dist/src/storage/sqlite/migrations/009_cron_jobs.sql +0 -24
- package/dist/src/storage/sqlite/migrations/010_session_id_identity.sql +0 -30
- package/dist/src/storage/sqlite/migrations/011_goal_context_messages.sql +0 -8
- package/dist/src/storage/sqlite/migrations/012_memory_records.sql +0 -63
- package/dist/src/storage/sqlite/migrations/013_memory_trace_events.sql +0 -21
- package/dist/src/storage/sqlite/migrations/014_memory_record_governance.sql +0 -10
- package/dist/src/storage/sqlite/migrations/015_memory_trace_feedback.sql +0 -4
- package/dist/src/storage/sqlite/migrations/016_automations.sql +0 -47
- package/dist/src/storage/sqlite/migrations/017_automation_run_events.sql +0 -14
- package/dist/src/storage/sqlite/migrations/018_automation_safety.sql +0 -1
- package/dist/src/storage/sqlite/migrations/019_projects.sql +0 -40
- package/dist/src/storage/sqlite/migrations/020_project_default_agent.sql +0 -1
- package/dist/src/storage/sqlite/migrations/021_projects_fts.sql +0 -21
- package/dist/src/storage/sqlite/migrations/022_work_items.sql +0 -61
- package/dist/src/storage/sqlite/migrations/023_work_item_attachments.sql +0 -15
- package/dist/src/storage/sqlite/migrations/024_activity_events.sql +0 -62
- package/dist/src/storage/sqlite/migrations/025_project_pinned_at.sql +0 -5
- package/dist/src/storage/sqlite/migrations/026_goal_contracts.sql +0 -10
- package/dist/src/storage/sqlite/migrations/027_mobile_notifications.sql +0 -43
- package/dist/src/storage/sqlite/migrations/028_goal_evidence_requirements.sql +0 -47
- package/dist/src/storage/sqlite/migrations/029_user_understanding.sql +0 -133
- package/dist/src/storage/sqlite/migrations/030_connectors.sql +0 -94
- package/dist/src/storage/sqlite/migrations/031_connector_approvals.sql +0 -24
- package/dist/src/storage/sqlite/migrations/032_connector_webhook_deliveries.sql +0 -15
- package/dist/src/storage/sqlite/migrations/033_user_trust_policies.sql +0 -6
- package/dist/src/storage/sqlite/migrations/034_allow_global_auto_trust.sql +0 -14
- package/dist/src/storage/sqlite/migrations/035_user_profile_prompt_state.sql +0 -7
- package/dist/src/storage/sqlite/migrations/036_goal_outcome_metric.sql +0 -12
- package/dist/src/storage/sqlite/migrations/037_connected_knowledge_pipeline.sql +0 -47
- package/dist/src/storage/sqlite/migrations/038_user_owned_memory.sql +0 -68
- package/dist/src/storage/sqlite/migrations/039_memory_reference_consents.sql +0 -19
- package/dist/src/storage/sqlite/migrations/040_local_apps.sql +0 -32
- package/dist/src/storage/sqlite/migrations/041_local_app_release_lifecycle.sql +0 -17
- package/dist/src/storage/sqlite/migrations/042_work_discovery.sql +0 -41
- package/dist/src/storage/sqlite/migrations/043_local_app_acceptance_runs.sql +0 -16
- package/dist/src/storage/sqlite/migrations/044_repair_work_discovery_foreign_keys.sql +0 -75
- package/dist/src/storage/sqlite/migrations/045_extension_ui_grants.sql +0 -13
- package/dist/src/storage/sqlite/migrations/046_work_discovery_feedback.sql +0 -13
- package/dist/src/storage/sqlite/migrations/047_work_discovery_sources.sql +0 -16
- package/dist/src/storage/sqlite/migrations/048_work_understanding_investigations.sql +0 -40
- package/dist/src/storage/sqlite/migrations/049_work_understanding_threads.sql +0 -52
- package/dist/src/storage/sqlite/migrations/050_work_discovery_source_refreshes.sql +0 -15
- package/dist/src/storage/sqlite/migrations/051_focus_watches.sql +0 -26
- package/dist/src/storage/sqlite/migrations/052_proactive_insights.sql +0 -25
- package/dist/src/storage/sqlite/migrations/053_browser_recipes.sql +0 -45
- package/dist/src/storage/sqlite/migrations/054_task_outcomes.sql +0 -24
- package/dist/src/storage/sqlite/migrations/055_relationship_settings.sql +0 -14
- package/dist/src/storage/sqlite/migrations/056_task_verification.sql +0 -6
- package/dist/src/storage/sqlite/migrations/057_interaction_states.sql +0 -11
- package/dist/src/storage/sqlite/migrations/058_proactive_value.sql +0 -3
- package/dist/src/storage/sqlite/migrations/059_composer_input_history.sql +0 -8
- package/dist/src/storage/sqlite/migrations/060_remove_runtime_transcript_messages.sql +0 -45
- package/dist/src/storage/sqlite/migrations/061_drop_compaction_checkpoints.sql +0 -2
- package/dist/src/storage/sqlite/migrations/062_connector_learning_jobs.sql +0 -27
- package/dist/src/storage/sqlite/migrations/063_knowledge_collection_scopes.sql +0 -14
- package/dist/src/storage/sqlite/migrations/064_user_claims.sql +0 -60
- package/dist/src/storage/sqlite/migrations/065_knowledge_item_scope_identity.sql +0 -116
- package/dist/src/storage/sqlite/migrations/066_first_class_focuses.sql +0 -126
- package/dist/src/storage/sqlite/migrations/067_home_attention_acknowledgements.sql +0 -9
- package/dist/src/storage/sqlite/migrations/068_proactive_event_spine.sql +0 -71
- package/dist/src/storage/sqlite/migrations/069_proactive_scenario_control.sql +0 -69
- package/dist/src/storage/sqlite/migrations/070_proactive_execution.sql +0 -55
- package/dist/src/storage/sqlite/migrations/071_proactive_inbox.sql +0 -45
- package/dist/src/storage/sqlite/migrations/072_proactive_judgments.sql +0 -14
- package/dist/src/storage/sqlite/migrations/073_enable_default_proactive_scenarios.sql +0 -13
- package/dist/src/storage/sqlite/migrations/074_deduplicate_blocked_work_routing.sql +0 -5
- package/dist/src/storage/sqlite/migrations/075_connector_sync_policies.sql +0 -13
- package/dist/src/storage/sqlite/migrations/076_meeting_preparation_scenario.sql +0 -29
- package/dist/src/storage/sqlite/migrations/077_proactive_insight_fingerprints.sql +0 -4
- package/dist/src/storage/sqlite/migrations/078_discussion_captures.sql +0 -64
- package/dist/src/storage/sqlite/migrations/079_discussion_follow_up_scenario.sql +0 -29
- package/dist/src/storage/sqlite/migrations/080_task_outcome_context.sql +0 -15
- package/dist/src/storage/sqlite/migrations/081_project_monitoring_policies.sql +0 -10
- package/dist/src/storage/sqlite/migrations/082_one_click_live_discussions.sql +0 -100
- package/dist/src/storage/sqlite/migrations/083_session_task_plans.sql +0 -9
- package/dist/src/storage/sqlite/migrations/084_work_intake_lifecycle.sql +0 -26
- package/dist/src/storage/sqlite/migrations/085_task_outcome_projection.sql +0 -19
- package/dist/src/storage/sqlite/migrations/086_outcome_aggregates.sql +0 -168
- package/dist/src/storage/sqlite/migrations/087_context_snapshots.sql +0 -21
- package/dist/src/storage/sqlite/migrations/088_automation_execution_deadlines.sql +0 -5
- package/dist/src/storage/sqlite/migrations/089_automation_run_leases.sql +0 -8
- package/dist/src/storage/sqlite/migrations/090_outcome_contract_judgment.sql +0 -2
- package/dist/src/storage/sqlite/migrations/091_context_allocation.sql +0 -1
- package/dist/src/storage/sqlite/migrations/092_outcome_execution_runtime.sql +0 -88
- package/dist/src/storage/sqlite/migrations/093_remove_legacy_goals.sql +0 -174
- package/dist/src/storage/sqlite/migrations/094_outcome_judgment_and_authority.sql +0 -3
- package/dist/src/storage/sqlite/migrations/095_session_input_queue.sql +0 -35
- package/dist/src/storage/sqlite/migrations/096_drop_work_intakes.sql +0 -6
- package/dist/src/storage/sqlite/migrations/097_work_item_lifecycle.sql +0 -194
- package/dist/src/storage/sqlite/migrations/098_discussion_note_documents.sql +0 -99
- package/dist/src/storage/sqlite/migrations/099_task_model.sql +0 -500
- package/dist/src/storage/sqlite/migrations/100_project_task_taskrun.sql +0 -763
- package/dist/src/storage/sqlite/migrations/101_session_response_language.sql +0 -1
- package/dist/src/storage/sqlite/migrations/102_session_user_context_mode.sql +0 -2
- package/dist/src/storage/sqlite/migrations/103_finalize_structured_memory.sql +0 -3
- package/dist/src/storage/sqlite/migrations/104_turn_memory_feedback.sql +0 -77
- package/dist/src/storage/sqlite/migrations/105_dreaming_ledger.sql +0 -34
- package/dist/src/storage/sqlite/migrations/106_dreaming_run_reproducibility.sql +0 -2
- package/dist/src/storage/sqlite/migrations/107_connector_accounts.sql +0 -146
- package/dist/src/storage/sqlite/migrations/108_repair_user_memory_provider.sql +0 -18
- package/dist/src/storage/sqlite/migrations/109_endpoint_principals.sql +0 -14
- package/dist/src/storage/sqlite/migrations/110_session_input_origin.sql +0 -43
- package/dist/src/storage/sqlite/migrations/111_endpoint_tool_invocations.sql +0 -18
- package/dist/src/storage/sqlite/migrations/112_endpoint_instance_bindings.sql +0 -8
- package/dist/src/storage/sqlite/migrations/113_memory_evidence_single_source.sql +0 -76
- package/dist/src/storage/sqlite/migrations/114_user_context_domain.sql +0 -193
- package/dist/src/storage/sqlite/migrations/115_remove_legacy_user_context.sql +0 -6
- package/dist/src/storage/sqlite/migrations/116_structured_context_consolidation.sql +0 -38
- package/dist/src/storage/sqlite/migrations/117_unified_understanding_sources.sql +0 -110
- package/dist/src/storage/sqlite/migrations/118_task_board_rank.sql +0 -6
- package/dist/src/storage/sqlite/migrations/119_proactive_disposition.sql +0 -13
- package/dist/src/storage/sqlite/migrations/120_task_conversation.sql +0 -112
- package/dist/src/storage/sqlite/migrations/121_automation_inbox.sql +0 -24
- package/dist/src/storage/sqlite/migrations/122_automation_session_projects.sql +0 -18
- package/dist/src/storage/sqlite/migrations/123_remove_v2_compaction_boundaries.sql +0 -25
- package/dist/src/storage/sqlite/migrations/124_workflow_context_snapshots.sql +0 -15
- package/dist/src/storage/sqlite/migrations/125_project_workflow_presets.sql +0 -12
- package/dist/src/storage/sqlite/migrations/126_focus_context_governance.sql +0 -72
- package/dist/src/storage/sqlite/migrations/127_context_object_origin.sql +0 -36
- package/dist/src/storage/sqlite/migrations/128_context_extraction.sql +0 -73
- package/dist/src/storage/sqlite/migrations/129_focus_versions.sql +0 -51
- package/dist/src/storage/sqlite/migrations/130_context_evidence_provenance.sql +0 -18
- package/dist/src/storage/sqlite/migrations/131_session_input_contexts.sql +0 -2
- package/dist/src/storage/sqlite/migrations/132_transcript_source_context_metadata.sql +0 -34
- package/dist/src/storage/sqlite/migrations/133_archive_legacy_work_discovery_profile_facts.sql +0 -11
- package/dist/src/storage/sqlite/migrations/134_memory_provenance.sql +0 -18
- package/dist/src/storage/sqlite/migrations/135_user_people.sql +0 -59
- package/dist/src/storage/sqlite/migrations/136_product_notifications.sql +0 -79
- package/dist/src/storage/sqlite/migrations/137_understanding_status_audit.sql +0 -71
- package/dist/src/storage/sqlite/migrations/138_device_access.sql +0 -96
- package/dist/src/storage/sqlite/migrations/139_turn_outcome_artifact_backfill.sql +0 -231
- package/dist/src/storage/sqlite/migrations/140_endpoint_session_bindings.sql +0 -8
- package/dist/src/storage/sqlite/migrations/141_device_pairing_approval.sql +0 -17
- package/dist/src/storage/sqlite/migrations/142_session_input_instance.sql +0 -1
- package/dist/src/storage/sqlite/migrations/143_fixed_session_model.sql +0 -1
- package/dist/src/storage/sqlite/migrations/144_execution_environments.sql +0 -59
- package/dist/src/storage/sqlite/migrations/145_project_execution_mode.sql +0 -5
- package/dist/src/storage/sqlite/migrations/146_understanding_focus_exclusions.sql +0 -9
- package/dist/src/storage/sqlite/migrations/147_durable_application_state.sql +0 -39
- package/dist/src/storage/sqlite/migrations/148_user_model_foundation.sql +0 -554
- package/dist/src/storage/sqlite/migrations/149_separate_source_index_from_memory.sql +0 -18
- package/dist/src/storage/sqlite/migrations/150_session_connection_waits.sql +0 -47
- package/dist/src/storage/sqlite/migrations/151_proactive_scope_cleanup.sql +0 -6
- package/dist/src/storage/sqlite/migrations/152_proactive_scenario_contract.sql +0 -140
- package/dist/src/storage/sqlite/migrations/153_browser_control_v2.sql +0 -45
- package/dist/src/storage/sqlite/migrations/154_session_clarification_waits.sql +0 -60
- package/dist/src/storage/sqlite/migrations/155_browser_extension.sql +0 -120
- package/dist/src/storage/sqlite/migrations/156_browser_tab_bindings.sql +0 -14
- package/dist/src/storage/sqlite/migrations/157_browser_endpoint_principals.sql +0 -50
- package/dist/src/storage/sqlite/migrations/158_browser_native_enrollment.sql +0 -4
- package/dist/src/storage/sqlite/migrations/159_proactive_controls.sql +0 -68
- package/dist/src/storage/sqlite/migrations/160_proactive_web_push.sql +0 -27
- package/dist/src/storage/sqlite/migrations/161_proactive_delivery_and_lifecycle.sql +0 -51
- package/dist/src/storage/sqlite/migrations/162_proactive_product.sql +0 -7
- package/dist/src/storage/sqlite/migrations/163_proactive_follow_ups.sql +0 -29
- package/dist/src/storage/sqlite/migrations/164_browser_sessions.sql +0 -8
- package/dist/src/storage/sqlite/migrations/165_device_pairing_target.sql +0 -40
- package/dist/src/storage/sqlite/migrations/__tests__/mobile-discussion-source.test.ts +0 -20
- package/dist/src/storage/sqlite/migrations/conversation-backup.ts +0 -66
- package/dist/src/storage/sqlite/migrations/conversation-key-decoder.ts +0 -50
- package/dist/src/storage/sqlite/migrations/conversation-uuid.ts +0 -324
- package/dist/src/storage/sqlite/migrations/conversation-windows-owners.ts +0 -71
- package/dist/src/storage/sqlite/migrations/discover.ts +0 -52
- package/dist/src/storage/sqlite/migrations/errors.ts +0 -32
- package/dist/src/storage/sqlite/migrations/runner.ts +0 -204
- package/dist/src/storage/sqlite/migrations/types.ts +0 -15
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ALTER TABLE session_config ADD COLUMN response_language TEXT;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
CREATE TEMP TABLE legacy_memory_feedback AS
|
|
2
|
-
SELECT trace_id, COALESCE(turn_id, trace_id) AS turn_id, feedback_json, created_at
|
|
3
|
-
FROM memory_trace_events
|
|
4
|
-
WHERE json_extract(feedback_json, '$.rating') IN ('helpful', 'not_helpful', 'mixed', 'irrelevant');
|
|
5
|
-
|
|
6
|
-
CREATE TABLE memory_trace_events_next (
|
|
7
|
-
trace_id TEXT PRIMARY KEY,
|
|
8
|
-
session_key TEXT,
|
|
9
|
-
turn_id TEXT,
|
|
10
|
-
phase TEXT NOT NULL,
|
|
11
|
-
provider_id TEXT NOT NULL,
|
|
12
|
-
request_json TEXT NOT NULL DEFAULT '{}',
|
|
13
|
-
result_count INTEGER,
|
|
14
|
-
selected_record_ids_json TEXT NOT NULL DEFAULT '[]',
|
|
15
|
-
skipped_reason TEXT,
|
|
16
|
-
error TEXT,
|
|
17
|
-
duration_ms INTEGER NOT NULL DEFAULT 0,
|
|
18
|
-
created_at INTEGER NOT NULL,
|
|
19
|
-
user_id TEXT NOT NULL DEFAULT 'local-owner',
|
|
20
|
-
source_agent_id TEXT
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
INSERT INTO memory_trace_events_next
|
|
24
|
-
SELECT trace_id, session_key, turn_id, phase, provider_id, request_json,
|
|
25
|
-
result_count, selected_record_ids_json, skipped_reason, error,
|
|
26
|
-
duration_ms, created_at, user_id, source_agent_id
|
|
27
|
-
FROM memory_trace_events;
|
|
28
|
-
|
|
29
|
-
DROP TABLE memory_trace_events;
|
|
30
|
-
ALTER TABLE memory_trace_events_next RENAME TO memory_trace_events;
|
|
31
|
-
|
|
32
|
-
CREATE INDEX idx_memory_trace_created ON memory_trace_events(created_at DESC);
|
|
33
|
-
CREATE INDEX idx_memory_trace_provider_created ON memory_trace_events(provider_id, created_at DESC);
|
|
34
|
-
CREATE INDEX idx_memory_trace_session_created ON memory_trace_events(session_key, created_at DESC);
|
|
35
|
-
CREATE INDEX idx_memory_trace_user_created ON memory_trace_events(user_id, created_at DESC);
|
|
36
|
-
CREATE INDEX idx_memory_trace_source_agent_created ON memory_trace_events(source_agent_id, created_at DESC);
|
|
37
|
-
CREATE UNIQUE INDEX idx_memory_trace_turn_inject
|
|
38
|
-
ON memory_trace_events(turn_id)
|
|
39
|
-
WHERE phase = 'inject' AND turn_id IS NOT NULL;
|
|
40
|
-
|
|
41
|
-
CREATE TABLE memory_feedback (
|
|
42
|
-
feedback_id TEXT PRIMARY KEY,
|
|
43
|
-
trace_id TEXT NOT NULL REFERENCES memory_trace_events(trace_id) ON DELETE CASCADE,
|
|
44
|
-
turn_id TEXT NOT NULL,
|
|
45
|
-
record_id TEXT REFERENCES memory_records(record_id) ON DELETE CASCADE,
|
|
46
|
-
level TEXT NOT NULL CHECK (level IN ('response', 'record')),
|
|
47
|
-
rating TEXT NOT NULL CHECK (rating IN (
|
|
48
|
-
'helpful', 'not_helpful', 'mixed', 'irrelevant', 'incorrect', 'outdated', 'sensitive'
|
|
49
|
-
)),
|
|
50
|
-
score REAL,
|
|
51
|
-
reason_code TEXT,
|
|
52
|
-
note TEXT,
|
|
53
|
-
source TEXT NOT NULL CHECK (source IN ('user', 'evaluator', 'system')),
|
|
54
|
-
created_at INTEGER NOT NULL,
|
|
55
|
-
updated_at INTEGER NOT NULL,
|
|
56
|
-
CHECK ((level = 'response' AND record_id IS NULL) OR (level = 'record' AND record_id IS NOT NULL))
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
CREATE UNIQUE INDEX idx_memory_feedback_target_source
|
|
60
|
-
ON memory_feedback(trace_id, level, COALESCE(record_id, ''), source);
|
|
61
|
-
CREATE INDEX idx_memory_feedback_turn ON memory_feedback(turn_id, updated_at DESC);
|
|
62
|
-
CREATE INDEX idx_memory_feedback_record ON memory_feedback(record_id, updated_at DESC);
|
|
63
|
-
|
|
64
|
-
INSERT INTO memory_feedback (
|
|
65
|
-
feedback_id, trace_id, turn_id, record_id, level, rating, score,
|
|
66
|
-
reason_code, note, source, created_at, updated_at
|
|
67
|
-
)
|
|
68
|
-
SELECT
|
|
69
|
-
lower(hex(randomblob(16))), trace_id, turn_id, NULL, 'response',
|
|
70
|
-
json_extract(feedback_json, '$.rating'), json_extract(feedback_json, '$.score'),
|
|
71
|
-
json_extract(feedback_json, '$.reason'), NULL,
|
|
72
|
-
COALESCE(json_extract(feedback_json, '$.source'), 'user'),
|
|
73
|
-
COALESCE(strftime('%s', json_extract(feedback_json, '$.createdAt')) * 1000, created_at),
|
|
74
|
-
COALESCE(strftime('%s', json_extract(feedback_json, '$.updatedAt')) * 1000, created_at)
|
|
75
|
-
FROM legacy_memory_feedback;
|
|
76
|
-
|
|
77
|
-
DROP TABLE legacy_memory_feedback;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
CREATE TABLE dreaming_runs (
|
|
2
|
-
run_id TEXT PRIMARY KEY,
|
|
3
|
-
agent_id TEXT NOT NULL,
|
|
4
|
-
workspace_id TEXT NOT NULL,
|
|
5
|
-
phase TEXT NOT NULL CHECK (phase IN ('light', 'deep', 'rem')),
|
|
6
|
-
mode TEXT NOT NULL CHECK (mode IN ('observe', 'review', 'automatic')),
|
|
7
|
-
trigger_kind TEXT NOT NULL CHECK (trigger_kind IN ('schedule', 'manual')),
|
|
8
|
-
status TEXT NOT NULL CHECK (status IN ('running', 'completed', 'failed')),
|
|
9
|
-
reason TEXT,
|
|
10
|
-
metrics_json TEXT NOT NULL DEFAULT '{}',
|
|
11
|
-
started_at INTEGER NOT NULL,
|
|
12
|
-
completed_at INTEGER
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
CREATE INDEX idx_dreaming_runs_agent_started
|
|
16
|
-
ON dreaming_runs(agent_id, started_at DESC);
|
|
17
|
-
CREATE INDEX idx_dreaming_runs_workspace_started
|
|
18
|
-
ON dreaming_runs(workspace_id, started_at DESC);
|
|
19
|
-
|
|
20
|
-
CREATE TABLE dreaming_decisions (
|
|
21
|
-
decision_id TEXT PRIMARY KEY,
|
|
22
|
-
run_id TEXT NOT NULL REFERENCES dreaming_runs(run_id) ON DELETE CASCADE,
|
|
23
|
-
record_id TEXT REFERENCES memory_records(record_id) ON DELETE SET NULL,
|
|
24
|
-
action TEXT NOT NULL CHECK (action IN ('observe', 'propose', 'activate', 'skip')),
|
|
25
|
-
reason_code TEXT NOT NULL,
|
|
26
|
-
score REAL,
|
|
27
|
-
evidence_json TEXT NOT NULL DEFAULT '{}',
|
|
28
|
-
created_at INTEGER NOT NULL
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
CREATE INDEX idx_dreaming_decisions_run
|
|
32
|
-
ON dreaming_decisions(run_id, created_at);
|
|
33
|
-
CREATE INDEX idx_dreaming_decisions_record
|
|
34
|
-
ON dreaming_decisions(record_id, created_at DESC);
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
CREATE TABLE connector_accounts (
|
|
2
|
-
id TEXT PRIMARY KEY,
|
|
3
|
-
connector_id TEXT NOT NULL,
|
|
4
|
-
principal_id TEXT NOT NULL,
|
|
5
|
-
identity_key TEXT,
|
|
6
|
-
identity_json TEXT NOT NULL DEFAULT '{}',
|
|
7
|
-
current_connection_id TEXT,
|
|
8
|
-
created_at TEXT NOT NULL,
|
|
9
|
-
updated_at TEXT NOT NULL
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
CREATE UNIQUE INDEX idx_connector_accounts_identity
|
|
13
|
-
ON connector_accounts(principal_id, connector_id, identity_key)
|
|
14
|
-
WHERE identity_key IS NOT NULL;
|
|
15
|
-
|
|
16
|
-
ALTER TABLE connector_connections ADD COLUMN account_id TEXT REFERENCES connector_accounts(id) ON DELETE CASCADE;
|
|
17
|
-
|
|
18
|
-
INSERT INTO connector_accounts (
|
|
19
|
-
id, connector_id, principal_id, identity_json, current_connection_id, created_at, updated_at
|
|
20
|
-
)
|
|
21
|
-
SELECT
|
|
22
|
-
'account:' || id, connector_id, principal_id, identity_json, id, created_at, updated_at
|
|
23
|
-
FROM connector_connections;
|
|
24
|
-
|
|
25
|
-
UPDATE connector_connections SET account_id = 'account:' || id;
|
|
26
|
-
|
|
27
|
-
CREATE TEMP TABLE connector_source_instance_migrations (
|
|
28
|
-
old_id TEXT PRIMARY KEY,
|
|
29
|
-
new_id TEXT NOT NULL
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
INSERT INTO connector_source_instance_migrations (old_id, new_id)
|
|
33
|
-
SELECT
|
|
34
|
-
'composio:' || connector_id || ':' || id,
|
|
35
|
-
'composio:' || connector_id || ':' || account_id
|
|
36
|
-
FROM connector_connections
|
|
37
|
-
WHERE provider = 'composio';
|
|
38
|
-
|
|
39
|
-
UPDATE knowledge_source_items
|
|
40
|
-
SET source_instance_id = (
|
|
41
|
-
SELECT new_id FROM connector_source_instance_migrations
|
|
42
|
-
WHERE old_id = knowledge_source_items.source_instance_id
|
|
43
|
-
)
|
|
44
|
-
WHERE source_instance_id IN (SELECT old_id FROM connector_source_instance_migrations);
|
|
45
|
-
|
|
46
|
-
UPDATE knowledge_sync_runs
|
|
47
|
-
SET source_instance_id = (
|
|
48
|
-
SELECT new_id FROM connector_source_instance_migrations
|
|
49
|
-
WHERE old_id = knowledge_sync_runs.source_instance_id
|
|
50
|
-
)
|
|
51
|
-
WHERE source_instance_id IN (SELECT old_id FROM connector_source_instance_migrations);
|
|
52
|
-
|
|
53
|
-
UPDATE knowledge_collection_state
|
|
54
|
-
SET source_instance_id = (
|
|
55
|
-
SELECT new_id FROM connector_source_instance_migrations
|
|
56
|
-
WHERE old_id = knowledge_collection_state.source_instance_id
|
|
57
|
-
)
|
|
58
|
-
WHERE source_instance_id IN (SELECT old_id FROM connector_source_instance_migrations);
|
|
59
|
-
|
|
60
|
-
UPDATE knowledge_source_changes
|
|
61
|
-
SET source_instance_id = (
|
|
62
|
-
SELECT new_id FROM connector_source_instance_migrations
|
|
63
|
-
WHERE old_id = knowledge_source_changes.source_instance_id
|
|
64
|
-
)
|
|
65
|
-
WHERE source_instance_id IN (SELECT old_id FROM connector_source_instance_migrations);
|
|
66
|
-
|
|
67
|
-
UPDATE knowledge_consumer_watermarks
|
|
68
|
-
SET source_instance_id = (
|
|
69
|
-
SELECT new_id FROM connector_source_instance_migrations
|
|
70
|
-
WHERE old_id = knowledge_consumer_watermarks.source_instance_id
|
|
71
|
-
)
|
|
72
|
-
WHERE source_instance_id IN (SELECT old_id FROM connector_source_instance_migrations);
|
|
73
|
-
|
|
74
|
-
UPDATE user_claim_evidence
|
|
75
|
-
SET source_instance_id = (
|
|
76
|
-
SELECT new_id FROM connector_source_instance_migrations
|
|
77
|
-
WHERE old_id = user_claim_evidence.source_instance_id
|
|
78
|
-
)
|
|
79
|
-
WHERE source_instance_id IN (SELECT old_id FROM connector_source_instance_migrations);
|
|
80
|
-
|
|
81
|
-
UPDATE connector_learning_jobs
|
|
82
|
-
SET source_instance_id = (
|
|
83
|
-
SELECT new_id FROM connector_source_instance_migrations
|
|
84
|
-
WHERE old_id = connector_learning_jobs.source_instance_id
|
|
85
|
-
)
|
|
86
|
-
WHERE source_instance_id IN (SELECT old_id FROM connector_source_instance_migrations);
|
|
87
|
-
|
|
88
|
-
UPDATE memory_records
|
|
89
|
-
SET source_json = json_set(
|
|
90
|
-
source_json,
|
|
91
|
-
'$.sourceInstanceId',
|
|
92
|
-
(SELECT new_id FROM connector_source_instance_migrations
|
|
93
|
-
WHERE old_id = json_extract(memory_records.source_json, '$.sourceInstanceId'))
|
|
94
|
-
)
|
|
95
|
-
WHERE json_extract(source_json, '$.sourceInstanceId') IN (
|
|
96
|
-
SELECT old_id FROM connector_source_instance_migrations
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
DROP TABLE connector_source_instance_migrations;
|
|
100
|
-
|
|
101
|
-
CREATE UNIQUE INDEX idx_connector_connections_provider_identity
|
|
102
|
-
ON connector_connections(provider, provider_connection_id);
|
|
103
|
-
CREATE INDEX idx_connector_connections_account
|
|
104
|
-
ON connector_connections(account_id, status, updated_at DESC);
|
|
105
|
-
|
|
106
|
-
ALTER TABLE connector_learning_jobs ADD COLUMN account_id TEXT REFERENCES connector_accounts(id) ON DELETE CASCADE;
|
|
107
|
-
UPDATE connector_learning_jobs
|
|
108
|
-
SET account_id = (
|
|
109
|
-
SELECT account_id FROM connector_connections
|
|
110
|
-
WHERE connector_connections.id = connector_learning_jobs.connection_id
|
|
111
|
-
);
|
|
112
|
-
CREATE INDEX idx_connector_learning_jobs_account
|
|
113
|
-
ON connector_learning_jobs(account_id, created_at DESC);
|
|
114
|
-
|
|
115
|
-
ALTER TABLE connector_sync_policies RENAME TO connector_sync_policies_by_connection;
|
|
116
|
-
|
|
117
|
-
CREATE TABLE connector_sync_policies (
|
|
118
|
-
account_id TEXT PRIMARY KEY REFERENCES connector_accounts(id) ON DELETE CASCADE,
|
|
119
|
-
scan_enabled INTEGER NOT NULL DEFAULT 1 CHECK(scan_enabled IN (0, 1)),
|
|
120
|
-
proactive_enabled INTEGER NOT NULL DEFAULT 0 CHECK(proactive_enabled IN (0, 1)),
|
|
121
|
-
interval_minutes INTEGER CHECK(interval_minutes IS NULL OR interval_minutes BETWEEN 5 AND 1440),
|
|
122
|
-
allowed_scenario_keys_json TEXT NOT NULL DEFAULT '[]',
|
|
123
|
-
revision INTEGER NOT NULL DEFAULT 1,
|
|
124
|
-
updated_at INTEGER NOT NULL
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
INSERT INTO connector_sync_policies (
|
|
128
|
-
account_id, scan_enabled, proactive_enabled, interval_minutes,
|
|
129
|
-
allowed_scenario_keys_json, revision, updated_at
|
|
130
|
-
)
|
|
131
|
-
SELECT
|
|
132
|
-
connector_connections.account_id,
|
|
133
|
-
connector_sync_policies_by_connection.scan_enabled,
|
|
134
|
-
connector_sync_policies_by_connection.proactive_enabled,
|
|
135
|
-
connector_sync_policies_by_connection.interval_minutes,
|
|
136
|
-
connector_sync_policies_by_connection.allowed_scenario_keys_json,
|
|
137
|
-
connector_sync_policies_by_connection.revision,
|
|
138
|
-
connector_sync_policies_by_connection.updated_at
|
|
139
|
-
FROM connector_sync_policies_by_connection
|
|
140
|
-
JOIN connector_connections
|
|
141
|
-
ON connector_connections.id = connector_sync_policies_by_connection.connection_id;
|
|
142
|
-
|
|
143
|
-
DROP TABLE connector_sync_policies_by_connection;
|
|
144
|
-
|
|
145
|
-
CREATE INDEX idx_connector_sync_policies_proactive
|
|
146
|
-
ON connector_sync_policies(proactive_enabled, account_id);
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
UPDATE memory_records
|
|
2
|
-
SET provider_id = 'local'
|
|
3
|
-
WHERE provider_id IN ('personal-context', 'connected-understanding')
|
|
4
|
-
AND EXISTS (
|
|
5
|
-
SELECT 1
|
|
6
|
-
FROM json_each(memory_records.tags_json)
|
|
7
|
-
WHERE json_each.value = 'user-understanding'
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
DELETE FROM memory_records_fts;
|
|
11
|
-
|
|
12
|
-
INSERT INTO memory_records_fts (
|
|
13
|
-
content, record_id, provider_id, kind, user_id, source_agent_id, workspace_id
|
|
14
|
-
)
|
|
15
|
-
SELECT
|
|
16
|
-
content, record_id, provider_id, kind, user_id, source_agent_id, workspace_id
|
|
17
|
-
FROM memory_records
|
|
18
|
-
WHERE trim(content) <> '';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
CREATE TABLE endpoint_principals (
|
|
2
|
-
id TEXT PRIMARY KEY,
|
|
3
|
-
kind TEXT NOT NULL CHECK(kind IN ('web', 'desktop', 'mobile')),
|
|
4
|
-
display_name TEXT NOT NULL,
|
|
5
|
-
platform TEXT NOT NULL,
|
|
6
|
-
public_key TEXT NOT NULL,
|
|
7
|
-
created_at INTEGER NOT NULL,
|
|
8
|
-
last_seen_at INTEGER,
|
|
9
|
-
revoked_at INTEGER
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
CREATE INDEX idx_endpoint_principals_active
|
|
13
|
-
ON endpoint_principals(kind, last_seen_at DESC)
|
|
14
|
-
WHERE revoked_at IS NULL;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
DROP INDEX idx_session_inputs_pending;
|
|
2
|
-
|
|
3
|
-
CREATE TABLE session_inputs_v110 (
|
|
4
|
-
id TEXT PRIMARY KEY,
|
|
5
|
-
session_key TEXT NOT NULL,
|
|
6
|
-
client_message_id TEXT NOT NULL,
|
|
7
|
-
requested_delivery TEXT NOT NULL CHECK (requested_delivery IN ('next', 'steer')),
|
|
8
|
-
effective_delivery TEXT NOT NULL CHECK (effective_delivery IN ('next', 'steer')),
|
|
9
|
-
status TEXT NOT NULL CHECK (status IN (
|
|
10
|
-
'queued', 'running', 'injecting',
|
|
11
|
-
'completed', 'cancelled', 'failed', 'interrupted'
|
|
12
|
-
)),
|
|
13
|
-
content TEXT NOT NULL,
|
|
14
|
-
attachments_json TEXT,
|
|
15
|
-
thinking TEXT,
|
|
16
|
-
origin_json TEXT NOT NULL,
|
|
17
|
-
position INTEGER NOT NULL,
|
|
18
|
-
target_run_id TEXT,
|
|
19
|
-
run_id TEXT,
|
|
20
|
-
version INTEGER NOT NULL DEFAULT 1,
|
|
21
|
-
error TEXT,
|
|
22
|
-
created_at_ms INTEGER NOT NULL,
|
|
23
|
-
updated_at_ms INTEGER NOT NULL,
|
|
24
|
-
UNIQUE(session_key, client_message_id)
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
INSERT INTO session_inputs_v110 (
|
|
28
|
-
id, session_key, client_message_id, requested_delivery, effective_delivery,
|
|
29
|
-
status, content, attachments_json, thinking, origin_json, position,
|
|
30
|
-
target_run_id, run_id, version, error, created_at_ms, updated_at_ms
|
|
31
|
-
)
|
|
32
|
-
SELECT
|
|
33
|
-
id, session_key, client_message_id, requested_delivery, effective_delivery,
|
|
34
|
-
status, content, attachments_json, thinking,
|
|
35
|
-
'{"type":"system","source":"internal"}', position,
|
|
36
|
-
target_run_id, run_id, version, error, created_at_ms, updated_at_ms
|
|
37
|
-
FROM session_inputs;
|
|
38
|
-
|
|
39
|
-
DROP TABLE session_inputs;
|
|
40
|
-
ALTER TABLE session_inputs_v110 RENAME TO session_inputs;
|
|
41
|
-
|
|
42
|
-
CREATE INDEX idx_session_inputs_pending
|
|
43
|
-
ON session_inputs(session_key, status, position, created_at_ms);
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
CREATE TABLE endpoint_tool_invocations (
|
|
2
|
-
id TEXT PRIMARY KEY,
|
|
3
|
-
principal_id TEXT NOT NULL,
|
|
4
|
-
endpoint_id TEXT NOT NULL,
|
|
5
|
-
tool_call_id TEXT NOT NULL,
|
|
6
|
-
tool_name TEXT NOT NULL,
|
|
7
|
-
effect TEXT NOT NULL CHECK(effect IN ('read', 'write', 'destructive')),
|
|
8
|
-
confirmation_required INTEGER NOT NULL CHECK(confirmation_required IN (0, 1)),
|
|
9
|
-
arguments_sha256 TEXT NOT NULL,
|
|
10
|
-
status TEXT NOT NULL CHECK(status IN ('running', 'succeeded', 'failed')),
|
|
11
|
-
error_code TEXT,
|
|
12
|
-
error_message TEXT,
|
|
13
|
-
started_at INTEGER NOT NULL,
|
|
14
|
-
completed_at INTEGER
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
CREATE INDEX idx_endpoint_tool_invocations_endpoint_started
|
|
18
|
-
ON endpoint_tool_invocations(endpoint_id, started_at DESC);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
CREATE TABLE endpoint_instance_bindings (
|
|
2
|
-
endpoint_id TEXT PRIMARY KEY,
|
|
3
|
-
principal_id TEXT NOT NULL REFERENCES endpoint_principals(id),
|
|
4
|
-
bound_at INTEGER NOT NULL
|
|
5
|
-
);
|
|
6
|
-
|
|
7
|
-
CREATE INDEX idx_endpoint_instance_bindings_principal
|
|
8
|
-
ON endpoint_instance_bindings(principal_id);
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
ALTER TABLE memory_evidence ADD COLUMN session_key TEXT;
|
|
2
|
-
ALTER TABLE memory_evidence ADD COLUMN turn_id TEXT;
|
|
3
|
-
ALTER TABLE memory_evidence ADD COLUMN tool_call_id TEXT;
|
|
4
|
-
|
|
5
|
-
-- Preserve evidence while treating deleted legacy sources like ON DELETE SET NULL.
|
|
6
|
-
WITH legacy AS (
|
|
7
|
-
SELECT
|
|
8
|
-
r.record_id,
|
|
9
|
-
source.item_id AS source_item_id,
|
|
10
|
-
COALESCE(json_extract(j.value, '$.relation'), 'supports') AS relation,
|
|
11
|
-
MAX(CAST(strftime('%s', json_extract(j.value, '$.observedAt')) AS INTEGER) * 1000) AS observed_at,
|
|
12
|
-
MAX(json_extract(j.value, '$.sessionKey')) AS session_key,
|
|
13
|
-
MAX(json_extract(j.value, '$.turnId')) AS turn_id,
|
|
14
|
-
MAX(json_extract(j.value, '$.toolCallId')) AS tool_call_id
|
|
15
|
-
FROM memory_records r
|
|
16
|
-
JOIN json_each(r.evidence_json) j
|
|
17
|
-
LEFT JOIN knowledge_source_items source
|
|
18
|
-
ON source.item_id = json_extract(j.value, '$.sourceItemId')
|
|
19
|
-
WHERE json_valid(r.evidence_json)
|
|
20
|
-
GROUP BY r.record_id, source_item_id, relation
|
|
21
|
-
)
|
|
22
|
-
UPDATE memory_evidence AS evidence
|
|
23
|
-
SET
|
|
24
|
-
observed_at = COALESCE(evidence.observed_at, legacy.observed_at),
|
|
25
|
-
session_key = COALESCE(evidence.session_key, legacy.session_key),
|
|
26
|
-
turn_id = COALESCE(evidence.turn_id, legacy.turn_id),
|
|
27
|
-
tool_call_id = COALESCE(evidence.tool_call_id, legacy.tool_call_id)
|
|
28
|
-
FROM legacy
|
|
29
|
-
WHERE evidence.record_id = legacy.record_id
|
|
30
|
-
AND COALESCE(evidence.source_item_id, '') = COALESCE(legacy.source_item_id, '')
|
|
31
|
-
AND evidence.relation = legacy.relation;
|
|
32
|
-
|
|
33
|
-
WITH legacy AS (
|
|
34
|
-
SELECT
|
|
35
|
-
r.record_id,
|
|
36
|
-
source.item_id AS source_item_id,
|
|
37
|
-
COALESCE(json_extract(j.value, '$.relation'), 'supports') AS relation,
|
|
38
|
-
MAX(json_extract(j.value, '$.sourceText')) AS excerpt,
|
|
39
|
-
MAX(json_extract(j.value, '$.confidence')) AS confidence,
|
|
40
|
-
MAX(CAST(strftime('%s', json_extract(j.value, '$.observedAt')) AS INTEGER) * 1000) AS observed_at,
|
|
41
|
-
MAX(json_extract(j.value, '$.sessionKey')) AS session_key,
|
|
42
|
-
MAX(json_extract(j.value, '$.turnId')) AS turn_id,
|
|
43
|
-
MAX(json_extract(j.value, '$.toolCallId')) AS tool_call_id,
|
|
44
|
-
MAX(r.created_at) AS created_at
|
|
45
|
-
FROM memory_records r
|
|
46
|
-
JOIN json_each(r.evidence_json) j
|
|
47
|
-
LEFT JOIN knowledge_source_items source
|
|
48
|
-
ON source.item_id = json_extract(j.value, '$.sourceItemId')
|
|
49
|
-
WHERE json_valid(r.evidence_json)
|
|
50
|
-
GROUP BY r.record_id, source_item_id, relation
|
|
51
|
-
)
|
|
52
|
-
INSERT INTO memory_evidence (
|
|
53
|
-
evidence_id, record_id, source_item_id, relation, excerpt, confidence,
|
|
54
|
-
observed_at, session_key, turn_id, tool_call_id, created_at
|
|
55
|
-
)
|
|
56
|
-
SELECT
|
|
57
|
-
lower(hex(randomblob(16))),
|
|
58
|
-
legacy.record_id,
|
|
59
|
-
legacy.source_item_id,
|
|
60
|
-
legacy.relation,
|
|
61
|
-
legacy.excerpt,
|
|
62
|
-
legacy.confidence,
|
|
63
|
-
legacy.observed_at,
|
|
64
|
-
legacy.session_key,
|
|
65
|
-
legacy.turn_id,
|
|
66
|
-
legacy.tool_call_id,
|
|
67
|
-
legacy.created_at
|
|
68
|
-
FROM legacy
|
|
69
|
-
WHERE NOT EXISTS (
|
|
70
|
-
SELECT 1 FROM memory_evidence e
|
|
71
|
-
WHERE e.record_id = legacy.record_id
|
|
72
|
-
AND COALESCE(e.source_item_id, '') = COALESCE(legacy.source_item_id, '')
|
|
73
|
-
AND e.relation = legacy.relation
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
ALTER TABLE memory_records DROP COLUMN evidence_json;
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
CREATE TABLE user_profiles (
|
|
2
|
-
principal_id TEXT PRIMARY KEY,
|
|
3
|
-
call_name TEXT NOT NULL DEFAULT '',
|
|
4
|
-
pronouns TEXT NOT NULL DEFAULT '',
|
|
5
|
-
timezone TEXT NOT NULL DEFAULT '',
|
|
6
|
-
locale TEXT NOT NULL DEFAULT '',
|
|
7
|
-
accessibility_json TEXT NOT NULL DEFAULT '{}',
|
|
8
|
-
created_at INTEGER NOT NULL,
|
|
9
|
-
updated_at INTEGER NOT NULL
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
CREATE TABLE user_understandings (
|
|
13
|
-
understanding_id TEXT PRIMARY KEY,
|
|
14
|
-
principal_id TEXT NOT NULL,
|
|
15
|
-
kind TEXT NOT NULL CHECK (kind IN (
|
|
16
|
-
'preference', 'boundary', 'relationship', 'routine', 'current_state',
|
|
17
|
-
'long_term_goal', 'project_context', 'task_lesson', 'derived_insight'
|
|
18
|
-
)),
|
|
19
|
-
canonical_key TEXT NOT NULL,
|
|
20
|
-
status TEXT NOT NULL CHECK (status IN (
|
|
21
|
-
'candidate', 'active', 'needs_review', 'stale', 'archived', 'rejected'
|
|
22
|
-
)),
|
|
23
|
-
scope_type TEXT NOT NULL CHECK (scope_type IN ('global', 'workspace', 'project', 'session')),
|
|
24
|
-
scope_id TEXT,
|
|
25
|
-
explicitness TEXT NOT NULL CHECK (explicitness IN ('explicit', 'observed', 'inferred')),
|
|
26
|
-
durability TEXT NOT NULL CHECK (durability IN ('ephemeral', 'durable', 'recurring')),
|
|
27
|
-
sensitivity TEXT NOT NULL CHECK (sensitivity IN ('normal', 'personal', 'secret', 'regulated')),
|
|
28
|
-
disclosure_policy TEXT NOT NULL CHECK (disclosure_policy IN ('silent', 'referenceable', 'ask_before_reference')),
|
|
29
|
-
confidence REAL NOT NULL CHECK (confidence >= 0 AND confidence <= 1),
|
|
30
|
-
valid_from INTEGER,
|
|
31
|
-
valid_to INTEGER,
|
|
32
|
-
expires_at INTEGER,
|
|
33
|
-
review_at INTEGER,
|
|
34
|
-
current_version_id TEXT NOT NULL REFERENCES user_understanding_versions(version_id)
|
|
35
|
-
DEFERRABLE INITIALLY DEFERRED,
|
|
36
|
-
conflict_group_id TEXT,
|
|
37
|
-
supersedes_id TEXT REFERENCES user_understandings(understanding_id) ON DELETE SET NULL,
|
|
38
|
-
created_at INTEGER NOT NULL,
|
|
39
|
-
updated_at INTEGER NOT NULL
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
CREATE TABLE user_understanding_versions (
|
|
43
|
-
version_id TEXT PRIMARY KEY,
|
|
44
|
-
understanding_id TEXT NOT NULL REFERENCES user_understandings(understanding_id) ON DELETE CASCADE,
|
|
45
|
-
statement TEXT NOT NULL,
|
|
46
|
-
payload_json TEXT NOT NULL DEFAULT '{}',
|
|
47
|
-
created_by TEXT NOT NULL CHECK (created_by IN ('user', 'runtime', 'connector', 'consolidation')),
|
|
48
|
-
change_reason TEXT NOT NULL,
|
|
49
|
-
created_at INTEGER NOT NULL
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
CREATE INDEX idx_user_understandings_principal_status
|
|
53
|
-
ON user_understandings(principal_id, status, updated_at DESC);
|
|
54
|
-
CREATE UNIQUE INDEX idx_user_understandings_active_canonical
|
|
55
|
-
ON user_understandings(principal_id, canonical_key, scope_type, COALESCE(scope_id, ''))
|
|
56
|
-
WHERE status IN ('candidate', 'active', 'needs_review', 'stale');
|
|
57
|
-
CREATE INDEX idx_user_understandings_scope
|
|
58
|
-
ON user_understandings(principal_id, scope_type, scope_id, status);
|
|
59
|
-
CREATE INDEX idx_user_understanding_versions_item
|
|
60
|
-
ON user_understanding_versions(understanding_id, created_at DESC);
|
|
61
|
-
|
|
62
|
-
CREATE VIRTUAL TABLE user_understanding_fts USING fts5(
|
|
63
|
-
statement,
|
|
64
|
-
understanding_id UNINDEXED,
|
|
65
|
-
version_id UNINDEXED,
|
|
66
|
-
tokenize='unicode61'
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
CREATE TABLE collaboration_rules (
|
|
70
|
-
rule_id TEXT PRIMARY KEY,
|
|
71
|
-
principal_id TEXT NOT NULL,
|
|
72
|
-
category TEXT NOT NULL CHECK (category IN ('communication', 'execution', 'boundary', 'routine', 'proactive')),
|
|
73
|
-
status TEXT NOT NULL CHECK (status IN ('active', 'disabled', 'archived')),
|
|
74
|
-
priority INTEGER NOT NULL DEFAULT 100,
|
|
75
|
-
scope_type TEXT NOT NULL CHECK (scope_type IN ('global', 'workspace', 'project', 'session')),
|
|
76
|
-
scope_id TEXT,
|
|
77
|
-
conditions_json TEXT NOT NULL DEFAULT '{}',
|
|
78
|
-
current_revision_id TEXT NOT NULL REFERENCES collaboration_rule_revisions(revision_id)
|
|
79
|
-
DEFERRABLE INITIALLY DEFERRED,
|
|
80
|
-
created_at INTEGER NOT NULL,
|
|
81
|
-
updated_at INTEGER NOT NULL
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
CREATE TABLE collaboration_rule_revisions (
|
|
85
|
-
revision_id TEXT PRIMARY KEY,
|
|
86
|
-
rule_id TEXT NOT NULL REFERENCES collaboration_rules(rule_id) ON DELETE CASCADE,
|
|
87
|
-
statement TEXT NOT NULL,
|
|
88
|
-
created_by TEXT NOT NULL CHECK (created_by = 'user'),
|
|
89
|
-
created_at INTEGER NOT NULL
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
CREATE INDEX idx_collaboration_rules_principal_status
|
|
93
|
-
ON collaboration_rules(principal_id, status, priority, updated_at DESC);
|
|
94
|
-
|
|
95
|
-
CREATE TABLE context_evidence (
|
|
96
|
-
evidence_id TEXT PRIMARY KEY,
|
|
97
|
-
principal_id TEXT NOT NULL,
|
|
98
|
-
source_type TEXT NOT NULL CHECK (source_type IN ('conversation', 'connector', 'user', 'runtime')),
|
|
99
|
-
source_instance_id TEXT,
|
|
100
|
-
source_ref TEXT NOT NULL,
|
|
101
|
-
redacted_excerpt TEXT,
|
|
102
|
-
trust_level TEXT NOT NULL CHECK (trust_level IN ('owner', 'trusted', 'untrusted')),
|
|
103
|
-
observed_at INTEGER NOT NULL,
|
|
104
|
-
created_at INTEGER NOT NULL
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
CREATE UNIQUE INDEX idx_context_evidence_source
|
|
108
|
-
ON context_evidence(principal_id, source_type, COALESCE(source_instance_id, ''), source_ref);
|
|
109
|
-
|
|
110
|
-
CREATE TABLE understanding_evidence_links (
|
|
111
|
-
version_id TEXT NOT NULL REFERENCES user_understanding_versions(version_id) ON DELETE CASCADE,
|
|
112
|
-
evidence_id TEXT NOT NULL REFERENCES context_evidence(evidence_id) ON DELETE CASCADE,
|
|
113
|
-
relation TEXT NOT NULL CHECK (relation IN ('supports', 'contradicts', 'supersedes')),
|
|
114
|
-
confidence REAL NOT NULL CHECK (confidence >= 0 AND confidence <= 1),
|
|
115
|
-
PRIMARY KEY (version_id, evidence_id, relation)
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
CREATE TABLE context_runs (
|
|
119
|
-
context_run_id TEXT PRIMARY KEY,
|
|
120
|
-
principal_id TEXT NOT NULL,
|
|
121
|
-
turn_id TEXT NOT NULL,
|
|
122
|
-
session_key TEXT NOT NULL,
|
|
123
|
-
query TEXT NOT NULL,
|
|
124
|
-
budget INTEGER NOT NULL,
|
|
125
|
-
duration_ms INTEGER NOT NULL DEFAULT 0,
|
|
126
|
-
created_at INTEGER NOT NULL,
|
|
127
|
-
UNIQUE (turn_id)
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
CREATE TABLE context_run_items (
|
|
131
|
-
context_run_id TEXT NOT NULL REFERENCES context_runs(context_run_id) ON DELETE CASCADE,
|
|
132
|
-
object_type TEXT NOT NULL CHECK (object_type IN ('profile', 'rule', 'understanding')),
|
|
133
|
-
object_id TEXT NOT NULL,
|
|
134
|
-
version_id TEXT,
|
|
135
|
-
decision TEXT NOT NULL CHECK (decision IN (
|
|
136
|
-
'selected', 'irrelevant', 'expired', 'scope_mismatch', 'sensitive',
|
|
137
|
-
'needs_consent', 'budget_exceeded', 'conflicted', 'disabled'
|
|
138
|
-
)),
|
|
139
|
-
reason TEXT NOT NULL,
|
|
140
|
-
content_snapshot TEXT NOT NULL,
|
|
141
|
-
source_label TEXT NOT NULL,
|
|
142
|
-
rank INTEGER,
|
|
143
|
-
score REAL,
|
|
144
|
-
injected_chars INTEGER NOT NULL DEFAULT 0,
|
|
145
|
-
PRIMARY KEY (context_run_id, object_type, object_id)
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
CREATE TABLE context_feedback (
|
|
149
|
-
feedback_id TEXT PRIMARY KEY,
|
|
150
|
-
turn_id TEXT NOT NULL,
|
|
151
|
-
context_run_id TEXT NOT NULL REFERENCES context_runs(context_run_id) ON DELETE CASCADE,
|
|
152
|
-
object_type TEXT,
|
|
153
|
-
object_id TEXT,
|
|
154
|
-
rating TEXT NOT NULL CHECK (rating IN ('helpful', 'irrelevant', 'wrong', 'stale', 'sensitive')),
|
|
155
|
-
reason TEXT,
|
|
156
|
-
created_at INTEGER NOT NULL,
|
|
157
|
-
UNIQUE (turn_id, object_type, object_id)
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
CREATE UNIQUE INDEX idx_context_feedback_response
|
|
161
|
-
ON context_feedback(turn_id)
|
|
162
|
-
WHERE object_type IS NULL AND object_id IS NULL;
|
|
163
|
-
|
|
164
|
-
CREATE TABLE context_suppressions (
|
|
165
|
-
suppression_id TEXT PRIMARY KEY,
|
|
166
|
-
principal_id TEXT NOT NULL,
|
|
167
|
-
canonical_key TEXT NOT NULL,
|
|
168
|
-
scope_type TEXT NOT NULL CHECK (scope_type IN ('global', 'workspace', 'project', 'session')),
|
|
169
|
-
scope_id TEXT,
|
|
170
|
-
reason TEXT NOT NULL,
|
|
171
|
-
expires_at INTEGER,
|
|
172
|
-
created_at INTEGER NOT NULL
|
|
173
|
-
);
|
|
174
|
-
|
|
175
|
-
CREATE UNIQUE INDEX idx_context_suppressions_identity
|
|
176
|
-
ON context_suppressions(principal_id, canonical_key, scope_type, COALESCE(scope_id, ''));
|
|
177
|
-
|
|
178
|
-
CREATE TABLE context_consents (
|
|
179
|
-
consent_id TEXT PRIMARY KEY,
|
|
180
|
-
principal_id TEXT NOT NULL,
|
|
181
|
-
understanding_id TEXT NOT NULL REFERENCES user_understandings(understanding_id) ON DELETE CASCADE,
|
|
182
|
-
session_key TEXT NOT NULL,
|
|
183
|
-
purpose TEXT NOT NULL,
|
|
184
|
-
status TEXT NOT NULL CHECK (status IN ('pending', 'granted', 'denied', 'consumed')),
|
|
185
|
-
grant_scope TEXT CHECK (grant_scope IN ('once', 'session', 'always')),
|
|
186
|
-
expires_at INTEGER,
|
|
187
|
-
created_at INTEGER NOT NULL,
|
|
188
|
-
updated_at INTEGER NOT NULL
|
|
189
|
-
);
|
|
190
|
-
|
|
191
|
-
CREATE UNIQUE INDEX idx_context_consents_pending
|
|
192
|
-
ON context_consents(understanding_id, session_key)
|
|
193
|
-
WHERE status = 'pending';
|