claude-yes 1.165.0 → 1.167.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{SUPPORTED_CLIS-H7IIw10E.js → SUPPORTED_CLIS-DFBATC85.js} +2 -2
- package/dist/SUPPORTED_CLIS-DLFqRE8W.js +8 -0
- package/dist/cli.js +15 -6
- package/dist/index.js +2 -2
- package/dist/{remotes-DkNuq417.js → remotes-ClT1bq16.js} +1 -1
- package/dist/{remotes-DBCvpp3B.js → remotes-T6nf0t3K.js} +2 -2
- package/dist/{schedule-BobQwIBS.js → schedule-C2RMA3qm.js} +5 -5
- package/dist/{serve-DzOWMI_8.js → serve-mLqsRwfR.js} +12 -9
- package/dist/{setup-tVfp7djj.js → setup-BtqKZx3q.js} +3 -3
- package/dist/{share-Bq_tDXQU.js → share-BjqQBWM-.js} +1 -1
- package/dist/spawnGate-B_VDMXYL.js +107 -0
- package/dist/spawnGate-UH73I2le.js +5 -0
- package/dist/{subcommands-CIFWi9vq.js → subcommands-B-WoBVhk.js} +2 -2
- package/dist/{subcommands-DtwxPMYe.js → subcommands-DWeo7ZLc.js} +29 -9
- package/dist/{tray-BMzpUSfa.js → tray-CZarCA2Q.js} +1 -1
- package/dist/{ts-jDEwTsVt.js → ts-s3wYccKf.js} +2 -2
- package/dist/{versionChecker-C0UJyFcN.js → versionChecker-BvR6tV3u.js} +2 -2
- package/dist/{webrtcRemote-Ccdzmuc-.js → webrtcRemote-GAgF5K45.js} +1 -1
- package/dist/{workspaceConfig-B0Q9-q2B.js → workspaceConfig-D3OH7and.js} +41 -2
- package/package.json +1 -1
- package/ts/cli.ts +22 -1
- package/ts/serve.ts +8 -0
- package/ts/spawnGate.spec.ts +155 -0
- package/ts/spawnGate.ts +123 -0
- package/ts/subcommands.spec.ts +127 -18
- package/ts/subcommands.ts +65 -2
- package/ts/workspaceConfig.spec.ts +85 -0
- package/ts/workspaceConfig.ts +64 -0
- package/dist/SUPPORTED_CLIS-dBgLp3mi.js +0 -8
package/ts/workspaceConfig.ts
CHANGED
|
@@ -25,6 +25,24 @@ interface Config {
|
|
|
25
25
|
* arbitrary local code that runs on every spawn.
|
|
26
26
|
*/
|
|
27
27
|
spawnHook?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Max number of concurrently-live agents the daemon will admit via
|
|
30
|
+
* `/api/spawn`. `0`/unset = unlimited (current behavior). See {@link getMaxAgents}.
|
|
31
|
+
*/
|
|
32
|
+
maxAgents?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Refuse a new spawn when system MemAvailable is below this many MB — a memory
|
|
35
|
+
* floor so a burst of spawns can't drive the host into the OOM-killer. `0`/unset
|
|
36
|
+
* = no floor. See {@link getMinFreeMb}.
|
|
37
|
+
*/
|
|
38
|
+
minFreeMb?: number;
|
|
39
|
+
/**
|
|
40
|
+
* How long (ms) a CLI spawn will block-and-wait for capacity (φ-backoff) before
|
|
41
|
+
* failing open and proceeding anyway. Prevents a burst of recursive `ay <cli>`
|
|
42
|
+
* spawns from storming the host while never permanently deadlocking a workflow.
|
|
43
|
+
* Unset = default 10 min. See {@link getSpawnWaitMs}.
|
|
44
|
+
*/
|
|
45
|
+
spawnWaitMs?: number;
|
|
28
46
|
}
|
|
29
47
|
|
|
30
48
|
function configPath(): string {
|
|
@@ -131,6 +149,52 @@ export function hasSpawnHook(): boolean {
|
|
|
131
149
|
return getSpawnHook() !== null;
|
|
132
150
|
}
|
|
133
151
|
|
|
152
|
+
/**
|
|
153
|
+
* Cap on concurrently-live agents admitted via `/api/spawn`. Env
|
|
154
|
+
* `AGENT_YES_MAX_AGENTS` overrides the config `maxAgents`. A non-positive,
|
|
155
|
+
* missing, or unparseable value means **unlimited** (returns undefined), which
|
|
156
|
+
* preserves the historical no-cap behavior. Exists to stop an unbounded fan-out
|
|
157
|
+
* of agents from exhausting host RAM and tripping the OOM-killer.
|
|
158
|
+
*/
|
|
159
|
+
export function getMaxAgents(): number | undefined {
|
|
160
|
+
const raw = process.env.AGENT_YES_MAX_AGENTS?.trim();
|
|
161
|
+
const n = raw !== undefined && raw !== "" ? Number(raw) : readConfig().maxAgents;
|
|
162
|
+
// Floor BEFORE the >0 check: a fractional 0<n<1 would otherwise floor to 0 and
|
|
163
|
+
// turn "invalid/unlimited" into "reject every spawn" (live >= 0 always true).
|
|
164
|
+
const v = typeof n === "number" && Number.isFinite(n) ? Math.floor(n) : NaN;
|
|
165
|
+
return v > 0 ? v : undefined;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Minimum system MemAvailable (MB) required to admit a new spawn. Env
|
|
170
|
+
* `AGENT_YES_MIN_FREE_MB` overrides config `minFreeMb`. Non-positive/unset =
|
|
171
|
+
* no floor (undefined). Complements {@link getMaxAgents}: a count cap alone
|
|
172
|
+
* can't stop OOM when individual agents are large, so we also refuse to spawn
|
|
173
|
+
* when free memory is already low.
|
|
174
|
+
*/
|
|
175
|
+
export function getMinFreeMb(): number | undefined {
|
|
176
|
+
const raw = process.env.AGENT_YES_MIN_FREE_MB?.trim();
|
|
177
|
+
const n = raw !== undefined && raw !== "" ? Number(raw) : readConfig().minFreeMb;
|
|
178
|
+
// Floor before the >0 check (see getMaxAgents) so a fractional value can't
|
|
179
|
+
// collapse to a meaningless 0 floor.
|
|
180
|
+
const v = typeof n === "number" && Number.isFinite(n) ? Math.floor(n) : NaN;
|
|
181
|
+
return v > 0 ? v : undefined;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Max time (ms) a CLI spawn blocks waiting for capacity before failing open.
|
|
186
|
+
* Env `AGENT_YES_SPAWN_WAIT_MS` overrides config `spawnWaitMs`. A non-negative
|
|
187
|
+
* finite value is used as-is (0 = don't wait, check once then proceed); anything
|
|
188
|
+
* missing/garbage falls back to the 10-minute default. Bounded fail-open is
|
|
189
|
+
* deliberate: recursive spawns must never deadlock permanently on each other.
|
|
190
|
+
*/
|
|
191
|
+
export function getSpawnWaitMs(): number {
|
|
192
|
+
const DEFAULT = 600_000;
|
|
193
|
+
const raw = process.env.AGENT_YES_SPAWN_WAIT_MS?.trim();
|
|
194
|
+
const n = raw !== undefined && raw !== "" ? Number(raw) : readConfig().spawnWaitMs;
|
|
195
|
+
return typeof n === "number" && Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT;
|
|
196
|
+
}
|
|
197
|
+
|
|
134
198
|
/** Persist the workspace root, tilde-expanded and resolved to an absolute path. */
|
|
135
199
|
export function setWorkspaceRoot(dir: string): string {
|
|
136
200
|
const abs = path.resolve(expandTilde(dir));
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import "./ts-jDEwTsVt.js";
|
|
2
|
-
import "./logger-CDIsZ-Pp.js";
|
|
3
|
-
import "./versionChecker-C0UJyFcN.js";
|
|
4
|
-
import "./pidStore-BfoBWUjc.js";
|
|
5
|
-
import "./globalPidIndex-DlmmJlO8.js";
|
|
6
|
-
import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-H7IIw10E.js";
|
|
7
|
-
|
|
8
|
-
export { SUPPORTED_CLIS };
|