@probelabs/probe 0.6.0-rc232 → 0.6.0-rc234

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 (61) hide show
  1. package/bin/binaries/probe-v0.6.0-rc234-aarch64-apple-darwin.tar.gz +0 -0
  2. package/bin/binaries/probe-v0.6.0-rc234-aarch64-unknown-linux-musl.tar.gz +0 -0
  3. package/bin/binaries/probe-v0.6.0-rc234-x86_64-apple-darwin.tar.gz +0 -0
  4. package/bin/binaries/probe-v0.6.0-rc234-x86_64-pc-windows-msvc.zip +0 -0
  5. package/bin/binaries/probe-v0.6.0-rc234-x86_64-unknown-linux-musl.tar.gz +0 -0
  6. package/build/agent/ProbeAgent.d.ts +2 -0
  7. package/build/agent/ProbeAgent.js +66 -7
  8. package/build/agent/dsl/agent-test.mjs +341 -0
  9. package/build/agent/dsl/analyze-test.mjs +237 -0
  10. package/build/agent/dsl/diag-test.mjs +78 -0
  11. package/build/agent/dsl/environment.js +387 -0
  12. package/build/agent/dsl/manual-test.mjs +662 -0
  13. package/build/agent/dsl/output-buffer-test.mjs +124 -0
  14. package/build/agent/dsl/pipeline-direct-test.mjs +147 -0
  15. package/build/agent/dsl/pipeline-test.mjs +223 -0
  16. package/build/agent/dsl/runtime.js +206 -0
  17. package/build/agent/dsl/sandbox-experiment.mjs +309 -0
  18. package/build/agent/dsl/transformer.js +156 -0
  19. package/build/agent/dsl/trigger-test.mjs +159 -0
  20. package/build/agent/dsl/validator.js +183 -0
  21. package/build/agent/index.js +18179 -7664
  22. package/build/agent/probeTool.js +9 -0
  23. package/build/agent/schemaUtils.js +74 -1
  24. package/build/agent/tasks/taskTool.js +6 -1
  25. package/build/agent/tools.js +9 -1
  26. package/build/index.js +5 -0
  27. package/build/tools/common.js +7 -0
  28. package/build/tools/executePlan.js +761 -0
  29. package/build/tools/index.js +4 -0
  30. package/cjs/agent/ProbeAgent.cjs +12146 -1638
  31. package/cjs/index.cjs +11800 -1283
  32. package/package.json +5 -1
  33. package/src/agent/ProbeAgent.d.ts +2 -0
  34. package/src/agent/ProbeAgent.js +66 -7
  35. package/src/agent/dsl/agent-test.mjs +341 -0
  36. package/src/agent/dsl/analyze-test.mjs +237 -0
  37. package/src/agent/dsl/diag-test.mjs +78 -0
  38. package/src/agent/dsl/environment.js +387 -0
  39. package/src/agent/dsl/manual-test.mjs +662 -0
  40. package/src/agent/dsl/output-buffer-test.mjs +124 -0
  41. package/src/agent/dsl/pipeline-direct-test.mjs +147 -0
  42. package/src/agent/dsl/pipeline-test.mjs +223 -0
  43. package/src/agent/dsl/runtime.js +206 -0
  44. package/src/agent/dsl/sandbox-experiment.mjs +309 -0
  45. package/src/agent/dsl/transformer.js +156 -0
  46. package/src/agent/dsl/trigger-test.mjs +159 -0
  47. package/src/agent/dsl/validator.js +183 -0
  48. package/src/agent/index.js +8 -0
  49. package/src/agent/probeTool.js +9 -0
  50. package/src/agent/schemaUtils.js +74 -1
  51. package/src/agent/tasks/taskTool.js +6 -1
  52. package/src/agent/tools.js +9 -1
  53. package/src/index.js +5 -0
  54. package/src/tools/common.js +7 -0
  55. package/src/tools/executePlan.js +761 -0
  56. package/src/tools/index.js +4 -0
  57. package/bin/binaries/probe-v0.6.0-rc232-aarch64-apple-darwin.tar.gz +0 -0
  58. package/bin/binaries/probe-v0.6.0-rc232-aarch64-unknown-linux-musl.tar.gz +0 -0
  59. package/bin/binaries/probe-v0.6.0-rc232-x86_64-apple-darwin.tar.gz +0 -0
  60. package/bin/binaries/probe-v0.6.0-rc232-x86_64-pc-windows-msvc.zip +0 -0
  61. package/bin/binaries/probe-v0.6.0-rc232-x86_64-unknown-linux-musl.tar.gz +0 -0
