@songtonyli/dsh-cli 0.1.64 → 0.1.65

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
@@ -26,7 +26,7 @@ workspace and no build step. Native packages that ship one build per platform
26
26
  ripgrep, the PTY backend's addons, sharp, koffi, and the Landlock launcher — are
27
27
  ordinary optional dependencies, so npm resolves the right one for your machine.
28
28
 
29
- Requires Node `^22.19.0 || >=24.0.0`. Version 0.1.64; `dsh --version`
29
+ Requires Node `^22.19.0 || >=24.0.0`. Version 0.1.65; `dsh --version`
30
30
  also reports the harness build the package was assembled from.
31
31
 
32
32
  ## License
package/bin/dsh.mjs CHANGED
@@ -18,7 +18,7 @@ const argv = process.argv.slice(2)
18
18
  // version this package publishes. Reporting only one of the two would make an
19
19
  // ordinary `npm install @songtonyli/dsh-cli@x` look like it installed something else.
20
20
  if (argv.length === 1 && (argv[0] === '--version' || argv[0] === '-V')) {
21
- console.log('@songtonyli/dsh-cli 0.1.64 (deepseek-harness 0.2.1-alpha.1)')
21
+ console.log('@songtonyli/dsh-cli 0.1.65 (deepseek-harness 0.2.1-alpha.1)')
22
22
  process.exit(0)
23
23
  }
24
24
 
@@ -48,9 +48,9 @@
48
48
  "micromark-util-sanitize-uri": "^2.0.1",
49
49
  "simple-icons": "16.31.0",
50
50
  "@deepseek-ai/dsh-client-store": "0.2.1-alpha.1",
51
- "@deepseek-ai/dsh-util-code-language": "0.2.1-alpha.1",
52
51
  "@deepseek-ai/dsh-util-workspace-path": "0.2.1-alpha.1",
53
- "@deepseek-ai/cordis": "~4.0.5-alpha.1"
52
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1",
53
+ "@deepseek-ai/dsh-util-code-language": "0.2.1-alpha.1"
54
54
  },
