@probelabs/probe 0.6.0-rc241 → 0.6.0-rc245

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.
@@ -5978,6 +5978,8 @@ var init_EventStreamSerde = __esm({
5978
5978
  } else {
5979
5979
  serializer.write(eventSchema, event[unionMember]);
5980
5980
  }
5981
+ } else if (eventSchema.isUnitSchema()) {
5982
+ serializer.write(eventSchema, {});
5981
5983
  } else {
5982
5984
  throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.");
5983
5985
  }
@@ -6314,7 +6316,9 @@ var init_HttpBindingProtocol = __esm({
6314
6316
  if (bytes.byteLength > 0) {
6315
6317
  const dataFromBody = await deserializer.read(ns, bytes);
6316
6318
  for (const member2 of nonHttpBindingMembers) {
6317
- dataObject[member2] = dataFromBody[member2];
6319
+ if (dataFromBody[member2] != null) {
6320
+ dataObject[member2] = dataFromBody[member2];
6321
+ }
6318
6322
  }
6319
6323
  }
6320
6324
  } else if (nonHttpBindingMembers.discardResponseBody) {
@@ -17502,7 +17506,7 @@ var require_package2 = __commonJS({
17502
17506
  module2.exports = {
17503
17507
  name: "@aws-sdk/client-bedrock-runtime",
17504
17508
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
17505
- version: "3.991.0",
17509
+ version: "3.992.0",
17506
17510
  scripts: {
17507
17511
  build: "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
17508
17512
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -17532,9 +17536,9 @@ var require_package2 = __commonJS({
17532
17536
  "@aws-sdk/middleware-user-agent": "^3.972.10",
17533
17537
  "@aws-sdk/middleware-websocket": "^3.972.6",
17534
17538
  "@aws-sdk/region-config-resolver": "^3.972.3",
17535
- "@aws-sdk/token-providers": "3.991.0",
17539
+ "@aws-sdk/token-providers": "3.992.0",
17536
17540
  "@aws-sdk/types": "^3.973.1",
17537
- "@aws-sdk/util-endpoints": "3.991.0",
17541
+ "@aws-sdk/util-endpoints": "3.992.0",
17538
17542
  "@aws-sdk/util-user-agent-browser": "^3.972.3",
17539
17543
  "@aws-sdk/util-user-agent-node": "^3.972.8",
17540
17544
  "@smithy/config-resolver": "^4.4.6",
@@ -24104,7 +24108,7 @@ var init_package2 = __esm({
24104
24108
  "node_modules/@aws-sdk/token-providers/node_modules/@aws-sdk/nested-clients/package.json"() {
24105
24109
  package_default2 = {
24106
24110
  name: "@aws-sdk/nested-clients",
24107
- version: "3.991.0",
24111
+ version: "3.992.0",
24108
24112
  description: "Nested clients for AWS SDK packages.",
24109
24113
  main: "./dist-cjs/index.js",
24110
24114
  module: "./dist-es/index.js",
@@ -24140,7 +24144,7 @@ var init_package2 = __esm({
24140
24144
  "@aws-sdk/middleware-user-agent": "^3.972.10",
24141
24145
  "@aws-sdk/region-config-resolver": "^3.972.3",
24142
24146
  "@aws-sdk/types": "^3.973.1",
24143
- "@aws-sdk/util-endpoints": "3.991.0",
24147
+ "@aws-sdk/util-endpoints": "3.992.0",
24144
24148
  "@aws-sdk/util-user-agent-browser": "^3.972.3",
24145
24149
  "@aws-sdk/util-user-agent-node": "^3.972.8",
24146
24150
  "@smithy/config-resolver": "^4.4.6",
@@ -51352,7 +51356,16 @@ function generateSandboxGlobals(options) {
51352
51356
  }
51353
51357
  if (llmCall) {
51354
51358
  const rawLLM = async (instruction, data3, opts = {}) => {
51355
- return llmCall(instruction, data3, opts);
51359
+ const result = await llmCall(instruction, data3, opts);
51360
+ if (opts.schema && typeof result === "string") {
51361
+ try {
51362
+ return JSON.parse(result);
51363
+ } catch (e5) {
51364
+ logFn?.("[LLM] Warning: schema provided but result is not valid JSON");
51365
+ return result;
51366
+ }
51367
+ }
51368
+ return result;
51356
51369
  };
51357
51370
  globals.LLM = traceToolCall("LLM", rawLLM, tracer, logFn);
51358
51371
  }
@@ -51409,6 +51422,54 @@ function generateSandboxGlobals(options) {
51409
51422
  }
51410
51423
  return chunks;
51411
51424
  };
51425
+ globals.chunkByKey = (data3, keyFn, maxTokens = 2e4) => {
51426
+ const CHARS_PER_TOKEN3 = 4;
51427
+ const maxChars = maxTokens * CHARS_PER_TOKEN3;
51428
+ const text = typeof data3 === "string" ? data3 : JSON.stringify(data3);
51429
+ const blockRegex = /^File: ([^\n]+)/gm;
51430
+ const markers = [];
51431
+ let match2;
51432
+ while ((match2 = blockRegex.exec(text)) !== null) {
51433
+ markers.push({ index: match2.index, file: match2[1].trim() });
51434
+ }
51435
+ if (markers.length === 0) {
51436
+ return globals.chunk(data3, maxTokens);
51437
+ }
51438
+ const chunks = [];
51439
+ let currentChunk = "";
51440
+ let currentSize = 0;
51441
+ let keysInChunk = /* @__PURE__ */ new Set();
51442
+ for (let i5 = 0; i5 < markers.length; i5++) {
51443
+ const start = markers[i5].index;
51444
+ const end = i5 + 1 < markers.length ? markers[i5 + 1].index : text.length;
51445
+ const block = text.slice(start, end).trim();
51446
+ const file = markers[i5].file;
51447
+ const key = typeof keyFn === "function" ? keyFn(file) : file;
51448
+ const blockSize = block.length + 2;
51449
+ const wouldOverflow = currentSize + blockSize > maxChars;
51450
+ const keyAlreadyInChunk = keysInChunk.has(key);
51451
+ if (!keyAlreadyInChunk && wouldOverflow && currentChunk) {
51452
+ chunks.push(currentChunk.trim());
51453
+ currentChunk = "";
51454
+ currentSize = 0;
51455
+ keysInChunk = /* @__PURE__ */ new Set();
51456
+ }
51457
+ if (currentChunk) currentChunk += "\n\n";
51458
+ currentChunk += block;
51459
+ currentSize += blockSize;
51460
+ keysInChunk.add(key);
51461
+ }
51462
+ if (currentChunk.trim()) {
51463
+ chunks.push(currentChunk.trim());
51464
+ }
51465
+ return chunks.length > 0 ? chunks : [""];
51466
+ };
51467
+ globals.extractPaths = (searchResults) => {
51468
+ const text = typeof searchResults === "string" ? searchResults : JSON.stringify(searchResults);
51469
+ const matches = text.match(/^File: ([^\n]+)/gm) || [];
51470
+ const paths = matches.map((m5) => m5.replace("File: ", "").trim());
51471
+ return [...new Set(paths)];
51472
+ };
51412
51473
  globals.log = (message) => {
51413
51474
  if (globals._logs) globals._logs.push(String(message));
51414
51475
  };
@@ -58653,6 +58714,26 @@ Last error: ${lastError}`;
58653
58714
  }
58654
58715
  });
58655
58716
  }
58717
+ function extractRawOutputBlocks(content, outputBuffer = null) {
58718
+ if (typeof content !== "string") {
58719
+ return { cleanedContent: content, extractedBlocks: [] };
58720
+ }
58721
+ const extractedBlocks = [];
58722
+ const regex = new RegExp(`${RAW_OUTPUT_START}\\n([\\s\\S]*?)\\n${RAW_OUTPUT_END}`, "g");
58723
+ let cleanedContent = content;
58724
+ let match2;
58725
+ while ((match2 = regex.exec(content)) !== null) {
58726
+ extractedBlocks.push(match2[1]);
58727
+ }
58728
+ cleanedContent = content.replace(new RegExp(`${RAW_OUTPUT_START}\\n[\\s\\S]*?\\n${RAW_OUTPUT_END}`, "g"), "").replace(/\n\n\[The above raw output \(\d+ chars\) will be passed directly to the final response\. Do NOT repeat, summarize, or modify it\.\]/g, "").trim();
58729
+ if (outputBuffer && extractedBlocks.length > 0) {
58730
+ for (const block of extractedBlocks) {
58731
+ outputBuffer.items = outputBuffer.items || [];
58732
+ outputBuffer.items.push(block);
58733
+ }
58734
+ }
58735
+ return { cleanedContent, extractedBlocks };
58736
+ }
58656
58737
  function formatSuccess(result, description, attempt, outputBuffer) {
58657
58738
  let output = "";
58658
58739
  if (description) {
@@ -58689,10 +58770,15 @@ ${JSON.stringify(resultValue, null, 2)}`;
58689
58770
  }
58690
58771
  }
58691
58772
  if (outputBuffer && outputBuffer.items && outputBuffer.items.length > 0) {
58692
- const totalChars = outputBuffer.items.reduce((sum, item) => sum + item.length, 0);
58773
+ const rawContent = outputBuffer.items.join("\n");
58774
+ output += `
58775
+
58776
+ ${RAW_OUTPUT_START}
58777
+ ${rawContent}
58778
+ ${RAW_OUTPUT_END}`;
58693
58779
  output += `
58694
58780
 
58695
- [Output buffer: ${totalChars} chars written via output(). This content will be appended directly to your response. Do NOT repeat or summarize it.]`;
58781
+ [The above raw output (${rawContent.length} chars) will be passed directly to the final response. Do NOT repeat, summarize, or modify it.]`;
58696
58782
  }
58697
58783
  return output;
58698
58784
  }
@@ -59141,7 +59227,7 @@ Example:
59141
59227
  <clearOutputBuffer>true</clearOutputBuffer>
59142
59228
  </cleanup_execute_plan>`;
59143
59229
  }
59144
- var import_ai4;
59230
+ var import_ai4, RAW_OUTPUT_START, RAW_OUTPUT_END;
59145
59231
  var init_executePlan = __esm({
59146
59232
  "src/tools/executePlan.js"() {
59147
59233
  "use strict";
@@ -59153,6 +59239,8 @@ var init_executePlan = __esm({
59153
59239
  init_extract();
59154
59240
  init_delegate();
59155
59241
  init_esm5();
59242
+ RAW_OUTPUT_START = "<<<RAW_OUTPUT>>>";
59243
+ RAW_OUTPUT_END = "<<<END_RAW_OUTPUT>>>";
59156
59244
  }
59157
59245
  });
59158
59246
 
@@ -110163,6 +110251,7 @@ var init_ProbeAgent = __esm({
110163
110251
  init_path_validation();
110164
110252
  init_outputTruncator();
110165
110253
  init_delegate();
110254
+ init_executePlan();
110166
110255
  init_tasks();
110167
110256
  import_dotenv2.default.config();
110168
110257
  ENGINE_ACTIVITY_TIMEOUT_DEFAULT = 18e4;
@@ -112894,6 +112983,15 @@ You are working with a workspace. Available paths: ${workspaceDesc}
112894
112983
  }
112895
112984
  const executionResult = await this.mcpBridge.mcpTools[toolName].execute(params);
112896
112985
  let toolResultContent = typeof executionResult === "string" ? executionResult : JSON.stringify(executionResult, null, 2);
112986
+ if (this._outputBuffer) {
112987
+ const { cleanedContent, extractedBlocks } = extractRawOutputBlocks(toolResultContent, this._outputBuffer);
112988
+ if (extractedBlocks.length > 0) {
112989
+ toolResultContent = cleanedContent;
112990
+ if (this.debug) {
112991
+ console.log(`[DEBUG] Extracted ${extractedBlocks.length} raw output blocks (${extractedBlocks.reduce((sum, b5) => sum + b5.length, 0)} chars) to output buffer`);
112992
+ }
112993
+ }
112994
+ }
112897
112995
  try {
112898
112996
  const truncateResult = await truncateIfNeeded(toolResultContent, this.tokenCounter, this.sessionId, this.maxOutputTokens);
112899
112997
  if (truncateResult.truncated) {
@@ -113100,6 +113198,15 @@ ${errorXml}
113100
113198
  const wsPrefix = this.workspaceRoot.endsWith(import_path17.sep) ? this.workspaceRoot : this.workspaceRoot + import_path17.sep;
113101
113199
  toolResultContent = toolResultContent.split(wsPrefix).join("");
113102
113200
  }
113201
+ if (this._outputBuffer) {
113202
+ const { cleanedContent, extractedBlocks } = extractRawOutputBlocks(toolResultContent, this._outputBuffer);
113203
+ if (extractedBlocks.length > 0) {
113204
+ toolResultContent = cleanedContent;
113205
+ if (this.debug) {
113206
+ console.log(`[DEBUG] Extracted ${extractedBlocks.length} raw output blocks (${extractedBlocks.reduce((sum, b5) => sum + b5.length, 0)} chars) to output buffer`);
113207
+ }
113208
+ }
113209
+ }
113103
113210
  try {
113104
113211
  const truncateResult = await truncateIfNeeded(toolResultContent, this.tokenCounter, this.sessionId, this.maxOutputTokens);
113105
113212
  if (truncateResult.truncated) {
@@ -113785,12 +113892,16 @@ Convert your previous response content into actual JSON data that follows this s
113785
113892
  }
113786
113893
  if (this._outputBuffer && this._outputBuffer.items.length > 0 && !options._schemaFormatted) {
113787
113894
  const outputContent = this._outputBuffer.items.join("\n\n");
113788
- finalResult = (finalResult || "") + "\n\n" + outputContent;
113895
+ if (options.schema) {
113896
+ finalResult = (finalResult || "") + "\n<<<RAW_OUTPUT>>>\n" + outputContent + "\n<<<END_RAW_OUTPUT>>>";
113897
+ } else {
113898
+ finalResult = (finalResult || "") + "\n\n" + outputContent;
113899
+ }
113789
113900
  if (options.onStream) {
113790
113901
  options.onStream("\n\n" + outputContent);
113791
113902
  }
113792
113903
  if (this.debug) {
113793
- console.log(`[DEBUG] Appended ${this._outputBuffer.items.length} output buffer items (${outputContent.length} chars) to final result`);
113904
+ console.log(`[DEBUG] Appended ${this._outputBuffer.items.length} output buffer items (${outputContent.length} chars) to final result${options.schema ? " (with RAW_OUTPUT delimiters)" : ""}`);
113794
113905
  }
113795
113906
  this._outputBuffer.items = [];
113796
113907
  }