@deepseek-ai/dsh-workflow-worker-thread 0.0.1-rc.3 → 0.1.0-rc.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/LICENSE CHANGED
@@ -1,28 +1,21 @@
1
- BSD 3-Clause License
1
+ MIT License
2
2
 
3
- Copyright (c) 2026, DeepSeek
3
+ Copyright (c) 2026 DeepSeek
4
4
 
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are met:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
7
11
 
8
- 1. Redistributions of source code must retain the above copyright notice, this
9
- list of conditions and the following disclaimer.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
10
14
 
11
- 2. Redistributions in binary form must reproduce the above copyright notice,
12
- this list of conditions and the following disclaimer in the documentation
13
- and/or other materials provided with the distribution.
14
-
15
- 3. Neither the name of the copyright holder nor the names of its
16
- contributors may be used to endorse or promote products derived from
17
- this software without specific prior written permission.
18
-
19
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import { availableParallelism } from "node:os";
2
+ import { availableParallelism, tmpdir } from "node:os";
3
3
  import * as vm from "node:vm";
4
4
  import z from "@deepseek-ai/schemastery";
5
5
  import WorkflowEngine, { WorkflowError, WorkflowRunId } from "@deepseek-ai/dsh-workflow";
@@ -187,10 +187,33 @@ var HostToWorkerType;
187
187
  * @module @deepseek-ai/dsh-workflow-worker-thread/host
188
188
  */
189
189
  /**
190
+ * The scrubbed worker environment: no ambient credentials, no loader flags.
191
+ * Windows derives `os.tmpdir()` from `TMP`/`TEMP` and falls back to the
192
+ * literal relative path `undefined\temp` when the environment is empty, so
193
+ * tsx's transform cache would land in a cwd-relative `undefined/temp`
194
+ * directory; the host's real temp path (not a credential) is injected there.
195
+ * The unbuilt shape additionally forwards `TSX_TSCONFIG_PATH` for path
196
+ * resolution.
197
+ * @param platform - host platform; overridable so tests exercise both peer arms.
198
+ * @param tsconfigPath - the tsconfig pin to forward; only the unbuilt caller
199
+ * passes one, so the built worker never observes the host's pin.
200
+ * @returns the scrubbed worker environment object.
201
+ */
202
+ function workerSpawnEnv(platform = process.platform, tsconfigPath) {
203
+ const env = {};
204
+ if (platform === "win32") {
205
+ const tmp = tmpdir();
206
+ env.TMP = tmp;
207
+ env.TEMP = tmp;
208
+ }
209
+ if (tsconfigPath !== void 0) env.TSX_TSCONFIG_PATH = tsconfigPath;
210
+ return env;
211
+ }
212
+ /**
190
213
  * Resolve a built worker bundle or an unbuilt bootstrap that installs both tsx
191
214
  * transforms inside the worker. Both shapes clear `execArgv` and the ambient
192
- * environment; the unbuilt shape forwards only `TSX_TSCONFIG_PATH` for path
193
- * resolution.
215
+ * environment (the worker only sees the platform temp path and, unbuilt,
216
+ * `TSX_TSCONFIG_PATH`).
194
217
  * @param init - the run payload, passed as `workerData`.
195
218
  * @returns the entry path or URL and the Worker options to spawn it with.
196
219
  */
@@ -200,7 +223,7 @@ function resolveWorkerSpawn(init) {
200
223
  entry: fileURLToPath(new URL("./worker.cjs", import.meta.url)),
201
224
  options: {
202
225
  workerData: init,
203
- env: {},
226
+ env: workerSpawnEnv(),
204
227
  execArgv: []
205
228
  }
206
229
  };
@@ -218,7 +241,7 @@ function resolveWorkerSpawn(init) {
218
241
  entry: new URL(`data:text/javascript,${encodeURIComponent(bootstrap)}`),
219
242
  options: {
220
243
  workerData: init,
221
- env: process.env.TSX_TSCONFIG_PATH === void 0 ? {} : { TSX_TSCONFIG_PATH: process.env.TSX_TSCONFIG_PATH },
244
+ env: workerSpawnEnv(void 0, process.env.TSX_TSCONFIG_PATH),
222
245
  execArgv: []
223
246
  }
224
247
  };
@@ -11,6 +11,20 @@ import type SubagentRuntime from '@deepseek-ai/dsh-subagent';
11
11
  import type { WorkflowMeta, WorkflowResult, WorkflowRun, WorkflowRunId } from '@deepseek-ai/dsh-workflow';
12
12
  import type { ExecutionObserver } from './runtime.ts';
13
13
  import type { WorkerInit } from './types.ts';
