@kvali/cli 0.7.8 → 0.7.9

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.8",
3
+ "version": "0.7.9",
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
@@ -3515,8 +3515,9 @@ function parseArgs(raw) {
3515
3515
  return {};
3516
3516
  }
3517
3517
  }
3518
+ var SHELL_TOOLS = /^(?:shell|shell_command|exec_command|exec|unified_exec|container\.exec|local_shell)$/;
3518
3519
  function describeCodexCall(name, args, at) {
3519
- if (name === "shell" || name === "exec_command" || name === "container.exec" || name === "local_shell") {
3520
+ if (SHELL_TOOLS.test(name)) {
3520
3521
  return { kind: "command", label: "Shell", detail: summarizeCommand(args.command ?? args.cmd), startedAt: at };
3521
3522
  }
3522
3523
  if (name === "apply_patch") return { kind: "tool", label: "Editing files", startedAt: at };
@@ -3608,6 +3609,7 @@ var CodexAdapter = class extends JsonlSessionAdapter {
3608
3609
  daily,
3609
3610
  tasks: [],
3610
3611
  open: /* @__PURE__ */ new Map(),
3612
+ callKeys: /* @__PURE__ */ new Map(),
3611
3613
  phase: "idle",
3612
3614
  phaseAt: 0,
3613
3615
  turns: 0,
@@ -3640,6 +3642,7 @@ var CodexAdapter = class extends JsonlSessionAdapter {
3640
3642
  if (typeof p2.originator === "string") st.originator = p2.originator;
3641
3643
  else if (typeof p2.source === "string") st.originator = p2.source;
3642
3644
  if (p2.parent_thread_id || p2.agent_role || p2.agent_nickname) st.isSubagent = true;
3645
+ if (p2.source && typeof p2.source === "object" && "subagent" in p2.source) st.isSubagent = true;
3643
3646
  const started = parseTime(p2.timestamp);
3644
3647
  if (started) st.startedAt = Math.min(st.startedAt ?? started, started);
3645
3648
  return;
@@ -3674,11 +3677,13 @@ var CodexAdapter = class extends JsonlSessionAdapter {
3674
3677
  st.phase = "idle";
3675
3678
  st.phaseAt = ts;
3676
3679
  st.open.clear();
3680
+ st.callKeys.clear();
3677
3681
  return;
3678
3682
  case "turn_aborted":
3679
3683
  st.phase = "interrupted";
3680
3684
  st.phaseAt = ts;
3681
3685
  st.open.clear();
3686
+ st.callKeys.clear();
3682
3687
  st.loops.reset();
3683
3688
  return;
3684
3689
  case "error":
@@ -3688,7 +3693,8 @@ var CodexAdapter = class extends JsonlSessionAdapter {
3688
3693
  return;
3689
3694
  case "user_message":
3690
3695
  if (typeof p2.message === "string" && p2.message.trim()) {
3691
- st.title ??= firstLine(p2.message, 100);
3696
+ const said = codexPrompt(p2.message);
3697
+ if (said) st.title ??= firstLine(said, 100);
3692
3698
  st.loops.reset();
3693
3699
  if (st.phase !== "working") {
3694
3700
  st.phase = "working";
@@ -3788,10 +3794,20 @@ var CodexAdapter = class extends JsonlSessionAdapter {
3788
3794
  return;
3789
3795
  }
3790
3796
  case "custom_tool_call": {
3791
- const act = describeCodexCall(String(p2.name ?? "tool"), {}, ts);
3792
- if (typeof p2.call_id === "string") st.open.set(p2.call_id, act);
3797
+ const name = String(p2.name ?? "tool");
3798
+ const input = typeof p2.input === "string" ? p2.input : void 0;
3799
+ const act = describeCodexCall(name, input !== void 0 ? { command: input } : {}, ts);
3800
+ if (typeof p2.call_id === "string") {
3801
+ st.open.set(p2.call_id, act);
3802
+ if (input) st.callKeys.set(p2.call_id, `${act.kind === "command" ? "command" : name}:${input.slice(0, 2e3)}`);
3803
+ }
3793
3804
  st.activity = act;
3794
3805
  st.turnSteps += 1;
3806
+ if (name !== "update_plan") {
3807
+ st.recent.unshift(act);
3808
+ if (st.recent.length > 6) st.recent.length = 6;
3809
+ st.timer.step();
3810
+ }
3795
3811
  return;
3796
3812
  }
3797
3813
  case "local_shell_call": {
@@ -3806,9 +3822,13 @@ var CodexAdapter = class extends JsonlSessionAdapter {
3806
3822
  const done = typeof p2.call_id === "string" ? st.open.get(p2.call_id) : void 0;
3807
3823
  if (done) {
3808
3824
  done.endedAt = ts;
3809
- st.loops.observe(loopKey(done), done, codexFailure(p2.output), ts, st.tokens ? totalTokens(st.tokens) : void 0);
3825
+ const key = st.callKeys.get(p2.call_id) ?? loopKey(done);
3826
+ st.loops.observe(key, done, codexFailure(p2.output), ts, st.tokens ? totalTokens(st.tokens) : void 0);
3827
+ }
3828
+ if (typeof p2.call_id === "string") {
3829
+ st.open.delete(p2.call_id);
3830
+ st.callKeys.delete(p2.call_id);
3810
3831
  }
3811
- if (typeof p2.call_id === "string") st.open.delete(p2.call_id);
3812
3832
  st.activity = { kind: "thinking", label: "Thinking", startedAt: ts };
3813
3833
  return;
3814
3834
  }
@@ -3819,6 +3839,14 @@ var CodexAdapter = class extends JsonlSessionAdapter {
3819
3839
  st.activity = { kind: "thinking", label: "Thinking", startedAt: ts };
3820
3840
  return;
3821
3841
  case "message":
3842
+ if (p2.role === "user") {
3843
+ const said = codexPrompt(contentText(p2.content));
3844
+ if (said) {
3845
+ st.promptTitle ??= firstLine(said, 100);
3846
+ st.loops.reset();
3847
+ }
3848
+ return;
3849
+ }
3822
3850
  if (p2.role === "assistant" && contentText(p2.content).trim()) {
3823
3851
  st.activity = { kind: "message", label: "Writing a reply", startedAt: ts };
3824
3852
  }
@@ -3860,13 +3888,13 @@ var CodexAdapter = class extends JsonlSessionAdapter {
3860
3888
  agent: "codex",
3861
3889
  agentLabel: this.label,
3862
3890
  id: st.id,
3863
- title: st.title ?? "Untitled session",
3864
- titleFromPrompt: st.title !== void 0 ? true : void 0,
3891
+ title: st.title ?? st.promptTitle ?? "Untitled session",
3892
+ titleFromPrompt: (st.title ?? st.promptTitle) !== void 0 ? true : void 0,
3865
3893
  projectPath: st.cwd ? findGitRoot(st.cwd) ?? st.cwd : void 0,
3866
3894
  cwd: st.cwd,
3867
3895
  model: st.model,
3868
3896
  agentVersion: st.version,
3869
- host: st.originator === void 0 ? void 0 : /vscode|ide/.test(st.originator) ? "editor" : /exec|mcp|sdk/.test(st.originator) ? "app" : "terminal",
3897
+ host: codexHost(st.originator),
3870
3898
  status,
3871
3899
  statusDetail: detail,
3872
3900
  startedAt: st.startedAt,
@@ -3887,6 +3915,21 @@ var CodexAdapter = class extends JsonlSessionAdapter {
3887
3915
  };
3888
3916
  }
3889
3917
  };
3918
+ function codexPrompt(text) {
3919
+ let t = text.trim();
3920
+ const req = /^#{1,3}\s*My request for Codex:?[ \t]*$/im.exec(t);
3921
+ if (req) t = t.slice(req.index + req[0].length).trim();
3922
+ else if (/^#\s*Context from my IDE setup/i.test(t)) return void 0;
3923
+ if (!t || t.startsWith("<") || /^#\s*AGENTS\.md\b/i.test(t)) return void 0;
3924
+ return t;
3925
+ }
3926
+ function codexHost(originator) {
3927
+ if (originator === void 0) return void 0;
3928
+ if (/desktop/i.test(originator)) return "app";
3929
+ if (/vscode|ide/.test(originator)) return "editor";
3930
+ if (/exec|mcp|sdk/.test(originator)) return "app";
3931
+ return "terminal";
3932
+ }
3890
3933
  function loopOf(st, status, now) {
3891
3934
  const l = status === "working" || status === "stale" ? st.loops.current(now) : void 0;
3892
3935
  if (!l) return void 0;
@@ -4790,9 +4833,9 @@ function todosOf(list) {
4790
4833
  if (!Array.isArray(list)) return void 0;
4791
4834
  return list.filter((t) => t && typeof t.content === "string" && t.content.trim()).map((t, i) => ({ id: typeof t.id === "string" ? t.id : String(i + 1), title: t.content.trim(), status: todoStatus3(t.status) }));
4792
4835
  }
4793
- var SHELL_TOOLS = /* @__PURE__ */ new Set(["shell", "bash"]);
4836
+ var SHELL_TOOLS2 = /* @__PURE__ */ new Set(["shell", "bash"]);
4794
4837
  function toolAct(name, input, at) {
4795
- if (SHELL_TOOLS.has(name)) return { kind: "command", label: "Shell", detail: summarizeCommand(input.command), startedAt: at };
4838
+ if (SHELL_TOOLS2.has(name)) return { kind: "command", label: "Shell", detail: summarizeCommand(input.command), startedAt: at };
4796
4839
  const file = typeof input.filePath === "string" ? input.filePath : typeof input.path === "string" ? input.path : void 0;
4797
4840
  const short = (p2) => p2 ? truncate(p2, 80) : void 0;
4798
4841
  switch (name) {
@@ -4831,7 +4874,7 @@ function failureOf(name, state, contentText2) {
4831
4874
  const e = state.error;
4832
4875
  return typeof e === "string" ? e : typeof e?.message === "string" ? e.message : "Tool error";
4833
4876
  }
4834
- if (state.status !== "completed" || !SHELL_TOOLS.has(name)) return void 0;
4877
+ if (state.status !== "completed" || !SHELL_TOOLS2.has(name)) return void 0;
4835
4878
  const m = state.metadata ?? {};
4836
4879
  if (m.timeout === true) return `Timed out
4837
4880
  ${contentText2()}`;
@@ -8986,7 +9029,7 @@ function qrTerminal(text, color = true) {
8986
9029
  }
8987
9030
 
8988
9031
  // src/index.ts
8989
- var VERSION = "0.7.8";
9032
+ var VERSION = "0.7.9";
8990
9033
  function parse(argv) {
8991
9034
  const opts = {
8992
9035
  json: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvali/cli",
3
- "version": "0.7.8",
3
+ "version": "0.7.9",
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)",