agent-yes 1.304.1 → 1.304.2
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-Czys-z07.js +12 -0
- package/dist/{SUPPORTED_CLIS-D1BObsKi.js → SUPPORTED_CLIS-T7Sv53Bo.js} +2 -2
- package/dist/{agentShare-pQedI_ay.js → agentShare-2m6Z2vy2.js} +4 -4
- package/dist/{askCli-KmMf-3wA.js → askCli-Dtxxwl28.js} +3 -3
- package/dist/{callback-WJ1STnzc.js → callback-B38IQXNa.js} +4 -4
- package/dist/{callback-Bd_uX6c9.js → callback-DxPucqvt.js} +3 -3
- package/dist/cli.js +10 -10
- package/dist/{cmdKill-CzSBfWmx.js → cmdKill-DUyZ7Dch.js} +2 -2
- package/dist/{cmdPs-Bzld9JDB.js → cmdPs-BQ-U5pf8.js} +4 -4
- package/dist/{cwdConflictWarn-y-epQyOj.js → cwdConflictWarn-ml6Qs3Qu.js} +2 -2
- package/dist/{forkNested-3heLs5XC.js → forkNested-DHuYbpaf.js} +3 -3
- package/dist/{globalPidIndex-BsjlId-h.js → globalPidIndex-C6p_AY4D.js} +5 -2
- package/dist/globalPidIndex-DmDCB_X7.js +4 -0
- package/dist/index.js +4 -4
- package/dist/{notifyDaemon-D_fT6Xht.js → notifyDaemon-6FYHbi51.js} +4 -4
- package/dist/{parentLink-MBUD3oY2.js → parentLink-B7_kEM1v.js} +2 -2
- package/dist/{parentLink-BcAYcO9L.js → parentLink-UiM6WoKm.js} +2 -2
- package/dist/{parentPingLoop-CVqnIzti.js → parentPingLoop-CeKYccEV.js} +4 -4
- package/dist/pidStore-B89BOF_T.js +6 -0
- package/dist/{pidStore-C50VPk3E.js → pidStore-DUXifdBr.js} +2 -2
- package/dist/{rustBinary-AJOmpsZY.js → rustBinary-BJbqTNcY.js} +2 -2
- package/dist/{rustBinary-BEUXAC5F.js → rustBinary-DD2EpKiN.js} +2 -2
- package/dist/{schedule-CeSvliXR.js → schedule-BrSPuXnv.js} +6 -6
- package/dist/{serve-Dn24AExp.js → serve-Gx4dc4LJ.js} +24 -24
- package/dist/{setup-onxpwXOt.js → setup-7OfVzrI2.js} +2 -2
- package/dist/{shareCmd-Bfxkzdm6.js → shareCmd-CruQ5TDa.js} +5 -5
- package/dist/{spawnGate-Dj_WaS29.js → spawnGate-3YSXiRFS.js} +2 -2
- package/dist/spawnGate-I4p2fbz7.js +5 -0
- package/dist/{subcommands--RGuFC68.js → subcommands-BqXeFyvv.js} +102 -31
- package/dist/{subcommands-B-VG0io0.js → subcommands-DW-SDIw2.js} +3 -3
- package/dist/{terminal-Jsj7SgxD.js → terminal-D36_TtJ3.js} +2 -2
- package/dist/{todoCli-CU9vSJSJ.js → todoCli-uJ3nK9j4.js} +3 -3
- package/dist/{todoIdentity-CzS1e7VL.js → todoIdentity-DeDp7LKl.js} +2 -2
- package/dist/trayApp-4sRZjNFr.js +5 -0
- package/dist/{trayApp-lEZ-Wa4D.js → trayApp-Hm0H3QAF.js} +2 -2
- package/dist/{ts-DLPvUXQS.js → ts-C8pyst8x.js} +6 -6
- package/dist/{versionChecker-Dtj0d8dY.js → versionChecker-D_4wDPSc.js} +2 -2
- package/dist/{widget-CyoP4Stv.js → widget-DpJJm-o5.js} +3 -3
- package/dist/{ws-DtFNNKlC.js → ws-BPUFhNVb.js} +4 -4
- package/dist/{ws-CDZj5r8l.js → ws-DYCivkyv.js} +2 -2
- package/package.json +1 -1
- package/ts/subcommands.ts +97 -10
- package/dist/SUPPORTED_CLIS-R2KdLsVb.js +0 -12
- package/dist/globalPidIndex-uoz8Esqz.js +0 -4
- package/dist/pidStore-COkPjpW8.js +0 -6
- package/dist/spawnGate-Dfj9V76w.js +0 -5
- package/dist/trayApp-Bngl2X4e.js +0 -5
package/ts/subcommands.ts
CHANGED
|
@@ -28,7 +28,12 @@ import { appendFile, mkdir, open, readFile, rm, stat, writeFile } from "fs/promi
|
|
|
28
28
|
import ms from "ms";
|
|
29
29
|
import { homedir } from "os";
|
|
30
30
|
import path from "path";
|
|
31
|
-
import {
|
|
31
|
+
import {
|
|
32
|
+
getGlobalPidIndexPath,
|
|
33
|
+
type GlobalPidRecord,
|
|
34
|
+
readGlobalPids,
|
|
35
|
+
updateGlobalPidStatus,
|
|
36
|
+
} from "./globalPidIndex.ts";
|
|
32
37
|
import { formatIdentity, localHost, localUser } from "./identity.ts";
|
|
33
38
|
import { hostedRoomMember, roomAliasPlaceholder } from "./roomReplyAlias.ts";
|
|
34
39
|
import { buildAgentForest, flattenForest } from "./agentTree.ts";
|
|
@@ -3096,7 +3101,7 @@ async function cmdLs(rest: string[]): Promise<number> {
|
|
|
3096
3101
|
.option("interval", {
|
|
3097
3102
|
type: "number",
|
|
3098
3103
|
default: 2,
|
|
3099
|
-
description: "
|
|
3104
|
+
description: "Fallback poll interval in seconds for --watch on Windows",
|
|
3100
3105
|
})
|
|
3101
3106
|
.option("latest", {
|
|
3102
3107
|
type: "boolean",
|
|
@@ -3173,11 +3178,80 @@ async function cmdLs(rest: string[]): Promise<number> {
|
|
|
3173
3178
|
// its own fan-out. Output is the same `deriveLiveState` shape `ay ls --json`
|
|
3174
3179
|
// already reports, so consumers parse one schema.
|
|
3175
3180
|
if (argv.watch) {
|
|
3176
|
-
const
|
|
3177
|
-
|
|
3181
|
+
const fallbackMs = Math.max(500, (Number.isFinite(argv.interval) ? argv.interval : 2) * 1000);
|
|
3182
|
+
const rescanMs = Math.max(15_000, fallbackMs * 15);
|
|
3183
|
+
const tailers = new Map<
|
|
3184
|
+
string,
|
|
3185
|
+
{ child: ReturnType<typeof spawnChild>; identity: string | null }
|
|
3186
|
+
>();
|
|
3187
|
+
const indexFiles = new Set([
|
|
3188
|
+
getGlobalPidIndexPath(),
|
|
3189
|
+
path.join(process.cwd(), ".agent-yes", "pid-records.jsonl"),
|
|
3190
|
+
...(opts.cwdScope ? [path.join(opts.cwdScope, ".agent-yes", "pid-records.jsonl")] : []),
|
|
3191
|
+
]);
|
|
3192
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
3193
|
+
let fallback: ReturnType<typeof setInterval> | undefined;
|
|
3178
3194
|
let prev = new Map<number, LsAgentState>();
|
|
3179
|
-
|
|
3195
|
+
let pending = Promise.resolve();
|
|
3196
|
+
let closing = false;
|
|
3197
|
+
const identityOf = async (file: string): Promise<string | null> => {
|
|
3198
|
+
try {
|
|
3199
|
+
const info = await stat(file);
|
|
3200
|
+
return `${info.dev}:${info.ino}`;
|
|
3201
|
+
} catch {
|
|
3202
|
+
return null;
|
|
3203
|
+
}
|
|
3204
|
+
};
|
|
3205
|
+
const follow = async (file: string, checkIdentity = false): Promise<void> => {
|
|
3206
|
+
if (process.platform === "win32") return;
|
|
3207
|
+
const existing = tailers.get(file);
|
|
3208
|
+
if (existing && !checkIdentity) return;
|
|
3209
|
+
const identity = await identityOf(file);
|
|
3210
|
+
if (existing && (!checkIdentity || existing.identity === identity)) return;
|
|
3211
|
+
if (existing) {
|
|
3212
|
+
tailers.delete(file);
|
|
3213
|
+
existing.child.kill("SIGTERM");
|
|
3214
|
+
}
|
|
3215
|
+
// macOS tail -f follows appends with kqueue. Unlike -F it does not
|
|
3216
|
+
// poll for replacement; the slow rescan below detects a new inode.
|
|
3217
|
+
const child = spawnChild("tail", ["-f", "-n", "0", file], {
|
|
3218
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
3219
|
+
});
|
|
3220
|
+
child.stdout?.on("data", schedule);
|
|
3221
|
+
const forget = (): void => {
|
|
3222
|
+
if (tailers.get(file)?.child === child) tailers.delete(file);
|
|
3223
|
+
};
|
|
3224
|
+
child.on("error", forget);
|
|
3225
|
+
child.on("exit", forget);
|
|
3226
|
+
tailers.set(file, { child, identity });
|
|
3227
|
+
};
|
|
3228
|
+
const queueSnapshot = (checkIdentity = false): void => {
|
|
3229
|
+
pending = pending
|
|
3230
|
+
.then(() => snapshot(checkIdentity))
|
|
3231
|
+
.catch((error) => {
|
|
3232
|
+
process.stderr.write(`ay ls --watch: ${String(error)}\n`);
|
|
3233
|
+
});
|
|
3234
|
+
};
|
|
3235
|
+
const schedule = (): void => {
|
|
3236
|
+
if (closing) return;
|
|
3237
|
+
if (timer) clearTimeout(timer);
|
|
3238
|
+
timer = setTimeout(() => {
|
|
3239
|
+
queueSnapshot();
|
|
3240
|
+
}, 75);
|
|
3241
|
+
};
|
|
3242
|
+
const snapshot = async (checkIdentity = false): Promise<void> => {
|
|
3180
3243
|
const recs = await listRecords(keyword, opts);
|
|
3244
|
+
const targets = new Set([
|
|
3245
|
+
...indexFiles,
|
|
3246
|
+
...recs.map((record) => record.log_file).filter((file): file is string => !!file),
|
|
3247
|
+
]);
|
|
3248
|
+
for (const [file, follower] of tailers) {
|
|
3249
|
+
if (!targets.has(file)) {
|
|
3250
|
+
tailers.delete(file);
|
|
3251
|
+
follower.child.kill("SIGTERM");
|
|
3252
|
+
}
|
|
3253
|
+
}
|
|
3254
|
+
await Promise.all([...targets].map((file) => follow(file, checkIdentity)));
|
|
3181
3255
|
const cur: LsAgentState[] = await Promise.all(
|
|
3182
3256
|
recs.map(async (r) => {
|
|
3183
3257
|
const { state, question } = await deriveLiveState(r);
|
|
@@ -3188,15 +3262,28 @@ async function cmdLs(rest: string[]): Promise<number> {
|
|
|
3188
3262
|
for (const e of events) process.stdout.write(JSON.stringify(e) + "\n");
|
|
3189
3263
|
prev = next;
|
|
3190
3264
|
};
|
|
3191
|
-
|
|
3265
|
+
process.stderr.write(
|
|
3266
|
+
process.platform === "win32"
|
|
3267
|
+
? `watching agents with a ${fallbackMs / 1000}s fallback poll… (Ctrl-C to stop)\n`
|
|
3268
|
+
: `watching agent indexes and logs with tail -f; rescanning for replacement files every ${rescanMs / 1000}s… (Ctrl-C to stop)\n`,
|
|
3269
|
+
);
|
|
3270
|
+
// Start the index follower before the baseline so an agent registered
|
|
3271
|
+
// during startup is either included in the baseline or triggers a follow-up.
|
|
3272
|
+
for (const file of indexFiles) await follow(file);
|
|
3273
|
+
await snapshot();
|
|
3192
3274
|
await new Promise<void>((resolve) => {
|
|
3193
|
-
const timer = setInterval(() => {
|
|
3194
|
-
void tick();
|
|
3195
|
-
}, intervalMs);
|
|
3196
3275
|
process.on("SIGINT", () => {
|
|
3197
|
-
|
|
3276
|
+
closing = true;
|
|
3277
|
+
if (timer) clearTimeout(timer);
|
|
3278
|
+
if (fallback) clearInterval(fallback);
|
|
3279
|
+
for (const follower of tailers.values()) follower.child.kill("SIGTERM");
|
|
3198
3280
|
resolve();
|
|
3199
3281
|
});
|
|
3282
|
+
if (process.platform === "win32") {
|
|
3283
|
+
fallback = setInterval(schedule, fallbackMs);
|
|
3284
|
+
} else {
|
|
3285
|
+
fallback = setInterval(() => queueSnapshot(true), rescanMs);
|
|
3286
|
+
}
|
|
3200
3287
|
});
|
|
3201
3288
|
return 0;
|
|
3202
3289
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./versionChecker-Dtj0d8dY.js";
|
|
3
|
-
import "./ts-DLPvUXQS.js";
|
|
4
|
-
import "./todoAutomation-CKlrxuZv.js";
|
|
5
|
-
import "./JsonlStore-CB_0sfdT.js";
|
|
6
|
-
import "./globalPidIndex-BsjlId-h.js";
|
|
7
|
-
import "./pidStore-C50VPk3E.js";
|
|
8
|
-
import "./messageLog-Dq_ka-Bt.js";
|
|
9
|
-
import "./todoStore-msRCEUi1.js";
|
|
10
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-D1BObsKi.js";
|
|
11
|
-
|
|
12
|
-
export { SUPPORTED_CLIS };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import { a as readGlobalPids, i as pruneOldLogs, n as gcLogs, o as sweepOrphanLogs, r as maybeCompactGlobalPids, s as updateGlobalPidStatus, t as appendGlobalPid } from "./globalPidIndex-BsjlId-h.js";
|
|
3
|
-
|
|
4
|
-
export { gcLogs, readGlobalPids, updateGlobalPidStatus };
|
package/dist/trayApp-Bngl2X4e.js
DELETED