@xopcai/xopc 0.0.306 → 0.0.308
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-DLtim-_I.js → activity-store-wgSB2HYK.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-iQXtiilH.js → agent-avatar-dicebear-dUotwUO6.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C6LflMXr.js +1 -0
- package/dist/gateway/static/root/assets/agents-VPDIGRSS.js +1 -0
- package/dist/gateway/static/root/assets/{api-DfSU0-lD.js → api-BKHmTb0w.js} +1 -1
- package/dist/gateway/static/root/assets/api-DFOlahZv.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BpYFKz7B.js → app-management-settings-panel-zPz0rOND.js} +1 -1
- package/dist/gateway/static/root/assets/appearance-settings-DhvhR43G.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-Pmslbzzr.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BxOvZ-ZX.js → archive-plugin-BQVZMreT.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-B0FzTMAJ.js → attachment-load-CPE-TMPf.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BpXuPaPg.js → automations-page-C4IAy_zF.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-Fx5VUJRu.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BP7wfpqy.js → binary-plugins-DgTl7diZ.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-oMLvdnOQ.js → block-editor-CcOVA-Gw.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-DTxSZ00u.js → browser-automation-inputs-BzkJog8e.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-IbJnwEY4.js → browser-automations-page--zKAgj1k.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-DBms6d35.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-epdDWIZy.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-B0bsDtmP.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-D2AmAoty.js → channels-status-swr-B2JwuTjG.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-B-yI3Mi1.js → chat-terminal-dock-BfLd2rIJ.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-CWx_jnng.js → computer-settings-page-Ckgc0Py-.js} +1 -1
- package/dist/gateway/static/root/assets/connector-service-page-BlC1OXX4.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-By33-bF1.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-DMRRL4Zg.js → cron-expression-CqNE-nf6.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-BSwL0e6E.js → date-picker-BS9ZjzYJ.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-BQTspLzC.js → dependency-picker-CF_zYzxX.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-C3lFxDF6.js → desktop-pet-CDwtLR7Z.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-Y8pjpXFE.js → desktop-pet-settings-C0djIc1J.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-CDKj9LQj.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-CVGiGVcR.js → extension-debug-page-CX5OXxEU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-g3JtCP_y.js → extension-page-BytR1PaY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CjpoKV1f.js → extension-settings-page-CkaMJA5F.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BSvXXpKM.js → gateway-config-swr-B6wHa6ZI.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-BDCpS7U1.js → gateway-realtime-B53R0CA4.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BLDgrJ30.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-CYG9WCZn.js → gateway-settings-_YU-1p0z.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-Caf8g3sC.js → gateway-startup-retry-DRzGnEV-.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Cl834-SS.js → heartbeat-settings-CVIvvm4x.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-COCHelcL.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-BwEWBUVC.js → image-generation-api-Ck_pyDom.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-CoMlgSIA.js → imports-page-DrtbjL8O.js} +1 -1
- package/dist/gateway/static/root/assets/index-CDfcPiPb.js +79 -0
- package/dist/gateway/static/root/assets/index-CRu1p38D.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CNq5D4pe.js → keyboard-shortcuts-settings-BlZh41Xq.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-D7_Raxjw.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DQnRA598.js → local-apps-page-DbP7wWuh.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-D16nmbaN.js → locale-store-msTfRK8P.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-C0n66FiO.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-DKcO5fQ-.js → management-settings-i6GhxpGV.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DCp4BlZP.js → markdown-view-BInabSKf.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Cy64sn_C.js → media-plugins-CnWChQ3Y.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-C-9oo69N.js → messages-F74LVAiU.js} +3 -3
- package/dist/gateway/static/root/assets/note-detail-panel-C59d8vDW.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-C1GBPrVI.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-CgEoHSVT.js → page-tabs-BWitjb3e.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Ck2uKTbf.js → preview-open-alternatives-UaCWCxZv.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-Dr1mCJhZ.js → proactive-page-CtSFJxoM.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-DbZvJ5GE.js → product-open-page-gmi5LLwM.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-ILTmQ1YN.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-snl4rOQZ.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-DcQdwpPu.js → registry-api-BSWtko7U.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BbaAcEN3.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CPwdgWKo.js → runtime-tools-settings-panel-CtOjKGWg.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-8psK4cFO.js → schema-form-DkyyDcl2.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DrWL71O8.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BG0kl4HT.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-D_Gsz5rl.js → settings-form-section-C0JDGN_V.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C_Tj_mkZ.js → settings-page-DiIyMQ52.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-EPazhoZO.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-B_M_oPsT.js → share-preview-page-Bt1K657Y.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-g2MdRXSZ.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-B1DPzu98.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-Wd0uYSPG.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-Cuh6s2HM.js → skills-page.utils-vq5Ujm03.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-aassGyNb.js → system-settings-panel-Cz1P-HDH.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-BG3A5gPZ.js +1 -0
- package/dist/gateway/static/root/assets/theme-store-1SZ-HFHX.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-DJYcPWIV.js → tunnel-api-DQGoFuZO.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-QGYG7oMZ.js → use-autosave-DVDlBb95.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-qM5UiTGx.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-D1s0gIRW.js → voice-api-key-field-B2pZCcxY.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-D2goEn5e.js → voice-config-api-DgJML_uM.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DkFW9aJ6.js → work-discovery-overlay-Bptv7bEY.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BYToUPUY.js → workflow-run-setup-panel-BijCrNc4.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DRy1RAYH.js +6 -0
- package/dist/gateway/static/root/channel-icons/feishu.svg +6 -12
- package/dist/gateway/static/root/connector-icons/SOURCES.md +12 -0
- package/dist/gateway/static/root/connector-icons/dingtalk-mark.svg +1 -0
- package/dist/gateway/static/root/connector-icons/tencent-meeting-mark.svg +37 -0
- package/dist/gateway/static/root/connector-icons/wps-calendar.svg +14 -0
- package/dist/gateway/static/root/connector-icons/wps-docs.svg +14 -0
- package/dist/gateway/static/root/connector-icons/wps-mail.svg +7 -0
- package/dist/gateway/static/root/index.html +12 -12
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/notifications.js +1 -1
- package/dist/src/agent/background-review/prompts.js +3 -1
- package/dist/src/agent/context/execution-context.js +4 -4
- package/dist/src/agent/external-tools/composio-provider.js +83 -20
- package/dist/src/agent/external-tools/gateway-tools.js +2 -1
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
- package/dist/src/agent/memory/compaction-promotion.d.ts +1 -1
- package/dist/src/agent/memory/compaction-promotion.js +4 -3
- package/dist/src/agent/tools/knowledge-memory-tool.d.ts +1 -1
- package/dist/src/agent/tools/knowledge-memory-tool.js +3 -3
- package/dist/src/agent/tools/user-context-tool.js +17 -7
- package/dist/src/chat-commands/builtins/understanding.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/config/schema.d.ts +14 -4
- package/dist/src/config/schema.js +6 -4
- package/dist/src/connectors/account-access.d.ts +4 -0
- package/dist/src/connectors/account-access.js +23 -0
- package/dist/src/connectors/approval-resume.d.ts +4 -0
- package/dist/src/connectors/approval-resume.js +23 -0
- package/dist/src/connectors/auth-provider-registry.d.ts +1 -0
- package/dist/src/connectors/auth-provider-registry.js +2 -1
- package/dist/src/connectors/authorization-attempts.d.ts +21 -0
- package/dist/src/connectors/authorization-attempts.js +33 -0
- package/dist/src/connectors/builtin-catalog.js +1 -3
- package/dist/src/connectors/catalog.js +2 -1
- package/dist/src/connectors/china-catalog.d.ts +2 -0
- package/dist/src/connectors/china-catalog.js +430 -0
- package/dist/src/connectors/composio-backends.d.ts +26 -0
- package/dist/src/connectors/composio-backends.js +65 -0
- package/dist/src/connectors/composio-catalog.js +2 -1
- package/dist/src/connectors/composio-managed-client.js +3 -1
- package/dist/src/connectors/composio-managed-events.js +5 -2
- package/dist/src/connectors/composio-session-types.d.ts +2 -0
- package/dist/src/connectors/composio-sessions.d.ts +11 -2
- package/dist/src/connectors/composio-sessions.js +137 -35
- package/dist/src/connectors/composio-triggers.js +4 -2
- package/dist/src/connectors/composio.d.ts +11 -8
- package/dist/src/connectors/composio.js +68 -84
- package/dist/src/connectors/connected-source-ingestion.js +4 -3
- package/dist/src/connectors/connected-source-understanding.d.ts +1 -0
- package/dist/src/connectors/connected-source-understanding.js +1 -0
- package/dist/src/connectors/connection-recovery-service.js +25 -13
- package/dist/src/connectors/connector-identity.d.ts +2 -0
- package/dist/src/connectors/connector-identity.js +18 -5
- package/dist/src/connectors/content-enrichment.js +1 -1
- package/dist/src/connectors/instances.js +1 -7
- package/dist/src/connectors/learning-coordinator.js +35 -12
- package/dist/src/connectors/materialize.js +14 -1
- package/dist/src/connectors/policy.d.ts +1 -1
- package/dist/src/connectors/policy.js +1 -1
- package/dist/src/connectors/principal.js +24 -3
- package/dist/src/connectors/providers.d.ts +1 -0
- package/dist/src/connectors/providers.js +14 -2
- package/dist/src/connectors/runtime-adapter-registry.js +4 -9
- package/dist/src/connectors/secret-store.d.ts +4 -1
- package/dist/src/connectors/secret-store.js +7 -3
- package/dist/src/connectors/source-change-publisher.js +4 -2
- package/dist/src/connectors/types.d.ts +16 -11
- package/dist/src/connectors/workflow-preflight.d.ts +2 -1
- package/dist/src/connectors/workflow-preflight.js +20 -3
- package/dist/src/gateway/hono/lib/config-payload.d.ts +2 -2
- package/dist/src/gateway/hono/routes/connectors.js +207 -16
- package/dist/src/gateway/hono/routes/context-sources.js +1 -24
- package/dist/src/gateway/hono/routes/home.js +4 -1
- package/dist/src/gateway/hono/routes/imports.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/local-apps.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/projects.js +8 -0
- package/dist/src/gateway/hono/routes/update.js +2 -2
- package/dist/src/gateway/hono/routes/user-model-refresh.d.ts +5 -0
- package/dist/src/gateway/hono/routes/user-model-refresh.js +128 -0
- package/dist/src/gateway/hono/routes/user-model.js +12 -5
- package/dist/src/gateway/hono/routes/work-discovery.js +0 -30
- package/dist/src/gateway/index.js +1 -1
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/service.js +6 -6
- package/dist/src/infra/gateway-processes.js +1 -1
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/infra/update-runner.js +2 -2
- package/dist/src/infra/update-startup.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
- package/dist/src/knowledge-memory/index.js +2 -2
- package/dist/src/knowledge-memory/repository.d.ts +7 -0
- package/dist/src/knowledge-memory/repository.js +58 -8
- package/dist/src/memory-maintenance/service.js +61 -31
- package/dist/src/migrations/memory-config.d.ts +2 -0
- package/dist/src/migrations/memory-config.js +77 -0
- package/dist/src/migrations/runner.js +2 -2
- package/dist/src/notifications/planner.js +5 -5
- package/dist/src/notifications/service.d.ts +2 -2
- package/dist/src/notifications/service.js +1 -1
- package/dist/src/proactive/follow-ups.js +2 -1
- package/dist/src/storage/sqlite/connection-wait-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/connection-wait-repository.js +63 -2
- package/dist/src/storage/sqlite/connector-account-repository.d.ts +6 -0
- package/dist/src/storage/sqlite/connector-account-repository.js +35 -7
- package/dist/src/storage/sqlite/connector-repository.js +15 -10
- package/dist/src/storage/sqlite/connector-sync-policy-repository.js +1 -1
- package/dist/src/storage/sqlite/index.js +4 -2
- package/dist/src/storage/sqlite/migrations/182_connector_account_policies.sql +92 -0
- package/dist/src/storage/sqlite/migrations/183_connector_backend_consistency.sql +20 -0
- package/dist/src/storage/sqlite/migrations/184_memory_suppressions.sql +12 -0
- package/dist/src/storage/sqlite/migrations/185_understanding_refresh_batches.sql +6 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +7 -7
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tasks/home-query-service.js +3 -3
- package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/user-context/config.d.ts +4 -9
- package/dist/src/user-context/config.js +7 -27
- package/dist/src/user-context/memory-suppression.d.ts +7 -0
- package/dist/src/user-context/memory-suppression.js +23 -0
- package/dist/src/user-context/relationship-continuity.js +1 -1
- package/dist/src/user-context/sources/refresh-service.d.ts +48 -0
- package/dist/src/user-context/sources/refresh-service.js +221 -0
- package/dist/src/user-context/sources/repository.js +1 -1
- package/dist/src/user-model/bootstrap.js +27 -24
- package/dist/src/user-model/capture/executor.d.ts +1 -1
- package/dist/src/user-model/capture/executor.js +17 -11
- package/dist/src/user-model/capture/semantic.js +1 -1
- package/dist/src/user-model/domain.d.ts +6 -2
- package/dist/src/user-model/index.js +3 -3
- package/dist/src/user-model/profile.js +1 -1
- package/dist/src/user-model/repository.d.ts +4 -1
- package/dist/src/user-model/repository.js +96 -6
- package/dist/src/user-model/usage-policy.d.ts +2 -0
- package/dist/src/user-model/usage-policy.js +6 -2
- package/dist/src/work-discovery/project-understanding.js +2 -1
- package/dist/src/work-discovery/service.d.ts +8 -24
- package/dist/src/work-discovery/service.js +138 -180
- package/dist/src/workflows/domain/definition.d.ts +1 -0
- package/dist/src/workflows/domain/validation.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +14 -0
- package/dist/src/workflows/service/workflow-session-bridge.d.ts +1 -0
- package/dist/src/workflows/service/workflow-session-bridge.js +1 -0
- package/package.json +5 -5
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CxOv4ivK.js +0 -1
- package/dist/gateway/static/root/assets/agents-DzKx7z3k.js +0 -1
- package/dist/gateway/static/root/assets/api-gpHh07OL.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-BQfR5vrq.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BceB7JHZ.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-Cn_p8zY_.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CCUO3G23.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BjMb5H2_.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-P22-_i13.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BLgPORmH.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-DM4_GMzo.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BGmP1obI.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CB_XVtIM.js +0 -1
- package/dist/gateway/static/root/assets/index-CI37dTAn.css +0 -1
- package/dist/gateway/static/root/assets/index-Do9MltC4.js +0 -79
- package/dist/gateway/static/root/assets/local-app-workbench-page-BxQlEje6.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-CT5GrcMs.js +0 -2
- package/dist/gateway/static/root/assets/note-detail-panel-5dc3LKTL.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-AbwxgXuG.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-DnE1zI1c.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BD0nLYxk.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-TYuE6A3S.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BcWDQQFX.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DzGQX6Hq.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CE2X89qN.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BL4H9Iym.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-WMKIgUOp.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DYgwzl5B.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-BjeRslap.js +0 -1
- package/dist/gateway/static/root/assets/theme-store-RUBQBsFP.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-PrRsd4go.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-Z8iZe9YP.js +0 -6
- package/dist/src/migrations/knowledge-memory-read-policy-config.d.ts +0 -2
- package/dist/src/migrations/knowledge-memory-read-policy-config.js +0 -48
|
@@ -3,7 +3,7 @@ import "../user-model/domain.js";
|
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
//#region src/memory-maintenance/service.ts
|
|
5
5
|
init_transaction();
|
|
6
|
-
const ALGORITHM_VERSION = "user-model-maintenance-
|
|
6
|
+
const ALGORITHM_VERSION = "user-model-maintenance-v2";
|
|
7
7
|
function emptyMetrics() {
|
|
8
8
|
return {
|
|
9
9
|
scanned: 0,
|
|
@@ -32,29 +32,22 @@ function addDecision(db, runId, objectType, objectId, action, reason, before, af
|
|
|
32
32
|
decision_id, run_id, object_type, object_id, action, reason, before_json, after_json, created_at
|
|
33
33
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(randomUUID(), runId, objectType, objectId, action, reason, before === void 0 ? null : JSON.stringify(before), after === void 0 ? null : JSON.stringify(after), now);
|
|
34
34
|
}
|
|
35
|
-
function transitionAssertions(db, runId, now, limit, metrics) {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
function transitionAssertions(db, runId, principalId, now, limit, metrics) {
|
|
36
|
+
const rows = db.prepare(`SELECT a.assertion_id, a.status FROM user_assertions a
|
|
37
|
+
JOIN user_assertion_slots s ON s.slot_id = a.slot_id
|
|
38
|
+
WHERE s.principal_id = ? AND a.status IN ('active', 'candidate', 'needs_review')
|
|
39
|
+
AND ((a.valid_to IS NOT NULL AND a.valid_to < ?)
|
|
40
|
+
OR (a.review_at IS NOT NULL AND a.review_at <= ?))
|
|
41
|
+
ORDER BY COALESCE(a.valid_to, a.review_at), a.assertion_id LIMIT ?`).all(principalId, now, now, limit);
|
|
42
|
+
metrics.scanned += rows.length;
|
|
43
|
+
for (const row of rows) {
|
|
44
|
+
db.prepare("UPDATE user_assertions SET status = 'stale' WHERE assertion_id = ?").run(row.assertion_id);
|
|
41
45
|
db.prepare(`INSERT INTO user_assertion_status_events (
|
|
42
46
|
event_id, assertion_id, from_status, to_status, actor_type, reason, source_run_id, created_at
|
|
43
|
-
) VALUES (?, ?,
|
|
44
|
-
addDecision(db, runId, "assertion", row.assertion_id, "stale", "
|
|
47
|
+
) VALUES (?, ?, ?, 'stale', 'maintenance', 'No current supporting evidence at review time.', ?, ?)`).run(randomUUID(), row.assertion_id, row.status, runId, now);
|
|
48
|
+
addDecision(db, runId, "assertion", row.assertion_id, "stale", "validity_or_review_ended", row, { status: "stale" }, now);
|
|
45
49
|
metrics.stale += 1;
|
|
46
50
|
}
|
|
47
|
-
const reviewDue = db.prepare(`SELECT assertion_id, status, review_at FROM user_assertions
|
|
48
|
-
WHERE status = 'active' AND review_at IS NOT NULL AND review_at <= ? LIMIT ?`).all(now, Math.max(0, limit - expired.length));
|
|
49
|
-
metrics.scanned += reviewDue.length;
|
|
50
|
-
for (const row of reviewDue) {
|
|
51
|
-
db.prepare("UPDATE user_assertions SET status = 'needs_review' WHERE assertion_id = ? AND status = 'active'").run(row.assertion_id);
|
|
52
|
-
db.prepare(`INSERT INTO user_assertion_status_events (
|
|
53
|
-
event_id, assertion_id, from_status, to_status, actor_type, reason, source_run_id, created_at
|
|
54
|
-
) VALUES (?, ?, 'active', 'needs_review', 'maintenance', 'Scheduled review became due.', ?, ?)`).run(randomUUID(), row.assertion_id, runId, now);
|
|
55
|
-
addDecision(db, runId, "assertion", row.assertion_id, "needs_review", "review_due", row, { status: "needs_review" }, now);
|
|
56
|
-
metrics.needsReview += 1;
|
|
57
|
-
}
|
|
58
51
|
}
|
|
59
52
|
function transitionPriorities(db, runId, principalId, now, limit, metrics) {
|
|
60
53
|
const rows = db.prepare(`SELECT priority_id, status, valid_to FROM user_priority_windows
|
|
@@ -68,7 +61,7 @@ function transitionPriorities(db, runId, principalId, now, limit, metrics) {
|
|
|
68
61
|
}
|
|
69
62
|
function transitionKnowledge(db, runId, principalId, now, limit, metrics) {
|
|
70
63
|
const expired = db.prepare(`SELECT knowledge_id, status, expires_at FROM knowledge_items
|
|
71
|
-
WHERE principal_id = ? AND status
|
|
64
|
+
WHERE principal_id = ? AND status IN ('active', 'candidate') AND expires_at IS NOT NULL AND expires_at < ? LIMIT ?`).all(principalId, now, limit);
|
|
72
65
|
metrics.scanned += expired.length;
|
|
73
66
|
for (const row of expired) {
|
|
74
67
|
db.prepare("UPDATE knowledge_items SET status = 'stale', updated_at = ? WHERE knowledge_id = ?").run(now, row.knowledge_id);
|
|
@@ -76,12 +69,12 @@ function transitionKnowledge(db, runId, principalId, now, limit, metrics) {
|
|
|
76
69
|
metrics.stale += 1;
|
|
77
70
|
}
|
|
78
71
|
const reviewDue = db.prepare(`SELECT knowledge_id, status, review_at FROM knowledge_items
|
|
79
|
-
WHERE principal_id = ? AND status
|
|
72
|
+
WHERE principal_id = ? AND status IN ('active', 'candidate', 'needs_review') AND review_at IS NOT NULL AND review_at <= ? LIMIT ?`).all(principalId, now, Math.max(0, limit - expired.length));
|
|
80
73
|
metrics.scanned += reviewDue.length;
|
|
81
74
|
for (const row of reviewDue) {
|
|
82
|
-
db.prepare("UPDATE knowledge_items SET status = '
|
|
83
|
-
addDecision(db, runId, "knowledge", row.knowledge_id, "
|
|
84
|
-
metrics.
|
|
75
|
+
db.prepare("UPDATE knowledge_items SET status = 'stale', updated_at = ? WHERE knowledge_id = ?").run(now, row.knowledge_id);
|
|
76
|
+
addDecision(db, runId, "knowledge", row.knowledge_id, "stale", "review_due", row, { status: "stale" }, now);
|
|
77
|
+
metrics.stale += 1;
|
|
85
78
|
}
|
|
86
79
|
}
|
|
87
80
|
function reconcileEvidence(db, runId, principalId, now, limit, evidenceThreshold, metrics) {
|
|
@@ -89,7 +82,10 @@ function reconcileEvidence(db, runId, principalId, now, limit, evidenceThreshold
|
|
|
89
82
|
FROM user_assertions a
|
|
90
83
|
JOIN user_assertion_slots s ON s.slot_id = a.slot_id
|
|
91
84
|
JOIN user_assertion_evidence ae ON ae.assertion_id = a.assertion_id AND ae.relation = 'contradicts'
|
|
92
|
-
|
|
85
|
+
JOIN context_evidence e ON e.evidence_id = ae.evidence_id
|
|
86
|
+
WHERE s.principal_id = ? AND a.status = 'active'
|
|
87
|
+
AND e.trust_level = 'owner' AND e.source_type IN ('conversation', 'user')
|
|
88
|
+
AND e.observed_at > a.observed_at AND ae.confidence >= 0.7 LIMIT ?`).all(principalId, limit);
|
|
93
89
|
metrics.scanned += contradicted.length;
|
|
94
90
|
for (const row of contradicted) {
|
|
95
91
|
db.prepare("UPDATE user_assertions SET status = 'needs_review' WHERE assertion_id = ?").run(row.assertion_id);
|
|
@@ -99,16 +95,31 @@ function reconcileEvidence(db, runId, principalId, now, limit, evidenceThreshold
|
|
|
99
95
|
addDecision(db, runId, "assertion", row.assertion_id, "needs_review", "contradictory_evidence", row, { status: "needs_review" }, now);
|
|
100
96
|
metrics.needsReview += 1;
|
|
101
97
|
}
|
|
102
|
-
const candidates = db.prepare(`SELECT a.assertion_id, a.status,
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
const candidates = db.prepare(`SELECT a.assertion_id, a.status,
|
|
99
|
+
MIN(COUNT(DISTINCT COALESCE(e.content_hash, e.source_ref)),
|
|
100
|
+
COUNT(DISTINCT e.source_type || ':' || COALESCE(e.source_instance_id, '') || ':' ||
|
|
101
|
+
COALESCE(e.source_item_id, e.source_ref))) AS evidence_count
|
|
105
102
|
FROM user_assertions a
|
|
106
103
|
JOIN user_assertion_slots s ON s.slot_id = a.slot_id
|
|
107
104
|
JOIN user_assertion_evidence ae ON ae.assertion_id = a.assertion_id AND ae.relation = 'supports'
|
|
108
105
|
JOIN context_evidence e ON e.evidence_id = ae.evidence_id AND e.trust_level = 'owner'
|
|
109
106
|
WHERE s.principal_id = ? AND a.status = 'candidate'
|
|
110
107
|
AND a.authority IN ('user_observed', 'system_inferred')
|
|
111
|
-
|
|
108
|
+
AND a.confidence >= 0.7 AND ae.confidence >= 0.7
|
|
109
|
+
AND a.sensitivity = 'normal' AND a.consequence IN ('low', 'medium')
|
|
110
|
+
AND a.disclosure_policy != 'ask_before_reference'
|
|
111
|
+
AND e.source_type IN ('conversation', 'user', 'connector')
|
|
112
|
+
AND (a.valid_from IS NULL OR a.valid_from <= ?)
|
|
113
|
+
AND (a.valid_to IS NULL OR a.valid_to >= ?)
|
|
114
|
+
AND (a.review_at IS NULL OR a.review_at > ?)
|
|
115
|
+
AND NOT EXISTS (SELECT 1 FROM user_assertion_evidence bad
|
|
116
|
+
WHERE bad.assertion_id = a.assertion_id AND bad.relation = 'contradicts')
|
|
117
|
+
AND (s.cardinality = 'multiple' OR NOT EXISTS (
|
|
118
|
+
SELECT 1 FROM user_assertions other WHERE other.slot_id = a.slot_id
|
|
119
|
+
AND other.assertion_id != a.assertion_id AND other.status IN ('active', 'conflicted')
|
|
120
|
+
AND other.normalized_value != a.normalized_value
|
|
121
|
+
AND (other.valid_to IS NULL OR other.valid_to >= ?)))
|
|
122
|
+
GROUP BY a.assertion_id HAVING evidence_count >= ? ORDER BY a.recorded_at LIMIT ?`).all(principalId, now, now, now, now, evidenceThreshold, limit);
|
|
112
123
|
metrics.scanned += candidates.length;
|
|
113
124
|
for (const row of candidates) {
|
|
114
125
|
db.prepare("UPDATE user_assertions SET status = 'active' WHERE assertion_id = ? AND status = 'candidate'").run(row.assertion_id);
|
|
@@ -119,6 +130,24 @@ function reconcileEvidence(db, runId, principalId, now, limit, evidenceThreshold
|
|
|
119
130
|
metrics.activated += 1;
|
|
120
131
|
}
|
|
121
132
|
}
|
|
133
|
+
function activateKnowledge(db, runId, principalId, now, limit, metrics) {
|
|
134
|
+
const rows = db.prepare(`SELECT knowledge_id FROM knowledge_items
|
|
135
|
+
WHERE principal_id = ? AND record_class = 'memory' AND status = 'candidate'
|
|
136
|
+
AND origin_class IN ('owner', 'agent', 'system') AND confidence >= 0.7
|
|
137
|
+
AND derived_from_recalled_context = 0
|
|
138
|
+
AND (valid_from IS NULL OR valid_from <= ?) AND (valid_to IS NULL OR valid_to >= ?)
|
|
139
|
+
AND (expires_at IS NULL OR expires_at >= ?) AND (review_at IS NULL OR review_at > ?)
|
|
140
|
+
ORDER BY created_at, knowledge_id LIMIT ?`).all(principalId, now, now, now, now, limit);
|
|
141
|
+
metrics.scanned += rows.length;
|
|
142
|
+
for (const row of rows) {
|
|
143
|
+
db.prepare("UPDATE knowledge_items SET status = 'active', updated_at = ? WHERE knowledge_id = ?").run(now, row.knowledge_id);
|
|
144
|
+
db.prepare(`INSERT INTO knowledge_item_status_events
|
|
145
|
+
(event_id, knowledge_id, from_status, to_status, actor_type, reason, created_at)
|
|
146
|
+
VALUES (?, ?, 'candidate', 'active', 'maintenance', 'Eligible scoped memory activated automatically.', ?)`).run(randomUUID(), row.knowledge_id, now);
|
|
147
|
+
addDecision(db, runId, "knowledge", row.knowledge_id, "activated", "eligible_scoped_memory", { status: "candidate" }, { status: "active" }, now);
|
|
148
|
+
metrics.activated += 1;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
122
151
|
function repairIndexes(db, runId, now, metrics) {
|
|
123
152
|
const assertionMissing = db.prepare(`SELECT COUNT(*) AS count FROM user_assertions a
|
|
124
153
|
LEFT JOIN user_assertions_fts f ON f.assertion_id = a.assertion_id
|
|
@@ -178,11 +207,12 @@ function runMemoryMaintenance(input) {
|
|
|
178
207
|
});
|
|
179
208
|
try {
|
|
180
209
|
runSqliteWriteTransaction((db) => {
|
|
181
|
-
transitionAssertions(db, runId, now, limit, metrics);
|
|
210
|
+
transitionAssertions(db, runId, principalId, now, limit, metrics);
|
|
182
211
|
transitionPriorities(db, runId, principalId, now, limit, metrics);
|
|
183
212
|
transitionKnowledge(db, runId, principalId, now, limit, metrics);
|
|
184
213
|
if (input.jobType === "daily_reconciliation" || input.jobType === "manual_repair") {
|
|
185
214
|
reconcileEvidence(db, runId, principalId, now, limit, evidenceThreshold, metrics);
|
|
215
|
+
activateKnowledge(db, runId, principalId, now, limit, metrics);
|
|
186
216
|
repairIndexes(db, runId, now, metrics);
|
|
187
217
|
}
|
|
188
218
|
if (input.jobType === "weekly_knowledge" || input.jobType === "manual_repair") archiveOldKnowledge(db, runId, principalId, now - (input.staleRetentionDays ?? 30) * 24 * 60 * 60 * 1e3, now, limit, metrics);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { init_lock, isGatewayConfigLockedByAnotherProcessSync } from "../gateway/lock.js";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
//#region src/migrations/memory-config.ts
|
|
4
|
+
init_lock();
|
|
5
|
+
const id = "automatic-memory-config";
|
|
6
|
+
function normalizeKnowledgeMemoryConfigInput(input) {
|
|
7
|
+
if (!input || typeof input !== "object" || Array.isArray(input)) return input;
|
|
8
|
+
const memory = input;
|
|
9
|
+
if (!Array.isArray(memory.sources)) return input;
|
|
10
|
+
const oldSources = memory.sources.filter((source) => typeof source === "string");
|
|
11
|
+
const visibilityScopes = new Set([
|
|
12
|
+
"session",
|
|
13
|
+
"workspace",
|
|
14
|
+
"project"
|
|
15
|
+
]);
|
|
16
|
+
const normalized = { ...memory };
|
|
17
|
+
if (!Array.isArray(normalized.readScopes)) normalized.readScopes = oldSources.filter((source) => visibilityScopes.has(source));
|
|
18
|
+
if (!Array.isArray(normalized.contentSources)) normalized.contentSources = [
|
|
19
|
+
...oldSources.some((source) => visibilityScopes.has(source)) ? ["memory"] : [],
|
|
20
|
+
...oldSources.includes("workspace") ? ["local_import"] : [],
|
|
21
|
+
...oldSources.includes("connector") ? ["connector"] : []
|
|
22
|
+
];
|
|
23
|
+
delete normalized.sources;
|
|
24
|
+
return normalized;
|
|
25
|
+
}
|
|
26
|
+
function convertedConfig(ctx) {
|
|
27
|
+
if (!existsSync(ctx.configPath)) return null;
|
|
28
|
+
const config = JSON.parse(readFileSync(ctx.configPath, "utf8"));
|
|
29
|
+
const userContext = config.userContext;
|
|
30
|
+
if (!userContext || typeof userContext !== "object" || Array.isArray(userContext)) return null;
|
|
31
|
+
const context = userContext;
|
|
32
|
+
let changed = false;
|
|
33
|
+
for (const key of ["userModel", "knowledgeMemory"]) {
|
|
34
|
+
const section = context[key];
|
|
35
|
+
if (!section || typeof section !== "object" || Array.isArray(section)) continue;
|
|
36
|
+
const memory = section;
|
|
37
|
+
if (memory.writePolicy === "confirm") {
|
|
38
|
+
memory.writePolicy = "allow";
|
|
39
|
+
changed = true;
|
|
40
|
+
}
|
|
41
|
+
if (key === "knowledgeMemory" && Array.isArray(memory.sources)) {
|
|
42
|
+
context[key] = normalizeKnowledgeMemoryConfigInput(memory);
|
|
43
|
+
changed = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (!changed) return null;
|
|
47
|
+
return config;
|
|
48
|
+
}
|
|
49
|
+
function item(status) {
|
|
50
|
+
return {
|
|
51
|
+
id,
|
|
52
|
+
title: "Automatic memory configuration",
|
|
53
|
+
kind: "config",
|
|
54
|
+
safety: "auto",
|
|
55
|
+
status,
|
|
56
|
+
message: "Enable automatic ordinary memory and separate visibility scopes from content sources."
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const memoryConfigMigration = {
|
|
60
|
+
id,
|
|
61
|
+
kind: "config",
|
|
62
|
+
safety: "auto",
|
|
63
|
+
detect: (ctx) => convertedConfig(ctx) ? item("planned") : null,
|
|
64
|
+
apply: (ctx) => {
|
|
65
|
+
if (isGatewayConfigLockedByAnotherProcessSync(ctx.configPath)) return {
|
|
66
|
+
...item("skipped"),
|
|
67
|
+
message: "Deferred knowledge memory config migration until the running gateway restarts."
|
|
68
|
+
};
|
|
69
|
+
const config = convertedConfig(ctx);
|
|
70
|
+
return config ? {
|
|
71
|
+
...item("applied"),
|
|
72
|
+
details: { config }
|
|
73
|
+
} : item("not_needed");
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
77
|
+
export { memoryConfigMigration };
|
|
@@ -3,7 +3,7 @@ import { init_logger } from "../utils/logger.js";
|
|
|
3
3
|
import { ConfigSchema, init_schema } from "../config/schema.js";
|
|
4
4
|
import { listRegisteredMigrations } from "./registry.js";
|
|
5
5
|
import { conversationRoutingConfigMigration } from "./conversation-routing-config.js";
|
|
6
|
-
import {
|
|
6
|
+
import { memoryConfigMigration } from "./memory-config.js";
|
|
7
7
|
import { dirname, join } from "node:path";
|
|
8
8
|
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
9
9
|
//#region src/migrations/runner.ts
|
|
@@ -12,7 +12,7 @@ init_logger();
|
|
|
12
12
|
const log = createLogger("Migrations");
|
|
13
13
|
const MIGRATION_LEDGER_FILENAME = "migrations.json";
|
|
14
14
|
const CONFIG_BACKUP_COUNT = 10;
|
|
15
|
-
const CORE_MIGRATIONS = [conversationRoutingConfigMigration,
|
|
15
|
+
const CORE_MIGRATIONS = [conversationRoutingConfigMigration, memoryConfigMigration];
|
|
16
16
|
function listAllMigrations() {
|
|
17
17
|
return [...CORE_MIGRATIONS, ...listRegisteredMigrations().map((entry) => entry.migration)];
|
|
18
18
|
}
|
|
@@ -162,7 +162,7 @@ function workDiscoveryPlan(eventType, payload) {
|
|
|
162
162
|
const event = payload;
|
|
163
163
|
const completed = eventType === "work-discovery.completed";
|
|
164
164
|
if (typeof event.runId !== "string" || !event.runId || typeof event.conversationId !== "string" || !event.conversationId || event.status !== (completed ? "completed" : "failed")) return null;
|
|
165
|
-
const type = completed ? "work_discovery.
|
|
165
|
+
const type = completed ? "work_discovery.completed" : "work_discovery.failed";
|
|
166
166
|
return {
|
|
167
167
|
dedupeKey: `${type}:${event.runId}`,
|
|
168
168
|
notification: {
|
|
@@ -174,15 +174,15 @@ function workDiscoveryPlan(eventType, payload) {
|
|
|
174
174
|
},
|
|
175
175
|
priority: completed ? "normal" : "high",
|
|
176
176
|
title: completed ? {
|
|
177
|
-
en: "Understanding
|
|
178
|
-
zh: "
|
|
177
|
+
en: "Understanding updated",
|
|
178
|
+
zh: "用户理解已更新"
|
|
179
179
|
} : {
|
|
180
180
|
en: "Understanding needs attention",
|
|
181
181
|
zh: "用户理解需要处理"
|
|
182
182
|
},
|
|
183
183
|
body: completed ? {
|
|
184
|
-
en: "
|
|
185
|
-
zh: "
|
|
184
|
+
en: "See what xopc learned. You can edit or delete it anytime.",
|
|
185
|
+
zh: "理解已自动整理,可随时查看、修改或删除。"
|
|
186
186
|
} : {
|
|
187
187
|
en: "Open user understanding to review or retry.",
|
|
188
188
|
zh: "打开用户理解,查看详情或重试。"
|
|
@@ -19,7 +19,7 @@ export declare class NotificationService {
|
|
|
19
19
|
persistGatewayEvent(type: string, payload: unknown): {
|
|
20
20
|
schemaVersion: 1;
|
|
21
21
|
id: string;
|
|
22
|
-
type: "work_discovery.failed" | "chat.completed" | "chat.failed" | "task.needs_input" | "task.blocked" | "task.failed" | "task.completed" | "automation.completed" | "automation.failed" | "proactive.insight"
|
|
22
|
+
type: "work_discovery.completed" | "work_discovery.failed" | "chat.completed" | "chat.failed" | "task.needs_input" | "task.blocked" | "task.failed" | "task.completed" | "automation.completed" | "automation.failed" | "proactive.insight";
|
|
23
23
|
priority: "normal" | "high";
|
|
24
24
|
title: {
|
|
25
25
|
en: string;
|
|
@@ -56,7 +56,7 @@ export declare class NotificationService {
|
|
|
56
56
|
persistPlan(plan: NotificationPlan): {
|
|
57
57
|
schemaVersion: 1;
|
|
58
58
|
id: string;
|
|
59
|
-
type: "work_discovery.failed" | "chat.completed" | "chat.failed" | "task.needs_input" | "task.blocked" | "task.failed" | "task.completed" | "automation.completed" | "automation.failed" | "proactive.insight"
|
|
59
|
+
type: "work_discovery.completed" | "work_discovery.failed" | "chat.completed" | "chat.failed" | "task.needs_input" | "task.blocked" | "task.failed" | "task.completed" | "automation.completed" | "automation.failed" | "proactive.insight";
|
|
60
60
|
priority: "normal" | "high";
|
|
61
61
|
title: {
|
|
62
62
|
en: string;
|
|
@@ -40,7 +40,7 @@ function preferenceAllows(type, preferences) {
|
|
|
40
40
|
case "automation.completed": return preferences.automationCompleted;
|
|
41
41
|
case "automation.failed": return preferences.automationFailed;
|
|
42
42
|
case "proactive.insight": return preferences.proactiveInsight;
|
|
43
|
-
case "work_discovery.
|
|
43
|
+
case "work_discovery.completed":
|
|
44
44
|
case "work_discovery.failed": return true;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
|
|
2
|
+
import { getConnectorConnection, init_connector_repository } from "../storage/sqlite/connector-repository.js";
|
|
2
3
|
import { listKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
|
|
3
|
-
import { getConnectorConnection } from "../storage/sqlite/connector-repository.js";
|
|
4
4
|
import { sourceFreshness } from "./source-freshness.js";
|
|
5
5
|
import { emailFields, readMailThread } from "./mail-thread.js";
|
|
6
6
|
import { authorizedConnectedSource } from "./execution/authorization.js";
|
|
@@ -12,6 +12,7 @@ import { ProactiveEventService } from "./service.js";
|
|
|
12
12
|
import { randomUUID } from "node:crypto";
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
//#region src/proactive/follow-ups.ts
|
|
15
|
+
init_connector_repository();
|
|
15
16
|
init_transaction();
|
|
16
17
|
const COMMUNICATION_SCENARIO = "communication_follow_up";
|
|
17
18
|
const CreateSchema = z.object({
|
|
@@ -21,6 +21,9 @@ export declare function requireSessionConnection(input: {
|
|
|
21
21
|
export declare function queueConnectionResolution(wait: ConnectionWait, resolution: 'continued' | 'skipped'): ConnectionWait;
|
|
22
22
|
export declare function consumeConnectionResume(input: SessionInput): boolean;
|
|
23
23
|
export declare function connectionBindings(conversationId: string): ConnectionNeed[];
|
|
24
|
+
/** Changes to the objective or transcript invalidate an outstanding action approval. */
|
|
25
|
+
export declare function connectorObjectiveScope(conversationId: string): string | undefined;
|
|
26
|
+
export declare function bindObjectiveAccount(conversationId: string, connectorId: string, accountId: string): void;
|
|
24
27
|
export declare function connectionBinding(conversationId: string, connectorId: string): string | undefined;
|
|
25
28
|
/** New input wins over an outstanding auto-resume intent, including an already queued resume. */
|
|
26
29
|
export declare function invalidateConnectionResumeIntent(conversationId: string): void;
|
|
@@ -6,6 +6,9 @@ import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "
|
|
|
6
6
|
import { init_session_instance_repository, readCurrentTranscriptId } from "./session-instance-repository.js";
|
|
7
7
|
import { bumpSessionInputRevision, getSessionInputById, getSessionInputState, init_session_input_repository, insertSessionInput, setSessionInputStatus } from "./session-input-repository.js";
|
|
8
8
|
import { TaskRunRepository, init_task_run_repository } from "../../tasks/task-run-repository.js";
|
|
9
|
+
import { getConnectorAccount, init_connector_account_repository } from "./connector-account-repository.js";
|
|
10
|
+
import { getConnectorConnection, init_connector_repository } from "./connector-repository.js";
|
|
11
|
+
import { getSessionMetadata, init_session_repository } from "./session-repository.js";
|
|
9
12
|
import { randomUUID } from "node:crypto";
|
|
10
13
|
import { EventEmitter } from "node:events";
|
|
11
14
|
//#region src/storage/sqlite/connection-wait-repository.ts
|
|
@@ -222,9 +225,64 @@ function consumeConnectionResume(input) {
|
|
|
222
225
|
}
|
|
223
226
|
function connectionBindings(conversationId) {
|
|
224
227
|
if (!isXopcDatabaseOpen()) return [];
|
|
228
|
+
let metadata = getSessionMetadata(conversationId);
|
|
229
|
+
if (metadata?.sessionType === "workflow-subagent" && metadata.parentConversationId) metadata = getSessionMetadata(metadata.parentConversationId);
|
|
230
|
+
const workflowAccounts = metadata?.sessionType === "workflow-run" ? metadata.customData?.connectorAccounts : void 0;
|
|
231
|
+
if (workflowAccounts && typeof workflowAccounts === "object" && !Array.isArray(workflowAccounts)) return Object.entries(workflowAccounts).flatMap(([connectorId, ids]) => Array.isArray(ids) ? ids.flatMap((id) => {
|
|
232
|
+
if (typeof id !== "string") return [];
|
|
233
|
+
const account = getConnectorAccount(id);
|
|
234
|
+
return [{
|
|
235
|
+
key: `${connectorId}:${id}`,
|
|
236
|
+
connectorId,
|
|
237
|
+
accountId: id,
|
|
238
|
+
connectionId: account?.currentConnectionId,
|
|
239
|
+
label: account?.label ?? connectorId,
|
|
240
|
+
capabilities: []
|
|
241
|
+
}];
|
|
242
|
+
}) : []);
|
|
225
243
|
const state = getSessionInputState(conversationId);
|
|
226
244
|
const input = state.activeInputId ? getSessionInputById(conversationId, state.activeInputId) : void 0;
|
|
227
|
-
|
|
245
|
+
if (!input) return [];
|
|
246
|
+
const wait = input.payload ? getConnectionWait(input.payload.waitId) : void 0;
|
|
247
|
+
const stored = getSqliteDatabase().prepare(`SELECT connector_id, account_id FROM connector_objective_accounts
|
|
248
|
+
WHERE conversation_id = ? AND transcript_id = ? AND objective_id = ?`).all(conversationId, readCurrentTranscriptId(getSqliteDatabase(), conversationId) ?? "", wait?.objectiveId ?? input.id);
|
|
249
|
+
return (wait?.needs ?? stored.map((row) => ({
|
|
250
|
+
key: `${row.connector_id}:${row.account_id}`,
|
|
251
|
+
connectorId: row.connector_id,
|
|
252
|
+
accountId: row.account_id,
|
|
253
|
+
label: getConnectorAccount(row.account_id)?.label ?? row.connector_id,
|
|
254
|
+
capabilities: []
|
|
255
|
+
}))).map((need) => {
|
|
256
|
+
const accountId = need.accountId ?? (need.connectionId ? getConnectorConnection(need.connectionId)?.accountId : void 0);
|
|
257
|
+
const account = accountId ? getConnectorAccount(accountId) : void 0;
|
|
258
|
+
return {
|
|
259
|
+
...need,
|
|
260
|
+
accountId,
|
|
261
|
+
connectionId: account?.currentConnectionId ?? need.connectionId
|
|
262
|
+
};
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
/** Changes to the objective or transcript invalidate an outstanding action approval. */
|
|
266
|
+
function connectorObjectiveScope(conversationId) {
|
|
267
|
+
const state = getSessionInputState(conversationId);
|
|
268
|
+
const input = state.activeInputId ? getSessionInputById(conversationId, state.activeInputId) : void 0;
|
|
269
|
+
if (!input) return void 0;
|
|
270
|
+
const active = getActiveConnectionWait(conversationId);
|
|
271
|
+
const wait = input.payload ? getConnectionWait(input.payload.waitId) : active?.originInputId === input.id ? active : void 0;
|
|
272
|
+
return JSON.stringify([
|
|
273
|
+
readCurrentTranscriptId(getSqliteDatabase(), conversationId),
|
|
274
|
+
wait?.objectiveId ?? input.id,
|
|
275
|
+
wait?.objectiveRevision ?? 0
|
|
276
|
+
]);
|
|
277
|
+
}
|
|
278
|
+
function bindObjectiveAccount(conversationId, connectorId, accountId) {
|
|
279
|
+
const db = getSqliteDatabase();
|
|
280
|
+
const state = getSessionInputState(conversationId);
|
|
281
|
+
const input = state.activeInputId ? getSessionInputById(conversationId, state.activeInputId) : void 0;
|
|
282
|
+
if (!input) return;
|
|
283
|
+
const wait = input.payload ? getConnectionWait(input.payload.waitId) : void 0;
|
|
284
|
+
db.prepare(`INSERT OR IGNORE INTO connector_objective_accounts
|
|
285
|
+
(conversation_id, transcript_id, objective_id, connector_id, account_id) VALUES (?, ?, ?, ?, ?)`).run(conversationId, readCurrentTranscriptId(db, conversationId) ?? "", wait?.objectiveId ?? input.id, connectorId, accountId);
|
|
228
286
|
}
|
|
229
287
|
function connectionBinding(conversationId, connectorId) {
|
|
230
288
|
const matches = connectionBindings(conversationId).filter((need) => need.connectorId === connectorId);
|
|
@@ -334,15 +392,18 @@ function listConnectionWaitsToCheck() {
|
|
|
334
392
|
}
|
|
335
393
|
var log, events;
|
|
336
394
|
var init_connection_wait_repository = __esmMin((() => {
|
|
395
|
+
init_connector_account_repository();
|
|
396
|
+
init_connector_repository();
|
|
337
397
|
init_logger();
|
|
338
398
|
init_task_run_repository();
|
|
339
399
|
init_connection();
|
|
340
400
|
init_transaction();
|
|
341
401
|
init_session_instance_repository();
|
|
402
|
+
init_session_repository();
|
|
342
403
|
init_session_input_repository();
|
|
343
404
|
log = createLogger("Connectors:Wait");
|
|
344
405
|
events = new EventEmitter();
|
|
345
406
|
}));
|
|
346
407
|
//#endregion
|
|
347
408
|
init_connection_wait_repository();
|
|
348
|
-
export { cancelConnectionObjective, connectionBinding, connectionBindings, consumeConnectionResume, getActiveConnectionWait, getConnectionResumeInput, getConnectionWait, init_connection_wait_repository, invalidateConnectionResumeIntent, isConnectionSuspended, listConnectionWaitsToCheck, onConnectionWaitChanged, publishConnectionWait, queueConnectionResolution, requireSessionConnection, reviseCurrentConnectionObjective, updateConnectionWait };
|
|
409
|
+
export { bindObjectiveAccount, cancelConnectionObjective, connectionBinding, connectionBindings, connectorObjectiveScope, consumeConnectionResume, getActiveConnectionWait, getConnectionResumeInput, getConnectionWait, init_connection_wait_repository, invalidateConnectionResumeIntent, isConnectionSuspended, listConnectionWaitsToCheck, onConnectionWaitChanged, publishConnectionWait, queueConnectionResolution, requireSessionConnection, reviseCurrentConnectionObjective, updateConnectionWait };
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { ConnectorAccount } from '../../connectors/types.js';
|
|
2
2
|
export declare function getConnectorAccount(id: string): ConnectorAccount | undefined;
|
|
3
|
+
export declare function updateConnectorAccount(id: string, patch: {
|
|
4
|
+
label?: string;
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
allowedAgentIds?: string[] | null;
|
|
7
|
+
}): ConnectorAccount;
|
|
3
8
|
export declare function listConnectorAccounts(options?: {
|
|
4
9
|
principalId?: string;
|
|
5
10
|
connectorId?: string;
|
|
@@ -7,6 +12,7 @@ export declare function listConnectorAccounts(options?: {
|
|
|
7
12
|
export declare function refreshConnectorAccountCurrent(accountId: string): ConnectorAccount | undefined;
|
|
8
13
|
export declare function reconcileConnectorAccount(input: {
|
|
9
14
|
connectionId: string;
|
|
15
|
+
backendId?: string;
|
|
10
16
|
identityKey: string;
|
|
11
17
|
identity: Record<string, unknown>;
|
|
12
18
|
}): ConnectorAccount;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
1
2
|
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
3
|
//#region src/storage/sqlite/connector-account-repository.ts
|
|
3
|
-
init_transaction();
|
|
4
4
|
function parseIdentity(value) {
|
|
5
5
|
try {
|
|
6
6
|
const parsed = JSON.parse(value);
|
|
@@ -15,8 +15,12 @@ function fromRow(row) {
|
|
|
15
15
|
connectorId: row.connector_id,
|
|
16
16
|
principalId: row.principal_id,
|
|
17
17
|
identityKey: row.identity_key ?? void 0,
|
|
18
|
+
backendId: row.backend_id ?? void 0,
|
|
18
19
|
identity: parseIdentity(row.identity_json),
|
|
19
20
|
currentConnectionId: row.current_connection_id ?? void 0,
|
|
21
|
+
label: row.label ?? void 0,
|
|
22
|
+
enabled: row.enabled === 1,
|
|
23
|
+
allowedAgentIds: row.allowed_agent_ids_json === null ? null : JSON.parse(row.allowed_agent_ids_json),
|
|
20
24
|
createdAt: row.created_at,
|
|
21
25
|
updatedAt: row.updated_at
|
|
22
26
|
};
|
|
@@ -74,6 +78,13 @@ function getConnectorAccount(id) {
|
|
|
74
78
|
const row = getSqliteDatabase().prepare("SELECT * FROM connector_accounts WHERE id = ?").get(id);
|
|
75
79
|
return row ? fromRow(row) : void 0;
|
|
76
80
|
}
|
|
81
|
+
function updateConnectorAccount(id, patch) {
|
|
82
|
+
const account = getConnectorAccount(id);
|
|
83
|
+
if (!account) throw new Error("Connector account not found.");
|
|
84
|
+
getSqliteDatabase().prepare(`UPDATE connector_accounts
|
|
85
|
+
SET label = ?, enabled = ?, allowed_agent_ids_json = ?, updated_at = ? WHERE id = ?`).run(patch.label === void 0 ? account.label ?? null : patch.label.trim() || null, patch.enabled ?? account.enabled ? 1 : 0, patch.allowedAgentIds === void 0 ? account.allowedAgentIds === null ? null : JSON.stringify(account.allowedAgentIds) : patch.allowedAgentIds === null ? null : JSON.stringify([...new Set(patch.allowedAgentIds)]), (/* @__PURE__ */ new Date()).toISOString(), id);
|
|
86
|
+
return getConnectorAccount(id);
|
|
87
|
+
}
|
|
77
88
|
function listConnectorAccounts(options = {}) {
|
|
78
89
|
const clauses = [];
|
|
79
90
|
const values = [];
|
|
@@ -109,13 +120,26 @@ function refreshConnectorAccountCurrent(accountId) {
|
|
|
109
120
|
function reconcileConnectorAccount(input) {
|
|
110
121
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
111
122
|
return getConnectorAccount(runSqliteWriteTransaction((db) => {
|
|
112
|
-
const connection = db.prepare(
|
|
123
|
+
const connection = db.prepare(`SELECT c.account_id, c.connector_id, c.principal_id, a.backend_id FROM connector_connections c
|
|
124
|
+
JOIN connector_accounts a ON a.id = c.account_id WHERE c.id = ?`).get(input.connectionId);
|
|
113
125
|
if (!connection?.account_id) throw new Error(`Connector connection not found: ${input.connectionId}`);
|
|
114
126
|
const targetId = db.prepare(`
|
|
115
127
|
SELECT id FROM connector_accounts
|
|
116
|
-
WHERE principal_id = ? AND connector_id = ? AND identity_key = ?
|
|
117
|
-
`).get(connection.principal_id, connection.connector_id, input.identityKey)?.id ?? connection.account_id;
|
|
128
|
+
WHERE principal_id = ? AND connector_id = ? AND identity_key = ? AND backend_id IS ?
|
|
129
|
+
`).get(connection.principal_id, connection.connector_id, input.identityKey, input.backendId ?? connection.backend_id)?.id ?? connection.account_id;
|
|
118
130
|
if (targetId !== connection.account_id) {
|
|
131
|
+
db.prepare(`UPDATE connector_installations SET selected_account_ids_json = (
|
|
132
|
+
SELECT json_group_array(DISTINCT CASE WHEN value = ? THEN ? ELSE value END)
|
|
133
|
+
FROM json_each(connector_installations.selected_account_ids_json))
|
|
134
|
+
WHERE json_type(selected_account_ids_json) = 'array'
|
|
135
|
+
AND EXISTS (SELECT 1 FROM json_each(selected_account_ids_json) WHERE value = ?)`).run(connection.account_id, targetId, connection.account_id);
|
|
136
|
+
db.prepare(`INSERT OR IGNORE INTO connector_objective_accounts
|
|
137
|
+
SELECT conversation_id, transcript_id, objective_id, connector_id, ?
|
|
138
|
+
FROM connector_objective_accounts WHERE account_id = ?`).run(targetId, connection.account_id);
|
|
139
|
+
const source = getConnectorAccount(connection.account_id);
|
|
140
|
+
const target = getConnectorAccount(targetId);
|
|
141
|
+
const agents = source.allowedAgentIds === null ? target.allowedAgentIds : target.allowedAgentIds === null ? source.allowedAgentIds : target.allowedAgentIds.filter((id) => source.allowedAgentIds.includes(id));
|
|
142
|
+
db.prepare(`UPDATE connector_accounts SET enabled = ?, allowed_agent_ids_json = ?, label = COALESCE(label, ?) WHERE id = ?`).run(source.enabled && target.enabled ? 1 : 0, agents === null ? null : JSON.stringify(agents), source.label ?? null, targetId);
|
|
119
143
|
mergeAccountSourceData(db, connection.connector_id, connection.account_id, targetId);
|
|
120
144
|
if (db.prepare("SELECT 1 FROM connector_sync_policies WHERE account_id = ?").get(targetId)) db.prepare("DELETE FROM connector_sync_policies WHERE account_id = ?").run(connection.account_id);
|
|
121
145
|
else db.prepare("UPDATE connector_sync_policies SET account_id = ? WHERE account_id = ?").run(targetId, connection.account_id);
|
|
@@ -133,11 +157,15 @@ function reconcileConnectorAccount(input) {
|
|
|
133
157
|
if (!primary) throw new Error(`Connector account has no authorizations: ${targetId}`);
|
|
134
158
|
db.prepare(`
|
|
135
159
|
UPDATE connector_accounts
|
|
136
|
-
SET identity_key = ?, identity_json = ?, current_connection_id = ?, updated_at = ?
|
|
160
|
+
SET identity_key = ?, identity_json = ?, current_connection_id = ?, updated_at = ?, backend_id = ?
|
|
137
161
|
WHERE id = ?
|
|
138
|
-
`).run(input.identityKey, JSON.stringify(input.identity), primary.id, now, targetId);
|
|
162
|
+
`).run(input.identityKey, JSON.stringify(input.identity), primary.id, now, input.backendId ?? connection.backend_id, targetId);
|
|
139
163
|
return targetId;
|
|
140
164
|
}));
|
|
141
165
|
}
|
|
166
|
+
var init_connector_account_repository = __esmMin((() => {
|
|
167
|
+
init_transaction();
|
|
168
|
+
}));
|
|
142
169
|
//#endregion
|
|
143
|
-
|
|
170
|
+
init_connector_account_repository();
|
|
171
|
+
export { getConnectorAccount, init_connector_account_repository, listConnectorAccounts, reconcileConnectorAccount, refreshConnectorAccountCurrent, updateConnectorAccount };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
1
2
|
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
3
|
import { randomUUID } from "node:crypto";
|
|
3
4
|
//#region src/storage/sqlite/connector-repository.ts
|
|
4
|
-
init_transaction();
|
|
5
5
|
function parseStringArray(value) {
|
|
6
6
|
try {
|
|
7
7
|
const parsed = JSON.parse(value);
|
|
@@ -27,7 +27,7 @@ function installationFromRow(row) {
|
|
|
27
27
|
allowedAgentIds: parseStringArray(row.allowed_agent_ids_json),
|
|
28
28
|
maxScope: row.max_scope,
|
|
29
29
|
confirmationPolicy: row.confirmation_policy,
|
|
30
|
-
|
|
30
|
+
selectedAccountIds: row.selected_account_ids_json === "null" ? null : parseStringArray(row.selected_account_ids_json),
|
|
31
31
|
createdAt: row.created_at,
|
|
32
32
|
updatedAt: row.updated_at
|
|
33
33
|
};
|
|
@@ -101,6 +101,7 @@ function catalogFromRow(row) {
|
|
|
101
101
|
function approvalFromRow(row) {
|
|
102
102
|
return {
|
|
103
103
|
id: row.id,
|
|
104
|
+
waitId: row.wait_id ?? void 0,
|
|
104
105
|
principalId: row.principal_id,
|
|
105
106
|
connectorId: row.connector_id,
|
|
106
107
|
connectionId: row.connection_id ?? void 0,
|
|
@@ -129,9 +130,9 @@ function createConnectorApproval(input) {
|
|
|
129
130
|
INSERT INTO connector_approvals (
|
|
130
131
|
id, principal_id, connector_id, connection_id, agent_id, conversation_id, action_id,
|
|
131
132
|
scope, arguments_hash, arguments_preview_json, status, expires_at, created_at,
|
|
132
|
-
decided_at, consumed_at
|
|
133
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
134
|
-
`).run(record.id, record.principalId, record.connectorId, record.connectionId ?? null, record.agentId ?? null, record.conversationId ?? null, record.actionId, record.scope, record.argumentsHash, JSON.stringify(record.argumentsPreview), record.status, record.expiresAt, record.createdAt, record.decidedAt ?? null, record.consumedAt ?? null);
|
|
133
|
+
decided_at, consumed_at, wait_id
|
|
134
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
135
|
+
`).run(record.id, record.principalId, record.connectorId, record.connectionId ?? null, record.agentId ?? null, record.conversationId ?? null, record.actionId, record.scope, record.argumentsHash, JSON.stringify(record.argumentsPreview), record.status, record.expiresAt, record.createdAt, record.decidedAt ?? null, record.consumedAt ?? null, record.waitId ?? null);
|
|
135
136
|
});
|
|
136
137
|
return record;
|
|
137
138
|
}
|
|
@@ -223,7 +224,7 @@ function upsertConnectorInstallation(input) {
|
|
|
223
224
|
db.prepare(`
|
|
224
225
|
INSERT INTO connector_installations (
|
|
225
226
|
id, connector_id, principal_id, enabled, allowed_agent_ids_json, max_scope,
|
|
226
|
-
confirmation_policy,
|
|
227
|
+
confirmation_policy, selected_account_ids_json, created_at, updated_at
|
|
227
228
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
228
229
|
ON CONFLICT(id) DO UPDATE SET
|
|
229
230
|
connector_id = excluded.connector_id,
|
|
@@ -232,9 +233,9 @@ function upsertConnectorInstallation(input) {
|
|
|
232
233
|
allowed_agent_ids_json = excluded.allowed_agent_ids_json,
|
|
233
234
|
max_scope = excluded.max_scope,
|
|
234
235
|
confirmation_policy = excluded.confirmation_policy,
|
|
235
|
-
|
|
236
|
+
selected_account_ids_json = excluded.selected_account_ids_json,
|
|
236
237
|
updated_at = excluded.updated_at
|
|
237
|
-
`).run(input.id, input.connectorId, input.principalId, input.enabled ? 1 : 0, JSON.stringify(input.allowedAgentIds), input.maxScope, input.confirmationPolicy, JSON.stringify(input.
|
|
238
|
+
`).run(input.id, input.connectorId, input.principalId, input.enabled ? 1 : 0, JSON.stringify(input.allowedAgentIds), input.maxScope, input.confirmationPolicy, JSON.stringify(input.selectedAccountIds), input.createdAt ?? now, input.updatedAt ?? now);
|
|
238
239
|
return getConnectorInstallation(input.id);
|
|
239
240
|
});
|
|
240
241
|
}
|
|
@@ -251,7 +252,7 @@ function deleteConnectorInstallation(id) {
|
|
|
251
252
|
function upsertConnectorConnection(input) {
|
|
252
253
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
253
254
|
return runSqliteWriteTransaction((db) => {
|
|
254
|
-
const accountId = input.accountId ?? `account:${input.id}`;
|
|
255
|
+
const accountId = db.prepare("SELECT account_id FROM connector_connections WHERE id = ?").get(input.id)?.account_id ?? input.accountId ?? `account:${input.id}`;
|
|
255
256
|
db.prepare(`
|
|
256
257
|
INSERT INTO connector_accounts (
|
|
257
258
|
id, connector_id, principal_id, identity_json, current_connection_id, created_at, updated_at
|
|
@@ -400,5 +401,9 @@ function releaseConnectorWebhookDelivery(id, error) {
|
|
|
400
401
|
`).run(message.slice(0, 500), id);
|
|
401
402
|
});
|
|
402
403
|
}
|
|
404
|
+
var init_connector_repository = __esmMin((() => {
|
|
405
|
+
init_transaction();
|
|
406
|
+
}));
|
|
403
407
|
//#endregion
|
|
404
|
-
|
|
408
|
+
init_connector_repository();
|
|
409
|
+
export { appendConnectorExecutionAudit, claimConnectorWebhookDelivery, completeConnectorWebhookDelivery, consumeConnectorApproval, createConnectorApproval, decideConnectorApproval, deleteConnectorConnection, deleteConnectorInstallation, getCachedConnectorCatalogEntry, getConnectorApproval, getConnectorConnection, getConnectorInstallation, init_connector_repository, listCachedConnectorCatalogEntries, listConnectorActionMetadata, listConnectorApprovals, listConnectorConnections, listConnectorExecutionAudit, listConnectorInstallations, releaseConnectorWebhookDelivery, replaceConnectorCatalogEntries, upsertConnectorActionMetadata, upsertConnectorCatalogEntry, upsertConnectorConnection, upsertConnectorInstallation };
|