@the-vibe-company/armada 0.2.42 → 0.2.44

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 +22 -2
  2. package/dist/armada.js +214 -33
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -4,7 +4,7 @@ Armada runs a fleet of coding agents on one project and keeps every piece of wor
4
4
 
5
5
  It imposes one method: grill the decisions, write a spec, cut it into tickets, let one worker agent ship each ticket as a green pull request, and let a coordinator agent merge. The tracker is the source of truth for progress; Armada adds live telemetry, contention rules and a fleet dashboard on top.
6
6
 
7
- **Status:** early. `armada status`, `armada auth`, `armada doctor`, `armada init`, `armada brief`, `armada claim`, `armada report`, `armada release`, `armada ask`, `armada inbox`, `armada answer`, `armada merge`, `armada validate`, `armada ask-owner` and `armada done` work; the other commands are being built.
7
+ **Status:** early. `armada status`, `armada auth`, `armada doctor`, `armada init`, `armada brief`, `armada launch`, `armada claim`, `armada report`, `armada release`, `armada ask`, `armada inbox`, `armada answer`, `armada merge`, `armada validate`, `armada ask-owner` and `armada done` work; the other commands are being built.
8
8
 
9
9
  ## Install
10
10
 
@@ -91,7 +91,7 @@ On a repository without `armada.toml`, pass `--program-root <ISSUE-ID>`; the nam
91
91
 
92
92
  ## Launch a worker (coordinators)
93
93
 
94
- Armada starts persistent local workers through herdr; Conductor and Claude Code subagents follow their runtime guides. The `armada-runtime-conductor` skill gives the exact Conductor Cloud commands; the `armada-runtime-claude-code` skill launches a worker as a background subagent of a coordinator running in Claude Code, in its own git worktree (it dies with the coordinator's session, so long runs go to Conductor). [`docs/runbook.md`](docs/runbook.md) says how to start a coordinator on a laptop or in Conductor Cloud, what the owner sets up once, and how one coordinator hands over to the next.
94
+ Armada starts [persistent local workers through herdr](#run-workers-on-your-own-machine); Conductor and Claude Code subagents follow their runtime guides. The `armada-runtime-conductor` skill gives the exact Conductor Cloud commands; the `armada-runtime-claude-code` skill launches a worker as a background subagent of a coordinator running in Claude Code, in its own git worktree (it dies with the coordinator's session, so long runs go to Conductor or a persistent herdr worker). [`docs/runbook.md`](docs/runbook.md) says how to start a coordinator on a laptop or in Conductor Cloud, what the owner sets up once, and how one coordinator hands over to the next.
95
95
 
96
96
  ```sh
97
97
  armada brief ABC-12 # read-only settings and prompt preview; no launch
@@ -112,6 +112,26 @@ armada launch revoke ABC-12 # cancel the newest pending launch throug
112
112
  - Label rules win: the first `[[conductor.routing]]` rule with a label the ticket carries (case, spaces and punctuation ignored) selects its profile. Otherwise, profiles with `when = "front end: dashboard pages, components, styles, design, UI copy"` or `when = "back end: CLI, core rules, API, database, migrations, tests, docs"` ask the coordinator to choose. `armada brief ABC-12` prints **Choose a profile**, the ticket's title and In short, and every profile's rule; it creates no launch token or watch entry. `--json` returns the choice information; `--prompt` refuses until a profile is chosen. Read the ticket and parent spec, choose the rule covering most files/work (explain mixed work), then run `armada brief ABC-12 --profile codex --reason "mostly CLI and core rules" --prompt`. Armada does not call a model to classify tickets. Projects without `when` keep their old `conductor.default_profile` or only-profile fallback.
113
113
  - `--profile` also overrides a label route. `--reason` is required for semantic choices and, when routing rules exist, overrides of the routed profile. Keep both flags on subsequent `--prompt` calls. The generated claim command carries the reason; the claim comment, `armada status` and dashboard agent Profile row show it. An unknown profile exits 2. The dashboard's ready-to-launch row shows a label-routed profile or "chosen by the coordinator"; Launch still sends an inbox request, not a runtime call.
114
114
 
115
+ ## Run workers on your own machine
116
+
117
+ Workers do not have to run in Conductor Cloud. With [herdr](https://herdr.dev) 0.9.1 or newer, the coordinator runs each worker on this machine, in its own git worktree and terminal, and the worker keeps going when the coordinator disconnects (the machine must stay awake). Four harnesses are supported: `claude`, `codex`, `opencode`, and `deepseek`, which runs a persistent OpenCode session with the DeepSeek model you configure. Add a local profile to the project's `armada.toml`:
118
+
119
+ ```toml
120
+ [herdr.profiles.backend]
121
+ harness = "codex" # claude, codex, opencode or deepseek (OpenCode + DeepSeek model)
122
+ model = "your-model-id" # exact id: `opencode models` lists them for opencode and deepseek
123
+ effort = "high"
124
+ extra_args = ["--sandbox", "workspace-write"] # arguments for this harness only
125
+ ```
126
+
127
+ Label routing follows the same rules as the Conductor profiles (`[[herdr.routing]]`). Launch from the signed-in coordinator; the worker's brief carries a one-time launch token, so it needs no key:
128
+
129
+ ```sh
130
+ armada launch ABC-12 --runtime herdr --profile backend --reason "back end work"
131
+ ```
132
+
133
+ `armada doctor` checks what the local profiles need: herdr (0.9.1 or newer), each harness CLI, the Claude and Codex sign-ins, and every OpenCode or DeepSeek profile's exact model against `opencode models`. On a terminal it offers the official installs and a numbered model pick, each only with your consent; `--json` and CI only print the fixes. Armada never runs a sign-in and never handles a provider key. The runbook's [Launch a persistent local worker](docs/runbook.md#launch-a-persistent-local-worker) has the rest: routing and model choice, messaging the worker, and safe archival with `armada stop`.
134
+
115
135
  ## Work on a ticket (workers)
116
136
 
117
137
  A worker writes to the tracker only through three commands. They set the labels and write the comments in the protocol format, and record each event on Armada with the worker's sign-in.
package/dist/armada.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/main.ts
4
- import { spawn as spawn2, spawnSync } from "node:child_process";
4
+ import { spawn as spawn3, spawnSync } from "node:child_process";
5
5
  import { createReadStream } from "node:fs";
6
6
  import { open as open2, readFile as readFile4, writeFile as writeFile3 } from "node:fs/promises";
7
7
  import { hostname as hostname2 } from "node:os";
@@ -10156,7 +10156,7 @@ ${attachments.join(`
10156
10156
  };
10157
10157
  }
