agent-nuvira 3.5.0 → 3.5.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.
Files changed (134) hide show
  1. package/README.md +13 -13
  2. package/dist/agent-sdk/src/scaffold.d.ts +1 -1
  3. package/dist/agent-sdk/src/scaffold.js +1 -1
  4. package/dist/cli/chat.d.ts +159 -6
  5. package/dist/cli/chat.d.ts.map +1 -1
  6. package/dist/cli/chat.js +583 -35
  7. package/dist/cli/chat.js.map +1 -1
  8. package/dist/cli/duties.d.ts +11 -0
  9. package/dist/cli/duties.d.ts.map +1 -1
  10. package/dist/cli/duties.js +31 -0
  11. package/dist/cli/duties.js.map +1 -1
  12. package/dist/cli/edit.d.ts.map +1 -1
  13. package/dist/cli/edit.js +3 -2
  14. package/dist/cli/edit.js.map +1 -1
  15. package/dist/cli/execute.d.ts.map +1 -1
  16. package/dist/cli/execute.js +10 -3
  17. package/dist/cli/execute.js.map +1 -1
  18. package/dist/cli/loop-executor.d.ts +16 -0
  19. package/dist/cli/loop-executor.d.ts.map +1 -1
  20. package/dist/cli/loop-executor.js +9 -0
  21. package/dist/cli/loop-executor.js.map +1 -1
  22. package/dist/cli/models.d.ts.map +1 -1
  23. package/dist/cli/models.js +55 -0
  24. package/dist/cli/models.js.map +1 -1
  25. package/dist/cli/plan.d.ts.map +1 -1
  26. package/dist/cli/plan.js +18 -6
  27. package/dist/cli/plan.js.map +1 -1
  28. package/dist/cli/run.d.ts.map +1 -1
  29. package/dist/cli/run.js +23 -8
  30. package/dist/cli/run.js.map +1 -1
  31. package/dist/cli/ui/answer-view.d.ts +38 -0
  32. package/dist/cli/ui/answer-view.d.ts.map +1 -0
  33. package/dist/cli/ui/answer-view.js +72 -0
  34. package/dist/cli/ui/answer-view.js.map +1 -0
  35. package/dist/cli/ui/cards.d.ts +61 -0
  36. package/dist/cli/ui/cards.d.ts.map +1 -0
  37. package/dist/cli/ui/cards.js +141 -0
  38. package/dist/cli/ui/cards.js.map +1 -0
  39. package/dist/cli/ui/highlight.d.ts +32 -0
  40. package/dist/cli/ui/highlight.d.ts.map +1 -0
  41. package/dist/cli/ui/highlight.js +261 -0
  42. package/dist/cli/ui/highlight.js.map +1 -0
  43. package/dist/cli/ui/index.d.ts +21 -0
  44. package/dist/cli/ui/index.d.ts.map +1 -0
  45. package/dist/cli/ui/index.js +14 -0
  46. package/dist/cli/ui/index.js.map +1 -0
  47. package/dist/cli/ui/markdown.d.ts +90 -0
  48. package/dist/cli/ui/markdown.d.ts.map +1 -0
  49. package/dist/cli/ui/markdown.js +292 -0
  50. package/dist/cli/ui/markdown.js.map +1 -0
  51. package/dist/cli/ui/presenter.d.ts +147 -0
  52. package/dist/cli/ui/presenter.d.ts.map +1 -0
  53. package/dist/cli/ui/presenter.js +313 -0
  54. package/dist/cli/ui/presenter.js.map +1 -0
  55. package/dist/cli/ui/render.d.ts +52 -0
  56. package/dist/cli/ui/render.d.ts.map +1 -0
  57. package/dist/cli/ui/render.js +384 -0
  58. package/dist/cli/ui/render.js.map +1 -0
  59. package/dist/cli/ui/theme.d.ts +36 -0
  60. package/dist/cli/ui/theme.d.ts.map +1 -0
  61. package/dist/cli/ui/theme.js +92 -0
  62. package/dist/cli/ui/theme.js.map +1 -0
  63. package/dist/inference/model-entitlement.d.ts +10 -0
  64. package/dist/inference/model-entitlement.d.ts.map +1 -1
  65. package/dist/inference/model-entitlement.js +1 -1
  66. package/dist/inference/model-entitlement.js.map +1 -1
  67. package/dist/learning/auto-router.d.ts +38 -1
  68. package/dist/learning/auto-router.d.ts.map +1 -1
  69. package/dist/learning/auto-router.js +139 -8
  70. package/dist/learning/auto-router.js.map +1 -1
  71. package/dist/learning/duty-lease.d.ts +163 -0
  72. package/dist/learning/duty-lease.d.ts.map +1 -0
  73. package/dist/learning/duty-lease.js +301 -0
  74. package/dist/learning/duty-lease.js.map +1 -0
  75. package/dist/learning/model-first-router.d.ts +14 -0
  76. package/dist/learning/model-first-router.d.ts.map +1 -1
  77. package/dist/learning/model-first-router.js +54 -17
  78. package/dist/learning/model-first-router.js.map +1 -1
  79. package/dist/learning/model-warmup.d.ts +92 -0
  80. package/dist/learning/model-warmup.d.ts.map +1 -1
  81. package/dist/learning/model-warmup.js +137 -2
  82. package/dist/learning/model-warmup.js.map +1 -1
  83. package/dist/learning/reasoning-trace.d.ts +21 -1
  84. package/dist/learning/reasoning-trace.d.ts.map +1 -1
  85. package/dist/learning/reasoning-trace.js.map +1 -1
  86. package/dist/learning/resilient-call.d.ts.map +1 -1
  87. package/dist/learning/resilient-call.js +70 -4
  88. package/dist/learning/resilient-call.js.map +1 -1
  89. package/dist/learning/retry-patience.d.ts +139 -0
  90. package/dist/learning/retry-patience.d.ts.map +1 -0
  91. package/dist/learning/retry-patience.js +169 -0
  92. package/dist/learning/retry-patience.js.map +1 -0
  93. package/dist/tools/process-liveness.d.ts +227 -0
  94. package/dist/tools/process-liveness.d.ts.map +1 -0
  95. package/dist/tools/process-liveness.js +486 -0
  96. package/dist/tools/process-liveness.js.map +1 -0
  97. package/dist/tools/registry.d.ts.map +1 -1
  98. package/dist/tools/registry.js +4 -2
  99. package/dist/tools/registry.js.map +1 -1
  100. package/dist/tools/run-registry.d.ts +282 -0
  101. package/dist/tools/run-registry.d.ts.map +1 -0
  102. package/dist/tools/run-registry.js +544 -0
  103. package/dist/tools/run-registry.js.map +1 -0
  104. package/dist/tools/run-terminal.d.ts +100 -2
  105. package/dist/tools/run-terminal.d.ts.map +1 -1
  106. package/dist/tools/run-terminal.js +841 -67
  107. package/dist/tools/run-terminal.js.map +1 -1
  108. package/dist/tools/tool-loop.d.ts +87 -3
  109. package/dist/tools/tool-loop.d.ts.map +1 -1
  110. package/dist/tools/tool-loop.js +375 -6
  111. package/dist/tools/tool-loop.js.map +1 -1
  112. package/dist/web-dashboard/chat-console.d.ts +25 -0
  113. package/dist/web-dashboard/chat-console.d.ts.map +1 -1
  114. package/dist/web-dashboard/chat-console.js +16 -1
  115. package/dist/web-dashboard/chat-console.js.map +1 -1
  116. package/dist/web-dashboard/server.d.ts.map +1 -1
  117. package/dist/web-dashboard/server.js +7 -1
  118. package/dist/web-dashboard/server.js.map +1 -1
  119. package/dist/web-dashboard/src/types.d.ts +32 -1
  120. package/dist/web-dashboard/src/types.d.ts.map +1 -1
  121. package/dist/web-dashboard/task-registry.d.ts +98 -0
  122. package/dist/web-dashboard/task-registry.d.ts.map +1 -0
  123. package/dist/web-dashboard/task-registry.js +159 -0
  124. package/dist/web-dashboard/task-registry.js.map +1 -0
  125. package/dist/web-dashboard/task-runner.d.ts +155 -5
  126. package/dist/web-dashboard/task-runner.d.ts.map +1 -1
  127. package/dist/web-dashboard/task-runner.js +505 -14
  128. package/dist/web-dashboard/task-runner.js.map +1 -1
  129. package/package.json +4 -1
  130. package/src/web-dashboard/public/assets/index-DycGBWwy.js +236 -0
  131. package/src/web-dashboard/public/assets/index-DycGBWwy.js.map +1 -0
  132. package/src/web-dashboard/public/index.html +1 -1
  133. package/src/web-dashboard/public/assets/index-yky0dw5e.js +0 -236
  134. package/src/web-dashboard/public/assets/index-yky0dw5e.js.map +0 -1
