agent-yes 1.238.0 → 1.238.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-NpYW9OaR.js → SUPPORTED_CLIS-C2CFOND-.js} +2 -2
- package/dist/{SUPPORTED_CLIS-CtgC_d_l.js → SUPPORTED_CLIS-DmflHNKL.js} +3 -3
- package/dist/{agentShare-549Zwi_B.js → agentShare-CyDqjBM_.js} +2 -2
- package/dist/{callback-B-ojDckO.js → callback-Bb5dBd02.js} +2 -2
- package/dist/{callback-BNJMOVlW.js → callback-D-kUTlR6.js} +3 -3
- package/dist/cli.js +11 -4
- package/dist/index.js +2 -2
- package/dist/{notifyDaemon-CjBVeWRg.js → notifyDaemon-BjyUCpbx.js} +2 -2
- package/dist/{rustBinary-DSorJMBV.js → rustBinary-CCi6Sqh5.js} +2 -2
- package/dist/{schedule-Bw3SL5Hv.js → schedule-CHSe24Je.js} +4 -4
- package/dist/{serve-BLxmap1e.js → serve-CuMtnSLs.js} +31 -14
- package/dist/{setup-DlFVw_1n.js → setup-wPtsNZZ5.js} +2 -2
- package/dist/{subcommands-BdBCxZVu.js → subcommands-CuvZqZTM.js} +26 -12
- package/dist/subcommands-z2YriUNK.js +10 -0
- package/dist/{terminal-w7drEaJc.js → terminal-CBbBQMcT.js} +2 -2
- package/dist/{ts-EvHuyNA9.js → ts-Cnhsw8GN.js} +2 -2
- package/dist/{versionChecker-DNLNn_SL.js → versionChecker-CBzYImFt.js} +2 -2
- package/dist/{widget-Coav85Lx.js → widget-j4TWqwpU.js} +4 -4
- package/dist/{ws-3prv2in5.js → ws-53rrEEbz.js} +2 -2
- package/package.json +1 -1
- package/ts/cli.ts +18 -1
- package/ts/serve.ts +20 -0
- package/ts/subcommands.spec.ts +23 -0
- package/ts/subcommands.ts +19 -0
- package/ts/widget.ts +2 -2
- package/dist/subcommands-A0uOpmco.js +0 -10
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as CLIS_CONFIG } from "./ts-
|
|
1
|
+
import { t as CLIS_CONFIG } from "./ts-Cnhsw8GN.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-C2CFOND-.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./versionChecker-
|
|
3
|
-
import "./ts-
|
|
2
|
+
import "./versionChecker-CBzYImFt.js";
|
|
3
|
+
import "./ts-Cnhsw8GN.js";
|
|
4
4
|
import "./todoAutomation-Buo457VO.js";
|
|
5
5
|
import "./JsonlStore-CPGIR0Wy.js";
|
|
6
6
|
import "./globalPidIndex-D9DOSd-c.js";
|
|
7
7
|
import "./pidStore-6EZd5DUv.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-C2CFOND-.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-9wVlbPyC.js";
|
|
6
|
-
import {
|
|
6
|
+
import { P as resolveOne } from "./subcommands-CuvZqZTM.js";
|
|
7
7
|
import "./webrtcLink-VQhWmKOw.js";
|
|
8
8
|
import "./remotes-Bem6WIyU.js";
|
|
9
9
|
import { a as startShare } from "./share-B9u8-I3y.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-CyDqjBM_.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-9wVlbPyC.js";
|
|
6
|
-
import "./subcommands-
|
|
6
|
+
import "./subcommands-CuvZqZTM.js";
|
|
7
7
|
import "./webrtcLink-VQhWmKOw.js";
|
|
8
8
|
import "./remotes-Bem6WIyU.js";
|
|
9
9
|
import "./callbackCore-DAYcemCC.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-D-kUTlR6.js";
|
|
11
11
|
|
|
12
12
|
export { cmdCallback };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as agentYesHome } from "./agentYesHome-CtmsY6I-.js";
|
|
2
|
-
import {
|
|
2
|
+
import { P as resolveOne } from "./subcommands-CuvZqZTM.js";
|
|
3
3
|
import { a as mintCapability, o as parseExpires } from "./callbackCore-DAYcemCC.js";
|
|
4
4
|
import { randomBytes } from "node:crypto";
|
|
5
5
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
@@ -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-CuMtnSLs.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-D-kUTlR6.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 { n as getRustBinary } from "./rustBinary-
|
|
4
|
+
import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-CBzYImFt.js";
|
|
5
|
+
import { n as getRustBinary } from "./rustBinary-CCi6Sqh5.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 } = await import("./subcommands-
|
|
288
|
+
const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken } = await import("./subcommands-z2YriUNK.js");
|
|
289
289
|
if (isHelpFlag && process.argv.length === 3) {
|
|
290
290
|
await cmdHelp(managerCommands);
|
|
291
291
|
process.exit(0);
|
|
@@ -294,6 +294,13 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
|
|
|
294
294
|
const code = await runSubcommand(process.argv);
|
|
295
295
|
process.exit(code ?? 0);
|
|
296
296
|
}
|
|
297
|
+
{
|
|
298
|
+
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DmflHNKL.js");
|
|
299
|
+
if (isUnknownManagerToken(rawArg, managerCommands, SUPPORTED_CLIS)) {
|
|
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
|
+
process.exit(1);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
297
304
|
}
|
|
298
305
|
{
|
|
299
306
|
const { detectCwdDeprecation, SUPPRESS_CWD_WARN_ENV } = await import("./cwdDeprecation-Cd8Ykm2t.js");
|
|
@@ -339,7 +346,7 @@ if (config.useRust) {
|
|
|
339
346
|
}
|
|
340
347
|
}
|
|
341
348
|
if (rustBinary) {
|
|
342
|
-
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-
|
|
349
|
+
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DmflHNKL.js");
|
|
343
350
|
const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
|
|
344
351
|
if (config.verbose) {
|
|
345
352
|
console.log(`[rust] Using binary: ${rustBinary}`);
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./versionChecker-
|
|
3
|
-
import { a as hasTodoStore, c as AgentContext, i as answerAsk, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-
|
|
2
|
+
import "./versionChecker-CBzYImFt.js";
|
|
3
|
+
import { a as hasTodoStore, c as AgentContext, i as answerAsk, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-Cnhsw8GN.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-Buo457VO.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-9wVlbPyC.js";
|
|
6
|
-
import { $ as
|
|
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-CuvZqZTM.js";
|
|
7
7
|
import "./webrtcLink-VQhWmKOw.js";
|
|
8
8
|
import "./remotes-Bem6WIyU.js";
|
|
9
9
|
import { mkdir, readFile, rename, rm, stat, writeFile } from "fs/promises";
|
|
@@ -589,4 +589,4 @@ async function ensureDaemon() {
|
|
|
589
589
|
|
|
590
590
|
//#endregion
|
|
591
591
|
export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
|
|
592
|
-
//# sourceMappingURL=notifyDaemon-
|
|
592
|
+
//# sourceMappingURL=notifyDaemon-BjyUCpbx.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as getInstalledPackage } from "./versionChecker-
|
|
1
|
+
import { r as getInstalledPackage } from "./versionChecker-CBzYImFt.js";
|
|
2
2
|
import { execFileSync } from "child_process";
|
|
3
3
|
import { existsSync, mkdirSync, unlinkSync } from "fs";
|
|
4
4
|
import { chmod, copyFile } from "fs/promises";
|
|
@@ -225,4 +225,4 @@ async function getRustBinary(options = {}) {
|
|
|
225
225
|
|
|
226
226
|
//#endregion
|
|
227
227
|
export { getRustBinary as n, findSpawnHiddenLauncher as t };
|
|
228
|
-
//# sourceMappingURL=rustBinary-
|
|
228
|
+
//# sourceMappingURL=rustBinary-CCi6Sqh5.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./versionChecker-
|
|
3
|
-
import "./ts-
|
|
2
|
+
import "./versionChecker-CBzYImFt.js";
|
|
3
|
+
import "./ts-Cnhsw8GN.js";
|
|
4
4
|
import "./todoAutomation-Buo457VO.js";
|
|
5
5
|
import "./JsonlStore-CPGIR0Wy.js";
|
|
6
6
|
import "./globalPidIndex-D9DOSd-c.js";
|
|
7
7
|
import "./pidStore-6EZd5DUv.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-C2CFOND-.js";
|
|
10
10
|
import { d as resolveSpawnCwd } from "./workspaceConfig-B7HaQ-MI.js";
|
|
11
11
|
import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-Bf88NPqj.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-CHSe24Je.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 { i as answerAsk, l as CLAUDE_SESSION_PIN_ENV, o as listAsks } from "./ts-
|
|
2
|
+
import { r as getInstalledPackage } from "./versionChecker-CBzYImFt.js";
|
|
3
|
+
import { t as findSpawnHiddenLauncher } from "./rustBinary-CCi6Sqh5.js";
|
|
4
|
+
import { i as answerAsk, l as CLAUDE_SESSION_PIN_ENV, o as listAsks } from "./ts-Cnhsw8GN.js";
|
|
5
5
|
import { t as agentYesHome$1 } from "./agentYesHome-CtmsY6I-.js";
|
|
6
6
|
import { x as removeControlCharacters } from "./todoAutomation-Buo457VO.js";
|
|
7
7
|
import "./JsonlStore-CPGIR0Wy.js";
|
|
@@ -11,12 +11,12 @@ 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-9wVlbPyC.js";
|
|
14
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-
|
|
15
|
-
import { A as
|
|
14
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-C2CFOND-.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-CuvZqZTM.js";
|
|
16
16
|
import "./webrtcLink-VQhWmKOw.js";
|
|
17
17
|
import "./remotes-Bem6WIyU.js";
|
|
18
18
|
import { i as frameVisitorMessage, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-DAYcemCC.js";
|
|
19
|
-
import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-
|
|
19
|
+
import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-D-kUTlR6.js";
|
|
20
20
|
import { a as getSpawnHook, c as hasProvisionHook, d as resolveSpawnCwd, i as getProvisionRoot, l as hasSpawnHook, r as getProvisionHook, u as isProvisionAllowed } from "./workspaceConfig-B7HaQ-MI.js";
|
|
21
21
|
import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-Bf88NPqj.js";
|
|
22
22
|
import { r as spawnRejectionReason } from "./spawnGate-Bo_LFgt9.js";
|
|
@@ -1021,6 +1021,23 @@ async function resolveLocalServeUrl() {
|
|
|
1021
1021
|
const port = portFromArgs(daemonArgs);
|
|
1022
1022
|
return port ? `http://127.0.0.1:${port}` : null;
|
|
1023
1023
|
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Best-effort HTTP base URL of the LOCAL running daemon, for CLI→daemon calls
|
|
1026
|
+
* (`ay widget`). More robust than resolveLocalServeUrl for UNMANAGED daemons: it
|
|
1027
|
+
* also reads the portless proxy backend port (~/.portless/routes.json) and the
|
|
1028
|
+
* PORT env, so a daemon started outside oxmgr (e.g. a portless wrapper that injects
|
|
1029
|
+
* PORT) is still found without the caller having to pass --base. Null if nothing
|
|
1030
|
+
* local is discoverable.
|
|
1031
|
+
*/
|
|
1032
|
+
async function resolveDaemonHttpBase() {
|
|
1033
|
+
const managed = await resolveLocalServeUrl();
|
|
1034
|
+
if (managed) return managed;
|
|
1035
|
+
const pport = await portlessAppPort();
|
|
1036
|
+
if (pport) return `http://127.0.0.1:${pport}`;
|
|
1037
|
+
const envPort = process.env.AGENT_YES_SERVE_PORT || process.env.PORT;
|
|
1038
|
+
if (envPort && /^\d+$/.test(envPort)) return `http://127.0.0.1:${envPort}`;
|
|
1039
|
+
return null;
|
|
1040
|
+
}
|
|
1024
1041
|
async function warnStrayServeProcesses() {
|
|
1025
1042
|
const stray = await listStrayServeProcesses();
|
|
1026
1043
|
if (stray.length === 0) return;
|
|
@@ -2229,7 +2246,7 @@ Options:
|
|
|
2229
2246
|
}
|
|
2230
2247
|
});
|
|
2231
2248
|
if (req.method === "GET" && p === "/api/ws") {
|
|
2232
|
-
const ws = await import("./ws-
|
|
2249
|
+
const ws = await import("./ws-53rrEEbz.js");
|
|
2233
2250
|
try {
|
|
2234
2251
|
await ws.loadProvision();
|
|
2235
2252
|
} catch (e) {
|
|
@@ -2249,7 +2266,7 @@ Options:
|
|
|
2249
2266
|
if (req.method === "GET" && p === "/api/ws/status") {
|
|
2250
2267
|
const dirRaw = url.searchParams.get("path");
|
|
2251
2268
|
if (!dirRaw) return new Response("missing ?path=<workspace dir>", { status: 400 });
|
|
2252
|
-
const ws = await import("./ws-
|
|
2269
|
+
const ws = await import("./ws-53rrEEbz.js");
|
|
2253
2270
|
let prov;
|
|
2254
2271
|
try {
|
|
2255
2272
|
prov = await ws.loadProvision();
|
|
@@ -2971,7 +2988,7 @@ Options:
|
|
|
2971
2988
|
const perm = body.perm ?? "r";
|
|
2972
2989
|
if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
|
|
2973
2990
|
try {
|
|
2974
|
-
const { createScopedShare } = await import("./agentShare-
|
|
2991
|
+
const { createScopedShare } = await import("./agentShare-CyDqjBM_.js");
|
|
2975
2992
|
const share = await createScopedShare({
|
|
2976
2993
|
agent: body.agent,
|
|
2977
2994
|
perm,
|
|
@@ -2986,12 +3003,12 @@ Options:
|
|
|
2986
3003
|
}
|
|
2987
3004
|
}
|
|
2988
3005
|
if (req.method === "GET" && p === "/api/shares") {
|
|
2989
|
-
const { listShares } = await import("./agentShare-
|
|
3006
|
+
const { listShares } = await import("./agentShare-CyDqjBM_.js");
|
|
2990
3007
|
return Response.json(listShares());
|
|
2991
3008
|
}
|
|
2992
3009
|
const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
|
|
2993
3010
|
if (req.method === "DELETE" && revokeM) {
|
|
2994
|
-
const { revokeShare } = await import("./agentShare-
|
|
3011
|
+
const { revokeShare } = await import("./agentShare-CyDqjBM_.js");
|
|
2995
3012
|
const ok = revokeShare(decodeURIComponent(revokeM[1]));
|
|
2996
3013
|
return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
|
|
2997
3014
|
}
|
|
@@ -3293,7 +3310,7 @@ Options:
|
|
|
3293
3310
|
const shutdown = (resolve) => {
|
|
3294
3311
|
if (heartbeat) clearInterval(heartbeat);
|
|
3295
3312
|
closeShare?.();
|
|
3296
|
-
import("./agentShare-
|
|
3313
|
+
import("./agentShare-CyDqjBM_.js").then((m) => m.revokeAllShares()).catch(() => {});
|
|
3297
3314
|
server?.stop();
|
|
3298
3315
|
Promise.resolve(releaseHostLock?.()).catch(() => {}).then(resolve);
|
|
3299
3316
|
};
|
|
@@ -3305,5 +3322,5 @@ Options:
|
|
|
3305
3322
|
}
|
|
3306
3323
|
|
|
3307
3324
|
//#endregion
|
|
3308
|
-
export { cmdServe, loadTokenReadOnly, mintScopedTermToken, resolveLocalServeUrl };
|
|
3309
|
-
//# sourceMappingURL=serve-
|
|
3325
|
+
export { cmdServe, loadTokenReadOnly, mintScopedTermToken, resolveDaemonHttpBase, resolveLocalServeUrl };
|
|
3326
|
+
//# sourceMappingURL=serve-CuMtnSLs.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-CuMtnSLs.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-wPtsNZZ5.js.map
|
|
@@ -1212,6 +1212,20 @@ function isSubcommand(name, managerCommands = true) {
|
|
|
1212
1212
|
return SUBCOMMANDS.has(name) || managerCommands && MANAGER_SUBCOMMANDS.has(name);
|
|
1213
1213
|
}
|
|
1214
1214
|
/**
|
|
1215
|
+
* Footgun guard for the MANAGER entry (`ay`/`agent-yes`): true when the first arg
|
|
1216
|
+
* is a bare word (not a flag) that is neither a subcommand nor a known CLI — a
|
|
1217
|
+
* typo, or a newer subcommand run on an older build. The caller should error
|
|
1218
|
+
* rather than silently spawn an agent with the word as a prompt (taku 2026-07-26:
|
|
1219
|
+
* bare `ay <prompt>` is too dangerous; a spawn must name a CLI — `ay <cli> …` or
|
|
1220
|
+
* `--cli`). Never fires for cli-bound aliases (cy/claude-yes/…), where the first
|
|
1221
|
+
* word is legitimately the prompt, nor for flags or an empty invocation.
|
|
1222
|
+
*/
|
|
1223
|
+
function isUnknownManagerToken(rawArg, managerCommands, supportedClis) {
|
|
1224
|
+
if (!managerCommands || !rawArg || rawArg.startsWith("-")) return false;
|
|
1225
|
+
if (isSubcommand(rawArg, managerCommands)) return false;
|
|
1226
|
+
return !supportedClis.includes(rawArg);
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1215
1229
|
* Top-level entry. Returns the desired process exit code, or null if argv
|
|
1216
1230
|
* is not a subcommand invocation.
|
|
1217
1231
|
*/
|
|
@@ -1253,31 +1267,31 @@ async function runSubcommand(argv) {
|
|
|
1253
1267
|
return cmdCh(rest);
|
|
1254
1268
|
}
|
|
1255
1269
|
case "term": {
|
|
1256
|
-
const { cmdTerm } = await import("./terminal-
|
|
1270
|
+
const { cmdTerm } = await import("./terminal-CBbBQMcT.js");
|
|
1257
1271
|
return cmdTerm(rest);
|
|
1258
1272
|
}
|
|
1259
1273
|
case "widget": {
|
|
1260
|
-
const { cmdWidget } = await import("./widget-
|
|
1274
|
+
const { cmdWidget } = await import("./widget-j4TWqwpU.js");
|
|
1261
1275
|
return cmdWidget(rest);
|
|
1262
1276
|
}
|
|
1263
1277
|
case "mint": {
|
|
1264
|
-
const { cmdMint } = await import("./widget-
|
|
1278
|
+
const { cmdMint } = await import("./widget-j4TWqwpU.js");
|
|
1265
1279
|
return cmdMint(rest);
|
|
1266
1280
|
}
|
|
1267
1281
|
case "serve": {
|
|
1268
|
-
const { cmdServe } = await import("./serve-
|
|
1282
|
+
const { cmdServe } = await import("./serve-CuMtnSLs.js");
|
|
1269
1283
|
return cmdServe(rest);
|
|
1270
1284
|
}
|
|
1271
1285
|
case "setup": {
|
|
1272
|
-
const { cmdSetup } = await import("./setup-
|
|
1286
|
+
const { cmdSetup } = await import("./setup-wPtsNZZ5.js");
|
|
1273
1287
|
return cmdSetup(rest);
|
|
1274
1288
|
}
|
|
1275
1289
|
case "ws": {
|
|
1276
|
-
const { cmdWs } = await import("./ws-
|
|
1290
|
+
const { cmdWs } = await import("./ws-53rrEEbz.js");
|
|
1277
1291
|
return cmdWs(rest);
|
|
1278
1292
|
}
|
|
1279
1293
|
case "schedule": {
|
|
1280
|
-
const { cmdSchedule } = await import("./schedule-
|
|
1294
|
+
const { cmdSchedule } = await import("./schedule-CHSe24Je.js");
|
|
1281
1295
|
return cmdSchedule(rest);
|
|
1282
1296
|
}
|
|
1283
1297
|
case "remote": {
|
|
@@ -1289,7 +1303,7 @@ async function runSubcommand(argv) {
|
|
|
1289
1303
|
return cmdExpose(rest);
|
|
1290
1304
|
}
|
|
1291
1305
|
case "callback": {
|
|
1292
|
-
const { cmdCallback } = await import("./callback-
|
|
1306
|
+
const { cmdCallback } = await import("./callback-Bb5dBd02.js");
|
|
1293
1307
|
return cmdCallback(rest);
|
|
1294
1308
|
}
|
|
1295
1309
|
case "reap":
|
|
@@ -4327,7 +4341,7 @@ async function cmdNotify(rest) {
|
|
|
4327
4341
|
}
|
|
4328
4342
|
const ensure = async () => {
|
|
4329
4343
|
if (!argv["ensure-daemon"]) return;
|
|
4330
|
-
const { ensureDaemon } = await import("./notifyDaemon-
|
|
4344
|
+
const { ensureDaemon } = await import("./notifyDaemon-BjyUCpbx.js");
|
|
4331
4345
|
await ensureDaemon().catch(() => null);
|
|
4332
4346
|
};
|
|
4333
4347
|
await heartbeatWatcher(parent, selfStartedAt);
|
|
@@ -4401,7 +4415,7 @@ async function cmdNotifyCursor(args) {
|
|
|
4401
4415
|
}
|
|
4402
4416
|
async function cmdNotifyd(rest) {
|
|
4403
4417
|
const sub = rest[0] ?? "status";
|
|
4404
|
-
const daemon = await import("./notifyDaemon-
|
|
4418
|
+
const daemon = await import("./notifyDaemon-BjyUCpbx.js");
|
|
4405
4419
|
switch (sub) {
|
|
4406
4420
|
case "run": return daemon.runDaemon();
|
|
4407
4421
|
case "once": return daemon.runDaemon({ once: true });
|
|
@@ -4427,5 +4441,5 @@ async function cmdNotifyd(rest) {
|
|
|
4427
4441
|
}
|
|
4428
4442
|
|
|
4429
4443
|
//#endregion
|
|
4430
|
-
export {
|
|
4431
|
-
//# sourceMappingURL=subcommands-
|
|
4444
|
+
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 };
|
|
4445
|
+
//# sourceMappingURL=subcommands-CuvZqZTM.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "./logger-CDIsZ-Pp.js";
|
|
2
|
+
import "./globalPidIndex-D9DOSd-c.js";
|
|
3
|
+
import "./messageLog-C-YIzhRj.js";
|
|
4
|
+
import "./e2e-CEIdJGZ7.js";
|
|
5
|
+
import "./configShared-9wVlbPyC.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-CuvZqZTM.js";
|
|
7
|
+
import "./webrtcLink-VQhWmKOw.js";
|
|
8
|
+
import "./remotes-Bem6WIyU.js";
|
|
9
|
+
|
|
10
|
+
export { cmdHelp, isSubcommand, isUnknownManagerToken, runSubcommand };
|
|
@@ -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-CuMtnSLs.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-CBbBQMcT.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-CBzYImFt.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-Buo457VO.js";
|
|
6
6
|
import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-DBoONoM-.js";
|
|
@@ -2027,4 +2027,4 @@ function sleep(ms) {
|
|
|
2027
2027
|
|
|
2028
2028
|
//#endregion
|
|
2029
2029
|
export { hasTodoStore as a, AgentContext as c, answerAsk as i, CLAUDE_SESSION_PIN_ENV as l, agentYes as n, listAsks as o, config as r, listAsksForProject as s, CLIS_CONFIG as t };
|
|
2030
|
-
//# sourceMappingURL=ts-
|
|
2030
|
+
//# sourceMappingURL=ts-Cnhsw8GN.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.238.
|
|
10
|
+
var version = "1.238.2";
|
|
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-CBzYImFt.js.map
|
|
@@ -28,8 +28,8 @@ 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 {
|
|
32
|
-
const base = typeof flags.base === "string" ? flags.base : await
|
|
31
|
+
const { resolveDaemonHttpBase, loadTokenReadOnly } = await import("./serve-CuMtnSLs.js");
|
|
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() ?? "";
|
|
35
35
|
if (!token) throw new Error("no serve token — pass --token or run `ay serve` once");
|
|
@@ -153,7 +153,7 @@ async function cmdMint(args) {
|
|
|
153
153
|
const bad = caps.filter((c) => !KNOWN_CAPS.has(c));
|
|
154
154
|
if (bad.length) throw new Error(`unknown cap(s): ${bad.join(", ")} (valid: ${[...KNOWN_CAPS].join(", ")})`);
|
|
155
155
|
const ttlSec = parseTtlSec(typeof flags.ttl === "string" ? flags.ttl : "15m");
|
|
156
|
-
const { mintScopedTermToken } = await import("./serve-
|
|
156
|
+
const { mintScopedTermToken } = await import("./serve-CuMtnSLs.js");
|
|
157
157
|
const r = await mintScopedTermToken(target, {
|
|
158
158
|
ttlSec,
|
|
159
159
|
caps
|
|
@@ -169,4 +169,4 @@ async function cmdMint(args) {
|
|
|
169
169
|
|
|
170
170
|
//#endregion
|
|
171
171
|
export { cmdMint, cmdWidget };
|
|
172
|
-
//# sourceMappingURL=widget-
|
|
172
|
+
//# sourceMappingURL=widget-j4TWqwpU.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-9wVlbPyC.js";
|
|
6
|
-
import {
|
|
6
|
+
import { C as listRecords } from "./subcommands-CuvZqZTM.js";
|
|
7
7
|
import "./webrtcLink-VQhWmKOw.js";
|
|
8
8
|
import "./remotes-Bem6WIyU.js";
|
|
9
9
|
import { i as getProvisionRoot } from "./workspaceConfig-B7HaQ-MI.js";
|
|
@@ -418,4 +418,4 @@ async function cmdWs(args) {
|
|
|
418
418
|
|
|
419
419
|
//#endregion
|
|
420
420
|
export { WS_JSON_SCHEMA, cmdWs, collectWorkspaces, isPathInside, loadProvision, workspaceStatus };
|
|
421
|
-
//# sourceMappingURL=ws-
|
|
421
|
+
//# sourceMappingURL=ws-53rrEEbz.js.map
|
package/package.json
CHANGED
package/ts/cli.ts
CHANGED
|
@@ -28,7 +28,9 @@ import { buildRustArgs } from "./buildRustArgs.ts";
|
|
|
28
28
|
const managerCommands = !invokedCliName(process.argv);
|
|
29
29
|
// Intercept bare -h/--help so we show TS subcommands, not just Rust agent-runner options.
|
|
30
30
|
const isHelpFlag = rawArg === "-h" || rawArg === "--help";
|
|
31
|
-
const { isSubcommand, runSubcommand, cmdHelp } = await import(
|
|
31
|
+
const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken } = await import(
|
|
32
|
+
"./subcommands.ts"
|
|
33
|
+
);
|
|
32
34
|
if (isHelpFlag && process.argv.length === 3) {
|
|
33
35
|
await cmdHelp(managerCommands);
|
|
34
36
|
process.exit(0);
|
|
@@ -37,6 +39,21 @@ import { buildRustArgs } from "./buildRustArgs.ts";
|
|
|
37
39
|
const code = await runSubcommand(process.argv);
|
|
38
40
|
process.exit(code ?? 0);
|
|
39
41
|
}
|
|
42
|
+
// Footgun guard: on the manager entry, a bare first word that is neither a
|
|
43
|
+
// subcommand nor a known CLI is a typo or a newer subcommand on an older build
|
|
44
|
+
// — error instead of silently spawning an agent with it as the prompt (taku
|
|
45
|
+
// 2026-07-26). A spawn must name a CLI: `ay <cli> …` or `ay --cli <cli> …`.
|
|
46
|
+
{
|
|
47
|
+
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS.ts");
|
|
48
|
+
if (isUnknownManagerToken(rawArg, managerCommands, SUPPORTED_CLIS)) {
|
|
49
|
+
process.stderr.write(
|
|
50
|
+
`ay: unknown subcommand or CLI '${rawArg}'.\n` +
|
|
51
|
+
` See 'ay help' for subcommands. To run an agent, name a CLI:\n` +
|
|
52
|
+
` 'ay <cli> …' (e.g. 'ay claude …') or 'ay --cli <cli> …'.\n`,
|
|
53
|
+
);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
40
57
|
}
|
|
41
58
|
|
|
42
59
|
// Deprecation: `--cwd <dir>` on an agent run. Runs AFTER the subcommand fast
|
package/ts/serve.ts
CHANGED
|
@@ -988,6 +988,26 @@ export async function resolveLocalServeUrl(): Promise<string | null> {
|
|
|
988
988
|
return port ? `http://127.0.0.1:${port}` : null;
|
|
989
989
|
}
|
|
990
990
|
|
|
991
|
+
/**
|
|
992
|
+
* Best-effort HTTP base URL of the LOCAL running daemon, for CLI→daemon calls
|
|
993
|
+
* (`ay widget`). More robust than resolveLocalServeUrl for UNMANAGED daemons: it
|
|
994
|
+
* also reads the portless proxy backend port (~/.portless/routes.json) and the
|
|
995
|
+
* PORT env, so a daemon started outside oxmgr (e.g. a portless wrapper that injects
|
|
996
|
+
* PORT) is still found without the caller having to pass --base. Null if nothing
|
|
997
|
+
* local is discoverable.
|
|
998
|
+
*/
|
|
999
|
+
export async function resolveDaemonHttpBase(): Promise<string | null> {
|
|
1000
|
+
const managed = await resolveLocalServeUrl();
|
|
1001
|
+
if (managed) return managed;
|
|
1002
|
+
// Unmanaged portless run: the real loopback backend is in the portless routes.
|
|
1003
|
+
const pport = await portlessAppPort();
|
|
1004
|
+
if (pport) return `http://127.0.0.1:${pport}`;
|
|
1005
|
+
// Last resort: an explicit port in the environment.
|
|
1006
|
+
const envPort = process.env.AGENT_YES_SERVE_PORT || process.env.PORT;
|
|
1007
|
+
if (envPort && /^\d+$/.test(envPort)) return `http://127.0.0.1:${envPort}`;
|
|
1008
|
+
return null;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
991
1011
|
async function warnStrayServeProcesses(): Promise<void> {
|
|
992
1012
|
const stray = await listStrayServeProcesses();
|
|
993
1013
|
if (stray.length === 0) return;
|
package/ts/subcommands.spec.ts
CHANGED
|
@@ -113,6 +113,29 @@ describe("subcommands.isSubcommand", () => {
|
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
115
|
|
|
116
|
+
describe("subcommands.isUnknownManagerToken (footgun guard)", () => {
|
|
117
|
+
const CLIS = ["claude", "codex", "gemini"];
|
|
118
|
+
it("flags a bare non-cli non-subcommand word on the manager entry", async () => {
|
|
119
|
+
const { isUnknownManagerToken } = await loadModule();
|
|
120
|
+
// `ay frobnicate` / a newer subcommand on an older build — neither a
|
|
121
|
+
// subcommand nor a CLI here → error (rather than spawn it as a prompt).
|
|
122
|
+
expect(isUnknownManagerToken("frobnicate", true, CLIS)).toBe(true);
|
|
123
|
+
expect(isUnknownManagerToken("xyzzy", true, CLIS)).toBe(true);
|
|
124
|
+
});
|
|
125
|
+
it("allows a known CLI, a subcommand, a flag, and empty", async () => {
|
|
126
|
+
const { isUnknownManagerToken } = await loadModule();
|
|
127
|
+
expect(isUnknownManagerToken("claude", true, CLIS)).toBe(false); // `ay claude …`
|
|
128
|
+
expect(isUnknownManagerToken("ls", true, CLIS)).toBe(false); // subcommand
|
|
129
|
+
expect(isUnknownManagerToken("--cli", true, CLIS)).toBe(false); // flag → explicit spawn
|
|
130
|
+
expect(isUnknownManagerToken(undefined, true, CLIS)).toBe(false); // bare `ay`
|
|
131
|
+
});
|
|
132
|
+
it("never fires for a cli-bound alias (first word is the prompt)", async () => {
|
|
133
|
+
const { isUnknownManagerToken } = await loadModule();
|
|
134
|
+
// `cy widget ls` → managerCommands=false → "widget ls" is a prompt to claude.
|
|
135
|
+
expect(isUnknownManagerToken("widget", false, CLIS)).toBe(false);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
|
|
116
139
|
describe("subcommands.cmdHelp", () => {
|
|
117
140
|
const capture = async (managerCommands?: boolean) => {
|
|
118
141
|
const { cmdHelp } = await loadModule();
|
package/ts/subcommands.ts
CHANGED
|
@@ -425,6 +425,25 @@ export function isSubcommand(name: string | undefined, managerCommands = true):
|
|
|
425
425
|
return SUBCOMMANDS.has(name) || (managerCommands && MANAGER_SUBCOMMANDS.has(name));
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
+
/**
|
|
429
|
+
* Footgun guard for the MANAGER entry (`ay`/`agent-yes`): true when the first arg
|
|
430
|
+
* is a bare word (not a flag) that is neither a subcommand nor a known CLI — a
|
|
431
|
+
* typo, or a newer subcommand run on an older build. The caller should error
|
|
432
|
+
* rather than silently spawn an agent with the word as a prompt (taku 2026-07-26:
|
|
433
|
+
* bare `ay <prompt>` is too dangerous; a spawn must name a CLI — `ay <cli> …` or
|
|
434
|
+
* `--cli`). Never fires for cli-bound aliases (cy/claude-yes/…), where the first
|
|
435
|
+
* word is legitimately the prompt, nor for flags or an empty invocation.
|
|
436
|
+
*/
|
|
437
|
+
export function isUnknownManagerToken(
|
|
438
|
+
rawArg: string | undefined,
|
|
439
|
+
managerCommands: boolean,
|
|
440
|
+
supportedClis: readonly string[],
|
|
441
|
+
): boolean {
|
|
442
|
+
if (!managerCommands || !rawArg || rawArg.startsWith("-")) return false;
|
|
443
|
+
if (isSubcommand(rawArg, managerCommands)) return false;
|
|
444
|
+
return !supportedClis.includes(rawArg);
|
|
445
|
+
}
|
|
446
|
+
|
|
428
447
|
/**
|
|
429
448
|
* Top-level entry. Returns the desired process exit code, or null if argv
|
|
430
449
|
* is not a subcommand invocation.
|
package/ts/widget.ts
CHANGED
|
@@ -42,8 +42,8 @@ function parseFlags(
|
|
|
42
42
|
async function daemonTarget(
|
|
43
43
|
flags: Record<string, string | boolean>,
|
|
44
44
|
): Promise<{ base: string; token: string }> {
|
|
45
|
-
const {
|
|
46
|
-
const base = typeof flags.base === "string" ? flags.base : await
|
|
45
|
+
const { resolveDaemonHttpBase, loadTokenReadOnly } = await import("./serve.ts");
|
|
46
|
+
const base = typeof flags.base === "string" ? flags.base : await resolveDaemonHttpBase();
|
|
47
47
|
if (!base)
|
|
48
48
|
throw new Error(
|
|
49
49
|
"no running ay serve daemon found — start `ay serve` or pass --base <url> (e.g. http://127.0.0.1:PORT)",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import "./logger-CDIsZ-Pp.js";
|
|
2
|
-
import "./globalPidIndex-D9DOSd-c.js";
|
|
3
|
-
import "./messageLog-C-YIzhRj.js";
|
|
4
|
-
import "./e2e-CEIdJGZ7.js";
|
|
5
|
-
import "./configShared-9wVlbPyC.js";
|
|
6
|
-
import { A as renderLogTailLines, B as stopTipForCli, C as matchKeyword, D as readPtysize, E as readNotes, F as resolveResumeArgs, H as waitForLogQuiet, I as restartHintLines, L as runSubcommand, M as renderRawLogLines, N as resolveOne, O as recentMessageEdges, P as resolveReadWindow, R as snapshotStatus, S as listRecords, T as readAgentPtysize, U as writeKeysPaced, V as submitAndConfirm, W as writeToIpc, _ as isPidAlive, a as cmdHelp, b as isUserTyping, c as deriveLiveState, d as extractMenu, f as extractNeedsInput, g as isExitRequest, h as isAgentStuck, i as backoffWhileTyping, j as renderRawLog, k as recentReadEdges, 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 menuSelectKeys, x as lastStdinAt, y as isSubcommand, z as stdinActivityPath } from "./subcommands-BdBCxZVu.js";
|
|
7
|
-
import "./webrtcLink-VQhWmKOw.js";
|
|
8
|
-
import "./remotes-Bem6WIyU.js";
|
|
9
|
-
|
|
10
|
-
export { cmdHelp, isSubcommand, runSubcommand };
|