@deepseek-ai/dsh-tool-bash-persistent 0.1.0-rc.7 → 0.1.1-rc.1

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
@@ -3,4 +3,4 @@
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
5
  README.md: 606920d087b42344f34b70103e167b0046d3cfd5
6
- README.zh.md: dd88db87cb617fb2f4d35ada9550d0142e32e979
6
+ README.zh.md: 85652bac23be02bd2c72753070734d91fb43ee98
package/README.zh.md CHANGED
@@ -19,7 +19,7 @@
19
19
 
20
20
  #### 模型所见
21
21
 
22
- 生成的 [`bash` schema](../../../docs/tool-catalog.md#deepseek-aidsh-tool-bash-persistent),其中包含配置的 `description`。本插件不贡献独立系统提示词段;persona 与环境指导由部署负责。
22
+ 生成的 [`bash` schema](../../../docs/tool-catalog.zh.md#deepseek-aidsh-tool-bash-persistent),其中包含配置的 `description`。本插件不贡献独立系统提示词段;persona 与环境指导由部署负责。
23
23
 
24
24
  #### Token 影响
25
25
 
package/lib/index.js CHANGED
@@ -161,6 +161,18 @@ function appendStatusMarker(content, marker) {
161
161
  function renderShellExitStatus(content, exitCode, signal) {
162
162
  return appendStatusMarker(content, signal !== null ? `[shell killed by signal: ${signal}]` : exitCode !== null ? `[shell exited: code ${exitCode}]` : "[shell exited]");
163
163
  }
164
+ /**
165
+ * Render the exited-session result, reset the owner's shell, and reset the
166
+ * message that tells the model the next call starts fresh.
167
+ * @param shells - the owner-scoped registry to reset.
168
+ * @param status - the exited session status (exit code and signal).
169
+ * @returns the complete model-facing result.
170
+ */
171
+ async function respondToSessionExit(ctx, shells, owner, id, status, marker, fallback, fallbackTruncated, config) {
172
+ const snapshot = retainedScrollback(ctx, owner, id);
173
+ await shells.reset(owner, "persistent bash shell exited");
174
+ return [renderShellExitStatus(renderCaptured(partialOutput(snapshot, marker, fallback, fallbackTruncated), config.maxOutputChars), status.exitCode, status.signal), SHELL_RESET_MESSAGE].filter((part) => part.length > 0).join("\n");
175
+ }
164
176
  function persistentShells(ctx, config) {
165
177
  const pending = /* @__PURE__ */ new WeakMap();
166
178
  const live = /* @__PURE__ */ new Map();
@@ -243,6 +255,8 @@ async function executeCommand(ctx, shells, owner, command, config, upstream) {
243
255
  let fallback = "";
244
256
  let fallbackTruncated = false;
245
257
  while (true) {
258
+ const status = ctx.terminals.list(owner).find((session) => session.sessionId === id)?.status;
259
+ if (status?.kind === "exited") return await respondToSessionExit(ctx, shells, owner, id, status, marker, fallback, fallbackTruncated, config);
246
260
  let operation;
247
261
  let result;
248
262
  try {
@@ -282,11 +296,7 @@ async function executeCommand(ctx, shells, owner, command, config, upstream) {
282
296
  const complete = commandOutput(retainedScrollback(ctx, owner, id, latest), marker);
283
297
  if (complete !== void 0) return renderCaptured(complete, config.maxOutputChars);
284
298
  }
285
- if (result.sessionStatus.kind === "exited") {
286
- const snapshot = retainedScrollback(ctx, owner, id, latest);
287
- await shells.reset(owner, "persistent bash shell exited");
288
- return [renderShellExitStatus(renderCaptured(partialOutput(snapshot, marker, fallback, fallbackTruncated), config.maxOutputChars), result.sessionStatus.exitCode, result.sessionStatus.signal), SHELL_RESET_MESSAGE].filter((part) => part.length > 0).join("\n");
289
- }
299
+ if (result.sessionStatus.kind === "exited") return await respondToSessionExit(ctx, shells, owner, id, result.sessionStatus, marker, fallback, fallbackTruncated, config);
290
300
  if (result.waitReason === "stdin_read") return renderCaptured(partialOutput(retainedScrollback(ctx, owner, id, latest), marker, fallback, fallbackTruncated), config.maxOutputChars);
291
301
  await pause();
292
302
  }
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.0-rc.7",
4
+ "version": "0.1.1-rc.1",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -31,31 +31,31 @@
31
31
  ],
32
32
  "license": "MIT",
33
33
  "peerDependencies": {
34
- "@deepseek-ai/dsh-agent": "^0.1.0-rc.7",
35
- "@deepseek-ai/dsh-invariants": "^0.1.0-rc.7",
36
- "@deepseek-ai/dsh-terminal": "^0.1.0-rc.7",
37
- "@deepseek-ai/dsh-timeout": "^0.1.0-rc.7",
38
- "@deepseek-ai/dsh-tools": "^0.1.0-rc.7",
34
+ "@deepseek-ai/dsh-agent": "^0.1.1-rc.1",
35
+ "@deepseek-ai/dsh-invariants": "^0.1.1-rc.1",
36
+ "@deepseek-ai/dsh-terminal": "^0.1.1-rc.1",
37
+ "@deepseek-ai/dsh-timeout": "^0.1.1-rc.1",
38
+ "@deepseek-ai/dsh-tools": "^0.1.1-rc.1",
39
39
  "@deepseek-ai/cordis": "^4.0.1"
40
40
  },
41
41
  "dependencies": {
42
42
  "@deepseek-ai/schemastery": "^3.18.1"
43
43
  },
44
44
  "devDependencies": {
45
- "@deepseek-ai/cordis-plugin-include": "^1.0.6",
46
45
  "@deepseek-ai/cordis-plugin-loader": "^1.0.2",
47
- "@deepseek-ai/dsh-agent": "^0.1.0-rc.7",
48
- "@deepseek-ai/dsh-invariants": "^0.1.0-rc.7",
49
- "@deepseek-ai/dsh-llm": "^0.1.0-rc.7",
50
- "@deepseek-ai/dsh-terminal": "^0.1.0-rc.7",
51
- "@deepseek-ai/dsh-terminal-bash": "^0.1.0-rc.7",
52
- "@deepseek-ai/dsh-sandbox-policy": "^0.1.0-rc.7",
53
- "@deepseek-ai/dsh-session": "^0.1.0-rc.7",
54
- "@deepseek-ai/dsh-subprocess-local": "^0.1.0-rc.7",
55
- "@deepseek-ai/dsh-system-prompt": "^0.1.0-rc.7",
56
- "@deepseek-ai/dsh-tools": "^0.1.0-rc.7",
57
- "@deepseek-ai/dsh-timeout": "^0.1.0-rc.7",
58
- "@deepseek-ai/cordis": "^4.0.1",
59
- "@deepseek-ai/dsh-sandbox": "^0.1.0-rc.7"
46
+ "@deepseek-ai/dsh-invariants": "^0.1.1-rc.1",
47
+ "@deepseek-ai/dsh-agent": "^0.1.1-rc.1",
48
+ "@deepseek-ai/dsh-llm": "^0.1.1-rc.1",
49
+ "@deepseek-ai/cordis-plugin-include": "^1.0.6",
50
+ "@deepseek-ai/dsh-terminal-bash": "^0.1.1-rc.1",
51
+ "@deepseek-ai/dsh-terminal": "^0.1.1-rc.1",
52
+ "@deepseek-ai/dsh-sandbox": "^0.1.1-rc.1",
53
+ "@deepseek-ai/dsh-sandbox-policy": "^0.1.1-rc.1",
54
+ "@deepseek-ai/dsh-session": "^0.1.1-rc.1",
55
+ "@deepseek-ai/dsh-subprocess-local": "^0.1.1-rc.1",
56
+ "@deepseek-ai/dsh-system-prompt": "^0.1.1-rc.1",
57
+ "@deepseek-ai/dsh-timeout": "^0.1.1-rc.1",
58
+ "@deepseek-ai/dsh-tools": "^0.1.1-rc.1",
59
+ "@deepseek-ai/cordis": "^4.0.1"
60
60
  }
61
61
  }