@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,5 +1,6 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { getProviderRegistry, init_plugin_registry } from "../providers/plugin-registry.js";
|
|
3
4
|
import { registerMarketplaceAdapter, unregisterMarketplaceAdapter } from "../agent/skills/marketplace/registry.js";
|
|
4
5
|
import { registerSpeechProvider } from "../voice/tts/speech-registry.js";
|
|
5
6
|
import { HOOK_EXECUTION_MODES } from "./types/hooks.js";
|
|
@@ -12,6 +13,7 @@ import { isAbsolute, resolve } from "path";
|
|
|
12
13
|
import { EventEmitter } from "events";
|
|
13
14
|
//#region src/extensions/api.ts
|
|
14
15
|
init_logger();
|
|
16
|
+
init_plugin_registry();
|
|
15
17
|
var ExtensionApiImpl = class {
|
|
16
18
|
_tools = /* @__PURE__ */ new Map();
|
|
17
19
|
_hooks = /* @__PURE__ */ new Map();
|
|
@@ -25,6 +27,7 @@ var ExtensionApiImpl = class {
|
|
|
25
27
|
_registeredSpeechProviderIds = [];
|
|
26
28
|
_registeredMediaUnderstandingProviderIds = [];
|
|
27
29
|
_registeredMarketplaceAdapterIds = [];
|
|
30
|
+
_providerCleanup = [];
|
|
28
31
|
_manifestCommands = /* @__PURE__ */ new Map();
|
|
29
32
|
constructor(id, name, version, source, config, extensionConfig, _logger, _resolvePath, _coreRegistry, _contracts = {}, runtime) {
|
|
30
33
|
this.id = id;
|
|
@@ -68,15 +71,17 @@ var ExtensionApiImpl = class {
|
|
|
68
71
|
registerHook(event, handler, opts) {
|
|
69
72
|
this._assertContract("hooks", event);
|
|
70
73
|
if (!this._hooks.has(event)) this._hooks.set(event, /* @__PURE__ */ new Set());
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
await handler(...args);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
const hookEvent = event;
|
|
75
|
+
const registeredHandler = opts?.once ? async (...args) => {
|
|
76
|
+
try {
|
|
77
|
+
return await handler(...args);
|
|
78
|
+
} finally {
|
|
79
|
+
this._hooks.get(event)?.delete(registeredHandler);
|
|
80
|
+
this._registry.removeHook(hookEvent, registeredHandler);
|
|
81
|
+
}
|
|
82
|
+
} : handler;
|
|
83
|
+
this._hooks.get(event).add(registeredHandler);
|
|
84
|
+
this._registry.addHook(hookEvent, registeredHandler, this.id, opts?.priority ?? 0);
|
|
80
85
|
this._logger.info(`Registered hook: ${event}`);
|
|
81
86
|
}
|
|
82
87
|
/**
|
|
@@ -89,11 +94,12 @@ var ExtensionApiImpl = class {
|
|
|
89
94
|
* return { systemPrompt: event.systemPrompt };
|
|
90
95
|
* });
|
|
91
96
|
*/
|
|
92
|
-
onHook(hookName, handler,
|
|
97
|
+
onHook(hookName, handler, opts) {
|
|
93
98
|
this._assertContract("hooks", hookName);
|
|
94
99
|
const mode = HOOK_EXECUTION_MODES[hookName];
|
|
95
100
|
if (!this._typedHooks.has(hookName)) this._typedHooks.set(hookName, /* @__PURE__ */ new Set());
|
|
96
101
|
this._typedHooks.get(hookName).add(handler);
|
|
102
|
+
this._registry.addHook(hookName, handler, this.id, opts?.priority ?? 0);
|
|
97
103
|
this._logger.debug(`Registered typed hook: ${hookName} (mode: ${mode})`);
|
|
98
104
|
}
|
|
99
105
|
/**
|
|
@@ -107,14 +113,14 @@ var ExtensionApiImpl = class {
|
|
|
107
113
|
registerChannel(registration) {
|
|
108
114
|
const plugin = registration.plugin;
|
|
109
115
|
this._assertContract("channels", plugin.id);
|
|
110
|
-
this._registry.addChannelPlugin(plugin);
|
|
116
|
+
this._registry.addChannelPlugin(plugin, this.id);
|
|
111
117
|
for (const migration of plugin.migrations ?? []) this.registerMigration(migration);
|
|
112
118
|
this._eventBus.emit("channel:register", plugin);
|
|
113
119
|
this._logger.info(`Registered channel plugin: ${plugin.id}`);
|
|
114
120
|
}
|
|
115
121
|
registerHttpRoute(path, handler) {
|
|
116
122
|
this._assertContract("httpRoutes", path);
|
|
117
|
-
this._registry.addHttpRoute(path, handler);
|
|
123
|
+
this._registry.addHttpRoute(path, handler, this.id);
|
|
118
124
|
this._eventBus.emit("http:route", {
|
|
119
125
|
path,
|
|
120
126
|
handler
|
|
@@ -154,7 +160,7 @@ var ExtensionApiImpl = class {
|
|
|
154
160
|
};
|
|
155
161
|
commandRegistry.register(definition);
|
|
156
162
|
this._registeredCommandIds.push(commandId);
|
|
157
|
-
this._registry.addCommand(command);
|
|
163
|
+
this._registry.addCommand(command, this.id);
|
|
158
164
|
this._eventBus.emit("command:register", command);
|
|
159
165
|
this._logger.info(`Registered chat command: /${command.name}`);
|
|
160
166
|
}
|
|
@@ -200,13 +206,13 @@ var ExtensionApiImpl = class {
|
|
|
200
206
|
}
|
|
201
207
|
registerService(service) {
|
|
202
208
|
this._assertContract("services", service.id);
|
|
203
|
-
this._registry.addService(service);
|
|
209
|
+
this._registry.addService(service, this.id);
|
|
204
210
|
this._eventBus.emit("service:register", service);
|
|
205
211
|
this._logger.info(`Registered service: ${service.id}`);
|
|
206
212
|
}
|
|
207
213
|
registerGatewayMethod(method, handler) {
|
|
208
214
|
this._assertContract("gatewayMethods", method);
|
|
209
|
-
this._registry.addGatewayMethod(method, handler);
|
|
215
|
+
this._registry.addGatewayMethod(method, handler, this.id);
|
|
210
216
|
this._eventBus.emit("gateway:method", {
|
|
211
217
|
method,
|
|
212
218
|
handler
|
|
@@ -244,22 +250,12 @@ var ExtensionApiImpl = class {
|
|
|
244
250
|
*/
|
|
245
251
|
registerProvider(plugin) {
|
|
246
252
|
this._assertContract("providers", plugin.id);
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
this._logger.info(`Extension registered provider: ${plugin.id}`);
|
|
250
|
-
}).catch((err) => {
|
|
251
|
-
this._logger.error(`Failed to register provider: ${err instanceof Error ? err.message : String(err)}`);
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Register a full ProviderPlugin (alias for registerProvider)
|
|
256
|
-
*/
|
|
257
|
-
registerProviderPlugin(plugin) {
|
|
258
|
-
this.registerProvider(plugin);
|
|
253
|
+
this._providerCleanup.push(getProviderRegistry().register(plugin));
|
|
254
|
+
this._logger.info(`Extension registered provider: ${plugin.id}`);
|
|
259
255
|
}
|
|
260
256
|
registerSpeechProvider(plugin) {
|
|
261
257
|
this._assertContract("speechProviders", plugin.id);
|
|
262
|
-
registerSpeechProvider(plugin);
|
|
258
|
+
this._providerCleanup.push(registerSpeechProvider(plugin));
|
|
263
259
|
if (!this._registeredSpeechProviderIds.includes(plugin.id)) this._registeredSpeechProviderIds.push(plugin.id);
|
|
264
260
|
this._logger.info(`Registered speech provider: ${plugin.id}`);
|
|
265
261
|
}
|
|
@@ -269,7 +265,7 @@ var ExtensionApiImpl = class {
|
|
|
269
265
|
}
|
|
270
266
|
registerMediaUnderstandingProvider(plugin) {
|
|
271
267
|
this._assertContract("mediaUnderstandingProviders", plugin.id);
|
|
272
|
-
registerMediaUnderstandingProvider(plugin);
|
|
268
|
+
this._providerCleanup.push(registerMediaUnderstandingProvider(plugin));
|
|
273
269
|
if (!this._registeredMediaUnderstandingProviderIds.includes(plugin.id)) this._registeredMediaUnderstandingProviderIds.push(plugin.id);
|
|
274
270
|
this._logger.info(`Registered media understanding provider: ${plugin.id}`);
|
|
275
271
|
}
|
|
@@ -287,9 +283,6 @@ var ExtensionApiImpl = class {
|
|
|
287
283
|
if (!this._registeredMarketplaceAdapterIds.includes(adapterId)) this._registeredMarketplaceAdapterIds.push(adapterId);
|
|
288
284
|
this._logger.info(`Extension registered marketplace adapter: ${adapterId}`);
|
|
289
285
|
}
|
|
290
|
-
registerFlag(_name, _config) {}
|
|
291
|
-
getFlag(_name) {}
|
|
292
|
-
registerShortcut(_key, _config) {}
|
|
293
286
|
registerTui(register) {
|
|
294
287
|
this._assertContract("tui", this.id);
|
|
295
288
|
this._registry.addTuiRegistration(this.id, register);
|
|
@@ -323,6 +316,7 @@ var ExtensionApiImpl = class {
|
|
|
323
316
|
this._registry.removeReloadRegistration(this.id);
|
|
324
317
|
for (const adapterId of this._registeredMarketplaceAdapterIds) unregisterMarketplaceAdapter(adapterId);
|
|
325
318
|
this._registeredMarketplaceAdapterIds = [];
|
|
319
|
+
for (const cleanup of this._providerCleanup.splice(0).reverse()) cleanup();
|
|
326
320
|
this._typedEventBus.cleanupAll();
|
|
327
321
|
this._eventBus.removeAllListeners();
|
|
328
322
|
this._hooks.clear();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type ExtensionConfigValidationResult = {
|
|
2
|
+
valid: true;
|
|
3
|
+
} | {
|
|
4
|
+
valid: false;
|
|
5
|
+
reason: string;
|
|
6
|
+
errors?: unknown;
|
|
7
|
+
};
|
|
8
|
+
export declare function validateExtensionConfig(schema: Record<string, unknown> | undefined, config: Record<string, unknown>): ExtensionConfigValidationResult;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Ajv from "ajv";
|
|
2
|
+
//#region src/extensions/config-validation.ts
|
|
3
|
+
const validator = new Ajv({
|
|
4
|
+
allErrors: true,
|
|
5
|
+
strict: false
|
|
6
|
+
});
|
|
7
|
+
function validateExtensionConfig(schema, config) {
|
|
8
|
+
if (!schema) return { valid: true };
|
|
9
|
+
try {
|
|
10
|
+
const validate = validator.compile(schema);
|
|
11
|
+
if (validate(config)) return { valid: true };
|
|
12
|
+
return {
|
|
13
|
+
valid: false,
|
|
14
|
+
reason: validator.errorsText(validate.errors, { separator: "; " }),
|
|
15
|
+
errors: validate.errors
|
|
16
|
+
};
|
|
17
|
+
} catch (error) {
|
|
18
|
+
return {
|
|
19
|
+
valid: false,
|
|
20
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { validateExtensionConfig };
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* without going through `loader.ts` (which imports back from `api.ts`,
|
|
4
4
|
* forming a circular cycle).
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* leaf and only depends on the type definitions in `./types/index.js`.
|
|
6
|
+
* This file is a leaf and only depends on the type definitions in `./types/index.js`.
|
|
8
7
|
*/
|
|
9
8
|
import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
10
9
|
import type { ChannelPlugin } from '../channels/plugin-types.js';
|
|
@@ -18,6 +17,13 @@ export declare class ExtensionRegistryImpl implements ExtensionRegistry {
|
|
|
18
17
|
gatewayMethods: Map<string, GatewayMethodHandler>;
|
|
19
18
|
tools: Map<string, AgentTool<any, any>>;
|
|
20
19
|
private toolExtensionIds;
|
|
20
|
+
private hookOwners;
|
|
21
|
+
private hookPriorities;
|
|
22
|
+
private channelOwners;
|
|
23
|
+
private httpRouteOwners;
|
|
24
|
+
private commandOwners;
|
|
25
|
+
private serviceOwners;
|
|
26
|
+
private gatewayMethodOwners;
|
|
21
27
|
channelPlugins: ChannelPlugin[];
|
|
22
28
|
private cliRegistrations;
|
|
23
29
|
private reloadRegistrations;
|
|
@@ -26,17 +32,22 @@ export declare class ExtensionRegistryImpl implements ExtensionRegistry {
|
|
|
26
32
|
addExtension(record: ExtensionRecord): void;
|
|
27
33
|
getExtension(id: string): ExtensionRecord | undefined;
|
|
28
34
|
getEnabledExtensions(): ExtensionRecord[];
|
|
29
|
-
addHook(event: ExtensionHookEvent, handler: ExtensionHookHandler,
|
|
35
|
+
addHook(event: ExtensionHookEvent, handler: ExtensionHookHandler, extensionId: string, priority?: number): void;
|
|
36
|
+
removeHook(event: ExtensionHookEvent, handler: ExtensionHookHandler): void;
|
|
30
37
|
getHooks(event: ExtensionHookEvent): ExtensionHookHandler[];
|
|
31
|
-
addChannelPlugin(plugin: ChannelPlugin): void;
|
|
32
|
-
addHttpRoute(path: string, handler: HttpRequestHandler): void;
|
|
33
|
-
getHttpRoute(path: string): HttpRequestHandler | undefined;
|
|
34
|
-
addCommand(command: ExtensionCommand): void;
|
|
38
|
+
addChannelPlugin(plugin: ChannelPlugin, extensionId?: string): void;
|
|
39
|
+
addHttpRoute(path: string, handler: HttpRequestHandler, extensionId?: string): void;
|
|
40
|
+
getHttpRoute(extensionId: string, path: string): HttpRequestHandler | undefined;
|
|
41
|
+
addCommand(command: ExtensionCommand, extensionId?: string): void;
|
|
35
42
|
getCommand(name: string): ExtensionCommand | undefined;
|
|
36
|
-
addService(service: ExtensionService): void;
|
|
43
|
+
addService(service: ExtensionService, extensionId?: string): void;
|
|
37
44
|
getService(id: string): ExtensionService | undefined;
|
|
38
|
-
addGatewayMethod(method: string, handler: GatewayMethodHandler): void;
|
|
45
|
+
addGatewayMethod(method: string, handler: GatewayMethodHandler, extensionId?: string): void;
|
|
39
46
|
getGatewayMethod(method: string): GatewayMethodHandler | undefined;
|
|
47
|
+
getServicesForExtension(extensionId: string): ExtensionService[];
|
|
48
|
+
removeExtensionContributions(extensionId: string): void;
|
|
49
|
+
private removeOwnedEntries;
|
|
50
|
+
private httpRouteKey;
|
|
40
51
|
addTool(tool: any, extensionId: string): void;
|
|
41
52
|
removeTool(name: string): void;
|
|
42
53
|
getTools(): Map<string, any>;
|
|
@@ -12,6 +12,13 @@ var ExtensionRegistryImpl = class {
|
|
|
12
12
|
gatewayMethods = /* @__PURE__ */ new Map();
|
|
13
13
|
tools = /* @__PURE__ */ new Map();
|
|
14
14
|
toolExtensionIds = /* @__PURE__ */ new Map();
|
|
15
|
+
hookOwners = /* @__PURE__ */ new Map();
|
|
16
|
+
hookPriorities = /* @__PURE__ */ new Map();
|
|
17
|
+
channelOwners = /* @__PURE__ */ new Map();
|
|
18
|
+
httpRouteOwners = /* @__PURE__ */ new Map();
|
|
19
|
+
commandOwners = /* @__PURE__ */ new Map();
|
|
20
|
+
serviceOwners = /* @__PURE__ */ new Map();
|
|
21
|
+
gatewayMethodOwners = /* @__PURE__ */ new Map();
|
|
15
22
|
channelPlugins = [];
|
|
16
23
|
cliRegistrations = [];
|
|
17
24
|
reloadRegistrations = [];
|
|
@@ -26,45 +33,106 @@ var ExtensionRegistryImpl = class {
|
|
|
26
33
|
getEnabledExtensions() {
|
|
27
34
|
return Array.from(this.extensions.values()).filter((p) => p.enabled);
|
|
28
35
|
}
|
|
29
|
-
addHook(event, handler,
|
|
36
|
+
addHook(event, handler, extensionId, priority = 0) {
|
|
30
37
|
if (!this.hooks.has(event)) this.hooks.set(event, []);
|
|
31
|
-
this.
|
|
38
|
+
const owners = this.hookOwners.get(event) ?? /* @__PURE__ */ new Map();
|
|
39
|
+
const priorities = this.hookPriorities.get(event) ?? /* @__PURE__ */ new Map();
|
|
40
|
+
owners.set(handler, extensionId);
|
|
41
|
+
priorities.set(handler, priority);
|
|
42
|
+
this.hookOwners.set(event, owners);
|
|
43
|
+
this.hookPriorities.set(event, priorities);
|
|
44
|
+
const handlers = this.hooks.get(event);
|
|
45
|
+
handlers.push(handler);
|
|
46
|
+
handlers.sort((left, right) => (priorities.get(right) ?? 0) - (priorities.get(left) ?? 0));
|
|
47
|
+
}
|
|
48
|
+
removeHook(event, handler) {
|
|
49
|
+
const handlers = this.hooks.get(event);
|
|
50
|
+
if (!handlers) return;
|
|
51
|
+
const next = handlers.filter((candidate) => candidate !== handler);
|
|
52
|
+
if (next.length > 0) this.hooks.set(event, next);
|
|
53
|
+
else this.hooks.delete(event);
|
|
54
|
+
const owners = this.hookOwners.get(event);
|
|
55
|
+
const priorities = this.hookPriorities.get(event);
|
|
56
|
+
owners?.delete(handler);
|
|
57
|
+
priorities?.delete(handler);
|
|
58
|
+
if (owners?.size === 0) this.hookOwners.delete(event);
|
|
59
|
+
if (priorities?.size === 0) this.hookPriorities.delete(event);
|
|
32
60
|
}
|
|
33
61
|
getHooks(event) {
|
|
34
62
|
return this.hooks.get(event) || [];
|
|
35
63
|
}
|
|
36
|
-
addChannelPlugin(plugin) {
|
|
64
|
+
addChannelPlugin(plugin, extensionId = "") {
|
|
37
65
|
this.channelPlugins = this.channelPlugins.filter((p) => p.id !== plugin.id);
|
|
38
66
|
this.channelPlugins.push(plugin);
|
|
67
|
+
this.channelOwners.set(plugin.id, extensionId);
|
|
39
68
|
}
|
|
40
|
-
addHttpRoute(path, handler) {
|
|
41
|
-
|
|
42
|
-
this.httpRoutes.
|
|
69
|
+
addHttpRoute(path, handler, extensionId = "") {
|
|
70
|
+
const key = this.httpRouteKey(extensionId, path);
|
|
71
|
+
if (this.httpRoutes.has(key)) log.warn({
|
|
72
|
+
extensionId,
|
|
73
|
+
path
|
|
74
|
+
}, `HTTP route already registered, overwriting`);
|
|
75
|
+
this.httpRoutes.set(key, handler);
|
|
76
|
+
this.httpRouteOwners.set(key, extensionId);
|
|
43
77
|
}
|
|
44
|
-
getHttpRoute(path) {
|
|
45
|
-
return this.httpRoutes.get(path);
|
|
78
|
+
getHttpRoute(extensionId, path) {
|
|
79
|
+
return this.httpRoutes.get(this.httpRouteKey(extensionId, path));
|
|
46
80
|
}
|
|
47
|
-
addCommand(command) {
|
|
81
|
+
addCommand(command, extensionId = "") {
|
|
48
82
|
if (this.commands.has(command.name)) log.warn({ command: command.name }, `Command already registered, overwriting`);
|
|
49
83
|
this.commands.set(command.name, command);
|
|
84
|
+
this.commandOwners.set(command.name, extensionId);
|
|
50
85
|
}
|
|
51
86
|
getCommand(name) {
|
|
52
87
|
return this.commands.get(name);
|
|
53
88
|
}
|
|
54
|
-
addService(service) {
|
|
89
|
+
addService(service, extensionId = "") {
|
|
55
90
|
if (this.services.has(service.id)) log.warn({ service: service.id }, `Service already registered, overwriting`);
|
|
56
91
|
this.services.set(service.id, service);
|
|
92
|
+
this.serviceOwners.set(service.id, extensionId);
|
|
57
93
|
}
|
|
58
94
|
getService(id) {
|
|
59
95
|
return this.services.get(id);
|
|
60
96
|
}
|
|
61
|
-
addGatewayMethod(method, handler) {
|
|
97
|
+
addGatewayMethod(method, handler, extensionId = "") {
|
|
62
98
|
if (this.gatewayMethods.has(method)) log.warn({ method }, `Gateway method already registered, overwriting`);
|
|
63
99
|
this.gatewayMethods.set(method, handler);
|
|
100
|
+
this.gatewayMethodOwners.set(method, extensionId);
|
|
64
101
|
}
|
|
65
102
|
getGatewayMethod(method) {
|
|
66
103
|
return this.gatewayMethods.get(method);
|
|
67
104
|
}
|
|
105
|
+
getServicesForExtension(extensionId) {
|
|
106
|
+
return [...this.services.entries()].filter(([id]) => this.serviceOwners.get(id) === extensionId).map(([, service]) => service);
|
|
107
|
+
}
|
|
108
|
+
removeExtensionContributions(extensionId) {
|
|
109
|
+
for (const [event, handlers] of this.hooks) for (const handler of [...handlers]) if (this.hookOwners.get(event)?.get(handler) === extensionId) this.removeHook(event, handler);
|
|
110
|
+
for (const [name, owner] of this.toolExtensionIds) if (owner === extensionId) this.removeTool(name);
|
|
111
|
+
this.channelPlugins = this.channelPlugins.filter((plugin) => {
|
|
112
|
+
const owned = this.channelOwners.get(plugin.id) === extensionId;
|
|
113
|
+
if (owned) this.channelOwners.delete(plugin.id);
|
|
114
|
+
return !owned;
|
|
115
|
+
});
|
|
116
|
+
this.removeOwnedEntries(this.httpRoutes, this.httpRouteOwners, extensionId);
|
|
117
|
+
this.removeOwnedEntries(this.commands, this.commandOwners, extensionId);
|
|
118
|
+
this.removeOwnedEntries(this.services, this.serviceOwners, extensionId);
|
|
119
|
+
this.removeOwnedEntries(this.gatewayMethods, this.gatewayMethodOwners, extensionId);
|
|
120
|
+
this.cliRegistrations = this.cliRegistrations.filter((entry) => entry.extensionId !== extensionId);
|
|
121
|
+
this.reloadRegistrations = this.reloadRegistrations.filter((entry) => entry.extensionId !== extensionId);
|
|
122
|
+
this.migrationRegistrations = this.migrationRegistrations.filter((entry) => entry.extensionId !== extensionId);
|
|
123
|
+
this.tuiRegistrations = this.tuiRegistrations.filter((entry) => entry.extensionId !== extensionId);
|
|
124
|
+
this.extensions.delete(extensionId);
|
|
125
|
+
}
|
|
126
|
+
removeOwnedEntries(values, owners, extensionId) {
|
|
127
|
+
for (const [key, owner] of owners) {
|
|
128
|
+
if (owner !== extensionId) continue;
|
|
129
|
+
owners.delete(key);
|
|
130
|
+
values.delete(key);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
httpRouteKey(extensionId, path) {
|
|
134
|
+
return `${extensionId}:${path.startsWith("/") ? path : `/${path}`}`;
|
|
135
|
+
}
|
|
68
136
|
addTool(tool, extensionId) {
|
|
69
137
|
if (this.tools.has(tool.name)) log.warn({ tool: tool.name }, `Tool already registered, overwriting`);
|
|
70
138
|
this.tools.set(tool.name, tool);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Extension Hook System
|
|
3
3
|
*/
|
|
4
4
|
import type { ExtensionHookEvent, HookAgentContext as HookContext, AgentMessage, BeforeAgentStartContext } from './types/hooks.js';
|
|
5
|
-
import { ExtensionRegistryImpl as ExtensionRegistry } from './
|
|
5
|
+
import { ExtensionRegistryImpl as ExtensionRegistry } from './extension-registry-impl.js';
|
|
6
6
|
export interface HookRunnerOptions {
|
|
7
7
|
catchErrors?: boolean;
|
|
8
8
|
logger?: HookLogger;
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export * from './types/index.js';
|
|
7
7
|
export { ExtensionApiImpl, createExtensionLogger, createPathResolver } from './api.js';
|
|
8
|
-
export { ExtensionRegistryImpl
|
|
8
|
+
export { ExtensionRegistryImpl } from './extension-registry-impl.js';
|
|
9
|
+
export { ExtensionLoader, normalizeExtensionConfig, resolveExtensionPath, areExtensionsGloballyDisabled } from './loader.js';
|
|
9
10
|
export type { ActivationPlanLoadOptions } from './loader.js';
|
|
10
11
|
export type { ExtensionRegistry } from './types/core.js';
|
|
11
12
|
export { ManifestRegistry, type ManifestRegistryEntry } from './manifest-registry.js';
|
|
@@ -8,6 +8,8 @@ export interface StagedExtensionInstall {
|
|
|
8
8
|
}
|
|
9
9
|
/** Extract, validate, install dependencies, and import-check an extension away from its live path. */
|
|
10
10
|
export declare function stageExtensionStoreZip(buffer: Buffer, extensionsDir: string): Promise<StagedExtensionInstall>;
|
|
11
|
+
export declare function stageExtensionNpm(packageSpec: string, extensionsDir: string, timeoutMs?: number): Promise<StagedExtensionInstall>;
|
|
12
|
+
export declare function stageExtensionLocal(localPath: string, extensionsDir: string): Promise<StagedExtensionInstall>;
|
|
11
13
|
/** Move a staged extension into its live path, preserving the previous version for rollback. */
|
|
12
14
|
export declare function commitStagedExtensionInstall(state: StagedExtensionInstall, overwrite: boolean): void;
|
|
13
15
|
/** Restore the previous live extension, or remove a newly committed install. */
|
|
@@ -1,36 +1,47 @@
|
|
|
1
|
-
import { installExtensionFromStoreZip } from "./install.js";
|
|
1
|
+
import { installExtensionFromStoreZip, installFromLocal, installFromNpm } from "./install.js";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { existsSync, mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync } from "node:fs";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
//#region src/extensions/install-transaction.ts
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
async function validateStagedInstall(result, stagingRoot, extensionsDir) {
|
|
7
|
+
if (!result.ok || !result.extensionId || !result.targetDir) throw new Error(result.error ?? "Extension staging failed");
|
|
8
|
+
const manifestPath = join(result.targetDir, "xopc.extension.json");
|
|
9
|
+
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
10
|
+
if (!manifest.main) throw new Error("Extension manifest must declare main");
|
|
11
|
+
const mainUrl = pathToFileURL(join(result.targetDir, manifest.main));
|
|
12
|
+
mainUrl.searchParams.set("xopcInstallCheck", `${Date.now()}-${Math.random()}`);
|
|
13
|
+
await import(mainUrl.href);
|
|
14
|
+
return {
|
|
15
|
+
extensionId: result.extensionId,
|
|
16
|
+
stagingRoot,
|
|
17
|
+
stagedExtensionDir: result.targetDir,
|
|
18
|
+
targetDir: join(extensionsDir, result.extensionId),
|
|
19
|
+
committed: false
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async function stageExtensionInstall(extensionsDir, install) {
|
|
8
23
|
mkdirSync(extensionsDir, { recursive: true });
|
|
9
24
|
const stagingRoot = mkdtempSync(join(extensionsDir, ".xopc-install-"));
|
|
10
25
|
try {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const manifestPath = join(result.targetDir, "xopc.extension.json");
|
|
14
|
-
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
15
|
-
if (!manifest.main) throw new Error("Extension manifest must declare main");
|
|
16
|
-
const mainUrl = pathToFileURL(join(result.targetDir, manifest.main));
|
|
17
|
-
mainUrl.searchParams.set("xopcInstallCheck", `${Date.now()}-${Math.random()}`);
|
|
18
|
-
await import(mainUrl.href);
|
|
19
|
-
return {
|
|
20
|
-
extensionId: result.extensionId,
|
|
21
|
-
stagingRoot,
|
|
22
|
-
stagedExtensionDir: result.targetDir,
|
|
23
|
-
targetDir: join(extensionsDir, result.extensionId),
|
|
24
|
-
committed: false
|
|
25
|
-
};
|
|
26
|
-
} catch (err) {
|
|
26
|
+
return await validateStagedInstall(await install(stagingRoot), stagingRoot, extensionsDir);
|
|
27
|
+
} catch (error) {
|
|
27
28
|
rmSync(stagingRoot, {
|
|
28
29
|
recursive: true,
|
|
29
30
|
force: true
|
|
30
31
|
});
|
|
31
|
-
throw
|
|
32
|
+
throw error;
|
|
32
33
|
}
|
|
33
34
|
}
|
|
35
|
+
/** Extract, validate, install dependencies, and import-check an extension away from its live path. */
|
|
36
|
+
async function stageExtensionStoreZip(buffer, extensionsDir) {
|
|
37
|
+
return stageExtensionInstall(extensionsDir, (stagingRoot) => installExtensionFromStoreZip(buffer, stagingRoot));
|
|
38
|
+
}
|
|
39
|
+
async function stageExtensionNpm(packageSpec, extensionsDir, timeoutMs) {
|
|
40
|
+
return stageExtensionInstall(extensionsDir, (stagingRoot) => installFromNpm(packageSpec, stagingRoot, timeoutMs));
|
|
41
|
+
}
|
|
42
|
+
async function stageExtensionLocal(localPath, extensionsDir) {
|
|
43
|
+
return stageExtensionInstall(extensionsDir, (stagingRoot) => installFromLocal(localPath, stagingRoot));
|
|
44
|
+
}
|
|
34
45
|
/** Move a staged extension into its live path, preserving the previous version for rollback. */
|
|
35
46
|
function commitStagedExtensionInstall(state, overwrite) {
|
|
36
47
|
if (existsSync(state.targetDir)) {
|
|
@@ -71,4 +82,4 @@ function finalizeStagedExtensionInstall(state) {
|
|
|
71
82
|
state.backupDir = void 0;
|
|
72
83
|
}
|
|
73
84
|
//#endregion
|
|
74
|
-
export { commitStagedExtensionInstall, finalizeStagedExtensionInstall, rollbackStagedExtensionInstall, stageExtensionStoreZip };
|
|
85
|
+
export { commitStagedExtensionInstall, finalizeStagedExtensionInstall, rollbackStagedExtensionInstall, stageExtensionLocal, stageExtensionNpm, stageExtensionStoreZip };
|
|
@@ -4,13 +4,14 @@ import { init_logger } from "../utils/logger.js";
|
|
|
4
4
|
import { init_paths, resolveBundledExtensionsDir, resolveExtensionsDir as resolveExtensionsDir$1 } from "../config/paths.js";
|
|
5
5
|
import { MAX_EXTENSION_STORE_ZIP_BYTES } from "./store-zip-limits.js";
|
|
6
6
|
import { checkEngineCompatibility } from "./engine-check.js";
|
|
7
|
+
import { EXTENSION_API_VERSION, EXTENSION_UI_API_VERSION, checkExtensionApiCompatibility } from "./api-version.js";
|
|
7
8
|
import { collectExtensionPackageDependencyIssues } from "./package-contract.js";
|
|
8
9
|
import { execFileSync } from "node:child_process";
|
|
9
10
|
import { dirname, isAbsolute, join, resolve, sep } from "path";
|
|
10
11
|
import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "fs";
|
|
11
12
|
import semver from "semver";
|
|
12
|
-
import AdmZip from "adm-zip";
|
|
13
13
|
import { tmpdir } from "os";
|
|
14
|
+
import AdmZip from "adm-zip";
|
|
14
15
|
//#region src/extensions/install.ts
|
|
15
16
|
/**
|
|
16
17
|
* Extension Installation Module
|
|
@@ -140,6 +141,7 @@ function installExtensionProdDependencies(extensionDir) {
|
|
|
140
141
|
"install",
|
|
141
142
|
"--prod",
|
|
142
143
|
"--no-frozen-lockfile",
|
|
144
|
+
"--package-import-method=copy",
|
|
143
145
|
...scriptArgs
|
|
144
146
|
]);
|
|
145
147
|
if (pnpm.ok) return pnpm;
|
|
@@ -488,6 +490,21 @@ async function installFromDirectory(sourceDir, extensionsDir) {
|
|
|
488
490
|
ok: false,
|
|
489
491
|
error: engineCheck.reason ?? `xopc ${PACKAGE_VERSION} does not satisfy engines.xopc ${manifest.engines.xopc}`
|
|
490
492
|
};
|
|
493
|
+
for (const [engineName, requiredRange, currentVersion] of [[
|
|
494
|
+
"extensionApi",
|
|
495
|
+
manifest.engines.extensionApi,
|
|
496
|
+
EXTENSION_API_VERSION
|
|
497
|
+
], [
|
|
498
|
+
"extensionUiApi",
|
|
499
|
+
manifest.engines.extensionUiApi,
|
|
500
|
+
EXTENSION_UI_API_VERSION
|
|
501
|
+
]]) {
|
|
502
|
+
const result = checkExtensionApiCompatibility(requiredRange, currentVersion, engineName);
|
|
503
|
+
if (result.parseWarning || !result.compatible) return {
|
|
504
|
+
ok: false,
|
|
505
|
+
error: result.reason ?? `Incompatible engines.${engineName}`
|
|
506
|
+
};
|
|
507
|
+
}
|
|
491
508
|
if (!manifest.main) return {
|
|
492
509
|
ok: false,
|
|
493
510
|
error: "Extension manifest must declare main"
|
|
@@ -21,8 +21,8 @@ import { type SlotRegistry } from './slots.js';
|
|
|
21
21
|
import { type ExtensionDiagnostics } from './diagnostics.js';
|
|
22
22
|
export type { ExtensionLoaderOptions, ExtensionSourceOrigin } from './discover-extensions.js';
|
|
23
23
|
export { areExtensionsGloballyDisabled } from './discover-extensions.js';
|
|
24
|
-
export { ExtensionRegistryImpl } from './extension-registry-impl.js';
|
|
25
24
|
import { ExtensionRegistryImpl } from './extension-registry-impl.js';
|
|
25
|
+
export { ExtensionRegistryImpl } from './extension-registry-impl.js';
|
|
26
26
|
export interface ActivationPlanLoadOptions extends Partial<ActivationContext> {
|
|
27
27
|
phase?: ActivationLoadPhase | 'all';
|
|
28
28
|
}
|
|
@@ -30,6 +30,7 @@ export declare class ExtensionLoader {
|
|
|
30
30
|
private registry;
|
|
31
31
|
private options;
|
|
32
32
|
private extensionInstances;
|
|
33
|
+
private startedServiceIds;
|
|
33
34
|
private jiti;
|
|
34
35
|
private _appConfig?;
|
|
35
36
|
private _runtimeContext?;
|
|
@@ -118,6 +119,7 @@ export declare class ExtensionLoader {
|
|
|
118
119
|
* Respects configured preferred plugin from config.extensions.slots
|
|
119
120
|
*/
|
|
120
121
|
private claimExtensionSlots;
|
|
122
|
+
private releaseExtensionSlots;
|
|
121
123
|
loadManifest(extensionPath: string): ExtensionManifest | null;
|
|
122
124
|
private moduleEntryCandidates;
|
|
123
125
|
private loadModule;
|
|
@@ -125,10 +127,8 @@ export declare class ExtensionLoader {
|
|
|
125
127
|
private initializeExtension;
|
|
126
128
|
startServices(): Promise<void>;
|
|
127
129
|
stopServices(): Promise<void>;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
*/
|
|
131
|
-
private validateType;
|
|
130
|
+
unloadExtension(extensionId: string): Promise<boolean>;
|
|
131
|
+
shutdown(): Promise<void>;
|
|
132
132
|
}
|
|
133
133
|
export declare function resolveExtensionPath(id: string, _options: ExtensionLoaderOptions): string | null;
|
|
134
134
|
export declare function normalizeExtensionConfig(rawConfig: Record<string, unknown>): ResolvedExtensionConfig[];
|