@deepseek-ai/dsh-shell 0.1.5-rc.2 → 0.1.6-alpha.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 +2 -2
- package/README.md +4 -4
- package/README.zh.md +7 -7
- package/lib/index.js +4 -3
- package/lib/types/index.d.ts +9 -7
- package/lib/types/types.d.ts +3 -3
- package/package.json +7 -7
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/shell/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 9b32149691a8cf4d4d8316101f4feec6762d0846
|
|
6
|
+
README.zh.md: 9d23b0c5957f9d59169c53c92b960c0b26b77a23
|
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "The
|
|
2
|
+
description: "The shell executor seam for developers and maintainers choosing, composing, or implementing command execution over ctx.shell."
|
|
3
3
|
kind: "package-reference"
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
|
|
|
9
9
|
|
|
10
10
|
## Summary
|
|
11
11
|
|
|
12
|
-
Use `ctx.shell` to run foreground shell commands with bounded output or
|
|
12
|
+
Use `ctx.shell` to run foreground shell commands with bounded output or prepare background processes asynchronously before receiving their handles. A profile can select local or sandboxed Bash or PowerShell execution without changing callers. Resolve each request before execution to make the working directory, timeout, and output limits explicit. Command completion, nonzero exits, timeouts, and caller aborts return results; only infrastructure failures reject, while the `bash` and `pwsh` tools own model-visible rendering and sandbox guidance.
|
|
13
13
|
|
|
14
14
|
## Table of Contents
|
|
15
15
|
|
|
@@ -38,7 +38,7 @@ console.log(result.exitCode, result.stdout.text)
|
|
|
38
38
|
|
|
39
39
|
### Background processes
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
Await `start` with a resolved spec to launch a background process; it publishes the handle after preparation and applies no background execution timeout. Cancellation or preparation failure rejects before publication. Read output incrementally with `readOutput()` — consecutive reads never repeat output, and lossy reads point at full-stream spill files. Terminate the provider-managed range with `kill()` (returns `false` once the direct command has finished) and await `done` for direct-command settlement. Job ids, ownership, polling, and notices belong to the generic `ctx.jobs` runtime, where the tool layer registers the handle.
|
|
42
42
|
|
|
43
43
|
### Requests and resolved specs
|
|
44
44
|
|
|
@@ -91,7 +91,7 @@ The package is one role of a standard capability seam: the Service Definition th
|
|
|
91
91
|
|
|
92
92
|
### Background lifecycle and ownership
|
|
93
93
|
|
|
94
|
-
A background process belongs to the subprocess service, not to the executor: it survives an executor-only reload and is killed and joined when the composition tears down. Implementations must honor the seam's semantics — `run` rejects only for infrastructure failures; `start`
|
|
94
|
+
A background process belongs to the subprocess service, not to the executor: it survives an executor-only reload and is killed and joined when the composition tears down. Implementations must honor the seam's semantics — `run` rejects only for infrastructure failures; `start` resolves after preparation with no background execution timeout and its published handle’s `done` never rejects (a subprocess provider rejection settles as `killed` with a stage-neutral error on stderr); `readOutput` is consuming and lossy reads report spill files.
|
|
95
95
|
|
|
96
96
|
</details>
|
|
97
97
|
|
package/README.zh.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "面向开发者与维护者的
|
|
2
|
+
description: "面向开发者与维护者的 shell 执行器 seam 说明,用于选择、组合或实现基于 ctx.shell 的命令执行。"
|
|
3
3
|
kind: "package-reference"
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -9,7 +9,7 @@ kind: "package-reference"
|
|
|
9
9
|
|
|
10
10
|
## 概述
|
|
11
11
|
|
|
12
|
-
使用 `ctx.shell`
|
|
12
|
+
使用 `ctx.shell` 运行输出有界的前台 shell 命令,或异步准备后台进程后取得句柄。配置文件可选择本地或沙箱化的 Bash 或 PowerShell 执行方式,而无需更改调用方。执行前解析每个请求,以显式确定工作目录、超时和输出上限。命令完成、非零退出、超时和调用方中止都会作为结果返回;只有基础设施故障才会 reject,而模型可见的渲染与沙箱指引由 `bash` 和 `pwsh` 工具负责。
|
|
13
13
|
|
|
14
14
|
## 目录
|
|
15
15
|
|
|
@@ -25,7 +25,7 @@ kind: "package-reference"
|
|
|
25
25
|
<a id="use-this-package"></a>
|
|
26
26
|
## 使用本包
|
|
27
27
|
|
|
28
|
-
当 agent
|
|
28
|
+
当 agent(智能体)或进程内插件需要运行 shell 命令并读取输出,或启动后台进程并轮询它时,使用 `ctx.shell`。它是每个 shell 执行器与面向模型的 `bash`/`pwsh` 工具共同依赖的约定,因此基于它编写的代码可以运行在任意执行器实现之上。
|
|
29
29
|
|
|
30
30
|
### 前台命令
|
|
31
31
|
|
|
@@ -38,7 +38,7 @@ console.log(result.exitCode, result.stdout.text)
|
|
|
38
38
|
|
|
39
39
|
### 后台进程
|
|
40
40
|
|
|
41
|
-
用已解析的 spec
|
|
41
|
+
用已解析的 spec 等待 `start` 即可启动后台进程;它在准备完成后发布句柄,不应用后台执行超时。取消或准备失败会在发布前拒绝调用。用 `readOutput()` 增量读取输出——连续读取绝不会重复交付,有损读取会指向完整流的 spill 文件。用 `kill()` 终止由提供方管理的进程范围(直接命令结束后返回 `false`),并等待 `done` 完成直接命令结算。job id、所有权、轮询与通知属于通用 `ctx.jobs` 运行时,工具层会把句柄注册进去。
|
|
42
42
|
|
|
43
43
|
### 请求与已解析 spec
|
|
44
44
|
|
|
@@ -83,7 +83,7 @@ seam 本身不是执行器:每个组合只挂载一个提供方,工具即可
|
|
|
83
83
|
| [`src/index.ts`](src/index.ts) | 插件入口:抽象 `ShellExecutor` 服务与共享设置命名空间 |
|
|
84
84
|
| [`src/types.ts`](src/types.ts) | 请求/spec 词汇、`ShellRunResult`、`ShellProcess` 与沙箱事实 |
|
|
85
85
|
| [`src/render.ts`](src/render.ts) | `parseExitStatus`:shell 工具共享的退出状态标记约定 |
|
|
86
|
-
| — |
|
|
86
|
+
| — | 不发布运行时不变式伴生入口;该无状态 Service Definition 负责请求/结果类型,执行器与策略负责观察。 |
|
|
87
87
|
|
|
88
88
|
### 设置命名空间
|
|
89
89
|
|
|
@@ -91,7 +91,7 @@ seam 本身不是执行器:每个组合只挂载一个提供方,工具即可
|
|
|
91
91
|
|
|
92
92
|
### 后台生命周期与归属
|
|
93
93
|
|
|
94
|
-
后台进程属于 subprocess 服务而非执行器:它能在仅重载执行器后存活,并在组合拆解时被终止并 join。实现必须遵守 seam 的语义——`run` 只在基础设施失败时 reject;`start`
|
|
94
|
+
后台进程属于 subprocess 服务而非执行器:它能在仅重载执行器后存活,并在组合拆解时被终止并 join。实现必须遵守 seam 的语义——`run` 只在基础设施失败时 reject;`start` 在准备完成后返回且不设后台执行超时,已发布句柄的 `done` 绝不 reject(subprocess provider rejection 以 `killed` 结算,并把不声明阶段的错误写入 stderr);`readOutput` 是消费式的,有损读取会报告 spill 文件。
|
|
95
95
|
|
|
96
96
|
</details>
|
|
97
97
|
|
|
@@ -104,7 +104,7 @@ seam 本身不是执行器:每个组合只挂载一个提供方,工具即可
|
|
|
104
104
|
|
|
105
105
|
- [Bash 执行器子系统](../../../docs/subsystems/shell.zh.md) —— 请求/spec 词汇、结果与完整的服务约定。
|
|
106
106
|
- [bash-local](../bash-local/README.zh.md) —— 默认 POSIX 执行器:全新的 `bash -c` 进程、预算与 deadline。
|
|
107
|
-
- [bash-sandbox](../bash-sandbox/README.zh.md) ——
|
|
107
|
+
- [bash-sandbox](../bash-sandbox/README.zh.md) —— 沙箱执行器:沙箱模式、拒绝与升权。
|
|
108
108
|
- [tool-bash](../tool-bash/README.zh.md) —— 基于该 seam 的面向模型 `bash` 工具。
|
|
109
109
|
- [能力 seam 笔记](../../../.agents/notes/implemented/architecture/2026-06-13-capability-seams.zh.md) —— 本 seam 遵循的 Service Definition / Provider / Consumer 拆分。
|
|
110
110
|
|
package/lib/index.js
CHANGED
|
@@ -71,9 +71,10 @@ const SHELL_SETTINGS_NAMESPACE = "shell";
|
|
|
71
71
|
* Implementations must honor these semantics:
|
|
72
72
|
* - {@link run} rejects only for infrastructure failures. Nonzero exits,
|
|
73
73
|
* timeout kills, and abort kills resolve with a {@link ShellRunResult}.
|
|
74
|
-
* - {@link start}
|
|
75
|
-
*
|
|
76
|
-
*
|
|
74
|
+
* - {@link start} resolves after launch preparation; cancellation or setup failure
|
|
75
|
+
* rejects before publishing a handle. No timeout applies to background processes.
|
|
76
|
+
* Once published, `done` settles at process close and never rejects; subprocess
|
|
77
|
+
* provider failures settle as `killed` with the error on stderr.
|
|
77
78
|
* - {@link ShellProcess.readOutput} is incremental: consecutive reads never
|
|
78
79
|
* repeat output. Lossy reads report truncation and available spill files.
|
|
79
80
|
* - A still-running background process is stopped and awaited when its
|
package/lib/types/index.d.ts
CHANGED
|
@@ -35,9 +35,10 @@ declare module '@deepseek-ai/cordis' {
|
|
|
35
35
|
* Implementations must honor these semantics:
|
|
36
36
|
* - {@link run} rejects only for infrastructure failures. Nonzero exits,
|
|
37
37
|
* timeout kills, and abort kills resolve with a {@link ShellRunResult}.
|
|
38
|
-
* - {@link start}
|
|
39
|
-
*
|
|
40
|
-
*
|
|
38
|
+
* - {@link start} resolves after launch preparation; cancellation or setup failure
|
|
39
|
+
* rejects before publishing a handle. No timeout applies to background processes.
|
|
40
|
+
* Once published, `done` settles at process close and never rejects; subprocess
|
|
41
|
+
* provider failures settle as `killed` with the error on stderr.
|
|
41
42
|
* - {@link ShellProcess.readOutput} is incremental: consecutive reads never
|
|
42
43
|
* repeat output. Lossy reads report truncation and available spill files.
|
|
43
44
|
* - A still-running background process is stopped and awaited when its
|
|
@@ -61,18 +62,19 @@ export declare abstract class ShellExecutor extends Service {
|
|
|
61
62
|
*/
|
|
62
63
|
abstract resolve(request: ShellExecRequest): ShellExecSpec;
|
|
63
64
|
/**
|
|
64
|
-
* Run
|
|
65
|
+
* Run preparation and the foreground command under the resolved timeout.
|
|
65
66
|
* @param spec - a resolved spec from {@link resolve}, never a raw request.
|
|
66
67
|
* @returns the outcome; nonzero exits, timeout kills, and abort kills
|
|
67
68
|
* resolve with a descriptive result rather than reject.
|
|
69
|
+
* @throws on preparation failure or caller cancellation before process publication.
|
|
68
70
|
*/
|
|
69
71
|
abstract run(spec: ShellExecSpec): Promise<ShellRunResult>;
|
|
70
72
|
/**
|
|
71
|
-
*
|
|
73
|
+
* Prepare a background process asynchronously and publish its live handle.
|
|
72
74
|
* @param spec - a resolved spec from {@link resolve}, never a raw request.
|
|
73
|
-
* @returns the live process handle
|
|
75
|
+
* @returns the live process handle after preparation; cancellation or setup failure rejects.
|
|
74
76
|
*/
|
|
75
|
-
abstract start(spec: ShellExecSpec): ShellProcess
|
|
77
|
+
abstract start(spec: ShellExecSpec): Promise<ShellProcess>;
|
|
76
78
|
}
|
|
77
79
|
export default ShellExecutor;
|
|
78
80
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/types/types.d.ts
CHANGED
|
@@ -103,11 +103,11 @@ export interface ShellExecSpec {
|
|
|
103
103
|
/** Resolved sandbox policy; ignored by executors that do not confine. */
|
|
104
104
|
sandboxPolicy: SandboxExecutionPolicy | undefined;
|
|
105
105
|
}
|
|
106
|
-
/** The outcome of
|
|
106
|
+
/** The outcome of a foreground run, including timeout during preparation. */
|
|
107
107
|
export interface ShellRunResult {
|
|
108
|
-
/** Exit code; null when the process died from a signal. */
|
|
108
|
+
/** Exit code; null when preparation expired or the process died from a signal. */
|
|
109
109
|
exitCode: number | null;
|
|
110
|
-
/** Terminating signal
|
|
110
|
+
/** Terminating signal, or null when none was reported, including preparation expiry. */
|
|
111
111
|
signal: NodeJS.Signals | null;
|
|
112
112
|
/**
|
|
113
113
|
* True when the executor's own timeout was the FIRST cause to cut the command
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-shell",
|
|
3
3
|
"description": "Abstract bash executor seam (ctx.shell) for the DeepSeek Harness",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.6-alpha.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@deepseek-ai/dsh-subprocess": "^0.1.
|
|
30
|
+
"@deepseek-ai/dsh-subprocess": "^0.1.6-alpha.1",
|
|
31
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.6-alpha.1",
|
|
31
32
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
32
|
-
"@deepseek-ai/dsh-settings": "^0.1.
|
|
33
|
-
"@deepseek-ai/dsh-sandbox": "^0.1.5-rc.2"
|
|
33
|
+
"@deepseek-ai/dsh-settings": "^0.1.6-alpha.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@deepseek-ai/dsh-
|
|
36
|
+
"@deepseek-ai/dsh-subprocess": "^0.1.6-alpha.1",
|
|
37
37
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
38
|
-
"@deepseek-ai/dsh-
|
|
39
|
-
"@deepseek-ai/dsh-settings": "^0.1.
|
|
38
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.6-alpha.1",
|
|
39
|
+
"@deepseek-ai/dsh-settings": "^0.1.6-alpha.1"
|
|
40
40
|
}
|
|
41
41
|
}
|