agent-yes 1.303.1-beta.790.1 → 1.303.1-beta.792.1

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 (73) hide show
  1. package/dist/{SUPPORTED_CLIS-B7JRHaXA.js → SUPPORTED_CLIS-BFep5hb5.js} +3 -3
  2. package/dist/{SUPPORTED_CLIS-zbr1qZRl.js → SUPPORTED_CLIS-t_5QYk33.js} +2 -2
  3. package/dist/{agentShare-DgCGfLUl.js → agentShare-BoUJNXqm.js} +6 -5
  4. package/dist/{askCli-BU3CNCLU.js → askCli-BIKef8Uz.js} +2 -2
  5. package/dist/{callback-_plPeIxu.js → callback-BnVg1IBI.js} +6 -5
  6. package/dist/{callback-CyqlBiDx.js → callback-KSfCHgvN.js} +5 -5
  7. package/dist/{callbackCore-DSJWhqAe.js → callbackCore-BZ_10zyc.js} +1 -1
  8. package/dist/{callbackCore-BesbQ6-Z.js → callbackCore-Deve5pv3.js} +1 -1
  9. package/dist/{channels-j5nWuzlQ.js → channels-Y36S0ccW.js} +2 -2
  10. package/dist/cli.js +12 -12
  11. package/dist/{cmdDsh-2LP0grim.js → cmdDsh-DZ8bLsH7.js} +1 -1
  12. package/dist/cmdKill-1irEzKl9.js +116 -0
  13. package/dist/{cmdPs-DfyTa7E0.js → cmdPs-BMBjSdpr.js} +6 -5
  14. package/dist/{cwdConflictWarn-skQSMwEh.js → cwdConflictWarn-DMjcRrlV.js} +1 -1
  15. package/dist/{cwdPassthroughHint-BUbWMoz0.js → cwdPassthroughHint-CzWh0hrw.js} +1 -1
  16. package/dist/{expose-Dawq1LxC.js → expose-BqaH-tsw.js} +1 -1
  17. package/dist/forceKill-BDqxx4uQ.js +44 -0
  18. package/dist/{forkNested-B3BE0ojL.js → forkNested-Bk0aDizk.js} +3 -3
  19. package/dist/{globalPidIndex-BftWlg2V.js → globalPidIndex-Q6NdU1NM.js} +1 -1
  20. package/dist/{hist-Cs0KFSUW.js → hist-DY16wm7g.js} +1 -1
  21. package/dist/index.js +2 -2
  22. package/dist/{initMsg-CcTqFtsp.js → initMsg-BEVDWYnv.js} +1 -1
  23. package/dist/{initMsg-D9KJnfgC.js → initMsg-GPU52N-j.js} +1 -1
  24. package/dist/{nodeRuntime-DGMQRTGT.js → nodeRuntime-B1nCglgu.js} +1 -1
  25. package/dist/{notifyDaemon-B0zqm-eL.js → notifyDaemon-D-0GQrD5.js} +5 -4
  26. package/dist/{openBrowser-1cIo4dJL.js → openBrowser-CQAOIrD6.js} +1 -1
  27. package/dist/{parentLink-B58V1RVd.js → parentLink-1BOJuXBu.js} +1 -1
  28. package/dist/{parentLink-DoEWVGld.js → parentLink-COFYy_0K.js} +1 -1
  29. package/dist/{parentPingLoop-y_ZCVMrB.js → parentPingLoop-DP1MoW_7.js} +4 -4
  30. package/dist/{procStats-BvmrBrOs.js → procStats-DwTxj3rs.js} +1 -1
  31. package/dist/{remotes-DevcBeLl.js → remotes-B2i_QcdG.js} +2 -2
  32. package/dist/{remotes-MfdV9M8u.js → remotes-D6sc8jcM.js} +1 -1
  33. package/dist/{roomReplyAlias-DFqg_6IU.js → roomReplyAlias-9jb1qmh3.js} +2 -2
  34. package/dist/roomReplyAlias-DKEuV2Qt.js +6 -0
  35. package/dist/{rustBinary-BFknuxsF.js → rustBinary-BDcUKywU.js} +2 -2
  36. package/dist/{rustBinary-C1QmuDI2.js → rustBinary-BqUk1oeN.js} +2 -2
  37. package/dist/{schedule-BAmEUXAI.js → schedule-DicWdnQc.js} +6 -6
  38. package/dist/senderAncestry-CVHeKk1Y.js +173 -0
  39. package/dist/senderAncestry-KhAUPCQs.js +3 -0
  40. package/dist/{serve-BQ4xpV6z.js → serve-Dj_XGSwX.js} +41 -54
  41. package/dist/{serveRust-Bn-s6FrM.js → serveRust-DKhCiKjJ.js} +1 -1
  42. package/dist/{setup-ByLdCoel.js → setup-mFtk1aA_.js} +4 -4
  43. package/dist/{share-w5oRbvlj.js → share-CbFetL5H.js} +1 -1
  44. package/dist/{share-DrS3LYqf.js → share-_TPYAGWC.js} +1 -1
  45. package/dist/{shareCmd-BBq0GoWM.js → shareCmd-B7GBEO5J.js} +9 -9
  46. package/dist/{spawnGate-lr3tvA6U.js → spawnGate-CEk6MowO.js} +2 -2
  47. package/dist/{spawnGate-DeQBTX-o.js → spawnGate-CYzzHDcZ.js} +1 -1
  48. package/dist/{subcommands-DPchg3Wm.js → subcommands-CzNl9RwB.js} +37 -203
  49. package/dist/{subcommands-CmKPaejC.js → subcommands-FaMjO2K3.js} +4 -3
  50. package/dist/{systemPathLink-SjUzgSiq.js → systemPathLink-DPb5Xbad.js} +1 -1
  51. package/dist/{terminal-xWupZIsP.js → terminal-DMpjnnTw.js} +2 -2
  52. package/dist/{todoCli-BWm5nZE0.js → todoCli-C8hRlyCE.js} +2 -2
  53. package/dist/{todoIdentity-BvXZKWJI.js → todoIdentity-B3VCO-jT.js} +1 -1
  54. package/dist/{tray-BeRSozJz.js → tray-BZ8qvzgM.js} +1 -1
  55. package/dist/{trayApp-Bd1Hojn1.js → trayApp-3IDyX8ND.js} +2 -2
  56. package/dist/trayApp-D8rXs_Ol.js +5 -0
  57. package/dist/{ts-Bl-WlOAr.js → ts-CRFAyvVD.js} +5 -5
  58. package/dist/{versionChecker-BI9VEIMH.js → versionChecker-62GqCQuL.js} +2 -2
  59. package/dist/{webrtcRemote-BlGyNZDC.js → webrtcRemote-DRF6N3FQ.js} +1 -1
  60. package/dist/{widget-B_23qhF1.js → widget-DLCi8qUM.js} +3 -3
  61. package/dist/{workspaceConfig-BLWB5Wu9.js → workspaceConfig-DXWyuf1A.js} +1 -1
  62. package/dist/{ws-BjZd6tLm.js → ws-DUprs8Xw.js} +5 -4
  63. package/dist/{ws-CmU70ekc.js → ws-tQGhJ5VC.js} +3 -3
  64. package/package.json +1 -1
  65. package/ts/cmdKill.bun.spec.ts +155 -0
  66. package/ts/cmdKill.spec.ts +155 -0
  67. package/ts/cmdKill.ts +183 -0
  68. package/ts/forceKill.ts +52 -0
  69. package/ts/serve.ts +2 -25
  70. package/ts/subcommands.spec.ts +2 -1
  71. package/ts/subcommands.ts +13 -3
  72. package/dist/roomReplyAlias-DuEkSSDI.js +0 -6
  73. package/dist/trayApp-CuH1O49w.js +0 -5
