@tangle-network/agent-eval 0.119.1 → 0.120.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +19 -3
  2. package/README.md +0 -26
  3. package/dist/benchmarks/index.d.ts +11 -5
  4. package/dist/benchmarks/index.js +4 -4
  5. package/dist/campaign/index.d.ts +93 -37
  6. package/dist/campaign/index.js +23 -7
  7. package/dist/{chunk-PSXJ32SR.js → chunk-32BZXMSO.js} +229 -118
  8. package/dist/chunk-32BZXMSO.js.map +1 -0
  9. package/dist/{chunk-XJ7JVCHB.js → chunk-3A246TSA.js} +2 -2
  10. package/dist/{chunk-XMBOU5W7.js → chunk-JN2FCO5W.js} +4 -5
  11. package/dist/chunk-JN2FCO5W.js.map +1 -0
  12. package/dist/{chunk-D7AEXSM5.js → chunk-PICTDURQ.js} +2 -2
  13. package/dist/{chunk-PAHNGS65.js → chunk-XDIRG3TO.js} +175 -11
  14. package/dist/chunk-XDIRG3TO.js.map +1 -0
  15. package/dist/contract/index.d.ts +52 -28
  16. package/dist/contract/index.js +350 -62
  17. package/dist/contract/index.js.map +1 -1
  18. package/dist/index.d.ts +22 -8
  19. package/dist/index.js +9 -5
  20. package/dist/index.js.map +1 -1
  21. package/dist/openapi.json +1 -1
  22. package/dist/rl.d.ts +11 -5
  23. package/dist/{run-campaign-OBXSN5WK.js → run-campaign-HNFPJET4.js} +2 -2
  24. package/package.json +1 -6
  25. package/dist/chunk-PAHNGS65.js.map +0 -1
  26. package/dist/chunk-PSXJ32SR.js.map +0 -1
  27. package/dist/chunk-XMBOU5W7.js.map +0 -1
  28. package/dist/primeintellect/index.d.ts +0 -311
  29. package/dist/primeintellect/index.js +0 -348
  30. package/dist/primeintellect/index.js.map +0 -1
  31. /package/dist/{chunk-XJ7JVCHB.js.map → chunk-3A246TSA.js.map} +0 -0
  32. /package/dist/{chunk-D7AEXSM5.js.map → chunk-PICTDURQ.js.map} +0 -0
  33. /package/dist/{run-campaign-OBXSN5WK.js.map → run-campaign-HNFPJET4.js.map} +0 -0
@@ -1387,6 +1387,10 @@ interface Scenario {
1387
1387
  kind: string;
1388
1388
  tags?: string[];
1389
1389
  }
1390
+ /** Redacted identity of a complete scenario payload retained in campaign results. */
1391
+ interface CampaignScenarioIdentity extends Pick<Scenario, 'id' | 'kind'> {
1392
+ scenarioDigest: `sha256:${string}`;
1393
+ }
1390
1394
  /** Context handed to every dispatch invocation. Scoped — every
1391
1395
  * trace/span carries the cellId, every artifact write lands under the cell's
1392
1396
  * artifact root, the cost meter accumulates per cell. */
