kimiflare 0.83.0 → 0.84.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
@@ -3727,7 +3727,7 @@ function raceWithSignal(promise, signal) {
3727
3727
  async function runAgentTurn(opts2) {
3728
3728
  const turnStart = performance.now();
3729
3729
  logger.info("turn:start", { sessionId: opts2.sessionId, codeMode: opts2.codeMode ?? false });
3730
- const max = opts2.maxToolIterations ?? 50;
3730
+ const max = opts2.maxToolIterations ?? 200;
3731
3731
  const codeMode = opts2.codeMode ?? false;
3732
3732
  const fireStopHook = async () => {
3733
3733
  if (opts2.signal.aborted) return;
@@ -16360,6 +16360,7 @@ ${err instanceof Error ? err.message : err}`);
16360
16360
  let currentThemeName = "everforest-dark";
16361
16361
  const branch = tryGitBranch2();
16362
16362
  let currentSessionFilePath = null;
16363
+ let sessionPlan = null;
16363
16364
  const startupCfg = await loadConfig().catch(() => null);
16364
16365
  let multiAgentEnabled = (startupCfg?.multiAgentEnabled ?? false) || /^(1|true|yes|on)$/i.test(process.env.KIMIFLARE_MULTI_AGENT_ENABLED ?? "");
16365
16366
  const multiAgentSupervisor = new TurnSupervisor();
@@ -16915,7 +16916,7 @@ Executor opened PR: ${prUrl}` : plan });
16915
16916
  onToolLimitReached: async () => {
16916
16917
  const r = await confirm(cam, {
16917
16918
  id: `lim-${Date.now()}`,
16918
- prompt: "Tool-call limit reached (50). Continue running?",
16919
+ prompt: "Tool-call limit reached (200). Continue running?",
16919
16920
  yes_label: "Continue",
16920
16921
  no_label: "Stop turn",
16921
16922
  default: "no",
@@ -17028,6 +17029,12 @@ Executor opened PR: ${prUrl}` : plan });
17028
17029
  setPhase("idle");
17029
17030
  cam.send("StatusUpdate", { segments: { elapsed: "" } });
17030
17031
  kimiLog({ dir: "turn", phase: "end" });
17032
+ if (currentMode === "plan" && !currentController?.signal.aborted) {
17033
+ const plan = distillSessionPlan(messages);
17034
+ if (plan) {
17035
+ sessionPlan = plan;
17036
+ }
17037
+ }
17031
17038
  if (planOptionsRef.current && !currentController?.signal.aborted) {
17032
17039
  const options = planOptionsRef.current;
17033
17040
  planOptionsRef.current = null;
@@ -17055,6 +17062,7 @@ Executor opened PR: ${prUrl}` : plan });
17055
17062
  promptTokens = 0;
17056
17063
  cachedTokens = 0;
17057
17064
  completionTokens = 0;
17065
+ sessionPlan = null;
17058
17066
  cam.send("TranscriptCleared", {});
17059
17067
  cam.send("StatusUpdate", {
17060
17068
  segments: { tokens: "in 0", cost: "$0.00", elapsed: "" }
@@ -17625,6 +17633,7 @@ Executor opened PR: ${prUrl}` : plan });
17625
17633
  promptTokens = 0;
17626
17634
  cachedTokens = 0;
17627
17635
  completionTokens = 0;
17636
+ sessionPlan = null;
17628
17637
  cam.send("TranscriptCleared", {});
17629
17638
  cam.send("StatusUpdate", {
17630
17639
  segments: { tokens: "in 0", cost: "$0.00", elapsed: "" }
@@ -18255,7 +18264,7 @@ Executor opened PR: ${prUrl}` : plan });
18255
18264
  cam.send("ShowToast", { text: "can't /fresh while model is running \u2014 press Esc to interrupt first", kind: "warn", ttl_ms: 2500 });
18256
18265
  return true;
18257
18266
  }
18258
- const plan = distillSessionPlan(messages);
18267
+ const plan = sessionPlan ?? distillSessionPlan(messages);
18259
18268
  if (!plan) {
18260
18269
  cam.send("ShowToast", { text: "No plan found to start fresh with.", kind: "error", ttl_ms: 2500 });
18261
18270
  return true;
@@ -18268,6 +18277,7 @@ Executor opened PR: ${prUrl}` : plan });
18268
18277
  promptTokens = 0;
18269
18278
  cachedTokens = 0;
18270
18279
  completionTokens = 0;
18280
+ sessionPlan = null;
18271
18281
  cam.send("TranscriptCleared", {});
18272
18282
  cam.send("StatusUpdate", {
18273
18283
  segments: { tokens: "in 0", cost: "$0.00", elapsed: "" }
@@ -28454,6 +28464,7 @@ function executeFreshStart(ctx, planText) {
28454
28464
  ctx.clearTaskTracking();
28455
28465
  ctx.compactSuggestedRef.current = false;
28456
28466
  ctx.updateNudgedRef.current = false;
28467
+ ctx.sessionPlanRef.current = null;
28457
28468
  ctx.messagesRef.current.push({ role: "user", content: planText });
28458
28469
  const newSessionId = ctx.ensureSessionId();
28459
28470
  if (oldSessionId) {
@@ -28535,6 +28546,7 @@ var init_slash_commands = __esm({
28535
28546
  ctx.clearTaskTracking();
28536
28547
  ctx.compactSuggestedRef.current = false;
28537
28548
  ctx.updateNudgedRef.current = false;
28549
+ ctx.sessionPlanRef.current = null;
28538
28550
  return true;
28539
28551
  };
28540
28552
  handleFresh = (ctx) => {
@@ -28546,7 +28558,7 @@ var init_slash_commands = __esm({
28546
28558
  ]);
28547
28559
  return true;
28548
28560
  }
28549
- const plan = distillSessionPlan(ctx.messagesRef.current);
28561
+ const plan = ctx.sessionPlanRef.current ?? distillSessionPlan(ctx.messagesRef.current);
28550
28562
  if (!plan) {
28551
28563
  setEvents((e) => [
28552
28564
  ...e,
@@ -31208,6 +31220,7 @@ ${wcagWarnings.join("\n")}` }
31208
31220
  }, []);
