@songtonyli/dsh-cli 0.1.64 → 0.1.66

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.
Files changed (91) hide show
  1. package/README.md +1 -1
  2. package/bin/dsh.mjs +1 -1
  3. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/package.json +2 -2
  4. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  5. package/node_modules/@deepseek-ai/dsh-otel/node_modules/@opentelemetry/resources/build/esm/version.js +1 -1
  6. package/node_modules/@deepseek-ai/dsh-otel/node_modules/@opentelemetry/resources/build/esnext/version.js +1 -1
  7. package/node_modules/@deepseek-ai/dsh-otel/node_modules/@opentelemetry/resources/build/src/version.js +1 -1
  8. package/node_modules/@deepseek-ai/dsh-otel/node_modules/@opentelemetry/resources/node_modules/@opentelemetry/core/build/esm/version.js +1 -1
  9. package/node_modules/@deepseek-ai/dsh-otel/node_modules/@opentelemetry/resources/node_modules/@opentelemetry/core/build/esnext/version.js +1 -1
  10. package/node_modules/@deepseek-ai/dsh-otel/node_modules/@opentelemetry/resources/node_modules/@opentelemetry/core/build/src/version.js +1 -1
  11. package/node_modules/@deepseek-ai/dsh-otel/node_modules/@opentelemetry/resources/node_modules/@opentelemetry/core/package.json +2 -2
  12. package/node_modules/@deepseek-ai/dsh-otel/node_modules/@opentelemetry/resources/package.json +3 -3
  13. package/node_modules/@deepseek-ai/dsh-sandbox/README.i18n.yaml +2 -2
  14. package/node_modules/@deepseek-ai/dsh-sandbox/README.md +1 -1
  15. package/node_modules/@deepseek-ai/dsh-sandbox/README.zh.md +1 -1
  16. package/node_modules/@deepseek-ai/dsh-sandbox/lib/index.js +13 -4
  17. package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/README.i18n.yaml +2 -2
  18. package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/README.md +2 -2
  19. package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/README.zh.md +2 -2
  20. package/node_modules/@deepseek-ai/dsh-sandbox-apple-container/lib/index.js +14 -1
  21. package/node_modules/@deepseek-ai/dsh-tool-bash/lib/index.js +3 -1
  22. package/node_modules/@deepseek-ai/dsh-tui-app/README.md +3 -2
  23. package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +3 -2
  24. package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +977 -16
  25. package/node_modules/@deepseek-ai/dsh-tui-app/package.json +2 -0
  26. package/node_modules/execa/lib/arguments/command-file.js +55 -23
  27. package/node_modules/execa/lib/arguments/command.js +2 -1
  28. package/node_modules/execa/lib/arguments/cwd.js +10 -6
  29. package/node_modules/execa/lib/arguments/encoding-option.js +11 -0
  30. package/node_modules/execa/lib/arguments/escape.js +2 -2
  31. package/node_modules/execa/lib/arguments/fd-options.js +3 -7
  32. package/node_modules/execa/lib/arguments/options.js +13 -3
  33. package/node_modules/execa/lib/arguments/specific.js +2 -1
  34. package/node_modules/execa/lib/convert/duplex.js +3 -1
  35. package/node_modules/execa/lib/convert/iterable.js +3 -5
  36. package/node_modules/execa/lib/convert/readable.js +3 -1
  37. package/node_modules/execa/lib/convert/writable.js +8 -4
  38. package/node_modules/execa/lib/io/contents.js +8 -11
  39. package/node_modules/execa/lib/io/input-sync.js +8 -5
  40. package/node_modules/execa/lib/io/max-buffer.js +41 -28
  41. package/node_modules/execa/lib/io/output-sync.js +64 -40
  42. package/node_modules/execa/lib/io/strip-newline.js +4 -3
  43. package/node_modules/execa/lib/ipc/buffer-messages.js +12 -2
  44. package/node_modules/execa/lib/ipc/get-each.js +8 -2
  45. package/node_modules/execa/lib/ipc/get-one.js +3 -1
  46. package/node_modules/execa/lib/ipc/graceful.js +3 -2
  47. package/node_modules/execa/lib/ipc/incoming.js +10 -3
  48. package/node_modules/execa/lib/ipc/ipc-input.js +7 -2
  49. package/node_modules/execa/lib/ipc/send.js +3 -1
  50. package/node_modules/execa/lib/ipc/strict.js +13 -7
  51. package/node_modules/execa/lib/ipc/validation.js +1 -1
  52. package/node_modules/execa/lib/methods/bind.js +2 -8
  53. package/node_modules/execa/lib/methods/create.js +3 -1
  54. package/node_modules/execa/lib/methods/main-async.js +21 -11
  55. package/node_modules/execa/lib/methods/main-sync.js +7 -5
  56. package/node_modules/execa/lib/methods/node.js +1 -1
  57. package/node_modules/execa/lib/methods/script.js +1 -1
  58. package/node_modules/execa/lib/methods/template.js +24 -5
  59. package/node_modules/execa/lib/pipe/pipe-arguments.js +36 -5
  60. package/node_modules/execa/lib/pipe/throw.js +5 -3
  61. package/node_modules/execa/lib/resolve/all-async.js +43 -19
  62. package/node_modules/execa/lib/resolve/all-sync.js +27 -15
  63. package/node_modules/execa/lib/resolve/exit-sync.js +13 -5
  64. package/node_modules/execa/lib/resolve/stdio.js +2 -1
  65. package/node_modules/execa/lib/resolve/wait-stream.js +12 -2
  66. package/node_modules/execa/lib/resolve/wait-subprocess.js +3 -1
  67. package/node_modules/execa/lib/return/early-error.js +58 -21
  68. package/node_modules/execa/lib/return/message.js +2 -10
  69. package/node_modules/execa/lib/return/reject.js +1 -1
  70. package/node_modules/execa/lib/stdio/direction.js +36 -5
  71. package/node_modules/execa/lib/stdio/duplicate.js +26 -16
  72. package/node_modules/execa/lib/stdio/handle-async.js +6 -0
  73. package/node_modules/execa/lib/stdio/handle-sync.js +5 -3
  74. package/node_modules/execa/lib/stdio/handle.js +47 -24
  75. package/node_modules/execa/lib/stdio/native.js +3 -6
  76. package/node_modules/execa/lib/stdio/stdio-option.js +13 -18
  77. package/node_modules/execa/lib/stdio/type.js +2 -10
  78. package/node_modules/execa/lib/terminate/cancel.js +7 -0
  79. package/node_modules/execa/lib/terminate/kill-descendants.js +20 -4
  80. package/node_modules/execa/lib/transform/encoding-transform.js +15 -0
  81. package/node_modules/execa/lib/transform/generator.js +13 -2
  82. package/node_modules/execa/lib/transform/split.js +37 -23
  83. package/node_modules/execa/lib/utils/options.js +9 -0
  84. package/node_modules/execa/lib/utils/standard-stream.js +6 -0
  85. package/node_modules/execa/lib/utils/uint-array.js +1 -7
  86. package/node_modules/execa/lib/verbose/log.js +3 -6
  87. package/node_modules/execa/lib/verbose/output.js +3 -1
  88. package/node_modules/execa/package.json +51 -48
  89. package/node_modules/http-cache-semantics/index.js +32 -9
  90. package/node_modules/http-cache-semantics/package.json +3 -3
  91. package/package.json +3 -3
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.66; `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.66 (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-358e216-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 }) {
@@ -3,5 +3,5 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  // this is autogenerated file, see scripts/version-update.js
6
- export const VERSION = '2.11.0';
6
+ export const VERSION = '2.12.0';
7
7
  //# sourceMappingURL=version.js.map
@@ -3,5 +3,5 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  // this is autogenerated file, see scripts/version-update.js
6
- export const VERSION = '2.11.0';
6
+ export const VERSION = '2.12.0';
7
7
  //# sourceMappingURL=version.js.map
@@ -6,5 +6,5 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.VERSION = void 0;
8
8
  // this is autogenerated file, see scripts/version-update.js
9
- exports.VERSION = '2.11.0';
9
+ exports.VERSION = '2.12.0';
10
10
  //# sourceMappingURL=version.js.map
@@ -3,5 +3,5 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  // this is autogenerated file, see scripts/version-update.js
6
- export const VERSION = '2.11.0';
6
+ export const VERSION = '2.12.0';
7
7
  //# sourceMappingURL=version.js.map
@@ -3,5 +3,5 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  // this is autogenerated file, see scripts/version-update.js
6
- export const VERSION = '2.11.0';
6
+ export const VERSION = '2.12.0';
7
7
  //# sourceMappingURL=version.js.map
@@ -6,5 +6,5 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.VERSION = void 0;
8
8
  // this is autogenerated file, see scripts/version-update.js
9
- exports.VERSION = '2.11.0';
9
+ exports.VERSION = '2.12.0';
10
10
  //# sourceMappingURL=version.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentelemetry/core",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "description": "OpenTelemetry Core provides constants and utilities shared by all OpenTelemetry SDK packages.",
5
5
  "main": "build/src/index.js",
6
6
  "module": "build/esm/index.js",
@@ -90,5 +90,5 @@
90
90
  },
91
91
  "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-core",
92
92
  "sideEffects": false,
93
- "gitHead": "0b72a81636fa476e8f1f1afd2ae0c90a1362194c"
93
+ "gitHead": "92b844e8aa7d9655e4b3560154e912c4c1ced64d"
94
94
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentelemetry/resources",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "description": "OpenTelemetry SDK resources",
5
5
  "main": "build/src/index.js",
6
6
  "module": "build/esm/index.js",
@@ -82,10 +82,10 @@
82
82
  "@opentelemetry/api": ">=1.3.0 <1.10.0"
83
83
  },
84
84
  "dependencies": {
85
- "@opentelemetry/core": "2.11.0",
85
+ "@opentelemetry/core": "2.12.0",
86
86
  "@opentelemetry/semantic-conventions": "^1.29.0"
87
87
  },
88
88
  "homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/packages/opentelemetry-resources",
89
89
  "sideEffects": false,
90
- "gitHead": "0b72a81636fa476e8f1f1afd2ae0c90a1362194c"
90
+ "gitHead": "92b844e8aa7d9655e4b3560154e912c4c1ced64d"
91
91
  }
@@ -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,
@@ -40,7 +40,7 @@ On quit the app prints `dsh: session <id> saved; resume with: dsh --profile tui
40
40
 
