@probelabs/probe 0.6.0-rc143 → 0.6.0-rc144

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.
@@ -7259,6 +7259,12 @@ function createMessagePreview(message, charsPerSide = 200) {
7259
7259
  const end = message.substring(message.length - charsPerSide);
7260
7260
  return `${start}...${end}`;
7261
7261
  }
7262
+ function parseTargets(targets) {
7263
+ if (!targets || typeof targets !== "string") {
7264
+ return [];
7265
+ }
7266
+ return targets.split(/\s+/).filter((f) => f.length > 0);
7267
+ }
7262
7268
  var searchSchema, querySchema, extractSchema, delegateSchema, bashSchema, attemptCompletionSchema, searchToolDefinition, queryToolDefinition, extractToolDefinition, attemptCompletionToolDefinition, searchDescription, queryDescription, extractDescription, delegateDescription, DEFAULT_VALID_TOOLS;
7263
7269
  var init_common = __esm({
7264
7270
  "src/tools/common.js"() {
@@ -7836,7 +7842,7 @@ var init_vercel = __esm({
7836
7842
  format: effectiveFormat
7837
7843
  };
7838
7844
  } else if (targets) {
7839
- const files = [targets];
7845
+ const files = parseTargets(targets);
7840
7846
  let effectiveFormat = format;
7841
7847
  if (outline && format === "outline-xml") {
7842
7848
  effectiveFormat = "xml";
@@ -484,6 +484,30 @@ export function createMessagePreview(message, charsPerSide = 200) {
484
484
  // Message is longer - show start and end with ... in between
485
485
  const start = message.substring(0, charsPerSide);
486
486
  const end = message.substring(message.length - charsPerSide);
487
-
487
+
488
488
  return `${start}...${end}`;
489
+ }
490
+
491
+ /**
492
+ * Parse targets string into array of file specifications
493
+ * Handles space-separated targets for extract tool
494
+ *
495
+ * @param {string} targets - Space-separated file targets (e.g., "file1.rs:10-20 file2.rs#symbol")
496
+ * @returns {string[]} Array of individual file specifications
497
+ *
498
+ * @example
499
+ * parseTargets("file1.rs:10-20 file2.rs:30-40")
500
+ * // Returns: ["file1.rs:10-20", "file2.rs:30-40"]
501
+ *
502
+ * @example
503
+ * parseTargets("session.rs#AuthService.login auth.rs:2-100 config.rs#DatabaseConfig")
504
+ * // Returns: ["session.rs#AuthService.login", "auth.rs:2-100", "config.rs#DatabaseConfig"]
505
+ */
506
+ export function parseTargets(targets) {
507
+ if (!targets || typeof targets !== 'string') {
508
+ return [];
509
+ }
510
+
511
+ // Split on any whitespace (spaces, tabs, newlines) and filter out empty strings
512
+ return targets.split(/\s+/).filter(f => f.length > 0);
489
513
  }
@@ -6,7 +6,7 @@
6
6
  import { search } from '../search.js';
7
7
  import { query } from '../query.js';
8
8
  import { extract } from '../extract.js';
9
- import { searchSchema, querySchema, extractSchema, searchDescription, queryDescription, extractDescription } from './common.js';
9
+ import { searchSchema, querySchema, extractSchema, searchDescription, queryDescription, extractDescription, parseTargets } from './common.js';
10
10
 
11
11
  // LangChain tool for searching code
12
12
  export function createSearchTool() {
@@ -69,7 +69,8 @@ export function createExtractTool() {
69
69
  schema: extractSchema,
70
70
  func: async ({ targets, line, end_line, allow_tests, context_lines, format }) => {
71
71
  try {
72
- const files = [targets];
72
+ // Split targets on whitespace to support multiple targets in one call
73
+ const files = parseTargets(targets);
73
74
 
74
75
  const results = await extract({
75
76
  files,
@@ -8,7 +8,7 @@ import { search } from '../search.js';
8
8
  import { query } from '../query.js';
9
9
  import { extract } from '../extract.js';
10
10
  import { delegate } from '../delegate.js';
11
- import { searchSchema, querySchema, extractSchema, delegateSchema, searchDescription, queryDescription, extractDescription, delegateDescription } from './common.js';
11
+ import { searchSchema, querySchema, extractSchema, delegateSchema, searchDescription, queryDescription, extractDescription, delegateDescription, parseTargets } from './common.js';
12
12
 
13
13
  /**
14
14
  * Search tool generator
@@ -190,7 +190,8 @@ export const extractTool = (options = {}) => {
190
190
  };
191
191
  } else if (targets) {
192
192
  // Parse targets to handle line numbers and symbol names
193
- const files = [targets];
193
+ // Split on whitespace to support multiple targets in one call
194
+ const files = parseTargets(targets);
194
195
 
195
196
  // Apply format mapping for outline-xml to xml
196
197
  let effectiveFormat = format;
@@ -32660,6 +32660,12 @@ function createMessagePreview(message, charsPerSide = 200) {
32660
32660
  const end = message.substring(message.length - charsPerSide);
32661
32661
  return `${start}...${end}`;
32662
32662
  }
32663
+ function parseTargets(targets) {
32664
+ if (!targets || typeof targets !== "string") {
32665
+ return [];
32666
+ }
32667
+ return targets.split(/\s+/).filter((f3) => f3.length > 0);
32668
+ }
32663
32669
  var searchSchema, querySchema, extractSchema, delegateSchema, bashSchema, attemptCompletionSchema, searchToolDefinition, queryToolDefinition, extractToolDefinition, attemptCompletionToolDefinition, searchDescription, queryDescription, extractDescription, delegateDescription, DEFAULT_VALID_TOOLS;
32664
32670
  var init_common2 = __esm({
32665
32671
  "src/tools/common.js"() {
@@ -33238,7 +33244,7 @@ var init_vercel = __esm({
33238
33244
  format: effectiveFormat
33239
33245
  };
33240
33246
  } else if (targets) {
33241
- const files = [targets];
33247
+ const files = parseTargets(targets);
33242
33248
  let effectiveFormat = format2;
33243
33249
  if (outline && format2 === "outline-xml") {
33244
33250
  effectiveFormat = "xml";
package/cjs/index.cjs CHANGED
@@ -5660,6 +5660,12 @@ function createMessagePreview(message, charsPerSide = 200) {
5660
5660
  const end = message.substring(message.length - charsPerSide);
5661
5661
  return `${start}...${end}`;
5662
5662
  }
5663
+ function parseTargets(targets) {
5664
+ if (!targets || typeof targets !== "string") {
5665
+ return [];
5666
+ }
5667
+ return targets.split(/\s+/).filter((f3) => f3.length > 0);
5668
+ }
5663
5669
  var searchSchema, querySchema, extractSchema, delegateSchema, bashSchema, attemptCompletionSchema, searchToolDefinition, queryToolDefinition, extractToolDefinition, delegateToolDefinition, attemptCompletionToolDefinition, bashToolDefinition, searchDescription, queryDescription, extractDescription, delegateDescription, bashDescription, DEFAULT_VALID_TOOLS;
5664
5670
  var init_common = __esm({
5665
5671
  "src/tools/common.js"() {
@@ -6314,7 +6320,7 @@ var init_vercel = __esm({
6314
6320
  format: effectiveFormat
6315
6321
  };
6316
6322
  } else if (targets) {
6317
- const files = [targets];
6323
+ const files = parseTargets(targets);
6318
6324
  let effectiveFormat = format2;
6319
6325
  if (outline && format2 === "outline-xml") {
6320
6326
  effectiveFormat = "xml";
@@ -7672,7 +7678,7 @@ function createExtractTool() {
7672
7678
  schema: extractSchema,
7673
7679
  func: async ({ targets, line, end_line, allow_tests, context_lines, format: format2 }) => {
7674
7680
  try {
7675
- const files = [targets];
7681
+ const files = parseTargets(targets);
7676
7682
  const results = await extract({
7677
7683
  files,
7678
7684
  allowTests: allow_tests,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc143",
3
+ "version": "0.6.0-rc144",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -484,6 +484,30 @@ export function createMessagePreview(message, charsPerSide = 200) {
484
484
  // Message is longer - show start and end with ... in between
485
485
  const start = message.substring(0, charsPerSide);
486
486
  const end = message.substring(message.length - charsPerSide);
487
-
487
+
488
488
  return `${start}...${end}`;
489
+ }
490
+
491
+ /**
492
+ * Parse targets string into array of file specifications
493
+ * Handles space-separated targets for extract tool
494
+ *
495
+ * @param {string} targets - Space-separated file targets (e.g., "file1.rs:10-20 file2.rs#symbol")
496
+ * @returns {string[]} Array of individual file specifications
497
+ *
498
+ * @example
499
+ * parseTargets("file1.rs:10-20 file2.rs:30-40")
500
+ * // Returns: ["file1.rs:10-20", "file2.rs:30-40"]
501
+ *
502
+ * @example
503
+ * parseTargets("session.rs#AuthService.login auth.rs:2-100 config.rs#DatabaseConfig")
504
+ * // Returns: ["session.rs#AuthService.login", "auth.rs:2-100", "config.rs#DatabaseConfig"]
505
+ */
506
+ export function parseTargets(targets) {
507
+ if (!targets || typeof targets !== 'string') {
508
+ return [];
509
+ }
510
+
511
+ // Split on any whitespace (spaces, tabs, newlines) and filter out empty strings
512
+ return targets.split(/\s+/).filter(f => f.length > 0);
489
513
  }
@@ -6,7 +6,7 @@
6
6
  import { search } from '../search.js';
7
7
  import { query } from '../query.js';
8
8
  import { extract } from '../extract.js';
9
- import { searchSchema, querySchema, extractSchema, searchDescription, queryDescription, extractDescription } from './common.js';
9
+ import { searchSchema, querySchema, extractSchema, searchDescription, queryDescription, extractDescription, parseTargets } from './common.js';
10
10
 
11
11
  // LangChain tool for searching code
12
12
  export function createSearchTool() {
@@ -69,7 +69,8 @@ export function createExtractTool() {
69
69
  schema: extractSchema,
70
70
  func: async ({ targets, line, end_line, allow_tests, context_lines, format }) => {
71
71
  try {
72
- const files = [targets];
72
+ // Split targets on whitespace to support multiple targets in one call
73
+ const files = parseTargets(targets);
73
74
 
74
75
  const results = await extract({
75
76
  files,
@@ -8,7 +8,7 @@ import { search } from '../search.js';
8
8
  import { query } from '../query.js';
9
9
  import { extract } from '../extract.js';
10
10
  import { delegate } from '../delegate.js';
11
- import { searchSchema, querySchema, extractSchema, delegateSchema, searchDescription, queryDescription, extractDescription, delegateDescription } from './common.js';
11
+ import { searchSchema, querySchema, extractSchema, delegateSchema, searchDescription, queryDescription, extractDescription, delegateDescription, parseTargets } from './common.js';
12
12
 
13
13
  /**
14
14
  * Search tool generator
@@ -190,7 +190,8 @@ export const extractTool = (options = {}) => {
190
190
  };
191
191
  } else if (targets) {
192
192
  // Parse targets to handle line numbers and symbol names
193
- const files = [targets];
193
+ // Split on whitespace to support multiple targets in one call
194
+ const files = parseTargets(targets);
194
195
 
195
196
  // Apply format mapping for outline-xml to xml
196
197
  let effectiveFormat = format;