@kvali/cli 0.7.9 → 0.7.10
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.10",
|
|
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
|
@@ -988,17 +988,24 @@ async function isolated(ctx, what, fn) {
|
|
|
988
988
|
}
|
|
989
989
|
}
|
|
990
990
|
var fileName = (p2) => p2.split(/[\\/]/).pop() ?? p2;
|
|
991
|
+
var SOON_MS = 250;
|
|
991
992
|
var JsonlSessionAdapter = class {
|
|
992
993
|
discoveryIntervalMs = 5e3;
|
|
993
994
|
tracked = /* @__PURE__ */ new Map();
|
|
994
995
|
lastDiscovery = 0;
|
|
996
|
+
/** A file it does not follow yet changed in a watched folder: look for sessions at once. */
|
|
997
|
+
soon = false;
|
|
998
|
+
changed(file) {
|
|
999
|
+
if (!file || !this.tracked.has(file)) this.soon = true;
|
|
1000
|
+
}
|
|
995
1001
|
/** Optional hook to read side files (plans, live state) after the transcript was read. */
|
|
996
1002
|
async afterRead(_state, _ctx, _changed) {
|
|
997
1003
|
}
|
|
998
1004
|
async poll(ctx) {
|
|
999
1005
|
const now = ctx.now();
|
|
1000
|
-
if (this.tracked.size === 0 || now - this.lastDiscovery >= this.discoveryIntervalMs) {
|
|
1006
|
+
if (this.tracked.size === 0 || now - this.lastDiscovery >= this.discoveryIntervalMs || this.soon && now - this.lastDiscovery >= SOON_MS) {
|
|
1001
1007
|
this.lastDiscovery = now;
|
|
1008
|
+
this.soon = false;
|
|
1002
1009
|
const candidates = (await this.discover(ctx)).filter((c) => now - c.mtimeMs <= ctx.activeWindowMs).sort((a, b) => b.mtimeMs - a.mtimeMs).slice(0, ctx.maxSessionsPerAgent);
|
|
1003
1010
|
const keep = new Set(candidates.map((c) => c.path));
|
|
1004
1011
|
for (const c of candidates) {
|
|
@@ -1033,6 +1040,7 @@ function staleness(updatedAt, ctx) {
|
|
|
1033
1040
|
}
|
|
1034
1041
|
|
|
1035
1042
|
// ../core/src/engine.ts
|
|
1043
|
+
import { existsSync as existsSync2, watch } from "node:fs";
|
|
1036
1044
|
import os from "node:os";
|
|
1037
1045
|
import path12 from "node:path";
|
|
1038
1046
|
|
|
@@ -1361,6 +1369,8 @@ var AntigravityAdapter = class {
|
|
|
1361
1369
|
label = "Antigravity";
|
|
1362
1370
|
tracked = /* @__PURE__ */ new Map();
|
|
1363
1371
|
lastDiscovery = 0;
|
|
1372
|
+
/** A conversation it does not follow yet changed in a watched folder: look for sessions at once. */
|
|
1373
|
+
soon = false;
|
|
1364
1374
|
extraBrainDirs;
|
|
1365
1375
|
constructor(extraBrainDirs = []) {
|
|
1366
1376
|
this.extraBrainDirs = extraBrainDirs;
|
|
@@ -1369,10 +1379,18 @@ var AntigravityAdapter = class {
|
|
|
1369
1379
|
const g = path3.join(ctx.home, ".gemini");
|
|
1370
1380
|
return [path3.join(g, "antigravity-ide", "brain"), path3.join(g, "antigravity", "brain"), ...this.extraBrainDirs];
|
|
1371
1381
|
}
|
|
1382
|
+
watchRoots(ctx) {
|
|
1383
|
+
return this.brainDirs(ctx);
|
|
1384
|
+
}
|
|
1385
|
+
changed(file) {
|
|
1386
|
+
if (file && [...this.tracked.keys()].some((dir) => file === dir || file.startsWith(dir + path3.sep))) return;
|
|
1387
|
+
this.soon = true;
|
|
1388
|
+
}
|
|
1372
1389
|
async poll(ctx) {
|
|
1373
1390
|
const now = ctx.now();
|
|
1374
|
-
if (this.tracked.size === 0 || now - this.lastDiscovery >= 5e3) {
|
|
1391
|
+
if (this.tracked.size === 0 || now - this.lastDiscovery >= 5e3 || this.soon && now - this.lastDiscovery >= SOON_MS) {
|
|
1375
1392
|
this.lastDiscovery = now;
|
|
1393
|
+
this.soon = false;
|
|
1376
1394
|
await this.discover(ctx);
|
|
1377
1395
|
}
|
|
1378
1396
|
const out = [];
|
|
@@ -1864,16 +1882,35 @@ var ClaudeCodeAdapter = class {
|
|
|
1864
1882
|
dirCache = /* @__PURE__ */ new Map();
|
|
1865
1883
|
lastDiscovery = 0;
|
|
1866
1884
|
lastFullScan = 0;
|
|
1885
|
+
/** A transcript it does not follow yet changed in the watched folder: look for sessions at once. */
|
|
1886
|
+
soon = false;
|
|
1867
1887
|
/** The subscription's usage windows, from every session's plugin heartbeat. */
|
|
1868
1888
|
limitBook = new LimitBook();
|
|
1869
1889
|
configDir(ctx) {
|
|
1870
1890
|
const fromEnv = ctx.env.CLAUDE_CONFIG_DIR?.split(",")[0]?.trim();
|
|
1871
1891
|
return fromEnv || path4.join(ctx.home, ".claude");
|
|
1872
1892
|
}
|
|
1893
|
+
/** The watched projects folder, as of the last `watchRoots`. */
|
|
1894
|
+
projectsDir;
|
|
1895
|
+
watchRoots(ctx) {
|
|
1896
|
+
this.projectsDir = path4.join(this.configDir(ctx), "projects");
|
|
1897
|
+
return [this.projectsDir];
|
|
1898
|
+
}
|
|
1899
|
+
changed(file) {
|
|
1900
|
+
if (file && this.sessions.has(file)) return;
|
|
1901
|
+
if (file && this.projectsDir) {
|
|
1902
|
+
const parent = path4.dirname(file);
|
|
1903
|
+
const transcript = file.endsWith(".jsonl") && path4.dirname(parent) === this.projectsDir;
|
|
1904
|
+
if (!transcript && parent !== this.projectsDir) return;
|
|
1905
|
+
}
|
|
1906
|
+
if (file?.endsWith(".jsonl")) this.dirCache.delete(path4.dirname(file));
|
|
1907
|
+
this.soon = true;
|
|
1908
|
+
}
|
|
1873
1909
|
async poll(ctx) {
|
|
1874
1910
|
const now = ctx.now();
|
|
1875
|
-
if (this.sessions.size === 0 || now - this.lastDiscovery >= 5e3) {
|
|
1911
|
+
if (this.sessions.size === 0 || now - this.lastDiscovery >= 5e3 || this.soon && now - this.lastDiscovery >= SOON_MS) {
|
|
1876
1912
|
this.lastDiscovery = now;
|
|
1913
|
+
this.soon = false;
|
|
1877
1914
|
await this.discover(ctx);
|
|
1878
1915
|
}
|
|
1879
1916
|
const out = [];
|
|
@@ -3515,6 +3552,19 @@ function parseArgs(raw) {
|
|
|
3515
3552
|
return {};
|
|
3516
3553
|
}
|
|
3517
3554
|
}
|
|
3555
|
+
var CODE_CELL = /\btools\.[A-Za-z_]\w*\s*\(/;
|
|
3556
|
+
function codeCommand(js) {
|
|
3557
|
+
const lit = /\bcmd\s*:\s*(?:(["'])((?:\\[\s\S]|(?!\1)[^\\])*)\1|`([^`]*)`)/.exec(js);
|
|
3558
|
+
if (lit) return lit[3] ?? lit[2].replace(/\\[nt]/g, " ").replace(/\\(["'\\])/g, "$1");
|
|
3559
|
+
const raw = /String\.raw\s*`([^`]*)`/.exec(js);
|
|
3560
|
+
return raw?.[1];
|
|
3561
|
+
}
|
|
3562
|
+
function describeCodeCell(js, at) {
|
|
3563
|
+
const cmd = summarizeCommand(codeCommand(js));
|
|
3564
|
+
if (/\btools\.(?:exec_command|shell_command|shell|exec|unified_exec)\s*\(/.test(js)) return { kind: "command", label: "Shell", detail: cmd, startedAt: at };
|
|
3565
|
+
if (/\btools\.apply_patch\s*\(/.test(js)) return { kind: "tool", label: "Editing files", startedAt: at };
|
|
3566
|
+
return { kind: "tool", label: "Running code", detail: cmd, startedAt: at };
|
|
3567
|
+
}
|
|
3518
3568
|
var SHELL_TOOLS = /^(?:shell|shell_command|exec_command|exec|unified_exec|container\.exec|local_shell)$/;
|
|
3519
3569
|
function describeCodexCall(name, args, at) {
|
|
3520
3570
|
if (SHELL_TOOLS.test(name)) {
|
|
@@ -3537,12 +3587,25 @@ var CodexAdapter = class extends JsonlSessionAdapter {
|
|
|
3537
3587
|
/** Rollouts in older day folders that were written lately: sessions resumed since they began. */
|
|
3538
3588
|
resumed = [];
|
|
3539
3589
|
resumedAt = -Infinity;
|
|
3590
|
+
/** Rollouts a watched folder said were written: a session resumed in any day's folder shows at once. */
|
|
3591
|
+
written = /* @__PURE__ */ new Set();
|
|
3540
3592
|
limits(ctx) {
|
|
3541
3593
|
const windows = this.limitBook.windows(ctx.now());
|
|
3542
3594
|
return windows.length ? { agent: this.id, agentLabel: this.label, windows } : void 0;
|
|
3543
3595
|
}
|
|
3544
3596
|
id = "codex";
|
|
3545
3597
|
label = "Codex";
|
|
3598
|
+
watchRoots(ctx) {
|
|
3599
|
+
return [path7.join(ctx.env.CODEX_HOME || path7.join(ctx.home, ".codex"), "sessions")];
|
|
3600
|
+
}
|
|
3601
|
+
changed(file) {
|
|
3602
|
+
if (file && !/^rollout-.*\.jsonl$/.test(path7.basename(file)) && /\.[A-Za-z]+$/.test(file)) return;
|
|
3603
|
+
super.changed(file);
|
|
3604
|
+
if (file && /^rollout-.*\.jsonl$/.test(path7.basename(file))) {
|
|
3605
|
+
if (this.written.size >= 200) this.written.clear();
|
|
3606
|
+
this.written.add(file);
|
|
3607
|
+
}
|
|
3608
|
+
}
|
|
3546
3609
|
async discover(ctx) {
|
|
3547
3610
|
const home = ctx.env.CODEX_HOME || path7.join(ctx.home, ".codex");
|
|
3548
3611
|
const root = path7.join(home, "sessions");
|
|
@@ -3589,10 +3652,12 @@ var CodexAdapter = class extends JsonlSessionAdapter {
|
|
|
3589
3652
|
}
|
|
3590
3653
|
this.resumed = found;
|
|
3591
3654
|
}
|
|
3592
|
-
for (const file of this.resumed) {
|
|
3655
|
+
for (const file of [...this.resumed, ...this.written]) {
|
|
3593
3656
|
if (seen.has(file)) continue;
|
|
3657
|
+
seen.add(file);
|
|
3594
3658
|
const st = await statSafe(file);
|
|
3595
3659
|
if (st) out.push({ path: file, mtimeMs: st.mtimeMs });
|
|
3660
|
+
else this.written.delete(file);
|
|
3596
3661
|
}
|
|
3597
3662
|
return out;
|
|
3598
3663
|
}
|
|
@@ -3796,7 +3861,7 @@ var CodexAdapter = class extends JsonlSessionAdapter {
|
|
|
3796
3861
|
case "custom_tool_call": {
|
|
3797
3862
|
const name = String(p2.name ?? "tool");
|
|
3798
3863
|
const input = typeof p2.input === "string" ? p2.input : void 0;
|
|
3799
|
-
const act = describeCodexCall(name, input !== void 0 ? { command: input } : {}, ts);
|
|
3864
|
+
const act = input !== void 0 && CODE_CELL.test(input) ? describeCodeCell(input, ts) : describeCodexCall(name, input !== void 0 ? { command: input } : {}, ts);
|
|
3800
3865
|
if (typeof p2.call_id === "string") {
|
|
3801
3866
|
st.open.set(p2.call_id, act);
|
|
3802
3867
|
if (input) st.callKeys.set(p2.call_id, `${act.kind === "command" ? "command" : name}:${input.slice(0, 2e3)}`);
|
|
@@ -3840,7 +3905,8 @@ var CodexAdapter = class extends JsonlSessionAdapter {
|
|
|
3840
3905
|
return;
|
|
3841
3906
|
case "message":
|
|
3842
3907
|
if (p2.role === "user") {
|
|
3843
|
-
const
|
|
3908
|
+
const parts = Array.isArray(p2.content) ? p2.content : [p2.content];
|
|
3909
|
+
const said = parts.map((c) => codexPrompt(contentText(Array.isArray(c) ? c : [c]))).find((x) => x !== void 0);
|
|
3844
3910
|
if (said) {
|
|
3845
3911
|
st.promptTitle ??= firstLine(said, 100);
|
|
3846
3912
|
st.loops.reset();
|
|
@@ -3919,7 +3985,7 @@ function codexPrompt(text) {
|
|
|
3919
3985
|
let t = text.trim();
|
|
3920
3986
|
const req = /^#{1,3}\s*My request for Codex:?[ \t]*$/im.exec(t);
|
|
3921
3987
|
if (req) t = t.slice(req.index + req[0].length).trim();
|
|
3922
|
-
else if (/^#\s*Context from my IDE setup
|
|
3988
|
+
else if (/^#\s*(?:Context from my IDE setup|[^\n]*\bby the user)\b[^\n]*$/im.test(t.split("\n", 1)[0] ?? "")) return void 0;
|
|
3923
3989
|
if (!t || t.startsWith("<") || /^#\s*AGENTS\.md\b/i.test(t)) return void 0;
|
|
3924
3990
|
return t;
|
|
3925
3991
|
}
|
|
@@ -4575,6 +4641,8 @@ var GeminiCliAdapter = class {
|
|
|
4575
4641
|
label = "Gemini CLI";
|
|
4576
4642
|
tracked = /* @__PURE__ */ new Map();
|
|
4577
4643
|
lastDiscovery = 0;
|
|
4644
|
+
/** A chat it does not follow yet changed in a watched folder: look for sessions at once. */
|
|
4645
|
+
soon = false;
|
|
4578
4646
|
roots(ctx) {
|
|
4579
4647
|
const homes = [ctx.env.GEMINI_CLI_HOME, ctx.home].filter((h) => !!h);
|
|
4580
4648
|
const out = /* @__PURE__ */ new Set();
|
|
@@ -4584,10 +4652,19 @@ var GeminiCliAdapter = class {
|
|
|
4584
4652
|
}
|
|
4585
4653
|
return [...out];
|
|
4586
4654
|
}
|
|
4655
|
+
watchRoots(ctx) {
|
|
4656
|
+
return this.roots(ctx);
|
|
4657
|
+
}
|
|
4658
|
+
changed(file) {
|
|
4659
|
+
if (file && this.tracked.has(file)) return;
|
|
4660
|
+
if (file && /\.[A-Za-z]+$/.test(file) && !/^session-.*\.jsonl?$/.test(path9.basename(file))) return;
|
|
4661
|
+
this.soon = true;
|
|
4662
|
+
}
|
|
4587
4663
|
async poll(ctx) {
|
|
4588
4664
|
const now = ctx.now();
|
|
4589
|
-
if (this.tracked.size === 0 || now - this.lastDiscovery >= 5e3) {
|
|
4665
|
+
if (this.tracked.size === 0 || now - this.lastDiscovery >= 5e3 || this.soon && now - this.lastDiscovery >= SOON_MS) {
|
|
4590
4666
|
this.lastDiscovery = now;
|
|
4667
|
+
this.soon = false;
|
|
4591
4668
|
await this.discover(ctx);
|
|
4592
4669
|
}
|
|
4593
4670
|
const out = [];
|
|
@@ -5600,6 +5677,9 @@ var ProgressFileAdapter = class {
|
|
|
5600
5677
|
};
|
|
5601
5678
|
|
|
5602
5679
|
// ../core/src/engine.ts
|
|
5680
|
+
var KICK_MS = 150;
|
|
5681
|
+
var KICK_GAP_MS = 400;
|
|
5682
|
+
var WATCH_SYNC_MS = 3e4;
|
|
5603
5683
|
function defaultLiveDir(home = os.homedir()) {
|
|
5604
5684
|
return path12.join(home, ".kvali", "live");
|
|
5605
5685
|
}
|
|
@@ -5690,11 +5770,22 @@ var Engine = class {
|
|
|
5690
5770
|
lastSignature = "";
|
|
5691
5771
|
current = { generatedAt: 0, sessions: [], errors: [] };
|
|
5692
5772
|
disabled;
|
|
5773
|
+
watchFolders;
|
|
5774
|
+
/** Per adapter and folder (`${id}\n${folder}`). */
|
|
5775
|
+
watchers = /* @__PURE__ */ new Map();
|
|
5776
|
+
/** Folders that could not be watched, said once in the log. */
|
|
5777
|
+
watchFailed = /* @__PURE__ */ new Set();
|
|
5778
|
+
lastWatchSync = -Infinity;
|
|
5779
|
+
kickTimer;
|
|
5780
|
+
/** A change came in while a poll ran: poll again once it is done. */
|
|
5781
|
+
kickAgain = false;
|
|
5782
|
+
lastKickAt = -Infinity;
|
|
5693
5783
|
constructor(opts = {}) {
|
|
5694
5784
|
const home = opts.home ?? os.homedir();
|
|
5695
5785
|
this.adapters = opts.adapters ?? createDefaultAdapters(opts);
|
|
5696
5786
|
this.disabled = new Set(opts.disabled ?? []);
|
|
5697
5787
|
this.intervalMs = opts.intervalMs ?? 1500;
|
|
5788
|
+
this.watchFolders = opts.watch ?? (process.platform === "darwin" || process.platform === "win32");
|
|
5698
5789
|
this.ctx = {
|
|
5699
5790
|
home,
|
|
5700
5791
|
env: opts.env ?? process.env,
|
|
@@ -5722,10 +5813,12 @@ var Engine = class {
|
|
|
5722
5813
|
if (opts.disabled) this.disabled = new Set(opts.disabled);
|
|
5723
5814
|
if (opts.intervalMs) this.intervalMs = opts.intervalMs;
|
|
5724
5815
|
this.lastSignature = "";
|
|
5816
|
+
this.lastWatchSync = -Infinity;
|
|
5725
5817
|
}
|
|
5726
5818
|
/** Swaps adapters, e.g. after a setting that changes an adapter's constructor options. */
|
|
5727
5819
|
setAdapters(adapters) {
|
|
5728
5820
|
for (const a of this.adapters) a.dispose?.();
|
|
5821
|
+
this.closeWatchers();
|
|
5729
5822
|
this.adapters = adapters;
|
|
5730
5823
|
this.lastSignature = "";
|
|
5731
5824
|
}
|
|
@@ -5742,6 +5835,9 @@ var Engine = class {
|
|
|
5742
5835
|
this.stopped = true;
|
|
5743
5836
|
if (this.timer) clearTimeout(this.timer);
|
|
5744
5837
|
this.timer = void 0;
|
|
5838
|
+
if (this.kickTimer) clearTimeout(this.kickTimer);
|
|
5839
|
+
this.kickTimer = void 0;
|
|
5840
|
+
this.closeWatchers();
|
|
5745
5841
|
}
|
|
5746
5842
|
dispose() {
|
|
5747
5843
|
this.stop();
|
|
@@ -5750,6 +5846,7 @@ var Engine = class {
|
|
|
5750
5846
|
}
|
|
5751
5847
|
async loop() {
|
|
5752
5848
|
if (this.stopped) return;
|
|
5849
|
+
if (this.watchFolders) this.syncWatchers();
|
|
5753
5850
|
try {
|
|
5754
5851
|
await this.tick();
|
|
5755
5852
|
} catch (err) {
|
|
@@ -5796,8 +5893,78 @@ var Engine = class {
|
|
|
5796
5893
|
return this.current;
|
|
5797
5894
|
} finally {
|
|
5798
5895
|
this.running = false;
|
|
5896
|
+
if (this.kickAgain) {
|
|
5897
|
+
this.kickAgain = false;
|
|
5898
|
+
this.kick();
|
|
5899
|
+
}
|
|
5799
5900
|
}
|
|
5800
5901
|
}
|
|
5902
|
+
/** Polls soon after a change in a watched folder, so a new session shows at once. */
|
|
5903
|
+
kick() {
|
|
5904
|
+
if (this.stopped || this.kickTimer) return;
|
|
5905
|
+
const delay = Math.max(KICK_MS, this.lastKickAt + KICK_GAP_MS - Date.now());
|
|
5906
|
+
this.kickTimer = setTimeout(() => {
|
|
5907
|
+
this.kickTimer = void 0;
|
|
5908
|
+
if (this.stopped) return;
|
|
5909
|
+
if (this.running) {
|
|
5910
|
+
this.kickAgain = true;
|
|
5911
|
+
return;
|
|
5912
|
+
}
|
|
5913
|
+
this.lastKickAt = Date.now();
|
|
5914
|
+
this.tick().catch((err) => this.ctx.log(`tick failed: ${err instanceof Error ? err.message : String(err)}`));
|
|
5915
|
+
}, delay);
|
|
5916
|
+
}
|
|
5917
|
+
/** Watches each adapter's folders that exist; one that cannot be watched is only polled, as before. */
|
|
5918
|
+
syncWatchers() {
|
|
5919
|
+
const now = this.ctx.now();
|
|
5920
|
+
if (now - this.lastWatchSync < WATCH_SYNC_MS) return;
|
|
5921
|
+
this.lastWatchSync = now;
|
|
5922
|
+
const want = /* @__PURE__ */ new Map();
|
|
5923
|
+
for (const a of this.adapters) {
|
|
5924
|
+
if (this.disabled.has(a.id) || !a.watchRoots) continue;
|
|
5925
|
+
let roots = [];
|
|
5926
|
+
try {
|
|
5927
|
+
roots = a.watchRoots(this.ctx);
|
|
5928
|
+
} catch {
|
|
5929
|
+
}
|
|
5930
|
+
for (const root of roots) want.set(`${a.id}
|
|
5931
|
+
${root}`, { adapter: a, root });
|
|
5932
|
+
}
|
|
5933
|
+
for (const [key, w] of this.watchers) {
|
|
5934
|
+
if (want.has(key)) continue;
|
|
5935
|
+
w.close();
|
|
5936
|
+
this.watchers.delete(key);
|
|
5937
|
+
}
|
|
5938
|
+
for (const [key, { adapter, root }] of want) {
|
|
5939
|
+
if (this.watchers.has(key) || !existsSync2(root)) continue;
|
|
5940
|
+
try {
|
|
5941
|
+
const w = watch(root, { recursive: true, persistent: false }, (_event, name) => {
|
|
5942
|
+
const file = name ? path12.join(root, String(name)) : void 0;
|
|
5943
|
+
try {
|
|
5944
|
+
adapter.changed?.(file);
|
|
5945
|
+
} catch {
|
|
5946
|
+
}
|
|
5947
|
+
this.kick();
|
|
5948
|
+
});
|
|
5949
|
+
w.on("error", () => {
|
|
5950
|
+
w.close();
|
|
5951
|
+
this.watchers.delete(key);
|
|
5952
|
+
});
|
|
5953
|
+
this.watchers.set(key, w);
|
|
5954
|
+
this.ctx.log(`[${adapter.id}] watching ${root}`);
|
|
5955
|
+
} catch (err) {
|
|
5956
|
+
if (!this.watchFailed.has(key)) {
|
|
5957
|
+
this.watchFailed.add(key);
|
|
5958
|
+
this.ctx.log(`[${adapter.id}] cannot watch ${root}, polling it: ${err instanceof Error ? err.message : String(err)}`);
|
|
5959
|
+
}
|
|
5960
|
+
}
|
|
5961
|
+
}
|
|
5962
|
+
}
|
|
5963
|
+
closeWatchers() {
|
|
5964
|
+
for (const w of this.watchers.values()) w.close();
|
|
5965
|
+
this.watchers.clear();
|
|
5966
|
+
this.lastWatchSync = -Infinity;
|
|
5967
|
+
}
|
|
5801
5968
|
};
|
|
5802
5969
|
|
|
5803
5970
|
// ../core/src/hooks/hub.ts
|
|
@@ -6498,12 +6665,12 @@ async function addProgressProtocol(root) {
|
|
|
6498
6665
|
}
|
|
6499
6666
|
|
|
6500
6667
|
// ../core/src/hooks/replies.ts
|
|
6501
|
-
import { existsSync as
|
|
6668
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
6502
6669
|
import path17 from "node:path";
|
|
6503
6670
|
var CLAUDE_PLAN_CONTEXT = "Progress tracking (Kvali): if this request takes more than two steps, start by creating a task list with TaskCreate or TodoWrite, whichever you have (if neither is in your tool list, look for them once with ToolSearch, and go on without a list if they are not there), keep exactly one task in_progress, and mark each task completed as soon as it is done. The user follows your progress from that list, so keep it current.";
|
|
6504
6671
|
function pluginRunsIn(liveDir, sessionId) {
|
|
6505
6672
|
if (!/^[A-Za-z0-9-]{8,80}$/.test(sessionId)) return false;
|
|
6506
|
-
return
|
|
6673
|
+
return existsSync3(path17.join(liveDir, "claude-code", `${sessionId}.mod.json`));
|
|
6507
6674
|
}
|
|
6508
6675
|
function claudeHookReply(ev, session, pluginRuns = false) {
|
|
6509
6676
|
if (ev.event !== "UserPromptSubmit") return void 0;
|
|
@@ -9029,7 +9196,7 @@ function qrTerminal(text, color = true) {
|
|
|
9029
9196
|
}
|
|
9030
9197
|
|
|
9031
9198
|
// src/index.ts
|
|
9032
|
-
var VERSION = "0.7.
|
|
9199
|
+
var VERSION = "0.7.10";
|
|
9033
9200
|
function parse(argv) {
|
|
9034
9201
|
const opts = {
|
|
9035
9202
|
json: false,
|
|
@@ -9552,7 +9719,7 @@ async function main() {
|
|
|
9552
9719
|
return;
|
|
9553
9720
|
}
|
|
9554
9721
|
if (cmd[0] === "phone") return phone(cmd[1], opts, cmd[2]);
|
|
9555
|
-
if (cmd[0] === "watch") return
|
|
9722
|
+
if (cmd[0] === "watch") return watch2(opts);
|
|
9556
9723
|
if (cmd[0] === "week") return week(opts, opts.svg);
|
|
9557
9724
|
if (cmd[0] === "plan-rule") {
|
|
9558
9725
|
for (const r of await addGlobalPlanRule(opts.home, process2.env)) console.log(`${r.agent}: ${r.result} (${r.file})`);
|
|
@@ -9619,7 +9786,7 @@ ${phoneLine ? `${phoneLine}
|
|
|
9619
9786
|
});
|
|
9620
9787
|
}
|
|
9621
9788
|
}
|
|
9622
|
-
async function
|
|
9789
|
+
async function watch2(opts) {
|
|
9623
9790
|
const engine = makeEngine(opts);
|
|
9624
9791
|
const hub = new HookHub({
|
|
9625
9792
|
port: opts.port,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kvali/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.10",
|
|
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)",
|