agent-yes 1.290.7 → 1.291.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 (82) hide show
  1. package/dist/SUPPORTED_CLIS-BZP767UR.js +12 -0
  2. package/dist/{SUPPORTED_CLIS-hTRegnm5.js → SUPPORTED_CLIS-TiOdGi1h.js} +2 -2
  3. package/dist/{agentShare-C_LTEKEb.js → agentShare-D4N8StHO.js} +8 -8
  4. package/dist/{askCli-DR9vhdcV.js → askCli-DFsWcgpF.js} +3 -3
  5. package/dist/{browser-oqC3Ln2a.js → browser-wkzxw6lx.js} +3 -2
  6. package/dist/{callback-DAQ8wCtJ.js → callback-Bc2gnr_f.js} +3 -3
  7. package/dist/{callback-BEvLUUBR.js → callback-yCpK6Qpg.js} +7 -7
  8. package/dist/{channels-hOG3-R_3.js → channels-aYwLMbFV.js} +2 -2
  9. package/dist/cli.js +9 -9
  10. package/dist/{cmdPs-BAaLB4Pz.js → cmdPs-D5L3Eyh5.js} +7 -7
  11. package/dist/{cwdConflictWarn-BgXN56Jc.js → cwdConflictWarn-sQUONAye.js} +2 -2
  12. package/dist/{forkNested-CJ7lQQCe.js → forkNested-xtEeYpBQ.js} +3 -3
  13. package/dist/{globalPidIndex-DoaKEUkO.js → globalPidIndex-CRH9L9tn.js} +139 -12
  14. package/dist/globalPidIndex-DC93JhHQ.js +4 -0
  15. package/dist/index.js +5 -5
  16. package/dist/{messageLog-CVRSTLza.js → messageLog-Brx3w6zT.js} +2 -1
  17. package/dist/{notifyDaemon-Dnbe66Fl.js → notifyDaemon-CvUtRnAB.js} +7 -7
  18. package/dist/{parentLink-fdiuB13i.js → parentLink-BILJ32nA.js} +2 -2
  19. package/dist/{parentLink-bpDGuQi6.js → parentLink-CfbxykCv.js} +2 -2
  20. package/dist/{parentPingLoop-DWv-xJoi.js → parentPingLoop-CVOCiQp2.js} +4 -4
  21. package/dist/pidStore-Bpe8i_oU.js +6 -0
  22. package/dist/{pidStore-B73xnAeT.js → pidStore-DXWqzTSz.js} +2 -2
  23. package/dist/{remotes-DTXPW8U1.js → remotes-tmKwrr20.js} +3 -3
  24. package/dist/{remotes-C696AJzL.js → remotes-wPL0JtBs.js} +2 -2
  25. package/dist/{rustBinary-CZRPfa4y.js → rustBinary-C_EbyMTk.js} +2 -2
  26. package/dist/{rustBinary-jO6EN8LR.js → rustBinary-Clbk_K5c.js} +2 -2
  27. package/dist/{schedule-Hao0WqyJ.js → schedule-Ba_4wNVK.js} +7 -7
  28. package/dist/{serve-B2nisui8.js → serve-CJDQq_Jp.js} +46 -40
  29. package/dist/{setup-vCDTqyqR.js → setup-DwLAkbTC.js} +2 -2
  30. package/dist/share-Bmnd_qT0.js +4 -0
  31. package/dist/{share-DTlaFn6s.js → share-C9oGvjXT.js} +13 -4
  32. package/dist/spawnGate-BUEswFgo.js +5 -0
  33. package/dist/{spawnGate-B26UnzqP.js → spawnGate-YpHopveO.js} +2 -2
  34. package/dist/{subcommands-BpFdlCY0.js → subcommands-x8Pe7DrF.js} +6 -6
  35. package/dist/{subcommands-D6LBtVPM.js → subcommands-yWgVRM2r.js} +273 -45
  36. package/dist/{terminal-iGHEnc7Z.js → terminal-Dv73BTE-.js} +2 -2
  37. package/dist/terminal.js +1 -1
  38. package/dist/{todoCli-azqbjBtz.js → todoCli-DSQXAcwA.js} +3 -3
  39. package/dist/{todoIdentity-NEceTmEe.js → todoIdentity-CAmnkzzP.js} +2 -2
  40. package/dist/{trayApp-BdNlQCFx.js → trayApp-BRw8f0mT.js} +2 -2
  41. package/dist/trayApp-BjQ5V3WV.js +5 -0
  42. package/dist/{ts-oyuaLWWx.js → ts-C8PxhJZM.js} +7 -7
  43. package/dist/{versionChecker-CMjS88mL.js → versionChecker-CWPGASjD.js} +2 -2
  44. package/dist/webrtcLink-CnQf9pmu.js +73 -0
  45. package/dist/{webrtcRemote-L5NxhLLR.js → webrtcRemote-yvMYsij3.js} +2 -2
  46. package/dist/{widget-OvkqW2Z6.js → widget-DhBSNUey.js} +3 -3
  47. package/dist/widgets.js +1 -1
  48. package/dist/{ws-BeMouYAU.js → ws-CMX0pkti.js} +2 -2
  49. package/dist/{ws-qZy7Giub.js → ws-DZ9YAXlY.js} +7 -7
  50. package/lab/ui/console-logic.js +27 -4
  51. package/package.json +1 -1
  52. package/ts/crossTreeClaim.bun.spec.ts +76 -0
  53. package/ts/crossTreeClaim.spec.ts +76 -0
  54. package/ts/globalPidIndex.spec.ts +153 -0
  55. package/ts/globalPidIndex.ts +151 -10
  56. package/ts/messageLog.bun.spec.ts +33 -0
  57. package/ts/messageLog.spec.ts +33 -0
  58. package/ts/messageLog.ts +3 -0
  59. package/ts/rawInputDeclared.bun.spec.ts +68 -0
  60. package/ts/rawInputDeclared.spec.ts +68 -0
  61. package/ts/remoteHealth.bun.spec.ts +130 -0
  62. package/ts/remoteHealth.spec.ts +130 -0
  63. package/ts/remoteHealth.ts +149 -0
  64. package/ts/restartKillGuard.bun.spec.ts +40 -0
  65. package/ts/restartKillGuard.spec.ts +40 -0
  66. package/ts/senderAncestry.ts +45 -7
  67. package/ts/serve.ts +46 -20
  68. package/ts/share.bun.spec.ts +24 -2
  69. package/ts/share.spec.ts +24 -2
  70. package/ts/share.ts +37 -5
  71. package/ts/subcommands.ts +239 -19
  72. package/ts/terminal/browser.ts +5 -1
  73. package/ts/webrtcLink.bun.spec.ts +45 -1
  74. package/ts/webrtcLink.spec.ts +45 -1
  75. package/ts/webrtcLink.ts +63 -19
  76. package/dist/SUPPORTED_CLIS-CuvT3tKq.js +0 -12
  77. package/dist/globalPidIndex-yvWZXeWT.js +0 -4
  78. package/dist/pidStore-V51mbgZY.js +0 -6
  79. package/dist/share-BvU4I8BI.js +0 -4
  80. package/dist/spawnGate-C8MSRt7X.js +0 -5
  81. package/dist/trayApp-Br2T2Yrb.js +0 -5
  82. package/dist/webrtcLink-DLaJfTcB.js +0 -45
