@sourcegraph/amp 0.0.1749283279-g57239a → 0.0.1749312087-g3e4f54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/amp.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import "./console-RPzEsLY0.js";
3
- import "./main-BtWlXNOi.js";
2
+ import "./console-Dvb4mlt2.js";
3
+ import "./main-C12KTwcJ.js";
4
4
  import "node:crypto";
5
5
  import "node:fs/promises";
6
6
  import "node:path";
7
7
  import "node:process";
8
- import "./client-D82aFqMl.js";
8
+ import "./client-D-IY-U_F.js";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { f as i, E as o, aS as c, s as p, p as u } from "./console-RPzEsLY0.js";
2
+ import { f as i, E as o, aS as c, s as p, p as u } from "./console-Dvb4mlt2.js";
3
3
  const m = !0;
4
4
  function f() {
5
5
  return new Proxy(
@@ -26,7 +26,7 @@ let qs = k2;
26
26
  function JAe(n) {
27
27
  qs = n;
28
28
  }
29
- const Re = {
29
+ const Ne = {
30
30
  error: (n, ...e) => qs.error(n, ...e),
31
31
  warn: (n, ...e) => qs.warn(n, ...e),
32
32
  info: (n, ...e) => qs.info(n, ...e),
@@ -1045,7 +1045,7 @@ COMPLEMENTARY USE WITH CODEBASE_SEARCH:
1045
1045
  },
1046
1046
  source: "builtin"
1047
1047
  },
1048
- fn: import("./node-CQsX6uby.js").then(({ nodeGrepTool: n }) => n)
1048
+ fn: import("./node-Q6Y8w80U.js").then(({ nodeGrepTool: n }) => n)
1049
1049
  };
1050
1050
  var Zc = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1051
1051
  function Li(n) {
@@ -1952,7 +1952,7 @@ It's VERY IMPORTANT to use specific tools when searching for files, instead of i
1952
1952
  },
1953
1953
  source: "builtin"
1954
1954
  },
1955
- fn: import("./node-DeN3f1CH.js").then(({ nodeBashTool: n }) => n),
1955
+ fn: import("./node-BQqcfLba.js").then(({ nodeBashTool: n }) => n),
1956
1956
  preprocessArgs: (n) => {
1957
1957
  if (!n.cwd)
1958
1958
  try {
@@ -2011,7 +2011,7 @@ Prefer this tool over \`edit_file\` when you want to ovewrite the entire content
2011
2011
  content: n.content + `
2012
2012
  `
2013
2013
  },
2014
- fn: import("./create_file.node-Dg6SfP0E.js").then(
2014
+ fn: import("./create_file.node-CRyFgm0F.js").then(
2015
2015
  ({ nodeCreateFileTool: n }) => n
2016
2016
  )
2017
2017
  };
@@ -4843,7 +4843,7 @@ Returns the contents of the file with each line prefixed by its line number. For
4843
4843
  switch ("node") {
4844
4844
  case "node":
4845
4845
  case "vscode":
4846
- return import("./read_file.node-Cf-KhpsY.js").then(({ nodeReadFileTool: n }) => n);
4846
+ return import("./read_file.node-BULEexSm.js").then(({ nodeReadFileTool: n }) => n);
4847
4847
  }
4848
4848
  })()
4849
4849
  }, cB = U8({
@@ -4872,7 +4872,7 @@ If you need to replace the entire contents of a file, use \`${$u}\` instead, sin
4872
4872
  inputSchema: t8(cB),
4873
4873
  source: "builtin"
4874
4874
  },
4875
- fn: import("./edit_file.node-DOTivrdL.js").then(({ nodeEditFileTool: n }) => n)
4875
+ fn: import("./edit_file.node-4wiIt_1p.js").then(({ nodeEditFileTool: n }) => n)
4876
4876
  };
4877
4877
  function ZS(n) {
4878
4878
  return n.replace(/\\\\n/g, "\\n").replace(/\\\\t/g, "\\t").replace(/\\\\/g, "\\").replace(/\\"/g, '"').replace(/\\'/g, "'").replace(/\\n/g, `
@@ -5053,7 +5053,7 @@ Note: Results are sorted by modification time with the most recently modified fi
5053
5053
  },
5054
5054
  source: "builtin"
5055
5055
  },
