@deepseek-ai/dsh-subprocess-local 0.2.0-rc.2 → 0.2.1-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
@@ -45,8 +45,8 @@
45
45
  en: c1f9a5ee756547b9
46
46
  zh: d47d9f6175f5cbc9
47
47
  /deepseek-ai-dsh-subprocess-local/understand-the-implementation/source-map:
48
- en: 155e6b83a97de7a2
49
- zh: b8a2c29bb1635d7d
48
+ en: 3d5fd99e4ad1f7af
49
+ zh: 241490c1052f415c
50
50
  /deepseek-ai-dsh-subprocess-local/understand-the-implementation/main-flow:
51
51
  en: 6b6e17fa0d1b39b7
52
52
  zh: 0b40691719ce658f
@@ -63,8 +63,8 @@
63
63
  en: e290ccc9b3c92c08
64
64
  zh: d75d48f485447a74
65
65
  /deepseek-ai-dsh-subprocess-local/known-limitations-and-deferred-work:
66
- en: 8c32701df6418b62
67
- zh: 3d8da68737d2f500
66
+ en: aca923fe6b461acb
67
+ zh: ee19a96907134d85
68
68
  /deepseek-ai-dsh-subprocess-local/known-limitations-and-deferred-work/dev-note:
69
69
  en: e67f633dc6fe7773
70
70
  zh: 3bb0c20c93f16f98
package/README.md CHANGED
@@ -101,7 +101,6 @@ Each spawn selects one owner for both signalling and quiescence. Supported Linux
101
101
  | [`src/terminal.ts`](src/terminal.ts) | `node-pty` handle: Linux scope attachment, foreground inspection, and fallback cleanup |
102
102
  | [`src/process-inspector.ts`](src/process-inspector.ts) | POSIX process-tree and session inspection |
103
103
  | [`src/windows-inspector.ts`](src/windows-inspector.ts) | Windows Toolhelp32 process-table inspection via koffi |
104
- | — | No runtime invariant companion is published; this package exposes no independent event sequence or mutable data relation beyond contracts enforced at its owning seam. |
105
104
 
106
105
  ### Main flow
107
106
 
@@ -150,7 +149,8 @@ These limits define when the provider is a poor fit or needs special operational
150
149
  - **Native ownership has explicit host requirements** — Linux needs a readable user manager and `systemd-run --expand-environment=no`; older systemd versions use the warned PGID fallback. macOS always uses that fallback because no supported public persistent owner exists.
151
150
  - **Native selection has bounded per-spawn costs** — Linux repeats the bootstrap entry, libc `execve`/`fcntl` bindings, live user manager, and literal-argv scope probe until it first succeeds; later eligible ordinary or terminal spawns recheck only the live user manager. Windows rechecks the runner entry, bindings, and current Job support before every ordinary spawn. Successful Linux deep-probe state and fallback-warning de-duplication persist for the provider lifetime. All probes finish before the user command can run, and child-process probes have a 5-second timeout. Each Linux launch creates a private request directory, checks unresolved scope establishment every 50 milliseconds, then exponentially backs off an established active scope to at most 5 seconds between queries; a Windows ordinary launch keeps one runner and IPC channel until the Job reports zero active processes. Target standard handles are inherited directly, with no named-pipe stdio or result files.
152
151
  - **Windows Job inheritance has defined exclusions** — ordinary descendants inherit the Job by default, but breakaway processes are outside the guarantee. The target starts only after Job assignment; external termination of the runner in the narrow create-to-assignment interval can leave a suspended target behind.
