@builder.io/buildercode 0.4.1 → 0.4.3

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 +1049 -601
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -24577,6 +24577,14 @@ const setTextNodeValue = (node, text) => {
24577
24577
  node.nodeValue = text;
24578
24578
  markNodeAsDirty(node);
24579
24579
  };
24580
+ const addLayoutListener = (rootNode, listener) => {
24581
+ if (rootNode.nodeName !== "ink-root") return () => {};
24582
+ rootNode.internal_layoutListeners ??= /* @__PURE__ */ new Set();
24583
+ rootNode.internal_layoutListeners.add(listener);
24584
+ return () => {
24585
+ rootNode.internal_layoutListeners?.delete(listener);
24586
+ };
24587
+ };
24580
24588
  const emitLayoutListeners = (rootNode) => {
24581
24589
  if (rootNode.nodeName !== "ink-root" || !rootNode.internal_layoutListeners) return;
24582
24590
  for (const listener of rootNode.internal_layoutListeners) listener();
@@ -46020,6 +46028,73 @@ const useWindowSize = () => {
46020
46028
  return size;
46021
46029
  };
46022
46030
  //#endregion
46031
+ //#region ../../node_modules/ink/build/hooks/use-box-metrics.js
46032
+ const emptyMetrics = {
46033
+ width: 0,
46034
+ height: 0,
46035
+ left: 0,
46036
+ top: 0
46037
+ };
46038
+ const findRootNode = (node) => {
46039
+ if (!node) return;
46040
+ if (!node.parentNode) return node.nodeName === "ink-root" ? node : void 0;
46041
+ return findRootNode(node.parentNode);
46042
+ };
46043
+ /**
46044
+ A React hook that returns the current layout metrics for a tracked box element.
46045
+ It updates when layout changes (for example terminal resize, sibling/content changes, or position changes).
46046
+
46047
+ The hook returns `{width: 0, height: 0, left: 0, top: 0}` until the first layout pass completes. It also returns zeros when the tracked ref is detached.
46048
+
46049
+ Use `hasMeasured` to detect when the currently tracked element has been measured.
46050
+
46051
+ @example
46052
+ ```tsx
46053
+ import {useRef} from 'react';
46054
+ import {Box, Text, useBoxMetrics} from 'ink';
46055
+
46056
+ const Example = () => {
46057
+ const ref = useRef(null);
46058
+ const {width, height, left, top, hasMeasured} = useBoxMetrics(ref);
46059
+ return (
46060
+ <Box ref={ref}>
46061
+ <Text>
46062
+ {hasMeasured ? `${width}x${height} at ${left},${top}` : 'Measuring...'}
46063
+ </Text>
46064
+ </Box>
46065
+ );
46066
+ };
46067
+ ```
46068
+ */
46069
+ const useBoxMetrics = (ref) => {
46070
+ const [metrics, setMetrics] = (0, import_react.useState)(emptyMetrics);
46071
+ const [hasMeasured, setHasMeasured] = (0, import_react.useState)(false);
46072
+ const { stdout } = useStdout();
46073
+ const updateMetrics = (0, import_react.useCallback)(() => {
46074
+ const layout = ref.current?.yogaNode?.getComputedLayout() ?? emptyMetrics;
46075
+ setMetrics((previousMetrics) => {
46076
+ return previousMetrics.width !== layout.width || previousMetrics.height !== layout.height || previousMetrics.left !== layout.left || previousMetrics.top !== layout.top ? layout : previousMetrics;
46077
+ });
46078
+ setHasMeasured(Boolean(ref.current));
46079
+ }, [ref]);
46080
+ (0, import_react.useEffect)(updateMetrics);
46081
+ (0, import_react.useEffect)(() => {
46082
+ const rootNode = findRootNode(ref.current);
46083
+ if (!rootNode) return;
46084
+ return addLayoutListener(rootNode, updateMetrics);
46085
+ });
46086
+ (0, import_react.useEffect)(() => {
46087
+ stdout.on("resize", updateMetrics);
46088
+ return () => {
46089
+ stdout.off("resize", updateMetrics);
46090
+ };
46091
+ }, [stdout, updateMetrics]);
46092
+ return (0, import_react.useMemo)(() => ({
46093
+ ...metrics,
46094
+ hasMeasured
46095
+ }), [metrics, hasMeasured]);
46096
+ };
46097
+ //#endregion
46023
46098
  //#region ../../node_modules/ink/build/measure-element.js
46024
46099
  /**
46025
46100
  Measure the dimensions of a particular `<Box>` element.
@@ -91994,7 +92069,27 @@ const defaultDarkTheme = {
91994
92069
  statusBarBackground: "#181818",
91995
92070
  headerBackground: "#181818",
91996
92071
  panelBackground: "#2A2A2A",
91997
- highlightBackground: "#3A3A3A"
92072
+ highlightBackground: "#000000",
92073
+ highlight: "#ffffff"
92074
+ };
92075
+ const defaultTransparentTheme = {
92076
+ background: "",
92077
+ foreground: "",
92078
+ dimForeground: "gray",
92079
+ accent: "cyan",
92080
+ accentForeground: "black",
92081
+ success: "green",
92082
+ error: "red",
92083
+ warning: "yellow",
92084
+ info: "cyan",
92085
+ border: "gray",
92086
+ inputBackground: "",
92087
+ inputBorder: "gray",
92088
+ statusBarBackground: "",
92089
+ headerBackground: "",
92090
+ panelBackground: "",
92091
+ highlightBackground: "#000000",
92092
+ highlight: "#ffffff"
91998
92093
  };
91999
92094
  const defaultLightTheme = {
92000
92095
  background: "#FFFFFF",
@@ -92012,7 +92107,8 @@ const defaultLightTheme = {
92012
92107
  statusBarBackground: "#F6F8FA",
92013
92108
  headerBackground: "#F6F8FA",
92014
92109
  panelBackground: "#F0F2F5",
92015
- highlightBackground: "#D6EBFF"
92110
+ highlightBackground: "#D6EBFF",
92111
+ highlight: "white"
92016
92112
  };
92017
92113
  /**
92018
92114
  * Parse a terminal OSC 11 response into an [R, G, B] tuple (0–255 each).
@@ -92070,8 +92166,57 @@ function queryOsc11() {
92070
92166
  });
92071
92167
  }
92072
92168
  /**
92169
+ * Compute HSL saturation (0–1) from an RGB tuple (0–255 each).
92170
+ * A value near 0 means achromatic (gray/black/white); near 1 means vivid.
92171
+ */
92172
+ function rgbSaturation(r, g, b) {
92173
+ const rn = r / 255, gn = g / 255, bn = b / 255;
92174
+ const max = Math.max(rn, gn, bn);
92175
+ const min = Math.min(rn, gn, bn);
92176
+ const delta = max - min;
92177
+ if (delta === 0) return 0;
92178
+ const lightness = (max + min) / 2;
92179
+ return delta / (1 - Math.abs(2 * lightness - 1));
92180
+ }
92181
+ /**
92182
+ * ANSI color indices (0–15) that represent chromatic colors — i.e. hues that
92183
+ * are neither near-black nor near-white. If COLORFGBG reports one of these
92184
+ * as the background, hard-coded dark/light hex palettes will look wrong and
92185
+ * transparent mode is the safest choice.
92186
+ *
92187
+ * Index mapping (standard xterm-256 ANSI palette):
92188
+ * 0 black 7 light-gray 8 dark-gray 15 white
92189
+ * 1 red 2 green 3 yellow 4 blue
92190
+ * 5 magenta 6 cyan 9 bright-red 10 bright-green
92191
+ * 11 bright-yellow 12 bright-blue 13 bright-magenta 14 bright-cyan
92192
+ */
92193
+ const CHROMATIC_ANSI_INDICES = new Set([
92194
+ 1,
92195
+ 2,
92196
+ 3,
92197
+ 4,
92198
+ 5,
92199
+ 6,
92200
+ 9,
92201
+ 10,
92202
+ 11,
92203
+ 12,
92204
+ 13,
92205
+ 14
92206
+ ]);
92207
+ /**
92073
92208
  * Detect which theme to use.
92074
92209
  *
92210
+ * Priority:
92211
+ * 1. `FUSION_THEME` / `COLOR_THEME` env-var explicit override
92212
+ * 2. OSC 11 actual background color (most accurate)
92213
+ * – high saturation → transparent (vivid/chromatic bg, e.g. blue, green)
92214
+ * – low saturation + dark luminance → dark
92215
+ * – low saturation + light luminance → light
92216
+ * 3. COLORFGBG heuristic (chromatic ANSI index → transparent)
92217
+ * 4. macOS system appearance
92218
+ * 5. Default dark
92219
+ *
92075
92220
  * @param terminalBg RGB tuple from a prior `queryOsc11()` call, or null/undefined.
92076
92221
  * Pass this to get the most accurate result; without it the
92077
92222
  * function falls back to env-var heuristics.
@@ -92080,8 +92225,10 @@ function detectTheme(terminalBg) {
92080
92225
  const explicitTheme = process.env.FUSION_THEME ?? process.env.COLOR_THEME;
92081
92226
  if (explicitTheme === "light") return defaultLightTheme;
92082
92227
  if (explicitTheme === "dark") return defaultDarkTheme;
92228
+ if (explicitTheme === "transparent") return defaultTransparentTheme;
92083
92229
  if (terminalBg != null) {
92084
92230
  const [r, g, b] = terminalBg;
92231
+ if (rgbSaturation(r, g, b) > .35) return defaultTransparentTheme;
92085
92232
  return (.299 * r + .587 * g + .114 * b) / 255 < .5 ? defaultDarkTheme : defaultLightTheme;
92086
92233
  }
92087
92234
  const colorfgbg = process.env.COLORFGBG ?? "";
@@ -92089,7 +92236,10 @@ function detectTheme(terminalBg) {
92089
92236
  const parts = colorfgbg.split(";");
92090
92237
  if (parts.length >= 2) {
92091
92238
  const bg = parseInt(parts[parts.length - 1], 10);
92092
- if (!isNaN(bg) && bg >= 0) return bg > 8 ? defaultLightTheme : defaultDarkTheme;
92239
+ if (!isNaN(bg) && bg >= 0) {
92240
+ if (CHROMATIC_ANSI_INDICES.has(bg)) return defaultTransparentTheme;
92241
+ return bg > 8 ? defaultLightTheme : defaultDarkTheme;
92242
+ }
92093
92243
  }
92094
92244
  }
92095
92245
  if (process.platform === "darwin" && process.env.TERM_PROGRAM !== "vscode") try {
@@ -245033,7 +245183,7 @@ const LIB_CACHE = /* @__PURE__ */ new Map();
245033
245183
  const PENDING_LIB_CACHE = /* @__PURE__ */ new Map();
245034
245184
  const NODE_MODULE_CACHE = /* @__PURE__ */ new Map();
245035
245185
  const TSCONFIG_CACHE = /* @__PURE__ */ new Map();
245036
- const pkgVersion = process.env.OVERRIDE_VERSION ?? "0.4.1";
245186
+ const pkgVersion = process.env.OVERRIDE_VERSION ?? "0.4.3";
245037
245187
  //#endregion
245038
245188
  //#region ../dev-tools/core/detect-frameworks.ts
245039
245189
  async function detectFrameworks$1(sys) {
@@ -290975,7 +291125,7 @@ function wc$1({ parent: e }) {
290975
291125
  default: return !1;
290976
291126
  }
290977
291127
  }
290978
- function _c$25({ parent: e, grandparent: t }) {
291128
+ function _c$26({ parent: e, grandparent: t }) {
290979
291129
  return t?.type === "JSXAttribute" && e.type === "JSXExpressionContainer" && t.name.type === "JSXIdentifier" && t.name.name === "css";
290980
291130
  }
290981
291131
  async function co(e, t, r) {
@@ -295991,7 +296141,7 @@ var init_estree = __esmMin((() => {
295991
296141
  (e, t) => e.type === "CallExpression" && e.callee.type === "Identifier" && e.callee.name === "Component" && t === "arguments",
295992
296142
  (e, t) => e.type === "Decorator" && t === "expression"
295993
296143
  ];
295994
- po$1 = (e) => Oc$1(e) || wc$1(e) || _c$25(e) || oo$2(e);
296144
+ po$1 = (e) => Oc$1(e) || wc$1(e) || _c$26(e) || oo$2(e);
295995
296145
  Es$6 = 0;
295996
296146
  fo = mo.bind(void 0, "html"), yo = mo.bind(void 0, "angular");
295997
296147
  jc = [
@@ -400168,7 +400318,7 @@ function xc(t, e, s = {}) {
400168
400318
  let r = It(t, s.backwards ? e - 1 : e, s);
400169
400319
  return r !== Gt(t, r, s);
400170
400320
  }
400171
- function _c$24(t, e) {
400321
+ function _c$25(t, e) {
400172
400322
  if (e === !1) return !1;
400173
400323
  if (t.charAt(e) === "/" && t.charAt(e + 1) === "*") {
400174
400324
  for (let s = e + 2; s < t.length; ++s) if (t.charAt(s) === "*" && t.charAt(s + 1) === "/") return s + 2;
@@ -405993,7 +406143,7 @@ https://evilmartians.com/chronicles/postcss-8-plugin-migration`));
405993
406143
  ` || t === "\r" || t === "\u2028" || t === "\u2029";
405994
406144
  Gt = vc;
405995
406145
  Yt = xc;
405996
- xi$1 = _c$24;
406146
+ xi$1 = _c$25;
405997
406147
  _i = bc;
405998
406148
  Vt$1 = Ec;
405999
406149
  De = Oc;
@@ -499176,8 +499326,47 @@ async function backupGitRepo({ sys, credentials, projectId, branchName, repoPath
499176
499326
  }
499177
499327
  const originalRepoUrl = (folderName ? workspace.folders.find((f) => (f.name ?? f.path) === folderName) : workspace.folders.find((f) => f.enableGit))?.originalRepoUrl ?? repoUrl;
499178
499328
  if (!originalRepoUrl) throw new Error("Original repo URL is required for backup upload");
499329
+ const forced = forcedFullBackup ? "offline-full" : !isConnectedToProvider ? "offline" : void 0;
499179
499330
  const lastCommitHash = await getCurrentCommitHash();
499180
- if (!lastCommitHash) throw new Error("Failed to get current commit hash");
499331
+ if (!lastCommitHash) {
499332
+ let totalCommits = null;
499333
+ try {
499334
+ const out = await git([
499335
+ "rev-list",
499336
+ "--all",
499337
+ "--count"
499338
+ ]);
499339
+ totalCommits = parseInt(out.trim(), 10);
499340
+ } catch {}
499341
+ if (totalCommits === 0) {
499342
+ backupLogger.info("Repository has no commits (empty repo) — nothing to back up");
499343
+ return {
499344
+ success: true,
499345
+ empty: true,
499346
+ lastCommitHash: "",
499347
+ partial: true,
499348
+ repoUrl: originalRepoUrl,
499349
+ backupRef: void 0,
499350
+ backupEntry: {
499351
+ projectId,
499352
+ branchName,
499353
+ size: 0,
499354
+ partial: true,
499355
+ initialBranch: featureBranch,
499356
+ initialCommitHash: void 0,
499357
+ lastCommitHash: "",
499358
+ gitBranchName: aiBranch,
499359
+ empty: true,
499360
+ status: "completed",
499361
+ version: "v2",
499362
+ repoUrl: originalRepoUrl,
499363
+ forced,
499364
+ ...folderName && { folderName }
499365
+ }
499366
+ };
499367
+ }
499368
+ throw new Error(totalCommits === null ? "Failed to get current commit hash (git rev-list failed)" : `Failed to get current commit hash (rev-list --all --count returned ${totalCommits})`);
499369
+ }
499181
499370
  const currentBranch = await getCurrentBranch();
499182
499371
  if (!silenceErrors && currentBranch !== aiBranch) throw new Error(`Current branch "${currentBranch}" is not the ai branch "${aiBranch}"`);
499183
499372
  const initCommitHashResult = await getInitialCommitHash({
@@ -499192,7 +499381,6 @@ async function backupGitRepo({ sys, credentials, projectId, branchName, repoPath
499192
499381
  projectId,
499193
499382
  folderName
499194
499383
  });
499195
- const forced = forcedFullBackup ? "offline-full" : !isConnectedToProvider ? "offline" : void 0;
499196
499384
  const recentRemoteSHAs = await getRecentCommitSHAs(initCommitHashResult.initialBranch, 10);
499197
499385
  const recentLocalSHAs = await getRecentCommitSHAs(aiBranch, 10);
499198
499386
  try {
@@ -531515,6 +531703,7 @@ async function getAgent(url) {
531515
531703
  }
531516
531704
  return _agent || new import_undici.Agent({ connect: { rejectUnauthorized } });
531517
531705
  }
531706
+ let lastGetSetCookie = void 0;
531518
531707
  const safeFetch = async (input, init, debug) => {
531519
531708
  const urlObj = new URL(input);
531520
531709
  const hostname = urlObj.hostname;
@@ -531532,9 +531721,11 @@ const safeFetch = async (input, init, debug) => {
531532
531721
  headers: {
531533
531722
  ...init?.headers,
531534
531723
  ...getUserAgent(),
531535
- ...traceData
531724
+ ...traceData,
531725
+ ...lastGetSetCookie ? { Cookie: lastGetSetCookie.join("; ") } : {}
531536
531726
  }
531537
531727
  });
531728
+ lastGetSetCookie = response.headers.getSetCookie();
531538
531729
  outcome = `status: ${response.status}`;
531539
531730
  if (!response.ok) {
531540
531731
  if (response.status === 402) {
@@ -534467,6 +534658,80 @@ function getNextLineIndex(text, cursor) {
534467
534658
  for (let i = 0; i <= lineIdx; i++) newIdx += lines[i].length + 1;
534468
534659
  return newIdx + Math.min(col, targetLine.length);
534469
534660
  }
534661
+ /**
534662
+ * Split `text` into visual lines of at most `width` characters each,
534663
+ * returning the character-index range [start, end) for each visual row.
534664
+ * Hard newlines (\n) always create a new visual line.
534665
+ */
534666
+ function getVisualLines(text, width) {
534667
+ if (width <= 0) return [{
534668
+ start: 0,
534669
+ end: text.length
534670
+ }];
534671
+ const result = [];
534672
+ const logicalLines = text.split("\n");
534673
+ let pos = 0;
534674
+ for (let li = 0; li < logicalLines.length; li++) {
534675
+ const line = logicalLines[li];
534676
+ const isLast = li === logicalLines.length - 1;
534677
+ if (line.length === 0) result.push({
534678
+ start: pos,
534679
+ end: pos
534680
+ });
534681
+ else for (let col = 0; col < line.length; col += width) {
534682
+ const segEnd = Math.min(col + width, line.length);
534683
+ result.push({
534684
+ start: pos + col,
534685
+ end: pos + segEnd
534686
+ });
534687
+ }
534688
+ pos += line.length + (isLast ? 0 : 1);
534689
+ }
534690
+ return result;
534691
+ }
534692
+ /**
534693
+ * Find which visual line the cursor is on, searching from the end.
534694
+ *
534695
+ * Searching in reverse means that when a cursor position falls on a
534696
+ * soft-wrap boundary (where segment_i.end === segment_{i+1}.start),
534697
+ * the LATER segment wins — which is visually correct: the cursor at
534698
+ * the first column of a wrapped row belongs to that row, not the one
534699
+ * above. For hard-newline gaps there is no overlap, so the unique
534700
+ * containing segment is always found.
534701
+ */
534702
+ function findVisualLineIndex(lines, cursor) {
534703
+ for (let i = lines.length - 1; i >= 0; i--) {
534704
+ const vl = lines[i];
534705
+ if (cursor >= vl.start && cursor <= vl.end) return i;
534706
+ }
534707
+ return 0;
534708
+ }
534709
+ function isOnFirstVisualLine(text, cursor, width) {
534710
+ const lines = getVisualLines(text, width);
534711
+ if (lines.length <= 1) return true;
534712
+ return findVisualLineIndex(lines, cursor) === 0;
534713
+ }
534714
+ function isOnLastVisualLine(text, cursor, width) {
534715
+ const lines = getVisualLines(text, width);
534716
+ if (!lines.length) return true;
534717
+ return findVisualLineIndex(lines, cursor) === lines.length - 1;
534718
+ }
534719
+ function getPrevVisualLineIndex(text, cursor, width) {
534720
+ const lines = getVisualLines(text, width);
534721
+ const idx = findVisualLineIndex(lines, cursor);
534722
+ if (idx <= 0) return cursor;
534723
+ const col = cursor - lines[idx].start;
534724
+ const prev = lines[idx - 1];
534725
+ return prev.start + Math.min(col, prev.end - prev.start);
534726
+ }
534727
+ function getNextVisualLineIndex(text, cursor, width) {
534728
+ const lines = getVisualLines(text, width);
534729
+ const idx = findVisualLineIndex(lines, cursor);
534730
+ if (idx >= lines.length - 1) return cursor;
534731
+ const col = cursor - lines[idx].start;
534732
+ const next = lines[idx + 1];
534733
+ return next.start + Math.min(col, next.end - next.start);
534734
+ }
534470
534735
  const inputHistory = {
534471
534736
  history: [],
534472
534737
  historyIndex: -1,
@@ -534482,7 +534747,7 @@ function useInputHistory() {
534482
534747
  let t0;
534483
534748
  if ($[0] !== forceUpdate) {
534484
534749
  t0 = () => {
534485
- const listener = () => forceUpdate(_temp$8);
534750
+ const listener = () => forceUpdate(_temp$9);
534486
534751
  inputHistory.listeners.add(listener);
534487
534752
  return () => {
534488
534753
  inputHistory.listeners.delete(listener);
@@ -534504,7 +534769,7 @@ function useInputHistory() {
534504
534769
  * characters — either case benefits from a compact inline placeholder rather
534505
534770
  * than flooding the input with raw content.
534506
534771
  */
534507
- function _temp$8(n) {
534772
+ function _temp$9(n) {
534508
534773
  return n + 1;
534509
534774
  }
534510
534775
  function isBigPaste(text) {
@@ -534514,24 +534779,16 @@ function makePasteToken(id, lineCount) {
534514
534779
  return `[Pasted text #${id} +${lineCount} line${lineCount === 1 ? "" : "s"}]`;
534515
534780
  }
534516
534781
  function useTextInput(options = {}) {
534517
- const { onSubmit, onChange, onTab, onShiftTab, onPaste, onBackspaceEmpty, isActive = true, getIsMenuActive, submitDisabled = false, disableHistory = false, initialValue = "" } = options;
534782
+ const { onSubmit, onChange, onTab, onShiftTab, onPaste, onBackspaceEmpty, isActive = true, getIsMenuActive, submitDisabled = false, disableHistory = false, initialValue = "", inputWidth = 0 } = options;
534518
534783
  const [value, setValueState] = (0, import_react.useState)(initialValue);
534519
534784
  const [cursorIndex, setCursorIndex] = (0, import_react.useState)(initialValue.length);
534520
534785
  useInputHistory();
534521
- const fnDeleteRef = (0, import_react.useRef)(false);
534522
- (0, import_react.useEffect)(() => {
534523
- const onData = (data) => {
534524
- if (data.toString("utf8").includes("\x1B[3~")) fnDeleteRef.current = true;
534525
- };
534526
- process.stdin.on("data", onData);
534527
- return () => {
534528
- process.stdin.off("data", onData);
534529
- };
534530
- }, []);
534531
534786
  const valueRef = (0, import_react.useRef)(value);
534532
534787
  const cursorRef = (0, import_react.useRef)(cursorIndex);
534788
+ const inputWidthRef = (0, import_react.useRef)(inputWidth);
534533
534789
  valueRef.current = value;
534534
534790
  cursorRef.current = cursorIndex;
534791
+ inputWidthRef.current = inputWidth;
534535
534792
  const pasteMapRef = (0, import_react.useRef)(/* @__PURE__ */ new Map());
534536
534793
  const pasteCounterRef = (0, import_react.useRef)(0);
534537
534794
  const resolvePaste = (0, import_react.useCallback)((val) => {
@@ -534579,6 +534836,7 @@ function useTextInput(options = {}) {
534579
534836
  onChange?.("");
534580
534837
  }, [onChange]);
534581
534838
  useInput((input, key) => {
534839
+ input = input.replaceAll("\\\r", "\n");
534582
534840
  const val_3 = valueRef.current;
534583
534841
  const cursor_1 = cursorRef.current;
534584
534842
  const { active: isMenuActive, captureSpace } = getIsMenuActive?.() ?? {
@@ -534609,9 +534867,12 @@ function useTextInput(options = {}) {
534609
534867
  return;
534610
534868
  }
534611
534869
  if (key.return && (key.ctrl || key.shift || key.meta)) {
534612
- const next_1 = val_3.slice(0, cursor_1) + "\n" + val_3.slice(cursor_1);
534870
+ const hasStrayBackslash = cursor_1 > 0 && val_3[cursor_1 - 1] === "\\";
534871
+ const baseVal = hasStrayBackslash ? val_3.slice(0, cursor_1 - 1) + val_3.slice(cursor_1) : val_3;
534872
+ const baseCursor = hasStrayBackslash ? cursor_1 - 1 : cursor_1;
534873
+ const next_1 = baseVal.slice(0, baseCursor) + "\n" + baseVal.slice(baseCursor);
534613
534874
  setValueState(next_1);
534614
- setCursorIndex(cursor_1 + 1);
534875
+ setCursorIndex(baseCursor + 1);
534615
534876
  onChange?.(next_1);
534616
534877
  return;
534617
534878
  }
@@ -534667,11 +534928,12 @@ function useTextInput(options = {}) {
534667
534928
  return;
534668
534929
  }
534669
534930
  if (key.upArrow) {
534670
- if (!isOnFirstLine(val_3, cursor_1)) {
534671
- setCursorIndex(getPrevLineIndex(val_3, cursor_1));
534931
+ const iw = inputWidthRef.current;
534932
+ if (!(iw > 0 ? isOnFirstVisualLine(val_3, cursor_1, iw) : isOnFirstLine(val_3, cursor_1))) {
534933
+ setCursorIndex(iw > 0 ? getPrevVisualLineIndex(val_3, cursor_1, iw) : getPrevLineIndex(val_3, cursor_1));
534672
534934
  return;
534673
534935
  }
534674
- if (!disableHistory) {
534936
+ if (!disableHistory && !val_3.includes("\n")) {
534675
534937
  const { history: h, historyIndex: hi } = inputHistory;
534676
534938
  const nextIndex = hi + 1;
534677
534939
  if (nextIndex < h.length) {
@@ -534688,11 +534950,12 @@ function useTextInput(options = {}) {
534688
534950
  return;
534689
534951
  }
534690
534952
  if (key.downArrow) {
534691
- if (!isOnLastLine(val_3, cursor_1)) {
534692
- setCursorIndex(getNextLineIndex(val_3, cursor_1));
534953
+ const iw_0 = inputWidthRef.current;
534954
+ if (!(iw_0 > 0 ? isOnLastVisualLine(val_3, cursor_1, iw_0) : isOnLastLine(val_3, cursor_1))) {
534955
+ setCursorIndex(iw_0 > 0 ? getNextVisualLineIndex(val_3, cursor_1, iw_0) : getNextLineIndex(val_3, cursor_1));
534693
534956
  return;
534694
534957
  }
534695
- if (!disableHistory) {
534958
+ if (!disableHistory && !val_3.includes("\n")) {
534696
534959
  const { history: h_0, historyIndex: hi_0, historyDraft: hd } = inputHistory;
534697
534960
  if (hi_0 > 0) {
534698
534961
  const nextIndex_0 = hi_0 - 1;
@@ -534722,16 +534985,14 @@ function useTextInput(options = {}) {
534722
534985
  setCursorIndex(Math.min(val_3.length, cursor_1 + 1));
534723
534986
  return;
534724
534987
  }
534725
- if (key.delete || key.backspace) {
534726
- const isFnDelete = fnDeleteRef.current;
534727
- fnDeleteRef.current = false;
534728
- if (isFnDelete) {
534729
- if (cursor_1 < val_3.length) {
534730
- const next_5 = val_3.slice(0, cursor_1) + val_3.slice(cursor_1 + 1);
534731
- setValueState(next_5);
534732
- onChange?.(next_5);
534733
- }
534734
- } else if (cursor_1 > 0) {
534988
+ if (key.delete && cursor_1 < val_3.length) {
534989
+ const next_5 = val_3.slice(0, cursor_1) + val_3.slice(cursor_1 + 1);
534990
+ setValueState(next_5);
534991
+ onChange?.(next_5);
534992
+ return;
534993
+ }
534994
+ if (key.backspace) {
534995
+ if (cursor_1 > 0) {
534735
534996
  const next_6 = val_3.slice(0, cursor_1 - 1) + val_3.slice(cursor_1);
534736
534997
  setValueState(next_6);
534737
534998
  setCursorIndex(cursor_1 - 1);
@@ -534739,8 +535000,9 @@ function useTextInput(options = {}) {
534739
535000
  } else if (val_3.length === 0) onBackspaceEmpty?.();
534740
535001
  return;
534741
535002
  }
534742
- if (input.length === 1 && input.charCodeAt(0) < 32) return;
534743
- if (input) {
535003
+ const code = input.charCodeAt(0);
535004
+ if (input.length === 1 && code < 32 && code !== 10) return;
535005
+ if (input && !key.ctrl && !key.meta) {
534744
535006
  if (inputHistory.historyIndex !== -1) {
534745
535007
  inputHistory.historyIndex = -1;
534746
535008
  inputHistory.historyDraft = "";
@@ -536248,7 +536510,8 @@ function useCodeGenStateHandler() {
536248
536510
  id: `thinking-${_msgIdCounter++}`,
536249
536511
  type: "thinking",
536250
536512
  content: step.content ?? "",
536251
- streaming: true
536513
+ streaming: true,
536514
+ startedAt: Date.now()
536252
536515
  });
536253
536516
  break;
536254
536517
  case "delta": {
@@ -536649,18 +536912,28 @@ const SUBVIEW_CONFIG = {
536649
536912
  description: "Choose reasoning effort level"
536650
536913
  }
536651
536914
  };
536652
- function renderCommandRow({ cmd, isSelected, maxLabelLen }) {
536915
+ function renderCommandRow({ cmd, isSelected, maxLabelLen, theme }) {
536653
536916
  const padded = cmd.label.padEnd(maxLabelLen + 2);
536654
536917
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
536655
536918
  width: "100%",
536656
536919
  paddingX: 1,
536657
536920
  children: isSelected ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
536658
- backgroundColor: "blue",
536659
- color: "white",
536921
+ backgroundColor: theme.highlightBackground,
536922
+ color: theme.highlight,
536660
536923
  children: [
536661
536924
  " ",
536662
- padded,
536663
- cmd.description,
536925
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
536926
+ backgroundColor: theme.highlightBackground,
536927
+ color: theme.highlight,
536928
+ bold: true,
536929
+ children: padded
536930
+ }),
536931
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
536932
+ backgroundColor: theme.highlightBackground,
536933
+ color: theme.highlight,
536934
+ dimColor: true,
536935
+ children: cmd.description
536936
+ }),
536664
536937
  " "
536665
536938
  ]
536666
536939
  }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
@@ -536695,7 +536968,7 @@ function SlashCommandMenu(t0) {
536695
536968
  const contextPct = t2;
536696
536969
  let t3;
536697
536970
  if ($[3] !== state.customInstructions) {
536698
- t3 = (state.customInstructions ?? []).filter(_temp$7).map(_temp2$4);
536971
+ t3 = (state.customInstructions ?? []).filter(_temp$8).map(_temp2$5);
536699
536972
  $[3] = state.customInstructions;
536700
536973
  $[4] = t3;
536701
536974
  } else t3 = $[4];
@@ -536874,7 +537147,7 @@ function SlashCommandMenu(t0) {
536874
537147
  const visibleStart = scrollOffset;
536875
537148
  const visibleEnd = Math.min(scrollOffset + MAX_VISIBLE_ITEMS, commands.length);
536876
537149
  let t10;
536877
- if ($[24] !== commands || $[25] !== contextPct || $[26] !== contextTotal || $[27] !== contextUsed || $[28] !== currentReasoning || $[29] !== maxLabelLen || $[30] !== prefs || $[31] !== proxy || $[32] !== selectedIndex || $[33] !== state.model || $[34] !== state.modelOverride || $[35] !== state.sessionMode || $[36] !== theme.background || $[37] !== view || $[38] !== visibleEnd || $[39] !== visibleStart) {
537150
+ if ($[24] !== commands || $[25] !== contextPct || $[26] !== contextTotal || $[27] !== contextUsed || $[28] !== currentReasoning || $[29] !== maxLabelLen || $[30] !== prefs || $[31] !== proxy || $[32] !== selectedIndex || $[33] !== state.model || $[34] !== state.modelOverride || $[35] !== state.sessionMode || $[36] !== theme || $[37] !== view || $[38] !== visibleEnd || $[39] !== visibleStart) {
536878
537151
  const visibleCommands = commands.slice(visibleStart, visibleEnd);
536879
537152
  const itemsAbove = visibleStart;
536880
537153
  const itemsBelow = commands.length - visibleEnd;
@@ -536901,7 +537174,8 @@ function SlashCommandMenu(t0) {
536901
537174
  visibleCommands.map((cmd_0, i_3) => renderCommandRow({
536902
537175
  cmd: cmd_0,
536903
537176
  isSelected: visibleStart + i_3 === selectedIndex,
536904
- maxLabelLen
537177
+ maxLabelLen,
537178
+ theme
536905
537179
  })),
536906
537180
  itemsBelow > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
536907
537181
  paddingX: 2,
@@ -537096,12 +537370,22 @@ function SlashCommandMenu(t0) {
537096
537370
  width: "100%",
537097
537371
  paddingLeft: 2,
537098
537372
  children: absoluteIndex === selectedIndex ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
537099
- backgroundColor: "blue",
537100
- color: "white",
537373
+ backgroundColor: theme.highlightBackground,
537374
+ color: theme.highlight,
537101
537375
  children: [
537102
537376
  " ",
537103
- padded,
537104
- cmd_2.description,
537377
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537378
+ backgroundColor: theme.highlightBackground,
537379
+ color: theme.highlight,
537380
+ bold: true,
537381
+ children: padded
537382
+ }),
537383
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537384
+ backgroundColor: theme.highlightBackground,
537385
+ color: theme.highlight,
537386
+ dimColor: true,
537387
+ children: cmd_2.description
537388
+ }),
537105
537389
  " "
537106
537390
  ]
537107
537391
  }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
@@ -537135,7 +537419,7 @@ function SlashCommandMenu(t0) {
537135
537419
  $[33] = state.model;
537136
537420
  $[34] = state.modelOverride;
537137
537421
  $[35] = state.sessionMode;
537138
- $[36] = theme.background;
537422
+ $[36] = theme;
537139
537423
  $[37] = view;
537140
537424
  $[38] = visibleEnd;
537141
537425
  $[39] = visibleStart;
@@ -537155,14 +537439,14 @@ function _temp4$1(cmd_1) {
537155
537439
  function _temp3$4(c) {
537156
537440
  return c.label.length;
537157
537441
  }
537158
- function _temp2$4(i_0) {
537442
+ function _temp2$5(i_0) {
537159
537443
  return {
537160
537444
  id: i_0.name,
537161
537445
  label: `/${i_0.name}`,
537162
537446
  description: i_0.description
537163
537447
  };
537164
537448
  }
537165
- function _temp$7(i) {
537449
+ function _temp$8(i) {
537166
537450
  return i.isSkill && i.userInvocable !== false && !BUILTIN_COMMAND_IDS.has(i.name);
537167
537451
  }
537168
537452
  //#endregion
@@ -537520,6 +537804,8 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
537520
537804
  setDismissedSlashValue(null);
537521
537805
  onChange?.("");
537522
537806
  }, [onChange, onSubmit]);
537807
+ const inputBoxRef = (0, import_react.useRef)(null);
537808
+ const { width: inputWidth } = useBoxMetrics(inputBoxRef);
537523
537809
  const pasteHandlerRef = (0, import_react.useRef)(() => {});
537524
537810
  const { value, cursorIndex, setValue, clear } = useTextInput({
537525
537811
  onSubmit: handleSubmitFromHook,
@@ -537530,6 +537816,7 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
537530
537816
  getIsMenuActive,
537531
537817
  submitDisabled: false,
537532
537818
  initialValue,
537819
+ inputWidth,
537533
537820
  onPaste: () => void Promise.resolve(pasteHandlerRef.current()).catch(() => {}),
537534
537821
  onBackspaceEmpty: pendingAttachments.length > 0 && onRemoveAttachment ? () => {
537535
537822
  const last = pendingAttachments[pendingAttachments.length - 1];
@@ -537640,7 +537927,8 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
537640
537927
  children: "queued:"
537641
537928
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
537642
537929
  color: "yellow",
537643
- children: msg.displayPrompt.length > 60 ? msg.displayPrompt.slice(0, 57) + "..." : msg.displayPrompt
537930
+ wrap: "truncate-end",
537931
+ children: msg.displayPrompt
537644
537932
  })]
537645
537933
  }, msg.idempotencyKey || i);
537646
537934
  })
@@ -537658,16 +537946,16 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
537658
537946
  onCancel: handleAtCancel
537659
537947
  }),
537660
537948
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537661
- borderStyle: "bold",
537949
+ borderStyle: theme.panelBackground ? "bold" : "round",
537662
537950
  borderColor: accentColor,
537663
537951
  borderLeft: true,
537664
- borderRight: false,
537665
- borderTop: false,
537666
- borderBottom: false,
537952
+ borderRight: !theme.panelBackground,
537953
+ borderTop: !theme.panelBackground,
537954
+ borderBottom: !theme.panelBackground,
537667
537955
  flexDirection: "column",
537668
537956
  paddingLeft: 2,
537669
537957
  paddingRight: 2,
537670
- paddingY: 1,
537958
+ paddingY: theme.panelBackground ? 1 : 0,
537671
537959
  backgroundColor: theme.panelBackground,
537672
537960
  children: [
537673
537961
  pendingAttachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
@@ -537700,14 +537988,17 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
537700
537988
  children: "(backspace on empty input to remove)"
537701
537989
  })]
537702
537990
  }),
537703
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ControlledTextInput, {
537704
- value,
537705
- cursorIndex,
537706
- rows: 1,
537707
- placeholder: hint,
537708
- showCursor: true,
537709
- maxRows: 10
537710
- }) }),
537991
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
537992
+ ref: inputBoxRef,
537993
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ControlledTextInput, {
537994
+ value,
537995
+ cursorIndex,
537996
+ rows: 1,
537997
+ placeholder: hint,
537998
+ showCursor: true,
537999
+ maxRows: 10
538000
+ })
538001
+ }),
537711
538002
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
537712
538003
  columnGap: 1,
537713
538004
  flexWrap: "wrap",
@@ -537776,7 +538067,7 @@ function RewindMode(t0) {
537776
538067
  if ($[0] !== onCancel || $[1] !== onSelect || $[2] !== selectedIndex || $[3] !== turns) {
537777
538068
  t1 = (input, key) => {
537778
538069
  if (key.upArrow) {
537779
- setSelectedIndex(_temp$6);
538070
+ setSelectedIndex(_temp$7);
537780
538071
  return;
537781
538072
  }
537782
538073
  if (key.downArrow) {
@@ -537910,7 +538201,7 @@ function RewindMode(t0) {
537910
538201
  } else t7 = $[16];
537911
538202
  return t7;
537912
538203
  }
537913
- function _temp$6(i) {
538204
+ function _temp$7(i) {
537914
538205
  return Math.max(0, i - 1);
537915
538206
  }
537916
538207
  //#endregion
@@ -540157,8 +540448,8 @@ function useToast() {
540157
540448
  //#endregion
540158
540449
  //#region src/components/StatusBar.tsx
540159
540450
  const StatusBar = (0, import_react.memo)((t0) => {
540160
- const $ = (0, import_compiler_runtime.c)(31);
540161
- const { ctrlCPending, showSidebar } = t0;
540451
+ const $ = (0, import_compiler_runtime.c)(39);
540452
+ const { ctrlCPending, showSidebar, updateCheck } = t0;
540162
540453
  const [state] = useCodeGenState();
540163
540454
  const toast = useToast();
540164
540455
  if (ctrlCPending) {
@@ -540192,22 +540483,82 @@ const StatusBar = (0, import_react.memo)((t0) => {
540192
540483
  } else t2 = $[3];
540193
540484
  return t2;
540194
540485
  }
540486
+ if (updateCheck?.status === "upgrade") {
540487
+ let t1;
540488
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
540489
+ t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540490
+ color: "yellow",
540491
+ children: "⬆"
540492
+ });
540493
+ $[4] = t1;
540494
+ } else t1 = $[4];
540495
+ let t2;
540496
+ if ($[5] !== updateCheck.currentVersion || $[6] !== updateCheck.newVersion) {
540497
+ t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540498
+ color: "yellow",
540499
+ children: [
540500
+ "Update available: ",
540501
+ updateCheck.currentVersion,
540502
+ " →",
540503
+ " ",
540504
+ updateCheck.newVersion
540505
+ ]
540506
+ });
540507
+ $[5] = updateCheck.currentVersion;
540508
+ $[6] = updateCheck.newVersion;
540509
+ $[7] = t2;
540510
+ } else t2 = $[7];
540511
+ let t3;
540512
+ let t4;
540513
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
540514
+ t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540515
+ dimColor: true,
540516
+ children: "· run"
540517
+ });
540518
+ t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540519
+ bold: true,
540520
+ color: "yellow",
540521
+ children: "builder update"
540522
+ });
540523
+ $[8] = t3;
540524
+ $[9] = t4;
540525
+ } else {
540526
+ t3 = $[8];
540527
+ t4 = $[9];
540528
+ }
540529
+ let t5;
540530
+ if ($[10] !== t2) {
540531
+ t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540532
+ paddingY: 0,
540533
+ gap: 1,
540534
+ children: [
540535
+ t1,
540536
+ t2,
540537
+ t3,
540538
+ t4
540539
+ ]
540540
+ });
540541
+ $[10] = t2;
540542
+ $[11] = t5;
540543
+ } else t5 = $[11];
540544
+ return t5;
540545
+ }
540195
540546
  const ctx = state.contextWindow;
540196
540547
  const showContext = !showSidebar && ctx != null;
540197
540548
  let t1;
540198
- if ($[4] !== ctx || $[5] !== showContext) {
540549
+ if ($[12] !== ctx || $[13] !== showContext) {
540199
540550
  t1 = showContext ? Math.round(Math.min(ctx.usage, 1) * 100) : 0;
540200
- $[4] = ctx;
540201
- $[5] = showContext;
540202
- $[6] = t1;
540203
- } else t1 = $[6];
540551
+ $[12] = ctx;
540552
+ $[13] = showContext;
540553
+ $[14] = t1;
540554
+ } else t1 = $[14];
540204
540555
  const pct = t1;
540205
540556
  const tokens = showContext ? ctx.usedTokens : 0;
540206
- const fmtTokens = _temp$5;
540557
+ const fmtTokens = _temp$6;
540207
540558
  const ctxColor = pct > 80 ? "red" : pct > 50 ? "yellow" : "green";
540208
540559
  if (ctx != null && pct >= 75 && !state.activeUserQuestions) {
540209
540560
  let t2;
540210
- if ($[7] !== ctxColor || $[8] !== pct || $[9] !== showContext || $[10] !== tokens) {
540561
+ if ($[15] !== ctxColor || $[16] !== pct || $[17] !== showContext || $[18] !== tokens) {
540211
540562
  t2 = showContext && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
540212
540563
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540213
540564
  color: ctxColor,
@@ -540220,24 +540571,24 @@ const StatusBar = (0, import_react.memo)((t0) => {
540220
540571
  }),
540221
540572
  ") · "
540222
540573
  ] });
540223
- $[7] = ctxColor;
540224
- $[8] = pct;
540225
- $[9] = showContext;
540226
- $[10] = tokens;
540227
- $[11] = t2;
540228
- } else t2 = $[11];
540574
+ $[15] = ctxColor;
540575
+ $[16] = pct;
540576
+ $[17] = showContext;
540577
+ $[18] = tokens;
540578
+ $[19] = t2;
540579
+ } else t2 = $[19];
540229
540580
  let t3;
540230
- if ($[12] !== ctxColor) {
540581
+ if ($[20] !== ctxColor) {
540231
540582
  t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
540232
540583
  bold: true,
540233
540584
  color: ctxColor,
540234
540585
  children: "/compact"
540235
540586
  });
540236
- $[12] = ctxColor;
540237
- $[13] = t3;
540238
- } else t3 = $[13];
540587
+ $[20] = ctxColor;
540588
+ $[21] = t3;
540589
+ } else t3 = $[21];
540239
540590
  let t4;
540240
- if ($[14] !== ctxColor || $[15] !== t2 || $[16] !== t3) {
540591
+ if ($[22] !== ctxColor || $[23] !== t2 || $[24] !== t3) {
540241
540592
  t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540242
540593
  color: ctxColor,
540243
540594
  dimColor: true,
@@ -540250,13 +540601,13 @@ const StatusBar = (0, import_react.memo)((t0) => {
540250
540601
  "to summarize the conversation before hitting the limit"
540251
540602
  ]
540252
540603
  });
540253
- $[14] = ctxColor;
540254
- $[15] = t2;
540255
- $[16] = t3;
540256
- $[17] = t4;
540257
- } else t4 = $[17];
540604
+ $[22] = ctxColor;
540605
+ $[23] = t2;
540606
+ $[24] = t3;
540607
+ $[25] = t4;
540608
+ } else t4 = $[25];
540258
540609
  let t5;
540259
- if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
540610
+ if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
540260
540611
  t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540261
540612
  gap: 3,
540262
540613
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
@@ -540267,22 +540618,22 @@ const StatusBar = (0, import_react.memo)((t0) => {
540267
540618
  }), " mode"]
540268
540619
  })
540269
540620
  });
