@the-vibe-company/armada 0.2.17 → 0.2.19
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 +13 -3
- package/dist/armada.js +303 -39
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,15 +77,18 @@ On a repository without `armada.toml`, pass `--program-root <ISSUE-ID>`; the nam
|
|
|
77
77
|
Armada prepares a launch; it never starts a runtime itself. The `armada-runtime-conductor` skill gives the exact Conductor Cloud commands; the `armada-runtime-claude-code` skill launches a worker as a background subagent of a coordinator running in Claude Code, in its own git worktree (it dies with the coordinator's session, so long runs go to Conductor). [`docs/runbook.md`](docs/runbook.md) says how to start a coordinator on a laptop or in Conductor Cloud, what the owner sets up once, and how one coordinator hands over to the next.
|
|
78
78
|
|
|
79
79
|
```sh
|
|
80
|
-
armada brief ABC-12 #
|
|
81
|
-
armada brief ABC-12 --prompt
|
|
80
|
+
armada brief ABC-12 # read-only settings and prompt preview; no launch
|
|
81
|
+
armada brief ABC-12 --prompt --profile-line # prompt on stdout; profile and reason on stderr
|
|
82
82
|
armada brief ABC-12 --profile codex --reason "a back-end bug behind a web label" --json
|
|
83
|
+
armada launch revoke ABC-12 # cancel the newest pending launch through Armada
|
|
83
84
|
```
|
|
84
85
|
|
|
85
86
|
- The prompt names the ticket and its Linear branch, starts by installing the coordinator's Armada version (`npm install -g`, with an `npm exec` fallback), signing in with `armada login --launch-token <token>` and running `armada claim` with the handle `$CONDUCTOR_WORKSPACE_ID/$CONDUCTOR_SESSION_ID`, and carries the blockers with their hand-back notes, the comments already on the ticket and the workers in flight.
|
|
86
87
|
- **Plan rule.** A "Plan" section says in one line whether the worker waits for approval: "post your plan with `armada report implementing --plan-file -` and go on" when plans are pre-approved, "post your plan with `armada report awaiting-approval --plan-file -` and wait for approval" otherwise. `[policy] plans` decides (`approve` by default, or `pre-approved`); a ticket labelled `plan-approved` (`policy.pre_approved_label`) is pre-approved, and one labelled `needs-plan-approval` (`policy.approval_label`) waits for approval, which wins when a ticket has both. The settings show the rule and where it comes from (`Plans:`), and `--json` carries it as `plans`.
|
|
87
88
|
- **Project conventions.** `[brief] extra = "<path>"` names a file of the repository (relative to `armada.toml`) that every prompt ends with, under "Project conventions": the checks to run, the generated files to refresh, how to bring main in. A missing file is a brief warning, and `armada doctor` checks it.
|
|
88
|
-
- **Workers need no key.**
|
|
89
|
+
- **Workers need no key.** Only `brief --prompt` asks Armada for a launch token: one ticket, used once, valid one hour. Human and `--json` views are read-only, mint no token and add no worker to watch state; they show `Launch: a one-time token is made when you print the prompt (--prompt)`. With `--prompt --profile-line`, stdout remains the exact worker prompt and stderr gives the selected profile, agent, model, effort, runtime and reason: one call supplies both the prompt and runtime settings. The worker exchanges the token for a session limited to its ticket's `claim`, `report`, `ask` and `release`, and Armada gives each command its keys. Make the prompt right before the launch; its token is the only secret a prompt ever holds, useless once used. The launch message is the `--prompt` output only, never either preview. Without a token, the profile line's `Launch:` summary says why (not signed in, or an Armada without accounts or keys).
|
|
90
|
+
- **Cancel a launch.** `armada launch revoke <ticket>` ends the newest pending launch through the API and records the same revocation audit as Organization > Workers. It also cancels a worker that signed in but never claimed; a claimed worker is refused with the `armada release` hint. Owners and admins can revoke, including an organization API key whose creator still has that role. `armada status` lists pending launches with the cancel command.
|
|
91
|
+
- **Unused launches clear.** Once an unused launch token expired more than an hour ago, it stops being followed. The next coordinator inbox read ends it server-side, shows one `not started (token expired)` notice, then clears it. Exchanged-but-unclaimed launches remain revocable and stop being followed after the existing 24-hour window from their launch.
|
|
89
92
|
- **A version npm serves.** The brief pins the coordinator's Armada version, after one request to npm (3 s at most, beside the Linear reads). When npm does not serve it yet (a release still publishing, a checkout ahead of npm), the brief pins the newest published version and warns; offline, it only warns. Merging or releasing the ticket ends the worker's session, and Organization > Workers on the dashboard revokes one.
|
|
90
93
|
- The settings give the profile's agent, model and effort from `[conductor]` in `armada.toml`, and the environment variables: `ARMADA_TICKET=<ticket>`, and, only without a launch token, `LINEAR_API_KEY` (required). Each shows whether this shell has it. No value is ever printed.
|
|
91
94
|
- A profile with `runtime = "claude-code"` routes the launch to the `armada-runtime-claude-code` skill: the `Runtime:` line names the skill, the claim runs `--runtime claude-code` with the subagent's name as its handle (the ticket id in lowercase), and the prompt first makes the worker check it runs in its own worktree. The Agent tool applies no effort; the brief says so.
|
|
@@ -101,12 +104,15 @@ armada login --launch-token <token> # the first line of the launch messag
|
|
|
101
104
|
armada claim ABC-12 --runtime conductor --handle <workspace>/<session>
|
|
102
105
|
armada report awaiting-approval --plan-file plan.md # the plan as its own block, one-line status
|
|
103
106
|
armada report implementing --message "plan approved, writing the parser"
|
|
107
|
+
armada attach ABC-12 .context/overview.png https://example.com/design --caption "Check the new overview"
|
|
104
108
|
armada report implementing --message "parser done, wiring the CLI" # same phase = status update
|
|
105
109
|
armada report shipping --message "PR open" --pr 34
|
|
106
110
|
armada report ready-to-merge --pr 34 --sha <full 40-character head SHA>
|
|
107
111
|
armada release --reason "wrong ticket"
|
|
108
112
|
```
|
|
109
113
|
|
|
114
|
+
`armada attach <ticket> <file|url>... [--caption "<text>"] [--for <item>]` keeps visual evidence out of git. It uploads byte-checked PNG, JPEG, WebP or GIF images (at most 2 MB each) and records HTTPS links, then prints private dashboard URLs. An organization member can inspect them in the agent's **Attachments** tab, enlarge images, and follow links. The bytes stay in the app's Postgres and are served only after organization/project access checks; signed-out callers and other organizations receive 403. Worker sessions attach only to their own ticket; coordinators attach to any ticket in their project's cached reading. Refresh the dashboard first if a new ticket is missing there. `--for` stores a free validation reference. Identical content on a ticket is stored once (a later `--for` can bind it to a validation). Each ticket defaults to 20 images/links, the project to 200 MB of image bytes, and evidence is deleted by the next successful project refresh at least 30 days after completion or cancellation; reopening resets that window. Configure these limits in `[policy]` below. Never include credentials or secrets in linked URLs or screenshots.
|
|
115
|
+
|
|
110
116
|
- `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 on Armada, 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.
|
|
111
117
|
- `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.
|
|
112
118
|
- `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.
|
|
@@ -179,6 +185,7 @@ Try it locally with synthetic data and no key:
|
|
|
179
185
|
```sh
|
|
180
186
|
cd packages/dashboard
|
|
181
187
|
bun run demo:seed # a local PGlite database (Postgres in the process) with the mockup's Acme world (three projects, ten sessions)
|
|
188
|
+
# bun run demo:seed busy # the same with twenty more sessions reporting every 2 minutes all day (then ARMADA_DASHBOARD_DEMO=busy)
|
|
182
189
|
ARMADA_DASHBOARD_PASSWORD=off ARMADA_DASHBOARD_DEMO=fleet ARMADA_DATABASE_URL=pglite:.demo/armada bun run dev # http://localhost:4822
|
|
183
190
|
```
|
|
184
191
|
|
|
@@ -389,6 +396,9 @@ required_checks = ["test"] # CI checks that must be green before a hand-ba
|
|
|
389
396
|
local_commands = ["npm ci", "npm test"] # run by `armada merge` on a test merge of a head behind its base (default: none: the worker brings the base branch in instead)
|
|
390
397
|
|
|
391
398
|
[policy]
|
|
399
|
+
attachments_per_ticket = 20 # images and links together (default 20)
|
|
400
|
+
attachments_project_mb = 200 # private image bytes per project, MB = 1024² bytes (default 200)
|
|
401
|
+
attachments_retention_days = 30 # deleted after completion/cancellation by the next project refresh (default 30)
|
|
392
402
|
silence_minutes = 15 # a worker with no report for longer is flagged silent (default 15)
|
|
393
403
|
coordinator_minutes = 10 # an inbox item open longer shows "waiting for the coordinator" (default 10)
|
|
394
404
|
not_started_minutes = 10 # a launched worker that has not claimed after this long shows as not started (default 10; a CLI older than this setting refuses it)
|
package/dist/armada.js
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
// src/main.ts
|
|
4
4
|
import { spawn as spawn2, spawnSync } from "node:child_process";
|
|
5
5
|
import { createReadStream } from "node:fs";
|
|
6
|
-
import { readFile as readFile3 } from "node:fs/promises";
|
|
6
|
+
import { open as open2, readFile as readFile3 } from "node:fs/promises";
|
|
7
7
|
import { hostname as hostname2 } from "node:os";
|
|
8
8
|
import { isatty } from "node:tty";
|
|
9
9
|
|
|
10
10
|
// src/cli.ts
|
|
11
|
-
import { dirname as dirname7, join as join6, resolve as
|
|
11
|
+
import { dirname as dirname7, join as join6, resolve as resolve3 } from "node:path";
|
|
12
12
|
|
|
13
13
|
// ../core/src/live.ts
|
|
14
14
|
import { createHash } from "node:crypto";
|
|
@@ -997,7 +997,10 @@ var CONFIG_DEFAULTS = {
|
|
|
997
997
|
notStartedMinutes: 10,
|
|
998
998
|
plans: "approve",
|
|
999
999
|
preApprovedLabel: "plan-approved",
|
|
1000
|
-
approvalLabel: "needs-plan-approval"
|
|
1000
|
+
approvalLabel: "needs-plan-approval",
|
|
1001
|
+
attachmentsPerTicket: 20,
|
|
1002
|
+
attachmentsProjectMb: 200,
|
|
1003
|
+
attachmentsRetentionDays: 30
|
|
1001
1004
|
};
|
|
1002
1005
|
|
|
1003
1006
|
class ConfigError extends Error {
|
|
@@ -1112,7 +1115,10 @@ function parseConfig(text, source = CONFIG_FILE) {
|
|
|
1112
1115
|
"not_started_minutes",
|
|
1113
1116
|
"plans",
|
|
1114
1117
|
"pre_approved_label",
|
|
1115
|
-
"approval_label"
|
|
1118
|
+
"approval_label",
|
|
1119
|
+
"attachments_per_ticket",
|
|
1120
|
+
"attachments_project_mb",
|
|
1121
|
+
"attachments_retention_days"
|
|
1116
1122
|
]
|
|
1117
1123
|
],
|
|
1118
1124
|
["brief", briefT, ["extra"]],
|
|
@@ -1225,6 +1231,18 @@ function parseConfig(text, source = CONFIG_FILE) {
|
|
|
1225
1231
|
problems.push(`"policy.plans" must be ${PLAN_POLICIES.map((p) => `"${p}"`).join(" or ")}`);
|
|
1226
1232
|
}
|
|
1227
1233
|
const preApprovedLabel = str(policyT, "policy", "pre_approved_label", { default: CONFIG_DEFAULTS.preApprovedLabel });
|
|
1234
|
+
const quota = (key, fallback) => {
|
|
1235
|
+
const value = policyT[key];
|
|
1236
|
+
if (value === undefined)
|
|
1237
|
+
return fallback;
|
|
1238
|
+
if (typeof value === "number" && Number.isSafeInteger(value) && value > 0)
|
|
1239
|
+
return value;
|
|
1240
|
+
problems.push(`"policy.${key}" must be a positive integer`);
|
|
1241
|
+
return fallback;
|
|
1242
|
+
};
|
|
1243
|
+
const attachmentsPerTicket = quota("attachments_per_ticket", CONFIG_DEFAULTS.attachmentsPerTicket);
|
|
1244
|
+
const attachmentsProjectMb = quota("attachments_project_mb", CONFIG_DEFAULTS.attachmentsProjectMb);
|
|
1245
|
+
const attachmentsRetentionDays = quota("attachments_retention_days", CONFIG_DEFAULTS.attachmentsRetentionDays);
|
|
1228
1246
|
const approvalLabel = str(policyT, "policy", "approval_label", { default: CONFIG_DEFAULTS.approvalLabel });
|
|
1229
1247
|
if (preApprovedLabel && approvalLabel && routingLabelKey(preApprovedLabel) === routingLabelKey(approvalLabel))
|
|
1230
1248
|
problems.push(`"policy.pre_approved_label" and "policy.approval_label" must name different labels`);
|
|
@@ -1282,7 +1300,17 @@ function parseConfig(text, source = CONFIG_FILE) {
|
|
|
1282
1300
|
repository: str(github, "github", "repository", { pattern: REPOSITORY, hint: "owner/name" })
|
|
1283
1301
|
},
|
|
1284
1302
|
gates: { requiredChecks, localCommands },
|
|
1285
|
-
policy: {
|
|
1303
|
+
policy: {
|
|
1304
|
+
silentAfterMinutes,
|
|
1305
|
+
coordinatorMinutes,
|
|
1306
|
+
notStartedMinutes,
|
|
1307
|
+
plans,
|
|
1308
|
+
preApprovedLabel,
|
|
1309
|
+
approvalLabel,
|
|
1310
|
+
attachmentsPerTicket,
|
|
1311
|
+
attachmentsProjectMb,
|
|
1312
|
+
attachmentsRetentionDays
|
|
1313
|
+
},
|
|
1286
1314
|
brief: { extra },
|
|
1287
1315
|
secrets: { names: secretNames },
|
|
1288
1316
|
conductor: { defaultProfile, profiles, routing }
|
|
@@ -1322,6 +1350,9 @@ silence_minutes = 15 # a worker with no report for longer than this shows as
|
|
|
1322
1350
|
coordinator_minutes = 10 # an inbox item open longer than this shows "waiting for the coordinator"
|
|
1323
1351
|
# not_started_minutes = 10 # a launched worker that has not claimed after this long shows as not started
|
|
1324
1352
|
# plans = "approve" # or "pre-approved": workers post their plan and go on without waiting
|
|
1353
|
+
# attachments_per_ticket = 20
|
|
1354
|
+
# attachments_project_mb = 200
|
|
1355
|
+
# attachments_retention_days = 30
|
|
1325
1356
|
# pre_approved_label = "plan-approved" # a ticket with this label skips the approval
|
|
1326
1357
|
# approval_label = "needs-plan-approval" # a ticket with this label waits for it; wins over the other
|
|
1327
1358
|
|
|
@@ -1698,17 +1729,20 @@ function waitingPullRequests(m, prs) {
|
|
|
1698
1729
|
|
|
1699
1730
|
// ../core/src/live.ts
|
|
1700
1731
|
var LAUNCH_WINDOW_MS = 24 * 60 * 60000;
|
|
1732
|
+
var UNUSED_LAUNCH_GRACE_MS = 60 * 60000;
|
|
1733
|
+
var unusedLaunchExpired = (launch, now) => !launch.tokenUsedAt && now.getTime() > (launch.tokenExpiresAt ? Date.parse(launch.tokenExpiresAt) : Date.parse(launch.launchedAt) + 60 * 60000) + UNUSED_LAUNCH_GRACE_MS;
|
|
1734
|
+
var followedLaunches = (launches, now) => launches.filter((launch) => now.getTime() - Date.parse(launch.launchedAt) <= LAUNCH_WINDOW_MS && !unusedLaunchExpired(launch, now));
|
|
1701
1735
|
var MIN2 = 60000;
|
|
1702
1736
|
var REWRITTEN = ["hand-back", "plan"];
|
|
1703
1737
|
var digest = (text) => createHash("sha256").update(text).digest("base64url").slice(0, 12);
|
|
1704
|
-
var entryKey = (e) => e.id !== null ? REWRITTEN.includes(e.kind) ? `#${e.id}@${digest(e.body)}` : `#${e.id}` : e.version ? `version:${e.version}` : `${e.kind}:${e.ticket}`;
|
|
1738
|
+
var entryKey = (e) => e.id !== null ? REWRITTEN.includes(e.kind) ? `#${e.id}@${digest(e.body)}` : `#${e.id}` : e.version ? `version:${e.version}` : e.kind === "not-started" && e.body.startsWith("not started (token expired)") ? `not-started:${e.ticket}:expired@${digest(e.body)}` : `${e.kind}:${e.ticket}`;
|
|
1705
1739
|
var hhmm = (iso) => `${iso.slice(11, 16)} UTC`;
|
|
1706
1740
|
function notStartedBody(l, now) {
|
|
1707
1741
|
const minutes = Math.floor((now.getTime() - Date.parse(l.launchedAt)) / MIN2);
|
|
1708
1742
|
const why = l.tokenUsedAt ? `the worker signed in with its launch token at ${hhmm(l.tokenUsedAt)}, then stopped before \`armada claim\`` : "its launch token was never used: the worker never reached its `armada login` line (an install that failed, a prompt cut short)";
|
|
1709
|
-
return `launched ${minutes} min ago and never claimed; ${why}${l.handle ? ` (session ${l.handle})` : ""}. Check its session with the runtime guide's status section; launch it again with armada brief, or revoke
|
|
1743
|
+
return `launched ${minutes} min ago and never claimed; ${why}${l.handle ? ` (session ${l.handle})` : ""}. Check its session with the runtime guide's status section; launch it again with armada brief ${l.ticket} --prompt, or revoke it with armada launch revoke ${l.ticket}`;
|
|
1710
1744
|
}
|
|
1711
|
-
var notStartedLaunches = (launches, now, minutes) => launches.filter((l) => now.getTime() - Date.parse(l.launchedAt) > minutes * MIN2);
|
|
1745
|
+
var notStartedLaunches = (launches, now, minutes) => followedLaunches(launches, now).filter((l) => now.getTime() - Date.parse(l.launchedAt) > minutes * MIN2);
|
|
1712
1746
|
|
|
1713
1747
|
// ../core/src/activity.ts
|
|
1714
1748
|
var SAME_MS = 10 * 60000;
|
|
@@ -2249,6 +2283,15 @@ function armadaApi(opts) {
|
|
|
2249
2283
|
warnings: strings(body.warnings)
|
|
2250
2284
|
};
|
|
2251
2285
|
},
|
|
2286
|
+
async attach(signIn, target) {
|
|
2287
|
+
const { status, body } = await call("POST", "attachments", { signIn, body: target });
|
|
2288
|
+
if (status !== 200)
|
|
2289
|
+
throw refusal(status, body, "Armada did not attach this item");
|
|
2290
|
+
const attachment = body.attachment;
|
|
2291
|
+
if (!attachment || typeof attachment.id !== "string" || typeof body.url !== "string")
|
|
2292
|
+
throw new ArmadaApiError("Armada answered the attachment in an unknown shape");
|
|
2293
|
+
return { attachment, url: body.url };
|
|
2294
|
+
},
|
|
2252
2295
|
async setSecret(signIn, target) {
|
|
2253
2296
|
const { status, body } = await call("POST", "secrets/set", { signIn, body: target });
|
|
2254
2297
|
if (status !== 200)
|
|
@@ -2287,6 +2330,14 @@ function armadaApi(opts) {
|
|
|
2287
2330
|
throw refusal(status, body, "Armada did not end the ticket's workers");
|
|
2288
2331
|
return typeof body.ended === "number" ? body.ended : 0;
|
|
2289
2332
|
},
|
|
2333
|
+
async revokeLaunch(signIn, target) {
|
|
2334
|
+
const { status, body } = await call("POST", "workers/revoke", { signIn, body: target });
|
|
2335
|
+
if (status !== 200)
|
|
2336
|
+
throw refusal(status, body, "Armada did not revoke the launch");
|
|
2337
|
+
if (typeof body.id !== "string" || typeof body.ticket !== "string")
|
|
2338
|
+
throw new ArmadaApiError(`Armada (${host}) answered the revoked launch in a shape this CLI does not know`);
|
|
2339
|
+
return { id: body.id, ticket: body.ticket };
|
|
2340
|
+
},
|
|
2290
2341
|
async signOut(signIn) {
|
|
2291
2342
|
const { status, body } = await call("DELETE", "session", { signIn });
|
|
2292
2343
|
if (status !== 200)
|
|
@@ -2321,6 +2372,45 @@ async function waitForApproval({ api, code, sleep, now }) {
|
|
|
2321
2372
|
}
|
|
2322
2373
|
throw new ArmadaApiError("the code expired before it was approved", LOGIN_NEXT);
|
|
2323
2374
|
}
|
|
2375
|
+
// ../core/src/attachments.ts
|
|
2376
|
+
var MAX_ATTACHMENT_BYTES = 2 * 1024 * 1024;
|
|
2377
|
+
function attachmentImageType(bytes) {
|
|
2378
|
+
const starts = (signature) => signature.every((value, index) => bytes[index] === value);
|
|
2379
|
+
if (starts([137, 80, 78, 71, 13, 10, 26, 10]))
|
|
2380
|
+
return "image/png";
|
|
2381
|
+
if (starts([255, 216, 255]))
|
|
2382
|
+
return "image/jpeg";
|
|
2383
|
+
const text = (start, end) => String.fromCharCode(...bytes.slice(start, end));
|
|
2384
|
+
if (["GIF87a", "GIF89a"].includes(text(0, 6)))
|
|
2385
|
+
return "image/gif";
|
|
2386
|
+
if (bytes.length >= 16 && text(0, 4) === "RIFF" && text(8, 12) === "WEBP" && ["VP8 ", "VP8L", "VP8X"].includes(text(12, 16)))
|
|
2387
|
+
return "image/webp";
|
|
2388
|
+
return null;
|
|
2389
|
+
}
|
|
2390
|
+
function checkAttachment(input) {
|
|
2391
|
+
if (input.kind === "image") {
|
|
2392
|
+
if (input.bytes.length > MAX_ATTACHMENT_BYTES)
|
|
2393
|
+
return "attachment size limit: images must be at most 2 MB each";
|
|
2394
|
+
const type = attachmentImageType(input.bytes);
|
|
2395
|
+
if (!type || type !== input.contentType)
|
|
2396
|
+
return "attachment type limit: only PNG, JPEG, WebP and GIF images matching their bytes are accepted";
|
|
2397
|
+
return null;
|
|
2398
|
+
}
|
|
2399
|
+
try {
|
|
2400
|
+
if ([...input.url].some((character) => character.charCodeAt(0) < 32 || character.charCodeAt(0) === 127))
|
|
2401
|
+
return "attachment link type limit: a valid HTTPS URL without control characters is required";
|
|
2402
|
+
const url = new URL(input.url);
|
|
2403
|
+
if (url.protocol !== "https:")
|
|
2404
|
+
return "attachment link type limit: HTTPS only";
|
|
2405
|
+
if (url.username || url.password)
|
|
2406
|
+
return "attachment links must not contain credentials";
|
|
2407
|
+
if (input.url.length > 4096)
|
|
2408
|
+
return "attachment link size limit: 4096 characters";
|
|
2409
|
+
return null;
|
|
2410
|
+
} catch {
|
|
2411
|
+
return "attachment link type limit: a valid HTTPS URL is required";
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2324
2414
|
// ../core/src/phases.ts
|
|
2325
2415
|
var TRANSITIONS = {
|
|
2326
2416
|
planning: ["awaiting-approval", "implementing"],
|
|
@@ -3116,6 +3206,7 @@ ${quote(x.handBack.body)}` : "No hand-back note.", "");
|
|
|
3116
3206
|
`;
|
|
3117
3207
|
}
|
|
3118
3208
|
async function loadBrief(config, opts) {
|
|
3209
|
+
const launchHint = "a one-time token is made when you print the prompt (--prompt)";
|
|
3119
3210
|
const now = opts.now ?? (() => new Date);
|
|
3120
3211
|
const linear = { apiKey: opts.linearApiKey, ...opts.fetch ? { fetch: opts.fetch } : {} };
|
|
3121
3212
|
try {
|
|
@@ -3134,6 +3225,7 @@ async function loadBrief(config, opts) {
|
|
|
3134
3225
|
throw new Refusal(`ticket ${opts.ticket} not found in Linear`, "armada status, to see the tickets of the program");
|
|
3135
3226
|
if (opts.profile === null && hasProfileRules(config) && !routeProfile(config, ticket.labels))
|
|
3136
3227
|
return {
|
|
3228
|
+
launchHint,
|
|
3137
3229
|
ticket: {
|
|
3138
3230
|
id: ticket.id,
|
|
3139
3231
|
title: ticket.title,
|
|
@@ -3162,12 +3254,12 @@ async function loadBrief(config, opts) {
|
|
|
3162
3254
|
throw new BriefError(err.message);
|
|
3163
3255
|
throw err;
|
|
3164
3256
|
}
|
|
3165
|
-
const launch = await launchForBrief(ticket, opts.launch);
|
|
3257
|
+
const launch = await launchForBrief(ticket, opts.prompt === true ? opts.launch : undefined);
|
|
3166
3258
|
const made = launch && "token" in launch ? launch : null;
|
|
3167
3259
|
const missed = launch && "reason" in launch ? launch : null;
|
|
3168
3260
|
if (missed?.warn)
|
|
3169
3261
|
ticket.warnings.push(`no launch token: ${missed.reason}`);
|
|
3170
|
-
|
|
3262
|
+
const brief = buildBrief({
|
|
3171
3263
|
config,
|
|
3172
3264
|
ticket,
|
|
3173
3265
|
program,
|
|
@@ -3182,6 +3274,7 @@ async function loadBrief(config, opts) {
|
|
|
3182
3274
|
conventions: opts.conventions ?? null,
|
|
3183
3275
|
now: now()
|
|
3184
3276
|
});
|
|
3277
|
+
return opts.prompt ? brief : { ...brief, launchHint };
|
|
3185
3278
|
}
|
|
3186
3279
|
async function launchForBrief(ticket, launch) {
|
|
3187
3280
|
return ticket.statusType !== "completed" && ticket.statusType !== "canceled" && launch ? launch(ticket.id) : null;
|
|
@@ -5139,6 +5232,8 @@ function outcome(c, merged, pr, lines, workers, archive) {
|
|
|
5139
5232
|
}
|
|
5140
5233
|
// ../core/src/timeline.ts
|
|
5141
5234
|
var SAME_REPORT_MS = 2 * 60000;
|
|
5235
|
+
var MIN3 = 60000;
|
|
5236
|
+
var HOUR = 60 * MIN3;
|
|
5142
5237
|
// ../core/src/projects.ts
|
|
5143
5238
|
var message = (err) => err instanceof Error ? err.message : String(err);
|
|
5144
5239
|
async function readProjectConfig(p, opts) {
|
|
@@ -5204,7 +5299,7 @@ A coordinator may start cold, on a laptop or in a fresh cloud session, with noth
|
|
|
5204
5299
|
5. **Launch ready tickets** that do not collide with work in flight, one at a time:
|
|
5205
5300
|
- pick the ticket from the frontier in \`armada status\`;
|
|
5206
5301
|
- run \`armada brief <ticket>\` and resolve its warnings. A matching \`[[conductor.routing]]\` label rule wins. Otherwise, when profiles have \`when\` rules, the brief prints **Choose a profile** and mints no launch token. Read the ticket and its parent spec; match each profile's plain-language rule and prefer the one covering most files the ticket will change. If it spans front end and back end, choose where most of the work is and say so. Run \`armada brief <ticket> --profile <name> --reason "<why>"\`, naming the files or work that justify the choice. Armada never calls a model to classify tickets. Only projects without \`when\` rules fall back to \`default_profile\` (or their only profile). Override a matching label rule only when the labels mislead, with the same reasoned command. Keep \`--profile\` and \`--reason\` on every subsequent \`--prompt\` call; the reason reaches the worker's claim, status and agent page;
|
|
5207
|
-
- write the prompt with \`armada brief <ticket> --prompt > <file
|
|
5302
|
+
- write the prompt with one launch call: \`armada brief <ticket> --prompt --profile-line > <file>\`, keeping the chosen \`--profile\` and \`--reason\` flags. Stdout is the exact prompt; stderr gives the selected profile, agent, model, effort, runtime and reason for the runtime's launch settings. Human and \`--json\` previews are read-only and create no token or launch row. **The launch message is that \`--prompt\` output, never text cut from either preview**. Cancel a minted launch with \`armada launch revoke <ticket>\` if the runtime launch fails or you change your mind; a worker that has claimed must use \`armada release\` instead. Add what only you know: which parallel workers touch neighbouring code and where the boundary is, and decisions not yet on the ticket. The brief already says whether the plan needs approval (\`[policy] plans\`, or the ticket's label) and ends with the project's conventions (\`[brief] extra\`): put a note every worker needs in that file, not in each prompt;
|
|
5208
5303
|
- launch it with the runtime guide's *launch* section, passing the profile's values. When the brief's \`Launch:\` line says the prompt carries a one-time token, pass no key: the worker signs in with it. When it says there is none, fix the reason (usually your sign-in) and brief again, rather than pass keys; the token works once, within the hour, so brief right before the launch;
|
|
5209
5304
|
- 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.
|
|
5210
5305
|
6. **Merge handed-back pull requests** one at a time with \`armada merge <pr>\` (\`--wait\` when main moved since the hand-back, \`--no-ticket\` for a pull request no ticket owns), 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. When the repository's rules (\`AGENTS.md\`) ask you to ship each merge through its release pull request (release-please's \`chore(main): release …\`), merge that one next, as "The release pull request" in [MERGE.md](MERGE.md) describes.
|
|
@@ -5227,6 +5322,8 @@ You only learn of something new when a command you run ends. So while a worker i
|
|
|
5227
5322
|
|
|
5228
5323
|
## Rules of thumb
|
|
5229
5324
|
|
|
5325
|
+
- When asking the owner to validate a design or change, attach what they must see with \`armada attach <ticket> <files|https-urls>... --caption "<what to check>" [--for <item>]\` and include the returned private dashboard URLs in the request. Keep screenshots out of git. Only organization members can open the evidence; each image is at most 2 MB.
|
|
5326
|
+
|
|
5230
5327
|
- Merge only after the worker's hand-back; a green pull request can still get one more push that brings the default branch in.
|
|
5231
5328
|
- Parallel workers in one area collide: stagger them, or give each a disjoint area and tell them the boundary.
|
|
5232
5329
|
- Everything that must survive your session goes to the tracker or the repository. The next coordinator may be a fresh cloud session with none of your context: it resumes from \`armada status\` and \`armada inbox\`.
|
|
@@ -5250,9 +5347,8 @@ Armada never calls a runtime. This guide tells a coordinator running inside Clau
|
|
|
5250
5347
|
## Launch
|
|
5251
5348
|
|
|
5252
5349
|
1. Pick a ready ticket from \`armada status\` that does not collide with work in flight.
|
|
5253
|
-
2.
|
|
5254
|
-
|
|
5255
|
-
3. Read the prompt: \`armada brief ABC-12 --prompt\`. **The launch message is that \`--prompt\` output, and only it**: the human view and \`--json\` mask the token as \`armada_launch_••••\`, which signs nobody in. The token in it works once, within the hour: brief again when that hour has passed before the launch. Add what only you know (the boundary with a parallel worker, a decision not yet on the ticket) at the end.
|
|
5350
|
+
2. Read the ticket and parent, then choose its profile. A matching label rule wins; otherwise match the profiles' \`when\` rules by most files/work and pass \`--profile <name> --reason "<why>"\`. Mixed front-end/back-end work: choose the larger part and say why. An optional \`armada brief ABC-12\` or \`--json\` preview is read-only: neither mints a token nor marks a worker in flight. The profile must have \`runtime = "claude-code"\` in \`armada.toml\`. The profile's effort is not applied by the Agent tool; a worker that needs a set effort goes to Conductor.
|
|
5351
|
+
3. **Make one brief call for the launch:** \`armada brief ABC-12 --prompt --profile-line\`, keeping the chosen \`--profile\` and \`--reason\` flags. Stdout is the exact worker prompt; stderr names the profile, agent, model, effort, runtime and reason, so no second brief is needed for the model. Resolve warnings before launching. If the choice is still needed, \`--prompt\` refuses without minting anything. **The launch message is that \`--prompt\` output, and only it**: the human view and \`--json\` carry no token. The token works once, within the hour; generate a fresh prompt if it has expired. If you cancel or launching the subagent fails, use \`armada launch revoke ABC-12\`. Add what only you know (the boundary with a parallel worker, a decision not yet on the ticket) at the end. Without a launch token, stderr says why: usually \`armada login\`, then generate a new prompt.
|
|
5256
5352
|
4. Launch with the Agent tool, every value set:
|
|
5257
5353
|
|
|
5258
5354
|
\`\`\`json
|
|
@@ -5343,7 +5439,7 @@ A subagent launched without \`isolation: "worktree"\` runs in your checkout. The
|
|
|
5343
5439
|
`;
|
|
5344
5440
|
|
|
5345
5441
|
// ../../skills/armada-runtime-conductor/SKILL.md
|
|
5346
|
-
var SKILL_default3 = "---\nname: armada-runtime-conductor\ndescription: Runtime guide for running Armada workers on Conductor Cloud. Use when an Armada coordinator must launch a worker on a ticket, send it a message, check whether a silent worker is still alive, or stop and archive it. Four fixed sections, each with the exact conductor command and how to read its output.\n---\n\nArmada never calls a runtime. This guide tells the coordinator how to launch, message, check and stop a worker with the `conductor` command line tool, and what to record in Armada afterwards. It was checked against `conductor` 0.89.x (the desktop app's CLI, macOS) and 0.1.x (the CLI inside a Conductor Cloud workspace, Linux); every command below works in both. `conductor --version` prints yours; if a flag is refused, compare with `conductor <command> --help`.\n\n- On a Mac, the app ships the CLI at `/Applications/Conductor.app/Contents/Resources/bin/conductor`, which is not on PATH. `armada doctor` looks for it and prints the fix: a link from a directory already on PATH (`ln -s \"/Applications/Conductor.app/Contents/Resources/bin/conductor\" ~/.local/bin/conductor`), or a PATH line for your shell profile.\n- Always pass `--json` and read fields with `jq`. Exit codes: 0 ok, 1 runtime error, 2 usage error, 3 authentication, 4 server error.\n- On exit code 3, `conductor auth whoami` checks the token the CLI uses (it exits 0 when the token works). Do not rely on `conductor auth status`: it only looks for a macOS Keychain entry and fails on Linux (\"Keychain storage is only supported on macOS\"). In a Conductor Cloud workspace the CLI reads `CONDUCTOR_API_KEY` from the environment and needs no login; on a Mac, `conductor auth login` stores a token in the Keychain.\n- A worker is one workspace with one session. Its Armada handle is `<workspaceId>/<sessionId>`; the worker's claim comment carries it, so `armada status` and the ticket always lead back to the session.\n- A worker needs no key in its workspace: the prompt of `armada brief` carries a one-time launch token, and the worker's first command exchanges it for a session limited to its ticket, through which Armada gives each command its keys. The token works once, within the hour, so a copy left in a transcript is useless once used.\n- Never type a secret value into a command, a file or a message: name the variable and let your shell expand it. The expanded value is still in the `conductor` process's arguments while it runs, so launch from a machine only you use.\n\n## Launch\n\n1. Pick a ready ticket from `armada status` that does not collide with work in flight.\n2. Run `armada brief ABC-12`, right before the launch. A matching label rule wins. If it prints **Choose a profile**, read the ticket and parent, match the profiles' `when` rules by most files/work and rerun with `--profile <name> --reason \"<why>\"`. Mixed front-end/back-end work: choose the larger part and say why. Use those flags also for a label-route override and keep them on every subsequent `--prompt` call. Read the profile (agent, model, effort, fast mode), the `Launch:` line and the warnings. Resolve every warning first: an open blocker, a ticket already in flight.\n - `Launch: one-time token in the prompt` is the normal case: the worker signs in to Armada with it and fetches its own keys. Its workspace receives no key at all. This view and `--json` show the token as `armada_launch_••••`; only `--prompt` prints it.\n - `Launch: no launch token (…)` says why. Not signed in: `armada login` (a headless coordinator sets `ARMADA_API_KEY`), then brief again; `armada doctor` checks the sign-in. Launch with keys (step 4, second block) only on an Armada that keeps no keys yet (no accounts or no vault: a self-hosted one, CI, or before the owner's switch to the Keys page).\n3. **The launch message is the `--prompt` output, and only it.** Never cut the prompt out of the human view of `armada brief` or its `--json`: they mask the token as `armada_launch_••••`, which signs nobody in, and the worker's `armada login` stops on it. Write the prompt to a file only you can read with `--prompt`, and add what only you know (the boundary with a parallel worker, a decision not yet on the ticket). The token in it works once, within the hour: brief again when that hour has passed before the launch.\n\n```sh\n(umask 077; armada brief ABC-12 --prompt > /tmp/abc-12-brief.md)\n```\n\n4. Create the workspace with every value from the profile. Never leave the agent, model or effort to Conductor's defaults. Add `--fast-mode` when the profile says fast mode. Run the whole block as one command: shell state does not carry over between separate calls.\n\n```sh\nconductor --json workspace create \\\n --repo-url https://github.com/<owner>/<name> \\\n --branch main \\\n --name \"ABC-12 <short title>\" \\\n --agent claude --model opus-5-5-1m --effort high \\\n --message-file - \\\n --env ARMADA_TICKET=ABC-12 \\\n < /tmp/abc-12-brief.md > /tmp/abc-12-launch.json\nrm -f /tmp/abc-12-brief.md\njq -r '\"\\(.workspaceId)/\\(.sessionId)\"' /tmp/abc-12-launch.json\n```\n\nWithout a launch token (an Armada that keeps no keys), pass the keys the brief's environment table marks `required`, from your shell or from Armada's credentials file (`in credentials file`: the `set -a` line loads it without printing it; drop it when every variable is set in your shell). The subshell keeps the keys out of the rest of your session. Without a launch token the worker is not signed in to Armada: its claims and reports reach Linear only, with a warning. When Conductor's organization environment still holds the keys, every workspace already has them: use the first block.\n\n```sh\n(\n set -a; . \"${XDG_CONFIG_HOME:-$HOME/.config}/armada/credentials\"; set +a\n [ -n \"$LINEAR_API_KEY\" ] || { echo \"LINEAR_API_KEY is missing\" >&2; exit 1; }\n conductor --json workspace create \\\n --repo-url https://github.com/<owner>/<name> \\\n --branch main \\\n --name \"ABC-12 <short title>\" \\\n --agent claude --model opus-5-5-1m --effort high \\\n --message-file - \\\n --env ARMADA_TICKET=ABC-12 \\\n --env LINEAR_API_KEY=\"$LINEAR_API_KEY\" \\\n < /tmp/abc-12-brief.md > /tmp/abc-12-launch.json\n)\nrm -f /tmp/abc-12-brief.md\n```\n\n- `--branch` is the base branch (the default branch). Conductor creates a branch named `conductor/<slug of --name>`; the brief tells the worker to rename it to the ticket's branch.\n- The output has `workspaceId`, `sessionId`, `deepLink` and `initialMessage` (`messageId`, `state: \"queued\"`). Keep the handle the `jq` line prints, and give the owner the `deepLink` when they want to watch.\n- Conductor sets `CONDUCTOR_WORKSPACE_ID` and `CONDUCTOR_SESSION_ID` inside the workspace, and signs `gh` in for the worker's pushes. The brief's first commands install your Armada version (`npm install -g`), sign in with the launch token (`armada login --launch-token`) and claim the ticket. `--env` values are not shown back by `workspace get`.\n- Keys in Conductor's organization environment reach every workspace, workers included: once Armada keeps the organization's keys, they belong on Armada's Keys page, not there.\n- An unknown agent, model or effort fails the command. Check the ids with `conductor model` (each agent's models, efforts and defaults) and fix the profile in `armada.toml`.\n\n5. **Check the claim.** Within a few minutes, `armada status` lists the ticket in flight, phase `planning`, runtime `Conductor`, and the ticket's claim comment reads `session: <workspaceId>/<sessionId>` and `profile: <name>`. No claim after `[policy] not_started_minutes` (ten by default): `armada watch` and `armada inbox` show a `not-started` entry, and `armada status` lists the ticket under \"Launched, not started\". It says whether the worker never used its launch token (it never reached its login line) or signed in and stopped before its claim. Read the transcript (Status section). A worker whose launch token was refused (already used, or more than an hour old) needs a new one: `armada brief ABC-12 --prompt` again, and message it only the `armada login --launch-token …` line of the new `--prompt` output (Message section). A worker cut off from Armada was revoked on the dashboard (Organization > Workers says by whom) or left idle for three days: ask the owner before you give a revoked worker a new token. If the worker cannot claim for another reason, fix the cause and message it; as a last resort record the handle yourself with `armada claim ABC-12 --runtime conductor --handle <workspaceId>/<sessionId> --profile <name>`, adding the brief's `--reason` for an override.\n\n## Message\n\n```sh\nprintf '%s\\n' \"Plan approved. Go on.\" | conductor --json message create --session <sessionId> --message-file -\nconductor --json message create --session <sessionId> --message-file - < /tmp/abc-12-answer.md\n```\n\nThe output is `{\"messageId\": …, \"state\": \"sent\"}`. Exit code 0 means Conductor accepted the message, not that the worker read it: check that the session turns `working`, then read its reply in the transcript. Use it to deliver an answer, a plan approval, or a heads-up that the default branch moved. Then record it in Armada: `armada answer <item> \"<answer>\"` for a question from `armada inbox`, `armada answer --note ABC-12 \"<message>\"` for a message the worker did not ask for.\n\n## Status\n\n```sh\nconductor --json session status <sessionId>\n```\n\nThe output is `{\"workspaceId\", \"sessionId\", \"status\", \"updatedAt\"}`. For a worker:\n\n- `working`: a turn is running. A silent worker that is `working` is busy (a long build or test run): leave it, and read the transcript if it stays silent past twice `policy.silence_minutes`.\n- `idle`: no turn is running. The worker finished its turn: it handed back, it waits for an answer, or it stopped without finishing. If `armada status` does not show it `ready-to-merge`, `awaiting-approval` or `blocked`, it has stopped: read its last reply, then message it to go on, or release and relaunch the ticket.\n- `error`: the last turn failed (agent or provider failure). Read the transcript and message it to resume; if it fails again, cancel, archive, release and relaunch.\n- Right after launch the session is `idle` for a few seconds while the workspace is initializing and the first message is queued; it turns `working` when the agent starts.\n\nThe workspace itself: `conductor --json workspace status <workspaceId>` gives `status` `initializing`, `ready` or `archived`.\n\n**Read the transcript** to see what a worker did or said. Events come oldest first, 100 per page; `hasMore` tells when to fetch the next page with `--after` the last event id. Keep the last id you read and poll from it.\n\n```sh\nconductor --json session message <sessionId> --limit 100 > /tmp/abc-12-events.json\njq -r '.hasMore, .data[-1].id' /tmp/abc-12-events.json\nconductor --json session message <sessionId> --after <lastEventId> --limit 100\n```\n\nThe second line prints whether more pages exist and the id to continue from. `.content.rawPayload` is the agent's own event format, so the filters depend on the worker's agent (the `agent` of its profile in `armada.toml`).\n\nA `claude` worker: each turn's final reply, then the commands and tools it ran.\n\n```sh\njq -r '.data[] | select(.content.rawPayload.type == \"result\") | .content.rawPayload | \"error=\\(.is_error)\\n\\(.result)\"' /tmp/abc-12-events.json\njq -r '.data[] | select(.content.rawPayload.type == \"assistant\") | .content.rawPayload.message.content[] | select(.type == \"tool_use\") | .input.command // .name' /tmp/abc-12-events.json\n```\n\nA `codex` worker: its events are `.content.rawPayload.event`, each item once as `item.started` and once as `item.completed`; read the completed ones. Its messages (`phase` is `commentary` along the way, `final_answer` at the end of a turn), then each command with its exit code, and its tool calls (Linear and other MCP servers).\n\n```sh\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"agentMessage\") | \"[\\(.phase)] \\(.text)\"' /tmp/abc-12-events.json\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"commandExecution\") | \"exit=\\(.exitCode) \\(.command)\"' /tmp/abc-12-events.json\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"mcpToolCall\") | \"\\(.server) \\(.tool)\"' /tmp/abc-12-events.json\n```\n\nAnother agent, or a filter that prints nothing: count the event types, look at one event of the type you need, and adapt the filter.\n\n```sh\njq -r '.data[].content.rawPayload | .type // .event.type // \"(no payload)\"' /tmp/abc-12-events.json | sort | uniq -c\n```\n\n## Stop and archive\n\n```sh\nconductor --json session cancel <sessionId>\nconductor --json workspace archive <workspaceId>\n```\n\n- `session cancel` stops the running turn: `{\"status\", \"canceledQueuedMessages\"}`, and the session is `idle` within seconds. The workspace stays; a message starts a new turn. Use it on a worker that runs the wrong thing.\n- `workspace archive` answers `{\"status\": \"archived\"}`. Archive a worker's workspace after its pull request is merged, or after `armada release --ticket ABC-12 --reason \"<why>\"` for a worker that stops without handing back. The branch and the pull request stay on GitHub.\n- **Wait for `idle` before archiving.** A hand-back often arrives while the worker's session is still `working`: `armada report ready-to-merge` runs inside its last turn, which then writes its final reply. Archive only once `session status` answers `idle`. Poll it every 15 seconds; if it is still `working` after 10 minutes, cancel the turn and archive (the transcript keeps what it was doing). Run the whole block as one command; it can take up to 10 minutes, so run it in the background or give it a longer command timeout:\n\n```sh\nfor i in $(seq 40); do\n [ \"$(conductor --json session status <sessionId> | jq -r .status)\" = working ] || break\n sleep 15\ndone\n[ \"$(conductor --json session status <sessionId> | jq -r .status)\" = working ] && conductor --json session cancel <sessionId>\nconductor --json workspace archive <workspaceId>\n```\n- After an archive, `session status` still answers `idle`; `workspace status` says `archived`.\n";
|
|
5442
|
+
var SKILL_default3 = "---\nname: armada-runtime-conductor\ndescription: Runtime guide for running Armada workers on Conductor Cloud. Use when an Armada coordinator must launch a worker on a ticket, send it a message, check whether a silent worker is still alive, or stop and archive it. Four fixed sections, each with the exact conductor command and how to read its output.\n---\n\nArmada never calls a runtime. This guide tells the coordinator how to launch, message, check and stop a worker with the `conductor` command line tool, and what to record in Armada afterwards. It was checked against `conductor` 0.89.x (the desktop app's CLI, macOS) and 0.1.x (the CLI inside a Conductor Cloud workspace, Linux); every command below works in both. `conductor --version` prints yours; if a flag is refused, compare with `conductor <command> --help`.\n\n- On a Mac, the app ships the CLI at `/Applications/Conductor.app/Contents/Resources/bin/conductor`, which is not on PATH. `armada doctor` looks for it and prints the fix: a link from a directory already on PATH (`ln -s \"/Applications/Conductor.app/Contents/Resources/bin/conductor\" ~/.local/bin/conductor`), or a PATH line for your shell profile.\n- Always pass `--json` and read fields with `jq`. Exit codes: 0 ok, 1 runtime error, 2 usage error, 3 authentication, 4 server error.\n- On exit code 3, `conductor auth whoami` checks the token the CLI uses (it exits 0 when the token works). Do not rely on `conductor auth status`: it only looks for a macOS Keychain entry and fails on Linux (\"Keychain storage is only supported on macOS\"). In a Conductor Cloud workspace the CLI reads `CONDUCTOR_API_KEY` from the environment and needs no login; on a Mac, `conductor auth login` stores a token in the Keychain.\n- A worker is one workspace with one session. Its Armada handle is `<workspaceId>/<sessionId>`; the worker's claim comment carries it, so `armada status` and the ticket always lead back to the session.\n- A worker needs no key in its workspace: the prompt of `armada brief` carries a one-time launch token, and the worker's first command exchanges it for a session limited to its ticket, through which Armada gives each command its keys. The token works once, within the hour, so a copy left in a transcript is useless once used.\n- Never type a secret value into a command, a file or a message: name the variable and let your shell expand it. The expanded value is still in the `conductor` process's arguments while it runs, so launch from a machine only you use.\n\n## Launch\n\n1. Pick a ready ticket from `armada status` that does not collide with work in flight.\n2. Read the ticket and parent, then choose its profile. A matching label rule wins; otherwise match the profiles' `when` rules by most files/work. Mixed front-end/back-end work: choose the larger part and say why with `--profile <name> --reason \"<why>\"`. An optional `armada brief ABC-12` or `--json` preview helps resolve the choice and warnings, but is read-only: neither creates a launch token nor marks a worker in flight. If the choice is still needed, `--prompt` refuses before minting anything.\n3. **Make one brief call for the launch:** `--prompt --profile-line` writes only the worker prompt to stdout and the selected profile (agent, model, effort, fast mode, runtime and reason) to stderr. Read that line to configure Conductor; no second brief is needed for the profile. Keep any `--profile` and `--reason` flags on this call. Resolve warnings before launching. Never cut a launch message from the human view or `--json`: they carry no token. Write the prompt to a file only you can read, then add what only you know (the boundary with a parallel worker, a decision not yet on the ticket). The token works once, within the hour; if you cancel or the runtime launch fails, use `armada launch revoke ABC-12`. Generate a fresh prompt if its token has expired.\n\n```sh\n(umask 077; armada brief ABC-12 --prompt --profile-line > /tmp/abc-12-brief.md)\n```\n\n4. Create the workspace with every value from the profile. Never leave the agent, model or effort to Conductor's defaults. Add `--fast-mode` when the profile says fast mode. Run the whole block as one command: shell state does not carry over between separate calls.\n\n```sh\nconductor --json workspace create \\\n --repo-url https://github.com/<owner>/<name> \\\n --branch main \\\n --name \"ABC-12 <short title>\" \\\n --agent claude --model opus-5-5-1m --effort high \\\n --message-file - \\\n --env ARMADA_TICKET=ABC-12 \\\n < /tmp/abc-12-brief.md > /tmp/abc-12-launch.json\nrm -f /tmp/abc-12-brief.md\njq -r '\"\\(.workspaceId)/\\(.sessionId)\"' /tmp/abc-12-launch.json\n```\n\nIf the prompt has no launch token, its stderr warning says why. Not signed in: `armada login` (a headless coordinator sets `ARMADA_API_KEY`), then generate a new prompt; `armada doctor` checks the sign-in. Only on an Armada that keeps no keys yet (no accounts or no vault), pass the keys the read-only brief's environment table marks `required`, from your shell or from Armada's credentials file (`in credentials file`: the `set -a` line loads it without printing it; drop it when every variable is set in your shell). The subshell keeps the keys out of the rest of your session. Without a launch token the worker is not signed in to Armada: its claims and reports reach Linear only, with a warning. When Conductor's organization environment still holds the keys, every workspace already has them: use the first block.\n\n```sh\n(\n set -a; . \"${XDG_CONFIG_HOME:-$HOME/.config}/armada/credentials\"; set +a\n [ -n \"$LINEAR_API_KEY\" ] || { echo \"LINEAR_API_KEY is missing\" >&2; exit 1; }\n conductor --json workspace create \\\n --repo-url https://github.com/<owner>/<name> \\\n --branch main \\\n --name \"ABC-12 <short title>\" \\\n --agent claude --model opus-5-5-1m --effort high \\\n --message-file - \\\n --env ARMADA_TICKET=ABC-12 \\\n --env LINEAR_API_KEY=\"$LINEAR_API_KEY\" \\\n < /tmp/abc-12-brief.md > /tmp/abc-12-launch.json\n)\nrm -f /tmp/abc-12-brief.md\n```\n\n- `--branch` is the base branch (the default branch). Conductor creates a branch named `conductor/<slug of --name>`; the brief tells the worker to rename it to the ticket's branch.\n- The output has `workspaceId`, `sessionId`, `deepLink` and `initialMessage` (`messageId`, `state: \"queued\"`). Keep the handle the `jq` line prints, and give the owner the `deepLink` when they want to watch.\n- Conductor sets `CONDUCTOR_WORKSPACE_ID` and `CONDUCTOR_SESSION_ID` inside the workspace, and signs `gh` in for the worker's pushes. The brief's first commands install your Armada version (`npm install -g`), sign in with the launch token (`armada login --launch-token`) and claim the ticket. `--env` values are not shown back by `workspace get`.\n- Keys in Conductor's organization environment reach every workspace, workers included: once Armada keeps the organization's keys, they belong on Armada's Keys page, not there.\n- An unknown agent, model or effort fails the command. Check the ids with `conductor model` (each agent's models, efforts and defaults) and fix the profile in `armada.toml`.\n\n5. **Check the claim.** Within a few minutes, `armada status` lists the ticket in flight, phase `planning`, runtime `Conductor`, and the ticket's claim comment reads `session: <workspaceId>/<sessionId>` and `profile: <name>`. No claim after `[policy] not_started_minutes` (ten by default): `armada watch` and `armada inbox` show a `not-started` entry; status lists it under \"Pending launches\" with `armada launch revoke ABC-12`. It says whether the worker never used its launch token (it never reached its login line) or signed in and stopped before its claim. An unused token expired more than an hour ago produces one `not started (token expired)` inbox notice, then clears. Exchanged launches without a claim stop being followed after 24 hours and remain revocable. Read the transcript (Status section). A worker whose launch token was refused (already used, or more than an hour old) needs a new one: `armada brief ABC-12 --prompt --profile-line` again, and message it only the `armada login --launch-token …` line of the new `--prompt` output (Message section). A worker cut off from Armada was revoked (Organization > Workers says by whom) or left idle for three days: ask the owner before you give a revoked worker a new token. If the worker cannot claim for another reason, fix the cause and message it; as a last resort record the handle yourself with `armada claim ABC-12 --runtime conductor --handle <workspaceId>/<sessionId> --profile <name>`, adding the brief's `--reason` for an override.\n\n## Message\n\n```sh\nprintf '%s\\n' \"Plan approved. Go on.\" | conductor --json message create --session <sessionId> --message-file -\nconductor --json message create --session <sessionId> --message-file - < /tmp/abc-12-answer.md\n```\n\nThe output is `{\"messageId\": …, \"state\": \"sent\"}`. Exit code 0 means Conductor accepted the message, not that the worker read it: check that the session turns `working`, then read its reply in the transcript. Use it to deliver an answer, a plan approval, or a heads-up that the default branch moved. Then record it in Armada: `armada answer <item> \"<answer>\"` for a question from `armada inbox`, `armada answer --note ABC-12 \"<message>\"` for a message the worker did not ask for.\n\n## Status\n\n```sh\nconductor --json session status <sessionId>\n```\n\nThe output is `{\"workspaceId\", \"sessionId\", \"status\", \"updatedAt\"}`. For a worker:\n\n- `working`: a turn is running. A silent worker that is `working` is busy (a long build or test run): leave it, and read the transcript if it stays silent past twice `policy.silence_minutes`.\n- `idle`: no turn is running. The worker finished its turn: it handed back, it waits for an answer, or it stopped without finishing. If `armada status` does not show it `ready-to-merge`, `awaiting-approval` or `blocked`, it has stopped: read its last reply, then message it to go on, or release and relaunch the ticket.\n- `error`: the last turn failed (agent or provider failure). Read the transcript and message it to resume; if it fails again, cancel, archive, release and relaunch.\n- Right after launch the session is `idle` for a few seconds while the workspace is initializing and the first message is queued; it turns `working` when the agent starts.\n\nThe workspace itself: `conductor --json workspace status <workspaceId>` gives `status` `initializing`, `ready` or `archived`.\n\n**Read the transcript** to see what a worker did or said. Events come oldest first, 100 per page; `hasMore` tells when to fetch the next page with `--after` the last event id. Keep the last id you read and poll from it.\n\n```sh\nconductor --json session message <sessionId> --limit 100 > /tmp/abc-12-events.json\njq -r '.hasMore, .data[-1].id' /tmp/abc-12-events.json\nconductor --json session message <sessionId> --after <lastEventId> --limit 100\n```\n\nThe second line prints whether more pages exist and the id to continue from. `.content.rawPayload` is the agent's own event format, so the filters depend on the worker's agent (the `agent` of its profile in `armada.toml`).\n\nA `claude` worker: each turn's final reply, then the commands and tools it ran.\n\n```sh\njq -r '.data[] | select(.content.rawPayload.type == \"result\") | .content.rawPayload | \"error=\\(.is_error)\\n\\(.result)\"' /tmp/abc-12-events.json\njq -r '.data[] | select(.content.rawPayload.type == \"assistant\") | .content.rawPayload.message.content[] | select(.type == \"tool_use\") | .input.command // .name' /tmp/abc-12-events.json\n```\n\nA `codex` worker: its events are `.content.rawPayload.event`, each item once as `item.started` and once as `item.completed`; read the completed ones. Its messages (`phase` is `commentary` along the way, `final_answer` at the end of a turn), then each command with its exit code, and its tool calls (Linear and other MCP servers).\n\n```sh\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"agentMessage\") | \"[\\(.phase)] \\(.text)\"' /tmp/abc-12-events.json\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"commandExecution\") | \"exit=\\(.exitCode) \\(.command)\"' /tmp/abc-12-events.json\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"mcpToolCall\") | \"\\(.server) \\(.tool)\"' /tmp/abc-12-events.json\n```\n\nAnother agent, or a filter that prints nothing: count the event types, look at one event of the type you need, and adapt the filter.\n\n```sh\njq -r '.data[].content.rawPayload | .type // .event.type // \"(no payload)\"' /tmp/abc-12-events.json | sort | uniq -c\n```\n\n## Stop and archive\n\n```sh\nconductor --json session cancel <sessionId>\nconductor --json workspace archive <workspaceId>\n```\n\n- `session cancel` stops the running turn: `{\"status\", \"canceledQueuedMessages\"}`, and the session is `idle` within seconds. The workspace stays; a message starts a new turn. Use it on a worker that runs the wrong thing.\n- `workspace archive` answers `{\"status\": \"archived\"}`. Archive a worker's workspace after its pull request is merged, or after `armada release --ticket ABC-12 --reason \"<why>\"` for a worker that stops without handing back. The branch and the pull request stay on GitHub.\n- **Wait for `idle` before archiving.** A hand-back often arrives while the worker's session is still `working`: `armada report ready-to-merge` runs inside its last turn, which then writes its final reply. Archive only once `session status` answers `idle`. Poll it every 15 seconds; if it is still `working` after 10 minutes, cancel the turn and archive (the transcript keeps what it was doing). Run the whole block as one command; it can take up to 10 minutes, so run it in the background or give it a longer command timeout:\n\n```sh\nfor i in $(seq 40); do\n [ \"$(conductor --json session status <sessionId> | jq -r .status)\" = working ] || break\n sleep 15\ndone\n[ \"$(conductor --json session status <sessionId> | jq -r .status)\" = working ] && conductor --json session cancel <sessionId>\nconductor --json workspace archive <workspaceId>\n```\n- After an archive, `session status` still answers `idle`; `workspace status` says `archived`.\n";
|
|
5347
5443
|
|
|
5348
5444
|
// ../../skills/armada-worker/SKILL.md
|
|
5349
5445
|
var SKILL_default4 = `---
|
|
@@ -5362,6 +5458,7 @@ You are a worker. You own exactly one ticket, named in your launch brief. You tu
|
|
|
5362
5458
|
- **The ticket is the source of truth.** Read it, its parent spec and the hand-back comments of its merged blockers in full before planning.
|
|
5363
5459
|
- Work only in your own branch and worktree. Never touch another agent's checkout, and stop only the processes you started.
|
|
5364
5460
|
- Never print, commit or log a secret.
|
|
5461
|
+
- For every visible change, capture screenshots under a gitignored directory, then \`armada attach <ticket> <files|https-urls>... --caption "<what to check>"\`. Link the returned private dashboard URLs in the pull request description. Never commit screenshots to show a change. PNG, JPEG, WebP and GIF images are limited to 2 MB each; only the project's organization members may open them. \`--for <item>\` associates evidence with an owner's validation reference when one exists.
|
|
5365
5462
|
- **The project's secrets** (an LLM provider key, a test database URL) come from Armada, never from your launch environment; \`armada secrets\` lists their names. Use them, in this order: \`armada run -- <command>\` for tests, builds and dev servers (they go in that command's environment only); \`armada secrets export --file <path>\` for a tool that reads a dotenv file, at a path git ignores (e.g. \`.env.local\`). Never run \`armada secrets get\`, and never echo, \`env\` or \`printenv\` a value: your command output is your transcript. A secret you need and do not have: ask the coordinator for it by name.
|
|
5366
5463
|
|
|
5367
5464
|
## Steps
|
|
@@ -5829,6 +5926,7 @@ function buildStatus({
|
|
|
5829
5926
|
openBlockers: l.openBlockers,
|
|
5830
5927
|
flags: l.flags
|
|
5831
5928
|
})),
|
|
5929
|
+
pendingLaunches: followedLaunches(launches, now),
|
|
5832
5930
|
notStarted: notStartedLaunches(launches, now, config.policy.notStartedMinutes).map((l) => {
|
|
5833
5931
|
const issue = issues.find((i) => i.id === l.ticket);
|
|
5834
5932
|
return { ...l, title: issue?.title ?? null, url: issue?.url ?? null, detail: notStartedBody(l, now) };
|
|
@@ -5902,7 +6000,10 @@ async function loadStatus(config, opts) {
|
|
|
5902
6000
|
});
|
|
5903
6001
|
}
|
|
5904
6002
|
// package.json
|
|
5905
|
-
var version = "0.2.
|
|
6003
|
+
var version = "0.2.19";
|
|
6004
|
+
|
|
6005
|
+
// src/attach.ts
|
|
6006
|
+
import { resolve } from "node:path";
|
|
5906
6007
|
|
|
5907
6008
|
// src/api.ts
|
|
5908
6009
|
var runs = new WeakMap;
|
|
@@ -5933,6 +6034,67 @@ class UsageError extends Error {
|
|
|
5933
6034
|
}
|
|
5934
6035
|
var missingKey = (key) => new UsageError(missingKeyMessage(key), "armada auth login");
|
|
5935
6036
|
|
|
6037
|
+
// src/attach.ts
|
|
6038
|
+
async function attachItems(io, config, credentials, target) {
|
|
6039
|
+
const ticket = target.ticket.toUpperCase();
|
|
6040
|
+
if (!/^[A-Z][A-Z0-9]*-\d+$/.test(ticket))
|
|
6041
|
+
throw new UsageError("attachment ticket limit: use a ticket identifier, e.g. WID-15");
|
|
6042
|
+
if (!target.items.length)
|
|
6043
|
+
throw new UsageError("attach needs at least one file or HTTPS URL");
|
|
6044
|
+
const signIn = credentials.armadaSignIn;
|
|
6045
|
+
if (!signIn)
|
|
6046
|
+
throw new UsageError("attachments need a sign-in to Armada", "armada login");
|
|
6047
|
+
if (signIn.kind === "worker" && (signIn.ticket !== ticket || signIn.project !== config.project.slug))
|
|
6048
|
+
throw new UsageError(`attachment ticket limit: this worker session acts on ${signIn.project}/${signIn.ticket} only`);
|
|
6049
|
+
const api = apiOf(io, credentials.armadaApi.url);
|
|
6050
|
+
const uploaded = [];
|
|
6051
|
+
for (const item of target.items) {
|
|
6052
|
+
let input;
|
|
6053
|
+
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(item)) {
|
|
6054
|
+
const link = { kind: "link", url: item };
|
|
6055
|
+
const refusal = checkAttachment(link);
|
|
6056
|
+
if (refusal)
|
|
6057
|
+
throw new UsageError(refusal);
|
|
6058
|
+
input = link;
|
|
6059
|
+
} else {
|
|
6060
|
+
if (!io.readBinaryFile)
|
|
6061
|
+
throw new UsageError("this CLI cannot read attachment files");
|
|
6062
|
+
const bytes = await io.readBinaryFile(resolve(io.cwd, item), MAX_ATTACHMENT_BYTES);
|
|
6063
|
+
if (!bytes)
|
|
6064
|
+
throw new UsageError(`attachment file not found: ${item}`);
|
|
6065
|
+
const contentType = attachmentImageType(bytes) ?? "";
|
|
6066
|
+
const refusal = checkAttachment({ kind: "image", contentType, bytes });
|
|
6067
|
+
if (refusal)
|
|
6068
|
+
throw new UsageError(refusal);
|
|
6069
|
+
input = { kind: "image", contentType, data: Buffer.from(bytes).toString("base64") };
|
|
6070
|
+
}
|
|
6071
|
+
const saved = await api.attach(signIn, {
|
|
6072
|
+
project: projectOf(config),
|
|
6073
|
+
ticket,
|
|
6074
|
+
input,
|
|
6075
|
+
caption: target.caption ?? null,
|
|
6076
|
+
reference: target.reference ?? null
|
|
6077
|
+
});
|
|
6078
|
+
uploaded.push(saved);
|
|
6079
|
+
target.onAttached?.(saved);
|
|
6080
|
+
}
|
|
6081
|
+
return uploaded;
|
|
6082
|
+
}
|
|
6083
|
+
async function attachCommand(io, config, credentials, args) {
|
|
6084
|
+
const [ticket, ...items] = args.rest;
|
|
6085
|
+
if (!ticket)
|
|
6086
|
+
throw new UsageError("attach needs a ticket and at least one file or HTTPS URL");
|
|
6087
|
+
await attachItems(io, config, credentials, {
|
|
6088
|
+
ticket,
|
|
6089
|
+
items,
|
|
6090
|
+
caption: args.options.caption,
|
|
6091
|
+
reference: args.options.for,
|
|
6092
|
+
onAttached: (saved) => io.stdout(`${saved.url}
|
|
6093
|
+
`)
|
|
6094
|
+
});
|
|
6095
|
+
return 0;
|
|
6096
|
+
}
|
|
6097
|
+
|
|
5936
6098
|
// src/auth.ts
|
|
5937
6099
|
async function loadMachine(io) {
|
|
5938
6100
|
const paths = machinePaths(io.env);
|
|
@@ -6700,7 +6862,7 @@ async function inbox2(io, config, credentials, a) {
|
|
|
6700
6862
|
}
|
|
6701
6863
|
|
|
6702
6864
|
// src/release.ts
|
|
6703
|
-
var NOTICE_COMMANDS = new Set(["status", "inbox", "watch", "brief", "merge", "doctor"]);
|
|
6865
|
+
var NOTICE_COMMANDS = new Set(["status", "inbox", "watch", "brief", "launch", "merge", "doctor"]);
|
|
6704
6866
|
function newer(io, running) {
|
|
6705
6867
|
const server = heard(io).server;
|
|
6706
6868
|
if (io.env.ARMADA_TICKET?.trim() || !server || compareVersions(running, server.minimum) < 0)
|
|
@@ -6890,8 +7052,8 @@ function renderBrief(b) {
|
|
|
6890
7052
|
...b.conventions ? [`Conventions: ${b.conventions.path} (under "Project conventions" in the prompt)`] : [],
|
|
6891
7053
|
`Repository: ${b.repository.url}`,
|
|
6892
7054
|
`Branch: ${b.ticket.branch ?? "none suggested by Linear"} (the worker renames its workspace branch to it)`,
|
|
6893
|
-
`Launch: ${b.launch ? `one-time token in the prompt, valid until ${b.launch.expiresAt.slice(0, 16).replace("T", " ")} UTC: the worker needs no key
|
|
6894
|
-
(shown as ${HIDDEN_LAUNCH_TOKEN} here; \`${promptCommand}\` prints it)` : `no launch token${b.noLaunch ? ` (${b.noLaunch})` : ""}: pass the keys below in the worker's environment`}`,
|
|
7055
|
+
`Launch: ${b.launchHint ?? (b.launch ? `one-time token in the prompt, valid until ${b.launch.expiresAt.slice(0, 16).replace("T", " ")} UTC: the worker needs no key
|
|
7056
|
+
(shown as ${HIDDEN_LAUNCH_TOKEN} here; \`${promptCommand}\` prints it)` : `no launch token${b.noLaunch ? ` (${b.noLaunch})` : ""}: pass the keys below in the worker's environment`)}`,
|
|
6895
7057
|
"",
|
|
6896
7058
|
"Environment to pass (values are never printed):",
|
|
6897
7059
|
...b.environment.map((v) => {
|
|
@@ -6918,6 +7080,7 @@ function renderProfileSelection(b) {
|
|
|
6918
7080
|
...b.selection.profiles.map((profile) => ` ${profile.name}: ${profile.when ?? "no when rule; choose only with a reason"}`),
|
|
6919
7081
|
"",
|
|
6920
7082
|
b.selection.hint,
|
|
7083
|
+
...b.launchHint ? [`Launch: ${b.launchHint}`] : [],
|
|
6921
7084
|
...b.warnings.map((warning) => `Warning: ${warning}`)
|
|
6922
7085
|
].join(`
|
|
6923
7086
|
`);
|
|
@@ -6952,6 +7115,8 @@ async function brief2(io, config, credentials, a, version, configPath) {
|
|
|
6952
7115
|
if (extra.length)
|
|
6953
7116
|
throw new UsageError(`unexpected argument ${extra[0]}`);
|
|
6954
7117
|
const promptOnly = a.options.prompt === "true";
|
|
7118
|
+
if (a.options["profile-line"] && !promptOnly)
|
|
7119
|
+
throw new UsageError("--profile-line goes with --prompt");
|
|
6955
7120
|
if (a.json && promptOnly)
|
|
6956
7121
|
throw new UsageError("pass --json or --prompt, not both");
|
|
6957
7122
|
const profile = a.options.profile?.trim() || null;
|
|
@@ -6979,6 +7144,7 @@ async function brief2(io, config, credentials, a, version, configPath) {
|
|
|
6979
7144
|
version,
|
|
6980
7145
|
env: io.env,
|
|
6981
7146
|
stored: STORED_KEYS.filter((k) => credentials.sources[k.name]?.kind === "store").map((k) => k.variable),
|
|
7147
|
+
prompt: promptOnly,
|
|
6982
7148
|
launch: launcher(io, config, credentials),
|
|
6983
7149
|
npm: (v) => checkPublished(v, io.fetch ?? fetch),
|
|
6984
7150
|
conventions,
|
|
@@ -6999,16 +7165,23 @@ async function brief2(io, config, credentials, a, version, configPath) {
|
|
|
6999
7165
|
}
|
|
7000
7166
|
const project = config.project.slug;
|
|
7001
7167
|
const known = (await watchOf(io, project)).state?.inFlight ?? [];
|
|
7002
|
-
const inFlight = [...new Set([...known, b.ticket.id])].sort((x, y) => x.localeCompare(y, "en", { numeric: true }));
|
|
7003
|
-
await remember(io, project, { inFlight, readAt: (io.now ?? (() => new Date))().toISOString() });
|
|
7004
7168
|
if (promptOnly) {
|
|
7169
|
+
const inFlight = [...new Set([...known, b.ticket.id])].sort((x, y) => x.localeCompare(y, "en", { numeric: true }));
|
|
7170
|
+
await remember(io, project, { inFlight, readAt: (io.now ?? (() => new Date))().toISOString() });
|
|
7171
|
+
if (a.options["profile-line"]) {
|
|
7172
|
+
const profile = b.profile;
|
|
7173
|
+
io.stderr(`Profile: ${profile ? `${profile.name}: agent ${profile.agent}, model ${profile.model}, effort ${profile.effort}${profile.fastMode ? ", fast mode" : ""}` : "none declared in armada.toml"}, runtime ${b.runtime}${b.routing ? ` — ${b.routing.why}` : ""}
|
|
7174
|
+
`);
|
|
7175
|
+
io.stderr(`Launch: ${b.launch ? `one-time token made, valid until ${b.launch.expiresAt}` : `no launch token${b.noLaunch ? ` (${b.noLaunch})` : ""}`}
|
|
7176
|
+
`);
|
|
7177
|
+
}
|
|
7005
7178
|
io.stdout(b.prompt);
|
|
7006
7179
|
for (const w of b.warnings)
|
|
7007
7180
|
io.stderr(`armada: warning: ${w}
|
|
7008
7181
|
`);
|
|
7009
7182
|
return 0;
|
|
7010
7183
|
}
|
|
7011
|
-
const next = await rearmFor(io, project, { inFlight, open: null });
|
|
7184
|
+
const next = await rearmFor(io, project, { inFlight: known, open: null });
|
|
7012
7185
|
const shown = hideLaunchToken(b);
|
|
7013
7186
|
if (a.json)
|
|
7014
7187
|
io.stdout(`${JSON.stringify({ ...shown, watch: next }, null, 2)}
|
|
@@ -7581,6 +7754,27 @@ async function init(io, opts) {
|
|
|
7581
7754
|
}
|
|
7582
7755
|
}
|
|
7583
7756
|
|
|
7757
|
+
// src/launch.ts
|
|
7758
|
+
async function launch(io, config, credentials, args) {
|
|
7759
|
+
const [operation, ticket, ...extra] = args.rest;
|
|
7760
|
+
if (operation !== "revoke" || !ticket || extra.length || !/^[A-Za-z][A-Za-z0-9]{0,15}-\d{1,9}$/.test(ticket))
|
|
7761
|
+
throw new UsageError("launch needs a ticket to revoke: armada launch revoke <ticket>");
|
|
7762
|
+
const revoked = await apiOf(io, credentials.armadaApi.url).revokeLaunch(requireSignIn(credentials), {
|
|
7763
|
+
project: config.project.slug,
|
|
7764
|
+
ticket: ticket.toUpperCase()
|
|
7765
|
+
});
|
|
7766
|
+
const known = (await watchOf(io, config.project.slug)).state?.inFlight;
|
|
7767
|
+
const inFlight = known?.filter((held) => held !== revoked.ticket) ?? null;
|
|
7768
|
+
if (inFlight)
|
|
7769
|
+
await remember(io, config.project.slug, { inFlight, readAt: (io.now ?? (() => new Date))().toISOString() });
|
|
7770
|
+
const watch = await rearmFor(io, config.project.slug, { inFlight, open: null });
|
|
7771
|
+
io.stdout(args.json ? `${JSON.stringify({ ...revoked, watch }, null, 2)}
|
|
7772
|
+
` : `Revoked the pending launch of ${revoked.ticket}.
|
|
7773
|
+
${watch.line}
|
|
7774
|
+
`);
|
|
7775
|
+
return 0;
|
|
7776
|
+
}
|
|
7777
|
+
|
|
7584
7778
|
// src/merge.ts
|
|
7585
7779
|
import { randomUUID } from "node:crypto";
|
|
7586
7780
|
import { rm as rm4 } from "node:fs/promises";
|
|
@@ -7830,10 +8024,10 @@ async function merge2(io, config, credentials, a, configPath) {
|
|
|
7830
8024
|
}
|
|
7831
8025
|
|
|
7832
8026
|
// src/render.ts
|
|
7833
|
-
var
|
|
8027
|
+
var MIN4 = 60000;
|
|
7834
8028
|
function relative2(iso, now) {
|
|
7835
8029
|
const diff = now - Date.parse(iso);
|
|
7836
|
-
const m = Math.round(Math.abs(diff) /
|
|
8030
|
+
const m = Math.round(Math.abs(diff) / MIN4);
|
|
7837
8031
|
const suffix = diff >= 0 ? "ago" : "from now";
|
|
7838
8032
|
if (m < 1)
|
|
7839
8033
|
return "just now";
|
|
@@ -7886,13 +8080,16 @@ function renderStatus(r) {
|
|
|
7886
8080
|
if (t.flags.length)
|
|
7887
8081
|
out.push(`${indent}! ${t.flags.join(", ")}`);
|
|
7888
8082
|
}
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
8083
|
+
const pending = r.pendingLaunches ?? r.notStarted;
|
|
8084
|
+
if (pending.length) {
|
|
8085
|
+
out.push("", `Pending launches (${pending.length})`);
|
|
8086
|
+
for (const l of pending) {
|
|
7892
8087
|
out.push(` ${pad(l.ticket, idWidth)} launched ${relative2(l.launchedAt, now)} · ${l.tokenUsedAt ? `signed in ${relative2(l.tokenUsedAt, now)}, no claim` : "launch token never used"}${l.handle ? ` · ${l.handle}` : ""}`);
|
|
7893
|
-
|
|
7894
|
-
|
|
8088
|
+
const title = r.notStarted.find((launch) => launch.ticket === l.ticket)?.title;
|
|
8089
|
+
if (title)
|
|
8090
|
+
out.push(`${indent}${truncate(title, 90)}`);
|
|
7895
8091
|
out.push(`${indent}! check its session with the runtime guide's status section`);
|
|
8092
|
+
out.push(`${indent}Cancel: armada launch revoke ${l.ticket}`);
|
|
7896
8093
|
}
|
|
7897
8094
|
}
|
|
7898
8095
|
const ready = r.frontier.filter((t) => t.readyForAgent);
|
|
@@ -7991,7 +8188,7 @@ ${"─".repeat(60)}
|
|
|
7991
8188
|
}
|
|
7992
8189
|
|
|
7993
8190
|
// src/secrets.ts
|
|
7994
|
-
import { dirname as dirname6, relative as relative3, resolve } from "node:path";
|
|
8191
|
+
import { dirname as dirname6, relative as relative3, resolve as resolve2 } from "node:path";
|
|
7995
8192
|
var NAME_HINT = "upper snake case, e.g. OPENAI_API_KEY";
|
|
7996
8193
|
var hhmm2 = (iso) => `${iso.slice(0, 16).replace("T", " ")} UTC`;
|
|
7997
8194
|
function signInOf(config, credentials) {
|
|
@@ -8154,7 +8351,7 @@ async function secretsCommand(io, config, credentials, args) {
|
|
|
8154
8351
|
const file = args.options.file;
|
|
8155
8352
|
if (!file)
|
|
8156
8353
|
throw new UsageError("secrets export needs --file <path>, a file git ignores (e.g. .env.local)");
|
|
8157
|
-
const path =
|
|
8354
|
+
const path = resolve2(io.cwd, file);
|
|
8158
8355
|
const refusal = await exportRefusal(io, path);
|
|
8159
8356
|
if (refusal)
|
|
8160
8357
|
throw new UsageError(refusal, "a path git ignores, e.g. .env.local listed in .gitignore");
|
|
@@ -8208,6 +8405,11 @@ async function runCommand(io, config, credentials, args) {
|
|
|
8208
8405
|
|
|
8209
8406
|
// src/cli.ts
|
|
8210
8407
|
var COMMAND_HELP = {
|
|
8408
|
+
attach: ` attach <ticket> <file|url>... [--caption <text>] [--for <item>]
|
|
8409
|
+
Privately attach PNG, JPEG, WebP or GIF images (up to 2 MB each),
|
|
8410
|
+
or HTTPS links. Prints a dashboard URL for each attachment.
|
|
8411
|
+
--for keeps a free reference for an owner validation item
|
|
8412
|
+
`,
|
|
8211
8413
|
status: ` status Tickets in flight, tickets ready to start and pull requests waiting
|
|
8212
8414
|
status --all The same for every project registered by \`armada init\`
|
|
8213
8415
|
`,
|
|
@@ -8280,7 +8482,11 @@ var COMMAND_HELP = {
|
|
|
8280
8482
|
--no-ticket: a pull request no ticket owns (armada init, a release);
|
|
8281
8483
|
nothing is written to Linear.
|
|
8282
8484
|
`,
|
|
8283
|
-
|
|
8485
|
+
launch: ` launch revoke <ticket>
|
|
8486
|
+
Cancel the newest pending launch through Armada, including a worker
|
|
8487
|
+
signed in but not claimed. A claimed launch needs armada release instead
|
|
8488
|
+
`,
|
|
8489
|
+
brief: ` brief <ticket> [--profile <name> [--reason <why>]] [--prompt [--profile-line]]
|
|
8284
8490
|
A new worker's launch prompt, the Conductor profile (agent, model,
|
|
8285
8491
|
effort) and the environment variables to pass, named, never shown.
|
|
8286
8492
|
The profile follows [[conductor.routing]] on the ticket's labels, then
|
|
@@ -8288,6 +8494,8 @@ var COMMAND_HELP = {
|
|
|
8288
8494
|
--reason. Only projects without when fall back to default_profile.
|
|
8289
8495
|
Signed in to Armada, the prompt starts with a one-time launch token, so
|
|
8290
8496
|
the worker needs no key. --prompt prints only the prompt, for \`--message-file -\`
|
|
8497
|
+
Human and --json views mint nothing. --prompt --profile-line also
|
|
8498
|
+
prints the profile and its reason on stderr, leaving stdout unchanged
|
|
8291
8499
|
`,
|
|
8292
8500
|
secrets: ` secrets The project's secrets for workers: names, project or organization,
|
|
8293
8501
|
who set each and when; never a value. Needs a sign-in to Armada
|
|
@@ -8332,6 +8540,7 @@ var COMMAND_HELP = {
|
|
|
8332
8540
|
};
|
|
8333
8541
|
var TICKET_OPTION = new Set(["report", "release", "ask", "merge", "secrets", "run"]);
|
|
8334
8542
|
var CONFIG_OPTION = new Set([
|
|
8543
|
+
"attach",
|
|
8335
8544
|
"status",
|
|
8336
8545
|
"secrets",
|
|
8337
8546
|
"run",
|
|
@@ -8343,9 +8552,15 @@ var CONFIG_OPTION = new Set([
|
|
|
8343
8552
|
"watch",
|
|
8344
8553
|
"answer",
|
|
8345
8554
|
"merge",
|
|
8346
|
-
"brief"
|
|
8555
|
+
"brief",
|
|
8556
|
+
"launch"
|
|
8557
|
+
]);
|
|
8558
|
+
var JSON_OPTION = new Set([
|
|
8559
|
+
...[...CONFIG_OPTION].filter((c) => c !== "run" && c !== "attach"),
|
|
8560
|
+
"doctor",
|
|
8561
|
+
"auth",
|
|
8562
|
+
"whoami"
|
|
8347
8563
|
]);
|
|
8348
|
-
var JSON_OPTION = new Set([...[...CONFIG_OPTION].filter((c) => c !== "run"), "doctor", "auth", "whoami"]);
|
|
8349
8564
|
var TICKET_HELP = ` --ticket <id> Ticket for report, release and ask (default ARMADA_TICKET, then the git
|
|
8350
8565
|
branch) and for merge (default: the ticket the PR branch names)
|
|
8351
8566
|
`;
|
|
@@ -8421,13 +8636,16 @@ var VALUE_OPTIONS = [
|
|
|
8421
8636
|
"api-url",
|
|
8422
8637
|
"only",
|
|
8423
8638
|
"file",
|
|
8424
|
-
"from-env"
|
|
8639
|
+
"from-env",
|
|
8640
|
+
"caption",
|
|
8641
|
+
"for"
|
|
8425
8642
|
];
|
|
8426
8643
|
var FLAG_OPTIONS = [
|
|
8427
8644
|
"dry-run",
|
|
8428
8645
|
"no-lock",
|
|
8429
8646
|
"no-ticket",
|
|
8430
8647
|
"prompt",
|
|
8648
|
+
"profile-line",
|
|
8431
8649
|
"wait",
|
|
8432
8650
|
"note",
|
|
8433
8651
|
"api-key",
|
|
@@ -8436,6 +8654,7 @@ var FLAG_OPTIONS = [
|
|
|
8436
8654
|
"value-stdin"
|
|
8437
8655
|
];
|
|
8438
8656
|
var COMMAND_OPTIONS = {
|
|
8657
|
+
attach: ["caption", "for"],
|
|
8439
8658
|
claim: ["runtime", "handle", "branch", "profile", "reason"],
|
|
8440
8659
|
report: ["ticket", "message", "message-file", "plan", "plan-file", "pr", "sha"],
|
|
8441
8660
|
release: ["ticket", "reason"],
|
|
@@ -8444,7 +8663,7 @@ var COMMAND_OPTIONS = {
|
|
|
8444
8663
|
answer: ["note", "message", "message-file"],
|
|
8445
8664
|
init: ["program-root", "name", "slug", "no-stop-hook"],
|
|
8446
8665
|
merge: ["ticket", "no-ticket", "dry-run", "no-lock", "wait", "timeout"],
|
|
8447
|
-
brief: ["profile", "reason", "prompt"],
|
|
8666
|
+
brief: ["profile", "reason", "prompt", "profile-line"],
|
|
8448
8667
|
login: ["api-key", "launch-token", "api-url"],
|
|
8449
8668
|
secrets: ["ticket", "org", "value-stdin", "from-env", "file", "only"],
|
|
8450
8669
|
run: ["ticket", "only"]
|
|
@@ -8499,13 +8718,13 @@ function parseArgs(argv) {
|
|
|
8499
8718
|
}
|
|
8500
8719
|
async function findConfig(io, explicit, command = "status") {
|
|
8501
8720
|
if (explicit) {
|
|
8502
|
-
const path =
|
|
8721
|
+
const path = resolve3(io.cwd, explicit);
|
|
8503
8722
|
const text = await io.readFile(path);
|
|
8504
8723
|
if (text === null)
|
|
8505
8724
|
throw new UsageError(`${path} does not exist`, `armada ${command} --config <file>, with the path of an ${CONFIG_FILE}`);
|
|
8506
8725
|
return { path, text };
|
|
8507
8726
|
}
|
|
8508
|
-
for (let dir =
|
|
8727
|
+
for (let dir = resolve3(io.cwd);; dir = dirname7(dir)) {
|
|
8509
8728
|
const path = join6(dir, CONFIG_FILE);
|
|
8510
8729
|
const text = await io.readFile(path);
|
|
8511
8730
|
if (text !== null)
|
|
@@ -8617,6 +8836,15 @@ async function dispatch(argv, io) {
|
|
|
8617
8836
|
});
|
|
8618
8837
|
return await (args.command === "run" ? runCommand : secretsCommand)(io, config, credentials, args);
|
|
8619
8838
|
}
|
|
8839
|
+
if (args.command === "attach") {
|
|
8840
|
+
const { path, text } = await findConfig(io, args.config, "attach");
|
|
8841
|
+
const config = parseConfig(text, path);
|
|
8842
|
+
const { credentials } = await loadCredentials(io, {
|
|
8843
|
+
armada: false,
|
|
8844
|
+
worker: { command: "attach", project: config.project.slug, ticket: () => args.rest[0]?.toUpperCase() ?? null }
|
|
8845
|
+
});
|
|
8846
|
+
return await attachCommand(io, config, credentials, args);
|
|
8847
|
+
}
|
|
8620
8848
|
const worker = { claim, report, release, ask, inbox: inbox2, answer }[args.command];
|
|
8621
8849
|
if (worker) {
|
|
8622
8850
|
const { path, text } = await findConfig(io, args.config, args.command);
|
|
@@ -8652,9 +8880,16 @@ async function dispatch(argv, io) {
|
|
|
8652
8880
|
const { path, text } = await findConfig(io, args.config, "brief");
|
|
8653
8881
|
const config = parseConfig(text, path);
|
|
8654
8882
|
const { credentials } = await loadCredentials(io, { project: config.project.slug });
|
|
8655
|
-
|
|
8883
|
+
if (args.options.prompt === "true")
|
|
8884
|
+
await recordPresence(io, config, credentials);
|
|
8656
8885
|
return await brief2(io, config, credentials, args, version, path);
|
|
8657
8886
|
}
|
|
8887
|
+
if (args.command === "launch") {
|
|
8888
|
+
const { path, text } = await findConfig(io, args.config, "launch");
|
|
8889
|
+
const config = parseConfig(text, path);
|
|
8890
|
+
const { credentials } = await loadCredentials(io, { project: config.project.slug });
|
|
8891
|
+
return await launch(io, config, credentials, args);
|
|
8892
|
+
}
|
|
8658
8893
|
if (args.command === "status") {
|
|
8659
8894
|
noExtra(args.rest);
|
|
8660
8895
|
return await (args.all ? statusAll(io, args.json) : status2(io, args));
|
|
@@ -8857,6 +9092,35 @@ var code = await run(process.argv.slice(2), {
|
|
|
8857
9092
|
throw err;
|
|
8858
9093
|
}),
|
|
8859
9094
|
stdout: (t) => process.stdout.write(t),
|
|
9095
|
+
readBinaryFile: async (path, maxBytes) => {
|
|
9096
|
+
const file = await open2(path, "r").catch((err) => {
|
|
9097
|
+
if (err.code === "ENOENT" || err.code === "ENOTDIR")
|
|
9098
|
+
return null;
|
|
9099
|
+
throw err;
|
|
9100
|
+
});
|
|
9101
|
+
if (!file)
|
|
9102
|
+
return null;
|
|
9103
|
+
try {
|
|
9104
|
+
const stat = await file.stat();
|
|
9105
|
+
if (!stat.isFile())
|
|
9106
|
+
throw new UsageError("attachment must be a regular image file");
|
|
9107
|
+
if (stat.size > maxBytes)
|
|
9108
|
+
throw new UsageError("attachment size limit: images must be at most 2 MB each");
|
|
9109
|
+
const buffer = Buffer.alloc(maxBytes + 1);
|
|
9110
|
+
let size = 0;
|
|
9111
|
+
while (size < buffer.length) {
|
|
9112
|
+
const { bytesRead } = await file.read(buffer, size, buffer.length - size, null);
|
|
9113
|
+
if (!bytesRead)
|
|
9114
|
+
break;
|
|
9115
|
+
size += bytesRead;
|
|
9116
|
+
}
|
|
9117
|
+
if (size > maxBytes)
|
|
9118
|
+
throw new UsageError("attachment size limit: images must be at most 2 MB each");
|
|
9119
|
+
return buffer.subarray(0, size);
|
|
9120
|
+
} finally {
|
|
9121
|
+
await file.close();
|
|
9122
|
+
}
|
|
9123
|
+
},
|
|
8860
9124
|
stderr: (t) => process.stderr.write(t),
|
|
8861
9125
|
ghToken,
|
|
8862
9126
|
interactive: isatty(0) && isatty(2),
|