41
41
  ### The screen
42
42
 
43
- Every frame is drawn one column in from each edge of the terminal, so no line of the conversation or of the docked chrome touches either side. The header names the session by its title once one is generated or set, with the id beside it. The transcript grows in the terminal's own scrollback: your prompts start with `❯` on a tinted full-width band while colour is on (attachments listed under them), and a prompt steered or injected into a turn that already had a model step draws dim on a darker band so it recedes behind the turn it joined, assistant reasoning is dim italic under a `✻ Thinking` header above the Markdown reply, and each tool call is a card with a status glyph — a yellow spinner of that tool family's flowers, blooms, and stars while it runs, a green `◆` once done, a red `◆` on failure — the bold tool name, the presenter headline in violet — without the tool name a presenter repeated, so `Read src/app.ts` draws as `read src/app.ts`, and for a shell card the call's own summary, never the command, which the card draws once as its `$` row — a loading row while it runs, and a body folded to `toolPreviewLines` rows. The card appears when the model starts the call, its header first and its rows unrolling beneath it over about `toolRevealFrames` frames; the result rows unroll and float out the same way when the tool answers. An `edit` or `write` diff card fills each added row edge to edge with a green background and each removed row with a red one, the removed rows above the added ones, and paints the `+` and `-` in their own lighter colour so each sign reads against the fill rather than in it; a wrapped row carries the fill on without a second sign; once the tool applied the change, the applied hunks replace the diff the call carried and lead every row with its file line number, the new file's for added and unchanged rows and the old file's for removed rows. A `subagent` or `subagent_*` card draws folded as one row behind the same status glyph, spinning while it runs and a dim `◆` for a child handed to the background: while it runs, the tool name, the task description, and the requested model and `background` when the call names them; once settled, the description dimmed with `[done]`, `[started]` for a child handed to the background, or `[failed]` at the right edge. `Space` on the marked row, or `Ctrl+O`, unfolds the full card. A nonempty system prompt and each injected context — instructions, catalogs, snapshots, notices, relays, and recalls — draw as a dim `⬡` title over the first `contextPreviewLines` rows of their model-facing text, with each snapshot contribution named above its own rows; an empty system prompt is omitted. A compaction, from `/compact` or automatic, draws as one context block whose accent `⬡` title names its origin and the estimated tokens it replaced and its summary costs, as in `context compacted by /compact · ~6.4k → ~0.9k tokens` or `context compacted automatically in turn 12 · …`; under the title, `compressed` names the item count and turns the summary replaced, each prompt among them (five at most, one row each), and a count of the replies, tool results by tool, context blocks, and earlier summaries, and `preserved` names the system prompt and what each later turn still holds verbatim; both stay drawn while the summary under them folds to `contextPreviewLines` rows like any context block. The checkpoint message itself is not drawn again. A `/compact` attempt the log closes with an error prints `/compact failed · <error>` when the session is redrawn, since the live command reports its own failure; a failed automatic attempt changes nothing and draws nothing, as in the browser. A tool card and a context block that carry more rows than they draw end on one marker: `… <n> more rows · Space expands` while the conversation's focus holds that block, and `… <n> more rows · Ctrl+O expands` otherwise. Fenced code in a reply, the file rows of a `read` card, the changed rows of an `edit` or `write` diff card — with `+` additions marked green, `-` removals red, and source text behind those signs drawn in the language the file's extension names — and the shell command of a `!` / `!!` draft, a `$ command` user-shell row (its `$` in the accent colour), and a terminal tool card, use syntax colours from a theme the terminal's own background picks, light or dark; the grammar of a language loads on the first block that asks for it, so that block draws plain and is repainted in colour a moment later, and a language with no grammar here, a terminal that reports neither 24-bit nor 256 colours, and `codeHighlight: false` each draw every block plain. Headings and list markers use warm orange, links and inline code use violet, and quotes stay dim. Streamed reasoning, reply text, and tool arguments are queued as they arrive and drawn a share per frame, about 60 frames per second by default, so a network burst spreads over `streamPaceFrames` frames instead of landing at once, and the queue never holds the model call back. Streamed reply text fades in and every word keeps its own clock: a word enters near the terminal's background color and brightens to the color it settles in over `streamFadeSteps` ticks of `streamFadeStepMs` each, so a fast stream leaves a longer trail of brightening words rather than a darker one. Streamed reasoning and a tool card float out over the same duration: they appear at a lifted color and recede to the dim italic or palette colors they settle in; a card redrawn from persisted history carries no fade, and text that has settled is never dimmed again.
43
+ Every frame is drawn one column in from each edge of the terminal, so no line of the conversation or of the docked chrome touches either side. The header names the session by its title once one is generated or set, with the id beside it. The transcript grows in the terminal's own scrollback: your prompts start with `❯` on a tinted full-width band while colour is on (attachments listed under them), and a prompt steered or injected into a turn that already had a model step draws dim on a darker band so it recedes behind the turn it joined, assistant reasoning is dim italic under a `✻ Thinking` header above the Markdown reply, and each tool call is a card with a status glyph — a yellow spinner of that tool family's flowers, blooms, and stars while it runs, a green `◆` once done, a red `◆` on failure — the bold tool name, the presenter headline in violet — without the tool name a presenter repeated, so `Read src/app.ts` draws as `read src/app.ts`, and for a shell card the call's own summary, never the command, which the card draws once as its `$` row — a loading row while it runs, and a body folded to `toolPreviewLines` rows. A top-level workflow call also draws its own run beside that card: the name, member count, and status, then each phase and the members that started. Running groups and groups with a failed, cancelled, or interrupted member open; a clean completion stays closed. Space or Enter on a run or phase folds that level, and Enter on a running member opens its child only while that child is a live direct child of this session. The card appears when the model starts the call, its header first and its rows unrolling beneath it over about `toolRevealFrames` frames; the result rows unroll and float out the same way when the tool answers. An `edit` or `write` diff card fills each added row edge to edge with a green background and each removed row with a red one, the removed rows above the added ones, and paints the `+` and `-` in their own lighter colour so each sign reads against the fill rather than in it; a wrapped row carries the fill on without a second sign; once the tool applied the change, the applied hunks replace the diff the call carried and lead every row with its file line number, the new file's for added and unchanged rows and the old file's for removed rows. A `subagent` or `subagent_*` card draws folded as one row behind the same status glyph, spinning while it runs and a dim `◆` for a child handed to the background: while it runs, the tool name, the task description, and the requested model and `background` when the call names them; once settled, the description dimmed with `[done]`, `[started]` for a child handed to the background, or `[failed]` at the right edge. `Space` on the marked row, or `Ctrl+O`, unfolds the full card. A nonempty system prompt and each injected context — instructions, catalogs, snapshots, notices, relays, and recalls — draw as a dim `⬡` title over the first `contextPreviewLines` rows of their model-facing text, with each snapshot contribution named above its own rows; an empty system prompt is omitted. A compaction, from `/compact` or automatic, draws as one context block whose accent `⬡` title names its origin and the estimated tokens it replaced and its summary costs, as in `context compacted by /compact · ~6.4k → ~0.9k tokens` or `context compacted automatically in turn 12 · …`; under the title, `compressed` names the item count and turns the summary replaced, each prompt among them (five at most, one row each), and a count of the replies, tool results by tool, context blocks, and earlier summaries, and `preserved` names the system prompt and what each later turn still holds verbatim; both stay drawn while the summary under them folds to `contextPreviewLines` rows like any context block. The checkpoint message itself is not drawn again. A `/compact` attempt the log closes with an error prints `/compact failed · <error>` when the session is redrawn, since the live command reports its own failure; a failed automatic attempt changes nothing and draws nothing, as in the browser. A tool card and a context block that carry more rows than they draw end on one marker: `… <n> more rows · Space expands` while the conversation's focus holds that block, and `… <n> more rows · Ctrl+O expands` otherwise. Fenced code in a reply, the file rows of a `read` card, the changed rows of an `edit` or `write` diff card — with `+` additions marked green, `-` removals red, and source text behind those signs drawn in the language the file's extension names — and the shell command of a `!` / `!!` draft, a `$ command` user-shell row (its `$` in the accent colour), and a terminal tool card, use syntax colours from a theme the terminal's own background picks, light or dark; the grammar of a language loads on the first block that asks for it, so that block draws plain and is repainted in colour a moment later, and a language with no grammar here, a terminal that reports neither 24-bit nor 256 colours, and `codeHighlight: false` each draw every block plain. Headings and list markers use warm orange, links and inline code use violet, and quotes stay dim. Streamed reasoning, reply text, and tool arguments are queued as they arrive and drawn a share per frame, about 60 frames per second by default, so a network burst spreads over `streamPaceFrames` frames instead of landing at once, and the queue never holds the model call back. Streamed reply text fades in and every word keeps its own clock: a word enters near the terminal's background color and brightens to the color it settles in over `streamFadeSteps` ticks of `streamFadeStepMs` each, so a fast stream leaves a longer trail of brightening words rather than a darker one. Streamed reasoning and a tool card float out over the same duration: they appear at a lifted color and recede to the dim italic or palette colors they settle in; a card redrawn from persisted history carries no fade, and text that has settled is never dimmed again.
44
44
 
