@banzhe/dsh-devcontainer 0.2.1 → 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/README.md +33 -0
- package/README.zh-CN.md +33 -0
- package/lib/client.js +151 -10
- package/lib/client.js.map +1 -1
- package/lib/{exec-CKAAz2zz.js → exec-Bcojrag9.js} +5 -4
- package/lib/exec-Bcojrag9.js.map +1 -0
- package/lib/fs.d.ts +62 -16
- package/lib/fs.d.ts.map +1 -1
- package/lib/fs.js +256 -68
- package/lib/fs.js.map +1 -1
- package/lib/helper/main.mjs +22 -3
- package/lib/index.d.ts +19 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +50 -4
- package/lib/index.js.map +1 -1
- package/lib/{sbx-1GsFjQBk.js → sbx-Blgjzzoe.js} +918 -135
- package/lib/sbx-Blgjzzoe.js.map +1 -0
- package/lib/shell.d.ts +3 -3
- package/lib/shell.d.ts.map +1 -1
- package/lib/shell.js +11 -4
- package/lib/shell.js.map +1 -1
- package/lib/{types-DsF9Hz5P.d.ts → types-B2cQmBTx.d.ts} +4 -2
- package/lib/types-B2cQmBTx.d.ts.map +1 -0
- package/package.json +36 -29
- package/lib/exec-CKAAz2zz.js.map +0 -1
- package/lib/sbx-1GsFjQBk.js.map +0 -1
- package/lib/types-DsF9Hz5P.d.ts.map +0 -1
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":["createSnapshotStore","Button","Checkbox","Tag","styles"],"sources":["../src/ids.ts","../src/client/variants.ts","../src/client/controller.ts","../src/client/VariantsSection.tsx","../src/client/locales.ts","../src/client/index.ts"],"sourcesContent":["/**\n * The suffixes and display labels that mark a derived preset, shared by both\n * halves of the Bundle.\n *\n * Two independent tracks exist: a `… (devContainer)` variant for repositories\n * that declare a Dev Container, and a `… (sbx)` variant for Docker Sandbox\n * (`sbx`) sessions. They differ only in the suffix, the label, and the\n * `DSH_*` marker the shell row injects; everything else about a derived preset\n * is identical, so one module owns the naming for both.\n *\n * The browser half needs these to keep derived presets out of its own picker\n * list, and must not import the Host modules to get them: this file has no\n * imports.\n */\n\n/** Appended to a source preset id to name its Dev Container variant. */\nexport const DEVCONTAINER_VARIANT_SUFFIX = '-devcontainer'\n\n/** Appended to a source preset id to name its Docker Sandbox variant. */\nexport const SBX_VARIANT_SUFFIX = '-sbx'\n\n/** Appended to a source preset's display name for the Dev Container variant. */\nexport const DEVCONTAINER_NAME_SUFFIX = ' (devContainer)'\n\n/** Appended to a source preset's display name for the Docker Sandbox variant. */\nexport const SBX_NAME_SUFFIX = ' (sbx)'\n\n/** Which runtime a derived preset targets. */\nexport type VariantKind = 'devcontainer' | 'sbx'\n\n/** Every kind, in the order the planner emits them. */\nexport const VARIANT_KINDS: readonly VariantKind[] = ['devcontainer', 'sbx']\n\n/**\n * The id suffix of one track.\n * @param kind - the track.\n * @returns `-devcontainer` or `-sbx`.\n */\nexport function variantSuffixOf(kind: VariantKind): string {\n return kind === 'sbx' ? SBX_VARIANT_SUFFIX : DEVCONTAINER_VARIANT_SUFFIX\n}\n\n/**\n * The display-name suffix of one track.\n * @param kind - the track.\n * @returns ` (devContainer)` or ` (sbx)`.\n */\nexport function variantNameSuffixOf(kind: VariantKind): string {\n return kind === 'sbx' ? SBX_NAME_SUFFIX : DEVCONTAINER_NAME_SUFFIX\n}\n\n/**\n * The derived id of one source preset on one track.\n * @param source - the source preset id.\n * @param kind - the track the variant belongs to.\n * @returns the variant id.\n */\nexport function variantIdOf(source: string, kind: VariantKind): string {\n return `${source}${variantSuffixOf(kind)}`\n}\n\n/**\n * The track one variant id belongs to.\n * @param id - any preset id.\n * @returns the track, or undefined when the id names no derived preset.\n */\nexport function variantKindOf(id: string): VariantKind | undefined {\n // The Dev Container suffix is checked first: it is the older of the two, and\n // no id can carry both.\n if (id.endsWith(DEVCONTAINER_VARIANT_SUFFIX)) return 'devcontainer'\n if (id.endsWith(SBX_VARIANT_SUFFIX)) return 'sbx'\n return undefined\n}\n\n/**\n * Whether an id names a `… (devContainer)` preset.\n * @param id - any preset id.\n * @returns true when the id carries the Dev Container suffix.\n */\nexport function isDevcontainerVariantId(id: string): boolean {\n return id.endsWith(DEVCONTAINER_VARIANT_SUFFIX)\n}\n\n/**\n * Whether an id names a `… (sbx)` preset.\n * @param id - any preset id.\n * @returns true when the id carries the Docker Sandbox suffix.\n */\nexport function isSbxVariantId(id: string): boolean {\n return id.endsWith(SBX_VARIANT_SUFFIX)\n}\n\n/**\n * Whether an id names a preset this Bundle derived, on either track.\n * @param id - any preset id.\n * @returns true when the id carries either variant suffix.\n */\nexport function isAnyVariantId(id: string): boolean {\n return variantKindOf(id) !== undefined\n}\n","/**\n * The settings page's data rules, as pure functions.\n *\n * Each derivative track has its own stored list and its own derived ids:\n * `sources` is the `(devContainer)` track and `sbxSources` the `(sbx)` track, so a\n * row's \"derived\" answer is always relative to the track that asked.\n *\n * The page lists the presets a person can derive from, which is the roster\n * MINUS every variant this Bundle already registered: offering\n * `standard-devcontainer` as a source would derive `standard-devcontainer-devcontainer`.\n */\nimport type { AgentPresetRow, AgentPresetRoster } from '@deepseek-ai/dsh-agent-preset-registry/types'\nimport { isAnyVariantId, variantIdOf, type VariantKind } from '../ids.ts'\n\n/**\n * The two stored source lists, one per derivative track.\n *\n * These are field names of the `devcontainer` settings namespace, and the Host\n * row reads exactly the same pair.\n */\nexport const SOURCE_FIELDS = {\n devcontainer: 'sources',\n sbx: 'sbxSources',\n} as const satisfies Record<VariantKind, string>\n\n/** One selectable source row. */\nexport interface SelectablePreset {\n /** Stable preset id: what the checkbox writes. */\n readonly id: string\n /** The preset's published name, or the id when it published none. */\n readonly name: string\n /** The preset's own one-line description, when it published one. */\n readonly description: string\n /** Whether THIS track's variant is registered right now. */\n readonly derived: boolean\n /**\n * The registry's diagnostic for this track's variant, when it registered but\n * could not mount. A variant the picker hides must never read as \"available\".\n */\n readonly variantBroken?: string\n /** Whether this track's stored list asks for its variant. */\n readonly checked: boolean\n /** The registry's activation diagnostic, when this preset could not be mounted. */\n readonly broken?: string\n}\n\n/**\n * The stored ids of one track.\n * @param section - the namespace value as the Host published it, possibly before the first read.\n * @param field - the settings field holding that track's list.\n * @returns every non-empty string id it lists, in written order.\n */\nfunction idsOf(section: unknown, field: string): string[] {\n if (typeof section !== 'object' || section === null) return []\n const raw: unknown = Reflect.get(section, field)\n if (!Array.isArray(raw)) return []\n return raw.filter((id): id is string => typeof id === 'string' && id.length > 0)\n}\n\n/**\n * The stored `(devContainer)` source list of one form value.\n * @param section - the namespace value as the Host published it, possibly before the first read.\n * @returns every non-empty string id it lists, in written order.\n */\nexport function sourcesOf(section: unknown): string[] {\n return idsOf(section, SOURCE_FIELDS.devcontainer)\n}\n\n/**\n * The stored `(sbx)` source list of one form value.\n * @param section - the namespace value as the Host published it, possibly before the first read.\n * @returns every non-empty string id it lists, in written order.\n */\nexport function sbxSourcesOf(section: unknown): string[] {\n return idsOf(section, SOURCE_FIELDS.sbx)\n}\n\n/**\n * The variant ids the roster currently carries.\n * @param roster - the roster the Host answered with.\n * @returns the derived preset ids it contains.\n */\nfunction rowsOf(roster: unknown): readonly AgentPresetRow[] {\n if (roster === null || typeof roster !== 'object') return []\n const presets: unknown = (roster as { presets?: unknown }).presets\n return Array.isArray(presets) ? presets as readonly AgentPresetRow[] : []\n}\n\n/**\n * The rows one track offers.\n *\n * Source presets keep the Host's roster order; a variant of either track never\n * appears as a source. `checked` follows the STORED list rather than the roster,\n * because a registration that failed still needs a row a person can uncheck.\n * @param roster - the full roster from the Host.\n * @param sources - the stored list of source ids on this track.\n * @param kind - the derivative track whose variants the rows report.\n * @returns one row per selectable preset.\n */\nexport function selectablePresets(\n roster: AgentPresetRoster,\n sources: readonly string[],\n kind: VariantKind = 'devcontainer',\n): SelectablePreset[] {\n const wanted = new Set(sources)\n const rows = rowsOf(roster)\n const byId = new Map(rows.map(preset => [preset.id, preset]))\n return rows\n .filter(preset => !isAnyVariantId(preset.id))\n .map((preset) => {\n const variant = byId.get(variantIdOf(preset.id, kind))\n return {\n id: preset.id,\n name: preset.name ?? preset.id,\n description: preset.description ?? '',\n derived: variant !== undefined,\n checked: wanted.has(preset.id),\n ...preset.broken === undefined ? {} : { broken: preset.broken },\n ...variant?.broken === undefined ? {} : { variantBroken: variant.broken },\n }\n })\n}\n\n/**\n * Whether one row may be checked: a preset the registry could not mount derives\n * a variant that cannot mount either, so offering it would only strand the page.\n * @param row - the row to test.\n * @returns false when the row is broken and not already stored.\n */\nexport function selectable(row: SelectablePreset): boolean {\n return row.broken === undefined || row.checked\n}\n\n/**\n * The stored list one checkbox produces.\n * @param sources - the ids currently stored, in written order.\n * @param id - the preset the row owns.\n * @param checked - whether that preset's variant is now wanted.\n * @returns the next stored order: existing ids keep their place, an added id goes last.\n */\nexport function nextSources(sources: readonly string[], id: string, checked: boolean): string[] {\n if (!checked) return sources.filter(held => held !== id)\n return sources.includes(id) ? [...sources] : [...sources, id]\n}\n","/**\n * Staged state for the Dev Container variants page.\n *\n * Reads the roster through `ctx.remote.agentPresets.list` — the same listing\n * every picker reads — and writes BOTH stored source lists (`sources` for the\n * `(devContainer)` track, `sbxSources` for the `(sbx)` track) through the shared\n * `ConfigForm` of the `devcontainer` settings namespace. A write lands in the\n * profile patch and in the Host's live reference, and the Host re-derives the\n * variant set while the same event is still settling, so checking a box is felt\n * before the next render.\n *\n * Toggles are queued rather than dropped: each write carries the WHOLE pair of\n * lists, and a person clearing two rows in a row must not lose the second click.\n */\nimport { createSnapshotStore, type SnapshotStore } from '@deepseek-ai/dsh-client-store'\nimport type { AgentPresetRoster } from '@deepseek-ai/dsh-agent-preset-registry/types'\nimport type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client'\nimport type { SettingsPathOpView } from '@deepseek-ai/dsh-api-remotes/client'\nimport {\n nextSources, selectable, selectablePresets, SOURCE_FIELDS, sbxSourcesOf, sourcesOf, type SelectablePreset,\n} from './variants.ts'\n\n/** The settings namespace this page edits: also the Host Loader row id. */\nexport const DEVCONTAINER_NS = 'devcontainer'\n\n/** The namespace section as the Host publishes it. */\nexport interface DevcontainerVariantsSettings {\n /** Source preset ids whose `(devContainer)` variants are wanted; absent before the first Host read. */\n sources?: readonly string[]\n /** Source preset ids whose `(sbx)` variants are wanted; absent before the first Host read. */\n sbxSources?: readonly string[]\n}\n\n/** One row as the page renders it. */\nexport type VariantRow = SelectablePreset\n\n/** What a failed read or write means for the page's own copy. */\nexport type VariantsFailure = 'load' | 'write'\n\n/** Page snapshot the renderer subscribes to. */\nexport interface VariantsState {\n /** `loading` until the roster arrives, `unavailable` when the Host serves no such namespace. */\n readonly status: 'loading' | 'ready' | 'error' | 'unavailable'\n /** The failure the page must explain, if any. */\n readonly failure: VariantsFailure | null\n /** Whether the Host accepts writes to this namespace. */\n readonly writable: boolean\n /** Whether a toggle is crossing the wire or still queued. */\n readonly saving: boolean\n /** Every selectable source preset, in Host roster order, with its `(devContainer)` state. */\n readonly rows: readonly VariantRow[]\n /** The same presets, with their `(sbx)` state. */\n readonly sbxRows: readonly VariantRow[]\n /** How many rows have a `(devContainer)` variant derived right now. */\n readonly checkedCount: number\n /** How many rows have an `(sbx)` variant derived right now. */\n readonly sbxCheckedCount: number\n}\n\n/** Business face the page receives (the framework binds `hooks` to a selector hook). */\nexport interface VariantsFace {\n hooks: { devcontainerVariants: SnapshotStore<VariantsState> }\n /** Read the roster from the Host. */\n load: () => Promise<void>\n /** Derive or drop one preset's `(devContainer)` variant; queues behind a write already in flight. */\n setChecked: (id: string, checked: boolean) => void\n /** Flip one preset's `(sbx)` variant; queues behind a write already in flight. */\n toggleSbxSource: (sourceId: string) => void\n}\n\n/** The pair of stored lists one write carries. */\ninterface SourcesIntent {\n readonly sources: string[]\n readonly sbxSources: string[]\n}\n\nconst INITIAL: VariantsState = {\n status: 'loading',\n failure: null,\n writable: false,\n saving: false,\n rows: [],\n sbxRows: [],\n checkedCount: 0,\n sbxCheckedCount: 0,\n}\n\n/**\n * Delays between roster re-reads after a write lands.\n *\n * A landed write reaches the Host before the variants it asks for are\n * registered: the settings event is emitted first, the sync then walks the\n * presets. One immediate re-read therefore sees the old roster, and without a\n * retry the page would show every freshly checked row as pending forever.\n */\nconst VERIFY_DELAYS: readonly number[] = [80, 150, 300, 600]\n\n/**\n * The rows of one roster answer.\n *\n * A listing that reports success without a body (a namespace whose method is not\n * what this build serves) must leave the page empty rather than throw inside the\n * plugin: this page is a preference, not a critical surface.\n * @param value - the roster the Remote answered with.\n * @returns its preset rows, or none when the answer carries no roster.\n */\nexport function rosterRows(value: unknown): AgentPresetRoster['presets'] {\n if (value === null || typeof value !== 'object') return []\n const presets: unknown = (value as { presets?: unknown }).presets\n return Array.isArray(presets) ? presets as AgentPresetRoster['presets'] : []\n}\n\n/** Resolve after one delay, so a test can drive the clock. */\nfunction wait(ms: number): Promise<void> {\n return new Promise((resolve) => { setTimeout(resolve, ms) })\n}\n\n/**\n * One roster read.\n *\n * Structural rather than `RemoteResult` so a build that serves no such namespace\n * can answer \"not readable\" without fabricating a carrier error: success carries\n * the roster, anything else is a failed read.\n */\nexport type RosterListing = () => Promise<{ readonly ok: boolean, readonly value?: unknown }>\n\n/** Reads the roster and writes the two source lists for one page instance. */\nexport class VariantsController {\n private declared: AgentPresetRoster['presets'] = []\n private failure: VariantsFailure | null = null\n private loading = true\n /** The lists the queue will send next; undefined when every toggle has landed. */\n private intent: SourcesIntent | undefined\n private writing = false\n /** Invalidates every read that a newer load, or a dispose, supersedes. */\n private generation = 0\n private disposed = false\n private readonly store: SnapshotStore<VariantsState> = createSnapshotStore(INITIAL)\n private readonly unsubscribe: () => void\n\n /**\n * @param form - the shared form of the `devcontainer` settings namespace.\n * @param listing - the roster listing the pickers read.\n */\n constructor(\n private readonly form: ConfigForm<DevcontainerVariantsSettings>,\n private readonly listing: RosterListing,\n ) {\n // Another editor of the same namespace (a second tab, an SSH session) moves\n // the stored lists under this page, so the rows follow the form, not a copy.\n this.unsubscribe = form.subscribe(() => { this.publish() })\n }\n\n dispose(): void {\n this.disposed = true\n this.generation += 1\n this.unsubscribe()\n }\n\n inject(): VariantsFace {\n return {\n hooks: { devcontainerVariants: this.store },\n load: () => this.load(),\n setChecked: (id, checked) => { this.setChecked(id, checked) },\n toggleSbxSource: (sourceId) => { this.toggleSbxSource(sourceId) },\n }\n }\n\n /** Read the roster the pickers read. */\n async load(): Promise<void> {\n await this.refresh(false)\n void this.settle()\n }\n\n /**\n * Re-read the roster without flipping the page back to `loading`.\n * @param quiet - true when a previous render must stay on screen while it refreshes.\n */\n private async refresh(quiet: boolean): Promise<void> {\n if (this.disposed) return\n const generation = ++this.generation\n if (!quiet) {\n this.loading = true\n this.publish()\n }\n const result = await this.listing()\n if (generation !== this.generation) return\n this.loading = false\n if (result.ok) {\n this.declared = rosterRows(result.value)\n this.failure = null\n } else {\n this.declared = []\n this.failure = 'load'\n }\n this.publish()\n }\n\n /**\n * Re-read the roster a few times while a write's registrations settle.\n *\n * The first re-read after a landed write races the Host's own sync, so the\n * variants it asks for may still be missing. Retrying with backoff turns the\n * \"waiting to be registered\" badge into the real state within a second, and\n * stops as soon as nothing is outstanding.\n */\n private async settle(): Promise<void> {\n for (const delay of VERIFY_DELAYS) {\n if (!this.polling()) return\n await wait(delay)\n if (!this.polling()) return\n await this.refresh(true)\n }\n }\n\n /** Whether another retry is still both wanted and possible. */\n private polling(): boolean {\n return !this.disposed && this.outstanding()\n }\n\n /** Whether a stored row of either track is still waiting for its variant to register. */\n private outstanding(): boolean {\n const stored = this.effective(this.form.getSnapshot().value)\n const roster = { presets: this.declared }\n return selectablePresets(roster, stored.sources, 'devcontainer').some(pending)\n || selectablePresets(roster, stored.sbxSources, 'sbx').some(pending)\n }\n\n /** Derive or drop one preset's `(devContainer)` variant, without losing a toggle that arrives mid-write. */\n setChecked(id: string, checked: boolean): void {\n const stored = this.stage()\n if (stored === undefined) return\n this.commit({ ...stored, sources: nextSources(stored.sources, id, checked) })\n }\n\n /**\n * Flip one preset's `(sbx)` variant.\n *\n * A toggle rather than a target state because the checkbox renders the\n * effective list: whatever the person saw checked is what flips, including a\n * toggle that is still queued behind a write in flight.\n * @param sourceId - the source preset whose `(sbx)` variant flips.\n */\n toggleSbxSource(sourceId: string): void {\n const stored = this.stage()\n if (stored === undefined) return\n const checked = !stored.sbxSources.includes(sourceId)\n this.commit({ ...stored, sbxSources: nextSources(stored.sbxSources, sourceId, checked) })\n }\n\n /**\n * The lists a toggle starts from, or undefined when this page must ignore it.\n * @returns the queued lists when a write is still pending, otherwise the stored ones.\n */\n private stage(): SourcesIntent | undefined {\n if (this.disposed) return undefined\n const snapshot = this.form.getSnapshot()\n if (!snapshot.writable) return undefined\n return this.effective(snapshot.value)\n }\n\n /** Queue one toggle and start the write that carries it. */\n private commit(next: SourcesIntent): void {\n this.intent = next\n this.publish()\n void this.flush()\n }\n\n /**\n * The lists to render: the queued ones while a write is in flight, otherwise\n * the ones the Host stored.\n */\n private effective(section: unknown): SourcesIntent {\n if (this.intent !== undefined) return this.intent\n return { sources: sourcesOf(section), sbxSources: sbxSourcesOf(section) }\n }\n\n /**\n * Send the queued lists until nothing is queued.\n *\n * Both fields travel in ONE mutation, so a single revision fence accepts or\n * refuses the pair together: a deployment can never store one track's toggle\n * and drop the other's.\n *\n * A refusal drops the queue: those intents were derived from lists the Host\n * never stored, so replaying them would toggle a different set than the one the\n * person was looking at. After a landed write the roster is re-read, because\n * the Host may have just registered or disposed a variant.\n */\n private async flush(): Promise<void> {\n if (this.writing) return\n this.writing = true\n this.publish()\n let landed = false\n try {\n while (this.intent !== undefined) {\n const next = this.intent\n const accepted = await this.form.mutate(opsFor(next))\n this.failure = accepted ? null : 'write'\n if (!accepted) break\n landed = true\n if (this.intent === next) this.intent = undefined\n this.publish()\n }\n } catch {\n this.failure = 'write'\n } finally {\n this.intent = undefined\n this.writing = false\n this.publish()\n }\n if (landed && !this.disposed) {\n await this.refresh(true)\n await this.settle()\n }\n }\n\n private publish(): void {\n if (this.disposed) return\n const snapshot = this.form.getSnapshot()\n const stored = this.effective(snapshot.value)\n const roster = { presets: this.declared }\n const rows = selectablePresets(roster, stored.sources, 'devcontainer')\n const sbxRows = selectablePresets(roster, stored.sbxSources, 'sbx')\n this.store.set({\n status: snapshot.status === 'unavailable'\n ? 'unavailable'\n : this.failure === 'load' ? 'error'\n : this.loading || snapshot.status === 'loading' ? 'loading' : 'ready',\n failure: this.failure,\n writable: snapshot.writable,\n saving: this.writing || this.intent !== undefined,\n rows,\n sbxRows,\n checkedCount: rows.filter(row => row.checked).length,\n sbxCheckedCount: sbxRows.filter(row => row.checked).length,\n })\n }\n}\n\n/** Whether one row is stored but its variant is not registered yet. */\nfunction pending(row: SelectablePreset): boolean {\n return row.checked && !row.derived && selectable(row)\n}\n\n/**\n * One mutation carrying both stored lists.\n * @param intent - the lists to store.\n * @returns the settings operations, in track order.\n */\nfunction opsFor(intent: SourcesIntent): SettingsPathOpView[] {\n return [\n { op: 'set', path: [SOURCE_FIELDS.devcontainer], value: intent.sources },\n { op: 'set', path: [SOURCE_FIELDS.sbx], value: intent.sbxSources },\n ]\n}\n","/**\n * The Dev Container variants page: two independent tracks, one checkbox per\n * source preset on each.\n *\n * A checkbox, not a dropdown, because each track is a SET rather than one\n * choice, and `Checkbox` is the primitive the shipped settings rows already use\n * for the same shape. Checked means \"derive my copy on this track\".\n *\n * The row's tail carries the truth from the Host: a checked box whose variant is\n * not in the roster yet says so (`pendingBadge`), and a preset the registry could\n * not mount says so too (`brokenBadge`) — its variant could not mount either, so\n * it is offered read-only rather than stranding the person with a pending row.\n */\nimport { useEffect, type ReactNode } from 'react'\nimport { Button, Checkbox, Tag } from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport { variantNameSuffixOf, type VariantKind } from '../ids.ts'\nimport type { VariantRow, VariantsFace, VariantsState } from './controller.ts'\nimport { selectable } from './variants.ts'\nimport type { DevcontainerVariantsKey } from './locales.ts'\n\nexport type DevcontainerVariantsSectionProps =\n PropsRuntime<'settings.section'>\n & PropsLocale<'devcontainer'>\n & InjectFace<VariantsFace>\n\n/** The translating seat the section and its track groups receive. */\ntype Translate = DevcontainerVariantsSectionProps['t']\n\n/** The dictionary keys one track reads for its own copy. */\ninterface TrackCopy {\n readonly title: DevcontainerVariantsKey\n readonly description: DevcontainerVariantsKey\n readonly empty: DevcontainerVariantsKey\n readonly none: DevcontainerVariantsKey\n readonly count: DevcontainerVariantsKey\n}\n\n/** Copy per track: the two groups differ only in their words and their suffix. */\nconst COPY: Record<VariantKind, TrackCopy> = {\n devcontainer: {\n title: 'devcontainerTitle',\n description: 'devcontainerDescription',\n empty: 'empty',\n none: 'noneChecked',\n count: 'checkedCount',\n },\n sbx: {\n title: 'sbxTitle',\n description: 'sbxDescription',\n empty: 'sbxEmpty',\n none: 'sbxNoneChecked',\n count: 'sbxCheckedCount',\n },\n}\n\n/** One track's rendered rows and the toggle they call. */\ninterface TrackInput {\n readonly kind: VariantKind\n readonly rows: VariantsState['rows']\n readonly checkedCount: number\n readonly disabled: boolean\n readonly onToggle: (id: string, checked: boolean) => void\n}\n\n/**\n * Render the selectable presets on both tracks, each with one derivation toggle\n * per row.\n * @param props - settings actions, the page snapshot hook, and localized copy.\n * @returns The Dev Container variants settings section.\n */\nexport function DevcontainerVariantsSection(props: DevcontainerVariantsSectionProps): ReactNode {\n const { t, load } = props\n const state = props.useDevcontainerVariants(snapshot => snapshot)\n useEffect(() => { void load() }, [load])\n // A write in flight does not lock the rows: the controller queues a toggle that\n // lands mid-write, so a person checking several rows keeps every click.\n const disabled = !state.writable\n return (\n <section className=\"dcv-section\">\n <h2 className=\"dcv-title\">{t('nav')}</h2>\n <p className=\"dcv-intro\">{t('intro')}</p>\n {state.failure === 'load'\n ? (\n <p className=\"dcv-notice\" data-failed=\"true\" role=\"alert\">\n {t('failed')}{' '}\n <Button variant=\"ghost\" disabled={disabled} onClick={() => { void load() }}>{t('retry')}</Button>\n </p>\n )\n : null}\n {state.failure === 'write'\n ? <p className=\"dcv-notice\" data-failed=\"true\" role=\"alert\">{t('writeFailed')}</p>\n : null}\n {state.status === 'unavailable' ? <p className=\"dcv-notice\">{t('unavailable')}</p> : null}\n {state.status === 'loading' ? <p className=\"dcv-notice\" role=\"status\">{t('loading')}</p> : null}\n {state.status === 'ready' && !state.writable ? <p className=\"dcv-notice\">{t('readOnly')}</p> : null}\n {state.status === 'ready'\n ? (\n <>\n {renderTrack(t, {\n kind: 'devcontainer',\n rows: state.rows,\n checkedCount: state.checkedCount,\n disabled,\n onToggle: (id, checked) => { props.setChecked(id, checked) },\n })}\n {renderTrack(t, {\n kind: 'sbx',\n rows: state.sbxRows,\n checkedCount: state.sbxCheckedCount,\n disabled,\n // The sbx box renders the effective list, so flipping it is the\n // whole intent: the controller derives the target state itself.\n onToggle: (id) => { props.toggleSbxSource(id) },\n })}\n <p className=\"dcv-notice\">{t('refreshHint')}</p>\n </>\n )\n : null}\n </section>\n )\n}\n\n/**\n * One track's card: its heading with the preset-name suffix, what the track is,\n * how much of it is derived, and the rows themselves.\n * @param t - the localized copy seat.\n * @param input - the track, its rows, and its toggle.\n * @returns The rendered group.\n */\nfunction renderTrack(t: Translate, input: TrackInput): ReactNode {\n const copy = COPY[input.kind]\n return (\n <div className=\"dcv-group\" data-track={input.kind}>\n <h3 className=\"dcv-group-title\">\n {t(copy.title)}\n <code className=\"dcv-suffix\">{variantNameSuffixOf(input.kind).trim()}</code>\n </h3>\n <p className=\"dcv-group-description\">{t(copy.description)}</p>\n <p className=\"dcv-count\">\n {input.rows.length === 0\n ? t(copy.empty)\n : input.checkedCount === 0 ? t(copy.none) : t(copy.count, { count: input.checkedCount })}\n </p>\n {input.rows.length === 0 ? null : (\n <ul className=\"dcv-rows\">\n {input.rows.map(row => renderRow(t, input.kind, row, input.disabled, input.onToggle))}\n </ul>\n )}\n </div>\n )\n}\n\n/**\n * One preset row: the checkbox, the preset's own description, and the Host's\n * verdict on this track's variant.\n * @param t - the localized copy seat.\n * @param kind - the derivative track this row belongs to.\n * @param row - the row to render.\n * @param disabled - whether the deployment refuses writes.\n * @param onToggle - the toggle for this row.\n * @returns The rendered row.\n */\nfunction renderRow(\n t: Translate,\n kind: VariantKind,\n row: VariantRow,\n disabled: boolean,\n onToggle: (id: string, checked: boolean) => void,\n): ReactNode {\n const broken = row.broken !== undefined\n return (\n <li\n key={row.id}\n className=\"dcv-row\"\n data-checked={row.checked ? 'true' : undefined}\n data-broken={broken ? 'true' : undefined}\n >\n <span className=\"dcv-main\">\n <Checkbox\n checked={row.checked}\n disabled={disabled || !selectable(row)}\n label={row.name}\n title={broken\n ? `${t('brokenBadge')}: ${row.broken ?? ''}`\n : row.variantBroken === undefined\n ? t(row.checked ? 'checked' : 'unchecked')\n : `${t('variantBrokenBadge')}: ${row.variantBroken}`}\n onChange={(next) => { onToggle(row.id, next) }}\n />\n {row.description === '' ? null : (\n // Both tracks list the same preset ids, so the anchor carries the track.\n <span className=\"dcv-description\" id={`dcv-description-${kind}-${row.id}`}>{row.description}</span>\n )}\n </span>\n <span className=\"dcv-tail\">\n {row.name === row.id ? null : <code className=\"dcv-id\">{row.id}</code>}\n {broken ? <Tag tone=\"danger\">{t('brokenBadge')}</Tag> : null}\n {row.checked\n ? row.variantBroken === undefined\n ? <Tag tone={row.derived ? 'success' : 'warning'}>{t(row.derived ? 'derivedBadge' : 'pendingBadge')}</Tag>\n : <Tag tone=\"danger\">{t('variantBrokenBadge')}</Tag>\n : null}\n <span className=\"dcv-state\" data-checked={row.checked ? 'true' : undefined}>\n {t(row.checked ? 'checked' : 'unchecked')}\n </span>\n </span>\n </li>\n )\n}\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n devcontainer: DevcontainerVariantsKey\n }\n}\n","/** Locale bundles for the Dev Container variants page (namespace `devcontainer`). */\n\nexport type DevcontainerVariantsKey =\n | 'nav' | 'intro'\n | 'devcontainerTitle' | 'devcontainerDescription' | 'sbxTitle' | 'sbxDescription'\n | 'checked' | 'unchecked' | 'derivedBadge' | 'pendingBadge' | 'brokenBadge' | 'variantBrokenBadge'\n | 'noneChecked' | 'checkedCount' | 'sbxNoneChecked' | 'sbxCheckedCount'\n | 'loading' | 'failed' | 'retry' | 'unavailable' | 'readOnly'\n | 'writeFailed' | 'refreshHint' | 'empty' | 'sbxEmpty'\n\nexport const en: Record<DevcontainerVariantsKey, string> = {\n nav: 'Dev Container presets',\n intro: 'Check a preset to derive copies of it. A “(devContainer)” copy sends every command into the repository\\'s Linux Dev Container; an “(sbx)” copy runs in a Docker Sandbox. The two tracks are independent, nothing is derived until you check something, and a copy disappears again as soon as you clear its box.',\n devcontainerTitle: 'Dev Container runtime',\n devcontainerDescription: 'The regular container environment built from the repository\\'s .devcontainer declaration: every command runs inside the Linux container the Dev Container CLI builds and starts.',\n sbxTitle: 'Docker Sandbox runtime',\n sbxDescription: 'Hardware-isolated execution in a Docker Sandbox (MicroVM): each session gets its own micro VM with Docker ready to build out of the box, and no repository declaration is needed.',\n checked: 'derived',\n unchecked: 'not derived',\n derivedBadge: 'Available',\n pendingBadge: 'Wait for it',\n brokenBadge: 'Cannot load',\n variantBrokenBadge: 'Variant cannot mount',\n noneChecked: 'No preset is derived.',\n checkedCount: '{count} derived',\n sbxNoneChecked: 'No Docker Sandbox copy is derived.',\n sbxCheckedCount: '{count} derived as (sbx)',\n loading: 'Loading presets…',\n failed: 'Presets could not be loaded.',\n retry: 'Retry',\n unavailable: 'This plugin is not loaded, so there is nothing to configure.',\n readOnly: 'This deployment stores settings read-only.',\n writeFailed: 'The deployment did not accept this change.',\n refreshHint: 'Preset pickers re-read the roster the next time one opens.',\n empty: 'This deployment declares no preset to derive from.',\n sbxEmpty: 'This deployment declares no preset to derive a Docker Sandbox copy from.',\n}\n\nexport const zh: Record<DevcontainerVariantsKey, string> = {\n nav: 'Dev Container 预设',\n intro: '勾选一个预设即可派生它的副本:「(devContainer)」副本把每条命令送进仓库指定的 Linux Dev Container,「(sbx)」副本在 Docker Sandbox 中执行。两组互相独立,默认都不派生;取消勾选后副本立即注销。',\n devcontainerTitle: 'Dev Container 运行环境',\n devcontainerDescription: '基于仓库 .devcontainer 声明的常规容器运行环境:命令在 Dev Container CLI 构建并启动的 Linux 容器里执行。',\n sbxTitle: 'Docker Sandbox 运行环境',\n sbxDescription: '基于 Docker Sandbox (MicroVM) 的硬件级隔离执行环境:每个会话独占一台微虚拟机,开箱即用支持 Docker 构建,不依赖仓库声明。',\n checked: '已派生',\n unchecked: '未派生',\n derivedBadge: '已可用',\n pendingBadge: '等待注册',\n brokenBadge: '无法加载',\n variantBrokenBadge: '派生副本不可用',\n noneChecked: '当前没有派生任何预设。',\n checkedCount: '已派生 {count} 项',\n sbxNoneChecked: '当前没有派生任何 Docker Sandbox 副本。',\n sbxCheckedCount: '已派生 {count} 项 (sbx)',\n loading: '正在加载预设…',\n failed: '无法加载预设。',\n retry: '重试',\n unavailable: '该插件当前未加载,无需配置。',\n readOnly: '本部署的设置为只读。',\n writeFailed: '本部署没有接受这次修改。',\n refreshHint: '预设选择器下次打开时会重新读取清单。',\n empty: '本部署没有可派生的预设。',\n sbxEmpty: '本部署没有可派生 Docker Sandbox 副本的预设。',\n}\n","/**\n * Browser half: the Dev Container variants page.\n *\n * The page is a `settings.section` of its own rather than a `plugins.row.config`\n * card: this preference decides which `(devContainer)` presets exist, not how\n * this Loader row is configured, and it has to stay reachable while the row is\n * what is being configured.\n *\n * Writes go through `configForms`, so the stored list lands in the profile patch\n * and in the Host's live reference in one step; the Host row follows the same\n * namespace and re-derives its variant set on the resulting\n * `settings/document-updated` event.\n */\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\n// Type-only: the ctx.remote merge and the agentPresets namespace it carries.\nimport type {} from '@deepseek-ai/dsh-api-remotes/client'\n// Type-only: the ctx.configForms merge, the ConfigForm type, and the\n// `settings.section` SlotMap entry.\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\nimport { DEVCONTAINER_NS, VariantsController, type DevcontainerVariantsSettings } from './controller.ts'\nimport { DevcontainerVariantsSection } from './VariantsSection.tsx'\nimport { en, zh } from './locales.ts'\n// Text, not a stylesheet link: the ModuleLoader fetches one artifact, so the\n// sheet is inlined at build time. See `tsdown.config.ts`.\nimport styles from './styles.css?inline'\n\nexport type {\n DevcontainerVariantsSettings, VariantRow, VariantsFace, VariantsFailure, VariantsState,\n} from './controller.ts'\nexport type { DevcontainerVariantsKey } from './locales.ts'\nexport type { SelectablePreset } from './variants.ts'\n\n/** Plugin id, stamped onto the injected stylesheet for teardown bookkeeping. */\nconst PLUGIN_ID = '@banzhe/dsh-devcontainer'\n\nconst NS = DEVCONTAINER_NS\n\nexport const inject = ['configForms', 'locale', 'remote', 'remote.agentPresets', 'slots']\n\n// Type-only: the roster read this page performs.\nimport type { RosterListing } from './controller.ts'\n\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'devcontainer: dictionaries')\n // The page's stylesheet rides the plugin's own fiber: unload removes it. It\n // carries the shell's `--dsw-*` token values, which only resolve inside a\n // themed document, so it is a `<style>` tag installed here — not inline\n // declarations on the elements, which beat every stylesheet in the cascade.\n ctx.effect(() => {\n if (typeof document === 'undefined') return () => {}\n const tag = document.createElement('style')\n tag.dataset.plugin = PLUGIN_ID\n tag.dataset.pluginCss = `${PLUGIN_ID}/styles.css`\n tag.textContent = styles\n document.head.appendChild(tag)\n return () => { tag.remove() }\n }, 'devcontainer: stylesheet')\n\n const form = ctx.configForms.get<DevcontainerVariantsSettings>(NS)\n ctx.effect(() => ctx.configForms.whileServed([NS], () => ctx.slots.inject('settings.section', () => {\n // The shared form is owned by configForms: repeated `get` returns the same\n // controller, so this page and any other editor of the entry share one write\n // queue and one revision fence.\n const controller = new VariantsController(form, async () => {\n // A build that serves no `agentPresets` namespace reports the page as\n // unreadable instead of throwing during plugin activation.\n const namespace = ctx.remote.agentPresets as { list?: RosterListing }\n if (typeof namespace.list !== 'function') return { ok: false }\n return namespace.list()\n })\n const offSlot = ctx.slots.register({\n name: 'settings.section',\n id: NS,\n // After the visibility page (order 30): this one decides what exists at all.\n order: 31,\n label: () => ctx.locale.bind(NS)('nav'),\n locale: NS,\n inject: () => controller.inject(),\n }, DevcontainerVariantsSection)\n // Reverse order: drop the registration before releasing what renders it.\n return [offSlot, () => { controller.dispose() }]\n })), 'devcontainer: variants page')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAgBA,MAAa,8BAA8B;;EAG3C,MAAa,qBAAqB;;EAGlC,MAAa,2BAA2B;;EAGxC,MAAa,kBAAkB;;;;;;EAa/B,SAAgB,gBAAgB,MAA2B;GACzD,OAAO,SAAS,QAAQ,qBAAqB;EAC/C;;;;;;EAOA,SAAgB,oBAAoB,MAA2B;GAC7D,OAAO,SAAS,QAAQ,kBAAkB;EAC5C;;;;;;;EAQA,SAAgB,YAAY,QAAgB,MAA2B;GACrE,OAAO,GAAG,SAAS,gBAAgB,IAAI;EACzC;;;;;;EAOA,SAAgB,cAAc,IAAqC;GAGjE,IAAI,GAAG,SAAA,eAAoC,GAAG,OAAO;GACrD,IAAI,GAAG,SAAA,MAA2B,GAAG,OAAO;EAE9C;;;;;;EAyBA,SAAgB,eAAe,IAAqB;GAClD,OAAO,cAAc,EAAE,MAAM,KAAA;EAC/B;;;;;;;;;EC/EA,MAAa,gBAAgB;GAC3B,cAAc;GACd,KAAK;EACP;;;;;;;EA6BA,SAAS,MAAM,SAAkB,OAAyB;GACxD,IAAI,OAAO,YAAY,YAAY,YAAY,MAAM,OAAO,CAAC;GAC7D,MAAM,MAAe,QAAQ,IAAI,SAAS,KAAK;GAC/C,IAAI,CAAC,MAAM,QAAQ,GAAG,GAAG,OAAO,CAAC;GACjC,OAAO,IAAI,QAAQ,OAAqB,OAAO,OAAO,YAAY,GAAG,SAAS,CAAC;EACjF;;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,aAAa,aAAa,aAAa,CAAC;IACnD,MAAM,MAAM,SAAS,cAAc,OAAO;IAC1C,IAAI,QAAQ,SAAS;IACrB,IAAI,QAAQ,YAAY,GAAG,UAAU;IACrC,IAAI,cAAcC;IAClB,SAAS,KAAK,YAAY,GAAG;IAC7B,aAAa;KAAE,IAAI,OAAO;IAAE;GAC9B,GAAG,0BAA0B;GAE7B,MAAM,OAAO,IAAI,YAAY,IAAkC,EAAE;GACjE,IAAI,aAAa,IAAI,YAAY,YAAY,CAAC,EAAE,SAAS,IAAI,MAAM,OAAO,0BAA0B;IAIlG,MAAM,aAAa,IAAI,mBAAmB,MAAM,YAAY;KAG1D,MAAM,YAAY,IAAI,OAAO;KAC7B,IAAI,OAAO,UAAU,SAAS,YAAY,OAAO,EAAE,IAAI,MAAM;KAC7D,OAAO,UAAU,KAAK;IACxB,CAAC;IAWD,OAAO,CAVS,IAAI,MAAM,SAAS;KACjC,MAAM;KACN,IAAI;KAEJ,OAAO;KACP,aAAa,IAAI,OAAO,KAAK,EAAE,CAAC,CAAC,KAAK;KACtC,QAAQ;KACR,cAAc,WAAW,OAAO;IAClC,GAAG,2BAEW,SAAS;KAAE,WAAW,QAAQ;IAAE,CAAC;GACjD,CAAC,CAAC,GAAG,6BAA6B;EACpC"}
|
|
1
|
+
{"version":3,"file":"client.js","names":["createSnapshotStore","Button","useState","Input","Checkbox","Tag","styles"],"sources":["../src/sbx-template.ts","../src/ids.ts","../src/client/variants.ts","../src/client/controller.ts","../src/client/VariantsSection.tsx","../src/client/locales.ts","../src/client/index.ts"],"sourcesContent":["/**\n * The image a Docker Sandbox is created with, as one argv token.\n *\n * The rule is shared by three callers that cannot reach each other's modules: the\n * row schema that validates the setting, the settings page in the browser that\n * writes it, and the argv builder that hands it to `sbx`. It therefore lives in a\n * module of its own — no Node import — so all three read one definition instead of\n * three copies.\n * @module @banzhe/dsh-devcontainer/sbx-template\n */\n\n/**\n * What a configured image may look like: nothing at all, or one argv token with\n * no whitespace of its own and no leading `-`.\n *\n * Surrounding whitespace is tolerated and trimmed, because the value is a person's\n * typing and the token is what reaches the CLI. A leading `-` is not, because the\n * CLI would read the value as another flag, and neither is an inner space, which\n * `sbx` would split into two arguments.\n */\nexport const SANDBOX_TEMPLATE_PATTERN = /^\\s*(?:[^\\s-]\\S*)?\\s*$/u\n\n/**\n * The image one configured value names, trimmed, or undefined when it names none.\n * @param value - the configured `sbxTemplate`.\n * @returns the image to pass as `--template`, or undefined for the CLI's own template.\n * @throws Error when the value cannot travel as one argv token.\n */\nexport function sandboxTemplateOf(value: string): string | undefined {\n if (!SANDBOX_TEMPLATE_PATTERN.test(value)) {\n throw new Error(`sbx: sbxTemplate ${JSON.stringify(value)} cannot be passed as one image name: it must contain no whitespace and must not start with \"-\"`)\n }\n const image = value.trim()\n return image === '' ? undefined : image\n}\n","/**\n * The suffixes and display labels that mark a derived preset, shared by both\n * halves of the Bundle.\n *\n * Two independent tracks exist: a `… (devContainer)` variant for repositories\n * that declare a Dev Container, and a `… (sbx)` variant for Docker Sandbox\n * (`sbx`) sessions. They differ only in the suffix, the label, and the\n * `DSH_*` marker the shell row injects; everything else about a derived preset\n * is identical, so one module owns the naming for both.\n *\n * The browser half needs these to keep derived presets out of its own picker\n * list, and must not import the Host modules to get them: this file has no\n * imports.\n */\n\n/** Appended to a source preset id to name its Dev Container variant. */\nexport const DEVCONTAINER_VARIANT_SUFFIX = '-devcontainer'\n\n/** Appended to a source preset id to name its Docker Sandbox variant. */\nexport const SBX_VARIANT_SUFFIX = '-sbx'\n\n/** Appended to a source preset's display name for the Dev Container variant. */\nexport const DEVCONTAINER_NAME_SUFFIX = ' (devContainer)'\n\n/** Appended to a source preset's display name for the Docker Sandbox variant. */\nexport const SBX_NAME_SUFFIX = ' (sbx)'\n\n/** Which runtime a derived preset targets. */\nexport type VariantKind = 'devcontainer' | 'sbx'\n\n/** Every kind, in the order the planner emits them. */\nexport const VARIANT_KINDS: readonly VariantKind[] = ['devcontainer', 'sbx']\n\n/**\n * The id suffix of one track.\n * @param kind - the track.\n * @returns `-devcontainer` or `-sbx`.\n */\nexport function variantSuffixOf(kind: VariantKind): string {\n return kind === 'sbx' ? SBX_VARIANT_SUFFIX : DEVCONTAINER_VARIANT_SUFFIX\n}\n\n/**\n * The display-name suffix of one track.\n * @param kind - the track.\n * @returns ` (devContainer)` or ` (sbx)`.\n */\nexport function variantNameSuffixOf(kind: VariantKind): string {\n return kind === 'sbx' ? SBX_NAME_SUFFIX : DEVCONTAINER_NAME_SUFFIX\n}\n\n/**\n * The derived id of one source preset on one track.\n * @param source - the source preset id.\n * @param kind - the track the variant belongs to.\n * @returns the variant id.\n */\nexport function variantIdOf(source: string, kind: VariantKind): string {\n return `${source}${variantSuffixOf(kind)}`\n}\n\n/**\n * The track one variant id belongs to.\n * @param id - any preset id.\n * @returns the track, or undefined when the id names no derived preset.\n */\nexport function variantKindOf(id: string): VariantKind | undefined {\n // The Dev Container suffix is checked first: it is the older of the two, and\n // no id can carry both.\n if (id.endsWith(DEVCONTAINER_VARIANT_SUFFIX)) return 'devcontainer'\n if (id.endsWith(SBX_VARIANT_SUFFIX)) return 'sbx'\n return undefined\n}\n\n/**\n * Whether an id names a `… (devContainer)` preset.\n * @param id - any preset id.\n * @returns true when the id carries the Dev Container suffix.\n */\nexport function isDevcontainerVariantId(id: string): boolean {\n return id.endsWith(DEVCONTAINER_VARIANT_SUFFIX)\n}\n\n/**\n * Whether an id names a `… (sbx)` preset.\n * @param id - any preset id.\n * @returns true when the id carries the Docker Sandbox suffix.\n */\nexport function isSbxVariantId(id: string): boolean {\n return id.endsWith(SBX_VARIANT_SUFFIX)\n}\n\n/**\n * Whether an id names a preset this Bundle derived, on either track.\n * @param id - any preset id.\n * @returns true when the id carries either variant suffix.\n */\nexport function isAnyVariantId(id: string): boolean {\n return variantKindOf(id) !== undefined\n}\n","/**\n * The settings page's data rules, as pure functions.\n *\n * Each derivative track has its own stored list and its own derived ids:\n * `sources` is the `(devContainer)` track and `sbxSources` the `(sbx)` track, so a\n * row's \"derived\" answer is always relative to the track that asked.\n *\n * The page lists the presets a person can derive from, which is the roster\n * MINUS every variant this Bundle already registered: offering\n * `standard-devcontainer` as a source would derive `standard-devcontainer-devcontainer`.\n */\nimport type { AgentPresetRow, AgentPresetRoster } from '@deepseek-ai/dsh-agent-preset-registry/types'\nimport { isAnyVariantId, variantIdOf, type VariantKind } from '../ids.ts'\n\n/**\n * The two stored source lists, one per derivative track.\n *\n * These are field names of the `devcontainer` settings namespace, and the Host\n * row reads exactly the same pair.\n */\nexport const SOURCE_FIELDS = {\n devcontainer: 'sources',\n sbx: 'sbxSources',\n} as const satisfies Record<VariantKind, string>\n\n/** One selectable source row. */\nexport interface SelectablePreset {\n /** Stable preset id: what the checkbox writes. */\n readonly id: string\n /** The preset's published name, or the id when it published none. */\n readonly name: string\n /** The preset's own one-line description, when it published one. */\n readonly description: string\n /** Whether THIS track's variant is registered right now. */\n readonly derived: boolean\n /**\n * The registry's diagnostic for this track's variant, when it registered but\n * could not mount. A variant the picker hides must never read as \"available\".\n */\n readonly variantBroken?: string\n /** Whether this track's stored list asks for its variant. */\n readonly checked: boolean\n /** The registry's activation diagnostic, when this preset could not be mounted. */\n readonly broken?: string\n}\n\n/**\n * The stored ids of one track.\n * @param section - the namespace value as the Host published it, possibly before the first read.\n * @param field - the settings field holding that track's list.\n * @returns every non-empty string id it lists, in written order.\n */\nfunction idsOf(section: unknown, field: string): string[] {\n if (typeof section !== 'object' || section === null) return []\n const raw: unknown = Reflect.get(section, field)\n if (!Array.isArray(raw)) return []\n return raw.filter((id): id is string => typeof id === 'string' && id.length > 0)\n}\n\n/**\n * The stored `(devContainer)` source list of one form value.\n * @param section - the namespace value as the Host published it, possibly before the first read.\n * @returns every non-empty string id it lists, in written order.\n */\nexport function sourcesOf(section: unknown): string[] {\n return idsOf(section, SOURCE_FIELDS.devcontainer)\n}\n\n/**\n * The stored `(sbx)` source list of one form value.\n * @param section - the namespace value as the Host published it, possibly before the first read.\n * @returns every non-empty string id it lists, in written order.\n */\nexport function sbxSourcesOf(section: unknown): string[] {\n return idsOf(section, SOURCE_FIELDS.sbx)\n}\n\n/**\n * The variant ids the roster currently carries.\n * @param roster - the roster the Host answered with.\n * @returns the derived preset ids it contains.\n */\nfunction rowsOf(roster: unknown): readonly AgentPresetRow[] {\n if (roster === null || typeof roster !== 'object') return []\n const presets: unknown = (roster as { presets?: unknown }).presets\n return Array.isArray(presets) ? presets as readonly AgentPresetRow[] : []\n}\n\n/**\n * The rows one track offers.\n *\n * Source presets keep the Host's roster order; a variant of either track never\n * appears as a source. `checked` follows the STORED list rather than the roster,\n * because a registration that failed still needs a row a person can uncheck.\n * @param roster - the full roster from the Host.\n * @param sources - the stored list of source ids on this track.\n * @param kind - the derivative track whose variants the rows report.\n * @returns one row per selectable preset.\n */\nexport function selectablePresets(\n roster: AgentPresetRoster,\n sources: readonly string[],\n kind: VariantKind = 'devcontainer',\n): SelectablePreset[] {\n const wanted = new Set(sources)\n const rows = rowsOf(roster)\n const byId = new Map(rows.map(preset => [preset.id, preset]))\n return rows\n .filter(preset => !isAnyVariantId(preset.id))\n .map((preset) => {\n const variant = byId.get(variantIdOf(preset.id, kind))\n return {\n id: preset.id,\n name: preset.name ?? preset.id,\n description: preset.description ?? '',\n derived: variant !== undefined,\n checked: wanted.has(preset.id),\n ...preset.broken === undefined ? {} : { broken: preset.broken },\n ...variant?.broken === undefined ? {} : { variantBroken: variant.broken },\n }\n })\n}\n\n/**\n * Whether one row may be checked: a preset the registry could not mount derives\n * a variant that cannot mount either, so offering it would only strand the page.\n * @param row - the row to test.\n * @returns false when the row is broken and not already stored.\n */\nexport function selectable(row: SelectablePreset): boolean {\n return row.broken === undefined || row.checked\n}\n\n/**\n * The stored list one checkbox produces.\n * @param sources - the ids currently stored, in written order.\n * @param id - the preset the row owns.\n * @param checked - whether that preset's variant is now wanted.\n * @returns the next stored order: existing ids keep their place, an added id goes last.\n */\nexport function nextSources(sources: readonly string[], id: string, checked: boolean): string[] {\n if (!checked) return sources.filter(held => held !== id)\n return sources.includes(id) ? [...sources] : [...sources, id]\n}\n","/**\n * Staged state for the Dev Container variants page.\n *\n * Reads the roster through `ctx.remote.agentPresets.list` — the same listing\n * every picker reads — and writes BOTH stored source lists (`sources` for the\n * `(devContainer)` track, `sbxSources` for the `(sbx)` track) through the shared\n * `ConfigForm` of the `devcontainer` settings namespace. A write lands in the\n * profile patch and in the Host's live reference, and the Host re-derives the\n * variant set while the same event is still settling, so checking a box is felt\n * before the next render.\n *\n * Toggles are queued rather than dropped: each write carries the WHOLE pair of\n * lists, and a person clearing two rows in a row must not lose the second click.\n */\nimport { createSnapshotStore, type SnapshotStore } from '@deepseek-ai/dsh-client-store'\nimport type { AgentPresetRoster } from '@deepseek-ai/dsh-agent-preset-registry/types'\nimport type { ConfigForm } from '@deepseek-ai/dsh-client-ui-settings/client'\nimport type { SettingsPathOpView } from '@deepseek-ai/dsh-api-remotes/client'\nimport { SANDBOX_TEMPLATE_PATTERN } from '../sbx-template.ts'\nimport {\n nextSources, selectable, selectablePresets, SOURCE_FIELDS, sbxSourcesOf, sourcesOf, type SelectablePreset,\n} from './variants.ts'\n\n/** The settings namespace this page edits: also the Host Loader row id. */\nexport const DEVCONTAINER_NS = 'devcontainer'\n\n/** The namespace section as the Host publishes it. */\nexport interface DevcontainerVariantsSettings {\n /** Source preset ids whose `(devContainer)` variants are wanted; absent before the first Host read. */\n sources?: readonly string[]\n /** Source preset ids whose `(sbx)` variants are wanted; absent before the first Host read. */\n sbxSources?: readonly string[]\n /** Image a created Docker Sandbox runs (`sbx create --template`); empty keeps the CLI template. */\n sbxTemplate?: string\n}\n\n/** The stored field the page's text input writes: the Host row's own image setting. */\nconst IMAGE_FIELD = 'sbxTemplate'\n\n/**\n * The image one stored namespace section carries.\n * @param section - the namespace's stored value.\n * @returns the image, or an empty string when none is stored.\n */\nfunction imageOf(section: unknown): string {\n if (typeof section !== 'object' || section === null) return ''\n const value: unknown = Reflect.get(section, IMAGE_FIELD)\n return typeof value === 'string' ? value : ''\n}\n\n/** One row as the page renders it. */\nexport type VariantRow = SelectablePreset\n\n/** What a failed read or write means for the page's own copy. */\nexport type VariantsFailure = 'load' | 'write' | 'template'\n\n/** Page snapshot the renderer subscribes to. */\nexport interface VariantsState {\n /** `loading` until the roster arrives, `unavailable` when the Host serves no such namespace. */\n readonly status: 'loading' | 'ready' | 'error' | 'unavailable'\n /** The failure the page must explain, if any. */\n readonly failure: VariantsFailure | null\n /** Whether the Host accepts writes to this namespace. */\n readonly writable: boolean\n /** Whether a toggle is crossing the wire or still queued. */\n readonly saving: boolean\n /** Every selectable source preset, in Host roster order, with its `(devContainer)` state. */\n readonly rows: readonly VariantRow[]\n /** The same presets, with their `(sbx)` state. */\n readonly sbxRows: readonly VariantRow[]\n /** How many rows have a `(devContainer)` variant derived right now. */\n readonly checkedCount: number\n /** How many rows have an `(sbx)` variant derived right now. */\n readonly sbxCheckedCount: number\n /** The image a created sandbox runs, as stored or as staged for the next write. */\n readonly sbxTemplate: string\n}\n\n/** Business face the page receives (the framework binds `hooks` to a selector hook). */\nexport interface VariantsFace {\n hooks: { devcontainerVariants: SnapshotStore<VariantsState> }\n /** Read the roster from the Host. */\n load: () => Promise<void>\n /** Derive or drop one preset's `(devContainer)` variant; queues behind a write already in flight. */\n setChecked: (id: string, checked: boolean) => void\n /** Flip one preset's `(sbx)` variant; queues behind a write already in flight. */\n toggleSbxSource: (sourceId: string) => void\n /** Store the image a created sandbox runs; refuses one that is not a single argv token. */\n setSbxTemplate: (value: string) => void\n}\n\n/** The pair of stored lists one write carries. */\ninterface SourcesIntent {\n readonly sources: string[]\n readonly sbxSources: string[]\n}\n\nconst INITIAL: VariantsState = {\n status: 'loading',\n failure: null,\n writable: false,\n saving: false,\n rows: [],\n sbxRows: [],\n checkedCount: 0,\n sbxCheckedCount: 0,\n sbxTemplate: '',\n}\n\n/**\n * Delays between roster re-reads after a write lands.\n *\n * A landed write reaches the Host before the variants it asks for are\n * registered: the settings event is emitted first, the sync then walks the\n * presets. One immediate re-read therefore sees the old roster, and without a\n * retry the page would show every freshly checked row as pending forever.\n */\nconst VERIFY_DELAYS: readonly number[] = [80, 150, 300, 600]\n\n/**\n * The rows of one roster answer.\n *\n * A listing that reports success without a body (a namespace whose method is not\n * what this build serves) must leave the page empty rather than throw inside the\n * plugin: this page is a preference, not a critical surface.\n * @param value - the roster the Remote answered with.\n * @returns its preset rows, or none when the answer carries no roster.\n */\nexport function rosterRows(value: unknown): AgentPresetRoster['presets'] {\n if (value === null || typeof value !== 'object') return []\n const presets: unknown = (value as { presets?: unknown }).presets\n return Array.isArray(presets) ? presets as AgentPresetRoster['presets'] : []\n}\n\n/** Resolve after one delay, so a test can drive the clock. */\nfunction wait(ms: number): Promise<void> {\n return new Promise((resolve) => { setTimeout(resolve, ms) })\n}\n\n/**\n * One roster read.\n *\n * Structural rather than `RemoteResult` so a build that serves no such namespace\n * can answer \"not readable\" without fabricating a carrier error: success carries\n * the roster, anything else is a failed read.\n */\nexport type RosterListing = () => Promise<{ readonly ok: boolean, readonly value?: unknown }>\n\n/** Reads the roster and writes the two source lists for one page instance. */\nexport class VariantsController {\n private declared: AgentPresetRoster['presets'] = []\n private failure: VariantsFailure | null = null\n private loading = true\n /** The lists the queue will send next; undefined when every toggle has landed. */\n private intent: SourcesIntent | undefined\n /** The image the queue will send next; undefined when every image save has landed. */\n private image: string | undefined\n private writing = false\n /** Invalidates every read that a newer load, or a dispose, supersedes. */\n private generation = 0\n private disposed = false\n private readonly store: SnapshotStore<VariantsState> = createSnapshotStore(INITIAL)\n private readonly unsubscribe: () => void\n\n /**\n * @param form - the shared form of the `devcontainer` settings namespace.\n * @param listing - the roster listing the pickers read.\n */\n constructor(\n private readonly form: ConfigForm<DevcontainerVariantsSettings>,\n private readonly listing: RosterListing,\n ) {\n // Another editor of the same namespace (a second tab, an SSH session) moves\n // the stored lists under this page, so the rows follow the form, not a copy.\n this.unsubscribe = form.subscribe(() => { this.publish() })\n }\n\n dispose(): void {\n this.disposed = true\n this.generation += 1\n this.unsubscribe()\n }\n\n inject(): VariantsFace {\n return {\n hooks: { devcontainerVariants: this.store },\n load: () => this.load(),\n setChecked: (id, checked) => { this.setChecked(id, checked) },\n toggleSbxSource: (sourceId) => { this.toggleSbxSource(sourceId) },\n setSbxTemplate: (value) => { this.setSbxTemplate(value) },\n }\n }\n\n /** Read the roster the pickers read. */\n async load(): Promise<void> {\n await this.refresh(false)\n void this.settle()\n }\n\n /**\n * Re-read the roster without flipping the page back to `loading`.\n * @param quiet - true when a previous render must stay on screen while it refreshes.\n */\n private async refresh(quiet: boolean): Promise<void> {\n if (this.disposed) return\n const generation = ++this.generation\n if (!quiet) {\n this.loading = true\n this.publish()\n }\n const result = await this.listing()\n if (generation !== this.generation) return\n this.loading = false\n if (result.ok) {\n this.declared = rosterRows(result.value)\n this.failure = null\n } else {\n this.declared = []\n this.failure = 'load'\n }\n this.publish()\n }\n\n /**\n * Re-read the roster a few times while a write's registrations settle.\n *\n * The first re-read after a landed write races the Host's own sync, so the\n * variants it asks for may still be missing. Retrying with backoff turns the\n * \"waiting to be registered\" badge into the real state within a second, and\n * stops as soon as nothing is outstanding.\n */\n private async settle(): Promise<void> {\n for (const delay of VERIFY_DELAYS) {\n if (!this.polling()) return\n await wait(delay)\n if (!this.polling()) return\n await this.refresh(true)\n }\n }\n\n /** Whether another retry is still both wanted and possible. */\n private polling(): boolean {\n return !this.disposed && this.outstanding()\n }\n\n /** Whether a stored row of either track is still waiting for its variant to register. */\n private outstanding(): boolean {\n const stored = this.effective(this.form.getSnapshot().value)\n const roster = { presets: this.declared }\n return selectablePresets(roster, stored.sources, 'devcontainer').some(pending)\n || selectablePresets(roster, stored.sbxSources, 'sbx').some(pending)\n }\n\n /** Derive or drop one preset's `(devContainer)` variant, without losing a toggle that arrives mid-write. */\n setChecked(id: string, checked: boolean): void {\n const stored = this.stage()\n if (stored === undefined) return\n this.commit({ ...stored, sources: nextSources(stored.sources, id, checked) })\n }\n\n /**\n * Flip one preset's `(sbx)` variant.\n *\n * A toggle rather than a target state because the checkbox renders the\n * effective list: whatever the person saw checked is what flips, including a\n * toggle that is still queued behind a write in flight.\n * @param sourceId - the source preset whose `(sbx)` variant flips.\n */\n toggleSbxSource(sourceId: string): void {\n const stored = this.stage()\n if (stored === undefined) return\n const checked = !stored.sbxSources.includes(sourceId)\n this.commit({ ...stored, sbxSources: nextSources(stored.sbxSources, sourceId, checked) })\n }\n\n /**\n * Store the image a created sandbox runs.\n *\n * The value is validated here instead of being written and refused by the Host:\n * an image that is not one argv token would otherwise reach the row's schema as\n * a rejected write with no way to say which field was at fault.\n * @param value - the text the person typed.\n */\n setSbxTemplate(value: string): void {\n if (this.disposed) return\n const image = value.trim()\n if (!SANDBOX_TEMPLATE_PATTERN.test(image)) {\n this.failure = 'template'\n this.publish()\n return\n }\n if (!this.form.getSnapshot().writable) return\n this.failure = null\n this.image = image\n this.publish()\n void this.flush()\n }\n\n /**\n * The lists a toggle starts from, or undefined when this page must ignore it.\n * @returns the queued lists when a write is still pending, otherwise the stored ones.\n */\n private stage(): SourcesIntent | undefined {\n if (this.disposed) return undefined\n const snapshot = this.form.getSnapshot()\n if (!snapshot.writable) return undefined\n return this.effective(snapshot.value)\n }\n\n /** Queue one toggle and start the write that carries it. */\n private commit(next: SourcesIntent): void {\n this.intent = next\n this.publish()\n void this.flush()\n }\n\n /**\n * The lists to render: the queued ones while a write is in flight, otherwise\n * the ones the Host stored.\n */\n private effective(section: unknown): SourcesIntent {\n if (this.intent !== undefined) return this.intent\n return { sources: sourcesOf(section), sbxSources: sbxSourcesOf(section) }\n }\n\n /**\n * Send the queued lists until nothing is queued.\n *\n * Both fields travel in ONE mutation, so a single revision fence accepts or\n * refuses the pair together: a deployment can never store one track's toggle\n * and drop the other's.\n *\n * A refusal drops the queue: those intents were derived from lists the Host\n * never stored, so replaying them would toggle a different set than the one the\n * person was looking at. After a landed write the roster is re-read, because\n * the Host may have just registered or disposed a variant.\n */\n private async flush(): Promise<void> {\n if (this.writing) return\n this.writing = true\n this.publish()\n let landed = false\n try {\n while (true) {\n const lists = this.intent\n const image = this.image\n // One field per mutation: the lists travel together because one track's\n // toggle must never drop the other's, while the image is a field of its\n // own and rewriting it from a list save would restate a value the person\n // did not touch.\n let accepted: boolean\n if (lists !== undefined) accepted = await this.form.mutate(opsFor(lists))\n else if (image !== undefined) accepted = await this.form.set(IMAGE_FIELD, image)\n else break\n this.failure = accepted ? null : 'write'\n if (!accepted) break\n landed = true\n if (lists !== undefined) {\n if (this.intent === lists) this.intent = undefined\n } else if (this.image === image) {\n this.image = undefined\n }\n this.publish()\n }\n } catch {\n this.failure = 'write'\n } finally {\n this.intent = undefined\n this.image = undefined\n this.writing = false\n this.publish()\n }\n if (landed && !this.disposed) {\n await this.refresh(true)\n await this.settle()\n }\n }\n\n private publish(): void {\n if (this.disposed) return\n const snapshot = this.form.getSnapshot()\n const stored = this.effective(snapshot.value)\n const roster = { presets: this.declared }\n const rows = selectablePresets(roster, stored.sources, 'devcontainer')\n const sbxRows = selectablePresets(roster, stored.sbxSources, 'sbx')\n this.store.set({\n status: snapshot.status === 'unavailable'\n ? 'unavailable'\n : this.failure === 'load' ? 'error'\n : this.loading || snapshot.status === 'loading' ? 'loading' : 'ready',\n failure: this.failure,\n writable: snapshot.writable,\n saving: this.writing || this.intent !== undefined || this.image !== undefined,\n rows,\n sbxRows,\n checkedCount: rows.filter(row => row.checked).length,\n sbxCheckedCount: sbxRows.filter(row => row.checked).length,\n sbxTemplate: this.image ?? imageOf(snapshot.value),\n })\n }\n}\n\n/** Whether one row is stored but its variant is not registered yet. */\nfunction pending(row: SelectablePreset): boolean {\n return row.checked && !row.derived && selectable(row)\n}\n\n/**\n * One mutation carrying both stored lists.\n * @param intent - the lists to store.\n * @returns the settings operations, in track order.\n */\nfunction opsFor(intent: SourcesIntent): SettingsPathOpView[] {\n return [\n { op: 'set', path: [SOURCE_FIELDS.devcontainer], value: intent.sources },\n { op: 'set', path: [SOURCE_FIELDS.sbx], value: intent.sbxSources },\n ]\n}\n","/**\n * The Dev Container variants page: two independent tracks, one checkbox per\n * source preset on each.\n *\n * A checkbox, not a dropdown, because each track is a SET rather than one\n * choice, and `Checkbox` is the primitive the shipped settings rows already use\n * for the same shape. Checked means \"derive my copy on this track\".\n *\n * The row's tail carries the truth from the Host: a checked box whose variant is\n * not in the roster yet says so (`pendingBadge`), and a preset the registry could\n * not mount says so too (`brokenBadge`) — its variant could not mount either, so\n * it is offered read-only rather than stranding the person with a pending row.\n */\nimport { useEffect, useState, type ReactNode } from 'react'\nimport { Button, Checkbox, Input, Tag } from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport { variantNameSuffixOf, type VariantKind } from '../ids.ts'\nimport type { VariantRow, VariantsFace, VariantsState } from './controller.ts'\nimport { selectable } from './variants.ts'\nimport type { DevcontainerVariantsKey } from './locales.ts'\n\nexport type DevcontainerVariantsSectionProps =\n PropsRuntime<'settings.section'>\n & PropsLocale<'devcontainer'>\n & InjectFace<VariantsFace>\n\n/** The translating seat the section and its track groups receive. */\ntype Translate = DevcontainerVariantsSectionProps['t']\n\n/** The dictionary keys one track reads for its own copy. */\ninterface TrackCopy {\n readonly title: DevcontainerVariantsKey\n readonly description: DevcontainerVariantsKey\n readonly empty: DevcontainerVariantsKey\n readonly none: DevcontainerVariantsKey\n readonly count: DevcontainerVariantsKey\n}\n\n/** Copy per track: the two groups differ only in their words and their suffix. */\nconst COPY: Record<VariantKind, TrackCopy> = {\n devcontainer: {\n title: 'devcontainerTitle',\n description: 'devcontainerDescription',\n empty: 'empty',\n none: 'noneChecked',\n count: 'checkedCount',\n },\n sbx: {\n title: 'sbxTitle',\n description: 'sbxDescription',\n empty: 'sbxEmpty',\n none: 'sbxNoneChecked',\n count: 'sbxCheckedCount',\n },\n}\n\n/** One track's rendered rows and the toggle they call. */\ninterface TrackInput {\n readonly kind: VariantKind\n readonly rows: VariantsState['rows']\n readonly checkedCount: number\n readonly disabled: boolean\n readonly onToggle: (id: string, checked: boolean) => void\n}\n\n/**\n * Render the selectable presets on both tracks, each with one derivation toggle\n * per row.\n * @param props - settings actions, the page snapshot hook, and localized copy.\n * @returns The Dev Container variants settings section.\n */\nexport function DevcontainerVariantsSection(props: DevcontainerVariantsSectionProps): ReactNode {\n const { t, load } = props\n const state = props.useDevcontainerVariants(snapshot => snapshot)\n useEffect(() => { void load() }, [load])\n // A write in flight does not lock the rows: the controller queues a toggle that\n // lands mid-write, so a person checking several rows keeps every click.\n const disabled = !state.writable\n return (\n <section className=\"dcv-section\">\n <h2 className=\"dcv-title\">{t('nav')}</h2>\n <p className=\"dcv-intro\">{t('intro')}</p>\n {state.failure === 'load'\n ? (\n <p className=\"dcv-notice\" data-failed=\"true\" role=\"alert\">\n {t('failed')}{' '}\n <Button variant=\"ghost\" disabled={disabled} onClick={() => { void load() }}>{t('retry')}</Button>\n </p>\n )\n : null}\n {state.failure === 'write'\n ? <p className=\"dcv-notice\" data-failed=\"true\" role=\"alert\">{t('writeFailed')}</p>\n : null}\n {state.status === 'unavailable' ? <p className=\"dcv-notice\">{t('unavailable')}</p> : null}\n {state.status === 'loading' ? <p className=\"dcv-notice\" role=\"status\">{t('loading')}</p> : null}\n {state.status === 'ready' && !state.writable ? <p className=\"dcv-notice\">{t('readOnly')}</p> : null}\n {state.status === 'ready'\n ? (\n <>\n {renderTrack(t, {\n kind: 'devcontainer',\n rows: state.rows,\n checkedCount: state.checkedCount,\n disabled,\n onToggle: (id, checked) => { props.setChecked(id, checked) },\n })}\n {renderTrack(t, {\n kind: 'sbx',\n rows: state.sbxRows,\n checkedCount: state.sbxCheckedCount,\n disabled,\n // The sbx box renders the effective list, so flipping it is the\n // whole intent: the controller derives the target state itself.\n onToggle: (id) => { props.toggleSbxSource(id) },\n })}\n <SandboxImageField\n t={t}\n value={state.sbxTemplate}\n invalid={state.failure === 'template'}\n disabled={disabled}\n onSave={props.setSbxTemplate}\n />\n <p className=\"dcv-notice\">{t('refreshHint')}</p>\n </>\n )\n : null}\n </section>\n )\n}\n\n/**\n * The image a created Docker Sandbox runs (`sbxTemplate`), as one text field.\n *\n * The box holds a local draft and writes on blur or Enter, so an unfinished value —\n * a leading `-`, a half-typed registry — is never sent; the value it shows reverts to\n * the stored one whenever no draft is in progress, which keeps a write from another\n * editor visible without an effect mirroring state.\n */\nfunction SandboxImageField(props: {\n readonly t: Translate\n readonly value: string\n readonly invalid: boolean\n readonly disabled: boolean\n readonly onSave: (next: string) => void\n}): ReactNode {\n const { t, value, invalid, disabled, onSave } = props\n const [draft, setDraft] = useState<string | null>(null)\n const commit = (): void => {\n if (draft === null) return\n onSave(draft)\n setDraft(null)\n }\n return (\n <div className=\"dcv-group\" data-image=\"true\">\n <label className=\"dcv-group-title\" htmlFor=\"dcv-sbx-template\">{t('imageTitle')}</label>\n <Input\n id=\"dcv-sbx-template\"\n className=\"dcv-image-input\"\n value={draft ?? value}\n disabled={disabled}\n placeholder={t('imagePlaceholder')}\n spellCheck={false}\n autoComplete=\"off\"\n onChange={(event) => { setDraft(event.target.value) }}\n onBlur={commit}\n onKeyDown={(event) => {\n if (event.key !== 'Enter') return\n event.preventDefault()\n commit()\n }}\n />\n <p className=\"dcv-group-description\">{t('imageDescription')}</p>\n {invalid\n ? <p className=\"dcv-notice\" data-failed=\"true\" role=\"alert\">{t('imageInvalid')}</p>\n : null}\n </div>\n )\n}\n\n/**\n * One track's card: its heading with the preset-name suffix, what the track is,\n * how much of it is derived, and the rows themselves.\n * @param t - the localized copy seat.\n * @param input - the track, its rows, and its toggle.\n * @returns The rendered group.\n */\nfunction renderTrack(t: Translate, input: TrackInput): ReactNode {\n const copy = COPY[input.kind]\n return (\n <div className=\"dcv-group\" data-track={input.kind}>\n <h3 className=\"dcv-group-title\">\n {t(copy.title)}\n <code className=\"dcv-suffix\">{variantNameSuffixOf(input.kind).trim()}</code>\n </h3>\n <p className=\"dcv-group-description\">{t(copy.description)}</p>\n <p className=\"dcv-count\">\n {input.rows.length === 0\n ? t(copy.empty)\n : input.checkedCount === 0 ? t(copy.none) : t(copy.count, { count: input.checkedCount })}\n </p>\n {input.rows.length === 0 ? null : (\n <ul className=\"dcv-rows\">\n {input.rows.map(row => renderRow(t, input.kind, row, input.disabled, input.onToggle))}\n </ul>\n )}\n </div>\n )\n}\n\n/**\n * One preset row: the checkbox, the preset's own description, and the Host's\n * verdict on this track's variant.\n * @param t - the localized copy seat.\n * @param kind - the derivative track this row belongs to.\n * @param row - the row to render.\n * @param disabled - whether the deployment refuses writes.\n * @param onToggle - the toggle for this row.\n * @returns The rendered row.\n */\nfunction renderRow(\n t: Translate,\n kind: VariantKind,\n row: VariantRow,\n disabled: boolean,\n onToggle: (id: string, checked: boolean) => void,\n): ReactNode {\n const broken = row.broken !== undefined\n return (\n <li\n key={row.id}\n className=\"dcv-row\"\n data-checked={row.checked ? 'true' : undefined}\n data-broken={broken ? 'true' : undefined}\n >\n <span className=\"dcv-main\">\n <Checkbox\n checked={row.checked}\n disabled={disabled || !selectable(row)}\n label={row.name}\n title={broken\n ? `${t('brokenBadge')}: ${row.broken ?? ''}`\n : row.variantBroken === undefined\n ? t(row.checked ? 'checked' : 'unchecked')\n : `${t('variantBrokenBadge')}: ${row.variantBroken}`}\n onChange={(next) => { onToggle(row.id, next) }}\n />\n {row.description === '' ? null : (\n // Both tracks list the same preset ids, so the anchor carries the track.\n <span className=\"dcv-description\" id={`dcv-description-${kind}-${row.id}`}>{row.description}</span>\n )}\n </span>\n <span className=\"dcv-tail\">\n {row.name === row.id ? null : <code className=\"dcv-id\">{row.id}</code>}\n {broken ? <Tag tone=\"danger\">{t('brokenBadge')}</Tag> : null}\n {row.checked\n ? row.variantBroken === undefined\n ? <Tag tone={row.derived ? 'success' : 'warning'}>{t(row.derived ? 'derivedBadge' : 'pendingBadge')}</Tag>\n : <Tag tone=\"danger\">{t('variantBrokenBadge')}</Tag>\n : null}\n <span className=\"dcv-state\" data-checked={row.checked ? 'true' : undefined}>\n {t(row.checked ? 'checked' : 'unchecked')}\n </span>\n </span>\n </li>\n )\n}\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n devcontainer: DevcontainerVariantsKey\n }\n}\n","/** Locale bundles for the Dev Container variants page (namespace `devcontainer`). */\n\nexport type DevcontainerVariantsKey =\n | 'nav' | 'intro'\n | 'devcontainerTitle' | 'devcontainerDescription' | 'sbxTitle' | 'sbxDescription'\n | 'checked' | 'unchecked' | 'derivedBadge' | 'pendingBadge' | 'brokenBadge' | 'variantBrokenBadge'\n | 'noneChecked' | 'checkedCount' | 'sbxNoneChecked' | 'sbxCheckedCount'\n | 'loading' | 'failed' | 'retry' | 'unavailable' | 'readOnly'\n | 'writeFailed' | 'refreshHint' | 'empty' | 'sbxEmpty'\n | 'imageTitle' | 'imageDescription' | 'imagePlaceholder' | 'imageInvalid'\n\nexport const en: Record<DevcontainerVariantsKey, string> = {\n nav: 'Dev Container presets',\n intro: 'Check a preset to derive copies of it. A “(devContainer)” copy sends every command into the repository\\'s Linux Dev Container; an “(sbx)” copy runs in a Docker Sandbox. The two tracks are independent, nothing is derived until you check something, and a copy disappears again as soon as you clear its box.',\n devcontainerTitle: 'Dev Container runtime',\n devcontainerDescription: 'The regular container environment built from the repository\\'s .devcontainer declaration: every command runs inside the Linux container the Dev Container CLI builds and starts.',\n sbxTitle: 'Docker Sandbox runtime',\n sbxDescription: 'Hardware-isolated execution in a Docker Sandbox (MicroVM): each session gets its own micro VM with Docker ready to build out of the box, and no repository declaration is needed.',\n checked: 'derived',\n unchecked: 'not derived',\n derivedBadge: 'Available',\n pendingBadge: 'Wait for it',\n brokenBadge: 'Cannot load',\n variantBrokenBadge: 'Variant cannot mount',\n noneChecked: 'No preset is derived.',\n checkedCount: '{count} derived',\n sbxNoneChecked: 'No Docker Sandbox copy is derived.',\n sbxCheckedCount: '{count} derived as (sbx)',\n loading: 'Loading presets…',\n failed: 'Presets could not be loaded.',\n retry: 'Retry',\n unavailable: 'This plugin is not loaded, so there is nothing to configure.',\n readOnly: 'This deployment stores settings read-only.',\n writeFailed: 'The deployment did not accept this change.',\n refreshHint: 'Preset pickers re-read the roster the next time one opens.',\n empty: 'This deployment declares no preset to derive from.',\n sbxEmpty: 'This deployment declares no preset to derive a Docker Sandbox copy from.',\n imageTitle: 'Sandbox template image',\n imageDescription: 'Leave it empty to use the shell template\\'s own image. It reaches sbx create --template only when a Docker Sandbox is created, so an existing sandbox of the same name is reused rather than rebuilt. The image must provide /bin/sh, cat, mkdir, and Node.js 18 or newer.',\n imagePlaceholder: 'docker.io/org/img:tag',\n imageInvalid: 'Only one image name is accepted: no whitespace, and no leading “-”.',\n}\n\nexport const zh: Record<DevcontainerVariantsKey, string> = {\n nav: 'Dev Container 预设',\n intro: '勾选一个预设即可派生它的副本:「(devContainer)」副本把每条命令送进仓库指定的 Linux Dev Container,「(sbx)」副本在 Docker Sandbox 中执行。两组互相独立,默认都不派生;取消勾选后副本立即注销。',\n devcontainerTitle: 'Dev Container 运行环境',\n devcontainerDescription: '基于仓库 .devcontainer 声明的常规容器运行环境:命令在 Dev Container CLI 构建并启动的 Linux 容器里执行。',\n sbxTitle: 'Docker Sandbox 运行环境',\n sbxDescription: '基于 Docker Sandbox (MicroVM) 的硬件级隔离执行环境:每个会话独占一台微虚拟机,开箱即用支持 Docker 构建,不依赖仓库声明。',\n checked: '已派生',\n unchecked: '未派生',\n derivedBadge: '已可用',\n pendingBadge: '等待注册',\n brokenBadge: '无法加载',\n variantBrokenBadge: '派生副本不可用',\n noneChecked: '当前没有派生任何预设。',\n checkedCount: '已派生 {count} 项',\n sbxNoneChecked: '当前没有派生任何 Docker Sandbox 副本。',\n sbxCheckedCount: '已派生 {count} 项 (sbx)',\n loading: '正在加载预设…',\n failed: '无法加载预设。',\n retry: '重试',\n unavailable: '该插件当前未加载,无需配置。',\n readOnly: '本部署的设置为只读。',\n writeFailed: '本部署没有接受这次修改。',\n refreshHint: '预设选择器下次打开时会重新读取清单。',\n empty: '本部署没有可派生的预设。',\n sbxEmpty: '本部署没有可派生 Docker Sandbox 副本的预设。',\n imageTitle: '沙盒模板镜像',\n imageDescription: '留空则使用 shell 的默认镜像。仅在新建沙盒时传给 sbx create --template,已存在的同名沙盒不会重建。镜像需提供 /bin/sh、cat、mkdir 和 node 18 或更高版本。',\n imagePlaceholder: 'docker.io/org/img:tag',\n imageInvalid: '只接受单个镜像名:不能含空白,也不能以「-」开头。',\n}\n","/**\n * Browser half: the Dev Container variants page.\n *\n * The page is a `settings.section` of its own rather than a `plugins.row.config`\n * card: this preference decides which `(devContainer)` presets exist, not how\n * this Loader row is configured, and it has to stay reachable while the row is\n * what is being configured.\n *\n * Writes go through `configForms`, so the stored list lands in the profile patch\n * and in the Host's live reference in one step; the Host row follows the same\n * namespace and re-derives its variant set on the resulting\n * `settings/document-updated` event.\n */\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\n// Type-only: the ctx.remote merge and the agentPresets namespace it carries.\nimport type {} from '@deepseek-ai/dsh-api-remotes/client'\n// Type-only: the ctx.configForms merge, the ConfigForm type, and the\n// `settings.section` SlotMap entry.\nimport type {} from '@deepseek-ai/dsh-client-ui-settings/client'\nimport { DEVCONTAINER_NS, VariantsController, type DevcontainerVariantsSettings } from './controller.ts'\nimport { DevcontainerVariantsSection } from './VariantsSection.tsx'\nimport { en, zh } from './locales.ts'\n// Text, not a stylesheet link: the ModuleLoader fetches one artifact, so the\n// sheet is inlined at build time. See `tsdown.config.ts`.\nimport styles from './styles.css?inline'\n\nexport type {\n DevcontainerVariantsSettings, VariantRow, VariantsFace, VariantsFailure, VariantsState,\n} from './controller.ts'\nexport type { DevcontainerVariantsKey } from './locales.ts'\nexport type { SelectablePreset } from './variants.ts'\n\n/** Plugin id, stamped onto the injected stylesheet for teardown bookkeeping. */\nconst PLUGIN_ID = '@banzhe/dsh-devcontainer'\n\nconst NS = DEVCONTAINER_NS\n\nexport const inject = ['configForms', 'locale', 'remote', 'remote.agentPresets', 'slots']\n\n// Type-only: the roster read this page performs.\nimport type { RosterListing } from './controller.ts'\n\nexport function apply(ctx: ClientContext): void {\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'devcontainer: dictionaries')\n // The page's stylesheet rides the plugin's own fiber: unload removes it. It\n // carries the shell's `--dsw-*` token values, which only resolve inside a\n // themed document, so it is a `<style>` tag installed here — not inline\n // declarations on the elements, which beat every stylesheet in the cascade.\n ctx.effect(() => {\n if (typeof document === 'undefined') return () => {}\n const tag = document.createElement('style')\n tag.dataset.plugin = PLUGIN_ID\n tag.dataset.pluginCss = `${PLUGIN_ID}/styles.css`\n tag.textContent = styles\n document.head.appendChild(tag)\n return () => { tag.remove() }\n }, 'devcontainer: stylesheet')\n\n const form = ctx.configForms.get<DevcontainerVariantsSettings>(NS)\n ctx.effect(() => ctx.configForms.whileServed([NS], () => ctx.slots.inject('settings.section', () => {\n // The shared form is owned by configForms: repeated `get` returns the same\n // controller, so this page and any other editor of the entry share one write\n // queue and one revision fence.\n const controller = new VariantsController(form, async () => {\n // A build that serves no `agentPresets` namespace reports the page as\n // unreadable instead of throwing during plugin activation.\n const namespace = ctx.remote.agentPresets as { list?: RosterListing }\n if (typeof namespace.list !== 'function') return { ok: false }\n return namespace.list()\n })\n const offSlot = ctx.slots.register({\n name: 'settings.section',\n id: NS,\n // After the visibility page (order 30): this one decides what exists at all.\n order: 31,\n label: () => ctx.locale.bind(NS)('nav'),\n locale: NS,\n inject: () => controller.inject(),\n }, DevcontainerVariantsSection)\n // Reverse order: drop the registration before releasing what renders it.\n return [offSlot, () => { controller.dispose() }]\n })), 'devcontainer: variants page')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBA,MAAa,2BAA2B;;;;;;;;;;;;;;;;;;ECJxC,MAAa,8BAA8B;;EAG3C,MAAa,qBAAqB;;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
import {
|
|
1
|
+
import { et as toPosixSlashes, r as resolveSbxTarget } from "./sbx-Blgjzzoe.js";
|
|
2
2
|
import { execFile } from "node:child_process";
|
|
3
3
|
import { SENSITIVE_ENV_PATTERN } from "@deepseek-ai/dsh-subprocess";
|
|
4
4
|
//#region src/container.ts
|
|
@@ -88,11 +88,12 @@ async function startContainer(spec, run, signal) {
|
|
|
88
88
|
* @param spec - the repository container specification.
|
|
89
89
|
* @param run - the CLI runner.
|
|
90
90
|
* @param signal - cancellation of the probe / start sequence.
|
|
91
|
+
* @param warn - reports a sandbox mount the row declares but the sandbox does not carry.
|
|
91
92
|
* @returns the docker target when a container id is known, else the CLI or sandbox target.
|
|
92
93
|
* @throws Error when `cli: 'docker'` was demanded and no container is running, or `sbx` cannot be prepared.
|
|
93
94
|
*/
|
|
94
|
-
async function resolveContainerTarget(spec, run, signal) {
|
|
95
|
-
if (spec.cli === "sbx") return await resolveSbxTarget(spec, run, signal);
|
|
95
|
+
async function resolveContainerTarget(spec, run, signal, warn) {
|
|
96
|
+
if (spec.cli === "sbx") return await resolveSbxTarget(spec, run, signal, warn);
|
|
96
97
|
if (spec.container !== void 0) return {
|
|
97
98
|
kind: "docker",
|
|
98
99
|
containerId: spec.container,
|
|
@@ -238,4 +239,4 @@ const runContainerCommand = (argv, options = {}) => {
|
|
|
238
239
|
//#endregion
|
|
239
240
|
export { runContainerCommand as n, resolveContainerTarget as r, containerCliEnv as t };
|
|
240
241
|
|
|
241
|
-
//# sourceMappingURL=exec-
|
|
242
|
+
//# sourceMappingURL=exec-Bcojrag9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec-Bcojrag9.js","names":[],"sources":["../src/container.ts","../src/exec.ts"],"sourcesContent":["/**\n * Finding or starting the repository's container.\n *\n * Three drivers, in the order `cli: 'auto'` tries them:\n *\n * 1. an explicit `container` / `containerName` from the configuration;\n * 2. a running container the Dev Container CLI labelled with\n * `devcontainer.local_folder=<host root>`, which needs no CLI of our own;\n * 3. `devcontainer up`, which builds and starts the container from the\n * configuration and reports the container id it produced.\n *\n * @module @banzhe/dsh-devcontainer/container\n */\n\nimport type { ContainerRun } from './exec.ts'\nimport { toPosixSlashes } from './paths.ts'\nimport { resolveSbxTarget } from './sbx.ts'\nimport type { SandboxWarning } from './sbx.ts'\nimport type { RepoContainerSpec } from './types.ts'\n\n/** Where agent commands run. */\nexport type ContainerTarget =\n | { readonly kind: 'docker'; readonly containerId: string; readonly workspaceFolder: string }\n | { readonly kind: 'devcontainer-cli'; readonly workspaceFolder: string }\n | { readonly kind: 'sbx'; readonly sandboxName: string; readonly workspaceFolder: string }\n\n/** Label the Dev Container CLI stamps on every container it creates. */\nexport const CONTAINER_FOLDER_LABEL = 'devcontainer.local_folder'\n\nconst PS_FORMAT = '{{.ID}}\\t{{.Label \"devcontainer.local_folder\"}}'\n\n/** Compare two host folders as one repository, folding separators and win32 case. */\nfunction sameFolder(left: string, right: string): boolean {\n return toPosixSlashes(left).replace(/\\/+$/, '').toLowerCase()\n === toPosixSlashes(right).replace(/\\/+$/, '').toLowerCase()\n}\n\n/**\n * Find the running container the Dev Container CLI started for this repository.\n * @param spec - the repository container specification.\n * @param run - the CLI runner.\n * @param signal - cancellation of the probe.\n * @returns the container id, or undefined when none is running (or Docker is absent).\n */\nexport async function findRunningContainer(\n spec: RepoContainerSpec,\n run: ContainerRun,\n signal?: AbortSignal,\n): Promise<string | undefined> {\n const result = await run(\n ['docker', 'ps', '--filter', `label=${CONTAINER_FOLDER_LABEL}`, '--format', PS_FORMAT],\n { ...signal === undefined ? {} : { signal }, timeoutMs: spec.containerTimeoutMs },\n )\n if (result.exitCode !== 0) return undefined\n for (const line of result.stdout.split('\\n')) {\n const [id, folder] = line.split('\\t')\n if (id === undefined || folder === undefined) continue\n if (id.trim() === '' || folder.trim() === '') continue\n if (sameFolder(folder.trim(), spec.hostWorkspaceRoot)) return id.trim()\n }\n return undefined\n}\n\n/**\n * Read the container id out of `devcontainer up` output (its last JSON line).\n * @param stdout - the CLI's standard output.\n * @returns the container id, or undefined when the output carries none.\n */\nexport function parseUpOutput(stdout: string): string | undefined {\n const lines = stdout.split('\\n').map(line => line.trim()).filter(line => line.startsWith('{'))\n for (const line of lines.reverse()) {\n try {\n const parsed: unknown = JSON.parse(line)\n if (typeof parsed === 'object' && parsed !== null) {\n const { containerId } = parsed as { containerId?: unknown }\n if (typeof containerId === 'string' && containerId !== '') return containerId\n }\n } catch {\n // A non-JSON line is progress output, not the result envelope.\n }\n }\n return undefined\n}\n\n/**\n * Build and start the repository's container through the Dev Container CLI.\n * @param spec - the repository container specification.\n * @param run - the CLI runner.\n * @param signal - cancellation of the CLI call.\n * @returns the produced container id when the CLI reported one.\n * @throws Error when the CLI failed and reported no container.\n */\nexport async function startContainer(\n spec: RepoContainerSpec,\n run: ContainerRun,\n signal?: AbortSignal,\n): Promise<{ containerId?: string; workspaceFolder: string }> {\n const result = await run(\n ['devcontainer', 'up', '--workspace-folder', spec.hostWorkspaceRoot],\n { ...signal === undefined ? {} : { signal }, timeoutMs: spec.containerTimeoutMs },\n )\n const containerId = parseUpOutput(result.stdout)\n if (result.exitCode !== 0 && containerId === undefined) {\n const detail = (result.stderr.trim() || result.stdout.trim() || 'no output').split('\\n').slice(-3).join(' ')\n throw new Error(`devcontainer: \"${spec.configPath}\": devcontainer up failed for ${spec.hostWorkspaceRoot}: ${detail}`)\n }\n return {\n ...containerId === undefined ? {} : { containerId },\n workspaceFolder: spec.hostWorkspaceRoot,\n }\n}\n\n/**\n * Resolve the container agent commands run in.\n *\n * `cli: 'sbx'` is not a container at all: a Docker Sandbox mounts the host\n * workspace at its own absolute path, so it is discovered and started by\n * {@link resolveSbxTarget} instead of by the Dev Container drivers below.\n * @param spec - the repository container specification.\n * @param run - the CLI runner.\n * @param signal - cancellation of the probe / start sequence.\n * @param warn - reports a sandbox mount the row declares but the sandbox does not carry.\n * @returns the docker target when a container id is known, else the CLI or sandbox target.\n * @throws Error when `cli: 'docker'` was demanded and no container is running, or `sbx` cannot be prepared.\n */\nexport async function resolveContainerTarget(\n spec: RepoContainerSpec,\n run: ContainerRun,\n signal?: AbortSignal,\n warn?: SandboxWarning,\n): Promise<ContainerTarget> {\n if (spec.cli === 'sbx') return await resolveSbxTarget(spec, run, signal, warn)\n if (spec.container !== undefined) {\n return { kind: 'docker', containerId: spec.container, workspaceFolder: spec.containerWorkspaceFolder }\n }\n if (spec.cli !== 'devcontainer') {\n const running = await findRunningContainer(spec, run, signal)\n if (running !== undefined) {\n return { kind: 'docker', containerId: running, workspaceFolder: spec.containerWorkspaceFolder }\n }\n if (spec.cli === 'docker') {\n throw new Error('devcontainer: \"' + spec.configPath + '\": cli is \"docker\" but no running container carries '\n + `${CONTAINER_FOLDER_LABEL}=${spec.hostWorkspaceRoot}; start it or set cli: \"auto\"`)\n }\n }\n if (spec.ensureUp) {\n const started = await startContainer(spec, run, signal)\n if (started.containerId !== undefined) {\n return {\n kind: 'docker',\n containerId: started.containerId,\n workspaceFolder: spec.containerWorkspaceFolder,\n }\n }\n return { kind: 'devcontainer-cli', workspaceFolder: started.workspaceFolder }\n }\n return { kind: 'devcontainer-cli', workspaceFolder: spec.hostWorkspaceRoot }\n}\n","/**\n * The one place this Bundle starts a host process: the Docker / Dev Container\n * CLI probes that find or start the container, and the `docker exec` that runs\n * the agent's command. Kept behind an interface so the container argv logic is\n * testable without a Docker daemon.\n * @module @banzhe/dsh-devcontainer/exec\n */\n\nimport { execFile } from 'node:child_process'\nimport { SENSITIVE_ENV_PATTERN } from '@deepseek-ai/dsh-subprocess'\n\n/** One finished CLI call. */\nexport interface ContainerCommandResult {\n readonly stdout: string\n readonly stderr: string\n /** Exit code, or null when the CLI could not be started at all. */\n readonly exitCode: number | null\n}\n\n/** Options for one CLI call. */\nexport interface ContainerCommandOptions {\n readonly signal?: AbortSignal | undefined\n readonly timeoutMs?: number | undefined\n readonly cwd?: string | undefined\n}\n\n/** Runs one host CLI command and resolves with its output. */\nexport type ContainerRun = (argv: readonly string[], options?: ContainerCommandOptions) => Promise<ContainerCommandResult>\n\n/**\n * Cap for one probe's captured output. The agent's own commands do not come\n * through here — they run through the subprocess seam, which streams and caps\n * them — so this only has to hold `devcontainer up`'s build log.\n */\nconst MAX_CLI_OUTPUT_BYTES = 32 * 1024 * 1024\n\n/**\n * The parent variables a Docker / Dev Container CLI is started with.\n *\n * The CLI is a host program the harness runs on the user's behalf, not a proxy\n * for the session: starting it with the ambient environment would hand the\n * harness's own credentials, the session's `DSH_*` facts, and every unrelated\n * host-only variable to a build that the container's `Dockerfile` can read.\n * Only the names below survive, because the CLI itself needs each one:\n * executable lookup and the platform runtime, the per-user Docker configuration\n * under `HOME`/`APPDATA` (where the credential helper is named), scratch space,\n * locale, and proxy routing.\n */\nconst CONTAINER_CLI_ENV_NAMES: readonly string[] = [\n 'PATH', 'PATHEXT', 'SYSTEMROOT', 'SYSTEMDRIVE', 'WINDIR', 'COMSPEC',\n 'HOME', 'USERPROFILE', 'HOMEDRIVE', 'HOMEPATH', 'APPDATA', 'LOCALAPPDATA',\n 'PROGRAMDATA', 'PROGRAMFILES', 'PROGRAMFILES(X86)', 'PROGRAMW6432',\n 'TEMP', 'TMP', 'TMPDIR',\n 'LANG', 'LANGUAGE', 'LC_ALL', 'LC_CTYPE', 'TZ',\n 'HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY', 'ALL_PROXY',\n]\n\n/** Families the CLIs own end to end; a user's Docker/XDG settings belong to them. */\nconst CONTAINER_CLI_ENV_PREFIXES: readonly string[] = ['DOCKER_', 'XDG_']\n\n/**\n * The environment one Docker / Dev Container CLI call is started with.\n *\n * Names are matched case-insensitively because Windows environment names are,\n * and a credential-shaped name is dropped even when it is otherwise listed (see\n * `SENSITIVE_ENV_PATTERN`, the one heuristic every in-repo spawner shares).\n * @param parent - the environment to filter; the host process environment by default.\n * @returns a fresh environment object, safe to hand to `execFile`.\n */\nexport function containerCliEnv(parent: NodeJS.ProcessEnv = process.env): Record<string, string> {\n const allowed = new Set(CONTAINER_CLI_ENV_NAMES)\n const env: Record<string, string> = {}\n for (const [name, value] of Object.entries(parent)) {\n if (value === undefined || SENSITIVE_ENV_PATTERN.test(name)) continue\n const folded = name.toUpperCase()\n if (!allowed.has(folded) && !CONTAINER_CLI_ENV_PREFIXES.some(prefix => folded.startsWith(prefix))) continue\n env[name] = value\n }\n return env\n}\n\n/**\n * Run one CLI command without a shell, capturing bounded output.\n * @param argv - program and arguments, never shell-interpreted.\n * @param options - cancellation, timeout, and working directory.\n * @returns the captured result; a missing program is reported as `exitCode: null`.\n */\nexport const runContainerCommand: ContainerRun = (argv, options = {}) => {\n const [program, ...args] = argv\n if (program === undefined) return Promise.reject(new Error('devcontainer: empty command'))\n return new Promise((resolvePromise, reject) => {\n execFile(program, args, {\n encoding: 'utf8',\n maxBuffer: MAX_CLI_OUTPUT_BYTES,\n windowsHide: true,\n env: containerCliEnv(),\n // `signal` kills the child on abort; naming the signal keeps the kill\n // deterministic instead of relying on the platform default.\n killSignal: 'SIGTERM',\n ...options.signal === undefined ? {} : { signal: options.signal },\n ...options.timeoutMs === undefined ? {} : { timeout: options.timeoutMs },\n ...options.cwd === undefined ? {} : { cwd: options.cwd },\n }, (error, stdout, stderr) => {\n if (error !== null && options.signal?.aborted === true) {\n reject(options.signal.reason instanceof Error ? options.signal.reason : new Error('devcontainer: command aborted'))\n return\n }\n const exitCode = error === null\n ? 0\n : typeof error.code === 'number' ? error.code : null\n resolvePromise({ stdout, stderr, exitCode })\n })\n })\n}\n"],"mappings":";;;;;AA2BA,MAAa,yBAAyB;AAEtC,MAAM,YAAY;;AAGlB,SAAS,WAAW,MAAc,OAAwB;CACxD,OAAO,eAAe,IAAI,CAAC,CAAC,QAAQ,QAAQ,EAAE,CAAC,CAAC,YAAY,MACtD,eAAe,KAAK,CAAC,CAAC,QAAQ,QAAQ,EAAE,CAAC,CAAC,YAAY;AAC9D;;;;;;;;AASA,eAAsB,qBACpB,MACA,KACA,QAC6B;CAC7B,MAAM,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AAkB,QAAQ,QAAQ,OAAO,yBAAS,IAAI,MAAM,+BAA+B,CAAC;IAClH;GACF;GAIA,eAAe;IAAE;IAAQ;IAAQ,UAHhB,UAAU,OACvB,IACA,OAAO,MAAM,SAAS,WAAW,MAAM,OAAO;GACR,CAAC;EAC7C,CAAC;CACH,CAAC;AACH"}
|
package/lib/fs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ContainerRun } from "./exec-_8g5fdSx.js";
|
|
2
|
-
import { t as ContainerOptions } from "./types-
|
|
2
|
+
import { t as ContainerOptions } from "./types-B2cQmBTx.js";
|
|
3
3
|
import z from "@deepseek-ai/schemastery";
|
|
4
4
|
import { Context } from "@deepseek-ai/cordis";
|
|
5
5
|
import { FsDirEntry, FsEditOutcome, FsEditRequest, FsInfo, FsPathInfo, FsTarget, FsVersion, FsWriteIntent, FsWriteOutcome } from "@deepseek-ai/dsh-fs";
|
|
@@ -49,6 +49,13 @@ type ChannelTarget = {
|
|
|
49
49
|
readonly kind: 'sbx';
|
|
50
50
|
readonly sandboxName: string;
|
|
51
51
|
readonly workspace: string;
|
|
52
|
+
/**
|
|
53
|
+
* Extra read-only mounts the sandbox carries beside the workspace. The helper
|
|
54
|
+
* fences every read against the workspace, so it has to be told which further
|
|
55
|
+
* roots this session may use — the host's global skills and `AGENTS.md` — and a
|
|
56
|
+
* sandbox that mounts none passes nothing.
|
|
57
|
+
*/
|
|
58
|
+
readonly mounts?: readonly string[];
|
|
52
59
|
};
|
|
53
60
|
/** Options for one channel. */
|
|
54
61
|
interface ChannelOptions {
|
|
@@ -185,7 +192,7 @@ declare class DevcontainerFileSystem extends SandboxedFileSystem {
|
|
|
185
192
|
*/
|
|
186
193
|
static Config: z<Schemastery.ObjectS<NoInfer<{
|
|
187
194
|
shell: z<string, string, "defined">;
|
|
188
|
-
cli: z<"
|
|
195
|
+
cli: z<"auto" | "devcontainer" | "docker" | "sbx", "auto" | "devcontainer" | "docker" | "sbx", "defined">;
|
|
189
196
|
ensureUp: z<boolean, boolean, "defined">;
|
|
190
197
|
containerTimeoutMs: z<number, number, "defined">;
|
|
191
198
|
requireContainer: z<boolean, boolean, "defined">;
|
|
@@ -194,7 +201,7 @@ declare class DevcontainerFileSystem extends SandboxedFileSystem {
|
|
|
194
201
|
rpcTimeoutMs: z<number, number, "defined">;
|
|
195
202
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
196
203
|
shell: z<string, string, "defined">;
|
|
197
|
-
cli: z<"
|
|
204
|
+
cli: z<"auto" | "devcontainer" | "docker" | "sbx", "auto" | "devcontainer" | "docker" | "sbx", "defined">;
|
|
198
205
|
ensureUp: z<boolean, boolean, "defined">;
|
|
199
206
|
containerTimeoutMs: z<number, number, "defined">;
|
|
200
207
|
requireContainer: z<boolean, boolean, "defined">;
|
|
@@ -227,7 +234,7 @@ declare class DevcontainerFileSystem extends SandboxedFileSystem {
|
|
|
227
234
|
* @param path - the path to resolve; relative paths resolve against `opts.cwd`.
|
|
228
235
|
* @param opts - optional cwd override and cancellation signal.
|
|
229
236
|
* @returns the stable target.
|
|
230
|
-
* @throws FsError `
|
|
237
|
+
* @throws FsError `FS_NOT_FOUND` when the caller is container-bound and this path is outside every mount the session has.
|
|
231
238
|
*/
|
|
232
239
|
resolve(path: string, opts?: {
|
|
233
240
|
cwd?: string;
|
|
@@ -260,7 +267,7 @@ declare class DevcontainerFileSystem extends SandboxedFileSystem {
|
|
|
260
267
|
* @param opts - `cwd` overrides the base for relative paths.
|
|
261
268
|
* @param signal - aborts the metadata round-trip.
|
|
262
269
|
* @returns metadata only, or undefined when the path is absent.
|
|
263
|
-
* @throws FsError `
|
|
270
|
+
* @throws FsError `FS_NOT_FOUND` when the caller is container-bound and this path is outside every mount the session has.
|
|
264
271
|
*/
|
|
265
272
|
lstat(path: string, opts?: {
|
|
266
273
|
cwd?: string;
|
|
@@ -270,7 +277,7 @@ declare class DevcontainerFileSystem extends SandboxedFileSystem {
|
|
|
270
277
|
* @param target - the resolved target.
|
|
271
278
|
* @param signal - aborts the metadata round-trip.
|
|
272
279
|
* @returns metadata only, or undefined when the target is absent.
|
|
273
|
-
* @throws FsError `
|
|
280
|
+
* @throws FsError `FS_NOT_FOUND` when the caller is container-bound and this target is outside every mount the session has.
|
|
274
281
|
*/
|
|
275
282
|
stat(target: FsTarget, signal?: AbortSignal): Promise<FsInfo | undefined>;
|
|
276
283
|
/**
|
|
@@ -318,7 +325,7 @@ declare class DevcontainerFileSystem extends SandboxedFileSystem {
|
|
|
318
325
|
* @param target - the resolved directory target.
|
|
319
326
|
* @param signal - aborts the listing.
|
|
320
327
|
* @returns the direct children with their resolved targets.
|
|
321
|
-
* @throws FsError `
|
|
328
|
+
* @throws FsError `FS_NOT_FOUND` when the caller is container-bound and this target is outside every mount the session has.
|
|
322
329
|
*/
|
|
323
330
|
listDir(target: FsTarget, signal?: AbortSignal): Promise<FsDirEntry[]>;
|
|
324
331
|
/**
|
|
@@ -405,13 +412,52 @@ declare class DevcontainerFileSystem extends SandboxedFileSystem {
|
|
|
405
412
|
private containerKey;
|
|
406
413
|
/** Drop one cached runtime, so the next call probes again. */
|
|
407
414
|
private forgetContainer;
|
|
415
|
+
/** Report every mount this row configures that no argv can carry, once per composition. */
|
|
416
|
+
private reportMountRejections;
|
|
408
417
|
/** Probe where the repository's container is, requiring an endpoint the helper can be started in. */
|
|
409
418
|
private probeContainer;
|
|
410
|
-
/**
|
|
419
|
+
/**
|
|
420
|
+
* Translate one path for a container-bound call, refusing anything outside the mount.
|
|
421
|
+
*
|
|
422
|
+
* Only a metadata probe answers a path outside every mount as absent; a read or a
|
|
423
|
+
* write names something the sandbox may not have, which stays a refusal.
|
|
424
|
+
*/
|
|
411
425
|
private remotePath;
|
|
412
|
-
/**
|
|
426
|
+
/** Whether a container path lies at or under one of the mounts this session may see. */
|
|
427
|
+
private insideMounts;
|
|
428
|
+
/** Whether a HOST path lies at or under one of the host directories this session may see. */
|
|
429
|
+
private insideHostRoots;
|
|
430
|
+
/**
|
|
431
|
+
* Whether the path a call named is one this session could have translated into I/O.
|
|
432
|
+
*
|
|
433
|
+
* The distinction the metadata answer turns on: a path this session cannot name at
|
|
434
|
+
* all is simply absent, while a path it CAN name whose I/O identity ends up outside
|
|
435
|
+
* the mount is an escape and stays a refusal. Both spellings are read, because a
|
|
436
|
+
* call may name either; a relative path may still be either, so it counts as
|
|
437
|
+
* inside and keeps the refusal.
|
|
438
|
+
* @param displayPath - the path the call named.
|
|
439
|
+
* @param route - the container route the call runs under.
|
|
440
|
+
* @param workspaceReal - the workspace as the helper resolved it, when it is known.
|
|
441
|
+
* @returns true when the named path belongs to some spelling of the mount.
|
|
442
|
+
*/
|
|
443
|
+
private namesMountPath;
|
|
444
|
+
/**
|
|
445
|
+
* Answer a container path that leaves every spelling of the repository's mount.
|
|
446
|
+
*
|
|
447
|
+
* Two situations look alike here and are not: a path the session cannot see at all,
|
|
448
|
+
* and a path it can see resolving out of the mount through a symbolic link. The
|
|
449
|
+
* named path decides which: outside every mount, a `probe` may be answered as the
|
|
450
|
+
* absence it is, while a named path that is inside still names an escape, and only
|
|
451
|
+
* a refusal can report that.
|
|
452
|
+
* @param containerPath - the container path the call would use for I/O.
|
|
453
|
+
* @param displayPath - the path the call named.
|
|
454
|
+
* @param route - the container route the call runs under.
|
|
455
|
+
* @param workspaceReal - the workspace as the helper resolved it, when it is known.
|
|
456
|
+
* @param outside - how a path outside every mount is answered: refused, or reported absent.
|
|
457
|
+
* @throws FsError `FS_NOT_FOUND` for an absent probe, `FS_PERMISSION_DENIED` otherwise.
|
|
458
|
+
*/
|
|
413
459
|
private assertInsideMount;
|
|
414
|
-
/**
|
|
460
|
+
/** Fence an already-resolved target against the repository's mount. */
|
|
415
461
|
private assertTargetInsideMount;
|
|
416
462
|
/**
|
|
417
463
|
* Install the target-taking mutations this build's base class may not declare.
|
|
@@ -459,7 +505,7 @@ declare class DevcontainerFileSystem extends SandboxedFileSystem {
|
|
|
459
505
|
* declares a container above the directory it spells: `/f/…` cannot claim
|
|
460
506
|
* whatever host path it happens to name, and a sandbox path outside every mount
|
|
461
507
|
* stays refused locally.
|
|
462
|
-
* @param path - the path the call named.
|
|
508
|
+
* @param path - the path the call named, in either spelling.
|
|
463
509
|
* @param adopt - the calling track's view of a declared specification.
|
|
464
510
|
* @returns the governing specification, or undefined when nothing attributes the path.
|
|
465
511
|
*/
|
|
@@ -467,11 +513,11 @@ declare class DevcontainerFileSystem extends SandboxedFileSystem {
|
|
|
467
513
|
/**
|
|
468
514
|
* Whether the fallback repository may claim one path.
|
|
469
515
|
*
|
|
470
|
-
* A container path of that repository, a host path under its root,
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
* not own: `..` traversal and absolute
|
|
474
|
-
* included.
|
|
516
|
+
* A container path of that repository, a host path under its root, a host path
|
|
517
|
+
* one of its declared extra mounts covers, or a relative path that resolves —
|
|
518
|
+
* against the same base the fallback names — to somewhere inside it. Anything
|
|
519
|
+
* else is a host path the repository does not own: `..` traversal and absolute
|
|
520
|
+
* paths elsewhere on the machine included.
|
|
475
521
|
* @param path - the path the call named.
|
|
476
522
|
* @param base - the directory relative paths resolve against.
|
|
477
523
|
* @param spec - the fallback repository specification.
|
package/lib/fs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.ts","names":[],"sources":["../src/rpc/client.ts","../src/fs.ts"],"mappings":";;;;;;;;;;UAgCiB;;WAEN,OAAO;;WAEP,QAAQ;;WAER,QAAQ;;WAER,QAAQ;aAAmB;aAA8B;;;EAElE,KAAK,SAAS,OAAO;;;KAIX,uBAAuB,yBAAyB;WAAqB;MAAmB;;UA6BnF;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;
|
|
1
|
+
{"version":3,"file":"fs.d.ts","names":[],"sources":["../src/rpc/client.ts","../src/fs.ts"],"mappings":";;;;;;;;;;UAgCiB;;WAEN,OAAO;;WAEP,QAAQ;;WAER,QAAQ;;WAER,QAAQ;aAAmB;aAA8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