@kvali/cli 0.7.3 → 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.
|
|
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(
|
|
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") {
|
|
@@ -1399,6 +1410,8 @@ function loopKey(a) {
|
|
|
1399
1410
|
// ../core/src/adapters/claude-code.ts
|
|
1400
1411
|
var PULSE_FRESH_MS = 3e4;
|
|
1401
1412
|
var PULSE_ACTIVE = /* @__PURE__ */ new Set(["requesting", "thinking", "writing", "tool-input", "running", "needs-you", "stalled"]);
|
|
1413
|
+
var PULSE_ENDED = /* @__PURE__ */ new Set(["idle", "done", "interrupted", "error"]);
|
|
1414
|
+
var WAKE_GRACE_MS = 2 * 6e4;
|
|
1402
1415
|
var WAITING_NOTIFICATIONS = /* @__PURE__ */ new Set([
|
|
1403
1416
|
"permission_prompt",
|
|
1404
1417
|
"elicitation_dialog",
|
|
@@ -1664,17 +1677,27 @@ var ClaudeCodeAdapter = class {
|
|
|
1664
1677
|
return;
|
|
1665
1678
|
case "system":
|
|
1666
1679
|
if (o.subtype === "compact_boundary") st.context = void 0;
|
|
1680
|
+
if (!o.isSidechain && (o.subtype === "turn_duration" || o.subtype === "stop_hook_summary" && st.open.size === 0)) {
|
|
1681
|
+
const at = ts ?? st.updatedAt;
|
|
1682
|
+
if (st.phase === "working" || st.phase === "tool") {
|
|
1683
|
+
st.phase = "idle";
|
|
1684
|
+
st.phaseAt = at;
|
|
1685
|
+
}
|
|
1686
|
+
st.open.clear();
|
|
1687
|
+
if (st.turnOpen) this.endTurn(st, at, void 0);
|
|
1688
|
+
}
|
|
1667
1689
|
if (/error|retry/i.test(String(o.subtype ?? "")) || o.level === "error" || o.level === "warning") {
|
|
1668
1690
|
const err = o.error && typeof o.error === "object" ? o.error : {};
|
|
1669
1691
|
const attempt = Number(o.retryAttempt ?? o.attempt ?? err.retryAttempt) || void 0;
|
|
1670
1692
|
const max = Number(o.maxRetries ?? o.max_retries ?? err.maxRetries) || void 0;
|
|
1671
|
-
const message = firstLine(
|
|
1693
|
+
const message = firstLine(errorMessage(o.content) ?? errorMessage(o.error) ?? errorMessage(o.cause) ?? "API problem", 100);
|
|
1672
1694
|
st.trouble = { message, at: ts ?? st.updatedAt, attempt, maxAttempts: max };
|
|
1673
1695
|
}
|
|
1674
|
-
|
|
1696
|
+
const retried = o.retryInMs !== void 0 || o.retryAttempt !== void 0;
|
|
1697
|
+
if ((o.level === "error" || o.subtype === "api_error") && !retried) {
|
|
1675
1698
|
st.phase = "error";
|
|
1676
1699
|
st.phaseAt = ts ?? st.updatedAt;
|
|
1677
|
-
st.errorText = firstLine(
|
|
1700
|
+
st.errorText = firstLine(errorMessage(o.content) ?? errorMessage(o.error) ?? "API error", 120);
|
|
1678
1701
|
}
|
|
1679
1702
|
return;
|
|
1680
1703
|
case "attachment": {
|
|
@@ -1736,6 +1759,7 @@ var ClaudeCodeAdapter = class {
|
|
|
1736
1759
|
return;
|
|
1737
1760
|
}
|
|
1738
1761
|
if (typeof m.model === "string" && m.model !== "<synthetic>") st.model = m.model;
|
|
1762
|
+
st.lastModelAt = ts;
|
|
1739
1763
|
this.countUsage(st, o, ts, ctx, true);
|
|
1740
1764
|
if (m.model !== "<synthetic>") st.trouble = void 0;
|
|
1741
1765
|
if (o.isApiErrorMessage || o.error && m.model === "<synthetic>") {
|
|
@@ -1863,6 +1887,7 @@ var ClaudeCodeAdapter = class {
|
|
|
1863
1887
|
if (!st.turnOpen) {
|
|
1864
1888
|
st.phase = "working";
|
|
1865
1889
|
st.phaseAt = ts;
|
|
1890
|
+
st.wokeAt = ts;
|
|
1866
1891
|
st.activity = { kind: "thinking", label: "Thinking", startedAt: ts };
|
|
1867
1892
|
}
|
|
1868
1893
|
}
|
|
@@ -2025,6 +2050,9 @@ var ClaudeCodeAdapter = class {
|
|
|
2025
2050
|
default:
|
|
2026
2051
|
status = allDone ? "done" : "idle";
|
|
2027
2052
|
}
|
|
2053
|
+
if (status === "working" && !st.turnOpen && st.wokeAt === st.phaseAt && now - st.phaseAt > WAKE_GRACE_MS) {
|
|
2054
|
+
status = allDone ? "done" : "idle";
|
|
2055
|
+
}
|
|
2028
2056
|
let lastSignal = st.updatedAt;
|
|
2029
2057
|
const live = st.pulse ? void 0 : st.live;
|
|
2030
2058
|
if (live?.at && live.at >= st.phaseAt - 1e3) {
|
|
@@ -2077,12 +2105,19 @@ var ClaudeCodeAdapter = class {
|
|
|
2077
2105
|
if (beat.phase === "needs-you") {
|
|
2078
2106
|
status = "waiting";
|
|
2079
2107
|
detail = beat.label ? `Needs you: ${truncate(beat.label, 80)}` : "Needs your input";
|
|
2080
|
-
} else if (status !== "waiting" && status !== "error"
|
|
2108
|
+
} else if (status !== "waiting" && (status !== "error" || beat.since > st.phaseAt)) {
|
|
2109
|
+
status = "working";
|
|
2110
|
+
detail = void 0;
|
|
2111
|
+
}
|
|
2081
2112
|
} else if (st.updatedAt <= beat.at + PULSE_FRESH_MS && (status === "working" || status === "waiting")) {
|
|
2082
2113
|
pulse = { phase: "gone", since: beat.at, at: beat.at };
|
|
2083
2114
|
status = "stale";
|
|
2084
2115
|
detail = "Claude Code stopped responding";
|
|
2085
2116
|
}
|
|
2117
|
+
} else if (beat && beat.at >= st.startedAt && PULSE_ENDED.has(beat.phase) && status === "working" && !background && beat.at >= (st.lastModelAt ?? 0) - 2e3 && now - beat.at > PULSE_FRESH_MS) {
|
|
2118
|
+
status = beat.phase === "error" ? "error" : allDone ? "done" : "idle";
|
|
2119
|
+
if (beat.phase === "interrupted") detail = "Interrupted";
|
|
2120
|
+
else if (beat.phase === "error") detail = st.errorText ?? "Stopped with an error";
|
|
2086
2121
|
}
|
|
2087
2122
|
if (status === "working") {
|
|
2088
2123
|
const stale = staleness(lastSignal, ctx);
|
|
@@ -2808,7 +2843,7 @@ function sdkFailure(result) {
|
|
|
2808
2843
|
}
|
|
2809
2844
|
if (!Array.isArray(content)) return void 0;
|
|
2810
2845
|
const failed = content.find((c) => c && typeof c === "object" && c.success === false);
|
|
2811
|
-
return failed ?
|
|
2846
|
+
return failed ? errorMessage(failed.error) ?? errorMessage(failed.result) ?? "Command failed" : void 0;
|
|
2812
2847
|
}
|
|
2813
2848
|
function sdkUserText(content) {
|
|
2814
2849
|
const text = contentText(content);
|
|
@@ -8544,7 +8579,7 @@ function qrTerminal(text, color = true) {
|
|
|
8544
8579
|
}
|
|
8545
8580
|
|
|
8546
8581
|
// src/index.ts
|
|
8547
|
-
var VERSION = "0.7.
|
|
8582
|
+
var VERSION = "0.7.5";
|
|
8548
8583
|
function parse(argv) {
|
|
8549
8584
|
const opts = {
|
|
8550
8585
|
json: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kvali/cli",
|
|
3
|
-
"version": "0.7.
|
|
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)",
|