540270
- $[18] = t5;
540271
- } else t5 = $[18];
540621
+ $[26] = t5;
540622
+ } else t5 = $[26];
540272
540623
  let t6;
540273
- if ($[19] !== t4) {
540624
+ if ($[27] !== t4) {
540274
540625
  t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540275
540626
  justifyContent: "space-between",
540276
540627
  paddingY: 0,
540277
540628
  children: [t4, t5]
540278
540629
  });
540279
- $[19] = t4;
540280
- $[20] = t6;
540281
- } else t6 = $[20];
540630
+ $[27] = t4;
540631
+ $[28] = t6;
540632
+ } else t6 = $[28];
540282
540633
  return t6;
540283
540634
  }
540284
540635
  let t2;
540285
- if ($[21] !== ctxColor || $[22] !== pct || $[23] !== showContext || $[24] !== tokens) {
540636
+ if ($[29] !== ctxColor || $[30] !== pct || $[31] !== showContext || $[32] !== tokens) {
540286
540637
  t2 = showContext ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
540287
540638
  dimColor: true,
540288
540639
  children: [
@@ -540298,14 +540649,14 @@ const StatusBar = (0, import_react.memo)((t0) => {
540298
540649
  ")"
540299
540650
  ]
540300
540651
  }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spacer, {});
540301
- $[21] = ctxColor;
540302
- $[22] = pct;
540303
- $[23] = showContext;
540304
- $[24] = tokens;
540305
- $[25] = t2;
540306
- } else t2 = $[25];
540652
+ $[29] = ctxColor;
540653
+ $[30] = pct;
540654
+ $[31] = showContext;
540655
+ $[32] = tokens;
540656
+ $[33] = t2;
540657
+ } else t2 = $[33];
540307
540658
  let t3;