@@ -0,0 +1,486 @@
1
+ /**
2
+ * Process liveness — is a long-running command WORKING, or is it HUNG?
3
+ *
4
+ * WHY THIS EXISTS. Handing a command to monitoring instead of killing it at a
5
+ * clock (see `run-terminal.ts`) removed the false failure, but it left the
6
+ * opposite hole open: a command that is genuinely STUCK — waiting on a prompt
7
+ * with no stdin, holding a lock, blocked on a socket that will never answer —
8
+ * now runs forever, and "it is still running" is not a diagnosis. Silence alone
9
+ * cannot tell the two apart, because a real test suite can be quiet for minutes
10
+ * while it works. The signal that separates them is CPU:
11
+ *
12
+ * - producing output → it is doing something
13
+ * - burning CPU with no output → it is computing (a build, a solver)
14
+ * - NO output AND NO CPU for a long time → it is waiting for something that is
15
+ * never coming. That is a hang, and it is a FACT about the process, not a
16
+ * guess from a stopwatch.
17
+ *
18
+ * So this module samples the process TREE (the shell `spawn(..., { shell: true })`
19
+ * creates plus everything under it) for cumulative CPU time, and classifies a
20
+ * run into `working` / `stalled` / `hung` with the evidence attached. Callers
21
+ * decide what to do with the verdict; the one rule this module enforces is that
22
+ * `hung` requires POSITIVE evidence (measurable CPU that is not advancing) —
23
+ * when CPU cannot be measured, a long silence is reported as `stalled`, never as
24
+ * `hung`, because an unmeasurable process must not be reaped on a guess.
25
+ *
26
+ * Platform: on POSIX the table comes from `ps` (macOS + Linux), the same tool
27
+ * `src/cli/process-control.ts` already relies on. On Windows it comes from ONE
28
+ * `Get-CimInstance Win32_Process` query — which reports `ParentProcessId` AND
29
+ * `KernelModeTime` + `UserModeTime` (CPU, in 100ns units) — so the same rule
30
+ * works there instead of degrading to silence-only: the tree walk and the
31
+ * zero-CPU evidence are both available, with `wmic` as the fallback the rest of
32
+ * this repo already uses.
33
+ *
34
+ * One Windows semantic difference is worth stating plainly, because `kill`
35
+ * implies something it cannot deliver there: Windows has no graceful SIGTERM.
36
+ * `process.kill(pid, 'SIGTERM')` is an immediate termination, so the
37
+ * SIGTERM→grace→SIGKILL ladder is a POSIX-only refinement.
38
+ */
39
+ import { execFileSync, execSync } from 'node:child_process';
40
+ export const DEFAULT_LIVENESS_THRESHOLDS = {
41
+ stallQuietMs: 60_000,
42
+ hangQuietMs: 300_000,
43
+ hangCpuFloorMs: 500,
44
+ };
45
+ /**
46
+ * The thresholds, with env overrides — read at CALL time, not module load, so a
47
+ * test (or an operator) can change them without re-importing.
48
+ *
49
+ * `NUVIRA_HANG_QUIET_MS` is the one that matters operationally: it is how long a
50
+ * command may be silent AND idle before the agent is told it is hung.
51
+ */
52
+ export function livenessThresholds(env = process.env) {
53
+ const int = (raw, fallback) => {
54
+ const n = Number.parseInt(String(raw ?? '').trim(), 10);
55
+ return Number.isFinite(n) && n > 0 ? n : fallback;
56
+ };
57
+ return {
58
+ stallQuietMs: int(env.NUVIRA_STALL_QUIET_MS, DEFAULT_LIVENESS_THRESHOLDS.stallQuietMs),
59
+ hangQuietMs: int(env.NUVIRA_HANG_QUIET_MS, DEFAULT_LIVENESS_THRESHOLDS.hangQuietMs),
60
+ hangCpuFloorMs: int(env.NUVIRA_HANG_CPU_MS, DEFAULT_LIVENESS_THRESHOLDS.hangCpuFloorMs),
61
+ };
62
+ }
63
+ /**
64
+ * Parse a `ps -o time=` value into milliseconds of cumulative CPU.
65
+ *
66
+ * Formats seen in the wild: `MM:SS.cc` (macOS), `HH:MM:SS` (Linux), and
67
+ * `DD-HH:MM:SS` (BSD, for a long-lived process). A value that does not parse is
68
+ * `null` — the caller must treat "no reading" differently from "no CPU", or a
69
+ * formatting change would read as a hang.
70
+ */
71
+ export function parseCpuTime(text) {
72
+ const m = /^(?:(\d+)-)?(?:(\d+):)?(\d+):(\d+(?:\.\d+)?)$/.exec(text.trim());
73
+ if (!m)
74
+ return null;
75
+ const days = Number(m[1] ?? 0);
76
+ const hours = Number(m[2] ?? 0);
77
+ const minutes = Number(m[3]);
78
+ const seconds = Number(m[4]);
79
+ if (![days, hours, minutes, seconds].every((n) => Number.isFinite(n)))
80
+ return null;
81
+ return ((days * 24 + hours) * 60 + minutes) * 60_000 + Math.round(seconds * 1000);
82
+ }
83
+ /**
84
+ * `lstart`, the OS's own answer to "when did this process start" — `Day Mon D
85
+ * HH:MM:SS YYYY` (e.g. `Tue Oct 14 15:02:03 2026`).
86
+ *
87
+ * Matched structurally because `ps` has no way to emit a marker column: the
88
+ * pattern is anchored right after the CPU field, and a command line whose first
89
+ * five words happen to look exactly like that is not a thing. If it does not
90
+ * match, the remainder is the command — the old behaviour, unchanged.
91
+ */
92
+ const POSIX_LSTART = /^([A-Za-z]{3}\s+[A-Za-z]{3}\s+\d{1,2}\s+\d{2}:\d{2}:\d{2}\s+\d{4})\s+(.*)$/;
93
+ /**
94
+ * Parse a POSIX process table: `ps -eo pid=,ppid=,time=,lstart=,command=` — and
95
+ * the older `…,command=` shape, which parses identically minus the start token.
96
+ *
97
+ * The command column is LAST on purpose: it may contain spaces and anything else,
98
+ * so everything after the known fields is taken verbatim.
99
+ */
100
+ export function parsePosixProcessTable(stdout) {
101
+ const table = new Map();
102
+ for (const line of stdout.split('\n')) {
103
+ const m = /^\s*(\d+)\s+(\d+)\s+(\S+)\s+(.*)$/.exec(line);
104
+ if (!m)
105
+ continue;
106
+ const rest = m[4].trim();
107
+ const withStart = POSIX_LSTART.exec(rest);
108
+ table.set(Number.parseInt(m[1], 10), {
109
+ ppid: Number.parseInt(m[2], 10),
110
+ cpuMs: parseCpuTime(m[3]),
111
+ command: (withStart ? withStart[2] : rest).trim() || null,
112
+ // Whitespace inside the token is collapsed so `ps`'s column padding cannot
113
+ // make two readings of the SAME process compare unequal.
114
+ startedAtText: withStart ? withStart[1].replace(/\s+/g, ' ').trim() : null,
115
+ });
116
+ }
117
+ return table;
118
+ }
119
+ /**
120
+ * Parse the Windows probe: `<pid>|<ppid>|<kernel 100ns>|<user 100ns>|<command>`.
121
+ *
122
+ * The pipe-delimited shape is the one `src/cli/process-control.ts` already uses
123
+ * for the same reason: it survives command lines that contain spaces, commas or
124
+ * quotes. A process whose CPU counters are unreadable (`KernelModeTime` is null
125
+ * for some system processes) yields an EMPTY field, which must stay
126
+ * "unmeasurable" — not zero — or an unreadable counter would read as a hang.
127
+ *
128
+ * 100ns units are converted to ms (÷10 000), the same unit `ps` reports in.
129
+ */
130
+ export function parseWindowsProcessTable(stdout) {
131
+ const table = new Map();
132
+ for (const line of stdout.split(/\r?\n/)) {
133
+ const parts = line.split('|');
134
+ if (parts.length < 4)
135
+ continue;
136
+ const pid = Number.parseInt(parts[0].trim(), 10);
137
+ const ppid = Number.parseInt(parts[1].trim(), 10);
138
+ if (!Number.isFinite(pid) || !Number.isFinite(ppid))
139
+ continue;
140
+ const kernel = Number.parseInt(parts[2].trim(), 10);
141
+ const user = Number.parseInt(parts[3].trim(), 10);
142
+ const measurable = Number.isFinite(kernel) && Number.isFinite(user);
143
+ // The start token is MARKED (`t<ticks>`), so the shape is unambiguous: a
144
+ // command line containing `|` can add fields but cannot manufacture a `t`
145
+ // marker, which a positional guess could be fooled by. A `t` with nothing
146
+ // after it is the honest "the OS would not tell us", not a fabricated value.
147
+ const marked = parts.length >= 5 && /^t\d*$/.test(parts[4].trim());
148
+ const commandFrom = marked ? 5 : 4;
149
+ table.set(pid, {
150
+ ppid,
151
+ cpuMs: measurable ? Math.round((kernel + user) / 10_000) : null,
152
+ command: (parts.slice(commandFrom).join('|').trim() || null),
153
+ startedAtText: marked ? parts[4].trim().slice(1) || null : null,
154
+ });
155
+ }
156
+ return table;
157
+ }
158
+ /**
159
+ * Parse the `wmic … /format:csv` fallback.
160
+ *
161
+ * Header-driven, because wmic emits its columns in QUERY order and the values
162
+ * themselves can contain commas — so the header is the only reliable index.
163
+ */
164
+ export function parseWmicProcessTable(stdout) {
165
+ const table = new Map();
166
+ const lines = stdout.split(/\r?\n/).filter((l) => l.trim().length > 0);
167
+ if (lines.length === 0)
168
+ return table;
169
+ const header = lines[0].split(',').map((h) => h.trim().toLowerCase());
170
+ const at = (...names) => header.findIndex((h) => names.includes(h));
171
+ const pidAt = at('processid');
172
+ const ppidAt = at('parentprocessid');
173
+ const kernelAt = at('kernelmodetime');
174
+ const userAt = at('usermodetime');
175
+ const created = at('creationdate');
176
+ if (pidAt < 0)
177
+ return table;
178
+ for (const line of lines.slice(1)) {
179
+ const cells = line.split(',');
180
+ const pid = Number.parseInt((cells[pidAt] ?? '').trim(), 10);
181
+ if (!Number.isFinite(pid))
182
+ continue;
183
+ const ppid = ppidAt >= 0 ? Number.parseInt((cells[ppidAt] ?? '').trim(), 10) : 0;
184
+ const kernel = kernelAt >= 0 ? Number.parseInt((cells[kernelAt] ?? '').trim(), 10) : Number.NaN;
185
+ const user = userAt >= 0 ? Number.parseInt((cells[userAt] ?? '').trim(), 10) : Number.NaN;
186
+ const measurable = Number.isFinite(kernel) && Number.isFinite(user);
187
+ // wmic CSV puts the host name first and the command line LAST (it can itself
188
+ // contain commas, so it is everything after the last known column).
189
+ table.set(pid, {
190
+ ppid: Number.isFinite(ppid) ? ppid : 0,
191
+ cpuMs: measurable ? Math.round((kernel + user) / 10_000) : null,
192
+ command: null,
193
+ // wmic's `creationdate` (`20261014150203.000000+060`): an opaque token that
194
+ // is stable across reads, which is all the identity check needs.
195
+ startedAtText: created >= 0 ? (cells[created] ?? '').trim() || null : null,
196
+ });
197
+ }
198
+ return table;
199
+ }
200
+ /**
201
+ * The Windows probe. `CreationDate.Ticks` (100ns since 0001-01-01) is the start
202
+ * token: a plain integer, so it cannot be mangled by locale, date format or the
203
+ * pipe the rest of the row uses. The `t` prefix marks the field's PRESENCE — an
204
+ * absent `CreationDate` yields bare `t`, which parses as "unknown", rather than
205
+ * shifting the command line into the wrong column.
206
+ */
207
+ const WINDOWS_PS_QUERY = 'Get-CimInstance Win32_Process | ForEach-Object { "$($_.ProcessId)|$($_.ParentProcessId)|$($_.KernelModeTime)|$($_.UserModeTime)|t$(if ($_.CreationDate) { $_.CreationDate.Ticks })|$($_.CommandLine)" }';
208
+ function readWindowsProcessTable() {
209
+ // execFileSync, not execSync: cmd.exe mangles PowerShell's `$()` syntax.
210
+ try {
211
+ const out = execFileSync('powershell', ['-NoProfile', '-NonInteractive', '-Command', WINDOWS_PS_QUERY], { encoding: 'utf8', timeout: 15_000, stdio: ['ignore', 'pipe', 'ignore'] });
212
+ const table = parseWindowsProcessTable(out);
213
+ if (table.size > 0)
214
+ return table;
215
+ }
216
+ catch {
217
+ // PowerShell unavailable or too slow — try the older tool.
218
+ }
219
+ try {
220
+ const out = execSync('wmic process get processid,parentprocessid,kernelmodetime,usermodetime,creationdate /format:csv', { encoding: 'utf8', timeout: 15_000, stdio: ['ignore', 'pipe', 'ignore'] });
221
+ const table = parseWmicProcessTable(out);
222
+ return table.size > 0 ? table : null;
223
+ }
224
+ catch {
225
+ return null;
226
+ }
227
+ }
228
+ function readPosixProcessTable() {
229
+ // `lstart` first, because it carries the identity token. A `ps` without it
230
+ // (an old or trimmed build) still gets the whole table — the start token is
231
+ // then simply unknown, which the identity rule treats as "no second witness"
232
+ // rather than as a mismatch.
233
+ for (const args of ['ps -eo pid=,ppid=,time=,lstart=,command=', 'ps -eo pid=,ppid=,time=,command=']) {
234
+ try {
235
+ const out = execSync(args, {
236
+ encoding: 'utf8',
237
+ timeout: 3_000,
238
+ stdio: ['ignore', 'pipe', 'ignore'],
239
+ });
240
+ const table = parsePosixProcessTable(out);
241
+ if (table.size > 0)
242
+ return table;
243
+ }
244
+ catch {
245
+ // Try the next shape; if both fail the answer is "unmeasurable", never
246
+ // "no CPU" — that distinction is what keeps a missing reading from
247
+ // certifying a hang.
248
+ }
249
+ }
250
+ return null;
251
+ }
252
+ /** One process table read: pid → { parent, cpu, command }. NEVER cached. */
253
+ function readProcessTable() {
254
+ return process.platform === 'win32' ? readWindowsProcessTable() : readPosixProcessTable();
255
+ }
256
+ /**
257
+ * One process table read, for a caller that needs the SAME view several times.
258
+ *
259
+ * A sample tick asks about every monitored run and then signals some of them, and
260
+ * on Windows each read costs a PowerShell start — so the tick reads the table ONCE
261
+ * and threads it through, instead of N times.
262
+ *
263
+ * Deliberately NOT a time-based cache. A cached table can answer about a snapshot
264
+ * taken before a process existed, and the answer it gives is "not found" — which
265
+ * a caller reads as "it is gone". That is the one direction this module must never
266
+ * guess in.
267
+ */
268
+ export function processTableSnapshot() {
269
+ return readProcessTable();
270
+ }
271
+ /**
272
+ * Sample the process tree rooted at `pid`: whether it exists, what it has cost
273
+ * in CPU so far, and every pid in it.
274
+ *
275
+ * The tree is the point. `spawn(command, { shell: true })` means the REAL work
276
+ * is a child of the shell we hold the handle to, so a sample (and a stop) that
277
+ * only looked at the root would report the shell's own ~0 CPU while the build
278
+ * underneath burned a core — the exact false hang this must not produce.
279
+ */
280
+ export function processTreeOf(table, pid) {
281
+ // pid <= 0 is not a process: 0 means "my process group" and -1 means "EVERY
282
+ // process I am allowed to signal". A caller that lost its pid must get an empty
283
+ // sample, never a signal to the whole machine.
284
+ if (!Number.isFinite(pid) || pid <= 0)
285
+ return { found: false, cpuMs: null, pids: [] };
286
+ if (!table.has(pid))
287
+ return { found: false, cpuMs: null, pids: [pid] };
288
+ // Children indexed by parent, so the walk is one pass per level.
289
+ const byParent = new Map();
290
+ for (const [childPid, info] of table) {
291
+ const siblings = byParent.get(info.ppid);
292
+ if (siblings)
293
+ siblings.push(childPid);
294
+ else
295
+ byParent.set(info.ppid, [childPid]);
296
+ }
297
+ const pids = [];
298
+ const queue = [pid];
299
+ const seen = new Set([pid]);
300
+ while (queue.length > 0) {
301
+ const current = queue.shift();
302
+ pids.push(current);
303
+ for (const child of byParent.get(current) ?? []) {
304
+ if (seen.has(child))
305
+ continue;
306
+ seen.add(child);
307
+ queue.push(child);
308
+ }
309
+ }
310
+ // CPU is summed only when EVERY node gave a reading: a partial sum would look
311
+ // like "less CPU than it really used", which is the safe direction only by
312
+ // accident. Missing data must stay "unmeasurable" — because "unmeasurable"
313
+ // cannot certify a hang, while a partial zero can.
314
+ let total = 0;
315
+ let measurable = true;
316
+ for (const treePid of pids) {
317
+ const info = table.get(treePid);
318
+ if (!info || info.cpuMs === null) {
319
+ measurable = false;
320
+ break;
321
+ }
322
+ total += info.cpuMs;
323
+ }
324
+ return { found: true, cpuMs: measurable ? total : null, pids };
325
+ }
326
+ export function sampleProcessTree(pid, table) {
327
+ if (!Number.isFinite(pid) || pid <= 0)
328
+ return { found: false, cpuMs: null, pids: [] };
329
+ const resolved = table === undefined ? readProcessTable() : table;
330
+ if (!resolved)
331
+ return { found: false, cpuMs: null, pids: [pid] };
332
+ return processTreeOf(resolved, pid);
333
+ }
334
+ /**
335
+ * Is this pid running? `null` means THIS PLATFORM CANNOT TELL.
336
+ *
337
+ * The distinction is load-bearing for a run recovered from disk: "not found"
338
+ * must never be read as "finished" on a platform where the process table is not
339
+ * readable, or a restart would declare live work dead (and a dead run's recorded
340
+ * exit code would be reported as its verdict).
341
+ */
342
+ export function processAlive(pid) {
343
+ return tableAlive(readProcessTable(), pid);
344
+ }
345
+ /**
346
+ * `processAlive`, answered from a table the caller ALREADY read — so a tick that
347
+ * samples every monitored run (and reconciles the recovered ones) costs one
348
+ * process listing, not one per run.
349
+ */
350
+ export function tableAlive(table, pid) {
351
+ if (!Number.isFinite(pid) || pid <= 0)
352
+ return false;
353
+ if (!table)
354
+ return null;
355
+ return table.has(pid);
356
+ }
357
+ /**
358
+ * One process's row, cross-platform: `null` when the platform cannot read the
359
+ * table at all, `{ found: false }` when the pid is simply not there.
360
+ *
361
+ * The distinction matters to a caller that has to decide whether a pid is still
362
+ * OURS: "gone" is an answer, "cannot tell" is not.
363
+ */
364
+ export function lookupProcess(pid) {
365
+ if (!Number.isFinite(pid) || pid <= 0)
366
+ return { found: false, command: null, startedAtText: null };
367
+ const table = readProcessTable();
368
+ if (!table)
369
+ return null;
370
+ const row = table.get(pid);
371
+ return row
372
+ ? { found: true, command: row.command, startedAtText: row.startedAtText }
373
+ : { found: false, command: null, startedAtText: null };
374
+ }
375
+ /** `45s` / `3m 05s` — how long, for a human reading a message. */
376
+ export function formatSpan(ms) {
377
+ const totalSeconds = Math.max(0, Math.round(ms / 1000));
378
+ if (totalSeconds < 60)
379
+ return `${totalSeconds}s`;
380
+ const minutes = Math.floor(totalSeconds / 60);
381
+ const seconds = totalSeconds % 60;
382
+ if (minutes < 60)
383
+ return `${minutes}m ${String(seconds).padStart(2, '0')}s`;
384
+ return `${Math.floor(minutes / 60)}h ${String(minutes % 60).padStart(2, '0')}m`;
385
+ }
386
+ /**
387
+ * Classify a run from its evidence. Deterministic and pure, so the decision can
388
+ * be asserted directly instead of inferred from a message.
389
+ *
390
+ * Order matters, and it is deliberately "innocent until proven hung":
391
+ * output recently → working; CPU advancing → working; only then, silence PLUS a
392
+ * measurable absence of CPU → hung. Anything we cannot prove lands in `stalled`,
393
+ * which is reported but never reaped.
394
+ */
395
+ export function classifyLiveness(input, thresholds = DEFAULT_LIVENESS_THRESHOLDS) {
396
+ if (!input.alive)
397
+ return { verdict: 'finished', why: 'the process has exited' };
398
+ // A command seconds old has simply not said anything yet.
399
+ if (input.ageMs < 3_000)
400
+ return { verdict: 'starting', why: 'just started' };
401
+ if (input.quietMs < thresholds.stallQuietMs) {
402
+ return {
403
+ verdict: 'working',
404
+ why: input.bytes > 0 ? `produced output ${formatSpan(input.quietMs)} ago` : 'producing output',
405
+ };
406
+ }
407
+ // "the last 0s" reads as nonsense, so a sub-second sample window is reported
408
+ // as one second — the point is that a MEASURABLE window passed with no CPU.
409
+ const windowLabel = formatSpan(Math.max(1_000, input.sampleWindowMs));
410
+ const measurable = input.cpuMs !== null && input.prevCpuMs !== null;
411
+ const cpuDelta = measurable ? Math.max(0, input.cpuMs - input.prevCpuMs) : null;
412
+ if (cpuDelta !== null && cpuDelta >= thresholds.hangCpuFloorMs) {
413
+ return {
414
+ verdict: 'working',
415
+ why: `silent for ${formatSpan(input.quietMs)} but still computing — ` +
416
+ `${cpuDelta}ms of CPU in the last ${windowLabel}`,
417
+ };
418
+ }
419
+ if (input.quietMs >= thresholds.hangQuietMs) {
420
+ if (cpuDelta !== null) {
421
+ return {
422
+ verdict: 'hung',
423
+ why: `no output for ${formatSpan(input.quietMs)} and no CPU in that time ` +
424
+ `(${cpuDelta}ms over the last ${windowLabel}) — it is waiting for something ` +
425
+ `that is not coming (a prompt with no stdin, a lock, or a socket that never answers)`,
426
+ };
427
+ }
428
+ return {
429
+ verdict: 'stalled',
430
+ why: `no output for ${formatSpan(input.quietMs)}; CPU is not measurable on this platform, so this is ` +
431
+ `reported rather than treated as a confirmed hang`,
432
+ };
433
+ }
434
+ return {
435
+ verdict: 'stalled',
436
+ why: measurable
437
+ ? `quiet for ${formatSpan(input.quietMs)} with only ${cpuDelta}ms of CPU in the last ` +
438
+ `${windowLabel} — slowing rather than stopped`
439
+ : `quiet for ${formatSpan(input.quietMs)}`,
440
+ };
441
+ }
442
+ /**
443
+ * Stop a process TREE, deepest first — the shell we spawned and the real work
444
+ * under it.
445
+ *
446
+ * A plain `child.kill()` reaches only the shell, which is why a "stopped" hung
447
+ * build can keep running: the shell dies, the compiler it launched does not.
448
+ * Best-effort throughout — a pid that exited between the sample and the signal
449
+ * must not throw, and a failed signal falls back to the child handle.
450
+ *
451
+ * On Windows the tree comes from WMI (`Get-CimInstance`), so this genuinely
452
+ * reaches grandchildren there too; if that probe is unavailable the tree is just
453
+ * the root, which is the old behaviour rather than a regression. Note that a
454
+ * Windows "signal" takes effect immediately — there is no graceful SIGTERM to
455
+ * follow with a SIGKILL.
456
+ */
457
+ export function killProcessTree(pid, signal, child, table) {
458
+ const signalled = [];
459
+ // GUARD, and it is not defensive theatre: `process.kill(-1, sig)` signals
460
+ // EVERY process this user can signal — on a developer machine that is a
461
+ // spontaneous logout. Only real, positive pids are ever signalled.
462
+ if (Number.isFinite(pid) && pid > 0) {
463
+ const { pids } = sampleProcessTree(pid, table);
464
+ for (const treePid of [...pids].reverse()) {
465
+ if (!Number.isFinite(treePid) || treePid <= 0)
466
+ continue;
467
+ try {
468
+ process.kill(treePid, signal);
469
+ signalled.push(treePid);
470
+ }
471
+ catch {
472
+ /* already gone — nothing to do */
473
+ }
474
+ }
475
+ }
476
+ if (signalled.length === 0 && child) {
477
+ try {
478
+ child.kill(signal);
479
+ }
480
+ catch {
481
+ /* best-effort */
482
+ }
483
+ }
484
+ return signalled;
485
+ }
486
+ //# sourceMappingURL=process-liveness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-liveness.js","sourceRoot":"","sources":["../../src/tools/process-liveness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAe5D,MAAM,CAAC,MAAM,2BAA2B,GAAuB;IAC7D,YAAY,EAAE,MAAM;IACpB,WAAW,EAAE,OAAO;IACpB,cAAc,EAAE,GAAG;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAyB,OAAO,C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;;iBAejC,CAAC;AAMH;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAO7C;AAED,8BAA8B;AAC9B,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAEtD;AAED,gFAAgF;AAChF,wBAAgB,SAAS,IAAI,IAAI,EAAE,CAElC;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CAOtE;AAID;;;;;GAKG;AACH,eAAO,MAAM,aAAa,u8KAkB8R,CAAC;AAEzT,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,+rLAK2C,CAAC;AAgzB3E;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAyBvE;AASD,OAAO,EACL,aAAa,EACb,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,EAC5B,+BAA+B,EAC/B,sBAAsB,EACtB,mBAAmB,EACnB,yBAAyB,EACzB,eAAe,EACf,YAAY,GACb,MAAM,qBAAqB,CAAC"}
@@ -343,7 +343,9 @@ const writeFileSchema = z.object({
343
343
  const runTerminalSchema = z.object({
344
344
  command: z.string().min(1).describe('The shell command to run in the workspace — e.g. "npx vitest run tests/foo.test.ts", "npx tsc --noEmit", "npm run build", "git diff --stat". Read-only verify commands run directly. Recoverable workspace commands (dependency installs, mkdir/touch/cp/mv, git add, npm init) also run directly when the request authorized the work; every other state-changing command needs confirm:true after the user approves via ask_user. Destructive/system commands are denied outright.'),
345
345
  confirm: z.boolean().default(false).describe('Set true ONLY after the user explicitly confirmed a command you initiated. Required for state-changing commands outside the recoverable workspace set (network fetches, arbitrary code, global installs, anything that leaves the machine).'),
346
- timeout_ms: z.number().int().min(1000).max(300000).optional().describe('Timeout in ms (default 120000).'),
346
+ action: z.enum(['run', 'poll', 'list', 'stop']).optional().describe("Default 'run'. 'poll' reports a long command that outlived its wait budget (pass process_id) — status, liveness (WORKING/STALLED/HUNG, judged from its output and its CPU), output tail, and the real exit code once it lands; 'list' shows every command currently being monitored; 'stop' deliberately stops one monitored run and everything under it. A command that outlives its wait budget is NOT killed, so poll it instead of re-running it — and a run that is genuinely HUNG (no output AND no CPU for minutes) is reported as such and stopped after a further grace, so a hang is never left running forever."),
347
+ process_id: z.string().optional().describe("The monitored run to report on or stop, from a 'still running' result or from action:'list'."),
348
+ timeout_ms: z.number().int().min(1000).max(1800000).optional().describe('How long THIS call waits in ms before handing the command to monitoring (default: assessed from the command — 15 min for a test suite/install, 10 min for a build, 120s otherwise; 60s when a person is watching). Reaching it never kills the command: it keeps running and you follow it with action:\'poll\'.'),
347
349
  verb: z.string().optional().describe('What this command is FOR (e.g. "install java"). When it SUCCEEDS, it is remembered for this verb on this machine, so the next tool_search resolve can offer it instead of re-deriving it. Optional.'),
348
350
  });
349
351
  /** The C2 requirementState check as a reusable tool. */
@@ -834,7 +836,7 @@ registerTool({
834
836
  registerTool({
835
837
  name: 'run_terminal',
836
838
  capability: { effectClass: 'local-state', grantCategory: 'terminal' },
837
- description: 'Run a shell command in the workspace and see its REAL output — typecheck, a single test file, a build, git diff/status. Use to verify code by actual invocation: run, read the failure, edit, re-run. Verify-class commands (tests/typecheck/build/git-readonly) run directly; state-changing commands need confirm:true after the user approves via ask_user. Destructive/system commands (sudo, git push, rm -rf at dangerous targets, ...) are denied outright.',
839
+ description: 'Run a shell command in the workspace and see its REAL output — typecheck, a single test file, a build, git diff/status. Use to verify code by actual invocation: run, read the failure, edit, re-run. Verify-class commands (tests/typecheck/build/git-readonly) run directly; state-changing commands need confirm:true after the user approves via ask_user. Destructive/system commands (sudo, git push, rm -rf at dangerous targets, ...) are denied outright. A long command (a full test suite, a build) is NOT killed when it outlives the call\'s wait budget: it keeps running, and you follow it with action:\'poll\' (process_id) until it reports its real exit code — never re-run it. A monitored run is watched for liveness: one that produces neither output nor CPU for minutes is reported as HUNG and stopped after a further grace (action:\'stop\' stops it now), while a slow-but-working command is left alone.',
838
840
  category: 'workflow',
839
841
  inputSchema: runTerminalSchema,
840
842
  endsAgentStep: false,