@probelabs/probe 0.6.0-rc188 → 0.6.0-rc190

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.
@@ -54730,6 +54730,10 @@ function cleanSchemaResponse(response) {
54730
54730
  return response;
54731
54731
  }
54732
54732
  const trimmed = response.trim();
54733
+ const resultWrapperMatch = trimmed.match(/^<result>\s*([\s\S]*?)\s*<\/result>$/);
54734
+ if (resultWrapperMatch) {
54735
+ return cleanSchemaResponse(resultWrapperMatch[1]);
54736
+ }
54733
54737
  const jsonBlockMatch = trimmed.match(/```json\s*\n([\s\S]*?)\n```/);
54734
54738
  if (jsonBlockMatch) {
54735
54739
  return normalizeJsonQuotes(jsonBlockMatch[1].trim());
@@ -62141,6 +62145,7 @@ Convert your previous response content into actual JSON data that follows this s
62141
62145
 
62142
62146
  // src/agent/index.js
62143
62147
  init_ProbeAgent();
62148
+ init_index();
62144
62149
  init_simpleTelemetry();
62145
62150
  init_schemaUtils();
62146
62151
  import dotenv3 from "dotenv";
@@ -63148,11 +63153,30 @@ var ProbeAgentMcpServer = class {
63148
63153
  },
63149
63154
  required: ["query"]
63150
63155
  }
63156
+ },
63157
+ {
63158
+ name: "extract_code",
63159
+ description: "Extract full code blocks from files using tree-sitter AST parsing. Use this to get complete code content based on file paths and symbols returned by search_code. Each file path can include optional line numbers or symbol names to extract specific code blocks.",
63160
+ inputSchema: {
63161
+ type: "object",
63162
+ properties: {
63163
+ path: {
63164
+ type: "string",
63165
+ description: "Absolute path to the project root directory (used as working directory for relative file paths)."
63166
+ },
63167
+ files: {
63168
+ type: "array",
63169
+ items: { type: "string" },
63170
+ description: 'Array of file paths to extract from. Formats: "file.js" (entire file), "file.js:42" (code block at line 42), "file.js:10-20" (lines 10-20), "file.js#funcName" (specific symbol). Line numbers and symbols are part of the path string, not separate parameters. Paths can be absolute or relative to the project directory.'
63171
+ }
63172
+ },
63173
+ required: ["path", "files"]
63174
+ }
63151
63175
  }
63152
63176
  ]
63153
63177
  }));
