@deepseek-ai/dsh-terminal-bash 0.2.0-rc.2 → 0.2.1-alpha.2

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.i18n.yaml CHANGED
@@ -15,8 +15,8 @@
15
15
  en: d152484eb41ac6b4
16
16
  zh: 09388d293f9be9cb
17
17
  /deepseek-ai-dsh-terminal-bash/use-this-package:
18
- en: 13e1b604a235290e
19
- zh: 5292c92ffe20537e
18
+ en: d8e828f8e99fe4f1
19
+ zh: 75c5823fe6364a11
20
20
  /deepseek-ai-dsh-terminal-bash/use-this-package/when-to-choose-it:
21
21
  en: f4304ced55e55d4f
22
22
  zh: 739d7a16691e4cc0
@@ -39,8 +39,8 @@
39
39
  en: 97f4f07114f5a995
40
40
  zh: d30b07058a3103c7
41
41
  /deepseek-ai-dsh-terminal-bash/understand-the-implementation/design-concept:
42
- en: 5808eba7c8ff1993
43
- zh: c85f1ab0a869c177
42
+ en: 1801aaa763743049
43
+ zh: b8c8158a63ed6055
44
44
  /deepseek-ai-dsh-terminal-bash/understand-the-implementation/source-map:
45
45
  en: 9a525f7a7228a09b
46
46
  zh: d57537edfacc9f8b
@@ -54,8 +54,8 @@
54
54
  en: a88b693ec539ac28
55
55
  zh: a309bbe671166027
56
56
  /deepseek-ai-dsh-terminal-bash/further-exploration:
57
- en: 648ee87712ed5c66
58
- zh: 6444df8b1fabbc17
57
+ en: 0c44b6dab2f819b7
58
+ zh: bdd3da50d9180977
59
59
  /deepseek-ai-dsh-terminal-bash/model-experience:
60
60
  en: 215e7ba838619b7b
61
61
  zh: a311da3843709f90
@@ -87,5 +87,5 @@
87
87
  en: 2dc221de0d3a76a7
88
88
  zh: 822cef044e765459
89
89
  /deepseek-ai-dsh-terminal-bash/known-limitations-and-deferred-work/dev-note:
90
- en: 979c4600ed8a81d5
91
- zh: 4016ea615f638036
90
+ en: e67f633dc6fe7773
91
+ zh: 3bb0c20c93f16f98
package/README.md CHANGED
@@ -25,6 +25,8 @@ English | [中文](README.zh.md)
25
25
  <a id="use-this-package"></a>
26
26
  ## Use this package
27
27
 
28
+ A terminal without an explicit initial directory starts in the owner's current Session directory. Its sandbox permission root remains governed by Session policy.
29
+
28
30
  Mount this backend when a composition needs persistent shell sessions — state such as cwd, exported variables, functions, or running interactive children must survive across tool calls. It is the default `shell` type: a composition that mounts `@deepseek-ai/dsh-terminal` without it has no sessions to open.
29
31
 
30
32
  ### When to choose it
@@ -85,7 +87,7 @@ This section explains the design behind the backend and points at the code that
85
87
 
86
88
  One backend serves both dialects: bash and pwsh share the same session machinery — sanitizer, bounded buffers, readiness polling, cancellation, and teardown — and differ only in argv, environment, and prompt installation. Bash receives a private marker through `PS1` plus `PROMPT_COMMAND`. Pwsh writes a prompt function, pins UTF-8 console encoding, and publishes startup only after the backend reports `stdin_read`; echoed setup text cannot publish the shell. A zero-scrollback `@xterm/headless` instance consumes raw PTY data and returns terminal-protocol replies through the same handle, while the line sanitizer remains the only output projection.
87
89
 
88
- Scrollback and unread send output retain independently owned strings with incremental byte and newline counts, so sanitized slices cannot retain discarded control sequences. Appending and evicting text takes amortized time proportional to incoming text; reads assemble the retained chunks. Retention preserves code-point boundaries and counts the empty line after a trailing newline. The [retention decision](../../../.agents/notes/implemented/bug-fix/2026-09-11-incremental-terminal-retention.md) owns the complexity and measurement rationale.
90
+ Scrollback and unread send output retain independently owned strings with incremental byte and newline counts, so sanitized slices cannot retain discarded control sequences. Appending and evicting text takes amortized time proportional to incoming text; reads assemble the retained chunks. Retention preserves code-point boundaries and counts the empty line after a trailing newline. The [historical retention decision](../../../.agents/notes/archived/bug-fix/2026-09-11-incremental-terminal-retention.md) records the complexity and measurement rationale.
89
91
 
90
92
  ### Source map
91
93
 
@@ -119,7 +121,7 @@ Read these pages when the package-level contract is not enough. They move from t
119
121
 
120
122
  - [Terminal subsystem reference](../../../docs/subsystems/terminal.md) — the service contract this backend implements and the generated `ctx.terminals` surface.
121
123
  - [terminal service](../terminal/README.md) — backend registration, owner fencing, and cleanup semantics.
