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
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
* @module application/user-store
|
|
15
15
|
*/
|
|
16
16
|
import { readdir, readFile, rmdir, rm, stat } from 'node:fs/promises';
|
|
17
|
+
import { isAbsentPath } from '../fs-probe.js';
|
|
17
18
|
import { dirname, join } from 'node:path';
|
|
18
19
|
import { writeFileAtomic } from '@deepseek-ai/dsh-atomic-write';
|
|
19
20
|
import { parseDocument, stringify } from 'yaml';
|
|
20
|
-
import { parseSkillFrontmatter, stripFrontmatter } from '
|
|
21
|
+
import { parseSkillFrontmatter, stripFrontmatter } from '../../../../market-catalog/src/index.js';
|
|
21
22
|
/** Where user panel entries persist: `<agentsRoot>/<kind>/`. */
|
|
22
23
|
export function userEntryDir(agentsRoot, kind) {
|
|
23
24
|
return join(agentsRoot, kind);
|
|
@@ -44,15 +45,48 @@ export const SKILL_ENTRY_SHAPES = ['skill-directory', 'file'];
|
|
|
44
45
|
export function entryDocumentPath(dir, name, shape) {
|
|
45
46
|
return shape === 'skill-directory' ? join(dir, name, SKILL_ENTRY_FILE) : join(dir, `${name}.md`);
|
|
46
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Whether one panel directory may be listed, answered structurally rather than
|
|
50
|
+
* from a listing failure.
|
|
51
|
+
*
|
|
52
|
+
* A path is either an existing directory, absent (a user who authored nothing
|
|
53
|
+
* has not broken anything), or something that can never hold entries. Only the
|
|
54
|
+
* first is listed; the second is a valid empty panel; the third is a broken
|
|
55
|
+
* configuration. Confirming the shape before listing keeps that decision
|
|
56
|
+
* independent of the code a `readdir` failure happens to carry.
|
|
57
|
+
* @param dir - the panel directory.
|
|
58
|
+
* @param strict - whether a broken configuration is an error or an empty read.
|
|
59
|
+
* @returns `true` when the directory is confirmed and may be listed.
|
|
60
|
+
*/
|
|
61
|
+
async function confirmDirectory(dir, strict) {
|
|
62
|
+
let info;
|
|
63
|
+
try {
|
|
64
|
+
info = await stat(dir);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
// A directory is absent only when its ancestors stay searchable: a platform
|
|
68
|
+
// can report ENOENT for a child of a file, which is an unreadable panel.
|
|
69
|
+
if (await isAbsentPath(dir))
|
|
70
|
+
return false;
|
|
71
|
+
if (strict)
|
|
72
|
+
throw error;
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (info.isDirectory())
|
|
76
|
+
return true;
|
|
77
|
+
if (strict)
|
|
78
|
+
throw Object.assign(new Error(`ENOTDIR: not a directory, scandir '${dir}'`), { code: 'ENOTDIR' });
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
47
81
|
/** Whether a path is a regular file; strict runtime snapshots propagate real I/O failures. */
|
|
48
82
|
async function isFile(file, strict) {
|
|
49
83
|
try {
|
|
50
84
|
return (await stat(file)).isFile();
|
|
51
85
|
}
|
|
52
86
|
catch (error) {
|
|
53
|
-
if (strict
|
|
54
|
-
|
|
55
|
-
|
|
87
|
+
if (!strict || (await isAbsentPath(file)))
|
|
88
|
+
return false;
|
|
89
|
+
throw error;
|
|
56
90
|
}
|
|
57
91
|
}
|
|
58
92
|
/**
|
|
@@ -83,14 +117,18 @@ export async function listEntryDocuments(dir, strict = false, shapes = ['file'],
|
|
|
83
117
|
await collectNestedEntryDocuments(dir, '', shapes, strict, found);
|
|
84
118
|
return [...found.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
85
119
|
}
|
|
120
|
+
if (!(await confirmDirectory(dir, strict)))
|
|
121
|
+
return [];
|
|
86
122
|
let entries;
|
|
87
123
|
try {
|
|
88
124
|
entries = await readdir(dir);
|
|
89
125
|
}
|
|
90
126
|
catch (error) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
127
|
+
// Only a structurally confirmed absence is tolerated: the directory can be
|
|
128
|
+
// removed between the confirmation and the listing.
|
|
129
|
+
if (!strict || (await isAbsentPath(dir)))
|
|
130
|
+
return [];
|
|
131
|
+
throw error;
|
|
94
132
|
}
|
|
95
133
|
for (const entry of entries.sort()) {
|
|
96
134
|
const name = entry.endsWith('.md') ? entry.slice(0, -3) : shapes.includes('skill-directory') ? entry : undefined;
|
|
@@ -114,14 +152,16 @@ export async function listEntryDocuments(dir, strict = false, shapes = ['file'],
|
|
|
114
152
|
* `/` separators and no trailing slash.
|
|
115
153
|
*/
|
|
116
154
|
async function collectNestedEntryDocuments(dir, prefix, shapes, strict, found) {
|
|
155
|
+
if (!(await confirmDirectory(dir, strict)))
|
|
156
|
+
return;
|
|
117
157
|
let entries;
|
|
118
158
|
try {
|
|
119
159
|
entries = await readdir(dir, { withFileTypes: true });
|
|
120
160
|
}
|
|
121
161
|
catch (error) {
|
|
122
|
-
if (strict
|
|
123
|
-
|
|
124
|
-
|
|
162
|
+
if (!strict || (await isAbsentPath(dir)))
|
|
163
|
+
return;
|
|
164
|
+
throw error;
|
|
125
165
|
}
|
|
126
166
|
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
127
167
|
if (entry.isSymbolicLink() || entry.name.startsWith('.') || entry.name === 'node_modules')
|
|
@@ -171,9 +211,9 @@ export async function readEntryDocument(document, strict = false) {
|
|
|
171
211
|
text = await readFile(document.file, 'utf8');
|
|
172
212
|
}
|
|
173
213
|
catch (error) {
|
|
174
|
-
if (strict
|
|
175
|
-
|
|
176
|
-
|
|
214
|
+
if (!strict || (await isAbsentPath(document.file)))
|
|
215
|
+
return undefined;
|
|
216
|
+
throw error;
|
|
177
217
|
}
|
|
178
218
|
let meta;
|
|
179
219
|
try {
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
/** Resolve read-only project roles from the calling session, never from tool-supplied paths. */
|
|
2
|
-
import { defaultMarkdownResources, resourceText } from '
|
|
3
|
-
import { pluginRootOf } from '
|
|
4
|
-
import { suiteDataDir } from '
|
|
2
|
+
import { defaultMarkdownResources, resourceText } from '../../../market-catalog/src/index.js';
|
|
3
|
+
import { pluginRootOf } from '../../../market-catalog/src/index.js';
|
|
4
|
+
import { suiteDataDir } from '../../../market-catalog/src/index.js';
|
|
5
5
|
import { parseAgentRole } from './agent-roles.js';
|
|
6
|
-
|
|
6
|
+
import { isAbsentPath } from './fs-probe.js';
|
|
7
|
+
export async function projectAgentRoles(catalog, parent, options = {}) {
|
|
7
8
|
const cwd = parent?.session?.header?.cwd;
|
|
8
9
|
if (typeof cwd !== 'string' || cwd === '')
|
|
9
10
|
return [];
|
|
10
|
-
const
|
|
11
|
+
const suites = options.suites ? await options.suites() : (await catalog.readProjectCatalog(cwd)).enabledSuites;
|
|
11
12
|
const entries = [];
|
|
12
|
-
for (const suite of
|
|
13
|
+
for (const suite of suites) {
|
|
13
14
|
if (suite.activeSurfaces.agents === false)
|
|
14
15
|
continue;
|
|
15
16
|
const suiteRoot = pluginRootOf(suite);
|
|
16
17
|
const suiteData = suiteRoot === undefined ? undefined : suiteDataDir(catalog.dataRoot, suite.sourceId, suite.id);
|
|
17
|
-
for (const resource of suite.resources?.agents ?? (await defaultMarkdownResources(suite.root, 'agents'))) {
|
|
18
|
+
for (const resource of suite.resources?.agents ?? (options.suites ? [] : await defaultMarkdownResources(suite.root, 'agents'))) {
|
|
18
19
|
const path = resource.file;
|
|
19
|
-
const rawText = await resourceText(resource).catch(error => {
|
|
20
|
-
|
|
20
|
+
const rawText = await resourceText(options.suites && resource.file !== suite.manifest.path ? { name: resource.name, file: resource.file } : resource).catch(async (error) => {
|
|
21
|
+
// A vanished document is an ordinary removal; any other failure must not
|
|
22
|
+
// silently drop a project role from the catalog.
|
|
23
|
+
if (!(await isAbsentPath(path)))
|
|
21
24
|
throw error;
|
|
22
25
|
return undefined;
|
|
23
26
|
});
|
|
@@ -25,7 +28,7 @@ export async function projectAgentRoles(catalog, parent) {
|
|
|
25
28
|
continue;
|
|
26
29
|
try {
|
|
27
30
|
const policy = parseAgentRole(rawText);
|
|
28
|
-
|
|
31
|
+
const entry = {
|
|
29
32
|
name: JSON.stringify([suite.sourceId, suite.id, 'agents', resource.name]),
|
|
30
33
|
path,
|
|
31
34
|
rawText,
|
|
@@ -34,7 +37,13 @@ export async function projectAgentRoles(catalog, parent) {
|
|
|
34
37
|
disabled: policy.disabled,
|
|
35
38
|
...(suiteRoot === undefined ? {} : { suiteRoot }),
|
|
36
39
|
...(suiteData === undefined ? {} : { suiteData })
|
|
37
|
-
}
|
|
40
|
+
};
|
|
41
|
+
if (options.selected) {
|
|
42
|
+
if (!options.selected(entry))
|
|
43
|
+
continue;
|
|
44
|
+
entry.selectionEnabled = true;
|
|
45
|
+
}
|
|
46
|
+
entries.push(entry);
|
|
38
47
|
}
|
|
39
48
|
catch {
|
|
40
49
|
// Malformed routing metadata cannot authorize a project role.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/** Workspace-owned extension presets. Reads do not cache; writers serialize across local host processes. */
|
|
2
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
3
|
+
import { mkdir, readFile } from 'node:fs/promises';
|
|
4
|
+
import { dirname, isAbsolute, join, normalize } from 'node:path';
|
|
5
|
+
import { withFileLock } from '@deepseek-ai/dsh-atomic-write';
|
|
6
|
+
import { writeJsonDocument } from '../../../../market-catalog/src/index.js';
|
|
7
|
+
import { parseExtensionIds, parseExtensionName, stripConfigurationParentIds } from '../../../../market-contracts/src/contracts/extension-presets.js';
|
|
8
|
+
export class ExtensionPresetError extends Error {
|
|
9
|
+
code;
|
|
10
|
+
constructor(code, message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.code = code;
|
|
13
|
+
this.name = 'ExtensionPresetError';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function workspaceKey(workspace) {
|
|
17
|
+
if (!isAbsolute(workspace))
|
|
18
|
+
throw new Error('extension presets require an absolute workspace');
|
|
19
|
+
return normalize(workspace);
|
|
20
|
+
}
|
|
21
|
+
/** The workspace path is validated and hashed; names and clipboard data never determine a path. */
|
|
22
|
+
export function extensionPresetLibraryPath(dataRoot, workspace) {
|
|
23
|
+
return join(dataRoot, 'extension-presets', createHash('sha256').update(workspaceKey(workspace)).digest('hex') + '.json');
|
|
24
|
+
}
|
|
25
|
+
function record(value) {
|
|
26
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
27
|
+
throw new ExtensionPresetError('preset-state-invalid', 'invalid extension preset state');
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
function revision(value) {
|
|
31
|
+
if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0 || value === Number.MAX_SAFE_INTEGER) {
|
|
32
|
+
throw new ExtensionPresetError('preset-state-invalid', 'invalid extension preset revision');
|
|
33
|
+
}
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
function parsePreset(value) {
|
|
37
|
+
const row = record(value);
|
|
38
|
+
if (typeof row.id !== 'string' || row.id === '' || row.id.length > 128 || row.revision === 0) {
|
|
39
|
+
throw new ExtensionPresetError('preset-state-invalid', 'invalid extension preset identity');
|
|
40
|
+
}
|
|
41
|
+
return { id: row.id, revision: revision(row.revision), name: parseExtensionName(row.name), enabledIds: parseExtensionIds(row.enabledIds) };
|
|
42
|
+
}
|
|
43
|
+
function parseLibrary(value, workspace) {
|
|
44
|
+
if (value === undefined)
|
|
45
|
+
return { revision: 0, defaultPresetId: null, presets: [] };
|
|
46
|
+
const document = record(value);
|
|
47
|
+
if (document.version !== 1 || document.workspace !== workspaceKey(workspace) || !Array.isArray(document.presets) || document.presets.length > 256) {
|
|
48
|
+
throw new ExtensionPresetError('preset-state-invalid', 'invalid workspace extension preset library');
|
|
49
|
+
}
|
|
50
|
+
const presets = document.presets.map(parsePreset);
|
|
51
|
+
if (new Set(presets.map(preset => preset.id)).size !== presets.length || new Set(presets.map(preset => preset.name)).size !== presets.length) {
|
|
52
|
+
throw new ExtensionPresetError('preset-state-invalid', 'duplicate extension preset identity or name');
|
|
53
|
+
}
|
|
54
|
+
const defaultId = document.defaultPresetId;
|
|
55
|
+
if (defaultId !== null && (typeof defaultId !== 'string' || !presets.some(preset => preset.id === defaultId))) {
|
|
56
|
+
throw new ExtensionPresetError('preset-state-invalid', 'extension default refers to a missing preset');
|
|
57
|
+
}
|
|
58
|
+
return { revision: revision(document.revision), defaultPresetId: defaultId, presets };
|
|
59
|
+
}
|
|
60
|
+
export class ExtensionPresetStore {
|
|
61
|
+
dataRoot;
|
|
62
|
+
constructor(dataRoot) {
|
|
63
|
+
this.dataRoot = dataRoot;
|
|
64
|
+
}
|
|
65
|
+
/** Read current disk state; corruption and access failures reject rather than erasing saved choices. */
|
|
66
|
+
async read(workspace) {
|
|
67
|
+
let text;
|
|
68
|
+
try {
|
|
69
|
+
text = await readFile(extensionPresetLibraryPath(this.dataRoot, workspace), 'utf8');
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (error.code === 'ENOENT')
|
|
73
|
+
return parseLibrary(undefined, workspace);
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
return parseLibrary(JSON.parse(text), workspace);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
throw new ExtensionPresetError('preset-state-invalid', 'invalid workspace extension preset library');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** Create a named preset at the caller's observed library revision; configuration parents never persist. */
|
|
84
|
+
create(workspace, expectedRevision, input) {
|
|
85
|
+
const parsed = { name: parseExtensionName(input.name), enabledIds: stripConfigurationParentIds(parseExtensionIds(input.enabledIds)) };
|
|
86
|
+
return this.mutate(workspace, expectedRevision, library => {
|
|
87
|
+
if (library.presets.length >= 256)
|
|
88
|
+
throw new Error('workspace extension preset limit reached');
|
|
89
|
+
this.assertName(library, parsed.name);
|
|
90
|
+
library.presets.push({ ...parsed, id: randomUUID(), revision: 1 });
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/** Replace one preset and advance its revision; existing session snapshots are not touched. */
|
|
94
|
+
update(workspace, expectedRevision, id, input) {
|
|
95
|
+
const parsed = { name: parseExtensionName(input.name), enabledIds: stripConfigurationParentIds(parseExtensionIds(input.enabledIds)) };
|
|
96
|
+
return this.mutate(workspace, expectedRevision, library => {
|
|
97
|
+
const preset = this.requirePreset(library, id);
|
|
98
|
+
this.assertName(library, parsed.name, id);
|
|
99
|
+
Object.assign(preset, parsed, { revision: revision(preset.revision) + 1 });
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/** Choose only the default for future sessions. Null captures global choices for new sessions. */
|
|
103
|
+
setDefault(workspace, expectedRevision, id) {
|
|
104
|
+
return this.mutate(workspace, expectedRevision, library => {
|
|
105
|
+
if (id !== null)
|
|
106
|
+
this.requirePreset(library, id);
|
|
107
|
+
library.defaultPresetId = id;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/** Delete a preset and clear its default pointer atomically; sessions retain their copies. */
|
|
111
|
+
delete(workspace, expectedRevision, id) {
|
|
112
|
+
return this.mutate(workspace, expectedRevision, library => {
|
|
113
|
+
this.requirePreset(library, id);
|
|
114
|
+
library.presets = library.presets.filter(preset => preset.id !== id);
|
|
115
|
+
if (library.defaultPresetId === id)
|
|
116
|
+
library.defaultPresetId = null;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
requirePreset(library, id) {
|
|
120
|
+
const preset = library.presets.find(preset => preset.id === id);
|
|
121
|
+
if (preset === undefined)
|
|
122
|
+
throw new ExtensionPresetError('preset-not-found', 'extension preset no longer exists');
|
|
123
|
+
return preset;
|
|
124
|
+
}
|
|
125
|
+
assertName(library, name, exceptId) {
|
|
126
|
+
if (library.presets.some(preset => preset.name === name && preset.id !== exceptId)) {
|
|
127
|
+
throw new ExtensionPresetError('preset-name-conflict', 'an extension preset with this name already exists');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
async mutate(workspace, expectedRevision, change) {
|
|
131
|
+
revision(expectedRevision);
|
|
132
|
+
const path = extensionPresetLibraryPath(this.dataRoot, workspace);
|
|
133
|
+
await mkdir(dirname(path), { recursive: true, mode: 0o700 });
|
|
134
|
+
return withFileLock(path, async () => {
|
|
135
|
+
const library = await this.read(workspace);
|
|
136
|
+
if (library.revision !== expectedRevision)
|
|
137
|
+
throw new ExtensionPresetError('preset-conflict', 'extension presets changed; reload before saving');
|
|
138
|
+
change(library);
|
|
139
|
+
library.revision++;
|
|
140
|
+
await writeJsonDocument(path, { version: 1, workspace: workspaceKey(workspace), ...library });
|
|
141
|
+
return library;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persisted cross-project resource favorites under the plugin data root.
|
|
3
|
+
*
|
|
4
|
+
* One global file (`resource-favorites.json`): a favorite is this user's
|
|
5
|
+
* complete switch snapshot — six surface switches plus the per-entry filters —
|
|
6
|
+
* captured once and applicable in any workspace. It is deliberately not
|
|
7
|
+
* per-workspace state: the whole point is replaying one setup in another
|
|
8
|
+
* project, and the entry ids it stores are workspace-independent (suite and
|
|
9
|
+
* server identities, never absolute paths).
|
|
10
|
+
*
|
|
11
|
+
* @module application/state/resource-favorites
|
|
12
|
+
*/
|
|
13
|
+
import { randomUUID } from 'node:crypto';
|
|
14
|
+
import { mkdir } from 'node:fs/promises';
|
|
15
|
+
import { dirname, join } from 'node:path';
|
|
16
|
+
import { withFileLock } from '@deepseek-ai/dsh-atomic-write';
|
|
17
|
+
import { readJsonFile, writeJsonDocument } from '../../../../market-catalog/src/index.js';
|
|
18
|
+
import { resolveFavoriteInput } from '../../../../market-contracts/src/contracts/resource-window.js';
|
|
19
|
+
/** The favorites file lives at the data root, beside the surface-toggles directory. */
|
|
20
|
+
export function resourceFavoritesPath(dataRoot) {
|
|
21
|
+
return join(dataRoot, 'resource-favorites.json');
|
|
22
|
+
}
|
|
23
|
+
/** Parse one untrusted favorite wire record; malformed rows drop out. */
|
|
24
|
+
function resolveFavorite(row) {
|
|
25
|
+
const input = resolveFavoriteInput(row);
|
|
26
|
+
if (input === undefined)
|
|
27
|
+
return undefined;
|
|
28
|
+
if (typeof row !== 'object' || row === null)
|
|
29
|
+
return undefined;
|
|
30
|
+
const record = row;
|
|
31
|
+
const id = typeof record.id === 'string' && record.id !== '' ? record.id : undefined;
|
|
32
|
+
const createdAt = typeof record.createdAt === 'string' && record.createdAt !== '' ? record.createdAt : new Date(0).toISOString();
|
|
33
|
+
if (id === undefined)
|
|
34
|
+
return undefined;
|
|
35
|
+
return { id, name: input.name, createdAt, surfaces: input.surfaces, offEntries: input.offEntries };
|
|
36
|
+
}
|
|
37
|
+
/** Load the global favorite list; absent or malformed means none. */
|
|
38
|
+
export async function loadResourceFavorites(dataRoot) {
|
|
39
|
+
const value = await readJsonFile(resourceFavoritesPath(dataRoot));
|
|
40
|
+
if (typeof value !== 'object' || value === null)
|
|
41
|
+
return [];
|
|
42
|
+
const record = value;
|
|
43
|
+
if (!Array.isArray(record.favorites))
|
|
44
|
+
return [];
|
|
45
|
+
return record.favorites.flatMap(row => {
|
|
46
|
+
const favorite = resolveFavorite(row);
|
|
47
|
+
return favorite === undefined ? [] : [favorite];
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Apply one mutation to the committed list and persist it as one transaction.
|
|
52
|
+
*
|
|
53
|
+
* The whole read-modify-write runs under the published host file lock, so two
|
|
54
|
+
* operations can never each read the document before either writes it: the
|
|
55
|
+
* second one re-reads what the first committed and applies its own change on
|
|
56
|
+
* top. Readers stay lock-free — the atomic rename is what makes that safe — and
|
|
57
|
+
* a failed operation releases the lock through the helper's own teardown.
|
|
58
|
+
* @param dataRoot - the plugin's own storage root.
|
|
59
|
+
* @param mutate - pure change applied to the freshly read list.
|
|
60
|
+
* @returns the list as committed.
|
|
61
|
+
*/
|
|
62
|
+
async function mutateFavorites(dataRoot, mutate) {
|
|
63
|
+
const path = resourceFavoritesPath(dataRoot);
|
|
64
|
+
await mkdir(dirname(path), { recursive: true, mode: 0o700 });
|
|
65
|
+
return withFileLock(path, async () => {
|
|
66
|
+
const next = mutate(await loadResourceFavorites(dataRoot));
|
|
67
|
+
const document = { version: 1, favorites: next };
|
|
68
|
+
await writeJsonDocument(path, document);
|
|
69
|
+
return next;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/** Append one favorite and return the stored row. */
|
|
73
|
+
export async function saveResourceFavorite(dataRoot, input) {
|
|
74
|
+
// Capture the caller's values before any await: the stored row is the snapshot
|
|
75
|
+
// the call was made with, whatever the caller does to its own object after.
|
|
76
|
+
const captured = structuredClone(input);
|
|
77
|
+
const favorite = {
|
|
78
|
+
id: randomUUID(),
|
|
79
|
+
name: captured.name,
|
|
80
|
+
createdAt: new Date().toISOString(),
|
|
81
|
+
surfaces: captured.surfaces,
|
|
82
|
+
offEntries: captured.offEntries
|
|
83
|
+
};
|
|
84
|
+
await mutateFavorites(dataRoot, favorites => [...favorites, favorite]);
|
|
85
|
+
return favorite;
|
|
86
|
+
}
|
|
87
|
+
/** Drop one favorite by id; a missing id is a no-op. */
|
|
88
|
+
export async function deleteResourceFavorite(dataRoot, id) {
|
|
89
|
+
await mutateFavorites(dataRoot, favorites => favorites.filter(favorite => favorite.id !== id));
|
|
90
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { loadResourceFilters, mutateResourceFilters } from './workspace-policy.js';
|
|
2
|
+
export { surfaceTogglesPath } from './workspace-policy.js';
|
|
3
|
+
export async function loadSurfaceToggles(dataRoot, workspace) {
|
|
4
|
+
return (await loadResourceFilters(dataRoot, workspace)).toggles;
|
|
5
|
+
}
|
|
6
|
+
/** Replace surface choices while preserving the latest committed entry choices. */
|
|
7
|
+
export async function saveSurfaceToggles(dataRoot, workspace, toggles) {
|
|
8
|
+
const captured = structuredClone(toggles);
|
|
9
|
+
await mutateResourceFilters(dataRoot, workspace, current => ({ ...current, toggles: captured }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** One persisted workspace policy and its atomic read-modify-write operation. */
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { mkdir } from 'node:fs/promises';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { withFileLock } from '@deepseek-ai/dsh-atomic-write';
|
|
6
|
+
import { readJsonFile, writeJsonDocument } from '../../../../market-catalog/src/index.js';
|
|
7
|
+
import { ALL_SURFACES_ON, resolveSurfaceToggles, SURFACE_TOGGLE_KEYS } from '../../../../market-contracts/src/contracts/surface-toggles.js';
|
|
8
|
+
export function allFiltersOn() {
|
|
9
|
+
return { toggles: { ...ALL_SURFACES_ON }, offEntries: {} };
|
|
10
|
+
}
|
|
11
|
+
/** Preserve the existing workspace hash and file location. */
|
|
12
|
+
export function surfaceTogglesPath(dataRoot, workspace) {
|
|
13
|
+
const key = createHash('sha256').update(workspace).digest('hex').slice(0, 24);
|
|
14
|
+
return join(dataRoot, 'surface-toggles', key + '.json');
|
|
15
|
+
}
|
|
16
|
+
export function resolveOffEntries(value) {
|
|
17
|
+
if (typeof value !== 'object' || value === null)
|
|
18
|
+
return {};
|
|
19
|
+
const record = value;
|
|
20
|
+
const out = {};
|
|
21
|
+
for (const face of SURFACE_TOGGLE_KEYS) {
|
|
22
|
+
const raw = record[face];
|
|
23
|
+
if (!Array.isArray(raw))
|
|
24
|
+
continue;
|
|
25
|
+
const ids = raw.filter((id) => typeof id === 'string' && id !== '');
|
|
26
|
+
if (ids.length > 0)
|
|
27
|
+
out[face] = ids;
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
/** v1 and v2 share field names. Invalid JSON and access failures still reject. */
|
|
32
|
+
export async function loadResourceFilters(dataRoot, workspace) {
|
|
33
|
+
const value = await readJsonFile(surfaceTogglesPath(dataRoot, workspace));
|
|
34
|
+
if (value === undefined)
|
|
35
|
+
return allFiltersOn();
|
|
36
|
+
const record = (typeof value === 'object' && value !== null ? value : {});
|
|
37
|
+
return { toggles: resolveSurfaceToggles(record.toggles), offEntries: resolveOffEntries(record.entries) };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Re-read under the published host file lock, persist once, then return the committed snapshot.
|
|
41
|
+
* The mutation stays synchronous; no runtime refresh or caller callback runs under the file lock.
|
|
42
|
+
*/
|
|
43
|
+
export async function mutateResourceFilters(dataRoot, workspace, mutate) {
|
|
44
|
+
const path = surfaceTogglesPath(dataRoot, workspace);
|
|
45
|
+
await mkdir(dirname(path), { recursive: true, mode: 0o700 });
|
|
46
|
+
return withFileLock(path, async () => {
|
|
47
|
+
const next = mutate(await loadResourceFilters(dataRoot, workspace));
|
|
48
|
+
await writeJsonDocument(path, { version: 2, workspace, toggles: next.toggles, entries: next.offEntries });
|
|
49
|
+
return next;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/** Replace both policy sections as one transaction. */
|
|
53
|
+
export async function saveResourceFilters(dataRoot, workspace, filters) {
|
|
54
|
+
const captured = structuredClone(filters);
|
|
55
|
+
await mutateResourceFilters(dataRoot, workspace, () => captured);
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Explicit cross-domain entry surface. Internal modules are not import targets for siblings. */
|
|
2
|
+
export { extensionResourceEnabled } from './application/extension-authorization.js';
|
|
3
|
+
export { exposesIndividualHooks } from './application/extension-hook-selection.js';
|
|
4
|
+
export { USER_HOOKS_SOURCE, USER_HOOKS_SUITE, loadUserHooksSuite } from './application/panels/user-hooks.js';
|
|
5
|
+
export { createPanelResources, pluginResourceId } from './application/panel-resources.js';
|
|
6
|
+
export { readExtensionSuiteDeclarations } from './application/extension-suite-declarations.js';
|
|
7
|
+
export { RuntimeReconciler } from './runtime/core/reconciler.js';
|
|
8
|
+
export { ReconcileScheduler } from './runtime/core/reconcile-scheduler.js';
|
|
9
|
+
export { SurfaceToggleService } from './runtime/host/surface-toggle-service.js';
|
|
10
|
+
export { inspectToolRegistry, toolsServiceOf } from './runtime/host/tool-registry-observer.js';
|
|
11
|
+
export { mountAgentRoleTool } from './runtime/agents/agent-role-router.js';
|
|
12
|
+
export { mountUnlessAgentTeams } from './runtime/agents/agent-teams-seat.js';
|
|
13
|
+
export { mountTeammateRoleTool } from './runtime/agents/teammate-role-tool.js';
|
|
14
|
+
export { mountTeamCoordination } from './runtime/agents/team-coordination.js';
|
|
15
|
+
export { projectAgentRoles } from './application/project-agent-roles.js';
|
|
16
|
+
export { ExtensionRuntime, extensionWorkspace } from './runtime/host/extension-runtime.js';
|
|
17
|
+
export { attachExtensionToolGates } from './runtime/host/extension-tool-gates.js';
|
|
18
|
+
export { ScopedExtensionContributors } from './runtime/host/scoped-contributors.js';
|
|
19
|
+
export { projectExtensionSuites, suiteOwnsResourceId } from './application/extension-suite-selection.js';
|
|
20
|
+
export { ResourceFilterService } from './runtime/host/resource-filter-service.js';
|
|
21
|
+
export { shellSeamOf } from './runtime/surfaces/dynamic-context.js';
|
|
22
|
+
export { HOOK_RUN_DEFAULT_TIMEOUT_SEC, HOOK_RUN_FAILED, HOOK_RUN_MAX_OUTPUT_CHARS, HOOK_RUN_MAX_TIMEOUT_MS, HOOK_RUN_NO_COMMAND, HOOK_RUN_SHELL_UNAVAILABLE, HOOK_RUN_UNKNOWN_DECLARATION, hookRunFailure, hookRunShellOf, hookRunStdin, runHookDryRun } from './runtime/surfaces/hook-dry-run.js';
|
|
23
|
+
export { LOCALE_SETTINGS_ENTRY, bindHostLocale, readHostLocalePreference, readLocalePreference, setHostLocaleSource } from './runtime/host/host-locale.js';
|
|
24
|
+
export { UserPanelSkillProvider, createUserPanelStores } from './runtime/panels/user-panels.js';
|
|
25
|
+
export { SourceAutoUpdater } from './runtime/core/source-auto-update.js';
|
|
26
|
+
export { collectMenuRowIdentities } from './runtime/host/menu-row-identities.js';
|
|
27
|
+
export { readModelCatalog } from './runtime/host/model-catalog.js';
|
|
28
|
+
export { RetryScheduler, SerialPassQueue } from './runtime/core/mount-lifecycle.js';
|
|
29
|
+
export { causeMessages } from './runtime/host/failure-detail.js';
|
|
30
|
+
export { resolveDeclaredCommand } from './runtime/host/shell-path.js';
|
|
31
|
+
export { optionalService } from './runtime/core/context.js';
|