540308
- if ($[26] !== state.activeUserQuestions) {
540659
+ if ($[34] !== state.activeUserQuestions) {
540309
540660
  t3 = state.activeUserQuestions ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540310
540661
  gap: 3,
540311
540662
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
@@ -540342,23 +540693,23 @@ const StatusBar = (0, import_react.memo)((t0) => {
540342
540693
  }), " mode"]
540343
540694
  })
540344
540695
  });
540345
- $[26] = state.activeUserQuestions;
540346
- $[27] = t3;
540347
- } else t3 = $[27];
540696
+ $[34] = state.activeUserQuestions;
540697
+ $[35] = t3;
540698
+ } else t3 = $[35];
540348
540699
  let t4;
540349
- if ($[28] !== t2 || $[29] !== t3) {
540700
+ if ($[36] !== t2 || $[37] !== t3) {
540350
540701
  t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540351
540702
  justifyContent: "space-between",
540352
540703
  paddingY: 0,
540353
540704
  children: [t2, t3]
540354
540705
  });
540355
- $[28] = t2;
540356
- $[29] = t3;
540357
- $[30] = t4;
540358
- } else t4 = $[30];
540706
+ $[36] = t2;
540707
+ $[37] = t3;
540708
+ $[38] = t4;
540709
+ } else t4 = $[38];
540359
540710
  return t4;