55
55
  "files": [
56
56
  "lib/index.js",
@@ -167,7 +167,7 @@ window.__ModuleLoader__.load({
167
167
  const SCROLLBAR_LINGER_MS = 2e3;
168
168
  /** Format complete-build metadata for the local brand badge. */
169
169
  function localBuildVersion() {
170
- return `0.2.1-alpha.1-6fd4f9d` + ({}.DSH_CLIENT_GIT_DIRTY === "true" ? "-dirty" : "");
170
+ return `0.2.1-alpha.1-a121561` + ({}.DSH_CLIENT_GIT_DIRTY === "true" ? "-dirty" : "");
171
171
  }
172
172
  /** Each panel row subscribes only to its own selection state. */
173
173
  function PanelRow({ id, label, wide, usePanelInfo, selectPanel, renderSlot }) {
@@ -24,8 +24,8 @@
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
26
  "@types/react": "~18.3.1",
27
- "@deepseek-ai/dsh-client-store": "0.2.1-alpha.1",
28
- "@deepseek-ai/cordis": "~4.0.5-alpha.1"
27
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1",
28
+ "@deepseek-ai/dsh-client-store": "0.2.1-alpha.1"
29
29
  },
30
30
  "files": [
31
31
  "lib/index.js",
@@ -27,8 +27,8 @@
27
27
  en: ab093e9042b86b99
28
28
  zh: d173df7cb3649446
29
29
  /deepseek-ai-dsh-sandbox/use-this-package/denied-calls-and-escalation:
30
- en: 92cf42bad65d112c
31
- zh: 60fa2cb7e9c4c556
30
+ en: 70c53dd52c94ab56
31
+ zh: 6b836c8078469cba
32
32
  /deepseek-ai-dsh-sandbox/use-this-package/fail-closed-behavior:
33
33
  en: 6bf240632a7a6bf5
34
34
  zh: ebf414f5cf435875
@@ -63,7 +63,7 @@ Enforcement is reported per call: `full` means the backend governs every promise
63
63
 
64
64
  ### Denied calls and escalation
65
65
 
66
- When a confined call is denied, the operation reports a denial marker naming the mode — `[sandbox: file access denied under <mode> mode]` — and, when the composition advertises escalation, an escalation hint. The model may retry the exact call once with `sandbox_permissions` (the narrowest wider mode that suffices) plus a `justification`; the approval service obtains consent for the operation. The request retains its audit reason and supplies English and Chinese presentation copy with the model's justification unchanged. Missing translations follow the locale service's fallback chain, ultimately English; requesters own their translated presentation text. A wider mode requires approval and applies to that one call only. Repeating the call's effective mode succeeds without approval; narrower targets remain invalid.
66
+ When a confined call is denied, the operation reports a denial marker naming the mode — `[sandbox: file access denied under <mode> mode]` — and, when the composition advertises escalation, an escalation hint. The model may retry the exact call once with `sandbox_permissions` (the narrowest wider mode that suffices) plus a `justification`; the approval service obtains consent for the operation. The request retains its audit reason and supplies English and Chinese presentation copy with the model's justification unchanged. Missing translations follow the locale service's fallback chain, ultimately English; requesters own their translated presentation text. A provider can append a sentence to the prompt through `SandboxProvider.escalationNote`, for example to say that the call will leave its container. A wider mode requires approval and applies to that one call only. Repeating the call's effective mode succeeds without approval; narrower targets remain invalid.
67
67
 
68
68
  ### Fail-closed behavior
69
69
 
@@ -63,7 +63,7 @@ kind: "package-reference"
63
63
 
64
64
  ### 被拒绝的调用与升权
65
65
 
66
- 受限调用被拒绝时,操作会报告指明模式的拒绝标记——`[sandbox: file access denied under <mode> mode]`——组合声明升权能力时还会给出升权提示。模型可以用 `sandbox_permissions`(足以放行的最窄更宽模式)加 `justification` 重试一次完全相同的调用;审批服务为操作取得同意。请求保留审计原因,同时提供英文和中文展示文案,模型给出的理由保持原样。缺失的译文遵循语言服务的回退链,最终回退到英文;请求方负责自己的展示译文。更宽的模式需要审批,且只作用于该次调用。重复指定调用的生效模式无需审批即可成功;更窄的目标仍然无效。
66
+ 受限调用被拒绝时,操作会报告指明模式的拒绝标记——`[sandbox: file access denied under <mode> mode]`——组合声明升权能力时还会给出升权提示。模型可以用 `sandbox_permissions`(足以放行的最窄更宽模式)加 `justification` 重试一次完全相同的调用;审批服务为操作取得同意。请求保留审计原因,同时提供英文和中文展示文案,模型给出的理由保持原样。缺失的译文遵循语言服务的回退链,最终回退到英文;请求方负责自己的展示译文。提供方可以通过 `SandboxProvider.escalationNote` 向审批提示追加一句话,例如说明该调用将离开其容器。更宽的模式需要审批,且只作用于该次调用。重复指定调用的生效模式无需审批即可成功;更窄的目标仍然无效。
67
67
 
68
68
  ### 故障关闭行为
69
69
 
@@ -98,7 +98,7 @@ function sandboxPermissionsDescription(subject) {
98
98
  * @returns the granted mode, consumed by the one call that asked.
99
99
  */
100
100
  async function approveEscalation(request, approval) {
101
- const { requestedMode: mode, effectiveMode, justification, subject } = request;
101
+ const { requestedMode: mode, effectiveMode, justification, subject, note } = request;
102
102
  if (mode === effectiveMode) return effectiveMode;
103
103
  if (!(WIDER_MODES[effectiveMode] ?? []).includes(mode)) throw new Error(`sandbox escalation to "${mode}" is not strictly wider than this call's current "${effectiveMode}" mode`);
104
104
  if (approval.approver === void 0) throw new Error(`sandbox escalation to "${mode}" requires approval, but no approval service is composed`);
@@ -107,10 +107,10 @@ async function approveEscalation(request, approval) {
107
107
  agent: approval.agent,
108
108
  toolName: approval.toolName,
109
109
  callId: approval.callId,
110
- reason: `escalate sandbox to ${mode}: ${justification}`,
110
+ reason: `escalate sandbox to ${mode}: ${justification}${note === void 0 ? "" : ` (${note.en})`}`,
111
111
  displayReason: {
112
- en: `Allow this operation with ${mode} permissions: ${justification}`,
113
- zh: `允许本次操作使用 ${mode} 权限:${justification}`
112
+ en: `Allow this operation with ${mode} permissions: ${justification}${note === void 0 ? "" : ` ${note.en}`}`,
113
+ zh: `允许本次操作使用 ${mode} 权限:${justification}${note === void 0 ? "" : ` ${note.zh ?? note.en}`}`
114
114
  },
115
115
  ...approval.signal ? { signal: approval.signal } : {}
116
116
  });
@@ -350,6 +350,15 @@ var SandboxProvider = class extends Service {
350
350
  * @returns the read scope, or `undefined` for unconfined reads.
351
351
  */
352
352
  readScope(_policy) {}
353
+ /**
354
+ * A user-facing sentence to add to the approval prompt for escalating one
355
+ * call to `target`, for backends where the wider mode changes where the
356
+ * command runs. The base implementation adds nothing.
357
+ * @param _policy - the file-effect policy the call currently runs under.
358
+ * @param _target - the wider mode the call asks for.
359
+ * @returns the localized sentence, or `undefined` when the prompt needs no addition.
360
+ */
361
+ escalationNote(_policy, _target) {}
353
362
  };
354
363
  //#endregion
355
364
  export { ESCALATION_TARGETS, SANDBOX_UNAVAILABLE, SandboxProvider, SandboxProvider as default, SandboxUnavailableError, WIDER_MODES, approveEscalation, canonicalPath, classifyRunnerFailure, escalationHintMarker, isHiddenIn, isReadableIn, isRunnerSpawnFailure, matchesNameGlob, matchesSignature, sandboxDenialMarker, sandboxPermissionsDescription, validateEscalationArgs, writableRoots };
@@ -27,8 +27,8 @@
27
27
  en: fe0f7d5ac6160763
28
28
  zh: 4e1455a8559d46ca
29
29
  /deepseek-ai-dsh-sandbox-apple-container/use-this-package/what-confinement-covers:
30
- en: 01b66f4de3beaaa2
31
- zh: b416302045f030e2
30
+ en: b88b6a821a2504eb
31
+ zh: 891ed523b2419020
32
32
  /deepseek-ai-dsh-sandbox-apple-container/use-this-package/failures-and-recovery:
33
33
  en: 79782500f91b1f06
34
34
  zh: a132d680acb85edc
@@ -73,7 +73,7 @@ The fields of `@deepseek-ai/dsh-sandbox-local` also apply to the `local` backend
73
73
  | A command plants a Git hook or config the host later runs | `.git` is read-only under `workspace-write`; writes fail with `Read-only file system` and use the normal escalation |
74
74
  | A command writes outside the workspace | The write lands in the container's own disk and never reaches the host |
75
75
 
76
- `danger-full-access` bypasses `confine`, so it runs on the host under either backend. The Auto permission does not write it while a session runs on this backend: it writes `workspace-write`, and the reviewer, not a prompt, approves a one-shot escalation that leaves the container ([Auto review](../../experimental/auto-review/README.md)). On the `local` backend Auto still writes `danger-full-access`.
76
+ `danger-full-access` bypasses `confine`, so it runs on the host under either backend. The approval prompt for an escalation to `danger-full-access` from a container session adds that the command runs directly on the Mac, outside the container. The Auto permission does not write it while a session runs on this backend: it writes `workspace-write`, and the reviewer, not a prompt, approves a one-shot escalation that leaves the container ([Auto review](../../experimental/auto-review/README.md)). On the `local` backend Auto still writes `danger-full-access`.
77
77
 
78
78
  ### Failures and recovery
79
79
 
@@ -132,7 +132,7 @@ One `sandbox:backend` contribution in the runtime-context snapshot when the sess
132
132
  ##### Container backend
133
133
 
134
134
  ```markdown
135
- Commands confined by the DSH file sandbox run inside a Linux container from image <image>. Only the session workspace <workspace root> is shared with the host; files written elsewhere stay inside the container and are not visible to file tools. File tools ask the user before reading a host path outside the workspace; secret files such as `.env` and private keys stay hidden from commands and file tools.
135
+ Commands confined by the DSH file sandbox run inside a Linux container from image <image>. Only the session workspace <workspace root> is shared with the host; files written elsewhere stay inside the container and are not visible to file tools. Host-installed programs (macOS apps, Homebrew tools, browsers) and the host home directory are absent, and HOME is /root; when a skill or command needs them, rerun it with `sandbox_permissions` escalation to run on the host, or ask the user to run `/sandbox local`. File tools ask the user before reading a host path outside the workspace; secret files such as `.env` and private keys stay hidden from commands and file tools.
136
136
  ```
137
137
 
138
138
  #### Token effect
@@ -73,7 +73,7 @@ kind: "package-reference"
73
73
  | 命令植入宿主机之后会执行的 Git hook 或配置 | 在 `workspace-write` 下 `.git` 为只读;写入以 `Read-only file system` 失败,并走常规提权流程 |
74
74
  | 命令写入工作区之外 | 写入落在容器自己的磁盘上,永远不会到达宿主机 |
75
75
 
76
- `danger-full-access` 绕过 `confine`,因此在任一后端下都在宿主机上运行。会话运行在此后端时,Auto 权限不会写入它:而是写入 `workspace-write`,并由 reviewer 而不是提示批准离开容器的一次性提权([Auto review](../../experimental/auto-review/README.zh.md))。在 `local` 后端上,Auto 仍写入 `danger-full-access`。
76
+ `danger-full-access` 绕过 `confine`,因此在任一后端下都在宿主机上运行。从容器会话升权到 `danger-full-access` 时,审批提示会补充说明该命令将直接在 Mac 上运行,而不是在容器内。会话运行在此后端时,Auto 权限不会写入它:而是写入 `workspace-write`,并由 reviewer 而不是提示批准离开容器的一次性提权([Auto review](../../experimental/auto-review/README.zh.md))。在 `local` 后端上,Auto 仍写入 `danger-full-access`。
77
77
 
78
78
  ### 失败与恢复
79
79
 
@@ -132,7 +132,7 @@ CLI 缺失、已停止且无法启动的 API 服务器,或 `container run` 失
132
132
  ##### container 后端
133
133
 
134
134
  ```markdown
135
- Commands confined by the DSH file sandbox run inside a Linux container from image <image>. Only the session workspace <workspace root> is shared with the host; files written elsewhere stay inside the container and are not visible to file tools. File tools ask the user before reading a host path outside the workspace; secret files such as `.env` and private keys stay hidden from commands and file tools.
135
+ Commands confined by the DSH file sandbox run inside a Linux container from image <image>. Only the session workspace <workspace root> is shared with the host; files written elsewhere stay inside the container and are not visible to file tools. Host-installed programs (macOS apps, Homebrew tools, browsers) and the host home directory are absent, and HOME is /root; when a skill or command needs them, rerun it with `sandbox_permissions` escalation to run on the host, or ask the user to run `/sandbox local`. File tools ask the user before reading a host path outside the workspace; secret files such as `.env` and private keys stay hidden from commands and file tools.
136
136
  ```
137
137
 
138
138
  #### Token 影响
@@ -594,7 +594,7 @@ var AppleContainerSandboxProvider = class extends LocalSandboxProvider {
594
594
  if (session === void 0 || this.backendFor(session) !== "container") return "";
595
595
  const policy = scope.sandboxPolicy.resolve({ session });
596
596
  if (policy.mode === "danger-full-access") return "";
597
- return `Commands confined by the DSH file sandbox run inside a Linux container from image ${JSON.stringify(this.image)}. Only the session workspace ${JSON.stringify(policy.workspaceRoot)} is shared with the host; files written elsewhere stay inside the container and are not visible to file tools. File tools ask the user before reading a host path outside the workspace; secret files such as \`.env\` and private keys stay hidden from commands and file tools.`;
597
+ return `Commands confined by the DSH file sandbox run inside a Linux container from image ${JSON.stringify(this.image)}. Only the session workspace ${JSON.stringify(policy.workspaceRoot)} is shared with the host; files written elsewhere stay inside the container and are not visible to file tools. Host-installed programs (macOS apps, Homebrew tools, browsers) and the host home directory are absent, and HOME is /root; when a skill or command needs them, rerun it with \`sandbox_permissions\` escalation to run on the host, or ask the user to run \`/sandbox local\`. File tools ask the user before reading a host path outside the workspace; secret files such as \`.env\` and private keys stay hidden from commands and file tools.`;
598
598
  }
599
599
  });
600
600
  });
@@ -661,6 +661,19 @@ var AppleContainerSandboxProvider = class extends LocalSandboxProvider {
661
661
  };
662
662
  }
