@tangle-network/agent-eval 0.121.0 → 0.122.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.
@@ -1,4 +1,4 @@
1
- import { AgentImprovementMeasuredComparison, Sha256Digest } from '@tangle-network/agent-interface';
1
+ import { AgentCandidateExperiment, AgentCandidateBundle, AgentCandidateBenchmarkTask, AgentCandidateBenchmarkCellRef, AgentCandidateExperimentMeasurement, AgentImprovementMeasuredComparison, CandidateExecutionEvidence, AgentCandidateBenchmarkSuiteInputs, AgentCandidateBenchmarkTaskMaterial, AgentCandidateExperimentMaterial } from '@tangle-network/agent-interface';
2
2
  import { AxFunction, AxAIService } from '@ax-llm/ax';
3
3
  import { z } from 'zod';
4
4
 
@@ -1582,10 +1582,15 @@ interface ScoredSurfaceOutcome {
1582
1582
  surfaceHash: string;
1583
1583
  composite: number;
1584
1584
  dimensions: Record<string, number>;
1585
+ /** Same per-scenario carrier shape as `GenerationCandidate.scenarios` and
1586
+ * `CampaignBreakdown.scenarios`: judge notes (the "why") + an optional
1587
+ * bounded `emitted` excerpt of the candidate's raw output (the "what it
1588
+ * actually did"). Copied verbatim from the measuring campaign's breakdown. */
1585
1589
  scenarios: Array<{
1586
1590
  scenarioId: string;
1587
1591
  composite: number;
1588
1592
  notes?: string;
1593
+ emitted?: string;
1589
1594
  }>;
1590
1595
  coverage: {
1591
1596
  expectedCells: number;
@@ -1937,11 +1942,15 @@ interface GenerationCandidate {
1937
1942
  * reflective proposer grounds its next edit on. Keep `notes` GENERALIZABLE
1938
1943
  * (which checks/lines/dimensions failed and how), NOT case-specific ground
1939
1944
  * truth: leaking expected answers into the prompt is memorization, and the
1940
- * held-out gate would reject it anyway. */
1945
+ * held-out gate would reject it anyway. `emitted` is a bounded excerpt of
1946
+ * the candidate's raw output for the scenario (worst rep when reps > 1) —
1947
+ * the "what it actually did" evidence; optional so trajectory capture is
1948
+ * never required of a dispatch. */
1941
1949
  scenarios: Array<{
1942
1950
  scenarioId: string;
1943
1951
  composite: number;
1944
1952
  notes?: string;
1953
+ emitted?: string;
1945
1954
  }>;
1946
1955
  /** Proposer-supplied short label for the change. Present when the proposer
1947
1956
  * returned a `ProposedCandidate`; absent for bare-surface mutators. */
@@ -4026,18 +4035,59 @@ interface DefinedAgentEval<TScenario extends Scenario, TArtifact> {
4026
4035
  */
4027
4036
  declare function defineAgentEval<TScenario extends Scenario, TArtifact>(defaults: DefineAgentEvalOptions<TScenario, TArtifact>): DefinedAgentEval<TScenario, TArtifact>;
4028
4037
 
4029
- interface MeasuredComparisonFromSelfImproveResultOptions<TScenario extends Scenario, TArtifact> {
4030
- result: SelfImproveResult<TScenario, TArtifact>;
4031
- benchmark: AgentImprovementMeasuredComparison['benchmark'];
4032
- /** Canonical digest verified by the runtime that owns the baseline profile. */
4033
- baselineProfileDigest: Sha256Digest;
4034
- /** Canonical digest verified by the runtime that owns candidate sealing. */
4035
- candidateBundleDigest: Sha256Digest;
4036
- /** Exact baseline surface; contradictory recorded provenance is rejected. */
4037
- baselineSurface: MutableSurface;
4038
+ interface SealCandidateBenchmarkSuiteOptions {
4039
+ tasks: [AgentCandidateBenchmarkTask, ...AgentCandidateBenchmarkTask[]];
4040
+ reps: number;
4041
+ seeds: [number, ...number[]];
4042
+ }
4043
+ interface CandidateExperimentExecutionInput {
4044
+ experiment: AgentCandidateExperiment;
4045
+ arm: 'baseline' | 'candidate';
4046
+ bundle: AgentCandidateBundle;
4047
+ task: AgentCandidateBenchmarkTask;
4048
+ benchmarkCell: AgentCandidateBenchmarkCellRef;
4049
+ seed: number;
4050
+ signal?: AbortSignal;
4051
+ }
4052
+ interface RunCandidateExperimentOptions {
4053
+ experiment: AgentCandidateExperiment;
4054
+ execute(input: CandidateExperimentExecutionInput): Promise<CandidateExecutionEvidence>;
4055
+ maxConcurrency?: number;
4056
+ signal?: AbortSignal;
4038
4057
  }
4039
- /** Convert one paired self-improvement result into the portable Interface evidence record. */
4040
- declare function measuredComparisonFromSelfImproveResult<TScenario extends Scenario, TArtifact>(options: MeasuredComparisonFromSelfImproveResultOptions<TScenario, TArtifact>): AgentImprovementMeasuredComparison;
4058
+ interface CompareCandidateExperimentOptions {
4059
+ experiment: AgentCandidateExperiment;
4060
+ measurements: AgentCandidateExperimentMeasurement[];
4061
+ runId: string;
4062
+ candidate?: AgentImprovementMeasuredComparison['candidate'];
4063
+ generationsExplored?: number;
4064
+ searchDurationMs?: number;
4065
+ searchCostUsd?: number;
4066
+ metadata?: AgentImprovementMeasuredComparison['metadata'];
4067
+ }
4068
+ /** Content-address one task before any measured execution can see it. */
4069
+ declare function sealCandidateBenchmarkTask(material: AgentCandidateBenchmarkTaskMaterial): AgentCandidateBenchmarkTask;
4070
+ /** Freeze task order, repetitions, and every seed before either arm runs. */
4071
+ declare function sealCandidateBenchmarkSuite(options: SealCandidateBenchmarkSuiteOptions): AgentCandidateBenchmarkSuiteInputs;
4072
+ /** Freeze both complete agent states and their exact held-out work. */
4073
+ declare function sealCandidateExperiment(material: AgentCandidateExperimentMaterial): AgentCandidateExperiment;
4074
+ declare function verifyCandidateExperiment(input: unknown): AgentCandidateExperiment;
4075
+ /** Execute each signed cell for both arms. The callback is Runtime's one executor. */
4076
+ declare function runCandidateExperiment(options: RunCandidateExperimentOptions): Promise<AgentCandidateExperimentMeasurement[]>;
4077
+ /** Build the only publishable comparison: paired statistics over Runtime receipts. */
4078
+ declare function measuredComparisonFromCandidateExperiment(options: CompareCandidateExperimentOptions): AgentImprovementMeasuredComparison;
4079
+ /** Recompute every statistic and decision from the signed experiment receipts. */
4080
+ declare function verifyCandidateExperimentComparison(input: unknown): AgentImprovementMeasuredComparison;
4081
+ declare function verifyCandidateBenchmarkTask(input: unknown): AgentCandidateBenchmarkTask;
4082
+ declare function verifyCandidateBenchmarkSuiteInputs(input: unknown): AgentCandidateBenchmarkSuiteInputs;
4083
+ declare function verifyCandidateBenchmarkSuite(input: unknown): {
4084
+ kind: "agent-candidate-benchmark-suite";
4085
+ digestAlgorithm: "rfc8785-sha256";
4086
+ taskDigests: [`sha256:${string}`, ...`sha256:${string}`[]];
4087
+ reps: number;
4088
+ seeds: [number, ...number[]];
4089
+ digest: `sha256:${string}`;
4090
+ };
4041
4091
 
4042
4092
  /**
4043
4093
  * Typed Ax output for analyst findings.
@@ -4764,6 +4814,49 @@ interface PartitionByAuthoringModelResult {
4764
4814
  declare function partitionRunsByAuthoringModel(runs: RunRecord[], index: AgentTraceIndex): PartitionByAuthoringModelResult;
4765
4815
 
4766
4816
  type CodeAgentSessionSource = 'codex' | 'claude-code' | 'opencode' | 'kimi-code' | 'pi';
4817
+ type CodeAgentSessionTerminalStatus = 'completed' | 'failed' | 'unknown';
4818
+ type CodeAgentSessionActionKind = 'tool' | 'patch' | 'terminal' | 'graph-completion';
4819
+ type CodeAgentSessionActionSurface = 'tool' | 'mcp' | 'subagent' | 'skill' | 'hook' | 'web' | 'code';
4820
+ type CodeAgentSessionActionStatus = 'started' | 'completed' | 'failed' | 'unknown';
4821
+ interface CodeAgentSessionExecutionReceipt {
4822
+ exitCode: number;
4823
+ startedAtMs?: number;
4824
+ completedAtMs?: number;
4825
+ }
4826
+ interface CodeAgentSessionAction {
4827
+ id: string;
4828
+ stepIndex: number;
4829
+ kind: CodeAgentSessionActionKind;
4830
+ surface: CodeAgentSessionActionSurface;
4831
+ name: string;
4832
+ status: CodeAgentSessionActionStatus;
4833
+ timestampMs?: number;
4834
+ costUsd?: number;
4835
+ metadata: Record<string, unknown>;
4836
+ }
4837
+ interface CodeAgentSessionObservation {
4838
+ source: CodeAgentSessionSource;
4839
+ sessionId: string;
4840
+ finalText: string | null;
4841
+ terminal: {
4842
+ status: CodeAgentSessionTerminalStatus;
4843
+ explicit: boolean;
4844
+ };
4845
+ actions: CodeAgentSessionAction[];
4846
+ }
4847
+ interface ObserveCodeAgentSessionOptions {
4848
+ source: CodeAgentSessionSource;
4849
+ entries: unknown[];
4850
+ sourcePath?: string;
4851
+ execution?: CodeAgentSessionExecutionReceipt;
4852
+ }
4853
+ /**
4854
+ * Project one provider session into the exact user-visible answer and a
4855
+ * provider-neutral action stream. Raw prompts, tool inputs, and tool outputs
4856
+ * stay out of this projection; callers retain the source JSONL as evidence.
4857
+ */
4858
+ declare function observeCodeAgentSession(options: ObserveCodeAgentSessionOptions): CodeAgentSessionObservation;
4859
+
4767
4860
  interface ParsedCodeAgentJsonl {
4768
4861
  entries: unknown[];
4769
4862
  malformedLines: number;
@@ -4783,6 +4876,12 @@ interface CodeAgentSessionMetrics {
4783
4876
  turnsCompleted: number;
4784
4877
  turnsAborted: number;
4785
4878
  contextCompactions: number;
4879
+ mcpCalls: number;
4880
+ subagentCalls: number;
4881
+ skillCalls: number;
4882
+ hookCalls: number;
4883
+ webCalls: number;
4884
+ codeActions: number;
4786
4885
  prLinks: number;
4787
4886
  fileSnapshots: number;
4788
4887
  graphNodes: number;
@@ -4810,6 +4909,7 @@ interface CodeAgentSessionDiagnostic {
4810
4909
  malformedLines: number;
4811
4910
  inferredScore: boolean;
4812
4911
  hasExplicitTerminalSignal: boolean;
4912
+ hasFinalOutput: boolean;
4813
4913
  hasQualityLabel: boolean;
4814
4914
  hasTokenUsage: boolean;
4815
4915
  hasCost: boolean;
@@ -4820,6 +4920,7 @@ interface CodeAgentSessionIntakeResult {
4820
4920
  runs: RunRecord[];
4821
4921
  diagnostics: CodeAgentSessionDiagnostic[];
4822
4922
  metrics: CodeAgentSessionMetrics[];
4923
+ observations: CodeAgentSessionObservation[];
4823
4924
  }
4824
4925
  interface CodeAgentSessionIntakeOptions {
4825
4926
  entries: unknown[];
@@ -4840,6 +4941,9 @@ interface CodeAgentSessionIntakeOptions {
4840
4941
  * sentinel as observed. When omitted, source-reported cost wins, then a
4841
4942
  * token-priced estimate, then uncaptured. */
4842
4943
  costProvenance?: RunCostProvenance;
4944
+ /** Exact executor-owned process result. This is required when a provider's
4945
+ * JSON stream has no terminal event, as with `opencode run --format json`. */
4946
+ execution?: CodeAgentSessionExecutionReceipt;
4843
4947
  }
4844
4948
  declare function parseCodeAgentJsonl(jsonl: string): ParsedCodeAgentJsonl;
4845
4949
  declare function fromCodexSession(options: CodeAgentSessionIntakeOptions): CodeAgentSessionIntakeResult;
@@ -4969,4 +5073,4 @@ interface FromOtelSpansOptions {
4969
5073
  }
4970
5074
  declare function fromOtelSpans(opts: FromOtelSpansOptions): RunRecord[];
4971
5075
 
4972
- export { type AgentEvalAgent, type AgentEvalEvaluateOptions, type AgentEvalImproveOptions, 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 CampaignCellResult, type CampaignCostMeter, type CampaignResult, type CampaignStorage, type CampaignTraceWriter, type ChatClient, type CodeAgentSessionDiagnostic, type CodeAgentSessionIntakeOptions, type CodeAgentSessionIntakeResult, type CodeAgentSessionMetrics, type CodeAgentSessionSource, type CodeSurface, type CostLedgerHandle, type CostProvenanceSummary, type CreateChatClientOpts, type DefaultAnalystRegistryOptions, type DefaultProductionGateOptions, 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 EvidenceVector, type EvolutionaryProposerOptions, type ExecutionInsight, type ExecutionReport, type FailureClusterInsight, type FeedbackTableMeta, type FeedbackTableRow, FileSystemOutcomeStore, type FileSystemOutcomeStoreOptions, type FromFeedbackTableOptions, type FromFeedbackTableResult, type FromOtelSpansOptions, type FromRunRecordDirOptions, type FromRunRecordDirResult, type Gate, type GateContext, type GateDecision, type GateResult, type GenerationCandidate, type GenerationRecord, type GepaProposerOptions, type HeldOutGateOptions, type HostedTenant, InMemoryOutcomeStore, type InsightReport, type InterRaterInsight, type JudgeConfig, type JudgeDimension, type JudgeInsight, type JudgeScore, type LiftInsight, type MeasuredComparisonFromSelfImproveResultOptions, type MutableSurface, type Mutator, type ObjectiveSource, type OptimizationProposer, type OptimizerConfig, type OutcomeCorrelationInsight, type OutcomeStore, type ParetoSignificanceGateOptions, type ParsedCodeAgentJsonl, type PartitionByAuthoringModelResult, type PromotionObjective, type PromotionPolicy, REFERENCE_EQUIVALENCE_INPUT_LIMITS, REFERENCE_EQUIVALENCE_JUDGE_VERSION, type Recommendation, type ReferenceEquivalenceJudgeInput, type ReferenceEquivalenceJudgeOptions, type ReferenceEquivalenceJudgeResult, type ReferenceEquivalenceScenario, type ReleaseSummary, type RunCampaignOptions, type RunEvalOptions, type RunImprovementLoopOptions, type RunImprovementLoopResult, type RunRecordRejection, type ScalarDistribution, type Scenario, type SelfImproveBudget, type SelfImproveLlm, type SelfImproveOptions, type SelfImproveProgressEvent, type SelfImproveResult, SelfImproveRunError, type SessionScript, type SummarizeExecutionOptions, type SurfaceProposer, type TokenUsageInsight, analyzeRuns, buildDefaultAnalystRegistry, buildEvidenceVector, campaignSplitDigest, composeGate, createChatClient, createReferenceEquivalenceJudge, defaultProductionGate, defineAgentEval, diffGenerations, diffRunBaselineToWinner, diffRuns, evalReportingSuite, evolutionaryProposer, fromClaudeCodeSession, fromCodexSession, fromFeedbackTable, fromKimiCodeSession, fromOpenCodeSession, fromOtelSpans, fromPiSession, fromPigraphSession, fromRunRecordDir, fsCampaignStorage, gepaProposer, heldOutGate, inMemoryCampaignStorage, measuredComparisonFromSelfImproveResult, paretoPolicy, paretoSignificanceGate, parseAgentTrace, parseCodeAgentJsonl, partitionRunsByAuthoringModel, runCampaign, runEval, runImprovementLoop, runReferenceEquivalenceJudge, selfImprove, summarizeExecution };
5076
+ export { type AgentEvalAgent, type AgentEvalEvaluateOptions, type AgentEvalImproveOptions, 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 CampaignCellResult, type CampaignCostMeter, type CampaignResult, type CampaignStorage, type CampaignTraceWriter, type CandidateExperimentExecutionInput, 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 CompareCandidateExperimentOptions, type CostLedgerHandle, type CostProvenanceSummary, type CreateChatClientOpts, type DefaultAnalystRegistryOptions, type DefaultProductionGateOptions, 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 EvidenceVector, type EvolutionaryProposerOptions, type ExecutionInsight, type ExecutionReport, type FailureClusterInsight, type FeedbackTableMeta, type FeedbackTableRow, FileSystemOutcomeStore, type FileSystemOutcomeStoreOptions, type FromFeedbackTableOptions, type FromFeedbackTableResult, type FromOtelSpansOptions, type FromRunRecordDirOptions, type FromRunRecordDirResult, type Gate, type GateContext, type GateDecision, type GateResult, type GenerationCandidate, type GenerationRecord, type GepaProposerOptions, type HeldOutGateOptions, type HostedTenant, InMemoryOutcomeStore, type InsightReport, type InterRaterInsight, type JudgeConfig, type JudgeDimension, type JudgeInsight, type JudgeScore, type LiftInsight, type MutableSurface, type Mutator, type ObjectiveSource, type OptimizationProposer, type OptimizerConfig, type OutcomeCorrelationInsight, type OutcomeStore, type ParetoSignificanceGateOptions, type ParsedCodeAgentJsonl, type PartitionByAuthoringModelResult, type PromotionObjective, type PromotionPolicy, REFERENCE_EQUIVALENCE_INPUT_LIMITS, REFERENCE_EQUIVALENCE_JUDGE_VERSION, type Recommendation, type ReferenceEquivalenceJudgeInput, type ReferenceEquivalenceJudgeOptions, type ReferenceEquivalenceJudgeResult, type ReferenceEquivalenceScenario, type ReleaseSummary, type RunCampaignOptions, type RunCandidateExperimentOptions, type RunEvalOptions, type RunImprovementLoopOptions, type RunImprovementLoopResult, type RunRecordRejection, type ScalarDistribution, type Scenario, type SealCandidateBenchmarkSuiteOptions, type SelfImproveBudget, type SelfImproveLlm, type SelfImproveOptions, type SelfImproveProgressEvent, type SelfImproveResult, SelfImproveRunError, type SessionScript, type SummarizeExecutionOptions, type SurfaceProposer, type TokenUsageInsight, analyzeRuns, buildDefaultAnalystRegistry, buildEvidenceVector, campaignSplitDigest, composeGate, createChatClient, createReferenceEquivalenceJudge, defaultProductionGate, defineAgentEval, diffGenerations, diffRunBaselineToWinner, diffRuns, evalReportingSuite, evolutionaryProposer, fromClaudeCodeSession, fromCodexSession, fromFeedbackTable, fromKimiCodeSession, fromOpenCodeSession, fromOtelSpans, fromPiSession, fromPigraphSession, fromRunRecordDir, fsCampaignStorage, gepaProposer, heldOutGate, inMemoryCampaignStorage, measuredComparisonFromCandidateExperiment, observeCodeAgentSession, paretoPolicy, paretoSignificanceGate, parseAgentTrace, parseCodeAgentJsonl, partitionRunsByAuthoringModel, runCampaign, runCandidateExperiment, runEval, runImprovementLoop, runReferenceEquivalenceJudge, sealCandidateBenchmarkSuite, sealCandidateBenchmarkTask, sealCandidateExperiment, selfImprove, summarizeExecution, verifyCandidateBenchmarkSuite, verifyCandidateBenchmarkSuiteInputs, verifyCandidateBenchmarkTask, verifyCandidateExperiment, verifyCandidateExperimentComparison };