@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { browserPairingInvitationPayloadSchema, devicePairingTargetKindSchema, formatBrowserPairingInvitation, formatMobilePairingInvitation } from "../../../../packages/gateway-contract/src/device-pairing.js";
|
|
2
2
|
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
3
3
|
import { listDevices, revokeDevice, rotateDeviceRefreshToken } from "../../../storage/sqlite/device-access-repository.js";
|
|
4
4
|
import { getGatewayIdentityPublicKeyRaw, getOrCreateGatewayIdentity, signGatewayPayload } from "../../../storage/sqlite/gateway-identity-repository.js";
|
|
@@ -23,9 +23,6 @@ const refreshRequestSchema = z.strictObject({
|
|
|
23
23
|
});
|
|
24
24
|
const pairingProbeSchema = z.strictObject({ pairingId: z.string().uuid() });
|
|
25
25
|
const pairingSetupSchema = z.strictObject({ targetKind: devicePairingTargetKindSchema });
|
|
26
|
-
function pairingPayload(input) {
|
|
27
|
-
return Buffer.from(JSON.stringify(devicePairingInvitationPayloadSchema.parse(input))).toString("base64url");
|
|
28
|
-
}
|
|
29
26
|
function registerDeviceAuthPublicRoutes(app, options) {
|
|
30
27
|
app.post("/api/gateway-identity/challenge", bodyLimit({ maxSize: 512 }), async (c) => {
|
|
31
28
|
const budget = buckets.identityChallenge().consume("gateway");
|
|
@@ -154,7 +151,14 @@ function registerDeviceRoutes(authenticated, deps) {
|
|
|
154
151
|
}, 409);
|
|
155
152
|
const setup = createDevicePairingSetup(routes, Date.now(), { targetKind: parsed.data.targetKind });
|
|
156
153
|
const identity = getOrCreateGatewayIdentity();
|
|
157
|
-
const
|
|
154
|
+
const invitation = setup.targetKind === "mobile" ? { universalLink: formatMobilePairingInvitation({
|
|
155
|
+
version: 4,
|
|
156
|
+
pairingToken: setup.token,
|
|
157
|
+
gatewayId: identity.id,
|
|
158
|
+
gatewayPublicKey: getGatewayIdentityPublicKeyRaw(identity),
|
|
159
|
+
origins: routes.map((route) => route.url),
|
|
160
|
+
expiresAt: setup.expiresAt
|
|
161
|
+
}) } : { browserInvitation: formatBrowserPairingInvitation(Buffer.from(JSON.stringify(browserPairingInvitationPayloadSchema.parse({
|
|
158
162
|
version: 3,
|
|
159
163
|
pairingToken: setup.token,
|
|
160
164
|
gatewayId: identity.id,
|
|
@@ -163,8 +167,7 @@ function registerDeviceRoutes(authenticated, deps) {
|
|
|
163
167
|
routes,
|
|
164
168
|
targetKind: setup.targetKind,
|
|
165
169
|
expiresAt: setup.expiresAt
|
|
166
|
-
});
|
|
167
|
-
const invitation = setup.targetKind === "mobile" ? { universalLink: `https://link.xopc.ai/connect#p=${encoded}` } : { browserInvitation: formatBrowserPairingInvitation(encoded) };
|
|
170
|
+
}))).toString("base64url")) };
|
|
168
171
|
return c.json({
|
|
169
172
|
ok: true,
|
|
170
173
|
setup: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { init_src } from "../../../../packages/endpoint-tools-protocol/src/index.js";
|
|
2
2
|
import { COMPUTER_DESCRIPTOR, COMPUTER_FRAME_MAX_BYTES, init_src as init_src$1 } from "../../../../packages/computer-control-contract/src/index.js";
|
|
3
|
+
import { REALTIME_CAPABILITIES } from "../../../../packages/realtime-protocol/src/index.js";
|
|
3
4
|
//#region src/gateway/hono/routes/endpoint-compatibility.ts
|
|
4
5
|
init_src$1();
|
|
5
6
|
init_src();
|
|
@@ -10,6 +11,11 @@ function registerEndpointCompatibilityRoutes(authenticated) {
|
|
|
10
11
|
ok: true,
|
|
11
12
|
payload: {
|
|
12
13
|
realtimeProtocolVersion: 2,
|
|
14
|
+
realtime: {
|
|
15
|
+
minVersion: 2,
|
|
16
|
+
maxVersion: 2,
|
|
17
|
+
capabilities: REALTIME_CAPABILITIES
|
|
18
|
+
},
|
|
13
19
|
endpointProtocolVersion: 2,
|
|
14
20
|
computerControl: COMPUTER_DESCRIPTOR,
|
|
15
21
|
computerFrameUploadMaxBytes: COMPUTER_FRAME_MAX_BYTES
|
|
@@ -1,39 +1,6 @@
|
|
|
1
1
|
//#region src/gateway/hono/routes/extension-gateway.ts
|
|
2
2
|
function registerExtensionGatewayRoutes(authenticated, deps) {
|
|
3
3
|
const { service } = deps;
|
|
4
|
-
const extensionRegistry = service.getExtensionRegistry?.();
|
|
5
|
-
if (extensionRegistry) {
|
|
6
|
-
const httpRoutes = extensionRegistry.httpRoutes;
|
|
7
|
-
for (const [path, handler] of httpRoutes) {
|
|
8
|
-
authenticated.post(path, async (c) => {
|
|
9
|
-
const response = await handler({
|
|
10
|
-
method: c.req.method,
|
|
11
|
-
url: c.req.url,
|
|
12
|
-
headers: c.req.header(),
|
|
13
|
-
body: await c.req.json().catch(() => ({}))
|
|
14
|
-
});
|
|
15
|
-
if (response) {
|
|
16
|
-
if (response.status) c.status(response.status);
|
|
17
|
-
if (response.headers) for (const [key, value] of Object.entries(response.headers)) c.header(key, String(value));
|
|
18
|
-
if (response.body !== void 0) return c.json(response.body);
|
|
19
|
-
}
|
|
20
|
-
return c.text("");
|
|
21
|
-
});
|
|
22
|
-
authenticated.get(path, async (c) => {
|
|
23
|
-
const response = await handler({
|
|
24
|
-
method: c.req.method,
|
|
25
|
-
url: c.req.url,
|
|
26
|
-
headers: c.req.header()
|
|
27
|
-
});
|
|
28
|
-
if (response) {
|
|
29
|
-
if (response.status) c.status(response.status);
|
|
30
|
-
if (response.headers) for (const [key, value] of Object.entries(response.headers)) c.header(key, String(value));
|
|
31
|
-
if (response.body !== void 0) return c.json(response.body);
|
|
32
|
-
}
|
|
33
|
-
return c.text("");
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
4
|
authenticated.post("/api/gateway/:method", async (c) => {
|
|
38
5
|
const method = c.req.param("method");
|
|
39
6
|
const params = await c.req.json().catch(() => ({}));
|
|
@@ -3,6 +3,7 @@ import { decideConnectorApproval } from "../../../storage/sqlite/connector-repos
|
|
|
3
3
|
import "../../../storage/sqlite/index.js";
|
|
4
4
|
import { listGatewayAgents } from "../../agents-admin.js";
|
|
5
5
|
import { HomeQueryService, buildHomeWorkbench, decisionFromTask } from "../../../tasks/home-query-service.js";
|
|
6
|
+
import { resumeApprovedConnectorAction } from "../../../connectors/approval-resume.js";
|
|
6
7
|
//#region src/gateway/hono/routes/home.ts
|
|
7
8
|
/** Register the unified work-home read model and its decision actions. */
|
|
8
9
|
function registerHomeRoutes(authenticated, deps) {
|
|
@@ -26,9 +27,11 @@ function registerHomeRoutes(authenticated, deps) {
|
|
|
26
27
|
ok: false,
|
|
27
28
|
error: `Approval is ${approval.status}`
|
|
28
29
|
}, 409);
|
|
30
|
+
const resumed = await resumeApprovedConnectorAction(approval, service.connectionRecovery);
|
|
29
31
|
return c.json({
|
|
30
32
|
ok: true,
|
|
31
|
-
status: approval.status
|
|
33
|
+
status: approval.status,
|
|
34
|
+
resumed
|
|
32
35
|
});
|
|
33
36
|
}
|
|
34
37
|
return c.json({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { isManagedConnectorServer } from "../../../connectors/materialize.js";
|
|
1
2
|
import { canonicalizeConfiguredMcpServer, normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
|
|
2
3
|
import { loadMergedBundleMcpConfig } from "../../../agent/mcp/bundle-mcp-config.js";
|
|
3
|
-
import { isManagedConnectorServer } from "../../../connectors/materialize.js";
|
|
4
4
|
import { getWorkspacePath } from "../../../config/workspace-path-helpers.js";
|
|
5
5
|
import { getMcpOAuthManager } from "../../../agent/mcp/oauth/mcp-oauth-manager.js";
|
|
6
6
|
import { listBundleMcpServerCapabilitiesForGateway, listBundleMcpServerToolsForGateway } from "../../../agent/mcp/bundle-mcp-gateway.js";
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { realtimeClientKindSchema } from "../../../../packages/realtime-protocol/src/index.js";
|
|
1
|
+
import { REALTIME_CAPABILITIES, realtimeClientKindSchema } from "../../../../packages/realtime-protocol/src/index.js";
|
|
2
2
|
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/gateway/hono/routes/realtime.ts
|
|
5
5
|
const ticketRequestSchema = z.strictObject({
|
|
6
6
|
clientId: z.string().min(1).max(160),
|
|
7
|
-
clientKind: realtimeClientKindSchema
|
|
7
|
+
clientKind: realtimeClientKindSchema,
|
|
8
|
+
protocolVersion: z.number().int().positive()
|
|
8
9
|
});
|
|
9
10
|
function registerRealtimeRoutes(authenticated, deps) {
|
|
10
11
|
authenticated.post("/api/realtime/tickets", async (c) => {
|
|
@@ -16,16 +17,37 @@ function registerRealtimeRoutes(authenticated, deps) {
|
|
|
16
17
|
message: "Invalid realtime ticket request"
|
|
17
18
|
}
|
|
18
19
|
}, 400);
|
|
20
|
+
if (parsed.data.protocolVersion !== 2) {
|
|
21
|
+
const clientIsOlder = parsed.data.protocolVersion < 2;
|
|
22
|
+
return c.json({
|
|
23
|
+
ok: false,
|
|
24
|
+
error: {
|
|
25
|
+
code: clientIsOlder ? "CLIENT_UPDATE_REQUIRED" : "GATEWAY_UPDATE_REQUIRED",
|
|
26
|
+
message: clientIsOlder ? "Update the client to connect to this Gateway." : "Update the Gateway to connect this client.",
|
|
27
|
+
retryable: false,
|
|
28
|
+
clientProtocolVersion: parsed.data.protocolVersion,
|
|
29
|
+
gatewayProtocolVersion: 2
|
|
30
|
+
}
|
|
31
|
+
}, 426);
|
|
32
|
+
}
|
|
19
33
|
try {
|
|
20
34
|
const principal = getGatewayPrincipal(c);
|
|
35
|
+
const ticket = deps.service.realtime.tickets.issue(parsed.data.clientId, parsed.data.clientKind, {
|
|
36
|
+
principalId: principal.principalId,
|
|
37
|
+
...principal.deviceId ? { deviceId: principal.deviceId } : {},
|
|
38
|
+
...principal.accessSessionId ? { accessSessionId: principal.accessSessionId } : {},
|
|
39
|
+
scopes: principal.scopes
|
|
40
|
+
});
|
|
21
41
|
return c.json({
|
|
22
42
|
ok: true,
|
|
23
|
-
payload:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
43
|
+
payload: {
|
|
44
|
+
...ticket,
|
|
45
|
+
realtime: {
|
|
46
|
+
minVersion: 2,
|
|
47
|
+
maxVersion: 2,
|
|
48
|
+
capabilities: REALTIME_CAPABILITIES
|
|
49
|
+
}
|
|
50
|
+
}
|
|
29
51
|
});
|
|
30
52
|
} catch (error) {
|
|
31
53
|
return c.json({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createCollaborationRule, getCollaborationRule, listCollaborationRules, setCollaborationRuleStatus } from "../../../storage/sqlite/collaboration-rule-repository.js";
|
|
2
|
-
import { getKnowledgeItem, listKnowledgeItems,
|
|
2
|
+
import { KnowledgeReviewConflictError, getKnowledgeItem, listKnowledgeItems, reviewKnowledgeItem, searchKnowledgeItems } from "../../../knowledge-memory/repository.js";
|
|
3
3
|
import "../../../knowledge-memory/index.js";
|
|
4
4
|
import { createPriorityWindow, createUserGoal, listPriorityWindows, listUserGoals, setUserGoalStatus } from "../../../user-model/goals.js";
|
|
5
5
|
import { getAssertionSlot, getUserAssertion, listUserAssertionSources, listUserAssertions, reconcileAssertion, setAssertionStatus } from "../../../user-model/repository.js";
|
|
@@ -83,6 +83,12 @@ const GOAL_STATUSES = new Set([
|
|
|
83
83
|
"achieved",
|
|
84
84
|
"abandoned"
|
|
85
85
|
]);
|
|
86
|
+
const KNOWLEDGE_REVIEW_ACTIONS = new Set([
|
|
87
|
+
"approve",
|
|
88
|
+
"edit_and_approve",
|
|
89
|
+
"reject",
|
|
90
|
+
"archive"
|
|
91
|
+
]);
|
|
86
92
|
const KNOWLEDGE_STATUSES = new Set([
|
|
87
93
|
"candidate",
|
|
88
94
|
"active",
|
|
@@ -399,12 +405,25 @@ function registerUserModelRoutes(authenticated, deps) {
|
|
|
399
405
|
const item = getKnowledgeItem(c.req.param("id"));
|
|
400
406
|
return item ? c.json({ item }) : c.json({ error: "Knowledge item not found" }, 404);
|
|
401
407
|
});
|
|
402
|
-
authenticated.
|
|
408
|
+
authenticated.post("/api/knowledge-memory/:id/review", write, async (c) => {
|
|
403
409
|
const input = await body(c);
|
|
404
|
-
const
|
|
405
|
-
if (!
|
|
406
|
-
|
|
407
|
-
|
|
410
|
+
const action = String(input?.action ?? "");
|
|
411
|
+
if (!KNOWLEDGE_REVIEW_ACTIONS.has(action)) return c.json({ error: "Invalid knowledge review action" }, 400);
|
|
412
|
+
if (input?.expectedStatus !== void 0 && !KNOWLEDGE_STATUSES.has(String(input.expectedStatus))) return c.json({ error: "Invalid expected knowledge status" }, 400);
|
|
413
|
+
if (input?.content !== void 0 && action !== "edit_and_approve") return c.json({ error: "Content can only be changed while editing and approving knowledge" }, 400);
|
|
414
|
+
try {
|
|
415
|
+
const item = reviewKnowledgeItem({
|
|
416
|
+
id: c.req.param("id"),
|
|
417
|
+
action,
|
|
418
|
+
actor: "user",
|
|
419
|
+
reason: typeof input?.reason === "string" && input.reason.trim() ? input.reason : `Knowledge ${action} by user.`,
|
|
420
|
+
...typeof input?.expectedStatus === "string" ? { expectedStatus: input.expectedStatus } : {},
|
|
421
|
+
...typeof input?.content === "string" ? { content: input.content } : {}
|
|
422
|
+
});
|
|
423
|
+
return item ? c.json({ item }) : c.json({ error: "Knowledge item not found" }, 404);
|
|
424
|
+
} catch (error) {
|
|
425
|
+
return c.json({ error: errorMessage(error) }, error instanceof KnowledgeReviewConflictError ? 409 : 400);
|
|
426
|
+
}
|
|
408
427
|
});
|
|
409
428
|
authenticated.get("/api/memory-maintenance/runs", (c) => c.json({ runs: listMemoryMaintenanceRuns(Math.max(1, Math.min(100, Number(c.req.query("limit") ?? 20)))) }));
|
|
410
429
|
authenticated.get("/api/turns/:turnId/execution-context", (c) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GatewayLockError, acquireGatewayLock, init_lock } from "./lock.js";
|
|
1
2
|
import { buildDefaultCorsOrigins, isAllInterfacesHost, isLoopbackHost, resolveEffectiveGatewayPort, resolveGatewayServiceListenPort } from "./host.js";
|
|
2
3
|
import { defaultGatewayBindMode, isContainerEnvironment, resolveGatewayBindHost, resolveGatewayBindHostSync, resolveGatewayBindMode, resolveGatewayEffectiveHost } from "../config/gateway-bind.js";
|
|
3
4
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
@@ -10,10 +11,12 @@ import { restartGatewayProcessWithFreshPid } from "./respawn.js";
|
|
|
10
11
|
import { GatewayService } from "./service.js";
|
|
11
12
|
import { createHonoApp } from "./hono/app.js";
|
|
12
13
|
import { GatewayServer } from "./server.js";
|
|
13
|
-
import { GatewayLockError, acquireGatewayLock } from "./lock.js";
|
|
14
14
|
import { runGatewayLoop } from "./run-loop.js";
|
|
15
15
|
import { checkPortAvailable, forceFreePortAndWait, listPortListeners, parseLsofOutput } from "./ports.js";
|
|
16
16
|
import { apiError, apiOk } from "./protocol.js";
|
|
17
17
|
import "./hono/index.js";
|
|
18
18
|
import { assertSecureGatewayHttpUrl, assertSecureWebSocketUrl, isInsecurePrivateWsAllowed, isSecureWebSocketUrl } from "./ws-security.js";
|
|
19
|
+
//#region src/gateway/index.ts
|
|
20
|
+
init_lock();
|
|
21
|
+
//#endregion
|
|
19
22
|
export { GatewayLockError, GatewayServer, GatewayService, acquireGatewayLock, apiError, apiOk, assertGatewayAuthConfigured, assertGatewayRuntimeConfig, assertSecureGatewayHttpUrl, assertSecureWebSocketUrl, buckets, buildDefaultCorsOrigins, checkPortAvailable, createHonoApp, defaultGatewayBindMode, extractToken, forceFreePortAndWait, isAllInterfacesHost, isContainerEnvironment, isGatewayStrictSecurityEnabled, isInsecurePrivateWsAllowed, isLoopbackHost, isSecureWebSocketUrl, listPortListeners, parseLsofOutput, resolveEffectiveGatewayPort, resolveGatewayAuth, resolveGatewayBindHost, resolveGatewayBindHostSync, resolveGatewayBindMode, resolveGatewayEffectiveHost, resolveGatewayListenHost, resolveGatewayListenPlan, resolveGatewayServiceListenPort, restartGatewayProcessWithFreshPid, runGatewayLoop, validateToken };
|
|
@@ -16,4 +16,6 @@ export declare class GatewayLockError extends Error {
|
|
|
16
16
|
readonly cause?: unknown;
|
|
17
17
|
constructor(message: string, cause?: unknown);
|
|
18
18
|
}
|
|
19
|
+
export declare function resolveGatewayLockPath(configPath: string): string;
|
|
20
|
+
export declare function isGatewayConfigLockedByAnotherProcessSync(configPath: string, currentPid?: number): boolean;
|
|
19
21
|
export declare function acquireGatewayLock(configPath: string, opts?: GatewayLockOptions): Promise<GatewayLockHandle>;
|
package/dist/src/gateway/lock.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
1
2
|
import path from "node:path";
|
|
2
3
|
import fs from "node:fs";
|
|
3
4
|
import { createHash } from "node:crypto";
|
|
@@ -8,24 +9,25 @@ import { homedir } from "os";
|
|
|
8
9
|
/**
|
|
9
10
|
* Gateway Lock - Prevents multiple gateway instances from running simultaneously
|
|
10
11
|
*/
|
|
11
|
-
const DEFAULT_TIMEOUT_MS = 5e3;
|
|
12
|
-
const DEFAULT_POLL_INTERVAL_MS = 100;
|
|
13
|
-
const DEFAULT_STALE_MS = 3e4;
|
|
14
|
-
const DEFAULT_PORT_PROBE_TIMEOUT_MS = 1e3;
|
|
15
|
-
var GatewayLockError = class extends Error {
|
|
16
|
-
constructor(message, cause) {
|
|
17
|
-
super(message);
|
|
18
|
-
this.cause = cause;
|
|
19
|
-
this.name = "GatewayLockError";
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
12
|
function resolveLockDir() {
|
|
23
13
|
return path.join(homedir(), ".xopc", "locks");
|
|
24
14
|
}
|
|
25
|
-
function
|
|
15
|
+
function resolveGatewayLockPath(configPath) {
|
|
26
16
|
const hash = createHash("sha256").update(configPath).digest("hex").slice(0, 8);
|
|
27
17
|
return path.join(resolveLockDir(), `gateway.${hash}.lock`);
|
|
28
18
|
}
|
|
19
|
+
function isGatewayConfigLockedByAnotherProcessSync(configPath, currentPid = process.pid) {
|
|
20
|
+
const lockPath = resolveGatewayLockPath(configPath);
|
|
21
|
+
try {
|
|
22
|
+
const parsed = JSON.parse(fs.readFileSync(lockPath, "utf8"));
|
|
23
|
+
if (typeof parsed.pid !== "number" || parsed.pid === currentPid || parsed.configPath !== configPath) return false;
|
|
24
|
+
if (!isPidAlive(parsed.pid)) return false;
|
|
25
|
+
if (process.platform !== "linux" || !Number.isFinite(parsed.startTime)) return true;
|
|
26
|
+
return readLinuxStartTime(parsed.pid) === parsed.startTime;
|
|
27
|
+
} catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
29
31
|
async function checkPortFree(port, host = "127.0.0.1") {
|
|
30
32
|
return new Promise((resolve) => {
|
|
31
33
|
const socket = net.createConnection({
|
|
@@ -104,7 +106,7 @@ async function acquireGatewayLock(configPath, opts = {}) {
|
|
|
104
106
|
const pollIntervalMs = opts.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
105
107
|
const staleMs = opts.staleMs ?? DEFAULT_STALE_MS;
|
|
106
108
|
const port = opts.port;
|
|
107
|
-
const lockPath =
|
|
109
|
+
const lockPath = resolveGatewayLockPath(configPath);
|
|
108
110
|
await fs$1.mkdir(path.dirname(lockPath), { recursive: true });
|
|
109
111
|
const startedAt = Date.now();
|
|
110
112
|
let lastPayload = null;
|
|
@@ -160,5 +162,20 @@ async function acquireGatewayLock(configPath, opts = {}) {
|
|
|
160
162
|
}
|
|
161
163
|
throw new GatewayLockError(`Gateway already running${lastPayload?.pid ? ` (pid ${lastPayload.pid})` : ""}; lock timeout after ${timeoutMs}ms`);
|
|
162
164
|
}
|
|
165
|
+
var DEFAULT_TIMEOUT_MS, DEFAULT_POLL_INTERVAL_MS, DEFAULT_STALE_MS, DEFAULT_PORT_PROBE_TIMEOUT_MS, GatewayLockError;
|
|
166
|
+
var init_lock = __esmMin((() => {
|
|
167
|
+
DEFAULT_TIMEOUT_MS = 5e3;
|
|
168
|
+
DEFAULT_POLL_INTERVAL_MS = 100;
|
|
169
|
+
DEFAULT_STALE_MS = 3e4;
|
|
170
|
+
DEFAULT_PORT_PROBE_TIMEOUT_MS = 1e3;
|
|
171
|
+
GatewayLockError = class extends Error {
|
|
172
|
+
constructor(message, cause) {
|
|
173
|
+
super(message);
|
|
174
|
+
this.cause = cause;
|
|
175
|
+
this.name = "GatewayLockError";
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
}));
|
|
163
179
|
//#endregion
|
|
164
|
-
|
|
180
|
+
init_lock();
|
|
181
|
+
export { GatewayLockError, acquireGatewayLock, init_lock, isGatewayConfigLockedByAnotherProcessSync, resolveGatewayLockPath };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { acquireGatewayLock, init_lock } from "./lock.js";
|
|
1
2
|
import { loadConfig } from "../config/loader.js";
|
|
2
3
|
import "../config/index.js";
|
|
3
4
|
import { isRestartEnabled } from "../config/commands.flags.js";
|
|
4
5
|
import { runBootstrapMigrationsSync } from "../migrations/runner.js";
|
|
5
6
|
import { restartGatewayProcessWithFreshPid } from "./respawn.js";
|
|
6
|
-
import { acquireGatewayLock } from "./lock.js";
|
|
7
7
|
import { consumeGatewayRestartIntentSync, consumeGatewaySigusr1RestartAuthorization, isGatewaySigusr1RestartExternallyAllowed, resetGatewayRestartStateForInProcessRestart, scheduleGatewaySigusr1Restart, setGatewaySigusr1RestartPolicy } from "../infra/restart.js";
|
|
8
8
|
//#region src/gateway/run-loop.ts
|
|
9
9
|
/**
|
|
10
10
|
* Gateway Run Loop - Core run loop for gateway process management
|
|
11
11
|
*/
|
|
12
|
+
init_lock();
|
|
12
13
|
async function runGatewayLoop(opts) {
|
|
13
14
|
runBootstrapMigrationsSync(opts.configPath);
|
|
14
15
|
setGatewaySigusr1RestartPolicy({ allowExternal: isRestartEnabled(loadConfig(opts.configPath)) });
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export type GatewayScope
|
|
3
|
-
export declare const DEFAULT_MOBILE_SCOPES: readonly GatewayScope[];
|
|
4
|
-
export declare const DEFAULT_BROWSER_EXTENSION_SCOPES: readonly GatewayScope[];
|
|
5
|
-
export declare function isGatewayScope(value: unknown): value is GatewayScope;
|
|
1
|
+
import { DEFAULT_BROWSER_EXTENSION_SCOPES, DEFAULT_MOBILE_SCOPES, GATEWAY_SCOPES, isGatewayScope, type GatewayScope } from '@xopcai/gateway-contract';
|
|
2
|
+
export { DEFAULT_BROWSER_EXTENSION_SCOPES, DEFAULT_MOBILE_SCOPES, GATEWAY_SCOPES, isGatewayScope, type GatewayScope, };
|
|
6
3
|
export declare function parseGatewayScopes(value: string): GatewayScope[];
|
|
7
4
|
export declare function requiredGatewayScope(method: string, path: string): GatewayScope;
|
|
8
5
|
export declare function hasGatewayScope(granted: readonly GatewayScope[], required: GatewayScope): boolean;
|
|
@@ -1,49 +1,7 @@
|
|
|
1
|
+
import { DEFAULT_BROWSER_EXTENSION_SCOPES, DEFAULT_MOBILE_SCOPES, GATEWAY_SCOPES, isGatewayScope } from "../../../packages/gateway-contract/src/gateway-scopes.js";
|
|
2
|
+
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
1
3
|
//#region src/gateway/security/gateway-scopes.ts
|
|
2
|
-
|
|
3
|
-
"voice.configure",
|
|
4
|
-
"gateway.status",
|
|
5
|
-
"agents.read",
|
|
6
|
-
"agents.run",
|
|
7
|
-
"sessions.read",
|
|
8
|
-
"sessions.write",
|
|
9
|
-
"workspace.read",
|
|
10
|
-
"workspace.write",
|
|
11
|
-
"tasks.read",
|
|
12
|
-
"tasks.write",
|
|
13
|
-
"automations.read",
|
|
14
|
-
"automations.write",
|
|
15
|
-
"notifications.self",
|
|
16
|
-
"device.self",
|
|
17
|
-
"gateway.admin"
|
|
18
|
-
];
|
|
19
|
-
const KNOWN_GATEWAY_SCOPES = new Set(GATEWAY_SCOPES);
|
|
20
|
-
const DEFAULT_MOBILE_SCOPES = [
|
|
21
|
-
"voice.configure",
|
|
22
|
-
"gateway.status",
|
|
23
|
-
"agents.read",
|
|
24
|
-
"agents.run",
|
|
25
|
-
"sessions.read",
|
|
26
|
-
"sessions.write",
|
|
27
|
-
"workspace.read",
|
|
28
|
-
"workspace.write",
|
|
29
|
-
"tasks.read",
|
|
30
|
-
"tasks.write",
|
|
31
|
-
"automations.read",
|
|
32
|
-
"automations.write",
|
|
33
|
-
"notifications.self",
|
|
34
|
-
"device.self"
|
|
35
|
-
];
|
|
36
|
-
const DEFAULT_BROWSER_EXTENSION_SCOPES = [
|
|
37
|
-
"gateway.status",
|
|
38
|
-
"agents.read",
|
|
39
|
-
"agents.run",
|
|
40
|
-
"sessions.read",
|
|
41
|
-
"sessions.write",
|
|
42
|
-
"device.self"
|
|
43
|
-
];
|
|
44
|
-
function isGatewayScope(value) {
|
|
45
|
-
return typeof value === "string" && KNOWN_GATEWAY_SCOPES.has(value);
|
|
46
|
-
}
|
|
4
|
+
init_src();
|
|
47
5
|
function parseGatewayScopes(value) {
|
|
48
6
|
const parsed = JSON.parse(value);
|
|
49
7
|
if (!Array.isArray(parsed) || !parsed.every(isGatewayScope)) throw new Error("Stored device scopes are invalid");
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { DEFAULT_MOBILE_SCOPES, GATEWAY_SCOPES,
|
|
1
|
+
import { DEFAULT_MOBILE_SCOPES, GATEWAY_SCOPES, isGatewayScope } from "../../../packages/gateway-contract/src/gateway-scopes.js";
|
|
2
|
+
import { hasGatewayScope, parseGatewayScopes, requiredGatewayScope } from "./gateway-scopes.js";
|
|
2
3
|
import { safeEqualSecret } from "./secret-equal.js";
|
|
3
4
|
import { KNOWN_WEAK_GATEWAY_TOKEN_PLACEHOLDERS, assertGatewayAuthNotKnownWeak } from "./known-weak-secrets.js";
|
|
4
5
|
import { auditGatewayConfig, collectGatewayConfigFindings, collectGatewaySecurityFindings, collectGatewayStartupGuardFindings } from "./audit.js";
|
|
@@ -51,6 +51,7 @@ import { ExtensionLoader } from "../extensions/loader.js";
|
|
|
51
51
|
import "../extensions/index.js";
|
|
52
52
|
import { MessageBus, MessageBusShutdownError } from "../infra/bus/queue.js";
|
|
53
53
|
import "../infra/bus/index.js";
|
|
54
|
+
import { collectMediaUrisFromMessages, deleteMediaUris } from "../media/session-references.js";
|
|
54
55
|
import { AgentService } from "../agent/service.js";
|
|
55
56
|
import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
|
|
56
57
|
import { setPairingBroadcastSink } from "../channels/pairing/pairing-events.js";
|
|
@@ -58,6 +59,12 @@ import { registerClarificationChannelRuntime } from "./clarify-runtime.js";
|
|
|
58
59
|
import { ChannelManager } from "../channels/manager.js";
|
|
59
60
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
60
61
|
import "../config/index.js";
|
|
62
|
+
import { DiscussionService } from "../discussions/service.js";
|
|
63
|
+
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
64
|
+
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
65
|
+
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
66
|
+
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
67
|
+
import "../discussions/index.js";
|
|
61
68
|
import { ManagedComposioEventPoller } from "../connectors/composio-managed-events.js";
|
|
62
69
|
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
63
70
|
import "../knowledge/index.js";
|
|
@@ -65,12 +72,6 @@ import { ConnectionRecoveryService } from "../connectors/connection-recovery-ser
|
|
|
65
72
|
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
66
73
|
import { ConnectedSourceChangePublisher } from "../connectors/source-change-publisher.js";
|
|
67
74
|
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
68
|
-
import { DiscussionService } from "../discussions/service.js";
|
|
69
|
-
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
70
|
-
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
71
|
-
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
72
|
-
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
73
|
-
import "../discussions/index.js";
|
|
74
75
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
75
76
|
import "../endpoint-tools/index.js";
|
|
76
77
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
@@ -106,7 +107,6 @@ import { assertGatewayRuntimeConfig } from "./runtime-config.js";
|
|
|
106
107
|
import { auditGatewayConfig } from "./security/audit.js";
|
|
107
108
|
import { getXopcCloudCatalogCoordinator } from "../providers/xopc-cloud-catalog-coordinator.js";
|
|
108
109
|
import { ModelCatalogSyncService } from "../providers/model-catalog-sync-service.js";
|
|
109
|
-
import { collectMediaUrisFromMessages, deleteMediaUris } from "../media/session-references.js";
|
|
110
110
|
import { runBootstrapMigrationsSync } from "../migrations/runner.js";
|
|
111
111
|
import { NotificationService } from "../notifications/service.js";
|
|
112
112
|
import { LocalAppService } from "../local-apps/service.js";
|
|
@@ -882,6 +882,7 @@ var GatewayService = class {
|
|
|
882
882
|
if (!this.extensionLoader) return;
|
|
883
883
|
try {
|
|
884
884
|
await this.extensionLoader.loadByActivationPlan({ phase: "startup" });
|
|
885
|
+
await this.extensionLoader.startServices();
|
|
885
886
|
this.registerExtensionChannelPlugins();
|
|
886
887
|
const reg = this.extensionLoader.getRegistry();
|
|
887
888
|
log.debug({
|
|
@@ -915,6 +916,7 @@ var GatewayService = class {
|
|
|
915
916
|
config: {}
|
|
916
917
|
};
|
|
917
918
|
await this.extensionLoader.loadExtension(extensionConfig);
|
|
919
|
+
await this.extensionLoader.startServices();
|
|
918
920
|
this.registerExtensionChannelPlugins();
|
|
919
921
|
if (!this.channelManager.getPlugin(channelId)) return;
|
|
920
922
|
await this.channelManager.initializeChannel(channelId);
|
|
@@ -924,6 +926,7 @@ var GatewayService = class {
|
|
|
924
926
|
if (!this.extensionLoader) return;
|
|
925
927
|
try {
|
|
926
928
|
await this.extensionLoader.loadByActivationPlan({ phase: "deferred" });
|
|
929
|
+
await this.extensionLoader.startServices();
|
|
927
930
|
this.registerExtensionChannelPlugins();
|
|
928
931
|
log.debug("Deferred-phase extensions loaded");
|
|
929
932
|
} catch (err) {
|
|
@@ -1311,6 +1314,7 @@ var GatewayService = class {
|
|
|
1311
1314
|
this.lastChannelConnectDeferMode = "auto";
|
|
1312
1315
|
this.lastChannelConnectDeferSource = "off";
|
|
1313
1316
|
await this.channelManager.stop();
|
|
1317
|
+
await this.extensionLoader?.shutdown();
|
|
1314
1318
|
await this.automationService.stop();
|
|
1315
1319
|
this.stopAutomationProductEventBridge?.();
|
|
1316
1320
|
this.stopAutomationProductEventBridge = null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, shouldSilence, stripHeartbeatToken } from "./tokens.js";
|
|
2
|
-
import { appendCronEventLines } from "./event-prompt.js";
|
|
3
2
|
import { isWithinActiveHours } from "./active-hours.js";
|
|
4
3
|
import { isHeartbeatContentEmpty } from "./content-check.js";
|
|
4
|
+
import { appendCronEventLines } from "./event-prompt.js";
|
|
5
5
|
import { createHeartbeatWake } from "./wake.js";
|
|
6
6
|
export { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, appendCronEventLines, createHeartbeatWake, isHeartbeatContentEmpty, isWithinActiveHours, shouldSilence, stripHeartbeatToken };
|
|
@@ -23,7 +23,7 @@ export declare class ImportService {
|
|
|
23
23
|
}>): import("./types.js").ImportPlan;
|
|
24
24
|
describeSkills(scan: ImportScan, target: ImportTarget): {
|
|
25
25
|
candidate: import("./types.js").ImportCandidate;
|
|
26
|
-
status:
|
|
26
|
+
status: "ready" | "blocked" | "conflict" | "existing";
|
|
27
27
|
reason: string;
|
|
28
28
|
targetName: string;
|
|
29
29
|
}[];
|
|
@@ -93,7 +93,21 @@ async function scanProduct(service, source, owner = "gateway-owner") {
|
|
|
93
93
|
});
|
|
94
94
|
for (const candidate of relevant.candidates) {
|
|
95
95
|
if (candidate.kind === "mcp") {
|
|
96
|
-
inventory.
|
|
96
|
+
inventory.candidates.push({
|
|
97
|
+
id: candidate.id,
|
|
98
|
+
kind: "connection",
|
|
99
|
+
parentId: parent?.id,
|
|
100
|
+
name: candidate.name,
|
|
101
|
+
description: candidate.description,
|
|
102
|
+
displayPath: candidate.location,
|
|
103
|
+
location: candidate.location,
|
|
104
|
+
scope: candidate.scope,
|
|
105
|
+
status: candidate.compatibility === "needs_setup" ? "requires_setup" : "blocked",
|
|
106
|
+
reason: candidate.findings.join("; ") || void 0,
|
|
107
|
+
suggested: false,
|
|
108
|
+
candidate,
|
|
109
|
+
scanId: scan.id
|
|
110
|
+
});
|
|
97
111
|
continue;
|
|
98
112
|
}
|
|
99
113
|
const item = {
|
|
@@ -192,7 +206,7 @@ function previewInventoryItem(service, owner, inventoryId, itemId) {
|
|
|
192
206
|
text: item.reason ?? "",
|
|
193
207
|
truncated: false
|
|
194
208
|
};
|
|
195
|
-
const text = item.kind === "context" ? item.candidate?.content ?? "" : item.kind === "skill" ? Buffer.from(service.readSnapshot(item.scanId, item.id).find((f) => f.path === "SKILL.md").data, "base64").toString("utf8") : item.displayPath;
|
|
209
|
+
const text = item.kind === "context" ? item.candidate?.content ?? "" : item.kind === "skill" ? Buffer.from(service.readSnapshot(item.scanId, item.id).find((f) => f.path === "SKILL.md").data, "base64").toString("utf8") : item.kind === "connection" ? JSON.stringify(item.candidate?.mcp ?? {}, null, 2) : item.displayPath;
|
|
196
210
|
return {
|
|
197
211
|
text: text.slice(0, 2e4),
|
|
198
212
|
truncated: text.length > 2e4
|
|
@@ -30,7 +30,7 @@ function selectedItems(inventory, ids) {
|
|
|
30
30
|
if (!ids.length || new Set(ids).size !== ids.length) throw new ImportError("invalid_selection", "Select at least one item; duplicate selections are not allowed");
|
|
31
31
|
return ids.map((id) => {
|
|
32
32
|
const item = inventory.candidates.find((c) => c.id === id);
|
|
33
|
-
if (!item || item.status === "blocked" || item.status === "existing" && item.kind !== "project") throw new ImportError("invalid_selection", "Select available items from this list");
|
|
33
|
+
if (!item || item.kind === "connection" || item.status === "blocked" || item.status === "requires_setup" || item.status === "existing" && item.kind !== "project") throw new ImportError("invalid_selection", "Select available items from this list");
|
|
34
34
|
if (item.parentId && !ids.includes(item.parentId)) throw new ImportError("missing_parent", "Select the project entry along with its contents");
|
|
35
35
|
return item;
|
|
36
36
|
}).sort((a, b) => Number(b.kind === "project") - Number(a.kind === "project"));
|
|
@@ -55,7 +55,7 @@ async function preflight(service, inventory, items, retry) {
|
|
|
55
55
|
if (digest(readRegularFile(item.location, 128 * 1024).toString("utf8").trim()) !== candidate.hash) stale();
|
|
56
56
|
const projectId = parent ? projects.findByWorkspaceRoot(parent.location)?.id : void 0;
|
|
57
57
|
if ((!parent || projectId) && existingContext(candidate, projectId)) stale();
|
|
58
|
-
} else {
|
|
58
|
+
} else if (item.kind === "skill") {
|
|
59
59
|
if (parent && !service.isWorkspaceTrusted(parent.location)) stale();
|
|
60
60
|
if (fileHash(readTree(item.location)) !== candidate.hash) stale();
|
|
61
61
|
service.readSnapshot(item.scanId, candidate.id);
|
|
@@ -69,7 +69,7 @@ async function preflight(service, inventory, items, retry) {
|
|
|
69
69
|
projectId: parent?.projectId
|
|
70
70
|
});
|
|
71
71
|
if ([...existing.flatMap((e) => [e.name, e.directory]), ...reserved].some((n) => n.toLowerCase() === item.targetName.toLowerCase())) stale();
|
|
72
|
-
}
|
|
72
|
+
} else throw new ImportError("invalid_selection", "Connections must be configured separately");
|
|
73
73
|
} catch (error) {
|
|
74
74
|
if (error instanceof ImportError && error.code === "inventory_stale") throw error;
|
|
75
75
|
stale();
|
|
@@ -115,7 +115,7 @@ async function execute(service, repo, inventory, run) {
|
|
|
115
115
|
entry.status = status === "created" ? "imported" : "existing";
|
|
116
116
|
persist();
|
|
117
117
|
});
|
|
118
|
-
else {
|
|
118
|
+
else if (item.kind === "skill") {
|
|
119
119
|
const key = `${run.id}:${item.id}`;
|
|
120
120
|
let job = service.jobByKey(key);
|
|
121
121
|
if (!job) {
|
|
@@ -143,7 +143,7 @@ async function execute(service, repo, inventory, run) {
|
|
|
143
143
|
if (!["active", "skipped"].includes(published.status)) throw new ImportError("publish_failed", published.error ?? "Could not publish the skill. Retry this item.");
|
|
144
144
|
entry.targetId = join(item.targetRoot, item.targetName);
|
|
145
145
|
entry.status = published.status === "active" ? "imported" : "existing";
|
|
146
|
-
}
|
|
146
|
+
} else throw new ImportError("invalid_selection", "Connections must be configured separately");
|
|
147
147
|
} catch (error) {
|
|
148
148
|
entry.status = "failed";
|
|
149
149
|
delete entry.targetId;
|
|
@@ -70,10 +70,10 @@ export declare class ImportError extends Error {
|
|
|
70
70
|
readonly status: 400 | 403 | 404 | 409 | 413;
|
|
71
71
|
constructor(code: string, message: string, status?: 400 | 403 | 404 | 409 | 413);
|
|
72
72
|
}
|
|
73
|
-
export type InventoryStatus = 'ready' | 'existing' | 'conflict' | 'blocked';
|
|
73
|
+
export type InventoryStatus = 'ready' | 'existing' | 'conflict' | 'requires_setup' | 'blocked';
|
|
74
74
|
export interface InventoryItem {
|
|
75
75
|
id: string;
|
|
76
|
-
kind: 'skill' | 'context' | 'project';
|
|
76
|
+
kind: 'skill' | 'context' | 'project' | 'connection';
|
|
77
77
|
parentId?: string;
|
|
78
78
|
name: string;
|
|
79
79
|
description: string;
|
|
@@ -112,7 +112,7 @@ export interface ImportSelection {
|
|
|
112
112
|
}
|
|
113
113
|
export interface ImportRunItem {
|
|
114
114
|
candidateId: string;
|
|
115
|
-
kind: InventoryItem['kind']
|
|
115
|
+
kind: Exclude<InventoryItem['kind'], 'connection'>;
|
|
116
116
|
name: string;
|
|
117
117
|
status: 'pending' | 'imported' | 'existing' | 'failed';
|
|
118
118
|
targetId?: string;
|