@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
@@ -0,0 +1,334 @@
1
+ 'use strict';
2
+
3
+ var chunkXE6D4J63_cjs = require('./chunk-XE6D4J63.cjs');
4
+ var chunkNNKBKENK_cjs = require('./chunk-NNKBKENK.cjs');
5
+ var chunkQEEAIXL5_cjs = require('./chunk-QEEAIXL5.cjs');
6
+ var chunk4EQQGUZ7_cjs = require('./chunk-4EQQGUZ7.cjs');
7
+ var fs = require('fs/promises');
8
+ var path = require('path');
9
+
10
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
+
12
+ var fs__default = /*#__PURE__*/_interopDefault(fs);
13
+ var path__default = /*#__PURE__*/_interopDefault(path);
14
+
15
+ var SKIP_NAMES = /* @__PURE__ */ new Set([
16
+ // Version control
17
+ ".git",
18
+ ".svn",
19
+ ".hg",
20
+ ".bzr",
21
+ // Dependencies
22
+ "node_modules",
23
+ "bower_components",
24
+ ".pnpm",
25
+ ".yarn",
26
+ "vendor",
27
+ "Pods",
28
+ ".bundle",
29
+ // Python
30
+ "__pycache__",
31
+ ".pytest_cache",
32
+ ".mypy_cache",
33
+ ".ruff_cache",
34
+ ".venv",
35
+ "venv",
36
+ ".tox",
37
+ ".nox",
38
+ ".eggs",
39
+ // Build outputs
40
+ "dist",
41
+ "build",
42
+ "out",
43
+ "output",
44
+ "target",
45
+ "_build",
46
+ ".next",
47
+ ".nuxt",
48
+ ".output",
49
+ ".vercel",
50
+ ".netlify",
51
+ // Cache
52
+ ".cache",
53
+ ".parcel-cache",
54
+ ".turbo",
55
+ ".nx",
56
+ ".gradle",
57
+ // IDE
58
+ ".idea",
59
+ ".vscode",
60
+ ".vs",
61
+ // Coverage
62
+ "coverage",
63
+ ".coverage",
64
+ "htmlcov",
65
+ ".nyc_output",
66
+ // Temp
67
+ "tmp",
68
+ "temp",
69
+ ".tmp",
70
+ ".temp",
71
+ // Lock files
72
+ "package-lock.json",
73
+ "yarn.lock",
74
+ "pnpm-lock.yaml",
75
+ "bun.lockb",
76
+ "Cargo.lock",
77
+ "Gemfile.lock",
78
+ "poetry.lock"
79
+ ]);
80
+ var SKIP_EXTENSIONS = /* @__PURE__ */ new Set([
81
+ ".min.js",
82
+ ".min.css",
83
+ ".bundle.js",
84
+ ".wasm",
85
+ ".so",
86
+ ".dll",
87
+ ".pyc",
88
+ ".map",
89
+ ".js.map"
90
+ ]);
91
+ function shouldSkip(name, allowNames) {
92
+ if (allowNames?.has(name)) return false;
93
+ if (SKIP_NAMES.has(name)) return true;
94
+ if (name.startsWith(".")) return true;
95
+ for (const ext of SKIP_EXTENSIONS) {
96
+ if (name.endsWith(ext)) return true;
97
+ }
98
+ return false;
99
+ }
100
+ var LocalRipgrepProvider = class {
101
+ constructor(repoRoot, excludes = chunk4EQQGUZ7_cjs.DEFAULT_EXCLUDES, options) {
102
+ this.repoRoot = repoRoot;
103
+ this.excludes = excludes;
104
+ if (options?.allowNames?.length) {
105
+ this.allowNames = new Set(options.allowNames);
106
+ }
107
+ }
108
+ allowNames;
109
+ async grep(params) {
110
+ let abs;
111
+ try {
112
+ abs = chunkQEEAIXL5_cjs.resolveUnderRepo(this.repoRoot, params.path);
113
+ } catch (err) {
114
+ return {
115
+ lines: [],
116
+ error: `[PATH ERROR] ${err instanceof Error ? err.message : String(err)}`
117
+ };
118
+ }
119
+ const stat = await fs__default.default.stat(abs).catch(() => null);
120
+ if (!stat) return { lines: [] };
121
+ const targetArg = abs === path__default.default.resolve(this.repoRoot) ? "." : chunkQEEAIXL5_cjs.toRepoRelative(this.repoRoot, abs);
122
+ const contextLines = params.context_lines !== void 0 ? String(params.context_lines) : "1";
123
+ const args = [
124
+ "--no-config",
125
+ "--no-heading",
126
+ "--with-filename",
127
+ "--line-number",
128
+ "--color=never",
129
+ "--trim",
130
+ "--max-columns=400",
131
+ "-C",
132
+ contextLines,
133
+ ...params.case_sensitive === false ? ["--ignore-case"] : [],
134
+ ...params.glob ? ["--glob", params.glob] : [],
135
+ ...this.excludes.filter((e) => !this.allowNames?.has(e)).flatMap((e) => ["-g", `!${e}`]),
136
+ params.pattern,
137
+ targetArg || "."
138
+ ];
139
+ const res = await chunkXE6D4J63_cjs.runRipgrep(args, { cwd: this.repoRoot });
140
+ if (res.exitCode === -1) {
141
+ return {
142
+ lines: [],
143
+ error: `[RIPGREP NOT AVAILABLE] ripgrep (rg) is required but failed to execute. Please install it:
144
+ \u2022 macOS: brew install ripgrep
145
+ \u2022 Ubuntu/Debian: apt install ripgrep
146
+ \u2022 Windows: choco install ripgrep
147
+ \u2022 Or visit: https://github.com/BurntSushi/ripgrep#installation
148
+ Exit code: ${res.exitCode}${res.stderr ? `
149
+ Details: ${res.stderr}` : ""}`
150
+ };
151
+ }
152
+ if (res.exitCode !== 0 && res.exitCode !== 1) {
153
+ return {
154
+ lines: [],
155
+ error: `[RIPGREP ERROR] grep failed with exit code ${res.exitCode}${res.stderr ? `: ${res.stderr}` : ""}`
156
+ };
157
+ }
158
+ const lines = (res.stdout || "").trim().split(/\r?\n/).filter((l) => l.length > 0);
159
+ if (lines.length > chunk4EQQGUZ7_cjs.AGENT_CONFIG.MAX_OUTPUT_LINES) {
160
+ const truncated = lines.slice(0, chunk4EQQGUZ7_cjs.AGENT_CONFIG.MAX_OUTPUT_LINES);
161
+ truncated.push(`... (output truncated at ${chunk4EQQGUZ7_cjs.AGENT_CONFIG.MAX_OUTPUT_LINES} of ${lines.length} lines)`);
162
+ return { lines: truncated };
163
+ }
164
+ return { lines };
165
+ }
166
+ async read(params) {
167
+ let abs;
168
+ try {
169
+ abs = chunkQEEAIXL5_cjs.resolveUnderRepo(this.repoRoot, params.path);
170
+ } catch (err) {
171
+ return {
172
+ lines: [],
173
+ error: `[PATH ERROR] ${err instanceof Error ? err.message : String(err)}`
174
+ };
175
+ }
176
+ let stat = await fs__default.default.stat(abs).catch(() => null);
177
+ if (!stat || !stat.isFile()) {
178
+ const fixedPath = chunkQEEAIXL5_cjs.fixPathRepetition(abs);
179
+ if (fixedPath) {
180
+ const fixedStat = await fs__default.default.stat(fixedPath).catch(() => null);
181
+ if (fixedStat?.isFile()) {
182
+ abs = fixedPath;
183
+ stat = fixedStat;
184
+ }
185
+ }
186
+ }
187
+ if (!stat || !stat.isFile()) {
188
+ return {
189
+ lines: [],
190
+ 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.`
191
+ };
192
+ }
193
+ if (chunkQEEAIXL5_cjs.isSymlink(abs)) {
194
+ return {
195
+ lines: [],
196
+ error: `[SYMLINK] You tried to read "${params.path}" but this is a symlink. Try reading the actual file it points to instead.`
197
+ };
198
+ }
199
+ if (!chunkQEEAIXL5_cjs.isTextualFile(abs)) {
200
+ return {
201
+ lines: [],
202
+ 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.`
203
+ };
204
+ }
205
+ let lines;
206
+ try {
207
+ lines = await chunkNNKBKENK_cjs.readAllLines(abs);
208
+ } catch (err) {
209
+ return {
210
+ lines: [],
211
+ error: `[READ ERROR] Failed to read "${params.path}": ${err instanceof Error ? err.message : String(err)}`
212
+ };
213
+ }
214
+ const total = lines.length;
215
+ const rawStart = params.start;
216
+ const rawEnd = params.end;
217
+ let s = 1;
218
+ let e = total;
219
+ const startValid = rawStart === void 0 || Number.isFinite(rawStart) && rawStart > 0;
220
+ const endValid = rawEnd === void 0 || Number.isFinite(rawEnd) && rawEnd > 0;
221
+ if (startValid && endValid) {
222
+ s = rawStart ?? 1;
223
+ e = Math.min(rawEnd ?? total, total);
224
+ if (s > total && total > 0 || s > e) {
225
+ s = 1;
226
+ e = total;
227
+ }
228
+ }
229
+ const out = [];
230
+ for (let i = s; i <= e; i += 1) {
231
+ const content = lines[i - 1] ?? "";
232
+ out.push(`${i}|${content}`);
233
+ }
234
+ if (out.length > chunk4EQQGUZ7_cjs.AGENT_CONFIG.MAX_READ_LINES) {
235
+ const truncated = out.slice(0, chunk4EQQGUZ7_cjs.AGENT_CONFIG.MAX_READ_LINES);
236
+ truncated.push(`... (output truncated at ${chunk4EQQGUZ7_cjs.AGENT_CONFIG.MAX_READ_LINES} of ${out.length} lines)`);
237
+ return { lines: truncated };
238
+ }
239
+ return { lines: out };
240
+ }
241
+ async listDirectory(params) {
242
+ let abs;
243
+ try {
244
+ abs = chunkQEEAIXL5_cjs.resolveUnderRepo(this.repoRoot, params.path);
245
+ } catch {
246
+ return [];
247
+ }
248
+ const stat = await fs__default.default.stat(abs).catch(() => null);
249
+ if (!stat || !stat.isDirectory()) {
250
+ return [];
251
+ }
252
+ const maxResults = params.maxResults ?? chunk4EQQGUZ7_cjs.AGENT_CONFIG.MAX_OUTPUT_LINES;
253
+ const maxDepth = params.maxDepth ?? chunk4EQQGUZ7_cjs.AGENT_CONFIG.MAX_LIST_DEPTH;
254
+ const regex = params.pattern ? new RegExp(params.pattern) : null;
255
+ const repoRoot = this.repoRoot;
256
+ const allowNames = this.allowNames;
257
+ const results = [];
258
+ let timedOut = false;
259
+ const startTime = Date.now();
260
+ async function walk(dir, depth) {
261
+ if (Date.now() - startTime > chunk4EQQGUZ7_cjs.AGENT_CONFIG.LIST_TIMEOUT_MS) {
262
+ timedOut = true;
263
+ return;
264
+ }
265
+ if (depth > maxDepth || results.length >= maxResults) return;
266
+ let entries;
267
+ try {
268
+ entries = await fs__default.default.readdir(dir, { withFileTypes: true });
269
+ } catch {
270
+ return;
271
+ }
272
+ for (const entry of entries) {
273
+ if (timedOut || results.length >= maxResults) break;
274
+ if (shouldSkip(entry.name, allowNames)) continue;
275
+ if (regex && !regex.test(entry.name)) continue;
276
+ const full = path__default.default.join(dir, entry.name);
277
+ const isDir = entry.isDirectory();
278
+ results.push({
279
+ name: entry.name,
280
+ path: chunkQEEAIXL5_cjs.toRepoRelative(repoRoot, full),
281
+ type: isDir ? "dir" : "file",
282
+ depth
283
+ });
284
+ if (isDir) {
285
+ await walk(full, depth + 1);
286
+ }
287
+ }
288
+ }
289
+ await walk(abs, 0);
290
+ return results;
291
+ }
292
+ async glob(params) {
293
+ let abs;
294
+ try {
295
+ abs = params.path ? chunkQEEAIXL5_cjs.resolveUnderRepo(this.repoRoot, params.path) : this.repoRoot;
296
+ } catch (err) {
297
+ return { files: [], searchDir: this.repoRoot, totalFound: 0, error: `[PATH ERROR] ${err instanceof Error ? err.message : String(err)}` };
298
+ }
299
+ const stat = await fs__default.default.stat(abs).catch(() => null);
300
+ if (!stat || !stat.isDirectory()) {
301
+ return { files: [], searchDir: abs, totalFound: 0, error: `[PATH ERROR] Directory not found: ${params.path || "."}` };
302
+ }
303
+ const targetArg = abs === path__default.default.resolve(this.repoRoot) ? "." : chunkQEEAIXL5_cjs.toRepoRelative(this.repoRoot, abs);
304
+ const args = [
305
+ "--no-config",
306
+ "--files",
307
+ "--color=never",
308
+ "-g",
309
+ params.pattern,
310
+ ...this.excludes.filter((e) => !this.allowNames?.has(e)).flatMap((e) => ["-g", `!${e}`]),
311
+ targetArg || "."
312
+ ];
313
+ const res = await chunkXE6D4J63_cjs.runRipgrep(args, { cwd: this.repoRoot });
314
+ if (res.exitCode === -1) {
315
+ return { files: [], searchDir: abs, totalFound: 0, error: `[RIPGREP NOT AVAILABLE] ripgrep (rg) is required for glob search.` };
316
+ }
317
+ if (res.exitCode !== 0 && res.exitCode !== 1) {
318
+ return { files: [], searchDir: abs, totalFound: 0, error: `[GLOB ERROR] glob failed with exit code ${res.exitCode}${res.stderr ? `: ${res.stderr}` : ""}` };
319
+ }
320
+ const absRoot = path__default.default.resolve(this.repoRoot);
321
+ const relFiles = (res.stdout || "").trim().split(/\r?\n/).filter((l) => l.length > 0);
322
+ const absFiles = relFiles.map((f) => path__default.default.resolve(absRoot, f));
323
+ const withMtime = [];
324
+ for (const f of absFiles) {
325
+ const s = await fs__default.default.stat(f).catch(() => null);
326
+ withMtime.push({ file: f, mtime: s?.mtimeMs ?? 0 });
327
+ }
328
+ withMtime.sort((a, b) => b.mtime - a.mtime);
329
+ const totalFound = withMtime.length;
330
+ return { files: withMtime.slice(0, 100).map((f) => f.file), searchDir: abs, totalFound };
331
+ }
332
+ };
333
+
334
+ exports.LocalRipgrepProvider = LocalRipgrepProvider;
@@ -16,6 +16,4 @@ function parseGitHubUrl(input) {
16
16
  );
