@sourcegraph/amp 0.0.1748339241-g4bad6a → 0.0.1748344183-gce2b68

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 (43) hide show
  1. package/dist/amp.js +3 -3
  2. package/dist/{client-Cz8QljuN.js → client-CGgxVuSC.js} +7 -7
  3. package/dist/{client-Cz8QljuN.js.map → client-CGgxVuSC.js.map} +1 -1
  4. package/dist/{color-DH4c3nvN.js → color-BHYGC4Ar.js} +135 -124
  5. package/dist/color-BHYGC4Ar.js.map +1 -0
  6. package/dist/{create_file.node-D6Df0Urb.js → create_file.node-D3fcWUKp.js} +2 -2
  7. package/dist/{create_file.node-D6Df0Urb.js.map → create_file.node-D3fcWUKp.js.map} +1 -1
  8. package/dist/{edit_file.node-C7Ni9Xjb.js → edit_file.node-DFDvUKmK.js} +5 -5
  9. package/dist/{edit_file.node-C7Ni9Xjb.js.map → edit_file.node-DFDvUKmK.js.map} +1 -1
  10. package/dist/{executable-BJNIVWlu.js → executable-CBhkfVUL.js} +2 -2
  11. package/dist/{executable-BJNIVWlu.js.map → executable-CBhkfVUL.js.map} +1 -1
  12. package/dist/{files-DZUDelFg.js → files-BqepJuwv.js} +2 -2
  13. package/dist/{files-DZUDelFg.js.map → files-BqepJuwv.js.map} +1 -1
  14. package/dist/{glob.node-C9lKzgi-.js → glob.node-BINRiQjJ.js} +26 -26
  15. package/dist/{glob.node-C9lKzgi-.js.map → glob.node-BINRiQjJ.js.map} +1 -1
  16. package/dist/{list_directory.node-DrWI9xPT.js → list_directory.node-DPu4RhvA.js} +2 -2
  17. package/dist/{list_directory.node-DrWI9xPT.js.map → list_directory.node-DPu4RhvA.js.map} +1 -1
  18. package/dist/{load-profile-noOyWkOF.js → load-profile-DC97etcT.js} +2 -2
  19. package/dist/{load-profile-noOyWkOF.js.map → load-profile-DC97etcT.js.map} +1 -1
  20. package/dist/{main-VhmuSMX3.js → main-C22ZCKsZ.js} +5534 -5480
  21. package/dist/main-C22ZCKsZ.js.map +1 -0
  22. package/dist/{node-TK8n7MXb.js → node-BOqn899s.js} +5 -5
  23. package/dist/{node-TK8n7MXb.js.map → node-BOqn899s.js.map} +1 -1
  24. package/dist/{node-CiK6YqQn.js → node-CK2AzzJP.js} +3 -3
  25. package/dist/{node-CiK6YqQn.js.map → node-CK2AzzJP.js.map} +1 -1
  26. package/dist/{node-DtF9_How.js → node-CieDu4sj.js} +2 -2
  27. package/dist/{node-DtF9_How.js.map → node-CieDu4sj.js.map} +1 -1
  28. package/dist/{node-5s3BwyMp.js → node-Coo1Y37e.js} +3 -3
  29. package/dist/{node-5s3BwyMp.js.map → node-Coo1Y37e.js.map} +1 -1
  30. package/dist/{node-BoNPZ-4l.js → node-DW21A6nN.js} +2 -2
  31. package/dist/{node-BoNPZ-4l.js.map → node-DW21A6nN.js.map} +1 -1
  32. package/dist/{node-CR6PuGwJ.js → node-DX52svHT.js} +20 -20
  33. package/dist/{node-CR6PuGwJ.js.map → node-DX52svHT.js.map} +1 -1
  34. package/dist/{read_file.node-DugoUCiQ.js → read_file.node-M7X04JIh.js} +2 -2
  35. package/dist/{read_file.node-DugoUCiQ.js.map → read_file.node-M7X04JIh.js.map} +1 -1
  36. package/dist/{stdio-b2NNJPn1.js → stdio-BIlnCjMe.js} +9 -9
  37. package/dist/{stdio-b2NNJPn1.js.map → stdio-BIlnCjMe.js.map} +1 -1
  38. package/dist/storybook.js +1 -1
  39. package/dist/{undo_edit.node-C8KyPFqz.js → undo_edit.node-CP3LxQtf.js} +10 -10
  40. package/dist/{undo_edit.node-C8KyPFqz.js.map → undo_edit.node-CP3LxQtf.js.map} +1 -1
  41. package/package.json +1 -1
  42. package/dist/color-DH4c3nvN.js.map +0 -1
  43. package/dist/main-VhmuSMX3.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import p from "node:path";
