@morphllm/morphsdk 0.2.68 → 0.2.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-6RFT7K7F.js → chunk-26QXQFLZ.js} +88 -23
- package/dist/chunk-26QXQFLZ.js.map +1 -0
- package/dist/{chunk-FURFQDXF.js → chunk-2LSVUHIE.js} +3 -3
- package/dist/{chunk-RTDKF6NS.js → chunk-5QIWYEHJ.js} +2 -2
- package/dist/{chunk-BYNVJ4ON.js → chunk-7CJPKJEE.js} +2 -2
- package/dist/{chunk-SXE54MIC.js → chunk-B3J2O2NW.js} +8 -8
- package/dist/{chunk-VDJGZIQ5.js → chunk-BGSHC2UK.js} +2 -2
- package/dist/{chunk-VLZEBK7S.js → chunk-E4434A4Y.js} +3 -3
- package/dist/{chunk-W76ICQKY.js → chunk-IUG2FHNN.js} +2 -2
- package/dist/{chunk-QEGH3CWQ.js → chunk-P6OEPI4N.js} +3 -3
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/{chunk-K3EHH3C4.js → chunk-Q6GHKKS5.js} +3 -3
- package/dist/{chunk-223ZMZP6.js → chunk-QIG7YPFW.js} +89 -30
- package/dist/chunk-QIG7YPFW.js.map +1 -0
- package/dist/{chunk-HBWJLKNM.js → chunk-QZNGKOCZ.js} +2 -2
- package/dist/{chunk-AAIUUX4Y.js → chunk-X4WPMVCM.js} +2 -2
- package/dist/{chunk-JPGX6WEV.js → chunk-XFCMTW5L.js} +3 -3
- package/dist/client.cjs +174 -434
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +11 -12
- package/dist/git/client.js +1 -1
- package/dist/git/config.js +1 -1
- package/dist/git/index.js +1 -1
- package/dist/index.cjs +174 -434
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -13
- package/dist/modelrouter/core.js +1 -1
- package/dist/modelrouter/index.js +1 -1
- package/dist/tools/browser/anthropic.js +2 -2
- package/dist/tools/browser/core.js +1 -1
- package/dist/tools/browser/index.js +4 -4
- package/dist/tools/browser/live.js +1 -1
- package/dist/tools/browser/openai.js +2 -2
- package/dist/tools/browser/prompts.js +1 -1
- package/dist/tools/browser/vercel.js +2 -2
- package/dist/tools/codebase_search/anthropic.js +1 -1
- package/dist/tools/codebase_search/core.js +1 -1
- package/dist/tools/codebase_search/index.js +1 -1
- package/dist/tools/codebase_search/openai.js +1 -1
- package/dist/tools/codebase_search/prompts.js +1 -1
- package/dist/tools/codebase_search/vercel.js +1 -1
- package/dist/tools/fastapply/anthropic.js +2 -2
- package/dist/tools/fastapply/core.js +1 -1
- package/dist/tools/fastapply/index.js +4 -4
- package/dist/tools/fastapply/openai.js +2 -2
- package/dist/tools/fastapply/prompts.js +1 -1
- package/dist/tools/fastapply/vercel.js +2 -2
- package/dist/tools/index.js +4 -4
- package/dist/tools/utils/resilience.js +1 -1
- package/dist/tools/warp_grep/agent/config.js +1 -1
- package/dist/tools/warp_grep/agent/formatter.js +1 -1
- package/dist/tools/warp_grep/agent/parser.js +1 -1
- package/dist/tools/warp_grep/agent/prompt.js +1 -1
- package/dist/tools/warp_grep/agent/runner.js +1 -1
- package/dist/tools/warp_grep/anthropic.cjs +174 -434
- package/dist/tools/warp_grep/anthropic.cjs.map +1 -1
- package/dist/tools/warp_grep/anthropic.js +5 -6
- package/dist/tools/warp_grep/client.cjs +174 -434
- package/dist/tools/warp_grep/client.cjs.map +1 -1
- package/dist/tools/warp_grep/client.js +4 -5
- package/dist/tools/warp_grep/gemini.cjs +174 -434
- package/dist/tools/warp_grep/gemini.cjs.map +1 -1
- package/dist/tools/warp_grep/gemini.js +5 -6
- package/dist/tools/warp_grep/harness.cjs +88 -417
- package/dist/tools/warp_grep/harness.cjs.map +1 -1
- package/dist/tools/warp_grep/harness.js +2 -3
- package/dist/tools/warp_grep/harness.js.map +1 -1
- package/dist/tools/warp_grep/index.cjs +174 -434
- package/dist/tools/warp_grep/index.cjs.map +1 -1
- package/dist/tools/warp_grep/index.js +8 -9
- package/dist/tools/warp_grep/openai.cjs +174 -434
- package/dist/tools/warp_grep/openai.cjs.map +1 -1
- package/dist/tools/warp_grep/openai.js +5 -6
- package/dist/tools/warp_grep/providers/local.cjs +88 -417
- package/dist/tools/warp_grep/providers/local.cjs.map +1 -1
- package/dist/tools/warp_grep/providers/local.d.ts +0 -6
- package/dist/tools/warp_grep/providers/local.js +2 -3
- package/dist/tools/warp_grep/providers/remote.cjs +86 -408
- package/dist/tools/warp_grep/providers/remote.cjs.map +1 -1
- package/dist/tools/warp_grep/providers/remote.d.ts +0 -7
- package/dist/tools/warp_grep/providers/remote.js +2 -3
- package/dist/tools/warp_grep/utils/files.js +1 -1
- package/dist/tools/warp_grep/utils/paths.js +1 -1
- package/dist/tools/warp_grep/utils/ripgrep.js +1 -1
- package/dist/tools/warp_grep/vercel.cjs +174 -434
- package/dist/tools/warp_grep/vercel.cjs.map +1 -1
- package/dist/tools/warp_grep/vercel.js +5 -6
- package/package.json +1 -1
- package/dist/chunk-223ZMZP6.js.map +0 -1
- package/dist/chunk-6RFT7K7F.js.map +0 -1
- package/dist/chunk-HKJ2B2AA.js +0 -15
- package/dist/chunk-S6KU22MU.js +0 -396
- package/dist/chunk-S6KU22MU.js.map +0 -1
- /package/dist/{chunk-FURFQDXF.js.map → chunk-2LSVUHIE.js.map} +0 -0
- /package/dist/{chunk-RTDKF6NS.js.map → chunk-5QIWYEHJ.js.map} +0 -0
- /package/dist/{chunk-BYNVJ4ON.js.map → chunk-7CJPKJEE.js.map} +0 -0
- /package/dist/{chunk-SXE54MIC.js.map → chunk-B3J2O2NW.js.map} +0 -0
- /package/dist/{chunk-VDJGZIQ5.js.map → chunk-BGSHC2UK.js.map} +0 -0
- /package/dist/{chunk-VLZEBK7S.js.map → chunk-E4434A4Y.js.map} +0 -0
- /package/dist/{chunk-W76ICQKY.js.map → chunk-IUG2FHNN.js.map} +0 -0
- /package/dist/{chunk-QEGH3CWQ.js.map → chunk-P6OEPI4N.js.map} +0 -0
- /package/dist/{chunk-HKJ2B2AA.js.map → chunk-PZ5AY32C.js.map} +0 -0
- /package/dist/{chunk-K3EHH3C4.js.map → chunk-Q6GHKKS5.js.map} +0 -0
- /package/dist/{chunk-HBWJLKNM.js.map → chunk-QZNGKOCZ.js.map} +0 -0
- /package/dist/{chunk-AAIUUX4Y.js.map → chunk-X4WPMVCM.js.map} +0 -0
- /package/dist/{chunk-JPGX6WEV.js.map → chunk-XFCMTW5L.js.map} +0 -0
|
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
8
|
var __export = (target, all) => {
|
|
12
9
|
for (var name in all)
|
|
13
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -30,394 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
27
|
));
|
|
31
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
29
|
|
|
33
|
-
// node_modules/ignore/index.js
|
|
34
|
-
var require_ignore = __commonJS({
|
|
35
|
-
"node_modules/ignore/index.js"(exports2, module2) {
|
|
36
|
-
"use strict";
|
|
37
|
-
function makeArray(subject) {
|
|
38
|
-
return Array.isArray(subject) ? subject : [subject];
|
|
39
|
-
}
|
|
40
|
-
var EMPTY = "";
|
|
41
|
-
var SPACE = " ";
|
|
42
|
-
var ESCAPE = "\\";
|
|
43
|
-
var REGEX_TEST_BLANK_LINE = /^\s+$/;
|
|
44
|
-
var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
|
|
45
|
-
var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
|
|
46
|
-
var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
|
|
47
|
-
var REGEX_SPLITALL_CRLF = /\r?\n/g;
|
|
48
|
-
var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/;
|
|
49
|
-
var SLASH = "/";
|
|
50
|
-
var TMP_KEY_IGNORE = "node-ignore";
|
|
51
|
-
if (typeof Symbol !== "undefined") {
|
|
52
|
-
TMP_KEY_IGNORE = Symbol.for("node-ignore");
|
|
53
|
-
}
|
|
54
|
-
var KEY_IGNORE = TMP_KEY_IGNORE;
|
|
55
|
-
var define = (object, key, value) => Object.defineProperty(object, key, { value });
|
|
56
|
-
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
|
57
|
-
var RETURN_FALSE = () => false;
|
|
58
|
-
var sanitizeRange = (range) => range.replace(
|
|
59
|
-
REGEX_REGEXP_RANGE,
|
|
60
|
-
(match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY
|
|
61
|
-
);
|
|
62
|
-
var cleanRangeBackSlash = (slashes) => {
|
|
63
|
-
const { length } = slashes;
|
|
64
|
-
return slashes.slice(0, length - length % 2);
|
|
65
|
-
};
|
|
66
|
-
var REPLACERS = [
|
|
67
|
-
[
|
|
68
|
-
// remove BOM
|
|
69
|
-
// TODO:
|
|
70
|
-
// Other similar zero-width characters?
|
|
71
|
-
/^\uFEFF/,
|
|
72
|
-
() => EMPTY
|
|
73
|
-
],
|
|
74
|
-
// > Trailing spaces are ignored unless they are quoted with backslash ("\")
|
|
75
|
-
[
|
|
76
|
-
// (a\ ) -> (a )
|
|
77
|
-
// (a ) -> (a)
|
|
78
|
-
// (a ) -> (a)
|
|
79
|
-
// (a \ ) -> (a )
|
|
80
|
-
/((?:\\\\)*?)(\\?\s+)$/,
|
|
81
|
-
(_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)
|
|
82
|
-
],
|
|
83
|
-
// replace (\ ) with ' '
|
|
84
|
-
// (\ ) -> ' '
|
|
85
|
-
// (\\ ) -> '\\ '
|
|
86
|
-
// (\\\ ) -> '\\ '
|
|
87
|
-
[
|
|
88
|
-
/(\\+?)\s/g,
|
|
89
|
-
(_, m1) => {
|
|
90
|
-
const { length } = m1;
|
|
91
|
-
return m1.slice(0, length - length % 2) + SPACE;
|
|
92
|
-
}
|
|
93
|
-
],
|
|
94
|
-
// Escape metacharacters
|
|
95
|
-
// which is written down by users but means special for regular expressions.
|
|
96
|
-
// > There are 12 characters with special meanings:
|
|
97
|
-
// > - the backslash \,
|
|
98
|
-
// > - the caret ^,
|
|
99
|
-
// > - the dollar sign $,
|
|
100
|
-
// > - the period or dot .,
|
|
101
|
-
// > - the vertical bar or pipe symbol |,
|
|
102
|
-
// > - the question mark ?,
|
|
103
|
-
// > - the asterisk or star *,
|
|
104
|
-
// > - the plus sign +,
|
|
105
|
-
// > - the opening parenthesis (,
|
|
106
|
-
// > - the closing parenthesis ),
|
|
107
|
-
// > - and the opening square bracket [,
|
|
108
|
-
// > - the opening curly brace {,
|
|
109
|
-
// > These special characters are often called "metacharacters".
|
|
110
|
-
[
|
|
111
|
-
/[\\$.|*+(){^]/g,
|
|
112
|
-
(match) => `\\${match}`
|
|
113
|
-
],
|
|
114
|
-
[
|
|
115
|
-
// > a question mark (?) matches a single character
|
|
116
|
-
/(?!\\)\?/g,
|
|
117
|
-
() => "[^/]"
|
|
118
|
-
],
|
|
119
|
-
// leading slash
|
|
120
|
-
[
|
|
121
|
-
// > A leading slash matches the beginning of the pathname.
|
|
122
|
-
// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
|
|
123
|
-
// A leading slash matches the beginning of the pathname
|
|
124
|
-
/^\//,
|
|
125
|
-
() => "^"
|
|
126
|
-
],
|
|
127
|
-
// replace special metacharacter slash after the leading slash
|
|
128
|
-
[
|
|
129
|
-
/\//g,
|
|
130
|
-
() => "\\/"
|
|
131
|
-
],
|
|
132
|
-
[
|
|
133
|
-
// > A leading "**" followed by a slash means match in all directories.
|
|
134
|
-
// > For example, "**/foo" matches file or directory "foo" anywhere,
|
|
135
|
-
// > the same as pattern "foo".
|
|
136
|
-
// > "**/foo/bar" matches file or directory "bar" anywhere that is directly
|
|
137
|
-
// > under directory "foo".
|
|
138
|
-
// Notice that the '*'s have been replaced as '\\*'
|
|
139
|
-
/^\^*\\\*\\\*\\\//,
|
|
140
|
-
// '**/foo' <-> 'foo'
|
|
141
|
-
() => "^(?:.*\\/)?"
|
|
142
|
-
],
|
|
143
|
-
// starting
|
|
144
|
-
[
|
|
145
|
-
// there will be no leading '/'
|
|
146
|
-
// (which has been replaced by section "leading slash")
|
|
147
|
-
// If starts with '**', adding a '^' to the regular expression also works
|
|
148
|
-
/^(?=[^^])/,
|
|
149
|
-
function startingReplacer() {
|
|
150
|
-
return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
|
|
151
|
-
}
|
|
152
|
-
],
|
|
153
|
-
// two globstars
|
|
154
|
-
[
|
|
155
|
-
// Use lookahead assertions so that we could match more than one `'/**'`
|
|
156
|
-
/\\\/\\\*\\\*(?=\\\/|$)/g,
|
|
157
|
-
// Zero, one or several directories
|
|
158
|
-
// should not use '*', or it will be replaced by the next replacer
|
|
159
|
-
// Check if it is not the last `'/**'`
|
|
160
|
-
(_, index, str) => index + 6 < str.length ? "(?:\\/[^\\/]+)*" : "\\/.+"
|
|
161
|
-
],
|
|
162
|
-
// normal intermediate wildcards
|
|
163
|
-
[
|
|
164
|
-
// Never replace escaped '*'
|
|
165
|
-
// ignore rule '\*' will match the path '*'
|
|
166
|
-
// 'abc.*/' -> go
|
|
167
|
-
// 'abc.*' -> skip this rule,
|
|
168
|
-
// coz trailing single wildcard will be handed by [trailing wildcard]
|
|
169
|
-
/(^|[^\\]+)(\\\*)+(?=.+)/g,
|
|
170
|
-
// '*.js' matches '.js'
|
|
171
|
-
// '*.js' doesn't match 'abc'
|
|
172
|
-
(_, p1, p2) => {
|
|
173
|
-
const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
|
|
174
|
-
return p1 + unescaped;
|
|
175
|
-
}
|
|
176
|
-
],
|
|
177
|
-
[
|
|
178
|
-
// unescape, revert step 3 except for back slash
|
|
179
|
-
// For example, if a user escape a '\\*',
|
|
180
|
-
// after step 3, the result will be '\\\\\\*'
|
|
181
|
-
/\\\\\\(?=[$.|*+(){^])/g,
|
|
182
|
-
() => ESCAPE
|
|
183
|
-
],
|
|
184
|
-
[
|
|
185
|
-
// '\\\\' -> '\\'
|
|
186
|
-
/\\\\/g,
|
|
187
|
-
() => ESCAPE
|
|
188
|
-
],
|
|
189
|
-
[
|
|
190
|
-
// > The range notation, e.g. [a-zA-Z],
|
|
191
|
-
// > can be used to match one of the characters in a range.
|
|
192
|
-
// `\` is escaped by step 3
|
|
193
|
-
/(\\)?\[([^\]/]*?)(\\*)($|\])/g,
|
|
194
|
-
(match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
|
|
195
|
-
],
|
|
196
|
-
// ending
|
|
197
|
-
[
|
|
198
|
-
// 'js' will not match 'js.'
|
|
199
|
-
// 'ab' will not match 'abc'
|
|
200
|
-
/(?:[^*])$/,
|
|
201
|
-
// WTF!
|
|
202
|
-
// https://git-scm.com/docs/gitignore
|
|
203
|
-
// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
|
|
204
|
-
// which re-fixes #24, #38
|
|
205
|
-
// > If there is a separator at the end of the pattern then the pattern
|
|
206
|
-
// > will only match directories, otherwise the pattern can match both
|
|
207
|
-
// > files and directories.
|
|
208
|
-
// 'js*' will not match 'a.js'
|
|
209
|
-
// 'js/' will not match 'a.js'
|
|
210
|
-
// 'js' will match 'a.js' and 'a.js/'
|
|
211
|
-
(match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
|
|
212
|
-
],
|
|
213
|
-
// trailing wildcard
|
|
214
|
-
[
|
|
215
|
-
/(\^|\\\/)?\\\*$/,
|
|
216
|
-
(_, p1) => {
|
|
217
|
-
const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
|
|
218
|
-
return `${prefix}(?=$|\\/$)`;
|
|
219
|
-
}
|
|
220
|
-
]
|
|
221
|
-
];
|
|
222
|
-
var regexCache = /* @__PURE__ */ Object.create(null);
|
|
223
|
-
var makeRegex = (pattern, ignoreCase) => {
|
|
224
|
-
let source = regexCache[pattern];
|
|
225
|
-
if (!source) {
|
|
226
|
-
source = REPLACERS.reduce(
|
|
227
|
-
(prev, [matcher, replacer]) => prev.replace(matcher, replacer.bind(pattern)),
|
|
228
|
-
pattern
|
|
229
|
-
);
|
|
230
|
-
regexCache[pattern] = source;
|
|
231
|
-
}
|
|
232
|
-
return ignoreCase ? new RegExp(source, "i") : new RegExp(source);
|
|
233
|
-
};
|
|
234
|
-
var isString = (subject) => typeof subject === "string";
|
|
235
|
-
var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
|
|
236
|
-
var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
|
|
237
|
-
var IgnoreRule = class {
|
|
238
|
-
constructor(origin, pattern, negative, regex) {
|
|
239
|
-
this.origin = origin;
|
|
240
|
-
this.pattern = pattern;
|
|
241
|
-
this.negative = negative;
|
|
242
|
-
this.regex = regex;
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
var createRule = (pattern, ignoreCase) => {
|
|
246
|
-
const origin = pattern;
|
|
247
|
-
let negative = false;
|
|
248
|
-
if (pattern.indexOf("!") === 0) {
|
|
249
|
-
negative = true;
|
|
250
|
-
pattern = pattern.substr(1);
|
|
251
|
-
}
|
|
252
|
-
pattern = pattern.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
|
|
253
|
-
const regex = makeRegex(pattern, ignoreCase);
|
|
254
|
-
return new IgnoreRule(
|
|
255
|
-
origin,
|
|
256
|
-
pattern,
|
|
257
|
-
negative,
|
|
258
|
-
regex
|
|
259
|
-
);
|
|
260
|
-
};
|
|
261
|
-
var throwError = (message, Ctor) => {
|
|
262
|
-
throw new Ctor(message);
|
|
263
|
-
};
|
|
264
|
-
var checkPath = (path5, originalPath, doThrow) => {
|
|
265
|
-
if (!isString(path5)) {
|
|
266
|
-
return doThrow(
|
|
267
|
-
`path must be a string, but got \`${originalPath}\``,
|
|
268
|
-
TypeError
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
if (!path5) {
|
|
272
|
-
return doThrow(`path must not be empty`, TypeError);
|
|
273
|
-
}
|
|
274
|
-
if (checkPath.isNotRelative(path5)) {
|
|
275
|
-
const r = "`path.relative()`d";
|
|
276
|
-
return doThrow(
|
|
277
|
-
`path should be a ${r} string, but got "${originalPath}"`,
|
|
278
|
-
RangeError
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
return true;
|
|
282
|
-
};
|
|
283
|
-
var isNotRelative = (path5) => REGEX_TEST_INVALID_PATH.test(path5);
|
|
284
|
-
checkPath.isNotRelative = isNotRelative;
|
|
285
|
-
checkPath.convert = (p) => p;
|
|
286
|
-
var Ignore = class {
|
|
287
|
-
constructor({
|
|
288
|
-
ignorecase = true,
|
|
289
|
-
ignoreCase = ignorecase,
|
|
290
|
-
allowRelativePaths = false
|
|
291
|
-
} = {}) {
|
|
292
|
-
define(this, KEY_IGNORE, true);
|
|
293
|
-
this._rules = [];
|
|
294
|
-
this._ignoreCase = ignoreCase;
|
|
295
|
-
this._allowRelativePaths = allowRelativePaths;
|
|
296
|
-
this._initCache();
|
|
297
|
-
}
|
|
298
|
-
_initCache() {
|
|
299
|
-
this._ignoreCache = /* @__PURE__ */ Object.create(null);
|
|
300
|
-
this._testCache = /* @__PURE__ */ Object.create(null);
|
|
301
|
-
}
|
|
302
|
-
_addPattern(pattern) {
|
|
303
|
-
if (pattern && pattern[KEY_IGNORE]) {
|
|
304
|
-
this._rules = this._rules.concat(pattern._rules);
|
|
305
|
-
this._added = true;
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
if (checkPattern(pattern)) {
|
|
309
|
-
const rule = createRule(pattern, this._ignoreCase);
|
|
310
|
-
this._added = true;
|
|
311
|
-
this._rules.push(rule);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
// @param {Array<string> | string | Ignore} pattern
|
|
315
|
-
add(pattern) {
|
|
316
|
-
this._added = false;
|
|
317
|
-
makeArray(
|
|
318
|
-
isString(pattern) ? splitPattern(pattern) : pattern
|
|
319
|
-
).forEach(this._addPattern, this);
|
|
320
|
-
if (this._added) {
|
|
321
|
-
this._initCache();
|
|
322
|
-
}
|
|
323
|
-
return this;
|
|
324
|
-
}
|
|
325
|
-
// legacy
|
|
326
|
-
addPattern(pattern) {
|
|
327
|
-
return this.add(pattern);
|
|
328
|
-
}
|
|
329
|
-
// | ignored : unignored
|
|
330
|
-
// negative | 0:0 | 0:1 | 1:0 | 1:1
|
|
331
|
-
// -------- | ------- | ------- | ------- | --------
|
|
332
|
-
// 0 | TEST | TEST | SKIP | X
|
|
333
|
-
// 1 | TESTIF | SKIP | TEST | X
|
|
334
|
-
// - SKIP: always skip
|
|
335
|
-
// - TEST: always test
|
|
336
|
-
// - TESTIF: only test if checkUnignored
|
|
337
|
-
// - X: that never happen
|
|
338
|
-
// @param {boolean} whether should check if the path is unignored,
|
|
339
|
-
// setting `checkUnignored` to `false` could reduce additional
|
|
340
|
-
// path matching.
|
|
341
|
-
// @returns {TestResult} true if a file is ignored
|
|
342
|
-
_testOne(path5, checkUnignored) {
|
|
343
|
-
let ignored = false;
|
|
344
|
-
let unignored = false;
|
|
345
|
-
this._rules.forEach((rule) => {
|
|
346
|
-
const { negative } = rule;
|
|
347
|
-
if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
const matched = rule.regex.test(path5);
|
|
351
|
-
if (matched) {
|
|
352
|
-
ignored = !negative;
|
|
353
|
-
unignored = negative;
|
|
354
|
-
}
|
|
355
|
-
});
|
|
356
|
-
return {
|
|
357
|
-
ignored,
|
|
358
|
-
unignored
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
// @returns {TestResult}
|
|
362
|
-
_test(originalPath, cache, checkUnignored, slices) {
|
|
363
|
-
const path5 = originalPath && checkPath.convert(originalPath);
|
|
364
|
-
checkPath(
|
|
365
|
-
path5,
|
|
366
|
-
originalPath,
|
|
367
|
-
this._allowRelativePaths ? RETURN_FALSE : throwError
|
|
368
|
-
);
|
|
369
|
-
return this._t(path5, cache, checkUnignored, slices);
|
|
370
|
-
}
|
|
371
|
-
_t(path5, cache, checkUnignored, slices) {
|
|
372
|
-
if (path5 in cache) {
|
|
373
|
-
return cache[path5];
|
|
374
|
-
}
|
|
375
|
-
if (!slices) {
|
|
376
|
-
slices = path5.split(SLASH);
|
|
377
|
-
}
|
|
378
|
-
slices.pop();
|
|
379
|
-
if (!slices.length) {
|
|
380
|
-
return cache[path5] = this._testOne(path5, checkUnignored);
|
|
381
|
-
}
|
|
382
|
-
const parent = this._t(
|
|
383
|
-
slices.join(SLASH) + SLASH,
|
|
384
|
-
cache,
|
|
385
|
-
checkUnignored,
|
|
386
|
-
slices
|
|
387
|
-
);
|
|
388
|
-
return cache[path5] = parent.ignored ? parent : this._testOne(path5, checkUnignored);
|
|
389
|
-
}
|
|
390
|
-
ignores(path5) {
|
|
391
|
-
return this._test(path5, this._ignoreCache, false).ignored;
|
|
392
|
-
}
|
|
393
|
-
createFilter() {
|
|
394
|
-
return (path5) => !this.ignores(path5);
|
|
395
|
-
}
|
|
396
|
-
filter(paths) {
|
|
397
|
-
return makeArray(paths).filter(this.createFilter());
|
|
398
|
-
}
|
|
399
|
-
// @returns {TestResult}
|
|
400
|
-
test(path5) {
|
|
401
|
-
return this._test(path5, this._testCache, true);
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
var factory = (options) => new Ignore(options);
|
|
405
|
-
var isPathValid = (path5) => checkPath(path5 && checkPath.convert(path5), path5, RETURN_FALSE);
|
|
406
|
-
factory.isPathValid = isPathValid;
|
|
407
|
-
factory.default = factory;
|
|
408
|
-
module2.exports = factory;
|
|
409
|
-
if (
|
|
410
|
-
// Detect `process` so that it can run in browsers.
|
|
411
|
-
typeof process !== "undefined" && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === "win32")
|
|
412
|
-
) {
|
|
413
|
-
const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
|
|
414
|
-
checkPath.convert = makePosix;
|
|
415
|
-
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
|
416
|
-
checkPath.isNotRelative = (path5) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path5) || isNotRelative(path5);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
|
|
421
30
|
// tools/warp_grep/openai.ts
|
|
422
31
|
var openai_exports = {};
|
|
423
32
|
__export(openai_exports, {
|
|
@@ -1602,30 +1211,95 @@ async function readAllLines(filePath) {
|
|
|
1602
1211
|
}
|
|
1603
1212
|
|
|
1604
1213
|
// tools/warp_grep/providers/local.ts
|
|
1605
|
-
var
|
|
1214
|
+
var SKIP_NAMES = /* @__PURE__ */ new Set([
|
|
1215
|
+
// Version control
|
|
1216
|
+
".git",
|
|
1217
|
+
".svn",
|
|
1218
|
+
".hg",
|
|
1219
|
+
".bzr",
|
|
1220
|
+
// Dependencies
|
|
1221
|
+
"node_modules",
|
|
1222
|
+
"bower_components",
|
|
1223
|
+
".pnpm",
|
|
1224
|
+
".yarn",
|
|
1225
|
+
"vendor",
|
|
1226
|
+
"Pods",
|
|
1227
|
+
".bundle",
|
|
1228
|
+
// Python
|
|
1229
|
+
"__pycache__",
|
|
1230
|
+
".pytest_cache",
|
|
1231
|
+
".mypy_cache",
|
|
1232
|
+
".ruff_cache",
|
|
1233
|
+
".venv",
|
|
1234
|
+
"venv",
|
|
1235
|
+
".tox",
|
|
1236
|
+
".nox",
|
|
1237
|
+
".eggs",
|
|
1238
|
+
// Build outputs
|
|
1239
|
+
"dist",
|
|
1240
|
+
"build",
|
|
1241
|
+
"out",
|
|
1242
|
+
"output",
|
|
1243
|
+
"target",
|
|
1244
|
+
"_build",
|
|
1245
|
+
".next",
|
|
1246
|
+
".nuxt",
|
|
1247
|
+
".output",
|
|
1248
|
+
".vercel",
|
|
1249
|
+
".netlify",
|
|
1250
|
+
// Cache
|
|
1251
|
+
".cache",
|
|
1252
|
+
".parcel-cache",
|
|
1253
|
+
".turbo",
|
|
1254
|
+
".nx",
|
|
1255
|
+
".gradle",
|
|
1256
|
+
// IDE
|
|
1257
|
+
".idea",
|
|
1258
|
+
".vscode",
|
|
1259
|
+
".vs",
|
|
1260
|
+
// Coverage
|
|
1261
|
+
"coverage",
|
|
1262
|
+
".coverage",
|
|
1263
|
+
"htmlcov",
|
|
1264
|
+
".nyc_output",
|
|
1265
|
+
// Temp
|
|
1266
|
+
"tmp",
|
|
1267
|
+
"temp",
|
|
1268
|
+
".tmp",
|
|
1269
|
+
".temp",
|
|
1270
|
+
// Lock files
|
|
1271
|
+
"package-lock.json",
|
|
1272
|
+
"yarn.lock",
|
|
1273
|
+
"pnpm-lock.yaml",
|
|
1274
|
+
"bun.lockb",
|
|
1275
|
+
"Cargo.lock",
|
|
1276
|
+
"Gemfile.lock",
|
|
1277
|
+
"poetry.lock"
|
|
1278
|
+
]);
|
|
1279
|
+
var SKIP_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
1280
|
+
".min.js",
|
|
1281
|
+
".min.css",
|
|
1282
|
+
".bundle.js",
|
|
1283
|
+
".wasm",
|
|
1284
|
+
".so",
|
|
1285
|
+
".dll",
|
|
1286
|
+
".pyc",
|
|
1287
|
+
".map",
|
|
1288
|
+
".js.map"
|
|
1289
|
+
]);
|
|
1290
|
+
function shouldSkip(name) {
|
|
1291
|
+
if (SKIP_NAMES.has(name)) return true;
|
|
1292
|
+
if (name.startsWith(".")) return true;
|
|
1293
|
+
for (const ext of SKIP_EXTENSIONS) {
|
|
1294
|
+
if (name.endsWith(ext)) return true;
|
|
1295
|
+
}
|
|
1296
|
+
return false;
|
|
1297
|
+
}
|
|
1606
1298
|
var LocalRipgrepProvider = class {
|
|
1607
1299
|
constructor(repoRoot, excludes = DEFAULT_EXCLUDES) {
|
|
1608
1300
|
this.repoRoot = repoRoot;
|
|
1609
1301
|
this.excludes = excludes;
|
|
1610
1302
|
}
|
|
1611
|
-
ignoreFilter = null;
|
|
1612
|
-
/**
|
|
1613
|
-
* Build an ignore filter that combines DEFAULT_EXCLUDES and .gitignore patterns.
|
|
1614
|
-
* Cached after first call.
|
|
1615
|
-
*/
|
|
1616
|
-
async getIgnoreFilter() {
|
|
1617
|
-
if (this.ignoreFilter) return this.ignoreFilter;
|
|
1618
|
-
const ig = ignore();
|
|
1619
|
-
ig.add(this.excludes);
|
|
1620
|
-
try {
|
|
1621
|
-
const gitignorePath = import_path4.default.join(this.repoRoot, ".gitignore");
|
|
1622
|
-
const gitignoreContent = await import_promises2.default.readFile(gitignorePath, "utf-8");
|
|
1623
|
-
ig.add(gitignoreContent);
|
|
1624
|
-
} catch {
|
|
1625
|
-
}
|
|
1626
|
-
this.ignoreFilter = ig;
|
|
1627
|
-
return ig;
|
|
1628
|
-
}
|
|
1629
1303
|
async grep(params) {
|
|
1630
1304
|
let abs;
|
|
1631
1305
|
try {
|
|
@@ -1753,11 +1427,10 @@ Details: ${res.stderr}` : ""}`
|
|
|
1753
1427
|
const maxResults = params.maxResults ?? AGENT_CONFIG.MAX_OUTPUT_LINES;
|
|
1754
1428
|
const maxDepth = params.maxDepth ?? AGENT_CONFIG.MAX_LIST_DEPTH;
|
|
1755
1429
|
const regex = params.pattern ? new RegExp(params.pattern) : null;
|
|
1756
|
-
const
|
|
1430
|
+
const repoRoot = this.repoRoot;
|
|
1757
1431
|
const results = [];
|
|
1758
1432
|
let timedOut = false;
|
|
1759
1433
|
const startTime = Date.now();
|
|
1760
|
-
const repoRoot = this.repoRoot;
|
|
1761
1434
|
async function walk(dir, depth) {
|
|
1762
1435
|
if (Date.now() - startTime > AGENT_CONFIG.LIST_TIMEOUT_MS) {
|
|
1763
1436
|
timedOut = true;
|
|
@@ -1767,15 +1440,13 @@ Details: ${res.stderr}` : ""}`
|
|
|
1767
1440
|
const entries = await import_promises2.default.readdir(dir, { withFileTypes: true });
|
|
1768
1441
|
for (const entry of entries) {
|
|
1769
1442
|
if (timedOut || results.length >= maxResults) break;
|
|
1443
|
+
if (shouldSkip(entry.name)) continue;
|
|
1444
|
+
if (regex && !regex.test(entry.name)) continue;
|
|
1770
1445
|
const full = import_path4.default.join(dir, entry.name);
|
|
1771
|
-
const relToRepo = toRepoRelative(repoRoot, full).replace(/^[.][/\\]?/, "");
|
|
1772
1446
|
const isDir = entry.isDirectory();
|
|
1773
|
-
if (ig.ignores(relToRepo) || isDir && ig.ignores(relToRepo + "/")) continue;
|
|
1774
|
-
if (regex && !regex.test(entry.name)) continue;
|
|
1775
1447
|
results.push({
|
|
1776
1448
|
name: entry.name,
|
|
1777
|
-
path: toRepoRelative(
|
|
1778
|
-
// relative display
|
|
1449
|
+
path: toRepoRelative(repoRoot, full),
|
|
1779
1450
|
type: isDir ? "dir" : "file",
|
|
1780
1451
|
depth
|
|
1781
1452
|
});
|
|
@@ -1790,25 +1461,95 @@ Details: ${res.stderr}` : ""}`
|
|
|
1790
1461
|
};
|
|
1791
1462
|
|
|
1792
1463
|
// tools/warp_grep/providers/remote.ts
|
|
1793
|
-
var
|
|
1464
|
+
var SKIP_NAMES2 = /* @__PURE__ */ new Set([
|
|
1465
|
+
// Version control
|
|
1466
|
+
".git",
|
|
1467
|
+
".svn",
|
|
1468
|
+
".hg",
|
|
1469
|
+
".bzr",
|
|
1470
|
+
// Dependencies
|
|
1471
|
+
"node_modules",
|
|
1472
|
+
"bower_components",
|
|
1473
|
+
".pnpm",
|
|
1474
|
+
".yarn",
|
|
1475
|
+
"vendor",
|
|
1476
|
+
"Pods",
|
|
1477
|
+
".bundle",
|
|
1478
|
+
// Python
|
|
1479
|
+
"__pycache__",
|
|
1480
|
+
".pytest_cache",
|
|
1481
|
+
".mypy_cache",
|
|
1482
|
+
".ruff_cache",
|
|
1483
|
+
".venv",
|
|
1484
|
+
"venv",
|
|
1485
|
+
".tox",
|
|
1486
|
+
".nox",
|
|
1487
|
+
".eggs",
|
|
1488
|
+
// Build outputs
|
|
1489
|
+
"dist",
|
|
1490
|
+
"build",
|
|
1491
|
+
"out",
|
|
1492
|
+
"output",
|
|
1493
|
+
"target",
|
|
1494
|
+
"_build",
|
|
1495
|
+
".next",
|
|
1496
|
+
".nuxt",
|
|
1497
|
+
".output",
|
|
1498
|
+
".vercel",
|
|
1499
|
+
".netlify",
|
|
1500
|
+
// Cache
|
|
1501
|
+
".cache",
|
|
1502
|
+
".parcel-cache",
|
|
1503
|
+
".turbo",
|
|
1504
|
+
".nx",
|
|
1505
|
+
".gradle",
|
|
1506
|
+
// IDE
|
|
1507
|
+
".idea",
|
|
1508
|
+
".vscode",
|
|
1509
|
+
".vs",
|
|
1510
|
+
// Coverage
|
|
1511
|
+
"coverage",
|
|
1512
|
+
".coverage",
|
|
1513
|
+
"htmlcov",
|
|
1514
|
+
".nyc_output",
|
|
1515
|
+
// Temp
|
|
1516
|
+
"tmp",
|
|
1517
|
+
"temp",
|
|
1518
|
+
".tmp",
|
|
1519
|
+
".temp",
|
|
1520
|
+
// Lock files
|
|
1521
|
+
"package-lock.json",
|
|
1522
|
+
"yarn.lock",
|
|
1523
|
+
"pnpm-lock.yaml",
|
|
1524
|
+
"bun.lockb",
|
|
1525
|
+
"Cargo.lock",
|
|
1526
|
+
"Gemfile.lock",
|
|
1527
|
+
"poetry.lock"
|
|
1528
|
+
]);
|
|
1529
|
+
var SKIP_EXTENSIONS2 = /* @__PURE__ */ new Set([
|
|
1530
|
+
".min.js",
|
|
1531
|
+
".min.css",
|
|
1532
|
+
".bundle.js",
|
|
1533
|
+
".wasm",
|
|
1534
|
+
".so",
|
|
1535
|
+
".dll",
|
|
1536
|
+
".pyc",
|
|
1537
|
+
".map",
|
|
1538
|
+
".js.map"
|
|
1539
|
+
]);
|
|
1540
|
+
function shouldSkip2(name) {
|
|
1541
|
+
if (SKIP_NAMES2.has(name)) return true;
|
|
1542
|
+
if (name.startsWith(".")) return true;
|
|
1543
|
+
for (const ext of SKIP_EXTENSIONS2) {
|
|
1544
|
+
if (name.endsWith(ext)) return true;
|
|
1545
|
+
}
|
|
1546
|
+
return false;
|
|
1547
|
+
}
|
|
1794
1548
|
var RemoteCommandsProvider = class {
|
|
1795
1549
|
constructor(repoRoot, commands) {
|
|
1796
1550
|
this.repoRoot = repoRoot;
|
|
1797
1551
|
this.commands = commands;
|
|
1798
1552
|
}
|
|
1799
|
-
ignoreFilter = null;
|
|
1800
|
-
/**
|
|
1801
|
-
* Build an ignore filter from DEFAULT_EXCLUDES.
|
|
1802
|
-
* Note: For remote providers, we can't read .gitignore from the remote sandbox,
|
|
1803
|
-
* so we only use the built-in excludes.
|
|
1804
|
-
*/
|
|
1805
|
-
getIgnoreFilter() {
|
|
1806
|
-
if (this.ignoreFilter) return this.ignoreFilter;
|
|
1807
|
-
const ig = ignore2();
|
|
1808
|
-
ig.add(DEFAULT_EXCLUDES);
|
|
1809
|
-
this.ignoreFilter = ig;
|
|
1810
|
-
return ig;
|
|
1811
|
-
}
|
|
1812
1553
|
/**
|
|
1813
1554
|
* Run grep command and parse ripgrep output
|
|
1814
1555
|
*/
|
|
@@ -1862,7 +1603,6 @@ var RemoteCommandsProvider = class {
|
|
|
1862
1603
|
async listDirectory(params) {
|
|
1863
1604
|
const maxDepth = params.maxDepth ?? AGENT_CONFIG.MAX_LIST_DEPTH;
|
|
1864
1605
|
const maxResults = params.maxResults ?? AGENT_CONFIG.MAX_OUTPUT_LINES;
|
|
1865
|
-
const ig = this.getIgnoreFilter();
|
|
1866
1606
|
try {
|
|
1867
1607
|
const stdout = await this.commands.listDir(params.path, maxDepth);
|
|
1868
1608
|
const paths = (stdout || "").trim().split(/\r?\n/).filter((p) => p.length > 0);
|
|
@@ -1871,12 +1611,12 @@ var RemoteCommandsProvider = class {
|
|
|
1871
1611
|
for (const fullPath of paths) {
|
|
1872
1612
|
if (fullPath === params.path || fullPath === this.repoRoot) continue;
|
|
1873
1613
|
const name = fullPath.split("/").pop() || "";
|
|
1614
|
+
if (shouldSkip2(name)) continue;
|
|
1615
|
+
if (regex && !regex.test(name)) continue;
|
|
1874
1616
|
let relativePath = fullPath;
|
|
1875
1617
|
if (fullPath.startsWith(this.repoRoot)) {
|
|
1876
1618
|
relativePath = fullPath.slice(this.repoRoot.length).replace(/^\//, "");
|
|
1877
1619
|
}
|
|
1878
|
-
if (ig.ignores(relativePath)) continue;
|
|
1879
|
-
if (regex && !regex.test(name)) continue;
|
|
1880
1620
|
const depth = relativePath.split("/").filter(Boolean).length - 1;
|
|
1881
1621
|
const hasExtension = name.includes(".") && !name.startsWith(".");
|
|
1882
1622
|
const type = hasExtension ? "file" : "dir";
|