@deepseek-ai/dsh-ptc-runtime-node 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
@@ -18,8 +18,8 @@
18
18
  en: 246231cf2a529550
19
19
  zh: 2b4ed96194acc639
20
20
  /deepseek-ai-dsh-ptc-runtime-node/use-this-package/configuration:
21
- en: e5bca585d02f08ca
22
- zh: a2e9a32fe4052d90
21
+ en: d8c1109db9f679ca
22
+ zh: 9c21a0bebc3a1c43
23
23
  /deepseek-ai-dsh-ptc-runtime-node/use-this-package/execution-and-results:
24
24
  en: 6d65b39223ca9f7a
25
25
  zh: 96f96341ecab1317
@@ -36,11 +36,11 @@
36
36
  en: 45527dad94dd9362
37
37
  zh: c1e1179391e89a3f
38
38
  /deepseek-ai-dsh-ptc-runtime-node/understand-the-implementation/source-and-built-bootstraps:
39
- en: c01071304a9d563a
40
- zh: 2938a64b13a257d8
39
+ en: 871adc8d69b07c85
40
+ zh: 2456b431749e78e0
41
41
  /deepseek-ai-dsh-ptc-runtime-node/understand-the-implementation/source-map:
42
- en: a6702856dec3d449
43
- zh: 0c442a74c8005571
42
+ en: e4cab2eb3f09e74b
43
+ zh: 5c10e8c4c0d9e56b
44
44
  /deepseek-ai-dsh-ptc-runtime-node/further-exploration:
45
45
  en: ac2e2ae13d3f1394
46
46
  zh: 5d08b9c658fcf83a
package/README.md CHANGED
@@ -52,8 +52,7 @@ Configure the provider row after its required services are available:
52
52
  | `maxMessageBytes` | `134,217,728` | Limit for a control frame, outstanding argument bytes and queued control writes |
53
53
  | `maxPendingCalls` | `128` | Maximum simultaneous host binding calls |
54
54
  | `graceMs` | `3,000` | Managed termination and output-drain grace |
55
- | `nodeExecutable` | Current Node executable | Executable resolved in the subprocess execution world |
56
- | `bootstrapPath` | Package bootstrap | Optional absolute path to a preinstalled built bootstrap in that world |
55
+ | `launch` | Local carrier | Explicit `{ kind: "node-script", executable, bootstrapPath? }` or `{ kind: "embedded", executable }` in the subprocess world |
57
56
 