540360
540711
  });
540361
- function _temp$5(n) {
540712
+ function _temp$6(n) {
540362
540713
  return n >= 1e6 ? `${(n / 1e6).toFixed(1)}M` : n >= 1e3 ? `${(n / 1e3).toFixed(0)}k` : String(n);
540363
540714
  }
540364
540715
  //#endregion
@@ -540401,8 +540752,8 @@ const GeneratingProgress = (0, import_react.memo)(() => {
540401
540752
  const theme = useTheme();
540402
540753
  const isGenerating = state.state === "generating";
540403
540754
  const todos = state.todoItems ?? [];
540404
- const completed = todos.filter(_temp$4);
540405
- const inProgress = todos.find(_temp2$3);
540755
+ const completed = todos.filter(_temp$5);
540756
+ const inProgress = todos.find(_temp2$4);
540406
540757
  const pending = todos.filter(_temp3$3);
540407
540758
  const lastCompleted = completed[completed.length - 1];
540408
540759
  const openCount = pending.length + (inProgress ? 1 : 0);
@@ -540439,7 +540790,6 @@ const GeneratingProgress = (0, import_react.memo)(() => {
540439
540790
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
540440
540791
  t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540441
540792
  gap: 1,
540442
- marginBottom: 1,
540443
540793
  children: [t0, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540444
540794
  flexShrink: 0,
540445
540795
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
@@ -540460,6 +540810,7 @@ const GeneratingProgress = (0, import_react.memo)(() => {
540460
540810
  t1,
540461
540811
  inProgress && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
540462
540812
  gap: 1,
540813
+ marginTop: 1,
540463
540814
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
540464
540815
  flexShrink: 0,
540465
540816
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
@@ -540648,10 +540999,10 @@ const ProgressBar = (0, import_react.memo)(() => {
540648
540999
  } else t2 = $[4];
540649
541000
  return t2;
540650
541001
  });
540651
- function _temp$4(t) {
541002
+ function _temp$5(t) {
540652
541003
  return t.status === "completed";
540653
541004
  }
540654
- function _temp2$3(t_0) {
541005
+ function _temp2$4(t_0) {
540655
541006
  return t_0.status === "in_progress";
540656
541007
  }
540657
541008
  function _temp3$3(t_1) {
@@ -541505,7 +541856,7 @@ const TipsSection = (0, import_react.memo)(() => {
541505
541856
  bb0: {
541506
541857
  let t1;
541507
541858
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
541508
- t1 = TIPS.filter(_temp$3);
541859
+ t1 = TIPS.filter(_temp$4);
541509
541860
  $[0] = t1;
541510
541861
  } else t1 = $[0];
541511
541862
  const availableTips = t1;
@@ -541656,7 +542007,7 @@ const TodoSection = (0, import_react.memo)(() => {
541656
542007
  if (!state.todoItems?.length) return null;
541657
542008
  let t0;
541658
542009
  if ($[0] !== state.todoItems) {
541659
- t0 = state.todoItems.filter(_temp2$2);
542010
+ t0 = state.todoItems.filter(_temp2$3);
541660
542011
  $[0] = state.todoItems;
541661
542012
  $[1] = t0;
541662
542013
  } else t0 = $[1];
@@ -541774,7 +542125,7 @@ const FooterSection = (0, import_react.memo)(() => {
541774
542125
  children: [
541775
542126
  "•",
541776
542127
  " Fusion ",
541777
- "0.4.1"
542128
+ "0.4.3"
541778
542129
  ]
541779
542130
  });
541780
542131
  $[10] = t7;
@@ -541860,10 +542211,10 @@ const Sidebar = (0, import_react.memo)(() => {
541860
542211
  } else t8 = $[9];
541861
542212
  return t8;
541862
542213
  });
541863
- function _temp$3(item) {
542214
+ function _temp$4(item) {
541864
542215
  return item.text;
541865
542216
  }
541866
- function _temp2$2(t) {
542217
+ function _temp2$3(t) {
541867
542218
  return t.status === "completed";
541868
542219
  }
541869
542220
  function _temp3$2(item) {
@@ -601253,7 +601604,7 @@ function OutputPreview(t0) {
601253
601604
  T0 = Box;
601254
601605
  t2 = "column";
601255
601606
  t3 = 2;
601256
- t4 = lines.map(_temp$2);
601607
+ t4 = lines.map(_temp$3);
601257
601608
  $[0] = maxLines;
601258
601609
  $[1] = text;
601259
601610
  $[2] = T0;
@@ -601307,7 +601658,7 @@ function OutputPreview(t0) {
601307
601658
  } else t6 = $[17];
601308
601659
  return t6;
601309
601660
  }
601310
- function _temp$2(line, i) {
601661
+ function _temp$3(line, i) {
601311
601662
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
601312
601663
  flexDirection: "row",
601313
601664
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
@@ -601372,7 +601723,7 @@ function DiffView(t0) {
601372
601723
  const lines = t1;
601373
601724
  let t2;
601374
601725
  if ($[3] !== lines) {
601375
- t2 = lines.map(_temp2$1);
601726
+ t2 = lines.map(_temp2$2);
601376
601727
  $[3] = lines;
601377
601728
  $[4] = t2;
601378
601729
  } else t2 = $[4];
@@ -601388,7 +601739,7 @@ function DiffView(t0) {
601388
601739
  } else t3 = $[6];
601389
601740
  return t3;
601390
601741
  }
601391
- function _temp2$1(line, i) {
601742
+ function _temp2$2(line, i) {
601392
601743
  if (line.kind === "ellipsis") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
601393
601744
  dimColor: true,
601394
601745
  children: " ···"
@@ -602715,57 +603066,35 @@ function getToolAriaProps(toolName, input) {
602715
603066
  };
602716
603067
  }
602717
603068
  const MessageBlockView = (0, import_react.memo)((props) => {
602718
- const $ = (0, import_compiler_runtime.c)(58);
603069
+ const $ = (0, import_compiler_runtime.c)(55);
602719
603070
  const message = useSnapshot(props.message);
602720
603071
  const theme = useTheme();
602721
- const [flash, setFlash] = (0, import_react.useState)(false);
602722
- let t0;
602723
- let t1;
602724
- if ($[0] !== props.highlighted) {
602725
- t0 = () => {
602726
- if (props.highlighted) {
602727
- setFlash(true);
602728
- const timer = setTimeout(() => setFlash(false), 1e3);
602729
- return () => clearTimeout(timer);
602730
- }
602731
- setFlash(false);
602732
- };
602733
- t1 = [props.highlighted];
602734
- $[0] = props.highlighted;
602735
- $[1] = t0;
602736
- $[2] = t1;
602737
- } else {
602738
- t0 = $[1];
602739
- t1 = $[2];
602740
- }
602741
- (0, import_react.useEffect)(t0, t1);
602742
- const flashBg = flash ? theme.highlightBackground : void 0;
602743
603072
  let inner;
602744
603073
  bb0: switch (message.type) {
602745
603074
  case "user": {
602746
603075
  if (message.compacting) {
602747
- const t2 = flash ? flashBg : theme.panelBackground;
602748
- let t3;
602749
- let t4;
602750
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
602751
- t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
603076
+ const t0 = props.highlighted ? theme.highlightBackground : theme.panelBackground;
603077
+ let t1;
603078
+ let t2;
603079
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
603080
+ t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
602752
603081
  color: "yellow",
602753
603082
  bold: true,
602754
603083
  children: "Compacting conversation"
602755
603084
  });
602756
- t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
603085
+ t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
602757
603086
  dimColor: true,
602758
603087
  children: "The conversation is too long to keep in the AI memory, auto-summarizing might take up to 1 minute. Conversation can continue shortly."
602759
603088
  });
602760
- $[3] = t3;
602761
- $[4] = t4;
603089
+ $[0] = t1;
603090
+ $[1] = t2;
602762
603091
  } else {
602763
- t3 = $[3];
602764
- t4 = $[4];
603092
+ t1 = $[0];
603093
+ t2 = $[1];
602765
603094
  }
602766
- let t5;
602767
- if ($[5] !== message.id || $[6] !== t2) {
602768
- t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
603095
+ let t3;
603096
+ if ($[2] !== message.id || $[3] !== t0) {
603097
+ t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
602769
603098
  marginBottom: 1,
602770
603099
  paddingLeft: 2,
602771
603100
  paddingRight: 2,
@@ -602776,34 +603105,34 @@ const MessageBlockView = (0, import_react.memo)((props) => {
602776
603105
  borderTop: false,
602777
603106
  borderBottom: false,
602778
603107
  borderColor: "yellow",
602779
- backgroundColor: t2,
603108
+ backgroundColor: t0,
602780
603109
  flexDirection: "column",
602781
603110
  "aria-role": "listitem",
602782
603111
  "aria-label": "Compacting conversation",
602783
- children: [t3, t4]
603112
+ children: [t1, t2]
602784
603113
  }, message.id);
602785
- $[5] = message.id;
602786
- $[6] = t2;
602787
- $[7] = t5;
602788
- } else t5 = $[7];
602789
- inner = t5;
603114
+ $[2] = message.id;
603115
+ $[3] = t0;
603116
+ $[4] = t3;
603117
+ } else t3 = $[4];
603118
+ inner = t3;
602790
603119
  break bb0;
602791
603120
  }
602792
- const t2 = flash ? flashBg : theme.panelBackground;
602793
- const t3 = `User: ${message.displayPrompt ?? ""}`;
602794
- const t4 = message.displayPrompt ?? "";
602795
- let t5;
602796
- if ($[8] !== t4) {
602797
- t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
603121
+ const t0 = props.highlighted ? theme.highlightBackground : theme.panelBackground;
603122
+ const t1 = `User: ${message.displayPrompt ?? ""}`;
603123
+ const t2 = message.displayPrompt ?? "";
603124
+ let t3;
603125
+ if ($[5] !== t2) {
603126
+ t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
602798
603127
  wrap: "wrap",
602799
- children: t4
603128
+ children: t2
602800
603129
  });
602801
- $[8] = t4;
602802
- $[9] = t5;
602803
- } else t5 = $[9];
602804
- let t6;
602805
- if ($[10] !== message.id || $[11] !== t2 || $[12] !== t3 || $[13] !== t5) {
602806
- t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
603130
+ $[5] = t2;
603131
+ $[6] = t3;
603132
+ } else t3 = $[6];
603133
+ let t4;
603134
+ if ($[7] !== message.id || $[8] !== t0 || $[9] !== t1 || $[10] !== t3) {
603135
+ t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
602807
603136
  marginBottom: 1,
602808
603137
  paddingLeft: 2,
602809
603138
  paddingRight: 2,
@@ -602814,164 +603143,164 @@ const MessageBlockView = (0, import_react.memo)((props) => {
602814
603143
  borderTop: false,
602815
603144
  borderBottom: false,
602816
603145
  borderColor: "green",
602817
- backgroundColor: t2,
603146
+ backgroundColor: t0,
602818
603147
  flexDirection: "column",
602819
603148
  "aria-role": "listitem",
602820
- "aria-label": t3,
602821
- children: t5
603149
+ "aria-label": t1,
603150
+ children: t3
602822
603151
  }, message.id);
602823
- $[10] = message.id;
602824
- $[11] = t2;
602825
- $[12] = t3;
602826
- $[13] = t5;
602827
- $[14] = t6;
602828
- } else t6 = $[14];
602829
- inner = t6;
603152
+ $[7] = message.id;
603153
+ $[8] = t0;
603154
+ $[9] = t1;
603155
+ $[10] = t3;
603156
+ $[11] = t4;
603157
+ } else t4 = $[11];
603158
+ inner = t4;
602830
603159
  break bb0;
602831
603160
  }
602832
603161
  case "text": {
602833
- let t2;
602834
- if ($[15] !== message.content || $[16] !== message.id || $[17] !== props.onRender) {
602835
- t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompletedTextBlock, {
603162
+ const t0 = props.highlighted ? theme.highlightBackground : void 0;
603163
+ let t1;
603164
+ if ($[12] !== message.content || $[13] !== message.id || $[14] !== props.onRender) {
603165
+ t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompletedTextBlock, {
602836
603166
  text: message.content,
603167
+ streaming: false,
602837
603168
  onRender: props.onRender
602838
603169
  }, message.id);
602839
- $[15] = message.content;
602840
- $[16] = message.id;
602841
- $[17] = props.onRender;
602842
- $[18] = t2;
602843
- } else t2 = $[18];
602844
- let t3;
602845
- if ($[19] !== flashBg || $[20] !== t2) {
602846
- t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
603170
+ $[12] = message.content;
603171
+ $[13] = message.id;
603172
+ $[14] = props.onRender;
603173
+ $[15] = t1;
603174
+ } else t1 = $[15];
603175
+ let t2;
603176
+ if ($[16] !== t0 || $[17] !== t1) {
603177
+ t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
602847
603178
  flexDirection: "column",
602848
- backgroundColor: flashBg,
603179
+ backgroundColor: t0,
602849
603180
  "aria-role": "listitem",
602850
- children: t2
603181
+ children: t1
602851
603182
  });
602852
- $[19] = flashBg;
602853
- $[20] = t2;
602854
- $[21] = t3;
602855
- } else t3 = $[21];
602856
- inner = t3;
603183
+ $[16] = t0;
603184
+ $[17] = t1;
603185
+ $[18] = t2;
603186
+ } else t2 = $[18];
603187
+ inner = t2;
602857
603188
  break bb0;
602858
603189
  }
602859
603190
  case "tool": {
602860
603191
  const toolMsg = message;
602861
- const t2 = toolMsg.input;
602862
- let t3;
602863
- if ($[22] !== t2 || $[23] !== toolMsg.toolName) {
602864
- t3 = getToolAriaProps(toolMsg.toolName, t2);
602865
- $[22] = t2;
602866
- $[23] = toolMsg.toolName;
602867
- $[24] = t3;
602868
- } else t3 = $[24];
602869
- const { ariaHidden, ariaLabel } = t3;
602870
- const t4 = ariaHidden || void 0;
602871
- let t5;
602872
- if ($[25] !== message.id || $[26] !== props.onRender || $[27] !== toolMsg) {
602873
- t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallCompleted, {
603192
+ const t0 = toolMsg.input;
603193
+ let t1;
603194
+ if ($[19] !== t0 || $[20] !== toolMsg.toolName) {
603195
+ t1 = getToolAriaProps(toolMsg.toolName, t0);
603196
+ $[19] = t0;
603197
+ $[20] = toolMsg.toolName;
603198
+ $[21] = t1;
603199
+ } else t1 = $[21];
603200
+ const { ariaHidden, ariaLabel } = t1;
603201
+ const t2 = props.highlighted ? theme.highlightBackground : void 0;
603202
+ const t3 = ariaHidden || void 0;
603203
+ let t4;
603204
+ if ($[22] !== message.id || $[23] !== props.onRender || $[24] !== toolMsg) {
603205
+ t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolCallCompleted, {
602874
603206
  tool: toolMsg,
602875
603207
  onRender: props.onRender
602876
603208
  }, message.id);
602877
- $[25] = message.id;
602878
- $[26] = props.onRender;
602879
- $[27] = toolMsg;
602880
- $[28] = t5;
602881
- } else t5 = $[28];
602882
- let t6;
602883
- if ($[29] !== ariaLabel || $[30] !== flashBg || $[31] !== t4 || $[32] !== t5) {
602884
- t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
603209
+ $[22] = message.id;
603210
+ $[23] = props.onRender;
603211
+ $[24] = toolMsg;
603212
+ $[25] = t4;
603213
+ } else t4 = $[25];
603214
+ let t5;
603215
+ if ($[26] !== ariaLabel || $[27] !== t2 || $[28] !== t3 || $[29] !== t4) {
603216
+ t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
602885
603217
  flexDirection: "column",
602886
- backgroundColor: flashBg,
602887
- "aria-hidden": t4,
603218
+ backgroundColor: t2,
603219
+ "aria-hidden": t3,
602888
603220
  "aria-label": ariaLabel,
602889
- children: t5
603221
+ children: t4
602890
603222
  });
602891
- $[29] = ariaLabel;
602892
- $[30] = flashBg;
602893
- $[31] = t4;
602894
- $[32] = t5;
602895
- $[33] = t6;
602896
- } else t6 = $[33];
602897
- inner = t6;
603223
+ $[26] = ariaLabel;
603224
+ $[27] = t2;
603225
+ $[28] = t3;
603226
+ $[29] = t4;
603227
+ $[30] = t5;
603228
+ } else t5 = $[30];
603229
+ inner = t5;
602898
603230
  break bb0;
602899
603231
  }
602900
603232
  case "thinking": {
602901
- let t2;
602902
- if ($[34] !== message.content || $[35] !== message.id || $[36] !== message.streaming || $[37] !== props.onRender) {
602903
- t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThinkingBlock, {
603233
+ const t0 = props.highlighted ? theme.highlightBackground : void 0;
603234
+ let t1;
603235
+ if ($[31] !== message.content || $[32] !== message.id || $[33] !== message.startedAt || $[34] !== message.streaming || $[35] !== props.onRender) {
603236
+ t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThinkingBlock, {
602904
603237
  text: message.content,
602905
603238
  streaming: message.streaming,
603239
+ startedAt: message.startedAt,
602906
603240
  onRender: props.onRender
602907
603241
  }, message.id);
602908
- $[34] = message.content;
602909
- $[35] = message.id;
602910
- $[36] = message.streaming;
602911
- $[37] = props.onRender;
602912
- $[38] = t2;
602913
- } else t2 = $[38];
602914
- let t3;
602915
- if ($[39] !== flashBg || $[40] !== t2) {
602916
- t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
603242
+ $[31] = message.content;
603243
+ $[32] = message.id;
603244
+ $[33] = message.startedAt;
603245
+ $[34] = message.streaming;
603246
+ $[35] = props.onRender;
603247
+ $[36] = t1;
603248
+ } else t1 = $[36];
603249
+ let t2;
603250
+ if ($[37] !== t0 || $[38] !== t1) {
603251
+ t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
602917
603252
  flexDirection: "column",
602918
- backgroundColor: flashBg,
603253
+ backgroundColor: t0,
602919
603254
  "aria-hidden": true,
602920
- children: t2
603255
+ children: t1
602921
603256
  });
602922
- $[39] = flashBg;
602923
- $[40] = t2;
602924
- $[41] = t3;
602925
- } else t3 = $[41];
602926
- inner = t3;
603257
+ $[37] = t0;
603258
+ $[38] = t1;
603259
+ $[39] = t2;
603260
+ } else t2 = $[39];
603261
+ inner = t2;
602927
603262
  break bb0;
602928
603263
  }
602929
603264
  case "idle": {
602930
603265
  const idleMsg = message;
602931
- let t2;
602932
- if ($[42] !== idleMsg.durationMs) {
602933
- t2 = formatDuration(idleMsg.durationMs);
602934
- $[42] = idleMsg.durationMs;
602935
- $[43] = t2;
602936
- } else t2 = $[43];
602937
- const idleDuration = t2;
603266
+ let t0;
603267
+ if ($[40] !== idleMsg.durationMs) {
603268
+ t0 = formatDuration(idleMsg.durationMs);
603269
+ $[40] = idleMsg.durationMs;
603270
+ $[41] = t0;
603271
+ } else t0 = $[41];
603272
+ const idleDuration = t0;
602938
603273
  const idleAriaLabel = idleMsg.state === "error" ? `Failed after ${idleDuration}` : idleMsg.state === "abort" ? `Interrupted after ${idleDuration}` : `Worked for ${idleDuration}`;
603274
+ const t1 = props.highlighted ? theme.highlightBackground : void 0;
603275
+ let t2;
603276
+ if ($[42] !== idleMsg || $[43] !== message.id) {
603277
+ t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IdleBlock, { message: idleMsg }, message.id);
603278
+ $[42] = idleMsg;
603279
+ $[43] = message.id;
603280
+ $[44] = t2;
603281
+ } else t2 = $[44];
602939
603282
  let t3;
602940
- if ($[44] !== idleMsg || $[45] !== message.id) {
602941
- t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IdleBlock, { message: idleMsg }, message.id);
602942
- $[44] = idleMsg;
602943
- $[45] = message.id;
602944
- $[46] = t3;
602945
- } else t3 = $[46];
602946
- let t4;
602947
- if ($[47] !== flashBg || $[48] !== idleAriaLabel || $[49] !== t3) {
602948
- t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
603283
+ if ($[45] !== idleAriaLabel || $[46] !== t1 || $[47] !== t2) {
603284
+ t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
602949
603285
  flexDirection: "column",
602950
- backgroundColor: flashBg,
603286
+ backgroundColor: t1,
602951
603287
  "aria-role": "listitem",
602952
603288
  "aria-label": idleAriaLabel,
602953
- children: t3
603289
+ children: t2
602954
603290
  });
602955
- $[47] = flashBg;
602956
- $[48] = idleAriaLabel;
602957
- $[49] = t3;
602958
- $[50] = t4;
602959
- } else t4 = $[50];
602960
- inner = t4;
603291
+ $[45] = idleAriaLabel;
603292
+ $[46] = t1;
603293
+ $[47] = t2;
603294
+ $[48] = t3;
603295
+ } else t3 = $[48];
603296
+ inner = t3;
602961
603297
  break bb0;
602962
603298
  }
602963
- default: {
602964
- let t2;
602965
- if ($[51] === Symbol.for("react.memo_cache_sentinel")) {
602966
- t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
602967
- $[51] = t2;
602968
- } else t2 = $[51];
602969
- return t2;
602970
- }
603299
+ default: throw new Error(`Unknown message type: ${message}`);
602971
603300
  }
602972
- let t2;
602973
- if ($[52] !== flash || $[53] !== theme) {
602974
- t2 = flash && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
603301
+ let t0;
603302
+ if ($[49] !== props.highlighted || $[50] !== theme) {
603303
+ t0 = props.highlighted && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
602975
603304
  position: "absolute",
602976
603305
  top: 0,
602977
603306
  right: 0,
@@ -602987,21 +603316,21 @@ const MessageBlockView = (0, import_react.memo)((props) => {
602987
603316
  children: "✓ Copied"
602988
603317
  })
602989
603318
  });
602990
- $[52] = flash;
602991
- $[53] = theme;
602992
- $[54] = t2;
602993
- } else t2 = $[54];
602994
- let t3;
602995
- if ($[55] !== inner || $[56] !== t2) {
602996
- t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
603319
+ $[49] = props.highlighted;
603320
+ $[50] = theme;
603321
+ $[51] = t0;
603322
+ } else t0 = $[51];
603323
+ let t1;
603324
+ if ($[52] !== inner || $[53] !== t0) {
603325
+ t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
602997
603326
  position: "relative",
602998
- children: [inner, t2]
603327
+ children: [inner, t0]
602999
603328
  });
603000
- $[55] = inner;
603001
- $[56] = t2;
603002
- $[57] = t3;
603003
- } else t3 = $[57];
603004
- return t3;
603329
+ $[52] = inner;
603330
+ $[53] = t0;
603331
+ $[54] = t1;
603332
+ } else t1 = $[54];
603333
+ return t1;
603005
603334
  });
