@deepseek-ai/dsh-bash-local 0.0.1-rc.2 → 0.0.1-rc.5
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 +3 -3
- package/README.md +4 -4
- package/README.zh.md +6 -6
- package/lib/index.js +4 -4
- package/lib/types/index.d.ts +10 -10
- package/package.json +16 -16
package/README.i18n.yaml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
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
|
-
# pnpm run verify-translation-pairing --write packages/
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/shell/bash-local/README.md
|
|
5
|
+
README.md: ceece7e69de9c5e5337173c9fe3776bfe510e484
|
|
6
|
+
README.zh.md: 643d74de08ae7ffcd23b97927b294e4ea0d16f81
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
Local Service provider for the `@deepseek-ai/dsh-
|
|
5
|
+
Local Service provider for the `@deepseek-ai/dsh-shell` executor seam over the [`@deepseek-ai/dsh-subprocess`](../../subprocess/subprocess/README.md) service: `LocalBashExecutor` spawns `bash -c <command>` per call as a managed process group through `ctx.subprocess`, and owns everything bash-shaped — command defaulting and caps, timeout/cancel classification, the model-friendly terminal environment, and the model-facing stdout/stderr merge for background reads. Group mechanics (bounded spill-backed output, credential scrub, kill escalation, disposal) are the subprocess service's.
|
|
6
6
|
|
|
7
7
|
The package root exports the default and named `LocalBashExecutor` plugin plus its `Config`.
|
|
8
8
|
|
|
@@ -23,11 +23,11 @@ The package root exports the default and named `LocalBashExecutor` plugin plus i
|
|
|
23
23
|
## Behavior
|
|
24
24
|
|
|
25
25
|
- **Spawn per call, no shell state** — every call is a fresh non-login `bash -c` with no rc files.
|
|
26
|
-
- **The composition entry is a layer, not the last word** — when a settings provider is composed, this executor registers the capability's [`bash` namespace](../
|
|
27
|
-
- **Configured budgets over managed groups** — `resolve()` fills `workdir`/`timeoutMs`/`stdoutMaxBytes` from config, and every spawn hands the service explicit byte caps, spill cap, and `graceMs`. The grace must be positive, finite, and no greater than [`MAX_TIMER_DELAY_MS`](../../util/timeout/README.md), so Node can represent it with one timer. Process-group kills, post-exit pipe draining, tail retention, and bounded spill files are [`dsh-subprocess-local`](../../subprocess/subprocess-local/README.md) mechanics. A foreground `
|
|
26
|
+
- **The composition entry is a layer, not the last word** — when a settings provider is composed, this executor registers the capability's [`bash` namespace](../shell/README.md) with the entry above as its base, so a user section in `settings.yaml` layers over it and the next command runs with the new budgets. Values the schema cannot judge (positive and finite, the `graceMs` timer bound) are refused at the write, leaving the running executor on its last good section; without a provider, or after one detaches, the composition entry is what runs.
|
|
27
|
+
- **Configured budgets over managed groups** — `resolve()` fills `workdir`/`timeoutMs`/`stdoutMaxBytes` from config, and every spawn hands the service explicit byte caps, spill cap, and `graceMs`. The grace must be positive, finite, and no greater than [`MAX_TIMER_DELAY_MS`](../../util/timeout/README.md), so Node can represent it with one timer. Process-group kills, post-exit pipe draining, tail retention, and bounded spill files are [`dsh-subprocess-local`](../../subprocess/subprocess-local/README.md) mechanics. A foreground `ShellExecRequest.stdoutMaxBytes` can raise stdout's capture budget for one trusted caller; stderr and background runs still use `maxOutputBytes`.
|
|
28
28
|
- **Timeout and cancel classification** — `run()` fuses its config-clamped timeout with the caller's signal through one deadline; only the executor's own timeout reports `timedOut`, an upstream cancel reports `aborted`, and a self-signaled command reports neither ([timeout-library Agent Note](../../../.agents/notes/implemented/architecture/2026-07-06-timeout-deadline-library.md)).
|
|
29
29
|
- **Model-friendly terminal env** — `NO_COLOR=1 TERM=dumb PAGER=cat GIT_PAGER=cat` prevents pagers and ANSI color from garbling results. These values merge as ordinary env under the service's credential scrub and `DSH_*` channel rules; an explicit caller entry still wins. See the [stdin/env Agent Note](../../../.agents/notes/implemented/architecture/2026-06-30-bash-stdin-env-trusted-plugin-api.md) and [managed environment Agent Note](../../../.agents/notes/implemented/feature/2026-07-10-agent-session-identity-and-log-location.md).
|
|
30
|
-
- **Background processes** — `start()` returns a live `
|
|
30
|
+
- **Background processes** — `start()` returns a live `ShellProcess` handle immediately with no timeout, and `readOutput()` merges offset-based stdout/stderr reads into one consuming delta, placing stderr under a `[stderr]` marker when present. A running process belongs to the subprocess service, survives executor reloads, and is killed and joined on service disposal. Job ids, ownership, polling, and notices belong to the generic [`ctx.jobs` runtime](../../jobs/jobs/README.md), which the tool layer registers the handle with.
|
|
31
31
|
|
|
32
32
|
## Model Experience
|
|
33
33
|
|
package/README.zh.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
`@deepseek-ai/dsh-
|
|
5
|
+
`@deepseek-ai/dsh-shell` 执行器 seam 的本地 Service provider,构建在 [`@deepseek-ai/dsh-subprocess`](../../subprocess/subprocess/README.md) 服务之上:`LocalBashExecutor` 每次调用都通过 `ctx.subprocess` 把 `bash -c <command>` 作为受管进程组 spawn,并负责所有 Bash 层职责(命令默认值补全与上限、超时与取消分类、适合模型的终端环境,以及后台读取时面向模型的 stdout/stderr 合并)。以 spill 文件兜底的有界输出、凭据清除、kill 升级和 dispose(资源释放)等进程组机制则由 subprocess 服务负责。
|
|
6
6
|
|
|
7
7
|
包根目录导出默认与具名的 `LocalBashExecutor` 插件及其 `Config`。
|
|
8
8
|
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
## 行为
|
|
24
24
|
|
|
25
25
|
- **每次调用都 spawn,不保留 shell 状态**:每次调用都启动新的非登录 `bash -c`,且不读取 rc 文件。
|
|
26
|
-
- **组装条目是一层,而不是最终值**:当组装中存在 settings 提供方时,本执行器以上面的条目为 base 注册该能力的 [`bash` 命名空间](../
|
|
27
|
-
- **在受管进程组之上应用配置预算**:`resolve()` 从配置补全 `workdir`/`timeoutMs`/`stdoutMaxBytes`,每次 spawn 都向服务传入显式的字节上限、spill 上限与 `graceMs`。该宽限期须为正有限值,且不得大于 [`MAX_TIMER_DELAY_MS`](../../util/timeout/README.md),这样 Node 就能用一个定时器表示它。进程组终止、退出后管道排空、尾部保留与有界 spill 文件是 [`dsh-subprocess-local`](../../subprocess/subprocess-local/README.md) 的机制。前台 `
|
|
26
|
+
- **组装条目是一层,而不是最终值**:当组装中存在 settings 提供方时,本执行器以上面的条目为 base 注册该能力的 [`bash` 命名空间](../shell/README.md),因此 `settings.yaml` 中的用户段会叠加其上,下一条命令即按新预算运行。schema 无法判定的值(正有限、`graceMs` 的定时器上界)会在写入时被拒绝,运行中的执行器保持它最后一份可用的段;没有提供方、或提供方脱离之后,运行的就是组装条目。
|
|
27
|
+
- **在受管进程组之上应用配置预算**:`resolve()` 从配置补全 `workdir`/`timeoutMs`/`stdoutMaxBytes`,每次 spawn 都向服务传入显式的字节上限、spill 上限与 `graceMs`。该宽限期须为正有限值,且不得大于 [`MAX_TIMER_DELAY_MS`](../../util/timeout/README.md),这样 Node 就能用一个定时器表示它。进程组终止、退出后管道排空、尾部保留与有界 spill 文件是 [`dsh-subprocess-local`](../../subprocess/subprocess-local/README.md) 的机制。前台 `ShellExecRequest.stdoutMaxBytes` 可为某个受信任调用方提高单次 stdout 捕获预算;stderr 和后台运行仍使用 `maxOutputBytes`。
|
|
28
28
|
- **超时与取消分类**:`run()` 通过同一个 deadline 把经配置钳位的超时与调用方的信号融合;只有执行器自身的超时报告 `timedOut`,上游取消报告 `aborted`,自身因信号终止的命令两者皆不报告(见[超时库 Agent Note](../../../.agents/notes/implemented/architecture/2026-07-06-timeout-deadline-library.md))。
|
|
29
29
|
- **适合模型的终端环境**:`NO_COLOR=1 TERM=dumb PAGER=cat GIT_PAGER=cat` 防止分页器与 ANSI 颜色破坏结果。这些值作为普通 env 合并,遵循服务的凭据清除与 `DSH_*` 通道规则;调用方的显式条目依旧优先。详见 [stdin/env Agent Note](../../../.agents/notes/implemented/architecture/2026-06-30-bash-stdin-env-trusted-plugin-api.md) 与 [受管环境 Agent Note](../../../.agents/notes/implemented/feature/2026-07-10-agent-session-identity-and-log-location.md)。
|
|
30
|
-
- **后台进程**:`start()` 会立即返回活动的 `
|
|
30
|
+
- **后台进程**:`start()` 会立即返回活动的 `ShellProcess` 句柄且不应用超时;`readOutput()` 把基于偏移量的 stdout/stderr 读取合并为一条消费式增量,并在存在 stderr 时将其置于 `[stderr]` 标记下。运行中的进程属于 subprocess 服务,可在执行器重载后存活,并在服务 dispose 时被终止且等待退出。job id、所有权、轮询和通知属于通用 [`ctx.jobs` 运行时](../../jobs/jobs/README.md),工具层会在其中注册该句柄。
|
|
31
31
|
|
|
32
32
|
## 模型体验
|
|
33
33
|
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
|
|
40
40
|
## 已知限制与暂缓事项
|
|
41
41
|
|
|
42
|
-
- **自身不提供隔离**:此执行器始终以 harness
|
|
42
|
+
- **自身不提供隔离**:此执行器始终以 harness 进程的权限运行命令;需要隔离的部署可以组合 [`dsh-bash-sandbox`](../bash-sandbox/README.md),每次调用的 allow/deny/ask 策略则属于 `tools/pre-execute`。
|
|
43
43
|
- **没有持久 shell 或 PTY**:每次调用都启动新的非登录 `bash -c`;仅持久化 cwd 与交互式终端会话均继续暂缓,直到真实工作流需要它们。
|
|
44
44
|
- **仅支持 POSIX**:`bash` 二进制已硬编码,底层服务的进程组语义也是 POSIX 的;不支持 Windows。
|
|
45
|
-
- **后台 spawn
|
|
45
|
+
- **后台 spawn 失败提示只交付一次**:subprocess 服务不会为从未真正运行的进程缓冲任何输出,因此执行器把 `spawn failed: …` 注入恰好一个 `readOutput()` 增量;丢弃了该增量的读取方无法再恢复它。
|
|
46
46
|
|
|
47
47
|
凭据清除启发式规则与 spill 保留的注意事项随 [`dsh-subprocess-local`](../../subprocess/subprocess-local/README.md) 记录;这些机制归它所有。
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
|
-
import {
|
|
2
|
+
import { SHELL_SETTINGS_NAMESPACE, ShellExecutor } from "@deepseek-ai/dsh-shell";
|
|
3
3
|
import { installSettingsSection } from "@deepseek-ai/dsh-settings";
|
|
4
4
|
import { MAX_TIMER_DELAY_MS, clampTimeout, deadline, timeoutOf } from "@deepseek-ai/dsh-timeout";
|
|
5
5
|
//#region lib/types/index.js
|
|
@@ -124,7 +124,7 @@ function assertServiceableBashConfig(config) {
|
|
|
124
124
|
* still-running background process stays managed (killed and joined at
|
|
125
125
|
* composition teardown) even across an executor reload.
|
|
126
126
|
*/
|
|
127
|
-
var LocalBashExecutor = class LocalBashExecutor extends
|
|
127
|
+
var LocalBashExecutor = class LocalBashExecutor extends ShellExecutor {
|
|
128
128
|
static inject = ["subprocess"];
|
|
129
129
|
static Config = z.object({
|
|
130
130
|
cwd: z.string(),
|
|
@@ -145,7 +145,7 @@ var LocalBashExecutor = class LocalBashExecutor extends BashExecutor {
|
|
|
145
145
|
const entry = config;
|
|
146
146
|
assertServiceableBashConfig(entry);
|
|
147
147
|
this.source = () => entry;
|
|
148
|
-
installSettingsSection(ctx,
|
|
148
|
+
installSettingsSection(ctx, SHELL_SETTINGS_NAMESPACE, LocalBashExecutor.Config, entry, {
|
|
149
149
|
validate: assertServiceableBashConfig,
|
|
150
150
|
setSource: (current) => {
|
|
151
151
|
this.source = current;
|
|
@@ -320,7 +320,7 @@ var LocalBashExecutor = class LocalBashExecutor extends BashExecutor {
|
|
|
320
320
|
/**
|
|
321
321
|
* Settlement hook for subclasses that attach execution facts to a process.
|
|
322
322
|
* Called after exit facts or spawn-failure output are stamped and before
|
|
323
|
-
* {@link
|
|
323
|
+
* {@link ShellProcess.done} resolves. The base implementation is intentionally
|
|
324
324
|
* empty.
|
|
325
325
|
* @param _proc - the settled process handle.
|
|
326
326
|
* @param _stderr - the process's retained stderr tail used by subclasses for settlement classification.
|
package/lib/types/index.d.ts
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { Context } from '@deepseek-ai/cordis';
|
|
12
12
|
import z from '@deepseek-ai/schemastery';
|
|
13
|
-
import {
|
|
14
|
-
import type {
|
|
13
|
+
import { ShellExecutor } from '@deepseek-ai/dsh-shell';
|
|
14
|
+
import type { ShellExecRequest, ShellExecSpec, ShellProcess, ShellRunResult } from '@deepseek-ai/dsh-shell';
|
|
15
15
|
/**
|
|
16
16
|
* Model-friendly environment overrides: disable colors, pagers, and
|
|
17
17
|
* interactive terminal features that would garble tool output (the same set
|
|
@@ -58,7 +58,7 @@ export declare function assertServiceableBashConfig(config: Config): void;
|
|
|
58
58
|
* still-running background process stays managed (killed and joined at
|
|
59
59
|
* composition teardown) even across an executor reload.
|
|
60
60
|
*/
|
|
61
|
-
export declare class LocalBashExecutor extends
|
|
61
|
+
export declare class LocalBashExecutor extends ShellExecutor {
|
|
62
62
|
static inject: string[];
|
|
63
63
|
static Config: z<Config>;
|
|
64
64
|
/** The currently authoritative config: the settings section, or the composition entry. */
|
|
@@ -73,12 +73,12 @@ export declare class LocalBashExecutor extends BashExecutor {
|
|
|
73
73
|
* this before {@link run}/{@link start}, so those methods receive explicit
|
|
74
74
|
* values and never re-default.
|
|
75
75
|
*/
|
|
76
|
-
resolve(request:
|
|
76
|
+
resolve(request: ShellExecRequest): ShellExecSpec;
|
|
77
77
|
/** Map one resolved bash spec and explicit argv onto a fully-specified subprocess spawn. */
|
|
78
78
|
private spawnSpec;
|
|
79
79
|
/** The collect-mode readers the executor itself requested (present by construction). */
|
|
80
80
|
private static collected;
|
|
81
|
-
run(spec:
|
|
81
|
+
run(spec: ShellExecSpec): Promise<ShellRunResult>;
|
|
82
82
|
/**
|
|
83
83
|
* Run an explicit argv with the foreground lifecycle, environment, output,
|
|
84
84
|
* timeout, and cancellation semantics of this executor. Subclasses use this
|
|
@@ -87,8 +87,8 @@ export declare class LocalBashExecutor extends BashExecutor {
|
|
|
87
87
|
* @param argv - exact executable and arguments to hand to `ctx.subprocess`.
|
|
88
88
|
* @returns the settled foreground result with collected output and cause facts.
|
|
89
89
|
*/
|
|
90
|
-
protected runArgv(spec:
|
|
91
|
-
start(spec:
|
|
90
|
+
protected runArgv(spec: ShellExecSpec, argv: readonly string[]): Promise<ShellRunResult>;
|
|
91
|
+
start(spec: ShellExecSpec): ShellProcess;
|
|
92
92
|
/**
|
|
93
93
|
* Start an explicit argv with the background lifecycle, environment, output,
|
|
94
94
|
* cancellation, and process-tree ownership semantics of this executor.
|
|
@@ -98,18 +98,18 @@ export declare class LocalBashExecutor extends BashExecutor {
|
|
|
98
98
|
* @param argv - exact executable and arguments to hand to `ctx.subprocess`.
|
|
99
99
|
* @returns the live background handle; spawn rejection settles it as killed.
|
|
100
100
|
*/
|
|
101
|
-
protected startArgv(spec:
|
|
101
|
+
protected startArgv(spec: ShellExecSpec, argv: readonly string[]): ShellProcess;
|
|
102
102
|
/**
|
|
103
103
|
* Settlement hook for subclasses that attach execution facts to a process.
|
|
104
104
|
* Called after exit facts or spawn-failure output are stamped and before
|
|
105
|
-
* {@link
|
|
105
|
+
* {@link ShellProcess.done} resolves. The base implementation is intentionally
|
|
106
106
|
* empty.
|
|
107
107
|
* @param _proc - the settled process handle.
|
|
108
108
|
* @param _stderr - the process's retained stderr tail used by subclasses for settlement classification.
|
|
109
109
|
* @param _spawnFailed - whether the subprocess promise rejected before a process started.
|
|
110
110
|
* @param _spawnError - the original spawn rejection reason, which may itself be undefined.
|
|
111
111
|
*/
|
|
112
|
-
protected onProcessDone(_proc:
|
|
112
|
+
protected onProcessDone(_proc: ShellProcess, _stderr: string, _spawnFailed: boolean, _spawnError?: unknown): void;
|
|
113
113
|
}
|
|
114
114
|
export default LocalBashExecutor;
|
|
115
115
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-bash-local",
|
|
3
3
|
"description": "Local-subprocess implementation of the DeepSeek Harness bash executor seam",
|
|
4
|
-
"version": "0.0.1-rc.
|
|
4
|
+
"version": "0.0.1-rc.5",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "restricted"
|
|
7
7
|
},
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
-
"directory": "packages/
|
|
11
|
+
"directory": "packages/shell/bash-local"
|
|
12
12
|
},
|
|
13
13
|
"type": "module",
|
|
14
14
|
"main": "lib/index.js",
|
|
@@ -32,23 +32,23 @@
|
|
|
32
32
|
],
|
|
33
33
|
"license": "BSD-3-Clause",
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@deepseek-ai/dsh-
|
|
36
|
-
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.
|
|
37
|
-
"@deepseek-ai/dsh-subprocess": "^0.0.1-rc.
|
|
38
|
-
"@deepseek-ai/dsh-timeout": "^0.0.1-rc.
|
|
39
|
-
"@deepseek-ai/cordis": "^4.0.1-rc.
|
|
40
|
-
"@deepseek-ai/dsh-settings": "^0.0.1-rc.
|
|
35
|
+
"@deepseek-ai/dsh-shell": "^0.0.1-rc.5",
|
|
36
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.5",
|
|
37
|
+
"@deepseek-ai/dsh-subprocess": "^0.0.1-rc.5",
|
|
38
|
+
"@deepseek-ai/dsh-timeout": "^0.0.1-rc.5",
|
|
39
|
+
"@deepseek-ai/cordis": "^4.0.1-rc.4",
|
|
40
|
+
"@deepseek-ai/dsh-settings": "^0.0.1-rc.5"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@deepseek-ai/schemastery": "^3.18.1-rc.
|
|
43
|
+
"@deepseek-ai/schemastery": "^3.18.1-rc.4"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@deepseek-ai/dsh-
|
|
47
|
-
"@deepseek-ai/dsh-
|
|
48
|
-
"@deepseek-ai/dsh-
|
|
49
|
-
"@deepseek-ai/dsh-subprocess": "^0.0.1-rc.
|
|
50
|
-
"@deepseek-ai/dsh-
|
|
51
|
-
"@deepseek-ai/cordis": "^4.0.1-rc.
|
|
52
|
-
"@deepseek-ai/dsh-settings": "^0.0.1-rc.
|
|
46
|
+
"@deepseek-ai/dsh-shell": "^0.0.1-rc.5",
|
|
47
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.5",
|
|
48
|
+
"@deepseek-ai/dsh-subprocess": "^0.0.1-rc.5",
|
|
49
|
+
"@deepseek-ai/dsh-subprocess-local": "^0.0.1-rc.5",
|
|
50
|
+
"@deepseek-ai/dsh-timeout": "^0.0.1-rc.5",
|
|
51
|
+
"@deepseek-ai/cordis": "^4.0.1-rc.4",
|
|
52
|
+
"@deepseek-ai/dsh-settings": "^0.0.1-rc.5"
|
|
53
53
|
}
|
|
54
54
|
}
|