@builder.io/buildercode 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +788 -473
- 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.
|
|
@@ -245033,7 +245108,7 @@ const LIB_CACHE = /* @__PURE__ */ new Map();
|
|
|
245033
245108
|
const PENDING_LIB_CACHE = /* @__PURE__ */ new Map();
|
|
245034
245109
|
const NODE_MODULE_CACHE = /* @__PURE__ */ new Map();
|
|
245035
245110
|
const TSCONFIG_CACHE = /* @__PURE__ */ new Map();
|
|
245036
|
-
const pkgVersion = process.env.OVERRIDE_VERSION ?? "0.4.
|
|
245111
|
+
const pkgVersion = process.env.OVERRIDE_VERSION ?? "0.4.2";
|
|
245037
245112
|
//#endregion
|
|
245038
245113
|
//#region ../dev-tools/core/detect-frameworks.ts
|
|
245039
245114
|
async function detectFrameworks$1(sys) {
|
|
@@ -290975,7 +291050,7 @@ function wc$1({ parent: e }) {
|
|
|
290975
291050
|
default: return !1;
|
|
290976
291051
|
}
|
|
290977
291052
|
}
|
|
290978
|
-
function _c$
|
|
291053
|
+
function _c$26({ parent: e, grandparent: t }) {
|
|
290979
291054
|
return t?.type === "JSXAttribute" && e.type === "JSXExpressionContainer" && t.name.type === "JSXIdentifier" && t.name.name === "css";
|
|
290980
291055
|
}
|
|
290981
291056
|
async function co(e, t, r) {
|
|
@@ -295991,7 +296066,7 @@ var init_estree = __esmMin((() => {
|
|
|
295991
296066
|
(e, t) => e.type === "CallExpression" && e.callee.type === "Identifier" && e.callee.name === "Component" && t === "arguments",
|
|
295992
296067
|
(e, t) => e.type === "Decorator" && t === "expression"
|
|
295993
296068
|
];
|
|
295994
|
-
po$1 = (e) => Oc$1(e) || wc$1(e) || _c$
|
|
296069
|
+
po$1 = (e) => Oc$1(e) || wc$1(e) || _c$26(e) || oo$2(e);
|
|
295995
296070
|
Es$6 = 0;
|
|
295996
296071
|
fo = mo.bind(void 0, "html"), yo = mo.bind(void 0, "angular");
|
|
295997
296072
|
jc = [
|
|
@@ -400168,7 +400243,7 @@ function xc(t, e, s = {}) {
|
|
|
400168
400243
|
let r = It(t, s.backwards ? e - 1 : e, s);
|
|
400169
400244
|
return r !== Gt(t, r, s);
|
|
400170
400245
|
}
|
|
400171
|
-
function _c$
|
|
400246
|
+
function _c$25(t, e) {
|
|
400172
400247
|
if (e === !1) return !1;
|
|
400173
400248
|
if (t.charAt(e) === "/" && t.charAt(e + 1) === "*") {
|
|
400174
400249
|
for (let s = e + 2; s < t.length; ++s) if (t.charAt(s) === "*" && t.charAt(s + 1) === "/") return s + 2;
|
|
@@ -405993,7 +406068,7 @@ https://evilmartians.com/chronicles/postcss-8-plugin-migration`));
|
|
|
405993
406068
|
` || t === "\r" || t === "\u2028" || t === "\u2029";
|
|
405994
406069
|
Gt = vc;
|
|
405995
406070
|
Yt = xc;
|
|
405996
|
-
xi$1 = _c$
|
|
406071
|
+
xi$1 = _c$25;
|
|
405997
406072
|
_i = bc;
|
|
405998
406073
|
Vt$1 = Ec;
|
|
405999
406074
|
De = Oc;
|
|
@@ -531515,6 +531590,7 @@ async function getAgent(url) {
|
|
|
531515
531590
|
}
|
|
531516
531591
|
return _agent || new import_undici.Agent({ connect: { rejectUnauthorized } });
|
|
531517
531592
|
}
|
|
531593
|
+
let lastGetSetCookie = void 0;
|
|
531518
531594
|
const safeFetch = async (input, init, debug) => {
|
|
531519
531595
|
const urlObj = new URL(input);
|
|
531520
531596
|
const hostname = urlObj.hostname;
|
|
@@ -531532,9 +531608,11 @@ const safeFetch = async (input, init, debug) => {
|
|
|
531532
531608
|
headers: {
|
|
531533
531609
|
...init?.headers,
|
|
531534
531610
|
...getUserAgent(),
|
|
531535
|
-
...traceData
|
|
531611
|
+
...traceData,
|
|
531612
|
+
...lastGetSetCookie ? { Cookie: lastGetSetCookie.join("; ") } : {}
|
|
531536
531613
|
}
|
|
531537
531614
|
});
|
|
531615
|
+
lastGetSetCookie = response.headers.getSetCookie();
|
|
531538
531616
|
outcome = `status: ${response.status}`;
|
|
531539
531617
|
if (!response.ok) {
|
|
531540
531618
|
if (response.status === 402) {
|
|
@@ -534467,6 +534545,80 @@ function getNextLineIndex(text, cursor) {
|
|
|
534467
534545
|
for (let i = 0; i <= lineIdx; i++) newIdx += lines[i].length + 1;
|
|
534468
534546
|
return newIdx + Math.min(col, targetLine.length);
|
|
534469
534547
|
}
|
|
534548
|
+
/**
|
|
534549
|
+
* Split `text` into visual lines of at most `width` characters each,
|
|
534550
|
+
* returning the character-index range [start, end) for each visual row.
|
|
534551
|
+
* Hard newlines (\n) always create a new visual line.
|
|
534552
|
+
*/
|
|
534553
|
+
function getVisualLines(text, width) {
|
|
534554
|
+
if (width <= 0) return [{
|
|
534555
|
+
start: 0,
|
|
534556
|
+
end: text.length
|
|
534557
|
+
}];
|
|
534558
|
+
const result = [];
|
|
534559
|
+
const logicalLines = text.split("\n");
|
|
534560
|
+
let pos = 0;
|
|
534561
|
+
for (let li = 0; li < logicalLines.length; li++) {
|
|
534562
|
+
const line = logicalLines[li];
|
|
534563
|
+
const isLast = li === logicalLines.length - 1;
|
|
534564
|
+
if (line.length === 0) result.push({
|
|
534565
|
+
start: pos,
|
|
534566
|
+
end: pos
|
|
534567
|
+
});
|
|
534568
|
+
else for (let col = 0; col < line.length; col += width) {
|
|
534569
|
+
const segEnd = Math.min(col + width, line.length);
|
|
534570
|
+
result.push({
|
|
534571
|
+
start: pos + col,
|
|
534572
|
+
end: pos + segEnd
|
|
534573
|
+
});
|
|
534574
|
+
}
|
|
534575
|
+
pos += line.length + (isLast ? 0 : 1);
|
|
534576
|
+
}
|
|
534577
|
+
return result;
|
|
534578
|
+
}
|
|
534579
|
+
/**
|
|
534580
|
+
* Find which visual line the cursor is on, searching from the end.
|
|
534581
|
+
*
|
|
534582
|
+
* Searching in reverse means that when a cursor position falls on a
|
|
534583
|
+
* soft-wrap boundary (where segment_i.end === segment_{i+1}.start),
|
|
534584
|
+
* the LATER segment wins — which is visually correct: the cursor at
|
|
534585
|
+
* the first column of a wrapped row belongs to that row, not the one
|
|
534586
|
+
* above. For hard-newline gaps there is no overlap, so the unique
|
|
534587
|
+
* containing segment is always found.
|
|
534588
|
+
*/
|
|
534589
|
+
function findVisualLineIndex(lines, cursor) {
|
|
534590
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
534591
|
+
const vl = lines[i];
|
|
534592
|
+
if (cursor >= vl.start && cursor <= vl.end) return i;
|
|
534593
|
+
}
|
|
534594
|
+
return 0;
|
|
534595
|
+
}
|
|
534596
|
+
function isOnFirstVisualLine(text, cursor, width) {
|
|
534597
|
+
const lines = getVisualLines(text, width);
|
|
534598
|
+
if (lines.length <= 1) return true;
|
|
534599
|
+
return findVisualLineIndex(lines, cursor) === 0;
|
|
534600
|
+
}
|
|
534601
|
+
function isOnLastVisualLine(text, cursor, width) {
|
|
534602
|
+
const lines = getVisualLines(text, width);
|
|
534603
|
+
if (!lines.length) return true;
|
|
534604
|
+
return findVisualLineIndex(lines, cursor) === lines.length - 1;
|
|
534605
|
+
}
|
|
534606
|
+
function getPrevVisualLineIndex(text, cursor, width) {
|
|
534607
|
+
const lines = getVisualLines(text, width);
|
|
534608
|
+
const idx = findVisualLineIndex(lines, cursor);
|
|
534609
|
+
if (idx <= 0) return cursor;
|
|
534610
|
+
const col = cursor - lines[idx].start;
|
|
534611
|
+
const prev = lines[idx - 1];
|
|
534612
|
+
return prev.start + Math.min(col, prev.end - prev.start);
|
|
534613
|
+
}
|
|
534614
|
+
function getNextVisualLineIndex(text, cursor, width) {
|
|
534615
|
+
const lines = getVisualLines(text, width);
|
|
534616
|
+
const idx = findVisualLineIndex(lines, cursor);
|
|
534617
|
+
if (idx >= lines.length - 1) return cursor;
|
|
534618
|
+
const col = cursor - lines[idx].start;
|
|
534619
|
+
const next = lines[idx + 1];
|
|
534620
|
+
return next.start + Math.min(col, next.end - next.start);
|
|
534621
|
+
}
|
|
534470
534622
|
const inputHistory = {
|
|
534471
534623
|
history: [],
|
|
534472
534624
|
historyIndex: -1,
|
|
@@ -534482,7 +534634,7 @@ function useInputHistory() {
|
|
|
534482
534634
|
let t0;
|
|
534483
534635
|
if ($[0] !== forceUpdate) {
|
|
534484
534636
|
t0 = () => {
|
|
534485
|
-
const listener = () => forceUpdate(_temp$
|
|
534637
|
+
const listener = () => forceUpdate(_temp$9);
|
|
534486
534638
|
inputHistory.listeners.add(listener);
|
|
534487
534639
|
return () => {
|
|
534488
534640
|
inputHistory.listeners.delete(listener);
|
|
@@ -534504,7 +534656,7 @@ function useInputHistory() {
|
|
|
534504
534656
|
* characters — either case benefits from a compact inline placeholder rather
|
|
534505
534657
|
* than flooding the input with raw content.
|
|
534506
534658
|
*/
|
|
534507
|
-
function _temp$
|
|
534659
|
+
function _temp$9(n) {
|
|
534508
534660
|
return n + 1;
|
|
534509
534661
|
}
|
|
534510
534662
|
function isBigPaste(text) {
|
|
@@ -534514,24 +534666,16 @@ function makePasteToken(id, lineCount) {
|
|
|
534514
534666
|
return `[Pasted text #${id} +${lineCount} line${lineCount === 1 ? "" : "s"}]`;
|
|
534515
534667
|
}
|
|
534516
534668
|
function useTextInput(options = {}) {
|
|
534517
|
-
const { onSubmit, onChange, onTab, onShiftTab, onPaste, onBackspaceEmpty, isActive = true, getIsMenuActive, submitDisabled = false, disableHistory = false, initialValue = "" } = options;
|
|
534669
|
+
const { onSubmit, onChange, onTab, onShiftTab, onPaste, onBackspaceEmpty, isActive = true, getIsMenuActive, submitDisabled = false, disableHistory = false, initialValue = "", inputWidth = 0 } = options;
|
|
534518
534670
|
const [value, setValueState] = (0, import_react.useState)(initialValue);
|
|
534519
534671
|
const [cursorIndex, setCursorIndex] = (0, import_react.useState)(initialValue.length);
|
|
534520
534672
|
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
534673
|
const valueRef = (0, import_react.useRef)(value);
|
|
534532
534674
|
const cursorRef = (0, import_react.useRef)(cursorIndex);
|
|
534675
|
+
const inputWidthRef = (0, import_react.useRef)(inputWidth);
|
|
534533
534676
|
valueRef.current = value;
|
|
534534
534677
|
cursorRef.current = cursorIndex;
|
|
534678
|
+
inputWidthRef.current = inputWidth;
|
|
534535
534679
|
const pasteMapRef = (0, import_react.useRef)(/* @__PURE__ */ new Map());
|
|
534536
534680
|
const pasteCounterRef = (0, import_react.useRef)(0);
|
|
534537
534681
|
const resolvePaste = (0, import_react.useCallback)((val) => {
|
|
@@ -534579,6 +534723,7 @@ function useTextInput(options = {}) {
|
|
|
534579
534723
|
onChange?.("");
|
|
534580
534724
|
}, [onChange]);
|
|
534581
534725
|
useInput((input, key) => {
|
|
534726
|
+
input = input.replaceAll("\\\r", "\n");
|
|
534582
534727
|
const val_3 = valueRef.current;
|
|
534583
534728
|
const cursor_1 = cursorRef.current;
|
|
534584
534729
|
const { active: isMenuActive, captureSpace } = getIsMenuActive?.() ?? {
|
|
@@ -534609,9 +534754,12 @@ function useTextInput(options = {}) {
|
|
|
534609
534754
|
return;
|
|
534610
534755
|
}
|
|
534611
534756
|
if (key.return && (key.ctrl || key.shift || key.meta)) {
|
|
534612
|
-
const
|
|
534757
|
+
const hasStrayBackslash = cursor_1 > 0 && val_3[cursor_1 - 1] === "\\";
|
|
534758
|
+
const baseVal = hasStrayBackslash ? val_3.slice(0, cursor_1 - 1) + val_3.slice(cursor_1) : val_3;
|
|
534759
|
+
const baseCursor = hasStrayBackslash ? cursor_1 - 1 : cursor_1;
|
|
534760
|
+
const next_1 = baseVal.slice(0, baseCursor) + "\n" + baseVal.slice(baseCursor);
|
|
534613
534761
|
setValueState(next_1);
|
|
534614
|
-
setCursorIndex(
|
|
534762
|
+
setCursorIndex(baseCursor + 1);
|
|
534615
534763
|
onChange?.(next_1);
|
|
534616
534764
|
return;
|
|
534617
534765
|
}
|
|
@@ -534667,11 +534815,12 @@ function useTextInput(options = {}) {
|
|
|
534667
534815
|
return;
|
|
534668
534816
|
}
|
|
534669
534817
|
if (key.upArrow) {
|
|
534670
|
-
|
|
534671
|
-
|
|
534818
|
+
const iw = inputWidthRef.current;
|
|
534819
|
+
if (!(iw > 0 ? isOnFirstVisualLine(val_3, cursor_1, iw) : isOnFirstLine(val_3, cursor_1))) {
|
|
534820
|
+
setCursorIndex(iw > 0 ? getPrevVisualLineIndex(val_3, cursor_1, iw) : getPrevLineIndex(val_3, cursor_1));
|
|
534672
534821
|
return;
|
|
534673
534822
|
}
|
|
534674
|
-
if (!disableHistory) {
|
|
534823
|
+
if (!disableHistory && !val_3.includes("\n")) {
|
|
534675
534824
|
const { history: h, historyIndex: hi } = inputHistory;
|
|
534676
534825
|
const nextIndex = hi + 1;
|
|
534677
534826
|
if (nextIndex < h.length) {
|
|
@@ -534688,11 +534837,12 @@ function useTextInput(options = {}) {
|
|
|
534688
534837
|
return;
|
|
534689
534838
|
}
|
|
534690
534839
|
if (key.downArrow) {
|
|
534691
|
-
|
|
534692
|
-
|
|
534840
|
+
const iw_0 = inputWidthRef.current;
|
|
534841
|
+
if (!(iw_0 > 0 ? isOnLastVisualLine(val_3, cursor_1, iw_0) : isOnLastLine(val_3, cursor_1))) {
|
|
534842
|
+
setCursorIndex(iw_0 > 0 ? getNextVisualLineIndex(val_3, cursor_1, iw_0) : getNextLineIndex(val_3, cursor_1));
|
|
534693
534843
|
return;
|
|
534694
534844
|
}
|
|
534695
|
-
if (!disableHistory) {
|
|
534845
|
+
if (!disableHistory && !val_3.includes("\n")) {
|
|
534696
534846
|
const { history: h_0, historyIndex: hi_0, historyDraft: hd } = inputHistory;
|
|
534697
534847
|
if (hi_0 > 0) {
|
|
534698
534848
|
const nextIndex_0 = hi_0 - 1;
|
|
@@ -534722,16 +534872,14 @@ function useTextInput(options = {}) {
|
|
|
534722
534872
|
setCursorIndex(Math.min(val_3.length, cursor_1 + 1));
|
|
534723
534873
|
return;
|
|
534724
534874
|
}
|
|
534725
|
-
if (key.delete
|
|
534726
|
-
const
|
|
534727
|
-
|
|
534728
|
-
|
|
534729
|
-
|
|
534730
|
-
|
|
534731
|
-
|
|
534732
|
-
|
|
534733
|
-
}
|
|
534734
|
-
} else if (cursor_1 > 0) {
|
|
534875
|
+
if (key.delete && cursor_1 < val_3.length) {
|
|
534876
|
+
const next_5 = val_3.slice(0, cursor_1) + val_3.slice(cursor_1 + 1);
|
|
534877
|
+
setValueState(next_5);
|
|
534878
|
+
onChange?.(next_5);
|
|
534879
|
+
return;
|
|
534880
|
+
}
|
|
534881
|
+
if (key.backspace) {
|
|
534882
|
+
if (cursor_1 > 0) {
|
|
534735
534883
|
const next_6 = val_3.slice(0, cursor_1 - 1) + val_3.slice(cursor_1);
|
|
534736
534884
|
setValueState(next_6);
|
|
534737
534885
|
setCursorIndex(cursor_1 - 1);
|
|
@@ -534739,7 +534887,8 @@ function useTextInput(options = {}) {
|
|
|
534739
534887
|
} else if (val_3.length === 0) onBackspaceEmpty?.();
|
|
534740
534888
|
return;
|
|
534741
534889
|
}
|
|
534742
|
-
|
|
534890
|
+
const code = input.charCodeAt(0);
|
|
534891
|
+
if (input.length === 1 && code < 32 && code !== 10) return;
|
|
534743
534892
|
if (input) {
|
|
534744
534893
|
if (inputHistory.historyIndex !== -1) {
|
|
534745
534894
|
inputHistory.historyIndex = -1;
|
|
@@ -536248,7 +536397,8 @@ function useCodeGenStateHandler() {
|
|
|
536248
536397
|
id: `thinking-${_msgIdCounter++}`,
|
|
536249
536398
|
type: "thinking",
|
|
536250
536399
|
content: step.content ?? "",
|
|
536251
|
-
streaming: true
|
|
536400
|
+
streaming: true,
|
|
536401
|
+
startedAt: Date.now()
|
|
536252
536402
|
});
|
|
536253
536403
|
break;
|
|
536254
536404
|
case "delta": {
|
|
@@ -536695,7 +536845,7 @@ function SlashCommandMenu(t0) {
|
|
|
536695
536845
|
const contextPct = t2;
|
|
536696
536846
|
let t3;
|
|
536697
536847
|
if ($[3] !== state.customInstructions) {
|
|
536698
|
-
t3 = (state.customInstructions ?? []).filter(_temp$
|
|
536848
|
+
t3 = (state.customInstructions ?? []).filter(_temp$8).map(_temp2$5);
|
|
536699
536849
|
$[3] = state.customInstructions;
|
|
536700
536850
|
$[4] = t3;
|
|
536701
536851
|
} else t3 = $[4];
|
|
@@ -537155,14 +537305,14 @@ function _temp4$1(cmd_1) {
|
|
|
537155
537305
|
function _temp3$4(c) {
|
|
537156
537306
|
return c.label.length;
|
|
537157
537307
|
}
|
|
537158
|
-
function _temp2$
|
|
537308
|
+
function _temp2$5(i_0) {
|
|
537159
537309
|
return {
|
|
537160
537310
|
id: i_0.name,
|
|
537161
537311
|
label: `/${i_0.name}`,
|
|
537162
537312
|
description: i_0.description
|
|
537163
537313
|
};
|
|
537164
537314
|
}
|
|
537165
|
-
function _temp$
|
|
537315
|
+
function _temp$8(i) {
|
|
537166
537316
|
return i.isSkill && i.userInvocable !== false && !BUILTIN_COMMAND_IDS.has(i.name);
|
|
537167
537317
|
}
|
|
537168
537318
|
//#endregion
|
|
@@ -537520,6 +537670,8 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
|
|
|
537520
537670
|
setDismissedSlashValue(null);
|
|
537521
537671
|
onChange?.("");
|
|
537522
537672
|
}, [onChange, onSubmit]);
|
|
537673
|
+
const inputBoxRef = (0, import_react.useRef)(null);
|
|
537674
|
+
const { width: inputWidth } = useBoxMetrics(inputBoxRef);
|
|
537523
537675
|
const pasteHandlerRef = (0, import_react.useRef)(() => {});
|
|
537524
537676
|
const { value, cursorIndex, setValue, clear } = useTextInput({
|
|
537525
537677
|
onSubmit: handleSubmitFromHook,
|
|
@@ -537530,6 +537682,7 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
|
|
|
537530
537682
|
getIsMenuActive,
|
|
537531
537683
|
submitDisabled: false,
|
|
537532
537684
|
initialValue,
|
|
537685
|
+
inputWidth,
|
|
537533
537686
|
onPaste: () => void Promise.resolve(pasteHandlerRef.current()).catch(() => {}),
|
|
537534
537687
|
onBackspaceEmpty: pendingAttachments.length > 0 && onRemoveAttachment ? () => {
|
|
537535
537688
|
const last = pendingAttachments[pendingAttachments.length - 1];
|
|
@@ -537640,7 +537793,8 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
|
|
|
537640
537793
|
children: "queued:"
|
|
537641
537794
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
537642
537795
|
color: "yellow",
|
|
537643
|
-
|
|
537796
|
+
wrap: "truncate-end",
|
|
537797
|
+
children: msg.displayPrompt
|
|
537644
537798
|
})]
|
|
537645
537799
|
}, msg.idempotencyKey || i);
|
|
537646
537800
|
})
|
|
@@ -537700,14 +537854,17 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
|
|
|
537700
537854
|
children: "(backspace on empty input to remove)"
|
|
537701
537855
|
})]
|
|
537702
537856
|
}),
|
|
537703
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
537704
|
-
|
|
537705
|
-
|
|
537706
|
-
|
|
537707
|
-
|
|
537708
|
-
|
|
537709
|
-
|
|
537710
|
-
|
|
537857
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
537858
|
+
ref: inputBoxRef,
|
|
537859
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ControlledTextInput, {
|
|
537860
|
+
value,
|
|
537861
|
+
cursorIndex,
|
|
537862
|
+
rows: 1,
|
|
537863
|
+
placeholder: hint,
|
|
537864
|
+
showCursor: true,
|
|
537865
|
+
maxRows: 10
|
|
537866
|
+
})
|
|
537867
|
+
}),
|
|
537711
537868
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
537712
537869
|
columnGap: 1,
|
|
537713
537870
|
flexWrap: "wrap",
|
|
@@ -537776,7 +537933,7 @@ function RewindMode(t0) {
|
|
|
537776
537933
|
if ($[0] !== onCancel || $[1] !== onSelect || $[2] !== selectedIndex || $[3] !== turns) {
|
|
537777
537934
|
t1 = (input, key) => {
|
|
537778
537935
|
if (key.upArrow) {
|
|
537779
|
-
setSelectedIndex(_temp$
|
|
537936
|
+
setSelectedIndex(_temp$7);
|
|
537780
537937
|
return;
|
|
537781
537938
|
}
|
|
537782
537939
|
if (key.downArrow) {
|
|
@@ -537910,7 +538067,7 @@ function RewindMode(t0) {
|
|
|
537910
538067
|
} else t7 = $[16];
|
|
537911
538068
|
return t7;
|
|
537912
538069
|
}
|
|
537913
|
-
function _temp$
|
|
538070
|
+
function _temp$7(i) {
|
|
537914
538071
|
return Math.max(0, i - 1);
|
|
537915
538072
|
}
|
|
537916
538073
|
//#endregion
|
|
@@ -537983,34 +538140,35 @@ const AskUserQuestionDisplay = (0, import_react.memo)(({ onSubmit, onAbort, isTa
|
|
|
537983
538140
|
};
|
|
537984
538141
|
useInput((input, key) => {
|
|
537985
538142
|
const { selectedIndex: selectedIndex_0, activeTabIndex: activeTabIndex_0, question: question_0, allOptions: allOptions_0, questions: questions_0, isConfirmTab: isConfirmTab_0, customMode: customMode_0, customText: customText_0, answers: answers_0 } = latestRef.current;
|
|
538143
|
+
function submitAnswer(rawAnswer) {
|
|
538144
|
+
if (!question_0) return;
|
|
538145
|
+
const nextAnswer = rawAnswer.trim() || "Other";
|
|
538146
|
+
const newAnswers = {
|
|
538147
|
+
...answers_0,
|
|
538148
|
+
[question_0.question]: nextAnswer
|
|
538149
|
+
};
|
|
538150
|
+
setAnswers(newAnswers);
|
|
538151
|
+
setSelectedIndices((prev) => ({
|
|
538152
|
+
...prev,
|
|
538153
|
+
[question_0.question]: getSelectedIndexForAnswer(question_0, nextAnswer)
|
|
538154
|
+
}));
|
|
538155
|
+
setCustomMode(false);
|
|
538156
|
+
setCustomText("");
|
|
538157
|
+
const nextUnanswered = findNextUnansweredIndex(questions_0, newAnswers, activeTabIndex_0 + 1);
|
|
538158
|
+
if (nextUnanswered >= 0) {
|
|
538159
|
+
setActiveTabIndex(nextUnanswered);
|
|
538160
|
+
return;
|
|
538161
|
+
}
|
|
538162
|
+
const firstUnanswered = findFirstUnansweredIndex(questions_0, newAnswers);
|
|
538163
|
+
setActiveTabIndex(firstUnanswered >= 0 ? firstUnanswered : questions_0.length);
|
|
538164
|
+
}
|
|
537986
538165
|
if (input === "c" && key.ctrl) {
|
|
537987
538166
|
onAbort?.();
|
|
537988
538167
|
return;
|
|
537989
538168
|
}
|
|
537990
538169
|
if (customMode_0) {
|
|
537991
|
-
if (key.return)
|
|
537992
|
-
|
|
537993
|
-
const nextAnswer = (customText_0 || "Other").trim() || "Other";
|
|
537994
|
-
const newAnswers = {
|
|
537995
|
-
...answers_0,
|
|
537996
|
-
[question_0.question]: nextAnswer
|
|
537997
|
-
};
|
|
537998
|
-
setAnswers(newAnswers);
|
|
537999
|
-
setSelectedIndices((prev) => ({
|
|
538000
|
-
...prev,
|
|
538001
|
-
[question_0.question]: getSelectedIndexForAnswer(question_0, nextAnswer)
|
|
538002
|
-
}));
|
|
538003
|
-
setCustomMode(false);
|
|
538004
|
-
setCustomText("");
|
|
538005
|
-
const nextUnanswered = findNextUnansweredIndex(questions_0, newAnswers, activeTabIndex_0 + 1);
|
|
538006
|
-
if (nextUnanswered >= 0) {
|
|
538007
|
-
setActiveTabIndex(nextUnanswered);
|
|
538008
|
-
return;
|
|
538009
|
-
}
|
|
538010
|
-
const firstUnanswered = findFirstUnansweredIndex(questions_0, newAnswers);
|
|
538011
|
-
setActiveTabIndex(firstUnanswered >= 0 ? firstUnanswered : questions_0.length);
|
|
538012
|
-
}
|
|
538013
|
-
} else if (key.escape) {
|
|
538170
|
+
if (key.return) submitAnswer(customText_0 || "Other");
|
|
538171
|
+
else if (key.escape) {
|
|
538014
538172
|
setCustomMode(false);
|
|
538015
538173
|
setCustomText("");
|
|
538016
538174
|
} else if (key.backspace || key.delete) setCustomText((text) => text.slice(0, -1));
|
|
@@ -538044,27 +538202,7 @@ const AskUserQuestionDisplay = (0, import_react.memo)(({ onSubmit, onAbort, isTa
|
|
|
538044
538202
|
else if (key.return || input === " ") if (selectedIndex_0 === allOptions_0.length - 1) {
|
|
538045
538203
|
setCustomMode(true);
|
|
538046
538204
|
setCustomText(answers_0[question_0.question] ?? "");
|
|
538047
|
-
} else
|
|
538048
|
-
const nextAnswer_0 = allOptions_0[selectedIndex_0].label.trim() || "Other";
|
|
538049
|
-
const newAnswers_0 = {
|
|
538050
|
-
...answers_0,
|
|
538051
|
-
[question_0.question]: nextAnswer_0
|
|
538052
|
-
};
|
|
538053
|
-
setAnswers(newAnswers_0);
|
|
538054
|
-
setSelectedIndices((prev_2) => ({
|
|
538055
|
-
...prev_2,
|
|
538056
|
-
[question_0.question]: getSelectedIndexForAnswer(question_0, nextAnswer_0)
|
|
538057
|
-
}));
|
|
538058
|
-
setCustomMode(false);
|
|
538059
|
-
setCustomText("");
|
|
538060
|
-
const nextUnanswered_0 = findNextUnansweredIndex(questions_0, newAnswers_0, activeTabIndex_0 + 1);
|
|
538061
|
-
if (nextUnanswered_0 >= 0) {
|
|
538062
|
-
setActiveTabIndex(nextUnanswered_0);
|
|
538063
|
-
return;
|
|
538064
|
-
}
|
|
538065
|
-
const firstUnanswered_0 = findFirstUnansweredIndex(questions_0, newAnswers_0);
|
|
538066
|
-
setActiveTabIndex(firstUnanswered_0 >= 0 ? firstUnanswered_0 : questions_0.length);
|
|
538067
|
-
}
|
|
538205
|
+
} else submitAnswer(allOptions_0[selectedIndex_0].label);
|
|
538068
538206
|
}, { isActive: questions.length > 0 && isTabActive });
|
|
538069
538207
|
const confirmItems = (0, import_react.useMemo)(() => questions.map((item_0, index) => ({
|
|
538070
538208
|
key: item_0.question,
|
|
@@ -538106,17 +538244,17 @@ const AskUserQuestionDisplay = (0, import_react.memo)(({ onSubmit, onAbort, isTa
|
|
|
538106
538244
|
questions.map((item_1, index_0) => {
|
|
538107
538245
|
const isActive = index_0 === activeTabIndex;
|
|
538108
538246
|
const isAnswered = !!answers[item_1.question];
|
|
538109
|
-
const
|
|
538247
|
+
const label = getQuestionTabLabel(item_1, index_0);
|
|
538110
538248
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
538111
538249
|
"aria-role": "tab",
|
|
538112
538250
|
"aria-state": { selected: isActive },
|
|
538113
|
-
"aria-label": `${
|
|
538251
|
+
"aria-label": `${label} ${isAnswered ? "(answered)" : "(unanswered)"}`,
|
|
538114
538252
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
538115
538253
|
backgroundColor: isActive ? accentColor : void 0,
|
|
538116
538254
|
color: isActive ? "black" : isAnswered ? "green" : void 0,
|
|
538117
538255
|
bold: isActive,
|
|
538118
538256
|
dimColor: !isActive && !isAnswered,
|
|
538119
|
-
children: ` ${isAnswered ? "✓" : index_0 + 1} ${
|
|
538257
|
+
children: ` ${isAnswered ? "✓" : index_0 + 1} ${label} `
|
|
538120
538258
|
})
|
|
538121
538259
|
}, item_1.question);
|
|
538122
538260
|
}),
|
|
@@ -540176,8 +540314,8 @@ function useToast() {
|
|
|
540176
540314
|
//#endregion
|
|
540177
540315
|
//#region src/components/StatusBar.tsx
|
|
540178
540316
|
const StatusBar = (0, import_react.memo)((t0) => {
|
|
540179
|
-
const $ = (0, import_compiler_runtime.c)(
|
|
540180
|
-
const { ctrlCPending, showSidebar } = t0;
|
|
540317
|
+
const $ = (0, import_compiler_runtime.c)(39);
|
|
540318
|
+
const { ctrlCPending, showSidebar, updateCheck } = t0;
|
|
540181
540319
|
const [state] = useCodeGenState();
|
|
540182
540320
|
const toast = useToast();
|
|
540183
540321
|
if (ctrlCPending) {
|
|
@@ -540211,22 +540349,82 @@ const StatusBar = (0, import_react.memo)((t0) => {
|
|
|
540211
540349
|
} else t2 = $[3];
|
|
540212
540350
|
return t2;
|
|
540213
540351
|
}
|
|
540352
|
+
if (updateCheck?.status === "upgrade") {
|
|
540353
|
+
let t1;
|
|
540354
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
540355
|
+
t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
540356
|
+
color: "yellow",
|
|
540357
|
+
children: "⬆"
|
|
540358
|
+
});
|
|
540359
|
+
$[4] = t1;
|
|
540360
|
+
} else t1 = $[4];
|
|
540361
|
+
let t2;
|
|
540362
|
+
if ($[5] !== updateCheck.currentVersion || $[6] !== updateCheck.newVersion) {
|
|
540363
|
+
t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
540364
|
+
color: "yellow",
|
|
540365
|
+
children: [
|
|
540366
|
+
"Update available: ",
|
|
540367
|
+
updateCheck.currentVersion,
|
|
540368
|
+
" →",
|
|
540369
|
+
" ",
|
|
540370
|
+
updateCheck.newVersion
|
|
540371
|
+
]
|
|
540372
|
+
});
|
|
540373
|
+
$[5] = updateCheck.currentVersion;
|
|
540374
|
+
$[6] = updateCheck.newVersion;
|
|
540375
|
+
$[7] = t2;
|
|
540376
|
+
} else t2 = $[7];
|
|
540377
|
+
let t3;
|
|
540378
|
+
let t4;
|
|
540379
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
540380
|
+
t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
540381
|
+
dimColor: true,
|
|
540382
|
+
children: "· run"
|
|
540383
|
+
});
|
|
540384
|
+
t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
540385
|
+
bold: true,
|
|
540386
|
+
color: "yellow",
|
|
540387
|
+
children: "builder update"
|
|
540388
|
+
});
|
|
540389
|
+
$[8] = t3;
|
|
540390
|
+
$[9] = t4;
|
|
540391
|
+
} else {
|
|
540392
|
+
t3 = $[8];
|
|
540393
|
+
t4 = $[9];
|
|
540394
|
+
}
|
|
540395
|
+
let t5;
|
|
540396
|
+
if ($[10] !== t2) {
|
|
540397
|
+
t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
540398
|
+
paddingY: 0,
|
|
540399
|
+
gap: 1,
|
|
540400
|
+
children: [
|
|
540401
|
+
t1,
|
|
540402
|
+
t2,
|
|
540403
|
+
t3,
|
|
540404
|
+
t4
|
|
540405
|
+
]
|
|
540406
|
+
});
|
|
540407
|
+
$[10] = t2;
|
|
540408
|
+
$[11] = t5;
|
|
540409
|
+
} else t5 = $[11];
|
|
540410
|
+
return t5;
|
|
540411
|
+
}
|
|
540214
540412
|
const ctx = state.contextWindow;
|
|
540215
540413
|
const showContext = !showSidebar && ctx != null;
|
|
540216
540414
|
let t1;
|
|
540217
|
-
if ($[
|
|
540415
|
+
if ($[12] !== ctx || $[13] !== showContext) {
|
|
540218
540416
|
t1 = showContext ? Math.round(Math.min(ctx.usage, 1) * 100) : 0;
|
|
540219
|
-
$[
|
|
540220
|
-
$[
|
|
540221
|
-
$[
|
|
540222
|
-
} else t1 = $[
|
|
540417
|
+
$[12] = ctx;
|
|
540418
|
+
$[13] = showContext;
|
|
540419
|
+
$[14] = t1;
|
|
540420
|
+
} else t1 = $[14];
|
|
540223
540421
|
const pct = t1;
|
|
540224
540422
|
const tokens = showContext ? ctx.usedTokens : 0;
|
|
540225
|
-
const fmtTokens = _temp$
|
|
540423
|
+
const fmtTokens = _temp$6;
|
|
540226
540424
|
const ctxColor = pct > 80 ? "red" : pct > 50 ? "yellow" : "green";
|
|
540227
540425
|
if (ctx != null && pct >= 75 && !state.activeUserQuestions) {
|
|
540228
540426
|
let t2;
|
|
540229
|
-
if ($[
|
|
540427
|
+
if ($[15] !== ctxColor || $[16] !== pct || $[17] !== showContext || $[18] !== tokens) {
|
|
540230
540428
|
t2 = showContext && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
540231
540429
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
540232
540430
|
color: ctxColor,
|
|
@@ -540239,24 +540437,24 @@ const StatusBar = (0, import_react.memo)((t0) => {
|
|
|
540239
540437
|
}),
|
|
540240
540438
|
") · "
|
|
540241
540439
|
] });
|
|
540242
|
-
$[
|
|
540243
|
-
$[
|
|
540244
|
-
$[
|
|
540245
|
-
$[
|
|
540246
|
-
$[
|
|
540247
|
-
} else t2 = $[
|
|
540440
|
+
$[15] = ctxColor;
|
|
540441
|
+
$[16] = pct;
|
|
540442
|
+
$[17] = showContext;
|
|
540443
|
+
$[18] = tokens;
|
|
540444
|
+
$[19] = t2;
|
|
540445
|
+
} else t2 = $[19];
|
|
540248
540446
|
let t3;
|
|
540249
|
-
if ($[
|
|
540447
|
+
if ($[20] !== ctxColor) {
|
|
540250
540448
|
t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
540251
540449
|
bold: true,
|
|
540252
540450
|
color: ctxColor,
|
|
540253
540451
|
children: "/compact"
|
|
540254
540452
|
});
|
|
540255
|
-
$[
|
|
540256
|
-
$[
|
|
540257
|
-
} else t3 = $[
|
|
540453
|
+
$[20] = ctxColor;
|
|
540454
|
+
$[21] = t3;
|
|
540455
|
+
} else t3 = $[21];
|
|
540258
540456
|
let t4;
|
|
540259
|
-
if ($[
|
|
540457
|
+
if ($[22] !== ctxColor || $[23] !== t2 || $[24] !== t3) {
|
|
540260
540458
|
t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
540261
540459
|
color: ctxColor,
|
|
540262
540460
|
dimColor: true,
|
|
@@ -540269,13 +540467,13 @@ const StatusBar = (0, import_react.memo)((t0) => {
|
|
|
540269
540467
|
"to summarize the conversation before hitting the limit"
|
|
540270
540468
|
]
|
|
540271
540469
|
});
|
|
540272
|
-
$[
|
|
540273
|
-
$[
|
|
540274
|
-
$[
|
|
540275
|
-
$[
|
|
540276
|
-
} else t4 = $[
|
|
540470
|
+
$[22] = ctxColor;
|
|
540471
|
+
$[23] = t2;
|
|
540472
|
+
$[24] = t3;
|
|
540473
|
+
$[25] = t4;
|
|
540474
|
+
} else t4 = $[25];
|
|
540277
540475
|
let t5;
|
|
540278
|
-
if ($[
|
|
540476
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
540279
540477
|
t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
540280
540478
|
gap: 3,
|
|
540281
540479
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
@@ -540286,22 +540484,22 @@ const StatusBar = (0, import_react.memo)((t0) => {
|
|
|
540286
540484
|
}), " mode"]
|
|
540287
540485
|
})
|
|
540288
540486
|
});
|
|
540289
|
-
$[
|
|
540290
|
-
} else t5 = $[
|
|
540487
|
+
$[26] = t5;
|
|
540488
|
+
} else t5 = $[26];
|
|
540291
540489
|
let t6;
|
|
540292
|
-
if ($[
|
|
540490
|
+
if ($[27] !== t4) {
|
|
540293
540491
|
t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
540294
540492
|
justifyContent: "space-between",
|
|
540295
540493
|
paddingY: 0,
|
|
540296
540494
|
children: [t4, t5]
|
|
540297
540495
|
});
|
|
540298
|
-
$[
|
|
540299
|
-
$[
|
|
540300
|
-
} else t6 = $[
|
|
540496
|
+
$[27] = t4;
|
|
540497
|
+
$[28] = t6;
|
|
540498
|
+
} else t6 = $[28];
|
|
540301
540499
|
return t6;
|
|
540302
540500
|
}
|
|
540303
540501
|
let t2;
|
|
540304
|
-
if ($[
|
|
540502
|
+
if ($[29] !== ctxColor || $[30] !== pct || $[31] !== showContext || $[32] !== tokens) {
|
|
540305
540503
|
t2 = showContext ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
540306
540504
|
dimColor: true,
|
|
540307
540505
|
children: [
|
|
@@ -540317,14 +540515,14 @@ const StatusBar = (0, import_react.memo)((t0) => {
|
|
|
540317
540515
|
")"
|
|
540318
540516
|
]
|
|
540319
540517
|
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spacer, {});
|
|
540320
|
-
$[
|
|
540321
|
-
$[
|
|
540322
|
-
$[
|
|
540323
|
-
$[
|
|
540324
|
-
$[
|
|
540325
|
-
} else t2 = $[
|
|
540518
|
+
$[29] = ctxColor;
|
|
540519
|
+
$[30] = pct;
|
|
540520
|
+
$[31] = showContext;
|
|
540521
|
+
$[32] = tokens;
|
|
540522
|
+
$[33] = t2;
|
|
540523
|
+
} else t2 = $[33];
|
|
540326
540524
|
let t3;
|
|
540327
|
-
if ($[
|
|
540525
|
+
if ($[34] !== state.activeUserQuestions) {
|
|
540328
540526
|
t3 = state.activeUserQuestions ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
540329
540527
|
gap: 3,
|
|
540330
540528
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
|
|
@@ -540361,23 +540559,23 @@ const StatusBar = (0, import_react.memo)((t0) => {
|
|
|
540361
540559
|
}), " mode"]
|
|
540362
540560
|
})
|
|
540363
540561
|
});
|
|
540364
|
-
$[
|
|
540365
|
-
$[
|
|
540366
|
-
} else t3 = $[
|
|
540562
|
+
$[34] = state.activeUserQuestions;
|
|
540563
|
+
$[35] = t3;
|
|
540564
|
+
} else t3 = $[35];
|
|
540367
540565
|
let t4;
|
|
540368
|
-
if ($[
|
|
540566
|
+
if ($[36] !== t2 || $[37] !== t3) {
|
|
540369
540567
|
t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
540370
540568
|
justifyContent: "space-between",
|
|
540371
540569
|
paddingY: 0,
|
|
540372
540570
|
children: [t2, t3]
|
|
540373
540571
|
});
|
|
540374
|
-
$[
|
|
540375
|
-
$[
|
|
540376
|
-
$[
|
|
540377
|
-
} else t4 = $[
|
|
540572
|
+
$[36] = t2;
|
|
540573
|
+
$[37] = t3;
|
|
540574
|
+
$[38] = t4;
|
|
540575
|
+
} else t4 = $[38];
|
|
540378
540576
|
return t4;
|
|
540379
540577
|
});
|
|
540380
|
-
function _temp$
|
|
540578
|
+
function _temp$6(n) {
|
|
540381
540579
|
return n >= 1e6 ? `${(n / 1e6).toFixed(1)}M` : n >= 1e3 ? `${(n / 1e3).toFixed(0)}k` : String(n);
|
|
540382
540580
|
}
|
|
540383
540581
|
//#endregion
|
|
@@ -540420,8 +540618,8 @@ const GeneratingProgress = (0, import_react.memo)(() => {
|
|
|
540420
540618
|
const theme = useTheme();
|
|
540421
540619
|
const isGenerating = state.state === "generating";
|
|
540422
540620
|
const todos = state.todoItems ?? [];
|
|
540423
|
-
const completed = todos.filter(_temp$
|
|
540424
|
-
const inProgress = todos.find(_temp2$
|
|
540621
|
+
const completed = todos.filter(_temp$5);
|
|
540622
|
+
const inProgress = todos.find(_temp2$4);
|
|
540425
540623
|
const pending = todos.filter(_temp3$3);
|
|
540426
540624
|
const lastCompleted = completed[completed.length - 1];
|
|
540427
540625
|
const openCount = pending.length + (inProgress ? 1 : 0);
|
|
@@ -540458,7 +540656,6 @@ const GeneratingProgress = (0, import_react.memo)(() => {
|
|
|
540458
540656
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
540459
540657
|
t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
540460
540658
|
gap: 1,
|
|
540461
|
-
marginBottom: 1,
|
|
540462
540659
|
children: [t0, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
540463
540660
|
flexShrink: 0,
|
|
540464
540661
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
@@ -540475,10 +540672,12 @@ const GeneratingProgress = (0, import_react.memo)(() => {
|
|
|
540475
540672
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
540476
540673
|
flexDirection: "column",
|
|
540477
540674
|
marginTop: 2,
|
|
540675
|
+
marginBottom: 1,
|
|
540478
540676
|
children: [
|
|
540479
540677
|
t1,
|
|
540480
540678
|
inProgress && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
540481
540679
|
gap: 1,
|
|
540680
|
+
marginTop: 1,
|
|
540482
540681
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
540483
540682
|
flexShrink: 0,
|
|
540484
540683
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
@@ -540667,10 +540866,10 @@ const ProgressBar = (0, import_react.memo)(() => {
|
|
|
540667
540866
|
} else t2 = $[4];
|
|
540668
540867
|
return t2;
|
|
540669
540868
|
});
|
|
540670
|
-
function _temp$
|
|
540869
|
+
function _temp$5(t) {
|
|
540671
540870
|
return t.status === "completed";
|
|
540672
540871
|
}
|
|
540673
|
-
function _temp2$
|
|
540872
|
+
function _temp2$4(t_0) {
|
|
540674
540873
|
return t_0.status === "in_progress";
|
|
540675
540874
|
}
|
|
540676
540875
|
function _temp3$3(t_1) {
|
|
@@ -541524,7 +541723,7 @@ const TipsSection = (0, import_react.memo)(() => {
|
|
|
541524
541723
|
bb0: {
|
|
541525
541724
|
let t1;
|
|
541526
541725
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
541527
|
-
t1 = TIPS.filter(_temp$
|
|
541726
|
+
t1 = TIPS.filter(_temp$4);
|
|
541528
541727
|
$[0] = t1;
|
|
541529
541728
|
} else t1 = $[0];
|
|
541530
541729
|
const availableTips = t1;
|
|
@@ -541675,7 +541874,7 @@ const TodoSection = (0, import_react.memo)(() => {
|
|
|
541675
541874
|
if (!state.todoItems?.length) return null;
|
|
541676
541875
|
let t0;
|
|
541677
541876
|
if ($[0] !== state.todoItems) {
|
|
541678
|
-
t0 = state.todoItems.filter(_temp2$
|
|
541877
|
+
t0 = state.todoItems.filter(_temp2$3);
|
|
541679
541878
|
$[0] = state.todoItems;
|
|
541680
541879
|
$[1] = t0;
|
|
541681
541880
|
} else t0 = $[1];
|
|
@@ -541793,7 +541992,7 @@ const FooterSection = (0, import_react.memo)(() => {
|
|
|
541793
541992
|
children: [
|
|
541794
541993
|
"•",
|
|
541795
541994
|
" Fusion ",
|
|
541796
|
-
"0.4.
|
|
541995
|
+
"0.4.2"
|
|
541797
541996
|
]
|
|
541798
541997
|
});
|
|
541799
541998
|
$[10] = t7;
|
|
@@ -541879,10 +542078,10 @@ const Sidebar = (0, import_react.memo)(() => {
|
|
|
541879
542078
|
} else t8 = $[9];
|
|
541880
542079
|
return t8;
|
|
541881
542080
|
});
|
|
541882
|
-
function _temp$
|
|
542081
|
+
function _temp$4(item) {
|
|
541883
542082
|
return item.text;
|
|
541884
542083
|
}
|
|
541885
|
-
function _temp2$
|
|
542084
|
+
function _temp2$3(t) {
|
|
541886
542085
|
return t.status === "completed";
|
|
541887
542086
|
}
|
|
541888
542087
|
function _temp3$2(item) {
|
|
@@ -601272,7 +601471,7 @@ function OutputPreview(t0) {
|
|
|
601272
601471
|
T0 = Box;
|
|
601273
601472
|
t2 = "column";
|
|
601274
601473
|
t3 = 2;
|
|
601275
|
-
t4 = lines.map(_temp$
|
|
601474
|
+
t4 = lines.map(_temp$3);
|
|
601276
601475
|
$[0] = maxLines;
|
|
601277
601476
|
$[1] = text;
|
|
601278
601477
|
$[2] = T0;
|
|
@@ -601326,7 +601525,7 @@ function OutputPreview(t0) {
|
|
|
601326
601525
|
} else t6 = $[17];
|
|
601327
601526
|
return t6;
|
|
601328
601527
|
}
|
|
601329
|
-
function _temp$
|
|
601528
|
+
function _temp$3(line, i) {
|
|
601330
601529
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
601331
601530
|
flexDirection: "row",
|
|
601332
601531
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
@@ -601391,7 +601590,7 @@ function DiffView(t0) {
|
|
|
601391
601590
|
const lines = t1;
|
|
601392
601591
|
let t2;
|
|
601393
601592
|
if ($[3] !== lines) {
|
|
601394
|
-
t2 = lines.map(_temp2$
|
|
601593
|
+
t2 = lines.map(_temp2$2);
|
|
601395
601594
|
$[3] = lines;
|
|
601396
601595
|
$[4] = t2;
|
|
601397
601596
|
} else t2 = $[4];
|
|
@@ -601407,7 +601606,7 @@ function DiffView(t0) {
|
|
|
601407
601606
|
} else t3 = $[6];
|
|
601408
601607
|
return t3;
|
|
601409
601608
|
}
|
|
601410
|
-
function _temp2$
|
|
601609
|
+
function _temp2$2(line, i) {
|
|
601411
601610
|
if (line.kind === "ellipsis") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
601412
601611
|
dimColor: true,
|
|
601413
601612
|
children: " ···"
|
|
@@ -602853,6 +603052,7 @@ const MessageBlockView = (0, import_react.memo)((props) => {
|
|
|
602853
603052
|
if ($[15] !== message.content || $[16] !== message.id || $[17] !== props.onRender) {
|
|
602854
603053
|
t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CompletedTextBlock, {
|
|
602855
603054
|
text: message.content,
|
|
603055
|
+
streaming: false,
|
|
602856
603056
|
onRender: props.onRender
|
|
602857
603057
|
}, message.id);
|
|
602858
603058
|
$[15] = message.content;
|
|
@@ -602918,52 +603118,54 @@ const MessageBlockView = (0, import_react.memo)((props) => {
|
|
|
602918
603118
|
}
|
|
602919
603119
|
case "thinking": {
|
|
602920
603120
|
let t2;
|
|
602921
|
-
if ($[34] !== message.content || $[35] !== message.id || $[36] !== message.
|
|
603121
|
+
if ($[34] !== message.content || $[35] !== message.id || $[36] !== message.startedAt || $[37] !== message.streaming || $[38] !== props.onRender) {
|
|
602922
603122
|
t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThinkingBlock, {
|
|
602923
603123
|
text: message.content,
|
|
602924
603124
|
streaming: message.streaming,
|
|
603125
|
+
startedAt: message.startedAt,
|
|
602925
603126
|
onRender: props.onRender
|
|
602926
603127
|
}, message.id);
|
|
602927
603128
|
$[34] = message.content;
|
|
602928
603129
|
$[35] = message.id;
|
|
602929
|
-
$[36] = message.
|
|
602930
|
-
$[37] =
|
|
602931
|
-
$[38] =
|
|
602932
|
-
|
|
603130
|
+
$[36] = message.startedAt;
|
|
603131
|
+
$[37] = message.streaming;
|
|
603132
|
+
$[38] = props.onRender;
|
|
603133
|
+
$[39] = t2;
|
|
603134
|
+
} else t2 = $[39];
|
|
602933
603135
|
let t3;
|
|
602934
|
-
if ($[
|
|
603136
|
+
if ($[40] !== flashBg || $[41] !== t2) {
|
|
602935
603137
|
t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
602936
603138
|
flexDirection: "column",
|
|
602937
603139
|
backgroundColor: flashBg,
|
|
602938
603140
|
"aria-hidden": true,
|
|
602939
603141
|
children: t2
|
|
602940
603142
|
});
|
|
602941
|
-
$[
|
|
602942
|
-
$[
|
|
602943
|
-
$[
|
|
602944
|
-
} else t3 = $[
|
|
603143
|
+
$[40] = flashBg;
|
|
603144
|
+
$[41] = t2;
|
|
603145
|
+
$[42] = t3;
|
|
603146
|
+
} else t3 = $[42];
|
|
602945
603147
|
inner = t3;
|
|
602946
603148
|
break bb0;
|
|
602947
603149
|
}
|
|
602948
603150
|
case "idle": {
|
|
602949
603151
|
const idleMsg = message;
|
|
602950
603152
|
let t2;
|
|
602951
|
-
if ($[
|
|
603153
|
+
if ($[43] !== idleMsg.durationMs) {
|
|
602952
603154
|
t2 = formatDuration(idleMsg.durationMs);
|
|
602953
|
-
$[
|
|
602954
|
-
$[
|
|
602955
|
-
} else t2 = $[
|
|
603155
|
+
$[43] = idleMsg.durationMs;
|
|
603156
|
+
$[44] = t2;
|
|
603157
|
+
} else t2 = $[44];
|
|
602956
603158
|
const idleDuration = t2;
|
|
602957
603159
|
const idleAriaLabel = idleMsg.state === "error" ? `Failed after ${idleDuration}` : idleMsg.state === "abort" ? `Interrupted after ${idleDuration}` : `Worked for ${idleDuration}`;
|
|
602958
603160
|
let t3;
|
|
602959
|
-
if ($[
|
|
603161
|
+
if ($[45] !== idleMsg || $[46] !== message.id) {
|
|
602960
603162
|
t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IdleBlock, { message: idleMsg }, message.id);
|
|
602961
|
-
$[
|
|
602962
|
-
$[
|
|
602963
|
-
$[
|
|
602964
|
-
} else t3 = $[
|
|
603163
|
+
$[45] = idleMsg;
|
|
603164
|
+
$[46] = message.id;
|
|
603165
|
+
$[47] = t3;
|
|
603166
|
+
} else t3 = $[47];
|
|
602965
603167
|
let t4;
|
|
602966
|
-
if ($[
|
|
603168
|
+
if ($[48] !== flashBg || $[49] !== idleAriaLabel || $[50] !== t3) {
|
|
602967
603169
|
t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
602968
603170
|
flexDirection: "column",
|
|
602969
603171
|
backgroundColor: flashBg,
|
|
@@ -602971,22 +603173,15 @@ const MessageBlockView = (0, import_react.memo)((props) => {
|
|
|
602971
603173
|
"aria-label": idleAriaLabel,
|
|
602972
603174
|
children: t3
|
|
602973
603175
|
});
|
|
602974
|
-
$[
|
|
602975
|
-
$[
|
|
602976
|
-
$[
|
|
602977
|
-
$[
|
|
602978
|
-
} else t4 = $[
|
|
603176
|
+
$[48] = flashBg;
|
|
603177
|
+
$[49] = idleAriaLabel;
|
|
603178
|
+
$[50] = t3;
|
|
603179
|
+
$[51] = t4;
|
|
603180
|
+
} else t4 = $[51];
|
|
602979
603181
|
inner = t4;
|
|
602980
603182
|
break bb0;
|
|
602981
603183
|
}
|
|
602982
|
-
default: {
|
|
602983
|
-
let t2;
|
|
602984
|
-
if ($[51] === Symbol.for("react.memo_cache_sentinel")) {
|
|
602985
|
-
t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
602986
|
-
$[51] = t2;
|
|
602987
|
-
} else t2 = $[51];
|
|
602988
|
-
return t2;
|
|
602989
|
-
}
|
|
603184
|
+
default: throw new Error(`Unknown message type: ${message}`);
|
|
602990
603185
|
}
|
|
602991
603186
|
let t2;
|
|
602992
603187
|
if ($[52] !== flash || $[53] !== theme) {
|
|
@@ -603059,36 +603254,62 @@ function CompletedTextBlock(t0) {
|
|
|
603059
603254
|
} else t4 = $[7];
|
|
603060
603255
|
return t4;
|
|
603061
603256
|
}
|
|
603062
|
-
const THINKING_MAX_CHARS = 400;
|
|
603063
603257
|
function ThinkingBlock(t0) {
|
|
603064
|
-
const $ = (0, import_compiler_runtime.c)(
|
|
603065
|
-
const { text, streaming: t1, onRender } = t0;
|
|
603258
|
+
const $ = (0, import_compiler_runtime.c)(25);
|
|
603259
|
+
const { text, streaming: t1, onRender, startedAt } = t0;
|
|
603066
603260
|
const streaming = t1 === void 0 ? false : t1;
|
|
603067
603261
|
let t2;
|
|
603068
603262
|
if ($[0] !== text) {
|
|
603069
|
-
t2 = text.
|
|
603263
|
+
t2 = text.trimEnd().split("\n").pop() ?? "";
|
|
603070
603264
|
$[0] = text;
|
|
603071
603265
|
$[1] = t2;
|
|
603072
603266
|
} else t2 = $[1];
|
|
603073
|
-
const
|
|
603267
|
+
const lastParagraph = t2;
|
|
603074
603268
|
let t3;
|
|
603075
|
-
if ($[2] !==
|
|
603076
|
-
t3 =
|
|
603077
|
-
|
|
603269
|
+
if ($[2] !== streaming) {
|
|
603270
|
+
t3 = {
|
|
603271
|
+
isActive: streaming,
|
|
603272
|
+
interval: 1e3
|
|
603078
603273
|
};
|
|
603079
|
-
$[2] =
|
|
603274
|
+
$[2] = streaming;
|
|
603080
603275
|
$[3] = t3;
|
|
603081
603276
|
} else t3 = $[3];
|
|
603277
|
+
const { frame } = useAnimation(t3);
|
|
603082
603278
|
let t4;
|
|
603083
|
-
if ($[4] !==
|
|
603084
|
-
t4 =
|
|
603085
|
-
|
|
603279
|
+
if ($[4] !== onRender) {
|
|
603280
|
+
t4 = () => {
|
|
603281
|
+
onRender();
|
|
603282
|
+
};
|
|
603283
|
+
$[4] = onRender;
|
|
603086
603284
|
$[5] = t4;
|
|
603087
603285
|
} else t4 = $[5];
|
|
603088
|
-
(0, import_react.useEffect)(t3, t4);
|
|
603089
603286
|
let t5;
|
|
603090
|
-
if ($[6] !==
|
|
603091
|
-
t5 =
|
|
603287
|
+
if ($[6] !== lastParagraph) {
|
|
603288
|
+
t5 = [lastParagraph];
|
|
603289
|
+
$[6] = lastParagraph;
|
|
603290
|
+
$[7] = t5;
|
|
603291
|
+
} else t5 = $[7];
|
|
603292
|
+
(0, import_react.useEffect)(t4, t5);
|
|
603293
|
+
let t6;
|
|
603294
|
+
bb0: {
|
|
603295
|
+
if (startedAt == null) {
|
|
603296
|
+
t6 = void 0;
|
|
603297
|
+
break bb0;
|
|
603298
|
+
}
|
|
603299
|
+
const t7 = Math.floor((Date.now() - startedAt) / 1e3) * 1e3;
|
|
603300
|
+
let t8;
|
|
603301
|
+
if ($[8] !== t7) {
|
|
603302
|
+
t8 = formatDuration(t7);
|
|
603303
|
+
$[8] = t7;
|
|
603304
|
+
$[9] = t8;
|
|
603305
|
+
} else t8 = $[9];
|
|
603306
|
+
t6 = `for ${t8}`;
|
|
603307
|
+
}
|
|
603308
|
+
const durationText = t6;
|
|
603309
|
+
let t7;
|
|
603310
|
+
let t8;
|
|
603311
|
+
if ($[10] !== streaming) {
|
|
603312
|
+
t7 = streaming ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
603092
603313
|
bold: true,
|
|
603093
603314
|
color: "cyan",
|
|
603094
603315
|
"aria-hidden": true,
|
|
@@ -603098,53 +603319,73 @@ function ThinkingBlock(t0) {
|
|
|
603098
603319
|
"aria-hidden": true,
|
|
603099
603320
|
children: "◆"
|
|
603100
603321
|
});
|
|
603101
|
-
|
|
603102
|
-
$[7] = t5;
|
|
603103
|
-
} else t5 = $[7];
|
|
603104
|
-
let t6;
|
|
603105
|
-
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
603106
|
-
t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
603322
|
+
t8 = streaming ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
603107
603323
|
bold: true,
|
|
603108
603324
|
dimColor: true,
|
|
603109
603325
|
children: "Thinking"
|
|
603326
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
603327
|
+
bold: true,
|
|
603328
|
+
children: "Thought"
|
|
603110
603329
|
});
|
|
603111
|
-
$[
|
|
603112
|
-
|
|
603113
|
-
|
|
603114
|
-
|
|
603115
|
-
t7 =
|
|
603330
|
+
$[10] = streaming;
|
|
603331
|
+
$[11] = t7;
|
|
603332
|
+
$[12] = t8;
|
|
603333
|
+
} else {
|
|
603334
|
+
t7 = $[11];
|
|
603335
|
+
t8 = $[12];
|
|
603336
|
+
}
|
|
603337
|
+
let t9;
|
|
603338
|
+
if ($[13] !== durationText) {
|
|
603339
|
+
t9 = durationText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
603340
|
+
dimColor: true,
|
|
603341
|
+
children: durationText
|
|
603342
|
+
});
|
|
603343
|
+
$[13] = durationText;
|
|
603344
|
+
$[14] = t9;
|
|
603345
|
+
} else t9 = $[14];
|
|
603346
|
+
let t10;
|
|
603347
|
+
if ($[15] !== t7 || $[16] !== t8 || $[17] !== t9) {
|
|
603348
|
+
t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
603116
603349
|
gap: 1,
|
|
603117
|
-
children: [
|
|
603350
|
+
children: [
|
|
603351
|
+
t7,
|
|
603352
|
+
t8,
|
|
603353
|
+
t9
|
|
603354
|
+
]
|
|
603118
603355
|
});
|
|
603119
|
-
$[
|
|
603120
|
-
$[
|
|
603121
|
-
|
|
603122
|
-
|
|
603123
|
-
|
|
603124
|
-
|
|
603356
|
+
$[15] = t7;
|
|
603357
|
+
$[16] = t8;
|
|
603358
|
+
$[17] = t9;
|
|
603359
|
+
$[18] = t10;
|
|
603360
|
+
} else t10 = $[18];
|
|
603361
|
+
let t11;
|
|
603362
|
+
if ($[19] !== lastParagraph || $[20] !== text.length) {
|
|
603363
|
+
t11 = text.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
603125
603364
|
paddingLeft: 2,
|
|
603365
|
+
flexWrap: "wrap",
|
|
603126
603366
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
603127
603367
|
dimColor: true,
|
|
603128
603368
|
wrap: "wrap",
|
|
603129
|
-
children:
|
|
603369
|
+
children: lastParagraph
|
|
603130
603370
|
})
|
|
603131
603371
|
});
|
|
603132
|
-
$[
|
|
603133
|
-
$[
|
|
603134
|
-
|
|
603135
|
-
|
|
603136
|
-
|
|
603137
|
-
|
|
603372
|
+
$[19] = lastParagraph;
|
|
603373
|
+
$[20] = text.length;
|
|
603374
|
+
$[21] = t11;
|
|
603375
|
+
} else t11 = $[21];
|
|
603376
|
+
let t12;
|
|
603377
|
+
if ($[22] !== t10 || $[23] !== t11) {
|
|
603378
|
+
t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
603138
603379
|
flexDirection: "column",
|
|
603139
603380
|
paddingX: 1,
|
|
603140
603381
|
marginY: 1,
|
|
603141
|
-
children: [
|
|
603382
|
+
children: [t10, t11]
|
|
603142
603383
|
});
|
|
603143
|
-
$[
|
|
603144
|
-
$[
|
|
603145
|
-
$[
|
|
603146
|
-
} else
|
|
603147
|
-
return
|
|
603384
|
+
$[22] = t10;
|
|
603385
|
+
$[23] = t11;
|
|
603386
|
+
$[24] = t12;
|
|
603387
|
+
} else t12 = $[24];
|
|
603388
|
+
return t12;
|
|
603148
603389
|
}
|
|
603149
603390
|
function formatDuration(ms) {
|
|
603150
603391
|
if (ms < 1e3) return `${ms}ms`;
|
|
@@ -603230,7 +603471,7 @@ function IdleBlock(t0) {
|
|
|
603230
603471
|
const summaryText = isError ? `Failed after ${duration}` : isAbort ? `Interrupted after ${duration}` : `${verb} for ${duration}`;
|
|
603231
603472
|
let t5;
|
|
603232
603473
|
if ($[6] !== message.applyResults) {
|
|
603233
|
-
t5 = message.applyResults.map(_temp$
|
|
603474
|
+
t5 = message.applyResults.map(_temp$2);
|
|
603234
603475
|
$[6] = message.applyResults;
|
|
603235
603476
|
$[7] = t5;
|
|
603236
603477
|
} else t5 = $[7];
|
|
@@ -603295,7 +603536,7 @@ function IdleBlock(t0) {
|
|
|
603295
603536
|
} else t10 = $[23];
|
|
603296
603537
|
return t10;
|
|
603297
603538
|
}
|
|
603298
|
-
function _temp$
|
|
603539
|
+
function _temp$2(result) {
|
|
603299
603540
|
const { green, red } = buildDots(result.addedLines, result.removedLines);
|
|
603300
603541
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
603301
603542
|
flexDirection: "row",
|
|
@@ -603366,8 +603607,8 @@ var ErrorBoundary = class extends import_react.Component {
|
|
|
603366
603607
|
//#endregion
|
|
603367
603608
|
//#region src/components/CodeSession.tsx
|
|
603368
603609
|
const CodeSessionWrapper = (0, import_react.memo)((t0) => {
|
|
603369
|
-
const $ = (0, import_compiler_runtime.c)(
|
|
603370
|
-
const { session, onExit, isTabActive: t1 } = t0;
|
|
603610
|
+
const $ = (0, import_compiler_runtime.c)(11);
|
|
603611
|
+
const { session, onExit, isTabActive: t1, updateCheck, credentials } = t0;
|
|
603371
603612
|
const isTabActive = t1 === void 0 ? true : t1;
|
|
603372
603613
|
const [proxy, api] = useCodeGenFromSession(session);
|
|
603373
603614
|
let t2;
|
|
@@ -603378,28 +603619,32 @@ const CodeSessionWrapper = (0, import_react.memo)((t0) => {
|
|
|
603378
603619
|
$[2] = t2;
|
|
603379
603620
|
} else t2 = $[2];
|
|
603380
603621
|
let t3;
|
|
603381
|
-
if ($[3] !==
|
|
603622
|
+
if ($[3] !== credentials || $[4] !== isTabActive || $[5] !== onExit || $[6] !== updateCheck) {
|
|
603382
603623
|
t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeSession, {
|
|
603383
603624
|
onExit,
|
|
603384
|
-
isTabActive
|
|
603385
|
-
|
|
603386
|
-
|
|
603387
|
-
|
|
603388
|
-
$[
|
|
603389
|
-
|
|
603625
|
+
isTabActive,
|
|
603626
|
+
updateCheck,
|
|
603627
|
+
credentials
|
|
603628
|
+
});
|
|
603629
|
+
$[3] = credentials;
|
|
603630
|
+
$[4] = isTabActive;
|
|
603631
|
+
$[5] = onExit;
|
|
603632
|
+
$[6] = updateCheck;
|
|
603633
|
+
$[7] = t3;
|
|
603634
|
+
} else t3 = $[7];
|
|
603390
603635
|
let t4;
|
|
603391
|
-
if ($[
|
|
603636
|
+
if ($[8] !== t2 || $[9] !== t3) {
|
|
603392
603637
|
t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeGenStateContext.Provider, {
|
|
603393
603638
|
value: t2,
|
|
603394
603639
|
children: t3
|
|
603395
603640
|
});
|
|
603396
|
-
$[
|
|
603397
|
-
$[
|
|
603398
|
-
$[
|
|
603399
|
-
} else t4 = $[
|
|
603641
|
+
$[8] = t2;
|
|
603642
|
+
$[9] = t3;
|
|
603643
|
+
$[10] = t4;
|
|
603644
|
+
} else t4 = $[10];
|
|
603400
603645
|
return t4;
|
|
603401
603646
|
});
|
|
603402
|
-
const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
|
|
603647
|
+
const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true, updateCheck, credentials }) => {
|
|
603403
603648
|
const { stdout } = useStdout();
|
|
603404
603649
|
const { rows, columns } = useWindowSize();
|
|
603405
603650
|
const [slashMenuActive, setSlashMenuActive] = (0, import_react.useState)(false);
|
|
@@ -603546,7 +603791,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
|
|
|
603546
603791
|
queue: true,
|
|
603547
603792
|
user: {
|
|
603548
603793
|
role: "user",
|
|
603549
|
-
source: "builder.io"
|
|
603794
|
+
source: "builder.io",
|
|
603795
|
+
userId: credentials.userId
|
|
603550
603796
|
}
|
|
603551
603797
|
}).catch(() => {});
|
|
603552
603798
|
break;
|
|
@@ -603587,7 +603833,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
|
|
|
603587
603833
|
queue: true,
|
|
603588
603834
|
user: {
|
|
603589
603835
|
role: "user",
|
|
603590
|
-
source: "builder.io"
|
|
603836
|
+
source: "builder.io",
|
|
603837
|
+
userId: credentials.userId
|
|
603591
603838
|
}
|
|
603592
603839
|
}).catch(() => {});
|
|
603593
603840
|
break;
|
|
@@ -603626,7 +603873,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
|
|
|
603626
603873
|
reasoning: prefs.reasoning,
|
|
603627
603874
|
user: {
|
|
603628
603875
|
role: "user",
|
|
603629
|
-
source: "builder.io"
|
|
603876
|
+
source: "builder.io",
|
|
603877
|
+
userId: credentials.userId
|
|
603630
603878
|
},
|
|
603631
603879
|
...attachments ? { attachments } : {}
|
|
603632
603880
|
});
|
|
@@ -603646,7 +603894,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
|
|
|
603646
603894
|
reasoning: prefs.reasoning,
|
|
603647
603895
|
user: {
|
|
603648
603896
|
role: "user",
|
|
603649
|
-
source: "builder.io"
|
|
603897
|
+
source: "builder.io",
|
|
603898
|
+
userId: credentials.userId
|
|
603650
603899
|
}
|
|
603651
603900
|
});
|
|
603652
603901
|
userScrolledUp.current = false;
|
|
@@ -603659,7 +603908,14 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
|
|
|
603659
603908
|
const getOnRenderCallback = (0, import_react.useCallback)((i_0) => {
|
|
603660
603909
|
let cb = onRenderCallbacksRef.current.get(i_0);
|
|
603661
603910
|
if (!cb) {
|
|
603662
|
-
cb = () =>
|
|
603911
|
+
cb = () => {
|
|
603912
|
+
if (isTabActive) {
|
|
603913
|
+
scrollRef.current?.remeasureItem(i_0);
|
|
603914
|
+
if (!userScrolledUp.current) setTimeout(() => {
|
|
603915
|
+
scrollRef.current?.scrollToBottom();
|
|
603916
|
+
}, 0);
|
|
603917
|
+
}
|
|
603918
|
+
};
|
|
603663
603919
|
onRenderCallbacksRef.current.set(i_0, cb);
|
|
603664
603920
|
}
|
|
603665
603921
|
return cb;
|
|
@@ -603672,9 +603928,9 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
|
|
|
603672
603928
|
const termRow = row_0 - 1 - terminalTop;
|
|
603673
603929
|
if (termRow < 0 || termRow >= viewportHeight) return;
|
|
603674
603930
|
const contentRow = sv.getScrollOffset() + termRow;
|
|
603675
|
-
const visibleCount = messageCount - startIndex
|
|
603931
|
+
const visibleCount = messageCount - startIndex;
|
|
603676
603932
|
for (let i_1 = 0; i_1 < visibleCount; i_1++) {
|
|
603677
|
-
const pos = sv.getItemPosition(i_1
|
|
603933
|
+
const pos = sv.getItemPosition(i_1);
|
|
603678
603934
|
if (!pos || contentRow < pos.top || contentRow >= pos.top + pos.height) continue;
|
|
603679
603935
|
const msg = proxy.messages[startIndex + i_1];
|
|
603680
603936
|
if (!msg) break;
|
|
@@ -603726,7 +603982,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
|
|
|
603726
603982
|
isTabActive
|
|
603727
603983
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusBar, {
|
|
603728
603984
|
ctrlCPending,
|
|
603729
|
-
showSidebar: false
|
|
603985
|
+
showSidebar: false,
|
|
603986
|
+
updateCheck
|
|
603730
603987
|
})]
|
|
603731
603988
|
});
|
|
603732
603989
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
@@ -603755,38 +604012,21 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
|
|
|
603755
604012
|
children: "You can still type below. Use /clear to reset the session."
|
|
603756
604013
|
})]
|
|
603757
604014
|
}),
|
|
603758
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
604015
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ScrollView$1, {
|
|
603759
604016
|
ref: scrollRef,
|
|
603760
604017
|
flexGrow: 1,
|
|
603761
604018
|
flexDirection: "column",
|
|
603762
604019
|
width: "100%",
|
|
603763
|
-
children:
|
|
603764
|
-
paddingX: 2,
|
|
603765
|
-
paddingY: 1,
|
|
603766
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
603767
|
-
dimColor: true,
|
|
603768
|
-
children: "No messages yet. Type a prompt below to get started."
|
|
603769
|
-
})
|
|
603770
|
-
}), Array.from({ length: messageCount - startIndex }, (__0, i_2) => {
|
|
604020
|
+
children: Array.from({ length: messageCount - startIndex }, (__0, i_2) => {
|
|
603771
604021
|
const idx = startIndex + i_2;
|
|
603772
604022
|
const msgProxy = proxy.messages[idx];
|
|
603773
604023
|
const msgId = msgProxy.id;
|
|
603774
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
603775
|
-
|
|
603776
|
-
|
|
603777
|
-
|
|
603778
|
-
|
|
603779
|
-
|
|
603780
|
-
children: "[failed to render message]"
|
|
603781
|
-
})
|
|
603782
|
-
}),
|
|
603783
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageBlockView, {
|
|
603784
|
-
message: msgProxy,
|
|
603785
|
-
highlighted: msgId === highlightedMessageId,
|
|
603786
|
-
onRender: getOnRenderCallback(i_2)
|
|
603787
|
-
})
|
|
603788
|
-
}, `err-${msgId}-${idx}`);
|
|
603789
|
-
})]
|
|
604024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageBlockView, {
|
|
604025
|
+
message: msgProxy,
|
|
604026
|
+
highlighted: msgId === highlightedMessageId,
|
|
604027
|
+
onRender: getOnRenderCallback(i_2)
|
|
604028
|
+
}, `${msgId}-${idx}`);
|
|
604029
|
+
})
|
|
603790
604030
|
})
|
|
603791
604031
|
})
|
|
603792
604032
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
@@ -603833,7 +604073,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
|
|
|
603833
604073
|
})] }),
|
|
603834
604074
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusBar, {
|
|
603835
604075
|
ctrlCPending,
|
|
603836
|
-
showSidebar
|
|
604076
|
+
showSidebar,
|
|
604077
|
+
updateCheck
|
|
603837
604078
|
})
|
|
603838
604079
|
]
|
|
603839
604080
|
})]
|
|
@@ -604375,7 +604616,7 @@ const ClawSession = (0, import_react.memo)(({ credentials, isActive, onNewMessag
|
|
|
604375
604616
|
});
|
|
604376
604617
|
});
|
|
604377
604618
|
//#endregion
|
|
604378
|
-
//#region ../../node_modules/ink-scroll-
|
|
604619
|
+
//#region ../../node_modules/ink-scroll-view/dist/index.js
|
|
604379
604620
|
var MeasurableItem = ({ children, onMeasure, index, width, measureKey }) => {
|
|
604380
604621
|
const ref = (0, import_react.useRef)(null);
|
|
604381
604622
|
(0, import_react.useLayoutEffect)(() => {
|
|
@@ -605477,6 +605718,7 @@ const KanbanSession = (0, import_react.memo)(({ credentials, isActive, onExit, c
|
|
|
605477
605718
|
};
|
|
605478
605719
|
}, []);
|
|
605479
605720
|
useInput((input, key) => {
|
|
605721
|
+
if (MOUSE_RE.test(input)) return;
|
|
605480
605722
|
if (input === "c" && key.ctrl) {
|
|
605481
605723
|
if (ctrlCPendingRef.current) {
|
|
605482
605724
|
if (ctrlCTimer.current) clearTimeout(ctrlCTimer.current);
|
|
@@ -605812,7 +606054,7 @@ function InitErrorScreen(t0) {
|
|
|
605812
606054
|
} else t5 = $[7];
|
|
605813
606055
|
return t5;
|
|
605814
606056
|
}
|
|
605815
|
-
function CodeCommand({ onExit, sys, options }) {
|
|
606057
|
+
function CodeCommand({ onExit, sys, options, updateCheck }) {
|
|
605816
606058
|
const { exit } = useApp();
|
|
605817
606059
|
const [initPhase, setInitPhase] = (0, import_react.useState)("loading");
|
|
605818
606060
|
const [initError, setInitError] = (0, import_react.useState)("");
|
|
@@ -605961,9 +606203,11 @@ function CodeCommand({ onExit, sys, options }) {
|
|
|
605961
606203
|
flexGrow: 1,
|
|
605962
606204
|
display: onCodegen ? "flex" : "none",
|
|
605963
606205
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeSessionWrapper, {
|
|
606206
|
+
credentials: credentialsRef.current,
|
|
605964
606207
|
session: sessionRef.current,
|
|
605965
606208
|
onExit: cleanup,
|
|
605966
|
-
isTabActive: onCodegen
|
|
606209
|
+
isTabActive: onCodegen,
|
|
606210
|
+
updateCheck
|
|
605967
606211
|
})
|
|
605968
606212
|
}),
|
|
605969
606213
|
clawEnabled === true && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
@@ -605995,167 +606239,6 @@ function CodeCommand({ onExit, sys, options }) {
|
|
|
605995
606239
|
}
|
|
605996
606240
|
}
|
|
605997
606241
|
//#endregion
|
|
605998
|
-
//#region src/app.tsx
|
|
605999
|
-
function FatalErrorScreen(t0) {
|
|
606000
|
-
const $ = (0, import_compiler_runtime.c)(8);
|
|
606001
|
-
const { error } = t0;
|
|
606002
|
-
const { exit } = useApp();
|
|
606003
|
-
let t1;
|
|
606004
|
-
if ($[0] !== exit) {
|
|
606005
|
-
t1 = (input, key) => {
|
|
606006
|
-
if (input === "c" && key.ctrl) {
|
|
606007
|
-
exit();
|
|
606008
|
-
process.exit(0);
|
|
606009
|
-
}
|
|
606010
|
-
};
|
|
606011
|
-
$[0] = exit;
|
|
606012
|
-
$[1] = t1;
|
|
606013
|
-
} else t1 = $[1];
|
|
606014
|
-
useInput(t1);
|
|
606015
|
-
let t2;
|
|
606016
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
606017
|
-
t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
606018
|
-
color: "red",
|
|
606019
|
-
bold: true,
|
|
606020
|
-
children: "Fatal render error"
|
|
606021
|
-
});
|
|
606022
|
-
$[2] = t2;
|
|
606023
|
-
} else t2 = $[2];
|
|
606024
|
-
let t3;
|
|
606025
|
-
if ($[3] !== error.message) {
|
|
606026
|
-
t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
606027
|
-
color: "red",
|
|
606028
|
-
children: error.message
|
|
606029
|
-
});
|
|
606030
|
-
$[3] = error.message;
|
|
606031
|
-
$[4] = t3;
|
|
606032
|
-
} else t3 = $[4];
|
|
606033
|
-
let t4;
|
|
606034
|
-
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
606035
|
-
t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
606036
|
-
dimColor: true,
|
|
606037
|
-
children: "Press Ctrl+C to exit"
|
|
606038
|
-
});
|
|
606039
|
-
$[5] = t4;
|
|
606040
|
-
} else t4 = $[5];
|
|
606041
|
-
let t5;
|
|
606042
|
-
if ($[6] !== t3) {
|
|
606043
|
-
t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
606044
|
-
flexDirection: "column",
|
|
606045
|
-
padding: 1,
|
|
606046
|
-
gap: 1,
|
|
606047
|
-
children: [
|
|
606048
|
-
t2,
|
|
606049
|
-
t3,
|
|
606050
|
-
t4
|
|
606051
|
-
]
|
|
606052
|
-
});
|
|
606053
|
-
$[6] = t3;
|
|
606054
|
-
$[7] = t5;
|
|
606055
|
-
} else t5 = $[7];
|
|
606056
|
-
return t5;
|
|
606057
|
-
}
|
|
606058
|
-
function App(t0) {
|
|
606059
|
-
const $ = (0, import_compiler_runtime.c)(12);
|
|
606060
|
-
const { command, options, sys, theme } = t0;
|
|
606061
|
-
const { exit } = useApp();
|
|
606062
|
-
const { rows } = useWindowSize();
|
|
606063
|
-
let t1;
|
|
606064
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
606065
|
-
t1 = [];
|
|
606066
|
-
$[0] = t1;
|
|
606067
|
-
} else t1 = $[0];
|
|
606068
|
-
(0, import_react.useEffect)(_temp2, t1);
|
|
606069
|
-
let t2;
|
|
606070
|
-
if ($[1] !== command || $[2] !== exit || $[3] !== options || $[4] !== sys) {
|
|
606071
|
-
t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
|
|
606072
|
-
fallback: _temp3,
|
|
606073
|
-
children: command === "code" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeCommand, {
|
|
606074
|
-
onExit: exit,
|
|
606075
|
-
sys,
|
|
606076
|
-
options
|
|
606077
|
-
}) : command === "launch" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
606078
|
-
flexDirection: "column",
|
|
606079
|
-
paddingX: 1,
|
|
606080
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
606081
|
-
color: "yellow",
|
|
606082
|
-
children: "Launch command coming soon. Use: npx builder.io@latest launch"
|
|
606083
|
-
})
|
|
606084
|
-
}) : command === "index-repo" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
606085
|
-
flexDirection: "column",
|
|
606086
|
-
paddingX: 1,
|
|
606087
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
606088
|
-
color: "yellow",
|
|
606089
|
-
children: "Repo indexing coming soon. Use: npx builder.io@latest index-repo"
|
|
606090
|
-
})
|
|
606091
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
606092
|
-
flexDirection: "column",
|
|
606093
|
-
paddingX: 1,
|
|
606094
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
606095
|
-
color: "red",
|
|
606096
|
-
children: ["Unknown command: ", command]
|
|
606097
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
606098
|
-
dimColor: true,
|
|
606099
|
-
children: "Run builder --help for usage information"
|
|
606100
|
-
})]
|
|
606101
|
-
})
|
|
606102
|
-
});
|
|
606103
|
-
$[1] = command;
|
|
606104
|
-
$[2] = exit;
|
|
606105
|
-
$[3] = options;
|
|
606106
|
-
$[4] = sys;
|
|
606107
|
-
$[5] = t2;
|
|
606108
|
-
} else t2 = $[5];
|
|
606109
|
-
let t3;
|
|
606110
|
-
if ($[6] !== rows || $[7] !== t2) {
|
|
606111
|
-
t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
606112
|
-
flexDirection: "column",
|
|
606113
|
-
height: rows,
|
|
606114
|
-
children: t2
|
|
606115
|
-
});
|
|
606116
|
-
$[6] = rows;
|
|
606117
|
-
$[7] = t2;
|
|
606118
|
-
$[8] = t3;
|
|
606119
|
-
} else t3 = $[8];
|
|
606120
|
-
let t4;
|
|
606121
|
-
if ($[9] !== t3 || $[10] !== theme) {
|
|
606122
|
-
t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext$1.Provider, {
|
|
606123
|
-
value: theme,
|
|
606124
|
-
children: t3
|
|
606125
|
-
});
|
|
606126
|
-
$[9] = t3;
|
|
606127
|
-
$[10] = theme;
|
|
606128
|
-
$[11] = t4;
|
|
606129
|
-
} else t4 = $[11];
|
|
606130
|
-
return t4;
|
|
606131
|
-
}
|
|
606132
|
-
function _temp3(error) {
|
|
606133
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FatalErrorScreen, { error });
|
|
606134
|
-
}
|
|
606135
|
-
function _temp2() {
|
|
606136
|
-
enableSgrMouse();
|
|
606137
|
-
return _temp;
|
|
606138
|
-
}
|
|
606139
|
-
function _temp() {
|
|
606140
|
-
resetTerminal();
|
|
606141
|
-
}
|
|
606142
|
-
//#endregion
|
|
606143
|
-
//#region src/sentry.ts
|
|
606144
|
-
function initSentry() {
|
|
606145
|
-
init({
|
|
606146
|
-
dsn: "https://1c5033d697e0271ebe53773bff826de0@o117565.ingest.us.sentry.io/4511107776905216",
|
|
606147
|
-
tracesSampleRate: 0,
|
|
606148
|
-
release: "0.4.0",
|
|
606149
|
-
environment: process.env.NODE_ENV ?? "development",
|
|
606150
|
-
enabled: false,
|
|
606151
|
-
registerEsmLoaderHooks: false,
|
|
606152
|
-
normalizeDepth: 5,
|
|
606153
|
-
maxValueLength: 1500,
|
|
606154
|
-
integrations: [extraErrorDataIntegration()],
|
|
606155
|
-
tracePropagationTargets: []
|
|
606156
|
-
});
|
|
606157
|
-
}
|
|
606158
|
-
//#endregion
|
|
606159
606242
|
//#region src/updater.ts
|
|
606160
606243
|
const REGISTRY_BASE = "https://registry.npmjs.org/@builder.io";
|
|
606161
606244
|
const CHECK_INTERVAL_MS = 1440 * 60 * 1e3;
|
|
@@ -606169,7 +606252,7 @@ function isStandaloneBinary() {
|
|
|
606169
606252
|
return !path$6.basename(process.execPath, ".exe").startsWith("node");
|
|
606170
606253
|
}
|
|
606171
606254
|
function getCurrentVersion() {
|
|
606172
|
-
return "0.4.
|
|
606255
|
+
return "0.4.2";
|
|
606173
606256
|
}
|
|
606174
606257
|
async function fetchLatestVersion() {
|
|
606175
606258
|
return new Promise((resolve, reject) => {
|
|
@@ -606216,8 +606299,8 @@ function isNewerVersion(a, b) {
|
|
|
606216
606299
|
}
|
|
606217
606300
|
/**
|
|
606218
606301
|
* Checks npm registry for a newer version of fusion (at most once per 24h).
|
|
606219
|
-
* Returns
|
|
606220
|
-
* Never throws — update checks should never interrupt normal usage.
|
|
606302
|
+
* Returns the current and latest versions when an update is available, null
|
|
606303
|
+
* otherwise. Never throws — update checks should never interrupt normal usage.
|
|
606221
606304
|
*/
|
|
606222
606305
|
async function runUpdateCheck() {
|
|
606223
606306
|
if (!isStandaloneBinary()) return null;
|
|
@@ -606234,7 +606317,10 @@ async function runUpdateCheck() {
|
|
|
606234
606317
|
});
|
|
606235
606318
|
}
|
|
606236
606319
|
const current = getCurrentVersion();
|
|
606237
|
-
if (isNewerVersion(latestVersion, current)) return
|
|
606320
|
+
if (isNewerVersion(latestVersion, current)) return {
|
|
606321
|
+
currentVersion: current,
|
|
606322
|
+
latestVersion
|
|
606323
|
+
};
|
|
606238
606324
|
} catch {}
|
|
606239
606325
|
return null;
|
|
606240
606326
|
}
|
|
@@ -606377,26 +606463,258 @@ async function downloadFile(url, dest, onRequest) {
|
|
|
606377
606463
|
});
|
|
606378
606464
|
}
|
|
606379
606465
|
//#endregion
|
|
606466
|
+
//#region src/hooks/useUpdateCheck.ts
|
|
606467
|
+
/**
|
|
606468
|
+
* Runs the update check once on mount and returns a structured state object
|
|
606469
|
+
* describing whether a newer version of the CLI is available.
|
|
606470
|
+
*
|
|
606471
|
+
* - `checking` — the async check is still in progress
|
|
606472
|
+
* - `up-to-date` — the CLI is already on the latest version (or the check
|
|
606473
|
+
* doesn't apply, e.g. running via npx)
|
|
606474
|
+
* - `upgrade` — a newer version is available; `newVersion` holds the latest
|
|
606475
|
+
*/
|
|
606476
|
+
function useUpdateCheck() {
|
|
606477
|
+
const $ = (0, import_compiler_runtime.c)(3);
|
|
606478
|
+
let t0;
|
|
606479
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
606480
|
+
t0 = {
|
|
606481
|
+
status: "checking",
|
|
606482
|
+
currentVersion: getCurrentVersion(),
|
|
606483
|
+
newVersion: ""
|
|
606484
|
+
};
|
|
606485
|
+
$[0] = t0;
|
|
606486
|
+
} else t0 = $[0];
|
|
606487
|
+
const [state, setState] = (0, import_react.useState)(t0);
|
|
606488
|
+
let t1;
|
|
606489
|
+
let t2;
|
|
606490
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
606491
|
+
t1 = () => {
|
|
606492
|
+
runUpdateCheck().then((result) => {
|
|
606493
|
+
if (result) setState({
|
|
606494
|
+
status: "upgrade",
|
|
606495
|
+
currentVersion: result.currentVersion,
|
|
606496
|
+
newVersion: result.latestVersion
|
|
606497
|
+
});
|
|
606498
|
+
else setState(_temp$1);
|
|
606499
|
+
}).catch(() => {
|
|
606500
|
+
setState(_temp2$1);
|
|
606501
|
+
});
|
|
606502
|
+
};
|
|
606503
|
+
t2 = [];
|
|
606504
|
+
$[1] = t1;
|
|
606505
|
+
$[2] = t2;
|
|
606506
|
+
} else {
|
|
606507
|
+
t1 = $[1];
|
|
606508
|
+
t2 = $[2];
|
|
606509
|
+
}
|
|
606510
|
+
(0, import_react.useEffect)(t1, t2);
|
|
606511
|
+
return state;
|
|
606512
|
+
}
|
|
606513
|
+
function _temp2$1(prev_0) {
|
|
606514
|
+
return {
|
|
606515
|
+
...prev_0,
|
|
606516
|
+
status: "up-to-date"
|
|
606517
|
+
};
|
|
606518
|
+
}
|
|
606519
|
+
function _temp$1(prev) {
|
|
606520
|
+
return {
|
|
606521
|
+
...prev,
|
|
606522
|
+
status: "up-to-date"
|
|
606523
|
+
};
|
|
606524
|
+
}
|
|
606525
|
+
//#endregion
|
|
606526
|
+
//#region src/app.tsx
|
|
606527
|
+
function FatalErrorScreen(t0) {
|
|
606528
|
+
const $ = (0, import_compiler_runtime.c)(8);
|
|
606529
|
+
const { error } = t0;
|
|
606530
|
+
const { exit } = useApp();
|
|
606531
|
+
let t1;
|
|
606532
|
+
if ($[0] !== exit) {
|
|
606533
|
+
t1 = (input, key) => {
|
|
606534
|
+
if (input === "c" && key.ctrl) {
|
|
606535
|
+
exit();
|
|
606536
|
+
process.exit(0);
|
|
606537
|
+
}
|
|
606538
|
+
};
|
|
606539
|
+
$[0] = exit;
|
|
606540
|
+
$[1] = t1;
|
|
606541
|
+
} else t1 = $[1];
|
|
606542
|
+
useInput(t1);
|
|
606543
|
+
let t2;
|
|
606544
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
606545
|
+
t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
606546
|
+
color: "red",
|
|
606547
|
+
bold: true,
|
|
606548
|
+
children: "Fatal render error"
|
|
606549
|
+
});
|
|
606550
|
+
$[2] = t2;
|
|
606551
|
+
} else t2 = $[2];
|
|
606552
|
+
let t3;
|
|
606553
|
+
if ($[3] !== error.message) {
|
|
606554
|
+
t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
606555
|
+
color: "red",
|
|
606556
|
+
children: error.message
|
|
606557
|
+
});
|
|
606558
|
+
$[3] = error.message;
|
|
606559
|
+
$[4] = t3;
|
|
606560
|
+
} else t3 = $[4];
|
|
606561
|
+
let t4;
|
|
606562
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
606563
|
+
t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
606564
|
+
dimColor: true,
|
|
606565
|
+
children: "Press Ctrl+C to exit"
|
|
606566
|
+
});
|
|
606567
|
+
$[5] = t4;
|
|
606568
|
+
} else t4 = $[5];
|
|
606569
|
+
let t5;
|
|
606570
|
+
if ($[6] !== t3) {
|
|
606571
|
+
t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
606572
|
+
flexDirection: "column",
|
|
606573
|
+
padding: 1,
|
|
606574
|
+
gap: 1,
|
|
606575
|
+
children: [
|
|
606576
|
+
t2,
|
|
606577
|
+
t3,
|
|
606578
|
+
t4
|
|
606579
|
+
]
|
|
606580
|
+
});
|
|
606581
|
+
$[6] = t3;
|
|
606582
|
+
$[7] = t5;
|
|
606583
|
+
} else t5 = $[7];
|
|
606584
|
+
return t5;
|
|
606585
|
+
}
|
|
606586
|
+
function App(t0) {
|
|
606587
|
+
const $ = (0, import_compiler_runtime.c)(13);
|
|
606588
|
+
const { command, options, sys, theme } = t0;
|
|
606589
|
+
const { exit } = useApp();
|
|
606590
|
+
const { rows } = useWindowSize();
|
|
606591
|
+
const updateCheck = useUpdateCheck();
|
|
606592
|
+
let t1;
|
|
606593
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
606594
|
+
t1 = [];
|
|
606595
|
+
$[0] = t1;
|
|
606596
|
+
} else t1 = $[0];
|
|
606597
|
+
(0, import_react.useEffect)(_temp2, t1);
|
|
606598
|
+
let t2;
|
|
606599
|
+
if ($[1] !== command || $[2] !== exit || $[3] !== options || $[4] !== sys || $[5] !== updateCheck) {
|
|
606600
|
+
t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
|
|
606601
|
+
fallback: _temp3,
|
|
606602
|
+
children: command === "code" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeCommand, {
|
|
606603
|
+
onExit: exit,
|
|
606604
|
+
sys,
|
|
606605
|
+
options,
|
|
606606
|
+
updateCheck
|
|
606607
|
+
}) : command === "launch" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
606608
|
+
flexDirection: "column",
|
|
606609
|
+
paddingX: 1,
|
|
606610
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
606611
|
+
color: "yellow",
|
|
606612
|
+
children: "Launch command coming soon. Use: npx builder.io@latest launch"
|
|
606613
|
+
})
|
|
606614
|
+
}) : command === "index-repo" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
606615
|
+
flexDirection: "column",
|
|
606616
|
+
paddingX: 1,
|
|
606617
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
606618
|
+
color: "yellow",
|
|
606619
|
+
children: "Repo indexing coming soon. Use: npx builder.io@latest index-repo"
|
|
606620
|
+
})
|
|
606621
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
606622
|
+
flexDirection: "column",
|
|
606623
|
+
paddingX: 1,
|
|
606624
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
606625
|
+
color: "red",
|
|
606626
|
+
children: ["Unknown command: ", command]
|
|
606627
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
606628
|
+
dimColor: true,
|
|
606629
|
+
children: "Run builder --help for usage information"
|
|
606630
|
+
})]
|
|
606631
|
+
})
|
|
606632
|
+
});
|
|
606633
|
+
$[1] = command;
|
|
606634
|
+
$[2] = exit;
|
|
606635
|
+
$[3] = options;
|
|
606636
|
+
$[4] = sys;
|
|
606637
|
+
$[5] = updateCheck;
|
|
606638
|
+
$[6] = t2;
|
|
606639
|
+
} else t2 = $[6];
|
|
606640
|
+
let t3;
|
|
606641
|
+
if ($[7] !== rows || $[8] !== t2) {
|
|
606642
|
+
t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
606643
|
+
flexDirection: "column",
|
|
606644
|
+
height: rows,
|
|
606645
|
+
children: t2
|
|
606646
|
+
});
|
|
606647
|
+
$[7] = rows;
|
|
606648
|
+
$[8] = t2;
|
|
606649
|
+
$[9] = t3;
|
|
606650
|
+
} else t3 = $[9];
|
|
606651
|
+
let t4;
|
|
606652
|
+
if ($[10] !== t3 || $[11] !== theme) {
|
|
606653
|
+
t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext$1.Provider, {
|
|
606654
|
+
value: theme,
|
|
606655
|
+
children: t3
|
|
606656
|
+
});
|
|
606657
|
+
$[10] = t3;
|
|
606658
|
+
$[11] = theme;
|
|
606659
|
+
$[12] = t4;
|
|
606660
|
+
} else t4 = $[12];
|
|
606661
|
+
return t4;
|
|
606662
|
+
}
|
|
606663
|
+
function _temp3(error) {
|
|
606664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FatalErrorScreen, { error });
|
|
606665
|
+
}
|
|
606666
|
+
function _temp2() {
|
|
606667
|
+
enableSgrMouse();
|
|
606668
|
+
return _temp;
|
|
606669
|
+
}
|
|
606670
|
+
function _temp() {
|
|
606671
|
+
resetTerminal();
|
|
606672
|
+
}
|
|
606673
|
+
//#endregion
|
|
606674
|
+
//#region src/sentry.ts
|
|
606675
|
+
function initSentry() {
|
|
606676
|
+
init({
|
|
606677
|
+
dsn: "https://1c5033d697e0271ebe53773bff826de0@o117565.ingest.us.sentry.io/4511107776905216",
|
|
606678
|
+
tracesSampleRate: 0,
|
|
606679
|
+
release: "0.4.2",
|
|
606680
|
+
environment: process.env.NODE_ENV ?? "development",
|
|
606681
|
+
enabled: false,
|
|
606682
|
+
registerEsmLoaderHooks: false,
|
|
606683
|
+
normalizeDepth: 5,
|
|
606684
|
+
maxValueLength: 1500,
|
|
606685
|
+
integrations: [extraErrorDataIntegration()],
|
|
606686
|
+
tracePropagationTargets: []
|
|
606687
|
+
});
|
|
606688
|
+
}
|
|
606689
|
+
//#endregion
|
|
606380
606690
|
//#region src/cli.tsx
|
|
606381
|
-
const VERSION = "0.4.
|
|
606691
|
+
const VERSION = "0.4.2";
|
|
606382
606692
|
async function startInk(command, options) {
|
|
606693
|
+
const sys = await createDevToolsNodeSys({
|
|
606694
|
+
cwd: process.cwd(),
|
|
606695
|
+
ignoreMissingConfig: true
|
|
606696
|
+
});
|
|
606697
|
+
const logFile = process.env.FUSION_LOG_FILE;
|
|
606698
|
+
const theme = detectTheme(await queryOsc11());
|
|
606699
|
+
const file = typeof logFile === "string" ? fs.createWriteStream(logFile) : void 0;
|
|
606700
|
+
const restore = patchConsole((_, data) => {
|
|
606701
|
+
file?.write(data);
|
|
606702
|
+
});
|
|
606383
606703
|
await render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
|
|
606384
606704
|
command,
|
|
606385
606705
|
options,
|
|
606386
|
-
sys
|
|
606387
|
-
|
|
606388
|
-
ignoreMissingConfig: true
|
|
606389
|
-
}),
|
|
606390
|
-
theme: detectTheme(await queryOsc11())
|
|
606706
|
+
sys,
|
|
606707
|
+
theme
|
|
606391
606708
|
}), {
|
|
606392
606709
|
exitOnCtrlC: false,
|
|
606393
606710
|
incrementalRendering: true,
|
|
606394
606711
|
maxFps: 30,
|
|
606395
|
-
patchConsole:
|
|
606712
|
+
patchConsole: false,
|
|
606396
606713
|
concurrent: false,
|
|
606397
|
-
alternateScreen: true
|
|
606398
|
-
isScreenReaderEnabled: process.env["INK_SCREEN_READER"] === "true"
|
|
606714
|
+
alternateScreen: true
|
|
606399
606715
|
}).waitUntilExit();
|
|
606716
|
+
file?.end();
|
|
606717
|
+
restore();
|
|
606400
606718
|
await flush(2e3);
|
|
606401
606719
|
}
|
|
606402
606720
|
const program = new Command().name("fusion").version(VERSION, "-v, --version").description("Builder.io Fusion CLI — AI-powered code generation");
|
|
@@ -606423,9 +606741,6 @@ process.on("uncaughtException", (error) => {
|
|
|
606423
606741
|
captureException(error);
|
|
606424
606742
|
throw error;
|
|
606425
606743
|
});
|
|
606426
|
-
runUpdateCheck().then((msg) => {
|
|
606427
|
-
if (msg) process.stderr.write(`\n${msg}\n\n`);
|
|
606428
|
-
}).catch(() => {});
|
|
606429
606744
|
await program.parseAsync();
|
|
606430
606745
|
//#endregion
|
|
606431
606746
|
export {};
|