claude-yes 1.161.0 → 1.162.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.
- package/dist/{SUPPORTED_CLIS-DYTnLX8C.js → SUPPORTED_CLIS-BNLYYzBZ.js} +2 -2
- package/dist/SUPPORTED_CLIS-C9TQK7ME.js +8 -0
- package/dist/cli.js +4 -4
- package/dist/index.js +3 -3
- package/dist/pidStore-5qyLX3Fh.js +5 -0
- package/dist/{pidStore-fqXqTKkh.js → pidStore-BfoBWUjc.js} +3 -2
- package/dist/{schedule-CCvB7SCT.js → schedule-DzFEVEoq.js} +5 -5
- package/dist/{serve-BRARQjsC.js → serve-BFnjq7JW.js} +15 -8
- package/dist/{setup-Cx7jDKtC.js → setup-BmUQ_Zbt.js} +2 -2
- package/dist/{subcommands-DGkBxWS5.js → subcommands-CKMEWv6U.js} +7 -6
- package/dist/{subcommands-5AXvxB0S.js → subcommands-DeW-4FGU.js} +1 -1
- package/dist/{ts-CRo3qQWb.js → ts--UKFJGU-.js} +4 -3
- package/dist/{versionChecker-DrjR4P0K.js → versionChecker-DJObC8O_.js} +2 -2
- package/package.json +1 -1
- package/ts/index.ts +6 -0
- package/ts/pidStore.ts +8 -2
- package/ts/serve.ts +12 -2
- package/ts/subcommands.ts +15 -10
- package/dist/SUPPORTED_CLIS-CHmQfHCh.js +0 -8
- package/dist/pidStore-DfHh3Yt0.js +0 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as CLIS_CONFIG } from "./ts
|
|
1
|
+
import { t as CLIS_CONFIG } from "./ts--UKFJGU-.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-
|
|
8
|
+
//# sourceMappingURL=SUPPORTED_CLIS-BNLYYzBZ.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "./ts--UKFJGU-.js";
|
|
2
|
+
import "./logger-CDIsZ-Pp.js";
|
|
3
|
+
import "./versionChecker-DJObC8O_.js";
|
|
4
|
+
import "./pidStore-BfoBWUjc.js";
|
|
5
|
+
import "./globalPidIndex-DlmmJlO8.js";
|
|
6
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BNLYYzBZ.js";
|
|
7
|
+
|
|
8
|
+
export { SUPPORTED_CLIS };
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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, r as getInstalledPackage, t as checkAndAutoUpdate } from "./versionChecker-
|
|
4
|
+
import { i as versionString, n as displayVersion, r as getInstalledPackage, t as checkAndAutoUpdate } from "./versionChecker-DJObC8O_.js";
|
|
5
5
|
import { argv } from "process";
|
|
6
6
|
import { execFileSync, spawn } from "child_process";
|
|
7
7
|
import ms from "ms";
|
|
@@ -481,7 +481,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
|
|
|
481
481
|
const rawArg = process.argv[2];
|
|
482
482
|
const managerCommands = !invokedCliName(process.argv);
|
|
483
483
|
const isHelpFlag = rawArg === "-h" || rawArg === "--help";
|
|
484
|
-
const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-
|
|
484
|
+
const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-DeW-4FGU.js");
|
|
485
485
|
if (isHelpFlag && process.argv.length === 3) {
|
|
486
486
|
cmdHelp(managerCommands);
|
|
487
487
|
process.exit(0);
|
|
@@ -514,7 +514,7 @@ if (config.useRust) {
|
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
if (rustBinary) {
|
|
517
|
-
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-
|
|
517
|
+
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-C9TQK7ME.js");
|
|
518
518
|
const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
|
|
519
519
|
if (config.verbose) {
|
|
520
520
|
console.log(`[rust] Using binary: ${rustBinary}`);
|
|
@@ -544,7 +544,7 @@ if (config.showVersion) {
|
|
|
544
544
|
process.exit(0);
|
|
545
545
|
}
|
|
546
546
|
if (config.appendPrompt) {
|
|
547
|
-
const { PidStore } = await import("./pidStore-
|
|
547
|
+
const { PidStore } = await import("./pidStore-5qyLX3Fh.js");
|
|
548
548
|
const ipcPath = await PidStore.findActiveFifo(process.cwd());
|
|
549
549
|
if (!ipcPath) {
|
|
550
550
|
console.error("No active agent with IPC found in current directory.");
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts
|
|
1
|
+
import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts--UKFJGU-.js";
|
|
2
2
|
import "./logger-CDIsZ-Pp.js";
|
|
3
|
-
import "./versionChecker-
|
|
4
|
-
import "./pidStore-
|
|
3
|
+
import "./versionChecker-DJObC8O_.js";
|
|
4
|
+
import "./pidStore-BfoBWUjc.js";
|
|
5
5
|
import "./globalPidIndex-DlmmJlO8.js";
|
|
6
6
|
|
|
7
7
|
export { AgentContext, CLIS_CONFIG, config, agentYes as default, removeControlCharacters };
|
|
@@ -209,8 +209,9 @@ var PidStore = class PidStore {
|
|
|
209
209
|
const argsJson = JSON.stringify(args);
|
|
210
210
|
const logFile = this.getRawLogPath(pid);
|
|
211
211
|
const fifoFile = this.getFifoPath(pid);
|
|
212
|
+
const injected = process.env.AGENT_YES_AGENT_ID;
|
|
212
213
|
const existing = this.store.findOne((doc) => doc.pid === pid);
|
|
213
|
-
const agentId = existing?.agentId ?? randomBytes(6).toString("hex");
|
|
214
|
+
const agentId = existing?.agentId ?? (injected && /^[0-9a-f]{6,32}$/i.test(injected) ? injected : randomBytes(6).toString("hex"));
|
|
214
215
|
const record = {
|
|
215
216
|
pid,
|
|
216
217
|
cli,
|
|
@@ -367,4 +368,4 @@ pid-db/
|
|
|
367
368
|
|
|
368
369
|
//#endregion
|
|
369
370
|
export { PidStore as t };
|
|
370
|
-
//# sourceMappingURL=pidStore-
|
|
371
|
+
//# sourceMappingURL=pidStore-BfoBWUjc.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./ts
|
|
1
|
+
import "./ts--UKFJGU-.js";
|
|
2
2
|
import "./logger-CDIsZ-Pp.js";
|
|
3
|
-
import "./versionChecker-
|
|
4
|
-
import "./pidStore-
|
|
3
|
+
import "./versionChecker-DJObC8O_.js";
|
|
4
|
+
import "./pidStore-BfoBWUjc.js";
|
|
5
5
|
import "./globalPidIndex-DlmmJlO8.js";
|
|
6
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-
|
|
6
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BNLYYzBZ.js";
|
|
7
7
|
import { o as resolveSpawnCwd } from "./workspaceConfig-B0Q9-q2B.js";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
9
|
|
|
@@ -141,4 +141,4 @@ async function cmdSchedule(rest) {
|
|
|
141
141
|
|
|
142
142
|
//#endregion
|
|
143
143
|
export { cmdSchedule };
|
|
144
|
-
//# sourceMappingURL=schedule-
|
|
144
|
+
//# sourceMappingURL=schedule-DzFEVEoq.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import "./ts
|
|
1
|
+
import "./ts--UKFJGU-.js";
|
|
2
2
|
import "./logger-CDIsZ-Pp.js";
|
|
3
|
-
import { r as getInstalledPackage } from "./versionChecker-
|
|
4
|
-
import "./pidStore-
|
|
3
|
+
import { r as getInstalledPackage } from "./versionChecker-DJObC8O_.js";
|
|
4
|
+
import "./pidStore-BfoBWUjc.js";
|
|
5
5
|
import { a as updateGlobalPidStatus } from "./globalPidIndex-DlmmJlO8.js";
|
|
6
6
|
import { t as pgidForWrapper } from "./reaper-C-eWAxIj.js";
|
|
7
7
|
import "./configShared-CEyhl0WH.js";
|
|
8
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-
|
|
8
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BNLYYzBZ.js";
|
|
9
9
|
import "./e2e-Bfw7qL9O.js";
|
|
10
10
|
import "./webrtcLink-CBZkZ-LT.js";
|
|
11
11
|
import "./remotes-DBCvpp3B.js";
|
|
12
12
|
import { a as isProvisionAllowed, i as hasSpawnHook, n as getSpawnHook, o as resolveSpawnCwd, t as getProvisionRoot } from "./workspaceConfig-B0Q9-q2B.js";
|
|
13
|
-
import { D as writeToIpc, T as snapshotStatus, _ as readPtysize, b as resolveOne, c as extractTaskCounts, g as readNotes, i as controlCodeFromName, m as listRecords, o as deriveLiveStatus, v as renderRawLog } from "./subcommands-
|
|
13
|
+
import { D as writeToIpc, T as snapshotStatus, _ as readPtysize, b as resolveOne, c as extractTaskCounts, g as readNotes, i as controlCodeFromName, m as listRecords, o as deriveLiveStatus, v as renderRawLog } from "./subcommands-CKMEWv6U.js";
|
|
14
14
|
import yargs from "yargs";
|
|
15
15
|
import { mkdir, open, readFile, stat, unlink, writeFile } from "fs/promises";
|
|
16
16
|
import { homedir, hostname, userInfo } from "os";
|
|
@@ -1200,6 +1200,7 @@ Options:
|
|
|
1200
1200
|
...prompt ? ["--", prompt] : []
|
|
1201
1201
|
];
|
|
1202
1202
|
const agentEnv = freshAgentEnv();
|
|
1203
|
+
const agentId = randomBytes(6).toString("hex");
|
|
1203
1204
|
try {
|
|
1204
1205
|
const hook = getSpawnHook();
|
|
1205
1206
|
if (hook) {
|
|
@@ -1218,7 +1219,8 @@ Options:
|
|
|
1218
1219
|
env: {
|
|
1219
1220
|
...agentEnv,
|
|
1220
1221
|
AGENT_YES_CWD: cwd,
|
|
1221
|
-
AGENT_YES_CLI: cli
|
|
1222
|
+
AGENT_YES_CLI: cli,
|
|
1223
|
+
AGENT_YES_AGENT_ID: agentId
|
|
1222
1224
|
},
|
|
1223
1225
|
stdin: "ignore",
|
|
1224
1226
|
stdout: "ignore",
|
|
@@ -1239,6 +1241,7 @@ Options:
|
|
|
1239
1241
|
return Response.json({
|
|
1240
1242
|
ok: true,
|
|
1241
1243
|
pid: child.pid,
|
|
1244
|
+
agentId,
|
|
1242
1245
|
cli,
|
|
1243
1246
|
cwd,
|
|
1244
1247
|
hook: true,
|
|
@@ -1248,7 +1251,10 @@ Options:
|
|
|
1248
1251
|
const child = Bun.spawn(agentArgv, {
|
|
1249
1252
|
cwd,
|
|
1250
1253
|
detached: true,
|
|
1251
|
-
env:
|
|
1254
|
+
env: {
|
|
1255
|
+
...agentEnv,
|
|
1256
|
+
AGENT_YES_AGENT_ID: agentId
|
|
1257
|
+
},
|
|
1252
1258
|
stdin: "ignore",
|
|
1253
1259
|
stdout: "ignore",
|
|
1254
1260
|
stderr: "ignore"
|
|
@@ -1257,6 +1263,7 @@ Options:
|
|
|
1257
1263
|
return Response.json({
|
|
1258
1264
|
ok: true,
|
|
1259
1265
|
pid: child.pid,
|
|
1266
|
+
agentId,
|
|
1260
1267
|
cli,
|
|
1261
1268
|
cwd,
|
|
1262
1269
|
...provisioned ? { provisioned } : {}
|
|
@@ -1389,4 +1396,4 @@ Options:
|
|
|
1389
1396
|
|
|
1390
1397
|
//#endregion
|
|
1391
1398
|
export { cmdServe };
|
|
1392
|
-
//# sourceMappingURL=serve-
|
|
1399
|
+
//# sourceMappingURL=serve-BFnjq7JW.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-
|
|
35
|
+
const { cmdServe } = await import("./serve-BFnjq7JW.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-
|
|
45
|
+
//# sourceMappingURL=setup-BmUQ_Zbt.js.map
|
|
@@ -556,15 +556,15 @@ async function runSubcommand(argv) {
|
|
|
556
556
|
case "restart": return await cmdRestart(rest);
|
|
557
557
|
case "note": return await cmdNote(rest);
|
|
558
558
|
case "serve": {
|
|
559
|
-
const { cmdServe } = await import("./serve-
|
|
559
|
+
const { cmdServe } = await import("./serve-BFnjq7JW.js");
|
|
560
560
|
return cmdServe(rest);
|
|
561
561
|
}
|
|
562
562
|
case "setup": {
|
|
563
|
-
const { cmdSetup } = await import("./setup-
|
|
563
|
+
const { cmdSetup } = await import("./setup-BmUQ_Zbt.js");
|
|
564
564
|
return cmdSetup(rest);
|
|
565
565
|
}
|
|
566
566
|
case "schedule": {
|
|
567
|
-
const { cmdSchedule } = await import("./schedule-
|
|
567
|
+
const { cmdSchedule } = await import("./schedule-DzFEVEoq.js");
|
|
568
568
|
return cmdSchedule(rest);
|
|
569
569
|
}
|
|
570
570
|
case "remote": {
|
|
@@ -913,7 +913,8 @@ async function runRemoteSpawn(remote, hint, spec) {
|
|
|
913
913
|
}
|
|
914
914
|
const r = await res.json();
|
|
915
915
|
process.stdout.write(`spawned ${r.cli} on ${remote.url} in ${r.cwd}${r.hook ? " (via spawn hook)" : ""}${r.provisioned ? ` (${r.provisioned.action})` : ""}\n`);
|
|
916
|
-
process.stderr.write(`\n ay
|
|
916
|
+
if (r.agentId && !hint.includes("://")) process.stderr.write(`\n ay tail ${hint}:${r.agentId} # watch its output\n ay status ${hint}:${r.agentId} --wait # block until it needs you\n`);
|
|
917
|
+
else process.stderr.write(`\n ay ls ${hint} # the new ${r.cli} agent appears here\n`);
|
|
917
918
|
return 0;
|
|
918
919
|
}
|
|
919
920
|
async function runRemoteStatus(remote) {
|
|
@@ -1933,7 +1934,7 @@ async function cmdSend(rest) {
|
|
|
1933
1934
|
const trailing = controlCodeFromName(codeName);
|
|
1934
1935
|
const record = await resolveOne(keyword, opts);
|
|
1935
1936
|
const fifoPath = record.fifo_file;
|
|
1936
|
-
if (!fifoPath) throw new Error(`pid ${record.pid}: no fifo_file recorded — agent
|
|
1937
|
+
if (!fifoPath) throw new Error(`pid ${record.pid}: no fifo_file recorded — this agent didn't register a stdin FIFO (an older agent, or one not started with --stdpush). Restarting it (ay restart ${record.pid}) re-registers one.`);
|
|
1937
1938
|
let body;
|
|
1938
1939
|
if (rawMessage === "-") {
|
|
1939
1940
|
const chunks = [];
|
|
@@ -2794,4 +2795,4 @@ async function cmdResultSet(rest) {
|
|
|
2794
2795
|
|
|
2795
2796
|
//#endregion
|
|
2796
2797
|
export { restartHintLines as C, writeToIpc as D, stopTipForCli as E, resolveResumeArgs as S, snapshotStatus as T, readPtysize as _, cursorAbs as a, resolveOne as b, extractTaskCounts as c, isExitRequest as d, isPidAlive as f, readNotes as g, matchKeyword as h, controlCodeFromName as i, finalizedLines as l, listRecords as m, READ_PAGE_DEFAULT as n, deriveLiveStatus as o, isSubcommand as p, cmdHelp as r, extractNeedsInput as s, GRACEFUL_EXIT_COMMANDS as t, isAgentStuck as u, renderRawLog as v, runSubcommand as w, resolveReadWindow as x, renderRawLogLines as y };
|
|
2797
|
-
//# sourceMappingURL=subcommands-
|
|
2798
|
+
//# sourceMappingURL=subcommands-CKMEWv6U.js.map
|
|
@@ -4,6 +4,6 @@ import "./configShared-CEyhl0WH.js";
|
|
|
4
4
|
import "./e2e-Bfw7qL9O.js";
|
|
5
5
|
import "./webrtcLink-CBZkZ-LT.js";
|
|
6
6
|
import "./remotes-DBCvpp3B.js";
|
|
7
|
-
import { C as restartHintLines, D as writeToIpc, E as stopTipForCli, S as resolveResumeArgs, T as snapshotStatus, _ as readPtysize, a as cursorAbs, b as resolveOne, c as extractTaskCounts, d as isExitRequest, f as isPidAlive, g as readNotes, h as matchKeyword, i as controlCodeFromName, l as finalizedLines, m as listRecords, n as READ_PAGE_DEFAULT, o as deriveLiveStatus, p as isSubcommand, r as cmdHelp, s as extractNeedsInput, t as GRACEFUL_EXIT_COMMANDS, u as isAgentStuck, v as renderRawLog, w as runSubcommand, x as resolveReadWindow, y as renderRawLogLines } from "./subcommands-
|
|
7
|
+
import { C as restartHintLines, D as writeToIpc, E as stopTipForCli, S as resolveResumeArgs, T as snapshotStatus, _ as readPtysize, a as cursorAbs, b as resolveOne, c as extractTaskCounts, d as isExitRequest, f as isPidAlive, g as readNotes, h as matchKeyword, i as controlCodeFromName, l as finalizedLines, m as listRecords, n as READ_PAGE_DEFAULT, o as deriveLiveStatus, p as isSubcommand, r as cmdHelp, s as extractNeedsInput, t as GRACEFUL_EXIT_COMMANDS, u as isAgentStuck, v as renderRawLog, w as runSubcommand, x as resolveReadWindow, y as renderRawLogLines } from "./subcommands-CKMEWv6U.js";
|
|
8
8
|
|
|
9
9
|
export { cmdHelp, isSubcommand, runSubcommand };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as logger, t as addTransport } from "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import { r as getInstalledPackage } from "./versionChecker-
|
|
2
|
+
import { r as getInstalledPackage } from "./versionChecker-DJObC8O_.js";
|
|
3
3
|
import { t as agentYesHome } from "./agentYesHome-_eJa3DaX.js";
|
|
4
4
|
import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-V4qvXgAw.js";
|
|
5
|
-
import { t as PidStore } from "./pidStore-
|
|
5
|
+
import { t as PidStore } from "./pidStore-BfoBWUjc.js";
|
|
6
6
|
import { i as readGlobalPids } from "./globalPidIndex-DlmmJlO8.js";
|
|
7
7
|
import { n as register, r as sweep } from "./reaper-C-eWAxIj.js";
|
|
8
8
|
import { arch, platform } from "process";
|
|
@@ -1216,6 +1216,7 @@ async function agentYes({ cli, cliArgs = [], skipPermissions = false, prompt, ro
|
|
|
1216
1216
|
const inheritedAyPid = Number(ptyEnv.AGENT_YES_PID);
|
|
1217
1217
|
const parentPid = Number.isInteger(inheritedAyPid) && inheritedAyPid > 0 ? inheritedAyPid : void 0;
|
|
1218
1218
|
ptyEnv.AGENT_YES_PID = String(process.pid);
|
|
1219
|
+
delete ptyEnv.AGENT_YES_AGENT_ID;
|
|
1219
1220
|
if (cliConf?.env) for (const [key, raw] of Object.entries(cliConf.env)) {
|
|
1220
1221
|
let unresolved = false;
|
|
1221
1222
|
const value = raw.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-([^}]*))?\}/g, (_, name, fallback) => {
|
|
@@ -1802,4 +1803,4 @@ function sleep(ms) {
|
|
|
1802
1803
|
|
|
1803
1804
|
//#endregion
|
|
1804
1805
|
export { removeControlCharacters as a, AgentContext as i, agentYes as n, config as r, CLIS_CONFIG as t };
|
|
1805
|
-
//# sourceMappingURL=ts
|
|
1806
|
+
//# sourceMappingURL=ts--UKFJGU-.js.map
|
|
@@ -7,7 +7,7 @@ import { fileURLToPath } from "url";
|
|
|
7
7
|
|
|
8
8
|
//#region package.json
|
|
9
9
|
var name = "claude-yes";
|
|
10
|
-
var version = "1.
|
|
10
|
+
var version = "1.162.0";
|
|
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-
|
|
218
|
+
//# sourceMappingURL=versionChecker-DJObC8O_.js.map
|
package/package.json
CHANGED
package/ts/index.ts
CHANGED
|
@@ -374,6 +374,12 @@ export default async function agentYes({
|
|
|
374
374
|
const parentPid =
|
|
375
375
|
Number.isInteger(inheritedAyPid) && inheritedAyPid > 0 ? inheritedAyPid : undefined;
|
|
376
376
|
ptyEnv.AGENT_YES_PID = String(process.pid);
|
|
377
|
+
// A caller-injected AGENT_YES_AGENT_ID (from `ay serve`'s /api/spawn) is meant
|
|
378
|
+
// for THIS agent's record only — pidStore.registerProcess reads it from our own
|
|
379
|
+
// env. Strip it from the wrapped CLI's env so the agent's subagents (a nested
|
|
380
|
+
// `ay`) don't inherit it and register under the same id (which would make that
|
|
381
|
+
// id ambiguous). The wrapper's own process.env still carries it for pidStore.
|
|
382
|
+
delete ptyEnv.AGENT_YES_AGENT_ID;
|
|
377
383
|
// Inject per-CLI env (e.g. glm → Z.AI endpoint). Expand ${VAR} against the
|
|
378
384
|
// launching env; skip entries whose vars are unset so we never blank out an
|
|
379
385
|
// inherited value (e.g. ANTHROPIC_AUTH_TOKEN when ZAI_API_KEY isn't exported).
|
package/ts/pidStore.ts
CHANGED
|
@@ -77,9 +77,15 @@ export class PidStore {
|
|
|
77
77
|
const fifoFile = this.getFifoPath(pid);
|
|
78
78
|
|
|
79
79
|
// Upsert by pid. Reuse an existing record's agent id so re-registration
|
|
80
|
-
// (e.g. status churn) keeps the id stable;
|
|
80
|
+
// (e.g. status churn) keeps the id stable; else adopt a caller-injected
|
|
81
|
+
// AGENT_YES_AGENT_ID (so `ay serve`'s /api/spawn can hand back an id that
|
|
82
|
+
// addresses this exact agent — index.ts strips it from the wrapped CLI's env
|
|
83
|
+
// so subagents don't inherit it); else mint a fresh 12-hex id.
|
|
84
|
+
const injected = process.env.AGENT_YES_AGENT_ID;
|
|
81
85
|
const existing = this.store.findOne((doc) => doc.pid === pid);
|
|
82
|
-
const agentId =
|
|
86
|
+
const agentId =
|
|
87
|
+
existing?.agentId ??
|
|
88
|
+
(injected && /^[0-9a-f]{6,32}$/i.test(injected) ? injected : randomBytes(6).toString("hex"));
|
|
83
89
|
|
|
84
90
|
const record: Omit<PidRecord, "_id"> = {
|
|
85
91
|
pid,
|
package/ts/serve.ts
CHANGED
|
@@ -1763,6 +1763,14 @@ export async function cmdServe(rest: string[]): Promise<number> {
|
|
|
1763
1763
|
const agentArgv = [...ayCmd, cli, ...(prompt ? ["--", prompt] : [])];
|
|
1764
1764
|
// don't leak our Claude Code session into the agent
|
|
1765
1765
|
const agentEnv = freshAgentEnv();
|
|
1766
|
+
// Correlation id: the spawn response returns the `ay` LAUNCHER pid, which is
|
|
1767
|
+
// NOT the agent's registered pid — so the caller can't find the agent it just
|
|
1768
|
+
// spawned. Mint a 12-hex id (the agent_id format), inject it as
|
|
1769
|
+
// AGENT_YES_AGENT_ID, and return it. Both runtimes adopt it as their agent_id
|
|
1770
|
+
// (instead of minting a random one) and strip it from the wrapped CLI's env so
|
|
1771
|
+
// subagents don't inherit and collide. The caller can then address the agent
|
|
1772
|
+
// immediately: `ay <verb> <remote>:<agentId>`.
|
|
1773
|
+
const agentId = randomBytes(6).toString("hex");
|
|
1766
1774
|
// Detach the agent into its OWN session (setsid). When `ay serve` runs WITH a
|
|
1767
1775
|
// controlling terminal (started in a shell rather than as a headless daemon),
|
|
1768
1776
|
// an undetached child inherits the daemon's session + controlling tty and lands
|
|
@@ -1792,7 +1800,7 @@ export async function cmdServe(rest: string[]): Promise<number> {
|
|
|
1792
1800
|
const child = Bun.spawn([shell, "-c", script, "ay-spawn", ...agentArgv], {
|
|
1793
1801
|
cwd,
|
|
1794
1802
|
detached: true,
|
|
1795
|
-
env: { ...agentEnv, AGENT_YES_CWD: cwd, AGENT_YES_CLI: cli },
|
|
1803
|
+
env: { ...agentEnv, AGENT_YES_CWD: cwd, AGENT_YES_CLI: cli, AGENT_YES_AGENT_ID: agentId },
|
|
1796
1804
|
stdin: "ignore",
|
|
1797
1805
|
stdout: "ignore",
|
|
1798
1806
|
stderr: Bun.file(errPath),
|
|
@@ -1829,6 +1837,7 @@ export async function cmdServe(rest: string[]): Promise<number> {
|
|
|
1829
1837
|
return Response.json({
|
|
1830
1838
|
ok: true,
|
|
1831
1839
|
pid: child.pid,
|
|
1840
|
+
agentId,
|
|
1832
1841
|
cli,
|
|
1833
1842
|
cwd,
|
|
1834
1843
|
hook: true,
|
|
@@ -1838,7 +1847,7 @@ export async function cmdServe(rest: string[]): Promise<number> {
|
|
|
1838
1847
|
const child = Bun.spawn(agentArgv, {
|
|
1839
1848
|
cwd,
|
|
1840
1849
|
detached: true,
|
|
1841
|
-
env: agentEnv,
|
|
1850
|
+
env: { ...agentEnv, AGENT_YES_AGENT_ID: agentId },
|
|
1842
1851
|
stdin: "ignore",
|
|
1843
1852
|
stdout: "ignore",
|
|
1844
1853
|
stderr: "ignore",
|
|
@@ -1847,6 +1856,7 @@ export async function cmdServe(rest: string[]): Promise<number> {
|
|
|
1847
1856
|
return Response.json({
|
|
1848
1857
|
ok: true,
|
|
1849
1858
|
pid: child.pid,
|
|
1859
|
+
agentId,
|
|
1850
1860
|
cli,
|
|
1851
1861
|
cwd,
|
|
1852
1862
|
...(provisioned ? { provisioned } : {}),
|
package/ts/subcommands.ts
CHANGED
|
@@ -897,6 +897,7 @@ async function runRemoteSpawn(
|
|
|
897
897
|
pid: number;
|
|
898
898
|
cli: string;
|
|
899
899
|
cwd: string;
|
|
900
|
+
agentId?: string;
|
|
900
901
|
hook?: boolean;
|
|
901
902
|
provisioned?: { action: string };
|
|
902
903
|
};
|
|
@@ -905,15 +906,19 @@ async function runRemoteSpawn(
|
|
|
905
906
|
`${r.hook ? " (via spawn hook)" : ""}` +
|
|
906
907
|
`${r.provisioned ? ` (${r.provisioned.action})` : ""}\n`,
|
|
907
908
|
);
|
|
908
|
-
//
|
|
909
|
-
//
|
|
910
|
-
//
|
|
911
|
-
//
|
|
912
|
-
//
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
909
|
+
// `/api/spawn` returns a correlation `agentId` that the agent adopts as its
|
|
910
|
+
// agent_id — so we address the EXACT agent by it (no pid guessing, no race). A
|
|
911
|
+
// webrtc:// / share-link target isn't `:keyword`-addressable, so the keyword
|
|
912
|
+
// hint is only for an alias / token@host:port. Older remotes omit agentId →
|
|
913
|
+
// fall back to pointing at `ay ls`.
|
|
914
|
+
if (r.agentId && !hint.includes("://")) {
|
|
915
|
+
process.stderr.write(
|
|
916
|
+
`\n ay tail ${hint}:${r.agentId} # watch its output\n` +
|
|
917
|
+
` ay status ${hint}:${r.agentId} --wait # block until it needs you\n`,
|
|
918
|
+
);
|
|
919
|
+
} else {
|
|
920
|
+
process.stderr.write(`\n ay ls ${hint} # the new ${r.cli} agent appears here\n`);
|
|
921
|
+
}
|
|
917
922
|
return 0;
|
|
918
923
|
}
|
|
919
924
|
|
|
@@ -2258,7 +2263,7 @@ async function cmdSend(rest: string[]): Promise<number> {
|
|
|
2258
2263
|
const fifoPath = record.fifo_file;
|
|
2259
2264
|
if (!fifoPath) {
|
|
2260
2265
|
throw new Error(
|
|
2261
|
-
`pid ${record.pid}: no fifo_file recorded — agent
|
|
2266
|
+
`pid ${record.pid}: no fifo_file recorded — this agent didn't register a stdin FIFO (an older agent, or one not started with --stdpush). Restarting it (ay restart ${record.pid}) re-registers one.`,
|
|
2262
2267
|
);
|
|
2263
2268
|
}
|
|
2264
2269
|
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "./ts-CRo3qQWb.js";
|
|
2
|
-
import "./logger-CDIsZ-Pp.js";
|
|
3
|
-
import "./versionChecker-DrjR4P0K.js";
|
|
4
|
-
import "./pidStore-fqXqTKkh.js";
|
|
5
|
-
import "./globalPidIndex-DlmmJlO8.js";
|
|
6
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DYTnLX8C.js";
|
|
7
|
-
|
|
8
|
-
export { SUPPORTED_CLIS };
|