@morphllm/morphsdk 0.2.201 → 0.2.203

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 (180) hide show
  1. package/dist/chunk-2PPYWRMZ.js +3 -4
  2. package/dist/{chunk-DBNSOYQ3.js → chunk-2UIOCSVJ.js} +3 -24
  3. package/dist/chunk-44OIEPIO.js +4 -23
  4. package/dist/chunk-4EQQGUZ7.cjs +104 -0
  5. package/dist/chunk-4OUGA3KS.js +1 -5
  6. package/dist/chunk-4R5MDGL6.cjs +280 -0
  7. package/dist/chunk-65W4I66Q.cjs +103 -0
  8. package/dist/{chunk-WBTXEJOC.js → chunk-66THRMD7.js} +10 -35
  9. package/dist/chunk-6TZCVTW5.js +3 -4
  10. package/dist/chunk-6WP7EA4F.js +2 -4
  11. package/dist/chunk-74A4HLIO.cjs +42 -0
  12. package/dist/chunk-75ZPJI57.cjs +9 -0
  13. package/dist/chunk-7NA7X7W2.cjs +77 -0
  14. package/dist/chunk-7PJYY46L.cjs +2 -0
  15. package/dist/chunk-AFF6XYKL.cjs +71 -0
  16. package/dist/{chunk-P2KW2O5R.js → chunk-AJBZA23L.js} +3 -25
  17. package/dist/chunk-AWFZKS27.cjs +11 -0
  18. package/dist/{chunk-FVT4PU4I.js → chunk-AXEKIRRY.js} +22 -62
  19. package/dist/chunk-B3FD67F2.cjs +256 -0
  20. package/dist/chunk-BJBWWIZV.cjs +2 -0
  21. package/dist/{chunk-M6AVXUM4.js → chunk-E3XNKAMI.js} +5 -15
  22. package/dist/{chunk-TS3OJ4LA.js → chunk-E7FLETFO.js} +2 -8
  23. package/dist/{chunk-EQAWWVKV.js → chunk-EI2M567U.js} +2 -6
  24. package/dist/chunk-EJTL2BOZ.cjs +42 -0
  25. package/dist/chunk-ETBRAKVV.js +1 -5
  26. package/dist/{chunk-VOXUA5ZH.js → chunk-EZ2OFDBJ.js} +5 -19
  27. package/dist/chunk-FBOZIVVQ.js +1 -0
  28. package/dist/{chunk-TZC3EOZS.js → chunk-GDFPZ3NJ.js} +4 -19
  29. package/dist/{chunk-LISSWRUD.js → chunk-GIQAIHUI.js} +8 -33
  30. package/dist/chunk-GSUQGDCL.cjs +235 -0
  31. package/dist/{chunk-5NSYDT36.js → chunk-H3HRSRR5.js} +4 -12
  32. package/dist/chunk-HDP4QAZL.js +1 -4
  33. package/dist/chunk-HMLYJVZM.cjs +410 -0
  34. package/dist/chunk-IPJA3ZS6.cjs +10 -0
  35. package/dist/{chunk-B376VMIH.js → chunk-IUM6CQYX.js} +3 -12
  36. package/dist/{chunk-OVLUL5AC.js → chunk-J56Q6C4Y.js} +4 -18
  37. package/dist/chunk-JBTR3FQD.cjs +135 -0
  38. package/dist/chunk-JNQKQKHS.cjs +81 -0
  39. package/dist/chunk-JOZC4T6C.cjs +168 -0
  40. package/dist/{chunk-ILY5N5NJ.js → chunk-JUGNTIVU.js} +6 -19
  41. package/dist/{chunk-SU7AAS3O.js → chunk-JY6COF3X.js} +5 -22
  42. package/dist/{chunk-JBAY3PRV.js → chunk-KLVJIC2O.js} +5 -17
  43. package/dist/chunk-KSZYOX6S.cjs +91 -0
  44. package/dist/chunk-KVGZ2TSG.cjs +274 -0
  45. package/dist/chunk-LDM7RNNN.js +1 -0
  46. package/dist/{chunk-RZOJ4GSY.js → chunk-LLQH6CCB.js} +10 -28
  47. package/dist/chunk-M34E2AMK.js +1 -5
  48. package/dist/chunk-MF56KEI4.js +1 -4
  49. package/dist/chunk-MLKGABMK.js +1 -3
  50. package/dist/{chunk-I26FQELI.js → chunk-MLPZKUCO.js} +11 -5
  51. package/dist/chunk-MWXJ6DZ2.cjs +21 -0
  52. package/dist/{chunk-NWGRW4V7.js → chunk-N7UKZ5X7.js} +2 -6
  53. package/dist/chunk-NDUC7OV6.cjs +74 -0
  54. package/dist/{chunk-RJXAXR7Q.js → chunk-NLACTMZT.js} +6 -19
  55. package/dist/chunk-NNKBKENK.cjs +15 -0
  56. package/dist/chunk-NRG6QX3L.js +1 -3
  57. package/dist/chunk-OCCGJ4S6.js +8 -0
  58. package/dist/chunk-ODY2NKQU.cjs +50 -0
  59. package/dist/chunk-OM5ZSXQW.cjs +91 -0
  60. package/dist/chunk-OOEORM7H.cjs +334 -0
  61. package/dist/chunk-OPDWMD4Q.js +1 -3
  62. package/dist/{chunk-BZXOAC2R.js → chunk-OSL4CNSO.js} +7 -23
  63. package/dist/chunk-OXXMTDOY.cjs +86 -0
  64. package/dist/chunk-PA3UTI4A.js +1 -4
  65. package/dist/chunk-QEEAIXL5.cjs +74 -0
  66. package/dist/chunk-RYVW7RUM.js +2 -6
  67. package/dist/chunk-S6QBPXBI.cjs +107 -0
  68. package/dist/chunk-TL34BLQD.cjs +10 -0
  69. package/dist/chunk-TPZHMD7J.cjs +72 -0
  70. package/dist/chunk-UAPK3AIJ.js +1 -10
  71. package/dist/chunk-UF5IKELS.cjs +26 -0
  72. package/dist/chunk-UNX7V6P6.cjs +60 -0
  73. package/dist/chunk-UUCRWJJR.cjs +313 -0
  74. package/dist/chunk-VDFLPO7B.cjs +396 -0
  75. package/dist/chunk-VHD7CW5O.cjs +43 -0
  76. package/dist/chunk-VL4QNALG.cjs +50 -0
  77. package/dist/chunk-WR7LSUIR.cjs +213 -0
  78. package/dist/chunk-XE6D4J63.cjs +72 -0
  79. package/dist/chunk-ZLG2M2I4.cjs +21 -0
  80. package/dist/chunk-ZSHVXDA2.js +4 -10
  81. package/dist/client.cjs +40 -4353
  82. package/dist/client.js +32 -37
  83. package/dist/core/client.cjs +10 -476
  84. package/dist/core/client.js +6 -11
  85. package/dist/core/error.cjs +8 -251
  86. package/dist/core/error.js +4 -9
  87. package/dist/core/index.cjs +20 -488
  88. package/dist/core/index.js +8 -19
  89. package/dist/core/resource.cjs +9 -33
  90. package/dist/core/resource.js +2 -7
  91. package/dist/edge.cjs +62 -1111
  92. package/dist/edge.js +10 -42
  93. package/dist/index.cjs +115 -4424
  94. package/dist/index.js +39 -87
  95. package/dist/modelrouter/core.cjs +28 -648
  96. package/dist/modelrouter/core.js +8 -21
  97. package/dist/modelrouter/index.cjs +28 -648
  98. package/dist/modelrouter/index.js +8 -21
  99. package/dist/modelrouter/types.cjs +1 -17
  100. package/dist/modelrouter/types.js +1 -0
  101. package/dist/subagents/anthropic.cjs +27 -2777
  102. package/dist/subagents/anthropic.js +19 -24
  103. package/dist/subagents/index.cjs +14 -95
  104. package/dist/subagents/index.js +2 -11
  105. package/dist/subagents/prompts.cjs +14 -93
  106. package/dist/subagents/prompts.js +2 -11
  107. package/dist/subagents/types.cjs +1 -17
  108. package/dist/subagents/types.js +1 -0
  109. package/dist/subagents/vercel.cjs +27 -2754
  110. package/dist/subagents/vercel.js +19 -24
  111. package/dist/tools/compact/core.cjs +12 -548
  112. package/dist/tools/compact/core.js +8 -13
  113. package/dist/tools/compact/index.cjs +17 -595
  114. package/dist/tools/compact/index.js +9 -17
  115. package/dist/tools/compact/types.cjs +1 -17
  116. package/dist/tools/compact/types.js +1 -0
  117. package/dist/tools/fastapply/anthropic.cjs +27 -891
  118. package/dist/tools/fastapply/anthropic.js +11 -24
  119. package/dist/tools/fastapply/apply.cjs +28 -672
  120. package/dist/tools/fastapply/apply.js +4 -19
  121. package/dist/tools/fastapply/core.cjs +37 -1061
  122. package/dist/tools/fastapply/core.js +9 -29
  123. package/dist/tools/fastapply/index.cjs +62 -1062
  124. package/dist/tools/fastapply/index.js +14 -44
  125. package/dist/tools/fastapply/openai.cjs +32 -901
  126. package/dist/tools/fastapply/openai.js +11 -26
  127. package/dist/tools/fastapply/prompts.cjs +10 -62
  128. package/dist/tools/fastapply/prompts.js +2 -9
  129. package/dist/tools/fastapply/types.cjs +1 -17
  130. package/dist/tools/fastapply/types.js +1 -0
  131. package/dist/tools/fastapply/vercel.cjs +25 -897
  132. package/dist/tools/fastapply/vercel.js +11 -22
  133. package/dist/tools/index.cjs +62 -1062
  134. package/dist/tools/index.js +14 -44
  135. package/dist/tools/utils/resilience.cjs +15 -312
  136. package/dist/tools/utils/resilience.js +3 -12
  137. package/dist/tools/warp_grep/agent/config.cjs +16 -127
  138. package/dist/tools/warp_grep/agent/config.js +2 -11
  139. package/dist/tools/warp_grep/agent/formatter.cjs +12 -48
  140. package/dist/tools/warp_grep/agent/formatter.js +2 -9
  141. package/dist/tools/warp_grep/agent/parser.cjs +16 -83
  142. package/dist/tools/warp_grep/agent/parser.js +2 -11
  143. package/dist/tools/warp_grep/agent/runner.cjs +15 -1081
  144. package/dist/tools/warp_grep/agent/runner.js +7 -14
  145. package/dist/tools/warp_grep/agent/types.cjs +1 -17
  146. package/dist/tools/warp_grep/agent/types.js +1 -0
  147. package/dist/tools/warp_grep/anthropic.cjs +47 -2554
  148. package/dist/tools/warp_grep/anthropic.js +19 -35
  149. package/dist/tools/warp_grep/client.cjs +49 -2464
  150. package/dist/tools/warp_grep/client.js +17 -34
  151. package/dist/tools/warp_grep/gemini.cjs +48 -2483
  152. package/dist/tools/warp_grep/gemini.js +21 -41
  153. package/dist/tools/warp_grep/harness.cjs +81 -929
  154. package/dist/tools/warp_grep/harness.js +12 -51
  155. package/dist/tools/warp_grep/index.cjs +124 -2568
  156. package/dist/tools/warp_grep/index.js +24 -87
  157. package/dist/tools/warp_grep/openai.cjs +53 -2568
  158. package/dist/tools/warp_grep/openai.js +19 -37
  159. package/dist/tools/warp_grep/providers/code_storage_http.cjs +12 -65
  160. package/dist/tools/warp_grep/providers/code_storage_http.js +2 -9
  161. package/dist/tools/warp_grep/providers/local.cjs +10 -582
  162. package/dist/tools/warp_grep/providers/local.js +6 -11
  163. package/dist/tools/warp_grep/providers/remote.cjs +8 -331
  164. package/dist/tools/warp_grep/providers/remote.js +3 -8
  165. package/dist/tools/warp_grep/providers/types.cjs +1 -17
  166. package/dist/tools/warp_grep/providers/types.js +1 -0
  167. package/dist/tools/warp_grep/utils/files.cjs +9 -42
  168. package/dist/tools/warp_grep/utils/files.js +2 -7
  169. package/dist/tools/warp_grep/utils/github.cjs +9 -43
  170. package/dist/tools/warp_grep/utils/github.js +2 -7
  171. package/dist/tools/warp_grep/utils/paths.cjs +28 -104
  172. package/dist/tools/warp_grep/utils/paths.js +2 -17
  173. package/dist/tools/warp_grep/utils/ripgrep.cjs +9 -86
  174. package/dist/tools/warp_grep/utils/ripgrep.js +2 -7
  175. package/dist/tools/warp_grep/vercel.cjs +53 -2550
  176. package/dist/tools/warp_grep/vercel.js +19 -37
  177. package/dist/version.cjs +7 -225
  178. package/dist/version.js +2 -7
  179. package/package.json +2 -2
  180. package/dist/chunk-UZCXOOZO.js +0 -203
