@neotx/core 0.1.0-alpha.5 → 0.1.0-alpha.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.
package/dist/index.js CHANGED
@@ -1207,7 +1207,10 @@ function isProcessAlive(pid) {
1207
1207
  try {
1208
1208
  process.kill(pid, 0);
1209
1209
  return true;
1210
- } catch {
1210
+ } catch (error) {
1211
+ if (error instanceof Error && "code" in error && error.code === "EPERM") {
1212
+ return true;
1213
+ }
1211
1214
  return false;
1212
1215
  }
1213
1216
  }
@@ -1282,6 +1285,7 @@ var RunStore = class {
1282
1285
  const content = await readFile4(filePath, "utf-8");
1283
1286
  const run = JSON.parse(content);
1284
1287
  if (run.status !== "running") return null;
1288
+ if (run.pid && run.pid === process.pid) return null;
1285
1289
  if (run.pid && isProcessAlive(run.pid)) return null;
1286
1290
  const ageMs = Date.now() - new Date(run.createdAt).getTime();
1287
1291
  if (ageMs < ORPHAN_GRACE_PERIOD_MS) return null;
@@ -2602,6 +2606,7 @@ var Orchestrator = class extends NeoEventEmitter {
2602
2606
  workflow: input.workflow,
2603
2607
  repo: input.repo,
2604
2608
  prompt: input.prompt,
2609
+ pid: process.pid,
2605
2610
  status: "running",
2606
2611
  steps: {},
2607
2612
  createdAt: activeSession.startedAt,
@@ -2789,6 +2794,7 @@ var Orchestrator = class extends NeoEventEmitter {
2789
2794
  workflow: input.workflow,
2790
2795
  repo: input.repo,
2791
2796
  prompt: input.prompt,
2797
+ pid: process.pid,
2792
2798
  branch: taskResult.branch,
2793
2799
  status: taskResult.status === "success" ? "completed" : "failed",
2794
2800
  steps: taskResult.steps,