@bike4mind/cli 0.2.2 → 0.2.3-basic-cli-shortcuts.17058

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.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/index.js CHANGED
@@ -79,13 +79,13 @@ import {
79
79
  } from "./chunk-PDX44BCA.js";
80
80
 
81
81
  // src/index.tsx
82
- import React11, { useState as useState3, useEffect as useEffect3, useCallback } from "react";
83
- import { render, Box as Box11, Text as Text10, useApp, useInput as useInput2 } from "ink";
82
+ import React12, { useState as useState4, useEffect as useEffect3, useCallback } from "react";
83
+ import { render, Box as Box11, Text as Text11, useApp, useInput as useInput3 } from "ink";
84
84
  import { v4 as uuidv49 } from "uuid";
85
85
 
86
86
  // src/components/App.tsx
87
- import React8 from "react";
88
- import { Box as Box8, Text as Text7, Static } from "ink";
87
+ import React9 from "react";
88
+ import { Box as Box8, Text as Text8, Static } from "ink";
89
89
 
90
90
  // src/components/StatusBar.tsx
91
91
  import React from "react";
@@ -95,27 +95,126 @@ var StatusBar = React.memo(function StatusBar2({ sessionName, model, tokenUsage
95
95
  });
96
96
 
97
97
  // src/components/InputPrompt.tsx
98
- import React4, { useState, useMemo, useEffect } from "react";
99
- import { Box as Box4, Text as Text4, useInput } from "ink";
100
- import TextInput from "ink-text-input";
98
+ import React5, { useState as useState2, useMemo, useEffect } from "react";
99
+ import { Box as Box4, Text as Text5, useInput as useInput2 } from "ink";
100
+
101
+ // src/components/CustomTextInput.tsx
102
+ import React2, { useState } from "react";
103
+ import { Text as Text2, useInput } from "ink";
104
+ function CustomTextInput({
105
+ value,
106
+ onChange,
107
+ onSubmit,
108
+ placeholder = "",
109
+ showCursor = true
110
+ }) {
111
+ const [cursorOffset, setCursorOffset] = useState(value.length);
112
+ useInput(
113
+ (input, key) => {
114
+ if (key.return) {
115
+ onSubmit(value);
116
+ return;
117
+ }
118
+ if (key.ctrl) {
119
+ switch (input) {
120
+ case "u":
121
+ {
122
+ const lines = value.split("\n");
123
+ let currentLineStart = 0;
124
+ let currentLineIndex = 0;
125
+ let charCount = 0;
126
+ for (let i = 0; i < lines.length; i++) {
127
+ const lineLength = lines[i].length;
128
+ if (charCount + lineLength >= cursorOffset) {
129
+ currentLineIndex = i;
130
+ currentLineStart = charCount;
131
+ break;
132
+ }
133
+ charCount += lineLength + 1;
134
+ }
135
+ lines.splice(currentLineIndex, 1);
136
+ const newValue = lines.join("\n");
137
+ onChange(newValue);
138
+ setCursorOffset(Math.min(currentLineStart, newValue.length));
139
+ }
140
+ return;
141
+ case "k":
142
+ onChange(value.slice(0, cursorOffset));
143
+ return;
144
+ case "w":
145
+ {
146
+ const beforeCursor2 = value.slice(0, cursorOffset);
147
+ const afterCursor2 = value.slice(cursorOffset);
148
+ const trimmed = beforeCursor2.trimEnd();
149
+ const lastSpace = trimmed.lastIndexOf(" ");
150
+ const newBefore = lastSpace === -1 ? "" : trimmed.slice(0, lastSpace + 1);
151
+ const newValue = newBefore + afterCursor2;
152
+ onChange(newValue);
153
+ setCursorOffset(newBefore.length);
154
+ }
155
+ return;
156
+ case "a":
157
+ setCursorOffset(0);
158
+ return;
159
+ case "e":
160
+ setCursorOffset(value.length);
161
+ return;
162
+ case "l":
163
+ onChange("");
164
+ return;
165
+ }
166
+ }
167
+ if (key.backspace || key.delete) {
168
+ if (cursorOffset > 0) {
169
+ const newValue = value.slice(0, cursorOffset - 1) + value.slice(cursorOffset);
170
+ onChange(newValue);
171
+ setCursorOffset(cursorOffset - 1);
172
+ }
173
+ return;
174
+ }
175
+ if (key.leftArrow) {
176
+ setCursorOffset(Math.max(0, cursorOffset - 1));
177
+ return;
178
+ }
179
+ if (key.rightArrow) {
180
+ setCursorOffset(Math.min(value.length, cursorOffset + 1));
181
+ return;
182
+ }
183
+ if (!key.ctrl && !key.meta && input.length === 1) {
184
+ const newValue = value.slice(0, cursorOffset) + input + value.slice(cursorOffset);
185
+ onChange(newValue);
186
+ setCursorOffset(cursorOffset + 1);
187
+ }
188
+ },
189
+ { isActive: true }
190
+ );
191
+ const hasValue = value.length > 0;
192
+ if (!hasValue) {
193
+ return /* @__PURE__ */ React2.createElement(Text2, null, showCursor ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Text2, { inverse: true }, " "), /* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, placeholder)) : /* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, placeholder));
194
+ }
195
+ const beforeCursor = value.slice(0, cursorOffset);
196
+ const cursorChar = value[cursorOffset] || " ";
197
+ const afterCursor = value.slice(cursorOffset + 1);
198
+ return /* @__PURE__ */ React2.createElement(Text2, null, beforeCursor, showCursor && /* @__PURE__ */ React2.createElement(Text2, { inverse: true }, cursorChar), !showCursor && cursorChar, afterCursor);
199
+ }
101
200
 
102
201
  // src/components/CommandAutocomplete.tsx
103
- import React2 from "react";
104
- import { Box as Box2, Text as Text2 } from "ink";
202
+ import React3 from "react";
203
+ import { Box as Box2, Text as Text3 } from "ink";
105
204
  function CommandAutocomplete({ commands, selectedIndex }) {
106
205
  if (commands.length === 0) {
107
- return /* @__PURE__ */ React2.createElement(Box2, { marginLeft: 2, marginTop: 1 }, /* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, "No matching commands"));
206
+ return /* @__PURE__ */ React3.createElement(Box2, { marginLeft: 2, marginTop: 1 }, /* @__PURE__ */ React3.createElement(Text3, { dimColor: true }, "No matching commands"));
108
207
  }
109
- return /* @__PURE__ */ React2.createElement(Box2, { flexDirection: "column", marginLeft: 2, marginTop: 1 }, /* @__PURE__ */ React2.createElement(Box2, { marginBottom: 1 }, /* @__PURE__ */ React2.createElement(Text2, { dimColor: true }, commands.length === 1 ? "1 command" : `${commands.length} commands`, " \u2022 Use \u2191\u2193 to navigate, Enter to select")), commands.map((cmd, index) => {
208
+ return /* @__PURE__ */ React3.createElement(Box2, { flexDirection: "column", marginLeft: 2, marginTop: 1 }, /* @__PURE__ */ React3.createElement(Box2, { marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Text3, { dimColor: true }, commands.length === 1 ? "1 command" : `${commands.length} commands`, " \u2022 Use \u2191\u2193 to navigate, Enter to select")), commands.map((cmd, index) => {
110
209
  const args = cmd.args ? ` ${cmd.args}` : "";
111
210
  const isSelected = index === selectedIndex;
112
- return /* @__PURE__ */ React2.createElement(Box2, { key: cmd.name, marginLeft: 1 }, /* @__PURE__ */ React2.createElement(Text2, { color: isSelected ? "cyan" : void 0, bold: isSelected }, isSelected ? "\u25B8 " : " ", "/", cmd.name, args, " - ", cmd.description));
211
+ return /* @__PURE__ */ React3.createElement(Box2, { key: cmd.name, marginLeft: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: isSelected ? "cyan" : void 0, bold: isSelected }, isSelected ? "\u25B8 " : " ", "/", cmd.name, args, " - ", cmd.description));
113
212
  }));
114
213
  }
115
214
 
116
215
  // src/components/FileAutocomplete.tsx
117
- import React3 from "react";
118
- import { Box as Box3, Text as Text3 } from "ink";
216
+ import React4 from "react";
217
+ import { Box as Box3, Text as Text4 } from "ink";
119
218
 
120
219
  // src/utils/fileSearch.ts
121
220
  import * as fs from "fs";
@@ -304,14 +403,14 @@ var MAX_FILE_SIZE = 10 * 1024 * 1024;
304
403
  // src/components/FileAutocomplete.tsx
305
404
  function FileAutocomplete({ files, selectedIndex, query }) {
306
405
  if (files.length === 0) {
307
- return /* @__PURE__ */ React3.createElement(Box3, { marginLeft: 2, marginTop: 1 }, /* @__PURE__ */ React3.createElement(Text3, { dimColor: true }, "No matching files", query ? ` for "${query}"` : ""));
406
+ return /* @__PURE__ */ React4.createElement(Box3, { marginLeft: 2, marginTop: 1 }, /* @__PURE__ */ React4.createElement(Text4, { dimColor: true }, "No matching files", query ? ` for "${query}"` : ""));
308
407
  }
309
- return /* @__PURE__ */ React3.createElement(Box3, { flexDirection: "column", marginLeft: 2, marginTop: 1 }, /* @__PURE__ */ React3.createElement(Box3, { marginBottom: 1 }, /* @__PURE__ */ React3.createElement(Text3, { dimColor: true }, files.length === 1 ? "1 match" : `${files.length} matches`, " - Use up/down to navigate, Tab to select")), files.map((file, index) => {
408
+ return /* @__PURE__ */ React4.createElement(Box3, { flexDirection: "column", marginLeft: 2, marginTop: 1 }, /* @__PURE__ */ React4.createElement(Box3, { marginBottom: 1 }, /* @__PURE__ */ React4.createElement(Text4, { dimColor: true }, files.length === 1 ? "1 match" : `${files.length} matches`, " - Use up/down to navigate, Tab to select")), files.map((file, index) => {
310
409
  const isSelected = index === selectedIndex;
311
410
  const icon = file.isDirectory ? "[folder]" : "[file] ";
312
411
  const sizeDisplay = file.isDirectory ? "" : file.size !== void 0 ? ` (${formatFileSize(file.size)})` : "";
313
412
  const pathDisplay = file.isDirectory ? `${file.path}/` : file.path;
314
- return /* @__PURE__ */ React3.createElement(Box3, { key: file.path, marginLeft: 1 }, /* @__PURE__ */ React3.createElement(Text3, { color: isSelected ? "cyan" : void 0, bold: isSelected }, isSelected ? "> " : " "), /* @__PURE__ */ React3.createElement(Text3, { color: file.isDirectory ? "yellow" : isSelected ? "cyan" : void 0, bold: isSelected }, icon), /* @__PURE__ */ React3.createElement(Text3, { color: isSelected ? "cyan" : void 0, bold: isSelected }, " ", pathDisplay), /* @__PURE__ */ React3.createElement(Text3, { dimColor: true }, sizeDisplay));
413
+ return /* @__PURE__ */ React4.createElement(Box3, { key: file.path, marginLeft: 1 }, /* @__PURE__ */ React4.createElement(Text4, { color: isSelected ? "cyan" : void 0, bold: isSelected }, isSelected ? "> " : " "), /* @__PURE__ */ React4.createElement(Text4, { color: file.isDirectory ? "yellow" : isSelected ? "cyan" : void 0, bold: isSelected }, icon), /* @__PURE__ */ React4.createElement(Text4, { color: isSelected ? "cyan" : void 0, bold: isSelected }, " ", pathDisplay), /* @__PURE__ */ React4.createElement(Text4, { dimColor: true }, sizeDisplay));
315
414
  }));
316
415
  }
317
416
 
@@ -425,13 +524,12 @@ function findAtTrigger(value) {
425
524
  return null;
426
525
  }
427
526
  function InputPrompt({ onSubmit, disabled = false, history = [] }) {
428
- const [value, setValue] = useState("");
429
- const [selectedIndex, setSelectedIndex] = useState(0);
430
- const [historyIndex, setHistoryIndex] = useState(-1);
431
- const [tempInput, setTempInput] = useState("");
432
- const [inputKey, setInputKey] = useState(0);
433
- const [fileAutocomplete, setFileAutocomplete] = useState(null);
434
- const [fileSelectedIndex, setFileSelectedIndex] = useState(0);
527
+ const [value, setValue] = useState2("");
528
+ const [selectedIndex, setSelectedIndex] = useState2(0);
529
+ const [historyIndex, setHistoryIndex] = useState2(-1);
530
+ const [tempInput, setTempInput] = useState2("");
531
+ const [fileAutocomplete, setFileAutocomplete] = useState2(null);
532
+ const [fileSelectedIndex, setFileSelectedIndex] = useState2(0);
435
533
  const shouldShowCommandAutocomplete = value.startsWith("/") && !disabled && !fileAutocomplete?.active;
436
534
  const commandQuery = shouldShowCommandAutocomplete ? value.slice(1) : "";
437
535
  const filteredCommands = useMemo(() => {
@@ -448,7 +546,7 @@ function InputPrompt({ onSubmit, disabled = false, history = [] }) {
448
546
  useEffect(() => {
449
547
  setFileSelectedIndex(0);
450
548
  }, [filteredFiles]);
451
- useInput((input, key) => {
549
+ useInput2((_input, key) => {
452
550
  if (fileAutocomplete?.active && filteredFiles.length > 0) {
453
551
  if (key.upArrow) {
454
552
  setFileSelectedIndex((prev) => prev > 0 ? prev - 1 : filteredFiles.length - 1);
@@ -505,7 +603,6 @@ function InputPrompt({ onSubmit, disabled = false, history = [] }) {
505
603
  const pathToInsert = file.isDirectory ? `@${file.path}/` : `@${file.path}`;
506
604
  const newValue = beforeAt + pathToInsert + afterQuery;
507
605
  setValue(newValue);
508
- setInputKey((prev) => prev + 1);
509
606
  if (file.isDirectory) {
510
607
  setFileAutocomplete({
511
608
  active: true,
@@ -532,7 +629,6 @@ function InputPrompt({ onSubmit, disabled = false, history = [] }) {
532
629
  if (selectedCommand.args) {
533
630
  setValue(commandText + " ");
534
631
  setHistoryIndex(-1);
535
- setInputKey((prev) => prev + 1);
536
632
  return;
537
633
  }
538
634
  setValue("");
@@ -562,29 +658,28 @@ function InputPrompt({ onSubmit, disabled = false, history = [] }) {
562
658
  setFileAutocomplete(null);
563
659
  }
564
660
  };
565
- return /* @__PURE__ */ React4.createElement(Box4, { flexDirection: "column" }, /* @__PURE__ */ React4.createElement(Box4, null, /* @__PURE__ */ React4.createElement(Text4, { bold: true, color: "cyan" }, "> "), /* @__PURE__ */ React4.createElement(
566
- TextInput,
661
+ return /* @__PURE__ */ React5.createElement(Box4, { flexDirection: "column" }, /* @__PURE__ */ React5.createElement(Box4, null, /* @__PURE__ */ React5.createElement(Text5, { bold: true, color: "cyan" }, "> "), /* @__PURE__ */ React5.createElement(
662
+ CustomTextInput,
567
663
  {
568
- key: inputKey,
569
664
  value,
570
665
  onChange: handleChange,
571
666
  onSubmit: handleSubmit,
572
667
  placeholder: disabled ? "Thinking..." : "Type your message, /help for commands, or @file to reference",
573
668
  showCursor: !disabled
574
669
  }
575
- )), shouldShowCommandAutocomplete && /* @__PURE__ */ React4.createElement(CommandAutocomplete, { commands: filteredCommands, selectedIndex }), fileAutocomplete?.active && /* @__PURE__ */ React4.createElement(FileAutocomplete, { files: filteredFiles, selectedIndex: fileSelectedIndex, query: fileAutocomplete.query }));
670
+ )), shouldShowCommandAutocomplete && /* @__PURE__ */ React5.createElement(CommandAutocomplete, { commands: filteredCommands, selectedIndex }), fileAutocomplete?.active && /* @__PURE__ */ React5.createElement(FileAutocomplete, { files: filteredFiles, selectedIndex: fileSelectedIndex, query: fileAutocomplete.query }));
576
671
  }
577
672
 
578
673
  // src/components/AgentThinking.tsx
579
- import React6 from "react";
674
+ import React7 from "react";
580
675
  import { Box as Box6 } from "ink";
581
676
 
582
677
  // src/components/ThoughtStream.tsx
583
- import React5 from "react";
584
- import { Box as Box5, Text as Text5 } from "ink";
678
+ import React6 from "react";
679
+ import { Box as Box5, Text as Text6 } from "ink";
585
680
  import Spinner from "ink-spinner";
586
- var ThoughtStream = React5.memo(function ThoughtStream2({ steps }) {
587
- return /* @__PURE__ */ React5.createElement(Box5, { flexDirection: "column", gap: 1 }, steps.map((step, index) => /* @__PURE__ */ React5.createElement(Box5, { key: index, flexDirection: "column" }, step.type === "thought" && /* @__PURE__ */ React5.createElement(Box5, null, /* @__PURE__ */ React5.createElement(Text5, { color: "magenta" }, "\u{1F914} Thought: "), /* @__PURE__ */ React5.createElement(Text5, null, step.content)), step.type === "action" && /* @__PURE__ */ React5.createElement(Box5, { flexDirection: "column" }, /* @__PURE__ */ React5.createElement(Box5, null, /* @__PURE__ */ React5.createElement(Text5, { color: "yellow" }, "\u26A1 Action: "), /* @__PURE__ */ React5.createElement(Text5, { bold: true }, step.metadata?.toolName || "unknown")), step.metadata?.toolInput && /* @__PURE__ */ React5.createElement(Box5, { paddingLeft: 2 }, /* @__PURE__ */ React5.createElement(Text5, { dimColor: true }, JSON.stringify(step.metadata.toolInput, null, 2)))), step.type === "observation" && /* @__PURE__ */ React5.createElement(Box5, { flexDirection: "column" }, /* @__PURE__ */ React5.createElement(Box5, null, /* @__PURE__ */ React5.createElement(Text5, { color: "blue" }, "\u{1F4CA} Observation: ")), /* @__PURE__ */ React5.createElement(Box5, { paddingLeft: 2 }, /* @__PURE__ */ React5.createElement(Text5, null, step.content))), step.type === "final_answer" && /* @__PURE__ */ React5.createElement(Box5, { flexDirection: "column" }, /* @__PURE__ */ React5.createElement(Box5, null, /* @__PURE__ */ React5.createElement(Text5, { color: "green", bold: true }, "\u2705 Final Answer:", " ")), /* @__PURE__ */ React5.createElement(Box5, { paddingLeft: 2 }, /* @__PURE__ */ React5.createElement(Text5, null, step.content)), step.metadata?.tokenUsage && /* @__PURE__ */ React5.createElement(Box5, { paddingLeft: 2 }, /* @__PURE__ */ React5.createElement(Text5, { dimColor: true }, "(", step.metadata.tokenUsage.total, " tokens)"))))), !steps.some((s) => s.type === "final_answer") && /* @__PURE__ */ React5.createElement(Box5, null, /* @__PURE__ */ React5.createElement(Text5, { color: "yellow" }, /* @__PURE__ */ React5.createElement(Spinner, { type: "dots" })), /* @__PURE__ */ React5.createElement(Text5, null, " ", steps.length === 0 ? "Thinking..." : "Processing...")));
681
+ var ThoughtStream = React6.memo(function ThoughtStream2({ steps }) {
682
+ return /* @__PURE__ */ React6.createElement(Box5, { flexDirection: "column", gap: 1 }, steps.map((step, index) => /* @__PURE__ */ React6.createElement(Box5, { key: index, flexDirection: "column" }, step.type === "thought" && /* @__PURE__ */ React6.createElement(Box5, null, /* @__PURE__ */ React6.createElement(Text6, { color: "magenta" }, "\u{1F914} Thought: "), /* @__PURE__ */ React6.createElement(Text6, null, step.content)), step.type === "action" && /* @__PURE__ */ React6.createElement(Box5, { flexDirection: "column" }, /* @__PURE__ */ React6.createElement(Box5, null, /* @__PURE__ */ React6.createElement(Text6, { color: "yellow" }, "\u26A1 Action: "), /* @__PURE__ */ React6.createElement(Text6, { bold: true }, step.metadata?.toolName || "unknown")), step.metadata?.toolInput && /* @__PURE__ */ React6.createElement(Box5, { paddingLeft: 2 }, /* @__PURE__ */ React6.createElement(Text6, { dimColor: true }, JSON.stringify(step.metadata.toolInput, null, 2)))), step.type === "observation" && /* @__PURE__ */ React6.createElement(Box5, { flexDirection: "column" }, /* @__PURE__ */ React6.createElement(Box5, null, /* @__PURE__ */ React6.createElement(Text6, { color: "blue" }, "\u{1F4CA} Observation: ")), /* @__PURE__ */ React6.createElement(Box5, { paddingLeft: 2 }, /* @__PURE__ */ React6.createElement(Text6, null, step.content))), step.type === "final_answer" && /* @__PURE__ */ React6.createElement(Box5, { flexDirection: "column" }, /* @__PURE__ */ React6.createElement(Box5, null, /* @__PURE__ */ React6.createElement(Text6, { color: "green", bold: true }, "\u2705 Final Answer:", " ")), /* @__PURE__ */ React6.createElement(Box5, { paddingLeft: 2 }, /* @__PURE__ */ React6.createElement(Text6, null, step.content)), step.metadata?.tokenUsage && /* @__PURE__ */ React6.createElement(Box5, { paddingLeft: 2 }, /* @__PURE__ */ React6.createElement(Text6, { dimColor: true }, "(", step.metadata.tokenUsage.total, " tokens)"))))), !steps.some((s) => s.type === "final_answer") && /* @__PURE__ */ React6.createElement(Box5, null, /* @__PURE__ */ React6.createElement(Text6, { color: "yellow" }, /* @__PURE__ */ React6.createElement(Spinner, { type: "dots" })), /* @__PURE__ */ React6.createElement(Text6, null, " ", steps.length === 0 ? "Thinking..." : "Processing...")));
588
683
  });
589
684
 
590
685
  // src/store/index.ts
@@ -593,6 +688,12 @@ var useCliStore = create((set) => ({
593
688
  // Session state
594
689
  session: null,
595
690
  setSession: (session) => set({ session }),
691
+ clearMessages: () => set((state) => ({
692
+ session: state.session ? {
693
+ ...state.session,
694
+ messages: []
695
+ } : null
696
+ })),
596
697
  // UI state
597
698
  isThinking: false,
598
699
  setIsThinking: (thinking) => set({ isThinking: thinking }),
@@ -610,32 +711,32 @@ var useCliStore = create((set) => ({
610
711
  }));
611
712
 
612
713
  // src/components/AgentThinking.tsx
613
- var AgentThinking = React6.memo(function AgentThinking2() {
714
+ var AgentThinking = React7.memo(function AgentThinking2() {
614
715
  const isThinking = useCliStore((state) => state.isThinking);
615
716
  const agentSteps = useCliStore((state) => state.agentSteps);
616
717
  if (!isThinking) {
617
718
  return null;
618
719
  }
619
- return /* @__PURE__ */ React6.createElement(Box6, { borderStyle: "single", borderColor: "yellow", paddingX: 1, marginY: 1 }, /* @__PURE__ */ React6.createElement(ThoughtStream, { steps: agentSteps }));
720
+ return /* @__PURE__ */ React7.createElement(Box6, { borderStyle: "single", borderColor: "yellow", paddingX: 1, marginY: 1 }, /* @__PURE__ */ React7.createElement(ThoughtStream, { steps: agentSteps }));
620
721
  });
621
722
 
622
723
  // src/components/PermissionPrompt.tsx
623
- import React7 from "react";
624
- import { Box as Box7, Text as Text6 } from "ink";
724
+ import React8 from "react";
725
+ import { Box as Box7, Text as Text7 } from "ink";
625
726
  import SelectInput from "ink-select-input";
626
727
  function renderDiffPreview(preview) {
627
728
  const lines = preview.split("\n");
628
729
  return lines.map((line, index) => {
629
730
  if (line.startsWith("+")) {
630
- return /* @__PURE__ */ React7.createElement(Text6, { key: index, color: "green" }, line);
731
+ return /* @__PURE__ */ React8.createElement(Text7, { key: index, color: "green" }, line);
631
732
  }
632
733
  if (line.startsWith("-")) {
633
- return /* @__PURE__ */ React7.createElement(Text6, { key: index, color: "red" }, line);
734
+ return /* @__PURE__ */ React8.createElement(Text7, { key: index, color: "red" }, line);
634
735
  }
635
736
  if (line.startsWith("@@")) {
636
- return /* @__PURE__ */ React7.createElement(Text6, { key: index, color: "cyan" }, line);
737
+ return /* @__PURE__ */ React8.createElement(Text7, { key: index, color: "cyan" }, line);
637
738
  }
638
- return /* @__PURE__ */ React7.createElement(Text6, { key: index, dimColor: true }, line);
739
+ return /* @__PURE__ */ React8.createElement(Text7, { key: index, dimColor: true }, line);
639
740
  });
640
741
  }
641
742
  function PermissionPrompt({
@@ -655,7 +756,7 @@ function PermissionPrompt({
655
756
  { label: "\u2717 Deny", value: "deny" }
656
757
  ];
657
758
  const argsString = typeof args === "string" ? args : JSON.stringify(args, null, 2);
658
- return /* @__PURE__ */ React7.createElement(Box7, { flexDirection: "column", borderStyle: "bold", borderColor: "yellow", padding: 1, marginY: 1 }, /* @__PURE__ */ React7.createElement(Box7, null, /* @__PURE__ */ React7.createElement(Text6, { bold: true, color: "yellow" }, "\u26A0\uFE0F Permission Required")), /* @__PURE__ */ React7.createElement(Box7, { marginTop: 1 }, /* @__PURE__ */ React7.createElement(Text6, { dimColor: true }, "Tool: "), /* @__PURE__ */ React7.createElement(Text6, { bold: true, color: "cyan" }, toolName)), toolDescription && /* @__PURE__ */ React7.createElement(Box7, null, /* @__PURE__ */ React7.createElement(Text6, { dimColor: true }, "Action: "), /* @__PURE__ */ React7.createElement(Text6, null, toolDescription)), /* @__PURE__ */ React7.createElement(Box7, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React7.createElement(Text6, { bold: true }, "Arguments:"), /* @__PURE__ */ React7.createElement(Box7, { paddingLeft: 2, flexDirection: "column" }, /* @__PURE__ */ React7.createElement(Text6, { dimColor: true }, argsString))), preview && /* @__PURE__ */ React7.createElement(Box7, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React7.createElement(Text6, { bold: true }, "Preview:"), /* @__PURE__ */ React7.createElement(Box7, { borderStyle: "single", borderColor: "gray", paddingX: 1, flexDirection: "column" }, renderDiffPreview(preview))), !canBeTrusted && /* @__PURE__ */ React7.createElement(Box7, { marginTop: 1 }, /* @__PURE__ */ React7.createElement(Text6, { color: "red", dimColor: true }, "Note: This tool cannot be trusted due to its dangerous nature.")), /* @__PURE__ */ React7.createElement(Box7, { marginTop: 1 }, /* @__PURE__ */ React7.createElement(SelectInput, { items, onSelect: (item) => onResponse(item.value) })));
759
+ return /* @__PURE__ */ React8.createElement(Box7, { flexDirection: "column", borderStyle: "bold", borderColor: "yellow", padding: 1, marginY: 1 }, /* @__PURE__ */ React8.createElement(Box7, null, /* @__PURE__ */ React8.createElement(Text7, { bold: true, color: "yellow" }, "\u26A0\uFE0F Permission Required")), /* @__PURE__ */ React8.createElement(Box7, { marginTop: 1 }, /* @__PURE__ */ React8.createElement(Text7, { dimColor: true }, "Tool: "), /* @__PURE__ */ React8.createElement(Text7, { bold: true, color: "cyan" }, toolName)), toolDescription && /* @__PURE__ */ React8.createElement(Box7, null, /* @__PURE__ */ React8.createElement(Text7, { dimColor: true }, "Action: "), /* @__PURE__ */ React8.createElement(Text7, null, toolDescription)), /* @__PURE__ */ React8.createElement(Box7, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React8.createElement(Text7, { bold: true }, "Arguments:"), /* @__PURE__ */ React8.createElement(Box7, { paddingLeft: 2, flexDirection: "column" }, /* @__PURE__ */ React8.createElement(Text7, { dimColor: true }, argsString))), preview && /* @__PURE__ */ React8.createElement(Box7, { marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React8.createElement(Text7, { bold: true }, "Preview:"), /* @__PURE__ */ React8.createElement(Box7, { borderStyle: "single", borderColor: "gray", paddingX: 1, flexDirection: "column" }, renderDiffPreview(preview))), !canBeTrusted && /* @__PURE__ */ React8.createElement(Box7, { marginTop: 1 }, /* @__PURE__ */ React8.createElement(Text7, { color: "red", dimColor: true }, "Note: This tool cannot be trusted due to its dangerous nature.")), /* @__PURE__ */ React8.createElement(Box7, { marginTop: 1 }, /* @__PURE__ */ React8.createElement(SelectInput, { items, onSelect: (item) => onResponse(item.value) })));
659
760
  }
660
761
 
661
762
  // src/utils/processFileReferences.ts
@@ -782,7 +883,7 @@ function App({ onMessage, onCommand, onPermissionResponse, commandHistory = [] }
782
883
  const permissionPrompt = useCliStore((state) => state.permissionPrompt);
783
884
  const exitRequested = useCliStore((state) => state.exitRequested);
784
885
  const setIsThinking = useCliStore((state) => state.setIsThinking);
785
- const handleSubmit = React8.useCallback(
886
+ const handleSubmit = React9.useCallback(
786
887
  async (input) => {
787
888
  const trimmed = input.trim();
788
889
  if (!trimmed) return;
@@ -811,7 +912,7 @@ ${errorBlock}`;
811
912
  },
812
913
  [onMessage, onCommand, setIsThinking]
813
914
  );
814
- return /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "column" }, /* @__PURE__ */ React8.createElement(StatusBar, { sessionName, model: currentModel, tokenUsage: totalTokens }), permissionPrompt ? /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React8.createElement(
915
+ return /* @__PURE__ */ React9.createElement(Box8, { flexDirection: "column" }, /* @__PURE__ */ React9.createElement(StatusBar, { sessionName, model: currentModel, tokenUsage: totalTokens }), permissionPrompt ? /* @__PURE__ */ React9.createElement(Box8, { flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React9.createElement(
815
916
  PermissionPrompt,
816
917
  {
817
918
  toolName: permissionPrompt.toolName,
@@ -820,39 +921,39 @@ ${errorBlock}`;
820
921
  canBeTrusted: permissionPrompt.canBeTrusted,
821
922
  onResponse: onPermissionResponse
822
923
  }
823
- )) : /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(Static, { items: messages }, (message, index) => /* @__PURE__ */ React8.createElement(Box8, { key: index, flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React8.createElement(MessageItem, { message }))), /* @__PURE__ */ React8.createElement(AgentThinking, null), exitRequested && /* @__PURE__ */ React8.createElement(Box8, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React8.createElement(Text7, { color: "yellow", bold: true }, "\u26A0\uFE0F Press Ctrl+C again to exit")), /* @__PURE__ */ React8.createElement(Box8, { borderStyle: "single", borderColor: "cyan", paddingX: 1 }, /* @__PURE__ */ React8.createElement(InputPrompt, { onSubmit: handleSubmit, disabled: isThinking, history: commandHistory }))));
924
+ )) : /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(Static, { items: messages }, (message, index) => /* @__PURE__ */ React9.createElement(Box8, { key: index, flexDirection: "column", paddingX: 1 }, /* @__PURE__ */ React9.createElement(MessageItem, { message }))), /* @__PURE__ */ React9.createElement(AgentThinking, null), exitRequested && /* @__PURE__ */ React9.createElement(Box8, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React9.createElement(Text8, { color: "yellow", bold: true }, "\u26A0\uFE0F Press Ctrl+C again to exit")), /* @__PURE__ */ React9.createElement(Box8, { borderStyle: "single", borderColor: "cyan", paddingX: 1 }, /* @__PURE__ */ React9.createElement(InputPrompt, { onSubmit: handleSubmit, disabled: isThinking, history: commandHistory }))));
824
925
  }
825
926
  function MessageItem({ message }) {
826
- return /* @__PURE__ */ React8.createElement(Box8, { flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React8.createElement(Box8, null, /* @__PURE__ */ React8.createElement(Text7, { bold: true, color: message.role === "user" ? "cyan" : "green" }, message.role === "user" ? "\u{1F464} You" : "\u{1F916} Assistant"), /* @__PURE__ */ React8.createElement(Text7, { dimColor: true }, " \u2022 ", new Date(message.timestamp).toLocaleTimeString())), /* @__PURE__ */ React8.createElement(Box8, { paddingLeft: 2 }, message.metadata?.permissionDenied ? /* @__PURE__ */ React8.createElement(Text7, { color: "yellow" }, "\u26A0\uFE0F ", message.content) : /* @__PURE__ */ React8.createElement(Text7, null, message.content)), message.metadata?.steps && message.metadata.steps.length > 0 && /* @__PURE__ */ React8.createElement(Box8, { paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React8.createElement(Text7, { dimColor: true, bold: true }, "\u{1F527} Agent Reasoning Trace (", message.metadata.steps.filter((s) => s.type === "action").length, " ", "tools used, ", message.metadata.steps.length, " total steps)", message.metadata.tokenUsage && ` \u2022 ${message.metadata.tokenUsage.total} tokens`), /* @__PURE__ */ React8.createElement(Text7, { dimColor: true }, "Step types: ", message.metadata.steps.map((s) => s.type).join(", ")), message.metadata.steps.map((step, idx) => {
927
+ return /* @__PURE__ */ React9.createElement(Box8, { flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React9.createElement(Box8, null, /* @__PURE__ */ React9.createElement(Text8, { bold: true, color: message.role === "user" ? "cyan" : "green" }, message.role === "user" ? "\u{1F464} You" : "\u{1F916} Assistant"), /* @__PURE__ */ React9.createElement(Text8, { dimColor: true }, " \u2022 ", new Date(message.timestamp).toLocaleTimeString())), /* @__PURE__ */ React9.createElement(Box8, { paddingLeft: 2 }, message.metadata?.permissionDenied ? /* @__PURE__ */ React9.createElement(Text8, { color: "yellow" }, "\u26A0\uFE0F ", message.content) : /* @__PURE__ */ React9.createElement(Text8, null, message.content)), message.metadata?.steps && message.metadata.steps.length > 0 && /* @__PURE__ */ React9.createElement(Box8, { paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React9.createElement(Text8, { dimColor: true, bold: true }, "\u{1F527} Agent Reasoning Trace (", message.metadata.steps.filter((s) => s.type === "action").length, " ", "tools used, ", message.metadata.steps.length, " total steps)", message.metadata.tokenUsage && ` \u2022 ${message.metadata.tokenUsage.total} tokens`), /* @__PURE__ */ React9.createElement(Text8, { dimColor: true }, "Step types: ", message.metadata.steps.map((s) => s.type).join(", ")), message.metadata.steps.map((step, idx) => {
827
928
  if (step.type === "thought") {
828
- return /* @__PURE__ */ React8.createElement(Box8, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React8.createElement(Text7, { color: "blue" }, "\u{1F4AD} Thought:"), /* @__PURE__ */ React8.createElement(Text7, { dimColor: true }, ` ${step.content.slice(0, 200)}${step.content.length > 200 ? "..." : ""}`));
929
+ return /* @__PURE__ */ React9.createElement(Box8, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React9.createElement(Text8, { color: "blue" }, "\u{1F4AD} Thought:"), /* @__PURE__ */ React9.createElement(Text8, { dimColor: true }, ` ${step.content.slice(0, 200)}${step.content.length > 200 ? "..." : ""}`));
829
930
  }
830
931
  if (step.type === "action") {
831
932
  const toolName = step.metadata?.toolName || "unknown";
832
933
  const toolInput = step.metadata?.toolInput;
833
934
  const observationStep = message.metadata.steps[idx + 1];
834
935
  const result = observationStep?.type === "observation" ? observationStep.content : null;
835
- return /* @__PURE__ */ React8.createElement(Box8, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React8.createElement(Text7, { color: "yellow" }, "\u{1F527} Action: ", toolName), toolInput && /* @__PURE__ */ React8.createElement(Text7, { dimColor: true }, ` Input: ${typeof toolInput === "string" ? toolInput : JSON.stringify(toolInput).slice(0, 100)}`), result && /* @__PURE__ */ React8.createElement(Text7, { dimColor: true }, ` Result: ${typeof result === "string" ? result.slice(0, 200) : JSON.stringify(result).slice(0, 200)}${(typeof result === "string" ? result.length : JSON.stringify(result).length) > 200 ? "..." : ""}`));
936
+ return /* @__PURE__ */ React9.createElement(Box8, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React9.createElement(Text8, { color: "yellow" }, "\u{1F527} Action: ", toolName), toolInput && /* @__PURE__ */ React9.createElement(Text8, { dimColor: true }, ` Input: ${typeof toolInput === "string" ? toolInput : JSON.stringify(toolInput).slice(0, 100)}`), result && /* @__PURE__ */ React9.createElement(Text8, { dimColor: true }, ` Result: ${typeof result === "string" ? result.slice(0, 200) : JSON.stringify(result).slice(0, 200)}${(typeof result === "string" ? result.length : JSON.stringify(result).length) > 200 ? "..." : ""}`));
836
937
  }
837
938
  return null;
838
- }).filter(Boolean)), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */ React8.createElement(Box8, { paddingLeft: 2 }, /* @__PURE__ */ React8.createElement(Text7, { dimColor: true }, `${message.metadata.tokenUsage.total} tokens`)));
939
+ }).filter(Boolean)), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */ React9.createElement(Box8, { paddingLeft: 2 }, /* @__PURE__ */ React9.createElement(Text8, { dimColor: true }, `${message.metadata.tokenUsage.total} tokens`)));
839
940
  }
840
941
 
841
942
  // src/components/MessageList.tsx
842
- import React9 from "react";
843
- import { Box as Box9, Text as Text8 } from "ink";
943
+ import React10 from "react";
944
+ import { Box as Box9, Text as Text9 } from "ink";
844
945
  function stripThinkingTags(content) {
845
946
  return content.replace(/<think>[\s\S]*?<\/think>/g, "").trim();
846
947
  }
847
- var MessageList = React9.memo(
948
+ var MessageList = React10.memo(
848
949
  function MessageList2({ messages }) {
849
950
  if (messages.length === 0) {
850
- return /* @__PURE__ */ React9.createElement(Box9, { paddingY: 1 }, /* @__PURE__ */ React9.createElement(Text8, { dimColor: true }, "No messages yet. Type a message to start!"));
951
+ return /* @__PURE__ */ React10.createElement(Box9, { paddingY: 1 }, /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, "No messages yet. Type a message to start!"));
851
952
  }
852
- return /* @__PURE__ */ React9.createElement(Box9, { flexDirection: "column", gap: 1, paddingY: 1 }, messages.map((message, index) => /* @__PURE__ */ React9.createElement(Box9, { key: index, flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React9.createElement(Box9, null, /* @__PURE__ */ React9.createElement(Text8, { bold: true, color: message.role === "user" ? "cyan" : "green" }, message.role === "user" ? "\u{1F464} You" : "\u{1F916} Assistant"), /* @__PURE__ */ React9.createElement(Text8, { dimColor: true }, " \u2022 ", new Date(message.timestamp).toLocaleTimeString())), /* @__PURE__ */ React9.createElement(Box9, { paddingLeft: 2 }, message.metadata?.permissionDenied ? /* @__PURE__ */ React9.createElement(Text8, { color: "yellow" }, "\u26A0\uFE0F ", stripThinkingTags(message.content)) : /* @__PURE__ */ React9.createElement(Text8, null, stripThinkingTags(message.content))), message.metadata?.steps && message.metadata.steps.length > 0 && /* @__PURE__ */ React9.createElement(Box9, { paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React9.createElement(Text8, { dimColor: true, bold: true }, "\u{1F527} Agent Reasoning Trace (", message.metadata.steps.filter((s) => s.type === "action").length, " tools used,", " ", message.metadata.steps.length, " total steps)", message.metadata.tokenUsage && ` \u2022 ${message.metadata.tokenUsage.total} tokens`), /* @__PURE__ */ React9.createElement(Text8, { dimColor: true }, "Step types: ", message.metadata.steps.map((s) => s.type).join(", ")), message.metadata.steps.map((step, idx) => {
953
+ return /* @__PURE__ */ React10.createElement(Box9, { flexDirection: "column", gap: 1, paddingY: 1 }, messages.map((message, index) => /* @__PURE__ */ React10.createElement(Box9, { key: index, flexDirection: "column", marginBottom: 1 }, /* @__PURE__ */ React10.createElement(Box9, null, /* @__PURE__ */ React10.createElement(Text9, { bold: true, color: message.role === "user" ? "cyan" : "green" }, message.role === "user" ? "\u{1F464} You" : "\u{1F916} Assistant"), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, " \u2022 ", new Date(message.timestamp).toLocaleTimeString())), /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2 }, message.metadata?.permissionDenied ? /* @__PURE__ */ React10.createElement(Text9, { color: "yellow" }, "\u26A0\uFE0F ", stripThinkingTags(message.content)) : /* @__PURE__ */ React10.createElement(Text9, null, stripThinkingTags(message.content))), message.metadata?.steps && message.metadata.steps.length > 0 && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { dimColor: true, bold: true }, "\u{1F527} Agent Reasoning Trace (", message.metadata.steps.filter((s) => s.type === "action").length, " tools used,", " ", message.metadata.steps.length, " total steps)", message.metadata.tokenUsage && ` \u2022 ${message.metadata.tokenUsage.total} tokens`), /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, "Step types: ", message.metadata.steps.map((s) => s.type).join(", ")), message.metadata.steps.map((step, idx) => {
853
954
  if (step.type === "thought") {
854
- return /* @__PURE__ */ React9.createElement(Box9, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React9.createElement(Text8, { color: "blue" }, "\u{1F4AD} Thought:"), /* @__PURE__ */ React9.createElement(
855
- Text8,
955
+ return /* @__PURE__ */ React10.createElement(Box9, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { color: "blue" }, "\u{1F4AD} Thought:"), /* @__PURE__ */ React10.createElement(
956
+ Text9,
856
957
  {
857
958
  dimColor: true
858
959
  },
@@ -864,10 +965,10 @@ var MessageList = React9.memo(
864
965
  const toolInput = step.metadata?.toolInput;
865
966
  const observationStep = message.metadata.steps[idx + 1];
866
967
  const result = observationStep?.type === "observation" ? observationStep.content : null;
867
- return /* @__PURE__ */ React9.createElement(Box9, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React9.createElement(Text8, { color: "yellow" }, "\u{1F527} Action: ", toolName), toolInput && /* @__PURE__ */ React9.createElement(Text8, { dimColor: true }, ` Input: ${typeof toolInput === "string" ? toolInput : JSON.stringify(toolInput).slice(0, 100)}`), result && /* @__PURE__ */ React9.createElement(Text8, { dimColor: true }, ` Result: ${typeof result === "string" ? result.slice(0, 200) : JSON.stringify(result).slice(0, 200)}${(typeof result === "string" ? result.length : JSON.stringify(result).length) > 200 ? "..." : ""}`));
968
+ return /* @__PURE__ */ React10.createElement(Box9, { key: idx, paddingLeft: 2, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React10.createElement(Text9, { color: "yellow" }, "\u{1F527} Action: ", toolName), toolInput && /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` Input: ${typeof toolInput === "string" ? toolInput : JSON.stringify(toolInput).slice(0, 100)}`), result && /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, ` Result: ${typeof result === "string" ? result.slice(0, 200) : JSON.stringify(result).slice(0, 200)}${(typeof result === "string" ? result.length : JSON.stringify(result).length) > 200 ? "..." : ""}`));
868
969
  }
869
970
  return null;
870
- }).filter(Boolean)), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */ React9.createElement(Box9, { paddingLeft: 2 }, /* @__PURE__ */ React9.createElement(Text8, { dimColor: true }, `${message.metadata.tokenUsage.total} tokens`)))));
971
+ }).filter(Boolean)), message.metadata?.tokenUsage && (!message.metadata.steps || message.metadata.steps.length === 0) && /* @__PURE__ */ React10.createElement(Box9, { paddingLeft: 2 }, /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, `${message.metadata.tokenUsage.total} tokens`)))));
871
972
  },
872
973
  (prevProps, nextProps) => {
873
974
  if (prevProps.messages.length !== nextProps.messages.length) {
@@ -878,8 +979,8 @@ var MessageList = React9.memo(
878
979
  );
879
980
 
880
981
  // src/components/LoginFlow.tsx
881
- import React10, { useState as useState2, useEffect as useEffect2 } from "react";
882
- import { Box as Box10, Text as Text9 } from "ink";
982
+ import React11, { useState as useState3, useEffect as useEffect2 } from "react";
983
+ import { Box as Box10, Text as Text10 } from "ink";
883
984
  import Spinner2 from "ink-spinner";
884
985
  import jwt from "jsonwebtoken";
885
986
  import open from "open";
@@ -995,10 +1096,10 @@ var OAuthClient = class {
995
1096
 
996
1097
  // src/components/LoginFlow.tsx
997
1098
  function LoginFlow({ apiUrl = "http://localhost:3000", configStore, onSuccess, onError }) {
998
- const [status, setStatus] = useState2("initiating");
999
- const [deviceFlow, setDeviceFlow] = useState2(null);
1000
- const [statusMessage, setStatusMessage] = useState2("Initiating device authorization...");
1001
- const [error, setError] = useState2(null);
1099
+ const [status, setStatus] = useState3("initiating");
1100
+ const [deviceFlow, setDeviceFlow] = useState3(null);
1101
+ const [statusMessage, setStatusMessage] = useState3("Initiating device authorization...");
1102
+ const [error, setError] = useState3(null);
1002
1103
  useEffect2(() => {
1003
1104
  const runLoginFlow = async () => {
1004
1105
  const oauth = new OAuthClient(apiUrl);
@@ -1042,15 +1143,15 @@ function LoginFlow({ apiUrl = "http://localhost:3000", configStore, onSuccess, o
1042
1143
  }
1043
1144
  }, [deviceFlow, status]);
1044
1145
  if (status === "initiating") {
1045
- return /* @__PURE__ */ React10.createElement(Box10, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React10.createElement(Box10, null, /* @__PURE__ */ React10.createElement(Text9, { color: "cyan" }, /* @__PURE__ */ React10.createElement(Spinner2, { type: "dots" }), " Initiating device authorization...")));
1146
+ return /* @__PURE__ */ React11.createElement(Box10, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React11.createElement(Box10, null, /* @__PURE__ */ React11.createElement(Text10, { color: "cyan" }, /* @__PURE__ */ React11.createElement(Spinner2, { type: "dots" }), " Initiating device authorization...")));
1046
1147
  }
1047
1148
  if (status === "error") {
1048
- return /* @__PURE__ */ React10.createElement(Box10, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React10.createElement(Box10, { marginBottom: 1 }, /* @__PURE__ */ React10.createElement(Text9, { color: "red", bold: true }, "\u2716 Authentication Failed")), /* @__PURE__ */ React10.createElement(Box10, null, /* @__PURE__ */ React10.createElement(Text9, { color: "red" }, error)));
1149
+ return /* @__PURE__ */ React11.createElement(Box10, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React11.createElement(Box10, { marginBottom: 1 }, /* @__PURE__ */ React11.createElement(Text10, { color: "red", bold: true }, "\u2716 Authentication Failed")), /* @__PURE__ */ React11.createElement(Box10, null, /* @__PURE__ */ React11.createElement(Text10, { color: "red" }, error)));
1049
1150
  }
1050
1151
  if (status === "success") {
1051
- return /* @__PURE__ */ React10.createElement(Box10, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React10.createElement(Box10, { marginBottom: 1 }, /* @__PURE__ */ React10.createElement(Text9, { color: "green", bold: true }, "\u2714 Successfully authenticated!")), /* @__PURE__ */ React10.createElement(Box10, null, /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, "You can now use B4M CLI with your account.")));
1152
+ return /* @__PURE__ */ React11.createElement(Box10, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React11.createElement(Box10, { marginBottom: 1 }, /* @__PURE__ */ React11.createElement(Text10, { color: "green", bold: true }, "\u2714 Successfully authenticated!")), /* @__PURE__ */ React11.createElement(Box10, null, /* @__PURE__ */ React11.createElement(Text10, { dimColor: true }, "You can now use B4M CLI with your account.")));
1052
1153
  }
1053
- return /* @__PURE__ */ React10.createElement(Box10, { flexDirection: "column", padding: 1, borderStyle: "round", borderColor: "cyan" }, /* @__PURE__ */ React10.createElement(Box10, { marginBottom: 1 }, /* @__PURE__ */ React10.createElement(Text9, { color: "cyan", bold: true }, "\u{1F510} Device Authorization")), /* @__PURE__ */ React10.createElement(Box10, { marginBottom: 1 }, /* @__PURE__ */ React10.createElement(Text9, null, "Opening browser automatically... If it doesn't open, please visit:")), /* @__PURE__ */ React10.createElement(Box10, { marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React10.createElement(Text9, { color: "blue", bold: true }, deviceFlow?.verification_uri)), /* @__PURE__ */ React10.createElement(Box10, { marginBottom: 1 }, /* @__PURE__ */ React10.createElement(Text9, null, "And enter this code when prompted:")), /* @__PURE__ */ React10.createElement(Box10, { marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React10.createElement(Text9, { color: "yellow", bold: true }, deviceFlow?.user_code)), /* @__PURE__ */ React10.createElement(Box10, { marginTop: 1 }, /* @__PURE__ */ React10.createElement(Text9, { color: "cyan" }, /* @__PURE__ */ React10.createElement(Spinner2, { type: "dots" }), " ", statusMessage)), /* @__PURE__ */ React10.createElement(Box10, { marginTop: 1 }, /* @__PURE__ */ React10.createElement(Text9, { dimColor: true }, "Expires in ", deviceFlow ? Math.floor(deviceFlow.expires_in / 60) : 0, " minutes")));
1154
+ return /* @__PURE__ */ React11.createElement(Box10, { flexDirection: "column", padding: 1, borderStyle: "round", borderColor: "cyan" }, /* @__PURE__ */ React11.createElement(Box10, { marginBottom: 1 }, /* @__PURE__ */ React11.createElement(Text10, { color: "cyan", bold: true }, "\u{1F510} Device Authorization")), /* @__PURE__ */ React11.createElement(Box10, { marginBottom: 1 }, /* @__PURE__ */ React11.createElement(Text10, null, "Opening browser automatically... If it doesn't open, please visit:")), /* @__PURE__ */ React11.createElement(Box10, { marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React11.createElement(Text10, { color: "blue", bold: true }, deviceFlow?.verification_uri)), /* @__PURE__ */ React11.createElement(Box10, { marginBottom: 1 }, /* @__PURE__ */ React11.createElement(Text10, null, "And enter this code when prompted:")), /* @__PURE__ */ React11.createElement(Box10, { marginBottom: 1, paddingLeft: 2 }, /* @__PURE__ */ React11.createElement(Text10, { color: "yellow", bold: true }, deviceFlow?.user_code)), /* @__PURE__ */ React11.createElement(Box10, { marginTop: 1 }, /* @__PURE__ */ React11.createElement(Text10, { color: "cyan" }, /* @__PURE__ */ React11.createElement(Spinner2, { type: "dots" }), " ", statusMessage)), /* @__PURE__ */ React11.createElement(Box10, { marginTop: 1 }, /* @__PURE__ */ React11.createElement(Text10, { dimColor: true }, "Expires in ", deviceFlow ? Math.floor(deviceFlow.expires_in / 60) : 0, " minutes")));
1054
1155
  }
1055
1156
 
1056
1157
  // src/storage/SessionStore.ts
@@ -9178,7 +9279,7 @@ import { isAxiosError as isAxiosError2 } from "axios";
9178
9279
  // package.json
9179
9280
  var package_default = {
9180
9281
  name: "@bike4mind/cli",
9181
- version: "0.2.2",
9282
+ version: "0.2.3-basic-cli-shortcuts.17058+9fe0019f0",
9182
9283
  type: "module",
9183
9284
  description: "Interactive CLI tool for Bike4Mind with ReAct agents",
9184
9285
  license: "UNLICENSED",
@@ -9279,11 +9380,11 @@ var package_default = {
9279
9380
  zustand: "^4.5.4"
9280
9381
  },
9281
9382
  devDependencies: {
9282
- "@bike4mind/agents": "workspace:*",
9283
- "@bike4mind/common": "workspace:*",
9284
- "@bike4mind/mcp": "workspace:*",
9285
- "@bike4mind/services": "workspace:*",
9286
- "@bike4mind/utils": "workspace:*",
9383
+ "@bike4mind/agents": "0.1.0",
9384
+ "@bike4mind/common": "2.37.1-basic-cli-shortcuts.17058+9fe0019f0",
9385
+ "@bike4mind/mcp": "1.19.5-basic-cli-shortcuts.17058+9fe0019f0",
9386
+ "@bike4mind/services": "2.31.1-basic-cli-shortcuts.17058+9fe0019f0",
9387
+ "@bike4mind/utils": "2.0.4-basic-cli-shortcuts.17058+9fe0019f0",
9287
9388
  "@types/diff": "^5.0.9",
9288
9389
  "@types/jsonwebtoken": "^9.0.4",
9289
9390
  "@types/node": "^22.9.0",
@@ -9294,7 +9395,8 @@ var package_default = {
9294
9395
  tsx: "^4.21.0",
9295
9396
  typescript: "^5.9.3",
9296
9397
  vitest: "^3.2.4"
9297
- }
9398
+ },
9399
+ gitHead: "9fe0019f0bca23b4ffe22a4d9504a0e02054f48d"
9298
9400
  };
9299
9401
 
9300
9402
  // src/config/constants.ts
@@ -9315,7 +9417,7 @@ var EXIT_TIMEOUT_MS = 2e3;
9315
9417
  var usageCache = null;
9316
9418
  function CliApp() {
9317
9419
  const { exit } = useApp();
9318
- const [state, setState] = useState3({
9420
+ const [state, setState] = useState4({
9319
9421
  session: null,
9320
9422
  sessionStore: new SessionStore(),
9321
9423
  configStore: new ConfigStore(),
@@ -9325,9 +9427,9 @@ function CliApp() {
9325
9427
  permissionManager: null,
9326
9428
  permissionPrompt: null
9327
9429
  });
9328
- const [isInitialized, setIsInitialized] = useState3(false);
9329
- const [initError, setInitError] = useState3(null);
9330
- const [commandHistory, setCommandHistory] = useState3([]);
9430
+ const [isInitialized, setIsInitialized] = useState4(false);
9431
+ const [initError, setInitError] = useState4(null);
9432
+ const [commandHistory, setCommandHistory] = useState4([]);
9331
9433
  const setStoreSession = useCliStore((state2) => state2.setSession);
9332
9434
  const setPermissionPrompt = useCliStore((state2) => state2.setPermissionPrompt);
9333
9435
  const setExitRequested = useCliStore((state2) => state2.setExitRequested);
@@ -9359,7 +9461,7 @@ function CliApp() {
9359
9461
  process.exit(0);
9360
9462
  }, 100);
9361
9463
  }, [state.session, state.sessionStore, state.mcpManager, state.agent]);
9362
- useInput2((input, key) => {
9464
+ useInput3((input, key) => {
9363
9465
  if (key.ctrl && input === "c") {
9364
9466
  const now = Date.now();
9365
9467
  if (exitTimestamp && now - exitTimestamp < EXIT_TIMEOUT_MS) {
@@ -9951,11 +10053,11 @@ No usage data available for the last ${USAGE_DAYS} days.`);
9951
10053
  }
9952
10054
  };
9953
10055
  if (initError) {
9954
- return /* @__PURE__ */ React11.createElement(Box11, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React11.createElement(Text10, { color: "red", bold: true }, "\u274C Initialization Error"), /* @__PURE__ */ React11.createElement(Text10, null, initError), /* @__PURE__ */ React11.createElement(Text10, { dimColor: true }, "\n", "Tip: Run /config to set up your API keys"));
10056
+ return /* @__PURE__ */ React12.createElement(Box11, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React12.createElement(Text11, { color: "red", bold: true }, "\u274C Initialization Error"), /* @__PURE__ */ React12.createElement(Text11, null, initError), /* @__PURE__ */ React12.createElement(Text11, { dimColor: true }, "\n", "Tip: Run /config to set up your API keys"));
9955
10057
  }
9956
10058
  if (state.showLoginFlow) {
9957
10059
  const loginApiUrl = getApiUrl(state.config?.apiConfig);
9958
- return /* @__PURE__ */ React11.createElement(
10060
+ return /* @__PURE__ */ React12.createElement(
9959
10061
  LoginFlow,
9960
10062
  {
9961
10063
  apiUrl: loginApiUrl,
@@ -9978,9 +10080,9 @@ No usage data available for the last ${USAGE_DAYS} days.`);
9978
10080
  );
9979
10081
  }
9980
10082
  if (!isInitialized) {
9981
- return /* @__PURE__ */ React11.createElement(Box11, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React11.createElement(Text10, null, "\u{1F680} Initializing..."));
10083
+ return /* @__PURE__ */ React12.createElement(Box11, { flexDirection: "column", padding: 1 }, /* @__PURE__ */ React12.createElement(Text11, null, "\u{1F680} Initializing..."));
9982
10084
  }
9983
- return /* @__PURE__ */ React11.createElement(
10085
+ return /* @__PURE__ */ React12.createElement(
9984
10086
  App,
9985
10087
  {
9986
10088
  onMessage: handleMessage,
@@ -10011,6 +10113,6 @@ var isDevMode = import.meta.url.includes("/src/") || process.env.NODE_ENV === "d
10011
10113
  if (isDevMode) {
10012
10114
  console.log("\u{1F527} Running in development mode (using TypeScript source)\n");
10013
10115
  }
10014
- render(/* @__PURE__ */ React11.createElement(CliApp, null), {
10116
+ render(/* @__PURE__ */ React12.createElement(CliApp, null), {
10015
10117
  exitOnCtrlC: false
10016
10118
  });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.3-basic-cli-shortcuts.17058+9fe0019f0",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -30,6 +30,15 @@
30
30
  "dist",
31
31
  "bin"
32
32
  ],
33
+ "scripts": {
34
+ "dev": "tsx src/index.tsx",
35
+ "build": "tsup",
36
+ "typecheck": "tsc --noEmit",
37
+ "test": "vitest run",
38
+ "test:watch": "vitest",
39
+ "start": "node dist/index.js",
40
+ "prepublishOnly": "pnpm build"
41
+ },
33
42
  "dependencies": {
34
43
  "@anthropic-ai/sdk": "^0.22.0",
35
44
  "@aws-sdk/client-apigatewaymanagementapi": "3.654.0",
@@ -92,6 +101,11 @@
92
101
  "zustand": "^4.5.4"
93
102
  },
94
103
  "devDependencies": {
104
+ "@bike4mind/agents": "0.1.0",
105
+ "@bike4mind/common": "2.37.1-basic-cli-shortcuts.17058+9fe0019f0",
106
+ "@bike4mind/mcp": "1.19.5-basic-cli-shortcuts.17058+9fe0019f0",
107
+ "@bike4mind/services": "2.31.1-basic-cli-shortcuts.17058+9fe0019f0",
108
+ "@bike4mind/utils": "2.0.4-basic-cli-shortcuts.17058+9fe0019f0",
95
109
  "@types/diff": "^5.0.9",
96
110
  "@types/jsonwebtoken": "^9.0.4",
97
111
  "@types/node": "^22.9.0",
@@ -101,19 +115,7 @@
101
115
  "tsup": "^8.5.1",
102
116
  "tsx": "^4.21.0",
103
117
  "typescript": "^5.9.3",
104
- "vitest": "^3.2.4",
105
- "@bike4mind/common": "2.37.0",
106
- "@bike4mind/agents": "0.1.0",
107
- "@bike4mind/mcp": "1.19.4",
108
- "@bike4mind/services": "2.31.0",
109
- "@bike4mind/utils": "2.0.3"
118
+ "vitest": "^3.2.4"
110
119
  },
111
- "scripts": {
112
- "dev": "tsx src/index.tsx",
113
- "build": "tsup",
114
- "typecheck": "tsc --noEmit",
115
- "test": "vitest run",
116
- "test:watch": "vitest",
117
- "start": "node dist/index.js"
118
- }
119
- }
120
+ "gitHead": "9fe0019f0bca23b4ffe22a4d9504a0e02054f48d"
121
+ }