122
- - [tool-terminal tools](../tool-terminal/README.md) — the model-facing tools that operate sessions.
124
+ - [tool-terminal tools](../../experimental/tool-terminal/README.md) — the model-facing tools that operate sessions.
123
125
  - [Subprocess seam](../../../docs/subsystems/subprocess.md) — the terminal primitive that owns PTY allocation and process-tree cleanup.
124
126
  - [Persistent PTY Agent Note](../../../.agents/notes/implemented/feature/2026-07-16-persistent-pty-sessions.md) — the capability design and deferred boundaries.
125
127
  - [Persistent pwsh Agent Note](../../../.agents/notes/archived/architecture/2026-08-11-pwsh-persistent-pty.md) — the Windows substrate and the pwsh dialect.
@@ -179,5 +181,3 @@ These limits define where the backend is a poor fit or needs special operational
179
181
  None.
180
182
 
181
183
  </details>
182
-
183
- **Runtime invariant:** No companion is published. Readiness, terminal buffers, and process-tree state are private per-session implementation state, and the backend publishes no independent lifecycle stream or snapshot.
package/README.zh.md CHANGED
@@ -25,6 +25,8 @@ kind: "package-reference"
25
25
  <a id="use-this-package"></a>
26
26
  ## 使用本包
27
27
 
28
+ 未显式指定初始目录的终端从所属 Session 的当前目录启动。沙箱权限根目录仍由 Session 策略控制。
29
+
28
30
  当组合需要持久 shell 会话时挂载此后端——cwd、导出的变量、函数或正在运行的交互式子进程等状态必须跨工具调用存活。它是默认的 `shell` 类型:组合只挂载 `@deepseek-ai/dsh-terminal` 而不挂载它时,将没有任何会话可打开。
29
31
 
30
32
  ### 何时选择
@@ -85,7 +87,7 @@ shell 在整个生命周期内运行在有效的沙箱边界之下。当所有
85
87
 
86
88
  一个后端服务两种方言:bash 与 pwsh 共享同一套会话机制——清理器、有界缓冲区、就绪轮询、取消与关闭——只在 argv、环境与提示符安装方式上不同。bash 通过 `PS1` 加 `PROMPT_COMMAND` 接收私有标记。pwsh 会写入提示符函数、固定 UTF-8 控制台编码,并只在后端报告 `stdin_read` 后发布启动;回显的设置文本不能发布 shell。一个不保留 scrollback 的 `@xterm/headless` 实例会消费原始 PTY 数据,并通过同一句柄返回终端协议响应;逐行 sanitizer 仍是唯一输出投影。
87
89
 
88
- Scrollback 和尚未读取的发送输出保留独立拥有的字符串,并增量维护字节数与换行符数,因此清理后的切片不会保留已丢弃的控制序列。追加与淘汰文本的摊还耗时与输入文本量成正比;读取时才拼接保留的分片。保留策略维持码点边界,并将末尾换行符之后的空行计入行数。[保留策略决策](../../../.agents/notes/implemented/bug-fix/2026-09-11-incremental-terminal-retention.zh.md)记录复杂度与测量依据。
90
+ Scrollback 和尚未读取的发送输出保留独立拥有的字符串,并增量维护字节数与换行符数,因此清理后的切片不会保留已丢弃的控制序列。追加与淘汰文本的摊还耗时与输入文本量成正比;读取时才拼接保留的分片。保留策略维持码点边界,并将末尾换行符之后的空行计入行数。[历史保留策略决策](../../../.agents/notes/archived/bug-fix/2026-09-11-incremental-terminal-retention.md)记录复杂度与测量依据。
89
91
 
90
92
  ### 源码地图
91
93
 
@@ -119,7 +121,7 @@ Scrollback 和尚未读取的发送输出保留独立拥有的字符串,并增
119
121
 
120
122
  - [终端子系统参考](../../../docs/subsystems/terminal.zh.md)——此后端实现的服务约定与生成的 `ctx.terminals` 接口面。
121
123
  - [terminal 服务](../terminal/README.zh.md)——后端注册、所有者限制与清理语义。
122
- - [tool-terminal 工具](../tool-terminal/README.zh.md)——操作会话的面向模型工具。
124
+ - [tool-terminal 工具](../../experimental/tool-terminal/README.zh.md)——操作会话的面向模型工具。
123
125
  - [子进程 seam](../../../docs/subsystems/subprocess.zh.md)——负责 PTY 分配与进程树清理的终端原语。
124
126
  - [持久 PTY Agent Note](../../../.agents/notes/implemented/feature/2026-07-16-persistent-pty-sessions.zh.md)——能力设计与暂缓边界。
125
127
  - [持久 pwsh Agent Note](../../../.agents/notes/archived/architecture/2026-08-11-pwsh-persistent-pty.md)——Windows 基底与 pwsh 方言。
@@ -179,5 +181,3 @@ Scrollback 和尚未读取的发送输出保留独立拥有的字符串,并增
179
181
  无。
180
182
 
181
183
  </details>
