@the-vibe-company/armada 0.2.41 → 0.2.42

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 (2) hide show
  1. package/dist/armada.js +90 -5
  2. package/package.json +1 -1
package/dist/armada.js CHANGED
@@ -10156,7 +10156,7 @@ ${attachments.join(`
10156
10156
  };
10157
10157
  }
10158
10158
  // package.json
10159
- var version = "0.2.41";
10159
+ var version = "0.2.42";
10160
10160
 
10161
10161
  // src/attach.ts
10162
10162
  import { resolve } from "node:path";
@@ -10693,6 +10693,68 @@ async function logout(io) {
10693
10693
  return 0;
10694
10694
  }
10695
10695
 
10696
+ // src/opencode-model.ts
10697
+ import { stripVTControlCharacters } from "node:util";
10698
+ function modelsFrom(raw) {
10699
+ const models = [];
10700
+ for (const match of stripVTControlCharacters(raw).matchAll(/^([^\s/#]+\/[^\s#]+)\r?\n(\{\r?\n[\s\S]*?^\})/gm)) {
10701
+ try {
10702
+ const metadata = JSON.parse(match[2] ?? "");
10703
+ 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 });
10706
+ } catch {}
10707
+ }
10708
+ return models;
10709
+ }
10710
+ function selectedModel(pane, models) {
10711
+ const lines = stripVTControlCharacters(pane).split(`
10712
+ `);
10713
+ 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+(.+)$/);
10717
+ return match?.[1] ? [match[1]] : [];
10718
+ });
10719
+ const candidates = models.filter((model) => footers.some((footer) => footer.startsWith(`${model.name} `) || footer.startsWith(`${model.id} `)));
10720
+ const ids = [...new Set(candidates.map((model) => model.id))];
10721
+ return ids.length === 1 ? ids[0] ?? null : null;
10722
+ }
10723
+ async function verifyOpenCodeModel(io, pane, expected) {
10724
+ const failure = () => new UsageError(`could not verify OpenCode model ${expected} from its pane; launch stopped`);
10725
+ if (!io.exec)
10726
+ throw failure();
10727
+ const metadata = await io.exec("opencode", ["models", "--verbose"], { cwd: io.cwd, timeoutMs: 5000 }).catch(() => null);
10728
+ const models = metadata?.code === 0 ? modelsFrom(metadata.stdout) : [];
10729
+ if (!models.some((model) => model.id === expected))
10730
+ throw failure();
10731
+ const now = io.now ?? (() => new Date);
10732
+ const deadline = now().getTime() + 5000;
10733
+ for (let attempt = 0;attempt < 20; attempt++) {
10734
+ const remaining = deadline - now().getTime();
10735
+ if (remaining <= 0)
10736
+ break;
10737
+ const reading = await io.exec("herdr", ["pane", "read", pane, "--source", "visible"], {
10738
+ cwd: io.cwd,
10739
+ timeoutMs: Math.min(1000, remaining)
10740
+ }).catch(() => null);
10741
+ if (reading?.code !== 0)
10742
+ throw failure();
10743
+ const text = stripVTControlCharacters(reading.stdout);
10744
+ if (/ProviderModelNotFoundError|Model not found:/i.test(text))
10745
+ throw new UsageError(`OpenCode could not load profile model ${expected}; launch stopped`);
10746
+ const selected = selectedModel(text, models);
10747
+ if (selected === expected)
10748
+ return;
10749
+ if (selected)
10750
+ throw new UsageError(`OpenCode model differs from profile ${expected}; launch stopped`);
10751
+ const delay = Math.min(250, deadline - now().getTime());
10752
+ if (delay > 0)
10753
+ await (io.sleep ?? ((ms) => new Promise((done) => setTimeout(done, ms))))(delay);
10754
+ }
10755
+ throw failure();
10756
+ }
10757
+
10696
10758
  // src/herdr.ts
10697
10759
  class HerdrError extends UsageError {
10698
10760
  code;
@@ -10703,7 +10765,7 @@ class HerdrError extends UsageError {
10703
10765
  }
10704
10766
  var harnessArgs = (p) => [
10705
10767
  "--model",
10706
- herdrHarnessKind(p.harness) === "opencode" ? `${p.model.split("#")[0]}#${p.effort}` : p.model,
10768
+ p.model,
10707
10769
  ...p.harness === "codex" ? ["-c", `model_reasoning_effort=${JSON.stringify(p.effort)}`] : p.harness === "claude" ? ["--effort", p.effort] : [],
10708
10770
  ...p.extraArgs
10709
10771
  ];
@@ -10863,6 +10925,18 @@ class Herdr {
10863
10925
  ...harnessArgs(profile)
10864
10926
  ]);
