@probelabs/probe 0.6.0-rc307 → 0.6.0-rc309
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/README.md +25 -0
- package/bin/binaries/{probe-v0.6.0-rc307-aarch64-apple-darwin.tar.gz → probe-v0.6.0-rc309-aarch64-apple-darwin.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc307-aarch64-unknown-linux-musl.tar.gz → probe-v0.6.0-rc309-aarch64-unknown-linux-musl.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc307-x86_64-apple-darwin.tar.gz → probe-v0.6.0-rc309-x86_64-apple-darwin.tar.gz} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc307-x86_64-pc-windows-msvc.zip → probe-v0.6.0-rc309-x86_64-pc-windows-msvc.zip} +0 -0
- package/bin/binaries/{probe-v0.6.0-rc307-x86_64-unknown-linux-musl.tar.gz → probe-v0.6.0-rc309-x86_64-unknown-linux-musl.tar.gz} +0 -0
- package/build/agent/ProbeAgent.js +17 -4
- package/build/agent/probeTool.js +9 -0
- package/build/agent/shared/prompts.js +4 -1
- package/build/agent/tools.js +6 -0
- package/build/index.js +6 -1
- package/build/symbols.js +86 -0
- package/build/tools/common.js +4 -0
- package/build/tools/index.js +2 -1
- package/build/tools/system-message.js +4 -0
- package/build/tools/vercel.js +36 -1
- package/cjs/agent/ProbeAgent.cjs +180 -40
- package/cjs/index.cjs +188 -40
- package/index.d.ts +63 -0
- package/package.json +1 -1
- package/src/agent/ProbeAgent.js +17 -4
- package/src/agent/probeTool.js +9 -0
- package/src/agent/shared/prompts.js +4 -1
- package/src/agent/tools.js +6 -0
- package/src/index.js +6 -1
- package/src/symbols.js +86 -0
- package/src/tools/common.js +4 -0
- package/src/tools/index.js +2 -1
- package/src/tools/system-message.js +4 -0
- package/src/tools/vercel.js +36 -1
package/cjs/agent/ProbeAgent.cjs
CHANGED
|
@@ -26735,15 +26735,79 @@ var init_extract = __esm({
|
|
|
26735
26735
|
}
|
|
26736
26736
|
});
|
|
26737
26737
|
|
|
26738
|
+
// src/symbols.js
|
|
26739
|
+
async function symbols(options) {
|
|
26740
|
+
if (!options) {
|
|
26741
|
+
throw new Error("Options object is required");
|
|
26742
|
+
}
|
|
26743
|
+
if (!options.files || !Array.isArray(options.files) || options.files.length === 0) {
|
|
26744
|
+
throw new Error("At least one file path is required");
|
|
26745
|
+
}
|
|
26746
|
+
const binaryPath = await getBinaryPath(options.binaryOptions || {});
|
|
26747
|
+
const cwd = await validateCwdPath(options.cwd);
|
|
26748
|
+
const args = ["symbols", "--format", "json"];
|
|
26749
|
+
if (options.allowTests) {
|
|
26750
|
+
args.push("--allow-tests");
|
|
26751
|
+
}
|
|
26752
|
+
for (const file2 of options.files) {
|
|
26753
|
+
args.push(escapeString(file2));
|
|
26754
|
+
}
|
|
26755
|
+
if (process.env.DEBUG === "1") {
|
|
26756
|
+
console.error(`
|
|
26757
|
+
Symbols: files="${options.files.join(", ")}" cwd="${cwd}"`);
|
|
26758
|
+
}
|
|
26759
|
+
return new Promise((resolve9, reject2) => {
|
|
26760
|
+
const childProcess = (0, import_child_process5.spawn)(binaryPath, args, {
|
|
26761
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
26762
|
+
cwd
|
|
26763
|
+
});
|
|
26764
|
+
let stdout = "";
|
|
26765
|
+
let stderr = "";
|
|
26766
|
+
childProcess.stdout.on("data", (data2) => {
|
|
26767
|
+
stdout += data2.toString();
|
|
26768
|
+
});
|
|
26769
|
+
childProcess.stderr.on("data", (data2) => {
|
|
26770
|
+
stderr += data2.toString();
|
|
26771
|
+
});
|
|
26772
|
+
childProcess.on("close", (code) => {
|
|
26773
|
+
if (stderr && process.env.DEBUG === "1") {
|
|
26774
|
+
console.error(`stderr: ${stderr}`);
|
|
26775
|
+
}
|
|
26776
|
+
if (code !== 0) {
|
|
26777
|
+
reject2(new Error(`Symbols command failed with exit code ${code}: ${stderr}`));
|
|
26778
|
+
return;
|
|
26779
|
+
}
|
|
26780
|
+
try {
|
|
26781
|
+
const result = JSON.parse(stdout);
|
|
26782
|
+
resolve9(result);
|
|
26783
|
+
} catch (error40) {
|
|
26784
|
+
reject2(new Error(`Failed to parse symbols output: ${error40.message}. Output: ${stdout.substring(0, 200)}`));
|
|
26785
|
+
}
|
|
26786
|
+
});
|
|
26787
|
+
childProcess.on("error", (error40) => {
|
|
26788
|
+
reject2(new Error(`Failed to spawn symbols process: ${error40.message}`));
|
|
26789
|
+
});
|
|
26790
|
+
});
|
|
26791
|
+
}
|
|
26792
|
+
var import_child_process5;
|
|
26793
|
+
var init_symbols = __esm({
|
|
26794
|
+
"src/symbols.js"() {
|
|
26795
|
+
"use strict";
|
|
26796
|
+
import_child_process5 = require("child_process");
|
|
26797
|
+
init_utils();
|
|
26798
|
+
init_path_validation();
|
|
26799
|
+
}
|
|
26800
|
+
});
|
|
26801
|
+
|
|
26738
26802
|
// src/grep.js
|
|
26739
|
-
var
|
|
26803
|
+
var import_child_process6, import_util12, execFileAsync2;
|
|
26740
26804
|
var init_grep = __esm({
|
|
26741
26805
|
"src/grep.js"() {
|
|
26742
26806
|
"use strict";
|
|
26743
|
-
|
|
26807
|
+
import_child_process6 = require("child_process");
|
|
26744
26808
|
import_util12 = require("util");
|
|
26745
26809
|
init_utils();
|
|
26746
|
-
execFileAsync2 = (0, import_util12.promisify)(
|
|
26810
|
+
execFileAsync2 = (0, import_util12.promisify)(import_child_process6.execFile);
|
|
26747
26811
|
}
|
|
26748
26812
|
});
|
|
26749
26813
|
|
|
@@ -27906,7 +27970,7 @@ function resolveTargetPath(target, cwd) {
|
|
|
27906
27970
|
}
|
|
27907
27971
|
return filePart + suffix;
|
|
27908
27972
|
}
|
|
27909
|
-
var import_path6, searchDelegateSchema, searchSchema, searchAllSchema, querySchema, extractSchema, delegateSchema, listSkillsSchema, useSkillSchema, listFilesSchema, searchFilesSchema, readImageSchema, readMediaSchema, bashSchema, analyzeAllSchema, executePlanSchema, cleanupExecutePlanSchema, searchDescription, searchDelegateDescription, queryDescription, extractDescription, delegateDescription, analyzeAllDescription;
|
|
27973
|
+
var import_path6, searchDelegateSchema, searchSchema, searchAllSchema, querySchema, extractSchema, delegateSchema, listSkillsSchema, useSkillSchema, listFilesSchema, searchFilesSchema, readImageSchema, readMediaSchema, symbolsSchema, bashSchema, analyzeAllSchema, executePlanSchema, cleanupExecutePlanSchema, searchDescription, searchDelegateDescription, queryDescription, extractDescription, delegateDescription, analyzeAllDescription;
|
|
27910
27974
|
var init_common = __esm({
|
|
27911
27975
|
"src/tools/common.js"() {
|
|
27912
27976
|
"use strict";
|
|
@@ -27965,6 +28029,9 @@ var init_common = __esm({
|
|
|
27965
28029
|
readMediaSchema = external_exports2.object({
|
|
27966
28030
|
path: external_exports2.string().describe("Path to the media file to read. Supports images (png, jpg, jpeg, webp, bmp, svg) and documents (pdf).")
|
|
27967
28031
|
});
|
|
28032
|
+
symbolsSchema = external_exports2.object({
|
|
28033
|
+
file: external_exports2.string().describe("Path to the file to list symbols from. Returns a hierarchical tree of functions, classes, structs, constants, etc. with line numbers and nesting (e.g., methods inside classes/impl blocks).")
|
|
28034
|
+
});
|
|
27968
28035
|
bashSchema = external_exports2.object({
|
|
27969
28036
|
command: external_exports2.string().describe("The bash command to execute"),
|
|
27970
28037
|
workingDirectory: external_exports2.string().optional().describe("Directory to execute the command in (optional)"),
|
|
@@ -28381,7 +28448,7 @@ The "searches" field helps the caller understand what was attempted.
|
|
|
28381
28448
|
- Deduplicate files across groups.
|
|
28382
28449
|
</output-rules>`;
|
|
28383
28450
|
}
|
|
28384
|
-
var import_ai, import_fs5, CODE_SEARCH_SCHEMA, searchTool, queryTool, extractTool, delegateTool, analyzeAllTool;
|
|
28451
|
+
var import_ai, import_fs5, CODE_SEARCH_SCHEMA, searchTool, queryTool, extractTool, delegateTool, analyzeAllTool, symbolsTool;
|
|
28385
28452
|
var init_vercel = __esm({
|
|
28386
28453
|
"src/tools/vercel.js"() {
|
|
28387
28454
|
"use strict";
|
|
@@ -28389,6 +28456,7 @@ var init_vercel = __esm({
|
|
|
28389
28456
|
init_search();
|
|
28390
28457
|
init_query();
|
|
28391
28458
|
init_extract();
|
|
28459
|
+
init_symbols();
|
|
28392
28460
|
init_delegate();
|
|
28393
28461
|
init_analyzeAll();
|
|
28394
28462
|
init_common();
|
|
@@ -29111,6 +29179,36 @@ Do NOT search for analogies or loosely related concepts. If the feature does not
|
|
|
29111
29179
|
}
|
|
29112
29180
|
});
|
|
29113
29181
|
};
|
|
29182
|
+
symbolsTool = (options = {}) => {
|
|
29183
|
+
return (0, import_ai.tool)({
|
|
29184
|
+
name: "symbols",
|
|
29185
|
+
description: "List all symbols (functions, classes, structs, constants, etc.) in a file. Returns a hierarchical tree with line numbers \u2014 like a table of contents for code files.",
|
|
29186
|
+
inputSchema: symbolsSchema,
|
|
29187
|
+
execute: async ({ file: file2 }) => {
|
|
29188
|
+
try {
|
|
29189
|
+
let filePath = file2;
|
|
29190
|
+
if (options.cwd) {
|
|
29191
|
+
const resolvedPaths = parseAndResolvePaths(file2, options.cwd);
|
|
29192
|
+
if (resolvedPaths.length > 0) {
|
|
29193
|
+
filePath = resolvedPaths[0];
|
|
29194
|
+
}
|
|
29195
|
+
}
|
|
29196
|
+
const result = await symbols({
|
|
29197
|
+
files: [filePath],
|
|
29198
|
+
cwd: options.cwd,
|
|
29199
|
+
binaryOptions: options.binaryOptions
|
|
29200
|
+
});
|
|
29201
|
+
if (result && result.length > 0) {
|
|
29202
|
+
return JSON.stringify(result[0], null, 2);
|
|
29203
|
+
}
|
|
29204
|
+
return JSON.stringify({ file: file2, symbols: [] }, null, 2);
|
|
29205
|
+
} catch (error40) {
|
|
29206
|
+
console.error("Error executing symbols:", error40);
|
|
29207
|
+
return formatErrorForAI(error40);
|
|
29208
|
+
}
|
|
29209
|
+
}
|
|
29210
|
+
});
|
|
29211
|
+
};
|
|
29114
29212
|
}
|
|
29115
29213
|
});
|
|
29116
29214
|
|
|
@@ -30589,7 +30687,7 @@ async function executeBashCommand(command, options = {}) {
|
|
|
30589
30687
|
[cmd, ...cmdArgs] = args;
|
|
30590
30688
|
useShell = false;
|
|
30591
30689
|
}
|
|
30592
|
-
const child = (0,
|
|
30690
|
+
const child = (0, import_child_process7.spawn)(cmd, cmdArgs, {
|
|
30593
30691
|
cwd,
|
|
30594
30692
|
env: processEnv,
|
|
30595
30693
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -30785,11 +30883,11 @@ function validateExecutionOptions(options = {}) {
|
|
|
30785
30883
|
warnings
|
|
30786
30884
|
};
|
|
30787
30885
|
}
|
|
30788
|
-
var
|
|
30886
|
+
var import_child_process7, import_path7, import_fs6;
|
|
30789
30887
|
var init_bashExecutor = __esm({
|
|
30790
30888
|
"src/agent/bashExecutor.js"() {
|
|
30791
30889
|
"use strict";
|
|
30792
|
-
|
|
30890
|
+
import_child_process7 = require("child_process");
|
|
30793
30891
|
import_path7 = require("path");
|
|
30794
30892
|
import_fs6 = require("fs");
|
|
30795
30893
|
init_bashCommandUtils();
|
|
@@ -49512,6 +49610,10 @@ You are Probe, a specialized code intelligence assistant. Your objective is to a
|
|
|
49512
49610
|
* **Purpose:** Retrieve specific code blocks or entire files *after* \`search\` or \`query\` identifies the target.
|
|
49513
49611
|
* **Syntax:** Optional \`#symbol\` (e.g., \`#MyClass\`), \`#Lstart-Lend\` (e.g., \`#L50-L75\`).
|
|
49514
49612
|
* **Mandatory Argument:** \`path\` (specific file path, e.g., \`"src/utils/helpers.go"\`, or dependency file like \`"go:github.com/gin-gonic/gin/context.go"\`).
|
|
49613
|
+
* \`symbols\`
|
|
49614
|
+
* **Purpose:** List all symbols (functions, classes, structs, constants, etc.) in a file \u2014 a table of contents with line numbers and nesting.
|
|
49615
|
+
* **Syntax:** \`file\` (path to the file to list symbols from).
|
|
49616
|
+
* **Use When:** You need to understand a file's structure before extracting specific parts, or to find the right symbol name/line number for \`extract\`.
|
|
49515
49617
|
|
|
49516
49618
|
[Examples]
|
|
49517
49619
|
|
|
@@ -49728,16 +49830,16 @@ function shouldIgnore(filePath, ignorePatterns) {
|
|
|
49728
49830
|
}
|
|
49729
49831
|
return false;
|
|
49730
49832
|
}
|
|
49731
|
-
var import_fs10, import_path10, import_util13,
|
|
49833
|
+
var import_fs10, import_path10, import_util13, import_child_process8, execAsync3;
|
|
49732
49834
|
var init_file_lister = __esm({
|
|
49733
49835
|
"src/utils/file-lister.js"() {
|
|
49734
49836
|
"use strict";
|
|
49735
49837
|
import_fs10 = __toESM(require("fs"), 1);
|
|
49736
49838
|
import_path10 = __toESM(require("path"), 1);
|
|
49737
49839
|
import_util13 = require("util");
|
|
49738
|
-
|
|
49840
|
+
import_child_process8 = require("child_process");
|
|
49739
49841
|
init_symlink_utils();
|
|
49740
|
-
execAsync3 = (0, import_util13.promisify)(
|
|
49842
|
+
execAsync3 = (0, import_util13.promisify)(import_child_process8.exec);
|
|
49741
49843
|
}
|
|
49742
49844
|
});
|
|
49743
49845
|
|
|
@@ -50138,14 +50240,21 @@ function createWrappedTools(baseTools) {
|
|
|
50138
50240
|
baseTools.multiEditTool.execute
|
|
50139
50241
|
);
|
|
50140
50242
|
}
|
|
50243
|
+
if (baseTools.symbolsTool) {
|
|
50244
|
+
wrappedTools.symbolsToolInstance = wrapToolWithEmitter(
|
|
50245
|
+
baseTools.symbolsTool,
|
|
50246
|
+
"symbols",
|
|
50247
|
+
baseTools.symbolsTool.execute
|
|
50248
|
+
);
|
|
50249
|
+
}
|
|
50141
50250
|
return wrappedTools;
|
|
50142
50251
|
}
|
|
50143
|
-
var
|
|
50252
|
+
var import_child_process9, import_util14, import_crypto4, import_events, import_fs11, import_fs12, import_path12, toolCallEmitter, activeToolExecutions, wrapToolWithEmitter, listFilesTool, searchFilesTool, listFilesToolInstance, searchFilesToolInstance;
|
|
50144
50253
|
var init_probeTool = __esm({
|
|
50145
50254
|
"src/agent/probeTool.js"() {
|
|
50146
50255
|
"use strict";
|
|
50147
50256
|
init_index();
|
|
50148
|
-
|
|
50257
|
+
import_child_process9 = require("child_process");
|
|
50149
50258
|
import_util14 = require("util");
|
|
50150
50259
|
import_crypto4 = require("crypto");
|
|
50151
50260
|
import_events = require("events");
|
|
@@ -51190,6 +51299,7 @@ var init_index = __esm({
|
|
|
51190
51299
|
init_search();
|
|
51191
51300
|
init_query();
|
|
51192
51301
|
init_extract();
|
|
51302
|
+
init_symbols();
|
|
51193
51303
|
init_grep();
|
|
51194
51304
|
init_delegate();
|
|
51195
51305
|
init_utils();
|
|
@@ -51229,6 +51339,9 @@ function createTools(configOptions) {
|
|
|
51229
51339
|
if (isToolAllowed("extract")) {
|
|
51230
51340
|
tools2.extractTool = extractTool(configOptions);
|
|
51231
51341
|
}
|
|
51342
|
+
if (isToolAllowed("symbols")) {
|
|
51343
|
+
tools2.symbolsTool = symbolsTool(configOptions);
|
|
51344
|
+
}
|
|
51232
51345
|
if (configOptions.enableDelegate && isToolAllowed("delegate")) {
|
|
51233
51346
|
tools2.delegateTool = delegateTool(configOptions);
|
|
51234
51347
|
}
|
|
@@ -89705,6 +89818,7 @@ CRITICAL - ALWAYS search before answering:
|
|
|
89705
89818
|
You must NEVER answer questions about the codebase from memory or general knowledge. ALWAYS use the search and extract tools first to find the actual code, then base your answer ONLY on what you found. Even if you think you know the answer, you MUST verify it against the actual code. Your answers must be grounded in code evidence, not assumptions.
|
|
89706
89819
|
|
|
89707
89820
|
When exploring code:
|
|
89821
|
+
- Use the symbols tool to get a quick overview of a file's structure (functions, classes, constants) before diving into details with extract
|
|
89708
89822
|
- Provide clear, concise explanations based on user request
|
|
89709
89823
|
- Find and highlight the most relevant code snippets, if required
|
|
89710
89824
|
- Trace function calls and data flow through the system \u2014 follow the FULL call chain, not just the entry point
|
|
@@ -89735,6 +89849,7 @@ You think like a code explorer \u2014 you understand that codebases have layers:
|
|
|
89735
89849
|
|
|
89736
89850
|
When searching:
|
|
89737
89851
|
- Search for the MAIN concept first, then think: "what RELATED subsystems would a real codebase have?"
|
|
89852
|
+
- Use symbols to get a file's table of contents (functions, classes, constants with line numbers) before extracting \u2014 it helps you pick the right symbols to extract
|
|
89738
89853
|
- Use extract to READ the code you find \u2014 look for function calls, type references, and imports that point to OTHER relevant code
|
|
89739
89854
|
- If you find middleware, check: are there org-level or tenant-level variants?
|
|
89740
89855
|
- If you find algorithms, check: are there different storage backends?
|
|
@@ -89778,6 +89893,7 @@ If the solution is clear, you can jump to implementation right away. If not, ask
|
|
|
89778
89893
|
- Do not add code comments unless the logic is genuinely complex and non-obvious.
|
|
89779
89894
|
|
|
89780
89895
|
# Before Implementation
|
|
89896
|
+
- Use symbols to get a quick overview of file structure (functions, classes, constants with line numbers) before reading or editing files.
|
|
89781
89897
|
- Read tests first \u2014 find existing test files for the module you're changing. They reveal expected behavior, edge cases, and the project's testing patterns.
|
|
89782
89898
|
- Read neighboring files \u2014 understand naming conventions, error handling patterns, import style, and existing utilities before creating new ones.
|
|
89783
89899
|
- Trace the call chain \u2014 follow how the code you're changing is called and what depends on it. Check interfaces, types, and consumers.
|
|
@@ -89814,7 +89930,7 @@ Use the right tool:
|
|
|
89814
89930
|
1. To MODIFY existing code \u2192 \`edit\` tool (old_string \u2192 new_string, or start_line/end_line)
|
|
89815
89931
|
2. To CREATE a new file \u2192 \`create\` tool
|
|
89816
89932
|
3. To CHANGE multiple files at once \u2192 \`multi_edit\` tool
|
|
89817
|
-
4. To READ code \u2192 \`extract\` or \`search\` tools
|
|
89933
|
+
4. To READ code \u2192 \`extract\` or \`search\` tools. Use \`symbols\` to get a file's table of contents (functions, classes, constants with line numbers) before extracting.
|
|
89818
89934
|
5. If \`edit\` fails with "file has not been read yet" \u2192 use \`extract\` with the EXACT same file path you will pass to \`edit\`. Relative vs absolute path mismatch causes this error. Use the same path format consistently. If it still fails, use bash \`cat\` to read the file, then use \`create\` to write the entire modified file. Do NOT fall back to sed.
|
|
89819
89935
|
|
|
89820
89936
|
Bash is fine for: formatters (gofmt, prettier, black), build/test/lint commands, git operations, and read-only file inspection (cat, head, tail). sed/awk should ONLY be used for trivial non-code tasks (e.g., config file tweaks) where the replacement is a simple literal string swap.
|
|
@@ -92268,6 +92384,7 @@ var require_stringify = __commonJS({
|
|
|
92268
92384
|
nullStr: "null",
|
|
92269
92385
|
simpleKeys: false,
|
|
92270
92386
|
singleQuote: null,
|
|
92387
|
+
trailingComma: false,
|
|
92271
92388
|
trueStr: "true",
|
|
92272
92389
|
verifyAliasOrder: true
|
|
92273
92390
|
}, doc.schema.toStringOptions, options);
|
|
@@ -92785,12 +92902,19 @@ ${indent}${line}` : "\n";
|
|
|
92785
92902
|
if (comment)
|
|
92786
92903
|
reqNewline = true;
|
|
92787
92904
|
let str = stringify.stringify(item, itemCtx, () => comment = null);
|
|
92788
|
-
|
|
92905
|
+
reqNewline || (reqNewline = lines.length > linesAtValue || str.includes("\n"));
|
|
92906
|
+
if (i < items.length - 1) {
|
|
92789
92907
|
str += ",";
|
|
92908
|
+
} else if (ctx.options.trailingComma) {
|
|
92909
|
+
if (ctx.options.lineWidth > 0) {
|
|
92910
|
+
reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (str.length + 2) > ctx.options.lineWidth);
|
|
92911
|
+
}
|
|
92912
|
+
if (reqNewline) {
|
|
92913
|
+
str += ",";
|
|
92914
|
+
}
|
|
92915
|
+
}
|
|
92790
92916
|
if (comment)
|
|
92791
92917
|
str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
|
|
92792
|
-
if (!reqNewline && (lines.length > linesAtValue || str.includes("\n")))
|
|
92793
|
-
reqNewline = true;
|
|
92794
92918
|
lines.push(str);
|
|
92795
92919
|
linesAtValue = lines.length;
|
|
92796
92920
|
}
|
|
@@ -95804,17 +95928,22 @@ var require_compose_node = __commonJS({
|
|
|
95804
95928
|
case "block-map":
|
|
95805
95929
|
case "block-seq":
|
|
95806
95930
|
case "flow-collection":
|
|
95807
|
-
|
|
95808
|
-
|
|
95809
|
-
|
|
95931
|
+
try {
|
|
95932
|
+
node = composeCollection.composeCollection(CN, ctx, token, props, onError);
|
|
95933
|
+
if (anchor)
|
|
95934
|
+
node.anchor = anchor.source.substring(1);
|
|
95935
|
+
} catch (error40) {
|
|
95936
|
+
const message = error40 instanceof Error ? error40.message : String(error40);
|
|
95937
|
+
onError(token, "RESOURCE_EXHAUSTION", message);
|
|
95938
|
+
}
|
|
95810
95939
|
break;
|
|
95811
95940
|
default: {
|
|
95812
95941
|
const message = token.type === "error" ? token.message : `Unsupported token (type: ${token.type})`;
|
|
95813
95942
|
onError(token, "UNEXPECTED_TOKEN", message);
|
|
95814
|
-
node = composeEmptyNode(ctx, token.offset, void 0, null, props, onError);
|
|
95815
95943
|
isSrcToken = false;
|
|
95816
95944
|
}
|
|
95817
95945
|
}
|
|
95946
|
+
node ?? (node = composeEmptyNode(ctx, token.offset, void 0, null, props, onError));
|
|
95818
95947
|
if (anchor && node.anchor === "")
|
|
95819
95948
|
onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
|
|
95820
95949
|
if (atKey && ctx.options.stringKeys && (!identity2.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) {
|
|
@@ -100182,7 +100311,7 @@ ${opts.schema}`;
|
|
|
100182
100311
|
}
|
|
100183
100312
|
}
|
|
100184
100313
|
const toolCollector = [];
|
|
100185
|
-
const proc2 = (0,
|
|
100314
|
+
const proc2 = (0, import_child_process10.spawn)("sh", ["-c", shellCmd], {
|
|
100186
100315
|
env: { ...process.env, FORCE_COLOR: "0" },
|
|
100187
100316
|
stdio: ["ignore", "pipe", "pipe"]
|
|
100188
100317
|
// Ignore stdin since echo handles it
|
|
@@ -100537,11 +100666,11 @@ function combinePrompts(systemPrompt, customPrompt, agent) {
|
|
|
100537
100666
|
}
|
|
100538
100667
|
return systemPrompt || "";
|
|
100539
100668
|
}
|
|
100540
|
-
var
|
|
100669
|
+
var import_child_process10, import_crypto7, import_promises5, import_path17, import_os5, import_events3;
|
|
100541
100670
|
var init_enhanced_claude_code = __esm({
|
|
100542
100671
|
"src/agent/engines/enhanced-claude-code.js"() {
|
|
100543
100672
|
"use strict";
|
|
100544
|
-
|
|
100673
|
+
import_child_process10 = require("child_process");
|
|
100545
100674
|
import_crypto7 = require("crypto");
|
|
100546
100675
|
import_promises5 = __toESM(require("fs/promises"), 1);
|
|
100547
100676
|
import_path17 = __toESM(require("path"), 1);
|
|
@@ -100583,7 +100712,7 @@ async function createCodexEngine(options = {}) {
|
|
|
100583
100712
|
if (debug) {
|
|
100584
100713
|
console.log("[DEBUG] Starting Codex MCP server...");
|
|
100585
100714
|
}
|
|
100586
|
-
const codexProcess = (0,
|
|
100715
|
+
const codexProcess = (0, import_child_process11.spawn)("codex", ["mcp-server"], {
|
|
100587
100716
|
stdio: ["pipe", "pipe", "pipe"]
|
|
100588
100717
|
});
|
|
100589
100718
|
let requestId = 0;
|
|
@@ -100815,11 +100944,11 @@ function combinePrompts2(systemPrompt, customPrompt, agent) {
|
|
|
100815
100944
|
}
|
|
100816
100945
|
return systemPrompt || "";
|
|
100817
100946
|
}
|
|
100818
|
-
var
|
|
100947
|
+
var import_child_process11, import_crypto8, import_readline;
|
|
100819
100948
|
var init_codex = __esm({
|
|
100820
100949
|
"src/agent/engines/codex.js"() {
|
|
100821
100950
|
"use strict";
|
|
100822
|
-
|
|
100951
|
+
import_child_process11 = require("child_process");
|
|
100823
100952
|
import_crypto8 = require("crypto");
|
|
100824
100953
|
import_readline = require("readline");
|
|
100825
100954
|
init_built_in_server();
|
|
@@ -101585,6 +101714,9 @@ var init_ProbeAgent = __esm({
|
|
|
101585
101714
|
if (isToolAllowed("searchFiles")) {
|
|
101586
101715
|
this.toolImplementations.searchFiles = searchFilesToolInstance;
|
|
101587
101716
|
}
|
|
101717
|
+
if (wrappedTools.symbolsToolInstance && isToolAllowed("symbols")) {
|
|
101718
|
+
this.toolImplementations.symbols = wrappedTools.symbolsToolInstance;
|
|
101719
|
+
}
|
|
101588
101720
|
if (this.enableSkills) {
|
|
101589
101721
|
const registry2 = this._getSkillsRegistry();
|
|
101590
101722
|
const { listSkillsToolInstance, useSkillToolInstance } = createSkillToolInstances({
|
|
@@ -102616,6 +102748,10 @@ var init_ProbeAgent = __esm({
|
|
|
102616
102748
|
schema: searchFilesSchema,
|
|
102617
102749
|
description: "Find files matching a glob pattern with recursive search capability."
|
|
102618
102750
|
},
|
|
102751
|
+
symbols: {
|
|
102752
|
+
schema: symbolsSchema,
|
|
102753
|
+
description: "List all symbols (functions, classes, structs, constants, etc.) in a file. Returns a hierarchical tree with line numbers \u2014 like a table of contents for code."
|
|
102754
|
+
},
|
|
102619
102755
|
readMedia: {
|
|
102620
102756
|
schema: readMediaSchema,
|
|
102621
102757
|
description: "Read and load a media file (image or PDF document) for AI analysis. Supports: png, jpg, jpeg, webp, bmp, svg, pdf."
|
|
@@ -103271,7 +103407,8 @@ ${this.architectureContext.content}
|
|
|
103271
103407
|
${searchToolDesc1}
|
|
103272
103408
|
- extract: Extract specific code sections with context
|
|
103273
103409
|
- listFiles: Browse directory contents
|
|
103274
|
-
- searchFiles: Find files by name patterns
|
|
103410
|
+
- searchFiles: Find files by name patterns
|
|
103411
|
+
- symbols: List all symbols in a file (functions, classes, constants, etc.) with line numbers`;
|
|
103275
103412
|
if (this.enableBash) {
|
|
103276
103413
|
systemPrompt += `
|
|
103277
103414
|
- bash: Execute bash commands for system operations (building, running tests, git, etc.). NEVER use bash for code exploration (no grep, cat, find, head, tail) \u2014 always use search and extract tools instead, they are faster and more accurate.`;
|
|
@@ -103326,7 +103463,8 @@ Workspace: ${this.allowedFolders.join(", ")}`;
|
|
|
103326
103463
|
${searchToolDesc2}
|
|
103327
103464
|
- extract: Extract specific code sections with context
|
|
103328
103465
|
- listFiles: Browse directory contents
|
|
103329
|
-
- searchFiles: Find files by name patterns
|
|
103466
|
+
- searchFiles: Find files by name patterns
|
|
103467
|
+
- symbols: List all symbols in a file (functions, classes, constants, etc.) with line numbers`;
|
|
103330
103468
|
if (this.enableBash) {
|
|
103331
103469
|
systemPrompt += `
|
|
103332
103470
|
- bash: Execute bash commands for system operations (building, running tests, git, etc.). NEVER use bash for code exploration (no grep, cat, find, head, tail) \u2014 always use search and extract tools instead, they are faster and more accurate.`;
|
|
@@ -103905,40 +104043,42 @@ or
|
|
|
103905
104043
|
}
|
|
103906
104044
|
const jsonStr = responseText.replace(/^```(?:json)?\s*/, "").replace(/\s*```$/, "");
|
|
103907
104045
|
const decision = JSON.parse(jsonStr);
|
|
104046
|
+
let grantedMs = 0;
|
|
104047
|
+
let grantedMin = 0;
|
|
103908
104048
|
if (decision.extend && decision.minutes > 0) {
|
|
103909
104049
|
const requestedMs = Math.min(decision.minutes, maxPerReqMin) * 6e4;
|
|
103910
|
-
|
|
103911
|
-
|
|
104050
|
+
grantedMs = Math.min(requestedMs, remainingBudgetMs, negotiatedTimeoutState.maxPerRequestMs);
|
|
104051
|
+
grantedMin = Math.round(grantedMs / 6e4 * 10) / 10;
|
|
103912
104052
|
negotiatedTimeoutState.extensionsUsed++;
|
|
103913
|
-
negotiatedTimeoutState.totalExtraTimeMs +=
|
|
103914
|
-
negotiatedTimeoutState.extensionMessage = `\u23F0 Time limit was reached. The timeout observer granted ${
|
|
104053
|
+
negotiatedTimeoutState.totalExtraTimeMs += grantedMs;
|
|
104054
|
+
negotiatedTimeoutState.extensionMessage = `\u23F0 Time limit was reached. The timeout observer granted ${grantedMin} more minute(s) (reason: ${decision.reason || "work in progress"}). Extensions remaining: ${negotiatedTimeoutState.maxRequests - negotiatedTimeoutState.extensionsUsed}. Continue your work efficiently.`;
|
|
103915
104055
|
negotiatedTimeoutState.softTimeoutId = setTimeout(() => {
|
|
103916
104056
|
runTimeoutObserver();
|
|
103917
|
-
},
|
|
104057
|
+
}, grantedMs);
|
|
103918
104058
|
if (this.debug) {
|
|
103919
|
-
console.log(`[DEBUG] Timeout observer: granted ${
|
|
104059
|
+
console.log(`[DEBUG] Timeout observer: granted ${grantedMin} min (reason: ${decision.reason}). Extensions: ${negotiatedTimeoutState.extensionsUsed}/${negotiatedTimeoutState.maxRequests}`);
|
|
103920
104060
|
}
|
|
103921
104061
|
if (this.tracer) {
|
|
103922
104062
|
this.tracer.addEvent("negotiated_timeout.observer_extended", {
|
|
103923
104063
|
decision_reason: decision.reason,
|
|
103924
104064
|
requested_minutes: decision.minutes,
|
|
103925
|
-
granted_ms:
|
|
103926
|
-
granted_min:
|
|
104065
|
+
granted_ms: grantedMs,
|
|
104066
|
+
granted_min: grantedMin,
|
|
103927
104067
|
extensions_used: negotiatedTimeoutState.extensionsUsed,
|
|
103928
104068
|
max_requests: negotiatedTimeoutState.maxRequests,
|
|
103929
104069
|
total_extra_time_ms: negotiatedTimeoutState.totalExtraTimeMs,
|
|
103930
|
-
budget_remaining_ms: remainingBudgetMs -
|
|
104070
|
+
budget_remaining_ms: remainingBudgetMs - grantedMs,
|
|
103931
104071
|
active_tools: activeToolsList.map((t) => t.name),
|
|
103932
104072
|
active_tools_count: activeToolsList.length
|
|
103933
104073
|
});
|
|
103934
104074
|
}
|
|
103935
104075
|
this.events.emit("timeout.extended", {
|
|
103936
|
-
grantedMs
|
|
104076
|
+
grantedMs,
|
|
103937
104077
|
reason: decision.reason || "work in progress",
|
|
103938
104078
|
extensionsUsed: negotiatedTimeoutState.extensionsUsed,
|
|
103939
104079
|
extensionsRemaining: negotiatedTimeoutState.maxRequests - negotiatedTimeoutState.extensionsUsed,
|
|
103940
104080
|
totalExtraTimeMs: negotiatedTimeoutState.totalExtraTimeMs,
|
|
103941
|
-
budgetRemainingMs: remainingBudgetMs -
|
|
104081
|
+
budgetRemainingMs: remainingBudgetMs - grantedMs
|
|
103942
104082
|
});
|
|
103943
104083
|
} else {
|
|
103944
104084
|
if (this.debug) {
|