@the-vibe-company/armada 0.2.19 → 0.2.21

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.
Files changed (3) hide show
  1. package/README.md +6 -4
  2. package/dist/armada.js +257 -28
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -34,7 +34,7 @@ Workers then need no key either: each one's launch message carries a one-time to
34
34
 
35
35
  `armada status` reads the `armada.toml` of the current repository (or the nearest parent directory) and prints:
36
36
 
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).
37
+ - **In flight**: tickets an agent holds, with their phase, runtime, last report and pull request. A worker with no heartbeat for longer than `policy.silence_minutes` is flagged `silent`, unless it is waiting on a human (`awaiting-approval`, `blocked`, `ready-to-merge`). Older workers without heartbeats fall back to reports (an `armada report` event recorded through Armada, an `Agent status:` comment or its claim), then the ticket's last sign of life (ticket edit, comment or pull request update). A live worker without a report for `policy.quiet_minutes` gets a coordinator-only inbox note, not a red dashboard state.
38
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.
39
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.
40
40
  - **Pull requests waiting**: open pull requests with their CI state and mergeability.
@@ -137,13 +137,14 @@ armada answer --note ABC-12 "main moved: bring it in before you ship" # an unso
137
137
 
138
138
  - `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`.
139
139
  - `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.
140
- - `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.
140
+ - `heartbeat --every 5m --parent <agent-pid>` pings Armada without reading keys from the vault or writing Linear. The brief starts it immediately after claim: Conductor uses `--background` (detached process group and PID file), Claude Code uses the subagent's background Bash. It survives between turns on Cloud and stops when its persistent parent exits or the current worker session ends (release, merge, revoke). If background startup is unsupported or fails, keep manual reports at least every 15 minutes. `[policy] silence_minutes` defaults to 15: no heartbeat means probably stopped; old clients use reports. `quiet_minutes` defaults to 45: alive without a progress report creates a coordinator-only `quiet` inbox note, never an owner item or red dashboard state. Heartbeats draw the timeline's session line; actual reports remain dots.
141
+ - `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 last heartbeat (or newest report for an older client) is older than `policy.silence_minutes`, and its phase does not wait on someone else. A live worker with no report for `policy.quiet_minutes` gets a softer `quiet` entry here only. 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.
141
142
  - `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.
142
143
  - 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.
143
144
  - `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.
144
145
  - On the dashboard, an item open in the coordinator's inbox for longer than `policy.coordinator_minutes` (default 10) shows "waiting for the coordinator for N min" in "Waiting for you".
145
146
  - A coordinator's own claim is never listed as silent in its inbox: only an exact, nonempty handle match is excluded, not its questions, requests or hand-backs. `inbox` takes the reading coordinator's handle from `ARMADA_COORDINATOR_HANDLE` first, otherwise from both `CONDUCTOR_WORKSPACE_ID` and `CONDUCTOR_SESSION_ID` joined as `workspace/session`. Blank values are ignored; with no complete identity, silence detection is unchanged. Local coordinators should set `ARMADA_COORDINATOR_HANDLE` to the handle used for their claim. The same identity is used for every `--wait` poll and the dashboard presence record; the fleet-wide `status` and dashboard silence rules are unchanged.
146
- - `answer` never calls a runtime: deliver the answer first with the runtime guide's message section. It posts `Agent status: <current phase> — answer: …` on the ticket and resolves the item. An item id needs Armada; a ticket id answers that ticket's open questions and plans and also works without it. `--note` records a delivered note as `Agent status: <phase> — note: …`; it accepts a ticket or plan item id and resolves open plans, not questions. These two are the coordinator's records: Armada never reads them as the worker's phase, hand-back or sign of life. Questions, plans and requests can be answered; `merge` resolves hand-backs, and `release` and `merge` resolve the ticket's open questions. A worker that does not report within `policy.silence_minutes` of an answer shows as silent.
147
+ - `answer` never calls a runtime: deliver the answer first with the runtime guide's message section. It posts `Agent status: <current phase> — answer: …` on the ticket and resolves the item. An item id needs Armada; a ticket id answers that ticket's open questions and plans and also works without it. `--note` records a delivered note as `Agent status: <phase> — note: …`; it accepts a ticket or plan item id and resolves open plans, not questions. These two are the coordinator's records: Armada never reads them as the worker's phase, hand-back or sign of life. Questions, plans and requests can be answered; `merge` resolves hand-backs, and `release` and `merge` resolve the ticket's open questions. For older clients without heartbeats, no report within `policy.silence_minutes` of an answer shows as silent. With heartbeats, the report reminder uses `policy.quiet_minutes` instead.
147
148
  - The dashboard adds two kinds of request, signed by the person who made them. In "Waiting for you", **Approve** opens an editable approval (`approved` by default); sending it creates an `answer-request`, just like answering a question. Deliver its text, then `armada answer <request id> "<answer>"`, which resolves the request and its question or plan and names the requester on the ticket (answering the item itself also closes a waiting request). A `launch-request` asks to launch a ready ticket on a profile: launch it as usual; the worker's `armada claim` resolves it and posts who asked. To decline one, `armada answer <request id> "<why>"`: it is closed with the reason and nothing is posted on the ticket.
148
149
 
149
150
  ## Merge a finished pull request (coordinator)
@@ -399,7 +400,8 @@ local_commands = ["npm ci", "npm test"] # run by `armada merge` on a test merge
399
400
  attachments_per_ticket = 20 # images and links together (default 20)
400
401
  attachments_project_mb = 200 # private image bytes per project, MB = 1024² bytes (default 200)
401
402
  attachments_retention_days = 30 # deleted after completion/cancellation by the next project refresh (default 30)
402
- silence_minutes = 15 # a worker with no report for longer is flagged silent (default 15)
403
+ silence_minutes = 15 # no heartbeat for longer flags a worker silent (default 15; reports for older clients)
404
+ quiet_minutes = 45 # live without a report for longer adds a coordinator-only note (default 45)
403
405
  coordinator_minutes = 10 # an inbox item open longer shows "waiting for the coordinator" (default 10)
404
406
  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)
405
407
  plans = "approve" # or "pre-approved": workers post their plan and go on (default "approve")
package/dist/armada.js CHANGED
@@ -993,6 +993,7 @@ var CONFIG_DEFAULTS = {
993
993
  runtimeGroup: "Agent runtime",
994
994
  runtimes: ["Claude Code", "Codex", "Conductor"],
995
995
  silentAfterMinutes: 15,
996
+ quietAfterMinutes: 45,
996
997
  coordinatorMinutes: 10,
997
998
  notStartedMinutes: 10,
998
999
  plans: "approve",
@@ -1110,6 +1111,7 @@ function parseConfig(text, source = CONFIG_FILE) {
1110
1111
  policyT,
1111
1112
  [
1112
1113
  "silence_minutes",
1114
+ "quiet_minutes",
1113
1115
  "silent_after_minutes",
1114
1116
  "coordinator_minutes",
1115
1117
  "not_started_minutes",
@@ -1207,6 +1209,14 @@ function parseConfig(text, source = CONFIG_FILE) {
1207
1209
  problems.push(`"policy.${silenceKey}" must be a positive number`);
1208
1210
  }
1209
1211
  let coordinatorMinutes = CONFIG_DEFAULTS.coordinatorMinutes;
1212
+ let quietAfterMinutes = CONFIG_DEFAULTS.quietAfterMinutes;
1213
+ if (policyT.quiet_minutes !== undefined) {
1214
+ const value = policyT.quiet_minutes;
1215
+ if (typeof value === "number" && Number.isFinite(value) && value > 0)
1216
+ quietAfterMinutes = value;
1217
+ else
1218
+ problems.push('"policy.quiet_minutes" must be a positive number');
1219
+ }
1210
1220
  if (policyT.coordinator_minutes !== undefined) {
1211
1221
  const v = policyT.coordinator_minutes;
1212
1222
  if (typeof v === "number" && Number.isFinite(v) && v > 0)
@@ -1302,6 +1312,7 @@ function parseConfig(text, source = CONFIG_FILE) {
1302
1312
  gates: { requiredChecks, localCommands },
1303
1313
  policy: {
1304
1314
  silentAfterMinutes,
1315
+ quietAfterMinutes,
1305
1316
  coordinatorMinutes,
1306
1317
  notStartedMinutes,
1307
1318
  plans,
@@ -1346,7 +1357,8 @@ repository = ${q(p.repository)}
1346
1357
  # required_checks = ["test"] # CI checks that must be green before a hand-back (default: every check)
1347
1358
 
1348
1359
  [policy]
1349
- silence_minutes = 15 # a worker with no report for longer than this shows as silent
1360
+ silence_minutes = 15 # a worker with no heartbeat for longer than this shows as silent
1361
+ quiet_minutes = 45 # alive but without a report: a coordinator-only note
1350
1362
  coordinator_minutes = 10 # an inbox item open longer than this shows "waiting for the coordinator"
1351
1363
  # not_started_minutes = 10 # a launched worker that has not claimed after this long shows as not started
1352
1364
  # plans = "approve" # or "pre-approved": workers post their plan and go on without waiting
@@ -1638,7 +1650,8 @@ function buildLane(m, allComments, issue, opts) {
1638
1650
  const agent = issue.delegate ?? issue.assignee;
1639
1651
  const flags = [];
1640
1652
  const waitingOnHuman = NEEDS_HUMAN.includes(phase) || phase === "merged";
1641
- const alive = lastReport ?? lastUpdate;
1653
+ const lastHeartbeat = opts.heartbeats?.[issue.id] ?? opts.live?.handles?.[issue.id]?.lastHeartbeatAt ?? null;
1654
+ const alive = lastHeartbeat ?? lastReport ?? lastUpdate;
1642
1655
  if (!waitingOnHuman && opts.now - Date.parse(alive) > opts.silentAfterMinutes * MIN)
1643
1656
  flags.push("silent");
1644
1657
  if (pr?.state === "open" && pr.ci === "failure")
@@ -1668,6 +1681,7 @@ function buildLane(m, allComments, issue, opts) {
1668
1681
  since,
1669
1682
  lastUpdate,
1670
1683
  lastReport,
1684
+ lastHeartbeat,
1671
1685
  statusLine: fresh?.message && phaseSource === "live" ? { summary: fresh.message, at: fresh.at, author: null, url: issue.url, plan: false } : withStatus?.status ? {
1672
1686
  summary: withStatus.status.summary,
1673
1687
  at: withStatus.createdAt,
@@ -1744,8 +1758,6 @@ function notStartedBody(l, now) {
1744
1758
  }
1745
1759
  var notStartedLaunches = (launches, now, minutes) => followedLaunches(launches, now).filter((l) => now.getTime() - Date.parse(l.launchedAt) > minutes * MIN2);
1746
1760
 
1747
- // ../core/src/activity.ts
1748
- var SAME_MS = 10 * 60000;
1749
1761
  // ../core/src/linear.ts
1750
1762
  var LINEAR_ENDPOINT = "https://api.linear.app/graphql";
1751
1763
  var MAX_DEPTH = 8;
@@ -2372,6 +2384,7 @@ async function waitForApproval({ api, code, sleep, now }) {
2372
2384
  }
2373
2385
  throw new ArmadaApiError("the code expired before it was approved", LOGIN_NEXT);
2374
2386
  }
2387
+
2375
2388
  // ../core/src/attachments.ts
2376
2389
  var MAX_ATTACHMENT_BYTES = 2 * 1024 * 1024;
2377
2390
  function attachmentImageType(bytes) {
@@ -2411,6 +2424,7 @@ function checkAttachment(input) {
2411
2424
  return "attachment link type limit: a valid HTTPS URL is required";
2412
2425
  }
2413
2426
  }
2427
+
2414
2428
  // ../core/src/phases.ts
2415
2429
  var TRANSITIONS = {
2416
2430
  planning: ["awaiting-approval", "implementing"],
@@ -3149,12 +3163,19 @@ function renderPrompt(b) {
3149
3163
  ] : [],
3150
3164
  subagent ? "## Then: install Armada and claim the ticket" : "## First: install Armada and claim the ticket",
3151
3165
  "",
3166
+ ...subagent ? [
3167
+ "Run install, login and claim first. Immediately after claim, run the final heartbeat line as a separate Bash tool call with `run_in_background: true`; keep that Bash owned by this subagent.",
3168
+ ""
3169
+ ] : [],
3152
3170
  "```sh",
