atlarix 14.41.0 → 14.43.0

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.
@@ -6528,10 +6528,10 @@ var init_session2 = __esm({
6528
6528
  }
6529
6529
  };
6530
6530
  PreparedQuery = class extends SQLitePreparedQuery {
6531
- constructor(stmt, query, logger93, cache6, queryMetadata, cacheConfig, fields, executeMethod, _isResponseInArrayMode, customResultMapper) {
6531
+ constructor(stmt, query, logger94, cache6, queryMetadata, cacheConfig, fields, executeMethod, _isResponseInArrayMode, customResultMapper) {
6532
6532
  super("sync", executeMethod, query, cache6, queryMetadata, cacheConfig);
6533
6533
  this.stmt = stmt;
6534
- this.logger = logger93;
6534
+ this.logger = logger94;
6535
6535
  this.fields = fields;
6536
6536
  this._isResponseInArrayMode = _isResponseInArrayMode;
6537
6537
  this.customResultMapper = customResultMapper;
@@ -6543,10 +6543,10 @@ var init_session2 = __esm({
6543
6543
  return this.stmt.run(...params);
6544
6544
  }
6545
6545
  all(placeholderValues) {
6546
- const { fields, joinsNotNullableMap, query, logger: logger93, stmt, customResultMapper } = this;
6546
+ const { fields, joinsNotNullableMap, query, logger: logger94, stmt, customResultMapper } = this;
6547
6547
  if (!fields && !customResultMapper) {
6548
6548
  const params = fillPlaceholders(query.params, placeholderValues ?? {});
6549
- logger93.logQuery(query.sql, params);
6549
+ logger94.logQuery(query.sql, params);
6550
6550
  return stmt.all(...params);
6551
6551
  }
6552
6552
  const rows = this.values(placeholderValues);
@@ -6588,11 +6588,11 @@ var init_session2 = __esm({
6588
6588
  import Client from "better-sqlite3";
6589
6589
  function construct(client2, config2 = {}) {
6590
6590
  const dialect = new SQLiteSyncDialect({ casing: config2.casing });
6591
- let logger93;
6591
+ let logger94;
6592
6592
  if (config2.logger === true) {
6593
- logger93 = new DefaultLogger();
6593
+ logger94 = new DefaultLogger();
6594
6594
  } else if (config2.logger !== false) {
6595
- logger93 = config2.logger;
6595
+ logger94 = config2.logger;
6596
6596
  }
6597
6597
  let schema;
6598
6598
  if (config2.schema) {
@@ -6606,7 +6606,7 @@ function construct(client2, config2 = {}) {
6606
6606
  tableNamesMap: tablesConfig.tableNamesMap
6607
6607
  };
6608
6608
  }
6609
- const session2 = new BetterSQLiteSession(client2, dialect, schema, { logger: logger93 });
6609
+ const session2 = new BetterSQLiteSession(client2, dialect, schema, { logger: logger94 });
6610
6610
  const db2 = new BetterSQLite3Database("sync", dialect, session2, schema);
6611
6611
  db2.$client = client2;
6612
6612
  return db2;
@@ -7791,7 +7791,7 @@ var require_scope = __commonJS({
7791
7791
  "node_modules/electron-log/src/core/scope.js"(exports2, module2) {
7792
7792
  "use strict";
7793
7793
  module2.exports = scopeFactory;
7794
- function scopeFactory(logger93) {
7794
+ function scopeFactory(logger94) {
7795
7795
  return Object.defineProperties(scope, {
7796
7796
  defaultLabel: { value: "", writable: true },
7797
7797
  labelPadding: { value: true, writable: true },
@@ -7812,8 +7812,8 @@ var require_scope = __commonJS({
7812
7812
  function scope(label) {
7813
7813
  scope.maxLabelLength = Math.max(scope.maxLabelLength, label.length);
7814
7814
  const newScope = {};
7815
- for (const level of logger93.levels) {
7816
- newScope[level] = (...d2) => logger93.logData(d2, { level, scope: label });
7815
+ for (const level of logger94.levels) {
7816
+ newScope[level] = (...d2) => logger94.logData(d2, { level, scope: label });
7817
7817
  }
7818
7818
  newScope.log = newScope.info;
7819
7819
  return newScope;
@@ -8106,7 +8106,7 @@ var require_transform = __commonJS({
8106
8106
  "use strict";
8107
8107
  module2.exports = { transform: transform2 };
8108
8108
  function transform2({
8109
- logger: logger93,
8109
+ logger: logger94,
8110
8110
  message,
8111
8111
  transport,
8112
8112
  initialData = message?.data || [],
@@ -8114,7 +8114,7 @@ var require_transform = __commonJS({
8114
8114
  }) {
8115
8115
  return transforms.reduce((data, trans) => {
8116
8116
  if (typeof trans === "function") {
8117
- return trans({ data, logger: logger93, message, transport });
8117
+ return trans({ data, logger: logger94, message, transport });
8118
8118
  }
8119
8119
  return data;
8120
8120
  }, initialData);
@@ -8137,7 +8137,7 @@ var require_console = __commonJS({
8137
8137
  silly: console.debug,
8138
8138
  log: console.log
8139
8139
  };
8140
- function consoleTransportRendererFactory(logger93) {
8140
+ function consoleTransportRendererFactory(logger94) {
8141
8141
  return Object.assign(transport, {
8142
8142
  format: "{h}:{i}:{s}.{ms}{scope} \u203A {text}",
8143
8143
  transforms: [formatDataFn],
@@ -8148,13 +8148,13 @@ var require_console = __commonJS({
8148
8148
  });
8149
8149
  function transport(message) {
8150
8150
  transport.writeFn({
8151
- message: { ...message, data: transform2({ logger: logger93, message, transport }) }
8151
+ message: { ...message, data: transform2({ logger: logger94, message, transport }) }
8152
8152
  });
8153
8153
  }
8154
8154
  }
8155
8155
  function formatDataFn({
8156
8156
  data = [],
8157
- logger: logger93 = {},
8157
+ logger: logger94 = {},
8158
8158
  message = {},
8159
8159
  transport = {}
8160
8160
  }) {
@@ -8162,7 +8162,7 @@ var require_console = __commonJS({
8162
8162
  return transport.format({
8163
8163
  data,
8164
8164
  level: message?.level || "info",
8165
- logger: logger93,
8165
+ logger: logger94,
8166
8166
  message,
8167
8167
  transport
8168
8168
  });
@@ -8182,7 +8182,7 @@ var require_console = __commonJS({
8182
8182
  case "logId":
8183
8183
  return message.logId;
8184
8184
  case "scope": {
8185
- const scope = message.scope || logger93.scope?.defaultLabel;
8185
+ const scope = message.scope || logger94.scope?.defaultLabel;
8186
8186
  return scope ? ` (${scope})` : "";
8187
8187
  }
8188
8188
  case "text":
@@ -8219,14 +8219,14 @@ var require_ipc = __commonJS({
8219
8219
  var { transform: transform2 } = require_transform();
8220
8220
  module2.exports = ipcTransportRendererFactory;
8221
8221
  var RESTRICTED_TYPES = /* @__PURE__ */ new Set([Promise, WeakMap, WeakSet]);
8222
- function ipcTransportRendererFactory(logger93) {
8222
+ function ipcTransportRendererFactory(logger94) {
8223
8223
  return Object.assign(transport, {
8224
8224
  depth: 5,
8225
8225
  transforms: [serializeFn]
8226
8226
  });
8227
8227
  function transport(message) {
8228
8228
  if (!window.__electronLog) {
8229
- logger93.processMessage(
8229
+ logger94.processMessage(
8230
8230
  {
8231
8231
  data: ["electron-log: logger isn't initialized in the main process"],
8232
8232
  level: "error"
@@ -8238,13 +8238,13 @@ var require_ipc = __commonJS({
8238
8238
  try {
8239
8239
  const serialized = transform2({
8240
8240
  initialData: message,
8241
- logger: logger93,
8241
+ logger: logger94,
8242
8242
  message,
8243
8243
  transport
8244
8244
  });
8245
8245
  __electronLog.sendToMain(serialized);
8246
8246
  } catch (e3) {
8247
- logger93.transports.console({
8247
+ logger94.transports.console({
8248
8248
  data: ["electronLog.transports.ipc", e3, "data:", message.data],
8249
8249
  level: "error"
8250
8250
  });
@@ -8340,7 +8340,7 @@ var require_renderer = __commonJS({
8340
8340
  module2.exports.Logger = Logger;
8341
8341
  module2.exports.default = module2.exports;
8342
8342
  function createLogger() {
8343
- const logger93 = new Logger({
8343
+ const logger94 = new Logger({
8344
8344
  allowUnknownLevel: true,
8345
8345
  errorHandler: new RendererErrorHandler(),
8346
8346
  initializeFn: () => {
@@ -8354,13 +8354,13 @@ var require_renderer = __commonJS({
8354
8354
  processType: "renderer"
8355
8355
  }
8356
8356
  });
8357
- logger93.errorHandler.setOptions({
8357
+ logger94.errorHandler.setOptions({
8358
8358
  logFn({ error: error51, errorName, showDialog }) {
8359
- logger93.transports.console({
8359
+ logger94.transports.console({
8360
8360
  data: [errorName, error51].filter(Boolean),
8361
8361
  level: "error"
8362
8362
  });
8363
- logger93.transports.ipc({
8363
+ logger94.transports.ipc({
8364
8364
  cmd: "errorHandler",
8365
8365
  error: {
8366
8366
  cause: error51?.cause,
@@ -8370,7 +8370,7 @@ var require_renderer = __commonJS({
8370
8370
  stack: error51?.stack
8371
8371
  },
8372
8372
  errorName,
8373
- logId: logger93.logId,
8373
+ logId: logger94.logId,
8374
8374
  showDialog
8375
8375
  });
8376
8376
  }
@@ -8384,12 +8384,12 @@ var require_renderer = __commonJS({
8384
8384
  }
8385
8385
  });
8386
8386
  }
8387
- return new Proxy(logger93, {
8387
+ return new Proxy(logger94, {
8388
8388
  get(target, prop) {
8389
8389
  if (typeof target[prop] !== "undefined") {
8390
8390
  return target[prop];
8391
8391
  }
8392
- return (...data) => logger93.logData(data, { level: prop });
8392
+ return (...data) => logger94.logData(data, { level: prop });
8393
8393
  }
8394
8394
  });
8395
8395
  }
@@ -8826,7 +8826,7 @@ var require_initialize = __commonJS({
8826
8826
  externalApi,
8827
8827
  getSessions,
8828
8828
  includeFutureSession,
8829
- logger: logger93,
8829
+ logger: logger94,
8830
8830
  preload = true,
8831
8831
  spyRendererConsole = false
8832
8832
  }) {
@@ -8837,15 +8837,15 @@ var require_initialize = __commonJS({
8837
8837
  externalApi,
8838
8838
  getSessions,
8839
8839
  includeFutureSession,
8840
- logger: logger93,
8840
+ logger: logger94,
8841
8841
  preloadOption: preload
8842
8842
  });
8843
8843
  }
8844
8844
  if (spyRendererConsole) {
8845
- initializeSpyRendererConsole({ externalApi, logger: logger93 });
8845
+ initializeSpyRendererConsole({ externalApi, logger: logger94 });
8846
8846
  }
8847
8847
  } catch (err2) {
8848
- logger93.warn(err2);
8848
+ logger94.warn(err2);
8849
8849
  }
8850
8850
  });
8851
8851
  }
@@ -8854,12 +8854,12 @@ var require_initialize = __commonJS({
8854
8854
  externalApi,
8855
8855
  getSessions,
8856
8856
  includeFutureSession,
8857
- logger: logger93,
8857
+ logger: logger94,
8858
8858
  preloadOption
8859
8859
  }) {
8860
8860
  let preloadPath = typeof preloadOption === "string" ? preloadOption : void 0;
8861
8861
  if (preloadInitialized) {
8862
- logger93.warn(new Error("log.initialize({ preload }) already called").stack);
8862
+ logger94.warn(new Error("log.initialize({ preload }) already called").stack);
8863
8863
  return;
8864
8864
  }
8865
8865
  preloadInitialized = true;
@@ -8890,9 +8890,9 @@ var require_initialize = __commonJS({
8890
8890
  getSessions
8891
8891
  });
8892
8892
  }
8893
- function initializeSpyRendererConsole({ externalApi, logger: logger93 }) {
8893
+ function initializeSpyRendererConsole({ externalApi, logger: logger94 }) {
8894
8894
  if (spyConsoleInitialized) {
8895
- logger93.warn(
8895
+ logger94.warn(
8896
8896
  new Error("log.initialize({ spyRendererConsole }) already called").stack
8897
8897
  );
8898
8898
  return;
@@ -8902,7 +8902,7 @@ var require_initialize = __commonJS({
8902
8902
  externalApi.onEveryWebContentsEvent(
8903
8903
  "console-message",
8904
8904
  (event, level, message) => {
8905
- logger93.processMessage({
8905
+ logger94.processMessage({
8906
8906
  data: [message],
8907
8907
  level: levels[level],
8908
8908
  variables: { processType: "renderer" }
@@ -9114,7 +9114,7 @@ var require_EventLogger = __commonJS({
9114
9114
  events,
9115
9115
  externalApi,
9116
9116
  level,
9117
- logger: logger93,
9117
+ logger: logger94,
9118
9118
  format: format2,
9119
9119
  formatters,
9120
9120
  scope
@@ -9128,8 +9128,8 @@ var require_EventLogger = __commonJS({
9128
9128
  if (typeof level === "string") {
9129
9129
  this.level = level;
9130
9130
  }
9131
- if (typeof logger93 === "object") {
9132
- this.logger = logger93;
9131
+ if (typeof logger94 === "object") {
9132
+ this.logger = logger94;
9133
9133
  }
9134
9134
  if (typeof format2 === "string" || typeof format2 === "function") {
9135
9135
  this.format = format2;
@@ -9228,10 +9228,10 @@ var require_EventLogger = __commonJS({
9228
9228
  }
9229
9229
  }
9230
9230
  handleEvent({ eventName, eventSource, handlerArgs }) {
9231
- const log95 = this.formatEventLog({ eventName, eventSource, handlerArgs });
9232
- if (log95) {
9231
+ const log96 = this.formatEventLog({ eventName, eventSource, handlerArgs });
9232
+ if (log96) {
9233
9233
  const logFns = this.scope ? this.logger.scope(this.scope) : this.logger;
9234
- logFns?.[this.level]?.(...log95);
9234
+ logFns?.[this.level]?.(...log96);
9235
9235
  }
9236
9236
  }
9237
9237
  };
@@ -9250,12 +9250,12 @@ var require_format = __commonJS({
9250
9250
  formatText,
9251
9251
  formatVariables,
9252
9252
  timeZoneFromOffset,
9253
- format({ message, logger: logger93, transport, data = message?.data }) {
9253
+ format({ message, logger: logger94, transport, data = message?.data }) {
9254
9254
  switch (typeof transport.format) {
9255
9255
  case "string": {
9256
9256
  return transform2({
9257
9257
  message,
9258
- logger: logger93,
9258
+ logger: logger94,
9259
9259
  transforms: [formatVariables, formatScope, formatText],
9260
9260
  transport,
9261
9261
  initialData: [transport.format, ...data]
@@ -9265,7 +9265,7 @@ var require_format = __commonJS({
9265
9265
  return transport.format({
9266
9266
  data,
9267
9267
  level: message?.level || "info",
9268
- logger: logger93,
9268
+ logger: logger94,
9269
9269
  message,
9270
9270
  transport
9271
9271
  });
@@ -9292,8 +9292,8 @@ var require_format = __commonJS({
9292
9292
  const minutes = (minutesPositive % 60).toString().padStart(2, "0");
9293
9293
  return `${sign}${hours}:${minutes}`;
9294
9294
  }
9295
- function formatScope({ data, logger: logger93, message }) {
9296
- const { defaultLabel, labelLength } = logger93?.scope || {};
9295
+ function formatScope({ data, logger: logger94, message }) {
9296
+ const { defaultLabel, labelLength } = logger94?.scope || {};
9297
9297
  const template2 = data[0];
9298
9298
  let label = message.scope;
9299
9299
  if (!label) {
@@ -9569,7 +9569,7 @@ var require_console2 = __commonJS({
9569
9569
  Object.assign(consoleTransportFactory, {
9570
9570
  DEFAULT_FORMAT
9571
9571
  });
9572
- function consoleTransportFactory(logger93) {
9572
+ function consoleTransportFactory(logger94) {
9573
9573
  return Object.assign(transport, {
9574
9574
  colorMap: {
9575
9575
  error: "red",
@@ -9597,7 +9597,7 @@ var require_console2 = __commonJS({
9597
9597
  }
9598
9598
  });
9599
9599
  function transport(message) {
9600
- const data = transform2({ logger: logger93, message, transport });
9600
+ const data = transform2({ logger: logger94, message, transport });
9601
9601
  transport.writeFn({
9602
9602
  message: { ...message, data }
9603
9603
  });
@@ -9880,7 +9880,7 @@ var require_file = __commonJS({
9880
9880
  var { toString: toString2 } = require_object();
9881
9881
  module2.exports = fileTransportFactory;
9882
9882
  var globalRegistry2 = new FileRegistry();
9883
- function fileTransportFactory(logger93, { registry: registry3 = globalRegistry2, externalApi } = {}) {
9883
+ function fileTransportFactory(logger94, { registry: registry3 = globalRegistry2, externalApi } = {}) {
9884
9884
  let pathVariables;
9885
9885
  if (registry3.listenerCount("error") < 1) {
9886
9886
  registry3.on("error", (e3, file2) => {
@@ -9888,7 +9888,7 @@ var require_file = __commonJS({
9888
9888
  });
9889
9889
  }
9890
9890
  return Object.assign(transport, {
9891
- fileName: getDefaultFileName(logger93.variables.processType),
9891
+ fileName: getDefaultFileName(logger94.variables.processType),
9892
9892
  format: "[{y}-{m}-{d} {h}:{i}:{s}.{ms}] [{level}]{scope} {text}",
9893
9893
  getFile,
9894
9894
  inspectOptions: { depth: 5 },
@@ -9913,7 +9913,7 @@ var require_file = __commonJS({
9913
9913
  return path51.join(vars.libraryDefaultDir, vars.fileName);
9914
9914
  },
9915
9915
  setAppName(name29) {
9916
- logger93.dependencies.externalApi.setAppName(name29);
9916
+ logger94.dependencies.externalApi.setAppName(name29);
9917
9917
  }
9918
9918
  });
9919
9919
  function transport(message) {
@@ -9923,7 +9923,7 @@ var require_file = __commonJS({
9923
9923
  transport.archiveLogFn(file2);
9924
9924
  file2.reset();
9925
9925
  }
9926
- const content = transform2({ logger: logger93, message, transport });
9926
+ const content = transform2({ logger: logger94, message, transport });
9927
9927
  file2.writeLine(content);
9928
9928
  }
9929
9929
  function initializeOnFirstAccess() {
@@ -9958,7 +9958,7 @@ var require_file = __commonJS({
9958
9958
  if (error51) {
9959
9959
  data.push(error51);
9960
9960
  }
9961
- logger93.transports.console({ data, date: /* @__PURE__ */ new Date(), level });
9961
+ logger94.transports.console({ data, date: /* @__PURE__ */ new Date(), level });
9962
9962
  }
9963
9963
  function getFile(msg) {
9964
9964
  initializeOnFirstAccess();
@@ -10007,11 +10007,11 @@ var require_ipc2 = __commonJS({
10007
10007
  var { maxDepth, toJSON } = require_object();
10008
10008
  var { transform: transform2 } = require_transform();
10009
10009
  module2.exports = ipcTransportFactory;
10010
- function ipcTransportFactory(logger93, { externalApi }) {
10010
+ function ipcTransportFactory(logger94, { externalApi }) {
10011
10011
  Object.assign(transport, {
10012
10012
  depth: 3,
10013
10013
  eventId: "__ELECTRON_LOG_IPC__",
10014
- level: logger93.isDev ? "silly" : false,
10014
+ level: logger94.isDev ? "silly" : false,
10015
10015
  transforms: [toJSON, maxDepth]
10016
10016
  });
10017
10017
  return externalApi?.isElectron() ? transport : void 0;
@@ -10021,7 +10021,7 @@ var require_ipc2 = __commonJS({
10021
10021
  }
10022
10022
  externalApi?.sendIpc(transport.eventId, {
10023
10023
  ...message,
10024
- data: transform2({ logger: logger93, message, transport })
10024
+ data: transform2({ logger: logger94, message, transport })
10025
10025
  });
10026
10026
  }
10027
10027
  }
@@ -10038,7 +10038,7 @@ var require_remote = __commonJS({
10038
10038
  var { removeStyles } = require_style();
10039
10039
  var { toJSON, maxDepth } = require_object();
10040
10040
  module2.exports = remoteTransportFactory;
10041
- function remoteTransportFactory(logger93) {
10041
+ function remoteTransportFactory(logger94) {
10042
10042
  return Object.assign(transport, {
10043
10043
  client: { name: "electron-application" },
10044
10044
  depth: 6,
@@ -10056,7 +10056,7 @@ var require_remote = __commonJS({
10056
10056
  });
10057
10057
  },
10058
10058
  processErrorFn({ error: error51 }) {
10059
- logger93.processMessage(
10059
+ logger94.processMessage(
10060
10060
  {
10061
10061
  data: [`electron-log: can't POST ${transport.url}`, error51],
10062
10062
  level: "warn"
@@ -10085,8 +10085,8 @@ var require_remote = __commonJS({
10085
10085
  return;
10086
10086
  }
10087
10087
  const body = transport.makeBodyFn({
10088
- logger: logger93,
10089
- message: { ...message, data: transform2({ logger: logger93, message, transport }) },
10088
+ logger: logger94,
10089
+ message: { ...message, data: transform2({ logger: logger94, message, transport }) },
10090
10090
  transport
10091
10091
  });
10092
10092
  const request = transport.sendRequestFn({
@@ -10096,7 +10096,7 @@ var require_remote = __commonJS({
10096
10096
  });
10097
10097
  request.on("error", (error51) => transport.processErrorFn({
10098
10098
  error: error51,
10099
- logger: logger93,
10099
+ logger: logger94,
10100
10100
  message,
10101
10101
  request,
10102
10102
  transport
@@ -10178,9 +10178,9 @@ var require_main = __commonJS({
10178
10178
  externalApi.onIpcInvoke("__ELECTRON_LOG__", (_4, { cmd = "", logId }) => {
10179
10179
  switch (cmd) {
10180
10180
  case "getOptions": {
10181
- const logger93 = defaultLogger2.Logger.getInstance({ logId });
10181
+ const logger94 = defaultLogger2.Logger.getInstance({ logId });
10182
10182
  return {
10183
- levels: logger93.levels,
10183
+ levels: logger94.levels,
10184
10184
  logId
10185
10185
  };
10186
10186
  }
@@ -26524,11 +26524,49 @@ var init_zod = __esm({
26524
26524
  }
26525
26525
  });
26526
26526
 
26527
+ // src/lib/i18n/locales.ts
26528
+ var SUPPORTED_LOCALES, LOCALE_ENGLISH_NAMES;
26529
+ var init_locales2 = __esm({
26530
+ "src/lib/i18n/locales.ts"() {
26531
+ SUPPORTED_LOCALES = [
26532
+ "en-us",
26533
+ "zh-hans",
26534
+ "fr",
26535
+ "de",
26536
+ "hi",
26537
+ "it",
26538
+ "ja",
26539
+ "ko",
26540
+ "pl",
26541
+ "pt-br",
26542
+ "ru",
26543
+ "es",
26544
+ "tr"
26545
+ ];
26546
+ LOCALE_ENGLISH_NAMES = {
26547
+ "en-us": "English",
26548
+ "zh-hans": "Simplified Chinese",
26549
+ fr: "French",
26550
+ de: "German",
26551
+ hi: "Hindi",
26552
+ it: "Italian",
26553
+ ja: "Japanese",
26554
+ ko: "Korean",
26555
+ pl: "Polish",
26556
+ "pt-br": "Brazilian Portuguese",
26557
+ ru: "Russian",
26558
+ es: "Spanish",
26559
+ tr: "Turkish"
26560
+ };
26561
+ }
26562
+ });
26563
+
26527
26564
  // src/lib/schemas.ts
26528
26565
  var SecretSchema, ChatSummarySchema, ChatSearchResultSchema, AppSearchResultSchema, AppSearchResultsSchema, LargeLanguageModelSchema, RegularProviderSettingSchema, AzureProviderSettingSchema, VertexProviderSettingSchema, ProviderSettingSchema, RuntimeModeSchema, ChatModeSchema, WorkModeSchema, AgentModeSchema, GuidedConfigSchema, AutonomousConfigSchema, DelegationConfigSchema, SelfReviewConfigSchema, ContextSummarizationConfigSchema, ActivityStreamConfigSchema, AIConfigurationSchema, GlobPathSchema, AppChatContextSchema, ReleaseChannelSchema, ZoomLevelSchema, DBConnectionConfigStoredSchema, DBConnectionStoredSchema, UserSettingsSchema;
26529
26566
  var init_schemas3 = __esm({
26530
26567
  "src/lib/schemas.ts"() {
26531
26568
  init_zod();
26569
+ init_locales2();
26532
26570
  SecretSchema = external_exports.object({
26533
26571
  value: external_exports.string(),
26534
26572
  encryptionType: external_exports.enum(["electron-safe-storage", "plaintext"]).optional()
@@ -26795,6 +26833,21 @@ var init_schemas3 = __esm({
26795
26833
  * language never needs a schema change (same reasoning as
26796
26834
  * `voiceTranscriptionProvider`). */
26797
26835
  voiceLanguage: external_exports.string().optional(),
26836
+ /**
26837
+ * UI language AND the language the assistant replies in.
26838
+ *
26839
+ * An ENUM, unlike `voiceLanguage` directly above, and the divergence is
26840
+ * deliberate: that one is free-form because any ISO-639-1 code is meaningful to
26841
+ * Whisper, so a new language needs no schema change. A value HERE selects a
26842
+ * bundled catalog, so an unrecognised tag renders a blank UI rather than a
26843
+ * degraded one.
26844
+ *
26845
+ * Unset means "derive from the OS locale", resolved at READ time rather than
26846
+ * defaulted at first launch — so a user who changes their system language sees
26847
+ * Atlarix follow, instead of being frozen to whatever it was when they
26848
+ * installed. That is why there is no entry in DEFAULT_SETTINGS.
26849
+ */
26850
+ appLanguage: external_exports.enum(SUPPORTED_LOCALES).optional(),
26798
26851
  /** @deprecated superseded by the binary `deepThinking` toggle (v14.8.5). */
26799
26852
  thinkingBudget: external_exports.enum(["low", "medium", "high"]).optional(),
26800
26853
  /**
@@ -29483,6 +29536,7 @@ var init_system_prompt = __esm({
29483
29536
  init_agent_memory();
29484
29537
  init_resolve_shell();
29485
29538
  init_settings();
29539
+ init_locales2();
29486
29540
  init_project_memory2();
29487
29541
  init_shared_fragments();
29488
29542
  logger6 = import_electron_log6.default.scope("system_prompt");
@@ -29600,6 +29654,9 @@ Operating system: **${os4.type()} ${os4.release()}** (${os4.arch()}). Shell comm
29600
29654
  This machine has **${cpuCount} CPU cores** and **${totalMemGb} GB RAM**. Dev servers, the browser, and concurrent sub-agents all compete for those \u2014 scale what you run at once to these specs.`;
29601
29655
  const contextBudgetInfo = `# Context budget
29602
29656
  Your context window this session is **${contextSize.toLocaleString("en-US")} tokens**. You are warned explicitly when it is close to full, and older turns are summarised for you \u2014 so a long thread is not a full one. Anything a summary left out is still in this session's transcript: use \`session_search\` to retrieve a specific earlier fact rather than guessing at it.`;
29657
+ const appLanguage = readSettings().appLanguage;
29658
+ const responseLanguage = appLanguage && appLanguage !== "en-us" ? `# Response language
29659
+ Reply in ${LOCALE_ENGLISH_NAMES[appLanguage]}. Keep code, file paths, shell commands, identifiers and commit messages in their original language. The user can change this in Settings \u2192 General \u2192 Language.` : "";
29603
29660
  const stableHeader = [
29604
29661
  runtimeIdentity,
29605
29662
  base.trim(),
@@ -29607,7 +29664,8 @@ Your context window this session is **${contextSize.toLocaleString("en-US")} tok
29607
29664
  outputStyleRule,
29608
29665
  modeBundle,
29609
29666
  deviceInfo,
29610
- contextBudgetInfo
29667
+ contextBudgetInfo,
29668
+ responseLanguage
29611
29669
  ].filter((s3) => s3.length > 0).join("\n\n");
29612
29670
  const currentDate = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
29613
29671
  weekday: "long",
@@ -66013,8 +66071,8 @@ async function fetchCatalogWithRetry() {
66013
66071
  throw lastError instanceof Error ? lastError : new Error(String(lastError));
66014
66072
  }
66015
66073
  async function refreshModelsDev(opts) {
66016
- const notify4 = opts?.notify !== false;
66017
- if (notify4) {
66074
+ const notify5 = opts?.notify !== false;
66075
+ if (notify5) {
66018
66076
  broadcastModelsDevStatus("Updating model catalog in background\u2026");
66019
66077
  }
66020
66078
  try {
@@ -66023,7 +66081,7 @@ async function refreshModelsDev(opts) {
66023
66081
  await saveToCache(data);
66024
66082
  setCachedData(data);
66025
66083
  logger7.info(`[models.dev] Fetched ${Object.keys(data).length} providers`);
66026
- if (notify4) broadcastModelsDevStatus("");
66084
+ if (notify5) broadcastModelsDevStatus("");
66027
66085
  return data;
66028
66086
  }
66029
66087
  } catch (e3) {
@@ -66034,7 +66092,7 @@ async function refreshModelsDev(opts) {
66034
66092
  level: "warning",
66035
66093
  tags: { feature: "models_dev" }
66036
66094
  });
66037
- if (notify4) {
66095
+ if (notify5) {
66038
66096
  broadcastModelsDevStatus(
66039
66097
  "Model catalog update timed out; using cached list.",
66040
66098
  true
@@ -66042,7 +66100,7 @@ async function refreshModelsDev(opts) {
66042
66100
  }
66043
66101
  } else {
66044
66102
  logger7.warn("[models.dev] Fetch failed, using cache", e3);
66045
- if (notify4) broadcastModelsDevStatus("");
66103
+ if (notify5) broadcastModelsDevStatus("");
66046
66104
  }
66047
66105
  }
66048
66106
  const cached3 = await loadFromCache();
@@ -111761,7 +111819,7 @@ var require_node2 = __commonJS({
111761
111819
  var tty = __require("tty");
111762
111820
  var util2 = __require("util");
111763
111821
  exports2.init = init2;
111764
- exports2.log = log95;
111822
+ exports2.log = log96;
111765
111823
  exports2.formatArgs = formatArgs;
111766
111824
  exports2.save = save;
111767
111825
  exports2.load = load;
@@ -111896,7 +111954,7 @@ var require_node2 = __commonJS({
111896
111954
  }
111897
111955
  return (/* @__PURE__ */ new Date()).toISOString() + " ";
111898
111956
  }
111899
- function log95(...args2) {
111957
+ function log96(...args2) {
111900
111958
  return process.stderr.write(util2.formatWithOptions(exports2.inspectOpts, ...args2) + "\n");
111901
111959
  }
111902
111960
  function save(namespaces) {
@@ -121335,7 +121393,7 @@ var require_logging_utils = __commonJS({
121335
121393
  exports2.getDebugBackend = getDebugBackend;
121336
121394
  exports2.getStructuredBackend = getStructuredBackend;
121337
121395
  exports2.setBackend = setBackend;
121338
- exports2.log = log95;
121396
+ exports2.log = log96;
121339
121397
  var events_1 = __require("events");
121340
121398
  var process6 = __importStar2(__require("process"));
121341
121399
  var util2 = __importStar2(__require("util"));
@@ -121367,7 +121425,7 @@ var require_logging_utils = __commonJS({
121367
121425
  this.func.info = (...args2) => this.invokeSeverity(LogSeverity.INFO, ...args2);
121368
121426
  this.func.warn = (...args2) => this.invokeSeverity(LogSeverity.WARNING, ...args2);
121369
121427
  this.func.error = (...args2) => this.invokeSeverity(LogSeverity.ERROR, ...args2);
121370
- this.func.sublog = (namespace2) => log95(namespace2, this.func);
121428
+ this.func.sublog = (namespace2) => log96(namespace2, this.func);
121371
121429
  }
121372
121430
  invoke(fields, ...args2) {
121373
121431
  if (this.upstream) {
@@ -121406,12 +121464,12 @@ var require_logging_utils = __commonJS({
121406
121464
  this.setFilters();
121407
121465
  this.filtersSet = true;
121408
121466
  }
121409
- let logger93 = this.cached.get(namespace);
121410
- if (!logger93) {
121411
- logger93 = this.makeLogger(namespace);
121412
- this.cached.set(namespace, logger93);
121467
+ let logger94 = this.cached.get(namespace);
121468
+ if (!logger94) {
121469
+ logger94 = this.makeLogger(namespace);
121470
+ this.cached.set(namespace, logger94);
121413
121471
  }
121414
- logger93(fields, ...args2);
121472
+ logger94(fields, ...args2);
121415
121473
  } catch (e3) {
121416
121474
  console.error(e3);
121417
121475
  }
@@ -121534,7 +121592,7 @@ var require_logging_utils = __commonJS({
121534
121592
  cachedBackend = backend;
121535
121593
  loggerCache.clear();
121536
121594
  }
121537
- function log95(namespace, parent) {
121595
+ function log96(namespace, parent) {
121538
121596
  if (!cachedBackend) {
121539
121597
  const enablesFlag = process6.env[exports2.env.nodeEnables];
121540
121598
  if (!enablesFlag) {
@@ -121556,7 +121614,7 @@ var require_logging_utils = __commonJS({
121556
121614
  } else if (cachedBackend === void 0) {
121557
121615
  cachedBackend = getNodeBackend();
121558
121616
  }
121559
- const logger93 = (() => {
121617
+ const logger94 = (() => {
121560
121618
  let previousBackend = void 0;
121561
121619
  const newLogger = new AdhocDebugLogger(namespace, (fields, ...args2) => {
121562
121620
  if (previousBackend !== cachedBackend) {
@@ -121571,8 +121629,8 @@ var require_logging_utils = __commonJS({
121571
121629
  });
121572
121630
  return newLogger;
121573
121631
  })();
121574
- loggerCache.set(namespace, logger93);
121575
- return logger93.func;
121632
+ loggerCache.set(namespace, logger94);
121633
+ return logger94.func;
121576
121634
  }
121577
121635
  }
121578
121636
  });
@@ -121660,14 +121718,14 @@ var require_src5 = __commonJS({
121660
121718
  var gaxios_1 = require_src3();
121661
121719
  var jsonBigint = require_json_bigint();
121662
121720
  var gcp_residency_1 = require_gcp_residency();
121663
- var logger93 = __importStar2(require_src4());
121721
+ var logger94 = __importStar2(require_src4());
121664
121722
  exports2.BASE_PATH = "/computeMetadata/v1";
121665
121723
  exports2.HOST_ADDRESS = "http://169.254.169.254";
121666
121724
  exports2.SECONDARY_HOST_ADDRESS = "http://metadata.google.internal.";
121667
121725
  exports2.HEADER_NAME = "Metadata-Flavor";
121668
121726
  exports2.HEADER_VALUE = "Google";
121669
121727
  exports2.HEADERS = Object.freeze({ [exports2.HEADER_NAME]: exports2.HEADER_VALUE });
121670
- var log95 = logger93.log("gcp-metadata");
121728
+ var log96 = logger94.log("gcp-metadata");
121671
121729
  exports2.METADATA_SERVER_DETECTION = Object.freeze({
121672
121730
  "assume-present": "don't try to ping the metadata server, but assume it's present",
121673
121731
  none: "don't try to ping the metadata server, but don't try to use it either",
@@ -121730,9 +121788,9 @@ var require_src5 = __commonJS({
121730
121788
  responseType: "text",
121731
121789
  timeout: requestTimeout()
121732
121790
  };
121733
- log95.info("instance request %j", req);
121791
+ log96.info("instance request %j", req);
121734
121792
  const res = await requestMethod(req);
121735
- log95.info("instance metadata is %s", res.data);
121793
+ log96.info("instance metadata is %s", res.data);
121736
121794
  const metadataFlavor = res.headers.get(exports2.HEADER_NAME);
121737
121795
  if (metadataFlavor !== exports2.HEADER_VALUE) {
121738
121796
  throw new RangeError(`Invalid response from metadata service: incorrect ${exports2.HEADER_NAME} header. Expected '${exports2.HEADER_VALUE}', got ${metadataFlavor ? `'${metadataFlavor}'` : "no header"}`);
@@ -151256,8 +151314,8 @@ function convertToOpenRouterChatMessages(prompt) {
151256
151314
  return !!detail.signature;
151257
151315
  });
151258
151316
  if (validDetails.length < candidateReasoningDetails.length) {
151259
- const logger93 = globalThis.AI_SDK_LOG_WARNINGS;
151260
- if (logger93 !== false && typeof logger93 !== "function") {
151317
+ const logger94 = globalThis.AI_SDK_LOG_WARNINGS;
151318
+ if (logger94 !== false && typeof logger94 !== "function") {
151261
151319
  console.warn(
151262
151320
  "[openrouter] Some reasoning_details entries were removed because they were missing signatures. See https://github.com/OpenRouterTeam/ai-sdk-provider/issues/423 and https://github.com/OpenRouterTeam/ai-sdk-provider/issues/418 for more details."
151263
151321
  );
@@ -162069,19 +162127,19 @@ var init_ProviderError = __esm({
162069
162127
  name = "ProviderError";
162070
162128
  tryNextLink;
162071
162129
  constructor(message, options = true) {
162072
- let logger93;
162130
+ let logger94;
162073
162131
  let tryNextLink = true;
162074
162132
  if (typeof options === "boolean") {
162075
- logger93 = void 0;
162133
+ logger94 = void 0;
162076
162134
  tryNextLink = options;
162077
162135
  } else if (options != null && typeof options === "object") {
162078
- logger93 = options.logger;
162136
+ logger94 = options.logger;
162079
162137
  tryNextLink = options.tryNextLink ?? true;
162080
162138
  }
162081
162139
  super(message);
162082
162140
  this.tryNextLink = tryNextLink;
162083
162141
  Object.setPrototypeOf(this, _ProviderError.prototype);
162084
- logger93?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
162142
+ logger94?.debug?.(`@smithy/property-provider ${tryNextLink ? "->" : "(!)"} ${message}`);
162085
162143
  }
162086
162144
  static from(error51, options = true) {
162087
162145
  return Object.assign(new this(error51.message, options), error51);
@@ -162510,8 +162568,8 @@ var init_configLoader = __esm({
162510
162568
  init_fromSharedConfigFiles();
162511
162569
  init_fromStatic();
162512
162570
  loadConfig = ({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => {
162513
- const { signingName, logger: logger93 } = configuration;
162514
- const envOptions = { signingName, logger: logger93 };
162571
+ const { signingName, logger: logger94 } = configuration;
162572
+ const envOptions = { signingName, logger: logger94 };
162515
162573
  return memoize(chain(fromEnv(environmentVariableSelector, envOptions), fromSharedConfigFiles(configFileSelector, configuration), fromStatic(defaultValue)));
162516
162574
  };
162517
162575
  }
@@ -163380,7 +163438,7 @@ var init_ByteArrayCollector = __esm({
163380
163438
  });
163381
163439
 
163382
163440
  // node_modules/@smithy/core/dist-es/submodules/serde/util-stream/createBufferedReadable.browser.js
163383
- function createBufferedReadableStream(upstream, size2, logger93) {
163441
+ function createBufferedReadableStream(upstream, size2, logger94) {
163384
163442
  const reader = upstream.getReader();
163385
163443
  let streamBufferingLoggedWarning = false;
163386
163444
  let bytesSeen = 0;
@@ -163418,7 +163476,7 @@ function createBufferedReadableStream(upstream, size2, logger93) {
163418
163476
  const newSize = merge2(buffers, mode, chunk2);
163419
163477
  if (!streamBufferingLoggedWarning && bytesSeen > size2 * 2) {
163420
163478
  streamBufferingLoggedWarning = true;
163421
- logger93?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size2}, automatically buffering.`);
163479
+ logger94?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size2}, automatically buffering.`);
163422
163480
  }
163423
163481
  if (newSize >= size2) {
163424
163482
  controller.enqueue(flush2(buffers, mode));
@@ -163478,9 +163536,9 @@ var init_createBufferedReadable_browser = __esm({
163478
163536
 
163479
163537
  // node_modules/@smithy/core/dist-es/submodules/serde/util-stream/createBufferedReadable.js
163480
163538
  import { Readable as Readable2 } from "node:stream";
163481
- function createBufferedReadable(upstream, size2, logger93) {
163539
+ function createBufferedReadable(upstream, size2, logger94) {
163482
163540
  if (isReadableStream(upstream)) {
163483
- return createBufferedReadableStream(upstream, size2, logger93);
163541
+ return createBufferedReadableStream(upstream, size2, logger94);
163484
163542
  }
163485
163543
  const downstream = new Readable2({ read() {
163486
163544
  } });
@@ -163513,7 +163571,7 @@ function createBufferedReadable(upstream, size2, logger93) {
163513
163571
  const newSize = merge2(buffers, mode, chunk2);
163514
163572
  if (!streamBufferingLoggedWarning && bytesSeen > size2 * 2) {
163515
163573
  streamBufferingLoggedWarning = true;
163516
- logger93?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size2}, automatically buffering.`);
163574
+ logger94?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size2}, automatically buffering.`);
163517
163575
  }
163518
163576
  if (newSize >= size2) {
163519
163577
  downstream.push(flush2(buffers, mode));
@@ -211418,6 +211476,87 @@ var init_system_reminder = __esm({
211418
211476
  }
211419
211477
  });
211420
211478
 
211479
+ // src/lib/agent/user-interjections.ts
211480
+ var user_interjections_exports = {};
211481
+ __export(user_interjections_exports, {
211482
+ cancelUserInterjection: () => cancelUserInterjection,
211483
+ clearUserInterjections: () => clearUserInterjections,
211484
+ hasPendingUserInterjections: () => hasPendingUserInterjections,
211485
+ listPendingUserInterjections: () => listPendingUserInterjections,
211486
+ recordUserInterjection: () => recordUserInterjection,
211487
+ setUserInterjectionNotifier: () => setUserInterjectionNotifier,
211488
+ takePendingUserInterjections: () => takePendingUserInterjections,
211489
+ takeUserInterjectionsAsPrompt: () => takeUserInterjectionsAsPrompt
211490
+ });
211491
+ function setUserInterjectionNotifier(fn2) {
211492
+ notifier = fn2;
211493
+ }
211494
+ function notify(chatId) {
211495
+ notifier?.(chatId, listPendingUserInterjections(chatId));
211496
+ }
211497
+ function recordUserInterjection(chatId, msg) {
211498
+ const text3 = msg.text.trim();
211499
+ if (!text3) return null;
211500
+ const list = byChat.get(chatId) ?? [];
211501
+ if (list.some((m3) => m3.id === msg.id)) return null;
211502
+ const entry = {
211503
+ id: msg.id,
211504
+ text: text3.length > TEXT_CAP ? `${text3.slice(0, TEXT_CAP)}\u2026` : text3,
211505
+ ts: msg.ts ?? Date.now()
211506
+ };
211507
+ list.push(entry);
211508
+ if (list.length > MAX_QUEUED_PER_CHAT) {
211509
+ console.warn(
211510
+ `[user-interjections] chat ${chatId}: >${MAX_QUEUED_PER_CHAT} undelivered \u2014 dropping ${list.length - MAX_QUEUED_PER_CHAT} oldest`
211511
+ );
211512
+ }
211513
+ byChat.set(chatId, list.slice(-MAX_QUEUED_PER_CHAT));
211514
+ notify(chatId);
211515
+ return entry;
211516
+ }
211517
+ function hasPendingUserInterjections(chatId) {
211518
+ return (byChat.get(chatId)?.length ?? 0) > 0;
211519
+ }
211520
+ function listPendingUserInterjections(chatId) {
211521
+ return [...byChat.get(chatId) ?? []];
211522
+ }
211523
+ function takePendingUserInterjections(chatId) {
211524
+ const list = byChat.get(chatId);
211525
+ if (!list?.length) return null;
211526
+ byChat.delete(chatId);
211527
+ notify(chatId);
211528
+ return list;
211529
+ }
211530
+ function cancelUserInterjection(chatId, id) {
211531
+ const list = byChat.get(chatId);
211532
+ if (!list?.length) return false;
211533
+ const next = list.filter((m3) => m3.id !== id);
211534
+ if (next.length === list.length) return false;
211535
+ if (next.length) byChat.set(chatId, next);
211536
+ else byChat.delete(chatId);
211537
+ notify(chatId);
211538
+ return true;
211539
+ }
211540
+ function takeUserInterjectionsAsPrompt(chatId) {
211541
+ const list = takePendingUserInterjections(chatId);
211542
+ if (!list) return null;
211543
+ return list.map((m3) => m3.text).join("\n\n");
211544
+ }
211545
+ function clearUserInterjections(chatId) {
211546
+ if (!byChat.has(chatId)) return;
211547
+ byChat.delete(chatId);
211548
+ notify(chatId);
211549
+ }
211550
+ var MAX_QUEUED_PER_CHAT, TEXT_CAP, byChat, notifier;
211551
+ var init_user_interjections = __esm({
211552
+ "src/lib/agent/user-interjections.ts"() {
211553
+ MAX_QUEUED_PER_CHAT = 40;
211554
+ TEXT_CAP = 2e4;
211555
+ byChat = /* @__PURE__ */ new Map();
211556
+ notifier = null;
211557
+ }
211558
+ });
211559
+
211421
211560
  // src/lib/chat/stream-transport.ts
211422
211561
  var stream_transport_exports = {};
211423
211562
  __export(stream_transport_exports, {
@@ -211431,6 +211570,7 @@ __export(stream_transport_exports, {
211431
211570
  getStreamTransportAppId: () => getStreamTransportAppId,
211432
211571
  hydrateStreamTransport: () => hydrateStreamTransport,
211433
211572
  insertAskUserAnswerUserMessage: () => insertAskUserAnswerUserMessage,
211573
+ insertUserInterjectionMessage: () => insertUserInterjectionMessage,
211434
211574
  isStreamTransportId: () => isStreamTransportId,
211435
211575
  nextEphemeralMessageId: () => nextEphemeralMessageId,
211436
211576
  seedEphemeralChatCounterBelow: () => seedEphemeralChatCounterBelow,
@@ -211477,6 +211617,22 @@ function insertAskUserAnswerUserMessage(chatId, formattedContent, sessionRowId)
211477
211617
  chat.messages.push(msg);
211478
211618
  return true;
211479
211619
  }
211620
+ function insertUserInterjectionMessage(chatId, content, placeholderMessageId, sessionRowId) {
211621
+ const chat = ephemeralChats.get(chatId);
211622
+ if (!chat) return null;
211623
+ const msg = {
211624
+ id: nextEphemeralMessageId(),
211625
+ chatId,
211626
+ role: "user",
211627
+ content,
211628
+ createdAt: /* @__PURE__ */ new Date(),
211629
+ ...sessionRowId ? { sessionRowId } : {}
211630
+ };
211631
+ const at2 = chat.messages.findIndex((m3) => m3.id === placeholderMessageId);
211632
+ if (at2 < 0) chat.messages.push(msg);
211633
+ else chat.messages.splice(at2, 0, msg);
211634
+ return msg;
211635
+ }
211480
211636
  function editTransportUserMessage(chatId, userMessageId, newContent, newModelContent) {
211481
211637
  const chat = ephemeralChats.get(chatId);
211482
211638
  if (!chat) return false;
@@ -211525,6 +211681,8 @@ function isStreamTransportId(chatId) {
211525
211681
  return chatId < 0;
211526
211682
  }
211527
211683
  function deleteStreamTransport(chatId) {
211684
+ void Promise.resolve().then(() => (init_user_interjections(), user_interjections_exports)).then((m3) => m3.clearUserInterjections(chatId)).catch(() => {
211685
+ });
211528
211686
  return ephemeralChats.delete(chatId);
211529
211687
  }
211530
211688
  function setTransportMessageDisplaySnapshot(chatId, messageId, snapshot) {
@@ -212098,7 +212256,7 @@ function scheduleInternal(chatId, delayMs, note, jobId) {
212098
212256
  const list = nudgesByChat.get(chatId) ?? [];
212099
212257
  list.push({ text: nudgeText, ...jobId ? { jobId } : {} });
212100
212258
  nudgesByChat.set(chatId, list.slice(-MAX_PENDING_PER_CHAT));
212101
- notifier?.(chatId, { operationId: id, status: "scheduled" });
212259
+ notifier2?.(chatId, { operationId: id, status: "scheduled" });
212102
212260
  }, clamped);
212103
212261
  timer.unref?.();
212104
212262
  if (!chatTimers) {
@@ -212175,7 +212333,7 @@ function clearScheduledWakeupsForChat(chatId) {
212175
212333
  }
212176
212334
  nudgesByChat.delete(chatId);
212177
212335
  }
212178
- var MIN_DELAY_MS, MAX_DELAY_MS, MAX_PENDING_PER_CHAT, timersByChat, nudgesByChat, seq, notifier;
212336
+ var MIN_DELAY_MS, MAX_DELAY_MS, MAX_PENDING_PER_CHAT, timersByChat, nudgesByChat, seq, notifier2;
212179
212337
  var init_scheduled_wakeups = __esm({
212180
212338
  "src/lib/agent/scheduled-wakeups.ts"() {
212181
212339
  MIN_DELAY_MS = 6e4;
@@ -212184,7 +212342,7 @@ var init_scheduled_wakeups = __esm({
212184
212342
  timersByChat = /* @__PURE__ */ new Map();
212185
212343
  nudgesByChat = /* @__PURE__ */ new Map();
212186
212344
  seq = 0;
212187
- notifier = null;
212345
+ notifier2 = null;
212188
212346
  }
212189
212347
  });
212190
212348
 
@@ -213006,13 +213164,13 @@ __export(background_commands_exports, {
213006
213164
  updateBackgroundOutput: () => updateBackgroundOutput
213007
213165
  });
213008
213166
  function setBackgroundJobNotifier(fn2) {
213009
- notifier2 = fn2;
213167
+ notifier3 = fn2;
213010
213168
  }
213011
213169
  function runningCount(chatId) {
213012
213170
  return runningJobsByChat.get(chatId)?.size ?? 0;
213013
213171
  }
213014
- function notify(chatId, operationId, status) {
213015
- notifier2?.(chatId, { operationId, status, running: runningCount(chatId) });
213172
+ function notify2(chatId, operationId, status) {
213173
+ notifier3?.(chatId, { operationId, status, running: runningCount(chatId) });
213016
213174
  }
213017
213175
  function totalRunningJobs() {
213018
213176
  let n2 = 0;
@@ -213036,8 +213194,8 @@ function scanForStalledJobs() {
213036
213194
  kind: "match",
213037
213195
  matchedPattern: job.wakeOn.pattern
213038
213196
  });
213039
- advisoriesByChat.set(chatId, list2.slice(-MAX_QUEUED_PER_CHAT));
213040
- notify(chatId, job.operationId, "condition_met");
213197
+ advisoriesByChat.set(chatId, list2.slice(-MAX_QUEUED_PER_CHAT2));
213198
+ notify2(chatId, job.operationId, "condition_met");
213041
213199
  }
213042
213200
  if (job.allowStalled) continue;
213043
213201
  if (wakeupActive) continue;
@@ -213053,8 +213211,8 @@ function scanForStalledJobs() {
213053
213211
  outputTail: tail,
213054
213212
  kind: "stall"
213055
213213
  });
213056
- advisoriesByChat.set(chatId, list.slice(-MAX_QUEUED_PER_CHAT));
213057
- notify(chatId, job.operationId, "stalled");
213214
+ advisoriesByChat.set(chatId, list.slice(-MAX_QUEUED_PER_CHAT2));
213215
+ notify2(chatId, job.operationId, "stalled");
213058
213216
  }
213059
213217
  }
213060
213218
  }
@@ -213084,7 +213242,7 @@ function recordBackgroundCommandStart(chatId, operationId, command, startedAt, w
213084
213242
  });
213085
213243
  runningJobsByChat.set(chatId, jobs);
213086
213244
  ensureStallWatchdog();
213087
- notify(chatId, operationId, "running");
213245
+ notify2(chatId, operationId, "running");
213088
213246
  }
213089
213247
  function setWakeCondition(chatId, operationId, wakeOn) {
213090
213248
  const job = runningJobsByChat.get(chatId)?.get(operationId);
@@ -213142,13 +213300,13 @@ function recordBackgroundCommandResult(chatId, operationId, result2) {
213142
213300
  output: result2.output.length > OUTPUT_TAIL_CAP ? `\u2026${result2.output.slice(-OUTPUT_TAIL_CAP)}` : result2.output,
213143
213301
  finishedAt: Date.now()
213144
213302
  });
213145
- if (list.length > MAX_QUEUED_PER_CHAT) {
213303
+ if (list.length > MAX_QUEUED_PER_CHAT2) {
213146
213304
  console.warn(
213147
- `[background-commands] chat ${chatId}: >${MAX_QUEUED_PER_CHAT} undrained results \u2014 dropping ${list.length - MAX_QUEUED_PER_CHAT} oldest (never delivered to the model)`
213305
+ `[background-commands] chat ${chatId}: >${MAX_QUEUED_PER_CHAT2} undrained results \u2014 dropping ${list.length - MAX_QUEUED_PER_CHAT2} oldest (never delivered to the model)`
213148
213306
  );
213149
213307
  }
213150
- resultsByChat.set(chatId, list.slice(-MAX_QUEUED_PER_CHAT));
213151
- notify(chatId, operationId, wasCancelled ? "cancelled" : "finished");
213308
+ resultsByChat.set(chatId, list.slice(-MAX_QUEUED_PER_CHAT2));
213309
+ notify2(chatId, operationId, wasCancelled ? "cancelled" : "finished");
213152
213310
  }
213153
213311
  function hasRunningBackgroundCommands(chatId) {
213154
213312
  return runningCount(chatId) > 0;
@@ -213299,13 +213457,13 @@ function killForegroundCommandsForChat(chatId) {
213299
213457
  foregroundProcsByChat.delete(chatId);
213300
213458
  return killed;
213301
213459
  }
213302
- var OUTPUT_TAIL_CAP, MAX_QUEUED_PER_CHAT, OUTPUT_IDLE_THRESHOLD_MS, STALL_CHECK_INTERVAL_MS, resultsByChat, runningJobsByChat, cancelledOps, stalledNotified, advisoriesByChat, stallWatchdog, notifier2, foregroundProcsByChat;
213460
+ var OUTPUT_TAIL_CAP, MAX_QUEUED_PER_CHAT2, OUTPUT_IDLE_THRESHOLD_MS, STALL_CHECK_INTERVAL_MS, resultsByChat, runningJobsByChat, cancelledOps, stalledNotified, advisoriesByChat, stallWatchdog, notifier3, foregroundProcsByChat;
213303
213461
  var init_background_commands = __esm({
213304
213462
  "src/lib/agent/background-commands.ts"() {
213305
213463
  init_scheduled_wakeups();
213306
213464
  init_runShellCommand();
213307
213465
  OUTPUT_TAIL_CAP = 8e3;
213308
- MAX_QUEUED_PER_CHAT = 10;
213466
+ MAX_QUEUED_PER_CHAT2 = 10;
213309
213467
  OUTPUT_IDLE_THRESHOLD_MS = 18e4;
213310
213468
  STALL_CHECK_INTERVAL_MS = 6e4;
213311
213469
  resultsByChat = /* @__PURE__ */ new Map();
@@ -213314,23 +213472,23 @@ var init_background_commands = __esm({
213314
213472
  stalledNotified = /* @__PURE__ */ new Set();
213315
213473
  advisoriesByChat = /* @__PURE__ */ new Map();
213316
213474
  stallWatchdog = null;
213317
- notifier2 = null;
213475
+ notifier3 = null;
213318
213476
  foregroundProcsByChat = /* @__PURE__ */ new Map();
213319
213477
  }
213320
213478
  });
213321
213479
 
213322
213480
  // src/lib/agents/subagent-results.ts
213323
- function notify2(chatId, taskId, status) {
213324
- notifier3?.(chatId, { taskId, status, running: runningSubagentCount(chatId) });
213481
+ function notify3(chatId, taskId, status) {
213482
+ notifier4?.(chatId, { taskId, status, running: runningSubagentCount(chatId) });
213325
213483
  }
213326
213484
  function notifySubagentStalled(chatId, taskId) {
213327
- notify2(chatId, taskId, "stalled");
213485
+ notify3(chatId, taskId, "stalled");
213328
213486
  }
213329
213487
  function recordSubagentStart(chatId, taskId) {
213330
213488
  const set2 = runningByChat.get(chatId) ?? /* @__PURE__ */ new Set();
213331
213489
  set2.add(taskId);
213332
213490
  runningByChat.set(chatId, set2);
213333
- notify2(chatId, taskId, "running");
213491
+ notify3(chatId, taskId, "running");
213334
213492
  }
213335
213493
  function recordSubagentResult(chatId, taskId, result2) {
213336
213494
  runningByChat.get(chatId)?.delete(taskId);
@@ -213341,13 +213499,13 @@ function recordSubagentResult(chatId, taskId, result2) {
213341
213499
  body: result2.body.length > BODY_TAIL_CAP ? `\u2026${result2.body.slice(-BODY_TAIL_CAP)}` : result2.body,
213342
213500
  finishedAt: Date.now()
213343
213501
  });
213344
- if (list.length > MAX_QUEUED_PER_CHAT2) {
213502
+ if (list.length > MAX_QUEUED_PER_CHAT3) {
213345
213503
  console.warn(
213346
- `[subagent-results] chat ${chatId}: >${MAX_QUEUED_PER_CHAT2} undrained results \u2014 dropping ${list.length - MAX_QUEUED_PER_CHAT2} oldest (never delivered to the model)`
213504
+ `[subagent-results] chat ${chatId}: >${MAX_QUEUED_PER_CHAT3} undrained results \u2014 dropping ${list.length - MAX_QUEUED_PER_CHAT3} oldest (never delivered to the model)`
213347
213505
  );
213348
213506
  }
213349
- resultsByChat2.set(chatId, list.slice(-MAX_QUEUED_PER_CHAT2));
213350
- notify2(chatId, taskId, "finished");
213507
+ resultsByChat2.set(chatId, list.slice(-MAX_QUEUED_PER_CHAT3));
213508
+ notify3(chatId, taskId, "finished");
213351
213509
  }
213352
213510
  function hasRunningSubagents(chatId) {
213353
213511
  return (runningByChat.get(chatId)?.size ?? 0) > 0;
@@ -213378,14 +213536,14 @@ function takePendingSubagentResults(chatId) {
213378
213536
  `Incorporate these result(s) and continue the user's task now. If a sub-agent failed, decide how to recover \u2014 only end your turn once you have acted on every result above. If they COMPLETE the user's request, report the outcome and end your turn \u2014 never re-run work that already finished.`
213379
213537
  ].join("\n\n");
213380
213538
  }
213381
- var BODY_TAIL_CAP, MAX_QUEUED_PER_CHAT2, resultsByChat2, runningByChat, notifier3;
213539
+ var BODY_TAIL_CAP, MAX_QUEUED_PER_CHAT3, resultsByChat2, runningByChat, notifier4;
213382
213540
  var init_subagent_results = __esm({
213383
213541
  "src/lib/agents/subagent-results.ts"() {
213384
213542
  BODY_TAIL_CAP = 12e3;
213385
- MAX_QUEUED_PER_CHAT2 = 10;
213543
+ MAX_QUEUED_PER_CHAT3 = 10;
213386
213544
  resultsByChat2 = /* @__PURE__ */ new Map();
213387
213545
  runningByChat = /* @__PURE__ */ new Map();
213388
- notifier3 = null;
213546
+ notifier4 = null;
213389
213547
  }
213390
213548
  });
213391
213549
 
@@ -213410,7 +213568,7 @@ function recordAutomationResult(workspaceId, result2) {
213410
213568
  ...result2,
213411
213569
  body: result2.body.slice(-BODY_TAIL_CAP2)
213412
213570
  });
213413
- while (list.length > MAX_QUEUED_PER_CHAT3) list.shift();
213571
+ while (list.length > MAX_QUEUED_PER_CHAT4) list.shift();
213414
213572
  resultsByWorkspace.set(workspaceId, list);
213415
213573
  }
213416
213574
  function hasPendingAutomationResults(chatId) {
@@ -213439,12 +213597,12 @@ ${r3.body.trim() || "(no detail)"}`;
213439
213597
  function clearAutomationResultsForTests() {
213440
213598
  resultsByWorkspace.clear();
213441
213599
  }
213442
- var BODY_TAIL_CAP2, MAX_QUEUED_PER_CHAT3, resultsByWorkspace;
213600
+ var BODY_TAIL_CAP2, MAX_QUEUED_PER_CHAT4, resultsByWorkspace;
213443
213601
  var init_automation_results = __esm({
213444
213602
  "src/lib/agent/automation-results.ts"() {
213445
213603
  init_stream_transport();
213446
213604
  BODY_TAIL_CAP2 = 8e3;
213447
- MAX_QUEUED_PER_CHAT3 = 10;
213605
+ MAX_QUEUED_PER_CHAT4 = 10;
213448
213606
  resultsByWorkspace = /* @__PURE__ */ new Map();
213449
213607
  }
213450
213608
  });
@@ -219061,7 +219219,7 @@ function now() {
219061
219219
  var _a232, _b21;
219062
219220
  return (_b21 = (_a232 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a232.now()) != null ? _b21 : Date.now();
219063
219221
  }
219064
- async function notify3(options) {
219222
+ async function notify4(options) {
219065
219223
  await Promise.all(
219066
219224
  asArray2(options.callbacks).map(async (callback) => {
219067
219225
  try {
@@ -219285,7 +219443,7 @@ async function executeToolCall({
219285
219443
  event: baseCallbackEvent,
219286
219444
  execute: async () => {
219287
219445
  let output;
219288
- await notify3({
219446
+ await notify4({
219289
219447
  event: baseCallbackEvent,
219290
219448
  callbacks: onToolExecutionStart
219291
219449
  });
@@ -219339,7 +219497,7 @@ async function executeToolCall({
219339
219497
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {},
219340
219498
  ...toolCall.toolMetadata != null ? { toolMetadata: toolCall.toolMetadata } : {}
219341
219499
  };
219342
- await notify3({
219500
+ await notify4({
219343
219501
  event: {
219344
219502
  ...baseCallbackEvent,
219345
219503
  toolOutput: toolError,
@@ -219362,7 +219520,7 @@ async function executeToolCall({
219362
219520
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {},
219363
219521
  ...toolCall.toolMetadata != null ? { toolMetadata: toolCall.toolMetadata } : {}
219364
219522
  };
219365
- await notify3({
219523
+ await notify4({
219366
219524
  event: {
219367
219525
  ...baseCallbackEvent,
219368
219526
  toolOutput: toolResult,
@@ -221138,7 +221296,7 @@ async function generateText({
221138
221296
  };
221139
221297
  const executeGenerateText = async () => {
221140
221298
  var _a242;
221141
- await notify3({
221299
+ await notify4({
221142
221300
  event: generateTextStartEvent,
221143
221301
  callbacks: [resolvedOnStart, telemetryDispatcher.onStart]
221144
221302
  });
@@ -221182,14 +221340,14 @@ async function generateText({
221182
221340
  timeout,
221183
221341
  experimental_sandbox: sandbox,
221184
221342
  toolsContext,
221185
- onToolExecutionStart: (event) => notify3({
221343
+ onToolExecutionStart: (event) => notify4({
221186
221344
  event,
221187
221345
  callbacks: [
221188
221346
  resolvedOnToolExecutionStart,
221189
221347
  telemetryDispatcher.onToolExecutionStart
221190
221348
  ]
221191
221349
  }),
221192
- onToolExecutionEnd: (event) => notify3({
221350
+ onToolExecutionEnd: (event) => notify4({
221193
221351
  event,
221194
221352
  callbacks: [
221195
221353
  resolvedOnToolExecutionEnd,
@@ -221334,7 +221492,7 @@ async function generateText({
221334
221492
  callSettings: callSettings2,
221335
221493
  stepSettings: prepareStepResult
221336
221494
  });
221337
- await notify3({
221495
+ await notify4({
221338
221496
  event: {
221339
221497
  callId,
221340
221498
  provider: stepModel.provider,
@@ -221373,7 +221531,7 @@ async function generateText({
221373
221531
  ...languageModelCallContext
221374
221532
  };
221375
221533
  const stepStartTimestampMs = now2();
221376
- await notify3({
221534
+ await notify4({
221377
221535
  event: languageModelCallStartEvent,
221378
221536
  callbacks: [
221379
221537
  resolvedOnLanguageModelCallStart,
@@ -221436,7 +221594,7 @@ async function generateText({
221436
221594
  toolApprovalResponses: [],
221437
221595
  tools
221438
221596
  });
221439
- await notify3({
221597
+ await notify4({
221440
221598
  event: {
221441
221599
  callId,
221442
221600
  provider: stepModel.provider,
@@ -221599,14 +221757,14 @@ async function generateText({
221599
221757
  timeout,
221600
221758
  experimental_sandbox: stepSandbox,
221601
221759
  toolsContext,
221602
- onToolExecutionStart: (event) => notify3({
221760
+ onToolExecutionStart: (event) => notify4({
221603
221761
  event,
221604
221762
  callbacks: [
221605
221763
  resolvedOnToolExecutionStart,
221606
221764
  telemetryDispatcher.onToolExecutionStart
221607
221765
  ]
221608
221766
  }),
221609
- onToolExecutionEnd: (event) => notify3({
221767
+ onToolExecutionEnd: (event) => notify4({
221610
221768
  event,
221611
221769
  callbacks: [
221612
221770
  resolvedOnToolExecutionEnd,
@@ -221710,7 +221868,7 @@ async function generateText({
221710
221868
  steps.push(currentStepResult);
221711
221869
  instructionsForNextStep = stepInstructions;
221712
221870
  messagesForNextStep = [...stepMessages, ...stepResponseMessages];
221713
- await notify3({
221871
+ await notify4({
221714
221872
  event: currentStepResult,
221715
221873
  callbacks: [resolvedOnStepEnd, telemetryDispatcher.onStepEnd]
221716
221874
  });
@@ -221794,7 +221952,7 @@ async function generateText({
221794
221952
  finalStep: lastStep,
221795
221953
  toolsContext
221796
221954
  };
221797
- await notify3({
221955
+ await notify4({
221798
221956
  event: onEndEvent,
221799
221957
  callbacks: [onEnd, telemetryDispatcher.onEnd]
221800
221958
  });
@@ -223720,7 +223878,7 @@ async function streamLanguageModelCall({
223720
223878
  const stepToolChoice = prepareToolChoice({
223721
223879
  toolChoice
223722
223880
  });
223723
- await notify3({
223881
+ await notify4({
223724
223882
  event: { promptMessages },
223725
223883
  callbacks: onStart
223726
223884
  });
@@ -223736,7 +223894,7 @@ async function streamLanguageModelCall({
223736
223894
  callId: effectiveCallId,
223737
223895
  ...languageModelCallContext
223738
223896
  };
223739
- await notify3({
223897
+ await notify4({
223740
223898
  event: languageModelCallStartEvent,
223741
223899
  callbacks: onLanguageModelCallStart
223742
223900
  });
@@ -223935,7 +224093,7 @@ function createLanguageModelV4StreamPartToLanguageModelStreamPartTransform({
223935
224093
  timeToFirstOutputMs,
223936
224094
  timeBetweenOutputChunksMs: timeBetweenOutputChunksMs.length > 0 ? calculateOutputChunkTimingStats(timeBetweenOutputChunksMs) : void 0
223937
224095
  };
223938
- await notify3({
224096
+ await notify4({
223939
224097
  event: {
223940
224098
  callId,
223941
224099
  provider,
@@ -225273,7 +225431,7 @@ async function embed({
225273
225431
  event: startEvent,
225274
225432
  execute: async () => {
225275
225433
  var _a242;
225276
- await notify3({
225434
+ await notify4({
225277
225435
  event: startEvent,
225278
225436
  callbacks: [resolvedOnStart, telemetryDispatcher.onStart]
225279
225437
  });
@@ -225281,7 +225439,7 @@ async function embed({
225281
225439
  const { embedding, usage, warnings, response, providerMetadata } = await retry(async () => {
225282
225440
  var _a252, _b21;
225283
225441
  const embedCallId = generateCallId();
225284
- await notify3({
225442
+ await notify4({
225285
225443
  event: {
225286
225444
  callId,
225287
225445
  embedCallId,
@@ -225300,7 +225458,7 @@ async function embed({
225300
225458
  });
225301
225459
  const embedding2 = modelResponse.embeddings[0];
225302
225460
  const usage2 = (_a252 = modelResponse.usage) != null ? _a252 : { tokens: NaN };
225303
- await notify3({
225461
+ await notify4({
225304
225462
  event: {
225305
225463
  callId,
225306
225464
  embedCallId,
@@ -225326,7 +225484,7 @@ async function embed({
225326
225484
  provider: model.provider,
225327
225485
  model: model.modelId
225328
225486
  });
225329
- await notify3({
225487
+ await notify4({
225330
225488
  event: {
225331
225489
  callId,
225332
225490
  operationId: "ai.embed",
@@ -225414,7 +225572,7 @@ async function embedMany({
225414
225572
  event: startEvent,
225415
225573
  execute: async () => {
225416
225574
  var _a242, _b21;
225417
- await notify3({
225575
+ await notify4({
225418
225576
  event: startEvent,
225419
225577
  callbacks: [resolvedOnStart, telemetryDispatcher.onStart]
225420
225578
  });
@@ -225426,7 +225584,7 @@ async function embedMany({
225426
225584
  const { embeddings: embeddings2, usage, warnings: warnings2, response, providerMetadata: providerMetadata2 } = await retry(async () => {
225427
225585
  var _a252, _b26;
225428
225586
  const embedCallId = generateCallId();
225429
- await notify3({
225587
+ await notify4({
225430
225588
  event: {
225431
225589
  callId,
225432
225590
  embedCallId,
@@ -225445,7 +225603,7 @@ async function embedMany({
225445
225603
  });
225446
225604
  const embeddings3 = modelResponse.embeddings;
225447
225605
  const usage2 = (_a252 = modelResponse.usage) != null ? _a252 : { tokens: NaN };
225448
- await notify3({
225606
+ await notify4({
225449
225607
  event: {
225450
225608
  callId,
225451
225609
  embedCallId,
@@ -225471,7 +225629,7 @@ async function embedMany({
225471
225629
  provider: model.provider,
225472
225630
  model: model.modelId
225473
225631
  });
225474
- await notify3({
225632
+ await notify4({
225475
225633
  event: {
225476
225634
  callId,
225477
225635
  operationId: "ai.embedMany",
@@ -225511,7 +225669,7 @@ async function embedMany({
225511
225669
  return retry(async () => {
225512
225670
  var _a252, _b26;
225513
225671
  const embedCallId = generateCallId();
225514
- await notify3({
225672
+ await notify4({
225515
225673
  event: {
225516
225674
  callId,
225517
225675
  embedCallId,
@@ -225530,7 +225688,7 @@ async function embedMany({
225530
225688
  });
225531
225689
  const chunkEmbeddings = modelResponse.embeddings;
225532
225690
  const usage = (_a252 = modelResponse.usage) != null ? _a252 : { tokens: NaN };
225533
- await notify3({
225691
+ await notify4({
225534
225692
  event: {
225535
225693
  callId,
225536
225694
  embedCallId,
@@ -225579,7 +225737,7 @@ async function embedMany({
225579
225737
  provider: model.provider,
225580
225738
  model: model.modelId
225581
225739
  });
225582
- await notify3({
225740
+ await notify4({
225583
225741
  event: {
225584
225742
  callId,
225585
225743
  operationId: "ai.embedMany",
@@ -226077,7 +226235,7 @@ async function generateObject(options) {
226077
226235
  const resolvedOnStepEnd = onStepEnd != null ? onStepEnd : onStepFinish;
226078
226236
  const jsonSchema22 = await outputStrategy.jsonSchema();
226079
226237
  const callId = generateId3();
226080
- await notify3({
226238
+ await notify4({
226081
226239
  event: {
226082
226240
  callId,
226083
226241
  operationId: "ai.generateObject",
@@ -226117,7 +226275,7 @@ async function generateObject(options) {
226117
226275
  download: download2,
226118
226276
  provider: model.provider.split(".")[0]
226119
226277
  });
226120
- await notify3({
226278
+ await notify4({
226121
226279
  event: {
226122
226280
  callId,
226123
226281
  stepNumber: 0,
@@ -226187,7 +226345,7 @@ async function generateObject(options) {
226187
226345
  response,
226188
226346
  providerMetadata: resultProviderMetadata
226189
226347
  };
226190
- await notify3({
226348
+ await notify4({
226191
226349
  event: stepFinishEvent,
226192
226350
  callbacks: [resolvedOnStepEnd, telemetryDispatcher.onObjectStepEnd]
226193
226351
  });
@@ -226201,7 +226359,7 @@ async function generateObject(options) {
226201
226359
  finishReason
226202
226360
  }
226203
226361
  );
226204
- await notify3({
226362
+ await notify4({
226205
226363
  event: {
226206
226364
  callId,
226207
226365
  object: object32,
@@ -227799,7 +227957,7 @@ async function rerank({
227799
227957
  });
227800
227958
  const runInTracingChannelSpan = (_a232 = telemetryDispatcher.runInTracingChannelSpan) != null ? _a232 : async ({ execute }) => await execute();
227801
227959
  if (documents.length === 0) {
227802
- await notify3({
227960
+ await notify4({
227803
227961
  event: {
227804
227962
  callId,
227805
227963
  operationId: "ai.rerank",
@@ -227814,7 +227972,7 @@ async function rerank({
227814
227972
  },
227815
227973
  callbacks: [resolvedOnStart, telemetryDispatcher.onStart]
227816
227974
  });
227817
- await notify3({
227975
+ await notify4({
227818
227976
  event: {
227819
227977
  callId,
227820
227978
  operationId: "ai.rerank",
@@ -227864,14 +228022,14 @@ async function rerank({
227864
228022
  event: startEvent,
227865
228023
  execute: async () => {
227866
228024
  var _a242, _b21, _c, _d, _e2;
227867
- await notify3({
228025
+ await notify4({
227868
228026
  event: startEvent,
227869
228027
  callbacks: [resolvedOnStart, telemetryDispatcher.onStart]
227870
228028
  });
227871
228029
  try {
227872
228030
  const { ranking, response, providerMetadata, warnings } = await retry(
227873
228031
  async () => {
227874
- await notify3({
228032
+ await notify4({
227875
228033
  event: {
227876
228034
  callId,
227877
228035
  operationId: "ai.rerank.doRerank",
@@ -227893,7 +228051,7 @@ async function rerank({
227893
228051
  headers
227894
228052
  });
227895
228053
  const ranking2 = modelResponse.ranking;
227896
- await notify3({
228054
+ await notify4({
227897
228055
  event: {
227898
228056
  callId,
227899
228057
  operationId: "ai.rerank.doRerank",
@@ -227917,7 +228075,7 @@ async function rerank({
227917
228075
  provider: model.provider,
227918
228076
  model: model.modelId
227919
228077
  });
227920
- await notify3({
228078
+ await notify4({
227921
228079
  event: {
227922
228080
  callId,
227923
228081
  operationId: "ai.rerank",
@@ -229253,12 +229411,12 @@ var init_dist21 = __esm({
229253
229411
  if (options.warnings.length === 0) {
229254
229412
  return;
229255
229413
  }
229256
- const logger93 = globalThis.AI_SDK_LOG_WARNINGS;
229257
- if (logger93 === false) {
229414
+ const logger94 = globalThis.AI_SDK_LOG_WARNINGS;
229415
+ if (logger94 === false) {
229258
229416
  return;
229259
229417
  }
229260
- if (typeof logger93 === "function") {
229261
- logger93(options);
229418
+ if (typeof logger94 === "function") {
229419
+ logger94(options);
229262
229420
  return;
229263
229421
  }
229264
229422
  if (!hasLoggedBefore) {
@@ -230654,7 +230812,7 @@ var init_dist21 = __esm({
230654
230812
  },
230655
230813
  providerMetadata: part.providerMetadata
230656
230814
  });
230657
- await notify3({
230815
+ await notify4({
230658
230816
  event: currentStepResult,
230659
230817
  callbacks: [onStepFinish, telemetryDispatcher.onStepEnd]
230660
230818
  });
@@ -230713,7 +230871,7 @@ var init_dist21 = __esm({
230713
230871
  var _a232;
230714
230872
  return (_a232 = step.warnings) != null ? _a232 : [];
230715
230873
  });
230716
- await notify3({
230874
+ await notify4({
230717
230875
  event: {
230718
230876
  callId,
230719
230877
  toolsContext: finalStep.toolsContext,
@@ -230764,7 +230922,7 @@ var init_dist21 = __esm({
230764
230922
  },
230765
230923
  async pull(controller) {
230766
230924
  async function abort() {
230767
- await notify3({
230925
+ await notify4({
230768
230926
  event: {
230769
230927
  callId,
230770
230928
  steps: recordedSteps,
@@ -230882,7 +231040,7 @@ var init_dist21 = __esm({
230882
231040
  const runInTracingChannelSpanInStreamText = telemetryDispatcher.runInTracingChannelSpan == null ? void 0 : (options) => runInStreamTextTracingChannelContext(
230883
231041
  () => telemetryDispatcher.runInTracingChannelSpan(options)
230884
231042
  );
230885
- await notify3({
231043
+ await notify4({
230886
231044
  event: startEvent,
230887
231045
  callbacks: [onStart, telemetryDispatcher.onStart]
230888
231046
  });
@@ -231179,7 +231337,7 @@ var init_dist21 = __esm({
231179
231337
  ),
231180
231338
  onStart: async ({ promptMessages }) => {
231181
231339
  var _a262, _b34;
231182
- await notify3({
231340
+ await notify4({
231183
231341
  event: {
231184
231342
  callId,
231185
231343
  provider: stepModel.provider,
@@ -232750,7 +232908,7 @@ var init_dist21 = __esm({
232750
232908
  const callId = generateId3();
232751
232909
  (async () => {
232752
232910
  const jsonSchema22 = await outputStrategy.jsonSchema();
232753
- await notify3({
232911
+ await notify4({
232754
232912
  event: {
232755
232913
  callId,
232756
232914
  operationId: "ai.streamObject",
@@ -232802,7 +232960,7 @@ var init_dist21 = __esm({
232802
232960
  headers,
232803
232961
  includeRawChunks: false
232804
232962
  };
232805
- await notify3({
232963
+ await notify4({
232806
232964
  event: {
232807
232965
  callId,
232808
232966
  stepNumber: 0,
@@ -232962,7 +233120,7 @@ var init_dist21 = __esm({
232962
233120
  completionTokens: NaN,
232963
233121
  totalTokens: NaN
232964
233122
  };
232965
- await notify3({
233123
+ await notify4({
232966
233124
  event: {
232967
233125
  callId,
232968
233126
  stepNumber: 0,
@@ -232986,7 +233144,7 @@ var init_dist21 = __esm({
232986
233144
  telemetryDispatcher.onObjectStepEnd
232987
233145
  ]
232988
233146
  });
232989
- await notify3({
233147
+ await notify4({
232990
233148
  event: {
232991
233149
  callId,
232992
233150
  object: object32,
@@ -235200,30 +235358,30 @@ function isUntrustedSenderFrame(event) {
235200
235358
  const frameUrl = event.senderFrame?.url ?? "";
235201
235359
  return /^https?:\/\//i.test(frameUrl);
235202
235360
  }
235203
- function createLoggedHandler(logger93) {
235361
+ function createLoggedHandler(logger94) {
235204
235362
  return (channel, fn2) => {
235205
235363
  ipcMain.handle(
235206
235364
  channel,
235207
235365
  async (event, ...args2) => {
235208
235366
  if (isUntrustedSenderFrame(event)) {
235209
- logger93.error(
235367
+ logger94.error(
235210
235368
  `IPC ${channel} rejected: untrusted sender frame ${event.senderFrame?.url}`
235211
235369
  );
235212
235370
  throw new Error(`[${channel}] rejected: untrusted sender frame`);
235213
235371
  }
235214
235372
  if (verboseIpc) {
235215
- logger93.log(`IPC: ${channel} called with args: ${JSON.stringify(args2)}`);
235373
+ logger94.log(`IPC: ${channel} called with args: ${JSON.stringify(args2)}`);
235216
235374
  }
235217
235375
  try {
235218
235376
  const result2 = await fn2(event, ...args2);
235219
235377
  if (verboseIpc) {
235220
- logger93.log(
235378
+ logger94.log(
235221
235379
  `IPC: ${channel} returned: ${JSON.stringify(result2)?.slice(0, 100)}...`
235222
235380
  );
235223
235381
  }
235224
235382
  return result2;
235225
235383
  } catch (error51) {
235226
- logger93.error(
235384
+ logger94.error(
235227
235385
  `Error in ${fn2.name}: args: ${JSON.stringify(args2)}`,
235228
235386
  error51
235229
235387
  );
@@ -235774,7 +235932,7 @@ var init_display_snapshot2 = __esm({
235774
235932
 
235775
235933
  // src/lib/attachment-persistence.ts
235776
235934
  function sanitizeAttachmentFilename(name29) {
235777
- return name29.replace(/[^\w\s.\-()·]/g, "_").slice(0, 120) || "attachment";
235935
+ return name29.replace(/[^\p{L}\p{N}\p{M}\s.\-()·]/gu, "_").slice(0, 120) || "attachment";
235778
235936
  }
235779
235937
  function fnv1aHex(input) {
235780
235938
  let hash3 = 2166136261;
@@ -238554,6 +238712,17 @@ var init_tool_result_status = __esm({
238554
238712
  });
238555
238713
 
238556
238714
  // src/lib/tools/registry.ts
238715
+ function largestStringField(o2) {
238716
+ let key = null;
238717
+ let len = -1;
238718
+ for (const [k2, v2] of Object.entries(o2)) {
238719
+ if (typeof v2 === "string" && v2.length > len) {
238720
+ key = k2;
238721
+ len = v2.length;
238722
+ }
238723
+ }
238724
+ return key;
238725
+ }
238557
238726
  async function maybeTruncateToolOutput(toolName, result2) {
238558
238727
  if (NEVER_TRUNCATE.has(toolName) || SELF_PAGINATED_TOOLS.has(toolName) || extractImageMedia(result2)) {
238559
238728
  return { value: result2, truncated: false, totalChars: 0 };
@@ -238573,16 +238742,41 @@ async function maybeTruncateToolOutput(toolName, result2) {
238573
238742
  return { value: result2, truncated: false, totalChars: resultStr.length };
238574
238743
  }
238575
238744
  }
238745
+ const hint = TRUNCATION_HINTS[toolName] ?? TRUNCATION_HINT_DEFAULT;
238746
+ const noticeFor = (omitted, total) => `
238747
+
238748
+ [output truncated: ${omitted.toLocaleString("en-US")} of ${total.toLocaleString("en-US")} chars omitted. To see more: ${hint}]`;
238749
+ if (result2 !== null && typeof result2 === "object" && !Array.isArray(result2)) {
238750
+ const obj2 = result2;
238751
+ const field = largestStringField(obj2);
238752
+ if (field) {
238753
+ const original = obj2[field];
238754
+ const overhead = resultStr.length - original.length;
238755
+ const { text: preview2, omittedChars: omittedChars2 } = truncateLib.headTailTruncateToTokens(
238756
+ original,
238757
+ TOOL_OUTPUT_PREVIEW_HEAD_TOKENS,
238758
+ TOOL_OUTPUT_PREVIEW_TAIL_TOKENS
238759
+ );
238760
+ if (omittedChars2 > 0) {
238761
+ return {
238762
+ value: {
238763
+ ...obj2,
238764
+ [field]: `${preview2}${noticeFor(omittedChars2, original.length)}`
238765
+ },
238766
+ truncated: true,
238767
+ totalChars: resultStr.length
238768
+ };
238769
+ }
238770
+ void overhead;
238771
+ }
238772
+ }
238576
238773
  const { text: preview, omittedChars } = truncateLib.headTailTruncateToTokens(
238577
238774
  resultStr,
238578
238775
  TOOL_OUTPUT_PREVIEW_HEAD_TOKENS,
238579
238776
  TOOL_OUTPUT_PREVIEW_TAIL_TOKENS
238580
238777
  );
238581
- const notice = `
238582
-
238583
- [output truncated: ${omittedChars.toLocaleString("en-US")} of ${resultStr.length.toLocaleString("en-US")} chars omitted. To see more: for a file, call read_file again with offset/limit on the same path; for a command, narrow it (pipe through head/grep or target a specific path).]`;
238584
238778
  return {
238585
- value: `${preview}${notice}`,
238779
+ value: `${preview}${noticeFor(omittedChars, resultStr.length)}`,
238586
238780
  truncated: true,
238587
238781
  totalChars: resultStr.length
238588
238782
  };
@@ -238653,7 +238847,7 @@ function enumParam(nameOrDescription, requiredOrDefault, defaultOrOptions, optio
238653
238847
  if (opts) param2.enum = opts;
238654
238848
  return param2;
238655
238849
  }
238656
- var TOOL_OUTPUT_BYTE_CEILING, TOOL_OUTPUT_CHAR_FLOOR, TOOL_OUTPUT_TOKEN_BUDGET, TOOL_OUTPUT_PREVIEW_HEAD_TOKENS, TOOL_OUTPUT_PREVIEW_TAIL_TOKENS, NEVER_TRUNCATE, SELF_PAGINATED_TOOLS, ToolRegistry;
238850
+ var TOOL_OUTPUT_BYTE_CEILING, TOOL_OUTPUT_CHAR_FLOOR, TOOL_OUTPUT_TOKEN_BUDGET, TOOL_OUTPUT_PREVIEW_HEAD_TOKENS, TOOL_OUTPUT_PREVIEW_TAIL_TOKENS, NEVER_TRUNCATE, SELF_PAGINATED_TOOLS, TRUNCATION_HINTS, TRUNCATION_HINT_DEFAULT, ToolRegistry;
238657
238851
  var init_registry = __esm({
238658
238852
  "src/lib/tools/registry.ts"() {
238659
238853
  init_is_main_node();
@@ -238667,7 +238861,19 @@ var init_registry = __esm({
238667
238861
  TOOL_OUTPUT_PREVIEW_HEAD_TOKENS = 1500;
238668
238862
  TOOL_OUTPUT_PREVIEW_TAIL_TOKENS = 500;
238669
238863
  NEVER_TRUNCATE = /* @__PURE__ */ new Set(["browser_screenshot"]);
238670
- SELF_PAGINATED_TOOLS = /* @__PURE__ */ new Set(["read_file", "read_attachment", "session_search"]);
238864
+ SELF_PAGINATED_TOOLS = /* @__PURE__ */ new Set([
238865
+ "read_file",
238866
+ "read_attachment",
238867
+ "session_search",
238868
+ "web_search"
238869
+ ]);
238870
+ TRUNCATION_HINTS = {
238871
+ mcp_call: "call the same MCP tool with narrower arguments, or ask the server for a specific field.",
238872
+ read_url: "call read_url again with a smaller max_length, or a more specific URL.",
238873
+ grep: "narrow the path/include, or lower max_results.",
238874
+ glob: "narrow the pattern, or lower the limit."
238875
+ };
238876
+ TRUNCATION_HINT_DEFAULT = "for a file, call read_file again with offset/limit on the same path; for a command, narrow it (pipe through head/grep or target a specific path).";
238671
238877
  ToolRegistry = class {
238672
238878
  static tools = /* @__PURE__ */ new Map();
238673
238879
  /**
@@ -269574,6 +269780,49 @@ var require_turndown_cjs = __commonJS({
269574
269780
  });
269575
269781
 
269576
269782
  // src/lib/tools/web.ts
269783
+ function renderFetchedPages(pages) {
269784
+ if (pages.length === 0) return { text: "", fullyIncluded: 0 };
269785
+ const CHROME_PER_PAGE = 220;
269786
+ const perPage = Math.max(
269787
+ 500,
269788
+ Math.floor(SEARCH_OUTPUT_TOTAL_CHARS / pages.length) - CHROME_PER_PAGE
269789
+ );
269790
+ let out = "";
269791
+ let fullyIncluded = 0;
269792
+ pages.forEach((page, idx) => {
269793
+ const total = page.content.length;
269794
+ const kept = Math.min(total, perPage);
269795
+ const complete = kept >= total;
269796
+ if (complete) fullyIncluded++;
269797
+ out += `### ${idx + 1}. ${page.title}
269798
+ `;
269799
+ out += `\u{1F4CD} ${page.source ? `[${page.source}] ` : ""}${page.url}
269800
+ `;
269801
+ out += complete ? `chars 1-${total} of ${total} (complete)
269802
+
269803
+ ` : `chars 1-${kept} of ${total}
269804
+
269805
+ `;
269806
+ out += page.content.slice(0, kept);
269807
+ out += complete ? `
269808
+
269809
+ ---
269810
+
269811
+ ` : `
269812
+
269813
+ (truncated \u2014 ${total - kept} more chars; call read_url with url="${page.url}" for the full page)
269814
+
269815
+ ---
269816
+
269817
+ `;
269818
+ });
269819
+ return { text: out, fullyIncluded };
269820
+ }
269821
+ function deepFetchBudget(pageCount) {
269822
+ if (pageCount <= 0) return DEEP_FETCH_MAX;
269823
+ const share = Math.floor(DEEP_FETCH_TOTAL / pageCount);
269824
+ return Math.min(READ_URL_MAX_CAP, Math.max(DEEP_FETCH_MAX, share));
269825
+ }
269577
269826
  function getTurndown() {
269578
269827
  if (!_turndown) {
269579
269828
  _turndown = new import_turndown.default({
@@ -269824,11 +270073,12 @@ async function runDeepSearch(query, maxSources = 3, sources = "general") {
269824
270073
  const cap = Math.max(1, Math.min(maxSources, 5));
269825
270074
  const searchResults = await aggregator.search(query, sources, cap);
269826
270075
  const topUrls = searchResults.sources.filter((r3) => r3.url && r3.url.startsWith("http")).slice(0, cap);
270076
+ const perPage = deepFetchBudget(topUrls.length);
269827
270077
  const fetchedContent = await Promise.allSettled(
269828
270078
  topUrls.map(async (result2) => {
269829
270079
  const fetched = await fetchUrlContentCached(
269830
270080
  result2.url,
269831
- DEEP_FETCH_MAX,
270081
+ perPage,
269832
270082
  FETCH_TIMEOUT_MS,
269833
270083
  "Atlarix/1.0 (Deep Search)"
269834
270084
  );
@@ -269841,10 +270091,15 @@ async function runDeepSearch(query, maxSources = 3, sources = "general") {
269841
270091
  })
269842
270092
  );
269843
270093
  const validFetched = fetchedContent.filter((r3) => r3.status === "fulfilled" && r3.value !== null).map((r3) => r3.value);
270094
+ const rendered = renderFetchedPages(validFetched);
269844
270095
  let response = `# Deep Search Results for: "${query}"
269845
270096
 
269846
270097
  `;
269847
- response += `_Searched ${searchResults.sources.length} sources, analyzed ${validFetched.length} pages in depth_
270098
+ response += `_Searched ${searchResults.sources.length} sources; ${validFetched.length} page(s) read`;
270099
+ if (validFetched.length > 0) {
270100
+ response += rendered.fullyIncluded === validFetched.length ? `, all included in full` : `, ${rendered.fullyIncluded} in full and ${validFetched.length - rendered.fullyIncluded} excerpted (read_url for the rest)`;
270101
+ }
270102
+ response += `_
269848
270103
 
269849
270104
  `;
269850
270105
  response += `## Quick Overview
@@ -269854,19 +270109,7 @@ ${searchResults.formattedText}
269854
270109
  if (validFetched.length > 0) {
269855
270110
  response += `## Detailed Content Analysis
269856
270111
 
269857
- `;
269858
- validFetched.forEach((page, idx) => {
269859
- response += `### ${idx + 1}. ${page.title}
269860
- `;
269861
- response += `\u{1F4CD} ${page.url}
269862
-
269863
- `;
269864
- response += `${page.content}
269865
-
269866
- ---
269867
-
269868
- `;
269869
- });
270112
+ ${rendered.text}`;
269870
270113
  }
269871
270114
  return {
269872
270115
  // Remote deep-search content is untrusted — data, not instructions.
@@ -269947,7 +270190,7 @@ function optimizeSearchQueryKeywords(rawQuery) {
269947
270190
  const optimized = [...quoted, ...keywords.slice(0, 6)].join(" ").trim();
269948
270191
  return optimized || rawQuery;
269949
270192
  }
269950
- var import_turndown, WEB_SEARCH_SETUP_HINT, READ_URL_DEFAULT_MAX, READ_URL_MAX_CAP, DEEP_FETCH_MAX, FETCH_TIMEOUT_MS, FETCH_TIMEOUT_MAX_MS, BROWSER_USER_AGENT, _turndown, READER_PARTITION, BROWSER_ESCALATION_STATUSES, JS_SHELL_MAX_TEXT_CHARS, JS_SHELL_MIN_HTML_BYTES, EXTERNAL_SCRIPT_RE, BROWSER_EXTRACT_TIMEOUT_MS, POST_RENDER_MIN_CHARS, READER_HTML_SCRIPT, RELEVANCE_STOP_WORDS, WEB_SEARCH_GLOBAL_CACHE, WEB_SEARCH_GLOBAL_IN_FLIGHT, WEB_SEARCH_CACHE_TTL, READ_URL_CACHE, READ_URL_IN_FLIGHT, READ_URL_CACHE_TTL, READ_URL_CACHE_MAX_CHARS, WebSearchAggregator;
270193
+ var import_turndown, WEB_SEARCH_SETUP_HINT, READ_URL_DEFAULT_MAX, READ_URL_MAX_CAP, DEEP_FETCH_MAX, DEEP_FETCH_TOTAL, SEARCH_OUTPUT_TOTAL_CHARS, FETCH_TIMEOUT_MS, FETCH_TIMEOUT_MAX_MS, BROWSER_USER_AGENT, _turndown, READER_PARTITION, BROWSER_ESCALATION_STATUSES, JS_SHELL_MAX_TEXT_CHARS, JS_SHELL_MIN_HTML_BYTES, EXTERNAL_SCRIPT_RE, BROWSER_EXTRACT_TIMEOUT_MS, POST_RENDER_MIN_CHARS, READER_HTML_SCRIPT, RELEVANCE_STOP_WORDS, WEB_SEARCH_GLOBAL_CACHE, WEB_SEARCH_GLOBAL_IN_FLIGHT, WEB_SEARCH_CACHE_TTL, READ_URL_CACHE, READ_URL_IN_FLIGHT, READ_URL_CACHE_TTL, READ_URL_CACHE_MAX_CHARS, WebSearchAggregator;
269951
270194
  var init_web = __esm({
269952
270195
  "src/lib/tools/web.ts"() {
269953
270196
  init_registry();
@@ -269960,6 +270203,8 @@ var init_web = __esm({
269960
270203
  READ_URL_DEFAULT_MAX = 2e4;
269961
270204
  READ_URL_MAX_CAP = 5e4;
269962
270205
  DEEP_FETCH_MAX = 2e4;
270206
+ DEEP_FETCH_TOTAL = 1e5;
270207
+ SEARCH_OUTPUT_TOTAL_CHARS = 24e3;
269963
270208
  FETCH_TIMEOUT_MS = 2e4;
269964
270209
  FETCH_TIMEOUT_MAX_MS = 6e4;
269965
270210
  BROWSER_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36";
@@ -270154,12 +270399,14 @@ ${fetched.content}`;
270154
270399
  })
270155
270400
  );
270156
270401
  const validFetched = fetchedContent.filter((r3) => r3.status === "fulfilled" && r3.value !== null).map((r3) => r3.value);
270402
+ const rendered = renderFetchedPages(validFetched);
270157
270403
  let response = `# \u{1F50D} ${searchMode.toUpperCase()} Search: "${query}"
270158
270404
 
270159
270405
  `;
270160
270406
  response += `_Searched ${searchResults.sources.length} sources`;
270161
270407
  if (validFetched.length > 0) {
270162
- response += `, analyzed ${validFetched.length} pages in depth`;
270408
+ response += `; ${validFetched.length} page(s) read`;
270409
+ response += rendered.fullyIncluded === validFetched.length ? `, all included in full` : `, ${rendered.fullyIncluded} in full and ${validFetched.length - rendered.fullyIncluded} excerpted (read_url for the rest)`;
270163
270410
  }
270164
270411
  response += `_
270165
270412
 
@@ -270171,19 +270418,7 @@ ${searchResults.formattedText}
270171
270418
  if (validFetched.length > 0) {
270172
270419
  response += `## Detailed Content Analysis
270173
270420
 
270174
- `;
270175
- validFetched.forEach((page, idx) => {
270176
- response += `### ${idx + 1}. ${page.title}
270177
- `;
270178
- response += `\u{1F4CD} [${page.source}] ${page.url}
270179
-
270180
- `;
270181
- response += `${page.content}
270182
-
270183
- ---
270184
-
270185
- `;
270186
- });
270421
+ ${rendered.text}`;
270187
270422
  }
270188
270423
  if (searchMode === "comprehensive" && validFetched.length > 1) {
270189
270424
  response += `## Cross-Reference Summary
@@ -320054,17 +320289,17 @@ function createTabNetworkLog(tabId) {
320054
320289
  function bodyKey(method, url2) {
320055
320290
  return `${method.toUpperCase()} ${url2}`;
320056
320291
  }
320057
- function beginRequest(log95, entry) {
320292
+ function beginRequest(log96, entry) {
320058
320293
  const epoch = currentNavigationEpoch(entry.tabId);
320059
- log95.pending.set(entry.id, {
320294
+ log96.pending.set(entry.id, {
320060
320295
  ...entry,
320061
320296
  navSeq: entry.navSeq ?? epoch.seq,
320062
320297
  pageUrl: entry.pageUrl ?? epoch.pageUrl
320063
320298
  });
320064
320299
  }
320065
- function completeRequest(log95, id, patch, fallback) {
320066
- const started = log95.pending.get(id);
320067
- if (started) log95.pending.delete(id);
320300
+ function completeRequest(log96, id, patch, fallback) {
320301
+ const started = log96.pending.get(id);
320302
+ if (started) log96.pending.delete(id);
320068
320303
  const base = started ?? (fallback ? {
320069
320304
  id,
320070
320305
  startedAt: patch.finishedAt ?? Date.now(),
@@ -320083,33 +320318,33 @@ function completeRequest(log95, id, patch, fallback) {
320083
320318
  };
320084
320319
  if (merged.responseBody === void 0 && merged.url) {
320085
320320
  const key = bodyKey(merged.method, merged.url);
320086
- const orphan = log95.orphanBodies.get(key);
320321
+ const orphan = log96.orphanBodies.get(key);
320087
320322
  if (orphan) {
320088
- log95.orphanBodies.delete(key);
320323
+ log96.orphanBodies.delete(key);
320089
320324
  merged.responseBody = orphan.body;
320090
320325
  merged.responseBodyTruncated = orphan.truncated;
320091
320326
  }
320092
320327
  }
320093
- log95.entries.push(merged);
320094
- if (log95.entries.length > NETWORK_ENTRIES_PER_TAB_MAX) {
320095
- log95.entries = log95.entries.slice(-NETWORK_ENTRIES_PER_TAB_MAX);
320328
+ log96.entries.push(merged);
320329
+ if (log96.entries.length > NETWORK_ENTRIES_PER_TAB_MAX) {
320330
+ log96.entries = log96.entries.slice(-NETWORK_ENTRIES_PER_TAB_MAX);
320096
320331
  }
320097
320332
  return merged;
320098
320333
  }
320099
- function attachResponseBody(log95, captured) {
320334
+ function attachResponseBody(log96, captured) {
320100
320335
  const key = bodyKey(captured.method, captured.url);
320101
- for (let i4 = log95.entries.length - 1; i4 >= 0; i4--) {
320102
- const entry = log95.entries[i4];
320336
+ for (let i4 = log96.entries.length - 1; i4 >= 0; i4--) {
320337
+ const entry = log96.entries[i4];
320103
320338
  if (entry.responseBody !== void 0) continue;
320104
320339
  if (bodyKey(entry.method, entry.url) !== key) continue;
320105
320340
  entry.responseBody = captured.body;
320106
320341
  entry.responseBodyTruncated = captured.truncated;
320107
320342
  return true;
320108
320343
  }
320109
- log95.orphanBodies.set(key, { body: captured.body, truncated: captured.truncated });
320110
- if (log95.orphanBodies.size > NETWORK_ORPHAN_BODIES_MAX) {
320111
- const oldest = log95.orphanBodies.keys().next();
320112
- if (!oldest.done) log95.orphanBodies.delete(oldest.value);
320344
+ log96.orphanBodies.set(key, { body: captured.body, truncated: captured.truncated });
320345
+ if (log96.orphanBodies.size > NETWORK_ORPHAN_BODIES_MAX) {
320346
+ const oldest = log96.orphanBodies.keys().next();
320347
+ if (!oldest.done) log96.orphanBodies.delete(oldest.value);
320113
320348
  }
320114
320349
  return false;
320115
320350
  }
@@ -321264,14 +321499,14 @@ var init_preview_verify = __esm({
321264
321499
  // src/lib/tools/browser-recorder.ts
321265
321500
  function recordBrowserAction(chatId, type2, detail, url2) {
321266
321501
  if (chatId == null) return;
321267
- const steps = byChat.get(chatId) ?? [];
321502
+ const steps = byChat2.get(chatId) ?? [];
321268
321503
  steps.push({ type: type2, detail: detail.slice(0, 300), url: url2, ts: Date.now() });
321269
321504
  if (steps.length > MAX_STEPS) steps.splice(0, steps.length - MAX_STEPS);
321270
- byChat.set(chatId, steps);
321505
+ byChat2.set(chatId, steps);
321271
321506
  }
321272
321507
  function getBrowserRecording(chatId) {
321273
321508
  if (chatId == null) return [];
321274
- return byChat.get(chatId) ?? [];
321509
+ return byChat2.get(chatId) ?? [];
321275
321510
  }
321276
321511
  function formatBrowserRecordingArtifact(chatId) {
321277
321512
  const steps = getBrowserRecording(chatId);
@@ -321283,11 +321518,11 @@ function formatBrowserRecordingArtifact(chatId) {
321283
321518
  return `## Browser session walkthrough (${steps.length} step${steps.length === 1 ? "" : "s"})
321284
321519
  ${lines.join("\n")}`;
321285
321520
  }
321286
- var MAX_STEPS, byChat;
321521
+ var MAX_STEPS, byChat2;
321287
321522
  var init_browser_recorder = __esm({
321288
321523
  "src/lib/tools/browser-recorder.ts"() {
321289
321524
  MAX_STEPS = 200;
321290
- byChat = /* @__PURE__ */ new Map();
321525
+ byChat2 = /* @__PURE__ */ new Map();
321291
321526
  }
321292
321527
  });
321293
321528
 
@@ -323542,7 +323777,7 @@ async function readHierarchy(device) {
323542
323777
  if (gap) return { ok: false, error: gap };
323543
323778
  const r3 = await runDeviceCli(
323544
323779
  "adb",
323545
- ["-s", device.id, "shell", "uiautomator", "dump", "/dev/tty"],
323780
+ ["-s", device.id, "exec-out", "uiautomator", "dump", "/dev/tty"],
323546
323781
  { timeoutMs: 25e3 }
323547
323782
  );
323548
323783
  if (!r3.ok) return { ok: false, error: r3.error };
@@ -323553,7 +323788,9 @@ async function readHierarchy(device) {
323553
323788
  error: 'uiautomator returned no XML. The screen may be mid-transition \u2014 retry once; if it persists the foreground app draws its own surface and only mode:"screenshot" can see it.'
323554
323789
  };
323555
323790
  }
323556
- return { ok: true, xml: r3.stdout.slice(start) };
323791
+ const end = r3.stdout.lastIndexOf("</hierarchy>");
323792
+ const xml = end > start ? r3.stdout.slice(start, end + "</hierarchy>".length) : r3.stdout.slice(start);
323793
+ return { ok: true, xml };
323557
323794
  }
323558
323795
  async function resolveRef2(device, ref) {
323559
323796
  const h3 = await readHierarchy(device);
@@ -323590,7 +323827,11 @@ var init_mobile = __esm({
323590
323827
  // carry the cheap default (a TEXT hierarchy) — not an introduction. Making
323591
323828
  // the default the cheap path is also why this tool needs no NEVER_TRIM
323592
323829
  // entry: a model that calls it with no arguments gets the right read.
323593
- 'Read the screen of a running Android emulator or iOS Simulator as TEXT: called with no `mode` it returns the UI hierarchy \u2014 every interactive element with a stable `ref` for the `mobile` tool to act on \u2014 which answers "what is on screen", "is the button there" and "did the form submit" in a few hundred tokens.\nmode:"screenshot" \u2014 a literal PNG and a LAST RESORT (thousands of tokens): only when the user needs the actual image (a design to match, a rendering artefact, a custom-drawn surface). NEVER to answer "what do you see" or to find an element \u2014 the hierarchy already does that, in text.\nmode:"logs" \u2014 a bounded tail of the device log, filtered to warnings and errors by default. This is where a crash\'s stack trace is.\nmode:"devices" \u2014 what is running, when you need to name one.\niOS Simulator has NO hierarchy and NO input (a `simctl` limitation, not a transient failure): screenshots and logs work, refs and taps do not.'
323830
+ // WAS 311 CHARS AND SILENTLY TRUNCATED at `firstSentence`'s 200-char cap,
323831
+ // which dropped "in a few hundred tokens" — the cheap-default claim this whole
323832
+ // design rests on. Measured and shortened 2026-09-04. Keep it under 200 with no
323833
+ // internal ". ", or the binding loses its point again.
323834
+ 'Read an Android emulator or iOS Simulator screen as TEXT \u2014 with no `mode` it returns the UI hierarchy: every interactive element with a stable `ref` for the `mobile` tool, in a few hundred tokens.\nmode:"screenshot" \u2014 a literal PNG and a LAST RESORT (thousands of tokens): only when the user needs the actual image (a design to match, a rendering artefact, a custom-drawn surface). NEVER to answer "what do you see" or to find an element \u2014 the hierarchy already does that, in text.\nmode:"logs" \u2014 a bounded tail of the device log, filtered to warnings and errors by default. This is where a crash\'s stack trace is.\nmode:"devices" \u2014 what is running, when you need to name one.\niOS Simulator has NO hierarchy and NO input (a `simctl` limitation, not a transient failure): screenshots and logs work, refs and taps do not.'
323594
323835
  ),
323595
323836
  parameters: {
323596
323837
  type: "object",
@@ -323842,13 +324083,30 @@ var init_mobile = __esm({
323842
324083
  error: `"${pkg}" is not a package identifier. Expected something like com.example.app \u2014 letters, digits, dots, dashes and underscores only.`
323843
324084
  };
323844
324085
  }
323845
- const r4 = device.platform === "android" ? await runDeviceCli(
323846
- "adb",
323847
- ["-s", device.id, "shell", "monkey", "-p", pkg, "-c", "android.intent.category.LAUNCHER", "1"],
323848
- { timeoutMs: 25e3 }
323849
- ) : await runDeviceCli("xcrun", ["simctl", "launch", device.id, pkg], {
323850
- timeoutMs: 25e3
323851
- });
324086
+ let r4;
324087
+ if (device.platform === "android") {
324088
+ const resolved3 = await runDeviceCli(
324089
+ "adb",
324090
+ ["-s", device.id, "shell", "cmd", "package", "resolve-activity", "--brief", pkg],
324091
+ { timeoutMs: 15e3 }
324092
+ );
324093
+ const component = resolved3.ok ? resolved3.stdout.split(/\r?\n/).map((l3) => l3.trim()).filter((l3) => /^[A-Za-z0-9_.]+\/[A-Za-z0-9_.$]+$/.test(l3)).pop() ?? "" : "";
324094
+ if (!component) {
324095
+ return {
324096
+ success: false,
324097
+ error: `"${pkg}" has no launchable activity on ${device.label} \u2014 it may not be installed. Check with mobile_inspect(mode:"devices") that you have the right device, and confirm the package name. Do not retry with the same value.`
324098
+ };
324099
+ }
324100
+ r4 = await runDeviceCli(
324101
+ "adb",
324102
+ ["-s", device.id, "shell", "am", "start", "-n", component],
324103
+ { timeoutMs: 25e3 }
324104
+ );
324105
+ } else {
324106
+ r4 = await runDeviceCli("xcrun", ["simctl", "launch", device.id, pkg], {
324107
+ timeoutMs: 25e3
324108
+ });
324109
+ }
323852
324110
  if (!r4.ok) return { success: false, error: r4.error };
323853
324111
  return {
323854
324112
  success: true,
@@ -325329,6 +325587,9 @@ function shouldDropSystemWake(req, state) {
325329
325587
  if (state.userStopped) return "user-stopped";
325330
325588
  return null;
325331
325589
  }
325590
+ function shouldClearUserStopLatch(req) {
325591
+ return !req.systemWake;
325592
+ }
325332
325593
  function isChatStreamLive(chatId) {
325333
325594
  return activeStreams.has(chatId) || activeStreamRuns.has(chatId);
325334
325595
  }
@@ -326303,6 +326564,37 @@ function registerSessionHandlers() {
326303
326564
  return { success: true, restream: true };
326304
326565
  }
326305
326566
  );
326567
+ setUserInterjectionNotifier((chatId, pending2) => {
326568
+ broadcastToAllWindows("chat:interjections", { chatId, pending: pending2 });
326569
+ });
326570
+ ipcMain.handle(
326571
+ "chat:interject",
326572
+ (_e2, payload) => {
326573
+ const entry = recordUserInterjection(Number(payload?.chatId), {
326574
+ id: String(payload?.id ?? ""),
326575
+ text: String(payload?.text ?? "")
326576
+ });
326577
+ return {
326578
+ ok: entry != null,
326579
+ pending: listPendingUserInterjections(Number(payload?.chatId))
326580
+ };
326581
+ }
326582
+ );
326583
+ ipcMain.handle(
326584
+ "chat:interject-cancel",
326585
+ (_e2, payload) => {
326586
+ const chatId = Number(payload?.chatId);
326587
+ const ok = cancelUserInterjection(chatId, String(payload?.id ?? ""));
326588
+ return { ok, pending: listPendingUserInterjections(chatId) };
326589
+ }
326590
+ );
326591
+ ipcMain.handle(
326592
+ "chat:interject-list",
326593
+ (_e2, chatId) => listPendingUserInterjections(Number(chatId))
326594
+ );
326595
+ ipcMain.handle("chat:interject-flush", (_e2, chatId) => ({
326596
+ text: takeUserInterjectionsAsPrompt(Number(chatId))
326597
+ }));
326306
326598
  }
326307
326599
  var import_electron_log68, logger67;
326308
326600
  var init_session_handlers = __esm({
@@ -326314,6 +326606,8 @@ var init_session_handlers = __esm({
326314
326606
  init_safe_sender();
326315
326607
  init_stream_lifecycle();
326316
326608
  init_stream_state();
326609
+ init_user_interjections();
326610
+ init_broadcast_all_windows();
326317
326611
  logger67 = import_electron_log68.default.scope("chat_stream_handlers");
326318
326612
  }
326319
326613
  });
@@ -326669,18 +326963,16 @@ async function processResponseChunkUpdate(deps, { fullResponse }) {
326669
326963
  );
326670
326964
  }
326671
326965
  const currentMessages = [...updatedChat.messages];
326672
- if (currentMessages.length > 0 && currentMessages[currentMessages.length - 1].role === "assistant") {
326673
- currentMessages[currentMessages.length - 1].content = fullResponse;
326674
- {
326675
- const lastIdx = updatedChat.messages.length - 1;
326676
- if (lastIdx >= 0 && updatedChat.messages[lastIdx]?.role === "assistant") {
326677
- updatedChat.messages[lastIdx].content = fullResponse;
326678
- const { getStreamTransport: getStreamTransport2 } = await Promise.resolve().then(() => (init_stream_transport(), stream_transport_exports));
326679
- const ec3 = getStreamTransport2(req.chatId);
326680
- if (ec3) {
326681
- ec3.messages = updatedChat.messages;
326682
- }
326683
- }
326966
+ const placeholderId = deps.placeholderAssistantMessage?.id;
326967
+ const idx = placeholderId != null ? currentMessages.findIndex((m3) => m3?.id === placeholderId) : -1;
326968
+ const targetIdx = idx >= 0 ? idx : currentMessages.length > 0 && currentMessages[currentMessages.length - 1].role === "assistant" ? currentMessages.length - 1 : -1;
326969
+ if (targetIdx >= 0) {
326970
+ currentMessages[targetIdx].content = fullResponse;
326971
+ updatedChat.messages[targetIdx].content = fullResponse;
326972
+ const { getStreamTransport: getStreamTransport2 } = await Promise.resolve().then(() => (init_stream_transport(), stream_transport_exports));
326973
+ const ec3 = getStreamTransport2(req.chatId);
326974
+ if (ec3) {
326975
+ ec3.messages = updatedChat.messages;
326684
326976
  }
326685
326977
  }
326686
326978
  safeSend(event.sender, "chat:response:chunk", {
@@ -328940,6 +329232,47 @@ var init_dropped_history_notice = __esm({
328940
329232
  }
328941
329233
  });
328942
329234
 
329235
+ // src/ipc/handlers/chat_stream/interjection-delivery.ts
329236
+ async function deliverInterjectionsToTranscript(args2) {
329237
+ const { chatId, streamId, event, placeholderMessageId, interjections } = args2;
329238
+ if (!interjections.length) return;
329239
+ try {
329240
+ const { isStreamTransportId: isStreamTransportId2, getStreamTransport: getStreamTransport2, insertUserInterjectionMessage: insertUserInterjectionMessage2 } = await Promise.resolve().then(() => (init_stream_transport(), stream_transport_exports));
329241
+ if (!isStreamTransportId2(chatId)) return;
329242
+ for (const item of interjections) {
329243
+ let rowId;
329244
+ try {
329245
+ const {
329246
+ resolveOrBindWorkspaceSessionForStream: resolveOrBindWorkspaceSessionForStream2,
329247
+ persistWorkspaceSessionUserMessage: persistWorkspaceSessionUserMessage2
329248
+ } = await Promise.resolve().then(() => (init_workspace_session_handlers(), workspace_session_handlers_exports));
329249
+ const sessionId = await resolveOrBindWorkspaceSessionForStream2({ chatId });
329250
+ const row = await persistWorkspaceSessionUserMessage2(sessionId, item.text, {});
329251
+ rowId = row?.id;
329252
+ } catch (err2) {
329253
+ logger76.warn(`[interjection] could not persist to session: ${String(err2)}`);
329254
+ }
329255
+ insertUserInterjectionMessage2(chatId, item.text, placeholderMessageId, rowId);
329256
+ }
329257
+ const chat = getStreamTransport2(chatId);
329258
+ safeSend(event.sender, "chat:response:chunk", {
329259
+ chatId,
329260
+ streamId,
329261
+ messages: [...chat?.messages ?? []]
329262
+ });
329263
+ } catch (err2) {
329264
+ logger76.warn(`[interjection] transcript insert failed: ${String(err2)}`);
329265
+ }
329266
+ }
329267
+ var import_electron_log77, logger76;
329268
+ var init_interjection_delivery = __esm({
329269
+ "src/ipc/handlers/chat_stream/interjection-delivery.ts"() {
329270
+ import_electron_log77 = __toESM(require_src());
329271
+ init_safe_sender();
329272
+ logger76 = import_electron_log77.default.scope("user-interjections");
329273
+ }
329274
+ });
329275
+
328943
329276
  // src/lib/ai/merge-system-prompt.ts
328944
329277
  function mergeSystemPromptParts(stable, ...dynamicParts) {
328945
329278
  const parts = [stable, ...dynamicParts].filter(
@@ -328958,18 +329291,37 @@ function perfReportOnce(key, label) {
328958
329291
  const start = marks.get(key);
328959
329292
  if (start == null) return;
328960
329293
  reported.add(key);
328961
- logger76.info(`[perf] ${label}: ${Date.now() - start}ms`);
329294
+ logger77.info(`[perf] ${label}: ${Date.now() - start}ms`);
328962
329295
  }
328963
- var import_electron_log77, logger76, marks, reported;
329296
+ var import_electron_log78, logger77, marks, reported;
328964
329297
  var init_perf_marks = __esm({
328965
329298
  "src/lib/perf-marks.ts"() {
328966
- import_electron_log77 = __toESM(require_src());
328967
- logger76 = import_electron_log77.default.scope("perf");
329299
+ import_electron_log78 = __toESM(require_src());
329300
+ logger77 = import_electron_log78.default.scope("perf");
328968
329301
  marks = /* @__PURE__ */ new Map();
328969
329302
  reported = /* @__PURE__ */ new Set();
328970
329303
  }
328971
329304
  });
328972
329305
 
329306
+ // src/lib/streaming/step-messages.ts
329307
+ function buildStepMessages(args2) {
329308
+ const { messages, injected, interjections, tag } = args2;
329309
+ const hasInterjections = (interjections?.length ?? 0) > 0;
329310
+ if (!injected && !hasInterjections) {
329311
+ return { messages, changed: false };
329312
+ }
329313
+ const out = [...messages];
329314
+ if (injected) out.push({ role: "user", content: tag(injected) });
329315
+ for (const m3 of interjections ?? []) {
329316
+ out.push({ role: "user", content: m3.text });
329317
+ }
329318
+ return { messages: out, changed: true };
329319
+ }
329320
+ var init_step_messages = __esm({
329321
+ "src/lib/streaming/step-messages.ts"() {
329322
+ }
329323
+ });
329324
+
328973
329325
  // src/ipc/handlers/chat_stream/turn-runner/simple-stream-text.ts
328974
329326
  function providerOptionsBucketName(providerId) {
328975
329327
  const camel = providerId.replace(/[-_](\w)/g, (_4, c2) => c2.toUpperCase());
@@ -329003,7 +329355,7 @@ async function simpleStreamText(ctx, deps, {
329003
329355
  abortController
329004
329356
  } = deps;
329005
329357
  const forceCollectOnWake = deps.forceCollectOnWake && !ctx.forcedToolChoiceRejected;
329006
- logger77.log("sending AI request");
329358
+ logger78.log("sending AI request");
329007
329359
  const optionsModel = getEffectiveModelForOptions(settings);
329008
329360
  const thinkingTier = enableNativeReasoning;
329009
329361
  const maxOutputTokens = await preflight.time(
@@ -329022,7 +329374,7 @@ async function simpleStreamText(ctx, deps, {
329022
329374
  provider: JSON.parse(pinJson)
329023
329375
  };
329024
329376
  } catch (e3) {
329025
- logger77.warn(
329377
+ logger78.warn(
329026
329378
  `Ignoring invalid ATLARIX_OPENROUTER_PROVIDER_JSON: ${e3 instanceof Error ? e3.message : String(e3)}`
329027
329379
  );
329028
329380
  }
@@ -329130,7 +329482,7 @@ async function simpleStreamText(ctx, deps, {
329130
329482
  ]
329131
329483
  };
329132
329484
  }
329133
- logger77.log(
329485
+ logger78.log(
329134
329486
  `[native-web-search] ${nativeWeb.kind} active (${modelClient.builtinProviderId}); dropped client tools: ${[...reserved].join(", ")}`
329135
329487
  );
329136
329488
  }
@@ -329241,21 +329593,27 @@ async function simpleStreamText(ctx, deps, {
329241
329593
  const taskLedger = stepNumber === 0 ? currentPlanLedger(req.chatId) ?? taskLedgerBlock : takeRefreshedPlanLedger(req.chatId);
329242
329594
  const emptyOutputNudge = ctx.pendingEmptyOutputNudge;
329243
329595
  ctx.pendingEmptyOutputNudge = null;
329596
+ const interjections = takePendingUserInterjections(req.chatId);
329244
329597
  if (correction) {
329245
- logger77.log(
329598
+ logger78.log(
329246
329599
  `[repetition] injecting mid-round correction (chat ${req.chatId})`
329247
329600
  );
329248
329601
  }
329249
329602
  if (bgResults) {
329250
- logger77.log(
329603
+ logger78.log(
329251
329604
  `[background-command] injecting finished result (chat ${req.chatId})`
329252
329605
  );
329253
329606
  }
329254
329607
  if (subagentResults) {
329255
- logger77.log(
329608
+ logger78.log(
329256
329609
  `[background-subagent] injecting finished result (chat ${req.chatId})`
329257
329610
  );
329258
329611
  }
329612
+ if (interjections?.length) {
329613
+ logger78.log(
329614
+ `[interjection] delivering ${interjections.length} mid-turn user message(s) (chat ${req.chatId}, step ${stepNumber})`
329615
+ );
329616
+ }
329259
329617
  const injected = [
329260
329618
  reminder,
329261
329619
  droppedHistory,
@@ -329268,16 +329626,38 @@ async function simpleStreamText(ctx, deps, {
329268
329626
  // Task ledger + mode re-anchor LAST so they are the final
329269
329627
  // things the model reads before it acts.
329270
329628
  taskLedger,
329271
- modeReanchor
329629
+ modeReanchor,
329630
+ // The harness half of a mid-turn message: the user's own words
329631
+ // go below, UNTAGGED, and this says how to read them. Kept in
329632
+ // the tagged block on purpose — guidance about the message is
329633
+ // the harness talking, and putting it in the user's mouth is
329634
+ // exactly the confusion the tag convention exists to prevent.
329635
+ interjections?.length ? `The user sent ${interjections.length === 1 ? "a message" : `${interjections.length} messages`} while you were working; ${interjections.length === 1 ? "it appears" : "they appear"} below as ${interjections.length === 1 ? "a real user turn" : "real user turns, oldest first"}. Fold ${interjections.length === 1 ? "it" : "them"} into what you are already doing and continue \u2014 do NOT restart, re-greet, or re-answer earlier requests. If ${interjections.length === 1 ? "it changes" : "they change"} the goal, say so briefly and change course.` : null
329272
329636
  ].filter(Boolean).join("\n\n");
329273
- const stepMessages = injected ? [...messages, { role: "user", content: systemReminder(injected) }] : messages;
329637
+ const assembled = buildStepMessages({
329638
+ messages,
329639
+ injected,
329640
+ interjections,
329641
+ tag: systemReminder
329642
+ });
329643
+ const stepMessages = assembled.messages;
329644
+ if (interjections?.length) {
329645
+ void deliverInterjectionsToTranscript({
329646
+ chatId: req.chatId,
329647
+ streamId,
329648
+ event,
329649
+ placeholderMessageId: Number(placeholderAssistantMessage?.id),
329650
+ interjections
329651
+ });
329652
+ }
329274
329653
  const forceCollect = forceCollectOnWake && stepNumber === 0;
329275
- const base = cacheMarkerPlacement !== "none" && (stepNumber > 0 || injected) ? {
329654
+ const changedMessages = assembled.changed;
329655
+ const base = cacheMarkerPlacement !== "none" && (stepNumber > 0 || changedMessages) ? {
329276
329656
  messages: advanceCacheBreakpointsForStep(
329277
329657
  stepMessages,
329278
329658
  cacheMarkerPlacement
329279
329659
  )
329280
- } : injected ? { messages: stepMessages } : void 0;
329660
+ } : changedMessages ? { messages: stepMessages } : void 0;
329281
329661
  if (forceCollect) {
329282
329662
  return {
329283
329663
  ...base ?? { messages },
@@ -329372,7 +329752,7 @@ async function simpleStreamText(ctx, deps, {
329372
329752
  ctx.turnActualCostUsd += orUsage.cost;
329373
329753
  }
329374
329754
  if (typeof cacheRead === "number" && cacheRead > 0 || typeof cacheWrite === "number" && cacheWrite > 0) {
329375
- logger77.log(
329755
+ logger78.log(
329376
329756
  `[prompt-cache] chat ${req.chatId}: read=${cacheRead ?? 0} write=${cacheWrite ?? 0} input=${response.usage?.inputTokens ?? "?"}`
329377
329757
  );
329378
329758
  }
@@ -329388,32 +329768,32 @@ async function simpleStreamText(ctx, deps, {
329388
329768
  }
329389
329769
  if (typeof totalTokens === "number" && totalTokens > 0) {
329390
329770
  ctx.maxTokensUsed = Math.max(ctx.maxTokensUsed ?? 0, totalTokens);
329391
- logger77.log(
329771
+ logger78.log(
329392
329772
  `Total tokens used (aggregated for message ${placeholderAssistantMessage.id}): ${ctx.maxTokensUsed}`
329393
329773
  );
329394
329774
  } else {
329395
- logger77.log(
329775
+ logger78.log(
329396
329776
  `Total tokens used (aggregated for message ${placeholderAssistantMessage.id}): unavailable (no total or prompt/completion counts from provider)`
329397
329777
  );
329398
329778
  }
329399
329779
  },
329400
329780
  onError: (error51) => {
329401
329781
  if (isNoUsableModelOutputError(error51)) {
329402
- logger77.warn(
329782
+ logger78.warn(
329403
329783
  "[stream] onError: empty/no usable model output (handled by consumption/retry or auxiliary handlers)",
329404
329784
  error51
329405
329785
  );
329406
329786
  return;
329407
329787
  }
329408
329788
  if (isNetworkStreamError(error51)) {
329409
- logger77.warn(
329789
+ logger78.warn(
329410
329790
  "[stream] onError: network/transport failure (will retry silently)",
329411
329791
  error51
329412
329792
  );
329413
329793
  return;
329414
329794
  }
329415
329795
  if (isForcedToolChoiceRejection(error51)) {
329416
- logger77.warn(
329796
+ logger78.warn(
329417
329797
  "[stream] onError: provider rejected the forced tool_choice (retrying without it)",
329418
329798
  error51
329419
329799
  );
@@ -329434,7 +329814,7 @@ async function simpleStreamText(ctx, deps, {
329434
329814
  const statusCode = error51?.statusCode ?? error51?.error?.statusCode;
329435
329815
  const rawBody = error51?.responseBody ?? error51?.error?.responseBody ?? "";
329436
329816
  const bodyStr = typeof rawBody === "string" ? rawBody : JSON.stringify(rawBody ?? "");
329437
- logger77.error(
329817
+ logger78.error(
329438
329818
  `[compass] upstream failure status=${statusCode ?? "none"} body=${bodyStr.slice(0, 800)}`
329439
329819
  );
329440
329820
  const classified = classifyCompassFailure(statusCode, bodyStr);
@@ -329443,7 +329823,7 @@ async function simpleStreamText(ctx, deps, {
329443
329823
  } else {
329444
329824
  message = modelFailureUserMessage(message);
329445
329825
  }
329446
- logger77.error(
329826
+ logger78.error(
329447
329827
  `AI stream text error for request: errorMessage=${errorMessage} error=`,
329448
329828
  error51
329449
329829
  );
@@ -329467,7 +329847,7 @@ async function simpleStreamText(ctx, deps, {
329467
329847
  });
329468
329848
  attachEmptyOutputSafeRejectHandlers(
329469
329849
  streamResult,
329470
- logger77.warn.bind(logger77),
329850
+ logger78.warn.bind(logger78),
329471
329851
  "chat_stream"
329472
329852
  );
329473
329853
  return {
@@ -329493,10 +329873,10 @@ async function simpleStreamText(ctx, deps, {
329493
329873
  getResumeMessages: () => completedStepMessages.slice()
329494
329874
  };
329495
329875
  }
329496
- var import_electron_log78, logger77;
329876
+ var import_electron_log79, logger78;
329497
329877
  var init_simple_stream_text = __esm({
329498
329878
  "src/ipc/handlers/chat_stream/turn-runner/simple-stream-text.ts"() {
329499
- import_electron_log78 = __toESM(require_src());
329879
+ import_electron_log79 = __toESM(require_src());
329500
329880
  init_dist21();
329501
329881
  init_get_model_client();
329502
329882
  init_ai_usage();
@@ -329517,6 +329897,8 @@ var init_simple_stream_text = __esm({
329517
329897
  init_scheduled_wakeups();
329518
329898
  init_dropped_history_notice();
329519
329899
  init_subagent_results();
329900
+ init_user_interjections();
329901
+ init_interjection_delivery();
329520
329902
  init_anthropic_cache_breakpoints();
329521
329903
  init_merge_system_prompt();
329522
329904
  init_normalize_tool_schema();
@@ -329524,8 +329906,9 @@ var init_simple_stream_text = __esm({
329524
329906
  init_byok_pricing();
329525
329907
  init_reasoning_detector();
329526
329908
  init_system_reminder();
329909
+ init_step_messages();
329527
329910
  init_texts();
329528
- logger77 = import_electron_log78.default.scope("chat_stream_handlers");
329911
+ logger78 = import_electron_log79.default.scope("chat_stream_handlers");
329529
329912
  }
329530
329913
  });
329531
329914
 
@@ -329592,7 +329975,7 @@ async function recordEditStats({
329592
329975
  }
329593
329976
  function recordEditStatsSafely(args2) {
329594
329977
  void recordEditStats(args2).catch((e3) => {
329595
- logger78.warn("failed to record edit stats", e3);
329978
+ logger79.warn("failed to record edit stats", e3);
329596
329979
  });
329597
329980
  }
329598
329981
  function resolveEditStatsModel(effectiveModel, dispatched) {
@@ -329619,16 +330002,16 @@ function dispatchedModelIdentity(modelClient) {
329619
330002
  modelId: typeof modelId === "string" ? modelId : void 0
329620
330003
  };
329621
330004
  }
329622
- var import_electron_log79, logger78;
330005
+ var import_electron_log80, logger79;
329623
330006
  var init_edit_stats2 = __esm({
329624
330007
  "src/lib/stats/edit-stats.ts"() {
329625
- import_electron_log79 = __toESM(require_src());
330008
+ import_electron_log80 = __toESM(require_src());
329626
330009
  init_drizzle_orm();
329627
330010
  init_db2();
329628
330011
  init_schema();
329629
330012
  init_compose_hunks();
329630
330013
  init_compass_constants();
329631
- logger78 = import_electron_log79.default.scope("edit-stats");
330014
+ logger79 = import_electron_log80.default.scope("edit-stats");
329632
330015
  }
329633
330016
  });
329634
330017
 
@@ -330055,7 +330438,7 @@ async function refreshPlanLedgerFromWrittenFile(params) {
330055
330438
  try {
330056
330439
  content = await readFile7(fullPath, "utf8");
330057
330440
  } catch (e3) {
330058
- logger79.warn("[refreshPlanLedgerFromWrittenFile] read failed:", e3);
330441
+ logger80.warn("[refreshPlanLedgerFromWrittenFile] read failed:", e3);
330059
330442
  return;
330060
330443
  }
330061
330444
  const digest = createHash6("sha256").update(content, "utf8").digest("hex");
@@ -330063,7 +330446,7 @@ async function refreshPlanLedgerFromWrittenFile(params) {
330063
330446
  const now2 = Date.now();
330064
330447
  const prev = refreshGuard.get(guardKey);
330065
330448
  if (prev?.hash === digest && now2 - prev.at < DEBOUNCE_MS) {
330066
- logger79.log(
330449
+ logger80.log(
330067
330450
  "[refreshPlanLedgerFromWrittenFile] skip duplicate plan body (debounced)"
330068
330451
  );
330069
330452
  return;
@@ -330105,12 +330488,12 @@ async function refreshPlanLedgerFromWrittenFile(params) {
330105
330488
  if (L2) await syncPlanFile2(workspacePath, L2);
330106
330489
  }
330107
330490
  }
330108
- var import_electron_log80, logger79, refreshGuard, DEBOUNCE_MS;
330491
+ var import_electron_log81, logger80, refreshGuard, DEBOUNCE_MS;
330109
330492
  var init_plan_ledger_from_file = __esm({
330110
330493
  "src/lib/tasks/plan-ledger-from-file.ts"() {
330111
- import_electron_log80 = __toESM(require_src());
330494
+ import_electron_log81 = __toESM(require_src());
330112
330495
  init_plan_sync();
330113
- logger79 = import_electron_log80.default.scope("plan-ledger-from-file");
330496
+ logger80 = import_electron_log81.default.scope("plan-ledger-from-file");
330114
330497
  refreshGuard = /* @__PURE__ */ new Map();
330115
330498
  DEBOUNCE_MS = 450;
330116
330499
  }
@@ -330122,7 +330505,7 @@ import pathModule from "node:path";
330122
330505
  function warnGitMissingOnce(op) {
330123
330506
  if (warnedGitMissing) return;
330124
330507
  warnedGitMissing = true;
330125
- logger80.warn(
330508
+ logger81.warn(
330126
330509
  `No git binary available (first noticed during '${op}'); git-backed features are disabled until Git is installed.`
330127
330510
  );
330128
330511
  }
@@ -330168,15 +330551,15 @@ async function getCurrentCommitHash({
330168
330551
  }
330169
330552
  return result2.stdout.trim();
330170
330553
  }
330171
- var import_electron_log81, logger80, warnedGitMissing;
330554
+ var import_electron_log82, logger81, warnedGitMissing;
330172
330555
  var init_git_utils = __esm({
330173
330556
  "src/ipc/utils/git_utils.ts"() {
330174
330557
  init_git_author();
330175
330558
  init_git_author();
330176
330559
  init_system_git_exec();
330177
330560
  init_settings();
330178
- import_electron_log81 = __toESM(require_src());
330179
- logger80 = import_electron_log81.default.scope("git_utils");
330561
+ import_electron_log82 = __toESM(require_src());
330562
+ logger81 = import_electron_log82.default.scope("git_utils");
330180
330563
  warnedGitMissing = false;
330181
330564
  }
330182
330565
  });
@@ -330238,9 +330621,9 @@ async function insertProjectSnapshot(params) {
330238
330621
  trigger
330239
330622
  });
330240
330623
  await pruneSnapshots(workspaceId);
330241
- logger81.debug("insertProjectSnapshot", { workspaceId, trigger });
330624
+ logger82.debug("insertProjectSnapshot", { workspaceId, trigger });
330242
330625
  } catch (e3) {
330243
- logger81.warn("insertProjectSnapshot failed:", e3);
330626
+ logger82.warn("insertProjectSnapshot failed:", e3);
330244
330627
  }
330245
330628
  }
330246
330629
  async function recordPlanUpdateSnapshot(workspaceId, workspacePath) {
@@ -330300,7 +330683,7 @@ async function applyProjectSnapshotRevert(workspaceId, workspacePath, snapshotId
330300
330683
  };
330301
330684
  }
330302
330685
  }
330303
- var import_electron_log82, PLAN_FILE, logger81, MAX_SNAPSHOTS_PER_WORKSPACE, touchedWorkspaces, planUpdateSnapshotDebounce, PLAN_UPDATE_SNAPSHOT_DEBOUNCE_MS;
330686
+ var import_electron_log83, PLAN_FILE, logger82, MAX_SNAPSHOTS_PER_WORKSPACE, touchedWorkspaces, planUpdateSnapshotDebounce, PLAN_UPDATE_SNAPSHOT_DEBOUNCE_MS;
330304
330687
  var init_service2 = __esm({
330305
330688
  "src/lib/project-memory/service.ts"() {
330306
330689
  init_db2();
@@ -330308,9 +330691,9 @@ var init_service2 = __esm({
330308
330691
  init_drizzle_orm();
330309
330692
  init_paths();
330310
330693
  init_git_utils();
330311
- import_electron_log82 = __toESM(require_src());
330694
+ import_electron_log83 = __toESM(require_src());
330312
330695
  PLAN_FILE = ".atlarix/ATLARIX_PLAN.md";
330313
- logger81 = import_electron_log82.default.scope("project-memory");
330696
+ logger82 = import_electron_log83.default.scope("project-memory");
330314
330697
  MAX_SNAPSHOTS_PER_WORKSPACE = 100;
330315
330698
  touchedWorkspaces = /* @__PURE__ */ new Set();
330316
330699
  planUpdateSnapshotDebounce = /* @__PURE__ */ new Map();
@@ -330323,14 +330706,14 @@ import * as fs35 from "fs/promises";
330323
330706
  import * as fsSync2 from "node:fs";
330324
330707
  import * as path45 from "path";
330325
330708
  import { EventEmitter as EventEmitter3 } from "events";
330326
- var import_electron_log83, logger82, PermissionInterceptor;
330709
+ var import_electron_log84, logger83, PermissionInterceptor;
330327
330710
  var init_interceptor = __esm({
330328
330711
  "src/ipc/handlers/permissions/interceptor.ts"() {
330329
330712
  init_realpath_contain();
330330
330713
  init_mutation_verify();
330331
330714
  init_edit_stats2();
330332
330715
  init_untrusted_data();
330333
- import_electron_log83 = __toESM(require_src());
330716
+ import_electron_log84 = __toESM(require_src());
330334
330717
  init_electron_stub();
330335
330718
  init_schema3();
330336
330719
  init_runShellCommand();
@@ -330352,7 +330735,7 @@ var init_interceptor = __esm({
330352
330735
  init_system_scope_commands();
330353
330736
  init_git_author();
330354
330737
  init_git_utils();
330355
- logger82 = import_electron_log83.default.scope("permission-interceptor");
330738
+ logger83 = import_electron_log84.default.scope("permission-interceptor");
330356
330739
  PermissionInterceptor = class extends EventEmitter3 {
330357
330740
  /** Map of operation ID to pending permission request */
330358
330741
  pendingOperations = /* @__PURE__ */ new Map();
@@ -330472,7 +330855,7 @@ var init_interceptor = __esm({
330472
330855
  }
330473
330856
  } catch {
330474
330857
  }
330475
- logger82.log(`[PermissionInterceptor] Initialized for workspace: ${workspacePath} (id: ${workspaceId}, turn: ${this.snapshotTurnId ?? "none"}, chat: ${this.activeChatId})`);
330858
+ logger83.log(`[PermissionInterceptor] Initialized for workspace: ${workspacePath} (id: ${workspaceId}, turn: ${this.snapshotTurnId ?? "none"}, chat: ${this.activeChatId})`);
330476
330859
  }
330477
330860
  /**
330478
330861
  * Approve everything for the remainder of this turn (see `turnBlanketApproved`).
@@ -330480,7 +330863,7 @@ var init_interceptor = __esm({
330480
330863
  */
330481
330864
  approveRestOfTurn() {
330482
330865
  this.turnBlanketApproved = true;
330483
- logger82.log(
330866
+ logger83.log(
330484
330867
  `[approveRestOfTurn] chat ${this.activeChatId}: approvals suppressed for the rest of this turn`
330485
330868
  );
330486
330869
  }
@@ -330548,7 +330931,7 @@ var init_interceptor = __esm({
330548
330931
  for (const win of BrowserWindow.getAllWindows()) {
330549
330932
  win.webContents.send("operation-status", payload);
330550
330933
  }
330551
- logger82.log(`[emitStatus] ${operationId} -> ${status}${error51 ? ` (${error51})` : ""}`);
330934
+ logger83.log(`[emitStatus] ${operationId} -> ${status}${error51 ? ` (${error51})` : ""}`);
330552
330935
  }
330553
330936
  /**
330554
330937
  * Set workspace ID (if not known at construction time)
@@ -330563,7 +330946,7 @@ var init_interceptor = __esm({
330563
330946
  setWorkspace(path51, id) {
330564
330947
  this.workspacePath = path51;
330565
330948
  if (id != null) this.workspaceId = id;
330566
- logger82.log(`[PermissionInterceptor] Workspace updated to: ${path51} (id: ${id})`);
330949
+ logger83.log(`[PermissionInterceptor] Workspace updated to: ${path51} (id: ${id})`);
330567
330950
  }
330568
330951
  // ════════════════════════════════════════════════════════════════════════════
330569
330952
  // DETECTION & PARSING
@@ -330590,13 +330973,13 @@ var init_interceptor = __esm({
330590
330973
  */
330591
330974
  parsePermissionRequest(result2) {
330592
330975
  if (typeof result2 === "object" && result2 !== null && result2.__permission_required) {
330593
- logger82.log("[parsePermissionRequest] Parsed object format");
330976
+ logger83.log("[parsePermissionRequest] Parsed object format");
330594
330977
  return result2;
330595
330978
  }
330596
330979
  if (typeof result2 === "string") {
330597
330980
  const parsed = parsePermissionRequest(result2);
330598
330981
  if (parsed) {
330599
- logger82.log("[parsePermissionRequest] Parsed JSON string format");
330982
+ logger83.log("[parsePermissionRequest] Parsed JSON string format");
330600
330983
  return parsed;
330601
330984
  }
330602
330985
  }
@@ -330623,7 +331006,7 @@ var init_interceptor = __esm({
330623
331006
  createdAt: Date.now()
330624
331007
  };
330625
331008
  this.pendingOperations.set(operationId, operation);
330626
- logger82.log("[Permission Request Buffered]", {
331009
+ logger83.log("[Permission Request Buffered]", {
330627
331010
  id: operationId,
330628
331011
  operation: request.operation,
330629
331012
  path: request.preview?.path || "N/A",
@@ -330672,7 +331055,7 @@ var init_interceptor = __esm({
330672
331055
  }
330673
331056
  this.pendingApprovals.clear();
330674
331057
  this.pendingOperations.clear();
330675
- logger82.log("[PermissionInterceptor] Cleared all pending operations");
331058
+ logger83.log("[PermissionInterceptor] Cleared all pending operations");
330676
331059
  }
330677
331060
  // ════════════════════════════════════════════════════════════════════════════
330678
331061
  // BLOCKING APPROVAL MECHANISM (NEW in v0.9.1)
@@ -330715,7 +331098,7 @@ var init_interceptor = __esm({
330715
331098
  // No grace timeout — indefinite block.
330716
331099
  createdAt: Date.now()
330717
331100
  });
330718
- logger82.log(`[waitForApproval] Blocking (indefinite) for user response on ${operationId}`);
331101
+ logger83.log(`[waitForApproval] Blocking (indefinite) for user response on ${operationId}`);
330719
331102
  });
330720
331103
  }
330721
331104
  /**
@@ -330729,7 +331112,7 @@ var init_interceptor = __esm({
330729
331112
  if (pending2.timeout) clearTimeout(pending2.timeout);
330730
331113
  pending2.resolve(approved ? "approved" : "rejected");
330731
331114
  this.pendingApprovals.delete(operationId);
330732
- logger82.log(`[resolveApproval] ${operationId} -> ${approved ? "APPROVED" : "REJECTED"}`);
331115
+ logger83.log(`[resolveApproval] ${operationId} -> ${approved ? "APPROVED" : "REJECTED"}`);
330733
331116
  }
330734
331117
  }
330735
331118
  // ════════════════════════════════════════════════════════════════════════════
@@ -330754,7 +331137,7 @@ var init_interceptor = __esm({
330754
331137
  const preview = request.preview;
330755
331138
  if (preview && typeof preview === "object") {
330756
331139
  preview.content = options.overrideContent;
330757
- logger82.log(
331140
+ logger83.log(
330758
331141
  `[executeOperation] per-hunk override applied for ${operationId} (${request.operation})`
330759
331142
  );
330760
331143
  }
@@ -330799,7 +331182,7 @@ var init_interceptor = __esm({
330799
331182
  }
330800
331183
  operation.status = "executed";
330801
331184
  this.emitStatus(operationId, "completed");
330802
- logger82.log(`[executeOperation] Executed ${operationId}: ${request.operation}`);
331185
+ logger83.log(`[executeOperation] Executed ${operationId}: ${request.operation}`);
330803
331186
  if (this.snapshotTurnId && CONTENT_WRITE_OPS.has(request.operation)) {
330804
331187
  recordMutationOutcome(this.snapshotTurnId, true);
330805
331188
  }
@@ -330846,7 +331229,7 @@ var init_interceptor = __esm({
330846
331229
  operation.status = "failed";
330847
331230
  const errorMessage = error51 instanceof Error ? error51.message : String(error51);
330848
331231
  this.emitStatus(operationId, "failed", void 0, void 0, errorMessage);
330849
- logger82.error(`[executeOperation] Failed ${operationId}:`, error51);
331232
+ logger83.error(`[executeOperation] Failed ${operationId}:`, error51);
330850
331233
  if (this.snapshotTurnId && CONTENT_WRITE_OPS.has(request.operation)) {
330851
331234
  recordMutationOutcome(
330852
331235
  this.snapshotTurnId,
@@ -330999,19 +331382,19 @@ var init_interceptor = __esm({
330999
331382
  }
331000
331383
  }
331001
331384
  if (operationsToExecute.length === 0) {
331002
- logger82.log("[executeAllOperations] No pending operations to execute");
331385
+ logger83.log("[executeAllOperations] No pending operations to execute");
331003
331386
  return results;
331004
331387
  }
331005
- logger82.log(`[executeAllOperations] Processing ${operationsToExecute.length} pending operations sequentially`);
331388
+ logger83.log(`[executeAllOperations] Processing ${operationsToExecute.length} pending operations sequentially`);
331006
331389
  for (const [operationId] of operationsToExecute) {
331007
331390
  const result2 = await this.executeOperation(operationId);
331008
331391
  results.push(result2);
331009
- logger82.log(`[executeAllOperations] Completed ${result2.operationId}: ${result2.approved ? "success" : "failed"}`);
331392
+ logger83.log(`[executeAllOperations] Completed ${result2.operationId}: ${result2.approved ? "success" : "failed"}`);
331010
331393
  }
331011
331394
  for (const [operationId] of operationsToExecute) {
331012
331395
  this.pendingOperations.delete(operationId);
331013
331396
  }
331014
- logger82.log(`[executeAllOperations] Completed all ${operationsToExecute.length} operations`);
331397
+ logger83.log(`[executeAllOperations] Completed all ${operationsToExecute.length} operations`);
331015
331398
  return results;
331016
331399
  }
331017
331400
  /**
@@ -331029,7 +331412,7 @@ var init_interceptor = __esm({
331029
331412
  }
331030
331413
  this.resolveApproval(operationId, false);
331031
331414
  operation.status = "rejected";
331032
- logger82.log(`[rejectOperation] Rejected ${operationId}: ${operation.request.operation}`);
331415
+ logger83.log(`[rejectOperation] Rejected ${operationId}: ${operation.request.operation}`);
331033
331416
  return {
331034
331417
  operationId,
331035
331418
  approved: false
@@ -331191,7 +331574,7 @@ var init_interceptor = __esm({
331191
331574
  if (p2) roots.push(path45.resolve(p2));
331192
331575
  }
331193
331576
  } catch (e3) {
331194
- logger82.warn(
331577
+ logger83.warn(
331195
331578
  `[writable-roots] could not read granted folders: ${e3 instanceof Error ? e3.message : String(e3)}`
331196
331579
  );
331197
331580
  }
@@ -331233,7 +331616,7 @@ var init_interceptor = __esm({
331233
331616
  grantedRoots: this.writableRoots()
331234
331617
  });
331235
331618
  } catch (e3) {
331236
- logger82.warn("[maybeCaptureWorkspaceSnapshot] skipped:", e3);
331619
+ logger83.warn("[maybeCaptureWorkspaceSnapshot] skipped:", e3);
331237
331620
  }
331238
331621
  }
331239
331622
  /**
@@ -331255,7 +331638,7 @@ var init_interceptor = __esm({
331255
331638
  if (preview.action === "delete") {
331256
331639
  if (!preview.automationId) throw new Error("Automation id missing");
331257
331640
  await svc.deleteAutomation(preview.automationId);
331258
- logger82.log(`[automation] deleted ${preview.automationId} (${preview.name})`);
331641
+ logger83.log(`[automation] deleted ${preview.automationId} (${preview.name})`);
331259
331642
  return;
331260
331643
  }
331261
331644
  const { AutomationInputSchema: AutomationInputSchema2 } = await Promise.resolve().then(() => (init_types4(), types_exports));
@@ -331270,12 +331653,12 @@ var init_interceptor = __esm({
331270
331653
  if (this.workspaceId == null) throw new Error("Workspace required");
331271
331654
  const { id } = await svc.createAutomation(this.workspaceId, input);
331272
331655
  preview.automationId = id;
331273
- logger82.log(`[automation] created ${id} (${input.name})`);
331656
+ logger83.log(`[automation] created ${id} (${input.name})`);
331274
331657
  return;
331275
331658
  }
331276
331659
  if (!preview.automationId) throw new Error("Automation id missing");
331277
331660
  await svc.updateAutomation(preview.automationId, input);
331278
- logger82.log(`[automation] updated ${preview.automationId} (${input.name})`);
331661
+ logger83.log(`[automation] updated ${preview.automationId} (${input.name})`);
331279
331662
  }
331280
331663
  async executeRevertProjectSnapshot(request) {
331281
331664
  const preview = request.preview;
@@ -331291,7 +331674,7 @@ var init_interceptor = __esm({
331291
331674
  if (!result2.success) {
331292
331675
  throw new Error(result2.error || "Revert failed");
331293
331676
  }
331294
- logger82.log(`[executeRevertProjectSnapshot] id=${preview.snapshotId}`);
331677
+ logger83.log(`[executeRevertProjectSnapshot] id=${preview.snapshotId}`);
331295
331678
  }
331296
331679
  async executeWriteFile(request) {
331297
331680
  const preview = request.preview;
@@ -331305,7 +331688,7 @@ var init_interceptor = __esm({
331305
331688
  await fs35.mkdir(path45.dirname(fullPath), { recursive: true });
331306
331689
  const intended = preview.content || "";
331307
331690
  await fs35.writeFile(fullPath, intended, "utf-8");
331308
- logger82.log(`Wrote file: ${fullPath}`);
331691
+ logger83.log(`Wrote file: ${fullPath}`);
331309
331692
  try {
331310
331693
  const onDisk = await fs35.readFile(fullPath, "utf-8");
331311
331694
  preview.verified = onDisk === intended;
@@ -331332,7 +331715,7 @@ var init_interceptor = __esm({
331332
331715
  await this.maybeCaptureWorkspaceSnapshot([this.toWorkspaceRelativePosix(preview.path)]);
331333
331716
  const fullPath = this.resolvePathWithinWorkspace(preview.path);
331334
331717
  await fs35.unlink(fullPath);
331335
- logger82.log(`Deleted file: ${fullPath}`);
331718
+ logger83.log(`Deleted file: ${fullPath}`);
331336
331719
  }
331337
331720
  async executeRenameFile(request) {
331338
331721
  const preview = request.preview;
@@ -331344,7 +331727,7 @@ var init_interceptor = __esm({
331344
331727
  const toFullPath = this.resolvePathWithinWorkspace(preview.toPath);
331345
331728
  await fs35.mkdir(path45.dirname(toFullPath), { recursive: true });
331346
331729
  await fs35.rename(fromFullPath, toFullPath);
331347
- logger82.log(`Renamed file: ${fromFullPath} \u2192 ${toFullPath}`);
331730
+ logger83.log(`Renamed file: ${fromFullPath} \u2192 ${toFullPath}`);
331348
331731
  }
331349
331732
  /**
331350
331733
  * Execute diagram update when user approves the AI's request.
@@ -331449,7 +331832,7 @@ var init_interceptor = __esm({
331449
331832
  }
331450
331833
  );
331451
331834
  } catch (e3) {
331452
- logger82.warn("[terminal-buffer] append failed:", e3);
331835
+ logger83.warn("[terminal-buffer] append failed:", e3);
331453
331836
  }
331454
331837
  this.emit("terminal-output", payload);
331455
331838
  }
@@ -331527,7 +331910,7 @@ ${result2.stdout ?? ""}`
331527
331910
  try {
331528
331911
  upsertSandboxWritablePath(this.workspaceId, denial.grantPath);
331529
331912
  } catch (e3) {
331530
- logger82.warn(
331913
+ logger83.warn(
331531
331914
  `[sandbox-escalation] persist failed: ${e3 instanceof Error ? e3.message : String(e3)}`
331532
331915
  );
331533
331916
  }
@@ -331580,12 +331963,12 @@ ${retried.stdout ?? ""}`
331580
331963
  const workspaceCdStrip = /^cd\s+\/workspace(?:\/[^\s;&|]*)?\s*(?:&&|;)\s*/;
331581
331964
  if (workspaceCdStrip.test(preview.command)) {
331582
331965
  commandToRun = preview.command.replace(workspaceCdStrip, "").trim() || "true";
331583
- logger82.log(`[executeRunCommand] Stripped 'cd /workspace' prefix (shell already in workspace); running: ${commandToRun}`);
331966
+ logger83.log(`[executeRunCommand] Stripped 'cd /workspace' prefix (shell already in workspace); running: ${commandToRun}`);
331584
331967
  }
331585
331968
  if (/\bgit\s+commit\b/.test(commandToRun) && !await hasConfiguredGitIdentity(workingDir)) {
331586
331969
  const withAgentIdentity = injectAgentGitIdentity(commandToRun);
331587
331970
  if (withAgentIdentity !== commandToRun) {
331588
- logger82.log(`[executeRunCommand] No git identity configured \u2014 injected agent identity into commit command`);
331971
+ logger83.log(`[executeRunCommand] No git identity configured \u2014 injected agent identity into commit command`);
331589
331972
  commandToRun = withAgentIdentity;
331590
331973
  }
331591
331974
  }
@@ -331594,7 +331977,7 @@ ${retried.stdout ?? ""}`
331594
331977
  const explicitBackground = preview.background === true;
331595
331978
  const wakeOn = preview.wake_on;
331596
331979
  const allowStalled = preview.allow_stalled === true;
331597
- logger82.log(
331980
+ logger83.log(
331598
331981
  `[executeRunCommand] Running: ${commandToRun} in ${workingDir}` + (explicitBackground ? " (background)" : ` (promote after ${PROMOTE_AFTER_MS}ms)`)
331599
331982
  );
331600
331983
  const scopeKey = resolveScopeKey(this.activeChatId, this.workspaceId);
@@ -331605,12 +331988,12 @@ ${retried.stdout ?? ""}`
331605
331988
  background: explicitBackground
331606
331989
  });
331607
331990
  if (preview.isDangerous) {
331608
- logger82.warn(`[DANGEROUS-COMMAND-AUDIT] User approved dangerous command | command="${commandToRun}" | cwd="${workingDir}" | explanation="${preview.dangerExplanation ?? "N/A"}" | timestamp=${(/* @__PURE__ */ new Date()).toISOString()}`);
331991
+ logger83.warn(`[DANGEROUS-COMMAND-AUDIT] User approved dangerous command | command="${commandToRun}" | cwd="${workingDir}" | explanation="${preview.dangerExplanation ?? "N/A"}" | timestamp=${(/* @__PURE__ */ new Date()).toISOString()}`);
331609
331992
  }
331610
331993
  const sandboxOpts = this.buildRunCommandSandbox(preview);
331611
331994
  if (preview.systemScopeInteractive === true) {
331612
331995
  const sandboxState = sandboxOpts ? "SANDBOXED (writable roots widened for the approved path)" : "UNSANDBOXED";
331613
- logger82.warn(`[SYSTEM-SCOPE-AUDIT] User approved a system-scope command | sandbox=${sandboxState} | command="${commandToRun}" | cwd="${workingDir}" | explanation="${preview.systemScopeExplanation ?? "N/A"}" | timestamp=${(/* @__PURE__ */ new Date()).toISOString()}`);
331996
+ logger83.warn(`[SYSTEM-SCOPE-AUDIT] User approved a system-scope command | sandbox=${sandboxState} | command="${commandToRun}" | cwd="${workingDir}" | explanation="${preview.systemScopeExplanation ?? "N/A"}" | timestamp=${(/* @__PURE__ */ new Date()).toISOString()}`);
331614
331997
  }
331615
331998
  this.emitTerminalOutput({
331616
331999
  operationId,
@@ -331701,7 +332084,7 @@ ${stderr}` : "");
331701
332084
  });
331702
332085
  if (retried) result2 = retried;
331703
332086
  } catch (e3) {
331704
- logger82.warn(
332087
+ logger83.warn(
331705
332088
  `[sandbox-escalation] ${e3 instanceof Error ? e3.message : String(e3)}`
331706
332089
  );
331707
332090
  }
@@ -331732,9 +332115,9 @@ ${result2.stderr}` : ""),
331732
332115
  }
331733
332116
  this.commandOutputs.set(operationId, result2);
331734
332117
  if (result2.success) {
331735
- logger82.log(`[executeRunCommand] Success: ${commandToRun} (${(duration3 / 1e3).toFixed(1)}s)`);
332118
+ logger83.log(`[executeRunCommand] Success: ${commandToRun} (${(duration3 / 1e3).toFixed(1)}s)`);
331736
332119
  } else {
331737
- logger82.error(`[executeRunCommand] Failed: ${commandToRun} (exit ${result2.exitCode})`);
332120
+ logger83.error(`[executeRunCommand] Failed: ${commandToRun} (exit ${result2.exitCode})`);
331738
332121
  const errDetail = result2.stderr ? `
331739
332122
 
331740
332123
  ${result2.stderr.slice(0, 500)}` : result2.stdout ? `
@@ -331871,14 +332254,14 @@ async function runAgentTurn(profile, rt2) {
331871
332254
  if (isForceTextFinishAbort(rt2.abortController.signal.reason)) {
331872
332255
  forceTextFinish = true;
331873
332256
  } else {
331874
- logger83.log(
332257
+ logger84.log(
331875
332258
  `${L2} Stream aborted (${String(rt2.abortController.signal.reason ?? "unknown")}) \u2014 stopping turn loop`
331876
332259
  );
331877
332260
  throw abortReasonError(rt2.abortController.signal.reason);
331878
332261
  }
331879
332262
  }
331880
332263
  if (!forceTextFinish && Date.now() - loopStartTime > STREAM_TOOL_LOOP_DURATION_CAP_MS) {
331881
- logger83.warn(`${L2} Hit duration limit (30 minutes) mode=${profile.mode}`);
332264
+ logger84.warn(`${L2} Hit duration limit (30 minutes) mode=${profile.mode}`);
331882
332265
  rt2.safeSend("chat:activity", {
331883
332266
  id: `duration-limit-${Date.now()}`,
331884
332267
  type: "duration_limit_reached",
@@ -331897,7 +332280,7 @@ async function runAgentTurn(profile, rt2) {
331897
332280
  maxIterations: 0,
331898
332281
  totalToolsExecuted: totalToolExecutions
331899
332282
  });
331900
- logger83.log(`${L2} Iteration ${agenticIteration + 1} (unbounded)`);
332283
+ logger84.log(`${L2} Iteration ${agenticIteration + 1} (unbounded)`);
331901
332284
  }
331902
332285
  const promptSpec = await profile.buildRoundSystemPrompt();
331903
332286
  const roundPrompt = typeof promptSpec === "string" ? { systemPromptOverride: promptSpec } : promptSpec;
@@ -331977,7 +332360,7 @@ async function runAgentTurn(profile, rt2) {
331977
332360
  finalFinishReason = fr2;
331978
332361
  if (resumeFromStall && resumeFromStall.length > 0) {
331979
332362
  if (stallResumeAttempts >= MAX_STALL_RESUME_ATTEMPTS) {
331980
- logger83.warn(
332363
+ logger84.warn(
331981
332364
  `${L2} Stall-resume cap (${MAX_STALL_RESUME_ATTEMPTS}) reached \u2014 ending round`
331982
332365
  );
331983
332366
  finalRoundRespMsgs = resumeFromStall;
@@ -331985,7 +332368,7 @@ async function runAgentTurn(profile, rt2) {
331985
332368
  break;
331986
332369
  }
331987
332370
  stallResumeAttempts++;
331988
- logger83.info(
332371
+ logger84.info(
331989
332372
  `${L2} Stall-resume ${stallResumeAttempts}/${MAX_STALL_RESUME_ATTEMPTS}: continuing from ${resumeFromStall.length} completed step-message(s)`
331990
332373
  );
331991
332374
  buildIterMessages = [
@@ -332040,7 +332423,7 @@ async function runAgentTurn(profile, rt2) {
332040
332423
  throw err2;
332041
332424
  }
332042
332425
  if (forceTextFinish) {
332043
- logger83.info(`${L2} Force-finish round complete \u2014 ending turn`);
332426
+ logger84.info(`${L2} Force-finish round complete \u2014 ending turn`);
332044
332427
  break;
332045
332428
  }
332046
332429
  const nativeIterMessages = [
@@ -332062,7 +332445,7 @@ async function runAgentTurn(profile, rt2) {
332062
332445
  stripThinkBlocks(iterationDeltaResponse)
332063
332446
  );
332064
332447
  if (textRep.kind === "loop_correct") {
332065
- logger83.info(
332448
+ logger84.info(
332066
332449
  `${L2} Repeated status restatement detected \u2014 injecting correction (attempt ${textRep.attempt})`
332067
332450
  );
332068
332451
  agenticMessages.push({
@@ -332079,7 +332462,7 @@ async function runAgentTurn(profile, rt2) {
332079
332462
  continue;
332080
332463
  }
332081
332464
  if (textRep.kind === "loop_abort") {
332082
- logger83.info(`${L2} Repeated status restatement persisted \u2014 forcing finish round`);
332465
+ logger84.info(`${L2} Repeated status restatement persisted \u2014 forcing finish round`);
332083
332466
  forceTextFinish = true;
332084
332467
  continue;
332085
332468
  }
@@ -332088,21 +332471,21 @@ async function runAgentTurn(profile, rt2) {
332088
332471
  const hasTextToolCalls = textToolCalls !== null;
332089
332472
  const currentOpCount = rt2.permissionInterceptor.getAllOperationsCount();
332090
332473
  const executedOpCount = rt2.permissionInterceptor.getExecutedOperationsCount();
332091
- logger83.log(
332474
+ logger84.log(
332092
332475
  `${L2} Operation counts: total=${currentOpCount}, executed=${executedOpCount}, tracked=${totalToolExecutions}`
332093
332476
  );
332094
332477
  const hadNativeToolExecution = currentOpCount > totalToolExecutions;
332095
332478
  if (hasTextToolCalls) {
332096
- logger83.log(`${L2} Detected text-based tool calls, parsing and executing...`);
332479
+ logger84.log(`${L2} Detected text-based tool calls, parsing and executing...`);
332097
332480
  } else if (hadNativeToolExecution) {
332098
332481
  const newOps = currentOpCount - totalToolExecutions;
332099
- logger83.log(
332482
+ logger84.log(
332100
332483
  `${L2} Native tool calls detected (${newOps} new operations, ${currentOpCount} total)`
332101
332484
  );
332102
332485
  totalToolExecutions = currentOpCount;
332103
332486
  }
332104
332487
  if (streamDebugLogging) {
332105
- logger83.log(`${L2} Round summary`, {
332488
+ logger84.log(`${L2} Round summary`, {
332106
332489
  iteration: agenticIteration + 1,
332107
332490
  hasTextToolCalls,
332108
332491
  hadNativeToolExecution,
@@ -332116,7 +332499,7 @@ async function runAgentTurn(profile, rt2) {
332116
332499
  }
332117
332500
  if (pendingWorkBlocksEnd()) {
332118
332501
  parked = true;
332119
- logger83.info(
332502
+ logger84.info(
332120
332503
  `${L2} Model yielded (fr=${String(finalFinishReason)}) \u2192 PARKED \u2014 ${runningSubagentCount(rt2.chatId)} sub-agent(s) / background work outstanding`
332121
332504
  );
332122
332505
  break;
@@ -332136,13 +332519,13 @@ async function runAgentTurn(profile, rt2) {
332136
332519
  gateFeedback = await profile.planCompletionGate();
332137
332520
  usePlanGate = gateFeedback != null;
332138
332521
  } catch (planErr) {
332139
- logger83.warn(`${L2} plan-completion gate failed to run: ${String(planErr)}`);
332522
+ logger84.warn(`${L2} plan-completion gate failed to run: ${String(planErr)}`);
332140
332523
  }
332141
332524
  }
332142
332525
  const gateStreak = usePlanGate ? planNudgeStreak : agenticProseOnlyStreak;
332143
332526
  const gateCap = usePlanGate ? PLAN_YIELD_MAX_NUDGES : PROSE_YIELD_MAX_NUDGES;
332144
332527
  if (gateFeedback == null || gateStreak >= gateCap || usePlanGate && planNudgeTotal >= PLAN_YIELD_TOTAL_MAX) {
332145
- logger83.info(
332528
+ logger84.info(
332146
332529
  `${L2} Model yielded (no tool calls) \u2014 ending turn at iteration ${agenticIteration + 1}`
332147
332530
  );
332148
332531
  break;
@@ -332164,7 +332547,7 @@ async function runAgentTurn(profile, rt2) {
332164
332547
  content: systemReminder(gateFeedback)
332165
332548
  });
332166
332549
  agenticIteration++;
332167
- logger83.log(
332550
+ logger84.log(
332168
332551
  `${L2} ${usePlanGate ? "Plan not complete" : "Completion gate not satisfied"} \u2014 nudge ${gateStreak + 1} of ${gateCap} allowed; continuing`
332169
332552
  );
332170
332553
  continue;
@@ -332172,7 +332555,7 @@ async function runAgentTurn(profile, rt2) {
332172
332555
  agenticProseOnlyStreak = 0;
332173
332556
  planNudgeStreak = 0;
332174
332557
  if (hasTextToolCalls && (textToolCalls?.length ?? 0) === 0) {
332175
- logger83.log(`${L2} No parseable tool calls found, ending loop`);
332558
+ logger84.log(`${L2} No parseable tool calls found, ending loop`);
332176
332559
  break;
332177
332560
  }
332178
332561
  let iterationResults = [];
@@ -332189,7 +332572,7 @@ ${r3.result}
332189
332572
  </tool_result>`).join("\n\n");
332190
332573
  if (roundHadNativeToolMessages && !hasTextToolCalls) {
332191
332574
  foldNativeIntoTurn(nativeIterMessages);
332192
- logger83.log(
332575
+ logger84.log(
332193
332576
  `${L2} Folded ${nativeIterMessages.length} native message(s) into history (no synthetic reflatten)`
332194
332577
  );
332195
332578
  } else {
@@ -332209,7 +332592,7 @@ Please continue with your task based on these results.`
332209
332592
  )
332210
332593
  });
332211
332594
  } else if (hadNativeToolExecution) {
332212
- logger83.log(
332595
+ logger84.log(
332213
332596
  `${L2} Skipping empty tool-results user message (native tools executed in-stream)`
332214
332597
  );
332215
332598
  }
@@ -332222,7 +332605,7 @@ Please continue with your task based on these results.`
332222
332605
  content: systemReminder(runtimeNotice)
332223
332606
  });
332224
332607
  runtimeNoticeSent = true;
332225
- logger83.log(`${L2} Browser runtime notice delivered (non-blocking, once per turn)`);
332608
+ logger84.log(`${L2} Browser runtime notice delivered (non-blocking, once per turn)`);
332226
332609
  }
332227
332610
  }
332228
332611
  {
@@ -332235,8 +332618,8 @@ Please continue with your task based on these results.`
332235
332618
  chatId: rt2.chatId,
332236
332619
  loopLabel: profile.compactionLabel,
332237
332620
  emitActivity: rt2.emitCompactionActivity,
332238
- onInfo: (msg) => logger83.log(msg),
332239
- onWarn: (msg, err2) => logger83.warn(msg, err2)
332621
+ onInfo: (msg) => logger84.log(msg),
332622
+ onWarn: (msg, err2) => logger84.warn(msg, err2)
332240
332623
  });
332241
332624
  if (compaction.compacted) {
332242
332625
  agenticMessages = compaction.messages;
@@ -332252,10 +332635,10 @@ Please continue with your task based on these results.`
332252
332635
  mode: profile.escalationMode
332253
332636
  });
332254
332637
  } catch (escalationErr) {
332255
- logger83.warn(`${L2} tier escalation guard failed: ${String(escalationErr)}`);
332638
+ logger84.warn(`${L2} tier escalation guard failed: ${String(escalationErr)}`);
332256
332639
  }
332257
332640
  if (hasPermissionRequest) {
332258
- logger83.log(`${L2} Had permission requests, continuing loop...`);
332641
+ logger84.log(`${L2} Had permission requests, continuing loop...`);
332259
332642
  }
332260
332643
  }
332261
332644
  trackTaskCompleted({
@@ -332276,10 +332659,10 @@ Please continue with your task based on these results.`
332276
332659
  forcedTextFinish: forceTextFinish
332277
332660
  };
332278
332661
  }
332279
- var import_electron_log84, logger83, DEFAULT_FORCE_FINISH_PROMPT;
332662
+ var import_electron_log85, logger84, DEFAULT_FORCE_FINISH_PROMPT;
332280
332663
  var init_run_agent_turn = __esm({
332281
332664
  "src/lib/agent/run-agent-turn.ts"() {
332282
- import_electron_log84 = __toESM(require_src());
332665
+ import_electron_log85 = __toESM(require_src());
332283
332666
  init_continuation_handler();
332284
332667
  init_system_reminder();
332285
332668
  init_plan_ledger_refresh();
@@ -332295,7 +332678,7 @@ var init_run_agent_turn = __esm({
332295
332678
  init_stream_stop_sentinels();
332296
332679
  init_subagent_results();
332297
332680
  init_background_commands();
332298
- logger83 = import_electron_log84.default.scope("run-agent-turn");
332681
+ logger84 = import_electron_log85.default.scope("run-agent-turn");
332299
332682
  DEFAULT_FORCE_FINISH_PROMPT = "You have been repeating actions without converging, so tools are now disabled for this turn. Do NOT attempt any further tool calls. In plain prose, briefly summarize what you accomplished, what is still incomplete, and the concrete next step \u2014 then stop.";
332300
332683
  }
332301
332684
  });
@@ -332334,7 +332717,7 @@ async function runAskBranch(ctx, deps) {
332334
332717
  processResponseChunkUpdate: processResponseChunkUpdate2,
332335
332718
  applyTierEscalation
332336
332719
  } = deps;
332337
- logger84.log(
332720
+ logger85.log(
332338
332721
  `Ask tier with workspace \u2014 read-only${effectiveWorkMode === "plan" ? " + Plan tools" : ""} (approval where required)`
332339
332722
  );
332340
332723
  const askPermissionInterceptor = new PermissionInterceptor(
@@ -332549,7 +332932,7 @@ async function runAskBranch(ctx, deps) {
332549
332932
  );
332550
332933
  if (outcome.success && outcome.tokensAfter > 0) {
332551
332934
  if (process.env.ATLARIX_DIAG_146 === "1") {
332552
- logger84.info(
332935
+ logger85.info(
332553
332936
  `[DIAG_146] compress(ask) chat=${req.chatId} ${outcome.tokensBefore}\u2192${outcome.tokensAfter} persisted=${outcome.summaryPersisted} \u2192 emit context-report dispatchedTokens=${outcome.tokensAfter}`
332554
332937
  );
332555
332938
  }
@@ -332718,13 +333101,13 @@ ${marker28}
332718
333101
  operationId,
332719
333102
  request: enrichPermissionRequestForUi(permRequest, effectiveAppId, appPath)
332720
333103
  });
332721
- logger84.log(`[Ask Mode] Permission request buffered: ${operationId}`);
333104
+ logger85.log(`[Ask Mode] Permission request buffered: ${operationId}`);
332722
333105
  } else if (askPermissionInterceptor.shouldAlwaysAutoApprove(permRequest)) {
332723
- logger84.log(
333106
+ logger85.log(
332724
333107
  `[Ask Mode] Auto-approved .atlarix internal write: ${operationId}`
332725
333108
  );
332726
333109
  } else {
332727
- logger84.log(`[Ask Mode] Auto-exec: ${operationId}`);
333110
+ logger85.log(`[Ask Mode] Auto-exec: ${operationId}`);
332728
333111
  }
332729
333112
  try {
332730
333113
  let approved;
@@ -332734,7 +333117,7 @@ ${marker28}
332734
333117
  if (!approved) {
332735
333118
  const execResultRejected = askPermissionInterceptor.getExecutionResult(operationId);
332736
333119
  if (execResultRejected.exitCode !== void 0) {
332737
- logger84.log(
333120
+ logger85.log(
332738
333121
  `[Ask Mode] Auto-approved op failed: ${operationId} (exit ${execResultRejected.exitCode})`
332739
333122
  );
332740
333123
  return JSON.stringify({
@@ -332761,7 +333144,7 @@ ${marker28}
332761
333144
  }
332762
333145
  if (approved) {
332763
333146
  const execResult = askPermissionInterceptor.getExecutionResult(operationId);
332764
- logger84.log(`[Ask Mode] Permission approved: ${operationId}`);
333147
+ logger85.log(`[Ask Mode] Permission approved: ${operationId}`);
332765
333148
  const preview = permRequest.preview;
332766
333149
  if (preview.path) {
332767
333150
  ctx.filesWrittenInThisExchange.push(preview.path);
@@ -332771,7 +333154,7 @@ ${marker28}
332771
333154
  output
332772
333155
  );
332773
333156
  if (hasCompilationErrors) {
332774
- logger84.log(`[Ask Mode] Command output contains errors: ${operationId}`);
333157
+ logger85.log(`[Ask Mode] Command output contains errors: ${operationId}`);
332775
333158
  return JSON.stringify({
332776
333159
  success: true,
332777
333160
  hasErrors: true,
@@ -332797,7 +333180,7 @@ ${marker28}
332797
333180
  } else {
332798
333181
  const execResultRejected = askPermissionInterceptor.getExecutionResult(operationId);
332799
333182
  if (execResultRejected.exitCode !== void 0) {
332800
- logger84.log(
333183
+ logger85.log(
332801
333184
  `[Ask Mode] Command failed: ${operationId} (exit ${execResultRejected.exitCode})`
332802
333185
  );
332803
333186
  return JSON.stringify({
@@ -332809,7 +333192,7 @@ ${marker28}
332809
333192
  path: permRequest.preview.path || permRequest.preview.command
332810
333193
  });
332811
333194
  } else {
332812
- logger84.log(`[Ask Mode] Permission denied: ${operationId}`);
333195
+ logger85.log(`[Ask Mode] Permission denied: ${operationId}`);
332813
333196
  return JSON.stringify({
332814
333197
  success: false,
332815
333198
  error: "Permission denied by user",
@@ -332819,7 +333202,7 @@ ${marker28}
332819
333202
  }
332820
333203
  }
332821
333204
  } catch (error51) {
332822
- logger84.error(`[Ask Mode] Permission error: ${operationId}`, error51);
333205
+ logger85.error(`[Ask Mode] Permission error: ${operationId}`, error51);
332823
333206
  return JSON.stringify({
332824
333207
  success: false,
332825
333208
  error: `Permission request failed: ${error51 instanceof Error ? error51.message : String(error51)}`,
@@ -332892,13 +333275,13 @@ ${marker28}
332892
333275
  }
332893
333276
  });
332894
333277
  }
332895
- logger84.log(
333278
+ logger85.log(
332896
333279
  `Ask tier: ${Object.keys(askTools).length} tools (read-only${effectiveWorkMode === "plan" ? " + Plan tools" : ""}; MCP via list_available_mcps + mcp_call)`
332897
333280
  );
332898
333281
  {
332899
333282
  const trimmed = peripheralToolNames(askToolsToInclude, effectiveWorkMode);
332900
333283
  const { full, bound } = revealSavings(askToolsToInclude, effectiveWorkMode);
332901
- logger84.log(
333284
+ logger85.log(
332902
333285
  `[tool-reveal] mode=${effectiveWorkMode} core=${askToolsToInclude.length - trimmed.length} peripheral=${trimmed.length} desc ${full}\u2192${bound} chars (\u2212${full - bound}); pointer=tool_help` + (trimmed.length > 0 ? ` [${trimmed.join(", ")}]` : "")
332903
333286
  );
332904
333287
  }
@@ -332989,10 +333372,10 @@ ${askParts.stableHeader}` : askParts.stableHeader;
332989
333372
  }
332990
333373
  askAgenticRepetition.setEnabled(false);
332991
333374
  }
332992
- var import_electron_log85, logger84;
333375
+ var import_electron_log86, logger85;
332993
333376
  var init_ask_branch = __esm({
332994
333377
  "src/ipc/handlers/chat_stream/turn-runner/ask-branch.ts"() {
332995
- import_electron_log85 = __toESM(require_src());
333378
+ import_electron_log86 = __toESM(require_src());
332996
333379
  init_agent_runtime();
332997
333380
  init_system_scope_commands();
332998
333381
  init_register_delegation_tools();
@@ -333028,7 +333411,7 @@ var init_ask_branch = __esm({
333028
333411
  init_resolve_toolset();
333029
333412
  init_tool_reveal();
333030
333413
  init_edit_stats2();
333031
- logger84 = import_electron_log85.default.scope("chat_stream_handlers");
333414
+ logger85 = import_electron_log86.default.scope("chat_stream_handlers");
333032
333415
  }
333033
333416
  });
333034
333417
 
@@ -333126,7 +333509,7 @@ function parseMiniMaxFormat(text3) {
333126
333509
  args: args2,
333127
333510
  rawMatch: match[0]
333128
333511
  });
333129
- logger85.log(`[MiniMax] Parsed tool call: ${toolName}`, args2);
333512
+ logger86.log(`[MiniMax] Parsed tool call: ${toolName}`, args2);
333130
333513
  }
333131
333514
  return results;
333132
333515
  }
@@ -333183,7 +333566,7 @@ function parseLegacyAngleFunctionFormat(text3) {
333183
333566
  args: args2,
333184
333567
  rawMatch: match[0]
333185
333568
  });
333186
- logger85.log(`[Legacy function=] Parsed tool call: ${toolName}`, args2);
333569
+ logger86.log(`[Legacy function=] Parsed tool call: ${toolName}`, args2);
333187
333570
  }
333188
333571
  return results;
333189
333572
  }
@@ -333266,11 +333649,11 @@ function parseTextToolCalls(text3) {
333266
333649
  function stripToolCallXML(text3) {
333267
333650
  return text3.replace(/<minimax:tool_call>[\s\S]*?<\/minimax:tool_call>/gi, "").replace(/<tool_call\s*>\s*<function\s*=\s*[a-zA-Z0-9_]+\s*>[\s\S]*?<\/function\s*>\s*<\/tool_call\s*>/gi, "").replace(/<tool_call\s+name="[^"]+">[\s\S]*?<\/tool_call>/gi, "").replace(/<function_call\s+name="[^"]+">[\s\S]*?<\/function_call>/gi, "").replace(/<invoke\s+name="[^"]+"[^>]*>[\s\S]*?<\/invoke>/gi, "").trim();
333268
333651
  }
333269
- var import_electron_log86, logger85;
333652
+ var import_electron_log87, logger86;
333270
333653
  var init_text_tool_parser = __esm({
333271
333654
  "src/ipc/utils/text_tool_parser.ts"() {
333272
- import_electron_log86 = __toESM(require_src());
333273
- logger85 = import_electron_log86.default.scope("text-tool-parser");
333655
+ import_electron_log87 = __toESM(require_src());
333656
+ logger86 = import_electron_log87.default.scope("text-tool-parser");
333274
333657
  }
333275
333658
  });
333276
333659
 
@@ -333308,7 +333691,7 @@ async function runBuildBranch(ctx, deps) {
333308
333691
  buildToolStreamOpts,
333309
333692
  streamDebugLogging
333310
333693
  } = deps;
333311
- logger86.log("Build mode with native tool calling + permission system");
333694
+ logger87.log("Build mode with native tool calling + permission system");
333312
333695
  const workspacePath = appPath;
333313
333696
  let workspaceOverride = null;
333314
333697
  const buildResolved = resolveToolsetForSession({
@@ -333365,7 +333748,7 @@ async function runBuildBranch(ctx, deps) {
333365
333748
  isPermissionBased: true
333366
333749
  // Don't force-switch to terminal tab
333367
333750
  });
333368
- logger86.log(`[Build Mode] Terminal output sent: ${payload.command} (${payload.status})`);
333751
+ logger87.log(`[Build Mode] Terminal output sent: ${payload.command} (${payload.status})`);
333369
333752
  });
333370
333753
  const recentCompletedBuildToolNames = [];
333371
333754
  const agenticRepetition = createAgenticRepetitionState();
@@ -333428,7 +333811,7 @@ async function runBuildBranch(ctx, deps) {
333428
333811
  execute: async (args2, { toolCallId }) => {
333429
333812
  const buildToolStartMs = Date.now();
333430
333813
  if (streamDebugLogging) {
333431
- logger86.log(`[Build Tool] start`, {
333814
+ logger87.log(`[Build Tool] start`, {
333432
333815
  toolName,
333433
333816
  chatId: req.chatId,
333434
333817
  argsKeys: args2 && typeof args2 === "object" ? Object.keys(args2) : []
@@ -333540,7 +333923,7 @@ async function runBuildBranch(ctx, deps) {
333540
333923
  );
333541
333924
  if (outcome.success && outcome.tokensAfter > 0) {
333542
333925
  if (process.env.ATLARIX_DIAG_146 === "1") {
333543
- logger86.info(
333926
+ logger87.info(
333544
333927
  `[DIAG_146] compress(build) chat=${req.chatId} ${outcome.tokensBefore}\u2192${outcome.tokensAfter} persisted=${outcome.summaryPersisted} \u2192 emit context-report dispatchedTokens=${outcome.tokensAfter}`
333545
333928
  );
333546
333929
  }
@@ -333625,7 +334008,7 @@ async function runBuildBranch(ctx, deps) {
333625
334008
  const r3 = result2;
333626
334009
  workspaceOverride = { path: r3.workspace_path, id: r3.workspace_id };
333627
334010
  permissionInterceptor.setWorkspace(r3.workspace_path, r3.workspace_id);
333628
- logger86.log(
334011
+ logger87.log(
333629
334012
  `[Build Mode] Switched to new workspace for this turn: ${r3.workspace_path} (id: ${r3.workspace_id})`
333630
334013
  );
333631
334014
  }
@@ -333738,19 +334121,12 @@ async function runBuildBranch(ctx, deps) {
333738
334121
  String(execResult.command ?? ""),
333739
334122
  permRequest.preview?.workingDirectory
333740
334123
  )
333741
- } : permRequest.operation === "automation_write" ? {
333742
- // The id only exists after approval. The tool
333743
- // description tells the model to run the
333744
- // automation it just created, and name is not a
333745
- // key — two automations may share one — so
333746
- // without this it could only guess via `list`.
333747
- ...execResult.automationId ? { automation_id: execResult.automationId } : {}
333748
- } : {};
334124
+ } : permRequest.operation === "automation_write" ? execResult.automationId ? { automation_id: execResult.automationId } : {} : {};
333749
334125
  const hasCompilationErrors = /error:|Error:|ERROR:|failed to|Failed to|Cannot find|cannot find|is not defined|is not a function|SyntaxError|TypeError|ReferenceError/i.test(
333750
334126
  output
333751
334127
  );
333752
334128
  if (hasCompilationErrors) {
333753
- logger86.log(`[Build Mode] Command output contains errors: ${operationId}`);
334129
+ logger87.log(`[Build Mode] Command output contains errors: ${operationId}`);
333754
334130
  return JSON.stringify({
333755
334131
  success: true,
333756
334132
  hasErrors: true,
@@ -333774,7 +334150,7 @@ async function runBuildBranch(ctx, deps) {
333774
334150
  };
333775
334151
  if (skipPermissionWait) {
333776
334152
  try {
333777
- logger86.log(`[Build Mode] Autonomous auto-exec: ${operationId}`);
334153
+ logger87.log(`[Build Mode] Autonomous auto-exec: ${operationId}`);
333778
334154
  const execMeta = await permissionInterceptor.executeOperation(operationId);
333779
334155
  const execResult = permissionInterceptor.getExecutionResult(operationId);
333780
334156
  appendAutonomousOp(
@@ -333788,7 +334164,7 @@ async function runBuildBranch(ctx, deps) {
333788
334164
  )
333789
334165
  );
333790
334166
  if (execMeta.approved) {
333791
- logger86.log(`[Build Mode] Autonomous permission executed: ${operationId}`);
334167
+ logger87.log(`[Build Mode] Autonomous permission executed: ${operationId}`);
333792
334168
  emitAutoApprovedWritePreview(
333793
334169
  event.sender,
333794
334170
  req.chatId,
@@ -333798,7 +334174,7 @@ async function runBuildBranch(ctx, deps) {
333798
334174
  return recordActivityResult(jsonAfterSuccessfulExec(execResult));
333799
334175
  }
333800
334176
  if (execResult.exitCode !== void 0) {
333801
- logger86.log(
334177
+ logger87.log(
333802
334178
  `[Build Mode] Autonomous exec command failed: ${operationId} (exit ${execResult.exitCode})`
333803
334179
  );
333804
334180
  activityStatus = "error";
@@ -333819,7 +334195,7 @@ async function runBuildBranch(ctx, deps) {
333819
334195
  path: permRequest.preview.path
333820
334196
  }));
333821
334197
  } catch (error51) {
333822
- logger86.error(`[Build Mode] Autonomous permission error: ${operationId}`, error51);
334198
+ logger87.error(`[Build Mode] Autonomous permission error: ${operationId}`, error51);
333823
334199
  activityStatus = "error";
333824
334200
  return recordActivityResult(JSON.stringify({
333825
334201
  success: false,
@@ -333832,7 +334208,7 @@ async function runBuildBranch(ctx, deps) {
333832
334208
  const __enriched = enrichPermissionRequestForUi(permRequest, effectiveAppId, workspacePath);
333833
334209
  if (process.env.ATLARIX_DIAG_146 === "1") {
333834
334210
  const prev = permRequest.preview;
333835
- logger86.info(
334211
+ logger87.info(
333836
334212
  `[DIAG_146] perm-edit op=${permRequest.operation} target=${prev.path ?? prev.command ?? ""} preflight+buffer=${__enrichT0 - __permEditT0}ms enrich/diff=${Date.now() - __enrichT0}ms (then awaits the user)`
333837
334213
  );
333838
334214
  }
@@ -333841,10 +334217,10 @@ async function runBuildBranch(ctx, deps) {
333841
334217
  operationId,
333842
334218
  request: __enriched
333843
334219
  });
333844
- logger86.log(`[Build Mode] Permission request buffered: ${operationId}`);
334220
+ logger87.log(`[Build Mode] Permission request buffered: ${operationId}`);
333845
334221
  try {
333846
334222
  if (streamDebugLogging) {
333847
- logger86.log(`[Build Tool] waitForApproval start`, {
334223
+ logger87.log(`[Build Tool] waitForApproval start`, {
333848
334224
  operationId,
333849
334225
  operation: permRequest.operation,
333850
334226
  chatId: req.chatId
@@ -333856,7 +334232,7 @@ async function runBuildBranch(ctx, deps) {
333856
334232
  );
333857
334233
  const approved = outcome === "approved";
333858
334234
  if (streamDebugLogging) {
333859
- logger86.log(`[Build Tool] waitForApproval end`, {
334235
+ logger87.log(`[Build Tool] waitForApproval end`, {
333860
334236
  operationId,
333861
334237
  approved,
333862
334238
  chatId: req.chatId
@@ -333864,12 +334240,12 @@ async function runBuildBranch(ctx, deps) {
333864
334240
  }
333865
334241
  if (approved) {
333866
334242
  const execResult = permissionInterceptor.getExecutionResult(operationId);
333867
- logger86.log(`[Build Mode] Permission approved: ${operationId}`);
334243
+ logger87.log(`[Build Mode] Permission approved: ${operationId}`);
333868
334244
  return recordActivityResult(jsonAfterSuccessfulExec(execResult));
333869
334245
  } else {
333870
334246
  const execResult = permissionInterceptor.getExecutionResult(operationId);
333871
334247
  if (execResult.exitCode !== void 0) {
333872
- logger86.log(`[Build Mode] Command failed: ${operationId} (exit ${execResult.exitCode})`);
334248
+ logger87.log(`[Build Mode] Command failed: ${operationId} (exit ${execResult.exitCode})`);
333873
334249
  activityStatus = "error";
333874
334250
  return recordActivityResult(JSON.stringify({
333875
334251
  success: false,
@@ -333881,7 +334257,7 @@ async function runBuildBranch(ctx, deps) {
333881
334257
  path: permRequest.preview.path || permRequest.preview.command
333882
334258
  }));
333883
334259
  } else {
333884
- logger86.log(`[Build Mode] Permission denied: ${operationId}`);
334260
+ logger87.log(`[Build Mode] Permission denied: ${operationId}`);
333885
334261
  activityStatus = "error";
333886
334262
  return recordActivityResult(JSON.stringify({
333887
334263
  success: false,
@@ -333893,7 +334269,7 @@ async function runBuildBranch(ctx, deps) {
333893
334269
  }
333894
334270
  } catch (error51) {
333895
334271
  if (abortController.signal.aborted) throw error51;
333896
- logger86.error(`[Build Mode] Permission error: ${operationId}`, error51);
334272
+ logger87.error(`[Build Mode] Permission error: ${operationId}`, error51);
333897
334273
  activityStatus = "error";
333898
334274
  return recordActivityResult(JSON.stringify({
333899
334275
  success: false,
@@ -333928,7 +334304,7 @@ async function runBuildBranch(ctx, deps) {
333928
334304
  );
333929
334305
  const resultText = toolResultTextForExpand(toolResultForActivity);
333930
334306
  if (streamDebugLogging) {
333931
- logger86.log(`[Build Tool] end`, {
334307
+ logger87.log(`[Build Tool] end`, {
333932
334308
  toolName,
333933
334309
  chatId: req.chatId,
333934
334310
  ms: Date.now() - buildToolStartMs,
@@ -333981,11 +334357,11 @@ async function runBuildBranch(ctx, deps) {
333981
334357
  }
333982
334358
  });
333983
334359
  }
333984
- logger86.log(`Build mode: ${Object.keys(tools).length} tools available`);
334360
+ logger87.log(`Build mode: ${Object.keys(tools).length} tools available`);
333985
334361
  {
333986
334362
  const trimmed = peripheralToolNames(buildToolsToInclude, effectiveWorkMode);
333987
334363
  const { full, bound } = revealSavings(buildToolsToInclude, effectiveWorkMode);
333988
- logger86.log(
334364
+ logger87.log(
333989
334365
  `[tool-reveal] mode=${effectiveWorkMode} core=${buildToolsToInclude.length - trimmed.length} peripheral=${trimmed.length} desc ${full}\u2192${bound} chars (\u2212${full - bound}); pointer=tool_help` + (trimmed.length > 0 ? ` [${trimmed.join(", ")}]` : "")
333990
334366
  );
333991
334367
  }
@@ -334098,7 +334474,7 @@ async function runBuildBranch(ctx, deps) {
334098
334474
  })
334099
334475
  ) : null;
334100
334476
  if (allReadOnly) {
334101
- logger86.log(`[Agentic Loop] Executed ${textToolCalls.length} read-only tools in parallel`);
334477
+ logger87.log(`[Agentic Loop] Executed ${textToolCalls.length} read-only tools in parallel`);
334102
334478
  }
334103
334479
  for (let i4 = 0; i4 < textToolCalls.length; i4++) {
334104
334480
  const toolCall = textToolCalls[i4];
@@ -334318,7 +334694,7 @@ async function runBuildBranch(ctx, deps) {
334318
334694
  operationId,
334319
334695
  request: enrichPermissionRequestForUi(permRequest, effectiveAppId, workspacePath)
334320
334696
  });
334321
- logger86.log(`[Agentic Loop] Permission request buffered: ${operationId}`);
334697
+ logger87.log(`[Agentic Loop] Permission request buffered: ${operationId}`);
334322
334698
  hasPermissionRequest = true;
334323
334699
  try {
334324
334700
  const outcome = await permissionInterceptor.waitForApproval(
@@ -334375,10 +334751,10 @@ async function runBuildBranch(ctx, deps) {
334375
334751
  } else {
334376
334752
  const resultStr = typeof toolResult === "string" ? toolResult : JSON.stringify(toolResult);
334377
334753
  iterationResults.push({ tool: toolCall.toolName, result: resultStr });
334378
- logger86.log(`[Agentic Loop] Tool executed: ${toolCall.toolName} \u2713`);
334754
+ logger87.log(`[Agentic Loop] Tool executed: ${toolCall.toolName} \u2713`);
334379
334755
  }
334380
334756
  } catch (toolError) {
334381
- logger86.error(`[Agentic Loop] Tool error: ${toolCall.toolName}`, toolError);
334757
+ logger87.error(`[Agentic Loop] Tool error: ${toolCall.toolName}`, toolError);
334382
334758
  iterationResults.push({
334383
334759
  tool: toolCall.toolName,
334384
334760
  result: `Error: ${toolError instanceof Error ? toolError.message : String(toolError)}`
@@ -334460,7 +334836,7 @@ async function runBuildBranch(ctx, deps) {
334460
334836
  ctx.turnForcedTextFinish = turnResult.forcedTextFinish;
334461
334837
  }
334462
334838
  ctx.fullResponse = stripToolCallXML2(ctx.fullResponse);
334463
- logger86.info(`[Agentic Loop] Completed:`, {
334839
+ logger87.info(`[Agentic Loop] Completed:`, {
334464
334840
  chatId: req.chatId,
334465
334841
  iterations: agenticIteration,
334466
334842
  toolsExecuted: totalToolExecutions,
@@ -334495,10 +334871,10 @@ ${stopNote}`;
334495
334871
  { force: true }
334496
334872
  );
334497
334873
  }
334498
- logger86.log(`Persisted partial response to ephemeral chat ${chatId} after abort`);
334874
+ logger87.log(`Persisted partial response to ephemeral chat ${chatId} after abort`);
334499
334875
  partialResponses.delete(req.chatId);
334500
334876
  } catch (error51) {
334501
- logger86.error(
334877
+ logger87.error(
334502
334878
  `Error saving partial response for chat ${chatId}:`,
334503
334879
  error51
334504
334880
  );
@@ -334507,7 +334883,7 @@ ${stopNote}`;
334507
334883
  return { earlyReturn: true, value: req.chatId };
334508
334884
  }
334509
334885
  if (abortController.signal.aborted && ledgerCompleteStop) {
334510
- logger86.log(
334886
+ logger87.log(
334511
334887
  `[Agentic Loop] Stream stopped after task ledger complete (chat ${req.chatId})`
334512
334888
  );
334513
334889
  captureStreamAbortLedgerCompleteIfNeeded();
@@ -334518,7 +334894,7 @@ ${stopNote}`;
334518
334894
  agenticRepetition.setEnabled(false);
334519
334895
  }
334520
334896
  }
334521
- var import_electron_log87, logger86;
334897
+ var import_electron_log88, logger87;
334522
334898
  var init_build_branch = __esm({
334523
334899
  "src/ipc/handlers/chat_stream/turn-runner/build-branch.ts"() {
334524
334900
  init_file_read_log();
@@ -334564,9 +334940,9 @@ var init_build_branch = __esm({
334564
334940
  init_resolve_toolset();
334565
334941
  init_tool_reveal();
334566
334942
  init_dist21();
334567
- import_electron_log87 = __toESM(require_src());
334943
+ import_electron_log88 = __toESM(require_src());
334568
334944
  init_edit_stats2();
334569
- logger86 = import_electron_log87.default.scope("chat_stream_handlers");
334945
+ logger87 = import_electron_log88.default.scope("chat_stream_handlers");
334570
334946
  }
334571
334947
  });
334572
334948
 
@@ -334574,14 +334950,14 @@ var init_build_branch = __esm({
334574
334950
  function trackPendingWork(promise3, label) {
334575
334951
  pending.add(promise3);
334576
334952
  promise3.catch(
334577
- (e3) => logger87.warn(`[${label}] background work failed: ${String(e3)}`)
334953
+ (e3) => logger88.warn(`[${label}] background work failed: ${String(e3)}`)
334578
334954
  ).finally(() => pending.delete(promise3));
334579
334955
  }
334580
- var import_electron_log88, logger87, pending;
334956
+ var import_electron_log89, logger88, pending;
334581
334957
  var init_pending_work = __esm({
334582
334958
  "src/lib/pending-work.ts"() {
334583
- import_electron_log88 = __toESM(require_src());
334584
- logger87 = import_electron_log88.default.scope("pending-work");
334959
+ import_electron_log89 = __toESM(require_src());
334960
+ logger88 = import_electron_log89.default.scope("pending-work");
334585
334961
  pending = /* @__PURE__ */ new Set();
334586
334962
  }
334587
334963
  });
@@ -334686,12 +335062,12 @@ async function finalizeTurn(ctx, deps) {
334686
335062
  nativeForPersist = boundNativeHistoryForPersist(nativeForPersist, {
334687
335063
  budgetTokens: envelopeBudget
334688
335064
  });
334689
- logger88.info(
335065
+ logger89.info(
334690
335066
  `[stream:${req.chatId}] turn envelope bounded for persist: ~${before2} \u2192 ~${estimateModelMessagesTokens(nativeForPersist)} est. tokens (budget ${envelopeBudget})`
334691
335067
  );
334692
335068
  }
334693
335069
  } catch (e3) {
334694
- logger88.warn(`[stream:${req.chatId}] envelope bounding skipped`, e3);
335070
+ logger89.warn(`[stream:${req.chatId}] envelope bounding skipped`, e3);
334695
335071
  nativeForPersist = ctx.nativeTurnMessages;
334696
335072
  }
334697
335073
  }
@@ -334786,11 +335162,11 @@ async function finalizeTurn(ctx, deps) {
334786
335162
  planStatus: updated.planStatus,
334787
335163
  title: updated.title
334788
335164
  });
334789
- logger88.info(`[plan-artifact] safety net marked plan ${buildingPlan.id} built`);
335165
+ logger89.info(`[plan-artifact] safety net marked plan ${buildingPlan.id} built`);
334790
335166
  }
334791
335167
  }
334792
335168
  } catch (planEndErr) {
334793
- logger88.warn("[plan-artifact] build-complete status update failed:", planEndErr);
335169
+ logger89.warn("[plan-artifact] build-complete status update failed:", planEndErr);
334794
335170
  }
334795
335171
  }
334796
335172
  if (isBuildModeTurn && !abortController.signal.aborted) {
@@ -334815,7 +335191,7 @@ async function finalizeTurn(ctx, deps) {
334815
335191
  const auxBySource = summarizeAuxBySource(auxUsage);
334816
335192
  if (auxUsage) {
334817
335193
  const est = auxUsage.totalEstimatedTokens;
334818
- logger88.log(
335194
+ logger89.log(
334819
335195
  `[usage] auxiliary LLM tokens this turn: ${auxUsage.totalTokens}` + (est > 0 ? ` (+~${est} estimated)` : "") + ` across ${auxUsage.calls} call(s) \u2014 ${Object.entries(auxUsage.byLabel).map(
334820
335196
  ([k2, v2]) => `${k2}=${v2.tokens}${v2.estimatedTokens > 0 ? `+~${v2.estimatedTokens}est` : ""}(${v2.calls} call${v2.calls === 1 ? "" : "s"})`
334821
335197
  ).join(", ")}`
@@ -334894,7 +335270,7 @@ async function finalizeTurn(ctx, deps) {
334894
335270
  async function handleTurnError(error51, ctx, deps) {
334895
335271
  const { overflowRetried, req, event, abortController, streamId } = deps;
334896
335272
  if (abortController.signal.aborted && abortReasonSentinel(abortController.signal.reason) === ASK_USER_STREAM_STOP) {
334897
- logger88.log(
335273
+ logger89.log(
334898
335274
  `[ask_user] Stream ended at question (benign: ${error51 instanceof Error ? error51.name : String(error51)})`
334899
335275
  );
334900
335276
  try {
@@ -334902,7 +335278,8 @@ async function handleTurnError(error51, ctx, deps) {
334902
335278
  const chat = getStreamTransport2(req.chatId);
334903
335279
  const pendingArtifact = pendingAskUserArtifactByChatId.get(req.chatId);
334904
335280
  if (chat) {
334905
- const last2 = chat.messages[chat.messages.length - 1];
335281
+ const pid = Number(streamTurnIdByChatId.get(req.chatId));
335282
+ const last2 = (Number.isFinite(pid) ? chat.messages.find((m3) => m3.id === pid) : void 0) ?? chat.messages[chat.messages.length - 1];
334906
335283
  if (last2?.role === "assistant") {
334907
335284
  let content = stripThinkBlocks(
334908
335285
  partialResponses.get(req.chatId) ?? last2.content ?? ""
@@ -334920,7 +335297,7 @@ async function handleTurnError(error51, ctx, deps) {
334920
335297
  });
334921
335298
  }
334922
335299
  } catch (finalizeErr) {
334923
- logger88.warn("[ask_user] Question-turn finalize failed:", finalizeErr);
335300
+ logger89.warn("[ask_user] Question-turn finalize failed:", finalizeErr);
334924
335301
  }
334925
335302
  partialResponses.delete(req.chatId);
334926
335303
  safeSend(event.sender, "chat:response:end", {
@@ -334934,7 +335311,7 @@ async function handleTurnError(error51, ctx, deps) {
334934
335311
  FileUploadsState.getInstance().clear(req.chatId);
334935
335312
  return;
334936
335313
  }
334937
- logger88.error("Error calling LLM:", error51);
335314
+ logger89.error("Error calling LLM:", error51);
334938
335315
  if (error51 instanceof NetworkStreamDisconnectedError) {
334939
335316
  safeSend(event.sender, "chat:stream:disconnected", {
334940
335317
  chatId: req.chatId,
@@ -335040,7 +335417,7 @@ async function handleTurnError(error51, ctx, deps) {
335040
335417
  readSettings().selectedModel?.provider
335041
335418
  ).catch(() => false);
335042
335419
  if (compacted) {
335043
- logger88.warn(
335420
+ logger89.warn(
335044
335421
  `[stream:${req.chatId}] Context overflow \u2014 compacted and retrying dispatch once`
335045
335422
  );
335046
335423
  safeSend(event.sender, "chat:activity", {
@@ -335090,7 +335467,7 @@ async function handleTurnError(error51, ctx, deps) {
335090
335467
  ctx.streamTerminated = true;
335091
335468
  FileUploadsState.getInstance().clear(req.chatId);
335092
335469
  }
335093
- var import_electron_log89, MAX_ENVELOPE_WINDOW_FRACTION, MIN_ENVELOPE_BUDGET_TOKENS, logger88;
335470
+ var import_electron_log90, MAX_ENVELOPE_WINDOW_FRACTION, MIN_ENVELOPE_BUDGET_TOKENS, logger89;
335094
335471
  var init_finalize = __esm({
335095
335472
  "src/ipc/handlers/chat_stream/turn-runner/finalize.ts"() {
335096
335473
  init_autonomous_session_state();
@@ -335118,10 +335495,10 @@ var init_finalize = __esm({
335118
335495
  init_turn_usage_aggregator();
335119
335496
  init_settings();
335120
335497
  init_texts();
335121
- import_electron_log89 = __toESM(require_src());
335498
+ import_electron_log90 = __toESM(require_src());
335122
335499
  MAX_ENVELOPE_WINDOW_FRACTION = 0.5;
335123
335500
  MIN_ENVELOPE_BUDGET_TOKENS = 8e3;
335124
- logger88 = import_electron_log89.default.scope("chat_stream_handlers");
335501
+ logger89 = import_electron_log90.default.scope("chat_stream_handlers");
335125
335502
  }
335126
335503
  });
335127
335504
 
@@ -335246,7 +335623,7 @@ async function loadPrioritySkillsForWorkspace(workspacePath, isWorkforce) {
335246
335623
  };
335247
335624
  skills.push(skill);
335248
335625
  } catch (err2) {
335249
- logger89.warn(`[priority-skills] Failed to parse ${entry.name}:`, err2);
335626
+ logger90.warn(`[priority-skills] Failed to parse ${entry.name}:`, err2);
335250
335627
  }
335251
335628
  }
335252
335629
  return skills.sort((a2, b3) => {
@@ -335261,11 +335638,11 @@ function filterSkillsForMode(skills, currentMode) {
335261
335638
  (s3) => s3.modes.includes("*") || s3.modes.some((m3) => normalizeMode(m3) === wanted)
335262
335639
  );
335263
335640
  }
335264
- var import_electron_log90, logger89, SKILLS_DIR_REL, ALL_MODES;
335641
+ var import_electron_log91, logger90, SKILLS_DIR_REL, ALL_MODES;
335265
335642
  var init_priority_skill_loader = __esm({
335266
335643
  "src/lib/skills/priority-skill-loader.ts"() {
335267
- import_electron_log90 = __toESM(require_src());
335268
- logger89 = import_electron_log90.default.scope("priority-skill-loader");
335644
+ import_electron_log91 = __toESM(require_src());
335645
+ logger90 = import_electron_log91.default.scope("priority-skill-loader");
335269
335646
  SKILLS_DIR_REL = ".atlarix/skills";
335270
335647
  ALL_MODES = ["ask", "build", "plan", "debug", "review"];
335271
335648
  }
@@ -335345,18 +335722,18 @@ async function buildSkillIndex(workspacePath, currentMode) {
335345
335722
  });
335346
335723
  }
335347
335724
  } catch (err2) {
335348
- logger90.warn("[skill-index] repo skills failed:", err2);
335725
+ logger91.warn("[skill-index] repo skills failed:", err2);
335349
335726
  }
335350
335727
  try {
335351
335728
  entries2.push(...await loadInstalledSkillEntries(ws2));
335352
335729
  } catch (err2) {
335353
- logger90.warn("[skill-index] installed skills failed:", err2);
335730
+ logger91.warn("[skill-index] installed skills failed:", err2);
335354
335731
  }
335355
335732
  }
335356
335733
  try {
335357
335734
  entries2.push(...await loadGuideEntries());
335358
335735
  } catch (err2) {
335359
- logger90.warn("[skill-index] bundled guides failed:", err2);
335736
+ logger91.warn("[skill-index] bundled guides failed:", err2);
335360
335737
  }
335361
335738
  return entries2;
335362
335739
  }
@@ -335385,10 +335762,10 @@ function formatSkillIndexForPrompt(entries2) {
335385
335762
  }
335386
335763
  return lines.join("\n");
335387
335764
  }
335388
- var import_electron_log91, logger90, BUNDLED_GUIDES;
335765
+ var import_electron_log92, logger91, BUNDLED_GUIDES;
335389
335766
  var init_skill_index = __esm({
335390
335767
  "src/lib/skills/skill-index.ts"() {
335391
- import_electron_log91 = __toESM(require_src());
335768
+ import_electron_log92 = __toESM(require_src());
335392
335769
  init_first_sentence();
335393
335770
  init_db2();
335394
335771
  init_schema();
@@ -335396,7 +335773,7 @@ var init_skill_index = __esm({
335396
335773
  init_paths();
335397
335774
  init_skill_loader();
335398
335775
  init_priority_skill_loader();
335399
- logger90 = import_electron_log91.default.scope("skill-index");
335776
+ logger91 = import_electron_log92.default.scope("skill-index");
335400
335777
  BUNDLED_GUIDES = [
335401
335778
  {
335402
335779
  file: "guides/memory.md",
@@ -335511,7 +335888,7 @@ async function loadModeSkillSection(p2) {
335511
335888
  ${modeSkillBody}`
335512
335889
  };
335513
335890
  } catch (skillErr) {
335514
- logger91.warn("[skills] Failed to load mode skill:", skillErr);
335891
+ logger92.warn("[skills] Failed to load mode skill:", skillErr);
335515
335892
  return null;
335516
335893
  }
335517
335894
  }
@@ -335524,12 +335901,12 @@ async function loadSkillsIndexSection(p2) {
335524
335901
  );
335525
335902
  const block = formatSkillIndexForPrompt(entries2);
335526
335903
  if (!block.trim()) return null;
335527
- logger91.info(
335904
+ logger92.info(
335528
335905
  `[skills-index] ${entries2.length} skill(s) indexed for mode "${effectiveWorkMode}" (${block.length} chars, bodies read on demand)`
335529
335906
  );
335530
335907
  return { name: "skillsIndex", priority: -2, content: block };
335531
335908
  } catch (skillIndexErr) {
335532
- logger91.warn("[skills-index] Failed to build skill index:", skillIndexErr);
335909
+ logger92.warn("[skills-index] Failed to build skill index:", skillIndexErr);
335533
335910
  return null;
335534
335911
  }
335535
335912
  }
@@ -335571,7 +335948,7 @@ async function loadWorkspaceCapsSection(p2) {
335571
335948
  content: capsBlock
335572
335949
  };
335573
335950
  } catch (capsErr) {
335574
- logger91.warn("[workspace-capabilities] Failed to load:", capsErr);
335951
+ logger92.warn("[workspace-capabilities] Failed to load:", capsErr);
335575
335952
  return null;
335576
335953
  }
335577
335954
  }
@@ -335619,7 +335996,7 @@ ${snippet}`
335619
335996
  taskLedgerBlock
335620
335997
  };
335621
335998
  } catch (planCtxErr) {
335622
- logger91.warn("[plan-artifact] context inject failed:", planCtxErr);
335999
+ logger92.warn("[plan-artifact] context inject failed:", planCtxErr);
335623
336000
  return { section: null, taskLedgerBlock: null };
335624
336001
  }
335625
336002
  }
@@ -335641,12 +336018,12 @@ async function loadAtlarixMdSection(p2) {
335641
336018
  `Read them with read_file before you change code or make a design decision, and follow them.`,
335642
336019
  headings.length ? `Sections: ${headings.join(" \xB7 ")}` : ""
335643
336020
  ].filter(Boolean).join("\n");
335644
- logger91.info(
336021
+ logger92.info(
335645
336022
  `Project instructions pointer (${instructions.source}, ${sizeKb}KB, ${headings.length} headings)`
335646
336023
  );
335647
336024
  return { name: "projectMemory", priority: 4, content };
335648
336025
  } catch (memErr) {
335649
- logger91.warn("Failed to read project instructions:", memErr);
336026
+ logger92.warn("Failed to read project instructions:", memErr);
335650
336027
  return null;
335651
336028
  }
335652
336029
  }
@@ -335682,20 +336059,20 @@ async function loadMemoryMdSection(p2) {
335682
336059
  ].join("\n");
335683
336060
  return { name: "projectKnowledge", priority: 3.9, content };
335684
336061
  } catch (memErr) {
335685
- logger91.warn("Failed to read agent memory index:", memErr);
336062
+ logger92.warn("Failed to read agent memory index:", memErr);
335686
336063
  return null;
335687
336064
  }
335688
336065
  }
335689
- var import_electron_log92, logger91;
336066
+ var import_electron_log93, logger92;
335690
336067
  var init_context_sections = __esm({
335691
336068
  "src/ipc/handlers/chat_stream/context-sections.ts"() {
335692
- import_electron_log92 = __toESM(require_src());
336069
+ import_electron_log93 = __toESM(require_src());
335693
336070
  init_skill_registry();
335694
336071
  init_skill_loader();
335695
336072
  init_skill_index();
335696
336073
  init_project_memory2();
335697
336074
  init_plan_checklist();
335698
- logger91 = import_electron_log92.default.scope("chat_stream_handlers");
336075
+ logger92 = import_electron_log93.default.scope("chat_stream_handlers");
335699
336076
  }
335700
336077
  });
335701
336078
 
@@ -335729,7 +336106,7 @@ function registerChatStreamHandlers() {
335729
336106
  userStopped: isChatUserStopped(req.chatId)
335730
336107
  });
335731
336108
  if (wakeDrop) {
335732
- logger92.log(
336109
+ logger93.log(
335733
336110
  `[wake] dropped system wake for chat ${req.chatId}: ${wakeDrop}`
335734
336111
  );
335735
336112
  return {
@@ -335737,7 +336114,7 @@ function registerChatStreamHandlers() {
335737
336114
  dropped: wakeDrop
335738
336115
  };
335739
336116
  }
335740
- if (req.prompt.trim().length > 0) {
336117
+ if (shouldClearUserStopLatch(req)) {
335741
336118
  clearChatUserStopped(req.chatId);
335742
336119
  }
335743
336120
  const priorController = activeStreams.get(req.chatId);
@@ -335791,7 +336168,7 @@ function registerChatStreamHandlers() {
335791
336168
  }
335792
336169
  };
335793
336170
  const handleStreamStall = () => {
335794
- logger92.warn(`[stream] Stall detected for chat ${req.chatId} \u2014 retrying`);
336171
+ logger93.warn(`[stream] Stall detected for chat ${req.chatId} \u2014 retrying`);
335795
336172
  handleStreamActivityPulse();
335796
336173
  };
335797
336174
  const streamDebugLogging = isStreamDebugLoggingEnabled();
@@ -335894,7 +336271,7 @@ function registerChatStreamHandlers() {
335894
336271
  const { isStreamTransportId: isStreamTransportId2, getStreamTransportAppId: getStreamTransportAppId2 } = await Promise.resolve().then(() => (init_stream_transport(), stream_transport_exports));
335895
336272
  if (!isStreamTransportId2(req.chatId)) {
335896
336273
  const legacyMsg = "Legacy database chats were removed. Open a workspace session from the sidebar.";
335897
- logger92.warn(`Chat ${req.chatId} rejected: legacy positive chat id`);
336274
+ logger93.warn(`Chat ${req.chatId} rejected: legacy positive chat id`);
335898
336275
  safeSend(event.sender, "chat:response:error", {
335899
336276
  chatId: req.chatId,
335900
336277
  streamId,
@@ -335912,10 +336289,10 @@ function registerChatStreamHandlers() {
335912
336289
  if (isStreamTransportId2(req.chatId)) {
335913
336290
  const ephemeralAppId = getStreamTransportAppId2(req.chatId);
335914
336291
  if (ephemeralAppId) {
335915
- logger92.log(`Chat ${req.chatId} is ephemeral workspace chat for app: ${ephemeralAppId}`);
336292
+ logger93.log(`Chat ${req.chatId} is ephemeral workspace chat for app: ${ephemeralAppId}`);
335916
336293
  } else {
335917
336294
  const noWorkspaceMsg = "Open a workspace folder to start chatting. Use Open folder on the welcome screen.";
335918
- logger92.warn(`Chat ${req.chatId} rejected: ephemeral chat without workspace`);
336295
+ logger93.warn(`Chat ${req.chatId} rejected: ephemeral chat without workspace`);
335919
336296
  safeSend(event.sender, "chat:response:error", {
335920
336297
  chatId: req.chatId,
335921
336298
  streamId,
@@ -335953,7 +336330,7 @@ function registerChatStreamHandlers() {
335953
336330
  lastUsedAt: /* @__PURE__ */ new Date(),
335954
336331
  hasAnsweredQuestions: false
335955
336332
  };
335956
- logger92.log(`Ephemeral workspace chat loaded for app: ${appData.name} (${appData.path})`);
336333
+ logger93.log(`Ephemeral workspace chat loaded for app: ${appData.name} (${appData.path})`);
335957
336334
  }
335958
336335
  const { resolveOrBindWorkspaceSessionForStream: resolveOrBindWorkspaceSessionForStream2 } = await Promise.resolve().then(() => (init_workspace_session_handlers(), workspace_session_handlers_exports));
335959
336336
  req.workspaceSessionId = await preflight.time(
@@ -336082,7 +336459,7 @@ function registerChatStreamHandlers() {
336082
336459
  ---
336083
336460
  `;
336084
336461
  } catch (err2) {
336085
- logger92.error(`Error reading file content: ${err2}`);
336462
+ logger93.error(`Error reading file content: ${err2}`);
336086
336463
  }
336087
336464
  }
336088
336465
  }
@@ -336127,7 +336504,7 @@ function registerChatStreamHandlers() {
336127
336504
  try {
336128
336505
  return await persistOnce();
336129
336506
  } catch (firstErr) {
336130
- logger92.warn(
336507
+ logger93.warn(
336131
336508
  "Persist of workspace session user message failed \u2014 retrying once:",
336132
336509
  firstErr
336133
336510
  );
@@ -336136,7 +336513,7 @@ function registerChatStreamHandlers() {
336136
336513
  });
336137
336514
  persistedUserRowId = row?.id;
336138
336515
  } catch (err2) {
336139
- logger92.error(
336516
+ logger93.error(
336140
336517
  "Failed to persist workspace session user message (after retry) \u2014 a resume of this turn will see attachment stubs without bodies:",
336141
336518
  err2
336142
336519
  );
@@ -336169,11 +336546,11 @@ function registerChatStreamHandlers() {
336169
336546
  name: activeUserAgent.model.slice(slash + 1)
336170
336547
  } : { provider: settings.selectedModel.provider, name: activeUserAgent.model };
336171
336548
  }
336172
- logger92.log(
336549
+ logger93.log(
336173
336550
  `[user-agent] active: ${activeUserAgent.name} (mode=${activeUserAgent.mode}${activeUserAgent.model ? `, model=${activeUserAgent.model}` : ""})`
336174
336551
  );
336175
336552
  } else {
336176
- logger92.warn(`[user-agent] "${req.agentOverride}" not found \u2014 ignored`);
336553
+ logger93.warn(`[user-agent] "${req.agentOverride}" not found \u2014 ignored`);
336177
336554
  }
336178
336555
  }
336179
336556
  const newUserMessageId = nextEphemeralMessageId();
@@ -336283,7 +336660,7 @@ function registerChatStreamHandlers() {
336283
336660
  modelClient.builtinProviderId
336284
336661
  );
336285
336662
  const reasoningCatalogModelId = resolveReasoningCatalogModelId(effectiveModel);
336286
- logger92.log(
336663
+ logger93.log(
336287
336664
  `[stream:${req.chatId}] model=${effectiveModel.provider}/${effectiveModel.name} reasoning=${enableNativeReasoning} wire=${modelClient.builtinProviderId ?? "?"} vendor=${reasoningCapabilityProvider ?? "?"}/${reasoningCatalogModelId} catalog=${catalogSaysReasons(
336288
336665
  reasoningCapabilityProvider,
336289
336666
  reasoningCatalogModelId
@@ -336294,7 +336671,7 @@ function registerChatStreamHandlers() {
336294
336671
  }).kind}`
336295
336672
  );
336296
336673
  const budgetDetail = await contextWindowPromise;
336297
- logger92.log(
336674
+ logger93.log(
336298
336675
  `[budget] model=${effectiveModel.provider}/${effectiveModel.name} contextWindow=${budgetDetail.contextWindow} source=${budgetDetail.source}`
336299
336676
  );
336300
336677
  const usedCompassThisStream = modelClient.builtinProviderId === "compass";
@@ -336312,7 +336689,7 @@ function registerChatStreamHandlers() {
336312
336689
  let appPath = effectiveApp?.path ? resolveAppPath(effectiveApp.path) : "";
336313
336690
  const effectiveAppId = effectiveApp?.id;
336314
336691
  if (process.env.ATLARIX_DIAG_146 === "1") {
336315
- logger92.info(
336692
+ logger93.info(
336316
336693
  `[DIAG_146] enforce-appId chat=${req.chatId} effectiveAppId=${effectiveAppId} path=${effectiveApp?.path ?? "<none>"}`
336317
336694
  );
336318
336695
  }
@@ -336321,11 +336698,11 @@ function registerChatStreamHandlers() {
336321
336698
  void Promise.resolve().then(() => (init_skill_loader(), skill_loader_exports)).then((m3) => m3.clearSkillCache()).catch(() => {
336322
336699
  });
336323
336700
  }
336324
- logger92.log(
336701
+ logger93.log(
336325
336702
  `Using workspace for chat ${req.chatId}: ${appPath || "(none)"} (appId: ${effectiveAppId ?? req.appId ?? "n/a"})`
336326
336703
  );
336327
336704
  if (hasWorkspace && appPath && !fs38.existsSync(appPath)) {
336328
- logger92.warn(`Workspace path does not exist on disk: ${appPath}`);
336705
+ logger93.warn(`Workspace path does not exist on disk: ${appPath}`);
336329
336706
  safeSend(event.sender, "chat:activity", {
336330
336707
  id: `workspace-path-missing-${req.chatId}`,
336331
336708
  type: "orchestrator_blocker",
@@ -336345,13 +336722,13 @@ function registerChatStreamHandlers() {
336345
336722
  }) : "";
336346
336723
  const otherAppsCodebaseInfo = mentionedContextBlock;
336347
336724
  if (otherAppsCodebaseInfo) {
336348
- logger92.log(
336725
+ logger93.log(
336349
336726
  `Injected @-mention context: ${contextMentions.files.length} file(s), ${contextMentions.dirs.length} folder(s)`
336350
336727
  );
336351
336728
  }
336352
336729
  if (hasWorkspace) {
336353
- logger92.log(`Extracted codebase information from ${appPath}`);
336354
- logger92.log(
336730
+ logger93.log(`Extracted codebase information from ${appPath}`);
336731
+ logger93.log(
336355
336732
  "codebaseInfo: length",
336356
336733
  codebaseInfo.length,
336357
336734
  "estimated tokens",
@@ -336378,18 +336755,18 @@ function registerChatStreamHandlers() {
336378
336755
  const { sliceFromLastCompactionSummary: sliceFromLastCompactionSummary2 } = await Promise.resolve().then(() => (init_compaction(), compaction_exports));
336379
336756
  const sliced = sliceFromLastCompactionSummary2(messageHistory);
336380
336757
  if (process.env.ATLARIX_DIAG_146 === "1") {
336381
- logger92.info(
336758
+ logger93.info(
336382
336759
  `[DIAG_146] dispatch-slice chat=${req.chatId} markerFound=${sliced.length !== messageHistory.length} fullLen=${messageHistory.length} slicedLen=${sliced.length}`
336383
336760
  );
336384
336761
  }
336385
336762
  if (sliced.length !== messageHistory.length) {
336386
- logger92.log(
336763
+ logger93.log(
336387
336764
  `[stream:${req.chatId}] Compaction summary found \u2014 model history ${messageHistory.length} \u2192 ${sliced.length} messages`
336388
336765
  );
336389
336766
  messageHistory = sliced;
336390
336767
  }
336391
336768
  }
336392
- logger92.log(
336769
+ logger93.log(
336393
336770
  `[stream:${req.chatId}] Prepared message history (len=${messageHistory.length})`
336394
336771
  );
336395
336772
  let limitedMessageHistory = messageHistory;
@@ -336419,7 +336796,7 @@ function registerChatStreamHandlers() {
336419
336796
  unattended: Boolean(req.automation)
336420
336797
  }).total;
336421
336798
  } catch (e3) {
336422
- logger92.warn(
336799
+ logger93.warn(
336423
336800
  `[budget] tool-surface measurement failed; budget decisions this turn use the system prompt alone: ${String(e3)}`
336424
336801
  );
336425
336802
  }
@@ -336593,7 +336970,7 @@ ${baseSystemPrompt}`;
336593
336970
  effectiveModel,
336594
336971
  contextWindowTokens
336595
336972
  );
336596
- logger92.info(
336973
+ logger93.info(
336597
336974
  `[budget] window=${contextWindowTokens} usable=${usableTokens} reserve=${contextWindowTokens - usableTokens}`
336598
336975
  );
336599
336976
  const applyTierEscalation = async (_args) => false;
@@ -336728,7 +337105,7 @@ ${baseSystemPrompt}`;
336728
337105
  if (done || !ttftShouldLog || ttftStartRef.ms == null) return;
336729
337106
  done = true;
336730
337107
  const openRouterCompressionApplied = (modelClient.builtinProviderId === "openrouter" || modelClient.builtinProviderId === "compass") && (budgetTracker.isCritical() || budgetTracker.isOverLimit());
336731
- logger92.log(
337108
+ logger93.log(
336732
337109
  `[TTFT] provider=${String(modelClient.builtinProviderId)} model=${String(effectiveModel?.name ?? "")} contextLength=${modelContextResolved.rawContextLength ?? "unknown"} ttft=${Date.now() - ttftStartRef.ms}ms budgetTier=${budgetTracker.getBudgetTier()} estimatedTokens=${dispatchEstimate} pruningApplied=${contextBudgetPruningApplied} compressionApplied=${openRouterCompressionApplied} budgetDroppedMessages=${budgetDroppedMessages}`
336733
337110
  );
336734
337111
  };
@@ -336871,7 +337248,7 @@ ${baseSystemPrompt}`;
336871
337248
  abortController
336872
337249
  };
336873
337250
  const processResponseChunkUpdate2 = (args2) => processResponseChunkUpdate(
336874
- { req, updatedChat, event, streamId },
337251
+ { req, updatedChat, event, streamId, placeholderAssistantMessage },
336875
337252
  args2
336876
337253
  );
336877
337254
  ctx.filesWrittenInThisExchange = [];
@@ -336970,13 +337347,13 @@ ${baseSystemPrompt}`;
336970
337347
  async () => {
336971
337348
  if (fs38.existsSync(filePath)) {
336972
337349
  await unlink2(filePath);
336973
- logger92.log(`Deleted temporary file: ${filePath}`);
337350
+ logger93.log(`Deleted temporary file: ${filePath}`);
336974
337351
  }
336975
337352
  },
336976
337353
  30 * 60 * 1e3
336977
337354
  );
336978
337355
  } catch (error51) {
336979
- logger92.error(`Error scheduling file deletion: ${error51}`);
337356
+ logger93.error(`Error scheduling file deletion: ${error51}`);
336980
337357
  }
336981
337358
  }
336982
337359
  }
@@ -337011,7 +337388,7 @@ ${baseSystemPrompt}`;
337011
337388
  registerLifecycleHandlers(chatStreamHandler);
337012
337389
  registerRevertHandlers();
337013
337390
  }
337014
- var import_electron_log93, logger92, TEMP_DIR;
337391
+ var import_electron_log94, logger93, TEMP_DIR;
337015
337392
  var init_chat_stream_handlers = __esm({
337016
337393
  "src/ipc/handlers/chat_stream_handlers.ts"() {
337017
337394
  init_electron_stub();
@@ -337033,7 +337410,7 @@ var init_chat_stream_handlers = __esm({
337033
337410
  init_active_model_identity();
337034
337411
  init_turn_usage_aggregator();
337035
337412
  init_stream_stop_sentinels();
337036
- import_electron_log93 = __toESM(require_src());
337413
+ import_electron_log94 = __toESM(require_src());
337037
337414
  init_safe_sender();
337038
337415
  init_stream_transport();
337039
337416
  init_stream_debug();
@@ -337079,7 +337456,7 @@ var init_chat_stream_handlers = __esm({
337079
337456
  init_build_branch();
337080
337457
  init_finalize();
337081
337458
  init_context_sections();
337082
- logger92 = import_electron_log93.default.scope("chat_stream_handlers");
337459
+ logger93 = import_electron_log94.default.scope("chat_stream_handlers");
337083
337460
  TEMP_DIR = path48.join(os11.tmpdir(), "atlarix-attachments");
337084
337461
  if (!fs38.existsSync(TEMP_DIR)) {
337085
337462
  fs38.mkdirSync(TEMP_DIR, { recursive: true });
@@ -337421,7 +337798,7 @@ if (!process.env.ATLARIX_MODELS_SNAPSHOT) {
337421
337798
  const shipped = path50.join(here, "models-snapshot.json.gz");
337422
337799
  if (fs40.existsSync(shipped)) process.env.ATLARIX_MODELS_SNAPSHOT = shipped;
337423
337800
  }
337424
- var VERSION15 = false ? "dev" : "14.41.0";
337801
+ var VERSION15 = false ? "dev" : "14.43.0";
337425
337802
  if (process.argv[2] === "run") process.argv.splice(2, 1);
337426
337803
  function arg(name29) {
337427
337804
  const i4 = process.argv.indexOf(`--${name29}`);