@tangle-network/agent-eval 0.145.11 → 0.145.13

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/analyst/index.d.ts +2 -2
  3. package/dist/analyst/index.js +3 -3
  4. package/dist/{benchmark-command-D8K5YJNS.js → benchmark-command-RyFRoiYm.js} +7 -7
  5. package/dist/{benchmark-command-D8K5YJNS.js.map → benchmark-command-RyFRoiYm.js.map} +1 -1
  6. package/dist/benchmarks/index.js +3 -3
  7. package/dist/campaign/index.js +5 -5
  8. package/dist/{campaign-B3GJpJ4h.js → campaign-Ct6r9oNe.js} +7 -7
  9. package/dist/{campaign-B3GJpJ4h.js.map → campaign-Ct6r9oNe.js.map} +1 -1
  10. package/dist/cli.js +1 -1
  11. package/dist/contract/index.d.ts +26 -1
  12. package/dist/contract/index.d.ts.map +1 -1
  13. package/dist/contract/index.js +191 -29
  14. package/dist/contract/index.js.map +1 -1
  15. package/dist/{define-agent-eval-cSMEFzVu.js → define-agent-eval-BXusiVTQ.js} +3 -3
  16. package/dist/{define-agent-eval-cSMEFzVu.js.map → define-agent-eval-BXusiVTQ.js.map} +1 -1
  17. package/dist/{dspy-rlm-engine-BZ2aMZEd.js → dspy-rlm-engine-CqwhQQBw.js} +2 -2
  18. package/dist/{dspy-rlm-engine-BZ2aMZEd.js.map → dspy-rlm-engine-CqwhQQBw.js.map} +1 -1
  19. package/dist/{external-optimizer-process-BRE56woM.js → external-optimizer-process-D-9iX64j.js} +3 -3
  20. package/dist/{external-optimizer-process-BRE56woM.js.map → external-optimizer-process-D-9iX64j.js.map} +1 -1
  21. package/dist/{external-optimizer-subprocess-BhKYK0Jv.js → external-optimizer-subprocess-x5AbhAYX.js} +2 -2
  22. package/dist/{external-optimizer-subprocess-BhKYK0Jv.js.map → external-optimizer-subprocess-x5AbhAYX.js.map} +1 -1
  23. package/dist/index.js +5 -5
  24. package/dist/ledger-core/index.js +1 -1
  25. package/dist/{ledger-core-BmZt19oQ.js → ledger-core-DTae9rv_.js} +3 -2
  26. package/dist/ledger-core-DTae9rv_.js.map +1 -0
  27. package/dist/{llm-judge-DhiJqSjB.js → llm-judge-DqAkIQA1.js} +6 -5
  28. package/dist/{llm-judge-DhiJqSjB.js.map → llm-judge-DqAkIQA1.js.map} +1 -1
  29. package/dist/openapi.json +1 -1
  30. package/dist/{produced-state-BNyyud4g.js → produced-state-B9skdU8u.js} +2 -2
  31. package/dist/{produced-state-BNyyud4g.js.map → produced-state-B9skdU8u.js.map} +1 -1
  32. package/dist/{semantic-concept-judge-BiJxScqe.js → semantic-concept-judge-C6M-qOeb.js} +2 -2
  33. package/dist/{semantic-concept-judge-BiJxScqe.js.map → semantic-concept-judge-C6M-qOeb.js.map} +1 -1
  34. package/dist/{skillopt-optimization-method-C6JSfYxT.js → skillopt-optimization-method-CcWZBaSz.js} +4 -4
  35. package/dist/{skillopt-optimization-method-C6JSfYxT.js.map → skillopt-optimization-method-CcWZBaSz.js.map} +1 -1
  36. package/package.json +1 -1
  37. package/dist/ledger-core-BmZt19oQ.js.map +0 -1
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { o as runRolloutReleaseCli } from "./hf-dataset-XggBupCr.js";
3
- import { n as runAnalystBenchmarkCommand } from "./benchmark-command-D8K5YJNS.js";
3
+ import { n as runAnalystBenchmarkCommand } from "./benchmark-command-RyFRoiYm.js";
4
4
  import { a as runRpcBatch, o as runRpcOnce, p as handleVersion, r as startServerAsync, s as buildOpenApi } from "./server-ulsOdrTI.js";
5
5
  import { writeFileSync } from "node:fs";
6
6
  //#region src/cli-config.ts
@@ -595,7 +595,32 @@ interface CodeAgentSessionIntakeOptions {
595
595
  * JSON stream has no terminal event, as with `opencode run --format json`. */
596
596
  execution?: CodeAgentSessionExecutionReceipt;
597
597
  }
598
+ /** One transcript line after the intake rule ran on it. A blank line produces
599
+ * nothing, so every value here is either a parsed entry or a counted defect. */
600
+ type CodeAgentJsonlLine = {
601
+ kind: 'entry';
602
+ lineNumber: number;
603
+ entry: unknown;
604
+ } | {
605
+ kind: 'malformed';
606
+ lineNumber: number;
607
+ };
598
608
  declare function parseCodeAgentJsonl(jsonl: string): ParsedCodeAgentJsonl;
609
+ /** Reads a transcript one line at a time and never holds the file as a single
610
+ * string. `parseCodeAgentJsonl` needs the whole file in one string, so a
611
+ * session above V8's ~512MB string ceiling throws `ERR_STRING_TOO_LONG` and
612
+ * cannot be ingested at all; the largest real Codex rollout on record is 695MB.
613
+ *
614
+ * Lines break on `\n` only, which is what the string path's `split('\n')` does.
615
+ * `node:readline` also breaks on a bare `\r`, so it is deliberately not used
616
+ * here: a lone carriage return inside a line must stay inside that line for the
617
+ * two paths to report the same malformed count. */
618
+ declare function streamCodeAgentJsonlFile(path: string): AsyncGenerator<CodeAgentJsonlLine>;
619
+ /** Streaming counterpart to `parseCodeAgentJsonl` for a transcript on disk.
620
+ * It returns the same shape, so a caller that holds every entry keeps working
621
+ * above the string ceiling. The entry array still grows with the transcript;
622
+ * consume `streamCodeAgentJsonlFile` directly when memory must stay flat. */
623
+ declare function parseCodeAgentJsonlFile(path: string): Promise<ParsedCodeAgentJsonl>;
599
624
  declare function fromCodexSession(options: CodeAgentSessionIntakeOptions): CodeAgentSessionIntakeResult;
600
625
  declare function fromClaudeCodeSession(options: CodeAgentSessionIntakeOptions): CodeAgentSessionIntakeResult;
601
626
  declare function fromOpenCodeSession(options: CodeAgentSessionIntakeOptions): CodeAgentSessionIntakeResult;
@@ -691,5 +716,5 @@ interface FromOtelSpansOptions {
691
716
  }
692
717
  declare function fromOtelSpans(opts: FromOtelSpansOptions): RunRecord[];
693
718
  //#endregion
