@deepseek-ai/dsh-tool-bash-persistent 0.1.1-rc.2 → 0.1.2-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 +2 -2
- package/README.md +120 -12
- package/README.zh.md +129 -21
- package/package.json +24 -23
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/shell/tool-bash-persistent/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: e7e75c49ecf3249b13ad28180420a9e980b8f0cb
|
|
6
|
+
README.zh.md: 80831e3516199068c52e26d7d1a2fdc64a2907bc
|
package/README.md
CHANGED
|
@@ -1,18 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "The model-facing persistent bash tool for users and maintainers choosing, configuring, or debugging owner-scoped shell state that survives across calls."
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# @deepseek-ai/dsh-tool-bash-persistent
|
|
2
7
|
|
|
3
8
|
English | [中文](README.zh.md)
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
`dsh-tool-bash-persistent` gives the agent a `bash` tool whose shell state persists across calls for the owning agent: cwd, exported variables, functions, and background jobs survive between commands. Each agent gets its own shell backed by an owner-scoped PTY session from the terminal service, and commands for the same agent run one at a time. Configuration selects the PTY backend and the wall-clock limit for one command; a timeout or an explicit `exit` closes the shell, and the next call starts fresh. It complements the one-shot `dsh-tool-bash` tool — choose it when work needs cross-call state. Mount it together with a terminal backend such as `dsh-terminal-bash` and the `ctx.terminals` service.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Use this package](#use-this-package)
|
|
17
|
+
- [Understand the implementation](#understand-the-implementation)
|
|
18
|
+
- [Further Exploration](#further-exploration)
|
|
19
|
+
- [Model Experience](#model-experience)
|
|
20
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
21
|
+
- [Dev Note](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## Use this package
|
|
27
|
+
|
|
28
|
+
Load this plugin in any composition where the agent should keep shell state between commands — for example long build sessions, activated environments, or scripts that export variables for later steps. It registers the `bash` tool and requires the `ctx.tools` and `ctx.terminals` services plus an owning agent session at execution time.
|
|
29
|
+
|
|
30
|
+
### When to choose it
|
|
31
|
+
|
|
32
|
+
Choose the persistent tool when work depends on cross-call state: a one-shot `dsh-tool-bash` call cannot remember a `cd` or an exported variable. Choose the one-shot tool when every command should start from a known, clean environment, or when the command is short and self-contained. Commands that need interactive stdin are unsupported here — a foreground child that reads input blocks until the command timeout — so interactive work belongs to the terminal tools.
|
|
33
|
+
|
|
34
|
+
### Minimal configuration
|
|
35
|
+
|
|
36
|
+
The default `shell` backend starts an interactive bash through `dsh-terminal-bash`; deployments may register another PTY backend and select it by name.
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
- name: '@deepseek-ai/dsh-terminal'
|
|
40
|
+
- name: '@deepseek-ai/dsh-terminal-bash'
|
|
41
|
+
- name: '@deepseek-ai/dsh-tool-bash-persistent'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
| Field | Default | Meaning |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `backendType` | `shell` | Registered PTY backend used for each agent's shell |
|
|
47
|
+
| `timeoutMs` | `300,000` | Wall-clock limit for one command; timeout closes the shell |
|
|
48
|
+
| `maxOutputChars` | `16,000` | Maximum retained command-output characters; fixed diagnostics are added afterward |
|
|
49
|
+
| `description` | `Run commands in a persistent bash shell. State, including the current directory and exported environment variables, persists across calls for this agent.` | Model-facing environment contract; deployments may describe their environment |
|
|
50
|
+
|
|
51
|
+
The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-tool-bash-persistent) is the exhaustive source for every accepted field and its JSDoc.
|
|
52
|
+
|
|
53
|
+
### What the agent can rely on
|
|
54
|
+
|
|
55
|
+
Commands share one shell per agent, so state persists until an `exit`, a timeout, or a reset — each of which closes the shell and tells the agent the next call starts from the workspace with a fresh directory and environment. Results exclude the private completion markers; a non-zero wrapped command appends `[exit code: N]`, and a shell that exits before reporting that status instead appends `[shell exited: code N]`, `[shell killed by signal: SIG]`, or `[shell exited]`, then resets. Long output keeps the earliest retained prefix plus a clipping notice; if the terminal has already dropped that prefix, the result says so explicitly rather than presenting a tail as complete output.
|
|
56
|
+
|
|
57
|
+
### What can go wrong
|
|
58
|
+
|
|
59
|
+
A call without an owning agent session fails with `bash requires an owning agent session`, and a composition without a PTY backend activates the tool but fails its first call with `no PTY backend registered for "shell"`. An interactive foreground child (for example a REPL) returns early with partial output only where the backend proves its stdin wait; elsewhere the call runs to `timeoutMs`, which closes the uncertain shell and reports the reset. Cancellation also resets and discards the result, even when a complete status marker is already observable.
|
|
60
|
+
|
|
61
|
+
-----
|
|
62
|
+
|
|
63
|
+
<a id="understand-the-implementation"></a>
|
|
64
|
+
## Understand the implementation
|
|
6
65
|
|
|
7
|
-
|
|
66
|
+
<details>
|
|
67
|
+
<summary>Implementation internals — click to expand</summary>
|
|
8
68
|
|
|
9
|
-
|
|
10
|
-
|---|---:|---|
|
|
11
|
-
| `backendType` | `shell` | Registered PTY backend used for each Agent shell. |
|
|
12
|
-
| `timeoutMs` | `300000` | Wall-clock limit for one command; timeout closes the shell. |
|
|
13
|
-
| `maxOutputChars` | `16000` | Maximum retained command-output characters; fixed diagnostics are added afterward. |
|
|
14
|
-
| `description` | Persistent-shell description | Model-facing environment contract. |
|
|
69
|
+
This section explains the design decisions behind the tool and points at the code that realizes them; the observable behavior is fully covered in [Use this package](#use-this-package).
|
|
15
70
|
|
|
71
|
+
### Design philosophy
|
|
72
|
+
|
|
73
|
+
- **One shell per owner, nothing shared.** The shell registry keys every session by the calling `Agent`, so concurrent agents never share state, and commands for the same agent are serialized through a per-owner queue.
|
|
74
|
+
- **Marker-anchored extraction.** Each command is wrapped with unique start/end markers carrying the exit status; the tool polls the PTY scrollback and extracts the span between the real markers, so prompts and echoed input never leak into results.
|
|
75
|
+
- **Reset, never repair.** Any uncertain state — an explicit `exit`, a timeout, a send failure, an abort — closes the shell and starts the next call fresh, because a half-known shell is worse than a clean one.
|
|
76
|
+
- **Owner-scoped lifecycle.** Shells are created lazily on first use and killed on plugin disposal or owner teardown; the owner-scoped `ctx.terminals` service fences every operation to the owning agent.
|
|
77
|
+
|
|
78
|
+
### Source map
|
|
79
|
+
|
|
80
|
+
| File | Role |
|
|
81
|
+
|---|---|
|
|
82
|
+
| [`src/index.ts`](src/index.ts) | Plugin entry: shell registry, command wrapping, scrollback polling, extraction and rendering |
|
|
83
|
+
| [`src/invariant.ts`](src/invariant.ts) | Invariant companion (no runtime invariant; shell reuse is observable through tool execution) |
|
|
84
|
+
|
|
85
|
+
### Command flow
|
|
86
|
+
|
|
87
|
+
A first command spawns the shell through `ctx.terminals.spawn`, disables input echo (`stty -echo`), and waits for readiness. Each command is then wrapped into one physical line — a printf of the start marker, the command body escaped with `$'…'`, and a printf of the end marker plus `$?` — so embedded newlines cannot leak terminal prompts into the result. The tool polls the scrollback in 1,000-line pages until the end marker appears, extracts the span, and renders it with any status marker. A timeout aborts the deadline, captures the partial output, and resets the shell.
|
|
88
|
+
|
|
89
|
+
</details>
|
|
90
|
+
|
|
91
|
+
-----
|
|
92
|
+
|
|
93
|
+
<a id="further-exploration"></a>
|
|
94
|
+
## Further Exploration
|
|
95
|
+
|
|
96
|
+
Read these pages when the package-level contract is not enough. They move from the terminal family to the seam, the backends, and the design note behind owner-scoped sessions.
|
|
97
|
+
|
|
98
|
+
- [terminal package map](../../terminal/README.md) — the persistent PTY capability family.
|
|
99
|
+
- [terminal seam](../../terminal/terminal/README.md) — the `ctx.terminals` service behind the tool.
|
|
100
|
+
- [terminal-bash backend](../../terminal/terminal-bash/README.md) — the default `shell` backend.
|
|
101
|
+
- [tool-terminal](../../terminal/tool-terminal/README.md) — six model-facing terminal tools for interactive work.
|
|
102
|
+
- [Persistent PTY sessions Agent Note](../../../.agents/notes/implemented/feature/2026-07-16-persistent-pty-sessions.md) — the owner-scoped session design and its rationale.
|
|
103
|
+
- [Generated tool catalog](../../../docs/tool-catalog.md#deepseek-aidsh-tool-bash-persistent) — the exact `bash` argument schema.
|
|
104
|
+
- [Generated configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-tool-bash-persistent) — every accepted config field and its source declaration.
|
|
105
|
+
|
|
106
|
+
-----
|
|
107
|
+
|
|
108
|
+
<a id="model-experience"></a>
|
|
16
109
|
## Model Experience
|
|
17
110
|
|
|
18
111
|
### Tool schema
|
|
@@ -45,7 +138,22 @@ Append-only tool results follow the reusable request prefix.
|
|
|
45
138
|
|
|
46
139
|
## Known Limitations and Deferred Work
|
|
47
140
|
|
|
48
|
-
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
141
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
These limits define when the tool is a poor fit or needs special care. They are current package constraints, not a task backlog.
|
|
145
|
+
|
|
146
|
+
- **The tool requires an owning Agent and a real PTY backend** — agent-less calls and backends that cannot start an interactive shell fail.
|
|
147
|
+
- **An interactive foreground child returns early with partial output only where the subprocess provider proves its stdin wait** — elsewhere the call runs to `timeoutMs`.
|
|
148
|
+
- **Explicit `exit` and timeout discard shell state** — cancellation also resets and discards the result, even when a complete status marker is already observable; the next call starts a fresh shell.
|
|
149
|
+
- **Environment facts such as network access and package mirrors belong in the configured `description`** — not this package's default.
|
|
150
|
+
|
|
151
|
+
<a id="dev-note"></a>
|
|
152
|
+
### Dev Note
|
|
153
|
+
|
|
154
|
+
<details>
|
|
155
|
+
<summary>Working context for maintainers — click to expand</summary>
|
|
156
|
+
|
|
157
|
+
None.
|
|
158
|
+
|
|
159
|
+
</details>
|
package/README.zh.md
CHANGED
|
@@ -1,51 +1,159 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "面向模型的持久 bash 工具,供选择、配置或排查跨调用保留的按所有者隔离 shell 状态的使用者与维护者阅读。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# @deepseek-ai/dsh-tool-bash-persistent
|
|
2
7
|
|
|
3
8
|
[English](README.md) | 中文
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
`dsh-tool-bash-persistent` 为 agent 提供 `bash` 工具,其 shell 状态对拥有它的 agent 跨调用保留:cwd、导出的变量、函数与后台任务都会在命令之间存活。每个 agent 都有自己由 terminal 服务的按所有者隔离 PTY 会话支撑的 shell,同一 agent 的命令逐个串行执行。配置选择 PTY 后端与单条命令的墙钟上限;超时或显式 `exit` 会关闭 shell,下一次调用从全新状态开始。它补充一次性 `dsh-tool-bash` 工具——当工作依赖跨调用状态时选择它。请与 `dsh-terminal-bash` 等 terminal 后端以及 `ctx.terminals` 服务一起挂载。
|
|
13
|
+
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [使用本包](#use-this-package)
|
|
17
|
+
- [理解实现](#understand-the-implementation)
|
|
18
|
+
- [进一步探索](#further-exploration)
|
|
19
|
+
- [模型体验](#model-experience)
|
|
20
|
+
- [已知限制与延期工作](#known-limitations-and-deferred-work)
|
|
21
|
+
- [开发备注](#dev-note)
|
|
22
|
+
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## 使用本包
|
|
27
|
+
|
|
28
|
+
在 agent 需要在命令之间保持 shell 状态的任何组合中加载本插件——例如长时间构建会话、已激活的环境,或为后续步骤导出变量的脚本。它注册 `bash` 工具,需要 `ctx.tools` 与 `ctx.terminals` 服务,并在执行时需要拥有者 agent 会话。
|
|
29
|
+
|
|
30
|
+
### 何时选择
|
|
31
|
+
|
|
32
|
+
当工作依赖跨调用状态时选择持久工具:一次性 `dsh-tool-bash` 调用无法记住 `cd` 或导出的变量。当每条命令都应从已知、干净的环境开始,或命令又短又独立时,选择一次性工具。这里不支持需要交互 stdin 的命令——读取输入的前台子进程会一直阻塞到命令超时——因此交互工作属于 terminal 工具。
|
|
33
|
+
|
|
34
|
+
### 最小配置
|
|
35
|
+
|
|
36
|
+
默认的 `shell` 后端通过 `dsh-terminal-bash` 启动交互式 bash;部署方可以注册其他 PTY 后端并按名称选择。
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
- name: '@deepseek-ai/dsh-terminal'
|
|
40
|
+
- name: '@deepseek-ai/dsh-terminal-bash'
|
|
41
|
+
- name: '@deepseek-ai/dsh-tool-bash-persistent'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
| 字段 | 默认值 | 含义 |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `backendType` | `shell` | 用于每个 agent shell 的已注册 PTY 后端 |
|
|
47
|
+
| `timeoutMs` | `300,000` | 单条命令的墙钟上限;超时关闭 shell |
|
|
48
|
+
| `maxOutputChars` | `16,000` | 保留的命令输出字符上限;固定诊断信息在其后追加 |
|
|
49
|
+
| `description` | `Run commands in a persistent bash shell. State, including the current directory and exported environment variables, persists across calls for this agent.` | 面向模型的环境约定;部署方可描述自己的环境 |
|
|
50
|
+
|
|
51
|
+
生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-tool-bash-persistent)是每个受支持字段及其 JSDoc 的穷尽式真源。
|
|
52
|
+
|
|
53
|
+
### agent 可以依赖什么
|
|
54
|
+
|
|
55
|
+
命令共享每个 agent 一个 shell,因此状态一直保留到 `exit`、超时或重置——每一种都会关闭 shell 并告诉 agent 下一次调用从工作区的新目录与环境开始。结果排除私有完成标记;非零的包装命令追加 `[exit code: N]`,而在报告该状态前就退出的 shell 改为追加 `[shell exited: code N]`、`[shell killed by signal: SIG]` 或 `[shell exited]`,然后重置。长输出保留最早的已保留前缀并附裁剪通知;若 terminal 已经丢弃该前缀,结果会明确说明,而不是把尾部当作完整输出呈现。
|
|
56
|
+
|
|
57
|
+
### 可能出什么问题
|
|
58
|
+
|
|
59
|
+
没有拥有者 agent 会话的调用会以 `bash requires an owning agent session` 失败,没有 PTY 后端的组合会激活该工具,但首次调用以 `no PTY backend registered for "shell"` 失败。交互式前台子进程(例如 REPL)只有在后端证明其 stdin 等待时才提前返回部分输出;否则调用一直运行到 `timeoutMs`,随后关闭不确定的 shell 并报告重置。取消也会重置并丢弃结果,即使完整状态标记已经可观察。
|
|
60
|
+
|
|
61
|
+
-----
|
|
62
|
+
|
|
63
|
+
<a id="understand-the-implementation"></a>
|
|
64
|
+
## 理解实现
|
|
6
65
|
|
|
7
|
-
|
|
66
|
+
<details>
|
|
67
|
+
<summary>实现细节——点击展开</summary>
|
|
8
68
|
|
|
9
|
-
|
|
10
|
-
|---|---:|---|
|
|
11
|
-
| `backendType` | `shell` | 每个 Agent shell 使用的已注册 PTY 后端。 |
|
|
12
|
-
| `timeoutMs` | `300000` | 单条命令的墙钟时间上限;超时会关闭 shell。 |
|
|
13
|
-
| `maxOutputChars` | `16000` | 命令输出最多保留的字符数;固定诊断会在此后追加。 |
|
|
14
|
-
| `description` | 持久 shell 描述 | 面向模型的环境约定。 |
|
|
69
|
+
本节解释工具背后的设计决策,并指出实现它们的代码位置;可观察行为已在[使用本包](#use-this-package)中完整说明。
|
|
15
70
|
|
|
71
|
+
### 设计理念
|
|
72
|
+
|
|
73
|
+
- **每个 owner 一个 shell,互不共享。** shell 注册表按调用方 `Agent` 为每个会话建键,因此并发 agent 永不共享状态,同一 agent 的命令通过按 owner 的队列串行化。
|
|
74
|
+
- **标记锚定提取。** 每条命令都用携带退出状态的唯一起止标记包装;工具轮询 PTY scrollback 并提取真实标记之间的区间,因此提示词与回显输入永不泄漏进结果。
|
|
75
|
+
- **重置,而非修复。** 任何不确定状态——显式 `exit`、超时、发送失败、中止——都会关闭 shell 并让下一次调用从全新状态开始,因为半知情的 shell 不如干净的 shell。
|
|
76
|
+
- **按 owner 的生命周期。** shell 在首次使用时惰性创建,在插件释放或 owner 拆除时终止;按所有者隔离的 `ctx.terminals` 服务把每个操作都围栏到拥有它的 agent。
|
|
77
|
+
|
|
78
|
+
### 源码地图
|
|
79
|
+
|
|
80
|
+
| 文件 | 职责 |
|
|
81
|
+
|---|---|
|
|
82
|
+
| [`src/index.ts`](src/index.ts) | 插件入口:shell 注册表、命令包装、scrollback 轮询、提取与渲染 |
|
|
83
|
+
| [`src/invariant.ts`](src/invariant.ts) | 不变式伴生插件(无运行时不变式;shell 复用可通过工具执行观察) |
|
|
84
|
+
|
|
85
|
+
### 命令流程
|
|
86
|
+
|
|
87
|
+
首条命令通过 `ctx.terminals.spawn` 生成 shell,禁用输入回显(`stty -echo`),并等待就绪。随后每条命令都包装成一行物理文本——printf 起始标记、用 `$'…'` 转义的命令体、printf 结束标记加 `$?`——因此内嵌换行无法把终端提示词泄漏进结果。工具以 1,000 行一页轮询 scrollback,直到出现结束标记,提取区间并连同任何状态标记一起渲染。超时会中止截止时间、捕获部分输出并重置 shell。
|
|
88
|
+
|
|
89
|
+
</details>
|
|
90
|
+
|
|
91
|
+
-----
|
|
92
|
+
|
|
93
|
+
<a id="further-exploration"></a>
|
|
94
|
+
## 进一步探索
|
|
95
|
+
|
|
96
|
+
当包级约定不够用时阅读以下页面。它们从 terminal 家族逐步进入 seam、后端,以及按所有者会话背后的设计笔记。
|
|
97
|
+
|
|
98
|
+
- [terminal 包映射](../../terminal/README.zh.md)——持久 PTY 能力家族。
|
|
99
|
+
- [terminal seam](../../terminal/terminal/README.zh.md)——工具背后的 `ctx.terminals` 服务。
|
|
100
|
+
- [terminal-bash 后端](../../terminal/terminal-bash/README.zh.md)——默认的 `shell` 后端。
|
|
101
|
+
- [tool-terminal](../../terminal/tool-terminal/README.zh.md)——面向交互工作的六个模型侧 terminal 工具。
|
|
102
|
+
- [持久 PTY 会话 Agent Note](../../../.agents/notes/implemented/feature/2026-07-16-persistent-pty-sessions.zh.md)——按所有者会话的设计及其理由。
|
|
103
|
+
- [生成的工具目录](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-bash-persistent)——`bash` 参数 schema 的确切内容。
|
|
104
|
+
- [生成的配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-tool-bash-persistent)——每个受支持配置字段及其源声明。
|
|
105
|
+
|
|
106
|
+
-----
|
|
107
|
+
|
|
108
|
+
<a id="model-experience"></a>
|
|
16
109
|
## 模型体验
|
|
17
110
|
|
|
18
111
|
### 工具 schema
|
|
19
112
|
|
|
20
|
-
####
|
|
113
|
+
#### 模型看到什么
|
|
21
114
|
|
|
22
|
-
生成的 [`bash` schema](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-bash-persistent)
|
|
115
|
+
生成的 [`bash` schema](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-bash-persistent),包括配置的 `description`。本插件不贡献独立的系统提示词区段;人设与环境指引由部署方负责。
|
|
23
116
|
|
|
24
117
|
#### Token 影响
|
|
25
118
|
|
|
26
|
-
`bash`
|
|
119
|
+
`bash` 可见期间产生固定 schema 开销。
|
|
27
120
|
|
|
28
121
|
#### KV Cache 影响
|
|
29
122
|
|
|
30
|
-
|
|
123
|
+
只要配置的描述与 schema 不变,前缀就保持稳定。
|
|
31
124
|
|
|
32
125
|
### 工具结果
|
|
33
126
|
|
|
34
|
-
####
|
|
127
|
+
#### 模型看到什么
|
|
35
128
|
|
|
36
|
-
|
|
129
|
+
命令共享每个 Agent 一个 shell,因此 cwd、导出的变量、已激活的环境、函数与后台任务都会跨调用保留。结果排除私有完成标记。当 shell 在没有打印完成标记的情况下再次读取 stdin——`exec`、中断,或提供方证明其 stdin 等待的交互式前台子进程之后——调用返回捕获的部分输出,它可能以后端自己的提示词文本结尾。非零的包装命令追加 `[exit code: N]`;在报告该状态前就退出的 shell 改为追加 `[shell exited: code N]`、`[shell killed by signal: SIG]`,或后端两者都未提供时的 `[shell exited]`,然后重置并告诉模型下一次调用从全新状态开始。长输出保留最早的已保留前缀并附裁剪通知。若 PTY 已经丢弃该前缀,结果会明确说明,而不是把尾部当作完整输出呈现。超时返回有界部分输出、关闭不确定的 shell 并报告重置。
|
|
37
130
|
|
|
38
131
|
#### Token 影响
|
|
39
132
|
|
|
40
|
-
|
|
133
|
+
依数据而定。`maxOutputChars` 限制保留的命令输出;固定的裁剪、丢失前缀、状态、超时与重置诊断可能延长结果。
|
|
41
134
|
|
|
42
135
|
#### KV Cache 影响
|
|
43
136
|
|
|
44
|
-
|
|
137
|
+
仅追加的工具结果位于可复用请求前缀之后。
|
|
138
|
+
|
|
139
|
+
## 已知限制与延期工作
|
|
140
|
+
|
|
141
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
这些限制说明工具何时不合适或需要特别小心。它们是当前包约束,不是任务积压。
|
|
145
|
+
|
|
146
|
+
- **工具需要拥有者 Agent 与真实的 PTY 后端**——无 agent 的调用与无法启动交互 shell 的后端都会失败。
|
|
147
|
+
- **交互式前台子进程只在子进程提供方证明其 stdin 等待时才提前返回部分输出**——否则调用一直运行到 `timeoutMs`。
|
|
148
|
+
- **显式 `exit` 与超时会丢弃 shell 状态**——取消同样重置并丢弃结果,即使完整状态标记已经可观察;下一次调用启动全新 shell。
|
|
149
|
+
- **网络访问与包镜像等环境事实属于配置的 `description`**——而不是本包的默认描述。
|
|
150
|
+
|
|
151
|
+
<a id="dev-note"></a>
|
|
152
|
+
### 开发备注
|
|
153
|
+
|
|
154
|
+
<details>
|
|
155
|
+
<summary>维护者的工作上下文——点击展开</summary>
|
|
45
156
|
|
|
46
|
-
|
|
157
|
+
无。
|
|
47
158
|
|
|
48
|
-
|
|
49
|
-
- 交互式前台子进程(例如 REPL)只有在进程管理提供方能证明其 stdin 等待时才会提前返回部分输出;否则调用会一直运行到 `timeoutMs`。
|
|
50
|
-
- 显式 `exit` 与超时会丢弃 shell 状态。取消同样会重置 shell 并丢弃结果,即使已经能观察到完整状态标记也是如此;下次调用创建新 shell。
|
|
51
|
-
- 网络访问、软件包镜像等环境事实应写入配置的 `description`,而非包默认描述。
|
|
159
|
+
</details>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-tool-bash-persistent",
|
|
3
3
|
"description": "Model-facing owner-scoped persistent Bash tool backed by the Harness PTY service",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2-alpha.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -31,31 +31,32 @@
|
|
|
31
31
|
],
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@deepseek-ai/dsh-agent": "^0.1.
|
|
35
|
-
"@deepseek-ai/dsh-
|
|
36
|
-
"@deepseek-ai/dsh-
|
|
37
|
-
"@deepseek-ai/
|
|
38
|
-
"@deepseek-ai/
|
|
39
|
-
"@deepseek-ai/dsh-
|
|
34
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.2",
|
|
35
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.2",
|
|
36
|
+
"@deepseek-ai/dsh-terminal": "^0.1.2-alpha.2",
|
|
37
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
38
|
+
"@deepseek-ai/dsh-tools": "^0.1.2-alpha.2",
|
|
39
|
+
"@deepseek-ai/dsh-timeout": "^0.1.2-alpha.2"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@deepseek-ai/schemastery": "^3.18.
|
|
42
|
+
"@deepseek-ai/schemastery": "^3.18.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@deepseek-ai/cordis-plugin-include": "^1.0.
|
|
46
|
-
"@deepseek-ai/cordis-plugin-loader": "^1.0.
|
|
47
|
-
"@deepseek-ai/dsh-agent": "^0.1.
|
|
48
|
-
"@deepseek-ai/dsh-
|
|
49
|
-
"@deepseek-ai/dsh-
|
|
50
|
-
"@deepseek-ai/dsh-
|
|
51
|
-
"@deepseek-ai/dsh-sandbox
|
|
52
|
-
"@deepseek-ai/dsh-
|
|
53
|
-
"@deepseek-ai/dsh-
|
|
54
|
-
"@deepseek-ai/dsh-
|
|
55
|
-
"@deepseek-ai/dsh-
|
|
56
|
-
"@deepseek-ai/dsh-
|
|
57
|
-
"@deepseek-ai/dsh-
|
|
58
|
-
"@deepseek-ai/
|
|
59
|
-
"@deepseek-ai/
|
|
45
|
+
"@deepseek-ai/cordis-plugin-include": "^1.0.7",
|
|
46
|
+
"@deepseek-ai/cordis-plugin-loader": "^1.0.3",
|
|
47
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.2",
|
|
48
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.2",
|
|
49
|
+
"@deepseek-ai/dsh-llm": "^0.1.2-alpha.2",
|
|
50
|
+
"@deepseek-ai/dsh-terminal-bash": "^0.1.2-alpha.2",
|
|
51
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.2-alpha.2",
|
|
52
|
+
"@deepseek-ai/dsh-sandbox-policy": "^0.1.2-alpha.2",
|
|
53
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.2",
|
|
54
|
+
"@deepseek-ai/dsh-subprocess-local": "^0.1.2-alpha.2",
|
|
55
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.2",
|
|
56
|
+
"@deepseek-ai/dsh-timeout": "^0.1.2-alpha.2",
|
|
57
|
+
"@deepseek-ai/dsh-tools": "^0.1.2-alpha.2",
|
|
58
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
59
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.2",
|
|
60
|
+
"@deepseek-ai/dsh-terminal": "^0.1.2-alpha.2"
|
|
60
61
|
}
|
|
61
62
|
}
|