@xopcai/xopc 0.0.303 → 0.0.307
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 +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/browser-ext/dist/assets/{auth-B_9ZuGDx.js → auth-C3yV1y_l.js} +67 -22
- package/dist/browser-ext/dist/background.js +4 -4
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +3 -3
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/xopc.extension.json +0 -3
- package/dist/extensions/telegram/xopc.extension.json +1 -4
- package/dist/extensions/weixin/xopc.extension.json +0 -3
- package/dist/gateway/static/root/assets/{activity-store-DCi5rh4e.js → activity-store-wgSB2HYK.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Ch3DzUvP.js → agent-avatar-dicebear-CZeQo09T.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BPsRb9Ck.js +1 -0
- package/dist/gateway/static/root/assets/{agents-DXHD-ST3.js → agents-BlrHMbRx.js} +1 -1
- package/dist/gateway/static/root/assets/{api-CAV9PN9i.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-Bzw4fQP8.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-8GZpUXva.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-BkQQtIxH.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BKGzaVvM.js → archive-plugin-CQ2NaoHb.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-8bARdLnp.js → attachment-load-BFi1H7yJ.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BAEenyzx.js → automations-page-CDBXcii_.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CUpiTTiY.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Cv3GS9Eo.js → binary-plugins-D07eWmOx.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-D4ZIVQbk.css → block-editor-BdOTO0Yo.css} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DUeb92LG.js → block-editor-CtVnjyYU.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BGT0xoTv.js → browser-automation-inputs-BzkJog8e.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-D1O22WIf.js → browser-automations-page-DyrSbDdG.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CqTxLpil.js +3 -0
- package/dist/gateway/static/root/assets/button-CS04eWY9.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BZ_-pnS6.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-DAD9qE3J.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-C_icwbWj.js → channels-status-swr-B2JwuTjG.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D-JYPVYl.js → chat-terminal-dock-B62SZdAo.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-Bcfp948A.js → computer-settings-page-ClSresNq.js} +1 -1
- package/dist/gateway/static/root/assets/connector-service-page-CPqVmNvx.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-BUQyg3CW.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CTMi_tql.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-B71AJK50.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-UtoUm57Q.js → dependency-picker-DlyGK-kA.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Bryx7gRM.js → desktop-pet-DGkbTE8_.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-BY8r9j66.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-DzRrgd59.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DQlFTVBx.js → extension-debug-page-L8Mm1n3A.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BSsqRDXh.js → extension-page-CFc4vSNU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DbVZv9ve.js → extension-settings-page-B5zWyHr3.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-D5AM8cyQ.js → gateway-config-swr-B6wHa6ZI.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-B53R0CA4.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-BLDgrJ30.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-D7qmTH4R.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CSJWdnFs.js → gateway-startup-retry-DRzGnEV-.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Cxowc29b.js → heartbeat-settings-Glsl3X5b.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-s9hDQ8Hc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-BNh604hw.js → image-generation-api-Ck_pyDom.js} +1 -1
- package/dist/gateway/static/root/assets/imports-page-ByBX7ome.js +1 -0
- package/dist/gateway/static/root/assets/index-RBCkv8a_.js +79 -0
- package/dist/gateway/static/root/assets/index-cFU4S35z.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-C45RlO8a.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-DP0x2jpR.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CXPaPDGm.js → local-apps-page-C_AQc2bI.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DLK05Y1a.js → locale-store-msTfRK8P.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DvM8Pyok.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-D1uwSutV.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-B8maDRWh.js → markdown-view-BInabSKf.js} +2 -2
- package/dist/gateway/static/root/assets/{media-plugins-tSJ0CvcX.js → media-plugins-C4mhf13f.js} +1 -1
- package/dist/gateway/static/root/assets/messages-F74LVAiU.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-D35sErp2.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-8jCDklDn.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-CQx6H-GS.js → page-tabs-1go_BtX1.js} +1 -1
- package/dist/gateway/static/root/assets/{popover-select-DldSX8GX.js → popover-select-9i-ZtHXL.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-A3-bVtdy.js → preview-open-alternatives-DmoSC0j1.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-D46cR3sf.js → proactive-page-xAjKTIID.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CujZXOea.js → product-open-page-gmi5LLwM.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BUMQHy_N.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DT-Mt7XR.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BMFL4vis.js → registry-api-BSWtko7U.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Clz3byir.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CR0qvq9C.js → runtime-tools-settings-panel-ClkOoxDl.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BUD9lLEE.js → schema-form-BuEmLiaU.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-tQRwktKm.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DqWg9XS5.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BZPCUH6a.js → settings-form-section-Dor39QON.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-XoHmqIdm.js → settings-page-Xj-yvIc8.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BB_sMB7P.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-BFWZoXdm.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-oDALm4b6.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DmwelnfK.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BE9JXz4U.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-CH-quGxZ.js → skills-page.utils-Ii8qeXhs.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CGC7eBso.js → system-settings-panel-Di6OSO-0.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-D1AWszc7.js +1 -0
- package/dist/gateway/static/root/assets/theme-store-1SZ-HFHX.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-DDOlOYlj.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-BydB6x2K.js → use-autosave-CQ8uWNnB.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-C00i4ea0.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CPUDBcag.js → voice-api-key-field-COTzshjL.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-bZqN8-UF.js → voice-config-api-DgJML_uM.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-D_FmJbGH.js → work-discovery-overlay-_URrXbi4.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CALs-1nd.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-BUiBjz6m.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 +14 -12
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/device-pairing.js +100 -7
- package/dist/packages/gateway-contract/src/gateway-scopes.js +53 -0
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/realtime-client/src/index.js +14 -2
- package/dist/packages/realtime-protocol/src/index.js +18 -14
- package/dist/src/agent/agent-instance-gateway.d.ts +2 -0
- package/dist/src/agent/agent-manager.d.ts +2 -0
- package/dist/src/agent/agent-manager.js +40 -12
- package/dist/src/agent/agent-scope.d.ts +4 -1
- package/dist/src/agent/agent-scope.js +19 -3
- package/dist/src/agent/commands/command-isolation.js +11 -9
- package/dist/src/agent/commands/command-registry.js +18 -33
- package/dist/src/agent/context/audit.js +12 -2
- package/dist/src/agent/context/coordinator.d.ts +13 -3
- package/dist/src/agent/context/coordinator.js +27 -11
- package/dist/src/agent/context/execution-context.js +42 -22
- package/dist/src/agent/context/execution-context.types.d.ts +4 -2
- package/dist/src/agent/context/execution-scope.d.ts +2 -2
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/context/project-context.d.ts +2 -2
- package/dist/src/agent/context/project-context.js +3 -3
- package/dist/src/agent/embedded/run-for-session.d.ts +1 -0
- package/dist/src/agent/embedded/run-for-session.js +7 -1
- 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/inbound/attachment-pipeline.d.ts +2 -0
- package/dist/src/agent/inbound/attachment-pipeline.js +3 -3
- package/dist/src/agent/inbound/inbound-loop.js +1 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +3 -3
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/mcp-stdio-transport.js +5 -2
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
- package/dist/src/agent/memory/compaction-promotion.js +7 -2
- package/dist/src/agent/memory/create-memory-manager.js +1 -0
- package/dist/src/agent/memory/manager.d.ts +6 -0
- package/dist/src/agent/memory/manager.js +74 -39
- package/dist/src/agent/memory/runtime.d.ts +3 -3
- package/dist/src/agent/memory/runtime.js +11 -4
- package/dist/src/agent/orchestration/agent-orchestrator.js +4 -1
- package/dist/src/agent/prompt/cache-boundary.d.ts +2 -0
- package/dist/src/agent/prompt/cache-boundary.js +10 -1
- package/dist/src/agent/service/build-direct-message-content.d.ts +1 -0
- package/dist/src/agent/service/build-direct-message-content.js +2 -1
- package/dist/src/agent/service/direct-turn-helpers.js +3 -2
- package/dist/src/agent/service/process-direct-streaming.d.ts +3 -1
- package/dist/src/agent/service/process-direct-streaming.js +3 -2
- package/dist/src/agent/service/webchat-tts.d.ts +0 -4
- package/dist/src/agent/service/webchat-tts.js +20 -19
- package/dist/src/agent/tools/factory.js +3 -3
- package/dist/src/agent/tools/knowledge-memory-tool.d.ts +2 -2
- package/dist/src/agent/tools/knowledge-memory-tool.js +7 -7
- package/dist/src/browser/native-messaging-host.js +2 -2
- package/dist/src/channels/attachments/voice-stt-webchat.d.ts +3 -0
- package/dist/src/channels/attachments/voice-stt-webchat.js +22 -9
- package/dist/src/cli/commands/agent.js +2 -0
- package/dist/src/cli/commands/config.js +8 -9
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +69 -44
- package/dist/src/cli/commands/extension-pack.js +0 -2
- package/dist/src/cli/commands/extension.js +4 -25
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/onboard/gateway.js +2 -1
- package/dist/src/cli/utils/init-workspace-core.js +5 -2
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/loader.d.ts +1 -0
- package/dist/src/config/loader.js +14 -1
- package/dist/src/config/schema.d.ts +22 -3
- package/dist/src/config/schema.js +13 -3
- 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/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 +4 -3
- 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/execution-environments/local-worktree-manager.js +17 -15
- package/dist/src/execution-environments/store.js +4 -2
- package/dist/src/execution-environments/types.d.ts +3 -0
- package/dist/src/execution-environments/types.js +2 -1
- package/dist/src/execution-environments/worktree-safety.d.ts +8 -0
- package/dist/src/execution-environments/worktree-safety.js +43 -0
- package/dist/src/extensions/activation-planner.d.ts +1 -1
- package/dist/src/extensions/activation-planner.js +1 -1
- package/dist/src/extensions/api-version.d.ts +4 -0
- package/dist/src/extensions/api-version.js +15 -0
- package/dist/src/extensions/api.d.ts +3 -9
- package/dist/src/extensions/api.js +26 -32
- package/dist/src/extensions/config-validation.d.ts +8 -0
- package/dist/src/extensions/config-validation.js +25 -0
- package/dist/src/extensions/extension-registry-impl.d.ts +20 -9
- package/dist/src/extensions/extension-registry-impl.js +79 -11
- package/dist/src/extensions/hooks.d.ts +1 -1
- package/dist/src/extensions/index.d.ts +2 -1
- package/dist/src/extensions/install-transaction.d.ts +2 -0
- package/dist/src/extensions/install-transaction.js +32 -21
- package/dist/src/extensions/install.js +18 -1
- package/dist/src/extensions/loader.d.ts +5 -5
- package/dist/src/extensions/loader.js +109 -47
- package/dist/src/extensions/lockfile.d.ts +3 -5
- package/dist/src/extensions/lockfile.js +41 -14
- package/dist/src/extensions/normalize-manifest.js +6 -60
- package/dist/src/extensions/sdk/index.d.ts +3 -2
- package/dist/src/extensions/sdk/index.js +2 -2
- package/dist/src/extensions/sdk/testing.js +0 -4
- package/dist/src/extensions/security.js +5 -7
- package/dist/src/extensions/types/core.d.ts +0 -5
- package/dist/src/extensions/types/index.d.ts +1 -1
- package/dist/src/extensions/types/manifest.d.ts +1 -25
- package/dist/src/extensions/types/providers.d.ts +1 -1
- package/dist/src/extensions/types/registration.d.ts +0 -12
- package/dist/src/extensions/update.js +71 -30
- package/dist/src/gateway/heartbeat/service.js +2 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +47 -10
- package/dist/src/gateway/hono/routes/connectors.js +208 -17
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/devices.js +10 -7
- package/dist/src/gateway/hono/routes/endpoint-compatibility.js +6 -0
- package/dist/src/gateway/hono/routes/extension-gateway.js +0 -33
- package/dist/src/gateway/hono/routes/home.js +4 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +0 -1
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/realtime.js +30 -8
- package/dist/src/gateway/hono/routes/user-model.js +25 -6
- package/dist/src/gateway/index.js +4 -1
- package/dist/src/gateway/lock.d.ts +2 -0
- package/dist/src/gateway/lock.js +31 -14
- package/dist/src/gateway/run-loop.js +2 -1
- package/dist/src/gateway/security/gateway-scopes.d.ts +2 -5
- package/dist/src/gateway/security/gateway-scopes.js +3 -45
- package/dist/src/gateway/security/index.js +2 -1
- package/dist/src/gateway/service.js +11 -7
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/imports/importService.d.ts +1 -1
- package/dist/src/imports/inventory.js +16 -2
- package/dist/src/imports/productImport.js +5 -5
- package/dist/src/imports/types.d.ts +3 -3
- package/dist/src/infra/exec.d.ts +2 -2
- package/dist/src/infra/exec.js +32 -27
- package/dist/src/infra/run-command.js +15 -50
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.js +13 -3
- package/dist/src/knowledge-memory/domain.d.ts +17 -1
- package/dist/src/knowledge-memory/index.js +2 -2
- package/dist/src/knowledge-memory/repository.d.ts +26 -4
- package/dist/src/knowledge-memory/repository.js +171 -36
- package/dist/src/mcp/channel-bridge.js +7 -3
- package/dist/src/media-understanding/registry.js +6 -1
- package/dist/src/migrations/knowledge-memory-read-policy-config.d.ts +2 -0
- package/dist/src/migrations/knowledge-memory-read-policy-config.js +48 -0
- package/dist/src/migrations/runner.js +2 -1
- package/dist/src/proactive/follow-ups.js +2 -1
- package/dist/src/process/bounded-output.d.ts +10 -0
- package/dist/src/process/bounded-output.js +41 -0
- package/dist/src/process/kill-tree.d.ts +6 -17
- package/dist/src/process/kill-tree.js +43 -75
- package/dist/src/process/process-spec.d.ts +39 -0
- package/dist/src/process/process-spec.js +13 -0
- package/dist/src/process/run-process.d.ts +4 -0
- package/dist/src/process/run-process.js +97 -0
- package/dist/src/providers/plugin-registry.d.ts +1 -1
- package/dist/src/providers/plugin-registry.js +6 -0
- package/dist/src/realtime/runtime.js +3 -1
- package/dist/src/session/store.js +1 -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/device-pairing-approval.js +1 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -1
- package/dist/src/storage/sqlite/index.js +6 -4
- package/dist/src/storage/sqlite/migrations/180_execution_environment_ownership.sql +7 -0
- package/dist/src/storage/sqlite/migrations/181_knowledge_item_status_events.sql +12 -0
- 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/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/storage/sqlite/schema.sql +13 -0
- package/dist/src/storage/sqlite/transcript-repository.d.ts +4 -0
- package/dist/src/storage/sqlite/transcript-repository.js +36 -1
- package/dist/src/tasks/home-query-service.js +3 -3
- package/dist/src/tui/backends/embedded-backend.d.ts +24 -8
- package/dist/src/tui/backends/embedded-backend.js +114 -10
- package/dist/src/tui/backends/gateway-realtime-backend.d.ts +18 -0
- package/dist/src/tui/backends/gateway-realtime-backend.js +31 -4
- package/dist/src/tui/components/assistant-message.d.ts +4 -1
- package/dist/src/tui/components/assistant-message.js +10 -2
- package/dist/src/tui/components/cell-render-mode.d.ts +4 -0
- package/dist/src/tui/components/cell-render-mode.js +1 -0
- package/dist/src/tui/components/chat-log.d.ts +17 -4
- package/dist/src/tui/components/chat-log.js +68 -50
- package/dist/src/tui/components/custom-editor.d.ts +2 -2
- package/dist/src/tui/components/custom-editor.js +5 -1
- package/dist/src/tui/components/pending-input-preview.d.ts +9 -0
- package/dist/src/tui/components/pending-input-preview.js +33 -0
- package/dist/src/tui/components/semantic-cell.d.ts +17 -0
- package/dist/src/tui/components/semantic-cell.js +29 -0
- package/dist/src/tui/components/tool-execution.d.ts +5 -1
- package/dist/src/tui/components/tool-execution.js +33 -10
- package/dist/src/tui/components/transcript-overlay.d.ts +29 -0
- package/dist/src/tui/components/transcript-overlay.js +114 -0
- package/dist/src/tui/components/tui-bottom-bar.js +3 -1
- package/dist/src/tui/components/user-message.d.ts +5 -1
- package/dist/src/tui/components/user-message.js +12 -1
- package/dist/src/tui/extension-host/load-extensions.d.ts +1 -1
- package/dist/src/tui/extension-host/runtime-context.js +2 -1
- package/dist/src/tui/extension-host/runtime.d.ts +1 -1
- package/dist/src/tui/format-tui-hotkeys.js +8 -1
- package/dist/src/tui/tui-agent-events.js +31 -0
- package/dist/src/tui/tui-backend.d.ts +23 -11
- package/dist/src/tui/tui-backend.js +1 -9
- package/dist/src/tui/tui-chat-input-state.d.ts +25 -0
- package/dist/src/tui/tui-chat-input-state.js +36 -0
- package/dist/src/tui/tui-command-formatters.js +2 -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-types.d.ts +2 -1
- package/dist/src/tui/tui-types.js +2 -1
- package/dist/src/tui/tui.js +122 -30
- package/dist/src/tui/xopc-tui-keybindings.d.ts +23 -3
- package/dist/src/tui/xopc-tui-keybindings.js +22 -2
- package/dist/src/user-context/access-policy.d.ts +2 -2
- package/dist/src/user-context/access-policy.js +10 -2
- package/dist/src/user-context/config.d.ts +23 -6
- package/dist/src/user-context/config.js +54 -7
- package/dist/src/voice/platform-streams.js +11 -1
- package/dist/src/voice/realtime/omniEngine.js +13 -1
- package/dist/src/voice/realtime/runtime.js +2 -1
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/voice/tts/speech-registry.js +6 -1
- 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 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-4oGrNj3m.js +0 -1
- package/dist/gateway/static/root/assets/api-fPapljyb.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-CdXnNtTg.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-izNAyDhW.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BQb3RCga.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-5vTl4x0h.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CH9prS-f.js +0 -3
- package/dist/gateway/static/root/assets/button-CGlRPNzi.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DMURlZbj.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-CFBS3Yqy.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DI1c3BMz.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-BJMBFKCh.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-BFRIn5y9.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DFsyEJUr.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-C3TQVPRy.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DUqVsB3X.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CLkumXdN.js +0 -1
- package/dist/gateway/static/root/assets/imports-page-DXNfRmk9.js +0 -1
- package/dist/gateway/static/root/assets/index-BLRIcVQa.css +0 -1
- package/dist/gateway/static/root/assets/index-gheM453N.js +0 -79
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-5Hcec8Xf.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BDg1-fcw.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-BWZc5jwO.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-COa3PhMs.js +0 -1
- package/dist/gateway/static/root/assets/messages-C9h8SImu.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-D_YGzNcR.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-D1f2oI2-.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-CRlD_Rwv.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-mmX0SavY.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Cqr3K6T5.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CPkvbdJP.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cu0DAbeH.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D8fQF1jZ.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-BgHqwTuT.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-Id4vRHzI.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BB2Fj_di.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BAwF4LpS.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-BVjw812D.js +0 -1
- package/dist/gateway/static/root/assets/theme-store-KfFEGMlp.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-Do98Xk05.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-Nv68a4ak.js +0 -2
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-1lZ_btki.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-DFOhccm3.js +0 -6
- package/dist/src/extensions/when-context.d.ts +0 -6
- package/dist/src/extensions/when-context.js +0 -26
- package/dist/src/extensions/when-expression.d.ts +0 -11
- package/dist/src/extensions/when-expression.js +0 -213
package/dist/src/infra/exec.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ChildProcess } from 'node:child_process';
|
|
2
2
|
export type ExecResult = {
|
|
3
3
|
stdout: string;
|
|
4
4
|
stderr: string;
|
|
@@ -13,4 +13,4 @@ export type ExecOptions = {
|
|
|
13
13
|
export declare function runExec(file: string, args: string[], opts?: ExecOptions): Promise<ExecResult>;
|
|
14
14
|
export declare function spawnDetached(file: string, args: string[], opts: {
|
|
15
15
|
stdio?: 'ignore' | 'pipe';
|
|
16
|
-
}):
|
|
16
|
+
}): ChildProcess;
|
package/dist/src/infra/exec.js
CHANGED
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProcessExitError } from "../process/process-spec.js";
|
|
2
|
+
import { runProcess, spawnProcess } from "../process/run-process.js";
|
|
2
3
|
//#region src/infra/exec.ts
|
|
3
|
-
function execFileAsync(file, args, opts) {
|
|
4
|
-
return new Promise((resolve, reject) => {
|
|
5
|
-
execFile(file, args, {
|
|
6
|
-
encoding: "utf8",
|
|
7
|
-
maxBuffer: opts.maxBuffer ?? 1024 * 1024,
|
|
8
|
-
cwd: opts.cwd,
|
|
9
|
-
env: opts.env,
|
|
10
|
-
timeout: opts.timeoutMs
|
|
11
|
-
}, (err, stdout, stderr) => {
|
|
12
|
-
if (err) {
|
|
13
|
-
const enriched = err;
|
|
14
|
-
enriched.stdout = typeof stdout === "string" ? stdout : String(stdout ?? "");
|
|
15
|
-
enriched.stderr = typeof stderr === "string" ? stderr : String(stderr ?? "");
|
|
16
|
-
reject(enriched);
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
resolve({
|
|
20
|
-
stdout: typeof stdout === "string" ? stdout : String(stdout ?? ""),
|
|
21
|
-
stderr: typeof stderr === "string" ? stderr : String(stderr ?? "")
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
4
|
/** Run a subprocess and capture stdout/stderr (OpenClaw-aligned). */
|
|
27
5
|
async function runExec(file, args, opts = {}) {
|
|
28
|
-
|
|
6
|
+
const result = await runProcess({
|
|
7
|
+
program: file,
|
|
8
|
+
args,
|
|
9
|
+
cwd: opts.cwd,
|
|
10
|
+
env: opts.env,
|
|
11
|
+
timeoutMs: opts.timeoutMs,
|
|
12
|
+
maxOutputBytes: opts.maxBuffer,
|
|
13
|
+
terminationPolicy: "tree"
|
|
14
|
+
});
|
|
15
|
+
if (result.exitCode !== 0) {
|
|
16
|
+
const error = new ProcessExitError({
|
|
17
|
+
program: file,
|
|
18
|
+
args
|
|
19
|
+
}, result);
|
|
20
|
+
error.stdout = result.stdout;
|
|
21
|
+
error.stderr = result.stderr;
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
stdout: result.stdout,
|
|
26
|
+
stderr: result.stderr
|
|
27
|
+
};
|
|
29
28
|
}
|
|
30
29
|
function spawnDetached(file, args, opts) {
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const handle = spawnProcess({
|
|
31
|
+
program: file,
|
|
32
|
+
args,
|
|
33
33
|
detached: false
|
|
34
34
|
});
|
|
35
|
+
if (opts.stdio === "ignore") {
|
|
36
|
+
handle.child.stdout?.resume();
|
|
37
|
+
handle.child.stderr?.resume();
|
|
38
|
+
}
|
|
39
|
+
return handle.child;
|
|
35
40
|
}
|
|
36
41
|
//#endregion
|
|
37
42
|
export { runExec, spawnDetached };
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { runProcess } from "../process/run-process.js";
|
|
2
2
|
//#region src/infra/run-command.ts
|
|
3
3
|
const MAX_CAPTURE_BYTES = 512 * 1024;
|
|
4
|
-
function appendCaptured(current, chunk) {
|
|
5
|
-
const next = current + chunk.toString();
|
|
6
|
-
if (next.length <= MAX_CAPTURE_BYTES) return next;
|
|
7
|
-
return next.slice(-MAX_CAPTURE_BYTES);
|
|
8
|
-
}
|
|
9
4
|
function createDefaultCommandRunner() {
|
|
10
5
|
return (argv, options) => runCommandWithTimeout(argv, options);
|
|
11
6
|
}
|
|
@@ -16,50 +11,20 @@ function runCommandWithTimeout(argv, options) {
|
|
|
16
11
|
stdout: "",
|
|
17
12
|
stderr: "empty argv"
|
|
18
13
|
});
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const finish = (result) => {
|
|
34
|
-
if (settled) return;
|
|
35
|
-
settled = true;
|
|
36
|
-
clearTimeout(timeoutId);
|
|
37
|
-
resolve(result);
|
|
38
|
-
};
|
|
39
|
-
const timeoutId = setTimeout(() => {
|
|
40
|
-
child.kill("SIGTERM");
|
|
41
|
-
}, options.timeoutMs);
|
|
42
|
-
child.stdout?.on("data", (chunk) => {
|
|
43
|
-
stdout = appendCaptured(stdout, chunk);
|
|
44
|
-
});
|
|
45
|
-
child.stderr?.on("data", (chunk) => {
|
|
46
|
-
stderr = appendCaptured(stderr, chunk);
|
|
47
|
-
});
|
|
48
|
-
child.on("error", (err) => {
|
|
49
|
-
finish({
|
|
50
|
-
code: null,
|
|
51
|
-
stdout,
|
|
52
|
-
stderr: stderr || err.message
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
child.on("close", (code) => {
|
|
56
|
-
finish({
|
|
57
|
-
code,
|
|
58
|
-
stdout,
|
|
59
|
-
stderr
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
});
|
|
14
|
+
return runProcess({
|
|
15
|
+
program: command,
|
|
16
|
+
args,
|
|
17
|
+
cwd: options.cwd,
|
|
18
|
+
env: options.env,
|
|
19
|
+
timeoutMs: options.timeoutMs,
|
|
20
|
+
maxOutputBytes: MAX_CAPTURE_BYTES,
|
|
21
|
+
terminationPolicy: "tree",
|
|
22
|
+
...process.platform === "win32" ? { shell: process.env.ComSpec && process.env.ComSpec.trim() || "cmd.exe" } : {}
|
|
23
|
+
}).then((result) => ({
|
|
24
|
+
code: result.exitCode,
|
|
25
|
+
stdout: result.stdout,
|
|
26
|
+
stderr: result.stderr
|
|
27
|
+
}));
|
|
63
28
|
}
|
|
64
29
|
//#endregion
|
|
65
30
|
export { createDefaultCommandRunner, runCommandWithTimeout };
|
|
@@ -2,8 +2,8 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { init_paths, resolveConfigPath } from "../config/paths.js";
|
|
4
4
|
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
|
-
import { isRestartEnabled } from "../config/commands.flags.js";
|
|
6
5
|
import { resolveGatewayService } from "../daemon/service.js";
|
|
6
|
+
import { isRestartEnabled } from "../config/commands.flags.js";
|
|
7
7
|
import { authorizeGatewaySigusr1Restart, writeGatewayRestartIntentSync } from "./restart.js";
|
|
8
8
|
import { findVerifiedGatewayListenerPidsOnPortSync, signalVerifiedGatewayPidSync } from "./gateway-processes.js";
|
|
9
9
|
import { refreshGatewayServiceAfterUpdate } from "./update-service-refresh.js";
|
|
@@ -2,7 +2,7 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { claimKnowledgeSourceItems, completeKnowledgeSourceItemSynthesis, listKnowledgeSourceItems, pruneBoundedKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
|
|
4
4
|
import "../storage/sqlite/index.js";
|
|
5
|
-
import { listKnowledgeItems,
|
|
5
|
+
import { listKnowledgeItems, transitionKnowledgeStatus, writeKnowledgeItem } from "../knowledge-memory/repository.js";
|
|
6
6
|
import "../knowledge-memory/index.js";
|
|
7
7
|
import { randomUUID } from "node:crypto";
|
|
8
8
|
//#region src/knowledge/connected-knowledge-pipeline.ts
|
|
@@ -54,7 +54,12 @@ var ConnectedKnowledgePipeline = class {
|
|
|
54
54
|
limit: 2e3
|
|
55
55
|
}).find((entry) => entry.canonicalKey === `source-item:${item.sourceInstanceId}:${item.externalId}`);
|
|
56
56
|
if (item.deletedAt) {
|
|
57
|
-
if (existing)
|
|
57
|
+
if (existing) transitionKnowledgeStatus({
|
|
58
|
+
id: existing.id,
|
|
59
|
+
status: "archived",
|
|
60
|
+
actor: "runtime",
|
|
61
|
+
reason: "Connected source item was deleted."
|
|
62
|
+
});
|
|
58
63
|
completeKnowledgeSourceItemSynthesis({
|
|
59
64
|
itemId: item.id,
|
|
60
65
|
workerId: this.workerId,
|
|
@@ -139,7 +144,12 @@ var ConnectedKnowledgePipeline = class {
|
|
|
139
144
|
recordClass: "source_index",
|
|
140
145
|
limit: 2e3
|
|
141
146
|
})) if (typeof item.source.sourceItemId === "string" && expiredIds.has(item.source.sourceItemId)) {
|
|
142
|
-
if (
|
|
147
|
+
if (transitionKnowledgeStatus({
|
|
148
|
+
id: item.id,
|
|
149
|
+
status: "archived",
|
|
150
|
+
actor: "maintenance",
|
|
151
|
+
reason: "Connected source retention window expired."
|
|
152
|
+
})) derivedDeleted += 1;
|
|
143
153
|
}
|
|
144
154
|
return {
|
|
145
155
|
rawDeleted: pruneBoundedKnowledgeSourceItems(sourceInstanceId, olderThanMs),
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { UserModelScope } from '../user-model/domain.js';
|
|
2
2
|
export type KnowledgeKind = 'project_fact' | 'workspace_fact' | 'decision' | 'task_lesson' | 'commitment' | 'open_question' | 'episode' | 'note';
|
|
3
3
|
export type KnowledgeStatus = 'candidate' | 'active' | 'needs_review' | 'stale' | 'archived' | 'rejected';
|
|
4
|
+
export type KnowledgeReviewAction = 'approve' | 'edit_and_approve' | 'reject' | 'archive';
|
|
5
|
+
export type KnowledgeStatusActor = 'user' | 'agent' | 'runtime' | 'maintenance' | 'migration';
|
|
4
6
|
export type KnowledgeOriginClass = 'owner' | 'agent' | 'system' | 'untrusted';
|
|
5
7
|
export type KnowledgeRecordClass = 'memory' | 'source_index';
|
|
6
|
-
export type
|
|
8
|
+
export type KnowledgeVisibilityScope = UserModelScope['type'];
|
|
9
|
+
export type KnowledgeContentSource = 'memory' | 'local_import' | 'connector';
|
|
10
|
+
export interface KnowledgeReadPolicy {
|
|
11
|
+
scopes: readonly KnowledgeVisibilityScope[];
|
|
12
|
+
contentSources: readonly KnowledgeContentSource[];
|
|
13
|
+
}
|
|
7
14
|
export interface KnowledgeItem {
|
|
8
15
|
id: string;
|
|
9
16
|
principalId: string;
|
|
@@ -34,3 +41,12 @@ export interface KnowledgeVisibilityContext {
|
|
|
34
41
|
projectId?: string;
|
|
35
42
|
conversationId: string;
|
|
36
43
|
}
|
|
44
|
+
export interface KnowledgeStatusEvent {
|
|
45
|
+
id: string;
|
|
46
|
+
knowledgeId: string;
|
|
47
|
+
fromStatus?: KnowledgeStatus;
|
|
48
|
+
toStatus: KnowledgeStatus;
|
|
49
|
+
actor: KnowledgeStatusActor;
|
|
50
|
+
reason: string;
|
|
51
|
+
createdAt: number;
|
|
52
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { getKnowledgeItem,
|
|
2
|
-
export { getKnowledgeItem,
|
|
1
|
+
import { KnowledgeReviewConflictError, classifyKnowledgeContentSource, getKnowledgeItem, knowledgeItemAllowed, listKnowledgeItems, listKnowledgeStatusEvents, reviewKnowledgeItem, searchKnowledgeItems, transitionKnowledgeStatus, writeKnowledgeItem } from "./repository.js";
|
|
2
|
+
export { KnowledgeReviewConflictError, classifyKnowledgeContentSource, getKnowledgeItem, knowledgeItemAllowed, listKnowledgeItems, listKnowledgeStatusEvents, reviewKnowledgeItem, searchKnowledgeItems, transitionKnowledgeStatus, writeKnowledgeItem };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type UserModelScope } from '../user-model/domain.js';
|
|
2
|
-
import type { KnowledgeItem, KnowledgeKind, KnowledgeOriginClass, KnowledgeRecordClass,
|
|
2
|
+
import type { KnowledgeItem, KnowledgeKind, KnowledgeOriginClass, KnowledgeRecordClass, KnowledgeContentSource, KnowledgeReadPolicy, KnowledgeStatus, KnowledgeReviewAction, KnowledgeStatusActor, KnowledgeStatusEvent, KnowledgeVisibilityContext } from './domain.js';
|
|
3
3
|
export interface WriteKnowledgeInput {
|
|
4
4
|
principalId?: string;
|
|
5
5
|
kind: KnowledgeKind;
|
|
@@ -23,6 +23,9 @@ export interface WriteKnowledgeInput {
|
|
|
23
23
|
replaceExisting?: boolean;
|
|
24
24
|
now?: number;
|
|
25
25
|
}
|
|
26
|
+
export declare class KnowledgeReviewConflictError extends Error {
|
|
27
|
+
constructor(message: string);
|
|
28
|
+
}
|
|
26
29
|
export declare function writeKnowledgeItem(input: WriteKnowledgeInput): {
|
|
27
30
|
item: KnowledgeItem;
|
|
28
31
|
created: boolean;
|
|
@@ -36,7 +39,25 @@ export declare function listKnowledgeItems(input?: {
|
|
|
36
39
|
recordClass?: KnowledgeRecordClass;
|
|
37
40
|
limit?: number;
|
|
38
41
|
}): KnowledgeItem[];
|
|
39
|
-
export declare function
|
|
42
|
+
export declare function transitionKnowledgeStatus(input: {
|
|
43
|
+
id: string;
|
|
44
|
+
status: KnowledgeStatus;
|
|
45
|
+
actor: KnowledgeStatusActor;
|
|
46
|
+
reason: string;
|
|
47
|
+
expectedStatus?: KnowledgeStatus;
|
|
48
|
+
content?: string;
|
|
49
|
+
now?: number;
|
|
50
|
+
}): KnowledgeItem | undefined;
|
|
51
|
+
export declare function reviewKnowledgeItem(input: {
|
|
52
|
+
id: string;
|
|
53
|
+
action: KnowledgeReviewAction;
|
|
54
|
+
actor: KnowledgeStatusActor;
|
|
55
|
+
reason: string;
|
|
56
|
+
expectedStatus?: KnowledgeStatus;
|
|
57
|
+
content?: string;
|
|
58
|
+
now?: number;
|
|
59
|
+
}): KnowledgeItem | undefined;
|
|
60
|
+
export declare function listKnowledgeStatusEvents(knowledgeId: string): KnowledgeStatusEvent[];
|
|
40
61
|
export declare function searchKnowledgeItems(input: {
|
|
41
62
|
query: string;
|
|
42
63
|
context: KnowledgeVisibilityContext;
|
|
@@ -44,7 +65,8 @@ export declare function searchKnowledgeItems(input: {
|
|
|
44
65
|
asOf?: number;
|
|
45
66
|
recordClass?: KnowledgeRecordClass;
|
|
46
67
|
trustedOnly?: boolean;
|
|
47
|
-
|
|
68
|
+
policy?: KnowledgeReadPolicy;
|
|
48
69
|
limit?: number;
|
|
49
70
|
}): KnowledgeItem[];
|
|
50
|
-
export declare function
|
|
71
|
+
export declare function classifyKnowledgeContentSource(item: KnowledgeItem): KnowledgeContentSource;
|
|
72
|
+
export declare function knowledgeItemAllowed(item: KnowledgeItem, policy: KnowledgeReadPolicy): boolean;
|
|
@@ -5,6 +5,12 @@ import { randomUUID } from "node:crypto";
|
|
|
5
5
|
//#region src/knowledge-memory/repository.ts
|
|
6
6
|
init_fts();
|
|
7
7
|
init_transaction();
|
|
8
|
+
var KnowledgeReviewConflictError = class extends Error {
|
|
9
|
+
constructor(message) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "KnowledgeReviewConflictError";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
8
14
|
function fromRow(row) {
|
|
9
15
|
return {
|
|
10
16
|
id: row.knowledge_id,
|
|
@@ -37,6 +43,14 @@ function fromRow(row) {
|
|
|
37
43
|
function bounded(value, field) {
|
|
38
44
|
if (!Number.isFinite(value) || value < 0 || value > 1) throw new Error(`${field} must be between 0 and 1.`);
|
|
39
45
|
}
|
|
46
|
+
function statusActorForOrigin(origin) {
|
|
47
|
+
return origin === "owner" ? "user" : origin === "agent" ? "agent" : "runtime";
|
|
48
|
+
}
|
|
49
|
+
function insertStatusEvent(db, input) {
|
|
50
|
+
db.prepare(`INSERT INTO knowledge_item_status_events (
|
|
51
|
+
event_id, knowledge_id, from_status, to_status, actor_type, reason, created_at
|
|
52
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?)`).run(randomUUID(), input.knowledgeId, input.fromStatus, input.toStatus, input.actor, input.reason, input.now);
|
|
53
|
+
}
|
|
40
54
|
function writeKnowledgeItem(input) {
|
|
41
55
|
validateScope(input.scope);
|
|
42
56
|
bounded(input.confidence, "confidence");
|
|
@@ -67,25 +81,43 @@ function writeKnowledgeItem(input) {
|
|
|
67
81
|
created: false
|
|
68
82
|
};
|
|
69
83
|
if (existing) {
|
|
84
|
+
const nextStatus = input.status ?? (input.originClass === "owner" ? "active" : "candidate");
|
|
70
85
|
db.prepare(`UPDATE knowledge_items SET kind = ?, content = ?, record_class = ?, status = ?, confidence = ?,
|
|
71
86
|
importance = ?, valid_from = ?, valid_to = ?, expires_at = ?, review_at = ?,
|
|
72
87
|
origin_class = ?, source_agent_id = ?, source_conversation_id = ?, source_turn_id = ?,
|
|
73
|
-
derived_from_recalled_context = ?, source_json = ?, updated_at = ? WHERE knowledge_id = ?`).run(input.kind, input.content.trim(), input.recordClass ?? "memory",
|
|
88
|
+
derived_from_recalled_context = ?, source_json = ?, updated_at = ? WHERE knowledge_id = ?`).run(input.kind, input.content.trim(), input.recordClass ?? "memory", nextStatus, input.confidence, input.importance, input.validFrom ?? null, input.validTo ?? null, input.expiresAt ?? null, input.reviewAt ?? null, input.originClass, input.sourceAgentId ?? null, input.sourceConversationId ?? null, input.sourceTurnId ?? null, input.derivedFromRecalledContext ? 1 : 0, JSON.stringify(input.source ?? {}), now, existing.knowledge_id);
|
|
74
89
|
db.prepare("DELETE FROM knowledge_items_fts WHERE knowledge_id = ?").run(existing.knowledge_id);
|
|
75
90
|
db.prepare("INSERT INTO knowledge_items_fts(content, knowledge_id) VALUES (?, ?)").run(input.content.trim(), existing.knowledge_id);
|
|
91
|
+
if (existing.status !== nextStatus) insertStatusEvent(db, {
|
|
92
|
+
knowledgeId: existing.knowledge_id,
|
|
93
|
+
fromStatus: existing.status,
|
|
94
|
+
toStatus: nextStatus,
|
|
95
|
+
actor: statusActorForOrigin(input.originClass),
|
|
96
|
+
reason: "Knowledge replaced from its source.",
|
|
97
|
+
now
|
|
98
|
+
});
|
|
76
99
|
return {
|
|
77
100
|
item: fromRow(db.prepare("SELECT * FROM knowledge_items WHERE knowledge_id = ?").get(existing.knowledge_id)),
|
|
78
101
|
created: false
|
|
79
102
|
};
|
|
80
103
|
}
|
|
81
104
|
const id = randomUUID();
|
|
105
|
+
const status = input.status ?? (input.originClass === "owner" ? "active" : "candidate");
|
|
82
106
|
db.prepare(`INSERT INTO knowledge_items (
|
|
83
107
|
knowledge_id, principal_id, kind, scope_type, scope_id, content, canonical_key, record_class,
|
|
84
108
|
status, confidence, importance, valid_from, valid_to, expires_at, review_at,
|
|
85
109
|
origin_class, source_agent_id, source_conversation_id, source_turn_id,
|
|
86
110
|
derived_from_recalled_context, source_json, created_at, updated_at
|
|
87
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(id, principalId, input.kind, input.scope.type, input.scope.id ?? null, input.content.trim(), input.canonicalKey.trim(), input.recordClass ?? "memory",
|
|
111
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(id, principalId, input.kind, input.scope.type, input.scope.id ?? null, input.content.trim(), input.canonicalKey.trim(), input.recordClass ?? "memory", status, input.confidence, input.importance, input.validFrom ?? null, input.validTo ?? null, input.expiresAt ?? null, input.reviewAt ?? null, input.originClass, input.sourceAgentId ?? null, input.sourceConversationId ?? null, input.sourceTurnId ?? null, input.derivedFromRecalledContext ? 1 : 0, JSON.stringify(input.source ?? {}), now, now);
|
|
88
112
|
db.prepare("INSERT INTO knowledge_items_fts(content, knowledge_id) VALUES (?, ?)").run(input.content.trim(), id);
|
|
113
|
+
insertStatusEvent(db, {
|
|
114
|
+
knowledgeId: id,
|
|
115
|
+
fromStatus: null,
|
|
116
|
+
toStatus: status,
|
|
117
|
+
actor: statusActorForOrigin(input.originClass),
|
|
118
|
+
reason: "Knowledge admitted.",
|
|
119
|
+
now
|
|
120
|
+
});
|
|
89
121
|
return {
|
|
90
122
|
item: fromRow(db.prepare("SELECT * FROM knowledge_items WHERE knowledge_id = ?").get(id)),
|
|
91
123
|
created: true
|
|
@@ -112,46 +144,146 @@ function listKnowledgeItems(input = {}) {
|
|
|
112
144
|
${input.canonicalKey ? "AND canonical_key = ?" : ""}
|
|
113
145
|
ORDER BY importance DESC, updated_at DESC LIMIT ?`).all(input.principalId ?? "local-owner", ...statuses, ...input.recordClass ? [input.recordClass] : [], ...input.scope ? [input.scope.type, input.scope.id ?? null] : [], ...input.canonicalKey ? [input.canonicalKey] : [], Math.max(1, Math.min(2e3, input.limit ?? 200))).map(fromRow);
|
|
114
146
|
}
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
|
|
147
|
+
function transitionKnowledgeStatus(input) {
|
|
148
|
+
const reason = input.reason.trim();
|
|
149
|
+
if (!reason) throw new Error("A knowledge status change reason is required.");
|
|
150
|
+
const content = input.content?.trim();
|
|
151
|
+
if (input.content !== void 0 && !content) throw new Error("Knowledge content is required.");
|
|
152
|
+
const now = input.now ?? Date.now();
|
|
153
|
+
return runSqliteWriteTransaction((db) => {
|
|
154
|
+
const current = db.prepare("SELECT * FROM knowledge_items WHERE knowledge_id = ?").get(input.id);
|
|
155
|
+
if (!current) return void 0;
|
|
156
|
+
if (input.expectedStatus && current.status !== input.expectedStatus) throw new KnowledgeReviewConflictError(`Knowledge status changed from ${input.expectedStatus} to ${current.status}.`);
|
|
157
|
+
db.prepare(`UPDATE knowledge_items SET status = ?, content = COALESCE(?, content), updated_at = ?
|
|
158
|
+
WHERE knowledge_id = ?`).run(input.status, content ?? null, now, input.id);
|
|
159
|
+
if (content !== void 0) {
|
|
160
|
+
db.prepare("DELETE FROM knowledge_items_fts WHERE knowledge_id = ?").run(input.id);
|
|
161
|
+
db.prepare("INSERT INTO knowledge_items_fts(content, knowledge_id) VALUES (?, ?)").run(content, input.id);
|
|
162
|
+
}
|
|
163
|
+
insertStatusEvent(db, {
|
|
164
|
+
knowledgeId: input.id,
|
|
165
|
+
fromStatus: current.status,
|
|
166
|
+
toStatus: input.status,
|
|
167
|
+
actor: input.actor,
|
|
168
|
+
reason,
|
|
169
|
+
now
|
|
170
|
+
});
|
|
171
|
+
return fromRow(db.prepare("SELECT * FROM knowledge_items WHERE knowledge_id = ?").get(input.id));
|
|
172
|
+
});
|
|
118
173
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
174
|
+
const REVIEW_TRANSITIONS = {
|
|
175
|
+
approve: {
|
|
176
|
+
from: [
|
|
177
|
+
"candidate",
|
|
178
|
+
"needs_review",
|
|
179
|
+
"stale"
|
|
180
|
+
],
|
|
181
|
+
to: "active"
|
|
182
|
+
},
|
|
183
|
+
edit_and_approve: {
|
|
184
|
+
from: [
|
|
185
|
+
"candidate",
|
|
186
|
+
"needs_review",
|
|
187
|
+
"stale"
|
|
188
|
+
],
|
|
189
|
+
to: "active",
|
|
190
|
+
requiresContent: true
|
|
191
|
+
},
|
|
192
|
+
reject: {
|
|
193
|
+
from: [
|
|
194
|
+
"candidate",
|
|
195
|
+
"needs_review",
|
|
196
|
+
"stale"
|
|
197
|
+
],
|
|
198
|
+
to: "rejected"
|
|
199
|
+
},
|
|
200
|
+
archive: {
|
|
201
|
+
from: [
|
|
202
|
+
"candidate",
|
|
203
|
+
"needs_review",
|
|
204
|
+
"stale",
|
|
205
|
+
"active"
|
|
206
|
+
],
|
|
207
|
+
to: "archived"
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
function reviewKnowledgeItem(input) {
|
|
211
|
+
const current = getKnowledgeItem(input.id);
|
|
212
|
+
if (!current) return void 0;
|
|
213
|
+
const transition = REVIEW_TRANSITIONS[input.action];
|
|
214
|
+
if (!transition.from.includes(current.status)) throw new KnowledgeReviewConflictError(`Cannot ${input.action} knowledge with status ${current.status}.`);
|
|
215
|
+
if (transition.requiresContent && !input.content?.trim()) throw new Error("Edited knowledge content is required.");
|
|
216
|
+
return transitionKnowledgeStatus({
|
|
217
|
+
id: input.id,
|
|
218
|
+
status: transition.to,
|
|
219
|
+
actor: input.actor,
|
|
220
|
+
reason: input.reason,
|
|
221
|
+
expectedStatus: input.expectedStatus ?? current.status,
|
|
222
|
+
...input.content === void 0 ? {} : { content: input.content },
|
|
223
|
+
...input.now === void 0 ? {} : { now: input.now }
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function listKnowledgeStatusEvents(knowledgeId) {
|
|
227
|
+
return getSqliteDatabase().prepare(`SELECT event_id, knowledge_id, from_status, to_status,
|
|
228
|
+
actor_type, reason, created_at FROM knowledge_item_status_events
|
|
229
|
+
WHERE knowledge_id = ? ORDER BY created_at ASC, event_id ASC`).all(knowledgeId).map((row) => ({
|
|
230
|
+
id: row.event_id,
|
|
231
|
+
knowledgeId: row.knowledge_id,
|
|
232
|
+
...row.from_status === null ? {} : { fromStatus: row.from_status },
|
|
233
|
+
toStatus: row.to_status,
|
|
234
|
+
actor: row.actor_type,
|
|
235
|
+
reason: row.reason,
|
|
236
|
+
createdAt: row.created_at
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
function visibilityClause(context, policy) {
|
|
240
|
+
const allowed = new Set(policy?.scopes ?? [
|
|
241
|
+
"global",
|
|
242
|
+
"agent",
|
|
243
|
+
"workspace",
|
|
244
|
+
"project",
|
|
245
|
+
"session"
|
|
246
|
+
]);
|
|
247
|
+
const parts = [];
|
|
248
|
+
const values = [];
|
|
249
|
+
if (allowed.has("global")) parts.push("k.scope_type = 'global'");
|
|
250
|
+
if (allowed.has("agent")) {
|
|
251
|
+
parts.push("(k.scope_type = 'agent' AND k.scope_id = ?)");
|
|
252
|
+
values.push(context.agentId ?? "");
|
|
253
|
+
}
|
|
254
|
+
if (allowed.has("workspace")) {
|
|
255
|
+
parts.push("(k.scope_type = 'workspace' AND k.scope_id = ?)");
|
|
256
|
+
values.push(context.workspaceId ?? "");
|
|
257
|
+
}
|
|
258
|
+
if (allowed.has("session")) {
|
|
259
|
+
parts.push("(k.scope_type = 'session' AND k.scope_id = ?)");
|
|
260
|
+
values.push(context.conversationId ?? "");
|
|
261
|
+
}
|
|
262
|
+
if (allowed.has("project") && context.projectId) {
|
|
132
263
|
parts.push("(k.scope_type = 'project' AND k.scope_id = ?)");
|
|
133
264
|
values.push(context.projectId);
|
|
134
265
|
}
|
|
135
266
|
return {
|
|
136
|
-
sql: `(${parts.join(" OR ")})`,
|
|
267
|
+
sql: `(${parts.length ? parts.join(" OR ") : "0"})`,
|
|
137
268
|
values
|
|
138
269
|
};
|
|
139
270
|
}
|
|
271
|
+
function contentSourceClause(policy) {
|
|
272
|
+
if (!policy) return "1";
|
|
273
|
+
const allowed = new Set(policy.contentSources);
|
|
274
|
+
const importedSource = "COALESCE(json_extract(k.source_json, '$.kind'), '') = 'product_import'";
|
|
275
|
+
const parts = [];
|
|
276
|
+
if (allowed.has("memory")) parts.push("k.record_class = 'memory'");
|
|
277
|
+
if (allowed.has("local_import")) parts.push(`(k.record_class = 'source_index' AND ${importedSource})`);
|
|
278
|
+
if (allowed.has("connector")) parts.push(`(k.record_class = 'source_index' AND NOT (${importedSource}))`);
|
|
279
|
+
return `(${parts.length ? parts.join(" OR ") : "0"})`;
|
|
280
|
+
}
|
|
140
281
|
function searchKnowledgeItems(input) {
|
|
141
282
|
const principalId = input.principalId ?? "local-owner";
|
|
142
283
|
const asOf = input.asOf ?? Date.now();
|
|
143
284
|
const limit = Math.max(1, Math.min(100, input.limit ?? 12));
|
|
144
|
-
const visible = visibilityClause(input.context);
|
|
145
|
-
const
|
|
146
|
-
const sourceValues = [];
|
|
147
|
-
const importedSource = "COALESCE(json_extract(k.source_json, '$.kind'), '') = 'product_import'";
|
|
148
|
-
if (input.sources?.includes("connector")) sourceParts.push(`(k.record_class = 'source_index' AND NOT (${importedSource}))`);
|
|
149
|
-
if (input.sources?.includes("workspace")) sourceParts.push(`(k.record_class = 'source_index' AND ${importedSource})`);
|
|
150
|
-
const memoryScopes = input.sources?.filter((source) => source !== "connector") ?? [];
|
|
151
|
-
if (memoryScopes.length) {
|
|
152
|
-
sourceParts.push(`(k.record_class = 'memory' AND k.scope_type IN (${memoryScopes.map(() => "?").join(", ")}))`);
|
|
153
|
-
sourceValues.push(...memoryScopes);
|
|
154
|
-
}
|
|
285
|
+
const visible = visibilityClause(input.context, input.policy);
|
|
286
|
+
const contentSource = contentSourceClause(input.policy);
|
|
155
287
|
const fts = buildFts5SearchQuery(input.query);
|
|
156
288
|
if (!fts) return [];
|
|
157
289
|
return getSqliteDatabase().prepare(`SELECT k.*, bm25(knowledge_items_fts) AS rank
|
|
@@ -162,13 +294,16 @@ function searchKnowledgeItems(input) {
|
|
|
162
294
|
AND (k.expires_at IS NULL OR k.expires_at >= ?)
|
|
163
295
|
${input.recordClass ? "AND k.record_class = ?" : ""}
|
|
164
296
|
${input.trustedOnly ? "AND k.origin_class != 'untrusted'" : ""}
|
|
165
|
-
|
|
297
|
+
AND ${contentSource}
|
|
166
298
|
AND ${visible.sql}
|
|
167
|
-
ORDER BY rank ASC, k.importance DESC, k.updated_at DESC LIMIT ?`).all(fts, principalId, asOf, asOf, asOf, ...input.recordClass ? [input.recordClass] : [], ...
|
|
299
|
+
ORDER BY rank ASC, k.importance DESC, k.updated_at DESC LIMIT ?`).all(fts, principalId, asOf, asOf, asOf, ...input.recordClass ? [input.recordClass] : [], ...visible.values, limit).map(fromRow);
|
|
300
|
+
}
|
|
301
|
+
function classifyKnowledgeContentSource(item) {
|
|
302
|
+
if (item.recordClass === "memory") return "memory";
|
|
303
|
+
return item.source.kind === "product_import" ? "local_import" : "connector";
|
|
168
304
|
}
|
|
169
|
-
function
|
|
170
|
-
|
|
171
|
-
return item.scope.type === "session" ? sources.includes("session") : item.scope.type === "workspace" ? sources.includes("workspace") : item.scope.type === "project" ? sources.includes("project") : false;
|
|
305
|
+
function knowledgeItemAllowed(item, policy) {
|
|
306
|
+
return policy.scopes.includes(item.scope.type) && policy.contentSources.includes(classifyKnowledgeContentSource(item));
|
|
172
307
|
}
|
|
173
308
|
//#endregion
|
|
174
|
-
export { getKnowledgeItem,
|
|
309
|
+
export { KnowledgeReviewConflictError, classifyKnowledgeContentSource, getKnowledgeItem, knowledgeItemAllowed, listKnowledgeItems, listKnowledgeStatusEvents, reviewKnowledgeItem, searchKnowledgeItems, transitionKnowledgeStatus, writeKnowledgeItem };
|
|
@@ -62,10 +62,14 @@ var XopcChannelBridge = class {
|
|
|
62
62
|
issueTicket: async () => {
|
|
63
63
|
const response = await this.client.postJson("/api/realtime/tickets", {
|
|
64
64
|
clientId: this.realtimeClientId,
|
|
65
|
-
clientKind: "mcp"
|
|
65
|
+
clientKind: "mcp",
|
|
66
|
+
protocolVersion: 2
|
|
66
67
|
});
|
|
67
|
-
if (!response.payload?.ticket) throw new Error(response.error?.message ?? "Realtime ticket response is invalid");
|
|
68
|
-
return
|
|
68
|
+
if (!response.payload?.ticket || !response.payload.realtime) throw new Error(response.error?.message ?? "Realtime ticket response is invalid");
|
|
69
|
+
return {
|
|
70
|
+
ticket: response.payload.ticket,
|
|
71
|
+
realtime: response.payload.realtime
|
|
72
|
+
};
|
|
69
73
|
},
|
|
70
74
|
createWebSocket: (url) => new WebSocket(url),
|
|
71
75
|
onEvent: (event) => this.handleRealtimeEvent(event),
|
|
@@ -14,6 +14,7 @@ function indexProvider(provider) {
|
|
|
14
14
|
}
|
|
15
15
|
function registerMediaUnderstandingProvider(provider) {
|
|
16
16
|
const keys = indexProvider(provider);
|
|
17
|
+
const previous = new Map(keys.map((key) => [key, registry.get(key)]));
|
|
17
18
|
const conflicts = keys.filter((key) => registry.has(key));
|
|
18
19
|
if (conflicts.length > 0) log.warn({
|
|
19
20
|
providerId: provider.id,
|
|
@@ -21,7 +22,11 @@ function registerMediaUnderstandingProvider(provider) {
|
|
|
21
22
|
}, `Media-understanding provider "${provider.id}" overrides existing registration(s): ${conflicts.join(", ")}`);
|
|
22
23
|
for (const key of keys) registry.set(key, provider);
|
|
23
24
|
return () => {
|
|
24
|
-
for (const key of keys) if (registry.get(key) === provider)
|
|
25
|
+
for (const key of keys) if (registry.get(key) === provider) {
|
|
26
|
+
const prior = previous.get(key);
|
|
27
|
+
if (prior) registry.set(key, prior);
|
|
28
|
+
else registry.delete(key);
|
|
29
|
+
}
|
|
25
30
|
};
|
|
26
31
|
}
|
|
27
32
|
function getMediaUnderstandingProvider(id) {
|