10158
10158
  // package.json
10159
- var version = "0.2.42";
10159
+ var version = "0.2.44";
10160
10160
 
10161
10161
  // src/attach.ts
10162
10162
  import { resolve } from "node:path";
@@ -10695,14 +10695,37 @@ async function logout(io) {
10695
10695
 
10696
10696
  // src/opencode-model.ts
10697
10697
  import { stripVTControlCharacters } from "node:util";
10698
- function modelsFrom(raw) {
10698
+ var displayName = (value) => typeof value === "string" && !!value.trim() && !/[\r\n]/.test(value) && stripVTControlCharacters(value) === value;
10699
+ function providersFrom(raw, configuration) {
10700
+ try {
10701
+ const catalog = JSON.parse(stripVTControlCharacters(raw));
10702
+ const config = JSON.parse(stripVTControlCharacters(configuration));
10703
+ const providers = Array.isArray(catalog?.providers) ? catalog.providers.filter((provider) => provider && displayName(provider.id) && displayName(provider.name)) : [];
10704
+ for (const [id, value] of Object.entries(config?.provider ?? {})) {
10705
+ const name = value?.name;
10706
+ if (!displayName(id) || name !== undefined && !displayName(name))
10707
+ continue;
10708
+ if (name === undefined && providers.some((provider) => provider.id === id))
10709
+ continue;
10710
+ for (let index = providers.length - 1;index >= 0; index--)
10711
+ if (providers[index]?.id === id)
10712
+ providers.splice(index, 1);
10713
+ providers.push({ id, name: name ?? id });
10714
+ }
10715
+ return providers;
10716
+ } catch {
10717
+ return [];
10718
+ }
10719
+ }
10720
+ function modelsFrom(raw, providers) {
10699
10721
  const models = [];
10700
10722
  for (const match of stripVTControlCharacters(raw).matchAll(/^([^\s/#]+\/[^\s#]+)\r?\n(\{\r?\n[\s\S]*?^\})/gm)) {
10701
10723
  try {
10702
10724
  const metadata = JSON.parse(match[2] ?? "");
10703
10725
  const id = match[1] ?? "";
10704
- if (metadata && `${metadata.providerID}/${metadata.id}` === id && typeof metadata.name === "string" && metadata.name.trim() && !/[\r\n]/.test(metadata.name) && stripVTControlCharacters(metadata.name) === metadata.name)
10705
- models.push({ id, name: metadata.name });
10726
+ if (metadata && `${metadata.providerID}/${metadata.id}` === id && displayName(metadata.name))
10727
+ for (const provider of providers.filter((provider) => provider.id === metadata.providerID))
10728
+ models.push({ id, name: metadata.name, provider: provider.name });
10706
10729
  } catch {}
10707
10730
  }
10708
10731
  return models;
@@ -10711,12 +10734,15 @@ function selectedModel(pane, models) {
10711
10734
  const lines = stripVTControlCharacters(pane).split(`
10712
10735
  `);
10713
10736
  const footers = lines.flatMap((line, index) => {
10714
- if (!/^\s*╹/.test(lines[index + 1] ?? ""))
10715
- return [];
10716
- const match = line.trim().match(/^(?:[┃│]\s*)?[A-Z][\w-]*(?:\s+auto)?(?:\s+·)?\s+(.+)$/);
10737
+ const bordered = /^\s*╹/.test(lines[index + 1] ?? "");
10738
+ const pattern = bordered ? /^(?:[┃│]\s*)?[A-Z][\w-]*(?:\s+auto)?(?:\s+·)?\s+(.+)$/ : /^(?:[┃│]\s*)?[A-Z][\w-]*(?:\s+auto)?\s+·\s+(.+)$/;
10739
+ const match = line.trim().match(pattern);
10717
10740
  return match?.[1] ? [match[1]] : [];
10718
10741
  });
10719
- const candidates = models.filter((model) => footers.some((footer) => footer.startsWith(`${model.name} `) || footer.startsWith(`${model.id} `)));
10742
+ const candidates = models.filter((model) => footers.some((footer) => [model.name, model.id].some((name) => {
10743
+ const identity = `${name} ${model.provider}`;
10744
+ return footer === identity || footer.startsWith(`${identity} · `);
10745
+ })));
10720
10746
  const ids = [...new Set(candidates.map((model) => model.id))];
10721
10747
  return ids.length === 1 ? ids[0] ?? null : null;
10722
10748
  }
@@ -10725,7 +10751,13 @@ async function verifyOpenCodeModel(io, pane, expected) {
10725
10751
  if (!io.exec)
10726
10752
  throw failure();
10727
10753
  const metadata = await io.exec("opencode", ["models", "--verbose"], { cwd: io.cwd, timeoutMs: 5000 }).catch(() => null);
10728
- const models = metadata?.code === 0 ? modelsFrom(metadata.stdout) : [];
10754
+ if (metadata?.code !== 0)
10755
+ throw failure();
10756
+ const catalog = await io.exec("opencode", ["debug", "v2"], { cwd: io.cwd, timeoutMs: 5000 }).catch(() => null);
10757
+ if (catalog?.code !== 0)
10758
+ throw failure();
10759
+ const config = await io.exec("opencode", ["debug", "config"], { cwd: io.cwd, timeoutMs: 5000 }).catch(() => null);
10760
+ const models = config?.code === 0 ? modelsFrom(metadata.stdout, providersFrom(catalog.stdout, config.stdout)) : [];
10729
10761
  if (!models.some((model) => model.id === expected))
10730
10762
  throw failure();
10731
10763
  const now = io.now ?? (() => new Date);
@@ -11990,12 +12022,12 @@ function localHarnesses(config) {
11990
12022
  return [...new Set(Object.values(config.herdr?.profiles ?? {}).map((profile) => profile.harness))];
11991
12023
  }
11992
12024
  function localModelProfiles(config) {
11993
- return Object.entries(config.herdr?.profiles ?? {}).flatMap(([name, profile]) => profile.harness === "opencode" || profile.harness === "deepseek" ? [{ name, harness: profile.harness, model: profile.model ?? "" }] : []);
12025
+ return Object.entries(config.herdr?.profiles ?? {}).flatMap(([name, profile]) => profile.model || profile.harness === "opencode" || profile.harness === "deepseek" ? [{ name, harness: profile.harness, model: profile.model ?? "" }] : []);
11994
12026
  }
11995
- async function probe(io, command, args) {
12027
+ async function probe(io, command, args, limits = {}) {
11996
12028
  if (!io.exec)
11997
12029
  return null;
11998
- return io.exec(command, args, { cwd: io.cwd }).catch(() => null);
12030
+ return io.exec(command, args, { cwd: io.cwd, ...limits }).catch(() => null);
11999
12031
  }
12000
12032
  function versionOf(result) {
12001
12033
  if (result.code !== 0)
@@ -12097,8 +12129,37 @@ async function openCodeModels(io) {
12097
12129
  `).map((line) => line.trim()).filter((line) => /^[^\s/#]+\/[^\s#]+$/.test(line)))
12098
12130
  ];
12099
12131
  }
12132
+ async function claudeModels(io) {
12133
+ const result = await probe(io, "claude", ["--help"], { timeoutMs: 5000, maxOutputBytes: 262144 });
12134
+ if (result?.code !== 0)
12135
+ return null;
12136
+ const help = stripVTControlCharacters2(result.stdout);
12137
+ const option = help.match(/(?:^|\n)\s+--model\s+<model>([\s\S]*?)(?=\n\s+--?[a-zA-Z]|$)/)?.[1];
12138
+ if (!option)
12139
+ return null;
12140
+ return [
12141
+ ...new Set([...option.matchAll(/['"]([a-z][a-z0-9.[\]-]*)['"]/g)].flatMap((match) => match[1] ? [match[1]] : []))
12142
+ ];
12143
+ }
12144
+ function modelsFor(detected, profile) {
12145
+ return detected.availableModels[profile.harness === "deepseek" ? "opencode" : profile.harness] ?? null;
12146
+ }
12100
12147
  function modelCheck(profile, available) {
12101
12148
  const model = profile.model;
12149
+ if (profile.harness === "claude" || profile.harness === "codex") {
12150
+ const claude = profile.harness === "claude";
12151
+ const ready = !!model && !!available?.includes(model);
12152
+ const section = profile.name ? ` under [herdr.profiles.${profile.name}]` : "";
12153
+ const suggested = claude ? available?.find((id) => id === "opus") ?? available?.[0] : available?.[0];
12154
+ const line = `model = ${JSON.stringify(suggested ?? "<exact model id>")}${section}`;
12155
+ return {
12156
+ id: `local-${profile.harness}-model:${profile.name || model}`,
12157
+ level: ready ? "ok" : "error",
12158
+ message: `${profile.harness}${profile.name ? ` profile ${profile.name}` : ""}: ${ready ? claude ? `the installed CLI advertises ${model} in --help` : `model/list lists ${model} for this sign-in (catalog check only)` : claude ? `could not verify ${model} with the installed CLI; --help is not a complete model catalog` : available === null ? "could not read the installed CLI's model/list catalog for this sign-in" : `${model} is not listed by the installed CLI for this sign-in`}${!claude && !ready && available?.length ? `
12159
+ Available models: ${available.map((id, i) => `${i + 1}. ${id} — model = ${JSON.stringify(id)}`).join("; ")}` : ""}`,
12160
+ fix: ready ? null : claude ? `add ${line}${suggested ? " (an advertised alias or model)" : "; choose an alias from `claude --help` or the owner's `/model` picker"}; or run \`claude update\` and retry doctor` : `pick a listed model and add ${line}; or update with \`npm i -g @openai/codex\`; if the model requires API access, the owner signs in using \`codex login --with-api-key\` and retries doctor; Armada never runs sign-in`
12161
+ };
12162
+ }
12102
12163
  const matching = available?.filter((id) => profile.harness !== "deepseek" || isDeepseekModel(id)) ?? [];
12103
12164
  const ready = !!model && matching.includes(model);
12104
12165
  const label = profile.harness === "deepseek" ? "deepseek (OpenCode + DeepSeek model)" : "opencode";
@@ -12111,13 +12172,14 @@ ${ready ? "" : `Available models: ${matching.length ? matching.map((id, i) => `$
12111
12172
  };
12112
12173
  }
12113
12174
  async function offerLocalModels(io, detected, configPath, options = {}) {
12114
- if (detected.availableModels === null)
12115
- return detected;
12116
12175
  let changed = false;
12117
12176
  for (const profile of detected.profiles) {
12118
- if (modelCheck(profile, detected.availableModels).level === "ok")
12177
+ if (profile.harness === "claude")
12178
+ continue;
12179
+ const available = modelsFor(detected, profile);
12180
+ if (!available || modelCheck(profile, available).level === "ok")
12119
12181
  continue;
12120
- const models = detected.availableModels.filter((id) => profile.harness !== "deepseek" || isDeepseekModel(id));
12182
+ const models = available.filter((id) => profile.harness !== "deepseek" || isDeepseekModel(id));
12121
12183
  if (!models.length || options.readOnly || !io.interactive || io.env.CI || !io.prompt || !io.writeFile || !configPath || !profile.name)
12122
12184
  continue;
12123
12185
  io.stderr(`Choose a model for [herdr.profiles.${profile.name}]:
@@ -12170,7 +12232,7 @@ async function detectLocalTools(io, harnesses, configured = []) {
12170
12232
  if ((harness === "opencode" || harness === "deepseek") && !profiles.some((profile) => profile.harness === harness))
12171
12233
  profiles.push({ name: "", harness, model: "" });
12172
12234
  }
12173
- let availableModels = null;
12235
+ const availableModels = {};
12174
12236
  const tools = [];
12175
12237
  const checks = [];
12176
12238
  const binaries = new Set(harnesses.map((harness) => harness === "deepseek" ? "opencode" : harness));
@@ -12179,11 +12241,13 @@ async function detectLocalTools(io, harnesses, configured = []) {
12179
12241
  tools.push(tool);
12180
12242
  checks.push(toolCheck(tool));
12181
12243
  if (name !== "herdr" && tool.state === "ready") {
12182
- if (name !== "opencode")
12183
- checks.push(await signInCheck(io, name));
12184
- else {
12185
- availableModels = await openCodeModels(io);
12186
- checks.push(...profiles.map((profile) => modelCheck(profile, availableModels)));
12244
+ const signIn = name !== "opencode" ? await signInCheck(io, name) : null;
12245
+ if (signIn)
12246
+ checks.push(signIn);
12247
+ const selected = profiles.filter((profile) => (profile.harness === "deepseek" ? "opencode" : profile.harness) === name);
12248
+ if (selected.length) {
12249
+ availableModels[name] = name === "opencode" ? await openCodeModels(io) : name === "claude" ? await claudeModels(io) : signIn?.level === "error" ? null : await io.codexModels?.(io.cwd).catch(() => null) ?? null;
12250
+ checks.push(...selected.map((profile) => modelCheck(profile, availableModels[name] ?? null)));
12187
12251
  }
12188
12252
  }
12189
12253
  }
@@ -14566,6 +14630,109 @@ ${next ? `Next: ${next}
14566
14630
  }
14567
14631
  }
14568
14632
 
14633
+ // src/codex-models.ts
14634
+ import { spawn } from "node:child_process";
14635
+ var system = {
14636
+ start: (cwd) => spawn("codex", ["app-server"], { cwd, stdio: ["pipe", "pipe", "ignore"] }),
14637
+ deadline: (expire) => {
14638
+ const timer = setTimeout(expire, 1e4);
14639
+ return () => clearTimeout(timer);
14640
+ }
14641
+ };
14642
+ function readCodexModels(cwd, io = system) {
14643
+ return new Promise((resolve) => {
14644
+ let child;
14645
+ try {
14646
+ child = io.start(cwd);
14647
+ } catch {
14648
+ resolve(null);
14649
+ return;
14650
+ }
14651
+ let settled = false;
14652
+ let cancel = () => {};
14653
+ const finish = (models) => {
14654
+ if (settled)
14655
+ return;
14656
+ settled = true;
14657
+ cancel();
14658
+ child.stdin.destroy();
14659
+ child.kill("SIGKILL");
14660
+ resolve(models);
14661
+ };
14662
+ cancel = io.deadline(() => finish(null));
14663
+ let buffer = "";
14664
+ let bytes = 0;
14665
+ let requestId = 0;
14666
+ const models = new Set;
14667
+ const cursors = new Set;
14668
+ const send = (message) => {
14669
+ if (!settled)
14670
+ child.stdin.write(`${JSON.stringify(message)}
14671
+ `);
14672
+ };
14673
+ const list = (cursor) => {
14674
+ requestId++;
14675
+ send({ id: requestId, method: "model/list", params: { limit: 100, includeHidden: true, cursor } });
14676
+ };
14677
+ child.on("error", () => finish(null));
14678
+ child.on("close", () => finish(null));
14679
+ child.stdin.on("error", () => finish(null));
14680
+ child.stdout.setEncoding("utf8").on("data", (chunk) => {
14681
+ if (settled)
14682
+ return;
14683
+ bytes += Buffer.byteLength(chunk);
14684
+ if (bytes > 1048576)
14685
+ return finish(null);
14686
+ buffer += chunk;
14687
+ while (!settled) {
14688
+ const newline = buffer.indexOf(`
14689
+ `);
14690
+ if (newline === -1)
14691
+ break;
14692
+ const line = buffer.slice(0, newline);
14693
+ buffer = buffer.slice(newline + 1);
14694
+ if (!line.trim())
14695
+ continue;
14696
+ try {
14697
+ const message = JSON.parse(line);
14698
+ if (!message || typeof message !== "object")
14699
+ return finish(null);
14700
+ if (message.id !== requestId)
14701
+ continue;
14702
+ if (message.error || !message.result || typeof message.result !== "object")
14703
+ return finish(null);
14704
+ if (requestId === 0) {
14705
+ send({ method: "initialized", params: {} });
14706
+ list(null);
14707
+ continue;
14708
+ }
14709
+ const { data, nextCursor } = message.result;
14710
+ if (!Array.isArray(data) || nextCursor != null && typeof nextCursor !== "string")
14711
+ return finish(null);
14712
+ for (const entry of data) {
14713
+ if (!entry || typeof entry.model !== "string" || !entry.model.trim() || entry.model.length > 4096 || /\p{Cc}/u.test(entry.model))
14714
+ return finish(null);
14715
+ models.add(entry.model);
14716
+ }
14717
+ if (nextCursor == null)
14718
+ return finish([...models]);
14719
+ if (!nextCursor || cursors.has(nextCursor) || cursors.size >= 100)
14720
+ return finish(null);
14721
+ cursors.add(nextCursor);
14722
+ list(nextCursor);
14723
+ } catch {
14724
+ return finish(null);
14725
+ }
14726
+ }
14727
+ });
14728
+ send({
14729
+ id: 0,
14730
+ method: "initialize",
14731
+ params: { clientInfo: { name: "armada_doctor", version: "1" }, capabilities: { explicitGatewayOAuth: true } }
14732
+ });
14733
+ });
14734
+ }
14735
+
14569
14736
  // src/line.ts
14570
14737
  var emptyLine = () => ({ answer: "", sequence: "none" });
14571
14738
  function feedLine(line, chunk) {
@@ -14645,11 +14812,11 @@ async function inspectProcess(exec, pid, system = {
14645
14812
  }
14646
14813
 
14647
14814
  // src/spawn.ts
14648
- import { spawn } from "node:child_process";
14815
+ import { spawn as spawn2 } from "node:child_process";
14649
14816
  import { constants } from "node:os";
14650
14817
  var SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
14651
14818
  var spawnInherited = (command, args, { cwd, env }) => new Promise((done, fail) => {
14652
- const child = spawn(command, args, { cwd, env, stdio: "inherit" });
14819
+ const child = spawn2(command, args, { cwd, env, stdio: "inherit" });
14653
14820
  const fromTerminal = process.stdin.isTTY === true;
14654
14821
  const handlers = SIGNALS.map((signal) => {
14655
14822
  const handler = () => {
@@ -14675,7 +14842,7 @@ var spawnInherited = (command, args, { cwd, env }) => new Promise((done, fail) =
14675
14842
  var startBackground = (args) => new Promise((resolve) => {
14676
14843
  if (process.platform === "win32")
14677
14844
  return resolve(false);
14678
- const child = spawn(process.execPath, [...process.execArgv, process.argv[1], ...args], {
14845
+ const child = spawn2(process.execPath, [...process.execArgv, process.argv[1], ...args], {
14679
14846
  cwd: process.cwd(),
14680
14847
  env: process.env,
14681
14848
  detached: true,
@@ -14757,7 +14924,7 @@ function openUrl(url) {
14757
14924
  return false;
14758
14925
  const [command, args] = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? ["rundll32", ["url.dll,FileProtocolHandler", url]] : ["xdg-open", [url]];
14759
14926
  try {
14760
- const child = spawn2(command, args, { stdio: "ignore", detached: true });
14927
+ const child = spawn3(command, args, { stdio: "ignore", detached: true });
14761
14928
  child.on("error", () => {});
14762
14929
  child.unref();
14763
14930
  return true;
@@ -14765,16 +14932,29 @@ function openUrl(url) {
14765
14932
  return false;
14766
14933
  }
14767
14934
  }
14768
- var exec = (command, args, { cwd, timeoutMs }) => new Promise((done, fail) => {
14769
- const child = spawn2(command, args, { cwd, stdio: ["ignore", "pipe", "pipe"] });
14935
+ var exec = (command, args, { cwd, timeoutMs, maxOutputBytes }) => new Promise((done, fail) => {
14936
+ const child = spawn3(command, args, { cwd, stdio: ["ignore", "pipe", "pipe"] });
14770
14937
  const timer = timeoutMs ? setTimeout(() => child.kill("SIGKILL"), timeoutMs) : null;
14771
14938
  let stdout = "";
14772
14939
  let stderr = "";
14940
+ let bytes = 0;
14941
+ let oversized = false;
14942
+ const accept = (text) => {
14943
+ bytes += Buffer.byteLength(text);
14944
+ if (maxOutputBytes !== undefined && bytes > maxOutputBytes) {
14945
+ oversized = true;
14946
+ stdout = stderr = "";
14947
+ child.kill("SIGKILL");
14948
+ }
14949
+ return !oversized;
14950
+ };
14773
14951
  child.stdout.setEncoding("utf8").on("data", (d) => {
14774
- stdout += d;
14952
+ if (accept(d))
14953
+ stdout += d;
14775
14954
  });
14776
14955
  child.stderr.setEncoding("utf8").on("data", (d) => {
14777
- stderr += d;
14956
+ if (accept(d))
14957
+ stderr += d;
14778
14958
  });
14779
14959
  child.on("error", (err) => {
14780
14960
  if (timer)
@@ -14784,7 +14964,7 @@ var exec = (command, args, { cwd, timeoutMs }) => new Promise((done, fail) => {
14784
14964
  child.on("close", (code) => {
14785
14965
  if (timer)
14786
14966
  clearTimeout(timer);
14787
- done({ code: code ?? 1, stdout, stderr });
14967
+ done({ code: oversized ? 1 : code ?? 1, stdout, stderr });
14788
14968
  });
14789
14969
  });
14790
14970
  var stopped = false;
@@ -14794,6 +14974,7 @@ if (process.argv.includes("heartbeat") && !process.argv.includes("--background")
14794
14974
  stopped = true;
14795
14975
  });
14796
14976
  var code = await run(process.argv.slice(2), {
14977
+ codexModels: readCodexModels,
14797
14978
  platform: process.platform,
14798
14979
  machineName: hostname2(),
14799
14980
  ttyName: process.stdin.isTTY ? spawnSync("tty", [], { encoding: "utf8", stdio: ["inherit", "pipe", "ignore"] }).stdout?.trim() || null : null,
@@ -14858,7 +15039,7 @@ var code = await run(process.argv.slice(2), {
14858
15039
  readStdin,
14859
15040
  exec,
14860
15041
  detach: (command, args, { cwd, env }) => new Promise((resolve) => {
14861
- const child = spawn2(command, args, { cwd, env, stdio: "ignore", detached: true });
15042
+ const child = spawn3(command, args, { cwd, env, stdio: "ignore", detached: true });
14862
15043
  child.once("error", () => resolve(false));
14863
15044
  child.once("spawn", () => {
14864
15045
  child.unref();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-vibe-company/armada",
3
- "version": "0.2.42",
3
+ "version": "0.2.44",
4
4
  "type": "module",
5
5
  "description": "Run a fleet of coding agents on one project: the armada command line.",
6
6
  "license": "MIT",