taskplane 0.20.4 → 0.20.6

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.
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Fork entry point for the engine child process.
3
+ *
4
+ * Node v25 blocks .ts files inside node_modules regardless of flags.
5
+ * This .mjs file loads cleanly (no TypeScript processing needed), then
6
+ * uses jiti to import engine-worker.ts — bypassing Node's restriction.
7
+ *
8
+ * jiti is the same TypeScript runtime loader that Pi uses to load
9
+ * extensions. It transforms .ts files itself, independent of Node's
10
+ * --experimental-strip-types support.
11
+ */
12
+ import { createJiti } from "jiti";
13
+ import { fileURLToPath } from "node:url";
14
+ import { dirname, join } from "node:path";
15
+
16
+ const __dirname = dirname(fileURLToPath(import.meta.url));
17
+ const jiti = createJiti(import.meta.url);
18
+ await jiti.import(join(__dirname, "engine-worker.ts"));
@@ -897,7 +897,7 @@ function resolveEngineWorkerPath(): string {
897
897
  } catch {
898
898
  thisDir = __dirname;
899
899
  }
900
- return join(thisDir, "engine-worker.ts");
900
+ return join(thisDir, "engine-worker-entry.mjs");
901
901
  }
902
902
 
903
903
  /**
@@ -940,8 +940,10 @@ export function startBatchInWorker(
940
940
 
941
941
  let child: ChildProcess;
942
942
  try {
943
+ // Fork a child process to run the engine in a separate isolate.
944
+ // The entry point is a .mjs file that uses jiti to load .ts files,
945
+ // bypassing Node v25's restriction on .ts in node_modules.
943
946
  child = fork(workerPath, [], {
944
- execArgv: ["--experimental-transform-types", "--no-warnings"],
945
947
  env: { ...process.env, TASKPLANE_ENGINE_FORK: "1" },
946
948
  serialization: "advanced",
947
949
  });
@@ -984,12 +986,10 @@ export function startBatchInWorker(
984
986
  return null;
985
987
  }
986
988
 
987
- // Send workerData as first IPC message (fork doesn't have workerData)
989
+ // Send workerData as first IPC message
988
990
  child.send({ type: "init", data: wkData });
989
991
 
990
992
  // Terminal settlement guard (R001 §3): ensures onTerminal fires at most once.
991
- // The child can emit error + complete messages, followed by exit event.
992
- // Without this guard, summary/integration/supervisor flows would fire multiple times.
993
993
  let settled = false;
994
994
  const settle = () => {
995
995
  if (settled) return;
@@ -1009,8 +1009,6 @@ export function startBatchInWorker(
1009
1009
  break;
1010
1010
 
1011
1011
  case "engine-event":
1012
- // Engine events are already persisted to events.jsonl by the child.
1013
- // No additional handling needed on the main thread.
1014
1012
  break;
1015
1013
 
1016
1014
  case "state-sync":
@@ -1041,7 +1039,6 @@ export function startBatchInWorker(
1041
1039
  });
1042
1040
 
1043
1041
  child.on("error", (err: Error) => {
1044
- // Child process encountered an error
1045
1042
  if (batchState.phase !== "completed" && batchState.phase !== "failed") {
1046
1043
  batchState.phase = "failed";
1047
1044
  batchState.endedAt = Date.now();
@@ -1058,7 +1055,6 @@ export function startBatchInWorker(
1058
1055
 
1059
1056
  child.on("exit", (code: number | null) => {
1060
1057
  if (code !== 0 && !settled) {
1061
- // Non-zero exit that wasn't handled by 'error' or 'complete'
1062
1058
  if (batchState.phase !== "completed" && batchState.phase !== "failed") {
1063
1059
  batchState.phase = "failed";
1064
1060
  batchState.endedAt = Date.now();
@@ -1070,7 +1066,6 @@ export function startBatchInWorker(
1070
1066
  );
1071
1067
  updateWidget();
1072
1068
  }
1073
- // Always settle on exit — ensures cleanup runs even on clean exit
1074
1069
  settle();
1075
1070
  });
1076
1071
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taskplane",
3
- "version": "0.20.4",
3
+ "version": "0.20.6",
4
4
  "description": "AI agent orchestration for pi — parallel task execution with checkpoint discipline",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -43,6 +43,7 @@
43
43
  "@sinclair/typebox": "*"
44
44
  },
45
45
  "dependencies": {
46
+ "jiti": "^2.6.1",
46
47
  "yaml": "^2.4.0"
47
48
  },
48
49
  "license": "MIT",