45
45
  Below the transcript sit a spinner while the agent works — `thinking`, `writing`, `calling <tool>`, a retry, or `compacting`, each beside its own braille animation: circling dots, filling lines, an orbiting dot, a sliding bar, or a settling cell — with a bright highlight sweeping across the word, plus live `↑` send and `↓` receive tokens for the current model call, as compact `k` / `M` / `B` counts, growing as the stream arrives and settling on the provider usage chunk — any open prompt, a boxed follow-ups list while messages wait, an activity board of the open turn's todos and latest descendant line while either has a row — completed todo content scratched out and status glyphs colored green, yellow, or cyan, the in-progress one a spinner, at most four todo rows then `+<n> more`, not a focus region, gone on `turn/end` and bind — the editor, the subagent panel, and the footer: a status bar that, unfocused, is one line built from both ends inward. The editor's caret is the terminal's own blinking bar: the app asks for that shape at start, gives your default back on quit, and draws no caret at all while the status bar or the panel holds the keyboard. The model and entry keys are colored; live turn, context, and todo facts use yellow, violet, and green. The model is anchored at the left edge and is never dropped — past 20 columns it falls back to the bare model name, and only a label still too wide for that is ellipsized — and the two keys that leave the input are anchored at the right edge as `Shift+↑ read · Shift+↓ status`, or `Shift+↑ select · Shift+↓ status` while follow-ups wait, narrowing to `Shift+↑↓ nav` and dropped below 40 columns. The key facts fill whatever middle is left, in bar order: effort (`effort default` when the selection leaves reasoning to the model), the running turn's elapsed time, the context window percentage, the todo counts, and the workspace path (shortened with `~` and `…/` when long). Every segment that middle cannot hold folds into a trailing `+N`, together with the segments the unfocused line never draws — the permission preset, token usage (session totals plus the in-flight call), the goal and plan-mode markers from the projection seam, and the count of pending attachments. Model-request retries appear as notices, the same facts the browser's markers carry.