@@ -1,12 +1,12 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-BI9VEIMH.js";
3
- import "./ts-Bl-WlOAr.js";
2
+ import "./versionChecker-62GqCQuL.js";
3
+ import "./ts-CRFAyvVD.js";
4
4
  import "./todoAutomation-TTp_Qz9G.js";
5
5
  import "./JsonlStore-BpYZZTap.js";
6
6
  import "./globalPidIndex-CRB5KtyL.js";
7
7
  import "./pidStore-433kvh9D.js";
8
8
  import "./messageLog-Dq_ka-Bt.js";
9
9
  import "./todoStore-C9RTz0Vs.js";
10
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-zbr1qZRl.js";
10
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-t_5QYk33.js";
11
11
 
12
12
  export { SUPPORTED_CLIS };
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-Bl-WlOAr.js";
1
+ import { t as CLIS_CONFIG } from "./ts-CRFAyvVD.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-zbr1qZRl.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-t_5QYk33.js.map
@@ -6,11 +6,12 @@ import "./messageLog-Dq_ka-Bt.js";
6
6
  import "./e2e-BdLf8DvY.js";
7
7
  import "./configShared-De4bR5hH.js";
8
8
  import "./webrtcLink-va_gAR77.js";
9
- import "./remotes-DevcBeLl.js";
10
- import "./roomReplyAlias-DFqg_6IU.js";
11
- import { rt as resolveOne } from "./subcommands-DPchg3Wm.js";
9
+ import "./remotes-B2i_QcdG.js";
10
+ import "./roomReplyAlias-9jb1qmh3.js";
11
+ import { rt as resolveOne } from "./subcommands-CzNl9RwB.js";
12
12
  import "./notifyStore-DIfkfKB2.js";
13
- import { l as startShare } from "./share-w5oRbvlj.js";
13
+ import "./senderAncestry-CVHeKk1Y.js";
14
+ import { l as startShare } from "./share-CbFetL5H.js";
14
15
 
15
16
  //#region ts/agentShare.ts
16
17
  const MAX_SHARES = 8;
@@ -233,4 +234,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
233
234
 
234
235
  //#endregion
235
236
  export { createScopedShare, listShares, revokeAllShares, revokeShare };
236
- //# sourceMappingURL=agentShare-DgCGfLUl.js.map
237
+ //# sourceMappingURL=agentShare-BoUJNXqm.js.map
@@ -3,7 +3,7 @@ import "./JsonlStore-BpYZZTap.js";
3
3
  import "./globalPidIndex-CRB5KtyL.js";
