@probelabs/probe 0.6.0-rc79 → 0.6.0-rc80
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/build/agent/index.js +53 -10
- package/build/tools/common.js +43 -10
- package/cjs/agent/ProbeAgent.cjs +53 -10
- package/cjs/index.cjs +53 -10
- package/package.json +1 -1
- package/src/tools/common.js +43 -10
package/build/agent/index.js
CHANGED
|
@@ -1440,11 +1440,24 @@ function parseXmlToolCall(xmlString, validTools = DEFAULT_VALID_TOOLS) {
|
|
|
1440
1440
|
"recursive",
|
|
1441
1441
|
"includeHidden",
|
|
1442
1442
|
"max_results",
|
|
1443
|
+
"maxResults",
|
|
1443
1444
|
"result",
|
|
1444
1445
|
"command",
|
|
1445
1446
|
"description",
|
|
1446
1447
|
"task",
|
|
1447
|
-
"param"
|
|
1448
|
+
"param",
|
|
1449
|
+
"pattern",
|
|
1450
|
+
"allow_tests",
|
|
1451
|
+
"exact",
|
|
1452
|
+
"maxTokens",
|
|
1453
|
+
"language",
|
|
1454
|
+
"input_content",
|
|
1455
|
+
"context_lines",
|
|
1456
|
+
"format",
|
|
1457
|
+
"directory",
|
|
1458
|
+
"autoCommits",
|
|
1459
|
+
"files",
|
|
1460
|
+
"targets"
|
|
1448
1461
|
];
|
|
1449
1462
|
for (const paramName of commonParams) {
|
|
1450
1463
|
const paramOpenTag = `<${paramName}>`;
|
|
@@ -1534,7 +1547,7 @@ var init_common = __esm({
|
|
|
1534
1547
|
allow_tests: z.boolean().optional().default(false).describe("Allow test files in search results")
|
|
1535
1548
|
});
|
|
1536
1549
|
extractSchema = z.object({
|
|
1537
|
-
|
|
1550
|
+
targets: z.string().optional().describe("File paths or symbols to extract from. Can include line numbers, symbol names, or multiple space-separated targets"),
|
|
1538
1551
|
input_content: z.string().optional().describe("Text content to extract file paths from"),
|
|
1539
1552
|
line: z.number().optional().describe("Start line number to extract a specific code block"),
|
|
1540
1553
|
end_line: z.number().optional().describe("End line number for extracting a range of lines"),
|
|
@@ -1602,6 +1615,12 @@ var init_common = __esm({
|
|
|
1602
1615
|
Description: Search code in the repository using Elasticsearch query syntax (except field based queries, e.g. "filename:..." NOT supported).
|
|
1603
1616
|
|
|
1604
1617
|
You need to focus on main keywords when constructing the query, and always use elastic search syntax like OR AND and brackets to group keywords.
|
|
1618
|
+
|
|
1619
|
+
**Session Management & Caching:**
|
|
1620
|
+
- Ensure not to re-read the same symbols twice - reuse context from previous tool calls
|
|
1621
|
+
- Probe returns a session ID on first run - reuse it for subsequent calls to avoid redundant searches
|
|
1622
|
+
- Once data is returned, it's cached and won't return on next runs (this is expected behavior)
|
|
1623
|
+
|
|
1605
1624
|
Parameters:
|
|
1606
1625
|
- query: (required) Search query with Elasticsearch syntax. You can use + for important terms, and - for negation.
|
|
1607
1626
|
- path: (required) Path to search in. All dependencies located in /dep folder, under language sub folders, like this: "/dep/go/github.com/owner/repo", "/dep/js/package_name", or "/dep/rust/cargo_name" etc. YOU SHOULD ALWAYS provide FULL PATH when searching dependencies, including depency name.
|
|
@@ -1611,11 +1630,22 @@ Parameters:
|
|
|
1611
1630
|
- maxTokens: (optional, default: 10000) Maximum number of tokens to return (number).
|
|
1612
1631
|
- language: (optional) Limit search to files of a specific programming language (e.g., 'rust', 'js', 'python', 'go' etc.).
|
|
1613
1632
|
|
|
1633
|
+
**Workflow:** Always start with search, then use extract for detailed context when needed.
|
|
1614
1634
|
|
|
1615
1635
|
Usage Example:
|
|
1616
1636
|
|
|
1617
1637
|
<examples>
|
|
1618
1638
|
|
|
1639
|
+
User: Where is the login logic?
|
|
1640
|
+
Assistant workflow:
|
|
1641
|
+
1. <search>
|
|
1642
|
+
<query>login AND auth AND token</query>
|
|
1643
|
+
<path>.</path>
|
|
1644
|
+
</search>
|
|
1645
|
+
2. Now lets look closer: <extract>
|
|
1646
|
+
<targets>session.rs#AuthService.login auth.rs:2-100</targets>
|
|
1647
|
+
</extract>
|
|
1648
|
+
|
|
1619
1649
|
User: How to calculate the total amount in the payments module?
|
|
1620
1650
|
<search>
|
|
1621
1651
|
<query>calculate AND payment</query>
|
|
@@ -1639,7 +1669,6 @@ User: Find all react imports in the project.
|
|
|
1639
1669
|
<language>js</language>
|
|
1640
1670
|
</search>
|
|
1641
1671
|
|
|
1642
|
-
|
|
1643
1672
|
User: Find how decompoud library works?
|
|
1644
1673
|
<search>
|
|
1645
1674
|
<query>import { react }</query>
|
|
@@ -1671,11 +1700,16 @@ Usage Example:
|
|
|
1671
1700
|
`;
|
|
1672
1701
|
extractToolDefinition = `
|
|
1673
1702
|
## extract
|
|
1674
|
-
Description: Extract code blocks from files based on file paths and optional line numbers. Use this tool to see complete context after finding relevant files. It can be used to read full files as well.
|
|
1703
|
+
Description: Extract code blocks from files based on file paths and optional line numbers. Use this tool to see complete context after finding relevant files. It can be used to read full files as well.
|
|
1675
1704
|
Full file extraction should be the LAST RESORT! Always prefer search.
|
|
1676
1705
|
|
|
1706
|
+
**Multiple Extraction:** You can extract multiple symbols/files in one call by providing multiple file paths separated by spaces.
|
|
1707
|
+
|
|
1708
|
+
**Session Awareness:** Reuse context from previous tool calls. Don't re-extract the same symbols you already have.
|
|
1709
|
+
|
|
1677
1710
|
Parameters:
|
|
1678
|
-
-
|
|
1711
|
+
- targets: (required) File paths or symbols to extract from. Can include line numbers, symbol names, or multiple space-separated targets (e.g., 'src/main.rs:10-20', 'src/utils.js#myFunction').
|
|
1712
|
+
For multiple extractions: 'session.rs#AuthService.login auth.rs:2-100 config.rs#DatabaseConfig'
|
|
1679
1713
|
- line: (optional) Start line number to extract a specific code block. Use with end_line for ranges.
|
|
1680
1714
|
- end_line: (optional) End line number for extracting a range of lines.
|
|
1681
1715
|
- allow_tests: (optional, default: false) Allow test files and test code blocks (true/false).
|
|
@@ -1683,29 +1717,38 @@ Usage Example:
|
|
|
1683
1717
|
|
|
1684
1718
|
<examples>
|
|
1685
1719
|
|
|
1720
|
+
User: Where is the login logic? (After search found relevant files)
|
|
1721
|
+
<extract>
|
|
1722
|
+
<targets>session.rs#AuthService.login auth.rs:2-100 config.rs#DatabaseConfig</targets>
|
|
1723
|
+
</extract>
|
|
1724
|
+
|
|
1725
|
+
User: How does error handling work? (After search identified files)
|
|
1726
|
+
<extract>
|
|
1727
|
+
<targets>error.rs#ErrorType utils.rs#handle_error src/main.rs:50-80</targets>
|
|
1728
|
+
</extract>
|
|
1729
|
+
|
|
1686
1730
|
User: How RankManager works
|
|
1687
1731
|
<extract>
|
|
1688
|
-
<
|
|
1732
|
+
<targets>src/search/ranking.rs#RankManager</targets>
|
|
1689
1733
|
</extract>
|
|
1690
1734
|
|
|
1691
1735
|
User: Lets read the whole file
|
|
1692
1736
|
<extract>
|
|
1693
|
-
<
|
|
1737
|
+
<targets>src/search/ranking.rs</targets>
|
|
1694
1738
|
</extract>
|
|
1695
1739
|
|
|
1696
1740
|
User: Read the first 10 lines of the file
|
|
1697
1741
|
<extract>
|
|
1698
|
-
<
|
|
1742
|
+
<targets>src/search/ranking.rs</targets>
|
|
1699
1743
|
<line>1</line>
|
|
1700
1744
|
<end_line>10</end_line>
|
|
1701
1745
|
</extract>
|
|
1702
1746
|
|
|
1703
1747
|
User: Read file inside the dependency
|
|
1704
1748
|
<extract>
|
|
1705
|
-
<
|
|
1749
|
+
<targets>/dep/go/github.com/gorilla/mux/router.go</targets>
|
|
1706
1750
|
</extract>
|
|
1707
1751
|
|
|
1708
|
-
|
|
1709
1752
|
</examples>
|
|
1710
1753
|
`;
|
|
1711
1754
|
attemptCompletionToolDefinition = `
|
package/build/tools/common.js
CHANGED
|
@@ -24,7 +24,7 @@ export const querySchema = z.object({
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
export const extractSchema = z.object({
|
|
27
|
-
|
|
27
|
+
targets: z.string().optional().describe('File paths or symbols to extract from. Can include line numbers, symbol names, or multiple space-separated targets'),
|
|
28
28
|
input_content: z.string().optional().describe('Text content to extract file paths from'),
|
|
29
29
|
line: z.number().optional().describe('Start line number to extract a specific code block'),
|
|
30
30
|
end_line: z.number().optional().describe('End line number for extracting a range of lines'),
|
|
@@ -106,6 +106,12 @@ export const searchToolDefinition = `
|
|
|
106
106
|
Description: Search code in the repository using Elasticsearch query syntax (except field based queries, e.g. "filename:..." NOT supported).
|
|
107
107
|
|
|
108
108
|
You need to focus on main keywords when constructing the query, and always use elastic search syntax like OR AND and brackets to group keywords.
|
|
109
|
+
|
|
110
|
+
**Session Management & Caching:**
|
|
111
|
+
- Ensure not to re-read the same symbols twice - reuse context from previous tool calls
|
|
112
|
+
- Probe returns a session ID on first run - reuse it for subsequent calls to avoid redundant searches
|
|
113
|
+
- Once data is returned, it's cached and won't return on next runs (this is expected behavior)
|
|
114
|
+
|
|
109
115
|
Parameters:
|
|
110
116
|
- query: (required) Search query with Elasticsearch syntax. You can use + for important terms, and - for negation.
|
|
111
117
|
- path: (required) Path to search in. All dependencies located in /dep folder, under language sub folders, like this: "/dep/go/github.com/owner/repo", "/dep/js/package_name", or "/dep/rust/cargo_name" etc. YOU SHOULD ALWAYS provide FULL PATH when searching dependencies, including depency name.
|
|
@@ -115,11 +121,22 @@ Parameters:
|
|
|
115
121
|
- maxTokens: (optional, default: 10000) Maximum number of tokens to return (number).
|
|
116
122
|
- language: (optional) Limit search to files of a specific programming language (e.g., 'rust', 'js', 'python', 'go' etc.).
|
|
117
123
|
|
|
124
|
+
**Workflow:** Always start with search, then use extract for detailed context when needed.
|
|
118
125
|
|
|
119
126
|
Usage Example:
|
|
120
127
|
|
|
121
128
|
<examples>
|
|
122
129
|
|
|
130
|
+
User: Where is the login logic?
|
|
131
|
+
Assistant workflow:
|
|
132
|
+
1. <search>
|
|
133
|
+
<query>login AND auth AND token</query>
|
|
134
|
+
<path>.</path>
|
|
135
|
+
</search>
|
|
136
|
+
2. Now lets look closer: <extract>
|
|
137
|
+
<targets>session.rs#AuthService.login auth.rs:2-100</targets>
|
|
138
|
+
</extract>
|
|
139
|
+
|
|
123
140
|
User: How to calculate the total amount in the payments module?
|
|
124
141
|
<search>
|
|
125
142
|
<query>calculate AND payment</query>
|
|
@@ -143,7 +160,6 @@ User: Find all react imports in the project.
|
|
|
143
160
|
<language>js</language>
|
|
144
161
|
</search>
|
|
145
162
|
|
|
146
|
-
|
|
147
163
|
User: Find how decompoud library works?
|
|
148
164
|
<search>
|
|
149
165
|
<query>import { react }</query>
|
|
@@ -177,11 +193,16 @@ Usage Example:
|
|
|
177
193
|
|
|
178
194
|
export const extractToolDefinition = `
|
|
179
195
|
## extract
|
|
180
|
-
Description: Extract code blocks from files based on file paths and optional line numbers. Use this tool to see complete context after finding relevant files. It can be used to read full files as well.
|
|
196
|
+
Description: Extract code blocks from files based on file paths and optional line numbers. Use this tool to see complete context after finding relevant files. It can be used to read full files as well.
|
|
181
197
|
Full file extraction should be the LAST RESORT! Always prefer search.
|
|
182
198
|
|
|
199
|
+
**Multiple Extraction:** You can extract multiple symbols/files in one call by providing multiple file paths separated by spaces.
|
|
200
|
+
|
|
201
|
+
**Session Awareness:** Reuse context from previous tool calls. Don't re-extract the same symbols you already have.
|
|
202
|
+
|
|
183
203
|
Parameters:
|
|
184
|
-
-
|
|
204
|
+
- targets: (required) File paths or symbols to extract from. Can include line numbers, symbol names, or multiple space-separated targets (e.g., 'src/main.rs:10-20', 'src/utils.js#myFunction').
|
|
205
|
+
For multiple extractions: 'session.rs#AuthService.login auth.rs:2-100 config.rs#DatabaseConfig'
|
|
185
206
|
- line: (optional) Start line number to extract a specific code block. Use with end_line for ranges.
|
|
186
207
|
- end_line: (optional) End line number for extracting a range of lines.
|
|
187
208
|
- allow_tests: (optional, default: false) Allow test files and test code blocks (true/false).
|
|
@@ -189,29 +210,38 @@ Usage Example:
|
|
|
189
210
|
|
|
190
211
|
<examples>
|
|
191
212
|
|
|
213
|
+
User: Where is the login logic? (After search found relevant files)
|
|
214
|
+
<extract>
|
|
215
|
+
<targets>session.rs#AuthService.login auth.rs:2-100 config.rs#DatabaseConfig</targets>
|
|
216
|
+
</extract>
|
|
217
|
+
|
|
218
|
+
User: How does error handling work? (After search identified files)
|
|
219
|
+
<extract>
|
|
220
|
+
<targets>error.rs#ErrorType utils.rs#handle_error src/main.rs:50-80</targets>
|
|
221
|
+
</extract>
|
|
222
|
+
|
|
192
223
|
User: How RankManager works
|
|
193
224
|
<extract>
|
|
194
|
-
<
|
|
225
|
+
<targets>src/search/ranking.rs#RankManager</targets>
|
|
195
226
|
</extract>
|
|
196
227
|
|
|
197
228
|
User: Lets read the whole file
|
|
198
229
|
<extract>
|
|
199
|
-
<
|
|
230
|
+
<targets>src/search/ranking.rs</targets>
|
|
200
231
|
</extract>
|
|
201
232
|
|
|
202
233
|
User: Read the first 10 lines of the file
|
|
203
234
|
<extract>
|
|
204
|
-
<
|
|
235
|
+
<targets>src/search/ranking.rs</targets>
|
|
205
236
|
<line>1</line>
|
|
206
237
|
<end_line>10</end_line>
|
|
207
238
|
</extract>
|
|
208
239
|
|
|
209
240
|
User: Read file inside the dependency
|
|
210
241
|
<extract>
|
|
211
|
-
<
|
|
242
|
+
<targets>/dep/go/github.com/gorilla/mux/router.go</targets>
|
|
212
243
|
</extract>
|
|
213
244
|
|
|
214
|
-
|
|
215
245
|
</examples>
|
|
216
246
|
`;
|
|
217
247
|
|
|
@@ -296,8 +326,11 @@ export function parseXmlToolCall(xmlString, validTools = DEFAULT_VALID_TOOLS) {
|
|
|
296
326
|
|
|
297
327
|
// Parse parameters using string-based approach for better safety
|
|
298
328
|
// Common parameter names to look for (can be extended as needed)
|
|
329
|
+
// Note: includes both camelCase and underscore_case variants to handle inconsistencies
|
|
299
330
|
const commonParams = ['query', 'file_path', 'line', 'end_line', 'path', 'recursive', 'includeHidden',
|
|
300
|
-
'max_results', 'result', 'command', 'description', 'task', 'param'
|
|
331
|
+
'max_results', 'maxResults', 'result', 'command', 'description', 'task', 'param', 'pattern',
|
|
332
|
+
'allow_tests', 'exact', 'maxTokens', 'language', 'input_content',
|
|
333
|
+
'context_lines', 'format', 'directory', 'autoCommits', 'files', 'targets'];
|
|
301
334
|
|
|
302
335
|
for (const paramName of commonParams) {
|
|
303
336
|
const paramOpenTag = `<${paramName}>`;
|
package/cjs/agent/ProbeAgent.cjs
CHANGED
|
@@ -1460,11 +1460,24 @@ function parseXmlToolCall(xmlString, validTools = DEFAULT_VALID_TOOLS) {
|
|
|
1460
1460
|
"recursive",
|
|
1461
1461
|
"includeHidden",
|
|
1462
1462
|
"max_results",
|
|
1463
|
+
"maxResults",
|
|
1463
1464
|
"result",
|
|
1464
1465
|
"command",
|
|
1465
1466
|
"description",
|
|
1466
1467
|
"task",
|
|
1467
|
-
"param"
|
|
1468
|
+
"param",
|
|
1469
|
+
"pattern",
|
|
1470
|
+
"allow_tests",
|
|
1471
|
+
"exact",
|
|
1472
|
+
"maxTokens",
|
|
1473
|
+
"language",
|
|
1474
|
+
"input_content",
|
|
1475
|
+
"context_lines",
|
|
1476
|
+
"format",
|
|
1477
|
+
"directory",
|
|
1478
|
+
"autoCommits",
|
|
1479
|
+
"files",
|
|
1480
|
+
"targets"
|
|
1468
1481
|
];
|
|
1469
1482
|
for (const paramName of commonParams) {
|
|
1470
1483
|
const paramOpenTag = `<${paramName}>`;
|
|
@@ -1555,7 +1568,7 @@ var init_common = __esm({
|
|
|
1555
1568
|
allow_tests: import_zod.z.boolean().optional().default(false).describe("Allow test files in search results")
|
|
1556
1569
|
});
|
|
1557
1570
|
extractSchema = import_zod.z.object({
|
|
1558
|
-
|
|
1571
|
+
targets: import_zod.z.string().optional().describe("File paths or symbols to extract from. Can include line numbers, symbol names, or multiple space-separated targets"),
|
|
1559
1572
|
input_content: import_zod.z.string().optional().describe("Text content to extract file paths from"),
|
|
1560
1573
|
line: import_zod.z.number().optional().describe("Start line number to extract a specific code block"),
|
|
1561
1574
|
end_line: import_zod.z.number().optional().describe("End line number for extracting a range of lines"),
|
|
@@ -1623,6 +1636,12 @@ var init_common = __esm({
|
|
|
1623
1636
|
Description: Search code in the repository using Elasticsearch query syntax (except field based queries, e.g. "filename:..." NOT supported).
|
|
1624
1637
|
|
|
1625
1638
|
You need to focus on main keywords when constructing the query, and always use elastic search syntax like OR AND and brackets to group keywords.
|
|
1639
|
+
|
|
1640
|
+
**Session Management & Caching:**
|
|
1641
|
+
- Ensure not to re-read the same symbols twice - reuse context from previous tool calls
|
|
1642
|
+
- Probe returns a session ID on first run - reuse it for subsequent calls to avoid redundant searches
|
|
1643
|
+
- Once data is returned, it's cached and won't return on next runs (this is expected behavior)
|
|
1644
|
+
|
|
1626
1645
|
Parameters:
|
|
1627
1646
|
- query: (required) Search query with Elasticsearch syntax. You can use + for important terms, and - for negation.
|
|
1628
1647
|
- path: (required) Path to search in. All dependencies located in /dep folder, under language sub folders, like this: "/dep/go/github.com/owner/repo", "/dep/js/package_name", or "/dep/rust/cargo_name" etc. YOU SHOULD ALWAYS provide FULL PATH when searching dependencies, including depency name.
|
|
@@ -1632,11 +1651,22 @@ Parameters:
|
|
|
1632
1651
|
- maxTokens: (optional, default: 10000) Maximum number of tokens to return (number).
|
|
1633
1652
|
- language: (optional) Limit search to files of a specific programming language (e.g., 'rust', 'js', 'python', 'go' etc.).
|
|
1634
1653
|
|
|
1654
|
+
**Workflow:** Always start with search, then use extract for detailed context when needed.
|
|
1635
1655
|
|
|
1636
1656
|
Usage Example:
|
|
1637
1657
|
|
|
1638
1658
|
<examples>
|
|
1639
1659
|
|
|
1660
|
+
User: Where is the login logic?
|
|
1661
|
+
Assistant workflow:
|
|
1662
|
+
1. <search>
|
|
1663
|
+
<query>login AND auth AND token</query>
|
|
1664
|
+
<path>.</path>
|
|
1665
|
+
</search>
|
|
1666
|
+
2. Now lets look closer: <extract>
|
|
1667
|
+
<targets>session.rs#AuthService.login auth.rs:2-100</targets>
|
|
1668
|
+
</extract>
|
|
1669
|
+
|
|
1640
1670
|
User: How to calculate the total amount in the payments module?
|
|
1641
1671
|
<search>
|
|
1642
1672
|
<query>calculate AND payment</query>
|
|
@@ -1660,7 +1690,6 @@ User: Find all react imports in the project.
|
|
|
1660
1690
|
<language>js</language>
|
|
1661
1691
|
</search>
|
|
1662
1692
|
|
|
1663
|
-
|
|
1664
1693
|
User: Find how decompoud library works?
|
|
1665
1694
|
<search>
|
|
1666
1695
|
<query>import { react }</query>
|
|
@@ -1692,11 +1721,16 @@ Usage Example:
|
|
|
1692
1721
|
`;
|
|
1693
1722
|
extractToolDefinition = `
|
|
1694
1723
|
## extract
|
|
1695
|
-
Description: Extract code blocks from files based on file paths and optional line numbers. Use this tool to see complete context after finding relevant files. It can be used to read full files as well.
|
|
1724
|
+
Description: Extract code blocks from files based on file paths and optional line numbers. Use this tool to see complete context after finding relevant files. It can be used to read full files as well.
|
|
1696
1725
|
Full file extraction should be the LAST RESORT! Always prefer search.
|
|
1697
1726
|
|
|
1727
|
+
**Multiple Extraction:** You can extract multiple symbols/files in one call by providing multiple file paths separated by spaces.
|
|
1728
|
+
|
|
1729
|
+
**Session Awareness:** Reuse context from previous tool calls. Don't re-extract the same symbols you already have.
|
|
1730
|
+
|
|
1698
1731
|
Parameters:
|
|
1699
|
-
-
|
|
1732
|
+
- targets: (required) File paths or symbols to extract from. Can include line numbers, symbol names, or multiple space-separated targets (e.g., 'src/main.rs:10-20', 'src/utils.js#myFunction').
|
|
1733
|
+
For multiple extractions: 'session.rs#AuthService.login auth.rs:2-100 config.rs#DatabaseConfig'
|
|
1700
1734
|
- line: (optional) Start line number to extract a specific code block. Use with end_line for ranges.
|
|
1701
1735
|
- end_line: (optional) End line number for extracting a range of lines.
|
|
1702
1736
|
- allow_tests: (optional, default: false) Allow test files and test code blocks (true/false).
|
|
@@ -1704,29 +1738,38 @@ Usage Example:
|
|
|
1704
1738
|
|
|
1705
1739
|
<examples>
|
|
1706
1740
|
|
|
1741
|
+
User: Where is the login logic? (After search found relevant files)
|
|
1742
|
+
<extract>
|
|
1743
|
+
<targets>session.rs#AuthService.login auth.rs:2-100 config.rs#DatabaseConfig</targets>
|
|
1744
|
+
</extract>
|
|
1745
|
+
|
|
1746
|
+
User: How does error handling work? (After search identified files)
|
|
1747
|
+
<extract>
|
|
1748
|
+
<targets>error.rs#ErrorType utils.rs#handle_error src/main.rs:50-80</targets>
|
|
1749
|
+
</extract>
|
|
1750
|
+
|
|
1707
1751
|
User: How RankManager works
|
|
1708
1752
|
<extract>
|
|
1709
|
-
<
|
|
1753
|
+
<targets>src/search/ranking.rs#RankManager</targets>
|
|
1710
1754
|
</extract>
|
|
1711
1755
|
|
|
1712
1756
|
User: Lets read the whole file
|
|
1713
1757
|
<extract>
|
|
1714
|
-
<
|
|
1758
|
+
<targets>src/search/ranking.rs</targets>
|
|
1715
1759
|
</extract>
|
|
1716
1760
|
|
|
1717
1761
|
User: Read the first 10 lines of the file
|
|
1718
1762
|
<extract>
|
|
1719
|
-
<
|
|
1763
|
+
<targets>src/search/ranking.rs</targets>
|
|
1720
1764
|
<line>1</line>
|
|
1721
1765
|
<end_line>10</end_line>
|
|
1722
1766
|
</extract>
|
|
1723
1767
|
|
|
1724
1768
|
User: Read file inside the dependency
|
|
1725
1769
|
<extract>
|
|
1726
|
-
<
|
|
1770
|
+
<targets>/dep/go/github.com/gorilla/mux/router.go</targets>
|
|
1727
1771
|
</extract>
|
|
1728
1772
|
|
|
1729
|
-
|
|
1730
1773
|
</examples>
|
|
1731
1774
|
`;
|
|
1732
1775
|
attemptCompletionToolDefinition = `
|
package/cjs/index.cjs
CHANGED
|
@@ -1160,11 +1160,24 @@ function parseXmlToolCall(xmlString, validTools = DEFAULT_VALID_TOOLS) {
|
|
|
1160
1160
|
"recursive",
|
|
1161
1161
|
"includeHidden",
|
|
1162
1162
|
"max_results",
|
|
1163
|
+
"maxResults",
|
|
1163
1164
|
"result",
|
|
1164
1165
|
"command",
|
|
1165
1166
|
"description",
|
|
1166
1167
|
"task",
|
|
1167
|
-
"param"
|
|
1168
|
+
"param",
|
|
1169
|
+
"pattern",
|
|
1170
|
+
"allow_tests",
|
|
1171
|
+
"exact",
|
|
1172
|
+
"maxTokens",
|
|
1173
|
+
"language",
|
|
1174
|
+
"input_content",
|
|
1175
|
+
"context_lines",
|
|
1176
|
+
"format",
|
|
1177
|
+
"directory",
|
|
1178
|
+
"autoCommits",
|
|
1179
|
+
"files",
|
|
1180
|
+
"targets"
|
|
1168
1181
|
];
|
|
1169
1182
|
for (const paramName of commonParams) {
|
|
1170
1183
|
const paramOpenTag = `<${paramName}>`;
|
|
@@ -1255,7 +1268,7 @@ var init_common = __esm({
|
|
|
1255
1268
|
allow_tests: import_zod.z.boolean().optional().default(false).describe("Allow test files in search results")
|
|
1256
1269
|
});
|
|
1257
1270
|
extractSchema = import_zod.z.object({
|
|
1258
|
-
|
|
1271
|
+
targets: import_zod.z.string().optional().describe("File paths or symbols to extract from. Can include line numbers, symbol names, or multiple space-separated targets"),
|
|
1259
1272
|
input_content: import_zod.z.string().optional().describe("Text content to extract file paths from"),
|
|
1260
1273
|
line: import_zod.z.number().optional().describe("Start line number to extract a specific code block"),
|
|
1261
1274
|
end_line: import_zod.z.number().optional().describe("End line number for extracting a range of lines"),
|
|
@@ -1323,6 +1336,12 @@ var init_common = __esm({
|
|
|
1323
1336
|
Description: Search code in the repository using Elasticsearch query syntax (except field based queries, e.g. "filename:..." NOT supported).
|
|
1324
1337
|
|
|
1325
1338
|
You need to focus on main keywords when constructing the query, and always use elastic search syntax like OR AND and brackets to group keywords.
|
|
1339
|
+
|
|
1340
|
+
**Session Management & Caching:**
|
|
1341
|
+
- Ensure not to re-read the same symbols twice - reuse context from previous tool calls
|
|
1342
|
+
- Probe returns a session ID on first run - reuse it for subsequent calls to avoid redundant searches
|
|
1343
|
+
- Once data is returned, it's cached and won't return on next runs (this is expected behavior)
|
|
1344
|
+
|
|
1326
1345
|
Parameters:
|
|
1327
1346
|
- query: (required) Search query with Elasticsearch syntax. You can use + for important terms, and - for negation.
|
|
1328
1347
|
- path: (required) Path to search in. All dependencies located in /dep folder, under language sub folders, like this: "/dep/go/github.com/owner/repo", "/dep/js/package_name", or "/dep/rust/cargo_name" etc. YOU SHOULD ALWAYS provide FULL PATH when searching dependencies, including depency name.
|
|
@@ -1332,11 +1351,22 @@ Parameters:
|
|
|
1332
1351
|
- maxTokens: (optional, default: 10000) Maximum number of tokens to return (number).
|
|
1333
1352
|
- language: (optional) Limit search to files of a specific programming language (e.g., 'rust', 'js', 'python', 'go' etc.).
|
|
1334
1353
|
|
|
1354
|
+
**Workflow:** Always start with search, then use extract for detailed context when needed.
|
|
1335
1355
|
|
|
1336
1356
|
Usage Example:
|
|
1337
1357
|
|
|
1338
1358
|
<examples>
|
|
1339
1359
|
|
|
1360
|
+
User: Where is the login logic?
|
|
1361
|
+
Assistant workflow:
|
|
1362
|
+
1. <search>
|
|
1363
|
+
<query>login AND auth AND token</query>
|
|
1364
|
+
<path>.</path>
|
|
1365
|
+
</search>
|
|
1366
|
+
2. Now lets look closer: <extract>
|
|
1367
|
+
<targets>session.rs#AuthService.login auth.rs:2-100</targets>
|
|
1368
|
+
</extract>
|
|
1369
|
+
|
|
1340
1370
|
User: How to calculate the total amount in the payments module?
|
|
1341
1371
|
<search>
|
|
1342
1372
|
<query>calculate AND payment</query>
|
|
@@ -1360,7 +1390,6 @@ User: Find all react imports in the project.
|
|
|
1360
1390
|
<language>js</language>
|
|
1361
1391
|
</search>
|
|
1362
1392
|
|
|
1363
|
-
|
|
1364
1393
|
User: Find how decompoud library works?
|
|
1365
1394
|
<search>
|
|
1366
1395
|
<query>import { react }</query>
|
|
@@ -1392,11 +1421,16 @@ Usage Example:
|
|
|
1392
1421
|
`;
|
|
1393
1422
|
extractToolDefinition = `
|
|
1394
1423
|
## extract
|
|
1395
|
-
Description: Extract code blocks from files based on file paths and optional line numbers. Use this tool to see complete context after finding relevant files. It can be used to read full files as well.
|
|
1424
|
+
Description: Extract code blocks from files based on file paths and optional line numbers. Use this tool to see complete context after finding relevant files. It can be used to read full files as well.
|
|
1396
1425
|
Full file extraction should be the LAST RESORT! Always prefer search.
|
|
1397
1426
|
|
|
1427
|
+
**Multiple Extraction:** You can extract multiple symbols/files in one call by providing multiple file paths separated by spaces.
|
|
1428
|
+
|
|
1429
|
+
**Session Awareness:** Reuse context from previous tool calls. Don't re-extract the same symbols you already have.
|
|
1430
|
+
|
|
1398
1431
|
Parameters:
|
|
1399
|
-
-
|
|
1432
|
+
- targets: (required) File paths or symbols to extract from. Can include line numbers, symbol names, or multiple space-separated targets (e.g., 'src/main.rs:10-20', 'src/utils.js#myFunction').
|
|
1433
|
+
For multiple extractions: 'session.rs#AuthService.login auth.rs:2-100 config.rs#DatabaseConfig'
|
|
1400
1434
|
- line: (optional) Start line number to extract a specific code block. Use with end_line for ranges.
|
|
1401
1435
|
- end_line: (optional) End line number for extracting a range of lines.
|
|
1402
1436
|
- allow_tests: (optional, default: false) Allow test files and test code blocks (true/false).
|
|
@@ -1404,29 +1438,38 @@ Usage Example:
|
|
|
1404
1438
|
|
|
1405
1439
|
<examples>
|
|
1406
1440
|
|
|
1441
|
+
User: Where is the login logic? (After search found relevant files)
|
|
1442
|
+
<extract>
|
|
1443
|
+
<targets>session.rs#AuthService.login auth.rs:2-100 config.rs#DatabaseConfig</targets>
|
|
1444
|
+
</extract>
|
|
1445
|
+
|
|
1446
|
+
User: How does error handling work? (After search identified files)
|
|
1447
|
+
<extract>
|
|
1448
|
+
<targets>error.rs#ErrorType utils.rs#handle_error src/main.rs:50-80</targets>
|
|
1449
|
+
</extract>
|
|
1450
|
+
|
|
1407
1451
|
User: How RankManager works
|
|
1408
1452
|
<extract>
|
|
1409
|
-
<
|
|
1453
|
+
<targets>src/search/ranking.rs#RankManager</targets>
|
|
1410
1454
|
</extract>
|
|
1411
1455
|
|
|
1412
1456
|
User: Lets read the whole file
|
|
1413
1457
|
<extract>
|
|
1414
|
-
<
|
|
1458
|
+
<targets>src/search/ranking.rs</targets>
|
|
1415
1459
|
</extract>
|
|
1416
1460
|
|
|
1417
1461
|
User: Read the first 10 lines of the file
|
|
1418
1462
|
<extract>
|
|
1419
|
-
<
|
|
1463
|
+
<targets>src/search/ranking.rs</targets>
|
|
1420
1464
|
<line>1</line>
|
|
1421
1465
|
<end_line>10</end_line>
|
|
1422
1466
|
</extract>
|
|
1423
1467
|
|
|
1424
1468
|
User: Read file inside the dependency
|
|
1425
1469
|
<extract>
|
|
1426
|
-
<
|
|
1470
|
+
<targets>/dep/go/github.com/gorilla/mux/router.go</targets>
|
|
1427
1471
|
</extract>
|
|
1428
1472
|
|
|
1429
|
-
|
|
1430
1473
|
</examples>
|
|
1431
1474
|
`;
|
|
1432
1475
|
delegateToolDefinition = `
|
package/package.json
CHANGED
package/src/tools/common.js
CHANGED
|
@@ -24,7 +24,7 @@ export const querySchema = z.object({
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
export const extractSchema = z.object({
|
|
27
|
-
|
|
27
|
+
targets: z.string().optional().describe('File paths or symbols to extract from. Can include line numbers, symbol names, or multiple space-separated targets'),
|
|
28
28
|
input_content: z.string().optional().describe('Text content to extract file paths from'),
|
|
29
29
|
line: z.number().optional().describe('Start line number to extract a specific code block'),
|
|
30
30
|
end_line: z.number().optional().describe('End line number for extracting a range of lines'),
|
|
@@ -106,6 +106,12 @@ export const searchToolDefinition = `
|
|
|
106
106
|
Description: Search code in the repository using Elasticsearch query syntax (except field based queries, e.g. "filename:..." NOT supported).
|
|
107
107
|
|
|
108
108
|
You need to focus on main keywords when constructing the query, and always use elastic search syntax like OR AND and brackets to group keywords.
|
|
109
|
+
|
|
110
|
+
**Session Management & Caching:**
|
|
111
|
+
- Ensure not to re-read the same symbols twice - reuse context from previous tool calls
|
|
112
|
+
- Probe returns a session ID on first run - reuse it for subsequent calls to avoid redundant searches
|
|
113
|
+
- Once data is returned, it's cached and won't return on next runs (this is expected behavior)
|
|
114
|
+
|
|
109
115
|
Parameters:
|
|
110
116
|
- query: (required) Search query with Elasticsearch syntax. You can use + for important terms, and - for negation.
|
|
111
117
|
- path: (required) Path to search in. All dependencies located in /dep folder, under language sub folders, like this: "/dep/go/github.com/owner/repo", "/dep/js/package_name", or "/dep/rust/cargo_name" etc. YOU SHOULD ALWAYS provide FULL PATH when searching dependencies, including depency name.
|
|
@@ -115,11 +121,22 @@ Parameters:
|
|
|
115
121
|
- maxTokens: (optional, default: 10000) Maximum number of tokens to return (number).
|
|
116
122
|
- language: (optional) Limit search to files of a specific programming language (e.g., 'rust', 'js', 'python', 'go' etc.).
|
|
117
123
|
|
|
124
|
+
**Workflow:** Always start with search, then use extract for detailed context when needed.
|
|
118
125
|
|
|
119
126
|
Usage Example:
|
|
120
127
|
|
|
121
128
|
<examples>
|
|
122
129
|
|
|
130
|
+
User: Where is the login logic?
|
|
131
|
+
Assistant workflow:
|
|
132
|
+
1. <search>
|
|
133
|
+
<query>login AND auth AND token</query>
|
|
134
|
+
<path>.</path>
|
|
135
|
+
</search>
|
|
136
|
+
2. Now lets look closer: <extract>
|
|
137
|
+
<targets>session.rs#AuthService.login auth.rs:2-100</targets>
|
|
138
|
+
</extract>
|
|
139
|
+
|
|
123
140
|
User: How to calculate the total amount in the payments module?
|
|
124
141
|
<search>
|
|
125
142
|
<query>calculate AND payment</query>
|
|
@@ -143,7 +160,6 @@ User: Find all react imports in the project.
|
|
|
143
160
|
<language>js</language>
|
|
144
161
|
</search>
|
|
145
162
|
|
|
146
|
-
|
|
147
163
|
User: Find how decompoud library works?
|
|
148
164
|
<search>
|
|
149
165
|
<query>import { react }</query>
|
|
@@ -177,11 +193,16 @@ Usage Example:
|
|
|
177
193
|
|
|
178
194
|
export const extractToolDefinition = `
|
|
179
195
|
## extract
|
|
180
|
-
Description: Extract code blocks from files based on file paths and optional line numbers. Use this tool to see complete context after finding relevant files. It can be used to read full files as well.
|
|
196
|
+
Description: Extract code blocks from files based on file paths and optional line numbers. Use this tool to see complete context after finding relevant files. It can be used to read full files as well.
|
|
181
197
|
Full file extraction should be the LAST RESORT! Always prefer search.
|
|
182
198
|
|
|
199
|
+
**Multiple Extraction:** You can extract multiple symbols/files in one call by providing multiple file paths separated by spaces.
|
|
200
|
+
|
|
201
|
+
**Session Awareness:** Reuse context from previous tool calls. Don't re-extract the same symbols you already have.
|
|
202
|
+
|
|
183
203
|
Parameters:
|
|
184
|
-
-
|
|
204
|
+
- targets: (required) File paths or symbols to extract from. Can include line numbers, symbol names, or multiple space-separated targets (e.g., 'src/main.rs:10-20', 'src/utils.js#myFunction').
|
|
205
|
+
For multiple extractions: 'session.rs#AuthService.login auth.rs:2-100 config.rs#DatabaseConfig'
|
|
185
206
|
- line: (optional) Start line number to extract a specific code block. Use with end_line for ranges.
|
|
186
207
|
- end_line: (optional) End line number for extracting a range of lines.
|
|
187
208
|
- allow_tests: (optional, default: false) Allow test files and test code blocks (true/false).
|
|
@@ -189,29 +210,38 @@ Usage Example:
|
|
|
189
210
|
|
|
190
211
|
<examples>
|
|
191
212
|
|
|
213
|
+
User: Where is the login logic? (After search found relevant files)
|
|
214
|
+
<extract>
|
|
215
|
+
<targets>session.rs#AuthService.login auth.rs:2-100 config.rs#DatabaseConfig</targets>
|
|
216
|
+
</extract>
|
|
217
|
+
|
|
218
|
+
User: How does error handling work? (After search identified files)
|
|
219
|
+
<extract>
|
|
220
|
+
<targets>error.rs#ErrorType utils.rs#handle_error src/main.rs:50-80</targets>
|
|
221
|
+
</extract>
|
|
222
|
+
|
|
192
223
|
User: How RankManager works
|
|
193
224
|
<extract>
|
|
194
|
-
<
|
|
225
|
+
<targets>src/search/ranking.rs#RankManager</targets>
|
|
195
226
|
</extract>
|
|
196
227
|
|
|
197
228
|
User: Lets read the whole file
|
|
198
229
|
<extract>
|
|
199
|
-
<
|
|
230
|
+
<targets>src/search/ranking.rs</targets>
|
|
200
231
|
</extract>
|
|
201
232
|
|
|
202
233
|
User: Read the first 10 lines of the file
|
|
203
234
|
<extract>
|
|
204
|
-
<
|
|
235
|
+
<targets>src/search/ranking.rs</targets>
|
|
205
236
|
<line>1</line>
|
|
206
237
|
<end_line>10</end_line>
|
|
207
238
|
</extract>
|
|
208
239
|
|
|
209
240
|
User: Read file inside the dependency
|
|
210
241
|
<extract>
|
|
211
|
-
<
|
|
242
|
+
<targets>/dep/go/github.com/gorilla/mux/router.go</targets>
|
|
212
243
|
</extract>
|
|
213
244
|
|
|
214
|
-
|
|
215
245
|
</examples>
|
|
216
246
|
`;
|
|
217
247
|
|
|
@@ -296,8 +326,11 @@ export function parseXmlToolCall(xmlString, validTools = DEFAULT_VALID_TOOLS) {
|
|
|
296
326
|
|
|
297
327
|
// Parse parameters using string-based approach for better safety
|
|
298
328
|
// Common parameter names to look for (can be extended as needed)
|
|
329
|
+
// Note: includes both camelCase and underscore_case variants to handle inconsistencies
|
|
299
330
|
const commonParams = ['query', 'file_path', 'line', 'end_line', 'path', 'recursive', 'includeHidden',
|
|
300
|
-
'max_results', 'result', 'command', 'description', 'task', 'param'
|
|
331
|
+
'max_results', 'maxResults', 'result', 'command', 'description', 'task', 'param', 'pattern',
|
|
332
|
+
'allow_tests', 'exact', 'maxTokens', 'language', 'input_content',
|
|
333
|
+
'context_lines', 'format', 'directory', 'autoCommits', 'files', 'targets'];
|
|
301
334
|
|
|
302
335
|
for (const paramName of commonParams) {
|
|
303
336
|
const paramOpenTag = `<${paramName}>`;
|