agent-yes 1.284.1 → 1.285.0

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 (31) hide show
  1. package/dist/{SUPPORTED_CLIS-DZwCkmvh.js → SUPPORTED_CLIS-CXvLHLG2.js} +3 -3
  2. package/dist/{SUPPORTED_CLIS-B2Jis2RD.js → SUPPORTED_CLIS-tYZC_KWR.js} +2 -2
  3. package/dist/{agentShare-BSh14vJq.js → agentShare-0hRw0bQn.js} +2 -2
  4. package/dist/{callback-nuwvhn5x.js → callback-BN6cqDjb.js} +3 -3
  5. package/dist/{callback-Cyr2rDek.js → callback-DCaGBxD1.js} +2 -2
  6. package/dist/cli.js +5 -5
  7. package/dist/{cmdPs-tzFiiKC5.js → cmdPs-CUkarOK7.js} +123 -18
  8. package/dist/index.js +2 -2
  9. package/dist/{notifyDaemon-BBQKDl7Q.js → notifyDaemon-DNTRkaSU.js} +2 -2
  10. package/dist/{parentPingLoop-CVy-ueZc.js → parentPingLoop-CovRlBFM.js} +2 -2
  11. package/dist/{rustBinary-CRR9Sr3R.js → rustBinary-CkKsMycJ.js} +2 -2
  12. package/dist/{rustBinary-C9B5hRAU.js → rustBinary-ydpdBd3-.js} +2 -2
  13. package/dist/{schedule-CH_evU-N.js → schedule-CgzQNLfP.js} +4 -4
  14. package/dist/{serve-CC074vGJ.js → serve-nk0r7fxV.js} +17 -17
  15. package/dist/{setup-DDZMpGsh.js → setup-P7AMLtbV.js} +2 -2
  16. package/dist/{subcommands-D2iZ_g0A.js → subcommands-B_Lg_zDe.js} +15 -15
  17. package/dist/{subcommands-DafbEv0e.js → subcommands-SeVXiezY.js} +1 -1
  18. package/dist/{terminal-C-UzqGmj.js → terminal-DM_kIymf.js} +2 -2
  19. package/dist/trayApp-BIOUrF8R.js +5 -0
  20. package/dist/{trayApp-Dylg_sbJ.js → trayApp-CUxqXOmu.js} +2 -2
  21. package/dist/{ts-BmiGlG1v.js → ts-LgWg13cL.js} +3 -3
  22. package/dist/{versionChecker-D59qJF9N.js → versionChecker-CbqhEGUc.js} +2 -2
  23. package/dist/{widget-BENlkcvI.js → widget-DUkLAsSR.js} +3 -3
  24. package/dist/{ws-PKok408W.js → ws-BAy7xMDI.js} +2 -2
  25. package/dist/{ws-DvMM1i2j.js → ws-ChkhtUQm.js} +2 -2
  26. package/package.json +1 -1
  27. package/ts/cmdPs.spec.ts +126 -1
  28. package/ts/cmdPs.ts +148 -12
  29. package/ts/procStats.spec.ts +32 -6
  30. package/ts/procStats.ts +77 -5
  31. package/dist/trayApp-D5SzLS6p.js +0 -5
@@ -1,12 +1,12 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-D59qJF9N.js";
3
- import "./ts-BmiGlG1v.js";
2
+ import "./versionChecker-CbqhEGUc.js";
3
+ import "./ts-LgWg13cL.js";
4
4
  import "./todoAutomation-CbVVS4re.js";
5
5
  import "./JsonlStore-BqF7AQ6E.js";
6
6
  import "./globalPidIndex-DoaKEUkO.js";
7
7
  import "./pidStore-B73xnAeT.js";
8
8
  import "./messageLog-DdjBNqgt.js";
9
9
  import "./todoStore-DF6vxHgV.js";
10
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-B2Jis2RD.js";
10
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-tYZC_KWR.js";
11
11
 
12
12
  export { SUPPORTED_CLIS };
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-BmiGlG1v.js";
1
+ import { t as CLIS_CONFIG } from "./ts-LgWg13cL.js";
2
2
 
3
3
  //#region ts/SUPPORTED_CLIS.ts
4
4
  const SUPPORTED_CLIS = Object.keys(CLIS_CONFIG);
5
5
 
6
6
  //#endregion
7
7
  export { SUPPORTED_CLIS as t };
8
- //# sourceMappingURL=SUPPORTED_CLIS-B2Jis2RD.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-tYZC_KWR.js.map
@@ -3,7 +3,7 @@ import "./globalPidIndex-DoaKEUkO.js";
3
3
  import "./messageLog-DdjBNqgt.js";
4
4
  import "./e2e-z1xpwSAg.js";
5
5
  import "./configShared-DKTgiz7K.js";
6
- import { z as resolveOne } from "./subcommands-D2iZ_g0A.js";
6
+ import { z as resolveOne } from "./subcommands-B_Lg_zDe.js";
7
7
  import "./notifyStore-2SWKGwZI.js";
8
8
  import "./webrtcLink-DLaJfTcB.js";
9
9
  import "./remotes-b6reVXzo.js";
@@ -230,4 +230,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
230
230
 
231
231
  //#endregion
232
232
  export { createScopedShare, listShares, revokeAllShares, revokeShare };
