@builder.io/buildercode 0.3.6 → 0.3.9
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 +309 -271
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -244266,7 +244266,7 @@ const LIB_CACHE = /* @__PURE__ */ new Map();
|
|
|
244266
244266
|
const PENDING_LIB_CACHE = /* @__PURE__ */ new Map();
|
|
244267
244267
|
const NODE_MODULE_CACHE = /* @__PURE__ */ new Map();
|
|
244268
244268
|
const TSCONFIG_CACHE = /* @__PURE__ */ new Map();
|
|
244269
|
-
const pkgVersion = process.env.OVERRIDE_VERSION ?? "0.3.
|
|
244269
|
+
const pkgVersion = process.env.OVERRIDE_VERSION ?? "0.3.9";
|
|
244270
244270
|
//#endregion
|
|
244271
244271
|
//#region ../dev-tools/core/detect-frameworks.ts
|
|
244272
244272
|
async function detectFrameworks$1(sys) {
|
|
@@ -290208,7 +290208,7 @@ function wc$1({ parent: e }) {
|
|
|
290208
290208
|
default: return !1;
|
|
290209
290209
|
}
|
|
290210
290210
|
}
|
|
290211
|
-
function _c$
|
|
290211
|
+
function _c$18({ parent: e, grandparent: t }) {
|
|
290212
290212
|
return t?.type === "JSXAttribute" && e.type === "JSXExpressionContainer" && t.name.type === "JSXIdentifier" && t.name.name === "css";
|
|
290213
290213
|
}
|
|
290214
290214
|
async function co(e, t, r) {
|
|
@@ -295224,7 +295224,7 @@ var init_estree = __esmMin((() => {
|
|
|
295224
295224
|
(e, t) => e.type === "CallExpression" && e.callee.type === "Identifier" && e.callee.name === "Component" && t === "arguments",
|
|
295225
295225
|
(e, t) => e.type === "Decorator" && t === "expression"
|
|
295226
295226
|
];
|
|
295227
|
-
po$1 = (e) => Oc$1(e) || wc$1(e) || _c$
|
|
295227
|
+
po$1 = (e) => Oc$1(e) || wc$1(e) || _c$18(e) || oo$2(e);
|
|
295228
295228
|
Es$6 = 0;
|
|
295229
295229
|
fo = mo.bind(void 0, "html"), yo = mo.bind(void 0, "angular");
|
|
295230
295230
|
jc = [
|
|
@@ -399401,7 +399401,7 @@ function xc(t, e, s = {}) {
|
|
|
399401
399401
|
let r = It(t, s.backwards ? e - 1 : e, s);
|
|
399402
399402
|
return r !== Gt(t, r, s);
|
|
399403
399403
|
}
|
|
399404
|
-
function _c$
|
|
399404
|
+
function _c$17(t, e) {
|
|
399405
399405
|
if (e === !1) return !1;
|
|
399406
399406
|
if (t.charAt(e) === "/" && t.charAt(e + 1) === "*") {
|
|
399407
399407
|
for (let s = e + 2; s < t.length; ++s) if (t.charAt(s) === "*" && t.charAt(s + 1) === "/") return s + 2;
|
|
@@ -405226,7 +405226,7 @@ https://evilmartians.com/chronicles/postcss-8-plugin-migration`));
|
|
|
405226
405226
|
` || t === "\r" || t === "\u2028" || t === "\u2029";
|
|
405227
405227
|
Gt = vc;
|
|
405228
405228
|
Yt = xc;
|
|
405229
|
-
xi$1 = _c$
|
|
405229
|
+
xi$1 = _c$17;
|
|
405230
405230
|
_i = bc;
|
|
405231
405231
|
Vt$1 = Ec;
|
|
405232
405232
|
De = Oc;
|
|
@@ -518362,6 +518362,7 @@ var CodeGenSession = class CodeGenSession {
|
|
|
518362
518362
|
this.#privacyMode = options.privacyMode ?? options.fusionConfig?.privacyMode;
|
|
518363
518363
|
this.#devServerOrchestrator = options.devServerOrchestrator;
|
|
518364
518364
|
this.#git = options.git ?? false;
|
|
518365
|
+
this.#softContextWindow = options.softContextWindow;
|
|
518365
518366
|
if (this.#git) process.env.GIT_CEILING_DIRECTORIES = this.#workingDirectory;
|
|
518366
518367
|
this.#gitAutoInit = options.gitAutoInit ?? false;
|
|
518367
518368
|
this.#fusionConfig = options.fusionConfig;
|
|
@@ -518472,6 +518473,10 @@ var CodeGenSession = class CodeGenSession {
|
|
|
518472
518473
|
branchName: this.#branchName,
|
|
518473
518474
|
hasPlanToApply: this.#hasPlanToApply,
|
|
518474
518475
|
sessionMode: this.getSessionMode()
|
|
518476
|
+
},
|
|
518477
|
+
extraAttributes: {
|
|
518478
|
+
projectId: this.#projectId,
|
|
518479
|
+
branchName: this.#branchName
|
|
518475
518480
|
}
|
|
518476
518481
|
});
|
|
518477
518482
|
});
|
|
@@ -518765,6 +518770,7 @@ var CodeGenSession = class CodeGenSession {
|
|
|
518765
518770
|
this.#position = resolved.options.position;
|
|
518766
518771
|
this.#queueMode = resolved.options.queueMode ?? "next-turn";
|
|
518767
518772
|
this.#asyncSubAgents = resolved.options.asyncSubAgents ?? false;
|
|
518773
|
+
this.#softContextWindow = resolved.options.softContextWindow;
|
|
518768
518774
|
this.#builtInMCPServerConfig = {
|
|
518769
518775
|
...this.#builtInMCPServerConfig,
|
|
518770
518776
|
...resolved.options.builtInMCPServerConfig
|
|
@@ -519116,7 +519122,7 @@ Tips:
|
|
|
519116
519122
|
}
|
|
519117
519123
|
}
|
|
519118
519124
|
}
|
|
519119
|
-
async #setRemoteUrl(config, cwd) {
|
|
519125
|
+
async #setRemoteUrl(config, cwd, folderName) {
|
|
519120
519126
|
let currentOriginUrl;
|
|
519121
519127
|
try {
|
|
519122
519128
|
currentOriginUrl = (await this.git([
|
|
@@ -519152,7 +519158,11 @@ Tips:
|
|
|
519152
519158
|
"origin",
|
|
519153
519159
|
url
|
|
519154
519160
|
], cwd);
|
|
519155
|
-
if ((provider === "github" || provider === "selfHostedGithub") && token)
|
|
519161
|
+
if ((provider === "github" || provider === "selfHostedGithub") && token) {
|
|
519162
|
+
if (!folderName || folderName === this.gitEnabledFolders[0]?.name) process.env["GH_TOKEN"] = token;
|
|
519163
|
+
const isMultiRepo = this.gitEnabledFolders.length > 1;
|
|
519164
|
+
if (folderName && isMultiRepo) process.env[toGhTokenEnvKey(folderName)] = token;
|
|
519165
|
+
}
|
|
519156
519166
|
}
|
|
519157
519167
|
async pushRepoV2(repoInfo) {
|
|
519158
519168
|
return await this.#addToPendingPromises(this.#pushChanges({
|
|
@@ -519214,7 +519224,7 @@ Tips:
|
|
|
519214
519224
|
const config = gitConfigs?.[repo.repoName];
|
|
519215
519225
|
if (config?.url) {
|
|
519216
519226
|
const resolvedPath = this.#sys.resolve(this.#workingDirectory, repo.path);
|
|
519217
|
-
await this.#setRemoteUrl(config, resolvedPath);
|
|
519227
|
+
await this.#setRemoteUrl(config, resolvedPath, repo.name);
|
|
519218
519228
|
}
|
|
519219
519229
|
}
|
|
519220
519230
|
return {
|
|
@@ -520772,13 +520782,7 @@ Tips:
|
|
|
520772
520782
|
...this.#lastAICommits,
|
|
520773
520783
|
...allCommits
|
|
520774
520784
|
};
|
|
520775
|
-
|
|
520776
|
-
this.#sys.Sentry?.captureException(/* @__PURE__ */ new Error(`Failed to get current commit hash after revert`), { tags: {
|
|
520777
|
-
operation: "codegen-git",
|
|
520778
|
-
endpoint: "revertToCommitHash"
|
|
520779
|
-
} });
|
|
520780
|
-
return;
|
|
520781
|
-
}
|
|
520785
|
+
await this.#emitGitStatus();
|
|
520782
520786
|
this.requestRefresh();
|
|
520783
520787
|
await this.#completionFinalize({ lastCommit: serializeGitSnapshot(allCommits) });
|
|
520784
520788
|
}
|
|
@@ -521404,10 +521408,11 @@ Tips:
|
|
|
521404
521408
|
const agents = sessionContext.customAgents;
|
|
521405
521409
|
const agent = agentName ? agents.find((a) => a.name.toLowerCase() === agentName.toLowerCase()) : void 0;
|
|
521406
521410
|
const subagentType = agent?.name ?? "explorer";
|
|
521407
|
-
const { mcpServers = false, model, mode = "quality-v4-agent", systemPrompt, subagent_type, includeMemories, needDevServer, needValidation, queueMode, asyncSubAgents, resetAfterRun = false, reasoning } = {
|
|
521411
|
+
const { mcpServers = false, model, mode = "quality-v4-agent", systemPrompt, subagent_type, includeMemories, needDevServer, needValidation, queueMode, asyncSubAgents, resetAfterRun = false, reasoning, softContextWindow } = {
|
|
521408
521412
|
mcpServers: agent?.mcpServers,
|
|
521409
521413
|
subagent_type: subagentType,
|
|
521410
521414
|
systemPrompt: agent?.systemPrompt,
|
|
521415
|
+
softContextWindow: agent?.softContextWindow,
|
|
521411
521416
|
model: (() => {
|
|
521412
521417
|
if (agent?.roundRobinModels?.length) {
|
|
521413
521418
|
const key = agent.name;
|
|
@@ -521534,6 +521539,7 @@ Make the necessary changes and try again.`
|
|
|
521534
521539
|
credentials: this.#credentials,
|
|
521535
521540
|
position: agent?.position ?? `${basePosition}-${subagentType}`,
|
|
521536
521541
|
mode,
|
|
521542
|
+
softContextWindow,
|
|
521537
521543
|
includeMemories,
|
|
521538
521544
|
modelOverride: agent?.inheritSessionModel && (this.#lastModelOverride ?? this.#modelOverride) ? this.#lastModelOverride ?? this.#modelOverride : resolveModelShortcut(resolvedModel) ?? this.#lastModelOverride ?? this.#modelOverride,
|
|
521539
521545
|
sessionOrCompletionId: sessionId,
|
|
@@ -521577,7 +521583,10 @@ Make the necessary changes and try again.`
|
|
|
521577
521583
|
checkpointCommitHash = (await this.#emitGitStatus())?.currentCommit;
|
|
521578
521584
|
}
|
|
521579
521585
|
const subagent_type = agentConfig.subagent_type;
|
|
521580
|
-
const agentSession = new CodeGenSession(
|
|
521586
|
+
const agentSession = new CodeGenSession({
|
|
521587
|
+
...agentConfig.options,
|
|
521588
|
+
git: false
|
|
521589
|
+
});
|
|
521581
521590
|
const subAgentId = options.sessionId ?? options.resume ?? sessionId;
|
|
521582
521591
|
const agentPromise = Promise.withResolvers();
|
|
521583
521592
|
this.#runningSubAgents.set(subAgentId, {
|
|
@@ -523370,6 +523379,7 @@ failed with code ${result.code}`,
|
|
|
523370
523379
|
projectId: this.#projectId,
|
|
523371
523380
|
branchName: this.#branchName,
|
|
523372
523381
|
repoHash: this.#repoHash,
|
|
523382
|
+
repoBranch: this.#aiBranch,
|
|
523373
523383
|
pingEvents: true,
|
|
523374
523384
|
workingDirectory: this.#bashWorkingDirectory,
|
|
523375
523385
|
beforeCommit,
|
|
@@ -523390,7 +523400,8 @@ failed with code ${result.code}`,
|
|
|
523390
523400
|
redactUserMessages: this.#privacyMode?.redactUserMessages,
|
|
523391
523401
|
redactLLMMessages: this.#privacyMode?.redactLLMMessages,
|
|
523392
523402
|
modelOverride: userInput.modelOverride ?? this.#modelOverride,
|
|
523393
|
-
reasoning: this.#reasoning
|
|
523403
|
+
reasoning: this.#reasoning,
|
|
523404
|
+
interruptActiveTask: userInput.userMessage?.queue === false || void 0
|
|
523394
523405
|
};
|
|
523395
523406
|
if (this.#debug) this.#logger.debug(`(generateCompletion-${currentId}): request partial body. ${JSON.stringify({
|
|
523396
523407
|
url: body.url,
|
|
@@ -527117,6 +527128,7 @@ async function executeShellCommand(toolContext, command, timeout, toolId, shellT
|
|
|
527117
527128
|
...devServerOrchestrator?.envVars
|
|
527118
527129
|
};
|
|
527119
527130
|
if (process.env.GH_TOKEN) env.GH_TOKEN = process.env.GH_TOKEN;
|
|
527131
|
+
for (const key of Object.keys(process.env)) if (key.startsWith("GH_TOKEN_") && process.env[key]) env[key] = process.env[key];
|
|
527120
527132
|
const shouldLogin = !devServerOrchestrator?.hasSetupEnvVars;
|
|
527121
527133
|
const proc = safeSpawn(shell, command, {
|
|
527122
527134
|
stdio: [
|
|
@@ -527268,6 +527280,11 @@ function dispatchAgent(toolContext, { prompt, subagent_type, resume, origin_chan
|
|
|
527268
527280
|
resume,
|
|
527269
527281
|
attachmentUrls
|
|
527270
527282
|
});
|
|
527283
|
+
if (toolContext.signal.aborted) return {
|
|
527284
|
+
isError: true,
|
|
527285
|
+
toolResult: `Agent task was aborted by the user, or by the system due to a new message being processesed.`,
|
|
527286
|
+
title: "Agent Task Aborted"
|
|
527287
|
+
};
|
|
527271
527288
|
if (!result.success) return {
|
|
527272
527289
|
isError: true,
|
|
527273
527290
|
toolResult: result.response,
|
|
@@ -528449,6 +528466,7 @@ async function* completionStream(sys, credentials, body, signal, debug) {
|
|
|
528449
528466
|
const res = await safeFetch(url, {
|
|
528450
528467
|
method: "POST",
|
|
528451
528468
|
body: json,
|
|
528469
|
+
keepalive: true,
|
|
528452
528470
|
headers: {
|
|
528453
528471
|
"Content-Type": "application/json",
|
|
528454
528472
|
Authorization: `Bearer ${credentials.builderPrivateKey}`
|
|
@@ -528891,6 +528909,13 @@ const getEnvironmentVariablesPrompt = (envs) => {
|
|
|
528891
528909
|
prompt += `</environment_variables>\n`;
|
|
528892
528910
|
return prompt;
|
|
528893
528911
|
};
|
|
528912
|
+
/**
|
|
528913
|
+
* Converts a folder name to a per-repo GitHub token env var key.
|
|
528914
|
+
* e.g. "code" → "GH_TOKEN_CODE", "ai-services" → "GH_TOKEN_AI_SERVICES"
|
|
528915
|
+
*/
|
|
528916
|
+
function toGhTokenEnvKey(folderName) {
|
|
528917
|
+
return `GH_TOKEN_${folderName.toUpperCase().replace(/[^A-Z0-9]/g, "_")}`;
|
|
528918
|
+
}
|
|
528894
528919
|
function inferGitProvider(repoUrl) {
|
|
528895
528920
|
if (!repoUrl) return "unknown";
|
|
528896
528921
|
const url = repoUrl.toLowerCase();
|
|
@@ -528941,8 +528966,14 @@ function generateGitStatusReminder(gitStatus, gitEnabledFolders, context) {
|
|
|
528941
528966
|
break;
|
|
528942
528967
|
}
|
|
528943
528968
|
if (repoName) lines.push(` - Repository: ${repoName}`);
|
|
528944
|
-
if (provider !== "unknown") if ((provider === "github" || provider === "selfHostedGithub") && process.env["GH_TOKEN"])
|
|
528945
|
-
|
|
528969
|
+
if (provider !== "unknown") if ((provider === "github" || provider === "selfHostedGithub") && process.env["GH_TOKEN"]) {
|
|
528970
|
+
lines.push(` - Provider: GitHub ( gh cli is available using the Bash tool )`);
|
|
528971
|
+
const repoTokenKeys = Object.keys(process.env).filter((k) => k.startsWith("GH_TOKEN_")).sort();
|
|
528972
|
+
if (repoTokenKeys.length > 0) {
|
|
528973
|
+
lines.push(` - GitHub token env vars: GH_TOKEN (primary repo default), ${repoTokenKeys.join(", ")}`);
|
|
528974
|
+
lines.push(` - Use the repo-specific GH_TOKEN_<REPO> when targeting a specific linked repo; fall back to GH_TOKEN for the primary repo`);
|
|
528975
|
+
}
|
|
528976
|
+
} else lines.push(` - Provider: ${provider}`);
|
|
528946
528977
|
lines.push(` - Current branch: ${gitStatus.currentBranch}`);
|
|
528947
528978
|
lines.push(` - Remote branch exists: ${gitStatus.remoteBranchExists ? "yes" : "no"}`);
|
|
528948
528979
|
if (gitStatus.currentCommit) lines.push(` - Current commit: ${gitStatus.currentCommit.slice(0, 7)}`);
|
|
@@ -530388,7 +530419,9 @@ async function getFusionConfig(sys, args) {
|
|
|
530388
530419
|
"netlify *",
|
|
530389
530420
|
"node *",
|
|
530390
530421
|
"tsx *",
|
|
530391
|
-
"builderio *"
|
|
530422
|
+
"builderio *",
|
|
530423
|
+
"builder *",
|
|
530424
|
+
"open *"
|
|
530392
530425
|
]
|
|
530393
530426
|
};
|
|
530394
530427
|
if (args.configJson) try {
|
|
@@ -531982,24 +532015,61 @@ function getNextLineIndex(text, cursor) {
|
|
|
531982
532015
|
for (let i = 0; i <= lineIdx; i++) newIdx += lines[i].length + 1;
|
|
531983
532016
|
return newIdx + Math.min(col, targetLine.length);
|
|
531984
532017
|
}
|
|
532018
|
+
const inputHistory = {
|
|
532019
|
+
history: [],
|
|
532020
|
+
historyIndex: -1,
|
|
532021
|
+
historyDraft: "",
|
|
532022
|
+
listeners: /* @__PURE__ */ new Set()
|
|
532023
|
+
};
|
|
532024
|
+
function notifyHistoryListeners() {
|
|
532025
|
+
inputHistory.listeners.forEach((l) => l());
|
|
532026
|
+
}
|
|
532027
|
+
function useInputHistory() {
|
|
532028
|
+
const $ = (0, import_compiler_runtime.c)(3);
|
|
532029
|
+
const [, forceUpdate] = (0, import_react.useState)(0);
|
|
532030
|
+
let t0;
|
|
532031
|
+
if ($[0] !== forceUpdate) {
|
|
532032
|
+
t0 = () => {
|
|
532033
|
+
const listener = () => forceUpdate(_temp$7);
|
|
532034
|
+
inputHistory.listeners.add(listener);
|
|
532035
|
+
return () => {
|
|
532036
|
+
inputHistory.listeners.delete(listener);
|
|
532037
|
+
};
|
|
532038
|
+
};
|
|
532039
|
+
$[0] = forceUpdate;
|
|
532040
|
+
$[1] = t0;
|
|
532041
|
+
} else t0 = $[1];
|
|
532042
|
+
let t1;
|
|
532043
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
532044
|
+
t1 = [];
|
|
532045
|
+
$[2] = t1;
|
|
532046
|
+
} else t1 = $[2];
|
|
532047
|
+
(0, import_react.useEffect)(t0, t1);
|
|
532048
|
+
return inputHistory;
|
|
532049
|
+
}
|
|
532050
|
+
function _temp$7(n) {
|
|
532051
|
+
return n + 1;
|
|
532052
|
+
}
|
|
531985
532053
|
function useTextInput(options = {}) {
|
|
531986
532054
|
const { onSubmit, onChange, onScrollUp, onScrollDown, onTab, isActive = true, getIsMenuActive, submitDisabled = false, disableHistory = false } = options;
|
|
531987
532055
|
const [value, setValueState] = (0, import_react.useState)("");
|
|
531988
532056
|
const [cursorIndex, setCursorIndex] = (0, import_react.useState)(0);
|
|
531989
532057
|
const [pasteLength, setPasteLength] = (0, import_react.useState)(0);
|
|
531990
|
-
|
|
531991
|
-
const
|
|
531992
|
-
|
|
532058
|
+
useInputHistory();
|
|
532059
|
+
const fnDeleteRef = (0, import_react.useRef)(false);
|
|
532060
|
+
(0, import_react.useEffect)(() => {
|
|
532061
|
+
const onData = (data) => {
|
|
532062
|
+
if (data.includes("\x1B[3~")) fnDeleteRef.current = true;
|
|
532063
|
+
};
|
|
532064
|
+
process.stdin.on("data", onData);
|
|
532065
|
+
return () => {
|
|
532066
|
+
process.stdin.off("data", onData);
|
|
532067
|
+
};
|
|
532068
|
+
}, []);
|
|
531993
532069
|
const valueRef = (0, import_react.useRef)(value);
|
|
531994
532070
|
const cursorRef = (0, import_react.useRef)(cursorIndex);
|
|
531995
|
-
const historyRef = (0, import_react.useRef)(history);
|
|
531996
|
-
const historyIndexRef = (0, import_react.useRef)(historyIndex);
|
|
531997
|
-
const historyDraftRef = (0, import_react.useRef)(historyDraft);
|
|
531998
532071
|
valueRef.current = value;
|
|
531999
532072
|
cursorRef.current = cursorIndex;
|
|
532000
|
-
historyRef.current = history;
|
|
532001
|
-
historyIndexRef.current = historyIndex;
|
|
532002
|
-
historyDraftRef.current = historyDraft;
|
|
532003
532073
|
const applyValue = (0, import_react.useCallback)((val, cursor) => {
|
|
532004
532074
|
const nextCursor = cursor ?? val.length;
|
|
532005
532075
|
setValueState(val);
|
|
@@ -532013,8 +532083,9 @@ function useTextInput(options = {}) {
|
|
|
532013
532083
|
setValueState("");
|
|
532014
532084
|
setCursorIndex(0);
|
|
532015
532085
|
setPasteLength(0);
|
|
532016
|
-
|
|
532017
|
-
|
|
532086
|
+
inputHistory.historyIndex = -1;
|
|
532087
|
+
inputHistory.historyDraft = "";
|
|
532088
|
+
notifyHistoryListeners();
|
|
532018
532089
|
onChange?.("");
|
|
532019
532090
|
}, [onChange]);
|
|
532020
532091
|
useInput((input, key) => {
|
|
@@ -532037,9 +532108,10 @@ function useTextInput(options = {}) {
|
|
|
532037
532108
|
if (isMenuActive && (key.upArrow || key.downArrow || key.return || key.escape)) return;
|
|
532038
532109
|
if (key.return && !key.ctrl && !key.shift && !key.meta && !isMenuActive) {
|
|
532039
532110
|
if (submitDisabled) return;
|
|
532040
|
-
if (val_1.trim())
|
|
532041
|
-
|
|
532042
|
-
|
|
532111
|
+
if (val_1.trim()) inputHistory.history = [...inputHistory.history, val_1];
|
|
532112
|
+
inputHistory.historyIndex = -1;
|
|
532113
|
+
inputHistory.historyDraft = "";
|
|
532114
|
+
notifyHistoryListeners();
|
|
532043
532115
|
onSubmit?.(val_1);
|
|
532044
532116
|
setValueState("");
|
|
532045
532117
|
setCursorIndex(0);
|
|
@@ -532108,13 +532180,13 @@ function useTextInput(options = {}) {
|
|
|
532108
532180
|
if (key.upArrow) {
|
|
532109
532181
|
const isMultiLine = val_1.includes("\n");
|
|
532110
532182
|
if (!disableHistory && isOnFirstLine(val_1, cursor_0) && !isMultiLine) {
|
|
532111
|
-
const
|
|
532112
|
-
const hi = historyIndexRef.current;
|
|
532183
|
+
const { history: h, historyIndex: hi } = inputHistory;
|
|
532113
532184
|
const nextIndex = hi + 1;
|
|
532114
|
-
if (nextIndex <
|
|
532115
|
-
if (hi === -1)
|
|
532116
|
-
const historyValue =
|
|
532117
|
-
|
|
532185
|
+
if (nextIndex < h.length) {
|
|
532186
|
+
if (hi === -1) inputHistory.historyDraft = val_1;
|
|
532187
|
+
const historyValue = h[h.length - 1 - nextIndex];
|
|
532188
|
+
inputHistory.historyIndex = nextIndex;
|
|
532189
|
+
notifyHistoryListeners();
|
|
532118
532190
|
setValueState(historyValue);
|
|
532119
532191
|
setCursorIndex(historyValue.length);
|
|
532120
532192
|
onChange?.(historyValue);
|
|
@@ -532126,18 +532198,18 @@ function useTextInput(options = {}) {
|
|
|
532126
532198
|
if (key.downArrow) {
|
|
532127
532199
|
const isMultiLine_0 = val_1.includes("\n");
|
|
532128
532200
|
if (!disableHistory && isOnLastLine(val_1, cursor_0) && !isMultiLine_0) {
|
|
532129
|
-
const
|
|
532130
|
-
const hi_0 = historyIndexRef.current;
|
|
532131
|
-
const hd = historyDraftRef.current;
|
|
532201
|
+
const { history: h_0, historyIndex: hi_0, historyDraft: hd } = inputHistory;
|
|
532132
532202
|
if (hi_0 > 0) {
|
|
532133
532203
|
const nextIndex_0 = hi_0 - 1;
|
|
532134
|
-
const historyValue_0 =
|
|
532135
|
-
|
|
532204
|
+
const historyValue_0 = h_0[h_0.length - 1 - nextIndex_0];
|
|
532205
|
+
inputHistory.historyIndex = nextIndex_0;
|
|
532206
|
+
notifyHistoryListeners();
|
|
532136
532207
|
setValueState(historyValue_0);
|
|
532137
532208
|
setCursorIndex(historyValue_0.length);
|
|
532138
532209
|
onChange?.(historyValue_0);
|
|
532139
532210
|
} else if (hi_0 === 0) {
|
|
532140
|
-
|
|
532211
|
+
inputHistory.historyIndex = -1;
|
|
532212
|
+
notifyHistoryListeners();
|
|
532141
532213
|
setValueState(hd);
|
|
532142
532214
|
setCursorIndex(hd.length);
|
|
532143
532215
|
onChange?.(hd);
|
|
@@ -532156,26 +532228,36 @@ function useTextInput(options = {}) {
|
|
|
532156
532228
|
setPasteLength(0);
|
|
532157
532229
|
return;
|
|
532158
532230
|
}
|
|
532159
|
-
if (key.
|
|
532160
|
-
|
|
532161
|
-
|
|
532162
|
-
|
|
532231
|
+
if (key.delete || key.backspace) {
|
|
532232
|
+
const isFnDelete = fnDeleteRef.current;
|
|
532233
|
+
fnDeleteRef.current = false;
|
|
532234
|
+
if (isFnDelete) {
|
|
532235
|
+
if (cursor_0 < val_1.length) {
|
|
532236
|
+
const next_3 = val_1.slice(0, cursor_0) + val_1.slice(cursor_0 + 1);
|
|
532237
|
+
setValueState(next_3);
|
|
532238
|
+
setPasteLength(0);
|
|
532239
|
+
onChange?.(next_3);
|
|
532240
|
+
}
|
|
532241
|
+
} else if (cursor_0 > 0) {
|
|
532242
|
+
const next_4 = val_1.slice(0, cursor_0 - 1) + val_1.slice(cursor_0);
|
|
532243
|
+
setValueState(next_4);
|
|
532163
532244
|
setCursorIndex(cursor_0 - 1);
|
|
532164
532245
|
setPasteLength(0);
|
|
532165
|
-
onChange?.(
|
|
532246
|
+
onChange?.(next_4);
|
|
532166
532247
|
}
|
|
532167
532248
|
return;
|
|
532168
532249
|
}
|
|
532169
532250
|
if (input) {
|
|
532170
|
-
if (
|
|
532171
|
-
|
|
532172
|
-
|
|
532251
|
+
if (inputHistory.historyIndex !== -1) {
|
|
532252
|
+
inputHistory.historyIndex = -1;
|
|
532253
|
+
inputHistory.historyDraft = "";
|
|
532254
|
+
notifyHistoryListeners();
|
|
532173
532255
|
}
|
|
532174
|
-
const
|
|
532175
|
-
setValueState(
|
|
532256
|
+
const next_5 = val_1.slice(0, cursor_0) + input + val_1.slice(cursor_0);
|
|
532257
|
+
setValueState(next_5);
|
|
532176
532258
|
setCursorIndex(cursor_0 + input.length);
|
|
532177
532259
|
setPasteLength(input.length > 1 ? input.length : 0);
|
|
532178
|
-
onChange?.(
|
|
532260
|
+
onChange?.(next_5);
|
|
532179
532261
|
}
|
|
532180
532262
|
}, { isActive });
|
|
532181
532263
|
return {
|
|
@@ -532233,161 +532315,78 @@ function computeCursorPos(value, cursorIndex, tabSize) {
|
|
|
532233
532315
|
isNewline
|
|
532234
532316
|
};
|
|
532235
532317
|
}
|
|
532236
|
-
const ControlledTextInput = (0, import_react.memo)(function ControlledTextInput(
|
|
532237
|
-
const $ = (0, import_compiler_runtime.c)(44);
|
|
532238
|
-
const { value, cursorIndex: t1, placeholder: t2, showCursor: t3, focus: t4, rows, maxRows: t5, tabSize: t6 } = t0;
|
|
532239
|
-
const cursorIndex = t1 === void 0 ? 0 : t1;
|
|
532240
|
-
const placeholder = t2 === void 0 ? "" : t2;
|
|
532241
|
-
const showCursor = t3 === void 0 ? true : t3;
|
|
532242
|
-
const focus = t4 === void 0 ? true : t4;
|
|
532243
|
-
const maxRows = t5 === void 0 ? 10 : t5;
|
|
532244
|
-
const tabSize = t6 === void 0 ? 4 : t6;
|
|
532318
|
+
const ControlledTextInput = (0, import_react.memo)(function ControlledTextInput({ value, cursorIndex = 0, placeholder = "", showCursor = true, focus = true, rows, maxRows = 10, tabSize = 4 }) {
|
|
532245
532319
|
const minRows = rows ?? 1;
|
|
532246
|
-
|
|
532247
|
-
|
|
532248
|
-
|
|
532249
|
-
|
|
532250
|
-
|
|
532251
|
-
|
|
532252
|
-
$[3] = t7;
|
|
532253
|
-
} else t7 = $[3];
|
|
532254
|
-
const cursorInfo = t7;
|
|
532255
|
-
let t8;
|
|
532256
|
-
if ($[4] !== tabSize || $[5] !== value) {
|
|
532257
|
-
t8 = value ? fmt(value, tabSize).split("\n") : [];
|
|
532258
|
-
$[4] = tabSize;
|
|
532259
|
-
$[5] = value;
|
|
532260
|
-
$[6] = t8;
|
|
532261
|
-
} else t8 = $[6];
|
|
532262
|
-
const allLines = t8;
|
|
532320
|
+
const cursorInfo = (0, import_react.useMemo)(() => value ? computeCursorPos(value, cursorIndex, tabSize) : null, [
|
|
532321
|
+
value,
|
|
532322
|
+
cursorIndex,
|
|
532323
|
+
tabSize
|
|
532324
|
+
]);
|
|
532325
|
+
const allLines = (0, import_react.useMemo)(() => value ? fmt(value, tabSize).split("\n") : [], [value, tabSize]);
|
|
532263
532326
|
const lineCount = allLines.length;
|
|
532264
532327
|
const cursorLineIdx = cursorInfo?.lineIdx ?? 0;
|
|
532265
532328
|
const cursorColIdx = cursorInfo?.colIdx ?? 0;
|
|
532266
532329
|
const cursorDisplayChar = cursorInfo?.char ?? " ";
|
|
532267
532330
|
const charIsNewline = cursorInfo?.isNewline ?? false;
|
|
532268
532331
|
const visibleRows = value ? Math.max(minRows, Math.min(maxRows, lineCount)) : minRows;
|
|
532269
|
-
const
|
|
532270
|
-
let
|
|
532271
|
-
if ($[7] !== allLines || $[8] !== scrollStart || $[9] !== value || $[10] !== visibleRows) {
|
|
532272
|
-
t9 = value ? allLines.slice(scrollStart, scrollStart + visibleRows) : [];
|
|
532273
|
-
$[7] = allLines;
|
|
532274
|
-
$[8] = scrollStart;
|
|
532275
|
-
$[9] = value;
|
|
532276
|
-
$[10] = visibleRows;
|
|
532277
|
-
$[11] = t9;
|
|
532278
|
-
} else t9 = $[11];
|
|
532279
|
-
const visibleLines = t9;
|
|
532332
|
+
const scrollStartRef = (0, import_react.useRef)(0);
|
|
532333
|
+
let scrollStart;
|
|
532280
532334
|
if (!value) {
|
|
532281
|
-
|
|
532282
|
-
|
|
532283
|
-
|
|
532284
|
-
|
|
532285
|
-
|
|
532286
|
-
|
|
532287
|
-
|
|
532288
|
-
|
|
532289
|
-
|
|
532290
|
-
|
|
532291
|
-
|
|
532292
|
-
|
|
532293
|
-
|
|
532294
|
-
|
|
532295
|
-
|
|
532296
|
-
|
|
532297
|
-
|
|
532298
|
-
|
|
532299
|
-
|
|
532300
|
-
|
|
532301
|
-
|
|
532302
|
-
|
|
532303
|
-
|
|
532304
|
-
|
|
532305
|
-
|
|
532306
|
-
}
|
|
532307
|
-
|
|
532308
|
-
|
|
532309
|
-
|
|
532310
|
-
|
|
532311
|
-
|
|
532312
|
-
|
|
532313
|
-
|
|
532314
|
-
|
|
532315
|
-
|
|
532316
|
-
|
|
532317
|
-
|
|
532318
|
-
|
|
532319
|
-
|
|
532320
|
-
|
|
532321
|
-
|
|
532322
|
-
|
|
532323
|
-
|
|
532324
|
-
|
|
532325
|
-
|
|
532326
|
-
|
|
532327
|
-
|
|
532328
|
-
|
|
532329
|
-
|
|
532330
|
-
|
|
532331
|
-
|
|
532332
|
-
|
|
532333
|
-
|
|
532334
|
-
|
|
532335
|
-
|
|
532336
|
-
children: t10
|
|
532337
|
-
});
|
|
532338
|
-
$[25] = t10;
|
|
532339
|
-
$[26] = t11;
|
|
532340
|
-
} else t11 = $[26];
|
|
532341
|
-
return t11;
|
|
532342
|
-
}
|
|
532343
|
-
let t10;
|
|
532344
|
-
if ($[27] !== charIsNewline || $[28] !== cursorColIdx || $[29] !== cursorDisplayChar || $[30] !== cursorLineIdx || $[31] !== scrollStart || $[32] !== showCursor || $[33] !== visibleLines) {
|
|
532345
|
-
let t11;
|
|
532346
|
-
if ($[35] !== charIsNewline || $[36] !== cursorColIdx || $[37] !== cursorDisplayChar || $[38] !== cursorLineIdx || $[39] !== scrollStart || $[40] !== showCursor) {
|
|
532347
|
-
t11 = (line_0, i_0) => {
|
|
532348
|
-
const absLine = i_0 + scrollStart;
|
|
532349
|
-
if (absLine !== cursorLineIdx) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: line_0 || " " }, absLine);
|
|
532350
|
-
const beforeCursor = line_0.slice(0, cursorColIdx);
|
|
532351
|
-
const afterCursor = charIsNewline ? "" : line_0.slice(cursorColIdx + cursorDisplayChar.length);
|
|
532352
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
|
|
532353
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: beforeCursor }),
|
|
532354
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
532355
|
-
inverse: showCursor,
|
|
532356
|
-
children: cursorDisplayChar
|
|
532357
|
-
}),
|
|
532358
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: afterCursor })
|
|
532359
|
-
] }, absLine);
|
|
532360
|
-
};
|
|
532361
|
-
$[35] = charIsNewline;
|
|
532362
|
-
$[36] = cursorColIdx;
|
|
532363
|
-
$[37] = cursorDisplayChar;
|
|
532364
|
-
$[38] = cursorLineIdx;
|
|
532365
|
-
$[39] = scrollStart;
|
|
532366
|
-
$[40] = showCursor;
|
|
532367
|
-
$[41] = t11;
|
|
532368
|
-
} else t11 = $[41];
|
|
532369
|
-
t10 = visibleLines.map(t11);
|
|
532370
|
-
$[27] = charIsNewline;
|
|
532371
|
-
$[28] = cursorColIdx;
|
|
532372
|
-
$[29] = cursorDisplayChar;
|
|
532373
|
-
$[30] = cursorLineIdx;
|
|
532374
|
-
$[31] = scrollStart;
|
|
532375
|
-
$[32] = showCursor;
|
|
532376
|
-
$[33] = visibleLines;
|
|
532377
|
-
$[34] = t10;
|
|
532378
|
-
} else t10 = $[34];
|
|
532379
|
-
let t11;
|
|
532380
|
-
if ($[42] !== t10) {
|
|
532381
|
-
t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
532382
|
-
flexDirection: "column",
|
|
532383
|
-
flexShrink: 0,
|
|
532384
|
-
flexGrow: 0,
|
|
532385
|
-
children: t10
|
|
532386
|
-
});
|
|
532387
|
-
$[42] = t10;
|
|
532388
|
-
$[43] = t11;
|
|
532389
|
-
} else t11 = $[43];
|
|
532390
|
-
return t11;
|
|
532335
|
+
scrollStart = 0;
|
|
532336
|
+
scrollStartRef.current = 0;
|
|
532337
|
+
} else {
|
|
532338
|
+
let s = scrollStartRef.current;
|
|
532339
|
+
if (cursorLineIdx < s) s = cursorLineIdx;
|
|
532340
|
+
else if (cursorLineIdx >= s + visibleRows) s = cursorLineIdx - visibleRows + 1;
|
|
532341
|
+
s = Math.max(0, Math.min(lineCount - visibleRows, s));
|
|
532342
|
+
scrollStartRef.current = s;
|
|
532343
|
+
scrollStart = s;
|
|
532344
|
+
}
|
|
532345
|
+
const visibleLines = (0, import_react.useMemo)(() => value ? allLines.slice(scrollStart, scrollStart + visibleRows) : [], [
|
|
532346
|
+
value,
|
|
532347
|
+
allLines,
|
|
532348
|
+
scrollStart,
|
|
532349
|
+
visibleRows
|
|
532350
|
+
]);
|
|
532351
|
+
if (!value) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
532352
|
+
height: minRows,
|
|
532353
|
+
overflow: "hidden",
|
|
532354
|
+
flexDirection: "column",
|
|
532355
|
+
flexShrink: 0,
|
|
532356
|
+
flexGrow: 0,
|
|
532357
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [showCursor && focus && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
532358
|
+
inverse: true,
|
|
532359
|
+
children: " "
|
|
532360
|
+
}), placeholder ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
532361
|
+
dimColor: true,
|
|
532362
|
+
children: placeholder
|
|
532363
|
+
}) : null] })
|
|
532364
|
+
});
|
|
532365
|
+
if (!focus) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
532366
|
+
flexDirection: "column",
|
|
532367
|
+
flexShrink: 0,
|
|
532368
|
+
flexGrow: 0,
|
|
532369
|
+
children: visibleLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: line || " " }, i))
|
|
532370
|
+
});
|
|
532371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
532372
|
+
flexDirection: "column",
|
|
532373
|
+
flexShrink: 0,
|
|
532374
|
+
flexGrow: 0,
|
|
532375
|
+
children: visibleLines.map((line_0, i_0) => {
|
|
532376
|
+
const absLine = i_0 + scrollStart;
|
|
532377
|
+
if (absLine !== cursorLineIdx) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: line_0 || " " }, absLine);
|
|
532378
|
+
const beforeCursor = line_0.slice(0, cursorColIdx);
|
|
532379
|
+
const afterCursor = charIsNewline ? "" : line_0.slice(cursorColIdx + cursorDisplayChar.length);
|
|
532380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, { children: [
|
|
532381
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: beforeCursor }),
|
|
532382
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
532383
|
+
inverse: showCursor,
|
|
532384
|
+
children: cursorDisplayChar
|
|
532385
|
+
}),
|
|
532386
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: afterCursor })
|
|
532387
|
+
] }, absLine);
|
|
532388
|
+
})
|
|
532389
|
+
});
|
|
532391
532390
|
});
|
|
532392
532391
|
/**
|
|
532393
532392
|
* `TextInput` manages its own value state (via `useTextInput`) and delegates
|
|
@@ -532443,9 +532442,6 @@ function TextInput(t0) {
|
|
|
532443
532442
|
} else t2 = $[16];
|
|
532444
532443
|
return t2;
|
|
532445
532444
|
}
|
|
532446
|
-
function _temp$7(line, i) {
|
|
532447
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, { children: line || " " }, i);
|
|
532448
|
-
}
|
|
532449
532445
|
//#endregion
|
|
532450
532446
|
//#region ../../node_modules/jsonrepair/lib/esm/utils/JSONRepairError.js
|
|
532451
532447
|
var JSONRepairError = class extends Error {
|
|
@@ -533719,6 +533715,10 @@ function useCodeGenStateHandler() {
|
|
|
533719
533715
|
state.metadata = step;
|
|
533720
533716
|
break;
|
|
533721
533717
|
case "start":
|
|
533718
|
+
if (step.name !== "thinking") {
|
|
533719
|
+
const prevThinking = state.messages.findLast((m_0) => m_0.type === "thinking");
|
|
533720
|
+
if (prevThinking) prevThinking.streaming = false;
|
|
533721
|
+
}
|
|
533722
533722
|
if (step.name === "text") state.messages.push({
|
|
533723
533723
|
id: step.name,
|
|
533724
533724
|
type: "text",
|
|
@@ -533741,10 +533741,6 @@ function useCodeGenStateHandler() {
|
|
|
533741
533741
|
content: step.content ?? "",
|
|
533742
533742
|
streaming: true
|
|
533743
533743
|
});
|
|
533744
|
-
else {
|
|
533745
|
-
const prevThinking = state.messages.findLast((m_0) => m_0.type === "thinking");
|
|
533746
|
-
if (prevThinking) prevThinking.streaming = false;
|
|
533747
|
-
}
|
|
533748
533744
|
break;
|
|
533749
533745
|
case "delta": {
|
|
533750
533746
|
const stepName = step.name;
|
|
@@ -533826,7 +533822,14 @@ function useCodeGenStateHandler() {
|
|
|
533826
533822
|
state.activeUserQuestions = void 0;
|
|
533827
533823
|
const doneThinking = state.messages.findLast((m) => m.type === "thinking");
|
|
533828
533824
|
if (doneThinking) doneThinking.streaming = false;
|
|
533829
|
-
if (step.applyResults?.length)
|
|
533825
|
+
if (step.applyResults?.length) for (const result of step.applyResults) {
|
|
533826
|
+
const existing = turnApplyResults.find((r) => r.filePath === result.filePath);
|
|
533827
|
+
if (existing) {
|
|
533828
|
+
existing.addedLines += result.addedLines;
|
|
533829
|
+
existing.removedLines += result.removedLines;
|
|
533830
|
+
existing.action = result.action;
|
|
533831
|
+
} else turnApplyResults.push({ ...result });
|
|
533832
|
+
}
|
|
533830
533833
|
turnCreditsUsed += step.creditsUsed ?? 0;
|
|
533831
533834
|
break;
|
|
533832
533835
|
}
|
|
@@ -534166,7 +534169,7 @@ function SlashCommandMenu(t0) {
|
|
|
534166
534169
|
borderBottom: false,
|
|
534167
534170
|
borderTop: false,
|
|
534168
534171
|
paddingX: 2,
|
|
534169
|
-
|
|
534172
|
+
paddingY: 1,
|
|
534170
534173
|
backgroundColor: theme.background,
|
|
534171
534174
|
children: t7
|
|
534172
534175
|
});
|
|
@@ -534235,7 +534238,7 @@ function SlashCommandMenu(t0) {
|
|
|
534235
534238
|
borderTop: false,
|
|
534236
534239
|
borderBottom: false,
|
|
534237
534240
|
paddingX: 0,
|
|
534238
|
-
|
|
534241
|
+
paddingY: 1,
|
|
534239
534242
|
backgroundColor: theme.background,
|
|
534240
534243
|
children: t8
|
|
534241
534244
|
});
|
|
@@ -534530,7 +534533,7 @@ const InputPrompt = (0, import_react.memo)(({ onSubmit, onChange, onSlashCommand
|
|
|
534530
534533
|
]);
|
|
534531
534534
|
slashMenuActiveRef.current = slashMenuActive;
|
|
534532
534535
|
atMenuActiveRef.current = atMenuActive;
|
|
534533
|
-
const planIsActive = hasPlan && !value;
|
|
534536
|
+
const planIsActive = hasPlan && !value && state.state !== "generating";
|
|
534534
534537
|
(0, import_react.useEffect)(() => {
|
|
534535
534538
|
onSlashMenuActiveChange?.(slashMenuActive);
|
|
534536
534539
|
return () => {
|
|
@@ -536738,12 +536741,16 @@ const WelcomeScreen = (0, import_react.memo)((t0) => {
|
|
|
536738
536741
|
const { stdout } = useStdout();
|
|
536739
536742
|
const theme = useTheme();
|
|
536740
536743
|
const [cols, setCols] = (0, import_react.useState)(stdout?.columns ?? 80);
|
|
536744
|
+
const [rows, setRows] = (0, import_react.useState)(stdout?.rows ?? 24);
|
|
536741
536745
|
let t2;
|
|
536742
536746
|
let t3;
|
|
536743
536747
|
if ($[0] !== stdout) {
|
|
536744
536748
|
t2 = () => {
|
|
536745
536749
|
if (!stdout) return;
|
|
536746
|
-
const onResize = () =>
|
|
536750
|
+
const onResize = () => {
|
|
536751
|
+
setCols(stdout.columns ?? 80);
|
|
536752
|
+
setRows(stdout.rows ?? 24);
|
|
536753
|
+
};
|
|
536747
536754
|
stdout.on("resize", onResize);
|
|
536748
536755
|
return () => {
|
|
536749
536756
|
stdout.off("resize", onResize);
|
|
@@ -536766,7 +536773,7 @@ const WelcomeScreen = (0, import_react.memo)((t0) => {
|
|
|
536766
536773
|
} else t4 = $[4];
|
|
536767
536774
|
const displayCwd = t4;
|
|
536768
536775
|
const inputWidth = Math.min(Math.max(cols, 20), 90);
|
|
536769
|
-
const t5 = cols >= 70 ? LOGO : cols >= 28 ? LOGO_SMALL : "BUILDER";
|
|
536776
|
+
const t5 = cols >= 70 && rows >= 20 ? LOGO : cols >= 28 && rows >= 14 ? LOGO_SMALL : "BUILDER";
|
|
536770
536777
|
let t6;
|
|
536771
536778
|
if ($[5] !== t5 || $[6] !== theme.background) {
|
|
536772
536779
|
t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
@@ -538131,7 +538138,7 @@ const FooterSection = (0, import_react.memo)(() => {
|
|
|
538131
538138
|
children: [
|
|
538132
538139
|
"•",
|
|
538133
538140
|
" Fusion ",
|
|
538134
|
-
"0.3.
|
|
538141
|
+
"0.3.9"
|
|
538135
538142
|
]
|
|
538136
538143
|
});
|
|
538137
538144
|
$[10] = t7;
|
|
@@ -599046,18 +599053,19 @@ function CompletedTextBlock(t0) {
|
|
|
599046
599053
|
}
|
|
599047
599054
|
const THINKING_MAX_CHARS = 400;
|
|
599048
599055
|
function ThinkingBlock(t0) {
|
|
599049
|
-
const $ = (0, import_compiler_runtime.c)(
|
|
599056
|
+
const $ = (0, import_compiler_runtime.c)(13);
|
|
599050
599057
|
const { text, streaming: t1 } = t0;
|
|
599051
599058
|
const streaming = t1 === void 0 ? false : t1;
|
|
599052
599059
|
let t2;
|
|
599053
|
-
if ($[0] !== text) {
|
|
599054
|
-
t2 = text.length > THINKING_MAX_CHARS ? text.slice(0, THINKING_MAX_CHARS).trimEnd() + "…" : text.trim();
|
|
599055
|
-
$[0] =
|
|
599056
|
-
$[1] =
|
|
599057
|
-
|
|
599060
|
+
if ($[0] !== streaming || $[1] !== text) {
|
|
599061
|
+
t2 = text.length > THINKING_MAX_CHARS ? streaming ? "…" + text.slice(-THINKING_MAX_CHARS).trimStart() : text.slice(0, THINKING_MAX_CHARS).trimEnd() + "…" : text.trim();
|
|
599062
|
+
$[0] = streaming;
|
|
599063
|
+
$[1] = text;
|
|
599064
|
+
$[2] = t2;
|
|
599065
|
+
} else t2 = $[2];
|
|
599058
599066
|
const preview = t2;
|
|
599059
599067
|
let t3;
|
|
599060
|
-
if ($[
|
|
599068
|
+
if ($[3] !== streaming) {
|
|
599061
599069
|
t3 = streaming ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
599062
599070
|
bold: true,
|
|
599063
599071
|
color: "cyan",
|
|
@@ -599066,29 +599074,29 @@ function ThinkingBlock(t0) {
|
|
|
599066
599074
|
dimColor: true,
|
|
599067
599075
|
children: "◆"
|
|
599068
599076
|
});
|
|
599069
|
-
$[
|
|
599070
|
-
$[
|
|
599071
|
-
} else t3 = $[
|
|
599077
|
+
$[3] = streaming;
|
|
599078
|
+
$[4] = t3;
|
|
599079
|
+
} else t3 = $[4];
|
|
599072
599080
|
let t4;
|
|
599073
|
-
if ($[
|
|
599081
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
599074
599082
|
t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
599075
599083
|
bold: true,
|
|
599076
599084
|
dimColor: true,
|
|
599077
599085
|
children: "Thinking"
|
|
599078
599086
|
});
|
|
599079
|
-
$[
|
|
599080
|
-
} else t4 = $[
|
|
599087
|
+
$[5] = t4;
|
|
599088
|
+
} else t4 = $[5];
|
|
599081
599089
|
let t5;
|
|
599082
|
-
if ($[
|
|
599090
|
+
if ($[6] !== t3) {
|
|
599083
599091
|
t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
599084
599092
|
gap: 1,
|
|
599085
599093
|
children: [t3, t4]
|
|
599086
599094
|
});
|
|
599087
|
-
$[
|
|
599088
|
-
$[
|
|
599089
|
-
} else t5 = $[
|
|
599095
|
+
$[6] = t3;
|
|
599096
|
+
$[7] = t5;
|
|
599097
|
+
} else t5 = $[7];
|
|
599090
599098
|
let t6;
|
|
599091
|
-
if ($[
|
|
599099
|
+
if ($[8] !== preview) {
|
|
599092
599100
|
t6 = preview.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
599093
599101
|
paddingLeft: 2,
|
|
599094
599102
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
@@ -599097,21 +599105,21 @@ function ThinkingBlock(t0) {
|
|
|
599097
599105
|
children: preview
|
|
599098
599106
|
})
|
|
599099
599107
|
});
|
|
599100
|
-
$[
|
|
599101
|
-
$[
|
|
599102
|
-
} else t6 = $[
|
|
599108
|
+
$[8] = preview;
|
|
599109
|
+
$[9] = t6;
|
|
599110
|
+
} else t6 = $[9];
|
|
599103
599111
|
let t7;
|
|
599104
|
-
if ($[
|
|
599112
|
+
if ($[10] !== t5 || $[11] !== t6) {
|
|
599105
599113
|
t7 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
599106
599114
|
flexDirection: "column",
|
|
599107
599115
|
paddingX: 1,
|
|
599108
599116
|
marginY: 1,
|
|
599109
599117
|
children: [t5, t6]
|
|
599110
599118
|
});
|
|
599111
|
-
$[
|
|
599112
|
-
$[
|
|
599113
|
-
$[
|
|
599114
|
-
} else t7 = $[
|
|
599119
|
+
$[10] = t5;
|
|
599120
|
+
$[11] = t6;
|
|
599121
|
+
$[12] = t7;
|
|
599122
|
+
} else t7 = $[12];
|
|
599115
599123
|
return t7;
|
|
599116
599124
|
}
|
|
599117
599125
|
function formatDuration(ms) {
|
|
@@ -599605,6 +599613,8 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
|
|
|
599605
599613
|
const idx = startIndex + i;
|
|
599606
599614
|
const msgProxy = proxy.messages[idx];
|
|
599607
599615
|
const msgId = msgProxy.id;
|
|
599616
|
+
const isLastMessage = idx === messageCount - 1;
|
|
599617
|
+
const isStreaming = state.state === "generating";
|
|
599608
599618
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
|
|
599609
599619
|
fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
599610
599620
|
paddingX: 2,
|
|
@@ -599614,21 +599624,12 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
|
|
|
599614
599624
|
children: "[failed to render message]"
|
|
599615
599625
|
})
|
|
599616
599626
|
}),
|
|
599617
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
599627
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
599628
|
+
minHeight: isLastMessage && isStreaming ? Math.floor(rows * .4) : void 0,
|
|
599629
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MessageBlockView, { message: msgProxy })
|
|
599630
|
+
})
|
|
599618
599631
|
}, `err-${msgId}-${idx}`);
|
|
599619
|
-
})
|
|
599620
|
-
state.state === "generating" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
599621
|
-
gap: 1,
|
|
599622
|
-
marginTop: 2,
|
|
599623
|
-
marginBottom: 1,
|
|
599624
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressBar, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
599625
|
-
dimColor: true,
|
|
599626
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
599627
|
-
bold: true,
|
|
599628
|
-
children: "esc"
|
|
599629
|
-
}), " interrupt"]
|
|
599630
|
-
})]
|
|
599631
|
-
}, "generating-progress-bar")
|
|
599632
|
+
})
|
|
599632
599633
|
]
|
|
599633
599634
|
})
|
|
599634
599635
|
})
|
|
@@ -599650,13 +599651,24 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
|
|
|
599650
599651
|
children: state.lastError.message
|
|
599651
599652
|
})
|
|
599652
599653
|
}),
|
|
599653
|
-
showInput && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
599654
|
+
showInput && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ErrorBoundary, {
|
|
599654
599655
|
fallback: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
599655
599656
|
color: "red",
|
|
599656
599657
|
dimColor: true,
|
|
599657
599658
|
children: "Input unavailable · Ctrl+C to exit"
|
|
599658
599659
|
}),
|
|
599659
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
599660
|
+
children: [state.state === "generating" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
599661
|
+
gap: 1,
|
|
599662
|
+
marginTop: 2,
|
|
599663
|
+
marginBottom: 1,
|
|
599664
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressBar, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
599665
|
+
dimColor: true,
|
|
599666
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
599667
|
+
bold: true,
|
|
599668
|
+
children: "esc"
|
|
599669
|
+
}), " interrupt"]
|
|
599670
|
+
})]
|
|
599671
|
+
}, "generating-progress-bar"), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InputPrompt, {
|
|
599660
599672
|
onSubmit: handlePromptSubmit,
|
|
599661
599673
|
onScrollUp: handleMouseScrollUp,
|
|
599662
599674
|
onScrollDown: handleMouseScrollDown,
|
|
@@ -599665,7 +599677,7 @@ const CodeSession = (0, import_react.memo)(({ onExit, isTabActive = true }) => {
|
|
|
599665
599677
|
onSlashMenuActiveChange: setSlashMenuActive,
|
|
599666
599678
|
onImplementPlan: handleImplementPlan,
|
|
599667
599679
|
isTabActive
|
|
599668
|
-
})
|
|
599680
|
+
})]
|
|
599669
599681
|
}),
|
|
599670
599682
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusBar, { ctrlCPending })
|
|
599671
599683
|
]
|
|
@@ -600772,7 +600784,7 @@ function initSentry() {
|
|
|
600772
600784
|
init({
|
|
600773
600785
|
dsn: "https://1c5033d697e0271ebe53773bff826de0@o117565.ingest.us.sentry.io/4511107776905216",
|
|
600774
600786
|
tracesSampleRate: 0,
|
|
600775
|
-
release: "0.3.
|
|
600787
|
+
release: "0.3.9",
|
|
600776
600788
|
environment: process.env.NODE_ENV ?? "development",
|
|
600777
600789
|
enabled: false,
|
|
600778
600790
|
registerEsmLoaderHooks: false,
|
|
@@ -600796,7 +600808,7 @@ function isStandaloneBinary() {
|
|
|
600796
600808
|
return !path$6.basename(process.execPath, ".exe").startsWith("node");
|
|
600797
600809
|
}
|
|
600798
600810
|
function getCurrentVersion() {
|
|
600799
|
-
return "0.3.
|
|
600811
|
+
return "0.3.9";
|
|
600800
600812
|
}
|
|
600801
600813
|
async function fetchLatestVersion() {
|
|
600802
600814
|
return new Promise((resolve, reject) => {
|
|
@@ -600886,16 +600898,39 @@ async function selfUpdate(onProgress) {
|
|
|
600886
600898
|
const tarballUrl = `https://registry.npmjs.org/@builder.io/${pkgName}/-/${pkgName}-${latestVersion}.tgz`;
|
|
600887
600899
|
const tmpDir = createTempDir(path$6.dirname(process.execPath));
|
|
600888
600900
|
const tarballPath = path$6.join(tmpDir, "builder.tgz");
|
|
600901
|
+
let activeRequest = null;
|
|
600902
|
+
let activeChild = null;
|
|
600903
|
+
const onSigint = () => {
|
|
600904
|
+
activeRequest?.destroy();
|
|
600905
|
+
activeChild?.kill();
|
|
600906
|
+
try {
|
|
600907
|
+
fs$20.rmSync(tmpDir, {
|
|
600908
|
+
recursive: true,
|
|
600909
|
+
force: true
|
|
600910
|
+
});
|
|
600911
|
+
} catch {}
|
|
600912
|
+
onProgress("\nUpdate cancelled.");
|
|
600913
|
+
process.exit(130);
|
|
600914
|
+
};
|
|
600915
|
+
process.on("SIGINT", onSigint);
|
|
600889
600916
|
try {
|
|
600890
|
-
await downloadFile(tarballUrl, tarballPath)
|
|
600917
|
+
await downloadFile(tarballUrl, tarballPath, (req) => {
|
|
600918
|
+
activeRequest = req;
|
|
600919
|
+
});
|
|
600920
|
+
activeRequest = null;
|
|
600891
600921
|
onProgress("Installing...");
|
|
600892
600922
|
await new Promise((resolve, reject) => {
|
|
600893
|
-
spawn("tar", [
|
|
600923
|
+
const tar = spawn("tar", [
|
|
600894
600924
|
"-xzf",
|
|
600895
600925
|
tarballPath,
|
|
600896
600926
|
"-C",
|
|
600897
600927
|
tmpDir
|
|
600898
|
-
], { stdio: "inherit" })
|
|
600928
|
+
], { stdio: "inherit" });
|
|
600929
|
+
activeChild = tar;
|
|
600930
|
+
tar.on("close", (code) => {
|
|
600931
|
+
activeChild = null;
|
|
600932
|
+
code === 0 ? resolve() : reject(/* @__PURE__ */ new Error(`tar exited with ${code}`));
|
|
600933
|
+
});
|
|
600899
600934
|
});
|
|
600900
600935
|
const binaryName = process.platform === "win32" ? "builder.exe" : "builder";
|
|
600901
600936
|
const extractedBinary = path$6.join(tmpDir, "package", binaryName);
|
|
@@ -600915,6 +600950,7 @@ async function selfUpdate(onProgress) {
|
|
|
600915
600950
|
});
|
|
600916
600951
|
onProgress(`Updated to ${latestVersion}. Restart builder to apply.`);
|
|
600917
600952
|
} finally {
|
|
600953
|
+
process.off("SIGINT", onSigint);
|
|
600918
600954
|
fs$20.rmSync(tmpDir, {
|
|
600919
600955
|
recursive: true,
|
|
600920
600956
|
force: true
|
|
@@ -600943,11 +600979,11 @@ function atomicReplace(source, dest) {
|
|
|
600943
600979
|
} else throw err;
|
|
600944
600980
|
}
|
|
600945
600981
|
}
|
|
600946
|
-
async function downloadFile(url, dest) {
|
|
600982
|
+
async function downloadFile(url, dest, onRequest) {
|
|
600947
600983
|
return new Promise((resolve, reject) => {
|
|
600948
600984
|
const file = fs$20.createWriteStream(dest);
|
|
600949
600985
|
const request = (targetUrl) => {
|
|
600950
|
-
https$4.get(targetUrl, (res) => {
|
|
600986
|
+
const req = https$4.get(targetUrl, (res) => {
|
|
600951
600987
|
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
600952
600988
|
const location = res.headers.location;
|
|
600953
600989
|
if (!location) {
|
|
@@ -600957,10 +600993,11 @@ async function downloadFile(url, dest) {
|
|
|
600957
600993
|
res.resume();
|
|
600958
600994
|
file.close();
|
|
600959
600995
|
const newFile = fs$20.createWriteStream(dest);
|
|
600960
|
-
https$4.get(location, (r) => {
|
|
600996
|
+
const redirectReq = https$4.get(location, (r) => {
|
|
600961
600997
|
r.pipe(newFile);
|
|
600962
600998
|
newFile.on("finish", () => newFile.close(() => resolve()));
|
|
600963
600999
|
}).on("error", reject);
|
|
601000
|
+
onRequest?.(redirectReq);
|
|
600964
601001
|
return;
|
|
600965
601002
|
}
|
|
600966
601003
|
if (res.statusCode !== 200) {
|
|
@@ -600973,13 +601010,14 @@ async function downloadFile(url, dest) {
|
|
|
600973
601010
|
fs$20.unlink(dest, () => {});
|
|
600974
601011
|
reject(err);
|
|
600975
601012
|
});
|
|
601013
|
+
onRequest?.(req);
|
|
600976
601014
|
};
|
|
600977
601015
|
request(url);
|
|
600978
601016
|
});
|
|
600979
601017
|
}
|
|
600980
601018
|
//#endregion
|
|
600981
601019
|
//#region src/cli.tsx
|
|
600982
|
-
const VERSION = "0.3.
|
|
601020
|
+
const VERSION = "0.3.9";
|
|
600983
601021
|
async function startInk(command, options) {
|
|
600984
601022
|
await render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
|
|
600985
601023
|
command,
|