@@ -0,0 +1,12 @@
1
+ import "./logger-CDIsZ-Pp.js";
2
+ import "./versionChecker-CWPGASjD.js";
3
+ import "./ts-C8PxhJZM.js";
4
+ import "./todoAutomation-CbVVS4re.js";
5
+ import "./JsonlStore-BqF7AQ6E.js";
6
+ import "./globalPidIndex-CRH9L9tn.js";
7
+ import "./pidStore-DXWqzTSz.js";
8
+ import "./messageLog-Brx3w6zT.js";
9
+ import "./todoStore-DF6vxHgV.js";
10
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-TiOdGi1h.js";
11
+
12
+ export { SUPPORTED_CLIS };
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-oyuaLWWx.js";
1
+ import { t as CLIS_CONFIG } from "./ts-C8PxhJZM.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-hTRegnm5.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-TiOdGi1h.js.map
@@ -1,15 +1,15 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
2
  import "./JsonlStore-BqF7AQ6E.js";
3
- import "./globalPidIndex-DoaKEUkO.js";
4
- import "./pidStore-B73xnAeT.js";
5
- import "./messageLog-CVRSTLza.js";
3
+ import "./globalPidIndex-CRH9L9tn.js";
4
+ import "./pidStore-DXWqzTSz.js";
5
+ import "./messageLog-Brx3w6zT.js";
6
6
  import "./e2e-z1xpwSAg.js";
7
7
  import "./configShared-DKTgiz7K.js";
8
- import { J as resolveOne } from "./subcommands-D6LBtVPM.js";
8
+ import { J as resolveOne } from "./subcommands-yWgVRM2r.js";
9
9
  import "./notifyStore-2SWKGwZI.js";
10
- import "./webrtcLink-DLaJfTcB.js";
11
- import "./remotes-DTXPW8U1.js";
12
- import { a as startShare } from "./share-DTlaFn6s.js";
10
+ import "./webrtcLink-CnQf9pmu.js";
11
+ import "./remotes-tmKwrr20.js";
12
+ import { o as startShare } from "./share-C9oGvjXT.js";
13
13
 
14
14
  //#region ts/agentShare.ts
15
15
  const MAX_SHARES = 8;
@@ -232,4 +232,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
232
232
 
233
233
  //#endregion
234
234
  export { createScopedShare, listShares, revokeAllShares, revokeShare };
235
- //# sourceMappingURL=agentShare-C_LTEKEb.js.map
235
+ //# sourceMappingURL=agentShare-D4N8StHO.js.map
@@ -1,9 +1,9 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
2
  import "./JsonlStore-BqF7AQ6E.js";
3
- import "./globalPidIndex-DoaKEUkO.js";
3
+ import "./globalPidIndex-CRH9L9tn.js";
4
4
  import { r as openStore } from "./todoStore-DF6vxHgV.js";
