@protolabsai/proto 0.25.4 → 0.25.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.js +747 -455
  2. package/package.json +2 -2
package/cli.js CHANGED
@@ -1883,8 +1883,8 @@ var require_dispatcher = __commonJS({
1883
1883
  "packages/core/node_modules/undici/lib/dispatcher/dispatcher.js"(exports2, module2) {
1884
1884
  "use strict";
1885
1885
  init_esbuild_shims();
1886
- var EventEmitter12 = __require("node:events");
1887
- var Dispatcher = class extends EventEmitter12 {
1886
+ var EventEmitter13 = __require("node:events");
1887
+ var Dispatcher = class extends EventEmitter13 {
1888
1888
  static {
1889
1889
  __name(this, "Dispatcher");
1890
1890
  }
@@ -56950,7 +56950,7 @@ var require_websocket2 = __commonJS({
56950
56950
  "node_modules/ws/lib/websocket.js"(exports2, module2) {
56951
56951
  "use strict";
56952
56952
  init_esbuild_shims();
56953
- var EventEmitter12 = __require("events");
56953
+ var EventEmitter13 = __require("events");
56954
56954
  var https8 = __require("https");
56955
56955
  var http8 = __require("http");
56956
56956
  var net2 = __require("net");
@@ -56982,7 +56982,7 @@ var require_websocket2 = __commonJS({
56982
56982
  var protocolVersions = [8, 13];
56983
56983
  var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
56984
56984
  var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
56985
- var WebSocket2 = class _WebSocket extends EventEmitter12 {
56985
+ var WebSocket2 = class _WebSocket extends EventEmitter13 {
56986
56986
  static {
56987
56987
  __name(this, "WebSocket");
56988
56988
  }
@@ -58007,7 +58007,7 @@ var require_websocket_server = __commonJS({
58007
58007
  "node_modules/ws/lib/websocket-server.js"(exports2, module2) {
58008
58008
  "use strict";
58009
58009
  init_esbuild_shims();
58010
- var EventEmitter12 = __require("events");
58010
+ var EventEmitter13 = __require("events");
58011
58011
  var http8 = __require("http");
58012
58012
  var { Duplex } = __require("stream");
58013
58013
  var { createHash: createHash8 } = __require("crypto");
@@ -58020,7 +58020,7 @@ var require_websocket_server = __commonJS({
58020
58020
  var RUNNING = 0;
58021
58021
  var CLOSING = 1;
58022
58022
  var CLOSED2 = 2;
58023
- var WebSocketServer2 = class extends EventEmitter12 {
58023
+ var WebSocketServer2 = class extends EventEmitter13 {
58024
58024
  static {
58025
58025
  __name(this, "WebSocketServer");
58026
58026
  }
@@ -100438,19 +100438,19 @@ var require_eventemitter = __commonJS({
100438
100438
  "node_modules/@protobufjs/eventemitter/index.js"(exports2, module2) {
100439
100439
  "use strict";
100440
100440
  init_esbuild_shims();
100441
- module2.exports = EventEmitter12;
100442
- function EventEmitter12() {
100441
+ module2.exports = EventEmitter13;
100442
+ function EventEmitter13() {
100443
100443
  this._listeners = {};
100444
100444
  }
100445
- __name(EventEmitter12, "EventEmitter");
100446
- EventEmitter12.prototype.on = /* @__PURE__ */ __name(function on(evt, fn, ctx) {
100445
+ __name(EventEmitter13, "EventEmitter");
100446
+ EventEmitter13.prototype.on = /* @__PURE__ */ __name(function on(evt, fn, ctx) {
100447
100447
  (this._listeners[evt] || (this._listeners[evt] = [])).push({
100448
100448
  fn,
100449
100449
  ctx: ctx || this
100450
100450
  });
100451
100451
  return this;
100452
100452
  }, "on");
100453
- EventEmitter12.prototype.off = /* @__PURE__ */ __name(function off(evt, fn) {
100453
+ EventEmitter13.prototype.off = /* @__PURE__ */ __name(function off(evt, fn) {
100454
100454
  if (evt === void 0)
100455
100455
  this._listeners = {};
100456
100456
  else {
@@ -100467,7 +100467,7 @@ var require_eventemitter = __commonJS({
100467
100467
  }
100468
100468
  return this;
100469
100469
  }, "off");
100470
- EventEmitter12.prototype.emit = /* @__PURE__ */ __name(function emit(evt) {
100470
+ EventEmitter13.prototype.emit = /* @__PURE__ */ __name(function emit(evt) {
100471
100471
  var listeners = this._listeners[evt];
100472
100472
  if (listeners) {
100473
100473
  var args2 = [], i4 = 1;
@@ -170887,7 +170887,7 @@ __export(geminiContentGenerator_exports, {
170887
170887
  createGeminiContentGenerator: () => createGeminiContentGenerator
170888
170888
  });
170889
170889
  function createGeminiContentGenerator(config2, gcConfig) {
170890
- const version2 = "0.25.4";
170890
+ const version2 = "0.25.5";
170891
170891
  const userAgent2 = config2.userAgent || `QwenCode/${version2} (${process.platform}; ${process.arch})`;
170892
170892
  const baseHeaders = {
170893
170893
  "User-Agent": userAgent2
@@ -173403,6 +173403,50 @@ var init_thoughtUtils = __esm({
173403
173403
  }
173404
173404
  });
173405
173405
 
173406
+ // packages/core/dist/src/utils/streamStall.js
173407
+ async function* withChunkTimeout(source2, timeoutMs) {
173408
+ while (true) {
173409
+ let timer;
173410
+ const stallPromise = new Promise((_2, reject) => {
173411
+ timer = setTimeout(() => reject(new StreamStallError(timeoutMs)), timeoutMs);
173412
+ });
173413
+ let result;
173414
+ try {
173415
+ result = await Promise.race([source2.next(), stallPromise]);
173416
+ clearTimeout(timer);
173417
+ } catch (err2) {
173418
+ clearTimeout(timer);
173419
+ try {
173420
+ void source2.return?.(void 0);
173421
+ } catch {
173422
+ }
173423
+ throw err2;
173424
+ }
173425
+ if (result.done)
173426
+ return;
173427
+ yield result.value;
173428
+ }
173429
+ }
173430
+ var StreamStallError;
173431
+ var init_streamStall = __esm({
173432
+ "packages/core/dist/src/utils/streamStall.js"() {
173433
+ "use strict";
173434
+ init_esbuild_shims();
173435
+ StreamStallError = class extends Error {
173436
+ static {
173437
+ __name(this, "StreamStallError");
173438
+ }
173439
+ timeoutMs;
173440
+ constructor(timeoutMs) {
173441
+ super(`Stream stalled: no data received for ${timeoutMs / 1e3}s. The model connection may have dropped \u2014 please try again.`);
173442
+ this.name = "StreamStallError";
173443
+ this.timeoutMs = timeoutMs;
173444
+ }
173445
+ };
173446
+ __name(withChunkTimeout, "withChunkTimeout");
173447
+ }
173448
+ });
173449
+
173406
173450
  // packages/core/dist/src/core/turn.js
173407
173451
  function getCitations(resp) {
173408
173452
  return (resp.candidates?.[0]?.citationMetadata?.citations ?? []).filter((citation) => citation.uri !== void 0).map((citation) => {
@@ -173412,7 +173456,7 @@ function getCitations(resp) {
173412
173456
  return citation.uri;
173413
173457
  });
173414
173458
  }
173415
- var GeminiEventType, CompressionStatus, Turn;
173459
+ var STREAM_STALL_TIMEOUT_MS, GeminiEventType, CompressionStatus, Turn;
173416
173460
  var init_turn = __esm({
173417
173461
  "packages/core/dist/src/core/turn.js"() {
173418
173462
  "use strict";
@@ -173422,6 +173466,8 @@ var init_turn = __esm({
173422
173466
  init_errorReporting();
173423
173467
  init_errors();
173424
173468
  init_thoughtUtils();
173469
+ init_streamStall();
173470
+ STREAM_STALL_TIMEOUT_MS = parseInt(process.env["PROTO_STREAM_STALL_TIMEOUT_MS"] ?? "30000", 10);
173425
173471
  (function(GeminiEventType2) {
173426
173472
  GeminiEventType2["Content"] = "content";
173427
173473
  GeminiEventType2["ToolCallRequest"] = "tool_call_request";
@@ -173464,12 +173510,13 @@ var init_turn = __esm({
173464
173510
  // The run method yields simpler events suitable for server logic
173465
173511
  async *run(model, req, signal) {
173466
173512
  try {
173467
- const responseStream = await this.chat.sendMessageStream(model, {
173513
+ const rawStream = await this.chat.sendMessageStream(model, {
173468
173514
  message: req,
173469
173515
  config: {
173470
173516
  abortSignal: signal
173471
173517
  }
173472
173518
  }, this.prompt_id);
173519
+ const responseStream = withChunkTimeout(rawStream, STREAM_STALL_TIMEOUT_MS);
173473
173520
  for await (const streamEvent of responseStream) {
173474
173521
  if (signal?.aborted) {
173475
173522
  yield { type: GeminiEventType.UserCancelled };
@@ -173540,6 +173587,18 @@ ${[...this.pendingCitations].sort().join("\n")}`
173540
173587
  yield { type: GeminiEventType.UserCancelled };
173541
173588
  return;
173542
173589
  }
173590
+ if (e4 instanceof StreamStallError) {
173591
+ yield {
173592
+ type: GeminiEventType.Error,
173593
+ value: {
173594
+ error: {
173595
+ message: e4.message,
173596
+ status: void 0
173597
+ }
173598
+ }
173599
+ };
173600
+ return;
173601
+ }
173543
173602
  const error40 = toFriendlyError(e4);
173544
173603
  if (error40 instanceof UnauthorizedError) {
173545
173604
  throw error40;
@@ -191472,6 +191531,95 @@ Notes:
191472
191531
  }
191473
191532
  });
191474
191533
 
191534
+ // packages/core/dist/src/utils/backgroundProgressEmitter.js
191535
+ import { EventEmitter as EventEmitter3 } from "node:events";
191536
+ function bridgeToProgressBus(source2, agentName, agentId) {
191537
+ const startTime = Date.now();
191538
+ const onStart = /* @__PURE__ */ __name(() => {
191539
+ backgroundProgressEmitter.emit("agent_started", {
191540
+ agentId,
191541
+ agentName,
191542
+ timestamp: Date.now()
191543
+ });
191544
+ }, "onStart");
191545
+ const onRound = /* @__PURE__ */ __name((payload) => {
191546
+ backgroundProgressEmitter.emit("agent_round", {
191547
+ agentId,
191548
+ agentName,
191549
+ round: payload.round,
191550
+ timestamp: Date.now()
191551
+ });
191552
+ }, "onRound");
191553
+ const onToolCall = /* @__PURE__ */ __name((payload) => {
191554
+ backgroundProgressEmitter.emit("agent_tool_call", {
191555
+ agentId,
191556
+ agentName,
191557
+ round: payload.round,
191558
+ toolName: payload.name,
191559
+ timestamp: Date.now()
191560
+ });
191561
+ }, "onToolCall");
191562
+ const onFinish = /* @__PURE__ */ __name((payload) => {
191563
+ const hitLimit = payload.terminateReason === "max_turns" || payload.terminateReason === "timeout";
191564
+ backgroundProgressEmitter.emit("agent_finished", {
191565
+ agentId,
191566
+ agentName,
191567
+ terminateReason: payload.terminateReason,
191568
+ hitLimit,
191569
+ rounds: payload.rounds ?? 0,
191570
+ durationMs: payload.totalDurationMs ?? Date.now() - startTime,
191571
+ timestamp: Date.now()
191572
+ });
191573
+ cleanup();
191574
+ }, "onFinish");
191575
+ const onError2 = /* @__PURE__ */ __name((payload) => {
191576
+ backgroundProgressEmitter.emit("agent_failed", {
191577
+ agentId,
191578
+ agentName,
191579
+ error: payload.error,
191580
+ timestamp: Date.now()
191581
+ });
191582
+ cleanup();
191583
+ }, "onError");
191584
+ function cleanup() {
191585
+ source2.off(AgentEventType.START, onStart);
191586
+ source2.off(AgentEventType.ROUND_START, onRound);
191587
+ source2.off(AgentEventType.TOOL_CALL, onToolCall);
191588
+ source2.off(AgentEventType.FINISH, onFinish);
191589
+ source2.off(AgentEventType.ERROR, onError2);
191590
+ }
191591
+ __name(cleanup, "cleanup");
191592
+ source2.on(AgentEventType.START, onStart);
191593
+ source2.on(AgentEventType.ROUND_START, onRound);
191594
+ source2.on(AgentEventType.TOOL_CALL, onToolCall);
191595
+ source2.on(AgentEventType.FINISH, onFinish);
191596
+ source2.on(AgentEventType.ERROR, onError2);
191597
+ }
191598
+ var BackgroundProgressEmitter, backgroundProgressEmitter;
191599
+ var init_backgroundProgressEmitter = __esm({
191600
+ "packages/core/dist/src/utils/backgroundProgressEmitter.js"() {
191601
+ "use strict";
191602
+ init_esbuild_shims();
191603
+ init_agent_events();
191604
+ BackgroundProgressEmitter = class extends EventEmitter3 {
191605
+ static {
191606
+ __name(this, "BackgroundProgressEmitter");
191607
+ }
191608
+ on(event, listener) {
191609
+ return super.on(event, listener);
191610
+ }
191611
+ off(event, listener) {
191612
+ return super.off(event, listener);
191613
+ }
191614
+ emit(event, payload) {
191615
+ return super.emit(event, payload);
191616
+ }
191617
+ };
191618
+ backgroundProgressEmitter = new BackgroundProgressEmitter();
191619
+ __name(bridgeToProgressBus, "bridgeToProgressBus");
191620
+ }
191621
+ });
191622
+
191475
191623
  // packages/core/dist/src/agents/background-store.js
191476
191624
  import fs29 from "node:fs";
191477
191625
  import path32 from "node:path";
@@ -191820,6 +191968,7 @@ var init_agent = __esm({
191820
191968
  init_agent_events();
191821
191969
  init_builtin_agents();
191822
191970
  init_debugLogger();
191971
+ init_backgroundProgressEmitter();
191823
191972
  init_background_store();
191824
191973
  init_types7();
191825
191974
  init_esm();
@@ -192298,6 +192447,10 @@ assistant: "I'm going to use the ${ToolNames.AGENT} tool to launch the greeting-
192298
192447
  startTime: entry.startTime,
192299
192448
  status: "running"
192300
192449
  }));
192450
+ const bgEmitter = subagent.getEventEmitter();
192451
+ if (bgEmitter) {
192452
+ bridgeToProgressBus(bgEmitter, entry.agentName, agentId);
192453
+ }
192301
192454
  subagent.execute(contextState, signal).then(() => {
192302
192455
  entry.completed = true;
192303
192456
  entry.result = subagent.getFinalText();
@@ -202312,7 +202465,7 @@ var init_esm8 = __esm({
202312
202465
  });
202313
202466
 
202314
202467
  // node_modules/minipass/dist/esm/index.js
202315
- import { EventEmitter as EventEmitter3 } from "node:events";
202468
+ import { EventEmitter as EventEmitter4 } from "node:events";
202316
202469
  import Stream5 from "node:stream";
202317
202470
  import { StringDecoder } from "node:string_decoder";
202318
202471
  var proc, isStream, isReadable, isWritable, EOF, MAYBE_EMIT_END, EMITTED_END, EMITTING_END, EMITTED_ERROR, CLOSED, READ, FLUSH, FLUSHCHUNK, ENCODING, DECODER, FLOWING, PAUSED, RESUME, BUFFER, PIPES, BUFFERLENGTH, BUFFERPUSH, BUFFERSHIFT, OBJECTMODE, DESTROYED, ERROR, EMITDATA, EMITEND, EMITEND2, ASYNC, ABORT2, ABORTED, SIGNAL, DATALISTENERS, DISCARDED, defer, nodefer, isEndish, isArrayBufferLike, isArrayBufferView, Pipe, PipeProxyErrors, isObjectModeOptions, isEncodingOptions, Minipass;
@@ -202324,9 +202477,9 @@ var init_esm9 = __esm({
202324
202477
  stderr: null
202325
202478
  };
202326
202479
  isStream = /* @__PURE__ */ __name((s5) => !!s5 && typeof s5 === "object" && (s5 instanceof Minipass || s5 instanceof Stream5 || isReadable(s5) || isWritable(s5)), "isStream");
202327
- isReadable = /* @__PURE__ */ __name((s5) => !!s5 && typeof s5 === "object" && s5 instanceof EventEmitter3 && typeof s5.pipe === "function" && // node core Writable streams have a pipe() method, but it throws
202480
+ isReadable = /* @__PURE__ */ __name((s5) => !!s5 && typeof s5 === "object" && s5 instanceof EventEmitter4 && typeof s5.pipe === "function" && // node core Writable streams have a pipe() method, but it throws
202328
202481
  s5.pipe !== Stream5.Writable.prototype.pipe, "isReadable");
202329
- isWritable = /* @__PURE__ */ __name((s5) => !!s5 && typeof s5 === "object" && s5 instanceof EventEmitter3 && typeof s5.write === "function" && typeof s5.end === "function", "isWritable");
202482
+ isWritable = /* @__PURE__ */ __name((s5) => !!s5 && typeof s5 === "object" && s5 instanceof EventEmitter4 && typeof s5.write === "function" && typeof s5.end === "function", "isWritable");
202330
202483
  EOF = Symbol("EOF");
202331
202484
  MAYBE_EMIT_END = Symbol("maybeEmitEnd");
202332
202485
  EMITTED_END = Symbol("emittedEnd");
@@ -202408,7 +202561,7 @@ var init_esm9 = __esm({
202408
202561
  };
202409
202562
  isObjectModeOptions = /* @__PURE__ */ __name((o3) => !!o3.objectMode, "isObjectModeOptions");
202410
202563
  isEncodingOptions = /* @__PURE__ */ __name((o3) => !o3.objectMode && !!o3.encoding && o3.encoding !== "buffer", "isEncodingOptions");
202411
- Minipass = class extends EventEmitter3 {
202564
+ Minipass = class extends EventEmitter4 {
202412
202565
  static {
202413
202566
  __name(this, "Minipass");
202414
202567
  }
@@ -206362,7 +206515,7 @@ var require_dist5 = __commonJS({
206362
206515
  // node_modules/simple-git/dist/esm/index.js
206363
206516
  import { Buffer as Buffer22 } from "node:buffer";
206364
206517
  import { spawn as spawn2 } from "child_process";
206365
- import { EventEmitter as EventEmitter4 } from "node:events";
206518
+ import { EventEmitter as EventEmitter5 } from "node:events";
206366
206519
  function pathspec(...paths) {
206367
206520
  const key = new String(paths);
206368
206521
  cache.set(key, paths);
@@ -211022,7 +211175,7 @@ var init_esm12 = __esm({
211022
211175
  }
211023
211176
  constructor() {
211024
211177
  this.plugins = /* @__PURE__ */ new Set();
211025
- this.events = new EventEmitter4();
211178
+ this.events = new EventEmitter5();
211026
211179
  }
211027
211180
  on(type, listener) {
211028
211181
  this.events.on(type, listener);
@@ -247931,7 +248084,7 @@ var init_handler = __esm({
247931
248084
  // node_modules/chokidar/esm/index.js
247932
248085
  import { stat as statcb } from "fs";
247933
248086
  import { stat as stat7, readdir as readdir5 } from "fs/promises";
247934
- import { EventEmitter as EventEmitter5 } from "events";
248087
+ import { EventEmitter as EventEmitter6 } from "events";
247935
248088
  import * as sysPath2 from "path";
247936
248089
  function arrify(item) {
247937
248090
  return Array.isArray(item) ? item : [item];
@@ -248145,7 +248298,7 @@ var init_esm21 = __esm({
248145
248298
  return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
248146
248299
  }
248147
248300
  };
248148
- FSWatcher = class extends EventEmitter5 {
248301
+ FSWatcher = class extends EventEmitter6 {
248149
248302
  static {
248150
248303
  __name(this, "FSWatcher");
248151
248304
  }
@@ -258099,15 +258252,15 @@ var require_fd_slicer = __commonJS({
258099
258252
  var Writable3 = stream2.Writable;
258100
258253
  var PassThrough8 = stream2.PassThrough;
258101
258254
  var Pend = require_pend();
258102
- var EventEmitter12 = __require("events").EventEmitter;
258255
+ var EventEmitter13 = __require("events").EventEmitter;
258103
258256
  exports2.createFromBuffer = createFromBuffer;
258104
258257
  exports2.createFromFd = createFromFd;
258105
258258
  exports2.BufferSlicer = BufferSlicer;
258106
258259
  exports2.FdSlicer = FdSlicer;
258107
- util3.inherits(FdSlicer, EventEmitter12);
258260
+ util3.inherits(FdSlicer, EventEmitter13);
258108
258261
  function FdSlicer(fd, options2) {
258109
258262
  options2 = options2 || {};
258110
- EventEmitter12.call(this);
258263
+ EventEmitter13.call(this);
258111
258264
  this.fd = fd;
258112
258265
  this.pend = new Pend();
258113
258266
  this.pend.max = 1;
@@ -258255,9 +258408,9 @@ var require_fd_slicer = __commonJS({
258255
258408
  this.destroyed = true;
258256
258409
  this.context.unref();
258257
258410
  };
258258
- util3.inherits(BufferSlicer, EventEmitter12);
258411
+ util3.inherits(BufferSlicer, EventEmitter13);
258259
258412
  function BufferSlicer(buffer, options2) {
258260
- EventEmitter12.call(this);
258413
+ EventEmitter13.call(this);
258261
258414
  options2 = options2 || {};
258262
258415
  this.refCount = 0;
258263
258416
  this.buffer = buffer;
@@ -258676,7 +258829,7 @@ var require_yauzl = __commonJS({
258676
258829
  var fd_slicer = require_fd_slicer();
258677
258830
  var crc32 = require_buffer_crc32();
258678
258831
  var util3 = __require("util");
258679
- var EventEmitter12 = __require("events").EventEmitter;
258832
+ var EventEmitter13 = __require("events").EventEmitter;
258680
258833
  var Transform2 = __require("stream").Transform;
258681
258834
  var PassThrough8 = __require("stream").PassThrough;
258682
258835
  var Writable3 = __require("stream").Writable;
@@ -258812,10 +258965,10 @@ var require_yauzl = __commonJS({
258812
258965
  });
258813
258966
  }
258814
258967
  __name(fromRandomAccessReader, "fromRandomAccessReader");
258815
- util3.inherits(ZipFile, EventEmitter12);
258968
+ util3.inherits(ZipFile, EventEmitter13);
258816
258969
  function ZipFile(reader, centralDirectoryOffset, fileSize, entryCount, comment, autoClose, lazyEntries, decodeStrings, validateEntrySizes, strictFileNames) {
258817
258970
  var self2 = this;
258818
- EventEmitter12.call(self2);
258971
+ EventEmitter13.call(self2);
258819
258972
  self2.reader = reader;
258820
258973
  self2.reader.on("error", function(err2) {
258821
258974
  emitError(self2, err2);
@@ -259184,9 +259337,9 @@ var require_yauzl = __commonJS({
259184
259337
  }
259185
259338
  cb();
259186
259339
  };
259187
- util3.inherits(RandomAccessReader, EventEmitter12);
259340
+ util3.inherits(RandomAccessReader, EventEmitter13);
259188
259341
  function RandomAccessReader() {
259189
- EventEmitter12.call(this);
259342
+ EventEmitter13.call(this);
259190
259343
  this.refCount = 0;
259191
259344
  }
259192
259345
  __name(RandomAccessReader, "RandomAccessReader");
@@ -263713,12 +263866,12 @@ var require_prompt = __commonJS({
263713
263866
  var readline4 = __require("readline");
263714
263867
  var _require2 = require_util17();
263715
263868
  var action = _require2.action;
263716
- var EventEmitter12 = __require("events");
263869
+ var EventEmitter13 = __require("events");
263717
263870
  var _require22 = require_src37();
263718
263871
  var beep2 = _require22.beep;
263719
263872
  var cursor = _require22.cursor;
263720
263873
  var color = require_kleur();
263721
- var Prompt = class extends EventEmitter12 {
263874
+ var Prompt = class extends EventEmitter13 {
263722
263875
  static {
263723
263876
  __name(this, "Prompt");
263724
263877
  }
@@ -266299,10 +266452,10 @@ var require_prompt2 = __commonJS({
266299
266452
  init_esbuild_shims();
266300
266453
  var readline4 = __require("readline");
266301
266454
  var { action } = require_util18();
266302
- var EventEmitter12 = __require("events");
266455
+ var EventEmitter13 = __require("events");
266303
266456
  var { beep: beep2, cursor } = require_src37();
266304
266457
  var color = require_kleur();
266305
- var Prompt = class extends EventEmitter12 {
266458
+ var Prompt = class extends EventEmitter13 {
266306
266459
  static {
266307
266460
  __name(this, "Prompt");
266308
266461
  }
@@ -271065,7 +271218,7 @@ var init_hooks = __esm({
271065
271218
 
271066
271219
  // packages/core/dist/src/confirmation-bus/message-bus.js
271067
271220
  import { randomUUID as randomUUID3 } from "node:crypto";
271068
- import { EventEmitter as EventEmitter6 } from "node:events";
271221
+ import { EventEmitter as EventEmitter7 } from "node:events";
271069
271222
  var debugLogger76, MessageBus;
271070
271223
  var init_message_bus = __esm({
271071
271224
  "packages/core/dist/src/confirmation-bus/message-bus.js"() {
@@ -271075,7 +271228,7 @@ var init_message_bus = __esm({
271075
271228
  init_safeJsonStringify();
271076
271229
  init_debugLogger();
271077
271230
  debugLogger76 = createDebugLogger("TRUSTED_HOOKS");
271078
- MessageBus = class extends EventEmitter6 {
271231
+ MessageBus = class extends EventEmitter7 {
271079
271232
  static {
271080
271233
  __name(this, "MessageBus");
271081
271234
  }
@@ -277751,6 +277904,9 @@ async function _runExtraction(config2, history, tokenCount) {
277751
277904
  const notesPath = getSessionNotesPath(projectDir);
277752
277905
  const currentNotes = await readSessionNotes(projectDir) ?? SESSION_MEMORY_TEMPLATE;
277753
277906
  const systemPrompt = buildExtractionPrompt(currentNotes, notesPath, history);
277907
+ const eventEmitter = new AgentEventEmitter();
277908
+ const agentId = `session-memory-${Date.now()}`;
277909
+ bridgeToProgressBus(eventEmitter, "session-memory", agentId);
277754
277910
  const agent = await AgentHeadless.create(
277755
277911
  "session-memory",
277756
277912
  config2,
@@ -277761,7 +277917,8 @@ async function _runExtraction(config2, history, tokenCount) {
277761
277917
  max_time_minutes: MAX_EXTRACTOR_MINUTES2
277762
277918
  },
277763
277919
  // Restrict to Edit only — the agent should only touch the notes file
277764
- { tools: [ToolNames.EDIT] }
277920
+ { tools: [ToolNames.EDIT] },
277921
+ eventEmitter
277765
277922
  );
277766
277923
  const timeoutSignal = AbortSignal.timeout(MAX_EXTRACTOR_MINUTES2 * 60 * 1e3);
277767
277924
  await agent.execute(new ContextState(), timeoutSignal);
@@ -277782,9 +277939,11 @@ var init_sessionMemory = __esm({
277782
277939
  init_sessionNotes();
277783
277940
  init_prompts2();
277784
277941
  init_sessionMemoryUtils();
277942
+ init_agent_events();
277943
+ init_backgroundProgressEmitter();
277785
277944
  logger6 = createDebugLogger("SESSION_MEMORY");
277786
- MAX_EXTRACTOR_TURNS2 = 2;
277787
- MAX_EXTRACTOR_MINUTES2 = 2;
277945
+ MAX_EXTRACTOR_TURNS2 = 4;
277946
+ MAX_EXTRACTOR_MINUTES2 = 3;
277788
277947
  __name(ensureNotesFile, "ensureNotesFile");
277789
277948
  __name(extractSessionMemory, "extractSessionMemory");
277790
277949
  __name(manuallyExtractSessionMemory, "manuallyExtractSessionMemory");
@@ -282919,7 +283078,7 @@ var init_backends = __esm({
282919
283078
  });
282920
283079
 
282921
283080
  // packages/core/dist/src/agents/arena/arena-events.js
282922
- import { EventEmitter as EventEmitter7 } from "events";
283081
+ import { EventEmitter as EventEmitter8 } from "events";
282923
283082
  var ArenaEventType, ArenaEventEmitter;
282924
283083
  var init_arena_events = __esm({
282925
283084
  "packages/core/dist/src/agents/arena/arena-events.js"() {
@@ -282939,7 +283098,7 @@ var init_arena_events = __esm({
282939
283098
  static {
282940
283099
  __name(this, "ArenaEventEmitter");
282941
283100
  }
282942
- ee = new EventEmitter7();
283101
+ ee = new EventEmitter8();
282943
283102
  on(event, listener) {
282944
283103
  this.ee.on(event, listener);
282945
283104
  }
@@ -288500,6 +288659,8 @@ var init_src2 = __esm({
288500
288659
  init_thoughtUtils();
288501
288660
  init_toml_to_markdown_converter();
288502
288661
  init_tool_utils();
288662
+ init_backgroundProgressEmitter();
288663
+ init_streamStall();
288503
288664
  init_workspaceContext();
288504
288665
  init_yaml_parser();
288505
288666
  init_config4();
@@ -288777,6 +288938,7 @@ __export(dist_exports, {
288777
288938
  StopHookOutput: () => StopHookOutput,
288778
288939
  Storage: () => Storage,
288779
288940
  StreamEventType: () => StreamEventType,
288941
+ StreamStallError: () => StreamStallError,
288780
288942
  SubagentError: () => SubagentError,
288781
288943
  SubagentManager: () => SubagentManager,
288782
288944
  SubagentValidator: () => SubagentValidator,
@@ -288825,7 +288987,9 @@ __export(dist_exports, {
288825
288987
  appendToLastTextPart: () => appendToLastTextPart,
288826
288988
  applyMicrocompact: () => applyMicrocompact,
288827
288989
  applyReplacement: () => applyReplacement,
288990
+ backgroundProgressEmitter: () => backgroundProgressEmitter,
288828
288991
  beginTurn: () => beginTurn,
288992
+ bridgeToProgressBus: () => bridgeToProgressBus,
288829
288993
  buildApiHistoryFromConversation: () => buildApiHistoryFromConversation,
288830
288994
  buildExtractionPrompt: () => buildExtractionPrompt,
288831
288995
  buildHumanReadableRuleLabel: () => buildHumanReadableRuleLabel,
@@ -289238,6 +289402,7 @@ __export(dist_exports, {
289238
289402
  validateVariables: () => validateVariables,
289239
289403
  waitForExtraction: () => waitForExtraction,
289240
289404
  windowsCodePageToEncoding: () => windowsCodePageToEncoding,
289405
+ withChunkTimeout: () => withChunkTimeout,
289241
289406
  write: () => write,
289242
289407
  writeLine: () => writeLine,
289243
289408
  writeLineSync: () => writeLineSync,
@@ -298955,14 +299120,14 @@ var require_react_reconciler_production = __commonJS({
298955
299120
  __name(markRetryLaneIfNotHydrated, "markRetryLaneIfNotHydrated");
298956
299121
  var exports3 = {};
298957
299122
  "use strict";
298958
- var React28 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = Symbol.for("react.provider"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
299123
+ var React29 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = Symbol.for("react.provider"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
298959
299124
  Symbol.for("react.scope");
298960
299125
  var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
298961
299126
  Symbol.for("react.legacy_hidden");
298962
299127
  Symbol.for("react.tracing_marker");
298963
299128
  var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
298964
299129
  Symbol.for("react.view_transition");
298965
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React28.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance2 = $$$config.createInstance;
299130
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React29.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance2 = $$$config.createInstance;
298966
299131
  $$$config.cloneMutableInstance;
298967
299132
  var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance;
298968
299133
  $$$config.cloneMutableTextInstance;
@@ -310178,14 +310343,14 @@ var require_react_reconciler_development = __commonJS({
310178
310343
  __name(getLaneLabelMap, "getLaneLabelMap");
310179
310344
  var exports3 = {};
310180
310345
  "use strict";
310181
- var React28 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = Symbol.for("react.provider"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
310346
+ var React29 = require_react(), Scheduler2 = require_scheduler(), assign = Object.assign, REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = Symbol.for("react.provider"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy");
310182
310347
  Symbol.for("react.scope");
310183
310348
  var REACT_ACTIVITY_TYPE = Symbol.for("react.activity");
310184
310349
  Symbol.for("react.legacy_hidden");
310185
310350
  Symbol.for("react.tracing_marker");
310186
310351
  var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel");
310187
310352
  Symbol.for("react.view_transition");
310188
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React28.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance2 = $$$config.createInstance;
310353
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), isArrayImpl = Array.isArray, ReactSharedInternals = React29.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, rendererVersion = $$$config.rendererVersion, rendererPackageName = $$$config.rendererPackageName, extraDevToolsConfig = $$$config.extraDevToolsConfig, getPublicInstance = $$$config.getPublicInstance, getRootHostContext = $$$config.getRootHostContext, getChildHostContext = $$$config.getChildHostContext, prepareForCommit = $$$config.prepareForCommit, resetAfterCommit = $$$config.resetAfterCommit, createInstance2 = $$$config.createInstance;
310189
310354
  $$$config.cloneMutableInstance;
310190
310355
  var appendInitialChild = $$$config.appendInitialChild, finalizeInitialChildren = $$$config.finalizeInitialChildren, shouldSetTextContent = $$$config.shouldSetTextContent, createTextInstance = $$$config.createTextInstance;
310191
310356
  $$$config.cloneMutableTextInstance;
@@ -315346,13 +315511,13 @@ var require_backend = __commonJS({
315346
315511
  return obj;
315347
315512
  }
315348
315513
  __name(_defineProperty2, "_defineProperty");
315349
- var EventEmitter12 = /* @__PURE__ */ function() {
315350
- function EventEmitter13() {
315351
- _classCallCheck(this, EventEmitter13);
315514
+ var EventEmitter13 = /* @__PURE__ */ function() {
315515
+ function EventEmitter14() {
315516
+ _classCallCheck(this, EventEmitter14);
315352
315517
  _defineProperty2(this, "listenersMap", /* @__PURE__ */ new Map());
315353
315518
  }
315354
- __name(EventEmitter13, "EventEmitter");
315355
- _createClass(EventEmitter13, [{
315519
+ __name(EventEmitter14, "EventEmitter");
315520
+ _createClass(EventEmitter14, [{
315356
315521
  key: "addListener",
315357
315522
  value: /* @__PURE__ */ __name(function addListener(event, listener) {
315358
315523
  var listeners = this.listenersMap.get(event);
@@ -315414,7 +315579,7 @@ var require_backend = __commonJS({
315414
315579
  }
315415
315580
  }, "removeListener")
315416
315581
  }]);
315417
- return EventEmitter13;
315582
+ return EventEmitter14;
315418
315583
  }();
315419
315584
  var lodash_throttle = __webpack_require__(172);
315420
315585
  var lodash_throttle_default = /* @__PURE__ */ __webpack_require__.n(lodash_throttle);
@@ -323138,7 +323303,7 @@ var require_backend = __commonJS({
323138
323303
  }, "get")
323139
323304
  }]);
323140
323305
  return Bridge2;
323141
- }(EventEmitter12);
323306
+ }(EventEmitter13);
323142
323307
  const src_bridge = Bridge;
323143
323308
  ;
323144
323309
  function agent_typeof(obj) {
@@ -323738,7 +323903,7 @@ var require_backend = __commonJS({
323738
323903
  }, "get")
323739
323904
  }]);
323740
323905
  return Agent5;
323741
- }(EventEmitter12);
323906
+ }(EventEmitter13);
323742
323907
  ;
323743
323908
  function hook_typeof(obj) {
323744
323909
  "@babel/helpers - typeof";
@@ -357445,8 +357610,8 @@ var require_dispatcher2 = __commonJS({
357445
357610
  "packages/cli/node_modules/undici/lib/dispatcher/dispatcher.js"(exports2, module2) {
357446
357611
  "use strict";
357447
357612
  init_esbuild_shims();
357448
- var EventEmitter12 = __require("node:events");
357449
- var Dispatcher = class extends EventEmitter12 {
357613
+ var EventEmitter13 = __require("node:events");
357614
+ var Dispatcher = class extends EventEmitter13 {
357450
357615
  static {
357451
357616
  __name(this, "Dispatcher");
357452
357617
  }
@@ -376483,18 +376648,18 @@ var require_react_jsx_runtime_development = __commonJS({
376483
376648
  return "object" === typeof object3 && null !== object3 && object3.$$typeof === REACT_ELEMENT_TYPE;
376484
376649
  }
376485
376650
  __name(isValidElement, "isValidElement");
376486
- var React28 = require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React28.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty2 = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
376651
+ var React29 = require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React29.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty2 = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
376487
376652
  return null;
376488
376653
  };
376489
- React28 = {
376654
+ React29 = {
376490
376655
  react_stack_bottom_frame: /* @__PURE__ */ __name(function(callStackForError) {
376491
376656
  return callStackForError();
376492
376657
  }, "react_stack_bottom_frame")
376493
376658
  };
376494
376659
  var specialPropKeyWarningShown;
376495
376660
  var didWarnAboutElementRef = {};
376496
- var unknownOwnerDebugStack = React28.react_stack_bottom_frame.bind(
376497
- React28,
376661
+ var unknownOwnerDebugStack = React29.react_stack_bottom_frame.bind(
376662
+ React29,
376498
376663
  UnknownOwner
376499
376664
  )();
376500
376665
  var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
@@ -401869,7 +402034,7 @@ var instances_default = instances;
401869
402034
  // node_modules/ink/build/components/App.js
401870
402035
  init_esbuild_shims();
401871
402036
  var import_react12 = __toESM(require_react(), 1);
401872
- import { EventEmitter as EventEmitter9 } from "node:events";
402037
+ import { EventEmitter as EventEmitter10 } from "node:events";
401873
402038
  import process16 from "node:process";
401874
402039
 
401875
402040
  // node_modules/ink/build/components/AppContext.js
@@ -401885,12 +402050,12 @@ var AppContext_default = AppContext;
401885
402050
  // node_modules/ink/build/components/StdinContext.js
401886
402051
  init_esbuild_shims();
401887
402052
  var import_react3 = __toESM(require_react(), 1);
401888
- import { EventEmitter as EventEmitter8 } from "node:events";
402053
+ import { EventEmitter as EventEmitter9 } from "node:events";
401889
402054
  import process13 from "node:process";
401890
402055
  var StdinContext = (0, import_react3.createContext)({
401891
402056
  stdin: process13.stdin,
401892
402057
  // eslint-disable-next-line @typescript-eslint/naming-convention
401893
- internal_eventEmitter: new EventEmitter8(),
402058
+ internal_eventEmitter: new EventEmitter9(),
401894
402059
  setRawMode() {
401895
402060
  },
401896
402061
  isRawModeSupported: false,
@@ -402215,7 +402380,7 @@ var App = class extends import_react12.PureComponent {
402215
402380
  // raw mode until all components don't need it anymore
402216
402381
  rawModeEnabledCount = 0;
402217
402382
  // eslint-disable-next-line @typescript-eslint/naming-convention
402218
- internal_eventEmitter = new EventEmitter9();
402383
+ internal_eventEmitter = new EventEmitter10();
402219
402384
  // Determines if TTY is supported on the provided stdin
402220
402385
  isRawModeSupported() {
402221
402386
  return this.props.stdin.isTTY;
@@ -402957,7 +403122,7 @@ var measureElement = /* @__PURE__ */ __name((node) => ({
402957
403122
  var measure_element_default = measureElement;
402958
403123
 
402959
403124
  // packages/cli/src/gemini.tsx
402960
- var import_react176 = __toESM(require_react(), 1);
403125
+ var import_react177 = __toESM(require_react(), 1);
402961
403126
  import dns2 from "node:dns";
402962
403127
  import os50 from "node:os";
402963
403128
  import { basename as basename31 } from "node:path";
@@ -414698,7 +414863,7 @@ __name(getPackageJson, "getPackageJson");
414698
414863
  // packages/cli/src/utils/version.ts
414699
414864
  async function getCliVersion() {
414700
414865
  const pkgJson = await getPackageJson();
414701
- return "0.25.4";
414866
+ return "0.25.5";
414702
414867
  }
414703
414868
  __name(getCliVersion, "getCliVersion");
414704
414869
 
@@ -414768,8 +414933,8 @@ __name(loadSandboxConfig, "loadSandboxConfig");
414768
414933
 
414769
414934
  // packages/cli/src/utils/events.ts
414770
414935
  init_esbuild_shims();
414771
- import { EventEmitter as EventEmitter10 } from "node:events";
414772
- var appEvents = new EventEmitter10();
414936
+ import { EventEmitter as EventEmitter11 } from "node:events";
414937
+ var appEvents = new EventEmitter11();
414773
414938
 
414774
414939
  // packages/cli/src/commands/mcp.ts
414775
414940
  init_esbuild_shims();
@@ -422470,7 +422635,7 @@ var formatDuration = /* @__PURE__ */ __name((milliseconds) => {
422470
422635
 
422471
422636
  // packages/cli/src/generated/git-commit.ts
422472
422637
  init_esbuild_shims();
422473
- var GIT_COMMIT_INFO = "5b2bb801f";
422638
+ var GIT_COMMIT_INFO = "b657765a7";
422474
422639
 
422475
422640
  // packages/cli/src/utils/systemInfo.ts
422476
422641
  async function getNpmVersion() {
@@ -436059,7 +436224,7 @@ __name(runNonInteractiveStreamJson, "runNonInteractiveStreamJson");
436059
436224
 
436060
436225
  // packages/cli/src/ui/AppContainer.tsx
436061
436226
  init_esbuild_shims();
436062
- var import_react173 = __toESM(require_react(), 1);
436227
+ var import_react174 = __toESM(require_react(), 1);
436063
436228
 
436064
436229
  // packages/cli/src/ui/App.tsx
436065
436230
  init_esbuild_shims();
@@ -473963,7 +474128,7 @@ var ScreenReaderAppLayout = /* @__PURE__ */ __name(() => {
473963
474128
 
473964
474129
  // packages/cli/src/ui/layouts/DefaultAppLayout.tsx
473965
474130
  init_esbuild_shims();
473966
- var import_react132 = __toESM(require_react(), 1);
474131
+ var import_react133 = __toESM(require_react(), 1);
473967
474132
 
473968
474133
  // packages/cli/src/ui/components/agent-view/AgentTabBar.tsx
473969
474134
  init_esbuild_shims();
@@ -474718,6 +474883,7 @@ var AgentComposer = /* @__PURE__ */ __name(({ agentId }) => {
474718
474883
 
474719
474884
  // packages/cli/src/ui/components/StatusBar.tsx
474720
474885
  init_esbuild_shims();
474886
+ var import_react132 = __toESM(require_react(), 1);
474721
474887
  import path130 from "node:path";
474722
474888
  import os38 from "node:os";
474723
474889
 
@@ -474831,21 +474997,92 @@ function useGitDiffStat(cwd6, intervalMs = 5e3) {
474831
474997
  }
474832
474998
  __name(useGitDiffStat, "useGitDiffStat");
474833
474999
 
474834
- // packages/cli/src/ui/hooks/useSessionMemoryStatus.ts
475000
+ // packages/cli/src/ui/hooks/useBackgroundAgentProgress.ts
474835
475001
  init_esbuild_shims();
474836
475002
  var import_react131 = __toESM(require_react(), 1);
474837
475003
  init_dist4();
474838
- function useSessionMemoryStatus() {
474839
- const [isExtracting, setIsExtracting] = (0, import_react131.useState)(false);
475004
+ function useBackgroundAgentProgress() {
475005
+ const [activeAgents, setActiveAgents] = (0, import_react131.useState)(/* @__PURE__ */ new Map());
475006
+ const [lastFinished, setLastFinished] = (0, import_react131.useState)(null);
474840
475007
  (0, import_react131.useEffect)(() => {
474841
- const tick = /* @__PURE__ */ __name(() => setIsExtracting(isExtractionInProgress()), "tick");
474842
- tick();
474843
- const id = setInterval(tick, 500);
474844
- return () => clearInterval(id);
475008
+ const onStarted = /* @__PURE__ */ __name((payload) => {
475009
+ setActiveAgents((prev) => {
475010
+ const next = new Map(prev);
475011
+ next.set(payload.agentId, {
475012
+ agentId: payload.agentId,
475013
+ agentName: payload.agentName,
475014
+ round: 0,
475015
+ startedAt: payload.timestamp
475016
+ });
475017
+ return next;
475018
+ });
475019
+ }, "onStarted");
475020
+ const onRound = /* @__PURE__ */ __name((payload) => {
475021
+ setActiveAgents((prev) => {
475022
+ const entry = prev.get(payload.agentId);
475023
+ if (!entry) return prev;
475024
+ const next = new Map(prev);
475025
+ next.set(payload.agentId, {
475026
+ ...entry,
475027
+ round: payload.round,
475028
+ toolName: void 0
475029
+ // clear tool name on new round
475030
+ });
475031
+ return next;
475032
+ });
475033
+ }, "onRound");
475034
+ const onToolCall = /* @__PURE__ */ __name((payload) => {
475035
+ setActiveAgents((prev) => {
475036
+ const entry = prev.get(payload.agentId);
475037
+ if (!entry) return prev;
475038
+ const next = new Map(prev);
475039
+ next.set(payload.agentId, { ...entry, toolName: payload.toolName });
475040
+ return next;
475041
+ });
475042
+ }, "onToolCall");
475043
+ const onFinished = /* @__PURE__ */ __name((payload) => {
475044
+ setActiveAgents((prev) => {
475045
+ const next = new Map(prev);
475046
+ next.delete(payload.agentId);
475047
+ return next;
475048
+ });
475049
+ setLastFinished({ ...payload, agentName: payload.agentName });
475050
+ }, "onFinished");
475051
+ const onFailed = /* @__PURE__ */ __name((payload) => {
475052
+ setActiveAgents((prev) => {
475053
+ const next = new Map(prev);
475054
+ next.delete(payload.agentId);
475055
+ return next;
475056
+ });
475057
+ setLastFinished({
475058
+ agentId: payload.agentId,
475059
+ agentName: payload.agentName,
475060
+ terminateReason: "error",
475061
+ hitLimit: false,
475062
+ rounds: 0,
475063
+ durationMs: 0,
475064
+ timestamp: payload.timestamp
475065
+ });
475066
+ }, "onFailed");
475067
+ backgroundProgressEmitter.on("agent_started", onStarted);
475068
+ backgroundProgressEmitter.on("agent_round", onRound);
475069
+ backgroundProgressEmitter.on("agent_tool_call", onToolCall);
475070
+ backgroundProgressEmitter.on("agent_finished", onFinished);
475071
+ backgroundProgressEmitter.on("agent_failed", onFailed);
475072
+ return () => {
475073
+ backgroundProgressEmitter.off("agent_started", onStarted);
475074
+ backgroundProgressEmitter.off("agent_round", onRound);
475075
+ backgroundProgressEmitter.off("agent_tool_call", onToolCall);
475076
+ backgroundProgressEmitter.off("agent_finished", onFinished);
475077
+ backgroundProgressEmitter.off("agent_failed", onFailed);
475078
+ };
474845
475079
  }, []);
474846
- return { isExtracting };
475080
+ return {
475081
+ activeAgents: Array.from(activeAgents.values()),
475082
+ lastFinished
475083
+ };
474847
475084
  }
474848
- __name(useSessionMemoryStatus, "useSessionMemoryStatus");
475085
+ __name(useBackgroundAgentProgress, "useBackgroundAgentProgress");
474849
475086
 
474850
475087
  // packages/cli/src/ui/components/StatusBar.tsx
474851
475088
  var import_jsx_runtime137 = __toESM(require_jsx_runtime(), 1);
@@ -474868,7 +475105,7 @@ __name(tildify, "tildify");
474868
475105
  var StatusBar = /* @__PURE__ */ __name(({ cwd: cwd6, terminalWidth }) => {
474869
475106
  const branch = useGitBranchName(cwd6);
474870
475107
  const diff4 = useGitDiffStat(cwd6);
474871
- const { isExtracting } = useSessionMemoryStatus();
475108
+ const { activeAgents } = useBackgroundAgentProgress();
474872
475109
  const cwdDisplay = tildify(path130.resolve(cwd6));
474873
475110
  const hasDiff = diff4 !== null && diff4.filesChanged > 0;
474874
475111
  return /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(
@@ -474886,10 +475123,13 @@ var StatusBar = /* @__PURE__ */ __name(({ cwd: cwd6, terminalWidth }) => {
474886
475123
  paddingX: 1,
474887
475124
  children: [
474888
475125
  /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(Text3, { color: theme.text.accent, bold: true, children: "\u27E1" }),
474889
- isExtracting && /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_jsx_runtime137.Fragment, { children: [
474890
- /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(Sep, {}),
474891
- /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(Badge, { children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(Text3, { color: theme.text.secondary, children: "\u21BA notes" }) })
474892
- ] }),
475126
+ activeAgents.map((agent) => {
475127
+ const label = agent.agentName === "session-memory" ? agent.toolName ? "\u21BA notes: writing" : `\u21BA notes: turn ${agent.round}` : agent.toolName ? `\u27F3 ${agent.agentName}: ${agent.toolName}` : `\u27F3 ${agent.agentName}: turn ${agent.round}`;
475128
+ return /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_react132.default.Fragment, { children: [
475129
+ /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(Sep, {}),
475130
+ /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(Badge, { children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(Text3, { color: theme.text.secondary, children: label }) })
475131
+ ] }, agent.agentId);
475132
+ }),
474893
475133
  hasDiff && /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_jsx_runtime137.Fragment, { children: [
474894
475134
  /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(Sep, {}),
474895
475135
  /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(Badge, { children: [
@@ -474935,8 +475175,8 @@ var DefaultAppLayout = /* @__PURE__ */ __name(() => {
474935
475175
  const config2 = useConfig();
474936
475176
  const hasAgents = agents.size > 0;
474937
475177
  const isAgentTab = activeView !== "main" && agents.has(activeView);
474938
- const prevViewRef = (0, import_react132.useRef)(activeView);
474939
- (0, import_react132.useEffect)(() => {
475178
+ const prevViewRef = (0, import_react133.useRef)(activeView);
475179
+ (0, import_react133.useEffect)(() => {
474940
475180
  if (prevViewRef.current !== activeView) {
474941
475181
  prevViewRef.current = activeView;
474942
475182
  refreshStatic();
@@ -474992,12 +475232,12 @@ import process47 from "node:process";
474992
475232
 
474993
475233
  // packages/cli/src/ui/hooks/useMemoryMonitor.ts
474994
475234
  init_esbuild_shims();
474995
- var import_react133 = __toESM(require_react(), 1);
475235
+ var import_react134 = __toESM(require_react(), 1);
474996
475236
  import process34 from "node:process";
474997
475237
  var MEMORY_WARNING_THRESHOLD = 7 * 1024 * 1024 * 1024;
474998
475238
  var MEMORY_CHECK_INTERVAL = 60 * 1e3;
474999
475239
  var useMemoryMonitor = /* @__PURE__ */ __name(({ addItem }) => {
475000
- (0, import_react133.useEffect)(() => {
475240
+ (0, import_react134.useEffect)(() => {
475001
475241
  const intervalId = setInterval(() => {
475002
475242
  const usage2 = process34.memoryUsage().rss;
475003
475243
  if (usage2 > MEMORY_WARNING_THRESHOLD) {
@@ -475017,11 +475257,11 @@ var useMemoryMonitor = /* @__PURE__ */ __name(({ addItem }) => {
475017
475257
 
475018
475258
  // packages/cli/src/ui/hooks/useThemeCommand.ts
475019
475259
  init_esbuild_shims();
475020
- var import_react134 = __toESM(require_react(), 1);
475260
+ var import_react135 = __toESM(require_react(), 1);
475021
475261
  import process35 from "node:process";
475022
475262
  var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, addItem, initialThemeError) => {
475023
- const [isThemeDialogOpen, setIsThemeDialogOpen] = (0, import_react134.useState)(!!initialThemeError);
475024
- const openThemeDialog = (0, import_react134.useCallback)(() => {
475263
+ const [isThemeDialogOpen, setIsThemeDialogOpen] = (0, import_react135.useState)(!!initialThemeError);
475264
+ const openThemeDialog = (0, import_react135.useCallback)(() => {
475025
475265
  if (process35.env["NO_COLOR"]) {
475026
475266
  addItem(
475027
475267
  {
@@ -475036,7 +475276,7 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
475036
475276
  }
475037
475277
  setIsThemeDialogOpen(true);
475038
475278
  }, [addItem]);
475039
- const applyTheme = (0, import_react134.useCallback)(
475279
+ const applyTheme = (0, import_react135.useCallback)(
475040
475280
  (themeName) => {
475041
475281
  if (!themeManager.setActiveTheme(themeName)) {
475042
475282
  setIsThemeDialogOpen(true);
@@ -475051,13 +475291,13 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
475051
475291
  },
475052
475292
  [setThemeError]
475053
475293
  );
475054
- const handleThemeHighlight = (0, import_react134.useCallback)(
475294
+ const handleThemeHighlight = (0, import_react135.useCallback)(
475055
475295
  (themeName) => {
475056
475296
  applyTheme(themeName);
475057
475297
  },
475058
475298
  [applyTheme]
475059
475299
  );
475060
- const handleThemeSelect = (0, import_react134.useCallback)(
475300
+ const handleThemeSelect = (0, import_react135.useCallback)(
475061
475301
  (themeName, scope) => {
475062
475302
  try {
475063
475303
  const mergedCustomThemes = {
@@ -475097,7 +475337,7 @@ var useThemeCommand = /* @__PURE__ */ __name((loadedSettings, setThemeError, add
475097
475337
 
475098
475338
  // packages/cli/src/ui/hooks/useFeedbackDialog.ts
475099
475339
  init_esbuild_shims();
475100
- var import_react135 = __toESM(require_react(), 1);
475340
+ var import_react136 = __toESM(require_react(), 1);
475101
475341
  init_dist4();
475102
475342
  import * as fs119 from "node:fs";
475103
475343
  var import_strip_json_comments3 = __toESM(require_strip_json_comments(), 1);
@@ -475143,20 +475383,20 @@ var useFeedbackDialog = /* @__PURE__ */ __name(({
475143
475383
  history,
475144
475384
  sessionStats
475145
475385
  }) => {
475146
- const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] = (0, import_react135.useState)(false);
475147
- const [isFeedbackDismissedTemporarily, setIsFeedbackDismissedTemporarily] = (0, import_react135.useState)(false);
475148
- const openFeedbackDialog = (0, import_react135.useCallback)(() => {
475386
+ const [isFeedbackDialogOpen, setIsFeedbackDialogOpen] = (0, import_react136.useState)(false);
475387
+ const [isFeedbackDismissedTemporarily, setIsFeedbackDismissedTemporarily] = (0, import_react136.useState)(false);
475388
+ const openFeedbackDialog = (0, import_react136.useCallback)(() => {
475149
475389
  setIsFeedbackDialogOpen(true);
475150
475390
  }, []);
475151
- const closeFeedbackDialog = (0, import_react135.useCallback)(
475391
+ const closeFeedbackDialog = (0, import_react136.useCallback)(
475152
475392
  () => setIsFeedbackDialogOpen(false),
475153
475393
  []
475154
475394
  );
475155
- const temporaryCloseFeedbackDialog = (0, import_react135.useCallback)(() => {
475395
+ const temporaryCloseFeedbackDialog = (0, import_react136.useCallback)(() => {
475156
475396
  setIsFeedbackDialogOpen(false);
475157
475397
  setIsFeedbackDismissedTemporarily(true);
475158
475398
  }, []);
475159
- const submitFeedback = (0, import_react135.useCallback)(
475399
+ const submitFeedback = (0, import_react136.useCallback)(
475160
475400
  (rating) => {
475161
475401
  if (rating >= FEEDBACK_OPTIONS.GOOD && rating <= FEEDBACK_OPTIONS.FINE) {
475162
475402
  const feedbackEvent = new UserFeedbackEvent(
@@ -475176,7 +475416,7 @@ var useFeedbackDialog = /* @__PURE__ */ __name(({
475176
475416
  },
475177
475417
  [closeFeedbackDialog, sessionStats.sessionId, config2, settings2]
475178
475418
  );
475179
- (0, import_react135.useEffect)(() => {
475419
+ (0, import_react136.useEffect)(() => {
475180
475420
  const checkAndShowFeedback = /* @__PURE__ */ __name(() => {
475181
475421
  if (streamingState === "idle" /* Idle */ && history.length > 0) {
475182
475422
  if (!config2.getUsageStatisticsEnabled() || settings2.merged.ui?.enableUserFeedback === false || !lastMessageIsAIResponse(history) || Math.random() > FEEDBACK_SHOW_PROBABILITY || !meetsMinimumSessionRequirements(sessionStats) || isFeedbackDismissedTemporarily) {
@@ -475198,7 +475438,7 @@ var useFeedbackDialog = /* @__PURE__ */ __name(({
475198
475438
  settings2.merged.ui?.enableUserFeedback,
475199
475439
  config2
475200
475440
  ]);
475201
- (0, import_react135.useEffect)(() => {
475441
+ (0, import_react136.useEffect)(() => {
475202
475442
  if (streamingState === "responding" /* Responding */ && isFeedbackDismissedTemporarily) {
475203
475443
  setIsFeedbackDismissedTemporarily(false);
475204
475444
  }
@@ -475215,19 +475455,19 @@ var useFeedbackDialog = /* @__PURE__ */ __name(({
475215
475455
  // packages/cli/src/ui/auth/useAuth.ts
475216
475456
  init_esbuild_shims();
475217
475457
  init_dist4();
475218
- var import_react136 = __toESM(require_react(), 1);
475458
+ var import_react137 = __toESM(require_react(), 1);
475219
475459
  var useAuthCommand = /* @__PURE__ */ __name((settings2, config2, addItem, onAuthChange) => {
475220
475460
  const unAuthenticated = config2.getAuthType() === void 0;
475221
- const [authState, setAuthState] = (0, import_react136.useState)(
475461
+ const [authState, setAuthState] = (0, import_react137.useState)(
475222
475462
  unAuthenticated ? "updating" /* Updating */ : "unauthenticated" /* Unauthenticated */
475223
475463
  );
475224
- const [authError, setAuthError] = (0, import_react136.useState)(null);
475225
- const [isAuthenticating, setIsAuthenticating] = (0, import_react136.useState)(false);
475226
- const [isAuthDialogOpen, setIsAuthDialogOpen] = (0, import_react136.useState)(unAuthenticated);
475227
- const [pendingAuthType, setPendingAuthType] = (0, import_react136.useState)(
475464
+ const [authError, setAuthError] = (0, import_react137.useState)(null);
475465
+ const [isAuthenticating, setIsAuthenticating] = (0, import_react137.useState)(false);
475466
+ const [isAuthDialogOpen, setIsAuthDialogOpen] = (0, import_react137.useState)(unAuthenticated);
475467
+ const [pendingAuthType, setPendingAuthType] = (0, import_react137.useState)(
475228
475468
  void 0
475229
475469
  );
475230
- const onAuthError = (0, import_react136.useCallback)(
475470
+ const onAuthError = (0, import_react137.useCallback)(
475231
475471
  (error40) => {
475232
475472
  setAuthError(error40);
475233
475473
  if (error40) {
@@ -475237,7 +475477,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings2, config2, addItem, onAuth
475237
475477
  },
475238
475478
  [setAuthError, setAuthState]
475239
475479
  );
475240
- const handleAuthFailure = (0, import_react136.useCallback)(
475480
+ const handleAuthFailure = (0, import_react137.useCallback)(
475241
475481
  (error40) => {
475242
475482
  setIsAuthenticating(false);
475243
475483
  const errorMessage = t4("Failed to authenticate. Message: {{message}}", {
@@ -475256,7 +475496,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings2, config2, addItem, onAuth
475256
475496
  },
475257
475497
  [onAuthError, pendingAuthType, config2]
475258
475498
  );
475259
- const handleAuthSuccess = (0, import_react136.useCallback)(
475499
+ const handleAuthSuccess = (0, import_react137.useCallback)(
475260
475500
  async (authType, credentials) => {
475261
475501
  try {
475262
475502
  const authTypeScope = getPersistScopeForModelSelection(settings2);
@@ -475313,7 +475553,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings2, config2, addItem, onAuth
475313
475553
  },
475314
475554
  [settings2, handleAuthFailure, config2, addItem, onAuthChange]
475315
475555
  );
475316
- const performAuth = (0, import_react136.useCallback)(
475556
+ const performAuth = (0, import_react137.useCallback)(
475317
475557
  async (authType, credentials) => {
475318
475558
  try {
475319
475559
  await config2.refreshAuth(authType);
@@ -475324,7 +475564,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings2, config2, addItem, onAuth
475324
475564
  },
475325
475565
  [config2, handleAuthSuccess, handleAuthFailure]
475326
475566
  );
475327
- const isProviderManagedModel = (0, import_react136.useCallback)(
475567
+ const isProviderManagedModel = (0, import_react137.useCallback)(
475328
475568
  (authType, modelId) => {
475329
475569
  if (!modelId) {
475330
475570
  return false;
@@ -475343,7 +475583,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings2, config2, addItem, onAuth
475343
475583
  },
475344
475584
  [settings2]
475345
475585
  );
475346
- const handleAuthSelect = (0, import_react136.useCallback)(
475586
+ const handleAuthSelect = (0, import_react137.useCallback)(
475347
475587
  async (authType, credentials) => {
475348
475588
  if (!authType) {
475349
475589
  setIsAuthDialogOpen(false);
@@ -475388,10 +475628,10 @@ var useAuthCommand = /* @__PURE__ */ __name((settings2, config2, addItem, onAuth
475388
475628
  settings2.merged.model?.generationConfig
475389
475629
  ]
475390
475630
  );
475391
- const openAuthDialog = (0, import_react136.useCallback)(() => {
475631
+ const openAuthDialog = (0, import_react137.useCallback)(() => {
475392
475632
  setIsAuthDialogOpen(true);
475393
475633
  }, []);
475394
- const cancelAuthentication = (0, import_react136.useCallback)(() => {
475634
+ const cancelAuthentication = (0, import_react137.useCallback)(() => {
475395
475635
  if (isAuthenticating && pendingAuthType) {
475396
475636
  const authEvent = new AuthEvent(pendingAuthType, "manual", "cancelled");
475397
475637
  logAuth(config2, authEvent);
@@ -475400,7 +475640,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings2, config2, addItem, onAuth
475400
475640
  setIsAuthDialogOpen(true);
475401
475641
  setAuthError(null);
475402
475642
  }, [isAuthenticating, pendingAuthType, config2]);
475403
- const handleCodingPlanSubmit = (0, import_react136.useCallback)(
475643
+ const handleCodingPlanSubmit = (0, import_react137.useCallback)(
475404
475644
  async (apiKey, region = "china" /* CHINA */) => {
475405
475645
  try {
475406
475646
  setIsAuthenticating(true);
@@ -475479,7 +475719,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings2, config2, addItem, onAuth
475479
475719
  },
475480
475720
  [settings2, config2, handleAuthFailure, addItem, onAuthChange]
475481
475721
  );
475482
- const handleAlibabaStandardSubmit = (0, import_react136.useCallback)(
475722
+ const handleAlibabaStandardSubmit = (0, import_react137.useCallback)(
475483
475723
  async (apiKey, region, modelIdsInput) => {
475484
475724
  try {
475485
475725
  setIsAuthenticating(true);
@@ -475571,7 +475811,7 @@ var useAuthCommand = /* @__PURE__ */ __name((settings2, config2, addItem, onAuth
475571
475811
  },
475572
475812
  [settings2, config2, handleAuthFailure, addItem, onAuthChange]
475573
475813
  );
475574
- (0, import_react136.useEffect)(() => {
475814
+ (0, import_react137.useEffect)(() => {
475575
475815
  const defaultAuthType = process.env["QWEN_DEFAULT_AUTH_TYPE"];
475576
475816
  if (defaultAuthType && ![
475577
475817
  AuthType2.USE_OPENAI,
@@ -475613,14 +475853,14 @@ var useAuthCommand = /* @__PURE__ */ __name((settings2, config2, addItem, onAuth
475613
475853
 
475614
475854
  // packages/cli/src/ui/hooks/useEditorSettings.ts
475615
475855
  init_esbuild_shims();
475616
- var import_react137 = __toESM(require_react(), 1);
475856
+ var import_react138 = __toESM(require_react(), 1);
475617
475857
  init_dist4();
475618
475858
  var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError, addItem) => {
475619
- const [isEditorDialogOpen, setIsEditorDialogOpen] = (0, import_react137.useState)(false);
475620
- const openEditorDialog = (0, import_react137.useCallback)(() => {
475859
+ const [isEditorDialogOpen, setIsEditorDialogOpen] = (0, import_react138.useState)(false);
475860
+ const openEditorDialog = (0, import_react138.useCallback)(() => {
475621
475861
  setIsEditorDialogOpen(true);
475622
475862
  }, []);
475623
- const handleEditorSelect = (0, import_react137.useCallback)(
475863
+ const handleEditorSelect = (0, import_react138.useCallback)(
475624
475864
  (editorType, scope) => {
475625
475865
  if (editorType && (!checkHasEditorType(editorType) || !allowEditorTypeInSandbox(editorType))) {
475626
475866
  return;
@@ -475642,7 +475882,7 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
475642
475882
  },
475643
475883
  [loadedSettings, setEditorError, addItem]
475644
475884
  );
475645
- const exitEditorDialog = (0, import_react137.useCallback)(() => {
475885
+ const exitEditorDialog = (0, import_react138.useCallback)(() => {
475646
475886
  setIsEditorDialogOpen(false);
475647
475887
  }, []);
475648
475888
  return {
@@ -475655,13 +475895,13 @@ var useEditorSettings = /* @__PURE__ */ __name((loadedSettings, setEditorError,
475655
475895
 
475656
475896
  // packages/cli/src/ui/hooks/useSettingsCommand.ts
475657
475897
  init_esbuild_shims();
475658
- var import_react138 = __toESM(require_react(), 1);
475898
+ var import_react139 = __toESM(require_react(), 1);
475659
475899
  function useSettingsCommand() {
475660
- const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0, import_react138.useState)(false);
475661
- const openSettingsDialog = (0, import_react138.useCallback)(() => {
475900
+ const [isSettingsDialogOpen, setIsSettingsDialogOpen] = (0, import_react139.useState)(false);
475901
+ const openSettingsDialog = (0, import_react139.useCallback)(() => {
475662
475902
  setIsSettingsDialogOpen(true);
475663
475903
  }, []);
475664
- const closeSettingsDialog = (0, import_react138.useCallback)(() => {
475904
+ const closeSettingsDialog = (0, import_react139.useCallback)(() => {
475665
475905
  setIsSettingsDialogOpen(false);
475666
475906
  }, []);
475667
475907
  return {
@@ -475674,18 +475914,18 @@ __name(useSettingsCommand, "useSettingsCommand");
475674
475914
 
475675
475915
  // packages/cli/src/ui/hooks/useModelCommand.ts
475676
475916
  init_esbuild_shims();
475677
- var import_react139 = __toESM(require_react(), 1);
475917
+ var import_react140 = __toESM(require_react(), 1);
475678
475918
  var useModelCommand = /* @__PURE__ */ __name(() => {
475679
- const [isModelDialogOpen, setIsModelDialogOpen] = (0, import_react139.useState)(false);
475680
- const [isFastModelMode, setIsFastModelMode] = (0, import_react139.useState)(false);
475681
- const openModelDialog = (0, import_react139.useCallback)(
475919
+ const [isModelDialogOpen, setIsModelDialogOpen] = (0, import_react140.useState)(false);
475920
+ const [isFastModelMode, setIsFastModelMode] = (0, import_react140.useState)(false);
475921
+ const openModelDialog = (0, import_react140.useCallback)(
475682
475922
  (options2) => {
475683
475923
  setIsFastModelMode(options2?.fastModelMode ?? false);
475684
475924
  setIsModelDialogOpen(true);
475685
475925
  },
475686
475926
  []
475687
475927
  );
475688
- const closeModelDialog = (0, import_react139.useCallback)(() => {
475928
+ const closeModelDialog = (0, import_react140.useCallback)(() => {
475689
475929
  setIsModelDialogOpen(false);
475690
475930
  setIsFastModelMode(false);
475691
475931
  }, []);
@@ -475699,13 +475939,13 @@ var useModelCommand = /* @__PURE__ */ __name(() => {
475699
475939
 
475700
475940
  // packages/cli/src/ui/hooks/useApprovalModeCommand.ts
475701
475941
  init_esbuild_shims();
475702
- var import_react140 = __toESM(require_react(), 1);
475942
+ var import_react141 = __toESM(require_react(), 1);
475703
475943
  var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config2) => {
475704
- const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0, import_react140.useState)(false);
475705
- const openApprovalModeDialog = (0, import_react140.useCallback)(() => {
475944
+ const [isApprovalModeDialogOpen, setIsApprovalModeDialogOpen] = (0, import_react141.useState)(false);
475945
+ const openApprovalModeDialog = (0, import_react141.useCallback)(() => {
475706
475946
  setIsApprovalModeDialogOpen(true);
475707
475947
  }, []);
475708
- const handleApprovalModeSelect = (0, import_react140.useCallback)(
475948
+ const handleApprovalModeSelect = (0, import_react141.useCallback)(
475709
475949
  (mode, scope) => {
475710
475950
  try {
475711
475951
  if (!mode) {
@@ -475731,7 +475971,7 @@ var useApprovalModeCommand = /* @__PURE__ */ __name((loadedSettings, config2) =>
475731
475971
 
475732
475972
  // packages/cli/src/ui/hooks/useResumeCommand.ts
475733
475973
  init_esbuild_shims();
475734
- var import_react141 = __toESM(require_react(), 1);
475974
+ var import_react142 = __toESM(require_react(), 1);
475735
475975
  init_dist4();
475736
475976
 
475737
475977
  // packages/cli/src/ui/utils/resumeHistoryUtils.ts
@@ -476033,15 +476273,15 @@ __name(buildResumedHistoryItems, "buildResumedHistoryItems");
476033
476273
 
476034
476274
  // packages/cli/src/ui/hooks/useResumeCommand.ts
476035
476275
  function useResumeCommand(options2) {
476036
- const [isResumeDialogOpen, setIsResumeDialogOpen] = (0, import_react141.useState)(false);
476037
- const openResumeDialog = (0, import_react141.useCallback)(() => {
476276
+ const [isResumeDialogOpen, setIsResumeDialogOpen] = (0, import_react142.useState)(false);
476277
+ const openResumeDialog = (0, import_react142.useCallback)(() => {
476038
476278
  setIsResumeDialogOpen(true);
476039
476279
  }, []);
476040
- const closeResumeDialog = (0, import_react141.useCallback)(() => {
476280
+ const closeResumeDialog = (0, import_react142.useCallback)(() => {
476041
476281
  setIsResumeDialogOpen(false);
476042
476282
  }, []);
476043
476283
  const { config: config2, historyManager, startNewSession, remount } = options2 ?? {};
476044
- const handleResume = (0, import_react141.useCallback)(
476284
+ const handleResume = (0, import_react142.useCallback)(
476045
476285
  async (sessionId) => {
476046
476286
  if (!config2 || !historyManager || !startNewSession) {
476047
476287
  return;
@@ -476083,7 +476323,7 @@ __name(useResumeCommand, "useResumeCommand");
476083
476323
 
476084
476324
  // packages/cli/src/ui/hooks/slashCommandProcessor.ts
476085
476325
  init_esbuild_shims();
476086
- var import_react142 = __toESM(require_react(), 1);
476326
+ var import_react143 = __toESM(require_react(), 1);
476087
476327
 
476088
476328
  // packages/cli/node_modules/@google/genai/dist/node/index.mjs
476089
476329
  init_esbuild_shims();
@@ -476798,34 +477038,34 @@ var SLASH_COMMANDS_SKIP_RECORDING = /* @__PURE__ */ new Set([
476798
477038
  ]);
476799
477039
  var useSlashCommandProcessor = /* @__PURE__ */ __name((config2, settings2, addItem, clearItems, loadHistory, history, refreshStatic, toggleVimEnabled, isProcessing, setIsProcessing, setGeminiMdFileCount, actions, extensionsUpdateState, isConfigInitialized, logger9) => {
476800
477040
  const { stats: sessionStats, startNewSession } = useSessionStats();
476801
- const [commands, setCommands] = (0, import_react142.useState)([]);
476802
- const [reloadTrigger, setReloadTrigger] = (0, import_react142.useState)(0);
476803
- const reloadCommands = (0, import_react142.useCallback)(() => {
477041
+ const [commands, setCommands] = (0, import_react143.useState)([]);
477042
+ const [reloadTrigger, setReloadTrigger] = (0, import_react143.useState)(0);
477043
+ const reloadCommands = (0, import_react143.useCallback)(() => {
476804
477044
  setReloadTrigger((v2) => v2 + 1);
476805
477045
  }, []);
476806
- const [shellConfirmationRequest, setShellConfirmationRequest] = (0, import_react142.useState)(null);
476807
- const [confirmationRequest, setConfirmationRequest] = (0, import_react142.useState)(null);
476808
- const [sessionShellAllowlist, setSessionShellAllowlist] = (0, import_react142.useState)(
477046
+ const [shellConfirmationRequest, setShellConfirmationRequest] = (0, import_react143.useState)(null);
477047
+ const [confirmationRequest, setConfirmationRequest] = (0, import_react143.useState)(null);
477048
+ const [sessionShellAllowlist, setSessionShellAllowlist] = (0, import_react143.useState)(
476809
477049
  /* @__PURE__ */ new Set()
476810
477050
  );
476811
- const gitService = (0, import_react142.useMemo)(() => {
477051
+ const gitService = (0, import_react143.useMemo)(() => {
476812
477052
  if (!config2?.getProjectRoot()) {
476813
477053
  return;
476814
477054
  }
476815
477055
  return new GitService(config2.getProjectRoot(), config2.storage);
476816
477056
  }, [config2]);
476817
- const [pendingItem, setPendingItem] = (0, import_react142.useState)(
477057
+ const [pendingItem, setPendingItem] = (0, import_react143.useState)(
476818
477058
  null
476819
477059
  );
476820
- const [btwItem, setBtwItem] = (0, import_react142.useState)(null);
476821
- const btwAbortControllerRef = (0, import_react142.useRef)(null);
476822
- const cancelBtw = (0, import_react142.useCallback)(() => {
477060
+ const [btwItem, setBtwItem] = (0, import_react143.useState)(null);
477061
+ const btwAbortControllerRef = (0, import_react143.useRef)(null);
477062
+ const cancelBtw = (0, import_react143.useCallback)(() => {
476823
477063
  btwAbortControllerRef.current?.abort();
476824
477064
  btwAbortControllerRef.current = null;
476825
477065
  setBtwItem(null);
476826
477066
  }, []);
476827
- const abortControllerRef = (0, import_react142.useRef)(null);
476828
- const cancelSlashCommand = (0, import_react142.useCallback)(() => {
477067
+ const abortControllerRef = (0, import_react143.useRef)(null);
477068
+ const cancelSlashCommand = (0, import_react143.useCallback)(() => {
476829
477069
  cancelBtw();
476830
477070
  if (!abortControllerRef.current) {
476831
477071
  return;
@@ -476849,14 +477089,14 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config2, settings2, addIt
476849
477089
  },
476850
477090
  { isActive: isProcessing }
476851
477091
  );
476852
- const pendingHistoryItems = (0, import_react142.useMemo)(() => {
477092
+ const pendingHistoryItems = (0, import_react143.useMemo)(() => {
476853
477093
  const items = [];
476854
477094
  if (pendingItem != null) {
476855
477095
  items.push(pendingItem);
476856
477096
  }
476857
477097
  return items;
476858
477098
  }, [pendingItem]);
476859
- const addMessage = (0, import_react142.useCallback)(
477099
+ const addMessage = (0, import_react143.useCallback)(
476860
477100
  (message) => {
476861
477101
  let historyItemContent;
476862
477102
  if (message.type === "about" /* ABOUT */) {
@@ -476912,7 +477152,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config2, settings2, addIt
476912
477152
  },
476913
477153
  [addItem]
476914
477154
  );
476915
- const commandContext = (0, import_react142.useMemo)(
477155
+ const commandContext = (0, import_react143.useMemo)(
476916
477156
  () => ({
476917
477157
  services: {
476918
477158
  config: config2,
@@ -476974,7 +477214,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config2, settings2, addIt
476974
477214
  extensionsUpdateState
476975
477215
  ]
476976
477216
  );
476977
- (0, import_react142.useEffect)(() => {
477217
+ (0, import_react143.useEffect)(() => {
476978
477218
  if (!config2) {
476979
477219
  return;
476980
477220
  }
@@ -476992,7 +477232,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config2, settings2, addIt
476992
477232
  })();
476993
477233
  };
476994
477234
  }, [config2, reloadCommands]);
476995
- (0, import_react142.useEffect)(() => {
477235
+ (0, import_react143.useEffect)(() => {
476996
477236
  const controller = new AbortController();
476997
477237
  const load = /* @__PURE__ */ __name(async () => {
476998
477238
  const loaders = [
@@ -477012,7 +477252,7 @@ var useSlashCommandProcessor = /* @__PURE__ */ __name((config2, settings2, addIt
477012
477252
  controller.abort();
477013
477253
  };
477014
477254
  }, [config2, reloadTrigger, isConfigInitialized]);
477015
- const handleSlashCommand2 = (0, import_react142.useCallback)(
477255
+ const handleSlashCommand2 = (0, import_react143.useCallback)(
477016
477256
  async (rawQuery, oneTimeShellAllowlist, overwriteConfirmed) => {
477017
477257
  if (typeof rawQuery !== "string") {
477018
477258
  return false;
@@ -477369,11 +477609,11 @@ import * as fs130 from "node:fs";
477369
477609
 
477370
477610
  // packages/cli/src/ui/hooks/useLogger.ts
477371
477611
  init_esbuild_shims();
477372
- var import_react143 = __toESM(require_react(), 1);
477612
+ var import_react144 = __toESM(require_react(), 1);
477373
477613
  init_dist4();
477374
477614
  var useLogger = /* @__PURE__ */ __name((storage, sessionId) => {
477375
- const [logger9, setLogger] = (0, import_react143.useState)(null);
477376
- (0, import_react143.useEffect)(() => {
477615
+ const [logger9, setLogger] = (0, import_react144.useState)(null);
477616
+ (0, import_react144.useEffect)(() => {
477377
477617
  if (!sessionId) {
477378
477618
  return;
477379
477619
  }
@@ -477388,12 +477628,12 @@ var useLogger = /* @__PURE__ */ __name((storage, sessionId) => {
477388
477628
 
477389
477629
  // packages/cli/src/ui/hooks/useGeminiStream.ts
477390
477630
  init_esbuild_shims();
477391
- var import_react147 = __toESM(require_react(), 1);
477631
+ var import_react148 = __toESM(require_react(), 1);
477392
477632
  init_dist4();
477393
477633
 
477394
477634
  // packages/cli/src/ui/hooks/shellCommandProcessor.ts
477395
477635
  init_esbuild_shims();
477396
- var import_react144 = __toESM(require_react(), 1);
477636
+ var import_react145 = __toESM(require_react(), 1);
477397
477637
  init_dist4();
477398
477638
  import crypto14 from "node:crypto";
477399
477639
  import path132 from "node:path";
@@ -477423,8 +477663,8 @@ ${modelContent}
477423
477663
  }
477424
477664
  __name(addShellCommandToGeminiHistory, "addShellCommandToGeminiHistory");
477425
477665
  var useShellCommandProcessor = /* @__PURE__ */ __name((addItemToHistory, setPendingHistoryItem, onExec, onDebugMessage, config2, geminiClient, setShellInputFocused, terminalWidth, terminalHeight) => {
477426
- const [activeShellPtyId, setActiveShellPtyId] = (0, import_react144.useState)(null);
477427
- const handleShellCommand = (0, import_react144.useCallback)(
477666
+ const [activeShellPtyId, setActiveShellPtyId] = (0, import_react145.useState)(null);
477667
+ const handleShellCommand = (0, import_react145.useCallback)(
477428
477668
  (rawQuery, abortSignal) => {
477429
477669
  if (typeof rawQuery !== "string" || rawQuery.trim() === "") {
477430
477670
  return false;
@@ -477731,11 +477971,11 @@ var findLastSafeSplitPoint = /* @__PURE__ */ __name((content) => {
477731
477971
 
477732
477972
  // packages/cli/src/ui/hooks/useStateAndRef.ts
477733
477973
  init_esbuild_shims();
477734
- var import_react145 = __toESM(require_react(), 1);
477974
+ var import_react146 = __toESM(require_react(), 1);
477735
477975
  var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
477736
- const [state, setState] = import_react145.default.useState(initialValue);
477737
- const ref = import_react145.default.useRef(initialValue);
477738
- const setStateInternal = import_react145.default.useCallback(
477976
+ const [state, setState] = import_react146.default.useState(initialValue);
477977
+ const ref = import_react146.default.useRef(initialValue);
477978
+ const setStateInternal = import_react146.default.useCallback(
477739
477979
  (newStateOrCallback) => {
477740
477980
  let newValue;
477741
477981
  if (typeof newStateOrCallback === "function") {
@@ -477754,11 +477994,11 @@ var useStateAndRef = /* @__PURE__ */ __name((initialValue) => {
477754
477994
  // packages/cli/src/ui/hooks/useReactToolScheduler.ts
477755
477995
  init_esbuild_shims();
477756
477996
  init_dist4();
477757
- var import_react146 = __toESM(require_react(), 1);
477997
+ var import_react147 = __toESM(require_react(), 1);
477758
477998
  var debugLogger145 = createDebugLogger("REACT_TOOL_SCHEDULER");
477759
477999
  function useReactToolScheduler(onComplete, config2, getPreferredEditor, onEditorClose) {
477760
- const [toolCallsForDisplay, setToolCallsForDisplay] = (0, import_react146.useState)([]);
477761
- const outputUpdateHandler = (0, import_react146.useCallback)(
478000
+ const [toolCallsForDisplay, setToolCallsForDisplay] = (0, import_react147.useState)([]);
478001
+ const outputUpdateHandler = (0, import_react147.useCallback)(
477762
478002
  (toolCallId, outputChunk) => {
477763
478003
  setToolCallsForDisplay(
477764
478004
  (prevCalls) => prevCalls.map((tc) => {
@@ -477772,13 +478012,13 @@ function useReactToolScheduler(onComplete, config2, getPreferredEditor, onEditor
477772
478012
  },
477773
478013
  []
477774
478014
  );
477775
- const allToolCallsCompleteHandler = (0, import_react146.useCallback)(
478015
+ const allToolCallsCompleteHandler = (0, import_react147.useCallback)(
477776
478016
  async (completedToolCalls) => {
477777
478017
  await onComplete(completedToolCalls);
477778
478018
  },
477779
478019
  [onComplete]
477780
478020
  );
477781
- const toolCallsUpdateHandler = (0, import_react146.useCallback)(
478021
+ const toolCallsUpdateHandler = (0, import_react147.useCallback)(
477782
478022
  (updatedCoreToolCalls) => {
477783
478023
  setToolCallsForDisplay(
477784
478024
  (prevTrackedCalls) => updatedCoreToolCalls.map((coreTc) => {
@@ -477805,7 +478045,7 @@ function useReactToolScheduler(onComplete, config2, getPreferredEditor, onEditor
477805
478045
  },
477806
478046
  [setToolCallsForDisplay]
477807
478047
  );
477808
- const scheduler = (0, import_react146.useMemo)(
478048
+ const scheduler = (0, import_react147.useMemo)(
477809
478049
  () => new CoreToolScheduler({
477810
478050
  config: config2,
477811
478051
  chatRecordingService: config2.getChatRecordingService(),
@@ -477824,13 +478064,13 @@ function useReactToolScheduler(onComplete, config2, getPreferredEditor, onEditor
477824
478064
  onEditorClose
477825
478065
  ]
477826
478066
  );
477827
- const schedule = (0, import_react146.useCallback)(
478067
+ const schedule = (0, import_react147.useCallback)(
477828
478068
  (request4, signal) => {
477829
478069
  void scheduler.schedule(request4, signal);
477830
478070
  },
477831
478071
  [scheduler]
477832
478072
  );
477833
- const markToolsAsSubmitted = (0, import_react146.useCallback)(
478073
+ const markToolsAsSubmitted = (0, import_react147.useCallback)(
477834
478074
  (callIdsToMark) => {
477835
478075
  setToolCallsForDisplay(
477836
478076
  (prevCalls) => prevCalls.map(
@@ -478052,15 +478292,15 @@ function showCitations(settings2) {
478052
478292
  }
478053
478293
  __name(showCitations, "showCitations");
478054
478294
  var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, config2, settings2, onDebugMessage, handleSlashCommand2, shellModeActive, getPreferredEditor, onAuthError, performMemoryRefresh, modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError, onEditorClose, onCancelSubmit, setShellInputFocused, terminalWidth, terminalHeight, drainQueuedMessages) => {
478055
- const [initError, setInitError] = (0, import_react147.useState)(null);
478056
- const abortControllerRef = (0, import_react147.useRef)(null);
478057
- const turnCancelledRef = (0, import_react147.useRef)(false);
478058
- const queryGuardRef = (0, import_react147.useRef)(new QueryGuard());
478059
- const lastPromptRef = (0, import_react147.useRef)(null);
478060
- const lastPromptErroredRef = (0, import_react147.useRef)(false);
478061
- const [isResponding, setIsResponding] = (0, import_react147.useState)(false);
478062
- const pendingCompletedToolsRef = (0, import_react147.useRef)([]);
478063
- const [thought, setThought] = (0, import_react147.useState)(null);
478295
+ const [initError, setInitError] = (0, import_react148.useState)(null);
478296
+ const abortControllerRef = (0, import_react148.useRef)(null);
478297
+ const turnCancelledRef = (0, import_react148.useRef)(false);
478298
+ const queryGuardRef = (0, import_react148.useRef)(new QueryGuard());
478299
+ const lastPromptRef = (0, import_react148.useRef)(null);
478300
+ const lastPromptErroredRef = (0, import_react148.useRef)(false);
478301
+ const [isResponding, setIsResponding] = (0, import_react148.useState)(false);
478302
+ const pendingCompletedToolsRef = (0, import_react148.useRef)([]);
478303
+ const [thought, setThought] = (0, import_react148.useState)(null);
478064
478304
  const [pendingHistoryItem, pendingHistoryItemRef, setPendingHistoryItem] = useStateAndRef(null);
478065
478305
  const [
478066
478306
  pendingRetryErrorItem,
@@ -478072,10 +478312,10 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478072
478312
  pendingRetryCountdownItemRef,
478073
478313
  setPendingRetryCountdownItem
478074
478314
  ] = useStateAndRef(null);
478075
- const retryCountdownTimerRef = (0, import_react147.useRef)(
478315
+ const retryCountdownTimerRef = (0, import_react148.useRef)(
478076
478316
  null
478077
478317
  );
478078
- const processedMemoryToolsRef = (0, import_react147.useRef)(/* @__PURE__ */ new Set());
478318
+ const processedMemoryToolsRef = (0, import_react148.useRef)(/* @__PURE__ */ new Set());
478079
478319
  const {
478080
478320
  startNewPrompt,
478081
478321
  getPromptCount,
@@ -478083,16 +478323,16 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478083
478323
  } = useSessionStats();
478084
478324
  const storage = config2.storage;
478085
478325
  const logger9 = useLogger(storage, sessionStates.sessionId);
478086
- const gitService = (0, import_react147.useMemo)(() => {
478326
+ const gitService = (0, import_react148.useMemo)(() => {
478087
478327
  if (!config2.getProjectRoot()) {
478088
478328
  return;
478089
478329
  }
478090
478330
  return new GitService(config2.getProjectRoot(), storage);
478091
478331
  }, [config2, storage]);
478092
- const addItemRef = (0, import_react147.useRef)(addItem);
478332
+ const addItemRef = (0, import_react148.useRef)(addItem);
478093
478333
  addItemRef.current = addItem;
478094
- const onCompleteFnRef = (0, import_react147.useRef)(void 0);
478095
- const stableOnComplete = (0, import_react147.useCallback)(
478334
+ const onCompleteFnRef = (0, import_react148.useRef)(void 0);
478335
+ const stableOnComplete = (0, import_react148.useCallback)(
478096
478336
  async (completedToolCallsFromScheduler) => {
478097
478337
  if (completedToolCallsFromScheduler.length > 0) {
478098
478338
  addItemRef.current(
@@ -478110,11 +478350,11 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478110
478350
  getPreferredEditor,
478111
478351
  onEditorClose
478112
478352
  );
478113
- const pendingToolCallGroupDisplay = (0, import_react147.useMemo)(
478353
+ const pendingToolCallGroupDisplay = (0, import_react148.useMemo)(
478114
478354
  () => toolCalls.length ? mapToDisplay(toolCalls) : void 0,
478115
478355
  [toolCalls]
478116
478356
  );
478117
- const activeToolPtyId = (0, import_react147.useMemo)(() => {
478357
+ const activeToolPtyId = (0, import_react148.useMemo)(() => {
478118
478358
  const executingShellTool = toolCalls?.find(
478119
478359
  (tc) => tc.status === "executing" && tc.request.name === "run_shell_command"
478120
478360
  );
@@ -478123,18 +478363,18 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478123
478363
  }
478124
478364
  return void 0;
478125
478365
  }, [toolCalls]);
478126
- const loopDetectedRef = (0, import_react147.useRef)(false);
478366
+ const loopDetectedRef = (0, import_react148.useRef)(false);
478127
478367
  const [
478128
478368
  loopDetectionConfirmationRequest,
478129
478369
  setLoopDetectionConfirmationRequest
478130
- ] = (0, import_react147.useState)(null);
478131
- const stopRetryCountdownTimer = (0, import_react147.useCallback)(() => {
478370
+ ] = (0, import_react148.useState)(null);
478371
+ const stopRetryCountdownTimer = (0, import_react148.useCallback)(() => {
478132
478372
  if (retryCountdownTimerRef.current) {
478133
478373
  clearInterval(retryCountdownTimerRef.current);
478134
478374
  retryCountdownTimerRef.current = null;
478135
478375
  }
478136
478376
  }, []);
478137
- const clearRetryCountdown = (0, import_react147.useCallback)(() => {
478377
+ const clearRetryCountdown = (0, import_react148.useCallback)(() => {
478138
478378
  stopRetryCountdownTimer();
478139
478379
  setPendingRetryErrorItem(null);
478140
478380
  setPendingRetryCountdownItem(null);
@@ -478143,7 +478383,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478143
478383
  setPendingRetryCountdownItem,
478144
478384
  stopRetryCountdownTimer
478145
478385
  ]);
478146
- const startRetryCountdown = (0, import_react147.useCallback)(
478386
+ const startRetryCountdown = (0, import_react148.useCallback)(
478147
478387
  (retryInfo) => {
478148
478388
  stopRetryCountdownTimer();
478149
478389
  const startTime = Date.now();
@@ -478183,8 +478423,8 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478183
478423
  stopRetryCountdownTimer
478184
478424
  ]
478185
478425
  );
478186
- (0, import_react147.useEffect)(() => () => stopRetryCountdownTimer(), [stopRetryCountdownTimer]);
478187
- const onExec = (0, import_react147.useCallback)(async (done) => {
478426
+ (0, import_react148.useEffect)(() => () => stopRetryCountdownTimer(), [stopRetryCountdownTimer]);
478427
+ const onExec = (0, import_react148.useCallback)(async (done) => {
478188
478428
  setIsResponding(true);
478189
478429
  await done;
478190
478430
  setIsResponding(false);
@@ -478201,12 +478441,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478201
478441
  terminalHeight
478202
478442
  );
478203
478443
  const activePtyId = activeShellPtyId || activeToolPtyId;
478204
- (0, import_react147.useEffect)(() => {
478444
+ (0, import_react148.useEffect)(() => {
478205
478445
  if (!activePtyId) {
478206
478446
  setShellInputFocused(false);
478207
478447
  }
478208
478448
  }, [activePtyId, setShellInputFocused]);
478209
- const streamingState = (0, import_react147.useMemo)(() => {
478449
+ const streamingState = (0, import_react148.useMemo)(() => {
478210
478450
  if (toolCalls.some((tc) => tc.status === "awaiting_approval")) {
478211
478451
  return "waiting_for_confirmation" /* WaitingForConfirmation */;
478212
478452
  }
@@ -478224,7 +478464,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478224
478464
  }
478225
478465
  return "idle" /* Idle */;
478226
478466
  }, [isResponding, toolCalls]);
478227
- (0, import_react147.useEffect)(() => {
478467
+ (0, import_react148.useEffect)(() => {
478228
478468
  if (config2.getApprovalMode() === ApprovalMode.YOLO && streamingState === "idle" /* Idle */) {
478229
478469
  const lastUserMessageIndex = history.findLastIndex(
478230
478470
  (item) => item.type === "user" /* USER */
@@ -478238,7 +478478,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478238
478478
  }
478239
478479
  }
478240
478480
  }, [streamingState, config2, history]);
478241
- const cancelOngoingRequest = (0, import_react147.useCallback)(() => {
478481
+ const cancelOngoingRequest = (0, import_react148.useCallback)(() => {
478242
478482
  if (streamingState !== "responding" /* Responding */) {
478243
478483
  return;
478244
478484
  }
@@ -478282,7 +478522,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478282
478522
  config2,
478283
478523
  getPromptCount
478284
478524
  ]);
478285
- const prepareQueryForGemini = (0, import_react147.useCallback)(
478525
+ const prepareQueryForGemini = (0, import_react148.useCallback)(
478286
478526
  async (query, userMessageTimestamp, abortSignal, prompt_id) => {
478287
478527
  if (turnCancelledRef.current) {
478288
478528
  return { queryToSend: null, shouldProceed: false };
@@ -478372,7 +478612,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478372
478612
  scheduleToolCalls
478373
478613
  ]
478374
478614
  );
478375
- const handleContentEvent = (0, import_react147.useCallback)(
478615
+ const handleContentEvent = (0, import_react148.useCallback)(
478376
478616
  (eventValue, currentGeminiMessageBuffer, userMessageTimestamp) => {
478377
478617
  if (turnCancelledRef.current) {
478378
478618
  return "";
@@ -478408,7 +478648,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478408
478648
  },
478409
478649
  [addItem, pendingHistoryItemRef, setPendingHistoryItem]
478410
478650
  );
478411
- const mergeThought = (0, import_react147.useCallback)(
478651
+ const mergeThought = (0, import_react148.useCallback)(
478412
478652
  (incoming) => {
478413
478653
  setThought((prev) => {
478414
478654
  if (!prev) {
@@ -478421,7 +478661,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478421
478661
  },
478422
478662
  [setThought]
478423
478663
  );
478424
- const handleThoughtEvent = (0, import_react147.useCallback)(
478664
+ const handleThoughtEvent = (0, import_react148.useCallback)(
478425
478665
  (eventValue, currentThoughtBuffer, userMessageTimestamp) => {
478426
478666
  if (turnCancelledRef.current) {
478427
478667
  return "";
@@ -478467,7 +478707,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478467
478707
  },
478468
478708
  [addItem, pendingHistoryItemRef, setPendingHistoryItem, mergeThought]
478469
478709
  );
478470
- const handleUserCancelledEvent = (0, import_react147.useCallback)(
478710
+ const handleUserCancelledEvent = (0, import_react148.useCallback)(
478471
478711
  (userMessageTimestamp) => {
478472
478712
  if (turnCancelledRef.current) {
478473
478713
  return;
@@ -478504,7 +478744,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478504
478744
  clearRetryCountdown
478505
478745
  ]
478506
478746
  );
478507
- const handleErrorEvent = (0, import_react147.useCallback)(
478747
+ const handleErrorEvent = (0, import_react148.useCallback)(
478508
478748
  (eventValue, userMessageTimestamp) => {
478509
478749
  lastPromptErroredRef.current = true;
478510
478750
  if (pendingHistoryItemRef.current) {
@@ -478536,7 +478776,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478536
478776
  clearRetryCountdown
478537
478777
  ]
478538
478778
  );
478539
- const handleCitationEvent = (0, import_react147.useCallback)(
478779
+ const handleCitationEvent = (0, import_react148.useCallback)(
478540
478780
  (text, userMessageTimestamp) => {
478541
478781
  if (!showCitations(settings2)) {
478542
478782
  return;
@@ -478549,7 +478789,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478549
478789
  },
478550
478790
  [addItem, pendingHistoryItemRef, setPendingHistoryItem, settings2]
478551
478791
  );
478552
- const handleFinishedEvent = (0, import_react147.useCallback)(
478792
+ const handleFinishedEvent = (0, import_react148.useCallback)(
478553
478793
  (event, userMessageTimestamp) => {
478554
478794
  const finishReason = event.value.reason;
478555
478795
  if (!finishReason) {
@@ -478588,7 +478828,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478588
478828
  },
478589
478829
  [addItem, clearRetryCountdown]
478590
478830
  );
478591
- const handleChatCompressionEvent = (0, import_react147.useCallback)(
478831
+ const handleChatCompressionEvent = (0, import_react148.useCallback)(
478592
478832
  (eventValue, userMessageTimestamp) => {
478593
478833
  if (pendingHistoryItemRef.current) {
478594
478834
  addItem(pendingHistoryItemRef.current, userMessageTimestamp);
@@ -478604,7 +478844,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478604
478844
  },
478605
478845
  [addItem, config2, pendingHistoryItemRef, setPendingHistoryItem]
478606
478846
  );
478607
- const handleMaxSessionTurnsEvent = (0, import_react147.useCallback)(
478847
+ const handleMaxSessionTurnsEvent = (0, import_react148.useCallback)(
478608
478848
  () => addItem(
478609
478849
  {
478610
478850
  type: "info",
@@ -478614,7 +478854,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478614
478854
  ),
478615
478855
  [addItem, config2]
478616
478856
  );
478617
- const handleSessionTokenLimitExceededEvent = (0, import_react147.useCallback)(
478857
+ const handleSessionTokenLimitExceededEvent = (0, import_react148.useCallback)(
478618
478858
  (value) => addItem(
478619
478859
  {
478620
478860
  type: "error",
@@ -478629,7 +478869,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478629
478869
  ),
478630
478870
  [addItem]
478631
478871
  );
478632
- const handleLoopDetectionConfirmation = (0, import_react147.useCallback)(
478872
+ const handleLoopDetectionConfirmation = (0, import_react148.useCallback)(
478633
478873
  (result) => {
478634
478874
  setLoopDetectionConfirmationRequest(null);
478635
478875
  if (result.userSelection === "disable") {
@@ -478653,12 +478893,12 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478653
478893
  },
478654
478894
  [config2, addItem]
478655
478895
  );
478656
- const handleLoopDetectedEvent = (0, import_react147.useCallback)(() => {
478896
+ const handleLoopDetectedEvent = (0, import_react148.useCallback)(() => {
478657
478897
  setLoopDetectionConfirmationRequest({
478658
478898
  onComplete: handleLoopDetectionConfirmation
478659
478899
  });
478660
478900
  }, [handleLoopDetectionConfirmation]);
478661
- const processGeminiStreamEvents = (0, import_react147.useCallback)(
478901
+ const processGeminiStreamEvents = (0, import_react148.useCallback)(
478662
478902
  async (stream2, userMessageTimestamp, signal) => {
478663
478903
  let geminiMessageBuffer = "";
478664
478904
  let thoughtBuffer = "";
@@ -478762,7 +479002,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478762
479002
  setPendingHistoryItem
478763
479003
  ]
478764
479004
  );
478765
- const submitQuery = (0, import_react147.useCallback)(
479005
+ const submitQuery = (0, import_react148.useCallback)(
478766
479006
  async (query, submitType = SendMessageType.UserQuery, prompt_id) => {
478767
479007
  const allowConcurrentBtwDuringResponse = submitType === SendMessageType.UserQuery && streamingState === "responding" /* Responding */ && typeof query === "string" && isBtwCommand(query);
478768
479008
  const bypassGuard = submitType === SendMessageType.ToolResult || allowConcurrentBtwDuringResponse;
@@ -478939,7 +479179,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478939
479179
  setPendingRetryErrorItem
478940
479180
  ]
478941
479181
  );
478942
- const retryLastPrompt = (0, import_react147.useCallback)(async () => {
479182
+ const retryLastPrompt = (0, import_react148.useCallback)(async () => {
478943
479183
  if (streamingState === "responding" /* Responding */ || streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */) {
478944
479184
  return;
478945
479185
  }
@@ -478957,7 +479197,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478957
479197
  clearRetryCountdown();
478958
479198
  await submitQuery(lastPrompt, SendMessageType.Retry);
478959
479199
  }, [streamingState, addItem, clearRetryCountdown, submitQuery]);
478960
- const handleApprovalModeChange = (0, import_react147.useCallback)(
479200
+ const handleApprovalModeChange = (0, import_react148.useCallback)(
478961
479201
  async (newApprovalMode) => {
478962
479202
  if (newApprovalMode === ApprovalMode.YOLO || newApprovalMode === ApprovalMode.AUTO_EDIT) {
478963
479203
  let awaitingApprovalCalls = toolCalls.filter(
@@ -478986,7 +479226,7 @@ var useGeminiStream = /* @__PURE__ */ __name((geminiClient, history, addItem, co
478986
479226
  },
478987
479227
  [toolCalls]
478988
479228
  );
478989
- const handleCompletedTools = (0, import_react147.useCallback)(
479229
+ const handleCompletedTools = (0, import_react148.useCallback)(
478990
479230
  async (completedToolCallsFromScheduler) => {
478991
479231
  if (isResponding) {
478992
479232
  pendingCompletedToolsRef.current.push(
@@ -479127,13 +479367,13 @@ ${verifyResult}` });
479127
479367
  ]
479128
479368
  );
479129
479369
  onCompleteFnRef.current = handleCompletedTools;
479130
- (0, import_react147.useEffect)(() => {
479370
+ (0, import_react148.useEffect)(() => {
479131
479371
  if (!isResponding && pendingCompletedToolsRef.current.length > 0) {
479132
479372
  const queued = pendingCompletedToolsRef.current.splice(0);
479133
479373
  void handleCompletedTools(queued);
479134
479374
  }
479135
479375
  }, [isResponding, handleCompletedTools]);
479136
- const pendingHistoryItems = (0, import_react147.useMemo)(
479376
+ const pendingHistoryItems = (0, import_react148.useMemo)(
479137
479377
  () => [
479138
479378
  pendingHistoryItem,
479139
479379
  pendingRetryErrorItem,
@@ -479147,7 +479387,7 @@ ${verifyResult}` });
479147
479387
  pendingToolCallGroupDisplay
479148
479388
  ]
479149
479389
  );
479150
- (0, import_react147.useEffect)(() => {
479390
+ (0, import_react148.useEffect)(() => {
479151
479391
  const saveRestorableToolCalls = /* @__PURE__ */ __name(async () => {
479152
479392
  if (!config2.getCheckpointingEnabled()) {
479153
479393
  return;
@@ -479250,9 +479490,9 @@ ${verifyResult}` });
479250
479490
  geminiClient,
479251
479491
  storage
479252
479492
  ]);
479253
- const cronQueueRef = (0, import_react147.useRef)([]);
479254
- const [cronTrigger, setCronTrigger] = (0, import_react147.useState)(0);
479255
- (0, import_react147.useEffect)(() => {
479493
+ const cronQueueRef = (0, import_react148.useRef)([]);
479494
+ const [cronTrigger, setCronTrigger] = (0, import_react148.useState)(0);
479495
+ (0, import_react148.useEffect)(() => {
479256
479496
  if (!config2.isCronEnabled()) return;
479257
479497
  const scheduler = config2.getCronScheduler();
479258
479498
  scheduler.start((job) => {
@@ -479267,13 +479507,13 @@ ${verifyResult}` });
479267
479507
  }
479268
479508
  };
479269
479509
  }, [config2]);
479270
- (0, import_react147.useEffect)(() => {
479510
+ (0, import_react148.useEffect)(() => {
479271
479511
  if (streamingState === "idle" /* Idle */ && cronQueueRef.current.length > 0) {
479272
479512
  const prompt = cronQueueRef.current.shift();
479273
479513
  submitQuery(prompt, SendMessageType.Cron);
479274
479514
  }
479275
479515
  }, [streamingState, submitQuery, cronTrigger]);
479276
- (0, import_react147.useEffect)(() => {
479516
+ (0, import_react148.useEffect)(() => {
479277
479517
  Promise.resolve().then(() => (init_dist4(), dist_exports)).then((core) => {
479278
479518
  core.initTimedMicrocompact?.();
479279
479519
  }).catch(() => {
@@ -479296,7 +479536,7 @@ ${verifyResult}` });
479296
479536
 
479297
479537
  // packages/cli/src/ui/hooks/vim.ts
479298
479538
  init_esbuild_shims();
479299
- var import_react148 = __toESM(require_react(), 1);
479539
+ var import_react149 = __toESM(require_react(), 1);
479300
479540
  init_dist4();
479301
479541
  var DIGIT_MULTIPLIER = 10;
479302
479542
  var DEFAULT_COUNT = 1;
@@ -479361,22 +479601,22 @@ var vimReducer = /* @__PURE__ */ __name((state, action) => {
479361
479601
  }, "vimReducer");
479362
479602
  function useVim(buffer, onSubmit) {
479363
479603
  const { vimEnabled, vimMode, setVimMode } = useVimMode();
479364
- const [state, dispatch] = (0, import_react148.useReducer)(vimReducer, initialVimState);
479365
- (0, import_react148.useEffect)(() => {
479604
+ const [state, dispatch] = (0, import_react149.useReducer)(vimReducer, initialVimState);
479605
+ (0, import_react149.useEffect)(() => {
479366
479606
  dispatch({ type: "SET_MODE", mode: vimMode });
479367
479607
  }, [vimMode]);
479368
- const updateMode = (0, import_react148.useCallback)(
479608
+ const updateMode = (0, import_react149.useCallback)(
479369
479609
  (mode) => {
479370
479610
  setVimMode(mode);
479371
479611
  dispatch({ type: "SET_MODE", mode });
479372
479612
  },
479373
479613
  [setVimMode]
479374
479614
  );
479375
- const getCurrentCount = (0, import_react148.useCallback)(
479615
+ const getCurrentCount = (0, import_react149.useCallback)(
479376
479616
  () => state.count || DEFAULT_COUNT,
479377
479617
  [state.count]
479378
479618
  );
479379
- const executeCommand = (0, import_react148.useCallback)(
479619
+ const executeCommand = (0, import_react149.useCallback)(
479380
479620
  (cmdType, count) => {
479381
479621
  switch (cmdType) {
479382
479622
  case CMD_TYPES.DELETE_WORD_FORWARD: {
@@ -479452,7 +479692,7 @@ function useVim(buffer, onSubmit) {
479452
479692
  },
479453
479693
  [buffer, updateMode]
479454
479694
  );
479455
- const handleInsertModeInput = (0, import_react148.useCallback)(
479695
+ const handleInsertModeInput = (0, import_react149.useCallback)(
479456
479696
  (normalizedKey) => {
479457
479697
  if (normalizedKey.name === "escape") {
479458
479698
  buffer.vimEscapeInsertMode();
@@ -479483,7 +479723,7 @@ function useVim(buffer, onSubmit) {
479483
479723
  },
479484
479724
  [buffer, dispatch, updateMode, onSubmit]
479485
479725
  );
479486
- const normalizeKey = (0, import_react148.useCallback)(
479726
+ const normalizeKey = (0, import_react149.useCallback)(
479487
479727
  (key) => ({
479488
479728
  name: key.name || "",
479489
479729
  sequence: key.sequence || "",
@@ -479494,7 +479734,7 @@ function useVim(buffer, onSubmit) {
479494
479734
  }),
479495
479735
  []
479496
479736
  );
479497
- const handleChangeMovement = (0, import_react148.useCallback)(
479737
+ const handleChangeMovement = (0, import_react149.useCallback)(
479498
479738
  (movement) => {
479499
479739
  const count = getCurrentCount();
479500
479740
  dispatch({ type: "CLEAR_COUNT" });
@@ -479515,7 +479755,7 @@ function useVim(buffer, onSubmit) {
479515
479755
  },
479516
479756
  [getCurrentCount, dispatch, buffer, updateMode]
479517
479757
  );
479518
- const handleOperatorMotion = (0, import_react148.useCallback)(
479758
+ const handleOperatorMotion = (0, import_react149.useCallback)(
479519
479759
  (operator2, motion) => {
479520
479760
  const count = getCurrentCount();
479521
479761
  const commandMap = {
@@ -479542,7 +479782,7 @@ function useVim(buffer, onSubmit) {
479542
479782
  },
479543
479783
  [getCurrentCount, executeCommand, dispatch]
479544
479784
  );
479545
- const handleInput = (0, import_react148.useCallback)(
479785
+ const handleInput = (0, import_react149.useCallback)(
479546
479786
  (key) => {
479547
479787
  if (!vimEnabled) {
479548
479788
  return false;
@@ -479842,14 +480082,14 @@ __name(useVim, "useVim");
479842
480082
 
479843
480083
  // packages/cli/src/ui/hooks/useBracketedPaste.ts
479844
480084
  init_esbuild_shims();
479845
- var import_react149 = __toESM(require_react(), 1);
480085
+ var import_react150 = __toESM(require_react(), 1);
479846
480086
  var ENABLE_BRACKETED_PASTE = "\x1B[?2004h";
479847
480087
  var DISABLE_BRACKETED_PASTE = "\x1B[?2004l";
479848
480088
  var useBracketedPaste = /* @__PURE__ */ __name(() => {
479849
480089
  const cleanup = /* @__PURE__ */ __name(() => {
479850
480090
  process.stdout.write(DISABLE_BRACKETED_PASTE);
479851
480091
  }, "cleanup");
479852
- (0, import_react149.useEffect)(() => {
480092
+ (0, import_react150.useEffect)(() => {
479853
480093
  process.stdout.write(`\x1B[?2026h${ENABLE_BRACKETED_PASTE}\x1B[?2026l`);
479854
480094
  process.on("exit", cleanup);
479855
480095
  process.on("SIGINT", cleanup);
@@ -479865,7 +480105,7 @@ var useBracketedPaste = /* @__PURE__ */ __name(() => {
479865
480105
 
479866
480106
  // packages/cli/src/ui/hooks/useKeyboardHandling.ts
479867
480107
  init_esbuild_shims();
479868
- var import_react150 = __toESM(require_react(), 1);
480108
+ var import_react151 = __toESM(require_react(), 1);
479869
480109
  init_dist4();
479870
480110
  var CTRL_EXIT_PROMPT_DURATION_MS = 1e3;
479871
480111
  function useKeyboardHandling(params) {
@@ -479887,20 +480127,20 @@ function useKeyboardHandling(params) {
479887
480127
  handleSlashCommand: handleSlashCommand2,
479888
480128
  debugKeystrokeLogging
479889
480129
  } = params;
479890
- const [showToolDescriptions, setShowToolDescriptions] = (0, import_react150.useState)(false);
479891
- const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0, import_react150.useState)(false);
479892
- const ctrlCTimerRef = (0, import_react150.useRef)(null);
479893
- const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0, import_react150.useState)(false);
479894
- const ctrlDTimerRef = (0, import_react150.useRef)(null);
479895
- const [escapePressedOnce, setEscapePressedOnce] = (0, import_react150.useState)(false);
479896
- const escapeTimerRef = (0, import_react150.useRef)(null);
479897
- const dialogsVisibleRef = (0, import_react150.useRef)(false);
479898
- const [constrainHeight, setConstrainHeight] = (0, import_react150.useState)(true);
479899
- const [showEscapePrompt, setShowEscapePrompt] = (0, import_react150.useState)(false);
479900
- const handleEscapePromptChange = (0, import_react150.useCallback)((showPrompt) => {
480130
+ const [showToolDescriptions, setShowToolDescriptions] = (0, import_react151.useState)(false);
480131
+ const [ctrlCPressedOnce, setCtrlCPressedOnce] = (0, import_react151.useState)(false);
480132
+ const ctrlCTimerRef = (0, import_react151.useRef)(null);
480133
+ const [ctrlDPressedOnce, setCtrlDPressedOnce] = (0, import_react151.useState)(false);
480134
+ const ctrlDTimerRef = (0, import_react151.useRef)(null);
480135
+ const [escapePressedOnce, setEscapePressedOnce] = (0, import_react151.useState)(false);
480136
+ const escapeTimerRef = (0, import_react151.useRef)(null);
480137
+ const dialogsVisibleRef = (0, import_react151.useRef)(false);
480138
+ const [constrainHeight, setConstrainHeight] = (0, import_react151.useState)(true);
480139
+ const [showEscapePrompt, setShowEscapePrompt] = (0, import_react151.useState)(false);
480140
+ const handleEscapePromptChange = (0, import_react151.useCallback)((showPrompt) => {
479901
480141
  setShowEscapePrompt(showPrompt);
479902
480142
  }, []);
479903
- const globalKeypressHandlerRef = (0, import_react150.useRef)(() => {
480143
+ const globalKeypressHandlerRef = (0, import_react151.useRef)(() => {
479904
480144
  });
479905
480145
  globalKeypressHandlerRef.current = (key) => {
479906
480146
  if (debugKeystrokeLogging) {
@@ -480007,7 +480247,7 @@ function useKeyboardHandling(params) {
480007
480247
  }
480008
480248
  }
480009
480249
  };
480010
- const handleGlobalKeypress = (0, import_react150.useCallback)(
480250
+ const handleGlobalKeypress = (0, import_react151.useCallback)(
480011
480251
  (key) => globalKeypressHandlerRef.current(key),
480012
480252
  []
480013
480253
  );
@@ -480032,22 +480272,22 @@ init_esbuild_shims();
480032
480272
 
480033
480273
  // packages/cli/src/ui/hooks/usePhraseCycler.ts
480034
480274
  init_esbuild_shims();
480035
- var import_react151 = __toESM(require_react(), 1);
480275
+ var import_react152 = __toESM(require_react(), 1);
480036
480276
  var WITTY_LOADING_PHRASES = ["I'm Feeling Lucky"];
480037
480277
  var PHRASE_CHANGE_INTERVAL_MS = 15e3;
480038
480278
  var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases) => {
480039
- const loadingPhrases = (0, import_react151.useMemo)(() => {
480279
+ const loadingPhrases = (0, import_react152.useMemo)(() => {
480040
480280
  if (customPhrases && customPhrases.length > 0) {
480041
480281
  return customPhrases;
480042
480282
  }
480043
480283
  const translatedPhrases = ta("WITTY_LOADING_PHRASES");
480044
480284
  return translatedPhrases.length > 0 ? translatedPhrases : WITTY_LOADING_PHRASES;
480045
480285
  }, [customPhrases]);
480046
- const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0, import_react151.useState)(
480286
+ const [currentLoadingPhrase, setCurrentLoadingPhrase] = (0, import_react152.useState)(
480047
480287
  loadingPhrases[0]
480048
480288
  );
480049
- const phraseIntervalRef = (0, import_react151.useRef)(null);
480050
- (0, import_react151.useEffect)(() => {
480289
+ const phraseIntervalRef = (0, import_react152.useRef)(null);
480290
+ (0, import_react152.useEffect)(() => {
480051
480291
  if (isWaiting) {
480052
480292
  setCurrentLoadingPhrase(t4("Waiting for user confirmation..."));
480053
480293
  if (phraseIntervalRef.current) {
@@ -480084,9 +480324,9 @@ var usePhraseCycler = /* @__PURE__ */ __name((isActive, isWaiting, customPhrases
480084
480324
  }, "usePhraseCycler");
480085
480325
 
480086
480326
  // packages/cli/src/ui/hooks/useLoadingIndicator.ts
480087
- var import_react152 = __toESM(require_react(), 1);
480327
+ var import_react153 = __toESM(require_react(), 1);
480088
480328
  var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhrases, currentCandidatesTokens) => {
480089
- const [timerResetKey, setTimerResetKey] = (0, import_react152.useState)(0);
480329
+ const [timerResetKey, setTimerResetKey] = (0, import_react153.useState)(0);
480090
480330
  const isTimerActive = streamingState === "responding" /* Responding */;
480091
480331
  const elapsedTimeFromTimer = useTimer(isTimerActive, timerResetKey);
480092
480332
  const isPhraseCyclingActive = streamingState === "responding" /* Responding */;
@@ -480096,10 +480336,10 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
480096
480336
  isWaiting,
480097
480337
  customWittyPhrases
480098
480338
  );
480099
- const [retainedElapsedTime, setRetainedElapsedTime] = (0, import_react152.useState)(0);
480100
- const [taskStartTokens, setTaskStartTokens] = (0, import_react152.useState)(0);
480101
- const prevStreamingStateRef = (0, import_react152.useRef)(null);
480102
- (0, import_react152.useEffect)(() => {
480339
+ const [retainedElapsedTime, setRetainedElapsedTime] = (0, import_react153.useState)(0);
480340
+ const [taskStartTokens, setTaskStartTokens] = (0, import_react153.useState)(0);
480341
+ const prevStreamingStateRef = (0, import_react153.useRef)(null);
480342
+ (0, import_react153.useEffect)(() => {
480103
480343
  if (prevStreamingStateRef.current === "waiting_for_confirmation" /* WaitingForConfirmation */ && streamingState === "responding" /* Responding */) {
480104
480344
  setTimerResetKey((prevKey) => prevKey + 1);
480105
480345
  setRetainedElapsedTime(0);
@@ -480124,20 +480364,20 @@ var useLoadingIndicator = /* @__PURE__ */ __name((streamingState, customWittyPhr
480124
480364
 
480125
480365
  // packages/cli/src/ui/hooks/useFolderTrust.ts
480126
480366
  init_esbuild_shims();
480127
- var import_react153 = __toESM(require_react(), 1);
480367
+ var import_react154 = __toESM(require_react(), 1);
480128
480368
  import * as process36 from "node:process";
480129
480369
  var useFolderTrust = /* @__PURE__ */ __name((settings2, onTrustChange) => {
480130
- const [isTrusted, setIsTrusted] = (0, import_react153.useState)(void 0);
480131
- const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0, import_react153.useState)(false);
480132
- const [isRestarting, setIsRestarting] = (0, import_react153.useState)(false);
480370
+ const [isTrusted, setIsTrusted] = (0, import_react154.useState)(void 0);
480371
+ const [isFolderTrustDialogOpen, setIsFolderTrustDialogOpen] = (0, import_react154.useState)(false);
480372
+ const [isRestarting, setIsRestarting] = (0, import_react154.useState)(false);
480133
480373
  const folderTrust = settings2.merged.security?.folderTrust?.enabled;
480134
- (0, import_react153.useEffect)(() => {
480374
+ (0, import_react154.useEffect)(() => {
480135
480375
  const { isTrusted: trusted } = isWorkspaceTrusted(settings2.merged);
480136
480376
  setIsTrusted(trusted);
480137
480377
  setIsFolderTrustDialogOpen(trusted === void 0);
480138
480378
  onTrustChange(trusted);
480139
480379
  }, [folderTrust, onTrustChange, settings2.merged]);
480140
- const handleFolderTrustSelect = (0, import_react153.useCallback)(
480380
+ const handleFolderTrustSelect = (0, import_react154.useCallback)(
480141
480381
  (choice2) => {
480142
480382
  const trustedFolders = loadTrustedFolders();
480143
480383
  const cwd6 = process36.cwd();
@@ -480180,7 +480420,7 @@ var useFolderTrust = /* @__PURE__ */ __name((settings2, onTrustChange) => {
480180
480420
 
480181
480421
  // packages/cli/src/ui/hooks/useCommandMigration.ts
480182
480422
  init_esbuild_shims();
480183
- var import_react154 = __toESM(require_react(), 1);
480423
+ var import_react155 = __toESM(require_react(), 1);
480184
480424
  init_dist4();
480185
480425
 
480186
480426
  // packages/cli/src/services/command-migration-tool.ts
@@ -480254,9 +480494,9 @@ __name(migrateTomlCommands, "migrateTomlCommands");
480254
480494
 
480255
480495
  // packages/cli/src/ui/hooks/useCommandMigration.ts
480256
480496
  function useCommandMigration(settings2, storage) {
480257
- const [showMigrationNudge, setShowMigrationNudge] = (0, import_react154.useState)(false);
480258
- const [tomlFiles, setTomlFiles] = (0, import_react154.useState)([]);
480259
- (0, import_react154.useEffect)(() => {
480497
+ const [showMigrationNudge, setShowMigrationNudge] = (0, import_react155.useState)(false);
480498
+ const [tomlFiles, setTomlFiles] = (0, import_react155.useState)([]);
480499
+ (0, import_react155.useEffect)(() => {
480260
480500
  const checkTomlCommands = /* @__PURE__ */ __name(async () => {
480261
480501
  const allFiles = [];
480262
480502
  const workspaceCommandsDir = storage.getProjectCommandsDir();
@@ -480282,9 +480522,9 @@ __name(useCommandMigration, "useCommandMigration");
480282
480522
 
480283
480523
  // packages/cli/src/ui/hooks/useIdleMessageDrain.ts
480284
480524
  init_esbuild_shims();
480285
- var import_react155 = __toESM(require_react(), 1);
480525
+ var import_react156 = __toESM(require_react(), 1);
480286
480526
  function useIdleMessageDrain(isConfigInitialized, streamingState, messageQueue, drain, submitQuery) {
480287
- (0, import_react155.useEffect)(() => {
480527
+ (0, import_react156.useEffect)(() => {
480288
480528
  if (isConfigInitialized && streamingState === "idle" /* Idle */ && messageQueue.length > 0) {
480289
480529
  const combined = messageQueue.join("\n\n");
480290
480530
  drain();
@@ -480296,7 +480536,7 @@ __name(useIdleMessageDrain, "useIdleMessageDrain");
480296
480536
 
480297
480537
  // packages/cli/src/ui/hooks/useWindowTitle.ts
480298
480538
  init_esbuild_shims();
480299
- var import_react156 = __toESM(require_react(), 1);
480539
+ var import_react157 = __toESM(require_react(), 1);
480300
480540
  import { basename as basename30 } from "node:path";
480301
480541
 
480302
480542
  // packages/cli/src/utils/windowTitle.ts
@@ -480313,9 +480553,9 @@ __name(computeWindowTitle, "computeWindowTitle");
480313
480553
 
480314
480554
  // packages/cli/src/ui/hooks/useWindowTitle.ts
480315
480555
  function useWindowTitle(streamingState, thought, settings2, stdout2, targetDir) {
480316
- const originalTitleRef = (0, import_react156.useRef)(computeWindowTitle(basename30(targetDir)));
480317
- const lastTitleRef = (0, import_react156.useRef)(null);
480318
- (0, import_react156.useEffect)(() => {
480556
+ const originalTitleRef = (0, import_react157.useRef)(computeWindowTitle(basename30(targetDir)));
480557
+ const lastTitleRef = (0, import_react157.useRef)(null);
480558
+ (0, import_react157.useEffect)(() => {
480319
480559
  if (!settings2.merged.ui?.showStatusInTitle || settings2.merged.ui?.hideWindowTitle)
480320
480560
  return;
480321
480561
  let title;
@@ -480342,11 +480582,11 @@ __name(useWindowTitle, "useWindowTitle");
480342
480582
 
480343
480583
  // packages/cli/src/ui/hooks/useInitializationEffects.ts
480344
480584
  init_esbuild_shims();
480345
- var import_react157 = __toESM(require_react(), 1);
480585
+ var import_react158 = __toESM(require_react(), 1);
480346
480586
  init_dist4();
480347
480587
  var debugLogger148 = createDebugLogger("APP_CONTAINER");
480348
480588
  function useInitializationEffects(config2, historyManager, setConfigInitialized) {
480349
- (0, import_react157.useEffect)(() => {
480589
+ (0, import_react158.useEffect)(() => {
480350
480590
  (async () => {
480351
480591
  await config2.initialize();
480352
480592
  setConfigInitialized(true);
@@ -480414,7 +480654,7 @@ __name(useInitializationEffects, "useInitializationEffects");
480414
480654
 
480415
480655
  // packages/cli/src/ui/hooks/usePromptSuggestions.ts
480416
480656
  init_esbuild_shims();
480417
- var import_react158 = __toESM(require_react(), 1);
480657
+ var import_react159 = __toESM(require_react(), 1);
480418
480658
  init_dist4();
480419
480659
  function usePromptSuggestions(params) {
480420
480660
  const {
@@ -480430,17 +480670,17 @@ function usePromptSuggestions(params) {
480430
480670
  settingInputRequests,
480431
480671
  pendingGeminiHistoryItems
480432
480672
  } = params;
480433
- const [promptSuggestion, setPromptSuggestion] = (0, import_react158.useState)(null);
480434
- const prevStreamingStateRef = (0, import_react158.useRef)("idle" /* Idle */);
480435
- const speculationRef = (0, import_react158.useRef)(IDLE_SPECULATION);
480436
- const suggestionAbortRef = (0, import_react158.useRef)(null);
480437
- const dismissPromptSuggestion = (0, import_react158.useCallback)(() => {
480673
+ const [promptSuggestion, setPromptSuggestion] = (0, import_react159.useState)(null);
480674
+ const prevStreamingStateRef = (0, import_react159.useRef)("idle" /* Idle */);
480675
+ const speculationRef = (0, import_react159.useRef)(IDLE_SPECULATION);
480676
+ const suggestionAbortRef = (0, import_react159.useRef)(null);
480677
+ const dismissPromptSuggestion = (0, import_react159.useCallback)(() => {
480438
480678
  setPromptSuggestion(null);
480439
480679
  suggestionAbortRef.current?.abort();
480440
480680
  suggestionAbortRef.current = null;
480441
480681
  }, []);
480442
480682
  const followupSuggestionsEnabled = settings2.merged.ui?.enableFollowupSuggestions !== false;
480443
- (0, import_react158.useEffect)(() => {
480683
+ (0, import_react159.useEffect)(() => {
480444
480684
  if (!followupSuggestionsEnabled) {
480445
480685
  suggestionAbortRef.current?.abort();
480446
480686
  setPromptSuggestion(null);
@@ -480513,7 +480753,7 @@ function usePromptSuggestions(params) {
480513
480753
  isPermissionsDialogOpen,
480514
480754
  settingInputRequests
480515
480755
  ]);
480516
- (0, import_react158.useEffect)(() => {
480756
+ (0, import_react159.useEffect)(() => {
480517
480757
  if (!promptSuggestion && speculationRef.current.status !== "idle") {
480518
480758
  abortSpeculation(speculationRef.current).catch(() => {
480519
480759
  });
@@ -480531,7 +480771,7 @@ __name(usePromptSuggestions, "usePromptSuggestions");
480531
480771
 
480532
480772
  // packages/cli/src/ui/hooks/useExitHandling.ts
480533
480773
  init_esbuild_shims();
480534
- var import_react159 = __toESM(require_react(), 1);
480774
+ var import_react160 = __toESM(require_react(), 1);
480535
480775
  function useExitHandling(params) {
480536
480776
  const {
480537
480777
  isAuthDialogOpen,
@@ -480541,7 +480781,7 @@ function useExitHandling(params) {
480541
480781
  cancelOngoingRequest,
480542
480782
  buffer
480543
480783
  } = params;
480544
- const handleExit = (0, import_react159.useCallback)(
480784
+ const handleExit = (0, import_react160.useCallback)(
480545
480785
  (pressedOnce, setPressedOnce, timerRef) => {
480546
480786
  if (pressedOnce) {
480547
480787
  if (timerRef.current) {
@@ -483559,8 +483799,8 @@ __name(getInstallationInfo, "getInstallationInfo");
483559
483799
 
483560
483800
  // packages/cli/src/utils/updateEventEmitter.ts
483561
483801
  init_esbuild_shims();
483562
- import { EventEmitter as EventEmitter11 } from "node:events";
483563
- var updateEventEmitter = new EventEmitter11();
483802
+ import { EventEmitter as EventEmitter12 } from "node:events";
483803
+ var updateEventEmitter = new EventEmitter12();
483564
483804
 
483565
483805
  // packages/cli/src/utils/spawnWrapper.ts
483566
483806
  init_esbuild_shims();
@@ -483684,7 +483924,7 @@ __name(setUpdateHandler, "setUpdateHandler");
483684
483924
 
483685
483925
  // packages/cli/src/ui/hooks/useMessageQueue.ts
483686
483926
  init_esbuild_shims();
483687
- var import_react160 = __toESM(require_react(), 1);
483927
+ var import_react161 = __toESM(require_react(), 1);
483688
483928
  var MessageQueueStore = class {
483689
483929
  static {
483690
483930
  __name(this, "MessageQueueStore");
@@ -483738,15 +483978,15 @@ var MessageQueueStore = class {
483738
483978
  }
483739
483979
  };
483740
483980
  function useMessageQueue() {
483741
- const store = (0, import_react160.useMemo)(() => new MessageQueueStore(), []);
483742
- const messageQueue = (0, import_react160.useSyncExternalStore)(store.subscribe, store.getSnapshot);
483743
- const addMessage = (0, import_react160.useCallback)(
483981
+ const store = (0, import_react161.useMemo)(() => new MessageQueueStore(), []);
483982
+ const messageQueue = (0, import_react161.useSyncExternalStore)(store.subscribe, store.getSnapshot);
483983
+ const addMessage = (0, import_react161.useCallback)(
483744
483984
  (message) => store.addMessage(message),
483745
483985
  [store]
483746
483986
  );
483747
- const clearQueue = (0, import_react160.useCallback)(() => store.clearQueue(), [store]);
483748
- const popLast = (0, import_react160.useCallback)(() => store.popLast(), [store]);
483749
- const drain = (0, import_react160.useCallback)(() => store.drain(), [store]);
483987
+ const clearQueue = (0, import_react161.useCallback)(() => store.clearQueue(), [store]);
483988
+ const popLast = (0, import_react161.useCallback)(() => store.popLast(), [store]);
483989
+ const drain = (0, import_react161.useCallback)(() => store.drain(), [store]);
483750
483990
  return { messageQueue, addMessage, clearQueue, popLast, drain };
483751
483991
  }
483752
483992
  __name(useMessageQueue, "useMessageQueue");
@@ -483754,7 +483994,7 @@ __name(useMessageQueue, "useMessageQueue");
483754
483994
  // packages/cli/src/ui/hooks/useAutoAcceptIndicator.ts
483755
483995
  init_esbuild_shims();
483756
483996
  init_dist4();
483757
- var import_react161 = __toESM(require_react(), 1);
483997
+ var import_react162 = __toESM(require_react(), 1);
483758
483998
  function useAutoAcceptIndicator({
483759
483999
  config: config2,
483760
484000
  addItem,
@@ -483763,8 +484003,8 @@ function useAutoAcceptIndicator({
483763
484003
  disabled
483764
484004
  }) {
483765
484005
  const currentConfigValue = config2.getApprovalMode();
483766
- const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0, import_react161.useState)(currentConfigValue);
483767
- (0, import_react161.useEffect)(() => {
484006
+ const [showAutoAcceptIndicator, setShowAutoAcceptIndicator] = (0, import_react162.useState)(currentConfigValue);
484007
+ (0, import_react162.useEffect)(() => {
483768
484008
  setShowAutoAcceptIndicator(currentConfigValue);
483769
484009
  }, [currentConfigValue]);
483770
484010
  useKeypress(
@@ -483802,7 +484042,7 @@ __name(useAutoAcceptIndicator, "useAutoAcceptIndicator");
483802
484042
 
483803
484043
  // packages/cli/src/ui/hooks/useExtensionUpdates.ts
483804
484044
  init_esbuild_shims();
483805
- var import_react162 = __toESM(require_react(), 1);
484045
+ var import_react163 = __toESM(require_react(), 1);
483806
484046
  function confirmationRequestsReducer(state, action) {
483807
484047
  switch (action.type) {
483808
484048
  case "add":
@@ -483819,8 +484059,8 @@ var useConfirmUpdateRequests = /* @__PURE__ */ __name(() => {
483819
484059
  const [
483820
484060
  confirmUpdateExtensionRequests,
483821
484061
  dispatchConfirmUpdateExtensionRequests
483822
- ] = (0, import_react162.useReducer)(confirmationRequestsReducer, []);
483823
- const addConfirmUpdateExtensionRequest = (0, import_react162.useCallback)(
484062
+ ] = (0, import_react163.useReducer)(confirmationRequestsReducer, []);
484063
+ const addConfirmUpdateExtensionRequest = (0, import_react163.useCallback)(
483824
484064
  (original) => {
483825
484065
  const wrappedRequest = {
483826
484066
  prompt: original.prompt,
@@ -483858,11 +484098,11 @@ function settingInputRequestsReducer(state, action) {
483858
484098
  }
483859
484099
  __name(settingInputRequestsReducer, "settingInputRequestsReducer");
483860
484100
  var useSettingInputRequests = /* @__PURE__ */ __name(() => {
483861
- const [settingInputRequests, dispatchSettingInputRequests] = (0, import_react162.useReducer)(
484101
+ const [settingInputRequests, dispatchSettingInputRequests] = (0, import_react163.useReducer)(
483862
484102
  settingInputRequestsReducer,
483863
484103
  []
483864
484104
  );
483865
- const addSettingInputRequest = (0, import_react162.useCallback)(
484105
+ const addSettingInputRequest = (0, import_react163.useCallback)(
483866
484106
  (original) => {
483867
484107
  const wrappedRequest = {
483868
484108
  settingName: original.settingName,
@@ -483909,11 +484149,11 @@ function pluginChoiceRequestsReducer(state, action) {
483909
484149
  }
483910
484150
  __name(pluginChoiceRequestsReducer, "pluginChoiceRequestsReducer");
483911
484151
  var usePluginChoiceRequests = /* @__PURE__ */ __name(() => {
483912
- const [pluginChoiceRequests, dispatchPluginChoiceRequests] = (0, import_react162.useReducer)(
484152
+ const [pluginChoiceRequests, dispatchPluginChoiceRequests] = (0, import_react163.useReducer)(
483913
484153
  pluginChoiceRequestsReducer,
483914
484154
  []
483915
484155
  );
483916
- const addPluginChoiceRequest = (0, import_react162.useCallback)(
484156
+ const addPluginChoiceRequest = (0, import_react163.useCallback)(
483917
484157
  (original) => {
483918
484158
  const wrappedRequest = {
483919
484159
  marketplaceName: original.marketplaceName,
@@ -483947,12 +484187,12 @@ var usePluginChoiceRequests = /* @__PURE__ */ __name(() => {
483947
484187
  };
483948
484188
  }, "usePluginChoiceRequests");
483949
484189
  var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd6) => {
483950
- const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0, import_react162.useReducer)(
484190
+ const [extensionsUpdateState, dispatchExtensionStateUpdate] = (0, import_react163.useReducer)(
483951
484191
  extensionUpdatesReducer,
483952
484192
  initialExtensionUpdatesState
483953
484193
  );
483954
484194
  const extensions = extensionManager.getLoadedExtensions();
483955
- (0, import_react162.useEffect)(() => {
484195
+ (0, import_react163.useEffect)(() => {
483956
484196
  (async () => {
483957
484197
  const extensionsToCheck = extensions.filter((extension) => {
483958
484198
  const currentStatus = extensionsUpdateState.extensionStatuses.get(
@@ -483980,7 +484220,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
483980
484220
  extensionsUpdateState.extensionStatuses,
483981
484221
  dispatchExtensionStateUpdate
483982
484222
  ]);
483983
- (0, import_react162.useEffect)(() => {
484223
+ (0, import_react163.useEffect)(() => {
483984
484224
  if (extensionsUpdateState.batchChecksInProgress > 0) {
483985
484225
  return;
483986
484226
  }
@@ -484039,7 +484279,7 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
484039
484279
  );
484040
484280
  }
484041
484281
  }, [extensions, extensionManager, extensionsUpdateState, addItem, cwd6]);
484042
- const extensionsUpdateStateComputed = (0, import_react162.useMemo)(() => {
484282
+ const extensionsUpdateStateComputed = (0, import_react163.useMemo)(() => {
484043
484283
  const result = /* @__PURE__ */ new Map();
484044
484284
  for (const [
484045
484285
  key,
@@ -484058,15 +484298,15 @@ var useExtensionUpdates = /* @__PURE__ */ __name((extensionManager, addItem, cwd
484058
484298
 
484059
484299
  // packages/cli/src/ui/hooks/useWelcomeBack.ts
484060
484300
  init_esbuild_shims();
484061
- var import_react163 = __toESM(require_react(), 1);
484301
+ var import_react164 = __toESM(require_react(), 1);
484062
484302
  init_dist4();
484063
484303
  function useWelcomeBack(config2, submitQuery, buffer, settings2) {
484064
- const [welcomeBackInfo, setWelcomeBackInfo] = (0, import_react163.useState)(null);
484065
- const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0, import_react163.useState)(false);
484066
- const [welcomeBackChoice, setWelcomeBackChoice] = (0, import_react163.useState)(null);
484067
- const [shouldFillInput, setShouldFillInput] = (0, import_react163.useState)(false);
484068
- const [inputFillText, setInputFillText] = (0, import_react163.useState)(null);
484069
- const checkWelcomeBack = (0, import_react163.useCallback)(async () => {
484304
+ const [welcomeBackInfo, setWelcomeBackInfo] = (0, import_react164.useState)(null);
484305
+ const [showWelcomeBackDialog, setShowWelcomeBackDialog] = (0, import_react164.useState)(false);
484306
+ const [welcomeBackChoice, setWelcomeBackChoice] = (0, import_react164.useState)(null);
484307
+ const [shouldFillInput, setShouldFillInput] = (0, import_react164.useState)(false);
484308
+ const [inputFillText, setInputFillText] = (0, import_react164.useState)(null);
484309
+ const checkWelcomeBack = (0, import_react164.useCallback)(async () => {
484070
484310
  if (settings2.ui?.enableWelcomeBack === false) {
484071
484311
  return;
484072
484312
  }
@@ -484080,7 +484320,7 @@ function useWelcomeBack(config2, submitQuery, buffer, settings2) {
484080
484320
  config2.getDebugLogger().debug("Welcome back check failed:", error40);
484081
484321
  }
484082
484322
  }, [config2, settings2.ui?.enableWelcomeBack]);
484083
- const handleWelcomeBackSelection = (0, import_react163.useCallback)(
484323
+ const handleWelcomeBackSelection = (0, import_react164.useCallback)(
484084
484324
  (choice2) => {
484085
484325
  setWelcomeBackChoice(choice2);
484086
484326
  setShowWelcomeBackDialog(false);
@@ -484092,21 +484332,21 @@ function useWelcomeBack(config2, submitQuery, buffer, settings2) {
484092
484332
  },
484093
484333
  [welcomeBackInfo]
484094
484334
  );
484095
- const handleWelcomeBackClose = (0, import_react163.useCallback)(() => {
484335
+ const handleWelcomeBackClose = (0, import_react164.useCallback)(() => {
484096
484336
  setWelcomeBackChoice("restart");
484097
484337
  setShowWelcomeBackDialog(false);
484098
484338
  }, []);
484099
- const clearInputFill = (0, import_react163.useCallback)(() => {
484339
+ const clearInputFill = (0, import_react164.useCallback)(() => {
484100
484340
  setShouldFillInput(false);
484101
484341
  setInputFillText(null);
484102
484342
  }, []);
484103
- (0, import_react163.useEffect)(() => {
484343
+ (0, import_react164.useEffect)(() => {
484104
484344
  if (shouldFillInput && inputFillText) {
484105
484345
  buffer.setText(inputFillText);
484106
484346
  clearInputFill();
484107
484347
  }
484108
484348
  }, [shouldFillInput, inputFillText, buffer, clearInputFill]);
484109
- (0, import_react163.useEffect)(() => {
484349
+ (0, import_react164.useEffect)(() => {
484110
484350
  checkWelcomeBack();
484111
484351
  }, [checkWelcomeBack]);
484112
484352
  return {
@@ -484127,9 +484367,9 @@ __name(useWelcomeBack, "useWelcomeBack");
484127
484367
 
484128
484368
  // packages/cli/src/ui/hooks/useDialogClose.ts
484129
484369
  init_esbuild_shims();
484130
- var import_react164 = __toESM(require_react(), 1);
484370
+ var import_react165 = __toESM(require_react(), 1);
484131
484371
  function useDialogClose(options2) {
484132
- const closeAnyOpenDialog = (0, import_react164.useCallback)(() => {
484372
+ const closeAnyOpenDialog = (0, import_react165.useCallback)(() => {
484133
484373
  if (options2.isThemeDialogOpen) {
484134
484374
  options2.handleThemeSelect(void 0, "User" /* User */);
484135
484375
  return true;
@@ -484165,14 +484405,14 @@ __name(useDialogClose, "useDialogClose");
484165
484405
 
484166
484406
  // packages/cli/src/ui/hooks/useInitializationAuthError.ts
484167
484407
  init_esbuild_shims();
484168
- var import_react165 = __toESM(require_react(), 1);
484408
+ var import_react166 = __toESM(require_react(), 1);
484169
484409
  var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError) => {
484170
- const hasHandled = (0, import_react165.useRef)(false);
484171
- const authErrorRef = (0, import_react165.useRef)(authError);
484172
- const onAuthErrorRef = (0, import_react165.useRef)(onAuthError);
484410
+ const hasHandled = (0, import_react166.useRef)(false);
484411
+ const authErrorRef = (0, import_react166.useRef)(authError);
484412
+ const onAuthErrorRef = (0, import_react166.useRef)(onAuthError);
484173
484413
  authErrorRef.current = authError;
484174
484414
  onAuthErrorRef.current = onAuthError;
484175
- (0, import_react165.useEffect)(() => {
484415
+ (0, import_react166.useEffect)(() => {
484176
484416
  if (hasHandled.current) {
484177
484417
  return;
484178
484418
  }
@@ -484185,13 +484425,13 @@ var useInitializationAuthError = /* @__PURE__ */ __name((authError, onAuthError)
484185
484425
 
484186
484426
  // packages/cli/src/ui/hooks/useSubagentCreateDialog.ts
484187
484427
  init_esbuild_shims();
484188
- var import_react166 = __toESM(require_react(), 1);
484428
+ var import_react167 = __toESM(require_react(), 1);
484189
484429
  function useSubagentCreateDialog() {
484190
- const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0, import_react166.useState)(false);
484191
- const openSubagentCreateDialog = (0, import_react166.useCallback)(() => {
484430
+ const [isSubagentCreateDialogOpen, setIsSubagentCreateDialogOpen] = (0, import_react167.useState)(false);
484431
+ const openSubagentCreateDialog = (0, import_react167.useCallback)(() => {
484192
484432
  setIsSubagentCreateDialogOpen(true);
484193
484433
  }, []);
484194
- const closeSubagentCreateDialog = (0, import_react166.useCallback)(() => {
484434
+ const closeSubagentCreateDialog = (0, import_react167.useCallback)(() => {
484195
484435
  setIsSubagentCreateDialogOpen(false);
484196
484436
  }, []);
484197
484437
  return {
@@ -484204,13 +484444,13 @@ __name(useSubagentCreateDialog, "useSubagentCreateDialog");
484204
484444
 
484205
484445
  // packages/cli/src/ui/hooks/useAgentsManagerDialog.ts
484206
484446
  init_esbuild_shims();
484207
- var import_react167 = __toESM(require_react(), 1);
484447
+ var import_react168 = __toESM(require_react(), 1);
484208
484448
  var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
484209
- const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0, import_react167.useState)(false);
484210
- const openAgentsManagerDialog = (0, import_react167.useCallback)(() => {
484449
+ const [isAgentsManagerDialogOpen, setIsAgentsManagerDialogOpen] = (0, import_react168.useState)(false);
484450
+ const openAgentsManagerDialog = (0, import_react168.useCallback)(() => {
484211
484451
  setIsAgentsManagerDialogOpen(true);
484212
484452
  }, []);
484213
- const closeAgentsManagerDialog = (0, import_react167.useCallback)(() => {
484453
+ const closeAgentsManagerDialog = (0, import_react168.useCallback)(() => {
484214
484454
  setIsAgentsManagerDialogOpen(false);
484215
484455
  }, []);
484216
484456
  return {
@@ -484222,13 +484462,13 @@ var useAgentsManagerDialog = /* @__PURE__ */ __name(() => {
484222
484462
 
484223
484463
  // packages/cli/src/ui/hooks/useExtensionsManagerDialog.ts
484224
484464
  init_esbuild_shims();
484225
- var import_react168 = __toESM(require_react(), 1);
484465
+ var import_react169 = __toESM(require_react(), 1);
484226
484466
  var useExtensionsManagerDialog = /* @__PURE__ */ __name(() => {
484227
- const [isExtensionsManagerDialogOpen, setIsExtensionsManagerDialogOpen] = (0, import_react168.useState)(false);
484228
- const openExtensionsManagerDialog = (0, import_react168.useCallback)(() => {
484467
+ const [isExtensionsManagerDialogOpen, setIsExtensionsManagerDialogOpen] = (0, import_react169.useState)(false);
484468
+ const openExtensionsManagerDialog = (0, import_react169.useCallback)(() => {
484229
484469
  setIsExtensionsManagerDialogOpen(true);
484230
484470
  }, []);
484231
- const closeExtensionsManagerDialog = (0, import_react168.useCallback)(() => {
484471
+ const closeExtensionsManagerDialog = (0, import_react169.useCallback)(() => {
484232
484472
  setIsExtensionsManagerDialogOpen(false);
484233
484473
  }, []);
484234
484474
  return {
@@ -484240,13 +484480,13 @@ var useExtensionsManagerDialog = /* @__PURE__ */ __name(() => {
484240
484480
 
484241
484481
  // packages/cli/src/ui/hooks/useMcpDialog.ts
484242
484482
  init_esbuild_shims();
484243
- var import_react169 = __toESM(require_react(), 1);
484483
+ var import_react170 = __toESM(require_react(), 1);
484244
484484
  var useMcpDialog = /* @__PURE__ */ __name(() => {
484245
- const [isMcpDialogOpen, setIsMcpDialogOpen] = (0, import_react169.useState)(false);
484246
- const openMcpDialog = (0, import_react169.useCallback)(() => {
484485
+ const [isMcpDialogOpen, setIsMcpDialogOpen] = (0, import_react170.useState)(false);
484486
+ const openMcpDialog = (0, import_react170.useCallback)(() => {
484247
484487
  setIsMcpDialogOpen(true);
484248
484488
  }, []);
484249
- const closeMcpDialog = (0, import_react169.useCallback)(() => {
484489
+ const closeMcpDialog = (0, import_react170.useCallback)(() => {
484250
484490
  setIsMcpDialogOpen(false);
484251
484491
  }, []);
484252
484492
  return {
@@ -484258,13 +484498,13 @@ var useMcpDialog = /* @__PURE__ */ __name(() => {
484258
484498
 
484259
484499
  // packages/cli/src/ui/hooks/useHooksDialog.ts
484260
484500
  init_esbuild_shims();
484261
- var import_react170 = __toESM(require_react(), 1);
484501
+ var import_react171 = __toESM(require_react(), 1);
484262
484502
  var useHooksDialog = /* @__PURE__ */ __name(() => {
484263
- const [isHooksDialogOpen, setIsHooksDialogOpen] = (0, import_react170.useState)(false);
484264
- const openHooksDialog = (0, import_react170.useCallback)(() => {
484503
+ const [isHooksDialogOpen, setIsHooksDialogOpen] = (0, import_react171.useState)(false);
484504
+ const openHooksDialog = (0, import_react171.useCallback)(() => {
484265
484505
  setIsHooksDialogOpen(true);
484266
484506
  }, []);
484267
- const closeHooksDialog = (0, import_react170.useCallback)(() => {
484507
+ const closeHooksDialog = (0, import_react171.useCallback)(() => {
484268
484508
  setIsHooksDialogOpen(false);
484269
484509
  }, []);
484270
484510
  return {
@@ -484276,7 +484516,7 @@ var useHooksDialog = /* @__PURE__ */ __name(() => {
484276
484516
 
484277
484517
  // packages/cli/src/ui/hooks/useAttentionNotifications.ts
484278
484518
  init_esbuild_shims();
484279
- var import_react171 = __toESM(require_react(), 1);
484519
+ var import_react172 = __toESM(require_react(), 1);
484280
484520
 
484281
484521
  // packages/cli/src/utils/attentionNotification.ts
484282
484522
  init_esbuild_shims();
@@ -484313,10 +484553,10 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
484313
484553
  config: config2
484314
484554
  }) => {
484315
484555
  const terminalBellEnabled = settings2?.merged?.general?.terminalBell ?? true;
484316
- const awaitingNotificationSentRef = (0, import_react171.useRef)(false);
484317
- const respondingElapsedRef = (0, import_react171.useRef)(0);
484318
- const idleNotificationSentRef = (0, import_react171.useRef)(false);
484319
- (0, import_react171.useEffect)(() => {
484556
+ const awaitingNotificationSentRef = (0, import_react172.useRef)(false);
484557
+ const respondingElapsedRef = (0, import_react172.useRef)(0);
484558
+ const idleNotificationSentRef = (0, import_react172.useRef)(false);
484559
+ (0, import_react172.useEffect)(() => {
484320
484560
  if (streamingState === "waiting_for_confirmation" /* WaitingForConfirmation */ && !isFocused && !awaitingNotificationSentRef.current) {
484321
484561
  notifyTerminalAttention("tool_approval" /* ToolApproval */, {
484322
484562
  enabled: terminalBellEnabled
@@ -484327,7 +484567,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
484327
484567
  awaitingNotificationSentRef.current = false;
484328
484568
  }
484329
484569
  }, [isFocused, streamingState, terminalBellEnabled]);
484330
- (0, import_react171.useEffect)(() => {
484570
+ (0, import_react172.useEffect)(() => {
484331
484571
  if (streamingState === "responding" /* Responding */) {
484332
484572
  respondingElapsedRef.current = elapsedTime;
484333
484573
  idleNotificationSentRef.current = false;
@@ -484363,7 +484603,7 @@ var useAttentionNotifications = /* @__PURE__ */ __name(({
484363
484603
 
484364
484604
  // packages/cli/src/ui/hooks/useVoice.ts
484365
484605
  init_esbuild_shims();
484366
- var import_react172 = __toESM(require_react(), 1);
484606
+ var import_react173 = __toESM(require_react(), 1);
484367
484607
  import os46 from "node:os";
484368
484608
  import path144 from "node:path";
484369
484609
  import fs129 from "node:fs";
@@ -484398,12 +484638,12 @@ __name(transcribe, "transcribe");
484398
484638
 
484399
484639
  // packages/cli/src/ui/hooks/useVoice.ts
484400
484640
  function useVoice(sttEndpoint, sttApiKey) {
484401
- const [voiceState, setVoiceState] = (0, import_react172.useState)("idle");
484402
- const [error40, setError] = (0, import_react172.useState)(null);
484403
- const procRef = (0, import_react172.useRef)(null);
484404
- const audioPathRef = (0, import_react172.useRef)(null);
484405
- const backend = (0, import_react172.useMemo)(() => detectBackend2(), []);
484406
- const start2 = (0, import_react172.useCallback)(async () => {
484641
+ const [voiceState, setVoiceState] = (0, import_react173.useState)("idle");
484642
+ const [error40, setError] = (0, import_react173.useState)(null);
484643
+ const procRef = (0, import_react173.useRef)(null);
484644
+ const audioPathRef = (0, import_react173.useRef)(null);
484645
+ const backend = (0, import_react173.useMemo)(() => detectBackend2(), []);
484646
+ const start2 = (0, import_react173.useCallback)(async () => {
484407
484647
  if (voiceState !== "idle") return;
484408
484648
  const tmpPath = path144.join(os46.tmpdir(), `proto-voice-${Date.now()}.wav`);
484409
484649
  audioPathRef.current = tmpPath;
@@ -484416,7 +484656,7 @@ function useVoice(sttEndpoint, sttApiKey) {
484416
484656
  setError(e4 instanceof Error ? e4.message : String(e4));
484417
484657
  }
484418
484658
  }, [voiceState, backend]);
484419
- const stop3 = (0, import_react172.useCallback)(async () => {
484659
+ const stop3 = (0, import_react173.useCallback)(async () => {
484420
484660
  if (voiceState !== "recording" || !procRef.current || !audioPathRef.current) {
484421
484661
  return "";
484422
484662
  }
@@ -484449,7 +484689,7 @@ function useVoice(sttEndpoint, sttApiKey) {
484449
484689
  return "";
484450
484690
  }
484451
484691
  }, [voiceState, sttEndpoint, sttApiKey]);
484452
- const reset = (0, import_react172.useCallback)(() => {
484692
+ const reset = (0, import_react173.useCallback)(() => {
484453
484693
  setVoiceState("idle");
484454
484694
  setError(null);
484455
484695
  }, []);
@@ -484484,21 +484724,21 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
484484
484724
  const { settings: settings2, config: config2, initializationResult } = props;
484485
484725
  const historyManager = useHistory();
484486
484726
  useMemoryMonitor(historyManager);
484487
- const [debugMessage, setDebugMessage] = (0, import_react173.useState)("");
484488
- const [quittingMessages, setQuittingMessages] = (0, import_react173.useState)(null);
484489
- const [themeError, setThemeError] = (0, import_react173.useState)(
484727
+ const [debugMessage, setDebugMessage] = (0, import_react174.useState)("");
484728
+ const [quittingMessages, setQuittingMessages] = (0, import_react174.useState)(null);
484729
+ const [themeError, setThemeError] = (0, import_react174.useState)(
484490
484730
  initializationResult.themeError
484491
484731
  );
484492
- const [isProcessing, setIsProcessing] = (0, import_react173.useState)(false);
484493
- const [embeddedShellFocused, setEmbeddedShellFocused] = (0, import_react173.useState)(false);
484494
- const [geminiMdFileCount, setGeminiMdFileCount] = (0, import_react173.useState)(
484732
+ const [isProcessing, setIsProcessing] = (0, import_react174.useState)(false);
484733
+ const [embeddedShellFocused, setEmbeddedShellFocused] = (0, import_react174.useState)(false);
484734
+ const [geminiMdFileCount, setGeminiMdFileCount] = (0, import_react174.useState)(
484495
484735
  initializationResult.geminiMdFileCount
484496
484736
  );
484497
- const [shellModeActive, setShellModeActive] = (0, import_react173.useState)(false);
484498
- const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0, import_react173.useState)(false);
484499
- const [historyRemountKey, setHistoryRemountKey] = (0, import_react173.useState)(0);
484500
- const [updateInfo, setUpdateInfo] = (0, import_react173.useState)(null);
484501
- const [isTrustedFolder, setIsTrustedFolder] = (0, import_react173.useState)(
484737
+ const [shellModeActive, setShellModeActive] = (0, import_react174.useState)(false);
484738
+ const [modelSwitchedFromQuotaError, setModelSwitchedFromQuotaError] = (0, import_react174.useState)(false);
484739
+ const [historyRemountKey, setHistoryRemountKey] = (0, import_react174.useState)(0);
484740
+ const [updateInfo, setUpdateInfo] = (0, import_react174.useState)(null);
484741
+ const [isTrustedFolder, setIsTrustedFolder] = (0, import_react174.useState)(
484502
484742
  config2.isTrustedFolder()
484503
484743
  );
484504
484744
  const extensionManager = config2.getExtensionManager();
@@ -484553,36 +484793,48 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
484553
484793
  config2.getWorkingDir()
484554
484794
  );
484555
484795
  const { codingPlanUpdateRequest, dismissCodingPlanUpdate } = useCodingPlanUpdates(settings2, config2, historyManager.addItem);
484556
- const [isTrustDialogOpen, setTrustDialogOpen] = (0, import_react173.useState)(false);
484557
- const openTrustDialog = (0, import_react173.useCallback)(() => setTrustDialogOpen(true), []);
484558
- const closeTrustDialog = (0, import_react173.useCallback)(() => setTrustDialogOpen(false), []);
484559
- const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0, import_react173.useState)(false);
484560
- const openPermissionsDialog = (0, import_react173.useCallback)(
484796
+ const [isTrustDialogOpen, setTrustDialogOpen] = (0, import_react174.useState)(false);
484797
+ const openTrustDialog = (0, import_react174.useCallback)(() => setTrustDialogOpen(true), []);
484798
+ const closeTrustDialog = (0, import_react174.useCallback)(() => setTrustDialogOpen(false), []);
484799
+ const [isPermissionsDialogOpen, setPermissionsDialogOpen] = (0, import_react174.useState)(false);
484800
+ const openPermissionsDialog = (0, import_react174.useCallback)(
484561
484801
  () => setPermissionsDialogOpen(true),
484562
484802
  []
484563
484803
  );
484564
- const closePermissionsDialog = (0, import_react173.useCallback)(
484804
+ const closePermissionsDialog = (0, import_react174.useCallback)(
484565
484805
  () => setPermissionsDialogOpen(false),
484566
484806
  []
484567
484807
  );
484568
- const getCurrentModel = (0, import_react173.useCallback)(() => config2.getModel(), [config2]);
484569
- const [currentModel, setCurrentModel] = (0, import_react173.useState)(getCurrentModel());
484570
- const [isConfigInitialized, setConfigInitialized] = (0, import_react173.useState)(false);
484571
- const [userMessages, setUserMessages] = (0, import_react173.useState)([]);
484808
+ const getCurrentModel = (0, import_react174.useCallback)(() => config2.getModel(), [config2]);
484809
+ const [currentModel, setCurrentModel] = (0, import_react174.useState)(getCurrentModel());
484810
+ const [isConfigInitialized, setConfigInitialized] = (0, import_react174.useState)(false);
484811
+ const [userMessages, setUserMessages] = (0, import_react174.useState)([]);
484572
484812
  const { columns: terminalWidth, rows: terminalHeight } = useTerminalSize();
484573
484813
  const { stdin: stdin2, setRawMode } = use_stdin_default();
484574
484814
  const { stdout: stdout2 } = use_stdout_default();
484575
484815
  const { stats: sessionStats, startNewSession } = useSessionStats();
484576
484816
  const logger9 = useLogger(config2.storage, sessionStats.sessionId);
484577
484817
  const branchName = useGitBranchName(config2.getTargetDir());
484578
- const mainControlsRef = (0, import_react173.useRef)(null);
484818
+ const mainControlsRef = (0, import_react174.useRef)(null);
484579
484819
  const staticExtraHeight = 3;
484580
484820
  useInitializationEffects(config2, historyManager, setConfigInitialized);
484581
- (0, import_react173.useEffect)(
484821
+ (0, import_react174.useEffect)(
484582
484822
  () => setUpdateHandler(historyManager.addItem, setUpdateInfo),
484583
484823
  [historyManager.addItem]
484584
484824
  );
484585
- (0, import_react173.useEffect)(() => {
484825
+ const { lastFinished } = useBackgroundAgentProgress();
484826
+ const addHistoryItem = historyManager.addItem;
484827
+ (0, import_react174.useEffect)(() => {
484828
+ if (!lastFinished?.hitLimit) return;
484829
+ addHistoryItem(
484830
+ {
484831
+ type: "warning" /* WARNING */,
484832
+ text: `Background agent "${lastFinished.agentName}" hit its ${lastFinished.terminateReason === "timeout" ? "time" : "turn"} limit after ${lastFinished.rounds} round(s) \u2014 notes may be partially updated.`
484833
+ },
484834
+ Date.now()
484835
+ );
484836
+ }, [lastFinished, addHistoryItem]);
484837
+ (0, import_react174.useEffect)(() => {
484586
484838
  const interval = setInterval(() => {
484587
484839
  const model = getCurrentModel();
484588
484840
  if (model !== currentModel) {
@@ -484591,13 +484843,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
484591
484843
  }, 1e3);
484592
484844
  return () => clearInterval(interval);
484593
484845
  }, [config2, currentModel, getCurrentModel]);
484594
- const { inputWidth, suggestionsWidth } = (0, import_react173.useMemo)(() => {
484846
+ const { inputWidth, suggestionsWidth } = (0, import_react174.useMemo)(() => {
484595
484847
  const { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 } = calculatePromptWidths(terminalWidth);
484596
484848
  return { inputWidth: inputWidth2, suggestionsWidth: suggestionsWidth2 };
484597
484849
  }, [terminalWidth]);
484598
484850
  const mainAreaWidth = Math.min(terminalWidth - 4, 100);
484599
484851
  const staticAreaMaxItemHeight = Math.max(terminalHeight * 4, 100);
484600
- const isValidPath = (0, import_react173.useCallback)((filePath) => {
484852
+ const isValidPath = (0, import_react174.useCallback)((filePath) => {
484601
484853
  try {
484602
484854
  return fs130.existsSync(filePath) && fs130.statSync(filePath).isFile();
484603
484855
  } catch (_e2) {
@@ -484612,7 +484864,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
484612
484864
  isValidPath,
484613
484865
  shellModeActive
484614
484866
  });
484615
- (0, import_react173.useEffect)(() => {
484867
+ (0, import_react174.useEffect)(() => {
484616
484868
  const fetchUserMessages = /* @__PURE__ */ __name(async () => {
484617
484869
  const pastMessagesRaw = await logger9?.getPreviousUserMessages() || [];
484618
484870
  const currentSessionUserMessages = historyManager.history.filter(
@@ -484635,7 +484887,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
484635
484887
  }, "fetchUserMessages");
484636
484888
  fetchUserMessages();
484637
484889
  }, [historyManager.history, logger9]);
484638
- const refreshStatic = (0, import_react173.useCallback)(() => {
484890
+ const refreshStatic = (0, import_react174.useCallback)(() => {
484639
484891
  stdout2.write("\x1B[?2026h");
484640
484892
  stdout2.write(base_exports.clearTerminal);
484641
484893
  stdout2.write("\x1B[?2026l");
@@ -484671,7 +484923,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
484671
484923
  cancelAuthentication
484672
484924
  } = useAuthCommand(settings2, config2, historyManager.addItem, refreshStatic);
484673
484925
  useInitializationAuthError(initializationResult.authError, onAuthError);
484674
- (0, import_react173.useEffect)(() => {
484926
+ (0, import_react174.useEffect)(() => {
484675
484927
  const currentAuthType = config2.getModelsConfig().getCurrentAuthType();
484676
484928
  if (settings2.merged.security?.auth?.enforcedType && currentAuthType && settings2.merged.security?.auth.enforcedType !== currentAuthType) {
484677
484929
  onAuthError(
@@ -484697,7 +484949,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
484697
484949
  config2,
484698
484950
  onAuthError
484699
484951
  ]);
484700
- const [editorError, setEditorError] = (0, import_react173.useState)(null);
484952
+ const [editorError, setEditorError] = (0, import_react174.useState)(null);
484701
484953
  const {
484702
484954
  isEditorDialogOpen,
484703
484955
  openEditorDialog,
@@ -484741,10 +484993,10 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
484741
484993
  } = useExtensionsManagerDialog();
484742
484994
  const { isMcpDialogOpen, openMcpDialog, closeMcpDialog } = useMcpDialog();
484743
484995
  const { isHooksDialogOpen, openHooksDialog, closeHooksDialog } = useHooksDialog();
484744
- const [isRewindDialogOpen, setIsRewindDialogOpen] = (0, import_react173.useState)(false);
484745
- const openRewindDialog = (0, import_react173.useCallback)(() => setIsRewindDialogOpen(true), []);
484746
- const closeRewindDialog = (0, import_react173.useCallback)(() => setIsRewindDialogOpen(false), []);
484747
- const slashCommandActions = (0, import_react173.useMemo)(
484996
+ const [isRewindDialogOpen, setIsRewindDialogOpen] = (0, import_react174.useState)(false);
484997
+ const openRewindDialog = (0, import_react174.useCallback)(() => setIsRewindDialogOpen(true), []);
484998
+ const closeRewindDialog = (0, import_react174.useCallback)(() => setIsRewindDialogOpen(false), []);
484999
+ const slashCommandActions = (0, import_react174.useMemo)(
484748
485000
  () => ({
484749
485001
  openAuthDialog,
484750
485002
  openThemeDialog,
@@ -484822,14 +485074,15 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
484822
485074
  isConfigInitialized,
484823
485075
  logger9
484824
485076
  );
484825
- const onDebugMessage = (0, import_react173.useCallback)(
485077
+ const onDebugMessage = (0, import_react174.useCallback)(
484826
485078
  (message) => {
484827
485079
  config2.getDebugLogger().debug(message);
484828
485080
  },
484829
485081
  [config2]
484830
485082
  );
484831
- const performMemoryRefresh = (0, import_react173.useCallback)(async () => {
484832
- historyManager.addItem(
485083
+ const stableAddItem = historyManager.addItem;
485084
+ const performMemoryRefresh = (0, import_react174.useCallback)(async () => {
485085
+ stableAddItem(
484833
485086
  {
484834
485087
  type: "info" /* INFO */,
484835
485088
  text: "Refreshing hierarchical memory (QWEN.md or other context files)..."
@@ -484849,7 +485102,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
484849
485102
  config2.setUserMemory(memoryContent);
484850
485103
  config2.setGeminiMdFileCount(fileCount);
484851
485104
  setGeminiMdFileCount(fileCount);
484852
- historyManager.addItem(
485105
+ stableAddItem(
484853
485106
  {
484854
485107
  type: "info" /* INFO */,
484855
485108
  text: `Memory refreshed successfully. ${memoryContent.length > 0 ? `Loaded ${memoryContent.length} characters from ${fileCount} file(s).` : "No memory content found."}`
@@ -484864,7 +485117,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
484864
485117
  );
484865
485118
  } catch (error40) {
484866
485119
  const errorMessage = getErrorMessage(error40);
484867
- historyManager.addItem(
485120
+ stableAddItem(
484868
485121
  {
484869
485122
  type: "error" /* ERROR */,
484870
485123
  text: `Error refreshing memory: ${errorMessage}`
@@ -484873,8 +485126,8 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
484873
485126
  );
484874
485127
  debugLogger152.error("Error refreshing memory:", error40);
484875
485128
  }
484876
- }, [config2, historyManager, settings2.merged]);
484877
- const cancelHandlerRef = (0, import_react173.useRef)(() => {
485129
+ }, [config2, stableAddItem, settings2.merged]);
485130
+ const cancelHandlerRef = (0, import_react174.useRef)(() => {
484878
485131
  });
484879
485132
  const { messageQueue, addMessage, popLast, drain } = useMessageQueue();
484880
485133
  const voiceEnabled = settings2.merged.voice?.enabled ?? false;
@@ -484925,7 +485178,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
484925
485178
  drain,
484926
485179
  submitQuery
484927
485180
  );
484928
- const [hasSuggestionsVisible, setHasSuggestionsVisible] = (0, import_react173.useState)(false);
485181
+ const [hasSuggestionsVisible, setHasSuggestionsVisible] = (0, import_react174.useState)(false);
484929
485182
  const agentViewState = useAgentViewState();
484930
485183
  const geminiClient = config2.getGeminiClient();
484931
485184
  const showAutoAcceptIndicator = useAutoAcceptIndicator({
@@ -484953,7 +485206,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
484953
485206
  settingInputRequests,
484954
485207
  pendingGeminiHistoryItems
484955
485208
  });
484956
- const handleFinalSubmit = (0, import_react173.useCallback)(
485209
+ const handleFinalSubmit = (0, import_react174.useCallback)(
484957
485210
  (submittedValue) => {
484958
485211
  if (agentViewState.activeView !== "main") {
484959
485212
  const agent = agentViewState.agents.get(agentViewState.activeView);
@@ -485061,7 +485314,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
485061
485314
  speculationRef
485062
485315
  ]
485063
485316
  );
485064
- const handleArenaModelsSelected = (0, import_react173.useCallback)(
485317
+ const handleArenaModelsSelected = (0, import_react174.useCallback)(
485065
485318
  (models) => {
485066
485319
  const value = models.join(",");
485067
485320
  buffer.setText(`/arena start --models ${value} `);
@@ -485076,7 +485329,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
485076
485329
  handleWelcomeBackSelection,
485077
485330
  handleWelcomeBackClose
485078
485331
  } = useWelcomeBack(config2, handleFinalSubmit, buffer, settings2.merged);
485079
- cancelHandlerRef.current = (0, import_react173.useCallback)(() => {
485332
+ cancelHandlerRef.current = (0, import_react174.useCallback)(() => {
485080
485333
  const pendingHistoryItems2 = [
485081
485334
  ...pendingSlashCommandHistoryItems,
485082
485335
  ...pendingGeminiHistoryItems
@@ -485101,15 +485354,15 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
485101
485354
  pendingSlashCommandHistoryItems,
485102
485355
  pendingGeminiHistoryItems
485103
485356
  ]);
485104
- const handleClearScreen = (0, import_react173.useCallback)(() => {
485357
+ const handleClearScreen = (0, import_react174.useCallback)(() => {
485105
485358
  historyManager.clearItems();
485106
485359
  clearScreen2();
485107
485360
  refreshStatic();
485108
485361
  }, [historyManager, refreshStatic]);
485109
485362
  const { handleInput: vimHandleInput } = useVim(buffer, handleFinalSubmit);
485110
485363
  const isInputActive = !initError && !isProcessing && (streamingState === "idle" /* Idle */ || streamingState === "responding" /* Responding */);
485111
- const [controlsHeight, setControlsHeight] = (0, import_react173.useState)(0);
485112
- (0, import_react173.useLayoutEffect)(() => {
485364
+ const [controlsHeight, setControlsHeight] = (0, import_react174.useState)(0);
485365
+ (0, import_react174.useLayoutEffect)(() => {
485113
485366
  if (mainControlsRef.current) {
485114
485367
  const fullFooterMeasurement = measure_element_default(mainControlsRef.current);
485115
485368
  if (fullFooterMeasurement.height > 0) {
@@ -485133,13 +485386,13 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
485133
485386
  });
485134
485387
  const isFocused = useFocus();
485135
485388
  useBracketedPaste();
485136
- const contextFileNames = (0, import_react173.useMemo)(() => {
485389
+ const contextFileNames = (0, import_react174.useMemo)(() => {
485137
485390
  const fromSettings = settings2.merged.context?.fileName;
485138
485391
  return fromSettings ? Array.isArray(fromSettings) ? fromSettings : [fromSettings] : getAllGeminiMdFilenames();
485139
485392
  }, [settings2.merged.context?.fileName]);
485140
- const initialPrompt = (0, import_react173.useMemo)(() => config2.getQuestion(), [config2]);
485141
- const initialPromptSubmitted = (0, import_react173.useRef)(false);
485142
- (0, import_react173.useEffect)(() => {
485393
+ const initialPrompt = (0, import_react174.useMemo)(() => config2.getQuestion(), [config2]);
485394
+ const initialPromptSubmitted = (0, import_react174.useRef)(false);
485395
+ (0, import_react174.useEffect)(() => {
485143
485396
  if (activePtyId) {
485144
485397
  ShellExecutionService.resizePty(
485145
485398
  activePtyId,
@@ -485148,7 +485401,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
485148
485401
  );
485149
485402
  }
485150
485403
  }, [terminalWidth, availableTerminalHeight, activePtyId]);
485151
- (0, import_react173.useEffect)(() => {
485404
+ (0, import_react174.useEffect)(() => {
485152
485405
  if (initialPrompt && isConfigInitialized && !initialPromptSubmitted.current && !isAuthenticating && !isAuthDialogOpen && !isThemeDialogOpen && !isEditorDialogOpen && !showWelcomeBackDialog && welcomeBackChoice !== "restart" && geminiClient?.isInitialized?.()) {
485153
485406
  handleFinalSubmit(initialPrompt);
485154
485407
  initialPromptSubmitted.current = true;
@@ -485165,9 +485418,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
485165
485418
  welcomeBackChoice,
485166
485419
  geminiClient
485167
485420
  ]);
485168
- const [idePromptAnswered, setIdePromptAnswered] = (0, import_react173.useState)(false);
485169
- const [currentIDE, setCurrentIDE] = (0, import_react173.useState)(null);
485170
- (0, import_react173.useEffect)(() => {
485421
+ const [idePromptAnswered, setIdePromptAnswered] = (0, import_react174.useState)(false);
485422
+ const [currentIDE, setCurrentIDE] = (0, import_react174.useState)(null);
485423
+ (0, import_react174.useEffect)(() => {
485171
485424
  const getIde = /* @__PURE__ */ __name(async () => {
485172
485425
  const ideClient = await IdeClient.getInstance();
485173
485426
  const currentIde = ideClient.getCurrentIde();
@@ -485183,20 +485436,20 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
485183
485436
  tomlFiles: commandMigrationTomlFiles,
485184
485437
  setShowMigrationNudge: setShowCommandMigrationNudge
485185
485438
  } = useCommandMigration(settings2, config2.storage);
485186
- const [ideContextState, setIdeContextState] = (0, import_react173.useState)();
485187
- const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0, import_react173.useState)(false);
485439
+ const [ideContextState, setIdeContextState] = (0, import_react174.useState)();
485440
+ const [showIdeRestartPrompt, setShowIdeRestartPrompt] = (0, import_react174.useState)(false);
485188
485441
  const { isFolderTrustDialogOpen, handleFolderTrustSelect, isRestarting } = useFolderTrust(settings2, setIsTrustedFolder);
485189
485442
  const {
485190
485443
  needsRestart: ideNeedsRestart,
485191
485444
  restartReason: ideTrustRestartReason
485192
485445
  } = useIdeTrustListener();
485193
- const isInitialMount = (0, import_react173.useRef)(true);
485194
- (0, import_react173.useEffect)(() => {
485446
+ const isInitialMount = (0, import_react174.useRef)(true);
485447
+ (0, import_react174.useEffect)(() => {
485195
485448
  if (ideNeedsRestart) {
485196
485449
  setShowIdeRestartPrompt(true);
485197
485450
  }
485198
485451
  }, [ideNeedsRestart]);
485199
- (0, import_react173.useEffect)(() => {
485452
+ (0, import_react174.useEffect)(() => {
485200
485453
  if (isInitialMount.current) {
485201
485454
  isInitialMount.current = false;
485202
485455
  return;
@@ -485208,12 +485461,12 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
485208
485461
  clearTimeout(handler);
485209
485462
  };
485210
485463
  }, [terminalWidth, refreshStatic]);
485211
- (0, import_react173.useEffect)(() => {
485464
+ (0, import_react174.useEffect)(() => {
485212
485465
  const unsubscribe = ideContextStore.subscribe(setIdeContextState);
485213
485466
  setIdeContextState(ideContextStore.get());
485214
485467
  return unsubscribe;
485215
485468
  }, []);
485216
- const handleIdePromptComplete = (0, import_react173.useCallback)(
485469
+ const handleIdePromptComplete = (0, import_react174.useCallback)(
485217
485470
  (result) => {
485218
485471
  if (result.userSelection === "yes") {
485219
485472
  if (result.isExtensionPreInstalled) {
@@ -485229,7 +485482,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
485229
485482
  },
485230
485483
  [handleSlashCommand2, settings2]
485231
485484
  );
485232
- const handleCommandMigrationComplete = (0, import_react173.useCallback)(
485485
+ const handleCommandMigrationComplete = (0, import_react174.useCallback)(
485233
485486
  async (result) => {
485234
485487
  setShowCommandMigrationNudge(false);
485235
485488
  if (result.userSelection === "yes") {
@@ -485387,11 +485640,11 @@ ${migrationResult.failedFiles.map((f5) => ` \u2022 ${f5.file}: ${f5.error}`).jo
485387
485640
  history: historyManager.history,
485388
485641
  sessionStats
485389
485642
  });
485390
- const pendingHistoryItems = (0, import_react173.useMemo)(
485643
+ const pendingHistoryItems = (0, import_react174.useMemo)(
485391
485644
  () => [...pendingSlashCommandHistoryItems, ...pendingGeminiHistoryItems],
485392
485645
  [pendingSlashCommandHistoryItems, pendingGeminiHistoryItems]
485393
485646
  );
485394
- const uiState = (0, import_react173.useMemo)(
485647
+ const uiState = (0, import_react174.useMemo)(
485395
485648
  () => ({
485396
485649
  history: historyManager.history,
485397
485650
  historyManager,
@@ -485616,7 +485869,7 @@ ${migrationResult.failedFiles.map((f5) => ` \u2022 ${f5.file}: ${f5.error}`).jo
485616
485869
  dismissPromptSuggestion
485617
485870
  ]
485618
485871
  );
485619
- const uiActions = (0, import_react173.useMemo)(
485872
+ const uiActions = (0, import_react174.useMemo)(
485620
485873
  () => ({
485621
485874
  openThemeDialog,
485622
485875
  openEditorDialog,
@@ -485767,9 +486020,9 @@ ${migrationResult.failedFiles.map((f5) => ` \u2022 ${f5.file}: ${f5.error}`).jo
485767
486020
 
485768
486021
  // packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts
485769
486022
  init_esbuild_shims();
485770
- var import_react174 = __toESM(require_react(), 1);
486023
+ var import_react175 = __toESM(require_react(), 1);
485771
486024
  function useKittyKeyboardProtocol() {
485772
- const [status] = (0, import_react174.useState)({
486025
+ const [status] = (0, import_react175.useState)({
485773
486026
  supported: isKittyProtocolSupported(),
485774
486027
  enabled: isKittyProtocolEnabled(),
485775
486028
  checking: false
@@ -486749,7 +487002,7 @@ __name(validateNonInteractiveAuth, "validateNonInteractiveAuth");
486749
487002
 
486750
487003
  // packages/cli/src/ui/components/StandaloneSessionPicker.tsx
486751
487004
  init_esbuild_shims();
486752
- var import_react175 = __toESM(require_react(), 1);
487005
+ var import_react176 = __toESM(require_react(), 1);
486753
487006
  init_dist4();
486754
487007
  var import_jsx_runtime141 = __toESM(require_jsx_runtime(), 1);
486755
487008
  function StandalonePickerScreen({
@@ -486759,7 +487012,7 @@ function StandalonePickerScreen({
486759
487012
  currentBranch
486760
487013
  }) {
486761
487014
  const { exit } = use_app_default();
486762
- const [isExiting, setIsExiting] = (0, import_react175.useState)(false);
487015
+ const [isExiting, setIsExiting] = (0, import_react176.useState)(false);
486763
487016
  const handleExit = /* @__PURE__ */ __name(() => {
486764
487017
  setIsExiting(true);
486765
487018
  exit();
@@ -489814,7 +490067,7 @@ var QwenAgent = class {
489814
490067
  async initialize(args2) {
489815
490068
  this.clientCapabilities = args2.clientCapabilities;
489816
490069
  const authMethods = buildAuthMethods();
489817
- const version2 = "0.25.4";
490070
+ const version2 = "0.25.5";
489818
490071
  return {
489819
490072
  protocolVersion: PROTOCOL_VERSION,
489820
490073
  agentInfo: {
@@ -490245,7 +490498,7 @@ async function startInteractiveUI(config2, settings2, startupWarnings, workspace
490245
490498
  ) });
490246
490499
  }, "AppWrapper");
490247
490500
  const instance2 = render_default(
490248
- process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_react176.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(AppWrapper, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(AppWrapper, {}),
490501
+ process.env["DEBUG"] ? /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_react177.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(AppWrapper, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(AppWrapper, {}),
490249
490502
  {
490250
490503
  exitOnCtrlC: false,
490251
490504
  patchConsole: false,
@@ -490553,6 +490806,24 @@ main().catch((error40) => {
490553
490806
  * Copyright 2026 Qwen Team
490554
490807
  * SPDX-License-Identifier: Apache-2.0
490555
490808
  */
490809
+ /**
490810
+ * @license
490811
+ * Copyright 2025 protoLabs
490812
+ * SPDX-License-Identifier: Apache-2.0
490813
+ *
490814
+ * Stream stall detection — per-chunk idle watchdog for async generators.
490815
+ *
490816
+ * The SDK's overall request timeout (120 s) covers the full lifetime of a
490817
+ * request, but undici body/header timeouts are explicitly disabled in
490818
+ * runtimeFetchOptions.ts to allow long streaming responses. This means a
490819
+ * stream that *starts* and then *freezes* (connection open, no more chunks
490820
+ * arriving) will not be detected until the full 120 s wall clock fires.
490821
+ *
490822
+ * `withChunkTimeout` wraps any AsyncGenerator and races each `.next()` call
490823
+ * against a per-chunk idle timer. If no chunk arrives within `timeoutMs`,
490824
+ * it throws `StreamStallError`, closes the upstream generator, and lets the
490825
+ * caller (Turn.run) surface it as a retryable error.
490826
+ */
490556
490827
  /**
490557
490828
  * @license
490558
490829
  * Copyright 2025 protoLabs
@@ -490589,6 +490860,27 @@ main().catch((error40) => {
490589
490860
  * Copyright 2025 protoLabs.studio
490590
490861
  * SPDX-License-Identifier: Apache-2.0
490591
490862
  */
490863
+ /**
490864
+ * @license
490865
+ * Copyright 2025 protoLabs
490866
+ * SPDX-License-Identifier: Apache-2.0
490867
+ *
490868
+ * Global singleton event bus for background agent progress.
490869
+ *
490870
+ * Background agents (session memory extractor, AgentTool background workers)
490871
+ * emit their lifecycle events here. The CLI layer subscribes to surface
490872
+ * progress in the UI without polling or blocking the main agent loop.
490873
+ *
490874
+ * Usage:
490875
+ * // In core — forward a local AgentEventEmitter into this bus:
490876
+ * import { bridgeToProgressBus } from './backgroundProgressEmitter.js';
490877
+ * const emitter = new AgentEventEmitter();
490878
+ * bridgeToProgressBus(emitter, agentName, agentId);
490879
+ *
490880
+ * // In CLI — subscribe:
490881
+ * import { backgroundProgressEmitter } from '@qwen-code/qwen-code-core';
490882
+ * backgroundProgressEmitter.on('agent_start', handler);
490883
+ */
490592
490884
  /**
490593
490885
  * @license
490594
490886
  * Copyright 2025 Qwen Team