17
17
  }
18
18
 
19
- export {
20
- parseGitHubUrl
21
- };
19
+ export { parseGitHubUrl };
@@ -1,24 +1,10 @@
1
- import {
2
- runRipgrep
3
- } from "./chunk-I26FQELI.js";
4
- import {
5
- readAllLines
6
- } from "./chunk-6TZCVTW5.js";
7
- import {
8
- fixPathRepetition,
9
- isSymlink,
10
- isTextualFile,
11
- resolveUnderRepo,
12
- toRepoRelative
13
- } from "./chunk-ZSHVXDA2.js";
14
- import {
15
- AGENT_CONFIG,
16
- DEFAULT_EXCLUDES
17
- } from "./chunk-M34E2AMK.js";
1
+ import { runRipgrep } from './chunk-MLPZKUCO.js';
2
+ import { readAllLines } from './chunk-6TZCVTW5.js';
3
+ import { resolveUnderRepo, toRepoRelative, fixPathRepetition, isSymlink, isTextualFile } from './chunk-ZSHVXDA2.js';
4
+ import { DEFAULT_EXCLUDES, AGENT_CONFIG } from './chunk-M34E2AMK.js';
5
+ import fs from 'fs/promises';
6
+ import path from 'path';
18
7
 
19
- // tools/warp_grep/providers/local.ts
20
- import fs from "fs/promises";
21
- import path from "path";
22
8
  var SKIP_NAMES = /* @__PURE__ */ new Set([
23
9
  // Version control
24
10
  ".git",
@@ -338,6 +324,4 @@ Details: ${res.stderr}` : ""}`
338
324
  }
339
325
  };