@@ -1,587 +1,15 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
29
2
 
30
- // tools/warp_grep/providers/local.ts
31
- var local_exports = {};
32
- __export(local_exports, {
33
- LocalRipgrepProvider: () => LocalRipgrepProvider
34
- });
35
- module.exports = __toCommonJS(local_exports);
36
- var import_promises2 = __toESM(require("fs/promises"), 1);
37
- var import_path2 = __toESM(require("path"), 1);
38
-
39
- // tools/warp_grep/utils/ripgrep.ts
40
- var import_child_process = require("child_process");
41
- var import_ripgrep = require("@vscode/ripgrep");
42
- var resolvedRgPath = null;
43
- var rgPathChecked = false;
44
- function spawnRg(rgBinary, args, opts) {
45
- return new Promise((resolve) => {
46
- const child = (0, import_child_process.spawn)(rgBinary, args, {
47
- cwd: opts?.cwd,
48
- env: { ...process.env, ...opts?.env || {} },
49
- stdio: ["ignore", "pipe", "pipe"]
50
- });
51
- let stdout = "";
52
- let stderr = "";
53
- child.stdout.on("data", (d) => stdout += d.toString());
54
- child.stderr.on("data", (d) => stderr += d.toString());
55
- child.on("close", (code) => {
56
- resolve({ stdout, stderr, exitCode: typeof code === "number" ? code : -1 });
57
- });
58
- child.on("error", () => {
59
- resolve({ stdout: "", stderr: "Failed to spawn ripgrep.", exitCode: -1 });
60
- });
61
- });
62
- }
63
- function isBinaryFailure(result) {
64
- if (result.exitCode === -1) return true;
65
- if (result.stderr.includes("jemalloc") || result.stderr.includes("Unsupported system page size")) return true;
66
- if (result.exitCode === 134) return true;
67
- return false;
68
- }
69
- async function runRipgrep(args, opts) {
70
- if (rgPathChecked && resolvedRgPath) {
71
- return spawnRg(resolvedRgPath, args, opts);
72
- }
73
- if (!rgPathChecked) {
74
- const result = await spawnRg(import_ripgrep.rgPath, args, opts);
75
- if (!isBinaryFailure(result)) {
76
- resolvedRgPath = import_ripgrep.rgPath;
77
- rgPathChecked = true;
78
- return result;
79
- }
80
- const fallbackResult = await spawnRg("rg", args, opts);
81
- if (!isBinaryFailure(fallbackResult)) {
82
- resolvedRgPath = "rg";
83
- rgPathChecked = true;
84
- return fallbackResult;
85
- }
86
- rgPathChecked = true;
87
- return {
88
- stdout: "",
89
- stderr: "Failed to spawn ripgrep. Neither bundled nor system rg is available.",
90
- exitCode: -1
91
- };
92
- }
93
- return {
94
- stdout: "",
95
- stderr: "Failed to spawn ripgrep. Neither bundled nor system rg is available.",
96
- exitCode: -1
97
- };
98
- }
99
-
100
- // tools/warp_grep/utils/paths.ts
101
- var import_fs = __toESM(require("fs"), 1);
102
- var import_path = __toESM(require("path"), 1);
103
- function resolveUnderRepo(repoRoot, targetPath) {
104
- const absRoot = import_path.default.resolve(repoRoot);
105
- const resolved = import_path.default.resolve(absRoot, targetPath);
106
- ensureWithinRepo(absRoot, resolved);
107
- return resolved;
108
- }
109
- function ensureWithinRepo(repoRoot, absTarget) {
110
- const rel = import_path.default.relative(import_path.default.resolve(repoRoot), import_path.default.resolve(absTarget));
111
- if (rel.startsWith("..") || import_path.default.isAbsolute(rel)) {
112
- throw new Error(`Path outside repository root: ${absTarget}`);
113
- }
114
- }
115
- function toRepoRelative(repoRoot, absPath) {
116
- return import_path.default.relative(import_path.default.resolve(repoRoot), import_path.default.resolve(absPath));
117
- }
118
- function isSymlink(p) {
119
- try {
120
- const st = import_fs.default.lstatSync(p);
121
- return st.isSymbolicLink();
122
- } catch {
123
- return false;
124
- }
125
- }
126
- function fixPathRepetition(fullPath) {
127
- const segments = fullPath.split(import_path.default.sep).filter(Boolean);
128
- if (segments.length < 2) return null;
129
- for (let len = Math.floor(segments.length / 2); len >= 1; len--) {
130
- for (let i = 0; i <= segments.length - 2 * len; i++) {
131
- const first = segments.slice(i, i + len);
132
- const second = segments.slice(i + len, i + 2 * len);
133
- if (first.every((seg, idx) => seg === second[idx])) {
134
- const fixed = [...segments.slice(0, i), ...segments.slice(i + len)];
135
- return import_path.default.sep + fixed.join(import_path.default.sep);
136
- }
137
- }
138
- }
139
- return null;
140
- }
141
- function isTextualFile(filePath, maxBytes = 2e6) {
142
- try {
143
- const st = import_fs.default.statSync(filePath);
144
- if (!st.isFile()) return false;
145
- if (st.size > maxBytes) return false;
146
- const fd = import_fs.default.openSync(filePath, "r");
147
- const buf = Buffer.alloc(512);
148
- const read = import_fs.default.readSync(fd, buf, 0, buf.length, 0);
149
- import_fs.default.closeSync(fd);
150
- for (let i = 0; i < read; i++) {
151
- const c = buf[i];
152
- if (c === 0) return false;
153
- }
154
- return true;
155
- } catch {
156
- return false;
157
- }
158
- }
3
+ var chunkOOEORM7H_cjs = require('../../../chunk-OOEORM7H.cjs');
4
+ require('../../../chunk-XE6D4J63.cjs');
5
+ require('../../../chunk-NNKBKENK.cjs');
6
+ require('../../../chunk-QEEAIXL5.cjs');
7
+ require('../../../chunk-4EQQGUZ7.cjs');
8
+ require('../../../chunk-75ZPJI57.cjs');
159
9
 
