agentv 4.15.1 → 4.15.2-next.1

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.
@@ -18441,7 +18441,21 @@ async function resolveWorkspaceConfig(raw, evalFileDir) {
18441
18441
  );
18442
18442
  }
18443
18443
  const workspaceFileDir = path8.dirname(workspaceFilePath);
18444
- return parseWorkspaceConfig(parsed, workspaceFileDir);
18444
+ const resolvedWorkspace = parseWorkspaceConfig(parsed, workspaceFileDir);
18445
+ if (resolvedWorkspace) {
18446
+ return resolvedWorkspace;
18447
+ }
18448
+ const parsedObject = parsed;
18449
+ if ("workspace" in parsedObject && isJsonObject(parsedObject.workspace)) {
18450
+ throw new Error(
18451
+ [
18452
+ `Invalid workspace file format: ${workspaceFilePath}`,
18453
+ "External workspace files must contain the workspace config object directly.",
18454
+ 'Remove the top-level "workspace:" wrapper.'
18455
+ ].join(" ")
18456
+ );
18457
+ }
18458
+ return void 0;
18445
18459
  }
18446
18460
  return parseWorkspaceConfig(raw, evalFileDir);
18447
18461
  }
@@ -35395,30 +35409,91 @@ async function discoverClaudeSessions(opts) {
35395
35409
  sessions.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
35396
35410
  return sessions.slice(0, limit);
35397
35411
  }