663
663
  /**
664
+ * Tells the user that `danger-full-access` leaves the container.
665
+ * @param policy - the calling session's resolved policy.
666
+ * @param target - the wider mode the call asks for.
667
+ * @returns the localized sentence for a container-backed call escalating to `danger-full-access`, otherwise `undefined`.
668
+ */
669
+ escalationNote(policy, target) {
670
+ if (target !== "danger-full-access" || this.policyBackend(policy) !== "container") return void 0;
671
+ return {
672
+ en: "It will run directly on your Mac, outside the Linux container.",
673
+ zh: "它将直接在你的 Mac 上运行,而不是在 Linux 容器内。"
674
+ };
675
+ }
676
+ /**
664
677
  * The host read scope of a container-backed confined policy: the workspace
665
678
  * (canonical and as spelled) and the extra read-only mounts, minus the
666
679
  * hidden files. The local backend and `danger-full-access` confine no reads.
@@ -361,11 +361,13 @@ function apply(ctx, config = {}) {
361
361
  const approveBashEscalation = (mode, justification, exec, standingPolicy) => {
362
362
  if (escalationModes.length === 0) throw new Error("sandbox_permissions is not available in this composition (no sandboxing executor to escalate)");
363
363
  const effectiveMode = standingPolicy.mode;
364
+ const note = ctx.get("sandbox")?.escalationNote(standingPolicy, mode);
364
365
  return approveEscalation({
365
366
  requestedMode: mode,
366
367
  justification,
367
368
  effectiveMode,
368
- subject: "command"
369
+ subject: "command",
370
+ ...note === void 0 ? {} : { note }
369
371
  }, {
370
372
  approver: ctx.get("approval"),
371
373
  agent: exec.agent,
@@ -334,12 +334,13 @@ module.exports = class CachePolicy {
334
334
 
335
335
  /**
336
336
  * @param {{headers: Record<string, string>, synchronous: boolean}|undefined} revalidation - Revalidation information, if any.
337
- * @returns {{response: {headers: Record<string, string>}, revalidation: {headers: Record<string, string>, synchronous: boolean}|undefined}} An object with a cached response headers and revalidation info.
337
+ * @returns {{response: HttpResponse, revalidation: {headers: Record<string, string>, synchronous: boolean}|undefined}} An object with a cached response headers and revalidation info.
338
338
  */