46
46
 
@@ -60,7 +60,7 @@ The subagent panel is drawn while a subagent session under the bound one is resi
60
60
 
61
61
  ### Keys and commands
62
62
 
63
- The conversation, input, subagent panel, and status bar form the vertical arrow-key walk: `Down` at the newest section, `Up` on the subagent panel's first row, and `Up` on the status bar with no subagent panel drawn all land at the caret. The follow-ups list sits above the input; `Shift+Up` enters it while it is drawn, and it joins the `Tab` walk. The activity board sits between follow-ups and the input and is not a focus region. While a region other than the editor has the keyboard, `Tab` and `Shift+Tab` walk the regions that are drawn, wrapping at both ends; in the editor, `Tab` takes the offered completion and `Shift+Tab` opens the reasoning-effort picker. A printable key pressed in any of them returns to the input and types there, so a sentence started while reading lands where it was aimed; `Space` in the conversation is the one exception, and folds the marked tool card or context block. `Ctrl+G`, `Ctrl+O`, `Ctrl+B`, `Ctrl+T`, `Ctrl+P`, and `Ctrl+L` mean the same thing in every one of those regions, and `Ctrl+C` and `Ctrl+D` return the keyboard to the input before they act. A prompt and the reader own their whole key stream instead, and answer `Ctrl+C` by giving the keyboard back.
63
+ The conversation, input, subagent panel, and status bar form the vertical arrow-key walk: `Down` at the newest section, `Up` on the subagent panel's first row, and `Up` on the status bar with no subagent panel drawn all land at the caret. The follow-ups list sits above the input; `Shift+Up` enters it while it is drawn, and it joins the `Tab` walk. The activity board sits between follow-ups and the input and is not a focus region. While a region other than the editor has the keyboard, `Tab` and `Shift+Tab` walk the regions that are drawn, wrapping at both ends; in the editor, `Tab` takes the offered completion and `Shift+Tab` opens the reasoning-effort picker. A printable key pressed in any of them returns to the input and types there, so a sentence started while reading lands where it was aimed; `Space` in the conversation is the one exception, and folds the marked tool card, context block, or workflow run or phase. `Ctrl+G`, `Ctrl+O`, `Ctrl+B`, `Ctrl+T`, `Ctrl+P`, and `Ctrl+L` mean the same thing in every one of those regions, and `Ctrl+C` and `Ctrl+D` return the keyboard to the input before they act. A prompt and the reader own their whole key stream instead, and answer `Ctrl+C` by giving the keyboard back.
64
64
 