14
+ /**
15
+ * The scrubbed worker environment: no ambient credentials, no loader flags.
16
+ * Windows derives `os.tmpdir()` from `TMP`/`TEMP` and falls back to the
17
+ * literal relative path `undefined\temp` when the environment is empty, so
18
+ * tsx's transform cache would land in a cwd-relative `undefined/temp`
19
+ * directory; the host's real temp path (not a credential) is injected there.
20
+ * The unbuilt shape additionally forwards `TSX_TSCONFIG_PATH` for path
21
+ * resolution.
22
+ * @param platform - host platform; overridable so tests exercise both peer arms.
23
+ * @param tsconfigPath - the tsconfig pin to forward; only the unbuilt caller
24
+ * passes one, so the built worker never observes the host's pin.
25
+ * @returns the scrubbed worker environment object.
26
+ */
27
+ export declare function workerSpawnEnv(platform?: NodeJS.Platform, tsconfigPath?: string): NodeJS.ProcessEnv;
14
28
  /**
15
29
  * One live worker-engine run — the seam's {@link WorkflowRun}, returned by
16
30
  * `start()` directly. Owns the Worker, the child registry, and the result
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/dsh-workflow-worker-thread",
3
3
  "description": "worker-thread workflow engine: executes model-written orchestration scripts off the host event loop, bridging agent() calls back to ctx.subagents",
4
- "version": "0.0.1-rc.3",
4
+ "version": "0.1.0-rc.2",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },
@@ -35,35 +35,35 @@
35
35
  "lib/worker.cjs",
36
36
  "lib/types/**/*.d.ts"
37
37
  ],
38
- "license": "BSD-3-Clause",
38
+ "license": "MIT",
39
39
  "peerDependencies": {
40
- "@deepseek-ai/dsh-agent": "^0.0.1-rc.3",
41
- "@deepseek-ai/dsh-brand": "^0.0.1-rc.3",
42
- "@deepseek-ai/dsh-invariants": "^0.0.1-rc.3",
43
- "@deepseek-ai/dsh-llm": "^0.0.1-rc.3",
44
- "@deepseek-ai/dsh-subagent": "^0.0.1-rc.3",
45
- "@deepseek-ai/dsh-tools": "^0.0.1-rc.3",
46
- "@deepseek-ai/dsh-workflow": "^0.0.1-rc.3",
47
- "@deepseek-ai/cordis": "^4.0.1-rc.1",
48
- "@deepseek-ai/dsh-session": "^0.0.1-rc.3"
40
+ "@deepseek-ai/dsh-agent": "^0.1.0-rc.2",
41
+ "@deepseek-ai/dsh-brand": "^0.1.0-rc.2",
42
+ "@deepseek-ai/dsh-invariants": "^0.1.0-rc.2",
43
+ "@deepseek-ai/dsh-session": "^0.1.0-rc.2",
44
+ "@deepseek-ai/dsh-subagent": "^0.1.0-rc.2",
45
+ "@deepseek-ai/dsh-tools": "^0.1.0-rc.2",
46
+ "@deepseek-ai/dsh-workflow": "^0.1.0-rc.2",
47
+ "@deepseek-ai/dsh-llm": "^0.1.0-rc.2",
48
+ "@deepseek-ai/cordis": "^4.0.1"
49
49
  },
50
50
  "dependencies": {
51
- "@deepseek-ai/schemastery": "^3.18.1-rc.1"
51
+ "@deepseek-ai/schemastery": "^3.18.1"
52
52
  },
53
53
  "devDependencies": {
54
54
  "tsx": "^4.19.2",
55
- "@deepseek-ai/dsh-agent": "^0.0.1-rc.3",
56
- "@deepseek-ai/dsh-agent-loop": "^0.0.1-rc.3",
57
- "@deepseek-ai/dsh-agent-loop-testkit": "^0.0.1-rc.3",
58
- "@deepseek-ai/dsh-invariants": "^0.0.1-rc.3",
59
- "@deepseek-ai/dsh-brand": "^0.0.1-rc.3",
60
- "@deepseek-ai/dsh-llm": "^0.0.1-rc.3",
61
- "@deepseek-ai/dsh-session": "^0.0.1-rc.3",
62
- "@deepseek-ai/dsh-subagent": "^0.0.1-rc.3",
63
- "@deepseek-ai/dsh-subagent-spawn-in-process": "^0.0.1-rc.3",
64
- "@deepseek-ai/dsh-tools": "^0.0.1-rc.3",
65
- "@deepseek-ai/dsh-workflow": "^0.0.1-rc.3",
66
- "@deepseek-ai/dsh-system-prompt": "^0.0.1-rc.3",
67
- "@deepseek-ai/cordis": "^4.0.1-rc.1"
55
+ "@deepseek-ai/dsh-agent": "^0.1.0-rc.2",
56
+ "@deepseek-ai/dsh-agent-loop": "^0.1.0-rc.2",
57
+ "@deepseek-ai/dsh-agent-loop-testkit": "^0.1.0-rc.2",
58
+ "@deepseek-ai/dsh-brand": "^0.1.0-rc.2",
59
+ "@deepseek-ai/dsh-invariants": "^0.1.0-rc.2",
60
+ "@deepseek-ai/dsh-llm": "^0.1.0-rc.2",
61
+ "@deepseek-ai/dsh-session": "^0.1.0-rc.2",
62
+ "@deepseek-ai/dsh-system-prompt": "^0.1.0-rc.2",
63
+ "@deepseek-ai/dsh-tools": "^0.1.0-rc.2",
64
+ "@deepseek-ai/dsh-subagent-spawn-in-process": "^0.1.0-rc.2",
65
+ "@deepseek-ai/dsh-subagent": "^0.1.0-rc.2",
66
+ "@deepseek-ai/dsh-workflow": "^0.1.0-rc.2",
67
+ "@deepseek-ai/cordis": "^4.0.1"
68
68
  }
69
69
  }