153
- - **Windows terminal signalling is console-wide** — SIGINT is delivered as a `\x03` Ctrl-C input write that conhost turns into a console-wide CTRL_C event; SIGTSTP and SIGHUP are rejected as unavailable; a `taskkill` without `/F` does not terminate console processes, so the teardown TERM tier is a grace wait before the `/F` escalation. Windows readiness has no exact stdin-wait tier: the prompt-marker fast path compares the shell pid as the pseudo foreground group, and silence/timing tiers cover the rest.
152
+ - **Windows terminal signalling is console-wide** — SIGINT is delivered as a `\x03` Ctrl-C input write that the console host turns into a console-wide CTRL_C event (on Windows that host is node-pty's bundled OpenConsole); SIGTSTP and SIGHUP are rejected as unavailable; a `taskkill` without `/F` does not terminate console processes, so the teardown TERM tier is a grace wait before the `/F` escalation. Windows readiness has no exact stdin-wait tier: the prompt-marker fast path compares the shell pid as the pseudo foreground group, and silence/timing tiers cover the rest.
153
+ - **Windows terminal allocation requires node-pty's bundled console host assets** — every Windows terminal is spawned with `useConptyDll: true`, so allocation resolves `conpty/conpty.dll` and `OpenConsole.exe` relative to node-pty's own addon; an asset that is missing or unpacked wrong makes `spawnTerminal` throw instead of falling back to the operating system console host. node-pty marks the option experimental, so a node-pty upgrade can change this behaviour. See the [bundled console host note](../../../.agents/notes/implemented/bug-fix/2026-09-28-pty-bundled-console-host.md).
154
154
  - **Fallback terminal ownership remains observational** — on macOS or Linux without usable user-systemd, a child that reparents before any foreground-inspection snapshot or leaves the owned terminal session can escape the process-table scan. The local provider does not add a continuous process-table monitor; supported Linux native mode instead retains these descendants through scope membership.
155
155
  - **In-process cleanup requires a JavaScript-observable exit** — direct `process.exit()`, default uncaught exceptions, and default unhandled rejections emit Node's synchronous `exit` event. The default OS disposition for an unhandled `SIGTERM`, `SIGINT`, or `SIGHUP` bypasses that event; an application covers those signals only by installing a handler that performs normal disposal or calls `process.exit()`. `SIGKILL`, fatal OOM, `process.abort()`, native crashes, power loss, and any failure that cannot run JavaScript require an external supervisor, container init, or equivalent OS owner.
156
156
  - **The credential scrub is a name heuristic** — `*KEY*`/`*PASSWORD*`/`*SECRET*`/`*TOKEN*` only; differently named secrets (for example `*PASSPHRASE*`) pass through, and a whitelist for over-scrubbed variables is noted future work.
package/README.zh.md CHANGED
@@ -101,7 +101,6 @@ Linux 普通进程和终端进程即使在 bootstrap 消费启动请求前被取
101
101
  | [`src/terminal.ts`](src/terminal.ts) | `node-pty` 终端句柄:Linux scope 绑定、前台检查与 fallback 清理 |
102
102
  | [`src/process-inspector.ts`](src/process-inspector.ts) | POSIX 进程树与会话检查 |
103
103
  | [`src/windows-inspector.ts`](src/windows-inspector.ts) | 经 koffi 的 Windows Toolhelp32 进程表检查 |
104
- | — | 不发布运行时不变式伴生入口;除所属 seam 强制执行的约定外,本包不公开独立的事件序列或可变数据关系。 |
105
104
 
106
105
  ### 主流程
107
106
 
@@ -150,7 +149,8 @@ spill 文件以 `0600` 权限、`O_EXCL` 与随机名称在 `0700` 每进程目
150
149
  - **native ownership 有明确宿主要求**——Linux 需要可读的 user manager 与 `systemd-run --expand-environment=no`;旧版 systemd 使用带告警的 PGID fallback。macOS 因没有受支持的公开 persistent owner,始终使用该 fallback。
151
150
  - **native 选择具有有界的每次 spawn 成本**——Linux 会重复检查 bootstrap 入口、libc `execve`/`fcntl` bindings、存活的 user manager 与 literal-argv scope 支持,直到这套完整探测首次成功;后续符合条件的普通命令或终端 spawn 只重新检查存活的 user manager。Windows 会在每次普通 spawn 前重新检查 runner 入口、bindings 与当前 Job 支持。Linux 深度探测的成功状态与 fallback 告警去重会在提供方生命周期内持续保留。所有探测都会在用户命令可能运行前完成,子进程探测的超时为 5 秒。每次 Linux 启动都会创建私有请求目录,以 50 毫秒间隔检查尚未确定的 scope 建立状态;scope 已建立且仍 active 后,查询间隔按指数增长,最多为 5 秒。Windows 普通命令会保留一个 runner 与一条 IPC 通道,直到 Job 报告活动进程数为零。目标会直接继承标准句柄,不使用 named-pipe stdio 或结果文件。
152
151
  - **Windows Job inheritance 有明确排除项**——普通后代默认继承 Job,但 breakaway 进程不在保证范围。目标只在 Job 分配后启动;runner 若在 create-to-assignment 极窄区间遭外力终止,可能留下 suspended target。
153
- - **Windows 终端信号是控制台级的**——SIGINT 以 `\x03` Ctrl-C 输入写入投递,由 conhost 转为控制台级 CTRL_C 事件;SIGTSTP 与 SIGHUP 被拒绝(不可用);不带 `/F` 的 `taskkill` 无法终止控制台进程,因此拆卸的 TERM 档是 `/F` 升级前的宽限等待。Windows 就绪没有精确的 stdin-wait 档:prompt-marker 快路径把 shell pid 作为伪前台进程组比较,其余由静默与计时档覆盖。
152
+ - **Windows 终端信号是控制台级的**——SIGINT 以 `\x03` Ctrl-C 输入写入投递,由控制台宿主(Windows 上为 node-pty 自带的 OpenConsole)转为控制台级 CTRL_C 事件;SIGTSTP 与 SIGHUP 被拒绝(不可用);不带 `/F` 的 `taskkill` 无法终止控制台进程,因此拆卸的 TERM 档是 `/F` 升级前的宽限等待。Windows 就绪没有精确的 stdin-wait 档:prompt-marker 快路径把 shell pid 作为伪前台进程组比较,其余由静默与计时档覆盖。
153
+ - **Windows 终端分配依赖 node-pty 自带的控制台宿主资产**——每个 Windows 终端都以 `useConptyDll: true` 启动,分配时按 node-pty 自身 addon 的相对位置解析 `conpty/conpty.dll` 与 `OpenConsole.exe`;资产缺失或解包错误会让 `spawnTerminal` 抛错,而不是回退到操作系统控制台宿主。node-pty 把该选项标为实验性,升级 node-pty 可能改变这一行为。见[自带控制台宿主说明](../../../.agents/notes/implemented/bug-fix/2026-09-28-pty-bundled-console-host.zh.md)。
154
154
  - **fallback 终端 ownership 仍依赖观察**——在 macOS 或缺少可用 user-systemd 的 Linux 上,子进程如果在任何前台检查快照之前重新设定父进程,或离开自有终端会话,就可能逃出进程表扫描。本地提供方不会新增持续进程表监视器;受支持的 Linux native 模式改由 scope membership 持有这些后代。
155
155
  - **进程内清理要求退出阶段仍能执行 JavaScript**——直接 `process.exit()`、默认未捕获异常和默认未处理 rejection 会发出 Node 同步 `exit` 事件。未安装 handler 时,`SIGTERM`、`SIGINT` 或 `SIGHUP` 的默认 OS 处置不会发出该事件;应用只有安装执行正常 dispose 或调用 `process.exit()` 的 handler 才能覆盖这些信号。`SIGKILL`、fatal OOM、`process.abort()`、native crash、断电,以及任何无法运行 JavaScript 的故障,都需要外部 supervisor、容器 init 或等价的 OS owner 负责。
156
156
  - **凭据清除依赖名称启发式规则**——只匹配 `*KEY*`/`*PASSWORD*`/`*SECRET*`/`*TOKEN*`;名称不同的 secret(例如 `*PASSPHRASE*`)会继续传递,对误删变量引入白名单属于已记录的后续工作。
package/lib/index.js CHANGED
@@ -1419,7 +1419,8 @@ var LocalSubprocessRuntime = class extends SubprocessRuntime {
1419
1419
  const inspector = this.terminalInspector ?? createProcessInspector();
1420
1420
  const containmentMode = this.selectContainmentMode("terminal");
1421
1421
  const env = targetEnvironment(spec);
1422
- const activity = prepareShellActivity(spec, env, this.internals.platform ?? process.platform);
1422
+ const platform = this.internals.platform ?? process.platform;
1423
+ const activity = prepareShellActivity(spec, env, platform);
1423
1424
  const launch = activity === void 0 ? spec : {
1424
1425
  ...spec,
1425
1426
  argv: activity.argv,
@@ -1433,7 +1434,8 @@ var LocalSubprocessRuntime = class extends SubprocessRuntime {
1433
1434
  env: {
1434
1435
  ...activity?.env ?? env,
1435
1436
  TERM: spec.terminalType
1436
- }
1437
+ },
1438
+ ...platform === "win32" ? { useConptyDll: true } : {}
1437
1439
  };
1438
1440
  let scope;
1439
1441
  let terminal;
@@ -1460,7 +1462,7 @@ var LocalSubprocessRuntime = class extends SubprocessRuntime {
1460
1462
  settled: directSettlement.promise,
1461
1463
  signal: (signal) => signalLinuxDirectProcess(terminal.pid, () => process.kill(terminal.pid, signal))
1462
1464
  });
1463
- handle = new LocalTerminalHandle(terminal, inspector, spec.graceMs, this.internals.platform ?? process.platform, owner, scope?.resolveOutcome, activity, () => {
1465
+ handle = new LocalTerminalHandle(terminal, inspector, spec.graceMs, platform, owner, scope?.resolveOutcome, activity, () => {
1464
1466
  this.terminals.delete(handle);
1465
1467
  }, spec.shellActivity === true);
1466
1468
  this.terminals.add(handle);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-subprocess-local",
3
3
  "description": "Local-subprocess implementation of the DeepSeek Harness subprocess seam",
4
- "version": "0.2.0-rc.2",
4
+ "version": "0.2.1-alpha.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -39,21 +39,21 @@
39
39
  ],
40
40
  "license": "MIT",
41
41
  "peerDependencies": {
42
- "@deepseek-ai/dsh-subprocess": "0.2.0-rc.2",
43
- "@deepseek-ai/dsh-timeout": "0.2.0-rc.2",
44
- "@deepseek-ai/cordis": "~4.0.4"
42
+ "@deepseek-ai/dsh-subprocess": "0.2.1-alpha.2",
43
+ "@deepseek-ai/dsh-timeout": "0.2.1-alpha.2",
44
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1"
45
45
  },
46
46
  "dependencies": {
47
+ "@deepseek-ai/dsh-lazy-require": "0.2.1-alpha.2",
48
+ "@deepseek-ai/dsh-win32-process": "0.2.1-alpha.2",
47
49
  "koffi": "3.1.1",
48
- "node-pty": "1.2.0-beta.15",
49
- "@deepseek-ai/dsh-lazy-require": "0.2.0-rc.2",
50
- "@deepseek-ai/dsh-win32-process": "0.2.0-rc.2"
50
+ "node-pty": "1.2.0-beta.15"
51
51
  },
52
52
  "devDependencies": {
53
- "@deepseek-ai/dsh-loader-smoke": "0.2.0-rc.2",
54
- "@deepseek-ai/dsh-subprocess": "0.2.0-rc.2",
55
- "@deepseek-ai/dsh-timeout": "0.2.0-rc.2",
56
- "@deepseek-ai/cordis": "~4.0.4"
53
+ "@deepseek-ai/dsh-loader-smoke": "0.2.1-alpha.2",
54
+ "@deepseek-ai/dsh-subprocess": "0.2.1-alpha.2",
55
+ "@deepseek-ai/dsh-timeout": "0.2.1-alpha.2",
56
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1"
57
57
  },
58
58
  "scripts": {
59
59
  "postinstall": "node scripts/ensure-spawn-helper.mjs"