65
65
  Every key the screen names is drawn as a chip, italic in the accent color apart from the words around it: in the status bar, the region legends, the pickers and prompts, the transient line, fold markers, notices, `/help`, and the reader. With `mouse: true`, a left click on a chip presses that key exactly as typing it would, so `Shift+↓` in the status bar walks to the bar, `Esc` on the armed-stop line stops the turn, and each arrow of a pair such as `↑↓` presses its own key. Turning it on turns the terminal's mouse reports on: the wheel opens the full-screen reader at the newest section and scrolls it up or down, but does nothing while an approval or question is open. The wheel and plain click-drag reach the application instead of scrolling the terminal's scrollback or selecting text; most terminals still scroll and select with `Shift` held (`Option` in iTerm2).
66
66
 
@@ -475,6 +475,7 @@ These limits describe the terminal surface as shipped; they are not a general CL
475
475
  - **Runs through the `dsh` launcher** — starting the profile another way fails at startup, because only the launcher can request the process exit.
476
476
  - **A `/btw` side agent is read-only by tool name and sandbox** — `btwTools` must name only tools that read, because the side agent shares the workspace with the working agent; a command tool can read anything the `read-only` sandbox mode allows, and without a confining command executor command tools are hidden. It inherits only what the working session has logged: reply text still streaming is absent. Its log is stored like a subagent session's and hidden from `/resume` and `/sessions`, and Web has no `/btw`.
477
477
  - **A moved call stays tied to its turn and returns text** — the tool runtime fuses the turn's signal into every call, so `Esc` on the turn that dispatched a call stops it even after `Ctrl+B`; a job result is a string, so other content blocks of the call's result are named as `[image omitted]` and the like; and moving needs `ctx.jobs` with `dsh-tool-jobs`, which the base profile composes.
478
+ - **Workflow runs show identity and status** — a top-level workflow call draws a run beside its tool card: the name, member count, status, phases, and started members. Running and abnormal groups open; a clean completion stays closed. Space or Enter on a run or phase folds that level. Enter opens a running member only while it is a live direct child of this session, and does not resume a member that has finished. The script stays on the tool card. A background run stays running after its launch turn while its job is live; an unfinished run with no live job is interrupted on replay. Phase and log lines stay on `/jobs`, and the job's return value stays with `job_output`.
478
479
  - **`!` is one-shot and not a TTY** — each line is a fresh `ctx.shell.run`; there is no persistent shell or interactive program. The Web composer does not intercept `!`. An optional first prompt on the command line is always a user message.
479
480
 
480
481
  <a id="dev-note"></a>
@@ -40,7 +40,7 @@ dsh tui --no-open # print sign-in URLs without opening a
40
40
 
41
41
  ### 屏幕布局
42
42
 
