@probelabs/probe 0.6.0-rc147 → 0.6.0-rc149
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/bin/probe +12 -3
- package/build/agent/ProbeAgent.js +1 -3
- package/build/agent/index.js +58 -477
- package/build/extract.js +1 -1
- package/build/index.js +1 -7
- package/build/mcp/index.js +3 -3
- package/build/mcp/index.ts +3 -3
- package/build/tools/common.js +58 -49
- package/cjs/agent/ProbeAgent.cjs +699 -770
- package/cjs/index.cjs +650 -1347
- package/package.json +1 -12
- package/src/agent/ProbeAgent.js +1 -3
- package/src/extract.js +1 -1
- package/src/index.js +1 -7
- package/src/mcp/index.ts +3 -3
- package/src/tools/common.js +58 -49
- package/bin/binaries/probe-v0.6.0-rc147-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc147-aarch64-unknown-linux-gnu.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc147-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc147-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc147-x86_64-unknown-linux-gnu.tar.gz +0 -0
- package/build/agent/appTracer.js +0 -360
- package/build/agent/fileSpanExporter.js +0 -167
- package/build/agent/telemetry.js +0 -219
- package/cjs/agent/telemetry.cjs +0 -358
- package/src/agent/appTracer.js +0 -360
- package/src/agent/fileSpanExporter.js +0 -167
- package/src/agent/telemetry.js +0 -219
package/build/agent/index.js
CHANGED
|
@@ -38,364 +38,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
38
38
|
mod
|
|
39
39
|
));
|
|
40
40
|
|
|
41
|
-
// node_modules/dotenv/package.json
|
|
42
|
-
var require_package = __commonJS({
|
|
43
|
-
"node_modules/dotenv/package.json"(exports2, module2) {
|
|
44
|
-
module2.exports = {
|
|
45
|
-
name: "dotenv",
|
|
46
|
-
version: "16.6.1",
|
|
47
|
-
description: "Loads environment variables from .env file",
|
|
48
|
-
main: "lib/main.js",
|
|
49
|
-
types: "lib/main.d.ts",
|
|
50
|
-
exports: {
|
|
51
|
-
".": {
|
|
52
|
-
types: "./lib/main.d.ts",
|
|
53
|
-
require: "./lib/main.js",
|
|
54
|
-
default: "./lib/main.js"
|
|
55
|
-
},
|
|
56
|
-
"./config": "./config.js",
|
|
57
|
-
"./config.js": "./config.js",
|
|
58
|
-
"./lib/env-options": "./lib/env-options.js",
|
|
59
|
-
"./lib/env-options.js": "./lib/env-options.js",
|
|
60
|
-
"./lib/cli-options": "./lib/cli-options.js",
|
|
61
|
-
"./lib/cli-options.js": "./lib/cli-options.js",
|
|
62
|
-
"./package.json": "./package.json"
|
|
63
|
-
},
|
|
64
|
-
scripts: {
|
|
65
|
-
"dts-check": "tsc --project tests/types/tsconfig.json",
|
|
66
|
-
lint: "standard",
|
|
67
|
-
pretest: "npm run lint && npm run dts-check",
|
|
68
|
-
test: "tap run --allow-empty-coverage --disable-coverage --timeout=60000",
|
|
69
|
-
"test:coverage": "tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",
|
|
70
|
-
prerelease: "npm test",
|
|
71
|
-
release: "standard-version"
|
|
72
|
-
},
|
|
73
|
-
repository: {
|
|
74
|
-
type: "git",
|
|
75
|
-
url: "git://github.com/motdotla/dotenv.git"
|
|
76
|
-
},
|
|
77
|
-
homepage: "https://github.com/motdotla/dotenv#readme",
|
|
78
|
-
funding: "https://dotenvx.com",
|
|
79
|
-
keywords: [
|
|
80
|
-
"dotenv",
|
|
81
|
-
"env",
|
|
82
|
-
".env",
|
|
83
|
-
"environment",
|
|
84
|
-
"variables",
|
|
85
|
-
"config",
|
|
86
|
-
"settings"
|
|
87
|
-
],
|
|
88
|
-
readmeFilename: "README.md",
|
|
89
|
-
license: "BSD-2-Clause",
|
|
90
|
-
devDependencies: {
|
|
91
|
-
"@types/node": "^18.11.3",
|
|
92
|
-
decache: "^4.6.2",
|
|
93
|
-
sinon: "^14.0.1",
|
|
94
|
-
standard: "^17.0.0",
|
|
95
|
-
"standard-version": "^9.5.0",
|
|
96
|
-
tap: "^19.2.0",
|
|
97
|
-
typescript: "^4.8.4"
|
|
98
|
-
},
|
|
99
|
-
engines: {
|
|
100
|
-
node: ">=12"
|
|
101
|
-
},
|
|
102
|
-
browser: {
|
|
103
|
-
fs: false
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
// node_modules/dotenv/lib/main.js
|
|
110
|
-
var require_main = __commonJS({
|
|
111
|
-
"node_modules/dotenv/lib/main.js"(exports2, module2) {
|
|
112
|
-
var fs6 = __require("fs");
|
|
113
|
-
var path7 = __require("path");
|
|
114
|
-
var os3 = __require("os");
|
|
115
|
-
var crypto = __require("crypto");
|
|
116
|
-
var packageJson = require_package();
|
|
117
|
-
var version = packageJson.version;
|
|
118
|
-
var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
119
|
-
function parse6(src) {
|
|
120
|
-
const obj = {};
|
|
121
|
-
let lines = src.toString();
|
|
122
|
-
lines = lines.replace(/\r\n?/mg, "\n");
|
|
123
|
-
let match2;
|
|
124
|
-
while ((match2 = LINE.exec(lines)) != null) {
|
|
125
|
-
const key = match2[1];
|
|
126
|
-
let value = match2[2] || "";
|
|
127
|
-
value = value.trim();
|
|
128
|
-
const maybeQuote = value[0];
|
|
129
|
-
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
|
|
130
|
-
if (maybeQuote === '"') {
|
|
131
|
-
value = value.replace(/\\n/g, "\n");
|
|
132
|
-
value = value.replace(/\\r/g, "\r");
|
|
133
|
-
}
|
|
134
|
-
obj[key] = value;
|
|
135
|
-
}
|
|
136
|
-
return obj;
|
|
137
|
-
}
|
|
138
|
-
function _parseVault(options) {
|
|
139
|
-
options = options || {};
|
|
140
|
-
const vaultPath = _vaultPath(options);
|
|
141
|
-
options.path = vaultPath;
|
|
142
|
-
const result = DotenvModule.configDotenv(options);
|
|
143
|
-
if (!result.parsed) {
|
|
144
|
-
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
145
|
-
err.code = "MISSING_DATA";
|
|
146
|
-
throw err;
|
|
147
|
-
}
|
|
148
|
-
const keys2 = _dotenvKey(options).split(",");
|
|
149
|
-
const length = keys2.length;
|
|
150
|
-
let decrypted;
|
|
151
|
-
for (let i = 0; i < length; i++) {
|
|
152
|
-
try {
|
|
153
|
-
const key = keys2[i].trim();
|
|
154
|
-
const attrs = _instructions(result, key);
|
|
155
|
-
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
156
|
-
break;
|
|
157
|
-
} catch (error) {
|
|
158
|
-
if (i + 1 >= length) {
|
|
159
|
-
throw error;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return DotenvModule.parse(decrypted);
|
|
164
|
-
}
|
|
165
|
-
function _warn(message) {
|
|
166
|
-
console.log(`[dotenv@${version}][WARN] ${message}`);
|
|
167
|
-
}
|
|
168
|
-
function _debug(message) {
|
|
169
|
-
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
170
|
-
}
|
|
171
|
-
function _log(message) {
|
|
172
|
-
console.log(`[dotenv@${version}] ${message}`);
|
|
173
|
-
}
|
|
174
|
-
function _dotenvKey(options) {
|
|
175
|
-
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
176
|
-
return options.DOTENV_KEY;
|
|
177
|
-
}
|
|
178
|
-
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
|
|
179
|
-
return process.env.DOTENV_KEY;
|
|
180
|
-
}
|
|
181
|
-
return "";
|
|
182
|
-
}
|
|
183
|
-
function _instructions(result, dotenvKey) {
|
|
184
|
-
let uri;
|
|
185
|
-
try {
|
|
186
|
-
uri = new URL(dotenvKey);
|
|
187
|
-
} catch (error) {
|
|
188
|
-
if (error.code === "ERR_INVALID_URL") {
|
|
189
|
-
const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
|
|
190
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
191
|
-
throw err;
|
|
192
|
-
}
|
|
193
|
-
throw error;
|
|
194
|
-
}
|
|
195
|
-
const key = uri.password;
|
|
196
|
-
if (!key) {
|
|
197
|
-
const err = new Error("INVALID_DOTENV_KEY: Missing key part");
|
|
198
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
199
|
-
throw err;
|
|
200
|
-
}
|
|
201
|
-
const environment = uri.searchParams.get("environment");
|
|
202
|
-
if (!environment) {
|
|
203
|
-
const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
|
|
204
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
205
|
-
throw err;
|
|
206
|
-
}
|
|
207
|
-
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
208
|
-
const ciphertext = result.parsed[environmentKey];
|
|
209
|
-
if (!ciphertext) {
|
|
210
|
-
const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
|
|
211
|
-
err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
|
|
212
|
-
throw err;
|
|
213
|
-
}
|
|
214
|
-
return { ciphertext, key };
|
|
215
|
-
}
|
|
216
|
-
function _vaultPath(options) {
|
|
217
|
-
let possibleVaultPath = null;
|
|
218
|
-
if (options && options.path && options.path.length > 0) {
|
|
219
|
-
if (Array.isArray(options.path)) {
|
|
220
|
-
for (const filepath of options.path) {
|
|
221
|
-
if (fs6.existsSync(filepath)) {
|
|
222
|
-
possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
} else {
|
|
226
|
-
possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
|
|
227
|
-
}
|
|
228
|
-
} else {
|
|
229
|
-
possibleVaultPath = path7.resolve(process.cwd(), ".env.vault");
|
|
230
|
-
}
|
|
231
|
-
if (fs6.existsSync(possibleVaultPath)) {
|
|
232
|
-
return possibleVaultPath;
|
|
233
|
-
}
|
|
234
|
-
return null;
|
|
235
|
-
}
|
|
236
|
-
function _resolveHome(envPath) {
|
|
237
|
-
return envPath[0] === "~" ? path7.join(os3.homedir(), envPath.slice(1)) : envPath;
|
|
238
|
-
}
|
|
239
|
-
function _configVault(options) {
|
|
240
|
-
const debug = Boolean(options && options.debug);
|
|
241
|
-
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
242
|
-
if (debug || !quiet) {
|
|
243
|
-
_log("Loading env from encrypted .env.vault");
|
|
244
|
-
}
|
|
245
|
-
const parsed = DotenvModule._parseVault(options);
|
|
246
|
-
let processEnv = process.env;
|
|
247
|
-
if (options && options.processEnv != null) {
|
|
248
|
-
processEnv = options.processEnv;
|
|
249
|
-
}
|
|
250
|
-
DotenvModule.populate(processEnv, parsed, options);
|
|
251
|
-
return { parsed };
|
|
252
|
-
}
|
|
253
|
-
function configDotenv(options) {
|
|
254
|
-
const dotenvPath = path7.resolve(process.cwd(), ".env");
|
|
255
|
-
let encoding = "utf8";
|
|
256
|
-
const debug = Boolean(options && options.debug);
|
|
257
|
-
const quiet = options && "quiet" in options ? options.quiet : true;
|
|
258
|
-
if (options && options.encoding) {
|
|
259
|
-
encoding = options.encoding;
|
|
260
|
-
} else {
|
|
261
|
-
if (debug) {
|
|
262
|
-
_debug("No encoding is specified. UTF-8 is used by default");
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
let optionPaths = [dotenvPath];
|
|
266
|
-
if (options && options.path) {
|
|
267
|
-
if (!Array.isArray(options.path)) {
|
|
268
|
-
optionPaths = [_resolveHome(options.path)];
|
|
269
|
-
} else {
|
|
270
|
-
optionPaths = [];
|
|
271
|
-
for (const filepath of options.path) {
|
|
272
|
-
optionPaths.push(_resolveHome(filepath));
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
let lastError;
|
|
277
|
-
const parsedAll = {};
|
|
278
|
-
for (const path8 of optionPaths) {
|
|
279
|
-
try {
|
|
280
|
-
const parsed = DotenvModule.parse(fs6.readFileSync(path8, { encoding }));
|
|
281
|
-
DotenvModule.populate(parsedAll, parsed, options);
|
|
282
|
-
} catch (e) {
|
|
283
|
-
if (debug) {
|
|
284
|
-
_debug(`Failed to load ${path8} ${e.message}`);
|
|
285
|
-
}
|
|
286
|
-
lastError = e;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
let processEnv = process.env;
|
|
290
|
-
if (options && options.processEnv != null) {
|
|
291
|
-
processEnv = options.processEnv;
|
|
292
|
-
}
|
|
293
|
-
DotenvModule.populate(processEnv, parsedAll, options);
|
|
294
|
-
if (debug || !quiet) {
|
|
295
|
-
const keysCount = Object.keys(parsedAll).length;
|
|
296
|
-
const shortPaths = [];
|
|
297
|
-
for (const filePath of optionPaths) {
|
|
298
|
-
try {
|
|
299
|
-
const relative = path7.relative(process.cwd(), filePath);
|
|
300
|
-
shortPaths.push(relative);
|
|
301
|
-
} catch (e) {
|
|
302
|
-
if (debug) {
|
|
303
|
-
_debug(`Failed to load ${filePath} ${e.message}`);
|
|
304
|
-
}
|
|
305
|
-
lastError = e;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
_log(`injecting env (${keysCount}) from ${shortPaths.join(",")}`);
|
|
309
|
-
}
|
|
310
|
-
if (lastError) {
|
|
311
|
-
return { parsed: parsedAll, error: lastError };
|
|
312
|
-
} else {
|
|
313
|
-
return { parsed: parsedAll };
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
function config(options) {
|
|
317
|
-
if (_dotenvKey(options).length === 0) {
|
|
318
|
-
return DotenvModule.configDotenv(options);
|
|
319
|
-
}
|
|
320
|
-
const vaultPath = _vaultPath(options);
|
|
321
|
-
if (!vaultPath) {
|
|
322
|
-
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
323
|
-
return DotenvModule.configDotenv(options);
|
|
324
|
-
}
|
|
325
|
-
return DotenvModule._configVault(options);
|
|
326
|
-
}
|
|
327
|
-
function decrypt(encrypted, keyStr) {
|
|
328
|
-
const key = Buffer.from(keyStr.slice(-64), "hex");
|
|
329
|
-
let ciphertext = Buffer.from(encrypted, "base64");
|
|
330
|
-
const nonce = ciphertext.subarray(0, 12);
|
|
331
|
-
const authTag = ciphertext.subarray(-16);
|
|
332
|
-
ciphertext = ciphertext.subarray(12, -16);
|
|
333
|
-
try {
|
|
334
|
-
const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
|
|
335
|
-
aesgcm.setAuthTag(authTag);
|
|
336
|
-
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
|
|
337
|
-
} catch (error) {
|
|
338
|
-
const isRange = error instanceof RangeError;
|
|
339
|
-
const invalidKeyLength = error.message === "Invalid key length";
|
|
340
|
-
const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
|
|
341
|
-
if (isRange || invalidKeyLength) {
|
|
342
|
-
const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
|
|
343
|
-
err.code = "INVALID_DOTENV_KEY";
|
|
344
|
-
throw err;
|
|
345
|
-
} else if (decryptionFailed) {
|
|
346
|
-
const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
|
|
347
|
-
err.code = "DECRYPTION_FAILED";
|
|
348
|
-
throw err;
|
|
349
|
-
} else {
|
|
350
|
-
throw error;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
function populate(processEnv, parsed, options = {}) {
|
|
355
|
-
const debug = Boolean(options && options.debug);
|
|
356
|
-
const override = Boolean(options && options.override);
|
|
357
|
-
if (typeof parsed !== "object") {
|
|
358
|
-
const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
|
|
359
|
-
err.code = "OBJECT_REQUIRED";
|
|
360
|
-
throw err;
|
|
361
|
-
}
|
|
362
|
-
for (const key of Object.keys(parsed)) {
|
|
363
|
-
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
364
|
-
if (override === true) {
|
|
365
|
-
processEnv[key] = parsed[key];
|
|
366
|
-
}
|
|
367
|
-
if (debug) {
|
|
368
|
-
if (override === true) {
|
|
369
|
-
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
370
|
-
} else {
|
|
371
|
-
_debug(`"${key}" is already defined and was NOT overwritten`);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
} else {
|
|
375
|
-
processEnv[key] = parsed[key];
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
var DotenvModule = {
|
|
380
|
-
configDotenv,
|
|
381
|
-
_configVault,
|
|
382
|
-
_parseVault,
|
|
383
|
-
config,
|
|
384
|
-
decrypt,
|
|
385
|
-
parse: parse6,
|
|
386
|
-
populate
|
|
387
|
-
};
|
|
388
|
-
module2.exports.configDotenv = DotenvModule.configDotenv;
|
|
389
|
-
module2.exports._configVault = DotenvModule._configVault;
|
|
390
|
-
module2.exports._parseVault = DotenvModule._parseVault;
|
|
391
|
-
module2.exports.config = DotenvModule.config;
|
|
392
|
-
module2.exports.decrypt = DotenvModule.decrypt;
|
|
393
|
-
module2.exports.parse = DotenvModule.parse;
|
|
394
|
-
module2.exports.populate = DotenvModule.populate;
|
|
395
|
-
module2.exports = DotenvModule;
|
|
396
|
-
}
|
|
397
|
-
});
|
|
398
|
-
|
|
399
41
|
// node_modules/gpt-tokenizer/esm/bpeRanks/o200k_base.js
|
|
400
42
|
var c0, c1, bpe, o200k_base_default;
|
|
401
43
|
var init_o200k_base = __esm({
|
|
@@ -3246,7 +2888,7 @@ async function extract(options) {
|
|
|
3246
2888
|
const hasInputFile = !!options.inputFile;
|
|
3247
2889
|
const hasContent = options.content !== void 0 && options.content !== null;
|
|
3248
2890
|
if (!hasFiles && !hasInputFile && !hasContent) {
|
|
3249
|
-
throw new Error("
|
|
2891
|
+
throw new Error('Extract requires one of: "files" (array of file paths), "inputFile" (path to input file), or "content" (string/buffer for stdin)');
|
|
3250
2892
|
}
|
|
3251
2893
|
const binaryPath = await getBinaryPath(options.binaryOptions || {});
|
|
3252
2894
|
const filteredOptions = { ...options };
|
|
@@ -7511,6 +7153,27 @@ var init_zod = __esm({
|
|
|
7511
7153
|
});
|
|
7512
7154
|
|
|
7513
7155
|
// src/tools/common.js
|
|
7156
|
+
function getValidParamsForTool(toolName) {
|
|
7157
|
+
const schemaMap = {
|
|
7158
|
+
search: searchSchema,
|
|
7159
|
+
query: querySchema,
|
|
7160
|
+
extract: extractSchema,
|
|
7161
|
+
delegate: delegateSchema,
|
|
7162
|
+
bash: bashSchema,
|
|
7163
|
+
attempt_completion: attemptCompletionSchema
|
|
7164
|
+
};
|
|
7165
|
+
const schema = schemaMap[toolName];
|
|
7166
|
+
if (!schema) {
|
|
7167
|
+
return ["path", "directory", "pattern", "recursive", "includeHidden", "task", "files", "autoCommits", "result"];
|
|
7168
|
+
}
|
|
7169
|
+
if (toolName === "attempt_completion") {
|
|
7170
|
+
return ["result"];
|
|
7171
|
+
}
|
|
7172
|
+
if (schema && schema._def && schema._def.shape) {
|
|
7173
|
+
return Object.keys(schema._def.shape());
|
|
7174
|
+
}
|
|
7175
|
+
return [];
|
|
7176
|
+
}
|
|
7514
7177
|
function parseXmlToolCall(xmlString, validTools = DEFAULT_VALID_TOOLS) {
|
|
7515
7178
|
for (const toolName of validTools) {
|
|
7516
7179
|
const openTag = `<${toolName}>`;
|
|
@@ -7529,35 +7192,8 @@ function parseXmlToolCall(xmlString, validTools = DEFAULT_VALID_TOOLS) {
|
|
|
7529
7192
|
closeIndex
|
|
7530
7193
|
);
|
|
7531
7194
|
const params = {};
|
|
7532
|
-
const
|
|
7533
|
-
|
|
7534
|
-
"file_path",
|
|
7535
|
-
"line",
|
|
7536
|
-
"end_line",
|
|
7537
|
-
"path",
|
|
7538
|
-
"recursive",
|
|
7539
|
-
"includeHidden",
|
|
7540
|
-
"max_results",
|
|
7541
|
-
"maxResults",
|
|
7542
|
-
"result",
|
|
7543
|
-
"command",
|
|
7544
|
-
"description",
|
|
7545
|
-
"task",
|
|
7546
|
-
"param",
|
|
7547
|
-
"pattern",
|
|
7548
|
-
"allow_tests",
|
|
7549
|
-
"exact",
|
|
7550
|
-
"maxTokens",
|
|
7551
|
-
"language",
|
|
7552
|
-
"input_content",
|
|
7553
|
-
"context_lines",
|
|
7554
|
-
"format",
|
|
7555
|
-
"directory",
|
|
7556
|
-
"autoCommits",
|
|
7557
|
-
"files",
|
|
7558
|
-
"targets"
|
|
7559
|
-
];
|
|
7560
|
-
for (const paramName of commonParams) {
|
|
7195
|
+
const validParams = getValidParamsForTool(toolName);
|
|
7196
|
+
for (const paramName of validParams) {
|
|
7561
7197
|
const paramOpenTag = `<${paramName}>`;
|
|
7562
7198
|
const paramCloseTag = `</${paramName}>`;
|
|
7563
7199
|
const paramOpenIndex = innerContent.indexOf(paramOpenTag);
|
|
@@ -7567,7 +7203,7 @@ function parseXmlToolCall(xmlString, validTools = DEFAULT_VALID_TOOLS) {
|
|
|
7567
7203
|
let paramCloseIndex = innerContent.indexOf(paramCloseTag, paramOpenIndex + paramOpenTag.length);
|
|
7568
7204
|
if (paramCloseIndex === -1) {
|
|
7569
7205
|
let nextTagIndex = innerContent.length;
|
|
7570
|
-
for (const nextParam of
|
|
7206
|
+
for (const nextParam of validParams) {
|
|
7571
7207
|
const nextOpenTag = `<${nextParam}>`;
|
|
7572
7208
|
const nextIndex = innerContent.indexOf(nextOpenTag, paramOpenIndex + paramOpenTag.length);
|
|
7573
7209
|
if (nextIndex !== -1 && nextIndex < nextTagIndex) {
|
|
@@ -7629,13 +7265,8 @@ var init_common = __esm({
|
|
|
7629
7265
|
"use strict";
|
|
7630
7266
|
init_zod();
|
|
7631
7267
|
searchSchema = external_exports.object({
|
|
7632
|
-
query: external_exports.string().describe("Search query with Elasticsearch syntax. Use
|
|
7633
|
-
path: external_exports.string().optional().default(".").describe('Path to search in. For dependencies use "go:github.com/owner/repo", "js:package_name", or "rust:cargo_name" etc.')
|
|
7634
|
-
allow_tests: external_exports.boolean().optional().default(false).describe("Allow test files in search results"),
|
|
7635
|
-
exact: external_exports.boolean().optional().default(false).describe("Perform exact search without tokenization (case-insensitive)"),
|
|
7636
|
-
maxResults: external_exports.number().optional().describe("Maximum number of results to return"),
|
|
7637
|
-
maxTokens: external_exports.number().optional().default(1e4).describe("Maximum number of tokens to return"),
|
|
7638
|
-
language: external_exports.string().optional().describe("Limit search to files of a specific programming language")
|
|
7268
|
+
query: external_exports.string().describe("Search query with Elasticsearch syntax. Use quotes for exact matches, AND/OR for boolean logic, - for negation."),
|
|
7269
|
+
path: external_exports.string().optional().default(".").describe('Path to search in. For dependencies use "go:github.com/owner/repo", "js:package_name", or "rust:cargo_name" etc.')
|
|
7639
7270
|
});
|
|
7640
7271
|
querySchema = external_exports.object({
|
|
7641
7272
|
pattern: external_exports.string().describe("AST pattern to search for. Use $NAME for variable names, $$$PARAMS for parameter lists, etc."),
|
|
@@ -7644,13 +7275,8 @@ var init_common = __esm({
|
|
|
7644
7275
|
allow_tests: external_exports.boolean().optional().default(false).describe("Allow test files in search results")
|
|
7645
7276
|
});
|
|
7646
7277
|
extractSchema = external_exports.object({
|
|
7647
|
-
targets: external_exports.string().optional().describe(
|
|
7648
|
-
input_content: external_exports.string().optional().describe("Text content to extract file paths from")
|
|
7649
|
-
line: external_exports.number().optional().describe("Start line number to extract a specific code block"),
|
|
7650
|
-
end_line: external_exports.number().optional().describe("End line number for extracting a range of lines"),
|
|
7651
|
-
allow_tests: external_exports.boolean().optional().default(false).describe("Allow test files and test code blocks"),
|
|
7652
|
-
context_lines: external_exports.number().optional().default(10).describe("Number of context lines to include"),
|
|
7653
|
-
format: external_exports.string().optional().default("plain").describe("Output format (plain, markdown, json, xml, color, outline-xml, outline-diff)")
|
|
7278
|
+
targets: external_exports.string().optional().describe('File paths or symbols to extract from. Formats: "file.js" (whole file), "file.js:42" (line 42), "file.js:10-20" (lines 10-20), "file.js#funcName" (symbol). Multiple targets separated by spaces.'),
|
|
7279
|
+
input_content: external_exports.string().optional().describe("Text content to extract file paths from (alternative to targets)")
|
|
7654
7280
|
});
|
|
7655
7281
|
delegateSchema = external_exports.object({
|
|
7656
7282
|
task: external_exports.string().describe("The task to delegate to a subagent. Be specific about what needs to be accomplished.")
|
|
@@ -7725,13 +7351,8 @@ You need to focus on main keywords when constructing the query, and always use e
|
|
|
7725
7351
|
- Once data is returned, it's cached and won't return on next runs (this is expected behavior)
|
|
7726
7352
|
|
|
7727
7353
|
Parameters:
|
|
7728
|
-
- query: (required) Search query with Elasticsearch syntax.
|
|
7729
|
-
- path: (
|
|
7730
|
-
- allow_tests: (optional, default: false) Allow test files in search results (true/false).
|
|
7731
|
-
- exact: (optional, default: false) Perform exact pricise search. Use it when you already know function or struct name, or some other code block, and want exact match.
|
|
7732
|
-
- maxResults: (optional) Maximum number of results to return (number).
|
|
7733
|
-
- maxTokens: (optional, default: 10000) Maximum number of tokens to return (number).
|
|
7734
|
-
- language: (optional) Limit search to files of a specific programming language (e.g., 'rust', 'js', 'python', 'go' etc.).
|
|
7354
|
+
- query: (required) Search query with Elasticsearch syntax. Use quotes for exact matches ("functionName"), AND/OR for boolean logic, - for negation, + for important terms.
|
|
7355
|
+
- path: (optional, default: '.') Path to search in. All dependencies located in /dep folder, under language sub folders, like this: "/dep/go/github.com/owner/repo", "/dep/js/package_name", or "/dep/rust/cargo_name" etc.
|
|
7735
7356
|
|
|
7736
7357
|
**Workflow:** Always start with search, then use extract for detailed context when needed.
|
|
7737
7358
|
|
|
@@ -7753,30 +7374,24 @@ User: How to calculate the total amount in the payments module?
|
|
|
7753
7374
|
<search>
|
|
7754
7375
|
<query>calculate AND payment</query>
|
|
7755
7376
|
<path>src/utils</path>
|
|
7756
|
-
<allow_tests>false</allow_tests>
|
|
7757
7377
|
</search>
|
|
7758
7378
|
|
|
7759
7379
|
User: How do the user authentication and authorization work?
|
|
7760
7380
|
<search>
|
|
7761
|
-
<query>+user
|
|
7381
|
+
<query>+user AND (authentication OR authorization OR authz)</query>
|
|
7762
7382
|
<path>.</path>
|
|
7763
|
-
<allow_tests>true</allow_tests>
|
|
7764
|
-
<language>go</language>
|
|
7765
7383
|
</search>
|
|
7766
7384
|
|
|
7767
7385
|
User: Find all react imports in the project.
|
|
7768
7386
|
<search>
|
|
7769
|
-
<query>import
|
|
7387
|
+
<query>"import" AND "react"</query>
|
|
7770
7388
|
<path>.</path>
|
|
7771
|
-
<exact>true</exact>
|
|
7772
|
-
<language>js</language>
|
|
7773
7389
|
</search>
|
|
7774
7390
|
|
|
7775
|
-
User: Find how
|
|
7391
|
+
User: Find how decompound library works?
|
|
7776
7392
|
<search>
|
|
7777
|
-
<query>
|
|
7393
|
+
<query>decompound</query>
|
|
7778
7394
|
<path>/dep/rust/decompound</path>
|
|
7779
|
-
<language>rust</language>
|
|
7780
7395
|
</search>
|
|
7781
7396
|
|
|
7782
7397
|
</examples>
|
|
@@ -7811,11 +7426,9 @@ Full file extraction should be the LAST RESORT! Always prefer search.
|
|
|
7811
7426
|
**Session Awareness:** Reuse context from previous tool calls. Don't re-extract the same symbols you already have.
|
|
7812
7427
|
|
|
7813
7428
|
Parameters:
|
|
7814
|
-
- targets: (required) File paths or symbols to extract from.
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
- end_line: (optional) End line number for extracting a range of lines.
|
|
7818
|
-
- allow_tests: (optional, default: false) Allow test files and test code blocks (true/false).
|
|
7429
|
+
- targets: (required) File paths or symbols to extract from. Formats: "file.js" (whole file), "file.js:42" (code block at line 42), "file.js:10-20" (lines 10-20), "file.js#funcName" (specific symbol). Multiple targets separated by spaces.
|
|
7430
|
+
- input_content: (optional) Text content to extract file paths from (alternative to targets for processing diffs/logs).
|
|
7431
|
+
|
|
7819
7432
|
Usage Example:
|
|
7820
7433
|
|
|
7821
7434
|
<examples>
|
|
@@ -7842,9 +7455,7 @@ User: Lets read the whole file
|
|
|
7842
7455
|
|
|
7843
7456
|
User: Read the first 10 lines of the file
|
|
7844
7457
|
<extract>
|
|
7845
|
-
<targets>src/search/ranking.rs</targets>
|
|
7846
|
-
<line>1</line>
|
|
7847
|
-
<end_line>10</end_line>
|
|
7458
|
+
<targets>src/search/ranking.rs:1-10</targets>
|
|
7848
7459
|
</extract>
|
|
7849
7460
|
|
|
7850
7461
|
User: Read file inside the dependency
|
|
@@ -9993,31 +9604,6 @@ var init_simpleTelemetry = __esm({
|
|
|
9993
9604
|
}
|
|
9994
9605
|
});
|
|
9995
9606
|
|
|
9996
|
-
// src/agent/fileSpanExporter.js
|
|
9997
|
-
import { createWriteStream as createWriteStream2 } from "fs";
|
|
9998
|
-
var init_fileSpanExporter = __esm({
|
|
9999
|
-
"src/agent/fileSpanExporter.js"() {
|
|
10000
|
-
"use strict";
|
|
10001
|
-
}
|
|
10002
|
-
});
|
|
10003
|
-
|
|
10004
|
-
// src/agent/telemetry.js
|
|
10005
|
-
import { existsSync as existsSync3, mkdirSync as mkdirSync2 } from "fs";
|
|
10006
|
-
import { dirname as dirname2 } from "path";
|
|
10007
|
-
var init_telemetry = __esm({
|
|
10008
|
-
"src/agent/telemetry.js"() {
|
|
10009
|
-
"use strict";
|
|
10010
|
-
init_fileSpanExporter();
|
|
10011
|
-
}
|
|
10012
|
-
});
|
|
10013
|
-
|
|
10014
|
-
// src/agent/appTracer.js
|
|
10015
|
-
var init_appTracer = __esm({
|
|
10016
|
-
"src/agent/appTracer.js"() {
|
|
10017
|
-
"use strict";
|
|
10018
|
-
}
|
|
10019
|
-
});
|
|
10020
|
-
|
|
10021
9607
|
// node_modules/balanced-match/index.js
|
|
10022
9608
|
var require_balanced_match = __commonJS({
|
|
10023
9609
|
"node_modules/balanced-match/index.js"(exports2, module2) {
|
|
@@ -16999,11 +16585,10 @@ var init_hooks = __esm({
|
|
|
16999
16585
|
});
|
|
17000
16586
|
|
|
17001
16587
|
// src/index.js
|
|
17002
|
-
|
|
16588
|
+
import dotenv from "dotenv";
|
|
17003
16589
|
var init_index = __esm({
|
|
17004
16590
|
"src/index.js"() {
|
|
17005
16591
|
"use strict";
|
|
17006
|
-
import_dotenv = __toESM(require_main(), 1);
|
|
17007
16592
|
init_search();
|
|
17008
16593
|
init_query();
|
|
17009
16594
|
init_extract();
|
|
@@ -17018,12 +16603,10 @@ var init_index = __esm({
|
|
|
17018
16603
|
init_bash();
|
|
17019
16604
|
init_ProbeAgent();
|
|
17020
16605
|
init_simpleTelemetry();
|
|
17021
|
-
init_telemetry();
|
|
17022
|
-
init_appTracer();
|
|
17023
16606
|
init_probeTool();
|
|
17024
16607
|
init_storage();
|
|
17025
16608
|
init_hooks();
|
|
17026
|
-
|
|
16609
|
+
dotenv.config();
|
|
17027
16610
|
}
|
|
17028
16611
|
});
|
|
17029
16612
|
|
|
@@ -48351,15 +47934,15 @@ Provide only the corrected Mermaid diagram within a mermaid code block. Do not a
|
|
|
48351
47934
|
});
|
|
48352
47935
|
|
|
48353
47936
|
// src/agent/mcp/config.js
|
|
48354
|
-
import { readFileSync, existsSync as
|
|
48355
|
-
import { join as join2, dirname as
|
|
47937
|
+
import { readFileSync, existsSync as existsSync3, mkdirSync as mkdirSync2, writeFileSync } from "fs";
|
|
47938
|
+
import { join as join2, dirname as dirname2 } from "path";
|
|
48356
47939
|
import { homedir } from "os";
|
|
48357
47940
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
48358
47941
|
function loadMCPConfigurationFromPath(configPath) {
|
|
48359
47942
|
if (!configPath) {
|
|
48360
47943
|
throw new Error("Config path is required");
|
|
48361
47944
|
}
|
|
48362
|
-
if (!
|
|
47945
|
+
if (!existsSync3(configPath)) {
|
|
48363
47946
|
throw new Error(`MCP configuration file not found: ${configPath}`);
|
|
48364
47947
|
}
|
|
48365
47948
|
try {
|
|
@@ -48388,7 +47971,7 @@ function loadMCPConfiguration() {
|
|
|
48388
47971
|
].filter(Boolean);
|
|
48389
47972
|
let config = null;
|
|
48390
47973
|
for (const configPath of configPaths) {
|
|
48391
|
-
if (
|
|
47974
|
+
if (existsSync3(configPath)) {
|
|
48392
47975
|
try {
|
|
48393
47976
|
const content = readFileSync(configPath, "utf8");
|
|
48394
47977
|
config = JSON.parse(content);
|
|
@@ -48491,7 +48074,7 @@ var init_config = __esm({
|
|
|
48491
48074
|
"src/agent/mcp/config.js"() {
|
|
48492
48075
|
"use strict";
|
|
48493
48076
|
__filename4 = fileURLToPath6(import.meta.url);
|
|
48494
|
-
__dirname4 =
|
|
48077
|
+
__dirname4 = dirname2(__filename4);
|
|
48495
48078
|
DEFAULT_CONFIG = {
|
|
48496
48079
|
mcpServers: {
|
|
48497
48080
|
// Example probe server configuration
|
|
@@ -49113,6 +48696,7 @@ var ProbeAgent_exports = {};
|
|
|
49113
48696
|
__export(ProbeAgent_exports, {
|
|
49114
48697
|
ProbeAgent: () => ProbeAgent
|
|
49115
48698
|
});
|
|
48699
|
+
import dotenv2 from "dotenv";
|
|
49116
48700
|
import { createAnthropic } from "@ai-sdk/anthropic";
|
|
49117
48701
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
49118
48702
|
import { createGoogleGenerativeAI } from "@ai-sdk/google";
|
|
@@ -49120,14 +48704,13 @@ import { createAmazonBedrock } from "@ai-sdk/amazon-bedrock";
|
|
|
49120
48704
|
import { streamText } from "ai";
|
|
49121
48705
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
49122
48706
|
import { EventEmitter as EventEmitter3 } from "events";
|
|
49123
|
-
import { existsSync as
|
|
48707
|
+
import { existsSync as existsSync4 } from "fs";
|
|
49124
48708
|
import { readFile, stat } from "fs/promises";
|
|
49125
|
-
import { resolve as resolve3, isAbsolute, dirname as
|
|
49126
|
-
var
|
|
48709
|
+
import { resolve as resolve3, isAbsolute, dirname as dirname3 } from "path";
|
|
48710
|
+
var MAX_TOOL_ITERATIONS, MAX_HISTORY_MESSAGES, SUPPORTED_IMAGE_EXTENSIONS, MAX_IMAGE_FILE_SIZE, ProbeAgent;
|
|
49127
48711
|
var init_ProbeAgent = __esm({
|
|
49128
48712
|
"src/agent/ProbeAgent.js"() {
|
|
49129
48713
|
"use strict";
|
|
49130
|
-
import_dotenv2 = __toESM(require_main(), 1);
|
|
49131
48714
|
init_tokenCounter();
|
|
49132
48715
|
init_InMemoryStorageAdapter();
|
|
49133
48716
|
init_HookManager();
|
|
@@ -49139,7 +48722,7 @@ var init_ProbeAgent = __esm({
|
|
|
49139
48722
|
init_schemaUtils();
|
|
49140
48723
|
init_xmlParsingUtils();
|
|
49141
48724
|
init_mcp();
|
|
49142
|
-
|
|
48725
|
+
dotenv2.config();
|
|
49143
48726
|
MAX_TOOL_ITERATIONS = parseInt(process.env.MAX_TOOL_ITERATIONS || "30", 10);
|
|
49144
48727
|
MAX_HISTORY_MESSAGES = 100;
|
|
49145
48728
|
SUPPORTED_IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp", "gif", "bmp", "svg"];
|
|
@@ -49509,7 +49092,7 @@ var init_ProbeAgent = __esm({
|
|
|
49509
49092
|
let match2;
|
|
49510
49093
|
while ((match2 = fileHeaderPattern.exec(content)) !== null) {
|
|
49511
49094
|
const filePath = match2[1].trim();
|
|
49512
|
-
const dir =
|
|
49095
|
+
const dir = dirname3(filePath);
|
|
49513
49096
|
if (dir && dir !== ".") {
|
|
49514
49097
|
directories.push(dir);
|
|
49515
49098
|
if (this.debug) {
|
|
@@ -49798,9 +49381,7 @@ Examples:
|
|
|
49798
49381
|
</search>
|
|
49799
49382
|
|
|
49800
49383
|
<extract>
|
|
49801
|
-
<
|
|
49802
|
-
<start_line>15</start_line>
|
|
49803
|
-
<end_line>25</end_line>
|
|
49384
|
+
<targets>src/config.js:15-25</targets>
|
|
49804
49385
|
</extract>
|
|
49805
49386
|
|
|
49806
49387
|
<attempt_completion>
|
|
@@ -51045,10 +50626,10 @@ Convert your previous response content into actual JSON data that follows this s
|
|
|
51045
50626
|
});
|
|
51046
50627
|
|
|
51047
50628
|
// src/agent/index.js
|
|
51048
|
-
var import_dotenv3 = __toESM(require_main(), 1);
|
|
51049
50629
|
init_ProbeAgent();
|
|
51050
50630
|
init_simpleTelemetry();
|
|
51051
50631
|
init_schemaUtils();
|
|
50632
|
+
import dotenv3 from "dotenv";
|
|
51052
50633
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
51053
50634
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
51054
50635
|
import {
|
|
@@ -51058,7 +50639,7 @@ import {
|
|
|
51058
50639
|
ListToolsRequestSchema,
|
|
51059
50640
|
McpError
|
|
51060
50641
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
51061
|
-
import { readFileSync as readFileSync2, existsSync as
|
|
50642
|
+
import { readFileSync as readFileSync2, existsSync as existsSync5 } from "fs";
|
|
51062
50643
|
import { resolve as resolve4 } from "path";
|
|
51063
50644
|
|
|
51064
50645
|
// src/agent/acp/server.js
|
|
@@ -51728,12 +51309,12 @@ var ACPServer = class {
|
|
|
51728
51309
|
import { randomUUID as randomUUID6 } from "crypto";
|
|
51729
51310
|
|
|
51730
51311
|
// src/agent/index.js
|
|
51731
|
-
|
|
51312
|
+
dotenv3.config();
|
|
51732
51313
|
function readInputContent(input) {
|
|
51733
51314
|
if (!input) return null;
|
|
51734
51315
|
try {
|
|
51735
51316
|
const resolvedPath = resolve4(input);
|
|
51736
|
-
if (
|
|
51317
|
+
if (existsSync5(resolvedPath)) {
|
|
51737
51318
|
return readFileSync2(resolvedPath, "utf-8").trim();
|
|
51738
51319
|
}
|
|
51739
51320
|
} catch (error) {
|
|
@@ -52285,7 +51866,7 @@ async function main() {
|
|
|
52285
51866
|
bashConfig.timeout = timeout;
|
|
52286
51867
|
}
|
|
52287
51868
|
if (config.bashWorkingDir) {
|
|
52288
|
-
if (!
|
|
51869
|
+
if (!existsSync5(config.bashWorkingDir)) {
|
|
52289
51870
|
console.error(`Error: Bash working directory does not exist: ${config.bashWorkingDir}`);
|
|
52290
51871
|
process.exit(1);
|
|
52291
51872
|
}
|