340
326
 
341
- export {
342
- LocalRipgrepProvider
343
- };
327
+ export { LocalRipgrepProvider };
@@ -0,0 +1,86 @@
1
+ 'use strict';
2
+
3
+ var chunk74A4HLIO_cjs = require('./chunk-74A4HLIO.cjs');
4
+ var chunkJBTR3FQD_cjs = require('./chunk-JBTR3FQD.cjs');
5
+ var chunk75ZPJI57_cjs = require('./chunk-75ZPJI57.cjs');
6
+
7
+ // tools/fastapply/openai.ts
8
+ var openai_exports = {};
9
+ chunk75ZPJI57_cjs.__export(openai_exports, {
10
+ createEditFileTool: () => createEditFileTool,
11
+ default: () => openai_default,
12
+ editFileTool: () => editFileTool,
13
+ execute: () => execute,
14
+ formatResult: () => formatResult,
15
+ getSystemPrompt: () => getSystemPrompt
16
+ });
17
+ var editFileTool = {
18
+ type: "function",
19
+ function: {
20
+ name: "edit_file",
21
+ description: chunk74A4HLIO_cjs.EDIT_FILE_TOOL_DESCRIPTION,
22
+ parameters: {
23
+ type: "object",
24
+ properties: {
25
+ target_filepath: {
26
+ type: "string",
27
+ description: "The path of the target file to modify"
28
+ },
29
+ instruction: {
30
+ type: "string",
31
+ description: "A single sentence written in the first person describing what the agent is changing. Used to help disambiguate uncertainty in the edit."
32
+ },
33
+ code_edit: {
34
+ type: "string",
35
+ description: "Specify ONLY the precise lines of code that you wish to edit. Use `// ... existing code ...` for unchanged sections."
36
+ }
37
+ },
38
+ required: ["target_filepath", "instruction", "code_edit"]
39
+ }
40
+ }
41
+ };
42
+ async function execute(input, config) {
43
+ return chunkJBTR3FQD_cjs.executeEditFile(input, config);
44
+ }
45
+ function getSystemPrompt() {
46
+ return chunk74A4HLIO_cjs.EDIT_FILE_SYSTEM_PROMPT;
47
+ }
48
+ function formatResult(result) {
49
+ if (!result.success) {
50
+ return `Error editing file: ${result.error}`;
51
+ }
52
+ const { changes } = result;
53
+ return `Successfully applied changes to ${result.filepath}. Added ${changes.linesAdded}, removed ${changes.linesRemoved}, modified ${changes.linesModified}.`;
54
+ }
55
+ function createEditFileTool(config = {}) {
56
+ const toolDef = {
57
+ ...editFileTool,
58
+ ...config.description && {
59
+ function: {
60
+ ...editFileTool.function,
61
+ description: config.description
62
+ }
63
+ }
64
+ };
65
+ return Object.assign({}, toolDef, {
66
+ execute: async (input) => {
67
+ const parsedInput = typeof input === "string" ? JSON.parse(input) : input;
68
+ return execute(parsedInput, config);
69
+ },
70
+ formatResult: (result) => {
71
+ return formatResult(result);
72
+ },
73
+ getSystemPrompt: () => {
74
+ return getSystemPrompt();
75
+ }
76
+ });
77
+ }
78
+ var openai_default = editFileTool;
79
+
80
+ exports.createEditFileTool = createEditFileTool;
81
+ exports.editFileTool = editFileTool;
82
+ exports.execute = execute;
83
+ exports.formatResult = formatResult;
84
+ exports.getSystemPrompt = getSystemPrompt;
85
+ exports.openai_default = openai_default;
86
+ exports.openai_exports = openai_exports;
@@ -36,7 +36,4 @@ Often this will mean that the start/end of the file will be skipped, but that's
36
36
 