5056
- fn: import("./glob.node-Betywdle.js").then(({ nodeGlobTool: n }) => n)
5056
+ fn: import("./glob.node-DiaL_K-Y.js").then(({ nodeGlobTool: n }) => n)
5057
5057
  }, Qu = "list_directory", IE = {
5058
5058
  spec: {
5059
5059
  name: Qu,
@@ -5074,7 +5074,7 @@ Note: Results are sorted by modification time with the most recently modified fi
5074
5074
  switch ("node") {
5075
5075
  case "node":
5076
5076
  case "vscode":
5077
- return import("./list_directory.node-B8bOIV1q.js").then(
5077
+ return import("./list_directory.node-CydlY2iC.js").then(
5078
5078
  ({ nodeListDirectoryTool: n }) => n
5079
5079
  );
5080
5080
  }
@@ -5161,7 +5161,7 @@ This tool converts web content to markdown format for better readability.`,
5161
5161
  requiresNetwork: !0
5162
5162
  }
5163
5163
  },
5164
- fn: import("./node-cSLqYAQI.js").then(({ nodeReadWebPageTool: n }) => n)
5164
+ fn: import("./node-Cj2ZZWHz.js").then(({ nodeReadWebPageTool: n }) => n)
5165
5165
  }, gB = "web_search", hB = `Search the web for information.
5166
5166
 
5167
5167
  Returns search result titles, associated URLs, and a small summary of the
@@ -5209,7 +5209,7 @@ the \`${x1}\` with the url.
5209
5209
  requiresNetwork: !0
5210
5210
  }
5211
5211
  },
5212
- fn: import("./node-l0bjR3wx.js").then(({ nodeWebSearchTool: n }) => n)
5212
+ fn: import("./node-j5JkFzVn.js").then(({ nodeWebSearchTool: n }) => n)
5213
5213
  };
5214
5214
  function KN({ onlyFirst: n = !1 } = {}) {
5215
5215
  const t = [
@@ -8418,7 +8418,7 @@ function vU() {
8418
8418
  }
8419
8419
  function AU() {
8420
8420
  const n = vU(), e = {};
8421
- return e["X-Amp-Client-Application"] = n.name, e["X-Amp-Client-Type"] = n.type, n.version && (e["X-Amp-Client-Version"] = n.version), e;
8421
+ return e["X-Amp-Client-Application"] = n.name, e["X-Amp-Client-Type"] = n.type, e["X-Amp-Client-Bundle"] = "cli", n.version && (e["X-Amp-Client-Version"] = n.version), e;
8422
8422
  }
8423
8423
  function Fl(n, e = "result") {
8424
8424
  return n === null ? `<${e}>null</${e}>` : n === void 0 ? `<${e}>undefined</${e}>` : typeof n == "string" ? `<${e}>${n}</${e}>` : typeof n == "number" || typeof n == "boolean" ? `<${e}>${n}</${e}>` : Array.isArray(n) ? `<${e}>${JSON.stringify(n)}</${e}>` : typeof n == "object" ? Object.entries(n).map(([t, r]) => {
@@ -8539,7 +8539,7 @@ function wU({
8539
8539
  _ === null ? (c = !0, u = "") : (c = !1, u = _);
8540
8540
  }
8541
8541
  } catch (_) {
8542
- Re.error(`Error reading file ${a} before modification:`, _);
8542
+ Ne.error(`Error reading file ${a} before modification:`, _);
8543
8543
  }
8544
8544
  if (await i(a), !o.has(a))
8545
8545
  try {
@@ -8558,13 +8558,13 @@ function wU({
8558
8558
  };
8559
8559
  o.set(a, b);
8560
8560
  const A = Mw(n, S);
8561
- await t.storeFileChange(A, b), Re.debug("Generated diff for file", {
8561
+ await t.storeFileChange(A, b), Ne.debug("Generated diff for file", {
8562
8562
  isNewFile: c,
8563
8563
  filePath: a,
8564
8564
  toolUseID: n
8565
8565
  }), r && kw(a, r, m);
8566
8566
  } catch (_) {
8567
- Re.error(`Error generating diff for ${a} after tool use:`, _);
8567
+ Ne.error(`Error generating diff for ${a} after tool use:`, _);
8568
8568
  }
8569
8569
  };
8570
8570
  }
@@ -8597,7 +8597,7 @@ async function bb(n, e, t) {
8597
8597
  const u = await B1(n, s) !== null;
8598
8598
  o.isNewFile && u ? (await n.deleteFile(s), a.add(s)) : u && (await n.writeFile(s, o.before), a.add(s));
8599
8599
  } catch (c) {
8600
- Re.error(`Error reverting file ${s}:`, c);
8600
+ Ne.error(`Error reverting file ${s}:`, c);
8601
8601
  }
8602
8602
  const i = Date.now();
8603
8603
  for (const s of a)
@@ -8614,7 +8614,7 @@ async function bb(n, e, t) {
8614
8614
  const _ = Mw(s, u.id);
8615
8615
  await n.storeFileChange(_, u);
8616
8616
  } catch (_) {
8617
- Re.error(`Error updating backup for file ${c}:`, _);
8617
+ Ne.error(`Error updating backup for file ${c}:`, _);
8618
8618
  }
8619
8619
  }
8620
8620
  }
@@ -8643,7 +8643,7 @@ function xU(n) {
8643
8643
  try {
8644
8644
  process.platform !== "win32" && n.pid ? process.kill(-n.pid, "SIGKILL") : n.kill("SIGKILL");
8645
8645
  } catch (e) {
8646
- Re.error(`Failed to kill process ${n.pid}`, e);
8646
+ Ne.error(`Failed to kill process ${n.pid}`, e);
8647
8647
  return;
8648
8648
  }
8649
8649
  }
@@ -9158,7 +9158,7 @@ async function JU(n, e, t) {
9158
9158
  tools: t
9159
9159
  })).input_tokens;
9160
9160
  } catch (r) {
9161
- return Re.warn("Failed to count tokens via Anthropic API:", r), null;
9161
+ return Ne.warn("Failed to count tokens via Anthropic API:", r), null;
9162
9162
  }
9163
9163
  }
9164
9164
  function Db(n) {
@@ -9244,7 +9244,7 @@ function jU(n) {
9244
9244
  }
9245
9245
  function z1(n, e) {
9246
9246
  if (!ec(e)) {
9247
- Re.error("runToBlockParam", "run is not terminal", { run: e });
9247
+ Ne.error("runToBlockParam", "run is not terminal", { run: e });
9248
9248
  return;
9249
9249
  }
9250
9250
  let t = [];
@@ -20945,7 +20945,7 @@ function G$() {
20945
20945
  }
20946
20946
  return $.apply(J, Q);
20947
20947
  }
20948
- function Ne($, J, Q, he) {
20948
+ function Re($, J, Q, he) {
20949
20949
  for (var $e = -1, Ct = $ == null ? 0 : $.length; ++$e < Ct; ) {
20950
20950
  var zn = $[$e];
20951
20951
  J(he, zn, Q(zn), $);
@@ -22168,7 +22168,7 @@ function G$() {
22168
22168
  }
22169
22169
  function xc(l, d) {
22170
22170
  return function(E, v) {
22171
- var I = We(E) ? Ne : fM, B = d ? d() : {};
22171
+ var I = We(E) ? Re : fM, B = d ? d() : {};
22172
22172
  return I(E, l, Oe(v, 2), B);
22173
22173
  };
22174
22174
  }
@@ -24367,7 +24367,7 @@ async function* W$(n, e, t, r, a) {
24367
24367
  a?.throwIfAborted();
24368
24368
  const o = n.pop();
24369
24369
  if (o?.role !== "user")
24370
- throw Re.warn("expected last message to be a user message", o), new Error("expected last message to be a user message");
24370
+ throw Ne.warn("expected last message to be a user message", o), new Error("expected last message to be a user message");
24371
24371
  const c = K$(e), u = {
24372
24372
  model: aE,
24373
24373
  history: n,
@@ -29457,7 +29457,7 @@ function mW(n, e) {
29457
29457
  continue;
29458
29458
  const a = JSON.stringify(e.toolUse.input), i = Array.isArray(t.on["input.contains"]) ? t.on["input.contains"] : [t.on["input.contains"]];
29459
29459
  for (const s of i)
29460
- if (a.includes(s) && (Re.debug(`Hook triggered: ${t.id}`, {
29460
+ if (a.includes(s) && (Ne.debug(`Hook triggered: ${t.id}`, {
29461
29461
  hookID: t.id,
29462
29462
  threadID: e.threadID,
29463
29463
  toolName: e.toolUse.name,
@@ -29492,7 +29492,7 @@ async function gW(n, e) {
29492
29492
  }
29493
29493
  }
29494
29494
  async function hW(n, e) {
29495
- return (await import("./list_directory.node-B8bOIV1q.js")).resolveArgumentDirectoryNode(n, e);
29495
+ return (await import("./list_directory.node-CydlY2iC.js")).resolveArgumentDirectoryNode(n, e);
29496
29496
  }
29497
29497
  class EW extends Nd {
29498
29498
  #e = new AbortController();
@@ -30116,7 +30116,7 @@ function RW(n) {
30116
30116
  try {
30117
30117
  n._regex = new RegExp(n.pattern, n.caseInsensitive ? "gi" : "g");
30118
30118
  } catch (e) {
30119
- Re.warn("Error compiling regex", { pattern: n.id, error: e }), n._regex = new RegExp("$^");
30119
+ Ne.warn("Error compiling regex", { pattern: n.id, error: e }), n._regex = new RegExp("$^");
30120
30120
  }
30121
30121
  return n._regex;
30122
30122
  }
@@ -30981,14 +30981,14 @@ function OW(n, e) {
30981
30981
  }
30982
30982
  case "user:tool-input": {
30983
30983
  if (!Qs(t, e.toolUse)) {
30984
- Re.debug(
30984
+ Ne.debug(
30985
30985
  `Ignoring user:tool-input delta for missing tool use ${e.toolUse} (likely deleted due to thread edit/truncation)`
30986
30986
  );
30987
30987
  break;
30988
30988
  }
30989
30989
  const a = ZN(t, e.toolUse);
30990
30990
  if (!a) {
30991
- Re.debug(
30991
+ Ne.debug(
30992
30992
  `Ignoring user:tool-input delta for missing tool result block ${e.toolUse} (likely deleted due to thread edit/truncation)`
30993
30993
  );
30994
30994
  break;
@@ -30998,7 +30998,7 @@ function OW(n, e) {
30998
30998
  }
30999
30999
  case "tool:data": {
31000
31000
  if (!JS(t, e.toolUse)) {
31001
- Re.debug(
31001
+ Ne.debug(
31002
31002
  `Ignoring tool:data delta for missing tool use ${e.toolUse} (likely deleted due to thread edit/truncation)`
31003
31003
  );
31004
31004
  break;
@@ -31010,13 +31010,13 @@ function OW(n, e) {
31010
31010
  case "tool:processed": {
31011
31011
  const r = JS(t, e.toolUse);
31012
31012
  if (!r) {
31013
- Re.debug(
31013
+ Ne.debug(
31014
31014
  `Ignoring tool:processed delta for missing tool use ${e.toolUse} (likely deleted due to thread edit/truncation)`
31015
31015
  );
31016
31016
  break;
31017
31017
  }
31018
31018
  const a = r.block.input;
31019
- Re.info("tool:processed - converted input", { from: a, to: e.newArgs }), r.block.input = e.newArgs, r.message.originalToolUseInput = {
31019
+ r.block.input = e.newArgs, r.message.originalToolUseInput = {
31020
31020
  ...r.message.originalToolUseInput,
31021
31021
  [e.toolUse]: a
31022
31022
  };
@@ -31145,13 +31145,13 @@ function OW(n, e) {
31145
31145
  else
31146
31146
  for (const s of i.content)
31147
31147
  if (s.type === "tool_use" && s.inputPartialJSON) {
31148
- Re.debug(
31148
+ Ne.debug(
31149
31149
  "Found a block with inputPartialJSON still set on message_delta"
31150
31150
  );
31151
31151
  try {
31152
31152
  s.inputPartialJSON.json !== "" ? s.input = JSON.parse(s.inputPartialJSON.json) : s.input = {};
31153
31153
  } catch (o) {
31154
- Re.error(
31154
+ Ne.error(
31155
31155
  `Failed to parse malformed JSON for tool_use ${s.id}`,
31156
31156
  o,
31157
31157
  {
@@ -31217,7 +31217,7 @@ function Du(n) {
31217
31217
  ) && (e.state = { type: "cancelled" }, t = !0), t) {
31218
31218
  for (const r of e.content)
31219
31219
  if (r.type === "tool_use" && r.inputPartialJSON) {
31220
- Re.debug(`Cleaning up partial tool_use ${r.id}`, {
31220
+ Ne.debug(`Cleaning up partial tool_use ${r.id}`, {
31221
31221
  name: "markPriorStreamingAssistantMessageAsCancelled",
31222
31222
  threadID: n.id,
31223
31223
  blockID: r.id
@@ -31225,7 +31225,7 @@ function Du(n) {
31225
31225
  try {
31226
31226
  r.inputPartialJSON.json !== "" ? r.input = Bd(r.inputPartialJSON.json) : r.input = {};
31227
31227
  } catch (a) {
31228
- Re.warn(
31228
+ Ne.warn(
31229
31229
  `Failed to parse partial JSON for cancelled tool_use ${r.id}:`,
31230
31230
  a,
31231
31231
  {
@@ -31484,7 +31484,7 @@ async function UW({
31484
31484
  fileMentions: void 0,
31485
31485
  userState: void 0
31486
31486
  };
31487
- const i = (await import("./files-DrSncnX3.js").then(
31487
+ const i = (await import("./files-URI9_POf.js").then(
31488
31488
  ({ getFileMentions: o }) => o(
31489
31489
  JN(t.content),
31490
31490
  a,
@@ -31583,9 +31583,9 @@ class Nl {
31583
31583
  else {
31584
31584
  const a = e.createFileSystem(t);
31585
31585
  try {
31586
- await a.cleanupBackupFiles(), Re.debug(`Cleaned up backup files for thread ${t}`, { threadID: t });
31586
+ await a.cleanupBackupFiles(), Ne.debug(`Cleaned up backup files for thread ${t}`, { threadID: t });
31587
31587
  } catch (i) {
31588
- Re.error("Error cleaning up thread backups", i, { threadID: t });
31588
+ Ne.error("Error cleaning up thread backups", i, { threadID: t });
31589
31589
  }
31590
31590
  }
31591
31591
  }
@@ -31607,7 +31607,7 @@ class Nl {
31607
31607
  this.findAndCancelToolRun(t.toolUseID);
31608
31608
  continue;
31609
31609
  }
31610
- Re.debug(`re-invoking tool ${a.name} with ID ${t.toolUseID}`, {
31610
+ Ne.debug(`re-invoking tool ${a.name} with ID ${t.toolUseID}`, {
31611
31611
  name: "resumeInProgressTools",
31612
31612
  threadID: this.threadID
31613
31613
  }), this.invokeTool(a, t.userInput);
@@ -31629,7 +31629,7 @@ class Nl {
31629
31629
  * Scan thread history and track all file mentions and tool result files
31630
31630
  */
31631
31631
  trackFilesFromHistory() {
31632
- Re.debug("Tracking files from thread history", {
31632
+ Ne.debug("Tracking files from thread history", {
31633
31633
  name: "trackFilesFromHistory",
31634
31634
  threadID: this.threadID
31635
31635
  });
@@ -31665,7 +31665,7 @@ class Nl {
31665
31665
  try {
31666
31666
  await this.deps.threadHistoryService.delete(i.threadID);
31667
31667
  } catch (s) {
31668
- Re.error(
31668
+ Ne.error(
31669
31669
  `Failed to delete Task tool sub-thread: ${i.threadID}`,
31670
31670
  s,
31671
31671
  {
@@ -31675,7 +31675,7 @@ class Nl {
31675
31675
  );
31676
31676
  }
31677
31677
  else
31678
- Re.warn(
31678
+ Ne.warn(
31679
31679
  `Cannot delete Task tool sub-thread: ${i.threadID} - threadHistoryService not available`,
31680
31680
  {
31681
31681
  threadID: this.threadID,
@@ -31818,21 +31818,21 @@ class Nl {
31818
31818
  this.handlePromise = this.handlePromise.then(async () => {
31819
31819
  await this.innerHandle(e, t);
31820
31820
  }).catch((r) => {
31821
- Re.error("Unhandled error in handle promise queue", r, {
31821
+ Ne.error("Unhandled error in handle promise queue", r, {
31822
31822
  threadID: this.threadID
31823
31823
  });
31824
31824
  }), await this.handlePromise;
31825
31825
  }
31826
31826
  async innerHandle(e, t) {
31827
31827
  if (this.isDisposed) {
31828
- Re.debug(`Skipping ${e.type} - worker disposed.`, {
31828
+ Ne.debug(`Skipping ${e.type} - worker disposed.`, {
31829
31829
  name: "handle queue",
31830
31830
  threadID: this.threadID
31831
31831
  });
31832
31832
  return;
31833
31833
  }
31834
31834
  if (t?.aborted) {
31835
- Re.debug(`Skipping ${e.type} - signal aborted.`, {
31835
+ Ne.debug(`Skipping ${e.type} - signal aborted.`, {
31836
31836
  name: "handle queue",
31837
31837
  threadID: this.threadID
31838
31838
  });
@@ -31852,7 +31852,7 @@ class Nl {
31852
31852
  e.message = await UW(
31853
31853
  { configService: this.deps.configService, filesystem: this.filesystem },
31854
31854
  e.message
31855
- ), e.message.fileMentions?.imageBlocks?.length && (Re.debug(
31855
+ ), e.message.fileMentions?.imageBlocks?.length && (Ne.debug(
31856
31856
  `Adding ${e.message.fileMentions.imageBlocks.length} image attachments to message`,
31857
31857
  {
31858
31858
  name: "adding image attachments",
@@ -31866,10 +31866,10 @@ class Nl {
31866
31866
  try {
31867
31867
  this.ephemeralError.getValue() !== void 0 && this.ephemeralError.next(void 0), this.updateThread(e), this.onThreadDelta(e);
31868
31868
  } catch (r) {
31869
- vf(r) ? Re.debug(`AbortError caught during handle processing for ${e.type}.`, {
31869
+ vf(r) ? Ne.debug(`AbortError caught during handle processing for ${e.type}.`, {
31870
31870
  name: "handle queue",
31871
31871
  threadID: this.threadID
31872
- }) : (Re.error("Ephemeral error during handle processing", r, {
31872
+ }) : (Ne.error("Ephemeral error during handle processing", r, {
31873
31873
  name: "ThreadWorker",
31874
31874
  threadID: this.threadID
31875
31875
  }), this.ephemeralError.next(r instanceof Error ? r : new Error(String(r))));
@@ -31894,11 +31894,11 @@ class Nl {
31894
31894
  for (const r of t.content)
31895
31895
  if (r.type === "tool_result" && r.run.status === "done")
31896
31896
  for (const a of r.run.files ?? [])
31897
- Re.info(`tracking (again) ${a}`, {
31897
+ Ne.info(`tracking (again) ${a}`, {
31898
31898
  threadID: this.threadID
31899
31899
  }), this.trackFile(a);
31900
31900
  for (const r of t.fileMentions?.files ?? [])
31901
- Re.debug(`file: ${r.path}`, {
31901
+ Ne.debug(`file: ${r.path}`, {
31902
31902
  name: "tracking file mention",
31903
31903
  threadID: this.threadID
31904
31904
  }), this.trackFile(r.path);
@@ -31906,7 +31906,7 @@ class Nl {
31906
31906
  });
31907
31907
  else
31908
31908
  for (const t of e.message.fileMentions?.files ?? [])
31909
- Re.debug(`file: ${t.path}`, {
31909
+ Ne.debug(`file: ${t.path}`, {
31910
31910
  name: "tracking file mention",
31911
31911
  threadID: this.threadID
31912
31912
  }), this.trackFile(t.path);
@@ -31924,7 +31924,7 @@ class Nl {
31924
31924
  r && this.registerSubthread(e.toolUse, r);
31925
31925
  }
31926
31926
  const t = o0(this.thread, e.toolUse);
31927
- Re.debug(
31927
+ Ne.debug(
31928
31928
  `updated tool_result${t ? " and running inference because all tools completed" : ""}`,
31929
31929
  {
31930
31930
  name: `handleThreadDelta(${e.type}, ${e.toolUse}, ${e.data.status})`,
@@ -31935,7 +31935,7 @@ class Nl {
31935
31935
  }
31936
31936
  case "assistant:message": {
31937
31937
  const t = this.findToolUsesNeedingInvocation(e.message);
31938
- Re.debug(
31938
+ Ne.debug(
31939
31939
  `saw ${t.length} tool uses (${t.map((r) => r.name).join(", ")})`,
31940
31940
  { name: `handleThreadDelta(${e.type})`, threadID: this.threadID }
31941
31941
  );
@@ -31945,10 +31945,10 @@ class Nl {
31945
31945
  }
31946
31946
  case "assistant:message-delta": {
31947
31947
  if (e.event.type === "message_start")
31948
- Re.debug("token usage", e.event.message.usage);
31948
+ Ne.debug("token usage", e.event.message.usage);
31949
31949
  else if (e.event.type === "message_delta" && e.inferenceStart && e.event.usage?.output_tokens) {
31950
31950
  const i = performance.now() - e.inferenceStart;
31951
- Re.debug("completed message", {
31951
+ Ne.debug("completed message", {
31952
31952
  outputTokens: e.event.usage.output_tokens,
31953
31953
  tokensPerSecond: e.event.usage.output_tokens / i * 1e3,
31954
31954
  inferenceDuration: PB(i)
@@ -31988,7 +31988,7 @@ class Nl {
31988
31988
  if (s)
31989
31989
  return;
31990
31990
  }
31991
- Re.debug("Invoking tool", {
31991
+ Ne.debug("Invoking tool", {
31992
31992
  name: "invokeTool",
31993
31993
  threadID: this.threadID,
31994
31994
  toolUse: e,
@@ -32036,12 +32036,12 @@ class Nl {
32036
32036
  })
32037
32037
  ).subscribe({
32038
32038
  next: async (m) => {
32039
- if (Re.debug(`${e.id}, ${m.status}`, {
32039
+ if (Ne.debug(`${e.id}, ${m.status}`, {
32040
32040
  name: "invokeTool",
32041
32041
  threadID: this.threadID
32042
32042
  }), ec(m) && (delete this.ops.tools[e.id], h.unsubscribe(), m.status === "done" && m.files?.length))
32043
32043
  for (const f of m.files)
32044
- Re.debug(`file: ${f}`, {
32044
+ Ne.debug(`file: ${f}`, {
32045
32045
  name: "tracking file from tool call",
32046
32046
  threadID: this.threadID
32047
32047
  }), this.trackFile(f);
@@ -32111,7 +32111,7 @@ class Nl {
32111
32111
  PW(a, e.signal).then((i) => {
32112
32112
  e.signal.aborted || this.isDisposed || this.thread.title !== i && this.updateThread({ type: "title", value: i });
32113
32113
  }).catch((i) => {
32114
- vf(i) || Re.error("generateThreadTitle error", i, {
32114
+ vf(i) || Ne.error("generateThreadTitle error", i, {
32115
32115
  name: "ThreadWorker",
32116
32116
  threadID: this.threadID
32117
32117
  });
@@ -32124,7 +32124,7 @@ class Nl {
32124
32124
  }
32125
32125
  });
32126
32126
  }).catch((i) => {
32127
- Re.error("Failed to initialize thread environment", i, {
32127
+ Ne.error("Failed to initialize thread environment", i, {
32128
32128
  threadID: this.threadID
32129
32129
  });
32130
32130
  });
@@ -32228,7 +32228,7 @@ class Nl {
32228
32228
  if (!Qs(this.thread, e)) return;
32229
32229
  const a = this.ops.toolMessages[e];
32230
32230
  if (!a) {
32231
- Re.warn("unable to detach tool use, missing toolMessages", { id: e });
32231
+ Ne.warn("unable to detach tool use, missing toolMessages", { id: e });
32232
32232
  return;
32233
32233
  }
32234
32234
  a.next(t);
@@ -32243,7 +32243,7 @@ class Nl {
32243
32243
  }
32244
32244
  async cancelTool(e, t) {
32245
32245
  const r = this.cancelDataForToolRun(e);
32246
- this.abortToolOp(e), this.cancelSubthread(e), Re.debug(`cancelToolRun(${e})`), await this.handle(
32246
+ this.abortToolOp(e), this.cancelSubthread(e), Ne.debug(`cancelToolRun(${e})`), await this.handle(
32247
32247
  {
32248
32248
  type: "tool:data",
32249
32249
  toolUse: e,
@@ -32253,13 +32253,13 @@ class Nl {
32253
32253
  );
32254
32254
  }
32255
32255
  async cancel() {
32256
- Re.debug("cancel: aborting inference operation and tools"), this.cancelInference(), this.cancelUnstartedTools(), this.cancelInProgressTools(), await this.handle({ type: "cancelled" }, void 0);
32256
+ Ne.debug("cancel: aborting inference operation and tools"), this.cancelInference(), this.cancelUnstartedTools(), this.cancelInProgressTools(), await this.handle({ type: "cancelled" }, void 0);
32257
32257
  }
32258
32258
  cancelInference() {
32259
32259
  this.ops.inference && (this.ops.inference.abort(new Error(jN.USER_CANCELLED)), this.ops.inference = null), this.inferenceState.next("cancelled");
32260
32260
  }
32261
32261
  async retry() {
32262
- Re.debug("retry: retrying inference operation"), this.ephemeralError.getValue() !== void 0 && this.ephemeralError.next(void 0), this.ops.inference && (this.ops.inference.abort(), this.ops.inference = null), this.inferenceState.next("idle"), await this.runInferenceAndUpdateThread();
32262
+ Ne.debug("retry: retrying inference operation"), this.ephemeralError.getValue() !== void 0 && this.ephemeralError.next(void 0), this.ops.inference && (this.ops.inference.abort(), this.ops.inference = null), this.inferenceState.next("idle"), await this.runInferenceAndUpdateThread();
32263
32263
  }
32264
32264
  cancelSubthread(e) {
32265
32265
  const t = this.subthreads.get(e);
@@ -32279,16 +32279,16 @@ class Nl {
32279
32279
  t.map((a) => a.fsPath),
32280
32280
  e
32281
32281
  ) : await Lw(this.filesystem, t, e);
32282
- Re.debug("tracking file", { absolutePath: r }), this.trackedFiles.add(r);
32282
+ Ne.debug("tracking file", { absolutePath: r }), this.trackedFiles.add(r);
32283
32283
  }
32284
32284
  async restoreFileChangesFromBackups() {
32285
32285
  try {
32286
32286
  const e = await OU(this.filesystem);
32287
32287
  for (const [t, r] of e.toolDiffs.entries())
32288
32288
  this.fileChangeRecords.set(t, r);
32289
- Re.debug(`Restored ${e.toolDiffs.size} file changes from disk`), await this.updateFileChanges();
32289
+ Ne.debug(`Restored ${e.toolDiffs.size} file changes from disk`), await this.updateFileChanges();
32290
32290
  } catch (e) {
32291
- Re.error("Error restoring file changes", e, { threadID: this.threadID });
32291
+ Ne.error("Error restoring file changes", e, { threadID: this.threadID });
32292
32292
  }
32293
32293
  }
32294
32294
  createToolUseFileChangeTracker(e) {
@@ -32435,7 +32435,7 @@ function GW(n, e, t) {
32435
32435
  },
32436
32436
  h
32437
32437
  ), o = i.status.pipe(AN((f) => f.state === "active")).subscribe((f) => {
32438
- a || (Re.warn("inferenceSTate", f.inferenceState), f.ephemeralError && (r.next({
32438
+ a || (Ne.warn("inferenceSTate", f.inferenceState), f.ephemeralError && (r.next({
32439
32439
  status: "error",
32440
32440
  progress: { threadID: h },
32441
32441
  error: {
@@ -32493,7 +32493,7 @@ function GW(n, e, t) {
32493
32493
  }
32494
32494
  });
32495
32495
  })().catch((h) => {
32496
- Re.warn("down here!!!"), a || (r.error(h), u());
32496
+ Ne.warn("down here!!!"), a || (r.error(h), u());
32497
32497
  }), u;
32498
32498
  });
32499
32499
  }
@@ -32632,7 +32632,7 @@ function hO() {
32632
32632
  try {
32633
32633
  return c(i, s);
32634
32634
  } catch (u) {
32635
- Re.error("preprocessArgs", { id: a, args: i, error: String(u) });
32635
+ Ne.error("preprocessArgs", { id: a, args: i, error: String(u) });
32636
32636
  return;
32637
32637
  }
32638
32638
  },
@@ -32677,7 +32677,7 @@ Returns a git-style diff showing the changes that were undone as formatted markd
32677
32677
  switch ("node") {
32678
32678
  case "node":
32679
32679
  case "vscode":
32680
- return import("./undo_edit.node-CCYYuJ4U.js").then(({ nodeUndoEditTool: n }) => n);
32680
+ return import("./undo_edit.node-CR56HIq6.js").then(({ nodeUndoEditTool: n }) => n);
32681
32681
  }
32682
32682
  })()
32683
32683
  }, iy = globalThis.window?.document !== void 0;
@@ -68167,8 +68167,8 @@ function VX() {
68167
68167
  D || (D = this.treeAdapter.createElement(f.TEMPLATE, S.HTML, []));
68168
68168
  const ae = this.treeAdapter.createElement("documentmock", S.HTML, []);
68169
68169
  this._bootstrap(ae, D), this.treeAdapter.getTagName(D) === f.TEMPLATE && this._pushTmplInsertionMode(lt), this._initTokenizerForFragmentParsing(), this._insertFakeRootElement(), this._resetInsertionMode(), this._findFormInFragmentContext(), this.tokenizer.write(C, !0), this._runParsingLoop(null);
68170
- const Ne = this.treeAdapter.getFirstChild(ae), Ze = this.treeAdapter.createDocumentFragment();
68171
- return this._adoptNodes(Ne, Ze), Ze;
68170
+ const Re = this.treeAdapter.getFirstChild(ae), Ze = this.treeAdapter.createDocumentFragment();
68171
+ return this._adoptNodes(Re, Ze), Ze;
68172
68172
  }
68173
68173
  //Bootstrap parser
68174
68174
  _bootstrap(C, D) {
@@ -68235,8 +68235,8 @@ function VX() {
68235
68235
  }
68236
68236
  //Tree mutation
68237
68237
  _setDocumentType(C) {
68238
- const D = C.name || "", ae = C.publicId || "", Ne = C.systemId || "";
68239
- this.treeAdapter.setDocumentType(this.document, D, ae, Ne);
68238
+ const D = C.name || "", ae = C.publicId || "", Re = C.systemId || "";
68239
+ this.treeAdapter.setDocumentType(this.document, D, ae, Re);
68240
68240
  }
68241
68241
  _attachElementToTree(C) {
68242
68242
  if (this._shouldFosterParentOnInsertion())
@@ -68290,8 +68290,8 @@ function VX() {
68290
68290
  const ae = this.treeAdapter.getNamespaceURI(D);
68291
68291
  if (ae === S.HTML || this.treeAdapter.getTagName(D) === f.ANNOTATION_XML && ae === S.MATHML && C.type === n.START_TAG_TOKEN && C.tagName === f.SVG)
68292
68292
  return !1;
68293
- const Ne = C.type === n.CHARACTER_TOKEN || C.type === n.NULL_CHARACTER_TOKEN || C.type === n.WHITESPACE_CHARACTER_TOKEN;
68294
- return (C.type === n.START_TAG_TOKEN && C.tagName !== f.MGLYPH && C.tagName !== f.MALIGNMARK || Ne) && this._isIntegrationPoint(D, S.MATHML) || (C.type === n.START_TAG_TOKEN || Ne) && this._isIntegrationPoint(D, S.HTML) ? !1 : C.type !== n.EOF_TOKEN;
68293
+ const Re = C.type === n.CHARACTER_TOKEN || C.type === n.NULL_CHARACTER_TOKEN || C.type === n.WHITESPACE_CHARACTER_TOKEN;
68294
+ return (C.type === n.START_TAG_TOKEN && C.tagName !== f.MGLYPH && C.tagName !== f.MALIGNMARK || Re) && this._isIntegrationPoint(D, S.MATHML) || (C.type === n.START_TAG_TOKEN || Re) && this._isIntegrationPoint(D, S.HTML) ? !1 : C.type !== n.EOF_TOKEN;
68295
68295
  }
68296
68296
  _processToken(C) {
68297
68297
  Jt[this.insertionMode][C.type](this, C);
@@ -68307,8 +68307,8 @@ function VX() {
68307
68307
  }
68308
68308
  //Integration points
68309
68309
  _isIntegrationPoint(C, D) {
68310
- const ae = this.treeAdapter.getTagName(C), Ne = this.treeAdapter.getNamespaceURI(C), Ze = this.treeAdapter.getAttrList(C);
68311
- return u.isIntegrationPoint(ae, Ne, Ze, D);
68310
+ const ae = this.treeAdapter.getTagName(C), Re = this.treeAdapter.getNamespaceURI(C), Ze = this.treeAdapter.getAttrList(C);
68311
+ return u.isIntegrationPoint(ae, Re, Ze, D);
68312
68312
  }
68313
68313
  //Active formatting elements reconstruction
68314
68314
  _reconstructActiveFormattingElements() {
@@ -68321,8 +68321,8 @@ function VX() {
68321
68321
  break;
68322
68322
  }
68323
68323
  while (D > 0);
68324
- for (let Ne = D; Ne < C; Ne++)
68325
- ae = this.activeFormattingElements.entries[Ne], this._insertElement(ae.token, this.treeAdapter.getNamespaceURI(ae.element)), ae.element = this.openElements.current;
68324
+ for (let Re = D; Re < C; Re++)
68325
+ ae = this.activeFormattingElements.entries[Re], this._insertElement(ae.token, this.treeAdapter.getNamespaceURI(ae.element)), ae.element = this.openElements.current;
68326
68326
  }
68327
68327
  }
68328
68328
  //Close elements
@@ -68337,23 +68337,23 @@ function VX() {
68337
68337
  for (let C = this.openElements.stackTop, D = !1; C >= 0; C--) {
68338
68338
  let ae = this.openElements.items[C];
68339
68339
  C === 0 && (D = !0, this.fragmentContext && (ae = this.fragmentContext));
68340
- const Ne = this.treeAdapter.getTagName(ae), Ze = Pn[Ne];
68340
+ const Re = this.treeAdapter.getTagName(ae), Ze = Pn[Re];
68341
68341
  if (Ze) {
68342
68342
  this.insertionMode = Ze;
68343
68343
  break;
68344
- } else if (!D && (Ne === f.TD || Ne === f.TH)) {
68344
+ } else if (!D && (Re === f.TD || Re === f.TH)) {
68345
68345
  this.insertionMode = _t;
68346
68346
  break;
68347
- } else if (!D && Ne === f.HEAD) {
68347
+ } else if (!D && Re === f.HEAD) {
68348
68348
  this.insertionMode = O;
68349
68349
  break;
68350
- } else if (Ne === f.SELECT) {
68350
+ } else if (Re === f.SELECT) {
68351
68351
  this._resetInsertionModeForSelect(C);
68352
68352
  break;
68353
- } else if (Ne === f.TEMPLATE) {
68353
+ } else if (Re === f.TEMPLATE) {
68354
68354
  this.insertionMode = this.currentTmplInsertionMode;
68355
68355
  break;
68356
- } else if (Ne === f.HTML) {
68356
+ } else if (Re === f.HTML) {
68357
68357
  this.insertionMode = this.headElement ? q : T;
68358
68358
  break;
68359
68359
  } else if (D) {
@@ -68365,10 +68365,10 @@ function VX() {
68365
68365
  _resetInsertionModeForSelect(C) {
68366
68366
  if (C > 0)
68367
68367
  for (let D = C - 1; D > 0; D--) {
68368
- const ae = this.openElements.items[D], Ne = this.treeAdapter.getTagName(ae);
68369
- if (Ne === f.TEMPLATE)
68368
+ const ae = this.openElements.items[D], Re = this.treeAdapter.getTagName(ae);
68369
+ if (Re === f.TEMPLATE)
68370
68370
  break;
68371
- if (Ne === f.TABLE) {
68371
+ if (Re === f.TABLE) {
68372
68372
  this.insertionMode = Gt;
68373
68373
  return;
68374
68374
  }
@@ -68395,11 +68395,11 @@ function VX() {
68395
68395
  beforeElement: null
68396
68396
  };
68397
68397
  for (let D = this.openElements.stackTop; D >= 0; D--) {
68398
- const ae = this.openElements.items[D], Ne = this.treeAdapter.getTagName(ae), Ze = this.treeAdapter.getNamespaceURI(ae);
68399
- if (Ne === f.TEMPLATE && Ze === S.HTML) {
68398
+ const ae = this.openElements.items[D], Re = this.treeAdapter.getTagName(ae), Ze = this.treeAdapter.getNamespaceURI(ae);
68399
+ if (Re === f.TEMPLATE && Ze === S.HTML) {
68400
68400
  C.parent = this.treeAdapter.getTemplateContent(ae);
68401
68401
  break;
68402
- } else if (Ne === f.TABLE) {
68402
+ } else if (Re === f.TABLE) {
68403
68403
  C.parent = this.treeAdapter.getParentNode(ae), C.parent ? C.beforeElement = ae : C.parent = this.openElements.items[D - 1];
68404
68404
  break;
68405
68405
  }
@@ -68428,17 +68428,17 @@ function VX() {
68428
68428
  function nn(y, C) {
68429
68429
  let D = null;
68430
68430
  for (let ae = y.openElements.stackTop; ae >= 0; ae--) {
68431
- const Ne = y.openElements.items[ae];
68432
- if (Ne === C.element)
68431
+ const Re = y.openElements.items[ae];
68432
+ if (Re === C.element)
68433
68433
  break;
68434
- y._isSpecialElement(Ne) && (D = Ne);
68434
+ y._isSpecialElement(Re) && (D = Re);
68435
68435
  }
68436
68436
  return D || (y.openElements.popUntilElementPopped(C.element), y.activeFormattingElements.removeEntry(C)), D;
68437
68437
  }
68438
68438
  function $n(y, C, D) {
68439
- let ae = C, Ne = y.openElements.getCommonAncestor(C);
68440
- for (let Ze = 0, Qn = Ne; Qn !== D; Ze++, Qn = Ne) {
68441
- Ne = y.openElements.getCommonAncestor(Qn);
68439
+ let ae = C, Re = y.openElements.getCommonAncestor(C);
68440
+ for (let Ze = 0, Qn = Re; Qn !== D; Ze++, Qn = Re) {
68441
+ Re = y.openElements.getCommonAncestor(Qn);
68442
68442
  const gi = y.activeFormattingElements.getElementEntry(Qn), ma = gi && Ze >= P;
68443
68443
  !gi || ma ? (ma && y.activeFormattingElements.removeEntry(gi), y.openElements.remove(Qn)) : (Qn = pt(y, gi), ae === C && (y.activeFormattingElements.bookmark = gi), y.treeAdapter.detachNode(ae), y.treeAdapter.appendChild(Qn, ae), ae = Qn);
68444
68444
  }
@@ -68452,23 +68452,23 @@ function VX() {
68452
68452
  if (y._isElementCausesFosterParenting(C))
68453
68453
  y._fosterParentElement(D);
68454
68454
  else {
68455
- const ae = y.treeAdapter.getTagName(C), Ne = y.treeAdapter.getNamespaceURI(C);
68456
- ae === f.TEMPLATE && Ne === S.HTML && (C = y.treeAdapter.getTemplateContent(C)), y.treeAdapter.appendChild(C, D);
68455
+ const ae = y.treeAdapter.getTagName(C), Re = y.treeAdapter.getNamespaceURI(C);
68456
+ ae === f.TEMPLATE && Re === S.HTML && (C = y.treeAdapter.getTemplateContent(C)), y.treeAdapter.appendChild(C, D);
68457
68457
  }
68458
68458
  }
68459
68459
  function yn(y, C, D) {
68460
- const ae = y.treeAdapter.getNamespaceURI(D.element), Ne = D.token, Ze = y.treeAdapter.createElement(Ne.tagName, ae, Ne.attrs);
68460
+ const ae = y.treeAdapter.getNamespaceURI(D.element), Re = D.token, Ze = y.treeAdapter.createElement(Re.tagName, ae, Re.attrs);
68461
68461
  y._adoptNodes(C, Ze), y.treeAdapter.appendChild(C, Ze), y.activeFormattingElements.insertElementAfterBookmark(Ze, D.token), y.activeFormattingElements.removeEntry(D), y.openElements.remove(D.element), y.openElements.insertAfter(C, Ze);
68462
68462
  }
68463
68463
  function St(y, C) {
68464
68464
  let D;
68465
68465
  for (let ae = 0; ae < x && (D = Yt(y, C), !!D); ae++) {
68466
- const Ne = nn(y, D);
68467
- if (!Ne)
68466
+ const Re = nn(y, D);
68467
+ if (!Re)
68468
68468
  break;
68469
68469
  y.activeFormattingElements.bookmark = D;
68470
- const Ze = $n(y, Ne, D.element), Qn = y.openElements.getCommonAncestor(D.element);
68471
- y.treeAdapter.detachNode(Ze), Mt(y, Qn, Ze), yn(y, Ne, D);
68470
+ const Ze = $n(y, Re, D.element), Qn = y.openElements.getCommonAncestor(D.element);
68471
+ y.treeAdapter.detachNode(Ze), Mt(y, Qn, Ze), yn(y, Re, D);
68472
68472
  }
68473
68473
  }
68474
68474
  function Ie() {
@@ -68590,13 +68590,13 @@ function VX() {
68590
68590
  y.framesetOk = !1;
68591
68591
  const D = C.tagName;
68592
68592
  for (let ae = y.openElements.stackTop; ae >= 0; ae--) {
68593
- const Ne = y.openElements.items[ae], Ze = y.treeAdapter.getTagName(Ne);
68593
+ const Re = y.openElements.items[ae], Ze = y.treeAdapter.getTagName(Re);
68594
68594
  let Qn = null;
68595
68595
  if (D === f.LI && Ze === f.LI ? Qn = f.LI : (D === f.DD || D === f.DT) && (Ze === f.DD || Ze === f.DT) && (Qn = Ze), Qn) {
68596
68596
  y.openElements.generateImpliedEndTagsWithExclusion(Qn), y.openElements.popUntilTagNamePopped(Qn);
68597
68597
  break;
68598
68598
  }
68599
- if (Ze !== f.ADDRESS && Ze !== f.DIV && Ze !== f.P && y._isSpecialElement(Ne))
68599
+ if (Ze !== f.ADDRESS && Ze !== f.DIV && Ze !== f.P && y._isSpecialElement(Re))
68600
68600
  break;
68601
68601
  }
68602
68602
  y.openElements.hasInButtonScope(f.P) && y._closePElement(), y._insertElement(C, S.HTML);
@@ -68750,12 +68750,12 @@ function VX() {
68750
68750
  function jn(y, C) {
68751
68751
  const D = C.tagName;
68752
68752
  for (let ae = y.openElements.stackTop; ae > 0; ae--) {
68753
- const Ne = y.openElements.items[ae];
68754
- if (y.treeAdapter.getTagName(Ne) === D) {
68755
- y.openElements.generateImpliedEndTagsWithExclusion(D), y.openElements.popUntilElementPopped(Ne);
68753
+ const Re = y.openElements.items[ae];
68754
+ if (y.treeAdapter.getTagName(Re) === D) {
68755
+ y.openElements.generateImpliedEndTagsWithExclusion(D), y.openElements.popUntilElementPopped(Re);
68756
68756
  break;
68757
68757
  }
68758
- if (y._isSpecialElement(Ne))
68758
+ if (y._isSpecialElement(Re))
68759
68759
  break;
68760
68760
  }
68761
68761
  }
@@ -68933,8 +68933,8 @@ function VX() {
68933
68933
  function sc(y, C) {
68934
68934
  const D = C.tagName;
68935
68935
  if (D === f.OPTGROUP) {
68936
- const ae = y.openElements.items[y.openElements.stackTop - 1], Ne = ae && y.treeAdapter.getTagName(ae);
68937
- y.openElements.currentTagName === f.OPTION && Ne === f.OPTGROUP && y.openElements.pop(), y.openElements.currentTagName === f.OPTGROUP && y.openElements.pop();
68936
+ const ae = y.openElements.items[y.openElements.stackTop - 1], Re = ae && y.treeAdapter.getTagName(ae);
68937
+ y.openElements.currentTagName === f.OPTION && Re === f.OPTGROUP && y.openElements.pop(), y.openElements.currentTagName === f.OPTGROUP && y.openElements.pop();
68938
68938
  } else D === f.OPTION ? y.openElements.currentTagName === f.OPTION && y.openElements.pop() : D === f.SELECT && y.openElements.hasInSelectScope(f.SELECT) ? (y.openElements.popUntilTagNamePopped(f.SELECT), y._resetInsertionMode()) : D === f.TEMPLATE && jt(y, C);
68939
68939
  }
68940
68940
  function Bt(y, C) {
@@ -76485,7 +76485,7 @@ class $Ae {
76485
76485
  ZO = t.width;
76486
76486
  try {
76487
76487
  const r = Nt(e, { async: !1 }).trimEnd();
76488
- return Re.info("marked output", { out: r }), r;
76488
+ return Ne.info("marked output", { out: r }), r;
76489
76489
  } catch {
76490
76490
  return e;
76491
76491
  }
@@ -76874,7 +76874,7 @@ export {
76874
76874
  d5 as $,
76875
76875
  LRe as A,
76876
76876
  _Re as B,
76877
- Re as C,
76877
+ Ne as C,
76878
76878
  z2 as D,
76879
76879
  Ua as E,
76880
76880
  lRe as F,
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import u from "node:path";
3
- import { p as d, aC as f, aD as l } from "./console-RPzEsLY0.js";
3
+ import { p as d, aC as f, aD as l } from "./console-Dvb4mlt2.js";
4
4
  const w = ({ args: t }, { dir: a, dirs: n, trackFileChange: c, filesystem: o }) => d(async (e) => {
5
5
  if (f(a), typeof t.content != "string")
6
6
  throw new Error("create_file: content must be specified");
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { p, aC as m, aD as F, aE as v, aF as _, aG as b } from "./console-RPzEsLY0.js";
3
- import { recordEdit as x } from "./undo_edit.node-CCYYuJ4U.js";
2
+ import { p, aC as m, aD as F, aE as v, aF as _, aG as b } from "./console-Dvb4mlt2.js";
3
+ import { recordEdit as x } from "./undo_edit.node-CR56HIq6.js";
4
4
  class E {
5
5
  #e = !1;
6
6
  #t = [];
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { existsSync as o } from "node:fs";
3
3
  import { createRequire as t } from "node:module";
4
- import { C as i } from "./console-RPzEsLY0.js";
4
+ import { C as i } from "./console-Dvb4mlt2.js";
5
5
  function u() {
6
6
  {
7
7
  if (process.env.AMP_RIPGREP_PATH)
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+ import T from "node:path";
3
+ import { b8 as B, b9 as I, C as v, ba as z, bb as C } from "./console-Dvb4mlt2.js";
4
+ async function A(r, h, a) {
5
+ const x = await a.listFiles(h), i = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), m = [], M = /\b([\w/_-]+(?:\\.|[\w/_-])*(?:\.[\w-]+)+)\b/g, F = /(\/(?:[\w-]+\/|[\w-]+\\[.\s\S])+[\w.-]+(?:\\.|[\w.-])*(?:\.[\w-]+)+)\b/g, y = /\b([A-Za-z]:[\\\\][^\s"'<>|]*(?:\.[\w-]+)+)\b/g;
6
+ await l(M, !1), await l(F, !0), await l(y, !0);
7
+ async function l(o, n) {
8
+ o.lastIndex = 0;
9
+ let s;
10
+ for (; (s = o.exec(r)) !== null; ) {
11
+ const [w] = s;
12
+ let e;
13
+ if (w.match(/^[A-Za-z]:[\\]/) !== null ? e = w : e = w.replace(/\\(.)/g, "$1"), i.has(e) || d.has(e)) {
14
+ u(e, s.index);
15
+ continue;
16
+ }
17
+ const c = n ? e : T.join(h, e);
18
+ if (!(!n && !x.includes(e))) {
19
+ if (n)
20
+ try {
21
+ await a.stat(c);
22
+ } catch {
23
+ continue;
24
+ }
25
+ try {
26
+ const t = await B(a, c);
27
+ if (t && I(t.mimeType)) {
28
+ d.set(e, t);
29
+ try {
30
+ const f = (await a.readBinaryFile(c)).toString("base64");
31
+ i.set(e, f);
32
+ } catch (g) {
33
+ v.error(
34
+ "Failed to read image as binary",
35
+ { path: e },
36
+ g
37
+ ), i.set(
38
+ e,
39
+ `[Image file: ${e} (${t.mimeType}, ${Math.round(t.size / 1024)} KB)]`
40
+ );
41
+ }
42
+ u(e, s.index);
43
+ } else {
44
+ if (await z(a, c))
45
+ continue;
46
+ const f = await a.readBinaryFile(c), p = D(f);
47
+ if (p === void 0)
48
+ continue;
49
+ i.set(e, p), u(e, s.index);
50
+ }
51
+ } catch {
52
+ continue;
53
+ }
54
+ }
55
+ }
56
+ }
57
+ function u(o, n) {
58
+ m.push({
59
+ path: o,
60
+ range: {
61
+ start: n,
62
+ end: n + o.length - 1
63
+ }
64
+ });
65
+ }
66
+ const b = new C(i, m);
67
+ return b.imageFiles = d, b;
68
+ }
69
+ function D(r) {
70
+ try {
71
+ return new TextDecoder("utf-8", { fatal: !0 }).decode(r);
72
+ } catch {
73
+ return;
74
+ }
75
+ }
76
+ export {
77
+ A as getFileMentions
78
+ };
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn as w } from "node:child_process";
3
- import { p as I } from "./index-C1JH-cfZ.js";
4
- import { O as v, g as N, m as E, aC as P, C as R } from "./console-RPzEsLY0.js";
5
- import { r as D } from "./executable-Cvv6G9ik.js";
3
+ import { p as I } from "./index-obyovEcz.js";
4
+ import { O as v, g as N, m as E, aC as P, C as R } from "./console-Dvb4mlt2.js";
5
+ import { r as D } from "./executable-BnwRQX_M.js";
6
6
  const S = ({ args: i }, { dirs: r }) => {
7
7
  if (r.length === 0)
8
8
  return new v((s) => {
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { z as xt } from "./console-RPzEsLY0.js";
2
+ import { z as xt } from "./console-Dvb4mlt2.js";
3
3
  var pt = {}, ft, Et;
4
4
  function ct() {
5
5
  if (Et) return ft;
@@ -2,7 +2,7 @@
2
2
  import c from "node:fs/promises";
3
3
  import u from "node:os";
4
4
  import s from "node:path";
5
- import { O as f, aH as i, aI as l, m, aJ as p } from "./console-RPzEsLY0.js";
5
+ import { O as f, aH as i, aI as l, m, aJ as p } from "./console-Dvb4mlt2.js";
6
6
  const D = ({ args: r }, { dirs: t }) => {
7
7
  if (t.length === 0)
8
8
  return new f((e) => {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import n from "node:os";
3
- import { O as r } from "./console-RPzEsLY0.js";
3
+ import { O as r } from "./console-Dvb4mlt2.js";
4
4
  const e = process.env;
5
5
  function i(t, o = "always") {
6
6
  return o === "never" ? r.of(e) : r.of(e);
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { O as je, s as Dr, c as dh, a as _r, b as Zn, f as We, d as kt, p as Dt, m as Ee, e as Bn, g as br, h as $t, i as sp, j as ph, o as ue, l as be, k as oe, n as re, q as ye, r as Ge, t as Ke, u as He, v as Xn, w as it, x as mh, y as lp, z as ei, A as up, M as Je, B as gh, C as J, N as Fn, D as ri, E as Jr, F as Ss, G as cp, H as fp, I as Es, J as hp, K as vh, L as dp, P as al, Q as Mt, R as pp, S as mp, T as gp, U as vp, V as yp, W as bp, X as wp, Y as _p, Z as Sp, _ as Ep, $ as Pp, a0 as Cp, a1 as Rp, a2 as xp, a3 as Tp, a4 as Op, a5 as Ap, a6 as Lp, a7 as Ip, a8 as Dp, a9 as at, aa as $p, ab as Mp, ac as yh, ad as Et, ae as ts, af as ns, ag as jn, ah as kp, ai as Fp, aj as jp, ak as qp, al as Ps, am as ol, an as Cs, ao as qr, ap as is, aq as Np, ar as Hp, as as sl, at as Up, au as Bp, av as as, aw as bh, ax as wh, ay as zp, az as Vp } from "./console-RPzEsLY0.js";
2
+ import { O as je, s as Dr, c as dh, a as _r, b as Zn, f as We, d as kt, p as Dt, m as Ee, e as Bn, g as br, h as $t, i as sp, j as ph, o as ue, l as be, k as oe, n as re, q as ye, r as Ge, t as Ke, u as He, v as Xn, w as it, x as mh, y as lp, z as ei, A as up, M as Je, B as gh, C as J, N as Fn, D as ri, E as Jr, F as Ss, G as cp, H as fp, I as Es, J as hp, K as vh, L as dp, P as al, Q as Mt, R as pp, S as mp, T as gp, U as vp, V as yp, W as bp, X as wp, Y as _p, Z as Sp, _ as Ep, $ as Pp, a0 as Cp, a1 as Rp, a2 as xp, a3 as Tp, a4 as Op, a5 as Ap, a6 as Lp, a7 as Ip, a8 as Dp, a9 as at, aa as $p, ab as Mp, ac as yh, ad as Et, ae as ts, af as ns, ag as jn, ah as kp, ai as Fp, aj as jp, ak as qp, al as Ps, am as ol, an as Cs, ao as qr, ap as is, aq as Np, ar as Hp, as as sl, at as Up, au as Bp, av as as, aw as bh, ax as wh, ay as zp, az as Vp } from "./console-Dvb4mlt2.js";
3
3
  import * as Wp from "node:fs/promises";
4
4
  import tt, { readdir as _h, stat as Sh, readFile as Or, mkdir as zn, writeFile as Tt, unlink as Gp, readlink as Kp, open as Jp } from "node:fs/promises";
5
5
  import * as Yp from "node:path";
6
6
  import me, { join as ze, dirname as ll } from "node:path";
7
- import { i as ul, F as yi, f as wr, a as Qp } from "./client-D82aFqMl.js";
7
+ import { i as ul, F as yi, f as wr, a as Qp } from "./client-D-IY-U_F.js";
8
8
  import Rs from "node:events";
9
9
  import * as Zp from "node:child_process";
10
10
  import Xp, { execFile as Eh, spawn as ti, exec as Nr } from "node:child_process";
@@ -18,7 +18,7 @@ import fm, { createGzip as hm } from "node:zlib";
18
18
  import dm from "node:string_decoder";
19
19
  import pm, { createServer as Ph } from "node:http";
20
20
  import mm from "node:https";
21
- import { r as gm } from "./executable-Cvv6G9ik.js";
21
+ import { r as gm } from "./executable-BnwRQX_M.js";
22
22
  import { pipeline as vm } from "node:stream/promises";
23
23
  import { lookup as ym } from "node:dns";
24
24
  const Ir = Symbol.for("@@pendingOperation");
@@ -4991,10 +4991,10 @@ async function Nv(t, e, n) {
4991
4991
  if ("url" in t)
4992
4992
  i = new jv(new URL(t.url));
4993
4993
  else {
4994
- const { loadProfileEnvironmentVariables: r } = await import("./load-profile-CgexvkzB.js"), a = n.loadProfile === "never" || !n.workingDirectory ? process.env : await We(
4994
+ const { loadProfileEnvironmentVariables: r } = await import("./load-profile-DfwAD194.js"), a = n.loadProfile === "never" || !n.workingDirectory ? process.env : await We(
4995
4995
  r(n.workingDirectory, n.loadProfile)
4996
4996
  );
4997
- i = await import("./stdio-DLKijHcf.js").then(
4997
+ i = await import("./stdio-DGe7LHrZ.js").then(
4998
4998
  ({ StdioClientTransport: s }) => new s({
4999
4999
  ...t,
5000
5000
  stderr: "pipe",
@@ -5755,7 +5755,7 @@ IMPORTANT: The result of this tool (if any) should be displayed directly to the
5755
5755
  },
5756
5756
  source: "builtin"
5757
5757
  },
5758
- fn: import("./node-DLr9sIY3.js").then(({ runRoutine: t }) => t)
5758
+ fn: import("./node-BI8YryFs.js").then(({ runRoutine: t }) => t)
5759
5759
  };
5760
5760
  let hu = !1;
5761
5761
  async function ed(t, e = !1) {
@@ -17638,7 +17638,7 @@ async function Ur(t, e, { stdin: n, stdout: i } = { stdin: process.stdin, stdout
17638
17638
  n.on("data", u), n.once("error", o);
17639
17639
  });
17640
17640
  }
17641
- const Bd = import("./node-BIJw0rpH.js").then(
17641
+ const Bd = import("./node-CeVAo09v.js").then(
17642
17642
  ({ nodeFileSystem: t }) => t
17643
17643
  ), Qo = Ft(Zp.exec);
17644
17644
  async function cw(t) {
@@ -18792,7 +18792,7 @@ async function Rw({
18792
18792
  }
18793
18793
  async function xw(t) {
18794
18794
  try {
18795
- const e = await _w("0.0.1749283279-g57239a");
18795
+ const e = await _w("0.0.1749312087-g3e4f54");
18796
18796
  e.hasUpdate && e.latestVersion ? (t.next({ type: "update-start-updating" }), setTimeout(async () => {
18797
18797
  try {
18798
18798
  await Cw(e.latestVersion), t.next({
@@ -20550,7 +20550,7 @@ async function Un(t, e) {
20550
20550
  Yn({
20551
20551
  logLevel: e.logLevel || process.env.AMP_LOG_LEVEL,
20552
20552
  logFile: e.logFile || process.env.AMP_LOG_FILE
20553
- }), Vp("0.0.1749283279-g57239a");
20553
+ }), Vp("0.0.1749312087-g3e4f54");
20554
20554
  const n = e.settingsFile ?? process.env.AMP_SETTINGS_FILE;
20555
20555
  J.info("Using settings file", { settingsFile: n });
20556
20556
  const i = Hn(), r = ad({ settingsFile: n }), a = process.env.AMP_API_KEY;
@@ -20658,7 +20658,7 @@ function Zw(t) {
20658
20658
  const e = new wu().name("amp").description("AI-powered coding assistant").option("--thread-id [THREAD_ID]", "ID of the thread to continue running", void 0);
20659
20659
  e.option("-V, --version", "output the version number", () => {
20660
20660
  if (t.isTTY) {
20661
- const a = "0.0.1749283279-g57239a".match(/^(\d+\.\d+)\.(\d+)-(.+)$/);
20661
+ const a = "0.0.1749312087-g3e4f54".match(/^(\d+\.\d+)\.(\d+)-(.+)$/);
20662
20662
  if (a) {
20663
20663
  const [, , s] = a;
20664
20664
  try {
@@ -20669,21 +20669,21 @@ function Zw(t) {
20669
20669
  day: "numeric"
20670
20670
  });
20671
20671
  Ie.write(
20672
- `0.0.1749283279-g57239a ${t.printer.print(`(released ${o})`, { foreground: "gray" })}
20672
+ `0.0.1749312087-g3e4f54 ${t.printer.print(`(released ${o})`, { foreground: "gray" })}
20673
20673
  `
20674
20674
  );
20675
20675
  } else
20676
- Ie.write(`0.0.1749283279-g57239a
20676
+ Ie.write(`0.0.1749312087-g3e4f54
20677
20677
  `);
20678
20678
  } catch {
20679
- Ie.write(`0.0.1749283279-g57239a
20679
+ Ie.write(`0.0.1749312087-g3e4f54
20680
20680
  `);
20681
20681
  }
20682
20682
  } else