339
339
  _evaluateRequestHitResult(revalidation) {
340
340
  return {
341
341
  response: {
342
342
  headers: this.responseHeaders(),
343
+ status: this._status,
343
344
  },
344
345
  revalidation,
345
346
  };
@@ -387,9 +388,9 @@ module.exports = class CachePolicy {
387
388
  * }
388
389
  * ```
389
390
  * @param {HttpRequest} req - new incoming HTTP request
390
- * @returns {{response: {headers: Record<string, string>}|undefined, revalidation: {headers: Record<string, string>, synchronous: boolean}|undefined}} An object containing keys:
391
+ * @returns {{response: HttpResponse|undefined, revalidation: {headers: Record<string, string>, synchronous: boolean}|undefined}} An object containing keys:
391
392
  * - revalidation: { headers: Record<string, string>, synchronous: boolean } Set if you should send this to the origin server
392
- * - response: { headers: Record<string, string> } Set if you can respond to the client with these cached headers
393
+ * - response: HttpResponse Set if you can respond to the client with these cached headers
393
394
  */
394
395
  evaluateRequest(req) {
395
396
  this._assertRequestHasHeaders(req);
@@ -484,18 +485,32 @@ module.exports = class CachePolicy {
484
485
  return true;
485
486
  }
486
487
 
487
- // A Vary header field-value of "*" always fails to match
488
- if (this._resHeaders.vary === '*') {
489
- return false;
490
- }
491
-
492
488
  const fields = this._resHeaders.vary
493
489
  .trim()
494
490
  .toLowerCase()
495
491
  .split(/\s*,\s*/);
492
+
496
493
  for (const name of fields) {
497
- if (req.headers[name] !== this._reqHeaders[name]) return false;
494
+ // A Vary header field-value of "*" always fails to match
495
+ if (name === '*') {
496
+ return false;
497
+ }
498
+
499
+ const newReq = Object.prototype.hasOwnProperty.call(
500
+ req.headers,
501
+ name
502
+ ) && req.headers[name];
503
+
504
+ const cachedReq = Object.prototype.hasOwnProperty.call(
505
+ this._reqHeaders,
506
+ name
507
+ ) && this._reqHeaders[name];
508
+
509
+ if (newReq !== cachedReq) {
510
+ return false;
511
+ }
498
512
  }
513
+
499
514
  return true;
500
515
  }
501
516
 
@@ -556,6 +571,14 @@ module.exports = class CachePolicy {
556
571
  return headers;
557
572
  }
558
573
 
574
+ /**
575
+ * Returns the status code of the cached response.
576
+ * @returns {number} The response status code.
577
+ */
578
+ status() {
579
+ return this._status;
580
+ }
581
+
559
582
  /**
560
583
  * Returns the Date header value from the response or the current time if invalid.
561
584
  * @returns {number} Timestamp (in milliseconds) representing the Date header or response time.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "http-cache-semantics",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "Parses Cache-Control and other headers. Helps building correct HTTP caches and proxies",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,9 +11,9 @@
11
11
  "files": [
12
12
  "index.js"
13
13
  ],
14
- "author": "Kornel Lesiński <npms2@geekhood.net> (https://kornel.ski/)",
14
+ "author": "Kornel Lesiński <kornel@geekhood.net> (https://kornel.ski/)",
15
15
  "license": "BSD-2-Clause",
16
16
  "devDependencies": {
17
- "mocha": "^11.0"
17
+ "mocha": "^12.0"
18
18
  }
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@songtonyli/dsh-cli",
3
- "version": "0.1.64",
3
+ "version": "0.1.65",
4
4
  "description": "The dsh terminal agent: an interactive TUI over the DeepSeek Harness, with its whole Node runtime bundled in one install.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -470,7 +470,7 @@
470
470
  "hast-util-to-html": "9.0.5",
471
471
  "hast-util-whitespace": "3.0.0",
472
472
  "html-void-elements": "3.0.0",
473
- "http-cache-semantics": "4.2.0",
473
+ "http-cache-semantics": "4.3.0",
474
474
  "http-errors": "2.0.1",
475
475
  "http-proxy-agent": "9.1.0",
476
476
  "http2-wrapper": "2.2.1",