@probelabs/probe 0.6.0-rc279 → 0.6.0-rc281
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-rc281-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc281-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc281-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc281-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc281-x86_64-unknown-linux-musl.tar.gz +0 -0
- package/build/agent/ProbeAgent.js +68 -34
- package/build/agent/dsl/environment.js +1 -0
- package/build/agent/index.js +161 -77
- package/build/delegate.js +22 -12
- package/build/downloader.js +28 -25
- package/build/tools/analyzeAll.js +2 -6
- package/build/tools/common.js +5 -4
- package/build/tools/vercel.js +65 -6
- package/cjs/agent/ProbeAgent.cjs +161 -77
- package/cjs/index.cjs +162 -78
- package/package.json +1 -1
- package/src/agent/ProbeAgent.js +68 -34
- package/src/agent/dsl/environment.js +1 -0
- package/src/delegate.js +22 -12
- package/src/downloader.js +28 -25
- package/src/tools/analyzeAll.js +2 -6
- package/src/tools/common.js +5 -4
- package/src/tools/vercel.js +65 -6
- package/bin/binaries/probe-v0.6.0-rc279-aarch64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc279-aarch64-unknown-linux-musl.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc279-x86_64-apple-darwin.tar.gz +0 -0
- package/bin/binaries/probe-v0.6.0-rc279-x86_64-pc-windows-msvc.zip +0 -0
- package/bin/binaries/probe-v0.6.0-rc279-x86_64-unknown-linux-musl.tar.gz +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -254,6 +254,7 @@ export class ProbeAgent {
|
|
|
254
254
|
// Supports exclusion with '!' prefix: ['*', '!bash'] = all tools except bash
|
|
255
255
|
// disableTools is a convenience flag that overrides allowedTools to []
|
|
256
256
|
const effectiveAllowedTools = options.disableTools ? [] : options.allowedTools;
|
|
257
|
+
this._rawAllowedTools = options.allowedTools; // Keep raw value for explicit tool checks
|
|
257
258
|
this.allowedTools = this._parseAllowedTools(effectiveAllowedTools);
|
|
258
259
|
|
|
259
260
|
// Storage adapter (defaults to in-memory)
|
|
@@ -481,6 +482,17 @@ export class ProbeAgent {
|
|
|
481
482
|
return mcpToolNames.filter(toolName => this._isMcpToolAllowed(toolName));
|
|
482
483
|
}
|
|
483
484
|
|
|
485
|
+
/**
|
|
486
|
+
* Check if query tool was explicitly listed in allowedTools (not via wildcard).
|
|
487
|
+
* Query (ast-grep) is excluded by default because models struggle with AST pattern syntax.
|
|
488
|
+
* @returns {boolean}
|
|
489
|
+
* @private
|
|
490
|
+
*/
|
|
491
|
+
_isQueryExplicitlyAllowed() {
|
|
492
|
+
if (!this._rawAllowedTools) return false;
|
|
493
|
+
return Array.isArray(this._rawAllowedTools) && this._rawAllowedTools.includes('query');
|
|
494
|
+
}
|
|
495
|
+
|
|
484
496
|
/**
|
|
485
497
|
* Check if tracer is AppTracer (expects sessionId as first param) vs SimpleAppTracer
|
|
486
498
|
* @returns {boolean} - True if tracer is AppTracer style (requires sessionId)
|
|
@@ -837,7 +849,9 @@ export class ProbeAgent {
|
|
|
837
849
|
if (wrappedTools.searchToolInstance && isToolAllowed('search')) {
|
|
838
850
|
this.toolImplementations.search = wrappedTools.searchToolInstance;
|
|
839
851
|
}
|
|
840
|
-
|
|
852
|
+
// query tool (ast-grep) is not exposed to AI by default — models struggle with AST pattern syntax.
|
|
853
|
+
// Only register it when explicitly listed in allowedTools (not via wildcard '*').
|
|
854
|
+
if (wrappedTools.queryToolInstance && isToolAllowed('query') && this._isQueryExplicitlyAllowed()) {
|
|
841
855
|
this.toolImplementations.query = wrappedTools.queryToolInstance;
|
|
842
856
|
}
|
|
843
857
|
if (wrappedTools.extractToolInstance && isToolAllowed('extract')) {
|
|
@@ -2008,12 +2022,15 @@ export class ProbeAgent {
|
|
|
2008
2022
|
const toolMap = {
|
|
2009
2023
|
search: {
|
|
2010
2024
|
schema: searchSchema,
|
|
2011
|
-
description:
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
schema: querySchema,
|
|
2015
|
-
description: 'Search code using ast-grep structural pattern matching.'
|
|
2025
|
+
description: this.searchDelegate
|
|
2026
|
+
? 'Search code in the repository by asking a question. Accepts natural language questions — a subagent breaks them into targeted keyword searches and returns extracted code blocks. Do NOT formulate keyword queries yourself.'
|
|
2027
|
+
: 'Search code in the repository using keyword queries with Elasticsearch syntax. Handles stemming, case-insensitive matching, and camelCase/snake_case splitting automatically — do NOT try keyword variations manually.'
|
|
2016
2028
|
},
|
|
2029
|
+
// query tool (ast-grep) removed from AI-facing tools — models struggle with pattern syntax
|
|
2030
|
+
// query: {
|
|
2031
|
+
// schema: querySchema,
|
|
2032
|
+
// description: 'Search code using ast-grep structural pattern matching.'
|
|
2033
|
+
// },
|
|
2017
2034
|
extract: {
|
|
2018
2035
|
schema: extractSchema,
|
|
2019
2036
|
description: 'Extract code blocks from files based on file paths and optional line numbers.'
|
|
@@ -2849,30 +2866,34 @@ export class ProbeAgent {
|
|
|
2849
2866
|
}
|
|
2850
2867
|
|
|
2851
2868
|
// Add high-level instructions about when to use tools
|
|
2869
|
+
const searchToolDesc1 = this.searchDelegate
|
|
2870
|
+
? '- search: Ask natural language questions to find code (e.g., "How does authentication work?"). A subagent handles keyword searches and returns extracted code blocks. Do NOT formulate keyword queries — just ask questions.'
|
|
2871
|
+
: '- search: Find code patterns using keyword queries with Elasticsearch syntax. Handles stemming and case variations automatically — do NOT try manual keyword variations.';
|
|
2852
2872
|
systemPrompt += `You have access to powerful code search and analysis tools through MCP:
|
|
2853
|
-
|
|
2873
|
+
${searchToolDesc1}
|
|
2854
2874
|
- extract: Extract specific code sections with context
|
|
2855
|
-
- query: Use AST patterns for structural code matching
|
|
2856
2875
|
- listFiles: Browse directory contents
|
|
2857
2876
|
- searchFiles: Find files by name patterns`;
|
|
2858
2877
|
|
|
2859
2878
|
if (this.enableBash) {
|
|
2860
|
-
systemPrompt += `\n- bash: Execute bash commands for system operations
|
|
2879
|
+
systemPrompt += `\n- bash: Execute bash commands for system operations (building, running tests, git, etc.). NEVER use bash for code exploration (no grep, cat, find, head, tail) — always use search and extract tools instead, they are faster and more accurate.`;
|
|
2861
2880
|
}
|
|
2862
2881
|
|
|
2863
|
-
const
|
|
2864
|
-
? '1. Start with search to
|
|
2865
|
-
: '1. Start with search to find relevant code patterns';
|
|
2866
|
-
const
|
|
2882
|
+
const searchGuidance1 = this.searchDelegate
|
|
2883
|
+
? '1. Start with search — ask a question about what you want to understand. It returns extracted code blocks directly.'
|
|
2884
|
+
: '1. Start with search to find relevant code patterns. One search per concept is usually enough — probe handles stemming and case variations.';
|
|
2885
|
+
const extractGuidance1 = this.searchDelegate
|
|
2867
2886
|
? '2. Use extract only if you need more context or a full file'
|
|
2868
2887
|
: '2. Use extract to get detailed context when needed';
|
|
2869
2888
|
|
|
2870
2889
|
systemPrompt += `\n
|
|
2871
2890
|
When exploring code:
|
|
2872
|
-
${
|
|
2873
|
-
${
|
|
2891
|
+
${searchGuidance1}
|
|
2892
|
+
${extractGuidance1}
|
|
2874
2893
|
3. Prefer focused, specific searches over broad queries
|
|
2875
|
-
4.
|
|
2894
|
+
4. Do NOT repeat the same search or try trivial keyword variations — probe handles stemming and case variations automatically
|
|
2895
|
+
5. If 2-3 consecutive searches return no results for a concept, stop searching for it — the term likely does not exist in that codebase
|
|
2896
|
+
6. Combine multiple tools to build complete understanding`;
|
|
2876
2897
|
|
|
2877
2898
|
// Add workspace context
|
|
2878
2899
|
if (this.allowedFolders && this.allowedFolders.length > 0) {
|
|
@@ -2911,30 +2932,34 @@ ${extractGuidance}
|
|
|
2911
2932
|
}
|
|
2912
2933
|
|
|
2913
2934
|
// Add high-level instructions about when to use tools
|
|
2935
|
+
const searchToolDesc2 = this.searchDelegate
|
|
2936
|
+
? '- search: Ask natural language questions to find code (e.g., "How does authentication work?"). A subagent handles keyword searches and returns extracted code blocks. Do NOT formulate keyword queries — just ask questions.'
|
|
2937
|
+
: '- search: Find code patterns using keyword queries with Elasticsearch syntax. Handles stemming and case variations automatically — do NOT try manual keyword variations.';
|
|
2914
2938
|
systemPrompt += `You have access to powerful code search and analysis tools through MCP:
|
|
2915
|
-
|
|
2939
|
+
${searchToolDesc2}
|
|
2916
2940
|
- extract: Extract specific code sections with context
|
|
2917
|
-
- query: Use AST patterns for structural code matching
|
|
2918
2941
|
- listFiles: Browse directory contents
|
|
2919
2942
|
- searchFiles: Find files by name patterns`;
|
|
2920
2943
|
|
|
2921
2944
|
if (this.enableBash) {
|
|
2922
|
-
systemPrompt += `\n- bash: Execute bash commands for system operations
|
|
2945
|
+
systemPrompt += `\n- bash: Execute bash commands for system operations (building, running tests, git, etc.). NEVER use bash for code exploration (no grep, cat, find, head, tail) — always use search and extract tools instead, they are faster and more accurate.`;
|
|
2923
2946
|
}
|
|
2924
2947
|
|
|
2925
|
-
const
|
|
2926
|
-
? '1. Start with search to
|
|
2927
|
-
: '1. Start with search to find relevant code patterns';
|
|
2928
|
-
const
|
|
2948
|
+
const searchGuidance2 = this.searchDelegate
|
|
2949
|
+
? '1. Start with search — ask a question about what you want to understand. It returns extracted code blocks directly.'
|
|
2950
|
+
: '1. Start with search to find relevant code patterns. One search per concept is usually enough — probe handles stemming and case variations.';
|
|
2951
|
+
const extractGuidance2 = this.searchDelegate
|
|
2929
2952
|
? '2. Use extract only if you need more context or a full file'
|
|
2930
2953
|
: '2. Use extract to get detailed context when needed';
|
|
2931
2954
|
|
|
2932
2955
|
systemPrompt += `\n
|
|
2933
2956
|
When exploring code:
|
|
2934
|
-
${
|
|
2935
|
-
${
|
|
2957
|
+
${searchGuidance2}
|
|
2958
|
+
${extractGuidance2}
|
|
2936
2959
|
3. Prefer focused, specific searches over broad queries
|
|
2937
|
-
4.
|
|
2960
|
+
4. Do NOT repeat the same search or try trivial keyword variations — probe handles stemming and case variations automatically
|
|
2961
|
+
5. If 2-3 consecutive searches return no results for a concept, stop searching for it — the term likely does not exist in that codebase
|
|
2962
|
+
6. Combine multiple tools to build complete understanding`;
|
|
2938
2963
|
|
|
2939
2964
|
// Add workspace context
|
|
2940
2965
|
if (this.allowedFolders && this.allowedFolders.length > 0) {
|
|
@@ -2990,10 +3015,11 @@ ${extractGuidance}
|
|
|
2990
3015
|
Follow these instructions carefully:
|
|
2991
3016
|
1. Analyze the user's request.
|
|
2992
3017
|
2. Use the available tools step-by-step to fulfill the request.
|
|
2993
|
-
3. You should always prefer the search tool for code-related questions.${this.searchDelegate ? '
|
|
3018
|
+
3. You should always prefer the search tool for code-related questions.${this.searchDelegate ? ' Ask natural language questions — the search subagent handles keyword formulation and returns extracted code blocks. Use extract only to expand context or read full files.' : ' Search handles stemming and case variations automatically — do NOT try keyword variations manually. Read full files only if really necessary.'}
|
|
2994
3019
|
4. Ensure to get really deep and understand the full picture before answering.
|
|
2995
3020
|
5. Once the task is fully completed, use the attempt_completion tool to provide the final result.
|
|
2996
|
-
6. Prefer concise and focused search queries. Use specific keywords and phrases to narrow down results
|
|
3021
|
+
6. ${this.searchDelegate ? 'Ask clear, specific questions when searching. Each search should target a distinct concept or question.' : 'Prefer concise and focused search queries. Use specific keywords and phrases to narrow down results.'}
|
|
3022
|
+
7. NEVER use bash for code exploration (no grep, cat, find, head, tail, awk, sed) — always use search and extract tools instead. Bash is only for system operations like building, running tests, or git commands.${this.allowEdit ? `
|
|
2997
3023
|
7. When modifying files, choose the appropriate tool:
|
|
2998
3024
|
- Use 'edit' for all code modifications:
|
|
2999
3025
|
* PREFERRED: Use start_line (and optionally end_line) for line-targeted editing — this is the safest and most precise approach.${this.hashLines ? ' Use the line:hash references from extract/search output (e.g. "42:ab") for integrity verification.' : ''} Always use extract first to see line numbers${this.hashLines ? ' and hashes' : ''}, then edit by line reference.
|
|
@@ -3010,22 +3036,30 @@ Follow these instructions carefully:
|
|
|
3010
3036
|
// Use predefined prompts from shared module (imported at top of file)
|
|
3011
3037
|
let systemMessage = '';
|
|
3012
3038
|
|
|
3013
|
-
//
|
|
3014
|
-
if (this.customPrompt) {
|
|
3039
|
+
// Build system message from predefined prompt + optional custom prompt
|
|
3040
|
+
if (this.customPrompt && this.promptType && predefinedPrompts[this.promptType]) {
|
|
3041
|
+
// Both: use predefined as base, append custom wrapped in tag
|
|
3042
|
+
systemMessage = "<role>" + predefinedPrompts[this.promptType] + "</role>";
|
|
3043
|
+
systemMessage += commonInstructions;
|
|
3044
|
+
systemMessage += "\n<custom-instructions>\n" + this.customPrompt + "\n</custom-instructions>";
|
|
3045
|
+
if (this.debug) {
|
|
3046
|
+
console.log(`[DEBUG] Using predefined prompt: ${this.promptType} + custom prompt`);
|
|
3047
|
+
}
|
|
3048
|
+
} else if (this.customPrompt) {
|
|
3049
|
+
// Only custom prompt
|
|
3015
3050
|
systemMessage = "<role>" + this.customPrompt + "</role>";
|
|
3016
3051
|
if (this.debug) {
|
|
3017
3052
|
console.log(`[DEBUG] Using custom prompt`);
|
|
3018
3053
|
}
|
|
3019
|
-
}
|
|
3020
|
-
|
|
3021
|
-
else if (this.promptType && predefinedPrompts[this.promptType]) {
|
|
3054
|
+
} else if (this.promptType && predefinedPrompts[this.promptType]) {
|
|
3055
|
+
// Only predefined prompt
|
|
3022
3056
|
systemMessage = "<role>" + predefinedPrompts[this.promptType] + "</role>";
|
|
3023
3057
|
if (this.debug) {
|
|
3024
3058
|
console.log(`[DEBUG] Using predefined prompt: ${this.promptType}`);
|
|
3025
3059
|
}
|
|
3026
3060
|
systemMessage += commonInstructions;
|
|
3027
3061
|
} else {
|
|
3028
|
-
//
|
|
3062
|
+
// Default: code explorer
|
|
3029
3063
|
systemMessage = "<role>" + predefinedPrompts['code-explorer'] + "</role>";
|
|
3030
3064
|
if (this.debug) {
|
|
3031
3065
|
console.log(`[DEBUG] Using default prompt: code explorer`);
|
|
@@ -284,6 +284,7 @@ export function generateSandboxGlobals(options) {
|
|
|
284
284
|
results.push(p);
|
|
285
285
|
|
|
286
286
|
if (executing.size >= mapConcurrency) {
|
|
287
|
+
console.error(`[map] Concurrency limit reached (${executing.size}/${mapConcurrency}), waiting for a slot...`);
|
|
287
288
|
await Promise.race(executing);
|
|
288
289
|
}
|
|
289
290
|
}
|