20683
- Ie.write(`0.0.1749283279-g57239a
20683
+ Ie.write(`0.0.1749312087-g3e4f54
20684
20684
  `);
20685
20685
  } else
20686
- Ie.write(`0.0.1749283279-g57239a
20686
+ Ie.write(`0.0.1749312087-g3e4f54
20687
20687
  `);
20688
20688
  process.exit(0);
20689
20689
  }), e.addHelpText(
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { q as x, o as A, n as g, y as B, r as j, l as h, x as I, u as J, w as V, A as k, aY as z, aZ as W, a_ as Z, a$ as C, b0 as L, b1 as _, b2 as D, ax as M, f as q, b3 as G, b4 as H, b5 as F, b6 as K, O as Q, b7 as N, _ as X, av as ee, C as te } from "./console-RPzEsLY0.js";
3
- import { r as se } from "./main-BtWlXNOi.js";
2
+ import { q as x, o as A, n as g, y as B, r as j, l as h, x as I, u as J, w as V, A as k, aY as z, aZ as W, a_ as Z, a$ as C, b0 as L, b1 as _, b2 as D, ax as M, f as q, b3 as G, b4 as H, b5 as F, b6 as K, O as Q, b7 as N, _ as X, av as ee, C as te } from "./console-Dvb4mlt2.js";
3
+ import { r as se } from "./main-C12KTwcJ.js";
4
4
  const v = A({
5
5
  context: V(["continue", "none"]).optional().default("continue"),
6
6
  tools: J([h("all"), x(g())]).optional(),
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import * as le from "node:os";
3
3
  import ee, { resolve as fe } from "node:path";
4
- import { aT as de, aU as _e, C as pe, aV as ne, aW as ge, aX as ve, aI as oe, aQ as me, aH as be, aC as Se, O as se } from "./console-RPzEsLY0.js";
5
- import { loadProfileEnvironmentVariables as Ce } from "./load-profile-CgexvkzB.js";
4
+ import { aT as de, aU as _e, C as pe, aV as ne, aW as ge, aX as ve, aI as oe, aQ as me, aH as be, aC as Se, O as se } from "./console-Dvb4mlt2.js";
5
+ import { loadProfileEnvironmentVariables as Ce } from "./load-profile-DfwAD194.js";
6
6
  const ye = [
7
7
  // Basic read/info operations
8
8
  "ls",
@@ -4,7 +4,7 @@ import * as i from "node:fs";
4
4
  import * as o from "node:path";
5
5
  import { join as f } from "node:path";
6
6
  import { promisify as p } from "node:util";
7
- import { C as l, aJ as n } from "./console-RPzEsLY0.js";
7
+ import { C as l, aJ as n } from "./console-Dvb4mlt2.js";
8
8
  import { homedir as w } from "node:os";
9
9
  const d = f(w(), ".amp", "file-changes"), u = p(m);
10
10
  function b(a) {
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a9 as Pe, a8 as st, p as lt } from "./console-RPzEsLY0.js";
2
+ import { a9 as Pe, a8 as st, p as lt } from "./console-Dvb4mlt2.js";
3
3
  var pe = {}, Pu = {}, be = {}, Me;
4
4
  function ne() {
5
5
  return Me || (Me = 1, function(u) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { p as f } from "./index-C1JH-cfZ.js";
3
- import { aC as m, g, m as c, aN as h, aO as d, aP as b, aQ as E, c as S, O as _ } from "./console-RPzEsLY0.js";
4
- import { r as v } from "./executable-Cvv6G9ik.js";
2
+ import { p as f } from "./index-obyovEcz.js";
3
+ import { aC as m, g, m as c, aN as h, aO as d, aP as b, aQ as E, c as S, O as _ } from "./console-Dvb4mlt2.js";
4
+ import { r as v } from "./executable-BnwRQX_M.js";
5
5
  const O = ({ args: a }, { dirs: s }) => {
6
6
  for (const e of s)
7
7
  m(e);
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { i as a, F as c, f as i } from "./client-D82aFqMl.js";
3
- import { p as m, aR as l } from "./console-RPzEsLY0.js";
2
+ import { i as a, F as c, f as i } from "./client-D-IY-U_F.js";
3
+ import { p as m, aR as l } from "./console-Dvb4mlt2.js";
4
4
  const h = ({ args: e }, { threadID: o }) => m(async (s) => {
5
5
  try {
6
6
  const r = await a.webSearch(
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { aK as F, p as d } from "./console-RPzEsLY0.js";
2
+ import { aK as F, p as d } from "./console-Dvb4mlt2.js";
3
3
  const s = ({ args: n }, { dir: o, dirs: r, threadID: a, filesystem: e }) => {
4
4
  const t = F({ readFileFn: e.readFile });
5
5
  return d(
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { a9 as ee, z as re } from "./console-RPzEsLY0.js";
2
+ import { a9 as ee, z as re } from "./console-Dvb4mlt2.js";
3
3
  import ne from "node:child_process";
4
4
  import D from "node:path";
5
5
  import L from "node:fs";
6
6
  import R from "node:process";
7
7
  import { PassThrough as te } from "node:stream";
8
- import { J as se } from "./main-BtWlXNOi.js";
8
+ import { J as se } from "./main-C12KTwcJ.js";
9
9
  var S = { exports: {} }, T, k;
10
10
  function oe() {
11
11
  if (k) return T;
package/dist/storybook.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { av as r, aA as a, an as c, aB as d, at as f, au as x, af as b, as as I } from "./console-RPzEsLY0.js";
2
+ import { av as r, aA as a, an as c, aB as d, at as f, au as x, af as b, as as I } from "./console-Dvb4mlt2.js";
3
3
  import { stdout as s } from "node:process";
4
4
  import { parseArgs as w } from "node:util";
5
5
  function D() {
@@ -3,7 +3,7 @@ import E from "node:crypto";
3
3
  import d, { writeFile as D } from "node:fs/promises";
4
4
  import g from "node:os";
5
5
  import a from "node:path";
6
- import { C as p, p as C, aC as F, aL as b, aM as _ } from "./console-RPzEsLY0.js";
6
+ import { C as p, p as C, aC as F, aL as b, aM as _ } from "./console-Dvb4mlt2.js";
7
7
  class v {
8
8
  MAX_TRACKED_EDITS = 50;
9
9
  editQueue = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sourcegraph/amp",
3
- "version": "0.0.1749283279-g57239a",
3
+ "version": "0.0.1749312087-g3e4f54",
4
4
  "description": "CLI for Amp, an agentic coding tool in research preview from Sourcegraph.",
5
5
  "homepage": "https://ampcode.com/",
6
6
  "author": {
@@ -1,69 +0,0 @@
1
- #!/usr/bin/env node
2
- import y from "node:path";
3
- import { b8 as I, b9 as T, C as z, ba as B, bb as C } from "./console-RPzEsLY0.js";
4
- async function L(p, h, t) {
5
- const b = await t.listFiles(h), i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), f = [], M = /\b([\w/_-]+(?:\\.|[\w/_-])*(?:\.[\w-]+)+)\b/g, F = /(\/(?:[\w-]+\/|[\w-]+\\[.\s\S])+[\w.-]+(?:\\.|[\w.-])*(?:\.[\w-]+)+)\b/g, x = /\b([A-Za-z]:[\\\\][^\s"'<>|]*(?:\.[\w-]+)+)\b/g;
6
- await l(M, !1), await l(F, !0), await l(x, !0);
7
- async function l(s, n) {
8
- s.lastIndex = 0;
9
- let o;
10
- for (; (o = s.exec(p)) !== null; ) {
11
- const [d] = o;
12
- let e;
13
- if (d.match(/^[A-Za-z]:[\\]/) !== null ? e = d : e = d.replace(/\\(.)/g, "$1"), i.has(e) || r.has(e)) {
14
- w(e, o.index);
15
- continue;
16
- }
17
- const c = n ? e : y.join(h, e);
18
- if (!(!n && !b.includes(e))) {
19
- if (n)
20
- try {
21
- await t.stat(c);
22
- } catch {
23
- continue;
24
- }
25
- try {
26
- const a = await I(t, c);
27
- if (a && T(a.mimeType)) {
28
- r.set(e, a);
29
- try {
30
- const u = (await t.readBinaryFile(c)).toString("base64");
31
- i.set(e, u);
32
- } catch (g) {
33
- z.error(
34
- "Failed to read image as binary",
35
- { path: e },
36
- g
37
- ), i.set(
38
- e,
39
- `[Image file: ${e} (${a.mimeType}, ${Math.round(a.size / 1024)} KB)]`
40
- );
41
- }
42
- w(e, o.index);
43
- } else {
44
- if (await B(t, c))
45
- continue;
46
- const u = await t.readFile(c);
47
- i.set(e, u), w(e, o.index);
48
- }
49
- } catch {
50
- continue;
51
- }
52
- }
53
- }
54
- }
55
- function w(s, n) {
56
- f.push({
57
- path: s,
58
- range: {
59
- start: n,
60
- end: n + s.length - 1
61
- }
62
- });
63
- }
64
- const m = new C(i, f);
65
- return m.imageFiles = r, m;
66
- }
67
- export {
68
- L as getFileMentions
69
- };