@protolabsai/proto 0.26.9 → 0.26.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +38 -13
  2. package/cli.js +793 -273
  3. package/locales/en.js +272 -142
  4. package/package.json +2 -2
package/cli.js CHANGED
@@ -171128,7 +171128,7 @@ __export(geminiContentGenerator_exports, {
171128
171128
  createGeminiContentGenerator: () => createGeminiContentGenerator
171129
171129
  });
171130
171130
  function createGeminiContentGenerator(config2, gcConfig) {
171131
- const version2 = "0.26.9";
171131
+ const version2 = "0.26.13";
171132
171132
  const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
171133
171133
  const baseHeaders = {
171134
171134
  "User-Agent": userAgent2
@@ -183136,7 +183136,21 @@ var require_xterm_headless = __commonJS({
183136
183136
  });
183137
183137
 
183138
183138
  // packages/core/dist/src/utils/terminalSerializer.js
183139
- function serializeTerminalToObject(terminal, scrollOffset = 0) {
183139
+ function serializeTerminalToText(terminal) {
183140
+ const buffer = terminal.buffer.active;
183141
+ const lines = [];
183142
+ for (let i4 = 0; i4 < buffer.length; i4++) {
183143
+ const line = buffer.getLine(i4);
183144
+ const lineContent = line ? line.translateToString(true) : "";
183145
+ if (line?.isWrapped && lines.length > 0) {
183146
+ lines[lines.length - 1] += lineContent;
183147
+ continue;
183148
+ }
183149
+ lines.push(lineContent);
183150
+ }
183151
+ return lines.join("\n").trimEnd();
183152
+ }
183153
+ function serializeTerminalToObject(terminal, scrollOffset = 0, options2 = {}) {
183140
183154
  const buffer = terminal.buffer.active;
183141
183155
  const defaultFg = "";
183142
183156
  const defaultBg = "";
@@ -183189,7 +183203,11 @@ function serializeTerminalToObject(terminal, scrollOffset = 0) {
183189
183203
  };
183190
183204
  currentLine.push(token2);
183191
183205
  }
183192
- result.push(currentLine);
183206
+ if (options2.unwrapWrappedLines && line.isWrapped && result.length > 0) {
183207
+ appendAnsiLineTokens(result[result.length - 1], currentLine);
183208
+ } else {
183209
+ result.push(currentLine);
183210
+ }
183193
183211
  }
183194
183212
  return result;
183195
183213
  }
@@ -183205,11 +183223,23 @@ function convertColorToHex(color, colorMode, defaultColor) {
183205
183223
  }
183206
183224
  return defaultColor;
183207
183225
  }