4
4
  import { r as openStore } from "./todoStore-C9RTz0Vs.js";
5
5
  import { t as formatIdentity } from "./identity-Bk-aG_xl.js";
6
- import { a as resolveTodoRoot, i as resolveSelf } from "./todoIdentity-BvXZKWJI.js";
6
+ import { a as resolveTodoRoot, i as resolveSelf } from "./todoIdentity-B3VCO-jT.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-BU3CNCLU.js.map
272
+ //# sourceMappingURL=askCli-BIKef8Uz.js.map
@@ -6,11 +6,12 @@ import "./messageLog-Dq_ka-Bt.js";
6
6
  import "./e2e-BdLf8DvY.js";
7
7
  import "./configShared-De4bR5hH.js";
8
8
  import "./webrtcLink-va_gAR77.js";
9
- import "./remotes-DevcBeLl.js";
10
- import "./roomReplyAlias-DFqg_6IU.js";
11
- import "./subcommands-DPchg3Wm.js";
9
+ import "./remotes-B2i_QcdG.js";
10
+ import "./roomReplyAlias-9jb1qmh3.js";
11
+ import "./subcommands-CzNl9RwB.js";
12
12
  import "./notifyStore-DIfkfKB2.js";
13
- import "./callbackCore-BesbQ6-Z.js";
14
- import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-CyqlBiDx.js";
13
+ import "./senderAncestry-CVHeKk1Y.js";
14
+ import "./callbackCore-Deve5pv3.js";
15
+ import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-KSfCHgvN.js";
15
16
 
16
17
  export { cmdCallback };
@@ -1,6 +1,6 @@
1
1
  import { t as agentYesHome } from "./agentYesHome-JmJC28YX.js";
2
- import { rt as resolveOne } from "./subcommands-DPchg3Wm.js";
3
- import { a as mintCapability, o as parseExpires } from "./callbackCore-BesbQ6-Z.js";
2
+ import { rt as resolveOne } from "./subcommands-CzNl9RwB.js";
3
+ import { a as mintCapability, o as parseExpires } from "./callbackCore-Deve5pv3.js";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { chmodSync, readFileSync, renameSync, writeFileSync } from "node:fs";
6
6
  import path from "node:path";
@@ -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-BQ4xpV6z.js");
75
+ const { resolveLocalServeUrl } = await import("./serve-Dj_XGSwX.js");
76
76
  const url = await resolveLocalServeUrl();
77
77
  if (url) return url;
78
78
  } catch {}
@@ -170,7 +170,7 @@ async function cmdCallback(rest) {
170
170
  createdAt: Date.now()
171
171
  };
172
172
  saveStore(all);
173
- const { buildSnippet } = await import("./callbackCore-DSJWhqAe.js");
173
+ const { buildSnippet } = await import("./callbackCore-BZ_10zyc.js");
174
174
  w(`callback ${id} → ${record.cli} #${record.pid} @ ${record.cwd}`);
175
175
  w(`expires: ${new Date(exp).toISOString()} (${expiresSpec})`);
176
176
  w(`endpoint: ${base.replace(/\/+$/, "")}/cb/${cap}`);
