agent-yes 1.254.1 → 1.255.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-BhbSi4ge.js → SUPPORTED_CLIS-BcY0IFUv.js} +2 -2
- package/dist/{SUPPORTED_CLIS-B-5GyU4X.js → SUPPORTED_CLIS-BzTf3bQ0.js} +3 -3
- package/dist/{agentShare-DJUHQE7G.js → agentShare-t1ZInzMI.js} +2 -2
- package/dist/{callback-CjSG-k5Y.js → callback-CGW3ODrJ.js} +2 -2
- package/dist/{callback-BskCzu9w.js → callback-CdshQxV7.js} +3 -3
- package/dist/cli.js +5 -5
- package/dist/{expose-BU3f7VfC.js → expose-BiJ-51Hm.js} +5 -2
- package/dist/index.js +2 -2
- package/dist/{notifyDaemon-C5XnK-C-.js → notifyDaemon-C_OmCogQ.js} +2 -2
- package/dist/{rustBinary-B9j6gcT9.js → rustBinary-CvMtlJ1s.js} +2 -2
- package/dist/{schedule-D6BJ6rQT.js → schedule-Bs_afpJx.js} +4 -4
- package/dist/{serve-C144WsGZ.js → serve-Df4M7wW_.js} +17 -17
- package/dist/{setup-dzmrjuFt.js → setup-Bw9l8rmh.js} +2 -2
- package/dist/{subcommands-BXWKGKOs.js → subcommands-CH2j-t3B.js} +1 -1
- package/dist/{subcommands-CXgnLEHh.js → subcommands-CHnQJIAF.js} +69 -15
- package/dist/{terminal-DlqujOus.js → terminal-DzezN9Jw.js} +2 -2
- package/dist/trayApp-Dvs-PaNc.js +5 -0
- package/dist/{trayApp-Ca8Dy08u.js → trayApp-tw_Xs_pV.js} +2 -2
- package/dist/{ts-Dt98NjsD.js → ts-xNk6v7mb.js} +2 -2
- package/dist/{versionChecker-B3A6WFDx.js → versionChecker-CKhp4L8u.js} +2 -2
- package/dist/{widget-D-7wc9Qr.js → widget-BBbqoR84.js} +3 -3
- package/dist/{ws-CfpP43k5.js → ws-DDwHaLJu.js} +3 -2
- package/lab/ui/index.html +2 -1
- package/package.json +2 -2
- package/scripts/build-rs.ts +3 -1
- package/ts/agentPermissions.spec.ts +3 -3
- package/ts/notifyInbox.spec.ts +1 -1
- package/ts/ownerHeartbeat.spec.ts +17 -3
- package/ts/procStartTime.spec.ts +1 -3
- package/ts/procStartTime.ts +4 -1
- package/ts/subcommands.spec.ts +109 -0
- package/ts/subcommands.ts +61 -0
- package/ts/ws.spec.ts +23 -0
- package/ts/ws.ts +5 -1
- package/dist/trayApp-DPn0jqBP.js +0 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as CLIS_CONFIG } from "./ts-
|
|
1
|
+
import { t as CLIS_CONFIG } from "./ts-xNk6v7mb.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-BcY0IFUv.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./versionChecker-
|
|
3
|
-
import "./ts-
|
|
2
|
+
import "./versionChecker-CKhp4L8u.js";
|
|
3
|
+
import "./ts-xNk6v7mb.js";
|
|
4
4
|
import "./todoAutomation-BQRW614S.js";
|
|
5
5
|
import "./JsonlStore-CPGIR0Wy.js";
|
|
6
6
|
import "./globalPidIndex-D9DOSd-c.js";
|
|
7
7
|
import "./pidStore-vnX0bgra.js";
|
|
8
8
|
import "./messageLog-C-YIzhRj.js";
|
|
9
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-
|
|
9
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BcY0IFUv.js";
|
|
10
10
|
|
|
11
11
|
export { SUPPORTED_CLIS };
|
|
@@ -3,7 +3,7 @@ import "./globalPidIndex-D9DOSd-c.js";
|
|
|
3
3
|
import "./messageLog-C-YIzhRj.js";
|
|
4
4
|
import "./e2e-CEIdJGZ7.js";
|
|
5
5
|
import "./configShared-IBbnn9b8.js";
|
|
6
|
-
import { P as resolveOne } from "./subcommands-
|
|
6
|
+
import { P as resolveOne } from "./subcommands-CHnQJIAF.js";
|
|
7
7
|
import "./webrtcLink-BMYneHbu.js";
|
|
8
8
|
import "./remotes-a0bGDae9.js";
|
|
9
9
|
import { a as startShare } from "./share-BGl3wutJ.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-
|
|
232
|
+
//# sourceMappingURL=agentShare-t1ZInzMI.js.map
|
|
@@ -3,10 +3,10 @@ import "./globalPidIndex-D9DOSd-c.js";
|
|
|
3
3
|
import "./messageLog-C-YIzhRj.js";
|
|
4
4
|
import "./e2e-CEIdJGZ7.js";
|
|
5
5
|
import "./configShared-IBbnn9b8.js";
|
|
6
|
-
import "./subcommands-
|
|
6
|
+
import "./subcommands-CHnQJIAF.js";
|
|
7
7
|
import "./webrtcLink-BMYneHbu.js";
|
|
8
8
|
import "./remotes-a0bGDae9.js";
|
|
9
9
|
import "./callbackCore-Dd28_cBM.js";
|
|
10
|
-
import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-
|
|
10
|
+
import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-CdshQxV7.js";
|
|
11
11
|
|
|
12
12
|
export { cmdCallback };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as agentYesHome } from "./agentYesHome-CtmsY6I-.js";
|
|
2
|
-
import { P as resolveOne } from "./subcommands-
|
|
2
|
+
import { P as resolveOne } from "./subcommands-CHnQJIAF.js";
|
|
3
3
|
import { a as mintCapability, o as parseExpires } from "./callbackCore-Dd28_cBM.js";
|
|
4
4
|
import { randomBytes } from "node:crypto";
|
|
5
5
|
import { chmodSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
@@ -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-
|
|
75
|
+
const { resolveLocalServeUrl } = await import("./serve-Df4M7wW_.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-
|
|
190
|
+
//# sourceMappingURL=callback-CdshQxV7.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-
|
|
5
|
-
import { r as getRustBinary } from "./rustBinary-
|
|
4
|
+
import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-CKhp4L8u.js";
|
|
5
|
+
import { r as getRustBinary } from "./rustBinary-CvMtlJ1s.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, isUnknownManagerToken } = await import("./subcommands-
|
|
288
|
+
const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken } = await import("./subcommands-CH2j-t3B.js");
|
|
289
289
|
if (isHelpFlag && process.argv.length === 3) {
|
|
290
290
|
await cmdHelp(managerCommands);
|
|
291
291
|
process.exit(0);
|
|
@@ -295,7 +295,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
|
|
|
295
295
|
process.exit(code ?? 0);
|
|
296
296
|
}
|
|
297
297
|
{
|
|
298
|
-
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-
|
|
298
|
+
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-BzTf3bQ0.js");
|
|
299
299
|
if (isUnknownManagerToken(rawArg, managerCommands, SUPPORTED_CLIS)) {
|
|
300
300
|
process.stderr.write(`ay: unknown subcommand or CLI '${rawArg}'.\n See 'ay help' for subcommands. To run an agent, name a CLI:\n 'ay <cli> …' (e.g. 'ay claude …') or 'ay --cli <cli> …'.\n`);
|
|
301
301
|
process.exit(1);
|
|
@@ -346,7 +346,7 @@ if (config.useRust) {
|
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
if (rustBinary) {
|
|
349
|
-
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-
|
|
349
|
+
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-BzTf3bQ0.js");
|
|
350
350
|
const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
|
|
351
351
|
if (config.verbose) {
|
|
352
352
|
console.log(`[rust] Using binary: ${rustBinary}`);
|
|
@@ -243,8 +243,11 @@ var TunnelHost = class {
|
|
|
243
243
|
}
|
|
244
244
|
openWs(streamId, info) {
|
|
245
245
|
let ws;
|
|
246
|
+
let target = this.wsOrigin + this.localPath(info.path);
|
|
247
|
+
const pm = /^\/__codehost\/port\/(\d{1,5})(\/.*)?$/.exec(info.path);
|
|
248
|
+
if (pm) target = `ws://127.0.0.1:${pm[1]}${pm[2] || "/"}`;
|
|
246
249
|
try {
|
|
247
|
-
ws = new WebSocket(
|
|
250
|
+
ws = new WebSocket(target, info.protocols);
|
|
248
251
|
} catch (err) {
|
|
249
252
|
this.send(encodeJson(Op.WsOpenAck, streamId, {
|
|
250
253
|
ok: false,
|
|
@@ -546,4 +549,4 @@ async function cmdExpose(args) {
|
|
|
546
549
|
|
|
547
550
|
//#endregion
|
|
548
551
|
export { cmdExpose, ensureExposure, listExposures, stopExposure };
|
|
549
|
-
//# sourceMappingURL=expose-
|
|
552
|
+
//# sourceMappingURL=expose-BiJ-51Hm.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./versionChecker-
|
|
3
|
-
import { a as hasTodoStore, i as answerAsk, l as AgentContext, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-
|
|
2
|
+
import "./versionChecker-CKhp4L8u.js";
|
|
3
|
+
import { a as hasTodoStore, i as answerAsk, l as AgentContext, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-xNk6v7mb.js";
|
|
4
4
|
import { _ as isKnownKind, a as renderTree, b as statesOf, c as monitorHint, d as openStore, f as DONE_STATE, g as initialState, h as canTransition, i as renderDigest, l as CycleError, m as ORPHANED_STATE, o as unblockedTasks, p as LIFECYCLES, r as openBlockers, s as describeBlock, t as reconcileTodos, u as TodoStore, v as nextStates, x as removeControlCharacters, y as requiredGate } from "./todoAutomation-BQRW614S.js";
|
|
5
5
|
import "./JsonlStore-CPGIR0Wy.js";
|
|
6
6
|
import "./globalPidIndex-D9DOSd-c.js";
|
|
@@ -3,7 +3,7 @@ import "./globalPidIndex-D9DOSd-c.js";
|
|
|
3
3
|
import "./messageLog-C-YIzhRj.js";
|
|
4
4
|
import "./e2e-CEIdJGZ7.js";
|
|
5
5
|
import "./configShared-IBbnn9b8.js";
|
|
6
|
-
import { $ as shouldStealLock, C as listRecords, J as hostId, K as appendEvent, Q as readInbox, X as listInboxParents, Z as liveWatchers, _ as isPidAlive, c as deriveLiveState, et as daemonLockDir, j as renderLogTailLines, nt as notifyDir, q as gcInboxes, tt as daemonLockOwnerPath } from "./subcommands-
|
|
6
|
+
import { $ as shouldStealLock, C as listRecords, J as hostId, K as appendEvent, Q as readInbox, X as listInboxParents, Z as liveWatchers, _ as isPidAlive, c as deriveLiveState, et as daemonLockDir, j as renderLogTailLines, nt as notifyDir, q as gcInboxes, tt as daemonLockOwnerPath } from "./subcommands-CHnQJIAF.js";
|
|
7
7
|
import "./webrtcLink-BMYneHbu.js";
|
|
8
8
|
import "./remotes-a0bGDae9.js";
|
|
9
9
|
import { mkdir, readFile, rename, rm, stat, writeFile } from "fs/promises";
|
|
@@ -836,4 +836,4 @@ async function ensureDaemon() {
|
|
|
836
836
|
|
|
837
837
|
//#endregion
|
|
838
838
|
export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
|
|
839
|
-
//# sourceMappingURL=notifyDaemon-
|
|
839
|
+
//# sourceMappingURL=notifyDaemon-C_OmCogQ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as getInstalledPackage } from "./versionChecker-
|
|
1
|
+
import { r as getInstalledPackage } from "./versionChecker-CKhp4L8u.js";
|
|
2
2
|
import { execFileSync } from "child_process";
|
|
3
3
|
import { existsSync, mkdirSync, unlinkSync } from "fs";
|
|
4
4
|
import { chmod, copyFile } from "fs/promises";
|
|
@@ -243,4 +243,4 @@ async function getRustBinary(options = {}) {
|
|
|
243
243
|
|
|
244
244
|
//#endregion
|
|
245
245
|
export { findTrayLauncher as n, getRustBinary as r, findSpawnHiddenLauncher as t };
|
|
246
|
-
//# sourceMappingURL=rustBinary-
|
|
246
|
+
//# sourceMappingURL=rustBinary-CvMtlJ1s.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./versionChecker-
|
|
3
|
-
import "./ts-
|
|
2
|
+
import "./versionChecker-CKhp4L8u.js";
|
|
3
|
+
import "./ts-xNk6v7mb.js";
|
|
4
4
|
import "./todoAutomation-BQRW614S.js";
|
|
5
5
|
import "./JsonlStore-CPGIR0Wy.js";
|
|
6
6
|
import "./globalPidIndex-D9DOSd-c.js";
|
|
7
7
|
import "./pidStore-vnX0bgra.js";
|
|
8
8
|
import "./messageLog-C-YIzhRj.js";
|
|
9
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-
|
|
9
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BcY0IFUv.js";
|
|
10
10
|
import { f as resolveSpawnCwd } from "./workspaceConfig-CpilQzMY.js";
|
|
11
11
|
import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-BtL6Oo1o.js";
|
|
12
12
|
import { createHash } from "node:crypto";
|
|
@@ -153,4 +153,4 @@ async function cmdSchedule(rest) {
|
|
|
153
153
|
|
|
154
154
|
//#endregion
|
|
155
155
|
export { cmdSchedule };
|
|
156
|
-
//# sourceMappingURL=schedule-
|
|
156
|
+
//# sourceMappingURL=schedule-Bs_afpJx.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import { r as getInstalledPackage } from "./versionChecker-
|
|
3
|
-
import { t as findSpawnHiddenLauncher } from "./rustBinary-
|
|
4
|
-
import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-
|
|
2
|
+
import { r as getInstalledPackage } from "./versionChecker-CKhp4L8u.js";
|
|
3
|
+
import { t as findSpawnHiddenLauncher } from "./rustBinary-CvMtlJ1s.js";
|
|
4
|
+
import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-xNk6v7mb.js";
|
|
5
5
|
import { t as agentYesHome$1 } from "./agentYesHome-CtmsY6I-.js";
|
|
6
6
|
import { x as removeControlCharacters } from "./todoAutomation-BQRW614S.js";
|
|
7
7
|
import "./JsonlStore-CPGIR0Wy.js";
|
|
@@ -11,16 +11,16 @@ import { r as recordInbox } from "./messageLog-C-YIzhRj.js";
|
|
|
11
11
|
import { t as pgidForWrapper } from "./reaper-DP49VCKx.js";
|
|
12
12
|
import "./e2e-CEIdJGZ7.js";
|
|
13
13
|
import "./configShared-IBbnn9b8.js";
|
|
14
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-
|
|
15
|
-
import { A as recentReadEdges, C as listRecords, D as readNotes, G as writeToIpc, M as renderRawLog, N as renderRawLogLines, O as readPtysize, P as resolveOne, Y as isTransientLockMkdirError, f as extractNeedsInput, j as renderLogTailLines, k as recentMessageEdges, l as deriveLiveStatus, o as controlCodeFromName, p as extractTaskCounts, rt as TYPING_BADGE, u as extractBadges, x as isUserTyping, z as snapshotStatus } from "./subcommands-
|
|
14
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BcY0IFUv.js";
|
|
15
|
+
import { A as recentReadEdges, C as listRecords, D as readNotes, G as writeToIpc, M as renderRawLog, N as renderRawLogLines, O as readPtysize, P as resolveOne, Y as isTransientLockMkdirError, f as extractNeedsInput, j as renderLogTailLines, k as recentMessageEdges, l as deriveLiveStatus, o as controlCodeFromName, p as extractTaskCounts, rt as TYPING_BADGE, u as extractBadges, x as isUserTyping, z as snapshotStatus } from "./subcommands-CHnQJIAF.js";
|
|
16
16
|
import "./webrtcLink-BMYneHbu.js";
|
|
17
17
|
import "./remotes-a0bGDae9.js";
|
|
18
18
|
import { i as frameVisitorMessage, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-Dd28_cBM.js";
|
|
19
|
-
import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-
|
|
19
|
+
import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-CdshQxV7.js";
|
|
20
20
|
import { a as getProvisionRoot, d as isProvisionAllowed, f as resolveSpawnCwd, i as getProvisionHook, l as hasProvisionHook, o as getSpawnHook, t as allowsSkipPermissions, u as hasSpawnHook } from "./workspaceConfig-CpilQzMY.js";
|
|
21
21
|
import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-BtL6Oo1o.js";
|
|
22
22
|
import { r as spawnRejectionReason } from "./spawnGate-BFJPdHCQ.js";
|
|
23
|
-
import { i as launchTray } from "./trayApp-
|
|
23
|
+
import { i as launchTray } from "./trayApp-tw_Xs_pV.js";
|
|
24
24
|
import yargs from "yargs";
|
|
25
25
|
import { appendFile, mkdir, open, readFile, readdir, rename, rm, stat, unlink, writeFile } from "fs/promises";
|
|
26
26
|
import { arch, cpus, freemem, homedir, hostname, loadavg, platform, totalmem, uptime, userInfo } from "os";
|
|
@@ -2367,7 +2367,7 @@ Options:
|
|
|
2367
2367
|
}
|
|
2368
2368
|
});
|
|
2369
2369
|
if (req.method === "GET" && p === "/api/ws") {
|
|
2370
|
-
const ws = await import("./ws-
|
|
2370
|
+
const ws = await import("./ws-DDwHaLJu.js");
|
|
2371
2371
|
try {
|
|
2372
2372
|
await ws.loadProvision();
|
|
2373
2373
|
} catch (e) {
|
|
@@ -2387,7 +2387,7 @@ Options:
|
|
|
2387
2387
|
if (req.method === "GET" && p === "/api/ws/status") {
|
|
2388
2388
|
const dirRaw = url.searchParams.get("path");
|
|
2389
2389
|
if (!dirRaw) return new Response("missing ?path=<workspace dir>", { status: 400 });
|
|
2390
|
-
const ws = await import("./ws-
|
|
2390
|
+
const ws = await import("./ws-DDwHaLJu.js");
|
|
2391
2391
|
let prov;
|
|
2392
2392
|
try {
|
|
2393
2393
|
prov = await ws.loadProvision();
|
|
@@ -3144,7 +3144,7 @@ Options:
|
|
|
3144
3144
|
const perm = body.perm ?? "r";
|
|
3145
3145
|
if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
|
|
3146
3146
|
try {
|
|
3147
|
-
const { createScopedShare } = await import("./agentShare-
|
|
3147
|
+
const { createScopedShare } = await import("./agentShare-t1ZInzMI.js");
|
|
3148
3148
|
const share = await createScopedShare({
|
|
3149
3149
|
agent: body.agent,
|
|
3150
3150
|
perm,
|
|
@@ -3159,12 +3159,12 @@ Options:
|
|
|
3159
3159
|
}
|
|
3160
3160
|
}
|
|
3161
3161
|
if (req.method === "GET" && p === "/api/shares") {
|
|
3162
|
-
const { listShares } = await import("./agentShare-
|
|
3162
|
+
const { listShares } = await import("./agentShare-t1ZInzMI.js");
|
|
3163
3163
|
return Response.json(listShares());
|
|
3164
3164
|
}
|
|
3165
3165
|
const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
|
|
3166
3166
|
if (req.method === "DELETE" && revokeM) {
|
|
3167
|
-
const { revokeShare } = await import("./agentShare-
|
|
3167
|
+
const { revokeShare } = await import("./agentShare-t1ZInzMI.js");
|
|
3168
3168
|
const ok = revokeShare(decodeURIComponent(revokeM[1]));
|
|
3169
3169
|
return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
|
|
3170
3170
|
}
|
|
@@ -3178,7 +3178,7 @@ Options:
|
|
|
3178
3178
|
const port = Number(body.port);
|
|
3179
3179
|
if (!Number.isInteger(port) || port < 1 || port > 65535) return new Response("valid port required", { status: 400 });
|
|
3180
3180
|
try {
|
|
3181
|
-
const { ensureExposure } = await import("./expose-
|
|
3181
|
+
const { ensureExposure } = await import("./expose-BiJ-51Hm.js");
|
|
3182
3182
|
const h = await ensureExposure(port, body.relay);
|
|
3183
3183
|
return Response.json({
|
|
3184
3184
|
id: h.id,
|
|
@@ -3192,12 +3192,12 @@ Options:
|
|
|
3192
3192
|
}
|
|
3193
3193
|
}
|
|
3194
3194
|
if (req.method === "GET" && p === "/api/exposes") {
|
|
3195
|
-
const { listExposures } = await import("./expose-
|
|
3195
|
+
const { listExposures } = await import("./expose-BiJ-51Hm.js");
|
|
3196
3196
|
return Response.json(listExposures());
|
|
3197
3197
|
}
|
|
3198
3198
|
const unexposeM = /^\/api\/expose\/(\d+)$/.exec(p);
|
|
3199
3199
|
if (req.method === "DELETE" && unexposeM) {
|
|
3200
|
-
const { stopExposure } = await import("./expose-
|
|
3200
|
+
const { stopExposure } = await import("./expose-BiJ-51Hm.js");
|
|
3201
3201
|
const ok = stopExposure(Number(unexposeM[1]));
|
|
3202
3202
|
return new Response(ok ? "revoked" : "no such exposure", { status: ok ? 200 : 404 });
|
|
3203
3203
|
}
|
|
@@ -3466,7 +3466,7 @@ Options:
|
|
|
3466
3466
|
const shutdown = (resolve) => {
|
|
3467
3467
|
if (heartbeat) clearInterval(heartbeat);
|
|
3468
3468
|
closeShare?.();
|
|
3469
|
-
import("./agentShare-
|
|
3469
|
+
import("./agentShare-t1ZInzMI.js").then((m) => m.revokeAllShares()).catch(() => {});
|
|
3470
3470
|
server?.stop();
|
|
3471
3471
|
Promise.resolve(releaseHostLock?.()).catch(() => {}).then(resolve);
|
|
3472
3472
|
};
|
|
@@ -3479,4 +3479,4 @@ Options:
|
|
|
3479
3479
|
|
|
3480
3480
|
//#endregion
|
|
3481
3481
|
export { cmdServe, loadTokenReadOnly, mintScopedTermToken, resolveDaemonHttpBase, resolveLocalServeUrl };
|
|
3482
|
-
//# sourceMappingURL=serve-
|
|
3482
|
+
//# sourceMappingURL=serve-Df4M7wW_.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-Df4M7wW_.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-Bw9l8rmh.js.map
|
|
@@ -3,7 +3,7 @@ import "./globalPidIndex-D9DOSd-c.js";
|
|
|
3
3
|
import "./messageLog-C-YIzhRj.js";
|
|
4
4
|
import "./e2e-CEIdJGZ7.js";
|
|
5
5
|
import "./configShared-IBbnn9b8.js";
|
|
6
|
-
import { A as recentReadEdges, B as stdinActivityPath, C as listRecords, D as readNotes, E as readAgentPtysize, F as resolveReadWindow, G as writeToIpc, H as submitAndConfirm, I as resolveResumeArgs, L as restartHintLines, M as renderRawLog, N as renderRawLogLines, O as readPtysize, P as resolveOne, R as runSubcommand, S as lastStdinAt, T as menuSelectKeys, U as waitForLogQuiet, V as stopTipForCli, W as writeKeysPaced, _ as isPidAlive, a as cmdHelp, b as isUnknownManagerToken, c as deriveLiveState, d as extractMenu, f as extractNeedsInput, g as isExitRequest, h as isAgentStuck, i as backoffWhileTyping, j as renderLogTailLines, k as recentMessageEdges, 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 matchKeyword, x as isUserTyping, y as isSubcommand, z as snapshotStatus } from "./subcommands-
|
|
6
|
+
import { A as recentReadEdges, B as stdinActivityPath, C as listRecords, D as readNotes, E as readAgentPtysize, F as resolveReadWindow, G as writeToIpc, H as submitAndConfirm, I as resolveResumeArgs, L as restartHintLines, M as renderRawLog, N as renderRawLogLines, O as readPtysize, P as resolveOne, R as runSubcommand, S as lastStdinAt, T as menuSelectKeys, U as waitForLogQuiet, V as stopTipForCli, W as writeKeysPaced, _ as isPidAlive, a as cmdHelp, b as isUnknownManagerToken, c as deriveLiveState, d as extractMenu, f as extractNeedsInput, g as isExitRequest, h as isAgentStuck, i as backoffWhileTyping, j as renderLogTailLines, k as recentMessageEdges, 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 matchKeyword, x as isUserTyping, y as isSubcommand, z as snapshotStatus } from "./subcommands-CHnQJIAF.js";
|
|
7
7
|
import "./webrtcLink-BMYneHbu.js";
|
|
8
8
|
import "./remotes-a0bGDae9.js";
|
|
9
9
|
|
|
@@ -1168,6 +1168,58 @@ async function senderContext() {
|
|
|
1168
1168
|
};
|
|
1169
1169
|
}
|
|
1170
1170
|
/**
|
|
1171
|
+
* `ay whoami` — the calling agent's own canonical registration, resolved from
|
|
1172
|
+
* AGENT_YES_PID (see resolveSender). One command answers "which agent am I,
|
|
1173
|
+
* per the registry?": after a fleet restore, several agents can share a cwd
|
|
1174
|
+
* and a resumed conversation can believe it is a different lane than the
|
|
1175
|
+
* process actually registered as — the registry record is the ground truth
|
|
1176
|
+
* every routing surface (console, ay send, heartbeats) actually uses. Also
|
|
1177
|
+
* prints the traceable reply address so an agent can stamp outgoing messages
|
|
1178
|
+
* (`<ay-msg … reply: ay send <id> "...">`) without re-deriving its identity.
|
|
1179
|
+
*/
|
|
1180
|
+
async function cmdWhoami(rest) {
|
|
1181
|
+
const argv = await yargs(rest).usage("Usage: ay whoami [--json]").option("json", {
|
|
1182
|
+
type: "boolean",
|
|
1183
|
+
default: false,
|
|
1184
|
+
description: "Machine-readable output"
|
|
1185
|
+
}).help(false).version(false).exitProcess(false).parseAsync();
|
|
1186
|
+
const self = await resolveSender();
|
|
1187
|
+
if (!self) {
|
|
1188
|
+
const reason = process.env.AGENT_YES_PID ? "unregistered" : "no-agent-context";
|
|
1189
|
+
if (argv.json) process.stdout.write(JSON.stringify({
|
|
1190
|
+
agent: null,
|
|
1191
|
+
reason
|
|
1192
|
+
}) + "\n");
|
|
1193
|
+
else process.stderr.write(reason === "unregistered" ? `ay whoami: AGENT_YES_PID=${process.env.AGENT_YES_PID} is set but matches no record in the registry (stale env, or the record aged out)\n` : `ay whoami: not inside an agent-yes session — AGENT_YES_PID is unset (human shell)\n`);
|
|
1194
|
+
return 1;
|
|
1195
|
+
}
|
|
1196
|
+
const { state, question } = await deriveLiveState(self);
|
|
1197
|
+
const reply = `ay send ${self.agent_id ?? String(self.pid)}`;
|
|
1198
|
+
if (argv.json) {
|
|
1199
|
+
process.stdout.write(JSON.stringify({
|
|
1200
|
+
...self,
|
|
1201
|
+
state,
|
|
1202
|
+
question,
|
|
1203
|
+
reply
|
|
1204
|
+
}, null, 2) + "\n");
|
|
1205
|
+
return 0;
|
|
1206
|
+
}
|
|
1207
|
+
const ageMin = Math.max(0, Math.round((Date.now() - self.started_at) / 6e4));
|
|
1208
|
+
const lines = [
|
|
1209
|
+
`agent ${self.cli} #${self.pid}${self.agent_id ? ` (agent_id ${self.agent_id})` : ""}`,
|
|
1210
|
+
`state ${state}${question ? ` — ${question}` : ""}`,
|
|
1211
|
+
`cwd ${self.cwd}`,
|
|
1212
|
+
`started ${new Date(self.started_at).toISOString()} (${ageMin}m ago)`,
|
|
1213
|
+
`wrapper ${self.wrapper_pid ?? "-"} parent ${self.parent_pid ?? "- (top-level)"}`,
|
|
1214
|
+
`log ${self.log_file ?? "-"}`,
|
|
1215
|
+
`fifo ${self.fifo_file ?? "-"}`,
|
|
1216
|
+
`reply ${reply} "..."`,
|
|
1217
|
+
`envelope <ay-msg from ${self.cli} #${self.pid} @ ${self.cwd} — reply: ${reply} "...">…</ay-msg>`
|
|
1218
|
+
];
|
|
1219
|
+
process.stdout.write(lines.join("\n") + "\n");
|
|
1220
|
+
return 0;
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1171
1223
|
* Read the per-cwd TS PidStore JSONL and convert to the global record shape,
|
|
1172
1224
|
* so pre-existing TS agents that were spawned before the global-index mirror
|
|
1173
1225
|
* shipped still show up in `ay ls`. Merging is done in `mergeRecords`.
|
|
@@ -1228,6 +1280,7 @@ const SUBCOMMANDS = new Set([
|
|
|
1228
1280
|
"list",
|
|
1229
1281
|
"ps",
|
|
1230
1282
|
"status",
|
|
1283
|
+
"whoami",
|
|
1231
1284
|
"result",
|
|
1232
1285
|
"notify",
|
|
1233
1286
|
"notifyd",
|
|
@@ -1313,6 +1366,7 @@ async function runSubcommand(argv) {
|
|
|
1313
1366
|
case "list":
|
|
1314
1367
|
case "ps": return await cmdLs(rest);
|
|
1315
1368
|
case "status": return await cmdStatus(rest);
|
|
1369
|
+
case "whoami": return await cmdWhoami(rest);
|
|
1316
1370
|
case "result": return await cmdResult(rest);
|
|
1317
1371
|
case "notify": return await cmdNotify(rest);
|
|
1318
1372
|
case "notifyd": return await cmdNotifyd(rest);
|
|
@@ -1340,35 +1394,35 @@ async function runSubcommand(argv) {
|
|
|
1340
1394
|
return cmdCh(rest);
|
|
1341
1395
|
}
|
|
1342
1396
|
case "term": {
|
|
1343
|
-
const { cmdTerm } = await import("./terminal-
|
|
1397
|
+
const { cmdTerm } = await import("./terminal-DzezN9Jw.js");
|
|
1344
1398
|
return cmdTerm(rest);
|
|
1345
1399
|
}
|
|
1346
1400
|
case "widget": {
|
|
1347
|
-
const { cmdWidget } = await import("./widget-
|
|
1401
|
+
const { cmdWidget } = await import("./widget-BBbqoR84.js");
|
|
1348
1402
|
return cmdWidget(rest);
|
|
1349
1403
|
}
|
|
1350
1404
|
case "mint": {
|
|
1351
|
-
const { cmdMint } = await import("./widget-
|
|
1405
|
+
const { cmdMint } = await import("./widget-BBbqoR84.js");
|
|
1352
1406
|
return cmdMint(rest);
|
|
1353
1407
|
}
|
|
1354
1408
|
case "serve": {
|
|
1355
|
-
const { cmdServe } = await import("./serve-
|
|
1409
|
+
const { cmdServe } = await import("./serve-Df4M7wW_.js");
|
|
1356
1410
|
return cmdServe(rest);
|
|
1357
1411
|
}
|
|
1358
1412
|
case "tray": {
|
|
1359
|
-
const { cmdTray } = await import("./trayApp-
|
|
1413
|
+
const { cmdTray } = await import("./trayApp-Dvs-PaNc.js");
|
|
1360
1414
|
return cmdTray(rest);
|
|
1361
1415
|
}
|
|
1362
1416
|
case "setup": {
|
|
1363
|
-
const { cmdSetup } = await import("./setup-
|
|
1417
|
+
const { cmdSetup } = await import("./setup-Bw9l8rmh.js");
|
|
1364
1418
|
return cmdSetup(rest);
|
|
1365
1419
|
}
|
|
1366
1420
|
case "ws": {
|
|
1367
|
-
const { cmdWs } = await import("./ws-
|
|
1421
|
+
const { cmdWs } = await import("./ws-DDwHaLJu.js");
|
|
1368
1422
|
return cmdWs(rest);
|
|
1369
1423
|
}
|
|
1370
1424
|
case "schedule": {
|
|
1371
|
-
const { cmdSchedule } = await import("./schedule-
|
|
1425
|
+
const { cmdSchedule } = await import("./schedule-Bs_afpJx.js");
|
|
1372
1426
|
return cmdSchedule(rest);
|
|
1373
1427
|
}
|
|
1374
1428
|
case "remote": {
|
|
@@ -1376,11 +1430,11 @@ async function runSubcommand(argv) {
|
|
|
1376
1430
|
return cmdRemote(rest);
|
|
1377
1431
|
}
|
|
1378
1432
|
case "expose": {
|
|
1379
|
-
const { cmdExpose } = await import("./expose-
|
|
1433
|
+
const { cmdExpose } = await import("./expose-BiJ-51Hm.js");
|
|
1380
1434
|
return cmdExpose(rest);
|
|
1381
1435
|
}
|
|
1382
1436
|
case "callback": {
|
|
1383
|
-
const { cmdCallback } = await import("./callback-
|
|
1437
|
+
const { cmdCallback } = await import("./callback-CGW3ODrJ.js");
|
|
1384
1438
|
return cmdCallback(rest);
|
|
1385
1439
|
}
|
|
1386
1440
|
case "reap":
|
|
@@ -1418,7 +1472,7 @@ async function cmdHelp(managerCommands = true) {
|
|
|
1418
1472
|
const wsLines = managerCommands ? " ay ws ls [--status] list <owner>/<repo>/tree/<branch> workspaces\n ay ws new <owner>/<repo>[@branch] clone/refresh a workspace (ay ws help for more)\n" : ``;
|
|
1419
1473
|
const self = process.env.AGENT_YES_PID ? await resolveSender() : null;
|
|
1420
1474
|
const agentSection = self ? await buildAgentContextSection(self) : "";
|
|
1421
|
-
process.stdout.write(agentSection + "ay - agent-yes CLI\n\nManagement:\n ay ls [keyword] list running agents\n ay tail [-f] [-n N] <keyword> last N lines (96), -f to follow\n ay read <keyword> [page opts] paginate: --last/--head N, --range A:B,\n --before-line L [--limit N]\n ay cat <keyword> full log\n ay head <keyword> first N lines\n ay send <keyword> <msg> send a message (keyword '.' = agent in this cwd)\n ay msgs [keyword] [--in|--out] inter-agent message log (sent + received)\n ay ch mk|join|send|read|tail <topic> local-first E2E channels: AI ↔ humans on a topic (ay ch help)\n ay term embed <pid> <script> to embed a live read-only agent terminal in a page (ay term help)\n ay widget ls | read selection|dom read an opted-in page widget's context (selection/DOM) (ay widget help)\n ay mint <target> --caps ... mint a scoped, short-TTL capability token (embeddable in a page)\n ay key <keyword> <key...> send raw keystrokes (down/up/enter/esc/…) — drives menus\n ay select <keyword> <N> pick option N of a needs_input selection menu\n ay attach <keyword> interactive attach (detach: Ctrl-\\)\n ay stop <keyword> graceful shutdown (/exit for claude/codex)\n ay exit <keyword> [reason] graceful shutdown, recording who/why (= 'ay send <kw> exit')\n ay restart <keyword> [--fresh] stop (if live) + relaunch resuming the session; --fresh replays the prompt\n ay status <keyword> agent status snapshot\n ay result <keyword> [--wait] pull an agent's structured result envelope\n ay result set '<json>' (inside an agent) deposit your result envelope\n ay reap kill process groups leaked by dead agents\n" + wsLines + "\nRemote:\n" + setupLine + " ay schedule <when> <cli> -- <msg> run an agent on a schedule (HH:MM or cron)\n ay serve [--port N] start HTTP API server (prints token)\n ay serve status show serve daemon/server status\n ay remote add <alias> http://<token>@<host>:<port>\n ay remote ls / rm <alias> manage saved remotes\n ay expose <port> share localhost:<port> at https://<id>.agent-yes.com (private link)\n ay callback --expires 7d mint an embeddable message-me widget for one agent\n ay ls <token>@<host>:<port> connect inline (no alias needed)\n ay send <token>@<host>:<port>:<kw> <msg>\n\nRun an agent:\n ay [claude|codex|gemini|...] [options] -- [prompt]\n ay claude -- \"fix the bug in auth.ts\"\n ay claude --help full agent-runner options\n\nLabs (examples at https://github.com/snomiao/agent-yes/tree/main/lab):\n local-role-play/ designer + builder on one machine\n http-remote/ ay serve remote access demo\n p2p-pairing/ libp2p P2P (needs: cargo build --features swarm)\n");
|
|
1475
|
+
process.stdout.write(agentSection + "ay - agent-yes CLI\n\nManagement:\n ay ls [keyword] list running agents\n ay tail [-f] [-n N] <keyword> last N lines (96), -f to follow\n ay read <keyword> [page opts] paginate: --last/--head N, --range A:B,\n --before-line L [--limit N]\n ay cat <keyword> full log\n ay head <keyword> first N lines\n ay send <keyword> <msg> send a message (keyword '.' = agent in this cwd)\n ay msgs [keyword] [--in|--out] inter-agent message log (sent + received)\n ay ch mk|join|send|read|tail <topic> local-first E2E channels: AI ↔ humans on a topic (ay ch help)\n ay term embed <pid> <script> to embed a live read-only agent terminal in a page (ay term help)\n ay widget ls | read selection|dom read an opted-in page widget's context (selection/DOM) (ay widget help)\n ay mint <target> --caps ... mint a scoped, short-TTL capability token (embeddable in a page)\n ay key <keyword> <key...> send raw keystrokes (down/up/enter/esc/…) — drives menus\n ay select <keyword> <N> pick option N of a needs_input selection menu\n ay attach <keyword> interactive attach (detach: Ctrl-\\)\n ay stop <keyword> graceful shutdown (/exit for claude/codex)\n ay exit <keyword> [reason] graceful shutdown, recording who/why (= 'ay send <kw> exit')\n ay restart <keyword> [--fresh] stop (if live) + relaunch resuming the session; --fresh replays the prompt\n ay status <keyword> agent status snapshot\n ay whoami [--json] (inside an agent) your own registry identity + reply address\n ay result <keyword> [--wait] pull an agent's structured result envelope\n ay result set '<json>' (inside an agent) deposit your result envelope\n ay reap kill process groups leaked by dead agents\n" + wsLines + "\nRemote:\n" + setupLine + " ay schedule <when> <cli> -- <msg> run an agent on a schedule (HH:MM or cron)\n ay serve [--port N] start HTTP API server (prints token)\n ay serve status show serve daemon/server status\n ay remote add <alias> http://<token>@<host>:<port>\n ay remote ls / rm <alias> manage saved remotes\n ay expose <port> share localhost:<port> at https://<id>.agent-yes.com (private link)\n ay callback --expires 7d mint an embeddable message-me widget for one agent\n ay ls <token>@<host>:<port> connect inline (no alias needed)\n ay send <token>@<host>:<port>:<kw> <msg>\n\nRun an agent:\n ay [claude|codex|gemini|...] [options] -- [prompt]\n ay claude -- \"fix the bug in auth.ts\"\n ay claude --help full agent-runner options\n\nLabs (examples at https://github.com/snomiao/agent-yes/tree/main/lab):\n local-role-play/ designer + builder on one machine\n http-remote/ ay serve remote access demo\n p2p-pairing/ libp2p P2P (needs: cargo build --features swarm)\n");
|
|
1422
1476
|
return 0;
|
|
1423
1477
|
}
|
|
1424
1478
|
function matchKeyword(record, keyword) {
|
|
@@ -3789,7 +3843,7 @@ async function cmdAttach(rest) {
|
|
|
3789
3843
|
const winsizeDir = path.join(ayHome, "winsize");
|
|
3790
3844
|
await mkdir(winsizeDir, { recursive: true });
|
|
3791
3845
|
const winsizePath = path.join(winsizeDir, String(record.pid));
|
|
3792
|
-
const { resolveDaemonHttpBase, loadTokenReadOnly } = await import("./serve-
|
|
3846
|
+
const { resolveDaemonHttpBase, loadTokenReadOnly } = await import("./serve-Df4M7wW_.js");
|
|
3793
3847
|
const daemonBase = await resolveDaemonHttpBase().catch(() => null);
|
|
3794
3848
|
const daemonToken = daemonBase ? await loadTokenReadOnly().catch(() => null) ?? "" : "";
|
|
3795
3849
|
const capViewer = `attach:${process.pid}`;
|
|
@@ -4499,7 +4553,7 @@ async function cmdNotify(rest) {
|
|
|
4499
4553
|
}
|
|
4500
4554
|
const ensure = async () => {
|
|
4501
4555
|
if (!argv["ensure-daemon"]) return;
|
|
4502
|
-
const { ensureDaemon } = await import("./notifyDaemon-
|
|
4556
|
+
const { ensureDaemon } = await import("./notifyDaemon-C_OmCogQ.js");
|
|
4503
4557
|
await ensureDaemon().catch(() => null);
|
|
4504
4558
|
};
|
|
4505
4559
|
await heartbeatWatcher(parent, selfStartedAt);
|
|
@@ -4573,7 +4627,7 @@ async function cmdNotifyCursor(args) {
|
|
|
4573
4627
|
}
|
|
4574
4628
|
async function cmdNotifyd(rest) {
|
|
4575
4629
|
const sub = rest[0] ?? "status";
|
|
4576
|
-
const daemon = await import("./notifyDaemon-
|
|
4630
|
+
const daemon = await import("./notifyDaemon-C_OmCogQ.js");
|
|
4577
4631
|
switch (sub) {
|
|
4578
4632
|
case "run": return daemon.runDaemon();
|
|
4579
4633
|
case "once": return daemon.runDaemon({ once: true });
|
|
@@ -4600,4 +4654,4 @@ async function cmdNotifyd(rest) {
|
|
|
4600
4654
|
|
|
4601
4655
|
//#endregion
|
|
4602
4656
|
export { shouldStealLock as $, recentReadEdges as A, stdinActivityPath as B, listRecords as C, readNotes as D, readAgentPtysize as E, resolveReadWindow as F, writeToIpc as G, submitAndConfirm as H, resolveResumeArgs as I, hostId as J, appendEvent as K, restartHintLines as L, renderRawLog as M, renderRawLogLines as N, readPtysize as O, resolveOne as P, readInbox as Q, runSubcommand as R, lastStdinAt as S, menuSelectKeys as T, waitForLogQuiet as U, stopTipForCli as V, writeKeysPaced as W, listInboxParents as X, isTransientLockMkdirError as Y, liveWatchers as Z, isPidAlive as _, cmdHelp as a, isUnknownManagerToken as b, deriveLiveState as c, extractMenu as d, daemonLockDir as et, extractNeedsInput as f, isExitRequest as g, isAgentStuck as h, backoffWhileTyping as i, renderLogTailLines as j, recentMessageEdges as k, deriveLiveStatus as l, finalizedLines as m, READ_PAGE_DEFAULT as n, notifyDir as nt, controlCodeFromName as o, extractTaskCounts as p, gcInboxes as q, TYPING_WINDOW_MS as r, TYPING_BADGE as rt, cursorAbs as s, GRACEFUL_EXIT_COMMANDS as t, daemonLockOwnerPath as tt, extractBadges as u, isSlashCommand as v, matchKeyword as w, isUserTyping as x, isSubcommand as y, snapshotStatus as z };
|
|
4603
|
-
//# sourceMappingURL=subcommands-
|
|
4657
|
+
//# sourceMappingURL=subcommands-CHnQJIAF.js.map
|
|
@@ -98,7 +98,7 @@ async function cmdTermMint(args) {
|
|
|
98
98
|
if (flags.ro && flags.interactive) throw new Error("--ro and --interactive are mutually exclusive");
|
|
99
99
|
const ttlSec = parseTtlSec(typeof flags.ttl === "string" ? flags.ttl : "15m");
|
|
100
100
|
const canSend = flags.interactive === true;
|
|
101
|
-
const { mintScopedTermToken } = await import("./serve-
|
|
101
|
+
const { mintScopedTermToken } = await import("./serve-Df4M7wW_.js");
|
|
102
102
|
const r = await mintScopedTermToken(pid, {
|
|
103
103
|
ttlSec,
|
|
104
104
|
canSend
|
|
@@ -135,4 +135,4 @@ async function cmdTerm(args) {
|
|
|
135
135
|
|
|
136
136
|
//#endregion
|
|
137
137
|
export { cmdTerm };
|
|
138
|
-
//# sourceMappingURL=terminal-
|
|
138
|
+
//# sourceMappingURL=terminal-DzezN9Jw.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as findTrayLauncher } from "./rustBinary-
|
|
1
|
+
import { n as findTrayLauncher } from "./rustBinary-CvMtlJ1s.js";
|
|
2
2
|
import { t as agentYesHome } from "./agentYesHome-CtmsY6I-.js";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
@@ -97,4 +97,4 @@ async function cmdTray(args) {
|
|
|
97
97
|
|
|
98
98
|
//#endregion
|
|
99
99
|
export { trayHiddenMarker as a, launchTray as i, hasDesktop as n, isTrayHidden as r, cmdTray as t };
|
|
100
|
-
//# sourceMappingURL=trayApp-
|
|
100
|
+
//# sourceMappingURL=trayApp-tw_Xs_pV.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __esmMin, r as __exportAll } from "./chunk-cZBX9HZv.js";
|
|
2
2
|
import { n as logger, t as addTransport } from "./logger-CDIsZ-Pp.js";
|
|
3
|
-
import { r as getInstalledPackage } from "./versionChecker-
|
|
3
|
+
import { r as getInstalledPackage } from "./versionChecker-CKhp4L8u.js";
|
|
4
4
|
import { t as agentYesHome } from "./agentYesHome-CtmsY6I-.js";
|
|
5
5
|
import { d as openStore, p as LIFECYCLES, x as removeControlCharacters } from "./todoAutomation-BQRW614S.js";
|
|
6
6
|
import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-DBoONoM-.js";
|
|
@@ -2155,4 +2155,4 @@ function sleep(ms) {
|
|
|
2155
2155
|
|
|
2156
2156
|
//#endregion
|
|
2157
2157
|
export { hasTodoStore as a, permissionBadge as c, answerAsk as i, AgentContext as l, agentYes as n, listAsks as o, config as r, listAsksForProject as s, CLIS_CONFIG as t, CLAUDE_SESSION_PIN_ENV as u };
|
|
2158
|
-
//# sourceMappingURL=ts-
|
|
2158
|
+
//# sourceMappingURL=ts-xNk6v7mb.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.
|
|
10
|
+
var version = "1.255.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-CKhp4L8u.js.map
|
|
@@ -28,7 +28,7 @@ function parseFlags(args, known) {
|
|
|
28
28
|
}
|
|
29
29
|
/** Resolve the local daemon base URL + token (flags override discovery). */
|
|
30
30
|
async function daemonTarget(flags) {
|
|
31
|
-
const { resolveDaemonHttpBase, loadTokenReadOnly } = await import("./serve-
|
|
31
|
+
const { resolveDaemonHttpBase, loadTokenReadOnly } = await import("./serve-Df4M7wW_.js");
|
|
32
32
|
const base = typeof flags.base === "string" ? flags.base : await resolveDaemonHttpBase();
|
|
33
33
|
if (!base) throw new Error("no running ay serve daemon found — start `ay serve` or pass --base <url> (e.g. http://127.0.0.1:PORT)");
|
|
34
34
|
const token = typeof flags.token === "string" ? flags.token : await loadTokenReadOnly() ?? "";
|
|
@@ -186,7 +186,7 @@ async function cmdMint(args) {
|
|
|
186
186
|
const bad = caps.filter((c) => !KNOWN_CAPS.has(c));
|
|
187
187
|
if (bad.length) throw new Error(`unknown cap(s): ${bad.join(", ")} (valid: ${[...KNOWN_CAPS].join(", ")})`);
|
|
188
188
|
const ttlSec = parseTtlSec(typeof flags.ttl === "string" ? flags.ttl : "15m");
|
|
189
|
-
const { mintScopedTermToken } = await import("./serve-
|
|
189
|
+
const { mintScopedTermToken } = await import("./serve-Df4M7wW_.js");
|
|
190
190
|
const r = await mintScopedTermToken(target, {
|
|
191
191
|
ttlSec,
|
|
192
192
|
caps
|
|
@@ -202,4 +202,4 @@ async function cmdMint(args) {
|
|
|
202
202
|
|
|
203
203
|
//#endregion
|
|
204
204
|
export { cmdMint, cmdWidget };
|
|
205
|
-
//# sourceMappingURL=widget-
|
|
205
|
+
//# sourceMappingURL=widget-BBbqoR84.js.map
|
|
@@ -3,7 +3,7 @@ import "./globalPidIndex-D9DOSd-c.js";
|
|
|
3
3
|
import "./messageLog-C-YIzhRj.js";
|
|
4
4
|
import "./e2e-CEIdJGZ7.js";
|
|
5
5
|
import "./configShared-IBbnn9b8.js";
|
|
6
|
-
import { C as listRecords } from "./subcommands-
|
|
6
|
+
import { C as listRecords } from "./subcommands-CHnQJIAF.js";
|
|
7
7
|
import "./webrtcLink-BMYneHbu.js";
|
|
8
8
|
import "./remotes-a0bGDae9.js";
|
|
9
9
|
import { a as getProvisionRoot } from "./workspaceConfig-CpilQzMY.js";
|
|
@@ -362,6 +362,7 @@ async function cmdWsNew(args) {
|
|
|
362
362
|
}
|
|
363
363
|
if (!res.ok) {
|
|
364
364
|
process.stderr.write(`provision failed (${res.reason ?? "error"}): ${res.error ?? "unknown"}\n` + (res.reason === "branch-not-found" && !flags.create ? ` (branch missing on the remote — re-run with --create to branch off the default)\n` : ""));
|
|
365
|
+
if (res.reason === "auth-missing") for (const line of prov.gitAuthHint()) process.stderr.write(` ${line}\n`);
|
|
365
366
|
return 1;
|
|
366
367
|
}
|
|
367
368
|
process.stdout.write(`${res.action} ${res.folder}\n`);
|
|
@@ -418,4 +419,4 @@ async function cmdWs(args) {
|
|
|
418
419
|
|
|
419
420
|
//#endregion
|
|
420
421
|
export { WS_JSON_SCHEMA, cmdWs, collectWorkspaces, isPathInside, loadProvision, workspaceStatus };
|
|
421
|
-
//# sourceMappingURL=ws-
|
|
422
|
+
//# sourceMappingURL=ws-DDwHaLJu.js.map
|
package/lab/ui/index.html
CHANGED
|
@@ -6118,7 +6118,8 @@ my.translate = async (text, lang) => {
|
|
|
6118
6118
|
// native click so focus + link handling still work.
|
|
6119
6119
|
const now = Date.now();
|
|
6120
6120
|
const near =
|
|
6121
|
-
Math.abs(p.clientX - lastTapX) < DBL_SLOP &&
|
|
6121
|
+
Math.abs(p.clientX - lastTapX) < DBL_SLOP &&
|
|
6122
|
+
Math.abs(p.clientY - lastTapY) < DBL_SLOP;
|
|
6122
6123
|
tapCount = now - lastTapAt < DBL_MS && near ? tapCount + 1 : 1;
|
|
6123
6124
|
lastTapAt = now;
|
|
6124
6125
|
lastTapX = p.clientX;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-yes",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.255.0",
|
|
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",
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"@vitest/coverage-v8": "4.1.0",
|
|
164
164
|
"@xterm/addon-fit": "^0.11.0",
|
|
165
165
|
"@xterm/xterm": "^6.0.0",
|
|
166
|
-
"codehost": "^0.
|
|
166
|
+
"codehost": "^0.39.0",
|
|
167
167
|
"html2canvas-pro": "^2.3.1",
|
|
168
168
|
"husky": "^9.1.7",
|
|
169
169
|
"lint-staged": "^16.2.7",
|
package/scripts/build-rs.ts
CHANGED
|
@@ -132,7 +132,9 @@ if (fast || dev) {
|
|
|
132
132
|
copyFileSync(built, tmp);
|
|
133
133
|
renameSync(tmp, dest);
|
|
134
134
|
console.log(`[build-rs] installed ${dest}`);
|
|
135
|
-
console.log(
|
|
135
|
+
console.log(
|
|
136
|
+
`[build-rs] NOTE: dev build — run \`bun run build:rs\` for the fully-optimized shipped binary`,
|
|
137
|
+
);
|
|
136
138
|
} else {
|
|
137
139
|
// Build failed and cargo never wrote a fresh binary — restore anything the
|
|
138
140
|
// Windows lock-aside moved, else ayrs.exe would be missing from PATH.
|
|
@@ -10,9 +10,9 @@ describe("derivePermissions", () => {
|
|
|
10
10
|
const YES = ["--dangerously-skip-permissions"];
|
|
11
11
|
|
|
12
12
|
it("detects the configured yolo flag", () => {
|
|
13
|
-
expect(
|
|
14
|
-
|
|
15
|
-
)
|
|
13
|
+
expect(derivePermissions({ cliArgs: ["--print", ...YES], yesArgs: YES }).skip_permissions).toBe(
|
|
14
|
+
true,
|
|
15
|
+
);
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
it("detects a dangerous flag the config never declared", () => {
|
package/ts/notifyInbox.spec.ts
CHANGED
|
@@ -234,7 +234,7 @@ describe("notifyInbox — emergency rotation (#169.3)", () => {
|
|
|
234
234
|
|
|
235
235
|
it("returns events in ascending seq order (append order preserved)", () => {
|
|
236
236
|
const kept = emergencyKeep(many(), 1, 10);
|
|
237
|
-
expect(kept.map((e) => e.seq)).toEqual(
|
|
237
|
+
expect(kept.map((e) => e.seq)).toEqual(kept.map((e) => e.seq).sort((a, b) => a - b));
|
|
238
238
|
});
|
|
239
239
|
});
|
|
240
240
|
|
|
@@ -2,7 +2,11 @@ import { afterEach, describe, expect, it } from "vitest";
|
|
|
2
2
|
import { mkdtemp, readFile, rm, writeFile } from "fs/promises";
|
|
3
3
|
import { tmpdir } from "os";
|
|
4
4
|
import path from "path";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
startInlineHeartbeat,
|
|
7
|
+
startOwnerHeartbeat,
|
|
8
|
+
type OwnerHeartbeat,
|
|
9
|
+
} from "./ownerHeartbeat.ts";
|
|
6
10
|
|
|
7
11
|
// Issue #169 item 5. The daemon's proof-of-life is a `ts` it refreshes in the
|
|
8
12
|
// lock owner file; if that stamp goes stale another `ay notify watch` steals the
|
|
@@ -58,7 +62,12 @@ for (const [name, start] of [
|
|
|
58
62
|
it("refreshes ts while the owner still carries our token", async () => {
|
|
59
63
|
const file = await ownerFile("tok-a");
|
|
60
64
|
track(
|
|
61
|
-
start({
|
|
65
|
+
start({
|
|
66
|
+
ownerPath: file,
|
|
67
|
+
token: "tok-a",
|
|
68
|
+
payload: { token: "tok-a" },
|
|
69
|
+
intervalMs: BEAT_MS,
|
|
70
|
+
}),
|
|
62
71
|
);
|
|
63
72
|
expect(await beaten(file)).toBe(true);
|
|
64
73
|
});
|
|
@@ -97,7 +106,12 @@ for (const [name, start] of [
|
|
|
97
106
|
// the rename instead of resurrecting an owner file it no longer owns.
|
|
98
107
|
const file = await ownerFile("tok-c");
|
|
99
108
|
track(
|
|
100
|
-
start({
|
|
109
|
+
start({
|
|
110
|
+
ownerPath: file,
|
|
111
|
+
token: "tok-c",
|
|
112
|
+
payload: { token: "tok-c" },
|
|
113
|
+
intervalMs: BEAT_MS,
|
|
114
|
+
}),
|
|
101
115
|
);
|
|
102
116
|
expect(await beaten(file)).toBe(true);
|
|
103
117
|
await rm(path.dirname(file), { recursive: true, force: true });
|
package/ts/procStartTime.spec.ts
CHANGED
|
@@ -36,9 +36,7 @@ describe("osProcessStartToken", () => {
|
|
|
36
36
|
const stat = `7 (agent) ${after("555")}`;
|
|
37
37
|
|
|
38
38
|
it("uses /proc on linux", () => {
|
|
39
|
-
expect(
|
|
40
|
-
osProcessStartToken(7, { platform: "linux", readProcStat: () => stat }),
|
|
41
|
-
).toBe("555");
|
|
39
|
+
expect(osProcessStartToken(7, { platform: "linux", readProcStat: () => stat })).toBe("555");
|
|
42
40
|
});
|
|
43
41
|
|
|
44
42
|
it("uses ps lstart on darwin/bsd", () => {
|
package/ts/procStartTime.ts
CHANGED
|
@@ -37,7 +37,10 @@ import { readFileSync } from "node:fs";
|
|
|
37
37
|
export function parseLinuxStartTime(stat: string): string | null {
|
|
38
38
|
const close = stat.lastIndexOf(")");
|
|
39
39
|
if (close < 0) return null;
|
|
40
|
-
const fields = stat
|
|
40
|
+
const fields = stat
|
|
41
|
+
.slice(close + 1)
|
|
42
|
+
.trim()
|
|
43
|
+
.split(/\s+/);
|
|
41
44
|
const starttime = fields[19];
|
|
42
45
|
return starttime && /^\d+$/.test(starttime) ? starttime : null;
|
|
43
46
|
}
|
package/ts/subcommands.spec.ts
CHANGED
|
@@ -2537,3 +2537,112 @@ describe("subcommands.resolveResumeArgs", () => {
|
|
|
2537
2537
|
});
|
|
2538
2538
|
});
|
|
2539
2539
|
});
|
|
2540
|
+
|
|
2541
|
+
describe("subcommands.cmdWhoami", () => {
|
|
2542
|
+
const envKey = "AGENT_YES_PID";
|
|
2543
|
+
let savedEnv: string | undefined;
|
|
2544
|
+
|
|
2545
|
+
beforeEach(() => {
|
|
2546
|
+
savedEnv = process.env[envKey];
|
|
2547
|
+
delete process.env[envKey];
|
|
2548
|
+
});
|
|
2549
|
+
afterEach(() => {
|
|
2550
|
+
if (savedEnv === undefined) delete process.env[envKey];
|
|
2551
|
+
else process.env[envKey] = savedEnv;
|
|
2552
|
+
});
|
|
2553
|
+
|
|
2554
|
+
it("outside an agent (no AGENT_YES_PID) exits 1 with a human-shell hint", async () => {
|
|
2555
|
+
const { runSubcommand } = await loadModule();
|
|
2556
|
+
const stderr: string[] = [];
|
|
2557
|
+
const orig = process.stderr.write.bind(process.stderr);
|
|
2558
|
+
(process.stderr as any).write = (s: any) => {
|
|
2559
|
+
stderr.push(String(s));
|
|
2560
|
+
return true;
|
|
2561
|
+
};
|
|
2562
|
+
try {
|
|
2563
|
+
const code = await runSubcommand(["bun", "cli.js", "whoami"]);
|
|
2564
|
+
expect(code).toBe(1);
|
|
2565
|
+
expect(stderr.join("")).toMatch(/AGENT_YES_PID is unset/);
|
|
2566
|
+
} finally {
|
|
2567
|
+
process.stderr.write = orig;
|
|
2568
|
+
}
|
|
2569
|
+
});
|
|
2570
|
+
|
|
2571
|
+
it("a set-but-unregistered AGENT_YES_PID reports 'unregistered' in --json and exits 1", async () => {
|
|
2572
|
+
const { runSubcommand } = await loadModule();
|
|
2573
|
+
process.env[envKey] = "999999";
|
|
2574
|
+
const stdout: string[] = [];
|
|
2575
|
+
const orig = process.stdout.write.bind(process.stdout);
|
|
2576
|
+
(process.stdout as any).write = (s: any) => {
|
|
2577
|
+
stdout.push(String(s));
|
|
2578
|
+
return true;
|
|
2579
|
+
};
|
|
2580
|
+
try {
|
|
2581
|
+
const code = await runSubcommand(["bun", "cli.js", "whoami", "--json"]);
|
|
2582
|
+
expect(code).toBe(1);
|
|
2583
|
+
} finally {
|
|
2584
|
+
process.stdout.write = orig;
|
|
2585
|
+
}
|
|
2586
|
+
expect(JSON.parse(stdout.join(""))).toEqual({ agent: null, reason: "unregistered" });
|
|
2587
|
+
});
|
|
2588
|
+
|
|
2589
|
+
it("resolves the caller via wrapper_pid and prints identity + reply address", async () => {
|
|
2590
|
+
const mod = await loadModule();
|
|
2591
|
+
const { appendGlobalPid } = await import("./globalPidIndex.ts");
|
|
2592
|
+
await appendGlobalPid({
|
|
2593
|
+
pid: process.pid, // alive, so live-state derivation doesn't read it as exited
|
|
2594
|
+
cli: "claude",
|
|
2595
|
+
prompt: "whoami test",
|
|
2596
|
+
cwd: "/repo/alpha",
|
|
2597
|
+
log_file: null,
|
|
2598
|
+
status: "active",
|
|
2599
|
+
exit_code: null,
|
|
2600
|
+
exit_reason: null,
|
|
2601
|
+
started_at: Date.now(),
|
|
2602
|
+
wrapper_pid: 424242,
|
|
2603
|
+
parent_pid: null,
|
|
2604
|
+
agent_id: "aaaa0000bbbb",
|
|
2605
|
+
});
|
|
2606
|
+
process.env[envKey] = "424242";
|
|
2607
|
+
|
|
2608
|
+
const stdout: string[] = [];
|
|
2609
|
+
const orig = process.stdout.write.bind(process.stdout);
|
|
2610
|
+
(process.stdout as any).write = (s: any) => {
|
|
2611
|
+
stdout.push(String(s));
|
|
2612
|
+
return true;
|
|
2613
|
+
};
|
|
2614
|
+
try {
|
|
2615
|
+
const code = await mod.runSubcommand(["bun", "cli.js", "whoami", "--json"]);
|
|
2616
|
+
expect(code).toBe(0);
|
|
2617
|
+
} finally {
|
|
2618
|
+
process.stdout.write = orig;
|
|
2619
|
+
}
|
|
2620
|
+
const parsed = JSON.parse(stdout.join(""));
|
|
2621
|
+
expect(parsed).toMatchObject({
|
|
2622
|
+
pid: process.pid,
|
|
2623
|
+
cli: "claude",
|
|
2624
|
+
cwd: "/repo/alpha",
|
|
2625
|
+
agent_id: "aaaa0000bbbb",
|
|
2626
|
+
wrapper_pid: 424242,
|
|
2627
|
+
reply: "ay send aaaa0000bbbb",
|
|
2628
|
+
});
|
|
2629
|
+
expect(typeof parsed.state).toBe("string");
|
|
2630
|
+
|
|
2631
|
+
// Human-readable form carries the traceable envelope template.
|
|
2632
|
+
const stdout2: string[] = [];
|
|
2633
|
+
(process.stdout as any).write = (s: any) => {
|
|
2634
|
+
stdout2.push(String(s));
|
|
2635
|
+
return true;
|
|
2636
|
+
};
|
|
2637
|
+
try {
|
|
2638
|
+
const code = await mod.runSubcommand(["bun", "cli.js", "whoami"]);
|
|
2639
|
+
expect(code).toBe(0);
|
|
2640
|
+
} finally {
|
|
2641
|
+
process.stdout.write = orig;
|
|
2642
|
+
}
|
|
2643
|
+
const text = stdout2.join("");
|
|
2644
|
+
expect(text).toMatch(/agent {5}claude #\d+ {2}\(agent_id aaaa0000bbbb\)/);
|
|
2645
|
+
expect(text).toMatch(/reply {5}ay send aaaa0000bbbb/);
|
|
2646
|
+
expect(text).toMatch(/<ay-msg from claude #\d+ @ \/repo\/alpha — reply: ay send aaaa0000bbbb "\.\.\.">/);
|
|
2647
|
+
});
|
|
2648
|
+
});
|
package/ts/subcommands.ts
CHANGED
|
@@ -277,6 +277,63 @@ async function senderContext(): Promise<{ key: string; agent: GlobalPidRecord |
|
|
|
277
277
|
return { key: agent ? `agent:${agent.pid}` : "human", agent };
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
+
/**
|
|
281
|
+
* `ay whoami` — the calling agent's own canonical registration, resolved from
|
|
282
|
+
* AGENT_YES_PID (see resolveSender). One command answers "which agent am I,
|
|
283
|
+
* per the registry?": after a fleet restore, several agents can share a cwd
|
|
284
|
+
* and a resumed conversation can believe it is a different lane than the
|
|
285
|
+
* process actually registered as — the registry record is the ground truth
|
|
286
|
+
* every routing surface (console, ay send, heartbeats) actually uses. Also
|
|
287
|
+
* prints the traceable reply address so an agent can stamp outgoing messages
|
|
288
|
+
* (`<ay-msg … reply: ay send <id> "...">`) without re-deriving its identity.
|
|
289
|
+
*/
|
|
290
|
+
async function cmdWhoami(rest: string[]): Promise<number> {
|
|
291
|
+
const y = yargs(rest)
|
|
292
|
+
.usage("Usage: ay whoami [--json]")
|
|
293
|
+
.option("json", { type: "boolean", default: false, description: "Machine-readable output" })
|
|
294
|
+
.help(false)
|
|
295
|
+
.version(false)
|
|
296
|
+
.exitProcess(false);
|
|
297
|
+
const argv = await y.parseAsync();
|
|
298
|
+
const self = await resolveSender();
|
|
299
|
+
if (!self) {
|
|
300
|
+
// Two distinct failures: no agent context at all (human shell), or a set
|
|
301
|
+
// AGENT_YES_PID that resolves to nothing (stale env / record aged out).
|
|
302
|
+
const reason = process.env.AGENT_YES_PID ? "unregistered" : "no-agent-context";
|
|
303
|
+
if (argv.json) {
|
|
304
|
+
process.stdout.write(JSON.stringify({ agent: null, reason }) + "\n");
|
|
305
|
+
} else {
|
|
306
|
+
process.stderr.write(
|
|
307
|
+
reason === "unregistered"
|
|
308
|
+
? `ay whoami: AGENT_YES_PID=${process.env.AGENT_YES_PID} is set but matches no record in the registry (stale env, or the record aged out)\n`
|
|
309
|
+
: `ay whoami: not inside an agent-yes session — AGENT_YES_PID is unset (human shell)\n`,
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
return 1;
|
|
313
|
+
}
|
|
314
|
+
const { state, question } = await deriveLiveState(self);
|
|
315
|
+
const replyKw = self.agent_id ?? String(self.pid);
|
|
316
|
+
const reply = `ay send ${replyKw}`;
|
|
317
|
+
if (argv.json) {
|
|
318
|
+
process.stdout.write(JSON.stringify({ ...self, state, question, reply }, null, 2) + "\n");
|
|
319
|
+
return 0;
|
|
320
|
+
}
|
|
321
|
+
const ageMin = Math.max(0, Math.round((Date.now() - self.started_at) / 60_000));
|
|
322
|
+
const lines = [
|
|
323
|
+
`agent ${self.cli} #${self.pid}${self.agent_id ? ` (agent_id ${self.agent_id})` : ""}`,
|
|
324
|
+
`state ${state}${question ? ` — ${question}` : ""}`,
|
|
325
|
+
`cwd ${self.cwd}`,
|
|
326
|
+
`started ${new Date(self.started_at).toISOString()} (${ageMin}m ago)`,
|
|
327
|
+
`wrapper ${self.wrapper_pid ?? "-"} parent ${self.parent_pid ?? "- (top-level)"}`,
|
|
328
|
+
`log ${self.log_file ?? "-"}`,
|
|
329
|
+
`fifo ${self.fifo_file ?? "-"}`,
|
|
330
|
+
`reply ${reply} "..."`,
|
|
331
|
+
`envelope <ay-msg from ${self.cli} #${self.pid} @ ${self.cwd} — reply: ${reply} "...">…</ay-msg>`,
|
|
332
|
+
];
|
|
333
|
+
process.stdout.write(lines.join("\n") + "\n");
|
|
334
|
+
return 0;
|
|
335
|
+
}
|
|
336
|
+
|
|
280
337
|
/**
|
|
281
338
|
* Read the per-cwd TS PidStore JSONL and convert to the global record shape,
|
|
282
339
|
* so pre-existing TS agents that were spawned before the global-index mirror
|
|
@@ -346,6 +403,7 @@ const SUBCOMMANDS = new Set([
|
|
|
346
403
|
"list",
|
|
347
404
|
"ps",
|
|
348
405
|
"status",
|
|
406
|
+
"whoami",
|
|
349
407
|
"result",
|
|
350
408
|
"notify",
|
|
351
409
|
"notifyd",
|
|
@@ -468,6 +526,8 @@ export async function runSubcommand(argv: string[]): Promise<number | null> {
|
|
|
468
526
|
return await cmdLs(rest);
|
|
469
527
|
case "status":
|
|
470
528
|
return await cmdStatus(rest);
|
|
529
|
+
case "whoami":
|
|
530
|
+
return await cmdWhoami(rest);
|
|
471
531
|
case "result":
|
|
472
532
|
return await cmdResult(rest);
|
|
473
533
|
case "notify":
|
|
@@ -672,6 +732,7 @@ export async function cmdHelp(managerCommands = true): Promise<number> {
|
|
|
672
732
|
` ay exit <keyword> [reason] graceful shutdown, recording who/why (= 'ay send <kw> exit')\n` +
|
|
673
733
|
` ay restart <keyword> [--fresh] stop (if live) + relaunch resuming the session; --fresh replays the prompt\n` +
|
|
674
734
|
` ay status <keyword> agent status snapshot\n` +
|
|
735
|
+
` ay whoami [--json] (inside an agent) your own registry identity + reply address\n` +
|
|
675
736
|
` ay result <keyword> [--wait] pull an agent's structured result envelope\n` +
|
|
676
737
|
` ay result set '<json>' (inside an agent) deposit your result envelope\n` +
|
|
677
738
|
` ay reap kill process groups leaked by dead agents\n` +
|
package/ts/ws.spec.ts
CHANGED
|
@@ -24,6 +24,7 @@ const prov = vi.hoisted(() => ({
|
|
|
24
24
|
provision: vi.fn(),
|
|
25
25
|
createBranch: vi.fn(),
|
|
26
26
|
forkWorktree: vi.fn(),
|
|
27
|
+
gitAuthHint: vi.fn(),
|
|
27
28
|
}));
|
|
28
29
|
|
|
29
30
|
vi.mock("codehost/provision", () => ({
|
|
@@ -35,6 +36,7 @@ vi.mock("codehost/provision", () => ({
|
|
|
35
36
|
provision: (spec: unknown, opts?: unknown) => prov.provision(spec, opts),
|
|
36
37
|
createBranch: (spec: unknown, opts?: unknown) => prov.createBranch(spec, opts),
|
|
37
38
|
forkWorktree: (opts: unknown) => prov.forkWorktree(opts),
|
|
39
|
+
gitAuthHint: (host?: string) => prov.gitAuthHint(host),
|
|
38
40
|
}));
|
|
39
41
|
|
|
40
42
|
describe("isPathInside", () => {
|
|
@@ -206,6 +208,7 @@ describe("cmdWs (mocked provision)", () => {
|
|
|
206
208
|
prov.provision.mockReset();
|
|
207
209
|
prov.createBranch.mockReset();
|
|
208
210
|
prov.forkWorktree.mockReset();
|
|
211
|
+
prov.gitAuthHint.mockReset().mockReturnValue([]);
|
|
209
212
|
out = [];
|
|
210
213
|
err = [];
|
|
211
214
|
vi.spyOn(process.stdout, "write").mockImplementation((s: any) => (out.push(String(s)), true));
|
|
@@ -421,6 +424,26 @@ describe("cmdWs (mocked provision)", () => {
|
|
|
421
424
|
expect(msg).not.toContain("--create");
|
|
422
425
|
});
|
|
423
426
|
|
|
427
|
+
it("new: auth-missing prints codehost's gitAuthHint lines", async () => {
|
|
428
|
+
prov.provision.mockResolvedValue({
|
|
429
|
+
ok: false,
|
|
430
|
+
action: "error",
|
|
431
|
+
reason: "auth-missing",
|
|
432
|
+
error: "could not read Username",
|
|
433
|
+
});
|
|
434
|
+
prov.gitAuthHint.mockReturnValue([
|
|
435
|
+
"⚠ this repo may be private, and no github.com credentials are available on this host.",
|
|
436
|
+
"To fix, run on the host:",
|
|
437
|
+
" gh auth login && gh auth setup-git",
|
|
438
|
+
"then retry this link.",
|
|
439
|
+
]);
|
|
440
|
+
expect(await cmdWs(["new", "o/r"])).toBe(1);
|
|
441
|
+
const msg = err.join("");
|
|
442
|
+
expect(msg).toContain("auth-missing");
|
|
443
|
+
expect(msg).toContain("gh auth login && gh auth setup-git");
|
|
444
|
+
expect(msg).not.toContain("--create");
|
|
445
|
+
});
|
|
446
|
+
|
|
424
447
|
it("fork: --from=<eq-form> and a stale AGENT_YES_PID both resolve", async () => {
|
|
425
448
|
prov.forkWorktree.mockResolvedValue({ ok: true, action: "forked", folder: "/f" });
|
|
426
449
|
expect(await cmdWs(["fork", "nb", `--from=${root}`])).toBe(0);
|
package/ts/ws.ts
CHANGED
|
@@ -52,7 +52,7 @@ interface ProvisionResult {
|
|
|
52
52
|
action: string;
|
|
53
53
|
git?: GitStatus;
|
|
54
54
|
error?: string;
|
|
55
|
-
reason?: "branch-not-found" | "repo-not-found" | "other";
|
|
55
|
+
reason?: "branch-not-found" | "repo-not-found" | "auth-missing" | "other";
|
|
56
56
|
}
|
|
57
57
|
interface Provision {
|
|
58
58
|
resolveWsRoot(wsRoot?: string): string;
|
|
@@ -67,6 +67,7 @@ interface Provision {
|
|
|
67
67
|
wsRoot?: string;
|
|
68
68
|
wip?: boolean;
|
|
69
69
|
}): Promise<ProvisionResult>;
|
|
70
|
+
gitAuthHint(host?: string): string[];
|
|
70
71
|
}
|
|
71
72
|
|
|
72
73
|
export async function loadProvision(): Promise<Provision> {
|
|
@@ -480,6 +481,9 @@ async function cmdWsNew(args: string[]): Promise<number> {
|
|
|
480
481
|
? ` (branch missing on the remote — re-run with --create to branch off the default)\n`
|
|
481
482
|
: ""),
|
|
482
483
|
);
|
|
484
|
+
if (res.reason === "auth-missing") {
|
|
485
|
+
for (const line of prov.gitAuthHint()) process.stderr.write(` ${line}\n`);
|
|
486
|
+
}
|
|
483
487
|
return 1;
|
|
484
488
|
}
|
|
485
489
|
process.stdout.write(`${res.action} ${res.folder}\n`);
|
package/dist/trayApp-DPn0jqBP.js
DELETED