@builder.io/buildercode 0.3.4 → 0.3.6

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +1817 -1118
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -51101,7 +51101,7 @@ function parameterize(strings, ...values) {
51101
51101
  * @param values Expressions extracted from template string
51102
51102
  * @returns A `ParameterizedString` object that can be passed into `captureMessage` or Sentry.logger.X methods.
51103
51103
  */
51104
- const fmt = parameterize;
51104
+ const fmt$1 = parameterize;
51105
51105
  //#endregion
51106
51106
  //#region ../../node_modules/@sentry/core/build/esm/utils/sdkMetadata.js
51107
51107
  /**
@@ -53095,7 +53095,7 @@ var exports_exports = /* @__PURE__ */ __exportAll({
53095
53095
  debug: () => debug$3,
53096
53096
  error: () => error,
53097
53097
  fatal: () => fatal,
53098
- fmt: () => fmt,
53098
+ fmt: () => fmt$1,
53099
53099
  info: () => info,
53100
53100
  trace: () => trace$1,
53101
53101
  warn: () => warn
@@ -244266,7 +244266,7 @@ const LIB_CACHE = /* @__PURE__ */ new Map();
244266
244266
  const PENDING_LIB_CACHE = /* @__PURE__ */ new Map();
244267
244267
  const NODE_MODULE_CACHE = /* @__PURE__ */ new Map();
244268
244268
  const TSCONFIG_CACHE = /* @__PURE__ */ new Map();
244269
- const pkgVersion = process.env.OVERRIDE_VERSION ?? "0.3.4";
244269
+ const pkgVersion = process.env.OVERRIDE_VERSION ?? "0.3.6";
244270
244270
  //#endregion
244271
244271
  //#region ../dev-tools/core/detect-frameworks.ts
244272
244272
  async function detectFrameworks$1(sys) {
@@ -290208,7 +290208,7 @@ function wc$1({ parent: e }) {
290208
290208
  default: return !1;
290209
290209
  }
290210
290210
  }
290211
- function _c$16({ parent: e, grandparent: t }) {
290211
+ function _c$17({ parent: e, grandparent: t }) {
290212
290212
  return t?.type === "JSXAttribute" && e.type === "JSXExpressionContainer" && t.name.type === "JSXIdentifier" && t.name.name === "css";
290213
290213
  }
290214
290214
  async function co(e, t, r) {
@@ -295224,7 +295224,7 @@ var init_estree = __esmMin((() => {
295224
295224
  (e, t) => e.type === "CallExpression" && e.callee.type === "Identifier" && e.callee.name === "Component" && t === "arguments",
295225
295225
  (e, t) => e.type === "Decorator" && t === "expression"
295226
295226
  ];
295227
- po$1 = (e) => Oc$1(e) || wc$1(e) || _c$16(e) || oo$2(e);
295227
+ po$1 = (e) => Oc$1(e) || wc$1(e) || _c$17(e) || oo$2(e);
295228
295228
  Es$6 = 0;
295229
295229
  fo = mo.bind(void 0, "html"), yo = mo.bind(void 0, "angular");
295230
295230
  jc = [
@@ -399401,7 +399401,7 @@ function xc(t, e, s = {}) {
399401
399401
  let r = It(t, s.backwards ? e - 1 : e, s);
399402
399402
  return r !== Gt(t, r, s);
399403
399403
  }
399404
- function _c$15(t, e) {
399404
+ function _c$16(t, e) {
399405
399405
  if (e === !1) return !1;
399406
399406
  if (t.charAt(e) === "/" && t.charAt(e + 1) === "*") {
399407
399407
  for (let s = e + 2; s < t.length; ++s) if (t.charAt(s) === "*" && t.charAt(s + 1) === "/") return s + 2;
@@ -405226,7 +405226,7 @@ https://evilmartians.com/chronicles/postcss-8-plugin-migration`));
405226
405226
  ` || t === "\r" || t === "\u2028" || t === "\u2029";
405227
405227
  Gt = vc;
405228
405228
  Yt = xc;
405229
- xi$1 = _c$15;
405229
+ xi$1 = _c$16;
405230
405230
  _i = bc;
405231
405231
  Vt$1 = Ec;
405232
405232
  De = Oc;
@@ -521191,6 +521191,7 @@ Tips:
521191
521191
  this.#preventMessageFlush = false;
521192
521192
  this.clearMessageQueue();
521193
521193
  this.queueGitStatusReminder({ trigger: "session-start" });
521194
+ this.#emitter.emit("step", this.#getSessionEvent());
521194
521195
  }
521195
521196
  async clearMessageQueue(emitUserMessages = false) {
521196
521197
  const userMessages = [];
@@ -521531,7 +521532,7 @@ Make the necessary changes and try again.`
521531
521532
  options: {
521532
521533
  sys: this.#sys,
521533
521534
  credentials: this.#credentials,
521534
- position: agent?.position ?? `${basePosition}-agent`,
521535
+ position: agent?.position ?? `${basePosition}-${subagentType}`,
521535
521536
  mode,
521536
521537
  includeMemories,
521537
521538
  modelOverride: agent?.inheritSessionModel && (this.#lastModelOverride ?? this.#modelOverride) ? this.#lastModelOverride ?? this.#modelOverride : resolveModelShortcut(resolvedModel) ?? this.#lastModelOverride ?? this.#modelOverride,
@@ -521625,7 +521626,7 @@ Make the necessary changes and try again.`
521625
521626
  });
521626
521627
  }
521627
521628
  if (step.type === "tool") timeline.onToolCall(step.name, step.id, step.content);
521628
- if (step.type === "planning") timeline.onThinking(step.content);
521629
+ if (step.type === "thinking") timeline.onThinking(step.content);
521629
521630
  if (step.type === "tool_result") {
521630
521631
  const prevFrameCount = timeline.getFrameCount();
521631
521632
  timeline.onToolResult(step.result, getLastCursorPosition());
@@ -522620,11 +522621,9 @@ Make the necessary changes and try again.`
522620
522621
  this.#isCheckingGitStatus--;
522621
522622
  }
522622
522623
  }
522623
- #replayTurns() {
522624
+ #getSessionEvent() {
522624
522625
  const sessionContext = this.getSessionContext();
522625
- const turns = sessionContext.turns;
522626
- const steps = [];
522627
- steps.push({
522626
+ return {
522628
522627
  type: "session",
522629
522628
  title: sessionContext.title,
522630
522629
  beforeCommit: sessionContext.beforeCommit,
@@ -522644,7 +522643,12 @@ Make the necessary changes and try again.`
522644
522643
  isSkill: instruction.isSkill ?? instruction.filePath?.toLowerCase().includes("/skills/") ?? false
522645
522644
  })),
522646
522645
  hasPlanToApply: this.#hasPlanToApply
522647
- });
522646
+ };
522647
+ }
522648
+ #replayTurns() {
522649
+ const turns = this.getSessionContext().turns;
522650
+ const steps = [];
522651
+ steps.push(this.#getSessionEvent());
522648
522652
  if (Object.keys(this.#lastMetadata).length > 0) steps.push({
522649
522653
  type: "metadata",
522650
522654
  ...this.#lastMetadata
@@ -522709,7 +522713,7 @@ Make the necessary changes and try again.`
522709
522713
  }
522710
522714
  } catch {}
522711
522715
  } else if (action.type === "thinking") steps.push({
522712
- type: "planning",
522716
+ type: "thinking",
522713
522717
  content: action.content
522714
522718
  });
522715
522719
  else if (action.type === "text") steps.push({
@@ -523116,6 +523120,7 @@ Make the necessary changes and try again.`
523116
523120
  let includeUserMessage = true;
523117
523121
  let hasChanges = false;
523118
523122
  let needGitStatus = false;
523123
+ let navigatePreviewCalled = false;
523119
523124
  let userInput;
523120
523125
  let validationCount = 0;
523121
523126
  let healthIssueCount = 0;
@@ -523169,6 +523174,7 @@ Make the necessary changes and try again.`
523169
523174
  errors = 0;
523170
523175
  hasChanges ||= filesChanged;
523171
523176
  needGitStatus ||= filesChanged;
523177
+ navigatePreviewCalled ||= completionResult.navigatePreviewCalled;
523172
523178
  totalCompletions += completions;
523173
523179
  this.#pendingValidation ||= filesChanged;
523174
523180
  this.#currentMessage = void 0;
@@ -523283,7 +523289,7 @@ failed with code ${result.code}`,
523283
523289
  }
523284
523290
  await this.#commitAccumulatedChanges(true);
523285
523291
  const shouldRefresh = this.#fusionConfig?.refreshPreview ?? true;
523286
- if (hasChanges && shouldRefresh) this.requestRefresh();
523292
+ if (hasChanges && shouldRefresh && !navigatePreviewCalled) this.requestRefresh();
523287
523293
  }
523288
523294
  }
523289
523295
  async #generateCompletion(sessionContext, userInput, signal, onStep) {
@@ -523293,13 +523299,7 @@ failed with code ${result.code}`,
523293
523299
  const url = this.getLastTurn()?.nextUrl ?? this.#initialUrl;
523294
523300
  let filesChanged = false;
523295
523301
  let completions = 0;
523296
- onStep({
523297
- type: "start",
523298
- id: "",
523299
- name: "thinking",
523300
- title: "Thinking",
523301
- content: ""
523302
- });
523302
+ let navigatePreviewCalled = false;
523303
523303
  try {
523304
523304
  const artifacts = this.#onGoingArtifacts = [];
523305
523305
  if (!sessionContext.beforeCommit) {
@@ -523458,6 +523458,7 @@ failed with code ${result.code}`,
523458
523458
  const turnState = lastTurn = await this.#finalizeTurn(sessionContext, json, lastTurn, beforeCommit);
523459
523459
  for (const action of json.actions ?? []) if (action.type === "tool_result") {
523460
523460
  if (action.filePath === "ExitPlanMode") this.#hasPlanToApply = true;
523461
+ if (action.filePath === "NavigatePreview") navigatePreviewCalled = true;
523461
523462
  onStep({
523462
523463
  type: "tool_result",
523463
523464
  result: {
@@ -523520,7 +523521,7 @@ failed with code ${result.code}`,
523520
523521
  };
523521
523522
  const closedAction = (json) => {
523522
523523
  if (json.type === "thinking") onStep({
523523
- type: "planning",
523524
+ type: "thinking",
523524
523525
  content: json.content
523525
523526
  });
523526
523527
  if (json.type === "server_tool_result") {
@@ -523606,6 +523607,7 @@ failed with code ${result.code}`,
523606
523607
  return {
523607
523608
  completions,
523608
523609
  filesChanged,
523610
+ navigatePreviewCalled,
523609
523611
  shouldContinue: shouldContinue || lastTurn.actions.some((a) => a.type === "tool") || lastTurn.autoContinue
523610
523612
  };
523611
523613
  } finally {
@@ -526250,7 +526252,10 @@ ${truncateLines(plan ?? "", 500)}
526250
526252
  isError: false,
526251
526253
  toolResult: isDeepResearch ? `Tech spec is about to be presented to the user. Do not communicate anything else, just acknowledge that the tech spec has been presented. Do not call any other tools.` : `Plan is about to be presented to the user. Waiting for user approval to proceed with implementation. Do not communicate anything else, just acknowledge that the plan has been presented. Do not start implementing anything yet or call any other tools.`,
526252
526254
  title: "Plan presented",
526253
- structuredResult: { sessionMode: toolContext.sessionMode }
526255
+ structuredResult: {
526256
+ sessionMode: toolContext.sessionMode,
526257
+ plan
526258
+ }
526254
526259
  };
526255
526260
  }
526256
526261
  async function proposeConfig(toolContext, input) {
@@ -526810,6 +526815,11 @@ async function getRipgrepExecutable(sys) {
526810
526815
  if (sys.existsSync(pkgBundledRgPath)) return pkgBundledRgPath;
526811
526816
  }
526812
526817
  } catch (error) {}
526818
+ try {
526819
+ const execDir = path$6.dirname(process.execPath);
526820
+ const siblingRgPath = path$6.join(execDir, rgFilename);
526821
+ if (sys.existsSync(siblingRgPath)) return siblingRgPath;
526822
+ } catch {}
526813
526823
  try {
526814
526824
  const platformKey = process.platform === "win32" ? "win32-x64" : `${process.platform}-${process.arch}`;
526815
526825
  const vendoredRgPath = path$6.join(__dirname$1, "..", "vendors", platformKey, rgFilename);
@@ -531908,341 +531918,534 @@ var ScrollView = (0, import_react.forwardRef)(({ onScroll, onViewportSizeChange,
531908
531918
  });
531909
531919
  });
531910
531920
  //#endregion
531911
- //#region ../../node_modules/ink-multiline-input/dist/index.js
531912
- function expandTabs(text, tabSize) {
531913
- return text.replace(/\t/g, " ".repeat(tabSize));
531921
+ //#region src/hooks/useTextInput.ts
531922
+ const MOUSE_RE = /^\[<(\d+);\d+;\d+[Mm]/;
531923
+ function getLineStart(text, cursor) {
531924
+ return text.slice(0, cursor).lastIndexOf("\n") + 1;
531925
+ }
531926
+ function getLineEnd(text, cursor) {
531927
+ const next = text.slice(cursor).indexOf("\n");
531928
+ return next === -1 ? text.length : cursor + next;
531929
+ }
531930
+ function isOnFirstLine(text, cursor) {
531931
+ return !text.slice(0, cursor).includes("\n");
531932
+ }
531933
+ function isOnLastLine(text, cursor) {
531934
+ return !text.slice(cursor).includes("\n");
531935
+ }
531936
+ function getPrevWordStart(text, cursor) {
531937
+ let i = cursor - 1;
531938
+ while (i > 0 && /\s/.test(text[i])) i--;
531939
+ while (i > 0 && !/\s/.test(text[i - 1])) i--;
531940
+ return Math.max(0, i);
531941
+ }
531942
+ function getNextWordEnd(text, cursor) {
531943
+ let i = cursor;
531944
+ const len = text.length;
531945
+ while (i < len && /\s/.test(text[i])) i++;
531946
+ while (i < len && !/\s/.test(text[i])) i++;
531947
+ return i;
531914
531948
  }
531915
- function normalizeLineEndings(text) {
531916
- if (text == null) return "";
531917
- return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
531949
+ function getPrevLineIndex(text, cursor) {
531950
+ const lines = text.split("\n");
531951
+ let pos = 0, lineIdx = 0, col = 0;
531952
+ for (let i = 0; i < lines.length; i++) {
531953
+ const lineEnd = pos + lines[i].length;
531954
+ if (cursor >= pos && cursor <= lineEnd) {
531955
+ lineIdx = i;
531956
+ col = cursor - pos;
531957
+ break;
531958
+ }
531959
+ pos = lineEnd + 1;
531960
+ }
531961
+ if (lineIdx === 0) return cursor;
531962
+ const targetLine = lines[lineIdx - 1];
531963
+ let newIdx = 0;
531964
+ for (let i = 0; i < lineIdx - 1; i++) newIdx += lines[i].length + 1;
531965
+ return newIdx + Math.min(col, targetLine.length);
531918
531966
  }
531919
- var MeasureBox = ({ children, onHeightChange }) => {
531920
- const ref = (0, import_react.useRef)(null);
531921
- const lastHeightRef = (0, import_react.useRef)(void 0);
531922
- (0, import_react.useEffect)(() => {
531923
- if (ref.current) {
531924
- const { height } = measureElement(ref.current);
531925
- if (lastHeightRef.current !== height) {
531926
- lastHeightRef.current = height;
531927
- onHeightChange?.(height);
531928
- }
531967
+ function getNextLineIndex(text, cursor) {
531968
+ const lines = text.split("\n");
531969
+ let pos = 0, lineIdx = 0, col = 0;
531970
+ for (let i = 0; i < lines.length; i++) {
531971
+ const lineEnd = pos + lines[i].length;
531972
+ if (cursor >= pos && cursor <= lineEnd) {
531973
+ lineIdx = i;
531974
+ col = cursor - pos;
531975
+ break;
531929
531976
  }
531930
- });
531931
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
531932
- ref,
531933
- flexShrink: 0,
531934
- flexGrow: 0,
531935
- width: "100%",
531936
- children
531937
- });
531938
- };
531939
- var ControlledMultilineInput = ({ value, rows, maxRows, highlightStyle, textStyle, placeholder = "", mask, showCursor = true, focus = true, tabSize = 4, cursorIndex = 0, highlight, refreshKey }) => {
531940
- const [scrollOffset, setScrollOffset] = (0, import_react.useState)(0);
531941
- const [contentHeight, setContentHeight] = (0, import_react.useState)(0);
531942
- const [markerHeight, setMarkerHeight] = (0, import_react.useState)(0);
531943
- const formatText = (0, import_react.useCallback)((text, isPlaceholder = false) => {
531944
- const normalized = normalizeLineEndings(text);
531945
- if (!isPlaceholder && mask) return normalized.replace(/[^\n]/g, mask);
531946
- return expandTabs(normalized, tabSize);
531947
- }, [tabSize, mask]);
531948
- const { preCursor, postCursor } = (0, import_react.useMemo)(() => {
531949
- if (!value) {
531950
- if (placeholder && !focus) return {
531951
- preCursor: [{
531952
- value: formatText(placeholder, true),
531953
- type: "placeholder"
531954
- }],
531955
- postCursor: []
531956
- };
531957
- return {
531958
- preCursor: [{
531959
- value: " ",
531960
- type: "cursor"
531961
- }],
531962
- postCursor: []
531963
- };
531977
+ pos = lineEnd + 1;
531978
+ }
531979
+ if (lineIdx >= lines.length - 1) return cursor;
531980
+ const targetLine = lines[lineIdx + 1];
531981
+ let newIdx = 0;
531982
+ for (let i = 0; i <= lineIdx; i++) newIdx += lines[i].length + 1;
531983
+ return newIdx + Math.min(col, targetLine.length);
531984
+ }
531985
+ function useTextInput(options = {}) {
531986
+ const { onSubmit, onChange, onScrollUp, onScrollDown, onTab, isActive = true, getIsMenuActive, submitDisabled = false, disableHistory = false } = options;
531987
+ const [value, setValueState] = (0, import_react.useState)("");
531988
+ const [cursorIndex, setCursorIndex] = (0, import_react.useState)(0);
531989
+ const [pasteLength, setPasteLength] = (0, import_react.useState)(0);
531990
+ const [history, setHistory] = (0, import_react.useState)([]);
531991
+ const [historyIndex, setHistoryIndex] = (0, import_react.useState)(-1);
531992
+ const [historyDraft, setHistoryDraft] = (0, import_react.useState)("");
531993
+ const valueRef = (0, import_react.useRef)(value);
531994
+ const cursorRef = (0, import_react.useRef)(cursorIndex);
531995
+ const historyRef = (0, import_react.useRef)(history);
531996
+ const historyIndexRef = (0, import_react.useRef)(historyIndex);
531997
+ const historyDraftRef = (0, import_react.useRef)(historyDraft);
531998
+ valueRef.current = value;
531999
+ cursorRef.current = cursorIndex;
532000
+ historyRef.current = history;
532001
+ historyIndexRef.current = historyIndex;
532002
+ historyDraftRef.current = historyDraft;
532003
+ const applyValue = (0, import_react.useCallback)((val, cursor) => {
532004
+ const nextCursor = cursor ?? val.length;
532005
+ setValueState(val);
532006
+ setCursorIndex(nextCursor);
532007
+ onChange?.(val);
532008
+ }, [onChange]);
532009
+ const setValue = (0, import_react.useCallback)((val_0, cursorPos) => {
532010
+ applyValue(val_0, cursorPos);
532011
+ }, [applyValue]);
532012
+ const clear = (0, import_react.useCallback)(() => {
532013
+ setValueState("");
532014
+ setCursorIndex(0);
532015
+ setPasteLength(0);
532016
+ setHistoryIndex(-1);
532017
+ setHistoryDraft("");
532018
+ onChange?.("");
532019
+ }, [onChange]);
532020
+ useInput((input, key) => {
532021
+ const val_1 = valueRef.current;
532022
+ const cursor_0 = cursorRef.current;
532023
+ const isMenuActive = getIsMenuActive?.() ?? false;
532024
+ const match = input.match(MOUSE_RE);
532025
+ if (match) {
532026
+ const button = parseInt(match[1], 10);
532027
+ if (button === 64) onScrollUp?.();
532028
+ else if (button === 65) onScrollDown?.();
532029
+ return;
531964
532030
  }
531965
- const textBefore = value.slice(0, cursorIndex);
531966
- const textAfter = value.slice(cursorIndex);
531967
- if (!focus) return {
531968
- preCursor: [{ value: formatText(value) }],
531969
- postCursor: []
531970
- };
531971
- if (!(highlight && highlight.end > highlight.start && highlight.start >= 0 && highlight.end <= value.length)) {
531972
- const formattedBefore = formatText(textBefore);
531973
- const formattedAfter = formatText(textAfter);
531974
- const lineStart = formattedBefore.lastIndexOf("\n") + 1;
531975
- const lineEnd = formattedAfter.indexOf("\n");
531976
- return {
531977
- preCursor: [
531978
- { value: formattedBefore.slice(0, lineStart) },
531979
- {
531980
- value: formattedBefore.slice(lineStart),
531981
- type: "highlight"
531982
- },
531983
- {
531984
- value: showCursor && focus ? " " : "",
531985
- type: "cursor"
531986
- }
531987
- ],
531988
- postCursor: [{
531989
- value: formattedAfter.slice(0, lineEnd),
531990
- type: "highlight"
531991
- }, { value: formattedAfter.slice(lineEnd) }]
531992
- };
531993
- } else return {
531994
- preCursor: [
531995
- { value: formatText(textBefore.slice(0, highlight.start)) },
531996
- {
531997
- value: formatText(textBefore.slice(highlight.start, Math.min(highlight.end, cursorIndex))),
531998
- type: "highlight"
531999
- },
532000
- { value: formatText(textBefore.slice(highlight.end)) },
532001
- {
532002
- value: " ",
532003
- type: "cursor"
532004
- }
532005
- ],
532006
- postCursor: [
532007
- { value: formatText(textAfter.slice(0, Math.max(highlight.start - cursorIndex, 0))) },
532008
- {
532009
- value: formatText(textAfter.slice(Math.max(highlight.start - cursorIndex, 0), Math.max(highlight.end - cursorIndex, 0))),
532010
- type: "highlight"
532011
- },
532012
- { value: formatText(textAfter.slice(Math.max(highlight.end - cursorIndex, 0))) }
532013
- ]
532014
- };
532015
- }, [
532016
- cursorIndex,
532017
- showCursor,
532018
- focus,
532019
- value,
532020
- placeholder,
532021
- mask,
532022
- highlight,
532023
- formatText,
532024
- refreshKey
532025
- ]);
532026
- const visibleRows = (0, import_react.useMemo)(() => {
532027
- if (contentHeight !== void 0) return Math.max(rows ?? maxRows ?? 1, Math.min(maxRows ?? rows ?? 1, contentHeight));
532028
- return 1;
532029
- }, [
532030
- rows,
532031
- maxRows,
532032
- contentHeight
532033
- ]);
532034
- (0, import_react.useEffect)(() => {
532035
- if (markerHeight !== void 0 && visibleRows !== void 0) {
532036
- const cursorLineEnd = markerHeight;
532037
- setScrollOffset((prevOffset) => {
532038
- const viewportStart = prevOffset;
532039
- const viewportEnd = prevOffset + visibleRows;
532040
- if (cursorLineEnd <= viewportStart) return Math.max(0, cursorLineEnd - 1);
532041
- else if (cursorLineEnd > viewportEnd) return cursorLineEnd - visibleRows;
532042
- else if (contentHeight) {
532043
- if (contentHeight < visibleRows) return 0;
532044
- else if (contentHeight < viewportEnd) return contentHeight - visibleRows;
532045
- }
532046
- return prevOffset;
532047
- });
532031
+ if (input.includes("[<") && /\d+;\d+;\d+[Mm]/.test(input)) return;
532032
+ if (key.tab && key.shift) return;
532033
+ if (key.tab && !isMenuActive) {
532034
+ onTab?.();
532035
+ return;
532048
532036
  }
532049
- }, [
532050
- markerHeight,
532051
- visibleRows,
532052
- contentHeight
532053
- ]);
532054
- const getStyle = (0, import_react.useCallback)((type) => {
532055
- switch (type) {
532056
- case "placeholder": return {
532057
- ...textStyle,
532058
- dimColor: true
532059
- };
532060
- case "highlight": return highlightStyle ?? textStyle;
532061
- case "cursor": return {
532062
- ...highlightStyle ?? textStyle,
532063
- inverse: showCursor && focus
532064
- };
532065
- default: return textStyle;
532037
+ if (isMenuActive && (key.upArrow || key.downArrow || key.return || key.escape)) return;
532038
+ if (key.return && !key.ctrl && !key.shift && !key.meta && !isMenuActive) {
532039
+ if (submitDisabled) return;
532040
+ if (val_1.trim()) setHistory((h) => [...h, val_1]);
532041
+ setHistoryIndex(-1);
532042
+ setHistoryDraft("");
532043
+ onSubmit?.(val_1);
532044
+ setValueState("");
532045
+ setCursorIndex(0);
532046
+ setPasteLength(0);
532047
+ onChange?.("");
532048
+ return;
532066
532049
  }
532067
- }, [
532068
- textStyle,
532069
- highlightStyle,
532070
- showCursor,
532071
- focus
532072
- ]);
532073
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
532074
- height: visibleRows,
532075
- overflow: "hidden",
532076
- flexDirection: "column",
532077
- flexGrow: 0,
532078
- flexShrink: 0,
532079
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
532080
- flexDirection: "column",
532081
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
532082
- height: visibleRows,
532083
- overflowY: "hidden",
532084
- flexShrink: 0,
532085
- flexDirection: "column",
532086
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
532087
- marginTop: -scrollOffset,
532088
- flexDirection: "column",
532089
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MeasureBox, {
532090
- onHeightChange: setContentHeight,
532091
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [preCursor?.map((segment, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
532092
- ...getStyle(segment.type),
532093
- children: segment.value
532094
- }, idx)), postCursor?.map((segment, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
532095
- ...getStyle(segment.type),
532096
- children: segment.value
532097
- }, idx))] })
532098
- })
532099
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spacer, {})]
532100
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MeasureBox, {
532101
- onHeightChange: setMarkerHeight,
532102
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: preCursor?.map((segment, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
532103
- ...getStyle(segment.type),
532104
- children: segment.value
532105
- }, idx)) })
532106
- })]
532107
- })
532108
- });
532109
- };
532110
- var MultilineInput = ({ value, onChange, onSubmit, keyBindings, showCursor = true, highlightPastedText = false, focus = true, useCustomInput = (inputHandler, isActive) => useInput(inputHandler, { isActive }), ...controlledProps }) => {
532111
- const [cursorIndex, setCursorIndex] = (0, import_react.useState)(value.length);
532112
- const [pasteLength, setPasteLength] = (0, import_react.useState)(0);
532113
- (0, import_react.useEffect)(() => {
532114
- if (cursorIndex > value.length) setCursorIndex(value.length);
532115
- }, [value, cursorIndex]);
532116
- useCustomInput((input, key) => {
532117
- const submitKey = keyBindings?.submit ?? ((key2) => key2.return && key2.ctrl);
532118
- const newlineKey = keyBindings?.newline ?? ((key2) => key2.return);
532119
- if (submitKey(key)) {
532120
- onSubmit?.(value);
532050
+ if (key.return && (key.ctrl || key.shift || key.meta)) {
532051
+ const next = val_1.slice(0, cursor_0) + "\n" + val_1.slice(cursor_0);
532052
+ setValueState(next);
532053
+ setCursorIndex(cursor_0 + 1);
532054
+ setPasteLength(0);
532055
+ onChange?.(next);
532056
+ return;
532057
+ }
532058
+ if (key.ctrl && input === "c") return;
532059
+ if (key.ctrl && input === "a") {
532060
+ setCursorIndex(getLineStart(val_1, cursor_0));
532061
+ return;
532062
+ }
532063
+ if (key.ctrl && input === "e") {
532064
+ setCursorIndex(getLineEnd(val_1, cursor_0));
532121
532065
  return;
532122
- } else if (newlineKey(key)) {
532123
- onChange(value.slice(0, cursorIndex) + "\n" + value.slice(cursorIndex));
532124
- setCursorIndex(cursorIndex + 1);
532066
+ }
532067
+ if (key.home) {
532068
+ setCursorIndex(getLineStart(val_1, cursor_0));
532069
+ return;
532070
+ }
532071
+ if (key.end) {
532072
+ setCursorIndex(getLineEnd(val_1, cursor_0));
532073
+ return;
532074
+ }
532075
+ if (key.meta && key.leftArrow || key.ctrl && key.leftArrow) {
532076
+ setCursorIndex(getPrevWordStart(val_1, cursor_0));
532077
+ return;
532078
+ }
532079
+ if (key.meta && key.rightArrow || key.ctrl && key.rightArrow) {
532080
+ setCursorIndex(getNextWordEnd(val_1, cursor_0));
532081
+ return;
532082
+ }
532083
+ if (key.ctrl && input === "k") {
532084
+ const next_0 = val_1.slice(0, cursor_0) + val_1.slice(getLineEnd(val_1, cursor_0));
532085
+ setValueState(next_0);
532125
532086
  setPasteLength(0);
532087
+ onChange?.(next_0);
532126
532088
  return;
532127
532089
  }
532128
- if (key.tab || key.shift && key.tab || key.ctrl && input === "c") return;
532129
- if (keyBindings?.newline?.(key)) {
532130
- onChange(value.slice(0, cursorIndex) + "\n" + value.slice(cursorIndex));
532131
- setCursorIndex(cursorIndex + 1);
532090
+ if (key.ctrl && input === "u") {
532091
+ const lineStart = getLineStart(val_1, cursor_0);
532092
+ const next_1 = val_1.slice(0, lineStart) + val_1.slice(cursor_0);
532093
+ setValueState(next_1);
532094
+ setCursorIndex(lineStart);
532132
532095
  setPasteLength(0);
532096
+ onChange?.(next_1);
532097
+ return;
532098
+ }
532099
+ if (key.ctrl && input === "w") {
532100
+ const wordStart = getPrevWordStart(val_1, cursor_0);
532101
+ const next_2 = val_1.slice(0, wordStart) + val_1.slice(cursor_0);
532102
+ setValueState(next_2);
532103
+ setCursorIndex(wordStart);
532104
+ setPasteLength(0);
532105
+ onChange?.(next_2);
532133
532106
  return;
532134
532107
  }
532135
- let nextPasteLength = 0;
532136
- if (input.length > 1) nextPasteLength = input.length;
532137
532108
  if (key.upArrow) {
532138
- if (showCursor) {
532139
- const lines = normalizeLineEndings(value).split("\n");
532140
- let currentLineIndex = 0;
532141
- let currentPos = 0;
532142
- let col = 0;
532143
- for (let i = 0; i < lines.length; i++) {
532144
- const line = lines[i];
532145
- if (line === void 0) continue;
532146
- const lineLen = line.length;
532147
- const lineEnd = currentPos + lineLen;
532148
- if (cursorIndex >= currentPos && cursorIndex <= lineEnd) {
532149
- currentLineIndex = i;
532150
- col = cursorIndex - currentPos;
532151
- break;
532152
- }
532153
- currentPos = lineEnd + 1;
532154
- }
532155
- if (currentLineIndex > 0) {
532156
- const targetLineIndex = currentLineIndex - 1;
532157
- const targetLine = lines[targetLineIndex];
532158
- if (targetLine !== void 0) {
532159
- const targetLineLen = targetLine.length;
532160
- const newCol = Math.min(col, targetLineLen);
532161
- let newIndex = 0;
532162
- for (let i = 0; i < targetLineIndex; i++) newIndex += lines[i].length + 1;
532163
- newIndex += newCol;
532164
- setCursorIndex(newIndex);
532165
- setPasteLength(0);
532166
- }
532167
- }
532168
- }
532169
- } else if (key.downArrow) {
532170
- if (showCursor) {
532171
- const lines = normalizeLineEndings(value).split("\n");
532172
- let currentLineIndex = 0;
532173
- let currentPos = 0;
532174
- let col = 0;
532175
- for (let i = 0; i < lines.length; i++) {
532176
- const line = lines[i];
532177
- if (line === void 0) continue;
532178
- const lineLen = line.length;
532179
- const lineEnd = currentPos + lineLen;
532180
- if (cursorIndex >= currentPos && cursorIndex <= lineEnd) {
532181
- currentLineIndex = i;
532182
- col = cursorIndex - currentPos;
532183
- break;
532184
- }
532185
- currentPos = lineEnd + 1;
532186
- }
532187
- if (currentLineIndex < lines.length - 1) {
532188
- const targetLineIndex = currentLineIndex + 1;
532189
- const targetLine = lines[targetLineIndex];
532190
- if (targetLine !== void 0) {
532191
- const targetLineLen = targetLine.length;
532192
- const newCol = Math.min(col, targetLineLen);
532193
- let newIndex = 0;
532194
- for (let i = 0; i < targetLineIndex; i++) newIndex += lines[i].length + 1;
532195
- newIndex += newCol;
532196
- setCursorIndex(newIndex);
532197
- setPasteLength(0);
532198
- }
532199
- }
532200
- }
532201
- } else if (key.leftArrow) {
532202
- if (showCursor) {
532203
- setCursorIndex(Math.max(0, cursorIndex - 1));
532204
- setPasteLength(0);
532205
- }
532206
- } else if (key.rightArrow) {
532207
- if (showCursor) {
532208
- setCursorIndex(Math.min(value.length, cursorIndex + 1));
532209
- setPasteLength(0);
532210
- }
532211
- } else if (key.return) {
532212
- onChange(value.slice(0, cursorIndex) + "\n" + value.slice(cursorIndex));
532213
- setCursorIndex(cursorIndex + 1);
532109
+ const isMultiLine = val_1.includes("\n");
532110
+ if (!disableHistory && isOnFirstLine(val_1, cursor_0) && !isMultiLine) {
532111
+ const h_0 = historyRef.current;
532112
+ const hi = historyIndexRef.current;
532113
+ const nextIndex = hi + 1;
532114
+ if (nextIndex < h_0.length) {
532115
+ if (hi === -1) setHistoryDraft(val_1);
532116
+ const historyValue = h_0[h_0.length - 1 - nextIndex];
532117
+ setHistoryIndex(nextIndex);
532118
+ setValueState(historyValue);
532119
+ setCursorIndex(historyValue.length);
532120
+ onChange?.(historyValue);
532121
+ }
532122
+ } else setCursorIndex(getPrevLineIndex(val_1, cursor_0));
532123
+ setPasteLength(0);
532124
+ return;
532125
+ }
532126
+ if (key.downArrow) {
532127
+ const isMultiLine_0 = val_1.includes("\n");
532128
+ if (!disableHistory && isOnLastLine(val_1, cursor_0) && !isMultiLine_0) {
532129
+ const h_1 = historyRef.current;
532130
+ const hi_0 = historyIndexRef.current;
532131
+ const hd = historyDraftRef.current;
532132
+ if (hi_0 > 0) {
532133
+ const nextIndex_0 = hi_0 - 1;
532134
+ const historyValue_0 = h_1[h_1.length - 1 - nextIndex_0];
532135
+ setHistoryIndex(nextIndex_0);
532136
+ setValueState(historyValue_0);
532137
+ setCursorIndex(historyValue_0.length);
532138
+ onChange?.(historyValue_0);
532139
+ } else if (hi_0 === 0) {
532140
+ setHistoryIndex(-1);
532141
+ setValueState(hd);
532142
+ setCursorIndex(hd.length);
532143
+ onChange?.(hd);
532144
+ }
532145
+ } else setCursorIndex(getNextLineIndex(val_1, cursor_0));
532146
+ setPasteLength(0);
532147
+ return;
532148
+ }
532149
+ if (key.leftArrow) {
532150
+ setCursorIndex(Math.max(0, cursor_0 - 1));
532151
+ setPasteLength(0);
532152
+ return;
532153
+ }
532154
+ if (key.rightArrow) {
532155
+ setCursorIndex(Math.min(val_1.length, cursor_0 + 1));
532214
532156
  setPasteLength(0);
532215
- } else if (key.backspace || key.delete) {
532216
- if (cursorIndex > 0) {
532217
- onChange(value.slice(0, cursorIndex - 1) + value.slice(cursorIndex));
532218
- setCursorIndex(cursorIndex - 1);
532157
+ return;
532158
+ }
532159
+ if (key.backspace || key.delete) {
532160
+ if (cursor_0 > 0) {
532161
+ const next_3 = val_1.slice(0, cursor_0 - 1) + val_1.slice(cursor_0);
532162
+ setValueState(next_3);
532163
+ setCursorIndex(cursor_0 - 1);
532219
532164
  setPasteLength(0);
532165
+ onChange?.(next_3);
532220
532166
  }
532221
- } else if (input) {
532222
- onChange(value.slice(0, cursorIndex) + input + value.slice(cursorIndex));
532223
- setCursorIndex(cursorIndex + input.length);
532224
- setPasteLength(nextPasteLength);
532167
+ return;
532225
532168
  }
532226
- }, focus);
532227
- const highlight = (0, import_react.useMemo)(() => {
532228
- if (highlightPastedText && pasteLength > 1) return {
532229
- start: Math.max(0, cursorIndex - pasteLength),
532230
- end: cursorIndex
532231
- };
532232
- }, [
532233
- cursorIndex,
532234
- pasteLength,
532235
- highlightPastedText
532236
- ]);
532237
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ControlledMultilineInput, {
532238
- ...controlledProps,
532169
+ if (input) {
532170
+ if (historyIndexRef.current !== -1) {
532171
+ setHistoryIndex(-1);
532172
+ setHistoryDraft("");
532173
+ }
532174
+ const next_4 = val_1.slice(0, cursor_0) + input + val_1.slice(cursor_0);
532175
+ setValueState(next_4);
532176
+ setCursorIndex(cursor_0 + input.length);
532177
+ setPasteLength(input.length > 1 ? input.length : 0);
532178
+ onChange?.(next_4);
532179
+ }
532180
+ }, { isActive });
532181
+ return {
532239
532182
  value,
532240
532183
  cursorIndex,
532241
- highlight,
532242
- showCursor,
532243
- focus
532244
- });
532245
- };
532184
+ pasteLength,
532185
+ setValue,
532186
+ clear
532187
+ };
532188
+ }
532189
+ //#endregion
532190
+ //#region src/components/TextInput.tsx
532191
+ /**
532192
+ * TextInput / ControlledTextInput
532193
+ *
532194
+ * Drop-in replacements for `MultilineInput` / `ControlledMultilineInput` from
532195
+ * `ink-multiline-input`. Key improvements over the upstream library:
532196
+ *
532197
+ * 1. Cursor rendered as an *inverse* block on the character it sits on —
532198
+ * no extra space inserted, no text displacement.
532199
+ *
532200
+ * 2. Placeholder visible whenever `value` is empty, regardless of focus.
532201
+ *
532202
+ * 3. Height and cursor-line computed directly from the text (no async
532203
+ * MeasureBox cycle), so arrow-key navigation shows immediately.
532204
+ *
532205
+ * 4. `useTextInput` (backing `TextInput`) fixes ↑/↓ so multi-line text
532206
+ * always navigates lines instead of history.
532207
+ */
532208
+ const TAB_CACHE = /* @__PURE__ */ new Map();
532209
+ function getSpaces(n) {
532210
+ if (!TAB_CACHE.has(n)) TAB_CACHE.set(n, " ".repeat(n));
532211
+ return TAB_CACHE.get(n);
532212
+ }
532213
+ function expandTabs(text, tabSize) {
532214
+ return text.replace(/\t/g, getSpaces(tabSize));
532215
+ }
532216
+ function normalizeLineEndings(text) {
532217
+ if (!text) return "";
532218
+ return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
532219
+ }
532220
+ function fmt(text, tabSize) {
532221
+ return expandTabs(normalizeLineEndings(text), tabSize);
532222
+ }
532223
+ function computeCursorPos(value, cursorIndex, tabSize) {
532224
+ const beforeLines = fmt(value.slice(0, cursorIndex), tabSize).split("\n");
532225
+ const lineIdx = beforeLines.length - 1;
532226
+ const colIdx = beforeLines[lineIdx].length;
532227
+ const rawCharAtCursor = value[cursorIndex];
532228
+ const isNewline = rawCharAtCursor === "\n";
532229
+ return {
532230
+ lineIdx,
532231
+ colIdx,
532232
+ char: !rawCharAtCursor || isNewline ? " " : fmt(rawCharAtCursor, tabSize),
532233
+ isNewline
532234
+ };
532235
+ }
532236
+ const ControlledTextInput = (0, import_react.memo)(function ControlledTextInput(t0) {
532237
+ const $ = (0, import_compiler_runtime.c)(44);
532238
+ const { value, cursorIndex: t1, placeholder: t2, showCursor: t3, focus: t4, rows, maxRows: t5, tabSize: t6 } = t0;
532239
+ const cursorIndex = t1 === void 0 ? 0 : t1;
532240
+ const placeholder = t2 === void 0 ? "" : t2;
532241
+ const showCursor = t3 === void 0 ? true : t3;
532242
+ const focus = t4 === void 0 ? true : t4;
532243
+ const maxRows = t5 === void 0 ? 10 : t5;
532244
+ const tabSize = t6 === void 0 ? 4 : t6;
532245
+ const minRows = rows ?? 1;
532246
+ let t7;
532247
+ if ($[0] !== cursorIndex || $[1] !== tabSize || $[2] !== value) {
532248
+ t7 = value ? computeCursorPos(value, cursorIndex, tabSize) : null;
532249
+ $[0] = cursorIndex;
532250
+ $[1] = tabSize;
532251
+ $[2] = value;
532252
+ $[3] = t7;
532253
+ } else t7 = $[3];
532254
+ const cursorInfo = t7;
532255
+ let t8;
532256
+ if ($[4] !== tabSize || $[5] !== value) {
532257
+ t8 = value ? fmt(value, tabSize).split("\n") : [];
532258
+ $[4] = tabSize;
532259
+ $[5] = value;
532260
+ $[6] = t8;
532261
+ } else t8 = $[6];
532262
+ const allLines = t8;
532263
+ const lineCount = allLines.length;
532264
+ const cursorLineIdx = cursorInfo?.lineIdx ?? 0;
532265
+ const cursorColIdx = cursorInfo?.colIdx ?? 0;
532266
+ const cursorDisplayChar = cursorInfo?.char ?? " ";
532267
+ const charIsNewline = cursorInfo?.isNewline ?? false;
532268
+ const visibleRows = value ? Math.max(minRows, Math.min(maxRows, lineCount)) : minRows;
532269
+ const scrollStart = value ? Math.max(0, Math.min(lineCount - visibleRows, cursorLineIdx - visibleRows + 1)) : 0;
532270
+ let t9;
532271
+ if ($[7] !== allLines || $[8] !== scrollStart || $[9] !== value || $[10] !== visibleRows) {
532272
+ t9 = value ? allLines.slice(scrollStart, scrollStart + visibleRows) : [];
532273
+ $[7] = allLines;
532274
+ $[8] = scrollStart;
532275
+ $[9] = value;
532276
+ $[10] = visibleRows;
532277
+ $[11] = t9;
532278
+ } else t9 = $[11];
532279
+ const visibleLines = t9;
532280
+ if (!value) {
532281
+ let t10;
532282
+ if ($[12] !== focus || $[13] !== showCursor) {
532283
+ t10 = showCursor && focus && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
532284
+ inverse: true,
532285
+ children: " "
532286
+ });
532287
+ $[12] = focus;
532288
+ $[13] = showCursor;
532289
+ $[14] = t10;
532290
+ } else t10 = $[14];
532291
+ let t11;
532292
+ if ($[15] !== placeholder) {
532293
+ t11 = placeholder ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
532294
+ dimColor: true,
532295
+ children: placeholder
532296
+ }) : null;
532297
+ $[15] = placeholder;
532298
+ $[16] = t11;
532299
+ } else t11 = $[16];
532300
+ let t12;
532301
+ if ($[17] !== t10 || $[18] !== t11) {
532302
+ t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [t10, t11] });
532303
+ $[17] = t10;
532304
+ $[18] = t11;
532305
+ $[19] = t12;
532306
+ } else t12 = $[19];
532307
+ let t13;
532308
+ if ($[20] !== minRows || $[21] !== t12) {
532309
+ t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
532310
+ height: minRows,
532311
+ overflow: "hidden",
532312
+ flexDirection: "column",
532313
+ flexShrink: 0,
532314
+ flexGrow: 0,
532315
+ children: t12
532316
+ });
532317
+ $[20] = minRows;
532318
+ $[21] = t12;
532319
+ $[22] = t13;
532320
+ } else t13 = $[22];
532321
+ return t13;
532322
+ }
532323
+ if (!focus) {
532324
+ let t10;
532325
+ if ($[23] !== visibleLines) {
532326
+ t10 = visibleLines.map(_temp$7);
532327
+ $[23] = visibleLines;
532328
+ $[24] = t10;
532329
+ } else t10 = $[24];
532330
+ let t11;
532331
+ if ($[25] !== t10) {
532332
+ t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
532333
+ flexDirection: "column",
532334
+ flexShrink: 0,
532335
+ flexGrow: 0,
532336
+ children: t10
532337
+ });
532338
+ $[25] = t10;
532339
+ $[26] = t11;
532340
+ } else t11 = $[26];
532341
+ return t11;
532342
+ }
532343
+ let t10;
532344
+ if ($[27] !== charIsNewline || $[28] !== cursorColIdx || $[29] !== cursorDisplayChar || $[30] !== cursorLineIdx || $[31] !== scrollStart || $[32] !== showCursor || $[33] !== visibleLines) {
532345
+ let t11;
532346
+ if ($[35] !== charIsNewline || $[36] !== cursorColIdx || $[37] !== cursorDisplayChar || $[38] !== cursorLineIdx || $[39] !== scrollStart || $[40] !== showCursor) {
532347
+ t11 = (line_0, i_0) => {
532348
+ const absLine = i_0 + scrollStart;
532349
+ if (absLine !== cursorLineIdx) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: line_0 || " " }, absLine);
532350
+ const beforeCursor = line_0.slice(0, cursorColIdx);
532351
+ const afterCursor = charIsNewline ? "" : line_0.slice(cursorColIdx + cursorDisplayChar.length);
532352
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
532353
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: beforeCursor }),
532354
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
532355
+ inverse: showCursor,
532356
+ children: cursorDisplayChar
532357
+ }),
532358
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: afterCursor })
532359
+ ] }, absLine);
532360
+ };
532361
+ $[35] = charIsNewline;
532362
+ $[36] = cursorColIdx;
532363
+ $[37] = cursorDisplayChar;
532364
+ $[38] = cursorLineIdx;
532365
+ $[39] = scrollStart;
532366
+ $[40] = showCursor;
532367
+ $[41] = t11;
532368
+ } else t11 = $[41];
532369
+ t10 = visibleLines.map(t11);
532370
+ $[27] = charIsNewline;
532371
+ $[28] = cursorColIdx;
532372
+ $[29] = cursorDisplayChar;
532373
+ $[30] = cursorLineIdx;
532374
+ $[31] = scrollStart;
532375
+ $[32] = showCursor;
532376
+ $[33] = visibleLines;
532377
+ $[34] = t10;
532378
+ } else t10 = $[34];
532379
+ let t11;
532380
+ if ($[42] !== t10) {
532381
+ t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
532382
+ flexDirection: "column",
532383
+ flexShrink: 0,
532384
+ flexGrow: 0,
532385
+ children: t10
532386
+ });
532387
+ $[42] = t10;
532388
+ $[43] = t11;
532389
+ } else t11 = $[43];
532390
+ return t11;
532391
+ });
532392
+ /**
532393
+ * `TextInput` manages its own value state (via `useTextInput`) and delegates
532394
+ * rendering to `ControlledTextInput`. Use this when you don't need external
532395
+ * control over the value.
532396
+ */
532397
+ function TextInput(t0) {
532398
+ const $ = (0, import_compiler_runtime.c)(17);
532399
+ const { onSubmit, onChange, onScrollUp, onScrollDown, onTab, isActive, getIsMenuActive, submitDisabled, disableHistory, placeholder, rows, maxRows, tabSize } = t0;
532400
+ let t1;
532401
+ if ($[0] !== disableHistory || $[1] !== getIsMenuActive || $[2] !== isActive || $[3] !== onChange || $[4] !== onScrollDown || $[5] !== onScrollUp || $[6] !== onSubmit || $[7] !== onTab || $[8] !== submitDisabled) {
532402
+ t1 = {
532403
+ onSubmit,
532404
+ onChange,
532405
+ onScrollUp,
532406
+ onScrollDown,
532407
+ onTab,
532408
+ isActive,
532409
+ getIsMenuActive,
532410
+ submitDisabled,
532411
+ disableHistory
532412
+ };
532413
+ $[0] = disableHistory;
532414
+ $[1] = getIsMenuActive;
532415
+ $[2] = isActive;
532416
+ $[3] = onChange;
532417
+ $[4] = onScrollDown;
532418
+ $[5] = onScrollUp;
532419
+ $[6] = onSubmit;
532420
+ $[7] = onTab;
532421
+ $[8] = submitDisabled;
532422
+ $[9] = t1;
532423
+ } else t1 = $[9];
532424
+ const { value, cursorIndex } = useTextInput(t1);
532425
+ let t2;
532426
+ if ($[10] !== cursorIndex || $[11] !== maxRows || $[12] !== placeholder || $[13] !== rows || $[14] !== tabSize || $[15] !== value) {
532427
+ t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ControlledTextInput, {
532428
+ value,
532429
+ cursorIndex,
532430
+ placeholder,
532431
+ showCursor: true,
532432
+ rows,
532433
+ maxRows,
532434
+ tabSize
532435
+ });
532436
+ $[10] = cursorIndex;
532437
+ $[11] = maxRows;
532438
+ $[12] = placeholder;
532439
+ $[13] = rows;
532440
+ $[14] = tabSize;
532441
+ $[15] = value;
532442
+ $[16] = t2;
532443
+ } else t2 = $[16];
532444
+ return t2;
532445
+ }
532446
+ function _temp$7(line, i) {
532447
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: line || " " }, i);
532448
+ }
532246
532449
  //#endregion
532247
532450
  //#region ../../node_modules/jsonrepair/lib/esm/utils/JSONRepairError.js
532248
532451
  var JSONRepairError = class extends Error {
@@ -533524,7 +533727,7 @@ function useCodeGenStateHandler() {
533524
533727
  else if (step.name === "tool") state.messages.push({
533525
533728
  id: step.id ?? "unknown",
533526
533729
  type: "tool",
533527
- state: "generating",
533730
+ state: state.state === "generating" ? "generating" : "success",
533528
533731
  toolName: step.filePath ?? "",
533529
533732
  input: processToolInput(step.content),
533530
533733
  content: step.content,
@@ -533535,8 +533738,13 @@ function useCodeGenStateHandler() {
533535
533738
  else if (step.name === "thinking") state.messages.push({
533536
533739
  id: step.name,
533537
533740
  type: "thinking",
533538
- content: step.content ?? ""
533741
+ content: step.content ?? "",
533742
+ streaming: true
533539
533743
  });
533744
+ else {
533745
+ const prevThinking = state.messages.findLast((m_0) => m_0.type === "thinking");
533746
+ if (prevThinking) prevThinking.streaming = false;
533747
+ }
533540
533748
  break;
533541
533749
  case "delta": {
533542
533750
  const stepName = step.name;
@@ -533578,7 +533786,7 @@ function useCodeGenStateHandler() {
533578
533786
  existingTool_0.content = toolResult.tool_input;
533579
533787
  existingTool_0.input = processToolInput(existingTool_0.content);
533580
533788
  }
533581
- toolResult.content = toolResult.content;
533789
+ existingTool_0.toolResult = toolResult.content;
533582
533790
  if (isTool(existingTool_0, "TodoWrite")) {
533583
533791
  const todos = existingTool_0.structuredResult?.todos;
533584
533792
  if (Array.isArray(todos)) state.todoItems = todos;
@@ -533609,16 +533817,19 @@ function useCodeGenStateHandler() {
533609
533817
  }
533610
533818
  break;
533611
533819
  }
533612
- case "done":
533820
+ case "done": {
533613
533821
  state.contextWindow = step.contextWindow;
533614
533822
  state.usage = step.usage;
533615
533823
  state.lastCompletionId = step.id;
533616
533824
  state.model = step.model;
533617
533825
  state.creditsUsed = step.creditsUsed;
533618
533826
  state.activeUserQuestions = void 0;
533827
+ const doneThinking = state.messages.findLast((m) => m.type === "thinking");
533828
+ if (doneThinking) doneThinking.streaming = false;
533619
533829
  if (step.applyResults?.length) turnApplyResults.push(...step.applyResults);
533620
533830
  turnCreditsUsed += step.creditsUsed ?? 0;
533621
533831
  break;
533832
+ }
533622
533833
  case "error":
533623
533834
  state.lastError = step;
533624
533835
  break;
@@ -533633,7 +533844,8 @@ function useCodeGenStateHandler() {
533633
533844
  type: "idle",
533634
533845
  applyResults: turnApplyResults,
533635
533846
  creditsUsed: turnCreditsUsed,
533636
- durationMs: Date.now() - turnStartTime
533847
+ durationMs: Date.now() - turnStartTime,
533848
+ state: step.state
533637
533849
  });
533638
533850
  turnApplyResults = [];
533639
533851
  turnCreditsUsed = 0;
@@ -533657,7 +533869,6 @@ function useCodeGenStateHandler() {
533657
533869
  case "user-abort":
533658
533870
  case "continue":
533659
533871
  case "update_setup_value":
533660
- case "planning":
533661
533872
  case "text": break;
533662
533873
  default: break;
533663
533874
  }
@@ -533830,7 +534041,7 @@ function SlashCommandMenu(t0) {
533830
534041
  const [state] = useCodeGenState();
533831
534042
  let t1;
533832
534043
  if ($[0] !== state.customInstructions) {
533833
- const agents = (state.customInstructions ?? []).filter(_temp$5).map(_temp2$3);
534044
+ const agents = (state.customInstructions ?? []).filter(_temp$6).map(_temp2$3);
533834
534045
  let t2;
533835
534046
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
533836
534047
  t2 = {
@@ -534044,7 +534255,7 @@ function _temp2$3(i_0) {
534044
534255
  description: i_0.description
534045
534256
  };
534046
534257
  }
534047
- function _temp$5(i) {
534258
+ function _temp$6(i) {
534048
534259
  return i.type === "agent-mode";
534049
534260
  }
534050
534261
  //#endregion
@@ -534241,9 +534452,19 @@ function FilePicker(t0) {
534241
534452
  }
534242
534453
  //#endregion
534243
534454
  //#region src/components/InputPrompt.tsx
534244
- const MOUSE_RE$1 = /^\[<(\d+);\d+;\d+[Mm]/;
534245
- function shouldSubmitPrompt({ hasText, submitDisabled }) {
534246
- return hasText && !submitDisabled;
534455
+ /**
534456
+ * Returns a short, provider-agnostic display name for a model ID.
534457
+ *
534458
+ * Examples:
534459
+ * "vertexai-claude-4-6-sonnet" → "Sonnet 4.6"
534460
+ * "claude-opus-4-6" → "Opus 4.6"
534461
+ * "claude-haiku-4-5-20251001" → "Haiku 4.5"
534462
+ */
534463
+ function formatModelName(model) {
534464
+ const stripped = model.replace(/^vertexai-/i, "").replace(/^bedrock-/i, "").replace(/^anthropic\./i, "");
534465
+ const m = stripped.match(/claude-([a-z]+)-(\d+)-(\d+)/i);
534466
+ if (m) return `${m[1].charAt(0).toUpperCase() + m[1].slice(1)} ${m[2]}.${m[3]}`;
534467
+ return stripped;
534247
534468
  }
534248
534469
  function isSlashCommandInput(value) {
534249
534470
  return value === "/" || value.startsWith("/") && value.length <= 10;
@@ -534255,14 +534476,46 @@ function getAtQuery(value) {
534255
534476
  }
534256
534477
  const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand, onToggleSessionMode, onSlashMenuActiveChange, onScrollUp, onScrollDown, onImplementPlan, isTabActive = true }) => {
534257
534478
  const [state] = useCodeGenState();
534258
- const [value, setValue] = (0, import_react.useState)("");
534259
534479
  const [dismissedSlashValue, setDismissedSlashValue] = (0, import_react.useState)(null);
534260
534480
  const [dismissedAtValue, setDismissedAtValue] = (0, import_react.useState)(null);
534261
- const [inputKey, setInputKey] = (0, import_react.useState)(0);
534262
534481
  const hasPlan = state.hasPlanToApply && !!onImplementPlan;
534263
- const planIsActive = hasPlan && !value;
534264
534482
  const isPlanning = state.sessionMode === "planning" || state.sessionMode === "auto-planning";
534265
534483
  const hint = hasPlan ? "Type to refine the plan..." : isPlanning ? "Describe what you want to plan..." : "Describe what you want to build...";
534484
+ const slashMenuActiveRef = (0, import_react.useRef)(false);
534485
+ const atMenuActiveRef = (0, import_react.useRef)(false);
534486
+ const getIsMenuActive = (0, import_react.useCallback)(() => slashMenuActiveRef.current || atMenuActiveRef.current, []);
534487
+ const handleChange = (0, import_react.useCallback)((val) => {
534488
+ if (dismissedSlashValue && val !== dismissedSlashValue) setDismissedSlashValue(null);
534489
+ if (dismissedAtValue && val !== dismissedAtValue) setDismissedAtValue(null);
534490
+ onChange?.(val);
534491
+ }, [
534492
+ dismissedSlashValue,
534493
+ dismissedAtValue,
534494
+ onChange
534495
+ ]);
534496
+ const { value, cursorIndex, setValue, clear } = useTextInput({
534497
+ onSubmit: (0, import_react.useCallback)((val_0) => {
534498
+ if (hasPlan && !val_0.trim() && onImplementPlan) {
534499
+ onImplementPlan();
534500
+ return;
534501
+ }
534502
+ if (val_0.trim()) onSubmit(val_0);
534503
+ setDismissedSlashValue(null);
534504
+ onChange?.("");
534505
+ }, [
534506
+ hasPlan,
534507
+ onChange,
534508
+ onImplementPlan,
534509
+ onSubmit
534510
+ ]),
534511
+ onChange: handleChange,
534512
+ onScrollUp,
534513
+ onScrollDown,
534514
+ onTab: onToggleSessionMode,
534515
+ isActive: isTabActive,
534516
+ getIsMenuActive,
534517
+ submitDisabled: false
534518
+ });
534266
534519
  const slashMenuActive = (0, import_react.useMemo)(() => !!onSlashCommand && isSlashCommandInput(value) && value.trim().length > 0 && value !== dismissedSlashValue, [
534267
534520
  dismissedSlashValue,
534268
534521
  onSlashCommand,
@@ -534275,59 +534528,32 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
534275
534528
  dismissedAtValue,
534276
534529
  slashMenuActive
534277
534530
  ]);
534531
+ slashMenuActiveRef.current = slashMenuActive;
534532
+ atMenuActiveRef.current = atMenuActive;
534533
+ const planIsActive = hasPlan && !value;
534278
534534
  (0, import_react.useEffect)(() => {
534279
534535
  onSlashMenuActiveChange?.(slashMenuActive);
534280
534536
  return () => {
534281
534537
  onSlashMenuActiveChange?.(false);
534282
534538
  };
534283
534539
  }, [onSlashMenuActiveChange, slashMenuActive]);
534284
- const handleSubmit = (0, import_react.useCallback)((val) => {
534285
- if (hasPlan && !val.trim() && onImplementPlan) {
534286
- onImplementPlan();
534287
- return;
534288
- }
534289
- if (shouldSubmitPrompt({
534290
- hasText: !!val.trim(),
534291
- submitDisabled: slashMenuActive
534292
- })) {
534293
- onSubmit(val);
534294
- setValue("");
534295
- setDismissedSlashValue(null);
534296
- onChange?.("");
534297
- }
534298
- }, [
534299
- hasPlan,
534300
- onChange,
534301
- onImplementPlan,
534302
- onSubmit,
534303
- slashMenuActive
534304
- ]);
534305
- const handleChange = (0, import_react.useCallback)((val_0) => {
534306
- setValue(val_0);
534307
- if (dismissedSlashValue && val_0 !== dismissedSlashValue) setDismissedSlashValue(null);
534308
- if (dismissedAtValue && val_0 !== dismissedAtValue) setDismissedAtValue(null);
534309
- onChange?.(val_0);
534310
- }, [
534311
- dismissedSlashValue,
534312
- dismissedAtValue,
534313
- onChange
534314
- ]);
534315
534540
  const handleSlashSelect = (0, import_react.useCallback)((selection) => {
534316
534541
  onSlashCommand?.(selection);
534317
- setValue("");
534318
- setDismissedSlashValue(null);
534319
- onChange?.("");
534320
- }, [onChange, onSlashCommand]);
534542
+ clear();
534543
+ }, [clear, onSlashCommand]);
534321
534544
  const handleSlashCancel = (0, import_react.useCallback)(() => {
534322
534545
  setDismissedSlashValue(value);
534323
534546
  }, [value]);
534324
534547
  const handleAtSelect = (0, import_react.useCallback)((filePath) => {
534325
534548
  const newValue = value.replace(/@[^\s]*$/, `@${filePath} `);
534326
534549
  setValue(newValue);
534327
- setInputKey((k) => k + 1);
534328
534550
  setDismissedAtValue(null);
534329
534551
  onChange?.(newValue);
534330
- }, [value, onChange]);
534552
+ }, [
534553
+ value,
534554
+ onChange,
534555
+ setValue
534556
+ ]);
534331
534557
  const handleAtCancel = (0, import_react.useCallback)(() => {
534332
534558
  setDismissedAtValue(value);
534333
534559
  }, [value]);
@@ -534402,62 +534628,30 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
534402
534628
  })
534403
534629
  ]
534404
534630
  }) }),
534405
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultilineInput, {
534631
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ControlledTextInput, {
534406
534632
  value,
534407
- onChange: handleChange,
534408
- onSubmit: handleSubmit,
534633
+ cursorIndex,
534409
534634
  rows: 1,
534410
- maxRows: 10,
534411
- keyBindings: {
534412
- submit: (key) => key.return && !key.ctrl && !slashMenuActive && !atMenuActive,
534413
- newline: (key_0) => key_0.return && key_0.ctrl
534414
- },
534415
- useCustomInput: (handler, isActive) => {
534416
- useInput((input, key_1) => {
534417
- const match = input.match(MOUSE_RE$1);
534418
- if (match) {
534419
- const button = parseInt(match[1], 10);
534420
- if (button === 64) onScrollUp?.();
534421
- else if (button === 65) onScrollDown?.();
534422
- return;
534423
- }
534424
- if (input.includes("[<") && /\d+;\d+;\d+[Mm]/.test(input)) return;
534425
- if (key_1.tab && key_1.shift) return;
534426
- if (key_1.tab && !slashMenuActive) {
534427
- onToggleSessionMode?.();
534428
- return;
534429
- }
534430
- if ((slashMenuActive || atMenuActive) && (key_1.upArrow || key_1.downArrow || key_1.return || key_1.escape)) return;
534431
- handler(input, key_1);
534432
- }, { isActive: isActive && isTabActive });
534433
- }
534434
- }, inputKey), !value && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
534435
- dimColor: true,
534436
- children: hint
534437
- })] }),
534635
+ placeholder: hint,
534636
+ showCursor: true,
534637
+ maxRows: 10
534638
+ }) }),
534438
534639
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
534439
- gap: 1,
534640
+ columnGap: 1,
534641
+ flexWrap: "wrap",
534440
534642
  children: [
534441
534643
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
534442
534644
  color: accentColor,
534443
534645
  bold: true,
534444
534646
  children: state.sessionMode === "planning" ? "Plan" : state.sessionMode === "auto-planning" ? "Auto-Plan" : "Build"
534445
534647
  }),
534446
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
534648
+ (state.modelOverride || state.model) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
534447
534649
  dimColor: true,
534448
534650
  children: "·"
534449
- }),
534450
- state.model && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
534451
- dimColor: true,
534452
- children: state.model
534453
534651
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
534454
534652
  dimColor: true,
534455
- children: "·"
534653
+ children: formatModelName(state.modelOverride ?? state.model)
534456
534654
  })] }),
534457
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
534458
- dimColor: true,
534459
- children: "Fusion"
534460
- }),
534461
534655
  planIsActive && !slashMenuActive && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
534462
534656
  dimColor: true,
534463
534657
  children: "·"
@@ -534654,7 +534848,7 @@ const AskUserQuestionDisplay = (0, import_react.memo)((t0) => {
534654
534848
  else if (key.escape) {
534655
534849
  setCustomMode(false);
534656
534850
  setCustomText("");
534657
- } else if (key.backspace || key.delete) setCustomText(_temp$4);
534851
+ } else if (key.backspace || key.delete) setCustomText(_temp$5);
534658
534852
  else if (input && !key.ctrl && !key.meta) setCustomText((text_0) => text_0 + input);
534659
534853
  return;
534660
534854
  }
@@ -534991,7 +535185,7 @@ const AskUserQuestionDisplay = (0, import_react.memo)((t0) => {
534991
535185
  } else t30 = $[86];
534992
535186
  return t30;
534993
535187
  });
534994
- function _temp$4(text) {
535188
+ function _temp$5(text) {
534995
535189
  return text.slice(0, -1);
534996
535190
  }
534997
535191
  //#endregion
@@ -536681,7 +536875,7 @@ const WelcomeScreen = (0, import_react.memo)((t0) => {
536681
536875
  });
536682
536876
  //#endregion
536683
536877
  //#region src/components/StatusBar.tsx
536684
- function ProgressBar() {
536878
+ const ProgressBar = (0, import_react.memo)(() => {
536685
536879
  const $ = (0, import_compiler_runtime.c)(6);
536686
536880
  const [frame, setFrame] = (0, import_react.useState)(0);
536687
536881
  const frameRef = (0, import_react.useRef)(0);
@@ -536724,9 +536918,9 @@ function ProgressBar() {
536724
536918
  $[5] = t3;
536725
536919
  } else t3 = $[5];
536726
536920
  return t3;
536727
- }
536921
+ });
536728
536922
  const StatusBar = (0, import_react.memo)((t0) => {
536729
- const $ = (0, import_compiler_runtime.c)(8);
536923
+ const $ = (0, import_compiler_runtime.c)(4);
536730
536924
  const { ctrlCPending } = t0;
536731
536925
  const [state] = useCodeGenState();
536732
536926
  if (ctrlCPending) {
@@ -536744,79 +536938,62 @@ const StatusBar = (0, import_react.memo)((t0) => {
536744
536938
  return t1;
536745
536939
  }
536746
536940
  let t1;
536747
- if ($[1] !== state.state) {
536748
- t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
536749
- gap: 1,
536750
- children: state.state === "generating" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressBar, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
536751
- dimColor: true,
536752
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
536753
- bold: true,
536754
- children: "esc"
536755
- }), " interrupt"]
536756
- })] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: " " })
536757
- });
536758
- $[1] = state.state;
536759
- $[2] = t1;
536760
- } else t1 = $[2];
536941
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
536942
+ t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spacer, {});
536943
+ $[1] = t1;
536944
+ } else t1 = $[1];
536761
536945
  let t2;
536762
- if ($[3] !== state.activeUserQuestions) {
536763
- t2 = state.activeUserQuestions ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
536764
- gap: 3,
536765
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
536766
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
536946
+ if ($[2] !== state.activeUserQuestions) {
536947
+ t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
536948
+ justifyContent: "space-between",
536949
+ paddingY: 0,
536950
+ children: [t1, state.activeUserQuestions ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
536951
+ gap: 3,
536952
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
536953
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
536954
+ bold: true,
536955
+ dimColor: true,
536956
+ children: "enter"
536957
+ }),
536958
+ " ",
536959
+ "or",
536960
+ " ",
536961
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
536962
+ bold: true,
536963
+ dimColor: true,
536964
+ children: "space"
536965
+ }),
536966
+ " ",
536967
+ "select"
536968
+ ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
536767
536969
  bold: true,
536768
536970
  dimColor: true,
536769
- children: "enter"
536770
- }),
536771
- " ",
536772
- "or",
536773
- " ",
536774
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
536775
- bold: true,
536971
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
536972
+ bold: true,
536973
+ children: "esc"
536974
+ }), " abort"]
536975
+ })]
536976
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
536977
+ gap: 3,
536978
+ children: [process.env.TERM_PROGRAM !== "vscode" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
536776
536979
  dimColor: true,
536777
- children: "space"
536778
- }),
536779
- " ",
536780
- "select"
536781
- ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
536782
- bold: true,
536783
- dimColor: true,
536784
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
536785
- bold: true,
536786
- children: "esc"
536787
- }), " abort"]
536788
- })]
536789
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
536790
- gap: 3,
536791
- children: [process.env.TERM_PROGRAM !== "vscode" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
536792
- dimColor: true,
536793
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
536794
- bold: true,
536795
- children: "shift+click"
536796
- }), " select text"]
536797
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
536798
- dimColor: true,
536799
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
536800
- bold: true,
536801
- children: "tab"
536802
- }), " agents"]
536980
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
536981
+ bold: true,
536982
+ children: "shift+click"
536983
+ }), " select text"]
536984
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
536985
+ dimColor: true,
536986
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
536987
+ bold: true,
536988
+ children: "tab"
536989
+ }), " agents"]
536990
+ })]
536803
536991
  })]
536804
536992
  });
536805
- $[3] = state.activeUserQuestions;
536806
- $[4] = t2;
536807
- } else t2 = $[4];
536808
- let t3;
536809
- if ($[5] !== t1 || $[6] !== t2) {
536810
- t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
536811
- justifyContent: "space-between",
536812
- paddingY: 0,
536813
- children: [t1, t2]
536814
- });
536815
- $[5] = t1;
536816
- $[6] = t2;
536817
- $[7] = t3;
536818
- } else t3 = $[7];
536819
- return t3;
536993
+ $[2] = state.activeUserQuestions;
536994
+ $[3] = t2;
536995
+ } else t2 = $[3];
536996
+ return t2;
536820
536997
  });
536821
536998
  //#endregion
536822
536999
  //#region src/utils/hyperlink.ts
@@ -537685,7 +537862,7 @@ const TipsSection = (0, import_react.memo)(() => {
537685
537862
  bb0: {
537686
537863
  let t1;
537687
537864
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
537688
- t1 = TIPS.filter(_temp$3);
537865
+ t1 = TIPS.filter(_temp$4);
537689
537866
  $[0] = t1;
537690
537867
  } else t1 = $[0];
537691
537868
  const availableTips = t1;
@@ -537887,71 +538064,95 @@ const TodoSection = (0, import_react.memo)(() => {
537887
538064
  return t4;
537888
538065
  });
537889
538066
  const FooterSection = (0, import_react.memo)(() => {
537890
- const $ = (0, import_compiler_runtime.c)(10);
538067
+ const $ = (0, import_compiler_runtime.c)(15);
537891
538068
  const [state] = useCodeGenState();
538069
+ const { stdout } = useStdout();
538070
+ const [rows, setRows] = (0, import_react.useState)(stdout?.rows ?? 24);
537892
538071
  let t0;
537893
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
537894
- t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TipsSection, {});
537895
- $[0] = t0;
537896
- } else t0 = $[0];
537897
538072
  let t1;
537898
- if ($[1] !== state.sessionId) {
537899
- t1 = state.sessionId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
538073
+ if ($[0] !== stdout) {
538074
+ t0 = () => {
538075
+ if (!stdout) return;
538076
+ const onResize = () => setRows(stdout.rows ?? 24);
538077
+ stdout.on("resize", onResize);
538078
+ return () => {
538079
+ stdout.off("resize", onResize);
538080
+ };
538081
+ };
538082
+ t1 = [stdout];
538083
+ $[0] = stdout;
538084
+ $[1] = t0;
538085
+ $[2] = t1;
538086
+ } else {
538087
+ t0 = $[1];
538088
+ t1 = $[2];
538089
+ }
538090
+ (0, import_react.useEffect)(t0, t1);
538091
+ let t2;
538092
+ if ($[3] !== rows) {
538093
+ t2 = rows >= 300 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TipsSection, {});
538094
+ $[3] = rows;
538095
+ $[4] = t2;
538096
+ } else t2 = $[4];
538097
+ let t3;
538098
+ if ($[5] !== state.sessionId) {
538099
+ t3 = state.sessionId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537900
538100
  marginTop: 1,
537901
538101
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
537902
538102
  dimColor: true,
537903
538103
  children: ["--resume ", state.sessionId]
537904
538104
  })
537905
538105
  });
537906
- $[1] = state.sessionId;
537907
- $[2] = t1;
537908
- } else t1 = $[2];
537909
- let t2;
537910
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
537911
- t2 = process.cwd().replace(process.env.HOME ?? "", "~");
537912
- $[3] = t2;
537913
- } else t2 = $[3];
537914
- const t3 = state.gitState?.currentBranch;
538106
+ $[5] = state.sessionId;
538107
+ $[6] = t3;
538108
+ } else t3 = $[6];
537915
538109
  let t4;
537916
- if ($[4] !== t3) {
537917
- t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
538110
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
538111
+ t4 = process.cwd().replace(process.env.HOME ?? "", "~");
538112
+ $[7] = t4;
538113
+ } else t4 = $[7];
538114
+ const t5 = state.gitState?.currentBranch;
538115
+ let t6;
538116
+ if ($[8] !== t5) {
538117
+ t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537918
538118
  marginTop: 1,
537919
538119
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
537920
538120
  dimColor: true,
537921
- children: [t2, t3]
538121
+ children: [t4, t5]
537922
538122
  })
537923
538123
  });
537924
- $[4] = t3;
537925
- $[5] = t4;
537926
- } else t4 = $[5];
537927
- let t5;
537928
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
537929
- t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
538124
+ $[8] = t5;
538125
+ $[9] = t6;
538126
+ } else t6 = $[9];
538127
+ let t7;
538128
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
538129
+ t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
537930
538130
  dimColor: true,
537931
538131
  children: [
537932
538132
  "•",
537933
538133
  " Fusion ",
537934
- "0.3.4"
538134
+ "0.3.6"
537935
538135
  ]
537936
538136
  });
537937
- $[6] = t5;
537938
- } else t5 = $[6];
537939
- let t6;
537940
- if ($[7] !== t1 || $[8] !== t4) {
537941
- t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
538137
+ $[10] = t7;
538138
+ } else t7 = $[10];
538139
+ let t8;
538140
+ if ($[11] !== t2 || $[12] !== t3 || $[13] !== t6) {
538141
+ t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537942
538142
  flexDirection: "column",
537943
538143
  children: [
537944
- t0,
537945
- t1,
537946
- t4,
537947
- t5
538144
+ t2,
538145
+ t3,
538146
+ t6,
538147
+ t7
537948
538148
  ]
537949
538149
  });
537950
- $[7] = t1;
537951
- $[8] = t4;
537952
- $[9] = t6;
537953
- } else t6 = $[9];
537954
- return t6;
538150
+ $[11] = t2;
538151
+ $[12] = t3;
538152
+ $[13] = t6;
538153
+ $[14] = t8;
538154
+ } else t8 = $[14];
538155
+ return t8;
537955
538156
  });
537956
538157
  const Sidebar = (0, import_react.memo)(() => {
537957
538158
  const $ = (0, import_compiler_runtime.c)(10);
@@ -538016,7 +538217,7 @@ const Sidebar = (0, import_react.memo)(() => {
538016
538217
  } else t8 = $[9];
538017
538218
  return t8;
538018
538219
  });
538019
- function _temp$3(item) {
538220
+ function _temp$4(item) {
538020
538221
  return item.text;
538021
538222
  }
538022
538223
  function _temp2$2(t) {
@@ -597271,16 +597472,21 @@ function ToolHeader(t0) {
597271
597472
  const { state } = tool;
597272
597473
  const color = state === "error" ? "red" : "gray";
597273
597474
  const icon = state === "error" ? "✗" : "✓";
597475
+ const isRunning = state === "generating" || state === "running";
597274
597476
  let t1;
597275
- if ($[0] !== color || $[1] !== icon || $[2] !== state) {
597276
- t1 = state === "generating" || state === "running" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { label: "" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597477
+ if ($[0] !== color || $[1] !== icon || $[2] !== isRunning) {
597478
+ t1 = isRunning ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597479
+ bold: true,
597480
+ color: "cyan",
597481
+ children: "●"
597482
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597277
597483
  color,
597278
597484
  dimColor: true,
597279
597485
  children: icon
597280
597486
  });
597281
597487
  $[0] = color;
597282
597488
  $[1] = icon;
597283
- $[2] = state;
597489
+ $[2] = isRunning;
597284
597490
  $[3] = t1;
597285
597491
  } else t1 = $[3];
597286
597492
  let t2;
@@ -597296,7 +597502,8 @@ function ToolHeader(t0) {
597296
597502
  let t3;
597297
597503
  if ($[6] !== extra || $[7] !== t1 || $[8] !== t2) {
597298
597504
  t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
597299
- gap: 1,
597505
+ columnGap: 1,
597506
+ flexWrap: "wrap",
597300
597507
  children: [
597301
597508
  t1,
597302
597509
  t2,
@@ -597324,6 +597531,7 @@ function FilePath(t0) {
597324
597531
  t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597325
597532
  color: "cyan",
597326
597533
  dimColor: true,
597534
+ wrap: "truncate-start",
597327
597535
  children: t1
597328
597536
  });
597329
597537
  $[2] = t1;
@@ -597339,6 +597547,7 @@ function CmdText(t0) {
597339
597547
  t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597340
597548
  color: "yellow",
597341
597549
  dimColor: true,
597550
+ wrap: "truncate",
597342
597551
  children: cmd
597343
597552
  });
597344
597553
  $[0] = cmd;
@@ -597363,7 +597572,7 @@ function OutputPreview(t0) {
597363
597572
  T0 = Box;
597364
597573
  t2 = "column";
597365
597574
  t3 = 2;
597366
- t4 = lines.map(_temp$2);
597575
+ t4 = lines.map(_temp$3);
597367
597576
  $[0] = maxLines;
597368
597577
  $[1] = text;
597369
597578
  $[2] = T0;
@@ -597382,13 +597591,19 @@ function OutputPreview(t0) {
597382
597591
  }
597383
597592
  let t5;
597384
597593
  if ($[8] !== allLines || $[9] !== maxLines || $[10] !== truncated) {
597385
- t5 = truncated && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
597386
- dimColor: true,
597387
- children: [
597388
- "... +",
597389
- allLines.length - maxLines,
597390
- " more lines"
597391
- ]
597594
+ t5 = truncated && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
597595
+ flexDirection: "row",
597596
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597597
+ dimColor: true,
597598
+ children: " "
597599
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
597600
+ dimColor: true,
597601
+ children: [
597602
+ "+",
597603
+ allLines.length - maxLines,
597604
+ " more lines"
597605
+ ]
597606
+ })]
597392
597607
  });
597393
597608
  $[8] = allLines;
597394
597609
  $[9] = maxLines;
@@ -597411,10 +597626,17 @@ function OutputPreview(t0) {
597411
597626
  } else t6 = $[17];
597412
597627
  return t6;
597413
597628
  }
597414
- function _temp$2(line, i) {
597415
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597416
- dimColor: true,
597417
- children: line || " "
597629
+ function _temp$3(line, i) {
597630
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
597631
+ flexDirection: "row",
597632
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597633
+ dimColor: true,
597634
+ children: i === 0 ? "└ " : " "
597635
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597636
+ dimColor: true,
597637
+ wrap: "wrap",
597638
+ children: line || " "
597639
+ })]
597418
597640
  }, i);
597419
597641
  }
597420
597642
  function buildDiffLines(oldStr, newStr) {
@@ -597480,6 +597702,7 @@ function _temp2$1(line, i) {
597480
597702
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597481
597703
  color: line.kind === "added" ? "green" : line.kind === "removed" ? "red" : void 0,
597482
597704
  dimColor: line.kind === "context",
597705
+ wrap: "wrap",
597483
597706
  children: prefix + " " + (line.text || " ")
597484
597707
  }, i);
597485
597708
  }
@@ -597494,7 +597717,7 @@ function ToolCallRead(t0) {
597494
597717
  } else t1 = $[1];
597495
597718
  const { file_path, offset, limit, view_range } = t1;
597496
597719
  let rangeInfo;
597497
- if (view_range) rangeInfo = `:${view_range[0]} ${view_range[1] - view_range[0]}L`;
597720
+ if (view_range) rangeInfo = `:${view_range[0]} ${view_range[1] - view_range[0] + 1}L`;
597498
597721
  else if (offset != null || limit != null) {
597499
597722
  const t2 = `${offset != null ? `:${offset}` : ""}${limit != null ? ` ${limit}L` : ""}`;
597500
597723
  let t3;
@@ -597690,7 +597913,7 @@ function ToolCallBash(t0) {
597690
597913
  const displayTitle = restart ? "[restart]" : description;
597691
597914
  let t2;
597692
597915
  if ($[2] !== command || $[3] !== restart) {
597693
- t2 = !restart && command ? command.includes("\n") ? command.split("\n")[0] + " ..." : command.slice(0, 80) : void 0;
597916
+ t2 = !restart && command ? command.includes("\n") ? command.split("\n")[0] + " ..." : command.slice(0, 90) : void 0;
597694
597917
  $[2] = command;
597695
597918
  $[3] = restart;
597696
597919
  $[4] = t2;
@@ -597723,12 +597946,16 @@ function ToolCallBash(t0) {
597723
597946
  } else t5 = $[12];
597724
597947
  let t6;
597725
597948
  if ($[13] !== displayCmd) {
597726
- t6 = displayCmd && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
597727
- paddingLeft: 3,
597728
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
597949
+ t6 = displayCmd && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
597950
+ paddingLeft: 2,
597951
+ flexDirection: "row",
597952
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597729
597953
  dimColor: true,
597730
- children: ["$ ", displayCmd]
597731
- })
597954
+ children: " "
597955
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597956
+ dimColor: true,
597957
+ children: displayCmd
597958
+ })]
597732
597959
  });
597733
597960
  $[13] = displayCmd;
597734
597961
  $[14] = t6;
@@ -597760,8 +597987,9 @@ function ToolCallBash(t0) {
597760
597987
  } else t8 = $[20];
597761
597988
  return t8;
597762
597989
  }
597990
+ const RESULT_PREVIEW_LINES = 5;
597763
597991
  function ToolCallGrep(t0) {
597764
- const $ = (0, import_compiler_runtime.c)(23);
597992
+ const $ = (0, import_compiler_runtime.c)(36);
597765
597993
  const { tool } = t0;
597766
597994
  let t1;
597767
597995
  if ($[0] !== tool.input) {
@@ -597770,93 +597998,158 @@ function ToolCallGrep(t0) {
597770
597998
  $[1] = t1;
597771
597999
  } else t1 = $[1];
597772
598000
  const { query, include_glob, case_sensitive } = t1;
598001
+ let T0;
598002
+ let matchCount;
597773
598003
  let t2;
597774
- if ($[2] !== tool.state || $[3] !== tool.toolResult) {
597775
- const resultText = tool.state === "success" ? getResultText(tool.toolResult) : void 0;
597776
- t2 = resultText ? resultText.trim().split("\n").filter(Boolean).length : void 0;
597777
- $[2] = tool.state;
597778
- $[3] = tool.toolResult;
597779
- $[4] = t2;
597780
- } else t2 = $[4];
597781
- const matchCount = t2;
597782
598004
  let t3;
597783
- if ($[5] !== query) {
597784
- t3 = query && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CmdText, { cmd: `"${query}"` });
597785
- $[5] = query;
597786
- $[6] = t3;
597787
- } else t3 = $[6];
597788
598005
  let t4;
597789
- if ($[7] !== include_glob) {
597790
- t4 = include_glob && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597791
- dimColor: true,
597792
- children: include_glob
597793
- });
597794
- $[7] = include_glob;
597795
- $[8] = t4;
597796
- } else t4 = $[8];
597797
598006
  let t5;
597798
- if ($[9] !== case_sensitive) {
597799
- t5 = case_sensitive === false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597800
- dimColor: true,
597801
- children: "-i"
598007
+ if ($[2] !== case_sensitive || $[3] !== include_glob || $[4] !== query || $[5] !== tool) {
598008
+ const resultText = tool.state === "success" ? getResultText(tool.toolResult) : void 0;
598009
+ const allFiles = resultText ? resultText.trim().split("\n").filter(Boolean) : void 0;
598010
+ matchCount = allFiles?.length;
598011
+ const previewFiles = allFiles?.slice(0, RESULT_PREVIEW_LINES);
598012
+ const hiddenCount = matchCount != null && matchCount > RESULT_PREVIEW_LINES ? matchCount - RESULT_PREVIEW_LINES : 0;
598013
+ let t6;
598014
+ if ($[12] !== query) {
598015
+ t6 = query ? query.length > 60 ? `"${query.slice(0, 57)}…"` : `"${query}"` : void 0;
598016
+ $[12] = query;
598017
+ $[13] = t6;
598018
+ } else t6 = $[13];
598019
+ const displayQuery = t6;
598020
+ T0 = Box;
598021
+ t2 = "column";
598022
+ t3 = 1;
598023
+ let t7;
598024
+ if ($[14] !== displayQuery) {
598025
+ t7 = displayQuery && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CmdText, { cmd: displayQuery });
598026
+ $[14] = displayQuery;
598027
+ $[15] = t7;
598028
+ } else t7 = $[15];
598029
+ let t8;
598030
+ if ($[16] !== include_glob) {
598031
+ t8 = include_glob && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598032
+ dimColor: true,
598033
+ children: include_glob
598034
+ });
598035
+ $[16] = include_glob;
598036
+ $[17] = t8;
598037
+ } else t8 = $[17];
598038
+ let t9;
598039
+ if ($[18] !== case_sensitive) {
598040
+ t9 = case_sensitive === false && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598041
+ dimColor: true,
598042
+ children: "-i"
598043
+ });
598044
+ $[18] = case_sensitive;
598045
+ $[19] = t9;
598046
+ } else t9 = $[19];
598047
+ let t10;
598048
+ if ($[20] !== t7 || $[21] !== t8 || $[22] !== t9) {
598049
+ t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
598050
+ t7,
598051
+ t8,
598052
+ t9
598053
+ ] });
598054
+ $[20] = t7;
598055
+ $[21] = t8;
598056
+ $[22] = t9;
598057
+ $[23] = t10;
598058
+ } else t10 = $[23];
598059
+ if ($[24] !== t10 || $[25] !== tool) {
598060
+ t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolHeader, {
598061
+ tool,
598062
+ label: TOOL_LABELS.Grep,
598063
+ extra: t10
598064
+ });
598065
+ $[24] = t10;
598066
+ $[25] = tool;
598067
+ $[26] = t4;
598068
+ } else t4 = $[26];
598069
+ t5 = previewFiles && previewFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598070
+ flexDirection: "column",
598071
+ paddingLeft: 2,
598072
+ children: [previewFiles.map(_temp3$1), hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598073
+ flexDirection: "row",
598074
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598075
+ dimColor: true,
598076
+ children: " "
598077
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
598078
+ dimColor: true,
598079
+ children: [
598080
+ "+",
598081
+ hiddenCount,
598082
+ " more"
598083
+ ]
598084
+ })]
598085
+ })]
597802
598086
  });
597803
- $[9] = case_sensitive;
597804
- $[10] = t5;
597805
- } else t5 = $[10];
598087
+ $[2] = case_sensitive;
598088
+ $[3] = include_glob;
598089
+ $[4] = query;
598090
+ $[5] = tool;
598091
+ $[6] = T0;
598092
+ $[7] = matchCount;
598093
+ $[8] = t2;
598094
+ $[9] = t3;
598095
+ $[10] = t4;
598096
+ $[11] = t5;
598097
+ } else {
598098
+ T0 = $[6];
598099
+ matchCount = $[7];
598100
+ t2 = $[8];
598101
+ t3 = $[9];
598102
+ t4 = $[10];
598103
+ t5 = $[11];
598104
+ }
597806
598105
  let t6;
597807
- if ($[11] !== t3 || $[12] !== t4 || $[13] !== t5) {
597808
- t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
597809
- t3,
597810
- t4,
597811
- t5
597812
- ] });
597813
- $[11] = t3;
597814
- $[12] = t4;
597815
- $[13] = t5;
597816
- $[14] = t6;
597817
- } else t6 = $[14];
597818
- let t7;
597819
- if ($[15] !== t6 || $[16] !== tool) {
597820
- t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolHeader, {
597821
- tool,
597822
- label: TOOL_LABELS.Grep,
597823
- extra: t6
597824
- });
597825
- $[15] = t6;
597826
- $[16] = tool;
597827
- $[17] = t7;
597828
- } else t7 = $[17];
597829
- let t8;
597830
- if ($[18] !== matchCount) {
597831
- t8 = matchCount != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
598106
+ if ($[27] !== matchCount) {
598107
+ t6 = matchCount === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
597832
598108
  paddingLeft: 2,
597833
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
598109
+ flexDirection: "row",
598110
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597834
598111
  dimColor: true,
597835
- children: [
597836
- matchCount,
597837
- " match",
597838
- matchCount !== 1 ? "es" : ""
597839
- ]
597840
- })
598112
+ children: "└ "
598113
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598114
+ dimColor: true,
598115
+ children: "no matches"
598116
+ })]
597841
598117
  });
597842
- $[18] = matchCount;
597843
- $[19] = t8;
597844
- } else t8 = $[19];
597845
- let t9;
597846
- if ($[20] !== t7 || $[21] !== t8) {
597847
- t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
597848
- flexDirection: "column",
597849
- paddingX: 1,
597850
- children: [t7, t8]
598118
+ $[27] = matchCount;
598119
+ $[28] = t6;
598120
+ } else t6 = $[28];
598121
+ let t7;
598122
+ if ($[29] !== T0 || $[30] !== t2 || $[31] !== t3 || $[32] !== t4 || $[33] !== t5 || $[34] !== t6) {
598123
+ t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(T0, {
598124
+ flexDirection: t2,
598125
+ paddingX: t3,
598126
+ children: [
598127
+ t4,
598128
+ t5,
598129
+ t6
598130
+ ]
597851
598131
  });
597852
- $[20] = t7;
597853
- $[21] = t8;
597854
- $[22] = t9;
597855
- } else t9 = $[22];
597856
- return t9;
598132
+ $[29] = T0;
598133
+ $[30] = t2;
598134
+ $[31] = t3;
598135
+ $[32] = t4;
598136
+ $[33] = t5;
598137
+ $[34] = t6;
598138
+ $[35] = t7;
598139
+ } else t7 = $[35];
598140
+ return t7;
598141
+ }
598142
+ function _temp3$1(file, i) {
598143
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598144
+ flexDirection: "row",
598145
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598146
+ dimColor: true,
598147
+ children: i === 0 ? "└ " : " "
598148
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilePath, { path: file })]
598149
+ }, i);
597857
598150
  }
597858
598151
  function ToolCallGlob(t0) {
597859
- const $ = (0, import_compiler_runtime.c)(15);
598152
+ const $ = (0, import_compiler_runtime.c)(24);
597860
598153
  const { tool } = t0;
597861
598154
  let t1;
597862
598155
  if ($[0] !== tool.input) {
@@ -597865,60 +598158,116 @@ function ToolCallGlob(t0) {
597865
598158
  $[1] = t1;
597866
598159
  } else t1 = $[1];
597867
598160
  const { pattern } = t1;
598161
+ let T0;
598162
+ let fileCount;
597868
598163
  let t2;
597869
- if ($[2] !== tool.state || $[3] !== tool.toolResult) {
597870
- const resultText = tool.state === "success" ? getResultText(tool.toolResult) : void 0;
597871
- t2 = resultText ? resultText.trim().split("\n").filter(Boolean).length : void 0;
597872
- $[2] = tool.state;
597873
- $[3] = tool.toolResult;
597874
- $[4] = t2;
597875
- } else t2 = $[4];
597876
- const fileCount = t2;
597877
598164
  let t3;
597878
- if ($[5] !== pattern) {
597879
- t3 = pattern ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CmdText, { cmd: pattern }) : void 0;
597880
- $[5] = pattern;
597881
- $[6] = t3;
597882
- } else t3 = $[6];
597883
598165
  let t4;
597884
- if ($[7] !== t3 || $[8] !== tool) {
597885
- t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolHeader, {
597886
- tool,
597887
- label: TOOL_LABELS.Glob,
597888
- extra: t3
598166
+ let t5;
598167
+ if ($[2] !== pattern || $[3] !== tool) {
598168
+ const resultText = tool.state === "success" ? getResultText(tool.toolResult) : void 0;
598169
+ const allFiles = resultText ? resultText.trim().split("\n").filter(Boolean) : void 0;
598170
+ fileCount = allFiles?.length;
598171
+ const previewFiles = allFiles?.slice(0, RESULT_PREVIEW_LINES);
598172
+ const hiddenCount = fileCount != null && fileCount > RESULT_PREVIEW_LINES ? fileCount - RESULT_PREVIEW_LINES : 0;
598173
+ T0 = Box;
598174
+ t2 = "column";
598175
+ t3 = 1;
598176
+ let t6;
598177
+ if ($[10] !== pattern) {
598178
+ t6 = pattern ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CmdText, { cmd: pattern }) : void 0;
598179
+ $[10] = pattern;
598180
+ $[11] = t6;
598181
+ } else t6 = $[11];
598182
+ if ($[12] !== t6 || $[13] !== tool) {
598183
+ t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolHeader, {
598184
+ tool,
598185
+ label: TOOL_LABELS.Glob,
598186
+ extra: t6
598187
+ });
598188
+ $[12] = t6;
598189
+ $[13] = tool;
598190
+ $[14] = t4;
598191
+ } else t4 = $[14];
598192
+ t5 = previewFiles && previewFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598193
+ flexDirection: "column",
598194
+ paddingLeft: 2,
598195
+ children: [previewFiles.map(_temp4), hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598196
+ flexDirection: "row",
598197
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598198
+ dimColor: true,
598199
+ children: " "
598200
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
598201
+ dimColor: true,
598202
+ children: [
598203
+ "+",
598204
+ hiddenCount,
598205
+ " more"
598206
+ ]
598207
+ })]
598208
+ })]
597889
598209
  });
598210
+ $[2] = pattern;
598211
+ $[3] = tool;
598212
+ $[4] = T0;
598213
+ $[5] = fileCount;
598214
+ $[6] = t2;
597890
598215
  $[7] = t3;
597891
- $[8] = tool;
597892
- $[9] = t4;
597893
- } else t4 = $[9];
597894
- let t5;
597895
- if ($[10] !== fileCount) {
597896
- t5 = fileCount != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
598216
+ $[8] = t4;
598217
+ $[9] = t5;
598218
+ } else {
598219
+ T0 = $[4];
598220
+ fileCount = $[5];
598221
+ t2 = $[6];
598222
+ t3 = $[7];
598223
+ t4 = $[8];
598224
+ t5 = $[9];
598225
+ }
598226
+ let t6;
598227
+ if ($[15] !== fileCount) {
598228
+ t6 = fileCount === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
597897
598229
  paddingLeft: 2,
597898
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
598230
+ flexDirection: "row",
598231
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
597899
598232
  dimColor: true,
597900
- children: [
597901
- fileCount,
597902
- " file",
597903
- fileCount !== 1 ? "s" : ""
597904
- ]
597905
- })
598233
+ children: "└ "
598234
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598235
+ dimColor: true,
598236
+ children: "no files found"
598237
+ })]
597906
598238
  });
597907
- $[10] = fileCount;
597908
- $[11] = t5;
597909
- } else t5 = $[11];
597910
- let t6;
597911
- if ($[12] !== t4 || $[13] !== t5) {
597912
- t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
597913
- flexDirection: "column",
597914
- paddingX: 1,
597915
- children: [t4, t5]
598239
+ $[15] = fileCount;
598240
+ $[16] = t6;
598241
+ } else t6 = $[16];
598242
+ let t7;
598243
+ if ($[17] !== T0 || $[18] !== t2 || $[19] !== t3 || $[20] !== t4 || $[21] !== t5 || $[22] !== t6) {
598244
+ t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(T0, {
598245
+ flexDirection: t2,
598246
+ paddingX: t3,
598247
+ children: [
598248
+ t4,
598249
+ t5,
598250
+ t6
598251
+ ]
597916
598252
  });
597917
- $[12] = t4;
597918
- $[13] = t5;
597919
- $[14] = t6;
597920
- } else t6 = $[14];
597921
- return t6;
598253
+ $[17] = T0;
598254
+ $[18] = t2;
598255
+ $[19] = t3;
598256
+ $[20] = t4;
598257
+ $[21] = t5;
598258
+ $[22] = t6;
598259
+ $[23] = t7;
598260
+ } else t7 = $[23];
598261
+ return t7;
598262
+ }
598263
+ function _temp4(file, i) {
598264
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598265
+ flexDirection: "row",
598266
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598267
+ dimColor: true,
598268
+ children: i === 0 ? "└ " : " "
598269
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilePath, { path: file })]
598270
+ }, i);
597922
598271
  }
597923
598272
  function ToolCallReadRule(t0) {
597924
598273
  const $ = (0, import_compiler_runtime.c)(7);
@@ -598085,7 +598434,7 @@ function ToolCallGetScreenshot(t0) {
598085
598434
  return t5;
598086
598435
  }
598087
598436
  function ToolCallAgent(t0) {
598088
- const $ = (0, import_compiler_runtime.c)(16);
598437
+ const $ = (0, import_compiler_runtime.c)(17);
598089
598438
  const { tool } = t0;
598090
598439
  let t1;
598091
598440
  if ($[0] !== tool.input) {
@@ -598107,13 +598456,14 @@ function ToolCallAgent(t0) {
598107
598456
  }
598108
598457
  let t3;
598109
598458
  if ($[3] !== tool.agentContext) {
598110
- t3 = tool.agentContext.split("\n").map(_temp3$1).filter(_temp4).slice(-8);
598459
+ t3 = tool.agentContext.split("\n").map(_temp5).filter(_temp6).slice(-8);
598111
598460
  $[3] = tool.agentContext;
598112
598461
  $[4] = t3;
598113
598462
  } else t3 = $[4];
598114
598463
  t2 = t3;
598115
598464
  }
598116
598465
  const lines = t2;
598466
+ const isRunning = tool.state === "generating" || tool.state === "running";
598117
598467
  const t3 = `Agent(${subagent_type ?? "explorer"})`;
598118
598468
  let t4;
598119
598469
  if ($[5] !== description) {
@@ -598137,8 +598487,8 @@ function ToolCallAgent(t0) {
598137
598487
  $[10] = t5;
598138
598488
  } else t5 = $[10];
598139
598489
  let t6;
598140
- if ($[11] !== lines) {
598141
- t6 = lines.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
598490
+ if ($[11] !== isRunning || $[12] !== lines) {
598491
+ t6 = isRunning && lines.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
598142
598492
  flexDirection: "column",
598143
598493
  marginLeft: 3,
598144
598494
  paddingX: 1,
@@ -598147,36 +598497,75 @@ function ToolCallAgent(t0) {
598147
598497
  borderStyle: "round",
598148
598498
  borderColor: "grey",
598149
598499
  borderDimColor: true,
598150
- children: lines.map(_temp5)
598500
+ children: lines.map(_temp7)
598151
598501
  });
598152
- $[11] = lines;
598153
- $[12] = t6;
598154
- } else t6 = $[12];
598502
+ $[11] = isRunning;
598503
+ $[12] = lines;
598504
+ $[13] = t6;
598505
+ } else t6 = $[13];
598155
598506
  let t7;
598156
- if ($[13] !== t5 || $[14] !== t6) {
598507
+ if ($[14] !== t5 || $[15] !== t6) {
598157
598508
  t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598158
598509
  flexDirection: "column",
598159
598510
  paddingX: 1,
598160
598511
  children: [t5, t6]
598161
598512
  });
598162
- $[13] = t5;
598163
- $[14] = t6;
598164
- $[15] = t7;
598165
- } else t7 = $[15];
598513
+ $[14] = t5;
598514
+ $[15] = t6;
598515
+ $[16] = t7;
598516
+ } else t7 = $[16];
598166
598517
  return t7;
598167
598518
  }
598168
- function _temp5(line, i) {
598519
+ function _temp7(line, i) {
598169
598520
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598170
598521
  dimColor: true,
598171
598522
  children: line
598172
598523
  }, i);
598173
598524
  }
598174
- function _temp4(l_0) {
598525
+ function _temp6(l_0) {
598175
598526
  return l_0.length > 0;
598176
598527
  }
598177
- function _temp3$1(l) {
598528
+ function _temp5(l) {
598178
598529
  return l.trimEnd();
598179
598530
  }
598531
+ function ToolCallExitPlanMode(t0) {
598532
+ const $ = (0, import_compiler_runtime.c)(8);
598533
+ const { tool } = t0;
598534
+ const plan = tool.structuredResult?.plan ?? tool.input?.plan;
598535
+ let t1;
598536
+ if ($[0] !== tool) {
598537
+ t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolHeader, {
598538
+ tool,
598539
+ label: TOOL_LABELS.ExitPlanMode
598540
+ });
598541
+ $[0] = tool;
598542
+ $[1] = t1;
598543
+ } else t1 = $[1];
598544
+ let t2;
598545
+ if ($[2] !== plan || $[3] !== tool.state) {
598546
+ t2 = plan && tool.state === "success" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
598547
+ flexDirection: "column",
598548
+ paddingLeft: 2,
598549
+ marginTop: 1,
598550
+ children: renderMarkdownBlocks(plan)
598551
+ });
598552
+ $[2] = plan;
598553
+ $[3] = tool.state;
598554
+ $[4] = t2;
598555
+ } else t2 = $[4];
598556
+ let t3;
598557
+ if ($[5] !== t1 || $[6] !== t2) {
598558
+ t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598559
+ flexDirection: "column",
598560
+ paddingX: 1,
598561
+ children: [t1, t2]
598562
+ });
598563
+ $[5] = t1;
598564
+ $[6] = t2;
598565
+ $[7] = t3;
598566
+ } else t3 = $[7];
598567
+ return t3;
598568
+ }
598180
598569
  function ToolCallGeneric(t0) {
598181
598570
  const $ = (0, import_compiler_runtime.c)(11);
598182
598571
  const { tool } = t0;
@@ -598223,8 +598612,9 @@ function ToolCallGeneric(t0) {
598223
598612
  } else t4 = $[10];
598224
598613
  return t4;
598225
598614
  }
598615
+ const WRITE_PREVIEW_MAX_LINES = 60;
598226
598616
  function ToolCallWrite(t0) {
598227
- const $ = (0, import_compiler_runtime.c)(14);
598617
+ const $ = (0, import_compiler_runtime.c)(17);
598228
598618
  const { tool } = t0;
598229
598619
  let t1;
598230
598620
  if ($[0] !== tool.input) {
@@ -598234,54 +598624,63 @@ function ToolCallWrite(t0) {
598234
598624
  } else t1 = $[1];
598235
598625
  const { file_path, title, content } = t1;
598236
598626
  let t2;
598237
- if ($[2] !== title) {
598238
- t2 = title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598239
- dimColor: true,
598240
- children: title
598241
- }) : void 0;
598242
- $[2] = title;
598627
+ if ($[2] !== file_path) {
598628
+ t2 = file_path?.startsWith(".builder/plans/");
598629
+ $[2] = file_path;
598243
598630
  $[3] = t2;
598244
598631
  } else t2 = $[3];
598632
+ const isPlanFile = t2;
598245
598633
  let t3;
598246
- if ($[4] !== t2 || $[5] !== tool) {
598247
- t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolHeader, {
598634
+ if ($[4] !== title) {
598635
+ t3 = title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598636
+ dimColor: true,
598637
+ children: title
598638
+ }) : void 0;
598639
+ $[4] = title;
598640
+ $[5] = t3;
598641
+ } else t3 = $[5];
598642
+ let t4;
598643
+ if ($[6] !== t3 || $[7] !== tool) {
598644
+ t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolHeader, {
598248
598645
  tool,
598249
598646
  label: TOOL_LABELS.Write,
598250
- extra: t2
598647
+ extra: t3
598251
598648
  });
598252
- $[4] = t2;
598253
- $[5] = tool;
598254
598649
  $[6] = t3;
598255
- } else t3 = $[6];
598256
- let t4;
598257
- if ($[7] !== content || $[8] !== file_path || $[9] !== tool.state) {
598258
- t4 = tool.state === "success" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodePreview, {
598650
+ $[7] = tool;
598651
+ $[8] = t4;
598652
+ } else t4 = $[8];
598653
+ let t5;
598654
+ if ($[9] !== content || $[10] !== file_path || $[11] !== isPlanFile || $[12] !== tool.state) {
598655
+ t5 = tool.state === "success" && !isPlanFile && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodePreview, {
598259
598656
  code: content ?? "",
598260
598657
  filePath: file_path,
598261
598658
  paddingLeft: 2,
598262
- highlight: true
598659
+ highlight: true,
598660
+ maxLines: WRITE_PREVIEW_MAX_LINES
598263
598661
  });
598264
- $[7] = content;
598265
- $[8] = file_path;
598266
- $[9] = tool.state;
598267
- $[10] = t4;
598268
- } else t4 = $[10];
598269
- let t5;
598270
- if ($[11] !== t3 || $[12] !== t4) {
598271
- t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598662
+ $[9] = content;
598663
+ $[10] = file_path;
598664
+ $[11] = isPlanFile;
598665
+ $[12] = tool.state;
598666
+ $[13] = t5;
598667
+ } else t5 = $[13];
598668
+ let t6;
598669
+ if ($[14] !== t4 || $[15] !== t5) {
598670
+ t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598272
598671
  flexDirection: "column",
598273
598672
  paddingX: 1,
598274
- children: [t3, t4]
598673
+ children: [t4, t5]
598275
598674
  });
598276
- $[11] = t3;
598277
- $[12] = t4;
598278
- $[13] = t5;
598279
- } else t5 = $[13];
598280
- return t5;
598675
+ $[14] = t4;
598676
+ $[15] = t5;
598677
+ $[16] = t6;
598678
+ } else t6 = $[16];
598679
+ return t6;
598281
598680
  }
598282
598681
  function CodePreview(t0) {
598283
- const $ = (0, import_compiler_runtime.c)(18);
598284
- const { code, filePath, paddingLeft, highlight } = t0;
598682
+ const $ = (0, import_compiler_runtime.c)(28);
598683
+ const { code, filePath, paddingLeft, highlight, maxLines } = t0;
598285
598684
  const theme = useTheme();
598286
598685
  let t1;
598287
598686
  if ($[0] !== filePath) {
@@ -598299,12 +598698,22 @@ function CodePreview(t0) {
598299
598698
  $[4] = highlight;
598300
598699
  $[5] = t2;
598301
598700
  } else t2 = $[5];
598302
- const highlightedLines = t2;
598303
- const lineNumberWidth = String(highlightedLines.length).length;
598304
- const t3 = theme.inputBackground;
598305
- let t4;
598306
- if ($[6] !== filePath) {
598307
- t4 = filePath && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
598701
+ const allHighlightedLines = t2;
598702
+ const truncated = maxLines != null && allHighlightedLines.length > maxLines;
598703
+ let t3;
598704
+ if ($[6] !== allHighlightedLines || $[7] !== maxLines || $[8] !== truncated) {
598705
+ t3 = truncated ? allHighlightedLines.slice(0, maxLines) : allHighlightedLines;
598706
+ $[6] = allHighlightedLines;
598707
+ $[7] = maxLines;
598708
+ $[8] = truncated;
598709
+ $[9] = t3;
598710
+ } else t3 = $[9];
598711
+ const highlightedLines = t3;
598712
+ const lineNumberWidth = String(allHighlightedLines.length).length;
598713
+ const t4 = theme.inputBackground;
598714
+ let t5;
598715
+ if ($[10] !== filePath) {
598716
+ t5 = filePath && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
598308
598717
  marginBottom: 1,
598309
598718
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598310
598719
  color: "cyan",
@@ -598312,14 +598721,14 @@ function CodePreview(t0) {
598312
598721
  children: fileHyperlink(filePath)
598313
598722
  })
598314
598723
  });
598315
- $[6] = filePath;
598316
- $[7] = t4;
598317
- } else t4 = $[7];
598318
- let t5;
598319
- if ($[8] !== highlightedLines || $[9] !== lineNumberWidth) {
598320
- let t6;
598321
- if ($[11] !== lineNumberWidth) {
598322
- t6 = (line, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, { children: [
598724
+ $[10] = filePath;
598725
+ $[11] = t5;
598726
+ } else t5 = $[11];
598727
+ let t6;
598728
+ if ($[12] !== highlightedLines || $[13] !== lineNumberWidth) {
598729
+ let t7;
598730
+ if ($[15] !== lineNumberWidth) {
598731
+ t7 = (line, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, { children: [
598323
598732
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598324
598733
  dimColor: true,
598325
598734
  children: String(index + 1).padStart(lineNumberWidth, " ")
@@ -598330,36 +598739,58 @@ function CodePreview(t0) {
598330
598739
  }),
598331
598740
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: line || " " })
598332
598741
  ] }, index);
598333
- $[11] = lineNumberWidth;
598334
- $[12] = t6;
598335
- } else t6 = $[12];
598336
- t5 = highlightedLines.map(t6);
598337
- $[8] = highlightedLines;
598338
- $[9] = lineNumberWidth;
598339
- $[10] = t5;
598340
- } else t5 = $[10];
598341
- let t6;
598342
- if ($[13] !== paddingLeft || $[14] !== t4 || $[15] !== t5 || $[16] !== theme.inputBackground) {
598343
- t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598742
+ $[15] = lineNumberWidth;
598743
+ $[16] = t7;
598744
+ } else t7 = $[16];
598745
+ t6 = highlightedLines.map(t7);
598746
+ $[12] = highlightedLines;
598747
+ $[13] = lineNumberWidth;
598748
+ $[14] = t6;
598749
+ } else t6 = $[14];
598750
+ let t7;
598751
+ if ($[17] !== allHighlightedLines.length || $[18] !== lineNumberWidth || $[19] !== maxLines || $[20] !== truncated) {
598752
+ t7 = truncated && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
598753
+ dimColor: true,
598754
+ children: [
598755
+ " ".repeat(lineNumberWidth + 3),
598756
+ "+",
598757
+ allHighlightedLines.length - maxLines,
598758
+ " more lines"
598759
+ ]
598760
+ });
598761
+ $[17] = allHighlightedLines.length;
598762
+ $[18] = lineNumberWidth;
598763
+ $[19] = maxLines;
598764
+ $[20] = truncated;
598765
+ $[21] = t7;
598766
+ } else t7 = $[21];
598767
+ let t8;
598768
+ if ($[22] !== paddingLeft || $[23] !== t5 || $[24] !== t6 || $[25] !== t7 || $[26] !== theme.inputBackground) {
598769
+ t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598344
598770
  flexDirection: "column",
598345
598771
  paddingLeft,
598346
598772
  marginTop: 0,
598347
598773
  paddingX: 1,
598348
598774
  paddingY: 1,
598349
598775
  marginBottom: 1,
598350
- backgroundColor: t3,
598351
- children: [t4, t5]
598776
+ backgroundColor: t4,
598777
+ children: [
598778
+ t5,
598779
+ t6,
598780
+ t7
598781
+ ]
598352
598782
  });
598353
- $[13] = paddingLeft;
598354
- $[14] = t4;
598355
- $[15] = t5;
598356
- $[16] = theme.inputBackground;
598357
- $[17] = t6;
598358
- } else t6 = $[17];
598359
- return t6;
598783
+ $[22] = paddingLeft;
598784
+ $[23] = t5;
598785
+ $[24] = t6;
598786
+ $[25] = t7;
598787
+ $[26] = theme.inputBackground;
598788
+ $[27] = t8;
598789
+ } else t8 = $[27];
598790
+ return t8;
598360
598791
  }
598361
598792
  function ToolCallCompleted(t0) {
598362
- const $ = (0, import_compiler_runtime.c)(24);
598793
+ const $ = (0, import_compiler_runtime.c)(26);
598363
598794
  const { tool } = t0;
598364
598795
  switch (tool.toolName) {
598365
598796
  case "Read": {
@@ -598462,23 +598893,33 @@ function ToolCallCompleted(t0) {
598462
598893
  } else t2 = $[19];
598463
598894
  return t2;
598464
598895
  }
598465
- case "Agent": {
598896
+ case "ExitPlanMode": {
598466
598897
  const t1 = tool;
598467
598898
  let t2;
598468
598899
  if ($[20] !== t1) {
598469
- t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallAgent, { tool: t1 });
598900
+ t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallExitPlanMode, { tool: t1 });
598470
598901
  $[20] = t1;
598471
598902
  $[21] = t2;
598472
598903
  } else t2 = $[21];
598473
598904
  return t2;
598474
598905
  }
598906
+ case "Agent": {
598907
+ const t1 = tool;
598908
+ let t2;
598909
+ if ($[22] !== t1) {
598910
+ t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallAgent, { tool: t1 });
598911
+ $[22] = t1;
598912
+ $[23] = t2;
598913
+ } else t2 = $[23];
598914
+ return t2;
598915
+ }
598475
598916
  default: {
598476
598917
  let t1;
598477
- if ($[22] !== tool) {
598918
+ if ($[24] !== tool) {
598478
598919
  t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallGeneric, { tool });
598479
- $[22] = tool;
598480
- $[23] = t1;
598481
- } else t1 = $[23];
598920
+ $[24] = tool;
598921
+ $[25] = t1;
598922
+ } else t1 = $[25];
598482
598923
  return t1;
598483
598924
  }
598484
598925
  }
@@ -598486,14 +598927,17 @@ function ToolCallCompleted(t0) {
598486
598927
  //#endregion
598487
598928
  //#region src/components/MessageBlockView.tsx
598488
598929
  const MessageBlockView = (0, import_react.memo)((props) => {
598489
- const $ = (0, import_compiler_runtime.c)(19);
598930
+ const $ = (0, import_compiler_runtime.c)(20);
598490
598931
  const message = useSnapshot(props.message);
598491
598932
  const theme = useTheme();
598492
598933
  switch (message.type) {
598493
598934
  case "user": {
598494
598935
  let t0;
598495
598936
  if ($[0] !== message.displayPrompt) {
598496
- t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: message.displayPrompt });
598937
+ t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598938
+ wrap: "wrap",
598939
+ children: message.displayPrompt
598940
+ });
598497
598941
  $[0] = message.displayPrompt;
598498
598942
  $[1] = t0;
598499
598943
  } else t0 = $[1];
@@ -598543,32 +598987,37 @@ const MessageBlockView = (0, import_react.memo)((props) => {
598543
598987
  return t1;
598544
598988
  }
598545
598989
  case "thinking": {
598546
- let t0;
598547
- if ($[12] !== message.content || $[13] !== message.id) {
598548
- t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThinkingBlock, { text: message.content }, message.id);
598990
+ const t0 = message;
598991
+ let t1;
598992
+ if ($[12] !== message.content || $[13] !== message.id || $[14] !== t0.streaming) {
598993
+ t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThinkingBlock, {
598994
+ text: message.content,
598995
+ streaming: t0.streaming
598996
+ }, message.id);
598549
598997
  $[12] = message.content;
598550
598998
  $[13] = message.id;
598551
- $[14] = t0;
598552
- } else t0 = $[14];
598553
- return t0;
598999
+ $[14] = t0.streaming;
599000
+ $[15] = t1;
599001
+ } else t1 = $[15];
599002
+ return t1;
598554
599003
  }
598555
599004
  case "idle": {
598556
599005
  const t0 = message;
598557
599006
  let t1;
598558
- if ($[15] !== message.id || $[16] !== t0) {
599007
+ if ($[16] !== message.id || $[17] !== t0) {
598559
599008
  t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IdleBlock, { message: t0 }, message.id);
598560
- $[15] = message.id;
598561
- $[16] = t0;
598562
- $[17] = t1;
598563
- } else t1 = $[17];
599009
+ $[16] = message.id;
599010
+ $[17] = t0;
599011
+ $[18] = t1;
599012
+ } else t1 = $[18];
598564
599013
  return t1;
598565
599014
  }
598566
599015
  default: {
598567
599016
  let t0;
598568
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
599017
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
598569
599018
  t0 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
598570
- $[18] = t0;
598571
- } else t0 = $[18];
599019
+ $[19] = t0;
599020
+ } else t0 = $[19];
598572
599021
  return t0;
598573
599022
  }
598574
599023
  }
@@ -598587,7 +599036,7 @@ function CompletedTextBlock(t0) {
598587
599036
  t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
598588
599037
  flexDirection: "column",
598589
599038
  paddingX: 2,
598590
- marginBottom: 1,
599039
+ marginY: 1,
598591
599040
  children: t1
598592
599041
  });
598593
599042
  $[2] = t1;
@@ -598595,24 +599044,75 @@ function CompletedTextBlock(t0) {
598595
599044
  } else t2 = $[3];
598596
599045
  return t2;
598597
599046
  }
599047
+ const THINKING_MAX_CHARS = 400;
598598
599048
  function ThinkingBlock(t0) {
598599
- const $ = (0, import_compiler_runtime.c)(2);
598600
- const { text } = t0;
598601
- let t1;
599049
+ const $ = (0, import_compiler_runtime.c)(12);
599050
+ const { text, streaming: t1 } = t0;
599051
+ const streaming = t1 === void 0 ? false : t1;
599052
+ let t2;
598602
599053
  if ($[0] !== text) {
598603
- t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
598604
- flexDirection: "column",
598605
- paddingX: 2,
598606
- marginBottom: 1,
599054
+ t2 = text.length > THINKING_MAX_CHARS ? text.slice(0, THINKING_MAX_CHARS).trimEnd() + "…" : text.trim();
599055
+ $[0] = text;
599056
+ $[1] = t2;
599057
+ } else t2 = $[1];
599058
+ const preview = t2;
599059
+ let t3;
599060
+ if ($[2] !== streaming) {
599061
+ t3 = streaming ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599062
+ bold: true,
599063
+ color: "cyan",
599064
+ children: "●"
599065
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599066
+ dimColor: true,
599067
+ children: "◆"
599068
+ });
599069
+ $[2] = streaming;
599070
+ $[3] = t3;
599071
+ } else t3 = $[3];
599072
+ let t4;
599073
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
599074
+ t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599075
+ bold: true,
599076
+ dimColor: true,
599077
+ children: "Thinking"
599078
+ });
599079
+ $[4] = t4;
599080
+ } else t4 = $[4];
599081
+ let t5;
599082
+ if ($[5] !== t3) {
599083
+ t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
599084
+ gap: 1,
599085
+ children: [t3, t4]
599086
+ });
599087
+ $[5] = t3;
599088
+ $[6] = t5;
599089
+ } else t5 = $[6];
599090
+ let t6;
599091
+ if ($[7] !== preview) {
599092
+ t6 = preview.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
599093
+ paddingLeft: 2,
598607
599094
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598608
599095
  dimColor: true,
598609
- children: text
599096
+ wrap: "wrap",
599097
+ children: preview
598610
599098
  })
598611
599099
  });
598612
- $[0] = text;
598613
- $[1] = t1;
598614
- } else t1 = $[1];
598615
- return t1;
599100
+ $[7] = preview;
599101
+ $[8] = t6;
599102
+ } else t6 = $[8];
599103
+ let t7;
599104
+ if ($[9] !== t5 || $[10] !== t6) {
599105
+ t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
599106
+ flexDirection: "column",
599107
+ paddingX: 1,
599108
+ marginY: 1,
599109
+ children: [t5, t6]
599110
+ });
599111
+ $[9] = t5;
599112
+ $[10] = t6;
599113
+ $[11] = t7;
599114
+ } else t7 = $[11];
599115
+ return t7;
598616
599116
  }
598617
599117
  function formatDuration(ms) {
598618
599118
  if (ms < 1e3) return `${ms}ms`;
@@ -598667,7 +599167,7 @@ function pickVerb(seed) {
598667
599167
  return IDLE_VERBS[hash % IDLE_VERBS.length];
598668
599168
  }
598669
599169
  function IdleBlock(t0) {
598670
- const $ = (0, import_compiler_runtime.c)(20);
599170
+ const $ = (0, import_compiler_runtime.c)(24);
598671
599171
  const { message } = t0;
598672
599172
  let t1;
598673
599173
  if ($[0] !== message.durationMs) {
@@ -598691,73 +599191,79 @@ function IdleBlock(t0) {
598691
599191
  $[5] = t4;
598692
599192
  } else t4 = $[5];
598693
599193
  const credits = t4;
599194
+ const isAbort = message.state === "abort";
599195
+ const isError = message.state === "error";
599196
+ const summaryIcon = isError ? "✗" : isAbort ? "◆" : "✦";
599197
+ const summaryColor = isError ? "red" : isAbort ? "yellow" : "magenta";
599198
+ const summaryText = isError ? `Failed after ${duration}` : isAbort ? `Interrupted after ${duration}` : `${verb} for ${duration}`;
598694
599199
  let t5;
598695
- if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
598696
- t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
598697
- color: "magenta",
598698
- bold: true,
598699
- children: "✦"
598700
- });
598701
- $[6] = t5;
598702
- } else t5 = $[6];
599200
+ if ($[6] !== message.applyResults) {
599201
+ t5 = message.applyResults.map(_temp$2);
599202
+ $[6] = message.applyResults;
599203
+ $[7] = t5;
599204
+ } else t5 = $[7];
598703
599205
  let t6;
598704
- if ($[7] !== duration || $[8] !== verb) {
598705
- t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
599206
+ if ($[8] !== summaryColor || $[9] !== summaryIcon) {
599207
+ t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599208
+ color: summaryColor,
598706
599209
  bold: true,
598707
- children: [
598708
- verb,
598709
- " for ",
598710
- duration
598711
- ]
599210
+ children: summaryIcon
598712
599211
  });
598713
- $[7] = duration;
598714
- $[8] = verb;
598715
- $[9] = t6;
598716
- } else t6 = $[9];
599212
+ $[8] = summaryColor;
599213
+ $[9] = summaryIcon;
599214
+ $[10] = t6;
599215
+ } else t6 = $[10];
598717
599216
  let t7;
598718
- if ($[10] !== credits) {
598719
- t7 = credits && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
599217
+ if ($[11] !== summaryText) {
599218
+ t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599219
+ bold: true,
599220
+ children: summaryText
599221
+ });
599222
+ $[11] = summaryText;
599223
+ $[12] = t7;
599224
+ } else t7 = $[12];
599225
+ let t8;
599226
+ if ($[13] !== credits || $[14] !== isAbort || $[15] !== isError) {
599227
+ t8 = credits && !isAbort && !isError && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
598720
599228
  dimColor: true,
598721
599229
  children: ["· ", credits]
598722
599230
  });
598723
- $[10] = credits;
598724
- $[11] = t7;
598725
- } else t7 = $[11];
598726
- let t8;
598727
- if ($[12] !== t6 || $[13] !== t7) {
598728
- t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
599231
+ $[13] = credits;
599232
+ $[14] = isAbort;
599233
+ $[15] = isError;
599234
+ $[16] = t8;
599235
+ } else t8 = $[16];
599236
+ let t9;
599237
+ if ($[17] !== t6 || $[18] !== t7 || $[19] !== t8) {
599238
+ t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598729
599239
  gap: 1,
599240
+ marginTop: 1,
598730
599241
  children: [
598731
- t5,
598732
599242
  t6,
598733
- t7
599243
+ t7,
599244
+ t8
598734
599245
  ]
598735
599246
  });
598736
- $[12] = t6;
598737
- $[13] = t7;
598738
- $[14] = t8;
598739
- } else t8 = $[14];
598740
- let t9;
598741
- if ($[15] !== message.applyResults) {
598742
- t9 = message.applyResults.map(_temp$1);
598743
- $[15] = message.applyResults;
598744
- $[16] = t9;
598745
- } else t9 = $[16];
599247
+ $[17] = t6;
599248
+ $[18] = t7;
599249
+ $[19] = t8;
599250
+ $[20] = t9;
599251
+ } else t9 = $[20];
598746
599252
  let t10;
598747
- if ($[17] !== t8 || $[18] !== t9) {
599253
+ if ($[21] !== t5 || $[22] !== t9) {
598748
599254
  t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598749
599255
  flexDirection: "column",
598750
599256
  paddingX: 0,
598751
599257
  marginY: 1,
598752
- children: [t8, t9]
599258
+ children: [t5, t9]
598753
599259
  });
598754
- $[17] = t8;
598755
- $[18] = t9;
598756
- $[19] = t10;
598757
- } else t10 = $[19];
599260
+ $[21] = t5;
599261
+ $[22] = t9;
599262
+ $[23] = t10;
599263
+ } else t10 = $[23];
598758
599264
  return t10;
598759
599265
  }
598760
- function _temp$1(result) {
599266
+ function _temp$2(result) {
598761
599267
  const { green, red } = buildDots(result.addedLines, result.removedLines);
598762
599268
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
598763
599269
  flexDirection: "row",
@@ -598934,14 +599440,6 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
598934
599440
  api.abort().catch(() => {});
598935
599441
  return;
598936
599442
  }
598937
- if (key.upArrow) {
598938
- scrollByClamped(-1);
598939
- return;
598940
- }
598941
- if (key.downArrow) {
598942
- scrollByClamped(1);
598943
- return;
598944
- }
598945
599443
  if (key.pageUp) {
598946
599444
  scrollByClamped(-(scrollRef.current?.getViewportHeight() || 10));
598947
599445
  return;
@@ -599032,8 +599530,9 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
599032
599530
  userScrolledUp.current = false;
599033
599531
  scrollRef.current?.scrollToBottom();
599034
599532
  }, [api]);
599035
- const startIndex = Math.max(0, state.messages.length - 200);
599036
- const visibleMessages = state.messages.slice(startIndex);
599533
+ const MAX_VISIBLE_MESSAGES = 200;
599534
+ const messageCount = state.messages.length;
599535
+ const startIndex = Math.max(0, messageCount - MAX_VISIBLE_MESSAGES);
599037
599536
  const hiddenCount = startIndex;
599038
599537
  const showInput = !!!state.activeUserQuestions;
599039
599538
  if (!isTabActive) return null;
@@ -599079,30 +599578,58 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
599079
599578
  ref: scrollRef,
599080
599579
  flexGrow: 1,
599081
599580
  flexDirection: "column",
599082
- children: [hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
599083
- paddingX: 2,
599084
- paddingY: 1,
599085
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
599086
- dimColor: true,
599087
- children: [
599088
- "─── ",
599089
- hiddenCount,
599090
- " older message",
599091
- hiddenCount === 1 ? "" : "s",
599092
- " not shown ───"
599093
- ]
599094
- })
599095
- }), visibleMessages.map((msg, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
599096
- fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
599581
+ children: [
599582
+ messageCount === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
599097
599583
  paddingX: 2,
599584
+ paddingY: 1,
599098
599585
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599099
- color: "red",
599100
599586
  dimColor: true,
599101
- children: "[failed to render message]"
599587
+ children: "No messages yet. Type a prompt below to get started."
599102
599588
  })
599103
599589
  }),
599104
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageBlockView, { message: proxy.messages[startIndex + i] }, `msg-${msg.id}-${startIndex + i}`)
599105
- }, `err-${msg.id}-${startIndex + i}`))]
599590
+ hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
599591
+ paddingX: 2,
599592
+ paddingY: 1,
599593
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
599594
+ dimColor: true,
599595
+ children: [
599596
+ "─── ",
599597
+ hiddenCount,
599598
+ " older message",
599599
+ hiddenCount === 1 ? "" : "s",
599600
+ " not shown ───"
599601
+ ]
599602
+ })
599603
+ }),
599604
+ Array.from({ length: messageCount - startIndex }, (_, i) => {
599605
+ const idx = startIndex + i;
599606
+ const msgProxy = proxy.messages[idx];
599607
+ const msgId = msgProxy.id;
599608
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
599609
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
599610
+ paddingX: 2,
599611
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599612
+ color: "red",
599613
+ dimColor: true,
599614
+ children: "[failed to render message]"
599615
+ })
599616
+ }),
599617
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageBlockView, { message: msgProxy }, `msg-${msgId}-${idx}`)
599618
+ }, `err-${msgId}-${idx}`);
599619
+ }),
599620
+ state.state === "generating" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
599621
+ gap: 1,
599622
+ marginTop: 2,
599623
+ marginBottom: 1,
599624
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressBar, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
599625
+ dimColor: true,
599626
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599627
+ bold: true,
599628
+ children: "esc"
599629
+ }), " interrupt"]
599630
+ })]
599631
+ }, "generating-progress-bar")
599632
+ ]
599106
599633
  })
599107
599634
  })
599108
599635
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
@@ -599288,7 +599815,6 @@ function useClawSession(credentials, onNewMessages) {
599288
599815
  }
599289
599816
  //#endregion
599290
599817
  //#region src/components/ClawSession.tsx
599291
- const MOUSE_RE = /^\[<(\d+);\d+;\d+[Mm]/;
599292
599818
  const SIDEBAR_WIDTH = 55;
599293
599819
  function formatMessageTime(ts) {
599294
599820
  const diffMs = Date.now() - ts;
@@ -599440,259 +599966,424 @@ const ClawSidebar = (0, import_react.memo)(() => {
599440
599966
  } else t2 = $[5];
599441
599967
  return t2;
599442
599968
  });
599443
- const ClawSession = (0, import_react.memo)(({ credentials, isActive, onNewMessages, onExit }) => {
599969
+ const ClawSession = (0, import_react.memo)((t0) => {
599970
+ const $ = (0, import_compiler_runtime.c)(60);
599971
+ const { credentials, isActive, onNewMessages, onExit } = t0;
599444
599972
  const { stdout } = useStdout();
599445
599973
  const [cols, setCols] = (0, import_react.useState)(stdout?.columns ?? 80);
599446
599974
  const [rows, setRows] = (0, import_react.useState)(stdout?.rows ?? 24);
599447
599975
  const theme = useTheme();
599448
- const [inputValue, setInputValue] = (0, import_react.useState)("");
599449
599976
  const [ctrlCPending, setCtrlCPending] = (0, import_react.useState)(false);
599450
599977
  const ctrlCTimer = (0, import_react.useRef)(null);
599451
599978
  const scrollRef = (0, import_react.useRef)(null);
599452
599979
  const userScrolledUp = (0, import_react.useRef)(false);
599453
- const scrollByClamped = (0, import_react.useCallback)((delta) => {
599454
- const scrollView = scrollRef.current;
599455
- if (!scrollView) return;
599456
- const currentOffset = scrollView.getScrollOffset();
599457
- const bottomOffset = Math.max(0, scrollView.getBottomOffset());
599458
- const nextOffset = Math.max(0, Math.min(bottomOffset, currentOffset + delta));
599459
- userScrolledUp.current = nextOffset < bottomOffset;
599460
- scrollView.scrollTo(nextOffset);
599461
- }, []);
599980
+ let t1;
599981
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
599982
+ t1 = (delta) => {
599983
+ const scrollView = scrollRef.current;
599984
+ if (!scrollView) return;
599985
+ const currentOffset = scrollView.getScrollOffset();
599986
+ const bottomOffset = Math.max(0, scrollView.getBottomOffset());
599987
+ const nextOffset = Math.max(0, Math.min(bottomOffset, currentOffset + delta));
599988
+ userScrolledUp.current = nextOffset < bottomOffset;
599989
+ scrollView.scrollTo(nextOffset);
599990
+ };
599991
+ $[0] = t1;
599992
+ } else t1 = $[0];
599993
+ const scrollByClamped = t1;
599462
599994
  const { messages, isSending, isWaitingForReply, error, sendMessage } = useClawSession(credentials, onNewMessages);
599463
- (0, import_react.useEffect)(() => {
599464
- if (!isActive) return;
599465
- userScrolledUp.current = false;
599466
- setTimeout(() => {
599467
- scrollRef.current?.remeasure();
599468
- scrollRef.current?.scrollToBottom();
599469
- }, 0);
599470
- }, [messages.length, isWaitingForReply]);
599471
- (0, import_react.useEffect)(() => {
599472
- if (isActive) {
599995
+ let t2;
599996
+ if ($[1] !== isActive) {
599997
+ t2 = () => {
599998
+ if (!isActive) return;
599473
599999
  userScrolledUp.current = false;
599474
600000
  setTimeout(() => {
599475
600001
  scrollRef.current?.remeasure();
599476
600002
  scrollRef.current?.scrollToBottom();
599477
600003
  }, 0);
599478
- }
599479
- }, [isActive]);
599480
- (0, import_react.useEffect)(() => {
599481
- return () => {
599482
- if (ctrlCTimer.current) clearTimeout(ctrlCTimer.current);
599483
600004
  };
599484
- }, []);
599485
- (0, import_react.useEffect)(() => {
599486
- const handleResize = () => {
599487
- scrollRef.current?.remeasure();
599488
- setCols(stdout?.columns ?? 80);
599489
- setRows(stdout?.rows ?? 24);
600005
+ $[1] = isActive;
600006
+ $[2] = t2;
600007
+ } else t2 = $[2];
600008
+ let t3;
600009
+ if ($[3] !== isWaitingForReply || $[4] !== messages.length) {
600010
+ t3 = [messages.length, isWaitingForReply];
600011
+ $[3] = isWaitingForReply;
600012
+ $[4] = messages.length;
600013
+ $[5] = t3;
600014
+ } else t3 = $[5];
600015
+ (0, import_react.useEffect)(t2, t3);
600016
+ let t4;
600017
+ let t5;
600018
+ if ($[6] !== isActive) {
600019
+ t4 = () => {
600020
+ if (isActive) {
600021
+ userScrolledUp.current = false;
600022
+ setTimeout(() => {
600023
+ scrollRef.current?.remeasure();
600024
+ scrollRef.current?.scrollToBottom();
600025
+ }, 0);
600026
+ }
599490
600027
  };
599491
- stdout?.on("resize", handleResize);
599492
- return () => {
599493
- stdout?.off("resize", handleResize);
600028
+ t5 = [isActive];
600029
+ $[6] = isActive;
600030
+ $[7] = t4;
600031
+ $[8] = t5;
600032
+ } else {
600033
+ t4 = $[7];
600034
+ t5 = $[8];
600035
+ }
600036
+ (0, import_react.useEffect)(t4, t5);
600037
+ let t6;
600038
+ let t7;
600039
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
600040
+ t6 = () => () => {
600041
+ if (ctrlCTimer.current) clearTimeout(ctrlCTimer.current);
599494
600042
  };
599495
- }, [stdout]);
600043
+ t7 = [];
600044
+ $[9] = t6;
600045
+ $[10] = t7;
600046
+ } else {
600047
+ t6 = $[9];
600048
+ t7 = $[10];
600049
+ }
600050
+ (0, import_react.useEffect)(t6, t7);
600051
+ let t8;
600052
+ let t9;
600053
+ if ($[11] !== stdout) {
600054
+ t8 = () => {
600055
+ const handleResize = () => {
600056
+ scrollRef.current?.remeasure();
600057
+ setCols(stdout?.columns ?? 80);
600058
+ setRows(stdout?.rows ?? 24);
600059
+ };
600060
+ stdout?.on("resize", handleResize);
600061
+ return () => {
600062
+ stdout?.off("resize", handleResize);
600063
+ };
600064
+ };
600065
+ t9 = [stdout];
600066
+ $[11] = stdout;
600067
+ $[12] = t8;
600068
+ $[13] = t9;
600069
+ } else {
600070
+ t8 = $[12];
600071
+ t9 = $[13];
600072
+ }
600073
+ (0, import_react.useEffect)(t8, t9);
599496
600074
  const showSidebar = cols >= 100 && rows >= 24;
599497
- const handleSubmit = (0, import_react.useCallback)(async (val) => {
599498
- if (!val.trim() || isSending) return;
599499
- setInputValue("");
599500
- await sendMessage(val.trim());
599501
- userScrolledUp.current = false;
599502
- scrollRef.current?.scrollToBottom();
599503
- }, [isSending, sendMessage]);
599504
- useInput((input, key) => {
599505
- if (input === "c" && key.ctrl) {
599506
- if (ctrlCPending) {
599507
- if (ctrlCTimer.current) clearTimeout(ctrlCTimer.current);
599508
- onExit?.();
599509
- } else {
599510
- setCtrlCPending(true);
599511
- ctrlCTimer.current = setTimeout(() => {
599512
- setCtrlCPending(false);
599513
- ctrlCTimer.current = null;
599514
- }, 1e3);
600075
+ let t10;
600076
+ if ($[14] !== sendMessage) {
600077
+ t10 = async (val) => {
600078
+ if (!val.trim()) return;
600079
+ await sendMessage(val.trim());
600080
+ userScrolledUp.current = false;
600081
+ scrollRef.current?.scrollToBottom();
600082
+ };
600083
+ $[14] = sendMessage;
600084
+ $[15] = t10;
600085
+ } else t10 = $[15];
600086
+ const handleSubmit = t10;
600087
+ let t11;
600088
+ if ($[16] !== ctrlCPending || $[17] !== onExit) {
600089
+ t11 = (input, key) => {
600090
+ if (input === "c" && key.ctrl) {
600091
+ if (ctrlCPending) {
600092
+ if (ctrlCTimer.current) clearTimeout(ctrlCTimer.current);
600093
+ onExit?.();
600094
+ } else {
600095
+ setCtrlCPending(true);
600096
+ ctrlCTimer.current = setTimeout(() => {
600097
+ setCtrlCPending(false);
600098
+ ctrlCTimer.current = null;
600099
+ }, 1e3);
600100
+ }
600101
+ return;
599515
600102
  }
599516
- return;
599517
- }
599518
- if (key.upArrow) {
599519
- scrollByClamped(-1);
599520
- return;
599521
- }
599522
- if (key.downArrow) {
599523
- scrollByClamped(1);
599524
- return;
599525
- }
599526
- if (key.pageUp) {
599527
- scrollByClamped(-(scrollRef.current?.getViewportHeight() || 10));
599528
- return;
599529
- }
599530
- if (key.pageDown) {
599531
- scrollByClamped(scrollRef.current?.getViewportHeight() || 10);
599532
- return;
599533
- }
599534
- }, { isActive });
599535
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
599536
- flexDirection: "row",
599537
- flexGrow: 1,
599538
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
600103
+ if (key.upArrow) {
600104
+ scrollByClamped(-1);
600105
+ return;
600106
+ }
600107
+ if (key.downArrow) {
600108
+ scrollByClamped(1);
600109
+ return;
600110
+ }
600111
+ if (key.pageUp) {
600112
+ scrollByClamped(-(scrollRef.current?.getViewportHeight() || 10));
600113
+ return;
600114
+ }
600115
+ if (key.pageDown) {
600116
+ scrollByClamped(scrollRef.current?.getViewportHeight() || 10);
600117
+ return;
600118
+ }
600119
+ };
600120
+ $[16] = ctrlCPending;
600121
+ $[17] = onExit;
600122
+ $[18] = t11;
600123
+ } else t11 = $[18];
600124
+ let t12;
600125
+ if ($[19] !== isActive) {
600126
+ t12 = { isActive };
600127
+ $[19] = isActive;
600128
+ $[20] = t12;
600129
+ } else t12 = $[20];
600130
+ useInput(t11, t12);
600131
+ let t13;
600132
+ if ($[21] !== messages) {
600133
+ t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
599539
600134
  flexDirection: "column",
599540
600135
  flexGrow: 1,
599541
- paddingRight: 2,
599542
- children: [
599543
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
599544
- flexDirection: "column",
599545
- flexGrow: 1,
599546
- flexBasis: 0,
599547
- overflow: "hidden",
599548
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollView, {
599549
- ref: scrollRef,
599550
- flexGrow: 1,
599551
- flexDirection: "column",
599552
- children: messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
599553
- paddingX: 2,
599554
- paddingY: 1,
599555
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599556
- dimColor: true,
599557
- children: "No messages yet. Send a message to start a conversation with Claw."
599558
- })
599559
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: (() => {
599560
- const startIndex = Math.max(0, messages.length - 100);
599561
- const visibleMessages = messages.slice(startIndex);
599562
- const hiddenCount = startIndex;
599563
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
599564
- paddingX: 2,
599565
- paddingY: 1,
599566
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
599567
- dimColor: true,
599568
- children: [
599569
- "─── ",
599570
- hiddenCount,
599571
- " older message",
599572
- hiddenCount === 1 ? "" : "s",
599573
- " not shown ───"
599574
- ]
599575
- })
599576
- }), visibleMessages.map((msg) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
599577
- fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
599578
- paddingX: 2,
599579
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599580
- color: "red",
599581
- dimColor: true,
599582
- children: "[failed to render message]"
599583
- })
599584
- }),
599585
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClawMessageView, { message: msg })
599586
- }, msg.id))] });
599587
- })() })
599588
- })
599589
- }),
599590
- isWaitingForReply && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
599591
- paddingX: 2,
599592
- paddingY: 0,
599593
- gap: 1,
599594
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599595
- dimColor: true,
599596
- children: "Claw is thinking"
599597
- })]
599598
- }),
599599
- error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
600136
+ flexBasis: 0,
600137
+ overflow: "hidden",
600138
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollView, {
600139
+ ref: scrollRef,
600140
+ flexGrow: 1,
600141
+ flexDirection: "column",
600142
+ children: messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
599600
600143
  paddingX: 2,
599601
- marginBottom: 1,
600144
+ paddingY: 1,
599602
600145
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599603
- color: "red",
599604
- children: error
599605
- })
599606
- }),
599607
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
599608
- fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599609
- color: "red",
599610
600146
  dimColor: true,
599611
- children: "Input unavailable · Ctrl+C to exit"
599612
- }),
599613
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
599614
- flexDirection: "column",
599615
- marginY: 1,
599616
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
599617
- borderStyle: "bold",
599618
- borderColor: "blue",
599619
- borderLeft: true,
599620
- borderRight: false,
599621
- borderTop: false,
599622
- borderBottom: false,
599623
- flexDirection: "column",
599624
- paddingLeft: 2,
599625
- paddingRight: 2,
599626
- paddingY: 1,
599627
- marginBottom: 1,
599628
- backgroundColor: theme.panelBackground,
599629
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(MultilineInput, {
599630
- value: inputValue,
599631
- onChange: setInputValue,
599632
- onSubmit: handleSubmit,
599633
- rows: 1,
599634
- maxRows: 10,
599635
- keyBindings: {
599636
- submit: (key_0) => key_0.return && !key_0.ctrl,
599637
- newline: (key_1) => key_1.return && key_1.ctrl
599638
- },
599639
- useCustomInput: (handler, active) => {
599640
- useInput((input_0, key_2) => {
599641
- const match = input_0.match(MOUSE_RE);
599642
- if (match) {
599643
- const button = parseInt(match[1], 10);
599644
- if (button === 64) scrollByClamped(-1);
599645
- else if (button === 65) scrollByClamped(1);
599646
- return;
599647
- }
599648
- if (input_0.includes("[<") && /\d+;\d+;\d+[Mm]/.test(input_0)) return;
599649
- if (key_2.tab && key_2.shift) return;
599650
- handler(input_0, key_2);
599651
- }, { isActive: active && isActive });
599652
- }
599653
- }), !inputValue && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599654
- dimColor: true,
599655
- children: "Message Claw..."
599656
- })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599657
- color: "blue",
599658
- bold: true,
599659
- children: isSending ? "Sending" : "Claw"
599660
- }) })]
599661
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
599662
- justifyContent: "space-between",
599663
- paddingY: 0,
599664
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
599665
- gap: 1,
599666
- children: ctrlCPending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599667
- color: "yellow",
599668
- children: "Press Ctrl+C again to exit"
599669
- }) : isSending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599670
- dimColor: true,
599671
- children: "waiting for response..."
599672
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: " " })
599673
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
599674
- gap: 3,
599675
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
599676
- dimColor: true,
599677
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599678
- bold: true,
599679
- children: "ctrl+enter"
599680
- }), " newline"]
599681
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
599682
- dimColor: true,
599683
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
599684
- bold: true,
599685
- children: "enter"
599686
- }), " send"]
599687
- })]
599688
- })]
599689
- })]
600147
+ children: "No messages yet. Send a message to start a conversation with Claw."
599690
600148
  })
599691
- })
600149
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: (() => {
600150
+ const startIndex = Math.max(0, messages.length - 100);
600151
+ const visibleMessages = messages.slice(startIndex);
600152
+ const hiddenCount = startIndex;
600153
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
600154
+ paddingX: 2,
600155
+ paddingY: 1,
600156
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
600157
+ dimColor: true,
600158
+ children: [
600159
+ "─── ",
600160
+ hiddenCount,
600161
+ " older message",
600162
+ hiddenCount === 1 ? "" : "s",
600163
+ " not shown ───"
600164
+ ]
600165
+ })
600166
+ }), visibleMessages.map(_temp$1)] });
600167
+ })() })
600168
+ })
600169
+ });
600170
+ $[21] = messages;
600171
+ $[22] = t13;
600172
+ } else t13 = $[22];
600173
+ let t14;
600174
+ if ($[23] !== isWaitingForReply) {
600175
+ t14 = isWaitingForReply && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
600176
+ paddingX: 2,
600177
+ paddingY: 0,
600178
+ gap: 1,
600179
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
600180
+ dimColor: true,
600181
+ children: "Claw is thinking"
600182
+ })]
600183
+ });
600184
+ $[23] = isWaitingForReply;
600185
+ $[24] = t14;
600186
+ } else t14 = $[24];
600187
+ let t15;
600188
+ if ($[25] !== error) {
600189
+ t15 = error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
600190
+ paddingX: 2,
600191
+ marginBottom: 1,
600192
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
600193
+ color: "red",
600194
+ children: error
600195
+ })
600196
+ });
600197
+ $[25] = error;
600198
+ $[26] = t15;
600199
+ } else t15 = $[26];
600200
+ let t16;
600201
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
600202
+ t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
600203
+ color: "red",
600204
+ dimColor: true,
600205
+ children: "Input unavailable · Ctrl+C to exit"
600206
+ });
600207
+ $[27] = t16;
600208
+ } else t16 = $[27];
600209
+ let t17;
600210
+ let t18;
600211
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
600212
+ t17 = () => scrollByClamped(-1);
600213
+ t18 = () => scrollByClamped(1);
600214
+ $[28] = t17;
600215
+ $[29] = t18;
600216
+ } else {
600217
+ t17 = $[28];
600218
+ t18 = $[29];
600219
+ }
600220
+ let t19;
600221
+ if ($[30] !== handleSubmit || $[31] !== isActive || $[32] !== isSending) {
600222
+ t19 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextInput, {
600223
+ placeholder: "Message Claw...",
600224
+ rows: 1,
600225
+ maxRows: 10,
600226
+ onSubmit: handleSubmit,
600227
+ onScrollUp: t17,
600228
+ onScrollDown: t18,
600229
+ isActive,
600230
+ submitDisabled: isSending,
600231
+ disableHistory: true
600232
+ }) });
600233
+ $[30] = handleSubmit;
600234
+ $[31] = isActive;
600235
+ $[32] = isSending;
600236
+ $[33] = t19;
600237
+ } else t19 = $[33];
600238
+ const t20 = isSending ? "Sending" : "Claw";
600239
+ let t21;
600240
+ if ($[34] !== t20) {
600241
+ t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
600242
+ color: "blue",
600243
+ bold: true,
600244
+ children: t20
600245
+ }) });
600246
+ $[34] = t20;
600247
+ $[35] = t21;
600248
+ } else t21 = $[35];
600249
+ let t22;
600250
+ if ($[36] !== t19 || $[37] !== t21 || $[38] !== theme.panelBackground) {
600251
+ t22 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
600252
+ borderStyle: "bold",
600253
+ borderColor: "blue",
600254
+ borderLeft: true,
600255
+ borderRight: false,
600256
+ borderTop: false,
600257
+ borderBottom: false,
600258
+ flexDirection: "column",
600259
+ paddingLeft: 2,
600260
+ paddingRight: 2,
600261
+ paddingY: 1,
600262
+ marginBottom: 1,
600263
+ backgroundColor: theme.panelBackground,
600264
+ children: [t19, t21]
600265
+ });
600266
+ $[36] = t19;
600267
+ $[37] = t21;
600268
+ $[38] = theme.panelBackground;
600269
+ $[39] = t22;
600270
+ } else t22 = $[39];
600271
+ let t23;
600272
+ if ($[40] !== ctrlCPending || $[41] !== isSending) {
600273
+ t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
600274
+ gap: 1,
600275
+ children: ctrlCPending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
600276
+ color: "yellow",
600277
+ children: "Press Ctrl+C again to exit"
600278
+ }) : isSending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
600279
+ dimColor: true,
600280
+ children: "waiting for response..."
600281
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: " " })
600282
+ });
600283
+ $[40] = ctrlCPending;
600284
+ $[41] = isSending;
600285
+ $[42] = t23;
600286
+ } else t23 = $[42];
600287
+ let t24;
600288
+ if ($[43] === Symbol.for("react.memo_cache_sentinel")) {
600289
+ t24 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
600290
+ dimColor: true,
600291
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
600292
+ bold: true,
600293
+ children: "ctrl+enter"
600294
+ }), " newline"]
600295
+ });
600296
+ $[43] = t24;
600297
+ } else t24 = $[43];
600298
+ let t25;
600299
+ if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
600300
+ t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
600301
+ gap: 3,
600302
+ children: [t24, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
600303
+ dimColor: true,
600304
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
600305
+ bold: true,
600306
+ children: "enter"
600307
+ }), " send"]
600308
+ })]
600309
+ });
600310
+ $[44] = t25;
600311
+ } else t25 = $[44];
600312
+ let t26;
600313
+ if ($[45] !== t23) {
600314
+ t26 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
600315
+ justifyContent: "space-between",
600316
+ paddingY: 0,
600317
+ children: [t23, t25]
600318
+ });
600319
+ $[45] = t23;
600320
+ $[46] = t26;
600321
+ } else t26 = $[46];
600322
+ let t27;
600323
+ if ($[47] !== t22 || $[48] !== t26) {
600324
+ t27 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
600325
+ fallback: t16,
600326
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
600327
+ flexDirection: "column",
600328
+ marginY: 1,
600329
+ children: [t22, t26]
600330
+ })
600331
+ });
600332
+ $[47] = t22;
600333
+ $[48] = t26;
600334
+ $[49] = t27;
600335
+ } else t27 = $[49];
600336
+ let t28;
600337
+ if ($[50] !== t13 || $[51] !== t14 || $[52] !== t15 || $[53] !== t27) {
600338
+ t28 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
600339
+ flexDirection: "column",
600340
+ flexGrow: 1,
600341
+ paddingRight: 2,
600342
+ children: [
600343
+ t13,
600344
+ t14,
600345
+ t15,
600346
+ t27
599692
600347
  ]
599693
- }), showSidebar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClawSidebar, {})]
599694
- });
600348
+ });
600349
+ $[50] = t13;
600350
+ $[51] = t14;
600351
+ $[52] = t15;
600352
+ $[53] = t27;
600353
+ $[54] = t28;
600354
+ } else t28 = $[54];
600355
+ let t29;
600356
+ if ($[55] !== showSidebar) {
600357
+ t29 = showSidebar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClawSidebar, {});
600358
+ $[55] = showSidebar;
600359
+ $[56] = t29;
600360
+ } else t29 = $[56];
600361
+ let t30;
600362
+ if ($[57] !== t28 || $[58] !== t29) {
600363
+ t30 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
600364
+ flexDirection: "row",
600365
+ flexGrow: 1,
600366
+ children: [t28, t29]
600367
+ });
600368
+ $[57] = t28;
600369
+ $[58] = t29;
600370
+ $[59] = t30;
600371
+ } else t30 = $[59];
600372
+ return t30;
599695
600373
  });
600374
+ function _temp$1(msg) {
600375
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
600376
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
600377
+ paddingX: 2,
600378
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
600379
+ color: "red",
600380
+ dimColor: true,
600381
+ children: "[failed to render message]"
600382
+ })
600383
+ }),
600384
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClawMessageView, { message: msg })
600385
+ }, msg.id);
600386
+ }
599696
600387
  //#endregion
599697
600388
  //#region src/components/CodeCommand.tsx
599698
600389
  const TabBar = (0, import_react.memo)((t0) => {
@@ -600081,7 +600772,7 @@ function initSentry() {
600081
600772
  init({
600082
600773
  dsn: "https://1c5033d697e0271ebe53773bff826de0@o117565.ingest.us.sentry.io/4511107776905216",
600083
600774
  tracesSampleRate: 0,
600084
- release: "0.3.4",
600775
+ release: "0.3.6",
600085
600776
  environment: process.env.NODE_ENV ?? "development",
600086
600777
  enabled: false,
600087
600778
  registerEsmLoaderHooks: false,
@@ -600105,7 +600796,7 @@ function isStandaloneBinary() {
600105
600796
  return !path$6.basename(process.execPath, ".exe").startsWith("node");
600106
600797
  }
600107
600798
  function getCurrentVersion() {
600108
- return "0.3.4";
600799
+ return "0.3.6";
600109
600800
  }
600110
600801
  async function fetchLatestVersion() {
600111
600802
  return new Promise((resolve, reject) => {
@@ -600211,6 +600902,13 @@ async function selfUpdate(onProgress) {
600211
600902
  if (!fs$20.existsSync(extractedBinary)) throw new Error(`Binary not found in tarball at ${extractedBinary}`);
600212
600903
  fs$20.chmodSync(extractedBinary, 493);
600213
600904
  atomicReplace(extractedBinary, process.execPath);
600905
+ const rgName = process.platform === "win32" ? "rg.exe" : "rg";
600906
+ const extractedRg = path$6.join(tmpDir, "package", rgName);
600907
+ if (fs$20.existsSync(extractedRg)) {
600908
+ const destRg = path$6.join(path$6.dirname(process.execPath), rgName);
600909
+ fs$20.chmodSync(extractedRg, 493);
600910
+ atomicReplace(extractedRg, destRg);
600911
+ }
600214
600912
  writeUpdateCheck({
600215
600913
  checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
600216
600914
  latestVersion
@@ -600281,7 +600979,7 @@ async function downloadFile(url, dest) {
600281
600979
  }
600282
600980
  //#endregion
600283
600981
  //#region src/cli.tsx
600284
- const VERSION = "0.3.4";
600982
+ const VERSION = "0.3.6";
600285
600983
  async function startInk(command, options) {
600286
600984
  await render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
600287
600985
  command,
@@ -600294,8 +600992,9 @@ async function startInk(command, options) {
600294
600992
  }), {
600295
600993
  exitOnCtrlC: false,
600296
600994
  incrementalRendering: true,
600297
- maxFps: 15,
600298
- patchConsole: true
600995
+ maxFps: 30,
600996
+ patchConsole: true,
600997
+ concurrent: true
600299
600998
  }).waitUntilExit();
600300
600999
  await flush(2e3);
600301
601000
  }