5
5
  import { t as formatIdentity } from "./identity-CKRuYUFi.js";
6
- import { a as resolveTodoRoot, i as resolveSelf } from "./todoIdentity-NEceTmEe.js";
6
+ import { a as resolveTodoRoot, i as resolveSelf } from "./todoIdentity-CAmnkzzP.js";
7
7
  import yargs from "yargs";
8
8
  import { randomBytes } from "crypto";
9
9
 
@@ -269,4 +269,4 @@ async function runAnswerSubcommand(rest, deps) {
269
269
 
270
270
  //#endregion
271
271
  export { runAnswerSubcommand, runAskSubcommand };
272
- //# sourceMappingURL=askCli-DR9vhdcV.js.map
272
+ //# sourceMappingURL=askCli-DFsWcgpF.js.map
@@ -13162,7 +13162,8 @@ var AyTerminal = class {
13162
13162
  body: JSON.stringify({
13163
13163
  keyword: this.pid,
13164
13164
  msg: data,
13165
- code: "none"
13165
+ code: "none",
13166
+ raw: true
13166
13167
  })
13167
13168
  }).then((r) => {
13168
13169
  if (r.status === 403 || r.status === 401) this.revokeWrite();
@@ -13565,4 +13566,4 @@ const XTERM_CSS = `
13565
13566
 
13566
13567
  //#endregion
13567
13568
  export { AyTerminal as t };
13568
- //# sourceMappingURL=browser-oqC3Ln2a.js.map
13569
+ //# sourceMappingURL=browser-wkzxw6lx.js.map
@@ -1,5 +1,5 @@
1
1
  import { t as agentYesHome } from "./agentYesHome-BNtn19J4.js";
2
- import { J as resolveOne } from "./subcommands-D6LBtVPM.js";
2
+ import { J as resolveOne } from "./subcommands-yWgVRM2r.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-B2nisui8.js");
75
+ const { resolveLocalServeUrl } = await import("./serve-CJDQq_Jp.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-DAQ8wCtJ.js.map
190
+ //# sourceMappingURL=callback-Bc2gnr_f.js.map
@@ -1,15 +1,15 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
2
  import "./JsonlStore-BqF7AQ6E.js";
3
- import "./globalPidIndex-DoaKEUkO.js";
4
- import "./pidStore-B73xnAeT.js";
5
- import "./messageLog-CVRSTLza.js";
3
+ import "./globalPidIndex-CRH9L9tn.js";
4
+ import "./pidStore-DXWqzTSz.js";
5
+ import "./messageLog-Brx3w6zT.js";
6
6
  import "./e2e-z1xpwSAg.js";
7
7
  import "./configShared-DKTgiz7K.js";
8
- import "./subcommands-D6LBtVPM.js";
8
+ import "./subcommands-yWgVRM2r.js";
9
9
  import "./notifyStore-2SWKGwZI.js";
10
- import "./webrtcLink-DLaJfTcB.js";
11
- import "./remotes-DTXPW8U1.js";
10
+ import "./webrtcLink-CnQf9pmu.js";
11
+ import "./remotes-tmKwrr20.js";
12
12
  import "./callbackCore-Bl2gGcxg.js";
13
- import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-DAQ8wCtJ.js";
13
+ import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-Bc2gnr_f.js";
14
14
 
15
15
  export { cmdCallback };
@@ -387,7 +387,7 @@ function printOp(op) {
387
387
  */
388
388
  async function runMesh(cwd, entry, opts) {
389
389
  const { ChannelPeer } = await import("./peer-CGSJluSw.js");
390
- const { importRTC, getIceServers } = await import("./share-BvU4I8BI.js");
390
+ const { importRTC, getIceServers } = await import("./share-Bmnd_qT0.js");
391
391
  const rtc = await importRTC();
392
392
  const seen = new Set((await readOps(cwd, entry.channelId)).map((o) => o.id));
393
393
  const peer = new ChannelPeer({
@@ -567,4 +567,4 @@ async function cmdCh(args) {
567
567
 
568
568
  //#endregion
569
569
  export { cmdCh };
570
- //# sourceMappingURL=channels-hOG3-R_3.js.map
570
+ //# sourceMappingURL=channels-aYwLMbFV.js.map
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-CMjS88mL.js";
5
- import { l as getRustBinary } from "./rustBinary-jO6EN8LR.js";
4
+ import { a as versionString, r as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-CWPGASjD.js";
5
+ import { l as getRustBinary } from "./rustBinary-Clbk_K5c.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-BpFdlCY0.js");
298
+ const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-x8Pe7DrF.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-CuvT3tKq.js");
312
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-BZP767UR.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);
@@ -337,7 +337,7 @@ if (config.tray) {
337
337
  ensureTray();
338
338
  }
339
339
  if (!config.showVersion && !config.appendPrompt && !config.tray) {
340
- const { waitForSpawnCapacity } = await import("./spawnGate-C8MSRt7X.js");
340
+ const { waitForSpawnCapacity } = await import("./spawnGate-BUEswFgo.js");
341
341
  await waitForSpawnCapacity({
342
342
  onWait: (reason, waitedMs) => {
343
343
  if (config.verbose || waitedMs === 0) console.error(`[agent-yes] spawn gate: ${reason} — waiting…`);
@@ -346,7 +346,7 @@ if (!config.showVersion && !config.appendPrompt && !config.tray) {
346
346
  });
347
347
  }
348
348
  if (!config.showVersion && !config.appendPrompt && !config.tray) {
349
- const { warnIfCwdOccupied } = await import("./cwdConflictWarn-BgXN56Jc.js");
349
+ const { warnIfCwdOccupied } = await import("./cwdConflictWarn-sQUONAye.js");
350
350
  await warnIfCwdOccupied(process.argv);
351
351
  }
352
352
  if (config.useRust) {
@@ -360,14 +360,14 @@ if (config.useRust) {
360
360
  }
361
361
  }
362
362
  if (rustBinary) {
363
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-CuvT3tKq.js");
363
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-BZP767UR.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}`);
367
367
  console.log(`[rust] Args: ${rustArgs.join(" ")}`);
368
368
  }
