@deepseek-ai/dsh-tool-bash-persistent 0.1.3-alpha.2 → 0.1.5-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
@@ -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: 8aaae0f848f1b1558cb05095ed3083c17f29f0bb
6
- README.zh.md: 6072985023605cf12d53c134c5616a5ef111097b
5
+ README.md: e2b1e16cb38a9e11d50033de73e10ecfff7b0ae2
6
+ README.zh.md: d478831b4e432df916492d8e60a6c9fa8d788b42
package/README.md CHANGED
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
9
9
 
10
10
  ## Summary
11
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.
12
+ This package gives an agent a `bash` tool whose cwd, exported variables, functions, and background jobs persist across calls. Each agent receives an isolated shell, and its commands run sequentially. Choose it for workflows that depend on cross-call state; use `dsh-tool-bash` when every command should start clean. Configure the PTY backend and per-command timeout; `exit`, timeout, or cancellation resets the shell, while interactive commands that wait for stdin may run until timeout.
13
13
 
14
14
  ## Table of Contents
15
15
 
@@ -52,7 +52,7 @@ The generated [configuration catalog](../../../docs/config-catalog.md#deepseek-a
52
52
 
53
53
  ### What the agent can rely on
54
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.
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; every settled command appends `[Command finished with 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
56
 
57
57
  ### What can go wrong
58
58
 
@@ -126,7 +126,7 @@ Prefix-stable while the configured description and schema remain unchanged.
126
126
 
127
127
  #### What the model sees
128
128
 
129
- Commands share one shell per Agent, so cwd, exported variables, activated environments, functions, and background jobs persist across calls. Results exclude private completion markers. When the shell reads stdin again without having printed the completion marker — after `exec`, an interrupt, or an interactive foreground child whose stdin wait the provider proves — the call returns the captured partial output, which can end with the backend's own prompt text. A nonzero wrapped command appends `[exit code: N]`; a shell that exits before reporting that status instead appends `[shell exited: code N]`, `[shell killed by signal: SIG]`, or `[shell exited]` when the backend supplies neither, then resets and tells the model that the next call starts fresh. Long output keeps the earliest retained prefix plus a clipping notice. If the PTY has already dropped that prefix, the result says so explicitly instead of presenting a tail as complete output. Timeout returns bounded partial output, closes the uncertain shell, and reports the reset.
129
+ Commands share one shell per Agent, so cwd, exported variables, activated environments, functions, and background jobs persist across calls. Results exclude private completion markers. When the shell reads stdin again without having printed the completion marker — after `exec`, an interrupt, or an interactive foreground child whose stdin wait the provider proves — the call returns the captured partial output, which can end with the backend's own prompt text. Every settled command appends `[Command finished with exit code N]`; a shell that exits before reporting that status instead appends `[shell exited: code N]`, `[shell killed by signal: SIG]`, or `[shell exited]` when the backend supplies neither, then resets and tells the model that the next call starts fresh. Long output keeps the earliest retained prefix plus a clipping notice. If the PTY has already dropped that prefix, the result says so explicitly instead of presenting a tail as complete output. Timeout returns bounded partial output followed by `[Command timed out or OOM]`, closes the uncertain shell, and reports the reset.
130
130
 
131
131
  #### Token effect
132
132
 
package/README.zh.md CHANGED
@@ -9,7 +9,7 @@ kind: "package-reference"
9
9
 
10
10
  ## 概述
11
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` 服务一起挂载。
12
+ 本包为 agent 提供 `bash` 工具,使 cwd、导出的变量、函数与后台任务跨调用保留。每个 agent 都有隔离的 shell,其命令串行执行。需要跨调用状态的工作流应选择本包;每条命令都应从干净环境开始时使用 `dsh-tool-bash`。配置 PTY 后端与单条命令的超时;`exit`、超时或取消会重置 shell,而等待 stdin 的交互式命令可能一直运行到超时。
13
13
 
14
14
  ## 目录
15
15
 
@@ -52,7 +52,7 @@ kind: "package-reference"
52
52
 
53
53
  ### agent 可以依赖什么
54
54
 
55
- 命令共享每个 agent 一个 shell,因此状态一直保留到 `exit`、超时或重置——每一种都会关闭 shell 并告诉 agent 下一次调用从工作区的新目录与环境开始。结果排除私有完成标记;非零的包装命令追加 `[exit code: N]`,而在报告该状态前就退出的 shell 改为追加 `[shell exited: code N]`、`[shell killed by signal: SIG]` 或 `[shell exited]`,然后重置。长输出保留最早的已保留前缀并附裁剪通知;若 terminal 已经丢弃该前缀,结果会明确说明,而不是把尾部当作完整输出呈现。
55
+ 命令共享每个 agent 一个 shell,因此状态一直保留到 `exit`、超时或重置——每一种都会关闭 shell 并告诉 agent 下一次调用从工作区的新目录与环境开始。结果排除私有完成标记;每条完成的命令都追加 `[Command finished with exit code N]`,而在报告该状态前就退出的 shell 改为追加 `[shell exited: code N]`、`[shell killed by signal: SIG]` 或 `[shell exited]`,然后重置。长输出保留最早的已保留前缀并附裁剪通知;若 terminal 已经丢弃该前缀,结果会明确说明,而不是把尾部当作完整输出呈现。
56
56
 
57
57
  ### 可能出什么问题
58
58
 
@@ -126,7 +126,7 @@ kind: "package-reference"
126
126
 
127
127
  #### 模型看到什么
128
128
 
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 并报告重置。
129
+ 命令共享每个 Agent 一个 shell,因此 cwd、导出的变量、已激活的环境、函数与后台任务都会跨调用保留。结果排除私有完成标记。当 shell 在没有打印完成标记的情况下再次读取 stdin——`exec`、中断,或提供方证明其 stdin 等待的交互式前台子进程之后——调用返回捕获的部分输出,它可能以后端自己的提示词文本结尾。每条完成的命令都追加 `[Command finished with exit code N]`;在报告该状态前就退出的 shell 改为追加 `[shell exited: code N]`、`[shell killed by signal: SIG]`,或后端两者都未提供时的 `[shell exited]`,然后重置并告诉模型下一次调用从全新状态开始。长输出保留最早的已保留前缀并附裁剪通知。若 PTY 已经丢弃该前缀,结果会明确说明,而不是把尾部当作完整输出呈现。超时返回有界部分输出并追加 `[Command timed out or OOM]`、关闭不确定的 shell 并报告重置。
130
130
 
131
131
  #### Token 影响
132
132
 
package/lib/index.js CHANGED
@@ -68,6 +68,7 @@ var __disposeResources = (function(SuppressedError) {
68
68
  const TRUNCATED_MESSAGE = "<response clipped><NOTE>To save on context only part of this file has been shown to you. You should retry this tool after you have searched inside the file with `grep -n` in order to find the line numbers of what you are looking for.</NOTE>";
69
69
  const LOST_PREFIX_MESSAGE = "<response clipped><NOTE>The beginning of this command output was dropped by the terminal scrollback limit. The following text is the earliest retained output.</NOTE>\n";
70
70
  const SHELL_RESET_MESSAGE = "The persistent bash shell was reset; the next bash call starts from the workspace with a fresh current directory and environment.";
71
+ const TIMEOUT_STATUS_MARKER = "[Command timed out or OOM]";
71
72
  const TIMEOUT_CODE = "PERSISTENT_BASH_TIMEOUT";
72
73
  const SCROLLBACK_PAGE_LINES = 1e3;
73
74
  const POLL_INTERVAL_MS = 25;
@@ -90,7 +91,7 @@ function wrapCommand(command, marker) {
90
91
  return `printf '%s\\n' ${quoteForBash(marker.start)}; eval -- ${quoteForBash(command)}; __dsh_persistent_bash_status=$?; printf '%s%s\\n' ${quoteForBash(marker.end)} "$__dsh_persistent_bash_status"`;
91
92
  }
92
93
  function trimTrailingNewline(text) {
93
- return text.replace(/\r?\n$/, "");
94
+ return text.replace(/(?:\r?\n)+$/, "");
94
95
  }
95
96
  function commandOutput(snapshot, marker) {
96
97
  const text = snapshot.text;
@@ -152,7 +153,7 @@ function retainedScrollback(ctx, owner, id, latest = ctx.terminals.read(owner, i
152
153
  }
153
154
  function renderCaptured(output, maxOutputChars) {
154
155
  const rendered = maybeTruncate(output.text, maxOutputChars, output.incomplete);
155
- return appendStatusMarker(output.incomplete && output.text.length > 0 ? LOST_PREFIX_MESSAGE + rendered : rendered, output.exitCode !== void 0 && output.exitCode !== 0 ? `[exit code: ${output.exitCode}]` : void 0);
156
+ return appendStatusMarker(output.incomplete && output.text.length > 0 ? LOST_PREFIX_MESSAGE + rendered : rendered, output.exitCode !== void 0 ? `[Command finished with exit code ${output.exitCode}]` : void 0);
156
157
  }
157
158
  function appendStatusMarker(content, marker) {
158
159
  if (marker === void 0) return content;
@@ -284,7 +285,7 @@ async function executeCommand(ctx, shells, owner, command, config, upstream) {
284
285
  await shells.reset(owner, "persistent bash command timed out");
285
286
  return [
286
287
  `Your command timed out after ${Math.round(timedOut.timeoutMs / 1e3)} seconds or experienced an OOM error. Below is partial output:`,
287
- partial,
288
+ appendStatusMarker(partial, TIMEOUT_STATUS_MARKER),
288
289
  SHELL_RESET_MESSAGE
289
290
  ].join("\n");
290
291
  }
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.3-alpha.2",
4
+ "version": "0.1.5-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -26,11 +26,11 @@
26
26
  ],
27
27
  "license": "MIT",
28
28
  "peerDependencies": {
29
- "@deepseek-ai/dsh-agent": "^0.1.3-alpha.2",
30
- "@deepseek-ai/dsh-terminal": "^0.1.3-alpha.2",
31
- "@deepseek-ai/dsh-timeout": "^0.1.3-alpha.2",
32
- "@deepseek-ai/dsh-tools": "^0.1.3-alpha.2",
33
- "@deepseek-ai/cordis": "^4.0.2"
29
+ "@deepseek-ai/dsh-agent": "^0.1.5-alpha.2",
30
+ "@deepseek-ai/dsh-terminal": "^0.1.5-alpha.2",
31
+ "@deepseek-ai/dsh-timeout": "^0.1.5-alpha.2",
32
+ "@deepseek-ai/cordis": "^4.0.2",
33
+ "@deepseek-ai/dsh-tools": "^0.1.5-alpha.2"
34
34
  },
35
35
  "dependencies": {
36
36
  "@deepseek-ai/schemastery": "^3.18.2"
@@ -38,18 +38,19 @@
38
38
  "devDependencies": {
39
39
  "@deepseek-ai/cordis-plugin-include": "^1.0.7",
40
40
  "@deepseek-ai/cordis-plugin-loader": "^1.0.3",
41
- "@deepseek-ai/dsh-agent": "^0.1.3-alpha.2",
42
- "@deepseek-ai/dsh-llm": "^0.1.3-alpha.2",
43
- "@deepseek-ai/dsh-terminal": "^0.1.3-alpha.2",
44
- "@deepseek-ai/dsh-terminal-bash": "^0.1.3-alpha.2",
45
- "@deepseek-ai/dsh-sandbox": "^0.1.3-alpha.2",
46
- "@deepseek-ai/dsh-sandbox-policy": "^0.1.3-alpha.2",
47
- "@deepseek-ai/dsh-session": "^0.1.3-alpha.2",
48
- "@deepseek-ai/dsh-system-prompt": "^0.1.3-alpha.2",
49
- "@deepseek-ai/dsh-timeout": "^0.1.3-alpha.2",
50
- "@deepseek-ai/dsh-subprocess-local": "^0.1.3-alpha.2",
41
+ "@deepseek-ai/dsh-agent-loop-testkit": "^0.1.5-alpha.2",
42
+ "@deepseek-ai/dsh-agent": "^0.1.5-alpha.2",
43
+ "@deepseek-ai/dsh-llm": "^0.1.5-alpha.2",
44
+ "@deepseek-ai/dsh-terminal-bash": "^0.1.5-alpha.2",
45
+ "@deepseek-ai/dsh-sandbox": "^0.1.5-alpha.2",
46
+ "@deepseek-ai/dsh-sandbox-policy": "^0.1.5-alpha.2",
47
+ "@deepseek-ai/dsh-session": "^0.1.5-alpha.2",
48
+ "@deepseek-ai/dsh-system-prompt": "^0.1.5-alpha.2",
49
+ "@deepseek-ai/dsh-timeout": "^0.1.5-alpha.2",
50
+ "@deepseek-ai/dsh-subprocess-local": "^0.1.5-alpha.2",
51
+ "@deepseek-ai/dsh-tools": "^0.1.5-alpha.2",
51
52
  "@deepseek-ai/cordis": "^4.0.2",
52
- "@deepseek-ai/dsh-session-projection": "^0.1.3-alpha.2",
53
- "@deepseek-ai/dsh-tools": "^0.1.3-alpha.2"
53
+ "@deepseek-ai/dsh-session-projection": "^0.1.5-alpha.2",
54
+ "@deepseek-ai/dsh-terminal": "^0.1.5-alpha.2"
54
55
  }
55
56
  }