182
-
183
- **运行时不变式:** 不发布伴生入口。就绪状态、终端缓冲区与进程树状态都是各会话私有的实现状态,后端不发布独立的生命周期流或快照。
package/lib/index.js CHANGED
@@ -907,7 +907,8 @@ const inject = [
907
907
  "terminals",
908
908
  "sandboxPolicy",
909
909
  "sessionProjections",
910
- "subprocess"
910
+ "subprocess",
911
+ "workingDirectory"
911
912
  ];
912
913
  const sandboxModeFences = /* @__PURE__ */ new WeakMap();
913
914
  function ensureSandboxModeFence(ctx, owner) {
@@ -1052,7 +1053,7 @@ var BashTerminalBackend = class {
1052
1053
  if (argv[0] === void 0) throw new Error("terminal-bash: sandbox returned empty argv");
1053
1054
  const terminal = await this.spawnTerminal({
1054
1055
  argv,
1055
- cwd: spec.cwd ?? policy.workspaceRoot,
1056
+ cwd: spec.cwd ?? await this.ctx.workingDirectory.ensure(spec.owner, spec.signal),
1056
1057
  env: childEnvironment(spec, this.config.shellDialect),
1057
1058
  rows: this.config.rows,
1058
1059
  cols: this.config.cols,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-terminal-bash",
3
3
  "description": "Persistent shell PTY backend over the DeepSeek Harness subprocess terminal primitive",
4
- "version": "0.2.0-rc.2",
4
+ "version": "0.2.1-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,30 +27,32 @@
27
27
  ],
28
28
  "license": "MIT",
29
29
  "peerDependencies": {
30
- "@deepseek-ai/dsh-terminal": "0.2.0-rc.2",
31
- "@deepseek-ai/dsh-sandbox": "0.2.0-rc.2",
32
- "@deepseek-ai/dsh-sandbox-policy": "0.2.0-rc.2",
33
- "@deepseek-ai/dsh-agent": "0.2.0-rc.2",
34
- "@deepseek-ai/dsh-session": "0.2.0-rc.2",
35
- "@deepseek-ai/dsh-subprocess": "0.2.0-rc.2",
36
- "@deepseek-ai/dsh-session-projection": "0.2.0-rc.2",
37
- "@deepseek-ai/cordis": "~4.0.4"
30
+ "@deepseek-ai/dsh-agent": "0.2.1-alpha.2",
31
+ "@deepseek-ai/dsh-terminal": "0.2.1-alpha.2",
32
+ "@deepseek-ai/dsh-sandbox": "0.2.1-alpha.2",
33
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.1-alpha.2",
34
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.2",
35
+ "@deepseek-ai/dsh-subprocess": "0.2.1-alpha.2",
36
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1",
37
+ "@deepseek-ai/dsh-session-projection": "0.2.1-alpha.2",
38
+ "@deepseek-ai/dsh-working-directory": "0.2.1-alpha.2"
38
39
  },
39
40
  "dependencies": {
40
- "@xterm/headless": "^6.0.0",
41
- "@deepseek-ai/dsh-lazy-require": "0.2.0-rc.2",
42
- "@deepseek-ai/dsh-pwsh-local": "0.2.0-rc.2",
43
- "@deepseek-ai/schemastery": "~3.18.4"
41
+ "@deepseek-ai/dsh-lazy-require": "0.2.1-alpha.2",
42
+ "@deepseek-ai/dsh-pwsh-local": "0.2.1-alpha.2",
43
+ "@deepseek-ai/schemastery": "~3.18.5-alpha.1",
44
+ "@xterm/headless": "^6.0.0"
44
45
  },
45
46
  "devDependencies": {
46
- "@deepseek-ai/dsh-agent": "0.2.0-rc.2",
47
- "@deepseek-ai/dsh-agent-loop-testkit": "0.2.0-rc.2",
48
- "@deepseek-ai/dsh-terminal": "0.2.0-rc.2",
49
- "@deepseek-ai/dsh-sandbox": "0.2.0-rc.2",
50
- "@deepseek-ai/dsh-sandbox-policy": "0.2.0-rc.2",
51
- "@deepseek-ai/dsh-session": "0.2.0-rc.2",
52
- "@deepseek-ai/dsh-subprocess": "0.2.0-rc.2",
53
- "@deepseek-ai/dsh-subprocess-local": "0.2.0-rc.2",
54
- "@deepseek-ai/cordis": "~4.0.4"
47
+ "@deepseek-ai/dsh-agent": "0.2.1-alpha.2",
48
+ "@deepseek-ai/dsh-agent-loop-testkit": "0.2.1-alpha.2",
49
+ "@deepseek-ai/dsh-terminal": "0.2.1-alpha.2",
50
+ "@deepseek-ai/dsh-sandbox": "0.2.1-alpha.2",
51
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.1-alpha.2",
52
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.2",
53
+ "@deepseek-ai/dsh-subprocess": "0.2.1-alpha.2",
54
+ "@deepseek-ai/dsh-subprocess-local": "0.2.1-alpha.2",
55
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1",
56
+ "@deepseek-ai/dsh-working-directory": "0.2.1-alpha.2"
55
57
  }
56
58
  }