603006
603335
  function CompletedTextBlock(t0) {
603007
603336
  const $ = (0, import_compiler_runtime.c)(8);
@@ -603040,36 +603369,62 @@ function CompletedTextBlock(t0) {
603040
603369
  } else t4 = $[7];
603041
603370
  return t4;
603042
603371
  }
603043
- const THINKING_MAX_CHARS = 400;
603044
603372
  function ThinkingBlock(t0) {
603045
- const $ = (0, import_compiler_runtime.c)(16);
603046
- const { text, streaming: t1, onRender } = t0;
603373
+ const $ = (0, import_compiler_runtime.c)(25);
603374
+ const { text, streaming: t1, onRender, startedAt } = t0;
603047
603375
  const streaming = t1 === void 0 ? false : t1;
603048
603376
  let t2;
603049
603377
  if ($[0] !== text) {
603050
- t2 = text.length > THINKING_MAX_CHARS ? "" + text.slice(-THINKING_MAX_CHARS).trimStart() : text;
603378
+ t2 = text.trimEnd().split("\n").pop() ?? "";
603051
603379
  $[0] = text;
603052
603380
  $[1] = t2;
603053
603381
  } else t2 = $[1];
603054
- const preview = t2;
603382
+ const lastParagraph = t2;
603055
603383
  let t3;
603056
- if ($[2] !== onRender) {
603057
- t3 = () => {
603058
- onRender();
603384
+ if ($[2] !== streaming) {
603385
+ t3 = {
603386
+ isActive: streaming,
603387
+ interval: 1e3
603059
603388
  };
603060
- $[2] = onRender;
603389
+ $[2] = streaming;
603061
603390
  $[3] = t3;
603062
603391
  } else t3 = $[3];
603392
+ const { frame } = useAnimation(t3);
603063
603393
  let t4;
603064
- if ($[4] !== preview) {
603065
- t4 = [preview];
603066
- $[4] = preview;
603394
+ if ($[4] !== onRender) {
603395
+ t4 = () => {
603396
+ onRender();
603397
+ };
603398
+ $[4] = onRender;
603067
603399
  $[5] = t4;
603068
603400
  } else t4 = $[5];
603069
- (0, import_react.useEffect)(t3, t4);
603070
603401
  let t5;
603071
- if ($[6] !== streaming) {
603072
- t5 = streaming ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
603402
+ if ($[6] !== lastParagraph) {
603403
+ t5 = [lastParagraph];
603404
+ $[6] = lastParagraph;
603405
+ $[7] = t5;
603406
+ } else t5 = $[7];
603407
+ (0, import_react.useEffect)(t4, t5);
603408
+ let t6;
603409
+ bb0: {
603410
+ if (startedAt == null) {
603411
+ t6 = void 0;
603412
+ break bb0;
603413
+ }
603414
+ const t7 = Math.floor((Date.now() - startedAt) / 1e3) * 1e3;
603415
+ let t8;
603416
+ if ($[8] !== t7) {
603417
+ t8 = formatDuration(t7);
603418
+ $[8] = t7;
603419
+ $[9] = t8;
603420
+ } else t8 = $[9];
603421
+ t6 = `for ${t8}`;
603422
+ }
603423
+ const durationText = t6;
603424
+ let t7;
603425
+ let t8;
603426
+ if ($[10] !== streaming) {
603427
+ t7 = streaming ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
603073
603428
  bold: true,
603074
603429
  color: "cyan",
603075
603430
  "aria-hidden": true,
@@ -603079,53 +603434,73 @@ function ThinkingBlock(t0) {
603079
603434
  "aria-hidden": true,
603080
603435
  children: "◆"
603081
603436
  });
603082
- $[6] = streaming;
603083
- $[7] = t5;
603084
- } else t5 = $[7];
603085
- let t6;
603086
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
603087
- t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
603437
+ t8 = streaming ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
603088
603438
  bold: true,
603089
603439
  dimColor: true,
603090
603440
  children: "Thinking"
603441
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
603442
+ bold: true,
603443
+ children: "Thought"
603091
603444
  });
603092
- $[8] = t6;
603093
- } else t6 = $[8];
603094
- let t7;
603095
- if ($[9] !== t5) {
603096
- t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
603445
+ $[10] = streaming;
603446
+ $[11] = t7;
603447
+ $[12] = t8;
603448
+ } else {
603449
+ t7 = $[11];
603450
+ t8 = $[12];
603451
+ }
603452
+ let t9;
603453
+ if ($[13] !== durationText) {
603454
+ t9 = durationText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
603455
+ dimColor: true,
603456
+ children: durationText
603457
+ });
603458
+ $[13] = durationText;
603459
+ $[14] = t9;
603460
+ } else t9 = $[14];
603461
+ let t10;
603462
+ if ($[15] !== t7 || $[16] !== t8 || $[17] !== t9) {
603463
+ t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
603097
603464
  gap: 1,
603098
- children: [t5, t6]
603465
+ children: [
603466
+ t7,
603467
+ t8,
603468
+ t9
603469
+ ]
603099
603470
  });
