@kvali/cli 0.7.4 → 0.7.5

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kvali",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "Live progress for Claude Code: plan progress, the current step and the time left, what the agent is doing right now, tokens and your plan limits, in a pane beside the chat.",
5
5
  "author": { "name": "Giorgi Khiladze" },
6
6
  "homepage": "https://github.com/webGrandpa/kvali",
package/dist/kvali.mjs CHANGED
@@ -351,6 +351,17 @@ function cleanFields(o, fields) {
351
351
  }
352
352
  return out ?? o;
353
353
  }
354
+ function errorMessage(v, depth = 0) {
355
+ if (typeof v === "string") return v.trim() || void 0;
356
+ if (typeof v === "number") return String(v);
357
+ if (!v || typeof v !== "object" || depth > 4) return void 0;
358
+ const o = v;
359
+ const inner = errorMessage(o.message, depth + 1) ?? errorMessage(o.error, depth + 1) ?? errorMessage(o.data, depth + 1) ?? errorMessage(o.cause, depth + 1);
360
+ const status = typeof o.status === "number" ? o.status : void 0;
361
+ if (inner) return status && !inner.includes(String(status)) ? `${inner} (${status})` : inner;
362
+ if (typeof o.type === "string" && o.type !== "error") return o.type;
363
+ return status ? `API error ${status}` : void 0;
364
+ }
354
365
 
355
366
  // ../core/src/week.ts
356
367
  var WEEK_DAYS = 7;
@@ -1217,7 +1228,7 @@ var AntigravityAdapter = class {
1217
1228
  st.turnStartedAt = at;
1218
1229
  }
1219
1230
  st.turnSteps += tools.length;
1220
- if (type === "ERROR_MESSAGE") st.error = firstLine(String(o.content ?? o.error ?? "Error"), 120);
1231
+ if (type === "ERROR_MESSAGE") st.error = firstLine(errorMessage(o.content) ?? errorMessage(o.error) ?? "Error", 120);
1221
1232
  else if (source === "MODEL") st.error = void 0;
1222
1233
  st.pendingAsk = void 0;
1223
1234
  if (type === "PLANNER_RESPONSE") {
@@ -1679,13 +1690,14 @@ var ClaudeCodeAdapter = class {
1679
1690
  const err = o.error && typeof o.error === "object" ? o.error : {};
1680
1691
  const attempt = Number(o.retryAttempt ?? o.attempt ?? err.retryAttempt) || void 0;
1681
1692
  const max = Number(o.maxRetries ?? o.max_retries ?? err.maxRetries) || void 0;
1682
- const message = firstLine(String(o.content ?? err.message ?? o.cause?.message ?? o.subtype ?? "API problem"), 100);
1693
+ const message = firstLine(errorMessage(o.content) ?? errorMessage(o.error) ?? errorMessage(o.cause) ?? "API problem", 100);
1683
1694
  st.trouble = { message, at: ts ?? st.updatedAt, attempt, maxAttempts: max };
1684
1695
  }
1685
- if (o.level === "error" || o.subtype === "api_error") {
1696
+ const retried = o.retryInMs !== void 0 || o.retryAttempt !== void 0;
1697
+ if ((o.level === "error" || o.subtype === "api_error") && !retried) {
1686
1698
  st.phase = "error";
1687
1699
  st.phaseAt = ts ?? st.updatedAt;
1688
- st.errorText = firstLine(String(o.content ?? o.error ?? "API error"), 120);
1700
+ st.errorText = firstLine(errorMessage(o.content) ?? errorMessage(o.error) ?? "API error", 120);
1689
1701
  }
1690
1702
  return;
1691
1703
  case "attachment": {
@@ -2093,7 +2105,10 @@ var ClaudeCodeAdapter = class {
2093
2105
  if (beat.phase === "needs-you") {
2094
2106
  status = "waiting";
2095
2107
  detail = beat.label ? `Needs you: ${truncate(beat.label, 80)}` : "Needs your input";
2096
- } else if (status !== "waiting" && status !== "error") status = "working";
2108
+ } else if (status !== "waiting" && (status !== "error" || beat.since > st.phaseAt)) {
2109
+ status = "working";
2110
+ detail = void 0;
2111
+ }
2097
2112
  } else if (st.updatedAt <= beat.at + PULSE_FRESH_MS && (status === "working" || status === "waiting")) {
2098
2113
  pulse = { phase: "gone", since: beat.at, at: beat.at };
2099
2114
  status = "stale";
@@ -2828,7 +2843,7 @@ function sdkFailure(result) {
2828
2843
  }
2829
2844
  if (!Array.isArray(content)) return void 0;
2830
2845
  const failed = content.find((c) => c && typeof c === "object" && c.success === false);
2831
- return failed ? String(failed.error ?? failed.result ?? "Command failed") : void 0;
2846
+ return failed ? errorMessage(failed.error) ?? errorMessage(failed.result) ?? "Command failed" : void 0;
2832
2847
  }
2833
2848
  function sdkUserText(content) {
2834
2849
  const text = contentText(content);
@@ -8564,7 +8579,7 @@ function qrTerminal(text, color = true) {
8564
8579
  }
8565
8580
 
8566
8581
  // src/index.ts
8567
- var VERSION = "0.7.4";
8582
+ var VERSION = "0.7.5";
8568
8583
  function parse(argv) {
8569
8584
  const opts = {
8570
8585
  json: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvali/cli",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "Live progress, time left, tokens, plan limits and phone alerts for AI coding agents (Claude Code, Codex, Gemini CLI, Antigravity, Copilot, Cline, Roo Code, Kilo Code, OpenCode), in your terminal.",
5
5
  "license": "MIT",
6
6
  "author": "Giorgi Khiladze (https://github.com/webGrandpa)",