@the-vibe-company/armada 0.2.70 → 0.2.72
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/armada.js +292 -87
- package/package.json +1 -1
package/dist/armada.js
CHANGED
|
@@ -10148,6 +10148,7 @@ var init_status = __esm(() => {
|
|
|
10148
10148
|
// ../plugins/claude/src/index.ts
|
|
10149
10149
|
var exports_src = {};
|
|
10150
10150
|
__export(exports_src, {
|
|
10151
|
+
HEADLESS_VARIABLE: () => HEADLESS_VARIABLE,
|
|
10151
10152
|
activate: () => activate,
|
|
10152
10153
|
claudeRuntime: () => claudeRuntime
|
|
10153
10154
|
});
|
|
@@ -10318,6 +10319,7 @@ function claudeRuntime(options = {}, node) {
|
|
|
10318
10319
|
] : request.args;
|
|
10319
10320
|
const ref = await facilities().launch({
|
|
10320
10321
|
...request,
|
|
10322
|
+
env: { [HEADLESS_VARIABLE]: "1", ...request.env },
|
|
10321
10323
|
command: stream ? "node" : request.command,
|
|
10322
10324
|
args: stream ? [
|
|
10323
10325
|
"--input-type=module",
|
|
@@ -10396,7 +10398,7 @@ function activate(ctx) {
|
|
|
10396
10398
|
const options = ctx.config.runtime?.claude ?? {};
|
|
10397
10399
|
ctx.register.runtime("claude", claudeRuntime(options));
|
|
10398
10400
|
}
|
|
10399
|
-
var same2 = (a, b) => a.project === b.project && a.ticket === b.ticket && a.session === b.session && a.generation === b.generation && a.handle === b.handle;
|
|
10401
|
+
var HEADLESS_VARIABLE = "ARMADA_DESKTOP_HEADLESS", same2 = (a, b) => a.project === b.project && a.ticket === b.ticket && a.session === b.session && a.generation === b.generation && a.handle === b.handle;
|
|
10400
10402
|
var init_src = __esm(() => {
|
|
10401
10403
|
init_driver();
|
|
10402
10404
|
init_status();
|
|
@@ -10770,7 +10772,7 @@ var init_src2 = __esm(() => {
|
|
|
10770
10772
|
});
|
|
10771
10773
|
|
|
10772
10774
|
// ../plugin-api/dist/guard.js
|
|
10773
|
-
import { AsyncLocalStorage as
|
|
10775
|
+
import { AsyncLocalStorage as AsyncLocalStorage3 } from "node:async_hooks";
|
|
10774
10776
|
async function guarded2(target, check, act) {
|
|
10775
10777
|
await check();
|
|
10776
10778
|
return guards2.run({ target, check }, async () => {
|
|
@@ -10792,7 +10794,7 @@ var init_guard = __esm(() => {
|
|
|
10792
10794
|
key = Symbol.for("@armada/plugin-api/guard/v1");
|
|
10793
10795
|
shared = globalThis;
|
|
10794
10796
|
if (!shared[key])
|
|
10795
|
-
shared[key] = new
|
|
10797
|
+
shared[key] = new AsyncLocalStorage3;
|
|
10796
10798
|
guards2 = shared[key];
|
|
10797
10799
|
});
|
|
10798
10800
|
|
|
@@ -31696,6 +31698,19 @@ var init_supervisor = __esm(() => {
|
|
|
31696
31698
|
return error && typeof error === "object" ? error.code : undefined;
|
|
31697
31699
|
}
|
|
31698
31700
|
|
|
31701
|
+
/** The last line a dying supervisor leaves: the reason, never the configuration or output. */
|
|
31702
|
+
function crash(reason, error) {
|
|
31703
|
+
try {
|
|
31704
|
+
const detail = error instanceof Error ? error.stack || error.message : String(error);
|
|
31705
|
+
const line = new Date().toISOString() + " supervisor exiting: " + reason + ": " + detail + "\n";
|
|
31706
|
+
if (config && config.paths && config.paths.directory)
|
|
31707
|
+
fs.appendFileSync(path.join(config.paths.directory, "supervisor.log"), line, { mode: 0o600 });
|
|
31708
|
+
} catch {}
|
|
31709
|
+
process.exit(1);
|
|
31710
|
+
}
|
|
31711
|
+
process.on("uncaughtException", (error) => crash("uncaught exception", error));
|
|
31712
|
+
process.on("unhandledRejection", (error) => crash("unhandled rejection", error));
|
|
31713
|
+
|
|
31699
31714
|
function uuid(value) {
|
|
31700
31715
|
return typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
|
|
31701
31716
|
}
|
|
@@ -32118,6 +32133,9 @@ var init_supervisor = __esm(() => {
|
|
|
32118
32133
|
function reply(socket, value) {
|
|
32119
32134
|
if (socket.destroyed) return;
|
|
32120
32135
|
const payload = JSON.stringify(value) + "\n";
|
|
32136
|
+
// A peer that already reset the connection (a timed-out or satisfied host
|
|
32137
|
+
// request) surfaces as EPIPE/ECONNRESET here; the socket's error listener
|
|
32138
|
+
// below keeps that a closed connection, never a supervisor crash.
|
|
32121
32139
|
socket.end(payload);
|
|
32122
32140
|
}
|
|
32123
32141
|
|
|
@@ -32134,6 +32152,9 @@ var init_supervisor = __esm(() => {
|
|
|
32134
32152
|
maybeCloseServer();
|
|
32135
32153
|
};
|
|
32136
32154
|
socket.setEncoding("utf8");
|
|
32155
|
+
// Without this listener one reset peer raises an uncaught error and ends
|
|
32156
|
+
// the supervisor while its process group keeps running (THE-2233).
|
|
32157
|
+
socket.on("error", () => socket.destroy());
|
|
32137
32158
|
socket.on("close", done);
|
|
32138
32159
|
socket.on("data", (chunk) => {
|
|
32139
32160
|
if (replied) return;
|
|
@@ -32159,7 +32180,7 @@ var init_supervisor = __esm(() => {
|
|
|
32159
32180
|
);
|
|
32160
32181
|
});
|
|
32161
32182
|
});
|
|
32162
|
-
server.on("error", () =>
|
|
32183
|
+
server.on("error", (error) => crash("socket server error", error));
|
|
32163
32184
|
server.listen(config.paths.socket, async () => {
|
|
32164
32185
|
try {
|
|
32165
32186
|
if (process.platform !== "win32") await fs.promises.chmod(config.paths.socket, 0o600);
|
|
@@ -46278,52 +46299,43 @@ function checkpointUsage(checkpoint, documents) {
|
|
|
46278
46299
|
}
|
|
46279
46300
|
return completions;
|
|
46280
46301
|
}
|
|
46281
|
-
|
|
46282
|
-
|
|
46283
|
-
|
|
46284
|
-
|
|
46285
|
-
|
|
46286
|
-
|
|
46287
|
-
|
|
46288
|
-
|
|
46289
|
-
const key = usageTime(at, zone).day;
|
|
46290
|
-
let row = days.get(key);
|
|
46291
|
-
if (!row) {
|
|
46292
|
-
row = { day: key, coordinator: emptyTotals(), workers: emptyTotals(), workerLaunches: 0, workersReported: 0 };
|
|
46293
|
-
days.set(key, row);
|
|
46294
|
-
}
|
|
46295
|
-
return row;
|
|
46296
|
-
};
|
|
46297
|
-
const sessionAt = (id, kind) => {
|
|
46302
|
+
|
|
46303
|
+
class UsageLedger {
|
|
46304
|
+
#turns = new Set;
|
|
46305
|
+
#documents = new Map;
|
|
46306
|
+
#previous = new Map;
|
|
46307
|
+
#sessions = new Map;
|
|
46308
|
+
#entries = [];
|
|
46309
|
+
#sessionAt(id, kind) {
|
|
46298
46310
|
const key = `${kind}:${id}`;
|
|
46299
|
-
let row = sessions.get(key);
|
|
46311
|
+
let row = this.#sessions.get(key);
|
|
46300
46312
|
if (!row) {
|
|
46301
46313
|
row = { session: id, kind, totals: emptyTotals() };
|
|
46302
|
-
sessions.set(key, row);
|
|
46314
|
+
this.#sessions.set(key, row);
|
|
46303
46315
|
}
|
|
46304
46316
|
return row;
|
|
46305
|
-
}
|
|
46306
|
-
|
|
46307
|
-
const row = sessionAt(id, "worker");
|
|
46317
|
+
}
|
|
46318
|
+
#launched(id, at) {
|
|
46319
|
+
const row = this.#sessionAt(id, "worker");
|
|
46308
46320
|
if (!row.launchedAt) {
|
|
46309
46321
|
row.launchedAt = at;
|
|
46310
|
-
|
|
46322
|
+
this.#entries.push({ at, kind: "launch" });
|
|
46311
46323
|
}
|
|
46312
46324
|
return row;
|
|
46313
|
-
}
|
|
46314
|
-
|
|
46325
|
+
}
|
|
46326
|
+
apply(e) {
|
|
46315
46327
|
if (e.kind === "coordinator.checkpoint") {
|
|
46316
46328
|
const c = e.payload.checkpoint;
|
|
46317
|
-
const derived = checkpointUsage(c, documents);
|
|
46329
|
+
const derived = checkpointUsage(c, this.#documents);
|
|
46318
46330
|
const completions = e.payload.turn ? [{ turn: e.payload.turn, usage: e.payload.usage ?? "unknown" }] : derived;
|
|
46319
46331
|
for (const { turn, usage } of completions)
|
|
46320
|
-
if (!turns.has(turn.id)) {
|
|
46321
|
-
turns.add(turn.id);
|
|
46322
|
-
|
|
46323
|
-
add(sessionAt(turn.session, "coordinator").totals, usage);
|
|
46332
|
+
if (!this.#turns.has(turn.id)) {
|
|
46333
|
+
this.#turns.add(turn.id);
|
|
46334
|
+
this.#entries.push({ at: e.at, kind: "coordinator", usage });
|
|
46335
|
+
add(this.#sessionAt(turn.session, "coordinator").totals, usage);
|
|
46324
46336
|
}
|
|
46325
46337
|
if (c && typeof c === "object" && !Array.isArray(c) && c.format === "armada.worker" && c.type === "launch" && typeof c.session === "string") {
|
|
46326
|
-
const row = c.step === "launched" ? launched(c.session, e.at) : sessionAt(c.session, "worker");
|
|
46338
|
+
const row = c.step === "launched" ? this.#launched(c.session, e.at) : this.#sessionAt(c.session, "worker");
|
|
46327
46339
|
if (typeof c.ticket === "string")
|
|
46328
46340
|
row.ticket = c.ticket;
|
|
46329
46341
|
if (typeof c.runtime === "string")
|
|
@@ -46331,18 +46343,17 @@ function projectUsage(events, zone) {
|
|
|
46331
46343
|
}
|
|
46332
46344
|
}
|
|
46333
46345
|
if (e.kind === "worker.readopted") {
|
|
46334
|
-
launched(e.payload.session, e.at).ticket = e.payload.ticket;
|
|
46346
|
+
this.#launched(e.payload.session, e.at).ticket = e.payload.ticket;
|
|
46335
46347
|
}
|
|
46336
46348
|
if (e.kind === "session.usage") {
|
|
46337
46349
|
const { session, ticket, usage } = e.payload;
|
|
46338
|
-
const row = sessionAt(session, "worker");
|
|
46350
|
+
const row = this.#sessionAt(session, "worker");
|
|
46339
46351
|
row.ticket = ticket;
|
|
46340
|
-
const day = dayAt(e.at);
|
|
46341
46352
|
if (usage === "unknown") {
|
|
46342
46353
|
row.totals.unknown = 1;
|
|
46343
|
-
|
|
46354
|
+
this.#entries.push({ at: e.at, kind: "worker", usage });
|
|
46344
46355
|
} else {
|
|
46345
|
-
const prior = previous.get(session);
|
|
46356
|
+
const prior = this.#previous.get(session);
|
|
46346
46357
|
const delta = { ...usage };
|
|
46347
46358
|
const cumulative = { ...usage };
|
|
46348
46359
|
for (const k of fields3) {
|
|
@@ -46355,21 +46366,95 @@ function projectUsage(events, zone) {
|
|
|
46355
46366
|
cumulative.incomplete = true;
|
|
46356
46367
|
}
|
|
46357
46368
|
}
|
|
46358
|
-
|
|
46369
|
+
this.#entries.push({
|
|
46370
|
+
at: e.at,
|
|
46371
|
+
kind: "worker",
|
|
46372
|
+
usage: delta,
|
|
46373
|
+
...fields3.some((k) => usage[k] !== null) ? { session } : {}
|
|
46374
|
+
});
|
|
46359
46375
|
row.totals = emptyTotals();
|
|
46360
46376
|
add(row.totals, cumulative);
|
|
46361
46377
|
if (cumulative.incomplete || fields3.some((k) => usage[k] === null))
|
|
46362
46378
|
row.totals.unknown = 1;
|
|
46363
|
-
previous.set(session, cumulative);
|
|
46364
|
-
const known = reported.get(day.day) ?? new Set;
|
|
46365
|
-
if (fields3.some((k) => usage[k] !== null))
|
|
46366
|
-
known.add(session);
|
|
46367
|
-
reported.set(day.day, known);
|
|
46368
|
-
day.workersReported = known.size;
|
|
46379
|
+
this.#previous.set(session, cumulative);
|
|
46369
46380
|
}
|
|
46370
46381
|
}
|
|
46371
46382
|
}
|
|
46372
|
-
|
|
46383
|
+
usage(zone) {
|
|
46384
|
+
const days = new Map;
|
|
46385
|
+
const reported = new Map;
|
|
46386
|
+
const dayAt = (at) => {
|
|
46387
|
+
const key = usageTime(at, zone).day;
|
|
46388
|
+
let row = days.get(key);
|
|
46389
|
+
if (!row) {
|
|
46390
|
+
row = { day: key, coordinator: emptyTotals(), workers: emptyTotals(), workerLaunches: 0, workersReported: 0 };
|
|
46391
|
+
days.set(key, row);
|
|
46392
|
+
}
|
|
46393
|
+
return row;
|
|
46394
|
+
};
|
|
46395
|
+
for (const entry of this.#entries) {
|
|
46396
|
+
const day = dayAt(entry.at);
|
|
46397
|
+
if (entry.kind === "launch")
|
|
46398
|
+
day.workerLaunches++;
|
|
46399
|
+
else if (entry.kind === "coordinator")
|
|
46400
|
+
add(day.coordinator, entry.usage);
|
|
46401
|
+
else {
|
|
46402
|
+
add(day.workers, entry.usage);
|
|
46403
|
+
if (entry.session) {
|
|
46404
|
+
const known = reported.get(day.day) ?? new Set;
|
|
46405
|
+
known.add(entry.session);
|
|
46406
|
+
reported.set(day.day, known);
|
|
46407
|
+
day.workersReported = known.size;
|
|
46408
|
+
}
|
|
46409
|
+
}
|
|
46410
|
+
}
|
|
46411
|
+
return {
|
|
46412
|
+
zone,
|
|
46413
|
+
days: [...days.values()],
|
|
46414
|
+
sessions: [...this.#sessions.values()].map((row) => ({
|
|
46415
|
+
...row,
|
|
46416
|
+
totals: { ...row.totals, models: [...row.totals.models] }
|
|
46417
|
+
}))
|
|
46418
|
+
};
|
|
46419
|
+
}
|
|
46420
|
+
serialize() {
|
|
46421
|
+
return {
|
|
46422
|
+
turns: [...this.#turns],
|
|
46423
|
+
documents: [...this.#documents],
|
|
46424
|
+
previous: [...this.#previous],
|
|
46425
|
+
sessions: [...this.#sessions],
|
|
46426
|
+
entries: this.#entries
|
|
46427
|
+
};
|
|
46428
|
+
}
|
|
46429
|
+
static restore(state) {
|
|
46430
|
+
if (!isObject3(state))
|
|
46431
|
+
throw new Error("usage ledger is not an object");
|
|
46432
|
+
if (!Array.isArray(state.turns) || state.turns.some((t) => typeof t !== "string"))
|
|
46433
|
+
throw new Error("usage ledger turns are not strings");
|
|
46434
|
+
if (!Array.isArray(state.entries) || state.entries.some((e) => !isObject3(e) || typeof e.at !== "string"))
|
|
46435
|
+
throw new Error("usage ledger entries are malformed");
|
|
46436
|
+
const ledger = new UsageLedger;
|
|
46437
|
+
for (const turn of state.turns)
|
|
46438
|
+
ledger.#turns.add(turn);
|
|
46439
|
+
for (const [id, document2] of pairs(state.documents, "documents")) {
|
|
46440
|
+
if (!isObject3(document2) || typeof document2.session !== "string" || !isObject3(document2.models))
|
|
46441
|
+
throw new Error("usage ledger document is malformed");
|
|
46442
|
+
ledger.#documents.set(id, document2);
|
|
46443
|
+
}
|
|
46444
|
+
for (const [session, usage] of pairs(state.previous, "previous")) {
|
|
46445
|
+
if (!isObject3(usage))
|
|
46446
|
+
throw new Error("usage ledger floor is malformed");
|
|
46447
|
+
ledger.#previous.set(session, usage);
|
|
46448
|
+
}
|
|
46449
|
+
for (const [key, row] of pairs(state.sessions, "sessions")) {
|
|
46450
|
+
if (!isObject3(row) || typeof row.session !== "string" || !isObject3(row.totals))
|
|
46451
|
+
throw new Error("usage ledger session is malformed");
|
|
46452
|
+
ledger.#sessions.set(key, row);
|
|
46453
|
+
}
|
|
46454
|
+
for (const entry of state.entries)
|
|
46455
|
+
ledger.#entries.push(entry);
|
|
46456
|
+
return ledger;
|
|
46457
|
+
}
|
|
46373
46458
|
}
|
|
46374
46459
|
var fields3, emptyTotals = () => ({
|
|
46375
46460
|
input: null,
|
|
@@ -46379,7 +46464,11 @@ var fields3, emptyTotals = () => ({
|
|
|
46379
46464
|
reported: 0,
|
|
46380
46465
|
unknown: 0,
|
|
46381
46466
|
models: []
|
|
46382
|
-
}), object8 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : undefined
|
|
46467
|
+
}), object8 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : undefined, isObject3 = (value) => object8(value) !== undefined, pairs = (value, name) => {
|
|
46468
|
+
if (!Array.isArray(value) || value.some((e) => !Array.isArray(e) || e.length !== 2 || typeof e[0] !== "string"))
|
|
46469
|
+
throw new Error(`usage ledger ${name} is not a list of named entries`);
|
|
46470
|
+
return value;
|
|
46471
|
+
};
|
|
46383
46472
|
var init_usage2 = __esm(() => {
|
|
46384
46473
|
init_usage_view();
|
|
46385
46474
|
fields3 = ["input", "output", "cacheRead", "cacheWrite"];
|
|
@@ -46395,7 +46484,7 @@ function fold(events) {
|
|
|
46395
46484
|
seq = source.seq;
|
|
46396
46485
|
applyEvent(projects, source.kind === "coordinator.checkpoint" ? source : structuredClone(source));
|
|
46397
46486
|
}
|
|
46398
|
-
return projectTables(projects, seq
|
|
46487
|
+
return projectTables(projects, seq);
|
|
46399
46488
|
}
|
|
46400
46489
|
function applyEvent(projects, e) {
|
|
46401
46490
|
let p = projects.get(e.project);
|
|
@@ -46404,6 +46493,7 @@ function applyEvent(projects, e) {
|
|
|
46404
46493
|
projects.set(e.project, p);
|
|
46405
46494
|
}
|
|
46406
46495
|
applyDelivery(p.deliveries, e);
|
|
46496
|
+
p.usage.apply(e);
|
|
46407
46497
|
if (e.kind === "inbox.opened" && e.payload.followUp?.code === "delivery_failed")
|
|
46408
46498
|
p.deliveryFollowUps.add(e.payload.id);
|
|
46409
46499
|
switch (e.kind) {
|
|
@@ -46676,13 +46766,14 @@ function applyEvent(projects, e) {
|
|
|
46676
46766
|
}
|
|
46677
46767
|
recoverFollowUps(p.inbox, e, p.sessions);
|
|
46678
46768
|
}
|
|
46679
|
-
function projectTables(projects, seq
|
|
46769
|
+
function projectTables(projects, seq) {
|
|
46680
46770
|
const tables = { seq, projects: Object.create(null) };
|
|
46681
46771
|
for (const [project, p] of projects) {
|
|
46772
|
+
const tickets = new Map(p.tickets);
|
|
46682
46773
|
for (const t of p.internal.values()) {
|
|
46683
46774
|
const labelPhase = t.labels.map((label) => phaseSchema.safeParse(label)).find((result) => result.success)?.data ?? null;
|
|
46684
46775
|
const phase = t.state === "completed" ? "merged" : t.state === "canceled" ? "released" : labelPhase;
|
|
46685
|
-
|
|
46776
|
+
tickets.set(t.id, {
|
|
46686
46777
|
id: t.id,
|
|
46687
46778
|
title: t.title,
|
|
46688
46779
|
description: t.description,
|
|
@@ -46694,7 +46785,7 @@ function projectTables(projects, seq, events) {
|
|
|
46694
46785
|
...t.source !== undefined ? { source: t.source } : {},
|
|
46695
46786
|
blockers: t.blockers.map((id) => ({
|
|
46696
46787
|
id,
|
|
46697
|
-
status: p.internal.get(id)?.state ??
|
|
46788
|
+
status: p.internal.get(id)?.state ?? tickets.get(id)?.status ?? "unstarted"
|
|
46698
46789
|
})),
|
|
46699
46790
|
comments: [...p.comments.get(t.id)?.values() ?? []].sort((a, b) => Date.parse(b.at) - Date.parse(a.at) || b.seq - a.seq).slice(0, 12).map(({ body, author, at }) => ({ body, author, at }))
|
|
46700
46791
|
});
|
|
@@ -46731,7 +46822,7 @@ function projectTables(projects, seq, events) {
|
|
|
46731
46822
|
owner: s.owner,
|
|
46732
46823
|
runtime: s.runtime,
|
|
46733
46824
|
handle: s.handle,
|
|
46734
|
-
title:
|
|
46825
|
+
title: tickets.get(s.ticket)?.title ?? s.ticket,
|
|
46735
46826
|
phase,
|
|
46736
46827
|
state,
|
|
46737
46828
|
reason,
|
|
@@ -46751,7 +46842,7 @@ function projectTables(projects, seq, events) {
|
|
|
46751
46842
|
};
|
|
46752
46843
|
for (const s of sessions)
|
|
46753
46844
|
sessionsByState[s.state].push(s);
|
|
46754
|
-
const usage =
|
|
46845
|
+
const usage = p.usage.usage(p.rules.value.policy?.budget?.zone ?? "UTC");
|
|
46755
46846
|
const deliveries = [...p.deliveries.values()].filter((d) => !d.sentAt && sessions.some((s) => s.ticket === d.ticket && s.session === d.session && s.generation === d.generation && !["released", "merged"].includes(s.phase)));
|
|
46756
46847
|
const failures = deliveries.flatMap((d) => {
|
|
46757
46848
|
const session = sessions.find((s) => s.ticket === d.ticket && s.session === d.session && s.generation === d.generation);
|
|
@@ -46774,7 +46865,7 @@ function projectTables(projects, seq, events) {
|
|
|
46774
46865
|
...usage.days.length ? { usage } : {},
|
|
46775
46866
|
...Object.keys(p.readers).length ? { readers: p.readers } : {},
|
|
46776
46867
|
...Object.keys(p.readAt).length ? { readAt: p.readAt } : {},
|
|
46777
|
-
tickets: [...
|
|
46868
|
+
tickets: [...tickets.values()],
|
|
46778
46869
|
pullRequests: [...p.prs.values()],
|
|
46779
46870
|
sessions,
|
|
46780
46871
|
sessionsByState,
|
|
@@ -46788,6 +46879,7 @@ function projectTables(projects, seq, events) {
|
|
|
46788
46879
|
return tables;
|
|
46789
46880
|
}
|
|
46790
46881
|
var linearUsageCheckpoint, readerCheckpoint, empty = () => ({
|
|
46882
|
+
usage: new UsageLedger,
|
|
46791
46883
|
rules: emptyRules(),
|
|
46792
46884
|
readAt: Object.create(null),
|
|
46793
46885
|
readers: Object.create(null),
|
|
@@ -46867,7 +46959,12 @@ import { basename as basename6, dirname as dirname16, join as join19, resolve as
|
|
|
46867
46959
|
// ../core/src/merge.ts
|
|
46868
46960
|
var import_picomatch3 = __toESM(require_picomatch2(), 1);
|
|
46869
46961
|
|
|
46962
|
+
// ../core/src/armada-api.ts
|
|
46963
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
46964
|
+
|
|
46870
46965
|
// ../core/src/http.ts
|
|
46966
|
+
var TRANSIENT_CODE = /^(?:ECONNRESET|ECONNREFUSED|EPIPE|ETIMEDOUT|EAI_AGAIN|ENETUNREACH|EHOSTUNREACH|UND_ERR_(?:CONNECT_TIMEOUT|HEADERS_TIMEOUT|BODY_TIMEOUT|SOCKET)|ConnectionClosed|ConnectionRefused)$/;
|
|
46967
|
+
|
|
46871
46968
|
class UnreadableAnswer extends Error {
|
|
46872
46969
|
status;
|
|
46873
46970
|
constructor(status) {
|
|
@@ -46889,10 +46986,13 @@ class HttpRequestError extends Error {
|
|
|
46889
46986
|
attempts;
|
|
46890
46987
|
transient;
|
|
46891
46988
|
name = "HttpRequestError";
|
|
46989
|
+
code;
|
|
46892
46990
|
constructor(error, timeoutMs, attempts, transient = false) {
|
|
46893
46991
|
super(`${networkReason(error, timeoutMs)}${attempts > 1 ? `; failed after ${attempts} attempts (${attempts === 2 ? "one retry" : `${attempts - 1} retries`})` : ""}`);
|
|
46894
46992
|
this.attempts = attempts;
|
|
46895
46993
|
this.transient = transient;
|
|
46994
|
+
const code = codeOf(error);
|
|
46995
|
+
this.code = code && TRANSIENT_CODE.test(code) ? code : error instanceof Error && error.name === "TimeoutError" ? "TimeoutError" : "network";
|
|
46896
46996
|
}
|
|
46897
46997
|
}
|
|
46898
46998
|
function networkReason(err, timeoutMs) {
|
|
@@ -46919,7 +47019,7 @@ function transient(error) {
|
|
|
46919
47019
|
return true;
|
|
46920
47020
|
const code = codeOf(error);
|
|
46921
47021
|
if (code)
|
|
46922
|
-
return
|
|
47022
|
+
return TRANSIENT_CODE.test(code);
|
|
46923
47023
|
return error instanceof TypeError && error.message === "fetch failed";
|
|
46924
47024
|
}
|
|
46925
47025
|
var retryStatus = (status) => [408, 429, 500, 502, 503, 504].includes(status);
|
|
@@ -46964,11 +47064,23 @@ async function wait(ms, opts, signal) {
|
|
|
46964
47064
|
async function httpRequest(url, init, opts, read) {
|
|
46965
47065
|
init.signal?.throwIfAborted();
|
|
46966
47066
|
const doFetch = opts.fetch ?? fetch;
|
|
46967
|
-
const attempts = opts.retry ? opts.retryStatus ? 3 : 2 : 1;
|
|
47067
|
+
const attempts = opts.retry ? opts.remainingMs ? Number.MAX_SAFE_INTEGER : opts.retryStatus ? 3 : 2 : 1;
|
|
46968
47068
|
let transportRetries = 0;
|
|
46969
47069
|
let waitedMs = 0;
|
|
47070
|
+
let lastError;
|
|
46970
47071
|
for (let attempt = 1;attempt <= attempts; attempt++) {
|
|
46971
|
-
|
|
47072
|
+
init.signal?.throwIfAborted();
|
|
47073
|
+
const remaining = () => opts.remainingMs?.() ?? Number.POSITIVE_INFINITY;
|
|
47074
|
+
const checkBudget = () => {
|
|
47075
|
+
if (remaining() <= 0)
|
|
47076
|
+
throw lastError ?? new HttpRequestError(new DOMException("deadline", "TimeoutError"), 0, attempt);
|
|
47077
|
+
};
|
|
47078
|
+
checkBudget();
|
|
47079
|
+
await opts.beforeAttempt?.();
|
|
47080
|
+
init.signal?.throwIfAborted();
|
|
47081
|
+
checkBudget();
|
|
47082
|
+
const requestLimit = opts.retry ? Math.min(opts.timeoutMs ?? 30000, attempt === 1 ? 5000 : 1e4) : opts.timeoutMs ?? 30000;
|
|
47083
|
+
const limit = Math.max(1, Math.floor(Math.min(requestLimit, remaining())));
|
|
46972
47084
|
const deadline = (opts.timeoutSignal ?? AbortSignal.timeout)(limit);
|
|
46973
47085
|
const controller = new AbortController;
|
|
46974
47086
|
const signal = init.signal ? AbortSignal.any([controller.signal, init.signal]) : controller.signal;
|
|
@@ -46998,15 +47110,16 @@ async function httpRequest(url, init, opts, read) {
|
|
|
46998
47110
|
}
|
|
46999
47111
|
if (opts.retry && opts.retryStatus?.(response.status)) {
|
|
47000
47112
|
const after = retryAfterMs(response.headers.get("Retry-After"), opts.now ?? (() => new Date));
|
|
47001
|
-
const
|
|
47002
|
-
if (response.status === 429 && after !== null && after >
|
|
47113
|
+
const waitBudget = Math.min(opts.remainingMs ? remaining() : 14000 - waitedMs, 1e4);
|
|
47114
|
+
if (response.status === 429 && after !== null && after > waitBudget)
|
|
47003
47115
|
throw new HttpStatusError(429, `${after / 1000} s`);
|
|
47004
47116
|
if (attempt < attempts) {
|
|
47117
|
+
lastError = new HttpStatusError(response.status, "the confirmed request budget expires");
|
|
47005
47118
|
const base = attempt === 1 ? 1000 : 3000;
|
|
47006
47119
|
const jitter = base * (0.8 + (opts.random ?? Math.random)() * 0.4);
|
|
47007
47120
|
pause = {
|
|
47008
47121
|
status: response.status,
|
|
47009
|
-
ms: Math.
|
|
47122
|
+
ms: Math.max(0, Math.min(waitBudget, Math.max(after ?? 0, Math.round(jitter))))
|
|
47010
47123
|
};
|
|
47011
47124
|
await response.body?.cancel().catch(() => {});
|
|
47012
47125
|
return;
|
|
@@ -47015,6 +47128,7 @@ async function httpRequest(url, init, opts, read) {
|
|
|
47015
47128
|
return read(response);
|
|
47016
47129
|
})()
|
|
47017
47130
|
]);
|
|
47131
|
+
checkBudget();
|
|
47018
47132
|
if (!pause)
|
|
47019
47133
|
return answer;
|
|
47020
47134
|
} catch (error) {
|
|
@@ -47026,11 +47140,18 @@ async function httpRequest(url, init, opts, read) {
|
|
|
47026
47140
|
const transport = fetchFailed || deadline.aborted || transient(cause) || unreadable;
|
|
47027
47141
|
if (!transport)
|
|
47028
47142
|
throw error;
|
|
47029
|
-
|
|
47143
|
+
const failure = new HttpRequestError(cause, limit, attempt, retryable);
|
|
47144
|
+
lastError = failure;
|
|
47145
|
+
if (attempt < attempts && (transportRetries < 1 || opts.remainingMs) && (!response || response.ok) && retryable) {
|
|
47030
47146
|
transportRetries++;
|
|
47031
|
-
|
|
47147
|
+
pause = {
|
|
47148
|
+
status: null,
|
|
47149
|
+
code: failure.code,
|
|
47150
|
+
ms: transportRetries === 1 ? 0 : Math.max(0, Math.min(1e4, remaining(), 3000))
|
|
47151
|
+
};
|
|
47152
|
+
} else {
|
|
47153
|
+
throw failure;
|
|
47032
47154
|
}
|
|
47033
|
-
throw new HttpRequestError(cause, limit, attempt, retryable);
|
|
47034
47155
|
} finally {
|
|
47035
47156
|
deadline.removeEventListener("abort", onDeadline);
|
|
47036
47157
|
controller.abort();
|
|
@@ -47038,7 +47159,8 @@ async function httpRequest(url, init, opts, read) {
|
|
|
47038
47159
|
response.body.cancel().catch(() => {});
|
|
47039
47160
|
}
|
|
47040
47161
|
if (pause) {
|
|
47041
|
-
|
|
47162
|
+
if (pause.status !== null || opts.remainingMs)
|
|
47163
|
+
opts.onRetry?.(`${opts.service ?? "Service"} ${pause.status === null ? `unreachable (${pause.code})` : `answered ${pause.status}`}; trying again in ${Math.round(pause.ms / 100) / 10} s (${opts.remainingMs ? "attempt " : ""}${attempt + 1}${opts.remainingMs ? "" : `/${attempts}`})`);
|
|
47042
47164
|
waitedMs += pause.ms;
|
|
47043
47165
|
await wait(pause.ms, opts, init.signal);
|
|
47044
47166
|
}
|
|
@@ -47080,14 +47202,20 @@ class ArmadaApiError extends Error {
|
|
|
47080
47202
|
signedOut;
|
|
47081
47203
|
status;
|
|
47082
47204
|
upgrade;
|
|
47083
|
-
|
|
47205
|
+
transient;
|
|
47206
|
+
constructor(message, next = null, signedOut = false, status = null, upgrade = null, transient = false) {
|
|
47084
47207
|
super(message);
|
|
47085
47208
|
this.next = next;
|
|
47086
47209
|
this.signedOut = signedOut;
|
|
47087
47210
|
this.status = status;
|
|
47088
47211
|
this.upgrade = upgrade;
|
|
47212
|
+
this.transient = transient;
|
|
47089
47213
|
}
|
|
47090
47214
|
}
|
|
47215
|
+
var fleetRequests = new AsyncLocalStorage;
|
|
47216
|
+
function withArmadaFleetRequest(request, act) {
|
|
47217
|
+
return fleetRequests.run(request, act);
|
|
47218
|
+
}
|
|
47091
47219
|
var LOGIN_NEXT = "armada login";
|
|
47092
47220
|
var TIMEOUT_MS = 30000;
|
|
47093
47221
|
function apiBaseUrl(value) {
|
|
@@ -47113,7 +47241,7 @@ function armadaApi(opts) {
|
|
|
47113
47241
|
const host = base.host;
|
|
47114
47242
|
let serverCli = null;
|
|
47115
47243
|
async function call(method, path, init = {}) {
|
|
47116
|
-
const limit = init.timeoutMs ?? timeoutMs;
|
|
47244
|
+
const limit = Math.min(init.timeoutMs ?? timeoutMs, init.request ? 15000 : Number.POSITIVE_INFINITY);
|
|
47117
47245
|
const headers = { Accept: "application/json" };
|
|
47118
47246
|
if (init.body)
|
|
47119
47247
|
headers["Content-Type"] = "application/json";
|
|
@@ -47126,9 +47254,11 @@ function armadaApi(opts) {
|
|
|
47126
47254
|
return httpRequest(new URL(`api/cli/${path}`, base).toString(), {
|
|
47127
47255
|
method,
|
|
47128
47256
|
headers,
|
|
47257
|
+
signal: init.request?.signal,
|
|
47129
47258
|
...init.body ? { body: JSON.stringify(init.body) } : {}
|
|
47130
47259
|
}, {
|
|
47131
47260
|
...opts,
|
|
47261
|
+
...init.request,
|
|
47132
47262
|
timeoutMs: limit,
|
|
47133
47263
|
retry: init.retry ?? method === "GET",
|
|
47134
47264
|
retryStatus: (status) => retryStatus(status) && (path !== "credentials" || status !== 429),
|
|
@@ -47159,7 +47289,7 @@ function armadaApi(opts) {
|
|
|
47159
47289
|
if (err instanceof HttpStatusError)
|
|
47160
47290
|
throw new ArmadaApiError(`Armada (${host}) ${err.message}`, "the same command after the rate limit expires", false, err.status);
|
|
47161
47291
|
if (err instanceof HttpRequestError)
|
|
47162
|
-
throw new ArmadaApiError(`Armada (${host}) unreachable: ${err.message} (${method} ${path})`, "the same command again once it answers, or check ARMADA_API_URL");
|
|
47292
|
+
throw new ArmadaApiError(`Armada (${host}) unreachable: ${init.request ? err.code : err.message} (${method} ${path})`, "the same command again once it answers, or check ARMADA_API_URL", false, null, null, err.transient);
|
|
47163
47293
|
throw err;
|
|
47164
47294
|
});
|
|
47165
47295
|
}
|
|
@@ -47253,11 +47383,14 @@ function armadaApi(opts) {
|
|
|
47253
47383
|
] : []);
|
|
47254
47384
|
},
|
|
47255
47385
|
async fleet(signIn, op, body, timeoutMs) {
|
|
47386
|
+
const context = fleetRequests.getStore();
|
|
47387
|
+
const request = context?.operation === op ? context : undefined;
|
|
47256
47388
|
const { status, body: answer } = await call("POST", `fleet/${op}`, {
|
|
47257
47389
|
signIn,
|
|
47258
47390
|
body,
|
|
47259
47391
|
...timeoutMs ? { timeoutMs } : {},
|
|
47260
|
-
|
|
47392
|
+
request,
|
|
47393
|
+
retry: request?.retry ?? [
|
|
47261
47394
|
"job/list",
|
|
47262
47395
|
"events/latest",
|
|
47263
47396
|
"events/state",
|
|
@@ -47278,8 +47411,11 @@ function armadaApi(opts) {
|
|
|
47278
47411
|
});
|
|
47279
47412
|
if (status === 304)
|
|
47280
47413
|
return null;
|
|
47281
|
-
if (status !== 200)
|
|
47414
|
+
if (status !== 200) {
|
|
47415
|
+
if (request)
|
|
47416
|
+
throw new ArmadaApiError(`Armada refused fleet/${op} (HTTP ${status})`, status === 401 ? LOGIN_NEXT : null, status === 401, status);
|
|
47282
47417
|
throw refusal(status, answer, status === 401 ? null : "Armada refused");
|
|
47418
|
+
}
|
|
47283
47419
|
if (!("result" in answer))
|
|
47284
47420
|
throw new ArmadaApiError(`Armada (${host}) answered fleet/${op} in a shape this CLI does not know`);
|
|
47285
47421
|
return answer.result;
|
|
@@ -57729,6 +57865,7 @@ async function readProjectConfig(p, opts) {
|
|
|
57729
57865
|
// ../core/src/queue-drain.ts
|
|
57730
57866
|
var TTL_MS = 10 * 60000;
|
|
57731
57867
|
var POLL_MS = 30000;
|
|
57868
|
+
var MARGIN_MS = 30000;
|
|
57732
57869
|
var BACKOFF_MS2 = [60000, 5 * 60000, 15 * 60000];
|
|
57733
57870
|
var PROGRESS_MAX = 300;
|
|
57734
57871
|
|
|
@@ -57737,20 +57874,76 @@ class TakenOver extends Refusal {
|
|
|
57737
57874
|
super("the queue was taken over", "armada merge --drain after its current holder finishes");
|
|
57738
57875
|
}
|
|
57739
57876
|
}
|
|
57740
|
-
var temporary = (err) => err instanceof ArmadaApiError ? !err.signedOut && !err.upgrade && (err.status ===
|
|
57877
|
+
var temporary = (err) => err instanceof ArmadaApiError ? !err.signedOut && !err.upgrade && (err.transient || err.status === 429 || err.status !== null && err.status >= 500) : err instanceof MergeStateError ? err.transient || !err.pull : err instanceof Error && ("transient" in err) && err.transient === true;
|
|
57741
57878
|
async function drainMergeQueue(ctx, fleet, opts) {
|
|
57879
|
+
const duration = opts.monotonic ?? (() => performance.now());
|
|
57880
|
+
const acquiredAt = duration();
|
|
57742
57881
|
const lease = { name: MERGE_QUEUE_LEASE, holder: ctx.holder, ttlMs: TTL_MS };
|
|
57743
57882
|
const got = await fleet.acquireLease(lease);
|
|
57744
57883
|
if (!got.acquired)
|
|
57745
57884
|
throw new Refusal(`drained by ${got.held?.holder ?? "another coordinator"} until ${got.held?.expiresAt ?? "unknown"}`, "armada merge --drain once that coordinator finishes");
|
|
57746
57885
|
let pulseError = null;
|
|
57886
|
+
let confirmedUntil = acquiredAt + TTL_MS;
|
|
57887
|
+
let renewing = null;
|
|
57888
|
+
const controller = new AbortController;
|
|
57889
|
+
const signal = opts.signal ? AbortSignal.any([controller.signal, opts.signal]) : controller.signal;
|
|
57747
57890
|
let pulse = Promise.resolve();
|
|
57748
57891
|
let stopPulse;
|
|
57892
|
+
const request = (operation, act, fence = false) => {
|
|
57893
|
+
const began = duration();
|
|
57894
|
+
const until = confirmedUntil;
|
|
57895
|
+
let notified = false;
|
|
57896
|
+
return withArmadaFleetRequest({
|
|
57897
|
+
operation,
|
|
57898
|
+
signal,
|
|
57899
|
+
retry: true,
|
|
57900
|
+
remainingMs: () => Math.min(until, confirmedUntil) - duration() - MARGIN_MS,
|
|
57901
|
+
beforeAttempt: fence ? tick : undefined,
|
|
57902
|
+
sleep: ctx.sleep,
|
|
57903
|
+
onRetry: (message) => {
|
|
57904
|
+
if (notified)
|
|
57905
|
+
return;
|
|
57906
|
+
notified = true;
|
|
57907
|
+
ctx.progress?.(`Armada unreachable, ${operation === "lease/renew" ? "renewing the lease" : operation} again: ${message}; elapsed ${Math.ceil((duration() - began) / 1000)} s; remaining ${Math.max(0, Math.floor((until - duration() - MARGIN_MS) / 1000))} s`);
|
|
57908
|
+
}
|
|
57909
|
+
}, async () => {
|
|
57910
|
+
const answer = await act();
|
|
57911
|
+
if (operation === "holds" && !Array.isArray(answer))
|
|
57912
|
+
throw new Refusal("Armada returned an invalid hold answer; nothing was merged", "armada merge --drain once Armada answers");
|
|
57913
|
+
return answer;
|
|
57914
|
+
}).catch((error) => {
|
|
57915
|
+
if (!(operation === "queue/progress" && error instanceof ArmadaApiError && error.status === 404))
|
|
57916
|
+
pulseError ??= error;
|
|
57917
|
+
throw error;
|
|
57918
|
+
});
|
|
57919
|
+
};
|
|
57749
57920
|
const tick = async () => {
|
|
57921
|
+
signal.throwIfAborted();
|
|
57922
|
+
if (pulseError)
|
|
57923
|
+
throw pulseError;
|
|
57924
|
+
if (duration() >= confirmedUntil - MARGIN_MS) {
|
|
57925
|
+
pulseError = new Refusal("the queue lease expired; nothing was merged", "armada merge --drain once Armada answers");
|
|
57926
|
+
throw pulseError;
|
|
57927
|
+
}
|
|
57928
|
+
if (!renewing) {
|
|
57929
|
+
const started = duration();
|
|
57930
|
+
renewing = request("lease/renew", () => fleet.renewLease(lease)).then((held) => {
|
|
57931
|
+
if (held === false)
|
|
57932
|
+
throw new TakenOver;
|
|
57933
|
+
if (held !== true)
|
|
57934
|
+
throw new Refusal("Armada returned an invalid lease renewal; nothing was merged", "armada merge --drain once Armada answers");
|
|
57935
|
+
confirmedUntil = started + TTL_MS;
|
|
57936
|
+
}).catch((error) => {
|
|
57937
|
+
pulseError = error;
|
|
57938
|
+
throw error;
|
|
57939
|
+
}).finally(() => {
|
|
57940
|
+
renewing = null;
|
|
57941
|
+
});
|
|
57942
|
+
}
|
|
57943
|
+
await renewing;
|
|
57944
|
+
signal.throwIfAborted();
|
|
57750
57945
|
if (pulseError)
|
|
57751
57946
|
throw pulseError;
|
|
57752
|
-
if (!await fleet.renewLease(lease))
|
|
57753
|
-
throw new TakenOver;
|
|
57754
57947
|
};
|
|
57755
57948
|
const sleep = async (ms) => {
|
|
57756
57949
|
for (let remaining = ms;remaining > 0; remaining -= POLL_MS) {
|
|
@@ -57767,8 +57960,9 @@ async function drainMergeQueue(ctx, fleet, opts) {
|
|
|
57767
57960
|
if (mutations && !mutations.includes(key))
|
|
57768
57961
|
return value.bind(target);
|
|
57769
57962
|
return async (...args) => {
|
|
57963
|
+
await recorded;
|
|
57770
57964
|
await tick();
|
|
57771
|
-
const result = await Reflect.apply(value, target, args);
|
|
57965
|
+
const result = key === "holds" ? await request("holds", () => Reflect.apply(value, target, args), true) : await Reflect.apply(value, target, args);
|
|
57772
57966
|
if (!mutations)
|
|
57773
57967
|
await tick();
|
|
57774
57968
|
return result;
|
|
@@ -57785,7 +57979,14 @@ async function drainMergeQueue(ctx, fleet, opts) {
|
|
|
57785
57979
|
if (!entry || !detail || detail === shown)
|
|
57786
57980
|
return;
|
|
57787
57981
|
shown = detail;
|
|
57788
|
-
recorded = recorded.then(
|
|
57982
|
+
recorded = recorded.then(async () => {
|
|
57983
|
+
const held = await request("queue/progress", () => fleet.queueProgress({ id: entry.id, holder: ctx.holder, detail }), true);
|
|
57984
|
+
if (held !== true)
|
|
57985
|
+
throw new TakenOver;
|
|
57986
|
+
}).then(() => {}, (error) => {
|
|
57987
|
+
if (!(error instanceof ArmadaApiError && error.status === 404))
|
|
57988
|
+
pulseError = error;
|
|
57989
|
+
});
|
|
57789
57990
|
};
|
|
57790
57991
|
const run = {
|
|
57791
57992
|
...ctx,
|
|
@@ -57822,12 +58023,13 @@ async function drainMergeQueue(ctx, fleet, opts) {
|
|
|
57822
58023
|
});
|
|
57823
58024
|
for (;; ) {
|
|
57824
58025
|
await tick();
|
|
57825
|
-
const next = await fleet.queueNext({ holder: ctx.holder });
|
|
58026
|
+
const next = await request("queue/next", () => fleet.queueNext({ holder: ctx.holder }), true);
|
|
57826
58027
|
if ("refused" in next)
|
|
57827
58028
|
throw new TakenOver;
|
|
58029
|
+
await tick();
|
|
57828
58030
|
const entry = next.entry;
|
|
57829
58031
|
if (!entry) {
|
|
57830
|
-
const pending = (await fleet.queueList()).find(queueOpen);
|
|
58032
|
+
const pending = (await request("queue/list", () => fleet.queueList(), true)).find(queueOpen);
|
|
57831
58033
|
if (!pending) {
|
|
57832
58034
|
ctx.progress?.("queue empty");
|
|
57833
58035
|
return;
|
|
@@ -57888,6 +58090,7 @@ async function drainMergeQueue(ctx, fleet, opts) {
|
|
|
57888
58090
|
} finally {
|
|
57889
58091
|
stopPulse?.();
|
|
57890
58092
|
current = null;
|
|
58093
|
+
controller.abort();
|
|
57891
58094
|
await Promise.all([pulse, recorded]);
|
|
57892
58095
|
await fleet.releaseLease(lease).catch(() => {});
|
|
57893
58096
|
}
|
|
@@ -57967,11 +58170,12 @@ You are a worker. You own exactly one ticket, named in your launch brief. You tu
|
|
|
57967
58170
|
- **Keep going on setup choices.** When setup needs a choice (an install fallback, a retry, a missing tool), take the safe option, say which in your next report, and go on. Never stop to ask about it.
|
|
57968
58171
|
- **Stop by impact, not effort.** There is no budget of attempts. Failing tests, many files and layout defects are reasons to keep going. Stop and ask only when the fix breaks a contract another ticket or caller relies on, moves a module's responsibility, or a design choice the ticket does not settle remains; name the interface and who it affects. Never widen the ticket to avoid asking. Decide reversible technical choices yourself and record each one, with its reason, on the ticket and in the pull request.
|
|
57969
58172
|
- **Work only in your own branch and worktree.** Never touch another agent's checkout, and stop only the processes you started.
|
|
58173
|
+
- **Never drive the owner's desktop.** A local worker runs on the owner's logged-in machine. Never open a window or an app (\`open -a\`, a packaged app's binary), bring one to the front, script System Events (\`osascript\`, AppleScript) or capture the screen (\`screencapture\`). Verify a GUI app headless or offscreen: an Electron window under test is \`new BrowserWindow({ show: false })\` behind a flag (the Armada desktop shell honours \`ARMADA_DESKTOP_HEADLESS=1\`, which a local Claude launch sets in your environment; set it yourself otherwise: no window, no dock icon, its data apart, only the catalog and log it is given), and the assertions go through the app's own HTTP and WebSocket endpoints, as its lifecycle tests do. What needs eyes on a screen goes to the coordinator or the owner as a written procedure in your hand-back.
|
|
57970
58174
|
- **Shared numbers and names come from \`armada reserve\`, never a guess**: a migration number, a port, a fixture name. \`armada reserve db-migration --next --floor <last number used on main>\` prints the next free number; \`--value <name>\` takes a name; a key alone takes an exclusive resource. \`armada reserve --list\` shows the holders. Reservations end when you release, stay used after merge, and \`armada unreserve <key>\` frees yours early. After a lost answer, list before retrying. If Armada is down, ask the coordinator before choosing.
|
|
57971
58175
|
- **Long runs go through \`armada job\`, never in your session**: an evaluation, a backfill, a load test. \`armada job start <name> --ticket <id>\` dispatches one of the project's \`[jobs.<name>]\` on its own runner; \`armada job status\` asks the runner, \`armada job list\` reads stored progress, \`armada job stop <id>\` stops it. You only see your own ticket's jobs. Unchanged progress past \`[jobs.<name>] stall_minutes\` (60 by default) alerts the coordinator as \`job-stalled\`; keep reporting meaningful progress. Nothing is stopped for you.
|
|
57972
58176
|
- **Secrets come from Armada**, never from your launch environment; \`armada secrets\` lists their names. Run commands that need them with \`armada run -- <command>\` (tests, builds, dev servers): the values reach that command only, and its output is masked. A tool that reads a dotenv file gets \`armada secrets export --file <path>\`, at a path git ignores. A secret you need and do not have: \`armada ask --secret <NAME> "<why>"\`; the coordinator sends the owner a link to set it, and tells you when to re-run. Never ask for a value in chat; a value pasted anywhere must be rotated.
|
|
57973
58177
|
- **Your tool output is your transcript.** Never print environment variables (\`env\`, \`printenv\`, \`echo $VAR\`), process lists with their arguments (\`ps -ef\`, \`ps aux\`, \`/proc/*/environ\`), or credential files, and never run \`armada secrets get\`. Never commit or log a secret. Masking is a safety net, not permission: values under eight characters and encoded values are not masked.
|
|
57974
|
-
- **Evidence goes through Armada, not git.** For every visible change, capture screenshots under a gitignored folder, then \`armada attach <ticket> <files|https-urls>... --caption "<what to check>"\`, and link the printed private URLs in the pull request. Images are PNG, JPEG, WebP or GIF, 2 MB each.
|
|
58178
|
+
- **Evidence goes through Armada, not git.** For every visible change, capture screenshots under a gitignored folder (from a headless browser or the app's own offscreen capture, never the owner's screen), then \`armada attach <ticket> <files|https-urls>... --caption "<what to check>"\`, and link the printed private URLs in the pull request. Images are PNG, JPEG, WebP or GIF, 2 MB each.
|
|
57975
58179
|
|
|
57976
58180
|
## Report vocabulary
|
|
57977
58181
|
|
|
@@ -62376,7 +62580,7 @@ ${attachments.join(`
|
|
|
62376
62580
|
};
|
|
62377
62581
|
}
|
|
62378
62582
|
// package.json
|
|
62379
|
-
var version2 = "0.2.
|
|
62583
|
+
var version2 = "0.2.72";
|
|
62380
62584
|
|
|
62381
62585
|
// src/io.ts
|
|
62382
62586
|
class UsageError extends Error {
|
|
@@ -63796,13 +64000,14 @@ async function preflight(io, branch) {
|
|
|
63796
64000
|
const root = io.coordinatorRoot ?? io.cwd;
|
|
63797
64001
|
if (!branch)
|
|
63798
64002
|
return "cannot push worker branch: the claim has no branch";
|
|
64003
|
+
const gitTimeoutMs = 20000;
|
|
63799
64004
|
for (const [action, args] of [
|
|
63800
|
-
["
|
|
63801
|
-
[`push
|
|
64005
|
+
["ls-remote origin HEAD", ["ls-remote", "origin", "HEAD"]],
|
|
64006
|
+
[`push --dry-run origin HEAD:refs/heads/${branch}`, ["push", "--dry-run", "origin", `HEAD:refs/heads/${branch}`]]
|
|
63802
64007
|
]) {
|
|
63803
64008
|
const result = await io.exec("git", [...args], {
|
|
63804
64009
|
cwd: root,
|
|
63805
|
-
timeoutMs:
|
|
64010
|
+
timeoutMs: gitTimeoutMs,
|
|
63806
64011
|
maxOutputBytes: 16384,
|
|
63807
64012
|
processGroup: true,
|
|
63808
64013
|
env: { ...io.env, GIT_TERMINAL_PROMPT: "0" }
|
|
@@ -63810,7 +64015,7 @@ async function preflight(io, branch) {
|
|
|
63810
64015
|
if (!result)
|
|
63811
64016
|
return `cannot ${action}: git could not be run`;
|
|
63812
64017
|
if (result.timedOut)
|
|
63813
|
-
return `cannot ${action}: timed out after
|
|
64018
|
+
return `cannot ${action}: timed out after ${gitTimeoutMs / 1000} seconds`;
|
|
63814
64019
|
if (result.outputExceeded)
|
|
63815
64020
|
return `cannot ${action}: Git output exceeded the check's limit`;
|
|
63816
64021
|
if (result.code !== 0) {
|
|
@@ -63880,7 +64085,7 @@ async function outgoingRedactor(io, config, credentials) {
|
|
|
63880
64085
|
}
|
|
63881
64086
|
|
|
63882
64087
|
// src/runtimes/adapter.ts
|
|
63883
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
64088
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
63884
64089
|
import { createHash as createHash6 } from "node:crypto";
|
|
63885
64090
|
|
|
63886
64091
|
// src/runtimes/claude-code.ts
|
|
@@ -69040,11 +69245,11 @@ function sharesRuntimeWorkspace(ref, other) {
|
|
|
69040
69245
|
return ref.handle === other.handle || ref.runtime === "conductor" && runtimeNameOf(other.runtime) === "conductor" && ref.handle.split("/")[0] === other.handle.split("/")[0];
|
|
69041
69246
|
}
|
|
69042
69247
|
var stale = (ticket) => new RuntimeError(`${ticket}'s claim changed; left the runtime untouched`, "stale", "armada inbox");
|
|
69043
|
-
var leases = new
|
|
69248
|
+
var leases = new AsyncLocalStorage2;
|
|
69044
69249
|
function withRuntimeLease(check, act) {
|
|
69045
69250
|
return leases.run(check, act);
|
|
69046
69251
|
}
|
|
69047
|
-
var guards = new
|
|
69252
|
+
var guards = new AsyncLocalStorage2;
|
|
69048
69253
|
function same(a, b) {
|
|
69049
69254
|
return a.ticket === b.ticket && a.runtime === b.runtime && a.handle === b.handle && a.claimedAt === b.claimedAt && a.launchId === b.launchId && a.releasedAt === b.releasedAt && (a.claimedAt === null || (a.branch ?? null) === (b.branch ?? null));
|
|
69050
69255
|
}
|