603100
- $[9] = t5;
603101
- $[10] = t7;
603102
- } else t7 = $[10];
603103
- let t8;
603104
- if ($[11] !== preview) {
603105
- t8 = preview.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
603471
+ $[15] = t7;
603472
+ $[16] = t8;
603473
+ $[17] = t9;
603474
+ $[18] = t10;
603475
+ } else t10 = $[18];
603476
+ let t11;
603477
+ if ($[19] !== lastParagraph || $[20] !== text.length) {
603478
+ t11 = text.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
603106
603479
  paddingLeft: 2,
603480
+ flexWrap: "wrap",
603107
603481
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
603108
603482
  dimColor: true,
603109
603483
  wrap: "wrap",
603110
- children: preview
603484
+ children: lastParagraph
603111
603485
  })
603112
603486
  });
603113
- $[11] = preview;
603114
- $[12] = t8;
603115
- } else t8 = $[12];
603116
- let t9;
603117
- if ($[13] !== t7 || $[14] !== t8) {
603118
- t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
603487
+ $[19] = lastParagraph;
603488
+ $[20] = text.length;
603489
+ $[21] = t11;
603490
+ } else t11 = $[21];
603491
+ let t12;
603492
+ if ($[22] !== t10 || $[23] !== t11) {
603493
+ t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
603119
603494
  flexDirection: "column",
603120
603495
  paddingX: 1,
603121
603496
  marginY: 1,
603122
- children: [t7, t8]
603497
+ children: [t10, t11]
603123
603498
  });
603124
- $[13] = t7;
603125
- $[14] = t8;
603126
- $[15] = t9;
603127
- } else t9 = $[15];
603128
- return t9;
603499
+ $[22] = t10;
603500
+ $[23] = t11;
603501
+ $[24] = t12;
603502
+ } else t12 = $[24];
603503
+ return t12;
603129
603504
  }