@@ -1964,7 +1968,11 @@ interface CampaignAggregates {
1964
1968
  interface CampaignResult<TArtifact = unknown, TScenario extends Scenario = Scenario> {
1965
1969
  /** sha256(scenarios, judges, dispatch source ref, optimizer config, seed). Stable identity for reruns. */
1966
1970
  manifestHash: string;
1971
+ /** Canonical identity of the exact scenario payloads and replicate count. */
1972
+ splitDigest: `sha256:${string}`;
1967
1973
  seed: number;
1974
+ /** Replicates designed for every scenario in this campaign. */
1975
+ reps: number;
1968
1976
  startedAt: string;
1969
1977
  endedAt: string;
1970
1978
  durationMs: number;
@@ -1978,13 +1986,14 @@ interface CampaignResult<TArtifact = unknown, TScenario extends Scenario = Scena
1978
1986
  prUrl?: string;
1979
1987
  runDir: string;
1980
1988
  artifactsByPath: Record<string, string>;
1981
- /** Substrate strips the input scenarios to id+kind for the result manifest;
1982
- * consumers needing full payload look it up via the original input. The
1983
- * type parameter `TScenario` is propagated for downstream consumers that
1984
- * want narrowed types when extending `CampaignResult`. */
1985
- scenarios: Array<Pick<TScenario, 'id' | 'kind'>>;
1989
+ /** Redacted identities that let consumers verify the exact scenario payloads
1990
+ * without retaining customer task content in the result. */
1991
+ scenarios: Array<CampaignScenarioIdentity & Pick<TScenario, 'id' | 'kind'>>;
1986
1992
  }
1987
1993
 
1994
+ /** Canonical identity of the exact scenario payloads and replicate count. */
1995
+ declare function campaignSplitDigest<TScenario extends Scenario>(scenarios: readonly TScenario[], reps: number): `sha256:${string}`;
1996
+
1988
1997
  /**
1989
1998
  * `CampaignStorage` — the filesystem seam `runCampaign` writes through
1990
1999
  * (run/cell dirs, the resumability cache, per-cell artifacts, trace spans).
@@ -2319,8 +2328,8 @@ interface RunOptimizationResult<TArtifact, TScenario extends Scenario> {
2319
2328
  *
2320
2329
  * Hard-refuses unsafe configurations:
2321
2330
  * - `tracing: 'off'` when a proposer is wired (improvement is unattributable)
2322
- * - `autoOnPromote: 'config'` — DEFERRED to Pass B; v0.40 only ships
2323
- * `'pr'` and `'none'`.
2331
+ * - `autoOnPromote: 'config'` — live mutation is unsupported without
2332
+ * isolated deployment, rollback, and independent validation.
2324
2333
  */
2325
2334
 
2326
2335
  type RunImprovementLoopOptions<TScenario extends Scenario, TArtifact> = RunOptimizationOptions<TScenario, TArtifact> & {
@@ -2334,15 +2343,11 @@ type RunImprovementLoopOptions<TScenario extends Scenario, TArtifact> = RunOptim
2334
2343
  /** What to do when the gate ships:
2335
2344
  * - `'pr'`: open a PR via `openAutoPr`
2336
2345
  * - `'none'`: just report — caller decides what to do with the winner
2337
- * v0.40 does NOT support `'config'` (live-runtime self-mutation)
2338
- * deferred to Pass B behind safety stack. */
2346
+ * Live-runtime self-mutation is intentionally unsupported. */
2339
2347
  autoOnPromote: 'pr' | 'none';
2340
2348
  /** GH owner / repo for the auto-PR. Required when autoOnPromote === 'pr'. */
2341
2349
  ghOwner?: string;
2342
2350
  ghRepo?: string;
2343
- /** Optional render override — substrate writes a diff-shaped surface; pass
2344
- * a function to format the promoted surface differently. */
2345
- renderPromotedDiff?: (winnerSurface: MutableSurface, baselineSurface: MutableSurface) => string;
2346
2351
  /** Placebo control. When supplied AND the winner differs from baseline, the
2347
2352
  * loop scores a THIRD holdout arm: the winner surface with its content
2348
2353
  * footprint-matched-blanked by this function (typically via `neutralizeText`).
@@ -2355,6 +2360,8 @@ type RunImprovementLoopOptions<TScenario extends Scenario, TArtifact> = RunOptim
2355
2360
  interface RunImprovementLoopResult<TArtifact, TScenario extends Scenario> extends RunOptimizationResult<TArtifact, TScenario> {
2356
2361
  baselineOnHoldout: CampaignResult<TArtifact, TScenario>;
2357
2362
  winnerOnHoldout: CampaignResult<TArtifact, TScenario>;
2363
+ neutralizedOnHoldout?: CampaignResult<TArtifact, TScenario>;
2364
+ neutralizedSurface?: MutableSurface;
2358
2365
  gateResult: Awaited<ReturnType<Gate<TArtifact, TScenario>['decide']>>;
2359
2366
  /** Unified baseline→winner surface diff. Computed UNCONDITIONALLY (not only
2360
2367
  * when `autoOnPromote === 'pr'`) so the diff that the gate decided on is
@@ -3557,9 +3564,8 @@ interface PowerPreflight {
3557
3564
  * reads). The hosted `/v1/ingest/traces` endpoint receives the FULL loop,
3558
3565
  * not just the `cost.*` spans `runCampaign` already emits per cell.
3559
3566
  *
3560
- * The record is built from the substrate's own loop result + the per-call
3561
- * `RunRecord`s the worker emitted no new measurement, no recomputation that
3562
- * could drift from what the gate actually saw.
3567
+ * The record is built from the loop result and its settled cost receipts — no
3568
+ * second usage collector can contradict what the measured cells recorded.
3563
3569
  */
3564
3570
 
3565
3571
  interface LoopProvenanceCandidate {
@@ -3569,6 +3575,8 @@ interface LoopProvenanceCandidate {
3569
3575
  surfaceHash: string;
3570
3576
  /** Full sha256 content hash — byte-identical-verifiable. */
3571
3577
  contentHash: string;
3578
+ /** Exact scored rows that produced this candidate's search result. */
3579
+ campaignDigest: `sha256:${string}`;
3572
3580
  /** Proposer label, when the proposer returned a `ProposedCandidate`. */
3573
3581
  label?: string;
3574
3582
  /** Proposer rationale — the "because Z". When the proposer returned a bare
@@ -3602,13 +3610,33 @@ interface LoopProvenanceBackend {
3602
3610
  totalOutputTokens: number;
3603
3611
  totalCostUsd: number;
3604
3612
  }
3613
+ interface LoopProvenanceEvidence {
3614
+ search: {
3615
+ splitDigest: `sha256:${string}`;
3616
+ baselineCampaignDigest: `sha256:${string}`;
3617
+ };
3618
+ holdout: {
3619
+ splitDigest: `sha256:${string}`;
3620
+ baselineCampaignDigest: `sha256:${string}`;
3621
+ winnerCampaignDigest: `sha256:${string}`;
3622
+ neutralized?: {
3623
+ contentHash: `sha256:${string}`;
3624
+ campaignDigest: `sha256:${string}`;
3625
+ composite: number;
3626
+ lift: number;
3627
+ };
3628
+ };
3629
+ costReceiptsDigest: `sha256:${string}`;
3630
+ }
3605
3631
  /**
3606
3632
  * The durable provenance record. Aligns to the hosted `EvalRunEvent` path but
3607
3633
  * ADDS the rationale + the explicit baseline→candidate diff (both omitted from
3608
3634
  * the bare hosted event) + backend provenance.
3609
3635
  */
3610
3636
  interface LoopProvenanceRecord {
3611
- schema: 'tangle.loop-provenance.v3';
3637
+ schema: 'tangle.loop-provenance';
3638
+ /** SHA-256 over the canonical record with this field omitted. */
3639
+ recordDigest: `sha256:${string}`;
3612
3640
  runId: string;
3613
3641
  runDir: string;
3614
3642
  timestamp: string;
@@ -3622,6 +3650,8 @@ interface LoopProvenanceRecord {
3622
3650
  diff: string;
3623
3651
  /** Every candidate across every generation, with its rationale and structured cause. */
3624
3652
  candidates: LoopProvenanceCandidate[];
3653
+ /** Exact campaign, split, surface, and receipt identities behind every summary. */
3654
+ evidence: LoopProvenanceEvidence;
3625
3655
  /** Baseline composite on the search split that generated the candidates. */
3626
3656
  baselineSearchComposite: number;
3627
3657
  /** The gate verdict — decision + reasons + contributing gates + delta. */
@@ -3632,6 +3662,7 @@ interface LoopProvenanceRecord {
3632
3662
  contributingGates: Array<{
3633
3663
  name: string;
3634
3664
  passed: boolean;
3665
+ detail: unknown;
3635
3666
  }>;
3636
3667
  };
3637
3668
  /** baseline-on-holdout composite mean. */
@@ -3784,17 +3815,6 @@ interface SelfImproveOptions<TScenario extends Scenario, TArtifact> {
3784
3815
  * Default `mem://selfImprove-<timestamp>` (in-memory, non-durable). Pass a
3785
3816
  * real path to persist the provenance record + spans. */
3786
3817
  runDir?: string;
3787
- /**
3788
- * Worker call records for backend provenance. The agent is opaque to the
3789
- * substrate (it returns an artifact, not token usage), so to capture an
3790
- * `assertRealBackend`-grade verdict + worker call count + model in the
3791
- * provenance record, the agent reports its per-call `RunRecord`s here.
3792
- * Called once after the loop; return the records the agent accumulated.
3793
- * When unset, backend provenance is derived from campaign cells (cost only;
3794
- * verdict will read `stub` without token usage — the honest signal that no
3795
- * token channel was wired).
3796
- */
3797
- collectWorkerRecords?: () => RunRecord[];
3798
3818
  /** Fires once the durable provenance record + OTel spans are emitted.
3799
3819
  * Receives the structured record for inline assertions / custom routing. */
3800
3820
  onProvenance?: (record: LoopProvenanceRecord) => void;
@@ -4006,8 +4026,12 @@ declare function defineAgentEval<TScenario extends Scenario, TArtifact>(defaults
4006
4026
  interface MeasuredComparisonFromSelfImproveResultOptions<TScenario extends Scenario, TArtifact> {
4007
4027
  result: SelfImproveResult<TScenario, TArtifact>;
4008
4028
  benchmark: AgentImprovementMeasuredComparison['benchmark'];
4029
+ /** Canonical digest verified by the runtime that owns the baseline profile. */
4009
4030
  baselineProfileDigest: Sha256Digest;
4031
+ /** Canonical digest verified by the runtime that owns candidate sealing. */
4010
4032
  candidateBundleDigest: Sha256Digest;
4033
+ /** Exact baseline surface; contradictory recorded provenance is rejected. */
4034
+ baselineSurface: MutableSurface;
4011
4035
  }
4012
4036
  /** Convert one paired self-improvement result into the portable Interface evidence record. */
4013
4037
  declare function measuredComparisonFromSelfImproveResult<TScenario extends Scenario, TArtifact>(options: MeasuredComparisonFromSelfImproveResultOptions<TScenario, TArtifact>): AgentImprovementMeasuredComparison;
@@ -4942,4 +4966,4 @@ interface FromOtelSpansOptions {
4942
4966
  }
4943
4967
  declare function fromOtelSpans(opts: FromOtelSpansOptions): RunRecord[];
4944
4968
 
4945
- 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, 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 };
4969
+ 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 };