@sourcegraph/amp 0.0.1749196899-g16ba82 → 0.0.1749211345-g16cdfc

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 (44) hide show
  1. package/dist/amp.js +3 -3
  2. package/dist/{client-D1Pmx669.js → client-Dd8T5Ydk.js} +2 -2
  3. package/dist/{client-D1Pmx669.js.map → client-Dd8T5Ydk.js.map} +1 -1
  4. package/dist/{console-DZmALLuA.js → console-D_ZxbRrA.js} +13 -13
  5. package/dist/{console-DZmALLuA.js.map → console-D_ZxbRrA.js.map} +1 -1
  6. package/dist/{create_file.node-CygrebBY.js → create_file.node-D_xwgdhJ.js} +2 -2
  7. package/dist/{create_file.node-CygrebBY.js.map → create_file.node-D_xwgdhJ.js.map} +1 -1
  8. package/dist/{edit_file.node-D_cMkiLI.js → edit_file.node-Cv9nC-uR.js} +3 -3
  9. package/dist/{edit_file.node-D_cMkiLI.js.map → edit_file.node-Cv9nC-uR.js.map} +1 -1
  10. package/dist/{executable-C8qYZU1W.js → executable-BTpHtmPV.js} +2 -2
  11. package/dist/{executable-C8qYZU1W.js.map → executable-BTpHtmPV.js.map} +1 -1
  12. package/dist/{files--h2VjD8F.js → files-CNmw2a6V.js} +2 -2
  13. package/dist/{files--h2VjD8F.js.map → files-CNmw2a6V.js.map} +1 -1
  14. package/dist/{glob.node-AB34HaNl.js → glob.node-Dbygwo7q.js} +4 -4
  15. package/dist/{glob.node-AB34HaNl.js.map → glob.node-Dbygwo7q.js.map} +1 -1
  16. package/dist/{index-nQBDDlvh.js → index-DGuVA6oK.js} +2 -2
  17. package/dist/{index-nQBDDlvh.js.map → index-DGuVA6oK.js.map} +1 -1
  18. package/dist/{list_directory.node-DZamBwOx.js → list_directory.node-DJCJkqLg.js} +2 -2
  19. package/dist/{list_directory.node-DZamBwOx.js.map → list_directory.node-DJCJkqLg.js.map} +1 -1
  20. package/dist/{load-profile-DzDzDOIq.js → load-profile-CXHBU_AI.js} +2 -2
  21. package/dist/{load-profile-DzDzDOIq.js.map → load-profile-CXHBU_AI.js.map} +1 -1
  22. package/dist/{main-WXbdYG4Z.js → main-CtHA5Ylu.js} +409 -398
  23. package/dist/{main-WXbdYG4Z.js.map → main-CtHA5Ylu.js.map} +1 -1
  24. package/dist/{node-CBRPqFin.js → node-BOIz1I5S.js} +374 -320
  25. package/dist/node-BOIz1I5S.js.map +1 -0
  26. package/dist/{node-Cs3K2AKs.js → node-C2cKbj9k.js} +3 -3
  27. package/dist/{node-Cs3K2AKs.js.map → node-C2cKbj9k.js.map} +1 -1
  28. package/dist/{node-CUCcBUhU.js → node-D9dPV0eu.js} +4 -4
  29. package/dist/{node-CUCcBUhU.js.map → node-D9dPV0eu.js.map} +1 -1
  30. package/dist/{node-B9XNCq_w.js → node-DPPbAAw0.js} +2 -2
  31. package/dist/{node-B9XNCq_w.js.map → node-DPPbAAw0.js.map} +1 -1
  32. package/dist/{node-SvjAOtkw.js → node-DZCyuAqY.js} +2 -2
  33. package/dist/{node-SvjAOtkw.js.map → node-DZCyuAqY.js.map} +1 -1
  34. package/dist/{node-D2Ho0W-v.js → node-DaL4eJRQ.js} +3 -3
  35. package/dist/{node-D2Ho0W-v.js.map → node-DaL4eJRQ.js.map} +1 -1
  36. package/dist/{read_file.node-CveQp78z.js → read_file.node-CAD-I3qI.js} +2 -2
  37. package/dist/{read_file.node-CveQp78z.js.map → read_file.node-CAD-I3qI.js.map} +1 -1
  38. package/dist/{stdio-CRvROLK4.js → stdio-7mSc8Mj0.js} +3 -3
  39. package/dist/{stdio-CRvROLK4.js.map → stdio-7mSc8Mj0.js.map} +1 -1
  40. package/dist/storybook.js +1 -1
  41. package/dist/{undo_edit.node-C3I02TEE.js → undo_edit.node-BYH1ok_y.js} +2 -2
  42. package/dist/{undo_edit.node-C3I02TEE.js.map → undo_edit.node-BYH1ok_y.js.map} +1 -1
  43. package/package.json +1 -1
  44. package/dist/node-CBRPqFin.js.map +0 -1