603130
603505
  function formatDuration(ms) {
603131
603506
  if (ms < 1e3) return `${ms}ms`;
@@ -603211,7 +603586,7 @@ function IdleBlock(t0) {
603211
603586
  const summaryText = isError ? `Failed after ${duration}` : isAbort ? `Interrupted after ${duration}` : `${verb} for ${duration}`;
603212
603587
  let t5;
603213
603588
  if ($[6] !== message.applyResults) {
603214
- t5 = message.applyResults.map(_temp$1);
603589
+ t5 = message.applyResults.map(_temp$2);
603215
603590
  $[6] = message.applyResults;
603216
603591
  $[7] = t5;
603217
603592
  } else t5 = $[7];
@@ -603276,7 +603651,7 @@ function IdleBlock(t0) {
603276
603651
  } else t10 = $[23];
603277
603652
  return t10;
603278
603653
  }
603279
- function _temp$1(result) {
603654
+ function _temp$2(result) {
603280
603655
  const { green, red } = buildDots(result.addedLines, result.removedLines);
603281
603656
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
603282
603657
  flexDirection: "row",
@@ -603347,8 +603722,8 @@ var ErrorBoundary = class extends import_react.Component {
603347
603722
  //#endregion
603348
603723
  //#region src/components/CodeSession.tsx
603349
603724
  const CodeSessionWrapper = (0, import_react.memo)((t0) => {
603350
- const $ = (0, import_compiler_runtime.c)(9);
603351
- const { session, onExit, isTabActive: t1 } = t0;
603725
+ const $ = (0, import_compiler_runtime.c)(11);
603726
+ const { session, onExit, isTabActive: t1, updateCheck, credentials } = t0;
603352
603727
  const isTabActive = t1 === void 0 ? true : t1;
603353
603728
  const [proxy, api] = useCodeGenFromSession(session);
603354
603729
  let t2;
@@ -603359,28 +603734,32 @@ const CodeSessionWrapper = (0, import_react.memo)((t0) => {
603359
603734
  $[2] = t2;
603360
603735
  } else t2 = $[2];
603361
603736
  let t3;
603362
- if ($[3] !== isTabActive || $[4] !== onExit) {
603737
+ if ($[3] !== credentials || $[4] !== isTabActive || $[5] !== onExit || $[6] !== updateCheck) {
603363
603738
  t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeSession, {
603364
603739
  onExit,
603365
- isTabActive
603366
- });
603367
- $[3] = isTabActive;
603368
- $[4] = onExit;
603369
- $[5] = t3;
603370
- } else t3 = $[5];
603740
+ isTabActive,
603741
+ updateCheck,
603742
+ credentials
603743
+ });
603744
+ $[3] = credentials;
603745
+ $[4] = isTabActive;
603746
+ $[5] = onExit;
603747
+ $[6] = updateCheck;
603748
+ $[7] = t3;
603749
+ } else t3 = $[7];
603371
603750
  let t4;
603372
- if ($[6] !== t2 || $[7] !== t3) {
603751
+ if ($[8] !== t2 || $[9] !== t3) {
603373
603752
  t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeGenStateContext.Provider, {
603374
603753
  value: t2,
603375
603754
  children: t3
603376
603755
  });
603377
- $[6] = t2;
603378
- $[7] = t3;
603379
- $[8] = t4;
603380
- } else t4 = $[8];
603756
+ $[8] = t2;
603757
+ $[9] = t3;
603758
+ $[10] = t4;
603759
+ } else t4 = $[10];
603381
603760
  return t4;
603382
603761
  });
603383
- const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
603762
+ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, updateCheck, credentials }) => {
603384
603763
  const { stdout } = useStdout();
603385
603764
  const { rows, columns } = useWindowSize();
603386
603765
  const [slashMenuActive, setSlashMenuActive] = (0, import_react.useState)(false);
@@ -603527,7 +603906,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
603527
603906
  queue: true,
603528
603907
  user: {
603529
603908
  role: "user",
603530
- source: "builder.io"
603909
+ source: "builder.io",
603910
+ userId: credentials.userId
603531
603911
  }
603532
603912
  }).catch(() => {});
603533
603913
  break;
@@ -603568,7 +603948,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
603568
603948
  queue: true,
603569
603949
  user: {
603570
603950
  role: "user",
603571
- source: "builder.io"
603951
+ source: "builder.io",
603952
+ userId: credentials.userId
603572
603953
  }
603573
603954
  }).catch(() => {});
603574
603955
  break;
@@ -603607,7 +603988,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
603607
603988
  reasoning: prefs.reasoning,
603608
603989
  user: {
603609
603990
  role: "user",
603610
- source: "builder.io"
603991
+ source: "builder.io",
603992
+ userId: credentials.userId
603611
603993
  },
603612
603994
  ...attachments ? { attachments } : {}
603613
603995
  });
@@ -603627,7 +604009,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
603627
604009
  reasoning: prefs.reasoning,
603628
604010
  user: {
603629
604011
  role: "user",
603630
- source: "builder.io"
604012
+ source: "builder.io",
604013
+ userId: credentials.userId
603631
604014
  }
603632
604015
  });
603633
604016
  userScrolledUp.current = false;
@@ -603640,7 +604023,14 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
603640
604023
  const getOnRenderCallback = (0, import_react.useCallback)((i_0) => {
603641
604024
  let cb = onRenderCallbacksRef.current.get(i_0);
603642
604025
  if (!cb) {
603643
- cb = () => scrollRef.current?.remeasureItem(i_0);
604026
+ cb = () => {
604027
+ if (isTabActive) {
604028
+ scrollRef.current?.remeasureItem(i_0);
604029
+ if (!userScrolledUp.current) setTimeout(() => {
604030
+ scrollRef.current?.scrollToBottom();
604031
+ }, 0);
604032
+ }
604033
+ };
603644
604034
  onRenderCallbacksRef.current.set(i_0, cb);
603645
604035
  }
603646
604036
  return cb;
@@ -603653,9 +604043,9 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
603653
604043
  const termRow = row_0 - 1 - terminalTop;
603654
604044
  if (termRow < 0 || termRow >= viewportHeight) return;
603655
604045
  const contentRow = sv.getScrollOffset() + termRow;
603656
- const visibleCount = messageCount - startIndex + 1;
604046
+ const visibleCount = messageCount - startIndex;
603657
604047
  for (let i_1 = 0; i_1 < visibleCount; i_1++) {
603658
- const pos = sv.getItemPosition(i_1 + 1);
604048
+ const pos = sv.getItemPosition(i_1);
603659
604049
  if (!pos || contentRow < pos.top || contentRow >= pos.top + pos.height) continue;
603660
604050
  const msg = proxy.messages[startIndex + i_1];
603661
604051
  if (!msg) break;
@@ -603707,7 +604097,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
603707
604097
  isTabActive
603708
604098
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusBar, {
603709
604099
  ctrlCPending,
603710
- showSidebar: false
604100
+ showSidebar: false,
604101
+ updateCheck
603711
604102
  })]
603712
604103
  });
603713
604104
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
@@ -603717,7 +604108,6 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
603717
604108
  flexDirection: "column",
603718
604109
  flexGrow: 1,
603719
604110
  paddingRight: 2,
603720
- paddingY: 1,
603721
604111
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
603722
604112
  flexDirection: "column",
603723
604113
  flexGrow: 1,
@@ -603736,38 +604126,21 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
603736
604126
  children: "You can still type below. Use /clear to reset the session."
603737
604127
  })]
603738
604128
  }),
603739
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ScrollView$1, {
604129
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollView$1, {
603740
604130
  ref: scrollRef,
603741
604131
  flexGrow: 1,
603742
604132
  flexDirection: "column",
603743
604133
  width: "100%",
603744
- children: [messageCount === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
603745
- paddingX: 2,
603746
- paddingY: 1,
603747
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
603748
- dimColor: true,
603749
- children: "No messages yet. Type a prompt below to get started."
603750
- })
603751
- }), Array.from({ length: messageCount - startIndex }, (__0, i_2) => {
604134
+ children: Array.from({ length: messageCount - startIndex }, (__0, i_2) => {
603752
604135
  const idx = startIndex + i_2;
603753
604136
  const msgProxy = proxy.messages[idx];
603754
604137
  const msgId = msgProxy.id;
603755
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
603756
- fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
603757
- paddingX: 2,
603758
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
603759
- color: "red",
603760
- dimColor: true,
603761
- children: "[failed to render message]"
603762
- })
603763
- }),
603764
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageBlockView, {
603765
- message: msgProxy,
603766
- highlighted: msgId === highlightedMessageId,
603767
- onRender: getOnRenderCallback(i_2)
603768
- })
603769
- }, `err-${msgId}-${idx}`);
603770
- })]
604138
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageBlockView, {
604139
+ message: msgProxy,
604140
+ highlighted: msgId === highlightedMessageId,
604141
+ onRender: getOnRenderCallback(i_2)
604142
+ }, `${msgId}-${idx}`);
604143
+ })
603771
604144
  })
603772
604145
  })
603773
604146
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
@@ -603814,7 +604187,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
603814
604187
  })] }),
603815
604188
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusBar, {
603816
604189
  ctrlCPending,
603817
- showSidebar
604190
+ showSidebar,
604191
+ updateCheck
603818
604192
  })
603819
604193
  ]
603820
604194
  })]
@@ -605458,6 +605832,7 @@ const KanbanSession = (0, import_react.memo)(({ credentials, isActive, onExit, c
605458
605832
  };
605459
605833
  }, []);
605460
605834
  useInput((input, key) => {
605835
+ if (MOUSE_RE.test(input)) return;
605461
605836
  if (input === "c" && key.ctrl) {
605462
605837
  if (ctrlCPendingRef.current) {
605463
605838
  if (ctrlCTimer.current) clearTimeout(ctrlCTimer.current);
@@ -605704,7 +606079,7 @@ const TabBar = (0, import_react.memo)((t0) => {
605704
606079
  if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
605705
606080
  t8 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
605706
606081
  dimColor: true,
605707
- children: " · Ctrl+] to cycle"
606082
+ children: " · Ctrl+T to cycle"
605708
606083
  });
605709
606084
  $[11] = t8;
605710
606085
  } else t8 = $[11];
@@ -605793,7 +606168,7 @@ function InitErrorScreen(t0) {
605793
606168
  } else t5 = $[7];
605794
606169
  return t5;
605795
606170
  }
605796
- function CodeCommand({ onExit, sys, options }) {
606171
+ function CodeCommand({ onExit, sys, options, updateCheck }) {
605797
606172
  const { exit } = useApp();
605798
606173
  const [initPhase, setInitPhase] = (0, import_react.useState)("loading");
605799
606174
  const [initError, setInitError] = (0, import_react.useState)("");
@@ -605823,8 +606198,8 @@ function CodeCommand({ onExit, sys, options }) {
605823
606198
  process.exit(0);
605824
606199
  }, 100);
605825
606200
  }, [exit, onExit]);
605826
- useInput((input, _key) => {
605827
- if (input === "" && clawEnabled === true) {
606201
+ useInput((input, key) => {
606202
+ if (key.ctrl && input === "t" && clawEnabled === true) {
605828
606203
  setClawHasUnread(false);
605829
606204
  setDisplayMode((prev) => prev === "code" ? "claw" : prev === "claw" ? "kanban" : "code");
605830
606205
  }
@@ -605942,9 +606317,11 @@ function CodeCommand({ onExit, sys, options }) {
605942
606317
  flexGrow: 1,
605943
606318
  display: onCodegen ? "flex" : "none",
605944
606319
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeSessionWrapper, {
606320
+ credentials: credentialsRef.current,
605945
606321
  session: sessionRef.current,
605946
606322
  onExit: cleanup,
605947
- isTabActive: onCodegen
606323
+ isTabActive: onCodegen,
606324
+ updateCheck
605948
606325
  })
605949
606326
  }),
605950
606327
  clawEnabled === true && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
@@ -605976,167 +606353,6 @@ function CodeCommand({ onExit, sys, options }) {
605976
606353
  }
605977
606354
  }
605978
606355
  //#endregion
605979
- //#region src/app.tsx
605980
- function FatalErrorScreen(t0) {
605981
- const $ = (0, import_compiler_runtime.c)(8);
605982
- const { error } = t0;
605983
- const { exit } = useApp();
605984
- let t1;
605985
- if ($[0] !== exit) {
605986
- t1 = (input, key) => {
605987
- if (input === "c" && key.ctrl) {
605988
- exit();
605989
- process.exit(0);
605990
- }
605991
- };
605992
- $[0] = exit;
605993
- $[1] = t1;
605994
- } else t1 = $[1];
605995
- useInput(t1);
605996
- let t2;
605997
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
605998
- t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
605999
- color: "red",
606000
- bold: true,
606001
- children: "Fatal render error"
606002
- });
606003
- $[2] = t2;
606004
- } else t2 = $[2];
606005
- let t3;
606006
- if ($[3] !== error.message) {
606007
- t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
606008
- color: "red",
606009
- children: error.message
606010
- });
606011
- $[3] = error.message;
606012
- $[4] = t3;
606013
- } else t3 = $[4];
606014
- let t4;
606015
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
606016
- t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
606017
- dimColor: true,
606018
- children: "Press Ctrl+C to exit"
606019
- });
606020
- $[5] = t4;
606021
- } else t4 = $[5];
606022
- let t5;
606023
- if ($[6] !== t3) {
606024
- t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
606025
- flexDirection: "column",
606026
- padding: 1,
606027
- gap: 1,
606028
- children: [
606029
- t2,
606030
- t3,
606031
- t4
606032
- ]
606033
- });
606034
- $[6] = t3;
606035
- $[7] = t5;
606036
- } else t5 = $[7];
606037
- return t5;
606038
- }
606039
- function App(t0) {
606040
- const $ = (0, import_compiler_runtime.c)(12);
606041
- const { command, options, sys, theme } = t0;
606042
- const { exit } = useApp();
606043
- const { rows } = useWindowSize();
606044
- let t1;
606045
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
606046
- t1 = [];
606047
- $[0] = t1;
606048
- } else t1 = $[0];
606049
- (0, import_react.useEffect)(_temp2, t1);
606050
- let t2;
606051
- if ($[1] !== command || $[2] !== exit || $[3] !== options || $[4] !== sys) {
606052
- t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
606053
- fallback: _temp3,
606054
- children: command === "code" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeCommand, {
606055
- onExit: exit,
606056
- sys,
606057
- options
606058
- }) : command === "launch" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
606059
- flexDirection: "column",
606060
- paddingX: 1,
606061
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
606062
- color: "yellow",
606063
- children: "Launch command coming soon. Use: npx builder.io@latest launch"
606064
- })
606065
- }) : command === "index-repo" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
606066
- flexDirection: "column",
606067
- paddingX: 1,
606068
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
606069
- color: "yellow",
606070
- children: "Repo indexing coming soon. Use: npx builder.io@latest index-repo"
606071
- })
606072
- }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
606073
- flexDirection: "column",
606074
- paddingX: 1,
606075
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
606076
- color: "red",
606077
- children: ["Unknown command: ", command]
606078
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
606079
- dimColor: true,
606080
- children: "Run builder --help for usage information"
606081
- })]
606082
- })
606083
- });
606084
- $[1] = command;
606085
- $[2] = exit;
606086
- $[3] = options;
606087
- $[4] = sys;
606088
- $[5] = t2;
606089
- } else t2 = $[5];
606090
- let t3;
606091
- if ($[6] !== rows || $[7] !== t2) {
606092
- t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
606093
- flexDirection: "column",
606094
- height: rows,
606095
- children: t2
606096
- });
606097
- $[6] = rows;
606098
- $[7] = t2;
606099
- $[8] = t3;
606100
- } else t3 = $[8];
606101
- let t4;
606102
- if ($[9] !== t3 || $[10] !== theme) {
606103
- t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext$1.Provider, {
606104
- value: theme,
606105
- children: t3
606106
- });
606107
- $[9] = t3;
606108
- $[10] = theme;
606109
- $[11] = t4;
606110
- } else t4 = $[11];
606111
- return t4;
606112
- }
606113
- function _temp3(error) {
606114
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FatalErrorScreen, { error });
606115
- }
606116
- function _temp2() {
606117
- enableSgrMouse();
606118
- return _temp;
606119
- }
606120
- function _temp() {
606121
- resetTerminal();
606122
- }
606123
- //#endregion
606124
- //#region src/sentry.ts
606125
- function initSentry() {
606126
- init({
606127
- dsn: "https://1c5033d697e0271ebe53773bff826de0@o117565.ingest.us.sentry.io/4511107776905216",
606128
- tracesSampleRate: 0,
606129
- release: "0.4.1",
606130
- environment: process.env.NODE_ENV ?? "development",
606131
- enabled: false,
606132
- registerEsmLoaderHooks: false,
606133
- normalizeDepth: 5,
606134
- maxValueLength: 1500,
606135
- integrations: [extraErrorDataIntegration()],
606136
- tracePropagationTargets: []
606137
- });
606138
- }
606139
- //#endregion
606140
606356
  //#region src/updater.ts
