@the-vibe-company/armada 0.1.9 → 0.1.11
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/README.md +4 -1
- package/dist/armada.js +130 -36
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,6 +90,7 @@ armada release --reason "wrong ticket"
|
|
|
90
90
|
|
|
91
91
|
- `claim` re-reads the ticket and refuses it when another worker holds it; if two claims race, the older comment wins and the other withdraws. It assigns the ticket to the Linear key's user, moves it to the team's first started state, sets the `planning` phase label and the runtime label (matched by name, so `conductor` finds `Conductor`), and posts an `Agent claim — runtime · session · branch · started` line. The handle is kept in that comment and in Turso, so a coordinator finds the session either way. Claiming again with the same handle repairs labels and state. It reads every comment and label of the ticket, however many.
|
|
92
92
|
- `report <phase>` accepts: planning → awaiting-approval or implementing; awaiting-approval → planning or implementing; implementing → shipping; shipping → implementing or ready-to-merge; ready-to-merge → shipping; blocked from anywhere and back to any phase; the current phase again as a status update. Anything else exits 1 with the reason. The output lists what waits in the worker's inbox.
|
|
93
|
+
- `report`, `ask` and `answer` accept `--message-file -` to read standard input to EOF, including a pipe or a shell heredoc. For example: `printf 'line one\nline two' | bun run armada report implementing --ticket ABC-12 --message-file -`. An explicitly empty or whitespace-only message file or stdin exits 2 before any tracker or database write, with a retry naming `--message` or a non-empty pipe. A `ready-to-merge` report may still omit the message option.
|
|
93
94
|
- `claim` and `report` read the ticket back and print where it stands, for example `Now: In Progress · phase implementing · runtime Conductor · profile none`, so a worker can check it without opening Linear. `--json` carries the same as `state`.
|
|
94
95
|
- `ready-to-merge` is refused unless the pull request is open in the project repository, `--sha` is the full 40-character SHA of its head, and every check in `[gates] required_checks` is green on that head (with none declared: at least one check, all green). It needs a GitHub token.
|
|
95
96
|
- `release` removes the phase and runtime labels, moves the ticket back to the team's first unstarted state and posts `Agent status: released — <reason>`.
|
|
@@ -109,6 +110,7 @@ armada answer --note ABC-12 "main moved: rebase before you ship" # an unsolicit
|
|
|
109
110
|
- `ask` reports the `blocked` phase with `Agent status: blocked — question: <first line>` (the rest and the numbered options below it) and adds a `question` item to the coordinator's inbox in Turso. The worker then stops and waits for the answer in its session, and reports the phase it resumes. It finds the ticket like `report`.
|
|
110
111
|
- `inbox` lists the coordinator's open items (questions, requests, hand-backs) and silent workers, oldest first. A worker is silent when it holds a ticket, its newest Turso event is older than `policy.silence_minutes`, and its phase does not wait on someone else. It reads Turso only (no Linear key) and records that the coordinator is at work, for the dashboard. `--wait` polls every 5 s and marks the items that were not there before with `*`; loop on it.
|
|
111
112
|
- `answer` never calls a runtime: deliver the answer first with the runtime guide's message section. It posts `Agent status: <current phase> — answer: …` on the ticket and resolves the item. An item id needs Turso; a ticket id answers that ticket's open questions and also works without Turso. `--note` records a message the worker did not ask for as `Agent status: <phase> — note: …`. These two are the coordinator's records: Armada never reads them as the worker's phase, hand-back or sign of life. Only questions and requests can be answered; `merge` resolves hand-backs, and `release` and `merge` resolve the ticket's open questions. A worker that does not report within `policy.silence_minutes` of an answer shows as silent.
|
|
113
|
+
- The dashboard adds two kinds of request, signed by the person who made them. An `answer-request` carries the owner's answer to an open question: deliver it, then `armada answer <request id> "<answer>"`, which resolves the request and its question and names the requester on the ticket (answering the question itself also closes a waiting request). A `launch-request` asks to launch a ready ticket on a profile: launch it as usual; the worker's `armada claim` resolves it and posts who asked. To decline one, `armada answer <request id> "<why>"`: it is closed with the reason and nothing is posted on the ticket.
|
|
112
114
|
|
|
113
115
|
## Merge a finished pull request (coordinator)
|
|
114
116
|
|
|
@@ -132,6 +134,7 @@ armada merge 34 # or the pull request URL; --ticket ABC-12 when the
|
|
|
132
134
|
- **Waiting for you** comes first, across projects. It lists questions, blocked workers, plans to approve, hand-backs and silent workers, the most urgent first.
|
|
133
135
|
- **At work** has one row per ticket in flight. A row shows the project, the runtime and session, the six-step phase pipeline, time in phase, the last report, the pull request with its CI, and the flags (red CI, conflict, double claim).
|
|
134
136
|
- A filter shows one project. Each project shows whether its coordinator is active, from its last inbox read.
|
|
137
|
+
- **Answer** a question from its line in Waiting for you (an option of the question fills the answer in). **Ready to launch** lists the frontier with a Launch button and a profile picker, the routed profile preselected. Neither reaches a worker: each becomes a request in that project's coordinator inbox, signed with the name the viewer gives (remembered in a cookie; default `ARMADA_DASHBOARD_AUTHOR`), and shows as pending until the coordinator carries it out. The dashboard holds no runtime credential.
|
|
135
138
|
- It stays live without a reload. Linear and GitHub are read at most once a minute per project. Turso is read on every 5-second poll, so a worker's `armada report` shows within seconds.
|
|
136
139
|
- When Turso is unreachable, a banner says so and the view falls back to Linear and GitHub.
|
|
137
140
|
- The interface is in English or French (`ARMADA_DASHBOARD_LANGUAGE`, or the EN/FR switch).
|
|
@@ -148,7 +151,7 @@ bun run demo:report WID-12 shipping "Opened the pull request" # w
|
|
|
148
151
|
**Deploy on Vercel.** Create a project from this repository and set these options:
|
|
149
152
|
|
|
150
153
|
- Root Directory: `packages/dashboard`, with files outside the root directory included (the default). The framework preset is Next.js, and Bun installs the workspace from `bun.lock`.
|
|
151
|
-
- Environment variables: `ARMADA_DASHBOARD_PASSWORD`, `LINEAR_API_KEY`, `GITHUB_TOKEN`, `ARMADA_TURSO_URL` and `ARMADA_TURSO_TOKEN`. Optional: `ARMADA_REPOSITORIES` (the `owner/name` list shown while Turso is unreachable on a fresh server), `ARMADA_DASHBOARD_LANGUAGE` (`en` or `fr`)
|
|
154
|
+
- Environment variables: `ARMADA_DASHBOARD_PASSWORD`, `LINEAR_API_KEY`, `GITHUB_TOKEN`, `ARMADA_TURSO_URL` and `ARMADA_TURSO_TOKEN`. Optional: `ARMADA_REPOSITORIES` (the `owner/name` list shown while Turso is unreachable on a fresh server), `ARMADA_DASHBOARD_LANGUAGE` (`en` or `fr`), `ARMADA_DASHBOARD_SNAPSHOT_SECONDS` (Linear and GitHub read period, default 60) and `ARMADA_DASHBOARD_AUTHOR` (the name requests are signed with until a viewer gives theirs). Never add a runtime token (Conductor or other): the coordinator carries out every request.
|
|
152
155
|
- The keys stay on the server; the browser only receives the fleet reading.
|
|
153
156
|
|
|
154
157
|
**Password.** The dashboard asks for `ARMADA_DASHBOARD_PASSWORD` before it shows anything, on every host, a custom domain included. Every page, the polling route and every server action answer 401 or send the viewer to the login page until then; only the build's static files are public.
|
package/dist/armada.js
CHANGED
|
@@ -20,7 +20,9 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
20
20
|
|
|
21
21
|
// src/main.ts
|
|
22
22
|
import { spawn, spawnSync } from "node:child_process";
|
|
23
|
+
import { createReadStream } from "node:fs";
|
|
23
24
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
25
|
+
import { isatty } from "node:tty";
|
|
24
26
|
|
|
25
27
|
// src/cli.ts
|
|
26
28
|
import { dirname as dirname3, join as join5, resolve } from "node:path";
|
|
@@ -2100,6 +2102,18 @@ var MIGRATIONS = [
|
|
|
2100
2102
|
PRIMARY KEY (project, ticket)
|
|
2101
2103
|
)`
|
|
2102
2104
|
]
|
|
2105
|
+
},
|
|
2106
|
+
{
|
|
2107
|
+
version: 4,
|
|
2108
|
+
statements: [
|
|
2109
|
+
`CREATE TABLE IF NOT EXISTS inbox_requests (
|
|
2110
|
+
item INTEGER PRIMARY KEY,
|
|
2111
|
+
project TEXT NOT NULL,
|
|
2112
|
+
question INTEGER,
|
|
2113
|
+
profile TEXT
|
|
2114
|
+
)`,
|
|
2115
|
+
"CREATE INDEX IF NOT EXISTS inbox_requests_by_question ON inbox_requests (project, question)"
|
|
2116
|
+
]
|
|
2103
2117
|
}
|
|
2104
2118
|
];
|
|
2105
2119
|
var SCHEMA_VERSION = MIGRATIONS.at(-1)?.version ?? 0;
|
|
@@ -2340,26 +2354,10 @@ async function putHandBack(db, item) {
|
|
|
2340
2354
|
if (!updated.rowsAffected)
|
|
2341
2355
|
await addInboxItem(db, { ...item, kind: "hand-back", recipient: "coordinator" });
|
|
2342
2356
|
}
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
ORDER BY created_at, id`,
|
|
2348
|
-
args: q.ticket ? [q.project, q.recipient, q.ticket] : [q.project, q.recipient]
|
|
2349
|
-
});
|
|
2350
|
-
return rs.rows.map((r) => ({
|
|
2351
|
-
id: Number(r.id),
|
|
2352
|
-
project: String(r.project),
|
|
2353
|
-
ticket: r.ticket === null ? null : String(r.ticket),
|
|
2354
|
-
kind: String(r.kind),
|
|
2355
|
-
recipient: String(r.recipient),
|
|
2356
|
-
author: r.author === null ? null : String(r.author),
|
|
2357
|
-
body: String(r.body),
|
|
2358
|
-
createdAt: String(r.created_at)
|
|
2359
|
-
}));
|
|
2360
|
-
}
|
|
2361
|
-
var INBOX_COLUMNS = "id, project, ticket, kind, recipient, author, body, created_at, resolved_at, resolution";
|
|
2362
|
-
var inboxRow = (r) => ({
|
|
2357
|
+
var INBOX_COLUMNS = `i.id, i.project, i.ticket, i.kind, i.recipient, i.author, i.body, i.created_at,
|
|
2358
|
+
i.resolved_at, i.resolution, q.item AS request_item, q.question AS request_question, q.profile AS request_profile`;
|
|
2359
|
+
var INBOX_FROM = "inbox_items i LEFT JOIN inbox_requests q ON q.item = i.id";
|
|
2360
|
+
var inboxItem = (r) => ({
|
|
2363
2361
|
id: Number(r.id),
|
|
2364
2362
|
project: String(r.project),
|
|
2365
2363
|
ticket: r.ticket === null ? null : String(r.ticket),
|
|
@@ -2368,12 +2366,30 @@ var inboxRow = (r) => ({
|
|
|
2368
2366
|
author: r.author === null ? null : String(r.author),
|
|
2369
2367
|
body: String(r.body),
|
|
2370
2368
|
createdAt: String(r.created_at),
|
|
2369
|
+
...r.request_item === null || r.request_item === undefined ? {} : {
|
|
2370
|
+
request: {
|
|
2371
|
+
question: r.request_question === null ? null : Number(r.request_question),
|
|
2372
|
+
profile: r.request_profile === null ? null : String(r.request_profile)
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
});
|
|
2376
|
+
async function openInboxItems(db, q) {
|
|
2377
|
+
const rs = await db.execute({
|
|
2378
|
+
sql: `SELECT ${INBOX_COLUMNS} FROM ${INBOX_FROM}
|
|
2379
|
+
WHERE i.project = ? AND i.recipient = ? AND i.resolved_at IS NULL ${q.ticket ? "AND i.ticket = ?" : ""}
|
|
2380
|
+
ORDER BY i.created_at, i.id`,
|
|
2381
|
+
args: q.ticket ? [q.project, q.recipient, q.ticket] : [q.project, q.recipient]
|
|
2382
|
+
});
|
|
2383
|
+
return rs.rows.map(inboxItem);
|
|
2384
|
+
}
|
|
2385
|
+
var inboxRow = (r) => ({
|
|
2386
|
+
...inboxItem(r),
|
|
2371
2387
|
resolvedAt: r.resolved_at === null ? null : String(r.resolved_at),
|
|
2372
2388
|
resolution: r.resolution === null ? null : String(r.resolution)
|
|
2373
2389
|
});
|
|
2374
2390
|
async function getInboxItem(db, project, id) {
|
|
2375
2391
|
const rs = await db.execute({
|
|
2376
|
-
sql: `SELECT ${INBOX_COLUMNS} FROM
|
|
2392
|
+
sql: `SELECT ${INBOX_COLUMNS} FROM ${INBOX_FROM} WHERE i.project = ? AND i.id = ?`,
|
|
2377
2393
|
args: [project, id]
|
|
2378
2394
|
});
|
|
2379
2395
|
const r = rs.rows[0];
|
|
@@ -2403,6 +2419,15 @@ async function resolveInboxItems(db, q) {
|
|
|
2403
2419
|
});
|
|
2404
2420
|
return rs.rowsAffected;
|
|
2405
2421
|
}
|
|
2422
|
+
async function resolveAnswerRequests(db, q) {
|
|
2423
|
+
const rs = await db.execute({
|
|
2424
|
+
sql: `UPDATE inbox_items SET resolved_at = ?, resolution = ?
|
|
2425
|
+
WHERE project = ? AND kind = 'answer-request' AND resolved_at IS NULL
|
|
2426
|
+
AND id IN (SELECT item FROM inbox_requests WHERE project = ? AND question = ?)`,
|
|
2427
|
+
args: [q.at.toISOString(), q.resolution, q.project, q.project, q.question]
|
|
2428
|
+
});
|
|
2429
|
+
return rs.rowsAffected;
|
|
2430
|
+
}
|
|
2406
2431
|
async function acquireLease(db, l) {
|
|
2407
2432
|
const at = l.at.toISOString();
|
|
2408
2433
|
const expires = new Date(l.at.getTime() + l.ttlMs).toISOString();
|
|
@@ -2625,7 +2650,7 @@ ${claimLine({ runtime: runtime.name, handle: input.handle, branch, started, prof
|
|
|
2625
2650
|
});
|
|
2626
2651
|
lines.push(`${inProgress ? `Moved to ${inProgress.name}` : "State unchanged"}, assigned to ${viewer.name}, labels ${phaseLabel?.name ?? ticket.agentPhase} and ${runtime.name}.`);
|
|
2627
2652
|
const at = ctx.now();
|
|
2628
|
-
await live(ctx, warnings, "record the claim", async (db) => {
|
|
2653
|
+
const launched = await live(ctx, warnings, "record the claim", async (db) => {
|
|
2629
2654
|
await ensureProject(db, projectOf(config), at);
|
|
2630
2655
|
await saveRuntimeHandle(db, {
|
|
2631
2656
|
project: config.project.slug,
|
|
@@ -2651,7 +2676,24 @@ ${claimLine({ runtime: runtime.name, handle: input.handle, branch, started, prof
|
|
|
2651
2676
|
handle: input.handle,
|
|
2652
2677
|
at
|
|
2653
2678
|
});
|
|
2679
|
+
if (resuming)
|
|
2680
|
+
return [];
|
|
2681
|
+
const asked = (await openInboxItems(db, { project: config.project.slug, recipient: "coordinator", ticket: ticket.id })).filter((i) => i.kind === "launch-request");
|
|
2682
|
+
for (const r of asked)
|
|
2683
|
+
await resolveInboxItem(db, {
|
|
2684
|
+
project: config.project.slug,
|
|
2685
|
+
id: r.id,
|
|
2686
|
+
resolution: `claimed by ${runtime.name} (${input.handle})`,
|
|
2687
|
+
at
|
|
2688
|
+
});
|
|
2689
|
+
return asked;
|
|
2654
2690
|
});
|
|
2691
|
+
if (launched?.length) {
|
|
2692
|
+
const who = [...new Set(launched.map((r) => r.author ?? "the owner"))].join(", ");
|
|
2693
|
+
const ids = launched.map((r) => `#${r.id}`).join(", ");
|
|
2694
|
+
await linear.comment(ticket.uuid, `Agent status: planning — launched as ${who} asked from the dashboard (request ${ids})`);
|
|
2695
|
+
lines.push(`Launch request ${ids} from ${who} resolved.`);
|
|
2696
|
+
}
|
|
2655
2697
|
const state = await readBack(ctx, ticket.id, warnings);
|
|
2656
2698
|
return { ticket: ticket.id, url: ticket.url, lines, warnings, inbox: null, state };
|
|
2657
2699
|
}
|
|
@@ -2782,6 +2824,13 @@ async function releaseTicket(ctx, input) {
|
|
|
2782
2824
|
resolution: `ticket released: ${input.reason.trim()}`,
|
|
2783
2825
|
at
|
|
2784
2826
|
});
|
|
2827
|
+
await resolveInboxItems(db, {
|
|
2828
|
+
project: config.project.slug,
|
|
2829
|
+
ticket: ticket.id,
|
|
2830
|
+
kind: "answer-request",
|
|
2831
|
+
resolution: `ticket released: ${input.reason.trim()}`,
|
|
2832
|
+
at
|
|
2833
|
+
});
|
|
2785
2834
|
await recordEvent(db, {
|
|
2786
2835
|
project: config.project.slug,
|
|
2787
2836
|
ticket: ticket.id,
|
|
@@ -3515,7 +3564,8 @@ async function readInbox(db, o) {
|
|
|
3515
3564
|
author: i.author,
|
|
3516
3565
|
body: i.body,
|
|
3517
3566
|
createdAt: i.createdAt,
|
|
3518
|
-
new: false
|
|
3567
|
+
new: false,
|
|
3568
|
+
...i.request ? { request: i.request } : {}
|
|
3519
3569
|
}));
|
|
3520
3570
|
const asking = new Set(items.filter((i) => i.kind === "question").map((i) => i.ticket));
|
|
3521
3571
|
for (const h of handles) {
|
|
@@ -3598,6 +3648,7 @@ function statusComment(phase, word, text, ref) {
|
|
|
3598
3648
|
|
|
3599
3649
|
${detail}` : line;
|
|
3600
3650
|
}
|
|
3651
|
+
var ANSWERABLE = ["question", "request", "answer-request", "launch-request"];
|
|
3601
3652
|
async function answerItem(ctx, input) {
|
|
3602
3653
|
const { config, linear } = ctx;
|
|
3603
3654
|
const project = config.project.slug;
|
|
@@ -3609,18 +3660,19 @@ async function answerItem(ctx, input) {
|
|
|
3609
3660
|
throw new Refusal("a note goes to a ticket, not to an inbox item", 'armada answer --note <ticket> "<message>"');
|
|
3610
3661
|
const warnings = [];
|
|
3611
3662
|
const lines = [];
|
|
3663
|
+
let item = null;
|
|
3612
3664
|
let itemId = null;
|
|
3613
3665
|
let ticketId = null;
|
|
3614
3666
|
if (idMatch) {
|
|
3615
3667
|
itemId = Number(idMatch[1]);
|
|
3616
|
-
|
|
3668
|
+
item = await live(ctx, warnings, `read inbox item #${itemId}`, (db) => getInboxItem(db, project, itemId ?? 0));
|
|
3617
3669
|
if (!item)
|
|
3618
3670
|
throw new Refusal(warnings.length ? `inbox item #${itemId} cannot be read (${warnings.join("; ")})` : `inbox item #${itemId} does not exist in project ${project}`, warnings.length ? 'armada answer <ticket> "<answer>", to answer by ticket instead' : "armada inbox");
|
|
3619
3671
|
if (item.resolvedAt)
|
|
3620
3672
|
throw new Refusal(`inbox item #${itemId} was already resolved at ${item.resolvedAt}`, "armada inbox");
|
|
3621
3673
|
if (item.kind === "hand-back")
|
|
3622
3674
|
throw new Refusal(`inbox item #${itemId} is a hand-back: armada merge resolves it once the pull request is merged`, `armada merge <pr>${item.ticket ? ` --ticket ${item.ticket}` : ""} --dry-run`);
|
|
3623
|
-
if (item.recipient !== "coordinator" ||
|
|
3675
|
+
if (item.recipient !== "coordinator" || !ANSWERABLE.includes(item.kind))
|
|
3624
3676
|
throw new Refusal(`inbox item #${itemId} is a ${item.kind} for the ${item.recipient}, not something to answer`, "armada inbox");
|
|
3625
3677
|
ticketId = item.ticket;
|
|
3626
3678
|
} else {
|
|
@@ -3631,6 +3683,9 @@ async function answerItem(ctx, input) {
|
|
|
3631
3683
|
throw new Refusal(`${ticketId} has no open question in the inbox`, `armada answer --note ${ticketId} "<message>", for an unsolicited message`);
|
|
3632
3684
|
}
|
|
3633
3685
|
}
|
|
3686
|
+
if (item?.kind === "launch-request")
|
|
3687
|
+
return declineLaunch(ctx, item, text, warnings);
|
|
3688
|
+
const question = item?.kind === "answer-request" ? item.request?.question ?? null : null;
|
|
3634
3689
|
let url = "";
|
|
3635
3690
|
if (ticketId) {
|
|
3636
3691
|
const ticket = await linear.readTicket(ticketId);
|
|
@@ -3643,7 +3698,7 @@ async function answerItem(ctx, input) {
|
|
|
3643
3698
|
throw new Refusal(`${ticket.id} has no agent phase: no worker holds it, so there is no one to tell`, "armada status, to see which tickets are in flight");
|
|
3644
3699
|
warnings.push(`${ticket.id} has no agent phase (no worker holds it); the answer was not posted on the ticket`);
|
|
3645
3700
|
} else {
|
|
3646
|
-
const ref = itemId === null ? null : `Answers question #${itemId}.`;
|
|
3701
|
+
const ref = item?.kind === "answer-request" ? `Answers ${question === null ? "the open question" : `question #${question}`}, as ${item.author ?? "the owner"} asked from the dashboard (request #${item.id}).` : itemId === null ? null : `Answers question #${itemId}.`;
|
|
3647
3702
|
await linear.comment(ticket.uuid, statusComment(ticket.agentPhase, input.note ? "note" : "answer", text, ref));
|
|
3648
3703
|
lines.push(`${input.note ? "Note" : "Answer"} posted on ${ticket.id} (${ticket.agentPhase}).`);
|
|
3649
3704
|
}
|
|
@@ -3664,11 +3719,19 @@ async function answerItem(ctx, input) {
|
|
|
3664
3719
|
await resolveInboxItem(db, { project, id, resolution: "delivered through the runtime", at });
|
|
3665
3720
|
return `Note #${id} recorded.`;
|
|
3666
3721
|
}
|
|
3722
|
+
if (item?.kind === "answer-request") {
|
|
3723
|
+
await resolveInboxItem(db, { project, id: item.id, resolution: text, at });
|
|
3724
|
+
const closed = question !== null && await resolveInboxItem(db, { project, id: question, resolution: text, at });
|
|
3725
|
+
return `Dashboard request #${item.id} delivered${closed ? `; question #${question} resolved` : ""}.`;
|
|
3726
|
+
}
|
|
3667
3727
|
if (itemId !== null) {
|
|
3668
3728
|
const done = await resolveInboxItem(db, { project, id: itemId, resolution: text, at });
|
|
3729
|
+
if (item?.kind === "question")
|
|
3730
|
+
await resolveAnswerRequests(db, { project, question: itemId, resolution: text, at });
|
|
3669
3731
|
return done ? `Inbox item #${itemId} resolved.` : `Inbox item #${itemId} was already resolved.`;
|
|
3670
3732
|
}
|
|
3671
3733
|
const n = await resolveInboxItems(db, { project, ticket: ticketId ?? "", kind: "question", resolution: text, at });
|
|
3734
|
+
await resolveInboxItems(db, { project, ticket: ticketId ?? "", kind: "answer-request", resolution: text, at });
|
|
3672
3735
|
return `${n} open question${n === 1 ? "" : "s"} of ${ticketId} resolved.`;
|
|
3673
3736
|
});
|
|
3674
3737
|
if (recorded)
|
|
@@ -3677,6 +3740,14 @@ async function answerItem(ctx, input) {
|
|
|
3677
3740
|
lines.push("The worker resumes once it reports its phase again.");
|
|
3678
3741
|
return { ticket: ticketId ?? `#${itemId}`, url, lines, warnings: [...new Set(warnings)], inbox: null };
|
|
3679
3742
|
}
|
|
3743
|
+
async function declineLaunch(ctx, item, reason, warnings) {
|
|
3744
|
+
const project = ctx.config.project.slug;
|
|
3745
|
+
const done = await live(ctx, warnings, `decline launch request #${item.id}`, (db) => resolveInboxItem(db, { project, id: item.id, resolution: `declined: ${reason}`, at: ctx.now() }));
|
|
3746
|
+
const lines = done === null ? [] : [
|
|
3747
|
+
done ? `Launch request #${item.id} for ${item.ticket} declined; the dashboard shows it closed.` : `Launch request #${item.id} was already resolved.`
|
|
3748
|
+
];
|
|
3749
|
+
return { ticket: item.ticket ?? `#${item.id}`, url: "", lines, warnings: [...new Set(warnings)], inbox: null };
|
|
3750
|
+
}
|
|
3680
3751
|
// ../core/src/labels.ts
|
|
3681
3752
|
function requiredLabels(config) {
|
|
3682
3753
|
return [
|
|
@@ -4449,6 +4520,13 @@ async function after(ctx, c, merged, lines) {
|
|
|
4449
4520
|
at
|
|
4450
4521
|
});
|
|
4451
4522
|
await resolveInboxItems(db, { project: slug, ticket: c.ticket.id, kind: "question", resolution: "merged", at });
|
|
4523
|
+
await resolveInboxItems(db, {
|
|
4524
|
+
project: slug,
|
|
4525
|
+
ticket: c.ticket.id,
|
|
4526
|
+
kind: "answer-request",
|
|
4527
|
+
resolution: "merged",
|
|
4528
|
+
at
|
|
4529
|
+
});
|
|
4452
4530
|
await releaseRuntimeHandle(db, slug, c.ticket.id, at);
|
|
4453
4531
|
return { handle, resolved, open: await openRuntimeHandles(db, slug) };
|
|
4454
4532
|
});
|
|
@@ -4544,16 +4622,20 @@ The coordinator turns the owner's intent into merged pull requests. Each worker
|
|
|
4544
4622
|
|
|
4545
4623
|
1. **Read the fleet** with \`armada status\` and \`armada inbox\`, never from memory. Done when you can name every ticket in flight and its phase, every ready ticket, every pull request waiting, every silent worker and every pending question or request.
|
|
4546
4624
|
2. **Answer what waits for you first.** For each question in \`armada inbox\`: decide it, or escalate it to the owner when it is a product decision and wait for theirs. Deliver the answer in the worker's session with the runtime guide's *message* section, then record it with \`armada answer <item> "<decision and reason>"\`. \`armada answer\` only records; it never reaches the worker. Decide reversible choices yourself and prefer the option that keeps behaviour observable. When two workers need the same shared resource (a migration slot, a generated file, a version number), set the rule once and tell both. A message the worker did not ask for (main moved, rebase needed) takes the same path: deliver it with the runtime guide, then \`armada answer --note <ticket> "<message>"\`. Done when the inbox shows no open question.
|
|
4547
|
-
3. **
|
|
4548
|
-
|
|
4625
|
+
3. **Carry out the owner's dashboard requests.** They are the owner's word, signed with their name; they never reached a worker.
|
|
4626
|
+
- \`answer-request\` (it names the question it answers, \`answers #<id>\`): deliver its text in the worker's session with the runtime guide's *message* section, as the owner's answer, then \`armada answer <request id> "<the text you delivered>"\`. That resolves the request and its question, and the ticket names who answered. If the question is gone (the worker was released), \`armada answer <request id> "<why>"\` closes it.
|
|
4627
|
+
- \`launch-request\` (it names the profile the owner chose): launch the ticket as in step 5, with that profile. When it differs from the routed one, the request's body gives the \`--profile\` and \`--reason\` to pass to \`armada brief\` and to the worker's claim. The worker's \`armada claim\` resolves the request and posts who asked. If the ticket must not start (it collides with work in flight, or its plan changed), decline it: \`armada answer <request id> "<why>"\`, and tell the owner in your report.
|
|
4628
|
+
Done when the inbox shows no open request.
|
|
4629
|
+
4. **Check silent workers** with the runtime guide's *status* section. A worker that is still working gets a nudge to report; a worker that died is relaunched or its ticket released.
|
|
4630
|
+
5. **Launch ready tickets** that do not collide with work in flight, one at a time:
|
|
4549
4631
|
- pick the ticket from the frontier in \`armada status\`;
|
|
4550
4632
|
- run \`armada brief <ticket>\` and resolve its warnings. The profile (agent, model, effort) is routed from the ticket's labels by \`[[conductor.routing]]\` in \`armada.toml\`, else \`default_profile\`, and the brief says which rule chose it. Follow it. Override it only when the ticket's labels mislead (for example a \`web\` ticket that is really a tricky back-end bug): \`armada brief <ticket> --profile <name> --reason "<why>"\`. The reason lands in the worker's claim comment;
|
|
4551
4633
|
- write the prompt with \`armada brief <ticket> --prompt > <file>\` and add what only you know: which parallel workers touch neighbouring code and where the boundary is, and decisions not yet on the ticket;
|
|
4552
4634
|
- launch it with the runtime guide's *launch* section, passing the profile's values and the environment variables the brief names;
|
|
4553
4635
|
- check the claim: \`armada status\` shows the ticket in flight, phase \`planning\`, with the handle the runtime returned. Done when every launched ticket is In Progress with a claim.
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4636
|
+
6. **Merge handed-back pull requests** one at a time with \`armada merge <pr>\`, following [MERGE.md](MERGE.md). Done when the pull request is merged, the ticket is Done with its agent labels removed, and every in-flight worker affected by what landed has been told.
|
|
4637
|
+
7. **Turn findings into tickets.** A gap a worker reports or a bug you see becomes a ticket under the right spec, with blocked-by relations, and is launched when ready. No finding lives only in a transcript.
|
|
4638
|
+
8. **Report to the owner** in their language (\`tracker.language\` in \`armada.toml\`, or the owner's personal setting): what merged, what runs, what you decided for them, and the one thing they must do, with its exact place (a URL, a setting). Outcomes and numbers, no process narration.
|
|
4557
4639
|
|
|
4558
4640
|
Repeat from step 1. Between rounds, \`armada inbox --wait\` blocks until a new item arrives or its timeout (default 300 s, \`--timeout <seconds>\`; keep it under your command time limit). Each \`armada inbox\` call also tells the dashboard you are at work.
|
|
4559
4641
|
|
|
@@ -4854,6 +4936,10 @@ ${SHIP_ARTIFACTS}
|
|
|
4854
4936
|
var planIsEmpty = (p) => !p.writes.length && !p.removes.length && !p.links.length;
|
|
4855
4937
|
// ../core/src/status.ts
|
|
4856
4938
|
var STATUS_SCHEMA_VERSION = 1;
|
|
4939
|
+
function routeOf(config, labels) {
|
|
4940
|
+
const route = routeProfile(config, labels);
|
|
4941
|
+
return route ? { profile: route.name, why: describeRoute(route, config) } : null;
|
|
4942
|
+
}
|
|
4857
4943
|
function buildStatus({
|
|
4858
4944
|
config,
|
|
4859
4945
|
program,
|
|
@@ -4900,6 +4986,7 @@ function buildStatus({
|
|
|
4900
4986
|
phaseSource: l.phaseSource,
|
|
4901
4987
|
runtime: l.runtime,
|
|
4902
4988
|
handle: l.handle,
|
|
4989
|
+
profile: live2?.handles?.[l.issue.id]?.profile ?? l.claim?.profile ?? null,
|
|
4903
4990
|
agent: l.agent,
|
|
4904
4991
|
since: l.since,
|
|
4905
4992
|
lastUpdate: l.lastUpdate,
|
|
@@ -4917,7 +5004,8 @@ function buildStatus({
|
|
|
4917
5004
|
spec: c.spec,
|
|
4918
5005
|
readyForAgent: c.readyForAgent,
|
|
4919
5006
|
onCriticalPath: c.onCriticalPath,
|
|
4920
|
-
unlocks: c.unlocksAll
|
|
5007
|
+
unlocks: c.unlocksAll,
|
|
5008
|
+
route: routeOf(config, c.issue.labels)
|
|
4921
5009
|
})),
|
|
4922
5010
|
pullRequests: forge ? waitingPullRequests(m, forge.prs).map(({ pr, ticket }) => ({
|
|
4923
5011
|
...prRef(pr),
|
|
@@ -4964,7 +5052,7 @@ async function loadStatus(config, opts) {
|
|
|
4964
5052
|
});
|
|
4965
5053
|
}
|
|
4966
5054
|
// package.json
|
|
4967
|
-
var version = "0.1.
|
|
5055
|
+
var version = "0.1.11";
|
|
4968
5056
|
|
|
4969
5057
|
// src/io.ts
|
|
4970
5058
|
class UsageError extends Error {
|
|
@@ -5507,6 +5595,8 @@ async function readMessage(io, options) {
|
|
|
5507
5595
|
const text = file === "-" ? await io.readStdin?.() ?? null : await io.readFile(file);
|
|
5508
5596
|
if (text === null)
|
|
5509
5597
|
throw new UsageError(`cannot read the message from ${file}`);
|
|
5598
|
+
if (!text.trim())
|
|
5599
|
+
throw new UsageError(`${file === "-" ? "standard input" : `message file ${file}`} is empty or whitespace-only`, 'pass --message "<text>" or pipe a non-empty message into --message-file -');
|
|
5510
5600
|
return text;
|
|
5511
5601
|
}
|
|
5512
5602
|
async function withContext(io, config2, credentials2, json, act) {
|
|
@@ -5629,6 +5719,8 @@ function renderInbox(r) {
|
|
|
5629
5719
|
e.id === null ? e.kind : `#${e.id} ${e.kind}`,
|
|
5630
5720
|
e.ticket,
|
|
5631
5721
|
e.author && `from ${e.author}`,
|
|
5722
|
+
e.request?.question && `answers #${e.request.question}`,
|
|
5723
|
+
e.request?.profile && `profile ${e.request.profile}`,
|
|
5632
5724
|
e.createdAt
|
|
5633
5725
|
].filter(Boolean).join(" · ");
|
|
5634
5726
|
out.push(`${e.new ? "* " : " "}${head}`, ...e.body.split(`
|
|
@@ -5636,6 +5728,8 @@ function renderInbox(r) {
|
|
|
5636
5728
|
}
|
|
5637
5729
|
if (r.items.some((e) => e.kind === "question"))
|
|
5638
5730
|
out.push(`Deliver each answer in the worker's session with the runtime guide, then record it: armada answer <id> "<answer>".`);
|
|
5731
|
+
if (r.items.some((e) => e.kind === "answer-request" || e.kind === "launch-request"))
|
|
5732
|
+
out.push('Dashboard requests: deliver an answer-request, then armada answer <id> "<answer>"; launch a launch-request (its claim resolves it), or decline it with armada answer <id> "<why>".');
|
|
5639
5733
|
}
|
|
5640
5734
|
if (r.wait?.timedOut)
|
|
5641
5735
|
out.push(`No new item within ${r.wait.timeoutSeconds} s.`);
|
|
@@ -6600,8 +6694,8 @@ function gitBranch() {
|
|
|
6600
6694
|
}
|
|
6601
6695
|
async function readStdin() {
|
|
6602
6696
|
let text = "";
|
|
6603
|
-
|
|
6604
|
-
for await (const chunk of
|
|
6697
|
+
const input = createReadStream("", { fd: 0, autoClose: false, encoding: "utf8" });
|
|
6698
|
+
for await (const chunk of input)
|
|
6605
6699
|
text += chunk;
|
|
6606
6700
|
return text;
|
|
6607
6701
|
}
|
|
@@ -6662,7 +6756,7 @@ var code = await run(process.argv.slice(2), {
|
|
|
6662
6756
|
stdout: (t) => process.stdout.write(t),
|
|
6663
6757
|
stderr: (t) => process.stderr.write(t),
|
|
6664
6758
|
ghToken,
|
|
6665
|
-
interactive:
|
|
6759
|
+
interactive: isatty(0) && isatty(2),
|
|
6666
6760
|
prompt,
|
|
6667
6761
|
gitBranch,
|
|
6668
6762
|
readStdin,
|