@banzhe/dsh-devcontainer 0.3.0 → 0.3.1
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/lib/index.js.map +1 -1
- package/package.json +35 -30
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["serviceOf"],"sources":["../src/prompt.ts","../src/presets.ts","../src/ptc.ts","../src/subprocess.ts","../src/variants.ts","../src/index.ts"],"sourcesContent":["/**\n * The Linux container context: the one place the model learns it is not on\n * Windows.\n *\n * `WorkingDirectoryService` owns the `working-directory:current` context and\n * rewrites it after `next()`; a listener registered with `{ prepend: true }`\n * runs first and therefore sees that final text, which is what this module\n * replaces.\n * @module @banzhe/dsh-devcontainer/prompt\n */\n\nimport type { PromptAssembly } from '@deepseek-ai/dsh-system-prompt'\nimport { win32, posix } from 'node:path'\nimport { hostPathStyle } from './paths.ts'\nimport type { RepoContainerSpec } from './types.ts'\n\n/** Name of the context `WorkingDirectoryService` contributes. */\nexport const WORKING_DIRECTORY_CONTEXT = 'working-directory:current'\n\n/**\n * The label the prompt names the container by: the explicit container, its\n * compose service, or the repository directory name.\n * @param spec - the repository container specification.\n * @returns a short human label.\n */\nexport function containerLabel(spec: RepoContainerSpec): string {\n if (spec.container !== undefined) return spec.container\n if (spec.composeService !== undefined) return `service ${spec.composeService}`\n const base = hostPathStyle(spec.hostWorkspaceRoot) === 'win32'\n ? win32.basename(spec.hostWorkspaceRoot)\n : posix.basename(spec.hostWorkspaceRoot)\n return base === '' ? spec.hostWorkspaceRoot : base\n}\n\n/**\n * The replacement text for `working-directory:current`.\n * @param containerWorkdir - POSIX directory the command runs in.\n * @param spec - the repository container specification.\n * @param hostWorkdir - the host directory that mount corresponds to.\n * @returns the assembled context text.\n */\nexport function containerContextText(\n containerWorkdir: string,\n spec: RepoContainerSpec,\n hostWorkdir: string,\n): string {\n return `Current working directory: \"${containerWorkdir}\".\\n`\n + `Runtime environment: Linux Docker container (${containerLabel(spec)}) mounted from host directory \"${hostWorkdir}\". `\n + 'The active shell is Linux bash (/bin/bash). Always write POSIX/Linux commands and never PowerShell commands.'\n}\n\n/**\n * The replacement text for `working-directory:current` under a `(sbx)` preset.\n *\n * A sandbox needs no declaration, so this text never explains a refusal: it names\n * the sandbox and states the one fact the model cannot infer — that the paths are\n * the host's own, because `sbx` mounts a workspace at the same absolute path.\n * @param containerWorkdir - the directory the command runs in.\n * @param sandboxName - the Docker Sandbox it runs in.\n * @param hostWorkdir - the host directory that sandbox mounts.\n * @returns the assembled context text.\n */\nexport function sbxContextText(\n containerWorkdir: string,\n sandboxName: string,\n hostWorkdir: string,\n): string {\n return `Current working directory: \"${containerWorkdir}\".\\n`\n + `Runtime environment: Linux Docker Sandbox \"${sandboxName}\" (sbx) mounting host directory \"${hostWorkdir}\" at the same absolute path. `\n + 'The active shell is Linux bash (/bin/bash). Always write POSIX/Linux commands and never PowerShell commands.'\n}\n\n/**\n * The replacement text for `working-directory:current` when a `(devContainer)`\n * preset meets a repository that declares no container.\n *\n * The instruction is explicit about the two things the model must not do: retry\n * the command or the file access, and describe the failure as if it were temporary. It also says\n * which language to report in, because the person on the other side chose a\n * Chinese-labelled preset.\n * @param hostWorkdir - the host directory the session is working in.\n * @param preset - the derived preset id the session runs.\n * @returns the assembled context text.\n */\nexport function missingContainerContextText(hostWorkdir: string, preset: string): string {\n return `Current working directory: \"${hostWorkdir}\".\\n`\n + `Runtime environment: this session runs the (devContainer) preset \"${preset}\", but the working directory \"${hostWorkdir}\" declares no Dev Container configuration.\\n`\n + 'Looked for .devcontainer/devcontainer.json, .devcontainer.json, .dsh/devcontainer.json, and .dsh/docker.json in that directory and every ancestor directory.\\n'\n + 'Every shell command and every file operation is BLOCKED: the shell tool refuses to run commands on the host, the file tools refuse to read or write host files, so nothing has executed and nothing will execute until this repository gets a container configuration.\\n'\n + 'Tell the user this immediately, in Chinese: the (devContainer) preset requires a container configuration for this repository, and there are two ways out — add one of those files (for example .devcontainer/devcontainer.json, or .dsh/docker.json pointing at a container that is already running), or switch back to an ordinary preset (标准模式 / 委派模式).'\n + ' Do not retry shell commands or file operations while this stands, and do not describe it as a temporary failure.'\n}\n\n/**\n * Replace (or add) the working-directory context of one assembly.\n * @param assembly - the mutable assembly the waterfall produced.\n * @param text - the container context text.\n * @returns true when the assembly was changed.\n */\nexport function applyContainerContext(assembly: PromptAssembly, text: string): boolean {\n const contribution = assembly.contexts.find(entry => entry.name === WORKING_DIRECTORY_CONTEXT)\n if (contribution === undefined) {\n assembly.contexts.unshift({ name: WORKING_DIRECTORY_CONTEXT, text, interpolate: false })\n return true\n }\n contribution.text = text\n contribution.interpolate = false\n return true\n}\n\n/**\n * Read the host directory back out of an assembly that carries no agent.\n * @param assembly - the assembly to read.\n * @returns the host directory the `working-directory:current` context names, or undefined.\n */\nexport function hostDirectoryFromContext(assembly: PromptAssembly): string | undefined {\n const contribution = assembly.contexts.find(entry => entry.name === WORKING_DIRECTORY_CONTEXT)\n if (contribution === undefined) return undefined\n const match = /Current working directory: (\".*?\")\\./.exec(contribution.text)\n if (match === null) return undefined\n try {\n const parsed: unknown = JSON.parse(match[1] as string)\n return typeof parsed === 'string' ? parsed : undefined\n } catch {\n return undefined\n }\n}\n","/**\n * Preset-variant transforms.\n *\n * A preset is a declarative plugin list, and the shipped presets pick their\n * shell tool with `disabled: !!js process.platform === 'win32'`: on Windows every\n * agent gets `pwsh` and no `bash`. Inside a Linux container that is backwards,\n * but a preset is config DATA, not a Loader row — a patch entry cannot reach\n * into `config.plugins`, and the registry has no mutation API. So this Bundle\n * reads a preset's declaration out of the Loader tree and registers a derived\n * one: same roster, shell tools flipped, subagent routes pointing at the derived\n * subagent presets.\n *\n * Every function here is pure, so the whole derivation is unit-tested without a\n * Cordis composition.\n * @module @banzhe/dsh-devcontainer/presets\n */\n\nimport { VARIANT_KINDS, variantIdOf, variantKindOf, variantNameSuffixOf } from './ids.ts'\nimport type { VariantKind } from './ids.ts'\n\n/**\n * Every row that gives an agent a POSIX shell. The shipped presets pick between\n * these and their PowerShell twins with `disabled: !!js process.platform === 'win32'`,\n * and they do not always use the plain tool: `minimal` mounts\n * `tool-bash-persistent` / `tool-pwsh-persistent` plus `terminal-bash`, so a\n * variant that only flipped the plain pair would still come up with PowerShell.\n */\nexport const BASH_TOOL_MODULES: readonly string[] = [\n '@deepseek-ai/dsh-tool-bash',\n '@deepseek-ai/dsh-tool-bash-persistent',\n '@deepseek-ai/dsh-terminal-bash',\n]\n\n/** Every row that gives an agent a PowerShell shell. */\nexport const PWSH_TOOL_MODULES: readonly string[] = [\n '@deepseek-ai/dsh-tool-pwsh',\n '@deepseek-ai/dsh-tool-pwsh-persistent',\n]\n\n/**\n * Rows whose tool spawns and OWNS its shell process (a PTY, or a persistent\n * session) instead of asking `ctx.shell` for one.\n *\n * They cannot be part of a container variant: the process would start on the\n * host, which is exactly what this Bundle exists to avoid, and on Windows the\n * terminal backend collides with the one the platform already registered\n * (\"a PTY backend named \\\"shell\\\" is already registered\" — the derived preset\n * then mounts as `broken` and disappears from the picker).\n */\nexport const PERSISTENT_SHELL_MODULES: readonly string[] = [\n '@deepseek-ai/dsh-tool-bash-persistent',\n '@deepseek-ai/dsh-terminal-bash',\n]\n\n/** The plain bash tool row, kept as the historical single-name export. */\nexport const BASH_TOOL_MODULE = BASH_TOOL_MODULES[0] as string\n\n/** The plain PowerShell tool row, kept as the historical single-name export. */\nexport const PWSH_TOOL_MODULE = PWSH_TOOL_MODULES[0] as string\n\n/** Module specifier of a preset declaration row. */\nexport const PRESET_MODULE = '@deepseek-ai/dsh-agent-preset'\n\n/** One row of a declarative preset plugin list. */\nexport interface PresetRow {\n readonly id?: string\n readonly name: string\n readonly group?: boolean | null\n readonly disabled?: unknown\n readonly config?: unknown\n readonly [key: string]: unknown\n}\n\n/** The fields of a preset declaration this Bundle reads and reproduces. */\nexport interface PresetDeclaration {\n readonly id: string\n readonly name?: string\n readonly description?: string\n readonly order?: number\n readonly plugins: readonly PresetRow[]\n}\n\n/**\n * The derived id for one source preset on one track.\n * @param sourceId - the declared preset id.\n * @param kind - the track; `(devContainer)` when omitted.\n * @returns the variant id, or the id itself when it already names a variant.\n */\nexport function variantId(sourceId: string, kind: VariantKind = 'devcontainer'): string {\n return variantKindOf(sourceId) === undefined ? variantIdOf(sourceId, kind) : sourceId\n}\n\nfunction isRow(value: unknown): value is PresetRow {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n && typeof (value as { name?: unknown }).name === 'string'\n}\n\nfunction childRows(row: PresetRow): readonly PresetRow[] | undefined {\n return row.group === true && Array.isArray(row.config) ? row.config.filter(isRow) : undefined\n}\n\n/** Deep-clone preset data (plain objects, arrays, and `!!js` marker objects). */\nexport function cloneRows(rows: readonly PresetRow[]): PresetRow[] {\n return rows.map((row) => {\n const cloned: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(row)) cloned[key] = cloneValue(value)\n return cloned as unknown as PresetRow\n })\n}\n\nfunction cloneValue(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(cloneValue)\n if (typeof value === 'object' && value !== null) {\n const cloned: Record<string, unknown> = {}\n for (const [key, entry] of Object.entries(value)) cloned[key] = cloneValue(entry)\n return cloned\n }\n return value\n}\n\n/**\n * Whether one row asks for a PowerShell shell.\n *\n * The module alone does not decide: `terminal-bash` carries BOTH dialects, and a\n * `shellDialect: pwsh` row left enabled is what collides with the bash backend.\n * @param row - the declared row.\n * @returns true for a PowerShell row in either form.\n */\nfunction isPowerShellRow(row: PresetRow): boolean {\n if (PWSH_TOOL_MODULES.includes(row.name)) return true\n return typeof row.config === 'object' && row.config !== null\n && (row.config as { shellDialect?: unknown }).shellDialect === 'pwsh'\n}\n\n/**\n * Flip every shell tool row at any nesting depth, so the variant speaks bash\n * inside the container and nothing else.\n *\n * - a PowerShell row (by module or by `shellDialect`) is disabled;\n * - a persistent/terminal bash row cannot keep its module: it owns a host-side\n * shell process, so it is rewritten into the ordinary `tool-bash` row, which\n * goes through `ctx.shell` and therefore into the container;\n * - only ONE such row is rewritten, because a second would mount a duplicate\n * `bash` tool; the rest are disabled;\n * - a row that already is `tool-bash`, or has no `disabled` field at all, gains\n * an explicit one, so a preset can no longer inherit the platform guess.\n * @param rows - the declared plugin list.\n * @returns a new list; the input is never mutated.\n */\nexport function rewriteShellTools(rows: readonly PresetRow[]): PresetRow[] {\n const state = { plain: false, replaced: false }\n const scan = (list: readonly PresetRow[]): void => {\n for (const row of list) {\n if (row.name === BASH_TOOL_MODULE) state.plain = true\n const children = childRows(row)\n if (children !== undefined) scan(children)\n }\n }\n scan(rows)\n const rewrite = (list: readonly PresetRow[]): PresetRow[] => list.map((row) => {\n const next: Record<string, unknown> = { ...row }\n if (isPowerShellRow(row)) next.disabled = true\n else if (row.name === BASH_TOOL_MODULE) next.disabled = false\n else if (PERSISTENT_SHELL_MODULES.includes(row.name)) {\n if (state.plain || state.replaced) next.disabled = true\n else {\n state.replaced = true\n next.name = BASH_TOOL_MODULE\n next.disabled = false\n // Terminal knobs (`shellDialect`, PTY sizing) are not `tool-bash` fields.\n delete next.config\n }\n }\n const children = childRows(row)\n if (children !== undefined) next.config = rewrite(children)\n return next as unknown as PresetRow\n })\n return rewrite(rows)\n}\n\n/** The subagent presets one row's config names, in declaration order. */\nfunction presetRefsOf(config: unknown): string[] {\n if (typeof config !== 'object' || config === null || Array.isArray(config)) return []\n const { agentPreset, allowedAgentPresets } = config as {\n agentPreset?: unknown\n allowedAgentPresets?: unknown\n }\n const found: string[] = []\n if (typeof agentPreset === 'string' && agentPreset !== '') found.push(agentPreset)\n if (Array.isArray(allowedAgentPresets)) {\n for (const entry of allowedAgentPresets) {\n if (typeof entry === 'string' && entry !== '') found.push(entry)\n }\n }\n return found\n}\n\n/**\n * Every preset id a plugin list routes a subagent to.\n *\n * A subagent row names its preset twice over: `agentPreset` fixes it, and\n * `allowedAgentPresets` (the array form `@deepseek-ai/dsh-tool-subagent` accepts)\n * lists the choices a caller may make. Both have to be derived, or a route can\n * point at a preset that has no container variant.\n * @param rows - the declared plugin list.\n * @returns the referenced preset ids, in first-seen order, without duplicates.\n */\nexport function referencedPresets(rows: readonly PresetRow[]): string[] {\n const found: string[] = []\n const collect = (list: readonly PresetRow[]): void => {\n for (const row of list) {\n for (const id of presetRefsOf(row.config)) {\n if (!found.includes(id)) found.push(id)\n }\n const children = childRows(row)\n if (children !== undefined) collect(children)\n }\n }\n collect(rows)\n return found\n}\n\n/**\n * Point every subagent route at its derived preset, and cut the routes that\n * have none.\n *\n * A route whose preset has no container variant must not survive as it is: the\n * subagent would start on the host with an ordinary preset while the calling\n * agent keeps believing every command runs in the container. Such a route is\n * removed instead — an `allowedAgentPresets` choice is dropped, and a single\n * fixed `agentPreset` disables its whole row, so the tool is absent rather than\n * silently host-bound. The blocked id stays in the disabled row's config, which\n * is where a reader looking for the cause will look.\n * @param rows - the declared plugin list.\n * @param map - source preset id → derived id, or undefined to leave the route alone.\n * @param blocked - whether one preset id has no variant and its routes must be cut.\n * @returns a new list; the input is never mutated.\n */\nexport function rewriteAgentPresetRefs(\n rows: readonly PresetRow[],\n map: (sourceId: string) => string | undefined,\n blocked: (sourceId: string) => boolean = () => false,\n): PresetRow[] {\n const remap = (id: string): string => {\n const mapped = map(id)\n return mapped === undefined ? id : mapped\n }\n return rows.map((row) => {\n const next: Record<string, unknown> = { ...row }\n const config = row.config\n let cut = false\n if (typeof config === 'object' && config !== null && !Array.isArray(config)) {\n const record = config as { agentPreset?: unknown; allowedAgentPresets?: unknown }\n const rewritten: Record<string, unknown> = { ...record }\n let changed = false\n if (typeof record.agentPreset === 'string') {\n if (blocked(record.agentPreset)) cut = true\n else {\n const mapped = remap(record.agentPreset)\n if (mapped !== record.agentPreset) { rewritten.agentPreset = mapped; changed = true }\n }\n }\n if (Array.isArray(record.allowedAgentPresets)) {\n const ids = record.allowedAgentPresets.filter((entry): entry is string => typeof entry === 'string')\n const kept = ids.filter(id => !blocked(id))\n const mapped = kept.map(remap)\n if (kept.length !== ids.length || mapped.some((id, index) => id !== kept[index])) {\n rewritten.allowedAgentPresets = mapped\n changed = true\n }\n // The array form IS the route list: an emptied one leaves the tool with\n // nothing it may spawn, so the row goes with it.\n if (kept.length === 0) cut = true\n }\n if (changed) next.config = rewritten\n }\n if (cut) next.disabled = true\n const children = childRows(row)\n if (children !== undefined) next.config = rewriteAgentPresetRefs(children, map, blocked)\n return next as unknown as PresetRow\n })\n}\n\n/**\n * Read one preset declaration out of a Loader row's raw config.\n * @param config - the row's `config` value.\n * @returns the declaration, or undefined when the value is not one.\n */\nexport function asDeclaration(config: unknown): PresetDeclaration | undefined {\n if (typeof config !== 'object' || config === null || Array.isArray(config)) return undefined\n const record = config as Record<string, unknown>\n if (typeof record.id !== 'string' || record.id === '' || !Array.isArray(record.plugins)) return undefined\n const plugins = record.plugins.filter(isRow)\n if (plugins.length === 0) return undefined\n return {\n id: record.id,\n ...typeof record.name === 'string' ? { name: record.name } : {},\n ...typeof record.description === 'string' ? { description: record.description } : {},\n ...typeof record.order === 'number' ? { order: record.order } : {},\n plugins,\n }\n}\n/** One derived preset ready to register. */\nexport interface PlannedVariant {\n /** The derived preset id. */\n readonly id: string\n /** The source preset id this variant came from. */\n readonly source: string\n /** Which runtime the variant routes commands to. */\n readonly kind: VariantKind\n /** Display name shown in the preset picker. */\n readonly name: string\n /** Display description. */\n readonly description: string\n /** Sort order: the source's order plus the configured offset. */\n readonly order: number\n /** The rewritten plugin list. */\n readonly plugins: readonly PresetRow[]\n}\n\n/** Inputs of {@link planVariants}. */\nexport interface VariantPlan {\n /** Source declarations by preset id, as read from the Loader tree. */\n readonly declarations: ReadonlyMap<string, PresetDeclaration>\n /** Source preset ids to derive a `… (devContainer)` variant from, in registration order. */\n readonly sources: readonly string[]\n /** Source preset ids to derive a `… (sbx)` variant from, in registration order. */\n readonly sbxSources?: readonly string[]\n /** Added to the source order. */\n readonly orderOffset: number\n /** How deep a variant may follow its own subagent routes (default 4). */\n readonly maxDepth?: number\n}\n\nconst DEFAULT_VARIANT_DEPTH = 4\n\n/**\n * Build the description of one derived preset.\n * @param source - the source declaration.\n * @param kind - the track the variant belongs to.\n * @returns the source description with one added sentence.\n */\nexport function variantDescription(source: PresetDeclaration, kind: VariantKind = 'devcontainer'): string {\n const note = kind === 'sbx'\n ? 'Every command runs inside the Docker Sandbox mounted on this workspace.'\n : \"Every command runs inside the repository's Linux Dev Container.\"\n return source.description === undefined ? note : `${source.description} ${note}`\n}\n\n/**\n * The sentence a variant's description gains when the depth cap cut one of its routes.\n * @param maxDepth - the route-following depth this plan was built with.\n * @returns the explanation appended to the source description.\n */\nfunction depthBlockNote(maxDepth: number): string {\n return `Subagent routes deeper than ${maxDepth} nested levels are disabled: their presets would run on the host instead of inside the container.`\n}\n\n/**\n * Plan the derived preset set for one composition.\n *\n * The whole point is what it does NOT change: a source preset that mounts no\n * shell tool (the delegate main agent) derives to a preset that still mounts\n * none — only the subagent presets it routes to get bash. A source that does\n * mount the pair gets it flipped. Nothing is inserted, so no variant can gain a\n * capability its source never had.\n *\n * Routes are followed breadth-first and depth-bounded. A route to a preset this\n * composition never declares stays untouched rather than dangling. A route the\n * DEPTH CAP stops is cut instead of kept: the preset behind it would otherwise\n * start an agent on the host under an ordinary preset, which is exactly the\n * silent downgrade the derived presets exist to prevent. Route depth also bounds\n * recursion, so a cyclic route graph terminates here.\n *\n * Two tracks are planned side by side: `sources` derives the\n * `… (devContainer)` set, `sbxSources` the `… (sbx)` set. A track only ever\n * routes into itself — a sandbox subagent under a Dev Container root would run\n * commands in a different runtime than the agent that delegated to it — so the\n * same source can appear on both lists and derives two independent trees.\n *\n * Referenced variants are emitted BEFORE the preset that routes to them.\n *\n * @param input - declarations, both source lists, and the labelling offsets.\n * @returns the variants to register, in dependency order, Dev Container track first.\n */\nexport function planVariants(input: VariantPlan): PlannedVariant[] {\n const maxDepth = input.maxDepth ?? DEFAULT_VARIANT_DEPTH\n // The map IS the ordering: an entry is inserted after its dependencies were\n // visited, so iteration yields them first. (A plain \"already planned\" guard is\n // not enough: two routes that reach the same preset — a diamond, or a cycle\n // through its own subagent routes — each finish inside their own frame.) The\n // key carries the track, because one source id can be planned on both.\n const planned = new Map<string, PlannedVariant>()\n const keyOf = (kind: VariantKind, sourceId: string): string => `${kind}\\u0000${sourceId}`\n const visit = (kind: VariantKind, sourceId: string, depth: number): void => {\n const key = keyOf(kind, sourceId)\n if (planned.has(key)) return\n const source = input.declarations.get(sourceId)\n if (source === undefined) return\n const id = variantId(sourceId, kind)\n const flipped = rewriteShellTools(cloneRows(source.plugins))\n const routes = new Map<string, string>()\n const blocked = new Set<string>()\n for (const referenced of referencedPresets(flipped)) {\n // A route back to its own preset is the derived preset itself, which is\n // bound to this runtime by construction; recursing into it would not terminate.\n if (referenced === sourceId) routes.set(referenced, id)\n else if (depth < maxDepth) {\n visit(kind, referenced, depth + 1)\n const derived = planned.get(keyOf(kind, referenced))\n if (derived !== undefined) routes.set(referenced, derived.id)\n } else if (planned.has(keyOf(kind, referenced))) routes.set(referenced, variantId(referenced, kind))\n // A declared preset that has no variant to reach is what the depth cap\n // leaves behind; an UNdeclared id keeps its route, because this plan\n // cannot register a variant for a preset it cannot read either.\n if (!routes.has(referenced) && input.declarations.has(referenced)) blocked.add(referenced)\n }\n const description = variantDescription(source, kind)\n planned.set(key, {\n id,\n source: sourceId,\n kind,\n name: `${source.name ?? source.id}${variantNameSuffixOf(kind)}`,\n description: blocked.size === 0 ? description : `${description} ${depthBlockNote(maxDepth)}`,\n order: (source.order ?? 0) + input.orderOffset,\n plugins: rewriteAgentPresetRefs(flipped, referenced => routes.get(referenced), referenced => blocked.has(referenced)),\n })\n }\n for (const kind of VARIANT_KINDS) {\n const sources = kind === 'sbx' ? input.sbxSources ?? [] : input.sources\n for (const sourceId of sources) visit(kind, sourceId, 0)\n }\n return [...planned.values()]\n}\n","/**\n * `ctx.ptcRuntime` for repositories that declare a Dev Container, narrowed to the\n * one field a program's host process cannot take from the container: its working\n * directory.\n *\n * `ctx.subprocess` already starts every host process in the host repository root\n * (`src/subprocess.ts`), but the PTC seam is asked for a directory of its own:\n * `resolve` fills a missing `cwd` from the sandbox policy's workspace root — the\n * container's `/workspaces/<repo>` — and `run` hands that directory to the worker,\n * whose entry program `process.chdir`s into it before the first line of the\n * program runs. The worker is a host Node process, so the chdir failed with\n * `ENOENT` before any binding call reached `ctx.fs`.\n *\n * So both entry points are decorated, one decision deep: a directory that names\n * the container view of a discovered repository becomes that repository's host\n * directory through `toHostPath` — POSIX remainder arithmetic plus the host\n * root's own separator style, so a Windows, Linux, or macOS host runs one code\n * path and no drive letter is ever constructed. Everything else — an ordinary\n * session, a host path, a relative path, a container path no declaration owns —\n * reaches the provider exactly as the caller wrote it.\n *\n * Only the working directory moves. The program's file access is `ctx.fs`, which\n * is the Docker RPC pipe, and the sandbox policy is the caller's: the host\n * directory is where a host process may start, never a place the session may read.\n * @module @banzhe/dsh-devcontainer/ptc\n */\n\nimport type { PtcRunRequest, PtcRunResult, PtcRunSpec } from '@deepseek-ai/dsh-ptc-runtime'\nimport { toHostPath } from './paths.ts'\nimport type { RepoContainerSpec } from './types.ts'\n\n/** The two methods of the PTC seam this module decorates. */\nexport interface PtcSeam {\n /**\n * Resolve supported options and provider defaults before execution.\n * @param request - program, bindings, cancellation and optional execution choices.\n * @returns the complete execution inputs, including the directory `run` receives.\n */\n resolve(request: PtcRunRequest): PtcRunSpec\n\n /**\n * Execute one resolved program.\n * @param spec - the directory, deadline, program, bindings and policy of one run.\n * @returns the captured output and the execution outcome.\n */\n run(spec: PtcRunSpec): Promise<PtcRunResult>\n}\n\n/** The repository that owns one directory, when a declaration does. */\nexport type RepositoryOfPath = (cwd: string) => RepoContainerSpec | undefined\n\n/**\n * The directory the host process may actually start in.\n * @param cwd - the directory the caller, or the provider's own default, named.\n * @param repository - the container repository that owns it, when one does.\n * @returns the host path of the same directory, or `cwd` unchanged.\n */\nexport function mapPtcCwd(cwd: string, repository: RepoContainerSpec | undefined): string {\n return repository === undefined ? cwd : toHostPath(cwd, repository)\n}\n\n/**\n * Make every program run in a directory that exists on this host.\n *\n * The seam is decorated in place rather than replaced: Cordis holds one\n * implementation per service name, so a second `ptcRuntime` row would be refused\n * at activation, while every run that needs no rewrite — an ordinary session's\n * program, a program in a host repository — must keep the provider's own process\n * mechanics. Both inherited methods are called with their own receiver, and a\n * request or spec object is passed through untouched when nothing is mapped.\n *\n * `resolve` is decorated as well as `run`, not instead of it: a caller that keeps\n * the resolved spec (a consumer that reports the directory, or a persistent\n * runtime that compares policies) must not be handed a container path that the\n * provider then chdirs into. A request that names no directory is resolved by the\n * provider first and mapped afterwards, because the provider fills it from the\n * sandbox policy's workspace root, which is the container spelling this module\n * exists to replace.\n * @param seam - the mounted PTC runtime.\n * @param repositoryOf - the repository that owns one directory, when one does.\n * @returns the disposer that puts the inherited methods back.\n */\nexport function installPtcCwdMapping(seam: PtcSeam, repositoryOf: RepositoryOfPath): () => void {\n const inheritedResolve = seam.resolve.bind(seam)\n const inheritedRun = seam.run.bind(seam)\n\n const mappedResolve = (request: PtcRunRequest): PtcRunSpec => {\n const requested = request.cwd\n if (requested !== undefined) {\n const cwd = mapPtcCwd(requested, repositoryOf(requested))\n return inheritedResolve(cwd === requested ? request : { ...request, cwd })\n }\n const resolved = inheritedResolve(request)\n const cwd = mapPtcCwd(resolved.cwd, repositoryOf(resolved.cwd))\n return cwd === resolved.cwd ? resolved : { ...resolved, cwd }\n }\n\n const mappedRun = (spec: PtcRunSpec): Promise<PtcRunResult> => {\n const cwd = mapPtcCwd(spec.cwd, repositoryOf(spec.cwd))\n return inheritedRun(cwd === spec.cwd ? spec : { ...spec, cwd })\n }\n\n Object.defineProperty(seam, 'resolve', { configurable: true, writable: true, value: mappedResolve })\n Object.defineProperty(seam, 'run', { configurable: true, writable: true, value: mappedRun })\n return () => {\n // Cordis hands a service out through a traceable proxy that wraps every\n // method read in a fresh function, so the own descriptor — not a read of the\n // method — says whether this decoration is still the installed one.\n for (const [method, installed] of [['resolve', mappedResolve], ['run', mappedRun]] as const) {\n if (Object.getOwnPropertyDescriptor(seam, method)?.value !== installed) continue\n Reflect.deleteProperty(seam, method)\n }\n }\n}\n","/**\n * `ctx.subprocess` for repositories that declare a Dev Container, narrowed to the\n * one field a host process cannot take from the container: its working directory.\n *\n * A container-bound session speaks container paths end to end — `ctx.shell`\n * reports `/workspaces/<repo>/…` and `ctx.fs` resolves the same spelling inside\n * the container — so the directory a child process is asked to start in can name\n * something that exists only on the container side. Nothing on the host can enter\n * it: the spawn fails with `ENOENT` before a single line of the child runs, which\n * is how the `run_code` PTC worker died before its first `tools.read` binding.\n *\n * So the seam is decorated, one decision deep: a working directory that belongs to\n * a discovered repository is translated back onto that repository's host root\n * using POSIX path arithmetic and the host root's own separator style, so the same\n * code is correct on a Windows, Linux, or macOS host. Everything else — an\n * ordinary session, a host path, a container path no declaration owns — reaches\n * the provider exactly as the caller wrote it.\n *\n * Only the working directory moves. What the child then does with files still\n * travels the container path: the PTC bindings call `tools.read`/`tools.write`,\n * which are `ctx.fs`, which is the Docker RPC pipe. The host directory is where a\n * host process may start, not a place the session may read.\n * @module @banzhe/dsh-devcontainer/subprocess\n */\n\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { SubprocessHandle, SubprocessSpawnSpec } from '@deepseek-ai/dsh-subprocess'\nimport { toHostPath } from './paths.ts'\nimport { callingVariantKind } from './refusal.ts'\nimport { liveSbxOptions, repoRegistry } from './registry.ts'\nimport { asSbxSpec, sbxSpecFor, sbxWorkspaceRootFor } from './sbx.ts'\nimport type { ContainerOptions, RepoContainerSpec } from './types.ts'\n\n/** The one method of the subprocess seam this module decorates. */\nexport interface SpawnSeam {\n /**\n * Start one managed child process.\n * @param spec - the caller's fully specified spawn request.\n * @returns the live process handle.\n */\n spawn(spec: SubprocessSpawnSpec): SubprocessHandle\n}\n\n/** The `ctx.agents` slice this module reads: the Agent that initiated the call. */\ninterface InitiatorLookup {\n /**\n * Read the Agent that initiated the inherited asynchronous driver chain.\n * @returns the inherited Agent, or undefined outside an initiator boundary.\n */\n currentInitiator(): { readonly session: { readonly header?: { readonly cwd?: string } } } | undefined\n}\n\n/** The `ctx.workingDirectory` slice this module reads. */\ninterface DirectoryLookup {\n /**\n * Read the Session's current directory.\n * @param session - the Session whose directory is requested.\n * @returns the committed directory.\n */\n get(session: never): string\n}\n\n/** Read one service without a typed `Context` augmentation, as the other rows do. */\nfunction serviceOf(ctx: Context, service: string): unknown {\n return (ctx as unknown as { get(name: string): unknown }).get(service)\n}\n\n/**\n * The working directory a host process may actually start in.\n * @param cwd - the directory the caller asked for.\n * @param repository - the container repository that owns it, when one does.\n * @returns the host path of the same directory, or `cwd` unchanged.\n */\nexport function mapSpawnCwd(cwd: string, repository: RepoContainerSpec | undefined): string {\n return repository === undefined ? cwd : toHostPath(cwd, repository)\n}\n\n/**\n * The host directories that can name the repository behind a container path.\n *\n * Discovery walks host ancestors, and a container path has none, so the walk needs\n * a real directory to start from. The initiating Agent's own two are the ones this\n * session started with: its working-directory projection is where the model\n * believes it is, and its Session header keeps the project directory the Session\n * was created in — a host path, because the Session is created on the host. An\n * anchor that names nothing real simply discovers nothing; ownership still decides\n * whether a repository may claim the path.\n * @param ctx - the calling row's context.\n * @returns candidate host directories, best first, without duplicates.\n */\nfunction hostAnchors(ctx: Context): readonly string[] {\n let initiator: { readonly session: { readonly header?: { readonly cwd?: string } } } | undefined\n try {\n initiator = (serviceOf(ctx, 'agents') as InitiatorLookup | undefined)?.currentInitiator()\n } catch {\n // A closing initiator scope cannot answer; the discovery cache is still consulted.\n initiator = undefined\n }\n if (initiator === undefined) return []\n const anchors: string[] = []\n const directories = serviceOf(ctx, 'workingDirectory') as DirectoryLookup | undefined\n if (directories !== undefined) {\n try {\n anchors.push(directories.get(initiator.session as never))\n } catch {\n // A Session with no directory projection answers nothing; the header still can.\n }\n }\n const project = initiator.session.header?.cwd\n if (project !== undefined) anchors.push(project)\n return [...new Set(anchors)]\n}\n\n/**\n * The repository whose runtime owns one directory.\n *\n * A `(sbx)` session mounts the host directory at its own absolute path, so the\n * specification handed back is the sandbox view of the same repository: the\n * declared `workspaceFolder` (`/workspaces/<repo>`) is replaced by the host\n * root, which keeps the translation this module performs a normalization instead\n * of a wrong mount. A sandbox directory with no declaration at all is described\n * from the directory itself, because a sandbox needs no declaration.\n * @param ctx - the calling row's context.\n * @param path - a container path, a host path, or a relative path.\n * @param options - the row's container defaults, applied to a fresh discovery.\n * @returns the owning repository specification, or undefined when nothing declares a container for it.\n */\nexport function repositoryOfPath(\n ctx: Context, path: string, options: ContainerOptions,\n): RepoContainerSpec | undefined {\n const kind = callingVariantKind(ctx)\n const adopt = (spec: RepoContainerSpec): RepoContainerSpec => (kind === 'sbx' ? asSbxSpec(spec) : spec)\n const registry = repoRegistry(ctx)\n for (const anchor of hostAnchors(ctx)) {\n const found = registry.locate(path, { ...options, cwd: anchor })\n if (found !== undefined) return adopt(found)\n }\n const found = registry.locate(path, options)\n if (found !== undefined) return adopt(found)\n if (kind !== 'sbx') return undefined\n const root = sbxWorkspaceRootFor(path, undefined, undefined)\n return root === undefined\n ? undefined\n : sbxSpecFor(root, liveSbxOptions(ctx, options), undefined)\n}\n\n/**\n * Start every host process in a directory that exists on this host.\n *\n * The seam is decorated in place rather than replaced: Cordis holds one\n * implementation per service name, so a second `subprocess` row would be refused\n * at activation, while every spawn that needs no rewrite — an ordinary session's\n * shell, a language server in a host repository — must keep the provider's own\n * process mechanics. The inherited method is called with its own receiver, and\n * the original spec object is passed through untouched when nothing is mapped.\n * @param seam - the mounted subprocess service.\n * @param repositoryOf - the repository that owns one directory, when one does.\n * @returns the disposer that puts the inherited method back.\n */\nexport function installSpawnCwdMapping(\n seam: SpawnSeam,\n repositoryOf: (cwd: string) => RepoContainerSpec | undefined,\n): () => void {\n const inherited = seam.spawn.bind(seam)\n const mapped = (spec: SubprocessSpawnSpec): SubprocessHandle => {\n const cwd = mapSpawnCwd(spec.cwd, repositoryOf(spec.cwd))\n return inherited(cwd === spec.cwd ? spec : { ...spec, cwd })\n }\n Object.defineProperty(seam, 'spawn', { configurable: true, writable: true, value: mapped })\n return () => {\n // Cordis hands a service out through a traceable proxy that wraps every\n // method read in a fresh function, so the own descriptor — not a read of the\n // method — says whether this decoration is still the installed one.\n if (Object.getOwnPropertyDescriptor(seam, 'spawn')?.value !== mapped) return\n Reflect.deleteProperty(seam, 'spawn')\n }\n}\n","/**\n * The live registration set of derived presets.\n *\n * The settings page can add or remove a source at any moment, so a derived\n * preset is not a startup artefact: this class owns the difference between what\n * is registered right now and what the stored source list asks for, and applies\n * it one operation at a time. `register`/dispose are awaited in queue order, so a\n * person toggling two rows quickly cannot leave a half-applied set behind.\n *\n * @module @banzhe/dsh-devcontainer/variants\n */\n\nimport type { PresetDefinition } from '@deepseek-ai/dsh-agent-preset-registry'\nimport { planVariants } from './presets.ts'\nimport type { PresetDeclaration, PlannedVariant } from './presets.ts'\n\n/** The registry slice this class calls. */\nexport interface VariantRegistryLike {\n /** Register one derived preset; resolves to its disposer. */\n register(definition: PresetDefinition): Promise<() => Promise<void>>\n}\n\n/** The logging slice this class calls. */\nexport interface VariantLogLike {\n warn(message: string): void\n}\n\n/** How the derived set is built. */\nexport interface VariantSyncOptions {\n /** The Host preset registry. */\n readonly registry: VariantRegistryLike\n /** Reports a variant that could not be registered. */\n readonly logger: VariantLogLike\n /** Reads the raw declarations of the current composition. */\n readonly declarations: () => ReadonlyMap<string, PresetDeclaration>\n /** Added to each source order. */\n readonly orderOffset: number\n /** Route-following depth cap. */\n readonly maxDepth?: number\n}\n\n/**\n * Keeps the registered variant set equal to the two stored source lists.\n *\n * Every call is idempotent: `sync` registers what is missing, disposes what is\n * no longer asked for, and touches nothing that is already correct. A variant\n * that fails to register is dropped from the bookkeeping and logged, so the rest\n * of the set still applies.\n */\nexport class VariantSync {\n /** Registered variant ids, in registration order, with their disposers. */\n private readonly registered = new Map<string, () => Promise<void>>()\n\n /** Serializes overlapping syncs so a later list cannot observe a half-applied one. */\n private queue: Promise<void> = Promise.resolve()\n\n /** Set once the row unloads: a queued sync then registers nothing. */\n private stopped = false\n\n constructor(private readonly options: VariantSyncOptions) {}\n\n /** The ids registered right now, in dependency order. */\n ids(): string[] {\n return [...this.registered.keys()]\n }\n\n /**\n * Apply both source lists.\n * @param sources - the preset ids to derive `… (devContainer)` variants from.\n * @param sbxSources - the preset ids to derive `… (sbx)` variants from.\n * @returns the settled application, in queue order.\n */\n sync(sources: readonly string[], sbxSources: readonly string[] = []): Promise<void> {\n return this.enqueue(async () => {\n if (this.stopped) return\n const planned = planVariants({\n declarations: this.options.declarations(),\n sources,\n sbxSources,\n orderOffset: this.options.orderOffset,\n ...this.options.maxDepth === undefined ? {} : { maxDepth: this.options.maxDepth },\n })\n await this.withdraw(planned)\n await this.add(planned)\n })\n }\n\n /**\n * Dispose every registered variant.\n * @returns the settled teardown, in queue order.\n */\n clear(): Promise<void> {\n return this.enqueue(async () => {\n await this.withdraw([])\n })\n }\n\n /**\n * Stop for good: queued work is skipped and nothing new registers.\n * @returns the settled teardown, in queue order.\n */\n stop(): Promise<void> {\n this.stopped = true\n return this.clear()\n }\n\n private enqueue(work: () => Promise<void>): Promise<void> {\n const next = this.queue.then(work, work)\n // A rejected step must not poison the queue: the next toggle still applies.\n this.queue = next.catch(() => {})\n return next\n }\n\n /** Dispose the registered variants the plan no longer contains, dependants first. */\n private async withdraw(planned: readonly PlannedVariant[]): Promise<void> {\n const keep = new Set(planned.map(variant => variant.id))\n const order = [...this.registered.keys()].reverse()\n for (const id of order) {\n if (keep.has(id)) continue\n const dispose = this.registered.get(id)\n this.registered.delete(id)\n if (dispose === undefined) continue\n try {\n await dispose()\n } catch (error) {\n this.options.logger.warn(`devcontainer: preset variant ${id} did not unregister cleanly: ${String(error)}`)\n }\n }\n }\n\n /** Register the planned variants that are not registered yet, dependencies first. */\n private async add(planned: readonly PlannedVariant[]): Promise<void> {\n for (const variant of planned) {\n if (this.registered.has(variant.id)) continue\n if (this.stopped) return\n try {\n const dispose = await this.options.registry.register({\n id: variant.id,\n name: variant.name,\n description: variant.description,\n order: variant.order,\n plugins: variant.plugins as unknown as PresetDefinition['plugins'],\n })\n this.registered.set(variant.id, dispose)\n } catch (error) {\n // One unavailable variant leaves its route on the original target.\n this.options.logger.warn(`devcontainer: preset variant ${variant.id} unavailable: ${String(error)}`)\n }\n }\n }\n}\n","/**\n * The Host half of the Dev Container / Docker Sandbox Bundle: the Linux runtime\n * context and the two derived preset tracks (`… (devContainer)`, `… (sbx)`).\n *\n * Neither half provides a service, so this row has no `inject` requirement: it\n * waits for `systemPrompt` to listen, and reads `loader`/`agentPresets` only when\n * a composition supplies them.\n *\n * The variant set is a SETTING, not a constant: `sources` (the Dev Container\n * track, written by the settings page) and `sbxSources` (the Docker Sandbox\n * track) are volatile fields, so a write lands in this live reference and in the\n * profile patch, and each write re-derives the whole set immediately — the newly\n * checked source registers, the unchecked one disposes. Nothing is derived until\n * someone asks for it.\n *\n * @module @banzhe/dsh-devcontainer\n */\n\nimport type { Context, Volatile } from '@deepseek-ai/cordis'\nimport z from '@deepseek-ai/schemastery'\nimport type { Agent } from '@deepseek-ai/dsh-agent'\nimport type { PromptAssembly } from '@deepseek-ai/dsh-system-prompt'\n// Type-only: the `settings/document-updated` event this row follows.\nimport type {} from '@deepseek-ai/dsh-settings'\nimport type {} from '@deepseek-ai/dsh-working-directory'\nimport {\n containerOptionFields, containerOptions, hostMountFields, presetSourceFields, sandboxTemplateFields,\n} from './options.ts'\nimport { toContainerPath } from './paths.ts'\nimport {\n applyContainerContext, containerContextText, hostDirectoryFromContext, missingContainerContextText, sbxContextText,\n} from './prompt.ts'\nimport { asDeclaration, PRESET_MODULE } from './presets.ts'\nimport type { PresetDeclaration } from './presets.ts'\nimport { installPtcCwdMapping } from './ptc.ts'\nimport {\n containerPresetOf,\n DEVCONTAINER_ENV_KEY,\n DEVCONTAINER_ENV_VALUE,\n DEVCONTAINER_PRESET_ENV_KEY,\n presetKindOf,\n SBX_ENV_KEY,\n SBX_ENV_VALUE,\n SBX_PRESET_ENV_KEY,\n} from './refusal.ts'\nimport type { PresetLookup } from './refusal.ts'\nimport { liveSbxOptions, registerHostMounts, registerSandboxTemplate, repoRegistry } from './registry.ts'\nimport { installSpawnCwdMapping, repositoryOfPath } from './subprocess.ts'\nimport { sandboxNameFor, sbxSpecFor, sbxWorkspaceRootFor } from './sbx.ts'\nimport { VariantSync } from './variants.ts'\nimport type { VariantRegistryLike } from './variants.ts'\nimport { hostMountsConfig } from './host-mounts.ts'\nimport type { ContainerOptions, HostMountsConfig } from './types.ts'\n\n/** Plugin name used by the Loader row, and the settings namespace the page edits. */\nexport const name = 'devcontainer'\n\n/** How deep a derived preset may follow its subagent routes. */\nconst MAX_VARIANT_DEPTH = 4\n\n/** The host-level event a settings write emits once the entry's config changed. */\nconst SETTINGS_UPDATED = 'settings/document-updated'\n\n/** The Loader event a volatile-only config change commits through. */\nconst VOLATILE_UPDATED = 'loader/volatile-update'\n\n/**\n * The settings namespace the shipped preset surfaces watch for roster changes.\n *\n * They re-read `agentPresets.list` when `settings/document-updated` names the\n * preset REGISTRY entry (`packages/client/ui-agent-preset/src/client/index.ts:164-167`),\n * which is the only roster-refresh signal a third-party registration can reach.\n */\nconst PRESET_REGISTRY_NS = 'agent-preset-registry'\n\n/** Labelling and gating the schema also supplies, kept here for the runtime read. */\nconst VARIANT_DEFAULTS: PresetVariantConfig = {\n enabled: true,\n win32Only: true,\n orderOffset: 1,\n}\n\n/** How the derived variants are built and labelled. */\nexport interface PresetVariantConfig {\n /** Register variants at all (default true); a false row is a pure container shell. */\n enabled: boolean\n /**\n * Only derive on win32 (default true): the platform where presets ship\n * `pwsh` instead of `bash`. Elsewhere the variants would be duplicates.\n */\n win32Only: boolean\n /**\n * Added to the source preset's `order` so the variant sorts right after it.\n *\n * The display suffix is not configurable: it is what the shell row reads back\n * to know which marker a preset needs, so it is owned by `src/ids.ts`.\n */\n orderOffset: number\n}\n\n/** Plugin config. */\nexport interface Config extends ContainerOptions {\n /** Source preset ids the page asked to derive a `… (devContainer)` variant from; empty derives nothing. */\n sources: Volatile<readonly string[]>\n /** Source preset ids the profile asked to derive a `… (sbx)` variant from; empty derives nothing. */\n sbxSources: Volatile<readonly string[]>\n /**\n * Image a created Docker Sandbox runs (`sbx create --template`); blank keeps\n * Docker's `shell` template. Written by the settings page, read by the shell,\n * filesystem, and subprocess rows through `liveSandboxTemplate`.\n */\n sbxTemplate: Volatile<string>\n /**\n * Extra read-only host paths a created Docker Sandbox mounts beside the\n * workspace (`auto`, `off`, or an explicit `PATH[:TARGET][:ro]` list). Read by\n * the shell, filesystem, and subprocess rows through `liveHostMounts`.\n */\n hostMounts: Volatile<HostMountsConfig>\n presets: PresetVariantConfig\n}\n\n/**\n * The live schema the settings page edits and the Loader validates.\n *\n * Deliberately not annotated `z<Config>`: the interface describes the runtime\n * config (`sources` is a `Volatile` reference), while the schema's own output is\n * the plain field type.\n */\nexport const Config = z.object({\n ...containerOptionFields(),\n ...presetSourceFields(),\n ...sandboxTemplateFields(),\n ...hostMountFields(),\n presets: z.object({\n enabled: z.boolean().default(true),\n win32Only: z.boolean().default(true),\n orderOffset: z.number().default(1),\n }),\n})\n\n/** The subset of the Cordis Loader this row reads, kept structural so the Bundle needs no Loader dependency. */\ninterface LoaderEntryLike {\n readonly options: { readonly name: string; readonly config?: unknown }\n}\n\ninterface LoaderLike {\n await(): Promise<void>\n entries(): Iterable<LoaderEntryLike>\n}\n\n/** The subset of the preset registry this row calls. */\ntype PresetRegistryLike = VariantRegistryLike\n\n/** Read one service without a typed `Context` augmentation. */\nfunction serviceOf(ctx: Context, service: string): unknown {\n return (ctx as unknown as { get(name: string): unknown }).get(service)\n}\n\n/** The host directory one assembly is about. */\nfunction hostDirectoryOf(ctx: Context, assembly: PromptAssembly, agent: Agent | undefined): string | undefined {\n if (agent === undefined) return hostDirectoryFromContext(assembly)\n const workingDirectory = serviceOf(ctx, 'workingDirectory') as { get(session: Agent['session']): string } | undefined\n return workingDirectory === undefined\n ? hostDirectoryFromContext(assembly)\n : workingDirectory.get(agent.session)\n}\n\n/**\n * Load the row: rewrite the working-directory context, and keep the derived\n * preset set equal to the two stored source lists.\n *\n * Deliberately the module's only plugin export besides its schema and name: the\n * Loader's `unwrapExports` prefers a `default` export, and a `default`-exported\n * `apply` would be the whole plugin — losing this module's `Config`, so the row\n * would activate with the raw (absent) config instead of the resolved one.\n * @param ctx - the Host plugin context.\n * @param configured - this row's resolved config; absent when the row declares none.\n */\nexport function apply(ctx: Context, configured?: Config): void {\n const config: Config = configured ?? ({} as Config)\n ctx.inject(['systemPrompt'], (child: Context) => {\n child.on('system-prompt/assemble', async (_assembly, context, next) => {\n // Prepend runs this listener first, so `next()` returns after the\n // working-directory service wrote its final text.\n const result = await next()\n const agent = context.agent\n // Only a session that actually runs in the container is told it does. An\n // ordinary preset keeps its own working-directory context and its own\n // shell, even when the repository declares a container.\n const preset = containerPresetOf(serviceOf(child, 'agentPresets') as PresetLookup | undefined, agent?.session)\n if (preset === undefined && !config.requireContainer) return result\n const hostWorkdir = hostDirectoryOf(child, result, agent)\n if (hostWorkdir === undefined) return result\n const options = containerOptions(config)\n const repository = repoRegistry(child).locate(hostWorkdir, { ...options, cwd: hostWorkdir })\n if (presetKindOf(preset) === 'sbx') {\n // A sandbox needs no declaration, so the missing-configuration branch\n // below cannot apply: the workspace is the session's own directory.\n const root = sbxWorkspaceRootFor(hostWorkdir, hostWorkdir, repository)\n if (root === undefined) return result\n const spec = sbxSpecFor(root, liveSbxOptions(child, options), repository)\n applyContainerContext(result, sbxContextText(\n toContainerPath(hostWorkdir, spec),\n spec.sandbox ?? sandboxNameFor(root),\n hostWorkdir,\n ))\n return result\n }\n if (repository === undefined) {\n // A (devContainer) preset over a repository that declares no container:\n // say so in the prompt, because the shell tool will refuse every command.\n if (preset === undefined) return result\n applyContainerContext(result, missingContainerContextText(hostWorkdir, preset))\n return result\n }\n applyContainerContext(result, containerContextText(\n toContainerPath(hostWorkdir, repository),\n repository,\n hostWorkdir,\n ))\n return result\n }, { prepend: true })\n })\n\n // A container-bound session hands every seam container paths, but a host\n // process can only start in a directory this host has: the working directory a\n // `run_code` PTC worker receives is `/workspaces/<repo>`, which no host can\n // `chdir` into. The spawn directory is translated back onto the repository root\n // and nothing else about the seam changes.\n ctx.inject(['subprocess'], (child: Context) => {\n child.effect(() => installSpawnCwdMapping(\n child.subprocess,\n cwd => repositoryOfPath(child, cwd, containerOptions(config)),\n ), 'devcontainer.spawn-cwd')\n })\n\n // The PTC seam starts a worker of its own: `resolve` fills a directory the\n // caller left out from the sandbox policy's workspace root — the container's\n // `/workspaces/<repo>` — and `run` hands it to a program that `process.chdir`s\n // into it. Decorating `ctx.subprocess` does not reach that worker, so the\n // directory is translated here as well, at both entry points.\n ctx.inject(['ptcRuntime'], (child: Context) => {\n child.effect(() => installPtcCwdMapping(\n child.ptcRuntime,\n cwd => repositoryOfPath(child, cwd, containerOptions(config)),\n ), 'devcontainer.ptc-cwd')\n })\n\n ctx.effect(() => {\n const cache = repoRegistry(ctx)\n markContainerPresets(ctx)\n return () => { cache.reset() }\n })\n // The image belongs to this row (the settings page writes this namespace) while\n // the rows that create a sandbox are the shell, filesystem, and subprocess ones:\n // they ask this reader at the moment they build a specification, so a write is\n // answered by the next command rather than by the next reload.\n ctx.effect(\n () => registerSandboxTemplate(ctx, () => configuredSbxTemplate(ctx, config)),\n 'devcontainer.sbx-template',\n )\n // The extra host mounts are read the same way and for the same reason: the rows\n // that create a sandbox ask this reader at the moment they build a\n // specification, so the value in force at that moment is the one that lands.\n ctx.effect(\n () => registerHostMounts(ctx, () => configuredHostMounts(ctx, config)),\n 'devcontainer.host-mounts',\n )\n registerVariants(ctx, config)\n}\n\n/**\n * The sandbox image this row configures right now, trimmed, or undefined when it\n * configures none.\n *\n * The live reference is read on every call rather than copied at mount time: a\n * settings write commits into the fiber's effective config (the same path\n * `storedList` follows), and the profile patch may land after this row mounted.\n * @param ctx - this row's context.\n * @param config - the resolved config this row was mounted with.\n * @returns the image to pass as `--template`, or undefined for the CLI's own template.\n */\nfunction configuredSbxTemplate(ctx: Context, config: Config): string | undefined {\n const value: unknown = liveField(ctx, 'sbxTemplate') ?? config.sbxTemplate\n if (value === undefined || value === null) return undefined\n const text: unknown = typeof (value as { get?: unknown }).get === 'function'\n ? (value as { get(): unknown }).get()\n : value\n const image = typeof text === 'string' ? text.trim() : ''\n return image === '' ? undefined : image\n}\n\n/**\n * The extra host mounts this row configures right now.\n * @param ctx - this row's context.\n * @param config - the resolved config this row was mounted with.\n * @returns the configured value, or the schema default when this row carries none.\n */\nfunction configuredHostMounts(ctx: Context, config: Config): HostMountsConfig {\n return hostMountsConfig(liveField(ctx, 'hostMounts') ?? config.hostMounts)\n}\n\n/**\n * The value of one field as the fiber holds it right now, or undefined when it holds none.\n *\n * A volatile field is committed into the fiber's effective config rather than into\n * the object `apply` was handed, and the profile patch may land after this row\n * mounted, so the live reference is the only current answer. The cast is the price\n * of reading a Cordis internal this Bundle does not own: the shape is checked here\n * and nowhere else.\n * @param ctx - this row's context.\n * @param field - the config key to read.\n * @returns the live value, or undefined when the fiber carries none.\n */\nfunction liveField(ctx: Context, field: string): unknown {\n const fiber = (ctx as unknown as { fiber?: { effectiveConfig?: Record<string, unknown> } }).fiber\n return fiber?.effectiveConfig?.[field]\n}\n\n/** The `ctx.shellEnv` slice this row registers into. */\ninterface ShellEnvLike {\n register(contributor: {\n name: string\n variables: Record<string, { description: string }>\n resolve(execution: { agent?: { session: unknown } }): Record<string, string>\n }): () => void\n}\n\n/**\n * Mark every shell call issued from a derived preset.\n *\n * The marker rides the managed `DSH_*` environment, which the shell tools build\n * per call from the calling agent: `exec.agent` is the one fact the executor\n * cannot otherwise see, so this is what lets `DevcontainerShellExecutor` refuse a\n * command instead of guessing whose it is. Each track has its own pair of\n * variables — `DSH_DEVCONTAINER` / `DSH_DEVCONTAINER_PRESET` and `DSH_SBX` /\n * `DSH_SBX_PRESET` — so the executor, the filesystem, the subprocess, and the PTC\n * seams route a call without re-deriving which preset asked for it. Values are\n * recomputed per call, so switching presets mid-session needs no reload.\n */\nfunction markContainerPresets(ctx: Context): void {\n ctx.inject(['shellEnv'], (child: Context) => {\n const shellEnv = serviceOf(child, 'shellEnv') as ShellEnvLike | undefined\n if (shellEnv === undefined) return\n child.effect(() => shellEnv.register({\n name: 'devcontainer-preset',\n variables: {\n [DEVCONTAINER_ENV_KEY]: {\n description: 'Set for shell calls issued from a (devContainer) preset; the command must reach a container.',\n },\n [DEVCONTAINER_PRESET_ENV_KEY]: {\n description: 'The (devContainer) preset id that issued this shell call.',\n },\n [SBX_ENV_KEY]: {\n description: 'Set for shell calls issued from a (sbx) preset; the command must reach its Docker Sandbox.',\n },\n [SBX_PRESET_ENV_KEY]: {\n description: 'The (sbx) preset id that issued this shell call.',\n },\n },\n resolve: (execution) => {\n const presets = serviceOf(child, 'agentPresets') as PresetLookup | undefined\n const preset = containerPresetOf(presets, execution.agent?.session)\n if (preset === undefined) return {}\n if (presetKindOf(preset) === 'sbx') {\n return { [SBX_ENV_KEY]: SBX_ENV_VALUE, [SBX_PRESET_ENV_KEY]: preset }\n }\n return { [DEVCONTAINER_ENV_KEY]: DEVCONTAINER_ENV_VALUE, [DEVCONTAINER_PRESET_ENV_KEY]: preset }\n },\n }))\n })\n}\n\n/**\n * Wire the variant set: derive once the tree is up, then re-derive on every write\n * that lands in this row's config.\n *\n * The sync is built inside `ctx.inject`, not at mount time. Both services can\n * activate AFTER this row (this row is inserted by the Bundle patch; the preset\n * registry is configured by the Profile patch), and a lookup made at mount time —\n * memoized like any other lazy init — would keep reporting \"no registry\" for the\n * life of the process, which looks exactly like a page whose checkbox never\n * registers anything. Cordis holds this callback until both exist and re-runs it\n * if they ever go away, so the derived set follows the composition.\n */\nfunction registerVariants(ctx: Context, config: Config): void {\n const presets: PresetVariantConfig = { ...VARIANT_DEFAULTS, ...config.presets }\n if (!presets.enabled) return\n if (presets.win32Only && process.platform !== 'win32') return\n\n // A stored list is read defensively: a row mounted programmatically (no profile\n // config) reaches this point with no `sources` / `sbxSources` reference at all,\n // and \"nothing is derived\" is the only sane reading of an absent list.\n const storedList = (field: 'sources' | 'sbxSources'): readonly string[] => {\n // Read the LIVE config: the Profile patch can land after this row mounted,\n // and a volatile-only change commits into the fiber's effective config rather\n // than into the object `apply` was handed.\n const value: unknown = liveField(ctx, field) ?? config[field]\n if (value === undefined || value === null) return []\n const list: unknown = typeof (value as { get?: unknown }).get === 'function'\n ? (value as { get(): unknown }).get()\n : value\n return Array.isArray(list) ? list.filter((id): id is string => typeof id === 'string' && id.length > 0) : []\n }\n\n const root = (ctx as unknown as { root: Context }).root\n\n ctx.inject(['loader', 'agentPresets'], (child: Context) => {\n const loader = serviceOf(child, 'loader') as LoaderLike\n const registry = serviceOf(child, 'agentPresets') as PresetRegistryLike\n // Read the declarations per sync: a preset row declared after this row\n // settled is still derivable without reloading the Bundle.\n const declarations = (): ReadonlyMap<string, PresetDeclaration> => {\n const found = new Map<string, PresetDeclaration>()\n for (const entry of loader.entries()) {\n if (entry.options.name !== PRESET_MODULE) continue\n const declaration = asDeclaration(entry.options.config)\n if (declaration !== undefined) found.set(declaration.id, declaration)\n }\n return found\n }\n const sync = new VariantSync({\n registry,\n logger: ctx.logger,\n declarations,\n orderOffset: presets.orderOffset,\n maxDepth: MAX_VARIANT_DEPTH,\n })\n\n const run = (): void => {\n void (async () => {\n // The tree must be up before its declarations can be read: a source\n // preset row may be inserted by a later patch layer.\n await loader.await()\n const before = sync.ids().join('\\n')\n await sync.sync(storedList('sources'), storedList('sbxSources'))\n // A roster change is invisible to an open picker unless it hears about\n // one: those surfaces re-read the roster on `settings/document-updated`\n // for the preset registry's namespace, and a registration made here is\n // not a settings write. Announce the new roster there.\n if (sync.ids().join('\\n') !== before) {\n // The event contract brands its namespace; this row owns no such type\n // for a foreign entry id, and the payload is what makes it a refresh.\n (root.emit as (name: string, ...args: unknown[]) => void)(\n SETTINGS_UPDATED, PRESET_REGISTRY_NS, Date.now(),\n )\n }\n })().catch((error: unknown) => {\n ctx.logger.warn(`devcontainer: preset variants unavailable: ${String(error)}`)\n })\n }\n\n // Reverse order: stop the queue before the scope it registers into goes away.\n child.effect(() => () => { void sync.stop() }, 'devcontainer.preset-variants')\n // A settings write commits the stored list into the live reference and then\n // emits this event, so the derived set follows the page without a remount.\n //\n // The event carries the Loader entry id of the row that owns the namespace,\n // not necessarily the namespace itself, so this listener cannot filter by\n // name: an entry loaded under a custom id would never sync. Syncing an\n // unchanged list is a no-op, so listening to every settings write is both\n // safe and cheap.\n child.on(SETTINGS_UPDATED, run)\n // The same write also commits a volatile field in place; that commit is what\n // carries the value this row reads, and it is emitted on this row's fiber.\n child.on(VOLATILE_UPDATED, run)\n run()\n })\n}\n"],"mappings":";;;;;AAiBA,MAAa,4BAA4B;;;;;;;AAQzC,SAAgB,eAAe,MAAiC;CAC9D,IAAI,KAAK,cAAc,KAAA,GAAW,OAAO,KAAK;CAC9C,IAAI,KAAK,mBAAmB,KAAA,GAAW,OAAO,WAAW,KAAK;CAC9D,MAAM,OAAO,cAAc,KAAK,iBAAiB,MAAM,UACnD,MAAM,SAAS,KAAK,iBAAiB,IACrC,MAAM,SAAS,KAAK,iBAAiB;CACzC,OAAO,SAAS,KAAK,KAAK,oBAAoB;AAChD;;;;;;;;AASA,SAAgB,qBACd,kBACA,MACA,aACQ;CACR,OAAO,+BAA+B,iBAAiB,mDACH,eAAe,IAAI,EAAE,iCAAiC,YAAY;AAExH;;;;;;;;;;;;AAaA,SAAgB,eACd,kBACA,aACA,aACQ;CACR,OAAO,+BAA+B,iBAAiB,iDACL,YAAY,mCAAmC,YAAY;AAE/G;;;;;;;;;;;;;AAcA,SAAgB,4BAA4B,aAAqB,QAAwB;CACvF,OAAO,+BAA+B,YAAY,wEACuB,OAAO,gCAAgC,YAAY;;;AAK9H;;;;;;;AAQA,SAAgB,sBAAsB,UAA0B,MAAuB;CACrF,MAAM,eAAe,SAAS,SAAS,MAAK,UAAS,MAAM,SAAS,yBAAyB;CAC7F,IAAI,iBAA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KAAK,MAAM,SAAS,OAAO,QAAQ,GAAG;IACpC,IAAI,MAAM,QAAQ,SAAA,iCAAwB;IAC1C,MAAM,cAAc,cAAc,MAAM,QAAQ,MAAM;IACtD,IAAI,gBAAgB,KAAA,GAAW,MAAM,IAAI,YAAY,IAAI,WAAW;GACtE;GACA,OAAO;EACT;EACA,MAAM,OAAO,IAAI,YAAY;GAC3B;GACA,QAAQ,IAAI;GACZ;GACA,aAAa,QAAQ;GACrB,UAAU;EACZ,CAAC;EAED,MAAM,YAAkB;GACtB,CAAM,YAAY;IAGhB,MAAM,OAAO,MAAM;IACnB,MAAM,SAAS,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI;IACnC,MAAM,KAAK,KAAK,WAAW,SAAS,GAAG,WAAW,YAAY,CAAC;IAK/D,IAAI,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,MAAM,QAG5B,KAAM,KACJ,kBAAkB,oBAAoB,KAAK,IAAI,CACjD;GAEJ,EAAA,CAAG,CAAC,CAAC,OAAO,UAAmB;IAC7B,IAAI,OAAO,KAAK,8CAA8C,OAAO,KAAK,GAAG;GAC/E,CAAC;EACH;EAGA,MAAM,mBAAmB;GAAE,KAAU,KAAK;EAAE,GAAG,8BAA8B;EAS7E,MAAM,GAAG,kBAAkB,GAAG;EAG9B,MAAM,GAAG,kBAAkB,GAAG;EAC9B,IAAI;CACN,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["serviceOf"],"sources":["../src/prompt.ts","../src/presets.ts","../src/ptc.ts","../src/subprocess.ts","../src/variants.ts","../src/index.ts"],"sourcesContent":["/**\n * The Linux container context: the one place the model learns it is not on\n * Windows.\n *\n * `WorkingDirectoryService` owns the `working-directory:current` context and\n * rewrites it after `next()`; a listener registered with `{ prepend: true }`\n * runs first and therefore sees that final text, which is what this module\n * replaces.\n * @module @banzhe/dsh-devcontainer/prompt\n */\n\nimport type { PromptPresentation } from '@deepseek-ai/dsh-system-prompt'\nimport { win32, posix } from 'node:path'\nimport { hostPathStyle } from './paths.ts'\nimport type { RepoContainerSpec } from './types.ts'\n\n/** Name of the context `WorkingDirectoryService` contributes. */\nexport const WORKING_DIRECTORY_CONTEXT = 'working-directory:current'\n\n/**\n * The label the prompt names the container by: the explicit container, its\n * compose service, or the repository directory name.\n * @param spec - the repository container specification.\n * @returns a short human label.\n */\nexport function containerLabel(spec: RepoContainerSpec): string {\n if (spec.container !== undefined) return spec.container\n if (spec.composeService !== undefined) return `service ${spec.composeService}`\n const base = hostPathStyle(spec.hostWorkspaceRoot) === 'win32'\n ? win32.basename(spec.hostWorkspaceRoot)\n : posix.basename(spec.hostWorkspaceRoot)\n return base === '' ? spec.hostWorkspaceRoot : base\n}\n\n/**\n * The replacement text for `working-directory:current`.\n * @param containerWorkdir - POSIX directory the command runs in.\n * @param spec - the repository container specification.\n * @param hostWorkdir - the host directory that mount corresponds to.\n * @returns the assembled context text.\n */\nexport function containerContextText(\n containerWorkdir: string,\n spec: RepoContainerSpec,\n hostWorkdir: string,\n): string {\n return `Current working directory: \"${containerWorkdir}\".\\n`\n + `Runtime environment: Linux Docker container (${containerLabel(spec)}) mounted from host directory \"${hostWorkdir}\". `\n + 'The active shell is Linux bash (/bin/bash). Always write POSIX/Linux commands and never PowerShell commands.'\n}\n\n/**\n * The replacement text for `working-directory:current` under a `(sbx)` preset.\n *\n * A sandbox needs no declaration, so this text never explains a refusal: it names\n * the sandbox and states the one fact the model cannot infer — that the paths are\n * the host's own, because `sbx` mounts a workspace at the same absolute path.\n * @param containerWorkdir - the directory the command runs in.\n * @param sandboxName - the Docker Sandbox it runs in.\n * @param hostWorkdir - the host directory that sandbox mounts.\n * @returns the assembled context text.\n */\nexport function sbxContextText(\n containerWorkdir: string,\n sandboxName: string,\n hostWorkdir: string,\n): string {\n return `Current working directory: \"${containerWorkdir}\".\\n`\n + `Runtime environment: Linux Docker Sandbox \"${sandboxName}\" (sbx) mounting host directory \"${hostWorkdir}\" at the same absolute path. `\n + 'The active shell is Linux bash (/bin/bash). Always write POSIX/Linux commands and never PowerShell commands.'\n}\n\n/**\n * The replacement text for `working-directory:current` when a `(devContainer)`\n * preset meets a repository that declares no container.\n *\n * The instruction is explicit about the two things the model must not do: retry\n * the command or the file access, and describe the failure as if it were temporary. It also says\n * which language to report in, because the person on the other side chose a\n * Chinese-labelled preset.\n * @param hostWorkdir - the host directory the session is working in.\n * @param preset - the derived preset id the session runs.\n * @returns the assembled context text.\n */\nexport function missingContainerContextText(hostWorkdir: string, preset: string): string {\n return `Current working directory: \"${hostWorkdir}\".\\n`\n + `Runtime environment: this session runs the (devContainer) preset \"${preset}\", but the working directory \"${hostWorkdir}\" declares no Dev Container configuration.\\n`\n + 'Looked for .devcontainer/devcontainer.json, .devcontainer.json, .dsh/devcontainer.json, and .dsh/docker.json in that directory and every ancestor directory.\\n'\n + 'Every shell command and every file operation is BLOCKED: the shell tool refuses to run commands on the host, the file tools refuse to read or write host files, so nothing has executed and nothing will execute until this repository gets a container configuration.\\n'\n + 'Tell the user this immediately, in Chinese: the (devContainer) preset requires a container configuration for this repository, and there are two ways out — add one of those files (for example .devcontainer/devcontainer.json, or .dsh/docker.json pointing at a container that is already running), or switch back to an ordinary preset (标准模式 / 委派模式).'\n + ' Do not retry shell commands or file operations while this stands, and do not describe it as a temporary failure.'\n}\n\n/**\n * Replace (or add) the working-directory context of one assembly.\n * @param assembly - the mutable assembly the waterfall produced.\n * @param text - the container context text.\n * @returns true when the assembly was changed.\n */\nexport function applyContainerContext(assembly: PromptPresentation, text: string): boolean {\n const contribution = assembly.contexts.find(entry => entry.name === WORKING_DIRECTORY_CONTEXT)\n if (contribution === undefined) {\n assembly.contexts.unshift({ name: WORKING_DIRECTORY_CONTEXT, text, interpolate: false })\n return true\n }\n contribution.text = text\n contribution.interpolate = false\n return true\n}\n\n/**\n * Read the host directory back out of an assembly that carries no agent.\n * @param assembly - the assembly to read.\n * @returns the host directory the `working-directory:current` context names, or undefined.\n */\nexport function hostDirectoryFromContext(assembly: PromptPresentation): string | undefined {\n const contribution = assembly.contexts.find(entry => entry.name === WORKING_DIRECTORY_CONTEXT)\n if (contribution === undefined) return undefined\n const match = /Current working directory: (\".*?\")\\./.exec(contribution.text)\n if (match === null) return undefined\n try {\n const parsed: unknown = JSON.parse(match[1] as string)\n return typeof parsed === 'string' ? parsed : undefined\n } catch {\n return undefined\n }\n}\n","/**\n * Preset-variant transforms.\n *\n * A preset is a declarative plugin list, and the shipped presets pick their\n * shell tool with `disabled: !!js process.platform === 'win32'`: on Windows every\n * agent gets `pwsh` and no `bash`. Inside a Linux container that is backwards,\n * but a preset is config DATA, not a Loader row — a patch entry cannot reach\n * into `config.plugins`, and the registry has no mutation API. So this Bundle\n * reads a preset's declaration out of the Loader tree and registers a derived\n * one: same roster, shell tools flipped, subagent routes pointing at the derived\n * subagent presets.\n *\n * Every function here is pure, so the whole derivation is unit-tested without a\n * Cordis composition.\n * @module @banzhe/dsh-devcontainer/presets\n */\n\nimport { VARIANT_KINDS, variantIdOf, variantKindOf, variantNameSuffixOf } from './ids.ts'\nimport type { VariantKind } from './ids.ts'\n\n/**\n * Every row that gives an agent a POSIX shell. The shipped presets pick between\n * these and their PowerShell twins with `disabled: !!js process.platform === 'win32'`,\n * and they do not always use the plain tool: `minimal` mounts\n * `tool-bash-persistent` / `tool-pwsh-persistent` plus `terminal-bash`, so a\n * variant that only flipped the plain pair would still come up with PowerShell.\n */\nexport const BASH_TOOL_MODULES: readonly string[] = [\n '@deepseek-ai/dsh-tool-bash',\n '@deepseek-ai/dsh-tool-bash-persistent',\n '@deepseek-ai/dsh-terminal-bash',\n]\n\n/** Every row that gives an agent a PowerShell shell. */\nexport const PWSH_TOOL_MODULES: readonly string[] = [\n '@deepseek-ai/dsh-tool-pwsh',\n '@deepseek-ai/dsh-tool-pwsh-persistent',\n]\n\n/**\n * Rows whose tool spawns and OWNS its shell process (a PTY, or a persistent\n * session) instead of asking `ctx.shell` for one.\n *\n * They cannot be part of a container variant: the process would start on the\n * host, which is exactly what this Bundle exists to avoid, and on Windows the\n * terminal backend collides with the one the platform already registered\n * (\"a PTY backend named \\\"shell\\\" is already registered\" — the derived preset\n * then mounts as `broken` and disappears from the picker).\n */\nexport const PERSISTENT_SHELL_MODULES: readonly string[] = [\n '@deepseek-ai/dsh-tool-bash-persistent',\n '@deepseek-ai/dsh-terminal-bash',\n]\n\n/** The plain bash tool row, kept as the historical single-name export. */\nexport const BASH_TOOL_MODULE = BASH_TOOL_MODULES[0] as string\n\n/** The plain PowerShell tool row, kept as the historical single-name export. */\nexport const PWSH_TOOL_MODULE = PWSH_TOOL_MODULES[0] as string\n\n/** Module specifier of a preset declaration row. */\nexport const PRESET_MODULE = '@deepseek-ai/dsh-agent-preset'\n\n/** One row of a declarative preset plugin list. */\nexport interface PresetRow {\n readonly id?: string\n readonly name: string\n readonly group?: boolean | null\n readonly disabled?: unknown\n readonly config?: unknown\n readonly [key: string]: unknown\n}\n\n/** The fields of a preset declaration this Bundle reads and reproduces. */\nexport interface PresetDeclaration {\n readonly id: string\n readonly name?: string\n readonly description?: string\n readonly order?: number\n readonly plugins: readonly PresetRow[]\n}\n\n/**\n * The derived id for one source preset on one track.\n * @param sourceId - the declared preset id.\n * @param kind - the track; `(devContainer)` when omitted.\n * @returns the variant id, or the id itself when it already names a variant.\n */\nexport function variantId(sourceId: string, kind: VariantKind = 'devcontainer'): string {\n return variantKindOf(sourceId) === undefined ? variantIdOf(sourceId, kind) : sourceId\n}\n\nfunction isRow(value: unknown): value is PresetRow {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n && typeof (value as { name?: unknown }).name === 'string'\n}\n\nfunction childRows(row: PresetRow): readonly PresetRow[] | undefined {\n return row.group === true && Array.isArray(row.config) ? row.config.filter(isRow) : undefined\n}\n\n/** Deep-clone preset data (plain objects, arrays, and `!!js` marker objects). */\nexport function cloneRows(rows: readonly PresetRow[]): PresetRow[] {\n return rows.map((row) => {\n const cloned: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(row)) cloned[key] = cloneValue(value)\n return cloned as unknown as PresetRow\n })\n}\n\nfunction cloneValue(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(cloneValue)\n if (typeof value === 'object' && value !== null) {\n const cloned: Record<string, unknown> = {}\n for (const [key, entry] of Object.entries(value)) cloned[key] = cloneValue(entry)\n return cloned\n }\n return value\n}\n\n/**\n * Whether one row asks for a PowerShell shell.\n *\n * The module alone does not decide: `terminal-bash` carries BOTH dialects, and a\n * `shellDialect: pwsh` row left enabled is what collides with the bash backend.\n * @param row - the declared row.\n * @returns true for a PowerShell row in either form.\n */\nfunction isPowerShellRow(row: PresetRow): boolean {\n if (PWSH_TOOL_MODULES.includes(row.name)) return true\n return typeof row.config === 'object' && row.config !== null\n && (row.config as { shellDialect?: unknown }).shellDialect === 'pwsh'\n}\n\n/**\n * Flip every shell tool row at any nesting depth, so the variant speaks bash\n * inside the container and nothing else.\n *\n * - a PowerShell row (by module or by `shellDialect`) is disabled;\n * - a persistent/terminal bash row cannot keep its module: it owns a host-side\n * shell process, so it is rewritten into the ordinary `tool-bash` row, which\n * goes through `ctx.shell` and therefore into the container;\n * - only ONE such row is rewritten, because a second would mount a duplicate\n * `bash` tool; the rest are disabled;\n * - a row that already is `tool-bash`, or has no `disabled` field at all, gains\n * an explicit one, so a preset can no longer inherit the platform guess.\n * @param rows - the declared plugin list.\n * @returns a new list; the input is never mutated.\n */\nexport function rewriteShellTools(rows: readonly PresetRow[]): PresetRow[] {\n const state = { plain: false, replaced: false }\n const scan = (list: readonly PresetRow[]): void => {\n for (const row of list) {\n if (row.name === BASH_TOOL_MODULE) state.plain = true\n const children = childRows(row)\n if (children !== undefined) scan(children)\n }\n }\n scan(rows)\n const rewrite = (list: readonly PresetRow[]): PresetRow[] => list.map((row) => {\n const next: Record<string, unknown> = { ...row }\n if (isPowerShellRow(row)) next.disabled = true\n else if (row.name === BASH_TOOL_MODULE) next.disabled = false\n else if (PERSISTENT_SHELL_MODULES.includes(row.name)) {\n if (state.plain || state.replaced) next.disabled = true\n else {\n state.replaced = true\n next.name = BASH_TOOL_MODULE\n next.disabled = false\n // Terminal knobs (`shellDialect`, PTY sizing) are not `tool-bash` fields.\n delete next.config\n }\n }\n const children = childRows(row)\n if (children !== undefined) next.config = rewrite(children)\n return next as unknown as PresetRow\n })\n return rewrite(rows)\n}\n\n/** The subagent presets one row's config names, in declaration order. */\nfunction presetRefsOf(config: unknown): string[] {\n if (typeof config !== 'object' || config === null || Array.isArray(config)) return []\n const { agentPreset, allowedAgentPresets } = config as {\n agentPreset?: unknown\n allowedAgentPresets?: unknown\n }\n const found: string[] = []\n if (typeof agentPreset === 'string' && agentPreset !== '') found.push(agentPreset)\n if (Array.isArray(allowedAgentPresets)) {\n for (const entry of allowedAgentPresets) {\n if (typeof entry === 'string' && entry !== '') found.push(entry)\n }\n }\n return found\n}\n\n/**\n * Every preset id a plugin list routes a subagent to.\n *\n * A subagent row names its preset twice over: `agentPreset` fixes it, and\n * `allowedAgentPresets` (the array form `@deepseek-ai/dsh-tool-subagent` accepts)\n * lists the choices a caller may make. Both have to be derived, or a route can\n * point at a preset that has no container variant.\n * @param rows - the declared plugin list.\n * @returns the referenced preset ids, in first-seen order, without duplicates.\n */\nexport function referencedPresets(rows: readonly PresetRow[]): string[] {\n const found: string[] = []\n const collect = (list: readonly PresetRow[]): void => {\n for (const row of list) {\n for (const id of presetRefsOf(row.config)) {\n if (!found.includes(id)) found.push(id)\n }\n const children = childRows(row)\n if (children !== undefined) collect(children)\n }\n }\n collect(rows)\n return found\n}\n\n/**\n * Point every subagent route at its derived preset, and cut the routes that\n * have none.\n *\n * A route whose preset has no container variant must not survive as it is: the\n * subagent would start on the host with an ordinary preset while the calling\n * agent keeps believing every command runs in the container. Such a route is\n * removed instead — an `allowedAgentPresets` choice is dropped, and a single\n * fixed `agentPreset` disables its whole row, so the tool is absent rather than\n * silently host-bound. The blocked id stays in the disabled row's config, which\n * is where a reader looking for the cause will look.\n * @param rows - the declared plugin list.\n * @param map - source preset id → derived id, or undefined to leave the route alone.\n * @param blocked - whether one preset id has no variant and its routes must be cut.\n * @returns a new list; the input is never mutated.\n */\nexport function rewriteAgentPresetRefs(\n rows: readonly PresetRow[],\n map: (sourceId: string) => string | undefined,\n blocked: (sourceId: string) => boolean = () => false,\n): PresetRow[] {\n const remap = (id: string): string => {\n const mapped = map(id)\n return mapped === undefined ? id : mapped\n }\n return rows.map((row) => {\n const next: Record<string, unknown> = { ...row }\n const config = row.config\n let cut = false\n if (typeof config === 'object' && config !== null && !Array.isArray(config)) {\n const record = config as { agentPreset?: unknown; allowedAgentPresets?: unknown }\n const rewritten: Record<string, unknown> = { ...record }\n let changed = false\n if (typeof record.agentPreset === 'string') {\n if (blocked(record.agentPreset)) cut = true\n else {\n const mapped = remap(record.agentPreset)\n if (mapped !== record.agentPreset) { rewritten.agentPreset = mapped; changed = true }\n }\n }\n if (Array.isArray(record.allowedAgentPresets)) {\n const ids = record.allowedAgentPresets.filter((entry): entry is string => typeof entry === 'string')\n const kept = ids.filter(id => !blocked(id))\n const mapped = kept.map(remap)\n if (kept.length !== ids.length || mapped.some((id, index) => id !== kept[index])) {\n rewritten.allowedAgentPresets = mapped\n changed = true\n }\n // The array form IS the route list: an emptied one leaves the tool with\n // nothing it may spawn, so the row goes with it.\n if (kept.length === 0) cut = true\n }\n if (changed) next.config = rewritten\n }\n if (cut) next.disabled = true\n const children = childRows(row)\n if (children !== undefined) next.config = rewriteAgentPresetRefs(children, map, blocked)\n return next as unknown as PresetRow\n })\n}\n\n/**\n * Read one preset declaration out of a Loader row's raw config.\n * @param config - the row's `config` value.\n * @returns the declaration, or undefined when the value is not one.\n */\nexport function asDeclaration(config: unknown): PresetDeclaration | undefined {\n if (typeof config !== 'object' || config === null || Array.isArray(config)) return undefined\n const record = config as Record<string, unknown>\n if (typeof record.id !== 'string' || record.id === '' || !Array.isArray(record.plugins)) return undefined\n const plugins = record.plugins.filter(isRow)\n if (plugins.length === 0) return undefined\n return {\n id: record.id,\n ...typeof record.name === 'string' ? { name: record.name } : {},\n ...typeof record.description === 'string' ? { description: record.description } : {},\n ...typeof record.order === 'number' ? { order: record.order } : {},\n plugins,\n }\n}\n/** One derived preset ready to register. */\nexport interface PlannedVariant {\n /** The derived preset id. */\n readonly id: string\n /** The source preset id this variant came from. */\n readonly source: string\n /** Which runtime the variant routes commands to. */\n readonly kind: VariantKind\n /** Display name shown in the preset picker. */\n readonly name: string\n /** Display description. */\n readonly description: string\n /** Sort order: the source's order plus the configured offset. */\n readonly order: number\n /** The rewritten plugin list. */\n readonly plugins: readonly PresetRow[]\n}\n\n/** Inputs of {@link planVariants}. */\nexport interface VariantPlan {\n /** Source declarations by preset id, as read from the Loader tree. */\n readonly declarations: ReadonlyMap<string, PresetDeclaration>\n /** Source preset ids to derive a `… (devContainer)` variant from, in registration order. */\n readonly sources: readonly string[]\n /** Source preset ids to derive a `… (sbx)` variant from, in registration order. */\n readonly sbxSources?: readonly string[]\n /** Added to the source order. */\n readonly orderOffset: number\n /** How deep a variant may follow its own subagent routes (default 4). */\n readonly maxDepth?: number\n}\n\nconst DEFAULT_VARIANT_DEPTH = 4\n\n/**\n * Build the description of one derived preset.\n * @param source - the source declaration.\n * @param kind - the track the variant belongs to.\n * @returns the source description with one added sentence.\n */\nexport function variantDescription(source: PresetDeclaration, kind: VariantKind = 'devcontainer'): string {\n const note = kind === 'sbx'\n ? 'Every command runs inside the Docker Sandbox mounted on this workspace.'\n : \"Every command runs inside the repository's Linux Dev Container.\"\n return source.description === undefined ? note : `${source.description} ${note}`\n}\n\n/**\n * The sentence a variant's description gains when the depth cap cut one of its routes.\n * @param maxDepth - the route-following depth this plan was built with.\n * @returns the explanation appended to the source description.\n */\nfunction depthBlockNote(maxDepth: number): string {\n return `Subagent routes deeper than ${maxDepth} nested levels are disabled: their presets would run on the host instead of inside the container.`\n}\n\n/**\n * Plan the derived preset set for one composition.\n *\n * The whole point is what it does NOT change: a source preset that mounts no\n * shell tool (the delegate main agent) derives to a preset that still mounts\n * none — only the subagent presets it routes to get bash. A source that does\n * mount the pair gets it flipped. Nothing is inserted, so no variant can gain a\n * capability its source never had.\n *\n * Routes are followed breadth-first and depth-bounded. A route to a preset this\n * composition never declares stays untouched rather than dangling. A route the\n * DEPTH CAP stops is cut instead of kept: the preset behind it would otherwise\n * start an agent on the host under an ordinary preset, which is exactly the\n * silent downgrade the derived presets exist to prevent. Route depth also bounds\n * recursion, so a cyclic route graph terminates here.\n *\n * Two tracks are planned side by side: `sources` derives the\n * `… (devContainer)` set, `sbxSources` the `… (sbx)` set. A track only ever\n * routes into itself — a sandbox subagent under a Dev Container root would run\n * commands in a different runtime than the agent that delegated to it — so the\n * same source can appear on both lists and derives two independent trees.\n *\n * Referenced variants are emitted BEFORE the preset that routes to them.\n *\n * @param input - declarations, both source lists, and the labelling offsets.\n * @returns the variants to register, in dependency order, Dev Container track first.\n */\nexport function planVariants(input: VariantPlan): PlannedVariant[] {\n const maxDepth = input.maxDepth ?? DEFAULT_VARIANT_DEPTH\n // The map IS the ordering: an entry is inserted after its dependencies were\n // visited, so iteration yields them first. (A plain \"already planned\" guard is\n // not enough: two routes that reach the same preset — a diamond, or a cycle\n // through its own subagent routes — each finish inside their own frame.) The\n // key carries the track, because one source id can be planned on both.\n const planned = new Map<string, PlannedVariant>()\n const keyOf = (kind: VariantKind, sourceId: string): string => `${kind}\\u0000${sourceId}`\n const visit = (kind: VariantKind, sourceId: string, depth: number): void => {\n const key = keyOf(kind, sourceId)\n if (planned.has(key)) return\n const source = input.declarations.get(sourceId)\n if (source === undefined) return\n const id = variantId(sourceId, kind)\n const flipped = rewriteShellTools(cloneRows(source.plugins))\n const routes = new Map<string, string>()\n const blocked = new Set<string>()\n for (const referenced of referencedPresets(flipped)) {\n // A route back to its own preset is the derived preset itself, which is\n // bound to this runtime by construction; recursing into it would not terminate.\n if (referenced === sourceId) routes.set(referenced, id)\n else if (depth < maxDepth) {\n visit(kind, referenced, depth + 1)\n const derived = planned.get(keyOf(kind, referenced))\n if (derived !== undefined) routes.set(referenced, derived.id)\n } else if (planned.has(keyOf(kind, referenced))) routes.set(referenced, variantId(referenced, kind))\n // A declared preset that has no variant to reach is what the depth cap\n // leaves behind; an UNdeclared id keeps its route, because this plan\n // cannot register a variant for a preset it cannot read either.\n if (!routes.has(referenced) && input.declarations.has(referenced)) blocked.add(referenced)\n }\n const description = variantDescription(source, kind)\n planned.set(key, {\n id,\n source: sourceId,\n kind,\n name: `${source.name ?? source.id}${variantNameSuffixOf(kind)}`,\n description: blocked.size === 0 ? description : `${description} ${depthBlockNote(maxDepth)}`,\n order: (source.order ?? 0) + input.orderOffset,\n plugins: rewriteAgentPresetRefs(flipped, referenced => routes.get(referenced), referenced => blocked.has(referenced)),\n })\n }\n for (const kind of VARIANT_KINDS) {\n const sources = kind === 'sbx' ? input.sbxSources ?? [] : input.sources\n for (const sourceId of sources) visit(kind, sourceId, 0)\n }\n return [...planned.values()]\n}\n","/**\n * `ctx.ptcRuntime` for repositories that declare a Dev Container, narrowed to the\n * one field a program's host process cannot take from the container: its working\n * directory.\n *\n * `ctx.subprocess` already starts every host process in the host repository root\n * (`src/subprocess.ts`), but the PTC seam is asked for a directory of its own:\n * `resolve` fills a missing `cwd` from the sandbox policy's workspace root — the\n * container's `/workspaces/<repo>` — and `run` hands that directory to the worker,\n * whose entry program `process.chdir`s into it before the first line of the\n * program runs. The worker is a host Node process, so the chdir failed with\n * `ENOENT` before any binding call reached `ctx.fs`.\n *\n * So both entry points are decorated, one decision deep: a directory that names\n * the container view of a discovered repository becomes that repository's host\n * directory through `toHostPath` — POSIX remainder arithmetic plus the host\n * root's own separator style, so a Windows, Linux, or macOS host runs one code\n * path and no drive letter is ever constructed. Everything else — an ordinary\n * session, a host path, a relative path, a container path no declaration owns —\n * reaches the provider exactly as the caller wrote it.\n *\n * Only the working directory moves. The program's file access is `ctx.fs`, which\n * is the Docker RPC pipe, and the sandbox policy is the caller's: the host\n * directory is where a host process may start, never a place the session may read.\n * @module @banzhe/dsh-devcontainer/ptc\n */\n\nimport type { PtcRunRequest, PtcRunResult, PtcRunSpec } from '@deepseek-ai/dsh-ptc-runtime'\nimport { toHostPath } from './paths.ts'\nimport type { RepoContainerSpec } from './types.ts'\n\n/** The two methods of the PTC seam this module decorates. */\nexport interface PtcSeam {\n /**\n * Resolve supported options and provider defaults before execution.\n * @param request - program, bindings, cancellation and optional execution choices.\n * @returns the complete execution inputs, including the directory `run` receives.\n */\n resolve(request: PtcRunRequest): PtcRunSpec\n\n /**\n * Execute one resolved program.\n * @param spec - the directory, deadline, program, bindings and policy of one run.\n * @returns the captured output and the execution outcome.\n */\n run(spec: PtcRunSpec): Promise<PtcRunResult>\n}\n\n/** The repository that owns one directory, when a declaration does. */\nexport type RepositoryOfPath = (cwd: string) => RepoContainerSpec | undefined\n\n/**\n * The directory the host process may actually start in.\n * @param cwd - the directory the caller, or the provider's own default, named.\n * @param repository - the container repository that owns it, when one does.\n * @returns the host path of the same directory, or `cwd` unchanged.\n */\nexport function mapPtcCwd(cwd: string, repository: RepoContainerSpec | undefined): string {\n return repository === undefined ? cwd : toHostPath(cwd, repository)\n}\n\n/**\n * Make every program run in a directory that exists on this host.\n *\n * The seam is decorated in place rather than replaced: Cordis holds one\n * implementation per service name, so a second `ptcRuntime` row would be refused\n * at activation, while every run that needs no rewrite — an ordinary session's\n * program, a program in a host repository — must keep the provider's own process\n * mechanics. Both inherited methods are called with their own receiver, and a\n * request or spec object is passed through untouched when nothing is mapped.\n *\n * `resolve` is decorated as well as `run`, not instead of it: a caller that keeps\n * the resolved spec (a consumer that reports the directory, or a persistent\n * runtime that compares policies) must not be handed a container path that the\n * provider then chdirs into. A request that names no directory is resolved by the\n * provider first and mapped afterwards, because the provider fills it from the\n * sandbox policy's workspace root, which is the container spelling this module\n * exists to replace.\n * @param seam - the mounted PTC runtime.\n * @param repositoryOf - the repository that owns one directory, when one does.\n * @returns the disposer that puts the inherited methods back.\n */\nexport function installPtcCwdMapping(seam: PtcSeam, repositoryOf: RepositoryOfPath): () => void {\n const inheritedResolve = seam.resolve.bind(seam)\n const inheritedRun = seam.run.bind(seam)\n\n const mappedResolve = (request: PtcRunRequest): PtcRunSpec => {\n const requested = request.cwd\n if (requested !== undefined) {\n const cwd = mapPtcCwd(requested, repositoryOf(requested))\n return inheritedResolve(cwd === requested ? request : { ...request, cwd })\n }\n const resolved = inheritedResolve(request)\n const cwd = mapPtcCwd(resolved.cwd, repositoryOf(resolved.cwd))\n return cwd === resolved.cwd ? resolved : { ...resolved, cwd }\n }\n\n const mappedRun = (spec: PtcRunSpec): Promise<PtcRunResult> => {\n const cwd = mapPtcCwd(spec.cwd, repositoryOf(spec.cwd))\n return inheritedRun(cwd === spec.cwd ? spec : { ...spec, cwd })\n }\n\n Object.defineProperty(seam, 'resolve', { configurable: true, writable: true, value: mappedResolve })\n Object.defineProperty(seam, 'run', { configurable: true, writable: true, value: mappedRun })\n return () => {\n // Cordis hands a service out through a traceable proxy that wraps every\n // method read in a fresh function, so the own descriptor — not a read of the\n // method — says whether this decoration is still the installed one.\n for (const [method, installed] of [['resolve', mappedResolve], ['run', mappedRun]] as const) {\n if (Object.getOwnPropertyDescriptor(seam, method)?.value !== installed) continue\n Reflect.deleteProperty(seam, method)\n }\n }\n}\n","/**\n * `ctx.subprocess` for repositories that declare a Dev Container, narrowed to the\n * one field a host process cannot take from the container: its working directory.\n *\n * A container-bound session speaks container paths end to end — `ctx.shell`\n * reports `/workspaces/<repo>/…` and `ctx.fs` resolves the same spelling inside\n * the container — so the directory a child process is asked to start in can name\n * something that exists only on the container side. Nothing on the host can enter\n * it: the spawn fails with `ENOENT` before a single line of the child runs, which\n * is how the `run_code` PTC worker died before its first `tools.read` binding.\n *\n * So the seam is decorated, one decision deep: a working directory that belongs to\n * a discovered repository is translated back onto that repository's host root\n * using POSIX path arithmetic and the host root's own separator style, so the same\n * code is correct on a Windows, Linux, or macOS host. Everything else — an\n * ordinary session, a host path, a container path no declaration owns — reaches\n * the provider exactly as the caller wrote it.\n *\n * Only the working directory moves. What the child then does with files still\n * travels the container path: the PTC bindings call `tools.read`/`tools.write`,\n * which are `ctx.fs`, which is the Docker RPC pipe. The host directory is where a\n * host process may start, not a place the session may read.\n * @module @banzhe/dsh-devcontainer/subprocess\n */\n\nimport type { Context } from '@deepseek-ai/cordis'\nimport type { SubprocessHandle, SubprocessSpawnSpec } from '@deepseek-ai/dsh-subprocess'\nimport { toHostPath } from './paths.ts'\nimport { callingVariantKind } from './refusal.ts'\nimport { liveSbxOptions, repoRegistry } from './registry.ts'\nimport { asSbxSpec, sbxSpecFor, sbxWorkspaceRootFor } from './sbx.ts'\nimport type { ContainerOptions, RepoContainerSpec } from './types.ts'\n\n/** The one method of the subprocess seam this module decorates. */\nexport interface SpawnSeam {\n /**\n * Start one managed child process.\n * @param spec - the caller's fully specified spawn request.\n * @returns the live process handle.\n */\n spawn(spec: SubprocessSpawnSpec): SubprocessHandle\n}\n\n/** The `ctx.agents` slice this module reads: the Agent that initiated the call. */\ninterface InitiatorLookup {\n /**\n * Read the Agent that initiated the inherited asynchronous driver chain.\n * @returns the inherited Agent, or undefined outside an initiator boundary.\n */\n currentInitiator(): { readonly session: { readonly header?: { readonly cwd?: string } } } | undefined\n}\n\n/** The `ctx.workingDirectory` slice this module reads. */\ninterface DirectoryLookup {\n /**\n * Read the Session's current directory.\n * @param session - the Session whose directory is requested.\n * @returns the committed directory.\n */\n get(session: never): string\n}\n\n/** Read one service without a typed `Context` augmentation, as the other rows do. */\nfunction serviceOf(ctx: Context, service: string): unknown {\n return (ctx as unknown as { get(name: string): unknown }).get(service)\n}\n\n/**\n * The working directory a host process may actually start in.\n * @param cwd - the directory the caller asked for.\n * @param repository - the container repository that owns it, when one does.\n * @returns the host path of the same directory, or `cwd` unchanged.\n */\nexport function mapSpawnCwd(cwd: string, repository: RepoContainerSpec | undefined): string {\n return repository === undefined ? cwd : toHostPath(cwd, repository)\n}\n\n/**\n * The host directories that can name the repository behind a container path.\n *\n * Discovery walks host ancestors, and a container path has none, so the walk needs\n * a real directory to start from. The initiating Agent's own two are the ones this\n * session started with: its working-directory projection is where the model\n * believes it is, and its Session header keeps the project directory the Session\n * was created in — a host path, because the Session is created on the host. An\n * anchor that names nothing real simply discovers nothing; ownership still decides\n * whether a repository may claim the path.\n * @param ctx - the calling row's context.\n * @returns candidate host directories, best first, without duplicates.\n */\nfunction hostAnchors(ctx: Context): readonly string[] {\n let initiator: { readonly session: { readonly header?: { readonly cwd?: string } } } | undefined\n try {\n initiator = (serviceOf(ctx, 'agents') as InitiatorLookup | undefined)?.currentInitiator()\n } catch {\n // A closing initiator scope cannot answer; the discovery cache is still consulted.\n initiator = undefined\n }\n if (initiator === undefined) return []\n const anchors: string[] = []\n const directories = serviceOf(ctx, 'workingDirectory') as DirectoryLookup | undefined\n if (directories !== undefined) {\n try {\n anchors.push(directories.get(initiator.session as never))\n } catch {\n // A Session with no directory projection answers nothing; the header still can.\n }\n }\n const project = initiator.session.header?.cwd\n if (project !== undefined) anchors.push(project)\n return [...new Set(anchors)]\n}\n\n/**\n * The repository whose runtime owns one directory.\n *\n * A `(sbx)` session mounts the host directory at its own absolute path, so the\n * specification handed back is the sandbox view of the same repository: the\n * declared `workspaceFolder` (`/workspaces/<repo>`) is replaced by the host\n * root, which keeps the translation this module performs a normalization instead\n * of a wrong mount. A sandbox directory with no declaration at all is described\n * from the directory itself, because a sandbox needs no declaration.\n * @param ctx - the calling row's context.\n * @param path - a container path, a host path, or a relative path.\n * @param options - the row's container defaults, applied to a fresh discovery.\n * @returns the owning repository specification, or undefined when nothing declares a container for it.\n */\nexport function repositoryOfPath(\n ctx: Context, path: string, options: ContainerOptions,\n): RepoContainerSpec | undefined {\n const kind = callingVariantKind(ctx)\n const adopt = (spec: RepoContainerSpec): RepoContainerSpec => (kind === 'sbx' ? asSbxSpec(spec) : spec)\n const registry = repoRegistry(ctx)\n for (const anchor of hostAnchors(ctx)) {\n const found = registry.locate(path, { ...options, cwd: anchor })\n if (found !== undefined) return adopt(found)\n }\n const found = registry.locate(path, options)\n if (found !== undefined) return adopt(found)\n if (kind !== 'sbx') return undefined\n const root = sbxWorkspaceRootFor(path, undefined, undefined)\n return root === undefined\n ? undefined\n : sbxSpecFor(root, liveSbxOptions(ctx, options), undefined)\n}\n\n/**\n * Start every host process in a directory that exists on this host.\n *\n * The seam is decorated in place rather than replaced: Cordis holds one\n * implementation per service name, so a second `subprocess` row would be refused\n * at activation, while every spawn that needs no rewrite — an ordinary session's\n * shell, a language server in a host repository — must keep the provider's own\n * process mechanics. The inherited method is called with its own receiver, and\n * the original spec object is passed through untouched when nothing is mapped.\n * @param seam - the mounted subprocess service.\n * @param repositoryOf - the repository that owns one directory, when one does.\n * @returns the disposer that puts the inherited method back.\n */\nexport function installSpawnCwdMapping(\n seam: SpawnSeam,\n repositoryOf: (cwd: string) => RepoContainerSpec | undefined,\n): () => void {\n const inherited = seam.spawn.bind(seam)\n const mapped = (spec: SubprocessSpawnSpec): SubprocessHandle => {\n const cwd = mapSpawnCwd(spec.cwd, repositoryOf(spec.cwd))\n return inherited(cwd === spec.cwd ? spec : { ...spec, cwd })\n }\n Object.defineProperty(seam, 'spawn', { configurable: true, writable: true, value: mapped })\n return () => {\n // Cordis hands a service out through a traceable proxy that wraps every\n // method read in a fresh function, so the own descriptor — not a read of the\n // method — says whether this decoration is still the installed one.\n if (Object.getOwnPropertyDescriptor(seam, 'spawn')?.value !== mapped) return\n Reflect.deleteProperty(seam, 'spawn')\n }\n}\n","/**\n * The live registration set of derived presets.\n *\n * The settings page can add or remove a source at any moment, so a derived\n * preset is not a startup artefact: this class owns the difference between what\n * is registered right now and what the stored source list asks for, and applies\n * it one operation at a time. `register`/dispose are awaited in queue order, so a\n * person toggling two rows quickly cannot leave a half-applied set behind.\n *\n * @module @banzhe/dsh-devcontainer/variants\n */\n\nimport type { PresetDefinition } from '@deepseek-ai/dsh-agent-preset-registry'\nimport { planVariants } from './presets.ts'\nimport type { PresetDeclaration, PlannedVariant } from './presets.ts'\n\n/** The registry slice this class calls. */\nexport interface VariantRegistryLike {\n /** Register one derived preset; resolves to its disposer. */\n register(definition: PresetDefinition): Promise<() => Promise<void>>\n}\n\n/** The logging slice this class calls. */\nexport interface VariantLogLike {\n warn(message: string): void\n}\n\n/** How the derived set is built. */\nexport interface VariantSyncOptions {\n /** The Host preset registry. */\n readonly registry: VariantRegistryLike\n /** Reports a variant that could not be registered. */\n readonly logger: VariantLogLike\n /** Reads the raw declarations of the current composition. */\n readonly declarations: () => ReadonlyMap<string, PresetDeclaration>\n /** Added to each source order. */\n readonly orderOffset: number\n /** Route-following depth cap. */\n readonly maxDepth?: number\n}\n\n/**\n * Keeps the registered variant set equal to the two stored source lists.\n *\n * Every call is idempotent: `sync` registers what is missing, disposes what is\n * no longer asked for, and touches nothing that is already correct. A variant\n * that fails to register is dropped from the bookkeeping and logged, so the rest\n * of the set still applies.\n */\nexport class VariantSync {\n /** Registered variant ids, in registration order, with their disposers. */\n private readonly registered = new Map<string, () => Promise<void>>()\n\n /** Serializes overlapping syncs so a later list cannot observe a half-applied one. */\n private queue: Promise<void> = Promise.resolve()\n\n /** Set once the row unloads: a queued sync then registers nothing. */\n private stopped = false\n\n constructor(private readonly options: VariantSyncOptions) {}\n\n /** The ids registered right now, in dependency order. */\n ids(): string[] {\n return [...this.registered.keys()]\n }\n\n /**\n * Apply both source lists.\n * @param sources - the preset ids to derive `… (devContainer)` variants from.\n * @param sbxSources - the preset ids to derive `… (sbx)` variants from.\n * @returns the settled application, in queue order.\n */\n sync(sources: readonly string[], sbxSources: readonly string[] = []): Promise<void> {\n return this.enqueue(async () => {\n if (this.stopped) return\n const planned = planVariants({\n declarations: this.options.declarations(),\n sources,\n sbxSources,\n orderOffset: this.options.orderOffset,\n ...this.options.maxDepth === undefined ? {} : { maxDepth: this.options.maxDepth },\n })\n await this.withdraw(planned)\n await this.add(planned)\n })\n }\n\n /**\n * Dispose every registered variant.\n * @returns the settled teardown, in queue order.\n */\n clear(): Promise<void> {\n return this.enqueue(async () => {\n await this.withdraw([])\n })\n }\n\n /**\n * Stop for good: queued work is skipped and nothing new registers.\n * @returns the settled teardown, in queue order.\n */\n stop(): Promise<void> {\n this.stopped = true\n return this.clear()\n }\n\n private enqueue(work: () => Promise<void>): Promise<void> {\n const next = this.queue.then(work, work)\n // A rejected step must not poison the queue: the next toggle still applies.\n this.queue = next.catch(() => {})\n return next\n }\n\n /** Dispose the registered variants the plan no longer contains, dependants first. */\n private async withdraw(planned: readonly PlannedVariant[]): Promise<void> {\n const keep = new Set(planned.map(variant => variant.id))\n const order = [...this.registered.keys()].reverse()\n for (const id of order) {\n if (keep.has(id)) continue\n const dispose = this.registered.get(id)\n this.registered.delete(id)\n if (dispose === undefined) continue\n try {\n await dispose()\n } catch (error) {\n this.options.logger.warn(`devcontainer: preset variant ${id} did not unregister cleanly: ${String(error)}`)\n }\n }\n }\n\n /** Register the planned variants that are not registered yet, dependencies first. */\n private async add(planned: readonly PlannedVariant[]): Promise<void> {\n for (const variant of planned) {\n if (this.registered.has(variant.id)) continue\n if (this.stopped) return\n try {\n const dispose = await this.options.registry.register({\n id: variant.id,\n name: variant.name,\n description: variant.description,\n order: variant.order,\n plugins: variant.plugins as unknown as PresetDefinition['plugins'],\n })\n this.registered.set(variant.id, dispose)\n } catch (error) {\n // One unavailable variant leaves its route on the original target.\n this.options.logger.warn(`devcontainer: preset variant ${variant.id} unavailable: ${String(error)}`)\n }\n }\n }\n}\n","/**\n * The Host half of the Dev Container / Docker Sandbox Bundle: the Linux runtime\n * context and the two derived preset tracks (`… (devContainer)`, `… (sbx)`).\n *\n * Neither half provides a service, so this row has no `inject` requirement: it\n * waits for `systemPrompt` to listen, and reads `loader`/`agentPresets` only when\n * a composition supplies them.\n *\n * The variant set is a SETTING, not a constant: `sources` (the Dev Container\n * track, written by the settings page) and `sbxSources` (the Docker Sandbox\n * track) are volatile fields, so a write lands in this live reference and in the\n * profile patch, and each write re-derives the whole set immediately — the newly\n * checked source registers, the unchecked one disposes. Nothing is derived until\n * someone asks for it.\n *\n * @module @banzhe/dsh-devcontainer\n */\n\nimport type { Context, Volatile } from '@deepseek-ai/cordis'\nimport z from '@deepseek-ai/schemastery'\nimport type { Agent } from '@deepseek-ai/dsh-agent'\nimport type { PromptPresentation } from '@deepseek-ai/dsh-system-prompt'\n// Type-only: the `settings/document-updated` event this row follows.\nimport type {} from '@deepseek-ai/dsh-settings'\nimport type {} from '@deepseek-ai/dsh-working-directory'\nimport {\n containerOptionFields, containerOptions, hostMountFields, presetSourceFields, sandboxTemplateFields,\n} from './options.ts'\nimport { toContainerPath } from './paths.ts'\nimport {\n applyContainerContext, containerContextText, hostDirectoryFromContext, missingContainerContextText, sbxContextText,\n} from './prompt.ts'\nimport { asDeclaration, PRESET_MODULE } from './presets.ts'\nimport type { PresetDeclaration } from './presets.ts'\nimport { installPtcCwdMapping } from './ptc.ts'\nimport {\n containerPresetOf,\n DEVCONTAINER_ENV_KEY,\n DEVCONTAINER_ENV_VALUE,\n DEVCONTAINER_PRESET_ENV_KEY,\n presetKindOf,\n SBX_ENV_KEY,\n SBX_ENV_VALUE,\n SBX_PRESET_ENV_KEY,\n} from './refusal.ts'\nimport type { PresetLookup } from './refusal.ts'\nimport { liveSbxOptions, registerHostMounts, registerSandboxTemplate, repoRegistry } from './registry.ts'\nimport { installSpawnCwdMapping, repositoryOfPath } from './subprocess.ts'\nimport { sandboxNameFor, sbxSpecFor, sbxWorkspaceRootFor } from './sbx.ts'\nimport { VariantSync } from './variants.ts'\nimport type { VariantRegistryLike } from './variants.ts'\nimport { hostMountsConfig } from './host-mounts.ts'\nimport type { ContainerOptions, HostMountsConfig } from './types.ts'\n\n/** Plugin name used by the Loader row, and the settings namespace the page edits. */\nexport const name = 'devcontainer'\n\n/** How deep a derived preset may follow its subagent routes. */\nconst MAX_VARIANT_DEPTH = 4\n\n/** The host-level event a settings write emits once the entry's config changed. */\nconst SETTINGS_UPDATED = 'settings/document-updated'\n\n/** The Loader event a volatile-only config change commits through. */\nconst VOLATILE_UPDATED = 'loader/volatile-update'\n\n/**\n * The settings namespace the shipped preset surfaces watch for roster changes.\n *\n * They re-read `agentPresets.list` when `settings/document-updated` names the\n * preset REGISTRY entry (`packages/client/ui-agent-preset/src/client/index.ts:164-167`),\n * which is the only roster-refresh signal a third-party registration can reach.\n */\nconst PRESET_REGISTRY_NS = 'agent-preset-registry'\n\n/** Labelling and gating the schema also supplies, kept here for the runtime read. */\nconst VARIANT_DEFAULTS: PresetVariantConfig = {\n enabled: true,\n win32Only: true,\n orderOffset: 1,\n}\n\n/** How the derived variants are built and labelled. */\nexport interface PresetVariantConfig {\n /** Register variants at all (default true); a false row is a pure container shell. */\n enabled: boolean\n /**\n * Only derive on win32 (default true): the platform where presets ship\n * `pwsh` instead of `bash`. Elsewhere the variants would be duplicates.\n */\n win32Only: boolean\n /**\n * Added to the source preset's `order` so the variant sorts right after it.\n *\n * The display suffix is not configurable: it is what the shell row reads back\n * to know which marker a preset needs, so it is owned by `src/ids.ts`.\n */\n orderOffset: number\n}\n\n/** Plugin config. */\nexport interface Config extends ContainerOptions {\n /** Source preset ids the page asked to derive a `… (devContainer)` variant from; empty derives nothing. */\n sources: Volatile<readonly string[]>\n /** Source preset ids the profile asked to derive a `… (sbx)` variant from; empty derives nothing. */\n sbxSources: Volatile<readonly string[]>\n /**\n * Image a created Docker Sandbox runs (`sbx create --template`); blank keeps\n * Docker's `shell` template. Written by the settings page, read by the shell,\n * filesystem, and subprocess rows through `liveSandboxTemplate`.\n */\n sbxTemplate: Volatile<string>\n /**\n * Extra read-only host paths a created Docker Sandbox mounts beside the\n * workspace (`auto`, `off`, or an explicit `PATH[:TARGET][:ro]` list). Read by\n * the shell, filesystem, and subprocess rows through `liveHostMounts`.\n */\n hostMounts: Volatile<HostMountsConfig>\n presets: PresetVariantConfig\n}\n\n/**\n * The live schema the settings page edits and the Loader validates.\n *\n * Deliberately not annotated `z<Config>`: the interface describes the runtime\n * config (`sources` is a `Volatile` reference), while the schema's own output is\n * the plain field type.\n */\nexport const Config = z.object({\n ...containerOptionFields(),\n ...presetSourceFields(),\n ...sandboxTemplateFields(),\n ...hostMountFields(),\n presets: z.object({\n enabled: z.boolean().default(true),\n win32Only: z.boolean().default(true),\n orderOffset: z.number().default(1),\n }),\n})\n\n/** The subset of the Cordis Loader this row reads, kept structural so the Bundle needs no Loader dependency. */\ninterface LoaderEntryLike {\n readonly options: { readonly name: string; readonly config?: unknown }\n}\n\ninterface LoaderLike {\n await(): Promise<void>\n entries(): Iterable<LoaderEntryLike>\n}\n\n/** The subset of the preset registry this row calls. */\ntype PresetRegistryLike = VariantRegistryLike\n\n/** Read one service without a typed `Context` augmentation. */\nfunction serviceOf(ctx: Context, service: string): unknown {\n return (ctx as unknown as { get(name: string): unknown }).get(service)\n}\n\n/** The host directory one assembly is about. */\nfunction hostDirectoryOf(ctx: Context, assembly: PromptPresentation, agent: Agent | undefined): string | undefined {\n if (agent === undefined) return hostDirectoryFromContext(assembly)\n const workingDirectory = serviceOf(ctx, 'workingDirectory') as { get(session: Agent['session']): string } | undefined\n return workingDirectory === undefined\n ? hostDirectoryFromContext(assembly)\n : workingDirectory.get(agent.session)\n}\n\n/**\n * Load the row: rewrite the working-directory context, and keep the derived\n * preset set equal to the two stored source lists.\n *\n * Deliberately the module's only plugin export besides its schema and name: the\n * Loader's `unwrapExports` prefers a `default` export, and a `default`-exported\n * `apply` would be the whole plugin — losing this module's `Config`, so the row\n * would activate with the raw (absent) config instead of the resolved one.\n * @param ctx - the Host plugin context.\n * @param configured - this row's resolved config; absent when the row declares none.\n */\nexport function apply(ctx: Context, configured?: Config): void {\n const config: Config = configured ?? ({} as Config)\n ctx.inject(['systemPrompt'], (child: Context) => {\n child.on('system-prompt/assemble', async (_assembly, context, next) => {\n // Prepend runs this listener first, so `next()` returns after the\n // working-directory service wrote its final text.\n const result = await next()\n const agent = context.agent\n // Only a session that actually runs in the container is told it does. An\n // ordinary preset keeps its own working-directory context and its own\n // shell, even when the repository declares a container.\n const preset = containerPresetOf(serviceOf(child, 'agentPresets') as PresetLookup | undefined, agent?.session)\n if (preset === undefined && !config.requireContainer) return result\n const hostWorkdir = hostDirectoryOf(child, result, agent)\n if (hostWorkdir === undefined) return result\n const options = containerOptions(config)\n const repository = repoRegistry(child).locate(hostWorkdir, { ...options, cwd: hostWorkdir })\n if (presetKindOf(preset) === 'sbx') {\n // A sandbox needs no declaration, so the missing-configuration branch\n // below cannot apply: the workspace is the session's own directory.\n const root = sbxWorkspaceRootFor(hostWorkdir, hostWorkdir, repository)\n if (root === undefined) return result\n const spec = sbxSpecFor(root, liveSbxOptions(child, options), repository)\n applyContainerContext(result, sbxContextText(\n toContainerPath(hostWorkdir, spec),\n spec.sandbox ?? sandboxNameFor(root),\n hostWorkdir,\n ))\n return result\n }\n if (repository === undefined) {\n // A (devContainer) preset over a repository that declares no container:\n // say so in the prompt, because the shell tool will refuse every command.\n if (preset === undefined) return result\n applyContainerContext(result, missingContainerContextText(hostWorkdir, preset))\n return result\n }\n applyContainerContext(result, containerContextText(\n toContainerPath(hostWorkdir, repository),\n repository,\n hostWorkdir,\n ))\n return result\n }, { prepend: true })\n })\n\n // A container-bound session hands every seam container paths, but a host\n // process can only start in a directory this host has: the working directory a\n // `run_code` PTC worker receives is `/workspaces/<repo>`, which no host can\n // `chdir` into. The spawn directory is translated back onto the repository root\n // and nothing else about the seam changes.\n ctx.inject(['subprocess'], (child: Context) => {\n child.effect(() => installSpawnCwdMapping(\n child.subprocess,\n cwd => repositoryOfPath(child, cwd, containerOptions(config)),\n ), 'devcontainer.spawn-cwd')\n })\n\n // The PTC seam starts a worker of its own: `resolve` fills a directory the\n // caller left out from the sandbox policy's workspace root — the container's\n // `/workspaces/<repo>` — and `run` hands it to a program that `process.chdir`s\n // into it. Decorating `ctx.subprocess` does not reach that worker, so the\n // directory is translated here as well, at both entry points.\n ctx.inject(['ptcRuntime'], (child: Context) => {\n child.effect(() => installPtcCwdMapping(\n child.ptcRuntime,\n cwd => repositoryOfPath(child, cwd, containerOptions(config)),\n ), 'devcontainer.ptc-cwd')\n })\n\n ctx.effect(() => {\n const cache = repoRegistry(ctx)\n markContainerPresets(ctx)\n return () => { cache.reset() }\n })\n // The image belongs to this row (the settings page writes this namespace) while\n // the rows that create a sandbox are the shell, filesystem, and subprocess ones:\n // they ask this reader at the moment they build a specification, so a write is\n // answered by the next command rather than by the next reload.\n ctx.effect(\n () => registerSandboxTemplate(ctx, () => configuredSbxTemplate(ctx, config)),\n 'devcontainer.sbx-template',\n )\n // The extra host mounts are read the same way and for the same reason: the rows\n // that create a sandbox ask this reader at the moment they build a\n // specification, so the value in force at that moment is the one that lands.\n ctx.effect(\n () => registerHostMounts(ctx, () => configuredHostMounts(ctx, config)),\n 'devcontainer.host-mounts',\n )\n registerVariants(ctx, config)\n}\n\n/**\n * The sandbox image this row configures right now, trimmed, or undefined when it\n * configures none.\n *\n * The live reference is read on every call rather than copied at mount time: a\n * settings write commits into the fiber's effective config (the same path\n * `storedList` follows), and the profile patch may land after this row mounted.\n * @param ctx - this row's context.\n * @param config - the resolved config this row was mounted with.\n * @returns the image to pass as `--template`, or undefined for the CLI's own template.\n */\nfunction configuredSbxTemplate(ctx: Context, config: Config): string | undefined {\n const value: unknown = liveField(ctx, 'sbxTemplate') ?? config.sbxTemplate\n if (value === undefined || value === null) return undefined\n const text: unknown = typeof (value as { get?: unknown }).get === 'function'\n ? (value as { get(): unknown }).get()\n : value\n const image = typeof text === 'string' ? text.trim() : ''\n return image === '' ? undefined : image\n}\n\n/**\n * The extra host mounts this row configures right now.\n * @param ctx - this row's context.\n * @param config - the resolved config this row was mounted with.\n * @returns the configured value, or the schema default when this row carries none.\n */\nfunction configuredHostMounts(ctx: Context, config: Config): HostMountsConfig {\n return hostMountsConfig(liveField(ctx, 'hostMounts') ?? config.hostMounts)\n}\n\n/**\n * The value of one field as the fiber holds it right now, or undefined when it holds none.\n *\n * A volatile field is committed into the fiber's effective config rather than into\n * the object `apply` was handed, and the profile patch may land after this row\n * mounted, so the live reference is the only current answer. The cast is the price\n * of reading a Cordis internal this Bundle does not own: the shape is checked here\n * and nowhere else.\n * @param ctx - this row's context.\n * @param field - the config key to read.\n * @returns the live value, or undefined when the fiber carries none.\n */\nfunction liveField(ctx: Context, field: string): unknown {\n const fiber = (ctx as unknown as { fiber?: { effectiveConfig?: Record<string, unknown> } }).fiber\n return fiber?.effectiveConfig?.[field]\n}\n\n/** The `ctx.shellEnv` slice this row registers into. */\ninterface ShellEnvLike {\n register(contributor: {\n name: string\n variables: Record<string, { description: string }>\n resolve(execution: { agent?: { session: unknown } }): Record<string, string>\n }): () => void\n}\n\n/**\n * Mark every shell call issued from a derived preset.\n *\n * The marker rides the managed `DSH_*` environment, which the shell tools build\n * per call from the calling agent: `exec.agent` is the one fact the executor\n * cannot otherwise see, so this is what lets `DevcontainerShellExecutor` refuse a\n * command instead of guessing whose it is. Each track has its own pair of\n * variables — `DSH_DEVCONTAINER` / `DSH_DEVCONTAINER_PRESET` and `DSH_SBX` /\n * `DSH_SBX_PRESET` — so the executor, the filesystem, the subprocess, and the PTC\n * seams route a call without re-deriving which preset asked for it. Values are\n * recomputed per call, so switching presets mid-session needs no reload.\n */\nfunction markContainerPresets(ctx: Context): void {\n ctx.inject(['shellEnv'], (child: Context) => {\n const shellEnv = serviceOf(child, 'shellEnv') as ShellEnvLike | undefined\n if (shellEnv === undefined) return\n child.effect(() => shellEnv.register({\n name: 'devcontainer-preset',\n variables: {\n [DEVCONTAINER_ENV_KEY]: {\n description: 'Set for shell calls issued from a (devContainer) preset; the command must reach a container.',\n },\n [DEVCONTAINER_PRESET_ENV_KEY]: {\n description: 'The (devContainer) preset id that issued this shell call.',\n },\n [SBX_ENV_KEY]: {\n description: 'Set for shell calls issued from a (sbx) preset; the command must reach its Docker Sandbox.',\n },\n [SBX_PRESET_ENV_KEY]: {\n description: 'The (sbx) preset id that issued this shell call.',\n },\n },\n resolve: (execution) => {\n const presets = serviceOf(child, 'agentPresets') as PresetLookup | undefined\n const preset = containerPresetOf(presets, execution.agent?.session)\n if (preset === undefined) return {}\n if (presetKindOf(preset) === 'sbx') {\n return { [SBX_ENV_KEY]: SBX_ENV_VALUE, [SBX_PRESET_ENV_KEY]: preset }\n }\n return { [DEVCONTAINER_ENV_KEY]: DEVCONTAINER_ENV_VALUE, [DEVCONTAINER_PRESET_ENV_KEY]: preset }\n },\n }))\n })\n}\n\n/**\n * Wire the variant set: derive once the tree is up, then re-derive on every write\n * that lands in this row's config.\n *\n * The sync is built inside `ctx.inject`, not at mount time. Both services can\n * activate AFTER this row (this row is inserted by the Bundle patch; the preset\n * registry is configured by the Profile patch), and a lookup made at mount time —\n * memoized like any other lazy init — would keep reporting \"no registry\" for the\n * life of the process, which looks exactly like a page whose checkbox never\n * registers anything. Cordis holds this callback until both exist and re-runs it\n * if they ever go away, so the derived set follows the composition.\n */\nfunction registerVariants(ctx: Context, config: Config): void {\n const presets: PresetVariantConfig = { ...VARIANT_DEFAULTS, ...config.presets }\n if (!presets.enabled) return\n if (presets.win32Only && process.platform !== 'win32') return\n\n // A stored list is read defensively: a row mounted programmatically (no profile\n // config) reaches this point with no `sources` / `sbxSources` reference at all,\n // and \"nothing is derived\" is the only sane reading of an absent list.\n const storedList = (field: 'sources' | 'sbxSources'): readonly string[] => {\n // Read the LIVE config: the Profile patch can land after this row mounted,\n // and a volatile-only change commits into the fiber's effective config rather\n // than into the object `apply` was handed.\n const value: unknown = liveField(ctx, field) ?? config[field]\n if (value === undefined || value === null) return []\n const list: unknown = typeof (value as { get?: unknown }).get === 'function'\n ? (value as { get(): unknown }).get()\n : value\n return Array.isArray(list) ? list.filter((id): id is string => typeof id === 'string' && id.length > 0) : []\n }\n\n const root = (ctx as unknown as { root: Context }).root\n\n ctx.inject(['loader', 'agentPresets'], (child: Context) => {\n const loader = serviceOf(child, 'loader') as LoaderLike\n const registry = serviceOf(child, 'agentPresets') as PresetRegistryLike\n // Read the declarations per sync: a preset row declared after this row\n // settled is still derivable without reloading the Bundle.\n const declarations = (): ReadonlyMap<string, PresetDeclaration> => {\n const found = new Map<string, PresetDeclaration>()\n for (const entry of loader.entries()) {\n if (entry.options.name !== PRESET_MODULE) continue\n const declaration = asDeclaration(entry.options.config)\n if (declaration !== undefined) found.set(declaration.id, declaration)\n }\n return found\n }\n const sync = new VariantSync({\n registry,\n logger: ctx.logger,\n declarations,\n orderOffset: presets.orderOffset,\n maxDepth: MAX_VARIANT_DEPTH,\n })\n\n const run = (): void => {\n void (async () => {\n // The tree must be up before its declarations can be read: a source\n // preset row may be inserted by a later patch layer.\n await loader.await()\n const before = sync.ids().join('\\n')\n await sync.sync(storedList('sources'), storedList('sbxSources'))\n // A roster change is invisible to an open picker unless it hears about\n // one: those surfaces re-read the roster on `settings/document-updated`\n // for the preset registry's namespace, and a registration made here is\n // not a settings write. Announce the new roster there.\n if (sync.ids().join('\\n') !== before) {\n // The event contract brands its namespace; this row owns no such type\n // for a foreign entry id, and the payload is what makes it a refresh.\n (root.emit as (name: string, ...args: unknown[]) => void)(\n SETTINGS_UPDATED, PRESET_REGISTRY_NS, Date.now(),\n )\n }\n })().catch((error: unknown) => {\n ctx.logger.warn(`devcontainer: preset variants unavailable: ${String(error)}`)\n })\n }\n\n // Reverse order: stop the queue before the scope it registers into goes away.\n child.effect(() => () => { void sync.stop() }, 'devcontainer.preset-variants')\n // A settings write commits the stored list into the live reference and then\n // emits this event, so the derived set follows the page without a remount.\n //\n // The event carries the Loader entry id of the row that owns the namespace,\n // not necessarily the namespace itself, so this listener cannot filter by\n // name: an entry loaded under a custom id would never sync. Syncing an\n // unchanged list is a no-op, so listening to every settings write is both\n // safe and cheap.\n child.on(SETTINGS_UPDATED, run)\n // The same write also commits a volatile field in place; that commit is what\n // carries the value this row reads, and it is emitted on this row's fiber.\n child.on(VOLATILE_UPDATED, run)\n run()\n })\n}\n"],"mappings":";;;;;AAiBA,MAAa,4BAA4B;;;;;;;AAQzC,SAAgB,eAAe,MAAiC;CAC9D,IAAI,KAAK,cAAc,KAAA,GAAW,OAAO,KAAK;CAC9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AkB,oBAAoB,KAAK,IAAI,CACjD;GAEJ,EAAA,CAAG,CAAC,CAAC,OAAO,UAAmB;IAC7B,IAAI,OAAO,KAAK,8CAA8C,OAAO,KAAK,GAAG;GAC/E,CAAC;EACH;EAGA,MAAM,mBAAmB;GAAE,KAAU,KAAK;EAAE,GAAG,8BAA8B;EAS7E,MAAM,GAAG,kBAAkB,GAAG;EAG9B,MAAM,GAAG,kBAAkB,GAAG;EAC9B,IAAI;CACN,CAAC;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@banzhe/dsh-devcontainer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Run every agent command inside the repository's Linux Dev Container or a Docker Sandbox: a Docker/sbx-backed ctx.shell, a ctx.fs that delegates every file operation to a runtime-resident Node helper, a Linux prompt context, and devContainer / sbx agent-preset variants",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,8 +37,10 @@
|
|
|
37
37
|
"client": {
|
|
38
38
|
"platform": "web",
|
|
39
39
|
"inject": [
|
|
40
|
+
"@deepseek-ai/dsh-api-gateway",
|
|
40
41
|
"@deepseek-ai/dsh-api-remotes",
|
|
41
42
|
"@deepseek-ai/dsh-client-locale",
|
|
43
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
42
44
|
"@deepseek-ai/dsh-client-ui-settings"
|
|
43
45
|
]
|
|
44
46
|
},
|
|
@@ -50,6 +52,7 @@
|
|
|
50
52
|
"@deepseek-ai/cordis": "^4.0.5-alpha.1",
|
|
51
53
|
"@deepseek-ai/dsh-agent": "^0.2.1-alpha.2",
|
|
52
54
|
"@deepseek-ai/dsh-agent-preset-registry": "^0.2.1-alpha.2",
|
|
55
|
+
"@deepseek-ai/dsh-api-gateway": "^0.2.2-rc.2",
|
|
53
56
|
"@deepseek-ai/dsh-api-remotes": "^0.2.1-alpha.2",
|
|
54
57
|
"@deepseek-ai/dsh-bash-local": "^0.2.1-alpha.2",
|
|
55
58
|
"@deepseek-ai/dsh-bash-sandbox": "^0.2.1-alpha.2",
|
|
@@ -69,38 +72,39 @@
|
|
|
69
72
|
"@deepseek-ai/dsh-settings": "^0.2.1-alpha.2",
|
|
70
73
|
"@deepseek-ai/dsh-shell": "^0.2.1-alpha.2",
|
|
71
74
|
"@deepseek-ai/dsh-subprocess": "^0.2.1-alpha.2",
|
|
72
|
-
"@deepseek-ai/dsh-system-prompt": "^0.2.
|
|
75
|
+
"@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.2",
|
|
73
76
|
"@deepseek-ai/dsh-working-directory": "^0.2.1-alpha.2",
|
|
74
77
|
"@deepseek-ai/schemastery": "^3.18.5-alpha.1"
|
|
75
78
|
},
|
|
76
79
|
"devDependencies": {
|
|
77
|
-
"@deepseek-ai/cordis": "4.0
|
|
78
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
79
|
-
"@deepseek-ai/dsh-agent-preset-registry": "0.2.
|
|
80
|
-
"@deepseek-ai/dsh-api-
|
|
81
|
-
"@deepseek-ai/dsh-
|
|
82
|
-
"@deepseek-ai/dsh-bash-
|
|
83
|
-
"@deepseek-ai/dsh-
|
|
84
|
-
"@deepseek-ai/dsh-client-
|
|
85
|
-
"@deepseek-ai/dsh-client-
|
|
86
|
-
"@deepseek-ai/dsh-client-ui-
|
|
87
|
-
"@deepseek-ai/dsh-client-ui-
|
|
88
|
-
"@deepseek-ai/dsh-client-ui-
|
|
89
|
-
"@deepseek-ai/dsh-
|
|
90
|
-
"@deepseek-ai/dsh-fs
|
|
91
|
-
"@deepseek-ai/dsh-fs-
|
|
92
|
-
"@deepseek-ai/dsh-
|
|
93
|
-
"@deepseek-ai/dsh-
|
|
94
|
-
"@deepseek-ai/dsh-
|
|
95
|
-
"@deepseek-ai/dsh-
|
|
96
|
-
"@deepseek-ai/dsh-sandbox
|
|
97
|
-
"@deepseek-ai/dsh-
|
|
98
|
-
"@deepseek-ai/dsh-
|
|
99
|
-
"@deepseek-ai/dsh-
|
|
100
|
-
"@deepseek-ai/dsh-
|
|
101
|
-
"@deepseek-ai/dsh-
|
|
102
|
-
"@deepseek-ai/dsh-
|
|
103
|
-
"@deepseek-ai/
|
|
80
|
+
"@deepseek-ai/cordis": "4.1.0",
|
|
81
|
+
"@deepseek-ai/dsh-agent": "0.2.2-rc.2",
|
|
82
|
+
"@deepseek-ai/dsh-agent-preset-registry": "0.2.2-rc.2",
|
|
83
|
+
"@deepseek-ai/dsh-api-gateway": "0.2.2-rc.2",
|
|
84
|
+
"@deepseek-ai/dsh-api-remotes": "0.2.2-rc.2",
|
|
85
|
+
"@deepseek-ai/dsh-bash-local": "0.2.2-rc.2",
|
|
86
|
+
"@deepseek-ai/dsh-bash-sandbox": "0.2.2-rc.2",
|
|
87
|
+
"@deepseek-ai/dsh-client-locale": "0.2.2-rc.2",
|
|
88
|
+
"@deepseek-ai/dsh-client-store": "0.2.2-rc.2",
|
|
89
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.2.2-rc.2",
|
|
90
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.2-rc.2",
|
|
91
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.2.2-rc.2",
|
|
92
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.2-rc.2",
|
|
93
|
+
"@deepseek-ai/dsh-fs": "0.2.2-rc.2",
|
|
94
|
+
"@deepseek-ai/dsh-fs-local": "0.2.2-rc.2",
|
|
95
|
+
"@deepseek-ai/dsh-fs-sandbox": "0.2.2-rc.2",
|
|
96
|
+
"@deepseek-ai/dsh-home-paths": "0.2.2-rc.2",
|
|
97
|
+
"@deepseek-ai/dsh-ptc-runtime": "0.2.2-rc.2",
|
|
98
|
+
"@deepseek-ai/dsh-pwsh-local": "0.2.2-rc.2",
|
|
99
|
+
"@deepseek-ai/dsh-sandbox": "0.2.2-rc.2",
|
|
100
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.2-rc.2",
|
|
101
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-rc.2",
|
|
102
|
+
"@deepseek-ai/dsh-settings": "0.2.2-rc.2",
|
|
103
|
+
"@deepseek-ai/dsh-shell": "0.2.2-rc.2",
|
|
104
|
+
"@deepseek-ai/dsh-subprocess": "0.2.2-rc.2",
|
|
105
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.2-rc.2",
|
|
106
|
+
"@deepseek-ai/dsh-working-directory": "0.2.2-rc.2",
|
|
107
|
+
"@deepseek-ai/schemastery": "3.19.0",
|
|
104
108
|
"@types/node": "^22.20.0",
|
|
105
109
|
"@types/react": "~18.3.31",
|
|
106
110
|
"@types/react-dom": "~18.3.7",
|
|
@@ -116,6 +120,7 @@
|
|
|
116
120
|
"scripts": {
|
|
117
121
|
"build": "tsdown",
|
|
118
122
|
"typecheck": "tsc --noEmit",
|
|
119
|
-
"test": "vitest run"
|
|
123
|
+
"test": "vitest run",
|
|
124
|
+
"test:coverage": "vitest run --coverage"
|
|
120
125
|
}
|
|
121
126
|
}
|