agent-yes 1.307.0 → 1.308.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/README.md +53 -0
- package/dist/{JsonlStore-CB_0sfdT.js → JsonlStore-fEAVg5aY.js} +1 -1
- package/dist/SUPPORTED_CLIS-Ce_7n97m.js +12 -0
- package/dist/{SUPPORTED_CLIS-qL9_2DZ8.js → SUPPORTED_CLIS-DFpjQ2Ke.js} +2 -2
- package/dist/agent-yes.config-ByXwI-t3.js +47 -0
- package/dist/agentPermissions-CgM1bl6m.js +62 -0
- package/dist/{agentShare-C2oXrGvf.js → agentShare-Dz_T6b5v.js} +14 -14
- package/dist/{askCli-D4czi-_j.js → askCli-BjQOqpvv.js} +6 -6
- package/dist/{browser-BW90gl2w.js → browser-BzjhscIR.js} +5 -5
- package/dist/{browser-BAFPmEvN.js → browser-CU933aYj.js} +1 -1
- package/dist/{callback-ie8yyKma.js → callback-CAWItwdn.js} +5 -5
- package/dist/callback-oTjpUn2G.js +17 -0
- package/dist/{callbackCore-Deve5pv3.js → callbackCore-DoPrLOFY.js} +1 -1
- package/dist/{callbackCore-BZ_10zyc.js → callbackCore-TE7HjQm9.js} +1 -1
- package/dist/{channels-jIa5fNjY.js → channels-BGSdyeQs.js} +2 -2
- package/dist/{channels-Y36S0ccW.js → channels-bw-b9z0l.js} +6 -6
- package/dist/channels.js +5 -5
- package/dist/claude-DLN2dvVD.js +180 -0
- package/dist/cli.js +60 -15
- package/dist/{cmdDsh-DZ8bLsH7.js → cmdDsh-h7V2ThH5.js} +1 -1
- package/dist/{cmdKill-DUyZ7Dch.js → cmdKill-b5I7H8wx.js} +5 -5
- package/dist/{cmdPs-CfR5qCiO.js → cmdPs-RZU-tTd4.js} +14 -14
- package/dist/{agent-yes.config-CRfpdp3A.js → configLoader-CLSX_LND.js} +4 -42
- package/dist/configLoader-D9O9zwKR.js +5 -0
- package/dist/{configShared-De4bR5hH.js → configShared-B9gyn11R.js} +1 -1
- package/dist/{cwdConflictWarn-ml6Qs3Qu.js → cwdConflictWarn-BQ8vH915.js} +2 -2
- package/dist/{cwdPassthroughHint-CzWh0hrw.js → cwdPassthroughHint-h4dQQCLO.js} +1 -1
- package/dist/detach-B_n7xRl2.js +58 -0
- package/dist/{e2e-BdLf8DvY.js → e2e-C34A1uYu.js} +1 -1
- package/dist/{expose-Bhsn5yUz.js → expose-BKxcKYt-.js} +1 -1
- package/dist/{forceKill-BDqxx4uQ.js → forceKill-BAqKNR_f.js} +2 -2
- package/dist/{forkNested-DHuYbpaf.js → forkNested-CVSWfZT6.js} +3 -3
- package/dist/{globalPidIndex-DmDCB_X7.js → globalPidIndex-B5c_g_yJ.js} +1 -1
- package/dist/{globalPidIndex-C6p_AY4D.js → globalPidIndex-D9fxq9Ad.js} +10 -2
- package/dist/{hist-DY16wm7g.js → hist-OSUKO8sb.js} +1 -1
- package/dist/{html2canvas-pro.esm-Dp-JZojz.js → html2canvas-pro.esm-BW1GOcB-.js} +1 -1
- package/dist/{identity-D3hr59eC.js → identity-BVHHqtvP.js} +1 -1
- package/dist/{identity-puvd7hVQ.js → identity-CtwRW1nD.js} +1 -1
- package/dist/index.js +8 -8
- package/dist/{initMsg-GPU52N-j.js → initMsg-C1tgHfYP.js} +1 -1
- package/dist/{initMsg-BEVDWYnv.js → initMsg-CkrZjsX-.js} +1 -1
- package/dist/launch-BlKMU2ZA.js +74 -0
- package/dist/launch-CMran68t.js +3 -0
- package/dist/{messageLog-CEqe4Hk1.js → messageLog-BrXNxItW.js} +1 -1
- package/dist/{needsInput-hRiWFjGy.js → needsInput-B3aPVSqs.js} +1 -1
- package/dist/{nodeRuntime-DGMQRTGT.js → nodeRuntime-B1nCglgu.js} +1 -1
- package/dist/{notifyDaemon-DcAbvP43.js → notifyDaemon-Dh4cLfBU.js} +13 -13
- package/dist/{notifyStore-C4pH_-zJ.js → notifyStore-B7DLD83Q.js} +1 -1
- package/dist/{notifyStore-DIfkfKB2.js → notifyStore-CNdHlJyW.js} +1 -1
- package/dist/{openBrowser-CQAOIrD6.js → openBrowser-CwhGNBhv.js} +1 -1
- package/dist/oxmgrService-C0nYf9CD.js +3 -0
- package/dist/{oxmgrService-DlYHmqyI.js → oxmgrService-CBlFJ_-C.js} +2 -2
- package/dist/{parentLink-UiM6WoKm.js → parentLink-C2gocHk9.js} +2 -2
- package/dist/{parentLink-B7_kEM1v.js → parentLink-EVI_0cLu.js} +2 -2
- package/dist/{parentPingLoop-BYT4XgfN.js → parentPingLoop-B9QDw20l.js} +7 -7
- package/dist/peer-BSZQbKB7.js +4 -0
- package/dist/{peer-L-prov9t.js → peer-DI_xxui8.js} +3 -3
- package/dist/pidStore-BRU1Q0uN.js +6 -0
- package/dist/{pidStore-DUXifdBr.js → pidStore-DXEbQrh-.js} +3 -3
- package/dist/{procStats-DwTxj3rs.js → procStats-CkzFrwx7.js} +1 -1
- package/dist/{reaper-DsZhX5FH.js → reaper-A_eEjMxS.js} +1 -1
- package/dist/{reaper-C2cuougX.js → reaper-BTfq0-5j.js} +1 -1
- package/dist/{remotes-CAZymHd7.js → remotes-B0vw-dsd.js} +3 -3
- package/dist/{remotes-W6NhMDfP.js → remotes-TKXkCV76.js} +3 -3
- package/dist/roomReplyAlias-0xfUQlda.js +6 -0
- package/dist/{roomReplyAlias-B1EJft2d.js → roomReplyAlias-CkfEtW2v.js} +3 -3
- package/dist/runner-B1vocYOj.js +371 -0
- package/dist/{runningLock-DMznYh45.js → runningLock-DaVbNt4d.js} +1 -1
- package/dist/{rustBinary-BjsZbiv5.js → rustBinary-B603fLUa.js} +2 -2
- package/dist/{rustBinary-CXQGcJEm.js → rustBinary-CTEd2FnZ.js} +2 -2
- package/dist/{schedule-zacFV53l.js → schedule-DncJhp1d.js} +15 -15
- package/dist/{schedules-BvwTGXU2.js → schedules-D6hZ7VpJ.js} +1 -1
- package/dist/{schedulesCli-Donh0LS2.js → schedulesCli-DSBZwREE.js} +3 -3
- package/dist/{senderAncestry-KhAUPCQs.js → senderAncestry-Brb-cYni.js} +1 -1
- package/dist/{senderAncestry-CVHeKk1Y.js → senderAncestry-DqbNIecg.js} +1 -1
- package/dist/{serve-C38WYmzz.js → serve-BJEDb5Az.js} +52 -51
- package/dist/{serveRust-76_apYb8.js → serveRust-B50JWdfK.js} +3 -3
- package/dist/{setup-CeAisuhv.js → setup-CxQJtnmp.js} +4 -4
- package/dist/{share-_TPYAGWC.js → share-CPtJgXt2.js} +2 -2
- package/dist/{share-CbFetL5H.js → share-zVt71n2g.js} +2 -2
- package/dist/{shareCmd-foO5MbJp.js → shareCmd-96G551OE.js} +10 -10
- package/dist/{spawnGate-nUrmf4dd.js → spawnGate-BkkT7GF2.js} +3 -3
- package/dist/spawnGate-Ky21E51l.js +5 -0
- package/dist/{store-xmBpqPUq.js → store-MjCqeJDI.js} +1 -1
- package/dist/{subcommands-DE31Tfv_.js → subcommands-BJezWaHi.js} +455 -124
- package/dist/{subcommands-DLQEC24N.js → subcommands-DbdxjvFI.js} +12 -12
- package/dist/{systemPathLink-DI9WdoqQ.js → systemPathLink-BQE53HED.js} +1 -1
- package/dist/{terminal-CBbp6PfB.js → terminal-CLjXOXI7.js} +2 -2
- package/dist/terminal.js +1 -1
- package/dist/{todoAutomation-CKlrxuZv.js → todoAutomation-KgmnTAsD.js} +2 -2
- package/dist/{todoCli-BllShFnc.js → todoCli-ammnk6Wv.js} +6 -6
- package/dist/{todoIdentity-DeDp7LKl.js → todoIdentity-DzjduXlF.js} +2 -2
- package/dist/{todoStore-msRCEUi1.js → todoStore-Dre3Yhwt.js} +2 -2
- package/dist/{tray-RIjHSw7z.js → tray-C4sCiT8B.js} +2 -2
- package/dist/{trayApp-C9SZOPpw.js → trayApp-CZwRPF62.js} +2 -2
- package/dist/trayApp-UWX_Bfay.js +5 -0
- package/dist/{ts-CO1H1P2R.js → ts-J77_edCv.js} +20 -79
- package/dist/{versionChecker-CG--tQsV.js → versionChecker-DcrK7m4z.js} +2 -2
- package/dist/{webrtcLink-WxS1nTIs.js → webrtcLink-CGCXjlQJ.js} +2 -2
- package/dist/{webrtcLink-DcvacEci.js → webrtcLink-D4pMhyvY.js} +2 -2
- package/dist/{webrtcRemote-B4pwES4i.js → webrtcRemote-DdCC3aZC.js} +3 -3
- package/dist/{widget-CI7BtN94.js → widget-DU-iJOPF.js} +3 -3
- package/dist/widget.js +1 -1
- package/dist/widgets.js +5 -5
- package/dist/{workspaceConfig-DjEklzxf.js → workspaceConfig-BmK6COFt.js} +1 -1
- package/dist/{ws-DLJSBws6.js → ws-AZ6QSr2M.js} +3 -3
- package/dist/ws-CNd9TMOE.js +16 -0
- package/package.json +1 -1
- package/ts/cli.ts +40 -1
- package/ts/globalPidIndex.ts +19 -2
- package/ts/parseCliArgs.spec.ts +10 -0
- package/ts/parseCliArgs.ts +22 -0
- package/ts/subcommands.spec.ts +2 -2
- package/ts/subcommands.ts +186 -13
- package/dist/SUPPORTED_CLIS-BOGmmIrH.js +0 -12
- package/dist/callback-CNL-PGwh.js +0 -17
- package/dist/oxmgrService-o9L3I6FX.js +0 -3
- package/dist/peer-3F7owPWt.js +0 -4
- package/dist/pidStore-B89BOF_T.js +0 -6
- package/dist/roomReplyAlias-BeGVkAlc.js +0 -6
- package/dist/spawnGate-DhPgMs0Y.js +0 -5
- package/dist/trayApp-BSOmax2E.js +0 -5
- package/dist/ws-W5nWHjDt.js +0 -16
package/ts/subcommands.spec.ts
CHANGED
|
@@ -914,7 +914,7 @@ describe("subcommands.cmdLs human table", () => {
|
|
|
914
914
|
} finally {
|
|
915
915
|
cap.restore();
|
|
916
916
|
}
|
|
917
|
-
expect(cap.text).toMatch(/PID\s+CLI\s+STATUS\s+AGE\s+CWD\s+NOTE\/PROMPT/);
|
|
917
|
+
expect(cap.text).toMatch(/PID\s+CLI\s+STATUS\s+AGE\s+COST\s+CWD\s+NOTE\/PROMPT/);
|
|
918
918
|
expect(cap.text).toMatch(new RegExp(`${process.pid}\\s`));
|
|
919
919
|
expect(cap.text).toMatch(/claude/);
|
|
920
920
|
expect(cap.text).toMatch(/table format test/);
|
|
@@ -1006,7 +1006,7 @@ describe("subcommands.cmdLs human table", () => {
|
|
|
1006
1006
|
}
|
|
1007
1007
|
// The local table has an AGE column under NOTE/PROMPT; the aggregated remote
|
|
1008
1008
|
// table has a HOST column and no AGE. --local must pick the former.
|
|
1009
|
-
expect(cap.text).toMatch(/PID\s+CLI\s+STATUS\s+AGE\s+CWD\s+NOTE\/PROMPT/);
|
|
1009
|
+
expect(cap.text).toMatch(/PID\s+CLI\s+STATUS\s+AGE\s+COST\s+CWD\s+NOTE\/PROMPT/);
|
|
1010
1010
|
expect(cap.text).not.toMatch(/^HOST\s/m);
|
|
1011
1011
|
expect(cap.text).toMatch(new RegExp(`${process.pid}\\s`));
|
|
1012
1012
|
});
|
package/ts/subcommands.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { eventFile, readStreamSnapshot } from "./stream/state.ts";
|
|
2
|
+
import { sendStream } from "./stream/send.ts";
|
|
1
3
|
/**
|
|
2
4
|
* `ay ls / read / cat / tail / head / send` subcommand implementations.
|
|
3
5
|
*
|
|
@@ -1454,6 +1456,7 @@ export async function cmdHelp(managerCommands = true): Promise<number> {
|
|
|
1454
1456
|
`Run an agent (naming a CLI is what launches one — bare 'ay' shows this help):\n` +
|
|
1455
1457
|
` ay <claude|codex|...> [options] -- [prompt]\n` +
|
|
1456
1458
|
` ay claude -- "fix the bug in auth.ts"\n` +
|
|
1459
|
+
` ay --stream claude "task" use the Claude stream JSON protocol\n` +
|
|
1457
1460
|
` ay --detach claude -- "…" start it in the background and return at once\n` +
|
|
1458
1461
|
` (e.g. over ssh); prints its pid + how to drive it\n` +
|
|
1459
1462
|
` cy [options] -- [prompt] shortcut for 'ay claude' (bare 'cy' starts claude)\n` +
|
|
@@ -2733,6 +2736,8 @@ async function runAllRemotesLs(opts: {
|
|
|
2733
2736
|
*/
|
|
2734
2737
|
export async function deriveLiveStatus(r: GlobalPidRecord): Promise<"active" | "idle" | "exited"> {
|
|
2735
2738
|
if (r.status === "exited" || !isPidAlive(r.pid)) return "exited";
|
|
2739
|
+
if (r.mode === "stream")
|
|
2740
|
+
return (await readStreamSnapshot(r)).state === "idle" ? "idle" : "active";
|
|
2736
2741
|
if (!r.log_file) return "active";
|
|
2737
2742
|
const mtime = await stat(r.log_file)
|
|
2738
2743
|
.then((s) => s.mtimeMs)
|
|
@@ -2894,6 +2899,12 @@ export async function deriveLiveState(
|
|
|
2894
2899
|
): Promise<{ state: LiveState; question: string | null }> {
|
|
2895
2900
|
const base = await deriveLiveStatus(r);
|
|
2896
2901
|
if (base === "exited") return { state: "stopped", question: null };
|
|
2902
|
+
if (r.mode === "stream") {
|
|
2903
|
+
if (reachabilityProbeApplies(r, base) && (await confirmStdinUnreachable(r)))
|
|
2904
|
+
return { state: "unreachable", question: null };
|
|
2905
|
+
const { state, question } = await readStreamSnapshot(r);
|
|
2906
|
+
return { state, question };
|
|
2907
|
+
}
|
|
2897
2908
|
// Alive but nothing can be delivered to it. Wins over every state below,
|
|
2898
2909
|
// including needs_input: a question we cannot answer is not a state a caller
|
|
2899
2910
|
// should be invited to act on, and reporting it as `idle` is what let a
|
|
@@ -3243,7 +3254,9 @@ async function cmdLs(rest: string[]): Promise<number> {
|
|
|
3243
3254
|
const recs = await listRecords(keyword, opts);
|
|
3244
3255
|
const targets = new Set([
|
|
3245
3256
|
...indexFiles,
|
|
3246
|
-
...recs
|
|
3257
|
+
...recs
|
|
3258
|
+
.map((record) => (record.mode === "stream" ? eventFile(record) : record.log_file))
|
|
3259
|
+
.filter((file): file is string => !!file),
|
|
3247
3260
|
]);
|
|
3248
3261
|
for (const [file, follower] of tailers) {
|
|
3249
3262
|
if (!targets.has(file)) {
|
|
@@ -3326,7 +3339,11 @@ async function cmdLs(rest: string[]): Promise<number> {
|
|
|
3326
3339
|
// an orchestrator parses) reports the same status the human table does. The
|
|
3327
3340
|
// original `status` field is preserved for backward compatibility.
|
|
3328
3341
|
const enriched = await Promise.all(
|
|
3329
|
-
records.map(async (r) => ({
|
|
3342
|
+
records.map(async (r) => ({
|
|
3343
|
+
...r,
|
|
3344
|
+
...(await deriveLiveState(r)),
|
|
3345
|
+
...(r.mode === "stream" ? { cost_usd: (await readStreamSnapshot(r)).costUsd ?? null } : {}),
|
|
3346
|
+
})),
|
|
3330
3347
|
);
|
|
3331
3348
|
await writeStdoutFlushed(JSON.stringify(enriched, null, 2) + "\n");
|
|
3332
3349
|
return 0;
|
|
@@ -3354,14 +3371,26 @@ async function cmdLs(rest: string[]): Promise<number> {
|
|
|
3354
3371
|
const ageOf = (r: GlobalPidRecord) => humanizeAge(now - (lastActive.get(r.pid) ?? r.started_at));
|
|
3355
3372
|
|
|
3356
3373
|
const rawCwds = records.map((r) => cwdLabel(r));
|
|
3374
|
+
const costs = new Map(
|
|
3375
|
+
await Promise.all(
|
|
3376
|
+
records.map(
|
|
3377
|
+
async (r) =>
|
|
3378
|
+
[r.pid, r.mode === "stream" ? (await readStreamSnapshot(r)).costUsd : undefined] as const,
|
|
3379
|
+
),
|
|
3380
|
+
),
|
|
3381
|
+
);
|
|
3382
|
+
const costOf = (r: GlobalPidRecord) =>
|
|
3383
|
+
costs.get(r.pid) === undefined ? "-" : `$${costs.get(r.pid)!.toFixed(4)}`;
|
|
3357
3384
|
const widths = {
|
|
3385
|
+
cost: Math.max(4, ...records.map((r) => costOf(r).length)),
|
|
3358
3386
|
pid: Math.max(3, ...records.map((r) => String(r.pid).length)),
|
|
3359
3387
|
cli: Math.max(3, ...records.map((r) => r.cli.length)),
|
|
3360
3388
|
status: Math.max(6, ...records.map((r) => r.status.length)),
|
|
3361
3389
|
age: Math.max(3, ...records.map((r) => ageOf(r).length)),
|
|
3362
3390
|
cwd: Math.max(3, ...rawCwds.map((c) => c.length)),
|
|
3363
3391
|
};
|
|
3364
|
-
const fixedWidth =
|
|
3392
|
+
const fixedWidth =
|
|
3393
|
+
widths.pid + widths.cli + widths.status + widths.age + widths.cwd + widths.cost + 6 * 2; // 6 separators of " "
|
|
3365
3394
|
const promptBudget = Math.max(20, termWidth - fixedWidth - 1);
|
|
3366
3395
|
|
|
3367
3396
|
// Reorder into the agent>subagent forest: a nested `ay` launched from inside
|
|
@@ -3425,6 +3454,7 @@ async function cmdLs(rest: string[]): Promise<number> {
|
|
|
3425
3454
|
cli: r.cli,
|
|
3426
3455
|
status: displayStatus,
|
|
3427
3456
|
age: ageOf(r),
|
|
3457
|
+
cost: costOf(r),
|
|
3428
3458
|
cwd: cwdLabel(r),
|
|
3429
3459
|
label,
|
|
3430
3460
|
hasNote,
|
|
@@ -3439,6 +3469,7 @@ async function cmdLs(rest: string[]): Promise<number> {
|
|
|
3439
3469
|
"CLI".padEnd(widths.cli),
|
|
3440
3470
|
"STATUS".padEnd(widths.status),
|
|
3441
3471
|
"AGE".padEnd(widths.age),
|
|
3472
|
+
"COST".padEnd(widths.cost),
|
|
3442
3473
|
"CWD".padEnd(widths.cwd),
|
|
3443
3474
|
"NOTE/PROMPT",
|
|
3444
3475
|
].join(" ") + "\n";
|
|
@@ -3451,6 +3482,7 @@ async function cmdLs(rest: string[]): Promise<number> {
|
|
|
3451
3482
|
r.cli.padEnd(widths.cli),
|
|
3452
3483
|
r.status.padEnd(widths.status),
|
|
3453
3484
|
r.age.padEnd(widths.age),
|
|
3485
|
+
r.cost.padEnd(widths.cost),
|
|
3454
3486
|
r.cwd.padEnd(widths.cwd),
|
|
3455
3487
|
r.label,
|
|
3456
3488
|
].join(" ") + "\n",
|
|
@@ -3741,7 +3773,12 @@ async function cmdRead(rest: string[], { mode }: ReadOpts): Promise<number> {
|
|
|
3741
3773
|
|
|
3742
3774
|
if (follow) {
|
|
3743
3775
|
// Follow mode ignores pagination: print the initial context, then stream deltas.
|
|
3744
|
-
const rendered =
|
|
3776
|
+
const rendered =
|
|
3777
|
+
record.mode === "stream"
|
|
3778
|
+
? n
|
|
3779
|
+
? Buffer.from(buf).toString("utf8").trimEnd().split("\n").slice(-n).join("\n")
|
|
3780
|
+
: Buffer.from(buf).toString("utf8")
|
|
3781
|
+
: await renderRawLog(buf, { mode, n, cols: size?.cols, rows: size?.rows });
|
|
3745
3782
|
process.stderr.write(header + "\n");
|
|
3746
3783
|
// `--until -q` is a predicate, not a reader: no context window, no stream —
|
|
3747
3784
|
// only the matching line, so a caller can capture it without filtering.
|
|
@@ -3773,6 +3810,23 @@ async function cmdRead(rest: string[], { mode }: ReadOpts): Promise<number> {
|
|
|
3773
3810
|
// Seed the follow from the log's REAL byte frontier (`stats.size`), not
|
|
3774
3811
|
// `buf.length` — `buf` may be a capped tail window, so its length is not the
|
|
3775
3812
|
// file offset. `buf` still seeds the terminal render (identical final state).
|
|
3813
|
+
if (record.mode === "stream")
|
|
3814
|
+
return followTranscriptLocal(
|
|
3815
|
+
logPath,
|
|
3816
|
+
stats.size,
|
|
3817
|
+
tally
|
|
3818
|
+
? {
|
|
3819
|
+
tally,
|
|
3820
|
+
failTally,
|
|
3821
|
+
pattern: until as string,
|
|
3822
|
+
failPattern: failOn,
|
|
3823
|
+
quiet: Boolean(argv.quiet),
|
|
3824
|
+
timeoutMs: untilTimeoutMs,
|
|
3825
|
+
matchBacklog: Boolean(argv["match-backlog"]),
|
|
3826
|
+
pid: record.pid,
|
|
3827
|
+
}
|
|
3828
|
+
: undefined,
|
|
3829
|
+
);
|
|
3776
3830
|
return plain
|
|
3777
3831
|
? followPlainLocal(
|
|
3778
3832
|
logPath,
|
|
@@ -3800,7 +3854,10 @@ async function cmdRead(rest: string[], { mode }: ReadOpts): Promise<number> {
|
|
|
3800
3854
|
|
|
3801
3855
|
// Static read: render the full log once, then window into the rendered lines
|
|
3802
3856
|
// so line numbers (and the pagination cursor in the footer) are exact.
|
|
3803
|
-
const allLines =
|
|
3857
|
+
const allLines =
|
|
3858
|
+
record.mode === "stream"
|
|
3859
|
+
? Buffer.from(buf).toString("utf8").trimEnd().split("\n")
|
|
3860
|
+
: await renderRawLogLines(buf, { cols: size?.cols, rows: size?.rows });
|
|
3804
3861
|
const total = allLines.length;
|
|
3805
3862
|
const win = resolveReadWindow({
|
|
3806
3863
|
total,
|
|
@@ -3947,6 +4004,69 @@ async function watchAppend(
|
|
|
3947
4004
|
return offset;
|
|
3948
4005
|
}
|
|
3949
4006
|
|
|
4007
|
+
/** Follow the already-readable stream transcript without terminal wrapping. */
|
|
4008
|
+
async function followTranscriptLocal(
|
|
4009
|
+
logPath: string,
|
|
4010
|
+
startOffset: number,
|
|
4011
|
+
until?: FollowUntil,
|
|
4012
|
+
): Promise<number> {
|
|
4013
|
+
const { StringDecoder } = await import("node:string_decoder");
|
|
4014
|
+
const decoder = new StringDecoder("utf8");
|
|
4015
|
+
const ac = new AbortController();
|
|
4016
|
+
const judge = until ? makeJudge(until.tally, until.failTally) : null;
|
|
4017
|
+
let pending = "";
|
|
4018
|
+
let outcome: UntilOutcome = "stopped";
|
|
4019
|
+
const feed = (chunk: Uint8Array) => {
|
|
4020
|
+
const text = decoder.write(Buffer.from(chunk));
|
|
4021
|
+
if (!until?.quiet) process.stdout.write(text);
|
|
4022
|
+
pending += text;
|
|
4023
|
+
let end: number;
|
|
4024
|
+
while ((end = pending.indexOf("\n")) !== -1) {
|
|
4025
|
+
const line = pending.slice(0, end);
|
|
4026
|
+
pending = pending.slice(end + 1);
|
|
4027
|
+
if (judge && !judge.settled && judge.test(line)) {
|
|
4028
|
+
outcome = judge.outcome ?? "match";
|
|
4029
|
+
ac.abort();
|
|
4030
|
+
}
|
|
4031
|
+
}
|
|
4032
|
+
};
|
|
4033
|
+
process.stderr.write(
|
|
4034
|
+
until ? untilBanner(until) : "following transcript... (Ctrl-C / SIGTERM to stop)\n",
|
|
4035
|
+
);
|
|
4036
|
+
const timer =
|
|
4037
|
+
until?.timeoutMs != null
|
|
4038
|
+
? setTimeout(() => {
|
|
4039
|
+
outcome = "timeout";
|
|
4040
|
+
ac.abort();
|
|
4041
|
+
}, until.timeoutMs)
|
|
4042
|
+
: undefined;
|
|
4043
|
+
const liveness = until
|
|
4044
|
+
? setInterval(() => {
|
|
4045
|
+
if (!isPidAlive(until.pid)) {
|
|
4046
|
+
outcome = "exited";
|
|
4047
|
+
ac.abort();
|
|
4048
|
+
}
|
|
4049
|
+
}, 250)
|
|
4050
|
+
: undefined;
|
|
4051
|
+
try {
|
|
4052
|
+
const offset = await watchAppend(logPath, startOffset, feed, () => {}, ac.signal);
|
|
4053
|
+
// Catch output written just before process exit but after the last watch notification.
|
|
4054
|
+
const remaining = await readFile(logPath).catch(() => Buffer.alloc(0));
|
|
4055
|
+
if (remaining.length > offset) feed(remaining.subarray(offset));
|
|
4056
|
+
if (pending && judge && !judge.settled && judge.test(pending))
|
|
4057
|
+
outcome = judge.outcome ?? "match";
|
|
4058
|
+
return until
|
|
4059
|
+
? reportUntil(outcome, judge?.matched ?? null, until.quiet, until.failPattern, {
|
|
4060
|
+
hits: until.tally.hits,
|
|
4061
|
+
needed: until.tally.needed,
|
|
4062
|
+
})
|
|
4063
|
+
: 0;
|
|
4064
|
+
} finally {
|
|
4065
|
+
if (timer) clearTimeout(timer);
|
|
4066
|
+
if (liveness) clearInterval(liveness);
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
|
|
3950
4070
|
/**
|
|
3951
4071
|
* Default (interactive) follow: append each new byte range with ANSI/control
|
|
3952
4072
|
* sequences stripped. Mirrors the historical behaviour, plus prompt signal /
|
|
@@ -6087,7 +6207,7 @@ async function cmdSend(rest: string[]): Promise<number> {
|
|
|
6087
6207
|
// `-` is the exception: resolving it means reading stdin, and a send that
|
|
6088
6208
|
// cannot land must not first consume the caller's piped body. That form keeps
|
|
6089
6209
|
// the reachability gate first and pays its cap check afterwards.
|
|
6090
|
-
if (rawMessage !== "-") {
|
|
6210
|
+
if (rawMessage !== "-" && record.mode !== "stream") {
|
|
6091
6211
|
const rawFlag = Boolean(argv.raw) || process.env.AGENT_YES_SEND_RAW === "1";
|
|
6092
6212
|
const err = sendPayloadCapError(rawMessage.length, await envelopeCostFor(rawMessage, rawFlag));
|
|
6093
6213
|
if (err) throw new Error(err);
|
|
@@ -6097,6 +6217,11 @@ async function cmdSend(rest: string[]): Promise<number> {
|
|
|
6097
6217
|
// Both shapes of "there is nobody to deliver to" exit with the same
|
|
6098
6218
|
// distinguishable status, before we read stdin or take the input lock — a
|
|
6099
6219
|
// send that cannot land should not first consume the caller's piped body.
|
|
6220
|
+
if (!fifoPath && record.mode === "stream") {
|
|
6221
|
+
throw new Error(
|
|
6222
|
+
"ay send: this native stream invocation has no replay-confirmed input; relaunch with --input-format stream-json --replay-user-messages",
|
|
6223
|
+
);
|
|
6224
|
+
}
|
|
6100
6225
|
if (!fifoPath) {
|
|
6101
6226
|
process.stderr.write(
|
|
6102
6227
|
`ay send: pid ${record.pid}: no fifo_file recorded — this agent didn't register a stdin FIFO (an older agent, or one not started with --stdpush), so there is no channel to deliver on. If it is still running, restarting it (ay restart ${record.pid}) registers one; if the row is stale, ay stop ${record.pid} retires it.\n`,
|
|
@@ -6142,7 +6267,7 @@ async function cmdSend(rest: string[]): Promise<number> {
|
|
|
6142
6267
|
// send guards run. The AUTHORITATIVE check is on the transmitted payload,
|
|
6143
6268
|
// below, once the envelope's length is known — see sendPayloadCapError.
|
|
6144
6269
|
{
|
|
6145
|
-
const err = sendPayloadCapError(body.length, 0);
|
|
6270
|
+
const err = record.mode === "stream" ? null : sendPayloadCapError(body.length, 0);
|
|
6146
6271
|
if (err) throw new Error(err);
|
|
6147
6272
|
}
|
|
6148
6273
|
|
|
@@ -6155,7 +6280,7 @@ async function cmdSend(rest: string[]): Promise<number> {
|
|
|
6155
6280
|
// literal `/exit` command, so `ay send <pid> exit` lands as plain text and the
|
|
6156
6281
|
// model just replies "Exiting…" while the process keeps running. Route an exact
|
|
6157
6282
|
// exit request to a real graceful shutdown instead, recording who asked.
|
|
6158
|
-
if (isExitRequest(body)) {
|
|
6283
|
+
if (record.mode !== "stream" && isExitRequest(body)) {
|
|
6159
6284
|
const reason = sender.agent
|
|
6160
6285
|
? `requested by ${sender.agent.cli} #${sender.agent.pid} @ ${shortenPath(sender.agent.cwd)}`
|
|
6161
6286
|
: `requested via 'ay send ${keyword} exit'`;
|
|
@@ -6190,7 +6315,7 @@ async function cmdSend(rest: string[]): Promise<number> {
|
|
|
6190
6315
|
let prefix = "";
|
|
6191
6316
|
let suffix = "";
|
|
6192
6317
|
let nonce: string | undefined;
|
|
6193
|
-
if (sender.agent && !isSlashCommand(body) && !raw) {
|
|
6318
|
+
if (record.mode !== "stream" && sender.agent && !isSlashCommand(body) && !raw) {
|
|
6194
6319
|
nonce = randomBytes(4).toString("hex");
|
|
6195
6320
|
// The standardized identity (<user>@<host>:<path>:<branch>#<pid>) names the
|
|
6196
6321
|
// sender in one token: the branch usually carries the lane name for free
|
|
@@ -6221,6 +6346,46 @@ async function cmdSend(rest: string[]): Promise<number> {
|
|
|
6221
6346
|
}
|
|
6222
6347
|
}
|
|
6223
6348
|
|
|
6349
|
+
if (record.mode === "stream") {
|
|
6350
|
+
if (codeName !== "enter")
|
|
6351
|
+
throw new Error("ay send: --code is not supported for stream sessions; use --interrupt");
|
|
6352
|
+
if (argv.noWait || process.env.AGENT_YES_SEND_NO_WAIT === "1")
|
|
6353
|
+
throw new Error("ay send: stream sessions require a replay receipt; omit --no-wait");
|
|
6354
|
+
const receipt = await sendStream(record, body, {
|
|
6355
|
+
interrupt: Boolean(argv.interrupt),
|
|
6356
|
+
write: (payload) =>
|
|
6357
|
+
withIpcLock(
|
|
6358
|
+
record.pid,
|
|
6359
|
+
() => writeToIpc(fifoPath, payload),
|
|
6360
|
+
(reason) => {
|
|
6361
|
+
throw new Error(`ay send: cannot lock stream input (${reason}); nothing sent`);
|
|
6362
|
+
},
|
|
6363
|
+
),
|
|
6364
|
+
});
|
|
6365
|
+
await recordMessage({
|
|
6366
|
+
at: Date.now(),
|
|
6367
|
+
nonce,
|
|
6368
|
+
origin: sender.agent ? undefined : "shell",
|
|
6369
|
+
from_via: sender.via,
|
|
6370
|
+
sender_observed: observedSender(),
|
|
6371
|
+
from: sender.agent
|
|
6372
|
+
? {
|
|
6373
|
+
pid: sender.agent.pid,
|
|
6374
|
+
cli: sender.agent.cli,
|
|
6375
|
+
cwd: sender.agent.cwd,
|
|
6376
|
+
agent_id: sender.agent.agent_id,
|
|
6377
|
+
}
|
|
6378
|
+
: null,
|
|
6379
|
+
to: { pid: record.pid, cli: record.cli, cwd: record.cwd, agent_id: record.agent_id },
|
|
6380
|
+
body,
|
|
6381
|
+
confirmed: true,
|
|
6382
|
+
submission: "submitted",
|
|
6383
|
+
wrapped: Boolean(nonce),
|
|
6384
|
+
});
|
|
6385
|
+
process.stdout.write(`sent to pid ${record.pid} (${record.cli}); replay receipt ${receipt}\n`);
|
|
6386
|
+
return 0;
|
|
6387
|
+
}
|
|
6388
|
+
|
|
6224
6389
|
// Deliver as ONE paste when the target CLI supports it, instead of a burst it
|
|
6225
6390
|
// has to segment by arrival timing — which silently eats the head of a long
|
|
6226
6391
|
// body. See ts/bracketedPaste.ts for the measurement and why no length or
|
|
@@ -7985,9 +8150,15 @@ export async function snapshotStatus(record: GlobalPidRecord): Promise<StatusSna
|
|
|
7985
8150
|
// not disagree about whether a row can be given work.
|
|
7986
8151
|
const alive = record.status !== "exited" && isPidAlive(record.pid);
|
|
7987
8152
|
let state: LiveState;
|
|
8153
|
+
let question: string | null = null;
|
|
7988
8154
|
let logMtimeMs: number | null = null;
|
|
7989
8155
|
if (!alive) {
|
|
7990
8156
|
state = "stopped";
|
|
8157
|
+
} else if (record.mode === "stream") {
|
|
8158
|
+
({ state, question } = await deriveLiveState(record));
|
|
8159
|
+
logMtimeMs = await stat(eventFile(record))
|
|
8160
|
+
.then((info) => info.mtimeMs)
|
|
8161
|
+
.catch(() => null);
|
|
7991
8162
|
} else if (record.log_file) {
|
|
7992
8163
|
logMtimeMs = await stat(record.log_file)
|
|
7993
8164
|
.then((s) => s.mtimeMs)
|
|
@@ -8000,11 +8171,12 @@ export async function snapshotStatus(record: GlobalPidRecord): Promise<StatusSna
|
|
|
8000
8171
|
// rewrite `state`. Gates the reachability probe.
|
|
8001
8172
|
const baseState: "active" | "idle" = state === "idle" ? "idle" : "active";
|
|
8002
8173
|
const activity =
|
|
8003
|
-
state !== "stopped" && record.
|
|
8174
|
+
state !== "stopped" && record.mode !== "stream" && record.log_file
|
|
8175
|
+
? await extractActivity(record.log_file)
|
|
8176
|
+
: null;
|
|
8004
8177
|
// A blocked interactive menu overrides active/idle — the agent is alive and
|
|
8005
8178
|
// quiet, but quiet because it's waiting for an answer, not because it's done.
|
|
8006
|
-
|
|
8007
|
-
if (state !== "stopped" && record.log_file) {
|
|
8179
|
+
if (record.mode !== "stream" && state !== "stopped" && record.log_file) {
|
|
8008
8180
|
const ni = await extractNeedsInput(record.log_file, record.cli);
|
|
8009
8181
|
if (ni) {
|
|
8010
8182
|
state = "needs_input";
|
|
@@ -8017,12 +8189,13 @@ export async function snapshotStatus(record: GlobalPidRecord): Promise<StatusSna
|
|
|
8017
8189
|
// The Rust supervisor's unresponsive flag is an authoritative wedge signal —
|
|
8018
8190
|
// it overrides the log-tail heuristics above (but never a dead agent, which
|
|
8019
8191
|
// Rust clears the flag on anyway).
|
|
8020
|
-
if (alive && record.unresponsive) state = "stuck";
|
|
8192
|
+
if (alive && record.mode !== "stream" && record.unresponsive) state = "stuck";
|
|
8021
8193
|
// Alive but undeliverable outranks all of the above, exactly as in
|
|
8022
8194
|
// deriveLiveState — `ay status` and `ay ls` must not disagree about whether a
|
|
8023
8195
|
// row can be given work. Same grace period, from the same helper.
|
|
8024
8196
|
if (
|
|
8025
8197
|
alive &&
|
|
8198
|
+
record.mode !== "stream" &&
|
|
8026
8199
|
reachabilityProbeApplies(record, baseState) &&
|
|
8027
8200
|
(await confirmStdinUnreachable(record))
|
|
8028
8201
|
) {
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./versionChecker-CG--tQsV.js";
|
|
3
|
-
import "./ts-CO1H1P2R.js";
|
|
4
|
-
import "./todoAutomation-CKlrxuZv.js";
|
|
5
|
-
import "./JsonlStore-CB_0sfdT.js";
|
|
6
|
-
import "./globalPidIndex-C6p_AY4D.js";
|
|
7
|
-
import "./pidStore-DUXifdBr.js";
|
|
8
|
-
import "./messageLog-CEqe4Hk1.js";
|
|
9
|
-
import "./todoStore-msRCEUi1.js";
|
|
10
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-qL9_2DZ8.js";
|
|
11
|
-
|
|
12
|
-
export { SUPPORTED_CLIS };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./JsonlStore-CB_0sfdT.js";
|
|
3
|
-
import "./globalPidIndex-C6p_AY4D.js";
|
|
4
|
-
import "./pidStore-DUXifdBr.js";
|
|
5
|
-
import "./messageLog-CEqe4Hk1.js";
|
|
6
|
-
import "./e2e-BdLf8DvY.js";
|
|
7
|
-
import "./configShared-De4bR5hH.js";
|
|
8
|
-
import "./subcommands-DE31Tfv_.js";
|
|
9
|
-
import "./webrtcLink-DcvacEci.js";
|
|
10
|
-
import "./remotes-CAZymHd7.js";
|
|
11
|
-
import "./roomReplyAlias-B1EJft2d.js";
|
|
12
|
-
import "./notifyStore-DIfkfKB2.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-ie8yyKma.js";
|
|
16
|
-
|
|
17
|
-
export { cmdCallback };
|
package/dist/peer-3F7owPWt.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import "./e2e-BdLf8DvY.js";
|
|
2
|
-
import "./webrtcLink-DcvacEci.js";
|
|
3
|
-
import "./remotes-CAZymHd7.js";
|
|
4
|
-
import { i as roomAliases, n as hostedRoomMember, r as roomAliasPlaceholder, t as fillRoomAlias } from "./roomReplyAlias-B1EJft2d.js";
|
|
5
|
-
|
|
6
|
-
export { fillRoomAlias, roomAliases };
|
package/dist/trayApp-BSOmax2E.js
DELETED
package/dist/ws-W5nWHjDt.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./JsonlStore-CB_0sfdT.js";
|
|
3
|
-
import "./globalPidIndex-C6p_AY4D.js";
|
|
4
|
-
import "./pidStore-DUXifdBr.js";
|
|
5
|
-
import "./messageLog-CEqe4Hk1.js";
|
|
6
|
-
import "./e2e-BdLf8DvY.js";
|
|
7
|
-
import "./configShared-De4bR5hH.js";
|
|
8
|
-
import "./subcommands-DE31Tfv_.js";
|
|
9
|
-
import "./webrtcLink-DcvacEci.js";
|
|
10
|
-
import "./remotes-CAZymHd7.js";
|
|
11
|
-
import "./roomReplyAlias-B1EJft2d.js";
|
|
12
|
-
import "./notifyStore-DIfkfKB2.js";
|
|
13
|
-
import "./senderAncestry-CVHeKk1Y.js";
|
|
14
|
-
import { a as isPathInside, c as walkWorkspaces, i as importProvisionModule, l as workspaceStatus, n as cmdWs, o as loadProvision, r as collectWorkspaces, s as resolveOperand, t as WS_JSON_SCHEMA } from "./ws-DLJSBws6.js";
|
|
15
|
-
|
|
16
|
-
export { WS_JSON_SCHEMA, cmdWs, collectWorkspaces, isPathInside, loadProvision, walkWorkspaces, workspaceStatus };
|