35398
- function toTranscriptJsonLine(entry) {
35399
- const firstUserMessage = entry.messages.find((m) => m.role === "user");
35400
- const input = typeof firstUserMessage?.content === "string" ? firstUserMessage.content : "";
35412
+ function toTranscriptJsonLines(entry, options) {
35413
+ const source = {
35414
+ provider: entry.source.provider,
35415
+ session_id: entry.source.sessionId,
35416
+ model: entry.source.model,
35417
+ timestamp: entry.source.startedAt,
35418
+ git_branch: entry.source.gitBranch,
35419
+ cwd: entry.source.cwd ?? entry.source.projectPath,
35420
+ version: entry.source.version
35421
+ };
35422
+ const transcriptTokenUsage = entry.tokenUsage ? {
35423
+ input: entry.tokenUsage.input,
35424
+ output: entry.tokenUsage.output,
35425
+ cached: entry.tokenUsage.cached,
35426
+ reasoning: entry.tokenUsage.reasoning
35427
+ } : void 0;
35428
+ const testId = options?.testId ?? entry.source.sessionId;
35429
+ const target = options?.target ?? entry.source.provider;
35430
+ return entry.messages.map((message, index) => ({
35431
+ test_id: testId,
35432
+ target,
35433
+ message_index: index,
35434
+ ...toSnakeCaseDeep(message),
35435
+ transcript_token_usage: transcriptTokenUsage,
35436
+ transcript_duration_ms: entry.durationMs,
35437
+ transcript_cost_usd: entry.costUsd,
35438
+ source
35439
+ }));
35440
+ }
35441
+ function buildReplayMessage(line) {
35442
+ const camelCased = toCamelCaseDeep(line);
35401
35443
  return {
35402
- input,
35403
- output: entry.messages,
35404
- token_usage: entry.tokenUsage ? {
35405
- input: entry.tokenUsage.input,
35406
- output: entry.tokenUsage.output,
35407
- cached: entry.tokenUsage.cached
35408
- } : void 0,
35409
- duration_ms: entry.durationMs,
35410
- cost_usd: entry.costUsd,
35411
- source: {
35412
- provider: entry.source.provider,
35413
- session_id: entry.source.sessionId,
35414
- model: entry.source.model,
35415
- timestamp: entry.source.startedAt,
35416
- git_branch: entry.source.gitBranch,
35417
- cwd: entry.source.cwd ?? entry.source.projectPath,
35418
- version: entry.source.version
35419
- }
35444
+ role: camelCased.role,
35445
+ name: camelCased.name,
35446
+ content: camelCased.content,
35447
+ toolCalls: camelCased.toolCalls,
35448
+ startTime: camelCased.startTime,
35449
+ endTime: camelCased.endTime,
35450
+ durationMs: camelCased.durationMs,
35451
+ metadata: camelCased.metadata,
35452
+ tokenUsage: camelCased.tokenUsage
35420
35453
  };
35421
35454
  }
35455
+ function groupTranscriptJsonLines(lines) {
35456
+ const grouped = /* @__PURE__ */ new Map();
35457
+ for (const line of lines) {
35458
+ const existing = grouped.get(line.test_id);
35459
+ const source = {
35460
+ provider: line.source.provider,
35461
+ sessionId: line.source.session_id,
35462
+ startedAt: line.source.timestamp,
35463
+ model: line.source.model,
35464
+ gitBranch: line.source.git_branch,
35465
+ cwd: line.source.cwd,
35466
+ version: line.source.version
35467
+ };
35468
+ const transcriptTokenUsage = line.transcript_token_usage ? {
35469
+ input: line.transcript_token_usage.input,
35470
+ output: line.transcript_token_usage.output,
35471
+ cached: line.transcript_token_usage.cached,
35472
+ reasoning: line.transcript_token_usage.reasoning
35473
+ } : void 0;
35474
+ if (existing) {
35475
+ existing.messages.push({ index: line.message_index, message: buildReplayMessage(line) });
35476
+ continue;
35477
+ }
35478
+ grouped.set(line.test_id, {
35479
+ target: line.target,
35480
+ tokenUsage: transcriptTokenUsage,
35481
+ durationMs: line.transcript_duration_ms,
35482
+ costUsd: line.transcript_cost_usd,
35483
+ source,
35484
+ messages: [{ index: line.message_index, message: buildReplayMessage(line) }]
35485
+ });
35486
+ }
35487
+ return [...grouped.entries()].map(([testId, entry]) => ({
35488
+ testId,
35489
+ target: entry.target,
35490
+ tokenUsage: entry.tokenUsage,
35491
+ durationMs: entry.durationMs,
35492
+ costUsd: entry.costUsd,
35493
+ source: entry.source,
35494
+ messages: entry.messages.sort((first, second) => first.index - second.index).map((item) => item.message)
35495
+ }));
35496
+ }
35422
35497
  async function readTranscriptJsonl(filePath) {
35423
35498
  const text2 = await readFile18(filePath, "utf8");
35424
35499
  return text2.split("\n").filter((line) => line.trim().length > 0).map((line) => JSON.parse(line));
@@ -35430,12 +35505,12 @@ var TranscriptProvider = class _TranscriptProvider {
35430
35505
  id;
35431
35506
  kind = "transcript";
35432
35507
  targetName;
35433
- lines;
35508
+ entries;
35434
35509
  cursor = 0;
35435
- constructor(targetName, lines) {
35510
+ constructor(targetName, entries) {
35436
35511
  this.targetName = targetName;
35437
35512
  this.id = `transcript:${targetName}`;
35438
- this.lines = lines;
35513
+ this.entries = entries;
35439
35514
  }
35440
35515
  /**
35441
35516
  * Create a TranscriptProvider from a JSONL file path.
@@ -35445,29 +35520,31 @@ var TranscriptProvider = class _TranscriptProvider {
35445
35520
  if (lines.length === 0) {
35446
35521
  throw new Error(`Transcript file is empty: ${filePath}`);
35447
35522
  }
35448
- const providerName = lines[0].source.provider ?? "transcript";
35449
- return new _TranscriptProvider(providerName, lines);
35523
+ const entries = groupTranscriptJsonLines(lines);
35524
+ const providerName = entries[0]?.source.provider ?? "transcript";
35525
+ return new _TranscriptProvider(providerName, entries);
35450
35526
  }
35451
35527
  get lineCount() {
35452
- return this.lines.length;
35528
+ return this.entries.length;
35453
35529
  }
35454
35530
  async invoke(_request) {
35455
- if (this.cursor >= this.lines.length) {
35531
+ if (this.cursor >= this.entries.length) {
35456
35532
  throw new Error(
35457
- `Transcript exhausted: ${this.lines.length} line(s) available but ${this.cursor + 1} invocations attempted. Each transcript line maps to one test case.`
35533
+ `Transcript exhausted: ${this.entries.length} entr${this.entries.length === 1 ? "y" : "ies"} available but ${this.cursor + 1} invocations attempted. Each transcript entry maps to one test case.`
35458
35534
  );
35459
35535
  }
35460
- const line = this.lines[this.cursor++];
35536
+ const entry = this.entries[this.cursor++];
35461
35537
  return {
35462
- output: line.output,
35463
- tokenUsage: line.token_usage ? {
35464
- input: line.token_usage.input,
35465
- output: line.token_usage.output,
35466
- cached: line.token_usage.cached
35538
+ output: entry.messages,
35539
+ tokenUsage: entry.tokenUsage ? {
35540
+ input: entry.tokenUsage.input,
35541
+ output: entry.tokenUsage.output,
35542
+ cached: entry.tokenUsage.cached,
35543
+ reasoning: entry.tokenUsage.reasoning
35467
35544
  } : void 0,
35468
- durationMs: line.duration_ms,
35469
- costUsd: line.cost_usd ?? void 0,
35470
- startTime: line.source.timestamp
35545
+ durationMs: entry.durationMs,
35546
+ costUsd: entry.costUsd ?? void 0,
35547
+ startTime: entry.source.startedAt
35471
35548
  };
35472
35549
  }
35473
35550
  };
@@ -35664,10 +35741,11 @@ export {
35664
35741
  parseCodexSession,
35665
35742
  discoverCodexSessions,
35666
35743
  discoverClaudeSessions,
35667
- toTranscriptJsonLine,
35744
+ toTranscriptJsonLines,
35745
+ groupTranscriptJsonLines,
35668
35746
  readTranscriptJsonl,
35669
35747
  readTranscriptFile,
35670
35748
  TranscriptProvider,
35671
35749
  createAgentKernel
35672
35750
  };
35673
- //# sourceMappingURL=chunk-CA3SJJN7.js.map
35751
+ //# sourceMappingURL=chunk-6X2UFVGI.js.map