694
- export { type AgentEvalAgent, type AgentEvalEvaluateOptions, type AgentEvalImproveOptions, type AgentProfileImprovementExperimentExecutionInput, type AgentProfileImprovementExperimentRun, type AgentTraceContributor, type AgentTraceContributorType, type AgentTraceConversation, type AgentTraceFile, type AgentTraceIndex, type AgentTraceRange, type AgentTraceRecord, type AnalystFinding, type AnalyzeRunsOptions, type AuthoringProvenance, type AxisEvidence, type AxisVerdict, type BuildEvidenceVectorOptions, type CampaignAggregates, type CampaignArtifactWriter, type CampaignCellFailureReceipt, type CampaignCellResult, type CampaignCostMeter, type CampaignResult, type CampaignStorage, type CampaignTraceWriter, type CandidateExperimentExecutionInput, type CandidateExperimentRun, type ChatClient, type CodeAgentSessionAction, type CodeAgentSessionActionKind, type CodeAgentSessionActionStatus, type CodeAgentSessionActionSurface, type CodeAgentSessionDiagnostic, type CodeAgentSessionExecutionReceipt, type CodeAgentSessionIntakeOptions, type CodeAgentSessionIntakeResult, type CodeAgentSessionMetrics, type CodeAgentSessionObservation, type CodeAgentSessionSource, type CodeAgentSessionTerminalStatus, type CodeSurface, type CompareAgentProfileImprovementExperimentOptions, type CompareCandidateExperimentOptions, type CompareOptimizationMethodsOptions, type ComparisonCost, type CostLedgerHandle, type CostProvenanceSummary, type CreateChatClientOpts, type DefaultAnalystRegistryOptions, type DefaultProductionGateCheck, type DefaultProductionGateOptions, type DefaultProductionRewardHackingOptions, type DefineAgentEvalOptions, type DefinedAgentEval, type DeploymentOutcome, type DispatchFn as Dispatch, type DispatchContext, type EvalCellScoreDelta, type EvalDimensionDelta, type EvalGenerationDiff, type EvalReportingSuiteInput, type EvalReportingSuiteOptions, type EvalReportingSuiteResult, type EvalRunDiff, type EvaluatePairedMeasurementsOptions, type EvidenceVector, type ExecutionErrorOutcomeCell, type ExecutionInsight, type ExecutionReport, type ExternalOptimizationExample, type ExternalTextEvaluationResponse, type ExternalTextOptimizationMethodConfig, type ExternalTextOptimizerContext, type ExternalTextOptimizerResult, type FailureClassTally, type FailureClusterInsight, type FeedbackTableMeta, type FeedbackTableRow, FileSystemOutcomeStore, type FileSystemOutcomeStoreOptions, type FromFeedbackTableOptions, type FromFeedbackTableResult, type FromOtelSpansOptions, type FromRunRecordDirOptions, type FromRunRecordDirResult, type Gate, type GateCheckStatus, type GateContext, type GateContribution, type GateDecision, type GateResult, type GenerationCandidate, type GenerationRecord, type GepaAdaptiveEngineRun, type GepaEngineOptions, type GepaEngineRun, type GepaOptimizationMethodConfig, type GepaOptimizationRecipe, type GepaRunnerCommand, type HeldOutGateOptions, type HostedTenant, InMemoryOutcomeStore, type InsightReport, type InterRaterInsight, type JudgeConfig, type JudgeDimension, type JudgeInsight, type JudgeScore, type LiftInsight, type LlmJudgeDimension, type LlmJudgeOptions, type MutableSurface, type ObjectiveSource, type OpenAICompatibleOptimizerModel, type OptimizationMethod, type OptimizationMethodComparison, type OptimizationMethodInput, type OptimizationMethodProvenance, type OptimizationMethodResult, type OptimizationPackageSource, type OptimizationTokenUsage, type OptimizerConfig, type OptimizerModelBudget, type OutcomeCorrelationInsight, type OutcomeStore, type PairedMeasurement, type PairedMeasurementAdapter, type PairedMeasurementEvaluation, type ParetoSignificanceGateOptions, type ParsedCodeAgentJsonl, type PartitionByAuthoringModelResult, type PromotionObjective, type PromotionPolicy, type ProposalFinding, type ProposalFindingOrigin, REFERENCE_EQUIVALENCE_INPUT_LIMITS, REFERENCE_EQUIVALENCE_JUDGE_VERSION, type Recommendation, type ReferenceEquivalenceJudgeInput, type ReferenceEquivalenceJudgeOptions, type ReferenceEquivalenceJudgeResult, type ReferenceEquivalenceScenario, type ReleaseSummary, type RunAgentProfileImprovementExperimentOptions, type RunCampaignOptions, type RunCandidateExperimentOptions, type RunEvalOptions, type RunImprovementLoopOptions, type RunImprovementLoopResult, type RunRecordRejection, type ScalarDistribution, type Scenario, type SealAgentProfileImprovementSuiteOptions, type SealCandidateBenchmarkSuiteOptions, type SelfImproveBudget, type SelfImproveOptions, type SelfImproveProgressEvent, type SelfImproveResult, SelfImproveRunError, type SessionScript, type SkillOptOptimizationMethodConfig, type SkillOptRunnerCommand, type SkillOptTrainerConfig, type SummarizeExecutionOptions, type SurfaceProposer, type TokenUsageInsight, analyzeRuns, buildDefaultAnalystRegistry, buildEvidenceVector, campaignSplitDigest, compareOptimizationMethods, composeGate, createChatClient, createReferenceEquivalenceJudge, defaultProductionGate, defineAgentEval, diffGenerations, diffRunBaselineToWinner, diffRuns, evalReportingSuite, evaluatePairedMeasurements, externalTextOptimizationMethod, fromClaudeCodeSession, fromCodexSession, fromFeedbackTable, fromKimiCodeSession, fromOpenCodeSession, fromOtelSpans, fromPiSession, fromPigraphSession, fromRunRecordDir, fsCampaignStorage, gepaOptimizationMethod, heldOutGate, inMemoryCampaignStorage, llmJudge, makeProposalFinding, measuredComparisonFromAgentProfileImprovementExperiment, measuredComparisonFromCandidateExperiment, observeCodeAgentSession, paretoPolicy, paretoSignificanceGate, parseAgentTrace, parseCodeAgentJsonl, partitionRunsByAuthoringModel, runAgentProfileImprovementExperiment, runCampaign, runCandidateExperiment, runEval, runImprovementLoop, runReferenceEquivalenceJudge, sealAgentProfileImprovementExperiment, sealAgentProfileImprovementSuite, sealAgentProfileImprovementTask, sealCandidateBenchmarkSuite, sealCandidateBenchmarkTask, sealCandidateExperiment, selfImprove, skillOptOptimizationMethod, summarizeExecution, verifyAgentProfileImprovementExperiment, verifyAgentProfileImprovementExperimentComparison, verifyAgentProfileImprovementSuiteInputs, verifyAgentProfileImprovementTask, verifyCandidateBenchmarkSuite, verifyCandidateBenchmarkSuiteInputs, verifyCandidateBenchmarkTask, verifyCandidateExperiment, verifyCandidateExperimentComparison };
719
+ export { type AgentEvalAgent, type AgentEvalEvaluateOptions, type AgentEvalImproveOptions, type AgentProfileImprovementExperimentExecutionInput, type AgentProfileImprovementExperimentRun, type AgentTraceContributor, type AgentTraceContributorType, type AgentTraceConversation, type AgentTraceFile, type AgentTraceIndex, type AgentTraceRange, type AgentTraceRecord, type AnalystFinding, type AnalyzeRunsOptions, type AuthoringProvenance, type AxisEvidence, type AxisVerdict, type BuildEvidenceVectorOptions, type CampaignAggregates, type CampaignArtifactWriter, type CampaignCellFailureReceipt, type CampaignCellResult, type CampaignCostMeter, type CampaignResult, type CampaignStorage, type CampaignTraceWriter, type CandidateExperimentExecutionInput, type CandidateExperimentRun, type ChatClient, type CodeAgentJsonlLine, type CodeAgentSessionAction, type CodeAgentSessionActionKind, type CodeAgentSessionActionStatus, type CodeAgentSessionActionSurface, type CodeAgentSessionDiagnostic, type CodeAgentSessionExecutionReceipt, type CodeAgentSessionIntakeOptions, type CodeAgentSessionIntakeResult, type CodeAgentSessionMetrics, type CodeAgentSessionObservation, type CodeAgentSessionSource, type CodeAgentSessionTerminalStatus, type CodeSurface, type CompareAgentProfileImprovementExperimentOptions, type CompareCandidateExperimentOptions, type CompareOptimizationMethodsOptions, type ComparisonCost, type CostLedgerHandle, type CostProvenanceSummary, type CreateChatClientOpts, type DefaultAnalystRegistryOptions, type DefaultProductionGateCheck, type DefaultProductionGateOptions, type DefaultProductionRewardHackingOptions, type DefineAgentEvalOptions, type DefinedAgentEval, type DeploymentOutcome, type DispatchFn as Dispatch, type DispatchContext, type EvalCellScoreDelta, type EvalDimensionDelta, type EvalGenerationDiff, type EvalReportingSuiteInput, type EvalReportingSuiteOptions, type EvalReportingSuiteResult, type EvalRunDiff, type EvaluatePairedMeasurementsOptions, type EvidenceVector, type ExecutionErrorOutcomeCell, type ExecutionInsight, type ExecutionReport, type ExternalOptimizationExample, type ExternalTextEvaluationResponse, type ExternalTextOptimizationMethodConfig, type ExternalTextOptimizerContext, type ExternalTextOptimizerResult, type FailureClassTally, type FailureClusterInsight, type FeedbackTableMeta, type FeedbackTableRow, FileSystemOutcomeStore, type FileSystemOutcomeStoreOptions, type FromFeedbackTableOptions, type FromFeedbackTableResult, type FromOtelSpansOptions, type FromRunRecordDirOptions, type FromRunRecordDirResult, type Gate, type GateCheckStatus, type GateContext, type GateContribution, type GateDecision, type GateResult, type GenerationCandidate, type GenerationRecord, type GepaAdaptiveEngineRun, type GepaEngineOptions, type GepaEngineRun, type GepaOptimizationMethodConfig, type GepaOptimizationRecipe, type GepaRunnerCommand, type HeldOutGateOptions, type HostedTenant, InMemoryOutcomeStore, type InsightReport, type InterRaterInsight, type JudgeConfig, type JudgeDimension, type JudgeInsight, type JudgeScore, type LiftInsight, type LlmJudgeDimension, type LlmJudgeOptions, type MutableSurface, type ObjectiveSource, type OpenAICompatibleOptimizerModel, type OptimizationMethod, type OptimizationMethodComparison, type OptimizationMethodInput, type OptimizationMethodProvenance, type OptimizationMethodResult, type OptimizationPackageSource, type OptimizationTokenUsage, type OptimizerConfig, type OptimizerModelBudget, type OutcomeCorrelationInsight, type OutcomeStore, type PairedMeasurement, type PairedMeasurementAdapter, type PairedMeasurementEvaluation, type ParetoSignificanceGateOptions, type ParsedCodeAgentJsonl, type PartitionByAuthoringModelResult, type PromotionObjective, type PromotionPolicy, type ProposalFinding, type ProposalFindingOrigin, REFERENCE_EQUIVALENCE_INPUT_LIMITS, REFERENCE_EQUIVALENCE_JUDGE_VERSION, type Recommendation, type ReferenceEquivalenceJudgeInput, type ReferenceEquivalenceJudgeOptions, type ReferenceEquivalenceJudgeResult, type ReferenceEquivalenceScenario, type ReleaseSummary, type RunAgentProfileImprovementExperimentOptions, type RunCampaignOptions, type RunCandidateExperimentOptions, type RunEvalOptions, type RunImprovementLoopOptions, type RunImprovementLoopResult, type RunRecordRejection, type ScalarDistribution, type Scenario, type SealAgentProfileImprovementSuiteOptions, type SealCandidateBenchmarkSuiteOptions, type SelfImproveBudget, type SelfImproveOptions, type SelfImproveProgressEvent, type SelfImproveResult, SelfImproveRunError, type SessionScript, type SkillOptOptimizationMethodConfig, type SkillOptRunnerCommand, type SkillOptTrainerConfig, type SummarizeExecutionOptions, type SurfaceProposer, type TokenUsageInsight, analyzeRuns, buildDefaultAnalystRegistry, buildEvidenceVector, campaignSplitDigest, compareOptimizationMethods, composeGate, createChatClient, createReferenceEquivalenceJudge, defaultProductionGate, defineAgentEval, diffGenerations, diffRunBaselineToWinner, diffRuns, evalReportingSuite, evaluatePairedMeasurements, externalTextOptimizationMethod, fromClaudeCodeSession, fromCodexSession, fromFeedbackTable, fromKimiCodeSession, fromOpenCodeSession, fromOtelSpans, fromPiSession, fromPigraphSession, fromRunRecordDir, fsCampaignStorage, gepaOptimizationMethod, heldOutGate, inMemoryCampaignStorage, llmJudge, makeProposalFinding, measuredComparisonFromAgentProfileImprovementExperiment, measuredComparisonFromCandidateExperiment, observeCodeAgentSession, paretoPolicy, paretoSignificanceGate, parseAgentTrace, parseCodeAgentJsonl, parseCodeAgentJsonlFile, partitionRunsByAuthoringModel, runAgentProfileImprovementExperiment, runCampaign, runCandidateExperiment, runEval, runImprovementLoop, runReferenceEquivalenceJudge, sealAgentProfileImprovementExperiment, sealAgentProfileImprovementSuite, sealAgentProfileImprovementTask, sealCandidateBenchmarkSuite, sealCandidateBenchmarkTask, sealCandidateExperiment, selfImprove, skillOptOptimizationMethod, streamCodeAgentJsonlFile, summarizeExecution, verifyAgentProfileImprovementExperiment, verifyAgentProfileImprovementExperimentComparison, verifyAgentProfileImprovementSuiteInputs, verifyAgentProfileImprovementTask, verifyCandidateBenchmarkSuite, verifyCandidateBenchmarkSuiteInputs, verifyCandidateBenchmarkTask, verifyCandidateExperiment, verifyCandidateExperimentComparison };
695
720
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/contract/measured-comparison.ts","../../src/contract/profile-measured-comparison.ts","../../src/contract/intake/run-record-dir.ts","../../src/contract/eval-reporting-suite.ts","../../src/contract/diff.ts","../../src/contract/intake/agent-trace.ts","../../src/contract/intake/code-agent-observation.ts","../../src/contract/intake/code-agent-session.ts","../../src/contract/intake/feedback-table.ts","../../src/contract/intake/otel-spans.ts"],"mappings":";;;;;;;;;;;;;;;;UAiCiB;EACf,QAAQ,gCAAgC;EACxC;EACA;;UAGe;EACf,YAAY;EACZ;EACA,QAAQ;EACR,MAAM;EACN,eAAe;EACf;EACA,SAAS;;UAGM;EACf,YAAY;EACZ,QAAQ,OAAO,oCAAoC,QAAQ;;EAE3D;;EAEA,aAAa;EACb,SAAS;;UAGM;EACf,cA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AEA;EACA;EACA;;EAEA;;EAEA;;KAGU,kBAAkB,YAAY;;;;;;iBAW1B,gBAAgB,SAAS,qBAAqB;UAmE7C;;;;EAIf,SAAS,YAAY;;;EAGrB,cAAc;;;;;;;;iBASA,8BACd,MAAM,aACN,OAAO,kBACN;;;KCjLS;KAEA;KAEA;KAEA;KASA;UAEK;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA,MAAM;EACN,SAAS;EACT;EACA,QAAQ;EACR;EACA;EACA,UAAU;;UAGK;EACf,QAAQ;EACR;EACA;EACA;IACE,QAAQ;IACR;;EAEF,SAAS;;UAGM;EACf,QAAQ;EACR;EACA;EACA,YAAY;;;;;;;iBAeE,wBACd,SAAS,iCACR;;;UCrCc;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;;UAGe;EACf,MAAM;EACN,aAAa;EACb,SAAS;EACT,cAAc;;UAGC;EACf;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;EACA;EACA;EACA;EACA;EACA;;;EAGA,iBAAiB;;;EAGjB,YAAY;;iBAGE,oBAAoB,gBAAgB;iBAepC,iBACd,SAAS,gCACR;iBAIa,sBACd,SAAS,gCACR;iBAIa,oBACd,SAAS,gCACR;iBAIa,oBACd,SAAS,gCACR;iBAIa,cACd,SAAS,gCACR;cAIU,2BAAkB;;;UCpJd;;;EAGf;;EAEA;;;EAGA;;;EAGA,WAAW;;UAGI;EACf;;;EAGA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;EAGA,WAAW;;;EAGX,SAAS;;UAGM;;EAEf,SAAS;;;EAGT,OAAO;;;;EAIP;IAAU;IAAa;;;;;EAIvB;;UAGe;EACf,MAAM;;;EAGN,aAAa;IAAQ;IAAe;IAAe;;;iBAGrC,kBAAkB,MAAM,2BAA2B;;;UCvBlD;EACf,OAAO;;EAEP,eAAe;;EAEf;;;;;;EAMA,eAAe,eAAe,gBAAgB;;iBAGhC,cAAc,MAAM,uBAAuB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/contract/measured-comparison.ts","../../src/contract/profile-measured-comparison.ts","../../src/contract/intake/run-record-dir.ts","../../src/contract/eval-reporting-suite.ts","../../src/contract/diff.ts","../../src/contract/intake/agent-trace.ts","../../src/contract/intake/code-agent-observation.ts","../../src/contract/intake/code-agent-session.ts","../../src/contract/intake/feedback-table.ts","../../src/contract/intake/otel-spans.ts"],"mappings":";;;;;;;;;;;;;;;;UAiCiB;EACf,QAAQ,gCAAgC;EACxC;EACA;;UAGe;EACf,YAAY;EACZ;EACA,QAAQ;EACR,MAAM;EACN,eAAe;EACf;EACA,SAAS;;UAGM;EACf,YAAY;EACZ,QAAQ,OAAO,oCAAoC,QAAQ;;EAE3D;;EAEA,aAAa;EACb,SAAS;;UAGM;EACf,cAAc;EACd;IACE;IACA,MAAM;;;UAIO;EACf,YAAY;EACZ,cAAc;EACd;IACE;IACA,MAAM;;EAER,aAAa;EACb;EACA,YAAY;EACZ;EACA,WAAW;;;UAII,kBAAkB;EACjC;EACA,UAAU;EACV,WAAW;;;UAII,yBAAyB;EACxC,MAAM,KAAK;EACX,WAAW,KAAK;IAAkB;IAAc;;EAChD,QAAQ,KAAK;EACb,eAAe,KAAK,OAAO;EAC3B,UAAU,KAAK;EACf,UAAU,KAAK;EACf,OAAO,KAAK;;UAGG,kCAAkC;EACjD,uBAAuB,kBAAkB;EACzC,QAAQ;EACR,SAAS,yBAAyB;;EAElC;;EAEA,kBAAkB;;EAElB,kBAAkB;;;KAIR,8BAA8B,KACxC;EAGA,iBAAiB;EACjB,WAAW;EACX;;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A;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;;UAGe;EACf,MAAM;EACN,aAAa;EACb,SAAS;EACT,cAAc;;UAGC;EACf;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;EACA;EACA;EACA;EACA;EACA;;;EAGA,iBAAiB;;;EAGjB,YAAY;;;;KAKF;EACN;EAAe;EAAoB;;EACnC;EAAmB;;iBAcT,oBAAoB,gBAAgB;;;;;;;;;;iBAuB7B,yBAAyB,eAAe,eAAe;;;;;iBA6BxD,wBAAwB,eAAe,QAAQ;iBAUrD,iBACd,SAAS,gCACR;iBAIa,sBACd,SAAS,gCACR;iBAIa,oBACd,SAAS,gCACR;iBAIa,oBACd,SAAS,gCACR;iBAIa,cACd,SAAS,gCACR;cAIU,2BAAkB;;;UCxNd;;;EAGf;;EAEA;;;EAGA;;;EAGA,WAAW;;UAGI;EACf;;;EAGA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;EAGA,WAAW;;;EAGX,SAAS;;UAGM;;EAEf,SAAS;;;EAGT,OAAO;;;;EAIP;IAAU;IAAa;;;;;EAIvB;;UAGe;EACf,MAAM;;;EAGN,aAAa;IAAQ;IAAe;IAAe;;;iBAGrC,kBAAkB,MAAM,2BAA2B;;;UCvBlD;EACf,OAAO;;EAEP,eAAe;;EAEf;;;;;;EAMA,eAAe,eAAe,gBAAgB;;iBAGhC,cAAc,MAAM,uBAAuB"}
@@ -1,12 +1,12 @@
1
1
  import { s as ValidationError } from "../errors-Dngq5h35.js";