63154
63178
  this.server.setRequestHandler(CallToolRequestSchema2, async (request) => {
63155
- if (request.params.name !== "search_code") {
63179
+ if (request.params.name !== "search_code" && request.params.name !== "extract_code") {
63156
63180
  throw new McpError(
63157
63181
  ErrorCode2.MethodNotFound,
63158
63182
  `Unknown tool: ${request.params.name}`
@@ -63160,6 +63184,33 @@ var ProbeAgentMcpServer = class {
63160
63184
  }
63161
63185
  try {
63162
63186
  const args = request.params.arguments;
63187
+ if (request.params.name === "extract_code") {
63188
+ if (!args.path) {
63189
+ throw new Error("Path is required");
63190
+ }
63191
+ if (!args.files || !Array.isArray(args.files) || args.files.length === 0) {
63192
+ throw new Error("Files array is required and must not be empty");
63193
+ }
63194
+ const options = {
63195
+ files: args.files,
63196
+ path: args.path,
63197
+ format: "xml",
63198
+ allowTests: true
63199
+ // Include test files by default
63200
+ };
63201
+ if (process.env.DEBUG === "1") {
63202
+ console.error("[DEBUG] Executing extract_code with options:", JSON.stringify(options, null, 2));
63203
+ }
63204
+ const result2 = await extract(options);
63205
+ return {
63206
+ content: [
63207
+ {
63208
+ type: "text",
63209
+ text: result2
63210
+ }
63211
+ ]
63212
+ };
63213
+ }
63163
63214
  if (!args.query) {
63164
63215
  throw new Error("Query is required");
63165
63216
  }
@@ -63276,7 +63327,7 @@ Please reformat your previous response to match this schema exactly. Only return
63276
63327
  ]
63277
63328
  };
63278
63329
  } catch (error) {
63279
- console.error(`Error executing search_code:`, error);
63330
+ console.error(`Error executing ${request.params.name}:`, error);
63280
63331
  return {
63281
63332
  content: [
63282
63333
  {
@@ -253,6 +253,14 @@ export function cleanSchemaResponse(response) {
253
253
 
254
254
  const trimmed = response.trim();
255
255
 
256
+ // Strip <result>...</result> wrapper if present (legacy XML format from some AI models)
257
+ // Some models like Google Gemini wrap JSON in <result> tags despite instructions not to
258
+ const resultWrapperMatch = trimmed.match(/^<result>\s*([\s\S]*?)\s*<\/result>$/);
259
+ if (resultWrapperMatch) {
260
+ // Recursively clean the inner content in case there are nested patterns
261
+ return cleanSchemaResponse(resultWrapperMatch[1]);
262
+ }
263
+
256
264
  // First, look for JSON after code block markers - similar to mermaid extraction
257
265
  // Try with json language specifier
258
266
  const jsonBlockMatch = trimmed.match(/```json\s*\n([\s\S]*?)\n```/);
@@ -6144,6 +6144,9 @@ var init_HttpBindingProtocol = __esm({
6144
6144
  const memberTraits = memberNs.getMergedTraits() ?? {};
6145
6145
  const inputMemberValue = input[memberName];
6146
6146
  if (inputMemberValue == null && !memberNs.isIdempotencyToken()) {
6147
+ if (memberTraits.httpLabel) {
6148
+ throw new Error(`No value provided for input HTTP label: ${memberName}.`);
6149
+ }
6147
6150
  continue;
6148
6151
  }
6149
6152
  if (memberTraits.httpPayload) {
@@ -17357,7 +17360,7 @@ var require_package2 = __commonJS({
17357
17360
  module2.exports = {
17358
17361
  name: "@aws-sdk/client-bedrock-runtime",
17359
17362
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
17360
- version: "3.970.0",
17363
+ version: "3.971.0",
17361
17364
  scripts: {
17362
17365
  build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
17363
17366
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -17378,20 +17381,20 @@ var require_package2 = __commonJS({
17378
17381
  "@aws-crypto/sha256-browser": "5.2.0",
17379
17382
  "@aws-crypto/sha256-js": "5.2.0",
17380
17383
  "@aws-sdk/core": "3.970.0",
17381
- "@aws-sdk/credential-provider-node": "3.970.0",
17382
- "@aws-sdk/eventstream-handler-node": "3.969.0",
17384
+ "@aws-sdk/credential-provider-node": "3.971.0",
17385
+ "@aws-sdk/eventstream-handler-node": "3.971.0",
17383
17386
  "@aws-sdk/middleware-eventstream": "3.969.0",
17384
17387
  "@aws-sdk/middleware-host-header": "3.969.0",
17385
17388
  "@aws-sdk/middleware-logger": "3.969.0",
17386
17389
  "@aws-sdk/middleware-recursion-detection": "3.969.0",
17387
17390
  "@aws-sdk/middleware-user-agent": "3.970.0",
17388
- "@aws-sdk/middleware-websocket": "3.969.0",
17391
+ "@aws-sdk/middleware-websocket": "3.971.0",
17389
17392
  "@aws-sdk/region-config-resolver": "3.969.0",
17390
- "@aws-sdk/token-providers": "3.970.0",
17393
+ "@aws-sdk/token-providers": "3.971.0",
17391
17394
  "@aws-sdk/types": "3.969.0",
17392
17395
  "@aws-sdk/util-endpoints": "3.970.0",
17393
17396
  "@aws-sdk/util-user-agent-browser": "3.969.0",
17394
- "@aws-sdk/util-user-agent-node": "3.970.0",
17397
+ "@aws-sdk/util-user-agent-node": "3.971.0",
17395
17398
  "@smithy/config-resolver": "^4.4.6",
17396
17399
  "@smithy/core": "^3.20.6",
17397
17400
  "@smithy/eventstream-serde-browser": "^4.2.8",
@@ -18138,7 +18141,7 @@ var init_package = __esm({
18138
18141
  "node_modules/@aws-sdk/nested-clients/package.json"() {
18139
18142
  package_default = {
18140
18143
  name: "@aws-sdk/nested-clients",
18141
- version: "3.970.0",
18144
+ version: "3.971.0",
18142
18145
  description: "Nested clients for AWS SDK packages.",
18143
18146
  main: "./dist-cjs/index.js",
18144
18147
  module: "./dist-es/index.js",
@@ -18176,7 +18179,7 @@ var init_package = __esm({
18176
18179
  "@aws-sdk/types": "3.969.0",
18177
18180
  "@aws-sdk/util-endpoints": "3.970.0",
18178
18181
  "@aws-sdk/util-user-agent-browser": "3.969.0",
18179
- "@aws-sdk/util-user-agent-node": "3.970.0",
18182
+ "@aws-sdk/util-user-agent-node": "3.971.0",
18180
18183
  "@smithy/config-resolver": "^4.4.6",
18181
18184
  "@smithy/core": "^3.20.6",
18182
18185
  "@smithy/fetch-http-handler": "^5.3.9",
@@ -19520,7 +19523,7 @@ var require_package3 = __commonJS({
19520
19523
  module2.exports = {
19521
19524
  name: "@aws-sdk/client-sso",
19522
19525
  description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native",
19523
- version: "3.970.0",
19526
+ version: "3.971.0",
19524
19527
  scripts: {
19525
19528
  build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
19526
19529
  "build:cjs": "node ../../scripts/compilation/inline client-sso",
@@ -19549,7 +19552,7 @@ var require_package3 = __commonJS({
19549
19552
  "@aws-sdk/types": "3.969.0",
19550
19553
  "@aws-sdk/util-endpoints": "3.970.0",
19551
19554
  "@aws-sdk/util-user-agent-browser": "3.969.0",
19552
- "@aws-sdk/util-user-agent-node": "3.970.0",
19555
+ "@aws-sdk/util-user-agent-node": "3.971.0",
19553
19556
  "@smithy/config-resolver": "^4.4.6",
19554
19557
  "@smithy/core": "^3.20.6",
19555
19558
  "@smithy/fetch-http-handler": "^5.3.9",
@@ -81416,6 +81419,10 @@ function cleanSchemaResponse(response) {
81416
81419
  return response;
81417
81420
  }
81418
81421
  const trimmed = response.trim();
81422
+ const resultWrapperMatch = trimmed.match(/^<result>\s*([\s\S]*?)\s*<\/result>$/);
81423
+ if (resultWrapperMatch) {
81424
+ return cleanSchemaResponse(resultWrapperMatch[1]);
81425
+ }
81419
81426
  const jsonBlockMatch = trimmed.match(/```json\s*\n([\s\S]*?)\n```/);
81420
81427
  if (jsonBlockMatch) {
81421
81428
  return normalizeJsonQuotes(jsonBlockMatch[1].trim());
package/cjs/index.cjs CHANGED
@@ -7671,6 +7671,9 @@ var init_HttpBindingProtocol = __esm({
7671
7671
  const memberTraits = memberNs.getMergedTraits() ?? {};
7672
7672
  const inputMemberValue = input[memberName];
7673
7673
  if (inputMemberValue == null && !memberNs.isIdempotencyToken()) {
7674
+ if (memberTraits.httpLabel) {
7675
+ throw new Error(`No value provided for input HTTP label: ${memberName}.`);
7676
+ }
7674
7677
  continue;
7675
7678
  }
7676
7679
  if (memberTraits.httpPayload) {
@@ -18884,7 +18887,7 @@ var require_package2 = __commonJS({
18884
18887
  module2.exports = {
18885
18888
  name: "@aws-sdk/client-bedrock-runtime",
18886
18889
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
18887
- version: "3.970.0",
18890
+ version: "3.971.0",
18888
18891
  scripts: {
18889
18892
  build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
18890
18893
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -18905,20 +18908,20 @@ var require_package2 = __commonJS({
18905
18908
  "@aws-crypto/sha256-browser": "5.2.0",
18906
18909
  "@aws-crypto/sha256-js": "5.2.0",
18907
18910
  "@aws-sdk/core": "3.970.0",
18908
- "@aws-sdk/credential-provider-node": "3.970.0",
18909
- "@aws-sdk/eventstream-handler-node": "3.969.0",
18911
+ "@aws-sdk/credential-provider-node": "3.971.0",
18912
+ "@aws-sdk/eventstream-handler-node": "3.971.0",
18910
18913
  "@aws-sdk/middleware-eventstream": "3.969.0",
18911
18914
  "@aws-sdk/middleware-host-header": "3.969.0",
18912
18915
  "@aws-sdk/middleware-logger": "3.969.0",
18913
18916
  "@aws-sdk/middleware-recursion-detection": "3.969.0",
18914
18917
  "@aws-sdk/middleware-user-agent": "3.970.0",
18915
- "@aws-sdk/middleware-websocket": "3.969.0",
18918
+ "@aws-sdk/middleware-websocket": "3.971.0",
18916
18919
  "@aws-sdk/region-config-resolver": "3.969.0",
18917
- "@aws-sdk/token-providers": "3.970.0",
18920
+ "@aws-sdk/token-providers": "3.971.0",
18918
18921
  "@aws-sdk/types": "3.969.0",
18919
18922
  "@aws-sdk/util-endpoints": "3.970.0",
18920
18923
  "@aws-sdk/util-user-agent-browser": "3.969.0",
18921
- "@aws-sdk/util-user-agent-node": "3.970.0",
18924
+ "@aws-sdk/util-user-agent-node": "3.971.0",
18922
18925
  "@smithy/config-resolver": "^4.4.6",
18923
18926
  "@smithy/core": "^3.20.6",
18924
18927
  "@smithy/eventstream-serde-browser": "^4.2.8",
@@ -19665,7 +19668,7 @@ var init_package = __esm({
19665
19668
  "node_modules/@aws-sdk/nested-clients/package.json"() {
19666
19669
  package_default = {
19667
19670
  name: "@aws-sdk/nested-clients",
19668
- version: "3.970.0",
19671
+ version: "3.971.0",
19669
19672
  description: "Nested clients for AWS SDK packages.",
19670
19673
  main: "./dist-cjs/index.js",
19671
19674
  module: "./dist-es/index.js",
@@ -19703,7 +19706,7 @@ var init_package = __esm({
19703
19706
  "@aws-sdk/types": "3.969.0",
19704
19707
  "@aws-sdk/util-endpoints": "3.970.0",
19705
19708
  "@aws-sdk/util-user-agent-browser": "3.969.0",
19706
- "@aws-sdk/util-user-agent-node": "3.970.0",
19709
+ "@aws-sdk/util-user-agent-node": "3.971.0",
19707
19710
  "@smithy/config-resolver": "^4.4.6",
19708
19711
  "@smithy/core": "^3.20.6",
19709
19712
  "@smithy/fetch-http-handler": "^5.3.9",
@@ -21047,7 +21050,7 @@ var require_package3 = __commonJS({
21047
21050
  module2.exports = {
21048
21051
  name: "@aws-sdk/client-sso",
21049
21052
  description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native",
21050
- version: "3.970.0",
21053
+ version: "3.971.0",
21051
21054
  scripts: {
21052
21055
  build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
21053
21056
  "build:cjs": "node ../../scripts/compilation/inline client-sso",
@@ -21076,7 +21079,7 @@ var require_package3 = __commonJS({
21076
21079
  "@aws-sdk/types": "3.969.0",
21077
21080
  "@aws-sdk/util-endpoints": "3.970.0",
21078
21081
  "@aws-sdk/util-user-agent-browser": "3.969.0",
21079
- "@aws-sdk/util-user-agent-node": "3.970.0",
21082
+ "@aws-sdk/util-user-agent-node": "3.971.0",
21080
21083
  "@smithy/config-resolver": "^4.4.6",
21081
21084
  "@smithy/core": "^3.20.6",
21082
21085
  "@smithy/fetch-http-handler": "^5.3.9",
@@ -79038,6 +79041,10 @@ function cleanSchemaResponse(response) {
79038
79041
  return response;
79039
79042
  }
79040
79043
  const trimmed = response.trim();
79044
+ const resultWrapperMatch = trimmed.match(/^<result>\s*([\s\S]*?)\s*<\/result>$/);
79045
+ if (resultWrapperMatch) {
79046
+ return cleanSchemaResponse(resultWrapperMatch[1]);
79047
+ }
79041
79048
  const jsonBlockMatch = trimmed.match(/```json\s*\n([\s\S]*?)\n```/);
79042
79049
  if (jsonBlockMatch) {
79043
79050
  return normalizeJsonQuotes(jsonBlockMatch[1].trim());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc188",
3
+ "version": "0.6.0-rc190",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -14,6 +14,7 @@ import {
14
14
  } from '@modelcontextprotocol/sdk/types.js';
15
15
  import { readFileSync, existsSync } from 'fs';
16
16
  import { resolve } from 'path';
17
+ import { extract } from '../index.js';
17
18
  import { initializeSimpleTelemetryFromOptions, SimpleAppTracer } from './simpleTelemetry.js';
18
19
  import {
19
20
  cleanSchemaResponse,
@@ -395,11 +396,30 @@ class ProbeAgentMcpServer {
395
396
  required: ['query']
396
397
  },
397
398
  },
399
+ {
400
+ name: 'extract_code',
401
+ description: "Extract full code blocks from files using tree-sitter AST parsing. Use this to get complete code content based on file paths and symbols returned by search_code. Each file path can include optional line numbers or symbol names to extract specific code blocks.",
402
+ inputSchema: {
403
+ type: 'object',
404
+ properties: {
405
+ path: {
406
+ type: 'string',
407
+ description: 'Absolute path to the project root directory (used as working directory for relative file paths).',
408
+ },
409
+ files: {
410
+ type: 'array',
411
+ items: { type: 'string' },
412
+ description: 'Array of file paths to extract from. Formats: "file.js" (entire file), "file.js:42" (code block at line 42), "file.js:10-20" (lines 10-20), "file.js#funcName" (specific symbol). Line numbers and symbols are part of the path string, not separate parameters. Paths can be absolute or relative to the project directory.',
413
+ }
414
+ },
415
+ required: ['path', 'files'],
416
+ },
417
+ },
398
418
  ],
399
419
  }));
400
420
 
401
421
  this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
402
- if (request.params.name !== 'search_code') {
422
+ if (request.params.name !== 'search_code' && request.params.name !== 'extract_code') {
403
423
  throw new McpError(
404
424
  ErrorCode.MethodNotFound,
405
425
  `Unknown tool: ${request.params.name}`
@@ -409,6 +429,42 @@ class ProbeAgentMcpServer {
409
429
  try {
410
430
  const args = request.params.arguments;
411
431
 
432
+ // Handle extract_code tool
433
+ if (request.params.name === 'extract_code') {
434
+ // Validate required parameters
435
+ if (!args.path) {
436
+ throw new Error("Path is required");
437
+ }
438
+ if (!args.files || !Array.isArray(args.files) || args.files.length === 0) {
439
+ throw new Error("Files array is required and must not be empty");
440
+ }
441
+
442
+ // Build options with smart defaults
443
+ const options = {
444
+ files: args.files,
445
+ path: args.path,
446
+ format: 'xml',
447
+ allowTests: true, // Include test files by default
448
+ };
449
+
450
+ if (process.env.DEBUG === '1') {
451
+ console.error('[DEBUG] Executing extract_code with options:', JSON.stringify(options, null, 2));
452
+ }
453
+
454
+ // Execute the extract command
455
+ const result = await extract(options);
456
+
457
+ return {
458
+ content: [
459
+ {
460
+ type: 'text',
461
+ text: result,
462
+ },
463
+ ],
464
+ };
465
+ }
466
+
467
+ // Handle search_code tool
412
468
  // Validate required fields
413
469
  if (!args.query) {
414
470
  throw new Error("Query is required");
@@ -554,7 +610,7 @@ class ProbeAgentMcpServer {
554
610
  ],
555
611
  };
556
612
  } catch (error) {
557
- console.error(`Error executing search_code:`, error);
613
+ console.error(`Error executing ${request.params.name}:`, error);
558
614
  return {
559
615
  content: [
560
616
  {
@@ -253,6 +253,14 @@ export function cleanSchemaResponse(response) {
253
253
 
254
254
  const trimmed = response.trim();
255
255
 
256
+ // Strip <result>...</result> wrapper if present (legacy XML format from some AI models)
257
+ // Some models like Google Gemini wrap JSON in <result> tags despite instructions not to
258
+ const resultWrapperMatch = trimmed.match(/^<result>\s*([\s\S]*?)\s*<\/result>$/);
259
+ if (resultWrapperMatch) {
260
+ // Recursively clean the inner content in case there are nested patterns
261
+ return cleanSchemaResponse(resultWrapperMatch[1]);
262
+ }
263
+
256
264
  // First, look for JSON after code block markers - similar to mermaid extraction
257
265
  // Try with json language specifier
258
266
  const jsonBlockMatch = trimmed.match(/```json\s*\n([\s\S]*?)\n```/);