@@ -211,6 +211,15 @@ export function createWrappedTools(baseTools) {
211
211
  );
212
212
  }
213
213
 
214
+ // Wrap execute_plan tool
215
+ if (baseTools.executePlanTool) {
216
+ wrappedTools.executePlanToolInstance = wrapToolWithEmitter(
217
+ baseTools.executePlanTool,
218
+ 'execute_plan',
219
+ baseTools.executePlanTool.execute
220
+ );
221
+ }
222
+
214
223
  // Wrap bash tool
215
224
  if (baseTools.bashTool) {
216
225
  wrappedTools.bashToolInstance = wrapToolWithEmitter(
@@ -771,6 +771,78 @@ export function isJsonSchemaDefinition(jsonString, options = {}) {
771
771
  }
772
772
  }
773
773
 
774
+ /**
775
+ * Check if schema is a simple text wrapper (e.g., {text: string} or {response: string})
776
+ * These schemas can be auto-wrapped without re-invoking the AI
777
+ * @param {string} schema - The schema string
778
+ * @returns {Object|null} - Object with field name if simple wrapper, null otherwise
779
+ */
780
+ export function isSimpleTextWrapperSchema(schema) {
781
+ if (!schema || typeof schema !== 'string') {
782
+ return null;
783
+ }
784
+
785
+ const trimmed = schema.trim();
786
+
787
+ // Match patterns like: {text: string}, {"text": "string"}, {response: string}, etc.
788
+ // These are simple wrappers that just need a single text field
789
+ const simplePatterns = [
790
+ /^\{\s*["']?(\w+)["']?\s*:\s*["']?string["']?\s*\}$/i,
791
+ /^\{\s*["']?type["']?\s*:\s*["']?object["']?\s*,\s*["']?properties["']?\s*:\s*\{\s*["']?(\w+)["']?\s*:\s*\{\s*["']?type["']?\s*:\s*["']?string["']?\s*\}\s*\}\s*\}$/i
792
+ ];
793
+
794
+ for (const pattern of simplePatterns) {
795
+ const match = trimmed.match(pattern);
796
+ if (match) {
797
+ return { fieldName: match[1] };
798
+ }
799
+ }
800
+
801
+ return null;
802
+ }
803
+
804
+ /**
805
+ * Try to auto-wrap plain text for simple wrapper schemas
806
+ * Returns wrapped JSON if successful, null if not applicable
807
+ * @param {string} response - The response to wrap
808
+ * @param {string} schema - The schema string
809
+ * @param {Object} options - Options
810
+ * @param {boolean} [options.debug=false] - Enable debug logging
811
+ * @returns {string|null} - Wrapped JSON string or null
812
+ */
813
+ export function tryAutoWrapForSimpleSchema(response, schema, options = {}) {
814
+ const { debug = false } = options;
815
+
816
+ const wrapperInfo = isSimpleTextWrapperSchema(schema);
817
+ if (!wrapperInfo) {
818
+ if (debug) {
819
+ console.log(`[DEBUG] Auto-wrap: Schema is not a simple text wrapper`);
820
+ }
821
+ return null;
822
+ }
823
+
824
+ // Check if response is already valid JSON
825
+ try {
826
+ JSON.parse(response);
827
+ // Already valid JSON, don't wrap
828
+ if (debug) {
829
+ console.log(`[DEBUG] Auto-wrap: Response is already valid JSON, skipping`);
830
+ }
831
+ return null;
832
+ } catch {
833
+ // Not valid JSON, proceed with wrapping
834
+ }
835
+
836
+ // Wrap the plain text in the schema structure
837
+ const wrapped = JSON.stringify({ [wrapperInfo.fieldName]: response });
838
+
839
+ if (debug) {
840
+ console.log(`[DEBUG] Auto-wrap: Wrapped plain text in {"${wrapperInfo.fieldName}": ...} (${response.length} chars)`);
841
+ }
842
+
843
+ return wrapped;
844
+ }
845
+
774
846
  /**
775
847
  * Create a correction prompt for invalid JSON
776
848
  * @param {string} invalidResponse - The invalid JSON response
@@ -817,9 +889,10 @@ export function createJsonCorrectionPrompt(invalidResponse, schema, errorOrValid
817
889
  const level = Math.min(retryCount, strengthLevels.length - 1);
818
890
  const currentLevel = strengthLevels[level];
819
891
 
892
+ // Include full response - truncating loses context the AI needs to fix the issue
820
893
  let prompt = `${currentLevel.prefix} Your previous response is not valid JSON and cannot be parsed. Here's what you returned:
821
894
 
822
- ${invalidResponse.substring(0, 500)}${invalidResponse.length > 500 ? '...' : ''}
895
+ ${invalidResponse}
823
896
 
824
897
  Error: ${enhancedError}
825
898
 
@@ -42,7 +42,7 @@ Manage tasks for tracking progress during code exploration and problem-solving.
42
42
 
43
43
  Parameters:
44
44
  - action: (required) The action to perform: create, update, complete, delete, list
45
- - tasks: (optional) JSON array for batch operations - alternative to single-task params
45
+ - tasks: (optional) Array of task objects for batch operations. Place raw JSON array directly between tags.
46
46
  - id: (optional) Task ID for single operations (e.g., "task-1")
47
47
  - title: (optional) Task title for create/update
48
48
  - description: (optional) Task description for create/update
@@ -51,6 +51,11 @@ Parameters:
51
51
  - dependencies: (optional) JSON array of task IDs that must be completed first
52
52
  - after: (optional) Task ID to insert the new task after (for ordering). By default, new tasks are appended to the end
53
53
 
54
+ IMPORTANT - JSON Format:
55
+ Place raw JSON arrays directly between tags without quotes or escaping:
56
+ CORRECT: <tasks>[{"title": "Do X"}]</tasks>
57
+ INCORRECT: <tasks>"[{\"title\": \"Do X\"}]"</tasks>
58
+
54
59
  Usage Examples:
55
60
 
56
61
  Creating a single task:
@@ -5,6 +5,7 @@ import {
5
5
  extractTool,
6
6
  delegateTool,
7
7
  analyzeAllTool,
8
+ createExecutePlanTool,
8
9
  bashTool,
9
10
  editTool,
10
11
  createTool,
@@ -16,6 +17,7 @@ import {
16
17
  extractSchema,
17
18
  delegateSchema,
18
19
  analyzeAllSchema,
20
+ executePlanSchema,
19
21
  bashSchema,
20
22
  editSchema,
21
23
  createSchema,
@@ -24,6 +26,7 @@ import {
24
26
  extractToolDefinition,
25
27
  delegateToolDefinition,
26
28
  analyzeAllToolDefinition,
29
+ getExecutePlanToolDefinition,
27
30
  bashToolDefinition,
28
31
  editToolDefinition,
29
32
  createToolDefinition,
@@ -58,7 +61,10 @@ export function createTools(configOptions) {
58
61
  if (configOptions.enableDelegate && isToolAllowed('delegate')) {
59
62
  tools.delegateTool = delegateTool(configOptions);
60
63
  }
61
- if (isToolAllowed('analyze_all')) {
64
+ if (configOptions.enableExecutePlan && isToolAllowed('execute_plan')) {
65
+ tools.executePlanTool = createExecutePlanTool(configOptions);
66
+ } else if (isToolAllowed('analyze_all')) {
67
+ // analyze_all is fallback when execute_plan is not enabled
62
68
  tools.analyzeAllTool = analyzeAllTool(configOptions);
63
69
  }
64
70
 
@@ -97,6 +103,7 @@ export {
97
103
  extractSchema,
98
104
  delegateSchema,
99
105
  analyzeAllSchema,
106
+ executePlanSchema,
100
107
  bashSchema,
101
108
  editSchema,
102
109
  createSchema,
@@ -106,6 +113,7 @@ export {
106
113
  extractToolDefinition,
107
114
  delegateToolDefinition,
108
115
  analyzeAllToolDefinition,
116
+ getExecutePlanToolDefinition,
109
117
  bashToolDefinition,
110
118
  editToolDefinition,
111
119
  createToolDefinition,
package/build/index.js CHANGED
@@ -26,6 +26,7 @@ import {
26
26
  extractSchema,
27
27
  delegateSchema,
28
28
  analyzeAllSchema,
29
+ executePlanSchema,
29
30
  attemptCompletionSchema,
30
31
  bashSchema,
31
32
  searchToolDefinition,
@@ -46,6 +47,7 @@ import {
46
47
  createToolDefinition
47
48
  } from './tools/edit.js';
48
49
  import { searchTool, queryTool, extractTool, delegateTool, analyzeAllTool } from './tools/vercel.js';
50
+ import { createExecutePlanTool, getExecutePlanToolDefinition } from './tools/executePlan.js';
49
51
  import { bashTool } from './tools/bash.js';
50
52
  import { editTool, createTool } from './tools/edit.js';
51
53
  import { ProbeAgent } from './agent/ProbeAgent.js';
@@ -90,6 +92,7 @@ export {
90
92
  extractTool,
91
93
  delegateTool,
92
94
  analyzeAllTool,
95
+ createExecutePlanTool,
93
96
  bashTool,
94
97
  editTool,
95
98
  createTool,
@@ -102,6 +105,7 @@ export {
102
105
  extractSchema,
103
106
  delegateSchema,
104
107
  analyzeAllSchema,
108
+ executePlanSchema,
105
109
  attemptCompletionSchema,
106
110
  bashSchema,
107
111
  editSchema,
@@ -112,6 +116,7 @@ export {
112
116
  extractToolDefinition,
113
117
  delegateToolDefinition,
114
118
  analyzeAllToolDefinition,
119
+ getExecutePlanToolDefinition,
115
120
  attemptCompletionToolDefinition,
116
121
  bashToolDefinition,
117
122
  editToolDefinition,
@@ -54,6 +54,11 @@ export const analyzeAllSchema = z.object({
54
54
  path: z.string().optional().default('.').describe('Directory path to search in')
55
55
  });
56
56
 
57
+ export const executePlanSchema = z.object({
58
+ code: z.string().min(1).describe('JavaScript DSL code to execute. All function calls look synchronous — do NOT use async/await. Use map(items, fn) for batch operations. Use LLM(instruction, data) for AI processing.'),
59
+ description: z.string().optional().describe('Human-readable description of what this plan does, for logging.')
60
+ });
61
+
57
62
  // Schema for the attempt_completion tool - flexible validation for direct XML response
58
63
  export const attemptCompletionSchema = {
59
64
  // Custom validation that requires result parameter but allows direct XML response
@@ -425,6 +430,7 @@ export const DEFAULT_VALID_TOOLS = [
425
430
  'extract',
426
431
  'delegate',
427
432
  'analyze_all',
433
+ 'execute_plan',
428
434
  'listSkills',
429
435
  'useSkill',
430
436
  'listFiles',
@@ -463,6 +469,7 @@ function getValidParamsForTool(toolName) {
463
469
  extract: extractSchema,
464
470
  delegate: delegateSchema,
465
471
  analyze_all: analyzeAllSchema,
472
+ execute_plan: executePlanSchema,
466
473
  listSkills: listSkillsSchema,
467
474
  useSkill: useSkillSchema,
468
475
  bash: bashSchema,