3153
3171
  b.install,
3154
3172
  ...b.launch ? [b.launch.command] : [],
3155
3173
  b.claimCommand,
3174
+ `armada heartbeat --every 5m --ticket ${t.id} --handle ${subagent ? subagentName(t.id) : CONDUCTOR_HANDLE} --parent "$PPID"${subagent ? "" : " --background"}`,
3156
3175
  "```",
3157
3176
  "",
3177
+ subagent ? "Keep this Bash heartbeat in the subagent's background: it dies with the subagent, which is intended. Do not detach it from the subagent. If background processes are unavailable, report manually at least every 15 minutes." : "The heartbeat detaches from the short-lived command shell (a new process group, like nohup + setsid), keeps a PID file under ~/.config/armada/watch/, and stays alive between turns and while waiting for messages. Its parent is the persistent agent PID ($PPID in the command shell), never the shell PID ($$). If startup fails or the runtime cannot keep a background process, report manually at least every 15 minutes instead.",
3178
+ "",
3158
3179
  `${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\`.`,
3159
3180
  ...b.launch ? [
3160
3181
  "",
@@ -3279,6 +3300,7 @@ async function loadBrief(config, opts) {
3279
3300
  async function launchForBrief(ticket, launch) {
3280
3301
  return ticket.statusType !== "completed" && ticket.statusType !== "canceled" && launch ? launch(ticket.id) : null;
3281
3302
  }
3303
+
3282
3304
  // ../core/src/credentials.ts
3283
3305
  var DEFAULT_ARMADA_API_URL = "https://armada.thevibecompany.co";
3284
3306
  var SESSION_TOKEN_VARIABLE = "ARMADA_SESSION_TOKEN";
@@ -3391,6 +3413,7 @@ var missingKeys = (credentials) => STORED_KEYS.filter((k) => credentials[k.name]
3391
3413
  function missingKeyMessage(key) {
3392
3414
  return `${key.variable} is not set. Set it in the environment, run \`armada auth login\` to store it on this machine (${key.hint}), or sign in with \`armada login\` to an Armada that keeps your organization's keys.`;
3393
3415
  }
3416
+
3394
3417
  // ../core/src/dotenv.ts
3395
3418
  var ASSIGNMENT = /^\s*(export\s+)?([A-Za-z_][A-Za-z0-9_]*)=(.*)$/;
3396
3419
  function shellWord2(raw) {
@@ -3503,14 +3526,16 @@ function updateDotenv(text, updates) {
3503
3526
  `)}
3504
3527
  ` : "";
3505
3528
  }
3529
+
3506
3530
  // ../core/src/fleet-api.ts
3507
- var WORKER_FLEET_OPS = ["claim", "report", "ask", "release"];
3531
+ var WORKER_FLEET_OPS = ["claim", "report", "ask", "release", "heartbeat"];
3508
3532
  var FLEET_OPS = [
3509
3533
  ...WORKER_FLEET_OPS,
3510
3534
  "register",
3511
3535
  "coordinator",
3512
3536
  "request",
3513
3537
  "events/latest",
3538
+ "heartbeats/latest",
3514
3539
  "launches",
3515
3540
  "inbox",
3516
3541
  "inbox/item",
@@ -3536,6 +3561,8 @@ function fleetClient(o) {
3536
3561
  return;
3537
3562
  }),
3538
3563
  lastEventTimes: () => call("events/latest", {}),
3564
+ heartbeatTimes: () => call("heartbeats/latest", {}),
3565
+ heartbeat: (input) => call("heartbeat", input),
3539
3566
  pendingLaunches: () => call("launches", {}),
3540
3567
  claim: (c) => call("claim", c),
3541
3568
  report: (r) => call("report", r),
@@ -3556,6 +3583,7 @@ function fleetClient(o) {
3556
3583
  })
3557
3584
  };
3558
3585
  }
3586
+
3559
3587
  // ../core/src/github.ts
3560
3588
  var GITHUB_GRAPHQL = "https://api.github.com/graphql";
3561
3589
 
@@ -3813,6 +3841,36 @@ async function fetchCommit(opts) {
3813
3841
  return null;
3814
3842
  return { sha: c.oid, tree: c.tree.oid, parents: c.parents.nodes.map((p) => p.oid) };
3815
3843
  }
3844
+
3845
+ // ../core/src/heartbeat.ts
3846
+ async function heartbeatLoop(options) {
3847
+ let claimedAt = null;
3848
+ let next = options.now().getTime();
3849
+ while (options.parentAlive()) {
3850
+ const remaining = next - options.now().getTime();
3851
+ if (remaining > 0) {
3852
+ await options.sleep(Math.min(1000, remaining));
3853
+ continue;
3854
+ }
3855
+ let result = null;
3856
+ try {
3857
+ result = await options.ping({ ticket: options.ticket, handle: options.handle, claimedAt });
3858
+ } catch (error) {
3859
+ if (error instanceof ArmadaApiError && error.status !== null && error.status >= 400 && error.status < 500 && error.status !== 429)
3860
+ return "session-ended";
3861
+ }
3862
+ if (result) {
3863
+ if (!result.active || !result.claimedAt)
3864
+ return "session-ended";
3865
+ if (!claimedAt && options.ready && !await options.ready(result))
3866
+ return "already-running";
3867
+ claimedAt = result.claimedAt;
3868
+ }
3869
+ next = options.now().getTime() + options.everyMs;
3870
+ }
3871
+ return "parent-exited";
3872
+ }
3873
+
3816
3874
  // ../core/src/inbox.ts
3817
3875
  function questionBody(question, options = []) {
3818
3876
  const listed = options.map((o) => o.trim()).filter(Boolean);
@@ -3842,6 +3900,7 @@ async function checkInbox(fleet, o) {
3842
3900
  const query = {
3843
3901
  coordinator: o.coordinator ?? null,
3844
3902
  silentAfterMinutes: o.silentAfterMinutes,
3903
+ quietAfterMinutes: o.quietAfterMinutes,
3845
3904
  ...o.facts ? { facts: o.facts } : {},
3846
3905
  ...o.notStartedMinutes !== undefined ? { notStartedMinutes: o.notStartedMinutes } : {}
3847
3906
  };
@@ -3977,6 +4036,7 @@ async function declineLaunch(ctx, item, reason, warnings) {
3977
4036
  ];
3978
4037
  return { ticket: item.ticket ?? `#${item.id}`, url: "", lines, warnings: [...new Set(warnings)], inbox: null };
3979
4038
  }
4039
+
3980
4040
  // ../core/src/labels.ts
3981
4041
  function requiredLabels(config) {
3982
4042
  return [
@@ -4066,6 +4126,7 @@ async function createMissingLabels(state, opts) {
4066
4126
  }
4067
4127
  return created;
4068
4128
  }
4129
+
4069
4130
  // ../core/src/linear-write.ts
4070
4131
  var LABEL = "id name parent { name }";
4071
4132
  var ATTACHMENT = "title url";
@@ -4206,6 +4267,7 @@ function createLinearWriter(opts) {
4206
4267
  }
4207
4268
  };
4208
4269
  }
4270
+
4209
4271
  // ../core/src/machine.ts
4210
4272
  import { randomBytes } from "node:crypto";
4211
4273
  import { chmod, link, mkdir, open, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
@@ -4229,6 +4291,7 @@ async function watchInbox(fleet, o) {
4229
4291
  const query = {
4230
4292
  coordinator: o.coordinator,
4231
4293
  silentAfterMinutes: o.silentAfterMinutes,
4294
+ quietAfterMinutes: o.quietAfterMinutes,
4232
4295
  ...o.facts ? { facts: o.facts } : {},
4233
4296
  ...o.notStartedMinutes !== undefined ? { notStartedMinutes: o.notStartedMinutes } : {}
4234
4297
  };
@@ -4582,6 +4645,7 @@ async function addNoticedRelease(paths, version) {
4582
4645
  `;
4583
4646
  await writePrivate(paths, releasesFile(paths), text, 420);
4584
4647
  }
4648
+
4585
4649
  // ../core/src/merge.ts
4586
4650
  var MERGE_LEASE = "merge";
4587
4651
  var MERGE_LEASE_TTL_MS = 20 * 60000;
@@ -5230,10 +5294,7 @@ function outcome(c, merged, pr, lines, workers, archive) {
5230
5294
  warnings: c.warnings
5231
5295
  };
5232
5296
  }
5233
- // ../core/src/timeline.ts
5234
- var SAME_REPORT_MS = 2 * 60000;
5235
- var MIN3 = 60000;
5236
- var HOUR = 60 * MIN3;
5297
+
5237
5298
  // ../core/src/projects.ts
5238
5299
  var message = (err) => err instanceof Error ? err.message : String(err);
5239
5300
  async function readProjectConfig(p, opts) {
@@ -5257,6 +5318,7 @@ async function readProjectConfig(p, opts) {
5257
5318
  return fallback(message(err));
5258
5319
  }
5259
5320
  }
5321
+
5260
5322
  // ../core/src/skills.ts
5261
5323
  import { createHash as createHash2 } from "node:crypto";
5262
5324
 
@@ -5346,6 +5408,8 @@ Armada never calls a runtime. This guide tells a coordinator running inside Clau
5346
5408
 
5347
5409
  ## Launch
5348
5410
 
5411
+ The brief starts a heartbeat immediately after claim. Run the heartbeat command in the subagent's **background Bash** (\`run_in_background: true\`), with \`--parent "$PPID"\` and its claim's \`--handle\`; do not use \`--background\`, \`nohup\` or \`setsid\` here. A subagent's background Bash dies with the subagent, which is the intended behaviour: detaching it could falsely keep a finished subagent alive while the coordinator's process still runs. It also stops when Armada ends its session (release, merge, revoke). If a runtime cannot keep any background Bash, report the fallback on the ticket and keep today's manual reports at least every 15 minutes. Report actual progress at meaningful steps even when heartbeats run.
5412
+
5349
5413
  1. Pick a ready ticket from \`armada status\` that does not collide with work in flight.
5350
5414
  2. Read the ticket and parent, then choose its profile. A matching label rule wins; otherwise match the profiles' \`when\` rules by most files/work and pass \`--profile <name> --reason "<why>"\`. Mixed front-end/back-end work: choose the larger part and say why. An optional \`armada brief ABC-12\` or \`--json\` preview is read-only: neither mints a token nor marks a worker in flight. The profile must have \`runtime = "claude-code"\` in \`armada.toml\`. The profile's effort is not applied by the Agent tool; a worker that needs a set effort goes to Conductor.
5351
5415
  3. **Make one brief call for the launch:** \`armada brief ABC-12 --prompt --profile-line\`, keeping the chosen \`--profile\` and \`--reason\` flags. Stdout is the exact worker prompt; stderr names the profile, agent, model, effort, runtime and reason, so no second brief is needed for the model. Resolve warnings before launching. If the choice is still needed, \`--prompt\` refuses without minting anything. **The launch message is that \`--prompt\` output, and only it**: the human view and \`--json\` carry no token. The token works once, within the hour; generate a fresh prompt if it has expired. If you cancel or launching the subagent fails, use \`armada launch revoke ABC-12\`. Add what only you know (the boundary with a parallel worker, a decision not yet on the ticket) at the end. Without a launch token, stderr says why: usually \`armada login\`, then generate a new prompt.
@@ -5439,12 +5503,12 @@ A subagent launched without \`isolation: "worktree"\` runs in your checkout. The
5439
5503
  `;
5440
5504
 
5441
5505
  // ../../skills/armada-runtime-conductor/SKILL.md
5442
- var SKILL_default3 = "---\nname: armada-runtime-conductor\ndescription: Runtime guide for running Armada workers on Conductor Cloud. Use when an Armada coordinator must launch a worker on a ticket, send it a message, check whether a silent worker is still alive, or stop and archive it. Four fixed sections, each with the exact conductor command and how to read its output.\n---\n\nArmada never calls a runtime. This guide tells the coordinator how to launch, message, check and stop a worker with the `conductor` command line tool, and what to record in Armada afterwards. It was checked against `conductor` 0.89.x (the desktop app's CLI, macOS) and 0.1.x (the CLI inside a Conductor Cloud workspace, Linux); every command below works in both. `conductor --version` prints yours; if a flag is refused, compare with `conductor <command> --help`.\n\n- On a Mac, the app ships the CLI at `/Applications/Conductor.app/Contents/Resources/bin/conductor`, which is not on PATH. `armada doctor` looks for it and prints the fix: a link from a directory already on PATH (`ln -s \"/Applications/Conductor.app/Contents/Resources/bin/conductor\" ~/.local/bin/conductor`), or a PATH line for your shell profile.\n- Always pass `--json` and read fields with `jq`. Exit codes: 0 ok, 1 runtime error, 2 usage error, 3 authentication, 4 server error.\n- On exit code 3, `conductor auth whoami` checks the token the CLI uses (it exits 0 when the token works). Do not rely on `conductor auth status`: it only looks for a macOS Keychain entry and fails on Linux (\"Keychain storage is only supported on macOS\"). In a Conductor Cloud workspace the CLI reads `CONDUCTOR_API_KEY` from the environment and needs no login; on a Mac, `conductor auth login` stores a token in the Keychain.\n- A worker is one workspace with one session. Its Armada handle is `<workspaceId>/<sessionId>`; the worker's claim comment carries it, so `armada status` and the ticket always lead back to the session.\n- A worker needs no key in its workspace: the prompt of `armada brief` carries a one-time launch token, and the worker's first command exchanges it for a session limited to its ticket, through which Armada gives each command its keys. The token works once, within the hour, so a copy left in a transcript is useless once used.\n- Never type a secret value into a command, a file or a message: name the variable and let your shell expand it. The expanded value is still in the `conductor` process's arguments while it runs, so launch from a machine only you use.\n\n## Launch\n\n1. Pick a ready ticket from `armada status` that does not collide with work in flight.\n2. Read the ticket and parent, then choose its profile. A matching label rule wins; otherwise match the profiles' `when` rules by most files/work. Mixed front-end/back-end work: choose the larger part and say why with `--profile <name> --reason \"<why>\"`. An optional `armada brief ABC-12` or `--json` preview helps resolve the choice and warnings, but is read-only: neither creates a launch token nor marks a worker in flight. If the choice is still needed, `--prompt` refuses before minting anything.\n3. **Make one brief call for the launch:** `--prompt --profile-line` writes only the worker prompt to stdout and the selected profile (agent, model, effort, fast mode, runtime and reason) to stderr. Read that line to configure Conductor; no second brief is needed for the profile. Keep any `--profile` and `--reason` flags on this call. Resolve warnings before launching. Never cut a launch message from the human view or `--json`: they carry no token. Write the prompt to a file only you can read, then add what only you know (the boundary with a parallel worker, a decision not yet on the ticket). The token works once, within the hour; if you cancel or the runtime launch fails, use `armada launch revoke ABC-12`. Generate a fresh prompt if its token has expired.\n\n```sh\n(umask 077; armada brief ABC-12 --prompt --profile-line > /tmp/abc-12-brief.md)\n```\n\n4. Create the workspace with every value from the profile. Never leave the agent, model or effort to Conductor's defaults. Add `--fast-mode` when the profile says fast mode. Run the whole block as one command: shell state does not carry over between separate calls.\n\n```sh\nconductor --json workspace create \\\n --repo-url https://github.com/<owner>/<name> \\\n --branch main \\\n --name \"ABC-12 <short title>\" \\\n --agent claude --model opus-5-5-1m --effort high \\\n --message-file - \\\n --env ARMADA_TICKET=ABC-12 \\\n < /tmp/abc-12-brief.md > /tmp/abc-12-launch.json\nrm -f /tmp/abc-12-brief.md\njq -r '\"\\(.workspaceId)/\\(.sessionId)\"' /tmp/abc-12-launch.json\n```\n\nIf the prompt has no launch token, its stderr warning says why. Not signed in: `armada login` (a headless coordinator sets `ARMADA_API_KEY`), then generate a new prompt; `armada doctor` checks the sign-in. Only on an Armada that keeps no keys yet (no accounts or no vault), pass the keys the read-only brief's environment table marks `required`, from your shell or from Armada's credentials file (`in credentials file`: the `set -a` line loads it without printing it; drop it when every variable is set in your shell). The subshell keeps the keys out of the rest of your session. Without a launch token the worker is not signed in to Armada: its claims and reports reach Linear only, with a warning. When Conductor's organization environment still holds the keys, every workspace already has them: use the first block.\n\n```sh\n(\n set -a; . \"${XDG_CONFIG_HOME:-$HOME/.config}/armada/credentials\"; set +a\n [ -n \"$LINEAR_API_KEY\" ] || { echo \"LINEAR_API_KEY is missing\" >&2; exit 1; }\n conductor --json workspace create \\\n --repo-url https://github.com/<owner>/<name> \\\n --branch main \\\n --name \"ABC-12 <short title>\" \\\n --agent claude --model opus-5-5-1m --effort high \\\n --message-file - \\\n --env ARMADA_TICKET=ABC-12 \\\n --env LINEAR_API_KEY=\"$LINEAR_API_KEY\" \\\n < /tmp/abc-12-brief.md > /tmp/abc-12-launch.json\n)\nrm -f /tmp/abc-12-brief.md\n```\n\n- `--branch` is the base branch (the default branch). Conductor creates a branch named `conductor/<slug of --name>`; the brief tells the worker to rename it to the ticket's branch.\n- The output has `workspaceId`, `sessionId`, `deepLink` and `initialMessage` (`messageId`, `state: \"queued\"`). Keep the handle the `jq` line prints, and give the owner the `deepLink` when they want to watch.\n- Conductor sets `CONDUCTOR_WORKSPACE_ID` and `CONDUCTOR_SESSION_ID` inside the workspace, and signs `gh` in for the worker's pushes. The brief's first commands install your Armada version (`npm install -g`), sign in with the launch token (`armada login --launch-token`) and claim the ticket. `--env` values are not shown back by `workspace get`.\n- Keys in Conductor's organization environment reach every workspace, workers included: once Armada keeps the organization's keys, they belong on Armada's Keys page, not there.\n- An unknown agent, model or effort fails the command. Check the ids with `conductor model` (each agent's models, efforts and defaults) and fix the profile in `armada.toml`.\n\n5. **Check the claim.** Within a few minutes, `armada status` lists the ticket in flight, phase `planning`, runtime `Conductor`, and the ticket's claim comment reads `session: <workspaceId>/<sessionId>` and `profile: <name>`. No claim after `[policy] not_started_minutes` (ten by default): `armada watch` and `armada inbox` show a `not-started` entry; status lists it under \"Pending launches\" with `armada launch revoke ABC-12`. It says whether the worker never used its launch token (it never reached its login line) or signed in and stopped before its claim. An unused token expired more than an hour ago produces one `not started (token expired)` inbox notice, then clears. Exchanged launches without a claim stop being followed after 24 hours and remain revocable. Read the transcript (Status section). A worker whose launch token was refused (already used, or more than an hour old) needs a new one: `armada brief ABC-12 --prompt --profile-line` again, and message it only the `armada login --launch-token …` line of the new `--prompt` output (Message section). A worker cut off from Armada was revoked (Organization > Workers says by whom) or left idle for three days: ask the owner before you give a revoked worker a new token. If the worker cannot claim for another reason, fix the cause and message it; as a last resort record the handle yourself with `armada claim ABC-12 --runtime conductor --handle <workspaceId>/<sessionId> --profile <name>`, adding the brief's `--reason` for an override.\n\n## Message\n\n```sh\nprintf '%s\\n' \"Plan approved. Go on.\" | conductor --json message create --session <sessionId> --message-file -\nconductor --json message create --session <sessionId> --message-file - < /tmp/abc-12-answer.md\n```\n\nThe output is `{\"messageId\": …, \"state\": \"sent\"}`. Exit code 0 means Conductor accepted the message, not that the worker read it: check that the session turns `working`, then read its reply in the transcript. Use it to deliver an answer, a plan approval, or a heads-up that the default branch moved. Then record it in Armada: `armada answer <item> \"<answer>\"` for a question from `armada inbox`, `armada answer --note ABC-12 \"<message>\"` for a message the worker did not ask for.\n\n## Status\n\n```sh\nconductor --json session status <sessionId>\n```\n\nThe output is `{\"workspaceId\", \"sessionId\", \"status\", \"updatedAt\"}`. For a worker:\n\n- `working`: a turn is running. A silent worker that is `working` is busy (a long build or test run): leave it, and read the transcript if it stays silent past twice `policy.silence_minutes`.\n- `idle`: no turn is running. The worker finished its turn: it handed back, it waits for an answer, or it stopped without finishing. If `armada status` does not show it `ready-to-merge`, `awaiting-approval` or `blocked`, it has stopped: read its last reply, then message it to go on, or release and relaunch the ticket.\n- `error`: the last turn failed (agent or provider failure). Read the transcript and message it to resume; if it fails again, cancel, archive, release and relaunch.\n- Right after launch the session is `idle` for a few seconds while the workspace is initializing and the first message is queued; it turns `working` when the agent starts.\n\nThe workspace itself: `conductor --json workspace status <workspaceId>` gives `status` `initializing`, `ready` or `archived`.\n\n**Read the transcript** to see what a worker did or said. Events come oldest first, 100 per page; `hasMore` tells when to fetch the next page with `--after` the last event id. Keep the last id you read and poll from it.\n\n```sh\nconductor --json session message <sessionId> --limit 100 > /tmp/abc-12-events.json\njq -r '.hasMore, .data[-1].id' /tmp/abc-12-events.json\nconductor --json session message <sessionId> --after <lastEventId> --limit 100\n```\n\nThe second line prints whether more pages exist and the id to continue from. `.content.rawPayload` is the agent's own event format, so the filters depend on the worker's agent (the `agent` of its profile in `armada.toml`).\n\nA `claude` worker: each turn's final reply, then the commands and tools it ran.\n\n```sh\njq -r '.data[] | select(.content.rawPayload.type == \"result\") | .content.rawPayload | \"error=\\(.is_error)\\n\\(.result)\"' /tmp/abc-12-events.json\njq -r '.data[] | select(.content.rawPayload.type == \"assistant\") | .content.rawPayload.message.content[] | select(.type == \"tool_use\") | .input.command // .name' /tmp/abc-12-events.json\n```\n\nA `codex` worker: its events are `.content.rawPayload.event`, each item once as `item.started` and once as `item.completed`; read the completed ones. Its messages (`phase` is `commentary` along the way, `final_answer` at the end of a turn), then each command with its exit code, and its tool calls (Linear and other MCP servers).\n\n```sh\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"agentMessage\") | \"[\\(.phase)] \\(.text)\"' /tmp/abc-12-events.json\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"commandExecution\") | \"exit=\\(.exitCode) \\(.command)\"' /tmp/abc-12-events.json\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"mcpToolCall\") | \"\\(.server) \\(.tool)\"' /tmp/abc-12-events.json\n```\n\nAnother agent, or a filter that prints nothing: count the event types, look at one event of the type you need, and adapt the filter.\n\n```sh\njq -r '.data[].content.rawPayload | .type // .event.type // \"(no payload)\"' /tmp/abc-12-events.json | sort | uniq -c\n```\n\n## Stop and archive\n\n```sh\nconductor --json session cancel <sessionId>\nconductor --json workspace archive <workspaceId>\n```\n\n- `session cancel` stops the running turn: `{\"status\", \"canceledQueuedMessages\"}`, and the session is `idle` within seconds. The workspace stays; a message starts a new turn. Use it on a worker that runs the wrong thing.\n- `workspace archive` answers `{\"status\": \"archived\"}`. Archive a worker's workspace after its pull request is merged, or after `armada release --ticket ABC-12 --reason \"<why>\"` for a worker that stops without handing back. The branch and the pull request stay on GitHub.\n- **Wait for `idle` before archiving.** A hand-back often arrives while the worker's session is still `working`: `armada report ready-to-merge` runs inside its last turn, which then writes its final reply. Archive only once `session status` answers `idle`. Poll it every 15 seconds; if it is still `working` after 10 minutes, cancel the turn and archive (the transcript keeps what it was doing). Run the whole block as one command; it can take up to 10 minutes, so run it in the background or give it a longer command timeout:\n\n```sh\nfor i in $(seq 40); do\n [ \"$(conductor --json session status <sessionId> | jq -r .status)\" = working ] || break\n sleep 15\ndone\n[ \"$(conductor --json session status <sessionId> | jq -r .status)\" = working ] && conductor --json session cancel <sessionId>\nconductor --json workspace archive <workspaceId>\n```\n- After an archive, `session status` still answers `idle`; `workspace status` says `archived`.\n";
5506
+ 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\nThe brief starts `armada heartbeat --every 5m --parent \"$PPID\" --background` immediately after claim. It creates a detached process group (like `nohup` + `setsid`) with closed terminal streams and a PID file under `~/.config/armada/watch/`. Plain `&` and `nohup` alone can be killed by command-tool cleanup on Cloud; detached startup survives between turns and while waiting for a message. `$PPID` in the agent's command shell must be the persistent agent process, never `$$` (the shell). The heartbeat stops with that parent or when Armada ends the current session (release, merge, revoke). If startup fails or the runtime cannot retain any background process, fall back to manual reports at least every 15 minutes and record that fallback on the ticket. Reports remain progress dots, not liveness.\n\n1. Pick a ready ticket from `armada status` that does not collide with work in flight.\n2. Read the ticket and parent, then choose its profile. A matching label rule wins; otherwise match the profiles' `when` rules by most files/work. Mixed front-end/back-end work: choose the larger part and say why with `--profile <name> --reason \"<why>\"`. An optional `armada brief ABC-12` or `--json` preview helps resolve the choice and warnings, but is read-only: neither creates a launch token nor marks a worker in flight. If the choice is still needed, `--prompt` refuses before minting anything.\n3. **Make one brief call for the launch:** `--prompt --profile-line` writes only the worker prompt to stdout and the selected profile (agent, model, effort, fast mode, runtime and reason) to stderr. Read that line to configure Conductor; no second brief is needed for the profile. Keep any `--profile` and `--reason` flags on this call. Resolve warnings before launching. Never cut a launch message from the human view or `--json`: they carry no token. Write the prompt to a file only you can read, then add what only you know (the boundary with a parallel worker, a decision not yet on the ticket). The token works once, within the hour; if you cancel or the runtime launch fails, use `armada launch revoke ABC-12`. Generate a fresh prompt if its token has expired.\n\n```sh\n(umask 077; armada brief ABC-12 --prompt --profile-line > /tmp/abc-12-brief.md)\n```\n\n4. Create the workspace with every value from the profile. Never leave the agent, model or effort to Conductor's defaults. Add `--fast-mode` when the profile says fast mode. Run the whole block as one command: shell state does not carry over between separate calls.\n\n```sh\nconductor --json workspace create \\\n --repo-url https://github.com/<owner>/<name> \\\n --branch main \\\n --name \"ABC-12 <short title>\" \\\n --agent claude --model opus-5-5-1m --effort high \\\n --message-file - \\\n --env ARMADA_TICKET=ABC-12 \\\n < /tmp/abc-12-brief.md > /tmp/abc-12-launch.json\nrm -f /tmp/abc-12-brief.md\njq -r '\"\\(.workspaceId)/\\(.sessionId)\"' /tmp/abc-12-launch.json\n```\n\nIf the prompt has no launch token, its stderr warning says why. Not signed in: `armada login` (a headless coordinator sets `ARMADA_API_KEY`), then generate a new prompt; `armada doctor` checks the sign-in. Only on an Armada that keeps no keys yet (no accounts or no vault), pass the keys the read-only brief's environment table marks `required`, from your shell or from Armada's credentials file (`in credentials file`: the `set -a` line loads it without printing it; drop it when every variable is set in your shell). The subshell keeps the keys out of the rest of your session. Without a launch token the worker is not signed in to Armada: its claims and reports reach Linear only, with a warning. When Conductor's organization environment still holds the keys, every workspace already has them: use the first block.\n\n```sh\n(\n set -a; . \"${XDG_CONFIG_HOME:-$HOME/.config}/armada/credentials\"; set +a\n [ -n \"$LINEAR_API_KEY\" ] || { echo \"LINEAR_API_KEY is missing\" >&2; exit 1; }\n conductor --json workspace create \\\n --repo-url https://github.com/<owner>/<name> \\\n --branch main \\\n --name \"ABC-12 <short title>\" \\\n --agent claude --model opus-5-5-1m --effort high \\\n --message-file - \\\n --env ARMADA_TICKET=ABC-12 \\\n --env LINEAR_API_KEY=\"$LINEAR_API_KEY\" \\\n < /tmp/abc-12-brief.md > /tmp/abc-12-launch.json\n)\nrm -f /tmp/abc-12-brief.md\n```\n\n- `--branch` is the base branch (the default branch). Conductor creates a branch named `conductor/<slug of --name>`; the brief tells the worker to rename it to the ticket's branch.\n- The output has `workspaceId`, `sessionId`, `deepLink` and `initialMessage` (`messageId`, `state: \"queued\"`). Keep the handle the `jq` line prints, and give the owner the `deepLink` when they want to watch.\n- Conductor sets `CONDUCTOR_WORKSPACE_ID` and `CONDUCTOR_SESSION_ID` inside the workspace, and signs `gh` in for the worker's pushes. The brief's first commands install your Armada version (`npm install -g`), sign in with the launch token (`armada login --launch-token`) and claim the ticket. `--env` values are not shown back by `workspace get`.\n- Keys in Conductor's organization environment reach every workspace, workers included: once Armada keeps the organization's keys, they belong on Armada's Keys page, not there.\n- An unknown agent, model or effort fails the command. Check the ids with `conductor model` (each agent's models, efforts and defaults) and fix the profile in `armada.toml`.\n\n5. **Check the claim.** Within a few minutes, `armada status` lists the ticket in flight, phase `planning`, runtime `Conductor`, and the ticket's claim comment reads `session: <workspaceId>/<sessionId>` and `profile: <name>`. No claim after `[policy] not_started_minutes` (ten by default): `armada watch` and `armada inbox` show a `not-started` entry; status lists it under \"Pending launches\" with `armada launch revoke ABC-12`. It says whether the worker never used its launch token (it never reached its login line) or signed in and stopped before its claim. An unused token expired more than an hour ago produces one `not started (token expired)` inbox notice, then clears. Exchanged launches without a claim stop being followed after 24 hours and remain revocable. Read the transcript (Status section). A worker whose launch token was refused (already used, or more than an hour old) needs a new one: `armada brief ABC-12 --prompt --profile-line` again, and message it only the `armada login --launch-token …` line of the new `--prompt` output (Message section). A worker cut off from Armada was revoked (Organization > Workers says by whom) or left idle for three days: ask the owner before you give a revoked worker a new token. If the worker cannot claim for another reason, fix the cause and message it; as a last resort record the handle yourself with `armada claim ABC-12 --runtime conductor --handle <workspaceId>/<sessionId> --profile <name>`, adding the brief's `--reason` for an override.\n\n## Message\n\n```sh\nprintf '%s\\n' \"Plan approved. Go on.\" | conductor --json message create --session <sessionId> --message-file -\nconductor --json message create --session <sessionId> --message-file - < /tmp/abc-12-answer.md\n```\n\nThe output is `{\"messageId\": …, \"state\": \"sent\"}`. Exit code 0 means Conductor accepted the message, not that the worker read it: check that the session turns `working`, then read its reply in the transcript. Use it to deliver an answer, a plan approval, or a heads-up that the default branch moved. Then record it in Armada: `armada answer <item> \"<answer>\"` for a question from `armada inbox`, `armada answer --note ABC-12 \"<message>\"` for a message the worker did not ask for.\n\n## Status\n\n```sh\nconductor --json session status <sessionId>\n```\n\nThe output is `{\"workspaceId\", \"sessionId\", \"status\", \"updatedAt\"}`. For a worker:\n\n- `working`: a turn is running. A silent worker that is `working` is busy (a long build or test run): leave it, and read the transcript if it stays silent past twice `policy.silence_minutes`.\n- `idle`: no turn is running. The worker finished its turn: it handed back, it waits for an answer, or it stopped without finishing. If `armada status` does not show it `ready-to-merge`, `awaiting-approval` or `blocked`, it has stopped: read its last reply, then message it to go on, or release and relaunch the ticket.\n- `error`: the last turn failed (agent or provider failure). Read the transcript and message it to resume; if it fails again, cancel, archive, release and relaunch.\n- Right after launch the session is `idle` for a few seconds while the workspace is initializing and the first message is queued; it turns `working` when the agent starts.\n\nThe workspace itself: `conductor --json workspace status <workspaceId>` gives `status` `initializing`, `ready` or `archived`.\n\n**Read the transcript** to see what a worker did or said. Events come oldest first, 100 per page; `hasMore` tells when to fetch the next page with `--after` the last event id. Keep the last id you read and poll from it.\n\n```sh\nconductor --json session message <sessionId> --limit 100 > /tmp/abc-12-events.json\njq -r '.hasMore, .data[-1].id' /tmp/abc-12-events.json\nconductor --json session message <sessionId> --after <lastEventId> --limit 100\n```\n\nThe second line prints whether more pages exist and the id to continue from. `.content.rawPayload` is the agent's own event format, so the filters depend on the worker's agent (the `agent` of its profile in `armada.toml`).\n\nA `claude` worker: each turn's final reply, then the commands and tools it ran.\n\n```sh\njq -r '.data[] | select(.content.rawPayload.type == \"result\") | .content.rawPayload | \"error=\\(.is_error)\\n\\(.result)\"' /tmp/abc-12-events.json\njq -r '.data[] | select(.content.rawPayload.type == \"assistant\") | .content.rawPayload.message.content[] | select(.type == \"tool_use\") | .input.command // .name' /tmp/abc-12-events.json\n```\n\nA `codex` worker: its events are `.content.rawPayload.event`, each item once as `item.started` and once as `item.completed`; read the completed ones. Its messages (`phase` is `commentary` along the way, `final_answer` at the end of a turn), then each command with its exit code, and its tool calls (Linear and other MCP servers).\n\n```sh\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"agentMessage\") | \"[\\(.phase)] \\(.text)\"' /tmp/abc-12-events.json\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"commandExecution\") | \"exit=\\(.exitCode) \\(.command)\"' /tmp/abc-12-events.json\njq -r '.data[] | .content.rawPayload.event | select(.type == \"item.completed\") | .item | select(.type == \"mcpToolCall\") | \"\\(.server) \\(.tool)\"' /tmp/abc-12-events.json\n```\n\nAnother agent, or a filter that prints nothing: count the event types, look at one event of the type you need, and adapt the filter.\n\n```sh\njq -r '.data[].content.rawPayload | .type // .event.type // \"(no payload)\"' /tmp/abc-12-events.json | sort | uniq -c\n```\n\n## Stop and archive\n\n```sh\nconductor --json session cancel <sessionId>\nconductor --json workspace archive <workspaceId>\n```\n\n- `session cancel` stops the running turn: `{\"status\", \"canceledQueuedMessages\"}`, and the session is `idle` within seconds. The workspace stays; a message starts a new turn. Use it on a worker that runs the wrong thing.\n- `workspace archive` answers `{\"status\": \"archived\"}`. Archive a worker's workspace after its pull request is merged, or after `armada release --ticket ABC-12 --reason \"<why>\"` for a worker that stops without handing back. The branch and the pull request stay on GitHub.\n- **Wait for `idle` before archiving.** A hand-back often arrives while the worker's session is still `working`: `armada report ready-to-merge` runs inside its last turn, which then writes its final reply. Archive only once `session status` answers `idle`. Poll it every 15 seconds; if it is still `working` after 10 minutes, cancel the turn and archive (the transcript keeps what it was doing). Run the whole block as one command; it can take up to 10 minutes, so run it in the background or give it a longer command timeout:\n\n```sh\nfor i in $(seq 40); do\n [ \"$(conductor --json session status <sessionId> | jq -r .status)\" = working ] || break\n sleep 15\ndone\n[ \"$(conductor --json session status <sessionId> | jq -r .status)\" = working ] && conductor --json session cancel <sessionId>\nconductor --json workspace archive <workspaceId>\n```\n- After an archive, `session status` still answers `idle`; `workspace status` says `archived`.\n";
5443
5507
 
5444
5508
  // ../../skills/armada-worker/SKILL.md
5445
5509
  var SKILL_default4 = `---
5446
5510
  name: armada-worker
5447
- description: Working one ticket as an Armada worker agent. Use when you were launched on a ticket by an Armada coordinator, or asked to claim, plan, implement and ship one ticket of a project that has an armada.toml. Covers the claim, the phase reports every 15 minutes, questions to the coordinator, the green pull request and the hand-back. A worker never merges.
5511
+ description: Working one ticket as an Armada worker agent. Use when you were launched on a ticket by an Armada coordinator, or asked to claim, plan, implement and ship one ticket of a project that has an armada.toml. Covers the claim, background liveness, progress reports, questions to the coordinator, the green pull request and the hand-back. A worker never merges.
5448
5512
  ---
5449
5513
 
5450
5514
  You are a worker. You own exactly one ticket, named in your launch brief. You turn it into one green pull request and hand it back to the coordinator, who merges. \`armada.toml\` at the repository root names the tracker program, the label groups and the policy; \`AGENTS.md\` (or \`CLAUDE.md\`) holds the repository's own rules, and they win over this skill where they are stricter.
@@ -5452,7 +5516,8 @@ You are a worker. You own exactly one ticket, named in your launch brief. You tu
5452
5516
  ## Rules
5453
5517
 
5454
5518
  - **Never merge**, never enable auto-merge, never approve your own plan. The coordinator merges.
5455
- - **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.
5519
+ - **Start the heartbeat right after claim**, using the line in your brief. It pings Armada only, never Linear. Conductor's \`--background\` detaches it and keeps a PID file: it survives between turns and while waiting for a message. Pass the persistent agent PID, \`$PPID\` in its command shell, not the short-lived shell \`$$\`. On Claude Code use the subagent's background Bash without \`--background\`: it dies with the subagent, as intended. If startup fails or the runtime cannot retain any background process, fall back to manual reports at least every 15 minutes and say so on the ticket. Older CLIs keep that manual rule too.
5520
+ - **Report at each real step** with \`armada report <phase> --message "<what changed, what is next>"\`: the plan, meaningful implementation progress, blockers, tests, shipping and hand-back. The same phase is allowed. Reports are progress, not liveness: \`policy.silence_minutes\` measures missing heartbeats (15 by default); \`policy.quiet_minutes\` is a coordinator-only reminder for a live worker without a report (45 by default). Never post empty reports just to look alive.
5456
5521
  - **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.
5457
5522
  - **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.
5458
5523
  - **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.
@@ -5848,6 +5913,7 @@ ${SHIP_ARTIFACTS}
5848
5913
  return plan;
5849
5914
  }
5850
5915
  var planIsEmpty = (p) => !p.writes.length && !p.removes.length && !p.links.length;
5916
+
5851
5917
  // ../core/src/status.ts
5852
5918
  var STATUS_SCHEMA_VERSION = 1;
5853
5919
  function routeOf(config, labels) {
@@ -5860,6 +5926,7 @@ function buildStatus({
5860
5926
  forge,
5861
5927
  forgeError = null,
5862
5928
  lastEvents,
5929
+ heartbeats,
5863
5930
  live,
5864
5931
  launches = [],
5865
5932
  extraWarnings = [],
@@ -5871,6 +5938,7 @@ function buildStatus({
5871
5938
  now: now.getTime(),
5872
5939
  silentAfterMinutes: config.policy.silentAfterMinutes,
5873
5940
  ...lastEvents ? { lastEvents } : {},
5941
+ ...heartbeats ? { heartbeats } : {},
5874
5942
  ...live ? { live } : {}
5875
5943
  });
5876
5944
  const phaseOf = new Map(lanes.map((l) => [l.issue.id, l.phase]));
@@ -5920,6 +5988,7 @@ function buildStatus({
5920
5988
  since: l.since,
5921
5989
  lastUpdate: l.lastUpdate,
5922
5990
  lastReport: l.lastReport,
5991
+ lastHeartbeat: l.lastHeartbeat,
5923
5992
  silent: l.flags.includes("silent"),
5924
5993
  statusLine: l.statusLine ? { summary: l.statusLine.summary, at: l.statusLine.at, url: l.statusLine.url, plan: l.statusLine.plan } : null,
5925
5994
  pr: l.pr ? prRef(l.pr) : null,
@@ -5983,10 +6052,13 @@ async function loadStatus(config, opts) {
5983
6052
  const launchesP = opts.launches ? opts.launches().then((launches) => ({ launches }), (err) => ({
5984
6053
  warning: `Armada's launches could not be read (${err instanceof Error ? err.message : String(err)}); workers launched that never started are not listed`
5985
6054
  })) : Promise.resolve({});
5986
- const [{ program, forge, forgeError }, events, launches] = await Promise.all([
6055
+ const [{ program, forge, forgeError }, events, launches, heartbeats] = await Promise.all([
5987
6056
  readStatusSources(config, opts),
5988
6057
  eventsP,
5989
- launchesP
6058
+ launchesP,
6059
+ opts.heartbeats?.().catch(() => {
6060
+ return;
6061
+ })
5990
6062
  ]);
5991
6063
  return buildStatus({
5992
6064
  config,
@@ -5994,13 +6066,14 @@ async function loadStatus(config, opts) {
5994
6066
  forge,
5995
6067
  forgeError,
5996
6068
  ...events.events ? { lastEvents: events.events } : {},
6069
+ ...heartbeats ? { heartbeats } : {},
5997
6070
  ...launches.launches ? { launches: launches.launches } : {},
5998
6071
  extraWarnings: [events.warning, launches.warning].filter((w) => !!w),
5999
6072
  now: now()
6000
6073
  });
6001
6074
  }
6002
6075
  // package.json
6003
- var version = "0.2.19";
6076
+ var version = "0.2.21";
6004
6077
 
6005
6078
  // src/attach.ts
6006
6079
  import { resolve } from "node:path";
@@ -6557,7 +6630,11 @@ function liveFleet(io, config, credentials) {
6557
6630
  }
6558
6631
  function statusLive(io, config, credentials) {
6559
6632
  const { fleet } = liveFleet(io, config, credentials);
6560
- return fleet ? { lastEvents: () => fleet.lastEventTimes(), launches: () => fleet.pendingLaunches() } : undefined;
6633
+ return fleet ? {
6634
+ lastEvents: () => fleet.lastEventTimes(),
6635
+ heartbeats: () => fleet.heartbeatTimes(),
6636
+ launches: () => fleet.pendingLaunches()
6637
+ } : undefined;
6561
6638
  }
6562
6639
  function currentTicket(io, config, explicit, workers = []) {
6563
6640
  const fromEnv = io.env.ARMADA_TICKET?.trim();
@@ -6827,7 +6904,7 @@ function renderInbox(r, next) {
6827
6904
  `)}
6828
6905
  `;
6829
6906
  }
6830
- async function inbox2(io, config, credentials, a) {
6907
+ async function inbox(io, config, credentials, a) {
6831
6908
  if (a.rest.length)
6832
6909
  throw new UsageError(`unexpected argument ${a.rest[0]}`);
6833
6910
  const wait = a.options.wait === "true";
@@ -6843,6 +6920,7 @@ async function inbox2(io, config, credentials, a) {
6843
6920
  coordinator: coordinatorHandle(io),
6844
6921
  facts: detectCoordinator(io),
6845
6922
  silentAfterMinutes: config.policy.silentAfterMinutes,
6923
+ quietAfterMinutes: config.policy.quietAfterMinutes,
6846
6924
  notStartedMinutes: config.policy.notStartedMinutes,
6847
6925
  now: io.now ?? (() => new Date),
6848
6926
  ...wait ? { wait: { timeoutMs, sleep: io.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms))) } } : {}
@@ -6935,7 +7013,7 @@ var shown = (io, items, inFlight) => ({
6935
7013
  ...inFlight ? { inFlight, readAt: now(io).toISOString() } : {},
6936
7014
  stopped: null
6937
7015
  });
6938
- async function watch2(io, config, credentials, a, configPath) {
7016
+ async function watch(io, config, credentials, a, configPath) {
6939
7017
  if (a.rest.length)
6940
7018
  throw new UsageError(`unexpected argument ${a.rest[0]}`);
6941
7019
  const project = config.project.slug;
@@ -6972,6 +7050,7 @@ async function watchUntil(io, config, credentials, json, configPath) {
6972
7050
  coordinator: coordinatorHandle(io),
6973
7051
  facts: detectCoordinator(io),
6974
7052
  silentAfterMinutes: config.policy.silentAfterMinutes,
7053
+ quietAfterMinutes: config.policy.quietAfterMinutes,
6975
7054
  notStartedMinutes: config.policy.notStartedMinutes,
6976
7055
  seen: before?.seen ?? [],
6977
7056
  now: io.now ?? (() => new Date),
@@ -7108,7 +7187,7 @@ function launcher(io, config, credentials) {
7108
7187
  }
7109
7188
  };
7110
7189
  }
7111
- async function brief2(io, config, credentials, a, version, configPath) {
7190
+ async function brief(io, config, credentials, a, version, configPath) {
7112
7191
  const [ticket, ...extra] = a.rest;
7113
7192
  if (!ticket)
7114
7193
  throw new UsageError('brief needs a ticket: armada brief <ticket> [--profile <name> [--reason "<why>"]]');
@@ -7545,6 +7624,93 @@ async function doctor(io, json, armadaVersion) {
7545
7624
  return report.errors ? 1 : 0;
7546
7625
  }
7547
7626
 
7627
+ // src/heartbeat.ts
7628
+ import { createHash as createHash3 } from "node:crypto";
7629
+ async function heartbeat(io, config, credentials, args) {
7630
+ if (args.rest.length)
7631
+ throw new UsageError("heartbeat takes no positional argument");
7632
+ const interval = args.options.every ?? "5m";
7633
+ const match = interval.match(/^(\d+(?:\.\d+)?)(s|m)$/);
7634
+ const everyMs = match ? Number(match[1]) * (match[2] === "m" ? 60000 : 1000) : 0;
7635
+ if (!Number.isFinite(everyMs) || everyMs < 1000 || everyMs > config.policy.silentAfterMinutes * 60000)
7636
+ throw new UsageError("--every needs seconds or minutes, at least 1s and no longer than policy.silence_minutes");
7637
+ const parent = Number(args.options.parent);
7638
+ if (!Number.isSafeInteger(parent) || parent <= 1)
7639
+ throw new UsageError('--parent needs the persistent agent PID (pass --parent "$PPID" from its command shell)');
7640
+ const ticket = currentTicket(io, config, args.options.ticket, credentials.armadaSignIn?.kind === "worker" ? [credentials.armadaSignIn.ticket] : []);
7641
+ const handle = args.options.handle || (io.env.CONDUCTOR_WORKSPACE_ID && io.env.CONDUCTOR_SESSION_ID ? `${io.env.CONDUCTOR_WORKSPACE_ID}/${io.env.CONDUCTOR_SESSION_ID}` : null);
7642
+ if (!handle)
7643
+ throw new UsageError("heartbeat needs --handle <claim-handle> outside Conductor");
7644
+ const alive = () => !io.stopped?.() && (io.processAlive ?? processAlive)(parent);
7645
+ if (!alive())
7646
+ throw new UsageError("the heartbeat parent no longer runs");
7647
+ const { fleet } = liveFleet(io, config, credentials);
7648
+ if (!fleet)
7649
+ throw new UsageError("heartbeat needs an Armada sign-in; use manual reports at least every 15 minutes");
7650
+ if (args.options.background === "true") {
7651
+ let started = false;
7652
+ try {
7653
+ started = await io.startBackground?.([
7654
+ "heartbeat",
7655
+ "--ticket",
7656
+ ticket,
7657
+ "--handle",
7658
+ handle,
7659
+ "--every",
7660
+ interval,
7661
+ "--parent",
7662
+ String(parent),
7663
+ ...args.config ? ["--config", args.config] : []
7664
+ ]) ?? false;
7665
+ } catch {}
7666
+ if (!started) {
7667
+ io.stderr(`armada: background heartbeat unavailable; report manually at least every 15 minutes.
7668
+ `);
7669
+ return 1;
7670
+ }
7671
+ io.stdout(`Heartbeat running in the background for ${ticket} (every ${interval}, parent ${parent}).
7672
+ `);
7673
+ return 0;
7674
+ }
7675
+ const paths = machinePaths(io.env);
7676
+ if (!paths)
7677
+ throw new UsageError("heartbeat needs HOME or XDG_CONFIG_HOME for its PID file");
7678
+ const pid = io.pid ?? process.pid;
7679
+ let lock = null;
7680
+ let ready = false;
7681
+ try {
7682
+ const result = await heartbeatLoop({
7683
+ ticket,
7684
+ handle,
7685
+ everyMs,
7686
+ now: io.now ?? (() => new Date),
7687
+ sleep: io.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms))),
7688
+ parentAlive: alive,
7689
+ ping: (input) => fleet.heartbeat(input),
7690
+ ready: async (session) => {
7691
+ const name = `${config.project.slug}-heartbeat-${ticket.toLowerCase()}-${createHash3("sha256").update(`${handle}/${session.claimedAt}`).digest("hex").slice(0, 12)}`;
7692
+ const acquired = await takeWatchLock(paths, name, pid, io.processAlive ?? processAlive);
7693
+ if (acquired.taken)
7694
+ lock = name;
7695
+ ready = true;
7696
+ io.backgroundReady?.(true);
7697
+ return acquired.taken;
7698
+ }
7699
+ });
7700
+ if (!ready)
7701
+ io.backgroundReady?.(false);
7702
+ return result === "session-ended" && !ready ? 1 : 0;
7703
+ } catch {
7704
+ io.backgroundReady?.(false);
7705
+ io.stderr(`armada: heartbeat unavailable; report manually at least every 15 minutes.
7706
+ `);
7707
+ return 1;
7708
+ } finally {
7709
+ if (lock)
7710
+ await releaseWatchLock(paths, lock, pid);
7711
+ }
7712
+ }
7713
+
7548
7714
  // src/init.ts
7549
7715
  import { mkdtemp, realpath, rm as rm3 } from "node:fs/promises";
7550
7716
  import { tmpdir } from "node:os";
@@ -7936,7 +8102,7 @@ function render(o) {
7936
8102
  `)}
7937
8103
  `;
7938
8104
  }
7939
- async function merge2(io, config, credentials, a, configPath) {
8105
+ async function merge(io, config, credentials, a, configPath) {
7940
8106
  const [arg, ...extra] = a.rest;
7941
8107
  if (extra.length)
7942
8108
  throw new UsageError(`unexpected argument ${extra[0]}`);
@@ -8024,10 +8190,10 @@ async function merge2(io, config, credentials, a, configPath) {
8024
8190
  }
8025
8191
 
8026
8192
  // src/render.ts
8027
- var MIN4 = 60000;
8193
+ var MIN3 = 60000;
8028
8194
  function relative2(iso, now) {
8029
8195
  const diff = now - Date.parse(iso);
8030
- const m = Math.round(Math.abs(diff) / MIN4);
8196
+ const m = Math.round(Math.abs(diff) / MIN3);
8031
8197
  const suffix = diff >= 0 ? "ago" : "from now";
8032
8198
  if (m < 1)
8033
8199
  return "just now";
@@ -8409,6 +8575,11 @@ var COMMAND_HELP = {
8409
8575
  Privately attach PNG, JPEG, WebP or GIF images (up to 2 MB each),
8410
8576
  or HTTPS links. Prints a dashboard URL for each attachment.
8411
8577
  --for keeps a free reference for an owner validation item
8578
+ `,
8579
+ heartbeat: ` heartbeat --every 5m --parent <agent-pid> [--background] [--ticket <id>] [--handle <id>]
8580
+ Keep the current worker session alive through Armada only, with no
8581
+ Linear comment. Stops with the parent or the released/revoked session.
8582
+ --background detaches from the command shell and keeps a PID file
8412
8583
  `,
8413
8584
  status: ` status Tickets in flight, tickets ready to start and pull requests waiting
8414
8585
  status --all The same for every project registered by \`armada init\`
@@ -8615,6 +8786,8 @@ Options:
8615
8786
  ${options.join("")}`;
8616
8787
  }
8617
8788
  var VALUE_OPTIONS = [
8789
+ "every",
8790
+ "parent",
8618
8791
  "runtime",
8619
8792
  "handle",
8620
8793
  "branch",
@@ -8641,6 +8814,7 @@ var VALUE_OPTIONS = [
8641
8814
  "for"
8642
8815
  ];
8643
8816
  var FLAG_OPTIONS = [
8817
+ "background",
8644
8818
  "dry-run",
8645
8819
  "no-lock",
8646
8820
  "no-ticket",
@@ -8655,6 +8829,7 @@ var FLAG_OPTIONS = [
8655
8829
  ];
8656
8830
  var COMMAND_OPTIONS = {
8657
8831
  attach: ["caption", "for"],
8832
+ heartbeat: ["every", "parent", "background", "ticket", "handle"],
8658
8833
  claim: ["runtime", "handle", "branch", "profile", "reason"],
8659
8834
  report: ["ticket", "message", "message-file", "plan", "plan-file", "pr", "sha"],
8660
8835
  release: ["ticket", "reason"],
@@ -8734,7 +8909,7 @@ async function findConfig(io, explicit, command = "status") {
8734
8909
  }
8735
8910
  throw new UsageError(`no ${CONFIG_FILE} found in ${io.cwd} or any parent directory, so this is not a repository Armada runs`, `armada init to set this repository up, armada ${command} --config <file> to use another ${CONFIG_FILE}, or armada status --all to see the registered projects`);
8736
8911
  }
8737
- async function status2(io, args) {
8912
+ async function status(io, args) {
8738
8913
  const { path, text } = await findConfig(io, args.config, "status");
8739
8914
  const config = parseConfig(text, path);
8740
8915
  const { credentials } = await loadCredentials(io, { project: config.project.slug });
@@ -8845,7 +9020,20 @@ async function dispatch(argv, io) {
8845
9020
  });
8846
9021
  return await attachCommand(io, config, credentials, args);
8847
9022
  }
8848
- const worker = { claim, report, release, ask, inbox: inbox2, answer }[args.command];
9023
+ if (args.command === "heartbeat") {
9024
+ const { path, text } = await findConfig(io, args.config, "heartbeat");
9025
+ const config = parseConfig(text, path);
9026
+ const { credentials } = await loadCredentials(io, {
9027
+ armada: false,
9028
+ worker: {
9029
+ command: "heartbeat",
9030
+ project: config.project.slug,
9031
+ ticket: (stored) => currentTicket(io, config, args.options.ticket, stored)
9032
+ }
9033
+ });
9034
+ return await heartbeat(io, config, credentials, args);
9035
+ }
9036
+ const worker = { claim, report, release, ask, inbox, answer }[args.command];
8849
9037
  if (worker) {
8850
9038
  const { path, text } = await findConfig(io, args.config, args.command);
8851
9039
  const config = parseConfig(text, path);
@@ -8865,7 +9053,7 @@ async function dispatch(argv, io) {
8865
9053
  const config = parseConfig(text, path);
8866
9054
  const { credentials } = await loadCredentials(io, { project: config.project.slug });
8867
9055
  await recordPresence(io, config, credentials);
8868
- return await watch2(io, config, credentials, args, path);
9056
+ return await watch(io, config, credentials, args, path);
8869
9057
  }
8870
9058
  if (args.command === "hook")
8871
9059
  return await hookStop(io, args.rest, (at) => findConfig(at, null, "hook"));
@@ -8874,7 +9062,7 @@ async function dispatch(argv, io) {
8874
9062
  const config = parseConfig(text, path);
8875
9063
  const { credentials } = await loadCredentials(io, { project: config.project.slug });
8876
9064
  await recordPresence(io, config, credentials);
8877
- return await merge2(io, config, credentials, args, path);
9065
+ return await merge(io, config, credentials, args, path);
8878
9066
  }
8879
9067
  if (args.command === "brief") {
8880
9068
  const { path, text } = await findConfig(io, args.config, "brief");
@@ -8882,7 +9070,7 @@ async function dispatch(argv, io) {
8882
9070
  const { credentials } = await loadCredentials(io, { project: config.project.slug });
8883
9071
  if (args.options.prompt === "true")
8884
9072
  await recordPresence(io, config, credentials);
8885
- return await brief2(io, config, credentials, args, version, path);
9073
+ return await brief(io, config, credentials, args, version, path);
8886
9074
  }
8887
9075
  if (args.command === "launch") {
8888
9076
  const { path, text } = await findConfig(io, args.config, "launch");
@@ -8892,7 +9080,7 @@ async function dispatch(argv, io) {
8892
9080
  }
8893
9081
  if (args.command === "status") {
8894
9082
  noExtra(args.rest);
8895
- return await (args.all ? statusAll(io, args.json) : status2(io, args));
9083
+ return await (args.all ? statusAll(io, args.json) : status(io, args));
8896
9084
  }
8897
9085
  if (args.command === "doctor") {
8898
9086
  noExtra(args.rest);
@@ -9002,6 +9190,33 @@ var spawnInherited = (command, args, { cwd, env }) => new Promise((done, fail) =
9002
9190
  done(code ?? 128 + (signal ? constants.signals[signal] ?? 0 : 0));
9003
9191
  });
9004
9192
  });
9193
+ var startBackground = (args) => new Promise((resolve) => {
9194
+ if (process.platform === "win32")
9195
+ return resolve(false);
9196
+ const child = spawn(process.execPath, [...process.execArgv, process.argv[1], ...args], {
9197
+ cwd: process.cwd(),
9198
+ env: process.env,
9199
+ detached: true,
9200
+ stdio: ["ignore", "ignore", "ignore", "ipc"]
9201
+ });
9202
+ let settled = false;
9203
+ const finish = (ready) => {
9204
+ if (settled)
9205
+ return;
9206
+ settled = true;
9207
+ clearTimeout(timeout);
9208
+ if (!ready)
9209
+ child.kill("SIGTERM");
9210
+ if (child.connected)
9211
+ child.disconnect();
9212
+ child.unref();
9213
+ resolve(ready);
9214
+ };
9215
+ const timeout = setTimeout(() => finish(false), 20000);
9216
+ child.once("error", () => finish(false));
9217
+ child.once("exit", () => finish(false));
9218
+ child.once("message", (message) => finish(typeof message === "object" && message !== null && "ready" in message && message.ready === true));
9219
+ });
9005
9220
 
9006
9221
  // src/main.ts
9007
9222
  function gitBranch() {
@@ -9081,6 +9296,12 @@ var exec = (command, args, { cwd }) => new Promise((done, fail) => {
9081
9296
  child.on("error", fail);
9082
9297
  child.on("close", (code) => done({ code: code ?? 1, stdout, stderr }));
9083
9298
  });
9299
+ var stopped = false;
9300
+ if (process.argv.includes("heartbeat") && !process.argv.includes("--background"))
9301
+ for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"])
9302
+ process.on(signal, () => {
9303
+ stopped = true;
9304
+ });
9084
9305
  var code = await run(process.argv.slice(2), {
9085
9306
  machineName: hostname2(),
9086
9307
  ttyName: process.stdin.isTTY ? spawnSync("tty", [], { encoding: "utf8", stdio: ["inherit", "pipe", "ignore"] }).stdout?.trim() || null : null,
@@ -9129,6 +9350,14 @@ var code = await run(process.argv.slice(2), {
9129
9350
  readStdin,
9130
9351
  exec,
9131
9352
  spawn: spawnInherited,
9353
+ startBackground,
9354
+ stopped: () => stopped,
9355
+ backgroundReady: (ready) => {
9356
+ if (process.connected)
9357
+ process.send?.({ ready });
9358
+ },
9132
9359
  openUrl
9133
9360
  });
9134
9361
  process.exitCode = code;
9362
+ if (process.connected)
9363
+ process.disconnect?.();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-vibe-company/armada",
3
- "version": "0.2.19",
3
+ "version": "0.2.21",
4
4
  "type": "module",
5
5
  "description": "Run a fleet of coding agents on one project: the armada command line.",
6
6
  "license": "MIT",