160
- // tools/warp_grep/utils/files.ts
161
- var import_promises = __toESM(require("fs/promises"), 1);
162
- async function readAllLines(filePath) {
163
- const content = await import_promises.default.readFile(filePath, "utf8");
164
- return content.split(/\r?\n/);
165
- }
166
10
 
167
- // tools/warp_grep/agent/config.ts
168
- var parseEnvTimeout = (envValue, defaultMs) => {
169
- if (!envValue) return defaultMs;
170
- const parsed = parseInt(envValue, 10);
171
- return isNaN(parsed) || parsed <= 0 ? defaultMs : parsed;
172
- };
173
- var AGENT_CONFIG = {
174
- MAX_TURNS: 6,
175
- /** Default timeout for model calls. Can be overridden via MORPH_WARP_GREP_TIMEOUT env var (in ms) */
176
- TIMEOUT_MS: parseEnvTimeout(process.env.MORPH_WARP_GREP_TIMEOUT, 6e4),
177
- MAX_CONTEXT_CHARS: 321600,
178
- MAX_OUTPUT_LINES: 200,
179
- MAX_LIST_RESULTS: 500,
180
- MAX_READ_LINES: 800,
181
- MAX_LIST_DEPTH: 3,
182
- LIST_TIMEOUT_MS: 2e3
183
- };
184
- var BUILTIN_EXCLUDES = [
185
- // Version control
186
- ".git",
187
- ".svn",
188
- ".hg",
189
- ".bzr",
190
- // Dependencies
191
- "node_modules",
192
- "bower_components",
193
- ".pnpm",
194
- ".yarn",
195
- "vendor",
196
- "packages",
197
- "Pods",
198
- ".bundle",
199
- // Python
200
- "__pycache__",
201
- ".pytest_cache",
202
- ".mypy_cache",
203
- ".ruff_cache",
204
- ".venv",
205
- "venv",
206
- ".tox",
207
- ".nox",
208
- ".eggs",
209
- "*.egg-info",
210
- // Build outputs
211
- "dist",
212
- "build",
213
- "out",
214
- "output",
215
- "target",
216
- "_build",
217
- ".next",
218
- ".nuxt",
219
- ".output",
220
- ".vercel",
221
- ".netlify",
222
- // Cache directories
223
- ".cache",
224
- ".parcel-cache",
225
- ".turbo",
226
- ".nx",
227
- ".gradle",
228
- // IDE/Editor
229
- ".idea",
230
- ".vscode",
231
- ".vs",
232
- // Coverage
233
- "coverage",
234
- ".coverage",
235
- "htmlcov",
236
- ".nyc_output",
237
- // Temporary
238
- "tmp",
239
- "temp",
240
- ".tmp",
241
- ".temp",
242
- // Lock files
243
- "package-lock.json",
244
- "yarn.lock",
245
- "pnpm-lock.yaml",
246
- "bun.lockb",
247
- "Cargo.lock",
248
- "Gemfile.lock",
249
- "poetry.lock",
250
- // Binary/minified
251
- "*.min.js",
252
- "*.min.css",
253
- "*.bundle.js",
254
- "*.wasm",
255
- "*.so",
256
- "*.dll",
257
- "*.pyc",
258
- "*.map",
259
- "*.js.map",
260
- // Hidden directories catch-all
261
- ".*"
262
- ];
263
- var DEFAULT_EXCLUDES = (process.env.MORPH_WARP_GREP_EXCLUDE || "").split(",").map((s) => s.trim()).filter(Boolean).concat(BUILTIN_EXCLUDES);
264
11
 
