@taskless-app/swarm 0.6.98 → 0.6.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -2807,6 +2807,9 @@ function grokAbort(rec) {
2807
2807
  }
2808
2808
  return void 0;
2809
2809
  }
2810
+ function grokRecordShape(rec) {
2811
+ return typeof rec.text === "string" || typeof rec.stopReason === "string" || typeof rec.sessionId === "string" || rec.type === "error";
2812
+ }
2810
2813
  function parseGrokResult(raw) {
2811
2814
  const trimmed = raw.trim();
2812
2815
  if (!trimmed) return null;
@@ -2818,8 +2821,7 @@ function parseGrokResult(raw) {
2818
2821
  }
2819
2822
  if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return null;
2820
2823
  const rec = parsed;
2821
- const hasShape = typeof rec.text === "string" || typeof rec.stopReason === "string" || typeof rec.sessionId === "string" || rec.type === "error";
2822
- if (!hasShape) return null;
2824
+ if (!grokRecordShape(rec)) return null;
2823
2825
  const reported = typeof rec.total_cost_usd === "number" && Number.isFinite(rec.total_cost_usd);
2824
2826
  const usage2 = rec.usage;
2825
2827
  let tokensIn;
@@ -2872,7 +2874,7 @@ function readGrokProbeRecord(out) {
2872
2874
  }
2873
2875
  function grokProbeScanText(out) {
2874
2876
  const located = locateGrokProbeJson(out);
2875
- if (!located || grokAbort(located.rec)) return out;
2877
+ if (!located || grokAbort(located.rec) || !grokRecordShape(located.rec)) return out;
2876
2878
  const at = out.indexOf(located.raw);
2877
2879
  return out.slice(0, at) + out.slice(at + located.raw.length);
2878
2880
  }
@@ -2973,7 +2975,9 @@ ${notice}` : spec.prompt;
2973
2975
  probe: {
2974
2976
  args: ["-p", "ok", "--output-format", "json", "--yolo", "--max-turns", "1", "--no-auto-update"],
2975
2977
  // В бинаре 1.0.77 кроме «usage limit» есть weekly/rate limit и «run out of credits».
2976
- limitPattern: /usage limit|weekly limit|rate limit|run out of credits/i,
2978
+ // TASWM-659: кончился баланс — «API error (status 402 Payment Required): Grok Build usage
2979
+ // balance exhausted». Код 402 — только рядом со словом ошибки, как 401 в authPattern.
2980
+ limitPattern: /usage limit|weekly limit|rate limit|run out of credits|balance exhausted|payment required|(?:error|api|http|status)[^\n]{0,60}\b402\b/i,
2977
2981
  // Голый 401 ловил output_tokens и 0.401. Код — только рядом со словом
2978
2982
  // ошибки, как у Claude. «401 Unauthorized» покрывает голое unauthorized.
2979
2983
  authPattern: /not logged in|not signed in|unauthorized|(?:error|api|http|status)[^\n]{0,60}\b40[13]\b|(?:invalid|incorrect) api key|authentication required|auth required/i,
@@ -4486,7 +4490,7 @@ var init_package = __esm({
4486
4490
  "package.json"() {
4487
4491
  package_default = {
4488
4492
  name: "@taskless-app/swarm",
4489
- version: "0.6.98",
4493
+ version: "0.6.100",
4490
4494
  type: "module",
4491
4495
  description: "Local control plane for a fleet of AI coding agents (drones), coordinating through Taskless. The overmind runs the swarm.",
4492
4496
  keywords: [
@@ -4538,7 +4542,7 @@ var init_package = __esm({
4538
4542
  undici: "^7.30.1",
4539
4543
  zod: "3.25.76"
4540
4544
  },
4541
- gitHead: "0893b7cf08facf1c6f118aeb082dcd807e61e059"
4545
+ gitHead: "a0643b2118fce225b5afbe7ce9c1afbe7cd25d39"
4542
4546
  };
4543
4547
  }
4544
4548
  });