369
369
  const attach = config.attach || process.env.AGENT_YES_ATTACH === "1";
370
- const { shouldForkNested, buildSpawnTutorial, waitForRegistration, confirmAgentStarted, predictedLogPath } = await import("./forkNested-CJ7lQQCe.js");
370
+ const { shouldForkNested, buildSpawnTutorial, waitForRegistration, confirmAgentStarted, predictedLogPath } = await import("./forkNested-xtEeYpBQ.js");
371
371
  if (shouldForkNested({
372
372
  isTTY: Boolean(process.stdout.isTTY),
373
373
  ayPid: process.env.AGENT_YES_PID,
@@ -434,7 +434,7 @@ if (config.showVersion) {
434
434
  process.exit(0);
435
435
  }
436
436
  if (config.appendPrompt) {
437
- const { PidStore } = await import("./pidStore-V51mbgZY.js");
437
+ const { PidStore } = await import("./pidStore-Bpe8i_oU.js");
438
438
  const ipcPath = await PidStore.findActiveFifo(process.cwd());
439
439
  if (!ipcPath) {
440
440
  console.error("No active agent with IPC found in current directory.");
@@ -1,14 +1,14 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
2
  import "./JsonlStore-BqF7AQ6E.js";
3
- import "./globalPidIndex-DoaKEUkO.js";
4
- import "./pidStore-B73xnAeT.js";
5
- import "./messageLog-CVRSTLza.js";
3
+ import "./globalPidIndex-CRH9L9tn.js";
4
+ import "./pidStore-DXWqzTSz.js";
5
+ import "./messageLog-Brx3w6zT.js";
6
6
  import "./e2e-z1xpwSAg.js";
7
7
  import "./configShared-DKTgiz7K.js";
8
- import { F as listRecords, dt as buildAgentForest, ft as flattenForest, h as deriveLiveState } from "./subcommands-D6LBtVPM.js";
8
+ import { F as listRecords, dt as buildAgentForest, ft as flattenForest, h as deriveLiveState } from "./subcommands-yWgVRM2r.js";
9
9
  import "./notifyStore-2SWKGwZI.js";
10
- import "./webrtcLink-DLaJfTcB.js";
11
- import "./remotes-DTXPW8U1.js";
10
+ import "./webrtcLink-CnQf9pmu.js";
11
+ import "./remotes-tmKwrr20.js";
12
12
  import { i as systemStats, n as sampleTrees, r as snapshotProcs, t as humanBytes } from "./procStats-CyD8h5nx.js";
13
13
  import yargs from "yargs";
14
14
  import { readFileSync } from "node:fs";
@@ -330,4 +330,4 @@ function readPpidSync(pid) {
330
330
 
331
331
  //#endregion
332
332
  export { cmdPs };
333
- //# sourceMappingURL=cmdPs-BAaLB4Pz.js.map
333
+ //# sourceMappingURL=cmdPs-D5L3Eyh5.js.map
@@ -1,5 +1,5 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import { i as readGlobalPids } from "./globalPidIndex-DoaKEUkO.js";
2
+ import { a as readGlobalPids } from "./globalPidIndex-CRH9L9tn.js";
3
3
  import path from "path";
4
4
 
5
5
  //#region ts/cwdConflictWarn.ts
@@ -61,4 +61,4 @@ async function warnIfCwdOccupied(rawArgv) {
61
61
 
62
62
  //#endregion
63
63
  export { warnIfCwdOccupied };
64
- //# sourceMappingURL=cwdConflictWarn-BgXN56Jc.js.map
64
+ //# sourceMappingURL=cwdConflictWarn-sQUONAye.js.map
@@ -62,7 +62,7 @@ function buildSpawnTutorial(cli, pid) {
62
62
  * fast instead of waiting out the whole window).
63
63
  */
64
64
  async function waitForRegistration(pid, timeoutMs = 5e3, aborted) {
65
- const { readGlobalPids } = await import("./globalPidIndex-yvWZXeWT.js");
65
+ const { readGlobalPids } = await import("./globalPidIndex-DC93JhHQ.js");
66
66
  const isRegistered = async () => (await readGlobalPids()).some((r) => r.pid === pid && r.status !== "exited");
67
67
  const deadline = Date.now() + timeoutMs;
68
68
  while (Date.now() < deadline) {
@@ -110,7 +110,7 @@ async function tailFile(file, max = 400) {
110
110
  * success, keeping the previous behaviour for anything this can't decide.
111
111
  */
112
112
  async function confirmAgentStarted(pid, graceMs = 1500, aborted) {
113
- const { readGlobalPids } = await import("./globalPidIndex-yvWZXeWT.js");
113
+ const { readGlobalPids } = await import("./globalPidIndex-DC93JhHQ.js");
114
114
  const { stat } = await import("fs/promises");
115
115
  const deadline = Date.now() + graceMs;
116
116
  while (Date.now() < deadline) {
@@ -141,4 +141,4 @@ async function confirmAgentStarted(pid, graceMs = 1500, aborted) {
141
141
 
142
142
  //#endregion
143
143
  export { buildSpawnTutorial, confirmAgentStarted, predictedLogPath, shouldForkNested, waitForRegistration };
144
- //# sourceMappingURL=forkNested-CJ7lQQCe.js.map
144
+ //# sourceMappingURL=forkNested-xtEeYpBQ.js.map
@@ -1,5 +1,5 @@
1
1
  import { n as logger } from "./logger-CDIsZ-Pp.js";
2
- import { appendFile, mkdir, readFile, rename, unlink, writeFile } from "fs/promises";
2
+ import { appendFile, mkdir, readFile, readdir, rename, stat, unlink, writeFile } from "fs/promises";
3
3
  import { homedir } from "os";
4
4
  import path from "path";
5
5
  import { lock } from "proper-lockfile";
@@ -155,6 +155,23 @@ function logSiblings(logFile) {
155
155
  ];
156
156
  }
157
157
  /**
158
+ * Delete one log file, reporting the bytes it held. Returns null when nothing
159
+ * was removed (already gone, or not ours to delete) so callers can count only
160
+ * real deletions.
161
+ */
162
+ async function removeLogFile(file) {
163
+ let size = 0;
164
+ try {
165
+ size = (await stat(file)).size;
166
+ } catch {}
167
+ try {
168
+ await unlink(file);
169
+ return size;
170
+ } catch {
171
+ return null;
172
+ }
173
+ }
174
+ /**
158
175
  * Index-driven retention sweep: delete the log files of sessions whose process
159
176
  * is gone (exited or dead pid) and that started longer ago than the retention
160
177
  * window. Because the index records absolute `log_file` paths, this reclaims
@@ -162,30 +179,140 @@ function logSiblings(logFile) {
162
179
  * Best-effort; never throws. Returns the number of files removed.
163
180
  */
164
181
  async function pruneOldLogs(maxAgeMs = retentionMs()) {
182
+ const { removed } = await pruneOldLogsDetailed(maxAgeMs);
183
+ return removed.length;
184
+ }
185
+ async function pruneOldLogsDetailed(maxAgeMs = retentionMs()) {
186
+ const result = {
187
+ removed: [],
188
+ freedBytes: 0
189
+ };
165
190
  let records;
166
191
  try {
167
192
  records = await readGlobalPidsRaw();
168
193
  } catch {
169
- return 0;
194
+ return result;
170
195
  }
171
196
  const now = Date.now();
172
- let removed = 0;
173
197
  for (const r of records) {
174
198
  const dead = r.status === "exited" || !isProcessAlive(r.pid);
175
199
  const old = now - (r.started_at ?? now) > maxAgeMs;
176
200
  if (!dead || !old) continue;
177
- for (const f of logSiblings(r.log_file)) try {
178
- await unlink(f);
179
- removed++;
180
- } catch {}
201
+ for (const f of logSiblings(r.log_file)) {
202
+ const freed = await removeLogFile(f);
203
+ if (freed === null) continue;
204
+ result.removed.push(f);
205
+ result.freedBytes += freed;
206
+ }
181
207
  }
182
- if (removed > 0) {
183
- logger.debug(`[globalPidIndex] pruned ${removed} stale log file(s)`);
208
+ if (result.removed.length > 0) {
209
+ logger.debug(`[globalPidIndex] pruned ${result.removed.length} stale log file(s)`);
184
210
  await maybeCompactGlobalPids();
185
211
  }
186
- return removed;
212
+ return result;
213
+ }
214
+ /** `<pid>.log`, `<pid>.raw.log`, `<pid>.lines.log`, `<pid>.debug.log` — nothing else. */
215
+ const PID_LOG_FILE = /^(\d+)\.(?:raw\.log|lines\.log|debug\.log|log)$/;
216
+ /**
217
+ * Every `.agent-yes/` dir that might hold logs: this process's cwd plus the
218
+ * dir of each path the index knows about. Records are the only breadcrumb to
219
+ * *other* projects, so a pid whose record is gone is still reachable as long
220
+ * as some sibling record points at the same dir.
221
+ */
222
+ function candidateLogDirs(records) {
223
+ const dirs = new Set([path.resolve(process.cwd(), ".agent-yes")]);
224
+ for (const r of records) {
225
+ if (r.log_file) dirs.add(path.resolve(path.dirname(r.log_file)));
226
+ if (r.cwd) dirs.add(path.resolve(r.cwd, ".agent-yes"));
227
+ }
228
+ return [...dirs];
229
+ }
230
+ /**
231
+ * Directory-driven sweep for **orphaned** logs — the ones `pruneOldLogs` can
232
+ * never see.
233
+ *
234
+ * `maybeCompactGlobalPids` drops records that are dead AND exited, but
235
+ * `pruneOldLogs` only deletes a log once its record is older than the
236
+ * retention window. A session that exits cleanly is therefore compacted out of
237
+ * the index long before its log ages out, and with the record goes the only
238
+ * record of the `log_file` path — the file is then unreclaimable by any
239
+ * index-driven pass. Left alone, those accumulate for as long as a machine
240
+ * keeps running agents, and a single long-lived session's raw log can reach
241
+ * hundreds of MiB on its own.
242
+ *
243
+ * So this pass ignores the index for *what* to delete and trusts the
244
+ * filesystem: in each candidate dir, any `<pid>.*.log` whose pid is no longer
245
+ * running and whose mtime is outside the retention window. Guards:
246
+ *
247
+ * - the name must parse as a pid log (never `inbox.jsonl`, `pid.sqlite`, …);
248
+ * - `isProcessAlive(pid)` must be false — pid reuse can only make a dead pid
249
+ * look alive, which keeps a file that a later run collects, never the
250
+ * reverse;
251
+ * - mtime, not `started_at`, bounds the age, so a log still being appended to
252
+ * is safe even when its session started long ago.
253
+ *
254
+ * Best-effort; never throws.
255
+ */
256
+ async function sweepOrphanLogs(maxAgeMs = retentionMs()) {
257
+ const result = {
258
+ removed: [],
259
+ freedBytes: 0
260
+ };
261
+ let records = [];
262
+ try {
263
+ records = await readGlobalPidsRaw();
264
+ } catch {}
265
+ const now = Date.now();
266
+ for (const dir of candidateLogDirs(records)) {
267
+ let entries;
268
+ try {
269
+ entries = await readdir(dir, { withFileTypes: true });
270
+ } catch {
271
+ continue;
272
+ }
273
+ for (const entry of entries) {
274
+ if (!entry.isFile()) continue;
275
+ const match = PID_LOG_FILE.exec(entry.name);
276
+ if (!match) continue;
277
+ const pid = Number(match[1]);
278
+ if (!Number.isInteger(pid) || pid <= 0 || isProcessAlive(pid)) continue;
279
+ const file = path.join(dir, entry.name);
280
+ let mtimeMs;
281
+ try {
282
+ mtimeMs = (await stat(file)).mtimeMs;
283
+ } catch {
284
+ continue;
285
+ }
286
+ if (now - mtimeMs <= maxAgeMs) continue;
287
+ const freed = await removeLogFile(file);
288
+ if (freed === null) continue;
289
+ result.removed.push(file);
290
+ result.freedBytes += freed;
291
+ }
292
+ }
293
+ if (result.removed.length > 0) logger.debug(`[globalPidIndex] swept ${result.removed.length} orphaned log file(s)`);
294
+ return result;
295
+ }
296
+ /**
297
+ * The full log reclaim `ay gc` runs: the index-driven retention pass first
298
+ * (it also compacts the index), then the directory sweep for whatever the
299
+ * index no longer remembers. Paths are deduped, so a file both passes could
300
+ * claim is only counted once.
301
+ */
302
+ async function gcLogs(maxAgeMs = retentionMs()) {
303
+ const pruned = await pruneOldLogsDetailed(maxAgeMs);
304
+ const swept = await sweepOrphanLogs(maxAgeMs);
305
+ const seen = new Set(pruned.removed);
306
+ const result = { ...pruned };
307
+ for (const f of swept.removed) {
308
+ if (seen.has(f)) continue;
309
+ seen.add(f);
310
+ result.removed.push(f);
311
+ }
312
+ result.freedBytes = pruned.freedBytes + swept.freedBytes;
313
+ return result;
187
314
  }
188
315
 
189
316
  //#endregion
190
- export { updateGlobalPidStatus as a, readGlobalPids as i, maybeCompactGlobalPids as n, pruneOldLogs as r, appendGlobalPid as t };
191
- //# sourceMappingURL=globalPidIndex-DoaKEUkO.js.map
317
+ export { readGlobalPids as a, pruneOldLogs as i, gcLogs as n, sweepOrphanLogs as o, maybeCompactGlobalPids as r, updateGlobalPidStatus as s, appendGlobalPid as t };
318
+ //# sourceMappingURL=globalPidIndex-CRH9L9tn.js.map
@@ -0,0 +1,4 @@
1
+ import "./logger-CDIsZ-Pp.js";
2
+ import { a as readGlobalPids, i as pruneOldLogs, n as gcLogs, o as sweepOrphanLogs, r as maybeCompactGlobalPids, s as updateGlobalPidStatus, t as appendGlobalPid } from "./globalPidIndex-CRH9L9tn.js";
3
+
4
+ export { gcLogs, readGlobalPids };
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-CMjS88mL.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-oyuaLWWx.js";
2
+ import "./versionChecker-CWPGASjD.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-C8PxhJZM.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
- import "./globalPidIndex-DoaKEUkO.js";
7
- import "./pidStore-B73xnAeT.js";
8
- import "./messageLog-CVRSTLza.js";
6
+ import "./globalPidIndex-CRH9L9tn.js";
7
+ import "./pidStore-DXWqzTSz.js";
8
+ import "./messageLog-Brx3w6zT.js";
9
9
  import { a as LIFECYCLES, c as initialState, d as requiredGate, f as statesOf, i as DONE_STATE, l as isKnownKind, n as TodoStore, o as ORPHANED_STATE, r as openStore, s as canTransition, t as CycleError, u as nextStates } from "./todoStore-DF6vxHgV.js";
10
10
 
11
11
  export { AgentContext, CLIS_CONFIG, CycleError, DONE_STATE, LIFECYCLES, ORPHANED_STATE, TodoStore, answerAsk, canTransition, config, agentYes as default, describeBlock, hasTodoStore, initialState, isKnownKind, listAsks, listAsksForProject, monitorHint, nextStates, openBlockers, openStore, reconcileTodos, removeControlCharacters, renderDigest, renderTree, requiredGate, statesOf, unblockedTasks };
@@ -127,6 +127,7 @@ function senderLabel(record) {
127
127
  const name = `${record.from.cli} #${record.from.pid}`;
128
128
  if (record.from_via === "ancestry") return `${name} (via process tree)`;
129
129
  if (record.from_via === "env-uncorroborated") return `${name} (UNCORROBORATED)`;
130
+ if (record.from_via === "env-unverified") return `${name} (unverified)`;
130
131
  return name;
131
132
  }
132
133
  if (record.sender_observed) {
@@ -220,4 +221,4 @@ async function readMailbox(cwd, box) {
220
221
 
221
222
  //#endregion
222
223
  export { recordOutbox as a, recordMessage as i, readMailbox as n, senderLabel as o, recordInbox as r, isTerminalReply as s, partyMatches as t };
223
- //# sourceMappingURL=messageLog-CVRSTLza.js.map
224
+ //# sourceMappingURL=messageLog-Brx3w6zT.js.map
@@ -1,14 +1,14 @@
1
1
  import { n as logger } from "./logger-CDIsZ-Pp.js";
2
2
  import "./JsonlStore-BqF7AQ6E.js";
3
- import "./globalPidIndex-DoaKEUkO.js";
4
- import "./pidStore-B73xnAeT.js";
5
- import "./messageLog-CVRSTLza.js";
3
+ import "./globalPidIndex-CRH9L9tn.js";
4
+ import "./pidStore-DXWqzTSz.js";
5
+ import "./messageLog-Brx3w6zT.js";
6
6
  import "./e2e-z1xpwSAg.js";
7
7
  import "./configShared-DKTgiz7K.js";
8
- import { D as isPidAlive, F as listRecords, G as renderLogTailLines, h as deriveLiveState } from "./subcommands-D6LBtVPM.js";
8
+ import { D as isPidAlive, F as listRecords, G as renderLogTailLines, h as deriveLiveState } from "./subcommands-yWgVRM2r.js";
9
9
  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";
10
- import "./webrtcLink-DLaJfTcB.js";
11
- import "./remotes-DTXPW8U1.js";
10
+ import "./webrtcLink-CnQf9pmu.js";
11
+ import "./remotes-tmKwrr20.js";
12
12
  import { mkdir, readFile, rename, rm, stat, writeFile } from "fs/promises";
13
13
  import { randomUUID } from "node:crypto";
14
14
  import { execFile, execFileSync } from "node:child_process";
@@ -879,4 +879,4 @@ async function ensureDaemon() {
879
879
 
880
880
  //#endregion
881
881
  export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
882
- //# sourceMappingURL=notifyDaemon-Dnbe66Fl.js.map
882
+ //# sourceMappingURL=notifyDaemon-CvUtRnAB.js.map
@@ -1,5 +1,5 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./globalPidIndex-DoaKEUkO.js";
3
- import { n as spawnerFromRecords, t as resolveSpawner } from "./parentLink-bpDGuQi6.js";
2
+ import "./globalPidIndex-CRH9L9tn.js";
3
+ import { n as spawnerFromRecords, t as resolveSpawner } from "./parentLink-CfbxykCv.js";
4
4
 
5
5
  export { resolveSpawner };
@@ -1,4 +1,4 @@
1
- import { i as readGlobalPids } from "./globalPidIndex-DoaKEUkO.js";
1
+ import { a as readGlobalPids } from "./globalPidIndex-CRH9L9tn.js";
2
2
 
3
3
  //#region ts/parentLink.ts
4
4
  /**
@@ -50,4 +50,4 @@ function spawnerFromRecords(records, parentPid) {
50
50
 
51
51
  //#endregion
52
52
  export { spawnerFromRecords as n, resolveSpawner as t };
53
- //# sourceMappingURL=parentLink-bpDGuQi6.js.map
53
+ //# sourceMappingURL=parentLink-CfbxykCv.js.map
@@ -1,8 +1,8 @@
1
1
  import { n as logger } from "./logger-CDIsZ-Pp.js";
2
- import "./globalPidIndex-DoaKEUkO.js";
2
+ import "./globalPidIndex-CRH9L9tn.js";
3
3
  import { t as classifyNeedsInput } from "./needsInput-BHopZGM8.js";
4
4
  import { n as replyTargetOf, r as shortenHome } from "./initMsg-axyQAPLK.js";
5
- import { t as resolveSpawner } from "./parentLink-bpDGuQi6.js";
5
+ import { t as resolveSpawner } from "./parentLink-CfbxykCv.js";
6
6
  import { spawn } from "node:child_process";
7
7
 
8
8
  //#region ts/parentPing.ts
@@ -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-BpFdlCY0.js");
341
+ const { lastReadAt, READ_WINDOW_MS } = await import("./subcommands-x8Pe7DrF.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-DWv-xJoi.js.map
469
+ //# sourceMappingURL=parentPingLoop-CVOCiQp2.js.map
@@ -0,0 +1,6 @@
1
+ import "./logger-CDIsZ-Pp.js";
2
+ import "./JsonlStore-BqF7AQ6E.js";
3
+ import "./globalPidIndex-CRH9L9tn.js";
4
+ import { t as PidStore } from "./pidStore-DXWqzTSz.js";
5
+
6
+ export { PidStore };
@@ -1,7 +1,7 @@
1
1
  import { n as logger } from "./logger-CDIsZ-Pp.js";
2
2
  import { t as agentYesHome } from "./agentYesHome-BNtn19J4.js";
3
3
  import { t as JsonlStore } from "./JsonlStore-BqF7AQ6E.js";
4
- import { a as updateGlobalPidStatus, n as maybeCompactGlobalPids, r as pruneOldLogs, t as appendGlobalPid } from "./globalPidIndex-DoaKEUkO.js";
4
+ import { i as pruneOldLogs, r as maybeCompactGlobalPids, s as updateGlobalPidStatus, t as appendGlobalPid } from "./globalPidIndex-CRH9L9tn.js";
5
5
  import { mkdir, writeFile } from "fs/promises";
6
6
  import path from "path";
7
7
  import { randomBytes } from "node:crypto";
@@ -197,4 +197,4 @@ pid-db/
197
197
 
198
198
  //#endregion
199
199
  export { PidStore as t };
200
- //# sourceMappingURL=pidStore-B73xnAeT.js.map
200
+ //# sourceMappingURL=pidStore-DXWqzTSz.js.map
@@ -1,4 +1,4 @@
1
- import { n as isWebrtcSpec, r as parseWebrtcLink } from "./webrtcLink-DLaJfTcB.js";
1
+ import { n as isWebrtcSpec, r as parseWebrtcLink } from "./webrtcLink-CnQf9pmu.js";
2
2
  import { mkdir, readFile, writeFile } from "fs/promises";
3
3
  import { homedir } from "os";
4
4
  import path from "path";
@@ -93,7 +93,7 @@ async function resolveRemoteSpec(spec) {
93
93
  * The bridge lives for the rest of the process (torn down on `process.exit`).
94
94
  */
95
95
  async function resolveWebrtc(link, keyword, label) {
96
- const { startWebrtcBridge } = await import("./webrtcRemote-L5NxhLLR.js");
96
+ const { startWebrtcBridge } = await import("./webrtcRemote-yvMYsij3.js");
97
97
  const bridge = await startWebrtcBridge(link);
98
98
  return {
99
99
  url: bridge.baseUrl,
@@ -181,4 +181,4 @@ async function cmdRemote(rest) {
181
181
 
182
182
  //#endregion
183
183
  export { resolveRemoteSpec as a, readRemotes as i, deleteRemoteAlias as n, writeRemoteAlias as o, parseDirectRemoteSpec as r, cmdRemote as t };
184
- //# sourceMappingURL=remotes-DTXPW8U1.js.map
184
+ //# sourceMappingURL=remotes-tmKwrr20.js.map
@@ -1,5 +1,5 @@
1
1
  import "./e2e-z1xpwSAg.js";
2
- import "./webrtcLink-DLaJfTcB.js";
3
- import { a as resolveRemoteSpec, i as readRemotes, n as deleteRemoteAlias, o as writeRemoteAlias, r as parseDirectRemoteSpec, t as cmdRemote } from "./remotes-DTXPW8U1.js";
2
+ import "./webrtcLink-CnQf9pmu.js";
3
+ import { a as resolveRemoteSpec, i as readRemotes, n as deleteRemoteAlias, o as writeRemoteAlias, r as parseDirectRemoteSpec, t as cmdRemote } from "./remotes-tmKwrr20.js";
4
4
 
5
5
  export { cmdRemote };