@probelabs/probe 0.6.0-rc329 → 0.6.0-rc331

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/extract.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { exec, spawn } from 'child_process';
7
7
  import { promisify } from 'util';
8
- import { getBinaryPath, buildCliArgs, escapeString } from './utils.js';
8
+ import { getBinaryPath, buildCliArgs, escapeString, getCleanEnv } from './utils.js';
9
9
  import { validateCwdPath } from './utils/path-validation.js';
10
10
 
11
11
  const execAsync = promisify(exec);
@@ -104,7 +104,7 @@ export async function extract(options) {
104
104
  const command = `${binaryPath} extract ${cliArgs.join(' ')}`;
105
105
 
106
106
  try {
107
- const { stdout, stderr } = await execAsync(command, { cwd });
107
+ const { stdout, stderr } = await execAsync(command, { cwd, env: getCleanEnv() });
108
108
 
109
109
  if (stderr) {
110
110
  console.error(`stderr: ${stderr}`);
@@ -126,7 +126,8 @@ function extractWithStdin(binaryPath, cliArgs, content, options, cwd) {
126
126
  return new Promise((resolve, reject) => {
127
127
  const childProcess = spawn(binaryPath, ['extract', ...cliArgs], {
128
128
  stdio: ['pipe', 'pipe', 'pipe'],
129
- cwd
129
+ cwd,
130
+ env: getCleanEnv()
130
131
  });
131
132
 
132
133
  let stdout = '';
package/build/grep.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { execFile } from 'child_process';
7
7
  import { promisify } from 'util';
8
- import { getBinaryPath } from './utils.js';
8
+ import { getBinaryPath, getCleanEnv } from './utils.js';
9
9
 
10
10
  const execFileAsync = promisify(execFile);
11
11
 
@@ -131,7 +131,7 @@ export async function grep(options) {
131
131
  const { stdout, stderr } = await execFileAsync(binaryPath, cliArgs, {
132
132
  maxBuffer: 10 * 1024 * 1024, // 10MB buffer
133
133
  env: {
134
- ...process.env,
134
+ ...getCleanEnv(),
135
135
  // Disable colors in stderr for cleaner output
136
136
  NO_COLOR: '1'
137
137
  }
package/build/query.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { exec } from 'child_process';
7
7
  import { promisify } from 'util';
8
- import { getBinaryPath, buildCliArgs, escapeString } from './utils.js';
8
+ import { getBinaryPath, buildCliArgs, escapeString, getCleanEnv } from './utils.js';
9
9
  import { validateCwdPath } from './utils/path-validation.js';
10
10
 
11
11
  const execAsync = promisify(exec);
@@ -84,7 +84,7 @@ export async function query(options) {
84
84
  const command = `${binaryPath} query ${cliArgs.join(' ')}`;
85
85
 
86
86
  try {
87
- const { stdout, stderr } = await execAsync(command, { cwd });
87
+ const { stdout, stderr } = await execAsync(command, { cwd, env: getCleanEnv() });
88
88
 
89
89
  if (stderr) {
90
90
  console.error(`stderr: ${stderr}`);
package/build/search.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { execFile } from 'child_process';
7
7
  import { promisify } from 'util';
8
- import { getBinaryPath, buildCliArgs } from './utils.js';
8
+ import { getBinaryPath, buildCliArgs, getCleanEnv } from './utils.js';
9
9
  import { validateCwdPath } from './utils/path-validation.js';
10
10
  import { TimeoutError, categorizeError } from './utils/error-types.js';
11
11
 
@@ -164,6 +164,7 @@ export async function search(options) {
164
164
  // Execute with execFile (no shell, prevents command injection)
165
165
  const { stdout, stderr } = await execFileAsync(binaryPath, args, {
166
166
  cwd,
167
+ env: getCleanEnv(),
167
168
  timeout: options.timeout * 1000, // Convert seconds to milliseconds
168
169
  maxBuffer: 50 * 1024 * 1024 // 50MB buffer for large outputs
169
170
  });
package/build/symbols.js CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { spawn } from 'child_process';
7
- import { getBinaryPath, escapeString } from './utils.js';
7
+ import { getBinaryPath, escapeString, getCleanEnv } from './utils.js';
8
8
  import { validateCwdPath } from './utils/path-validation.js';
9
9
 
10
10
  /**
@@ -47,7 +47,8 @@ export async function symbols(options) {
47
47
  return new Promise((resolve, reject) => {
48
48
  const childProcess = spawn(binaryPath, args, {
49
49
  stdio: ['pipe', 'pipe', 'pipe'],
50
- cwd
50
+ cwd,
51
+ env: getCleanEnv()
51
52
  });
52
53
 
53
54
  let stdout = '';
package/build/utils.js CHANGED
@@ -122,6 +122,29 @@ export function buildCliArgs(options, flagMap) {
122
122
  return cliArgs;
123
123
  }
124
124
 
125
+ /**
126
+ * Build a minimal environment for spawning the probe binary.
127
+ * Prevents E2BIG when the host process accumulates a large process.env.
128
+ * @returns {Record<string, string>} - Clean environment with only essential vars
129
+ */
130
+ export function getCleanEnv() {
131
+ const keep = [
132
+ 'PATH', 'HOME', 'USER', 'SHELL', 'TERM', 'LANG', 'LC_ALL',
133
+ 'TMPDIR', 'TMP', 'TEMP',
134
+ 'SystemRoot', 'SYSTEMROOT', 'COMSPEC', // Windows
135
+ 'PROBE_PATH', 'PROBE_CONFIG_DIR', 'DEBUG',
136
+ 'HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY',
137
+ 'http_proxy', 'https_proxy', 'no_proxy',
138
+ ];
139
+ const env = {};
140
+ for (const key of keep) {
141
+ if (process.env[key] !== undefined) {
142
+ env[key] = process.env[key];
143
+ }
144
+ }
145
+ return env;
146
+ }
147
+
125
148
  /**
126
149
  * Escape a string for use in a command line
127
150
  * @param {string} str - String to escape
@@ -16503,6 +16503,7 @@ async function readResponseWithSizeLimit({
16503
16503
  } finally {
16504
16504
  try {
16505
16505
  await reader.cancel();
16506
+ } catch (e) {
16506
16507
  } finally {
16507
16508
  reader.releaseLock();
16508
16509
  }
@@ -17839,7 +17840,7 @@ var init_dist2 = __esm({
17839
17840
  "ETIMEDOUT",
17840
17841
  "EPIPE"
17841
17842
  ];
17842
- VERSION = true ? "4.0.41" : "0.0.0-test";
17843
+ VERSION = true ? "4.0.45" : "0.0.0-test";
17843
17844
  DEFAULT_SCHEMA_PREFIX = "JSON schema:";
17844
17845
  DEFAULT_SCHEMA_SUFFIX = "You MUST answer with a JSON object that matches the JSON schema above.";
17845
17846
  DEFAULT_GENERIC_SUFFIX = "You MUST answer with JSON.";
@@ -23099,6 +23100,13 @@ async function prepareTools({
23099
23100
  const filteredFunctionTools = (toolChoice == null ? void 0 : toolChoice.type) === "tool" ? functionTools.filter((t) => t.name === toolChoice.toolName) : functionTools;
23100
23101
  const supportsStrictOnTools = supportsStrictTools(modelId);
23101
23102
  for (const tool6 of filteredFunctionTools) {
23103
+ if (!supportsStrictOnTools && tool6.strict != null) {
23104
+ toolWarnings.push({
23105
+ type: "unsupported",
23106
+ feature: "strict",
23107
+ details: `Tool '${tool6.name}' has strict: ${tool6.strict}, but strict mode is not supported by this model on Amazon Bedrock. The strict property will be ignored.`
23108
+ });
23109
+ }
23102
23110
  bedrockTools.push({
23103
23111
  toolSpec: {
23104
23112
  name: tool6.name,
@@ -24091,7 +24099,7 @@ var init_dist3 = __esm({
24091
24099
  const isThinkingEnabled = ((_b16 = bedrockOptions.reasoningConfig) == null ? void 0 : _b16.type) === "enabled" || ((_c = bedrockOptions.reasoningConfig) == null ? void 0 : _c.type) === "adaptive";
24092
24100
  const { supportsStructuredOutput: modelSupportsStructuredOutput } = (0, import_internal2.getModelCapabilities)(this.modelId);
24093
24101
  const useNativeStructuredOutput = isAnthropicModel && supportsNativeStructuredOutput(this.modelId) && (modelSupportsStructuredOutput || isThinkingEnabled) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null;
24094
- const useJsonInstructionForStructuredOutput = isAnthropicModel && (this.modelId.includes("claude-opus-4-7") || this.modelId.includes("claude-opus-4-8")) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && tools2 != null && tools2.length > 0;
24102
+ const useJsonInstructionForStructuredOutput = isAnthropicModel && !supportsStrictTools(this.modelId) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && tools2 != null && tools2.length > 0;
24095
24103
  const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useNativeStructuredOutput && !useJsonInstructionForStructuredOutput ? {
24096
24104
  type: "function",
24097
24105
  name: "json",
@@ -25279,7 +25287,7 @@ var init_dist3 = __esm({
25279
25287
  details: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
25280
25288
  preview: external_exports.unknown().optional()
25281
25289
  });
25282
- VERSION2 = true ? "4.0.144" : "0.0.0-test";
25290
+ VERSION2 = true ? "4.0.153" : "0.0.0-test";
25283
25291
  bedrockRerankingResponseSchema = lazySchema(
25284
25292
  () => zodSchema(
25285
25293
  external_exports.object({
@@ -29106,6 +29114,40 @@ function buildCliArgs(options, flagMap) {
29106
29114
  }
29107
29115
  return cliArgs;
29108
29116
  }
29117
+ function getCleanEnv() {
29118
+ const keep = [
29119
+ "PATH",
29120
+ "HOME",
29121
+ "USER",
29122
+ "SHELL",
29123
+ "TERM",
29124
+ "LANG",
29125
+ "LC_ALL",
29126
+ "TMPDIR",
29127
+ "TMP",
29128
+ "TEMP",
29129
+ "SystemRoot",
29130
+ "SYSTEMROOT",
29131
+ "COMSPEC",
29132
+ // Windows
29133
+ "PROBE_PATH",
29134
+ "PROBE_CONFIG_DIR",
29135
+ "DEBUG",
29136
+ "HTTP_PROXY",
29137
+ "HTTPS_PROXY",
29138
+ "NO_PROXY",
29139
+ "http_proxy",
29140
+ "https_proxy",
29141
+ "no_proxy"
29142
+ ];
29143
+ const env = {};
29144
+ for (const key of keep) {
29145
+ if (process.env[key] !== void 0) {
29146
+ env[key] = process.env[key];
29147
+ }
29148
+ }
29149
+ return env;
29150
+ }
29109
29151
  function escapeString(str) {
29110
29152
  if (process.platform === "win32") {
29111
29153
  return `"${str.replace(/"/g, '\\"')}"`;
@@ -29540,6 +29582,7 @@ Search: query="${queries[0]}" path="${options.path}"`;
29540
29582
  try {
29541
29583
  const { stdout, stderr } = await execFileAsync(binaryPath, args, {
29542
29584
  cwd,
29585
+ env: getCleanEnv(),
29543
29586
  timeout: options.timeout * 1e3,
29544
29587
  // Convert seconds to milliseconds
29545
29588
  maxBuffer: 50 * 1024 * 1024
@@ -29670,7 +29713,7 @@ async function query(options) {
29670
29713
  }
29671
29714
  const command = `${binaryPath} query ${cliArgs.join(" ")}`;
29672
29715
  try {
29673
- const { stdout, stderr } = await execAsync(command, { cwd });
29716
+ const { stdout, stderr } = await execAsync(command, { cwd, env: getCleanEnv() });
29674
29717
  if (stderr) {
29675
29718
  console.error(`stderr: ${stderr}`);
29676
29719
  }
@@ -29764,7 +29807,7 @@ Extract:`;
29764
29807
  }
29765
29808
  const command = `${binaryPath} extract ${cliArgs.join(" ")}`;
29766
29809
  try {
29767
- const { stdout, stderr } = await execAsync2(command, { cwd });
29810
+ const { stdout, stderr } = await execAsync2(command, { cwd, env: getCleanEnv() });
29768
29811
  if (stderr) {
29769
29812
  console.error(`stderr: ${stderr}`);
29770
29813
  }
@@ -29780,7 +29823,8 @@ function extractWithStdin(binaryPath, cliArgs, content, options, cwd) {
29780
29823
  return new Promise((resolve9, reject2) => {
29781
29824
  const childProcess = (0, import_child_process4.spawn)(binaryPath, ["extract", ...cliArgs], {
29782
29825
  stdio: ["pipe", "pipe", "pipe"],
29783
- cwd
29826
+ cwd,
29827
+ env: getCleanEnv()
29784
29828
  });
29785
29829
  let stdout = "";
29786
29830
  let stderr = "";
@@ -29907,7 +29951,8 @@ Symbols: files="${options.files.join(", ")}" cwd="${cwd}"`);
29907
29951
  return new Promise((resolve9, reject2) => {
29908
29952
  const childProcess = (0, import_child_process5.spawn)(binaryPath, args, {
29909
29953
  stdio: ["pipe", "pipe", "pipe"],
29910
- cwd
29954
+ cwd,
29955
+ env: getCleanEnv()
29911
29956
  });
29912
29957
  let stdout = "";
29913
29958
  let stderr = "";
@@ -89046,7 +89091,12 @@ var require_fast_uri = __commonJS({
89046
89091
  }
89047
89092
  function resolve9(baseURI, relativeURI, options) {
89048
89093
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
89049
- const resolved = resolveComponent(parse11(baseURI, schemelessOptions), parse11(relativeURI, schemelessOptions), schemelessOptions, true);
89094
+ const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
89095
+ const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
89096
+ if (baseMalformed || relativeMalformed) {
89097
+ throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
89098
+ }
89099
+ const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
89050
89100
  schemelessOptions.skipEscape = true;
89051
89101
  return serialize(resolved, schemelessOptions);
89052
89102
  }
@@ -89172,6 +89222,7 @@ var require_fast_uri = __commonJS({
89172
89222
  }
89173
89223
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
89174
89224
  var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
89225
+ var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
89175
89226
  function getParseError(parsed, matches) {
89176
89227
  if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
89177
89228
  return 'URI path must start with "/" when authority is present.';
@@ -89206,6 +89257,20 @@ var require_fast_uri = __commonJS({
89206
89257
  parsed.error = "URI authority must not contain a literal backslash.";
89207
89258
  malformedAuthorityOrPort = true;
89208
89259
  }
89260
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
89261
+ if (introducerMatch !== null) {
89262
+ const region = introducerMatch[1];
89263
+ const normalizedRegion = region.replace(/[\t\n\r]/g, "");
89264
+ if (normalizedRegion.length >= 2) {
89265
+ if (normalizedRegion.slice(0, 2) !== "//") {
89266
+ parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
89267
+ malformedAuthorityOrPort = true;
89268
+ } else if (region.length !== normalizedRegion.length) {
89269
+ parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
89270
+ malformedAuthorityOrPort = true;
89271
+ }
89272
+ }
89273
+ }
89209
89274
  const matches = uri.match(URI_PARSE);
89210
89275
  if (matches) {
89211
89276
  parsed.scheme = matches[1];
package/cjs/index.cjs CHANGED
@@ -1411,6 +1411,40 @@ function buildCliArgs(options, flagMap) {
1411
1411
  }
1412
1412
  return cliArgs;
1413
1413
  }
1414
+ function getCleanEnv() {
1415
+ const keep = [
1416
+ "PATH",
1417
+ "HOME",
1418
+ "USER",
1419
+ "SHELL",
1420
+ "TERM",
1421
+ "LANG",
1422
+ "LC_ALL",
1423
+ "TMPDIR",
1424
+ "TMP",
1425
+ "TEMP",
1426
+ "SystemRoot",
1427
+ "SYSTEMROOT",
1428
+ "COMSPEC",
1429
+ // Windows
1430
+ "PROBE_PATH",
1431
+ "PROBE_CONFIG_DIR",
1432
+ "DEBUG",
1433
+ "HTTP_PROXY",
1434
+ "HTTPS_PROXY",
1435
+ "NO_PROXY",
1436
+ "http_proxy",
1437
+ "https_proxy",
1438
+ "no_proxy"
1439
+ ];
1440
+ const env = {};
1441
+ for (const key of keep) {
1442
+ if (process.env[key] !== void 0) {
1443
+ env[key] = process.env[key];
1444
+ }
1445
+ }
1446
+ return env;
1447
+ }
1414
1448
  function escapeString(str) {
1415
1449
  if (process.platform === "win32") {
1416
1450
  return `"${str.replace(/"/g, '\\"')}"`;
@@ -1845,6 +1879,7 @@ Search: query="${queries[0]}" path="${options.path}"`;
1845
1879
  try {
1846
1880
  const { stdout, stderr } = await execFileAsync(binaryPath, args, {
1847
1881
  cwd,
1882
+ env: getCleanEnv(),
1848
1883
  timeout: options.timeout * 1e3,
1849
1884
  // Convert seconds to milliseconds
1850
1885
  maxBuffer: 50 * 1024 * 1024
@@ -1975,7 +2010,7 @@ async function query(options) {
1975
2010
  }
1976
2011
  const command = `${binaryPath} query ${cliArgs.join(" ")}`;
1977
2012
  try {
1978
- const { stdout, stderr } = await execAsync(command, { cwd });
2013
+ const { stdout, stderr } = await execAsync(command, { cwd, env: getCleanEnv() });
1979
2014
  if (stderr) {
1980
2015
  console.error(`stderr: ${stderr}`);
1981
2016
  }
@@ -2069,7 +2104,7 @@ Extract:`;
2069
2104
  }
2070
2105
  const command = `${binaryPath} extract ${cliArgs.join(" ")}`;
2071
2106
  try {
2072
- const { stdout, stderr } = await execAsync2(command, { cwd });
2107
+ const { stdout, stderr } = await execAsync2(command, { cwd, env: getCleanEnv() });
2073
2108
  if (stderr) {
2074
2109
  console.error(`stderr: ${stderr}`);
2075
2110
  }
@@ -2085,7 +2120,8 @@ function extractWithStdin(binaryPath, cliArgs, content, options, cwd) {
2085
2120
  return new Promise((resolve9, reject2) => {
2086
2121
  const childProcess = (0, import_child_process4.spawn)(binaryPath, ["extract", ...cliArgs], {
2087
2122
  stdio: ["pipe", "pipe", "pipe"],
2088
- cwd
2123
+ cwd,
2124
+ env: getCleanEnv()
2089
2125
  });
2090
2126
  let stdout = "";
2091
2127
  let stderr = "";
@@ -2212,7 +2248,8 @@ Symbols: files="${options.files.join(", ")}" cwd="${cwd}"`);
2212
2248
  return new Promise((resolve9, reject2) => {
2213
2249
  const childProcess = (0, import_child_process5.spawn)(binaryPath, args, {
2214
2250
  stdio: ["pipe", "pipe", "pipe"],
2215
- cwd
2251
+ cwd,
2252
+ env: getCleanEnv()
2216
2253
  });
2217
2254
  let stdout = "";
2218
2255
  let stderr = "";
@@ -2281,7 +2318,7 @@ async function grep(options) {
2281
2318
  maxBuffer: 10 * 1024 * 1024,
2282
2319
  // 10MB buffer
2283
2320
  env: {
2284
- ...process.env,
2321
+ ...getCleanEnv(),
2285
2322
  // Disable colors in stderr for cleaner output
2286
2323
  NO_COLOR: "1"
2287
2324
  }
@@ -18432,6 +18469,7 @@ async function readResponseWithSizeLimit({
18432
18469
  } finally {
18433
18470
  try {
18434
18471
  await reader.cancel();
18472
+ } catch (e) {
18435
18473
  } finally {
18436
18474
  reader.releaseLock();
18437
18475
  }
@@ -19768,7 +19806,7 @@ var init_dist2 = __esm({
19768
19806
  "ETIMEDOUT",
19769
19807
  "EPIPE"
19770
19808
  ];
19771
- VERSION = true ? "4.0.41" : "0.0.0-test";
19809
+ VERSION = true ? "4.0.45" : "0.0.0-test";
19772
19810
  DEFAULT_SCHEMA_PREFIX = "JSON schema:";
19773
19811
  DEFAULT_SCHEMA_SUFFIX = "You MUST answer with a JSON object that matches the JSON schema above.";
19774
19812
  DEFAULT_GENERIC_SUFFIX = "You MUST answer with JSON.";
@@ -25028,6 +25066,13 @@ async function prepareTools({
25028
25066
  const filteredFunctionTools = (toolChoice == null ? void 0 : toolChoice.type) === "tool" ? functionTools.filter((t) => t.name === toolChoice.toolName) : functionTools;
25029
25067
  const supportsStrictOnTools = supportsStrictTools(modelId);
25030
25068
  for (const tool6 of filteredFunctionTools) {
25069
+ if (!supportsStrictOnTools && tool6.strict != null) {
25070
+ toolWarnings.push({
25071
+ type: "unsupported",
25072
+ feature: "strict",
25073
+ details: `Tool '${tool6.name}' has strict: ${tool6.strict}, but strict mode is not supported by this model on Amazon Bedrock. The strict property will be ignored.`
25074
+ });
25075
+ }
25031
25076
  bedrockTools.push({
25032
25077
  toolSpec: {
25033
25078
  name: tool6.name,
@@ -26020,7 +26065,7 @@ var init_dist3 = __esm({
26020
26065
  const isThinkingEnabled = ((_b16 = bedrockOptions.reasoningConfig) == null ? void 0 : _b16.type) === "enabled" || ((_c = bedrockOptions.reasoningConfig) == null ? void 0 : _c.type) === "adaptive";
26021
26066
  const { supportsStructuredOutput: modelSupportsStructuredOutput } = (0, import_internal2.getModelCapabilities)(this.modelId);
26022
26067
  const useNativeStructuredOutput = isAnthropicModel && supportsNativeStructuredOutput(this.modelId) && (modelSupportsStructuredOutput || isThinkingEnabled) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null;
26023
- const useJsonInstructionForStructuredOutput = isAnthropicModel && (this.modelId.includes("claude-opus-4-7") || this.modelId.includes("claude-opus-4-8")) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && tools2 != null && tools2.length > 0;
26068
+ const useJsonInstructionForStructuredOutput = isAnthropicModel && !supportsStrictTools(this.modelId) && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && tools2 != null && tools2.length > 0;
26024
26069
  const jsonResponseTool = (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && !useNativeStructuredOutput && !useJsonInstructionForStructuredOutput ? {
26025
26070
  type: "function",
26026
26071
  name: "json",
@@ -27208,7 +27253,7 @@ var init_dist3 = __esm({
27208
27253
  details: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
27209
27254
  preview: external_exports.unknown().optional()
27210
27255
  });
27211
- VERSION2 = true ? "4.0.144" : "0.0.0-test";
27256
+ VERSION2 = true ? "4.0.153" : "0.0.0-test";
27212
27257
  bedrockRerankingResponseSchema = lazySchema(
27213
27258
  () => zodSchema(
27214
27259
  external_exports.object({
@@ -73120,7 +73165,12 @@ var require_fast_uri = __commonJS({
73120
73165
  }
73121
73166
  function resolve9(baseURI, relativeURI, options) {
73122
73167
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
73123
- const resolved = resolveComponent(parse11(baseURI, schemelessOptions), parse11(relativeURI, schemelessOptions), schemelessOptions, true);
73168
+ const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
73169
+ const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
73170
+ if (baseMalformed || relativeMalformed) {
73171
+ throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
73172
+ }
73173
+ const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
73124
73174
  schemelessOptions.skipEscape = true;
73125
73175
  return serialize(resolved, schemelessOptions);
73126
73176
  }
@@ -73246,6 +73296,7 @@ var require_fast_uri = __commonJS({
73246
73296
  }
73247
73297
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
73248
73298
  var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
73299
+ var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
73249
73300
  function getParseError(parsed, matches) {
73250
73301
  if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
73251
73302
  return 'URI path must start with "/" when authority is present.';
@@ -73280,6 +73331,20 @@ var require_fast_uri = __commonJS({
73280
73331
  parsed.error = "URI authority must not contain a literal backslash.";
73281
73332
  malformedAuthorityOrPort = true;
73282
73333
  }
73334
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
73335
+ if (introducerMatch !== null) {
73336
+ const region = introducerMatch[1];
73337
+ const normalizedRegion = region.replace(/[\t\n\r]/g, "");
73338
+ if (normalizedRegion.length >= 2) {
73339
+ if (normalizedRegion.slice(0, 2) !== "//") {
73340
+ parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
73341
+ malformedAuthorityOrPort = true;
73342
+ } else if (region.length !== normalizedRegion.length) {
73343
+ parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
73344
+ malformedAuthorityOrPort = true;
73345
+ }
73346
+ }
73347
+ }
73283
73348
  const matches = uri.match(URI_PARSE);
73284
73349
  if (matches) {
73285
73350
  parsed.scheme = matches[1];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc329",
3
+ "version": "0.6.0-rc331",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
package/src/extract.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { exec, spawn } from 'child_process';
7
7
  import { promisify } from 'util';
8
- import { getBinaryPath, buildCliArgs, escapeString } from './utils.js';
8
+ import { getBinaryPath, buildCliArgs, escapeString, getCleanEnv } from './utils.js';
9
9
  import { validateCwdPath } from './utils/path-validation.js';
10
10
 
11
11
  const execAsync = promisify(exec);
@@ -104,7 +104,7 @@ export async function extract(options) {
104
104
  const command = `${binaryPath} extract ${cliArgs.join(' ')}`;
105
105
 
106
106
  try {
107
- const { stdout, stderr } = await execAsync(command, { cwd });
107
+ const { stdout, stderr } = await execAsync(command, { cwd, env: getCleanEnv() });
108
108
 
109
109
  if (stderr) {
110
110
  console.error(`stderr: ${stderr}`);
@@ -126,7 +126,8 @@ function extractWithStdin(binaryPath, cliArgs, content, options, cwd) {
126
126
  return new Promise((resolve, reject) => {
127
127
  const childProcess = spawn(binaryPath, ['extract', ...cliArgs], {
128
128
  stdio: ['pipe', 'pipe', 'pipe'],
129
- cwd
129
+ cwd,
130
+ env: getCleanEnv()
130
131
  });
131
132
 
132
133
  let stdout = '';
package/src/grep.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { execFile } from 'child_process';
7
7
  import { promisify } from 'util';
8
- import { getBinaryPath } from './utils.js';
8
+ import { getBinaryPath, getCleanEnv } from './utils.js';
9
9
 
10
10
  const execFileAsync = promisify(execFile);
11
11
 
@@ -131,7 +131,7 @@ export async function grep(options) {
131
131
  const { stdout, stderr } = await execFileAsync(binaryPath, cliArgs, {
132
132
  maxBuffer: 10 * 1024 * 1024, // 10MB buffer
133
133
  env: {
134
- ...process.env,
134
+ ...getCleanEnv(),
135
135
  // Disable colors in stderr for cleaner output
136
136
  NO_COLOR: '1'
137
137
  }
package/src/query.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { exec } from 'child_process';
7
7
  import { promisify } from 'util';
8
- import { getBinaryPath, buildCliArgs, escapeString } from './utils.js';
8
+ import { getBinaryPath, buildCliArgs, escapeString, getCleanEnv } from './utils.js';
9
9
  import { validateCwdPath } from './utils/path-validation.js';
10
10
 
11
11
  const execAsync = promisify(exec);
@@ -84,7 +84,7 @@ export async function query(options) {
84
84
  const command = `${binaryPath} query ${cliArgs.join(' ')}`;
85
85
 
86
86
  try {
87
- const { stdout, stderr } = await execAsync(command, { cwd });
87
+ const { stdout, stderr } = await execAsync(command, { cwd, env: getCleanEnv() });
88
88
 
89
89
  if (stderr) {
90
90
  console.error(`stderr: ${stderr}`);
package/src/search.js CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  import { execFile } from 'child_process';
7
7
  import { promisify } from 'util';
8
- import { getBinaryPath, buildCliArgs } from './utils.js';
8
+ import { getBinaryPath, buildCliArgs, getCleanEnv } from './utils.js';
9
9
  import { validateCwdPath } from './utils/path-validation.js';
10
10
  import { TimeoutError, categorizeError } from './utils/error-types.js';
11
11
 
@@ -164,6 +164,7 @@ export async function search(options) {
164
164
  // Execute with execFile (no shell, prevents command injection)
165
165
  const { stdout, stderr } = await execFileAsync(binaryPath, args, {
166
166
  cwd,
167
+ env: getCleanEnv(),
167
168
  timeout: options.timeout * 1000, // Convert seconds to milliseconds
168
169
  maxBuffer: 50 * 1024 * 1024 // 50MB buffer for large outputs
169
170
  });
package/src/symbols.js CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { spawn } from 'child_process';
7
- import { getBinaryPath, escapeString } from './utils.js';
7
+ import { getBinaryPath, escapeString, getCleanEnv } from './utils.js';
8
8
  import { validateCwdPath } from './utils/path-validation.js';
9
9
 
10
10
  /**
@@ -47,7 +47,8 @@ export async function symbols(options) {
47
47
  return new Promise((resolve, reject) => {
48
48
  const childProcess = spawn(binaryPath, args, {
49
49
  stdio: ['pipe', 'pipe', 'pipe'],
50
- cwd
50
+ cwd,
51
+ env: getCleanEnv()
51
52
  });
52
53
 
53
54
  let stdout = '';
package/src/utils.js CHANGED
@@ -122,6 +122,29 @@ export function buildCliArgs(options, flagMap) {
122
122
  return cliArgs;
123
123
  }
124
124
 
125
+ /**
126
+ * Build a minimal environment for spawning the probe binary.
127
+ * Prevents E2BIG when the host process accumulates a large process.env.
128
+ * @returns {Record<string, string>} - Clean environment with only essential vars
129
+ */
130
+ export function getCleanEnv() {
131
+ const keep = [
132
+ 'PATH', 'HOME', 'USER', 'SHELL', 'TERM', 'LANG', 'LC_ALL',
133
+ 'TMPDIR', 'TMP', 'TEMP',
134
+ 'SystemRoot', 'SYSTEMROOT', 'COMSPEC', // Windows
135
+ 'PROBE_PATH', 'PROBE_CONFIG_DIR', 'DEBUG',
136
+ 'HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY',
137
+ 'http_proxy', 'https_proxy', 'no_proxy',
138
+ ];
139
+ const env = {};
140
+ for (const key of keep) {
141
+ if (process.env[key] !== undefined) {
142
+ env[key] = process.env[key];
143
+ }
144
+ }
145
+ return env;
146
+ }
147
+
125
148
  /**
126
149
  * Escape a string for use in a command line
127
150
  * @param {string} str - String to escape