@sideboard-ai/core 0.1.164 → 0.1.165

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.
@@ -464,7 +464,7 @@ async function continueSourceThread(threadId, prompt) {
464
464
  await continueOnReply(threadId, prompt);
465
465
  return;
466
466
  }
467
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-MOK2ZLDI.js");
467
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-UQCRZ3DL.js");
468
468
  await getOrchestrator2().send(threadId, prompt);
469
469
  } catch {
470
470
  }
@@ -2626,6 +2626,20 @@ function jobAlive(pid) {
2626
2626
  return false;
2627
2627
  }
2628
2628
  }
2629
+ function processGroupAlive(pgid) {
2630
+ if (process.platform === "win32") return false;
2631
+ if (!Number.isInteger(pgid) || pgid <= 0) return false;
2632
+ try {
2633
+ process.kill(-pgid, 0);
2634
+ return true;
2635
+ } catch (err) {
2636
+ return err && typeof err === "object" && "code" in err && err.code === "EPERM";
2637
+ }
2638
+ }
2639
+ function jobTreeAlive(pid) {
2640
+ if (pid == null) return false;
2641
+ return jobAlive(pid) || processGroupAlive(pid);
2642
+ }
2629
2643
  function readIntFile(file) {
2630
2644
  if (!existsSync8(file)) return null;
2631
2645
  const n = Number.parseInt(readFileSync7(file, "utf8").trim(), 10);
@@ -2727,7 +2741,7 @@ function takeDelta(logFile, cursorFile) {
2727
2741
  }
2728
2742
  function snapshotJob(dir) {
2729
2743
  const pid = readIntFile(join10(dir, "pid"));
2730
- const running = pid != null && jobAlive(pid);
2744
+ const running = jobTreeAlive(pid);
2731
2745
  return {
2732
2746
  pid,
2733
2747
  running,
@@ -2855,15 +2869,15 @@ async function stopDetachedJob(cwd, id, opts) {
2855
2869
  };
2856
2870
  }
2857
2871
  appendJobLog(snap.log, `$ stop${why ? `: ${why}` : ""}`);
2858
- if (snap.pid != null) killProcessTree(snap.pid, "SIGTERM");
2872
+ const targetPid = snap.pid;
2873
+ if (targetPid != null) killProcessTree(targetPid, "SIGTERM");
2859
2874
  const graceMs = Number.isFinite(opts?.graceMs) ? Math.max(50, opts.graceMs) : 2e3;
2860
2875
  const deadline = Date.now() + graceMs;
2861
- while (Date.now() < deadline && snap.pid != null && jobAlive(snap.pid)) {
2876
+ while (Date.now() < deadline && jobTreeAlive(targetPid)) {
2862
2877
  await sleep(Math.min(100, Math.max(20, deadline - Date.now())));
2863
- snap = snapshotJob(dir);
2864
2878
  }
2865
- if (snap.pid != null && jobAlive(snap.pid)) {
2866
- killProcessTree(snap.pid, "SIGKILL");
2879
+ if (targetPid != null) {
2880
+ killProcessTree(targetPid, "SIGKILL");
2867
2881
  await sleep(100);
2868
2882
  }
2869
2883
  const exitFile = join10(dir, "exit");
@@ -2874,14 +2888,15 @@ async function stopDetachedJob(cwd, id, opts) {
2874
2888
  }
2875
2889
  }
2876
2890
  snap = snapshotJob(dir);
2891
+ const stillRunning = jobTreeAlive(targetPid) || snap.running;
2877
2892
  const result = toResult(jobId, snap, { failed: true });
2878
- const stopped = !snap.running;
2893
+ const stopped = !stillRunning;
2879
2894
  return {
2880
2895
  ...result,
2881
- stillRunning: snap.running,
2896
+ stillRunning,
2882
2897
  ok: false,
2883
2898
  failed: true,
2884
- status: snap.running ? "running" : "failed",
2899
+ status: stillRunning ? "running" : "failed",
2885
2900
  stopped,
2886
2901
  reason: stopped ? "stopped" : "still-running",
2887
2902
  stopReason: why || void 0,
@@ -6626,7 +6641,7 @@ function formatScheduledPrompt(name, prompt) {
6626
6641
  ${prompt}`;
6627
6642
  }
6628
6643
  async function defaultDeps() {
6629
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-MOK2ZLDI.js");
6644
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-UQCRZ3DL.js");
6630
6645
  const orch = getOrchestrator2();
6631
6646
  return {
6632
6647
  findThread: (id) => findThreadByRef(id),
@@ -399,7 +399,7 @@ async function continueSourceThread(threadId, prompt) {
399
399
  await continueOnReply(threadId, prompt);
400
400
  return;
401
401
  }
402
- const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-OBKLUBKI.js");
402
+ const { getOrchestrator: getOrchestrator2 } = await import("./orchestrator-T55HBVGL.js");
403
403
  await getOrchestrator2().send(threadId, prompt);
404
404
  } catch {
405
405
  }
@@ -2541,6 +2541,20 @@ function jobAlive(pid) {
2541
2541
  return false;
2542
2542
  }
2543
2543
  }
2544
+ function processGroupAlive(pgid) {
2545
+ if (process.platform === "win32") return false;
2546
+ if (!Number.isInteger(pgid) || pgid <= 0) return false;
2547
+ try {
2548
+ process.kill(-pgid, 0);
2549
+ return true;
2550
+ } catch (err) {
2551
+ return err && typeof err === "object" && "code" in err && err.code === "EPERM";
2552
+ }
2553
+ }
2554
+ function jobTreeAlive(pid) {
2555
+ if (pid == null) return false;
2556
+ return jobAlive(pid) || processGroupAlive(pid);
2557
+ }
2544
2558
  function readIntFile(file) {
2545
2559
  if (!existsSync8(file)) return null;
2546
2560
  const n = Number.parseInt(readFileSync7(file, "utf8").trim(), 10);
@@ -2642,7 +2656,7 @@ function takeDelta(logFile, cursorFile) {
2642
2656
  }
2643
2657
  function snapshotJob(dir) {
2644
2658
  const pid = readIntFile(join10(dir, "pid"));
2645
- const running = pid != null && jobAlive(pid);
2659
+ const running = jobTreeAlive(pid);
2646
2660
  return {
2647
2661
  pid,
2648
2662
  running,
@@ -2770,15 +2784,15 @@ async function stopDetachedJob(cwd, id, opts) {
2770
2784
  };
2771
2785
  }
2772
2786
  appendJobLog(snap.log, `$ stop${why ? `: ${why}` : ""}`);
2773
- if (snap.pid != null) killProcessTree(snap.pid, "SIGTERM");
2787
+ const targetPid = snap.pid;
2788
+ if (targetPid != null) killProcessTree(targetPid, "SIGTERM");
2774
2789
  const graceMs = Number.isFinite(opts?.graceMs) ? Math.max(50, opts.graceMs) : 2e3;
2775
2790
  const deadline = Date.now() + graceMs;
2776
- while (Date.now() < deadline && snap.pid != null && jobAlive(snap.pid)) {
2791
+ while (Date.now() < deadline && jobTreeAlive(targetPid)) {
2777
2792
  await sleep(Math.min(100, Math.max(20, deadline - Date.now())));
2778
- snap = snapshotJob(dir);
2779
2793
  }
2780
- if (snap.pid != null && jobAlive(snap.pid)) {
2781
- killProcessTree(snap.pid, "SIGKILL");
2794
+ if (targetPid != null) {
2795
+ killProcessTree(targetPid, "SIGKILL");
2782
2796
  await sleep(100);
2783
2797
  }
2784
2798
  const exitFile = join10(dir, "exit");
@@ -2789,14 +2803,15 @@ async function stopDetachedJob(cwd, id, opts) {
2789
2803
  }
2790
2804
  }
2791
2805
  snap = snapshotJob(dir);
2806
+ const stillRunning = jobTreeAlive(targetPid) || snap.running;
2792
2807
  const result = toResult(jobId, snap, { failed: true });
2793
- const stopped = !snap.running;
2808
+ const stopped = !stillRunning;
2794
2809
  return {
2795
2810
  ...result,
2796
- stillRunning: snap.running,
2811
+ stillRunning,
2797
2812
  ok: false,
2798
2813
  failed: true,
2799
- status: snap.running ? "running" : "failed",
2814
+ status: stillRunning ? "running" : "failed",
2800
2815
  stopped,
2801
2816
  reason: stopped ? "stopped" : "still-running",
2802
2817
  stopReason: why || void 0,
@@ -6216,7 +6231,7 @@ function formatScheduledPrompt(name, prompt) {
6216
6231
  ${prompt}`;
6217
6232
  }
6218
6233
  async function defaultDeps() {
6219
- const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-OBKLUBKI.js");
6234
+ const { getOrchestrator: getOrchestrator2, startOrchestration: startOrchestration2 } = await import("./orchestrator-T55HBVGL.js");
6220
6235
  const orch = getOrchestrator2();
6221
6236
  return {
6222
6237
  findThread: (id) => findThreadByRef(id),
package/dist/index.cjs CHANGED
@@ -15440,6 +15440,20 @@ function jobAlive(pid) {
15440
15440
  return false;
15441
15441
  }
15442
15442
  }
15443
+ function processGroupAlive(pgid) {
15444
+ if (process.platform === "win32") return false;
15445
+ if (!Number.isInteger(pgid) || pgid <= 0) return false;
15446
+ try {
15447
+ process.kill(-pgid, 0);
15448
+ return true;
15449
+ } catch (err) {
15450
+ return err && typeof err === "object" && "code" in err && err.code === "EPERM";
15451
+ }
15452
+ }
15453
+ function jobTreeAlive(pid) {
15454
+ if (pid == null) return false;
15455
+ return jobAlive(pid) || processGroupAlive(pid);
15456
+ }
15443
15457
  function readIntFile(file) {
15444
15458
  if (!(0, import_node_fs40.existsSync)(file)) return null;
15445
15459
  const n = Number.parseInt((0, import_node_fs40.readFileSync)(file, "utf8").trim(), 10);
@@ -15541,7 +15555,7 @@ function takeDelta(logFile, cursorFile) {
15541
15555
  }
15542
15556
  function snapshotJob(dir) {
15543
15557
  const pid = readIntFile((0, import_node_path40.join)(dir, "pid"));
15544
- const running = pid != null && jobAlive(pid);
15558
+ const running = jobTreeAlive(pid);
15545
15559
  return {
15546
15560
  pid,
15547
15561
  running,
@@ -15669,15 +15683,15 @@ async function stopDetachedJob(cwd, id, opts) {
15669
15683
  };
15670
15684
  }
15671
15685
  appendJobLog(snap.log, `$ stop${why ? `: ${why}` : ""}`);
15672
- if (snap.pid != null) killProcessTree(snap.pid, "SIGTERM");
15686
+ const targetPid = snap.pid;
15687
+ if (targetPid != null) killProcessTree(targetPid, "SIGTERM");
15673
15688
  const graceMs = Number.isFinite(opts?.graceMs) ? Math.max(50, opts.graceMs) : 2e3;
15674
15689
  const deadline = Date.now() + graceMs;
15675
- while (Date.now() < deadline && snap.pid != null && jobAlive(snap.pid)) {
15690
+ while (Date.now() < deadline && jobTreeAlive(targetPid)) {
15676
15691
  await sleep2(Math.min(100, Math.max(20, deadline - Date.now())));
15677
- snap = snapshotJob(dir);
15678
15692
  }
15679
- if (snap.pid != null && jobAlive(snap.pid)) {
15680
- killProcessTree(snap.pid, "SIGKILL");
15693
+ if (targetPid != null) {
15694
+ killProcessTree(targetPid, "SIGKILL");
15681
15695
  await sleep2(100);
15682
15696
  }
15683
15697
  const exitFile = (0, import_node_path40.join)(dir, "exit");
@@ -15688,14 +15702,15 @@ async function stopDetachedJob(cwd, id, opts) {
15688
15702
  }
15689
15703
  }
15690
15704
  snap = snapshotJob(dir);
15705
+ const stillRunning = jobTreeAlive(targetPid) || snap.running;
15691
15706
  const result = toResult(jobId, snap, { failed: true });
15692
- const stopped = !snap.running;
15707
+ const stopped = !stillRunning;
15693
15708
  return {
15694
15709
  ...result,
15695
- stillRunning: snap.running,
15710
+ stillRunning,
15696
15711
  ok: false,
15697
15712
  failed: true,
15698
- status: snap.running ? "running" : "failed",
15713
+ status: stillRunning ? "running" : "failed",
15699
15714
  stopped,
15700
15715
  reason: stopped ? "stopped" : "still-running",
15701
15716
  stopReason: why || void 0,
package/dist/index.js CHANGED
@@ -237,7 +237,7 @@ import {
237
237
  worktreeCleanupSettings,
238
238
  wrapReviewSkillMarkdown,
239
239
  writeWorktreeFile
240
- } from "./chunk-PNGP3UX5.js";
240
+ } from "./chunk-7MYB6LV7.js";
241
241
  import {
242
242
  LEGACY_PLAN_FILE_REL,
243
243
  PLAN_FILE_NAME,
@@ -13792,6 +13792,20 @@ function jobAlive(pid) {
13792
13792
  return false;
13793
13793
  }
13794
13794
  }
13795
+ function processGroupAlive(pgid) {
13796
+ if (process.platform === "win32") return false;
13797
+ if (!Number.isInteger(pgid) || pgid <= 0) return false;
13798
+ try {
13799
+ process.kill(-pgid, 0);
13800
+ return true;
13801
+ } catch (err) {
13802
+ return err && typeof err === "object" && "code" in err && err.code === "EPERM";
13803
+ }
13804
+ }
13805
+ function jobTreeAlive(pid) {
13806
+ if (pid == null) return false;
13807
+ return jobAlive(pid) || processGroupAlive(pid);
13808
+ }
13795
13809
  function readIntFile(file) {
13796
13810
  if (!(0, import_node_fs38.existsSync)(file)) return null;
13797
13811
  const n = Number.parseInt((0, import_node_fs38.readFileSync)(file, "utf8").trim(), 10);
@@ -13893,7 +13907,7 @@ function takeDelta(logFile, cursorFile) {
13893
13907
  }
13894
13908
  function snapshotJob(dir) {
13895
13909
  const pid = readIntFile((0, import_node_path38.join)(dir, "pid"));
13896
- const running = pid != null && jobAlive(pid);
13910
+ const running = jobTreeAlive(pid);
13897
13911
  return {
13898
13912
  pid,
13899
13913
  running,
@@ -14021,15 +14035,15 @@ async function stopDetachedJob(cwd, id, opts) {
14021
14035
  };
14022
14036
  }
14023
14037
  appendJobLog(snap.log, `$ stop${why ? `: ${why}` : ""}`);
14024
- if (snap.pid != null) killProcessTree(snap.pid, "SIGTERM");
14038
+ const targetPid = snap.pid;
14039
+ if (targetPid != null) killProcessTree(targetPid, "SIGTERM");
14025
14040
  const graceMs = Number.isFinite(opts?.graceMs) ? Math.max(50, opts.graceMs) : 2e3;
14026
14041
  const deadline = Date.now() + graceMs;
14027
- while (Date.now() < deadline && snap.pid != null && jobAlive(snap.pid)) {
14042
+ while (Date.now() < deadline && jobTreeAlive(targetPid)) {
14028
14043
  await sleep(Math.min(100, Math.max(20, deadline - Date.now())));
14029
- snap = snapshotJob(dir);
14030
14044
  }
14031
- if (snap.pid != null && jobAlive(snap.pid)) {
14032
- killProcessTree(snap.pid, "SIGKILL");
14045
+ if (targetPid != null) {
14046
+ killProcessTree(targetPid, "SIGKILL");
14033
14047
  await sleep(100);
14034
14048
  }
14035
14049
  const exitFile = (0, import_node_path38.join)(dir, "exit");
@@ -14040,14 +14054,15 @@ async function stopDetachedJob(cwd, id, opts) {
14040
14054
  }
14041
14055
  }
14042
14056
  snap = snapshotJob(dir);
14057
+ const stillRunning = jobTreeAlive(targetPid) || snap.running;
14043
14058
  const result = toResult(jobId, snap, { failed: true });
14044
- const stopped = !snap.running;
14059
+ const stopped = !stillRunning;
14045
14060
  return {
14046
14061
  ...result,
14047
- stillRunning: snap.running,
14062
+ stillRunning,
14048
14063
  ok: false,
14049
14064
  failed: true,
14050
- status: snap.running ? "running" : "failed",
14065
+ status: stillRunning ? "running" : "failed",
14051
14066
  stopped,
14052
14067
  reason: stopped ? "stopped" : "still-running",
14053
14068
  stopReason: why || void 0,
@@ -37,7 +37,7 @@ import {
37
37
  syncBoardPins,
38
38
  updateSchedule,
39
39
  waitForDetachedJob
40
- } from "../chunk-ZMRG2VJX.js";
40
+ } from "../chunk-XADKXAAI.js";
41
41
  import {
42
42
  isInternalAgentStatusText,
43
43
  listModelsForAgent,
@@ -7,7 +7,7 @@ import {
7
7
  isPidAlive,
8
8
  startOrchestration,
9
9
  waitForPidExit
10
- } from "./chunk-ZMRG2VJX.js";
10
+ } from "./chunk-XADKXAAI.js";
11
11
  import "./chunk-SVWI4427.js";
12
12
  import "./chunk-LZ6QMEQC.js";
13
13
  import "./chunk-S42XV45P.js";
@@ -5,7 +5,7 @@ import {
5
5
  isPidAlive,
6
6
  startOrchestration,
7
7
  waitForPidExit
8
- } from "./chunk-PNGP3UX5.js";
8
+ } from "./chunk-7MYB6LV7.js";
9
9
  import "./chunk-DJU54RYW.js";
10
10
  import "./chunk-CV33B57G.js";
11
11
  import "./chunk-OGR4GPSH.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sideboard-ai/core",
3
- "version": "0.1.164",
3
+ "version": "0.1.165",
4
4
  "description": "Sideboard core — orchestration, agents, git worktrees, MCP server",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",