@the-vibe-company/armada 0.2.9 → 0.2.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 +6 -3
- package/dist/armada.js +235 -41
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,6 +35,7 @@ Workers then need no key either: each one's launch message carries a one-time to
|
|
|
35
35
|
`armada status` reads the `armada.toml` of the current repository (or the nearest parent directory) and prints:
|
|
36
36
|
|
|
37
37
|
- **In flight**: tickets an agent holds, with their phase, runtime, last report and pull request. A worker with no report (an `armada report` event recorded through Armada, an `Agent status:` comment or its claim) for longer than `policy.silence_minutes` is flagged `silent`, unless it is waiting on a human (`awaiting-approval`, `blocked`, `ready-to-merge`). A ticket that never had a report falls back to its last sign of life (ticket edit, comment or pull request update).
|
|
38
|
+
- **Launched, not started**: signed in to Armada, the workers launched with a launch token that have not claimed their ticket after `policy.not_started_minutes`, each saying whether the token was never used (the worker never reached its `armada login` line) or used without a claim.
|
|
38
39
|
- **Ready to start**: tickets without sub-issues that are not started, not held by an agent, have no open pull request, and whose blocked-by tickets are all closed, ranked by what they unlock. Tickets without the ready label, or still in triage, are listed separately.
|
|
39
40
|
- **Pull requests waiting**: open pull requests with their CI state and mergeability.
|
|
40
41
|
|
|
@@ -84,7 +85,8 @@ armada brief ABC-12 --profile codex --reason "a back-end bug behind a web label"
|
|
|
84
85
|
- 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.
|
|
85
86
|
- **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`.
|
|
86
87
|
- **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.
|
|
87
|
-
- **Workers need no key.** When the coordinator is signed in to an Armada that keeps the organization's keys, the brief asks it for a launch token: one ticket, used once, valid one hour. The worker exchanges it for a session limited to its ticket's `claim`, `report`, `ask` and `release`, and Armada gives each of those commands its keys. The `Launch:` line says whether the prompt carries one, and when there is none, why (not signed in, or an Armada without accounts or keys). Only `--prompt` prints the token; the full brief and `--json` show it as `armada_launch_••••`, so it stays out of the coordinator's transcript. Make the brief right before the launch; the token is the only secret a prompt ever holds, useless once used.
|
|
88
|
+
- **Workers need no key.** When the coordinator is signed in to an Armada that keeps the organization's keys, the brief asks it for a launch token: one ticket, used once, valid one hour. The worker exchanges it for a session limited to its ticket's `claim`, `report`, `ask` and `release`, and Armada gives each of those commands its keys. The `Launch:` line says whether the prompt carries one, and when there is none, why (not signed in, or an Armada without accounts or keys). Only `--prompt` prints the token; the full brief and `--json` show it as `armada_launch_••••`, so it stays out of the coordinator's transcript. Make the brief right before the launch; the token is the only secret a prompt ever holds, useless once used. The launch message is the `--prompt` output only: a worker given the masked token is told so by `armada login`.
|
|
89
|
+
- **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.
|
|
88
90
|
- 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.
|
|
89
91
|
- 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.
|
|
90
92
|
- The profile follows the ticket's Linear labels: the first `[[conductor.routing]]` rule with a label the ticket carries (case, spaces and punctuation ignored), else `conductor.default_profile`, else the only profile. The settings say which rule chose it.
|
|
@@ -129,7 +131,7 @@ armada answer --note ABC-12 "main moved: bring it in before you ship" # an unso
|
|
|
129
131
|
|
|
130
132
|
- `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 on Armada. The worker then stops and waits for the answer in its session, and reports the phase it resumes. It finds the ticket like `report`.
|
|
131
133
|
- `report awaiting-approval` adds a `plan` item with the full message (and the `--plan` block) and worker handle to the coordinator's inbox. Same-phase heartbeats neither duplicate nor reopen it. Answering it, recording a note, leaving the phase or releasing the ticket closes the plan and any pending approval request. For a pre-approved plan (the brief's "Plan" line says which), post the plan with `report implementing --plan-file -` instead: no approval item is needed.
|
|
132
|
-
- `inbox` lists the coordinator's open items (questions, plans, requests, hand-backs) and
|
|
134
|
+
- `inbox` lists the coordinator's open items (questions, plans, requests, hand-backs), silent workers and workers that never started, oldest first. A worker never started (`not-started`) was launched with a launch token and has not claimed its ticket after `policy.not_started_minutes`; the entry says whether the token was never used or used without a claim, names the worker's session when its sign-in gave one, and clears on the claim, when the launch ends (release, merge, revoke) or when a newer launch of the ticket replaces it. A launch on a ticket a session still holds is not followed (a brief made to read a running worker's prompt again launches nobody; a relaunch releases the old claim first). A launched worker counts as in flight from its launch until it shows as not started, so `armada watch` waits for its claim; past that, its entry carries it. A worker is silent when it holds a ticket, its newest event is older than `policy.silence_minutes`, and its phase does not wait on someone else. It reads Armada only (a sign-in, no Linear key) and records that the coordinator is at work, for the dashboard. `--wait` asks Armada every 15 s until `--timeout`; Armada answers "not modified" (HTTP 304, no body) while the inbox holds the same entries, so a waiting coordinator costs one short request per ask and holds nothing open. It marks the items that were not there before with `*`; loop on it. A hand-back handed back again on a new head (or a plan rewritten in place) counts as new.
|
|
133
135
|
- `watch` is how a coordinator keeps listening, run in the background while a worker is in flight. It asks Armada like `inbox --wait` (every 15 s, every 60 s when no worker is in flight, 304 while nothing changed) with no time limit of its own, and exits as soon as something needs the coordinator that it has not been shown yet by `inbox` or `watch` on this machine: it prints the inbox, new items marked `*`. It exits with "nothing to watch" when no worker is in flight and nothing is open. Armada unreachable or answering 5xx only prints a warning and it keeps going, waiting longer each time; a refusal (signed out) ends it. One watch per project and machine: a second one says the first is running. Its state (a lock, the entries shown, the tickets in flight at the last read, the checkout it ran in) lives in `~/.config/armada/watch/`, no secret.
|
|
134
136
|
- The last line of `inbox`, `watch`, `merge` and `brief` (not `brief --prompt`) says whether to start watching again, for example `2 workers in flight (ABC-1, ABC-2) — keep watching: armada watch`; with `--json`, the same is the `watch` field.
|
|
135
137
|
- `armada hook stop` is the Claude Code Stop hook `armada init` adds to `.claude/settings.json` (it asks; `--no-stop-hook` leaves it out; `armada doctor` shows it). It reads only armada.toml and the watch state, so it answers at once without the network. It refuses to end the turn, and tells the agent to start `armada watch` in the background, only in the checkout where `armada watch` ran (never a worker's), while the last read had workers in flight and no watch runs. A watch that ended on a refusal lets the turn end, and `ARMADA_STOP_HOOK=off` turns the hook off.
|
|
@@ -163,7 +165,7 @@ armada merge 35 --no-ticket # a pull request no ticket owns: armada init's, a re
|
|
|
163
165
|
|
|
164
166
|
`packages/dashboard` is a Next.js app whose main page is the Fleet of the projects registered in its database. With accounts, each person sees the projects of their organization; under the shared password, every project.
|
|
165
167
|
|
|
166
|
-
- **Waiting for you** comes first, across projects. It lists questions, blocked workers, plans to approve, hand-backs and silent workers, the most urgent first.
|
|
168
|
+
- **Waiting for you** comes first, across projects. It lists questions, blocked workers, plans to approve, hand-backs, workers launched that never started and silent workers, the most urgent first.
|
|
167
169
|
- **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).
|
|
168
170
|
- A filter shows one project. Each project shows whether its coordinator is active, from its last inbox read.
|
|
169
171
|
- **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 signed-in person's name and address (with accounts) or with the name the viewer gives (under the shared password; remembered in a cookie, default `ARMADA_DASHBOARD_AUTHOR`), and shows as pending until the coordinator carries it out. The dashboard holds no runtime credential.
|
|
@@ -389,6 +391,7 @@ local_commands = ["npm ci", "npm test"] # run by `armada merge` on a test merge
|
|
|
389
391
|
[policy]
|
|
390
392
|
silence_minutes = 15 # a worker with no report for longer is flagged silent (default 15)
|
|
391
393
|
coordinator_minutes = 10 # an inbox item open longer shows "waiting for the coordinator" (default 10)
|
|
394
|
+
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)
|
|
392
395
|
plans = "approve" # or "pre-approved": workers post their plan and go on (default "approve")
|
|
393
396
|
pre_approved_label = "plan-approved" # a ticket with this label is pre-approved (default)
|
|
394
397
|
approval_label = "needs-plan-approval" # a ticket with this label waits for approval; wins over the other (default)
|
package/dist/armada.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { spawn as spawn2, spawnSync } from "node:child_process";
|
|
5
5
|
import { createReadStream } from "node:fs";
|
|
6
6
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
7
|
+
import { hostname as hostname2 } from "node:os";
|
|
7
8
|
import { isatty } from "node:tty";
|
|
8
9
|
|
|
9
10
|
// src/cli.ts
|
|
@@ -319,6 +320,12 @@ var CHANGED_COMMENTS_QUERY = `
|
|
|
319
320
|
}`;
|
|
320
321
|
|
|
321
322
|
// ../core/src/armada-api.ts
|
|
323
|
+
var MASKED_LAUNCH_TOKEN = "armada_launch_••••";
|
|
324
|
+
var isMaskedLaunchToken = (token) => token.includes("•");
|
|
325
|
+
var MASKED_LAUNCH_TOKEN_REFUSAL = {
|
|
326
|
+
error: "this is the masked token from `armada brief`'s human view, not a launch token",
|
|
327
|
+
next: "ask the coordinator for the `armada brief <ticket> --prompt` text: only it carries the token"
|
|
328
|
+
};
|
|
322
329
|
var displayCode = (code) => code.length === 8 ? `${code.slice(0, 4)}-${code.slice(4)}` : code;
|
|
323
330
|
var CLI_PACKAGE = "@the-vibe-company/armada";
|
|
324
331
|
var CLI_VERSION_HEADER = "x-armada-cli-version";
|
|
@@ -567,8 +574,10 @@ function armadaApi(opts) {
|
|
|
567
574
|
throw new ArmadaApiError(`Armada (${host}) answered the launch token in a shape this CLI does not know`);
|
|
568
575
|
return body;
|
|
569
576
|
},
|
|
570
|
-
async exchangeLaunchToken(token) {
|
|
571
|
-
const { status, body } = await call("POST", "launch-tokens/exchange", {
|
|
577
|
+
async exchangeLaunchToken(token, handle = null) {
|
|
578
|
+
const { status, body } = await call("POST", "launch-tokens/exchange", {
|
|
579
|
+
body: handle ? { token, handle } : { token }
|
|
580
|
+
});
|
|
572
581
|
if (status !== 200)
|
|
573
582
|
throw refusal(status, body, null);
|
|
574
583
|
const w = body.worker;
|
|
@@ -1905,6 +1914,7 @@ var CONFIG_DEFAULTS = {
|
|
|
1905
1914
|
runtimes: ["Claude Code", "Codex", "Conductor"],
|
|
1906
1915
|
silentAfterMinutes: 15,
|
|
1907
1916
|
coordinatorMinutes: 10,
|
|
1917
|
+
notStartedMinutes: 10,
|
|
1908
1918
|
plans: "approve",
|
|
1909
1919
|
preApprovedLabel: "plan-approved",
|
|
1910
1920
|
approvalLabel: "needs-plan-approval"
|
|
@@ -2019,6 +2029,7 @@ function parseConfig(text, source = CONFIG_FILE) {
|
|
|
2019
2029
|
"silence_minutes",
|
|
2020
2030
|
"silent_after_minutes",
|
|
2021
2031
|
"coordinator_minutes",
|
|
2032
|
+
"not_started_minutes",
|
|
2022
2033
|
"plans",
|
|
2023
2034
|
"pre_approved_label",
|
|
2024
2035
|
"approval_label"
|
|
@@ -2116,6 +2127,14 @@ function parseConfig(text, source = CONFIG_FILE) {
|
|
|
2116
2127
|
else
|
|
2117
2128
|
problems.push(`"policy.coordinator_minutes" must be a positive number`);
|
|
2118
2129
|
}
|
|
2130
|
+
let notStartedMinutes = CONFIG_DEFAULTS.notStartedMinutes;
|
|
2131
|
+
if (policyT.not_started_minutes !== undefined) {
|
|
2132
|
+
const v = policyT.not_started_minutes;
|
|
2133
|
+
if (typeof v === "number" && Number.isFinite(v) && v > 0)
|
|
2134
|
+
notStartedMinutes = v;
|
|
2135
|
+
else
|
|
2136
|
+
problems.push(`"policy.not_started_minutes" must be a positive number`);
|
|
2137
|
+
}
|
|
2119
2138
|
let plans = CONFIG_DEFAULTS.plans;
|
|
2120
2139
|
if (policyT.plans !== undefined) {
|
|
2121
2140
|
const v = policyT.plans;
|
|
@@ -2182,7 +2201,7 @@ function parseConfig(text, source = CONFIG_FILE) {
|
|
|
2182
2201
|
repository: str(github, "github", "repository", { pattern: REPOSITORY, hint: "owner/name" })
|
|
2183
2202
|
},
|
|
2184
2203
|
gates: { requiredChecks, localCommands },
|
|
2185
|
-
policy: { silentAfterMinutes, coordinatorMinutes, plans, preApprovedLabel, approvalLabel },
|
|
2204
|
+
policy: { silentAfterMinutes, coordinatorMinutes, notStartedMinutes, plans, preApprovedLabel, approvalLabel },
|
|
2186
2205
|
brief: { extra },
|
|
2187
2206
|
secrets: { names: secretNames },
|
|
2188
2207
|
conductor: { defaultProfile, profiles, routing }
|
|
@@ -2220,6 +2239,7 @@ repository = ${q(p.repository)}
|
|
|
2220
2239
|
[policy]
|
|
2221
2240
|
silence_minutes = 15 # a worker with no report for longer than this shows as silent
|
|
2222
2241
|
coordinator_minutes = 10 # an inbox item open longer than this shows "waiting for the coordinator"
|
|
2242
|
+
# not_started_minutes = 10 # a launched worker that has not claimed after this long shows as not started
|
|
2223
2243
|
# plans = "approve" # or "pre-approved": workers post their plan and go on without waiting
|
|
2224
2244
|
# pre_approved_label = "plan-approved" # a ticket with this label skips the approval
|
|
2225
2245
|
# approval_label = "needs-plan-approval" # a ticket with this label waits for it; wins over the other
|
|
@@ -2753,6 +2773,27 @@ async function releaseTicket(ctx, input) {
|
|
|
2753
2773
|
|
|
2754
2774
|
// ../core/src/brief.ts
|
|
2755
2775
|
var ARMADA_PACKAGE = "@the-vibe-company/armada";
|
|
2776
|
+
var NPM_REGISTRY_URL = `https://registry.npmjs.org/${ARMADA_PACKAGE.replace("/", "%2f")}`;
|
|
2777
|
+
var NPM_CHECK_MS = 3000;
|
|
2778
|
+
async function checkPublished(version, fetch2, timeoutMs = NPM_CHECK_MS) {
|
|
2779
|
+
try {
|
|
2780
|
+
const res = await fetch2(NPM_REGISTRY_URL, {
|
|
2781
|
+
headers: { accept: "application/vnd.npm.install-v1+json" },
|
|
2782
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
2783
|
+
});
|
|
2784
|
+
if (!res.ok)
|
|
2785
|
+
return { state: "unknown", reason: `npm answered HTTP ${res.status}` };
|
|
2786
|
+
const versions = Object.keys((await res.json()).versions ?? {});
|
|
2787
|
+
if (!versions.length)
|
|
2788
|
+
return { state: "unknown", reason: "npm listed no version" };
|
|
2789
|
+
if (versions.includes(version))
|
|
2790
|
+
return { state: "published" };
|
|
2791
|
+
const older = versions.filter((v) => !v.includes("-") && compareVersions(v, version) < 0).sort(compareVersions);
|
|
2792
|
+
return { state: "missing", newest: older.at(-1) ?? null };
|
|
2793
|
+
} catch (err) {
|
|
2794
|
+
return { state: "unknown", reason: networkReason(err, timeoutMs) };
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2756
2797
|
var WORKER_SKILL_PATH = ".agents/skills/armada-worker/SKILL.md";
|
|
2757
2798
|
var CONDUCTOR_HANDLE = '"$CONDUCTOR_WORKSPACE_ID/$CONDUCTOR_SESSION_ID"';
|
|
2758
2799
|
var subagentName = (ticket) => ticket.toLowerCase();
|
|
@@ -2876,7 +2917,8 @@ function buildBrief(input) {
|
|
|
2876
2917
|
branch: l.claim?.branch ?? null,
|
|
2877
2918
|
pr: l.pr?.url ?? null
|
|
2878
2919
|
}));
|
|
2879
|
-
const
|
|
2920
|
+
const pinned = npmPin(input.version, input.npm ?? null, warnings);
|
|
2921
|
+
const pkg = `${ARMADA_PACKAGE}@${pinned}`;
|
|
2880
2922
|
const branch = ticket.branchName;
|
|
2881
2923
|
const runtime = choice?.profile.runtime ?? "conductor";
|
|
2882
2924
|
const handle = runtime === "claude-code" ? subagentName(ticket.id) : CONDUCTOR_HANDLE;
|
|
@@ -2926,6 +2968,7 @@ function buildBrief(input) {
|
|
|
2926
2968
|
profile: choice ? { name: choice.name, ...choice.profile } : null,
|
|
2927
2969
|
routing: choice ? { source: choice.source, rule: choice.rule, routed: choice.routed, reason: choice.reason, why: choice.why } : null,
|
|
2928
2970
|
repository: { name: config.github.repository, url: `https://github.com/${config.github.repository}` },
|
|
2971
|
+
armadaVersion: { pinned, coordinator: input.version },
|
|
2929
2972
|
install: `npm install -g ${pkg}`,
|
|
2930
2973
|
fallback: `npm exec --yes --package=${pkg} -- armada`,
|
|
2931
2974
|
claimCommand,
|
|
@@ -2946,6 +2989,20 @@ function buildBrief(input) {
|
|
|
2946
2989
|
warnings.push(`${ticket.id} has ${ticket.notes.length} comments; the brief carries the newest ${MAX_NOTES}`);
|
|
2947
2990
|
return { ...brief, prompt: renderPrompt(brief) };
|
|
2948
2991
|
}
|
|
2992
|
+
function npmPin(version, npm, warnings) {
|
|
2993
|
+
if (!npm || npm.state === "published")
|
|
2994
|
+
return version;
|
|
2995
|
+
if (npm.state === "unknown") {
|
|
2996
|
+
warnings.push(`could not check that armada ${version} is on npm (${npm.reason}); if it is not published yet, the worker's install fails`);
|
|
2997
|
+
return version;
|
|
2998
|
+
}
|
|
2999
|
+
if (!npm.newest) {
|
|
3000
|
+
warnings.push(`armada ${version} is not on npm, nor any older version: the worker's install and its fallback line fail until it is published`);
|
|
3001
|
+
return version;
|
|
3002
|
+
}
|
|
3003
|
+
warnings.push(`armada ${version} is not on npm yet: this brief pins ${npm.newest}, the newest published version. The skills of this checkout may describe commands ${npm.newest} lacks; publish ${version} (the release pull request) and brief again to launch with it`);
|
|
3004
|
+
return npm.newest;
|
|
3005
|
+
}
|
|
2949
3006
|
var shellWord = (s) => /^\w[\w./:@+-]*$/.test(s) ? s : `'${s.replaceAll("'", `'\\''`)}'`;
|
|
2950
3007
|
var quote = (body) => body.trim().split(`
|
|
2951
3008
|
`).map((l) => l ? `> ${l}` : ">").join(`
|
|
@@ -2973,7 +3030,7 @@ function renderPrompt(b) {
|
|
|
2973
3030
|
b.claimCommand,
|
|
2974
3031
|
"```",
|
|
2975
3032
|
"",
|
|
2976
|
-
|
|
3033
|
+
`${b.armadaVersion.pinned === b.armadaVersion.coordinator ? "This installs the coordinator's Armada version." : `This installs Armada ${b.armadaVersion.pinned}, the newest on npm (the coordinator runs ${b.armadaVersion.coordinator}, not published yet).`} If the global install is refused, use \`${b.fallback}\` wherever this brief or the skill says \`armada\`.`,
|
|
2977
3034
|
...b.launch ? [
|
|
2978
3035
|
"",
|
|
2979
3036
|
`\`armada login --launch-token\` signs this workspace in to Armada as the worker of ${t.id}, with a one-time token valid until ${b.launch.expiresAt.slice(0, 16).replace("T", " ")} UTC. Run it first, once.`
|
|
@@ -3033,9 +3090,10 @@ async function loadBrief(config, opts) {
|
|
|
3033
3090
|
throw new BriefError(err.message);
|
|
3034
3091
|
throw err;
|
|
3035
3092
|
}
|
|
3036
|
-
const [ticket, program] = await Promise.all([
|
|
3093
|
+
const [ticket, program, npm] = await Promise.all([
|
|
3037
3094
|
fetchBriefTicket(linear, opts.ticket),
|
|
3038
|
-
fetchProgram({ ...linear, rootId: config.tracker.programRoot, labels: config.tracker.labels, now })
|
|
3095
|
+
fetchProgram({ ...linear, rootId: config.tracker.programRoot, labels: config.tracker.labels, now }),
|
|
3096
|
+
opts.npm?.(opts.version) ?? null
|
|
3039
3097
|
]);
|
|
3040
3098
|
if (!ticket)
|
|
3041
3099
|
throw new Refusal(`ticket ${opts.ticket} not found in Linear`, "armada status, to see the tickets of the program");
|
|
@@ -3052,6 +3110,7 @@ async function loadBrief(config, opts) {
|
|
|
3052
3110
|
profile: opts.profile,
|
|
3053
3111
|
reason: opts.reason ?? null,
|
|
3054
3112
|
version: opts.version,
|
|
3113
|
+
npm,
|
|
3055
3114
|
env: opts.env,
|
|
3056
3115
|
...opts.stored ? { stored: opts.stored } : {},
|
|
3057
3116
|
launch: made,
|
|
@@ -3285,14 +3344,29 @@ function updateDotenv(text, updates) {
|
|
|
3285
3344
|
` : "";
|
|
3286
3345
|
}
|
|
3287
3346
|
// ../core/src/live.ts
|
|
3288
|
-
|
|
3347
|
+
import { createHash } from "node:crypto";
|
|
3348
|
+
var LAUNCH_WINDOW_MS = 24 * 60 * 60000;
|
|
3349
|
+
var MIN2 = 60000;
|
|
3350
|
+
var REWRITTEN = ["hand-back", "plan"];
|
|
3351
|
+
var digest = (text) => createHash("sha256").update(text).digest("base64url").slice(0, 12);
|
|
3352
|
+
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}`;
|
|
3353
|
+
var hhmm = (iso) => `${iso.slice(11, 16)} UTC`;
|
|
3354
|
+
function notStartedBody(l, now) {
|
|
3355
|
+
const minutes = Math.floor((now.getTime() - Date.parse(l.launchedAt)) / MIN2);
|
|
3356
|
+
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)";
|
|
3357
|
+
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 the launch on the dashboard's Workers page`;
|
|
3358
|
+
}
|
|
3359
|
+
var notStartedLaunches = (launches, now, minutes) => launches.filter((l) => now.getTime() - Date.parse(l.launchedAt) > minutes * MIN2);
|
|
3289
3360
|
|
|
3290
3361
|
// ../core/src/fleet-api.ts
|
|
3291
3362
|
var WORKER_FLEET_OPS = ["claim", "report", "ask", "release"];
|
|
3292
3363
|
var FLEET_OPS = [
|
|
3293
3364
|
...WORKER_FLEET_OPS,
|
|
3294
3365
|
"register",
|
|
3366
|
+
"coordinator",
|
|
3367
|
+
"request",
|
|
3295
3368
|
"events/latest",
|
|
3369
|
+
"launches",
|
|
3296
3370
|
"inbox",
|
|
3297
3371
|
"inbox/item",
|
|
3298
3372
|
"inbox/ticket",
|
|
@@ -3309,10 +3383,15 @@ var CALL_TIMEOUT_MS = 15000;
|
|
|
3309
3383
|
function fleetClient(o) {
|
|
3310
3384
|
const call = async (op, input) => await o.api.fleet(o.signIn, op, { project: o.project, input }, CALL_TIMEOUT_MS);
|
|
3311
3385
|
return {
|
|
3386
|
+
coordinator: (facts) => call("coordinator", facts).then(() => {
|
|
3387
|
+
return;
|
|
3388
|
+
}),
|
|
3389
|
+
request: (input) => call("request", input),
|
|
3312
3390
|
register: () => call("register", {}).then(() => {
|
|
3313
3391
|
return;
|
|
3314
3392
|
}),
|
|
3315
3393
|
lastEventTimes: () => call("events/latest", {}),
|
|
3394
|
+
pendingLaunches: () => call("launches", {}),
|
|
3316
3395
|
claim: (c) => call("claim", c),
|
|
3317
3396
|
report: (r) => call("report", r),
|
|
3318
3397
|
ask: (q) => call("ask", q),
|
|
@@ -3370,13 +3449,19 @@ function normalizePull(raw, repo) {
|
|
|
3370
3449
|
const status = raw.commits.nodes[0]?.commit.statusCheckRollup ?? null;
|
|
3371
3450
|
const checks = status?.contexts.nodes.map((c) => c.__typename === "CheckRun" ? { name: c.name, state: checkState(c.status, c.conclusion) } : { name: c.context, state: checkState("", c.state) });
|
|
3372
3451
|
return {
|
|
3452
|
+
files: raw.files?.nodes ?? null,
|
|
3453
|
+
additions: raw.additions ?? null,
|
|
3454
|
+
deletions: raw.deletions ?? null,
|
|
3455
|
+
filesComplete: !!raw.files && !raw.files.pageInfo.hasNextPage,
|
|
3456
|
+
checksComplete: !status || status.contexts.pageInfo?.hasNextPage === false,
|
|
3457
|
+
mergeability: raw.mergeable === "CONFLICTING" || raw.mergeStateStatus === "DIRTY" ? "conflicting" : raw.mergeStateStatus === "BEHIND" ? "behind" : raw.mergeable === "MERGEABLE" ? "clean" : "unknown",
|
|
3373
3458
|
url: raw.url,
|
|
3374
3459
|
number: raw.number,
|
|
3375
3460
|
repo,
|
|
3376
3461
|
title: raw.title,
|
|
3377
3462
|
state: raw.state === "OPEN" ? "open" : raw.state === "MERGED" ? "merged" : "closed",
|
|
3378
3463
|
draft: raw.isDraft,
|
|
3379
|
-
ci: checks ? rollup(checks.map((c) => c.state)) : "none",
|
|
3464
|
+
ci: status?.contexts.pageInfo?.hasNextPage ? checkState("", status.state) : checks ? rollup(checks.map((c) => c.state)) : "none",
|
|
3380
3465
|
checks: checks ?? [],
|
|
3381
3466
|
mergeable: raw.mergeable,
|
|
3382
3467
|
headRef: raw.headRefName,
|
|
@@ -3388,8 +3473,9 @@ function normalizePull(raw, repo) {
|
|
|
3388
3473
|
}
|
|
3389
3474
|
var PULL_FIELDS = `
|
|
3390
3475
|
fragment P on PullRequest {
|
|
3391
|
-
number title url state isDraft mergeable headRefName headRefOid createdAt updatedAt mergedAt
|
|
3392
|
-
|
|
3476
|
+
number title url state isDraft mergeable mergeStateStatus headRefName headRefOid createdAt updatedAt mergedAt additions deletions
|
|
3477
|
+
files(first: 100) { nodes { path additions deletions } pageInfo { hasNextPage } }
|
|
3478
|
+
commits(last: 1) { nodes { commit { statusCheckRollup { state contexts(first: 50) { pageInfo { hasNextPage } nodes {
|
|
3393
3479
|
__typename
|
|
3394
3480
|
... on CheckRun { name status conclusion }
|
|
3395
3481
|
... on StatusContext { context state }
|
|
@@ -3447,7 +3533,13 @@ async function fetchForge(opts) {
|
|
|
3447
3533
|
repo: opts.repository,
|
|
3448
3534
|
fetchedAt: (opts.now?.() ?? new Date).toISOString(),
|
|
3449
3535
|
prs: [...repo.open.nodes, ...repo.closed.nodes].map((p) => normalizePull(p, opts.repository)),
|
|
3450
|
-
warnings:
|
|
3536
|
+
warnings: [
|
|
3537
|
+
...repo.open.pageInfo?.hasNextPage ? ["more than 100 open pull requests; the least recently updated are ignored"] : [],
|
|
3538
|
+
...repo.open.nodes.flatMap((pr) => [
|
|
3539
|
+
...pr.files?.pageInfo.hasNextPage ? [`PR #${pr.number}: changed files are incomplete (first 100)`] : [],
|
|
3540
|
+
...pr.commits.nodes[0]?.commit.statusCheckRollup?.contexts.pageInfo?.hasNextPage ? [`PR #${pr.number}: checks are incomplete (first 50)`] : []
|
|
3541
|
+
])
|
|
3542
|
+
]
|
|
3451
3543
|
};
|
|
3452
3544
|
}
|
|
3453
3545
|
function attachPullRequests(program, forge) {
|
|
@@ -3602,7 +3694,12 @@ async function askCoordinator(ctx, input) {
|
|
|
3602
3694
|
var INBOX_POLL_MS = 15000;
|
|
3603
3695
|
async function checkInbox(fleet, o) {
|
|
3604
3696
|
const started = o.now();
|
|
3605
|
-
const query = {
|
|
3697
|
+
const query = {
|
|
3698
|
+
coordinator: o.coordinator ?? null,
|
|
3699
|
+
silentAfterMinutes: o.silentAfterMinutes,
|
|
3700
|
+
...o.facts ? { facts: o.facts } : {},
|
|
3701
|
+
...o.notStartedMinutes !== undefined ? { notStartedMinutes: o.notStartedMinutes } : {}
|
|
3702
|
+
};
|
|
3606
3703
|
const first = await fleet.inbox({ ...query, etag: null });
|
|
3607
3704
|
if (!first)
|
|
3608
3705
|
throw new Error("Armada answered the first inbox read with nothing");
|
|
@@ -3651,7 +3748,16 @@ function statusComment(phase, word, text, ref) {
|
|
|
3651
3748
|
|
|
3652
3749
|
${detail}` : line;
|
|
3653
3750
|
}
|
|
3654
|
-
var ANSWERABLE = [
|
|
3751
|
+
var ANSWERABLE = [
|
|
3752
|
+
"question",
|
|
3753
|
+
"plan",
|
|
3754
|
+
"request",
|
|
3755
|
+
"answer-request",
|
|
3756
|
+
"launch-request",
|
|
3757
|
+
"merge-request",
|
|
3758
|
+
"release-request",
|
|
3759
|
+
"plan-changes"
|
|
3760
|
+
];
|
|
3655
3761
|
async function answerItem(ctx, input) {
|
|
3656
3762
|
const { config, linear } = ctx;
|
|
3657
3763
|
const project = config.project.slug;
|
|
@@ -3688,6 +3794,10 @@ async function answerItem(ctx, input) {
|
|
|
3688
3794
|
}
|
|
3689
3795
|
if (item?.kind === "launch-request")
|
|
3690
3796
|
return declineLaunch(ctx, item, text, warnings);
|
|
3797
|
+
if (item && ["merge-request", "release-request", "plan-changes"].includes(item.kind)) {
|
|
3798
|
+
const recorded = await live(ctx, warnings, "resolve the dashboard request", (fleet) => fleet.answer({ text, note: false, ticket: item.ticket, item: item.id }));
|
|
3799
|
+
return { ticket: item.ticket ?? `#${item.id}`, url: "", lines: recorded ? [recorded] : [], warnings, inbox: null };
|
|
3800
|
+
}
|
|
3691
3801
|
const question = item?.kind === "answer-request" ? item.request?.question ?? null : null;
|
|
3692
3802
|
const answered = question === null ? item : await live(ctx, warnings, `read the item answered by #${item?.id}`, (fleet) => fleet.inboxItem(question));
|
|
3693
3803
|
const answerKind = answered?.kind === "plan" ? "plan" : "question";
|
|
@@ -3971,7 +4081,12 @@ function transientFailure(err) {
|
|
|
3971
4081
|
return /\bunreachable\b|\bHTTP (?:5\d\d|408|429) without JSON\b/.test(err.message);
|
|
3972
4082
|
}
|
|
3973
4083
|
async function watchInbox(fleet, o) {
|
|
3974
|
-
const query = {
|
|
4084
|
+
const query = {
|
|
4085
|
+
coordinator: o.coordinator,
|
|
4086
|
+
silentAfterMinutes: o.silentAfterMinutes,
|
|
4087
|
+
...o.facts ? { facts: o.facts } : {},
|
|
4088
|
+
...o.notStartedMinutes !== undefined ? { notStartedMinutes: o.notStartedMinutes } : {}
|
|
4089
|
+
};
|
|
3975
4090
|
const pollMs = o.pollMs ?? WATCH_POLL_MS;
|
|
3976
4091
|
const idlePollMs = o.idlePollMs ?? WATCH_IDLE_POLL_MS;
|
|
3977
4092
|
let known = new Set(o.seen);
|
|
@@ -4994,7 +5109,7 @@ async function readProjectConfig(p, opts) {
|
|
|
4994
5109
|
}
|
|
4995
5110
|
}
|
|
4996
5111
|
// ../core/src/skills.ts
|
|
4997
|
-
import { createHash } from "node:crypto";
|
|
5112
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
4998
5113
|
|
|
4999
5114
|
// ../../skills/armada-coordinator/MERGE.md
|
|
5000
5115
|
var MERGE_default = "# Merging a pull request\n\nRun `armada merge <pr>` (add `--dry-run` to see the checklist only, `--wait` when main keeps moving, `--no-ticket` for a pull request no ticket owns). It checks everything below, takes the project's merge lock, merges pinned to the handed-back SHA, confirms the merge on GitHub and closes the ticket. Its output lists the workers in flight to tell and the worker session to archive. When a refusal names a rule, fix the cause (usually: ask the worker to bring the default branch in and report again) rather than merging by hand. When you must merge by hand, follow the same steps.\n\n## Main kept moving: `--wait`\n\nWith several workers in flight, main often moves between a green hand-back and its merge. Instead of asking the worker to bring main in, run `armada merge <pr> --wait [--timeout <min>]` (30 minutes by default), in the background where your runtime allows it (Claude Code: `run_in_background`):\n\n- A head behind main that GitHub says merges cleanly is updated with GitHub's \"update branch\": a merge commit on the branch, no force-push. Squash merges make that merge commit harmless. When main does not require heads to be up to date and `[gates] local_commands` is set, it is test-merged instead, as without `--wait`, so a busy main does not restart CI each time.\n- It waits for every required check on the new head, then merges pinned to that head.\n- It holds the project's merge lock only while merging, not while waiting, so two waits never block each other. Signed in with Armada down, it refuses before touching the branch.\n- It stops at once, naming the cause, on a red check, a conflict, any other refused rule, or when GitHub refuses the update (a branch protection rule or ruleset can forbid it) or accepts it without the head moving within 3 minutes: ask the worker to fix it. A refusal after an update says so: the worker pulls the updated branch before pushing again.\n- The updated head still counts as the worker's hand-back, because the only change is main coming in: `armada merge` accepts a head that is the handed-back SHA followed only by merge commits, each bringing in a commit of main, with the tree of a clean merge (checked with git). That holds without `--wait` too, for example after \"Update branch\" on GitHub. The ticket's merged comment names both heads: `head <new>, the handed-back <old> updated with main`.\n\n## No ticket: `--no-ticket`\n\n`armada merge <pr> --no-ticket` merges a pull request no ticket owns: the `armada init` pull request (its output names the command) or the release pull request below. There is no hand-back and nothing is written to Linear; every other check is unchanged, and the merge is pinned to the head it checked. It refuses a branch that names a ticket of the program: that one is merged on its worker's hand-back.\n\nWhen none of the required checks ran on the head (a release pull request opened with the workflow's own token gets no CI run), it passes with a note, on GitHub's own state (`UNSTABLE` included, when nothing failed) and the checks that did run, once the head is a minute old; a younger head, or a head this run updated (its update starts CI), is waited for (`--wait`) or refused.\n\n## Before\n\n1. The worker has handed back: `Agent phase` is `ready-to-merge` and you have the full 40-character head SHA it reported.\n2. `gh pr view <n> --json headRefOid,mergeStateStatus,isDraft,title` shows that SHA (or that SHA with only main merged in), `CLEAN` (or `HAS_HOOKS`), not a draft, and a Commitizen title.\n3. `gh pr checks <n>` shows every required check passing.\n4. The head contains the current default branch: `git merge-base --is-ancestor origin/<default> <sha>`. If not, update it (`--wait`) or ask the worker to bring the default branch in (rebase, or merge it into their branch; never force-push a branch someone else pushed to).\n5. Semantic check: search the default branch for callers of anything the pull request deletes or renames.\n\n## Merge\n\n```sh\ngh pr merge <n> --squash --match-head-commit <full-sha>\n```\n\n- One merge at a time: `armada merge` holds the project's merge lock. If it refuses because Armada is down, use `--no-lock` only when you are sure no other coordinator merges in the project.\n- Leave out `--delete-branch`: it deletes local worktrees that have the branch checked out, including other agents'. Delete the branch once its worktree is gone.\n- If GitHub answers with a 5xx, check `gh pr view <n> --json state` before retrying.\n\n## After\n\n1. The ticket is Done, its `Agent phase` and `Agent runtime` labels removed, the pull request linked.\n2. Tell every in-flight worker what the merge changes for them: a shared file, a migration, a new check, code they must now reuse or delete.\n3. Archive the merged worker's workspace with the \"Stop and archive\" section of its runtime guide.\n4. Launch the tickets this merge unblocked.\n\n## The release pull request\n\nSome repositories publish through release-please: every merge to the default branch opens or updates one release pull request, and merging it tags the version and publishes it. When the repository's rules (`AGENTS.md`) say to merge it after each merge, do it right after the ticket's merge, without a hand-back: no worker owns it.\n\n- **What it looks like.** Title `chore(main): release <version>`, opened by `github-actions`, label `autorelease: pending`, and a diff that only touches the changelog, the manifest and version fields. It is opened with the workflow's own token, so **no CI check runs on it** (only checks from apps such as Vercel, if any) and `mergeStateStatus` is often `UNSTABLE` (`armada merge --no-ticket` accepts it when none of the required checks ran and nothing failed). Both are expected: the publish job runs the repository's checks again before publishing. Anything else in the diff, or a `DIRTY` state, is not expected: stop and tell the owner.\n- **Find it and its head:**\n\n```sh\ngh pr list --state open --label \"autorelease: pending\" --json number,title,headRefOid,mergeStateStatus\n```\n\n- **Merge it** with `armada merge <n> --no-ticket`: no ticket owns it, and no required check runs on it (see \"No ticket\" above). By hand, pin it to that head, like any merge, and without `--delete-branch`:\n\n```sh\ngh pr merge <n> --squash --match-head-commit <full-sha>\n```\n\n- **Check the publish.** After a minute or two the new version is on the registry, for example `npm view <package> version` for an npm package (the package is named in `AGENTS.md` or the release workflow). If it is not, open the Release run (`gh run list --workflow release.yml --limit 3`), fix the cause and re-run its failed jobs: a later push does not publish a version already tagged.\n- Release-please updates the same pull request on each merge to the default branch; one release pull request can carry several merges.\n";
|
|
@@ -5031,11 +5146,11 @@ A coordinator may start cold, on a laptop or in a fresh cloud session, with noth
|
|
|
5031
5146
|
- \`answer-request\` (it names the question or plan it answers, \`answers #<id>\`): deliver its text in the worker's session with the runtime guide's *message* section, as the owner's answer or plan approval, then \`armada answer <request id> "<the text you delivered>"\`. That resolves the request and its question or plan, and the ticket names who answered. If the item is gone (the worker was released or changed phase), \`armada answer <request id> "<why>"\` closes it.
|
|
5032
5147
|
- \`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.
|
|
5033
5148
|
Done when the inbox shows no open request.
|
|
5034
|
-
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.
|
|
5149
|
+
4. **Check silent workers and workers that never started** 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. A \`not-started\` entry is a worker launched that has not claimed after \`[policy] not_started_minutes\` (10 by default); it says whether the worker never used its launch token (it never reached its \`armada login\` line: an install that failed, a prompt cut short) or signed in and stopped before its claim. Read its session: a worker stuck on a setup choice gets a message to take the safe option and go on; one that is gone is launched again with a new brief, or its launch revoked on the dashboard's Workers page. The entry clears on the claim.
|
|
5035
5150
|
5. **Launch ready tickets** that do not collide with work in flight, one at a time:
|
|
5036
5151
|
- pick the ticket from the frontier in \`armada status\`;
|
|
5037
5152
|
- 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;
|
|
5038
|
-
- write the prompt with \`armada brief <ticket> --prompt > <file
|
|
5153
|
+
- write the prompt with \`armada brief <ticket> --prompt > <file>\`. **The launch message is that \`--prompt\` output, never text cut from the human view or \`--json\`**: those show the token masked as \`armada_launch_••••\`, which signs nobody in. 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;
|
|
5039
5154
|
- 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;
|
|
5040
5155
|
- 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.
|
|
5041
5156
|
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.
|
|
@@ -5046,7 +5161,7 @@ Repeat from step 1.
|
|
|
5046
5161
|
|
|
5047
5162
|
## Keep watching
|
|
5048
5163
|
|
|
5049
|
-
You only learn of something new when a command you run ends. So while a worker is in flight, always have exactly one \`armada watch\` running, in the background (in Claude Code, a Bash command with \`run_in_background\`; in another runtime, its own way of running a command in the background). It waits until something needs you (a question, a plan, a request, a hand-back
|
|
5164
|
+
You only learn of something new when a command you run ends. So while a worker is in flight, always have exactly one \`armada watch\` running, in the background (in Claude Code, a Bash command with \`run_in_background\`; in another runtime, its own way of running a command in the background). It waits until something needs you (a question, a plan, a request, a hand-back, a silent worker or one that never started, you have not been shown yet), prints it and exits, and you are woken. Armada being down or a command time limit does not end it, and it tells the dashboard you are at work.
|
|
5050
5165
|
|
|
5051
5166
|
- Start it as soon as a worker is in flight, and start it again right after acting on what it returned. Never end your turn with a worker in flight and no watch running: that is how a hand-back sits unmerged.
|
|
5052
5167
|
- The last line of \`armada inbox\`, \`armada watch\`, \`armada merge\` and \`armada brief\` says whether to: \`2 workers in flight (ABC-1, ABC-2) — keep watching: armada watch\`, \`armada watch is already running (pid …)\`, or \`nothing to watch\`. Follow it. A second \`armada watch\` on the same project only says the first one is running.
|
|
@@ -5083,7 +5198,7 @@ Armada never calls a runtime. This guide tells a coordinator running inside Clau
|
|
|
5083
5198
|
1. Pick a ready ticket from \`armada status\` that does not collide with work in flight.
|
|
5084
5199
|
2. Run \`armada brief ABC-12\` (with \`--profile <name> --reason "<why>"\` when you override the routed profile), right before the launch. Its \`Runtime:\` line must say \`claude-code\`: the profile has \`runtime = "claude-code"\` in \`armada.toml\`. Read the profile (model), the \`Launch:\` line and the warnings, and resolve every warning first. The profile's effort is not applied by the Agent tool; a worker that needs a set effort goes to Conductor.
|
|
5085
5200
|
- \`Launch: one-time token in the prompt\` is the normal case. \`Launch: no launch token (…)\` says why: usually \`armada login\`, then brief again.
|
|
5086
|
-
3. Read the prompt: \`armada brief ABC-12 --prompt\`. 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.
|
|
5201
|
+
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.
|
|
5087
5202
|
4. Launch with the Agent tool, every value set:
|
|
5088
5203
|
|
|
5089
5204
|
\`\`\`json
|
|
@@ -5104,7 +5219,7 @@ Armada never calls a runtime. This guide tells a coordinator running inside Clau
|
|
|
5104
5219
|
- The result gives the \`agentId\` and an \`output_file\`: the worker's transcript (JSONL). Keep both. Never read that file whole: it is the entire conversation (Status section).
|
|
5105
5220
|
- \`.claude/worktrees/\` appears as untracked in your own checkout: never commit it (add it to \`.gitignore\`).
|
|
5106
5221
|
|
|
5107
|
-
5. **Check the claim.** Within a few minutes, \`armada status\` lists the ticket in flight, phase \`planning\`, runtime \`Claude Code\`, and the claim comment reads \`session: abc-12\` and \`profile: <name>\`. No claim:
|
|
5222
|
+
5. **Check the claim.** Within a few minutes, \`armada status\` lists the ticket in flight, phase \`planning\`, runtime \`Claude Code\`, and the claim comment reads \`session: abc-12\` and \`profile: <name>\`. No claim after \`[policy] not_started_minutes\` (ten by default): \`armada watch\` and \`armada inbox\` show a \`not-started\` entry saying whether the worker never used its token or signed in and stopped. Read the transcript (Status section). A worker whose launch token was refused needs a new one: brief again and message it only the \`armada login --launch-token …\` line of the new \`--prompt\` output. A worker cut off from Armada was revoked on the dashboard or left idle for three days: ask the owner before you give it a new token.
|
|
5108
5223
|
|
|
5109
5224
|
## Message
|
|
5110
5225
|
|
|
@@ -5174,7 +5289,7 @@ A subagent launched without \`isolation: "worktree"\` runs in your checkout. The
|
|
|
5174
5289
|
`;
|
|
5175
5290
|
|
|
5176
5291
|
// ../../skills/armada-runtime-conductor/SKILL.md
|
|
5177
|
-
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` (with `--profile <name> --reason \"<why>\"` when you override the routed profile), right before the launch. 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. Write the prompt to a file only you can read, 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 ten minutes: 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 (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";
|
|
5292
|
+
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` (with `--profile <name> --reason \"<why>\"` when you override the routed profile), right before the launch. 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";
|
|
5178
5293
|
|
|
5179
5294
|
// ../../skills/armada-worker/SKILL.md
|
|
5180
5295
|
var SKILL_default4 = `---
|
|
@@ -5188,6 +5303,7 @@ You are a worker. You own exactly one ticket, named in your launch brief. You tu
|
|
|
5188
5303
|
|
|
5189
5304
|
- **Never merge**, never enable auto-merge, never approve your own plan. The coordinator merges.
|
|
5190
5305
|
- **Report at least every 15 minutes** of work with \`armada report <phase> --message "<what you are doing>"\`. The same phase is allowed: it is your heartbeat. A worker silent for longer than \`policy.silence_minutes\` shows as silent, and the coordinator comes to check on you.
|
|
5306
|
+
- **Keep going on setup choices.** When setup needs a choice (an install fallback, a retry, a missing tool), pick the safe option, say which in your next report, and keep going: never stop to ask about it. Ask only for product decisions.
|
|
5191
5307
|
- **Ask instead of guessing** when a choice changes the ticket's outcome: \`armada ask "<question and your recommendation>" --options "<a> | <b>"\`. Your phase becomes \`blocked\` and the question reaches the coordinator's inbox. Then **stop and end your turn**: the answer arrives as a message in this session, not in a command's output. When it arrives, report the phase you resume, for example \`armada report implementing --message "resumed: <the decision>"\`. Decide reversible technical choices yourself and record each one, with its reason, on the ticket and in the pull request.
|
|
5192
5308
|
- **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.
|
|
5193
5309
|
- Work only in your own branch and worktree. Never touch another agent's checkout, and stop only the processes you started.
|
|
@@ -5196,7 +5312,7 @@ You are a worker. You own exactly one ticket, named in your launch brief. You tu
|
|
|
5196
5312
|
|
|
5197
5313
|
## Steps
|
|
5198
5314
|
|
|
5199
|
-
1. **Claim** with the exact commands your brief starts with, for example \`armada claim <ticket> --runtime conductor --handle "$CONDUCTOR_WORKSPACE_ID/$CONDUCTOR_SESSION_ID"\`. Install the Armada version the brief names first; if it gives a fallback command, use it wherever this skill says \`armada\`. When the brief has an \`armada login --launch-token <token>\` line, run it once, right after the install and before the claim: it signs your workspace in to Armada for your ticket only, and Armada then gives your \`claim\`, \`report\`, \`ask\` and \`release\` their keys, so none is needed in your environment (do not ask for one; \`armada whoami\` shows the sign-in). The token works once, within the hour; never copy it anywhere else. If it is refused, or a later command says you were cut off from Armada, stop and say so in your reply: the coordinator decides whether you get a new one. The claim assigns the ticket, moves it to In Progress, sets \`Agent phase = planning\` and your \`Agent runtime\`, and posts the \`Agent claim\` comment. If it refuses because another claim exists, stop: the older claim wins.
|
|
5315
|
+
1. **Claim** with the exact commands your brief starts with, for example \`armada claim <ticket> --runtime conductor --handle "$CONDUCTOR_WORKSPACE_ID/$CONDUCTOR_SESSION_ID"\`. Install the Armada version the brief names first; if it gives a fallback command, use it wherever this skill says \`armada\`. If neither installs (a version npm does not serve yet), install the newest published one (\`npm install -g @the-vibe-company/armada\`), say so in your first report, and go on. When the brief has an \`armada login --launch-token <token>\` line, run it once, right after the install and before the claim: it signs your workspace in to Armada for your ticket only, and Armada then gives your \`claim\`, \`report\`, \`ask\` and \`release\` their keys, so none is needed in your environment (do not ask for one; \`armada whoami\` shows the sign-in). The token works once, within the hour; never copy it anywhere else. If it is refused, or a later command says you were cut off from Armada, stop and say so in your reply: the coordinator decides whether you get a new one. A token shown as \`armada_launch_••••\` is the masked one of the brief's human view: it signs nobody in, and \`armada login\` says so; ask for the \`armada brief <ticket> --prompt\` text. The claim assigns the ticket, moves it to In Progress, sets \`Agent phase = planning\` and your \`Agent runtime\`, and posts the \`Agent claim\` comment. If it refuses because another claim exists, stop: the older claim wins.
|
|
5200
5316
|
2. **Branch.** Use the branch named after the ticket (the tracker suggests one, for example \`feature/abc-12-short-title\`), created from the latest default branch.
|
|
5201
5317
|
3. **Plan.** Write the plan: what changes, how it is tested, and the checks a person could observe when it is done. Your brief's "Plan" section says in one line whether it needs approval (from \`[policy] plans\` in \`armada.toml\`, or a label on the ticket); follow that line, do not guess. Pre-approved: post the plan with \`armada report implementing --plan-file -\` (or \`--plan-file <path>\`) and go on; do not enter \`awaiting-approval\`. Otherwise post it with \`armada report awaiting-approval --plan-file -\`: it creates a \`plan\` item in the coordinator's inbox. \`--plan-file\` posts the plan as its own block, under a one-line status (\`--message\` sets that line, else the plan's first line). Push your branch and wait for the coordinator's decision in your session. On approval, report \`implementing\`; on amendments, report \`planning\`, revise the plan and submit it for approval again.
|
|
5202
5318
|
4. **Implement** test-first. A material change to the approved plan needs a new approval.
|
|
@@ -5226,7 +5342,7 @@ var BUNDLED_SKILLS = [
|
|
|
5226
5342
|
{ name: "armada-worker", files: [{ path: "SKILL.md", content: SKILL_default4 }] }
|
|
5227
5343
|
];
|
|
5228
5344
|
function skillFolderHash(files) {
|
|
5229
|
-
const hash =
|
|
5345
|
+
const hash = createHash2("sha256");
|
|
5230
5346
|
for (const f of [...files].sort((a, b) => a.path.localeCompare(b.path))) {
|
|
5231
5347
|
hash.update(f.path);
|
|
5232
5348
|
hash.update(f.content);
|
|
@@ -5594,6 +5710,7 @@ function buildStatus({
|
|
|
5594
5710
|
forgeError = null,
|
|
5595
5711
|
lastEvents,
|
|
5596
5712
|
live,
|
|
5713
|
+
launches = [],
|
|
5597
5714
|
extraWarnings = [],
|
|
5598
5715
|
now
|
|
5599
5716
|
}) {
|
|
@@ -5607,6 +5724,13 @@ function buildStatus({
|
|
|
5607
5724
|
});
|
|
5608
5725
|
const phaseOf = new Map(lanes.map((l) => [l.issue.id, l.phase]));
|
|
5609
5726
|
const prRef = (p) => ({
|
|
5727
|
+
files: p.files ?? null,
|
|
5728
|
+
additions: p.additions ?? null,
|
|
5729
|
+
deletions: p.deletions ?? null,
|
|
5730
|
+
filesComplete: p.filesComplete ?? false,
|
|
5731
|
+
checksComplete: p.checksComplete ?? false,
|
|
5732
|
+
mergeability: p.mergeability ?? "unknown",
|
|
5733
|
+
failingChecks: (p.checks ?? []).filter((check) => check.state === "failure").map((check) => check.name),
|
|
5610
5734
|
number: p.number,
|
|
5611
5735
|
url: p.url,
|
|
5612
5736
|
title: p.title,
|
|
@@ -5616,6 +5740,10 @@ function buildStatus({
|
|
|
5616
5740
|
});
|
|
5617
5741
|
return {
|
|
5618
5742
|
schemaVersion: STATUS_SCHEMA_VERSION,
|
|
5743
|
+
progress: {
|
|
5744
|
+
done: m.program.filter((ticket) => m.isLeaf(ticket) && isDone(ticket)).length,
|
|
5745
|
+
total: m.program.filter(m.isLeaf).length
|
|
5746
|
+
},
|
|
5619
5747
|
generatedAt: now.toISOString(),
|
|
5620
5748
|
project: { name: config.project.name, slug: config.project.slug, repository: config.github.repository },
|
|
5621
5749
|
programRoot: { id: m.root.id, title: m.root.title, url: m.root.url },
|
|
@@ -5645,6 +5773,10 @@ function buildStatus({
|
|
|
5645
5773
|
openBlockers: l.openBlockers,
|
|
5646
5774
|
flags: l.flags
|
|
5647
5775
|
})),
|
|
5776
|
+
notStarted: notStartedLaunches(launches, now, config.policy.notStartedMinutes).map((l) => {
|
|
5777
|
+
const issue = issues.find((i) => i.id === l.ticket);
|
|
5778
|
+
return { ...l, title: issue?.title ?? null, url: issue?.url ?? null, detail: notStartedBody(l, now) };
|
|
5779
|
+
}),
|
|
5648
5780
|
frontier: frontier(m, config.tracker.readyLabel).filter((c) => !phaseOf.has(c.issue.id)).map((c) => ({
|
|
5649
5781
|
id: c.issue.id,
|
|
5650
5782
|
title: c.issue.title,
|
|
@@ -5692,19 +5824,27 @@ async function loadStatus(config, opts) {
|
|
|
5692
5824
|
const eventsP = opts.lastEvents ? opts.lastEvents().then((events) => ({ events }), (err) => ({
|
|
5693
5825
|
warning: `Armada's live data could not be read (${err instanceof Error ? err.message : String(err)}); silence is measured from Linear only`
|
|
5694
5826
|
})) : Promise.resolve({});
|
|
5695
|
-
const
|
|
5827
|
+
const launchesP = opts.launches ? opts.launches().then((launches) => ({ launches }), (err) => ({
|
|
5828
|
+
warning: `Armada's launches could not be read (${err instanceof Error ? err.message : String(err)}); workers launched that never started are not listed`
|
|
5829
|
+
})) : Promise.resolve({});
|
|
5830
|
+
const [{ program, forge, forgeError }, events, launches] = await Promise.all([
|
|
5831
|
+
readStatusSources(config, opts),
|
|
5832
|
+
eventsP,
|
|
5833
|
+
launchesP
|
|
5834
|
+
]);
|
|
5696
5835
|
return buildStatus({
|
|
5697
5836
|
config,
|
|
5698
5837
|
program,
|
|
5699
5838
|
forge,
|
|
5700
5839
|
forgeError,
|
|
5701
5840
|
...events.events ? { lastEvents: events.events } : {},
|
|
5702
|
-
|
|
5841
|
+
...launches.launches ? { launches: launches.launches } : {},
|
|
5842
|
+
extraWarnings: [events.warning, launches.warning].filter((w) => !!w),
|
|
5703
5843
|
now: now()
|
|
5704
5844
|
});
|
|
5705
5845
|
}
|
|
5706
5846
|
// package.json
|
|
5707
|
-
var version = "0.2.
|
|
5847
|
+
var version = "0.2.11";
|
|
5708
5848
|
|
|
5709
5849
|
// src/api.ts
|
|
5710
5850
|
var runs = new WeakMap;
|
|
@@ -6047,7 +6187,14 @@ The key is stored in ${p.credentials}.
|
|
|
6047
6187
|
`);
|
|
6048
6188
|
return 0;
|
|
6049
6189
|
}
|
|
6190
|
+
function sessionHandle(io) {
|
|
6191
|
+
const workspace = io.env.CONDUCTOR_WORKSPACE_ID?.trim();
|
|
6192
|
+
const session = io.env.CONDUCTOR_SESSION_ID?.trim();
|
|
6193
|
+
return workspace && session ? `${workspace}/${session}` : null;
|
|
6194
|
+
}
|
|
6050
6195
|
async function loginWithLaunchToken(io, credentials, token, apiUrl) {
|
|
6196
|
+
if (isMaskedLaunchToken(token))
|
|
6197
|
+
throw new Refusal(MASKED_LAUNCH_TOKEN_REFUSAL.error, MASKED_LAUNCH_TOKEN_REFUSAL.next);
|
|
6051
6198
|
const p = paths(io);
|
|
6052
6199
|
let url = credentials.armadaApi.url;
|
|
6053
6200
|
if (apiUrl) {
|
|
@@ -6056,7 +6203,7 @@ async function loginWithLaunchToken(io, credentials, token, apiUrl) {
|
|
|
6056
6203
|
throw new UsageError(`the launch message names ${hostOf(apiUrl)}, but ARMADA_API_URL or [api] url names ${hostOf(url)}`, "unset ARMADA_API_URL, or ask the coordinator for a launch from that Armada");
|
|
6057
6204
|
url = apiUrl;
|
|
6058
6205
|
}
|
|
6059
|
-
const session = await apiOf(io, url).exchangeLaunchToken(token.trim());
|
|
6206
|
+
const session = await apiOf(io, url).exchangeLaunchToken(token.trim(), sessionHandle(io));
|
|
6060
6207
|
const w = session.worker;
|
|
6061
6208
|
await updateCredentialStore(p, {
|
|
6062
6209
|
[workerSessionVariable(w.ticket)]: formatWorkerSession({
|
|
@@ -6188,9 +6335,9 @@ function liveFleet(io, config, credentials) {
|
|
|
6188
6335
|
};
|
|
6189
6336
|
}
|
|
6190
6337
|
}
|
|
6191
|
-
function
|
|
6338
|
+
function statusLive(io, config, credentials) {
|
|
6192
6339
|
const { fleet } = liveFleet(io, config, credentials);
|
|
6193
|
-
return fleet ? () => fleet.lastEventTimes() : undefined;
|
|
6340
|
+
return fleet ? { lastEvents: () => fleet.lastEventTimes(), launches: () => fleet.pendingLaunches() } : undefined;
|
|
6194
6341
|
}
|
|
6195
6342
|
function currentTicket(io, config, explicit, workers = []) {
|
|
6196
6343
|
const fromEnv = io.env.ARMADA_TICKET?.trim();
|
|
@@ -6363,6 +6510,29 @@ async function endWorkerSessions(io, config, credentials, ticket, reason, quiet)
|
|
|
6363
6510
|
}
|
|
6364
6511
|
}
|
|
6365
6512
|
|
|
6513
|
+
// src/presence.ts
|
|
6514
|
+
function detectCoordinator(io) {
|
|
6515
|
+
const read = (name) => io.env[name]?.trim() || null;
|
|
6516
|
+
const workspace = read("CONDUCTOR_WORKSPACE_ID");
|
|
6517
|
+
const harness = workspace ? "conductor-cloud" : read("CLAUDECODE") ? "claude-code" : ["CODEX_THREAD_ID", "CODEX_CI", "CODEX_SANDBOX_ENV", "CODEX_SESSION_ID"].some(read) ? "codex" : "terminal";
|
|
6518
|
+
const handle = read("ARMADA_COORDINATOR_HANDLE") ?? (workspace ? [workspace, read("CONDUCTOR_SESSION_ID")].filter(Boolean).join("/") : [io.machineName, io.ttyName].filter(Boolean).join("/") || null);
|
|
6519
|
+
const model = harness === "conductor-cloud" ? read("CONDUCTOR_MODEL") ?? read("CODEX_MODEL") ?? read("CLAUDE_MODEL") : harness === "claude-code" ? read("CLAUDE_MODEL") ?? read("ANTHROPIC_MODEL") : harness === "codex" ? read("CODEX_MODEL") ?? read("OPENAI_MODEL") : null;
|
|
6520
|
+
return { harness, handle, model, cliVersion: version };
|
|
6521
|
+
}
|
|
6522
|
+
async function recordPresence(io, config, credentials) {
|
|
6523
|
+
if (!credentials.armadaSignIn || credentials.armadaSignIn.kind === "worker")
|
|
6524
|
+
return;
|
|
6525
|
+
const { fleet, warning } = liveFleet(io, config, credentials);
|
|
6526
|
+
try {
|
|
6527
|
+
if (!fleet)
|
|
6528
|
+
throw new Error(warning ?? "Armada is unreachable");
|
|
6529
|
+
await fleet.coordinator(detectCoordinator(io));
|
|
6530
|
+
} catch (error) {
|
|
6531
|
+
io.stderr(`armada: warning: could not record coordinator activity (${error instanceof Error ? error.message : String(error)})
|
|
6532
|
+
`);
|
|
6533
|
+
}
|
|
6534
|
+
}
|
|
6535
|
+
|
|
6366
6536
|
// src/inbox.ts
|
|
6367
6537
|
var DEFAULT_WAIT_SECONDS = 300;
|
|
6368
6538
|
async function ask(io, config, credentials, a) {
|
|
@@ -6412,8 +6582,9 @@ function renderEntries(project, items) {
|
|
|
6412
6582
|
e.id === null ? e.kind : `#${e.id} ${e.kind}`,
|
|
6413
6583
|
e.ticket,
|
|
6414
6584
|
e.author && `from ${e.author}`,
|
|
6415
|
-
e.request?.question &&
|
|
6585
|
+
e.request?.question && `${e.kind === "plan-changes" ? "amends" : "answers"} #${e.request.question}`,
|
|
6416
6586
|
e.request?.profile && `profile ${e.request.profile}`,
|
|
6587
|
+
e.request?.pr && `PR #${e.request.pr}`,
|
|
6417
6588
|
e.createdAt
|
|
6418
6589
|
].filter(Boolean).join(" · ");
|
|
6419
6590
|
out.push(`${e.new ? "* " : " "}${head}`, ...e.body.split(`
|
|
@@ -6421,8 +6592,8 @@ function renderEntries(project, items) {
|
|
|
6421
6592
|
}
|
|
6422
6593
|
if (items.some((e) => e.kind === "question" || e.kind === "plan"))
|
|
6423
6594
|
out.push(`Deliver each answer in the worker's session with the runtime guide, then record it: armada answer <id> "<answer>".`);
|
|
6424
|
-
if (items.some((e) =>
|
|
6425
|
-
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>".');
|
|
6595
|
+
if (items.some((e) => ["answer-request", "launch-request", "merge-request", "release-request", "plan-changes"].includes(e.kind)))
|
|
6596
|
+
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>". Handle or decline merge-request, release-request and plan-changes, then resolve them with armada answer <id> "<result>". Plan changes are not an approval.');
|
|
6426
6597
|
return out;
|
|
6427
6598
|
}
|
|
6428
6599
|
function renderInbox(r, next) {
|
|
@@ -6450,7 +6621,9 @@ async function inbox2(io, config, credentials, a) {
|
|
|
6450
6621
|
const report = await checkInbox(fleet, {
|
|
6451
6622
|
project: config.project.slug,
|
|
6452
6623
|
coordinator: coordinatorHandle(io),
|
|
6624
|
+
facts: detectCoordinator(io),
|
|
6453
6625
|
silentAfterMinutes: config.policy.silentAfterMinutes,
|
|
6626
|
+
notStartedMinutes: config.policy.notStartedMinutes,
|
|
6454
6627
|
now: io.now ?? (() => new Date),
|
|
6455
6628
|
...wait ? { wait: { timeoutMs, sleep: io.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms))) } } : {}
|
|
6456
6629
|
});
|
|
@@ -6577,7 +6750,9 @@ async function watchUntil(io, config, credentials, json, configPath) {
|
|
|
6577
6750
|
const report = await watchInbox(fleet, {
|
|
6578
6751
|
project,
|
|
6579
6752
|
coordinator: coordinatorHandle(io),
|
|
6753
|
+
facts: detectCoordinator(io),
|
|
6580
6754
|
silentAfterMinutes: config.policy.silentAfterMinutes,
|
|
6755
|
+
notStartedMinutes: config.policy.notStartedMinutes,
|
|
6581
6756
|
seen: before?.seen ?? [],
|
|
6582
6757
|
now: io.now ?? (() => new Date),
|
|
6583
6758
|
sleep: io.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms))),
|
|
@@ -6634,7 +6809,7 @@ async function hookStop(io, rest, findConfig) {
|
|
|
6634
6809
|
}
|
|
6635
6810
|
|
|
6636
6811
|
// src/brief.ts
|
|
6637
|
-
var HIDDEN_LAUNCH_TOKEN =
|
|
6812
|
+
var HIDDEN_LAUNCH_TOKEN = MASKED_LAUNCH_TOKEN;
|
|
6638
6813
|
function hideLaunchToken(b) {
|
|
6639
6814
|
if (!b.launch)
|
|
6640
6815
|
return b;
|
|
@@ -6730,6 +6905,7 @@ async function brief2(io, config, credentials, a, version, configPath) {
|
|
|
6730
6905
|
env: io.env,
|
|
6731
6906
|
stored: STORED_KEYS.filter((k) => credentials.sources[k.name]?.kind === "store").map((k) => k.variable),
|
|
6732
6907
|
launch: launcher(io, config, credentials),
|
|
6908
|
+
npm: (v) => checkPublished(v, io.fetch ?? fetch),
|
|
6733
6909
|
conventions,
|
|
6734
6910
|
...io.fetch ? { fetch: io.fetch } : {},
|
|
6735
6911
|
...io.now ? { now: io.now } : {}
|
|
@@ -7572,10 +7748,10 @@ async function merge2(io, config, credentials, a, configPath) {
|
|
|
7572
7748
|
}
|
|
7573
7749
|
|
|
7574
7750
|
// src/render.ts
|
|
7575
|
-
var
|
|
7751
|
+
var MIN3 = 60000;
|
|
7576
7752
|
function relative2(iso, now) {
|
|
7577
7753
|
const diff = now - Date.parse(iso);
|
|
7578
|
-
const m = Math.round(Math.abs(diff) /
|
|
7754
|
+
const m = Math.round(Math.abs(diff) / MIN3);
|
|
7579
7755
|
const suffix = diff >= 0 ? "ago" : "from now";
|
|
7580
7756
|
if (m < 1)
|
|
7581
7757
|
return "just now";
|
|
@@ -7604,7 +7780,7 @@ var phaseLabel = (t) => t.phaseSource === "label" ? t.phase : `${t.phase} (${t.p
|
|
|
7604
7780
|
function renderStatus(r) {
|
|
7605
7781
|
const now = Date.parse(r.generatedAt);
|
|
7606
7782
|
const out = [];
|
|
7607
|
-
const idWidth = Math.max(6, ...r.inFlight.map((t) => t.id.length), ...r.frontier.map((t) => t.id.length), ...(r.pullRequests ?? []).map((p) => `#${p.number}`.length));
|
|
7783
|
+
const idWidth = Math.max(6, ...r.inFlight.map((t) => t.id.length), ...r.notStarted.map((l) => l.ticket.length), ...r.frontier.map((t) => t.id.length), ...(r.pullRequests ?? []).map((p) => `#${p.number}`.length));
|
|
7608
7784
|
const indent = " ".repeat(idWidth + 4);
|
|
7609
7785
|
const phaseWidth = Math.max(0, ...r.inFlight.map((t) => phaseLabel(t).length));
|
|
7610
7786
|
out.push(`${r.project.name} · ${r.programRoot.id} ${r.programRoot.title}`);
|
|
@@ -7626,6 +7802,15 @@ function renderStatus(r) {
|
|
|
7626
7802
|
if (t.flags.length)
|
|
7627
7803
|
out.push(`${indent}! ${t.flags.join(", ")}`);
|
|
7628
7804
|
}
|
|
7805
|
+
if (r.notStarted.length) {
|
|
7806
|
+
out.push("", `Launched, not started (${r.notStarted.length})`);
|
|
7807
|
+
for (const l of r.notStarted) {
|
|
7808
|
+
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}` : ""}`);
|
|
7809
|
+
if (l.title)
|
|
7810
|
+
out.push(`${indent}${truncate(l.title, 90)}`);
|
|
7811
|
+
out.push(`${indent}! check its session with the runtime guide's status section`);
|
|
7812
|
+
}
|
|
7813
|
+
}
|
|
7629
7814
|
const ready = r.frontier.filter((t) => t.readyForAgent);
|
|
7630
7815
|
const untriaged = r.frontier.filter((t) => !t.readyForAgent);
|
|
7631
7816
|
out.push("", `Ready to start (${ready.length})`);
|
|
@@ -7687,6 +7872,7 @@ async function statusAll(io, json) {
|
|
|
7687
7872
|
warning = read.warning;
|
|
7688
7873
|
const config = read.config;
|
|
7689
7874
|
const own = p.ownLinearKey && !io.env.LINEAR_API_KEY?.trim() ? (await api.credentials(signIn, { project: p.slug })).linear?.apiKey : undefined;
|
|
7875
|
+
await recordPresence(io, config, credentials);
|
|
7690
7876
|
const report = await loadStatus(config, {
|
|
7691
7877
|
linearApiKey: own ?? linearApiKey,
|
|
7692
7878
|
githubToken: credentials.githubToken,
|
|
@@ -7723,7 +7909,7 @@ ${"─".repeat(60)}
|
|
|
7723
7909
|
// src/secrets.ts
|
|
7724
7910
|
import { dirname as dirname6, relative as relative3, resolve } from "node:path";
|
|
7725
7911
|
var NAME_HINT = "upper snake case, e.g. OPENAI_API_KEY";
|
|
7726
|
-
var
|
|
7912
|
+
var hhmm2 = (iso) => `${iso.slice(0, 16).replace("T", " ")} UTC`;
|
|
7727
7913
|
function signInOf(config, credentials) {
|
|
7728
7914
|
const signIn = credentials.armadaSignIn;
|
|
7729
7915
|
if (!signIn)
|
|
@@ -7793,7 +7979,7 @@ Next: armada secrets set <NAME> (an owner or admin), or the Keys page of Armada
|
|
|
7793
7979
|
const width = Math.max(...secrets.map((s) => s.name.length));
|
|
7794
7980
|
const lines = [`Secrets for workers of ${p} (names only; values stay in Armada)`];
|
|
7795
7981
|
for (const s of secrets)
|
|
7796
|
-
lines.push(` ${s.name.padEnd(width)} ${s.scope.padEnd(12)} set by ${s.setBy}, ${
|
|
7982
|
+
lines.push(` ${s.name.padEnd(width)} ${s.scope.padEnd(12)} set by ${s.setBy}, ${hhmm2(s.setAt)}${s.overridden ? " (the project's own wins)" : ""}`);
|
|
7797
7983
|
return `${lines.join(`
|
|
7798
7984
|
`)}
|
|
7799
7985
|
`;
|
|
@@ -8249,13 +8435,14 @@ async function status2(io, args) {
|
|
|
8249
8435
|
const config = parseConfig(text, path);
|
|
8250
8436
|
const { credentials } = await loadCredentials(io, { project: config.project.slug });
|
|
8251
8437
|
const { linearApiKey, githubToken } = credentials;
|
|
8438
|
+
await recordPresence(io, config, credentials);
|
|
8252
8439
|
if (!linearApiKey)
|
|
8253
8440
|
throw missingKey(LINEAR_KEY);
|
|
8254
|
-
const
|
|
8441
|
+
const live = statusLive(io, config, credentials);
|
|
8255
8442
|
const report = await loadStatus(config, {
|
|
8256
8443
|
linearApiKey,
|
|
8257
8444
|
githubToken,
|
|
8258
|
-
...
|
|
8445
|
+
...live ?? {},
|
|
8259
8446
|
...io.fetch ? { fetch: io.fetch } : {},
|
|
8260
8447
|
...io.now ? { now: io.now } : {}
|
|
8261
8448
|
});
|
|
@@ -8356,12 +8543,15 @@ async function dispatch(argv, io) {
|
|
|
8356
8543
|
ticket: (stored) => command === "claim" ? args.rest[0]?.toUpperCase() ?? null : currentTicket(io, config, args.options.ticket, stored)
|
|
8357
8544
|
} : undefined;
|
|
8358
8545
|
const { credentials } = await loadCredentials(io, scope ? { worker: scope } : { project: config.project.slug });
|
|
8546
|
+
if (command === "inbox")
|
|
8547
|
+
await recordPresence(io, config, credentials);
|
|
8359
8548
|
return await worker(io, config, credentials, args);
|
|
8360
8549
|
}
|
|
8361
8550
|
if (args.command === "watch") {
|
|
8362
8551
|
const { path, text } = await findConfig(io, args.config, "watch");
|
|
8363
8552
|
const config = parseConfig(text, path);
|
|
8364
8553
|
const { credentials } = await loadCredentials(io, { project: config.project.slug });
|
|
8554
|
+
await recordPresence(io, config, credentials);
|
|
8365
8555
|
return await watch2(io, config, credentials, args, path);
|
|
8366
8556
|
}
|
|
8367
8557
|
if (args.command === "hook")
|
|
@@ -8370,12 +8560,14 @@ async function dispatch(argv, io) {
|
|
|
8370
8560
|
const { path, text } = await findConfig(io, args.config, "merge");
|
|
8371
8561
|
const config = parseConfig(text, path);
|
|
8372
8562
|
const { credentials } = await loadCredentials(io, { project: config.project.slug });
|
|
8563
|
+
await recordPresence(io, config, credentials);
|
|
8373
8564
|
return await merge2(io, config, credentials, args, path);
|
|
8374
8565
|
}
|
|
8375
8566
|
if (args.command === "brief") {
|
|
8376
8567
|
const { path, text } = await findConfig(io, args.config, "brief");
|
|
8377
8568
|
const config = parseConfig(text, path);
|
|
8378
8569
|
const { credentials } = await loadCredentials(io, { project: config.project.slug });
|
|
8570
|
+
await recordPresence(io, config, credentials);
|
|
8379
8571
|
return await brief2(io, config, credentials, args, version, path);
|
|
8380
8572
|
}
|
|
8381
8573
|
if (args.command === "status") {
|
|
@@ -8570,6 +8762,8 @@ var exec = (command, args, { cwd }) => new Promise((done, fail) => {
|
|
|
8570
8762
|
child.on("close", (code) => done({ code: code ?? 1, stdout, stderr }));
|
|
8571
8763
|
});
|
|
8572
8764
|
var code = await run(process.argv.slice(2), {
|
|
8765
|
+
machineName: hostname2(),
|
|
8766
|
+
ttyName: process.stdin.isTTY ? spawnSync("tty", [], { encoding: "utf8", stdio: ["inherit", "pipe", "ignore"] }).stdout?.trim() || null : null,
|
|
8573
8767
|
cwd: process.cwd(),
|
|
8574
8768
|
env: process.env,
|
|
8575
8769
|
readFile: (path) => readFile3(path, "utf8").catch((err) => {
|