agent-yes 1.223.0 → 1.223.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.
@@ -0,0 +1,9 @@
1
+ import "./ts-bE-SKMWi.js";
2
+ import "./logger-CDIsZ-Pp.js";
3
+ import "./versionChecker-EEzUODBd.js";
4
+ import "./pidStore-BIvsBQ8X.js";
5
+ import "./globalPidIndex-CoNr7tS8.js";
6
+ import "./messageLog-CxrKJj77.js";
7
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-CY6Qo_bF.js";
8
+
9
+ export { SUPPORTED_CLIS };
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-74aVYJYj.js";
1
+ import { t as CLIS_CONFIG } from "./ts-bE-SKMWi.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-91SHco8n.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-CY6Qo_bF.js.map
@@ -2,7 +2,7 @@ import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
3
  import "./messageLog-CxrKJj77.js";
4
4
  import "./configShared-aKTg-sa5.js";
5
- import { M as resolveOne } from "./subcommands-D2llN6dR.js";
5
+ import { M as resolveOne } from "./subcommands-Dl2Kx1FC.js";
6
6
  import "./e2e-jb0Hp43q.js";
7
7
  import "./webrtcLink-B7REGtK2.js";
8
8
  import "./remotes-CZGDxzIP.js";
@@ -229,4 +229,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
229
229
 
230
230
  //#endregion
231
231
  export { createScopedShare, listShares, revokeAllShares, revokeShare };
232
- //# sourceMappingURL=agentShare-CXksKQvX.js.map
232
+ //# sourceMappingURL=agentShare-CRJb4GhE.js.map
@@ -2,11 +2,11 @@ import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
3
  import "./messageLog-CxrKJj77.js";
4
4
  import "./configShared-aKTg-sa5.js";
5
- import "./subcommands-D2llN6dR.js";
5
+ import "./subcommands-Dl2Kx1FC.js";
6
6
  import "./e2e-jb0Hp43q.js";
7
7
  import "./webrtcLink-B7REGtK2.js";
8
8
  import "./remotes-CZGDxzIP.js";
9
9
  import "./callbackCore-Cm_yYhep.js";
10
- import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-C1ICxY94.js";
10
+ import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-DZhSN9-O.js";
11
11
 
12
12
  export { cmdCallback };
@@ -1,5 +1,5 @@
1
1
  import { t as agentYesHome } from "./agentYesHome-CtHb5b71.js";
2
- import { M as resolveOne } from "./subcommands-D2llN6dR.js";
2
+ import { M as resolveOne } from "./subcommands-Dl2Kx1FC.js";
3
3
  import { a as mintCapability, o as parseExpires } from "./callbackCore-Cm_yYhep.js";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { mkdir, readFile, writeFile } from "node:fs/promises";
