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,241 @@
|
|
|
1
|
+
/** Role composition over public Team creation and awaited Agent initialization. */
|
|
2
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
3
|
+
import { installModelSelection } from '@deepseek-ai/dsh-agent';
|
|
4
|
+
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
5
|
+
import { foldSubagentDescriptor } from '@deepseek-ai/dsh-subagent';
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
const PROVIDER = 'market-role-team';
|
|
8
|
+
export const TEAM_ROLE_SOURCE = 'teammate-role-binding';
|
|
9
|
+
const routeSchema = z.object({ provider: z.string().min(1), model: z.string().min(1), reasoningEffort: z.string().min(1).optional() }).strict();
|
|
10
|
+
const snapshotSchema = z.object({ roleId: z.string().min(1), persona: z.string(), route: routeSchema }).strict();
|
|
11
|
+
const bindingSchema = snapshotSchema.extend({ version: z.literal(1), childId: z.string().min(1) }).strict();
|
|
12
|
+
/** The teammate's own orientation, mirroring the host's native teammate wrapper. */
|
|
13
|
+
function memberIdentity(member, role) {
|
|
14
|
+
return [
|
|
15
|
+
'<system-reminder>',
|
|
16
|
+
'',
|
|
17
|
+
`You are teammate ${JSON.stringify(member)}.`,
|
|
18
|
+
'Your Team Lead is addressed as "lead".',
|
|
19
|
+
'Use list_agents({}) to find your teammates and their names.',
|
|
20
|
+
'To message your Team Lead, use send_message({ target: "lead", message: "..." }).',
|
|
21
|
+
'To message another teammate, use send_message({ target: "<teammate name>", message: "..." }).',
|
|
22
|
+
...(role === '' ? [] : [`Your role is ${role}. The role instructions are applied to your system prompt.`]),
|
|
23
|
+
'',
|
|
24
|
+
'</system-reminder>'
|
|
25
|
+
].join('\n');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Record the role route on the member's own `AgentOptions`.
|
|
29
|
+
*
|
|
30
|
+
* The host Team creation request carries no per-member route, so the child
|
|
31
|
+
* Agent starts with the Lead's route. Host surfaces read this object rather
|
|
32
|
+
* than the model selection: the Team roster shows it, the image-input gate
|
|
33
|
+
* checks it, and the member's own delegation inherits it. A host that freezes
|
|
34
|
+
* the object is reported and keeps the model selection, which still routes
|
|
35
|
+
* every request.
|
|
36
|
+
* @param agent - the member's live Agent.
|
|
37
|
+
* @param route - the validated route from the creation snapshot.
|
|
38
|
+
* @param diagnose - diagnostic sink for a host that refuses the write.
|
|
39
|
+
* @returns the disposer that restores the inherited values.
|
|
40
|
+
*/
|
|
41
|
+
function applyRoleRoute(agent, route, diagnose) {
|
|
42
|
+
const options = agent.options;
|
|
43
|
+
const inherited = { provider: options.provider, model: options.model, reasoningEffort: options.reasoningEffort };
|
|
44
|
+
const write = (next) => {
|
|
45
|
+
try {
|
|
46
|
+
options.provider = next.provider;
|
|
47
|
+
options.model = next.model;
|
|
48
|
+
if (next.reasoningEffort === undefined)
|
|
49
|
+
delete options.reasoningEffort;
|
|
50
|
+
else
|
|
51
|
+
options.reasoningEffort = next.reasoningEffort;
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
if (!write(route)) {
|
|
59
|
+
diagnose(`role teammate ${agent.id}: AgentOptions is not writable, so the host reports the inherited route`);
|
|
60
|
+
return () => { };
|
|
61
|
+
}
|
|
62
|
+
return () => {
|
|
63
|
+
write(inherited);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** Creation and replay keep role data out of task text and never mutate the Lead's route. */
|
|
67
|
+
export class TeammateRoleRuntime {
|
|
68
|
+
ctx;
|
|
69
|
+
teams;
|
|
70
|
+
subagents;
|
|
71
|
+
pending = new AsyncLocalStorage();
|
|
72
|
+
stop = new AbortController();
|
|
73
|
+
registrations = [];
|
|
74
|
+
compositions = new Map();
|
|
75
|
+
creations = new Set();
|
|
76
|
+
initializing = new Map();
|
|
77
|
+
disposal;
|
|
78
|
+
constructor(ctx) {
|
|
79
|
+
this.ctx = ctx;
|
|
80
|
+
this.teams = ctx.get('agentTeams');
|
|
81
|
+
this.subagents = ctx.get('subagents');
|
|
82
|
+
this.registrations.push(this.subagents.registerProvider({
|
|
83
|
+
name: PROVIDER,
|
|
84
|
+
inheritsParentContext: false,
|
|
85
|
+
capabilities: { agentOptions: false, outputSchema: false, depthLimit: false, toolFilter: false, persona: false },
|
|
86
|
+
start: () => Promise.reject(new Error('role teammates require Team continuation')),
|
|
87
|
+
prepareContinuable: request => {
|
|
88
|
+
const pending = this.pending.getStore();
|
|
89
|
+
if (this.stop.signal.aborted || !pending || pending.parent !== request.parent || pending.childId !== undefined)
|
|
90
|
+
throw new Error('role teammate creation has no matching role binding');
|
|
91
|
+
pending.childId = request.sessionId;
|
|
92
|
+
return Promise.resolve({});
|
|
93
|
+
}
|
|
94
|
+
}));
|
|
95
|
+
this.registrations.push(ctx.on('agent/created', async ({ agent, signal }) => {
|
|
96
|
+
await this.initialize(agent, signal);
|
|
97
|
+
}));
|
|
98
|
+
this.registrations.push(ctx.on('agent/disposed', ({ agent }) => {
|
|
99
|
+
this.compositions.get(agent)?.();
|
|
100
|
+
this.compositions.delete(agent);
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
/** Reattach immutable role snapshots after a plugin reload, before exposing its creation tool. */
|
|
104
|
+
async restore() {
|
|
105
|
+
for (const agent of this.ctx.agents.list())
|
|
106
|
+
await this.initialize(agent, this.stop.signal);
|
|
107
|
+
}
|
|
108
|
+
/** Resolve after native Team admission; use the returned target with native Team management tools. */
|
|
109
|
+
spawn(parent, request, snapshot, signal) {
|
|
110
|
+
this.stop.signal.throwIfAborted();
|
|
111
|
+
signal.throwIfAborted();
|
|
112
|
+
if (!request.prompt.trim())
|
|
113
|
+
return Promise.reject(new Error('spawn_teammate_role requires a non-empty prompt'));
|
|
114
|
+
const membership = this.teams.membership(parent);
|
|
115
|
+
if (membership.role !== 'lead')
|
|
116
|
+
return Promise.reject(new Error('only the Team Lead can create role teammates'));
|
|
117
|
+
const pending = {
|
|
118
|
+
parent,
|
|
119
|
+
name: request.name,
|
|
120
|
+
role: request.agent?.trim() ?? '',
|
|
121
|
+
snapshot: snapshotSchema.parse(snapshot),
|
|
122
|
+
initialized: false
|
|
123
|
+
};
|
|
124
|
+
const operation = this.pending.run(pending, async () => {
|
|
125
|
+
const result = await this.teams.spawnTeammate(parent, {
|
|
126
|
+
name: request.name,
|
|
127
|
+
description: request.description,
|
|
128
|
+
prompt: [{ type: 'text', text: request.prompt }],
|
|
129
|
+
context: 'fresh',
|
|
130
|
+
provider: PROVIDER,
|
|
131
|
+
signal: AbortSignal.any([signal, this.stop.signal])
|
|
132
|
+
});
|
|
133
|
+
if (!pending.initialized || result.member.id !== pending.childId)
|
|
134
|
+
throw new Error('role teammate was not initialized before Team admission');
|
|
135
|
+
return { target: result.member.name, roleId: pending.snapshot.roleId, ...pending.snapshot.route };
|
|
136
|
+
});
|
|
137
|
+
this.creations.add(operation);
|
|
138
|
+
void operation.finally(() => this.creations.delete(operation)).catch(() => { });
|
|
139
|
+
return operation;
|
|
140
|
+
}
|
|
141
|
+
initialize(agent, signal) {
|
|
142
|
+
const existing = this.initializing.get(agent);
|
|
143
|
+
if (existing)
|
|
144
|
+
return existing;
|
|
145
|
+
const operation = this.initializeOnce(agent, signal);
|
|
146
|
+
this.initializing.set(agent, operation);
|
|
147
|
+
void operation.finally(() => this.initializing.delete(agent)).catch(() => { });
|
|
148
|
+
return operation;
|
|
149
|
+
}
|
|
150
|
+
async initializeOnce(agent, signal) {
|
|
151
|
+
if (this.compositions.has(agent))
|
|
152
|
+
return;
|
|
153
|
+
const query = this.ctx.get('sessionQuery');
|
|
154
|
+
const observation = await query.observeSession(agent.id, { projectionMode: 'none', ...(signal === undefined ? {} : { signal }) });
|
|
155
|
+
let events;
|
|
156
|
+
try {
|
|
157
|
+
events = observation.events.filter(event => event.seq >= observation.inheritedEventCount);
|
|
158
|
+
}
|
|
159
|
+
finally {
|
|
160
|
+
observation[Symbol.dispose]();
|
|
161
|
+
}
|
|
162
|
+
const descriptor = foldSubagentDescriptor(events);
|
|
163
|
+
if (descriptor?.provider !== PROVIDER)
|
|
164
|
+
return;
|
|
165
|
+
this.stop.signal.throwIfAborted();
|
|
166
|
+
signal?.throwIfAborted();
|
|
167
|
+
const messages = events.flatMap(event => (event.type === 'user/message' ? [event.data] : event.type === 'agent/inbox/spliced' ? event.data.inserted : []));
|
|
168
|
+
const sources = new Map(messages.filter(message => message.source.kind === TEAM_ROLE_SOURCE).map(message => [message.id, message.source]));
|
|
169
|
+
const records = [...sources.values()].map(source => (source.kind === TEAM_ROLE_SOURCE ? source.binding : undefined));
|
|
170
|
+
if (records.length > 1)
|
|
171
|
+
throw new Error('role teammate has multiple role bindings');
|
|
172
|
+
let binding;
|
|
173
|
+
if (records.length === 1) {
|
|
174
|
+
binding = bindingSchema.parse(records[0]);
|
|
175
|
+
if (binding.childId !== agent.id)
|
|
176
|
+
throw new Error('role binding belongs to another teammate');
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
const pending = this.pending.getStore();
|
|
180
|
+
const membership = this.teams.tryMembership(agent);
|
|
181
|
+
if (!pending || pending.initialized || pending.childId !== agent.id || membership?.root !== pending.parent || membership.name !== pending.name) {
|
|
182
|
+
throw new Error('role teammate has no durable or in-flight role binding');
|
|
183
|
+
}
|
|
184
|
+
binding = { version: 1, childId: agent.id, ...pending.snapshot };
|
|
185
|
+
agent.inject(createUserMessage({
|
|
186
|
+
source: { kind: TEAM_ROLE_SOURCE, form: 'context', binding },
|
|
187
|
+
content: [{ type: 'text', text: memberIdentity(membership.name, pending.role) }]
|
|
188
|
+
}));
|
|
189
|
+
if (!(await this.ctx.sessions.flush(agent.session)))
|
|
190
|
+
throw new Error('role teammate requires session persistence');
|
|
191
|
+
pending.initialized = true;
|
|
192
|
+
}
|
|
193
|
+
signal?.throwIfAborted();
|
|
194
|
+
this.stop.signal.throwIfAborted();
|
|
195
|
+
const prompt = agent.ctx.get('systemPrompt');
|
|
196
|
+
const offPersona = prompt.section({ name: 'deployment:persona-prefix', order: prompt.getSectionOrder('DEPLOYMENT_PERSONA_PREFIX'), text: binding.persona, interpolate: false });
|
|
197
|
+
const offRoute = applyRoleRoute(agent, binding.route, message => this.ctx.logger?.warn(message));
|
|
198
|
+
let offModel;
|
|
199
|
+
try {
|
|
200
|
+
offModel = installModelSelection(agent.ctx, { current: binding.route, assembled: undefined });
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
offRoute();
|
|
204
|
+
offPersona();
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
this.compositions.set(agent, () => {
|
|
208
|
+
offModel?.();
|
|
209
|
+
offPersona();
|
|
210
|
+
offRoute();
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/** Stop owned role work before removing its scoped configuration; native Team records stay authoritative. */
|
|
214
|
+
dispose() {
|
|
215
|
+
return (this.disposal ??= this.finishDisposal());
|
|
216
|
+
}
|
|
217
|
+
async finishDisposal() {
|
|
218
|
+
this.stop.abort('role teammate plugin disposed');
|
|
219
|
+
// Keep initialization guards installed while draining, so concurrent cold
|
|
220
|
+
// resumes cannot start without the role composition during teardown.
|
|
221
|
+
await Promise.allSettled([...this.creations, ...this.initializing.values()]);
|
|
222
|
+
const byParent = new Map();
|
|
223
|
+
for (const agent of this.compositions.keys()) {
|
|
224
|
+
const parentId = agent.session.header.parentSession;
|
|
225
|
+
const parent = parentId === undefined ? undefined : this.ctx.agents.get(parentId);
|
|
226
|
+
if (parent !== undefined)
|
|
227
|
+
byParent.set(parent, [...(byParent.get(parent) ?? []), agent.id]);
|
|
228
|
+
}
|
|
229
|
+
try {
|
|
230
|
+
await Promise.all([...byParent].map(([parent, ids]) => this.subagents.drainContinuableChildren(parent, ids)));
|
|
231
|
+
}
|
|
232
|
+
finally {
|
|
233
|
+
for (const off of this.registrations.splice(0).reverse())
|
|
234
|
+
off();
|
|
235
|
+
for (const off of this.compositions.values())
|
|
236
|
+
off();
|
|
237
|
+
this.compositions.clear();
|
|
238
|
+
this.pending.disable();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { resolveChildAgentOptions } from '@deepseek-ai/dsh-subagent';
|
|
2
|
+
import { defineTool } from '@deepseek-ai/dsh-tools';
|
|
3
|
+
import { agentRoleCatalog, requireCurrentRole, resolveAgentOptions, resolveRolePolicy, roleSnapshot, sessionCwd } from './agent-role-router.js';
|
|
4
|
+
import { mountSubagentCatalog } from './subagent-catalog.js';
|
|
5
|
+
import { TeammateRoleRuntime } from './teammate-role-runtime.js';
|
|
6
|
+
export const TEAMMATE_ROLE_TOOL_NAME = 'spawn_teammate_role';
|
|
7
|
+
/** Install the enhanced tool after its replay listener is ready; teardown drains owned role creations. */
|
|
8
|
+
export async function mountTeammateRoleTool(ctx, listRoles) {
|
|
9
|
+
const runtime = new TeammateRoleRuntime(ctx);
|
|
10
|
+
const entries = async (parent) => roleSnapshot(await listRoles(parent)).entries;
|
|
11
|
+
const cleanups = [];
|
|
12
|
+
try {
|
|
13
|
+
await runtime.restore();
|
|
14
|
+
const tool = defineTool({
|
|
15
|
+
name: TEAMMATE_ROLE_TOOL_NAME,
|
|
16
|
+
description: 'Create a named Team member from a role in the current "subagent-catalog" message. Use only when the user explicitly requests Agent Teams or teammates; only the Team Lead can create members. The member starts fresh, without this conversation, with the role instructions applied to its system prompt. Returns the Team target immediately and the member runs asynchronously, so keep working instead of waiting on the call. Use the native Team tools to message, interrupt, list and assign tasks to it. Without a matching role, use spawn_teammate.',
|
|
17
|
+
parameters: {
|
|
18
|
+
agent: { type: 'string', required: true, description: 'Exact role name listed in the current "subagent-catalog" message.' },
|
|
19
|
+
name: { type: 'string', required: true, description: 'Unique lower-kebab-case Team member name, distinct from the reusable role name.' },
|
|
20
|
+
description: { type: 'string', required: true, description: 'Short description of this member responsibility.' },
|
|
21
|
+
prompt: {
|
|
22
|
+
type: 'string',
|
|
23
|
+
required: true,
|
|
24
|
+
description: 'Complete standalone task, context, expected result and write boundaries. The member does not inherit this conversation.'
|
|
25
|
+
},
|
|
26
|
+
provider: { type: 'string', description: 'LLM provider, paired with model to override the role route. This is not the Team transport provider.' },
|
|
27
|
+
model: { type: 'string', description: 'Exact model id, paired with provider. Omit both to use the role route or inherit the Lead route.' },
|
|
28
|
+
reasoning_effort: { type: 'string', description: 'Optional adapter-owned reasoning effort. An explicit call route without effort uses that model default.' }
|
|
29
|
+
},
|
|
30
|
+
output: {
|
|
31
|
+
schema: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
additionalProperties: false,
|
|
34
|
+
properties: {
|
|
35
|
+
target: { type: 'string', required: true },
|
|
36
|
+
roleId: { type: 'string', required: true },
|
|
37
|
+
provider: { type: 'string', required: true },
|
|
38
|
+
model: { type: 'string', required: true },
|
|
39
|
+
reasoningEffort: { type: 'string' }
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
render: (_args, value) => [{ type: 'text', text: `created role teammate ${value.target} on ${value.provider}/${value.model}` }]
|
|
43
|
+
},
|
|
44
|
+
isConcurrencySafe: () => true,
|
|
45
|
+
async execute(args, exec) {
|
|
46
|
+
const parent = exec.agent;
|
|
47
|
+
if (!parent)
|
|
48
|
+
throw new Error('spawn_teammate_role requires a calling agent');
|
|
49
|
+
exec.signal.throwIfAborted();
|
|
50
|
+
if (ctx.agentTeams.membership(parent).role !== 'lead')
|
|
51
|
+
throw new Error('only the Team Lead can create role teammates');
|
|
52
|
+
const { entry, policy } = await resolveRolePolicy(entries, args.agent, parent);
|
|
53
|
+
const options = await resolveAgentOptions(policy, {
|
|
54
|
+
...(args.provider === undefined ? {} : { provider: args.provider }),
|
|
55
|
+
...(args.model === undefined ? {} : { model: args.model }),
|
|
56
|
+
...(args.reasoning_effort === undefined ? {} : { reasoningEffort: args.reasoning_effort })
|
|
57
|
+
}, parent, ctx.llm, exec.signal, args.agent, message => ctx.logger.warn(message));
|
|
58
|
+
// The role resolver validates effort with the live adapter; brand it only at this host boundary.
|
|
59
|
+
const effective = resolveChildAgentOptions(parent, options, parent.session.header.delegationDepth ?? 0);
|
|
60
|
+
if (!effective.provider || !effective.model)
|
|
61
|
+
throw new Error('role teammate requires an effective provider and model');
|
|
62
|
+
// The route lookup awaited the live LLM runtime; a role revoked during
|
|
63
|
+
// it must not become a Team member.
|
|
64
|
+
await requireCurrentRole(entries, entry, parent);
|
|
65
|
+
exec.signal.throwIfAborted();
|
|
66
|
+
return runtime.spawn(parent, args, {
|
|
67
|
+
roleId: entry.name,
|
|
68
|
+
persona: policy.content,
|
|
69
|
+
route: {
|
|
70
|
+
provider: effective.provider,
|
|
71
|
+
model: effective.model,
|
|
72
|
+
...(effective.reasoningEffort === undefined ? {} : { reasoningEffort: effective.reasoningEffort })
|
|
73
|
+
}
|
|
74
|
+
}, exec.signal);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
cleanups.push(ctx.tools.register(tool));
|
|
78
|
+
// Lead-only in the model schema: registration stays global, and each non-Lead scope
|
|
79
|
+
// denies the name in its own layer, which also covers that agent's descendants.
|
|
80
|
+
const denied = new Map();
|
|
81
|
+
const denyFor = (agent) => {
|
|
82
|
+
if (denied.has(agent) || ctx.agentTeams.tryMembership(agent)?.role === 'lead')
|
|
83
|
+
return;
|
|
84
|
+
denied.set(agent, agent.ctx.tools.restrict({ deny: [TEAMMATE_ROLE_TOOL_NAME] }));
|
|
85
|
+
};
|
|
86
|
+
// Registered before the sweep and the listeners: an early throw must still unwind
|
|
87
|
+
// what the sweep installed, and the listeners are dropped before the restrictions.
|
|
88
|
+
cleanups.push(() => {
|
|
89
|
+
for (const off of denied.values())
|
|
90
|
+
off();
|
|
91
|
+
denied.clear();
|
|
92
|
+
});
|
|
93
|
+
const offCreated = ctx.on('agent/created', ({ agent }) => {
|
|
94
|
+
denyFor(agent);
|
|
95
|
+
return undefined;
|
|
96
|
+
});
|
|
97
|
+
cleanups.push(() => {
|
|
98
|
+
offCreated();
|
|
99
|
+
});
|
|
100
|
+
const offDisposed = ctx.on('agent/disposed', ({ agent }) => {
|
|
101
|
+
denied.get(agent)?.();
|
|
102
|
+
denied.delete(agent);
|
|
103
|
+
});
|
|
104
|
+
cleanups.push(() => {
|
|
105
|
+
offDisposed();
|
|
106
|
+
});
|
|
107
|
+
for (const agent of ctx.agents.list())
|
|
108
|
+
denyFor(agent);
|
|
109
|
+
cleanups.push(mountSubagentCatalog(ctx, tool, async (agent, signal) => {
|
|
110
|
+
if (ctx.agentTeams.tryMembership(agent)?.role !== 'lead')
|
|
111
|
+
return { entries: [], complete: true };
|
|
112
|
+
const observation = roleSnapshot(await listRoles(agent));
|
|
113
|
+
return {
|
|
114
|
+
entries: await agentRoleCatalog(observation.entries, signal, message => ctx.logger.warn(message), sessionCwd(agent)),
|
|
115
|
+
complete: observation.complete
|
|
116
|
+
};
|
|
117
|
+
}, 'spawn_teammate_role'));
|
|
118
|
+
return async () => {
|
|
119
|
+
for (const off of cleanups.splice(0).reverse())
|
|
120
|
+
off();
|
|
121
|
+
await runtime.dispose();
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
for (const off of cleanups.reverse())
|
|
126
|
+
off();
|
|
127
|
+
await runtime.dispose();
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -52,10 +52,10 @@ export class ReconcileScheduler {
|
|
|
52
52
|
}
|
|
53
53
|
async reconcileOnce() {
|
|
54
54
|
try {
|
|
55
|
-
const suites = await this.host.enabledSuites();
|
|
55
|
+
const [suites, declarations] = await Promise.all([this.host.enabledSuites(), this.host.declarations?.()]);
|
|
56
56
|
if (this.disposed)
|
|
57
57
|
return;
|
|
58
|
-
const diagnostics = await this.runtime.reconcile(suites);
|
|
58
|
+
const diagnostics = declarations === undefined ? await this.runtime.reconcile(suites) : await this.runtime.refreshCatalog(declarations, suites);
|
|
59
59
|
this.host.publishMcpDiagnostics(diagnostics.mcp);
|
|
60
60
|
for (const diagnostic of diagnostics.mcp) {
|
|
61
61
|
this.ctx.logger?.warn(`[dsh-agent-plugins-market] suite "${diagnostic.suiteId}" mcp server "${diagnostic.serverKey}": ${diagnostic.reason}`);
|