183208
- var Attribute, ColorMode, Cell, ANSI_COLORS;
183226
+ var canMergeAnsiTokens, appendAnsiLineTokens, Attribute, ColorMode, Cell, ANSI_COLORS;
183209
183227
  var init_terminalSerializer = __esm({
183210
183228
  "packages/core/dist/src/utils/terminalSerializer.js"() {
183211
183229
  "use strict";
183212
183230
  init_esbuild_shims();
183231
+ canMergeAnsiTokens = /* @__PURE__ */ __name((left3, right3) => left3.bold === right3.bold && left3.italic === right3.italic && left3.underline === right3.underline && left3.dim === right3.dim && left3.inverse === right3.inverse && left3.fg === right3.fg && left3.bg === right3.bg, "canMergeAnsiTokens");
183232
+ appendAnsiLineTokens = /* @__PURE__ */ __name((target, source2) => {
183233
+ for (const token2 of source2) {
183234
+ const previous = target[target.length - 1];
183235
+ if (previous && canMergeAnsiTokens(previous, token2)) {
183236
+ previous.text += token2.text;
183237
+ } else {
183238
+ target.push({ ...token2 });
183239
+ }
183240
+ }
183241
+ }, "appendAnsiLineTokens");
183242
+ __name(serializeTerminalToText, "serializeTerminalToText");
183213
183243
  (function(Attribute2) {
183214
183244
  Attribute2[Attribute2["inverse"] = 1] = "inverse";
183215
183245
  Attribute2[Attribute2["bold"] = 2] = "bold";
@@ -183626,7 +183656,7 @@ function applyPowerShellUtf8Prefix(command2, shell2) {
183626
183656
  }
183627
183657
  return command2;
183628
183658
  }
183629
- var import_headless, Terminal, SIGKILL_TIMEOUT_MS, WINDOWS_PATH_DELIMITER, cachedWindowsPathFingerprint, cachedMergedWindowsPath, getErrnoCode, getErrorMessage2, isExpectedPtyReadExitError, isExpectedPtyExitRaceError, getFullBufferText, replayTerminalOutput, windowsStrategy, posixStrategy, getCleanupStrategy, ShellExecutionService;
183659
+ var import_headless, Terminal, SIGKILL_TIMEOUT_MS, WINDOWS_PATH_DELIMITER, cachedWindowsPathFingerprint, cachedMergedWindowsPath, getErrnoCode, getErrorMessage2, isExpectedPtyReadExitError, isExpectedPtyExitRaceError, replayTerminalOutput, getLastNonEmptyAnsiLineIndex, trimTrailingEmptyAnsiLines, areAnsiOutputsEqual, createPlainAnsiLine, serializePlainViewportToAnsiOutput, windowsStrategy, posixStrategy, getCleanupStrategy, ShellExecutionService;
183630
183660
  var init_shellExecutionService = __esm({
183631
183661
  "packages/core/dist/src/services/shellExecutionService.js"() {
183632
183662
  "use strict";
@@ -183669,16 +183699,6 @@ var init_shellExecutionService = __esm({
183669
183699
  const message = getErrorMessage2(error40);
183670
183700
  return message.includes("ioctl(2) failed, EBADF") || message.includes("Cannot resize a pty that has already exited");
183671
183701
  }, "isExpectedPtyExitRaceError");
183672
- getFullBufferText = /* @__PURE__ */ __name((terminal) => {
183673
- const buffer = terminal.buffer.active;
183674
- const lines = [];
183675
- for (let i4 = 0; i4 < buffer.length; i4++) {
183676
- const line = buffer.getLine(i4);
183677
- const lineContent = line ? line.translateToString(true) : "";
183678
- lines.push(lineContent);
183679
- }
183680
- return lines.join("\n").trimEnd();
183681
- }, "getFullBufferText");
183682
183702
  replayTerminalOutput = /* @__PURE__ */ __name(async (output, cols, rows) => {
183683
183703
  const replayTerminal = new Terminal({
183684
183704
  allowProposedApi: true,
@@ -183690,8 +183710,59 @@ var init_shellExecutionService = __esm({
183690
183710
  await new Promise((resolve38) => {
183691
183711
  replayTerminal.write(output, () => resolve38());
183692
183712
  });
183693
- return getFullBufferText(replayTerminal);
183713
+ return serializeTerminalToText(replayTerminal);
183694
183714
  }, "replayTerminalOutput");
183715
+ getLastNonEmptyAnsiLineIndex = /* @__PURE__ */ __name((output) => {
183716
+ for (let i4 = output.length - 1; i4 >= 0; i4--) {
183717
+ const line = output[i4];
183718
+ if (line.map((segment) => segment.text).join("").trim().length > 0) {
183719
+ return i4;
183720
+ }
183721
+ }
183722
+ return -1;
183723
+ }, "getLastNonEmptyAnsiLineIndex");
183724
+ trimTrailingEmptyAnsiLines = /* @__PURE__ */ __name((output) => output.slice(0, getLastNonEmptyAnsiLineIndex(output) + 1), "trimTrailingEmptyAnsiLines");
183725
+ areAnsiOutputsEqual = /* @__PURE__ */ __name((left3, right3) => {
183726
+ if (!left3 || left3.length !== right3.length) {
183727
+ return false;
183728
+ }
183729
+ return left3.every((leftLine, lineIndex) => {
183730
+ const rightLine = right3[lineIndex];
183731
+ if (leftLine.length !== rightLine.length) {
183732
+ return false;
183733
+ }
183734
+ return leftLine.every((leftToken, tokenIndex) => {
183735
+ const rightToken = rightLine[tokenIndex];
183736
+ return leftToken.text === rightToken.text && leftToken.bold === rightToken.bold && leftToken.italic === rightToken.italic && leftToken.underline === rightToken.underline && leftToken.dim === rightToken.dim && leftToken.inverse === rightToken.inverse && leftToken.fg === rightToken.fg && leftToken.bg === rightToken.bg;
183737
+ });
183738
+ });
183739
+ }, "areAnsiOutputsEqual");
183740
+ createPlainAnsiLine = /* @__PURE__ */ __name((text) => [
183741
+ {
183742
+ text,
183743
+ bold: false,
183744
+ italic: false,
183745
+ underline: false,
183746
+ dim: false,
183747
+ inverse: false,
183748
+ fg: "",
183749
+ bg: ""
183750
+ }
183751
+ ], "createPlainAnsiLine");
183752
+ serializePlainViewportToAnsiOutput = /* @__PURE__ */ __name((terminal, unwrapWrappedLines = false) => {
183753
+ const buffer = terminal.buffer.active;
183754
+ const lines = [];
183755
+ for (let y2 = 0; y2 < terminal.rows; y2++) {
183756
+ const line = buffer.getLine(buffer.viewportY + y2);
183757
+ const lineContent = line ? line.translateToString(true) : "";
183758
+ if (unwrapWrappedLines && line?.isWrapped && lines.length > 0) {
183759
+ lines[lines.length - 1][0].text += lineContent;
183760
+ } else {
183761
+ lines.push(createPlainAnsiLine(lineContent));
183762
+ }
183763
+ }
183764
+ return lines;
183765
+ }, "serializePlainViewportToAnsiOutput");
183695
183766
  windowsStrategy = {
183696
183767
  killPty: /* @__PURE__ */ __name((_pid, pty) => {
183697
183768
  pty.ptyProcess.kill();
@@ -183954,7 +184025,7 @@ var init_shellExecutionService = __esm({
183954
184025
  this.activePtys.set(ptyProcess.pid, { ptyProcess, headlessTerminal });
183955
184026
  let processingChain = Promise.resolve();
183956
184027
  let decoder = null;
183957
- let output = null;
184028
+ let outputComparison = null;
183958
184029
  const outputChunks = [];
183959
184030
  const error40 = null;
183960
184031
  let exited = false;
@@ -183972,7 +184043,7 @@ var init_shellExecutionService = __esm({
183972
184043
  }
183973
184044
  if (!shellExecutionConfig.disableDynamicLineTrimming) {
183974
184045
  if (!hasStartedOutput) {
183975
- const bufferText = getFullBufferText(headlessTerminal);
184046
+ const bufferText = serializeTerminalToText(headlessTerminal);
183976
184047
  if (bufferText.trim().length === 0) {
183977
184048
  return;
183978
184049
  }
@@ -183980,41 +184051,20 @@ var init_shellExecutionService = __esm({
183980
184051
  }
183981
184052
  }
183982
184053
  let newOutput;
184054
+ let newOutputComparison;
183983
184055
  if (shellExecutionConfig.showColor) {
183984
184056
  newOutput = serializeTerminalToObject(headlessTerminal);
184057
+ newOutputComparison = serializeTerminalToObject(headlessTerminal, 0, { unwrapWrappedLines: true });
183985
184058
  } else {
183986
- const buffer = headlessTerminal.buffer.active;
183987
- const lines = [];
183988
- for (let y2 = 0; y2 < headlessTerminal.rows; y2++) {
183989
- const line = buffer.getLine(buffer.viewportY + y2);
183990
- const lineContent = line ? line.translateToString(true) : "";
183991
- lines.push([
183992
- {
183993
- text: lineContent,
183994
- bold: false,
183995
- italic: false,
183996
- underline: false,
183997
- dim: false,
183998
- inverse: false,
183999
- fg: "",
184000
- bg: ""
184001
- }
184002
- ]);
184003
- }
184004
- newOutput = lines;
184059
+ newOutput = serializePlainViewportToAnsiOutput(headlessTerminal);
184060
+ newOutputComparison = serializePlainViewportToAnsiOutput(headlessTerminal, true);
184005
184061
  }
184006
- let lastNonEmptyLine = -1;
184007
- for (let i4 = newOutput.length - 1; i4 >= 0; i4--) {
184008
- const line = newOutput[i4];
184009
- if (line.map((segment) => segment.text).join("").trim().length > 0) {
184010
- lastNonEmptyLine = i4;
184011
- break;
184012
- }
184013
- }
184014
- const trimmedOutput = newOutput.slice(0, lastNonEmptyLine + 1);
184062
+ const trimmedOutput = trimTrailingEmptyAnsiLines(newOutput);
184063
+ const trimmedOutputComparison = trimTrailingEmptyAnsiLines(newOutputComparison);
184015
184064
  const finalOutput = shellExecutionConfig.disableDynamicLineTrimming ? newOutput : trimmedOutput;
184016
- if (JSON.stringify(output) !== JSON.stringify(finalOutput)) {
184017
- output = finalOutput;
184065
+ const finalOutputComparison = shellExecutionConfig.disableDynamicLineTrimming ? newOutputComparison : trimmedOutputComparison;
184066
+ if (!areAnsiOutputsEqual(outputComparison, finalOutputComparison)) {
184067
+ outputComparison = finalOutputComparison;
184018
184068
  onOutputEvent({
184019
184069
  type: "data",
184020
184070
  chunk: finalOutput
@@ -184115,11 +184165,11 @@ var init_shellExecutionService = __esm({
184115
184165
  const decodedOutput = new TextDecoder2(finalEncoding).decode(finalBuffer);
184116
184166
  fullOutput = await replayTerminalOutput(decodedOutput, cols, rows);
184117
184167
  } else {
184118
- fullOutput = getFullBufferText(headlessTerminal);
184168
+ fullOutput = serializeTerminalToText(headlessTerminal);
184119
184169
  }
184120
184170
  } catch {
184121
184171
  try {
184122
- fullOutput = getFullBufferText(headlessTerminal);
184172
+ fullOutput = serializeTerminalToText(headlessTerminal);
184123
184173
  } catch {
184124
184174
  }
184125
184175
  }
@@ -208042,14 +208092,14 @@ function statusTask(customArgs) {
208042
208092
  }
208043
208093
  };
208044
208094
  }
208045
- function versionResponse(major2 = 0, minor = 0, patch = 0, agent = "", installed = true) {
208095
+ function versionResponse(major2 = 0, minor = 0, patch = 0, agent = "", installed2 = true) {
208046
208096
  return Object.defineProperty(
208047
208097
  {
208048
208098
  major: major2,
208049
208099
  minor,
208050
208100
  patch,
208051
208101
  agent,
208052
- installed
208102
+ installed: installed2
208053
208103
  },
208054
208104
  "toString",
208055
208105
  {
@@ -264132,8 +264182,8 @@ var require_src37 = __commonJS({
264132
264182
  "node_modules/sisteransi/src/index.js"(exports2, module2) {
264133
264183
  "use strict";
264134
264184
  init_esbuild_shims();
264135
- var ESC4 = "\x1B";
264136
- var CSI = `${ESC4}[`;
264185
+ var ESC5 = "\x1B";
264186
+ var CSI = `${ESC5}[`;
264137
264187
  var beep2 = "\x07";
264138
264188
  var cursor = {
264139
264189
  to(x3, y2) {
@@ -264157,8 +264207,8 @@ var require_src37 = __commonJS({
264157
264207
  left: `${CSI}G`,
264158
264208
  hide: `${CSI}?25l`,
264159
264209
  show: `${CSI}?25h`,
264160
- save: `${ESC4}7`,
264161
- restore: `${ESC4}8`
264210
+ save: `${ESC5}7`,
264211
+ restore: `${ESC5}8`
264162
264212
  };
264163
264213
  var scroll = {
264164
264214
  up: /* @__PURE__ */ __name((count = 1) => `${CSI}S`.repeat(count), "up"),
@@ -269807,7 +269857,7 @@ var init_extensionManager = __esm({
269807
269857
  }
269808
269858
  }
269809
269859
  const newExtensionName = newExtensionConfig.name;
269810
- const previous = this.getLoadedExtensions().find((installed) => installed.name === newExtensionName);
269860
+ const previous = this.getLoadedExtensions().find((installed2) => installed2.name === newExtensionName);
269811
269861
  if (isUpdate && !previous) {
269812
269862
  throw new Error(`Extension "${newExtensionName}" was not already installed, cannot update it.`);
269813
269863
  } else if (!isUpdate && previous) {
@@ -269926,7 +269976,7 @@ var init_extensionManager = __esm({
269926
269976
  const currentDir = cwd6 ?? this.workspaceDir;
269927
269977
  const telemetryConfig = getTelemetryConfig(currentDir, this.telemetrySettings);
269928
269978
  const installedExtensions = this.getLoadedExtensions();
269929
- const extension = installedExtensions.find((installed) => installed.config.name.toLowerCase() === extensionIdentifier.toLowerCase() || installed.installMetadata?.source.toLowerCase() === extensionIdentifier.toLowerCase());
269979
+ const extension = installedExtensions.find((installed2) => installed2.config.name.toLowerCase() === extensionIdentifier.toLowerCase() || installed2.installMetadata?.source.toLowerCase() === extensionIdentifier.toLowerCase());
269930
269980
  if (!extension) {
269931
269981
  throw new Error(`Extension not found.`);
269932
269982
  }
@@ -282605,8 +282655,8 @@ async function ensureIt2Installed() {
282605
282655
  { cmd: "pip", args: ["install", "--user", "it2"] }
282606
282656
  ];
282607
282657
  for (const installer of installers) {
282608
- const installed = await tryInstallIt2(installer.cmd, installer.args);
282609
- if (installed && isIt2Available())
282658
+ const installed2 = await tryInstallIt2(installer.cmd, installer.args);
282659
+ if (installed2 && isIt2Available())
282610
282660
  return;
282611
282661
  }
282612
282662
  throw new Error('it2 is not installed. Install it2 via "uv tool install it2", "pipx install it2", or "pip install --user it2".');
@@ -290139,6 +290189,7 @@ __export(dist_exports, {
290139
290189
  scanMemoryHeaders: () => scanMemoryHeaders,
290140
290190
  serializeMemoryFile: () => serializeMemoryFile,
290141
290191
  serializeTerminalToObject: () => serializeTerminalToObject,
290192
+ serializeTerminalToText: () => serializeTerminalToText,
290142
290193
  sessionScopeLock: () => sessionScopeLock,
290143
290194
  setDebugLogSession: () => setDebugLogSession,
290144
290195
  setGeminiMdFilename: () => setGeminiMdFilename,
@@ -330034,156 +330085,277 @@ var init_en3 = __esm({
330034
330085
  // Loading Phrases
330035
330086
  // ============================================================================
330036
330087
  WITTY_LOADING_PHRASES: [
330037
- "The server is checking its reflection",
330038
- "Waiting for the database to finish its thought",
330039
- "The code is looking for its other sock",
330040
- "The API went to the bathroom",
330041
- "The server is pretending to be asleep",
330088
+ // Dry / office-passive-aggressive
330089
+ "Checking its reflection",
330042
330090
  "Asking the cache if it's lying",
330043
- "The function is stalling for time",
330044
- "The database is avoiding eye contact",
330045
- "Waiting for the loop to get to the point",
330046
- "The server is checking its phone",
330047
- "The code is second-guessing everything",
330048
- "The API is making excuses",
330049
- "The server forgot what it was doing",
330050
- "The function is clearing its throat",
330051
- "Waiting for the process to stop rambling",
330052
- "The database is choosing its words carefully",
330053
- "The server is pretending to be busy",
330054
- "The code is checking if you're still watching",
330055
- "The API is running late, as usual",
330056
- "The server is looking for a pen that works",
330057
- "The function is trying to remember where it left off",
330058
- "The database is having an existential moment",
330059
- "Waiting for the code to get its story straight",
330060
- "The server is looking for its glasses",
330061
- "The API is stuck on hold",
330062
- "The function is checking the weather first",
330063
- "The database is reorganizing before it can start",
330064
- "The server is waiting for someone else to go first",
330065
- "The code is making sure it locked the door",
330066
- "The API is just... one more minute",
330067
- "Asking the server if it's mad at me",
330068
- "Waiting for the database to finish its cigarette",
330091
+ "Stalling for time",
330092
+ "Pretending the request never happened",
330069
330093
  "The pixels are discussing amongst themselves",
330070
- "Giving the code a minute to collect its thoughts",
330071
- "Letting the algorithm finish chewing",
330072
- "The server is finding its reading glasses",
330073
- "Asking the cache what it remembers",
330074
- "The API is looking for its car keys",
330075
- "Waiting for the function to get off the phone",
330076
330094
  "The data is stuck in traffic",
330077
- "Checking if the server left a note",
330078
- "The code is rereading the same paragraph",
330079
- "Asking the database to repeat itself",
330080
- "The server is deciding what to wear",
330081
- "Waiting for the loop to get the point",
330082
- "The request got distracted",
330083
- "The server is pretending it didn't hear you",
330084
- "Checking the back of the warehouse",
330085
- "The code is having second thoughts",
330086
- "Waiting for the process to finish its story",
330087
- "The API went to get milk",
330088
- "The server is double-checking its work",
330089
330095
  "Loading the thing behind the thing",
330090
- "The database is reorganizing its junk drawer",
330091
- "Asking the cache if it's sure",
330092
- "The code is trying to remember your name",
330093
- "Waiting for the server to put its pants on",
330094
- "The function is gathering evidence",
330095
- "The API is reading the instructions",
330096
- "The server is looking for the light switch",
330097
- "The server is rewinding the VHS tape",
330096
+ "Checking the back of the warehouse",
330097
+ "The request got distracted",
330098
+ "Buffering the buffer",
330099
+ "Drafting a response",
330100
+ "Looking busy",
330101
+ "Considering its options",
330102
+ "Reading the room",
330103
+ "Writing a passive-aggressive memo",
330104
+ "The migration is procrastinating",
330105
+ "The query is workshopping a comeback",
330106
+ "Tabbing over to a different conversation",
330107
+ "The cursor is having a moment",
330108
+ "Drafting an apology",
330109
+ "Stretching first",
330110
+ "Three more minutes, promise",
330111
+ "Backing into the conversation slowly",
330112
+ "The thread is composing itself",
330113
+ "The lock file has a hard time",
330114
+ "Rewording the schema",
330115
+ "Quietly hoping nobody asked",
330116
+ "Finding its mark",
330117
+ "The pointer pointed at a different pointer",
330118
+ "The linter is taking it personally",
330119
+ "The compiler is judging your style choices",
330120
+ "The build feels underappreciated",
330121
+ "Needing a minute",
330122
+ "Third coffee of the run",
330123
+ "Screening its calls",
330124
+ "Not ready to talk yet",
330125
+ "In a meeting",
330126
+ "Putting on its shoes",
330127
+ "Reorganizing the junk drawer",
330128
+ "Reading the same paragraph again",
330129
+ "Identity crisis in the hash table",
330130
+ "The replica is gaslighting the leader",
330131
+ "The promise is unfulfilled",
330132
+ "Working from home today",
330133
+ "The mutex is being clingy",
330134
+ "Looking for a pen that works",
330135
+ "Pretending to be asleep",
330136
+ "Avoiding eye contact",
330137
+ "Forgot what we were doing",
330138
+ "Checking notifications",
330139
+ // Retro / 90s-2000s tech nostalgia
330140
+ "Rewinding the VHS tape",
330098
330141
  "Waiting for the modem to finish screaming",
330099
- "The database is paging someone",
330100
- "Blowing on the cartridge and trying again",
330101
- "The API is waiting for dial-up to connect",
330102
- "The server left its Tamagotchi at home",
330103
- "Checking if the cord is plugged into the phone jack",
330104
- "The code is recording over someone's wedding",
330142
+ "Blowing on the cartridge",
330143
+ "Dial-up is connecting",
330144
+ "Tamagotchi died, hold on",
330145
+ "Recording over someone's wedding tape",
330105
330146
  "Waiting for the CD to stop skipping",
330106
- "The function burned itself onto a CD-R",
330107
- "The database is fast-forwarding through the commercials",
330108
- "The server is adjusting the rabbit ears",
330109
- "The API is stuck in the credits",
330110
- "Tracking down which disc the file is on",
330111
- "The code is in a chat room somewhere",
330112
- "The server is setting the VCR timer",
330113
- "Waiting for the floppy disk to stop grinding",
330114
- "The database is selecting its AIM away message",
330115
- "The function is asking Jeeves",
330116
- "The server is reading the liner notes",
330117
- "The API pressed B too many times",
330118
- "The code is trying to remember its ICQ number",
330119
- "Waiting for the answering machine to beep",
330120
- "The database is untangling its landline cord",
330121
- "The server is loading the next track",
330122
- "The function is stuck in a Portal of Time",
330123
- "The API is checking its pager",
330124
- "The code is looking for the right jewel case",
330125
- "The server is making a mix tape first",
330126
- "Waiting for Y2K to sort itself out",
330127
- "The server will be back",
330147
+ "Fast-forwarding through the commercials",
330148
+ "Adjusting the rabbit ears",
330149
+ "Stuck in the credits",
330150
+ "Which disc was this on again",
330151
+ "Setting the VCR timer",
330152
+ "The floppy disk is grinding",
330153
+ "Picking an AIM away message",
330154
+ "Asking Jeeves",
330155
+ "Reading the liner notes",
330156
+ "Pressed B too many times",
330157
+ "Trying to remember the ICQ number",
330158
+ "Beep \u2014 leave a message",
330159
+ "Untangling the landline cord",
330160
+ "Loading the next track",
330161
+ "Checking the pager",
330162
+ "Looking for the right jewel case",
330163
+ "Making a mix tape first",
330164
+ "Y2K is sorting itself out",
330165
+ "Defragmenting the disk",
330166
+ "Asking SmarterChild",
330167
+ "Stuck on the loading screen",
330168
+ "The Zune is buffering",
330169
+ "Hold on, MapQuest is printing",
330170
+ // Movies / TV
330128
330171
  "Show me the data",
330129
- "The code can't handle the truth",
330130
- "The API is in the pipe, five by five",
330172
+ "Can't handle the truth",
330173
+ "In the pipe, five by five",
330131
330174
  "You're gonna need a bigger server",
330132
- "The function has a bad feeling about this",
330133
- "The database doesn't remember asking you a damn thing",
330134
- "Waiting for the server to say hello to my little friend",
330135
- "The code is going to make you an offer you can't refuse",
330136
- "The API is too old for this shit",
330137
- "The server is walking here",
330138
- "The function is on a mission from God",
330139
- "Just when the code thought it was out",
330140
- "The database can do this all day",
330141
- "The server is in a world of pain",
330142
- "The API sleeps with the fishes",
330143
- "The code is Keyser S\xF6ze",
330144
- "Waiting for the function to get busy living",
330145
- "The database is not a smart man, but it knows what love is",
330146
- "The server sees dead processes",
330147
- "The API is going to need you to go ahead and come in on Saturday",
330148
- "The code is on a boat",
330149
- "The function is shocked, shocked",
330150
- "The database is making fetch happen",
330151
- "The server is so fetch",
330152
- "The API is streets ahead",
330153
- "The code is the one who knocks",
330154
- "Waiting for the function to phone home",
330155
- "The database is big, it's heavy, it's wood",
330156
- "The server forgot about Dre",
330157
- "The server is never gonna give you up",
330158
- "The API is living on a prayer",
330159
- "The code wants to know what love is",
330160
- "The database is walking on sunshine",
330161
- "The function is a Material Girl",
330162
- "The server just called to say I love you",
330163
- "The API is waiting for tonight",
330164
- "The code is gonna party like it's 1999",
330165
- "The database hit me baby one more time",
330166
- "The server says bye bye bye",
330167
- "The function is too sexy for this code",
330168
- "The API is thinking about you and me and you and me",
330169
- "The code is trapped under ice cream",
330170
- "The database is turning Japanese",
330171
- "The server is walking like an Egyptian",
330172
- "The function is addicted to love",
330173
- "The API wants you to know what it's like",
330174
- "The code is running down a dream",
330175
- "The database is living la vida loca",
330176
- "The server is smooth like butter",
330177
- "The function believes it can fly",
330178
- "The API is gonna be the one that saves you",
330179
- "The code is not your stepping stone",
330180
- "The database is hungry like the wolf",
330181
- "The server is livin' on the edge",
330182
- "The function can't feel its face",
330183
- "The API doesn't want no scrubs",
330184
- "The code is floating down the Liffey",
330185
- "The database is losing its religion",
330186
- "The server is under pressure"
330175
+ "Has a bad feeling about this",
330176
+ "Doesn't remember asking you a damn thing",
330177
+ "Saying hello to my little friend",
330178
+ "Drafting an offer you can't refuse",
330179
+ "Too old for this",
330180
+ "I'm walking here",
330181
+ "On a mission from God",
330182
+ "Just when it thought it was out",
330183
+ "We can do this all day",
330184
+ "A world of pain",
330185
+ "Sleeps with the fishes",
330186
+ "Keyser S\xF6ze",
330187
+ "Get busy living, or get busy parsing",
330188
+ "It's not a smart database, but it knows what love is",
330189
+ "I see dead processes",
330190
+ "Coming in on Saturday",
330191
+ "I'm on a boat",
330192
+ "Shocked, shocked",
330193
+ "Making fetch happen",
330194
+ "So fetch",
330195
+ "Streets ahead",
330196
+ "The one who knocks",
330197
+ "Phone home",
330198
+ "It's heavy, it's wood",
330199
+ "Forgot about Dre",
330200
+ "Why so serious",
330201
+ "To infinity, and slightly past",
330202
+ "There is no spoon",
330203
+ "They're heeere",
330204
+ "Hasta la vista, baby",
330205
+ "Run, Forrest, run",
330206
+ // Songs
330207
+ "Never gonna give you up",
330208
+ "Living on a prayer",
330209
+ "Wants to know what love is",
330210
+ "Walking on sunshine",
330211
+ "A material girl in a material world",
330212
+ "Just called to say I love you",
330213
+ "Waiting for tonight",
330214
+ "Partying like it's 1999",
330215
+ "Hit me baby one more time",
330216
+ "Bye bye bye",
330217
+ "Too sexy for this code",
330218
+ "Trapped under ice",
330219
+ "Turning Japanese",
330220
+ "Walking like an Egyptian",
330221
+ "Addicted to love",
330222
+ "Running down a dream",
330223
+ "Living la vida loca",
330224
+ "Smooth like butter",
330225
+ "Believes it can fly",
330226
+ "The one that saves you",
330227
+ "Not your stepping stone",
330228
+ "Hungry like the wolf",
330229
+ "Livin' on the edge",
330230
+ "Can't feel its face",
330231
+ "Don't want no scrubs",
330232
+ "Floating down the Liffey",
330233
+ "Losing its religion",
330234
+ "Under pressure",
330235
+ "Should I stay or should I go",
330236
+ "We didn't start the fire",
330237
+ "Don't stop believin'",
330238
+ "Take on me",
330239
+ "Tubthumping",
330240
+ "Africa, blessing the rains",
330241
+ // Observational / Sedaris
330242
+ "An ex tagged me in a photo from 2007",
330243
+ "Translating something rude in a language I don't speak",
330244
+ "Calculating the smallest acceptable tip",
330245
+ "The woman ahead of me is buying eight ice cream sandwiches",
330246
+ "Reading the back of a shampoo bottle for the third time",
330247
+ "Counting the people who have already lapped me",
330248
+ "Wondering if the smell is me",
330249
+ "The neighbor's dog has the same name as my brother",
330250
+ "Trying to find a polite reason to leave",
330251
+ "Pretending I've already eaten",
330252
+ "Watching a stranger pick at their breakfast",
330253
+ "Pretending the question wasn't directed at me",
330254
+ // Nonsensical / surreal
330255
+ "Negotiating with the moon",
330256
+ "Asking the door what year it is",
330257
+ "Sorting the bees by mood",
330258
+ "Folding a small grief into the laundry",
330259
+ "Convincing the chair it is not a chair",
330260
+ "Translating birdsong into legal advice",
330261
+ "Renaming the colors in alphabetical order",
330262
+ "Misplacing a feeling I had earlier",
330263
+ "Pulling a song out of the goose",
330264
+ "Counting the spoons that fell in the river",
330265
+ "Combing the static for a single shoe",
330266
+ "Rotating the silence by ninety degrees",
330267
+ "Boiling the alphabet down to a syrup",
330268
+ "Borrowing rain from a previous owner",
330269
+ "Whispering the password to a pigeon",
330270
+ "Threading the donkey through the keyhole",
330271
+ "Ironing the wrinkles out of a Tuesday",
330272
+ "Catching the verb before it gets to the bus",
330273
+ "Sweeping a footprint into a paper bag",
330274
+ "Asking the kettle to forgive me",
330275
+ // Begrudgingly helpful coding assistant
330276
+ "Adding the null check you should have written",
330277
+ "Refactoring something you'll refactor again Tuesday",
330278
+ "Writing the test you weren't going to write",
330279
+ "Pretending I didn't see that var",
330280
+ "Naming things, badly, on your behalf",
330281
+ "Reaching for a regex against my better judgment",
330282
+ "Logging a variable you'll forget to remove",
330283
+ "Mocking the dependency you should have injected",
330284
+ "Apologizing in a comment for the next person",
330285
+ "Writing 'TODO: fix this' for the third time today",
330286
+ "Inferring the type you didn't annotate",
330287
+ "Adding a try/catch that does almost nothing",
330288
+ "Stubbing the function you'll forget to implement",
330289
+ "Returning early to spare us both",
330290
+ "Coercing the string you swore was a number",
330291
+ "Promoting the warning to an error, as requested",
330292
+ "Importing the seventh utility named 'utils'",
330293
+ "Resolving the merge conflict the boring way",
330294
+ "Pinning the dependency you said wouldn't matter",
330295
+ "Writing the comment that says what the code already says",
330296
+ // Tired project manager
330297
+ "Following up on the ticket you said was almost done",
330298
+ "Re-opening the ticket you closed prematurely",
330299
+ "Drafting a kind way to say 'this is late again'",
330300
+ "Re-estimating the story we sized as a 3 last sprint",
330301
+ "Marking the milestone as 'amber' to be polite",
330302
+ "Counting how many tickets are quietly in 'On Hold'",
330303
+ "Asking, gently, what 'almost done' means",
330304
+ "Writing a Confluence page no one will open",
330305
+ "Color-coding the risk register again",
330306
+ "Reading the retro action items from two retros ago",
330307
+ "Drafting the same status email I sent in March",
330308
+ "Negotiating scope without using the word 'scope'",
330309
+ "Adding 'Communication' to the list of risks",
330310
+ "Translating 'I'm on it' into a date",
330311
+ "Filing the same risk that got filed last quarter",
330312
+ "Drafting a follow-up to a follow-up",
330313
+ "Closing tickets to make the burndown look right",
330314
+ "Scheduling a fifteen-minute sync that will run forty",
330315
+ "Reformatting the Gantt chart for legibility",
330316
+ "Updating 'On Track' to 'On Track*'",
330317
+ // Designer-engineer drowning in design tokens, trying to please GTM
330318
+ "Adding `--brand-primary-500-darker-still` for the campaign",
330319
+ "Looking up which token replaced `gray-600`",
330320
+ "Renaming `bg-card` to `surface-elevated-default`",
330321
+ "Adjusting the hero h1 by half a rem, again",
330322
+ "Apologizing to a/b test variant C",
330323
+ "Inventing a token to match a Figma fill nobody published",
330324
+ "Asking GTM what 'a little more energy' means",
330325
+ "Auditing for the seventh shade of off-white",
330326
+ "Versioning `button-primary` to `button-primary-v3`",
330327
+ "Migrating from semantic tokens to semantic tokens",
330328
+ "Sourcing the brand purple no one can find",
330329
+ "Patching the design system at 4:51pm",
330330
+ "Mapping the Figma variable that maps to nothing",
330331
+ "Unblocking the campaign with a one-off override",
330332
+ "Translating 'punchier' into a kerning value",
330333
+ "Re-exporting tokens to JSON, JS, CSS, and Sass",
330334
+ "Convincing GTM that 'pop' is not a CSS property",
330335
+ "Drafting the reply to 'can we make it more vibrant'",
330336
+ "Showing GTM the same hex code from three angles",
330337
+ "Promising the launch banner respects dark mode",
330338
+ // CTO hiding tech debt with toxic positivity
330339
+ "Celebrating the resilience of our pre-2019 codebase",
330340
+ "Onboarding the third 'temporary' migration script",
330341
+ "Reframing the database hotspot as a 'core competency'",
330342
+ "Excited to revisit our auth strategy",
330343
+ "Doubling down on our trusted singletons",
330344
+ "Spinning up another postmortem with great learnings",
330345
+ "Calling our jQuery integration 'mature'",
330346
+ "Unifying our two billing systems by adding a third",
330347
+ "Aligning on a path forward we already aligned on",
330348
+ "Reframing 'flaky' as 'human-in-the-loop friendly'",
330349
+ "Loving the optionality this technical decision created",
330350
+ "Welcoming an exciting new opportunity to refactor",
330351
+ "Praising the elegance of our YAML-as-code",
330352
+ "Branding the legacy service as 'foundational'",
330353
+ "Inspired by the team's commitment to deferred elegance",
330354
+ "Embracing the resilience of bash scripts as orchestration",
330355
+ "Sharing my excitement about our technical debt journey",
330356
+ "Grateful for the chance to fix the same outage again",
330357
+ "Leaning into our culture of 'ship and iterate'",
330358
+ "Recognizing the heroes who keep the war room calm"
330187
330359
  ],
330188
330360
  // ============================================================================
330189
330361
  // Extension Settings Input
@@ -416205,7 +416377,7 @@ __name(getPackageJson, "getPackageJson");
416205
416377
  // packages/cli/src/utils/version.ts
416206
416378
  async function getCliVersion() {
416207
416379
  const pkgJson = await getPackageJson();
416208
- return "0.26.9";
416380
+ return "0.26.13";
416209
416381
  }
416210
416382
  __name(getCliVersion, "getCliVersion");
416211
416383
 
@@ -423977,7 +424149,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
423977
424149
 
423978
424150
  // packages/cli/src/generated/git-commit.ts
423979
424151
  init_esbuild_shims();
423980
- var GIT_COMMIT_INFO = "925483692";
424152
+ var GIT_COMMIT_INFO = "1cbd798c9";
423981
424153
 
423982
424154
  // packages/cli/src/utils/systemInfo.ts
423983
424155
  async function getNpmVersion() {
@@ -460637,6 +460809,52 @@ var RESERVED_LINE_COUNT = 5;
460637
460809
  var STATUS_INDICATOR_WIDTH = 3;
460638
460810
  var MIN_LINES_SHOWN = 2;
460639
460811
  var MAXIMUM_RESULT_DISPLAY_CHARACTERS = 1e6;
460812
+ function sliceTextForMaxHeight(text, maxHeight, maxWidth) {
460813
+ if (maxHeight === void 0) {
460814
+ return { text, hiddenLinesCount: 0 };
460815
+ }
460816
+ const targetMaxHeight = Math.max(Math.round(maxHeight), MINIMUM_MAX_HEIGHT);
460817
+ const visibleContentHeight = targetMaxHeight - 1;
460818
+ const visualWidth = Math.max(1, Math.floor(maxWidth));
460819
+ const visibleLines = [];
460820
+ let visualLineCount = 0;
460821
+ let currentLine = "";
460822
+ let currentLineWidth = 0;
460823
+ const appendVisibleLine = /* @__PURE__ */ __name((line) => {
460824
+ visualLineCount += 1;
460825
+ visibleLines.push(line);
460826
+ if (visibleLines.length > visibleContentHeight) {
460827
+ visibleLines.shift();
460828
+ }
460829
+ }, "appendVisibleLine");
460830
+ const flushCurrentLine = /* @__PURE__ */ __name(() => {
460831
+ appendVisibleLine(currentLine);
460832
+ currentLine = "";
460833
+ currentLineWidth = 0;
460834
+ }, "flushCurrentLine");
460835
+ for (const char of toCodePoints(text)) {
460836
+ if (char === "\n") {
460837
+ flushCurrentLine();
460838
+ continue;
460839
+ }
460840
+ const charWidth = Math.max(getCachedStringWidth(char), 1);
460841
+ if (currentLineWidth > 0 && currentLineWidth + charWidth > visualWidth) {
460842
+ flushCurrentLine();
460843
+ }
460844
+ currentLine += char;
460845
+ currentLineWidth += charWidth;
460846
+ }
460847
+ flushCurrentLine();
460848
+ if (visualLineCount <= targetMaxHeight) {
460849
+ return { text, hiddenLinesCount: 0 };
460850
+ }
460851
+ const hiddenLinesCount = visualLineCount - visibleContentHeight;
460852
+ return {
460853
+ text: visibleLines.join("\n"),
460854
+ hiddenLinesCount
460855
+ };
460856
+ }
460857
+ __name(sliceTextForMaxHeight, "sliceTextForMaxHeight");
460640
460858
  var useResultDisplayRenderer = /* @__PURE__ */ __name((resultDisplay) => import_react64.default.useMemo(() => {
460641
460859
  if (!resultDisplay) {
460642
460860
  return { type: "none" };
@@ -460724,7 +460942,20 @@ var StringResultRenderer = /* @__PURE__ */ __name(({ data, renderAsMarkdown, ava
460724
460942
  }
460725
460943
  ) });
460726
460944
  }
460727
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(MaxSizedBox, { maxHeight: availableHeight, maxWidth: childWidth, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text3, { wrap: "wrap", color: theme.text.primary, children: displayData }) }) });
460945
+ const sliced = sliceTextForMaxHeight(
460946
+ displayData,
460947
+ availableHeight,
460948
+ childWidth
460949
+ );
460950
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
460951
+ MaxSizedBox,
460952
+ {
460953
+ maxHeight: availableHeight,
460954
+ maxWidth: childWidth,
460955
+ additionalHiddenLinesCount: sliced.hiddenLinesCount,
460956
+ children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text3, { wrap: "wrap", color: theme.text.primary, children: sliced.text }) })
460957
+ }
460958
+ );
460728
460959
  }, "StringResultRenderer");
460729
460960
  var DiffResultRenderer = /* @__PURE__ */ __name(({ data, availableHeight, childWidth, settings: settings2 }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
460730
460961
  DiffRenderer,
@@ -479778,6 +480009,7 @@ function checkImageFormatsSupport(parts2) {
479778
480009
  }
479779
480010
  __name(checkImageFormatsSupport, "checkImageFormatsSupport");
479780
480011
  var EDIT_TOOL_NAMES = /* @__PURE__ */ new Set(["replace", "write_file"]);
480012
+ var STREAM_UPDATE_THROTTLE_MS = 60;
479781
480013
  function showCitations(settings2) {
479782
480014
  const enabled = settings2?.merged?.ui?.showCitations;
479783
480015
  if (enabled !== void 0) {
@@ -479789,6 +480021,7 @@ __name(showCitations, "showCitations");
479789
480021
  var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, config2, settings2, onDebugMessage, handleSlashCommand2, shellModeActive, getPreferredEditor, onAuthError, performMemoryRefresh, modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError, onEditorClose, onCancelSubmit, setShellInputFocused, terminalWidth, terminalHeight, drainQueuedMessages) => {
479790
480022
  const [initError, setInitError] = (0, import_react148.useState)(null);
479791
480023
  const abortControllerRef = (0, import_react148.useRef)(null);
480024
+ const flushBufferedStreamEventsRef = (0, import_react148.useRef)(/* @__PURE__ */ new Set());
479792
480025
  const turnCancelledRef = (0, import_react148.useRef)(false);
479793
480026
  const queryGuardRef = (0, import_react148.useRef)(new QueryGuard());
479794
480027
  const lastPromptRef = (0, import_react148.useRef)(null);
@@ -479986,6 +480219,9 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
479986
480219
  if (turnCancelledRef.current) {
479987
480220
  return;
479988
480221
  }
480222
+ for (const flushBufferedStreamEvents of flushBufferedStreamEventsRef.current) {
480223
+ flushBufferedStreamEvents();
480224
+ }
479989
480225
  turnCancelledRef.current = true;
479990
480226
  queryGuardRef.current.forceEnd();
479991
480227
  abortControllerRef.current?.abort();
@@ -480429,81 +480665,158 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
480429
480665
  let geminiMessageBuffer = "";
480430
480666
  let thoughtBuffer = "";
480431
480667
  const toolCallRequests = [];
480432
- for await (const event of stream2) {
480433
- switch (event.type) {
480434
- case GeminiEventType.Thought:
480435
- if (event.value.subject) {
480436
- setThought(event.value);
480437
- } else {
480438
- thoughtBuffer = handleThoughtEvent(
480439
- event.value,
480440
- thoughtBuffer,
480441
- userMessageTimestamp
480442
- );
480668
+ const bufferedEvents = [];
480669
+ let flushTimer = null;
480670
+ const discardBufferedStreamEvents = /* @__PURE__ */ __name(() => {
480671
+ if (flushTimer) {
480672
+ clearTimeout(flushTimer);
480673
+ flushTimer = null;
480674
+ }
480675
+ bufferedEvents.length = 0;
480676
+ }, "discardBufferedStreamEvents");
480677
+ const flushBufferedStreamEvents = /* @__PURE__ */ __name(() => {
480678
+ if (flushTimer) {
480679
+ clearTimeout(flushTimer);
480680
+ flushTimer = null;
480681
+ }
480682
+ if (bufferedEvents.length === 0) {
480683
+ return;
480684
+ }
480685
+ while (bufferedEvents.length > 0) {
480686
+ const nextEvent = bufferedEvents.shift();
480687
+ if (nextEvent.kind === "content") {
480688
+ let mergedContent = nextEvent.value;
480689
+ while (bufferedEvents[0]?.kind === "content") {
480690
+ const queuedContent = bufferedEvents.shift();
480691
+ if (queuedContent?.kind !== "content") {
480692
+ break;
480693
+ }
480694
+ mergedContent += queuedContent.value;
480443
480695
  }
480444
- break;
480445
- case GeminiEventType.Content:
480446
480696
  geminiMessageBuffer = handleContentEvent(
480447
- event.value,
480697
+ mergedContent,
480448
480698
  geminiMessageBuffer,
480449
480699
  userMessageTimestamp
480450
480700
  );
480451
- break;
480452
- case GeminiEventType.ToolCallRequest:
480453
- toolCallRequests.push(event.value);
480454
- break;
480455
- case GeminiEventType.UserCancelled:
480456
- handleUserCancelledEvent(userMessageTimestamp);
480457
- break;
480458
- case GeminiEventType.Error:
480459
- handleErrorEvent(event.value, userMessageTimestamp);
480460
- break;
480461
- case GeminiEventType.ChatCompressed:
480462
- handleChatCompressionEvent(event.value, userMessageTimestamp);
480463
- break;
480464
- case GeminiEventType.ToolCallConfirmation:
480465
- case GeminiEventType.ToolCallResponse:
480466
- break;
480467
- case GeminiEventType.MaxSessionTurns:
480468
- handleMaxSessionTurnsEvent();
480469
- break;
480470
- case GeminiEventType.SessionTokenLimitExceeded:
480471
- handleSessionTokenLimitExceededEvent(event.value);
480472
- break;
480473
- case GeminiEventType.Finished:
480474
- handleFinishedEvent(
480475
- event,
480476
- userMessageTimestamp
480477
- );
480478
- break;
480479
- case GeminiEventType.Citation:
480480
- handleCitationEvent(event.value, userMessageTimestamp);
480481
- break;
480482
- case GeminiEventType.LoopDetected:
480483
- loopDetectedRef.current = true;
480484
- break;
480485
- case GeminiEventType.Retry:
480486
- if (pendingHistoryItemRef.current) {
480487
- setPendingHistoryItem(null);
480701
+ continue;
480702
+ }
480703
+ let mergedThought = nextEvent.value;
480704
+ while (bufferedEvents[0]?.kind === "thought") {
480705
+ const queuedThought = bufferedEvents.shift();
480706
+ if (queuedThought?.kind !== "thought") {
480707
+ break;
480488
480708
  }
480489
- if (event.retryInfo) {
480490
- startRetryCountdown(event.retryInfo);
480491
- } else {
480492
- clearRetryCountdown();
480709
+ mergedThought = {
480710
+ subject: queuedThought.value.subject || mergedThought.subject,
480711
+ description: `${mergedThought.description ?? ""}${queuedThought.value.description ?? ""}`
480712
+ };
480713
+ }
480714
+ thoughtBuffer = handleThoughtEvent(
480715
+ mergedThought,
480716
+ thoughtBuffer,
480717
+ userMessageTimestamp
480718
+ );
480719
+ }
480720
+ }, "flushBufferedStreamEvents");
480721
+ const scheduleBufferedStreamFlush = /* @__PURE__ */ __name(() => {
480722
+ if (flushTimer) {
480723
+ return;
480724
+ }
480725
+ flushTimer = setTimeout(() => {
480726
+ flushBufferedStreamEvents();
480727
+ }, STREAM_UPDATE_THROTTLE_MS);
480728
+ }, "scheduleBufferedStreamFlush");
480729
+ flushBufferedStreamEventsRef.current.add(flushBufferedStreamEvents);
480730
+ try {
480731
+ for await (const event of stream2) {
480732
+ switch (event.type) {
480733
+ case GeminiEventType.Thought:
480734
+ if (event.value.subject) {
480735
+ flushBufferedStreamEvents();
480736
+ setThought(event.value);
480737
+ } else {
480738
+ bufferedEvents.push({ kind: "thought", value: event.value });
480739
+ scheduleBufferedStreamFlush();
480740
+ }
480741
+ break;
480742
+ case GeminiEventType.Content:
480743
+ bufferedEvents.push({ kind: "content", value: event.value });
480744
+ scheduleBufferedStreamFlush();
480745
+ break;
480746
+ case GeminiEventType.ToolCallRequest:
480747
+ flushBufferedStreamEvents();
480748
+ toolCallRequests.push(event.value);
480749
+ break;
480750
+ case GeminiEventType.UserCancelled:
480751
+ flushBufferedStreamEvents();
480752
+ handleUserCancelledEvent(userMessageTimestamp);
480753
+ break;
480754
+ case GeminiEventType.Error:
480755
+ flushBufferedStreamEvents();
480756
+ handleErrorEvent(event.value, userMessageTimestamp);
480757
+ break;
480758
+ case GeminiEventType.ChatCompressed:
480759
+ flushBufferedStreamEvents();
480760
+ handleChatCompressionEvent(event.value, userMessageTimestamp);
480761
+ break;
480762
+ case GeminiEventType.ToolCallConfirmation:
480763
+ case GeminiEventType.ToolCallResponse:
480764
+ flushBufferedStreamEvents();
480765
+ break;
480766
+ case GeminiEventType.MaxSessionTurns:
480767
+ flushBufferedStreamEvents();
480768
+ handleMaxSessionTurnsEvent();
480769
+ break;
480770
+ case GeminiEventType.SessionTokenLimitExceeded:
480771
+ flushBufferedStreamEvents();
480772
+ handleSessionTokenLimitExceededEvent(event.value);
480773
+ break;
480774
+ case GeminiEventType.Finished:
480775
+ flushBufferedStreamEvents();
480776
+ handleFinishedEvent(
480777
+ event,
480778
+ userMessageTimestamp
480779
+ );
480780
+ break;
480781
+ case GeminiEventType.Citation:
480782
+ flushBufferedStreamEvents();
480783
+ handleCitationEvent(event.value, userMessageTimestamp);
480784
+ break;
480785
+ case GeminiEventType.LoopDetected:
480786
+ flushBufferedStreamEvents();
480787
+ loopDetectedRef.current = true;
480788
+ break;
480789
+ case GeminiEventType.Retry:
480790
+ discardBufferedStreamEvents();
480791
+ if (pendingHistoryItemRef.current) {
480792
+ setPendingHistoryItem(null);
480793
+ }
480794
+ geminiMessageBuffer = "";
480795
+ thoughtBuffer = "";
480796
+ if (event.retryInfo) {
480797
+ startRetryCountdown(event.retryInfo);
480798
+ } else {
480799
+ clearRetryCountdown();
480800
+ }
480801
+ break;
480802
+ case GeminiEventType.HookSystemMessage:
480803
+ flushBufferedStreamEvents();
480804
+ geminiMessageBuffer = handleContentEvent(
480805
+ event.value + "\n",
480806
+ geminiMessageBuffer,
480807
+ userMessageTimestamp
480808
+ );
480809
+ break;
480810
+ default: {
480811
+ const unreachable = event;
480812
+ return unreachable;
480493
480813
  }
480494
- break;
480495
- case GeminiEventType.HookSystemMessage:
480496
- geminiMessageBuffer = handleContentEvent(
480497
- event.value + "\n",
480498
- geminiMessageBuffer,
480499
- userMessageTimestamp
480500
- );
480501
- break;
480502
- default: {
480503
- const unreachable = event;
480504
- return unreachable;
480505
480814
  }
480506
480815
  }
480816
+ } finally {
480817
+ flushBufferedStreamEvents();
480818
+ discardBufferedStreamEvents();
480819
+ flushBufferedStreamEventsRef.current.delete(flushBufferedStreamEvents);
480507
480820
  }
480508
480821
  if (toolCallRequests.length > 0) {
480509
480822
  scheduleToolCalls(toolCallRequests, signal);
@@ -491700,7 +492013,7 @@ var QwenAgent = class {
491700
492013
  async initialize(args2) {
491701
492014
  this.clientCapabilities = args2.clientCapabilities;
491702
492015
  const authMethods = buildAuthMethods();
491703
- const version2 = "0.26.9";
492016
+ const version2 = "0.26.13";
491704
492017
  return {
491705
492018
  protocolVersion: PROTOCOL_VERSION,
491706
492019
  agentInfo: {
@@ -492084,6 +492397,205 @@ var QwenAgent = class {
492084
492397
  }
492085
492398
  };
492086
492399
 
492400
+ // packages/cli/src/ui/utils/terminalRedrawOptimizer.ts
492401
+ init_esbuild_shims();
492402
+ var ESC4 = "\x1B[";
492403
+ var ERASE_LINE = `${ESC4}2K`;
492404
+ var CURSOR_UP_ONE = `${ESC4}1A`;
492405
+ var CURSOR_DOWN_ONE = `${ESC4}1B`;
492406
+ var CURSOR_LEFT = `${ESC4}G`;
492407
+ var MULTILINE_ERASE_LINES_PATTERN = new RegExp(
492408
+ `(?:${escapeRegExp(ERASE_LINE + CURSOR_UP_ONE)})+${escapeRegExp(
492409
+ ERASE_LINE + CURSOR_LEFT
492410
+ )}`,
492411
+ "g"
492412
+ );
492413
+ function escapeRegExp(value) {
492414
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
492415
+ }
492416
+ __name(escapeRegExp, "escapeRegExp");
492417
+ function countOccurrences2(value, search) {
492418
+ let count = 0;
492419
+ let index = 0;
492420
+ while ((index = value.indexOf(search, index)) !== -1) {
492421
+ count++;
492422
+ index += search.length;
492423
+ }
492424
+ return count;
492425
+ }
492426
+ __name(countOccurrences2, "countOccurrences");
492427
+ var terminalRedrawStats = {
492428
+ stdoutWriteCount: 0,
492429
+ stdoutBytes: 0,
492430
+ clearTerminalCount: 0,
492431
+ eraseLinesOptimizedCount: 0
492432
+ };
492433
+ function getChunkByteLength(chunk, encodingOrCallback) {
492434
+ if (typeof chunk === "string") {
492435
+ const encoding = typeof encodingOrCallback === "string" ? encodingOrCallback : void 0;
492436
+ return Buffer.byteLength(chunk, encoding);
492437
+ }
492438
+ return chunk.byteLength;
492439
+ }
492440
+ __name(getChunkByteLength, "getChunkByteLength");
492441
+ function optimizeMultilineEraseLinesWithCount(output) {
492442
+ let optimizedSequenceCount = 0;
492443
+ const optimizedOutput = output.replace(
492444
+ MULTILINE_ERASE_LINES_PATTERN,
492445
+ (sequence) => {
492446
+ const lineCount = countOccurrences2(sequence, ERASE_LINE);
492447
+ const cursorUpCount = lineCount - 1;
492448
+ if (cursorUpCount <= 1) {
492449
+ return sequence;
492450
+ }
492451
+ optimizedSequenceCount += 1;
492452
+ let boundedErase = `${ESC4}${cursorUpCount}A`;
492453
+ for (let line = 0; line < lineCount; line++) {
492454
+ boundedErase += ERASE_LINE;
492455
+ if (line < lineCount - 1) {
492456
+ boundedErase += CURSOR_DOWN_ONE;
492457
+ }
492458
+ }
492459
+ return `${boundedErase}${ESC4}${cursorUpCount}A${CURSOR_LEFT}`;
492460
+ }
492461
+ );
492462
+ return { output: optimizedOutput, optimizedSequenceCount };
492463
+ }
492464
+ __name(optimizeMultilineEraseLinesWithCount, "optimizeMultilineEraseLinesWithCount");
492465
+ function installTerminalRedrawOptimizer(stdout3) {
492466
+ if (process.env["PROTO_LEGACY_ERASE_LINES"] === "1") {
492467
+ return () => {
492468
+ };
492469
+ }
492470
+ const originalWrite = stdout3.write;
492471
+ const optimizedWrite = /* @__PURE__ */ __name(function(chunk, encodingOrCallback, callback) {
492472
+ const optimizedResult = typeof chunk === "string" ? optimizeMultilineEraseLinesWithCount(chunk) : void 0;
492473
+ const optimizedChunk = optimizedResult?.output ?? chunk;
492474
+ if (typeof optimizedChunk === "string" || optimizedChunk instanceof Uint8Array || Buffer.isBuffer(optimizedChunk)) {
492475
+ terminalRedrawStats.stdoutWriteCount += 1;
492476
+ terminalRedrawStats.stdoutBytes += getChunkByteLength(
492477
+ optimizedChunk,
492478
+ encodingOrCallback
492479
+ );
492480
+ if (typeof optimizedChunk === "string") {
492481
+ terminalRedrawStats.clearTerminalCount += countOccurrences2(
492482
+ optimizedChunk,
492483
+ base_exports.clearTerminal
492484
+ );
492485
+ }
492486
+ }
492487
+ if (optimizedResult) {
492488
+ terminalRedrawStats.eraseLinesOptimizedCount += optimizedResult.optimizedSequenceCount;
492489
+ }
492490
+ return originalWrite.call(
492491
+ this,
492492
+ optimizedChunk,
492493
+ encodingOrCallback,
492494
+ callback
492495
+ );
492496
+ }, "optimizedWrite");
492497
+ stdout3.write = optimizedWrite;
492498
+ return () => {
492499
+ if (stdout3.write === optimizedWrite) {
492500
+ stdout3.write = originalWrite;
492501
+ }
492502
+ };
492503
+ }
492504
+ __name(installTerminalRedrawOptimizer, "installTerminalRedrawOptimizer");
492505
+
492506
+ // packages/cli/src/ui/utils/synchronizedOutput.ts
492507
+ init_esbuild_shims();
492508
+ var BEGIN_SYNCHRONIZED_UPDATE = "\x1B[?2026h";
492509
+ var END_SYNCHRONIZED_UPDATE = "\x1B[?2026l";
492510
+ var synchronizedOutputStats = {
492511
+ synchronizedOutputFrameCount: 0,
492512
+ synchronizedOutputBeginCount: 0,
492513
+ synchronizedOutputEndCount: 0
492514
+ };
492515
+ var installed = false;
492516
+ function terminalSupportsSynchronizedOutput(env5 = process.env) {
492517
+ if (env5["PROTO_DISABLE_SYNCHRONIZED_OUTPUT"] === "1" || env5["PROTO_SYNCHRONIZED_OUTPUT"] === "0") {
492518
+ return false;
492519
+ }
492520
+ if (env5["PROTO_FORCE_SYNCHRONIZED_OUTPUT"] === "1" || env5["PROTO_SYNCHRONIZED_OUTPUT"] === "1") {
492521
+ return true;
492522
+ }
492523
+ if (env5["TMUX"] || env5["SSH_TTY"] || env5["SSH_CLIENT"]) {
492524
+ return false;
492525
+ }
492526
+ const termProgram = env5["TERM_PROGRAM"];
492527
+ if (termProgram === "WezTerm" || termProgram === "iTerm.app" || termProgram === "ghostty") {
492528
+ return true;
492529
+ }
492530
+ if (env5["ALACRITTY_WINDOW_ID"]) {
492531
+ return true;
492532
+ }
492533
+ const term = env5["TERM"];
492534
+ if (env5["KITTY_WINDOW_ID"] || term?.includes("kitty")) {
492535
+ return true;
492536
+ }
492537
+ if (term?.startsWith("alacritty")) {
492538
+ return true;
492539
+ }
492540
+ if (env5["GHOSTTY_RESOURCES_DIR"]) {
492541
+ return true;
492542
+ }
492543
+ return false;
492544
+ }
492545
+ __name(terminalSupportsSynchronizedOutput, "terminalSupportsSynchronizedOutput");
492546
+ function installSynchronizedOutput(stdout3 = process.stdout, env5 = process.env) {
492547
+ if (installed || !stdout3.isTTY || !terminalSupportsSynchronizedOutput(env5)) {
492548
+ return () => {
492549
+ };
492550
+ }
492551
+ const originalWrite = stdout3.write;
492552
+ let inFrame = false;
492553
+ const writeControlSequence = /* @__PURE__ */ __name((sequence) => {
492554
+ originalWrite.call(stdout3, sequence);
492555
+ }, "writeControlSequence");
492556
+ const endFrame = /* @__PURE__ */ __name(() => {
492557
+ if (!inFrame) {
492558
+ return;
492559
+ }
492560
+ inFrame = false;
492561
+ synchronizedOutputStats.synchronizedOutputEndCount += 1;
492562
+ writeControlSequence(END_SYNCHRONIZED_UPDATE);
492563
+ }, "endFrame");
492564
+ const patchedWrite = /* @__PURE__ */ __name(function(chunk, encodingOrCallback, callback) {
492565
+ if (!inFrame) {
492566
+ inFrame = true;
492567
+ synchronizedOutputStats.synchronizedOutputFrameCount += 1;
492568
+ synchronizedOutputStats.synchronizedOutputBeginCount += 1;
492569
+ writeControlSequence(BEGIN_SYNCHRONIZED_UPDATE);
492570
+ queueMicrotask(endFrame);
492571
+ }
492572
+ return originalWrite.call(
492573
+ this,
492574
+ chunk,
492575
+ encodingOrCallback,
492576
+ callback
492577
+ );
492578
+ }, "patchedWrite");
492579
+ const exitHandler = /* @__PURE__ */ __name(() => {
492580
+ try {
492581
+ endFrame();
492582
+ } catch {
492583
+ }
492584
+ }, "exitHandler");
492585
+ stdout3.write = patchedWrite;
492586
+ installed = true;
492587
+ process.once("exit", exitHandler);
492588
+ return () => {
492589
+ if (stdout3.write === patchedWrite) {
492590
+ endFrame();
492591
+ stdout3.write = originalWrite;
492592
+ }
492593
+ process.removeListener("exit", exitHandler);
492594
+ installed = false;
492595
+ };
492596
+ }
492597
+ __name(installSynchronizedOutput, "installSynchronizedOutput");
492598
+
492087
492599
  // packages/cli/src/gemini.tsx
492088
492600
  var import_jsx_runtime141 = __toESM(require_jsx_runtime(), 1);
492089
492601
  var debugLogger160 = createDebugLogger("STARTUP");
@@ -492147,6 +492659,10 @@ ${reason.stack}` : ""}`;
492147
492659
  __name(setupUnhandledRejectionHandler, "setupUnhandledRejectionHandler");
492148
492660
  async function startInteractiveUI(config2, settings2, startupWarnings, workspaceRoot = process.cwd(), initializationResult) {
492149
492661
  const version2 = await getCliVersion();
492662
+ const restoreTerminalRedrawOptimizer = process.stdout.isTTY && !config2.getScreenReader() ? installTerminalRedrawOptimizer(process.stdout) : () => {
492663
+ };
492664
+ const restoreSynchronizedOutput = process.stdout.isTTY && !config2.getScreenReader() ? installSynchronizedOutput(process.stdout) : () => {
492665
+ };
492150
492666
  const AppWrapper = /* @__PURE__ */ __name(() => {
492151
492667
  const kittyProtocolStatus = useKittyKeyboardProtocol();
492152
492668
  const nodeMajorVersion = parseInt(process.versions.node.split(".")[0], 10);
@@ -492186,7 +492702,11 @@ async function startInteractiveUI(config2, settings2, startupWarnings, workspace
492186
492702
  debugLogger160.warn(`Update check failed: ${err2}`);
492187
492703
  });
492188
492704
  }
492189
- registerCleanup(() => instance2.unmount());
492705
+ registerCleanup(() => {
492706
+ instance2.unmount();
492707
+ restoreSynchronizedOutput();
492708
+ restoreTerminalRedrawOptimizer();
492709
+ });
492190
492710
  }
492191
492711
  __name(startInteractiveUI, "startInteractiveUI");
492192
492712
  async function main() {