10865
10927
  this.checkAgent(r, handle);
10928
+ if (herdrHarnessKind(profile.harness) === "opencode") {
10929
+ try {
10930
+ await verifyOpenCodeModel(this.io, handle.pane, profile.model);
10931
+ } catch (error) {
10932
+ let closed = false;
10933
+ try {
10934
+ await this.call(["pane", "close", handle.pane]);
10935
+ closed = true;
10936
+ } catch {}
10937
+ throw new UsageError(`${error instanceof UsageError ? error.message : "could not verify OpenCode model"}; ${closed ? "worker pane closed" : "could not close worker pane; close it with herdr pane close"}. No worker brief was sent.`);
10938
+ }
10939
+ }
10866
10940
  }
10867
10941
  async prompt(handle, prompt) {
10868
10942
  const r = await this.call([
@@ -11903,7 +11977,7 @@ ${next.line}
11903
11977
  import { join as join4 } from "node:path";
11904
11978
 
11905
11979
  // src/local-tools.ts
11906
- import { stripVTControlCharacters } from "node:util";
11980
+ import { stripVTControlCharacters as stripVTControlCharacters2 } from "node:util";
11907
11981
  var MINIMUM_HERDR_VERSION = "0.9.1";
11908
11982
  var TOOLS = {
11909
11983
  herdr: { command: "herdr", install: "curl -fsSL https://herdr.dev/install.sh | sh" },
@@ -12019,7 +12093,7 @@ async function openCodeModels(io) {
12019
12093
  if (result?.code !== 0)
12020
12094
  return null;
12021
12095
  return [
12022
- ...new Set(stripVTControlCharacters(result.stdout).split(`
12096
+ ...new Set(stripVTControlCharacters2(result.stdout).split(`
12023
12097
  `).map((line) => line.trim()).filter((line) => /^[^\s/#]+\/[^\s#]+$/.test(line)))
12024
12098
  ];
12025
12099
  }
@@ -12514,7 +12588,18 @@ async function localRuntimeChecks(io, config, options = { readOnly: true }) {
12514
12588
  return [];
12515
12589
  const result = await offerLocalInstalls(io, await detectLocalTools(io, harnesses, config ? localModelProfiles(config) : []), options);
12516
12590
  const selected = await offerLocalModels(io, result, options.configPath ?? join4(io.cwd, CONFIG_FILE), options);
12517
- return [...selected.checks, ...harnesses.includes("deepseek") ? [await dshInformation(io)] : []];
12591
+ return [
12592
+ ...selected.checks,
12593
+ ...harnesses.some((harness) => harness === "opencode" || harness === "deepseek") ? [
12594
+ {
12595
+ id: "local-opencode-effort",
12596
+ level: "warning",
12597
+ message: "effort is not applied for OpenCode (including DeepSeek); the interactive UI uses its default variant",
12598
+ fix: null
12599
+ }
12600
+ ] : [],
12601
+ ...harnesses.includes("deepseek") ? [await dshInformation(io)] : []
12602
+ ];
12518
12603
  }
12519
12604
  async function buildDoctor(io, armadaVersion, options = { readOnly: true }) {
12520
12605
  const root = (io.exec ? await gitRoot(io.exec, io.cwd) : null) ?? io.cwd;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-vibe-company/armada",
3
- "version": "0.2.41",
3
+ "version": "0.2.42",
4
4
  "type": "module",
5
5
  "description": "Run a fleet of coding agents on one project: the armada command line.",
6
6
  "license": "MIT",