43
- 每一帧都从终端左右两边各内缩一列绘制,因此对话记录与停靠的界面组件都不会有任何一行贴到两侧边缘。页眉在标题生成或设置后以标题命名会话,并在旁边显示 id。对话记录在终端自身的回滚区中增长:你的提示以 `❯` 开头,启用颜色时铺在一条通栏的着色背景带上(附件列在其下),而在已有模型步骤的轮次中被引导或注入的提示以暗色文字铺在更深的背景带上,退到它所加入的轮次之后,assistant 的推理以暗色斜体显示在 `✻ Thinking` 标题之下、Markdown 回复上方,每次工具调用是一张卡片,含状态符号(运行中为按工具族混合花朵、绽放与星形的黄色旋转指示、完成为绿色 `◆`、失败为红色 `◆`)、粗体工具名、以紫色显示的呈现器标题(去掉呈现器重复写出的工具名,因此 `Read src/app.ts` 画成 `read src/app.ts`;shell 卡片取该次调用自身的摘要,绝不取命令,命令只由卡片的 `$` 行绘制一次)、运行中的一行加载标记,以及折叠到 `toolPreviewLines` 行的正文。卡片在模型开始调用时出现,先画标题,其下各行在约 `toolRevealFrames` 帧内逐行展开;工具回答后,结果行也以同样方式展开并浮出。`edit` 或 `write` diff 卡片把每一新增行整行铺满绿色背景、每一删除行整行铺满红色背景,删除的旧行在上、新增的新行在下,并把 `+` 与 `-` 画成各自更亮的颜色,使符号从填充色中读得出来;折行续行只延续填充色,不再画第二个符号;工具应用变更后,已应用的 hunk 取代调用时携带的 diff,并在每行前标出文件行号,新增行与未变行用新文件的行号,删除行用旧文件的行号。`subagent` 与 `subagent_*` 卡片折叠时只画一行,行首是同样的状态符号,运行中旋转,交给后台的子 agent 则为暗色 `◆`:运行中显示工具名、任务描述,以及调用指定的模型与 `background`;结束后描述变暗,右端标出 `[done]`,交给后台的子 agent 标 `[started]`,失败标 `[failed]`。在被标记的行上按 `Space`,或按 `Ctrl+O`,即可展开完整卡片。非空的系统提示词与每一条注入的上下文——instructions、catalogs、snapshots、notices、relays 与 recalls——绘制为暗色 `⬡` 标题,其下是面向模型文本的前 `contextPreviewLines` 行,快照的每一份贡献具名写在其自身各行上方;空的系统提示词则省略。一次压缩(compaction)——无论来自 `/compact` 还是自动触发——绘制为一个上下文块,其强调色 `⬡` 标题写明来源,以及被替换内容与摘要各自的估算 token 数,如 `context compacted by /compact · ~6.4k → ~0.9k tokens` 或 `context compacted automatically in turn 12 · …`;标题之下,`compressed` 写明摘要替换的条目数与轮次、其中的每条提示(最多五条,每条一行),以及回复、按工具分列的工具结果、上下文块与更早摘要的计数,`preserved` 写明系统提示词以及之后每一轮仍逐字保留的内容;这两部分始终绘出,其下的摘要则像其他上下文块一样折叠到 `contextPreviewLines` 行。检查点消息本身不再重复绘制。日志以错误结束的 `/compact` 尝试会在会话重绘时打印 `/compact failed · <error>`,因为实时运行的命令会自己报告失败;失败的自动尝试不改变任何内容,也不绘制任何内容,与浏览器一致。承载的行数多于其绘制行数的工具卡片与上下文块,结尾都是同一条标记:该块被对话记录的焦点持有时为 `… <n> more rows · Space expands`,否则为 `… <n> more rows · Ctrl+O expands`。回复中的围栏代码、`read` 卡片的文件行、`edit` 或 `write` diff 卡片的变更行——其中 `+` 新增项标为绿色、`-` 删除项标为红色,符号后的源文本按文件扩展名对应的语言绘制——以及 `!` / `!!` 草稿、用户 shell 的 `$ command` 行(其 `$` 用强调色)与终端工具卡片中的 shell 命令,都使用语法高亮,配色主题由终端自身的背景在明暗之间选定;某种语言的语法会在第一个用到它的代码块出现时才加载,因此该块先以纯文本绘制、随后被重绘为彩色;这里没有对应语法的语言、既不支持 24 位也不支持 256 色的终端,以及 `codeHighlight: false`,都会把每个代码块画成纯文本。标题与列表标记使用暖橙色,链接与行内代码使用紫色,引用保持暗色。流式推理、回复文字与工具参数到达时先入队,再按帧(默认约每秒 60 帧)分批绘制,因此一次网络突发会分摊到 `streamPaceFrames` 帧里,而不是一次落下,队列也从不拖慢模型调用。流式回复文字会淡入,而且每个词各走各的时钟:一个词以接近终端背景色的亮度出现,并经 `streamFadeSteps` 次、每次 `streamFadeStepMs` 提亮到它最终稳定的颜色,因此流得更快只会留下更长的一串正在提亮的词,而不会更暗。流式推理与工具卡片在同一时长内浮出:它们以抬高的颜色出现,再退回到稳定时的暗色斜体或调色板颜色;从持久化历史重绘的卡片不带淡入,已经稳定下来的文字也不会再被调暗。
43
+ 每一帧都从终端左右两边各内缩一列绘制,因此对话记录与停靠的界面组件都不会有任何一行贴到两侧边缘。页眉在标题生成或设置后以标题命名会话,并在旁边显示 id。对话记录在终端自身的回滚区中增长:你的提示以 `❯` 开头,启用颜色时铺在一条通栏的着色背景带上(附件列在其下),而在已有模型步骤的轮次中被引导或注入的提示以暗色文字铺在更深的背景带上,退到它所加入的轮次之后,assistant 的推理以暗色斜体显示在 `✻ Thinking` 标题之下、Markdown 回复上方,每次工具调用是一张卡片,含状态符号(运行中为按工具族混合花朵、绽放与星形的黄色旋转指示、完成为绿色 `◆`、失败为红色 `◆`)、粗体工具名、以紫色显示的呈现器标题(去掉呈现器重复写出的工具名,因此 `Read src/app.ts` 画成 `read src/app.ts`;shell 卡片取该次调用自身的摘要,绝不取命令,命令只由卡片的 `$` 行绘制一次)、运行中的一行加载标记,以及折叠到 `toolPreviewLines` 行的正文。顶层 workflow 调用还会在该卡片旁另绘一次运行:运行名、成员数与状态,然后是每个阶段和已启动的成员。运行中的层级,以及含失败、取消或中断成员的层级会展开;干净完成的层级保持折叠。在运行或阶段上按 Space 或 Enter 折叠该层,在仍在运行的成员上按 Enter 只会在该子会话是本会话的直接子会话且仍在本进程运行时打开它。卡片在模型开始调用时出现,先画标题,其下各行在约 `toolRevealFrames` 帧内逐行展开;工具回答后,结果行也以同样方式展开并浮出。`edit` 或 `write` diff 卡片把每一新增行整行铺满绿色背景、每一删除行整行铺满红色背景,删除的旧行在上、新增的新行在下,并把 `+` 与 `-` 画成各自更亮的颜色,使符号从填充色中读得出来;折行续行只延续填充色,不再画第二个符号;工具应用变更后,已应用的 hunk 取代调用时携带的 diff,并在每行前标出文件行号,新增行与未变行用新文件的行号,删除行用旧文件的行号。`subagent` 与 `subagent_*` 卡片折叠时只画一行,行首是同样的状态符号,运行中旋转,交给后台的子 agent 则为暗色 `◆`:运行中显示工具名、任务描述,以及调用指定的模型与 `background`;结束后描述变暗,右端标出 `[done]`,交给后台的子 agent 标 `[started]`,失败标 `[failed]`。在被标记的行上按 `Space`,或按 `Ctrl+O`,即可展开完整卡片。非空的系统提示词与每一条注入的上下文——instructions、catalogs、snapshots、notices、relays 与 recalls——绘制为暗色 `⬡` 标题,其下是面向模型文本的前 `contextPreviewLines` 行,快照的每一份贡献具名写在其自身各行上方;空的系统提示词则省略。一次压缩(compaction)——无论来自 `/compact` 还是自动触发——绘制为一个上下文块,其强调色 `⬡` 标题写明来源,以及被替换内容与摘要各自的估算 token 数,如 `context compacted by /compact · ~6.4k → ~0.9k tokens` 或 `context compacted automatically in turn 12 · …`;标题之下,`compressed` 写明摘要替换的条目数与轮次、其中的每条提示(最多五条,每条一行),以及回复、按工具分列的工具结果、上下文块与更早摘要的计数,`preserved` 写明系统提示词以及之后每一轮仍逐字保留的内容;这两部分始终绘出,其下的摘要则像其他上下文块一样折叠到 `contextPreviewLines` 行。检查点消息本身不再重复绘制。日志以错误结束的 `/compact` 尝试会在会话重绘时打印 `/compact failed · <error>`,因为实时运行的命令会自己报告失败;失败的自动尝试不改变任何内容,也不绘制任何内容,与浏览器一致。承载的行数多于其绘制行数的工具卡片与上下文块,结尾都是同一条标记:该块被对话记录的焦点持有时为 `… <n> more rows · Space expands`,否则为 `… <n> more rows · Ctrl+O expands`。回复中的围栏代码、`read` 卡片的文件行、`edit` 或 `write` diff 卡片的变更行——其中 `+` 新增项标为绿色、`-` 删除项标为红色,符号后的源文本按文件扩展名对应的语言绘制——以及 `!` / `!!` 草稿、用户 shell 的 `$ command` 行(其 `$` 用强调色)与终端工具卡片中的 shell 命令,都使用语法高亮,配色主题由终端自身的背景在明暗之间选定;某种语言的语法会在第一个用到它的代码块出现时才加载,因此该块先以纯文本绘制、随后被重绘为彩色;这里没有对应语法的语言、既不支持 24 位也不支持 256 色的终端,以及 `codeHighlight: false`,都会把每个代码块画成纯文本。标题与列表标记使用暖橙色,链接与行内代码使用紫色,引用保持暗色。流式推理、回复文字与工具参数到达时先入队,再按帧(默认约每秒 60 帧)分批绘制,因此一次网络突发会分摊到 `streamPaceFrames` 帧里,而不是一次落下,队列也从不拖慢模型调用。流式回复文字会淡入,而且每个词各走各的时钟:一个词以接近终端背景色的亮度出现,并经 `streamFadeSteps` 次、每次 `streamFadeStepMs` 提亮到它最终稳定的颜色,因此流得更快只会留下更长的一串正在提亮的词,而不会更暗。流式推理与工具卡片在同一时长内浮出:它们以抬高的颜色出现,再退回到稳定时的暗色斜体或调色板颜色;从持久化历史重绘的卡片不带淡入,已经稳定下来的文字也不会再被调暗。
44
44
 
