agent-yes 1.132.0 → 1.132.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/agent-yes.config.schema.json +5 -0
- package/default.config.yaml +15 -0
- package/dist/SUPPORTED_CLIS-C_y1AnCm.js +8 -0
- package/dist/{SUPPORTED_CLIS-eDyeNYJQ.js → SUPPORTED_CLIS-DeVq1yxH.js} +2 -2
- package/dist/{agent-yes.config-D6ycMApr.js → agent-yes.config-BKtCmmy9.js} +3 -3
- package/dist/{agentYesHome-BvaUOzCV.js → agentYesHome-_eJa3DaX.js} +1 -1
- package/dist/cli.js +15 -17
- package/dist/{configShared-C5QaNPnz.js → configShared-C1C04bbq.js} +1 -1
- package/dist/{globalPidIndex-C7r2m6s7.js → globalPidIndex-DlmmJlO8.js} +2 -2
- package/dist/index.js +5 -5
- package/dist/invokedCli-zdFbz1ST.js +25 -0
- package/dist/{logger-B9h0djqx.js → logger-CDIsZ-Pp.js} +1 -1
- package/dist/pidStore-DfHh3Yt0.js +5 -0
- package/dist/{pidStore-DWQoGxxA.js → pidStore-fqXqTKkh.js} +4 -4
- package/dist/{reaper-BLVA780B.js → reaper-BQgDb85W.js} +1 -1
- package/dist/{reaper-BkjPN7mw.js → reaper-C-eWAxIj.js} +2 -2
- package/dist/{remotes-BRCDVnR7.js → remotes-BdankQeI.js} +1 -1
- package/dist/{remotes-D8GvSbhf.js → remotes-PKKjfTI1.js} +1 -1
- package/dist/{runningLock-CJxsoGdb.js → runningLock-V4qvXgAw.js} +1 -1
- package/dist/{schedule-B53gHsN7.js → schedule-B9Un9AyJ.js} +8 -8
- package/dist/{serve-Bu-QzAlr.js → serve-Ci4pKi4Y.js} +13 -13
- package/dist/{setup-DTgN_sqc.js → setup-CRbKBN8L.js} +3 -3
- package/dist/{share-Cvb0PBKg.js → share-CoyAOa6e.js} +1 -1
- package/dist/{subcommands-CjrE1pU-.js → subcommands-BMO5n56g.js} +5 -5
- package/dist/{subcommands-CpEK563F.js → subcommands-CP1qTDDZ.js} +38 -18
- package/dist/{tray-BVnJLThD.js → tray-DsTv-C04.js} +2 -2
- package/dist/{ts-FPleHqxr.js → ts-BbiNmJ-t.js} +11 -10
- package/dist/{versionChecker-4ovR76r7.js → versionChecker-D_J86wfl.js} +2 -2
- package/dist/{workspaceConfig-BJO4fzEn.js → workspaceConfig-BCOqRBEW.js} +2 -2
- package/package.json +1 -1
- package/ts/cli.ts +7 -2
- package/ts/index.ts +11 -0
- package/ts/invokedCli.spec.ts +30 -0
- package/ts/invokedCli.ts +32 -0
- package/ts/parseCliArgs.ts +10 -19
- package/ts/subcommands.spec.ts +132 -0
- package/ts/subcommands.ts +0 -0
- package/dist/SUPPORTED_CLIS-DnObTI1A.js +0 -8
- package/dist/pidStore-BweOirbR.js +0 -5
|
@@ -99,6 +99,11 @@
|
|
|
99
99
|
"items": { "type": "string" },
|
|
100
100
|
"description": "Default arguments to always pass to the CLI"
|
|
101
101
|
},
|
|
102
|
+
"yesArgs": {
|
|
103
|
+
"type": "array",
|
|
104
|
+
"items": { "type": "string" },
|
|
105
|
+
"description": "Arguments appended when -y/--yes is passed: the per-CLI 'yolo' flag (claude: --dangerously-skip-permissions; codex: --dangerously-bypass-approvals-and-sandbox)"
|
|
106
|
+
},
|
|
102
107
|
"ready": {
|
|
103
108
|
"type": "array",
|
|
104
109
|
"items": { "$ref": "#/definitions/RegexSource" },
|
package/default.config.yaml
CHANGED
|
@@ -2,6 +2,9 @@ clis:
|
|
|
2
2
|
claude:
|
|
3
3
|
promptArg: last-arg
|
|
4
4
|
systemPrompt: --append-system-prompt
|
|
5
|
+
# yesArgs: appended when `-y` / --yes is passed. The per-CLI "yolo" flag.
|
|
6
|
+
yesArgs:
|
|
7
|
+
- --dangerously-skip-permissions
|
|
5
8
|
install:
|
|
6
9
|
powershell: 'powershell -Command "irm https://claude.ai/install.ps1 | iex"'
|
|
7
10
|
bash: "curl -fsSL https://claude.ai/install.sh | bash"
|
|
@@ -96,6 +99,18 @@ clis:
|
|
|
96
99
|
|
|
97
100
|
codex:
|
|
98
101
|
promptArg: first-arg
|
|
102
|
+
# yesArgs: `-y` / --yes maps to codex's own "yolo" flag. Codex rejects
|
|
103
|
+
# claude's --dangerously-skip-permissions outright, and its bwrap sandbox
|
|
104
|
+
# cannot initialize inside an already-sandboxed/containerized environment
|
|
105
|
+
# ("bwrap: Failed to make / slave: Permission denied"), blocking command
|
|
106
|
+
# exec AND apply_patch before they run. --dangerously-bypass-approvals-and
|
|
107
|
+
# -sandbox skips both the approval prompts and the sandbox wrapper, which is
|
|
108
|
+
# exactly codex's documented mode for "environments that are externally
|
|
109
|
+
# sandboxed" (the agent-yes-in-a-container case). Invoke as `ay -y codex
|
|
110
|
+
# "<task>"` — agent-yes's own `-y` must precede the cli name (everything
|
|
111
|
+
# after it is forwarded verbatim to codex via trailing_var_arg).
|
|
112
|
+
yesArgs:
|
|
113
|
+
- --dangerously-bypass-approvals-and-sandbox
|
|
99
114
|
install:
|
|
100
115
|
npm: "npm install -g @openai/codex@latest"
|
|
101
116
|
updateAvailable:
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "./ts-BbiNmJ-t.js";
|
|
2
|
+
import "./logger-CDIsZ-Pp.js";
|
|
3
|
+
import "./versionChecker-D_J86wfl.js";
|
|
4
|
+
import "./pidStore-fqXqTKkh.js";
|
|
5
|
+
import "./globalPidIndex-DlmmJlO8.js";
|
|
6
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DeVq1yxH.js";
|
|
7
|
+
|
|
8
|
+
export { SUPPORTED_CLIS };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as CLIS_CONFIG } from "./ts-
|
|
1
|
+
import { t as CLIS_CONFIG } from "./ts-BbiNmJ-t.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-DeVq1yxH.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as logger } from "./logger-
|
|
2
|
-
import { n as normalizeAgentYesConfig, t as loadSharedCliDefaults } from "./configShared-
|
|
1
|
+
import { n as logger } from "./logger-CDIsZ-Pp.js";
|
|
2
|
+
import { n as normalizeAgentYesConfig, t as loadSharedCliDefaults } from "./configShared-C1C04bbq.js";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
5
5
|
import path from "node:path";
|
|
@@ -226,4 +226,4 @@ async function getDefaultConfig() {
|
|
|
226
226
|
|
|
227
227
|
//#endregion
|
|
228
228
|
export { agent_yes_config_default as default };
|
|
229
|
-
//# sourceMappingURL=agent-yes.config-
|
|
229
|
+
//# sourceMappingURL=agent-yes.config-BKtCmmy9.js.map
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { t as invokedCliName } from "./invokedCli-zdFbz1ST.js";
|
|
3
|
+
import { n as logger } from "./logger-CDIsZ-Pp.js";
|
|
4
|
+
import { i as versionString, n as displayVersion, r as getInstalledPackage, t as checkAndAutoUpdate } from "./versionChecker-D_J86wfl.js";
|
|
4
5
|
import { argv } from "process";
|
|
5
6
|
import { execFileSync, spawn } from "child_process";
|
|
6
7
|
import ms from "ms";
|
|
@@ -16,12 +17,7 @@ import path from "path";
|
|
|
16
17
|
* This is a test helper that mirrors the parsing logic in cli.ts
|
|
17
18
|
*/
|
|
18
19
|
function parseCliArgs(argv, supportedClis) {
|
|
19
|
-
const
|
|
20
|
-
const CLI_ALIASES = { cy: "claude" };
|
|
21
|
-
const cliName = (() => {
|
|
22
|
-
const raw = scriptBaseName.replace(/^(cli|agent)(-yes)?$/, "").replace(/^ay$/, "").replace(/-yes$/, "") || void 0;
|
|
23
|
-
return raw && CLI_ALIASES[raw] || raw;
|
|
24
|
-
})();
|
|
20
|
+
const cliName = invokedCliName(argv);
|
|
25
21
|
const parsedArgv = yargs(hideBin(argv)).usage("Usage: $0 [cli] [agent-yes args] [agent-cli args] [--] [prompts...]").example("$0 claude --timeout=30s -- solve all todos in my codebase, commit one by one", "Run Claude with a 30 seconds idle timeout (will type /exit when timeout), everything after `--` will be treated as the prompt").example("$0 claude --stdpush", "Run Claude with external stdin input enabled via --append-prompt").option("robust", {
|
|
26
22
|
type: "boolean",
|
|
27
23
|
default: true,
|
|
@@ -90,7 +86,7 @@ function parseCliArgs(argv, supportedClis) {
|
|
|
90
86
|
default: "yes"
|
|
91
87
|
}).option("yes", {
|
|
92
88
|
type: "boolean",
|
|
93
|
-
description: "Pass --dangerously-skip-permissions
|
|
89
|
+
description: "Pass the CLI's 'yolo' flag (claude: --dangerously-skip-permissions; codex: --dangerously-bypass-approvals-and-sandbox)",
|
|
94
90
|
default: false,
|
|
95
91
|
alias: "y"
|
|
96
92
|
}).option("tray", {
|
|
@@ -211,7 +207,8 @@ function parseCliArgs(argv, supportedClis) {
|
|
|
211
207
|
cwd: process.cwd(),
|
|
212
208
|
env: process.env,
|
|
213
209
|
cli: cliName || parsedArgv.cli || (dashIndex !== 0 ? parsedArgv._[0]?.toString()?.replace?.(/-yes$/, "") : void 0),
|
|
214
|
-
cliArgs:
|
|
210
|
+
cliArgs: cliArgsForSpawn,
|
|
211
|
+
skipPermissions: parsedArgv.yes,
|
|
215
212
|
prompt: [
|
|
216
213
|
parsedArgv.prompt,
|
|
217
214
|
positionalPrompt,
|
|
@@ -481,13 +478,14 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
|
|
|
481
478
|
}
|
|
482
479
|
{
|
|
483
480
|
const rawArg = process.argv[2];
|
|
481
|
+
const managerCommands = !invokedCliName(process.argv);
|
|
484
482
|
const isHelpFlag = rawArg === "-h" || rawArg === "--help";
|
|
485
|
-
const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-
|
|
483
|
+
const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-BMO5n56g.js");
|
|
486
484
|
if (isHelpFlag && process.argv.length === 3) {
|
|
487
|
-
cmdHelp();
|
|
485
|
+
cmdHelp(managerCommands);
|
|
488
486
|
process.exit(0);
|
|
489
487
|
}
|
|
490
|
-
if (isSubcommand(rawArg)) {
|
|
488
|
+
if (isSubcommand(rawArg, managerCommands)) {
|
|
491
489
|
const code = await runSubcommand(process.argv);
|
|
492
490
|
process.exit(code ?? 0);
|
|
493
491
|
}
|
|
@@ -496,12 +494,12 @@ await checkAndAutoUpdate();
|
|
|
496
494
|
logger.info(versionString());
|
|
497
495
|
const config = parseCliArgs(process.argv);
|
|
498
496
|
if (config.tray) {
|
|
499
|
-
const { startTray } = await import("./tray-
|
|
497
|
+
const { startTray } = await import("./tray-DsTv-C04.js");
|
|
500
498
|
await startTray();
|
|
501
499
|
await new Promise(() => {});
|
|
502
500
|
}
|
|
503
501
|
{
|
|
504
|
-
const { ensureTray } = await import("./tray-
|
|
502
|
+
const { ensureTray } = await import("./tray-DsTv-C04.js");
|
|
505
503
|
ensureTray();
|
|
506
504
|
}
|
|
507
505
|
if (config.useRust) {
|
|
@@ -515,7 +513,7 @@ if (config.useRust) {
|
|
|
515
513
|
}
|
|
516
514
|
}
|
|
517
515
|
if (rustBinary) {
|
|
518
|
-
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-
|
|
516
|
+
const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-C_y1AnCm.js");
|
|
519
517
|
const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
|
|
520
518
|
if (config.verbose) {
|
|
521
519
|
console.log(`[rust] Using binary: ${rustBinary}`);
|
|
@@ -545,7 +543,7 @@ if (config.showVersion) {
|
|
|
545
543
|
process.exit(0);
|
|
546
544
|
}
|
|
547
545
|
if (config.appendPrompt) {
|
|
548
|
-
const { PidStore } = await import("./pidStore-
|
|
546
|
+
const { PidStore } = await import("./pidStore-DfHh3Yt0.js");
|
|
549
547
|
const ipcPath = await PidStore.findActiveFifo(process.cwd());
|
|
550
548
|
if (!ipcPath) {
|
|
551
549
|
console.error("No active agent with IPC found in current directory.");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as logger } from "./logger-
|
|
1
|
+
import { n as logger } from "./logger-CDIsZ-Pp.js";
|
|
2
2
|
import { appendFile, mkdir, readFile, rename, unlink, writeFile } from "fs/promises";
|
|
3
3
|
import { homedir } from "os";
|
|
4
4
|
import path from "path";
|
|
@@ -188,4 +188,4 @@ async function pruneOldLogs(maxAgeMs = retentionMs()) {
|
|
|
188
188
|
|
|
189
189
|
//#endregion
|
|
190
190
|
export { updateGlobalPidStatus as a, readGlobalPids as i, maybeCompactGlobalPids as n, pruneOldLogs as r, appendGlobalPid as t };
|
|
191
|
-
//# sourceMappingURL=globalPidIndex-
|
|
191
|
+
//# sourceMappingURL=globalPidIndex-DlmmJlO8.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-
|
|
2
|
-
import "./logger-
|
|
3
|
-
import "./versionChecker-
|
|
4
|
-
import "./pidStore-
|
|
5
|
-
import "./globalPidIndex-
|
|
1
|
+
import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-BbiNmJ-t.js";
|
|
2
|
+
import "./logger-CDIsZ-Pp.js";
|
|
3
|
+
import "./versionChecker-D_J86wfl.js";
|
|
4
|
+
import "./pidStore-fqXqTKkh.js";
|
|
5
|
+
import "./globalPidIndex-DlmmJlO8.js";
|
|
6
6
|
|
|
7
7
|
export { AgentContext, CLIS_CONFIG, config, agentYes as default, removeControlCharacters };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region ts/invokedCli.ts
|
|
2
|
+
/**
|
|
3
|
+
* Resolve which agent CLI a binary invocation implies, from the binary name in
|
|
4
|
+
* argv[1].
|
|
5
|
+
*
|
|
6
|
+
* Every published bin (cy, claude-yes, codex-yes, ay, agent-yes, …) is the SAME
|
|
7
|
+
* cli.ts entry; the binary's *name* is what selects the default agent. A
|
|
8
|
+
* cli-bound alias — `cy` (= claude-yes = "agent-yes claude"), `codex-yes`, … —
|
|
9
|
+
* resolves to that agent; the generic manager entry (`ay` / `agent-yes` / `cli`)
|
|
10
|
+
* resolves to `undefined`. Callers use that `undefined` to tell "the agent-yes
|
|
11
|
+
* manager" apart from "a cli-bound runner alias".
|
|
12
|
+
*/
|
|
13
|
+
const CLI_ALIASES = { cy: "claude" };
|
|
14
|
+
/**
|
|
15
|
+
* The agent CLI implied by argv[1] (cy / claude-yes → "claude", codex-yes →
|
|
16
|
+
* "codex", …), or `undefined` for the generic `ay` / `agent-yes` / `cli` entry.
|
|
17
|
+
*/
|
|
18
|
+
function invokedCliName(argv) {
|
|
19
|
+
const raw = (argv[1]?.split(/[/\\]/).at(-1)?.replace(/(\.[jt]s)?$/, "") || "").replace(/^(cli|agent)(-yes)?$/, "").replace(/^ay$/, "").replace(/-yes$/, "") || void 0;
|
|
20
|
+
return raw && CLI_ALIASES[raw] || raw;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { invokedCliName as t };
|
|
25
|
+
//# sourceMappingURL=invokedCli-zdFbz1ST.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as logger } from "./logger-
|
|
2
|
-
import { t as agentYesHome } from "./agentYesHome-
|
|
3
|
-
import { a as updateGlobalPidStatus, n as maybeCompactGlobalPids, r as pruneOldLogs, t as appendGlobalPid } from "./globalPidIndex-
|
|
1
|
+
import { n as logger } from "./logger-CDIsZ-Pp.js";
|
|
2
|
+
import { t as agentYesHome } from "./agentYesHome-_eJa3DaX.js";
|
|
3
|
+
import { a as updateGlobalPidStatus, n as maybeCompactGlobalPids, r as pruneOldLogs, t as appendGlobalPid } from "./globalPidIndex-DlmmJlO8.js";
|
|
4
4
|
import { closeSync, existsSync, fsyncSync, openSync } from "fs";
|
|
5
5
|
import { appendFile, mkdir, readFile, rename, writeFile } from "fs/promises";
|
|
6
6
|
import path from "path";
|
|
@@ -367,4 +367,4 @@ pid-db/
|
|
|
367
367
|
|
|
368
368
|
//#endregion
|
|
369
369
|
export { PidStore as t };
|
|
370
|
-
//# sourceMappingURL=pidStore-
|
|
370
|
+
//# sourceMappingURL=pidStore-fqXqTKkh.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as agentYesHome } from "./agentYesHome-
|
|
1
|
+
import { t as agentYesHome } from "./agentYesHome-_eJa3DaX.js";
|
|
2
2
|
import { appendFile, mkdir, readFile, rename, writeFile } from "fs/promises";
|
|
3
3
|
import path from "path";
|
|
4
4
|
|
|
@@ -83,4 +83,4 @@ async function sweep() {
|
|
|
83
83
|
|
|
84
84
|
//#endregion
|
|
85
85
|
export { register as n, sweep as r, pgidForWrapper as t };
|
|
86
|
-
//# sourceMappingURL=reaper-
|
|
86
|
+
//# sourceMappingURL=reaper-C-eWAxIj.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as resolveRemoteSpec, i as readRemotes, n as deleteRemoteAlias, o as writeRemoteAlias, r as parseDirectRemoteSpec, t as cmdRemote } from "./remotes-
|
|
1
|
+
import { a as resolveRemoteSpec, i as readRemotes, n as deleteRemoteAlias, o as writeRemoteAlias, r as parseDirectRemoteSpec, t as cmdRemote } from "./remotes-PKKjfTI1.js";
|
|
2
2
|
|
|
3
3
|
export { cmdRemote };
|
|
@@ -147,4 +147,4 @@ async function cmdRemote(rest) {
|
|
|
147
147
|
|
|
148
148
|
//#endregion
|
|
149
149
|
export { resolveRemoteSpec as a, readRemotes as i, deleteRemoteAlias as n, writeRemoteAlias as o, parseDirectRemoteSpec as r, cmdRemote as t };
|
|
150
|
-
//# sourceMappingURL=remotes-
|
|
150
|
+
//# sourceMappingURL=remotes-PKKjfTI1.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "./ts-
|
|
2
|
-
import "./logger-
|
|
3
|
-
import "./versionChecker-
|
|
4
|
-
import "./pidStore-
|
|
5
|
-
import "./globalPidIndex-
|
|
6
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-
|
|
7
|
-
import { n as resolveSpawnCwd } from "./workspaceConfig-
|
|
1
|
+
import "./ts-BbiNmJ-t.js";
|
|
2
|
+
import "./logger-CDIsZ-Pp.js";
|
|
3
|
+
import "./versionChecker-D_J86wfl.js";
|
|
4
|
+
import "./pidStore-fqXqTKkh.js";
|
|
5
|
+
import "./globalPidIndex-DlmmJlO8.js";
|
|
6
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DeVq1yxH.js";
|
|
7
|
+
import { n as resolveSpawnCwd } from "./workspaceConfig-BCOqRBEW.js";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
9
|
|
|
10
10
|
//#region ts/oxmgrService.ts
|
|
@@ -141,4 +141,4 @@ async function cmdSchedule(rest) {
|
|
|
141
141
|
|
|
142
142
|
//#endregion
|
|
143
143
|
export { cmdSchedule };
|
|
144
|
-
//# sourceMappingURL=schedule-
|
|
144
|
+
//# sourceMappingURL=schedule-B9Un9AyJ.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import "./ts-
|
|
2
|
-
import "./logger-
|
|
3
|
-
import { r as getInstalledPackage } from "./versionChecker-
|
|
4
|
-
import "./pidStore-
|
|
5
|
-
import { a as updateGlobalPidStatus } from "./globalPidIndex-
|
|
6
|
-
import { t as pgidForWrapper } from "./reaper-
|
|
7
|
-
import "./configShared-
|
|
8
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-
|
|
9
|
-
import "./remotes-
|
|
10
|
-
import { d as listRecords, g as resolveOne, i as controlCodeFromName, m as renderRawLog, p as readNotes, s as extractTaskCounts, x as writeToIpc, y as snapshotStatus } from "./subcommands-
|
|
1
|
+
import "./ts-BbiNmJ-t.js";
|
|
2
|
+
import "./logger-CDIsZ-Pp.js";
|
|
3
|
+
import { r as getInstalledPackage } from "./versionChecker-D_J86wfl.js";
|
|
4
|
+
import "./pidStore-fqXqTKkh.js";
|
|
5
|
+
import { a as updateGlobalPidStatus } from "./globalPidIndex-DlmmJlO8.js";
|
|
6
|
+
import { t as pgidForWrapper } from "./reaper-C-eWAxIj.js";
|
|
7
|
+
import "./configShared-C1C04bbq.js";
|
|
8
|
+
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DeVq1yxH.js";
|
|
9
|
+
import "./remotes-PKKjfTI1.js";
|
|
10
|
+
import { d as listRecords, g as resolveOne, i as controlCodeFromName, m as renderRawLog, p as readNotes, s as extractTaskCounts, x as writeToIpc, y as snapshotStatus } from "./subcommands-CP1qTDDZ.js";
|
|
11
11
|
import yargs from "yargs";
|
|
12
12
|
import { mkdir, open, readFile, stat, writeFile } from "fs/promises";
|
|
13
13
|
import { homedir, hostname, userInfo } from "os";
|
|
@@ -247,7 +247,7 @@ async function cmdServeDaemon(sub, args) {
|
|
|
247
247
|
let shareLink = null;
|
|
248
248
|
let shareLinkMinted = false;
|
|
249
249
|
if (webrtcDaemon) try {
|
|
250
|
-
const { loadOrCreateShareRoom, shareLinkFromRoomUrl } = await import("./share-
|
|
250
|
+
const { loadOrCreateShareRoom, shareLinkFromRoomUrl } = await import("./share-CoyAOa6e.js");
|
|
251
251
|
const explicit = explicitWebrtcUrl(effArgs);
|
|
252
252
|
shareLink = shareLinkFromRoomUrl(explicit ?? await loadOrCreateShareRoom());
|
|
253
253
|
shareLinkMinted = !explicit;
|
|
@@ -1087,7 +1087,7 @@ Options:
|
|
|
1087
1087
|
const webrtcVal = argv.webrtc ?? argv.share;
|
|
1088
1088
|
const explicitUrl = typeof webrtcVal === "string" && webrtcVal.startsWith("webrtc://") ? webrtcVal : void 0;
|
|
1089
1089
|
try {
|
|
1090
|
-
const { startShare, loadOrCreateShareRoom } = await import("./share-
|
|
1090
|
+
const { startShare, loadOrCreateShareRoom } = await import("./share-CoyAOa6e.js");
|
|
1091
1091
|
const linkFile = path.join(process.env.AGENT_YES_HOME ?? path.join(homedir(), ".agent-yes"), ".share-link");
|
|
1092
1092
|
const announce = async (room, link, rotated) => {
|
|
1093
1093
|
const lead = rotated ? "the room was rejected by signaling (stale generation) — rotated to a fresh link" : "shared over WebRTC — open this link (the token is eaten from the URL on open)";
|
|
@@ -1142,4 +1142,4 @@ Options:
|
|
|
1142
1142
|
|
|
1143
1143
|
//#endregion
|
|
1144
1144
|
export { cmdServe };
|
|
1145
|
-
//# sourceMappingURL=serve-
|
|
1145
|
+
//# sourceMappingURL=serve-Ci4pKi4Y.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as setWorkspaceRoot, t as getWorkspaceRoot } from "./workspaceConfig-
|
|
1
|
+
import { r as setWorkspaceRoot, t as getWorkspaceRoot } from "./workspaceConfig-BCOqRBEW.js";
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { stdin, stdout } from "node:process";
|
|
4
4
|
import { createInterface } from "node:readline/promises";
|
|
@@ -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-Ci4pKi4Y.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-CRbKBN8L.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./logger-
|
|
2
|
-
import "./globalPidIndex-
|
|
3
|
-
import "./configShared-
|
|
4
|
-
import "./remotes-
|
|
5
|
-
import { _ as resolveReadWindow, a as cursorAbs, b as stopTipForCli, c as finalizedLines, d as listRecords, f as matchKeyword, g as resolveOne, h as renderRawLogLines, i as controlCodeFromName, l as isPidAlive, m as renderRawLog, n as READ_PAGE_DEFAULT, o as extractNeedsInput, p as readNotes, r as cmdHelp, s as extractTaskCounts, t as GRACEFUL_EXIT_COMMANDS, u as isSubcommand, v as runSubcommand, x as writeToIpc, y as snapshotStatus } from "./subcommands-
|
|
1
|
+
import "./logger-CDIsZ-Pp.js";
|
|
2
|
+
import "./globalPidIndex-DlmmJlO8.js";
|
|
3
|
+
import "./configShared-C1C04bbq.js";
|
|
4
|
+
import "./remotes-PKKjfTI1.js";
|
|
5
|
+
import { _ as resolveReadWindow, a as cursorAbs, b as stopTipForCli, c as finalizedLines, d as listRecords, f as matchKeyword, g as resolveOne, h as renderRawLogLines, i as controlCodeFromName, l as isPidAlive, m as renderRawLog, n as READ_PAGE_DEFAULT, o as extractNeedsInput, p as readNotes, r as cmdHelp, s as extractTaskCounts, t as GRACEFUL_EXIT_COMMANDS, u as isSubcommand, v as runSubcommand, x as writeToIpc, y as snapshotStatus } from "./subcommands-CP1qTDDZ.js";
|
|
6
6
|
|
|
7
7
|
export { cmdHelp, isSubcommand, runSubcommand };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { t as invokedCliName } from "./invokedCli-zdFbz1ST.js";
|
|
2
|
+
import { t as agentYesHome } from "./agentYesHome-_eJa3DaX.js";
|
|
3
|
+
import { a as updateGlobalPidStatus, i as readGlobalPids } from "./globalPidIndex-DlmmJlO8.js";
|
|
4
|
+
import { t as loadSharedCliDefaults } from "./configShared-C1C04bbq.js";
|
|
5
|
+
import { a as resolveRemoteSpec, i as readRemotes } from "./remotes-PKKjfTI1.js";
|
|
5
6
|
import ms from "ms";
|
|
6
7
|
import yargs from "yargs";
|
|
7
8
|
import { appendFile, mkdir, open, readFile, stat, writeFile } from "fs/promises";
|
|
@@ -489,15 +490,22 @@ const SUBCOMMANDS = new Set([
|
|
|
489
490
|
"restart",
|
|
490
491
|
"note",
|
|
491
492
|
"serve",
|
|
492
|
-
"setup",
|
|
493
493
|
"schedule",
|
|
494
494
|
"remote",
|
|
495
495
|
"reap",
|
|
496
496
|
"help"
|
|
497
497
|
]);
|
|
498
|
+
const MANAGER_SUBCOMMANDS = new Set(["setup"]);
|
|
498
499
|
const IDLE_THRESHOLD_MS = 60 * 1e3;
|
|
499
|
-
|
|
500
|
-
|
|
500
|
+
/**
|
|
501
|
+
* Whether `name` is a subcommand. `managerCommands` (default true, for the
|
|
502
|
+
* generic `ay`/`agent-yes` entry) additionally admits manager-only commands
|
|
503
|
+
* like `setup`; pass false for a cli-bound alias (cy/claude-yes/…) so those
|
|
504
|
+
* names fall through to running the agent instead.
|
|
505
|
+
*/
|
|
506
|
+
function isSubcommand(name, managerCommands = true) {
|
|
507
|
+
if (!name) return false;
|
|
508
|
+
return SUBCOMMANDS.has(name) || managerCommands && MANAGER_SUBCOMMANDS.has(name);
|
|
501
509
|
}
|
|
502
510
|
/**
|
|
503
511
|
* Top-level entry. Returns the desired process exit code, or null if argv
|
|
@@ -505,7 +513,8 @@ function isSubcommand(name) {
|
|
|
505
513
|
*/
|
|
506
514
|
async function runSubcommand(argv) {
|
|
507
515
|
const sub = argv[2];
|
|
508
|
-
|
|
516
|
+
const managerCommands = !invokedCliName(argv);
|
|
517
|
+
if (!isSubcommand(sub, managerCommands)) return null;
|
|
509
518
|
const rest = argv.slice(3);
|
|
510
519
|
try {
|
|
511
520
|
switch (sub) {
|
|
@@ -524,25 +533,25 @@ async function runSubcommand(argv) {
|
|
|
524
533
|
case "restart": return await cmdRestart(rest);
|
|
525
534
|
case "note": return await cmdNote(rest);
|
|
526
535
|
case "serve": {
|
|
527
|
-
const { cmdServe } = await import("./serve-
|
|
536
|
+
const { cmdServe } = await import("./serve-Ci4pKi4Y.js");
|
|
528
537
|
return cmdServe(rest);
|
|
529
538
|
}
|
|
530
539
|
case "setup": {
|
|
531
|
-
const { cmdSetup } = await import("./setup-
|
|
540
|
+
const { cmdSetup } = await import("./setup-CRbKBN8L.js");
|
|
532
541
|
return cmdSetup(rest);
|
|
533
542
|
}
|
|
534
543
|
case "schedule": {
|
|
535
|
-
const { cmdSchedule } = await import("./schedule-
|
|
544
|
+
const { cmdSchedule } = await import("./schedule-B9Un9AyJ.js");
|
|
536
545
|
return cmdSchedule(rest);
|
|
537
546
|
}
|
|
538
547
|
case "remote": {
|
|
539
|
-
const { cmdRemote } = await import("./remotes-
|
|
548
|
+
const { cmdRemote } = await import("./remotes-BdankQeI.js");
|
|
540
549
|
return cmdRemote(rest);
|
|
541
550
|
}
|
|
542
551
|
case "reap":
|
|
543
|
-
await (await import("./reaper-
|
|
552
|
+
await (await import("./reaper-BQgDb85W.js")).sweep();
|
|
544
553
|
return 0;
|
|
545
|
-
case "help": return cmdHelp();
|
|
554
|
+
case "help": return cmdHelp(managerCommands);
|
|
546
555
|
default: return null;
|
|
547
556
|
}
|
|
548
557
|
} catch (err) {
|
|
@@ -551,14 +560,18 @@ async function runSubcommand(argv) {
|
|
|
551
560
|
return 1;
|
|
552
561
|
}
|
|
553
562
|
}
|
|
554
|
-
function cmdHelp() {
|
|
555
|
-
|
|
563
|
+
function cmdHelp(managerCommands = true) {
|
|
564
|
+
const setupLine = managerCommands ? ` ay setup guided setup: pick a workspace, share to agent-yes.com\n` : ``;
|
|
565
|
+
process.stdout.write("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\n ay attach <keyword> interactive attach (detach: Ctrl-\\)\n ay stop <keyword> graceful shutdown (/exit for claude/codex)\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\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 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");
|
|
556
566
|
return 0;
|
|
557
567
|
}
|
|
558
568
|
function matchKeyword(record, keyword) {
|
|
559
569
|
if (!keyword) return true;
|
|
560
570
|
const kw = keyword.toLowerCase();
|
|
561
|
-
if (/^\d+$/.test(keyword)
|
|
571
|
+
if (/^\d+$/.test(keyword)) {
|
|
572
|
+
if (record.pid === Number(keyword)) return true;
|
|
573
|
+
return !!(record.agent_id && record.agent_id.toLowerCase().startsWith(kw));
|
|
574
|
+
}
|
|
562
575
|
if (record.cwd.toLowerCase().includes(kw)) return true;
|
|
563
576
|
if (record.cli.toLowerCase() === kw) return true;
|
|
564
577
|
if (record.prompt && record.prompt.toLowerCase().includes(kw)) return true;
|
|
@@ -660,6 +673,13 @@ async function resolveOne(keyword, opts) {
|
|
|
660
673
|
if (!keyword) throw new Error("keyword required (pid, cwd substring, cli name, or prompt substring)");
|
|
661
674
|
const matches = await listRecords(keyword, opts);
|
|
662
675
|
if (matches.length === 0) throw new Error(`no agent matched "${keyword}"`);
|
|
676
|
+
if (/^\d+$/.test(keyword)) {
|
|
677
|
+
const byPid = matches.filter((r) => r.pid === Number(keyword));
|
|
678
|
+
if (byPid.length === 1) return byPid[0];
|
|
679
|
+
}
|
|
680
|
+
const kw = keyword.toLowerCase();
|
|
681
|
+
const byAgentId = matches.filter((r) => r.agent_id && r.agent_id.toLowerCase() === kw);
|
|
682
|
+
if (byAgentId.length === 1) return byAgentId[0];
|
|
663
683
|
if (matches.length === 1) return matches[0];
|
|
664
684
|
if (opts.latest) return matches[0];
|
|
665
685
|
if (process.stderr.isTTY && process.platform !== "win32") try {
|
|
@@ -2408,4 +2428,4 @@ async function cmdResultSet(rest) {
|
|
|
2408
2428
|
|
|
2409
2429
|
//#endregion
|
|
2410
2430
|
export { resolveReadWindow as _, cursorAbs as a, stopTipForCli as b, finalizedLines as c, listRecords as d, matchKeyword as f, resolveOne as g, renderRawLogLines as h, controlCodeFromName as i, isPidAlive as l, renderRawLog as m, READ_PAGE_DEFAULT as n, extractNeedsInput as o, readNotes as p, cmdHelp as r, extractTaskCounts as s, GRACEFUL_EXIT_COMMANDS as t, isSubcommand as u, runSubcommand as v, writeToIpc as x, snapshotStatus as y };
|
|
2411
|
-
//# sourceMappingURL=subcommands-
|
|
2431
|
+
//# sourceMappingURL=subcommands-CP1qTDDZ.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as getRunningAgentCount } from "./runningLock-
|
|
1
|
+
import { n as getRunningAgentCount } from "./runningLock-V4qvXgAw.js";
|
|
2
2
|
import { existsSync } from "fs";
|
|
3
3
|
import { mkdir, readFile, unlink, writeFile } from "fs/promises";
|
|
4
4
|
import { homedir } from "os";
|
|
@@ -187,4 +187,4 @@ async function startTray() {
|
|
|
187
187
|
|
|
188
188
|
//#endregion
|
|
189
189
|
export { ensureTray, startTray };
|
|
190
|
-
//# sourceMappingURL=tray-
|
|
190
|
+
//# sourceMappingURL=tray-DsTv-C04.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { n as logger, t as addTransport } from "./logger-
|
|
2
|
-
import { r as getInstalledPackage } from "./versionChecker-
|
|
3
|
-
import { t as agentYesHome } from "./agentYesHome-
|
|
4
|
-
import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-
|
|
5
|
-
import { t as PidStore } from "./pidStore-
|
|
6
|
-
import { i as readGlobalPids } from "./globalPidIndex-
|
|
7
|
-
import { n as register, r as sweep } from "./reaper-
|
|
1
|
+
import { n as logger, t as addTransport } from "./logger-CDIsZ-Pp.js";
|
|
2
|
+
import { r as getInstalledPackage } from "./versionChecker-D_J86wfl.js";
|
|
3
|
+
import { t as agentYesHome } from "./agentYesHome-_eJa3DaX.js";
|
|
4
|
+
import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-V4qvXgAw.js";
|
|
5
|
+
import { t as PidStore } from "./pidStore-fqXqTKkh.js";
|
|
6
|
+
import { i as readGlobalPids } from "./globalPidIndex-DlmmJlO8.js";
|
|
7
|
+
import { n as register, r as sweep } from "./reaper-C-eWAxIj.js";
|
|
8
8
|
import { arch, platform } from "process";
|
|
9
9
|
import { execSync } from "child_process";
|
|
10
10
|
import { closeSync, constants, createReadStream, existsSync, mkdirSync, openSync } from "fs";
|
|
@@ -1060,7 +1060,7 @@ async function notifyWebhook(status, details, cwd = process.cwd()) {
|
|
|
1060
1060
|
|
|
1061
1061
|
//#endregion
|
|
1062
1062
|
//#region ts/index.ts
|
|
1063
|
-
const config = await import("./agent-yes.config-
|
|
1063
|
+
const config = await import("./agent-yes.config-BKtCmmy9.js").then((mod) => mod.default || mod);
|
|
1064
1064
|
const CLIS_CONFIG = config.clis;
|
|
1065
1065
|
/**
|
|
1066
1066
|
* Main function to run agent-cli with automatic yes/no responses
|
|
@@ -1090,7 +1090,7 @@ const CLIS_CONFIG = config.clis;
|
|
|
1090
1090
|
* });
|
|
1091
1091
|
* ```
|
|
1092
1092
|
*/
|
|
1093
|
-
async function agentYes({ cli, cliArgs = [], prompt, robust = true, cwd, env, exitOnIdle, logFile, removeControlCharactersFromStdout = false, verbose = false, queue = false, install = false, resume = false, useSkills = false, useStdinAppend = false, autoYes = true, idleAction, swarmHint = true }) {
|
|
1093
|
+
async function agentYes({ cli, cliArgs = [], skipPermissions = false, prompt, robust = true, cwd, env, exitOnIdle, logFile, removeControlCharactersFromStdout = false, verbose = false, queue = false, install = false, resume = false, useSkills = false, useStdinAppend = false, autoYes = true, idleAction, swarmHint = true }) {
|
|
1094
1094
|
if (!cli) throw new Error(`cli is required`);
|
|
1095
1095
|
const conf = CLIS_CONFIG[cli] || DIE(`Unsupported cli tool: ${cli}, current process.argv: ${process.argv.join(" ")}`);
|
|
1096
1096
|
const workingDir = cwd ?? process.cwd();
|
|
@@ -1126,6 +1126,7 @@ async function agentYes({ cli, cliArgs = [], prompt, robust = true, cwd, env, ex
|
|
|
1126
1126
|
if (!!process.env.CLAUDE_PPID) logger.info(`[${cli}-yes] Running as sub-agent (CLAUDE_PPID=${process.env.CLAUDE_PPID})`);
|
|
1127
1127
|
const cliConf = CLIS_CONFIG[cli] || {};
|
|
1128
1128
|
cliArgs = cliConf.defaultArgs ? [...cliConf.defaultArgs, ...cliArgs] : cliArgs;
|
|
1129
|
+
if (skipPermissions && cliConf.yesArgs?.length) cliArgs = [...cliArgs, ...cliConf.yesArgs];
|
|
1129
1130
|
try {
|
|
1130
1131
|
const workingDir = cwd ?? process.cwd();
|
|
1131
1132
|
if (useSkills && cli !== "claude") {
|
|
@@ -1787,4 +1788,4 @@ function sleep(ms) {
|
|
|
1787
1788
|
|
|
1788
1789
|
//#endregion
|
|
1789
1790
|
export { removeControlCharacters as a, AgentContext as i, agentYes as n, config as r, CLIS_CONFIG as t };
|
|
1790
|
-
//# sourceMappingURL=ts-
|
|
1791
|
+
//# sourceMappingURL=ts-BbiNmJ-t.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.132.
|
|
10
|
+
var version = "1.132.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-D_J86wfl.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as agentYesHome } from "./agentYesHome-
|
|
1
|
+
import { t as agentYesHome } from "./agentYesHome-_eJa3DaX.js";
|
|
2
2
|
import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
3
3
|
import { homedir } from "os";
|
|
4
4
|
import path from "path";
|
|
@@ -53,4 +53,4 @@ function resolveSpawnCwd(input) {
|
|
|
53
53
|
|
|
54
54
|
//#endregion
|
|
55
55
|
export { resolveSpawnCwd as n, setWorkspaceRoot as r, getWorkspaceRoot as t };
|
|
56
|
-
//# sourceMappingURL=workspaceConfig-
|
|
56
|
+
//# sourceMappingURL=workspaceConfig-BCOqRBEW.js.map
|
package/package.json
CHANGED
package/ts/cli.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { argv } from "process";
|
|
3
3
|
import { spawn } from "child_process";
|
|
4
4
|
import { parseCliArgs } from "./parseCliArgs.ts";
|
|
5
|
+
import { invokedCliName } from "./invokedCli.ts";
|
|
5
6
|
import { logger } from "./logger.ts";
|
|
6
7
|
import { checkAndAutoUpdate, displayVersion, versionString } from "./versionChecker.ts";
|
|
7
8
|
import { getRustBinary } from "./rustBinary.ts";
|
|
@@ -21,14 +22,18 @@ import { buildRustArgs } from "./buildRustArgs.ts";
|
|
|
21
22
|
// pid index instead. Must run before checkAndAutoUpdate / yargs / Rust spawn.
|
|
22
23
|
{
|
|
23
24
|
const rawArg = process.argv[2];
|
|
25
|
+
// Manager-only subcommands (e.g. `setup`) apply only to the generic
|
|
26
|
+
// `ay`/`agent-yes` entry, not to a cli-bound alias like `cy` (= claude-yes):
|
|
27
|
+
// `cy setup …` must run claude with that text, not manage the host.
|
|
28
|
+
const managerCommands = !invokedCliName(process.argv);
|
|
24
29
|
// Intercept bare -h/--help so we show TS subcommands, not just Rust agent-runner options.
|
|
25
30
|
const isHelpFlag = rawArg === "-h" || rawArg === "--help";
|
|
26
31
|
const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands.ts");
|
|
27
32
|
if (isHelpFlag && process.argv.length === 3) {
|
|
28
|
-
cmdHelp();
|
|
33
|
+
cmdHelp(managerCommands);
|
|
29
34
|
process.exit(0);
|
|
30
35
|
}
|
|
31
|
-
if (isSubcommand(rawArg)) {
|
|
36
|
+
if (isSubcommand(rawArg, managerCommands)) {
|
|
32
37
|
const code = await runSubcommand(process.argv);
|
|
33
38
|
process.exit(code ?? 0);
|
|
34
39
|
}
|
package/ts/index.ts
CHANGED
|
@@ -44,6 +44,7 @@ export type AgentCliConfig = {
|
|
|
44
44
|
version?: string; // hint user for version command to check if installed
|
|
45
45
|
binary?: string; // actual binary name if different from cli, e.g. cursor -> cursor-agent
|
|
46
46
|
defaultArgs?: string[]; // function to ensure certain args are present
|
|
47
|
+
yesArgs?: string[]; // appended when `-y`/--yes is passed: the per-CLI "yolo" flag (claude: --dangerously-skip-permissions; codex: --dangerously-bypass-approvals-and-sandbox)
|
|
47
48
|
help?: string; // documentation/help URL for the CLI
|
|
48
49
|
bunx?: boolean; // metadata for bunx-based launches
|
|
49
50
|
systemPrompt?: string; // flag name for system prompt injection
|
|
@@ -115,6 +116,7 @@ export const CLIS_CONFIG = config.clis as Record<
|
|
|
115
116
|
export default async function agentYes({
|
|
116
117
|
cli,
|
|
117
118
|
cliArgs = [],
|
|
119
|
+
skipPermissions = false,
|
|
118
120
|
prompt,
|
|
119
121
|
robust = true,
|
|
120
122
|
cwd,
|
|
@@ -134,6 +136,7 @@ export default async function agentYes({
|
|
|
134
136
|
}: {
|
|
135
137
|
cli: keyof typeof CLIS_CONFIG;
|
|
136
138
|
cliArgs?: string[];
|
|
139
|
+
skipPermissions?: boolean; // if true (`-y`/--yes), append the per-CLI yesArgs ("yolo" flag)
|
|
137
140
|
prompt?: string;
|
|
138
141
|
robust?: boolean;
|
|
139
142
|
cwd?: string;
|
|
@@ -217,6 +220,14 @@ export default async function agentYes({
|
|
|
217
220
|
const cliConf = (CLIS_CONFIG as Record<string, AgentCliConfig>)[cli] || {};
|
|
218
221
|
cliArgs = cliConf.defaultArgs ? [...cliConf.defaultArgs, ...cliArgs] : cliArgs;
|
|
219
222
|
|
|
223
|
+
// `-y`/--yes appends the per-CLI "yolo" args. Each CLI declares its own:
|
|
224
|
+
// claude → --dangerously-skip-permissions; codex →
|
|
225
|
+
// --dangerously-bypass-approvals-and-sandbox (codex rejects the claude flag,
|
|
226
|
+
// and its bwrap sandbox can't init inside an already-sandboxed container).
|
|
227
|
+
if (skipPermissions && cliConf.yesArgs?.length) {
|
|
228
|
+
cliArgs = [...cliArgs, ...cliConf.yesArgs];
|
|
229
|
+
}
|
|
230
|
+
|
|
220
231
|
// If enabled, read SKILL.md header and prepend to the prompt for non-Claude agents
|
|
221
232
|
try {
|
|
222
233
|
const workingDir = cwd ?? process.cwd();
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { invokedCliName } from "./invokedCli.ts";
|
|
3
|
+
|
|
4
|
+
// argv[1] is the invoked binary path; argv[0] is the runtime (node/bun).
|
|
5
|
+
const argv = (bin: string) => ["/usr/bin/bun", bin];
|
|
6
|
+
|
|
7
|
+
describe("invokedCliName", () => {
|
|
8
|
+
it("resolves cli-bound aliases to their agent", () => {
|
|
9
|
+
expect(invokedCliName(argv("/root/.bun/bin/cy"))).toBe("claude");
|
|
10
|
+
expect(invokedCliName(argv("/usr/local/bin/claude-yes"))).toBe("claude");
|
|
11
|
+
expect(invokedCliName(argv("/usr/local/bin/codex-yes"))).toBe("codex");
|
|
12
|
+
expect(invokedCliName(argv("gemini-yes"))).toBe("gemini");
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("returns undefined for the generic manager entry", () => {
|
|
16
|
+
expect(invokedCliName(argv("/root/.bun/bin/ay"))).toBeUndefined();
|
|
17
|
+
expect(invokedCliName(argv("/usr/local/bin/agent-yes"))).toBeUndefined();
|
|
18
|
+
expect(invokedCliName(argv("/path/to/cli"))).toBeUndefined();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("ignores the .js / .ts extension the wrapper bins carry", () => {
|
|
22
|
+
expect(invokedCliName(argv("/app/dist/cy.js"))).toBe("claude");
|
|
23
|
+
expect(invokedCliName(argv("/app/dist/codex-yes.js"))).toBe("codex");
|
|
24
|
+
expect(invokedCliName(argv("/app/dist/agent-yes.js"))).toBeUndefined();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("is undefined when argv[1] is missing", () => {
|
|
28
|
+
expect(invokedCliName(["/usr/bin/bun"])).toBeUndefined();
|
|
29
|
+
});
|
|
30
|
+
});
|
package/ts/invokedCli.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve which agent CLI a binary invocation implies, from the binary name in
|
|
3
|
+
* argv[1].
|
|
4
|
+
*
|
|
5
|
+
* Every published bin (cy, claude-yes, codex-yes, ay, agent-yes, …) is the SAME
|
|
6
|
+
* cli.ts entry; the binary's *name* is what selects the default agent. A
|
|
7
|
+
* cli-bound alias — `cy` (= claude-yes = "agent-yes claude"), `codex-yes`, … —
|
|
8
|
+
* resolves to that agent; the generic manager entry (`ay` / `agent-yes` / `cli`)
|
|
9
|
+
* resolves to `undefined`. Callers use that `undefined` to tell "the agent-yes
|
|
10
|
+
* manager" apart from "a cli-bound runner alias".
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// Short aliases → target CLI. Must match the alias wrappers postbuild.ts emits.
|
|
14
|
+
export const CLI_ALIASES: Record<string, string> = { cy: "claude" };
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The agent CLI implied by argv[1] (cy / claude-yes → "claude", codex-yes →
|
|
18
|
+
* "codex", …), or `undefined` for the generic `ay` / `agent-yes` / `cli` entry.
|
|
19
|
+
*/
|
|
20
|
+
export function invokedCliName(argv: string[]): string | undefined {
|
|
21
|
+
const base =
|
|
22
|
+
argv[1]
|
|
23
|
+
?.split(/[/\\]/)
|
|
24
|
+
.at(-1)
|
|
25
|
+
?.replace(/(\.[jt]s)?$/, "") || "";
|
|
26
|
+
const raw =
|
|
27
|
+
base
|
|
28
|
+
.replace(/^(cli|agent)(-yes)?$/, "")
|
|
29
|
+
.replace(/^ay$/, "") // treat standalone "ay" same as "agent-yes"
|
|
30
|
+
.replace(/-yes$/, "") || undefined;
|
|
31
|
+
return (raw && CLI_ALIASES[raw]) || raw;
|
|
32
|
+
}
|
package/ts/parseCliArgs.ts
CHANGED
|
@@ -1,28 +1,15 @@
|
|
|
1
1
|
import ms from "ms";
|
|
2
2
|
import yargs from "yargs";
|
|
3
3
|
import { hideBin } from "yargs/helpers";
|
|
4
|
+
import { invokedCliName } from "./invokedCli.ts";
|
|
4
5
|
/**
|
|
5
6
|
* Parse CLI arguments the same way cli.ts does
|
|
6
7
|
* This is a test helper that mirrors the parsing logic in cli.ts
|
|
7
8
|
*/
|
|
8
9
|
export function parseCliArgs(argv: string[], supportedClis?: readonly string[]) {
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
?.split(/[/\\]/)
|
|
13
|
-
.at(-1)
|
|
14
|
-
?.replace(/(\.[jt]s)?$/, "") || "";
|
|
15
|
-
|
|
16
|
-
const CLI_ALIASES: Record<string, string> = { cy: "claude" };
|
|
17
|
-
|
|
18
|
-
const cliName = (() => {
|
|
19
|
-
const raw =
|
|
20
|
-
scriptBaseName
|
|
21
|
-
.replace(/^(cli|agent)(-yes)?$/, "")
|
|
22
|
-
.replace(/^ay$/, "") // treat standalone "ay" same as "agent-yes"
|
|
23
|
-
.replace(/-yes$/, "") || undefined;
|
|
24
|
-
return (raw && CLI_ALIASES[raw]) || raw;
|
|
25
|
-
})();
|
|
10
|
+
// The agent CLI implied by the invoked binary name (cy/claude-yes → claude),
|
|
11
|
+
// or undefined for the generic ay/agent-yes manager entry.
|
|
12
|
+
const cliName = invokedCliName(argv);
|
|
26
13
|
|
|
27
14
|
// Parse args with yargs (same logic as cli.ts:16-73)
|
|
28
15
|
const parsedArgv = yargs(hideBin(argv))
|
|
@@ -128,7 +115,8 @@ export function parseCliArgs(argv: string[], supportedClis?: readonly string[])
|
|
|
128
115
|
})
|
|
129
116
|
.option("yes", {
|
|
130
117
|
type: "boolean",
|
|
131
|
-
description:
|
|
118
|
+
description:
|
|
119
|
+
"Pass the CLI's 'yolo' flag (claude: --dangerously-skip-permissions; codex: --dangerously-bypass-approvals-and-sandbox)",
|
|
132
120
|
default: false,
|
|
133
121
|
alias: "y",
|
|
134
122
|
})
|
|
@@ -305,7 +293,10 @@ export function parseCliArgs(argv: string[], supportedClis?: readonly string[])
|
|
|
305
293
|
(dashIndex !== 0
|
|
306
294
|
? parsedArgv._[0]?.toString()?.replace?.(/-yes$/, "")
|
|
307
295
|
: undefined)) as string,
|
|
308
|
-
cliArgs:
|
|
296
|
+
cliArgs: cliArgsForSpawn,
|
|
297
|
+
// `-y`/--yes: the actual flag is per-CLI (see each CLI's `yesArgs` in
|
|
298
|
+
// default.config.yaml). agentYes() appends it once the CLI is resolved.
|
|
299
|
+
skipPermissions: parsedArgv.yes,
|
|
309
300
|
prompt:
|
|
310
301
|
[parsedArgv.prompt, positionalPrompt, dashPrompt].filter(Boolean).join(" ") || undefined,
|
|
311
302
|
install: parsedArgv.install,
|
package/ts/subcommands.spec.ts
CHANGED
|
@@ -65,6 +65,42 @@ describe("subcommands.isSubcommand", () => {
|
|
|
65
65
|
expect(isSubcommand("not-a-command")).toBe(false);
|
|
66
66
|
expect(isSubcommand(undefined)).toBe(false);
|
|
67
67
|
});
|
|
68
|
+
|
|
69
|
+
it("gates manager-only `setup` on the generic manager, not cli-bound aliases", async () => {
|
|
70
|
+
const { isSubcommand } = await loadModule();
|
|
71
|
+
// `ay setup` (managerCommands defaults to true) → a subcommand.
|
|
72
|
+
expect(isSubcommand("setup")).toBe(true);
|
|
73
|
+
expect(isSubcommand("setup", true)).toBe(true);
|
|
74
|
+
// `cy setup` (cli-bound alias) → NOT a subcommand, so it falls through to
|
|
75
|
+
// running claude with that text.
|
|
76
|
+
expect(isSubcommand("setup", false)).toBe(false);
|
|
77
|
+
// Inspection subcommands stay universal — `cy ls` / `cy send` still work.
|
|
78
|
+
expect(isSubcommand("ls", false)).toBe(true);
|
|
79
|
+
expect(isSubcommand("send", false)).toBe(true);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe("subcommands.cmdHelp", () => {
|
|
84
|
+
it("hides the manager-only `setup` line for cli-bound aliases", async () => {
|
|
85
|
+
const { cmdHelp } = await loadModule();
|
|
86
|
+
const capture = (managerCommands?: boolean) => {
|
|
87
|
+
let out = "";
|
|
88
|
+
const spy = vi.spyOn(process.stdout, "write").mockImplementation((s: unknown) => {
|
|
89
|
+
out += String(s);
|
|
90
|
+
return true;
|
|
91
|
+
});
|
|
92
|
+
try {
|
|
93
|
+
cmdHelp(managerCommands);
|
|
94
|
+
} finally {
|
|
95
|
+
spy.mockRestore();
|
|
96
|
+
}
|
|
97
|
+
return out;
|
|
98
|
+
};
|
|
99
|
+
expect(capture(true)).toContain("ay setup"); // manager
|
|
100
|
+
expect(capture()).toContain("ay setup"); // default = manager
|
|
101
|
+
expect(capture(false)).not.toContain("ay setup"); // cli-bound alias (cy)
|
|
102
|
+
expect(capture(false)).toContain("ay ls"); // universal commands still shown
|
|
103
|
+
});
|
|
68
104
|
});
|
|
69
105
|
|
|
70
106
|
describe("subcommands.stopTipForCli", () => {
|
|
@@ -111,6 +147,23 @@ describe("subcommands.matchKeyword", () => {
|
|
|
111
147
|
expect(matchKeyword(baseRecord, "9999")).toBe(false);
|
|
112
148
|
});
|
|
113
149
|
|
|
150
|
+
it("treats a numeric keyword as an identity selector (pid or agent_id prefix, no cwd/prompt match)", async () => {
|
|
151
|
+
const { matchKeyword } = await loadModule();
|
|
152
|
+
// pid mentioned inside another agent's prompt/cwd must NOT match by number.
|
|
153
|
+
const r = {
|
|
154
|
+
...baseRecord,
|
|
155
|
+
pid: 5678,
|
|
156
|
+
prompt: "investigating crash in pid 1234",
|
|
157
|
+
cwd: "/v1/code/proj-1234",
|
|
158
|
+
};
|
|
159
|
+
expect(matchKeyword(r, "1234")).toBe(false); // not this agent's pid, despite cwd/prompt mentions
|
|
160
|
+
expect(matchKeyword(r, "5678")).toBe(true); // its actual pid
|
|
161
|
+
// an all-digit agent_id prefix still resolves (ids are random hex).
|
|
162
|
+
const idr = { ...baseRecord, pid: 5678, agent_id: "206812abcdef" };
|
|
163
|
+
expect(matchKeyword(idr, "206812")).toBe(true); // agent_id prefix
|
|
164
|
+
expect(matchKeyword(idr, "5678")).toBe(true); // pid still wins too
|
|
165
|
+
});
|
|
166
|
+
|
|
114
167
|
it("matches by cwd substring (case-insensitive)", async () => {
|
|
115
168
|
const { matchKeyword } = await loadModule();
|
|
116
169
|
expect(matchKeyword(baseRecord, "agent-yes")).toBe(true);
|
|
@@ -152,6 +205,85 @@ describe("subcommands.matchKeyword", () => {
|
|
|
152
205
|
});
|
|
153
206
|
});
|
|
154
207
|
|
|
208
|
+
describe("subcommands.resolveOne exact-identity precedence", () => {
|
|
209
|
+
const opts = { all: false, active: false, json: true, latest: true, cwdScope: null };
|
|
210
|
+
|
|
211
|
+
// Regression for the `/w/#room:206812` deep link rendering a sibling's terminal:
|
|
212
|
+
// sharing the URL pastes the pid into other agents' prompts, so a bare pid
|
|
213
|
+
// lookup fuzzily matched them too and the newest-first tiebreak won. Exact pid
|
|
214
|
+
// must beat prompt-substring collisions.
|
|
215
|
+
it("returns the agent whose pid IS the keyword over newer prompt-substring matches", async () => {
|
|
216
|
+
const { resolveOne } = await loadModule();
|
|
217
|
+
const { appendGlobalPid } = await import("./globalPidIndex.ts");
|
|
218
|
+
const now = Date.now();
|
|
219
|
+
const base = {
|
|
220
|
+
cwd: process.cwd(),
|
|
221
|
+
log_file: null,
|
|
222
|
+
status: "active" as const,
|
|
223
|
+
exit_code: null,
|
|
224
|
+
exit_reason: null,
|
|
225
|
+
};
|
|
226
|
+
// The real target — oldest.
|
|
227
|
+
await appendGlobalPid({
|
|
228
|
+
...base,
|
|
229
|
+
pid: 206812,
|
|
230
|
+
cli: "codex",
|
|
231
|
+
prompt: "do the thing",
|
|
232
|
+
started_at: now - 60_000,
|
|
233
|
+
});
|
|
234
|
+
// Two newer claudes whose prompt embeds the share URL containing "206812".
|
|
235
|
+
await appendGlobalPid({
|
|
236
|
+
...base,
|
|
237
|
+
pid: 265959,
|
|
238
|
+
cli: "claude",
|
|
239
|
+
prompt: "https://agent-yes.com/w/#r2d058f:206812 is codex agent but renders claude",
|
|
240
|
+
started_at: now - 2_000,
|
|
241
|
+
});
|
|
242
|
+
await appendGlobalPid({
|
|
243
|
+
...base,
|
|
244
|
+
pid: 239973,
|
|
245
|
+
cli: "claude",
|
|
246
|
+
prompt: "look at https://agent-yes.com/w/#r2d058f:206812",
|
|
247
|
+
started_at: now - 6_000,
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
const record = await resolveOne("206812", opts);
|
|
251
|
+
expect(record.pid).toBe(206812);
|
|
252
|
+
expect(record.cli).toBe("codex");
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it("returns the agent whose agent_id IS the keyword over prompt-substring matches", async () => {
|
|
256
|
+
const { resolveOne } = await loadModule();
|
|
257
|
+
const { appendGlobalPid } = await import("./globalPidIndex.ts");
|
|
258
|
+
const now = Date.now();
|
|
259
|
+
const base = {
|
|
260
|
+
cwd: process.cwd(),
|
|
261
|
+
log_file: null,
|
|
262
|
+
status: "active" as const,
|
|
263
|
+
exit_code: null,
|
|
264
|
+
exit_reason: null,
|
|
265
|
+
};
|
|
266
|
+
await appendGlobalPid({
|
|
267
|
+
...base,
|
|
268
|
+
pid: 111,
|
|
269
|
+
cli: "codex",
|
|
270
|
+
prompt: "target",
|
|
271
|
+
agent_id: "a1b2c3d4e5f6",
|
|
272
|
+
started_at: now - 60_000,
|
|
273
|
+
});
|
|
274
|
+
await appendGlobalPid({
|
|
275
|
+
...base,
|
|
276
|
+
pid: 222,
|
|
277
|
+
cli: "claude",
|
|
278
|
+
prompt: "mentions a1b2c3d4e5f6 in passing",
|
|
279
|
+
started_at: now - 1_000,
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
const record = await resolveOne("a1b2c3d4e5f6", opts);
|
|
283
|
+
expect(record.pid).toBe(111);
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
|
|
155
287
|
describe("subcommands.runSubcommand routing", () => {
|
|
156
288
|
it("returns null for unknown subcommands so cli.ts falls through", async () => {
|
|
157
289
|
const { runSubcommand } = await loadModule();
|
package/ts/subcommands.ts
CHANGED
|
Binary file
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "./ts-FPleHqxr.js";
|
|
2
|
-
import "./logger-B9h0djqx.js";
|
|
3
|
-
import "./versionChecker-4ovR76r7.js";
|
|
4
|
-
import "./pidStore-DWQoGxxA.js";
|
|
5
|
-
import "./globalPidIndex-C7r2m6s7.js";
|
|
6
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-eDyeNYJQ.js";
|
|
7
|
-
|
|
8
|
-
export { SUPPORTED_CLIS };
|