2
2
  import { r as pairedBootstrap } from "../paired-tests-BHIhYVdu.js";
3
- import { a as summarizeExecution, i as analyzeRuns, n as SelfImproveRunError, r as selfImprove, t as defineAgentEval } from "../define-agent-eval-cSMEFzVu.js";
3
+ import { a as summarizeExecution, i as analyzeRuns, n as SelfImproveRunError, r as selfImprove, t as defineAgentEval } from "../define-agent-eval-BXusiVTQ.js";
4
4
  import { a as parseRunRecordSafe } from "../run-record-D2lDdSAz.js";
5
- import { G as runEval, K as runCampaign, f as runImprovementLoop, nt as campaignSplitDigest, t as llmJudge, x as compareOptimizationMethods, z as defaultProductionGate } from "../llm-judge-DhiJqSjB.js";
5
+ import { G as runEval, K as runCampaign, f as runImprovementLoop, nt as campaignSplitDigest, t as llmJudge, x as compareOptimizationMethods, z as defaultProductionGate } from "../llm-judge-DqAkIQA1.js";
6
6
  import { i as isModelPriced, n as estimateCost } from "../metrics-Cl0L1KUy.js";
7
7
  import { i as CostLedger } from "../cost-ledger-BSe92yAV.js";
8
- import { d as mapConcurrentRange } from "../ledger-core-BmZt19oQ.js";
9
- import { S as inMemoryCampaignStorage, x as fsCampaignStorage } from "../external-optimizer-subprocess-BhKYK0Jv.js";
8
+ import { d as mapConcurrentRange } from "../ledger-core-DTae9rv_.js";
9
+ import { S as inMemoryCampaignStorage, x as fsCampaignStorage } from "../external-optimizer-subprocess-x5AbhAYX.js";
10
10
  import { a as heldoutSignificance, s as decidePairedPromotion } from "../power-preflight-DEw-uC7q.js";
