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
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** One live workspace policy snapshot. Publication follows successful persistence. */
|
|
2
|
+
import type { ResourceFace, ResourceFavoriteWire } from '../../../../market-contracts/src/contracts/resource-window.js';
|
|
3
|
+
import { type SurfaceToggleKey, type SurfaceToggles } from '../../../../market-contracts/src/contracts/surface-toggles.js';
|
|
4
|
+
import { type ResourceFilters } from '../../application/state/workspace-policy.js';
|
|
5
|
+
import type { ResourceFavoriteInput } from '../../../../market-contracts/src/contracts/resource-window.js';
|
|
6
|
+
export interface ResourceFilterHooks {
|
|
7
|
+
onFiltersChanged(): Promise<void> | void;
|
|
8
|
+
}
|
|
9
|
+
export declare class ResourceFilterService {
|
|
10
|
+
private readonly dataRoot;
|
|
11
|
+
private readonly hooks;
|
|
12
|
+
private filters;
|
|
13
|
+
private readonly workspace;
|
|
14
|
+
private tail;
|
|
15
|
+
constructor(dataRoot: string, workspace: string | undefined, hooks: ResourceFilterHooks);
|
|
16
|
+
private enqueue;
|
|
17
|
+
/** Reload shares mutation ordering; an earlier read cannot overwrite a later write. */
|
|
18
|
+
reload(): Promise<void>;
|
|
19
|
+
/** Callers receive detached data, never the owner's mutable snapshot. */
|
|
20
|
+
currentFilters(): ResourceFilters;
|
|
21
|
+
currentToggles(): SurfaceToggles;
|
|
22
|
+
allowsSurface(key: SurfaceToggleKey): boolean;
|
|
23
|
+
allowsEntry(face: ResourceFace, entryId: string): boolean;
|
|
24
|
+
allows(face: ResourceFace, entryId: string): boolean;
|
|
25
|
+
offEntriesOf(face: ResourceFace): string[];
|
|
26
|
+
private mutate;
|
|
27
|
+
setSurface(key: SurfaceToggleKey, enabled: boolean): Promise<SurfaceToggles>;
|
|
28
|
+
setEntry(face: ResourceFace, entryId: string, enabled: boolean): Promise<ResourceFilters>;
|
|
29
|
+
/** One complete commit and one refresh. Failed refresh does not roll back persisted state. */
|
|
30
|
+
applyFilters(toggles: SurfaceToggles, offEntries: Partial<Record<ResourceFace, string[]>>): Promise<ResourceFilters>;
|
|
31
|
+
favorites(): Promise<ResourceFavoriteWire[]>;
|
|
32
|
+
saveFavorite(input: ResourceFavoriteInput): Promise<ResourceFavoriteWire>;
|
|
33
|
+
deleteFavorite(id: string): Promise<void>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** Agent-owned extension registrations; pending targets prepare data, committed policy authorizes effects. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
4
|
+
import type { CatalogPort as Catalog } from '../../catalog-port.js';
|
|
5
|
+
import { type ExtensionSelection } from '../../../../market-contracts/src/contracts/extension-presets.js';
|
|
6
|
+
import type { Suite } from '../../../../market-contracts/src/model/types.js';
|
|
7
|
+
import type { ShellSeam } from '../surfaces/dynamic-context.js';
|
|
8
|
+
import { type UserPanelStore } from '../panels/user-panels.js';
|
|
9
|
+
import { type HostTranslate } from './host-locale.js';
|
|
10
|
+
import type { McpMountFactory } from '../../adapter-contracts.js';
|
|
11
|
+
import type { ExtensionMcpTool } from './extension-tool-gates.js';
|
|
12
|
+
import type { MenuRowRegistration } from './menu-row-identities.js';
|
|
13
|
+
export interface ScopedContributorPorts {
|
|
14
|
+
dataRoot: string;
|
|
15
|
+
catalog: Catalog;
|
|
16
|
+
/** Validated selected projections; may read pending selection during registration, never grants execution. */
|
|
17
|
+
suites?(agent: Agent): Promise<Suite[]>;
|
|
18
|
+
shell: () => ShellSeam | undefined;
|
|
19
|
+
allows(agent: Agent, resourceId: string, suiteId?: string): boolean;
|
|
20
|
+
registrationAllows?(agent: Agent, resourceId: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Creates one MCP mount over the context it is given. The composition root
|
|
23
|
+
* supplies the adapter, so this module never imports a transport package; the
|
|
24
|
+
* agent-scoped mount and the workspace-pooled host bridge both come from it.
|
|
25
|
+
*/
|
|
26
|
+
mcpMounts: McpMountFactory;
|
|
27
|
+
/** Production supplies panels; omission supports a skill-provider-only consumer. */
|
|
28
|
+
panels?: {
|
|
29
|
+
commands: UserPanelStore;
|
|
30
|
+
skills?: UserPanelStore;
|
|
31
|
+
};
|
|
32
|
+
t?: HostTranslate;
|
|
33
|
+
/** Plugin-owned root context for workspace-pooled host-compatibility MCP. */
|
|
34
|
+
hostContext?: Context;
|
|
35
|
+
}
|
|
36
|
+
export declare class ScopedExtensionContributors {
|
|
37
|
+
private readonly ports;
|
|
38
|
+
private readonly mounted;
|
|
39
|
+
private readonly hostMcp;
|
|
40
|
+
private readonly hostQueues;
|
|
41
|
+
constructor(ports: ScopedContributorPorts);
|
|
42
|
+
private registrationAllows;
|
|
43
|
+
private registerSkills;
|
|
44
|
+
private attach;
|
|
45
|
+
/** Called inside the session maintenance transaction, before its committed record. */
|
|
46
|
+
reconcile(agent: Agent, selection: ExtensionSelection): Promise<void>;
|
|
47
|
+
private hostOperation;
|
|
48
|
+
private reconcileHostMcp;
|
|
49
|
+
private releaseHostMcp;
|
|
50
|
+
committed(agent: Agent): void;
|
|
51
|
+
/** Invalidate cached summaries and run startup hooks only after the session is durably ready. */
|
|
52
|
+
ready(agent: Agent, source?: string): Promise<void>;
|
|
53
|
+
invalidateAll(): void;
|
|
54
|
+
toolOwnership(agent: Agent): ExtensionMcpTool[];
|
|
55
|
+
registrations(): MenuRowRegistration[];
|
|
56
|
+
dispose(agent: Agent): Promise<void>;
|
|
57
|
+
disposeAll(): Promise<void>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Legacy surface API over the shared policy owner; no independent state or persistence. */
|
|
2
|
+
import type { SurfaceToggleKey, SurfaceToggles } from '../../../../market-contracts/src/contracts/surface-toggles.js';
|
|
3
|
+
import type { ResourceFilterService } from './resource-filter-service.js';
|
|
4
|
+
export declare class SurfaceToggleService {
|
|
5
|
+
private readonly owner;
|
|
6
|
+
constructor(owner: ResourceFilterService);
|
|
7
|
+
reload(): Promise<void>;
|
|
8
|
+
currentToggles(): SurfaceToggles;
|
|
9
|
+
set(key: SurfaceToggleKey, enabled: boolean): Promise<SurfaceToggles>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User command mounting: every enabled entry of the user commands panel
|
|
3
|
+
* registers as a dsh slash command, so user-authored quick replies behave
|
|
4
|
+
* exactly like suite commands — the body with `$ARGUMENTS` substituted rides
|
|
5
|
+
* one follow-up message on the receiving agent. A nested entry registers
|
|
6
|
+
* under its flattened call name (`git/commit` → `git-commit`) while the panel
|
|
7
|
+
* keeps addressing it by path; when two entries flatten to one call name the
|
|
8
|
+
* later one takes a numeric suffix (`git-commit-1`) and is reported, because a
|
|
9
|
+
* second registration of one name is what makes the host's slash menu drop it.
|
|
10
|
+
* Reconciled on every catalog change, keyed by the entry path.
|
|
11
|
+
* @module runtime/user-commands
|
|
12
|
+
*/
|
|
13
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
14
|
+
import type { HostTranslate } from '../host/host-locale.js';
|
|
15
|
+
import type { UserPanelStore } from './user-panels.js';
|
|
16
|
+
import type { MenuRowRegistration } from '../host/menu-row-identities.js';
|
|
17
|
+
/** Register/unregister user-panel commands to match the panel's enabled entries. */
|
|
18
|
+
export declare class UserCommandMountRegistry {
|
|
19
|
+
private readonly ctx;
|
|
20
|
+
private readonly store;
|
|
21
|
+
private readonly t;
|
|
22
|
+
private readonly fingerprints;
|
|
23
|
+
private readonly live;
|
|
24
|
+
/**
|
|
25
|
+
* The call names this seat holds, and the entry each one was registered for.
|
|
26
|
+
*
|
|
27
|
+
* Occupancy is per layer, which is the unit the host checks: this registry
|
|
28
|
+
* registers into the global layer, so its names must be unique among
|
|
29
|
+
* themselves and against every other registration in that layer.
|
|
30
|
+
*/
|
|
31
|
+
private readonly names;
|
|
32
|
+
private readonly registeredName;
|
|
33
|
+
/** The menu row each live registration produces, with the panel id it translates as. */
|
|
34
|
+
private readonly registered;
|
|
35
|
+
/** Per-workspace entry filter; an absent provider registers everything wanted. */
|
|
36
|
+
private entryFilter;
|
|
37
|
+
private selectionPolicy;
|
|
38
|
+
private registrationPolicy;
|
|
39
|
+
private allowDisabled;
|
|
40
|
+
constructor(ctx: Context, store: UserPanelStore, t: HostTranslate);
|
|
41
|
+
/**
|
|
42
|
+
* Install the per-workspace entry filter read at wanted-row time, keyed by
|
|
43
|
+
* the panel path name the resource window lists (`commands:${entry.name}`).
|
|
44
|
+
*/
|
|
45
|
+
setEntryFilter(filter: () => {
|
|
46
|
+
allows(face: 'commands', entryId: string): boolean;
|
|
47
|
+
}): void;
|
|
48
|
+
/** Gate reconcile and execution by the original panel path name; unset allows all. */
|
|
49
|
+
setSelectionPolicy(callback: (name: string) => boolean, registration?: (name: string) => boolean, options?: {
|
|
50
|
+
allowDisabled?: boolean;
|
|
51
|
+
}): void;
|
|
52
|
+
/**
|
|
53
|
+
* Sync the live registrations with the panel's enabled entries.
|
|
54
|
+
*
|
|
55
|
+
* A switched-off commands surface reconciles against no entries at all,
|
|
56
|
+
* which unregisters whatever is live — skipping the pass would leave the
|
|
57
|
+
* previous registrations mounted after the switch went off.
|
|
58
|
+
* @param allow - whether the workspace's commands switch is on.
|
|
59
|
+
*/
|
|
60
|
+
reconcile(allow?: boolean): Promise<string[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Every command this seat currently holds: the call name the menu row carries
|
|
63
|
+
* and the panel identity that owns its translation.
|
|
64
|
+
*
|
|
65
|
+
* The registry is the only place that knows a name allocation suffixed, and a
|
|
66
|
+
* user entry's panel identity is the entry name the panel lists.
|
|
67
|
+
* @returns one row per live registration, in registration-key order.
|
|
68
|
+
*/
|
|
69
|
+
registrations(): MenuRowRegistration[];
|
|
70
|
+
/** Dispose every registration (plugin teardown). */
|
|
71
|
+
disposeAll(): void;
|
|
72
|
+
/** Free the call name one unmounted entry held, so a later claim can reuse it. */
|
|
73
|
+
private releaseName;
|
|
74
|
+
}
|
|
@@ -142,14 +142,20 @@ export declare function createUserPanelStores(agentsRoot: string): {
|
|
|
142
142
|
* command grammar (`_` allowed).
|
|
143
143
|
*/
|
|
144
144
|
export declare function isUserSkillEntryName(name: string): boolean;
|
|
145
|
+
export interface UserPanelSkillProviderOptions {
|
|
146
|
+
/** Session-local choice. Valid unselected entries remain non-invocable shadows; absent preserves global switches. */
|
|
147
|
+
enabled?: (entry: UserPanelEntry) => boolean;
|
|
148
|
+
}
|
|
145
149
|
/**
|
|
146
150
|
* Skill provider over user skills only. Agent definitions belong to the
|
|
147
151
|
* subagent catalog and never become skill candidates or slash entries.
|
|
148
152
|
*/
|
|
149
153
|
export declare class UserPanelSkillProvider implements SkillProvider {
|
|
150
154
|
private readonly skills;
|
|
155
|
+
private readonly options;
|
|
151
156
|
readonly name = "user-panel";
|
|
152
|
-
constructor(skills: UserPanelStore);
|
|
157
|
+
constructor(skills: UserPanelStore, options?: UserPanelSkillProviderOptions);
|
|
158
|
+
private invocation;
|
|
153
159
|
list(_options: SkillLookupOptions): Promise<SkillCandidate[]>;
|
|
154
160
|
get(candidate: SkillCandidate, _options: SkillLookupOptions): Promise<SkillDefinition | undefined>;
|
|
155
161
|
/**
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code command compatibility: `commands/*.md` of enabled suites
|
|
3
|
+
* register as dsh slash commands.
|
|
4
|
+
*
|
|
5
|
+
* A CC command is a prompt template the model executes (its body carries
|
|
6
|
+
* `$ARGUMENTS`, path variables and `` !`cmd` `` dynamic-context placeholders),
|
|
7
|
+
* so the handler maps it onto the harness's follow-up mechanism: the template
|
|
8
|
+
* with those placeholders resolved becomes one durable user-role follow-up
|
|
9
|
+
* message on the receiving agent. Registrations reconcile on every
|
|
10
|
+
* enable/disable/install/uninstall; a broken command file, a failed injected
|
|
11
|
+
* command, or an unavailable `ctx.commands` is contained per command and
|
|
12
|
+
* reported as a diagnostic.
|
|
13
|
+
*/
|
|
14
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
15
|
+
import type { Suite } from '../../../../market-contracts/src/model/types.js';
|
|
16
|
+
export { readCommands } from '../../application/command-resources.js';
|
|
17
|
+
import { type HostTranslate } from '../host/host-locale.js';
|
|
18
|
+
import type { MenuRowRegistration } from '../host/menu-row-identities.js';
|
|
19
|
+
export interface CommandMountDiagnostic {
|
|
20
|
+
suiteId: string;
|
|
21
|
+
command: string;
|
|
22
|
+
reason: string;
|
|
23
|
+
}
|
|
24
|
+
export declare class CommandMountRegistry {
|
|
25
|
+
private readonly ctx;
|
|
26
|
+
private readonly t;
|
|
27
|
+
private readonly dataRoot?;
|
|
28
|
+
private readonly fingerprints;
|
|
29
|
+
private readonly live;
|
|
30
|
+
/**
|
|
31
|
+
* The call names this seat holds, and the keys they were registered under.
|
|
32
|
+
*
|
|
33
|
+
* Occupancy is per layer, which is the unit the host checks: this registry
|
|
34
|
+
* instance registers into one layer (an agent's scope on the project path,
|
|
35
|
+
* the global layer on the user path), and a sibling registry in another
|
|
36
|
+
* layer neither sees nor is seen by these names.
|
|
37
|
+
*/
|
|
38
|
+
private readonly names;
|
|
39
|
+
private readonly registeredName;
|
|
40
|
+
/** The menu row each live registration produces, with the panel id it translates as. */
|
|
41
|
+
private readonly registered;
|
|
42
|
+
/** Per-workspace entry filter; an absent provider registers everything wanted. */
|
|
43
|
+
private entryFilter;
|
|
44
|
+
private selectionPolicy;
|
|
45
|
+
private registrationPolicy;
|
|
46
|
+
private allowDisabled;
|
|
47
|
+
constructor(ctx: Context, t?: HostTranslate, dataRoot?: string | undefined);
|
|
48
|
+
/**
|
|
49
|
+
* Install the per-workspace entry filter read at wanted-row time. A filtered
|
|
50
|
+
* command never becomes wanted, which unregisters it through the ordinary
|
|
51
|
+
* reconcile pass — the same path a removed command file takes.
|
|
52
|
+
*/
|
|
53
|
+
setEntryFilter(filter: () => {
|
|
54
|
+
allows(face: 'commands', entryId: string): boolean;
|
|
55
|
+
}): void;
|
|
56
|
+
/**
|
|
57
|
+
* Gate reconcile and execution by owning suite and authored resource name,
|
|
58
|
+
* before call-name flattening or collision allocation. Unset allows all.
|
|
59
|
+
*/
|
|
60
|
+
setSelectionPolicy(callback: (suite: Suite, commandName: string) => boolean, registration?: (suite: Suite, commandName: string) => boolean, options?: {
|
|
61
|
+
allowDisabled?: boolean;
|
|
62
|
+
}): void;
|
|
63
|
+
/** The live shell seam, when the profile has one; dynamic context stays literal without it. */
|
|
64
|
+
private shell;
|
|
65
|
+
/** Register/unregister suite commands to match the enabled suites exactly. */
|
|
66
|
+
reconcile(enabledSuites: Suite[]): Promise<CommandMountDiagnostic[]>;
|
|
67
|
+
/**
|
|
68
|
+
* Every command this layer currently holds: the call name the menu row
|
|
69
|
+
* carries and the panel identity that owns its translation.
|
|
70
|
+
*
|
|
71
|
+
* Two files of one suite can flatten to the same call name, so the
|
|
72
|
+
* registration key (not the name) is what tells those rows apart; each one
|
|
73
|
+
* keeps its own resource name and therefore its own translation id.
|
|
74
|
+
* @returns one row per live registration, in registration-key order.
|
|
75
|
+
*/
|
|
76
|
+
registrations(): MenuRowRegistration[];
|
|
77
|
+
/** Dispose every registered command; used at plugin teardown. */
|
|
78
|
+
disposeAll(): void;
|
|
79
|
+
/** Free the call name one unmounted key held, so a later claim can reuse it. */
|
|
80
|
+
private releaseName;
|
|
81
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { Agent } from '@deepseek-ai/dsh-agent';
|
|
3
|
+
import type { Suite } from '../../../../market-contracts/src/model/types.js';
|
|
4
|
+
import { type HooksMountDiagnostic } from './hooks-mounts.js';
|
|
5
|
+
type Source = 'startup' | 'resume';
|
|
6
|
+
/**
|
|
7
|
+
* Own one live Agent's hooks. Supply a live context injected with shell and
|
|
8
|
+
* sessionProjections, plus a synchronous live authorization check. Reconcile before
|
|
9
|
+
* awaiting start; agent/created is deliberately not observed. Dispose before the
|
|
10
|
+
* Agent or its context tears down. Each command rechecks authorization.
|
|
11
|
+
* Subagent events use the exact parent carrier, but identify the child on stdin.
|
|
12
|
+
* Like the host bridge, input rewrites, systemMessage and run-level halt are not
|
|
13
|
+
* applied; SubagentStop is observation-only. Unknown remote child cwd is empty.
|
|
14
|
+
* Every command receives its suite's path variables in the process environment,
|
|
15
|
+
* the same values its command string expands to.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ExtensionHooks {
|
|
18
|
+
private readonly ctx;
|
|
19
|
+
private readonly agent;
|
|
20
|
+
private readonly isSuiteAllowed;
|
|
21
|
+
/**
|
|
22
|
+
* Live check for one hook's own identity: the event and its declaration index,
|
|
23
|
+
* the same position the session inventory published a row for. Absent keeps the
|
|
24
|
+
* parent-suite contract, which is what a suite with no individual row requires.
|
|
25
|
+
*/
|
|
26
|
+
private readonly isHookAllowed?;
|
|
27
|
+
/** Plugin storage root; supplies the suite's data directory to hook processes. */
|
|
28
|
+
private readonly dataRoot?;
|
|
29
|
+
private selected;
|
|
30
|
+
private pending;
|
|
31
|
+
private readonly runs;
|
|
32
|
+
private readonly listeners;
|
|
33
|
+
private readonly children;
|
|
34
|
+
private startup?;
|
|
35
|
+
private closing?;
|
|
36
|
+
private disposed;
|
|
37
|
+
private revision;
|
|
38
|
+
private handler;
|
|
39
|
+
constructor(ctx: Context, agent: Agent, isSuiteAllowed: (suite: Suite) => boolean,
|
|
40
|
+
/**
|
|
41
|
+
* Live check for one hook's own identity: the event and its declaration index,
|
|
42
|
+
* the same position the session inventory published a row for. Absent keeps the
|
|
43
|
+
* parent-suite contract, which is what a suite with no individual row requires.
|
|
44
|
+
*/
|
|
45
|
+
isHookAllowed?: ((suite: Suite, event: string, index: number) => boolean) | undefined,
|
|
46
|
+
/** Plugin storage root; supplies the suite's data directory to hook processes. */
|
|
47
|
+
dataRoot?: string | undefined);
|
|
48
|
+
/** Replace selection; malformed suites are dropped with diagnostics. Does not replay startup. */
|
|
49
|
+
reconcile(suites: readonly Suite[]): Promise<HooksMountDiagnostic[]>;
|
|
50
|
+
/** Run SessionStart once, after already-submitted reconciliation, and await its context injection. */
|
|
51
|
+
start(source: Source, signal?: AbortSignal): Promise<void>;
|
|
52
|
+
/** Stop admission, unregister listeners, abort and await owned runs. Repeated calls share completion. */
|
|
53
|
+
dispose(): Promise<void>;
|
|
54
|
+
private observeSubagent;
|
|
55
|
+
private track;
|
|
56
|
+
private lastTurn;
|
|
57
|
+
private runPoint;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { ExtensionHookRunResult } from '../../../../market-contracts/src/contracts/extension-presets.js';
|
|
2
|
+
/** Per-stream cap, in characters, on the output one result carries. */
|
|
3
|
+
export declare const HOOK_RUN_MAX_OUTPUT_CHARS = 32768;
|
|
4
|
+
/** Timeout applied when the declaration carries none. */
|
|
5
|
+
export declare const HOOK_RUN_DEFAULT_TIMEOUT_SEC = 30;
|
|
6
|
+
/** Hard ceiling on any dry run, whatever the declaration asks for. */
|
|
7
|
+
export declare const HOOK_RUN_MAX_TIMEOUT_MS = 60000;
|
|
8
|
+
/** A resolved declaration that named no runnable hook. */
|
|
9
|
+
export declare const HOOK_RUN_UNKNOWN_DECLARATION = "hook-run-unknown-declaration";
|
|
10
|
+
/** A matched declaration that carries no command (a rejected declaration exists only as a diagnostic). */
|
|
11
|
+
export declare const HOOK_RUN_NO_COMMAND = "hook-run-no-command";
|
|
12
|
+
/** No shell executor is mounted in this profile. */
|
|
13
|
+
export declare const HOOK_RUN_SHELL_UNAVAILABLE = "hook-run-shell-unavailable";
|
|
14
|
+
/** The executor rejected the run before it produced an outcome. */
|
|
15
|
+
export declare const HOOK_RUN_FAILED = "hook-run-failed";
|
|
16
|
+
/** The slice of the host shell executor this module uses. */
|
|
17
|
+
export interface HookRunShellRequest {
|
|
18
|
+
command: string;
|
|
19
|
+
workdir?: string;
|
|
20
|
+
timeoutMs?: number;
|
|
21
|
+
stdin?: string;
|
|
22
|
+
env?: Record<string, string>;
|
|
23
|
+
stdoutMaxBytes?: number;
|
|
24
|
+
}
|
|
25
|
+
/** The fields of one shell run this module reads. */
|
|
26
|
+
export interface HookRunShellResult {
|
|
27
|
+
exitCode: number | null;
|
|
28
|
+
timedOut: boolean;
|
|
29
|
+
aborted: boolean;
|
|
30
|
+
stdout: {
|
|
31
|
+
text: string;
|
|
32
|
+
truncated: boolean;
|
|
33
|
+
};
|
|
34
|
+
stderr: {
|
|
35
|
+
text: string;
|
|
36
|
+
truncated: boolean;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** The host shell executor, reached structurally so a missing service stays optional. */
|
|
40
|
+
export interface HookRunShell {
|
|
41
|
+
resolve(request: HookRunShellRequest): unknown;
|
|
42
|
+
execute(spec: unknown): Promise<{
|
|
43
|
+
result(): Promise<HookRunShellResult>;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Narrow a resolved shell seam to the executor surface, or answer undefined.
|
|
48
|
+
*
|
|
49
|
+
* The seam is read without injecting shell, so its value is untyped at the
|
|
50
|
+
* boundary. A service that only exposes the legacy run shape is not an
|
|
51
|
+
* executor and is reported as unavailable rather than run against.
|
|
52
|
+
* @param value - the service resolved from the context, if any.
|
|
53
|
+
* @returns the executor surface, or undefined when no executor is mounted.
|
|
54
|
+
*/
|
|
55
|
+
export declare function hookRunShellOf(value: unknown): HookRunShell | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* The synthetic stdin payload one dry run writes.
|
|
58
|
+
*
|
|
59
|
+
* It carries the same event name the declaration fired under and the directory
|
|
60
|
+
* the command runs in, so a script that reads stdin sees a coherent event,
|
|
61
|
+
* plus dry_run: true so it can refuse to act for real.
|
|
62
|
+
* @param event - the declared event the hook belongs to.
|
|
63
|
+
* @param cwd - the directory the command runs in.
|
|
64
|
+
* @returns the JSON payload, newline terminated.
|
|
65
|
+
*/
|
|
66
|
+
export declare function hookRunStdin(event: string, cwd: string): string;
|
|
67
|
+
/** One result that reports a failure without running anything. */
|
|
68
|
+
export declare function hookRunFailure(code: string): ExtensionHookRunResult;
|
|
69
|
+
/** How one resolved declaration runs. */
|
|
70
|
+
export interface HookDryRunOptions {
|
|
71
|
+
/** The event the declaration belongs to. */
|
|
72
|
+
event: string;
|
|
73
|
+
/** The declaration's own timeout in seconds; absent uses the module default. */
|
|
74
|
+
timeoutSec?: number;
|
|
75
|
+
/** The suite's path variables as process environment. */
|
|
76
|
+
env?: Record<string, string>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Run one resolved command in the home directory under a bounded timeout.
|
|
80
|
+
*
|
|
81
|
+
* The timeout is the declaration's own, defaulted to HOOK_RUN_DEFAULT_TIMEOUT_SEC
|
|
82
|
+
* and capped at HOOK_RUN_MAX_TIMEOUT_MS; the command's cwd is the home
|
|
83
|
+
* directory whatever the caller passes elsewhere. Both streams are capped
|
|
84
|
+
* independently, and an executor rejection becomes a result, so the request
|
|
85
|
+
* never fails with a thrown error.
|
|
86
|
+
* @param shell - the resolved host shell executor.
|
|
87
|
+
* @param command - the declaration's own command text.
|
|
88
|
+
* @param options - the event, declared timeout, and suite environment.
|
|
89
|
+
* @returns the bounded result of the run.
|
|
90
|
+
*/
|
|
91
|
+
export declare function runHookDryRun(shell: HookRunShell, command: string, options: HookDryRunOptions): Promise<ExtensionHookRunResult>;
|
package/lib/types/{runtime → packages/market-runtime/src/runtime}/surfaces/project-runtime.d.ts
RENAMED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/** Native project effects are owned by the receiving agent's scoped host context. */
|
|
2
2
|
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
-
import type { Catalog } from '../../
|
|
3
|
+
import type { CatalogPort as Catalog } from '../../catalog-port.js';
|
|
4
4
|
import type { HostTranslate } from '../host/host-locale.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { McpMountFactory } from '../../adapter-contracts.js';
|
|
6
|
+
import type { Suite } from '../../../../market-contracts/src/model/types.js';
|
|
6
7
|
/** Mount under existing and newly created agents; the caller owns refresh and teardown. */
|
|
7
|
-
export declare function mountProjectCommands(ctx: Context, catalog: Catalog, t: HostTranslate, dataRoot?: string): {
|
|
8
|
+
export declare function mountProjectCommands(ctx: Context, catalog: Catalog, t: HostTranslate, dataRoot?: string, allows?: () => boolean): {
|
|
8
9
|
refresh(): Promise<void>;
|
|
9
10
|
dispose(): Promise<void>;
|
|
10
11
|
};
|
|
11
12
|
/** MCP uses a separate injected child so network startup cannot delay local commands. */
|
|
12
|
-
export declare function mountProjectMcp(ctx: Context, catalog: Catalog, dataRoot: string): {
|
|
13
|
+
export declare function mountProjectMcp(ctx: Context, catalog: Catalog, dataRoot: string, mcpMounts: McpMountFactory, allows?: () => boolean): {
|
|
13
14
|
refresh(): Promise<void>;
|
|
14
15
|
dispose(): Promise<void>;
|
|
15
16
|
};
|
|
@@ -19,7 +20,9 @@ export declare function mountProjectHooks(ctx: Context, catalog: Catalog): {
|
|
|
19
20
|
dispose(): Promise<void>;
|
|
20
21
|
};
|
|
21
22
|
/** Kimi's startup skill and system-prompt declarations use the existing scoped prompt service. */
|
|
22
|
-
export declare function mountSuiteInstructions(ctx: Context, catalog: Catalog, dataRoot?: string
|
|
23
|
+
export declare function mountSuiteInstructions(ctx: Context, catalog: Catalog, dataRoot?: string,
|
|
24
|
+
/** Whether one user-dimension suite may contribute instructions; absent allows all. */
|
|
25
|
+
suiteAllowed?: (suite: Suite) => boolean): {
|
|
23
26
|
refresh(): Promise<void>;
|
|
24
27
|
dispose(): Promise<void>;
|
|
25
28
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { SkillCandidate, SkillDefinition, SkillLookupOptions, SkillProvider } from '@deepseek-ai/dsh-skill';
|
|
2
|
+
import type { CatalogPort as Catalog } from '../../catalog-port.js';
|
|
3
|
+
import type { Suite, SuiteSkill } from '../../../../market-contracts/src/model/types.js';
|
|
4
|
+
import { type ShellSeam } from './dynamic-context.js';
|
|
5
|
+
export declare const SUITE_PROJECT_SOURCE = "agent-plugin-project";
|
|
6
|
+
export declare const SUITE_USER_SOURCE = "agent-plugin-user";
|
|
7
|
+
/** Runtime inputs the provider cannot read off one suite. */
|
|
8
|
+
export interface SuiteSkillProviderOptions {
|
|
9
|
+
/** Plugin storage root holding each suite's data directory. */
|
|
10
|
+
dataRoot?: string;
|
|
11
|
+
/** Resolves the live shell seam; absent keeps dynamic-context placeholders literal. */
|
|
12
|
+
shell?: () => ShellSeam | undefined;
|
|
13
|
+
/** Validated session-selected clones; supplied readers replace global discovery rather than augmenting it. */
|
|
14
|
+
suites?: (cwd?: string) => Promise<Suite[]>;
|
|
15
|
+
/** Explicit live session grant for an ordinary disabled entry; validation and both selection guards still apply. */
|
|
16
|
+
overrideDisabled?: (suite: Suite, skill: SuiteSkill) => boolean;
|
|
17
|
+
/** Whether a user or project suite may contribute skills; checked live on list and get. */
|
|
18
|
+
suiteAllowed?: (suite: Suite) => boolean;
|
|
19
|
+
/** Per-entry policy, applied before name deduplication and checked live on get; absent allows all. */
|
|
20
|
+
entryAllowed?: (suite: Suite, skill: SuiteSkill) => boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare class SuiteSkillProvider implements SkillProvider {
|
|
23
|
+
private readonly manager;
|
|
24
|
+
private readonly options;
|
|
25
|
+
readonly name = "agent-plugin";
|
|
26
|
+
constructor(manager: Catalog, options?: SuiteSkillProviderOptions);
|
|
27
|
+
list(options: SkillLookupOptions): Promise<SkillCandidate[]>;
|
|
28
|
+
/** With policy callbacks, only owned candidates from list are loadable; denied or ownerless candidates return undefined. */
|
|
29
|
+
get(candidate: SkillCandidate, options: SkillLookupOptions): Promise<SkillDefinition | undefined>;
|
|
30
|
+
private candidateFor;
|
|
31
|
+
private hasPolicy;
|
|
32
|
+
private entryAllowed;
|
|
33
|
+
private locatorAllowed;
|
|
34
|
+
private canOverrideDisabled;
|
|
35
|
+
private locate;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A skill provider that answers nothing while the workspace's skills switch is
|
|
39
|
+
* off.
|
|
40
|
+
*
|
|
41
|
+
* The wrapper is generic over the provider it guards, so both contributors to
|
|
42
|
+
* the skills surface — installed suites and the user's own panel entries —
|
|
43
|
+
* answer the one switch. Only the two data-carrying methods observe it and the
|
|
44
|
+
* wrapped provider keeps its own name, so the provider seat survives a toggle
|
|
45
|
+
* without re-registering.
|
|
46
|
+
*/
|
|
47
|
+
export declare class ToggledSkillProvider implements SkillProvider {
|
|
48
|
+
private readonly inner;
|
|
49
|
+
private readonly allows;
|
|
50
|
+
constructor(inner: SkillProvider, allows: () => boolean);
|
|
51
|
+
get name(): string;
|
|
52
|
+
list(options: Parameters<SkillProvider['list']>[0]): ReturnType<SkillProvider['list']>;
|
|
53
|
+
get(...args: Parameters<SkillProvider['get']>): ReturnType<SkillProvider['get']>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A skill provider that drops the entries this workspace filtered off, while
|
|
57
|
+
* the surface switch itself keeps flowing through {@link ToggledSkillProvider}.
|
|
58
|
+
*
|
|
59
|
+
* The filter answers by the resource-window entry id (`skills:${name}`), which
|
|
60
|
+
* is the candidate name the harness would surface, so window and provider
|
|
61
|
+
* agree on what one row names. Both list and get check the live filter, so a
|
|
62
|
+
* cached candidate cannot bypass a later denial.
|
|
63
|
+
*/
|
|
64
|
+
export declare class EntryFilteredSkillProvider implements SkillProvider {
|
|
65
|
+
private readonly inner;
|
|
66
|
+
private readonly allowsEntry;
|
|
67
|
+
constructor(inner: SkillProvider, allowsEntry: (entryId: string) => boolean);
|
|
68
|
+
get name(): string;
|
|
69
|
+
list(options: Parameters<SkillProvider['list']>[0]): ReturnType<SkillProvider['list']>;
|
|
70
|
+
get(...args: Parameters<SkillProvider['get']>): ReturnType<SkillProvider['get']>;
|
|
71
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { TranslationProviderId } from '../../../../market-contracts/src/contracts/translation.js';
|
|
2
|
+
import type { TranslationUnit } from '../translation/unit.js';
|
|
3
|
+
/** One cached translation, stored under its own key. */
|
|
4
|
+
export interface TranslationRecord {
|
|
5
|
+
/** The translated text exactly as the provider returned it. */
|
|
6
|
+
text: string;
|
|
7
|
+
/** The provider that produced this text, for operator inspection. */
|
|
8
|
+
provider: TranslationProviderId;
|
|
9
|
+
/** Epoch milliseconds of the successful call, for operator inspection. */
|
|
10
|
+
at: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The cache file inside the plugin data root.
|
|
14
|
+
* @param dataRoot - the plugin's own storage root, never the project directory.
|
|
15
|
+
* @returns the absolute path of the translation cache.
|
|
16
|
+
*/
|
|
17
|
+
export declare function translationCachePath(dataRoot: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* One cache key: target locale, the unit's identity and text, and the provider
|
|
20
|
+
* chain's identity.
|
|
21
|
+
*
|
|
22
|
+
* Every part is joined with a NUL so no id containing the separator can alias
|
|
23
|
+
* another unit's entry, and the digest keeps the key bounded regardless of how
|
|
24
|
+
* long an upstream description is. The provider identity is part of the key on
|
|
25
|
+
* purpose: a deployment that changes engines must not serve the old engine's
|
|
26
|
+
* text as if the new one had produced it.
|
|
27
|
+
* @param unit - the field being translated.
|
|
28
|
+
* @param locale - the target locale id.
|
|
29
|
+
* @param providerIdentity - stable identity of the provider chain in use.
|
|
30
|
+
* @returns a stable key for the persisted entry.
|
|
31
|
+
*/
|
|
32
|
+
export declare function translationKey(unit: TranslationUnit, locale: string, providerIdentity: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Read the live cache. A missing, unreadable, or malformed file yields an empty
|
|
35
|
+
* cache: the panel always renders, it just has nothing translated yet.
|
|
36
|
+
* @param dataRoot - the plugin's own storage root.
|
|
37
|
+
* @returns the cached translations keyed by {@link translationKey}.
|
|
38
|
+
*/
|
|
39
|
+
export declare function loadTranslationCache(dataRoot: string): Promise<Record<string, TranslationRecord>>;
|
|
40
|
+
/**
|
|
41
|
+
* Delete the whole cache file.
|
|
42
|
+
*
|
|
43
|
+
* A missing file is the desired end state, not a failure, so the removal is
|
|
44
|
+
* tolerant. The caller re-reads through {@link loadTranslationCache} to confirm.
|
|
45
|
+
* @param dataRoot - the plugin's own storage root.
|
|
46
|
+
*/
|
|
47
|
+
export declare function clearTranslationCache(dataRoot: string): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Replace the whole cache document.
|
|
50
|
+
*
|
|
51
|
+
* Writes go through the shared atomic writer, so a crash mid-write leaves the
|
|
52
|
+
* previous cache readable rather than a truncated file.
|
|
53
|
+
* @param dataRoot - the plugin's own storage root.
|
|
54
|
+
* @param entries - the complete entry set to persist.
|
|
55
|
+
*/
|
|
56
|
+
export declare function saveTranslationCache(dataRoot: string, entries: Record<string, TranslationRecord>): Promise<void>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ordered provider chain: one batch in, the first provider that answers wins.
|
|
3
|
+
*
|
|
4
|
+
* Providers run in the order the composition root hands them over, which is the
|
|
5
|
+
* market's own quality order — the keyless public endpoints first, the user's
|
|
6
|
+
* model last. A provider that fails is remembered for the rest of the process:
|
|
7
|
+
* an unreachable endpoint then costs one timeout per session rather than one
|
|
8
|
+
* per batch, which matters because a blocked network does not refuse the
|
|
9
|
+
* connection, it holds it open until the timeout fires.
|
|
10
|
+
* @module application/translation/chain
|
|
11
|
+
*/
|
|
12
|
+
import type { TranslationProvider, TranslationProviderId } from '../../../../market-contracts/src/contracts/translation.js';
|
|
13
|
+
/** The provider contract lives in the shared contracts; re-exported so chain consumers keep one import. */
|
|
14
|
+
export type { TranslationProvider };
|
|
15
|
+
/**
|
|
16
|
+
* Per-provider timeout, in chain order.
|
|
17
|
+
*
|
|
18
|
+
* Google is first and shortest because a blocked network makes it hang rather
|
|
19
|
+
* than fail: the whole session should pay that wait at most once. The model
|
|
20
|
+
* gets the longest budget because a generation legitimately takes seconds.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PROVIDER_TIMEOUT_MS: Record<TranslationProviderId, number>;
|
|
23
|
+
/** Clear the circuit breaker. Tests call this between cases. */
|
|
24
|
+
export declare function resetCircuitBreaker(): void;
|
|
25
|
+
/** Whether a provider has been taken out of the chain by an earlier failure. */
|
|
26
|
+
export declare function isTripped(id: TranslationProviderId): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Run one batch through the chain.
|
|
29
|
+
*
|
|
30
|
+
* Every provider failure — a throw, a timeout, a short result — takes that
|
|
31
|
+
* provider out of the chain and moves on to the next. The caller's own
|
|
32
|
+
* cancellation is not a provider failure: it rethrows immediately and leaves
|
|
33
|
+
* the breaker untouched, so a panel that closed does not disable a provider for
|
|
34
|
+
* the rest of the session. Deadline and caller cancellation settle independently
|
|
35
|
+
* of provider cooperation. A late provider result cannot replace the chosen result.
|
|
36
|
+
* @param providers - the ordered chain, best first.
|
|
37
|
+
* @param texts - the batch, already masked.
|
|
38
|
+
* @param locale - target locale id.
|
|
39
|
+
* @param signal - caller cancellation, merged with the per-provider deadline.
|
|
40
|
+
* @param canContinue - live work gate checked before hops and after each result; false cancels without tripping a provider.
|
|
41
|
+
* @returns the translated batch and the provider that produced it.
|
|
42
|
+
* @throws when every provider is unavailable, tripped, or fails.
|
|
43
|
+
*/
|
|
44
|
+
export declare function runChain(providers: readonly TranslationProvider[], texts: readonly string[], locale: string, signal?: AbortSignal, canContinue?: () => boolean): Promise<{
|
|
45
|
+
texts: string[];
|
|
46
|
+
provider: TranslationProviderId;
|
|
47
|
+
}>;
|