@probelabs/probe 0.6.0-rc154 → 0.6.0-rc159
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/binaries/probe-v0.6.0-rc159-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc159-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc159-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc159-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc159-x86_64-unknown-linux-musl.tar.gz +0 -0
- package/build/agent/ProbeAgent.d.ts +2 -0
- package/build/agent/ProbeAgent.js +20 -4
- package/build/agent/acp/server.js +1 -0
- package/build/agent/index.js +464 -216
- package/build/delegate.js +326 -201
- package/build/downloader.js +46 -17
- package/build/extractor.js +12 -12
- package/build/tools/vercel.js +55 -14
- package/build/utils.js +18 -9
- package/cjs/agent/ProbeAgent.cjs +478 -234
- package/cjs/index.cjs +41496 -41272
- package/package.json +2 -2
- package/src/agent/ProbeAgent.d.ts +2 -0
- package/src/agent/ProbeAgent.js +20 -4
- package/src/agent/acp/server.js +1 -0
- package/src/agent/index.js +8 -0
- package/src/delegate.js +326 -201
- package/src/downloader.js +46 -17
- package/src/extractor.js +12 -12
- package/src/tools/vercel.js +55 -14
- package/src/utils.js +18 -9
- package/bin/binaries/probe-v0.6.0-rc154-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc154-aarch64-unknown-linux-gnu.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc154-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc154-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc154-x86_64-unknown-linux-gnu.tar.gz +0 -0
package/src/downloader.js
CHANGED
|
@@ -17,6 +17,35 @@ import { getPackageBinDir } from './directory-resolver.js';
|
|
|
17
17
|
|
|
18
18
|
const exec = promisify(execCallback);
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Create a plain, serializable Error from possibly complex/circular errors (e.g., axios)
|
|
22
|
+
* Avoids passing circular req/res objects to IPC serializers and test runners.
|
|
23
|
+
*/
|
|
24
|
+
function sanitizeError(err) {
|
|
25
|
+
try {
|
|
26
|
+
const status = err?.response?.status;
|
|
27
|
+
const statusText = err?.response?.statusText;
|
|
28
|
+
const url = err?.config?.url || err?.response?.config?.url;
|
|
29
|
+
const code = err?.code;
|
|
30
|
+
const serverMsg = typeof err?.response?.data === 'string'
|
|
31
|
+
? err.response.data.slice(0, 500)
|
|
32
|
+
: (typeof err?.response?.data?.message === 'string' ? err.response.data.message : undefined);
|
|
33
|
+
const base = err?.message || String(err);
|
|
34
|
+
const parts = [base];
|
|
35
|
+
if (status || statusText) parts.push(`[${(status ?? '')} ${(statusText ?? '')}]`.trim());
|
|
36
|
+
if (code) parts.push(`code=${code}`);
|
|
37
|
+
if (url) parts.push(`url=${url}`);
|
|
38
|
+
if (serverMsg) parts.push(`server="${String(serverMsg).replace(/\s+/g, ' ').trim()}"`);
|
|
39
|
+
const e = new Error(parts.filter(Boolean).join(' '));
|
|
40
|
+
if (status) e.status = status;
|
|
41
|
+
if (code) e.code = code;
|
|
42
|
+
if (url) e.url = url;
|
|
43
|
+
return e;
|
|
44
|
+
} catch (_) {
|
|
45
|
+
return new Error(err?.message || String(err));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
20
49
|
// GitHub repository information
|
|
21
50
|
const REPO_OWNER = "probelabs";
|
|
22
51
|
const REPO_NAME = "probe";
|
|
@@ -69,7 +98,7 @@ async function acquireFileLock(lockPath, version) {
|
|
|
69
98
|
console.log(`Acquired file lock: ${lockPath}`);
|
|
70
99
|
}
|
|
71
100
|
return true;
|
|
72
|
-
|
|
101
|
+
} catch (error) {
|
|
73
102
|
if (error.code === 'EEXIST') {
|
|
74
103
|
// Lock file exists - check if it's stale
|
|
75
104
|
try {
|
|
@@ -265,13 +294,13 @@ function detectOsArch() {
|
|
|
265
294
|
let archInfo;
|
|
266
295
|
|
|
267
296
|
// Detect OS
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
297
|
+
switch (osType) {
|
|
298
|
+
case 'linux':
|
|
299
|
+
osInfo = {
|
|
300
|
+
type: 'linux',
|
|
301
|
+
keywords: ['linux', 'Linux', 'musl', 'gnu']
|
|
302
|
+
};
|
|
303
|
+
break;
|
|
275
304
|
case 'darwin':
|
|
276
305
|
osInfo = {
|
|
277
306
|
type: 'darwin',
|
|
@@ -324,11 +353,11 @@ function constructAssetInfo(version, osInfo, archInfo) {
|
|
|
324
353
|
let extension;
|
|
325
354
|
|
|
326
355
|
// Map OS and arch to the expected format in release names
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
356
|
+
switch (osInfo.type) {
|
|
357
|
+
case 'linux':
|
|
358
|
+
platform = `${archInfo.type}-unknown-linux-musl`;
|
|
359
|
+
extension = 'tar.gz';
|
|
360
|
+
break;
|
|
332
361
|
case 'darwin':
|
|
333
362
|
platform = `${archInfo.type}-apple-darwin`;
|
|
334
363
|
extension = 'tar.gz';
|
|
@@ -482,7 +511,7 @@ async function getLatestRelease(version) {
|
|
|
482
511
|
return { tag, assets };
|
|
483
512
|
}
|
|
484
513
|
|
|
485
|
-
throw error;
|
|
514
|
+
throw sanitizeError(error);
|
|
486
515
|
}
|
|
487
516
|
}
|
|
488
517
|
|
|
@@ -787,7 +816,7 @@ async function extractBinary(assetPath, outputDir) {
|
|
|
787
816
|
return binaryPath;
|
|
788
817
|
} catch (error) {
|
|
789
818
|
console.error(`Error extracting binary: ${error instanceof Error ? error.message : String(error)}`);
|
|
790
|
-
throw error;
|
|
819
|
+
throw sanitizeError(error);
|
|
791
820
|
}
|
|
792
821
|
}
|
|
793
822
|
|
|
@@ -1032,7 +1061,7 @@ export async function downloadProbeBinary(version) {
|
|
|
1032
1061
|
}
|
|
1033
1062
|
return await withDownloadLock(version, () => doDownload(version));
|
|
1034
1063
|
} catch (error) {
|
|
1035
|
-
console.error('Error downloading probe binary:', error);
|
|
1036
|
-
throw error;
|
|
1064
|
+
console.error('Error downloading probe binary:', error?.message || String(error));
|
|
1065
|
+
throw sanitizeError(error);
|
|
1037
1066
|
}
|
|
1038
1067
|
}
|
package/src/extractor.js
CHANGED
|
@@ -27,16 +27,16 @@ function detectPlatform() {
|
|
|
27
27
|
let extension;
|
|
28
28
|
|
|
29
29
|
// Map to the same format used in release artifacts
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
if (osType === 'linux') {
|
|
31
|
+
if (archType === 'x64') {
|
|
32
|
+
platform = 'x86_64-unknown-linux-musl';
|
|
33
|
+
extension = 'tar.gz';
|
|
34
|
+
} else if (archType === 'arm64') {
|
|
35
|
+
platform = 'aarch64-unknown-linux-musl';
|
|
36
|
+
extension = 'tar.gz';
|
|
37
|
+
} else {
|
|
38
|
+
throw new Error(`Unsupported Linux architecture: ${archType}`);
|
|
39
|
+
}
|
|
40
40
|
} else if (osType === 'darwin') {
|
|
41
41
|
if (archType === 'x64') {
|
|
42
42
|
platform = 'x86_64-apple-darwin';
|
|
@@ -191,8 +191,8 @@ export async function extractBundledBinary(version) {
|
|
|
191
191
|
`Searched in: ${binariesDir}\n` +
|
|
192
192
|
`\n` +
|
|
193
193
|
`Supported platforms:\n` +
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
` - x86_64-unknown-linux-musl (Linux x64, static)\n` +
|
|
195
|
+
` - aarch64-unknown-linux-musl (Linux ARM64, static)\n` +
|
|
196
196
|
` - x86_64-apple-darwin (macOS Intel)\n` +
|
|
197
197
|
` - aarch64-apple-darwin (macOS Apple Silicon)\n` +
|
|
198
198
|
` - x86_64-pc-windows-msvc (Windows x64)\n` +
|
package/src/tools/vercel.js
CHANGED
|
@@ -250,23 +250,64 @@ export const delegateTool = (options = {}) => {
|
|
|
250
250
|
name: 'delegate',
|
|
251
251
|
description: delegateDescription,
|
|
252
252
|
inputSchema: delegateSchema,
|
|
253
|
-
execute: async ({ task }) => {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
253
|
+
execute: async ({ task, currentIteration, maxIterations, parentSessionId, path, provider, model, tracer }) => {
|
|
254
|
+
// Validate required parameters - throw errors for consistency
|
|
255
|
+
if (!task || typeof task !== 'string') {
|
|
256
|
+
throw new Error('Task parameter is required and must be a non-empty string');
|
|
257
|
+
}
|
|
258
258
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
debug
|
|
263
|
-
});
|
|
259
|
+
if (task.trim().length === 0) {
|
|
260
|
+
throw new Error('Task parameter cannot be empty or whitespace only');
|
|
261
|
+
}
|
|
264
262
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
263
|
+
// Validate optional numeric parameters
|
|
264
|
+
if (currentIteration !== undefined && (typeof currentIteration !== 'number' || currentIteration < 0)) {
|
|
265
|
+
throw new Error('currentIteration must be a non-negative number');
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (maxIterations !== undefined && (typeof maxIterations !== 'number' || maxIterations < 1)) {
|
|
269
|
+
throw new Error('maxIterations must be a positive number');
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Validate optional string parameters for type consistency
|
|
273
|
+
if (parentSessionId !== undefined && parentSessionId !== null && typeof parentSessionId !== 'string') {
|
|
274
|
+
throw new TypeError('parentSessionId must be a string, null, or undefined');
|
|
269
275
|
}
|
|
276
|
+
|
|
277
|
+
if (path !== undefined && path !== null && typeof path !== 'string') {
|
|
278
|
+
throw new TypeError('path must be a string, null, or undefined');
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (provider !== undefined && provider !== null && typeof provider !== 'string') {
|
|
282
|
+
throw new TypeError('provider must be a string, null, or undefined');
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (model !== undefined && model !== null && typeof model !== 'string') {
|
|
286
|
+
throw new TypeError('model must be a string, null, or undefined');
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (debug) {
|
|
290
|
+
console.error(`Executing delegate with task: "${task.substring(0, 100)}${task.length > 100 ? '...' : ''}"`);
|
|
291
|
+
if (parentSessionId) {
|
|
292
|
+
console.error(`Parent session: ${parentSessionId}`);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Execute delegation - let errors propagate naturally
|
|
297
|
+
const result = await delegate({
|
|
298
|
+
task,
|
|
299
|
+
timeout,
|
|
300
|
+
debug,
|
|
301
|
+
currentIteration: currentIteration || 0,
|
|
302
|
+
maxIterations: maxIterations || 30,
|
|
303
|
+
parentSessionId,
|
|
304
|
+
path,
|
|
305
|
+
provider,
|
|
306
|
+
model,
|
|
307
|
+
tracer
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
return result;
|
|
270
311
|
}
|
|
271
312
|
});
|
|
272
313
|
};
|
package/src/utils.js
CHANGED
|
@@ -25,9 +25,9 @@ let probeBinaryPath = '';
|
|
|
25
25
|
* @returns {Promise<string>} - Path to the binary
|
|
26
26
|
*/
|
|
27
27
|
export async function getBinaryPath(options = {}) {
|
|
28
|
-
|
|
28
|
+
const { forceDownload = false, version } = options;
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
// Check environment variable first (user override)
|
|
31
31
|
if (process.env.PROBE_PATH && fs.existsSync(process.env.PROBE_PATH) && !forceDownload) {
|
|
32
32
|
probeBinaryPath = process.env.PROBE_PATH;
|
|
33
33
|
return probeBinaryPath;
|
|
@@ -40,13 +40,22 @@ export async function getBinaryPath(options = {}) {
|
|
|
40
40
|
return probeBinaryPath;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
// Prefer local package bin if available (avoids network during tests/monorepo)
|
|
44
|
+
const isWindows = process.platform === 'win32';
|
|
45
|
+
const binaryName = isWindows ? 'probe.exe' : 'probe-binary';
|
|
46
|
+
const localPackageBin = path.resolve(__dirname, '..', 'bin');
|
|
47
|
+
const localBinaryPath = path.join(localPackageBin, binaryName);
|
|
48
|
+
if (fs.existsSync(localBinaryPath) && !forceDownload) {
|
|
49
|
+
// Use committed binary bundled with the repo/package
|
|
50
|
+
probeBinaryPath = localBinaryPath;
|
|
51
|
+
return probeBinaryPath;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Get dynamic bin directory (handles CI, npx, Docker scenarios)
|
|
55
|
+
const binDir = await getPackageBinDir();
|
|
56
|
+
|
|
57
|
+
// Check postinstall binary in resolved directory
|
|
58
|
+
const binaryPath = path.join(binDir, binaryName);
|
|
50
59
|
|
|
51
60
|
if (fs.existsSync(binaryPath) && !forceDownload) {
|
|
52
61
|
probeBinaryPath = binaryPath;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|