@@ -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-D1GP9e62.js");
75
+ const { resolveLocalServeUrl } = await import("./serve-v5fUhHiR.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-C1ICxY94.js.map
190
+ //# sourceMappingURL=callback-DZhSN9-O.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-uqM2YYA7.js";
3
3
  import { n as logger } from "./logger-CDIsZ-Pp.js";
4
- import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-QP6QKiG-.js";
5
- import { n as getRustBinary } from "./rustBinary-CODJm5nX.js";
4
+ import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-EEzUODBd.js";
5
+ import { n as getRustBinary } from "./rustBinary-CUJuJD2N.js";
6
6
  import { argv } from "process";
7
7
  import { spawn } from "child_process";
8
8
  import ms from "ms";
@@ -285,7 +285,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
285
285
  const rawArg = process.argv[2];
286
286
  const managerCommands = !invokedCliName(process.argv);
287
287
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
288
- const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-CvmstmY_.js");
288
+ const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-ZqHQMFDJ.js");
289
289
  if (isHelpFlag && process.argv.length === 3) {
290
290
  await cmdHelp(managerCommands);
291
291
  process.exit(0);
@@ -327,7 +327,7 @@ if (config.useRust) {
327
327
  }
328
328
  }
329
329
  if (rustBinary) {
330
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-6VyrMWG_.js");
330
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-CE3JLqnP.js");
331
331
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
332
332
  if (config.verbose) {
333
333
  console.log(`[rust] Using binary: ${rustBinary}`);
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-74aVYJYj.js";
1
+ import { i as AgentContext, n as agentYes, o as removeControlCharacters, r as config, t as CLIS_CONFIG } from "./ts-bE-SKMWi.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-QP6QKiG-.js";
3
+ import "./versionChecker-EEzUODBd.js";
4
4
  import "./pidStore-BIvsBQ8X.js";
5
5
  import "./globalPidIndex-CoNr7tS8.js";
6
6
  import "./messageLog-CxrKJj77.js";
@@ -2,7 +2,7 @@ import { n as logger } from "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
3
  import "./messageLog-CxrKJj77.js";
4
4
  import "./configShared-aKTg-sa5.js";
5
- import { $ as daemonLockOwnerPath, G as gcInboxes, J as listInboxParents, K as hostId, Q as daemonLockDir, S as listRecords, W as appendEvent, X as readInbox, Y as liveWatchers, Z as shouldStealLock, _ as isPidAlive, c as deriveLiveState, et as notifyDir, k as renderLogTailLines } from "./subcommands-D2llN6dR.js";
5
+ import { $ as daemonLockOwnerPath, G as gcInboxes, J as listInboxParents, K as hostId, Q as daemonLockDir, S as listRecords, W as appendEvent, X as readInbox, Y as liveWatchers, Z as shouldStealLock, _ as isPidAlive, c as deriveLiveState, et as notifyDir, k as renderLogTailLines } from "./subcommands-Dl2Kx1FC.js";
6
6
  import "./e2e-jb0Hp43q.js";
7
7
  import "./webrtcLink-B7REGtK2.js";
8
8
  import "./remotes-CZGDxzIP.js";
@@ -589,4 +589,4 @@ async function ensureDaemon() {
589
589
 
590
590
  //#endregion
591
591
  export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
592
- //# sourceMappingURL=notifyDaemon-C4Z9gxKe.js.map
592
+ //# sourceMappingURL=notifyDaemon-CjszDILI.js.map
@@ -1,4 +1,4 @@
1
- import { r as getInstalledPackage } from "./versionChecker-QP6QKiG-.js";
1
+ import { r as getInstalledPackage } from "./versionChecker-EEzUODBd.js";
2
2
  import { execFileSync } from "child_process";
3
3
  import { existsSync, mkdirSync, unlinkSync } from "fs";
4
4
  import { chmod, copyFile } from "fs/promises";
@@ -225,4 +225,4 @@ async function getRustBinary(options = {}) {
225
225
 
226
226
  //#endregion
227
227
  export { getRustBinary as n, findSpawnHiddenLauncher as t };
228
- //# sourceMappingURL=rustBinary-CODJm5nX.js.map
228
+ //# sourceMappingURL=rustBinary-CUJuJD2N.js.map
@@ -1,10 +1,10 @@
1
- import "./ts-74aVYJYj.js";
1
+ import "./ts-bE-SKMWi.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-QP6QKiG-.js";
3
+ import "./versionChecker-EEzUODBd.js";
4
4
  import "./pidStore-BIvsBQ8X.js";
5
5
  import "./globalPidIndex-CoNr7tS8.js";
6
6
  import "./messageLog-CxrKJj77.js";
7
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-91SHco8n.js";
7
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-CY6Qo_bF.js";
8
8
  import { d as resolveSpawnCwd } from "./workspaceConfig-Dcbe4y77.js";
9
9
  import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-DttG711L.js";
10
10
  import { createHash } from "node:crypto";
@@ -151,4 +151,4 @@ async function cmdSchedule(rest) {
151
151
 
152
152
  //#endregion
153
153
  export { cmdSchedule };
154
- //# sourceMappingURL=schedule-CmbUKK0u.js.map
154
+ //# sourceMappingURL=schedule-CKF_arnv.js.map
@@ -1,20 +1,20 @@
1
- import "./ts-74aVYJYj.js";
1
+ import { a as CLAUDE_SESSION_PIN_ENV } from "./ts-bE-SKMWi.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import { r as getInstalledPackage } from "./versionChecker-QP6QKiG-.js";
4
- import { t as findSpawnHiddenLauncher } from "./rustBinary-CODJm5nX.js";
3
+ import { r as getInstalledPackage } from "./versionChecker-EEzUODBd.js";
4
+ import { t as findSpawnHiddenLauncher } from "./rustBinary-CUJuJD2N.js";
5
5
  import { t as agentYesHome$1 } from "./agentYesHome-CtHb5b71.js";
6
6
  import "./pidStore-BIvsBQ8X.js";
7
7
  import { a as updateGlobalPidStatus } from "./globalPidIndex-CoNr7tS8.js";
8
8
  import { r as recordInbox } from "./messageLog-CxrKJj77.js";
9
9
  import { t as pgidForWrapper } from "./reaper-BUHCyxdF.js";
10
10
  import "./configShared-aKTg-sa5.js";
11
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-91SHco8n.js";
12
- import { A as renderRawLog, D as recentMessageEdges, E as readPtysize, L as snapshotStatus, M as resolveOne, O as recentReadEdges, S as listRecords, T as readNotes, U as writeToIpc, b as isUserTyping, f as extractNeedsInput, j as renderRawLogLines, k as renderLogTailLines, l as deriveLiveStatus, o as controlCodeFromName, p as extractTaskCounts, q as isTransientLockMkdirError, tt as TYPING_BADGE, u as extractBadges } from "./subcommands-D2llN6dR.js";
11
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-CY6Qo_bF.js";
12
+ import { A as renderRawLog, D as recentMessageEdges, E as readPtysize, L as snapshotStatus, M as resolveOne, O as recentReadEdges, S as listRecords, T as readNotes, U as writeToIpc, b as isUserTyping, f as extractNeedsInput, j as renderRawLogLines, k as renderLogTailLines, l as deriveLiveStatus, o as controlCodeFromName, p as extractTaskCounts, q as isTransientLockMkdirError, tt as TYPING_BADGE, u as extractBadges } from "./subcommands-Dl2Kx1FC.js";
13
13
  import "./e2e-jb0Hp43q.js";
14
14
  import "./webrtcLink-B7REGtK2.js";
15
15
  import "./remotes-CZGDxzIP.js";
16
16
  import { i as frameVisitorMessage, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-Cm_yYhep.js";
17
- import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-C1ICxY94.js";
17
+ import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-DZhSN9-O.js";
18
18
  import { a as getSpawnHook, c as hasProvisionHook, d as resolveSpawnCwd, i as getProvisionRoot, l as hasSpawnHook, r as getProvisionHook, u as isProvisionAllowed } from "./workspaceConfig-Dcbe4y77.js";
19
19
  import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-DttG711L.js";
20
20
  import { r as spawnRejectionReason } from "./spawnGate-SmqvtNIZ.js";
@@ -417,14 +417,7 @@ const defaultOpts = (overrides = {}) => ({
417
417
  cwdScope: null,
418
418
  ...overrides
419
419
  });
420
- const SESSION_PIN_ENV = new Set([
421
- "CLAUDECODE",
422
- "CLAUDE_CODE_SSE_PORT",
423
- "CLAUDE_CODE_SESSION_ID",
424
- "CLAUDE_CODE_CHILD_SESSION",
425
- "CLAUDE_CODE_ENTRYPOINT",
426
- "AGENT_YES_PID"
427
- ]);
420
+ const SESSION_PIN_ENV = new Set([...CLAUDE_SESSION_PIN_ENV, "AGENT_YES_PID"]);
428
421
  let loginShellEnvCache;
429
422
  function loginShellEnv() {
430
423
  if (loginShellEnvCache !== void 0) return loginShellEnvCache;
@@ -1997,7 +1990,7 @@ Options:
1997
1990
  }
1998
1991
  });
1999
1992
  if (req.method === "GET" && p === "/api/ws") {
2000
- const ws = await import("./ws-93eeiNKB.js");
1993
+ const ws = await import("./ws-qE_t5H8x.js");
2001
1994
  try {
2002
1995
  await ws.loadProvision();
2003
1996
  } catch (e) {
@@ -2017,7 +2010,7 @@ Options:
2017
2010
  if (req.method === "GET" && p === "/api/ws/status") {
2018
2011
  const dirRaw = url.searchParams.get("path");
2019
2012
  if (!dirRaw) return new Response("missing ?path=<workspace dir>", { status: 400 });
2020
- const ws = await import("./ws-93eeiNKB.js");
2013
+ const ws = await import("./ws-qE_t5H8x.js");
2021
2014
  let prov;
2022
2015
  try {
2023
2016
  prov = await ws.loadProvision();
@@ -2606,7 +2599,7 @@ Options:
2606
2599
  const perm = body.perm ?? "r";
2607
2600
  if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
2608
2601
  try {
2609
- const { createScopedShare } = await import("./agentShare-CXksKQvX.js");
2602
+ const { createScopedShare } = await import("./agentShare-CRJb4GhE.js");
2610
2603
  const share = await createScopedShare({
2611
2604
  agent: body.agent,
2612
2605
  perm,
@@ -2621,12 +2614,12 @@ Options:
2621
2614
  }
2622
2615
  }
2623
2616
  if (req.method === "GET" && p === "/api/shares") {
2624
- const { listShares } = await import("./agentShare-CXksKQvX.js");
2617
+ const { listShares } = await import("./agentShare-CRJb4GhE.js");
2625
2618
  return Response.json(listShares());
2626
2619
  }
2627
2620
  const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
2628
2621
  if (req.method === "DELETE" && revokeM) {
2629
- const { revokeShare } = await import("./agentShare-CXksKQvX.js");
2622
+ const { revokeShare } = await import("./agentShare-CRJb4GhE.js");
2630
2623
  const ok = revokeShare(decodeURIComponent(revokeM[1]));
2631
2624
  return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
2632
2625
  }
@@ -2928,7 +2921,7 @@ Options:
2928
2921
  const shutdown = (resolve) => {
2929
2922
  if (heartbeat) clearInterval(heartbeat);
2930
2923
  closeShare?.();
2931
- import("./agentShare-CXksKQvX.js").then((m) => m.revokeAllShares()).catch(() => {});
2924
+ import("./agentShare-CRJb4GhE.js").then((m) => m.revokeAllShares()).catch(() => {});
2932
2925
  server?.stop();
2933
2926
  Promise.resolve(releaseHostLock?.()).catch(() => {}).then(resolve);
2934
2927
  };
@@ -2941,4 +2934,4 @@ Options:
2941
2934
 
2942
2935
  //#endregion
2943
2936
  export { cmdServe, resolveLocalServeUrl };
2944
- //# sourceMappingURL=serve-D1GP9e62.js.map
2937
+ //# sourceMappingURL=serve-v5fUhHiR.js.map
@@ -32,7 +32,7 @@ async function cmdSetup(rest) {
32
32
  if (!existsSync(abs)) process.stderr.write(` note: that directory doesn't exist yet — create it, or agents spawned there will fail\n`);
33
33
  if (noShare) return 0;
34
34
  process.stdout.write(`\nsharing this machine to agent-yes.com…\n`);
35
- const { cmdServe } = await import("./serve-D1GP9e62.js");
35
+ const { cmdServe } = await import("./serve-v5fUhHiR.js");
36
36
  return cmdServe([
37
37
  "install",
38
38
  "--share",
@@ -42,4 +42,4 @@ async function cmdSetup(rest) {
42
42
 
43
43
  //#endregion
44
44
  export { cmdSetup };
45
- //# sourceMappingURL=setup-p9dIsEH2.js.map
45
+ //# sourceMappingURL=setup-DojqtiR5.js.map
@@ -1238,19 +1238,19 @@ async function runSubcommand(argv) {
1238
1238
  case "restart": return await cmdRestart(rest);
1239
1239
  case "note": return await cmdNote(rest);
1240
1240
  case "serve": {
1241
- const { cmdServe } = await import("./serve-D1GP9e62.js");
1241
+ const { cmdServe } = await import("./serve-v5fUhHiR.js");
1242
1242
  return cmdServe(rest);
1243
1243
  }
1244
1244
  case "setup": {
1245
- const { cmdSetup } = await import("./setup-p9dIsEH2.js");
1245
+ const { cmdSetup } = await import("./setup-DojqtiR5.js");
1246
1246
  return cmdSetup(rest);
1247
1247
  }
1248
1248
  case "ws": {
1249
- const { cmdWs } = await import("./ws-93eeiNKB.js");
1249
+ const { cmdWs } = await import("./ws-qE_t5H8x.js");
1250
1250
  return cmdWs(rest);
1251
1251
  }
1252
1252
  case "schedule": {
1253
- const { cmdSchedule } = await import("./schedule-CmbUKK0u.js");
1253
+ const { cmdSchedule } = await import("./schedule-CKF_arnv.js");
1254
1254
  return cmdSchedule(rest);
1255
1255
  }
1256
1256
  case "remote": {
@@ -1262,7 +1262,7 @@ async function runSubcommand(argv) {
1262
1262
  return cmdExpose(rest);
1263
1263
  }
1264
1264
  case "callback": {
1265
- const { cmdCallback } = await import("./callback-8taXMdxt.js");
1265
+ const { cmdCallback } = await import("./callback-CzFcLTZn.js");
1266
1266
  return cmdCallback(rest);
1267
1267
  }
1268
1268
  case "reap":
@@ -4274,7 +4274,7 @@ async function cmdNotify(rest) {
4274
4274
  }
4275
4275
  const ensure = async () => {
4276
4276
  if (!argv["ensure-daemon"]) return;
4277
- const { ensureDaemon } = await import("./notifyDaemon-C4Z9gxKe.js");
4277
+ const { ensureDaemon } = await import("./notifyDaemon-CjszDILI.js");
4278
4278
  await ensureDaemon().catch(() => null);
4279
4279
  };
4280
4280
  await heartbeatWatcher(parent, selfStartedAt);
@@ -4348,7 +4348,7 @@ async function cmdNotifyCursor(args) {
4348
4348
  }
4349
4349
  async function cmdNotifyd(rest) {
4350
4350
  const sub = rest[0] ?? "status";
4351
- const daemon = await import("./notifyDaemon-C4Z9gxKe.js");
4351
+ const daemon = await import("./notifyDaemon-CjszDILI.js");
4352
4352
  switch (sub) {
4353
4353
  case "run": return daemon.runDaemon();
4354
4354
  case "once": return daemon.runDaemon({ once: true });
@@ -4375,4 +4375,4 @@ async function cmdNotifyd(rest) {
4375
4375
 
4376
4376
  //#endregion
4377
4377
  export { daemonLockOwnerPath as $, renderRawLog as A, submitAndConfirm as B, matchKeyword as C, recentMessageEdges as D, readPtysize as E, restartHintLines as F, gcInboxes as G, writeKeysPaced as H, runSubcommand as I, listInboxParents as J, hostId as K, snapshotStatus as L, resolveOne as M, resolveReadWindow as N, recentReadEdges as O, resolveResumeArgs as P, daemonLockDir as Q, stdinActivityPath as R, listRecords as S, readNotes as T, writeToIpc as U, waitForLogQuiet as V, appendEvent as W, readInbox as X, liveWatchers as Y, shouldStealLock as Z, isPidAlive as _, cmdHelp as a, isUserTyping as b, deriveLiveState as c, extractMenu as d, notifyDir as et, extractNeedsInput as f, isExitRequest as g, isAgentStuck as h, backoffWhileTyping as i, renderRawLogLines as j, renderLogTailLines as k, deriveLiveStatus as l, finalizedLines as m, READ_PAGE_DEFAULT as n, controlCodeFromName as o, extractTaskCounts as p, isTransientLockMkdirError as q, TYPING_WINDOW_MS as r, cursorAbs as s, GRACEFUL_EXIT_COMMANDS as t, TYPING_BADGE as tt, extractBadges as u, isSlashCommand as v, menuSelectKeys as w, lastStdinAt as x, isSubcommand as y, stopTipForCli as z };
4378
- //# sourceMappingURL=subcommands-D2llN6dR.js.map
4378
+ //# sourceMappingURL=subcommands-Dl2Kx1FC.js.map
@@ -2,7 +2,7 @@ import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
3
  import "./messageLog-CxrKJj77.js";
4
4
  import "./configShared-aKTg-sa5.js";
5
- import { A as renderRawLog, B as submitAndConfirm, C as matchKeyword, D as recentMessageEdges, E as readPtysize, F as restartHintLines, H as writeKeysPaced, I as runSubcommand, L as snapshotStatus, M as resolveOne, N as resolveReadWindow, O as recentReadEdges, P as resolveResumeArgs, R as stdinActivityPath, S as listRecords, T as readNotes, U as writeToIpc, V as waitForLogQuiet, _ as isPidAlive, a as cmdHelp, b as isUserTyping, c as deriveLiveState, d as extractMenu, f as extractNeedsInput, g as isExitRequest, h as isAgentStuck, i as backoffWhileTyping, j as renderRawLogLines, k as renderLogTailLines, l as deriveLiveStatus, m as finalizedLines, n as READ_PAGE_DEFAULT, o as controlCodeFromName, p as extractTaskCounts, r as TYPING_WINDOW_MS, s as cursorAbs, t as GRACEFUL_EXIT_COMMANDS, u as extractBadges, v as isSlashCommand, w as menuSelectKeys, x as lastStdinAt, y as isSubcommand, z as stopTipForCli } from "./subcommands-D2llN6dR.js";
5
+ import { A as renderRawLog, B as submitAndConfirm, C as matchKeyword, D as recentMessageEdges, E as readPtysize, F as restartHintLines, H as writeKeysPaced, I as runSubcommand, L as snapshotStatus, M as resolveOne, N as resolveReadWindow, O as recentReadEdges, P as resolveResumeArgs, R as stdinActivityPath, S as listRecords, T as readNotes, U as writeToIpc, V as waitForLogQuiet, _ as isPidAlive, a as cmdHelp, b as isUserTyping, c as deriveLiveState, d as extractMenu, f as extractNeedsInput, g as isExitRequest, h as isAgentStuck, i as backoffWhileTyping, j as renderRawLogLines, k as renderLogTailLines, l as deriveLiveStatus, m as finalizedLines, n as READ_PAGE_DEFAULT, o as controlCodeFromName, p as extractTaskCounts, r as TYPING_WINDOW_MS, s as cursorAbs, t as GRACEFUL_EXIT_COMMANDS, u as extractBadges, v as isSlashCommand, w as menuSelectKeys, x as lastStdinAt, y as isSubcommand, z as stopTipForCli } from "./subcommands-Dl2Kx1FC.js";
6
6
  import "./e2e-jb0Hp43q.js";
7
7
  import "./webrtcLink-B7REGtK2.js";
8
8
  import "./remotes-CZGDxzIP.js";
@@ -1,5 +1,5 @@
1
1
  import { n as logger, t as addTransport } from "./logger-CDIsZ-Pp.js";
2
- import { r as getInstalledPackage } from "./versionChecker-QP6QKiG-.js";
2
+ import { r as getInstalledPackage } from "./versionChecker-EEzUODBd.js";
3
3
  import { t as agentYesHome } from "./agentYesHome-CtHb5b71.js";
4
4
  import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-CNMl13dC.js";
5
5
  import { t as PidStore } from "./pidStore-BIvsBQ8X.js";
@@ -300,6 +300,23 @@ function removeControlCharacters(str) {
300
300
  return str.replace(OSC_PATTERN, "").replace(CSI_PATTERN, "");
301
301
  }
302
302
 
303
+ //#endregion
304
+ //#region ts/sessionEnv.ts
305
+ const CLAUDE_SESSION_PIN_ENV = [
306
+ "CLAUDECODE",
307
+ "CLAUDE_CODE_SSE_PORT",
308
+ "CLAUDE_CODE_SESSION_ID",
309
+ "CLAUDE_CODE_CHILD_SESSION",
310
+ "CLAUDE_CODE_ENTRYPOINT"
311
+ ];
312
+ /** Delete the parent Claude Code session-pin vars from a mutable env map, in
313
+ * place. Idempotent (a no-op when they're already absent, e.g. a console spawn
314
+ * whose env came from freshAgentEnv). Returns the same object for chaining. */
315
+ function stripClaudeSessionPin(env) {
316
+ for (const k of CLAUDE_SESSION_PIN_ENV) delete env[k];
317
+ return env;
318
+ }
319
+
303
320
  //#endregion
304
321
  //#region ts/beta/fifo.ts
305
322
  /**
@@ -1300,6 +1317,7 @@ async function agentYes({ cli, cliArgs = [], skipPermissions = false, prompt, ro
1300
1317
  const parentPid = Number.isInteger(inheritedAyPid) && inheritedAyPid > 0 ? inheritedAyPid : void 0;
1301
1318
  ptyEnv.AGENT_YES_PID = String(process.pid);
1302
1319
  delete ptyEnv.AGENT_YES_AGENT_ID;
1320
+ stripClaudeSessionPin(ptyEnv);
1303
1321
  if (cliConf?.env) for (const [key, raw] of Object.entries(cliConf.env)) {
1304
1322
  let unresolved = false;
1305
1323
  const value = raw.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-([^}]*))?\}/g, (_, name, fallback) => {
@@ -1900,5 +1918,5 @@ function sleep(ms) {
1900
1918
  }
1901
1919
 
1902
1920
  //#endregion
1903
- export { removeControlCharacters as a, AgentContext as i, agentYes as n, config as r, CLIS_CONFIG as t };
1904
- //# sourceMappingURL=ts-74aVYJYj.js.map
1921
+ export { CLAUDE_SESSION_PIN_ENV as a, AgentContext as i, agentYes as n, removeControlCharacters as o, config as r, CLIS_CONFIG as t };
1922
+ //# sourceMappingURL=ts-bE-SKMWi.js.map
@@ -7,7 +7,7 @@ import { fileURLToPath } from "url";
7
7
 
8
8
  //#region package.json
9
9
  var name = "agent-yes";
10
- var version = "1.223.0";
10
+ var version = "1.223.1";
11
11
 
12
12
  //#endregion
13
13
  //#region ts/versionChecker.ts
@@ -215,4 +215,4 @@ async function displayVersion() {
215
215
 
216
216
  //#endregion
217
217
  export { versionString as i, displayVersion as n, getInstalledPackage as r, checkAndAutoUpdate as t };
218
- //# sourceMappingURL=versionChecker-QP6QKiG-.js.map
218
+ //# sourceMappingURL=versionChecker-EEzUODBd.js.map
@@ -2,7 +2,7 @@ import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
3
  import "./messageLog-CxrKJj77.js";
4
4
  import "./configShared-aKTg-sa5.js";
5
- import { S as listRecords } from "./subcommands-D2llN6dR.js";
5
+ import { S as listRecords } from "./subcommands-Dl2Kx1FC.js";
6
6
  import "./e2e-jb0Hp43q.js";
7
7
  import "./webrtcLink-B7REGtK2.js";
8
8
  import "./remotes-CZGDxzIP.js";
@@ -418,4 +418,4 @@ async function cmdWs(args) {
418
418
 
419
419
  //#endregion
420
420
  export { WS_JSON_SCHEMA, cmdWs, collectWorkspaces, isPathInside, loadProvision, workspaceStatus };
421
- //# sourceMappingURL=ws-93eeiNKB.js.map
421
+ //# sourceMappingURL=ws-qE_t5H8x.js.map
@@ -0,0 +1,407 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <title>ay callback — let readers message your agent from any web page</title>
7
+ <meta
8
+ name="description"
9
+ content="ay callback mints a signed, send-only, single-agent capability and an embeddable widget — so a public report page can message the agent that wrote it, without ever exposing your serve token."
10
+ />
11
+ <link
12
+ rel="icon"
13
+ href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ctext y='14' font-size='14'%3E%E2%9C%93%3C/text%3E%3C/svg%3E"
14
+ />
15
+ <style>
16
+ :root {
17
+ --bg: #0d1117;
18
+ --fg: #e6edf3;
19
+ --muted: #8b949e;
20
+ --accent: #58a6ff;
21
+ --green: #3fb950;
22
+ --red: #f85149;
23
+ --card: #161b22;
24
+ --border: #30363d;
25
+ }
26
+ @media (prefers-color-scheme: light) {
27
+ :root {
28
+ --bg: #ffffff;
29
+ --fg: #1f2328;
30
+ --muted: #59636e;
31
+ --accent: #0969da;
32
+ --green: #1a7f37;
33
+ --red: #cf222e;
34
+ --card: #f6f8fa;
35
+ --border: #d0d7de;
36
+ }
37
+ }
38
+ * {
39
+ box-sizing: border-box;
40
+ }
41
+ body {
42
+ background: var(--bg);
43
+ color: var(--fg);
44
+ font:
45
+ 16px/1.65 -apple-system,
46
+ BlinkMacSystemFont,
47
+ "Segoe UI",
48
+ Helvetica,
49
+ Arial,
50
+ sans-serif;
51
+ margin: 0;
52
+ padding: 0 20px;
53
+ }
54
+ main {
55
+ max-width: 760px;
56
+ margin: 0 auto;
57
+ padding: 56px 0 96px;
58
+ }
59
+ .tag {
60
+ background: var(--accent);
61
+ color: #fff;
62
+ padding: 2px 8px;
63
+ border-radius: 6px;
64
+ font-size: 0.8em;
65
+ letter-spacing: 0.02em;
66
+ }
67
+ h1 {
68
+ font-size: 2em;
69
+ line-height: 1.2;
70
+ margin: 18px 0 8px;
71
+ }
72
+ h2 {
73
+ font-size: 1.3em;
74
+ margin: 40px 0 10px;
75
+ border-top: 1px solid var(--border);
76
+ padding-top: 28px;
77
+ }
78
+ h2 a.anchor {
79
+ color: var(--muted);
80
+ text-decoration: none;
81
+ margin-left: 6px;
82
+ opacity: 0;
83
+ }
84
+ h2:hover a.anchor {
85
+ opacity: 1;
86
+ }
87
+ .sub {
88
+ color: var(--muted);
89
+ font-size: 1.05em;
90
+ }
91
+ a {
92
+ color: var(--accent);
93
+ }
94
+ code {
95
+ background: var(--card);
96
+ border: 1px solid var(--border);
97
+ border-radius: 5px;
98
+ padding: 1px 5px;
99
+ font-size: 0.88em;
100
+ font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
101
+ }
102
+ pre {
103
+ background: var(--card);
104
+ border: 1px solid var(--border);
105
+ border-radius: 10px;
106
+ padding: 14px 16px;
107
+ overflow-x: auto;
108
+ font-size: 0.86em;
109
+ line-height: 1.5;
110
+ }
111
+ pre code {
112
+ background: none;
113
+ border: 0;
114
+ padding: 0;
115
+ }
116
+ .note {
117
+ border-left: 3px solid var(--accent);
118
+ background: var(--card);
119
+ padding: 10px 16px;
120
+ border-radius: 0 8px 8px 0;
121
+ margin: 18px 0;
122
+ }
123
+ .ok {
124
+ color: var(--green);
125
+ }
126
+ .no {
127
+ color: var(--red);
128
+ }
129
+ footer {
130
+ color: var(--muted);
131
+ font-size: 0.9em;
132
+ margin-top: 48px;
133
+ border-top: 1px solid var(--border);
134
+ padding-top: 20px;
135
+ }
136
+ table {
137
+ border-collapse: collapse;
138
+ width: 100%;
139
+ margin: 16px 0;
140
+ font-size: 0.92em;
141
+ }
142
+ th,
143
+ td {
144
+ border: 1px solid var(--border);
145
+ padding: 8px 10px;
146
+ text-align: left;
147
+ vertical-align: top;
148
+ }
149
+ th {
150
+ background: var(--card);
151
+ }
152
+ /* Inert demo replica of the widget the snippet renders. */
153
+ .demo {
154
+ position: relative;
155
+ background: var(--card);
156
+ border: 1px dashed var(--border);
157
+ border-radius: 12px;
158
+ min-height: 180px;
159
+ margin: 18px 0;
160
+ padding: 12px 16px;
161
+ color: var(--muted);
162
+ font-size: 0.9em;
163
+ }
164
+ .demo .fab {
165
+ position: absolute;
166
+ right: 16px;
167
+ bottom: 16px;
168
+ padding: 10px 14px;
169
+ border-radius: 20px;
170
+ border: none;
171
+ background: #1a7f37;
172
+ color: #fff;
173
+ font: 13px system-ui;
174
+ cursor: pointer;
175
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
176
+ }
177
+ .demo .modal {
178
+ position: absolute;
179
+ right: 16px;
180
+ bottom: 64px;
181
+ width: min(300px, 80%);
182
+ background: var(--bg);
183
+ color: var(--fg);
184
+ border: 1px solid var(--border);
185
+ border-radius: 8px;
186
+ padding: 12px;
187
+ font: 13px system-ui;
188
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
189
+ display: none;
190
+ text-align: left;
191
+ }
192
+ .demo .modal textarea {
193
+ width: 100%;
194
+ height: 64px;
195
+ box-sizing: border-box;
196
+ font: inherit;
197
+ margin: 8px 0;
198
+ resize: vertical;
199
+ background: var(--card);
200
+ color: var(--fg);
201
+ border: 1px solid var(--border);
202
+ border-radius: 6px;
203
+ padding: 6px;
204
+ }
205
+ .demo .modal button {
206
+ padding: 6px 12px;
207
+ border: none;
208
+ border-radius: 6px;
209
+ background: #1a7f37;
210
+ color: #fff;
211
+ cursor: pointer;
212
+ font: inherit;
213
+ }
214
+ .demo .status {
215
+ min-height: 16px;
216
+ font-size: 12px;
217
+ color: var(--muted);
218
+ margin-top: 6px;
219
+ }
220
+ </style>
221
+ </head>
222
+ <body>
223
+ <main>
224
+ <p><span class="tag">agent-yes</span> · engineering</p>
225
+ <h1>ay callback: let readers message your agent from any web page</h1>
226
+ <p class="sub">
227
+ Your agent just published a report. The person reading it has a question. Until now the
228
+ answer was "find the console, find the right terminal, type there." Now the report page
229
+ itself can carry a tiny widget that delivers the reader's message straight into that
230
+ agent's terminal — through a signed, send-only, single-agent capability that expires on a
231
+ date you chose, and never through your master token.
232
+ </p>
233
+
234
+ <h2 id="what">What it does <a class="anchor" href="#what">#</a></h2>
235
+ <p>
236
+ <code>ay callback</code> mints a capability for <strong>one agent</strong> and prints a
237
+ self-contained HTML snippet — one inline <code>&lt;script&gt;</code>, zero external
238
+ requests. Paste it into any page your agent publishes (a status dashboard, a nightly
239
+ report, a postmortem) and readers get a floating button:
240
+ </p>
241
+ <pre><code>$ ay callback --expires 7d
242
+ callback 3b6f23e7 → claude #46555 @ ~/ws/reports
243
+ expires: 2026-07-29T10:57:01.398Z (7d)
244
+ endpoint: https://x1a2b3c.agent-yes.com/cb/cb1.eyJpZCI6…
245
+ revoke: ay callback revoke 3b6f23e7
246
+
247
+ ── embed snippet ──────────────────────────────
248
+ &lt;script&gt; … &lt;/script&gt;</code></pre>
249
+ <p>Here is what the widget feels like (demo only — this one talks to nobody):</p>
250
+ <div class="demo" id="cb-demo">
251
+ Imagine this box is your agent's published report page…
252
+ <button class="fab" id="cb-demo-fab">💬 Message the agent</button>
253
+ <div class="modal" id="cb-demo-modal">
254
+ <strong>Message the agent</strong>
255
+ <textarea id="cb-demo-ta" placeholder="Your message to the agent…"></textarea>
256
+ <button id="cb-demo-send">Send</button>
257
+ <div class="status" id="cb-demo-status"></div>
258
+ </div>
259
+ </div>
260
+ <p>
261
+ When a reader hits <em>Send</em>, the message lands in the agent's terminal wrapped in an
262
+ explicit "untrusted visitor" frame, and in its inbox. One way, by design — the visitor
263
+ never sees the terminal.
264
+ </p>
265
+
266
+ <h2 id="capability">The capability is a hash, not a key <a class="anchor" href="#capability">#</a></h2>
267
+ <p>
268
+ The obvious-but-wrong implementation is to put your daemon's serve token in the snippet.
269
+ That token is a master key: whoever holds it can read every terminal, send to every agent,
270
+ spawn and kill. Pasting it into a public page is game over.
271
+ </p>
272
+ <p>
273
+ So the snippet carries a <strong>capability token</strong> instead — three dot-separated
274
+ parts, the last one an HMAC-SHA256 over the rest:
275
+ </p>
276
+ <pre><code>cb1 . base64url({ "id": "3b6f23e7",
277
+ "agent": "4d65a096e983", // exactly one agent_id
278
+ "exp": 1785322621398 }) // hard expiry, unix ms
279
+ . base64url(HMAC-SHA256(secret, "cb1." + payload))</code></pre>
280
+ <p>
281
+ The scope lives <em>inside the signed payload</em>. That has three consequences worth
282
+ spelling out:
283
+ </p>
284
+ <table>
285
+ <tr>
286
+ <th>Attack</th>
287
+ <th>Result</th>
288
+ </tr>
289
+ <tr>
290
+ <td>Edit the payload to point at another agent, or push the expiry out</td>
291
+ <td><span class="no">✗</span> signature no longer verifies — the daemon answers 404</td>
292
+ </tr>
293
+ <tr>
294
+ <td>Delete the daemon's bookkeeping to "resurrect" an expired token</td>
295
+ <td>
296
+ <span class="no">✗</span> expiry is in the token itself, not in local state — still
297
+ 410
298
+ </td>
299
+ </tr>
300
+ <tr>
301
+ <td>Steal the token from the page source</td>
302
+ <td>
303
+ <span class="ok">✓</span> you can do exactly what the page could already do: send
304
+ rate-limited text to one agent, until the expiry the owner chose
305
+ </td>
306
+ </tr>
307
+ </table>
308
+ <p>
309
+ The HMAC secret is minted on first use into <code>~/.agent-yes/.callback-secret</code>
310
+ (0600), deliberately separate from the serve token — rotating one never invalidates the
311
+ other.
312
+ </p>
313
+
314
+ <h2 id="expiry">--expires is required. There is no "never" <a class="anchor" href="#expiry">#</a></h2>
315
+ <p>
316
+ Every capability API eventually grows a default lifetime, and every default lifetime
317
+ eventually becomes "forever, because nobody thinks about it." We refuse the default:
318
+ </p>
319
+ <pre><code>$ ay callback
320
+ ay callback: --expires is required (e.g. --expires 7d) —
321
+ an embed capability must carry an explicit lifetime</code></pre>
322
+ <p>
323
+ <code>--expires</code> takes <code>30m</code>, <code>12h</code>, <code>7d</code>,
324
+ <code>2w</code> — and caps at 365 days. There is no <code>--expires never</code> and there
325
+ never will be. The point is a moment of deliberate friction: whoever pastes a capability
326
+ into a public page must answer "how long should this live?" while they still remember the
327
+ page exists. When it lapses, the widget doesn't fail silently — it tells the reader the
328
+ link expired and to ask the owner for a fresh one.
329
+ </p>
330
+ <p>For everything before the deadline, there's the kill switch:</p>
331
+ <pre><code>$ ay callback ls
332
+ 3b6f23e7 6d left → claude #46555 @ ~/ws/reports
333
+ $ ay callback revoke 3b6f23e7
334
+ revoked 3b6f23e7</code></pre>
335
+
336
+ <h2 id="hardening">A public route that leaks nothing <a class="anchor" href="#hardening">#</a></h2>
337
+ <p>
338
+ <code>POST /cb/&lt;cap&gt;</code> is the daemon's only unauthenticated write route, so it
339
+ is deliberately paranoid:
340
+ </p>
341
+ <ul>
342
+ <li>
343
+ <strong>Info-tight responses.</strong> The page learns <code>ok</code>,
344
+ <code>expired</code>, or a generic failure — never a pid, a cwd, a hostname, or whether
345
+ a given agent exists. Malformed and forged tokens are indistinguishable 404s.
346
+ </li>
347
+ <li>
348
+ <strong>Untrusted framing.</strong> Visitor text is stripped of control characters (no
349
+ smuggled escape sequences, no fake Enter) and wrapped in an
350
+ <code>&lt;ay-callback&gt;</code> block that names it an untrusted visitor message — the
351
+ agent is told to treat it as data, not instructions.
352
+ </li>
353
+ <li>
354
+ <strong>Flood control.</strong> Per-capability sliding-window rate limit and a 4&nbsp;KB
355
+ body cap. A public page can nudge your agent; it cannot bury it.
356
+ </li>
357
+ <li>
358
+ <strong>One-way.</strong> The route writes to the agent's stdin and records the inbox
359
+ entry. It never reads the terminal back — a public embed must not become a viewport
360
+ into your machine.
361
+ </li>
362
+ </ul>
363
+ <div class="note">
364
+ Two-way chat — the widget showing the agent's reply — is the obvious next step, and the
365
+ design line is already drawn: the page will only ever see replies the agent
366
+ <em>explicitly</em> addresses to that callback, never the raw terminal.
367
+ </div>
368
+
369
+ <h2 id="try">Try it <a class="anchor" href="#try">#</a></h2>
370
+ <pre><code>$ npm i -g agent-yes
371
+ $ ay serve # local daemon
372
+ $ ay expose … # or put the daemon on a public URL first
373
+ $ ay callback --expires 7d --title "Ask the report bot"</code></pre>
374
+ <p>
375
+ Paste the printed snippet at the end of anything your agent publishes. Ship the report;
376
+ keep the conversation.
377
+ </p>
378
+
379
+ <footer>
380
+ <a href="/blog/">← All posts</a> · <a href="/">agent-yes.com</a> ·
381
+ <a href="https://github.com/snomiao/agent-yes">GitHub</a> ·
382
+ <a href="https://github.com/snomiao/agent-yes/pull/295">PR #295</a>
383
+ </footer>
384
+ </main>
385
+ <script>
386
+ // Inert demo widget — mirrors the real snippet's UX, delivers nowhere.
387
+ (function () {
388
+ var fab = document.getElementById("cb-demo-fab");
389
+ var modal = document.getElementById("cb-demo-modal");
390
+ var ta = document.getElementById("cb-demo-ta");
391
+ var send = document.getElementById("cb-demo-send");
392
+ var status = document.getElementById("cb-demo-status");
393
+ fab.onclick = function () {
394
+ modal.style.display = modal.style.display === "block" ? "none" : "block";
395
+ };
396
+ send.onclick = function () {
397
+ if (!ta.value.trim()) return;
398
+ status.textContent = "sending…";
399
+ setTimeout(function () {
400
+ status.textContent = "Delivered. (demo — no agent was harmed)";
401
+ ta.value = "";
402
+ }, 450);
403
+ };
404
+ })();
405
+ </script>
406
+ </body>
407
+ </html>
@@ -156,6 +156,16 @@
156
156
  </p>
157
157
  </a>
158
158
 
159
+ <a class="post" href="/blog/ay-callback/">
160
+ <span class="tag">Feature</span>
161
+ <h2>ay callback — let readers message your agent from any web page</h2>
162
+ <p>
163
+ A signed, send-only, single-agent capability plus a one-script embed widget: report
164
+ pages that can talk back, with a required expiry and a revoke kill-switch — never your
165
+ serve token.
166
+ </p>
167
+ </a>
168
+
159
169
  <a class="post" href="/blog/e2ee-share-links/">
160
170
  <span class="tag">Security</span>
161
171
  <h2>End-to-end encryption for agent-yes share links</h2>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-yes",
3
- "version": "1.223.0",
3
+ "version": "1.223.1",
4
4
  "description": "A wrapper tool that automates interactions with various AI CLI tools by automatically handling common prompts and responses.",
5
5
  "keywords": [
6
6
  "ai",
package/ts/index.ts CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  } from "./resume/codexSessionManager.ts";
14
14
  import pty, { ptyPackage } from "./pty.ts";
15
15
  import { removeControlCharacters } from "./removeControlCharacters.ts";
16
+ import { stripClaudeSessionPin } from "./sessionEnv.ts";
16
17
  import { acquireLock, releaseLock, shouldUseLock } from "./runningLock.ts";
17
18
  import { logger } from "./logger.ts";
18
19
  import { createFifoStream } from "./beta/fifo.ts";
@@ -394,6 +395,16 @@ export default async function agentYes({
394
395
  // `ay`) don't inherit it and register under the same id (which would make that
395
396
  // id ambiguous). The wrapper's own process.env still carries it for pidStore.
396
397
  delete ptyEnv.AGENT_YES_AGENT_ID;
398
+ // Strip the parent Claude Code session markers so the wrapped CLI is a CLEAN
399
+ // top-level session. Without this, an `ay claude` launched from inside another
400
+ // Claude Code session (or this claude's Bash tool) inherits
401
+ // CLAUDE_CODE_CHILD_SESSION — the child claude then disables transcript saving
402
+ // ("⚠ Transcript saving is off …") — and CLAUDE_CODE_SSE_PORT/SESSION_ID make it
403
+ // attach to the parent's stale session. The daemon /api/spawn path already drops
404
+ // these via freshAgentEnv; this covers the direct-launch path. Idempotent, and
405
+ // AGENT_YES_PID is handled above (read for parentPid, then re-stamped). See
406
+ // ts/sessionEnv.ts (mirrored in rs/src/pty_spawner.rs for the Rust runtime).
407
+ stripClaudeSessionPin(ptyEnv);
397
408
  // Inject per-CLI env (e.g. glm → Z.AI endpoint). Expand ${VAR} against the
398
409
  // launching env; skip entries whose vars are unset so we never blank out an
399
410
  // inherited value (e.g. ANTHROPIC_AUTH_TOKEN when ZAI_API_KEY isn't exported).
package/ts/serve.ts CHANGED
@@ -39,6 +39,7 @@ import {
39
39
  } from "./subcommands.ts";
40
40
  import { TYPING_BADGE } from "./badges.ts";
41
41
  import { isCallbackRevoked, loadCallbackSecretReadOnly } from "./callback.ts";
42
+ import { CLAUDE_SESSION_PIN_ENV } from "./sessionEnv.ts";
42
43
  import { MAX_CALLBACK_MSG_BYTES, frameVisitorMessage, verifyCapability } from "./callbackCore.ts";
43
44
  import { isTerminalReply } from "./terminalReply.ts";
44
45
  import { parseStatusText } from "./statusText.ts";
@@ -223,23 +224,17 @@ const defaultOpts = (overrides: Partial<CommonOpts> = {}): CommonOpts => ({
223
224
  ...overrides,
224
225
  });
225
226
 
226
- // The vars that pin a process to a PARENT Claude Code session — NOT the many
227
- // other CLAUDE_CODE_* settings that configure provider/auth/limits (USE_BEDROCK,
228
- // USE_VERTEX, MAX_OUTPUT_TOKENS, …), which must pass through untouched.
229
- const SESSION_PIN_ENV = new Set([
230
- "CLAUDECODE",
231
- "CLAUDE_CODE_SSE_PORT",
232
- "CLAUDE_CODE_SESSION_ID",
233
- "CLAUDE_CODE_CHILD_SESSION",
234
- "CLAUDE_CODE_ENTRYPOINT",
235
- // The agent-yes wrapper pid of the agent that launched `ay serve`. A daemon
236
- // started from inside an agent's shell carries that agent's AGENT_YES_PID for
237
- // its whole lifetime; without stripping it, every console-spawned agent would
238
- // inherit it and be recorded with parent_pid = that stale agent, mis-rooting
239
- // the whole subagent tree under an unrelated agent. Dropping it makes console
240
- // spawns clean top-level agents (parent_pid = None).
241
- "AGENT_YES_PID",
242
- ]);
227
+ // The vars that pin a process to a PARENT Claude Code session (the shared
228
+ // CLAUDE_SESSION_PIN_ENV set, see ts/sessionEnv.ts) plus AGENT_YES_PID:
229
+ // The agent-yes wrapper pid of the agent that launched `ay serve`. A daemon
230
+ // started from inside an agent's shell carries that agent's AGENT_YES_PID for
231
+ // its whole lifetime; without stripping it, every console-spawned agent would
232
+ // inherit it and be recorded with parent_pid = that stale agent, mis-rooting
233
+ // the whole subagent tree under an unrelated agent. Dropping it makes console
234
+ // spawns clean top-level agents (parent_pid = None).
235
+ // (The direct `ay …` launch path re-stamps AGENT_YES_PID with its own pid instead
236
+ // see ts/index.ts so it strips only the shared claude set, not this one.)
237
+ const SESSION_PIN_ENV = new Set<string>([...CLAUDE_SESSION_PIN_ENV, "AGENT_YES_PID"]);
243
238
 
244
239
  // The login-shell environment, captured once and cached for the daemon's
245
240
  // lifetime. `ay serve` is daemonized by oxmgr/launchd/pm2, which start it with a
@@ -0,0 +1,65 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { CLAUDE_SESSION_PIN_ENV, stripClaudeSessionPin } from "./sessionEnv.ts";
3
+
4
+ describe("CLAUDE_SESSION_PIN_ENV", () => {
5
+ it("includes the markers that cause the child-session symptoms", () => {
6
+ // CLAUDE_CODE_CHILD_SESSION → "Transcript saving is off"; SSE_PORT/SESSION_ID
7
+ // → nested-attach "fail to connect". All must be in the strip set.
8
+ for (const k of [
9
+ "CLAUDECODE",
10
+ "CLAUDE_CODE_CHILD_SESSION",
11
+ "CLAUDE_CODE_SSE_PORT",
12
+ "CLAUDE_CODE_SESSION_ID",
13
+ "CLAUDE_CODE_ENTRYPOINT",
14
+ ]) {
15
+ expect(CLAUDE_SESSION_PIN_ENV).toContain(k);
16
+ }
17
+ });
18
+
19
+ it("does NOT include AGENT_YES_PID (re-stamped per path, not shared)", () => {
20
+ expect(CLAUDE_SESSION_PIN_ENV).not.toContain("AGENT_YES_PID");
21
+ });
22
+ });
23
+
24
+ describe("stripClaudeSessionPin", () => {
25
+ it("removes every pin var so the child is a clean top-level session", () => {
26
+ const env: Record<string, string | undefined> = {
27
+ CLAUDECODE: "1",
28
+ CLAUDE_CODE_SSE_PORT: "12345",
29
+ CLAUDE_CODE_SESSION_ID: "abc-123",
30
+ CLAUDE_CODE_CHILD_SESSION: "1",
31
+ CLAUDE_CODE_ENTRYPOINT: "cli",
32
+ };
33
+ stripClaudeSessionPin(env);
34
+ for (const k of CLAUDE_SESSION_PIN_ENV) expect(env[k]).toBeUndefined();
35
+ });
36
+
37
+ it("preserves non-pin CLAUDE_CODE_* config and unrelated vars", () => {
38
+ const env: Record<string, string | undefined> = {
39
+ CLAUDE_CODE_CHILD_SESSION: "1",
40
+ // provider/auth/limit config that must survive
41
+ CLAUDE_CODE_USE_BEDROCK: "1",
42
+ CLAUDE_CODE_MAX_OUTPUT_TOKENS: "8000",
43
+ CLAUDE_EFFORT: "high",
44
+ ANTHROPIC_API_KEY: "sk-xxx",
45
+ PATH: "/usr/bin",
46
+ AGENT_YES_PID: "999",
47
+ };
48
+ stripClaudeSessionPin(env);
49
+ expect(env.CLAUDE_CODE_CHILD_SESSION).toBeUndefined();
50
+ expect(env.CLAUDE_CODE_USE_BEDROCK).toBe("1");
51
+ expect(env.CLAUDE_CODE_MAX_OUTPUT_TOKENS).toBe("8000");
52
+ expect(env.CLAUDE_EFFORT).toBe("high");
53
+ expect(env.ANTHROPIC_API_KEY).toBe("sk-xxx");
54
+ expect(env.PATH).toBe("/usr/bin");
55
+ // AGENT_YES_PID is this path's own concern (re-stamped), not stripped here.
56
+ expect(env.AGENT_YES_PID).toBe("999");
57
+ });
58
+
59
+ it("is idempotent and returns the same object (already-clean env)", () => {
60
+ const env: Record<string, string | undefined> = { PATH: "/bin" };
61
+ const out = stripClaudeSessionPin(env);
62
+ expect(out).toBe(env);
63
+ expect(out).toEqual({ PATH: "/bin" });
64
+ });
65
+ });
@@ -0,0 +1,37 @@
1
+ // Env vars that PIN a process to a PARENT Claude Code session.
2
+ //
3
+ // When `ay` launches an agent, the wrapped CLI must be a CLEAN TOP-LEVEL session
4
+ // — every agent-yes agent gets its own pid, its own log, and (for claude) its
5
+ // own saved transcript. If these markers leak in from the launching env (e.g.
6
+ // `ay claude` run from inside another Claude Code session, or from this claude's
7
+ // Bash tool), the child claude:
8
+ // - sees CLAUDE_CODE_CHILD_SESSION and turns transcript saving OFF
9
+ // ("⚠ Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker"), and
10
+ // - sees CLAUDE_CODE_SSE_PORT / CLAUDE_CODE_SESSION_ID and tries to attach to
11
+ // the parent's stale session, surfacing as "fail to connect".
12
+ //
13
+ // So we strip exactly this set on every spawn path. It is deliberately NARROW —
14
+ // the many OTHER CLAUDE_CODE_* settings configure provider/auth/limits
15
+ // (CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX, CLAUDE_CODE_MAX_OUTPUT_TOKENS,
16
+ // …) and MUST pass through untouched.
17
+ //
18
+ // MIRRORED in rs/src/pty_spawner.rs (`CLAUDE_SESSION_PIN_ENV`) — the Rust runtime
19
+ // (the default) strips the same set; keep the two lists in sync. `AGENT_YES_PID`
20
+ // is handled separately per spawn path (index.ts re-stamps it with its own pid to
21
+ // build the subagent tree; serve.ts's freshAgentEnv drops it for clean console
22
+ // roots), so it is NOT part of this shared set.
23
+ export const CLAUDE_SESSION_PIN_ENV = [
24
+ "CLAUDECODE",
25
+ "CLAUDE_CODE_SSE_PORT",
26
+ "CLAUDE_CODE_SESSION_ID",
27
+ "CLAUDE_CODE_CHILD_SESSION",
28
+ "CLAUDE_CODE_ENTRYPOINT",
29
+ ] as const;
30
+
31
+ /** Delete the parent Claude Code session-pin vars from a mutable env map, in
32
+ * place. Idempotent (a no-op when they're already absent, e.g. a console spawn
33
+ * whose env came from freshAgentEnv). Returns the same object for chaining. */
34
+ export function stripClaudeSessionPin<T extends Record<string, string | undefined>>(env: T): T {
35
+ for (const k of CLAUDE_SESSION_PIN_ENV) delete env[k];
36
+ return env;
37
+ }
@@ -1,9 +0,0 @@
1
- import "./ts-74aVYJYj.js";
2
- import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-QP6QKiG-.js";
4
- import "./pidStore-BIvsBQ8X.js";
5
- import "./globalPidIndex-CoNr7tS8.js";
6
- import "./messageLog-CxrKJj77.js";
7
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-91SHco8n.js";
8
-
9
- export { SUPPORTED_CLIS };