@feigi/fleet-ctl 3.50.0 → 3.50.1
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/package.json +1 -1
- package/scripts/tier-roles.mjs +51 -3
package/package.json
CHANGED
package/scripts/tier-roles.mjs
CHANGED
|
@@ -34,7 +34,13 @@
|
|
|
34
34
|
// with none, (a), (b) and (d) have nothing to check; an agents
|
|
35
35
|
// directory that cannot be read (missing, not a directory) or a
|
|
36
36
|
// definition that cannot be read (a directory named `*.agent.md`)
|
|
37
|
-
// fails too
|
|
37
|
+
// fails too;
|
|
38
|
+
// (g) `--in-flight <B>`, required under `--check`: omp's
|
|
39
|
+
// `task.maxConcurrency` below 2·B+2, or one that cannot be read, is a
|
|
40
|
+
// notice (`0` is unbounded and prints none). The value is read live
|
|
41
|
+
// with `omp config get`, or from the file `--max-concurrency <path>`
|
|
42
|
+
// names, which takes its place when given. A notice never changes the
|
|
43
|
+
// exit code.
|
|
38
44
|
|
|
39
45
|
import { readFileSync, readdirSync } from "node:fs";
|
|
40
46
|
import { execFileSync } from "node:child_process";
|
|
@@ -304,21 +310,53 @@ export function checkRoutes({ agentsDir, agentsSource = `--agents ${agentsDir}`,
|
|
|
304
310
|
return { violations, notices };
|
|
305
311
|
}
|
|
306
312
|
|
|
313
|
+
// The phase-0 semaphore notice: omp's `task.maxConcurrency` against the
|
|
314
|
+
// In-flight bound. `read` is `{ ok: true, value }` or `{ ok: false, why }`.
|
|
315
|
+
// Returns the notice line, or null for `0` (unbounded) and `>= 2·B+2`. A
|
|
316
|
+
// notice never changes the exit code, so a value that cannot be read is a
|
|
317
|
+
// line too, not a refusal.
|
|
318
|
+
export function semaphoreNotice({ inFlight, read }) {
|
|
319
|
+
const unreadable = (why) => `task.maxConcurrency unreadable — ${why}; In-flight bound ${inFlight} is unchecked against it`;
|
|
320
|
+
// `why` can be omp's raw stderr, which ends in a newline and may span
|
|
321
|
+
// lines; a notice is one line.
|
|
322
|
+
if (!read.ok) return unreadable(read.why.replace(/\s+/g, " ").trim());
|
|
323
|
+
const c = read.value;
|
|
324
|
+
if (!Number.isInteger(c) || c < 0) return unreadable(`not a non-negative integer (got ${c === undefined ? "no value" : JSON.stringify(c)})`);
|
|
325
|
+
const threshold = 2 * inFlight + 2;
|
|
326
|
+
if (c === 0 || c >= threshold) return null;
|
|
327
|
+
return `task.maxConcurrency is ${c}, below 2·${inFlight}+2 = ${threshold} for In-flight bound ${inFlight} — omp queues members past it, so a Pulled implementer may sit unstarted; raise it in omp config (the fleet never writes it)`;
|
|
328
|
+
}
|
|
329
|
+
|
|
307
330
|
// ---------------------------------------------------------------------------
|
|
308
331
|
// CLI
|
|
309
332
|
// ---------------------------------------------------------------------------
|
|
310
333
|
|
|
311
334
|
const die = makeDie(NAME);
|
|
312
|
-
const { arg, has, sweep, stray } = defineFlags(die, {
|
|
335
|
+
const { arg, numArg, has, sweep, stray } = defineFlags(die, {
|
|
313
336
|
flags: {
|
|
314
337
|
check: "bool",
|
|
338
|
+
"in-flight": "value",
|
|
315
339
|
agents: "value",
|
|
316
340
|
overrides: "value",
|
|
317
341
|
"model-roles": "value",
|
|
318
342
|
catalog: "value",
|
|
343
|
+
"max-concurrency": "value",
|
|
319
344
|
},
|
|
320
345
|
});
|
|
321
346
|
|
|
347
|
+
// The `task.maxConcurrency` read `semaphoreNotice` formats: the
|
|
348
|
+
// `--max-concurrency <path>` fixture (a file holding the bare JSON value)
|
|
349
|
+
// when given, else the live `omp config get` read. A read that throws is a
|
|
350
|
+
// result, not a refusal — the notice says it was unreadable and the exit
|
|
351
|
+
// code is the role check's either way.
|
|
352
|
+
function readMaxConcurrency(path) {
|
|
353
|
+
try {
|
|
354
|
+
return { ok: true, value: path === null ? readOmpConfigValue("task.maxConcurrency") : JSON.parse(readFileSync(path, "utf8")) };
|
|
355
|
+
} catch (e) {
|
|
356
|
+
return { ok: false, why: e.message };
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
322
360
|
// `--<flagName> <path>` when given, else the live install read `readLive()`
|
|
323
361
|
// performs (`source` names it in a refusal).
|
|
324
362
|
function loadJsonObject(path, readLive, source, flagName) {
|
|
@@ -339,7 +377,14 @@ function main() {
|
|
|
339
377
|
stray();
|
|
340
378
|
|
|
341
379
|
const check = has("check");
|
|
342
|
-
if (!check) die("--check is required (usage: tier-roles.mjs --check [--agents <dir>] [--model-roles <path>] [--overrides <path>] [--catalog <path>])");
|
|
380
|
+
if (!check) die("--check --in-flight <B> is required (usage: tier-roles.mjs --check --in-flight <B> [--agents <dir>] [--model-roles <path>] [--overrides <path>] [--catalog <path>] [--max-concurrency <path>])");
|
|
381
|
+
|
|
382
|
+
// numArg() is the fleet's digits rule (arg.mjs): `0x5`, `1e1`, ` 5`, `5.0`
|
|
383
|
+
// and `+5` are refused where `Number()` would have read a bound the caller
|
|
384
|
+
// never wrote.
|
|
385
|
+
const inFlightBound = numArg("in-flight");
|
|
386
|
+
if (inFlightBound === null) die("--in-flight is required with --check");
|
|
387
|
+
if (inFlightBound < 1) die(`--in-flight must be at least 1, got ${inFlightBound}`);
|
|
343
388
|
|
|
344
389
|
const agentsFlag = arg("agents");
|
|
345
390
|
const agentsDir = agentsFlag ?? join(SCRIPT_DIR, "..", "agents");
|
|
@@ -356,6 +401,9 @@ function main() {
|
|
|
356
401
|
catalog,
|
|
357
402
|
});
|
|
358
403
|
|
|
404
|
+
const notice = semaphoreNotice({ inFlight: inFlightBound, read: readMaxConcurrency(arg("max-concurrency")) });
|
|
405
|
+
if (notice !== null) notices.push(notice);
|
|
406
|
+
|
|
359
407
|
if (violations.length === 0) {
|
|
360
408
|
console.log("tier-roles: every definition routes to a resolvable model at a level it runs, no shadowing override");
|
|
361
409
|
for (const n of notices) console.log(`tier-roles: notice: ${n}`);
|