233
- //# sourceMappingURL=agentShare-BSh14vJq.js.map
233
+ //# sourceMappingURL=agentShare-0hRw0bQn.js.map
@@ -1,5 +1,5 @@
1
1
  import { t as agentYesHome } from "./agentYesHome-BNtn19J4.js";
2
- import { z as resolveOne } from "./subcommands-D2iZ_g0A.js";
2
+ import { z as resolveOne } from "./subcommands-B_Lg_zDe.js";
3
3
  import { a as mintCapability, o as parseExpires } from "./callbackCore-Bl2gGcxg.js";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { chmodSync, readFileSync, renameSync, writeFileSync } from "node:fs";
@@ -72,7 +72,7 @@ async function resolveBase(flag) {
72
72
  if (flag) return flag;
73
73
  if (process.env.AGENT_YES_CALLBACK_BASE) return process.env.AGENT_YES_CALLBACK_BASE;
74
74
  try {
75
- const { resolveLocalServeUrl } = await import("./serve-CC074vGJ.js");
75
+ const { resolveLocalServeUrl } = await import("./serve-nk0r7fxV.js");
76
76
  const url = await resolveLocalServeUrl();
77
77
  if (url) return url;
78
78
  } catch {}
@@ -187,4 +187,4 @@ async function cmdCallback(rest) {
187
187
 
188
188
  //#endregion
189
189
  export { loadOrCreateCallbackSecret as i, isCallbackRevoked as n, loadCallbackSecretReadOnly as r, cmdCallback as t };
190
- //# sourceMappingURL=callback-nuwvhn5x.js.map
190
+ //# sourceMappingURL=callback-BN6cqDjb.js.map
@@ -3,11 +3,11 @@ import "./globalPidIndex-DoaKEUkO.js";
3
3
  import "./messageLog-DdjBNqgt.js";
4
4
  import "./e2e-z1xpwSAg.js";
5
5
  import "./configShared-DKTgiz7K.js";
6
- import "./subcommands-D2iZ_g0A.js";
6
+ import "./subcommands-B_Lg_zDe.js";
7
7
  import "./notifyStore-2SWKGwZI.js";
8
8
  import "./webrtcLink-DLaJfTcB.js";
9
9
  import "./remotes-b6reVXzo.js";
10
10
  import "./callbackCore-Bl2gGcxg.js";
11
- import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-nuwvhn5x.js";
11
+ import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-BN6cqDjb.js";
12
12
 
13
13
  export { cmdCallback };
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env bun
2
2
  import { t as invokedCliName } from "./invokedCli-zdFbz1ST.js";
3
3
  import { n as logger } from "./logger-CDIsZ-Pp.js";
4
- import { a as versionString, r as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-D59qJF9N.js";
5
- import { l as getRustBinary } from "./rustBinary-C9B5hRAU.js";
4
+ import { a as versionString, r as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-CbqhEGUc.js";
5
+ import { l as getRustBinary } from "./rustBinary-ydpdBd3-.js";
6
6
  import { argv } from "process";
7
7
  import { spawn } from "child_process";
8
8
  import ms from "ms";
@@ -295,7 +295,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
295
295
  const rawArg = process.argv[2];
296
296
  const managerCommands = !invokedCliName(process.argv);
297
297
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
298
- const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-DafbEv0e.js");
298
+ const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-SeVXiezY.js");
299
299
  if (isHelpFlag && process.argv.length === 3) {
300
300
  await cmdHelp(managerCommands);
301
301
  process.exit(0);
@@ -309,7 +309,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
309
309
  process.exit(code ?? 0);
310
310
  }
311
311
  {
312
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DZwCkmvh.js");
312
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-CXvLHLG2.js");
313
313
  if (isUnknownManagerToken(rawArg, managerCommands, SUPPORTED_CLIS)) {
314
314
  process.stderr.write(`ay: unknown subcommand or CLI '${rawArg}'.\n See 'ay help' for subcommands. To run an agent, name a CLI:\n 'ay <cli> …' (e.g. 'ay claude …') or 'ay --cli <cli> …'.\n`);
315
315
  process.exit(1);
@@ -360,7 +360,7 @@ if (config.useRust) {
360
360
  }
361
361
  }
362
362
  if (rustBinary) {
363
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DZwCkmvh.js");
363
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-CXvLHLG2.js");
364
364
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
365
365
  if (config.verbose) {
366
366
  console.log(`[rust] Using binary: ${rustBinary}`);
@@ -3,7 +3,7 @@ import "./globalPidIndex-DoaKEUkO.js";
3
3
  import "./messageLog-DdjBNqgt.js";
4
4
  import "./e2e-z1xpwSAg.js";
5
5
  import "./configShared-DKTgiz7K.js";
6
- import { $ as buildAgentForest, D as listRecords, et as flattenForest, u as deriveLiveState } from "./subcommands-D2iZ_g0A.js";
6
+ import { $ as buildAgentForest, D as listRecords, et as flattenForest, u as deriveLiveState } from "./subcommands-B_Lg_zDe.js";
7
7
  import "./notifyStore-2SWKGwZI.js";
8
8
  import "./webrtcLink-DLaJfTcB.js";
9
9
  import "./remotes-b6reVXzo.js";
@@ -94,6 +94,8 @@ async function pageSize(deps) {
94
94
  function parseProcStat(pid, stat, pageSizeBytes = DEFAULT_PAGE_SIZE) {
95
95
  const close = stat.lastIndexOf(")");
96
96
  if (close < 0) return null;
97
+ const open = stat.indexOf("(");
98
+ const comm = open >= 0 && open < close ? stat.slice(open + 1, close) : "";
97
99
  const f = stat.slice(close + 1).trim().split(/\s+/);
98
100
  const state = f[0];
99
101
  const ppid = Number(f[1]);
@@ -104,6 +106,7 @@ function parseProcStat(pid, stat, pageSizeBytes = DEFAULT_PAGE_SIZE) {
104
106
  return {
105
107
  pid,
106
108
  ppid,
109
+ comm,
107
110
  rss: Number.isFinite(rssPages) ? rssPages * pageSizeBytes : 0,
108
111
  cpuSeconds: (utime + stime) / USER_HZ,
109
112
  state,
@@ -136,7 +139,7 @@ async function defaultReadSys(name) {
136
139
  }
137
140
  async function defaultReadPsTable() {
138
141
  try {
139
- const { stdout } = await execFileAsync("ps", ["-eo", "pid=,ppid=,rss=,time=,state="], {
142
+ const { stdout } = await execFileAsync("ps", ["-eo", "pid=,ppid=,rss=,time=,state=,comm="], {
140
143
  encoding: "utf8",
141
144
  timeout: 3e3,
142
145
  maxBuffer: 16 * 1024 * 1024
@@ -159,13 +162,20 @@ function parsePsTime(raw) {
159
162
  }
160
163
  return seconds;
161
164
  }
162
- /** Parse the `ps -eo pid=,ppid=,rss=,time=,state=` fallback table. */
165
+ /**
166
+ * Parse the `ps -eo pid=,ppid=,rss=,time=,state=,comm=` fallback table.
167
+ *
168
+ * comm is requested LAST on purpose: it can contain spaces (`Google Chrome
169
+ * Helper`), so anywhere else it would shift every column after it. Being last,
170
+ * everything from field 6 on is simply rejoined.
171
+ */
163
172
  function parsePsTable(out) {
164
173
  const procs = /* @__PURE__ */ new Map();
165
174
  for (const line of out.split("\n")) {
166
175
  const m = line.trim().split(/\s+/);
167
176
  if (m.length < 5) continue;
168
177
  const [pidS, ppidS, rssS, timeS, state] = m;
178
+ const comm = m.slice(5).join(" ");
169
179
  const pid = Number(pidS);
170
180
  const ppid = Number(ppidS);
171
181
  const rssKib = Number(rssS);
@@ -173,6 +183,7 @@ function parsePsTable(out) {
173
183
  procs.set(pid, {
174
184
  pid,
175
185
  ppid,
186
+ comm,
176
187
  rss: Number.isFinite(rssKib) ? rssKib * 1024 : 0,
177
188
  cpuSeconds: parsePsTime(timeS ?? ""),
178
189
  state: state ?? "?",
@@ -225,6 +236,30 @@ function descendantsOf(root, kids, seen = /* @__PURE__ */ new Set()) {
225
236
  }
226
237
  return out;
227
238
  }
239
+ /**
240
+ * Per-process detail for one claimed member set, same window and pid-reuse
241
+ * rules as `rollup` (see there for why a newcomer or a reused pid contributes
242
+ * no CPU delta).
243
+ */
244
+ function memberRows(members, first, second, elapsedSeconds) {
245
+ const out = [];
246
+ for (const pid of members) {
247
+ const now = second.get(pid);
248
+ if (!now) continue;
249
+ const before = first.get(pid);
250
+ const reused = before !== void 0 && before.startToken !== "" && now.startToken !== "" && before.startToken !== now.startToken;
251
+ const delta = before && !reused ? Math.max(0, now.cpuSeconds - before.cpuSeconds) : 0;
252
+ out.push({
253
+ pid,
254
+ ppid: now.ppid,
255
+ comm: (now.comm || "").split(/[\\/]+/).filter(Boolean).pop() ?? "",
256
+ rss: now.rss,
257
+ cpuPercent: elapsedSeconds > 0 ? delta / elapsedSeconds * 100 : 0,
258
+ state: now.state
259
+ });
260
+ }
261
+ return out;
262
+ }
228
263
  function rollup(root, members, first, second, elapsedSeconds) {
229
264
  let rss = 0;
230
265
  let cpuDelta = 0;
@@ -269,16 +304,19 @@ async function sampleTrees(roots, opts = {}) {
269
304
  const kids = buildChildIndex(second);
270
305
  const claimed = /* @__PURE__ */ new Set();
271
306
  const trees = /* @__PURE__ */ new Map();
307
+ const memberRowsByRoot = /* @__PURE__ */ new Map();
272
308
  for (const root of roots) {
273
309
  const members = descendantsOf(root, kids, claimed);
274
310
  for (const pid of members) claimed.add(pid);
275
311
  trees.set(root, rollup(root, members, first, second, elapsedSeconds));
312
+ memberRowsByRoot.set(root, memberRows(members, first, second, elapsedSeconds));
276
313
  }
277
314
  const rest = /* @__PURE__ */ new Set();
278
315
  for (const pid of second.keys()) if (!claimed.has(pid)) rest.add(pid);
279
316
  return {
280
317
  trees,
281
- unattributed: rollup(0, rest, first, second, elapsedSeconds)
318
+ unattributed: rollup(0, rest, first, second, elapsedSeconds),
319
+ members: memberRowsByRoot
282
320
  };
283
321
  }
284
322
  /** Parse /proc/meminfo (`MemTotal: 16316360 kB`) into a kB-valued map. */
@@ -383,21 +421,63 @@ function formatSystemLine(sys) {
383
421
  if (sys.zombies > 0) bits.push(`zombies ${sys.zombies}`);
384
422
  return bits.join(" ");
385
423
  }
424
+ /**
425
+ * Roll each row up with its descendants, using the forest `depth` column: a
426
+ * row's descendants are the following rows with a strictly greater depth, up to
427
+ * the next row at or above its own level.
428
+ *
429
+ * Needed because sampleTrees attributes DEEPEST-FIRST and exclusively — a
430
+ * parent's own numbers deliberately omit its subagents, so without this a
431
+ * fan-out parent looks cheap while its real cost sits in rows below it.
432
+ *
433
+ * Returns null for a row with no descendants.
434
+ */
435
+ function subtreeTotals(rows) {
436
+ return rows.map((r, i) => {
437
+ const depth = r.depth ?? 0;
438
+ const own = r.stats;
439
+ if (!own) return null;
440
+ let rss = own.rss;
441
+ let cpuPercent = own.cpuPercent;
442
+ let procs = own.procs;
443
+ let found = false;
444
+ for (let j = i + 1; j < rows.length; j++) {
445
+ if ((rows[j]?.depth ?? 0) <= depth) break;
446
+ const st = rows[j]?.stats;
447
+ if (!st) continue;
448
+ found = true;
449
+ rss += st.rss;
450
+ cpuPercent += st.cpuPercent;
451
+ procs += st.procs;
452
+ }
453
+ return found ? {
454
+ pid: own.pid,
455
+ rss,
456
+ cpuPercent,
457
+ procs
458
+ } : null;
459
+ });
460
+ }
386
461
  function pad(s, n) {
387
462
  return s.length >= n ? s : s + " ".repeat(n - s.length);
388
463
  }
389
464
  function padStart(s, n) {
390
465
  return s.length >= n ? s : " ".repeat(n - s.length) + s;
391
466
  }
392
- function renderTable(rows, unattributed) {
467
+ function renderTable(rows, unattributed, opts = {}) {
468
+ const tree = opts.tree === true;
393
469
  const cells = rows.map((r) => ({
394
- pid: String(r.pid),
470
+ pid: (tree ? r.prefix ?? "" : "") + String(r.pid),
395
471
  cli: r.cli,
396
472
  status: r.status,
397
473
  cpu: r.stats.cpuPercent.toFixed(1),
398
474
  rss: humanBytes(r.stats.rss),
399
475
  procs: String(r.stats.procs),
400
476
  repo: r.repo,
477
+ cwd: shortenPath(r.cwd),
478
+ scpu: r.subtree ? r.subtree.cpuPercent.toFixed(1) : "",
479
+ srss: r.subtree ? humanBytes(r.subtree.rss) : "",
480
+ sprocs: r.subtree ? String(r.subtree.procs) : "",
401
481
  self: r.self
402
482
  }));
403
483
  if (unattributed && unattributed.procs > 0) cells.push({
@@ -408,6 +488,10 @@ function renderTable(rows, unattributed) {
408
488
  rss: humanBytes(unattributed.rss),
409
489
  procs: String(unattributed.procs),
410
490
  repo: "-",
491
+ cwd: "-",
492
+ scpu: "",
493
+ srss: "",
494
+ sprocs: "",
411
495
  self: false
412
496
  });
413
497
  const w = {
@@ -417,11 +501,22 @@ function renderTable(rows, unattributed) {
417
501
  cpu: Math.max(5, ...cells.map((c) => c.cpu.length)),
418
502
  rss: Math.max(5, ...cells.map((c) => c.rss.length)),
419
503
  procs: Math.max(5, ...cells.map((c) => c.procs.length)),
420
- repo: Math.max(4, ...cells.map((c) => c.repo.length))
504
+ repo: Math.max(4, ...cells.map((c) => c.repo.length)),
505
+ scpu: Math.max(5, ...cells.map((c) => c.scpu.length)),
506
+ srss: Math.max(5, ...cells.map((c) => c.srss.length)),
507
+ sprocs: Math.max(6, ...cells.map((c) => c.sprocs.length))
421
508
  };
422
- const line = (pid, cli, status, cpu, rss, procs, repo, tail = "") => `${pad(pid, w.pid)} ${pad(cli, w.cli)} ${pad(status, w.status)} ${padStart(cpu, w.cpu)} ${padStart(rss, w.rss)} ${padStart(procs, w.procs)} ${pad(repo, w.repo)}${tail}`;
423
- const out = [line("PID", "CLI", "STATUS", "CPU%", "RSS", "PROCS", "REPO")];
424
- for (const c of cells) out.push(line(c.pid, c.cli, c.status, c.cpu, c.rss, c.procs, c.repo, c.self ? " ← this session" : ""));
509
+ const line = (pid, cli, status, cpu, rss, procs, repo, cwd, scpu = "", srss = "", sprocs = "", tail = "") => `${pad(pid, w.pid)} ${pad(cli, w.cli)} ${pad(status, w.status)} ${padStart(cpu, w.cpu)} ${padStart(rss, w.rss)} ${padStart(procs, w.procs)} ` + (tree ? `${padStart(scpu, w.scpu)} ${padStart(srss, w.srss)} ${padStart(sprocs, w.sprocs)} ` : "") + `${pad(repo, w.repo)} ${cwd}${tail}`;
510
+ const out = [line("PID", "CLI", "STATUS", "CPU%", "RSS", "PROCS", "REPO", "CWD", "ΣCPU%", "ΣRSS", "ΣPROCS")];
511
+ cells.forEach((c, i) => {
512
+ out.push(line(c.pid, c.cli, c.status, c.cpu, c.rss, c.procs, c.repo, c.cwd, c.scpu, c.srss, c.sprocs, c.self ? " ← this session" : ""));
513
+ const kids = rows[i]?.procRows;
514
+ if (!tree || !kids?.length) return;
515
+ const indent = " ".repeat((rows[i]?.prefix ?? "").length + 2);
516
+ const pw = Math.max(...kids.map((k) => String(k.pid).length));
517
+ const cw = Math.max(...kids.map((k) => k.comm.length));
518
+ for (const k of kids) out.push(`${indent}· ${padStart(String(k.pid), pw)} ${pad(k.comm, cw)} ${padStart(k.cpuPercent.toFixed(1), 5)} ${padStart(humanBytes(k.rss), 7)}` + (k.state === "Z" ? " zombie" : ""));
519
+ });
425
520
  return out.join("\n");
426
521
  }
427
522
  async function cmdPs(rest) {
@@ -446,7 +541,7 @@ async function cmdPs(rest) {
446
541
  }).option("tree", {
447
542
  type: "boolean",
448
543
  default: false,
449
- description: "Keep ay ls's parent>child forest order instead of sorting"
544
+ description: "Forest order with ├─ rails, plus Σ columns rolling each agent up with its subagents"
450
545
  }).option("interval", {
451
546
  type: "number",
452
547
  default: DEFAULT_WINDOW_MS / 1e3,
@@ -459,7 +554,7 @@ async function cmdPs(rest) {
459
554
  type: "boolean",
460
555
  default: false,
461
556
  description: "Show this help"
462
- }).example("ay ps", "biggest agents first, with box vitals").example("ay ps --sort cpu", "who is actually burning CPU right now").example("ay ps --json", "machine-readable rollup").help(false).version(false).exitProcess(false);
557
+ }).example("ay ps", "biggest agents first, with box vitals").example("ay ps --sort cpu", "who is actually burning CPU right now").example("ay ps --tree", "parent>child forest; Σ columns include each agent's subagents").example("ay ps --json", "machine-readable rollup").help(false).version(false).exitProcess(false);
463
558
  const argv = await y.parseAsync();
464
559
  if (argv.help || argv.h) {
465
560
  process.stdout.write(await y.getHelp() + "\n");
@@ -477,12 +572,13 @@ async function cmdPs(rest) {
477
572
  process.stderr.write(keyword ? `no agents matched "${keyword}"\n` : "no running agents\n");
478
573
  return 0;
479
574
  }
480
- const ordered = flattenForest(buildAgentForest(records)).map((r) => r.record);
575
+ const flat = flattenForest(buildAgentForest(records));
576
+ const ordered = flat.map((r) => r.record);
481
577
  const windowMs = Math.max(100, (Number.isFinite(argv.interval) ? argv.interval : 1) * 1e3);
482
- const { trees, unattributed } = await sampleTrees([...ordered].reverse().map((r) => r.pid), { windowMs });
578
+ const { trees, unattributed, members } = await sampleTrees([...ordered].reverse().map((r) => r.pid), { windowMs });
483
579
  const states = new Map(await Promise.all(ordered.map(async (r) => [r.pid, (await deriveLiveState(r)).state])));
484
580
  const selfPid = process.pid;
485
- const rows = ordered.map((r) => ({
581
+ const rows = ordered.map((r, i) => ({
486
582
  pid: r.pid,
487
583
  cli: r.cli,
488
584
  status: states.get(r.pid) ?? r.status,
@@ -494,8 +590,17 @@ async function cmdPs(rest) {
494
590
  cpuPercent: 0,
495
591
  procs: 0
496
592
  },
497
- self: trees.get(r.pid) !== void 0 && isSelfTree(r.pid, selfPid)
593
+ self: trees.get(r.pid) !== void 0 && isSelfTree(r.pid, selfPid),
594
+ prefix: flat[i]?.prefix ?? "",
595
+ depth: flat[i]?.depth ?? 0
498
596
  }));
597
+ if (argv.tree) {
598
+ const totals = subtreeTotals(rows);
599
+ rows.forEach((r, i) => {
600
+ r.subtree = totals[i] ?? null;
601
+ r.procRows = [...members?.get(r.pid) ?? []].sort((x, y) => y.rss - x.rss);
602
+ });
603
+ }
499
604
  if (!argv.tree) {
500
605
  const key = String(argv.sort);
501
606
  rows.sort((a, b) => {
@@ -529,7 +634,7 @@ async function cmdPs(rest) {
529
634
  }
530
635
  const header = formatSystemLine(sys);
531
636
  if (header) process.stdout.write(` ${header}\n\n`);
532
- process.stdout.write(renderTable(rows, unattributed) + "\n");
637
+ process.stdout.write(renderTable(rows, unattributed, { tree: argv.tree === true }) + "\n");
533
638
  return 0;
534
639
  }
535
640
  /**
@@ -574,4 +679,4 @@ function readPpidSync(pid) {
574
679
 
575
680
  //#endregion
576
681
  export { cmdPs };
577
- //# sourceMappingURL=cmdPs-tzFiiKC5.js.map
682
+ //# sourceMappingURL=cmdPs-CUkarOK7.js.map
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-D59qJF9N.js";
3
- import { a as hasTodoStore, i as answerAsk, l as AgentContext, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-BmiGlG1v.js";
2
+ import "./versionChecker-CbqhEGUc.js";
3
+ import { a as hasTodoStore, i as answerAsk, l as AgentContext, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-LgWg13cL.js";
4
4
  import { a as renderTree, c as describeBlock, i as renderDigest, l as monitorHint, o as unblockedTasks, r as openBlockers, t as reconcileTodos, u as removeControlCharacters } from "./todoAutomation-CbVVS4re.js";
5
5
  import "./JsonlStore-BqF7AQ6E.js";
6
6
  import "./globalPidIndex-DoaKEUkO.js";
@@ -3,7 +3,7 @@ import "./globalPidIndex-DoaKEUkO.js";
3
3
  import "./messageLog-DdjBNqgt.js";
4
4
  import "./e2e-z1xpwSAg.js";
5
5
  import "./configShared-DKTgiz7K.js";
6
- import { D as listRecords, I as renderLogTailLines, b as isPidAlive, u as deriveLiveState } from "./subcommands-D2iZ_g0A.js";
6
+ import { D as listRecords, I as renderLogTailLines, b as isPidAlive, u as deriveLiveState } from "./subcommands-B_Lg_zDe.js";
7
7
  import { f as readInbox, g as daemonLockOwnerPath, h as daemonLockDir, i as gcInboxes, l as listInboxParents, m as shouldStealLock, n as appendEvent, s as hostId, u as liveWatchers, x as notifyDir } from "./notifyStore-2SWKGwZI.js";
8
8
  import "./webrtcLink-DLaJfTcB.js";
9
9
  import "./remotes-b6reVXzo.js";
@@ -863,4 +863,4 @@ async function ensureDaemon() {
863
863
 
864
864
  //#endregion
865
865
  export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
866
- //# sourceMappingURL=notifyDaemon-BBQKDl7Q.js.map
866
+ //# sourceMappingURL=notifyDaemon-DNTRkaSU.js.map
@@ -338,7 +338,7 @@ async function isParentWatching(parentWrapperPid, parentAgentPid, selfAgentPid,
338
338
  logger.debug("[parent-ping] watcher lookup failed:", error);
339
339
  }
340
340
  try {
341
- const { lastReadAt, READ_WINDOW_MS } = await import("./subcommands-DafbEv0e.js");
341
+ const { lastReadAt, READ_WINDOW_MS } = await import("./subcommands-SeVXiezY.js");
342
342
  const last = await lastReadAt(`agent:${parentAgentPid}`, selfAgentPid);
343
343
  if (last !== null && now - last <= READ_WINDOW_MS) return true;
344
344
  } catch (error) {
@@ -466,4 +466,4 @@ function startParentPingLoop(opts) {
466
466
 
467
467
  //#endregion
468
468
  export { startParentPingLoop };
469
- //# sourceMappingURL=parentPingLoop-CVy-ueZc.js.map
469
+ //# sourceMappingURL=parentPingLoop-CovRlBFM.js.map
@@ -1,4 +1,4 @@
1
- import "./versionChecker-D59qJF9N.js";
2
- import { a as gcOldBinaryDirs, c as getDownloadUrl, i as findTrayLauncher, l as getRustBinary, n as findRustBinary, o as getBinDir, r as findSpawnHiddenLauncher, s as getBinaryName, t as downloadBinary } from "./rustBinary-C9B5hRAU.js";
1
+ import "./versionChecker-CbqhEGUc.js";
2
+ import { a as gcOldBinaryDirs, c as getDownloadUrl, i as findTrayLauncher, l as getRustBinary, n as findRustBinary, o as getBinDir, r as findSpawnHiddenLauncher, s as getBinaryName, t as downloadBinary } from "./rustBinary-ydpdBd3-.js";
3
3
 
4
4
  export { gcOldBinaryDirs };
@@ -1,4 +1,4 @@
1
- import { i as getInstalledPackage, n as compareVersions } from "./versionChecker-D59qJF9N.js";
1
+ import { i as getInstalledPackage, n as compareVersions } from "./versionChecker-CbqhEGUc.js";
2
2
  import { execFileSync } from "child_process";
3
3
  import { existsSync, mkdirSync, readdirSync, rmSync, statSync, unlinkSync } from "fs";
4
4
  import { chmod, copyFile } from "fs/promises";
@@ -310,4 +310,4 @@ async function getRustBinary(options = {}) {
310
310
 
311
311
  //#endregion
312
312
  export { gcOldBinaryDirs as a, getDownloadUrl as c, findTrayLauncher as i, getRustBinary as l, findRustBinary as n, getBinDir as o, findSpawnHiddenLauncher as r, getBinaryName as s, downloadBinary as t };
313
- //# sourceMappingURL=rustBinary-C9B5hRAU.js.map
313
+ //# sourceMappingURL=rustBinary-ydpdBd3-.js.map
@@ -1,13 +1,13 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-D59qJF9N.js";
3
- import "./ts-BmiGlG1v.js";
2
+ import "./versionChecker-CbqhEGUc.js";
3
+ import "./ts-LgWg13cL.js";
4
4
  import "./todoAutomation-CbVVS4re.js";
5
5
  import "./JsonlStore-BqF7AQ6E.js";
6
6
  import "./globalPidIndex-DoaKEUkO.js";
7
7
  import "./pidStore-B73xnAeT.js";
8
8
  import "./messageLog-DdjBNqgt.js";
9
9
  import "./todoStore-DF6vxHgV.js";
10
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-B2Jis2RD.js";
10
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-tYZC_KWR.js";
11
11
  import { f as resolveSpawnCwd } from "./workspaceConfig-D6QndOCz.js";
12
12
  import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-_zeWDISM.js";
13
13
  import { createHash } from "node:crypto";
@@ -154,4 +154,4 @@ async function cmdSchedule(rest) {
154
154
 
155
155
  //#endregion
156
156
  export { cmdSchedule };
157
- //# sourceMappingURL=schedule-CH_evU-N.js.map
157
+ //# sourceMappingURL=schedule-CgzQNLfP.js.map
@@ -1,7 +1,7 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import { i as getInstalledPackage } from "./versionChecker-D59qJF9N.js";
3
- import { r as findSpawnHiddenLauncher } from "./rustBinary-C9B5hRAU.js";
4
- import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-BmiGlG1v.js";
2
+ import { i as getInstalledPackage } from "./versionChecker-CbqhEGUc.js";
3
+ import { r as findSpawnHiddenLauncher } from "./rustBinary-ydpdBd3-.js";
4
+ import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-LgWg13cL.js";
5
5
  import { t as agentYesHome$1 } from "./agentYesHome-BNtn19J4.js";
6
6
  import { u as removeControlCharacters } from "./todoAutomation-CbVVS4re.js";
7
7
  import "./JsonlStore-BqF7AQ6E.js";
@@ -12,18 +12,18 @@ import { t as pgidForWrapper } from "./reaper-UimuuTfO.js";
12
12
  import "./todoStore-DF6vxHgV.js";
13
13
  import "./e2e-z1xpwSAg.js";
14
14
  import "./configShared-DKTgiz7K.js";
15
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-B2Jis2RD.js";
16
- import { D as listRecords, F as recentReadEdges, I as renderLogTailLines, L as renderRawLog, M as readNotes, N as readPtysize, P as recentMessageEdges, Q as TYPING_BADGE, R as renderRawLogLines, W as snapshotStatus, X as writeToIpc, Z as withIpcLock, c as controlCodeFromName, d as deriveLiveStatus, f as extractBadges, h as extractTaskCounts, j as readLogForRender, m as extractNeedsInput, w as isUserTyping, z as resolveOne } from "./subcommands-D2iZ_g0A.js";
15
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-tYZC_KWR.js";
16
+ import { D as listRecords, F as recentReadEdges, I as renderLogTailLines, L as renderRawLog, M as readNotes, N as readPtysize, P as recentMessageEdges, Q as TYPING_BADGE, R as renderRawLogLines, W as snapshotStatus, X as writeToIpc, Z as withIpcLock, c as controlCodeFromName, d as deriveLiveStatus, f as extractBadges, h as extractTaskCounts, j as readLogForRender, m as extractNeedsInput, w as isUserTyping, z as resolveOne } from "./subcommands-B_Lg_zDe.js";
17
17
  import { c as isTransientLockMkdirError } from "./notifyStore-2SWKGwZI.js";
18
18
  import "./webrtcLink-DLaJfTcB.js";
19
19
  import "./remotes-b6reVXzo.js";
20
20
  import { i as frameVisitorMessage, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-Bl2gGcxg.js";
21
- import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-nuwvhn5x.js";
21
+ import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-BN6cqDjb.js";
22
22
  import { a as getProvisionRoot, d as isProvisionAllowed, f as resolveSpawnCwd, i as getProvisionHook, l as hasProvisionHook, o as getSpawnHook, t as allowsSkipPermissions, u as hasSpawnHook } from "./workspaceConfig-D6QndOCz.js";
23
23
  import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-_zeWDISM.js";
24
- import { i as importProvisionModule } from "./ws-PKok408W.js";
24
+ import { i as importProvisionModule } from "./ws-BAy7xMDI.js";
25
25
  import { r as spawnRejectionReason } from "./spawnGate-B2hA_2NQ.js";
26
- import { i as launchTray } from "./trayApp-Dylg_sbJ.js";
26
+ import { i as launchTray } from "./trayApp-CUxqXOmu.js";
27
27
  import yargs from "yargs";
28
28
  import { appendFile, mkdir, open, readFile, readdir, rename, rm, stat, unlink, writeFile } from "fs/promises";
29
29
  import { arch, cpus, freemem, homedir, hostname, loadavg, platform, totalmem, uptime, userInfo } from "os";
@@ -2436,7 +2436,7 @@ Options:
2436
2436
  }
2437
2437
  });
2438
2438
  if (req.method === "GET" && p === "/api/ws") {
2439
- const ws = await import("./ws-DvMM1i2j.js");
2439
+ const ws = await import("./ws-ChkhtUQm.js");
2440
2440
  try {
2441
2441
  await ws.loadProvision();
2442
2442
  } catch (e) {
@@ -2456,7 +2456,7 @@ Options:
2456
2456
  if (req.method === "GET" && p === "/api/ws/status") {
2457
2457
  const dirRaw = url.searchParams.get("path");
2458
2458
  if (!dirRaw) return new Response("missing ?path=<workspace dir>", { status: 400 });
2459
- const ws = await import("./ws-DvMM1i2j.js");
2459
+ const ws = await import("./ws-ChkhtUQm.js");
2460
2460
  let prov;
2461
2461
  try {
2462
2462
  prov = await ws.loadProvision();
@@ -2478,7 +2478,7 @@ Options:
2478
2478
  }
2479
2479
  }
2480
2480
  if (req.method === "GET" && p === "/api/ws/repos") {
2481
- const ws = await import("./ws-DvMM1i2j.js");
2481
+ const ws = await import("./ws-ChkhtUQm.js");
2482
2482
  try {
2483
2483
  await ws.loadProvision();
2484
2484
  } catch (e) {
@@ -2559,7 +2559,7 @@ Options:
2559
2559
  const m = /^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)$/.exec(repoParam);
2560
2560
  if (!m || m[1] === "." || m[1] === ".." || m[2] === "." || m[2] === "..") return new Response("missing/invalid ?repo=<owner>/<repo>", { status: 400 });
2561
2561
  const [, owner, repo] = m;
2562
- const ws = await import("./ws-DvMM1i2j.js");
2562
+ const ws = await import("./ws-ChkhtUQm.js");
2563
2563
  let prov;
2564
2564
  try {
2565
2565
  prov = await ws.loadProvision();
@@ -3470,7 +3470,7 @@ Options:
3470
3470
  const perm = body.perm ?? "r";
3471
3471
  if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
3472
3472
  try {
3473
- const { createScopedShare } = await import("./agentShare-BSh14vJq.js");
3473
+ const { createScopedShare } = await import("./agentShare-0hRw0bQn.js");
3474
3474
  const share = await createScopedShare({
3475
3475
  agent: body.agent,
3476
3476
  perm,
@@ -3485,12 +3485,12 @@ Options:
3485
3485
  }
3486
3486
  }
3487
3487
  if (req.method === "GET" && p === "/api/shares") {
3488
- const { listShares } = await import("./agentShare-BSh14vJq.js");
3488
+ const { listShares } = await import("./agentShare-0hRw0bQn.js");
3489
3489
  return Response.json(listShares());
3490
3490
  }
3491
3491
  const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
3492
3492
  if (req.method === "DELETE" && revokeM) {
3493
- const { revokeShare } = await import("./agentShare-BSh14vJq.js");
3493
+ const { revokeShare } = await import("./agentShare-0hRw0bQn.js");
3494
3494
  const ok = revokeShare(decodeURIComponent(revokeM[1]));
3495
3495
  return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
3496
3496
  }
@@ -3795,7 +3795,7 @@ Options:
3795
3795
  const shutdown = (resolve) => {
3796
3796
  if (heartbeat) clearInterval(heartbeat);
3797
3797
  closeShare?.();
3798
- import("./agentShare-BSh14vJq.js").then((m) => m.revokeAllShares()).catch(() => {});
3798
+ import("./agentShare-0hRw0bQn.js").then((m) => m.revokeAllShares()).catch(() => {});
3799
3799
  server?.stop();
3800
3800
  Promise.resolve(releaseHostLock?.()).catch(() => {}).then(resolve);
3801
3801
  };
@@ -3808,4 +3808,4 @@ Options:
3808
3808
 
3809
3809
  //#endregion
3810
3810
  export { cmdServe, loadTokenReadOnly, mintScopedTermToken, resolveDaemonHttpBase, resolveLocalServeUrl };
3811
- //# sourceMappingURL=serve-CC074vGJ.js.map
3811
+ //# sourceMappingURL=serve-nk0r7fxV.js.map
@@ -40,7 +40,7 @@ async function cmdSetup(rest) {
40
40
  } catch {}
41
41
  if (noShare) return 0;
42
42
  process.stdout.write(`\nsharing this machine to agent-yes.com…\n`);
43
- const { cmdServe } = await import("./serve-CC074vGJ.js");
43
+ const { cmdServe } = await import("./serve-nk0r7fxV.js");
44
44
  return cmdServe([
45
45
  "install",
46
46
  "--share",
@@ -50,4 +50,4 @@ async function cmdSetup(rest) {
50
50
 
51
51
  //#endregion
52
52
  export { cmdSetup };
53
- //# sourceMappingURL=setup-DDZMpGsh.js.map
53
+ //# sourceMappingURL=setup-P7AMLtbV.js.map