kimiflare 0.43.0 → 0.44.0

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/index.js CHANGED
@@ -2693,6 +2693,9 @@ function collapsePath(input, cwd, maxLen = 40) {
2693
2693
  if (parts.length <= 2) return input;
2694
2694
  return `\u2026/${parts.slice(-2).join(sep)}`;
2695
2695
  }
2696
+ function collapsePathsInText(s, cwd, maxLen = 40) {
2697
+ return s.replace(/([~/][^\s"',)}\]]+)/g, (match) => collapsePath(match, cwd, maxLen));
2698
+ }
2696
2699
  var init_paths = __esm({
2697
2700
  "src/util/paths.ts"() {
2698
2701
  "use strict";
@@ -6755,186 +6758,6 @@ var init_diff_view = __esm({
6755
6758
  }
6756
6759
  });
6757
6760
 
6758
- // src/ui/narrative.ts
6759
- function countByCategory(items) {
6760
- let reads = 0;
6761
- let writes = 0;
6762
- let shells = 0;
6763
- let webs = 0;
6764
- let memories = 0;
6765
- let others = 0;
6766
- for (const t of items) {
6767
- if (READING_TOOLS.has(t.name)) reads++;
6768
- else if (WRITING_TOOLS.has(t.name)) writes++;
6769
- else if (SHELL_TOOLS.has(t.name)) shells++;
6770
- else if (WEB_TOOLS.has(t.name)) webs++;
6771
- else if (MEMORY_TOOLS.has(t.name)) memories++;
6772
- else others++;
6773
- }
6774
- return { reads, writes, shells, webs, memories, others };
6775
- }
6776
- function pickOne(arr) {
6777
- return arr[Math.floor(Math.random() * arr.length)];
6778
- }
6779
- function generateActivityText(items, _ctx) {
6780
- if (items.length === 0) return null;
6781
- const { reads, writes, shells, webs, memories } = countByCategory(items);
6782
- const total = items.length;
6783
- if (total === 1) {
6784
- const t = items[0];
6785
- if (t.name === "read") {
6786
- const path = typeof t.args?.path === "string" ? t.args.path : "a file";
6787
- return pickOne([`Reading ${path}\u2026`, `Opening ${path}\u2026`, `Taking a look at ${path}\u2026`]);
6788
- }
6789
- if (t.name === "grep") {
6790
- const pattern = typeof t.args?.pattern === "string" ? `"${t.args.pattern}"` : "for patterns";
6791
- return pickOne([`Searching for ${pattern}\u2026`, `Hunting for ${pattern}\u2026`]);
6792
- }
6793
- if (t.name === "glob") {
6794
- const pattern = typeof t.args?.pattern === "string" ? t.args.pattern : "files";
6795
- return pickOne([`Finding ${pattern}\u2026`, `Gathering ${pattern}\u2026`]);
6796
- }
6797
- if (t.name === "write") {
6798
- const path = typeof t.args?.path === "string" ? t.args.path : "a file";
6799
- return pickOne([`Creating ${path}\u2026`, `Writing ${path}\u2026`]);
6800
- }
6801
- if (t.name === "edit") {
6802
- const path = typeof t.args?.path === "string" ? t.args.path : "a file";
6803
- return pickOne([`Patching ${path}\u2026`, `Editing ${path}\u2026`]);
6804
- }
6805
- if (t.name === "bash") {
6806
- return pickOne([`Running a shell command\u2026`, `Executing something in the terminal\u2026`]);
6807
- }
6808
- if (t.name === "web_fetch") {
6809
- return pickOne([`Fetching docs\u2026`, `Checking a reference\u2026`, `Looking something up\u2026`]);
6810
- }
6811
- if (t.name === "memory_remember") {
6812
- return pickOne([`Taking notes for next time\u2026`, `Committing that to memory\u2026`]);
6813
- }
6814
- if (t.name === "memory_recall") {
6815
- return pickOne([`Recalling what we know\u2026`, `Searching past notes\u2026`]);
6816
- }
6817
- return null;
6818
- }
6819
- if (webs >= 2) {
6820
- return pickOne([`Digging through documentation\u2026`, `Cross-referencing sources\u2026`, `Reading up on this\u2026`]);
6821
- }
6822
- if (reads >= 2 && writes === 0 && shells === 0) {
6823
- return pickOne([`Surveying the landscape\u2026`, `Getting the lay of the land\u2026`, `Mapping out the files\u2026`]);
6824
- }
6825
- if (reads >= 1 && (writes >= 1 || shells >= 1)) {
6826
- return pickOne([`Reading, then making changes\u2026`, `Exploring and editing\u2026`, `Survey and patch\u2026`]);
6827
- }
6828
- if (writes >= 1 && shells >= 1) {
6829
- return pickOne([`Committing the changes\u2026`, `Writing and verifying\u2026`, `Editing and checking\u2026`]);
6830
- }
6831
- if (reads >= 1 && webs >= 1) {
6832
- return pickOne([`Exploring the codebase and docs\u2026`, `Cross-referencing code with references\u2026`]);
6833
- }
6834
- if (memories >= 1) {
6835
- return pickOne([`Jogging the memory\u2026`, `Checking past notes\u2026`]);
6836
- }
6837
- if (shells >= 1) {
6838
- return pickOne([`Running some commands\u2026`, `Working in the shell\u2026`]);
6839
- }
6840
- return null;
6841
- }
6842
- function narrativizeInfo(text, ctx) {
6843
- if (ctx?.tier === "heavy") {
6844
- return { kind: "activity", text: "Sizing this up\u2026 feels like a deep one.", feature: "triage" };
6845
- }
6846
- if (ctx?.tier === "light") {
6847
- return { kind: "activity", text: "Quick check \u2014 this looks light.", feature: "triage" };
6848
- }
6849
- if (ctx?.tier === "medium") {
6850
- return { kind: "activity", text: "This one feels medium weight.", feature: "triage" };
6851
- }
6852
- if (ctx?.codeMode) {
6853
- return { kind: "activity", text: "The toolbox feels right for this. Switching to code mode\u2026", feature: "code" };
6854
- }
6855
- if (text.includes("auto-compacted") || text.includes("compacted")) {
6856
- return { kind: "activity", text: "Making room by summarizing older turns\u2026", feature: "compact" };
6857
- }
6858
- if (text.includes("recalled") && text.includes("memory")) {
6859
- return { kind: "activity", text: "Remembering what we learned before\u2026", feature: "memory" };
6860
- }
6861
- if (text.includes("memory cleanup") || text.includes("memory backfill")) {
6862
- return null;
6863
- }
6864
- if (text.startsWith("LSP ready")) {
6865
- return { kind: "activity", text: "Waking up the language servers\u2026" };
6866
- }
6867
- if (text.startsWith("LSP reload complete")) {
6868
- return null;
6869
- }
6870
- if (text.startsWith("MCP connected")) {
6871
- return { kind: "activity", text: "Plugging in external tools\u2026" };
6872
- }
6873
- if (text.includes("research budget") || text.includes("web request")) {
6874
- return { kind: "activity", text: "Researching\u2026 gathering what we can from the web.", feature: "explore" };
6875
- }
6876
- return null;
6877
- }
6878
- function humanizeToolTitle(name, args) {
6879
- const path = typeof args?.path === "string" ? args.path : void 0;
6880
- const pattern = typeof args?.pattern === "string" ? args.pattern : void 0;
6881
- const command = typeof args?.command === "string" ? args.command : void 0;
6882
- const url = typeof args?.url === "string" ? args.url : void 0;
6883
- switch (name) {
6884
- case "read":
6885
- return path ? `Reading ${path}` : "Reading a file\u2026";
6886
- case "grep":
6887
- return pattern ? `Searching for "${pattern}"` : "Searching\u2026";
6888
- case "glob":
6889
- return pattern ? `Finding ${pattern}` : "Finding files\u2026";
6890
- case "write":
6891
- return path ? `Creating ${path}` : "Creating a file\u2026";
6892
- case "edit":
6893
- return path ? `Patching ${path}` : "Patching a file\u2026";
6894
- case "bash":
6895
- return command ? `Running: ${command.split(/\s+/).slice(0, 4).join(" ")}${command.split(/\s+/).length > 4 ? "\u2026" : ""}` : "Running shell command\u2026";
6896
- case "web_fetch":
6897
- return url ? `Fetching ${url.replace(/^https?:\/\//, "").split("/")[0]}` : "Fetching docs\u2026";
6898
- case "memory_remember":
6899
- return "Committing to memory\u2026";
6900
- case "memory_recall":
6901
- return "Recalling memories\u2026";
6902
- case "memory_forget":
6903
- return "Forgetting a memory\u2026";
6904
- case "lsp_hover":
6905
- return "Inspecting symbol\u2026";
6906
- case "lsp_definition":
6907
- return "Jumping to definition\u2026";
6908
- case "lsp_references":
6909
- return "Finding references\u2026";
6910
- case "lsp_implementation":
6911
- return "Finding implementations\u2026";
6912
- case "lsp_typeDefinition":
6913
- return "Finding type definition\u2026";
6914
- case "lsp_documentSymbols":
6915
- return "Listing symbols\u2026";
6916
- case "lsp_workspaceSymbol":
6917
- return "Searching workspace symbols\u2026";
6918
- case "lsp_rename":
6919
- return "Renaming symbol\u2026";
6920
- case "lsp_codeAction":
6921
- return "Applying quick fix\u2026";
6922
- default:
6923
- return name;
6924
- }
6925
- }
6926
- var READING_TOOLS, WRITING_TOOLS, SHELL_TOOLS, WEB_TOOLS, MEMORY_TOOLS;
6927
- var init_narrative = __esm({
6928
- "src/ui/narrative.ts"() {
6929
- "use strict";
6930
- READING_TOOLS = /* @__PURE__ */ new Set(["read", "glob", "grep", "lsp_hover", "lsp_definition", "lsp_references", "lsp_implementation", "lsp_typeDefinition", "lsp_documentSymbols", "lsp_workspaceSymbol"]);
6931
- WRITING_TOOLS = /* @__PURE__ */ new Set(["write", "edit", "lsp_rename", "lsp_codeAction"]);
6932
- SHELL_TOOLS = /* @__PURE__ */ new Set(["bash"]);
6933
- WEB_TOOLS = /* @__PURE__ */ new Set(["web_fetch"]);
6934
- MEMORY_TOOLS = /* @__PURE__ */ new Set(["memory_remember", "memory_recall", "memory_forget"]);
6935
- }
6936
- });
6937
-
6938
6761
  // src/ui/tool-view.tsx
6939
6762
  import React2, { useEffect, useState } from "react";
6940
6763
  import { Box as Box2, Text as Text2 } from "ink";
@@ -6948,6 +6771,11 @@ function formatElapsed(ms) {
6948
6771
  if (m === 0) return `${s}s`;
6949
6772
  return `${m}m ${s}s`;
6950
6773
  }
6774
+ function compactArgs(raw) {
6775
+ const collapsed = collapsePathsInText(raw, process.cwd());
6776
+ const s = collapsed.replace(/\s+/g, " ");
6777
+ return s.length <= 80 ? s : s.slice(0, 80) + "\u2026";
6778
+ }
6951
6779
  function firstLine(s) {
6952
6780
  const line = s.split("\n").find((l) => l.trim().length > 0) ?? "";
6953
6781
  return line.length <= 120 ? line : line.slice(0, 120) + "\u2026";
@@ -6959,7 +6787,6 @@ var init_tool_view = __esm({
6959
6787
  init_diff_view();
6960
6788
  init_paths();
6961
6789
  init_theme_context();
6962
- init_narrative();
6963
6790
  ToolView = React2.memo(function ToolView2({ evt, verbose, isRepeated }) {
6964
6791
  const theme = useTheme();
6965
6792
  const [now2, setNow] = useState(Date.now());
@@ -6973,14 +6800,7 @@ var init_tool_view = __esm({
6973
6800
  return () => clearInterval(id);
6974
6801
  }, [evt.status, evt.startedAt]);
6975
6802
  const statusIcon = evt.status === "running" ? /* @__PURE__ */ jsx3(Text2, { color: theme.info.color, children: /* @__PURE__ */ jsx3(Spinner, { type: "dots" }) }) : evt.status === "error" ? /* @__PURE__ */ jsx3(Text2, { color: theme.palette.error, children: "\u2717" }) : /* @__PURE__ */ jsx3(Text2, { color: theme.palette.success, children: "\u2713" });
6976
- let title = evt.render?.title ?? (() => {
6977
- try {
6978
- const args = evt.args ? JSON.parse(evt.args) : {};
6979
- return humanizeToolTitle(evt.name, args);
6980
- } catch {
6981
- return humanizeToolTitle(evt.name);
6982
- }
6983
- })();
6803
+ let title = evt.render?.title ?? `${evt.name}(${compactArgs(evt.args)})`;
6984
6804
  if (evt.startedAt !== void 0) {
6985
6805
  title += ` \xB7 ${formatElapsed(now2 - evt.startedAt)}`;
6986
6806
  }
@@ -7302,7 +7122,7 @@ var init_chat = __esm({
7302
7122
  init_tool_view();
7303
7123
  init_markdown();
7304
7124
  init_theme_context();
7305
- ChatView = React4.memo(function ChatView2({ events, showReasoning, verbose, suppressTools }) {
7125
+ ChatView = React4.memo(function ChatView2({ events, showReasoning, verbose }) {
7306
7126
  const theme = useTheme();
7307
7127
  const finalized = [];
7308
7128
  const active = [];
@@ -7319,7 +7139,6 @@ var init_chat = __esm({
7319
7139
  }
7320
7140
  for (let i = 0; i < events.length; i++) {
7321
7141
  const e = events[i];
7322
- if (suppressTools && e.kind === "tool") continue;
7323
7142
  const isStreaming = e.kind === "assistant" && e.streaming;
7324
7143
  if (isStreaming) {
7325
7144
  active.push(e);
@@ -7409,12 +7228,6 @@ var init_chat = __esm({
7409
7228
  if (parts.length === 0) return null;
7410
7229
  return /* @__PURE__ */ jsx5(Text4, { color: theme.info.color, dimColor: true, children: parts.join(" \xB7 ") });
7411
7230
  }
7412
- if (evt.kind === "activity") {
7413
- return /* @__PURE__ */ jsxs4(Text4, { italic: true, color: theme.info.dim ? theme.info.color : theme.palette.secondary, children: [
7414
- "~ ",
7415
- evt.text
7416
- ] });
7417
- }
7418
7231
  return /* @__PURE__ */ jsxs4(Text4, { color: theme.error, children: [
7419
7232
  "! ",
7420
7233
  evt.text
@@ -7446,7 +7259,7 @@ import { useEffect as useEffect2, useState as useState2 } from "react";
7446
7259
  import { Box as Box5, Text as Text5 } from "ink";
7447
7260
  import Spinner3 from "ink-spinner";
7448
7261
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
7449
- function StatusBar({ model, usage, sessionUsage, thinking, turnStartedAt, mode, effort, contextLimit, hasUpdate, latestVersion, gatewayMeta, codeMode, cloudMode, cloudBudget, skillsActive, memoryRecalled, phase, currentTool, lastActivityAt, kimiMdStale }) {
7262
+ function StatusBar({ model, usage, sessionUsage, thinking, turnStartedAt, mode, effort, contextLimit, hasUpdate, latestVersion, gatewayMeta, codeMode, cloudMode, cloudBudget, skillsActive, memoryRecalled, phase, currentTool, lastActivityAt, kimiMdStale, gitBranch }) {
7450
7263
  const theme = useTheme();
7451
7264
  const [now2, setNow] = useState2(Date.now());
7452
7265
  const modeColor = mode === "plan" ? theme.modeBadge.plan : mode === "auto" ? theme.modeBadge.auto : theme.modeBadge.edit;
@@ -7458,6 +7271,7 @@ function StatusBar({ model, usage, sessionUsage, thinking, turnStartedAt, mode,
7458
7271
  }, [thinking, turnStartedAt]);
7459
7272
  const elapsed = turnStartedAt !== null ? formatElapsed2(now2 - turnStartedAt) : null;
7460
7273
  const leftParts = [`${shortModel(model)}`, effort];
7274
+ if (gitBranch) leftParts.push(gitBranch);
7461
7275
  if (cloudMode) leftParts.push("CLOUD");
7462
7276
  if (codeMode) leftParts.push("CODE");
7463
7277
  const labelParts = [];
@@ -7506,7 +7320,8 @@ function StatusBar({ model, usage, sessionUsage, thinking, turnStartedAt, mode,
7506
7320
  " \xB7 ",
7507
7321
  "\u26A0 KIMI.md stale \xB7 run /init"
7508
7322
  ] }) : null
7509
- ] })
7323
+ ] }),
7324
+ !thinking && /* @__PURE__ */ jsx6(Box5, { children: /* @__PURE__ */ jsx6(Text5, { color: theme.muted?.color ?? theme.info.color, dimColor: theme.muted?.dim, children: "tip: shift+tab cycles mode" }) })
7510
7325
  ] });
7511
7326
  }
7512
7327
  function buildRightParts(usage, contextLimit, sessionUsage, gatewayMeta, cloudMode, cloudBudget) {
@@ -14520,6 +14335,13 @@ function detectGitHubRepo(cachedRepo) {
14520
14335
  }
14521
14336
  return null;
14522
14337
  }
14338
+ function detectGitBranch() {
14339
+ try {
14340
+ return execSync2("git branch --show-current", { cwd: process.cwd(), encoding: "utf8" }).trim() || null;
14341
+ } catch {
14342
+ return null;
14343
+ }
14344
+ }
14523
14345
  function formatTokens4(n) {
14524
14346
  if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
14525
14347
  if (n >= 1e3) return `${(n / 1e3).toFixed(1)}K`;
@@ -14649,6 +14471,10 @@ function App({
14649
14471
  const [intentTier, setIntentTier] = useState10(null);
14650
14472
  const skillsDirRef = useRef3(join25(process.cwd(), ".kimiflare", "skills"));
14651
14473
  const [kimiMdStale, setKimiMdStale] = useState10(false);
14474
+ const [gitBranch, setGitBranch] = useState10(null);
14475
+ useEffect7(() => {
14476
+ setGitBranch(detectGitBranch());
14477
+ }, []);
14652
14478
  useEffect7(() => {
14653
14479
  let cancelled = false;
14654
14480
  loadAndMergeThemes().then(({ errors, wcagWarnings }) => {
@@ -14703,8 +14529,6 @@ ${wcagWarnings.join("\n")}` }
14703
14529
  const permResolveRef = useRef3(null);
14704
14530
  const limitResolveRef = useRef3(null);
14705
14531
  const pendingToolCallsRef = useRef3(/* @__PURE__ */ new Map());
14706
- const toolBatchRef = useRef3([]);
14707
- const toolBatchTimerRef = useRef3(null);
14708
14532
  const sessionIdRef = useRef3(null);
14709
14533
  const modeRef = useRef3(mode);
14710
14534
  const effortRef = useRef3(effort);
@@ -14952,7 +14776,7 @@ ${wcagWarnings.join("\n")}` }
14952
14776
  messagesRef.current.splice(insertIdx, 0, { role: "system", content: text });
14953
14777
  setEvents((e) => [
14954
14778
  ...e,
14955
- { kind: "activity", key: mkKey(), text: "Remembering what we know about this repo\u2026", feature: "memory" }
14779
+ { kind: "memory", key: mkKey(), text: `recalled ${results.length} memory${results.length === 1 ? "" : "ies"} about this repo` }
14956
14780
  ]);
14957
14781
  }
14958
14782
  } catch {
@@ -15178,7 +15002,7 @@ ${wcagWarnings.join("\n")}` }
15178
15002
  }
15179
15003
  setEvents((e) => [
15180
15004
  ...e,
15181
- { kind: "activity", key: mkKey(), text: "Plugging in external tools\u2026" }
15005
+ { kind: "info", key: mkKey(), text: `MCP connected \u2014 ${totalTools} external tool${totalTools === 1 ? "" : "s"} available` }
15182
15006
  ]);
15183
15007
  }
15184
15008
  }, [cfg]);
@@ -15236,7 +15060,7 @@ ${wcagWarnings.join("\n")}` }
15236
15060
  }
15237
15061
  setEvents((e) => [
15238
15062
  ...e,
15239
- { kind: "activity", key: mkKey(), text: "Waking up the language servers\u2026" }
15063
+ { kind: "info", key: mkKey(), text: `LSP ready \u2014 ${totalServers} server${totalServers === 1 ? "" : "s"} active` }
15240
15064
  ]);
15241
15065
  } else {
15242
15066
  setEvents((e) => [
@@ -15473,16 +15297,6 @@ ${wcagWarnings.join("\n")}` }
15473
15297
  },
15474
15298
  []
15475
15299
  );
15476
- const flushToolBatch = useCallback2(() => {
15477
- toolBatchTimerRef.current = null;
15478
- const batch = toolBatchRef.current;
15479
- toolBatchRef.current = [];
15480
- if (batch.length === 0) return;
15481
- const text = generateActivityText(batch, { mode: modeRef.current });
15482
- if (text) {
15483
- setEvents((e) => [...e, { kind: "activity", key: mkKey(), text, feature: "explore" }]);
15484
- }
15485
- }, []);
15486
15300
  const updateGatewayMeta = useCallback2((meta) => {
15487
15301
  gatewayMetaRef.current = meta;
15488
15302
  setGatewayMeta(meta);
@@ -15662,16 +15476,11 @@ ${wcagWarnings.join("\n")}` }
15662
15476
  pendingToolCallsRef.current.set(call.id, call.function.name);
15663
15477
  const spec = executorRef.current.list().find((t) => t.name === call.function.name);
15664
15478
  let renderMeta;
15665
- let argsParsed = {};
15666
15479
  try {
15667
- argsParsed = call.function.arguments ? JSON.parse(call.function.arguments) : {};
15668
- renderMeta = spec?.render?.(argsParsed);
15480
+ const args = call.function.arguments ? JSON.parse(call.function.arguments) : {};
15481
+ renderMeta = spec?.render?.(args);
15669
15482
  } catch {
15670
15483
  }
15671
- toolBatchRef.current.push({ name: call.function.name, args: argsParsed });
15672
- if (toolBatchTimerRef.current) clearTimeout(toolBatchTimerRef.current);
15673
- toolBatchTimerRef.current = setTimeout(flushToolBatch, 120);
15674
- if (modeRef.current === "plan") return;
15675
15484
  setEvents((e) => [
15676
15485
  ...e,
15677
15486
  {
@@ -15815,15 +15624,8 @@ ${wcagWarnings.join("\n")}` }
15815
15624
  permResolveRef.current = null;
15816
15625
  limitResolveRef.current = null;
15817
15626
  pendingToolCallsRef.current.clear();
15818
- tasksRef.current = [];
15819
- setTasks([]);
15820
- setTasksStartedAt(null);
15821
- setTasksStartTokens(0);
15822
- setEvents(
15823
- (evts) => evts.map((e) => e.kind === "tool" && e.status === "running" ? { ...e, status: "error", result: "(interrupted)" } : e)
15824
- );
15825
15627
  }
15826
- }, [cfg, busy, updateAssistant, updateTool, updateGatewayMeta, flushToolBatch]);
15628
+ }, [cfg, busy, updateAssistant, updateTool, updateGatewayMeta]);
15827
15629
  const handleThemePick = useCallback2(
15828
15630
  (picked) => {
15829
15631
  setShowThemePicker(false);
@@ -16924,10 +16726,6 @@ ${lines.join("\n")}` }]);
16924
16726
  memoryRecalled: false
16925
16727
  }
16926
16728
  ]);
16927
- const triageActivity = narrativizeInfo("", { tier: classification.tier, codeMode: effectiveCodeMode });
16928
- if (triageActivity) {
16929
- setEvents((e) => [...e, { kind: "activity", key: mkKey(), text: triageActivity.text, feature: triageActivity.feature }]);
16930
- }
16931
16729
  const controller = new AbortController();
16932
16730
  activeControllerRef.current = controller;
16933
16731
  const sharedCallbacks = {
@@ -16963,16 +16761,11 @@ ${lines.join("\n")}` }]);
16963
16761
  setLastActivityAt(Date.now());
16964
16762
  const spec = executorRef.current.list().find((t) => t.name === call.function.name);
16965
16763
  let renderMeta;
16966
- let argsParsed = {};
16967
16764
  try {
16968
- argsParsed = call.function.arguments ? JSON.parse(call.function.arguments) : {};
16969
- renderMeta = spec?.render?.(argsParsed);
16765
+ const args = call.function.arguments ? JSON.parse(call.function.arguments) : {};
16766
+ renderMeta = spec?.render?.(args);
16970
16767
  } catch {
16971
16768
  }
16972
- toolBatchRef.current.push({ name: call.function.name, args: argsParsed });
16973
- if (toolBatchTimerRef.current) clearTimeout(toolBatchTimerRef.current);
16974
- toolBatchTimerRef.current = setTimeout(flushToolBatch, 120);
16975
- if (modeRef.current === "plan") return;
16976
16769
  setEvents((e) => [
16977
16770
  ...e,
16978
16771
  {
@@ -17124,10 +16917,9 @@ ${lines.join("\n")}` }]);
17124
16917
  setEvents((e) => [
17125
16918
  ...e,
17126
16919
  {
17127
- kind: "activity",
16920
+ kind: "info",
17128
16921
  key: mkKey(),
17129
- text: "Making room by summarizing older turns\u2026",
17130
- feature: "compact"
16922
+ text: `auto-compacted: ${result.metrics.estimatedTokensBefore} \u2192 ${result.metrics.estimatedTokensAfter} tokens (${result.metrics.archivedArtifacts} artifacts)`
17131
16923
  }
17132
16924
  ]);
17133
16925
  await saveSessionSafe();
@@ -17147,10 +16939,9 @@ ${lines.join("\n")}` }]);
17147
16939
  setEvents((e) => [
17148
16940
  ...e,
17149
16941
  {
17150
- kind: "activity",
16942
+ kind: "info",
17151
16943
  key: mkKey(),
17152
- text: "Making room by summarizing older turns\u2026",
17153
- feature: "compact"
16944
+ text: `auto-compacted: ${result.replacedCount} messages summarized`
17154
16945
  }
17155
16946
  ]);
17156
16947
  await saveSessionSafe();
@@ -17185,10 +16976,9 @@ ${lines.join("\n")}` }]);
17185
16976
  setEvents((e) => [
17186
16977
  ...e,
17187
16978
  {
17188
- kind: "activity",
16979
+ kind: "memory",
17189
16980
  key: mkKey(),
17190
- text: "Remembering what we learned before\u2026",
17191
- feature: "memory"
16981
+ text: `recalled ${results.length} memory${results.length === 1 ? "" : "ies"} after compaction`
17192
16982
  }
17193
16983
  ]);
17194
16984
  await saveSessionSafe();
@@ -17242,16 +17032,9 @@ ${lines.join("\n")}` }]);
17242
17032
  permResolveRef.current = null;
17243
17033
  limitResolveRef.current = null;
17244
17034
  pendingToolCallsRef.current.clear();
17245
- tasksRef.current = [];
17246
- setTasks([]);
17247
- setTasksStartedAt(null);
17248
- setTasksStartTokens(0);
17249
- setEvents(
17250
- (evts) => evts.map((e) => e.kind === "tool" && e.status === "running" ? { ...e, status: "error", result: "(interrupted)" } : e)
17251
- );
17252
17035
  }
17253
17036
  },
17254
- [cfg, handleSlash, updateAssistant, updateTool, saveSessionSafe, updateGatewayMeta, flushToolBatch]
17037
+ [cfg, handleSlash, updateAssistant, updateTool, saveSessionSafe, updateGatewayMeta]
17255
17038
  );
17256
17039
  useEffect7(() => {
17257
17040
  if (!busy && queue.length > 0) {
@@ -17470,7 +17253,7 @@ ${lines.join("\n")}` }]);
17470
17253
  }
17471
17254
  const hasConversation = events.some((e) => e.kind === "user" || e.kind === "assistant");
17472
17255
  return /* @__PURE__ */ jsx22(ThemeProvider, { theme, children: /* @__PURE__ */ jsxs20(Box20, { flexDirection: "column", children: [
17473
- !hasConversation && events.length === 0 ? /* @__PURE__ */ jsx22(Welcome, { accountId: cfg.accountId, cloudMode: cfg.cloudMode }) : /* @__PURE__ */ jsx22(ChatView, { events, showReasoning, verbose, suppressTools: mode === "plan" }),
17256
+ !hasConversation && events.length === 0 ? /* @__PURE__ */ jsx22(Welcome, { accountId: cfg.accountId, cloudMode: cfg.cloudMode }) : /* @__PURE__ */ jsx22(ChatView, { events, showReasoning, verbose }),
17474
17257
  perm ? /* @__PURE__ */ jsx22(
17475
17258
  PermissionModal,
17476
17259
  {
@@ -17527,7 +17310,8 @@ ${lines.join("\n")}` }]);
17527
17310
  phase: turnPhase,
17528
17311
  currentTool: currentToolName,
17529
17312
  lastActivityAt,
17530
- kimiMdStale
17313
+ kimiMdStale,
17314
+ gitBranch
17531
17315
  }
17532
17316
  ),
17533
17317
  activePicker?.kind === "file" && /* @__PURE__ */ jsx22(
@@ -17639,7 +17423,6 @@ var init_app = __esm({
17639
17423
  init_errors();
17640
17424
  init_chat();
17641
17425
  init_status();
17642
- init_narrative();
17643
17426
  init_permission();
17644
17427
  init_limit_modal();
17645
17428
  init_resume_picker();