agentv 0.10.1 → 0.11.0

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.
@@ -12097,14 +12097,13 @@ function formatSegment(segment) {
12097
12097
  const text = asString(segment.text);
12098
12098
  const filePath = asString(segment.path);
12099
12099
  if (text && filePath) {
12100
- return `=== ${filePath} ===
12101
- ${text}`;
12100
+ return formatFileContents([{ content: text.trim(), isFile: true, displayPath: filePath }]);
12102
12101
  }
12103
12102
  }
12104
12103
  return void 0;
12105
12104
  }
12106
12105
  async function buildPromptInputs(testCase) {
12107
- const guidelineContents = [];
12106
+ const guidelineParts = [];
12108
12107
  for (const rawPath of testCase.guideline_paths) {
12109
12108
  const absolutePath = path8.resolve(rawPath);
12110
12109
  if (!await fileExists2(absolutePath)) {
@@ -12112,14 +12111,17 @@ async function buildPromptInputs(testCase) {
12112
12111
  continue;
12113
12112
  }
12114
12113
  try {
12115
- const content = (await readFile3(absolutePath, "utf8")).replace(/\r\n/g, "\n");
12116
- guidelineContents.push(`=== ${path8.basename(absolutePath)} ===
12117
- ${content}`);
12114
+ const content = (await readFile3(absolutePath, "utf8")).replace(/\r\n/g, "\n").trim();
12115
+ guidelineParts.push({
12116
+ content,
12117
+ isFile: true,
12118
+ displayPath: path8.basename(absolutePath)
12119
+ });
12118
12120
  } catch (error) {
12119
12121
  logWarning(`Could not read guideline file ${absolutePath}: ${error.message}`);
12120
12122
  }
12121
12123
  }
12122
- const guidelines = guidelineContents.map((part) => part.trim()).filter((part) => part.length > 0).join("\n\n");
12124
+ const guidelines = formatFileContents(guidelineParts);
12123
12125
  const segmentsByMessage = [];
12124
12126
  const fileContentsByPath = /* @__PURE__ */ new Map();
12125
12127
  for (const segment of testCase.input_segments) {
@@ -12321,6 +12323,20 @@ function cloneJsonValue(value) {
12321
12323
  }
12322
12324
  return cloneJsonObject(value);
12323
12325
  }
12326
+ function formatFileContents(parts) {
12327
+ const fileCount = parts.filter((p) => p.isFile).length;
12328
+ if (fileCount > 0) {
12329
+ return parts.map((part) => {
12330
+ if (part.isFile && part.displayPath) {
12331
+ return `<file path="${part.displayPath}">
12332
+ ${part.content}
12333
+ </file>`;
12334
+ }
12335
+ return part.content;
12336
+ }).join("\n\n");
12337
+ }
12338
+ return parts.map((p) => p.content).join(" ");
12339
+ }
12324
12340
  async function resolveAssistantContent(content, searchRoots, verbose) {
12325
12341
  if (typeof content === "string") {
12326
12342
  return content;
@@ -12331,7 +12347,7 @@ async function resolveAssistantContent(content, searchRoots, verbose) {
12331
12347
  const parts = [];
12332
12348
  for (const entry of content) {
12333
12349
  if (typeof entry === "string") {
12334
- parts.push(entry);
12350
+ parts.push({ content: entry, isFile: false });
12335
12351
  continue;
12336
12352
  }
12337
12353
  if (!isJsonObject(entry)) {
@@ -12353,8 +12369,8 @@ async function resolveAssistantContent(content, searchRoots, verbose) {
12353
12369
  continue;
12354
12370
  }
12355
12371
  try {
12356
- const fileContent = (await readFile3(resolvedPath, "utf8")).replace(/\r\n/g, "\n");
12357
- parts.push(fileContent);
12372
+ const fileContent = (await readFile3(resolvedPath, "utf8")).replace(/\r\n/g, "\n").trim();
12373
+ parts.push({ content: fileContent, isFile: true, displayPath });
12358
12374
  if (verbose) {
12359
12375
  console.log(` [Expected Assistant File] Found: ${displayPath}`);
12360
12376
  console.log(` Resolved to: ${resolvedPath}`);
@@ -12366,17 +12382,17 @@ async function resolveAssistantContent(content, searchRoots, verbose) {
12366
12382
  }
12367
12383
  const textValue = asString(entry.text);
12368
12384
  if (typeof textValue === "string") {
12369
- parts.push(textValue);
12385
+ parts.push({ content: textValue, isFile: false });
12370
12386
  continue;
12371
12387
  }
12372
12388
  const valueValue = asString(entry.value);
12373
12389
  if (typeof valueValue === "string") {
12374
- parts.push(valueValue);
12390
+ parts.push({ content: valueValue, isFile: false });
12375
12391
  continue;
12376
12392
  }
12377
- parts.push(JSON.stringify(entry));
12393
+ parts.push({ content: JSON.stringify(entry), isFile: false });
12378
12394
  }
12379
- return parts.join(" ");
12395
+ return formatFileContents(parts);
12380
12396
  }
12381
12397
  async function parseEvaluators(rawEvalCase, globalExecution, searchRoots, evalId) {
12382
12398
  const execution = rawEvalCase.execution;
@@ -17938,4 +17954,4 @@ export {
17938
17954
  createProgram,
17939
17955
  runCli
17940
17956
  };
17941
- //# sourceMappingURL=chunk-72BHGHIT.js.map
17957
+ //# sourceMappingURL=chunk-7CJK3EYC.js.map