3
- import { p as f, aS as u, a6 as d } from "./color-DH4c3nvN.js";
3
+ import { p as f, aV as u, a7 as d } from "./color-BHYGC4Ar.js";
4
4
  const w = ({ args: t }, { dir: n, dirs: i, trackFileChange: c, filesystem: o }) => f(async (e) => {
5
5
  if (u(n), typeof t.content != "string")
6
6
  throw new Error("create_file: content must be specified");
@@ -19,4 +19,4 @@ const w = ({ args: t }, { dir: n, dirs: i, trackFileChange: c, filesystem: o })
19
19
  export {
20
20
  w as nodeCreateFileTool
21
21
  };
22
- //# sourceMappingURL=create_file.node-D6Df0Urb.js.map
22
+ //# sourceMappingURL=create_file.node-D3fcWUKp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create_file.node-D6Df0Urb.js","sources":["../../core/src/tools/builtin/filesystem/create_file.node.ts"],"sourcesContent":["import { promiseFactoryToObservable } from '@sourcegraph/observable'\nimport path from 'path'\nimport { checkDirURIIsFile } from '../node-helpers'\nimport type { createFileToolReg } from './create_file.common'\nimport { resolveArgumentPath } from './read_file.util'\n\nexport const nodeCreateFileTool: NonNullable<typeof createFileToolReg.fn> = (\n\t{ args },\n\t{ dir, dirs, trackFileChange, filesystem },\n) => {\n\treturn promiseFactoryToObservable(async (signal) => {\n\t\tcheckDirURIIsFile(dir)\n\t\tif (typeof args.content !== 'string') {\n\t\t\tthrow new Error('create_file: content must be specified')\n\t\t}\n\n\t\tsignal.throwIfAborted()\n\n\t\tconst fullPath = await resolveArgumentPath(filesystem, dirs, args.path, signal)\n\t\tconst dirname = path.dirname(fullPath)\n\t\tawait filesystem.mkdirp(dirname, signal)\n\n\t\tlet content = args.content\n\t\t// HACK: Gemini has a bug where it will sometimes add a leading backslash to\n\t\t// the beginning of its tool args. I've reported the bug, but it still\n\t\t// happens pretty regularly. For now, this attempts to get things working\n\t\t// by trimming any leading backslash\n\t\tif (content.startsWith('\\\\')) {\n\t\t\tcontent = content.slice(1)\n\t\t}\n\n\t\tawait trackFileChange(fullPath, async (path) => {\n\t\t\tawait filesystem.writeFile(path, content, signal)\n\t\t})\n\t\treturn {\n\t\t\tstatus: 'done',\n\t\t\tresult: `Successfully created file ${args.path}`,\n\t\t\tfiles: [args.path],\n\t\t}\n\t})\n}\n"],"names":["nodeCreateFileTool","args","dir","dirs","trackFileChange","filesystem","promiseFactoryToObservable","signal","checkDirURIIsFile","fullPath","resolveArgumentPath","dirname","path","content"],"mappings":";;;AAMa,MAAAA,IAA+D,CAC3E,EAAE,MAAAC,KACF,EAAE,KAAAC,GAAK,MAAAC,GAAM,iBAAAC,GAAiB,YAAAC,QAEvBC,EAA2B,OAAOC,MAAW;AAE/C,MADJC,EAAkBN,CAAG,GACjB,OAAOD,EAAK,WAAY;AACrB,UAAA,IAAI,MAAM,wCAAwC;AAGzD,EAAAM,EAAO,eAAe;AAEtB,QAAME,IAAW,MAAMC,EAAoBL,GAAYF,GAAMF,EAAK,MAAMM,CAAM,GACxEI,IAAUC,EAAK,QAAQH,CAAQ;AAC/B,QAAAJ,EAAW,OAAOM,GAASJ,CAAM;AAEvC,MAAIM,IAAUZ,EAAK;AAKf,SAAAY,EAAQ,WAAW,IAAI,MAChBA,IAAAA,EAAQ,MAAM,CAAC,IAGpB,MAAAT,EAAgBK,GAAU,OAAOG,MAAS;AAC/C,UAAMP,EAAW,UAAUO,GAAMC,GAASN,CAAM;AAAA,EAAA,CAChD,GACM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ,6BAA6BN,EAAK,IAAI;AAAA,IAC9C,OAAO,CAACA,EAAK,IAAI;AAAA,EAClB;AAAA,CACA;"}
1
+ {"version":3,"file":"create_file.node-D3fcWUKp.js","sources":["../../core/src/tools/builtin/filesystem/create_file.node.ts"],"sourcesContent":["import { promiseFactoryToObservable } from '@sourcegraph/observable'\nimport path from 'path'\nimport { checkDirURIIsFile } from '../node-helpers'\nimport type { createFileToolReg } from './create_file.common'\nimport { resolveArgumentPath } from './read_file.util'\n\nexport const nodeCreateFileTool: NonNullable<typeof createFileToolReg.fn> = (\n\t{ args },\n\t{ dir, dirs, trackFileChange, filesystem },\n) => {\n\treturn promiseFactoryToObservable(async (signal) => {\n\t\tcheckDirURIIsFile(dir)\n\t\tif (typeof args.content !== 'string') {\n\t\t\tthrow new Error('create_file: content must be specified')\n\t\t}\n\n\t\tsignal.throwIfAborted()\n\n\t\tconst fullPath = await resolveArgumentPath(filesystem, dirs, args.path, signal)\n\t\tconst dirname = path.dirname(fullPath)\n\t\tawait filesystem.mkdirp(dirname, signal)\n\n\t\tlet content = args.content\n\t\t// HACK: Gemini has a bug where it will sometimes add a leading backslash to\n\t\t// the beginning of its tool args. I've reported the bug, but it still\n\t\t// happens pretty regularly. For now, this attempts to get things working\n\t\t// by trimming any leading backslash\n\t\tif (content.startsWith('\\\\')) {\n\t\t\tcontent = content.slice(1)\n\t\t}\n\n\t\tawait trackFileChange(fullPath, async (path) => {\n\t\t\tawait filesystem.writeFile(path, content, signal)\n\t\t})\n\t\treturn {\n\t\t\tstatus: 'done',\n\t\t\tresult: `Successfully created file ${args.path}`,\n\t\t\tfiles: [args.path],\n\t\t}\n\t})\n}\n"],"names":["nodeCreateFileTool","args","dir","dirs","trackFileChange","filesystem","promiseFactoryToObservable","signal","checkDirURIIsFile","fullPath","resolveArgumentPath","dirname","path","content"],"mappings":";;;AAMa,MAAAA,IAA+D,CAC3E,EAAE,MAAAC,KACF,EAAE,KAAAC,GAAK,MAAAC,GAAM,iBAAAC,GAAiB,YAAAC,QAEvBC,EAA2B,OAAOC,MAAW;AAE/C,MADJC,EAAkBN,CAAG,GACjB,OAAOD,EAAK,WAAY;AACrB,UAAA,IAAI,MAAM,wCAAwC;AAGzD,EAAAM,EAAO,eAAe;AAEtB,QAAME,IAAW,MAAMC,EAAoBL,GAAYF,GAAMF,EAAK,MAAMM,CAAM,GACxEI,IAAUC,EAAK,QAAQH,CAAQ;AAC/B,QAAAJ,EAAW,OAAOM,GAASJ,CAAM;AAEvC,MAAIM,IAAUZ,EAAK;AAKf,SAAAY,EAAQ,WAAW,IAAI,MAChBA,IAAAA,EAAQ,MAAM,CAAC,IAGpB,MAAAT,EAAgBK,GAAU,OAAOG,MAAS;AAC/C,UAAMP,EAAW,UAAUO,GAAMC,GAASN,CAAM;AAAA,EAAA,CAChD,GACM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ,6BAA6BN,EAAK,IAAI;AAAA,IAC9C,OAAO,CAACA,EAAK,IAAI;AAAA,EAClB;AAAA,CACA;"}
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { p, aS as m, a6 as F, aW as v, aX as _, aY as b } from "./color-DH4c3nvN.js";
3
- import { recordEdit as x } from "./undo_edit.node-C8KyPFqz.js";
2
+ import { p, aV as m, a7 as F, aZ as _, a_ as v, a$ as b } from "./color-BHYGC4Ar.js";
3
+ import { recordEdit as x } from "./undo_edit.node-CP3LxQtf.js";
4
4
  class y {
5
5
  #e = !1;
6
6
  #t = [];
@@ -27,7 +27,7 @@ const l = new y(), k = ({ args: e }, { dir: t, dirs: d, threadID: u, trackFileCh
27
27
  E(e), m(t);
28
28
  const r = await F(i, d, e.path, a);
29
29
  if (!i.exclusiveWriter) {
30
- const s = v(r, u), c = await i.getMtime(r);
30
+ const s = _(r, u), c = await i.getMtime(r);
31
31
  if (s && c && s !== c)
32
32
  return {
33
33
  status: "error",
@@ -37,7 +37,7 @@ const l = new y(), k = ({ args: e }, { dir: t, dirs: d, threadID: u, trackFileCh
37
37
  }
38
38
  };
39
39
  }
40
- const n = await i.readFile(r, a), { modifiedContent: o, formattedDiff: f, lineRange: w } = await _(
40
+ const n = await i.readFile(r, a), { modifiedContent: o, formattedDiff: f, lineRange: w } = await v(
41
41
  e.path,
42
42
  n,
43
43
  e.old_str,
@@ -65,4 +65,4 @@ function E(e) {
65
65
  export {
66
66
  k as nodeEditFileTool
67
67
  };
68
- //# sourceMappingURL=edit_file.node-C7Ni9Xjb.js.map
68
+ //# sourceMappingURL=edit_file.node-DFDvUKmK.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"edit_file.node-C7Ni9Xjb.js","sources":["../../core/src/utils/async_mutex.ts","../../core/src/tools/builtin/filesystem/edit_file.node.ts"],"sourcesContent":["export class AsyncMutex {\n\t#locked = false\n\t#queue: (() => void)[] = []\n\n\t/**\n\t * Acquires the lock. If the lock is already held, waits until it is released.\n\t * @returns A promise that resolves when the lock is acquired.\n\t */\n\tasync acquire(): Promise<void> {\n\t\treturn new Promise<void>((resolve) => {\n\t\t\tif (!this.#locked) {\n\t\t\t\t// Lock is free, acquire it immediately\n\t\t\t\tthis.#locked = true\n\t\t\t\tresolve()\n\t\t\t} else {\n\t\t\t\t// Lock is held, add the resolver to the queue\n\t\t\t\tthis.#queue.push(resolve)\n\t\t\t}\n\t\t})\n\t}\n\n\t/**\n\t * Releases the lock. If there are waiters in the queue, the next one acquires the lock.\n\t * Otherwise, the lock becomes free.\n\t */\n\trelease(): void {\n\t\tif (this.#queue.length > 0) {\n\t\t\t// Pass the lock to the next waiter without setting #locked to false\n\t\t\tconst nextResolve = this.#queue.shift()\n\t\t\t// The next waiter's promise resolves, and *they* now hold the lock.\n\t\t\t// #locked remains true.\n\t\t\tnextResolve?.()\n\t\t} else {\n\t\t\t// No waiters, release the lock\n\t\t\tthis.#locked = false\n\t\t}\n\t}\n}\n","import { promiseFactoryToObservable } from '@sourcegraph/observable'\nimport { getFileModTime } from '../../../threads/file-tracking/common'\nimport { AsyncMutex } from '../../../utils/async_mutex'\nimport { checkDirURIIsFile } from '../node-helpers'\nimport type { EditFileToolDef, editFileToolReg } from './edit_file.common'\nimport { applyFileEdits, editFileArgsSchema } from './edit_file.common'\nimport { resolveArgumentPath } from './read_file.util'\nimport { recordEdit } from './undo_edit.node'\n\nconst runningMutex = new AsyncMutex()\n\nexport const nodeEditFileTool: NonNullable<(typeof editFileToolReg)['fn']> = (\n\t{ args },\n\t{ dir, dirs, threadID, trackFileChange, filesystem },\n) => {\n\treturn promiseFactoryToObservable(async (signal) => {\n\t\tawait runningMutex.acquire()\n\t\ttry {\n\t\t\tcheckEditArgs(args)\n\n\t\t\tcheckDirURIIsFile(dir)\n\n\t\t\tconst filePath = await resolveArgumentPath(filesystem, dirs, args.path, signal)\n\n\t\t\tif (!filesystem.exclusiveWriter) {\n\t\t\t\tconst lastReadTime = getFileModTime(filePath, threadID)\n\t\t\t\tconst currentMtime = await filesystem.getMtime(filePath)\n\t\t\t\tif (lastReadTime && currentMtime && lastReadTime !== currentMtime) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'error' as const,\n\t\t\t\t\t\tprogress: {},\n\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\tmessage: `The file '${args.path}' has been modified since you last read it. Please use read_file to view the current version before making edits.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst content = await filesystem.readFile(filePath, signal)\n\t\t\tconst { modifiedContent, formattedDiff, lineRange } = await applyFileEdits(\n\t\t\t\targs.path,\n\t\t\t\tcontent,\n\t\t\t\targs.old_str,\n\t\t\t\targs.new_str,\n\t\t\t)\n\n\t\t\tawait recordEdit(args.path, content, modifiedContent)\n\n\t\t\tawait trackFileChange(filePath, async (path) => {\n\t\t\t\tawait filesystem.writeFile(path, modifiedContent, signal)\n\t\t\t})\n\n\t\t\tconst result = {\n\t\t\t\tdiff: formattedDiff,\n\t\t\t\tlineRange,\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tstatus: 'done',\n\t\t\t\tprogress: {},\n\t\t\t\tresult,\n\t\t\t\tfiles: [args.path],\n\t\t\t}\n\t\t} finally {\n\t\t\trunningMutex.release()\n\t\t}\n\t})\n}\n\nfunction checkEditArgs(args: EditFileToolDef['args']): asserts args is EditFileToolDef['args'] {\n\targs = editFileArgsSchema.parse(args)\n\tif (args.old_str === args.new_str) {\n\t\tthrow new Error('old_str and new_str must be different from each other.')\n\t}\n}\n"],"names":["AsyncMutex","#locked","#queue","resolve","runningMutex","nodeEditFileTool","args","dir","dirs","threadID","trackFileChange","filesystem","promiseFactoryToObservable","signal","checkEditArgs","checkDirURIIsFile","filePath","resolveArgumentPath","lastReadTime","getFileModTime","currentMtime","content","modifiedContent","formattedDiff","lineRange","applyFileEdits","recordEdit","path","editFileArgsSchema"],"mappings":";;;AAAO,MAAMA,EAAW;AAAA,EACvBC,KAAU;AAAA,EACVC,KAAyB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAM1B,MAAM,UAAyB;AACvB,WAAA,IAAI,QAAc,CAACC,MAAY;AACjC,MAAC,KAAKF,KAMJ,KAAAC,GAAO,KAAKC,CAAO,KAJxB,KAAKF,KAAU,IACPE,EAAA;AAAA,IAIT,CACA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOF,UAAgB;AACX,IAAA,KAAKD,GAAO,SAAS,IAEJ,KAAKA,GAAO,MAAM,IAGxB,IAGd,KAAKD,KAAU;AAAA,EAChB;AAEF;AC5BA,MAAMG,IAAe,IAAIJ,EAAW,GAEvBK,IAAgE,CAC5E,EAAE,MAAAC,EAAK,GACP,EAAE,KAAAC,GAAK,MAAAC,GAAM,UAAAC,GAAU,iBAAAC,GAAiB,YAAAC,QAEjCC,EAA2B,OAAOC,MAAW;AACnD,QAAMT,EAAa,QAAQ;AACvB,MAAA;AACH,IAAAU,EAAcR,CAAI,GAElBS,EAAkBR,CAAG;AAErB,UAAMS,IAAW,MAAMC,EAAoBN,GAAYH,GAAMF,EAAK,MAAMO,CAAM;AAE1E,QAAA,CAACF,EAAW,iBAAiB;AAC1B,YAAAO,IAAeC,EAAeH,GAAUP,CAAQ,GAChDW,IAAe,MAAMT,EAAW,SAASK,CAAQ;AACnD,UAAAE,KAAgBE,KAAgBF,MAAiBE;AAC7C,eAAA;AAAA,UACN,QAAQ;AAAA,UACR,UAAU,CAAC;AAAA,UACX,OAAO;AAAA,YACN,SAAS,aAAad,EAAK,IAAI;AAAA,UAAA;AAAA,QAEjC;AAAA,IACD;AAGD,UAAMe,IAAU,MAAMV,EAAW,SAASK,GAAUH,CAAM,GACpD,EAAE,iBAAAS,GAAiB,eAAAC,GAAe,WAAAC,EAAA,IAAc,MAAMC;AAAA,MAC3DnB,EAAK;AAAA,MACLe;AAAA,MACAf,EAAK;AAAA,MACLA,EAAK;AAAA,IACN;AAEA,iBAAMoB,EAAWpB,EAAK,MAAMe,GAASC,CAAe,GAE9C,MAAAZ,EAAgBM,GAAU,OAAOW,MAAS;AAC/C,YAAMhB,EAAW,UAAUgB,GAAML,GAAiBT,CAAM;AAAA,IAAA,CACxD,GAOM;AAAA,MACN,QAAQ;AAAA,MACR,UAAU,CAAC;AAAA,MACX,QARc;AAAA,QACd,MAAMU;AAAA,QACN,WAAAC;AAAA,MACD;AAAA,MAMC,OAAO,CAAClB,EAAK,IAAI;AAAA,IAClB;AAAA,EAAA,UACC;AACD,IAAAF,EAAa,QAAQ;AAAA,EAAA;AACtB,CACA;AAGF,SAASU,EAAcR,GAAwE;AAE1F,MADGA,IAAAsB,EAAmB,MAAMtB,CAAI,GAChCA,EAAK,YAAYA,EAAK;AACnB,UAAA,IAAI,MAAM,wDAAwD;AAE1E;"}
1
+ {"version":3,"file":"edit_file.node-DFDvUKmK.js","sources":["../../core/src/utils/async_mutex.ts","../../core/src/tools/builtin/filesystem/edit_file.node.ts"],"sourcesContent":["export class AsyncMutex {\n\t#locked = false\n\t#queue: (() => void)[] = []\n\n\t/**\n\t * Acquires the lock. If the lock is already held, waits until it is released.\n\t * @returns A promise that resolves when the lock is acquired.\n\t */\n\tasync acquire(): Promise<void> {\n\t\treturn new Promise<void>((resolve) => {\n\t\t\tif (!this.#locked) {\n\t\t\t\t// Lock is free, acquire it immediately\n\t\t\t\tthis.#locked = true\n\t\t\t\tresolve()\n\t\t\t} else {\n\t\t\t\t// Lock is held, add the resolver to the queue\n\t\t\t\tthis.#queue.push(resolve)\n\t\t\t}\n\t\t})\n\t}\n\n\t/**\n\t * Releases the lock. If there are waiters in the queue, the next one acquires the lock.\n\t * Otherwise, the lock becomes free.\n\t */\n\trelease(): void {\n\t\tif (this.#queue.length > 0) {\n\t\t\t// Pass the lock to the next waiter without setting #locked to false\n\t\t\tconst nextResolve = this.#queue.shift()\n\t\t\t// The next waiter's promise resolves, and *they* now hold the lock.\n\t\t\t// #locked remains true.\n\t\t\tnextResolve?.()\n\t\t} else {\n\t\t\t// No waiters, release the lock\n\t\t\tthis.#locked = false\n\t\t}\n\t}\n}\n","import { promiseFactoryToObservable } from '@sourcegraph/observable'\nimport { getFileModTime } from '../../../threads/file-tracking/common'\nimport { AsyncMutex } from '../../../utils/async_mutex'\nimport { checkDirURIIsFile } from '../node-helpers'\nimport type { EditFileToolDef, editFileToolReg } from './edit_file.common'\nimport { applyFileEdits, editFileArgsSchema } from './edit_file.common'\nimport { resolveArgumentPath } from './read_file.util'\nimport { recordEdit } from './undo_edit.node'\n\nconst runningMutex = new AsyncMutex()\n\nexport const nodeEditFileTool: NonNullable<(typeof editFileToolReg)['fn']> = (\n\t{ args },\n\t{ dir, dirs, threadID, trackFileChange, filesystem },\n) => {\n\treturn promiseFactoryToObservable(async (signal) => {\n\t\tawait runningMutex.acquire()\n\t\ttry {\n\t\t\tcheckEditArgs(args)\n\n\t\t\tcheckDirURIIsFile(dir)\n\n\t\t\tconst filePath = await resolveArgumentPath(filesystem, dirs, args.path, signal)\n\n\t\t\tif (!filesystem.exclusiveWriter) {\n\t\t\t\tconst lastReadTime = getFileModTime(filePath, threadID)\n\t\t\t\tconst currentMtime = await filesystem.getMtime(filePath)\n\t\t\t\tif (lastReadTime && currentMtime && lastReadTime !== currentMtime) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'error' as const,\n\t\t\t\t\t\tprogress: {},\n\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\tmessage: `The file '${args.path}' has been modified since you last read it. Please use read_file to view the current version before making edits.`,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst content = await filesystem.readFile(filePath, signal)\n\t\t\tconst { modifiedContent, formattedDiff, lineRange } = await applyFileEdits(\n\t\t\t\targs.path,\n\t\t\t\tcontent,\n\t\t\t\targs.old_str,\n\t\t\t\targs.new_str,\n\t\t\t)\n\n\t\t\tawait recordEdit(args.path, content, modifiedContent)\n\n\t\t\tawait trackFileChange(filePath, async (path) => {\n\t\t\t\tawait filesystem.writeFile(path, modifiedContent, signal)\n\t\t\t})\n\n\t\t\tconst result = {\n\t\t\t\tdiff: formattedDiff,\n\t\t\t\tlineRange,\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tstatus: 'done',\n\t\t\t\tprogress: {},\n\t\t\t\tresult,\n\t\t\t\tfiles: [args.path],\n\t\t\t}\n\t\t} finally {\n\t\t\trunningMutex.release()\n\t\t}\n\t})\n}\n\nfunction checkEditArgs(args: EditFileToolDef['args']): asserts args is EditFileToolDef['args'] {\n\targs = editFileArgsSchema.parse(args)\n\tif (args.old_str === args.new_str) {\n\t\tthrow new Error('old_str and new_str must be different from each other.')\n\t}\n}\n"],"names":["AsyncMutex","#locked","#queue","resolve","runningMutex","nodeEditFileTool","args","dir","dirs","threadID","trackFileChange","filesystem","promiseFactoryToObservable","signal","checkEditArgs","checkDirURIIsFile","filePath","resolveArgumentPath","lastReadTime","getFileModTime","currentMtime","content","modifiedContent","formattedDiff","lineRange","applyFileEdits","recordEdit","path","editFileArgsSchema"],"mappings":";;;AAAO,MAAMA,EAAW;AAAA,EACvBC,KAAU;AAAA,EACVC,KAAyB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAM1B,MAAM,UAAyB;AACvB,WAAA,IAAI,QAAc,CAACC,MAAY;AACjC,MAAC,KAAKF,KAMJ,KAAAC,GAAO,KAAKC,CAAO,KAJxB,KAAKF,KAAU,IACPE,EAAA;AAAA,IAIT,CACA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOF,UAAgB;AACX,IAAA,KAAKD,GAAO,SAAS,IAEJ,KAAKA,GAAO,MAAM,IAGxB,IAGd,KAAKD,KAAU;AAAA,EAChB;AAEF;AC5BA,MAAMG,IAAe,IAAIJ,EAAW,GAEvBK,IAAgE,CAC5E,EAAE,MAAAC,EAAK,GACP,EAAE,KAAAC,GAAK,MAAAC,GAAM,UAAAC,GAAU,iBAAAC,GAAiB,YAAAC,QAEjCC,EAA2B,OAAOC,MAAW;AACnD,QAAMT,EAAa,QAAQ;AACvB,MAAA;AACH,IAAAU,EAAcR,CAAI,GAElBS,EAAkBR,CAAG;AAErB,UAAMS,IAAW,MAAMC,EAAoBN,GAAYH,GAAMF,EAAK,MAAMO,CAAM;AAE1E,QAAA,CAACF,EAAW,iBAAiB;AAC1B,YAAAO,IAAeC,EAAeH,GAAUP,CAAQ,GAChDW,IAAe,MAAMT,EAAW,SAASK,CAAQ;AACnD,UAAAE,KAAgBE,KAAgBF,MAAiBE;AAC7C,eAAA;AAAA,UACN,QAAQ;AAAA,UACR,UAAU,CAAC;AAAA,UACX,OAAO;AAAA,YACN,SAAS,aAAad,EAAK,IAAI;AAAA,UAAA;AAAA,QAEjC;AAAA,IACD;AAGD,UAAMe,IAAU,MAAMV,EAAW,SAASK,GAAUH,CAAM,GACpD,EAAE,iBAAAS,GAAiB,eAAAC,GAAe,WAAAC,EAAA,IAAc,MAAMC;AAAA,MAC3DnB,EAAK;AAAA,MACLe;AAAA,MACAf,EAAK;AAAA,MACLA,EAAK;AAAA,IACN;AAEA,iBAAMoB,EAAWpB,EAAK,MAAMe,GAASC,CAAe,GAE9C,MAAAZ,EAAgBM,GAAU,OAAOW,MAAS;AAC/C,YAAMhB,EAAW,UAAUgB,GAAML,GAAiBT,CAAM;AAAA,IAAA,CACxD,GAOM;AAAA,MACN,QAAQ;AAAA,MACR,UAAU,CAAC;AAAA,MACX,QARc;AAAA,QACd,MAAMU;AAAA,QACN,WAAAC;AAAA,MACD;AAAA,MAMC,OAAO,CAAClB,EAAK,IAAI;AAAA,IAClB;AAAA,EAAA,UACC;AACD,IAAAF,EAAa,QAAQ;AAAA,EAAA;AACtB,CACA;AAGF,SAASU,EAAcR,GAAwE;AAE1F,MADGA,IAAAsB,EAAmB,MAAMtB,CAAI,GAChCA,EAAK,YAAYA,EAAK;AACnB,UAAA,IAAI,MAAM,wDAAwD;AAE1E;"}
@@ -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 { k as i } from "./color-DH4c3nvN.js";
4
+ import { k as i } from "./color-BHYGC4Ar.js";
5
5
  function g() {
6
6
  try {
7
7
  const r = t(import.meta.url)("@vscode/ripgrep")?.rgPath;
@@ -15,4 +15,4 @@ function g() {
15
15
  export {
16
16
  g as r
17
17
  };
18
- //# sourceMappingURL=executable-BJNIVWlu.js.map
18
+ //# sourceMappingURL=executable-CBhkfVUL.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"executable-BJNIVWlu.js","sources":["../../core/src/tools/builtin/grep/executable.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\nimport logger from '../../../common/logger'\n\nexport function ripgrepExecutable(): string {\n\tif (import.meta.env.VITE_PLATFORM === 'vscode') {\n\t\tconst possiblePaths = getVSCodeRipgrepPaths()\n\n\t\tfor (const path of possiblePaths) {\n\t\t\tif (existsSync(path)) {\n\t\t\t\treturn path\n\t\t\t}\n\t\t}\n\t} else if (import.meta.env.VITE_PLATFORM === 'node') {\n\t\ttry {\n\t\t\t// Create a require function that can be used in ESM context\n\t\t\tconst require = createRequire(import.meta.url)\n\n\t\t\t// Use the created require function to load @vscode/ripgrep\n\t\t\tconst ripgrepModule = require('@vscode/ripgrep') as { rgPath: string }\n\t\t\tconst rgPath = ripgrepModule?.rgPath\n\n\t\t\tif (rgPath && existsSync(rgPath)) {\n\t\t\t\treturn rgPath\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlogger.error('Error with ripgrep:', error)\n\t\t}\n\t}\n\n\treturn 'rg'\n}\n\nfunction getVSCodeRipgrepPaths(): string[] {\n\tconst platform = process.platform\n\tconst paths: string[] = []\n\n\ttry {\n\t\t// eslint-disable-next-line @typescript-eslint/no-require-imports\n\t\tconst vscode = require('vscode') as typeof import('vscode')\n\t\tconst binaryName = platform === 'win32' ? 'rg.exe' : 'rg'\n\t\tpaths.push(\n\t\t\tjoin(vscode.env.appRoot, 'node_modules', '@vscode', 'ripgrep', 'bin', binaryName),\n\t\t)\n\t} catch {\n\t\t// ignore\n\t}\n\n\t// This if statement should no longer be needed since vscode.env.appRoot\n\t// already handles it. However, keeping it here as a fallback just to be\n\t// sure we don't regress anything after adding appRoot support.\n\tif (platform === 'darwin') {\n\t\tpaths.push(\n\t\t\t'/Applications/Visual Studio Code.app/Contents/Resources/app/node_modules/@vscode/ripgrep/bin/rg',\n\t\t)\n\t} else if (platform === 'linux') {\n\t\tpaths.push(\n\t\t\t'/usr/share/code/resources/app/node_modules/@vscode/ripgrep/bin/rg',\n\t\t\tjoin(homedir(), '.vscode/extensions/ms-vscode.vscode-ripgrep-*/bin/rg'),\n\t\t)\n\t}\n\n\treturn paths\n}\n"],"names":["ripgrepExecutable","rgPath","createRequire","existsSync","error","logger"],"mappings":";;;;AAMO,SAASA,IAA4B;AAUtC,MAAA;AAMH,UAAMC,IAJUC,EAAc,YAAY,GAAG,EAGf,iBAAiB,GACjB;AAE1B,QAAAD,KAAUE,EAAWF,CAAM;AACvB,aAAAA;AAAA,WAEAG,GAAO;AACR,IAAAC,EAAA,MAAM,uBAAuBD,CAAK;AAAA,EAAA;AAIpC,SAAA;AACR;"}
1
+ {"version":3,"file":"executable-CBhkfVUL.js","sources":["../../core/src/tools/builtin/grep/executable.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { homedir } from 'node:os'\nimport { join } from 'node:path'\nimport logger from '../../../common/logger'\n\nexport function ripgrepExecutable(): string {\n\tif (import.meta.env.VITE_PLATFORM === 'vscode') {\n\t\tconst possiblePaths = getVSCodeRipgrepPaths()\n\n\t\tfor (const path of possiblePaths) {\n\t\t\tif (existsSync(path)) {\n\t\t\t\treturn path\n\t\t\t}\n\t\t}\n\t} else if (import.meta.env.VITE_PLATFORM === 'node') {\n\t\ttry {\n\t\t\t// Create a require function that can be used in ESM context\n\t\t\tconst require = createRequire(import.meta.url)\n\n\t\t\t// Use the created require function to load @vscode/ripgrep\n\t\t\tconst ripgrepModule = require('@vscode/ripgrep') as { rgPath: string }\n\t\t\tconst rgPath = ripgrepModule?.rgPath\n\n\t\t\tif (rgPath && existsSync(rgPath)) {\n\t\t\t\treturn rgPath\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tlogger.error('Error with ripgrep:', error)\n\t\t}\n\t}\n\n\treturn 'rg'\n}\n\nfunction getVSCodeRipgrepPaths(): string[] {\n\tconst platform = process.platform\n\tconst paths: string[] = []\n\n\ttry {\n\t\t// eslint-disable-next-line @typescript-eslint/no-require-imports\n\t\tconst vscode = require('vscode') as typeof import('vscode')\n\t\tconst binaryName = platform === 'win32' ? 'rg.exe' : 'rg'\n\t\tpaths.push(\n\t\t\tjoin(vscode.env.appRoot, 'node_modules', '@vscode', 'ripgrep', 'bin', binaryName),\n\t\t)\n\t} catch {\n\t\t// ignore\n\t}\n\n\t// This if statement should no longer be needed since vscode.env.appRoot\n\t// already handles it. However, keeping it here as a fallback just to be\n\t// sure we don't regress anything after adding appRoot support.\n\tif (platform === 'darwin') {\n\t\tpaths.push(\n\t\t\t'/Applications/Visual Studio Code.app/Contents/Resources/app/node_modules/@vscode/ripgrep/bin/rg',\n\t\t)\n\t} else if (platform === 'linux') {\n\t\tpaths.push(\n\t\t\t'/usr/share/code/resources/app/node_modules/@vscode/ripgrep/bin/rg',\n\t\t\tjoin(homedir(), '.vscode/extensions/ms-vscode.vscode-ripgrep-*/bin/rg'),\n\t\t)\n\t}\n\n\treturn paths\n}\n"],"names":["ripgrepExecutable","rgPath","createRequire","existsSync","error","logger"],"mappings":";;;;AAMO,SAASA,IAA4B;AAUtC,MAAA;AAMH,UAAMC,IAJUC,EAAc,YAAY,GAAG,EAGf,iBAAiB,GACjB;AAE1B,QAAAD,KAAUE,EAAWF,CAAM;AACvB,aAAAA;AAAA,WAEAG,GAAO;AACR,IAAAC,EAAA,MAAM,uBAAuBD,CAAK;AAAA,EAAA;AAIpC,SAAA;AACR;"}
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import y from "node:path";
3
- import { b3 as I, b4 as T, k as z, b5 as B, b6 as P } from "./color-DH4c3nvN.js";
3
+ import { b6 as I, b7 as T, k as z, b8 as B, b9 as P } from "./color-BHYGC4Ar.js";
4
4
  async function L(p, h, t) {
5
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
6
  await l(M, !1), await l(F, !0), await l(x, !0);
@@ -67,4 +67,4 @@ async function L(p, h, t) {
67
67
  export {
68
68
  L as getFileMentions
69
69
  };
70
- //# sourceMappingURL=files-DZUDelFg.js.map
70
+ //# sourceMappingURL=files-BqepJuwv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"files-DZUDelFg.js","sources":["../../core/src/threads/files.ts"],"sourcesContent":["import path from 'node:path'\nimport logger from '../common/logger'\nimport type { FileSystem } from '../platform/fs/fs'\nimport { getImageFileMetadata } from '../tools/builtin/filesystem/file-type'\nimport { checkFileSizeLimit } from '../tools/builtin/filesystem/read_file.util'\nimport type { FileMention } from './file-mentions'\nimport { FileMentions } from './file-mentions'\nimport { isSupportedImageMIMEType } from './image-attachments'\n\nexport async function getFileMentions(\n\tcontent: string,\n\tworkspaceRoot: string,\n\tfilesystem: Pick<FileSystem, 'stat' | 'readFile' | 'readBinaryFile' | 'listFiles'>,\n): Promise<FileMentions> {\n\tconst files = await filesystem.listFiles(workspaceRoot)\n\tconst fileContents = new Map<string, string>()\n\tconst imageFiles = new Map<string, { mimeType: string; size: number }>() // Track image files separately\n\tconst mentions: FileMention[] = []\n\n\t// Regex patterns for file paths\n\t// Match relative paths with extension within workspace\n\tconst relativePathRegex = /\\b([\\w/_-]+(?:\\\\.|[\\w/_-])*(?:\\.[\\w-]+)+)\\b/g\n\t// Match absolute paths with extension (Unix/Linux/Mac)\n\tconst unixAbsolutePathRegex =\n\t\t/(\\/(?:[\\w-]+\\/|[\\w-]+\\\\[.\\s\\S])+[\\w.-]+(?:\\\\.|[\\w.-])*(?:\\.[\\w-]+)+)\\b/g\n\t// Match absolute paths with extension (Windows) - using a more permissive approach\n\tconst windowsAbsolutePathRegex = /\\b([A-Za-z]:[\\\\\\\\][^\\s\"'<>|]*(?:\\.[\\w-]+)+)\\b/g\n\n\t// Process matches for each regex pattern\n\tawait processMatches(relativePathRegex, false)\n\tawait processMatches(unixAbsolutePathRegex, true)\n\n\tawait processMatches(windowsAbsolutePathRegex, true)\n\n\t// Process matches from a regex pattern\n\tasync function processMatches(regex: RegExp, isAbsolutePath: boolean) {\n\t\t// Reset regex before execution to ensure we don't miss any matches\n\t\tregex.lastIndex = 0\n\n\t\tlet match\n\t\twhile ((match = regex.exec(content)) !== null) {\n\t\t\tconst [word] = match\n\t\t\t// Unescape special characters in the path\n\t\t\t// Unescape characters in file paths\n\t\t\tlet unescapedWord\n\t\t\t// Check if this is a Windows path with drive letter\n\t\t\tconst isWindowsPath = word.match(/^[A-Za-z]:[\\\\]/) !== null\n\t\t\tif (isWindowsPath) {\n\t\t\t\t// For Windows paths, preserve the backslashes as path separators but handle escaped characters\n\t\t\t\tunescapedWord = word\n\t\t\t} else {\n\t\t\t\t// For other paths, unescape everything\n\t\t\t\tunescapedWord = word.replace(/\\\\(.)/g, '$1')\n\t\t\t}\n\n\t\t\tconst isCached = fileContents.has(unescapedWord) || imageFiles.has(unescapedWord)\n\n\t\t\t// Skip if we've already processed this file path\n\t\t\tif (isCached) {\n\t\t\t\taddMention(unescapedWord, match.index)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Determine file path\n\t\t\tconst filePath = isAbsolutePath\n\t\t\t\t? unescapedWord\n\t\t\t\t: path.join(workspaceRoot, unescapedWord)\n\n\t\t\t// For relative paths, check if file exists in the workspace\n\t\t\tif (!isAbsolutePath && !files.includes(unescapedWord)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// For absolute paths, check if file exists on disk\n\t\t\tif (isAbsolutePath) {\n\t\t\t\ttry {\n\t\t\t\t\t// Just try to stat the file to see if it exists\n\t\t\t\t\tawait filesystem.stat(filePath)\n\t\t\t\t} catch (err) {\n\t\t\t\t\t// File doesn't exist or can't be accessed\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Process the file\n\t\t\ttry {\n\t\t\t\t// Check if this is an image file\n\t\t\t\tconst imageInfo = await getImageFileMetadata(filesystem, filePath)\n\n\t\t\t\tif (imageInfo && isSupportedImageMIMEType(imageInfo.mimeType)) {\n\t\t\t\t\t// This is an image file, treat it as an attachment\n\t\t\t\t\timageFiles.set(unescapedWord, imageInfo)\n\t\t\t\t\t// Read the image file as binary and convert to base64\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst imageBuffer = await filesystem.readBinaryFile(filePath)\n\t\t\t\t\t\tconst base64Data = imageBuffer.toString('base64')\n\t\t\t\t\t\t// Store the base64 data\n\t\t\t\t\t\tfileContents.set(unescapedWord, base64Data)\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tlogger.error(\n\t\t\t\t\t\t\t'Failed to read image as binary',\n\t\t\t\t\t\t\t{ path: unescapedWord },\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t// Set a placeholder in case of error\n\t\t\t\t\t\tfileContents.set(\n\t\t\t\t\t\t\tunescapedWord,\n\t\t\t\t\t\t\t`[Image file: ${unescapedWord} (${imageInfo.mimeType}, ${Math.round(imageInfo.size / 1024)} KB)]`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\taddMention(unescapedWord, match.index)\n\t\t\t\t} else {\n\t\t\t\t\t// Not an image file, handle normally\n\t\t\t\t\tconst isTooLarge = await checkFileSizeLimit(filesystem, filePath)\n\t\t\t\t\tif (isTooLarge) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tconst data = await filesystem.readFile(filePath)\n\t\t\t\t\tfileContents.set(unescapedWord, data)\n\t\t\t\t\taddMention(unescapedWord, match.index)\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\t// Skip file if there's any error reading it\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t}\n\n\t// Helper function to add a mention\n\tfunction addMention(path: string, startIndex: number) {\n\t\tmentions.push({\n\t\t\tpath,\n\t\t\trange: {\n\t\t\t\tstart: startIndex,\n\t\t\t\tend: startIndex + path.length - 1,\n\t\t\t},\n\t\t})\n\t}\n\n\t// Create a FileMentions instance with both text and image file contents\n\tconst fileMentions = new FileMentions(fileContents, mentions)\n\n\t// Add image file metadata to the FileMentions instance\n\tfileMentions.imageFiles = imageFiles\n\n\treturn fileMentions\n}\n"],"names":["getFileMentions","content","workspaceRoot","filesystem","files","fileContents","imageFiles","mentions","relativePathRegex","unixAbsolutePathRegex","windowsAbsolutePathRegex","processMatches","regex","isAbsolutePath","match","word","unescapedWord","addMention","filePath","path","imageInfo","getImageFileMetadata","isSupportedImageMIMEType","base64Data","error","logger","checkFileSizeLimit","data","startIndex","fileMentions","FileMentions"],"mappings":";;;AASsB,eAAAA,EACrBC,GACAC,GACAC,GACwB;AACxB,QAAMC,IAAQ,MAAMD,EAAW,UAAUD,CAAa,GAChDG,wBAAmB,IAAoB,GACvCC,wBAAiB,IAAgD,GACjEC,IAA0B,CAAC,GAI3BC,IAAoB,gDAEpBC,IACL,2EAEKC,IAA2B;AAG3B,QAAAC,EAAeH,GAAmB,EAAK,GACvC,MAAAG,EAAeF,GAAuB,EAAI,GAE1C,MAAAE,EAAeD,GAA0B,EAAI;AAGpC,iBAAAC,EAAeC,GAAeC,GAAyB;AAErE,IAAAD,EAAM,YAAY;AAEd,QAAAE;AACJ,YAAQA,IAAQF,EAAM,KAAKX,CAAO,OAAO,QAAM;AACxC,YAAA,CAACc,CAAI,IAAID;AAGX,UAAAE;AAcJ,UAZsBD,EAAK,MAAM,gBAAgB,MAAM,OAGtCC,IAAAD,IAGAC,IAAAD,EAAK,QAAQ,UAAU,IAAI,GAG3BV,EAAa,IAAIW,CAAa,KAAKV,EAAW,IAAIU,CAAa,GAGlE;AACF,QAAAC,EAAAD,GAAeF,EAAM,KAAK;AACrC;AAAA,MAAA;AAID,YAAMI,IAAWL,IACdG,IACAG,EAAK,KAAKjB,GAAec,CAAa;AAGzC,UAAI,GAACH,KAAkB,CAACT,EAAM,SAASY,CAAa,IAKpD;AAAA,YAAIH;AACC,cAAA;AAEG,kBAAAV,EAAW,KAAKe,CAAQ;AAAA,kBACjB;AAEb;AAAA,UAAA;AAKE,YAAA;AAEH,gBAAME,IAAY,MAAMC,EAAqBlB,GAAYe,CAAQ;AAEjE,cAAIE,KAAaE,EAAyBF,EAAU,QAAQ,GAAG;AAEnD,YAAAd,EAAA,IAAIU,GAAeI,CAAS;AAEnC,gBAAA;AAEG,oBAAAG,KADc,MAAMpB,EAAW,eAAee,CAAQ,GAC7B,SAAS,QAAQ;AAEnC,cAAAb,EAAA,IAAIW,GAAeO,CAAU;AAAA,qBAClCC,GAAO;AACR,cAAAC,EAAA;AAAA,gBACN;AAAA,gBACA,EAAE,MAAMT,EAAc;AAAA,gBACtBQ;AAAA,cACD,GAEanB,EAAA;AAAA,gBACZW;AAAA,gBACA,gBAAgBA,CAAa,KAAKI,EAAU,QAAQ,KAAK,KAAK,MAAMA,EAAU,OAAO,IAAI,CAAC;AAAA,cAC3F;AAAA,YAAA;AAEU,YAAAH,EAAAD,GAAeF,EAAM,KAAK;AAAA,UAAA,OAC/B;AAGN,gBADmB,MAAMY,EAAmBvB,GAAYe,CAAQ;AAE/D;AAGD,kBAAMS,IAAO,MAAMxB,EAAW,SAASe,CAAQ;AAClC,YAAAb,EAAA,IAAIW,GAAeW,CAAI,GACzBV,EAAAD,GAAeF,EAAM,KAAK;AAAA,UAAA;AAAA,gBAEvB;AAEf;AAAA,QAAA;AAAA;AAAA,IACD;AAAA,EACD;AAIQ,WAAAG,EAAWE,GAAcS,GAAoB;AACrD,IAAArB,EAAS,KAAK;AAAA,MACb,MAAAY;AAAAA,MACA,OAAO;AAAA,QACN,OAAOS;AAAA,QACP,KAAKA,IAAaT,EAAK,SAAS;AAAA,MAAA;AAAA,IACjC,CACA;AAAA,EAAA;AAIF,QAAMU,IAAe,IAAIC,EAAazB,GAAcE,CAAQ;AAG5D,SAAAsB,EAAa,aAAavB,GAEnBuB;AACR;"}
1
+ {"version":3,"file":"files-BqepJuwv.js","sources":["../../core/src/threads/files.ts"],"sourcesContent":["import path from 'node:path'\nimport logger from '../common/logger'\nimport type { FileSystem } from '../platform/fs/fs'\nimport { getImageFileMetadata } from '../tools/builtin/filesystem/file-type'\nimport { checkFileSizeLimit } from '../tools/builtin/filesystem/read_file.util'\nimport type { FileMention } from './file-mentions'\nimport { FileMentions } from './file-mentions'\nimport { isSupportedImageMIMEType } from './image-attachments'\n\nexport async function getFileMentions(\n\tcontent: string,\n\tworkspaceRoot: string,\n\tfilesystem: Pick<FileSystem, 'stat' | 'readFile' | 'readBinaryFile' | 'listFiles'>,\n): Promise<FileMentions> {\n\tconst files = await filesystem.listFiles(workspaceRoot)\n\tconst fileContents = new Map<string, string>()\n\tconst imageFiles = new Map<string, { mimeType: string; size: number }>() // Track image files separately\n\tconst mentions: FileMention[] = []\n\n\t// Regex patterns for file paths\n\t// Match relative paths with extension within workspace\n\tconst relativePathRegex = /\\b([\\w/_-]+(?:\\\\.|[\\w/_-])*(?:\\.[\\w-]+)+)\\b/g\n\t// Match absolute paths with extension (Unix/Linux/Mac)\n\tconst unixAbsolutePathRegex =\n\t\t/(\\/(?:[\\w-]+\\/|[\\w-]+\\\\[.\\s\\S])+[\\w.-]+(?:\\\\.|[\\w.-])*(?:\\.[\\w-]+)+)\\b/g\n\t// Match absolute paths with extension (Windows) - using a more permissive approach\n\tconst windowsAbsolutePathRegex = /\\b([A-Za-z]:[\\\\\\\\][^\\s\"'<>|]*(?:\\.[\\w-]+)+)\\b/g\n\n\t// Process matches for each regex pattern\n\tawait processMatches(relativePathRegex, false)\n\tawait processMatches(unixAbsolutePathRegex, true)\n\n\tawait processMatches(windowsAbsolutePathRegex, true)\n\n\t// Process matches from a regex pattern\n\tasync function processMatches(regex: RegExp, isAbsolutePath: boolean) {\n\t\t// Reset regex before execution to ensure we don't miss any matches\n\t\tregex.lastIndex = 0\n\n\t\tlet match\n\t\twhile ((match = regex.exec(content)) !== null) {\n\t\t\tconst [word] = match\n\t\t\t// Unescape special characters in the path\n\t\t\t// Unescape characters in file paths\n\t\t\tlet unescapedWord\n\t\t\t// Check if this is a Windows path with drive letter\n\t\t\tconst isWindowsPath = word.match(/^[A-Za-z]:[\\\\]/) !== null\n\t\t\tif (isWindowsPath) {\n\t\t\t\t// For Windows paths, preserve the backslashes as path separators but handle escaped characters\n\t\t\t\tunescapedWord = word\n\t\t\t} else {\n\t\t\t\t// For other paths, unescape everything\n\t\t\t\tunescapedWord = word.replace(/\\\\(.)/g, '$1')\n\t\t\t}\n\n\t\t\tconst isCached = fileContents.has(unescapedWord) || imageFiles.has(unescapedWord)\n\n\t\t\t// Skip if we've already processed this file path\n\t\t\tif (isCached) {\n\t\t\t\taddMention(unescapedWord, match.index)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Determine file path\n\t\t\tconst filePath = isAbsolutePath\n\t\t\t\t? unescapedWord\n\t\t\t\t: path.join(workspaceRoot, unescapedWord)\n\n\t\t\t// For relative paths, check if file exists in the workspace\n\t\t\tif (!isAbsolutePath && !files.includes(unescapedWord)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// For absolute paths, check if file exists on disk\n\t\t\tif (isAbsolutePath) {\n\t\t\t\ttry {\n\t\t\t\t\t// Just try to stat the file to see if it exists\n\t\t\t\t\tawait filesystem.stat(filePath)\n\t\t\t\t} catch (err) {\n\t\t\t\t\t// File doesn't exist or can't be accessed\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Process the file\n\t\t\ttry {\n\t\t\t\t// Check if this is an image file\n\t\t\t\tconst imageInfo = await getImageFileMetadata(filesystem, filePath)\n\n\t\t\t\tif (imageInfo && isSupportedImageMIMEType(imageInfo.mimeType)) {\n\t\t\t\t\t// This is an image file, treat it as an attachment\n\t\t\t\t\timageFiles.set(unescapedWord, imageInfo)\n\t\t\t\t\t// Read the image file as binary and convert to base64\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst imageBuffer = await filesystem.readBinaryFile(filePath)\n\t\t\t\t\t\tconst base64Data = imageBuffer.toString('base64')\n\t\t\t\t\t\t// Store the base64 data\n\t\t\t\t\t\tfileContents.set(unescapedWord, base64Data)\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tlogger.error(\n\t\t\t\t\t\t\t'Failed to read image as binary',\n\t\t\t\t\t\t\t{ path: unescapedWord },\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t)\n\t\t\t\t\t\t// Set a placeholder in case of error\n\t\t\t\t\t\tfileContents.set(\n\t\t\t\t\t\t\tunescapedWord,\n\t\t\t\t\t\t\t`[Image file: ${unescapedWord} (${imageInfo.mimeType}, ${Math.round(imageInfo.size / 1024)} KB)]`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\taddMention(unescapedWord, match.index)\n\t\t\t\t} else {\n\t\t\t\t\t// Not an image file, handle normally\n\t\t\t\t\tconst isTooLarge = await checkFileSizeLimit(filesystem, filePath)\n\t\t\t\t\tif (isTooLarge) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tconst data = await filesystem.readFile(filePath)\n\t\t\t\t\tfileContents.set(unescapedWord, data)\n\t\t\t\t\taddMention(unescapedWord, match.index)\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\t// Skip file if there's any error reading it\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t}\n\n\t// Helper function to add a mention\n\tfunction addMention(path: string, startIndex: number) {\n\t\tmentions.push({\n\t\t\tpath,\n\t\t\trange: {\n\t\t\t\tstart: startIndex,\n\t\t\t\tend: startIndex + path.length - 1,\n\t\t\t},\n\t\t})\n\t}\n\n\t// Create a FileMentions instance with both text and image file contents\n\tconst fileMentions = new FileMentions(fileContents, mentions)\n\n\t// Add image file metadata to the FileMentions instance\n\tfileMentions.imageFiles = imageFiles\n\n\treturn fileMentions\n}\n"],"names":["getFileMentions","content","workspaceRoot","filesystem","files","fileContents","imageFiles","mentions","relativePathRegex","unixAbsolutePathRegex","windowsAbsolutePathRegex","processMatches","regex","isAbsolutePath","match","word","unescapedWord","addMention","filePath","path","imageInfo","getImageFileMetadata","isSupportedImageMIMEType","base64Data","error","logger","checkFileSizeLimit","data","startIndex","fileMentions","FileMentions"],"mappings":";;;AASsB,eAAAA,EACrBC,GACAC,GACAC,GACwB;AACxB,QAAMC,IAAQ,MAAMD,EAAW,UAAUD,CAAa,GAChDG,wBAAmB,IAAoB,GACvCC,wBAAiB,IAAgD,GACjEC,IAA0B,CAAC,GAI3BC,IAAoB,gDAEpBC,IACL,2EAEKC,IAA2B;AAG3B,QAAAC,EAAeH,GAAmB,EAAK,GACvC,MAAAG,EAAeF,GAAuB,EAAI,GAE1C,MAAAE,EAAeD,GAA0B,EAAI;AAGpC,iBAAAC,EAAeC,GAAeC,GAAyB;AAErE,IAAAD,EAAM,YAAY;AAEd,QAAAE;AACJ,YAAQA,IAAQF,EAAM,KAAKX,CAAO,OAAO,QAAM;AACxC,YAAA,CAACc,CAAI,IAAID;AAGX,UAAAE;AAcJ,UAZsBD,EAAK,MAAM,gBAAgB,MAAM,OAGtCC,IAAAD,IAGAC,IAAAD,EAAK,QAAQ,UAAU,IAAI,GAG3BV,EAAa,IAAIW,CAAa,KAAKV,EAAW,IAAIU,CAAa,GAGlE;AACF,QAAAC,EAAAD,GAAeF,EAAM,KAAK;AACrC;AAAA,MAAA;AAID,YAAMI,IAAWL,IACdG,IACAG,EAAK,KAAKjB,GAAec,CAAa;AAGzC,UAAI,GAACH,KAAkB,CAACT,EAAM,SAASY,CAAa,IAKpD;AAAA,YAAIH;AACC,cAAA;AAEG,kBAAAV,EAAW,KAAKe,CAAQ;AAAA,kBACjB;AAEb;AAAA,UAAA;AAKE,YAAA;AAEH,gBAAME,IAAY,MAAMC,EAAqBlB,GAAYe,CAAQ;AAEjE,cAAIE,KAAaE,EAAyBF,EAAU,QAAQ,GAAG;AAEnD,YAAAd,EAAA,IAAIU,GAAeI,CAAS;AAEnC,gBAAA;AAEG,oBAAAG,KADc,MAAMpB,EAAW,eAAee,CAAQ,GAC7B,SAAS,QAAQ;AAEnC,cAAAb,EAAA,IAAIW,GAAeO,CAAU;AAAA,qBAClCC,GAAO;AACR,cAAAC,EAAA;AAAA,gBACN;AAAA,gBACA,EAAE,MAAMT,EAAc;AAAA,gBACtBQ;AAAA,cACD,GAEanB,EAAA;AAAA,gBACZW;AAAA,gBACA,gBAAgBA,CAAa,KAAKI,EAAU,QAAQ,KAAK,KAAK,MAAMA,EAAU,OAAO,IAAI,CAAC;AAAA,cAC3F;AAAA,YAAA;AAEU,YAAAH,EAAAD,GAAeF,EAAM,KAAK;AAAA,UAAA,OAC/B;AAGN,gBADmB,MAAMY,EAAmBvB,GAAYe,CAAQ;AAE/D;AAGD,kBAAMS,IAAO,MAAMxB,EAAW,SAASe,CAAQ;AAClC,YAAAb,EAAA,IAAIW,GAAeW,CAAI,GACzBV,EAAAD,GAAeF,EAAM,KAAK;AAAA,UAAA;AAAA,gBAEvB;AAEf;AAAA,QAAA;AAAA;AAAA,IACD;AAAA,EACD;AAIQ,WAAAG,EAAWE,GAAcS,GAAoB;AACrD,IAAArB,EAAS,KAAK;AAAA,MACb,MAAAY;AAAAA,MACA,OAAO;AAAA,QACN,OAAOS;AAAA,QACP,KAAKA,IAAaT,EAAK,SAAS;AAAA,MAAA;AAAA,IACjC,CACA;AAAA,EAAA;AAIF,QAAMU,IAAe,IAAIC,EAAazB,GAAcE,CAAQ;AAG5D,SAAAsB,EAAa,aAAavB,GAEnBuB;AACR;"}
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn as yt } from "node:child_process";
3
- import { as as Ht, O as $t, g as mt, m as Lt, aS as Tt, k as vt } from "./color-DH4c3nvN.js";
4
- import { r as Ot } from "./executable-BJNIVWlu.js";
3
+ import { at as Ht, O as $t, g as mt, m as Lt, aV as Tt, k as vt } from "./color-BHYGC4Ar.js";
4
+ import { r as Ot } from "./executable-CBhkfVUL.js";
5
5
  var pt = {}, ft, Et;
6
6
  function it() {
7
7
  if (Et) return ft;
@@ -250,7 +250,7 @@ function wt() {
250
250
  return ht = (T, G) => {
251
251
  const b = G || {}, Y = T.length - 1, B = b.parts === !0 || b.scanToEnd === !0, W = [], w = [], st = [];
252
252
  let M = T, H = -1, N = 0, tt = 0, rt = !1, j = !1, v = !1, et = !1, X = !1, s = !1, k = !1, z = !1, ut = !1, t = !1, e = 0, nt, l, C = { value: "", depth: 0, isGlob: !1 };
253
- const V = () => H >= Y, J = () => M.charCodeAt(H + 1), U = () => (nt = l, M.charCodeAt(++H));
253
+ const Z = () => H >= Y, J = () => M.charCodeAt(H + 1), U = () => (nt = l, M.charCodeAt(++H));
254
254
  for (; H < Y; ) {
255
255
  l = U();
256
256
  let q;
@@ -259,7 +259,7 @@ function wt() {
259
259
  continue;
260
260
  }
261
261
  if (s === !0 || l === f) {
262
- for (e++; V() !== !0 && (l = U()); ) {
262
+ for (e++; Z() !== !0 && (l = U()); ) {
263
263
  if (l === d) {
264
264
  k = C.backslashes = !0, U();
265
265
  continue;
@@ -298,7 +298,7 @@ function wt() {
298
298
  }
299
299
  if (b.noext !== !0 && (l === E || l === R || l === A || l === r || l === u) === !0 && J() === x) {
300
300
  if (v = C.isGlob = !0, et = C.isExtglob = !0, t = !0, l === u && H === N && (ut = !0), B === !0) {
301
- for (; V() !== !0 && (l = U()); ) {
301
+ for (; Z() !== !0 && (l = U()); ) {
302
302
  if (l === d) {
303
303
  k = C.backslashes = !0, l = U();
304
304
  continue;
@@ -323,7 +323,7 @@ function wt() {
323
323
  break;
324
324
  }
325
325
  if (l === c) {
326
- for (; V() !== !0 && (q = U()); ) {
326
+ for (; Z() !== !0 && (q = U()); ) {
327
327
  if (q === d) {
328
328
  k = C.backslashes = !0, U();
329
329
  continue;
@@ -343,7 +343,7 @@ function wt() {
343
343
  }
344
344
  if (b.noparen !== !0 && l === x) {
345
345
  if (v = C.isGlob = !0, B === !0) {
346
- for (; V() !== !0 && (l = U()); ) {
346
+ for (; Z() !== !0 && (l = U()); ) {
347
347
  if (l === x) {
348
348
  k = C.backslashes = !0, l = U();
349
349
  continue;
@@ -364,14 +364,14 @@ function wt() {
364
364
  }
365
365
  }
366
366
  b.noext === !0 && (et = !1, v = !1);
367
- let D = M, ot = "", Z = "";
368
- N > 0 && (ot = M.slice(0, N), M = M.slice(N), tt -= N), D && v === !0 && tt > 0 ? (D = M.slice(0, tt), Z = M.slice(tt)) : v === !0 ? (D = "", Z = M) : D = M, D && D !== "" && D !== "/" && D !== M && S(D.charCodeAt(D.length - 1)) && (D = D.slice(0, -1)), b.unescape === !0 && (Z && (Z = p.removeBackslashes(Z)), D && k === !0 && (D = p.removeBackslashes(D)));
367
+ let D = M, ot = "", V = "";
368
+ N > 0 && (ot = M.slice(0, N), M = M.slice(N), tt -= N), D && v === !0 && tt > 0 ? (D = M.slice(0, tt), V = M.slice(tt)) : v === !0 ? (D = "", V = M) : D = M, D && D !== "" && D !== "/" && D !== M && S(D.charCodeAt(D.length - 1)) && (D = D.slice(0, -1)), b.unescape === !0 && (V && (V = p.removeBackslashes(V)), D && k === !0 && (D = p.removeBackslashes(D)));
369
369
  const h = {
370
370
  prefix: ot,
371
371
  input: T,
372
372
  start: N,
373
373
  base: D,
374
- glob: Z,
374
+ glob: V,
375
375
  isBrace: rt,
376
376
  isBracket: j,
377
377
  isGlob: v,
@@ -460,7 +460,7 @@ function Nt() {
460
460
  c = A.removePrefix(c, s), m = c.length;
461
461
  const k = [], z = [], ut = [];
462
462
  let t = y, e;
463
- const nt = () => s.index === m - 1, l = s.peek = (i = 1) => c[s.index + i], C = s.advance = () => c[++s.index] || "", V = () => c.slice(s.index + 1), J = (i = "", L = 0) => {
463
+ const nt = () => s.index === m - 1, l = s.peek = (i = 1) => c[s.index + i], C = s.advance = () => c[++s.index] || "", Z = () => c.slice(s.index + 1), J = (i = "", L = 0) => {
464
464
  s.consumed += i, s.index += L;
465
465
  }, U = (i) => {
466
466
  s.output += i.output != null ? i.output : i.value, J(i.value);
@@ -471,7 +471,7 @@ function Nt() {
471
471
  return i % 2 === 0 ? !1 : (s.negated = !0, s.start++, !0);
472
472
  }, ot = (i) => {
473
473
  s[i]++, ut.push(i);
474
- }, Z = (i) => {
474
+ }, V = (i) => {
475
475
  s[i]--, ut.pop();
476
476
  }, h = (i) => {
477
477
  if (t.type === "globstar") {
@@ -492,13 +492,13 @@ function Nt() {
492
492
  let L = i.close + (r.capture ? ")" : ""), n;
493
493
  if (i.type === "negate") {
494
494
  let _ = X;
495
- if (i.inner && i.inner.length > 1 && i.inner.includes("/") && (_ = j(r)), (_ !== X || nt() || /^\)+$/.test(V())) && (L = i.close = `)$))${_}`), i.inner.includes("*") && (n = V()) && /^\.[^\\/.]+$/.test(n)) {
495
+ if (i.inner && i.inner.length > 1 && i.inner.includes("/") && (_ = j(r)), (_ !== X || nt() || /^\)+$/.test(Z())) && (L = i.close = `)$))${_}`), i.inner.includes("*") && (n = Z()) && /^\.[^\\/.]+$/.test(n)) {
496
496
  const O = x(n, { ...E, fastpaths: !1 }).output;
497
497
  L = i.close = `)${O})${_})`;
498
498
  }
499
499
  i.prev.type === "bos" && (s.negatedExtglob = !0);
500
500
  }
501
- h({ type: "paren", extglob: !0, value: e, output: L }), Z("parens");
501
+ h({ type: "paren", extglob: !0, value: e, output: L }), V("parens");
502
502
  };
503
503
  if (r.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(c)) {
504
504
  let i = !1, L = c.replace(o, (n, _, O, Q, P, lt) => Q === "\\" ? (i = !0, n) : Q === "?" ? _ ? _ + Q + (P ? H.repeat(P.length) : "") : lt === 0 ? et + (P ? H.repeat(P.length) : "") : H.repeat(O.length) : Q === "." ? G.repeat(O.length) : Q === "*" ? _ ? _ + Q + (P ? X : "") : X : _ ? n : `\\${n}`);
@@ -515,7 +515,7 @@ function Nt() {
515
515
  e += "\\", h({ type: "text", value: e });
516
516
  continue;
517
517
  }
518
- const _ = /^\\+/.exec(V());
518
+ const _ = /^\\+/.exec(Z());
519
519
  let O = 0;
520
520
  if (_ && _[0].length > 2 && (O = _[0].length, s.index += O, O % 2 !== 0 && (e += "\\")), r.unescape === !0 ? e = C() : e += C(), s.brackets === 0) {
521
521
  h({ type: "text", value: e });
@@ -556,11 +556,11 @@ function Nt() {
556
556
  K(k.pop());
557
557
  continue;
558
558
  }
559
- h({ type: "paren", value: e, output: s.parens ? ")" : "\\)" }), Z("parens");
559
+ h({ type: "paren", value: e, output: s.parens ? ")" : "\\)" }), V("parens");
560
560
  continue;
561
561
  }
562
562
  if (e === "[") {
563
- if (r.nobracket === !0 || !V().includes("]")) {
563
+ if (r.nobracket === !0 || !Z().includes("]")) {
564
564
  if (r.nobracket !== !0 && r.strictBrackets === !0)
565
565
  throw new SyntaxError(f("closing", "]"));
566
566
  e = `\\${e}`;
@@ -580,7 +580,7 @@ function Nt() {
580
580
  h({ type: "text", value: e, output: `\\${e}` });
581
581
  continue;
582
582
  }
583
- Z("brackets");
583
+ V("brackets");
584
584
  const n = t.value.slice(1);
585
585
  if (t.posix !== !0 && n[0] === "^" && !n.includes("/") && (e = `/${e}`), t.value += e, U({ value: e }), r.literalBrackets === !1 || A.hasRegexChars(n))
586
586
  continue;
@@ -623,7 +623,7 @@ function Nt() {
623
623
  for (const P of Q)
624
624
  s.output += P.output || P.value;
625
625
  }
626
- h({ type: "brace", value: e, output: _ }), Z("braces"), z.pop();
626
+ h({ type: "brace", value: e, output: _ }), V("braces"), z.pop();
627
627
  continue;
628
628
  }
629
629
  if (e === "|") {
@@ -666,7 +666,7 @@ function Nt() {
666
666
  if (t && t.type === "paren") {
667
667
  const _ = l();
668
668
  let O = e;
669
- (t.value === "(" && !/[!=<:]/.test(_) || _ === "<" && !/<([!=]|\w+>)/.test(V())) && (O = `\\${e}`), h({ type: "text", value: e, output: O });
669
+ (t.value === "(" && !/[!=<:]/.test(_) || _ === "<" && !/<([!=]|\w+>)/.test(Z())) && (O = `\\${e}`), h({ type: "text", value: e, output: O });
670
670
  continue;
671
671
  }
672
672
  if (r.dot !== !0 && (t.type === "slash" || t.type === "bos")) {
@@ -712,7 +712,7 @@ function Nt() {
712
712
  }
713
713
  if (e !== "*") {
714
714
  (e === "$" || e === "^") && (e = `\\${e}`);
715
- const n = g.exec(V());
715
+ const n = g.exec(Z());
716
716
  n && (e += n[0], s.index += n[0].length), h({ type: "text", value: e });
717
717
  continue;
718
718
  }
@@ -720,7 +720,7 @@ function Nt() {
720
720
  t.type = "star", t.star = !0, t.value += e, t.output = X, s.backtrack = !0, s.globstar = !0, J(e);
721
721
  continue;
722
722
  }
723
- let i = V();
723
+ let i = Z();
724
724
  if (r.noextglob !== !0 && /^\([^?]/.test(i)) {
725
725
  q("star", e);
726
726
  continue;
@@ -779,15 +779,15 @@ function Nt() {
779
779
  }
780
780
  for (; s.brackets > 0; ) {
781
781
  if (r.strictBrackets === !0) throw new SyntaxError(f("closing", "]"));
782
- s.output = A.escapeLast(s.output, "["), Z("brackets");
782
+ s.output = A.escapeLast(s.output, "["), V("brackets");
783
783
  }
784
784
  for (; s.parens > 0; ) {
785
785
  if (r.strictBrackets === !0) throw new SyntaxError(f("closing", ")"));
786
- s.output = A.escapeLast(s.output, "("), Z("parens");
786
+ s.output = A.escapeLast(s.output, "("), V("parens");
787
787
  }
788
788
  for (; s.braces > 0; ) {
789
789
  if (r.strictBrackets === !0) throw new SyntaxError(f("closing", "}"));
790
- s.output = A.escapeLast(s.output, "{"), Z("braces");
790
+ s.output = A.escapeLast(s.output, "{"), V("braces");
791
791
  }
792
792
  if (r.strictSlashes !== !0 && (t.type === "star" || t.type === "bracket") && h({ type: "maybe_slash", value: "", output: `${Y}?` }), s.backtrack === !0) {
793
793
  s.output = "";
@@ -1048,4 +1048,4 @@ export {
1048
1048
  Xt as nodeGlobTool,
1049
1049
  Mt as ripgrepFiles
1050
1050
  };
1051
- //# sourceMappingURL=glob.node-C9lKzgi-.js.map
1051
+ //# sourceMappingURL=glob.node-BINRiQjJ.js.map