11
11
  import { r as makeProposalFinding } from "../types-BI4fT3HN.js";
12
12
  import { $ as classifyOtlpSpanRole, et as isOtlpModelCall } from "../kind-factory-CPmSd58s.js";
@@ -15,10 +15,11 @@ import { LLM_MODEL_ATTR_KEYS, SPAN_KIND_ATTR_KEYS } from "../trace-attributes.js
15
15
  import { t as extractUsage } from "../extract-usage-BrQ8mCLX.js";
16
16
  import { n as InMemoryOutcomeStore, t as FileSystemOutcomeStore } from "../outcome-store-ChBKlTd_.js";
17
17
  import { i as summarizeTraceErrors, n as recordAggregateMeasurements, r as summarizeExecutionMeasurements, t as readTaskFailureLabels } from "../task-failure-attributes-CpQ4y5RD.js";
18
- import { a as externalTextOptimizationMethod, c as REFERENCE_EQUIVALENCE_INPUT_LIMITS, d as runReferenceEquivalenceJudge, i as composeGate, l as REFERENCE_EQUIVALENCE_JUDGE_VERSION, n as gepaOptimizationMethod, r as heldOutGate, t as skillOptOptimizationMethod, u as createReferenceEquivalenceJudge } from "../skillopt-optimization-method-C6JSfYxT.js";
18
+ import { a as externalTextOptimizationMethod, c as REFERENCE_EQUIVALENCE_INPUT_LIMITS, d as runReferenceEquivalenceJudge, i as composeGate, l as REFERENCE_EQUIVALENCE_JUDGE_VERSION, n as gepaOptimizationMethod, r as heldOutGate, t as skillOptOptimizationMethod, u as createReferenceEquivalenceJudge } from "../skillopt-optimization-method-CcWZBaSz.js";
19
19
  import { n as paretoPolicy, r as paretoSignificanceGate, t as buildEvidenceVector } from "../promotion-policy-xzA40Evo.js";