45
45
  对话记录下方依次是 agent 工作时的旋转指示——`thinking`、`writing`、`calling <tool>`、重试或 `compacting`,各自旁边是它自己的盲文动画:环绕的点、逐行填满的线、绕行的单点、滑动的横条,或沉降又回满的方格——标签单词上带着一道扫过的高亮,并带着当前这次模型调用的实时 `↑` 发送与 `↓` 接收 token,以紧凑的 `k` / `M` / `B` 计数,随数据流入增长,并在提供方的 usage 块到达后落定——任何打开的提示、有消息等待时的带框 follow-ups 列表、本轮 todo 与最新后代行的 activity board(有行时才绘制;已完成内容划掉,状态符号以绿色、黄色或青色显示,进行中的那一项为旋转指示,todo 最多四行其后 `+<n> more`,不是焦点区域,在 `turn/end` 与 bind 时消失)、编辑器、子 agent 面板,以及页脚:未聚焦时是一行由两端向内构建的状态栏。编辑器的光标是终端自身的闪烁竖条:应用在启动时请求这一形状,退出时把你的默认形状还回去,而状态栏或面板持有键盘期间完全不绘制光标。模型与入口按键带有颜色;进行中的轮次、上下文与 todo 信息分别使用黄色、紫色与绿色。模型锚定在左端且永不丢弃——超过 20 列时退回到裸模型名,只有仍然过宽的标签才会被省略号截断——离开编辑器的那两个按键则锚定在右端,写作 `Shift+↑ read · Shift+↓ status`,有 follow-ups 等待时则写作 `Shift+↑ select · Shift+↓ status`,窄到一定程度收缩为 `Shift+↑↓ nav`,不足 40 列时整体丢弃。关键事实填满剩下的中间部分,按状态栏顺序排列:推理强度(选择把推理交给模型时标为 `effort default`)、进行中轮次的已用时间、上下文窗口百分比、todo 计数,以及 workspace 路径(过长时以 `~` 与 `…/` 缩短)。中间部分容纳不下的每个分段都折进末尾的 `+N`,未聚焦行从不绘制的那些分段也一并折入——权限预设、token 用量(会话合计加上进行中的这次调用)、来自投影接缝的目标与计划模式标记,以及待发送附件的数量。模型请求重试以通知形式出现,与浏览器标记承载的事实相同。
46
46
 
@@ -60,7 +60,7 @@ dsh tui --no-open # print sign-in URLs without opening a
60
60
 
61
61
  ### 按键与命令
62
62
 
