@letta-ai/letta-code 0.24.9 → 0.24.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/letta.js +571 -231
  2. package/package.json +2 -1
package/letta.js CHANGED
@@ -3269,7 +3269,7 @@ var package_default;
3269
3269
  var init_package = __esm(() => {
3270
3270
  package_default = {
3271
3271
  name: "@letta-ai/letta-code",
3272
- version: "0.24.9",
3272
+ version: "0.24.10",
3273
3273
  description: "Letta Code is a CLI tool for interacting with stateful Letta agents from the terminal.",
3274
3274
  type: "module",
3275
3275
  bin: {
@@ -3310,6 +3310,7 @@ var init_package = __esm(() => {
3310
3310
  "node-pty": "^1.1.0",
3311
3311
  open: "^10.2.0",
3312
3312
  sharp: "^0.34.5",
3313
+ "strip-ansi": "^7.2.0",
3313
3314
  ws: "^8.19.0"
3314
3315
  },
3315
3316
  optionalDependencies: {
@@ -4905,6 +4906,7 @@ function getClientDefaultHeaders() {
4905
4906
  return {
4906
4907
  "X-Letta-Source": "letta-code",
4907
4908
  "User-Agent": `letta-code/${package_default.version}`,
4909
+ "X-Letta-Environment-Device-Id": settingsManager.getOrCreateDeviceId(),
4908
4910
  ...nodeExperiment.source === "override" ? { "x-letta-node": nodeExperiment.enabled ? "1" : "0" } : nodeExperiment.enabled ? { "x-letta-node": "1" } : {}
4909
4911
  };
4910
4912
  }
@@ -4966,7 +4968,7 @@ If you experience this issue multiple times, move ~/.letta to ~/.letta_backup, a
4966
4968
  console.error(new Error("getClient() called without credentials").stack);
4967
4969
  throw new Error("Missing LETTA_API_KEY. Run 'letta' to configure authentication, or set LETTA_API_KEY to your API key.");
4968
4970
  }
4969
- return new Letta({
4971
+ const client = new Letta({
4970
4972
  apiKey,
4971
4973
  baseURL,
4972
4974
  logger: sdkLogger,
@@ -4974,6 +4976,28 @@ If you experience this issue multiple times, move ~/.letta to ~/.letta_backup, a
4974
4976
  defaultHeaders: getClientDefaultHeaders(),
4975
4977
  ...isTimingsEnabled() && { fetch: createTimingFetch(fetch) }
4976
4978
  });
4979
+ const MESSAGE_CACHE_MAX = 32;
4980
+ const messageCache = new Map;
4981
+ const origRetrieveMessage = client.messages.retrieve.bind(client.messages);
4982
+ client.messages.retrieve = (...args) => {
4983
+ const messageId = args[0];
4984
+ const cached = messageCache.get(messageId);
4985
+ if (cached) {
4986
+ messageCache.delete(messageId);
4987
+ messageCache.set(messageId, cached);
4988
+ return cached;
4989
+ }
4990
+ const promise = origRetrieveMessage(...args);
4991
+ messageCache.set(messageId, promise);
4992
+ if (messageCache.size > MESSAGE_CACHE_MAX) {
4993
+ const oldest = messageCache.keys().next().value;
4994
+ if (oldest !== undefined)
4995
+ messageCache.delete(oldest);
4996
+ }
4997
+ promise.catch(() => messageCache.delete(messageId));
4998
+ return promise;
4999
+ };
5000
+ return client;
4977
5001
  }
4978
5002
  var SDK_DIAGNOSTIC_MAX_LEN = 400, SDK_DIAGNOSTIC_MAX_LINES = 4, lastSDKDiagnostic = null, _cachedApiKey, _testClientOverride = null, sdkLogger, LETTA_MEMFS_GIT_PROXY_BASE_URL_ENV = "LETTA_MEMFS_GIT_PROXY_BASE_URL";
4979
5003
  var init_client2 = __esm(() => {
@@ -29814,7 +29838,7 @@ function ansiRegex({ onlyFirst = false } = {}) {
29814
29838
  return new RegExp(pattern, onlyFirst ? undefined : "g");
29815
29839
  }
29816
29840
 
29817
- // node_modules/strip-ansi/index.js
29841
+ // node_modules/string-width/node_modules/strip-ansi/index.js
29818
29842
  function stripAnsi(string) {
29819
29843
  if (typeof string !== "string") {
29820
29844
  throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
@@ -29954,6 +29978,18 @@ var init_measure_text = __esm(() => {
29954
29978
  measure_text_default = measureText;
29955
29979
  });
29956
29980
 
29981
+ // node_modules/wrap-ansi/node_modules/strip-ansi/index.js
29982
+ function stripAnsi2(string) {
29983
+ if (typeof string !== "string") {
29984
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
29985
+ }
29986
+ return string.replace(regex2, "");
29987
+ }
29988
+ var regex2;
29989
+ var init_strip_ansi2 = __esm(() => {
29990
+ regex2 = ansiRegex();
29991
+ });
29992
+
29957
29993
  // node_modules/ansi-styles/index.js
29958
29994
  function assembleStyles() {
29959
29995
  const codes = new Map;
@@ -30142,7 +30178,7 @@ var ESCAPES, END_CODE = 39, ANSI_ESCAPE_BELL = "\x07", ANSI_CSI = "[", ANSI_OSC
30142
30178
  const characters = [...word];
30143
30179
  let isInsideEscape = false;
30144
30180
  let isInsideLinkEscape = false;
30145
- let visible = stringWidth(stripAnsi(rows.at(-1)));
30181
+ let visible = stringWidth(stripAnsi2(rows.at(-1)));
30146
30182
  for (const [index, character] of characters.entries()) {
30147
30183
  const characterLength = stringWidth(character);
30148
30184
  if (visible + characterLength <= columns) {
@@ -30278,7 +30314,7 @@ var ESCAPES, END_CODE = 39, ANSI_ESCAPE_BELL = "\x07", ANSI_CSI = "[", ANSI_OSC
30278
30314
  };
30279
30315
  var init_wrap_ansi = __esm(() => {
30280
30316
  init_string_width();
30281
- init_strip_ansi();
30317
+ init_strip_ansi2();
30282
30318
  init_ansi_styles();
30283
30319
  ESCAPES = new Set([
30284
30320
  "\x1B",
@@ -31083,8 +31119,8 @@ function indentString(string, count = 1, options = {}) {
31083
31119
  if (count === 0) {
31084
31120
  return string;
31085
31121
  }
31086
- const regex2 = includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
31087
- return string.replace(regex2, indent.repeat(count));
31122
+ const regex3 = includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
31123
+ return string.replace(regex3, indent.repeat(count));
31088
31124
  }
31089
31125
 
31090
31126
  // node_modules/ink/build/get-max-width.js
@@ -37361,17 +37397,17 @@ var require_picomatch = __commonJS((exports, module) => {
37361
37397
  }
37362
37398
  const opts = options || {};
37363
37399
  const posix = utils.isWindows(options);
37364
- const regex2 = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
37365
- const state = regex2.state;
37366
- delete regex2.state;
37400
+ const regex3 = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
37401
+ const state = regex3.state;
37402
+ delete regex3.state;
37367
37403
  let isIgnored = () => false;
37368
37404
  if (opts.ignore) {
37369
37405
  const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
37370
37406
  isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
37371
37407
  }
37372
37408
  const matcher = (input, returnObject = false) => {
37373
- const { isMatch, match, output } = picomatch.test(input, regex2, options, { glob, posix });
37374
- const result = { glob, state, regex: regex2, posix, input, output, match, isMatch };
37409
+ const { isMatch, match, output } = picomatch.test(input, regex3, options, { glob, posix });
37410
+ const result = { glob, state, regex: regex3, posix, input, output, match, isMatch };
37375
37411
  if (typeof opts.onResult === "function") {
37376
37412
  opts.onResult(result);
37377
37413
  }
@@ -37396,7 +37432,7 @@ var require_picomatch = __commonJS((exports, module) => {
37396
37432
  }
37397
37433
  return matcher;
37398
37434
  };
37399
- picomatch.test = (input, regex2, options, { glob, posix } = {}) => {
37435
+ picomatch.test = (input, regex3, options, { glob, posix } = {}) => {
37400
37436
  if (typeof input !== "string") {
37401
37437
  throw new TypeError("Expected input to be a string");
37402
37438
  }
@@ -37413,16 +37449,16 @@ var require_picomatch = __commonJS((exports, module) => {
37413
37449
  }
37414
37450
  if (match === false || opts.capture === true) {
37415
37451
  if (opts.matchBase === true || opts.basename === true) {
37416
- match = picomatch.matchBase(input, regex2, options, posix);
37452
+ match = picomatch.matchBase(input, regex3, options, posix);
37417
37453
  } else {
37418
- match = regex2.exec(output);
37454
+ match = regex3.exec(output);
37419
37455
  }
37420
37456
  }
37421
37457
  return { isMatch: Boolean(match), match, output };
37422
37458
  };
37423
37459
  picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
37424
- const regex2 = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
37425
- return regex2.test(path2.basename(input));
37460
+ const regex3 = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
37461
+ return regex3.test(path2.basename(input));
37426
37462
  };
37427
37463
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
37428
37464
  picomatch.parse = (pattern, options) => {
@@ -37442,11 +37478,11 @@ var require_picomatch = __commonJS((exports, module) => {
37442
37478
  if (state && state.negated === true) {
37443
37479
  source = `^(?!${source}).*$`;
37444
37480
  }
37445
- const regex2 = picomatch.toRegex(source, options);
37481
+ const regex3 = picomatch.toRegex(source, options);
37446
37482
  if (returnState === true) {
37447
- regex2.state = state;
37483
+ regex3.state = state;
37448
37484
  }
37449
- return regex2;
37485
+ return regex3;
37450
37486
  };
37451
37487
  picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
37452
37488
  if (!input || typeof input !== "string") {
@@ -39281,7 +39317,13 @@ async function cloneMemoryRepo(agentId) {
39281
39317
  operation: "clone memory repo (tmp migration)"
39282
39318
  });
39283
39319
  renameSync(join7(tmpDir, ".git"), join7(dir, ".git"));
39284
- await runGit(dir, ["checkout", "--", "."], token);
39320
+ try {
39321
+ await runGit(dir, ["rev-parse", "--verify", "HEAD"], token);
39322
+ await runGit(dir, ["checkout", "--", "."], token);
39323
+ } catch (checkoutErr) {
39324
+ const msg = checkoutErr instanceof Error ? checkoutErr.message : String(checkoutErr);
39325
+ debugLog("memfs-git", `Skipping checkout (likely empty remote, no HEAD yet): ${msg}`);
39326
+ }
39285
39327
  debugLog("memfs-git", "Migrated existing memory directory to git repo");
39286
39328
  } finally {
39287
39329
  if (existsSync8(tmpDir)) {
@@ -46501,6 +46543,21 @@ var init_registry = __esm(() => {
46501
46543
  init_xml();
46502
46544
  });
46503
46545
 
46546
+ // node_modules/strip-ansi/index.js
46547
+ function stripAnsi3(string) {
46548
+ if (typeof string !== "string") {
46549
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
46550
+ }
46551
+ if (!string.includes("\x1B") && !string.includes("›")) {
46552
+ return string;
46553
+ }
46554
+ return string.replace(regex3, "");
46555
+ }
46556
+ var regex3;
46557
+ var init_strip_ansi3 = __esm(() => {
46558
+ regex3 = ansiRegex();
46559
+ });
46560
+
46504
46561
  // src/agent/approval-execution.ts
46505
46562
  var exports_approval_execution = {};
46506
46563
  __export(exports_approval_execution, {
@@ -47541,6 +47598,9 @@ var init_session = __esm(() => {
47541
47598
  });
47542
47599
 
47543
47600
  // src/tools/impl/shellLaunchers.ts
47601
+ function isValidEnvAlias(name) {
47602
+ return /^[A-Za-z_][A-Za-z0-9_]*$/.test(name);
47603
+ }
47544
47604
  function pushUnique(list, seen, entry) {
47545
47605
  if (!entry.length || !entry[0])
47546
47606
  return;
@@ -47557,18 +47617,21 @@ function normalizePowerShellCommand(command) {
47557
47617
  }
47558
47618
  return trimmed;
47559
47619
  }
47560
- function buildPowerShellCommand(command) {
47620
+ function buildPowerShellCommand(command, envAliases = []) {
47561
47621
  const powerShellCommand = normalizePowerShellCommand(command);
47562
- const aliasPrelude = POWERSHELL_ENV_ALIASES.map((name) => `$${name} = $env:${name}`).join("; ");
47622
+ const aliases = [
47623
+ ...new Set([...POWERSHELL_ENV_ALIASES, ...envAliases])
47624
+ ].filter(isValidEnvAlias);
47625
+ const aliasPrelude = aliases.map((name) => `$${name} = $env:${name}`).join("; ");
47563
47626
  return `${aliasPrelude}; ${powerShellCommand}`;
47564
47627
  }
47565
- function windowsLaunchers(command) {
47628
+ function windowsLaunchers(command, envAliases = []) {
47566
47629
  const trimmed = command.trim();
47567
47630
  if (!trimmed)
47568
47631
  return [];
47569
47632
  const launchers = [];
47570
47633
  const seen = new Set;
47571
- const powerShellCommand = buildPowerShellCommand(trimmed);
47634
+ const powerShellCommand = buildPowerShellCommand(trimmed, envAliases);
47572
47635
  pushUnique(launchers, seen, [
47573
47636
  "powershell.exe",
47574
47637
  "-NoProfile",
@@ -47648,7 +47711,7 @@ function unixLaunchers(command, login) {
47648
47711
  }
47649
47712
  function buildShellLaunchers(command, options) {
47650
47713
  const login = options?.login ?? false;
47651
- return process.platform === "win32" ? windowsLaunchers(command) : unixLaunchers(command, login);
47714
+ return process.platform === "win32" ? windowsLaunchers(command, options?.powershellEnvAliases) : unixLaunchers(command, login);
47652
47715
  }
47653
47716
  var SEP2 = "\x00", POWERSHELL_ENV_ALIASES;
47654
47717
  var init_shellLaunchers = __esm(() => {
@@ -48214,8 +48277,8 @@ function matchesTool(pattern, toolName) {
48214
48277
  return true;
48215
48278
  }
48216
48279
  try {
48217
- const regex2 = new RegExp(`^(?:${pattern})$`);
48218
- return regex2.test(toolName);
48280
+ const regex4 = new RegExp(`^(?:${pattern})$`);
48281
+ return regex4.test(toolName);
48219
48282
  } catch (error) {
48220
48283
  debugLog("hooks", `matchesTool: Invalid regex pattern "${pattern}", falling back to exact match`, error);
48221
48284
  return pattern === toolName;
@@ -52130,26 +52193,30 @@ var init_mode = __esm(() => {
52130
52193
  });
52131
52194
 
52132
52195
  // src/tools/secret-substitution.ts
52133
- function substituteSecretsInString(input) {
52134
- const secrets2 = loadSecrets();
52135
- return input.replace(SECRET_PATTERN, (match, name) => {
52136
- const value = secrets2[name];
52137
- return value !== undefined ? value : match;
52138
- });
52139
- }
52140
- function substituteSecretsInArgs(args) {
52141
- const result = {};
52142
- for (const [key, value] of Object.entries(args)) {
52143
- if (typeof value === "string") {
52144
- result[key] = substituteSecretsInString(value);
52145
- } else {
52146
- result[key] = value;
52196
+ function extractSecretEnvFromCommand(command, agentId) {
52197
+ const secrets2 = loadSecrets(agentId);
52198
+ const env3 = {};
52199
+ const scan = (text) => {
52200
+ for (const match of text.matchAll(SECRET_PATTERN)) {
52201
+ const name = match[1];
52202
+ if (name !== undefined && secrets2[name] !== undefined) {
52203
+ env3[name] = secrets2[name];
52204
+ }
52147
52205
  }
52206
+ };
52207
+ if (typeof command === "string") {
52208
+ scan(command);
52209
+ return env3;
52148
52210
  }
52149
- return result;
52211
+ for (const part of command) {
52212
+ if (typeof part === "string") {
52213
+ scan(part);
52214
+ }
52215
+ }
52216
+ return env3;
52150
52217
  }
52151
- function scrubSecretsFromString(input) {
52152
- const secrets2 = loadSecrets();
52218
+ function scrubSecretsFromString(input, agentId) {
52219
+ const secrets2 = loadSecrets(agentId);
52153
52220
  let result = input;
52154
52221
  const entries = Object.entries(secrets2).sort(([, a], [, b]) => b.length - a.length);
52155
52222
  for (const [name, value] of entries) {
@@ -55219,40 +55286,45 @@ function validateWorktreePath(command, cwd2) {
55219
55286
  }
55220
55287
  return null;
55221
55288
  }
55222
- function rebuildCachedLauncher(command) {
55289
+ function rebuildCachedLauncher(command, secretEnv) {
55223
55290
  if (!cachedWorkingLauncher)
55224
55291
  return null;
55225
55292
  const cachedExecutable = cachedWorkingLauncher[0]?.toLowerCase();
55226
55293
  if (!cachedExecutable)
55227
55294
  return null;
55228
- const launchers = buildShellLaunchers(command);
55295
+ const launchers = buildShellLaunchers(command, {
55296
+ powershellEnvAliases: secretEnv ? Object.keys(secretEnv) : undefined
55297
+ });
55229
55298
  return launchers.find((launcher) => launcher[0]?.toLowerCase() === cachedExecutable) ?? null;
55230
55299
  }
55231
- function getBackgroundLauncher(command) {
55232
- const cachedLauncher = rebuildCachedLauncher(command);
55300
+ function getBackgroundLauncher(command, secretEnv) {
55301
+ const cachedLauncher = rebuildCachedLauncher(command, secretEnv);
55233
55302
  if (cachedLauncher)
55234
55303
  return cachedLauncher;
55235
- const launchers = buildShellLaunchers(command);
55304
+ const launchers = buildShellLaunchers(command, {
55305
+ powershellEnvAliases: secretEnv ? Object.keys(secretEnv) : undefined
55306
+ });
55236
55307
  return launchers[0] || [];
55237
55308
  }
55238
55309
  async function spawnCommand(command, options) {
55310
+ const env3 = options.secretEnv ? { ...options.env, ...options.secretEnv } : options.env;
55239
55311
  if (process.platform !== "win32") {
55240
55312
  const executable = process.platform === "darwin" ? "/bin/zsh" : "bash";
55241
55313
  return spawnWithLauncher([executable, "-c", command], {
55242
55314
  cwd: options.cwd,
55243
- env: options.env,
55315
+ env: env3,
55244
55316
  timeoutMs: options.timeout,
55245
55317
  signal: options.signal,
55246
55318
  onOutput: options.onOutput
55247
55319
  });
55248
55320
  }
55249
55321
  if (cachedWorkingLauncher) {
55250
- const newLauncher = rebuildCachedLauncher(command);
55322
+ const newLauncher = rebuildCachedLauncher(command, options.secretEnv);
55251
55323
  if (newLauncher) {
55252
55324
  try {
55253
55325
  const result = await spawnWithLauncher(newLauncher, {
55254
55326
  cwd: options.cwd,
55255
- env: options.env,
55327
+ env: env3,
55256
55328
  timeoutMs: options.timeout,
55257
55329
  signal: options.signal,
55258
55330
  onOutput: options.onOutput
@@ -55267,7 +55339,9 @@ async function spawnCommand(command, options) {
55267
55339
  }
55268
55340
  }
55269
55341
  }
55270
- const launchers = buildShellLaunchers(command);
55342
+ const launchers = buildShellLaunchers(command, {
55343
+ powershellEnvAliases: options.secretEnv ? Object.keys(options.secretEnv) : undefined
55344
+ });
55271
55345
  if (launchers.length === 0) {
55272
55346
  throw new Error("No shell launchers available");
55273
55347
  }
@@ -55277,7 +55351,7 @@ async function spawnCommand(command, options) {
55277
55351
  try {
55278
55352
  const result = await spawnWithLauncher(launcher, {
55279
55353
  cwd: options.cwd,
55280
- env: options.env,
55354
+ env: env3,
55281
55355
  timeoutMs: options.timeout,
55282
55356
  signal: options.signal,
55283
55357
  onOutput: options.onOutput
@@ -55306,7 +55380,8 @@ async function bash(args) {
55306
55380
  description: _description,
55307
55381
  run_in_background = false,
55308
55382
  signal,
55309
- onOutput
55383
+ onOutput,
55384
+ secretEnv
55310
55385
  } = args;
55311
55386
  const userCwd = getCurrentWorkingDirectory();
55312
55387
  const worktreeError = validateWorktreePath(command, userCwd);
@@ -55351,7 +55426,7 @@ async function bash(args) {
55351
55426
  }
55352
55427
  const bashId = getNextBashId();
55353
55428
  const outputFile = createBackgroundOutputFile(bashId);
55354
- const launcher = getBackgroundLauncher(command);
55429
+ const launcher = getBackgroundLauncher(command, secretEnv);
55355
55430
  const [executable, ...launcherArgs] = launcher;
55356
55431
  if (!executable) {
55357
55432
  return {
@@ -55362,7 +55437,7 @@ async function bash(args) {
55362
55437
  const childProcess = spawn4(executable, launcherArgs, {
55363
55438
  shell: false,
55364
55439
  cwd: userCwd,
55365
- env: getShellEnv()
55440
+ env: secretEnv ? { ...getShellEnv(), ...secretEnv } : getShellEnv()
55366
55441
  });
55367
55442
  backgroundProcesses.set(bashId, {
55368
55443
  process: childProcess,
@@ -55439,7 +55514,8 @@ Output file: ${outputFile}`
55439
55514
  env: getShellEnv(),
55440
55515
  timeout: effectiveTimeout,
55441
55516
  signal,
55442
- onOutput
55517
+ onOutput,
55518
+ secretEnv
55443
55519
  });
55444
55520
  let output = stdout;
55445
55521
  if (stderr)
@@ -71566,7 +71642,15 @@ async function runProcess(context3) {
71566
71642
  }
71567
71643
  async function shell(args) {
71568
71644
  validateRequiredParams(args, ["command"], "shell");
71569
- const { command, workdir, timeout_ms, env_overrides, signal, onOutput } = args;
71645
+ const {
71646
+ command,
71647
+ workdir,
71648
+ timeout_ms,
71649
+ env_overrides,
71650
+ secretEnv,
71651
+ signal,
71652
+ onOutput
71653
+ } = args;
71570
71654
  if (!Array.isArray(command) || command.length === 0) {
71571
71655
  throw new Error("command must be a non-empty array of strings");
71572
71656
  }
@@ -71577,7 +71661,8 @@ async function shell(args) {
71577
71661
  cwd: cwd2,
71578
71662
  env: {
71579
71663
  ...getShellEnv(),
71580
- ...env_overrides ?? {}
71664
+ ...env_overrides ?? {},
71665
+ ...secretEnv ?? {}
71581
71666
  },
71582
71667
  timeout,
71583
71668
  signal,
@@ -71709,11 +71794,18 @@ async function shell_command(args) {
71709
71794
  timeout_ms,
71710
71795
  justification,
71711
71796
  signal,
71712
- onOutput
71797
+ onOutput,
71798
+ secretEnv
71713
71799
  } = args;
71714
- const envOverrides = getMemoryGitIdentityEnvOverrides(command, workdir);
71800
+ const envOverrides = {
71801
+ ...getMemoryGitIdentityEnvOverrides(command, workdir),
71802
+ ...secretEnv ?? {}
71803
+ };
71715
71804
  const resolvedWorkdir = resolveShellWorkdir(workdir);
71716
- const launchers = buildShellLaunchers(command, { login });
71805
+ const launchers = buildShellLaunchers(command, {
71806
+ login,
71807
+ powershellEnvAliases: secretEnv ? Object.keys(secretEnv) : undefined
71808
+ });
71717
71809
  if (launchers.length === 0) {
71718
71810
  throw new Error("Command must be a non-empty string");
71719
71811
  }
@@ -71843,7 +71935,8 @@ async function run_shell_command(args) {
71843
71935
  workdir: args.dir_path,
71844
71936
  timeout_ms: args.timeout_ms,
71845
71937
  signal: args.signal,
71846
- onOutput: args.onOutput
71938
+ onOutput: args.onOutput,
71939
+ secretEnv: args.secretEnv
71847
71940
  });
71848
71941
  const message = result.output.trim() || "(Command completed with no output)";
71849
71942
  return { message };
@@ -77995,9 +78088,9 @@ function detectSkillScript(command, workingDir) {
77995
78088
  }
77996
78089
  const normalizedWorkingDir = normalizePathSeparators(workingDir).replace(/\/$/, "");
77997
78090
  const normalizedHomeDir = normalizePathSeparators(homedir18()).replace(/\/$/, "");
77998
- const detect = (source, regex2) => {
78091
+ const detect = (source, regex4) => {
77999
78092
  for (const candidate of pathCandidates) {
78000
- const match3 = candidate.match(regex2);
78093
+ const match3 = candidate.match(regex4);
78001
78094
  if (!match3?.[1]) {
78002
78095
  continue;
78003
78096
  }
@@ -78966,11 +79059,15 @@ async function executeTool(name, args, options) {
78966
79059
  enhancedArgs = {
78967
79060
  ...enhancedArgs,
78968
79061
  onOutput: (chunk, stream2) => {
78969
- options.onOutput?.(scrubSecretsFromString(chunk), stream2);
79062
+ options.onOutput?.(stripAnsi3(scrubSecretsFromString(chunk, scopedAgentId)), stream2);
78970
79063
  }
78971
79064
  };
78972
79065
  }
78973
- enhancedArgs = substituteSecretsInArgs(enhancedArgs);
79066
+ const command = enhancedArgs.command;
79067
+ const secretEnv = typeof command === "string" || Array.isArray(command) && command.every((part) => typeof part === "string") ? extractSecretEnvFromCommand(command, scopedAgentId) : {};
79068
+ if (Object.keys(secretEnv).length > 0) {
79069
+ enhancedArgs = { ...enhancedArgs, secretEnv };
79070
+ }
78974
79071
  }
78975
79072
  if (internalName === "Task") {
78976
79073
  if (options?.toolCallId) {
@@ -79025,16 +79122,17 @@ async function executeTool(name, args, options) {
79025
79122
  const toolStatus = recordResult?.status === "error" ? "error" : "success";
79026
79123
  let flattenedResponse = flattenToolResponse(result);
79027
79124
  if (STREAMING_SHELL_TOOLS.has(internalName)) {
79125
+ const sanitize = (text) => stripAnsi3(scrubSecretsFromString(text, scopedAgentId));
79028
79126
  if (typeof flattenedResponse === "string") {
79029
- flattenedResponse = scrubSecretsFromString(flattenedResponse);
79127
+ flattenedResponse = sanitize(flattenedResponse);
79030
79128
  } else if (Array.isArray(flattenedResponse)) {
79031
- flattenedResponse = flattenedResponse.map((block) => block.type === "text" ? { ...block, text: scrubSecretsFromString(block.text) } : block);
79129
+ flattenedResponse = flattenedResponse.map((block) => block.type === "text" ? { ...block, text: sanitize(block.text) } : block);
79032
79130
  }
79033
79131
  if (stdout) {
79034
79132
  for (let i = 0;i < stdout.length; i++) {
79035
79133
  const line = stdout[i];
79036
79134
  if (line !== undefined) {
79037
- stdout[i] = scrubSecretsFromString(line);
79135
+ stdout[i] = sanitize(line);
79038
79136
  }
79039
79137
  }
79040
79138
  }
@@ -79042,7 +79140,7 @@ async function executeTool(name, args, options) {
79042
79140
  for (let i = 0;i < stderr.length; i++) {
79043
79141
  const line = stderr[i];
79044
79142
  if (line !== undefined) {
79045
- stderr[i] = scrubSecretsFromString(line);
79143
+ stderr[i] = sanitize(line);
79046
79144
  }
79047
79145
  }
79048
79146
  }
@@ -79180,6 +79278,7 @@ function clearToolsWithLock() {
79180
79278
  }
79181
79279
  var TOOL_NAMES, STREAMING_SHELL_TOOLS, FILE_MUTATING_TOOLS, TOOL_NAME_MAPPINGS, ANTHROPIC_DEFAULT_TOOLS, OPENAI_DEFAULT_TOOLS, GEMINI_DEFAULT_TOOLS, OPENAI_PASCAL_TOOLS, GEMINI_PASCAL_TOOLS, REGISTRY_KEY, SWITCH_LOCK_KEY, EXECUTION_CONTEXTS_KEY, toolRegistry, toolExecutionContextCounter = 0, EXTERNAL_TOOLS_KEY, EXTERNAL_EXECUTOR_KEY;
79182
79280
  var init_manager4 = __esm(async () => {
79281
+ init_strip_ansi3();
79183
79282
  init_context();
79184
79283
  init_model2();
79185
79284
  init_subagents();
@@ -90363,6 +90462,46 @@ var init_approval_suggestions = __esm(async () => {
90363
90462
  ]);
90364
90463
  });
90365
90464
 
90465
+ // src/websocket/listener/secrets-sync.ts
90466
+ var exports_secrets_sync = {};
90467
+ __export(exports_secrets_sync, {
90468
+ ensureSecretsHydratedForAgent: () => ensureSecretsHydratedForAgent,
90469
+ __testOverrideRefreshSecretsForAgent: () => __testOverrideRefreshSecretsForAgent
90470
+ });
90471
+ function __testOverrideRefreshSecretsForAgent(factory) {
90472
+ _testRefreshSecretsForAgentOverride = factory;
90473
+ }
90474
+ async function refreshSecretsForAgent(agentId) {
90475
+ if (_testRefreshSecretsForAgentOverride) {
90476
+ await _testRefreshSecretsForAgentOverride(agentId);
90477
+ debugLog("secrets-sync", `Refreshed secrets for agent ${agentId}`);
90478
+ return;
90479
+ }
90480
+ const { initSecretsFromServer: initSecretsFromServer2 } = await Promise.resolve().then(() => (init_secretsStore(), exports_secretsStore));
90481
+ await initSecretsFromServer2(agentId);
90482
+ debugLog("secrets-sync", `Refreshed secrets for agent ${agentId}`);
90483
+ }
90484
+ async function ensureSecretsHydratedForAgent(listener, agentId) {
90485
+ const existing = listener.secretsHydrationByAgent.get(agentId);
90486
+ if (existing) {
90487
+ await existing;
90488
+ return;
90489
+ }
90490
+ const promise = refreshSecretsForAgent(agentId).catch((err) => {
90491
+ debugWarn("secrets-sync", `Failed to refresh secrets for agent ${agentId}: ${err instanceof Error ? err.message : String(err)}`);
90492
+ }).finally(() => {
90493
+ if (listener.secretsHydrationByAgent.get(agentId) === promise) {
90494
+ listener.secretsHydrationByAgent.delete(agentId);
90495
+ }
90496
+ });
90497
+ listener.secretsHydrationByAgent.set(agentId, promise);
90498
+ await promise;
90499
+ }
90500
+ var _testRefreshSecretsForAgentOverride = null;
90501
+ var init_secrets_sync = __esm(() => {
90502
+ init_debug();
90503
+ });
90504
+
90366
90505
  // src/websocket/listener/recovery.ts
90367
90506
  function isApprovalToolCallDesyncError(detail) {
90368
90507
  if (isInvalidToolCallIdsError(detail) || isApprovalPendingError(detail)) {
@@ -90703,6 +90842,7 @@ async function resolveRecoveredApprovalResponse(runtime, socket, response, proce
90703
90842
  });
90704
90843
  const recoveryAbortController = new AbortController;
90705
90844
  runtime.activeAbortController = recoveryAbortController;
90845
+ await ensureSecretsHydratedForAgent(runtime.listener, recovered.agentId);
90706
90846
  const preparedToolContext = await prepareToolExecutionContextForScope({
90707
90847
  agentId: recovered.agentId,
90708
90848
  conversationId: recovered.conversationId,
@@ -90787,6 +90927,7 @@ var init_recovery = __esm(async () => {
90787
90927
  init_cwd();
90788
90928
  init_permissionMode();
90789
90929
  init_runtime4();
90930
+ init_secrets_sync();
90790
90931
  await __promiseAll([
90791
90932
  init_approval_execution(),
90792
90933
  init_accumulator(),
@@ -91678,8 +91819,8 @@ var init_word = __esm(() => {
91678
91819
  wordDiff = new WordDiff;
91679
91820
  WordsWithSpaceDiff = class WordsWithSpaceDiff extends Diff {
91680
91821
  tokenize(value) {
91681
- const regex2 = new RegExp(`(\\r?\\n)|[${extendedWordChars}]+|[^\\S\\n\\r]+|[^${extendedWordChars}]`, "ug");
91682
- return value.match(regex2) || [];
91822
+ const regex4 = new RegExp(`(\\r?\\n)|[${extendedWordChars}]+|[^\\S\\n\\r]+|[^${extendedWordChars}]`, "ug");
91823
+ return value.match(regex4) || [];
91683
91824
  }
91684
91825
  };
91685
91826
  wordsWithSpaceDiff = new WordsWithSpaceDiff;
@@ -93559,6 +93700,9 @@ async function handleApprovalStop(params) {
93559
93700
  };
93560
93701
  let executionResults;
93561
93702
  try {
93703
+ if (agentId) {
93704
+ await ensureSecretsHydratedForAgent(runtime.listener, agentId);
93705
+ }
93562
93706
  executionResults = await executeApprovalBatch(decisions, undefined, {
93563
93707
  toolContextId: turnToolContextId ?? undefined,
93564
93708
  abortSignal: abortController.signal,
@@ -93672,6 +93816,7 @@ var init_turn_approval = __esm(async () => {
93672
93816
  init_diffPreview();
93673
93817
  init_formatDenial();
93674
93818
  init_interactivePolicy();
93819
+ init_secrets_sync();
93675
93820
  init_skill_injection();
93676
93821
  init_transport();
93677
93822
  await __promiseAll([
@@ -93912,8 +94057,11 @@ async function handleIncomingMessage(msg, socket, runtime, onStatusChange, conne
93912
94057
  });
93913
94058
  return;
93914
94059
  }
93915
- const { ensureMemfsSyncedForAgent: ensureMemfsSyncedForAgent2 } = await Promise.resolve().then(() => (init_memfs_sync(), exports_memfs_sync));
93916
- await ensureMemfsSyncedForAgent2(runtime.listener, agentId);
94060
+ const [{ ensureMemfsSyncedForAgent: ensureMemfsSyncedForAgent2 }, { ensureSecretsHydratedForAgent: ensureSecretsHydratedForAgent2 }] = await Promise.all([Promise.resolve().then(() => (init_memfs_sync(), exports_memfs_sync)), Promise.resolve().then(() => (init_secrets_sync(), exports_secrets_sync))]);
94061
+ await Promise.all([
94062
+ ensureMemfsSyncedForAgent2(runtime.listener, agentId),
94063
+ ensureSecretsHydratedForAgent2(runtime.listener, agentId)
94064
+ ]);
93917
94065
  setCurrentAgentId(agentId);
93918
94066
  setConversationId2(conversationId);
93919
94067
  if (isDebugEnabled()) {
@@ -99276,6 +99424,7 @@ function createRuntime() {
99276
99424
  conversationRuntimes: new Map,
99277
99425
  approvalRuntimeKeyByRequestId: new Map,
99278
99426
  memfsSyncedAgents: new Map,
99427
+ secretsHydrationByAgent: new Map,
99279
99428
  lastEmittedStatus: null
99280
99429
  };
99281
99430
  }
@@ -100729,6 +100878,12 @@ function createLegacyTestRuntime() {
100729
100878
  listener.memfsSyncedAgents = value;
100730
100879
  }
100731
100880
  },
100881
+ secretsHydrationByAgent: {
100882
+ get: () => listener.secretsHydrationByAgent,
100883
+ set: (value) => {
100884
+ listener.secretsHydrationByAgent = value;
100885
+ }
100886
+ },
100732
100887
  worktreeWatcherByConversation: {
100733
100888
  get: () => listener.worktreeWatcherByConversation,
100734
100889
  set: (value) => {
@@ -107847,12 +108002,12 @@ var init_AgentSelector = __esm(async () => {
107847
108002
 
107848
108003
  // node_modules/highlight.js/es/languages/arduino.js
107849
108004
  function cPlusPlus(hljs) {
107850
- const regex2 = hljs.regex;
108005
+ const regex4 = hljs.regex;
107851
108006
  const C_LINE_COMMENT_MODE = hljs.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] });
107852
108007
  const DECLTYPE_AUTO_RE = "decltype\\(auto\\)";
107853
108008
  const NAMESPACE_RE = "[a-zA-Z_]\\w*::";
107854
108009
  const TEMPLATE_ARGUMENT_RE = "<[^<>]+>";
107855
- const FUNCTION_TYPE_RE = "(?!struct)(" + DECLTYPE_AUTO_RE + "|" + regex2.optional(NAMESPACE_RE) + "[a-zA-Z_]\\w*" + regex2.optional(TEMPLATE_ARGUMENT_RE) + ")";
108010
+ const FUNCTION_TYPE_RE = "(?!struct)(" + DECLTYPE_AUTO_RE + "|" + regex4.optional(NAMESPACE_RE) + "[a-zA-Z_]\\w*" + regex4.optional(TEMPLATE_ARGUMENT_RE) + ")";
107856
108011
  const CPP_PRIMITIVE_TYPES = {
107857
108012
  className: "type",
107858
108013
  begin: "\\b[a-z\\d_]*_t\\b"
@@ -107911,10 +108066,10 @@ function cPlusPlus(hljs) {
107911
108066
  };
107912
108067
  const TITLE_MODE = {
107913
108068
  className: "title",
107914
- begin: regex2.optional(NAMESPACE_RE) + hljs.IDENT_RE,
108069
+ begin: regex4.optional(NAMESPACE_RE) + hljs.IDENT_RE,
107915
108070
  relevance: 0
107916
108071
  };
107917
- const FUNCTION_TITLE = regex2.optional(NAMESPACE_RE) + hljs.IDENT_RE + "\\s*\\(";
108072
+ const FUNCTION_TITLE = regex4.optional(NAMESPACE_RE) + hljs.IDENT_RE + "\\s*\\(";
107918
108073
  const RESERVED_KEYWORDS = [
107919
108074
  "alignas",
107920
108075
  "alignof",
@@ -108204,7 +108359,7 @@ function cPlusPlus(hljs) {
108204
108359
  keywords: {
108205
108360
  _hint: FUNCTION_HINTS
108206
108361
  },
108207
- begin: regex2.concat(/\b/, /(?!decltype)/, /(?!if)/, /(?!for)/, /(?!switch)/, /(?!while)/, hljs.IDENT_RE, regex2.lookahead(/(<[^<>]+>|)\s*\(/))
108362
+ begin: regex4.concat(/\b/, /(?!decltype)/, /(?!if)/, /(?!for)/, /(?!switch)/, /(?!while)/, hljs.IDENT_RE, regex4.lookahead(/(<[^<>]+>|)\s*\(/))
108208
108363
  };
108209
108364
  const EXPRESSION_CONTAINS = [
108210
108365
  FUNCTION_DISPATCH,
@@ -108746,7 +108901,7 @@ var init_arduino = () => {};
108746
108901
 
108747
108902
  // node_modules/highlight.js/es/languages/bash.js
108748
108903
  function bash2(hljs) {
108749
- const regex2 = hljs.regex;
108904
+ const regex4 = hljs.regex;
108750
108905
  const VAR = {};
108751
108906
  const BRACED_VAR = {
108752
108907
  begin: /\$\{/,
@@ -108762,7 +108917,7 @@ function bash2(hljs) {
108762
108917
  Object.assign(VAR, {
108763
108918
  className: "variable",
108764
108919
  variants: [
108765
- { begin: regex2.concat(/\$[\w\d#@][\w\d_]*/, `(?![\\w\\d])(?![$])`) },
108920
+ { begin: regex4.concat(/\$[\w\d#@][\w\d_]*/, `(?![\\w\\d])(?![$])`) },
108766
108921
  BRACED_VAR
108767
108922
  ]
108768
108923
  });
@@ -109127,12 +109282,12 @@ var init_bash = () => {};
109127
109282
 
109128
109283
  // node_modules/highlight.js/es/languages/c.js
109129
109284
  function c(hljs) {
109130
- const regex2 = hljs.regex;
109285
+ const regex4 = hljs.regex;
109131
109286
  const C_LINE_COMMENT_MODE = hljs.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] });
109132
109287
  const DECLTYPE_AUTO_RE = "decltype\\(auto\\)";
109133
109288
  const NAMESPACE_RE = "[a-zA-Z_]\\w*::";
109134
109289
  const TEMPLATE_ARGUMENT_RE = "<[^<>]+>";
109135
- const FUNCTION_TYPE_RE = "(" + DECLTYPE_AUTO_RE + "|" + regex2.optional(NAMESPACE_RE) + "[a-zA-Z_]\\w*" + regex2.optional(TEMPLATE_ARGUMENT_RE) + ")";
109290
+ const FUNCTION_TYPE_RE = "(" + DECLTYPE_AUTO_RE + "|" + regex4.optional(NAMESPACE_RE) + "[a-zA-Z_]\\w*" + regex4.optional(TEMPLATE_ARGUMENT_RE) + ")";
109136
109291
  const TYPES = {
109137
109292
  className: "type",
109138
109293
  variants: [
@@ -109192,10 +109347,10 @@ function c(hljs) {
109192
109347
  };
109193
109348
  const TITLE_MODE = {
109194
109349
  className: "title",
109195
- begin: regex2.optional(NAMESPACE_RE) + hljs.IDENT_RE,
109350
+ begin: regex4.optional(NAMESPACE_RE) + hljs.IDENT_RE,
109196
109351
  relevance: 0
109197
109352
  };
109198
- const FUNCTION_TITLE = regex2.optional(NAMESPACE_RE) + hljs.IDENT_RE + "\\s*\\(";
109353
+ const FUNCTION_TITLE = regex4.optional(NAMESPACE_RE) + hljs.IDENT_RE + "\\s*\\(";
109199
109354
  const C_KEYWORDS = [
109200
109355
  "asm",
109201
109356
  "auto",
@@ -109403,12 +109558,12 @@ var init_c = () => {};
109403
109558
 
109404
109559
  // node_modules/highlight.js/es/languages/cpp.js
109405
109560
  function cpp(hljs) {
109406
- const regex2 = hljs.regex;
109561
+ const regex4 = hljs.regex;
109407
109562
  const C_LINE_COMMENT_MODE = hljs.COMMENT("//", "$", { contains: [{ begin: /\\\n/ }] });
109408
109563
  const DECLTYPE_AUTO_RE = "decltype\\(auto\\)";
109409
109564
  const NAMESPACE_RE = "[a-zA-Z_]\\w*::";
109410
109565
  const TEMPLATE_ARGUMENT_RE = "<[^<>]+>";
109411
- const FUNCTION_TYPE_RE = "(?!struct)(" + DECLTYPE_AUTO_RE + "|" + regex2.optional(NAMESPACE_RE) + "[a-zA-Z_]\\w*" + regex2.optional(TEMPLATE_ARGUMENT_RE) + ")";
109566
+ const FUNCTION_TYPE_RE = "(?!struct)(" + DECLTYPE_AUTO_RE + "|" + regex4.optional(NAMESPACE_RE) + "[a-zA-Z_]\\w*" + regex4.optional(TEMPLATE_ARGUMENT_RE) + ")";
109412
109567
  const CPP_PRIMITIVE_TYPES = {
109413
109568
  className: "type",
109414
109569
  begin: "\\b[a-z\\d_]*_t\\b"
@@ -109467,10 +109622,10 @@ function cpp(hljs) {
109467
109622
  };
109468
109623
  const TITLE_MODE = {
109469
109624
  className: "title",
109470
- begin: regex2.optional(NAMESPACE_RE) + hljs.IDENT_RE,
109625
+ begin: regex4.optional(NAMESPACE_RE) + hljs.IDENT_RE,
109471
109626
  relevance: 0
109472
109627
  };
109473
- const FUNCTION_TITLE = regex2.optional(NAMESPACE_RE) + hljs.IDENT_RE + "\\s*\\(";
109628
+ const FUNCTION_TITLE = regex4.optional(NAMESPACE_RE) + hljs.IDENT_RE + "\\s*\\(";
109474
109629
  const RESERVED_KEYWORDS = [
109475
109630
  "alignas",
109476
109631
  "alignof",
@@ -109760,7 +109915,7 @@ function cpp(hljs) {
109760
109915
  keywords: {
109761
109916
  _hint: FUNCTION_HINTS
109762
109917
  },
109763
- begin: regex2.concat(/\b/, /(?!decltype)/, /(?!if)/, /(?!for)/, /(?!switch)/, /(?!while)/, hljs.IDENT_RE, regex2.lookahead(/(<[^<>]+>|)\s*\(/))
109918
+ begin: regex4.concat(/\b/, /(?!decltype)/, /(?!if)/, /(?!for)/, /(?!switch)/, /(?!while)/, hljs.IDENT_RE, regex4.lookahead(/(<[^<>]+>|)\s*\(/))
109764
109919
  };
109765
109920
  const EXPRESSION_CONTAINS = [
109766
109921
  FUNCTION_DISPATCH,
@@ -110306,7 +110461,7 @@ var init_csharp = () => {};
110306
110461
 
110307
110462
  // node_modules/highlight.js/es/languages/css.js
110308
110463
  function css(hljs) {
110309
- const regex2 = hljs.regex;
110464
+ const regex4 = hljs.regex;
110310
110465
  const modes = MODES(hljs);
110311
110466
  const VENDOR_PREFIX = { begin: /-(webkit|moz|ms|o)-(?=[a-z])/ };
110312
110467
  const AT_MODIFIERS = "and or not only";
@@ -110379,7 +110534,7 @@ function css(hljs) {
110379
110534
  ]
110380
110535
  },
110381
110536
  {
110382
- begin: regex2.lookahead(/@/),
110537
+ begin: regex4.lookahead(/@/),
110383
110538
  end: "[{;]",
110384
110539
  relevance: 0,
110385
110540
  illegal: /:/,
@@ -111211,7 +111366,7 @@ var init_css2 = __esm(() => {
111211
111366
 
111212
111367
  // node_modules/highlight.js/es/languages/diff.js
111213
111368
  function diff2(hljs) {
111214
- const regex2 = hljs.regex;
111369
+ const regex4 = hljs.regex;
111215
111370
  return {
111216
111371
  name: "Diff",
111217
111372
  aliases: ["patch"],
@@ -111219,13 +111374,13 @@ function diff2(hljs) {
111219
111374
  {
111220
111375
  className: "meta",
111221
111376
  relevance: 10,
111222
- match: regex2.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/, /^\*\*\* +\d+,\d+ +\*\*\*\*$/, /^--- +\d+,\d+ +----$/)
111377
+ match: regex4.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/, /^\*\*\* +\d+,\d+ +\*\*\*\*$/, /^--- +\d+,\d+ +----$/)
111223
111378
  },
111224
111379
  {
111225
111380
  className: "comment",
111226
111381
  variants: [
111227
111382
  {
111228
- begin: regex2.either(/Index: /, /^index/, /={3,}/, /^-{3}/, /^\*{3} /, /^\+{3}/, /^diff --git/),
111383
+ begin: regex4.either(/Index: /, /^index/, /={3,}/, /^-{3}/, /^\*{3} /, /^\+{3}/, /^diff --git/),
111229
111384
  end: /$/
111230
111385
  },
111231
111386
  { match: /^\*{15}$/ }
@@ -111402,7 +111557,7 @@ var init_go = () => {};
111402
111557
 
111403
111558
  // node_modules/highlight.js/es/languages/graphql.js
111404
111559
  function graphql(hljs) {
111405
- const regex2 = hljs.regex;
111560
+ const regex4 = hljs.regex;
111406
111561
  const GQL_NAME = /[_A-Za-z][_0-9A-Za-z]*/;
111407
111562
  return {
111408
111563
  name: "GraphQL",
@@ -111459,7 +111614,7 @@ function graphql(hljs) {
111459
111614
  },
111460
111615
  {
111461
111616
  scope: "symbol",
111462
- begin: regex2.concat(GQL_NAME, regex2.lookahead(/\s*:/)),
111617
+ begin: regex4.concat(GQL_NAME, regex4.lookahead(/\s*:/)),
111463
111618
  relevance: 0
111464
111619
  }
111465
111620
  ],
@@ -111473,7 +111628,7 @@ var init_graphql = () => {};
111473
111628
 
111474
111629
  // node_modules/highlight.js/es/languages/ini.js
111475
111630
  function ini(hljs) {
111476
- const regex2 = hljs.regex;
111631
+ const regex4 = hljs.regex;
111477
111632
  const NUMBERS = {
111478
111633
  className: "number",
111479
111634
  relevance: 0,
@@ -111544,8 +111699,8 @@ function ini(hljs) {
111544
111699
  const BARE_KEY = /[A-Za-z0-9_-]+/;
111545
111700
  const QUOTED_KEY_DOUBLE_QUOTE = /"(\\"|[^"])*"/;
111546
111701
  const QUOTED_KEY_SINGLE_QUOTE = /'[^']*'/;
111547
- const ANY_KEY = regex2.either(BARE_KEY, QUOTED_KEY_DOUBLE_QUOTE, QUOTED_KEY_SINGLE_QUOTE);
111548
- const DOTTED_KEY = regex2.concat(ANY_KEY, "(\\s*\\.\\s*", ANY_KEY, ")*", regex2.lookahead(/\s*=\s*[^#\s]/));
111702
+ const ANY_KEY = regex4.either(BARE_KEY, QUOTED_KEY_DOUBLE_QUOTE, QUOTED_KEY_SINGLE_QUOTE);
111703
+ const DOTTED_KEY = regex4.concat(ANY_KEY, "(\\s*\\.\\s*", ANY_KEY, ")*", regex4.lookahead(/\s*=\s*[^#\s]/));
111549
111704
  return {
111550
111705
  name: "TOML, also INI",
111551
111706
  aliases: ["toml"],
@@ -111587,7 +111742,7 @@ function recurRegex(re, substitution, depth) {
111587
111742
  });
111588
111743
  }
111589
111744
  function java(hljs) {
111590
- const regex2 = hljs.regex;
111745
+ const regex4 = hljs.regex;
111591
111746
  const JAVA_IDENT_RE = "[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*";
111592
111747
  const GENERIC_IDENT_RE = JAVA_IDENT_RE + recurRegex("(?:<" + JAVA_IDENT_RE + "~~~(?:\\s*,\\s*" + JAVA_IDENT_RE + "~~~)*>)?", /~~~/g, 2);
111593
111748
  const MAIN_KEYWORDS = [
@@ -111732,7 +111887,7 @@ function java(hljs) {
111732
111887
  },
111733
111888
  {
111734
111889
  begin: [
111735
- regex2.concat(/(?!else)/, JAVA_IDENT_RE),
111890
+ regex4.concat(/(?!else)/, JAVA_IDENT_RE),
111736
111891
  /\s+/,
111737
111892
  JAVA_IDENT_RE,
111738
111893
  /\s+/,
@@ -111818,7 +111973,7 @@ var init_java = __esm(() => {
111818
111973
 
111819
111974
  // node_modules/highlight.js/es/languages/javascript.js
111820
111975
  function javascript(hljs) {
111821
- const regex2 = hljs.regex;
111976
+ const regex4 = hljs.regex;
111822
111977
  const hasClosingTag = (match3, { after }) => {
111823
111978
  const tag = "</" + match3[0].slice(1);
111824
111979
  const pos = match3.input.indexOf(tag, after);
@@ -112024,7 +112179,7 @@ function javascript(hljs) {
112024
112179
  /\s+/,
112025
112180
  /extends/,
112026
112181
  /\s+/,
112027
- regex2.concat(IDENT_RE$1, "(", regex2.concat(/\./, IDENT_RE$1), ")*")
112182
+ regex4.concat(IDENT_RE$1, "(", regex4.concat(/\./, IDENT_RE$1), ")*")
112028
112183
  ],
112029
112184
  scope: {
112030
112185
  1: "keyword",
@@ -112048,7 +112203,7 @@ function javascript(hljs) {
112048
112203
  };
112049
112204
  const CLASS_REFERENCE = {
112050
112205
  relevance: 0,
112051
- match: regex2.either(/\bJSON/, /\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/, /\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/, /\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),
112206
+ match: regex4.either(/\bJSON/, /\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/, /\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/, /\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),
112052
112207
  className: "title.class",
112053
112208
  keywords: {
112054
112209
  _: [
@@ -112094,19 +112249,19 @@ function javascript(hljs) {
112094
112249
  className: "variable.constant"
112095
112250
  };
112096
112251
  function noneOf(list) {
112097
- return regex2.concat("(?!", list.join("|"), ")");
112252
+ return regex4.concat("(?!", list.join("|"), ")");
112098
112253
  }
112099
112254
  const FUNCTION_CALL = {
112100
- match: regex2.concat(/\b/, noneOf([
112255
+ match: regex4.concat(/\b/, noneOf([
112101
112256
  ...BUILT_IN_GLOBALS,
112102
112257
  "super",
112103
112258
  "import"
112104
- ].map((x) => `${x}\\s*\\(`)), IDENT_RE$1, regex2.lookahead(/\s*\(/)),
112259
+ ].map((x) => `${x}\\s*\\(`)), IDENT_RE$1, regex4.lookahead(/\s*\(/)),
112105
112260
  className: "title.function",
112106
112261
  relevance: 0
112107
112262
  };
112108
112263
  const PROPERTY_ACCESS = {
112109
- begin: regex2.concat(/\./, regex2.lookahead(regex2.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/))),
112264
+ begin: regex4.concat(/\./, regex4.lookahead(regex4.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/))),
112110
112265
  end: IDENT_RE$1,
112111
112266
  excludeBegin: true,
112112
112267
  keywords: "prototype",
@@ -112140,7 +112295,7 @@ function javascript(hljs) {
112140
112295
  /\s*/,
112141
112296
  /=\s*/,
112142
112297
  /(async\s*)?/,
112143
- regex2.lookahead(FUNC_LEAD_IN_RE)
112298
+ regex4.lookahead(FUNC_LEAD_IN_RE)
112144
112299
  ],
112145
112300
  keywords: "async",
112146
112301
  className: {
@@ -112176,7 +112331,7 @@ function javascript(hljs) {
112176
112331
  CLASS_REFERENCE,
112177
112332
  {
112178
112333
  scope: "attr",
112179
- match: IDENT_RE$1 + regex2.lookahead(":"),
112334
+ match: IDENT_RE$1 + regex4.lookahead(":"),
112180
112335
  relevance: 0
112181
112336
  },
112182
112337
  FUNCTION_VARIABLE,
@@ -113787,7 +113942,7 @@ var init_makefile = () => {};
113787
113942
 
113788
113943
  // node_modules/highlight.js/es/languages/markdown.js
113789
113944
  function markdown(hljs) {
113790
- const regex2 = hljs.regex;
113945
+ const regex4 = hljs.regex;
113791
113946
  const INLINE_HTML = {
113792
113947
  begin: /<\/?[A-Za-z_]/,
113793
113948
  end: ">",
@@ -113861,7 +114016,7 @@ function markdown(hljs) {
113861
114016
  relevance: 2
113862
114017
  },
113863
114018
  {
113864
- begin: regex2.concat(/\[.+?\]\(/, URL_SCHEME, /:\/\/.*?\)/),
114019
+ begin: regex4.concat(/\[.+?\]\(/, URL_SCHEME, /:\/\/.*?\)/),
113865
114020
  relevance: 2
113866
114021
  },
113867
114022
  {
@@ -114251,7 +114406,7 @@ var init_objectivec = () => {};
114251
114406
 
114252
114407
  // node_modules/highlight.js/es/languages/perl.js
114253
114408
  function perl(hljs) {
114254
- const regex2 = hljs.regex;
114409
+ const regex4 = hljs.regex;
114255
114410
  const KEYWORDS2 = [
114256
114411
  "abs",
114257
114412
  "accept",
@@ -114511,7 +114666,7 @@ function perl(hljs) {
114511
114666
  variants: [
114512
114667
  { begin: /\$\d/ },
114513
114668
  {
114514
- begin: regex2.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/, `(?![A-Za-z])(?![@$%])`)
114669
+ begin: regex4.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/, `(?![A-Za-z])(?![@$%])`)
114515
114670
  },
114516
114671
  {
114517
114672
  begin: /[$%@](?!")[^\s\w{=]|\$=/,
@@ -114546,11 +114701,11 @@ function perl(hljs) {
114546
114701
  /#/
114547
114702
  ];
114548
114703
  const PAIRED_DOUBLE_RE = (prefix, open2, close = "\\1") => {
114549
- const middle = close === "\\1" ? close : regex2.concat(close, open2);
114550
- return regex2.concat(regex2.concat("(?:", prefix, ")"), open2, /(?:\\.|[^\\\/])*?/, middle, /(?:\\.|[^\\\/])*?/, close, REGEX_MODIFIERS);
114704
+ const middle = close === "\\1" ? close : regex4.concat(close, open2);
114705
+ return regex4.concat(regex4.concat("(?:", prefix, ")"), open2, /(?:\\.|[^\\\/])*?/, middle, /(?:\\.|[^\\\/])*?/, close, REGEX_MODIFIERS);
114551
114706
  };
114552
114707
  const PAIRED_RE = (prefix, open2, close) => {
114553
- return regex2.concat(regex2.concat("(?:", prefix, ")"), open2, /(?:\\.|[^\\\/])*?/, close, REGEX_MODIFIERS);
114708
+ return regex4.concat(regex4.concat("(?:", prefix, ")"), open2, /(?:\\.|[^\\\/])*?/, close, REGEX_MODIFIERS);
114554
114709
  };
114555
114710
  const PERL_DEFAULT_CONTAINS = [
114556
114711
  VAR,
@@ -114625,7 +114780,7 @@ function perl(hljs) {
114625
114780
  {
114626
114781
  className: "regexp",
114627
114782
  variants: [
114628
- { begin: PAIRED_DOUBLE_RE("s|tr|y", regex2.either(...REGEX_DELIMS, { capture: true })) },
114783
+ { begin: PAIRED_DOUBLE_RE("s|tr|y", regex4.either(...REGEX_DELIMS, { capture: true })) },
114629
114784
  { begin: PAIRED_DOUBLE_RE("s|tr|y", "\\(", "\\)") },
114630
114785
  { begin: PAIRED_DOUBLE_RE("s|tr|y", "\\[", "\\]") },
114631
114786
  { begin: PAIRED_DOUBLE_RE("s|tr|y", "\\{", "\\}") }
@@ -114640,7 +114795,7 @@ function perl(hljs) {
114640
114795
  relevance: 0
114641
114796
  },
114642
114797
  { begin: PAIRED_RE("(?:m|qr)?", /\//, /\//) },
114643
- { begin: PAIRED_RE("m|qr", regex2.either(...REGEX_DELIMS, { capture: true }), /\1/) },
114798
+ { begin: PAIRED_RE("m|qr", regex4.either(...REGEX_DELIMS, { capture: true }), /\1/) },
114644
114799
  { begin: PAIRED_RE("m|qr", /\(/, /\)/) },
114645
114800
  { begin: PAIRED_RE("m|qr", /\[/, /\]/) },
114646
114801
  { begin: PAIRED_RE("m|qr", /\{/, /\}/) }
@@ -114697,11 +114852,11 @@ var init_perl = () => {};
114697
114852
 
114698
114853
  // node_modules/highlight.js/es/languages/php.js
114699
114854
  function php(hljs) {
114700
- const regex2 = hljs.regex;
114855
+ const regex4 = hljs.regex;
114701
114856
  const NOT_PERL_ETC = /(?![A-Za-z0-9])(?![$])/;
114702
- const IDENT_RE2 = regex2.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/, NOT_PERL_ETC);
114703
- const PASCAL_CASE_CLASS_NAME_RE = regex2.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/, NOT_PERL_ETC);
114704
- const UPCASE_NAME_RE = regex2.concat(/[A-Z]+/, NOT_PERL_ETC);
114857
+ const IDENT_RE2 = regex4.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/, NOT_PERL_ETC);
114858
+ const PASCAL_CASE_CLASS_NAME_RE = regex4.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/, NOT_PERL_ETC);
114859
+ const UPCASE_NAME_RE = regex4.concat(/[A-Z]+/, NOT_PERL_ETC);
114705
114860
  const VARIABLE = {
114706
114861
  scope: "variable",
114707
114862
  match: "\\$+" + IDENT_RE2
@@ -114980,8 +115135,8 @@ function php(hljs) {
114980
115135
  {
114981
115136
  match: [
114982
115137
  /new/,
114983
- regex2.concat(WHITESPACE, "+"),
114984
- regex2.concat("(?!", normalizeKeywords(BUILT_INS2).join("\\b|"), "\\b)"),
115138
+ regex4.concat(WHITESPACE, "+"),
115139
+ regex4.concat("(?!", normalizeKeywords(BUILT_INS2).join("\\b|"), "\\b)"),
114985
115140
  PASCAL_CASE_CLASS_NAME_RE
114986
115141
  ],
114987
115142
  scope: {
@@ -114990,11 +115145,11 @@ function php(hljs) {
114990
115145
  }
114991
115146
  }
114992
115147
  ] };
114993
- const CONSTANT_REFERENCE = regex2.concat(IDENT_RE2, "\\b(?!\\()");
115148
+ const CONSTANT_REFERENCE = regex4.concat(IDENT_RE2, "\\b(?!\\()");
114994
115149
  const LEFT_AND_RIGHT_SIDE_OF_DOUBLE_COLON = { variants: [
114995
115150
  {
114996
115151
  match: [
114997
- regex2.concat(/::/, regex2.lookahead(/(?!class\b)/)),
115152
+ regex4.concat(/::/, regex4.lookahead(/(?!class\b)/)),
114998
115153
  CONSTANT_REFERENCE
114999
115154
  ],
115000
115155
  scope: { 2: "variable.constant" }
@@ -115009,7 +115164,7 @@ function php(hljs) {
115009
115164
  {
115010
115165
  match: [
115011
115166
  PASCAL_CASE_CLASS_NAME_RE,
115012
- regex2.concat(/::/, regex2.lookahead(/(?!class\b)/)),
115167
+ regex4.concat(/::/, regex4.lookahead(/(?!class\b)/)),
115013
115168
  CONSTANT_REFERENCE
115014
115169
  ],
115015
115170
  scope: {
@@ -115020,7 +115175,7 @@ function php(hljs) {
115020
115175
  {
115021
115176
  match: [
115022
115177
  PASCAL_CASE_CLASS_NAME_RE,
115023
- regex2.concat("::", regex2.lookahead(/(?!class\b)/))
115178
+ regex4.concat("::", regex4.lookahead(/(?!class\b)/))
115024
115179
  ],
115025
115180
  scope: { 1: "title.class" }
115026
115181
  },
@@ -115038,7 +115193,7 @@ function php(hljs) {
115038
115193
  ] };
115039
115194
  const NAMED_ARGUMENT = {
115040
115195
  scope: "attr",
115041
- match: regex2.concat(IDENT_RE2, regex2.lookahead(":"), regex2.lookahead(/(?!::)/))
115196
+ match: regex4.concat(IDENT_RE2, regex4.lookahead(":"), regex4.lookahead(/(?!::)/))
115042
115197
  };
115043
115198
  const PARAMS_MODE = {
115044
115199
  relevance: 0,
@@ -115059,10 +115214,10 @@ function php(hljs) {
115059
115214
  relevance: 0,
115060
115215
  match: [
115061
115216
  /\b/,
115062
- regex2.concat("(?!fn\\b|function\\b|", normalizeKeywords(KWS).join("\\b|"), "|", normalizeKeywords(BUILT_INS2).join("\\b|"), "\\b)"),
115217
+ regex4.concat("(?!fn\\b|function\\b|", normalizeKeywords(KWS).join("\\b|"), "|", normalizeKeywords(BUILT_INS2).join("\\b|"), "\\b)"),
115063
115218
  IDENT_RE2,
115064
- regex2.concat(WHITESPACE, "*"),
115065
- regex2.lookahead(/(?=\()/)
115219
+ regex4.concat(WHITESPACE, "*"),
115220
+ regex4.lookahead(/(?=\()/)
115066
115221
  ],
115067
115222
  scope: { 3: "title.function.invoke" },
115068
115223
  contains: [PARAMS_MODE]
@@ -115077,7 +115232,7 @@ function php(hljs) {
115077
115232
  CONSTRUCTOR_CALL
115078
115233
  ];
115079
115234
  const ATTRIBUTES3 = {
115080
- begin: regex2.concat(/#\[\s*\\?/, regex2.either(PASCAL_CASE_CLASS_NAME_RE, UPCASE_NAME_RE)),
115235
+ begin: regex4.concat(/#\[\s*\\?/, regex4.either(PASCAL_CASE_CLASS_NAME_RE, UPCASE_NAME_RE)),
115081
115236
  beginScope: "meta",
115082
115237
  end: /]/,
115083
115238
  endScope: "meta",
@@ -115301,7 +115456,7 @@ var init_plaintext = () => {};
115301
115456
 
115302
115457
  // node_modules/highlight.js/es/languages/python.js
115303
115458
  function python(hljs) {
115304
- const regex2 = hljs.regex;
115459
+ const regex4 = hljs.regex;
115305
115460
  const IDENT_RE2 = /[\p{XID_Start}_]\p{XID_Continue}*/u;
115306
115461
  const RESERVED_WORDS = [
115307
115462
  "and",
@@ -115569,7 +115724,7 @@ function python(hljs) {
115569
115724
  };
115570
115725
  const COMMENT_TYPE = {
115571
115726
  className: "comment",
115572
- begin: regex2.lookahead(/# type:/),
115727
+ begin: regex4.lookahead(/# type:/),
115573
115728
  end: /$/,
115574
115729
  keywords: KEYWORDS2,
115575
115730
  contains: [
@@ -115717,11 +115872,11 @@ var init_python_repl = () => {};
115717
115872
 
115718
115873
  // node_modules/highlight.js/es/languages/r.js
115719
115874
  function r(hljs) {
115720
- const regex2 = hljs.regex;
115875
+ const regex4 = hljs.regex;
115721
115876
  const IDENT_RE2 = /(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/;
115722
- const NUMBER_TYPES_RE = regex2.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/, /0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/, /(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/);
115877
+ const NUMBER_TYPES_RE = regex4.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/, /0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/, /(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/);
115723
115878
  const OPERATORS_RE = /[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/;
115724
- const PUNCTUATION_RE = regex2.either(/[()]/, /[{}]/, /\[\[/, /[[\]]/, /\\/, /,/);
115879
+ const PUNCTUATION_RE = regex4.either(/[()]/, /[{}]/, /\[\[/, /[[\]]/, /\\/, /,/);
115725
115880
  return {
115726
115881
  name: "R",
115727
115882
  keywords: {
@@ -115736,7 +115891,7 @@ function r(hljs) {
115736
115891
  scope: "doctag",
115737
115892
  match: /@examples/,
115738
115893
  starts: {
115739
- end: regex2.lookahead(regex2.either(/\n^#'\s*(?=@[a-zA-Z]+)/, /\n^(?!#')/)),
115894
+ end: regex4.lookahead(regex4.either(/\n^#'\s*(?=@[a-zA-Z]+)/, /\n^(?!#')/)),
115740
115895
  endsParent: true
115741
115896
  }
115742
115897
  },
@@ -115881,10 +116036,10 @@ var init_r = () => {};
115881
116036
 
115882
116037
  // node_modules/highlight.js/es/languages/ruby.js
115883
116038
  function ruby(hljs) {
115884
- const regex2 = hljs.regex;
116039
+ const regex4 = hljs.regex;
115885
116040
  const RUBY_METHOD_RE = "([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)";
115886
- const CLASS_NAME_RE = regex2.either(/\b([A-Z]+[a-z0-9]+)+/, /\b([A-Z]+[a-z0-9]+)+[A-Z]+/);
115887
- const CLASS_NAME_WITH_NAMESPACE_RE = regex2.concat(CLASS_NAME_RE, /(::\w+)*/);
116041
+ const CLASS_NAME_RE = regex4.either(/\b([A-Z]+[a-z0-9]+)+/, /\b([A-Z]+[a-z0-9]+)+[A-Z]+/);
116042
+ const CLASS_NAME_WITH_NAMESPACE_RE = regex4.concat(CLASS_NAME_RE, /(::\w+)*/);
115888
116043
  const PSEUDO_KWS = [
115889
116044
  "include",
115890
116045
  "extend",
@@ -116037,7 +116192,7 @@ function ruby(hljs) {
116037
116192
  { begin: /\B\?\\(c|C-)[\x20-\x7e]/ },
116038
116193
  { begin: /\B\?\\?\S/ },
116039
116194
  {
116040
- begin: regex2.concat(/<<[-~]?'?/, regex2.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),
116195
+ begin: regex4.concat(/<<[-~]?'?/, regex4.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),
116041
116196
  contains: [
116042
116197
  hljs.END_SAME_AS_BEGIN({
116043
116198
  begin: /(\w+)/,
@@ -116266,14 +116421,14 @@ var init_ruby = () => {};
116266
116421
 
116267
116422
  // node_modules/highlight.js/es/languages/rust.js
116268
116423
  function rust(hljs) {
116269
- const regex2 = hljs.regex;
116424
+ const regex4 = hljs.regex;
116270
116425
  const RAW_IDENTIFIER = /(r#)?/;
116271
- const UNDERSCORE_IDENT_RE = regex2.concat(RAW_IDENTIFIER, hljs.UNDERSCORE_IDENT_RE);
116272
- const IDENT_RE2 = regex2.concat(RAW_IDENTIFIER, hljs.IDENT_RE);
116426
+ const UNDERSCORE_IDENT_RE = regex4.concat(RAW_IDENTIFIER, hljs.UNDERSCORE_IDENT_RE);
116427
+ const IDENT_RE2 = regex4.concat(RAW_IDENTIFIER, hljs.IDENT_RE);
116273
116428
  const FUNCTION_INVOKE = {
116274
116429
  className: "title.function.invoke",
116275
116430
  relevance: 0,
116276
- begin: regex2.concat(/\b/, /(?!let|for|while|if|else|match\b)/, IDENT_RE2, regex2.lookahead(/\s*\(/))
116431
+ begin: regex4.concat(/\b/, /(?!let|for|while|if|else|match\b)/, IDENT_RE2, regex4.lookahead(/\s*\(/))
116277
116432
  };
116278
116433
  const NUMBER_SUFFIX = "([ui](8|16|32|64|128|size)|f(32|64))?";
116279
116434
  const KEYWORDS2 = [
@@ -117493,7 +117648,7 @@ var init_shell = () => {};
117493
117648
 
117494
117649
  // node_modules/highlight.js/es/languages/sql.js
117495
117650
  function sql(hljs) {
117496
- const regex2 = hljs.regex;
117651
+ const regex4 = hljs.regex;
117497
117652
  const COMMENT_MODE = hljs.COMMENT("--", "$");
117498
117653
  const STRING = {
117499
117654
  scope: "string",
@@ -118067,12 +118222,12 @@ function sql(hljs) {
118067
118222
  relevance: 0
118068
118223
  };
118069
118224
  const FUNCTION_CALL = {
118070
- match: regex2.concat(/\b/, regex2.either(...FUNCTIONS), /\s*\(/),
118225
+ match: regex4.concat(/\b/, regex4.either(...FUNCTIONS), /\s*\(/),
118071
118226
  relevance: 0,
118072
118227
  keywords: { built_in: FUNCTIONS }
118073
118228
  };
118074
118229
  function kws_to_regex(list) {
118075
- return regex2.concat(/\b/, regex2.either(...list.map((kw) => {
118230
+ return regex4.concat(/\b/, regex4.either(...list.map((kw) => {
118076
118231
  return kw.replace(/\s+/, "\\s+");
118077
118232
  })), /\b/);
118078
118233
  }
@@ -118884,7 +119039,7 @@ var init_swift = __esm(() => {
118884
119039
 
118885
119040
  // node_modules/highlight.js/es/languages/typescript.js
118886
119041
  function javascript2(hljs) {
118887
- const regex2 = hljs.regex;
119042
+ const regex4 = hljs.regex;
118888
119043
  const hasClosingTag = (match3, { after }) => {
118889
119044
  const tag = "</" + match3[0].slice(1);
118890
119045
  const pos = match3.input.indexOf(tag, after);
@@ -119090,7 +119245,7 @@ function javascript2(hljs) {
119090
119245
  /\s+/,
119091
119246
  /extends/,
119092
119247
  /\s+/,
119093
- regex2.concat(IDENT_RE$1, "(", regex2.concat(/\./, IDENT_RE$1), ")*")
119248
+ regex4.concat(IDENT_RE$1, "(", regex4.concat(/\./, IDENT_RE$1), ")*")
119094
119249
  ],
119095
119250
  scope: {
119096
119251
  1: "keyword",
@@ -119114,7 +119269,7 @@ function javascript2(hljs) {
119114
119269
  };
119115
119270
  const CLASS_REFERENCE = {
119116
119271
  relevance: 0,
119117
- match: regex2.either(/\bJSON/, /\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/, /\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/, /\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),
119272
+ match: regex4.either(/\bJSON/, /\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/, /\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/, /\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),
119118
119273
  className: "title.class",
119119
119274
  keywords: {
119120
119275
  _: [
@@ -119160,19 +119315,19 @@ function javascript2(hljs) {
119160
119315
  className: "variable.constant"
119161
119316
  };
119162
119317
  function noneOf(list) {
119163
- return regex2.concat("(?!", list.join("|"), ")");
119318
+ return regex4.concat("(?!", list.join("|"), ")");
119164
119319
  }
119165
119320
  const FUNCTION_CALL = {
119166
- match: regex2.concat(/\b/, noneOf([
119321
+ match: regex4.concat(/\b/, noneOf([
119167
119322
  ...BUILT_IN_GLOBALS2,
119168
119323
  "super",
119169
119324
  "import"
119170
- ].map((x) => `${x}\\s*\\(`)), IDENT_RE$1, regex2.lookahead(/\s*\(/)),
119325
+ ].map((x) => `${x}\\s*\\(`)), IDENT_RE$1, regex4.lookahead(/\s*\(/)),
119171
119326
  className: "title.function",
119172
119327
  relevance: 0
119173
119328
  };
119174
119329
  const PROPERTY_ACCESS = {
119175
- begin: regex2.concat(/\./, regex2.lookahead(regex2.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/))),
119330
+ begin: regex4.concat(/\./, regex4.lookahead(regex4.concat(IDENT_RE$1, /(?![0-9A-Za-z$_(])/))),
119176
119331
  end: IDENT_RE$1,
119177
119332
  excludeBegin: true,
119178
119333
  keywords: "prototype",
@@ -119206,7 +119361,7 @@ function javascript2(hljs) {
119206
119361
  /\s*/,
119207
119362
  /=\s*/,
119208
119363
  /(async\s*)?/,
119209
- regex2.lookahead(FUNC_LEAD_IN_RE)
119364
+ regex4.lookahead(FUNC_LEAD_IN_RE)
119210
119365
  ],
119211
119366
  keywords: "async",
119212
119367
  className: {
@@ -119242,7 +119397,7 @@ function javascript2(hljs) {
119242
119397
  CLASS_REFERENCE,
119243
119398
  {
119244
119399
  scope: "attr",
119245
- match: IDENT_RE$1 + regex2.lookahead(":"),
119400
+ match: IDENT_RE$1 + regex4.lookahead(":"),
119246
119401
  relevance: 0
119247
119402
  },
119248
119403
  FUNCTION_VARIABLE,
@@ -119351,7 +119506,7 @@ function javascript2(hljs) {
119351
119506
  };
119352
119507
  }
119353
119508
  function typescript(hljs) {
119354
- const regex2 = hljs.regex;
119509
+ const regex4 = hljs.regex;
119355
119510
  const tsLanguage = javascript2(hljs);
119356
119511
  const IDENT_RE$1 = IDENT_RE2;
119357
119512
  const TYPES3 = [
@@ -119427,7 +119582,7 @@ function typescript(hljs) {
119427
119582
  Object.assign(tsLanguage.keywords, KEYWORDS$1);
119428
119583
  tsLanguage.exports.PARAMS_CONTAINS.push(DECORATOR);
119429
119584
  const ATTRIBUTE_HIGHLIGHT = tsLanguage.contains.find((c2) => c2.scope === "attr");
119430
- const OPTIONAL_KEY_OR_ARGUMENT = Object.assign({}, ATTRIBUTE_HIGHLIGHT, { match: regex2.concat(IDENT_RE$1, regex2.lookahead(/\s*\?:/)) });
119585
+ const OPTIONAL_KEY_OR_ARGUMENT = Object.assign({}, ATTRIBUTE_HIGHLIGHT, { match: regex4.concat(IDENT_RE$1, regex4.lookahead(/\s*\?:/)) });
119431
119586
  tsLanguage.exports.PARAMS_CONTAINS.push([
119432
119587
  tsLanguage.exports.CLASS_REFERENCE,
119433
119588
  ATTRIBUTE_HIGHLIGHT,
@@ -119592,7 +119747,7 @@ var init_typescript2 = __esm(() => {
119592
119747
 
119593
119748
  // node_modules/highlight.js/es/languages/vbnet.js
119594
119749
  function vbnet(hljs) {
119595
- const regex2 = hljs.regex;
119750
+ const regex4 = hljs.regex;
119596
119751
  const CHARACTER = {
119597
119752
  className: "string",
119598
119753
  begin: /"(""|[^/n])"C\b/
@@ -119616,16 +119771,16 @@ function vbnet(hljs) {
119616
119771
  className: "literal",
119617
119772
  variants: [
119618
119773
  {
119619
- begin: regex2.concat(/# */, regex2.either(YYYY_MM_DD, MM_DD_YYYY), / *#/)
119774
+ begin: regex4.concat(/# */, regex4.either(YYYY_MM_DD, MM_DD_YYYY), / *#/)
119620
119775
  },
119621
119776
  {
119622
- begin: regex2.concat(/# */, TIME_24H, / *#/)
119777
+ begin: regex4.concat(/# */, TIME_24H, / *#/)
119623
119778
  },
119624
119779
  {
119625
- begin: regex2.concat(/# */, TIME_12H, / *#/)
119780
+ begin: regex4.concat(/# */, TIME_12H, / *#/)
119626
119781
  },
119627
119782
  {
119628
- begin: regex2.concat(/# */, regex2.either(YYYY_MM_DD, MM_DD_YYYY), / +/, regex2.either(TIME_12H, TIME_24H), / *#/)
119783
+ begin: regex4.concat(/# */, regex4.either(YYYY_MM_DD, MM_DD_YYYY), / +/, regex4.either(TIME_12H, TIME_24H), / *#/)
119629
119784
  }
119630
119785
  ]
119631
119786
  };
@@ -119821,8 +119976,8 @@ var init_wasm = () => {};
119821
119976
 
119822
119977
  // node_modules/highlight.js/es/languages/xml.js
119823
119978
  function xml(hljs) {
119824
- const regex2 = hljs.regex;
119825
- const TAG_NAME_RE = regex2.concat(/[\p{L}_]/u, regex2.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u);
119979
+ const regex4 = hljs.regex;
119980
+ const TAG_NAME_RE = regex4.concat(/[\p{L}_]/u, regex4.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u);
119826
119981
  const XML_IDENT_RE = /[\p{L}0-9._:-]+/u;
119827
119982
  const XML_ENTITIES = {
119828
119983
  className: "symbol",
@@ -119985,7 +120140,7 @@ function xml(hljs) {
119985
120140
  },
119986
120141
  {
119987
120142
  className: "tag",
119988
- begin: regex2.concat(/</, regex2.lookahead(regex2.concat(TAG_NAME_RE, regex2.either(/\/>/, />/, /\s/)))),
120143
+ begin: regex4.concat(/</, regex4.lookahead(regex4.concat(TAG_NAME_RE, regex4.either(/\/>/, />/, /\s/)))),
119989
120144
  end: /\/?>/,
119990
120145
  contains: [
119991
120146
  {
@@ -119998,7 +120153,7 @@ function xml(hljs) {
119998
120153
  },
119999
120154
  {
120000
120155
  className: "tag",
120001
- begin: regex2.concat(/<\//, regex2.lookahead(regex2.concat(TAG_NAME_RE, />/))),
120156
+ begin: regex4.concat(/<\//, regex4.lookahead(regex4.concat(TAG_NAME_RE, />/))),
120002
120157
  contains: [
120003
120158
  {
120004
120159
  className: "name",
@@ -120546,10 +120701,10 @@ var require_core = __commonJS((exports, module) => {
120546
120701
  var BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
120547
120702
  function _rewriteBackreferences(regexps, { joinWith }) {
120548
120703
  let numCaptures = 0;
120549
- return regexps.map((regex2) => {
120704
+ return regexps.map((regex4) => {
120550
120705
  numCaptures += 1;
120551
120706
  const offset = numCaptures;
120552
- let re = source2(regex2);
120707
+ let re = source2(regex4);
120553
120708
  let out = "";
120554
120709
  while (re.length > 0) {
120555
120710
  const match3 = BACKREF_RE.exec(re);
@@ -129297,6 +129452,7 @@ __export(exports_terminalKeybindingInstaller, {
129297
129452
  installWezTermDeleteFix: () => installWezTermDeleteFix,
129298
129453
  installKeybindingForCurrentTerminal: () => installKeybindingForCurrentTerminal,
129299
129454
  installKeybinding: () => installKeybinding,
129455
+ injectWezTermDeleteFix: () => injectWezTermDeleteFix,
129300
129456
  getWezTermConfigPath: () => getWezTermConfigPath,
129301
129457
  getKeybindingsPath: () => getKeybindingsPath,
129302
129458
  detectTerminalType: () => detectTerminalType
@@ -129512,6 +129668,106 @@ function getWezTermConfigPath() {
129512
129668
  return configPath;
129513
129669
  return join46(homedir32(), ".wezterm.lua");
129514
129670
  }
129671
+ function stripLuaCommentsFromLine(line, blockCommentEnd) {
129672
+ let code = "";
129673
+ let index = 0;
129674
+ let currentBlockCommentEnd = blockCommentEnd;
129675
+ while (index < line.length) {
129676
+ if (currentBlockCommentEnd) {
129677
+ const closeIndex = line.indexOf(currentBlockCommentEnd, index);
129678
+ if (closeIndex === -1) {
129679
+ return { code, blockCommentEnd: currentBlockCommentEnd };
129680
+ }
129681
+ index = closeIndex + currentBlockCommentEnd.length;
129682
+ currentBlockCommentEnd = null;
129683
+ continue;
129684
+ }
129685
+ if (line.startsWith("--", index)) {
129686
+ const longCommentMatch = line.slice(index).match(/^--\[(=*)\[/);
129687
+ if (longCommentMatch) {
129688
+ const equals = longCommentMatch[1] ?? "";
129689
+ currentBlockCommentEnd = `]${equals}]`;
129690
+ index += longCommentMatch[0].length;
129691
+ continue;
129692
+ }
129693
+ break;
129694
+ }
129695
+ code += line.charAt(index);
129696
+ index += 1;
129697
+ }
129698
+ return { code, blockCommentEnd: currentBlockCommentEnd };
129699
+ }
129700
+ function getLuaCodeLines(content) {
129701
+ const lines = [];
129702
+ let start = 0;
129703
+ let blockCommentEnd = null;
129704
+ while (start < content.length) {
129705
+ const newlineIndex = content.indexOf(`
129706
+ `, start);
129707
+ const end = newlineIndex === -1 ? content.length : newlineIndex + 1;
129708
+ const rawLine = content.slice(start, end);
129709
+ const lineEnding = rawLine.endsWith(`\r
129710
+ `) ? `\r
129711
+ ` : rawLine.endsWith(`
129712
+ `) ? `
129713
+ ` : "";
129714
+ const line = lineEnding ? rawLine.slice(0, rawLine.length - lineEnding.length) : rawLine;
129715
+ const stripped = stripLuaCommentsFromLine(line, blockCommentEnd);
129716
+ blockCommentEnd = stripped.blockCommentEnd;
129717
+ lines.push({
129718
+ start,
129719
+ end,
129720
+ line,
129721
+ lineEnding,
129722
+ code: stripped.code
129723
+ });
129724
+ start = end;
129725
+ }
129726
+ return lines;
129727
+ }
129728
+ function findLastMatchingLuaLine(content, pattern) {
129729
+ let result = null;
129730
+ for (const line of getLuaCodeLines(content)) {
129731
+ if (pattern.test(line.code)) {
129732
+ result = line;
129733
+ }
129734
+ }
129735
+ return result;
129736
+ }
129737
+ function hasMatchingLuaLine(content, pattern) {
129738
+ return findLastMatchingLuaLine(content, pattern) !== null;
129739
+ }
129740
+ function replaceLuaLine(content, line, replacement) {
129741
+ return `${content.slice(0, line.start)}${replacement}${line.lineEnding}${content.slice(line.end)}`;
129742
+ }
129743
+ function injectWezTermDeleteFix(content) {
129744
+ let nextContent = content;
129745
+ const returnTableLine = findLastMatchingLuaLine(nextContent, RETURN_TABLE_LINE);
129746
+ if (returnTableLine && !hasMatchingLuaLine(nextContent, LOCAL_CONFIG_LINE)) {
129747
+ nextContent = replaceLuaLine(nextContent, returnTableLine, returnTableLine.line.replace(/return\s*\{/, "local config = {"));
129748
+ if (!hasMatchingLuaLine(nextContent, RETURN_CONFIG_LINE)) {
129749
+ nextContent = `${nextContent.trimEnd()}
129750
+
129751
+ return config
129752
+ `;
129753
+ }
129754
+ }
129755
+ if (!nextContent.trim()) {
129756
+ nextContent = `-- WezTerm configuration
129757
+ local config = {}
129758
+
129759
+ return config
129760
+ `;
129761
+ }
129762
+ const returnConfigLine = findLastMatchingLuaLine(nextContent, RETURN_CONFIG_LINE);
129763
+ if (returnConfigLine) {
129764
+ return `${nextContent.slice(0, returnConfigLine.start)}${WEZTERM_DELETE_FIX}
129765
+ ${nextContent.slice(returnConfigLine.start)}`;
129766
+ }
129767
+ return `${nextContent.trimEnd()}
129768
+ ${WEZTERM_DELETE_FIX}
129769
+ `;
129770
+ }
129515
129771
  function wezTermDeleteFixExists(configPath) {
129516
129772
  if (!existsSync39(configPath))
129517
129773
  return false;
@@ -129535,30 +129791,7 @@ function installWezTermDeleteFix() {
129535
129791
  copyFileSync(configPath, backupPath);
129536
129792
  content = readFileSync26(configPath, { encoding: "utf-8" });
129537
129793
  }
129538
- if (content.includes("return {") && !content.includes("local config")) {
129539
- content = content.replace(/return\s*\{/, "local config = {");
129540
- if (!content.includes("return config")) {
129541
- content = `${content.trimEnd()}
129542
-
129543
- return config
129544
- `;
129545
- }
129546
- }
129547
- if (!content.trim()) {
129548
- content = `-- WezTerm configuration
129549
- local config = {}
129550
-
129551
- return config
129552
- `;
129553
- }
129554
- if (content.includes("return config")) {
129555
- content = content.replace("return config", `${WEZTERM_DELETE_FIX}
129556
- return config`);
129557
- } else {
129558
- content = `${content.trimEnd()}
129559
- ${WEZTERM_DELETE_FIX}
129560
- `;
129561
- }
129794
+ content = injectWezTermDeleteFix(content);
129562
129795
  const parentDir = dirname20(configPath);
129563
129796
  if (!existsSync39(parentDir)) {
129564
129797
  mkdirSync30(parentDir, { recursive: true });
@@ -129587,7 +129820,7 @@ table.insert(keys, {
129587
129820
  action = wezterm.action.SendString '\\x1b[3~',
129588
129821
  })
129589
129822
  config.keys = keys
129590
- `;
129823
+ `, RETURN_CONFIG_LINE, RETURN_TABLE_LINE, LOCAL_CONFIG_LINE;
129591
129824
  var init_terminalKeybindingInstaller = __esm(() => {
129592
129825
  SHIFT_ENTER_KEYBINDING = {
129593
129826
  key: "shift+enter",
@@ -129595,6 +129828,9 @@ var init_terminalKeybindingInstaller = __esm(() => {
129595
129828
  args: { text: "\x1B\r" },
129596
129829
  when: "terminalFocus"
129597
129830
  };
129831
+ RETURN_CONFIG_LINE = /^\s*return\s+config\s*$/;
129832
+ RETURN_TABLE_LINE = /^\s*return\s*\{/;
129833
+ LOCAL_CONFIG_LINE = /^\s*local\s+config\b/;
129598
129834
  });
129599
129835
 
129600
129836
  // src/cli/commands/registry.ts
@@ -134111,8 +134347,8 @@ function findCursorLine(cursorPos, visualLines) {
134111
134347
  function parseOsc8Line(line, keyPrefix) {
134112
134348
  const parts = [];
134113
134349
  let lastIndex = 0;
134114
- const regex2 = new RegExp(OSC8_REGEX.source, "g");
134115
- for (let match3 = regex2.exec(line);match3 !== null; match3 = regex2.exec(line)) {
134350
+ const regex4 = new RegExp(OSC8_REGEX.source, "g");
134351
+ for (let match3 = regex4.exec(line);match3 !== null; match3 = regex4.exec(line)) {
134116
134352
  if (match3.index > lastIndex) {
134117
134353
  parts.push(/* @__PURE__ */ jsx_dev_runtime53.jsxDEV(Text2, {
134118
134354
  children: line.slice(lastIndex, match3.index)
@@ -159106,6 +159342,7 @@ __export(exports_terminalKeybindingInstaller2, {
159106
159342
  installWezTermDeleteFix: () => installWezTermDeleteFix2,
159107
159343
  installKeybindingForCurrentTerminal: () => installKeybindingForCurrentTerminal2,
159108
159344
  installKeybinding: () => installKeybinding2,
159345
+ injectWezTermDeleteFix: () => injectWezTermDeleteFix2,
159109
159346
  getWezTermConfigPath: () => getWezTermConfigPath2,
159110
159347
  getKeybindingsPath: () => getKeybindingsPath2,
159111
159348
  detectTerminalType: () => detectTerminalType2
@@ -159321,6 +159558,106 @@ function getWezTermConfigPath2() {
159321
159558
  return configPath;
159322
159559
  return join54(homedir38(), ".wezterm.lua");
159323
159560
  }
159561
+ function stripLuaCommentsFromLine2(line, blockCommentEnd) {
159562
+ let code = "";
159563
+ let index = 0;
159564
+ let currentBlockCommentEnd = blockCommentEnd;
159565
+ while (index < line.length) {
159566
+ if (currentBlockCommentEnd) {
159567
+ const closeIndex = line.indexOf(currentBlockCommentEnd, index);
159568
+ if (closeIndex === -1) {
159569
+ return { code, blockCommentEnd: currentBlockCommentEnd };
159570
+ }
159571
+ index = closeIndex + currentBlockCommentEnd.length;
159572
+ currentBlockCommentEnd = null;
159573
+ continue;
159574
+ }
159575
+ if (line.startsWith("--", index)) {
159576
+ const longCommentMatch = line.slice(index).match(/^--\[(=*)\[/);
159577
+ if (longCommentMatch) {
159578
+ const equals = longCommentMatch[1] ?? "";
159579
+ currentBlockCommentEnd = `]${equals}]`;
159580
+ index += longCommentMatch[0].length;
159581
+ continue;
159582
+ }
159583
+ break;
159584
+ }
159585
+ code += line.charAt(index);
159586
+ index += 1;
159587
+ }
159588
+ return { code, blockCommentEnd: currentBlockCommentEnd };
159589
+ }
159590
+ function getLuaCodeLines2(content) {
159591
+ const lines = [];
159592
+ let start = 0;
159593
+ let blockCommentEnd = null;
159594
+ while (start < content.length) {
159595
+ const newlineIndex = content.indexOf(`
159596
+ `, start);
159597
+ const end = newlineIndex === -1 ? content.length : newlineIndex + 1;
159598
+ const rawLine = content.slice(start, end);
159599
+ const lineEnding = rawLine.endsWith(`\r
159600
+ `) ? `\r
159601
+ ` : rawLine.endsWith(`
159602
+ `) ? `
159603
+ ` : "";
159604
+ const line = lineEnding ? rawLine.slice(0, rawLine.length - lineEnding.length) : rawLine;
159605
+ const stripped = stripLuaCommentsFromLine2(line, blockCommentEnd);
159606
+ blockCommentEnd = stripped.blockCommentEnd;
159607
+ lines.push({
159608
+ start,
159609
+ end,
159610
+ line,
159611
+ lineEnding,
159612
+ code: stripped.code
159613
+ });
159614
+ start = end;
159615
+ }
159616
+ return lines;
159617
+ }
159618
+ function findLastMatchingLuaLine2(content, pattern) {
159619
+ let result = null;
159620
+ for (const line of getLuaCodeLines2(content)) {
159621
+ if (pattern.test(line.code)) {
159622
+ result = line;
159623
+ }
159624
+ }
159625
+ return result;
159626
+ }
159627
+ function hasMatchingLuaLine2(content, pattern) {
159628
+ return findLastMatchingLuaLine2(content, pattern) !== null;
159629
+ }
159630
+ function replaceLuaLine2(content, line, replacement) {
159631
+ return `${content.slice(0, line.start)}${replacement}${line.lineEnding}${content.slice(line.end)}`;
159632
+ }
159633
+ function injectWezTermDeleteFix2(content) {
159634
+ let nextContent = content;
159635
+ const returnTableLine = findLastMatchingLuaLine2(nextContent, RETURN_TABLE_LINE2);
159636
+ if (returnTableLine && !hasMatchingLuaLine2(nextContent, LOCAL_CONFIG_LINE2)) {
159637
+ nextContent = replaceLuaLine2(nextContent, returnTableLine, returnTableLine.line.replace(/return\s*\{/, "local config = {"));
159638
+ if (!hasMatchingLuaLine2(nextContent, RETURN_CONFIG_LINE2)) {
159639
+ nextContent = `${nextContent.trimEnd()}
159640
+
159641
+ return config
159642
+ `;
159643
+ }
159644
+ }
159645
+ if (!nextContent.trim()) {
159646
+ nextContent = `-- WezTerm configuration
159647
+ local config = {}
159648
+
159649
+ return config
159650
+ `;
159651
+ }
159652
+ const returnConfigLine = findLastMatchingLuaLine2(nextContent, RETURN_CONFIG_LINE2);
159653
+ if (returnConfigLine) {
159654
+ return `${nextContent.slice(0, returnConfigLine.start)}${WEZTERM_DELETE_FIX2}
159655
+ ${nextContent.slice(returnConfigLine.start)}`;
159656
+ }
159657
+ return `${nextContent.trimEnd()}
159658
+ ${WEZTERM_DELETE_FIX2}
159659
+ `;
159660
+ }
159324
159661
  function wezTermDeleteFixExists2(configPath) {
159325
159662
  if (!existsSync46(configPath))
159326
159663
  return false;
@@ -159344,30 +159681,7 @@ function installWezTermDeleteFix2() {
159344
159681
  copyFileSync2(configPath, backupPath);
159345
159682
  content = readFileSync30(configPath, { encoding: "utf-8" });
159346
159683
  }
159347
- if (content.includes("return {") && !content.includes("local config")) {
159348
- content = content.replace(/return\s*\{/, "local config = {");
159349
- if (!content.includes("return config")) {
159350
- content = `${content.trimEnd()}
159351
-
159352
- return config
159353
- `;
159354
- }
159355
- }
159356
- if (!content.trim()) {
159357
- content = `-- WezTerm configuration
159358
- local config = {}
159359
-
159360
- return config
159361
- `;
159362
- }
159363
- if (content.includes("return config")) {
159364
- content = content.replace("return config", `${WEZTERM_DELETE_FIX2}
159365
- return config`);
159366
- } else {
159367
- content = `${content.trimEnd()}
159368
- ${WEZTERM_DELETE_FIX2}
159369
- `;
159370
- }
159684
+ content = injectWezTermDeleteFix2(content);
159371
159685
  const parentDir = dirname23(configPath);
159372
159686
  if (!existsSync46(parentDir)) {
159373
159687
  mkdirSync33(parentDir, { recursive: true });
@@ -159396,7 +159710,7 @@ table.insert(keys, {
159396
159710
  action = wezterm.action.SendString '\\x1b[3~',
159397
159711
  })
159398
159712
  config.keys = keys
159399
- `;
159713
+ `, RETURN_CONFIG_LINE2, RETURN_TABLE_LINE2, LOCAL_CONFIG_LINE2;
159400
159714
  var init_terminalKeybindingInstaller2 = __esm(() => {
159401
159715
  SHIFT_ENTER_KEYBINDING2 = {
159402
159716
  key: "shift+enter",
@@ -159404,6 +159718,9 @@ var init_terminalKeybindingInstaller2 = __esm(() => {
159404
159718
  args: { text: "\x1B\r" },
159405
159719
  when: "terminalFocus"
159406
159720
  };
159721
+ RETURN_CONFIG_LINE2 = /^\s*return\s+config\s*$/;
159722
+ RETURN_TABLE_LINE2 = /^\s*return\s*\{/;
159723
+ LOCAL_CONFIG_LINE2 = /^\s*local\s+config\b/;
159407
159724
  });
159408
159725
 
159409
159726
  // src/settings.ts
@@ -160954,6 +161271,7 @@ function getClientDefaultHeaders2() {
160954
161271
  return {
160955
161272
  "X-Letta-Source": "letta-code",
160956
161273
  "User-Agent": `letta-code/${package_default.version}`,
161274
+ "X-Letta-Environment-Device-Id": settingsManager.getOrCreateDeviceId(),
160957
161275
  ...nodeExperiment.source === "override" ? { "x-letta-node": nodeExperiment.enabled ? "1" : "0" } : nodeExperiment.enabled ? { "x-letta-node": "1" } : {}
160958
161276
  };
160959
161277
  }
@@ -161015,7 +161333,7 @@ If you experience this issue multiple times, move ~/.letta to ~/.letta_backup, a
161015
161333
  console.error(new Error("getClient() called without credentials").stack);
161016
161334
  throw new Error("Missing LETTA_API_KEY. Run 'letta' to configure authentication, or set LETTA_API_KEY to your API key.");
161017
161335
  }
161018
- return new Letta({
161336
+ const client = new Letta({
161019
161337
  apiKey,
161020
161338
  baseURL,
161021
161339
  logger: sdkLogger2,
@@ -161023,6 +161341,28 @@ If you experience this issue multiple times, move ~/.letta to ~/.letta_backup, a
161023
161341
  defaultHeaders: getClientDefaultHeaders2(),
161024
161342
  ...isTimingsEnabled() && { fetch: createTimingFetch(fetch) }
161025
161343
  });
161344
+ const MESSAGE_CACHE_MAX = 32;
161345
+ const messageCache = new Map;
161346
+ const origRetrieveMessage = client.messages.retrieve.bind(client.messages);
161347
+ client.messages.retrieve = (...args) => {
161348
+ const messageId = args[0];
161349
+ const cached = messageCache.get(messageId);
161350
+ if (cached) {
161351
+ messageCache.delete(messageId);
161352
+ messageCache.set(messageId, cached);
161353
+ return cached;
161354
+ }
161355
+ const promise = origRetrieveMessage(...args);
161356
+ messageCache.set(messageId, promise);
161357
+ if (messageCache.size > MESSAGE_CACHE_MAX) {
161358
+ const oldest = messageCache.keys().next().value;
161359
+ if (oldest !== undefined)
161360
+ messageCache.delete(oldest);
161361
+ }
161362
+ promise.catch(() => messageCache.delete(messageId));
161363
+ return promise;
161364
+ };
161365
+ return client;
161026
161366
  }
161027
161367
 
161028
161368
  // src/agent/context.ts
@@ -169769,4 +170109,4 @@ Error during initialization: ${message}`);
169769
170109
  }
169770
170110
  main();
169771
170111
 
169772
- //# debugId=5F460A87866AF15264756E2164756E21
170112
+ //# debugId=1F73E48C6C64400464756E2164756E21