dsh-agent-plugins-market 0.9.0 → 0.9.2
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 +64 -154
- package/README.zh.md +74 -164
- package/assets/dsh-agent-plugins.png +0 -0
- package/client/client.js +5371 -1085
- package/client/client.js.map +1 -1
- package/lib/index.js +2 -257
- package/lib/{application → packages/market-bundle/src/application}/catalog.js +207 -41
- package/lib/{application → packages/market-bundle/src/application}/details.js +73 -29
- package/lib/packages/market-bundle/src/application/extension-inventory.js +408 -0
- package/lib/packages/market-bundle/src/application/extension-project.js +64 -0
- package/lib/packages/market-bundle/src/application/resource-inventory.js +96 -0
- package/lib/packages/market-bundle/src/application/server-config.js +9 -0
- package/lib/packages/market-bundle/src/application/suite-queries.js +86 -0
- package/lib/packages/market-bundle/src/index.js +372 -0
- package/lib/{runtime/host → packages/market-bundle/src/platform}/feedback-tool.js +2 -2
- package/lib/{runtime/host → packages/market-bundle/src/platform}/settings-namespace.js +55 -7
- package/lib/packages/market-bundle/src/platform/settings-schema.js +25 -0
- package/lib/packages/market-bundle/src/routes-extension-presets.js +161 -0
- package/lib/packages/market-bundle/src/routes-resources.js +127 -0
- package/lib/{routes.js → packages/market-bundle/src/routes.js} +225 -21
- package/lib/packages/market-bundle/src/runtime-adapters.js +57 -0
- package/lib/packages/market-bundle/src/session-extension.js +337 -0
- package/lib/{application → packages/market-catalog/src/application}/catalog-context.js +7 -4
- package/lib/{application → packages/market-catalog/src/application}/install-store.js +3 -3
- package/lib/{application → packages/market-catalog/src/application}/snapshot-cache.js +100 -11
- package/lib/{application → packages/market-catalog/src/application}/source-store.js +24 -11
- package/lib/{application → packages/market-catalog/src/application}/state/state-store.js +1 -1
- package/lib/{application → packages/market-catalog/src/application}/state/storage-migration.js +1 -1
- package/lib/packages/market-catalog/src/index.js +19 -0
- package/lib/{catalog → packages/market-catalog/src/scanning}/archive.js +1 -1
- package/lib/{catalog → packages/market-catalog/src/scanning}/codex-mcp.js +1 -1
- package/lib/{catalog → packages/market-catalog/src/scanning}/component-files.js +2 -2
- package/lib/{catalog → packages/market-catalog/src/scanning}/manifests.js +2 -2
- package/lib/{catalog → packages/market-catalog/src/scanning}/native-project.js +1 -1
- package/lib/{catalog → packages/market-catalog/src/scanning}/paths.js +1 -1
- package/lib/{catalog → packages/market-catalog/src/scanning}/plugin-variables.js +21 -1
- package/lib/{catalog → packages/market-catalog/src/scanning}/scan-resolvers.js +35 -2
- package/lib/{catalog → packages/market-catalog/src/scanning}/skills-parse.js +40 -10
- package/lib/{catalog → packages/market-catalog/src/scanning}/validate.js +15 -2
- package/lib/packages/market-contracts/src/contracts/extension-presets.js +125 -0
- package/lib/{contracts → packages/market-contracts/src/contracts}/market.js +33 -5
- package/lib/packages/market-contracts/src/contracts/mcp-overrides.js +2 -0
- package/lib/packages/market-contracts/src/contracts/resource-window.js +29 -0
- package/lib/packages/market-contracts/src/contracts/settings.js +130 -0
- package/lib/packages/market-contracts/src/contracts/surface-toggles.js +29 -0
- package/lib/packages/market-contracts/src/contracts/translation.js +28 -0
- package/lib/packages/market-contracts/src/index.js +4 -0
- package/lib/{model → packages/market-contracts/src/model}/layouts.js +11 -0
- package/lib/{application → packages/market-contracts/src/ports}/ports.js +3 -0
- package/lib/{application/mcp/mcp-redaction.js → packages/market-contracts/src/redaction.js} +17 -1
- package/lib/{application → packages/market-lsp/src/application}/lsp/lsp-direct-config.js +2 -2
- package/lib/{application → packages/market-lsp/src/application}/lsp/lsp-server-state.js +1 -1
- package/lib/{application → packages/market-lsp/src/application}/lsp/lsp-status.js +20 -3
- package/lib/{application → packages/market-lsp/src/application}/lsp/profile-seam.js +1 -1
- package/lib/packages/market-lsp/src/application/lsp/validation.js +46 -0
- package/lib/{application → packages/market-lsp/src/application}/lsp-service.js +61 -3
- package/lib/packages/market-lsp/src/index.js +8 -0
- package/lib/{runtime → packages/market-lsp/src/runtime}/lsp/lsp-mounts.js +79 -40
- package/lib/{application → packages/market-mcp/src/application}/mcp/mcp-backend.js +0 -16
- package/lib/{application → packages/market-mcp/src/application}/mcp/mcp-config.js +104 -21
- package/lib/{application → packages/market-mcp/src/application}/mcp/mcp-direct-config.js +12 -4
- package/lib/{application → packages/market-mcp/src/application}/mcp/mcp-overrides.js +4 -4
- package/lib/{application → packages/market-mcp/src/application}/mcp/mcp-status.js +49 -10
- package/lib/packages/market-mcp/src/application/mcp/validation.js +63 -0
- package/lib/{application → packages/market-mcp/src/application}/mcp-service.js +111 -91
- package/lib/packages/market-mcp/src/index.js +10 -0
- package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/bridge.js +12 -9
- package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/connection.js +1 -1
- package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/oauth.js +1 -1
- package/lib/packages/market-mcp/src/runtime/mcp/bridge/tool-ownership.js +26 -0
- package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/tools.js +1 -1
- package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/mcp-auth-record.js +35 -4
- package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/mcp-mounts.js +35 -4
- package/lib/packages/market-runtime/src/adapter-contracts.js +1 -0
- package/lib/packages/market-runtime/src/application/command-resources.js +74 -0
- package/lib/packages/market-runtime/src/application/extension-authorization.js +27 -0
- package/lib/packages/market-runtime/src/application/extension-hook-selection.js +56 -0
- package/lib/packages/market-runtime/src/application/extension-suite-declarations.js +57 -0
- package/lib/packages/market-runtime/src/application/extension-suite-selection.js +84 -0
- package/lib/packages/market-runtime/src/application/fs-probe.js +43 -0
- package/lib/packages/market-runtime/src/application/panel-resources.js +370 -0
- package/lib/{application → packages/market-runtime/src/application}/panels/user-hooks.js +2 -2
- package/lib/{application → packages/market-runtime/src/application}/panels/user-store.js +53 -13
- package/lib/{application → packages/market-runtime/src/application}/project-agent-roles.js +20 -11
- package/lib/packages/market-runtime/src/application/state/extension-presets.js +144 -0
- package/lib/packages/market-runtime/src/application/state/resource-favorites.js +90 -0
- package/lib/packages/market-runtime/src/application/state/resource-filters.js +2 -0
- package/lib/packages/market-runtime/src/application/state/surface-toggles.js +10 -0
- package/lib/packages/market-runtime/src/application/state/workspace-policy.js +56 -0
- package/lib/packages/market-runtime/src/catalog-port.js +1 -0
- package/lib/packages/market-runtime/src/extension-service.js +1 -0
- package/lib/packages/market-runtime/src/index.js +31 -0
- package/lib/{runtime → packages/market-runtime/src/runtime}/agents/agent-role-router.js +74 -79
- package/lib/packages/market-runtime/src/runtime/agents/agent-teams-seat.js +58 -0
- package/lib/{runtime → packages/market-runtime/src/runtime}/agents/subagent-catalog.js +89 -21
- package/lib/packages/market-runtime/src/runtime/agents/team-coordination.js +51 -0
- package/lib/packages/market-runtime/src/runtime/agents/teammate-role-runtime.js +241 -0
- package/lib/packages/market-runtime/src/runtime/agents/teammate-role-tool.js +130 -0
- package/lib/{runtime → packages/market-runtime/src/runtime}/core/reconcile-scheduler.js +2 -2
- package/lib/packages/market-runtime/src/runtime/core/reconciler.js +457 -0
- package/lib/packages/market-runtime/src/runtime/host/command-name-allocator.js +168 -0
- package/lib/packages/market-runtime/src/runtime/host/extension-progress.js +120 -0
- package/lib/packages/market-runtime/src/runtime/host/extension-runtime.js +405 -0
- package/lib/packages/market-runtime/src/runtime/host/extension-session-state.js +839 -0
- package/lib/packages/market-runtime/src/runtime/host/extension-tool-gates.js +96 -0
- package/lib/{runtime → packages/market-runtime/src/runtime}/host/failure-detail.js +1 -1
- package/lib/{runtime → packages/market-runtime/src/runtime}/host/host-locale.js +2 -0
- package/lib/packages/market-runtime/src/runtime/host/menu-row-identities.js +38 -0
- package/lib/packages/market-runtime/src/runtime/host/resource-filter-service.js +81 -0
- package/lib/packages/market-runtime/src/runtime/host/scoped-contributors.js +304 -0
- package/lib/packages/market-runtime/src/runtime/host/surface-toggle-service.js +15 -0
- package/lib/packages/market-runtime/src/runtime/panels/user-commands.js +211 -0
- package/lib/{runtime → packages/market-runtime/src/runtime}/panels/user-panels.js +34 -14
- package/lib/packages/market-runtime/src/runtime/surfaces/commands-mounts.js +256 -0
- package/lib/packages/market-runtime/src/runtime/surfaces/extension-hooks.js +294 -0
- package/lib/packages/market-runtime/src/runtime/surfaces/hook-dry-run.js +122 -0
- package/lib/{runtime → packages/market-runtime/src/runtime}/surfaces/hooks-mounts.js +1 -1
- package/lib/{runtime → packages/market-runtime/src/runtime}/surfaces/project-runtime.js +23 -13
- package/lib/packages/market-runtime/src/runtime/surfaces/skills-provider.js +241 -0
- package/lib/packages/market-translation/src/application/state/translation-cache.js +122 -0
- package/lib/packages/market-translation/src/application/translation/chain.js +99 -0
- package/lib/packages/market-translation/src/application/translation/document.js +384 -0
- package/lib/packages/market-translation/src/application/translation/localizer.js +642 -0
- package/lib/packages/market-translation/src/application/translation/service.js +113 -0
- package/lib/packages/market-translation/src/application/translation/unit.js +19 -0
- package/lib/packages/market-translation/src/index.js +4 -0
- package/lib/packages/market-translation/src/runtime/host/llm-translator.js +278 -0
- package/lib/packages/market-translation/src/runtime/host/machine-translator.js +152 -0
- package/lib/packages/market-translation/src/runtime/host/text-masking.js +96 -0
- package/lib/packages/market-translation/src/runtime/host/translation-providers.js +116 -0
- package/lib/types/index.d.ts +2 -130
- package/lib/types/{application → packages/market-bundle/src/application}/catalog.d.ts +117 -22
- package/lib/types/packages/market-bundle/src/application/details.d.ts +24 -0
- package/lib/types/packages/market-bundle/src/application/extension-inventory.d.ts +45 -0
- package/lib/types/packages/market-bundle/src/application/extension-project.d.ts +26 -0
- package/lib/types/packages/market-bundle/src/application/resource-inventory.d.ts +42 -0
- package/lib/types/packages/market-bundle/src/application/server-config.d.ts +9 -0
- package/lib/types/packages/market-bundle/src/application/suite-queries.d.ts +84 -0
- package/lib/types/packages/market-bundle/src/index.d.ts +125 -0
- package/lib/types/{runtime/host → packages/market-bundle/src/platform}/settings-namespace.d.ts +44 -9
- package/lib/types/{application/mcp/mcp-backend.d.ts → packages/market-bundle/src/platform/settings-schema.d.ts} +13 -28
- package/lib/types/packages/market-bundle/src/routes-extension-presets.d.ts +15 -0
- package/lib/types/packages/market-bundle/src/routes-resources.d.ts +17 -0
- package/lib/types/packages/market-bundle/src/routes.d.ts +32 -0
- package/lib/types/packages/market-bundle/src/runtime-adapters.d.ts +42 -0
- package/lib/types/packages/market-bundle/src/session-extension.d.ts +62 -0
- package/lib/types/{application → packages/market-catalog/src/application}/catalog-context.d.ts +11 -3
- package/lib/types/{application → packages/market-catalog/src/application}/install-store.d.ts +1 -1
- package/lib/types/{application → packages/market-catalog/src/application}/regions.d.ts +1 -1
- package/lib/types/{application → packages/market-catalog/src/application}/snapshot-cache.d.ts +44 -2
- package/lib/types/{application → packages/market-catalog/src/application}/source-store.d.ts +12 -3
- package/lib/types/{application → packages/market-catalog/src/application}/state/state-store.d.ts +1 -1
- package/lib/types/packages/market-catalog/src/index.d.ts +22 -0
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/archive.d.ts +1 -1
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/codex-mcp.d.ts +1 -1
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/component-files.d.ts +1 -1
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/lsp-spec.d.ts +1 -1
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/manifests.d.ts +3 -3
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/native-project.d.ts +2 -2
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/plugin-variables.d.ts +12 -1
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/project-config.d.ts +2 -2
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/project-hooks.d.ts +2 -2
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/scan-pipeline.d.ts +1 -1
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/scan-resolvers.d.ts +3 -3
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/source-catalog.d.ts +1 -1
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/suite-components.d.ts +1 -1
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/suite-scanner.d.ts +1 -1
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/surfaces.d.ts +1 -1
- package/lib/types/{catalog → packages/market-catalog/src/scanning}/validate.d.ts +1 -1
- package/lib/types/packages/market-contracts/src/contracts/extension-presets.d.ts +237 -0
- package/lib/types/{contracts → packages/market-contracts/src/contracts}/market.d.ts +87 -16
- package/lib/types/packages/market-contracts/src/contracts/mcp-overrides.d.ts +39 -0
- package/lib/types/{contracts → packages/market-contracts/src/contracts}/mcp-status.d.ts +9 -0
- package/lib/types/packages/market-contracts/src/contracts/resource-window.d.ts +70 -0
- package/lib/types/packages/market-contracts/src/contracts/settings.d.ts +121 -0
- package/lib/types/packages/market-contracts/src/contracts/surface-toggles.d.ts +28 -0
- package/lib/types/packages/market-contracts/src/contracts/translation.d.ts +81 -0
- package/lib/types/{runtime → packages/market-contracts/src}/host/plugin-message-source.d.ts +1 -1
- package/lib/types/packages/market-contracts/src/index.d.ts +5 -0
- package/lib/types/{model → packages/market-contracts/src/model}/layouts.d.ts +7 -0
- package/lib/types/{model → packages/market-contracts/src/model}/types.d.ts +2 -2
- package/lib/types/packages/market-contracts/src/ports/ports.d.ts +183 -0
- package/lib/types/{application → packages/market-contracts/src/ports}/queries.d.ts +27 -6
- package/lib/types/{application/mcp/mcp-redaction.d.ts → packages/market-contracts/src/redaction.d.ts} +2 -0
- package/lib/types/{application → packages/market-lsp/src/application}/lsp/lsp-direct-config.d.ts +1 -1
- package/lib/types/{application → packages/market-lsp/src/application}/lsp/lsp-status.d.ts +21 -5
- package/lib/types/packages/market-lsp/src/application/lsp/validation.d.ts +8 -0
- package/lib/types/{application → packages/market-lsp/src/application}/lsp-service.d.ts +19 -6
- package/lib/types/packages/market-lsp/src/index.d.ts +8 -0
- package/lib/types/{runtime → packages/market-lsp/src/runtime}/lsp/lsp-mounts.d.ts +26 -6
- package/lib/types/packages/market-mcp/src/application/mcp/mcp-backend.d.ts +28 -0
- package/lib/types/{application → packages/market-mcp/src/application}/mcp/mcp-bridge-config.d.ts +1 -1
- package/lib/types/{application → packages/market-mcp/src/application}/mcp/mcp-config.d.ts +2 -2
- package/lib/types/{application → packages/market-mcp/src/application}/mcp/mcp-direct-config.d.ts +6 -1
- package/lib/types/{application → packages/market-mcp/src/application}/mcp/mcp-overrides.d.ts +4 -38
- package/lib/types/packages/market-mcp/src/application/mcp/mcp-status.d.ts +40 -0
- package/lib/types/{application/server-config.d.ts → packages/market-mcp/src/application/mcp/validation.d.ts} +2 -10
- package/lib/types/{application → packages/market-mcp/src/application}/mcp-service.d.ts +22 -16
- package/lib/types/packages/market-mcp/src/index.d.ts +12 -0
- package/lib/types/packages/market-mcp/src/runtime/mcp/bridge/tool-ownership.d.ts +14 -0
- package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/mcp-auth-record.d.ts +4 -0
- package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/mcp-mounts.d.ts +19 -3
- package/lib/types/packages/market-runtime/src/adapter-contracts.d.ts +89 -0
- package/lib/types/{application → packages/market-runtime/src/application}/agent-roles.d.ts +2 -0
- package/lib/types/packages/market-runtime/src/application/command-resources.d.ts +26 -0
- package/lib/types/packages/market-runtime/src/application/extension-authorization.d.ts +12 -0
- package/lib/types/packages/market-runtime/src/application/extension-hook-selection.d.ts +23 -0
- package/lib/types/packages/market-runtime/src/application/extension-suite-declarations.d.ts +10 -0
- package/lib/types/packages/market-runtime/src/application/extension-suite-selection.d.ts +30 -0
- package/lib/types/packages/market-runtime/src/application/fs-probe.d.ts +12 -0
- package/lib/types/packages/market-runtime/src/application/panel-resources.d.ts +100 -0
- package/lib/types/{application → packages/market-runtime/src/application}/panels/user-hooks.d.ts +1 -1
- package/lib/types/packages/market-runtime/src/application/project-agent-roles.d.ts +10 -0
- package/lib/types/packages/market-runtime/src/application/state/extension-presets.d.ts +24 -0
- package/lib/types/packages/market-runtime/src/application/state/resource-favorites.d.ts +9 -0
- package/lib/types/packages/market-runtime/src/application/state/resource-filters.d.ts +2 -0
- package/lib/types/packages/market-runtime/src/application/state/surface-toggles.d.ts +6 -0
- package/lib/types/packages/market-runtime/src/application/state/workspace-policy.d.ts +19 -0
- package/lib/types/packages/market-runtime/src/catalog-port.d.ts +30 -0
- package/lib/types/packages/market-runtime/src/extension-service.d.ts +14 -0
- package/lib/types/packages/market-runtime/src/index.d.ts +41 -0
- package/lib/types/{runtime → packages/market-runtime/src/runtime}/agents/agent-role-router.d.ts +66 -31
- package/lib/types/packages/market-runtime/src/runtime/agents/agent-teams-seat.d.ts +41 -0
- package/lib/types/{runtime → packages/market-runtime/src/runtime}/agents/subagent-catalog.d.ts +34 -2
- package/lib/types/packages/market-runtime/src/runtime/agents/team-coordination.d.ts +8 -0
- package/lib/types/packages/market-runtime/src/runtime/agents/teammate-role-runtime.d.ts +74 -0
- package/lib/types/packages/market-runtime/src/runtime/agents/teammate-role-tool.d.ts +6 -0
- package/lib/types/{runtime → packages/market-runtime/src/runtime}/core/reconcile-scheduler.d.ts +5 -2
- package/lib/types/packages/market-runtime/src/runtime/core/reconciler.d.ts +141 -0
- package/lib/types/packages/market-runtime/src/runtime/host/command-name-allocator.d.ts +132 -0
- package/lib/types/packages/market-runtime/src/runtime/host/extension-progress.d.ts +91 -0
- package/lib/types/packages/market-runtime/src/runtime/host/extension-runtime.d.ts +77 -0
- package/lib/types/packages/market-runtime/src/runtime/host/extension-session-state.d.ts +242 -0
- package/lib/types/packages/market-runtime/src/runtime/host/extension-tool-gates.d.ts +38 -0
- package/lib/types/{runtime → packages/market-runtime/src/runtime}/host/host-locale.d.ts +1 -1
- package/lib/types/packages/market-runtime/src/runtime/host/menu-row-identities.d.ts +50 -0
- package/lib/types/{runtime → packages/market-runtime/src/runtime}/host/model-catalog.d.ts +1 -1
- package/lib/types/packages/market-runtime/src/runtime/host/resource-filter-service.d.ts +34 -0
- package/lib/types/packages/market-runtime/src/runtime/host/scoped-contributors.d.ts +58 -0
- package/lib/types/packages/market-runtime/src/runtime/host/surface-toggle-service.d.ts +10 -0
- package/lib/types/packages/market-runtime/src/runtime/panels/user-commands.d.ts +74 -0
- package/lib/types/{runtime → packages/market-runtime/src/runtime}/panels/user-panels.d.ts +7 -1
- package/lib/types/packages/market-runtime/src/runtime/surfaces/commands-mounts.d.ts +81 -0
- package/lib/types/packages/market-runtime/src/runtime/surfaces/extension-hooks.d.ts +59 -0
- package/lib/types/packages/market-runtime/src/runtime/surfaces/hook-dry-run.d.ts +91 -0
- package/lib/types/{runtime → packages/market-runtime/src/runtime}/surfaces/hooks-mounts.d.ts +1 -1
- package/lib/types/{runtime → packages/market-runtime/src/runtime}/surfaces/project-runtime.d.ts +8 -5
- package/lib/types/packages/market-runtime/src/runtime/surfaces/skills-provider.d.ts +71 -0
- package/lib/types/packages/market-translation/src/application/state/translation-cache.d.ts +56 -0
- package/lib/types/packages/market-translation/src/application/translation/chain.d.ts +47 -0
- package/lib/types/packages/market-translation/src/application/translation/document.d.ts +54 -0
- package/lib/types/packages/market-translation/src/application/translation/localizer.d.ts +325 -0
- package/lib/types/packages/market-translation/src/application/translation/service.d.ts +89 -0
- package/lib/types/packages/market-translation/src/application/translation/unit.d.ts +35 -0
- package/lib/types/packages/market-translation/src/index.d.ts +4 -0
- package/lib/types/packages/market-translation/src/runtime/host/llm-translator.d.ts +30 -0
- package/lib/types/packages/market-translation/src/runtime/host/machine-translator.d.ts +52 -0
- package/lib/types/packages/market-translation/src/runtime/host/text-masking.d.ts +42 -0
- package/lib/types/packages/market-translation/src/runtime/host/translation-providers.d.ts +42 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +47 -10
- package/schemas/README.md +4 -4
- package/schemas/agent-plugins/spec.md +2 -2
- package/schemas/com.deepseek.harness/spec.md +1 -1
- package/schemas/skill-collection/spec.md +10 -2
- package/lib/application/panel-resources.js +0 -161
- package/lib/application/server-config.js +0 -109
- package/lib/contracts/settings.js +0 -63
- package/lib/runtime/core/reconciler.js +0 -100
- package/lib/runtime/panels/user-commands.js +0 -105
- package/lib/runtime/surfaces/commands-mounts.js +0 -186
- package/lib/runtime/surfaces/skills-provider.js +0 -160
- package/lib/types/application/details.d.ts +0 -7
- package/lib/types/application/mcp/mcp-status.d.ts +0 -24
- package/lib/types/application/panel-resources.d.ts +0 -28
- package/lib/types/application/ports.d.ts +0 -86
- package/lib/types/application/project-agent-roles.d.ts +0 -3
- package/lib/types/contracts/settings.d.ts +0 -59
- package/lib/types/routes.d.ts +0 -16
- package/lib/types/runtime/core/reconciler.d.ts +0 -58
- package/lib/types/runtime/panels/user-commands.d.ts +0 -27
- package/lib/types/runtime/surfaces/commands-mounts.d.ts +0 -48
- package/lib/types/runtime/surfaces/skills-provider.d.ts +0 -23
- /package/lib/{application → packages/market-catalog/src/application}/deadline.js +0 -0
- /package/lib/{application → packages/market-catalog/src/application}/json-file.js +0 -0
- /package/lib/{application → packages/market-catalog/src/application}/regions.js +0 -0
- /package/lib/{catalog → packages/market-catalog/src/scanning}/fs-probes.js +0 -0
- /package/lib/{catalog → packages/market-catalog/src/scanning}/git.js +0 -0
- /package/lib/{catalog → packages/market-catalog/src/scanning}/lsp-spec.js +0 -0
- /package/lib/{catalog → packages/market-catalog/src/scanning}/project-config.js +0 -0
- /package/lib/{catalog → packages/market-catalog/src/scanning}/project-hooks.js +0 -0
- /package/lib/{catalog → packages/market-catalog/src/scanning}/scan-pipeline.js +0 -0
- /package/lib/{catalog → packages/market-catalog/src/scanning}/source-catalog.js +0 -0
- /package/lib/{catalog → packages/market-catalog/src/scanning}/suite-components.js +0 -0
- /package/lib/{catalog → packages/market-catalog/src/scanning}/suite-scanner.js +0 -0
- /package/lib/{catalog → packages/market-catalog/src/scanning}/surfaces.js +0 -0
- /package/lib/{contracts → packages/market-contracts/src/contracts}/lsp-status.js +0 -0
- /package/lib/{contracts → packages/market-contracts/src/contracts}/lsp.js +0 -0
- /package/lib/{contracts → packages/market-contracts/src/contracts}/mcp-status.js +0 -0
- /package/lib/{contracts → packages/market-contracts/src/contracts}/mcp.js +0 -0
- /package/lib/{runtime → packages/market-contracts/src}/host/plugin-message-source.js +0 -0
- /package/lib/{model → packages/market-contracts/src/model}/command-names.js +0 -0
- /package/lib/{model → packages/market-contracts/src/model}/preset-source.js +0 -0
- /package/lib/{model → packages/market-contracts/src/model}/types.js +0 -0
- /package/lib/{application → packages/market-contracts/src/ports}/queries.js +0 -0
- /package/lib/{application → packages/market-mcp/src/application}/mcp/mcp-bridge-config.js +0 -0
- /package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/host-contract.js +0 -0
- /package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/host-seams.js +0 -0
- /package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/plugin-identity.js +0 -0
- /package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/projection.js +0 -0
- /package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/transport.js +0 -0
- /package/lib/{runtime → packages/market-mcp/src/runtime}/mcp/mcp-credentials.js +0 -0
- /package/lib/{application → packages/market-runtime/src/application}/agent-roles.js +0 -0
- /package/lib/{runtime → packages/market-runtime/src/runtime}/agents/agent-role-names.js +0 -0
- /package/lib/{runtime → packages/market-runtime/src/runtime}/core/context.js +0 -0
- /package/lib/{runtime → packages/market-runtime/src/runtime}/core/mount-lifecycle.js +0 -0
- /package/lib/{runtime → packages/market-runtime/src/runtime}/core/source-auto-update.js +0 -0
- /package/lib/{runtime → packages/market-runtime/src/runtime}/core/timer-seat.js +0 -0
- /package/lib/{runtime → packages/market-runtime/src/runtime}/host/model-catalog.js +0 -0
- /package/lib/{runtime → packages/market-runtime/src/runtime}/host/shell-path.js +0 -0
- /package/lib/{runtime → packages/market-runtime/src/runtime}/host/tool-registry-observer.js +0 -0
- /package/lib/{runtime → packages/market-runtime/src/runtime}/surfaces/dynamic-context.js +0 -0
- /package/lib/types/{runtime/host → packages/market-bundle/src/platform}/feedback-tool.d.ts +0 -0
- /package/lib/types/{application → packages/market-catalog/src/application}/deadline.d.ts +0 -0
- /package/lib/types/{application → packages/market-catalog/src/application}/json-file.d.ts +0 -0
- /package/lib/types/{application → packages/market-catalog/src/application}/state/storage-migration.d.ts +0 -0
- /package/lib/types/{catalog → packages/market-catalog/src/scanning}/fs-probes.d.ts +0 -0
- /package/lib/types/{catalog → packages/market-catalog/src/scanning}/git.d.ts +0 -0
- /package/lib/types/{catalog → packages/market-catalog/src/scanning}/paths.d.ts +0 -0
- /package/lib/types/{catalog → packages/market-catalog/src/scanning}/skills-parse.d.ts +0 -0
- /package/lib/types/{contracts → packages/market-contracts/src/contracts}/lsp-status.d.ts +0 -0
- /package/lib/types/{contracts → packages/market-contracts/src/contracts}/lsp.d.ts +0 -0
- /package/lib/types/{contracts → packages/market-contracts/src/contracts}/mcp.d.ts +0 -0
- /package/lib/types/{model → packages/market-contracts/src/model}/command-names.d.ts +0 -0
- /package/lib/types/{model → packages/market-contracts/src/model}/preset-source.d.ts +0 -0
- /package/lib/types/{application → packages/market-lsp/src/application}/lsp/lsp-server-state.d.ts +0 -0
- /package/lib/types/{application → packages/market-lsp/src/application}/lsp/profile-seam.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/bridge.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/connection.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/host-contract.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/host-seams.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/oauth.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/plugin-identity.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/projection.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/tools.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/bridge/transport.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-mcp/src/runtime}/mcp/mcp-credentials.d.ts +0 -0
- /package/lib/types/{application → packages/market-runtime/src/application}/panels/user-store.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-runtime/src/runtime}/agents/agent-role-names.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-runtime/src/runtime}/core/context.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-runtime/src/runtime}/core/mount-lifecycle.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-runtime/src/runtime}/core/source-auto-update.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-runtime/src/runtime}/core/timer-seat.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-runtime/src/runtime}/host/failure-detail.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-runtime/src/runtime}/host/shell-path.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-runtime/src/runtime}/host/tool-registry-observer.d.ts +0 -0
- /package/lib/types/{runtime → packages/market-runtime/src/runtime}/surfaces/dynamic-context.d.ts +0 -0
package/lib/index.js
CHANGED
|
@@ -1,257 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Catalog } from './application/catalog.js';
|
|
4
|
-
import { settlesWithin } from './application/deadline.js';
|
|
5
|
-
import { RuntimeReconciler } from './runtime/core/reconciler.js';
|
|
6
|
-
import { ReconcileScheduler } from './runtime/core/reconcile-scheduler.js';
|
|
7
|
-
import { MarketSettingsNamespace } from './runtime/host/settings-namespace.js';
|
|
8
|
-
import { deleteMcpAuthGrant } from './runtime/mcp/mcp-auth-record.js';
|
|
9
|
-
import { inspectToolRegistry, toolsServiceOf } from './runtime/host/tool-registry-observer.js';
|
|
10
|
-
import { migratePluginStorage } from './application/state/storage-migration.js';
|
|
11
|
-
import { mountAgentRoleTool } from './runtime/agents/agent-role-router.js';
|
|
12
|
-
import { projectAgentRoles } from './application/project-agent-roles.js';
|
|
13
|
-
import { mountProjectCommands, mountProjectMcp, mountProjectHooks, mountSuiteInstructions } from './runtime/surfaces/project-runtime.js';
|
|
14
|
-
import { createPanelResources } from './application/panel-resources.js';
|
|
15
|
-
import { resolveAgentsRoot, resolveDataRoot, resolveUserRoot } from './catalog/paths.js';
|
|
16
|
-
import { mountSuiteRoutes } from './routes.js';
|
|
17
|
-
import { SuiteSkillProvider } from './runtime/surfaces/skills-provider.js';
|
|
18
|
-
import { shellSeamOf } from './runtime/surfaces/dynamic-context.js';
|
|
19
|
-
import { loadLspServers } from './application/lsp/lsp-direct-config.js';
|
|
20
|
-
import { loadDisabledLspServers } from './application/lsp/lsp-server-state.js';
|
|
21
|
-
import { bindHostLocale, LOCALE_SETTINGS_ENTRY, readHostLocalePreference, readLocalePreference, setHostLocaleSource } from './runtime/host/host-locale.js';
|
|
22
|
-
import { createUserPanelStores } from './runtime/panels/user-panels.js';
|
|
23
|
-
import { SourceAutoUpdater } from './runtime/core/source-auto-update.js';
|
|
24
|
-
import { UserPanelSkillProvider } from './runtime/panels/user-panels.js';
|
|
25
|
-
import { UserCommandMountRegistry } from './runtime/panels/user-commands.js';
|
|
26
|
-
import { presetSourceRef } from './model/preset-source.js';
|
|
27
|
-
export const name = 'dsh-agent-plugins-market';
|
|
28
|
-
export const inject = ['skills', 'commands'];
|
|
29
|
-
export const Config = z.object({
|
|
30
|
-
userRoot: z.union([z.string(), z.const(undefined)]),
|
|
31
|
-
dataRoot: z.union([z.string(), z.const(undefined)]),
|
|
32
|
-
sources: z.any(),
|
|
33
|
-
git: z.object({
|
|
34
|
-
proxy: z.string(),
|
|
35
|
-
insteadOf: z.dict(z.string(), z.any()),
|
|
36
|
-
timeoutMs: z.natural(),
|
|
37
|
-
cloneRetry: z.boolean(),
|
|
38
|
-
fallbackTarball: z.boolean(),
|
|
39
|
-
allowHttpArchives: z.boolean()
|
|
40
|
-
}),
|
|
41
|
-
mcpEnhanced: MarketSettingsFields.mcpEnhanced.volatile(),
|
|
42
|
-
scanProjectLayouts: MarketSettingsFields.scanProjectLayouts.volatile(),
|
|
43
|
-
downloadRegion: MarketSettingsFields.downloadRegion.volatile(),
|
|
44
|
-
feedbackEnabled: MarketSettingsFields.feedbackEnabled.volatile(),
|
|
45
|
-
autoUpdateSources: MarketSettingsFields.autoUpdateSources.volatile()
|
|
46
|
-
});
|
|
47
|
-
const undefinedRef = { get: () => undefined };
|
|
48
|
-
export async function apply(ctx, config = { mcpEnhanced: undefinedRef, scanProjectLayouts: undefinedRef, downloadRegion: undefinedRef, feedbackEnabled: undefinedRef, autoUpdateSources: undefinedRef }) {
|
|
49
|
-
const userRoot = resolveUserRoot(config.userRoot);
|
|
50
|
-
const dataRoot = resolveDataRoot(config.dataRoot, userRoot);
|
|
51
|
-
const agentsRoot = resolveAgentsRoot();
|
|
52
|
-
const migration = await migratePluginStorage(config);
|
|
53
|
-
if (migration.conflicts.length > 0)
|
|
54
|
-
throw new Error(`Plugin storage migration conflicts (original files retained): ${migration.conflicts.join(', ')}`);
|
|
55
|
-
let providerControl;
|
|
56
|
-
let userPanelControl;
|
|
57
|
-
// Host runtime copy resolves from the harness `locale.preference` setting.
|
|
58
|
-
const hostLocale = { t: bindHostLocale(undefined) };
|
|
59
|
-
const refreshHostLocale = () => {
|
|
60
|
-
hostLocale.t = bindHostLocale(readLocalePreference());
|
|
61
|
-
providerControl?.invalidate();
|
|
62
|
-
userPanelControl?.invalidate();
|
|
63
|
-
};
|
|
64
|
-
// The preference is the `locale` entry's live configuration, projected by the
|
|
65
|
-
// host settings service. Resolve that service through the store from this
|
|
66
|
-
// entry's own context, and register the wiring as an effect so it lives
|
|
67
|
-
// exactly as long as this fiber: a context captured from an injection
|
|
68
|
-
// callback throws `cannot get required service "settings" in inactive
|
|
69
|
-
// context` once a profile reload disposes that fiber, and the unhandled
|
|
70
|
-
// rejection ends the host. Re-read once the service lands, because it may
|
|
71
|
-
// mount after this plugin.
|
|
72
|
-
ctx.effect(() => setHostLocaleSource(() => readHostLocalePreference(ctx.get('settings'))), 'dsh-agent-plugins-market: host locale source');
|
|
73
|
-
refreshHostLocale();
|
|
74
|
-
ctx.inject(['settings'], () => {
|
|
75
|
-
refreshHostLocale();
|
|
76
|
-
});
|
|
77
|
-
// A language switch writes the `locale` entry's form; re-read so the copy the
|
|
78
|
-
// market renders follows it without a reload.
|
|
79
|
-
ctx.effect(() => ctx.on('settings/document-updated', (ns) => {
|
|
80
|
-
if (ns === LOCALE_SETTINGS_ENTRY)
|
|
81
|
-
refreshHostLocale();
|
|
82
|
-
}), 'dsh-agent-plugins-market: host locale refresh');
|
|
83
|
-
const runtime = new RuntimeReconciler(ctx, dataRoot, key => hostLocale.t(key));
|
|
84
|
-
// User panel stores (skills / commands / agent personas) and their runtime
|
|
85
|
-
// contributions: one extra skill provider plus one command mount registry.
|
|
86
|
-
const panels = createUserPanelStores(agentsRoot);
|
|
87
|
-
const userCommands = new UserCommandMountRegistry(ctx, panels.commands, key => hostLocale.t(key));
|
|
88
|
-
let disposed = false;
|
|
89
|
-
let projectCommands;
|
|
90
|
-
let projectMcp;
|
|
91
|
-
let projectHooks;
|
|
92
|
-
let suitePrompts;
|
|
93
|
-
const scheduler = new ReconcileScheduler(ctx, runtime, {
|
|
94
|
-
enabledSuites: () => catalog.enabledUserSuites(),
|
|
95
|
-
publishMcpDiagnostics: diagnostics => {
|
|
96
|
-
catalog.mcpDiagnostics = diagnostics;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
/** Reconcile the user command mounts and report each failure once. */
|
|
100
|
-
const reconcileUserCommands = async () => {
|
|
101
|
-
const diagnostics = await userCommands.reconcile().catch(() => []);
|
|
102
|
-
for (const reason of diagnostics) {
|
|
103
|
-
ctx.logger?.warn(`[dsh-agent-plugins-market] user commands: ${reason}`);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* How long the change pipeline holds the queue on one stage. A mount that
|
|
108
|
-
* stops responding — a stdio server that never finishes its handshake, a
|
|
109
|
-
* browser authorization nobody completed — delays its own surface only; the
|
|
110
|
-
* stage keeps running while the pipeline moves on to the next change.
|
|
111
|
-
*/
|
|
112
|
-
const CHANGE_STAGE_DEADLINE_MS = 20_000;
|
|
113
|
-
/** Run one pipeline stage, logging its failure or its overrun instead of holding the pipeline. */
|
|
114
|
-
const runStage = async (stage, work) => {
|
|
115
|
-
const running = (async () => await work())();
|
|
116
|
-
void running.catch(error => {
|
|
117
|
-
ctx.logger?.warn(`[dsh-agent-plugins-market] ${stage} failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
118
|
-
});
|
|
119
|
-
if (!(await settlesWithin(running, CHANGE_STAGE_DEADLINE_MS))) {
|
|
120
|
-
ctx.logger?.warn(`[dsh-agent-plugins-market] ${stage} is still running after ${CHANGE_STAGE_DEADLINE_MS}ms; the change pipeline continues without waiting for it`);
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* Catalog change pipeline: invalidate the derived skill and command
|
|
125
|
-
* surfaces, refresh the project mounts, then reconcile every runtime mount.
|
|
126
|
-
* `CatalogContext` schedules it in the background, so a stage that overruns
|
|
127
|
-
* costs freshness, never the mutation that asked for it.
|
|
128
|
-
*/
|
|
129
|
-
const onChanged = async () => {
|
|
130
|
-
if (disposed)
|
|
131
|
-
return;
|
|
132
|
-
providerControl?.invalidate();
|
|
133
|
-
userPanelControl?.invalidate();
|
|
134
|
-
await runStage('project commands', () => projectCommands?.refresh());
|
|
135
|
-
await runStage('suite instructions', () => suitePrompts?.refresh());
|
|
136
|
-
await runStage('project MCP and hooks', () => Promise.all([projectMcp?.refresh(), projectHooks?.refresh()]));
|
|
137
|
-
await runStage('user commands', () => reconcileUserCommands());
|
|
138
|
-
await runStage('runtime mounts', () => scheduler.request());
|
|
139
|
-
};
|
|
140
|
-
// Background source updates: off until the settings switch says otherwise.
|
|
141
|
-
const autoUpdate = new SourceAutoUpdater(ctx, () => catalog.refreshSource());
|
|
142
|
-
const settings = new MarketSettingsNamespace(ctx, config, dataRoot, hostLocale, {
|
|
143
|
-
setScanProjectLayouts: enabled => catalog.setScanProjectLayouts(enabled),
|
|
144
|
-
refreshMcpMounts: () => {
|
|
145
|
-
void Promise.all([scheduler.request(), projectMcp?.refresh()]).catch(() => { });
|
|
146
|
-
},
|
|
147
|
-
setAutoUpdateSources: enabled => autoUpdate.setEnabled(enabled)
|
|
148
|
-
});
|
|
149
|
-
// The credentials store powers the MCP re-authorize action (dropping a grant
|
|
150
|
-
// record forces the next mount through a fresh browser authorization). Every
|
|
151
|
-
// port below is read at call time: this plugin's apply may run before the
|
|
152
|
-
// credentials, tools and settings services provision, and a snapshot taken
|
|
153
|
-
// here would be permanently undefined even after the service is live.
|
|
154
|
-
// Read at call time: the tools service provisions after apply() returns.
|
|
155
|
-
let toolsRegistry = toolsServiceOf(ctx);
|
|
156
|
-
const ports = {
|
|
157
|
-
mcpToolSnapshot: () => inspectToolRegistry(toolsRegistry),
|
|
158
|
-
credentialsStore: {
|
|
159
|
-
deleteGrantRecord: async (serverName) => {
|
|
160
|
-
const store = ctx.get?.('credentials');
|
|
161
|
-
await deleteMcpAuthGrant(store, serverName);
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
// Re-authorize must rebuild the live bridge, not just drop the grant: the
|
|
165
|
-
// registry flags the mount and the following reconcile tears it down and
|
|
166
|
-
// remounts, so the server's 401 restarts the browser authorization.
|
|
167
|
-
mcpRemount: (suiteId, serverKey) => runtime.forceMcpRemount(suiteId, serverKey),
|
|
168
|
-
mcpRemountAll: () => runtime.forceMcpRemountAll(),
|
|
169
|
-
mcpServerOwner: serverName => runtime.mcpServerOwner(serverName),
|
|
170
|
-
lspStatusSource: runtime.lsp,
|
|
171
|
-
mcpBackend: () => settings.backend(),
|
|
172
|
-
setMcpBackend: backend => settings.setBackend(backend),
|
|
173
|
-
downloadRegion: () => settings.downloadRegion(),
|
|
174
|
-
localePreference: () => readLocalePreference() ?? 'zh'
|
|
175
|
-
};
|
|
176
|
-
const catalog = new Catalog({ userRoot, dataRoot, agentsRoot, onChanged, ports, ...(config.git === undefined ? {} : { git: config.git }) });
|
|
177
|
-
await catalog.load();
|
|
178
|
-
// Configured seeds first, then the record this plugin presets: the market
|
|
179
|
-
// lists the first-party collection on the first open, and the ordinary
|
|
180
|
-
// refresh path clones it. Registration performs no network access.
|
|
181
|
-
await catalog.mergeSources([...(config.sources ?? []), presetSourceRef()]);
|
|
182
|
-
const resources = createPanelResources(catalog, panels);
|
|
183
|
-
runtime.setMcpOverridesProvider(async () => catalog.allMcpOverrides(await catalog.enabledUserSuites()));
|
|
184
|
-
runtime.lsp.setDirectProvider(async () => (await loadLspServers(agentsRoot)).servers);
|
|
185
|
-
runtime.lsp.setDisabledProvider(() => loadDisabledLspServers(dataRoot));
|
|
186
|
-
runtime.setMcpBackendProvider(() => catalog.mcpBackend());
|
|
187
|
-
// The namespace must be registered after the catalog exists: the host
|
|
188
|
-
// resolves the inject callback synchronously when the settings service is
|
|
189
|
-
// already mounted, and the registration reads back the project-layout switch.
|
|
190
|
-
settings.mount();
|
|
191
|
-
ctx.inject(['tools'], toolsCtx => {
|
|
192
|
-
toolsRegistry = toolsCtx.tools;
|
|
193
|
-
// Foreign-namespace guard: a native host MCP client (or another plugin)
|
|
194
|
-
// owning `mcp__<serverName>__` names makes the mount registry skip its
|
|
195
|
-
// own server with a clear diagnostic instead of failing mid-registration.
|
|
196
|
-
runtime.setMcpToolNamesProvider(() => inspectToolRegistry(toolsRegistry).map(tool => tool.name));
|
|
197
|
-
});
|
|
198
|
-
void Promise.resolve()
|
|
199
|
-
.then(async () => {
|
|
200
|
-
await reconcileUserCommands();
|
|
201
|
-
await scheduler.request();
|
|
202
|
-
})
|
|
203
|
-
.catch(() => { });
|
|
204
|
-
// The shell seam resolves lazily: the service may land after this plugin, and
|
|
205
|
-
// a profile without one keeps dynamic-context placeholders literal.
|
|
206
|
-
const shellSeam = () => shellSeamOf(ctx);
|
|
207
|
-
ctx.skills.registerProvider(control => {
|
|
208
|
-
providerControl = control;
|
|
209
|
-
return new SuiteSkillProvider(catalog, { dataRoot, shell: shellSeam });
|
|
210
|
-
});
|
|
211
|
-
// User panel skills ride a second provider so a panel
|
|
212
|
-
// edit invalidates only its own catalog contribution.
|
|
213
|
-
ctx.skills.registerProvider(control => {
|
|
214
|
-
userPanelControl = control;
|
|
215
|
-
return new UserPanelSkillProvider(panels.skills);
|
|
216
|
-
});
|
|
217
|
-
ctx.inject(['tools', 'llm', 'subagents', 'agents'], hostCtx => {
|
|
218
|
-
hostCtx.effect(() => mountAgentRoleTool(hostCtx, async (parent) => [
|
|
219
|
-
...(await resources.agents.list(true)).map(entry => ({ ...entry, title: entry.name, name: entry.id ?? entry.name })),
|
|
220
|
-
...(await projectAgentRoles(catalog, parent))
|
|
221
|
-
]), 'dsh-agent-plugins-market: agent role routing');
|
|
222
|
-
});
|
|
223
|
-
ctx.inject(['agents'], hostCtx => {
|
|
224
|
-
hostCtx.effect(() => {
|
|
225
|
-
const mounted = mountProjectCommands(hostCtx, catalog, key => hostLocale.t(key), dataRoot);
|
|
226
|
-
const mcp = mountProjectMcp(hostCtx, catalog, dataRoot);
|
|
227
|
-
const hooks = mountProjectHooks(hostCtx, catalog);
|
|
228
|
-
const prompts = mountSuiteInstructions(hostCtx, catalog, dataRoot);
|
|
229
|
-
projectCommands = mounted;
|
|
230
|
-
projectMcp = mcp;
|
|
231
|
-
projectHooks = hooks;
|
|
232
|
-
suitePrompts = prompts;
|
|
233
|
-
return async () => {
|
|
234
|
-
if (projectCommands === mounted)
|
|
235
|
-
projectCommands = undefined;
|
|
236
|
-
if (projectMcp === mcp)
|
|
237
|
-
projectMcp = undefined;
|
|
238
|
-
if (projectHooks === hooks)
|
|
239
|
-
projectHooks = undefined;
|
|
240
|
-
if (suitePrompts === prompts)
|
|
241
|
-
suitePrompts = undefined;
|
|
242
|
-
await Promise.all([mounted.dispose(), mcp.dispose(), hooks.dispose(), prompts.dispose()]);
|
|
243
|
-
};
|
|
244
|
-
}, 'dsh-agent-plugins-market: project command lifecycle');
|
|
245
|
-
});
|
|
246
|
-
ctx.inject(['webServer', 'loader'], hostCtx => {
|
|
247
|
-
hostCtx.effect(() => mountSuiteRoutes(hostCtx, catalog, resources), 'dsh-agent-plugins-market: http routes');
|
|
248
|
-
});
|
|
249
|
-
ctx.effect(() => () => {
|
|
250
|
-
disposed = true;
|
|
251
|
-
scheduler.dispose();
|
|
252
|
-
autoUpdate.dispose();
|
|
253
|
-
settings.dispose();
|
|
254
|
-
userCommands.disposeAll();
|
|
255
|
-
void runtime.dispose();
|
|
256
|
-
}, 'dsh-agent-plugins-market: lifecycle');
|
|
257
|
-
}
|
|
1
|
+
/** Public installation entry; domain ownership lives in private workspace packages. */
|
|
2
|
+
export * from './packages/market-bundle/src/index.js';
|
|
@@ -9,18 +9,19 @@
|
|
|
9
9
|
* MCP, LSP). The facade composes them and forwards, so a caller never has to
|
|
10
10
|
* know which collaborator owns a given invariant.
|
|
11
11
|
*/
|
|
12
|
-
import { qualifiedSuiteId } from '
|
|
13
|
-
import { loadUserMcpSuite } from '
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { InstallStore } from '
|
|
20
|
-
import { LspService } from '
|
|
21
|
-
import { McpService } from '
|
|
22
|
-
import { resolveCatalogPorts } from '
|
|
23
|
-
import { SourceStore, codeloadTarballUrl } from '
|
|
12
|
+
import { qualifiedSuiteId } from '../../../market-catalog/src/index.js';
|
|
13
|
+
import { loadUserMcpSuite } from '../../../market-mcp/src/index.js';
|
|
14
|
+
import { loadUserHooksSuite } from '../../../market-runtime/src/index.js';
|
|
15
|
+
import { applyLspOverrides } from '../../../market-lsp/src/index.js';
|
|
16
|
+
import { SuiteQueries } from './suite-queries.js';
|
|
17
|
+
import { CatalogContext } from '../../../market-catalog/src/index.js';
|
|
18
|
+
import { TranslationService } from '../../../market-translation/src/index.js';
|
|
19
|
+
import { InstallStore } from '../../../market-catalog/src/index.js';
|
|
20
|
+
import { LspService } from '../../../market-lsp/src/index.js';
|
|
21
|
+
import { McpService } from '../../../market-mcp/src/index.js';
|
|
22
|
+
import { resolveCatalogPorts } from '../../../market-contracts/src/ports/ports.js';
|
|
23
|
+
import { SourceStore, codeloadTarballUrl } from '../../../market-catalog/src/index.js';
|
|
24
|
+
import { readExtensionSuiteDeclarations } from '../../../market-runtime/src/index.js';
|
|
24
25
|
export class Catalog {
|
|
25
26
|
context;
|
|
26
27
|
ports;
|
|
@@ -29,14 +30,38 @@ export class Catalog {
|
|
|
29
30
|
installs;
|
|
30
31
|
mcp;
|
|
31
32
|
lsp;
|
|
33
|
+
translation;
|
|
34
|
+
suiteQueries;
|
|
32
35
|
constructor(options) {
|
|
33
36
|
this.context = new CatalogContext(options);
|
|
34
37
|
this.ports = resolveCatalogPorts(options.ports);
|
|
35
38
|
this.snapshots = this.context.snapshots;
|
|
36
39
|
this.sourceStore = new SourceStore(this.context, this.ports);
|
|
37
40
|
this.installs = new InstallStore(this.context, this.sourceStore);
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
// The status builders resolve translations through this callback rather
|
|
42
|
+
// than reaching into the service, so the panel surfaces stay independent
|
|
43
|
+
// of how the catalog stores them.
|
|
44
|
+
const localizeFields = (surface, id, fields, locale) => this.translateFields(surface, id, fields, locale);
|
|
45
|
+
this.mcp = new McpService(this.context, this.ports, this.sourceStore, localizeFields);
|
|
46
|
+
this.lsp = new LspService(this.context, this.ports, localizeFields);
|
|
47
|
+
this.translation = new TranslationService({
|
|
48
|
+
dataRoot: this.context.dataRoot,
|
|
49
|
+
providers: this.ports.translationProviders ?? [],
|
|
50
|
+
...(this.ports.translationEnabled === undefined ? {} : { enabled: this.ports.translationEnabled }),
|
|
51
|
+
providerIdentity: this.ports.translationProviderIdentity ?? (() => 'none')
|
|
52
|
+
});
|
|
53
|
+
// Every dependency is a closure over this instance, so a caller that replaces
|
|
54
|
+
// one of these methods still decides what the query sees.
|
|
55
|
+
this.suiteQueries = new SuiteQueries({
|
|
56
|
+
readUserCatalog: () => this.readUserCatalog(),
|
|
57
|
+
readProjectCatalog: cwd => this.readProjectCatalog(cwd),
|
|
58
|
+
installed: (sourceId, suiteId) => this.context.installed(sourceId, suiteId),
|
|
59
|
+
dataRoot: () => this.context.dataRoot,
|
|
60
|
+
mcpDiagnostics: () => this.mcp.diagnostics,
|
|
61
|
+
localePreference: () => this.ports.localePreference(),
|
|
62
|
+
translateFields: (surface, id, fields, locale) => this.translateFields(surface, id, fields, locale),
|
|
63
|
+
translateDocument: (surface, id, text, locale, retry) => this.translateDocument(surface, id, text, locale, retry)
|
|
64
|
+
});
|
|
40
65
|
}
|
|
41
66
|
/** Latest MCP mount diagnostics (suiteId -> reasons), fed by host reconcile. */
|
|
42
67
|
get mcpDiagnostics() {
|
|
@@ -53,6 +78,32 @@ export class Catalog {
|
|
|
53
78
|
get dataRoot() {
|
|
54
79
|
return this.context.dataRoot;
|
|
55
80
|
}
|
|
81
|
+
/** The shared Agent layout root the direct user declarations (hooks, MCP) are read from. */
|
|
82
|
+
get agentsRoot() {
|
|
83
|
+
return this.context.agentsRoot;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The host locale preference the panels render in.
|
|
87
|
+
*
|
|
88
|
+
* A read that walks many rows resolves it once and passes the value to every
|
|
89
|
+
* {@link translateFields} call: the host answers the preference by projecting
|
|
90
|
+
* every profile entry's live configuration, so reading it per row made a
|
|
91
|
+
* panel's latency scale with its row count instead of its work.
|
|
92
|
+
*/
|
|
93
|
+
get localePreference() {
|
|
94
|
+
return this.ports.localePreference();
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The clock this catalog's caches age against.
|
|
98
|
+
*
|
|
99
|
+
* The panel row cache is derived from the same files the snapshot cache
|
|
100
|
+
* walks, so it measures its maximum age on the same timeline: a test that
|
|
101
|
+
* drives the catalog's injected clock drives both, and a deployment gets the
|
|
102
|
+
* one process clock.
|
|
103
|
+
*/
|
|
104
|
+
now() {
|
|
105
|
+
return this.context.now();
|
|
106
|
+
}
|
|
56
107
|
get sources() {
|
|
57
108
|
return this.context.state.sources;
|
|
58
109
|
}
|
|
@@ -67,6 +118,42 @@ export class Catalog {
|
|
|
67
118
|
/** Load persisted user state once at plugin activation. */
|
|
68
119
|
async load() {
|
|
69
120
|
await this.context.load();
|
|
121
|
+
// Cached translations load alongside the catalog so the first overview
|
|
122
|
+
// answers from cache instead of re-asking a provider.
|
|
123
|
+
await this.translation.load();
|
|
124
|
+
}
|
|
125
|
+
/** Release the localizer's and the snapshot cache's timers; in-flight work still persists. */
|
|
126
|
+
dispose() {
|
|
127
|
+
this.translation.dispose();
|
|
128
|
+
this.snapshots.dispose();
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Drop every cached translation, in memory and on disk.
|
|
132
|
+
*
|
|
133
|
+
* Translation is lazy, so this is the whole of the reset: nothing is queued
|
|
134
|
+
* here, and the next panel read repopulates the cache from scratch. The
|
|
135
|
+
* in-memory copy is emptied too, or the same process would keep serving text
|
|
136
|
+
* the file no longer holds.
|
|
137
|
+
* @returns fulfillment once the cache is empty.
|
|
138
|
+
*/
|
|
139
|
+
async clearTranslations() {
|
|
140
|
+
await this.translation.clear();
|
|
141
|
+
}
|
|
142
|
+
/** Apply the current display preference to pending translation work. */
|
|
143
|
+
syncTranslationEnabled() {
|
|
144
|
+
this.translation.onEnabledChanged();
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Wait for queued translations to finish.
|
|
148
|
+
*
|
|
149
|
+
* Nothing on the request path calls this — the panel renders upstream text
|
|
150
|
+
* and re-reads. It exists so a test can observe the settled state instead of
|
|
151
|
+
* polling.
|
|
152
|
+
* @param deadlineMs - maximum wait; omitted waits for the queue alone.
|
|
153
|
+
* @returns whether the queue drained before the deadline.
|
|
154
|
+
*/
|
|
155
|
+
async settleDescriptions(deadlineMs) {
|
|
156
|
+
return this.translation.settle(deadlineMs);
|
|
70
157
|
}
|
|
71
158
|
/** Append config-seeded sources missing from user state and persist them. */
|
|
72
159
|
async mergeSources(sources) {
|
|
@@ -92,6 +179,11 @@ export class Catalog {
|
|
|
92
179
|
async readUserCatalog() {
|
|
93
180
|
return this.snapshots.readUserCatalog();
|
|
94
181
|
}
|
|
182
|
+
/** Installed local user declarations, including globally disabled suites; never changes global runtime discovery. */
|
|
183
|
+
async installedSuiteDeclarations() {
|
|
184
|
+
const snapshot = await this.readUserCatalog();
|
|
185
|
+
return readExtensionSuiteDeclarations(snapshot.suites.filter(suite => this.context.installed(suite.sourceId, suite.id) !== undefined));
|
|
186
|
+
}
|
|
95
187
|
/** Read one coherent project-dimension snapshot for a workspace cwd. */
|
|
96
188
|
async readProjectCatalog(cwd) {
|
|
97
189
|
return this.snapshots.readProjectCatalog(cwd);
|
|
@@ -113,12 +205,25 @@ export class Catalog {
|
|
|
113
205
|
const direct = [...(Object.keys(mcp.mcp.servers).length === 0 ? [] : [mcp]), ...(hooks.surfaces.hooks === 0 ? [] : [hooks])];
|
|
114
206
|
return applyLspOverrides(this.context.dataRoot, direct.length === 0 ? suites : [...suites, ...direct]);
|
|
115
207
|
}
|
|
116
|
-
/**
|
|
208
|
+
/**
|
|
209
|
+
* The full market overview from one user snapshot.
|
|
210
|
+
*
|
|
211
|
+
* The description is localized on the way out: a suite whose text is already
|
|
212
|
+
* Chinese (or already bilingual) is served as authored, and every other
|
|
213
|
+
* description is translated in the background. The read itself never waits on
|
|
214
|
+
* a provider call — a suite with no cached translation carries its original
|
|
215
|
+
* text plus a translated field only once one lands, and the panel re-reads
|
|
216
|
+
* while anything reports itself pending.
|
|
217
|
+
*/
|
|
117
218
|
async overview() {
|
|
118
219
|
const snapshot = await this.readUserCatalog();
|
|
119
220
|
const sourceRows = await this.sourceStore.overviewRows(snapshot);
|
|
221
|
+
const locale = this.ports.localePreference();
|
|
222
|
+
let translationPending = 0;
|
|
120
223
|
const cards = snapshot.suites.map(suite => {
|
|
121
224
|
const isInstalled = this.isInstalled(suite.sourceId, suite.id);
|
|
225
|
+
const localized = this.translateFields('market', qualifiedSuiteId(suite.sourceId, suite.id), { name: suite.manifest.name, description: suite.manifest.description }, locale);
|
|
226
|
+
translationPending += localized.pending;
|
|
122
227
|
return {
|
|
123
228
|
sourceId: suite.sourceId,
|
|
124
229
|
suiteId: suite.id,
|
|
@@ -134,7 +239,8 @@ export class Catalog {
|
|
|
134
239
|
dimension: suite.dimension,
|
|
135
240
|
layout: suite.manifest.layout,
|
|
136
241
|
errors: suite.errors,
|
|
137
|
-
mcpErrors: this.mcp.diagnostics.filter(diagnostic => diagnostic.suiteId === suite.id).map(diagnostic => `${diagnostic.serverKey}: ${diagnostic.reason}`)
|
|
242
|
+
mcpErrors: this.mcp.diagnostics.filter(diagnostic => diagnostic.suiteId === suite.id).map(diagnostic => `${diagnostic.serverKey}: ${diagnostic.reason}`),
|
|
243
|
+
...localized.fields
|
|
138
244
|
};
|
|
139
245
|
});
|
|
140
246
|
return {
|
|
@@ -146,25 +252,71 @@ export class Catalog {
|
|
|
146
252
|
enabled: cards.filter(card => card.enabled).length
|
|
147
253
|
},
|
|
148
254
|
roots: { user: this.context.userRoot, data: this.context.dataRoot },
|
|
149
|
-
unmanaged: await this.sourceStore.unmanaged()
|
|
255
|
+
unmanaged: await this.sourceStore.unmanaged(),
|
|
256
|
+
...(translationPending === 0 ? {} : { translationPending })
|
|
150
257
|
};
|
|
151
258
|
}
|
|
152
|
-
/** One
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
259
|
+
/** One entity's translated description, pending count included. {@link TranslationService.translateFields} owns the rule. */
|
|
260
|
+
translateFields(surface, id, fields, locale) {
|
|
261
|
+
return this.translation.translateFields(surface, id, fields, locale);
|
|
262
|
+
}
|
|
263
|
+
/** One authored text translated chunk by chunk. {@link TranslationService.translateDocument} owns the rule for bodies. */
|
|
264
|
+
translateDocument(surface, id, text, locale, retry = false) {
|
|
265
|
+
return this.translation.translateDocument(surface, id, text, locale, retry);
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* The localized face of every `/` menu row this plugin owns.
|
|
269
|
+
*
|
|
270
|
+
* The rows come from the runtime registries (through
|
|
271
|
+
* {@link CatalogPorts.menuRowIdentities}) because only they know the call name
|
|
272
|
+
* a command actually got; the text comes from the shared translation service,
|
|
273
|
+
* because the panel reads it through the same translation cache. Resolution
|
|
274
|
+
* is a cache read and never a provider call: a row whose text is not cached
|
|
275
|
+
* yet answers without a face, and the panel read that follows queues it.
|
|
276
|
+
*
|
|
277
|
+
* A field is emitted only when the translation differs from the authored
|
|
278
|
+
* text. The menu shows the call name beside the label, so a name that
|
|
279
|
+
* translated to itself would only duplicate the alias.
|
|
280
|
+
* @returns one wire row per owned menu row, without rows carrying no translation.
|
|
281
|
+
*/
|
|
282
|
+
async menuRowFaces() {
|
|
283
|
+
// No chain, no translations: every cache key is folded with the chain's
|
|
284
|
+
// identity, so a deployment with no provider has nothing cached to serve.
|
|
285
|
+
// Skipping it also skips the panel reads behind the rows, which walk every
|
|
286
|
+
// suite's resources.
|
|
287
|
+
if ((this.ports.translationProviders ?? []).length === 0)
|
|
288
|
+
return [];
|
|
289
|
+
// The switch mirrors the client's: while it is off the `/` menu is not
|
|
290
|
+
// wrapped at all and renders the host's own rows, so walking the panels for
|
|
291
|
+
// faces nothing would display only spends the reads. The panels themselves
|
|
292
|
+
// still render what is already cached — the switch gates new work there.
|
|
293
|
+
if (this.ports.translationEnabled?.() === false)
|
|
294
|
+
return [];
|
|
295
|
+
// One preference read for the whole menu: the host answers it by projecting
|
|
296
|
+
// every profile entry's live configuration, so resolving it per row made
|
|
297
|
+
// opening the menu scale with the row count.
|
|
298
|
+
const locale = this.ports.localePreference();
|
|
299
|
+
const faces = [];
|
|
300
|
+
for (const row of await this.ports.menuRowIdentities()) {
|
|
301
|
+
const { fields } = this.translateFields(row.source, row.id, { description: row.authoredDescription }, locale);
|
|
302
|
+
const description = row.authoredDescription === undefined || fields.translatedDescription === row.authoredDescription ? undefined : fields.translatedDescription;
|
|
303
|
+
if (description === undefined)
|
|
304
|
+
continue;
|
|
305
|
+
faces.push({ source: row.source, name: row.name, description });
|
|
306
|
+
}
|
|
307
|
+
return faces;
|
|
308
|
+
}
|
|
309
|
+
/** One suite's full detail. {@link SuiteQueries.suiteDetail} owns the composition. */
|
|
310
|
+
async suiteDetail(sourceId, suiteId, projectCwd) {
|
|
311
|
+
return this.suiteQueries.suiteDetail(sourceId, suiteId, projectCwd);
|
|
312
|
+
}
|
|
313
|
+
/** One suite document's authored text. {@link SuiteQueries.suiteDocument} owns the read. */
|
|
314
|
+
async suiteDocument(sourceId, suiteId, kind, name, projectCwd) {
|
|
315
|
+
return this.suiteQueries.suiteDocument(sourceId, suiteId, kind, name, projectCwd);
|
|
316
|
+
}
|
|
317
|
+
/** One suite document's translation. {@link SuiteQueries.suiteDocumentTranslation} owns the keying. */
|
|
318
|
+
async suiteDocumentTranslation(sourceId, suiteId, kind, name, retry = false, projectCwd) {
|
|
319
|
+
return this.suiteQueries.suiteDocumentTranslation(sourceId, suiteId, kind, name, projectCwd, retry);
|
|
168
320
|
}
|
|
169
321
|
// ---- Source acquisition and CRUD ----
|
|
170
322
|
/** Add a source and acquire it immediately (clone, download, or in-place). */
|
|
@@ -190,6 +342,9 @@ export class Catalog {
|
|
|
190
342
|
/** Refresh one source checkout, or every source when sourceId is omitted. */
|
|
191
343
|
async refreshSource(sourceId) {
|
|
192
344
|
await this.sourceStore.refresh(sourceId);
|
|
345
|
+
// No warm-up here: a refresh runs from the background updater too, and
|
|
346
|
+
// translating then would make the layer eager again. The next panel read
|
|
347
|
+
// discovers the new text and queues it.
|
|
193
348
|
}
|
|
194
349
|
/** Progress snapshot for the progress route. */
|
|
195
350
|
sourceProgress() {
|
|
@@ -229,17 +384,28 @@ export class Catalog {
|
|
|
229
384
|
async mcpStatus() {
|
|
230
385
|
return this.mcp.status();
|
|
231
386
|
}
|
|
232
|
-
/**
|
|
233
|
-
async addMcpServer(name, server) {
|
|
234
|
-
await this.mcp.addServer(name, server);
|
|
387
|
+
/** Validate and persist a user-owned MCP service with optional policy before reconciling its mount. */
|
|
388
|
+
async addMcpServer(name, server, policy) {
|
|
389
|
+
await this.mcp.addServer(name, server, policy);
|
|
235
390
|
}
|
|
236
|
-
/**
|
|
237
|
-
|
|
238
|
-
|
|
391
|
+
/**
|
|
392
|
+
* Read a service without credential literals, or an unsaved template when
|
|
393
|
+
* `create` is true. The two transports have separate owners, so this facade
|
|
394
|
+
* only routes the request to the module that owns the declaration.
|
|
395
|
+
*/
|
|
396
|
+
async serverConfig(kind, id, create = false) {
|
|
397
|
+
return kind === 'mcp' ? this.mcp.serverConfig(id, create) : this.lsp.serverConfig(id, create);
|
|
239
398
|
}
|
|
240
|
-
/**
|
|
399
|
+
/**
|
|
400
|
+
* Validate a complete replacement before writing; plugin checkouts remain
|
|
401
|
+
* untouched. The MCP half also carries the editing policy, which the LSP
|
|
402
|
+
* document has no seat for.
|
|
403
|
+
*/
|
|
241
404
|
async saveServerConfig(kind, id, config, policy) {
|
|
242
|
-
|
|
405
|
+
if (kind === 'mcp')
|
|
406
|
+
await this.mcp.saveServerConfig(id, config, policy);
|
|
407
|
+
else
|
|
408
|
+
await this.lsp.saveServerConfig(id, config);
|
|
243
409
|
}
|
|
244
410
|
/** One suite's persisted MCP overrides, addressed by qualified suite id. */
|
|
245
411
|
async mcpOverrides(sourceId, suiteId) {
|