265
- // tools/warp_grep/providers/local.ts
266
- var SKIP_NAMES = /* @__PURE__ */ new Set([
267
- // Version control
268
- ".git",
269
- ".svn",
270
- ".hg",
271
- ".bzr",
272
- // Dependencies
273
- "node_modules",
274
- "bower_components",
275
- ".pnpm",
276
- ".yarn",
277
- "vendor",
278
- "Pods",
279
- ".bundle",
280
- // Python
281
- "__pycache__",
282
- ".pytest_cache",
283
- ".mypy_cache",
284
- ".ruff_cache",
285
- ".venv",
286
- "venv",
287
- ".tox",
288
- ".nox",
289
- ".eggs",
290
- // Build outputs
291
- "dist",
292
- "build",
293
- "out",
294
- "output",
295
- "target",
296
- "_build",
297
- ".next",
298
- ".nuxt",
299
- ".output",
300
- ".vercel",
301
- ".netlify",
302
- // Cache
303
- ".cache",
304
- ".parcel-cache",
305
- ".turbo",
306
- ".nx",
307
- ".gradle",
308
- // IDE
309
- ".idea",
310
- ".vscode",
311
- ".vs",
312
- // Coverage
313
- "coverage",
314
- ".coverage",
315
- "htmlcov",
316
- ".nyc_output",
317
- // Temp
318
- "tmp",
319
- "temp",
320
- ".tmp",
321
- ".temp",
322
- // Lock files
323
- "package-lock.json",
324
- "yarn.lock",
325
- "pnpm-lock.yaml",
326
- "bun.lockb",
327
- "Cargo.lock",
328
- "Gemfile.lock",
329
- "poetry.lock"
330
- ]);
331
- var SKIP_EXTENSIONS = /* @__PURE__ */ new Set([
332
- ".min.js",
333
- ".min.css",
334
- ".bundle.js",
335
- ".wasm",
336
- ".so",
337
- ".dll",
338
- ".pyc",
339
- ".map",
340
- ".js.map"
341
- ]);
342
- function shouldSkip(name, allowNames) {
343
- if (allowNames?.has(name)) return false;
344
- if (SKIP_NAMES.has(name)) return true;
345
- if (name.startsWith(".")) return true;
346
- for (const ext of SKIP_EXTENSIONS) {
347
- if (name.endsWith(ext)) return true;
348
- }
349
- return false;
350
- }
351
- var LocalRipgrepProvider = class {
352
- constructor(repoRoot, excludes = DEFAULT_EXCLUDES, options) {
353
- this.repoRoot = repoRoot;
354
- this.excludes = excludes;
355
- if (options?.allowNames?.length) {
356
- this.allowNames = new Set(options.allowNames);
357
- }
358
- }
359
- allowNames;
360
- async grep(params) {
361
- let abs;
362
- try {
363
- abs = resolveUnderRepo(this.repoRoot, params.path);
364
- } catch (err) {
365
- return {
366
- lines: [],
367
- error: `[PATH ERROR] ${err instanceof Error ? err.message : String(err)}`
368
- };
369
- }
370
- const stat = await import_promises2.default.stat(abs).catch(() => null);
371
- if (!stat) return { lines: [] };
372
- const targetArg = abs === import_path2.default.resolve(this.repoRoot) ? "." : toRepoRelative(this.repoRoot, abs);
373
- const contextLines = params.context_lines !== void 0 ? String(params.context_lines) : "1";
374
- const args = [
375
- "--no-config",
376
- "--no-heading",
377
- "--with-filename",
378
- "--line-number",
379
- "--color=never",
380
- "--trim",
381
- "--max-columns=400",
382
- "-C",
383
- contextLines,
384
- ...params.case_sensitive === false ? ["--ignore-case"] : [],
385
- ...params.glob ? ["--glob", params.glob] : [],
386
- ...this.excludes.filter((e) => !this.allowNames?.has(e)).flatMap((e) => ["-g", `!${e}`]),
387
- params.pattern,
388
- targetArg || "."
389
- ];
390
- const res = await runRipgrep(args, { cwd: this.repoRoot });
391
- if (res.exitCode === -1) {
392
- return {
393
- lines: [],
394
- error: `[RIPGREP NOT AVAILABLE] ripgrep (rg) is required but failed to execute. Please install it:
395
- \u2022 macOS: brew install ripgrep
396
- \u2022 Ubuntu/Debian: apt install ripgrep
397
- \u2022 Windows: choco install ripgrep
398
- \u2022 Or visit: https://github.com/BurntSushi/ripgrep#installation
399
- Exit code: ${res.exitCode}${res.stderr ? `
400
- Details: ${res.stderr}` : ""}`
401
- };
402
- }
403
- if (res.exitCode !== 0 && res.exitCode !== 1) {
404
- return {
405
- lines: [],
406
- error: `[RIPGREP ERROR] grep failed with exit code ${res.exitCode}${res.stderr ? `: ${res.stderr}` : ""}`
407
- };
408
- }
409
- const lines = (res.stdout || "").trim().split(/\r?\n/).filter((l) => l.length > 0);
410
- if (lines.length > AGENT_CONFIG.MAX_OUTPUT_LINES) {
411
- const truncated = lines.slice(0, AGENT_CONFIG.MAX_OUTPUT_LINES);
412
- truncated.push(`... (output truncated at ${AGENT_CONFIG.MAX_OUTPUT_LINES} of ${lines.length} lines)`);
413
- return { lines: truncated };
414
- }
415
- return { lines };
416
- }
417
- async read(params) {
418
- let abs;
419
- try {
420
- abs = resolveUnderRepo(this.repoRoot, params.path);
421
- } catch (err) {
422
- return {
423
- lines: [],
424
- error: `[PATH ERROR] ${err instanceof Error ? err.message : String(err)}`
425
- };
426
- }
427
- let stat = await import_promises2.default.stat(abs).catch(() => null);
428
- if (!stat || !stat.isFile()) {
429
- const fixedPath = fixPathRepetition(abs);
430
- if (fixedPath) {
431
- const fixedStat = await import_promises2.default.stat(fixedPath).catch(() => null);
432
- if (fixedStat?.isFile()) {
433
- abs = fixedPath;
434
- stat = fixedStat;
435
- }
436
- }
437
- }
438
- if (!stat || !stat.isFile()) {
439
- return {
440
- lines: [],
441
- error: `[FILE NOT FOUND] You tried to read "${params.path}" but there is no file at this path. Double-check the path exists and is spelled correctly.`
442
- };
443
- }
444
- if (isSymlink(abs)) {
445
- return {
446
- lines: [],
447
- error: `[SYMLINK] You tried to read "${params.path}" but this is a symlink. Try reading the actual file it points to instead.`
448
- };
449
- }
450
- if (!isTextualFile(abs)) {
451
- return {
452
- lines: [],
453
- error: `[UNREADABLE FILE] You tried to read "${params.path}" but this file is either too large or not a text file, so it cannot be read. Try a different file.`
454
- };
455
- }
456
- let lines;
457
- try {
458
- lines = await readAllLines(abs);
459
- } catch (err) {
460
- return {
461
- lines: [],
462
- error: `[READ ERROR] Failed to read "${params.path}": ${err instanceof Error ? err.message : String(err)}`
463
- };
464
- }
465
- const total = lines.length;
466
- const rawStart = params.start;
467
- const rawEnd = params.end;
468
- let s = 1;
469
- let e = total;
470
- const startValid = rawStart === void 0 || Number.isFinite(rawStart) && rawStart > 0;
471
- const endValid = rawEnd === void 0 || Number.isFinite(rawEnd) && rawEnd > 0;
472
- if (startValid && endValid) {
473
- s = rawStart ?? 1;
474
- e = Math.min(rawEnd ?? total, total);
475
- if (s > total && total > 0 || s > e) {
476
- s = 1;
477
- e = total;
478
- }
479
- }
480
- const out = [];
481
- for (let i = s; i <= e; i += 1) {
482
- const content = lines[i - 1] ?? "";
483
- out.push(`${i}|${content}`);
484
- }
485
- if (out.length > AGENT_CONFIG.MAX_READ_LINES) {
486
- const truncated = out.slice(0, AGENT_CONFIG.MAX_READ_LINES);
487
- truncated.push(`... (output truncated at ${AGENT_CONFIG.MAX_READ_LINES} of ${out.length} lines)`);
488
- return { lines: truncated };
489
- }
490
- return { lines: out };
491
- }
492
- async listDirectory(params) {
493
- let abs;
494
- try {
495
- abs = resolveUnderRepo(this.repoRoot, params.path);
496
- } catch {
497
- return [];
498
- }
499
- const stat = await import_promises2.default.stat(abs).catch(() => null);
500
- if (!stat || !stat.isDirectory()) {
501
- return [];
502
- }
503
- const maxResults = params.maxResults ?? AGENT_CONFIG.MAX_OUTPUT_LINES;
504
- const maxDepth = params.maxDepth ?? AGENT_CONFIG.MAX_LIST_DEPTH;
505
- const regex = params.pattern ? new RegExp(params.pattern) : null;
506
- const repoRoot = this.repoRoot;
507
- const allowNames = this.allowNames;
508
- const results = [];
509
- let timedOut = false;
510
- const startTime = Date.now();
511
- async function walk(dir, depth) {
512
- if (Date.now() - startTime > AGENT_CONFIG.LIST_TIMEOUT_MS) {
513
- timedOut = true;
514
- return;
515
- }
516
- if (depth > maxDepth || results.length >= maxResults) return;
517
- let entries;
518
- try {
519
- entries = await import_promises2.default.readdir(dir, { withFileTypes: true });
520
- } catch {
521
- return;
522
- }
523
- for (const entry of entries) {
524
- if (timedOut || results.length >= maxResults) break;
525
- if (shouldSkip(entry.name, allowNames)) continue;
526
- if (regex && !regex.test(entry.name)) continue;
527
- const full = import_path2.default.join(dir, entry.name);
528
- const isDir = entry.isDirectory();
529
- results.push({
530
- name: entry.name,
531
- path: toRepoRelative(repoRoot, full),
532
- type: isDir ? "dir" : "file",
533
- depth
534
- });
535
- if (isDir) {
536
- await walk(full, depth + 1);
537
- }
538
- }
539
- }
540
- await walk(abs, 0);
541
- return results;
542
- }
543
- async glob(params) {
544
- let abs;
545
- try {
546
- abs = params.path ? resolveUnderRepo(this.repoRoot, params.path) : this.repoRoot;
547
- } catch (err) {
548
- return { files: [], searchDir: this.repoRoot, totalFound: 0, error: `[PATH ERROR] ${err instanceof Error ? err.message : String(err)}` };
549
- }
550
- const stat = await import_promises2.default.stat(abs).catch(() => null);
551
- if (!stat || !stat.isDirectory()) {
552
- return { files: [], searchDir: abs, totalFound: 0, error: `[PATH ERROR] Directory not found: ${params.path || "."}` };
553
- }
554
- const targetArg = abs === import_path2.default.resolve(this.repoRoot) ? "." : toRepoRelative(this.repoRoot, abs);
555
- const args = [
556
- "--no-config",
557
- "--files",
558
- "--color=never",
559
- "-g",
560
- params.pattern,
561
- ...this.excludes.filter((e) => !this.allowNames?.has(e)).flatMap((e) => ["-g", `!${e}`]),
562
- targetArg || "."
563
- ];
564
- const res = await runRipgrep(args, { cwd: this.repoRoot });
565
- if (res.exitCode === -1) {
566
- return { files: [], searchDir: abs, totalFound: 0, error: `[RIPGREP NOT AVAILABLE] ripgrep (rg) is required for glob search.` };
567
- }
568
- if (res.exitCode !== 0 && res.exitCode !== 1) {
569
- return { files: [], searchDir: abs, totalFound: 0, error: `[GLOB ERROR] glob failed with exit code ${res.exitCode}${res.stderr ? `: ${res.stderr}` : ""}` };
570
- }
571
- const absRoot = import_path2.default.resolve(this.repoRoot);
572
- const relFiles = (res.stdout || "").trim().split(/\r?\n/).filter((l) => l.length > 0);
573
- const absFiles = relFiles.map((f) => import_path2.default.resolve(absRoot, f));
574
- const withMtime = [];
575
- for (const f of absFiles) {
576
- const s = await import_promises2.default.stat(f).catch(() => null);
577
- withMtime.push({ file: f, mtime: s?.mtimeMs ?? 0 });
578
- }
579
- withMtime.sort((a, b) => b.mtime - a.mtime);
580
- const totalFound = withMtime.length;
581
- return { files: withMtime.slice(0, 100).map((f) => f.file), searchDir: abs, totalFound };
582
- }
583
- };
584
- // Annotate the CommonJS export names for ESM import in node:
585
- 0 && (module.exports = {
586
- LocalRipgrepProvider
12
+ Object.defineProperty(exports, "LocalRipgrepProvider", {
13
+ enumerable: true,
14
+ get: function () { return chunkOOEORM7H_cjs.LocalRipgrepProvider; }
587
15
  });
@@ -1,11 +1,6 @@
1
- import {
2
- LocalRipgrepProvider
3
- } from "../../../chunk-BZXOAC2R.js";
4
- import "../../../chunk-I26FQELI.js";
5
- import "../../../chunk-6TZCVTW5.js";
6
- import "../../../chunk-ZSHVXDA2.js";
7
- import "../../../chunk-M34E2AMK.js";
8
- import "../../../chunk-MLKGABMK.js";
9
- export {
10
- LocalRipgrepProvider
11
- };
1
+ export { LocalRipgrepProvider } from '../../../chunk-OSL4CNSO.js';
2
+ import '../../../chunk-MLPZKUCO.js';
3
+ import '../../../chunk-6TZCVTW5.js';
4
+ import '../../../chunk-ZSHVXDA2.js';
5
+ import '../../../chunk-M34E2AMK.js';
6
+ import '../../../chunk-MLKGABMK.js';