@@ -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-DZmALLuA.js";
3
+ import { p as d, aC as f, aD as l } from "./console-D_ZxbRrA.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");
@@ -19,4 +19,4 @@ const w = ({ args: t }, { dir: a, dirs: n, trackFileChange: c, filesystem: o })
19
19
  export {
20
20
  w as nodeCreateFileTool
21
21
  };
22
- //# sourceMappingURL=create_file.node-CygrebBY.js.map
22
+ //# sourceMappingURL=create_file.node-D_xwgdhJ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create_file.node-CygrebBY.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\tconst content = args.content\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,QAAMM,IAAUZ,EAAK;AACf,eAAAG,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-D_xwgdhJ.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\tconst content = args.content\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,QAAMM,IAAUZ,EAAK;AACf,eAAAG,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, aC as m, aD as F, aE as v, aF as _, aG as b } from "./console-DZmALLuA.js";
3
- import { recordEdit as x } from "./undo_edit.node-C3I02TEE.js";
2
+ import { p, aC as m, aD as F, aE as v, aF as _, aG as b } from "./console-D_ZxbRrA.js";
3
+ import { recordEdit as x } from "./undo_edit.node-BYH1ok_y.js";
4
4
  class E {
5
5
  #e = !1;
6
6
  #t = [];
@@ -65,4 +65,4 @@ function y(e) {
65
65
  export {
66
66
  k as nodeEditFileTool
67
67
  };
68
- //# sourceMappingURL=edit_file.node-D_cMkiLI.js.map
68
+ //# sourceMappingURL=edit_file.node-Cv9nC-uR.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"edit_file.node-D_cMkiLI.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-Cv9nC-uR.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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AAML,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 { C as i } from "./console-DZmALLuA.js";
4
+ import { C as i } from "./console-D_ZxbRrA.js";
5
5
  function u() {
6
6
  {
7
7
  if (process.env.AMP_RIPGREP_PATH)
@@ -19,4 +19,4 @@ function u() {
19
19
  export {
20
20
  u as r
21
21
  };
22
- //# sourceMappingURL=executable-C8qYZU1W.js.map
22
+ //# sourceMappingURL=executable-BTpHtmPV.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"executable-C8qYZU1W.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\tif (process.env.AMP_RIPGREP_PATH) {\n\t\t\treturn process.env.AMP_RIPGREP_PATH\n\t\t}\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;AASU;AAChD,QAAA,QAAQ,IAAI;AACf,aAAO,QAAQ,IAAI;AAEhB,QAAA;AAMH,YAAMC,IAJUC,EAAc,YAAY,GAAG,EAGf,iBAAiB,GACjB;AAE1B,UAAAD,KAAUE,EAAWF,CAAM;AACvB,eAAAA;AAAA,aAEAG,GAAO;AACR,MAAAC,EAAA,MAAM,uBAAuBD,CAAK;AAAA,IAAA;AAAA,EAC1C;AAGM,SAAA;AACR;"}
1
+ {"version":3,"file":"executable-BTpHtmPV.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\tif (process.env.AMP_RIPGREP_PATH) {\n\t\t\treturn process.env.AMP_RIPGREP_PATH\n\t\t}\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;AASU;AAChD,QAAA,QAAQ,IAAI;AACf,aAAO,QAAQ,IAAI;AAEhB,QAAA;AAMH,YAAMC,IAJUC,EAAc,YAAY,GAAG,EAGf,iBAAiB,GACjB;AAE1B,UAAAD,KAAUE,EAAWF,CAAM;AACvB,eAAAA;AAAA,aAEAG,GAAO;AACR,MAAAC,EAAA,MAAM,uBAAuBD,CAAK;AAAA,IAAA;AAAA,EAC1C;AAGM,SAAA;AACR;"}
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
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-DZmALLuA.js";
3
+ import { b8 as I, b9 as T, C as z, ba as B, bb as C } from "./console-D_ZxbRrA.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--h2VjD8F.js.map
70
+ //# sourceMappingURL=files-CNmw2a6V.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"files--h2VjD8F.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-CNmw2a6V.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,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-nQBDDlvh.js";
4
- import { O as v, g as N, m as E, aC as P, C as R } from "./console-DZmALLuA.js";
5
- import { r as D } from "./executable-C8qYZU1W.js";
3
+ import { p as I } from "./index-DGuVA6oK.js";
4
+ import { O as v, g as N, m as E, aC as P, C as R } from "./console-D_ZxbRrA.js";
5
+ import { r as D } from "./executable-BTpHtmPV.js";
6
6
  const S = ({ args: i }, { dirs: r }) => {
7
7
  if (r.length === 0)
8
8
  return new v((s) => {
@@ -134,4 +134,4 @@ export {
134
134
  S as nodeGlobTool,
135
135
  F as ripgrepFiles
136
136
  };
137
- //# sourceMappingURL=glob.node-AB34HaNl.js.map
137
+ //# sourceMappingURL=glob.node-Dbygwo7q.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"glob.node-AB34HaNl.js","sources":["../../core/src/tools/builtin/filesystem/glob.node.ts"],"sourcesContent":["import { combineLatest, map, Observable } from '@sourcegraph/observable'\nimport { spawn } from 'node:child_process'\nimport pm from 'picomatch'\nimport type { URI } from 'vscode-uri'\nimport logger from '../../../common/logger'\nimport type { ToolRun } from '../../tool-service'\nimport { ripgrepExecutable } from '../grep/executable'\nimport { checkDirURIIsFile } from '../node-helpers'\nimport type { GlobToolDef, globToolReg } from './glob.common'\n\nexport interface GlobFilesWithRipgrepOptions {\n\tlimit?: number\n\toffset?: number\n\tmaxDepth?: number\n\tbasePath?: string\n\tsignal?: AbortSignal\n}\n\nexport const nodeGlobTool: NonNullable<(typeof globToolReg)['fn']> = ({ args }, { dirs }) => {\n\tif (dirs.length === 0) {\n\t\treturn new Observable((observer) => {\n\t\t\tobserver.next({\n\t\t\t\tstatus: 'error' as const,\n\t\t\t\terror: { message: 'No directory provided' },\n\t\t\t})\n\t\t\tobserver.complete()\n\t\t})\n\t}\n\n\t// Clean up options to avoid exactOptionalPropertyTypes issues\n\tconst options: GlobFilesWithRipgrepOptions = {}\n\tif (args.limit !== undefined) options.limit = args.limit\n\tif (args.offset !== undefined) options.offset = args.offset\n\n\treturn globFilesWithRipgrep(dirs, args.filePattern, options)\n}\n\nexport function globFilesWithRipgrep(\n\tdirs: URI[],\n\tpattern: string | null,\n\toptions?: GlobFilesWithRipgrepOptions,\n): Observable<ToolRun<GlobToolDef>> {\n\treturn combineLatest(\n\t\t...dirs.map((dir) => globFilesInDirWithRipgrep(dir, pattern, options)),\n\t).pipe(\n\t\tmap<ToolRun<GlobToolDef>[], ToolRun<GlobToolDef>>((results) => {\n\t\t\tconst progress: string[] = []\n\t\t\tfor (const result of results) {\n\t\t\t\tif (result.status === 'in-progress') {\n\t\t\t\t\tprogress.push(...(result?.progress ?? []))\n\t\t\t\t} else if (result.status === 'done') {\n\t\t\t\t\tprogress.push(...result.result)\n\t\t\t\t} else if (result.status === 'error') {\n\t\t\t\t\tprogress.push(...(result.progress ?? []))\n\t\t\t\t} else if (result.status === 'cancelled') {\n\t\t\t\t\tprogress.push(...(result.progress ?? []))\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst errors = results.filter((result) => result.status === 'error')\n\t\t\tif (errors.length > 0) {\n\t\t\t\treturn {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tprogress,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tmessage: errors\n\t\t\t\t\t\t\t.map<string>((error) => error?.error?.message ?? '')\n\t\t\t\t\t\t\t.join('\\n'),\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst status = results.every((result) => result.status === 'done')\n\t\t\t\t? 'done'\n\t\t\t\t: results.some((result) => result.status === 'cancelled')\n\t\t\t\t\t? 'cancelled'\n\t\t\t\t\t: 'in-progress'\n\t\t\treturn {\n\t\t\t\tstatus,\n\t\t\t\tprogress,\n\t\t\t\tresult: progress,\n\t\t\t}\n\t\t}),\n\t)\n}\n\nfunction globFilesInDirWithRipgrep(\n\tdir: URI,\n\tpattern: string | null,\n\toptions?: GlobFilesWithRipgrepOptions,\n): Observable<ToolRun<GlobToolDef>> {\n\tcheckDirURIIsFile(dir)\n\treturn new Observable<ToolRun<GlobToolDef>>((observer) => {\n\t\tobserver.next({\n\t\t\tstatus: 'in-progress',\n\t\t\tprogress: [],\n\t\t})\n\n\t\tripgrepFiles(dir.fsPath, pattern ? { pattern, caseInsensitive: true } : null, options ?? {})\n\t\t\t.then(({ files, remaining }) => {\n\t\t\t\tif (remaining > 0) {\n\t\t\t\t\tfiles.push(`--- ${remaining} more files not shown ---`)\n\t\t\t\t}\n\t\t\t\tobserver.next({\n\t\t\t\t\tstatus: 'done',\n\t\t\t\t\tprogress: files,\n\t\t\t\t\tresult: files,\n\t\t\t\t})\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error)\n\t\t\t\tobserver.next({\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tprogress: [],\n\t\t\t\t\terror: { message },\n\t\t\t\t})\n\t\t\t})\n\t\t\t.finally(() => observer.complete())\n\t})\n}\n\ninterface RipgrepResult {\n\tfiles: string[]\n\tremaining: number\n\taborted?: boolean\n}\n\nconst MAX_GLOB_COUNT = 500_000\n\nexport function ripgrepFiles(\n\tdir: string,\n\tglob: {\n\t\tpattern: string\n\t\tcaseInsensitive?: boolean\n\t} | null,\n\tparams: GlobFilesWithRipgrepOptions,\n): Promise<RipgrepResult> {\n\t// The Chromium repo has ~500k files so this is generous\n\t// enough to cover such a large repo. The fuzzy filtering is\n\t// sluggish in the Chromium repo so we don't want it to be\n\t// slower than that, and we also don't want to load arbitrary\n\t// many files into memory.\n\tconst limit = params.limit ?? MAX_GLOB_COUNT\n\n\tif (glob?.pattern && glob.pattern === '*') {\n\t\tglob.pattern = '**'\n\t}\n\t// IMPORTANT: we implement glob filtering on the TypeScript side instead of\n\t// using the ripgrep --glob option because the --glob option disables the\n\t// built-in gitignore/ignore/rgignore support. Instead, to support only\n\t// including certain patterns like `src/**/*.ts` then we filter those out\n\t// from the ripgrep output.\n\tconst matchesGlobPattern = glob?.pattern\n\t\t? pm(glob.pattern, { nocase: glob.caseInsensitive, dot: true })\n\t\t: undefined\n\n\tconst args = [\n\t\t'--files',\n\t\t'--color',\n\t\t'never',\n\t\t'--no-require-git',\n\t\t// We want to include hidden files because dot-files in a repository are often important.\n\t\t'--hidden',\n\t\t// Ripgrep will include the .git/ directory when using --hidden unless\n\t\t// the user explicitly gitignores the .git/ directory, or rgignores it,\n\t\t// which most people don't.\n\t\t'--glob',\n\t\t'!\\\\.git/',\n\t]\n\n\tif (params.maxDepth !== undefined) {\n\t\targs.push('--max-depth', params.maxDepth.toString())\n\t}\n\tif (params.basePath !== undefined) {\n\t\targs.push(params.basePath)\n\t}\n\n\t// We manually control the spawn here instead of using `spawnAndObserveChildProcess` because\n\t// we don't want to re-process the entire output on every streaming chunk.\n\t// Large repos can have hundreds of thousands of files, and we're processing the output on the extension process host.\n\t// ripgrep --files is fast anyways so there's no point in streaming the results.\n\n\tconst proc = spawn(ripgrepExecutable(), args, {\n\t\tcwd: dir,\n\t\tstdio: ['ignore', 'pipe', 'pipe'],\n\t\tdetached: process.platform !== 'win32',\n\t\tenv: {\n\t\t\t...process.env,\n\t\t\tNONINTERACTIVE: '1',\n\t\t\tDEBIAN_FRONTEND: 'noninteractive',\n\t\t},\n\t})\n\n\treturn new Promise<RipgrepResult>((resolve, reject) => {\n\t\tconst lines: string[] = []\n\t\tlet stderr = ''\n\t\tlet line = ''\n\t\tlet offset = params.offset ?? 0\n\t\tlet isResolved = false\n\t\tconst pushLine = (): void => {\n\t\t\tif (isResolved) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!line) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (matchesGlobPattern && !matchesGlobPattern(line)) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst toPush = line\n\t\t\tline = ''\n\n\t\t\tif (offset > 0) {\n\t\t\t\toffset--\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlines.push(toPush)\n\t\t\tif (lines.length >= MAX_GLOB_COUNT) {\n\t\t\t\tlogger.warn('Glob limit reached. Returning partial results.', {\n\t\t\t\t\tglob: glob?.pattern,\n\t\t\t\t\tlimit: MAX_GLOB_COUNT,\n\t\t\t\t\tdir,\n\t\t\t\t})\n\t\t\t\tproc.kill()\n\t\t\t\tisResolved = true\n\t\t\t\tresolve({\n\t\t\t\t\tfiles: lines,\n\t\t\t\t\tremaining: 0,\n\t\t\t\t\taborted: true,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tproc.stdout?.on('data', (data) => {\n\t\t\tfor (const ch of String(data)) {\n\t\t\t\tif (ch === '\\r') {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (ch === '\\n') {\n\t\t\t\t\tpushLine()\n\t\t\t\t\tline = ''\n\t\t\t\t} else {\n\t\t\t\t\tline += ch\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\tproc?.stderr?.on('data', (data) => {\n\t\t\tstderr += String(data)\n\t\t})\n\n\t\tproc.on('exit', (code) => {\n\t\t\t// ripgrep exit code 1 means \"no matches found\" which is valid for our glob tool\n\t\t\tif (code && code >= 2) {\n\t\t\t\treject(new Error(`ripgrep exited with code ${code}:\\n${stderr}`))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// The last line does not end with \\n\n\t\t\tpushLine()\n\n\t\t\tconst filesMatchingLimit = lines.slice(0, limit)\n\t\t\tresolve({\n\t\t\t\tfiles: filesMatchingLimit,\n\t\t\t\tremaining: lines.length - filesMatchingLimit.length,\n\t\t\t})\n\t\t})\n\t})\n}\n"],"names":["nodeGlobTool","args","dirs","Observable","observer","options","globFilesWithRipgrep","pattern","combineLatest","dir","globFilesInDirWithRipgrep","map","results","progress","result","errors","error","checkDirURIIsFile","ripgrepFiles","files","remaining","message","MAX_GLOB_COUNT","glob","params","limit","matchesGlobPattern","pm","proc","spawn","ripgrepExecutable","resolve","reject","lines","stderr","line","offset","isResolved","pushLine","toPush","logger","data","ch","code","filesMatchingLimit"],"mappings":";;;;;AAkBO,MAAMA,IAAwD,CAAC,EAAE,MAAAC,KAAQ,EAAE,MAAAC,QAAW;AACxF,MAAAA,EAAK,WAAW;AACZ,WAAA,IAAIC,EAAW,CAACC,MAAa;AACnC,MAAAA,EAAS,KAAK;AAAA,QACb,QAAQ;AAAA,QACR,OAAO,EAAE,SAAS,wBAAwB;AAAA,MAAA,CAC1C,GACDA,EAAS,SAAS;AAAA,IAAA,CAClB;AAIF,QAAMC,IAAuC,CAAC;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4BW,CAAI;AAAA,EAAMT,CAAM,EAAE,CAAC;AAChE;AAAA,MAAA;AAIQ,MAAAI,EAAA;AAET,YAAMM,IAAqBX,EAAM,MAAM,GAAGR,CAAK;AACvC,MAAAM,EAAA;AAAA,QACP,OAAOa;AAAA,QACP,WAAWX,EAAM,SAASW,EAAmB;AAAA,MAAA,CAC7C;AAAA,IAAA,CACD;AAAA,EAAA,CACD;AACF;"}
1
+ {"version":3,"file":"glob.node-Dbygwo7q.js","sources":["../../core/src/tools/builtin/filesystem/glob.node.ts"],"sourcesContent":["import { combineLatest, map, Observable } from '@sourcegraph/observable'\nimport { spawn } from 'node:child_process'\nimport pm from 'picomatch'\nimport type { URI } from 'vscode-uri'\nimport logger from '../../../common/logger'\nimport type { ToolRun } from '../../tool-service'\nimport { ripgrepExecutable } from '../grep/executable'\nimport { checkDirURIIsFile } from '../node-helpers'\nimport type { GlobToolDef, globToolReg } from './glob.common'\n\nexport interface GlobFilesWithRipgrepOptions {\n\tlimit?: number\n\toffset?: number\n\tmaxDepth?: number\n\tbasePath?: string\n\tsignal?: AbortSignal\n}\n\nexport const nodeGlobTool: NonNullable<(typeof globToolReg)['fn']> = ({ args }, { dirs }) => {\n\tif (dirs.length === 0) {\n\t\treturn new Observable((observer) => {\n\t\t\tobserver.next({\n\t\t\t\tstatus: 'error' as const,\n\t\t\t\terror: { message: 'No directory provided' },\n\t\t\t})\n\t\t\tobserver.complete()\n\t\t})\n\t}\n\n\t// Clean up options to avoid exactOptionalPropertyTypes issues\n\tconst options: GlobFilesWithRipgrepOptions = {}\n\tif (args.limit !== undefined) options.limit = args.limit\n\tif (args.offset !== undefined) options.offset = args.offset\n\n\treturn globFilesWithRipgrep(dirs, args.filePattern, options)\n}\n\nexport function globFilesWithRipgrep(\n\tdirs: URI[],\n\tpattern: string | null,\n\toptions?: GlobFilesWithRipgrepOptions,\n): Observable<ToolRun<GlobToolDef>> {\n\treturn combineLatest(\n\t\t...dirs.map((dir) => globFilesInDirWithRipgrep(dir, pattern, options)),\n\t).pipe(\n\t\tmap<ToolRun<GlobToolDef>[], ToolRun<GlobToolDef>>((results) => {\n\t\t\tconst progress: string[] = []\n\t\t\tfor (const result of results) {\n\t\t\t\tif (result.status === 'in-progress') {\n\t\t\t\t\tprogress.push(...(result?.progress ?? []))\n\t\t\t\t} else if (result.status === 'done') {\n\t\t\t\t\tprogress.push(...result.result)\n\t\t\t\t} else if (result.status === 'error') {\n\t\t\t\t\tprogress.push(...(result.progress ?? []))\n\t\t\t\t} else if (result.status === 'cancelled') {\n\t\t\t\t\tprogress.push(...(result.progress ?? []))\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst errors = results.filter((result) => result.status === 'error')\n\t\t\tif (errors.length > 0) {\n\t\t\t\treturn {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tprogress,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tmessage: errors\n\t\t\t\t\t\t\t.map<string>((error) => error?.error?.message ?? '')\n\t\t\t\t\t\t\t.join('\\n'),\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst status = results.every((result) => result.status === 'done')\n\t\t\t\t? 'done'\n\t\t\t\t: results.some((result) => result.status === 'cancelled')\n\t\t\t\t\t? 'cancelled'\n\t\t\t\t\t: 'in-progress'\n\t\t\treturn {\n\t\t\t\tstatus,\n\t\t\t\tprogress,\n\t\t\t\tresult: progress,\n\t\t\t}\n\t\t}),\n\t)\n}\n\nfunction globFilesInDirWithRipgrep(\n\tdir: URI,\n\tpattern: string | null,\n\toptions?: GlobFilesWithRipgrepOptions,\n): Observable<ToolRun<GlobToolDef>> {\n\tcheckDirURIIsFile(dir)\n\treturn new Observable<ToolRun<GlobToolDef>>((observer) => {\n\t\tobserver.next({\n\t\t\tstatus: 'in-progress',\n\t\t\tprogress: [],\n\t\t})\n\n\t\tripgrepFiles(dir.fsPath, pattern ? { pattern, caseInsensitive: true } : null, options ?? {})\n\t\t\t.then(({ files, remaining }) => {\n\t\t\t\tif (remaining > 0) {\n\t\t\t\t\tfiles.push(`--- ${remaining} more files not shown ---`)\n\t\t\t\t}\n\t\t\t\tobserver.next({\n\t\t\t\t\tstatus: 'done',\n\t\t\t\t\tprogress: files,\n\t\t\t\t\tresult: files,\n\t\t\t\t})\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error)\n\t\t\t\tobserver.next({\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tprogress: [],\n\t\t\t\t\terror: { message },\n\t\t\t\t})\n\t\t\t})\n\t\t\t.finally(() => observer.complete())\n\t})\n}\n\ninterface RipgrepResult {\n\tfiles: string[]\n\tremaining: number\n\taborted?: boolean\n}\n\nconst MAX_GLOB_COUNT = 500_000\n\nexport function ripgrepFiles(\n\tdir: string,\n\tglob: {\n\t\tpattern: string\n\t\tcaseInsensitive?: boolean\n\t} | null,\n\tparams: GlobFilesWithRipgrepOptions,\n): Promise<RipgrepResult> {\n\t// The Chromium repo has ~500k files so this is generous\n\t// enough to cover such a large repo. The fuzzy filtering is\n\t// sluggish in the Chromium repo so we don't want it to be\n\t// slower than that, and we also don't want to load arbitrary\n\t// many files into memory.\n\tconst limit = params.limit ?? MAX_GLOB_COUNT\n\n\tif (glob?.pattern && glob.pattern === '*') {\n\t\tglob.pattern = '**'\n\t}\n\t// IMPORTANT: we implement glob filtering on the TypeScript side instead of\n\t// using the ripgrep --glob option because the --glob option disables the\n\t// built-in gitignore/ignore/rgignore support. Instead, to support only\n\t// including certain patterns like `src/**/*.ts` then we filter those out\n\t// from the ripgrep output.\n\tconst matchesGlobPattern = glob?.pattern\n\t\t? pm(glob.pattern, { nocase: glob.caseInsensitive, dot: true })\n\t\t: undefined\n\n\tconst args = [\n\t\t'--files',\n\t\t'--color',\n\t\t'never',\n\t\t'--no-require-git',\n\t\t// We want to include hidden files because dot-files in a repository are often important.\n\t\t'--hidden',\n\t\t// Ripgrep will include the .git/ directory when using --hidden unless\n\t\t// the user explicitly gitignores the .git/ directory, or rgignores it,\n\t\t// which most people don't.\n\t\t'--glob',\n\t\t'!\\\\.git/',\n\t]\n\n\tif (params.maxDepth !== undefined) {\n\t\targs.push('--max-depth', params.maxDepth.toString())\n\t}\n\tif (params.basePath !== undefined) {\n\t\targs.push(params.basePath)\n\t}\n\n\t// We manually control the spawn here instead of using `spawnAndObserveChildProcess` because\n\t// we don't want to re-process the entire output on every streaming chunk.\n\t// Large repos can have hundreds of thousands of files, and we're processing the output on the extension process host.\n\t// ripgrep --files is fast anyways so there's no point in streaming the results.\n\n\tconst proc = spawn(ripgrepExecutable(), args, {\n\t\tcwd: dir,\n\t\tstdio: ['ignore', 'pipe', 'pipe'],\n\t\tdetached: process.platform !== 'win32',\n\t\tenv: {\n\t\t\t...process.env,\n\t\t\tNONINTERACTIVE: '1',\n\t\t\tDEBIAN_FRONTEND: 'noninteractive',\n\t\t},\n\t})\n\n\treturn new Promise<RipgrepResult>((resolve, reject) => {\n\t\tconst lines: string[] = []\n\t\tlet stderr = ''\n\t\tlet line = ''\n\t\tlet offset = params.offset ?? 0\n\t\tlet isResolved = false\n\t\tconst pushLine = (): void => {\n\t\t\tif (isResolved) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!line) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (matchesGlobPattern && !matchesGlobPattern(line)) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst toPush = line\n\t\t\tline = ''\n\n\t\t\tif (offset > 0) {\n\t\t\t\toffset--\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tlines.push(toPush)\n\t\t\tif (lines.length >= MAX_GLOB_COUNT) {\n\t\t\t\tlogger.warn('Glob limit reached. Returning partial results.', {\n\t\t\t\t\tglob: glob?.pattern,\n\t\t\t\t\tlimit: MAX_GLOB_COUNT,\n\t\t\t\t\tdir,\n\t\t\t\t})\n\t\t\t\tproc.kill()\n\t\t\t\tisResolved = true\n\t\t\t\tresolve({\n\t\t\t\t\tfiles: lines,\n\t\t\t\t\tremaining: 0,\n\t\t\t\t\taborted: true,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tproc.stdout?.on('data', (data) => {\n\t\t\tfor (const ch of String(data)) {\n\t\t\t\tif (ch === '\\r') {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (ch === '\\n') {\n\t\t\t\t\tpushLine()\n\t\t\t\t\tline = ''\n\t\t\t\t} else {\n\t\t\t\t\tline += ch\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\tproc?.stderr?.on('data', (data) => {\n\t\t\tstderr += String(data)\n\t\t})\n\n\t\tproc.on('exit', (code) => {\n\t\t\t// ripgrep exit code 1 means \"no matches found\" which is valid for our glob tool\n\t\t\tif (code && code >= 2) {\n\t\t\t\treject(new Error(`ripgrep exited with code ${code}:\\n${stderr}`))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// The last line does not end with \\n\n\t\t\tpushLine()\n\n\t\t\tconst filesMatchingLimit = lines.slice(0, limit)\n\t\t\tresolve({\n\t\t\t\tfiles: filesMatchingLimit,\n\t\t\t\tremaining: lines.length - filesMatchingLimit.length,\n\t\t\t})\n\t\t})\n\t})\n}\n"],"names":["nodeGlobTool","args","dirs","Observable","observer","options","globFilesWithRipgrep","pattern","combineLatest","dir","globFilesInDirWithRipgrep","map","results","progress","result","errors","error","checkDirURIIsFile","ripgrepFiles","files","remaining","message","MAX_GLOB_COUNT","glob","params","limit","matchesGlobPattern","pm","proc","spawn","ripgrepExecutable","resolve","reject","lines","stderr","line","offset","isResolved","pushLine","toPush","logger","data","ch","code","filesMatchingLimit"],"mappings":";;;;;AAkBO,MAAMA,IAAwD,CAAC,EAAE,MAAAC,KAAQ,EAAE,MAAAC,QAAW;AACxF,MAAAA,EAAK,WAAW;AACZ,WAAA,IAAIC,EAAW,CAACC,MAAa;AACnC,MAAAA,EAAS,KAAK;AAAA,QACb,QAAQ;AAAA,QACR,OAAO,EAAE,SAAS,wBAAwB;AAA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ACe,MAAS;AAErB,UAAAA,KAAQA,KAAQ,GAAG;AACf,QAAAX,EAAA,IAAI,MAAM,4BAA4BW,CAAI;AAAA,EAAMT,CAAM,EAAE,CAAC;AAChE;AAAA,MAAA;AAIQ,MAAAI,EAAA;AAET,YAAMM,IAAqBX,EAAM,MAAM,GAAGR,CAAK;AACvC,MAAAM,EAAA;AAAA,QACP,OAAOa;AAAA,QACP,WAAWX,EAAM,SAASW,EAAmB;AAAA,MAAA,CAC7C;AAAA,IAAA,CACD;AAAA,EAAA,CACD;AACF;"}
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { z as xt } from "./console-DZmALLuA.js";
2
+ import { z as xt } from "./console-D_ZxbRrA.js";
3
3
  var pt = {}, ft, Et;
4
4
  function ct() {
5
5
  if (Et) return ft;
@@ -919,4 +919,4 @@ const vt = /* @__PURE__ */ xt(Tt);
919
919
  export {
920
920
  vt as p
921
921
  };
922
- //# sourceMappingURL=index-nQBDDlvh.js.map
922
+ //# sourceMappingURL=index-DGuVA6oK.js.map