@probelabs/probe 0.6.0-rc154 → 0.6.0-rc161

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 (49) hide show
  1. package/README.md +80 -1
  2. package/build/agent/FallbackManager.d.ts +176 -0
  3. package/build/agent/FallbackManager.js +545 -0
  4. package/build/agent/ProbeAgent.d.ts +9 -1
  5. package/build/agent/ProbeAgent.js +218 -10
  6. package/build/agent/RetryManager.d.ts +157 -0
  7. package/build/agent/RetryManager.js +334 -0
  8. package/build/agent/acp/server.js +1 -0
  9. package/build/agent/acp/tools.js +6 -2
  10. package/build/agent/index.js +1814 -355
  11. package/build/agent/probeTool.js +20 -2
  12. package/build/agent/tools.js +16 -0
  13. package/build/delegate.js +326 -201
  14. package/build/downloader.js +46 -17
  15. package/build/extractor.js +12 -12
  16. package/build/index.js +13 -0
  17. package/build/tools/common.js +5 -3
  18. package/build/tools/edit.js +409 -0
  19. package/build/tools/index.js +11 -0
  20. package/build/tools/vercel.js +55 -14
  21. package/build/utils.js +18 -9
  22. package/cjs/agent/ProbeAgent.cjs +2268 -699
  23. package/cjs/index.cjs +75902 -74348
  24. package/package.json +2 -2
  25. package/src/agent/FallbackManager.d.ts +176 -0
  26. package/src/agent/FallbackManager.js +545 -0
  27. package/src/agent/ProbeAgent.d.ts +9 -1
  28. package/src/agent/ProbeAgent.js +218 -10
  29. package/src/agent/RetryManager.d.ts +157 -0
  30. package/src/agent/RetryManager.js +334 -0
  31. package/src/agent/acp/server.js +1 -0
  32. package/src/agent/acp/tools.js +6 -2
  33. package/src/agent/index.js +8 -0
  34. package/src/agent/probeTool.js +20 -2
  35. package/src/agent/tools.js +16 -0
  36. package/src/delegate.js +326 -201
  37. package/src/downloader.js +46 -17
  38. package/src/extractor.js +12 -12
  39. package/src/index.js +13 -0
  40. package/src/tools/common.js +5 -3
  41. package/src/tools/edit.js +409 -0
  42. package/src/tools/index.js +11 -0
  43. package/src/tools/vercel.js +55 -14
  44. package/src/utils.js +18 -9
  45. package/bin/binaries/probe-v0.6.0-rc154-aarch64-apple-darwin.tar.gz +0 -0
  46. package/bin/binaries/probe-v0.6.0-rc154-aarch64-unknown-linux-gnu.tar.gz +0 -0
  47. package/bin/binaries/probe-v0.6.0-rc154-x86_64-apple-darwin.tar.gz +0 -0
  48. package/bin/binaries/probe-v0.6.0-rc154-x86_64-pc-windows-msvc.zip +0 -0
  49. package/bin/binaries/probe-v0.6.0-rc154-x86_64-unknown-linux-gnu.tar.gz +0 -0
@@ -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
- try {
255
- if (debug) {
256
- console.error(`Executing delegate with task: "${task}"`);
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
- const result = await delegate({
260
- task,
261
- timeout,
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
- return result;
266
- } catch (error) {
267
- console.error('Error executing delegate command:', error);
268
- return `Error executing delegate command: ${error.message}`;
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/build/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
- const { forceDownload = false, version } = options;
28
+ const { forceDownload = false, version } = options;
29
29
 
30
- // Check environment variable first (user override)
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
- // Get dynamic bin directory (handles CI, npx, Docker scenarios)
44
- const binDir = await getPackageBinDir();
45
-
46
- // Check postinstall binary in package directory (most up-to-date with npm package version)
47
- const isWindows = process.platform === 'win32';
48
- const binaryName = isWindows ? 'probe.exe' : 'probe-binary';
49
- const binaryPath = path.join(binDir, binaryName);
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;