606141
606357
  const REGISTRY_BASE = "https://registry.npmjs.org/@builder.io";
606142
606358
  const CHECK_INTERVAL_MS = 1440 * 60 * 1e3;
@@ -606150,7 +606366,7 @@ function isStandaloneBinary() {
606150
606366
  return !path$6.basename(process.execPath, ".exe").startsWith("node");
606151
606367
  }
606152
606368
  function getCurrentVersion() {
606153
- return "0.4.1";
606369
+ return "0.4.3";
606154
606370
  }
606155
606371
  async function fetchLatestVersion() {
606156
606372
  return new Promise((resolve, reject) => {
@@ -606197,8 +606413,8 @@ function isNewerVersion(a, b) {
606197
606413
  }
606198
606414
  /**
606199
606415
  * Checks npm registry for a newer version of fusion (at most once per 24h).
606200
- * Returns a notification string if an update is available, null otherwise.
606201
- * Never throws — update checks should never interrupt normal usage.
606416
+ * Returns the current and latest versions when an update is available, null
606417
+ * otherwise. Never throws — update checks should never interrupt normal usage.
606202
606418
  */
606203
606419
  async function runUpdateCheck() {
606204
606420
  if (!isStandaloneBinary()) return null;
@@ -606215,7 +606431,10 @@ async function runUpdateCheck() {
606215
606431
  });
606216
606432
  }
606217
606433
  const current = getCurrentVersion();
606218
- if (isNewerVersion(latestVersion, current)) return `Update available: ${current} → ${latestVersion}\nRun \`builder update\` to install.`;
606434
+ if (isNewerVersion(latestVersion, current)) return {
606435
+ currentVersion: current,
606436
+ latestVersion
606437
+ };
606219
606438
  } catch {}
606220
606439
  return null;
606221
606440
  }
@@ -606358,26 +606577,258 @@ async function downloadFile(url, dest, onRequest) {
606358
606577
  });
606359
606578
  }
606360
606579
  //#endregion
606580
+ //#region src/hooks/useUpdateCheck.ts
606581
+ /**
606582
+ * Runs the update check once on mount and returns a structured state object
606583
+ * describing whether a newer version of the CLI is available.
606584
+ *
606585
+ * - `checking` — the async check is still in progress
606586
+ * - `up-to-date` — the CLI is already on the latest version (or the check
606587
+ * doesn't apply, e.g. running via npx)
606588
+ * - `upgrade` — a newer version is available; `newVersion` holds the latest
606589
+ */
606590
+ function useUpdateCheck() {
606591
+ const $ = (0, import_compiler_runtime.c)(3);
606592
+ let t0;
606593
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
606594
+ t0 = {
606595
+ status: "checking",
606596
+ currentVersion: getCurrentVersion(),
606597
+ newVersion: ""
606598
+ };
606599
+ $[0] = t0;
606600
+ } else t0 = $[0];
606601
+ const [state, setState] = (0, import_react.useState)(t0);
606602
+ let t1;
606603
+ let t2;
606604
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
606605
+ t1 = () => {
606606
+ runUpdateCheck().then((result) => {
606607
+ if (result) setState({
606608
+ status: "upgrade",
606609
+ currentVersion: result.currentVersion,
606610
+ newVersion: result.latestVersion
606611
+ });
606612
+ else setState(_temp$1);
606613
+ }).catch(() => {
606614
+ setState(_temp2$1);
606615
+ });
606616
+ };
606617
+ t2 = [];
606618
+ $[1] = t1;
606619
+ $[2] = t2;
606620
+ } else {
606621
+ t1 = $[1];
606622
+ t2 = $[2];
606623
+ }
606624
+ (0, import_react.useEffect)(t1, t2);
606625
+ return state;
606626
+ }
606627
+ function _temp2$1(prev_0) {
606628
+ return {
606629
+ ...prev_0,
606630
+ status: "up-to-date"
606631
+ };
606632
+ }
606633
+ function _temp$1(prev) {
606634
+ return {
606635
+ ...prev,
606636
+ status: "up-to-date"
606637
+ };
606638
+ }
606639
+ //#endregion
606640
+ //#region src/app.tsx
606641
+ function FatalErrorScreen(t0) {
606642
+ const $ = (0, import_compiler_runtime.c)(8);
606643
+ const { error } = t0;
606644
+ const { exit } = useApp();
606645
+ let t1;
606646
+ if ($[0] !== exit) {
606647
+ t1 = (input, key) => {
606648
+ if (input === "c" && key.ctrl) {
606649
+ exit();
606650
+ process.exit(0);
606651
+ }
606652
+ };
606653
+ $[0] = exit;
606654
+ $[1] = t1;
606655
+ } else t1 = $[1];
606656
+ useInput(t1);
606657
+ let t2;
606658
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
606659
+ t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
606660
+ color: "red",
606661
+ bold: true,
606662
+ children: "Fatal render error"
606663
+ });
606664
+ $[2] = t2;
606665
+ } else t2 = $[2];
606666
+ let t3;
606667
+ if ($[3] !== error.message) {
606668
+ t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
606669
+ color: "red",
606670
+ children: error.message
606671
+ });
606672
+ $[3] = error.message;
606673
+ $[4] = t3;
606674
+ } else t3 = $[4];
606675
+ let t4;
606676
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
606677
+ t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
606678
+ dimColor: true,
606679
+ children: "Press Ctrl+C to exit"
606680
+ });
606681
+ $[5] = t4;
606682
+ } else t4 = $[5];
606683
+ let t5;
606684
+ if ($[6] !== t3) {
606685
+ t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
606686
+ flexDirection: "column",
606687
+ padding: 1,
606688
+ gap: 1,
606689
+ children: [
606690
+ t2,
606691
+ t3,
606692
+ t4
606693
+ ]
606694
+ });
606695
+ $[6] = t3;
606696
+ $[7] = t5;
606697
+ } else t5 = $[7];
606698
+ return t5;
606699
+ }
606700
+ function App(t0) {
606701
+ const $ = (0, import_compiler_runtime.c)(13);
606702
+ const { command, options, sys, theme } = t0;
606703
+ const { exit } = useApp();
606704
+ const { rows } = useWindowSize();
606705
+ const updateCheck = useUpdateCheck();
606706
+ let t1;
606707
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
606708
+ t1 = [];
606709
+ $[0] = t1;
606710
+ } else t1 = $[0];
606711
+ (0, import_react.useEffect)(_temp2, t1);
606712
+ let t2;
606713
+ if ($[1] !== command || $[2] !== exit || $[3] !== options || $[4] !== sys || $[5] !== updateCheck) {
606714
+ t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
606715
+ fallback: _temp3,
606716
+ children: command === "code" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeCommand, {
606717
+ onExit: exit,
606718
+ sys,
606719
+ options,
606720
+ updateCheck
606721
+ }) : command === "launch" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
606722
+ flexDirection: "column",
606723
+ paddingX: 1,
606724
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
606725
+ color: "yellow",
606726
+ children: "Launch command coming soon. Use: npx builder.io@latest launch"
606727
+ })
606728
+ }) : command === "index-repo" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
606729
+ flexDirection: "column",
606730
+ paddingX: 1,
606731
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
606732
+ color: "yellow",
606733
+ children: "Repo indexing coming soon. Use: npx builder.io@latest index-repo"
606734
+ })
606735
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
606736
+ flexDirection: "column",
606737
+ paddingX: 1,
606738
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
606739
+ color: "red",
606740
+ children: ["Unknown command: ", command]
606741
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
606742
+ dimColor: true,
606743
+ children: "Run builder --help for usage information"
606744
+ })]
606745
+ })
606746
+ });
606747
+ $[1] = command;
606748
+ $[2] = exit;
606749
+ $[3] = options;
606750
+ $[4] = sys;
606751
+ $[5] = updateCheck;
606752
+ $[6] = t2;
606753
+ } else t2 = $[6];
606754
+ let t3;
606755
+ if ($[7] !== rows || $[8] !== t2) {
606756
+ t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
606757
+ flexDirection: "column",
606758
+ height: rows,
606759
+ children: t2
606760
+ });
606761
+ $[7] = rows;
606762
+ $[8] = t2;
606763
+ $[9] = t3;
606764
+ } else t3 = $[9];
606765
+ let t4;
606766
+ if ($[10] !== t3 || $[11] !== theme) {
606767
+ t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext$1.Provider, {
606768
+ value: theme,
606769
+ children: t3
606770
+ });
606771
+ $[10] = t3;
606772
+ $[11] = theme;
606773
+ $[12] = t4;
606774
+ } else t4 = $[12];
606775
+ return t4;
606776
+ }
606777
+ function _temp3(error) {
606778
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FatalErrorScreen, { error });
606779
+ }
606780
+ function _temp2() {
606781
+ enableSgrMouse();
606782
+ return _temp;
606783
+ }
606784
+ function _temp() {
606785
+ resetTerminal();
606786
+ }
606787
+ //#endregion
606788
+ //#region src/sentry.ts
606789
+ function initSentry() {
606790
+ init({
606791
+ dsn: "https://1c5033d697e0271ebe53773bff826de0@o117565.ingest.us.sentry.io/4511107776905216",
606792
+ tracesSampleRate: 0,
606793
+ release: "0.4.3",
606794
+ environment: process.env.NODE_ENV ?? "development",
606795
+ enabled: false,
606796
+ registerEsmLoaderHooks: false,
606797
+ normalizeDepth: 5,
606798
+ maxValueLength: 1500,
606799
+ integrations: [extraErrorDataIntegration()],
606800
+ tracePropagationTargets: []
606801
+ });
606802
+ }
606803
+ //#endregion
606361
606804
  //#region src/cli.tsx
606362
- const VERSION = "0.4.1";
606805
+ const VERSION = "0.4.3";
606363
606806
  async function startInk(command, options) {
606807
+ const sys = await createDevToolsNodeSys({
606808
+ cwd: process.cwd(),
606809
+ ignoreMissingConfig: true
606810
+ });
606811
+ const logFile = process.env.FUSION_LOG_FILE;
606812
+ const theme = detectTheme(await queryOsc11());
606813
+ const file = typeof logFile === "string" ? fs.createWriteStream(logFile) : void 0;
606814
+ const restore = patchConsole((_, data) => {
606815
+ file?.write(data);
606816
+ });
606364
606817
  await render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
606365
606818
  command,
606366
606819
  options,
606367
- sys: await createDevToolsNodeSys({
606368
- cwd: process.cwd(),
606369
- ignoreMissingConfig: true
606370
- }),
606371
- theme: detectTheme(await queryOsc11())
606820
+ sys,
606821
+ theme
606372
606822
  }), {
606373
606823
  exitOnCtrlC: false,
606374
606824
  incrementalRendering: true,
606375
606825
  maxFps: 30,
606376
- patchConsole: true,
606826
+ patchConsole: false,
606377
606827
  concurrent: false,
606378
- alternateScreen: true,
606379
- isScreenReaderEnabled: process.env["INK_SCREEN_READER"] === "true"
606828
+ alternateScreen: true
606380
606829
  }).waitUntilExit();
606830
+ file?.end();
606831
+ restore();
606381
606832
  await flush(2e3);
606382
606833
  }
606383
606834
  const program = new Command().name("fusion").version(VERSION, "-v, --version").description("Builder.io Fusion CLI — AI-powered code generation");
@@ -606404,9 +606855,6 @@ process.on("uncaughtException", (error) => {
606404
606855
  captureException(error);
606405
606856
  throw error;
606406
606857
  });
606407
- runUpdateCheck().then((msg) => {
606408
- if (msg) process.stderr.write(`\n${msg}\n\n`);
606409
- }).catch(() => {});
606410
606858
  await program.parseAsync();
606411
606859
  //#endregion
606412
606860
  export {};