58
57
  The [configuration catalog](../../../docs/config-catalog.md#deepseek-aidsh-ptc-runtime-node) defines accepted config fields. `resolve(request)` supplies cwd, the numeric or null deadline choice and the execution policy; `run(spec)` accepts those resolved inputs and does not fill missing values.
59
58
 
@@ -91,7 +90,7 @@ Length-framed JSON travels separately from stdout/stderr. The host bounds frames
91
90
 
92
91
  ### Source and built bootstraps
93
92
 
94
- Source execution loads an erasable-only bootstrap closure without relying on sibling built exports. Built execution uses the packaged `process.js` entry. An execution world that cannot map the host bootstrap requires a preinstalled compatible `bootstrapPath`; a host path is never assumed to name the same remote file.
93
+ Source execution loads an erasable-only bootstrap closure without relying on sibling built exports. Built script execution uses `process.js`; a remote script deployment supplies `launch.bootstrapPath`. Embedded carriers launch their private worker through `launch.executable`. `resolveLaunch()` selects the local default during construction; an explicit remote invocation never depends on whether the client itself is packaged. A host path is never assumed to name the same remote file.
95
94
 
96
95
  ### Source map
97
96
 
@@ -103,7 +102,6 @@ Source execution loads an erasable-only bootstrap closure without relying on sib
103
102
  | [`src/bootstrap.ts`](src/bootstrap.ts) | Program evaluation, binding proxies and output capture |
104
103
  | [`src/channel.ts`](src/channel.ts) | Framing, bounded writes and protocol failures |
105
104
  | [`src/output-ledger.ts`](src/output-ledger.ts) | Host accounting for the outer result |
106
- | — | No runtime invariant companion is published; framing and process cleanup are enforced across the process boundary rather than through independent same-process observations. |
107
105
 
108
106
  </details>
109
107
 
package/README.zh.md CHANGED
@@ -52,8 +52,7 @@ kind: "package-reference"
52
52
  | `maxMessageBytes` | `134,217,728` | 控制帧、未完成参数字节和排队控制写入的上限 |
53
53
  | `maxPendingCalls` | `128` | 同时进行的 Host 绑定调用数量上限 |
54
54
  | `graceMs` | `3,000` | 受管终止与输出排空宽限时间 |
55
- | `nodeExecutable` | 当前 Node 可执行文件 | 在子进程执行世界中解析的可执行文件 |
56
- | `bootstrapPath` | 包内 bootstrap | 该执行世界中预先安装的构建后 bootstrap 的可选绝对路径 |
55
+ | `launch` | 本地载体 | 子进程环境中显式的 `{ kind: "node-script", executable, bootstrapPath? }` 或 `{ kind: "embedded", executable }` |
57
56
 
58
57
  [配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-ptc-runtime-node)定义可接受的配置字段。`resolve(request)` 补全 cwd、数值或 null 截止选择与执行策略;`run(spec)` 接受这些已解析输入,不补缺省值。
59
58
 
@@ -91,7 +90,7 @@ Host 擦除可擦除类型,在配置的执行世界中解析可执行文件与
91
90
 
92
91
  ### 源代码与构建后 bootstrap
93
92
 
94
- 源代码执行加载仅含可擦除语法的 bootstrap 依赖,不依赖同级包的构建后导出。构建后执行使用包内 `process.js` 入口。无法映射 Host bootstrap 的执行世界需要预先安装兼容的 `bootstrapPath`;不会假设 Host 路径对应同一个远程文件。
93
+ 源代码执行加载仅含可擦除语法的 bootstrap 依赖,不依赖同级包的构建后导出。构建后脚本使用 `process.js`,远端脚本部署提供 `launch.bootstrapPath`。内嵌载体通过 `launch.executable` 启动私有 worker。`resolveLaunch()` 在构造时选择本地默认值;显式的远端调用不依赖客户端自身是否打包。不会假设 Host 路径对应同一个远程文件。
95
94
 
96
95
  ### 源码索引
97
96
 
@@ -103,7 +102,6 @@ Host 擦除可擦除类型,在配置的执行世界中解析可执行文件与
103
102
  | [`src/bootstrap.ts`](src/bootstrap.ts) | 程序求值、绑定代理与输出捕获 |
104
103
  | [`src/channel.ts`](src/channel.ts) | 分帧、有界写入与协议失败 |
105
104
  | [`src/output-ledger.ts`](src/output-ledger.ts) | Host 外层结果计量 |
106
- | — | 不发布运行时不变式配套模块;分帧与进程清理跨进程边界强制执行,不依靠同进程中的独立观测。 |
107
105
 
108
106
  </details>
109
107
 
package/lib/index.js CHANGED
@@ -4,7 +4,7 @@ import z from "@deepseek-ai/schemastery";
4
4
  import { DUNDER_MEMBER, PORTABLE_RESERVED_WORDS, PtcRuntime, RESERVED_BINDING_GLOBALS, RESERVED_ERROR_MEMBERS } from "@deepseek-ai/dsh-ptc-runtime";
5
5
  import { MAX_TIMER_DELAY_MS, clampTimeout } from "@deepseek-ai/dsh-timeout";
6
6
  import { SandboxUnavailableError, classifyRunnerFailure, isRunnerSpawnFailure } from "@deepseek-ai/dsh-sandbox";
7
- import { snapshotJsonValue } from "@deepseek-ai/dsh-util-values";
7
+ import { assertNever, snapshotJsonValue } from "@deepseek-ai/dsh-util-values";
8
8
  import { Buffer as Buffer$1 } from "node:buffer";
9
9
  import { fileURLToPath, pathToFileURL } from "node:url";
10
10
  //#region lib/types/bindings.js
@@ -340,15 +340,36 @@ var JsonChannel = class {
340
340
  //#region lib/types/launch.js
341
341
  /** Select source or built bootstrap assets in the mounted execution world. */
342
342
  /**
343
+ * Resolve the local carrier default or validate an explicit execution-world invocation.
344
+ * @param config - explicit remote or local worker configuration; omitted selects this carrier.
345
+ * @returns the worker invocation without guessing from the execution world's paths.
346
+ */
347
+ function resolveLaunch(config) {
348
+ const launch = config ?? {
349
+ kind: "pkg" in process ? "embedded" : "node-script",
350
+ executable: process.execPath
351
+ };
352
+ if (launch.executable.length === 0) throw new Error("ptc-runtime-node: launch.executable must be non-empty");
353
+ if (launch.kind === "node-script" && launch.bootstrapPath !== void 0 && !isAbsolute(launch.bootstrapPath)) throw new Error("ptc-runtime-node: launch.bootstrapPath must be absolute");
354
+ return launch;
355
+ }
356
+ /**
343
357
  * Select explicit arguments without inheriting host loader or inspector flags.
344
358
  * @param fs - Filesystem mapping host bootstrap assets into the process world.
345
- * @param config - Optional preinstalled built bootstrap.
359
+ * @param config - resolved worker invocation.
346
360
  * @param maxMessageBytes - Validated frame and queued-write limit.
347
361
  * @returns Arguments following the resolved Node executable.
348
362
  */
349
363
  function bootstrapArgs(fs, config, maxMessageBytes) {
350
- if (config.bootstrapPath !== void 0) return [config.bootstrapPath, String(maxMessageBytes)];
351
- if ("pkg" in process) return [String(maxMessageBytes)];
364
+ switch (config.kind) {
365
+ case "embedded": return [String(maxMessageBytes)];
366
+ case "node-script": return scriptBootstrapArgs(fs, config.bootstrapPath, maxMessageBytes);
367
+ /* v8 ignore next -- Callers supply the resolved, closed LaunchConfig union. */
368
+ default: return assertNever(config);
369
+ }
370
+ }
371
+ function scriptBootstrapArgs(fs, bootstrapPath, maxMessageBytes) {
372
+ if (bootstrapPath !== void 0) return [bootstrapPath, String(maxMessageBytes)];
352
373
  const mapped = (path) => {
353
374
  const result = fs.processPathFromHostPath(path);
354
375
  if (result === void 0) throw new Error(`PTC runtime bootstrap is unavailable in the subprocess execution world: ${path}`);
@@ -776,8 +797,14 @@ var NodePtcRuntime = class extends PtcRuntime {
776
797
  maxMessageBytes: z.number().default(134217728),
777
798
  maxPendingCalls: z.number().default(128),
778
799
  graceMs: z.number().default(3e3),
779
- nodeExecutable: z.string(),
780
- bootstrapPath: z.string()
800
+ launch: z.union([z.object({
801
+ kind: z.const("node-script").required(),
802
+ executable: z.string().required(),
803
+ bootstrapPath: z.string()
804
+ }), z.object({
805
+ kind: z.const("embedded").required(),
806
+ executable: z.string().required()
807
+ })])
781
808
  });
782
809
  language = "typescript";
783
810
  isolation = "process";
@@ -791,7 +818,7 @@ var NodePtcRuntime = class extends PtcRuntime {
791
818
  super(ctx);
792
819
  this.config = {
793
820
  ...config,
794
- nodeExecutable: config.nodeExecutable ?? process.execPath
821
+ launch: resolveLaunch(config.launch)
795
822
  };
796
823
  for (const [key, value] of Object.entries(this.config)) if (typeof value === "number" && (!Number.isFinite(value) || value <= 0)) throw new Error(`ptc-runtime-node: ${key} must be positive and finite`);
797
824
  for (const key of [
@@ -803,8 +830,6 @@ var NodePtcRuntime = class extends PtcRuntime {
803
830
  if (!Number.isSafeInteger(this.config.maxMessageBytes) || this.config.maxMessageBytes > 4294967295) throw new Error("ptc-runtime-node: maxMessageBytes must fit an unsigned 32-bit frame length");
804
831
  if (!Number.isSafeInteger(this.config.maxPendingCalls)) throw new Error("ptc-runtime-node: maxPendingCalls must be an integer");
805
832
  if (!Number.isSafeInteger(this.config.maxOldGenerationSizeMb)) throw new Error("ptc-runtime-node: maxOldGenerationSizeMb must be an integer");
806
- if (this.config.nodeExecutable.length === 0) throw new Error("ptc-runtime-node: nodeExecutable must be non-empty");
807
- if (this.config.bootstrapPath !== void 0 && !isAbsolute(this.config.bootstrapPath)) throw new Error("ptc-runtime-node: bootstrapPath must be absolute");
808
833
  ctx.effect(() => async () => {
809
834
  this.disposed = true;
810
835
  const active = [...this.live];
@@ -938,14 +963,14 @@ var NodePtcRuntime = class extends PtcRuntime {
938
963
  })),
939
964
  maxOutputBytes: this.config.maxOutputBytes
940
965
  };
941
- const executable = await this.ctx.subprocess.resolveExecutable(this.config.nodeExecutable, void 0, signal);
966
+ const executable = await this.ctx.subprocess.resolveExecutable(this.config.launch.executable, void 0, signal);
942
967
  if (settled) return await result.promise;
943
- const packaged = "pkg" in process && this.config.bootstrapPath === void 0;
968
+ const packaged = this.config.launch.kind === "embedded";
944
969
  const heapFlag = `--max-old-space-size=${this.config.maxOldGenerationSizeMb}`;
945
970
  const argv = [
946
971
  executable,
947
972
  ...packaged ? [] : [heapFlag],
948
- ...bootstrapArgs(this.ctx.fs, this.config, this.config.maxMessageBytes)
973
+ ...bootstrapArgs(this.ctx.fs, this.config.launch, this.config.maxMessageBytes)
949
974
  ];
950
975
  confined = policy.mode === "danger-full-access" ? void 0 : await this.ctx.sandbox.confine(argv, {
951
976
  ...policy,
@@ -4,8 +4,11 @@ import { PtcRuntime } from '@deepseek-ai/dsh-ptc-runtime';
4
4
  import type { PtcRunRequest, PtcRunResult, PtcRunSpec } from '@deepseek-ai/dsh-ptc-runtime';
5
5
  import type { SandboxMode } from '@deepseek-ai/dsh-sandbox';
6
6
  import type { LaunchConfig } from './launch.ts';
7
+ export type { LaunchConfig } from './launch.ts';
7
8
  /** Deployment-varying runtime bounds and launch choices. */
8
- export interface Config extends LaunchConfig {
9
+ export interface Config {
10
+ /** Worker invocation in the subprocess world; omitted selects the local carrier. */
11
+ launch?: LaunchConfig;
9
12
  /** Default elapsed deadline, including nested tool and approval waits. */
10
13
  timeoutMs?: number;
11
14
  /** Maximum numeric elapsed budget accepted by resolve. */
@@ -1,17 +1,30 @@
1
1
  import type { FileSystem } from '@deepseek-ai/dsh-fs';
2
- /** Deployment-owned Node executable and optional preinstalled built bootstrap. */
3
- export interface LaunchConfig {
4
- /** Executable in the subprocess world; defaults to the current Node executable. */
5
- nodeExecutable?: string;
6
- /** Absolute preinstalled built bootstrap in the execution world. */
2
+ /** Deployment-owned worker invocation in the subprocess execution world. */
3
+ export type LaunchConfig = {
4
+ /** Start a separately installed Node executable and JavaScript bootstrap. */
5
+ kind: 'node-script';
6
+ /** Executable name or path resolved by the subprocess provider. */
7
+ executable: string;
8
+ /** Absolute preinstalled bootstrap; omitted maps this package's bootstrap into the execution world. */
7
9
  bootstrapPath?: string;
8
- }
10
+ } | {
11
+ /** Start the private PTC worker embedded in a packaged executable. */
12
+ kind: 'embedded';
13
+ /** Packaged executable name or path resolved by the subprocess provider. */
14
+ executable: string;
15
+ };
16
+ /**
17
+ * Resolve the local carrier default or validate an explicit execution-world invocation.
18
+ * @param config - explicit remote or local worker configuration; omitted selects this carrier.
19
+ * @returns the worker invocation without guessing from the execution world's paths.
20
+ */
21
+ export declare function resolveLaunch(config?: LaunchConfig): LaunchConfig;
9
22
  /**
10
23
  * Select explicit arguments without inheriting host loader or inspector flags.
11
24
  * @param fs - Filesystem mapping host bootstrap assets into the process world.
12
- * @param config - Optional preinstalled built bootstrap.
25
+ * @param config - resolved worker invocation.
13
26
  * @param maxMessageBytes - Validated frame and queued-write limit.
14
27
  * @returns Arguments following the resolved Node executable.
15
28
  */
16
- export declare function bootstrapArgs(fs: FileSystem, config: LaunchConfig, maxMessageBytes: number): string[];
29
+ export declare function bootstrapArgs(fs: Pick<FileSystem, 'processPathFromHostPath'>, config: LaunchConfig, maxMessageBytes: number): string[];
17
30
  //# sourceMappingURL=launch.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-ptc-runtime-node",
3
3
  "description": "Sandboxed Node process implementation of the DeepSeek Harness PTC execution capability",
4
- "version": "0.2.0-rc.2",
4
+ "version": "0.2.1-alpha.2",
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/cordis": "~4.0.4",
35
- "@deepseek-ai/dsh-session": "0.2.0-rc.2",
36
- "@deepseek-ai/dsh-timeout": "0.2.0-rc.2",
37
- "@deepseek-ai/dsh-ptc-runtime": "0.2.0-rc.2",
38
- "@deepseek-ai/dsh-fs": "0.2.0-rc.2",
39
- "@deepseek-ai/dsh-subprocess": "0.2.0-rc.2",
40
- "@deepseek-ai/dsh-sandbox": "0.2.0-rc.2",
41
- "@deepseek-ai/dsh-sandbox-policy": "0.2.0-rc.2"
34
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1",
35
+ "@deepseek-ai/dsh-ptc-runtime": "0.2.1-alpha.2",
36
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.2",
37
+ "@deepseek-ai/dsh-timeout": "0.2.1-alpha.2",
38
+ "@deepseek-ai/dsh-fs": "0.2.1-alpha.2",
39
+ "@deepseek-ai/dsh-subprocess": "0.2.1-alpha.2",
40
+ "@deepseek-ai/dsh-sandbox": "0.2.1-alpha.2",
41
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.1-alpha.2"
42
42
  },
43
43
  "dependencies": {
44
- "@deepseek-ai/dsh-util-values": "0.2.0-rc.2",
45
- "@deepseek-ai/schemastery": "~3.18.4"
44
+ "@deepseek-ai/dsh-util-values": "0.2.1-alpha.2",
45
+ "@deepseek-ai/schemastery": "~3.18.5-alpha.1"
46
46
  },
47
47
  "devDependencies": {
48
- "@deepseek-ai/cordis": "~4.0.4",
49
- "@deepseek-ai/dsh-ptc-runtime": "0.2.0-rc.2",
50
- "@deepseek-ai/dsh-session": "0.2.0-rc.2",
51
- "@deepseek-ai/dsh-timeout": "0.2.0-rc.2",
52
- "@deepseek-ai/dsh-fs": "0.2.0-rc.2",
53
- "@deepseek-ai/dsh-subprocess": "0.2.0-rc.2",
54
- "@deepseek-ai/dsh-sandbox": "0.2.0-rc.2",
55
- "@deepseek-ai/dsh-sandbox-policy": "0.2.0-rc.2",
56
- "@deepseek-ai/dsh-subprocess-local": "0.2.0-rc.2",
57
- "@deepseek-ai/dsh-session-projection": "0.2.0-rc.2",
58
- "@deepseek-ai/dsh-sandbox-local": "0.2.0-rc.2",
59
- "@deepseek-ai/dsh-fs-local": "0.2.0-rc.2"
48
+ "@deepseek-ai/cordis": "~4.0.5-alpha.1",
49
+ "@deepseek-ai/dsh-ptc-runtime": "0.2.1-alpha.2",
50
+ "@deepseek-ai/dsh-session": "0.2.1-alpha.2",
51
+ "@deepseek-ai/dsh-timeout": "0.2.1-alpha.2",
52
+ "@deepseek-ai/dsh-fs": "0.2.1-alpha.2",
53
+ "@deepseek-ai/dsh-subprocess": "0.2.1-alpha.2",
54
+ "@deepseek-ai/dsh-sandbox": "0.2.1-alpha.2",
55
+ "@deepseek-ai/dsh-sandbox-policy": "0.2.1-alpha.2",
56
+ "@deepseek-ai/dsh-fs-local": "0.2.1-alpha.2",
57
+ "@deepseek-ai/dsh-subprocess-local": "0.2.1-alpha.2",
58
+ "@deepseek-ai/dsh-session-projection": "0.2.1-alpha.2",
59
+ "@deepseek-ai/dsh-sandbox-local": "0.2.1-alpha.2"
60
60
  }
61
61
  }