20
20
  import { createHash } from "node:crypto";
21
21
  import { agentCandidateBenchmarkSuiteSchema, agentCandidateBenchmarkTaskSchema, agentCandidateBundleSchema, agentCandidateEvaluationPolicySchema, agentCandidateExperimentSchema, agentImprovementMeasuredComparisonSchema, agentProfileImprovementExperimentSchema, agentProfileImprovementMeasuredComparisonSchema, agentProfileImprovementRunCellSchema, agentProfileImprovementRunReceiptSchema, agentProfileImprovementSuiteInputsSchema, agentProfileImprovementSuiteSchema, agentProfileImprovementTaskSchema, candidateExecutionEvidenceSchema, canonicalCandidateDigest, canonicalCandidateJson, numbersApproximatelyEqual, omitTopLevelDigest } from "@tangle-network/agent-interface";
22
+ import { createReadStream } from "node:fs";
22
23
  import { dirname, join } from "node:path";
23
24
  import { mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
24
25
  //#region src/contract/fixed-spend.ts
@@ -1558,6 +1559,7 @@ function projectionFor(source, entries) {
1558
1559
  function codexProjection(entries) {
1559
1560
  const actions = [];
1560
1561
  const calls = /* @__PURE__ */ new Map();
1562
+ const transcriptStream = hasCodexTranscriptStream(entries);
1561
1563
  let finalText = null;
1562
1564
  let terminal = "unknown";
1563
1565
  let explicitTerminal = false;
@@ -1566,8 +1568,9 @@ function codexProjection(entries) {
1566
1568
  const payload = record$1(entry.payload) ?? {};
1567
1569
  const payloadType = stringField$1(payload, "type");
1568
1570
  const timestampMs = timestamp(entry.timestamp);
1569
- const item = record$1(entry.item);
1570
- if (entryType === "item.started" && item) {
1571
+ const itemEvent = admittedCodexItem(entry, transcriptStream);
1572
+ const item = itemEvent?.item ?? null;
1573
+ if (itemEvent?.eventType === "item.started" && item) {
1571
1574
  const itemType = stringField$1(item, "type");
1572
1575
  if (isCodexActionItem(itemType)) {
1573
1576
  const id = stringField$1(item, "id") ?? `item-${actions.length}`;
@@ -1580,7 +1583,7 @@ function codexProjection(entries) {
1580
1583
  status: "started",
1581
1584
  timestampMs,
1582
1585
  metadata: compactMetadata({
1583
- sourceEventType: entryType,
1586
+ sourceEventType: itemEvent.eventType,
1584
1587
  itemType
1585
1588
  })
1586
1589
  });
@@ -1588,7 +1591,7 @@ function codexProjection(entries) {
1588
1591
  actions.push(action);
1589
1592
  }
1590
1593
  }
1591
- if (entryType === "item.completed" && item) {
1594
+ if (itemEvent?.eventType === "item.completed" && item) {
1592
1595
  const itemType = stringField$1(item, "type");
1593
1596
  if (itemType === "agent_message" || itemType === "message") finalText = nonEmpty(stringField$1(item, "text")) ?? finalText;
1594
1597
  if (isCodexActionItem(itemType)) {
@@ -1606,7 +1609,7 @@ function codexProjection(entries) {
1606
1609
  status,
1607
1610
  timestampMs,
1608
1611
  metadata: compactMetadata({
1609
- sourceEventType: entryType,
1612
+ sourceEventType: itemEvent.eventType,
1610
1613
  itemType
1611
1614
  })
1612
1615
  });
@@ -1986,6 +1989,79 @@ function completeClaudeTools(content, calls) {
1986
1989
  if (action) action.status = part.is_error === true ? "failed" : "completed";
1987
1990
  }
1988
1991
  }
1992
+ /**
1993
+ * Codex writes the same session items on two transports. The app-server stream
1994
+ * of `codex exec --json` puts an item at the top level under `item.started` or
1995
+ * `item.completed` and names its type in snake_case. A rollout file under
1996
+ * `~/.codex/sessions` wraps the same item in an `event_msg` entry under
1997
+ * `payload.item_started` or `payload.item_completed` and names its type in
1998
+ * PascalCase. Read both here so one branch serves both transports.
1999
+ */
2000
+ function codexItemEvent(entry) {
2001
+ const entryType = stringField$1(entry, "type");
2002
+ if (entryType === "item.started" || entryType === "item.completed") {
2003
+ const item = record$1(entry.item);
2004
+ return item ? {
2005
+ eventType: entryType,
2006
+ item
2007
+ } : null;
2008
+ }
2009
+ if (entryType !== "event_msg") return null;
2010
+ const payload = record$1(entry.payload);
2011
+ const payloadType = payload ? stringField$1(payload, "type") : void 0;
2012
+ if (payloadType !== "item_started" && payloadType !== "item_completed") return null;
2013
+ const item = record$1(payload?.item);
2014
+ if (!item) return null;
2015
+ const itemType = codexItemType(stringField$1(item, "type"));
2016
+ return {
2017
+ eventType: payloadType === "item_started" ? "item.started" : "item.completed",
2018
+ item: itemType === void 0 ? item : {
2019
+ ...item,
2020
+ type: itemType
2021
+ }
2022
+ };
2023
+ }
2024
+ /**
2025
+ * A rollout item type differs from its app-server name by case alone, except
2026
+ * `CollabAgentToolCall`, which the app-server calls `collab_tool_call`. Convert
2027
+ * the case mechanically so a new item type still arrives under a stable name.
2028
+ */
2029
+ function codexItemType(itemType) {
2030
+ if (itemType === void 0 || !/^[A-Z]/.test(itemType)) return itemType;
2031
+ if (itemType === "CollabAgentToolCall") return "collab_tool_call";
2032
+ return itemType.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase();
2033
+ }
2034
+ function hasCodexTranscriptStream(entries) {
2035
+ return entries.some((entry) => stringField$1(entry, "type") === "response_item");
2036
+ }
2037
+ /**
2038
+ * A rollout file records each turn twice: `response_item` holds the model
2039
+ * transcript and the item stream holds the execution record. The app-server
2040
+ * transport sends no `response_item` entry at all. So `response_item` keeps the
2041
+ * tool call, reasoning, and assistant message accounting wherever it is
2042
+ * present, and the item stream adds only the facts a `response_item` cannot
2043
+ * express. Counting both streams together doubles the totals: a 186-file
2044
+ * rollout corpus holds 58,752 `Reasoning` items against 58,893 `reasoning`
2045
+ * response items, and 49,694 `CommandExecution` items against 52,183 response
2046
+ * item tool calls.
2047
+ *
2048
+ * A collaboration or subagent item states no fact of its own here. Its id is
2049
+ * either the id of a response item that the same file already reports, or the
2050
+ * id of a command that ran inside the sandbox, which the enclosing response
2051
+ * item already counts. Over the same corpus, all 320 collaboration items and
2052
+ * all 523 subagent items that match a response item resolve to an action that
2053
+ * `surfaceForTool` already marks `subagent`, and the 1,434 that match nothing
2054
+ * would each add a second action for one operation.
2055
+ */
2056
+ function isCodexExecutionOnlyItem(itemType) {
2057
+ return itemType === "file_change" || itemType === "user_message" || itemType === "context_compaction";
2058
+ }
2059
+ function admittedCodexItem(entry, transcriptStream) {
2060
+ const event = codexItemEvent(entry);
2061
+ if (!event) return null;
2062
+ if (!transcriptStream) return event;
2063
+ return isCodexExecutionOnlyItem(stringField$1(event.item, "type")) ? event : null;
2064
+ }
1989
2065
  function isCodexActionItem(itemType) {
1990
2066
  return itemType === "command_execution" || itemType === "mcp_tool_call" || itemType === "collab_tool_call" || itemType === "web_search" || itemType === "file_change";
1991
2067
  }
@@ -2058,13 +2134,25 @@ function actionFor(input) {
2058
2134
  function surfaceForTool(name) {
2059
2135
  const normalized = name.toLowerCase();
2060
2136
  if (normalized.startsWith("mcp__") || normalized.includes("mcp_tool")) return "mcp";
2061
- if (normalized === "task" || normalized === "agent" || normalized.includes("subagent") || normalized.includes("spawn_agent") || normalized.includes("collab") || normalized.startsWith("multi_agent")) return "subagent";
2137
+ if (normalized === "task" || normalized === "agent" || normalized.includes("subagent") || normalized.includes("spawn_agent") || normalized.includes("collab") || normalized.startsWith("multi_agent") || isCodexCollaborationTool(normalized)) return "subagent";
2062
2138
  if (normalized === "skill" || normalized.includes("skill")) return "skill";
2063
2139
  if (normalized.includes("hook")) return "hook";
2064
2140
  if (normalized.includes("web_search") || normalized.includes("webfetch") || normalized === "web") return "web";
2065
2141
  if (normalized === "edit" || normalized === "write" || normalized.includes("patch") || normalized.includes("file_change")) return "code";
2066
2142
  return "tool";
2067
2143
  }
2144
+ /**
2145
+ * Codex serves its subagent tools from the `collaboration` and `multi_agent_v1`
2146
+ * namespaces. The namespace does not reach this function, so the tool name must
2147
+ * carry the decision. Codex names every lifecycle verb `<verb>_agent` or
2148
+ * `<verb>_agents`, and adds three message verbs that do not use that suffix.
2149
+ * A namespaced name such as `collaboration.wait_agent` keeps the verb last, so
2150
+ * only the final segment is tested.
2151
+ */
2152
+ function isCodexCollaborationTool(normalized) {
2153
+ const verb = normalized.slice(normalized.lastIndexOf(".") + 1);
2154
+ return /^[a-z_]+_agents?$/.test(verb) || verb === "send_message" || verb === "send_input" || verb === "followup_task";
2155
+ }
2068
2156
  function statusFrom(value) {
2069
2157
  const status = (stringField$1(value, "status") ?? "").toLowerCase();
2070
2158
  if (status === "completed" || status === "success" || status === "succeeded") return "completed";
@@ -2127,18 +2215,80 @@ function timestamp(value) {
2127
2215
  }
2128
2216
  //#endregion
2129
2217
  //#region src/contract/intake/code-agent-session.ts
2218
+ /** The single per-line rule. Both the string path and the file path call this,
2219
+ * so malformed-line handling and entry validation cannot drift apart. */
2220
+ function readCodeAgentJsonlLine(line, lineNumber) {
2221
+ const trimmed = line.trim();
2222
+ if (!trimmed) return void 0;
2223
+ try {
2224
+ return {
2225
+ kind: "entry",
2226
+ lineNumber,
2227
+ entry: JSON.parse(trimmed)
2228
+ };
2229
+ } catch {
2230
+ return {
2231
+ kind: "malformed",
2232
+ lineNumber
2233
+ };
2234
+ }
2235
+ }
2130
2236
  function parseCodeAgentJsonl(jsonl) {
2131
2237
  const entries = [];
2132
2238
  let malformedLines = 0;
2239
+ let lineNumber = 0;
2133
2240
  for (const line of jsonl.split("\n")) {
2134
- const trimmed = line.trim();
2135
- if (!trimmed) continue;
2136
- try {
2137
- entries.push(JSON.parse(trimmed));
2138
- } catch {
2139
- malformedLines += 1;
2241
+ lineNumber += 1;
2242
+ const read = readCodeAgentJsonlLine(line, lineNumber);
2243
+ if (!read) continue;
2244
+ if (read.kind === "malformed") malformedLines += 1;
2245
+ else entries.push(read.entry);
2246
+ }
2247
+ return {
2248
+ entries,
2249
+ malformedLines
2250
+ };
2251
+ }
2252
+ /** Reads a transcript one line at a time and never holds the file as a single
2253
+ * string. `parseCodeAgentJsonl` needs the whole file in one string, so a
2254
+ * session above V8's ~512MB string ceiling throws `ERR_STRING_TOO_LONG` and
2255
+ * cannot be ingested at all; the largest real Codex rollout on record is 695MB.
2256
+ *
2257
+ * Lines break on `\n` only, which is what the string path's `split('\n')` does.
2258
+ * `node:readline` also breaks on a bare `\r`, so it is deliberately not used
2259
+ * here: a lone carriage return inside a line must stay inside that line for the
2260
+ * two paths to report the same malformed count. */
2261
+ async function* streamCodeAgentJsonlFile(path) {
2262
+ const stream = createReadStream(path, { encoding: "utf8" });
2263
+ let pending = "";
2264
+ let lineNumber = 0;
2265
+ try {
2266
+ for await (const chunk of stream) {
2267
+ pending += chunk;
2268
+ let start = 0;
2269
+ for (let at = pending.indexOf("\n"); at !== -1; at = pending.indexOf("\n", start)) {
2270
+ lineNumber += 1;
2271
+ const read = readCodeAgentJsonlLine(pending.slice(start, at), lineNumber);
2272
+ if (read) yield read;
2273
+ start = at + 1;
2274
+ }
2275
+ pending = pending.slice(start);
2140
2276
  }
2277
+ } finally {
2278
+ stream.destroy();
2141
2279
  }
2280
+ const last = readCodeAgentJsonlLine(pending, lineNumber + 1);
2281
+ if (last) yield last;
2282
+ }
2283
+ /** Streaming counterpart to `parseCodeAgentJsonl` for a transcript on disk.
2284
+ * It returns the same shape, so a caller that holds every entry keeps working
2285
+ * above the string ceiling. The entry array still grows with the transcript;
2286
+ * consume `streamCodeAgentJsonlFile` directly when memory must stay flat. */
2287
+ async function parseCodeAgentJsonlFile(path) {
2288
+ const entries = [];
2289
+ let malformedLines = 0;
2290
+ for await (const read of streamCodeAgentJsonlFile(path)) if (read.kind === "malformed") malformedLines += 1;
2291
+ else entries.push(read.entry);
2142
2292
  return {
2143
2293
  entries,
2144
2294
  malformedLines
@@ -2332,6 +2482,7 @@ function metricsFor(source, entries) {
2332
2482
  function codexMetrics(entries) {
2333
2483
  const metrics = emptyMetrics(entries.length);
2334
2484
  const startedToolIds = /* @__PURE__ */ new Set();
2485
+ const transcriptStream = hasCodexTranscriptStream(entries);
2335
2486
  let startedAt;
2336
2487
  let completedAt;
2337
2488
  for (const entry of entries) {
@@ -2350,8 +2501,8 @@ function codexMetrics(entries) {
2350
2501
  }
2351
2502
  if (entryType === "turn.failed") metrics.turnsAborted += 1;
2352
2503
  if (entryType === "error") metrics.unclassifiedErrors += 1;
2353
- const item = record(entry.item);
2354
- if (item && (entryType === "item.started" || entryType === "item.completed")) addCodexExecItem(metrics, startedToolIds, entryType, item);
2504
+ const itemEvent = admittedCodexItem(entry, transcriptStream);
2505
+ if (itemEvent) addCodexExecItem(metrics, startedToolIds, itemEvent.eventType, itemEvent.item, transcriptStream);
2355
2506
  if (entryType === "response_item") {
2356
2507
  if (payloadType === "function_call" || payloadType === "custom_tool_call") metrics.toolCalls += 1;
2357
2508
  if (payloadType === "function_call_output" || payloadType === "custom_tool_call_output") metrics.toolOutputs += 1;
@@ -2396,10 +2547,10 @@ function codexMetrics(entries) {
2396
2547
  metrics.processScore = codexProcessScore(metrics);
2397
2548
  return metrics;
2398
2549
  }
2399
- function addCodexExecItem(metrics, startedToolIds, eventType, item) {
2550
+ function addCodexExecItem(metrics, startedToolIds, eventType, item, transcriptStream) {
2400
2551
  const itemType = stringField(item, "type");
2401
2552
  const itemId = stringField(item, "id");
2402
- const isTool = itemType === "command_execution" || itemType === "mcp_tool_call" || itemType === "collab_tool_call" || itemType === "web_search";
2553
+ const isTool = !transcriptStream && (itemType === "command_execution" || itemType === "mcp_tool_call" || itemType === "collab_tool_call" || itemType === "web_search");
2403
2554
  if (eventType === "item.started" && isTool) {
2404
2555
  metrics.toolCalls += 1;
2405
2556
  if (itemId) startedToolIds.add(itemId);
@@ -2410,7 +2561,9 @@ function addCodexExecItem(metrics, startedToolIds, eventType, item) {
2410
2561
  }
2411
2562
  if (eventType !== "item.completed") return;
2412
2563
  if (itemType === "agent_message" || itemType === "message") metrics.assistantMessages += 1;
2564
+ if (itemType === "user_message") metrics.userMessages += 1;
2413
2565
  if (itemType === "reasoning") metrics.reasoningItems += 1;
2566
+ if (itemType === "context_compaction") metrics.contextCompactions += 1;
2414
2567
  if (itemType === "file_change") {
2415
2568
  metrics.patchAttempts += 1;
2416
2569
  const status = stringField(item, "status");
@@ -2838,10 +2991,24 @@ function cwdFromEntries(entries) {
2838
2991
  if (cwd) return cwd;
2839
2992
  }
2840
2993
  }
2994
+ /** Join the `text` of every part in a `[{ type: 'text', text }]` content list. */
2995
+ function textFromContentParts(content) {
2996
+ if (!Array.isArray(content)) return void 0;
2997
+ const text = content.map((part) => {
2998
+ const obj = record(part);
2999
+ return obj ? stringField(obj, "text") : void 0;
3000
+ }).filter((part) => part !== void 0).join("\n");
3001
+ return text.length > 0 ? text : void 0;
3002
+ }
2841
3003
  function firstUserText(entries) {
2842
3004
  for (const entry of entries) {
2843
3005
  const payload = record(entry.payload);
2844
3006
  if ((payload ? stringField(payload, "type") : void 0) === "user_message") return stringField(payload, "message");
3007
+ const itemEvent = payload ? admittedCodexItem(entry, false) : null;
3008
+ if (itemEvent && stringField(itemEvent.item, "type") === "user_message") {
3009
+ const text = textFromContentParts(itemEvent.item.content);
3010
+ if (text) return text;
3011
+ }
2845
3012
  if (stringField(entry, "role") === "user") {
2846
3013
  const content = entry.content;
2847
3014
  if (typeof content === "string") return content;
@@ -2853,13 +3020,8 @@ function firstUserText(entries) {
2853
3020
  if (message && stringField(message, "role") === "user") {
2854
3021
  const content = message.content;
2855
3022
  if (typeof content === "string") return content;
2856
- if (Array.isArray(content)) {
2857
- const text = content.map((part) => {
2858
- const obj = record(part);
2859
- return obj ? stringField(obj, "text") : void 0;
2860
- }).filter((part) => part !== void 0).join("\n");
2861
- if (text) return text;
2862
- }
3023
+ const text = textFromContentParts(content);
3024
+ if (text) return text;
2863
3025
  }
2864
3026
  }
2865
3027
  }
@@ -3259,6 +3421,6 @@ function collectNumericAttrs(spans) {
3259
3421
  return raw;
3260
3422
  }
3261
3423
  //#endregion
3262
- export { FileSystemOutcomeStore, InMemoryOutcomeStore, REFERENCE_EQUIVALENCE_INPUT_LIMITS, REFERENCE_EQUIVALENCE_JUDGE_VERSION, SelfImproveRunError, analyzeRuns, buildDefaultAnalystRegistry, buildEvidenceVector, campaignSplitDigest, compareOptimizationMethods, composeGate, createChatClient, createReferenceEquivalenceJudge, defaultProductionGate, defineAgentEval, diffGenerations, diffRunBaselineToWinner, diffRuns, evalReportingSuite, evaluatePairedMeasurements, externalTextOptimizationMethod, fromClaudeCodeSession, fromCodexSession, fromFeedbackTable, fromKimiCodeSession, fromOpenCodeSession, fromOtelSpans, fromPiSession, fromPigraphSession, fromRunRecordDir, fsCampaignStorage, gepaOptimizationMethod, heldOutGate, inMemoryCampaignStorage, llmJudge, makeProposalFinding, measuredComparisonFromAgentProfileImprovementExperiment, measuredComparisonFromCandidateExperiment, observeCodeAgentSession, paretoPolicy, paretoSignificanceGate, parseAgentTrace, parseCodeAgentJsonl, partitionRunsByAuthoringModel, runAgentProfileImprovementExperiment, runCampaign, runCandidateExperiment, runEval, runImprovementLoop, runReferenceEquivalenceJudge, sealAgentProfileImprovementExperiment, sealAgentProfileImprovementSuite, sealAgentProfileImprovementTask, sealCandidateBenchmarkSuite, sealCandidateBenchmarkTask, sealCandidateExperiment, selfImprove, skillOptOptimizationMethod, summarizeExecution, verifyAgentProfileImprovementExperiment, verifyAgentProfileImprovementExperimentComparison, verifyAgentProfileImprovementSuiteInputs, verifyAgentProfileImprovementTask, verifyCandidateBenchmarkSuite, verifyCandidateBenchmarkSuiteInputs, verifyCandidateBenchmarkTask, verifyCandidateExperiment, verifyCandidateExperimentComparison };
3424
+ export { FileSystemOutcomeStore, InMemoryOutcomeStore, REFERENCE_EQUIVALENCE_INPUT_LIMITS, REFERENCE_EQUIVALENCE_JUDGE_VERSION, SelfImproveRunError, analyzeRuns, buildDefaultAnalystRegistry, buildEvidenceVector, campaignSplitDigest, compareOptimizationMethods, composeGate, createChatClient, createReferenceEquivalenceJudge, defaultProductionGate, defineAgentEval, diffGenerations, diffRunBaselineToWinner, diffRuns, evalReportingSuite, evaluatePairedMeasurements, externalTextOptimizationMethod, fromClaudeCodeSession, fromCodexSession, fromFeedbackTable, fromKimiCodeSession, fromOpenCodeSession, fromOtelSpans, fromPiSession, fromPigraphSession, fromRunRecordDir, fsCampaignStorage, gepaOptimizationMethod, heldOutGate, inMemoryCampaignStorage, llmJudge, makeProposalFinding, measuredComparisonFromAgentProfileImprovementExperiment, measuredComparisonFromCandidateExperiment, observeCodeAgentSession, paretoPolicy, paretoSignificanceGate, parseAgentTrace, parseCodeAgentJsonl, parseCodeAgentJsonlFile, partitionRunsByAuthoringModel, runAgentProfileImprovementExperiment, runCampaign, runCandidateExperiment, runEval, runImprovementLoop, runReferenceEquivalenceJudge, sealAgentProfileImprovementExperiment, sealAgentProfileImprovementSuite, sealAgentProfileImprovementTask, sealCandidateBenchmarkSuite, sealCandidateBenchmarkTask, sealCandidateExperiment, selfImprove, skillOptOptimizationMethod, streamCodeAgentJsonlFile, summarizeExecution, verifyAgentProfileImprovementExperiment, verifyAgentProfileImprovementExperimentComparison, verifyAgentProfileImprovementSuiteInputs, verifyAgentProfileImprovementTask, verifyCandidateBenchmarkSuite, verifyCandidateBenchmarkSuiteInputs, verifyCandidateBenchmarkTask, verifyCandidateExperiment, verifyCandidateExperimentComparison };
3263
3425
 
3264
3426
  //# sourceMappingURL=index.js.map