37
37
  These edit codeblocks are also read by a less intelligent language model, colloquially called the apply model, to update the file. To help specify the edit to the apply model, you will be very careful when generating the codeblock to not introduce ambiguity. You will specify all unchanged regions (code and comments) of the file with "// ... existing code ..." comment markers. This will ensure the apply model will not delete existing unchanged code or comments when editing the file.`;
38
38
 
39
- export {
40
- EDIT_FILE_TOOL_DESCRIPTION,
41
- EDIT_FILE_SYSTEM_PROMPT
42
- };
39
+ export { EDIT_FILE_SYSTEM_PROMPT, EDIT_FILE_TOOL_DESCRIPTION };
@@ -0,0 +1,74 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs');
4
+ var path = require('path');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var fs__default = /*#__PURE__*/_interopDefault(fs);
9
+ var path__default = /*#__PURE__*/_interopDefault(path);
10
+
11
+ // tools/warp_grep/utils/paths.ts
12
+ function resolveUnderRepo(repoRoot, targetPath) {
13
+ const absRoot = path__default.default.resolve(repoRoot);
14
+ const resolved = path__default.default.resolve(absRoot, targetPath);
15
+ ensureWithinRepo(absRoot, resolved);
16
+ return resolved;
17
+ }
18
+ function ensureWithinRepo(repoRoot, absTarget) {
19
+ const rel = path__default.default.relative(path__default.default.resolve(repoRoot), path__default.default.resolve(absTarget));
20
+ if (rel.startsWith("..") || path__default.default.isAbsolute(rel)) {
21
+ throw new Error(`Path outside repository root: ${absTarget}`);
22
+ }
23
+ }
24
+ function toRepoRelative(repoRoot, absPath) {
25
+ return path__default.default.relative(path__default.default.resolve(repoRoot), path__default.default.resolve(absPath));
26
+ }
27
+ function isSymlink(p) {
28
+ try {
29
+ const st = fs__default.default.lstatSync(p);
30
+ return st.isSymbolicLink();
31
+ } catch {
32
+ return false;
33
+ }
34
+ }
35
+ function fixPathRepetition(fullPath) {
36
+ const segments = fullPath.split(path__default.default.sep).filter(Boolean);
37
+ if (segments.length < 2) return null;
38
+ for (let len = Math.floor(segments.length / 2); len >= 1; len--) {
39
+ for (let i = 0; i <= segments.length - 2 * len; i++) {
40
+ const first = segments.slice(i, i + len);
41
+ const second = segments.slice(i + len, i + 2 * len);
42
+ if (first.every((seg, idx) => seg === second[idx])) {
43
+ const fixed = [...segments.slice(0, i), ...segments.slice(i + len)];
44
+ return path__default.default.sep + fixed.join(path__default.default.sep);
45
+ }
46
+ }
47
+ }
48
+ return null;
49
+ }
50
+ function isTextualFile(filePath, maxBytes = 2e6) {
51
+ try {
52
+ const st = fs__default.default.statSync(filePath);
53
+ if (!st.isFile()) return false;
54
+ if (st.size > maxBytes) return false;
55
+ const fd = fs__default.default.openSync(filePath, "r");
56
+ const buf = Buffer.alloc(512);
57
+ const read = fs__default.default.readSync(fd, buf, 0, buf.length, 0);
58
+ fs__default.default.closeSync(fd);
59
+ for (let i = 0; i < read; i++) {
60
+ const c = buf[i];
61
+ if (c === 0) return false;
62
+ }
63
+ return true;
64
+ } catch {
65
+ return false;
66
+ }
67
+ }
68
+
69
+ exports.ensureWithinRepo = ensureWithinRepo;
70
+ exports.fixPathRepetition = fixPathRepetition;
71
+ exports.isSymlink = isSymlink;
72
+ exports.isTextualFile = isTextualFile;
73
+ exports.resolveUnderRepo = resolveUnderRepo;
74
+ exports.toRepoRelative = toRepoRelative;
@@ -1,6 +1,4 @@
1
- import {
2
- AGENT_CONFIG
3
- } from "./chunk-M34E2AMK.js";
1
+ import { AGENT_CONFIG } from './chunk-M34E2AMK.js';
4
2
 
5
3
  // tools/warp_grep/providers/remote.ts
6
4
  var SKIP_NAMES = /* @__PURE__ */ new Set([
@@ -210,6 +208,4 @@ var RemoteCommandsProvider = class {
210
208
  }
211
209
  };
212
210
 
213
- export {
214
- RemoteCommandsProvider
215
- };
211
+ export { RemoteCommandsProvider };
@@ -0,0 +1,107 @@
1
+ 'use strict';
2
+
3
+ var chunkEJTL2BOZ_cjs = require('./chunk-EJTL2BOZ.cjs');
4
+ var chunkUUCRWJJR_cjs = require('./chunk-UUCRWJJR.cjs');
5
+ var ai = require('ai');
6
+ var zod = require('zod');
7
+
8
+ var warpGrepJsonSchema = {
9
+ type: "object",
10
+ properties: {
11
+ search_term: {
12
+ type: "string",
13
+ description: "Search problem statement that this subagent is supposed to research for"
14
+ }
15
+ },
16
+ required: ["search_term"],
17
+ additionalProperties: false
18
+ };
19
+ async function execute(input, config) {
20
+ return chunkUUCRWJJR_cjs.executeToolCall(input, config);
21
+ }
22
+ function createWarpGrepTool(config) {
23
+ const schema = config.inputSchema ?? zod.z.object({
24
+ search_term: zod.z.string().describe("Search problem statement that this subagent is supposed to research for")
25
+ });
26
+ return ai.tool({
27
+ description: config.description ?? chunkEJTL2BOZ_cjs.WARP_GREP_DESCRIPTION,
28
+ inputSchema: schema,
29
+ execute: async (params) => {
30
+ const steps = [];
31
+ const generator = chunkUUCRWJJR_cjs.executeToolCallStreaming(params, config);
32
+ let result;
33
+ for (; ; ) {
34
+ const { value, done } = await generator.next();
35
+ if (done) {
36
+ result = value;
37
+ break;
38
+ }
39
+ steps.push(value);
40
+ }
41
+ if (!result.success) {
42
+ throw new Error(`Failed to search codebase: ${result.error}`);
43
+ }
44
+ const allToolCalls = steps.flatMap((s) => s.toolCalls);
45
+ return {
46
+ success: true,
47
+ contexts: result.contexts,
48
+ summary: result.summary,
49
+ progress: allToolCalls.length > 0 ? { turn: steps.length, toolCalls: allToolCalls } : void 0
50
+ };
51
+ }
52
+ });
53
+ }
54
+ function createGitHubSearchTool(config) {
55
+ const client = new chunkUUCRWJJR_cjs.WarpGrepClient(config);
56
+ return ai.tool({
57
+ description: chunkEJTL2BOZ_cjs.GITHUB_SEARCH_DESCRIPTION,
58
+ inputSchema: zod.z.object({
59
+ search_term: zod.z.string().describe("Search problem statement that this subagent is supposed to research for"),
60
+ github_url: zod.z.string().optional().describe('GitHub repository URL to search (e.g. "https://github.com/vercel/next.js"). You must provide either github_url or owner_repo.'),
61
+ owner_repo: zod.z.string().optional().describe('Repository owner/repo shorthand (e.g. "vercel/next.js"). You must provide either github_url or owner_repo.'),
62
+ branch: zod.z.string().optional().describe("Branch to search (defaults to repo default branch)")
63
+ }),
64
+ execute: async (params) => {
65
+ const github = params.github_url || params.owner_repo;
66
+ if (!github) {
67
+ throw new Error("Please provide github search url or owner/repo id");
68
+ }
69
+ const result = await client.searchGitHub({ searchTerm: params.search_term, github, branch: params.branch });
70
+ if (!result.success) {
71
+ throw new Error(`GitHub search failed: ${result.error}`);
72
+ }
73
+ return {
74
+ success: true,
75
+ contexts: result.contexts,
76
+ summary: result.summary
77
+ };
78
+ }
79
+ });
80
+ }
81
+ function createGitHubReadFileTool(config) {
82
+ return ai.tool({
83
+ description: chunkEJTL2BOZ_cjs.GITHUB_READ_FILE_DESCRIPTION,
84
+ inputSchema: zod.z.object({
85
+ github: zod.z.string().describe('owner/repo shorthand (e.g., "vercel/next.js")'),
86
+ path: zod.z.string().describe("File path within the repository"),
87
+ startLine: zod.z.number().optional().describe("Start line number (1-based)"),
88
+ endLine: zod.z.number().optional().describe("End line number (1-based, inclusive)"),
89
+ branch: zod.z.string().optional().describe("Branch to read from (defaults to repo default branch)")
90
+ }),
91
+ execute: async (params) => {
92
+ const result = await chunkUUCRWJJR_cjs.executeGitHubReadFile(params, config);
93
+ if (!result.success) {
94
+ throw new Error(`GitHub read file failed: ${result.error}`);
95
+ }
96
+ return result;
97
+ }
98
+ });
99
+ }
100
+ var vercel_default = createWarpGrepTool;
101
+
102
+ exports.createGitHubReadFileTool = createGitHubReadFileTool;
103
+ exports.createGitHubSearchTool = createGitHubSearchTool;
104
+ exports.createWarpGrepTool = createWarpGrepTool;
105
+ exports.execute = execute;
106
+ exports.vercel_default = vercel_default;
107
+ exports.warpGrepJsonSchema = warpGrepJsonSchema;
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ // package.json
4
+ var package_default = {
5
+ version: "0.2.203"};
6
+
7
+ // version.ts
8
+ var SDK_VERSION = package_default.version;
9
+
10
+ exports.SDK_VERSION = SDK_VERSION;