31209
31221
  const sessionStartRecallRef = useRef7(null);
31210
31222
  const kimiMdStaleNudgedRef = useRef7(false);
31223
+ const sessionPlanRef = useRef7(null);
31211
31224
  const sessionMgr = useSessionManager({
31212
31225
  cfg,
31213
31226
  messagesRef,
@@ -31885,7 +31898,7 @@ ${wcagWarnings.join("\n")}` }
31885
31898
  (picked) => {
31886
31899
  setShowPlanCompletePicker(false);
31887
31900
  if (!picked || picked === "continue") return;
31888
- const plan = distillSessionPlan(messagesRef.current);
31901
+ const plan = sessionPlanRef.current ?? distillSessionPlan(messagesRef.current);
31889
31902
  if (!plan) {
31890
31903
  setEvents((e) => [
31891
31904
  ...e,
@@ -31919,6 +31932,7 @@ ${wcagWarnings.join("\n")}` }
31919
31932
  clearTaskTracking();
31920
31933
  compactSuggestedRef.current = false;
31921
31934
  updateNudgedRef.current = false;
31935
+ sessionPlanRef.current = null;
31922
31936
  setEvents((e) => [
31923
31937
  ...e,
31924
31938
  {
@@ -32145,7 +32159,8 @@ ${wcagWarnings.join("\n")}` }
32145
32159
  sessionStateRef,
32146
32160
  compiledContextRef,
32147
32161
  lastApiErrorRef,
32148
- activeScopeRef
32162
+ activeScopeRef,
32163
+ sessionPlanRef
32149
32164
  }), [
32150
32165
  exit,
32151
32166
  busy,
@@ -32583,7 +32598,7 @@ ${conflicts.join("\n")}` }
32583
32598
  askPermission: askForPermission,
32584
32599
  onToolLimitReached: () => new Promise((resolve5) => {
32585
32600
  limitResolveRef.current = resolve5;
32586
- setLimitModal({ limit: 50, resolve: resolve5 });
32601
+ setLimitModal({ limit: 200, resolve: resolve5 });
32587
32602
  }),
32588
32603
  onLoopDetected: () => new Promise((resolve5) => {
32589
32604
  loopResolveRef.current = resolve5;
@@ -32805,6 +32820,7 @@ ${conflicts.join("\n")}` }
32805
32820
  if (modeRef.current === "plan") {
32806
32821
  const plan = distillSessionPlan(messagesRef.current);
32807
32822
  if (plan) {
32823
+ sessionPlanRef.current = plan;
32808
32824
  setShowPlanCompletePicker(true);
32809
32825
  }
32810
32826
  }
@@ -33520,7 +33536,7 @@ function renderLogo(version) {
33520
33536
 
33521
33537
  // src/index.tsx
33522
33538
  var program = new Command2();
33523
- program.name("kimiflare").description("Terminal coding agent powered by Kimi-K2.6 on Cloudflare Workers AI.").version(getAppVersion()).option("-p, --print <prompt>", "one-shot mode: send prompt, stream reply to stdout, exit").option("-m, --model <id>", "model id (defaults to @cf/moonshotai/kimi-k2.6)").option("--dangerously-allow-all", "auto-approve every permission prompt (print mode only)").option("--reasoning", "include reasoning in stdout (print mode only)").option("--continue-on-limit", "reset tool-call counter and continue when the 50-call limit is hit (print mode only)").option("--max-input-tokens <n>", "cumulative prompt token budget; exits 42 when exhausted (print mode only)", (v) => parseInt(v, 10)).option("--emit-events", "emit Camouflage NDJSON events to stdout; requires -p (for initial prompt)").option("--multi-turn", "with --emit-events: keep reading stdin for UserInputSubmitted follow-ups after the initial turn").option("--ui <name>", "render UI with the given engine: `ink` (default, stable) or `camouflage` (experimental Rust TUI). Can also be set via the KIMIFLARE_UI environment variable.").option("--camouflage-bin <path>", "with --ui camouflage: path to the camouflage-tui binary (defaults to PATH lookup)").option("--mode <mode>", "run mode: interactive (default), print, rpc");
33539
+ program.name("kimiflare").description("Terminal coding agent powered by Kimi-K2.6 on Cloudflare Workers AI.").version(getAppVersion()).option("-p, --print <prompt>", "one-shot mode: send prompt, stream reply to stdout, exit").option("-m, --model <id>", "model id (defaults to @cf/moonshotai/kimi-k2.6)").option("--dangerously-allow-all", "auto-approve every permission prompt (print mode only)").option("--reasoning", "include reasoning in stdout (print mode only)").option("--continue-on-limit", "reset tool-call counter and continue when the 200-call limit is hit (print mode only)").option("--max-input-tokens <n>", "cumulative prompt token budget; exits 42 when exhausted (print mode only)", (v) => parseInt(v, 10)).option("--emit-events", "emit Camouflage NDJSON events to stdout; requires -p (for initial prompt)").option("--multi-turn", "with --emit-events: keep reading stdin for UserInputSubmitted follow-ups after the initial turn").option("--ui <name>", "render UI with the given engine: `ink` (default, stable) or `camouflage` (experimental Rust TUI). Can also be set via the KIMIFLARE_UI environment variable.").option("--camouflage-bin <path>", "with --ui camouflage: path to the camouflage-tui binary (defaults to PATH lookup)").option("--mode <mode>", "run mode: interactive (default), print, rpc");
33524
33540
  program.command("cost").description("Show cost attribution by task type (requires costAttribution enabled)").option("-w, --week", "last 7 days (default)").option("-m, --month", "last 30 days").option("-d, --day", "today only").option("-s, --session <id>", "single session detail").option("-c, --category <name>", "filter by category").option("--json", "machine-readable output").option("--reclassify", "re-run classification on all sessions").option("--local-only", "skip Cloudflare reconciliation").action(async (cmdOpts) => {
33525
33541
  const cfg = await loadConfig();
33526
33542
  const enabled = cfg?.costAttribution ?? false;