@xopcai/xopc 0.0.396 → 0.0.398
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DwTaeL1e.js → agent-avatar-dicebear-Q-lKLSrc.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CobxTBV_.js +1 -0
- package/dist/gateway/static/root/assets/agents-Bgmmue5K.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-BjGOUrAf.js → agents-admin-api-DvSe10zu.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-B1ApwlFh.js → app-management-settings-panel-CB_W2ano.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Avd_jVji.js → appearance-settings-B-ppSGBm.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-3qUgsGui.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-C26WGbj9.js → archive-plugin-CeQrQ693.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-T3FSuURJ.js → automations-page-Cc9vZanv.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-Bc4c_AEq.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CLaLkM3M.js → binary-plugins-BqaVBv1R.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CB4oRyM5.js → block-editor-B4ij8nZi.js} +40 -40
- package/dist/gateway/static/root/assets/{browser-automation-inputs-0nkk3bLA.js → browser-automation-inputs-DngvcZH9.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-CdqwXyYq.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-CJT0rB-I.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-CTfLd_UE.js → capabilities-glv1DeRI.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-C56VsP0Y.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DZiA8JIq.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-Br5PchG2.js → capability-header-actions-Cu-ATcJq.js} +1 -1
- package/dist/gateway/static/root/assets/capability-links--dcwUjgv.js +1 -0
- package/dist/gateway/static/root/assets/channels-gIjZtYnV.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Cl0hAav9.js → chat-terminal-dock-COdvmTgN.js} +2 -2
- package/dist/gateway/static/root/assets/computer-settings-page-C1XHsuI8.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-AqsoqTnF.js → connector-service-page-Cv2bhnQ5.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-SmKItq0N.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-CyFehuto.js → date-picker-CCnqYwy0.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Vu_5QGGJ.js → dependency-picker-nt5ruIio.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Dw9k0Z2p.js → desktop-pet-Bn8xj1v3.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DKqkhvxu.js → desktop-pet-settings-Cbl1J_VE.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-4l4ESMon.js → device-pairing-wizard-Tadg9co1.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-7svbL2tR.js → directory-picker-path-field-DuE5ez1E.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CFa6PCBV.js → extension-debug-page-jsNxwqNi.js} +1 -1
- package/dist/gateway/static/root/assets/extension-page-N_rBjYX8.js +1 -0
- package/dist/gateway/static/root/assets/extension-settings-page-7qAdvlRB.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-Di9g6pE8.js → gateway-config-swr-DAir1JsW.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-2-o7qk92.js → gateway-realtime-dE0XrVAT.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CPlVuu0d.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-ViqOhx_m.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BCUswcVy.js → gateway-startup-retry-CqyGHM2M.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-DzEeyJpH.js → highlighted-body-KQOG7T2V-XrkWdmrk.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-C_Xn_Kkz.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-Zo56ZmKs.js → image-generation-api-CmHdM2uL.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-C_PPaOFv.js → imports-page-B-dnvHP_.js} +1 -1
- package/dist/gateway/static/root/assets/index-DWzv8ZoO.css +1 -0
- package/dist/gateway/static/root/assets/{index-XRbEWVyZ.js → index-DvKDT-RQ.js} +116 -116
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BGtrzFT6.js → keyboard-shortcuts-settings-mCs9cDgv.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-Cu80fCA0.js → local-app-workbench-page-B7AtlfWQ.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-Zsu8FnwP.js → local-apps-page-CIJE7jME.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-BjwlkAKA.js → local-session-drafts-fhip41-L.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Djl2FW6_.js → locale-store-Jnhw2WMv.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-DlIhfEW_.js → logs-page-HawXUKF2.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-DByEh6rq.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DyO7Q0Ms.js → markdown-view-B58RypQ4.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Ba1_QMmZ.js → media-plugins-B8BLxQgj.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CZjPT7xE.js +1 -0
- package/dist/gateway/static/root/assets/messages-DBvKzlCl.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-hQHB5fCs.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-BEusEk31.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-BqNWtf_f.js → page-context-capture-button-42bq8N6-.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-DPR5gzhf.js +1 -0
- package/dist/gateway/static/root/assets/plugin-details-dialog-D8dKKIY9.js +1 -0
- package/dist/gateway/static/root/assets/plugin-presentation-BrQpVvjC.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-kkbrbiVd.js → preview-open-alternatives-DKyLVLpX.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-Dheqo_4J.js → product-open-page-DcGH0AXN.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-B9Y6dIuh.js → product-preview-content-Ck6OzP09.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BHoQ10Eo.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DYsq_OLJ.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BwR2CiR5.js → registry-api-BbUEMGcj.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CU3EChY0.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-C_VOMhLI.js → runtime-tools-api-D0xtCTXr.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BjyZGNP3.js → runtime-tools-settings-panel-Bfs5zKDg.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DelMOLjg.js → schema-form-BbI2BuSU.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-DbNNQps9.js → session-api-CAKgrbgz.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-DfVviLTK.js → session-manager-D_N7qha7.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-CjB2GOTs.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-jbVx8gcF.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DNWEDA71.js → settings-form-section-BfBBJlr-.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DJ27gC7J.js → settings-page-9yu4SN1j.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DhWB3feW.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-Du4mumVM.js → share-preview-page-B6lQl5xb.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-UJGjdz3F.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-zOxHjU7m.js → skill-api-y2m3k_R4.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Bk9FqsVa.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DLd4O-Fo.js +2 -0
- package/dist/gateway/static/root/assets/{style-DsnKw5jo.js → style-C2ptQg95.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-mz9hWo_H.js → system-settings-panel-DYzcLnVk.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DLGtmHAH.js +2 -0
- package/dist/gateway/static/root/assets/{task-expandable-content-D3i_51Oc.js → task-expandable-content-HdEeV_0-.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-aC-ziRbY.js → tracing-settings-page-DKQYmzFn.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-Ch2Veztk.js → tunnel-api-C2VY_HTy.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-CjzunQtj.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-BLW3t_OK.js → use-autosave-BElgnGMt.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-DsOGCDTR.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DulF6Cm4.js → voice-api-key-field-FVjX0qhn.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-Ceo_hqZC.js → voice-config-api-T3nM4buh.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-bBMZM8tN.js → work-discovery-overlay-B2S2NZuK.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CsxXS1WI.js → workflow-run-setup-panel-2Gq34KQk.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CjeFD3mk.js +6 -0
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-wwIRBFCs.js → xopc-cloud-account-card-BZMIZxWg.js} +1 -1
- package/dist/gateway/static/root/index.html +15 -15
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +8 -0
- package/dist/src/agent/agent-manager.js +3 -3
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/codemode-extension.d.ts +1 -0
- package/dist/src/agent/embedded/codemode-extension.js +6 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +34 -2
- package/dist/src/agent/embedded/session-runner.js +1 -1
- package/dist/src/agent/external-tools/cliProvider.js +2 -2
- package/dist/src/agent/external-tools/composio-provider.js +2 -2
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/mcp/config.d.ts +2 -0
- package/dist/src/agent/mcp/config.js +2 -2
- package/dist/src/agent/mcp/connection-setup.js +13 -1
- package/dist/src/agent/mcp/effective-server.d.ts +3 -0
- package/dist/src/agent/mcp/effective-server.js +27 -0
- package/dist/src/agent/mcp/native-mcp.d.ts +1 -1
- package/dist/src/agent/mcp/native-mcp.js +13 -4
- package/dist/src/agent/mcp/tool-catalog.js +2 -1
- package/dist/src/agent/service/process-direct-streaming.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/skills/index.d.ts +1 -0
- package/dist/src/agent/skills/index.js +7 -3
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/skills/skill-manager.d.ts +1 -0
- package/dist/src/agent/skills/skill-manager.js +6 -1
- package/dist/src/agent/skills/skill-sources.d.ts +1 -0
- package/dist/src/agent/skills/skill-sources.js +4 -3
- package/dist/src/agent/skills/types.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent/workspace-runtime/registry.js +7 -3
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/service/action-executor.js +2 -2
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-agent-plugin.js +92 -7
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension.js +1 -1
- package/dist/src/cli/commands/mcp.js +6 -4
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/config/agent-model-intents.js +1 -1
- package/dist/src/config/agent-profile.js +2 -2
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.js +2 -2
- package/dist/src/extensions/agent-plugins/auth.d.ts +7 -1
- package/dist/src/extensions/agent-plugins/auth.js +53 -12
- package/dist/src/extensions/agent-plugins/branding.d.ts +12 -0
- package/dist/src/extensions/agent-plugins/branding.js +54 -0
- package/dist/src/extensions/agent-plugins/cli-authorization.d.ts +33 -0
- package/dist/src/extensions/agent-plugins/cli-authorization.js +203 -0
- package/dist/src/extensions/agent-plugins/connection-reuse.d.ts +10 -0
- package/dist/src/extensions/agent-plugins/connection-reuse.js +23 -0
- package/dist/src/extensions/agent-plugins/credentials.js +24 -1
- package/dist/src/extensions/agent-plugins/formats.d.ts +27 -0
- package/dist/src/extensions/agent-plugins/formats.js +208 -0
- package/dist/src/extensions/agent-plugins/inventory.d.ts +154 -2
- package/dist/src/extensions/agent-plugins/inventory.js +40 -5
- package/dist/src/extensions/agent-plugins/mcp-adapter.d.ts +2 -1
- package/dist/src/extensions/agent-plugins/mcp-adapter.js +42 -8
- package/dist/src/extensions/agent-plugins/mcp-format.d.ts +2 -0
- package/dist/src/extensions/agent-plugins/mcp-format.js +82 -0
- package/dist/src/extensions/agent-plugins/resources.d.ts +14 -0
- package/dist/src/extensions/agent-plugins/resources.js +112 -0
- package/dist/src/extensions/agent-plugins/setup-contract.d.ts +74 -0
- package/dist/src/extensions/agent-plugins/setup-contract.js +77 -0
- package/dist/src/extensions/agent-plugins/setup.d.ts +127 -0
- package/dist/src/extensions/agent-plugins/setup.js +496 -0
- package/dist/src/extensions/agent-plugins/skill-catalog.d.ts +14 -0
- package/dist/src/extensions/agent-plugins/skill-catalog.js +95 -0
- package/dist/src/extensions/agent-plugins/source-catalog.d.ts +21 -0
- package/dist/src/extensions/agent-plugins/source-catalog.js +175 -0
- package/dist/src/extensions/agent-plugins/sources.d.ts +1 -1
- package/dist/src/extensions/agent-plugins/sources.js +12 -3
- package/dist/src/extensions/agent-plugins/store.d.ts +33 -2
- package/dist/src/extensions/agent-plugins/store.js +175 -25
- package/dist/src/extensions/agent-plugins/user-config.d.ts +5 -0
- package/dist/src/extensions/agent-plugins/user-config.js +49 -0
- package/dist/src/extensions/agent-plugins/validation.d.ts +26 -1
- package/dist/src/extensions/agent-plugins/validation.js +143 -28
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/agent-plugins.js +121 -10
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/composer-history.js +22 -4
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +6 -4
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/service/marketplace-service.js +4 -2
- package/dist/src/gateway/service.js +8 -6
- package/dist/src/gateway/session-context-summary.js +1 -1
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/personal-agent/proactivity/service.js +1 -1
- package/dist/src/personal-agent/service.js +2 -2
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/routing/resolve-route.js +1 -1
- package/dist/src/routing/resolve-tui-session-key.js +1 -1
- package/dist/src/storage/sqlite/composer-input-history-repository.d.ts +4 -3
- package/dist/src/storage/sqlite/composer-input-history-repository.js +10 -8
- package/dist/src/storage/sqlite/migrations/257_session_composer_history.sql +11 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tui/backends/embedded-backend.d.ts +2 -2
- package/dist/src/tui/backends/embedded-backend.js +6 -6
- package/dist/src/tui/backends/gateway-realtime-backend.d.ts +2 -2
- package/dist/src/tui/backends/gateway-realtime-backend.js +7 -4
- package/dist/src/tui/composer-history.d.ts +14 -0
- package/dist/src/tui/composer-history.js +85 -0
- package/dist/src/tui/tui-backend.d.ts +4 -3
- package/dist/src/tui/tui.js +19 -46
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/package.json +12 -4
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D8Q9Cpge.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-C-UKhDkS.js +0 -1
- package/dist/gateway/static/root/assets/agents-DOv68iBN.js +0 -77
- package/dist/gateway/static/root/assets/apps-page-Da6Ar2U3.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-B9r27rPk.js +0 -6
- package/dist/gateway/static/root/assets/browser-automations-page-KLG8IXvl.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-Tcejw5fF.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-BJlw9rhA.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-kEvUR6Yu.js +0 -8
- package/dist/gateway/static/root/assets/channels-DRaE6_ub.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-B6JI2S1b.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-cDRZ8bqm.js +0 -1
- package/dist/gateway/static/root/assets/extension-page-BD4nZ9sf.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-CxPIMrmn.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DQ6-whg-.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-Da2CtQ7c.js +0 -1
- package/dist/gateway/static/root/assets/home-page-Cp4-sTfX.js +0 -2
- package/dist/gateway/static/root/assets/index-zIgp-ZTu.css +0 -1
- package/dist/gateway/static/root/assets/management-settings-CDV-xItG.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-CpK57Kgp.js +0 -1
- package/dist/gateway/static/root/assets/messages-DPxcWxfD.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-BXi6BrXd.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-ClR9R90o.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-CSF-sn8w.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-l5dXxnSq.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-95Od8gLy.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DPEpPFax.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BN0nMm0w.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BvfEKyfy.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BWA_puDN.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-C0ixka9_.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-743oJIiS.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DBYhEjP9.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-Brp2wrEc.js +0 -2
- package/dist/gateway/static/root/assets/usage-page-KfKZ2a3t.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-BSsT8WjA.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-a-mfjQ2h.js +0 -6
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type PluginAuthorization } from './setup-contract.js';
|
|
2
|
+
import type { AgentPluginStore, InstalledAgentPlugin } from './store.js';
|
|
3
|
+
type CliMethod = Extract<PluginAuthorization['methods'][number], {
|
|
4
|
+
type: 'cli';
|
|
5
|
+
}>;
|
|
6
|
+
export type PluginCliAuthorization = {
|
|
7
|
+
id: string;
|
|
8
|
+
state: 'preparing' | 'awaiting_user' | 'connected' | 'error' | 'cancelled';
|
|
9
|
+
expiresAt: number;
|
|
10
|
+
challenge?: {
|
|
11
|
+
type: 'url' | 'qr';
|
|
12
|
+
url: string;
|
|
13
|
+
message?: string;
|
|
14
|
+
};
|
|
15
|
+
error?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function inspectPluginCliAuthorization(store: AgentPluginStore, plugin: InstalledAgentPlugin, authorization: string, method: CliMethod, signal: AbortSignal): Promise<{
|
|
18
|
+
authenticated: boolean;
|
|
19
|
+
issues: {
|
|
20
|
+
id: string;
|
|
21
|
+
title: string;
|
|
22
|
+
scopes: string[];
|
|
23
|
+
instructions: string[];
|
|
24
|
+
method?: string;
|
|
25
|
+
helpUrl?: string;
|
|
26
|
+
}[];
|
|
27
|
+
}>;
|
|
28
|
+
export declare function checkPluginCliAuthorization(store: AgentPluginStore, plugin: InstalledAgentPlugin, authorization: string, method: CliMethod, signal: AbortSignal): Promise<boolean>;
|
|
29
|
+
export declare function startPluginCliAuthorization(store: AgentPluginStore, plugin: InstalledAgentPlugin, authorization: string, method: CliMethod, owner: string): PluginCliAuthorization;
|
|
30
|
+
export declare function getPluginCliAuthorization(id: string, owner: string, revision: string): PluginCliAuthorization | undefined;
|
|
31
|
+
export declare function cancelPluginCliAuthorizations(pluginId: string, owner?: string): void;
|
|
32
|
+
export declare function cancelAllPluginCliAuthorizations(): void;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
2
|
+
import { spawnProcess } from "../../process/run-process.js";
|
|
3
|
+
import { parsePluginAuthorizationCheck, pluginAuthorizations, safeAuthorizationUrl } from "./setup-contract.js";
|
|
4
|
+
import { containedPath, expandPluginVariables, resolvePluginCwd, validatePluginServer } from "./validation.js";
|
|
5
|
+
import { expandUserConfig, readPluginUserConfig } from "./user-config.js";
|
|
6
|
+
import { homedir } from "node:os";
|
|
7
|
+
import { join, resolve } from "node:path";
|
|
8
|
+
import { mkdirSync, readFileSync } from "node:fs";
|
|
9
|
+
import { randomUUID } from "node:crypto";
|
|
10
|
+
//#region src/extensions/agent-plugins/cli-authorization.ts
|
|
11
|
+
init_credentials();
|
|
12
|
+
const attempts = /* @__PURE__ */ new Map();
|
|
13
|
+
async function execute(store, plugin, authorization, command, signal, timeoutMs, onLine) {
|
|
14
|
+
validatePluginServer({
|
|
15
|
+
type: "stdio",
|
|
16
|
+
...command
|
|
17
|
+
}, plugin.rootDir, store.dataDir(plugin.id));
|
|
18
|
+
const data = store.dataDir(plugin.id), home = join(data, "accounts", plugin.receipt.revision, authorization);
|
|
19
|
+
mkdirSync(home, {
|
|
20
|
+
recursive: true,
|
|
21
|
+
mode: 448
|
|
22
|
+
});
|
|
23
|
+
const values = {
|
|
24
|
+
...Object.fromEntries(Object.entries(plugin.layout?.userConfig ?? {}).filter(([, field]) => field.default !== void 0).map(([key, field]) => [key, field.default])),
|
|
25
|
+
...readPluginUserConfig(store, plugin.id, plugin.receipt.revision)
|
|
26
|
+
};
|
|
27
|
+
const expand = (value) => expandUserConfig(expandPluginVariables(value.replace(/\$\{PLUGIN_RESOURCES\}/g, join(data, "resources", plugin.receipt.revision)), plugin.rootDir, data), values);
|
|
28
|
+
const environment = Object.fromEntries([
|
|
29
|
+
"PATH",
|
|
30
|
+
"SystemRoot",
|
|
31
|
+
"WINDIR",
|
|
32
|
+
"TMPDIR",
|
|
33
|
+
"TEMP",
|
|
34
|
+
"TMP",
|
|
35
|
+
"LANG"
|
|
36
|
+
].flatMap((key) => process.env[key] === void 0 ? [] : [[key, process.env[key]]]));
|
|
37
|
+
Object.assign(environment, {
|
|
38
|
+
HOME: home,
|
|
39
|
+
USERPROFILE: home,
|
|
40
|
+
XDG_CONFIG_HOME: join(home, "config"),
|
|
41
|
+
PLUGIN_HOST_HOME: homedir(),
|
|
42
|
+
PLUGIN_ACCOUNT_HOME: home,
|
|
43
|
+
PLUGIN_ROOT: plugin.rootDir,
|
|
44
|
+
PLUGIN_DATA: data,
|
|
45
|
+
PLUGIN_RESOURCES: join(data, "resources", plugin.receipt.revision)
|
|
46
|
+
});
|
|
47
|
+
const resolver = new CredentialResolver({ stateDir: store.stateDir });
|
|
48
|
+
for (const [key, value] of Object.entries(command.env)) {
|
|
49
|
+
const expanded = expand(value);
|
|
50
|
+
if (typeof expanded === "string") environment[key] = expanded;
|
|
51
|
+
else {
|
|
52
|
+
const reference = expanded;
|
|
53
|
+
if (!reference.xopcSecretRef) throw new Error("Invalid login credential reference");
|
|
54
|
+
const secret = await resolver.resolveApiKey(reference.xopcSecretRef.provider);
|
|
55
|
+
if (!secret) throw new Error("Login credential is unavailable");
|
|
56
|
+
environment[key] = reference.xopcSecretRef.prefix + secret;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const program = command.command.startsWith("./") ? containedPath(plugin.rootDir, resolve(plugin.rootDir, command.command)) : command.command.startsWith("${PLUGIN_RESOURCES}/") ? containedPath(data, join(data, "resources", plugin.receipt.revision, command.command.slice(20))) : command.command;
|
|
60
|
+
let pending = "";
|
|
61
|
+
const result = await spawnProcess({
|
|
62
|
+
program,
|
|
63
|
+
args: command.args.map((arg) => {
|
|
64
|
+
const value = expand(arg);
|
|
65
|
+
if (typeof value !== "string") throw new Error("Use environment variables for login secrets");
|
|
66
|
+
return value;
|
|
67
|
+
}),
|
|
68
|
+
cwd: resolvePluginCwd(command.cwd, plugin.rootDir, data),
|
|
69
|
+
env: environment,
|
|
70
|
+
signal,
|
|
71
|
+
timeoutMs,
|
|
72
|
+
maxOutputBytes: 65536,
|
|
73
|
+
terminationPolicy: "tree",
|
|
74
|
+
shell: false,
|
|
75
|
+
onOutput(stream, chunk) {
|
|
76
|
+
if (stream !== "stdout" || !onLine) return;
|
|
77
|
+
pending = (pending + chunk.toString("utf8")).slice(-65536);
|
|
78
|
+
let boundary;
|
|
79
|
+
while ((boundary = pending.indexOf("\n")) >= 0) {
|
|
80
|
+
const line = pending.slice(0, boundary);
|
|
81
|
+
pending = pending.slice(boundary + 1);
|
|
82
|
+
onLine(line);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}).completion;
|
|
86
|
+
if (result.exitCode !== 0 || result.timedOut || result.aborted || result.outputTruncated) throw new Error("CLI login or account check failed. Retry authorization.");
|
|
87
|
+
return result.stdout;
|
|
88
|
+
}
|
|
89
|
+
async function inspectPluginCliAuthorization(store, plugin, authorization, method, signal) {
|
|
90
|
+
try {
|
|
91
|
+
return parsePluginAuthorizationCheck(await execute(store, plugin, authorization, method.check, signal, 15e3), pluginAuthorizations(plugin.manifest).find((value) => value.id === authorization)?.methods.map((value) => value.id) ?? []);
|
|
92
|
+
} catch {
|
|
93
|
+
signal.throwIfAborted();
|
|
94
|
+
return {
|
|
95
|
+
authenticated: false,
|
|
96
|
+
issues: []
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async function checkPluginCliAuthorization(store, plugin, authorization, method, signal) {
|
|
101
|
+
return (await inspectPluginCliAuthorization(store, plugin, authorization, method, signal)).authenticated;
|
|
102
|
+
}
|
|
103
|
+
function startPluginCliAuthorization(store, plugin, authorization, method, owner) {
|
|
104
|
+
for (const [key, attempt] of attempts) if (attempt.view.expiresAt < Date.now()) {
|
|
105
|
+
attempt.controller.abort();
|
|
106
|
+
attempts.delete(key);
|
|
107
|
+
} else if (attempt.pluginId === plugin.id && attempt.authorization === authorization) {
|
|
108
|
+
if (attempt.owner !== owner) throw new Error("Authorization belongs to another principal");
|
|
109
|
+
attempt.controller.abort();
|
|
110
|
+
attempt.view.state = "cancelled";
|
|
111
|
+
}
|
|
112
|
+
const controller = new AbortController();
|
|
113
|
+
const view = {
|
|
114
|
+
id: randomUUID(),
|
|
115
|
+
state: "preparing",
|
|
116
|
+
expiresAt: Date.now() + method.timeoutSeconds * 1e3
|
|
117
|
+
};
|
|
118
|
+
const attempt = {
|
|
119
|
+
owner,
|
|
120
|
+
pluginId: plugin.id,
|
|
121
|
+
revision: plugin.receipt.revision,
|
|
122
|
+
authorization,
|
|
123
|
+
view,
|
|
124
|
+
controller
|
|
125
|
+
};
|
|
126
|
+
attempts.set(view.id, attempt);
|
|
127
|
+
const watcher = setInterval(() => {
|
|
128
|
+
try {
|
|
129
|
+
const current = store.pendingReceipt(plugin.id) ?? store.receipt(plugin.id);
|
|
130
|
+
const job = JSON.parse(readFileSync(join(store.stateDir, "plugin-setup", `${plugin.id}.json`), "utf8"));
|
|
131
|
+
const target = job.authorizations?.find((value) => value.id === authorization);
|
|
132
|
+
if (current?.revision !== plugin.receipt.revision || job.packageRevision !== plugin.receipt.revision || target?.attemptId !== view.id || ["cancelled", "completed"].includes(job.state)) controller.abort();
|
|
133
|
+
} catch {
|
|
134
|
+
controller.abort();
|
|
135
|
+
}
|
|
136
|
+
}, 500);
|
|
137
|
+
watcher.unref();
|
|
138
|
+
(async () => {
|
|
139
|
+
try {
|
|
140
|
+
await execute(store, plugin, authorization, method.login, controller.signal, method.timeoutSeconds * 1e3, (line) => {
|
|
141
|
+
try {
|
|
142
|
+
const value = JSON.parse(line);
|
|
143
|
+
if (value.type === "challenge" && ["qr", "url"].includes(value.kind) && typeof value.url === "string" && value.url.length <= 8192) {
|
|
144
|
+
view.challenge = {
|
|
145
|
+
type: value.kind,
|
|
146
|
+
url: safeAuthorizationUrl(value.url),
|
|
147
|
+
...typeof value.message === "string" && value.message.length <= 300 ? { message: value.message } : {}
|
|
148
|
+
};
|
|
149
|
+
view.state = "awaiting_user";
|
|
150
|
+
}
|
|
151
|
+
} catch {}
|
|
152
|
+
});
|
|
153
|
+
controller.signal.throwIfAborted();
|
|
154
|
+
if ((store.pending(plugin.id) ?? store.get(plugin.id))?.receipt.revision !== plugin.receipt.revision) throw new Error("Plugin revision changed");
|
|
155
|
+
if (!await checkPluginCliAuthorization(store, plugin, authorization, method, controller.signal)) throw new Error("Account verification failed");
|
|
156
|
+
view.state = "connected";
|
|
157
|
+
delete view.challenge;
|
|
158
|
+
} catch {
|
|
159
|
+
view.state = controller.signal.aborted ? "cancelled" : "error";
|
|
160
|
+
view.error = controller.signal.aborted ? "Sign-in cancelled." : "Sign-in or account verification failed. Retry authorization.";
|
|
161
|
+
delete view.challenge;
|
|
162
|
+
} finally {
|
|
163
|
+
clearInterval(watcher);
|
|
164
|
+
}
|
|
165
|
+
})();
|
|
166
|
+
return view;
|
|
167
|
+
}
|
|
168
|
+
function getPluginCliAuthorization(id, owner, revision) {
|
|
169
|
+
const attempt = attempts.get(id);
|
|
170
|
+
if (!attempt) return;
|
|
171
|
+
if (attempt.owner !== owner || attempt.revision !== revision) throw new Error("Authorization does not match this installation");
|
|
172
|
+
if (attempt.view.expiresAt <= Date.now() && ![
|
|
173
|
+
"connected",
|
|
174
|
+
"error",
|
|
175
|
+
"cancelled"
|
|
176
|
+
].includes(attempt.view.state)) {
|
|
177
|
+
attempt.controller.abort();
|
|
178
|
+
attempt.view.state = "error";
|
|
179
|
+
attempt.view.error = "Sign-in expired. Try again.";
|
|
180
|
+
delete attempt.view.challenge;
|
|
181
|
+
}
|
|
182
|
+
return attempt.view;
|
|
183
|
+
}
|
|
184
|
+
function cancelPluginCliAuthorizations(pluginId, owner) {
|
|
185
|
+
for (const attempt of attempts.values()) if (attempt.pluginId === pluginId && (owner === void 0 || attempt.owner === owner)) {
|
|
186
|
+
attempt.controller.abort();
|
|
187
|
+
attempt.view.state = "cancelled";
|
|
188
|
+
delete attempt.view.challenge;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function cancelAllPluginCliAuthorizations() {
|
|
192
|
+
for (const attempt of attempts.values()) {
|
|
193
|
+
attempt.controller.abort();
|
|
194
|
+
if (![
|
|
195
|
+
"connected",
|
|
196
|
+
"error",
|
|
197
|
+
"cancelled"
|
|
198
|
+
].includes(attempt.view.state)) attempt.view.state = "cancelled";
|
|
199
|
+
delete attempt.view.challenge;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
//#endregion
|
|
203
|
+
export { cancelAllPluginCliAuthorizations, cancelPluginCliAuthorizations, checkPluginCliAuthorization, getPluginCliAuthorization, inspectPluginCliAuthorization, startPluginCliAuthorization };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Config } from '../../config/schema.js';
|
|
2
|
+
import type { PluginServer } from './validation.js';
|
|
3
|
+
export interface PluginOAuthReference {
|
|
4
|
+
sourceServerId: string;
|
|
5
|
+
credentialId: string;
|
|
6
|
+
fingerprint: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function connectionFingerprint(server: Record<string, unknown>): string;
|
|
9
|
+
export declare function matchingReusableConnection(target: PluginServer, source: Record<string, unknown>): boolean;
|
|
10
|
+
export declare function validPluginOAuthReference(reference: PluginOAuthReference, config: Config, target?: PluginServer): boolean;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
//#region src/extensions/agent-plugins/connection-reuse.ts
|
|
3
|
+
function connectionFingerprint(server) {
|
|
4
|
+
return createHash("sha256").update(JSON.stringify([
|
|
5
|
+
server.url,
|
|
6
|
+
server.oauth ?? null,
|
|
7
|
+
server.auth ?? null,
|
|
8
|
+
server.headers ?? null,
|
|
9
|
+
server.xopcOAuthCredentialId
|
|
10
|
+
])).digest("hex");
|
|
11
|
+
}
|
|
12
|
+
function settings(value) {
|
|
13
|
+
return JSON.stringify(Object.fromEntries(Object.entries(value && typeof value === "object" ? value : {}).sort(([a], [b]) => a.localeCompare(b))));
|
|
14
|
+
}
|
|
15
|
+
function matchingReusableConnection(target, source) {
|
|
16
|
+
return target.type !== "stdio" && target.connectionAuth?.mode !== "api-key" && source.enabled !== false && source.url === target.url && typeof source.xopcOAuthCredentialId === "string" && /^mcp_draft_[a-f0-9]{32}$/.test(source.xopcOAuthCredentialId) && !source.auth && !Object.keys(source.headers ?? {}).some((key) => key.toLowerCase() === "authorization") && !Object.keys(target.headers ?? {}).some((key) => key.toLowerCase() === "authorization") && settings(source.oauth) === settings(target.oauth);
|
|
17
|
+
}
|
|
18
|
+
function validPluginOAuthReference(reference, config, target) {
|
|
19
|
+
const source = config.mcp?.servers?.[reference.sourceServerId];
|
|
20
|
+
return !!source && (!target || matchingReusableConnection(target, source)) && source.enabled !== false && source.xopcOAuthCredentialId === reference.credentialId && connectionFingerprint(source) === reference.fingerprint;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { connectionFingerprint, matchingReusableConnection, validPluginOAuthReference };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { init_paths_state, resolveStateDir } from "../../config/paths-state.js";
|
|
2
2
|
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
3
|
-
import { pluginName } from "./validation.js";
|
|
3
|
+
import { pluginName, pluginServerId } from "./validation.js";
|
|
4
|
+
import { createNativeMcpCredentials } from "../../agent/mcp/credential-store.js";
|
|
4
5
|
import { pluginCredentialProviderPrefix } from "./auth.js";
|
|
6
|
+
import { pluginOAuthCredentialId } from "./mcp-adapter.js";
|
|
7
|
+
import { getNativePiAgentDir } from "../../agent/mcp/native-mcp.js";
|
|
5
8
|
import { join } from "node:path";
|
|
6
9
|
import { existsSync, rmSync } from "node:fs";
|
|
7
10
|
//#region src/extensions/agent-plugins/credentials.ts
|
|
@@ -9,6 +12,19 @@ init_credentials();
|
|
|
9
12
|
init_paths_state();
|
|
10
13
|
async function removePluginCredentials(store, id) {
|
|
11
14
|
pluginName.parse(id);
|
|
15
|
+
const history = store.history(id);
|
|
16
|
+
if (store.stateDir === resolveStateDir()) {
|
|
17
|
+
getNativePiAgentDir();
|
|
18
|
+
const native = await createNativeMcpCredentials();
|
|
19
|
+
for (const plugin of history) {
|
|
20
|
+
const servers = plugin.receipt.oauthServers ?? Object.fromEntries(Object.entries(plugin.servers).filter(([, server]) => server.type !== "stdio").map(([name, server]) => [name, server.type !== "stdio" ? server.url : ""]));
|
|
21
|
+
for (const [name, url] of Object.entries(servers)) {
|
|
22
|
+
const alias = plugin.receipt.credentialScope === "revision" ? pluginOAuthCredentialId(id, plugin.receipt.revision, name) : pluginServerId(id, name);
|
|
23
|
+
await native.forServer(alias, url).save({ serverUrl: url });
|
|
24
|
+
native.remove(alias, url);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
12
28
|
const dir = join(store.stateDir, "plugin-auth", id);
|
|
13
29
|
const resolver = new CredentialResolver(store.stateDir === resolveStateDir() ? {} : { stateDir: store.stateDir });
|
|
14
30
|
for (const profile of await resolver.listProfiles()) if (profile.provider.startsWith(pluginCredentialProviderPrefix(id))) await resolver.deleteProviderCredential(profile.provider);
|
|
@@ -16,6 +32,13 @@ async function removePluginCredentials(store, id) {
|
|
|
16
32
|
recursive: true,
|
|
17
33
|
force: true
|
|
18
34
|
});
|
|
35
|
+
for (const plugin of history) {
|
|
36
|
+
rmSync(join(store.stateDir, "plugin-config", `${id}-${plugin.receipt.revision}.json`), { force: true });
|
|
37
|
+
rmSync(join(store.dataDir(id), "accounts", plugin.receipt.revision), {
|
|
38
|
+
recursive: true,
|
|
39
|
+
force: true
|
|
40
|
+
});
|
|
41
|
+
}
|
|
19
42
|
}
|
|
20
43
|
//#endregion
|
|
21
44
|
export { removePluginCredentials };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const PLUGIN_MANIFEST_PATHS: readonly ["plugin.json", ".codex-plugin/plugin.json", ".claude-plugin/plugin.json"];
|
|
2
|
+
export type PluginDialect = 'portable' | 'codex' | 'claude';
|
|
3
|
+
export interface CompatibilityItem {
|
|
4
|
+
component: string;
|
|
5
|
+
support: 'supported' | 'needs_adapter' | 'unsupported' | 'invalid';
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
export interface PluginLayout {
|
|
9
|
+
descriptorVersion: 1;
|
|
10
|
+
adapterVersion: 'xopc-plugin-v1';
|
|
11
|
+
dialect: PluginDialect;
|
|
12
|
+
manifest: Record<string, unknown>;
|
|
13
|
+
skillRoots: string[];
|
|
14
|
+
mcpConfigs: unknown[];
|
|
15
|
+
compatibility: CompatibilityItem[];
|
|
16
|
+
userConfig: Record<string, {
|
|
17
|
+
type: 'string' | 'number' | 'boolean';
|
|
18
|
+
title: string;
|
|
19
|
+
required: boolean;
|
|
20
|
+
sensitive: boolean;
|
|
21
|
+
default?: string | number | boolean;
|
|
22
|
+
}>;
|
|
23
|
+
tasks: string[];
|
|
24
|
+
}
|
|
25
|
+
/** Interpret each dialect before applying the common package and execution checks. */
|
|
26
|
+
export declare function readPluginLayout(root: string, read: (path: string) => string, safe: (path: string) => string, importManifest?: Record<string, unknown>): PluginLayout;
|
|
27
|
+
export declare function collectPluginSkillFiles(root: string, safe: (path: string) => string): string[];
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { basename, join } from "node:path";
|
|
2
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
3
|
+
//#region src/extensions/agent-plugins/formats.ts
|
|
4
|
+
const PLUGIN_MANIFEST_PATHS = [
|
|
5
|
+
"plugin.json",
|
|
6
|
+
".codex-plugin/plugin.json",
|
|
7
|
+
".claude-plugin/plugin.json"
|
|
8
|
+
];
|
|
9
|
+
/** Interpret each dialect before applying the common package and execution checks. */
|
|
10
|
+
function readPluginLayout(root, read, safe, importManifest) {
|
|
11
|
+
const has = (path) => existsSync(join(root, path));
|
|
12
|
+
const json = (path) => {
|
|
13
|
+
const value = JSON.parse(read(join(root, path)));
|
|
14
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`Expected an object: ${path}`);
|
|
15
|
+
return value;
|
|
16
|
+
};
|
|
17
|
+
const path = PLUGIN_MANIFEST_PATHS.find(has);
|
|
18
|
+
if (!path && !importManifest) throw new Error("No supported plugin manifest found");
|
|
19
|
+
const dialect = path === "plugin.json" ? "portable" : path?.startsWith(".codex") ? "codex" : "claude";
|
|
20
|
+
const raw = path ? json(path) : importManifest;
|
|
21
|
+
const compatibility = [];
|
|
22
|
+
if (dialect !== "portable" && has(".codex-plugin/plugin.json") && has(".claude-plugin/plugin.json")) compatibility.push({
|
|
23
|
+
component: "manifest:claude",
|
|
24
|
+
support: "unsupported",
|
|
25
|
+
message: "Codex dialect selected; the separate Claude manifest is not applied."
|
|
26
|
+
});
|
|
27
|
+
const object = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
28
|
+
const overlay = dialect === "portable" ? object(object(raw.extensions)["com.openai"] ?? (has(".codex-plugin/plugin.json") ? json(".codex-plugin/plugin.json") : {})) : raw;
|
|
29
|
+
const manifest = dialect === "portable" ? raw : {
|
|
30
|
+
$schema: "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
31
|
+
...Object.fromEntries([
|
|
32
|
+
"name",
|
|
33
|
+
"version",
|
|
34
|
+
"description",
|
|
35
|
+
"homepage",
|
|
36
|
+
"repository",
|
|
37
|
+
"license",
|
|
38
|
+
"keywords",
|
|
39
|
+
"extensions"
|
|
40
|
+
].filter((key) => raw[key] !== void 0).map((key) => [key, raw[key]])),
|
|
41
|
+
...raw.author ? { author: typeof raw.author === "string" ? { name: raw.author } : raw.author } : {}
|
|
42
|
+
};
|
|
43
|
+
const paths = (value, component) => {
|
|
44
|
+
if (value === void 0) return [];
|
|
45
|
+
const values = typeof value === "string" ? [value] : Array.isArray(value) ? value : [];
|
|
46
|
+
if (!values.length || values.some((v) => typeof v !== "string" || !v.startsWith("./"))) {
|
|
47
|
+
compatibility.push({
|
|
48
|
+
component,
|
|
49
|
+
support: "invalid",
|
|
50
|
+
message: "Expected package-relative paths beginning with ./"
|
|
51
|
+
});
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
return values.map((v) => safe(join(root, v)));
|
|
55
|
+
};
|
|
56
|
+
const guarded = (component, fn, fallback) => {
|
|
57
|
+
try {
|
|
58
|
+
return fn();
|
|
59
|
+
} catch (error) {
|
|
60
|
+
compatibility.push({
|
|
61
|
+
component,
|
|
62
|
+
support: "invalid",
|
|
63
|
+
message: error instanceof Error ? error.message : String(error)
|
|
64
|
+
});
|
|
65
|
+
return fallback;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const defaults = has("skills") ? guarded("skills", () => [safe(join(root, "skills"))], []) : [];
|
|
69
|
+
const declared = paths(overlay.skills, "skills");
|
|
70
|
+
const skillRoots = [...new Set(dialect === "portable" ? defaults : dialect === "claude" ? [...defaults, ...declared] : overlay.skills === void 0 ? defaults : declared)];
|
|
71
|
+
const mcpConfigs = [];
|
|
72
|
+
if (dialect === "portable" && has("mcp.json")) {
|
|
73
|
+
const config = guarded("mcp", () => json("mcp.json"), void 0);
|
|
74
|
+
if (config) mcpConfigs.push(config);
|
|
75
|
+
}
|
|
76
|
+
const legacyDefault = has(".mcp.json");
|
|
77
|
+
if (dialect !== "portable" && legacyDefault && (dialect === "claude" || overlay.mcpServers === void 0)) {
|
|
78
|
+
const config = guarded("mcp", () => json(".mcp.json"), void 0);
|
|
79
|
+
if (config) mcpConfigs.push(config);
|
|
80
|
+
}
|
|
81
|
+
if (dialect !== "portable" || !has("mcp.json")) {
|
|
82
|
+
if (overlay.mcpServers !== void 0) for (const item of Array.isArray(overlay.mcpServers) ? overlay.mcpServers : [overlay.mcpServers]) if (typeof item === "string") for (const file of paths(item, "mcp")) {
|
|
83
|
+
const config = guarded("mcp", () => JSON.parse(read(file)), void 0);
|
|
84
|
+
if (config) mcpConfigs.push(config);
|
|
85
|
+
}
|
|
86
|
+
else if (item && typeof item === "object") mcpConfigs.push({ mcpServers: item });
|
|
87
|
+
else compatibility.push({
|
|
88
|
+
component: "mcp",
|
|
89
|
+
support: "invalid",
|
|
90
|
+
message: "Expected an MCP configuration object or package path."
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
for (const [key, conventional] of Object.entries({
|
|
94
|
+
apps: ".app.json",
|
|
95
|
+
hooks: "hooks/hooks.json",
|
|
96
|
+
agents: "agents",
|
|
97
|
+
commands: "commands",
|
|
98
|
+
lspServers: ".lsp.json",
|
|
99
|
+
outputStyles: "output-styles",
|
|
100
|
+
settings: "settings.json",
|
|
101
|
+
workflows: "workflows",
|
|
102
|
+
monitors: "monitors",
|
|
103
|
+
channels: "channels",
|
|
104
|
+
themes: "themes"
|
|
105
|
+
})) if (overlay[key] !== void 0 || has(conventional)) compatibility.push({
|
|
106
|
+
component: key,
|
|
107
|
+
support: key === "apps" ? "needs_adapter" : "unsupported",
|
|
108
|
+
message: key === "apps" ? "Platform application tools require a host capability adapter; accounts are not inherited." : `${key} is not executed by this compatibility version.`
|
|
109
|
+
});
|
|
110
|
+
const userConfig = Object.create(null);
|
|
111
|
+
for (const [key, value] of Object.entries(object(overlay.userConfig))) {
|
|
112
|
+
const field = object(value);
|
|
113
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key) || ![
|
|
114
|
+
"string",
|
|
115
|
+
"number",
|
|
116
|
+
"boolean"
|
|
117
|
+
].includes(String(field.type))) {
|
|
118
|
+
compatibility.push({
|
|
119
|
+
component: `config:${key}`,
|
|
120
|
+
support: "unsupported",
|
|
121
|
+
message: "Unsupported configuration field."
|
|
122
|
+
});
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
userConfig[key] = {
|
|
126
|
+
type: field.type,
|
|
127
|
+
title: String(field.title ?? key),
|
|
128
|
+
required: field.required === true,
|
|
129
|
+
sensitive: field.sensitive === true,
|
|
130
|
+
...[
|
|
131
|
+
"string",
|
|
132
|
+
"number",
|
|
133
|
+
"boolean"
|
|
134
|
+
].includes(typeof field.default) ? { default: field.default } : {}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
const tasks = [object(overlay.interface).defaultPrompt].flat().filter((v) => typeof v === "string");
|
|
138
|
+
if (overlay.onboardingSkill !== void 0) compatibility.push({
|
|
139
|
+
component: "onboardingSkill",
|
|
140
|
+
support: "unsupported",
|
|
141
|
+
message: "Automatic onboarding skill execution is not supported; use the host setup flow."
|
|
142
|
+
});
|
|
143
|
+
const known = new Set([
|
|
144
|
+
"$schema",
|
|
145
|
+
"name",
|
|
146
|
+
"version",
|
|
147
|
+
"description",
|
|
148
|
+
"author",
|
|
149
|
+
"homepage",
|
|
150
|
+
"repository",
|
|
151
|
+
"license",
|
|
152
|
+
"keywords",
|
|
153
|
+
"extensions",
|
|
154
|
+
"displayName",
|
|
155
|
+
"skills",
|
|
156
|
+
"mcpServers",
|
|
157
|
+
"interface",
|
|
158
|
+
"userConfig",
|
|
159
|
+
"onboardingSkill",
|
|
160
|
+
"apps",
|
|
161
|
+
"hooks",
|
|
162
|
+
"agents",
|
|
163
|
+
"commands",
|
|
164
|
+
"lspServers",
|
|
165
|
+
"outputStyles",
|
|
166
|
+
"settings",
|
|
167
|
+
"workflows",
|
|
168
|
+
"monitors",
|
|
169
|
+
"channels",
|
|
170
|
+
"themes"
|
|
171
|
+
]);
|
|
172
|
+
for (const key of Object.keys(overlay)) if (!known.has(key)) compatibility.push({
|
|
173
|
+
component: key,
|
|
174
|
+
support: "unsupported",
|
|
175
|
+
message: "Unrecognized platform declaration."
|
|
176
|
+
});
|
|
177
|
+
return {
|
|
178
|
+
descriptorVersion: 1,
|
|
179
|
+
adapterVersion: "xopc-plugin-v1",
|
|
180
|
+
dialect,
|
|
181
|
+
manifest,
|
|
182
|
+
skillRoots,
|
|
183
|
+
mcpConfigs,
|
|
184
|
+
compatibility,
|
|
185
|
+
userConfig,
|
|
186
|
+
tasks
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function collectPluginSkillFiles(root, safe) {
|
|
190
|
+
const result = [];
|
|
191
|
+
const visit = (path, depth) => {
|
|
192
|
+
const target = safe(path);
|
|
193
|
+
if (depth > 16) throw new Error("Skill directory nesting exceeds limits");
|
|
194
|
+
if (statSync(target).isFile()) {
|
|
195
|
+
if (basename(target) === "SKILL.md") result.push(target);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (existsSync(join(target, "SKILL.md"))) {
|
|
199
|
+
result.push(safe(join(target, "SKILL.md")));
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
for (const name of readdirSync(target).sort()) visit(join(target, name), depth + 1);
|
|
203
|
+
};
|
|
204
|
+
visit(root, 0);
|
|
205
|
+
return result;
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
export { PLUGIN_MANIFEST_PATHS, collectPluginSkillFiles, readPluginLayout };
|