63
- 对话记录、编辑器、子 agent 面板与状态栏构成垂直方向键走查:在最新小节上按 `Down`、在子 agent 面板第一行上按 `Up`、在没有绘制子 agent 面板时于状态栏上按 `Up`,都会落到光标处。follow-ups 列表位于输入框上方;绘制该列表时,`Shift+Up` 会进入它,它也加入 `Tab` 走查。activity board 位于 follow-ups 与输入之间,不是焦点区域。编辑器以外的区域持有键盘时,`Tab` 与 `Shift+Tab` 走遍已绘制的各区域,并在两端环绕;在编辑器中,`Tab` 采用给出的补全,`Shift+Tab` 打开推理强度选择器。在其中任何一个区域按下可打印键都会回到编辑器并在那里输入,因此在阅读时开始写的句子会落在它所指向的地方;对话记录中的 `Space` 是唯一的例外,它折叠被标记的工具卡片或上下文块。`Ctrl+G`、`Ctrl+O`、`Ctrl+B`、`Ctrl+T`、`Ctrl+P` 与 `Ctrl+L` 在这些区域中含义完全相同,而 `Ctrl+C` 与 `Ctrl+D` 会先把键盘交还编辑器再行动。提示与阅读器则各自持有整条按键流,并以交还键盘的方式应答 `Ctrl+C`。
63
+ 对话记录、编辑器、子 agent 面板与状态栏构成垂直方向键走查:在最新小节上按 `Down`、在子 agent 面板第一行上按 `Up`、在没有绘制子 agent 面板时于状态栏上按 `Up`,都会落到光标处。follow-ups 列表位于输入框上方;绘制该列表时,`Shift+Up` 会进入它,它也加入 `Tab` 走查。activity board 位于 follow-ups 与输入之间,不是焦点区域。编辑器以外的区域持有键盘时,`Tab` 与 `Shift+Tab` 走遍已绘制的各区域,并在两端环绕;在编辑器中,`Tab` 采用给出的补全,`Shift+Tab` 打开推理强度选择器。在其中任何一个区域按下可打印键都会回到编辑器并在那里输入,因此在阅读时开始写的句子会落在它所指向的地方;对话记录中的 `Space` 是唯一的例外,它折叠被标记的工具卡片、上下文块,或工作流运行与阶段。`Ctrl+G`、`Ctrl+O`、`Ctrl+B`、`Ctrl+T`、`Ctrl+P` 与 `Ctrl+L` 在这些区域中含义完全相同,而 `Ctrl+C` 与 `Ctrl+D` 会先把键盘交还编辑器再行动。提示与阅读器则各自持有整条按键流,并以交还键盘的方式应答 `Ctrl+C`。
64
64
 
65
65
  屏幕上写出的每个按键都画成一枚徽标,以强调色的斜体与周围文字区分开:出现在状态栏、各区域的按键提示、选择器与提示、临时提示行、折叠标记、通知、`/help` 与阅读器中。设置 `mouse: true` 后,左键点击一枚徽标就按下该键,与键入它完全相同:点击状态栏中的 `Shift+↓` 会走到状态栏,点击已布防的停止提示行中的 `Esc` 会停止轮次,`↑↓` 这类成对箭头中的每个箭头各自按下自己的键。开启它会打开终端的鼠标报告:滚轮在最新小节打开全屏阅读器并向上或向下滚动,但审批或提问打开期间不响应滚轮。滚轮与普通的点击拖动交给应用,而不再滚动终端的回滚缓冲区或选择文本;大多数终端在按住 `Shift`(iTerm2 中为 `Option`)时仍可滚动与选择。
66
66
 
@@ -475,6 +475,7 @@ The user moved this call to the background. It keeps running as job <id>. You ar
475
475
  - **通过 `dsh` 启动器运行**——以其他方式启动该 profile 会在启动时失败,因为只有启动器能请求进程退出。
476
476
  - **`/btw` 旁路 agent 靠工具名称与沙箱保持只读**——`btwTools` 只能列出读取类工具,因为旁路 agent 与工作 agent 共享工作区;命令工具可以读取 `read-only` 沙箱模式允许的任何内容,而没有会约束命令的执行器时命令工具会被隐藏。它只继承工作会话已记录的内容:仍在流式输出的回复文本不在其中。它的日志像子 agent 会话一样被存储,并在 `/resume` 与 `/sessions` 中隐藏,Web 没有 `/btw`。
477
477
  - **被移走的调用仍绑定其轮次并返回文本**——工具运行时把轮次的信号融合进每个调用,因此即便按过 `Ctrl+B`,在派发该调用的轮次上按 `Esc` 仍会停止它;作业结果是字符串,因此调用结果中的其他内容块会被写成 `[image omitted]` 之类;移走调用需要 `ctx.jobs` 与 `dsh-tool-jobs`,base profile 已组合二者。
478
+ - **工作流运行块只显示身份与状态**——顶层 workflow 调用在工具卡片旁另绘运行块:运行名、成员数、状态、阶段和已启动的成员。运行中与异常的层级默认展开,干净完成的层级保持折叠。在运行或阶段上按 Space 或 Enter 折叠该层。在仍在运行的成员上按 Enter 只会在它是本会话的直接子会话且仍在本进程运行时打开,不会恢复已结束的成员。脚本留在工具卡片上。后台运行在其作业仍存活时,启动轮次结束后仍显示为运行中;重放时没有存活作业的未结束运行显示为 interrupted。阶段与日志行留在 `/jobs`,作业返回值仍由 `job_output` 交给模型。
478
479
  - **`!` 是一次性的,也不是 TTY**——每一行都是一次新的 `ctx.shell.run`;没有持久 shell,也不能跑交互式程序。Web 编辑器不拦截 `!`。命令行上的可选首条提示始终是用户消息。
479
480
 
480
481
  <a id="dev-note"></a>