@@ -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-CyqlBiDx.js.map
190
+ //# sourceMappingURL=callback-KSfCHgvN.js.map
@@ -1,3 +1,3 @@
1
- import { a as mintCapability, i as frameVisitorMessage, n as MAX_EXPIRES_MS, o as parseExpires, r as buildSnippet, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-BesbQ6-Z.js";
1
+ import { a as mintCapability, i as frameVisitorMessage, n as MAX_EXPIRES_MS, o as parseExpires, r as buildSnippet, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-Deve5pv3.js";
2
2
 
3
3
  export { buildSnippet };
@@ -140,4 +140,4 @@ function buildSnippet(opts) {
140
140
 
141
141
  //#endregion
142
142
  export { mintCapability as a, frameVisitorMessage as i, MAX_EXPIRES_MS as n, parseExpires as o, buildSnippet as r, verifyCapability as s, MAX_CALLBACK_MSG_BYTES as t };
143
- //# sourceMappingURL=callbackCore-BesbQ6-Z.js.map
143
+ //# sourceMappingURL=callbackCore-Deve5pv3.js.map
@@ -387,7 +387,7 @@ function printOp(op) {
387
387
  */
388
388
  async function runMesh(cwd, entry, opts) {
389
389
  const { ChannelPeer } = await import("./peer-3F7owPWt.js");
390
- const { importRTC, getIceServers } = await import("./share-DrS3LYqf.js");
390
+ const { importRTC, getIceServers } = await import("./share-_TPYAGWC.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-j5nWuzlQ.js.map
570
+ //# sourceMappingURL=channels-Y36S0ccW.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-BI9VEIMH.js";
5
- import { m as getRustBinary } from "./rustBinary-BFknuxsF.js";
4
+ import { a as versionString, r as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-62GqCQuL.js";
5
+ import { m as getRustBinary } from "./rustBinary-BDcUKywU.js";
6
6
  import { argv } from "process";
7
7
  import { spawn } from "child_process";
8
8
  import ms from "ms";
@@ -300,7 +300,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
300
300
  const rawArg = process.argv[2];
301
301
  const managerCommands = !invokedCliName(process.argv);
302
302
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
303
- const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-CmKPaejC.js");
303
+ const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-FaMjO2K3.js");
304
304
  if (isHelpFlag && process.argv.length === 3) {
305
305
  await cmdHelp(managerCommands);
306
306
  process.exit(0);
@@ -314,7 +314,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
314
314
  process.exit(code ?? 0);
315
315
  }
316
316
  {
317
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-B7JRHaXA.js");
317
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-BFep5hb5.js");
318
318
  if (isUnknownManagerToken(rawArg, managerCommands, SUPPORTED_CLIS)) {
319
319
  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`);
320
320
  process.exit(1);
@@ -322,7 +322,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
322
322
  }
323
323
  }
324
324
  {
325
- const { detectCwdPassthrough, SUPPRESS_CWD_WARN_ENV } = await import("./cwdPassthroughHint-BUbWMoz0.js");
325
+ const { detectCwdPassthrough, SUPPRESS_CWD_WARN_ENV } = await import("./cwdPassthroughHint-CzWh0hrw.js");
326
326
  const dep = detectCwdPassthrough(process.argv);
327
327
  if (dep) {
328
328
  console.warn(dep.message);
@@ -333,7 +333,7 @@ await checkAndAutoUpdate();
333
333
  logger.info(versionString());
334
334
  const config = parseCliArgs(process.argv);
335
335
  {
336
- const { stripDetachFlag } = await import("./forkNested-B3BE0ojL.js");
336
+ const { stripDetachFlag } = await import("./forkNested-Bk0aDizk.js");
337
337
  const res = stripDetachFlag(process.argv.slice(2), Boolean(config.detach));
338
338
  if (!res.ok) {
339
339
  console.error(res.error);
@@ -350,16 +350,16 @@ if (config.detach && !config.useRust) {
350
350
  process.exit(1);
351
351
  }
352
352
  if (config.tray) {
353
- const { startTray } = await import("./tray-BeRSozJz.js");
353
+ const { startTray } = await import("./tray-BZ8qvzgM.js");
354
354
  await startTray();
355
355
  await new Promise(() => {});
356
356
  }
357
357
  {
358
- const { ensureTray } = await import("./tray-BeRSozJz.js");
358
+ const { ensureTray } = await import("./tray-BZ8qvzgM.js");
359
359
  ensureTray();
360
360
  }
361
361
  if (!config.showVersion && !config.appendPrompt && !config.tray) {
362
- const { waitForSpawnCapacity } = await import("./spawnGate-DeQBTX-o.js");
362
+ const { waitForSpawnCapacity } = await import("./spawnGate-CYzzHDcZ.js");
363
363
  await waitForSpawnCapacity({
364
364
  onWait: (reason, waitedMs) => {
365
365
  if (config.verbose || waitedMs === 0) console.error(`[agent-yes] spawn gate: ${reason} — waiting…`);
@@ -368,7 +368,7 @@ if (!config.showVersion && !config.appendPrompt && !config.tray) {
368
368
  });
369
369
  }
370
370
  if (!config.showVersion && !config.appendPrompt && !config.tray) {
371
- const { warnIfCwdOccupied } = await import("./cwdConflictWarn-skQSMwEh.js");
371
+ const { warnIfCwdOccupied } = await import("./cwdConflictWarn-DMjcRrlV.js");
372
372
  await warnIfCwdOccupied(process.argv);
373
373
  }
374
374
  if (config.useRust) {
@@ -386,14 +386,14 @@ if (config.useRust) {
386
386
  process.exit(1);
387
387
  }
388
388
  if (rustBinary) {
389
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-B7JRHaXA.js");
389
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-BFep5hb5.js");
390
390
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
391
391
  if (config.verbose) {
392
392
  console.log(`[rust] Using binary: ${rustBinary}`);
393
393
  console.log(`[rust] Args: ${rustArgs.join(" ")}`);
394
394
  }
395
395
  const attach = config.attach || process.env.AGENT_YES_ATTACH === "1";
396
- const { shouldForkNested, buildSpawnTutorial, waitForRegistration, confirmAgentStarted, predictedLogPath } = await import("./forkNested-B3BE0ojL.js");
396
+ const { shouldForkNested, buildSpawnTutorial, waitForRegistration, confirmAgentStarted, predictedLogPath } = await import("./forkNested-Bk0aDizk.js");
397
397
  if (shouldForkNested({
398
398
  isTTY: Boolean(process.stdout.isTTY),
399
399
  ayPid: process.env.AGENT_YES_PID,
@@ -42,4 +42,4 @@ async function cmdDsh(rest, spawn = defaultSpawn) {
42
42
 
43
43
  //#endregion
44
44
  export { cmdDsh };
45
- //# sourceMappingURL=cmdDsh-2LP0grim.js.map
45
+ //# sourceMappingURL=cmdDsh-DZ8bLsH7.js.map
@@ -0,0 +1,116 @@
1
+ import { o as pidOwnershipVerdict } from "./senderAncestry-CVHeKk1Y.js";
2
+ import yargs from "yargs";
3
+
4
+ //#region ts/cmdKill.ts
5
+ /**
6
+ * Why a kill of `record` must not go ahead, or null. Pure, so each refusal is
7
+ * unit-tested. `selfChain` is the caller and its ancestors; `selfPgid` the
8
+ * caller's process group (null when unknown).
9
+ */
10
+ function killRefusal(record, targets, selfChain, selfPgid) {
11
+ for (const [pid, what] of [[record.pid, "pid"], [record.wrapper_pid, "wrapper pid"]]) if (pid && selfChain.includes(pid)) return `${what} ${pid} is this shell or one of its ancestors — killing it would kill the caller too. To end your own agent, use: ay exit ${record.pid}`;
12
+ if (targets.pgid && selfPgid && targets.pgid === selfPgid) return `process group ${targets.pgid} is the caller's own group — refusing to kill it`;
13
+ return null;
14
+ }
15
+ /** The record's wrapper pid if it now belongs to a process younger than the
16
+ * registration (reused), else null. Same age test as `ay restart`. */
17
+ function reusedWrapperPid(record, table, now = Date.now()) {
18
+ const w = record.wrapper_pid;
19
+ if (!w || w === record.pid) return null;
20
+ return pidOwnershipVerdict(table.get(w)?.ageSecs, record.started_at, now) === "reused" ? w : null;
21
+ }
22
+ async function ownPgid() {
23
+ try {
24
+ const { execFileSync } = await import("node:child_process");
25
+ const out = execFileSync("ps", [
26
+ "-o",
27
+ "pgid=",
28
+ "-p",
29
+ String(process.pid)
30
+ ], {
31
+ encoding: "utf8",
32
+ timeout: 5e3
33
+ });
34
+ const n = Number(out.trim());
35
+ return Number.isInteger(n) && n > 1 ? n : null;
36
+ } catch {
37
+ return null;
38
+ }
39
+ }
40
+ async function cmdKill(rest) {
41
+ const argv = await yargs(rest).usage("usage: ay kill <pid> [--dry-run] (the exact pid shown by ay ls)").option("dry-run", {
42
+ alias: "n",
43
+ type: "boolean",
44
+ default: false,
45
+ description: "Print what would be killed, send nothing"
46
+ }).strictOptions().parserConfiguration({ "parse-positional-numbers": false }).help(false).version(false).exitProcess(false).parseAsync();
47
+ const sel = argv._.length === 1 ? String(argv._[0]) : "";
48
+ if (!/^[1-9]\d*$/.test(sel)) {
49
+ process.stderr.write(`ay kill: expected exactly one pid as printed by \`ay ls\`${sel ? ` (got '${sel}')` : ""}.\n No keyword, agent-id or remote matching — for a graceful stop use: ay stop <keyword>\n`);
50
+ return 1;
51
+ }
52
+ if (process.platform === "win32") {
53
+ process.stderr.write(`ay kill: not supported on Windows (as with the console's Kill)\n`);
54
+ return 1;
55
+ }
56
+ const pid = Number(sel);
57
+ const { readGlobalPids, updateGlobalPidStatus } = await import("./globalPidIndex-Q6NdU1NM.js");
58
+ const matches = (await readGlobalPids()).filter((r) => r.pid === pid);
59
+ if (matches.length !== 1) {
60
+ process.stderr.write(matches.length === 0 ? `ay kill: no registered agent has pid ${pid} (see: ay ls --all)\n` : `ay kill: ${matches.length} registry rows claim pid ${pid} — refusing an ambiguous kill\n`);
61
+ return 1;
62
+ }
63
+ const record = matches[0];
64
+ if (record.status === "exited") {
65
+ process.stderr.write(`ay kill: pid ${pid} is registered as exited — refusing: the number may belong to another process by now\n`);
66
+ return 1;
67
+ }
68
+ const { ancestorPids, pidOwnershipVerdict, readAncestryTable } = await import("./senderAncestry-KhAUPCQs.js");
69
+ const table = await readAncestryTable();
70
+ const selfPgid = await ownPgid();
71
+ if (!table || !selfPgid) {
72
+ process.stderr.write(`ay kill: could not read the process table (ps) — refusing, since it is unknown whether pid ${pid} is still this agent or an ancestor of this shell\n`);
73
+ return 1;
74
+ }
75
+ if (pidOwnershipVerdict(table.get(pid)?.ageSecs, record.started_at) === "reused") {
76
+ process.stderr.write(`ay kill: pid ${pid} is alive but is NOT the agent that registered it (the number was reused) — refusing. Retire the stale row with: ay stop ${pid}\n`);
77
+ return 1;
78
+ }
79
+ const { forceKill, forceKillTargets } = await import("./forceKill-BDqxx4uQ.js");
80
+ const targets = await forceKillTargets(record);
81
+ const reusedWrapper = reusedWrapperPid(record, table);
82
+ if (reusedWrapper) {
83
+ targets.pids = targets.pids.filter((p) => p !== reusedWrapper);
84
+ process.stderr.write(`ay kill: warning: wrapper pid ${reusedWrapper} was reused — not signalling it\n`);
85
+ }
86
+ const refusal = killRefusal(record, targets, [
87
+ process.pid,
88
+ process.ppid,
89
+ ...await ancestorPids(process.pid, { readTable: async () => table })
90
+ ], selfPgid);
91
+ if (refusal) {
92
+ process.stderr.write(`ay kill: ${refusal}\n`);
93
+ return 1;
94
+ }
95
+ const what = `pid ${pid} (${record.cli}, ${record.cwd})`;
96
+ if (argv["dry-run"]) {
97
+ const list = [...targets.pgid ? [`group ${targets.pgid}`] : [], ...targets.pids];
98
+ process.stdout.write(`would SIGKILL ${list.join(", ")} — ${what}\n`);
99
+ return 0;
100
+ }
101
+ const { killed, failed } = forceKill(targets);
102
+ if (failed.length) {
103
+ process.stderr.write(`ay kill: could not signal ${failed.join(", ")} — ${what} not marked exited\n`);
104
+ return 1;
105
+ }
106
+ await updateGlobalPidStatus(pid, {
107
+ status: "exited",
108
+ exit_reason: "force-killed via ay kill"
109
+ }).catch(() => {});
110
+ process.stdout.write(`killed ${what}: ${killed.join(", ") || "nothing left to signal (already gone)"}\n`);
111
+ return 0;
112
+ }
113
+
114
+ //#endregion
115
+ export { cmdKill };
116
+ //# sourceMappingURL=cmdKill-1irEzKl9.js.map
@@ -6,11 +6,12 @@ import "./messageLog-Dq_ka-Bt.js";
6
6
  import "./e2e-BdLf8DvY.js";
7
7
  import "./configShared-De4bR5hH.js";
8
8
  import "./webrtcLink-va_gAR77.js";
9
- import "./remotes-DevcBeLl.js";
10
- import "./roomReplyAlias-DFqg_6IU.js";
11
- import { H as listRecords, St as flattenForest, v as deriveLiveState, xt as buildAgentForest } from "./subcommands-DPchg3Wm.js";
9
+ import "./remotes-B2i_QcdG.js";
10
+ import "./roomReplyAlias-9jb1qmh3.js";
11
+ import { H as listRecords, St as flattenForest, v as deriveLiveState, xt as buildAgentForest } from "./subcommands-CzNl9RwB.js";
12
12
  import "./notifyStore-DIfkfKB2.js";
13
- import { i as systemStats, n as sampleTrees, r as snapshotProcs, t as humanBytes } from "./procStats-BvmrBrOs.js";
13
+ import "./senderAncestry-CVHeKk1Y.js";
14
+ import { i as systemStats, n as sampleTrees, r as snapshotProcs, t as humanBytes } from "./procStats-DwTxj3rs.js";
14
15
  import yargs from "yargs";
15
16
  import { readFileSync } from "node:fs";
16
17
  import path from "node:path";
@@ -331,4 +332,4 @@ function readPpidSync(pid) {
331
332
 
332
333
  //#endregion
333
334
  export { cmdPs };
334
- //# sourceMappingURL=cmdPs-DfyTa7E0.js.map
335
+ //# sourceMappingURL=cmdPs-BMBjSdpr.js.map
@@ -61,4 +61,4 @@ async function warnIfCwdOccupied(rawArgv) {
61
61
 
62
62
  //#endregion
63
63
  export { warnIfCwdOccupied };
64
- //# sourceMappingURL=cwdConflictWarn-skQSMwEh.js.map
64
+ //# sourceMappingURL=cwdConflictWarn-DMjcRrlV.js.map
@@ -85,4 +85,4 @@ function detectCwdPassthrough(argv) {
85
85
 
86
86
  //#endregion
87
87
  export { SUPPRESS_CWD_WARN_ENV, detectCwdPassthrough };
88
- //# sourceMappingURL=cwdPassthroughHint-BUbWMoz0.js.map
88
+ //# sourceMappingURL=cwdPassthroughHint-CzWh0hrw.js.map
@@ -549,4 +549,4 @@ async function cmdExpose(args) {
549
549
 
550
550
  //#endregion
551
551
  export { cmdExpose, ensureExposure, listExposures, stopExposure };
552
- //# sourceMappingURL=expose-Dawq1LxC.js.map
552
+ //# sourceMappingURL=expose-BqaH-tsw.js.map
@@ -0,0 +1,44 @@
1
+ import { t as pgidForWrapper } from "./reaper-C2cuougX.js";
2
+
3
+ //#region ts/forceKill.ts
4
+ /** What forceKill would signal, without signalling it. */
5
+ async function forceKillTargets(record) {
6
+ const g = await pgidForWrapper(record.wrapper_pid ?? 0);
7
+ const pids = [record.pid];
8
+ if (record.wrapper_pid && record.wrapper_pid !== record.pid) pids.push(record.wrapper_pid);
9
+ return {
10
+ pgid: g && g > 1 ? g : null,
11
+ pids: pids.filter((p) => p > 1)
12
+ };
13
+ }
14
+ /**
15
+ * SIGKILL the targets. Returns labels of what was signalled, and of what could
16
+ * NOT be signalled for a reason other than "already gone" (ESRCH) — e.g. EPERM,
17
+ * a process owned by another user.
18
+ */
19
+ function forceKill(targets) {
20
+ const killed = [];
21
+ const failed = [];
22
+ const sig = (target, label) => {
23
+ try {
24
+ process.kill(target, "SIGKILL");
25
+ killed.push(label);
26
+ } catch (e) {
27
+ const code = e.code;
28
+ if (code !== "ESRCH") failed.push(`${label} (${code ?? "error"})`);
29
+ }
30
+ };
31
+ if (targets.pgid && targets.pgid > 1) sig(-targets.pgid, `group ${targets.pgid}`);
32
+ for (const pid of targets.pids) {
33
+ if (pid <= 1) continue;
34
+ sig(pid, pid === targets.pids[0] ? `pid ${pid}` : `wrapper ${pid}`);
35
+ }
36
+ return {
37
+ killed,
38
+ failed
39
+ };
40
+ }
41
+
42
+ //#endregion
43
+ export { forceKill, forceKillTargets };
44
+ //# sourceMappingURL=forceKill-BDqxx4uQ.js.map
@@ -102,7 +102,7 @@ function buildSpawnTutorial(cli, pid) {
102
102
  * fast instead of waiting out the whole window).
103
103
  */
104
104
  async function waitForRegistration(pid, timeoutMs = 5e3, aborted) {
105
- const { readGlobalPids } = await import("./globalPidIndex-BftWlg2V.js");
105
+ const { readGlobalPids } = await import("./globalPidIndex-Q6NdU1NM.js");
106
106
  const isRegistered = async () => (await readGlobalPids()).some((r) => r.pid === pid && r.status !== "exited");
107
107
  const deadline = Date.now() + timeoutMs;
108
108
  while (Date.now() < deadline) {
@@ -150,7 +150,7 @@ async function tailFile(file, max = 400) {
150
150
  * success, keeping the previous behaviour for anything this can't decide.
151
151
  */
152
152
  async function confirmAgentStarted(pid, graceMs = 1500, aborted) {
153
- const { readGlobalPids } = await import("./globalPidIndex-BftWlg2V.js");
153
+ const { readGlobalPids } = await import("./globalPidIndex-Q6NdU1NM.js");
154
154
  const { stat } = await import("fs/promises");
155
155
  const deadline = Date.now() + graceMs;
156
156
  while (Date.now() < deadline) {
@@ -181,4 +181,4 @@ async function confirmAgentStarted(pid, graceMs = 1500, aborted) {
181
181
 
182
182
  //#endregion
183
183
  export { buildSpawnTutorial, confirmAgentStarted, predictedLogPath, shouldForkNested, stripDetachFlag, waitForRegistration };
184
- //# sourceMappingURL=forkNested-B3BE0ojL.js.map
184
+ //# sourceMappingURL=forkNested-Bk0aDizk.js.map
@@ -1,4 +1,4 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
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-CRB5KtyL.js";
3
3
 
4
- export { gcLogs, readGlobalPids };
4
+ export { gcLogs, readGlobalPids, updateGlobalPidStatus };
@@ -439,4 +439,4 @@ async function cmdHist(rest) {
439
439
 
440
440
  //#endregion
441
441
  export { cmdHist };
442
- //# sourceMappingURL=hist-Cs0KFSUW.js.map
442
+ //# sourceMappingURL=hist-DY16wm7g.js.map
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-BI9VEIMH.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-Bl-WlOAr.js";
2
+ import "./versionChecker-62GqCQuL.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-CRFAyvVD.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-TTp_Qz9G.js";
5
5
  import "./JsonlStore-BpYZZTap.js";
6
6
  import "./globalPidIndex-CRB5KtyL.js";
@@ -86,4 +86,4 @@ function buildInitMsg(prompt, spawner, nonce, identity) {
86
86
 
87
87
  //#endregion
88
88
  export { replyTargetOf as n, shortenHome as r, buildInitMsg as t };
89
- //# sourceMappingURL=initMsg-CcTqFtsp.js.map
89
+ //# sourceMappingURL=initMsg-BEVDWYnv.js.map
@@ -1,3 +1,3 @@
1
- import { n as replyTargetOf, r as shortenHome, t as buildInitMsg } from "./initMsg-CcTqFtsp.js";
1
+ import { n as replyTargetOf, r as shortenHome, t as buildInitMsg } from "./initMsg-BEVDWYnv.js";
2
2
 
3
3
  export { buildInitMsg };
@@ -53,4 +53,4 @@ async function ensureNodeRuntime(which = Bun.which) {
53
53
 
54
54
  //#endregion
55
55
  export { liveEnv as n, ensureNodeRuntime as t };
56
- //# sourceMappingURL=nodeRuntime-DGMQRTGT.js.map
56
+ //# sourceMappingURL=nodeRuntime-B1nCglgu.js.map
@@ -6,10 +6,11 @@ import "./messageLog-Dq_ka-Bt.js";
6
6
  import "./e2e-BdLf8DvY.js";
7
7
  import "./configShared-De4bR5hH.js";
8
8
  import "./webrtcLink-va_gAR77.js";
9
- import "./remotes-DevcBeLl.js";
10
- import "./roomReplyAlias-DFqg_6IU.js";
11
- import { H as listRecords, P as isPidAlive, et as renderLogTailLines, v as deriveLiveState } from "./subcommands-DPchg3Wm.js";
9
+ import "./remotes-B2i_QcdG.js";
10
+ import "./roomReplyAlias-9jb1qmh3.js";
11
+ import { H as listRecords, P as isPidAlive, et as renderLogTailLines, v as deriveLiveState } from "./subcommands-CzNl9RwB.js";
12
12
  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-DIfkfKB2.js";
13
+ import "./senderAncestry-CVHeKk1Y.js";
13
14
  import { mkdir, readFile, rename, rm, stat, writeFile } from "fs/promises";
14
15
  import { randomUUID } from "node:crypto";
15
16
  import { execFile, execFileSync } from "node:child_process";
@@ -880,4 +881,4 @@ async function ensureDaemon() {
880
881
 
881
882
  //#endregion
882
883
  export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
883
- //# sourceMappingURL=notifyDaemon-B0zqm-eL.js.map
884
+ //# sourceMappingURL=notifyDaemon-D-0GQrD5.js.map
@@ -68,4 +68,4 @@ async function offerOpenInBrowser(url, prompt = "Open in browser now? [Y/n] ") {
68
68
 
69
69
  //#endregion
70
70
  export { offerOpenInBrowser };
71
- //# sourceMappingURL=openBrowser-1cIo4dJL.js.map
71
+ //# sourceMappingURL=openBrowser-CQAOIrD6.js.map
@@ -1,5 +1,5 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CRB5KtyL.js";
3
- import { n as spawnerFromRecords, t as resolveSpawner } from "./parentLink-DoEWVGld.js";
3
+ import { n as spawnerFromRecords, t as resolveSpawner } from "./parentLink-COFYy_0K.js";
4
4
 
5
5
  export { resolveSpawner };
@@ -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-DoEWVGld.js.map
53
+ //# sourceMappingURL=parentLink-COFYy_0K.js.map
@@ -1,8 +1,8 @@
1
1
  import { n as logger } from "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CRB5KtyL.js";
3
3
  import { t as classifyNeedsInput } from "./needsInput-hRiWFjGy.js";
4
- import { n as replyTargetOf, r as shortenHome } from "./initMsg-CcTqFtsp.js";
5
- import { t as resolveSpawner } from "./parentLink-DoEWVGld.js";
4
+ import { n as replyTargetOf, r as shortenHome } from "./initMsg-BEVDWYnv.js";
5
+ import { t as resolveSpawner } from "./parentLink-COFYy_0K.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-CmKPaejC.js");
341
+ const { lastReadAt, READ_WINDOW_MS } = await import("./subcommands-FaMjO2K3.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-y_ZCVMrB.js.map
469
+ //# sourceMappingURL=parentPingLoop-DP1MoW_7.js.map
@@ -360,4 +360,4 @@ function humanBytes(bytes) {
360
360
 
361
361
  //#endregion
362
362
  export { systemStats as i, sampleTrees as n, snapshotProcs as r, humanBytes as t };
363
- //# sourceMappingURL=procStats-BvmrBrOs.js.map
363
+ //# sourceMappingURL=procStats-DwTxj3rs.js.map
@@ -136,7 +136,7 @@ async function resolveRemoteSpec(spec) {
136
136
  * The bridge lives for the rest of the process (torn down on `process.exit`).
137
137
  */
138
138
  async function resolveWebrtc(link, keyword, label) {
139
- const { startWebrtcBridge } = await import("./webrtcRemote-BlGyNZDC.js");
139
+ const { startWebrtcBridge } = await import("./webrtcRemote-DRF6N3FQ.js");
140
140
  const bridge = await startWebrtcBridge(link, { keyword });
141
141
  return {
142
142
  url: bridge.baseUrl,
@@ -322,4 +322,4 @@ async function cmdConnect(rest) {
322
322
 
323
323
  //#endregion
324
324
  export { deleteRemoteAlias as a, parseShareUrl as c, writeRemoteAlias as d, defaultConnectAlias as i, readRemotes as l, cmdConnect as n, maskRemoteUrl as o, cmdRemote as r, parseDirectRemoteSpec as s, MASK as t, resolveRemoteSpec as u };
325
- //# sourceMappingURL=remotes-DevcBeLl.js.map
325
+ //# sourceMappingURL=remotes-B2i_QcdG.js.map
@@ -1,5 +1,5 @@
1
1
  import "./e2e-BdLf8DvY.js";
2
2
  import "./webrtcLink-va_gAR77.js";
3
- import { a as deleteRemoteAlias, c as parseShareUrl, d as writeRemoteAlias, i as defaultConnectAlias, l as readRemotes, n as cmdConnect, o as maskRemoteUrl, r as cmdRemote, s as parseDirectRemoteSpec, t as MASK, u as resolveRemoteSpec } from "./remotes-DevcBeLl.js";
3
+ import { a as deleteRemoteAlias, c as parseShareUrl, d as writeRemoteAlias, i as defaultConnectAlias, l as readRemotes, n as cmdConnect, o as maskRemoteUrl, r as cmdRemote, s as parseDirectRemoteSpec, t as MASK, u as resolveRemoteSpec } from "./remotes-B2i_QcdG.js";
4
4
 
5
5
  export { cmdConnect, cmdRemote };