omegon 0.6.8 → 0.6.10

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.
Files changed (133) hide show
  1. package/extensions/cleave/dispatcher.ts +32 -6
  2. package/extensions/cleave/index.ts +21 -3
  3. package/extensions/cleave/subprocess-tracker.ts +72 -0
  4. package/extensions/project-memory/extraction-v2.ts +206 -434
  5. package/extensions/project-memory/index.ts +89 -182
  6. package/extensions/project-memory/llm-direct.ts +260 -0
  7. package/extensions/project-memory/types.ts +3 -3
  8. package/node_modules/@mariozechner/clipboard-linux-x64-gnu/README.md +3 -0
  9. package/node_modules/@mariozechner/clipboard-linux-x64-gnu/clipboard.linux-x64-gnu.node +0 -0
  10. package/node_modules/@mariozechner/{clipboard-darwin-arm64 → clipboard-linux-x64-gnu}/package.json +8 -5
  11. package/node_modules/@styrene-lab/pi-ai/dist/cli.js +0 -0
  12. package/node_modules/@types/node/README.md +2 -2
  13. package/node_modules/@types/node/assert/strict.d.ts +5 -11
  14. package/node_modules/@types/node/assert.d.ts +11 -171
  15. package/node_modules/@types/node/async_hooks.d.ts +8 -8
  16. package/node_modules/@types/node/buffer.buffer.d.ts +1 -7
  17. package/node_modules/@types/node/buffer.d.ts +44 -168
  18. package/node_modules/@types/node/child_process.d.ts +21 -64
  19. package/node_modules/@types/node/cluster.d.ts +240 -332
  20. package/node_modules/@types/node/console.d.ts +49 -351
  21. package/node_modules/@types/node/constants.d.ts +3 -4
  22. package/node_modules/@types/node/crypto.d.ts +287 -1639
  23. package/node_modules/@types/node/dgram.d.ts +15 -51
  24. package/node_modules/@types/node/diagnostics_channel.d.ts +4 -4
  25. package/node_modules/@types/node/dns/promises.d.ts +3 -3
  26. package/node_modules/@types/node/dns.d.ts +131 -132
  27. package/node_modules/@types/node/domain.d.ts +13 -17
  28. package/node_modules/@types/node/events.d.ts +866 -795
  29. package/node_modules/@types/node/fs/promises.d.ts +7 -8
  30. package/node_modules/@types/node/fs.d.ts +419 -455
  31. package/node_modules/@types/node/globals.d.ts +6 -26
  32. package/node_modules/@types/node/globals.typedarray.d.ts +60 -0
  33. package/node_modules/@types/node/http.d.ts +310 -276
  34. package/node_modules/@types/node/http2.d.ts +528 -804
  35. package/node_modules/@types/node/https.d.ts +63 -243
  36. package/node_modules/@types/node/index.d.ts +15 -1
  37. package/node_modules/@types/node/inspector/promises.d.ts +41 -0
  38. package/node_modules/@types/node/inspector.d.ts +42 -50
  39. package/node_modules/@types/node/inspector.generated.d.ts +572 -417
  40. package/node_modules/@types/node/module.d.ts +47 -195
  41. package/node_modules/@types/node/net.d.ts +68 -189
  42. package/node_modules/@types/node/os.d.ts +6 -6
  43. package/node_modules/@types/node/package.json +3 -3
  44. package/node_modules/@types/node/path/posix.d.ts +8 -0
  45. package/node_modules/@types/node/path/win32.d.ts +8 -0
  46. package/node_modules/@types/node/path.d.ts +120 -133
  47. package/node_modules/@types/node/perf_hooks.d.ts +244 -643
  48. package/node_modules/@types/node/process.d.ts +219 -127
  49. package/node_modules/@types/node/punycode.d.ts +5 -5
  50. package/node_modules/@types/node/querystring.d.ts +4 -4
  51. package/node_modules/@types/node/quic.d.ts +910 -0
  52. package/node_modules/@types/node/readline/promises.d.ts +3 -3
  53. package/node_modules/@types/node/readline.d.ts +68 -120
  54. package/node_modules/@types/node/repl.d.ts +75 -98
  55. package/node_modules/@types/node/sea.d.ts +1 -1
  56. package/node_modules/@types/node/sqlite.d.ts +137 -30
  57. package/node_modules/@types/node/stream/consumers.d.ts +10 -10
  58. package/node_modules/@types/node/stream/promises.d.ts +136 -15
  59. package/node_modules/@types/node/stream/web.d.ts +176 -453
  60. package/node_modules/@types/node/stream.d.ts +565 -478
  61. package/node_modules/@types/node/string_decoder.d.ts +4 -4
  62. package/node_modules/@types/node/test/reporters.d.ts +96 -0
  63. package/node_modules/@types/node/test.d.ts +134 -199
  64. package/node_modules/@types/node/timers/promises.d.ts +4 -4
  65. package/node_modules/@types/node/timers.d.ts +4 -130
  66. package/node_modules/@types/node/tls.d.ts +109 -179
  67. package/node_modules/@types/node/trace_events.d.ts +9 -9
  68. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +1 -7
  69. package/node_modules/@types/node/ts5.6/index.d.ts +15 -1
  70. package/node_modules/@types/node/ts5.7/index.d.ts +15 -1
  71. package/node_modules/@types/node/tty.d.ts +58 -16
  72. package/node_modules/@types/node/url.d.ts +78 -594
  73. package/node_modules/@types/node/util/types.d.ts +558 -0
  74. package/node_modules/@types/node/util.d.ts +150 -796
  75. package/node_modules/@types/node/v8.d.ts +31 -21
  76. package/node_modules/@types/node/vm.d.ts +43 -30
  77. package/node_modules/@types/node/wasi.d.ts +4 -4
  78. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +27 -2
  79. package/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  80. package/node_modules/@types/node/web-globals/console.d.ts +9 -0
  81. package/node_modules/@types/node/web-globals/crypto.d.ts +7 -0
  82. package/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  83. package/node_modules/@types/node/web-globals/events.d.ts +9 -0
  84. package/node_modules/@types/node/web-globals/fetch.d.ts +7 -0
  85. package/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  86. package/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  87. package/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  88. package/node_modules/@types/node/web-globals/streams.d.ts +93 -0
  89. package/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  90. package/node_modules/@types/node/web-globals/url.d.ts +24 -0
  91. package/node_modules/@types/node/worker_threads.d.ts +186 -363
  92. package/node_modules/@types/node/zlib.d.ts +8 -71
  93. package/node_modules/cliui/CHANGELOG.md +121 -0
  94. package/node_modules/color-convert/CHANGELOG.md +54 -0
  95. package/node_modules/esprima/ChangeLog +235 -0
  96. package/node_modules/mz/HISTORY.md +66 -0
  97. package/node_modules/proper-lockfile/CHANGELOG.md +108 -0
  98. package/node_modules/source-map/CHANGELOG.md +301 -0
  99. package/node_modules/thenify/History.md +11 -0
  100. package/node_modules/thenify-all/History.md +11 -0
  101. package/node_modules/undici-types/agent.d.ts +1 -1
  102. package/node_modules/undici-types/api.d.ts +2 -2
  103. package/node_modules/undici-types/balanced-pool.d.ts +2 -1
  104. package/node_modules/undici-types/cache-interceptor.d.ts +1 -0
  105. package/node_modules/undici-types/client.d.ts +1 -1
  106. package/node_modules/undici-types/connector.d.ts +2 -2
  107. package/node_modules/undici-types/diagnostics-channel.d.ts +2 -2
  108. package/node_modules/undici-types/dispatcher.d.ts +12 -12
  109. package/node_modules/undici-types/fetch.d.ts +4 -4
  110. package/node_modules/undici-types/formdata.d.ts +1 -1
  111. package/node_modules/undici-types/h2c-client.d.ts +1 -1
  112. package/node_modules/undici-types/index.d.ts +9 -1
  113. package/node_modules/undici-types/interceptors.d.ts +36 -2
  114. package/node_modules/undici-types/package.json +1 -1
  115. package/node_modules/undici-types/pool.d.ts +1 -1
  116. package/node_modules/undici-types/readable.d.ts +2 -2
  117. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  118. package/node_modules/undici-types/websocket.d.ts +9 -9
  119. package/node_modules/which/CHANGELOG.md +166 -0
  120. package/node_modules/y18n/CHANGELOG.md +100 -0
  121. package/node_modules/yargs/CHANGELOG.md +88 -0
  122. package/node_modules/yargs-parser/CHANGELOG.md +263 -0
  123. package/package.json +5 -5
  124. package/extensions/render/composition/package-lock.json +0 -534
  125. package/node_modules/@mariozechner/clipboard-darwin-arm64/README.md +0 -3
  126. package/node_modules/@mariozechner/clipboard-darwin-arm64/clipboard.darwin-arm64.node +0 -0
  127. package/node_modules/@mariozechner/clipboard-darwin-universal/README.md +0 -3
  128. package/node_modules/@mariozechner/clipboard-darwin-universal/clipboard.darwin-universal.node +0 -0
  129. package/node_modules/@mariozechner/clipboard-darwin-universal/package.json +0 -19
  130. /package/node_modules/{p-retry/node_modules/@types → @types}/retry/LICENSE +0 -0
  131. /package/node_modules/{p-retry/node_modules/@types → @types}/retry/README.md +0 -0
  132. /package/node_modules/{p-retry/node_modules/@types → @types}/retry/index.d.ts +0 -0
  133. /package/node_modules/{p-retry/node_modules/@types → @types}/retry/package.json +0 -0
