@banzhe/dsh-devcontainer 0.2.0 → 0.3.0

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 CHANGED
@@ -19,6 +19,7 @@ A Host-only [DSH](https://github.com/deepseek-ai/deepseek-harness) Bundle for th
19
19
  - **A settings page that derives presets on demand.** On Windows the shipped presets mount `pwsh` and disable `bash`; a Dev Container is Linux, so checking a preset on the **Settings → Dev Container presets** page derives a `… (devContainer)` copy of it (for example `委派模式 (devContainer)`, `标准模式 (devContainer)`) that mounts `bash` and sends its subagents to their own derived copies. Subagent routes are followed four levels deep; a route that limit stops is dropped (an allowed choice removed, a fixed preset row disabled) instead of being left pointing at the ordinary preset. The page carries two independent groups: **Dev Container** (the `sources` list, heading `(devContainer)`) and **Docker Sandbox** (the `sbxSources` list, heading `(sbx)`), and checking a box in one group never touches the other list. Nothing is derived until you check something, unchecking disposes the copy immediately, and the presets you already have are never modified — a preset that mounts no shell tool (the delegate main agent) derives to one that still mounts none.
20
20
  - **Docker Sandbox (`sbx`) is a second track, with no declaration required.** A `… (sbx)` preset derives from the new `sbxSources` list the same way `… (devContainer)` derives from `sources` — same shell-tool flip, same depth-bounded subagent routing, but each track routes only into its own variants. Because a sandbox is given a host directory to mount rather than a build to describe, a repository needs no `.devcontainer/devcontainer.json`: the sandbox `dsh-<repo>-<hash>` is listed (`sbx ls --json`), created (`sbx create --name … shell <root>`) and started detached (`sbx run --detach --name …`) on first use, and commands run as `sbx exec <name> -- /bin/sh -c "cd -- '<workdir>' && exec … '<shell>' -c '<command>'"`. `ctx.fs` delegates to the same container helper over `sbx exec -i <name> -- node …`, so reads and writes happen inside the sandbox, and a missing `sbx` CLI is reported as an install problem rather than as a missing sandbox. A filesystem call names its workspace the way the sandbox mounts it (`/f/personal/repo`), which is no host path at all, while one row serves every session on the host and its configured `cwd` is the directory DSH started in: the host directory is recovered from the mounts `sbx ls` reported — the deepest one wins and names the workspace, declaration or not — and from the drive convention only when a repository really declares a container there, so a path outside every mount is still refused on the host. The shell row reverses the same spelling before it looks a repository up, so a workdir of `/f/personal/repo` runs in that directory's sandbox even when the row was mounted without a `cwd`.
21
21
  - **Falls back to the platform's own shell** for ordinary presets: a directory with no Dev Container declaration keeps the local provider it had before — bash on POSIX, PowerShell on Windows (`pwsh -NoLogo -NoProfile -NonInteractive -Command`) — so the ordinary `pwsh` tool keeps working outside container repositories.
22
+ - **The host's `AGENTS.md` and skills travel with the sandbox.** A `… (sbx)` preset mounts the host's global agent configuration read-only beside the workspace — `hostMounts`, `auto` by default: `<dshHome>/AGENTS.md`, `<agentsHome>/AGENTS.md`, `<dshHome>/skills`, `<agentsHome>/skills` — so a sandboxed session reads the same skills and instructions as a host one. A source that does not exist is skipped with a warning, every mount is read-only, and the fence admits exactly the declared ones. See [Host AGENTS.md and skills in sandboxed sessions](#host-agentsmd-and-skills-in-sandboxed-sessions).
22
23
  - **Container routing follows the preset.** A `… (devContainer)` preset runs every command in the repository's container; an ordinary preset keeps the host shell it had, even in a repository that declares a container. Set `requireContainer: true` on the rows to make every session container-bound instead.
23
24
  - **A `(devContainer)` preset never runs on the host by accident.** The shell tools mark every call issued from a derived preset, so a repository that declares no container gets a warning in the working-directory context (the model is told to say so, in Chinese, and to stop retrying) and the executor **refuses** the command with `exitCode: 1` and a diagnostic instead of falling back. Ordinary presets are unaffected.
24
25
  - **Files are refused with the commands.** `ctx.fs` reads the same preset for the agent that issued the call (a subagent answers for its own Session), so in a repository that declares no container every `resolve`, `read`, `write`, `edit`, `stat`, and listing is refused with a structured `FS_PERMISSION_DENIED` — no host file is read, written, or created. A `(devContainer)` session over a repository that DOES declare a container is fully delegated to that container, and an ordinary preset keeps the plain host filesystem. Looking like it is inside the repository is not enough: a symbolic link that resolves outside the repository's mount is refused the same way, and the diagnostic names the link target.
@@ -45,6 +46,38 @@ A repository opts in with any one of the three shapes, for example:
45
46
 
46
47
  Every field, the driver fallbacks, and the preset mechanics are documented in the implementation notes.
47
48
 
49
+ ## Host AGENTS.md and skills in sandboxed sessions
50
+
51
+ A `… (devContainer)` or `… (sbx)` preset runs under the filesystem fence of its runtime: a path outside the mounted workspace is refused, so a global skill on the host — `~/.agents/skills`, say — is invisible from inside. The host's shared agent configuration is therefore mounted into the sandbox instead, read-only, and read through `ctx.fs` like any other file.
52
+
53
+ `hostMounts` on the Host row decides what is mounted. `auto` (the default) takes the host's `AGENTS.md` and skill trees, each only when it exists:
54
+
55
+ | host path | mounted as |
56
+ | --- | --- |
57
+ | `<dshHome>/AGENTS.md` | a single read-only file |
58
+ | `<agentsHome>/AGENTS.md` | a single read-only file |
59
+ | `<dshHome>/skills` | a read-only directory |
60
+ | `<agentsHome>/skills` | a read-only directory |
61
+
62
+ `dshHome` and `agentsHome` are resolved by DSH itself (`$DSH_HOME` / `$DSH_AGENTS_HOME`, else `~/.dsh` and `~/.agents`), so an override is the directory the sandbox mounts. Set `hostMounts: 'off'` to mount nothing, or list your own `PATH[:TARGET][:ro]` entries; every entry is mounted read-only whichever form it is written in.
63
+
64
+ A source that does not exist is skipped with a warning that names it, instead of failing the create — nothing is created on the host. Mounts are fixed at creation: a path added later needs `sbx rm <sandbox>` and a fresh create before the sandbox can see it. A sandbox already running keeps reading what it mounted, so editing or replacing those files shows up immediately.
65
+
66
+ The fence knows about exactly these mounts: the paths `hostMounts` declares, translated to the places the sandbox mounted them at. Anything else the sandbox reports — the agent skill store `sbx` injects itself, for example — stays unreachable. No environment variable and no restart is involved.
67
+
68
+ ## Docker Sandbox image
69
+
70
+ A created Docker Sandbox runs Docker's agent-less `shell` template. To give it an image instead, fill in **Sandbox template image** on the **Settings → Dev Container presets** page: the value is stored as `sbxTemplate` and travels as `sbx create --template <image>`, in front of the agent and the workspace directory. The field is a settings-page write, so it lands in the profile patch like the two preset lists do.
71
+
72
+ ```text
73
+ sbx create --name <sandbox> shell <hostWorkspaceRoot> # sbxTemplate unset
74
+ sbx create --name <sandbox> --template <image> shell <hostWorkspaceRoot> # sbxTemplate set
75
+ ```
76
+
77
+ The default is `""`, and a blank value is unset too, so an unconfigured row issues exactly the argv it always did. The image must be one argv token — no whitespace of its own, no leading `-` — which admits `docker.io/org/img:tag`, a digest reference such as `docker.io/org/img@sha256:…`, and a local template name such as `my-template:v1`; a registry host is not required. The row's schema refuses anything else, and `sbx create` is never issued with a value it cannot pass. This is the CLI's image flag, not the positional agent: `shell` stays what the sandbox starts, and there is no `--kit`, CPU, or memory setting.
78
+
79
+ The image applies only when this Bundle creates the sandbox. A sandbox that already exists under the same name is reused, or started if it is stopped: it is never removed and recreated because the setting changed, so switching images takes an explicit `sbx rm` of that sandbox. Whatever the image is, it must provide `/bin/sh`, `cat`, and `mkdir`, plus Node.js 18 or newer for the filesystem helper and the tool calls that run through it.
80
+
48
81
  ## Install
49
82
 
50
83
  ### From npm
package/README.zh-CN.md CHANGED
@@ -18,6 +18,7 @@
18
18
  - **不串环境变量。** 进入容器的只有 `remoteEnv`、调用方自己的条目、`DSH_*` 快照,以及 `TERM=dumb`/`GIT_TERMINAL_PROMPT=0`/`NO_COLOR=1`:没有宿主机 `PATH`,没有 `SystemRoot`。宿主一侧同样清洗:Docker / Dev Container CLI 只带着白名单变量启动(找到 `docker` 与读取你自己的 Docker 配置所需的那几个,加上 `DOCKER_*`/`XDG_*` 家族,并剔除名字像凭据的变量),DSH 自己的凭据不会进入它,也不会进入它启动的进程。
19
19
  - **设置页按需派生预设。** Windows 上官方预设挂 `pwsh`、禁用 `bash`;Dev Container 是 Linux,所以在**设置 → Dev Container 预设**页勾选某个预设,就会派生它的 `… (devContainer)` 副本(例如 `委派模式 (devContainer)`、`标准模式 (devContainer)`):改用 `bash`,子代理也指向各自派生的副本,路由最多追踪四层;到达上限的路由会被切断(从可选列表里移除,或禁用整行固定路由),而不是留成原版宿主预设。该页分成两组,互不影响:**Dev Container** 组写 `sources`、派生的预设名后缀是 `(devContainer)`,**Docker Sandbox** 组写 `sbxSources`、后缀是 `(sbx)`。默认不派生任何预设,取消勾选立即注销副本;原有预设一律不改——本来不挂 shell 工具的预设(委派模式主代理)派生后依然不挂。
20
20
  - **Docker Sandbox(`sbx`)是第二条派生轨道,且不需要任何声明文件。** `… (sbx)` 预设由新的 `sbxSources` 列表派生,机制与 `sources` 派生 `… (devContainer)` 完全一致:同样翻转 shell 工具、同样限深的子代理路由,但每条轨道只会把子代理指向自己这条轨道的副本。因为沙箱只需要一个宿主目录、不需要任何构建描述,仓库不需要 `.devcontainer/devcontainer.json`:首次使用时会列出(`sbx ls --json`)、创建(`sbx create --name … shell <仓库根>`)并以 detach 方式启动(`sbx run --detach --name …`)名为 `dsh-<仓库>-<哈希>` 的沙箱,命令以 `sbx exec <名字> -- /bin/sh -c "cd -- '<工作目录>' && exec … '<shell>' -c '<命令>'"` 执行。`ctx.fs` 通过 `sbx exec -i <名字> -- node …` 复用同一个容器 helper,读写都发生在沙箱内部;缺少 `sbx` CLI 时给出的是安装指引,而不是「沙箱不存在」。文件调用报出的路径是沙箱挂载的拼写(`/f/personal/repo`),它根本不是宿主路径,而一行配置服务宿主上的所有会话、其 `cwd` 是启动 DSH 的目录:宿主目录由 `sbx ls` 报告的挂载反解得出(最深的挂载优先,并直接给出工作区根目录,无论仓库有没有声明文件),只有仓库确实在该盘符路径上声明了容器时才采用盘符约定,因此落在所有挂载之外的路径仍然在宿主侧被拒绝。shell 行在查找仓库之前会先反解同一个拼写,因此即使该行挂载时没有配置 `cwd`,工作目录 `/f/personal/repo` 也会进入该目录对应的沙箱。
21
+ - **宿主的 `AGENTS.md` 与技能跟着沙箱一起可见。** `… (sbx)` 预设把宿主的全局 agent 配置以只读方式挂到工作区旁边——宿主行配置项 `hostMounts`,默认 `auto`:`<dshHome>/AGENTS.md`、`<agentsHome>/AGENTS.md`、`<dshHome>/skills`、`<agentsHome>/skills`——于是沙箱会话读到的技能与说明和在宿主上一致。宿主上不存在的源会被跳过并告警,所有挂载一律只读,围栏只放行声明的这几条。详见[在沙箱会话中使用宿主机全局 AGENTS.md 与技能](#在沙箱会话中使用宿主机全局-agentsmd-与技能)。
21
22
  - **普通预设的本地兜底沿用平台自己的 shell。** 没有声明 Dev Container 的目录保持安装前的本地执行器:POSIX 上用 bash,Windows 上用 PowerShell(`pwsh -NoLogo -NoProfile -NonInteractive -Command`)。因此普通的 `pwsh` 工具在容器仓库之外照常可用。
22
23
  - **容器路由跟随预设。**`… (devContainer)` 预设把每条命令送进仓库容器;普通预设保持原来的宿主机 shell,即使该仓库声明了容器。想让所有会话都走容器,请在各行设置 `requireContainer: true`。
23
24
  - **`(devContainer)` 预设不会悄悄在宿主机上跑命令。** shell 工具会给来自派生预设的每次调用打标记,所以仓库没有容器配置时:工作目录上下文里会出现明确警告(要求模型立刻用中文说明情况并停止重试),执行器**直接拒绝**执行并返回 `exitCode: 1` 与诊断信息,而不是回退到宿主机。普通预设不受影响。
@@ -45,6 +46,38 @@
45
46
 
46
47
  字段全表、驱动回退顺序与预设机制见实现说明文档。
47
48
 
49
+ ## 在沙箱会话中使用宿主机全局 AGENTS.md 与技能
50
+
51
+ 使用 `… (devContainer)` 或 `… (sbx)` 预设时,会话跑在对应沙箱的文件系统围栏之内:工作区挂载点之外的路径一律被拒绝,因此宿主上的全局技能目录(例如 `~/.agents/skills`)在沙箱里看不到。宿主的全局 agent 配置改为以只读方式挂进沙箱,并像其他文件一样经 `ctx.fs` 读取。
52
+
53
+ 挂载哪些路径由宿主行的 `hostMounts` 决定。默认值 `auto` 取宿主的 `AGENTS.md` 与技能目录,且每一项只在宿主上确实存在时才挂:
54
+
55
+ | 宿主路径 | 挂载形态 |
56
+ | --- | --- |
57
+ | `<dshHome>/AGENTS.md` | 只读单文件 |
58
+ | `<agentsHome>/AGENTS.md` | 只读单文件 |
59
+ | `<dshHome>/skills` | 只读目录 |
60
+ | `<agentsHome>/skills` | 只读目录 |
61
+
62
+ `dshHome` 与 `agentsHome` 由 DSH 自己解析(`$DSH_HOME` / `$DSH_AGENTS_HOME`,否则是 `~/.dsh` 与 `~/.agents`),所以改了环境变量后沙箱挂载的就是那个目录。把 `hostMounts` 设为 `'off'` 则什么都不挂;也可以自己列 `PATH[:TARGET][:ro]` 条目,无论写成哪种形态,挂载一律只读。
63
+
64
+ 宿主上不存在的源会被跳过并给出一条指名路径的告警,而不是让创建失败——也不会在宿主上创建任何文件。挂载在创建时固定:之后再补的路径需要 `sbx rm <沙箱>` 重建才能被沙箱看见;已经在运行的沙箱则实时读取它挂载的内容,改动或替换文件立刻生效。
65
+
66
+ 围栏只承认这些挂载:即 `hostMounts` 声明的路径,翻译成沙箱里实际挂载的位置。沙箱自己上报的其他挂载(例如 `sbx` 注入的 agent 技能库)仍然不可达。整个过程不涉及环境变量,也不需要重启 DSH。
67
+
68
+ ## Docker Sandbox 镜像
69
+
70
+ 新建 Docker Sandbox 时默认运行 Docker 自带的、不带 agent 的 `shell` 模板。若想换成指定镜像,在**设置 → Dev Container 预设**页的“沙盒模板镜像”一栏填写:该值存为 `sbxTemplate`,并以 `sbx create --template <镜像>` 传入,插在位置参数 agent 与工作区目录之前。这一栏和两份预设列表一样是设置页写入的,会一并落进 profile。
71
+
72
+ ```text
73
+ sbx create --name <沙箱> shell <仓库根> # 未设置 sbxTemplate
74
+ sbx create --name <沙箱> --template <镜像> shell <仓库根> # 已设置 sbxTemplate
75
+ ```
76
+
77
+ 默认值是 `""`,只含空白的值同样视为未设置,因此没配置过的行发出的 argv 与以前完全一致。镜像必须是单独一个 argv:自身不含空白、不以 `-` 开头;因此 `docker.io/org/img:tag`、带 digest 的引用(如 `docker.io/org/img@sha256:…`)以及本地模板名(如 `my-template:v1`)都可用,不要求写 registry 域名。其他取值会被该行的 schema 拒绝,也不会带着无法作为单个参数的值去调用 `sbx create`。这里用的是 CLI 的镜像标志,不是位置参数 agent:`shell` 仍然是沙箱启动的 agent,且不提供 `--kit`、CPU、内存之类的设置。
78
+
79
+ 该设置只在由本插件创建沙箱时生效。同名沙箱已经存在时直接复用,已停止则启动,不会因为改了镜像就删除并重建;要换镜像需自行 `sbx rm` 该沙箱。无论用哪个镜像,都必须提供 `/bin/sh`、`cat`、`mkdir`,以及 Node.js 18 或更新版本(文件系统 helper 和经由它的工具调用需要)。
80
+
48
81
  ## 安装
49
82
 
50
83
  ### 从 npm
package/lib/client.js CHANGED
@@ -8,6 +8,28 @@ window.__ModuleLoader__.load({
8
8
  let react = require("react");
9
9
  let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
10
10
  let react_jsx_runtime = require("react/jsx-runtime");
11
+ //#region src/sbx-template.ts
12
+ /**
13
+ * The image a Docker Sandbox is created with, as one argv token.
14
+ *
15
+ * The rule is shared by three callers that cannot reach each other's modules: the
16
+ * row schema that validates the setting, the settings page in the browser that
17
+ * writes it, and the argv builder that hands it to `sbx`. It therefore lives in a
18
+ * module of its own — no Node import — so all three read one definition instead of
19
+ * three copies.
20
+ * @module @banzhe/dsh-devcontainer/sbx-template
21
+ */
22
+ /**
23
+ * What a configured image may look like: nothing at all, or one argv token with
24
+ * no whitespace of its own and no leading `-`.
25
+ *
26
+ * Surrounding whitespace is tolerated and trimmed, because the value is a person's
27
+ * typing and the token is what reaches the CLI. A leading `-` is not, because the
28
+ * CLI would read the value as another flag, and neither is an inner space, which
29
+ * `sbx` would split into two arguments.
30
+ */
31
+ const SANDBOX_TEMPLATE_PATTERN = /^\s*(?:[^\s-]\S*)?\s*$/u;
32
+ //#endregion
11
33
  //#region src/ids.ts
12
34
  /**
13
35
  * The suffixes and display labels that mark a derived preset, shared by both
@@ -189,6 +211,18 @@ window.__ModuleLoader__.load({
189
211
  */
190
212
  /** The settings namespace this page edits: also the Host Loader row id. */
191
213
  const DEVCONTAINER_NS = "devcontainer";
214
+ /** The stored field the page's text input writes: the Host row's own image setting. */
215
+ const IMAGE_FIELD = "sbxTemplate";
216
+ /**
217
+ * The image one stored namespace section carries.
218
+ * @param section - the namespace's stored value.
219
+ * @returns the image, or an empty string when none is stored.
220
+ */
221
+ function imageOf(section) {
222
+ if (typeof section !== "object" || section === null) return "";
223
+ const value = Reflect.get(section, IMAGE_FIELD);
224
+ return typeof value === "string" ? value : "";
225
+ }
192
226
  const INITIAL = {
193
227
  status: "loading",
194
228
  failure: null,
@@ -197,7 +231,8 @@ window.__ModuleLoader__.load({
197
231
  rows: [],
198
232
  sbxRows: [],
199
233
  checkedCount: 0,
200
- sbxCheckedCount: 0
234
+ sbxCheckedCount: 0,
235
+ sbxTemplate: ""
201
236
  };
202
237
  /**
203
238
  * Delays between roster re-reads after a write lands.
@@ -242,6 +277,8 @@ window.__ModuleLoader__.load({
242
277
  loading = true;
243
278
  /** The lists the queue will send next; undefined when every toggle has landed. */
244
279
  intent;
280
+ /** The image the queue will send next; undefined when every image save has landed. */
281
+ image;
245
282
  writing = false;
246
283
  /** Invalidates every read that a newer load, or a dispose, supersedes. */
247
284
  generation = 0;
@@ -273,6 +310,9 @@ window.__ModuleLoader__.load({
273
310
  },
274
311
  toggleSbxSource: (sourceId) => {
275
312
  this.toggleSbxSource(sourceId);
313
+ },
314
+ setSbxTemplate: (value) => {
315
+ this.setSbxTemplate(value);
276
316
  }
277
317
  };
278
318
  }
@@ -357,6 +397,28 @@ window.__ModuleLoader__.load({
357
397
  });
358
398
  }
359
399
  /**
400
+ * Store the image a created sandbox runs.
401
+ *
402
+ * The value is validated here instead of being written and refused by the Host:
403
+ * an image that is not one argv token would otherwise reach the row's schema as
404
+ * a rejected write with no way to say which field was at fault.
405
+ * @param value - the text the person typed.
406
+ */
407
+ setSbxTemplate(value) {
408
+ if (this.disposed) return;
409
+ const image = value.trim();
410
+ if (!SANDBOX_TEMPLATE_PATTERN.test(image)) {
411
+ this.failure = "template";
412
+ this.publish();
413
+ return;
414
+ }
415
+ if (!this.form.getSnapshot().writable) return;
416
+ this.failure = null;
417
+ this.image = image;
418
+ this.publish();
419
+ this.flush();
420
+ }
421
+ /**
360
422
  * The lists a toggle starts from, or undefined when this page must ignore it.
361
423
  * @returns the queued lists when a write is still pending, otherwise the stored ones.
362
424
  */
@@ -401,19 +463,26 @@ window.__ModuleLoader__.load({
401
463
  this.publish();
402
464
  let landed = false;
403
465
  try {
404
- while (this.intent !== void 0) {
405
- const next = this.intent;
406
- const accepted = await this.form.mutate(opsFor(next));
466
+ while (true) {
467
+ const lists = this.intent;
468
+ const image = this.image;
469
+ let accepted;
470
+ if (lists !== void 0) accepted = await this.form.mutate(opsFor(lists));
471
+ else if (image !== void 0) accepted = await this.form.set(IMAGE_FIELD, image);
472
+ else break;
407
473
  this.failure = accepted ? null : "write";
408
474
  if (!accepted) break;
409
475
  landed = true;
410
- if (this.intent === next) this.intent = void 0;
476
+ if (lists !== void 0) {
477
+ if (this.intent === lists) this.intent = void 0;
478
+ } else if (this.image === image) this.image = void 0;
411
479
  this.publish();
412
480
  }
413
481
  } catch {
414
482
  this.failure = "write";
415
483
  } finally {
416
484
  this.intent = void 0;
485
+ this.image = void 0;
417
486
  this.writing = false;
418
487
  this.publish();
419
488
  }
@@ -433,11 +502,12 @@ window.__ModuleLoader__.load({
433
502
  status: snapshot.status === "unavailable" ? "unavailable" : this.failure === "load" ? "error" : this.loading || snapshot.status === "loading" ? "loading" : "ready",
434
503
  failure: this.failure,
435
504
  writable: snapshot.writable,
436
- saving: this.writing || this.intent !== void 0,
505
+ saving: this.writing || this.intent !== void 0 || this.image !== void 0,
437
506
  rows,
438
507
  sbxRows,
439
508
  checkedCount: rows.filter((row) => row.checked).length,
440
- sbxCheckedCount: sbxRows.filter((row) => row.checked).length
509
+ sbxCheckedCount: sbxRows.filter((row) => row.checked).length,
510
+ sbxTemplate: this.image ?? imageOf(snapshot.value)
441
511
  });
442
512
  }
443
513
  };
@@ -572,6 +642,13 @@ window.__ModuleLoader__.load({
572
642
  props.toggleSbxSource(id);
573
643
  }
574
644
  }),
645
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SandboxImageField, {
646
+ t,
647
+ value: state.sbxTemplate,
648
+ invalid: state.failure === "template",
649
+ disabled,
650
+ onSave: props.setSbxTemplate
651
+ }),
575
652
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
576
653
  className: "dcv-notice",
577
654
  children: t("refreshHint")
@@ -581,6 +658,62 @@ window.__ModuleLoader__.load({
581
658
  });
582
659
  }
583
660
  /**
661
+ * The image a created Docker Sandbox runs (`sbxTemplate`), as one text field.
662
+ *
663
+ * The box holds a local draft and writes on blur or Enter, so an unfinished value —
664
+ * a leading `-`, a half-typed registry — is never sent; the value it shows reverts to
665
+ * the stored one whenever no draft is in progress, which keeps a write from another
666
+ * editor visible without an effect mirroring state.
667
+ */
668
+ function SandboxImageField(props) {
669
+ const { t, value, invalid, disabled, onSave } = props;
670
+ const [draft, setDraft] = (0, react.useState)(null);
671
+ const commit = () => {
672
+ if (draft === null) return;
673
+ onSave(draft);
674
+ setDraft(null);
675
+ };
676
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
677
+ className: "dcv-group",
678
+ "data-image": "true",
679
+ children: [
680
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
681
+ className: "dcv-group-title",
682
+ htmlFor: "dcv-sbx-template",
683
+ children: t("imageTitle")
684
+ }),
685
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
686
+ id: "dcv-sbx-template",
687
+ className: "dcv-image-input",
688
+ value: draft ?? value,
689
+ disabled,
690
+ placeholder: t("imagePlaceholder"),
691
+ spellCheck: false,
692
+ autoComplete: "off",
693
+ onChange: (event) => {
694
+ setDraft(event.target.value);
695
+ },
696
+ onBlur: commit,
697
+ onKeyDown: (event) => {
698
+ if (event.key !== "Enter") return;
699
+ event.preventDefault();
700
+ commit();
701
+ }
702
+ }),
703
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
704
+ className: "dcv-group-description",
705
+ children: t("imageDescription")
706
+ }),
707
+ invalid ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
708
+ className: "dcv-notice",
709
+ "data-failed": "true",
710
+ role: "alert",
711
+ children: t("imageInvalid")
712
+ }) : null
713
+ ]
714
+ });
715
+ }
716
+ /**
584
717
  * One track's card: its heading with the preset-name suffix, what the track is,
585
718
  * how much of it is derived, and the rows themselves.
586
719
  * @param t - the localized copy seat.
@@ -700,7 +833,11 @@ window.__ModuleLoader__.load({
700
833
  writeFailed: "The deployment did not accept this change.",
701
834
  refreshHint: "Preset pickers re-read the roster the next time one opens.",
702
835
  empty: "This deployment declares no preset to derive from.",
703
- sbxEmpty: "This deployment declares no preset to derive a Docker Sandbox copy from."
836
+ sbxEmpty: "This deployment declares no preset to derive a Docker Sandbox copy from.",
837
+ imageTitle: "Sandbox template image",
838
+ 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.",
839
+ imagePlaceholder: "docker.io/org/img:tag",
840
+ imageInvalid: "Only one image name is accepted: no whitespace, and no leading “-”."
704
841
  };
705
842
  const zh = {
706
843
  nav: "Dev Container 预设",
@@ -727,11 +864,15 @@ window.__ModuleLoader__.load({
727
864
  writeFailed: "本部署没有接受这次修改。",
728
865
  refreshHint: "预设选择器下次打开时会重新读取清单。",
729
866
  empty: "本部署没有可派生的预设。",
730
- sbxEmpty: "本部署没有可派生 Docker Sandbox 副本的预设。"
867
+ sbxEmpty: "本部署没有可派生 Docker Sandbox 副本的预设。",
868
+ imageTitle: "沙盒模板镜像",
869
+ imageDescription: "留空则使用 shell 的默认镜像。仅在新建沙盒时传给 sbx create --template,已存在的同名沙盒不会重建。镜像需提供 /bin/sh、cat、mkdir 和 node 18 或更高版本。",
870
+ imagePlaceholder: "docker.io/org/img:tag",
871
+ imageInvalid: "只接受单个镜像名:不能含空白,也不能以「-」开头。"
731
872
  };
732
873
  //#endregion
733
874
  //#region \0dsh-css-inline:/home/runner/work/dsh-plugins/dsh-plugins/plugins/devcontainer/src/client/styles.css.mjs
734
- var styles_css_default = ".dcv-section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:16px;display:flex}.dcv-title{margin:0;font-size:18px;font-weight:600}.dcv-intro,.dcv-count,.dcv-notice,.dcv-description,.dcv-group-description{color:var(--dsw-alias-label-tertiary);margin:0;font-size:13px;line-height:1.5}.dcv-notice[data-failed=true]{color:var(--dsw-alias-state-error-primary)}.dcv-group{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-settings-card-fill);flex-direction:column;gap:8px;padding:12px 14px;display:flex}.dcv-group-title{align-items:baseline;gap:6px;margin:0;font-size:14px;font-weight:600;display:flex}.dcv-suffix{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:500}.dcv-rows{flex-direction:column;margin:0;padding:0;list-style:none;display:flex}.dcv-row{justify-content:space-between;align-items:center;gap:12px;padding:8px 0;display:flex}.dcv-row+.dcv-row{border-top:.5px solid var(--dsw-alias-border-l2)}.dcv-main{flex-direction:column;gap:2px;min-width:0;display:flex}.dcv-description{text-overflow:ellipsis;white-space:nowrap;max-width:420px;overflow:hidden}.dcv-row[data-checked=true] .dcv-tail{color:var(--dsw-alias-label-primary)}.dcv-tail{flex:none;align-items:center;gap:8px;min-width:0;display:inline-flex}.dcv-id{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;max-width:220px;font-size:12px;overflow:hidden}.dcv-state{color:var(--dsw-alias-label-tertiary);text-align:right;min-width:56px;font-size:12px}.dcv-state[data-checked=true]{color:var(--dsw-alias-label-secondary,var(--dsw-alias-label-tertiary))}";
875
+ var styles_css_default = ".dcv-section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:16px;display:flex}.dcv-title{margin:0;font-size:18px;font-weight:600}.dcv-intro,.dcv-count,.dcv-notice,.dcv-description,.dcv-group-description{color:var(--dsw-alias-label-tertiary);margin:0;font-size:13px;line-height:1.5}.dcv-notice[data-failed=true]{color:var(--dsw-alias-state-error-primary)}.dcv-group{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-xl);background:var(--dsw-alias-settings-card-fill);flex-direction:column;gap:8px;padding:12px 14px;display:flex}.dcv-group-title{align-items:baseline;gap:6px;margin:0;font-size:14px;font-weight:600;display:flex}.dcv-suffix{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:500}.dcv-rows{flex-direction:column;margin:0;padding:0;list-style:none;display:flex}.dcv-row{justify-content:space-between;align-items:center;gap:12px;padding:8px 0;display:flex}.dcv-row+.dcv-row{border-top:.5px solid var(--dsw-alias-border-l2)}.dcv-main{flex-direction:column;gap:2px;min-width:0;display:flex}.dcv-description{text-overflow:ellipsis;white-space:nowrap;max-width:420px;overflow:hidden}.dcv-row[data-checked=true] .dcv-tail{color:var(--dsw-alias-label-primary)}.dcv-tail{flex:none;align-items:center;gap:8px;min-width:0;display:inline-flex}.dcv-id{color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;max-width:220px;font-size:12px;overflow:hidden}.dcv-state{color:var(--dsw-alias-label-tertiary);text-align:right;min-width:56px;font-size:12px}.dcv-state[data-checked=true]{color:var(--dsw-alias-label-secondary,var(--dsw-alias-label-tertiary))}.dcv-image-input{max-width:420px}.dcv-group[data-image=true] .dcv-group-title{display:block}";
735
876
  //#endregion
736
877
  //#region src/client/index.ts
737
878
  /** Plugin id, stamped onto the injected stylesheet for teardown bookkeeping. */