agent-yes 1.168.0 → 1.169.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.
- package/dist/{SUPPORTED_CLIS-CnvLgnlN.js → SUPPORTED_CLIS-Bwg9VqLI.js} +2 -2
- package/dist/SUPPORTED_CLIS-DiL99G3j.js +8 -0
- package/dist/cli.js +47 -6
- package/dist/{e2e-Bfw7qL9O.js → e2e-BeKjLhmO.js} +1 -1
- package/dist/forkNested-UCKPEgSI.js +59 -0
- package/dist/index.js +2 -2
- package/dist/{openBrowser-CuOlFtow.js → openBrowser-CCF1iuQK.js} +1 -1
- package/dist/{remotes-T6nf0t3K.js → remotes-BmAPylU_.js} +3 -3
- package/dist/{remotes-ClT1bq16.js → remotes-cx_GDFPj.js} +3 -3
- package/dist/{runningLock-V4qvXgAw.js → runningLock-BobVW1_A.js} +2 -1
- package/dist/{schedule-CgdRQVI9.js → schedule-CtVvSyaN.js} +5 -5
- package/dist/{serve-Bv2Fvt4n.js → serve-CLmk5ujF.js} +34 -15
- package/dist/{setup-2mTN8Pz1.js → setup-CYbXOcpH.js} +3 -3
- package/dist/{share-BjqQBWM-.js → share-D_e2Fwiy.js} +2 -2
- package/dist/{spawnGate-UH73I2le.js → spawnGate-CQ1Il3Xk.js} +1 -1
- package/dist/{spawnGate-B_VDMXYL.js → spawnGate-DzPfa1PZ.js} +2 -2
- package/dist/{subcommands-gqQYqyVj.js → subcommands--EUush_X.js} +45 -11
- package/dist/subcommands-1ZcaHYkb.js +9 -0
- package/dist/{tray-CZarCA2Q.js → tray-CWUpaZF4.js} +2 -2
- package/dist/{ts-j34CxbQs.js → ts-Bbhf5JbN.js} +5 -5
- package/dist/{versionChecker-CCPt7CpW.js → versionChecker-BmWkWhcJ.js} +2 -2
- package/dist/{webrtcLink-CBZkZ-LT.js → webrtcLink-BG0Xc4-W.js} +2 -2
- package/dist/{webrtcRemote-GAgF5K45.js → webrtcRemote-SybKurg9.js} +3 -3
- package/dist/{workspaceConfig-D3OH7and.js → workspaceConfig-BC03X4Y1.js} +1 -1
- package/lab/ui/console-logic.js +16 -0
- package/lab/ui/index.html +28 -0
- package/package.json +1 -1
- package/ts/badges.spec.ts +54 -0
- package/ts/badges.ts +42 -0
- package/ts/cli.ts +46 -0
- package/ts/forkNested.spec.ts +34 -0
- package/ts/forkNested.ts +64 -0
- package/ts/index.ts +13 -4
- package/ts/needsInput.ts +1 -1
- package/ts/parseCliArgs.spec.ts +18 -0
- package/ts/parseCliArgs.ts +8 -0
- package/ts/runningLock.ts +1 -0
- package/ts/serve.ts +24 -0
- package/ts/subcommands.spec.ts +22 -0
- package/ts/subcommands.ts +40 -13
- package/dist/SUPPORTED_CLIS-JQkvO2eq.js +0 -8
- package/dist/subcommands-Bc08oDD_.js +0 -9
package/ts/subcommands.ts
CHANGED
|
@@ -18,6 +18,7 @@ import path from "path";
|
|
|
18
18
|
import { type GlobalPidRecord, readGlobalPids, updateGlobalPidStatus } from "./globalPidIndex.ts";
|
|
19
19
|
import { buildAgentForest, flattenForest } from "./agentTree.ts";
|
|
20
20
|
import { parseTaskCounts, type TaskCounts } from "./todoParse.ts";
|
|
21
|
+
import { matchBadges } from "./badges.ts";
|
|
21
22
|
import {
|
|
22
23
|
classifyNeedsInput,
|
|
23
24
|
isWorkingScreen,
|
|
@@ -2128,6 +2129,17 @@ export async function extractNeedsInput(logPath: string, cli: string): Promise<N
|
|
|
2128
2129
|
return classifyNeedsInput(lines, { needsInput: cfg.needsInput, working: cfg.working });
|
|
2129
2130
|
}
|
|
2130
2131
|
|
|
2132
|
+
/**
|
|
2133
|
+
* Which badges (see badges.ts) match an agent's current screen — the same 32 KB
|
|
2134
|
+
* tail window `ay tail` renders, no CLI-specific config needed. Returns [] on
|
|
2135
|
+
* any read/render error or an empty log, same failure shape as extractNeedsInput.
|
|
2136
|
+
*/
|
|
2137
|
+
export async function extractBadges(logPath: string): Promise<string[]> {
|
|
2138
|
+
const lines = await renderLogTailLines(logPath, 40);
|
|
2139
|
+
if (!lines) return [];
|
|
2140
|
+
return matchBadges(lines);
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2131
2143
|
/**
|
|
2132
2144
|
* Whether an alive agent is wedged: its log has been silent for at least
|
|
2133
2145
|
* STUCK_THRESHOLD_MS yet its screen still shows a `working` busy marker (a live
|
|
@@ -2388,7 +2400,10 @@ export async function extractMenu(logPath: string, cli: string): Promise<MenuSta
|
|
|
2388
2400
|
|
|
2389
2401
|
/** Poll until the agent is no longer parked on a menu (selection accepted → it
|
|
2390
2402
|
* resumed / moved on) or the deadline passes. Returns true if it cleared. */
|
|
2391
|
-
async function waitForNeedsInputClear(
|
|
2403
|
+
async function waitForNeedsInputClear(
|
|
2404
|
+
record: GlobalPidRecord,
|
|
2405
|
+
timeoutMs: number,
|
|
2406
|
+
): Promise<boolean> {
|
|
2392
2407
|
const deadline = Date.now() + timeoutMs;
|
|
2393
2408
|
while (Date.now() < deadline) {
|
|
2394
2409
|
await new Promise((r) => setTimeout(r, 250));
|
|
@@ -2476,10 +2491,15 @@ async function cmdSend(rest: string[]): Promise<number> {
|
|
|
2476
2491
|
}
|
|
2477
2492
|
|
|
2478
2493
|
// When an agent sends, prefix one line so the recipient knows who pinged it
|
|
2479
|
-
// and exactly how to reply (to a resolvable pid — the sender's own).
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2494
|
+
// and exactly how to reply (to a resolvable pid — the sender's own). BUT a
|
|
2495
|
+
// slash command is only recognized when `/` is the very first character of the
|
|
2496
|
+
// submitted message; the prefix would bump it to line 2 and the CLI would type
|
|
2497
|
+
// the command as plain text. So skip the prefix for a command body and send it
|
|
2498
|
+
// verbatim — attribution is dropped for the command, but it actually runs.
|
|
2499
|
+
const prefix =
|
|
2500
|
+
sender.agent && !isSlashCommand(body)
|
|
2501
|
+
? `[from ${sender.agent.cli} #${sender.agent.pid} @ ${shortenPath(sender.agent.cwd)} — reply: ay send ${sender.agent.pid} "..."]\n`
|
|
2502
|
+
: "";
|
|
2483
2503
|
|
|
2484
2504
|
const fullBody = prefix + body;
|
|
2485
2505
|
if (fullBody && trailing) {
|
|
@@ -2610,9 +2630,7 @@ async function cmdSelect(rest: string[]): Promise<number> {
|
|
|
2610
2630
|
const keyword = argv._[0] !== undefined ? String(argv._[0]) : undefined;
|
|
2611
2631
|
const n = Number(argv._[1]);
|
|
2612
2632
|
if (!keyword || !Number.isInteger(n) || n < 1) {
|
|
2613
|
-
throw new Error(
|
|
2614
|
-
"usage: ay select <keyword> <N> (N = the 1-based option number to choose)",
|
|
2615
|
-
);
|
|
2633
|
+
throw new Error("usage: ay select <keyword> <N> (N = the 1-based option number to choose)");
|
|
2616
2634
|
}
|
|
2617
2635
|
|
|
2618
2636
|
const opts: CommonOpts = {
|
|
@@ -2624,7 +2642,9 @@ async function cmdSelect(rest: string[]): Promise<number> {
|
|
|
2624
2642
|
};
|
|
2625
2643
|
const record = await resolveWritableAgent(keyword, opts);
|
|
2626
2644
|
if (!record.log_file) {
|
|
2627
|
-
throw new Error(
|
|
2645
|
+
throw new Error(
|
|
2646
|
+
`pid ${record.pid}: no log_file recorded — can't read the menu to select from.`,
|
|
2647
|
+
);
|
|
2628
2648
|
}
|
|
2629
2649
|
const force = Boolean(argv.force) || process.env.AGENT_YES_FORCE_SEND === "1";
|
|
2630
2650
|
await enforceSendGuards(record, force);
|
|
@@ -2636,9 +2656,7 @@ async function cmdSelect(rest: string[]): Promise<number> {
|
|
|
2636
2656
|
);
|
|
2637
2657
|
}
|
|
2638
2658
|
if (menu.options.length > 0 && !menu.options.includes(n)) {
|
|
2639
|
-
throw new Error(
|
|
2640
|
-
`option ${n} is out of range — this menu offers ${menu.options.join(", ")}.`,
|
|
2641
|
-
);
|
|
2659
|
+
throw new Error(`option ${n} is out of range — this menu offers ${menu.options.join(", ")}.`);
|
|
2642
2660
|
}
|
|
2643
2661
|
|
|
2644
2662
|
// Move the cursor from where it sits to option N, then confirm. Delta from the
|
|
@@ -2648,7 +2666,8 @@ async function cmdSelect(rest: string[]): Promise<number> {
|
|
|
2648
2666
|
await writeKeysPaced(record.fifo_file!, byteSeqs, Math.max(0, argv.pace));
|
|
2649
2667
|
|
|
2650
2668
|
const delta = n - menu.cursor;
|
|
2651
|
-
const moved =
|
|
2669
|
+
const moved =
|
|
2670
|
+
delta === 0 ? "cursor already there" : `${Math.abs(delta)}× ${delta > 0 ? "down" : "up"}`;
|
|
2652
2671
|
process.stdout.write(
|
|
2653
2672
|
`pid ${record.pid} (${record.cli}): selected option ${n} (${moved} + enter)\n`,
|
|
2654
2673
|
);
|
|
@@ -2917,6 +2936,14 @@ export function isExitRequest(body: string): boolean {
|
|
|
2917
2936
|
return t === "exit" || t === "/exit";
|
|
2918
2937
|
}
|
|
2919
2938
|
|
|
2939
|
+
/** A body that the CLI will parse as a slash command — `/` as the very first
|
|
2940
|
+
* character (claude requires column 0, no leading whitespace, then a letter).
|
|
2941
|
+
* Such a body must be sent verbatim: any prefix line bumps the `/` off column 0
|
|
2942
|
+
* and the CLI types the command as plain text instead of running it. */
|
|
2943
|
+
export function isSlashCommand(body: string): boolean {
|
|
2944
|
+
return /^\/[A-Za-z]/.test(body);
|
|
2945
|
+
}
|
|
2946
|
+
|
|
2920
2947
|
/**
|
|
2921
2948
|
* Gracefully terminate a live agent and record WHY in its note (the audit trail
|
|
2922
2949
|
* shown by `ay ls`). Sends the CLI's graceful-exit command (e.g. claude's
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "./ts-j34CxbQs.js";
|
|
2
|
-
import "./logger-CDIsZ-Pp.js";
|
|
3
|
-
import "./versionChecker-CCPt7CpW.js";
|
|
4
|
-
import "./pidStore-BfoBWUjc.js";
|
|
5
|
-
import "./globalPidIndex-DlmmJlO8.js";
|
|
6
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-CnvLgnlN.js";
|
|
7
|
-
|
|
8
|
-
export { SUPPORTED_CLIS };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./globalPidIndex-DlmmJlO8.js";
|
|
3
|
-
import "./configShared-CEyhl0WH.js";
|
|
4
|
-
import "./e2e-Bfw7qL9O.js";
|
|
5
|
-
import "./webrtcLink-CBZkZ-LT.js";
|
|
6
|
-
import "./remotes-T6nf0t3K.js";
|
|
7
|
-
import { A as writeToIpc, C as resolveReadWindow, D as snapshotStatus, E as runSubcommand, O as stopTipForCli, S as resolveOne, T as restartHintLines, _ as menuSelectKeys, a as cursorAbs, b as renderRawLog, c as extractNeedsInput, d as isAgentStuck, f as isExitRequest, g as matchKeyword, h as listRecords, i as controlCodeFromName, k as writeKeysPaced, l as extractTaskCounts, m as isSubcommand, n as READ_PAGE_DEFAULT, o as deriveLiveStatus, p as isPidAlive, r as cmdHelp, s as extractMenu, t as GRACEFUL_EXIT_COMMANDS, u as finalizedLines, v as readNotes, w as resolveResumeArgs, x as renderRawLogLines, y as readPtysize } from "./subcommands-gqQYqyVj.js";
|
|
8
|
-
|
|
9
|
-
export { cmdHelp, isSubcommand, runSubcommand };
|