@@ -27,6 +27,7 @@ import { executeWithReview, type ReviewConfig, type ReviewExecutor, DEFAULT_REVI
27
27
  import { saveState } from "./workspace.ts";
28
28
  import { resolveTier, getDefaultPolicy, getViableModels, type ProviderRoutingPolicy, type RegistryModel } from "../lib/model-routing.ts";
29
29
  import { resolveOmegonSubprocess } from "../lib/omegon-subprocess.ts";
30
+ import { registerCleaveProc, deregisterCleaveProc, killCleaveProc } from "./subprocess-tracker.ts";
30
31
 
31
32
  // ─── Large-run threshold ────────────────────────────────────────────────────
32
33
 
@@ -385,6 +386,7 @@ async function spawnChild(
385
386
  const proc = spawn(omegon.command, args, {
386
387
  cwd,
387
388
  stdio: ["pipe", "pipe", "pipe"],
389
+ detached: true,
388
390
  env: {
389
391
  ...process.env,
390
392
  // Prevent nested detection issues
@@ -393,6 +395,7 @@ async function spawnChild(
393
395
  I_AM: "alpharius",
394
396
  },
395
397
  });
398
+ registerCleaveProc(proc);
396
399
 
397
400
  // Write prompt to stdin
398
401
  if (proc.stdin) {
@@ -417,24 +420,43 @@ async function spawnChild(
417
420
  });
418
421
  proc.stderr?.on("data", (data) => { stderr += data.toString(); });
419
422
 
423
+ // SIGKILL escalation helper — sends SIGKILL by process group with fallback
424
+ let escalationTimer: ReturnType<typeof setTimeout> | undefined;
425
+ const scheduleEscalation = () => {
426
+ escalationTimer = setTimeout(() => {
427
+ if (!proc.killed) {
428
+ try {
429
+ if (proc.pid) process.kill(-proc.pid, "SIGKILL");
430
+ } catch {
431
+ try { proc.kill("SIGKILL"); } catch { /* already dead */ }
432
+ }
433
+ }
434
+ }, 5_000);
435
+ };
436
+
420
437
  // Timeout enforcement
421
438
  const timer = setTimeout(() => {
422
439
  killed = true;
423
- proc.kill("SIGTERM");
424
- setTimeout(() => {
425
- if (!proc.killed) proc.kill("SIGKILL");
426
- }, 5_000);
440
+ killCleaveProc(proc);
441
+ scheduleEscalation();
427
442
  }, timeoutMs);
428
443
 
429
- // Abort signal support
444
+ // Abort signal support (with SIGKILL escalation — detached processes
445
+ // won't receive SIGHUP on parent exit, so SIGTERM alone is insufficient)
430
446
  const onAbort = () => {
431
447
  killed = true;
432
- proc.kill("SIGTERM");
448
+ killCleaveProc(proc);
449
+ scheduleEscalation();
433
450
  };
434
451
  signal?.addEventListener("abort", onAbort, { once: true });
435
452
 
453
+ let settled = false;
436
454
  proc.on("close", (code) => {
455
+ if (settled) return;
456
+ settled = true;
457
+ deregisterCleaveProc(proc);
437
458
  clearTimeout(timer);
459
+ clearTimeout(escalationTimer);
438
460
  signal?.removeEventListener("abort", onAbort);
439
461
  resolve({
440
462
  exitCode: killed ? -1 : (code ?? 1),
@@ -444,7 +466,11 @@ async function spawnChild(
444
466
  });
445
467
 
446
468
  proc.on("error", (err) => {
469
+ if (settled) return;
470
+ settled = true;
471
+ deregisterCleaveProc(proc);
447
472
  clearTimeout(timer);
473
+ clearTimeout(escalationTimer);
448
474
  signal?.removeEventListener("abort", onAbort);
449
475
  resolve({
450
476
  exitCode: 1,
@@ -20,6 +20,7 @@ import { truncateTail, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize } from "
20
20
  import { Text } from "@styrene-lab/pi-tui";
21
21
  import { Type } from "@sinclair/typebox";
22
22
  import { spawn, execFile } from "node:child_process";
23
+ import { registerCleaveProc, deregisterCleaveProc, killCleaveProc, killAllCleaveSubprocesses } from "./subprocess-tracker.ts";
23
24
  import * as fs from "node:fs";
24
25
  import * as path from "node:path";
25
26
  import { promisify } from "node:util";
@@ -766,12 +767,14 @@ async function runSpecAssessmentSubprocess(
766
767
  cwd: input.repoPath,
767
768
  shell: false,
768
769
  stdio: ["pipe", "pipe", "pipe"],
770
+ detached: true,
769
771
  env: {
770
772
  ...process.env,
771
773
  PI_CHILD: "1",
772
774
  TERM: process.env.TERM ?? "dumb",
773
775
  },
774
776
  });
777
+ registerCleaveProc(proc);
775
778
  let stdout = "";
776
779
  let stderr = "";
777
780
  let buffer = "";
@@ -789,10 +792,17 @@ async function runSpecAssessmentSubprocess(
789
792
  clearTimeout(timer);
790
793
  resolve(value);
791
794
  };
795
+ let escalationTimer: ReturnType<typeof setTimeout> | undefined;
792
796
  const timer = setTimeout(() => {
793
- proc.kill("SIGTERM");
794
- setTimeout(() => {
795
- if (!proc.killed) proc.kill("SIGKILL");
797
+ killCleaveProc(proc);
798
+ escalationTimer = setTimeout(() => {
799
+ if (!proc.killed) {
800
+ try {
801
+ if (proc.pid) process.kill(-proc.pid, "SIGKILL");
802
+ } catch {
803
+ try { proc.kill("SIGKILL"); } catch { /* already dead */ }
804
+ }
805
+ }
796
806
  }, 5_000);
797
807
  settleReject(new Error(`Timed out after 120s while assessing ${input.changeName}.`));
798
808
  }, 120_000);
@@ -823,9 +833,13 @@ async function runSpecAssessmentSubprocess(
823
833
  stderr += data.toString();
824
834
  });
825
835
  proc.on("error", (error) => {
836
+ deregisterCleaveProc(proc);
837
+ clearTimeout(escalationTimer);
826
838
  settleReject(error);
827
839
  });
828
840
  proc.on("close", (code) => {
841
+ deregisterCleaveProc(proc);
842
+ clearTimeout(escalationTimer);
829
843
  if (buffer.trim()) processLine(buffer.trim());
830
844
  if ((code ?? 1) !== 0) {
831
845
  settleReject(new Error(stderr.trim() || `Assessment subprocess exited with code ${code ?? 1}.`));
@@ -1688,6 +1702,10 @@ export default function cleaveExtension(pi: ExtensionAPI) {
1688
1702
  }
1689
1703
  });
1690
1704
 
1705
+ // ── Subprocess cleanup on session exit ───────────────────────────────
1706
+ pi.on("session_shutdown", () => {
1707
+ killAllCleaveSubprocesses();
1708
+ });
1691
1709
 
1692
1710
  // ── cleave_assess tool ───────────────────────────────────────────────
1693
1711
  pi.registerTool({
@@ -0,0 +1,72 @@
1
+ /**
2
+ * cleave/subprocess-tracker — Process registry for cleave subprocesses.
3
+ *
4
+ * Mirrors the extraction-v2 pattern: all spawned child processes are tracked
5
+ * in a Set, killed by process group (SIGTERM to -pid), and cleaned up on
6
+ * session_shutdown. Prevents orphaned `pi` processes when assessments time
7
+ * out or sessions exit mid-dispatch.
8
+ */
9
+
10
+ import type { ChildProcess } from "node:child_process";
11
+
12
+ const allCleaveProcs = new Set<ChildProcess>();
13
+
14
+ /** Kill a single subprocess by process group, with fallback to direct kill. */
15
+ export function killCleaveProc(proc: ChildProcess): void {
16
+ try {
17
+ if (proc.pid) process.kill(-proc.pid, "SIGTERM");
18
+ } catch {
19
+ try { proc.kill("SIGTERM"); } catch { /* already dead */ }
20
+ }
21
+ }
22
+
23
+ /** Add a subprocess to the tracked set. */
24
+ export function registerCleaveProc(proc: ChildProcess): void {
25
+ allCleaveProcs.add(proc);
26
+ }
27
+
28
+ /** Remove a subprocess from the tracked set. */
29
+ export function deregisterCleaveProc(proc: ChildProcess): void {
30
+ allCleaveProcs.delete(proc);
31
+ }
32
+
33
+ /**
34
+ * Force-kill a single subprocess (SIGKILL) by process group, with fallback.
35
+ * Used for escalation when SIGTERM is ignored.
36
+ */
37
+ function forceKillCleaveProc(proc: ChildProcess): void {
38
+ try {
39
+ if (proc.pid) process.kill(-proc.pid, "SIGKILL");
40
+ } catch {
41
+ try { proc.kill("SIGKILL"); } catch { /* already dead */ }
42
+ }
43
+ }
44
+
45
+ /**
46
+ * Kill all tracked cleave subprocesses and clear the registry.
47
+ * Sends SIGTERM immediately, then SIGKILL after 5 seconds to any survivors.
48
+ * Because cleave subprocesses are spawned with `detached: true`, they will
49
+ * NOT receive SIGHUP when the parent exits — SIGKILL escalation is required.
50
+ */
51
+ export function killAllCleaveSubprocesses(): void {
52
+ const snapshot = [...allCleaveProcs];
53
+ for (const proc of snapshot) {
54
+ killCleaveProc(proc);
55
+ }
56
+ // Escalate: SIGKILL after 5s for any process that ignored SIGTERM.
57
+ // The timer is unref'd so it does not keep the Node.js event loop alive.
58
+ if (snapshot.length > 0) {
59
+ const escalation = setTimeout(() => {
60
+ for (const proc of snapshot) {
61
+ if (!proc.killed) forceKillCleaveProc(proc);
62
+ }
63
+ }, 5_000);
64
+ escalation.unref();
65
+ }
66
+ allCleaveProcs.clear();
67
+ }
68
+
69
+ /** Number of currently tracked subprocesses (for diagnostics). */
70
+ export function cleaveTrackedProcCount(): number {
71
+ return allCleaveProcs.size;
72
+ }