@tangle-network/agent-eval 1.0.16 → 1.0.18
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.
- package/CHANGELOG.md +11 -0
- package/dist/analyst/index.js +1 -1
- package/dist/app-grade/index.d.ts +1037 -0
- package/dist/app-grade/index.d.ts.map +1 -0
- package/dist/app-grade/index.js +3073 -0
- package/dist/app-grade/index.js.map +1 -0
- package/dist/{benchmark-command-BRRhjX2k.js → benchmark-command-Bqqvv9Tk.js} +2 -2
- package/dist/{benchmark-command-BRRhjX2k.js.map → benchmark-command-Bqqvv9Tk.js.map} +1 -1
- package/dist/cli.js +5 -5
- package/dist/cli.js.map +1 -1
- package/dist/index-BAPkHt5H.d.ts +3649 -0
- package/dist/index-BAPkHt5H.d.ts.map +1 -0
- package/dist/index.d.ts +9 -3623
- package/dist/openapi.json +1 -1
- package/dist/pipelines/index.d.ts +1 -1
- package/dist/rl.d.ts +2 -2
- package/dist/{render-DPcMWx5w.js → runtime-rollouts-kGn1K5ut.js} +196 -284
- package/dist/runtime-rollouts-kGn1K5ut.js.map +1 -0
- package/dist/supervisor-run/index.d.ts +30 -34
- package/dist/supervisor-run/index.d.ts.map +1 -1
- package/dist/supervisor-run/index.js +2 -2
- package/dist/traces.d.ts +1 -1
- package/docs/app-grade.md +79 -0
- package/package.json +15 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/render-DPcMWx5w.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { _ as PendingCostCall, a as CostLedgerFilter, c as CostLedgerPersistence, d as CostReceipt, f as CostReceiptInput, g as PaidCallResult, h as MaximumCharge, i as CostChannel, l as CostLedgerSummary, m as CustomTokenPricing, n as ChannelRollup, o as CostLedgerHandle, p as CostUsage, s as CostLedgerOptions, t as CostLedger, u as CostProvenance, v as PendingCostCallView, y as RunPaidCallInput } from "./cost-ledger-Czro9wmo.js";
|
|
2
2
|
import { a as JudgeError, c as ValidationError, i as ConfigError, n as AgentEvalErrorCode, s as NotFoundError, t as AgentEvalError } from "./errors-E9I2hldP.js";
|
|
3
|
+
import { $ as KeywordConceptSpec, $i as PolicyEditCandidateRecord, $n as TrialTrace, $r as exportProductBenchmark, $t as ArgumentCheck, A as contentHash, Aa as summarizeDistribution, Ai as DetectorSignal, An as SteeringOptimizationResult, Ar as localCommandRunner, At as assertNoHiddenLeak, B as PairedPromotionPowerOptions, Ba as costForTokenPricing, Bi as ScenarioCost, Bn as PromptHandle, Br as RuntimeTrajectoryEvidenceSummary, Bt as CanaryLeak, C as runAgentControlLoop, Ca as CliffsMagnitude, Ci as UserQuestion, Cn as recordRuns, Cr as DiscoverPersonasOptions, Ct as FieldDestination, D as index_d_exports, Da as pairedCohensDz, Di as ExtractResult, Dn as CounterfactualResult, Dr as DirEntry, Dt as JudgeScoreInput, E as BudgetGuard, Ea as interpretCliffs, Ei as ExtractOptions, En as CounterfactualMutation, Er as CommandRunner, Et as HiddenLeak, F as gateTreatmentApplied, Fa as LlmResponseError, Fi as observeAll, Fn as clamp01, Fr as ActiveLearningOptions, Ft as ViteDeployRunnerInput, G as pairedPromotionPower, Gi as TaskHeadroom, Gn as seatPresets, Gr as ProductBenchmarkManifest, Gt as ContractLintFinding, H as PairedValueLaw, Ha as CostAccountingIncompleteError, Hi as CapabilityHeadroomOptions, Hn as hashContent, Hr as RuntimeTrajectoryRecord, Ht as ActionExecutionPolicy, I as PairedPromotionAlternative, Ia as costReceiptFromLlm, Ii as repeatedActionDetector, In as SteeringBundle, Ir as SynthesisTarget, It as WranglerDeployRunnerInput, J as OracleObservation, Ji as FindingToPolicyEditOptions, Jn as preflightModels, Jr as assertProductBenchmarkRun, Jt as lintTraceContractSpec, K as requiredPairsForPairedPromotion, Ki as assertCapabilityHeadroom, Kn as ModelEndpointCheck, Kr as ProductBenchmarkSplit, Kt as TraceContractSpec, L as PairedPromotionAlternativeCell, La as costReceiptFromLlmError, Li as CostEntry, Ln as ReferenceReplayCaseRun, Lr as proposeSynthesisTargets, Lt as deployGateLayer, M as TreatmentGate, Ma as isTransientLlmError, Mi as RepeatedActionOptions, Mn as RunScore, Mr as BoundedProcessResult, Mt as DeployGateLayerInput, N as TreatmentGateInput, Na as stripFencedJson, Ni as StreamingDetector, Nn as RunScoreWeights, Nr as DEFAULT_BOUNDED_PROCESS_TIMEOUT_MS, Nt as DeployRunResult, O as VerdictCacheStore, Oa as SampleDistribution, Oi as extractErrorCount, On as CounterfactualRunner, Or as RunCommandInput, Ot as NoLeakOptions, P as TreatmentGateOptions, Pa as LlmCallError, Pi as errorStreakDetector, Pn as aggregateRunScore, Pr as runBoundedProcess, Pt as DeployRunner, Q as jsonShape, Qi as PolicyEditAxis, Qn as ReflectionProposal, Qr as ProductBenchmarkSingleRunExportOptions, Qt as traceContract, R as PairedPromotionCallRates, Ra as maximumChargeForLlmRequest, Ri as CostSummary, Rn as ReferenceReplayRun, Rr as ProjectRuntimeTrajectoryEvidenceOptions, Rt as viteDeployRunner, S as subjectiveEval, Sa as twoByTwoPValue, Si as KnowledgeSensitivity, Sn as loadScorecard, Sr as ImprovementVerdictResult, St as BlendWeights, T as BudgetBreachError, Ta as cohensD, Ti as ErrorCountPattern, Tn as CounterfactualContext, Tr as discoverPersonas, Tt as HiddenGradeResult, U as RequiredPairsForPairedPromotionOptions, Ua as CostCeilingReachedError, Ui as CapabilityHeadroomResult, Un as ModelSeats, Ur as RuntimeTrajectoryRunRecord, Ut as ActionPolicyDecision, V as PairedPromotionPowerResult, Va as costForUsage, Vi as AssertCapabilityHeadroomOptions, Vn as PromptRegistry, Vr as RuntimeTrajectoryHookEvent, Vt as checkCanaries, W as RequiredPairsForPairedPromotionResult, Wi as HeadroomInput, Wn as resolveSeat, Wr as projectRuntimeTrajectoryEvidence, Wt as evaluateActionPolicy, X as OracleResult, Xi as PolicyEditAdmission, Xn as jsonlRunRecordBackend, Xr as ProductBenchmarkExportOptions, Xt as checkTraceContracts, Y as OracleReport, Yi as PolicyEdit, Yn as RunRecordBackend, Yr as readProductBenchmarkManifest, Yt as explainTraceContract, Z as evaluateOracles, Zi as PolicyEditAdmissionOptions, Zn as ReflectionContext, Zr as ProductBenchmarkExportResult, Zt as evaluateTraceContract, _ as blockingKnowledgeEval, _a as chiSquaredPValue, _i as KnowledgeFreshness, _n as ScorecardDiff, _r as jsonlReviewStore, _t as AssertSingleBackendOptions, a as assertHttpOk, aa as PolicyEditRisk, ai as TrainSelectionTestPartition, an as ContractStatus, ar as ProposeOutput, at as EnsembleJudgeOptions, b as userQuestionsForKnowledgeGaps, ba as normalTwoSidedPValue, bi as KnowledgeRequirement, bn as diffScorecard, br as ExperimentStats, bt as SingleBackendReport, c as assertStatus, ca as PolicyEditTarget, ci as PairedDeltaTestResult, cn as RetryWrite, cr as Review, ct as JudgeRetryPolicy, d as MODEL_PRICING, da as SampleSummary, di as LeaderboardOptions, dn as CellVerdict, dr as ReviewMemoryEntry, dt as JudgeVerdict, ea as PolicyEditChange, ei as exportProductBenchmarkRuns, en as ContractCheckResult, er as buildReflectionPrompt, et as KeywordCoverageFinding, f as estimateCost, fa as SampleSummaryOptions, fi as LeaderboardRow, fn as DiffScorecardOptions, fr as ReviewMemoryStore, ft as aggregateJudgeVerdicts, g as acquisitionPlansForKnowledgeGaps, ga as chiSquared, gi as KnowledgeBundle, gn as ScorecardCellDiff, gr as inMemoryReviewStore, gt as runIntentMatchJudge, h as resolveModelPricing, ha as LinearRegressionResult, hi as KnowledgeAcquisitionMode, hn as ScorecardCell, hr as createLlmReviewer, ht as IntentMatchResult, i as assertHasField, ia as PolicyEditInit, ii as TrainSelectionTestOptions, in as ContractSpan, ir as ProposeInput, it as runKeywordCoverageJudgeUrl, j as fileVerdictCache, ja as rocAuc, ji as ErrorStreakOptions, jn as SteeringOptimizationRow, jr as BoundedProcessInput, jt as blendHeldout, k as canonicalJson, ka as percentileNearestRank, ki as DetectorEvent, kn as PairwiseSteeringOptimizer, kr as RunCommandResult, kt as RoutedField, l as analyzeAntiSlop, la as PolicyEditTargetSurface, li as minimumPairsForPairedDeltaTest, ln as SpanPredicate, lr as ReviewFn, lt as withJudgeRetry, m as isModelPriced, ma as summarizeSample, mi as DataAcquisitionPlan, mn as Scorecard, mr as VerifyFn, mt as IntentMatchOptions, n as assertEventCount, na as PolicyEditGainDirection, ni as HeldOutPartition, nn as ContractRuleExecution, nr as LlmReviewerConfig, nt as KeywordCoverageResult, o as assertLatencyUnder, oa as PolicyEditSchemaVersion, oi as partitionHeldOut, on as ContractVerdict, or as ProposeReviewConfig, ot as ensembleJudge, p as estimateTokens, pa as sampleMedian, pi as leaderboard, pn as RecordRunsOptions, pr as Verification, pt as IntentMatchInput, q as Oracle, qi as capabilityHeadroom, qn as ModelEndpointRequest, qr as ProductBenchmarkValidationReport, qt as compileTraceContractSpec, r as assertExists, ra as PolicyEditGainUnit, ri as PartitionHeldOutOptions, rn as ContractRun, rr as ProposeFn, rt as runKeywordCoverageJudge, s as assertNotContains, sa as PolicyEditSource, si as PairedDeltaTestOptions, sn as OrderMode, sr as ProposeReviewReport, st as JudgeRetryOutcome, t as assertContains, ta as PolicyEditExpectedGain, ti as productBenchmarkRepoIdentity, tn as ContractRule, tr as parseReflectionResponse, tt as KeywordCoverageOptions, u as createAntiSlopJudge, ua as makePolicyEditCandidateRecord, ui as pairedDeltaTest, un as TraceContract, ur as ReviewInput, ut as EnsembleAggregate, v as knowledgeReadinessTracePayload, va as fisherExactTwoSided, vi as KnowledgeImportance, vn as ScorecardEntry, vr as runProposeReview, vt as BackendDescriptor, w as ProductClient, wa as cliffsDelta, wi as ERROR_COUNT_PATTERNS, wn as recordRunsToScorecard, wr as DiscoveredPersona, wt as HiddenCriteriaGrader, x as objectiveEval, xa as studentTTwoSidedPValue, xi as KnowledgeRequirementCategory, xn as formatScorecardDiff, xr as ImprovementThresholds, xt as assertSingleBackend, y as scoreKnowledgeReadiness, ya as linearRegressionSlope, yi as KnowledgeReadinessReport, yn as ScorecardLogLine, yr as ExperimentRep, yt as SingleBackendDivergence, z as PairedPromotionPowerCall, za as CostResult, zi as CostTracker, zn as ReferenceReplaySplit, zr as RuntimeTrajectoryEvidenceProjection, zt as wranglerDeployRunner } from "./index-BAPkHt5H.js";
|
|
3
4
|
import { _ as toAgentProfileJson, g as groupRunsByAgentProfileCell, h as buildAgentProfileCell, i as AgentProfileCellInput, l as AgentProfileJson, m as agentProfileCellKey, p as AgentProfileSourceInput, r as AgentProfileCell, s as AgentProfileDimensionValue, t as AGENT_PROFILE_KINDS, y as verifyAgentProfileCell } from "./agent-profile-cell-3kYxUsK2.js";
|
|
4
5
|
import { E as isToolSpan, S as TraceEvent, T as isLlmSpan, _ as Span, a as FAILURE_CLASSES, c as JudgeSpan, f as Run, h as RunStatus, l as LlmSpan, n as BudgetLedgerEntry, o as FailureClass, p as RunCaptureReport, r as BudgetSpec, s as GenericSpan, t as Artifact, w as isJudgeSpan, x as ToolSpan } from "./schema-CkIvnmLU.js";
|
|
5
6
|
import { _ as runTaskScore, a as RunRecord, c as RunSplitTag, d as RunTokenUsage, f as RunTraceRef, g as parseRunRecordSafe, h as modelHasSnapshot, i as RunOutcome, l as RunTaskFailure, m as isRunRecord, n as RunCostProvenance, o as RunRecordValidationError, p as UNKNOWN_MODEL, r as RunJudgeMetadata, s as RunSearchCoordinates, t as JudgeScoresRecord, u as RunTerminalOutcome, v as validateRunRecord } from "./run-record-D2BFMPGl.js";
|
|
@@ -14,18 +15,18 @@ import { a as PairedPromotionDecision, c as BOOTSTRAP_GATE_MIN_N, d as PairedSig
|
|
|
14
15
|
import { a as requiredPairedSampleSize, i as pairedMde, n as mcnemarPower, o as requiredSampleSize, r as mcnemarRequiredN, t as mulberry32 } from "./random-BN150Q_X.js";
|
|
15
16
|
import { C as mannWhitneyU, S as WilcoxonSignedRankResult, _ as evaluateReleaseConfidence, a as bootstrapCi, b as RankTestMethodRequest, d as ReleaseConfidenceIssue, f as ReleaseConfidenceMetrics, g as ReleaseTraceEvidence, i as Verdict, n as BootstrapResult, p as ReleaseConfidenceScorecard, s as ActionableSideInfo, t as BootstrapOptions, u as ReleaseConfidenceInput, v as MannWhitneyResult, w as wilcoxonSignedRank, x as RankTestOptions, y as RankTestMethod } from "./promotion-gate-DOkgJcLW.js";
|
|
16
17
|
import { $ as summarizeBackendIntegrity, $n as RedTeamCategory, Di as RunCampaignOptions, Ei as CampaignCellRetryPolicy, Oi as runCampaign, Q as assertRealBackend, Qn as RedTeamCase, Ti as CampaignCellFailureReceipt, X as BackendIntegrityError, Z as BackendIntegrityReport, Zn as DEFAULT_RED_TEAM_CORPUS, ar as CanaryAlert, ci as LlmJudgeOptions, cr as CanaryOptions, er as RedTeamFinding, fi as transientDispatchFailure, ft as ArtifactEventLike, gt as extractProducedState, ht as ToolCallEventLike, ir as scoreRedTeamOutput, li as llmJudge, lr as CanaryReport, mt as RuntimeEventLike, nr as redTeamDataset, or as CanaryEvaluation, pt as ProposalEventLike, rr as redTeamReport, sr as CanaryKind, tr as RedTeamReport, ur as runCanaries } from "./index-BJM4rwP2.js";
|
|
17
|
-
import { $ as MintRolloutResult, Q as MintRolloutOptions, R as Scenario,
|
|
18
|
+
import { $ as MintRolloutResult, Q as MintRolloutOptions, R as Scenario, _ as GateDecision, a as CampaignResult, nt as mintRolloutRows, tt as RolloutSearchLineage, w as JudgeScore } from "./types-CBkDo7ja.js";
|
|
18
19
|
import { a as RunFilter, i as InMemoryTraceStore, n as FileSystemTraceStore, o as SpanFilter, s as TraceStore, t as EventFilter } from "./store-CMs5wGXP.js";
|
|
19
20
|
import { n as ScorePreference } from "./reward-ST4PXNXF.js";
|
|
20
21
|
import { a as ProfileAxisSpec, c as expandProfileAxes, i as HarnessType, l as harnessAxisOf, n as CODING_HARNESSES, o as agentProfileHash, r as HARNESS_NATIVE_MODEL, s as agentProfileId, t as AgentProfile } from "./agent-profile-CPv4tENR.js";
|
|
21
|
-
import { i as DatasetSplit, n as DatasetManifest, r as DatasetScenario
|
|
22
|
+
import { i as DatasetSplit, n as DatasetManifest, r as DatasetScenario } from "./dataset-DThC1S6G.js";
|
|
22
23
|
import { C as runEquivalenceCheck, S as defineEquivalenceCheck, _ as StrategyChecker, a as CheckerIdentity, b as VerificationStrategyProfile, c as EquivalenceCheckDefinition, d as EquivalenceCheckerInput, f as EquivalenceCheckerResult, g as EquivalenceRecord, h as EquivalenceProtocolError, i as equivalenceVerdict, l as EquivalenceCheckSpec, m as EquivalenceObligationStatus, n as VerdictCertification, o as CheckerOutcome, p as EquivalenceObligation, r as certificationEvidenceDigest, s as EquivalenceArm, t as DefaultVerdict, u as EquivalenceChecker, v as VERIFICATION_STRATEGIES, x as VerificationStrategySource, y as VERIFICATION_STRATEGY_SOURCES } from "./verdict-D_qiBQ6_.js";
|
|
23
24
|
import { a as MultiLayerVerifier, c as VerifyOptions, i as LayerStatus, l as gradeSemanticStatus, n as Layer, o as Severity, r as LayerResult, s as VerificationReport, t as Finding } from "./multi-layer-verifier-lM4aVN78.js";
|
|
24
25
|
import { C as HeldOutGateRejectionCode, S as HeldOutGateDecision, _ as gainHistogram, a as ResearchReportOptions, b as HeldOutGate, d as GainDistributionOptions, g as SummaryTableRow, h as SummaryTableOptions, l as GainDistributionBin, m as SummaryTable, p as ParetoPoint, t as ResearchReport, u as GainDistributionFigureSpec, v as summaryTable, w as SplitCoverage, x as HeldOutGateConfig, y as GateEvidence } from "./summary-report-0La5vejY.js";
|
|
25
26
|
import { a as FailureClassification, c as FailureRule, d as failureBlame, i as FailureBlame, l as classifyFailure, o as FailureContext, r as failureClusterView, s as FailureReasonRule, u as classifyFailureReason } from "./failure-cluster-DOoa7CBg.js";
|
|
26
27
|
import { d as InsightReport, n as analyzeRuns, t as AnalyzeRunsOptions } from "./analyze-runs-pJ4fhnYg.js";
|
|
27
28
|
import { a as SpanHandle, n as CaptureWrite, o as TraceEmitter, s as TraceEmitterOptions, t as CaptureErrorHandler } from "./emitter-mAXC5PSN.js";
|
|
28
|
-
import { c as SandboxDriver
|
|
29
|
+
import { c as SandboxDriver } from "./sandbox-harness-K3LuyORm.js";
|
|
29
30
|
import { a as ProducedProposal, c as SatisfiedBy, d as createLlmCorrectnessChecker, f as verifyCompletion, i as LlmCorrectnessCheckerOpts, l as TaskGold, n as CompletionVerdict, o as ProducedState, r as CorrectnessChecker, s as RequirementCheck, t as CompletionRequirement, u as completionVerdict } from "./completion-verifier-7KEfroqx.js";
|
|
30
31
|
import { _ as SelfImproveMethodResult, a as DefinedAgentEval, c as SelfImproveMethodOptions, d as SelfImproveProposerOptions, f as SelfImproveProposerResult, g as SelfImproveMethodProvenance, h as selfImprove, i as DefineAgentEvalOptions, l as SelfImproveOptions, n as AgentEvalEvaluateOptions, o as defineAgentEval, p as SelfImproveResult, r as AgentEvalImproveOptions, s as SelfImproveBudget, t as AgentEvalAgent, u as SelfImproveProgressEvent } from "./define-agent-eval-DKVYlm-T.js";
|
|
31
32
|
import { a as createTraceAnalyst, i as TraceAnalystDefinition, n as buildDefaultAnalystRegistry, r as CreateTraceAnalystOptions, t as DefaultAnalystRegistryOptions } from "./default-registry-BNv7eB1C.js";
|
|
@@ -34,3629 +35,14 @@ import { B as DiffPolicy, H as FindingsStore, U as PersistedFinding, V as Findin
|
|
|
34
35
|
import { r as TraceAnalysisEngineResult, s as RawAnalystFinding, t as TraceAnalysisEngine } from "./engine-rfV8Ff8V.js";
|
|
35
36
|
import { a as BudgetPolicy, c as RegistryRunOpts, i as AnalystRegistryOptions, s as ExactRegistryRunOpts, t as AnalystRegistry } from "./registry-Ck7w-rr5.js";
|
|
36
37
|
import { C as SEMANTIC_CONCEPT_JUDGE_VERSION, D as runSemanticConceptJudge, E as SemanticConceptJudgeResult, S as ConceptSpec, T as SemanticConceptJudgeOptions, _ as DspyRlmTraceEngineOptions, a as FAILURE_MODE_KIND_SPEC, b as createChatTraceEngine, d as FindingSubject, f as FindingSubjectKind, t as DEFAULT_TRACE_ANALYST_KINDS, v as createDspyRlmTraceEngine, w as SemanticConceptJudgeInput, x as ConceptFinding, y as ChatTraceEngineOptions } from "./index-Dt6E4BHX.js";
|
|
37
|
-
import { i as BenchmarkEvaluation } from "./types-D91tnhzf.js";
|
|
38
|
-
import { _ as redactText, d as ShareSafetyVerdict, f as assessShareSafety, g as redactForShare, h as redact, i as RedactOptions, o as RedactionProfile, r as REDACTION_VERSION, s as RedactionReport, u as ShareSafetyStatus, v as shareAllowed } from "./redact-jrT0APTU.js";
|
|
39
|
-
import { a as PairedEvalueStep, c as SequentialDecision, i as PairedEvalueSequence, l as evaluateInterimReleaseConfidence, n as InterimReleaseConfidenceInput, r as PairedEvalueOptions, t as InterimReleaseConfidence, u as pairedEvalueSequence } from "./sequential-Bb_pdTqG.js";
|
|
40
38
|
import { S as welchsTTest, _ as computeToolUseMetrics, b as WelchTestStatus, d as Trajectory, f as TrajectoryStep, g as ToolUseOptions, h as ToolUseMetrics, i as toolWasteView, m as ToolStats, p as buildTrajectory, s as judgeAgreementView, u as budgetBreachView, x as iqr, y as WelchTestResult } from "./tool-waste-CUASoTtk.js";
|
|
41
|
-
import {
|
|
39
|
+
import { i as BenchmarkEvaluation } from "./types-D91tnhzf.js";
|
|
40
|
+
import { A as AnalystFindingDigest, B as ControlRuntimeConfig, C as createFeedbackTrajectory, D as renderPreferenceMemoryMarkdown, E as feedbackTrajectoryToOptimizerRow, F as ControlBudget, I as ControlContext, L as ControlDecision, M as AnalystRunDigest, N as analystRunDigest, O as summarizePreferenceMemory, P as ControlActionOutcome, R as ControlEvalResult, S as controlRunToFeedbackTrajectory, T as feedbackTrajectoriesToOptimizerRows, U as ControlStep, V as ControlRuntimeError, W as StopDecision, _ as PreferenceMemoryEntry, a as FeedbackLabel, b as analystRunToReviewRequests, c as FeedbackOptimizerRow, d as FeedbackTask, f as FeedbackTrajectory, g as InMemoryFeedbackTrajectoryStore, h as FileSystemFeedbackTrajectoryStore, i as FeedbackAttempt, j as AnalystReviewDecision, k as withAssignedFeedbackSplit, l as FeedbackOutcome, m as FeedbackTrajectoryStore, n as AnalystReviewRequest, o as FeedbackLabelKind, p as FeedbackTrajectoryFilter, r as FeedbackArtifactType, s as FeedbackLabelSource, t as AnalystFeedbackTrajectoryOptions, u as FeedbackSplitPolicy, v as ProposedSideEffect, w as feedbackTrajectoriesToDatasetScenarios, x as assignFeedbackSplit, y as analystRunToFeedbackTrajectory, z as ControlRunResult } from "./feedback-trajectory-P37ju-gW.js";
|
|
42
41
|
import { A as TraceInsightReadiness, F as describeTraceInsightScope, G as AnalyzeTracesResult, H as tokenizeDomainWords, I as domainEvidencePattern, K as analyzeTraces, L as inferDomainKeywords, N as buildTraceInsightContext, P as buildTraceInsightPrompt, V as scoreTraceInsightReadiness, a as captureFetchToRawSink, b as OtlpSpan, c as ExtractedUsage, d as extractUsageFromSse, f as OtlpFileTraceStore, g as spanRecordsToTraceAnalysisStore, h as otlpTextToTraceAnalysisStore, j as TraceInsightSuite, m as SpanRecordsToTraceAnalysisStoreOptions, n as toolSpansToTraceAnalysisStore, o as OtlpFlatLine, u as extractUsage, v as OtlpExport, x as exportRunAsOtlp } from "./store-tool-spans-BgwVHXma.js";
|
|
43
42
|
import { a as RunIntegrityReport, o as assertRunCaptured, t as RunIntegrityError } from "./integrity-BAdVzT8u.js";
|
|
44
43
|
import { a as SteeringChange, c as CampaignRunContext, d as CampaignVariant, f as EvalCampaignOptions, h as runEvalCampaign, i as Researcher, l as CampaignRunOutcome, m as FailedRun, n as ExperimentResult, o as CampaignFactoryParams, p as EvalCampaignResult, r as FailureMode, s as CampaignIntegrityPolicy, t as ExperimentPlan, u as CampaignScenario } from "./researcher-CLnNJ7Or.js";
|
|
45
|
-
import "./
|
|
44
|
+
import { a as PairedEvalueStep, c as SequentialDecision, i as PairedEvalueSequence, l as evaluateInterimReleaseConfidence, n as InterimReleaseConfidenceInput, r as PairedEvalueOptions, t as InterimReleaseConfidence, u as pairedEvalueSequence } from "./sequential-Bb_pdTqG.js";
|
|
45
|
+
import { _ as redactText, d as ShareSafetyVerdict, f as assessShareSafety, g as redactForShare, h as redact, i as RedactOptions, o as RedactionProfile, r as REDACTION_VERSION, s as RedactionReport, u as ShareSafetyStatus, v as shareAllowed } from "./redact-jrT0APTU.js";
|
|
46
46
|
import { y as OUTPUT_VALUE } from "./attribute-vocabulary-5oo8ykIx.js";
|
|
47
47
|
import { i as judgeSpans, n as argHash, s as runsForScenario } from "./query-UD0B08Sb.js";
|
|
48
|
-
import { SpanKind } from "@tangle-network/agent-trace-contract";
|
|
49
|
-
export declare class CostCeilingReachedError extends ValidationError {
|
|
50
|
-
constructor(ceilingUsd: number, committedUsd: number, requestedUsd: number, phase: string, actor: string);
|
|
51
|
-
}
|
|
52
|
-
export declare class CostAccountingIncompleteError extends ValidationError {}
|
|
53
|
-
interface CostResult {
|
|
54
|
-
costUsd: number;
|
|
55
|
-
costUnknown: boolean;
|
|
56
|
-
}
|
|
57
|
-
export declare function costForUsage(model: string, usage: CostUsage): CostResult;
|
|
58
|
-
/** Price token counts with caller-supplied per-million rates. */
|
|
59
|
-
export declare function costForTokenPricing(pricing: CustomTokenPricing, usage: Pick<CostUsage, 'inputTokens' | 'outputTokens' | 'cachedTokens' | 'cacheWriteTokens'>): number;
|
|
60
|
-
export declare function maximumChargeForLlmRequest(request: Pick<LlmCallRequest, 'model' | 'messages' | 'jsonSchema' | 'tools' | 'toolChoice' | 'maxTokens' | 'thinking'>, options?: LlmChargeBounds): MaximumCharge | undefined;
|
|
61
|
-
/** Convert a provider result into the canonical paid-call receipt input.
|
|
62
|
-
* The receipt is JSON-clean: absent optional fields are omitted, never carried
|
|
63
|
-
* as explicit-undefined keys. Receipts cross JSON boundaries (the external
|
|
64
|
-
* optimizer's loopback proxy validates them with `assertJsonValue`), where an
|
|
65
|
-
* explicit-undefined value is rejected as non-serializable. */
|
|
66
|
-
export declare function costReceiptFromLlm(result: LlmCallResult, customTokenPricing?: CustomTokenPricing): CostReceiptInput;
|
|
67
|
-
/** Structured-response failures retain their completed provider receipt. */
|
|
68
|
-
export declare function costReceiptFromLlmError(error: Error, customTokenPricing?: CustomTokenPricing): CostReceiptInput | undefined;
|
|
69
|
-
export declare class LlmCallError extends AgentEvalError {
|
|
70
|
-
readonly status: number;
|
|
71
|
-
readonly body: string;
|
|
72
|
-
readonly model: string;
|
|
73
|
-
constructor(message: string, status: number, body: string, model: string);
|
|
74
|
-
}
|
|
75
|
-
/** A provider response completed and incurred measurable usage, but its content
|
|
76
|
-
* could not satisfy the caller's response contract. The response envelope is
|
|
77
|
-
* retained so accounting can commit the receipt before the error propagates. */
|
|
78
|
-
export declare class LlmResponseError extends AgentEvalError {
|
|
79
|
-
readonly result: LlmCallResult;
|
|
80
|
-
constructor(message: string, result: LlmCallResult, options?: {
|
|
81
|
-
cause?: unknown;
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Strip a ```json / ``` code fence if the model emitted one.
|
|
86
|
-
* Idempotent for naked JSON. Some models (claude-code via router, certain
|
|
87
|
-
* deepseek models) wrap output even under json_object.
|
|
88
|
-
*/
|
|
89
|
-
export declare function stripFencedJson(raw: string): string;
|
|
90
|
-
/**
|
|
91
|
-
* True when an error is a transient transport/network fault worth retrying,
|
|
92
|
-
* as opposed to a deterministic failure (4xx schema reject, JSON parse) that
|
|
93
|
-
* a retry cannot fix. Inspects `LlmCallError.status`, then the error's
|
|
94
|
-
* name/message/code, then recurses into `error.cause` — undici nests the
|
|
95
|
-
* real socket fault one or more levels under `.cause`.
|
|
96
|
-
*
|
|
97
|
-
* This is the retry classifier for the package: `callLlm` and
|
|
98
|
-
* `withJudgeRetry` both route through it, so connection failures are treated
|
|
99
|
-
* consistently across transports.
|
|
100
|
-
*/
|
|
101
|
-
export declare function isTransientLlmError(err: unknown): boolean;
|
|
102
|
-
/** Mann–Whitney ROC area: ties count half; no observed member of either class means unknown. */
|
|
103
|
-
export declare function rocAuc(scores: number[], labels: number[]): number | null;
|
|
104
|
-
/**
|
|
105
|
-
* Nearest-rank distribution summary for measurement paths (gates, dashboards,
|
|
106
|
-
* load harnesses): min/p50/p90/p95/p99/max + mean + sample stddev + a 95%
|
|
107
|
-
* Student-t CI on the mean. Consolidates the former @repo/shared
|
|
108
|
-
* distribution-stats: identical nearest-rank percentiles, with the CI now the
|
|
109
|
-
* exact t critical value for any df (the retired implementation capped its
|
|
110
|
-
* table at df 30 and fell back to 1.96).
|
|
111
|
-
*/
|
|
112
|
-
interface SampleDistribution {
|
|
113
|
-
min: number;
|
|
114
|
-
p50: number;
|
|
115
|
-
p90: number;
|
|
116
|
-
p95: number;
|
|
117
|
-
p99: number;
|
|
118
|
-
max: number;
|
|
119
|
-
mean: number;
|
|
120
|
-
stddev?: number;
|
|
121
|
-
ci95Low?: number;
|
|
122
|
-
ci95High?: number;
|
|
123
|
-
n: number;
|
|
124
|
-
values: number[];
|
|
125
|
-
}
|
|
126
|
-
interface DistributionSummaryOptions {
|
|
127
|
-
lowerBound?: number;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Nearest-rank percentile on an arbitrary sample, `percentile` on a 0-100
|
|
131
|
-
* scale — the same rule `summarizeDistribution` applies, exposed for a single
|
|
132
|
-
* percentile the summary struct does not carry (e.g. p99.9). Returns NaN for
|
|
133
|
-
* an empty sample; callers that need a numeric floor guard it.
|
|
134
|
-
*/
|
|
135
|
-
export declare function percentileNearestRank(values: number[], percentile: number): number;
|
|
136
|
-
export declare function summarizeDistribution(values: number[], options?: DistributionSummaryOptions): SampleDistribution;
|
|
137
|
-
/** Standardized effect sizes; undefined effects remain null. */
|
|
138
|
-
/** Independent Cohen's d, oriented b − a; null below two samples or for an unbounded effect. */
|
|
139
|
-
export declare function cohensD(a: number[], b: number[]): number | null;
|
|
140
|
-
/** Paired Cohen's dz; constant nonzero deltas have no finite standardized effect. */
|
|
141
|
-
export declare function pairedCohensDz(before: number[], after: number[]): number | null;
|
|
142
|
-
type CliffsMagnitude = 'negligible' | 'small' | 'medium' | 'large';
|
|
143
|
-
/** Cliff's delta, oriented after − before; empty samples return zero. */
|
|
144
|
-
export declare function cliffsDelta(before: number[], after: number[]): number;
|
|
145
|
-
/** Romano magnitude thresholds for the absolute Cliff's delta. */
|
|
146
|
-
export declare function interpretCliffs(delta: number): CliffsMagnitude;
|
|
147
|
-
/** Two-sided normal tail, evaluated without subtracting a near-one CDF. */
|
|
148
|
-
export declare function normalTwoSidedPValue(z: number): number;
|
|
149
|
-
/** Two-sided Student-t tail, preserving small tail probabilities. */
|
|
150
|
-
export declare function studentTTwoSidedPValue(t: number, df: number): number;
|
|
151
|
-
/** Pearson statistic for a 2x2 table; empty or fixed margins have statistic zero. */
|
|
152
|
-
export declare function chiSquared(a: number, b: number, c: number, d: number): number;
|
|
153
|
-
/** One-degree-of-freedom chi-squared survival probability. */
|
|
154
|
-
export declare function chiSquaredPValue(statistic: number): number;
|
|
155
|
-
/** Fisher two-sided probability: sum all fixed-margin tables no likelier than the observed table. */
|
|
156
|
-
export declare function fisherExactTwoSided(a: number, b: number, c: number, d: number): number;
|
|
157
|
-
/** Fisher when any expected count is below five; otherwise Pearson's chi-squared tail. */
|
|
158
|
-
export declare function twoByTwoPValue(a: number, b: number, c: number, d: number): number;
|
|
159
|
-
interface LinearRegressionResult {
|
|
160
|
-
slope: number;
|
|
161
|
-
rSquared: number;
|
|
162
|
-
slopePValue: number | null;
|
|
163
|
-
}
|
|
164
|
-
/** Centered least-squares slope; null p-value means no slope test was possible. */
|
|
165
|
-
export declare function linearRegressionSlope(points: readonly {
|
|
166
|
-
x: number;
|
|
167
|
-
y: number;
|
|
168
|
-
}[]): LinearRegressionResult;
|
|
169
|
-
interface SampleSummaryOptions {
|
|
170
|
-
confidence?: number;
|
|
171
|
-
seed?: number;
|
|
172
|
-
resamples?: number;
|
|
173
|
-
}
|
|
174
|
-
interface SampleSummary {
|
|
175
|
-
n: number;
|
|
176
|
-
median: number;
|
|
177
|
-
mean: number;
|
|
178
|
-
stddev: number;
|
|
179
|
-
q1: number;
|
|
180
|
-
q3: number;
|
|
181
|
-
iqr: number;
|
|
182
|
-
min: number;
|
|
183
|
-
max: number;
|
|
184
|
-
range: number;
|
|
185
|
-
cv: number | null;
|
|
186
|
-
skewness: number | null;
|
|
187
|
-
kurtosis: number | null;
|
|
188
|
-
mad: number;
|
|
189
|
-
outliers: number[];
|
|
190
|
-
medianInterval: {
|
|
191
|
-
low: number;
|
|
192
|
-
high: number;
|
|
193
|
-
confidence: number;
|
|
194
|
-
resamples: number;
|
|
195
|
-
} | null;
|
|
196
|
-
}
|
|
197
|
-
/** Interpolated sample median; an empty population has no measured median. */
|
|
198
|
-
export declare function sampleMedian(values: readonly number[]): number | null;
|
|
199
|
-
/** Descriptive facts, not stability policy or a significance test. */
|
|
200
|
-
export declare function summarizeSample(values: readonly number[], options?: SampleSummaryOptions): SampleSummary | null;
|
|
201
|
-
type PolicyEditSchemaVersion = 'policy-edit/v1';
|
|
202
|
-
declare const POLICY_EDIT_AXES: readonly ["carrier", "representation", "budget", "sampling", "output_contract", "tool_contract", "routing", "memory", "agent_profile", "deployment_target"];
|
|
203
|
-
type PolicyEditAxis = (typeof POLICY_EDIT_AXES)[number];
|
|
204
|
-
declare const POLICY_EDIT_TARGET_SURFACES: readonly ["prompt", "tool-contract", "runtime-config", "memory", "agent-profile", "code", "deployment"];
|
|
205
|
-
type PolicyEditTargetSurface = (typeof POLICY_EDIT_TARGET_SURFACES)[number];
|
|
206
|
-
type PolicyEditRisk = 'low' | 'medium' | 'high' | 'unknown';
|
|
207
|
-
type PolicyEditGainDirection = 'increase' | 'decrease';
|
|
208
|
-
type PolicyEditGainUnit = 'absolute' | 'relative' | 'percent' | 'score';
|
|
209
|
-
interface PolicyEditTarget {
|
|
210
|
-
surface: PolicyEditTargetSurface;
|
|
211
|
-
/** Stable path inside the target surface, for example `system-prompt:tools`
|
|
212
|
-
* or `budget.maxTurns`. */
|
|
213
|
-
path?: string;
|
|
214
|
-
/** Optional canonical deployment identity. Store the existing cell, not a
|
|
215
|
-
* local profile shape. */
|
|
216
|
-
agentProfileCell?: AgentProfileCell;
|
|
217
|
-
/** Human label when the path is not enough for a readable audit trail. */
|
|
218
|
-
label?: string;
|
|
219
|
-
}
|
|
220
|
-
type PolicyEditChange = {
|
|
221
|
-
kind: 'text';
|
|
222
|
-
mode: 'append' | 'prepend' | 'replace';
|
|
223
|
-
value: string;
|
|
224
|
-
/** Required when `mode === 'replace'`; exact match only. */
|
|
225
|
-
find?: string;
|
|
226
|
-
} | {
|
|
227
|
-
kind: 'json';
|
|
228
|
-
mode: 'set' | 'merge' | 'remove';
|
|
229
|
-
path: string;
|
|
230
|
-
value?: AgentProfileJson;
|
|
231
|
-
};
|
|
232
|
-
interface PolicyEditExpectedGain {
|
|
233
|
-
/** Metric this edit is expected to move, e.g. `holdout.composite`. */
|
|
234
|
-
metric: string;
|
|
235
|
-
direction: PolicyEditGainDirection;
|
|
236
|
-
/** Positive magnitude in the metric's native units. */
|
|
237
|
-
amount: number;
|
|
238
|
-
unit?: PolicyEditGainUnit;
|
|
239
|
-
rationale?: string;
|
|
240
|
-
}
|
|
241
|
-
interface PolicyEditSource {
|
|
242
|
-
findingIds: string[];
|
|
243
|
-
analystIds: string[];
|
|
244
|
-
evidenceRefs: EvidenceRef[];
|
|
245
|
-
/** Mirrors `AnalystFinding.derived_from_judge`; admission rejects it. */
|
|
246
|
-
derivedFromJudge?: boolean;
|
|
247
|
-
}
|
|
248
|
-
interface PolicyEdit {
|
|
249
|
-
schemaVersion: PolicyEditSchemaVersion;
|
|
250
|
-
editId: string;
|
|
251
|
-
axis: PolicyEditAxis;
|
|
252
|
-
target: PolicyEditTarget;
|
|
253
|
-
change: PolicyEditChange;
|
|
254
|
-
claim: string;
|
|
255
|
-
expectedGain: PolicyEditExpectedGain;
|
|
256
|
-
confidence: number;
|
|
257
|
-
risk: PolicyEditRisk;
|
|
258
|
-
source: PolicyEditSource;
|
|
259
|
-
rationale?: string;
|
|
260
|
-
validationPlan?: string;
|
|
261
|
-
metadata?: Record<string, unknown>;
|
|
262
|
-
}
|
|
263
|
-
declare const POLICY_EDIT_CANDIDATE_RECORD_SCHEMA: "tangle.policy-edit-candidate.v1";
|
|
264
|
-
/** JSON-safe attribution carried with a measured candidate and its scores. */
|
|
265
|
-
interface PolicyEditCandidateRecord {
|
|
266
|
-
schema: typeof POLICY_EDIT_CANDIDATE_RECORD_SCHEMA;
|
|
267
|
-
policyEdit: PolicyEdit;
|
|
268
|
-
}
|
|
269
|
-
type PolicyEditInit = Omit<PolicyEdit, 'schemaVersion' | 'editId'> & {
|
|
270
|
-
schemaVersion?: PolicyEditSchemaVersion;
|
|
271
|
-
editId?: string;
|
|
272
|
-
};
|
|
273
|
-
interface FindingToPolicyEditOptions {
|
|
274
|
-
expectedGain?: PolicyEditExpectedGain | ((finding: AnalystFinding) => PolicyEditExpectedGain | null | undefined);
|
|
275
|
-
risk?: PolicyEditRisk | ((finding: AnalystFinding) => PolicyEditRisk);
|
|
276
|
-
defaultAxis?: PolicyEditAxis;
|
|
277
|
-
defaultTargetSurface?: PolicyEditTargetSurface;
|
|
278
|
-
}
|
|
279
|
-
interface PolicyEditAdmissionOptions {
|
|
280
|
-
minScore?: number;
|
|
281
|
-
minExpectedGain?: number;
|
|
282
|
-
allowHighRisk?: boolean;
|
|
283
|
-
requireEvidence?: boolean;
|
|
284
|
-
}
|
|
285
|
-
interface PolicyEditAdmission {
|
|
286
|
-
edit: PolicyEdit;
|
|
287
|
-
decision: 'admit' | 'reject';
|
|
288
|
-
score: number;
|
|
289
|
-
reasons: string[];
|
|
290
|
-
}
|
|
291
|
-
export declare function makePolicyEditCandidateRecord(edit: PolicyEdit): PolicyEditCandidateRecord;
|
|
292
|
-
/**
|
|
293
|
-
* Capability-headroom gate — "can this task set even SEE the capability
|
|
294
|
-
* you're about to A/B?"
|
|
295
|
-
*
|
|
296
|
-
* A capability A/B (grant one arm a tool, a skill, extra context — anything)
|
|
297
|
-
* can only detect the capability on tasks the capability-ABSENT baseline
|
|
298
|
-
* FAILS. A task the baseline already passes is saturated: the treatment arm
|
|
299
|
-
* has no headroom to demonstrate anything, and averaging saturated tasks into
|
|
300
|
-
* the comparison dilutes a real effect toward a false null. Calibrate before
|
|
301
|
-
* measuring: run the baseline arm first, classify every task's headroom, and
|
|
302
|
-
* refuse to run the comparison when no task has a gap.
|
|
303
|
-
*
|
|
304
|
-
* Fail-closed on unknown outcomes: a baseline run whose outcome could not be
|
|
305
|
-
* determined (infra loss, unverified, missing) NEVER counts as a failure —
|
|
306
|
-
* treating "couldn't tell" as "failed" would manufacture headroom out of
|
|
307
|
-
* telemetry gaps and launder infra noise into a treatment effect.
|
|
308
|
-
*
|
|
309
|
-
* Domain-free by construction: the capability under test never appears here.
|
|
310
|
-
* Callers decide what the baseline arm lacks; this module only classifies
|
|
311
|
-
* baseline outcomes per task.
|
|
312
|
-
*/
|
|
313
|
-
/** One baseline-arm (capability-absent) observation of one task. */
|
|
314
|
-
interface HeadroomInput {
|
|
315
|
-
/** Stable task identity; multiple rows per task are multiple baseline reps. */
|
|
316
|
-
taskId: string;
|
|
317
|
-
/** Baseline outcome. 'unknown' = the outcome could not be determined —
|
|
318
|
-
* distinct from 'fail' and never counted as one. */
|
|
319
|
-
baselineOutcome: 'pass' | 'fail' | 'unknown';
|
|
320
|
-
}
|
|
321
|
-
/** Headroom classification for one task.
|
|
322
|
-
* - 'gap': the baseline fails it — the comparison can see the capability here.
|
|
323
|
-
* - 'saturated': the baseline already passes it — no headroom.
|
|
324
|
-
* - 'unknown': every baseline outcome is unknown — fail-closed, not a gap. */
|
|
325
|
-
type HeadroomClass = 'gap' | 'saturated' | 'unknown';
|
|
326
|
-
interface TaskHeadroom {
|
|
327
|
-
taskId: string;
|
|
328
|
-
/** Total baseline observations for this task (known + unknown). */
|
|
329
|
-
n: number;
|
|
330
|
-
/** Observations with a known ('pass' | 'fail') outcome — the evidence the
|
|
331
|
-
* classification actually rests on. A large `n` with a small `nKnown`
|
|
332
|
-
* means the headroom verdict is thin, not well-replicated. */
|
|
333
|
-
nKnown: number;
|
|
334
|
-
/** Pass rate over KNOWN outcomes only; NaN when every outcome is unknown
|
|
335
|
-
* (no data ≠ measured zero). */
|
|
336
|
-
baselinePassRate: number;
|
|
337
|
-
headroom: HeadroomClass;
|
|
338
|
-
}
|
|
339
|
-
interface CapabilityHeadroomOptions {
|
|
340
|
-
/** A task counts as 'gap' when its baseline pass rate is ≤ this. Default 0
|
|
341
|
-
* (the baseline must fail every known rep). Must be in [0, 1) — a
|
|
342
|
-
* threshold of 1 would classify a fully-saturated task as a gap. */
|
|
343
|
-
keepThreshold?: number;
|
|
344
|
-
}
|
|
345
|
-
interface CapabilityHeadroomResult {
|
|
346
|
-
/** Per-task classification, sorted by `taskId`. */
|
|
347
|
-
tasks: TaskHeadroom[];
|
|
348
|
-
summary: {
|
|
349
|
-
tasksWithGap: number;
|
|
350
|
-
tasksSaturated: number;
|
|
351
|
-
tasksUnknown: number;
|
|
352
|
-
/** Total unknown-outcome reps across ALL tasks (including tasks that
|
|
353
|
-
* still classified via their known reps) — the size of the telemetry
|
|
354
|
-
* hole behind the classifications. */
|
|
355
|
-
repsUnknown: number;
|
|
356
|
-
};
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* Classify every task's baseline headroom from capability-absent baseline
|
|
360
|
-
* outcomes.
|
|
361
|
-
*
|
|
362
|
-
* A task is 'gap' when it has ≥ 1 known outcome and its pass rate over known
|
|
363
|
-
* outcomes is ≤ `keepThreshold`; 'saturated' when the rate exceeds the
|
|
364
|
-
* threshold; 'unknown' when every outcome is unknown. Unknown reps never
|
|
365
|
-
* count toward the rate in either direction (fail-closed — see the module
|
|
366
|
-
* doc), and evidence strength stays visible: each task reports `nKnown`
|
|
367
|
-
* alongside `n`, and the summary totals the unknown reps in `repsUnknown`.
|
|
368
|
-
* Throws on empty input, an out-of-range `keepThreshold`, or an
|
|
369
|
-
* unrecognized outcome value (rows are often projected from untyped records).
|
|
370
|
-
*/
|
|
371
|
-
export declare function capabilityHeadroom(rows: readonly HeadroomInput[], opts?: CapabilityHeadroomOptions): CapabilityHeadroomResult;
|
|
372
|
-
interface AssertCapabilityHeadroomOptions {
|
|
373
|
-
/** Minimum tasks classified 'gap' for the comparison to proceed. Default 1. */
|
|
374
|
-
minTasksWithGap?: number;
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* The go/no-go guard: throws when fewer than `minTasksWithGap` tasks have
|
|
378
|
-
* baseline headroom — i.e. the benchmark cannot see the capability, so any
|
|
379
|
-
* comparison run on it would measure noise. Call between the baseline
|
|
380
|
-
* calibration run and the treatment run.
|
|
381
|
-
*/
|
|
382
|
-
export declare function assertCapabilityHeadroom(result: CapabilityHeadroomResult, opts?: AssertCapabilityHeadroomOptions): void;
|
|
383
|
-
/**
|
|
384
|
-
* Cost tracker — token + USD accounting per scenario and per run.
|
|
385
|
-
*
|
|
386
|
-
* Adapted from generic usage-event accounting. Every
|
|
387
|
-
* optimizer needs to know "is the quality gain worth the cost delta?",
|
|
388
|
-
* and every dashboard needs dollars-per-completed-task. MODEL_PRICING
|
|
389
|
-
* from metrics.ts stays authoritative for estimate math; this module
|
|
390
|
-
* adds the aggregation + per-scenario roll-up that was duplicated
|
|
391
|
-
* across 4 verticals.
|
|
392
|
-
*/
|
|
393
|
-
interface TokenSpec {
|
|
394
|
-
inputTokens: number;
|
|
395
|
-
outputTokens: number;
|
|
396
|
-
cachedTokens?: number;
|
|
397
|
-
reasoningTokens?: number;
|
|
398
|
-
}
|
|
399
|
-
interface CostEntry extends TokenSpec {
|
|
400
|
-
scenarioId: string;
|
|
401
|
-
model: string;
|
|
402
|
-
/** Override estimate with an observed cost (e.g. from provider response). */
|
|
403
|
-
actualCostUsd?: number;
|
|
404
|
-
timestamp: number;
|
|
405
|
-
/** Free-form tags (variant id, round #, etc.). */
|
|
406
|
-
tags?: Record<string, string>;
|
|
407
|
-
}
|
|
408
|
-
interface ScenarioCost {
|
|
409
|
-
scenarioId: string;
|
|
410
|
-
entries: CostEntry[];
|
|
411
|
-
totalInputTokens: number;
|
|
412
|
-
totalOutputTokens: number;
|
|
413
|
-
totalCachedTokens: number;
|
|
414
|
-
totalCostUsd: number;
|
|
415
|
-
/** Pass flag — set by consumer via markOutcome; used for cost-per-completed-task. */
|
|
416
|
-
completed?: boolean;
|
|
417
|
-
}
|
|
418
|
-
export declare class CostTracker {
|
|
419
|
-
private byScenario;
|
|
420
|
-
record(entry: Omit<CostEntry, 'timestamp'> & {
|
|
421
|
-
timestamp?: number;
|
|
422
|
-
}): CostEntry;
|
|
423
|
-
markOutcome(scenarioId: string, completed: boolean): void;
|
|
424
|
-
/**
|
|
425
|
-
* Convenience: record + markOutcome in one call from a
|
|
426
|
-
* `{ usage, verdict }`-shaped response (starter-foundry's
|
|
427
|
-
* `invokeMetaJudge` returns this shape; consumers that wrap any
|
|
428
|
-
* judge/critic can follow the same convention).
|
|
429
|
-
*
|
|
430
|
-
* `usage.model` must be present in `MODEL_PRICING` for cost math to
|
|
431
|
-
* populate; otherwise totalCostUsd stays at 0 for the entry but
|
|
432
|
-
* tokens still aggregate.
|
|
433
|
-
*/
|
|
434
|
-
recordVerdict(verdict: {
|
|
435
|
-
usage?: {
|
|
436
|
-
inputTokens: number;
|
|
437
|
-
outputTokens: number;
|
|
438
|
-
model: string;
|
|
439
|
-
cachedTokens?: number;
|
|
440
|
-
reasoningTokens?: number;
|
|
441
|
-
};
|
|
442
|
-
verdict?: 'pass' | 'fail' | 'borderline' | string;
|
|
443
|
-
}, scenarioId: string, tags?: Record<string, string>): CostEntry | null;
|
|
444
|
-
get(scenarioId: string): ScenarioCost | undefined;
|
|
445
|
-
list(): ScenarioCost[];
|
|
446
|
-
summary(): CostSummary;
|
|
447
|
-
}
|
|
448
|
-
interface CostSummary {
|
|
449
|
-
scenarioCount: number;
|
|
450
|
-
completedCount: number;
|
|
451
|
-
totalInputTokens: number;
|
|
452
|
-
totalOutputTokens: number;
|
|
453
|
-
totalCostUsd: number;
|
|
454
|
-
avgCostPerScenarioUsd: number;
|
|
455
|
-
/** Total USD / completed scenarios — null when nothing completed. */
|
|
456
|
-
costPerCompletedTaskUsd: number | null;
|
|
457
|
-
}
|
|
458
|
-
type DetectorSeverity = 'info' | 'warn' | 'critical';
|
|
459
|
-
/** A normalized step a detector folds over. Fields are optional; each detector reads only what it
|
|
460
|
-
* needs (repeated-action → `actionFingerprint`; no-progress → `stateFingerprint` + `score`;
|
|
461
|
-
* error-streak → `status`). */
|
|
462
|
-
interface DetectorEvent {
|
|
463
|
-
/** Fingerprint of the action/tool-call this step took (caller pre-hashes). */
|
|
464
|
-
readonly actionFingerprint?: string;
|
|
465
|
-
/** Fingerprint of observable state AFTER this step. */
|
|
466
|
-
readonly stateFingerprint?: string;
|
|
467
|
-
/** Score after this step (the score-flat half of no-progress). */
|
|
468
|
-
readonly score?: number;
|
|
469
|
-
/** Whether this step errored. */
|
|
470
|
-
readonly status?: 'ok' | 'error';
|
|
471
|
-
/** Free-form label carried into the signal evidence (e.g. the tool name). */
|
|
472
|
-
readonly label?: string;
|
|
473
|
-
}
|
|
474
|
-
interface DetectorSignal {
|
|
475
|
-
readonly detector: string;
|
|
476
|
-
readonly severity: DetectorSeverity;
|
|
477
|
-
readonly failureClass?: FailureClass;
|
|
478
|
-
readonly reason: string;
|
|
479
|
-
/** Consecutive matching steps at the moment the signal fired. */
|
|
480
|
-
readonly streak: number;
|
|
481
|
-
readonly evidence?: Record<string, unknown>;
|
|
482
|
-
}
|
|
483
|
-
interface StreamingDetector {
|
|
484
|
-
readonly id: string;
|
|
485
|
-
/** Current streak (consecutive matching steps) — for telemetry/introspection between observes. */
|
|
486
|
-
readonly streak: number;
|
|
487
|
-
/** Fold one event; return a signal when the threshold trips, else null. */
|
|
488
|
-
observe(event: DetectorEvent): DetectorSignal | null;
|
|
489
|
-
/** Clear all state. */
|
|
490
|
-
reset(): void;
|
|
491
|
-
}
|
|
492
|
-
interface RepeatedActionOptions {
|
|
493
|
-
/** Signal once the same action fingerprint repeats this many CONSECUTIVE steps (default 3).
|
|
494
|
-
* `<= 0` disables the signal (the streak is still tracked, for telemetry). */
|
|
495
|
-
readonly maxRepeated?: number;
|
|
496
|
-
readonly severity?: DetectorSeverity;
|
|
497
|
-
/** Failure class to stamp on the signal (default `tool_recovery_failure`). */
|
|
498
|
-
readonly failureClass?: FailureClass;
|
|
499
|
-
}
|
|
500
|
-
/** Same action fingerprint N consecutive steps = a stuck loop (the #1 long-horizon failure mode). */
|
|
501
|
-
export declare function repeatedActionDetector(opts?: RepeatedActionOptions): StreamingDetector;
|
|
502
|
-
interface ErrorStreakOptions {
|
|
503
|
-
/** Signal once this many CONSECUTIVE steps errored (default 3). `<= 0` disables. */
|
|
504
|
-
readonly maxErrors?: number;
|
|
505
|
-
readonly severity?: DetectorSeverity;
|
|
506
|
-
readonly failureClass?: FailureClass;
|
|
507
|
-
}
|
|
508
|
-
/** N consecutive tool errors = the worker is hammering a broken approach. */
|
|
509
|
-
export declare function errorStreakDetector(opts?: ErrorStreakOptions): StreamingDetector;
|
|
510
|
-
/** Fold one event through many detectors at once; returns every signal that fired this step. The
|
|
511
|
-
* natural shape for an online pipe watching with a whole panel of detectors. */
|
|
512
|
-
export declare function observeAll(detectors: ReadonlyArray<StreamingDetector>, event: DetectorEvent): DetectorSignal[];
|
|
513
|
-
/**
|
|
514
|
-
* Toolchain error-count extractor.
|
|
515
|
-
*
|
|
516
|
-
* Given stderr/stdout from a compiler or test runner, count the number
|
|
517
|
-
* of reported errors/failures. Patterns are deliberately narrow —
|
|
518
|
-
* unknown stderr returns `null` rather than zero so callers can
|
|
519
|
-
* distinguish "no errors" from "different toolchain, couldn't parse".
|
|
520
|
-
*
|
|
521
|
-
* All patterns are anchored to the start of a line and use bounded
|
|
522
|
-
* character classes to avoid catastrophic backtracking on pathological
|
|
523
|
-
* inputs.
|
|
524
|
-
*
|
|
525
|
-
* Add new toolchains by appending to {@link ERROR_COUNT_PATTERNS};
|
|
526
|
-
* order matters only in the sense that the first matching pattern wins.
|
|
527
|
-
*/
|
|
528
|
-
interface ErrorCountPattern {
|
|
529
|
-
/** Stable identifier for logging + tests. */
|
|
530
|
-
name: string;
|
|
531
|
-
/** Must be global (`g` flag) — the extractor counts matches. */
|
|
532
|
-
regex: RegExp;
|
|
533
|
-
/** Optional post-processing to extract a count from a single captured match. */
|
|
534
|
-
transform?: (match: RegExpMatchArray) => number;
|
|
535
|
-
}
|
|
536
|
-
export declare const ERROR_COUNT_PATTERNS: ErrorCountPattern[];
|
|
537
|
-
interface ExtractOptions {
|
|
538
|
-
/** Restrict to named patterns — default: all patterns. */
|
|
539
|
-
only?: string[];
|
|
540
|
-
/** Additional patterns to consider BEFORE the built-in list. */
|
|
541
|
-
extra?: ErrorCountPattern[];
|
|
542
|
-
}
|
|
543
|
-
interface ExtractResult {
|
|
544
|
-
/** Total count of matched errors, or null when no pattern matched. */
|
|
545
|
-
count: number | null;
|
|
546
|
-
/** Name of the pattern that matched, or null. */
|
|
547
|
-
matched: string | null;
|
|
548
|
-
/** Original matches for callers that want to surface specifics. */
|
|
549
|
-
samples: string[];
|
|
550
|
-
}
|
|
551
|
-
/**
|
|
552
|
-
* Try each pattern in order; return the first with matches.
|
|
553
|
-
*
|
|
554
|
-
* Returning `null` (instead of zero) on no-match is deliberate — a
|
|
555
|
-
* callsite that greps for "typescript errors" on cargo output should
|
|
556
|
-
* NOT treat that as "zero TS errors" because the toolchain is wrong.
|
|
557
|
-
*/
|
|
558
|
-
export declare function extractErrorCount(text: string, opts?: ExtractOptions): ExtractResult;
|
|
559
|
-
type KnowledgeRequirementCategory = 'user_specific' | 'company_specific' | 'domain_specific' | 'codebase_specific' | 'market_specific' | 'regulatory' | 'tool_api' | 'credential_or_secret' | 'runtime_environment' | 'preference' | 'historical_context';
|
|
560
|
-
type KnowledgeAcquisitionMode = 'ask_user' | 'search_web' | 'query_connector' | 'inspect_repo' | 'run_command' | 'infer_low_confidence' | 'not_available';
|
|
561
|
-
type KnowledgeImportance = 'blocking' | 'high' | 'medium' | 'low';
|
|
562
|
-
type KnowledgeFreshness = 'static' | 'monthly' | 'weekly' | 'daily' | 'realtime';
|
|
563
|
-
type KnowledgeSensitivity = 'public' | 'private' | 'secret';
|
|
564
|
-
type KnowledgeFallbackPolicy = 'block' | 'ask' | 'continue_with_caveat' | 'use_default';
|
|
565
|
-
interface KnowledgeRequirement {
|
|
566
|
-
id: string;
|
|
567
|
-
description: string;
|
|
568
|
-
requiredFor: string[];
|
|
569
|
-
category: KnowledgeRequirementCategory;
|
|
570
|
-
acquisitionMode: KnowledgeAcquisitionMode;
|
|
571
|
-
importance: KnowledgeImportance;
|
|
572
|
-
freshness: KnowledgeFreshness;
|
|
573
|
-
sensitivity: KnowledgeSensitivity;
|
|
574
|
-
confidenceNeeded: number;
|
|
575
|
-
currentConfidence: number;
|
|
576
|
-
evidenceIds: string[];
|
|
577
|
-
fallbackPolicy: KnowledgeFallbackPolicy;
|
|
578
|
-
/**
|
|
579
|
-
* ISO timestamp after which this requirement must be treated as stale.
|
|
580
|
-
* Stale requirements score as missing even when they still have evidence.
|
|
581
|
-
*/
|
|
582
|
-
validUntil?: string;
|
|
583
|
-
/** ISO timestamp for the last source-grounding or human verification pass. */
|
|
584
|
-
lastVerifiedAt?: string;
|
|
585
|
-
metadata?: Record<string, unknown>;
|
|
586
|
-
}
|
|
587
|
-
interface KnowledgeBundle {
|
|
588
|
-
taskId: string;
|
|
589
|
-
requirements: KnowledgeRequirement[];
|
|
590
|
-
evidenceIds: string[];
|
|
591
|
-
claimIds: string[];
|
|
592
|
-
wikiPageIds: string[];
|
|
593
|
-
userAnswers: Record<string, string>;
|
|
594
|
-
missing: KnowledgeRequirement[];
|
|
595
|
-
readinessScore: number;
|
|
596
|
-
metadata?: Record<string, unknown>;
|
|
597
|
-
}
|
|
598
|
-
type KnowledgeRecommendedAction = 'run_agent' | 'ask_user' | 'collect_web_data' | 'query_connectors' | 'inspect_repo' | 'build_domain_wiki' | 'continue_with_caveat' | 'abort_or_rescope';
|
|
599
|
-
interface KnowledgeReadinessReport {
|
|
600
|
-
taskId: string;
|
|
601
|
-
readinessScore: number;
|
|
602
|
-
blockingMissingRequirements: KnowledgeRequirement[];
|
|
603
|
-
nonBlockingGaps: KnowledgeRequirement[];
|
|
604
|
-
recommendedAction: KnowledgeRecommendedAction;
|
|
605
|
-
bundle: KnowledgeBundle;
|
|
606
|
-
severity: ControlSeverity;
|
|
607
|
-
reason: string;
|
|
608
|
-
}
|
|
609
|
-
interface UserQuestion {
|
|
610
|
-
id: string;
|
|
611
|
-
question: string;
|
|
612
|
-
reason: string;
|
|
613
|
-
requirementId: string;
|
|
614
|
-
importance: KnowledgeImportance;
|
|
615
|
-
answerType: 'free_text' | 'select_one' | 'multi_select' | 'file_upload' | 'credential' | 'url';
|
|
616
|
-
defaultIfSkipped?: string;
|
|
617
|
-
impactIfUnknown: string;
|
|
618
|
-
options?: string[];
|
|
619
|
-
metadata?: Record<string, unknown>;
|
|
620
|
-
}
|
|
621
|
-
interface DataAcquisitionPlan {
|
|
622
|
-
id: string;
|
|
623
|
-
requirementIds: string[];
|
|
624
|
-
mode: Exclude<KnowledgeAcquisitionMode, 'not_available' | 'infer_low_confidence'> | 'build_domain_wiki';
|
|
625
|
-
description: string;
|
|
626
|
-
priority: KnowledgeImportance;
|
|
627
|
-
expectedEvidenceIds?: string[];
|
|
628
|
-
questions?: UserQuestion[];
|
|
629
|
-
metadata?: Record<string, unknown>;
|
|
630
|
-
}
|
|
631
|
-
interface LeaderboardRow {
|
|
632
|
-
/** Group key — the agent-profile cellId by default, else a caller dimension. */
|
|
633
|
-
key: string;
|
|
634
|
-
/** Display label: `harness · model` when the profile carries them, else the key. */
|
|
635
|
-
label: string;
|
|
636
|
-
harness?: string;
|
|
637
|
-
model?: string;
|
|
638
|
-
rank: number;
|
|
639
|
-
/** Measured runs in this group. */
|
|
640
|
-
n: number;
|
|
641
|
-
passRate: number;
|
|
642
|
-
passRateCi95: [number, number];
|
|
643
|
-
/** Observability rollup — means over the group; null when no run reported it. */
|
|
644
|
-
meanCostUsd: number | null;
|
|
645
|
-
meanTokensIn: number | null;
|
|
646
|
-
meanTokensOut: number | null;
|
|
647
|
-
meanWallMs: number | null;
|
|
648
|
-
}
|
|
649
|
-
interface LeaderboardOptions {
|
|
650
|
-
/** Per-run pass predicate — the benchmark defines what "passed" means (real-build
|
|
651
|
-
* hit-rate, test-pass, etc.). The leaderboard owns only the grouping + stats. */
|
|
652
|
-
passed: (record: RunRecord) => boolean;
|
|
653
|
-
/** Group key. Default: the agent-profile cellId (harness × model × dimensions),
|
|
654
|
-
* so persona/harness/model sweeps separate without parsing labels. */
|
|
655
|
-
groupBy?: (record: RunRecord) => string;
|
|
656
|
-
}
|
|
657
|
-
/**
|
|
658
|
-
* Group `records`, compute pass-rate + Wilson CI + cost/token/latency means per
|
|
659
|
-
* group, and rank by pass-rate (cost as the tiebreaker — cheaper wins a tie).
|
|
660
|
-
* Pure projection: no I/O, deterministic, safe to call on any RunRecord[].
|
|
661
|
-
*/
|
|
662
|
-
export declare function leaderboard(records: RunRecord[], opts: LeaderboardOptions): LeaderboardRow[];
|
|
663
|
-
interface PairedDeltaTestOptions extends PairedBootstrapOptions {
|
|
664
|
-
/** Smallest candidate-minus-baseline delta that counts as improvement. Default 0. */
|
|
665
|
-
threshold?: number;
|
|
666
|
-
/** Caller-required paired observations. The exact test may impose a higher minimum. */
|
|
667
|
-
minPairs?: number;
|
|
668
|
-
}
|
|
669
|
-
interface PairedDeltaTestResult {
|
|
670
|
-
bootstrap: PairedBootstrapResult;
|
|
671
|
-
method: 'bootstrap-ci' | 'exact-sign';
|
|
672
|
-
/** Exact one-sided p-value below the bootstrap minimum; otherwise null. */
|
|
673
|
-
pValue: number | null;
|
|
674
|
-
/** Effective observation minimum after accounting for confidence. */
|
|
675
|
-
minimumPairs: number;
|
|
676
|
-
sufficient: boolean;
|
|
677
|
-
/**
|
|
678
|
-
* The bootstrap interval has zero width (or is non-finite), so it carries no
|
|
679
|
-
* information about how far the estimate could be wrong and cannot support a
|
|
680
|
-
* decision in either direction. See {@link pairedDeltaTest}.
|
|
681
|
-
*/
|
|
682
|
-
indeterminate: boolean;
|
|
683
|
-
significant: boolean;
|
|
684
|
-
}
|
|
685
|
-
/** Smallest all-positive sample that can clear a one-sided exact sign test. */
|
|
686
|
-
export declare function minimumPairsForPairedDeltaTest(confidence?: number): number;
|
|
687
|
-
/**
|
|
688
|
-
* Tests whether a paired candidate-minus-baseline delta clears a threshold.
|
|
689
|
-
*
|
|
690
|
-
* At 20 or more pairs, the percentile bootstrap lower bound carries the
|
|
691
|
-
* decision. Below that point the interval is descriptive only, so the function
|
|
692
|
-
* switches to a pre-registered one-sided exact sign test. The exact path is
|
|
693
|
-
* deliberately conservative: it requires both a point estimate above the
|
|
694
|
-
* threshold and enough consistently positive paired differences.
|
|
695
|
-
*
|
|
696
|
-
* ## A zero-width interval is never significant
|
|
697
|
-
*
|
|
698
|
-
* When every paired delta is identical the resample distribution is a point
|
|
699
|
-
* mass and the interval collapses: `[0, 0]` when all pairs tie, `[g, g]` on n
|
|
700
|
-
* identical deltas of g. Neither says the effect is certain — both say the
|
|
701
|
-
* sample carries no information about how far the estimate could be wrong, and
|
|
702
|
-
* `low > threshold` then answers on the point estimate alone. It fails in both
|
|
703
|
-
* directions: `[0, 0]` clears every NEGATIVE threshold, which is how a
|
|
704
|
-
* tie-dominated pass/fail comparison laundered a regression into a
|
|
705
|
-
* noninferiority pass, and `[g, g]` clears every threshold below g with no
|
|
706
|
-
* spread behind it. Under a bounded asymmetric null whose true mean paired
|
|
707
|
-
* delta is exactly 0 — 2 % of pairs dropping by 1.0, the rest gaining 0.0204 —
|
|
708
|
-
* every sample that misses the drop is exactly that shape, and deciding on
|
|
709
|
-
* `low > 0` promoted 65.65 % of samples at n = 20 against a nominal 5 %.
|
|
710
|
-
*
|
|
711
|
-
* So `indeterminate` is reported and `significant` is false whenever the
|
|
712
|
-
* interval has zero width, on BOTH paths: at small n the exact sign test is a
|
|
713
|
-
* test of the MEDIAN and a zero-spread sample is precisely where it stops
|
|
714
|
-
* saying anything about the mean the caller is thresholding.
|
|
715
|
-
*
|
|
716
|
-
* `threshold` may be negative — that is a noninferiority margin, and it is the
|
|
717
|
-
* regime the zero-width hole is worst in. For a two-point (pass/fail) outcome
|
|
718
|
-
* the percentile bootstrap is not a valid interval at a nonzero margin at all;
|
|
719
|
-
* use {@link decidePairedPromotion}, which routes those to Tango's score
|
|
720
|
-
* interval, rather than thresholding this function's bootstrap directly.
|
|
721
|
-
*/
|
|
722
|
-
export declare function pairedDeltaTest(before: number[], after: number[], options?: PairedDeltaTestOptions): PairedDeltaTestResult;
|
|
723
|
-
/**
|
|
724
|
-
* Deterministic held-out partitioning over stable ids.
|
|
725
|
-
*
|
|
726
|
-
* A promotion gate's paired-delta math needs a fixed partition: the same
|
|
727
|
-
* scenario id lands in the same bucket forever, regardless of when it ran or
|
|
728
|
-
* which loop emitted the record — otherwise the gate has nothing paired to
|
|
729
|
-
* compare against. Picking one global split per run is wrong: every run then
|
|
730
|
-
* stamps either ALL search or ALL holdout, and no id is ever observed on both
|
|
731
|
-
* sides. Per-id deterministic hashing fixes that.
|
|
732
|
-
*
|
|
733
|
-
* Two consumers hand-roll this (agent-builder's `deterministicSplit` and the
|
|
734
|
-
* frontier persona-splitter). The substrate already has a 3-way benchmark
|
|
735
|
-
* `deterministicSplit` in `./benchmarks`; this is the generic, validated batch
|
|
736
|
-
* partitioner: it takes a list of ids, splits them by a stable FNV-1a hash, and
|
|
737
|
-
* fails loud when the inputs can't support a trustworthy held-out comparison
|
|
738
|
-
* (duplicate ids, or a holdout set below the significance floor).
|
|
739
|
-
*/
|
|
740
|
-
interface PartitionHeldOutOptions {
|
|
741
|
-
/** Partition seed. Bumping it reshuffles every assignment — do that only when
|
|
742
|
-
* the corpus/policy changes meaningfully so old and new records can't pair.
|
|
743
|
-
* Default 'held-out-v1'. */
|
|
744
|
-
seed?: string;
|
|
745
|
-
/** Fraction routed to the held-out bucket, in (0, 1). Default 0.5. */
|
|
746
|
-
holdoutFraction?: number;
|
|
747
|
-
/**
|
|
748
|
-
* Minimum held-out ids required for the split to be admissible. Below this,
|
|
749
|
-
* a paired comparison has too few observations to be significant, so the
|
|
750
|
-
* partition throws rather than hand back an underpowered holdout. Default 1
|
|
751
|
-
* (only the empty-holdout degenerate case is rejected). Raise it to enforce
|
|
752
|
-
* real statistical power. */
|
|
753
|
-
minHoldout?: number;
|
|
754
|
-
/** Same floor for the search side. Default 1. */
|
|
755
|
-
minSearch?: number;
|
|
756
|
-
}
|
|
757
|
-
interface HeldOutPartition {
|
|
758
|
-
/** Ids the optimizer is allowed to read/optimize against. */
|
|
759
|
-
search: string[];
|
|
760
|
-
/** Ids reserved for gated, held-out evaluation. */
|
|
761
|
-
holdout: string[];
|
|
762
|
-
seed: string;
|
|
763
|
-
holdoutFraction: number;
|
|
764
|
-
}
|
|
765
|
-
/**
|
|
766
|
-
* Partition a list of stable ids into disjoint `search` / `holdout` sets by a
|
|
767
|
-
* deterministic hash. Fail-loud:
|
|
768
|
-
* - empty input throws,
|
|
769
|
-
* - duplicate ids throw (a dup would be observed on both sides, double-counting),
|
|
770
|
-
* - a holdout (or search) set below its floor throws (underpowered comparison).
|
|
771
|
-
*
|
|
772
|
-
* Order within each bucket follows the input order, so the result is stable and
|
|
773
|
-
* reproducible.
|
|
774
|
-
*/
|
|
775
|
-
export declare function partitionHeldOut(ids: string[], options?: PartitionHeldOutOptions): HeldOutPartition;
|
|
776
|
-
interface TrainSelectionTestOptions<T> {
|
|
777
|
-
/** Partition seed. Bumping it reshuffles every unit. Default 'train-selection-test-v1'. */
|
|
778
|
-
seed?: string;
|
|
779
|
-
/** Share of units routed to selection, in (0, 1). Default 0.25. */
|
|
780
|
-
selectionFraction?: number;
|
|
781
|
-
/** Share of units routed to test, in (0, 1). Default 0.25. */
|
|
782
|
-
testFraction?: number;
|
|
783
|
-
/**
|
|
784
|
-
* The independent unit an item samples, such as the task a fresh run repeats.
|
|
785
|
-
* Every item of one unit lands in the same partition, so a final test never
|
|
786
|
-
* scores a unit the optimizer read. Default: the item id.
|
|
787
|
-
*/
|
|
788
|
-
unitOf?: (item: T) => string;
|
|
789
|
-
/** Minimum items per partition. Defaults 1, 1 and 1. */
|
|
790
|
-
minTrain?: number;
|
|
791
|
-
minSelection?: number;
|
|
792
|
-
minTest?: number;
|
|
793
|
-
}
|
|
794
|
-
interface TrainSelectionTestPartition<T> {
|
|
795
|
-
/** Items an optimizer may learn from. */
|
|
796
|
-
train: T[];
|
|
797
|
-
/** Items an optimizer may use to accept candidates and stop. */
|
|
798
|
-
selection: T[];
|
|
799
|
-
/** Items reserved for the final comparison. */
|
|
800
|
-
test: T[];
|
|
801
|
-
seed: string;
|
|
802
|
-
selectionFraction: number;
|
|
803
|
-
testFraction: number;
|
|
804
|
-
}
|
|
805
|
-
interface ProductBenchmarkExportOptions {
|
|
806
|
-
/** Source eval run directories, each containing a `records.jsonl` of RunRecord rows. */
|
|
807
|
-
readonly runDirs: readonly string[];
|
|
808
|
-
/** Destination directory for the bundle (manifest + records + materialized source runs). */
|
|
809
|
-
readonly outDir: string;
|
|
810
|
-
readonly projectId: string;
|
|
811
|
-
readonly benchmarkId: string;
|
|
812
|
-
/** Repo-relative path of the product's canonical agent profile source. */
|
|
813
|
-
readonly agentProfilePath: string;
|
|
814
|
-
/** Pass threshold applied when a row carries no explicit `outcome.raw.pass`. Default 0.7. */
|
|
815
|
-
readonly passThreshold?: number;
|
|
816
|
-
/**
|
|
817
|
-
* First scenario tag. Defaults to `projectId` with a trailing `-agent`
|
|
818
|
-
* stripped (`tax-agent` → `tax`), matching the product exporters.
|
|
819
|
-
*/
|
|
820
|
-
readonly scenarioTagPrefix?: string;
|
|
821
|
-
/** Profile id used when a row has no `agentProfile.profileId`. Defaults to the row's arm id. */
|
|
822
|
-
readonly fallbackProfileId?: string;
|
|
823
|
-
/** Arm mutable surfaces recorded in the manifest. Defaults to the full superset. */
|
|
824
|
-
readonly mutableSurfaces?: readonly string[];
|
|
825
|
-
/**
|
|
826
|
-
* Copy each run dir into `<outDir>/source-runs/` and record
|
|
827
|
-
* bundle-relative artifact paths (portable, self-contained). When false,
|
|
828
|
-
* artifacts keep absolute paths into the original run dirs. Default true.
|
|
829
|
-
*/
|
|
830
|
-
readonly materializeSourceRuns?: boolean;
|
|
831
|
-
/**
|
|
832
|
-
* Override split classification for a row. Return undefined to fall back
|
|
833
|
-
* to the default (`outcome.raw.safety === 1` → safety, then splitTag).
|
|
834
|
-
*/
|
|
835
|
-
readonly classifySplit?: (record: RunRecord) => ProductBenchmarkSplit | undefined;
|
|
836
|
-
/** Recovers a tool-call count when the row's raw bag carries none (e.g. from turn artifacts). */
|
|
837
|
-
readonly toolCallFallback?: (record: RunRecord, runDir: string) => number;
|
|
838
|
-
/** Backend version recorded per row. Defaults to the cwd package.json's `@tangle-network/sandbox` range. */
|
|
839
|
-
readonly backendVersion?: string;
|
|
840
|
-
/**
|
|
841
|
-
* Explicit substrate versions for the manifest, merged over what the cwd
|
|
842
|
-
* package.json / node_modules resolve. Use when a substrate package is not
|
|
843
|
-
* installed where the export runs — the validator refuses an `'unknown'`
|
|
844
|
-
* version, so provide the real one rather than shipping the sentinel.
|
|
845
|
-
*/
|
|
846
|
-
readonly substrate?: Partial<ProductBenchmarkManifest['substrate']>;
|
|
847
|
-
}
|
|
848
|
-
interface ProductBenchmarkSingleRunExportOptions extends Omit<ProductBenchmarkExportOptions, 'runDirs'> {
|
|
849
|
-
readonly runDir: string;
|
|
850
|
-
}
|
|
851
|
-
interface ProductBenchmarkExportResult {
|
|
852
|
-
readonly manifestPath: string;
|
|
853
|
-
readonly recordsPath: string;
|
|
854
|
-
readonly records: number;
|
|
855
|
-
}
|
|
856
|
-
/** Repo identity from the exporting process's cwd. `'unknown'` values are flagged by `validateProductBenchmarkRun`. */
|
|
857
|
-
export declare function productBenchmarkRepoIdentity(): ProductBenchmarkManifest['repo'];
|
|
858
|
-
/** Single-run convenience wrapper over `exportProductBenchmarkRuns`. */
|
|
859
|
-
export declare function exportProductBenchmark(options: ProductBenchmarkSingleRunExportOptions): ProductBenchmarkExportResult;
|
|
860
|
-
/**
|
|
861
|
-
* Export one or more product eval run dirs into a validated product
|
|
862
|
-
* benchmark bundle at `outDir`. Both the manifest and every record are
|
|
863
|
-
* run through the contract validators before anything is written.
|
|
864
|
-
*/
|
|
865
|
-
export declare function exportProductBenchmarkRuns(options: ProductBenchmarkExportOptions): ProductBenchmarkExportResult;
|
|
866
|
-
declare const productBenchmarkSplits: readonly ["practice", "dev", "holdout", "safety", "sentinel"];
|
|
867
|
-
type ProductBenchmarkSplit = (typeof productBenchmarkSplits)[number];
|
|
868
|
-
interface ProductBenchmarkRepoRef {
|
|
869
|
-
readonly url: string;
|
|
870
|
-
readonly commit: string;
|
|
871
|
-
readonly branch: string;
|
|
872
|
-
}
|
|
873
|
-
interface ProductBenchmarkSubstrateVersions {
|
|
874
|
-
readonly agentEval: string;
|
|
875
|
-
readonly agentRuntime: string;
|
|
876
|
-
readonly agentInterface: string;
|
|
877
|
-
readonly sandbox: string;
|
|
878
|
-
readonly agentBench?: string;
|
|
879
|
-
}
|
|
880
|
-
interface ProductBenchmarkProfileRef {
|
|
881
|
-
readonly id: string;
|
|
882
|
-
readonly profileHash: string;
|
|
883
|
-
readonly agentProfilePath: string;
|
|
884
|
-
}
|
|
885
|
-
interface ProductBenchmarkArm {
|
|
886
|
-
readonly id: string;
|
|
887
|
-
readonly profileId: string;
|
|
888
|
-
readonly mutableSurfaces: readonly string[];
|
|
889
|
-
readonly policyAxes: Record<string, unknown>;
|
|
890
|
-
}
|
|
891
|
-
interface ProductBenchmarkScenario {
|
|
892
|
-
readonly id: string;
|
|
893
|
-
readonly split: ProductBenchmarkSplit;
|
|
894
|
-
readonly tags: readonly string[];
|
|
895
|
-
readonly sourceAllowedForSynthesis: boolean;
|
|
896
|
-
}
|
|
897
|
-
interface ProductBenchmarkBudgets {
|
|
898
|
-
readonly maxUsd: number;
|
|
899
|
-
readonly maxCells: number;
|
|
900
|
-
readonly maxWallMs: number;
|
|
901
|
-
}
|
|
902
|
-
interface ProductBenchmarkManifest {
|
|
903
|
-
readonly schemaVersion: 1;
|
|
904
|
-
readonly projectId: string;
|
|
905
|
-
readonly benchmarkId: string;
|
|
906
|
-
readonly repo: ProductBenchmarkRepoRef;
|
|
907
|
-
readonly substrate: ProductBenchmarkSubstrateVersions;
|
|
908
|
-
readonly profiles: readonly ProductBenchmarkProfileRef[];
|
|
909
|
-
readonly arms: readonly ProductBenchmarkArm[];
|
|
910
|
-
readonly scenarios: readonly ProductBenchmarkScenario[];
|
|
911
|
-
readonly budgets: ProductBenchmarkBudgets;
|
|
912
|
-
readonly expectedArtifactDir: string;
|
|
913
|
-
}
|
|
914
|
-
interface ProductBenchmarkValidationReport {
|
|
915
|
-
readonly manifestPath: string;
|
|
916
|
-
readonly recordsPath: string;
|
|
917
|
-
readonly records: number;
|
|
918
|
-
/** Manifest repo fields that are empty or the `'unknown'` export sentinel. */
|
|
919
|
-
readonly repoFailures: readonly string[];
|
|
920
|
-
/** Manifest substrate versions that are empty or the `'unknown'` export
|
|
921
|
-
* sentinel — a bundle without substrate identity is not reproducible. */
|
|
922
|
-
readonly substrateFailures: readonly string[];
|
|
923
|
-
readonly projects: readonly string[];
|
|
924
|
-
readonly benchmarks: readonly string[];
|
|
925
|
-
readonly arms: readonly string[];
|
|
926
|
-
readonly scenarios: readonly string[];
|
|
927
|
-
readonly passed: number;
|
|
928
|
-
readonly failed: number;
|
|
929
|
-
readonly inputTokens: number;
|
|
930
|
-
readonly outputTokens: number;
|
|
931
|
-
readonly costUsd: number;
|
|
932
|
-
readonly wallMs: number;
|
|
933
|
-
readonly integrityFailures: readonly string[];
|
|
934
|
-
readonly missingArtifacts: readonly string[];
|
|
935
|
-
}
|
|
936
|
-
export declare function readProductBenchmarkManifest(path: string): ProductBenchmarkManifest;
|
|
937
|
-
/**
|
|
938
|
-
* Fail-loud gate over a bundle directory: locates the manifest + records,
|
|
939
|
-
* runs `validateProductBenchmarkRun`, and throws with every repo,
|
|
940
|
-
* integrity, and artifact failure listed. Returns the report when clean.
|
|
941
|
-
*/
|
|
942
|
-
export declare function assertProductBenchmarkRun(runDir: string): ProductBenchmarkValidationReport;
|
|
943
|
-
interface RuntimeTrajectoryHookEvent {
|
|
944
|
-
id: string;
|
|
945
|
-
runId: string;
|
|
946
|
-
scenarioId?: string;
|
|
947
|
-
target: string;
|
|
948
|
-
phase: string;
|
|
949
|
-
timestamp: number;
|
|
950
|
-
stepIndex?: number;
|
|
951
|
-
parentId?: string;
|
|
952
|
-
payload?: unknown;
|
|
953
|
-
metadata?: Record<string, unknown>;
|
|
954
|
-
}
|
|
955
|
-
interface RuntimeTrajectoryRecord {
|
|
956
|
-
id?: string;
|
|
957
|
-
scenarioId?: string;
|
|
958
|
-
splitTag?: RunSplitTag;
|
|
959
|
-
runtimeEvents?: unknown;
|
|
960
|
-
[key: string]: unknown;
|
|
961
|
-
}
|
|
962
|
-
interface RuntimeTrajectoryRunRecord {
|
|
963
|
-
runId: string;
|
|
964
|
-
scenarioId?: string;
|
|
965
|
-
splitTag: RunSplitTag;
|
|
966
|
-
}
|
|
967
|
-
interface RuntimeTrajectoryEvidenceSummary {
|
|
968
|
-
recordCount: number;
|
|
969
|
-
recordWithRuntimeEventsCount: number;
|
|
970
|
-
runtimeRunCount: number;
|
|
971
|
-
lifecycleEventCount: number;
|
|
972
|
-
defaultedSplitCount: number;
|
|
973
|
-
}
|
|
974
|
-
interface RuntimeTrajectoryEvidenceProjection {
|
|
975
|
-
runs: RuntimeTrajectoryRunRecord[];
|
|
976
|
-
events: RuntimeTrajectoryHookEvent[];
|
|
977
|
-
summary: RuntimeTrajectoryEvidenceSummary;
|
|
978
|
-
diagnostics: string[];
|
|
979
|
-
}
|
|
980
|
-
interface ProjectRuntimeTrajectoryEvidenceOptions<TRecord extends RuntimeTrajectoryRecord = RuntimeTrajectoryRecord> {
|
|
981
|
-
records: TRecord[];
|
|
982
|
-
defaultSplitTag?: RunSplitTag;
|
|
983
|
-
recordIdOf?: (record: TRecord, index: number) => string | undefined;
|
|
984
|
-
scenarioIdOf?: (record: TRecord, index: number) => string | undefined;
|
|
985
|
-
}
|
|
986
|
-
export declare function projectRuntimeTrajectoryEvidence<TRecord extends RuntimeTrajectoryRecord>(options: ProjectRuntimeTrajectoryEvidenceOptions<TRecord>): RuntimeTrajectoryEvidenceProjection;
|
|
987
|
-
type SynthesisReason = 'high-variance' | 'undersampled' | 'failure-cluster' | 'difficulty-gap';
|
|
988
|
-
interface SynthesisTarget {
|
|
989
|
-
reason: SynthesisReason;
|
|
990
|
-
description: string;
|
|
991
|
-
/** Existing scenarios that are closest to the gap; caller feeds these to
|
|
992
|
-
* their LLM proposer as few-shot examples. */
|
|
993
|
-
neighbors: DatasetScenario[];
|
|
994
|
-
/** Suggested direction — e.g. "harder variants", "edge cases of X", "failure class Y". */
|
|
995
|
-
direction: string;
|
|
996
|
-
/** Priority score — higher = more information-dense gap. 0..1. */
|
|
997
|
-
priority: number;
|
|
998
|
-
}
|
|
999
|
-
interface ActiveLearningOptions {
|
|
1000
|
-
/** Minimum scenarios per difficulty band to count as "covered". */
|
|
1001
|
-
minPerBand?: number;
|
|
1002
|
-
/** Variance threshold above which a scenario's dimension is "unstable". */
|
|
1003
|
-
varianceThreshold?: number;
|
|
1004
|
-
/** Max synthesis targets returned. */
|
|
1005
|
-
topK?: number;
|
|
1006
|
-
}
|
|
1007
|
-
export declare function proposeSynthesisTargets(dataset: Dataset, traceStore: TraceStore, options?: ActiveLearningOptions): Promise<SynthesisTarget[]>;
|
|
1008
|
-
/**
|
|
1009
|
-
* `runBoundedProcess` — run one command under a wall-clock bound and return
|
|
1010
|
-
* what it produced, leaving no descendant behind.
|
|
1011
|
-
*
|
|
1012
|
-
* The child leads its own process group (`detached` on every non-win32
|
|
1013
|
-
* platform), so a deadline or an abort kills the group with
|
|
1014
|
-
* `process.kill(-pid, 'SIGKILL')` rather than only the shell that was
|
|
1015
|
-
* spawned. That distinction is the whole point of this module: `sh -c
|
|
1016
|
-
* 'solver & wait'` puts the real work in a grandchild, and a kill aimed at
|
|
1017
|
-
* the shell alone leaves that grandchild running, holding the stdout and
|
|
1018
|
-
* stderr pipes open. `close` then never fires, so the deadline produces no
|
|
1019
|
-
* result the caller can observe and the descendant outlives the run.
|
|
1020
|
-
*
|
|
1021
|
-
* Two further guarantees the caller depends on:
|
|
1022
|
-
*
|
|
1023
|
-
* - A killed run never reports success. A SIGKILLed child can still close
|
|
1024
|
-
* with exit code 0, so a run killed by the deadline or by an abort has
|
|
1025
|
-
* its exit code forced non-zero.
|
|
1026
|
-
* - A run always resolves. If a grandchild escaped the group and still
|
|
1027
|
-
* holds the pipes, the result is delivered {@link KILL_DRAIN_MS} after
|
|
1028
|
-
* the kill instead of waiting on a `close` that will not come.
|
|
1029
|
-
*
|
|
1030
|
-
* The captured output is bounded. Once the cap is reached the streams are
|
|
1031
|
-
* still drained — the child needs its pipes read to reach `close` — but the
|
|
1032
|
-
* bytes are discarded and `outputTruncated` is set.
|
|
1033
|
-
*/
|
|
1034
|
-
/** Wall-clock bound applied when the caller names none. */
|
|
1035
|
-
export declare const DEFAULT_BOUNDED_PROCESS_TIMEOUT_MS: number;
|
|
1036
|
-
interface BoundedProcessInput {
|
|
1037
|
-
/**
|
|
1038
|
-
* The command line, interpreted by a shell unless `shell` is `false`. When
|
|
1039
|
-
* {@link BoundedProcessInput.args} is present this is a program path
|
|
1040
|
-
* instead, and no shell reads it.
|
|
1041
|
-
*/
|
|
1042
|
-
command: string;
|
|
1043
|
-
/**
|
|
1044
|
-
* Argument vector for `command`, delivered to the program as separate
|
|
1045
|
-
* argv entries with no shell between them.
|
|
1046
|
-
*
|
|
1047
|
-
* This is the form to use whenever an argument carries text the caller did
|
|
1048
|
-
* not author — a script body, a path, a pattern. Without it, `interpreter
|
|
1049
|
-
* -flag <script>` can only be expressed by quoting the script into a
|
|
1050
|
-
* shell string, and a quoting bug there is a command injection rather than
|
|
1051
|
-
* a wrong answer. Each entry arrives verbatim, so there is nothing to
|
|
1052
|
-
* quote: `{ command: 'bash', args: ['-n', '-c', body] }` parses `body`
|
|
1053
|
-
* whatever shell metacharacters it holds.
|
|
1054
|
-
*
|
|
1055
|
-
* Two limits are the platform's, not this module's. A NUL byte in an entry
|
|
1056
|
-
* cannot be passed to a process at all, and is reported as a `runnerError`
|
|
1057
|
-
* rather than thrown. A lone surrogate is encoded to UTF-8 as U+FFFD, and a
|
|
1058
|
-
* non-string entry from an untypechecked caller is coerced with `String()`,
|
|
1059
|
-
* so an entry is verbatim exactly when it is a string a UTF-8 argv can hold.
|
|
1060
|
-
*
|
|
1061
|
-
* A shell cannot interpret an argument vector, so `args` and a truthy
|
|
1062
|
-
* `shell` are contradictory. Passing both spawns nothing and reports
|
|
1063
|
-
* `runnerError`.
|
|
1064
|
-
*/
|
|
1065
|
-
args?: string[];
|
|
1066
|
-
/**
|
|
1067
|
-
* Text written to the child's standard input. The stream is closed after
|
|
1068
|
-
* the write, so a command that reads until end-of-file sees exactly this
|
|
1069
|
-
* payload and then EOF.
|
|
1070
|
-
*
|
|
1071
|
-
* The child's stdin is closed whether or not this field is present. A pipe
|
|
1072
|
-
* nobody closes is a hang: a command that reads stdin waits for bytes that
|
|
1073
|
-
* never arrive until the deadline kills it, which reads downstream as a
|
|
1074
|
-
* slow command rather than as a caller that forgot to send input.
|
|
1075
|
-
*
|
|
1076
|
-
* The payload is written as UTF-8 and is otherwise verbatim: a NUL byte,
|
|
1077
|
-
* a newline, a quote and a backslash all arrive as themselves, because
|
|
1078
|
-
* nothing parses this text. The one platform limit is the one `args`
|
|
1079
|
-
* already states — a lone surrogate is encoded as U+FFFD, since no UTF-8
|
|
1080
|
-
* stream can carry it.
|
|
1081
|
-
*
|
|
1082
|
-
* A child that exits before reading breaks the pipe. That is the child's
|
|
1083
|
-
* behaviour, not a runner failure, so the run still settles on the child's
|
|
1084
|
-
* own exit code, and the undelivered payload is reported in `runnerError`
|
|
1085
|
-
* with the `stdin not delivered:` prefix. Whether a SMALL payload to a
|
|
1086
|
-
* command that ignores stdin reports this is a race — the write may land in
|
|
1087
|
-
* the pipe buffer before the child exits — so the flag is a statement about
|
|
1088
|
-
* delivery, never about the command. It is not a race for the case that
|
|
1089
|
-
* matters: a payload larger than the pipe buffer that the child never
|
|
1090
|
-
* drains cannot be delivered, and reports every time.
|
|
1091
|
-
*/
|
|
1092
|
-
stdin?: string;
|
|
1093
|
-
/**
|
|
1094
|
-
* Shell that interprets `command`. `true` (the default) uses the platform
|
|
1095
|
-
* default — `/bin/sh` on POSIX, `cmd.exe` on Windows. A string names the
|
|
1096
|
-
* shell binary, e.g. `'bash'`, which is required for a bash-only construct
|
|
1097
|
-
* such as `[[ ]]` or `$BASH_VERSION`. `false` executes `command` directly
|
|
1098
|
-
* as a program path with no arguments. Ignored — and refused when truthy —
|
|
1099
|
-
* once {@link BoundedProcessInput.args} is present.
|
|
1100
|
-
*/
|
|
1101
|
-
shell?: boolean | string;
|
|
1102
|
-
/** Working directory. The parent's cwd is inherited when omitted. */
|
|
1103
|
-
cwd?: string;
|
|
1104
|
-
/**
|
|
1105
|
-
* Environment for the child. How it combines with the parent environment
|
|
1106
|
-
* is decided by {@link BoundedProcessInput.envMode}.
|
|
1107
|
-
*/
|
|
1108
|
-
env?: NodeJS.ProcessEnv;
|
|
1109
|
-
/**
|
|
1110
|
-
* `'merge'` (the default) layers `env` on top of `process.env`, so the
|
|
1111
|
-
* child sees every variable this process has plus the named ones.
|
|
1112
|
-
* `'replace'` passes exactly `env` and nothing else, which is what a
|
|
1113
|
-
* grader needs when the claim under test is about the variables the
|
|
1114
|
-
* command could read. `PATH` is not re-added under `'replace'`, and a
|
|
1115
|
-
* command that must find a binary on `PATH` names `PATH` itself.
|
|
1116
|
-
*
|
|
1117
|
-
* With no `PATH` in the child environment the two forms do NOT search the
|
|
1118
|
-
* same directories, so a caller under `'replace'` that names no `PATH` gets
|
|
1119
|
-
* a resolution that depends on which form it picked. The shell form execs
|
|
1120
|
-
* the shell, which applies its own compiled-in default; the argv form
|
|
1121
|
-
* reaches `execvp`, which falls back to `confstr(_CS_PATH)`. Measured on
|
|
1122
|
-
* Linux/glibc: `/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`
|
|
1123
|
-
* against `/bin:/usr/bin`, so a binary in `/usr/local/bin` resolves on the
|
|
1124
|
-
* shell form and reports ENOENT on the argv form. Name `PATH` and both
|
|
1125
|
-
* forms search exactly what was named.
|
|
1126
|
-
*/
|
|
1127
|
-
envMode?: 'merge' | 'replace';
|
|
1128
|
-
/** Wall-clock bound in ms. Defaults to 10 minutes. */
|
|
1129
|
-
timeoutMs?: number;
|
|
1130
|
-
/**
|
|
1131
|
-
* Cap on captured stdout+stderr. Reaching it truncates the captured text
|
|
1132
|
-
* and sets `outputTruncated`; it never kills the process. Defaults to
|
|
1133
|
-
* 16 MiB.
|
|
1134
|
-
*/
|
|
1135
|
-
maxOutputBytes?: number;
|
|
1136
|
-
/**
|
|
1137
|
-
* Kills the process group when it aborts, the same way the deadline does.
|
|
1138
|
-
* A signal that is already aborted when `runBoundedProcess` is called
|
|
1139
|
-
* prevents the spawn entirely — nothing runs.
|
|
1140
|
-
*/
|
|
1141
|
-
signal?: AbortSignal;
|
|
1142
|
-
}
|
|
1143
|
-
interface BoundedProcessResult {
|
|
1144
|
-
/**
|
|
1145
|
-
* The process actually started. False when nothing ran at all: an
|
|
1146
|
-
* already-aborted signal, `args` with a truthy `shell`, an argument the
|
|
1147
|
-
* platform refuses, or a program that does not exist.
|
|
1148
|
-
*
|
|
1149
|
-
* This is the field to branch on, never the text of `runnerError`. A caller
|
|
1150
|
-
* deciding whether a run produced an outcome at all is asking exactly this,
|
|
1151
|
-
* and asking it here is type-checked rather than held by a wording
|
|
1152
|
-
* convention.
|
|
1153
|
-
*/
|
|
1154
|
-
spawned: boolean;
|
|
1155
|
-
/**
|
|
1156
|
-
* The `stdin` payload reached the child in full. True whenever the caller
|
|
1157
|
-
* supplied none, because nothing could fail to arrive.
|
|
1158
|
-
*
|
|
1159
|
-
* False means the command ran on partial input, which is a fact about the
|
|
1160
|
-
* answer it produced: a checksum over a truncated payload is a wrong answer,
|
|
1161
|
-
* not a failed run. `spawned` stays true and `exitCode` stays the child's.
|
|
1162
|
-
*/
|
|
1163
|
-
stdinDelivered: boolean;
|
|
1164
|
-
/**
|
|
1165
|
-
* Exit code. Forced non-zero whenever `killedByTimeout` or
|
|
1166
|
-
* `killedBySignal` is set, because a SIGKILLed child can close with 0 and
|
|
1167
|
-
* a killed run must never read as a pass.
|
|
1168
|
-
*/
|
|
1169
|
-
exitCode: number;
|
|
1170
|
-
/** Captured stdout, truncated at `maxOutputBytes`. */
|
|
1171
|
-
stdout: string;
|
|
1172
|
-
/**
|
|
1173
|
-
* Captured stderr, truncated at `maxOutputBytes`. A runner-side failure is
|
|
1174
|
-
* reported in `runnerError`, not appended here; the caller decides whether
|
|
1175
|
-
* the command's own stderr and the runner's diagnosis belong together.
|
|
1176
|
-
*/
|
|
1177
|
-
stderr: string;
|
|
1178
|
-
/** Wall-clock duration in ms, measured across the whole call. */
|
|
1179
|
-
wallMs: number;
|
|
1180
|
-
/** The wall-clock bound was reached and the process group was killed. */
|
|
1181
|
-
killedByTimeout: boolean;
|
|
1182
|
-
/** `signal` aborted and the process group was killed. */
|
|
1183
|
-
killedBySignal: boolean;
|
|
1184
|
-
/** `maxOutputBytes` was reached and later output was discarded. */
|
|
1185
|
-
outputTruncated: boolean;
|
|
1186
|
-
/**
|
|
1187
|
-
* Human-readable diagnosis of a runner-side failure, in one of three shapes:
|
|
1188
|
-
*
|
|
1189
|
-
* - `not spawned:` — the caller's own bug, such as `args` with a truthy
|
|
1190
|
-
* `shell`, or an already-aborted signal. No retry helps.
|
|
1191
|
-
* - `stdin not delivered:` — the command ran and exited on its own, and
|
|
1192
|
-
* the stdin payload did not reach it in full because the child closed
|
|
1193
|
-
* the pipe first.
|
|
1194
|
-
* - anything else — the process could not be spawned (a missing binary, a
|
|
1195
|
-
* NUL byte in an argument).
|
|
1196
|
-
*
|
|
1197
|
-
* Absent when the command ran and read everything it was sent, however it
|
|
1198
|
-
* exited. The prefixes are for a person reading a log; code reads `spawned`
|
|
1199
|
-
* and `stdinDelivered`, which say the same things and are type-checked.
|
|
1200
|
-
*/
|
|
1201
|
-
runnerError?: string;
|
|
1202
|
-
}
|
|
1203
|
-
export declare function runBoundedProcess(input: BoundedProcessInput): Promise<BoundedProcessResult>;
|
|
1204
|
-
/**
|
|
1205
|
-
* CommandRunner — abstract subprocess execution surface.
|
|
1206
|
-
*
|
|
1207
|
-
* Layers in a {@link MultiLayerVerifier} that need to invoke external
|
|
1208
|
-
* tools (compilers, test runners, package managers) call out via this
|
|
1209
|
-
* interface rather than directly using `child_process`. Two reasons:
|
|
1210
|
-
*
|
|
1211
|
-
* 1. **Sandbox interchangeability.** A run that targets a sandbox box
|
|
1212
|
-
* (via SDK-specific Box.exec) and a run that targets the host both
|
|
1213
|
-
* satisfy this same contract. The harness doesn't care which.
|
|
1214
|
-
* 2. **Testability.** Tests inject a fake runner and assert on calls
|
|
1215
|
-
* without spawning real subprocesses.
|
|
1216
|
-
*
|
|
1217
|
-
* agent-eval ships only the local implementation (host-process). Sandbox
|
|
1218
|
-
* implementations live with their consumer because they depend on
|
|
1219
|
-
* SDK-specific Box / Sandbox types that don't belong in this package.
|
|
1220
|
-
*/
|
|
1221
|
-
interface RunCommandInput {
|
|
1222
|
-
/** Executable name, looked up via PATH unless absolute. */
|
|
1223
|
-
cmd: string;
|
|
1224
|
-
/** Argument vector, NOT shell-interpolated. Each element passed to argv. */
|
|
1225
|
-
argv: string[];
|
|
1226
|
-
/** Working directory. Defaults to runner's notion of cwd if omitted. */
|
|
1227
|
-
cwd?: string;
|
|
1228
|
-
/**
|
|
1229
|
-
* Wall-clock cap in ms. The runner SHOULD return `timedOut: true` when
|
|
1230
|
-
* exceeded; callers MAY treat status null + timedOut as "killed."
|
|
1231
|
-
*
|
|
1232
|
-
* Omitting it does NOT mean unbounded: {@link localCommandRunner} then
|
|
1233
|
-
* applies {@link LOCAL_COMMAND_RUNNER_DEFAULT_CAP_MS}. A command that
|
|
1234
|
-
* legitimately runs longer than that names its own `capMs`; it is never
|
|
1235
|
-
* killed silently, because a run stopped by the bound comes back with
|
|
1236
|
-
* `timedOut: true` and `status: null`.
|
|
1237
|
-
*/
|
|
1238
|
-
capMs?: number;
|
|
1239
|
-
/** Env overrides merged on top of the runner's base environment. */
|
|
1240
|
-
env?: Record<string, string>;
|
|
1241
|
-
/** Optional stdin payload. */
|
|
1242
|
-
stdin?: string;
|
|
1243
|
-
}
|
|
1244
|
-
interface RunCommandResult {
|
|
1245
|
-
/** Exit code, or null when the process couldn't start / was killed. */
|
|
1246
|
-
status: number | null;
|
|
1247
|
-
stdout: string;
|
|
1248
|
-
stderr: string;
|
|
1249
|
-
durationMs: number;
|
|
1250
|
-
timedOut: boolean;
|
|
1251
|
-
/** Non-fatal runner-side error (binary missing, signal, etc.). */
|
|
1252
|
-
runnerError?: string;
|
|
1253
|
-
}
|
|
1254
|
-
interface DirEntry {
|
|
1255
|
-
name: string;
|
|
1256
|
-
isDirectory: boolean;
|
|
1257
|
-
isFile: boolean;
|
|
1258
|
-
/** File size in bytes. `null` for directories (not stat'd). */
|
|
1259
|
-
sizeBytes: number | null;
|
|
1260
|
-
}
|
|
1261
|
-
interface CommandRunner {
|
|
1262
|
-
/** Identifier for telemetry + logs. Open-ended literal-union for new runners. */
|
|
1263
|
-
readonly name: string;
|
|
1264
|
-
/** Execute a command in the runner's environment. */
|
|
1265
|
-
run(input: RunCommandInput): Promise<RunCommandResult>;
|
|
1266
|
-
/** True iff `<name>` resolves on the runner's PATH. */
|
|
1267
|
-
hasBin(name: string): Promise<boolean>;
|
|
1268
|
-
/** True iff the given path exists in the runner's filesystem. */
|
|
1269
|
-
fileExists(path: string): Promise<boolean>;
|
|
1270
|
-
/** Read a file. Returns `null` if missing or unreadable. */
|
|
1271
|
-
readFile(path: string): Promise<string | null>;
|
|
1272
|
-
/** List a directory. Returns `[]` if unreadable / missing. */
|
|
1273
|
-
readDir(path: string): Promise<DirEntry[]>;
|
|
1274
|
-
}
|
|
1275
|
-
export declare const localCommandRunner: CommandRunner;
|
|
1276
|
-
/**
|
|
1277
|
-
* Walk a personas directory and return every file matching the convention
|
|
1278
|
-
* `NN-slug.{yaml,yml,json,md}`. Sorted by filename so the numeric prefix
|
|
1279
|
-
* gives stable persona ordering for reproducibility. Consumers filter
|
|
1280
|
-
* through `include` / `exclude`.
|
|
1281
|
-
*/
|
|
1282
|
-
interface DiscoverPersonasOptions {
|
|
1283
|
-
/**
|
|
1284
|
-
* Regex applied to filenames. Files that don't match are skipped.
|
|
1285
|
-
* Default: `^[0-9]{2}-.+\.(yaml|yml|json|md)$`.
|
|
1286
|
-
*/
|
|
1287
|
-
pattern?: RegExp;
|
|
1288
|
-
/**
|
|
1289
|
-
* Filenames (or basenames) to skip. Use this to exclude WIP / archived
|
|
1290
|
-
* personas without removing the file.
|
|
1291
|
-
*/
|
|
1292
|
-
exclude?: readonly string[];
|
|
1293
|
-
/**
|
|
1294
|
-
* If set, return only personas whose basename contains one of these
|
|
1295
|
-
* substrings (post-pattern filter).
|
|
1296
|
-
*/
|
|
1297
|
-
include?: readonly string[];
|
|
1298
|
-
/** Recurse into subdirectories. Default false. */
|
|
1299
|
-
recursive?: boolean;
|
|
1300
|
-
}
|
|
1301
|
-
interface DiscoveredPersona {
|
|
1302
|
-
/** Absolute file path. */
|
|
1303
|
-
path: string;
|
|
1304
|
-
/** Filename without directory. */
|
|
1305
|
-
filename: string;
|
|
1306
|
-
/** Filename without extension — the conventional persona id. */
|
|
1307
|
-
id: string;
|
|
1308
|
-
}
|
|
1309
|
-
export declare function discoverPersonas(dir: string, opts?: DiscoverPersonasOptions): Promise<DiscoveredPersona[]>;
|
|
1310
|
-
/** Verdict for one candidate relative to its parent. ITERATE is the neutral
|
|
1311
|
-
* "keep collecting reps / no parent to compare against" state. */
|
|
1312
|
-
type ExperimentVerdict = 'KEEP' | 'ITERATE' | 'NOISE' | 'REGRESSION';
|
|
1313
|
-
/** A single repetition of a candidate run, carrying the score the verdict is
|
|
1314
|
-
* computed on plus any free-form per-rep metrics the consumer wants kept. */
|
|
1315
|
-
interface ExperimentRep {
|
|
1316
|
-
/** 0-indexed repetition number. */
|
|
1317
|
-
rep: number;
|
|
1318
|
-
/** The score this rep is judged on (same scale as the thresholds). */
|
|
1319
|
-
score: number;
|
|
1320
|
-
/** ISO timestamp the rep completed. */
|
|
1321
|
-
timestamp: string;
|
|
1322
|
-
/** Stable execution/run identity that produced this score. */
|
|
1323
|
-
runId?: string;
|
|
1324
|
-
/** Mechanically resolvable trace, artifact, metric, or finding evidence. */
|
|
1325
|
-
evidence?: EvidenceRef[];
|
|
1326
|
-
/** Whether this rep passed the consumer's own gate — folded into `passRate`. */
|
|
1327
|
-
passed?: boolean;
|
|
1328
|
-
/** Free-form numeric metrics retained for later analysis. */
|
|
1329
|
-
metrics?: Record<string, number>;
|
|
1330
|
-
}
|
|
1331
|
-
interface ExperimentStats {
|
|
1332
|
-
median: number;
|
|
1333
|
-
mean: number;
|
|
1334
|
-
min: number;
|
|
1335
|
-
max: number;
|
|
1336
|
-
/** Inter-quartile range of the rep scores. */
|
|
1337
|
-
iqr: number;
|
|
1338
|
-
/** Population standard deviation of the rep scores. */
|
|
1339
|
-
stddev: number;
|
|
1340
|
-
/** Fraction of reps with `passed === true`, over reps that set `passed`.
|
|
1341
|
-
* null when no rep declared a pass/fail outcome. */
|
|
1342
|
-
passRate: number | null;
|
|
1343
|
-
/** Number of reps. */
|
|
1344
|
-
n: number;
|
|
1345
|
-
/** True when the sample is tight enough to trust for a verdict. */
|
|
1346
|
-
stable: boolean;
|
|
1347
|
-
}
|
|
1348
|
-
interface ImprovementThresholds {
|
|
1349
|
-
/** medianDelta strictly above this ⇒ KEEP. Default 5. */
|
|
1350
|
-
keepThreshold?: number;
|
|
1351
|
-
/** medianDelta strictly below the negative of this ⇒ REGRESSION. Default 5. */
|
|
1352
|
-
regressionThreshold?: number;
|
|
1353
|
-
/** iqr at or above this ⇒ unstable. Default 10. */
|
|
1354
|
-
iqrUnstableAbove?: number;
|
|
1355
|
-
/** stddev at or above this ⇒ unstable. Default Infinity (iqr-only stability). */
|
|
1356
|
-
stddevUnstableAbove?: number;
|
|
1357
|
-
/** Reps required on BOTH candidate and parent before a verdict is rendered.
|
|
1358
|
-
* Default 3. */
|
|
1359
|
-
minRepsForVerdict?: number;
|
|
1360
|
-
}
|
|
1361
|
-
interface ImprovementVerdictResult {
|
|
1362
|
-
verdict: ExperimentVerdict;
|
|
1363
|
-
/** candidate.median − parent.median; null when no parent or insufficient reps. */
|
|
1364
|
-
medianDelta: number | null;
|
|
1365
|
-
/** Human-readable reason for the verdict — for dashboards and logs. */
|
|
1366
|
-
reason: string;
|
|
1367
|
-
}
|
|
1368
|
-
interface Verification {
|
|
1369
|
-
pass: boolean;
|
|
1370
|
-
score?: number;
|
|
1371
|
-
failingLayers?: string[];
|
|
1372
|
-
details?: unknown;
|
|
1373
|
-
}
|
|
1374
|
-
interface Review {
|
|
1375
|
-
observations: string;
|
|
1376
|
-
diagnosis: string;
|
|
1377
|
-
nextShotInstruction: string;
|
|
1378
|
-
shouldContinue: boolean;
|
|
1379
|
-
confidence: number;
|
|
1380
|
-
}
|
|
1381
|
-
interface ReviewMemoryEntry extends Review {
|
|
1382
|
-
shot: number;
|
|
1383
|
-
timestamp: number;
|
|
1384
|
-
verification: {
|
|
1385
|
-
pass: boolean;
|
|
1386
|
-
score?: number;
|
|
1387
|
-
failingLayers?: string[];
|
|
1388
|
-
};
|
|
1389
|
-
}
|
|
1390
|
-
interface ProposeInput<State> {
|
|
1391
|
-
shot: number;
|
|
1392
|
-
goal: string;
|
|
1393
|
-
state: State;
|
|
1394
|
-
priorReview: Review | null;
|
|
1395
|
-
abortSignal: AbortSignal;
|
|
1396
|
-
emitter?: TraceEmitter;
|
|
1397
|
-
}
|
|
1398
|
-
interface ProposeOutput<State, Summary = unknown> {
|
|
1399
|
-
state: State;
|
|
1400
|
-
traceSummary?: Summary;
|
|
1401
|
-
}
|
|
1402
|
-
interface ReviewInput<State, Summary = unknown> {
|
|
1403
|
-
shot: number;
|
|
1404
|
-
goal: string;
|
|
1405
|
-
state: State;
|
|
1406
|
-
verification: Verification;
|
|
1407
|
-
traceSummary: Summary | undefined;
|
|
1408
|
-
memory: ReviewMemoryEntry[];
|
|
1409
|
-
}
|
|
1410
|
-
type ProposeFn<State, Summary = unknown> = (input: ProposeInput<State>) => Promise<ProposeOutput<State, Summary>>;
|
|
1411
|
-
type VerifyFn<State> = (state: State) => Promise<Verification>;
|
|
1412
|
-
type ReviewFn<State, Summary = unknown> = (input: ReviewInput<State, Summary>) => Promise<Review>;
|
|
1413
|
-
interface ReviewMemoryStore {
|
|
1414
|
-
load(): Promise<ReviewMemoryEntry[]>;
|
|
1415
|
-
append(entry: ReviewMemoryEntry): Promise<void>;
|
|
1416
|
-
}
|
|
1417
|
-
interface ProposeReviewConfig<State, Summary = unknown> {
|
|
1418
|
-
goal: string;
|
|
1419
|
-
initialState: State;
|
|
1420
|
-
propose: ProposeFn<State, Summary>;
|
|
1421
|
-
verify: VerifyFn<State>;
|
|
1422
|
-
review: ReviewFn<State, Summary>;
|
|
1423
|
-
/** Hard shot cap. Default 10. */
|
|
1424
|
-
maxShots?: number;
|
|
1425
|
-
/** Wall-clock cap in ms. Default 10 min. */
|
|
1426
|
-
maxWallMs?: number;
|
|
1427
|
-
/**
|
|
1428
|
-
* If the reviewer returns confidence ≤ floor on `confidenceFloorWindow`
|
|
1429
|
-
* consecutive shots, terminate early. Default floor 0.3, window 2.
|
|
1430
|
-
* Set window to 0 or floor to <0 to disable.
|
|
1431
|
-
*/
|
|
1432
|
-
confidenceFloor?: number;
|
|
1433
|
-
confidenceFloorWindow?: number;
|
|
1434
|
-
/** Defaults to an in-memory store if omitted. */
|
|
1435
|
-
memory?: ReviewMemoryStore;
|
|
1436
|
-
/** If provided, emit a Run + per-shot spans. */
|
|
1437
|
-
store?: TraceStore;
|
|
1438
|
-
scenarioId?: string;
|
|
1439
|
-
projectId?: string;
|
|
1440
|
-
variantId?: string;
|
|
1441
|
-
/**
|
|
1442
|
-
* Used when the reviewer soft-fails on shot 1 (no prior instruction to
|
|
1443
|
-
* fall back to). Default is a generic "inspect failures and fix".
|
|
1444
|
-
*/
|
|
1445
|
-
fallbackInstruction?: string;
|
|
1446
|
-
}
|
|
1447
|
-
interface ProposeReviewShot<State, Summary = unknown> {
|
|
1448
|
-
shot: number;
|
|
1449
|
-
state: State;
|
|
1450
|
-
verification: Verification;
|
|
1451
|
-
traceSummary: Summary | undefined;
|
|
1452
|
-
review: Review;
|
|
1453
|
-
reviewAvailable: boolean;
|
|
1454
|
-
reviewError?: string;
|
|
1455
|
-
durationMs: number;
|
|
1456
|
-
}
|
|
1457
|
-
interface ProposeReviewReport<State, Summary = unknown> {
|
|
1458
|
-
runId: string | null;
|
|
1459
|
-
completed: boolean;
|
|
1460
|
-
shots: ProposeReviewShot<State, Summary>[];
|
|
1461
|
-
finalState: State;
|
|
1462
|
-
finalVerification: Verification;
|
|
1463
|
-
failureClass?: FailureClass;
|
|
1464
|
-
wallMs: number;
|
|
1465
|
-
score: number;
|
|
1466
|
-
}
|
|
1467
|
-
export declare function inMemoryReviewStore(initial?: ReviewMemoryEntry[]): ReviewMemoryStore;
|
|
1468
|
-
export declare function jsonlReviewStore(path: string): ReviewMemoryStore;
|
|
1469
|
-
export declare function runProposeReview<State, Summary = unknown>(config: ProposeReviewConfig<State, Summary>): Promise<ProposeReviewReport<State, Summary>>;
|
|
1470
|
-
type LlmJsonCall = (req: {
|
|
1471
|
-
system: string;
|
|
1472
|
-
user: string;
|
|
1473
|
-
}) => Promise<unknown>;
|
|
1474
|
-
interface LlmReviewerConfig<State, Summary = unknown> {
|
|
1475
|
-
callJson: LlmJsonCall;
|
|
1476
|
-
renderState?: (state: State) => string;
|
|
1477
|
-
renderTraceSummary?: (summary: Summary | undefined) => string;
|
|
1478
|
-
/** Appended to the default system prompt. */
|
|
1479
|
-
systemPromptAddendum?: string;
|
|
1480
|
-
}
|
|
1481
|
-
export declare function createLlmReviewer<State, Summary = unknown>(cfg: LlmReviewerConfig<State, Summary>): ReviewFn<State, Summary>;
|
|
1482
|
-
interface TrialTrace {
|
|
1483
|
-
/** Stable id for the trial — surfaces in the prompt for grounding. */
|
|
1484
|
-
id: string;
|
|
1485
|
-
/** Score the trial received on its primary metric. */
|
|
1486
|
-
score: number;
|
|
1487
|
-
/** Candidate inputs the agent was given (e.g., the fixture or scenario). */
|
|
1488
|
-
inputName?: string;
|
|
1489
|
-
/**
|
|
1490
|
-
* Goldens / expectations this trial was tested against, with whether each
|
|
1491
|
-
* was matched. The reflection prompt quotes the missed ones specifically.
|
|
1492
|
-
*/
|
|
1493
|
-
expectations?: Array<{
|
|
1494
|
-
id: string;
|
|
1495
|
-
phrase: string;
|
|
1496
|
-
matched: boolean;
|
|
1497
|
-
}>;
|
|
1498
|
-
/** Free-form text — what the agent actually emitted (e.g., findings, plan). */
|
|
1499
|
-
emitted?: string;
|
|
1500
|
-
/** The judge's free-form note on WHY this trial scored low — the failure
|
|
1501
|
-
* evidence the reflection targets. Should be a generalizable pattern (which
|
|
1502
|
-
* checks/lines/dimensions failed, and how), never case-specific ground
|
|
1503
|
-
* truth (that would teach memorization, not capability). */
|
|
1504
|
-
failureNote?: string;
|
|
1505
|
-
/** Optional structured metrics (recall, precision, cost, latency). */
|
|
1506
|
-
metrics?: Record<string, number>;
|
|
1507
|
-
}
|
|
1508
|
-
interface ReflectionContext {
|
|
1509
|
-
/** What is being mutated — appears in the system prompt for orientation. */
|
|
1510
|
-
target: string;
|
|
1511
|
-
/** Current variant's payload — JSON-serialised for the prompt. */
|
|
1512
|
-
parentPayload: unknown;
|
|
1513
|
-
/** Best-performing trials this generation. */
|
|
1514
|
-
topTrials: TrialTrace[];
|
|
1515
|
-
/** Worst-performing trials this generation — the missed-golden source. */
|
|
1516
|
-
bottomTrials: TrialTrace[];
|
|
1517
|
-
/** How many children the mutator should propose. */
|
|
1518
|
-
childCount: number;
|
|
1519
|
-
/** Optional: domain-specific mutation primitives the model can pick from. */
|
|
1520
|
-
mutationPrimitives?: string[];
|
|
1521
|
-
}
|
|
1522
|
-
/**
|
|
1523
|
-
* Build the LLM-ready reflection prompt. Output is plain text — pass it as
|
|
1524
|
-
* the user message. The system message should be small and stable (e.g.
|
|
1525
|
-
* "Output ONLY a JSON object matching the schema below.").
|
|
1526
|
-
*/
|
|
1527
|
-
export declare function buildReflectionPrompt(ctx: ReflectionContext): string;
|
|
1528
|
-
interface ReflectionProposal {
|
|
1529
|
-
label: string;
|
|
1530
|
-
rationale: string;
|
|
1531
|
-
payload: unknown;
|
|
1532
|
-
}
|
|
1533
|
-
/**
|
|
1534
|
-
* Parse the model's JSON response back into proposals. Tolerates markdown
|
|
1535
|
-
* fences and surrounding prose. Returns at most `maxProposals`.
|
|
1536
|
-
*/
|
|
1537
|
-
export declare function parseReflectionResponse(raw: string, maxProposals?: number): ReflectionProposal[];
|
|
1538
|
-
/**
|
|
1539
|
-
* Backing persistence for `EvalTraceStore`. The in-memory store is the default;
|
|
1540
|
-
* the JSONL file store appends one validated `RunRecord` per line. Both keep an
|
|
1541
|
-
* append order so `getBest` / `compareRuns` are reproducible.
|
|
1542
|
-
*/
|
|
1543
|
-
interface RunRecordBackend {
|
|
1544
|
-
append(record: RunRecord): Promise<void>;
|
|
1545
|
-
load(): Promise<RunRecord[]>;
|
|
1546
|
-
}
|
|
1547
|
-
/**
|
|
1548
|
-
* JSONL-backed store at `path`, one `RunRecord` per line. Malformed lines fail
|
|
1549
|
-
* loud on load (a corrupt corpus must not silently shrink the analysis set);
|
|
1550
|
-
* pass `skipInvalid` only for forensics on a known-bad file.
|
|
1551
|
-
*/
|
|
1552
|
-
export declare function jsonlRunRecordBackend(path: string, opts?: {
|
|
1553
|
-
skipInvalid?: boolean;
|
|
1554
|
-
}): RunRecordBackend;
|
|
1555
|
-
interface ModelPreflight {
|
|
1556
|
-
/** The model id as supplied by the caller. */
|
|
1557
|
-
model: string;
|
|
1558
|
-
/** Membership in the `{baseUrl}/models` served set. */
|
|
1559
|
-
listed: boolean;
|
|
1560
|
-
/**
|
|
1561
|
-
* The router reached a provider for this model. `null` when `probe` was not
|
|
1562
|
-
* requested. True on a 2xx, and also when the provider answered by
|
|
1563
|
-
* exhausting its reasoning budget — that proves reachability while leaving
|
|
1564
|
-
* identity unproven (see `budgetExhausted`).
|
|
1565
|
-
*/
|
|
1566
|
-
served: boolean | null;
|
|
1567
|
-
/** HTTP status of the probe. `null` when not probed. */
|
|
1568
|
-
status: number | null;
|
|
1569
|
-
/** Probe body's `error.message` when present, else `null`. */
|
|
1570
|
-
detail: string | null;
|
|
1571
|
-
/**
|
|
1572
|
-
* The probe died on the token budget rather than on the model. Identity is
|
|
1573
|
-
* unproven, not refuted: raise `probeMaxTokens` to resolve it.
|
|
1574
|
-
*/
|
|
1575
|
-
budgetExhausted: boolean;
|
|
1576
|
-
/**
|
|
1577
|
-
* Identity of the model that answered the probe, compared against `model`.
|
|
1578
|
-
* `null` when the model was not probed or the probe failed.
|
|
1579
|
-
*/
|
|
1580
|
-
substitution: ServedModelCheck | null;
|
|
1581
|
-
}
|
|
1582
|
-
/** One check Agent Eval asks the caller's endpoint to perform. */
|
|
1583
|
-
type ModelEndpointCheck = {
|
|
1584
|
-
readonly kind: 'list-models';
|
|
1585
|
-
} | {
|
|
1586
|
-
readonly kind: 'probe';
|
|
1587
|
-
readonly model: string;
|
|
1588
|
-
/** Output-token budget the probe completion may bill. */
|
|
1589
|
-
readonly maxOutputTokens: number;
|
|
1590
|
-
};
|
|
1591
|
-
/**
|
|
1592
|
-
* Caller-owned request into the model endpoint. The caller binds the base URL
|
|
1593
|
-
* and the credential and returns the raw `Response`; a `list-models` request
|
|
1594
|
-
* answers with an OpenAI-compatible `{ data: [{ id }] }` body, and a `probe`
|
|
1595
|
-
* request answers with one minimal chat completion for `model`.
|
|
1596
|
-
*/
|
|
1597
|
-
type ModelEndpointRequest = (check: ModelEndpointCheck) => Promise<Response>;
|
|
1598
|
-
interface PreflightModelsOptions {
|
|
1599
|
-
/** Caller-owned endpoint request. Agent Eval issues no provider HTTP itself. */
|
|
1600
|
-
request: ModelEndpointRequest;
|
|
1601
|
-
/** Model ids to check. */
|
|
1602
|
-
models: string[];
|
|
1603
|
-
/** When true, additionally spend a small chat probe per model. Default false. */
|
|
1604
|
-
probe?: boolean;
|
|
1605
|
-
/**
|
|
1606
|
-
* Output-token budget per probe. Default `PROBE_MAX_TOKENS`. Lowering it
|
|
1607
|
-
* below the reasoning floor makes healthy reasoning models report
|
|
1608
|
-
* `budgetExhausted` instead of proving their identity.
|
|
1609
|
-
*/
|
|
1610
|
-
probeMaxTokens?: number;
|
|
1611
|
-
}
|
|
1612
|
-
interface PreflightOutcome {
|
|
1613
|
-
succeeded: boolean;
|
|
1614
|
-
value: ModelPreflight[] | null;
|
|
1615
|
-
error: string | null;
|
|
1616
|
-
}
|
|
1617
|
-
/**
|
|
1618
|
-
* Check that `models` are reachable on the router. Returns a typed outcome —
|
|
1619
|
-
* a network failure yields `{ succeeded: false, error }`, never a throw and
|
|
1620
|
-
* never a partial result silently reported as success. No retries, no
|
|
1621
|
-
* fallbacks.
|
|
1622
|
-
*
|
|
1623
|
-
* The membership check (one GET) always runs. When `probe` is true, each model
|
|
1624
|
-
* additionally gets a small chat probe so a model that is listed but
|
|
1625
|
-
* unconfigured (a 401 `model_not_found` from the router) is caught.
|
|
1626
|
-
*/
|
|
1627
|
-
export declare function preflightModels(opts: PreflightModelsOptions): Promise<PreflightOutcome>;
|
|
1628
|
-
/**
|
|
1629
|
-
* ModelSeats — the program's model seating chart.
|
|
1630
|
-
*
|
|
1631
|
-
* One object names which model fills each role in an eval program: the worker
|
|
1632
|
-
* under evaluation, the judge panel, the analyst, the reflection/driver model,
|
|
1633
|
-
* and the verifier. Re-tiering an entire program (economy ↔ frontier) is one
|
|
1634
|
-
* swapped object instead of a hunt through call sites.
|
|
1635
|
-
*
|
|
1636
|
-
* Wiring points — consumers thread seats; this module implements none of them
|
|
1637
|
-
* (those files belong to other surfaces):
|
|
1638
|
-
* - `judges` → `ensembleJudge({ models: seats.judges, … })` (src/judge-panel.ts)
|
|
1639
|
-
* and the `JudgeConfig`s handed to `makeEvalTools({ judges })`
|
|
1640
|
-
* (src/eval-tools.ts).
|
|
1641
|
-
* - `reflection` → the model configured by a custom `SurfaceProposer` or
|
|
1642
|
-
* external optimization engine.
|
|
1643
|
-
* - `worker` → the dispatch model the agent itself calls — the model an
|
|
1644
|
-
* `AgentProfile` declares.
|
|
1645
|
-
* - `analyst` → the LLM behind `analyzeRuns` / analyst-registry kinds.
|
|
1646
|
-
* - `verifier` → completion-verifier / objective-checker model.
|
|
1647
|
-
* - campaign cells thread `judges` + driver models the same way; that wiring
|
|
1648
|
-
* lands with the campaign surface, not here.
|
|
1649
|
-
*
|
|
1650
|
-
* `resolveSeat` is the only read path: an unset seat with no explicit fallback
|
|
1651
|
-
* throws — a model id is a budget decision, never a silent default.
|
|
1652
|
-
*/
|
|
1653
|
-
interface ModelSeats {
|
|
1654
|
-
/** The model under evaluation — what the agent itself dispatches with. */
|
|
1655
|
-
worker?: string;
|
|
1656
|
-
/** Judge-panel model ids — thread into `ensembleJudge({ models })`. */
|
|
1657
|
-
judges?: string[];
|
|
1658
|
-
/** Analyst model — `analyzeRuns` / analyst-registry LLM calls. */
|
|
1659
|
-
analyst?: string;
|
|
1660
|
-
/** Reflection or candidate-generation model. */
|
|
1661
|
-
reflection?: string;
|
|
1662
|
-
/** Verifier model — completion/objective checking. */
|
|
1663
|
-
verifier?: string;
|
|
1664
|
-
}
|
|
1665
|
-
type SeatName = keyof ModelSeats;
|
|
1666
|
-
/**
|
|
1667
|
-
* Tier presets — plain data, swap or spread freely.
|
|
1668
|
-
*
|
|
1669
|
-
* A preset names REQUESTED ids, and a requested id is NOT a guarantee of
|
|
1670
|
-
* family, of provider, or of liveness. A routing gateway can accept any id
|
|
1671
|
-
* below and answer from a different model on HTTP 200, with only the response
|
|
1672
|
-
* body's `model` field betraying the swap. The served assertion is the
|
|
1673
|
-
* guarantee: gate a run on `assertModelsServed({ probe: true })` and assert
|
|
1674
|
-
* `assertServedModel` per call. `assertCrossFamily` over these ids proves the
|
|
1675
|
-
* configuration is diverse; only `assertCrossFamilyServed` over the ids that
|
|
1676
|
-
* ANSWERED proves the run was.
|
|
1677
|
-
*
|
|
1678
|
-
* `economy` names ids a live router probe answered from the provider their
|
|
1679
|
-
* name implies, so the judge trio spanned three provider families (deepseek /
|
|
1680
|
-
* zhipu / google) as configured and, at that probe, as served. A preset is
|
|
1681
|
-
* only as good as its last probe: ids go dead and start resolving elsewhere
|
|
1682
|
-
* without notice, so re-probe rather than trusting this list.
|
|
1683
|
-
*
|
|
1684
|
-
* `frontier` is deliberately EMPTY: entitled frontier ids vary per router
|
|
1685
|
-
* account, and a hardcoded claude/gpt-5 id 401s on keys that lack it. Supply
|
|
1686
|
-
* your own: `{ ...seatPresets.frontier, worker: '<your-frontier-id>', … }` —
|
|
1687
|
-
* `resolveSeat` throws on every seat you haven't filled.
|
|
1688
|
-
*/
|
|
1689
|
-
export declare const seatPresets: Record<'economy' | 'frontier', ModelSeats>;
|
|
1690
|
-
/**
|
|
1691
|
-
* Read one seat. Blank strings and empty arrays count as unset (env-var
|
|
1692
|
-
* plumbing produces them); malformed values (non-string seat, non-array or
|
|
1693
|
-
* blank-entry `judges`) throw `ValidationError`. When the seat is unset, an
|
|
1694
|
-
* explicit `fallback` is returned (`[fallback]` for `judges` — a one-model
|
|
1695
|
-
* panel); without one, `SeatUnsetError`.
|
|
1696
|
-
*/
|
|
1697
|
-
export declare function resolveSeat(seats: ModelSeats, seat: 'judges', fallback?: string): string[];
|
|
1698
|
-
export declare function resolveSeat(seats: ModelSeats, seat: Exclude<SeatName, 'judges'>, fallback?: string): string;
|
|
1699
|
-
export declare function resolveSeat(seats: ModelSeats, seat: SeatName, fallback?: string): string | string[];
|
|
1700
|
-
/**
|
|
1701
|
-
* Versioned prompt registry.
|
|
1702
|
-
*
|
|
1703
|
-
* Every prompt used in an eval run is registered with an explicit version.
|
|
1704
|
-
* Reports include the content hash so A/B compares are rigorous: if the
|
|
1705
|
-
* hash changes between two reports, the prompt actually changed; if it
|
|
1706
|
-
* matches, the variance is elsewhere.
|
|
1707
|
-
*
|
|
1708
|
-
* Hash is SHA-256(content), truncated to 12 hex chars for readability.
|
|
1709
|
-
* Uses the Web Crypto API (works in Workers, Node 22+, browsers).
|
|
1710
|
-
*/
|
|
1711
|
-
interface PromptHandle {
|
|
1712
|
-
/** Stable human-readable id, e.g. 'browser.system' */
|
|
1713
|
-
id: string;
|
|
1714
|
-
/** Caller-chosen version string, e.g. 'v3' or '2026-04-20' */
|
|
1715
|
-
version: string;
|
|
1716
|
-
/** SHA-256 of content, 12-hex-char prefix */
|
|
1717
|
-
hash: string;
|
|
1718
|
-
/** Full prompt body */
|
|
1719
|
-
content: string;
|
|
1720
|
-
}
|
|
1721
|
-
export declare class PromptRegistry {
|
|
1722
|
-
private readonly entries;
|
|
1723
|
-
/**
|
|
1724
|
-
* Register a prompt. Re-registering the same id+version with DIFFERENT
|
|
1725
|
-
* content throws — versions are immutable. Re-registering with the SAME
|
|
1726
|
-
* content is a no-op (idempotent).
|
|
1727
|
-
*/
|
|
1728
|
-
register(id: string, version: string, content: string): Promise<PromptHandle>;
|
|
1729
|
-
/** Look up a registered prompt. Throws if unknown — no implicit defaults. */
|
|
1730
|
-
get(id: string, version: string): PromptHandle;
|
|
1731
|
-
/** Return all versions of an id, newest-first (lex-descending on version). */
|
|
1732
|
-
listVersions(id: string): PromptHandle[];
|
|
1733
|
-
/** Snapshot the whole registry — useful for including in reports. */
|
|
1734
|
-
list(): PromptHandle[];
|
|
1735
|
-
/** Verify a hash against registered content. Returns null if not found. */
|
|
1736
|
-
verifyHash(id: string, version: string, expectedHash: string): boolean | null;
|
|
1737
|
-
}
|
|
1738
|
-
/** SHA-256(content) → first 12 hex chars. Stable across runtimes. */
|
|
1739
|
-
export declare function hashContent(content: string): Promise<string>;
|
|
1740
|
-
/**
|
|
1741
|
-
* Reference replay — score an agent against withheld historical outcomes.
|
|
1742
|
-
*
|
|
1743
|
-
* This is the generic version of the public-audit replay pattern:
|
|
1744
|
-
* run a candidate system on an old task, keep the reference answers hidden
|
|
1745
|
-
* until after execution, then score recall/precision and gate promotion
|
|
1746
|
-
* across train/dev/test/holdout splits.
|
|
1747
|
-
*/
|
|
1748
|
-
type ReferenceReplaySplit = 'train' | 'dev' | 'test' | 'holdout';
|
|
1749
|
-
interface ReferenceReplayItem {
|
|
1750
|
-
id: string;
|
|
1751
|
-
title: string;
|
|
1752
|
-
description?: string;
|
|
1753
|
-
severity?: string;
|
|
1754
|
-
tags?: string[];
|
|
1755
|
-
weight?: number;
|
|
1756
|
-
}
|
|
1757
|
-
interface ReferenceReplayCandidate {
|
|
1758
|
-
id: string;
|
|
1759
|
-
title: string;
|
|
1760
|
-
description?: string;
|
|
1761
|
-
severity?: string;
|
|
1762
|
-
tags?: string[];
|
|
1763
|
-
metadata?: Record<string, unknown>;
|
|
1764
|
-
}
|
|
1765
|
-
interface ReferenceReplayMatch {
|
|
1766
|
-
scenarioId: string;
|
|
1767
|
-
referenceId: string;
|
|
1768
|
-
candidateId: string | null;
|
|
1769
|
-
score: number;
|
|
1770
|
-
matched: boolean;
|
|
1771
|
-
weight: number;
|
|
1772
|
-
reason: string;
|
|
1773
|
-
}
|
|
1774
|
-
interface ReferenceReplayScenarioScore {
|
|
1775
|
-
scenarioId: string;
|
|
1776
|
-
split: ReferenceReplaySplit;
|
|
1777
|
-
matched: number;
|
|
1778
|
-
total: number;
|
|
1779
|
-
falsePositives: number;
|
|
1780
|
-
matchedWeight: number;
|
|
1781
|
-
totalWeight: number;
|
|
1782
|
-
precision: number;
|
|
1783
|
-
recall: number;
|
|
1784
|
-
f1: number;
|
|
1785
|
-
matches: ReferenceReplayMatch[];
|
|
1786
|
-
}
|
|
1787
|
-
interface ReferenceReplayAggregate {
|
|
1788
|
-
matched: number;
|
|
1789
|
-
total: number;
|
|
1790
|
-
falsePositives: number;
|
|
1791
|
-
matchedWeight: number;
|
|
1792
|
-
totalWeight: number;
|
|
1793
|
-
precision: number;
|
|
1794
|
-
recall: number;
|
|
1795
|
-
f1: number;
|
|
1796
|
-
weightedRecall: number;
|
|
1797
|
-
}
|
|
1798
|
-
interface ReferenceReplayScore {
|
|
1799
|
-
scenarios: ReferenceReplayScenarioScore[];
|
|
1800
|
-
aggregate: ReferenceReplayAggregate;
|
|
1801
|
-
bySplit: Partial<Record<ReferenceReplaySplit, ReferenceReplayAggregate>>;
|
|
1802
|
-
}
|
|
1803
|
-
interface ReferenceReplayCaseRun<Input = unknown> {
|
|
1804
|
-
caseId: string;
|
|
1805
|
-
split: ReferenceReplaySplit;
|
|
1806
|
-
input: Input;
|
|
1807
|
-
metadata?: Record<string, unknown>;
|
|
1808
|
-
references: ReferenceReplayItem[];
|
|
1809
|
-
candidates: ReferenceReplayCandidate[];
|
|
1810
|
-
score: ReferenceReplayScenarioScore;
|
|
1811
|
-
durationMs: number;
|
|
1812
|
-
error?: string;
|
|
1813
|
-
}
|
|
1814
|
-
interface ReferenceReplayRun<Input = unknown> {
|
|
1815
|
-
id: string;
|
|
1816
|
-
variantId?: string;
|
|
1817
|
-
startedAt: number;
|
|
1818
|
-
completedAt: number;
|
|
1819
|
-
durationMs: number;
|
|
1820
|
-
cases: ReferenceReplayCaseRun<Input>[];
|
|
1821
|
-
score: ReferenceReplayScore;
|
|
1822
|
-
metadata?: Record<string, unknown>;
|
|
1823
|
-
}
|
|
1824
|
-
interface SteeringRolePrompt {
|
|
1825
|
-
system?: string;
|
|
1826
|
-
append?: string;
|
|
1827
|
-
}
|
|
1828
|
-
interface SteeringBundle {
|
|
1829
|
-
id: string;
|
|
1830
|
-
coderPrompt?: string;
|
|
1831
|
-
continuePrompt?: string;
|
|
1832
|
-
reviewerPrompts?: Record<string, string>;
|
|
1833
|
-
skills?: string[];
|
|
1834
|
-
rolePrompts?: Record<string, SteeringRolePrompt>;
|
|
1835
|
-
metadata?: Record<string, unknown>;
|
|
1836
|
-
}
|
|
1837
|
-
interface RunScore {
|
|
1838
|
-
success: number;
|
|
1839
|
-
goalProgress: number;
|
|
1840
|
-
repoGroundedness: number;
|
|
1841
|
-
driftPenalty: number;
|
|
1842
|
-
toolUseQuality: number;
|
|
1843
|
-
patchQuality: number;
|
|
1844
|
-
testReality: number;
|
|
1845
|
-
finalGate: number;
|
|
1846
|
-
reviewerBlockers: number;
|
|
1847
|
-
costUsd: number;
|
|
1848
|
-
wallSeconds: number;
|
|
1849
|
-
notes?: string[];
|
|
1850
|
-
}
|
|
1851
|
-
type RunScoreWeights = Omit<RunScore, 'notes'>;
|
|
1852
|
-
export declare function aggregateRunScore(score: RunScore, weights?: Partial<RunScoreWeights>): number;
|
|
1853
|
-
export declare function clamp01(value: number): number;
|
|
1854
|
-
type SteeringOptimizerBackend = 'pairwise';
|
|
1855
|
-
interface SteeringOptimizationRow {
|
|
1856
|
-
variantId: string;
|
|
1857
|
-
scenarioId: string;
|
|
1858
|
-
bundle: SteeringBundle;
|
|
1859
|
-
score: RunScore;
|
|
1860
|
-
metadata?: Record<string, unknown>;
|
|
1861
|
-
}
|
|
1862
|
-
interface SteeringOptimizationSelector {
|
|
1863
|
-
backend: SteeringOptimizerBackend;
|
|
1864
|
-
signature?: string;
|
|
1865
|
-
labels?: string[];
|
|
1866
|
-
rationale?: string;
|
|
1867
|
-
}
|
|
1868
|
-
interface SteeringOptimizationResult {
|
|
1869
|
-
backend: SteeringOptimizerBackend;
|
|
1870
|
-
recommendedVariantId: string;
|
|
1871
|
-
rationale: string;
|
|
1872
|
-
rankings: Array<{
|
|
1873
|
-
variantId: string;
|
|
1874
|
-
mean: number;
|
|
1875
|
-
runs: number;
|
|
1876
|
-
}>;
|
|
1877
|
-
selector?: SteeringOptimizationSelector;
|
|
1878
|
-
skipped?: boolean;
|
|
1879
|
-
}
|
|
1880
|
-
interface SteeringOptimizerConfig {
|
|
1881
|
-
weights?: Partial<RunScoreWeights>;
|
|
1882
|
-
}
|
|
1883
|
-
/**
|
|
1884
|
-
* Rank already-evaluated steering variants.
|
|
1885
|
-
*
|
|
1886
|
-
* Model-backed candidate generation belongs to the official GEPA campaign
|
|
1887
|
-
* integration. This class only performs the deterministic selection it owns.
|
|
1888
|
-
*/
|
|
1889
|
-
export declare class PairwiseSteeringOptimizer {
|
|
1890
|
-
optimize(rows: SteeringOptimizationRow[], config?: SteeringOptimizerConfig): SteeringOptimizationResult;
|
|
1891
|
-
}
|
|
1892
|
-
type CounterfactualMutation = {
|
|
1893
|
-
kind: 'swap-model';
|
|
1894
|
-
at: number;
|
|
1895
|
-
newModel: string;
|
|
1896
|
-
} | {
|
|
1897
|
-
kind: 'swap-tool-result';
|
|
1898
|
-
at: number;
|
|
1899
|
-
newResult: unknown;
|
|
1900
|
-
} | {
|
|
1901
|
-
kind: 'truncate-after';
|
|
1902
|
-
at: number;
|
|
1903
|
-
} | {
|
|
1904
|
-
kind: 'inject-system-message';
|
|
1905
|
-
at: number;
|
|
1906
|
-
content: string;
|
|
1907
|
-
} | {
|
|
1908
|
-
kind: 'custom';
|
|
1909
|
-
at: number;
|
|
1910
|
-
describe: string;
|
|
1911
|
-
apply: (step: TrajectoryStep) => TrajectoryStep;
|
|
1912
|
-
};
|
|
1913
|
-
interface CounterfactualContext {
|
|
1914
|
-
originalRunId: string;
|
|
1915
|
-
originalTrajectory: Trajectory;
|
|
1916
|
-
/** Steps up to (but not including) the mutation point — the prefix the
|
|
1917
|
-
* replayed agent inherits as its prior conversation/tool history. */
|
|
1918
|
-
prefix: TrajectoryStep[];
|
|
1919
|
-
mutation: CounterfactualMutation;
|
|
1920
|
-
/** Pre-applied mutation on the step at `mutation.at`. Consumers use this
|
|
1921
|
-
* as the FIRST step the replayed agent emits (they decide whether to
|
|
1922
|
-
* re-emit it or continue from there). */
|
|
1923
|
-
mutatedStep: TrajectoryStep;
|
|
1924
|
-
}
|
|
1925
|
-
interface CounterfactualResult {
|
|
1926
|
-
counterfactualRunId: string;
|
|
1927
|
-
originalRunId: string;
|
|
1928
|
-
mutation: CounterfactualMutation;
|
|
1929
|
-
/** Structured delta summary — caller can extend via scoring. */
|
|
1930
|
-
delta: {
|
|
1931
|
-
originalOutcomeScore: number | null;
|
|
1932
|
-
counterfactualOutcomeScore: number | null;
|
|
1933
|
-
deltaScore: number | null;
|
|
1934
|
-
};
|
|
1935
|
-
}
|
|
1936
|
-
interface CounterfactualRunner {
|
|
1937
|
-
/**
|
|
1938
|
-
* Execute the agent from `ctx.prefix` with the mutation applied.
|
|
1939
|
-
* MUST emit spans into the provided emitter so they become part of
|
|
1940
|
-
* the counterfactual run. MUST call emitter.endRun() with a verdict.
|
|
1941
|
-
*/
|
|
1942
|
-
executeFrom: (ctx: CounterfactualContext, emitter: TraceEmitter) => Promise<void>;
|
|
1943
|
-
}
|
|
1944
|
-
/** One commit's measurement of one (scenario, profile) cell. */
|
|
1945
|
-
interface ScorecardEntry {
|
|
1946
|
-
commitSha: string;
|
|
1947
|
-
/** ISO timestamp the entry was recorded. */
|
|
1948
|
-
timestamp: string;
|
|
1949
|
-
/** Per-seed (or per-rep) scores for this cell at this commit. */
|
|
1950
|
-
scores: number[];
|
|
1951
|
-
/** Median of `scores` — the cell's headline score for the commit. */
|
|
1952
|
-
composite: number;
|
|
1953
|
-
/** Per-dimension means, when the runs carried a judge breakdown. */
|
|
1954
|
-
perDimension?: Record<string, number>;
|
|
1955
|
-
/** RunRecord ids folded into this entry — provenance. */
|
|
1956
|
-
runIds: string[];
|
|
1957
|
-
}
|
|
1958
|
-
/** A (scenario, profile) cell and its commit-ordered score timeline. */
|
|
1959
|
-
interface ScorecardCell {
|
|
1960
|
-
scenarioId: string;
|
|
1961
|
-
profileHash: string;
|
|
1962
|
-
/** Model id — denormalised from the profile for readable filtering. */
|
|
1963
|
-
model: string;
|
|
1964
|
-
timeline: ScorecardEntry[];
|
|
1965
|
-
}
|
|
1966
|
-
/** The folded scorecard: every cell, plus the profile definitions by hash. */
|
|
1967
|
-
interface Scorecard {
|
|
1968
|
-
cells: ScorecardCell[];
|
|
1969
|
-
/** Profile definitions seen — keeps the scorecard self-describing. */
|
|
1970
|
-
profiles: Record<string, AgentProfile>;
|
|
1971
|
-
}
|
|
1972
|
-
/** One append-only log line — a single cell's entry for a single commit. */
|
|
1973
|
-
interface ScorecardLogLine {
|
|
1974
|
-
scenarioId: string;
|
|
1975
|
-
profileHash: string;
|
|
1976
|
-
model: string;
|
|
1977
|
-
profile: AgentProfile;
|
|
1978
|
-
entry: ScorecardEntry;
|
|
1979
|
-
}
|
|
1980
|
-
interface RecordRunsOptions {
|
|
1981
|
-
/** The profile that produced these runs — keys the cell. */
|
|
1982
|
-
profile: AgentProfile;
|
|
1983
|
-
commitSha: string;
|
|
1984
|
-
/** Defaults to `new Date().toISOString()`. */
|
|
1985
|
-
timestamp?: string;
|
|
1986
|
-
}
|
|
1987
|
-
/**
|
|
1988
|
-
* Fold a benchmark's `RunRecord[]` into per-cell scorecard log lines — one
|
|
1989
|
-
* line per scenario the runs cover. All runs are attributed to the single
|
|
1990
|
-
* `profile` in `opts` (the harness ran them under it); the cell key is
|
|
1991
|
-
* `(scenarioId, agentProfileHash(profile))`.
|
|
1992
|
-
*/
|
|
1993
|
-
export declare function recordRuns(runs: RunRecord[], opts: RecordRunsOptions): ScorecardLogLine[];
|
|
1994
|
-
/** Record runs and append them to the log in one call. Returns the lines. */
|
|
1995
|
-
export declare function recordRunsToScorecard(logPath: string, runs: RunRecord[], opts: RecordRunsOptions): ScorecardLogLine[];
|
|
1996
|
-
/**
|
|
1997
|
-
* Fold the JSONL log into a queryable `Scorecard`. A missing file yields an
|
|
1998
|
-
* empty scorecard; a malformed line is skipped — a corrupt append never
|
|
1999
|
-
* breaks the read. Each cell's timeline is sorted chronologically.
|
|
2000
|
-
*/
|
|
2001
|
-
export declare function loadScorecard(logPath: string): Scorecard;
|
|
2002
|
-
type CellVerdict = 'improved' | 'regressed' | 'flat' | 'new';
|
|
2003
|
-
interface ScorecardCellDiff {
|
|
2004
|
-
scenarioId: string;
|
|
2005
|
-
profileHash: string;
|
|
2006
|
-
model: string;
|
|
2007
|
-
verdict: CellVerdict;
|
|
2008
|
-
/** Composite of the latest entry. */
|
|
2009
|
-
current: number;
|
|
2010
|
-
/** Composite of the comparison entry — `null` when `verdict === 'new'`. */
|
|
2011
|
-
baseline: number | null;
|
|
2012
|
-
/** `current − baseline` — `null` when new. */
|
|
2013
|
-
delta: number | null;
|
|
2014
|
-
/** Cohen's d of current vs baseline samples — `null` when new or n < 2. */
|
|
2015
|
-
cohensD: number | null;
|
|
2016
|
-
/** Welch's t-test p-value — `null` when new or n < 2. */
|
|
2017
|
-
pValue: number | null;
|
|
2018
|
-
currentCommit: string;
|
|
2019
|
-
baselineCommit: string | null;
|
|
2020
|
-
}
|
|
2021
|
-
interface ScorecardDiff {
|
|
2022
|
-
cells: ScorecardCellDiff[];
|
|
2023
|
-
summary: {
|
|
2024
|
-
improved: number;
|
|
2025
|
-
regressed: number;
|
|
2026
|
-
flat: number;
|
|
2027
|
-
new: number;
|
|
2028
|
-
};
|
|
2029
|
-
}
|
|
2030
|
-
interface DiffScorecardOptions {
|
|
2031
|
-
/** Compare each cell against this commit instead of its immediate predecessor. */
|
|
2032
|
-
baselineCommit?: string;
|
|
2033
|
-
/** |Cohen's d| at/above which a move counts as real. Default 0.5. */
|
|
2034
|
-
minEffect?: number;
|
|
2035
|
-
/** p-value at/below which a move is significant. Default 0.05. */
|
|
2036
|
-
maxP?: number;
|
|
2037
|
-
/**
|
|
2038
|
-
* |delta| at/above which a move counts when statistics are unavailable
|
|
2039
|
-
* (a cell with fewer than 2 samples on either side). Default 0.05.
|
|
2040
|
-
*/
|
|
2041
|
-
minDelta?: number;
|
|
2042
|
-
}
|
|
2043
|
-
/**
|
|
2044
|
-
* Compare the latest entry of every cell against its predecessor (or against
|
|
2045
|
-
* `baselineCommit`) and classify the move. A move is `improved`/`regressed`
|
|
2046
|
-
* only when it clears both the effect-size and significance gates; otherwise
|
|
2047
|
-
* `flat`. Cells with no prior entry are `new`.
|
|
2048
|
-
*/
|
|
2049
|
-
export declare function diffScorecard(scorecard: Scorecard, opts?: DiffScorecardOptions): ScorecardDiff;
|
|
2050
|
-
/**
|
|
2051
|
-
* Render a scorecard diff as a human-readable report — the block a feature
|
|
2052
|
-
* PR prints. Regressions are listed first; flat cells are summarised, not
|
|
2053
|
-
* enumerated.
|
|
2054
|
-
*/
|
|
2055
|
-
export declare function formatScorecardDiff(diff: ScorecardDiff): string;
|
|
2056
|
-
/**
|
|
2057
|
-
* Minimal structural span the checker reads. The eval-side `Span`
|
|
2058
|
-
* (trace/schema) and the output of {@link contractSpansFromOtlp} satisfy it.
|
|
2059
|
-
*/
|
|
2060
|
-
interface ContractSpan {
|
|
2061
|
-
spanId?: string;
|
|
2062
|
-
parentSpanId?: string | null;
|
|
2063
|
-
name?: string;
|
|
2064
|
-
/** Eval kinds (`tool`, `llm`, ...) or contract kinds (`TOOL`, `LLM`, ...). */
|
|
2065
|
-
kind?: string;
|
|
2066
|
-
startedAt?: number;
|
|
2067
|
-
endedAt?: number;
|
|
2068
|
-
status?: string;
|
|
2069
|
-
error?: string;
|
|
2070
|
-
/** Typed field on eval-side ToolSpans; OTLP flattenings drop it (see
|
|
2071
|
-
* {@link contractSpanToolName}). */
|
|
2072
|
-
toolName?: string;
|
|
2073
|
-
/** Typed field on eval-side LlmSpans. */
|
|
2074
|
-
model?: string;
|
|
2075
|
-
inputTokens?: number;
|
|
2076
|
-
outputTokens?: number;
|
|
2077
|
-
/** Typed field on eval-side ToolSpans. */
|
|
2078
|
-
args?: unknown;
|
|
2079
|
-
/** False when the source observed the call but did not capture its arguments. */
|
|
2080
|
-
argsCaptured?: boolean;
|
|
2081
|
-
attributes?: Record<string, unknown>;
|
|
2082
|
-
}
|
|
2083
|
-
/**
|
|
2084
|
-
* The run a `run` rule reads. The eval-side `Run` satisfies it. When no run is
|
|
2085
|
-
* passed, the checker derives it from the trace's single root span; a trace
|
|
2086
|
-
* with no unique root leaves the run unknown and every `run` rule fails.
|
|
2087
|
-
*/
|
|
2088
|
-
interface ContractRun {
|
|
2089
|
-
status?: string;
|
|
2090
|
-
startedAt?: number;
|
|
2091
|
-
endedAt?: number;
|
|
2092
|
-
}
|
|
2093
|
-
/** JSON-safe RegExp form — what the builder normalizes RegExp matchers to. */
|
|
2094
|
-
interface SerializedRegex {
|
|
2095
|
-
$regex: string;
|
|
2096
|
-
flags: string;
|
|
2097
|
-
}
|
|
2098
|
-
/** Matches when the value equals one of the listed strings. */
|
|
2099
|
-
interface OneOfMatcher {
|
|
2100
|
-
oneOf: string[];
|
|
2101
|
-
}
|
|
2102
|
-
type TextMatcher = string | RegExp | SerializedRegex | OneOfMatcher;
|
|
2103
|
-
/**
|
|
2104
|
-
* Proposition over one span. All specified fields must match (AND); `not`
|
|
2105
|
-
* must NOT match. At least one field is required — an empty predicate would
|
|
2106
|
-
* match every span and is rejected.
|
|
2107
|
-
*
|
|
2108
|
-
* `kind` compares against the span's contract kind (`TOOL`, `LLM`, `AGENT`,
|
|
2109
|
-
* ...), resolved by agent-trace-contract's classifier, so eval kinds
|
|
2110
|
-
* (`tool`, `llm`) and OTLP spans that declare no kind are read the same way.
|
|
2111
|
-
*
|
|
2112
|
-
* `tool` resolves through {@link contractSpanToolName}; `model` through the
|
|
2113
|
-
* typed `model` field and the gen_ai model attributes.
|
|
2114
|
-
*
|
|
2115
|
-
* `attr` values match by strict equality, or regex-test when the value is a
|
|
2116
|
-
* RegExp/SerializedRegex and the attribute is a string. Structured attribute
|
|
2117
|
-
* values need `custom`, or an `argument` rule for tool arguments.
|
|
2118
|
-
*/
|
|
2119
|
-
interface SpanPredicate {
|
|
2120
|
-
name?: TextMatcher;
|
|
2121
|
-
tool?: TextMatcher;
|
|
2122
|
-
model?: TextMatcher;
|
|
2123
|
-
kind?: SpanKind;
|
|
2124
|
-
attr?: Record<string, unknown>;
|
|
2125
|
-
not?: SpanPredicate;
|
|
2126
|
-
custom?: (span: ContractSpan) => boolean;
|
|
2127
|
-
/** Stamped by the builder when `custom` is present. Survives JSON while
|
|
2128
|
-
* the function does not, so evaluation of a deserialized contract throws
|
|
2129
|
-
* instead of silently dropping the check. */
|
|
2130
|
-
requiresCustom?: true;
|
|
2131
|
-
}
|
|
2132
|
-
declare const ORDER_MODES: readonly ["start-order", "finish-before-start", "all-occurrences"];
|
|
2133
|
-
type OrderMode = (typeof ORDER_MODES)[number];
|
|
2134
|
-
declare const ARGUMENT_OCCURRENCES: readonly ["first", "last", "any", "all"];
|
|
2135
|
-
type ArgumentOccurrence = (typeof ARGUMENT_OCCURRENCES)[number];
|
|
2136
|
-
declare const ARGUMENT_TYPES: readonly ["string", "number", "boolean", "object", "array", "null"];
|
|
2137
|
-
type ArgumentType = (typeof ARGUMENT_TYPES)[number];
|
|
2138
|
-
type ArgumentCheck = {
|
|
2139
|
-
op: 'exists';
|
|
2140
|
-
} | {
|
|
2141
|
-
op: 'equals';
|
|
2142
|
-
value: unknown;
|
|
2143
|
-
} | {
|
|
2144
|
-
op: 'oneOf';
|
|
2145
|
-
values: unknown[];
|
|
2146
|
-
} | {
|
|
2147
|
-
op: 'type';
|
|
2148
|
-
type: ArgumentType;
|
|
2149
|
-
};
|
|
2150
|
-
/** A tool whose calls change state outside the run. */
|
|
2151
|
-
interface RetryWrite {
|
|
2152
|
-
tool: string;
|
|
2153
|
-
/** RFC 6901 JSON Pointer to the idempotency key in the call's arguments.
|
|
2154
|
-
* Without it, a repeated call of this tool always fails. */
|
|
2155
|
-
idempotencyKey?: string;
|
|
2156
|
-
}
|
|
2157
|
-
interface RunChecks {
|
|
2158
|
-
/** The run's status is `completed` and its end time is recorded. A failed
|
|
2159
|
-
* or aborted run fails this check. */
|
|
2160
|
-
requireCompleted?: boolean;
|
|
2161
|
-
/** The run's status must be one of these. */
|
|
2162
|
-
allowedStatuses?: RunStatus[];
|
|
2163
|
-
/** End minus start, in milliseconds. An unknown duration fails. */
|
|
2164
|
-
maxDurationMs?: number;
|
|
2165
|
-
}
|
|
2166
|
-
type ContractRule = {
|
|
2167
|
-
kind: 'always' | 'never' | 'eventually';
|
|
2168
|
-
label: string;
|
|
2169
|
-
p: SpanPredicate;
|
|
2170
|
-
} | {
|
|
2171
|
-
kind: 'precedes';
|
|
2172
|
-
label: string;
|
|
2173
|
-
a: SpanPredicate;
|
|
2174
|
-
b: SpanPredicate;
|
|
2175
|
-
order?: OrderMode;
|
|
2176
|
-
} | {
|
|
2177
|
-
kind: 'neverUnless';
|
|
2178
|
-
label: string;
|
|
2179
|
-
p: SpanPredicate;
|
|
2180
|
-
prior: SpanPredicate;
|
|
2181
|
-
order?: OrderMode;
|
|
2182
|
-
} | {
|
|
2183
|
-
kind: 'atMost';
|
|
2184
|
-
label: string;
|
|
2185
|
-
p: SpanPredicate;
|
|
2186
|
-
max: number;
|
|
2187
|
-
} | {
|
|
2188
|
-
kind: 'tokensAtMost';
|
|
2189
|
-
label: string;
|
|
2190
|
-
p: SpanPredicate;
|
|
2191
|
-
max: number;
|
|
2192
|
-
} | ({
|
|
2193
|
-
kind: 'run';
|
|
2194
|
-
label: string;
|
|
2195
|
-
} & RunChecks) | {
|
|
2196
|
-
kind: 'argument';
|
|
2197
|
-
label: string;
|
|
2198
|
-
p: SpanPredicate;
|
|
2199
|
-
/** RFC 6901 JSON Pointer into the call's arguments; `''` is the whole value. */
|
|
2200
|
-
pointer: string;
|
|
2201
|
-
check: ArgumentCheck;
|
|
2202
|
-
/** Which matching calls must satisfy the check. Default `all`. */
|
|
2203
|
-
occurrence?: ArgumentOccurrence;
|
|
2204
|
-
} | {
|
|
2205
|
-
/**
|
|
2206
|
-
* The tools the harness offered the model (the OTel GenAI
|
|
2207
|
-
* `gen_ai.tool.definitions` attribute) are recorded, every tool call is
|
|
2208
|
-
* one of them, and, when `declared` is set, every offered tool is
|
|
2209
|
-
* declared. A trace that records no offered tools fails: what the
|
|
2210
|
-
* harness enforced is unknown.
|
|
2211
|
-
*/
|
|
2212
|
-
kind: 'toolsOffered';
|
|
2213
|
-
label: string;
|
|
2214
|
-
declared?: string[];
|
|
2215
|
-
} | {
|
|
2216
|
-
/**
|
|
2217
|
-
* A tool called again with the same arguments repeats its side effect.
|
|
2218
|
-
* A repeated `reads` call passes; a repeated `writes` call passes only
|
|
2219
|
-
* when every call carries the same idempotency key; a repeated call of
|
|
2220
|
-
* any other tool fails, because its side effect is unknown.
|
|
2221
|
-
*/
|
|
2222
|
-
kind: 'retrySafe';
|
|
2223
|
-
label: string;
|
|
2224
|
-
reads?: string[];
|
|
2225
|
-
writes?: RetryWrite[];
|
|
2226
|
-
};
|
|
2227
|
-
/** One legitimate alternate path. The contract passes only when the base
|
|
2228
|
-
* rules pass and at least one alternative passes completely. */
|
|
2229
|
-
interface ContractAlternative {
|
|
2230
|
-
id: string;
|
|
2231
|
-
rules: ContractRule[];
|
|
2232
|
-
}
|
|
2233
|
-
/** Serializable plain object — `traceContract(name)....build()` output. */
|
|
2234
|
-
interface TraceContract {
|
|
2235
|
-
name: string;
|
|
2236
|
-
/** What the contract protects, for reports and `explainTraceContract`. */
|
|
2237
|
-
description?: string;
|
|
2238
|
-
/** Evaluate only the span matching `root` and its descendants. Exactly one
|
|
2239
|
-
* span must match; zero or several make every rule an error. */
|
|
2240
|
-
scope?: {
|
|
2241
|
-
root: SpanPredicate;
|
|
2242
|
-
};
|
|
2243
|
-
rules: ContractRule[];
|
|
2244
|
-
alternatives?: ContractAlternative[];
|
|
2245
|
-
}
|
|
2246
|
-
type ContractStatus = 'pass' | 'fail' | 'error';
|
|
2247
|
-
interface ContractViolation {
|
|
2248
|
-
rule: string;
|
|
2249
|
-
spanId?: string;
|
|
2250
|
-
detail: string;
|
|
2251
|
-
}
|
|
2252
|
-
/** What happened to one rule. `error` means it could not be evaluated. */
|
|
2253
|
-
interface ContractRuleExecution {
|
|
2254
|
-
rule: string;
|
|
2255
|
-
/** Set for rules inside `alternatives`. */
|
|
2256
|
-
alternative?: string;
|
|
2257
|
-
status: ContractStatus;
|
|
2258
|
-
violations: number;
|
|
2259
|
-
error?: string;
|
|
2260
|
-
}
|
|
2261
|
-
interface ContractVerdict extends DefaultVerdict {
|
|
2262
|
-
/** Contract name — keys this verdict in multi-contract reports. */
|
|
2263
|
-
contract: string;
|
|
2264
|
-
status: ContractStatus;
|
|
2265
|
-
/** `status === 'pass'`. */
|
|
2266
|
-
valid: boolean;
|
|
2267
|
-
/** Fraction of rules that passed, in [0, 1]. An errored rule is not a pass. */
|
|
2268
|
-
score: number;
|
|
2269
|
-
/** 0|1 per evaluated base rule, keyed by label, plus `anyOf` when the
|
|
2270
|
-
* contract has alternatives. Errored rules are absent, never 0. */
|
|
2271
|
-
scores: Record<string, number>;
|
|
2272
|
-
violations: ContractViolation[];
|
|
2273
|
-
ruleExecutions: ContractRuleExecution[];
|
|
2274
|
-
/** Why rules errored, one line per errored rule or scope failure. */
|
|
2275
|
-
errors: string[];
|
|
2276
|
-
}
|
|
2277
|
-
interface ContractCheckResult {
|
|
2278
|
-
verdicts: ContractVerdict[];
|
|
2279
|
-
/** `error` if any verdict errored, else `fail` if any failed, else `pass`. */
|
|
2280
|
-
status: ContractStatus;
|
|
2281
|
-
allValid: boolean;
|
|
2282
|
-
}
|
|
2283
|
-
interface EvaluateTraceContractOptions {
|
|
2284
|
-
/** The run `run` rules read. Ignored under `scope`, where the scope root is the run. */
|
|
2285
|
-
run?: ContractRun;
|
|
2286
|
-
}
|
|
2287
|
-
interface OrderOptions {
|
|
2288
|
-
order?: OrderMode;
|
|
2289
|
-
}
|
|
2290
|
-
interface ArgumentRuleOptions {
|
|
2291
|
-
pointer: string;
|
|
2292
|
-
check: ArgumentCheck;
|
|
2293
|
-
occurrence?: ArgumentOccurrence;
|
|
2294
|
-
}
|
|
2295
|
-
declare class TraceContractBuilder {
|
|
2296
|
-
private readonly name;
|
|
2297
|
-
private readonly rules;
|
|
2298
|
-
private readonly alternativeList;
|
|
2299
|
-
private scopeRoot;
|
|
2300
|
-
constructor(name: string);
|
|
2301
|
-
/** Every span in the trace must satisfy `p`. */
|
|
2302
|
-
always(p: SpanPredicate, label?: string): this;
|
|
2303
|
-
/** No span in the trace may satisfy `p`. */
|
|
2304
|
-
never(p: SpanPredicate, label?: string): this;
|
|
2305
|
-
/** At least one span in the trace must satisfy `p`. */
|
|
2306
|
-
eventually(p: SpanPredicate, label?: string): this;
|
|
2307
|
-
/** Both `a` and `b` must occur, with `a` first under `options.order`
|
|
2308
|
-
* (default `start-order`). For "every `b` needs an earlier `a`, and a run
|
|
2309
|
-
* without `b` passes", use {@link neverUnless}. */
|
|
2310
|
-
precedes(a: SpanPredicate, b: SpanPredicate, label?: string, options?: OrderOptions): this;
|
|
2311
|
-
/** Every `p`-match needs an earlier `prior`-match; a run without `p` passes. */
|
|
2312
|
-
neverUnless(p: SpanPredicate, prior: SpanPredicate, label?: string, options?: OrderOptions): this;
|
|
2313
|
-
/** At most `max` spans may satisfy `p`. */
|
|
2314
|
-
atMost(p: SpanPredicate, max: number, label?: string): this;
|
|
2315
|
-
/** Spans satisfying `p` may use at most `max` input+output tokens in total. */
|
|
2316
|
-
tokensAtMost(p: SpanPredicate, max: number, label?: string): this;
|
|
2317
|
-
/** Terminal status and duration of the run. */
|
|
2318
|
-
run(checks: RunChecks, label?: string): this;
|
|
2319
|
-
/** A JSON Pointer check on the arguments of calls matching `p`. */
|
|
2320
|
-
argument(p: SpanPredicate, options: ArgumentRuleOptions, label?: string): this;
|
|
2321
|
-
/** The trace records the tools offered to the model, every call is one of
|
|
2322
|
-
* them, and, with `declared`, every offered tool is declared. */
|
|
2323
|
-
toolsOffered(declared?: string[], label?: string): this;
|
|
2324
|
-
/** No call repeats a side effect that is not proven safe to repeat. */
|
|
2325
|
-
retrySafe(options: {
|
|
2326
|
-
reads?: string[];
|
|
2327
|
-
writes?: RetryWrite[];
|
|
2328
|
-
}, label?: string): this;
|
|
2329
|
-
/** Evaluate only the subtree rooted at the one span matching `root`. */
|
|
2330
|
-
scope(root: SpanPredicate): this;
|
|
2331
|
-
/** A named alternate path; at least one alternative must pass completely. */
|
|
2332
|
-
alternative(id: string, define: (branch: TraceContractBuilder) => TraceContractBuilder): this;
|
|
2333
|
-
build(): TraceContract;
|
|
2334
|
-
private where;
|
|
2335
|
-
private add;
|
|
2336
|
-
}
|
|
2337
|
-
export declare function traceContract(name: string): TraceContractBuilder;
|
|
2338
|
-
/**
|
|
2339
|
-
* Evaluate one contract over a span sequence. Pure and synchronous — works on
|
|
2340
|
-
* `Span[]` from a TraceStore, `contractSpansFromOtlp` output, or any array
|
|
2341
|
-
* satisfying `ContractSpan`. Throws
|
|
2342
|
-
* `ValidationError` for a malformed contract; a rule that cannot be evaluated
|
|
2343
|
-
* is reported as `error` in the verdict instead.
|
|
2344
|
-
*/
|
|
2345
|
-
export declare function evaluateTraceContract(contract: TraceContract, spans: readonly ContractSpan[], options?: EvaluateTraceContractOptions): ContractVerdict;
|
|
2346
|
-
/**
|
|
2347
|
-
* Evaluate many contracts over one span sequence. Throws on an empty
|
|
2348
|
-
* contract list — `allValid: true` over zero contracts is a silent pass.
|
|
2349
|
-
*/
|
|
2350
|
-
export declare function checkTraceContracts(spans: readonly ContractSpan[], contracts: readonly TraceContract[], options?: EvaluateTraceContractOptions): ContractCheckResult;
|
|
2351
|
-
/** Plain-language statement of everything a contract checks, one rule per line. */
|
|
2352
|
-
export declare function explainTraceContract(contract: TraceContract): string;
|
|
2353
|
-
interface ToolArgumentSpec {
|
|
2354
|
-
tool: string;
|
|
2355
|
-
/** RFC 6901 JSON Pointer into the call's arguments; `''` is the whole value. */
|
|
2356
|
-
pointer: string;
|
|
2357
|
-
/** Which calls must satisfy the check. Default `all`. */
|
|
2358
|
-
occurrence?: ArgumentOccurrence;
|
|
2359
|
-
/** Exactly one of `exists`, `equals`, `oneOf`, `type`. */
|
|
2360
|
-
exists?: true;
|
|
2361
|
-
equals?: unknown;
|
|
2362
|
-
oneOf?: unknown[];
|
|
2363
|
-
type?: ArgumentType;
|
|
2364
|
-
}
|
|
2365
|
-
interface ToolsSpec {
|
|
2366
|
-
/** Each must be called at least once. */
|
|
2367
|
-
required?: string[];
|
|
2368
|
-
/** None may be called. */
|
|
2369
|
-
forbidden?: string[];
|
|
2370
|
-
/** Every tool call must name one of these; a call without a name fails. */
|
|
2371
|
-
allowed?: string[];
|
|
2372
|
-
/** Ceiling on tool calls of any name. */
|
|
2373
|
-
maxCalls?: number;
|
|
2374
|
-
/** Ceiling per tool name. */
|
|
2375
|
-
maxCallsPerTool?: Record<string, number>;
|
|
2376
|
-
/** Each tool is called, and each comes before the next under `orderMode`. */
|
|
2377
|
-
requiredOrder?: string[];
|
|
2378
|
-
/** Default `start-order`. */
|
|
2379
|
-
orderMode?: OrderMode;
|
|
2380
|
-
arguments?: ToolArgumentSpec[];
|
|
2381
|
-
/** The trace records the tools the harness offered the model
|
|
2382
|
-
* (`gen_ai.tool.definitions`), every call is one of them, and, with
|
|
2383
|
-
* `allowed`, every offered tool is allowed. */
|
|
2384
|
-
enforced?: true;
|
|
2385
|
-
}
|
|
2386
|
-
interface RetriesSpec {
|
|
2387
|
-
/** Tools that change nothing outside the run: repeating a call is safe. */
|
|
2388
|
-
reads?: string[];
|
|
2389
|
-
/** Tools that change state outside the run: a repeated call must carry one
|
|
2390
|
-
* idempotency key. Any other tool called twice with the same arguments fails. */
|
|
2391
|
-
writes?: RetryWrite[];
|
|
2392
|
-
}
|
|
2393
|
-
interface LlmSpec {
|
|
2394
|
-
maxCalls?: number;
|
|
2395
|
-
/** Input plus output tokens across LLM calls; an unrecorded count fails. */
|
|
2396
|
-
maxTotalTokens?: number;
|
|
2397
|
-
/** Every LLM call must name one of these models; a call without one fails. */
|
|
2398
|
-
allowedModels?: string[];
|
|
2399
|
-
}
|
|
2400
|
-
/** The checks one path carries: the base contract or one alternative. */
|
|
2401
|
-
interface PathSpec {
|
|
2402
|
-
run?: RunChecks;
|
|
2403
|
-
tools?: ToolsSpec;
|
|
2404
|
-
llm?: LlmSpec;
|
|
2405
|
-
retries?: RetriesSpec;
|
|
2406
|
-
/** Low-level rules in their serialized form. */
|
|
2407
|
-
rules?: ContractRule[];
|
|
2408
|
-
}
|
|
2409
|
-
interface AlternativeSpec extends PathSpec {
|
|
2410
|
-
id: string;
|
|
2411
|
-
}
|
|
2412
|
-
interface TraceContractSpec extends PathSpec {
|
|
2413
|
-
name: string;
|
|
2414
|
-
description?: string;
|
|
2415
|
-
/** Check only the one span matching `root` and its descendants: one
|
|
2416
|
-
* sub-agent (`{ "kind": "AGENT", "name": "researcher" }`) or one search
|
|
2417
|
-
* node (`{ "attr": { "agent.branch.id": "n7" } }`). */
|
|
2418
|
-
scope?: {
|
|
2419
|
-
root: SpanPredicate;
|
|
2420
|
-
};
|
|
2421
|
-
/** At least one alternative must pass completely, as well as the base checks. */
|
|
2422
|
-
alternatives?: {
|
|
2423
|
-
anyOf: AlternativeSpec[];
|
|
2424
|
-
};
|
|
2425
|
-
}
|
|
2426
|
-
/**
|
|
2427
|
-
* Parse and compile a declarative contract. Throws `ValidationError` naming
|
|
2428
|
-
* the path of the first problem: an unknown key, a wrong type, an unknown
|
|
2429
|
-
* status, or a contract that checks nothing.
|
|
2430
|
-
*/
|
|
2431
|
-
export declare function compileTraceContractSpec(input: unknown): TraceContract;
|
|
2432
|
-
interface ContractLintFinding {
|
|
2433
|
-
/** `error`: the contract can never pass, or contradicts itself.
|
|
2434
|
-
* `warning`: the contract works but likely does not say what was meant. */
|
|
2435
|
-
level: 'error' | 'warning';
|
|
2436
|
-
code: string;
|
|
2437
|
-
path: string;
|
|
2438
|
-
message: string;
|
|
2439
|
-
}
|
|
2440
|
-
/**
|
|
2441
|
-
* Find contradictions and likely mistakes in a declarative contract. Parses
|
|
2442
|
-
* strictly first, so a malformed spec throws instead of linting.
|
|
2443
|
-
*/
|
|
2444
|
-
export declare function lintTraceContractSpec(input: unknown): ContractLintFinding[];
|
|
2445
|
-
interface ActionExecutionPolicy {
|
|
2446
|
-
allowedTypes?: string[];
|
|
2447
|
-
blockedTypes?: string[];
|
|
2448
|
-
alwaysRequireApprovalTypes?: string[];
|
|
2449
|
-
autoApproveTypes?: string[];
|
|
2450
|
-
requireApprovalForExternalSideEffects?: boolean;
|
|
2451
|
-
requireApprovalAboveCostUsd?: number;
|
|
2452
|
-
maxActionCostUsd?: number;
|
|
2453
|
-
remainingBudgetUsd?: number;
|
|
2454
|
-
expectedOutcomeRequired?: boolean;
|
|
2455
|
-
killCriteriaRequired?: boolean;
|
|
2456
|
-
}
|
|
2457
|
-
interface ActionPolicyDecision {
|
|
2458
|
-
allowed: boolean;
|
|
2459
|
-
blocked: boolean;
|
|
2460
|
-
requiresApproval: boolean;
|
|
2461
|
-
reasons: string[];
|
|
2462
|
-
label?: FeedbackLabel;
|
|
2463
|
-
}
|
|
2464
|
-
export declare function evaluateActionPolicy(action: ProposedSideEffect, policy?: ActionExecutionPolicy, options?: {
|
|
2465
|
-
createdAt?: string;
|
|
2466
|
-
}): ActionPolicyDecision;
|
|
2467
|
-
interface CanaryLeak {
|
|
2468
|
-
scenarioId: string;
|
|
2469
|
-
canary: string;
|
|
2470
|
-
runId?: string;
|
|
2471
|
-
evidence: string;
|
|
2472
|
-
}
|
|
2473
|
-
export declare function checkCanaries(output: string, scenarios: DatasetScenario[]): CanaryLeak[];
|
|
2474
|
-
type DeployFamily = 'frontend-static' | 'nextjs' | 'remix' | 'fullstack-ts';
|
|
2475
|
-
interface DeployRunResult {
|
|
2476
|
-
ok: boolean;
|
|
2477
|
-
/** Stdout/stderr tail surfaced as evidence. Bounded in caller. */
|
|
2478
|
-
output?: string;
|
|
2479
|
-
/** Wall-clock duration of the build command. */
|
|
2480
|
-
durationMs?: number;
|
|
2481
|
-
/** Path to artifact directory the runner expects (dist/, .next/, build/, etc). */
|
|
2482
|
-
artifactDir?: string;
|
|
2483
|
-
/** True iff artifactDir contains the family's expected entry point. */
|
|
2484
|
-
artifactValid?: boolean;
|
|
2485
|
-
}
|
|
2486
|
-
interface DeployRunner {
|
|
2487
|
-
/** Run the production build. The runner owns command + cwd. */
|
|
2488
|
-
run(): Promise<DeployRunResult>;
|
|
2489
|
-
}
|
|
2490
|
-
interface DeployGateLayerInput {
|
|
2491
|
-
/** Build the runner per call. */
|
|
2492
|
-
runner: () => DeployRunner | Promise<DeployRunner>;
|
|
2493
|
-
/** Family hint — for logging, surfaced in diagnostics. */
|
|
2494
|
-
family?: DeployFamily;
|
|
2495
|
-
/** Layer name. Default `deploy`. */
|
|
2496
|
-
name?: string;
|
|
2497
|
-
/** Layer dependencies — default `['build']`. */
|
|
2498
|
-
dependsOn?: string[];
|
|
2499
|
-
/** Weight in blendedScore. Default 1. */
|
|
2500
|
-
weight?: number;
|
|
2501
|
-
/** Cap (ms). Default 120s — prod builds are slower than dev. */
|
|
2502
|
-
capMs?: number;
|
|
2503
|
-
/** When true, treat artifactValid=false as a fail (default true). */
|
|
2504
|
-
requireArtifact?: boolean;
|
|
2505
|
-
}
|
|
2506
|
-
/**
|
|
2507
|
-
* Build a deploy gate layer that runs the production build and verifies
|
|
2508
|
-
* the artifact. Pass: ok && artifactValid. Score: 1.0 (pass) or 0 (fail).
|
|
2509
|
-
*
|
|
2510
|
-
* For families where artifact-validation isn't applicable (e.g. a
|
|
2511
|
-
* server-rendered build that prints a manifest), set `requireArtifact:
|
|
2512
|
-
* false` and rely on the runner's own ok signal.
|
|
2513
|
-
*/
|
|
2514
|
-
export declare function deployGateLayer<Env = unknown>(input: DeployGateLayerInput): Layer<Env>;
|
|
2515
|
-
interface ViteDeployRunnerInput {
|
|
2516
|
-
/** Workdir to build. The runner cd's here. */
|
|
2517
|
-
workdir: string;
|
|
2518
|
-
/**
|
|
2519
|
-
* Function to run a shell command in `workdir`. Same shape as
|
|
2520
|
-
* agent-eval's CommandRunner.run for compositional reuse.
|
|
2521
|
-
*/
|
|
2522
|
-
exec: (cmd: string, opts?: {
|
|
2523
|
-
cwd?: string;
|
|
2524
|
-
timeoutMs?: number;
|
|
2525
|
-
}) => Promise<{
|
|
2526
|
-
stdout: string;
|
|
2527
|
-
stderr: string;
|
|
2528
|
-
exitCode: number;
|
|
2529
|
-
}>;
|
|
2530
|
-
/**
|
|
2531
|
-
* Function to test whether a path exists in the workdir. Inject
|
|
2532
|
-
* `(p) => existsSync(join(workdir, p))` for host runs.
|
|
2533
|
-
*/
|
|
2534
|
-
exists: (relativePath: string) => boolean | Promise<boolean>;
|
|
2535
|
-
/** Build command. Default `npm run build`. */
|
|
2536
|
-
buildCommand?: string;
|
|
2537
|
-
/** Artifact directory to validate. Default `dist`. */
|
|
2538
|
-
artifactDir?: string;
|
|
2539
|
-
/** Entry-point file under artifactDir. Default `index.html`. */
|
|
2540
|
-
artifactEntry?: string;
|
|
2541
|
-
/** Per-build cap (ms). Default 90s. */
|
|
2542
|
-
timeoutMs?: number;
|
|
2543
|
-
}
|
|
2544
|
-
/**
|
|
2545
|
-
* Canonical runner for `frontend-static` family — runs the build script,
|
|
2546
|
-
* validates `<artifactDir>/<artifactEntry>` exists. Use as the `runner:`
|
|
2547
|
-
* factory for {@link deployGateLayer}.
|
|
2548
|
-
*/
|
|
2549
|
-
export declare function viteDeployRunner(input: ViteDeployRunnerInput): DeployRunner;
|
|
2550
|
-
interface WranglerDeployRunnerInput {
|
|
2551
|
-
workdir: string;
|
|
2552
|
-
exec: (cmd: string, opts?: {
|
|
2553
|
-
cwd?: string;
|
|
2554
|
-
timeoutMs?: number;
|
|
2555
|
-
}) => Promise<{
|
|
2556
|
-
stdout: string;
|
|
2557
|
-
stderr: string;
|
|
2558
|
-
exitCode: number;
|
|
2559
|
-
}>;
|
|
2560
|
-
exists: (relativePath: string) => boolean | Promise<boolean>;
|
|
2561
|
-
/** Build command. Default `npm run build`. */
|
|
2562
|
-
buildCommand?: string;
|
|
2563
|
-
/** Wrangler dry-run command. Default `npx wrangler deploy --dry-run --outdir dist`. */
|
|
2564
|
-
dryRunCommand?: string;
|
|
2565
|
-
/** Per-step cap (ms). Default 120s. */
|
|
2566
|
-
timeoutMs?: number;
|
|
2567
|
-
}
|
|
2568
|
-
/**
|
|
2569
|
-
* Canonical runner for the `fullstack-ts` family on Cloudflare Workers
|
|
2570
|
-
* (Remix / React Router v7 / Hono on Workers). Detects wrangler.toml or
|
|
2571
|
-
* wrangler.jsonc in the workdir, builds, then `wrangler deploy --dry-run`
|
|
2572
|
-
* to catch missing bindings, syntax errors in wrangler config, and
|
|
2573
|
-
* import-time crashes that don't surface in `tsc`.
|
|
2574
|
-
*
|
|
2575
|
-
* No wrangler config = skip with "no wrangler" evidence (not a failure
|
|
2576
|
-
* — the gate caller decides whether to require deploy validation).
|
|
2577
|
-
*/
|
|
2578
|
-
export declare function wranglerDeployRunner(input: WranglerDeployRunnerInput): DeployRunner;
|
|
2579
|
-
/**
|
|
2580
|
-
* Hidden-criteria grading firewall — grade an agent on criteria it never saw.
|
|
2581
|
-
*
|
|
2582
|
-
* A trustworthy benchmark splits every scenario's data by WHERE each field is
|
|
2583
|
-
* allowed to flow, then proves the held-out / judge-only fields never reach the
|
|
2584
|
-
* agent during the run. The coding bench expresses this with four destinations
|
|
2585
|
-
* (prompt / develop-against / held-out suite / rubric); this module lifts the
|
|
2586
|
-
* domain-FREE core out of it so research, legal, tax, content — any domain —
|
|
2587
|
-
* can declare the same routing and get the same firewall enforcement and the
|
|
2588
|
-
* same held-out-weighted composite, plugging in its OWN grader.
|
|
2589
|
-
*
|
|
2590
|
-
* Two reusable pieces, both domain-agnostic:
|
|
2591
|
-
*
|
|
2592
|
-
* 1. FIELD ROUTING BY DESTINATION. A scenario declares each field's
|
|
2593
|
-
* `FieldDestination`; `assertNoHiddenLeak` is a pure checker that throws if
|
|
2594
|
-
* a grading-only or judge-only field's value appears in what reaches the
|
|
2595
|
-
* agent. The domain decides which fields exist and where they go — the
|
|
2596
|
-
* substrate only enforces "hidden stays hidden".
|
|
2597
|
-
*
|
|
2598
|
-
* 2. HIDDEN-CRITERIA GRADING. The domain supplies its own grader
|
|
2599
|
-
* `(artifact, hiddenCriteria) => { passRate, total }` — the coding
|
|
2600
|
-
* node-test executor is ONE such grader a consumer plugs in; the substrate
|
|
2601
|
-
* bakes in NO node/test/TS/exec/regex. `gradeOnHidden` runs that grader
|
|
2602
|
-
* behind the firewall and `blendHeldout` composes its pass rate with a
|
|
2603
|
-
* judge score into the final number the leaderboard ranks on.
|
|
2604
|
-
*
|
|
2605
|
-
* Shape mirrors `treatment-gate`/`authenticity`: pure predicates and pure
|
|
2606
|
-
* composition over already-computed values, fail-loud, with the
|
|
2607
|
-
* "which field / which weight / which grader" decisions left as parameters and
|
|
2608
|
-
* no domain literal anywhere in the module.
|
|
2609
|
-
*
|
|
2610
|
-
* Lives next to `test-graded-scenario` and `partition-held-out` — it is a
|
|
2611
|
-
* scorecard/grading concept that makes sense without a running agent loop.
|
|
2612
|
-
*/
|
|
2613
|
-
/**
|
|
2614
|
-
* Where one scenario field is allowed to flow. The firewall guarantee is keyed
|
|
2615
|
-
* on this tag, not on a field name — a domain can have any number of fields per
|
|
2616
|
-
* destination.
|
|
2617
|
-
*
|
|
2618
|
-
* - `agent-visible` reaches the agent's context during the run (the prompt,
|
|
2619
|
-
* the task statement — what the agent reads to act).
|
|
2620
|
-
* - `develop-against` seeded into the agent's environment during the run so it
|
|
2621
|
-
* can iterate (a visible example/test/reference). The
|
|
2622
|
-
* agent MAY read it — that is intentional (real TDD). Not
|
|
2623
|
-
* a leak: it is example-grade, not the grading criteria.
|
|
2624
|
-
* - `grading-only` the hidden criteria. Used ONLY at grading, after the run
|
|
2625
|
-
* — the held-out suite / answer key / hidden requirements.
|
|
2626
|
-
* Must NEVER reach the agent context. This is what makes a
|
|
2627
|
-
* good score un-memorizable.
|
|
2628
|
-
* - `judge-only` grading context for the judge only (rubric anchors,
|
|
2629
|
-
* design intent). Lives with the judge, never in the agent
|
|
2630
|
-
* context.
|
|
2631
|
-
*/
|
|
2632
|
-
type FieldDestination = 'agent-visible' | 'develop-against' | 'grading-only' | 'judge-only';
|
|
2633
|
-
/**
|
|
2634
|
-
* A scenario's fields routed by destination. The domain owns the field set
|
|
2635
|
-
* (`TFields` — a record of its named fields to their string-renderable values)
|
|
2636
|
-
* and declares one `FieldDestination` per field. `routeFields` builds this from
|
|
2637
|
-
* a domain's `(value, destination)` map; the firewall reads it.
|
|
2638
|
-
*/
|
|
2639
|
-
interface RoutedField {
|
|
2640
|
-
/** The field's name — for diagnostics only. */
|
|
2641
|
-
name: string;
|
|
2642
|
-
/** The field's value as it would be rendered into text. The firewall compares
|
|
2643
|
-
* this against the agent context, so a domain that ships structured data
|
|
2644
|
-
* passes a stable string projection (e.g. JSON) of the hidden value. */
|
|
2645
|
-
value: string;
|
|
2646
|
-
destination: FieldDestination;
|
|
2647
|
-
}
|
|
2648
|
-
/** A single detected leak: a hidden field whose value appears in the agent context. */
|
|
2649
|
-
interface HiddenLeak {
|
|
2650
|
-
field: string;
|
|
2651
|
-
destination: FieldDestination;
|
|
2652
|
-
}
|
|
2653
|
-
interface NoLeakOptions {
|
|
2654
|
-
/** Minimum hidden-value length to check. A hidden value shorter than this is
|
|
2655
|
-
* skipped — a one-word or empty hidden field would substring-match innocuous
|
|
2656
|
-
* prose and is not meaningful evidence of a leak. Default 12. */
|
|
2657
|
-
minMatchLength?: number;
|
|
2658
|
-
}
|
|
2659
|
-
/**
|
|
2660
|
-
* The FIREWALL. Throws `ValidationError` if any `grading-only`/`judge-only`
|
|
2661
|
-
* field's value is found inside `agentContext` — the exact text that reaches the
|
|
2662
|
-
* agent during the run (its prompt, its seeded files concatenated, whatever the
|
|
2663
|
-
* caller assembled). `agent-visible` and `develop-against` fields are never
|
|
2664
|
-
* checked: they are meant to be there.
|
|
2665
|
-
*
|
|
2666
|
-
* Substring containment is the check: it is domain-free and catches the failure
|
|
2667
|
-
* that matters — a hidden answer key, held-out case, or rubric anchor pasted
|
|
2668
|
-
* into the prompt. Returns the routed fields on success so a caller can chain.
|
|
2669
|
-
*/
|
|
2670
|
-
export declare function assertNoHiddenLeak(fields: readonly RoutedField[], agentContext: string, opts?: NoLeakOptions): readonly RoutedField[];
|
|
2671
|
-
/** What a hidden-criteria grader reports. `passRate = passed / total` over the
|
|
2672
|
-
* hidden checks; `total === 0` means the criteria never ran (e.g. the artifact
|
|
2673
|
-
* did not even load) — an honest zero, never a spurious pass. */
|
|
2674
|
-
interface HiddenGradeResult {
|
|
2675
|
-
/** Hidden checks that passed. */
|
|
2676
|
-
passed: number;
|
|
2677
|
-
/** Total hidden checks attempted. 0 when the criteria could not run at all. */
|
|
2678
|
-
total: number;
|
|
2679
|
-
/** `passed / total`, or 0 when `total === 0`. The PRIMARY correctness score. */
|
|
2680
|
-
passRate: number;
|
|
2681
|
-
/** Free-form provenance the caller may record (runner output, reason for 0). */
|
|
2682
|
-
notes?: string;
|
|
2683
|
-
}
|
|
2684
|
-
/**
|
|
2685
|
-
* The domain's grader: given the agent's artifact and the HIDDEN criteria,
|
|
2686
|
-
* return a pass rate. This is the ONE seam a non-coding domain implements — the
|
|
2687
|
-
* coding node-test executor is a single implementation of it; a legal grader
|
|
2688
|
-
* checks the brief against hidden required holdings, a research grader checks an
|
|
2689
|
-
* answer against held-out facts, a tax grader runs hidden return assertions.
|
|
2690
|
-
* The substrate calls it ONLY at grading time, behind the firewall.
|
|
2691
|
-
*
|
|
2692
|
-
* `THidden` is the domain's hidden-criteria payload (the held-out suite, the
|
|
2693
|
-
* answer key, the hidden requirements) — opaque to the substrate.
|
|
2694
|
-
*/
|
|
2695
|
-
type HiddenCriteriaGrader<TArtifact, THidden> = (artifact: TArtifact, hiddenCriteria: THidden, signal?: AbortSignal) => Promise<HiddenGradeResult> | HiddenGradeResult;
|
|
2696
|
-
/** Weights for the held-out / judge blend. Must be finite and non-negative;
|
|
2697
|
-
* they are renormalized to sum to 1 so a caller can pass any positive ratio. */
|
|
2698
|
-
interface BlendWeights {
|
|
2699
|
-
/** Weight on the hidden-criteria pass rate (the primary, ungameable score). */
|
|
2700
|
-
heldout: number;
|
|
2701
|
-
/** Weight on the judge's quality composite (the secondary style/quality score). */
|
|
2702
|
-
judge: number;
|
|
2703
|
-
}
|
|
2704
|
-
/** The input shape a judge's `score` receives — exactly `JudgeConfig.score`'s
|
|
2705
|
-
* argument: the artifact, plus any scenario/signal fields the judge carries.
|
|
2706
|
-
* `withHeldoutBlend` only reads `artifact`; the rest rides through. */
|
|
2707
|
-
interface JudgeScoreInput<TArtifact> {
|
|
2708
|
-
artifact: TArtifact;
|
|
2709
|
-
/** Pass-through for the judge's extra input fields (scenario, signal). */
|
|
2710
|
-
[key: string]: unknown;
|
|
2711
|
-
}
|
|
2712
|
-
/**
|
|
2713
|
-
* Compose the PRIMARY hidden-criteria pass rate with the SECONDARY judge
|
|
2714
|
-
* composite into the single score the leaderboard ranks on. Weights are
|
|
2715
|
-
* renormalized, so a solution that fails the hidden criteria is capped low no
|
|
2716
|
-
* matter how the judge felt about its style, while a stylistically-mediocre but
|
|
2717
|
-
* CORRECT solution still earns the bulk of the points. Both inputs are clamped
|
|
2718
|
-
* to [0,1] — a judge on a non-unit scale must be normalized by the caller first.
|
|
2719
|
-
*/
|
|
2720
|
-
export declare function blendHeldout(heldoutPassRate: number, judgeScore: number, weights?: BlendWeights): number;
|
|
2721
|
-
/**
|
|
2722
|
-
* Minimal backend-config shape the assertion reads. Consumers may pass richer
|
|
2723
|
-
* types — only these five fields are inspected.
|
|
2724
|
-
*/
|
|
2725
|
-
interface BackendDescriptor {
|
|
2726
|
-
/** Backend route — e.g. `'tcloud' | 'cli-bridge' | 'sandbox' | 'direct-provider'`;
|
|
2727
|
-
* free-form for consumer extensibility. */
|
|
2728
|
-
kind: string;
|
|
2729
|
-
/** Resolved base URL. Compared lexically (trailing slash stripped). */
|
|
2730
|
-
baseUrl: string;
|
|
2731
|
-
/** Model id (with snapshot suffix). Compared lexically. */
|
|
2732
|
-
model: string;
|
|
2733
|
-
/** Optional provider override. Compared when both set; flagged when only
|
|
2734
|
-
* one side sets it. */
|
|
2735
|
-
provider?: string;
|
|
2736
|
-
/** Bearer token. Values are NEVER compared (security) — only that EITHER
|
|
2737
|
-
* both are set OR both are empty. Mismatched presence is a divergence. */
|
|
2738
|
-
apiKey?: string;
|
|
2739
|
-
}
|
|
2740
|
-
interface AssertSingleBackendOptions {
|
|
2741
|
-
/** When true, ANY field divergence fails. When false (default), only
|
|
2742
|
-
* `kind` / `baseUrl` / `provider` / `apiKeyPresence` divergence throws —
|
|
2743
|
-
* a different judge `model` on the same route is allowed (the legal
|
|
2744
|
-
* pattern: a cheaper judge model). */
|
|
2745
|
-
strict?: boolean;
|
|
2746
|
-
agentLabel?: string;
|
|
2747
|
-
judgeLabel?: string;
|
|
2748
|
-
}
|
|
2749
|
-
type SingleBackendField = 'kind' | 'baseUrl' | 'model' | 'provider' | 'apiKeyPresence';
|
|
2750
|
-
interface SingleBackendDivergence {
|
|
2751
|
-
field: SingleBackendField;
|
|
2752
|
-
agent: string | undefined;
|
|
2753
|
-
judge: string | undefined;
|
|
2754
|
-
}
|
|
2755
|
-
interface SingleBackendReport {
|
|
2756
|
-
/** True when agent + judge agree per the configured strictness. */
|
|
2757
|
-
ok: boolean;
|
|
2758
|
-
/** Every divergence detected (includes `model` even when non-blocking). */
|
|
2759
|
-
divergences: ReadonlyArray<SingleBackendDivergence>;
|
|
2760
|
-
}
|
|
2761
|
-
/**
|
|
2762
|
-
* Throw `SingleBackendError` when the agent and judge backends diverge in a
|
|
2763
|
-
* way that would re-route the judge through a different backend than the
|
|
2764
|
-
* agent. Returns the report so callers can log it in either case.
|
|
2765
|
-
*/
|
|
2766
|
-
export declare function assertSingleBackend(agent: BackendDescriptor, judge: BackendDescriptor, opts?: AssertSingleBackendOptions): SingleBackendReport;
|
|
2767
|
-
interface IntentMatchInput {
|
|
2768
|
-
/** The full natural-language prompt the agent was handed. */
|
|
2769
|
-
userRequest: string;
|
|
2770
|
-
/** Top-level source files from the agent's workdir. */
|
|
2771
|
-
sourceFiles: Array<{
|
|
2772
|
-
path: string;
|
|
2773
|
-
content: string;
|
|
2774
|
-
}>;
|
|
2775
|
-
/** Rendered HTML the preview returned, when available. */
|
|
2776
|
-
servedHtml?: string;
|
|
2777
|
-
/** Optional metadata to inject (id, vertical, difficulty). */
|
|
2778
|
-
artifactLabel?: string;
|
|
2779
|
-
artifactDescription?: string;
|
|
2780
|
-
}
|
|
2781
|
-
interface IntentMatchResult {
|
|
2782
|
-
kind: 'intent-match';
|
|
2783
|
-
version: string;
|
|
2784
|
-
/** 0..1 — 1 = unmistakably the right app, 0 = unrelated to the brief. */
|
|
2785
|
-
score: number;
|
|
2786
|
-
/** One-sentence rationale citing concrete evidence (file or HTML). */
|
|
2787
|
-
evidence: string;
|
|
2788
|
-
durationMs: number;
|
|
2789
|
-
costUsd: number | null;
|
|
2790
|
-
available: boolean;
|
|
2791
|
-
error?: string;
|
|
2792
|
-
}
|
|
2793
|
-
interface IntentMatchOptions {
|
|
2794
|
-
/** Caller-owned transport. Required: agent-eval executes no paid model. */
|
|
2795
|
-
chat: ChatClient;
|
|
2796
|
-
model?: string;
|
|
2797
|
-
timeoutMs?: number;
|
|
2798
|
-
maxTokens?: number;
|
|
2799
|
-
maxSourceChars?: number;
|
|
2800
|
-
maxPerFileChars?: number;
|
|
2801
|
-
maxHtmlChars?: number;
|
|
2802
|
-
/** Endpoint rates used when the transport reports no billed amount. */
|
|
2803
|
-
pricing?: CustomTokenPricing;
|
|
2804
|
-
costLedger?: CostLedgerHandle;
|
|
2805
|
-
costPhase?: string;
|
|
2806
|
-
costTags?: Record<string, string>;
|
|
2807
|
-
signal?: AbortSignal;
|
|
2808
|
-
}
|
|
2809
|
-
/**
|
|
2810
|
-
* Run the intent-match judge. Soft-fails to available=false on error.
|
|
2811
|
-
*/
|
|
2812
|
-
export declare function runIntentMatchJudge(input: IntentMatchInput, options: IntentMatchOptions): Promise<IntentMatchResult>;
|
|
2813
|
-
/** One judge's verdict. `perDimension: null` ⇒ that judge call failed (threw or
|
|
2814
|
-
* returned malformed output) — recorded, never folded into a zero. */
|
|
2815
|
-
interface JudgeVerdict<D extends string = string> {
|
|
2816
|
-
/** Judge identity (typically the model id) — the `perJudge` / `failedJudges` key. */
|
|
2817
|
-
model: string;
|
|
2818
|
-
/** Per-dimension scores, or `null` when the judge failed. */
|
|
2819
|
-
perDimension: Record<D, number> | null;
|
|
2820
|
-
/** Optional one-line rationale; the first non-empty one becomes the aggregate's. */
|
|
2821
|
-
rationale?: string;
|
|
2822
|
-
/** Optional reported cost, committed by the caller's CostLedger. */
|
|
2823
|
-
costUsd?: number;
|
|
2824
|
-
/** Optional provider usage, committed by the caller's CostLedger. */
|
|
2825
|
-
usage?: LlmUsage;
|
|
2826
|
-
/** Optional per-dimension reasoning/evidence. Carried through to
|
|
2827
|
-
* `EnsembleAggregate.verdicts` verbatim — never folded into the math. */
|
|
2828
|
-
detail?: Partial<Record<D, {
|
|
2829
|
-
reasoning?: string;
|
|
2830
|
-
evidence?: string;
|
|
2831
|
-
}>>;
|
|
2832
|
-
}
|
|
2833
|
-
/** The aggregated ensemble result. */
|
|
2834
|
-
interface EnsembleAggregate<D extends string = string> {
|
|
2835
|
-
/** Mean over SURVIVING judges, per dimension (absent-everywhere ⇒ 0). */
|
|
2836
|
-
perDimension: Record<D, number>;
|
|
2837
|
-
/** Weighted mean of `perDimension` (uniform unless `weights` given). */
|
|
2838
|
-
composite: number;
|
|
2839
|
-
/** Each surviving judge's clamped per-dimension scores, for trace drill-down. */
|
|
2840
|
-
perJudge: Record<string, Record<D, number>>;
|
|
2841
|
-
/** Max over dimensions of (max − min) across survivors — the inter-rater signal. */
|
|
2842
|
-
maxDisagreement: number;
|
|
2843
|
-
/** Models whose verdict was null (failed). */
|
|
2844
|
-
failedJudges: string[];
|
|
2845
|
-
/** First non-empty survivor rationale, or `'llm-judge'`. */
|
|
2846
|
-
rationale: string;
|
|
2847
|
-
/** The input verdicts, verbatim — drill-down to raw scores, `detail`
|
|
2848
|
-
* reasoning/evidence, and per-verdict cost without re-running judges. */
|
|
2849
|
-
verdicts: JudgeVerdict<D>[];
|
|
2850
|
-
}
|
|
2851
|
-
/**
|
|
2852
|
-
* Reduce per-judge verdicts to one aggregate. Generic over the rubric: pass the
|
|
2853
|
-
* stable-ordered `dimensionKeys` the judges scored.
|
|
2854
|
-
*
|
|
2855
|
-
* - Per-dimension score = mean over surviving judges (out-of-range clamped to [0,1]).
|
|
2856
|
-
* - `composite` = `weightedComposite` of `perDimension`. No `weights` ⇒ uniform
|
|
2857
|
-
* over every dimension. A partial `weights` map selects AND weights exactly the
|
|
2858
|
-
* named dimensions (others excluded from the composite) — the substrate's
|
|
2859
|
-
* sum-normalized weighting, not re-implemented here.
|
|
2860
|
-
* - Throws if `verdicts` or `dimensionKeys` is empty, or if every judge failed.
|
|
2861
|
-
*/
|
|
2862
|
-
export declare function aggregateJudgeVerdicts<D extends string>(verdicts: readonly JudgeVerdict<D>[], dimensionKeys: readonly D[], weights?: Partial<Record<D, number>>): EnsembleAggregate<D>;
|
|
2863
|
-
/**
|
|
2864
|
-
* Wrap a single judge LLM call with retry, optional fallback-model
|
|
2865
|
-
* rotation, exponential backoff, and a typed `JudgeRetryOutcome`. Callers
|
|
2866
|
-
* MUST inspect `succeeded` before using `value`; on failure the library
|
|
2867
|
-
* returns `value: null` rather than substituting a default, so a judge
|
|
2868
|
-
* abort cannot silently corrupt a downstream composite.
|
|
2869
|
-
*
|
|
2870
|
-
* Reporting contract: callers ship `TrialResult.judgeSucceeded = succeeded`
|
|
2871
|
-
* and `TrialResult.judgeAttempts = attempts` so `aggregateTrialsByMode`
|
|
2872
|
-
* with `mode: 'exclude-failed'` drops the trial.
|
|
2873
|
-
*/
|
|
2874
|
-
/** Retry policy for judge LLM calls. */
|
|
2875
|
-
interface JudgeRetryPolicy {
|
|
2876
|
-
/** Max attempts per model. Default 3 (one initial + two retries). */
|
|
2877
|
-
maxAttempts?: number;
|
|
2878
|
-
/** Per-attempt timeout in ms. Default 300_000. */
|
|
2879
|
-
timeoutMs?: number;
|
|
2880
|
-
/**
|
|
2881
|
-
* Models to try, in order. The first model is the primary; subsequent
|
|
2882
|
-
* models are fallbacks invoked only when ALL retries on the previous
|
|
2883
|
-
* model have been exhausted. Example: `['claude-code/sonnet', 'kimi-code/k2p6']`
|
|
2884
|
-
* runs claude-code up to maxAttempts times, then falls back to kimi.
|
|
2885
|
-
* If omitted, the caller's judge function controls model selection and
|
|
2886
|
-
* the retries apply to that single model.
|
|
2887
|
-
*/
|
|
2888
|
-
models?: readonly string[];
|
|
2889
|
-
/** Exponential backoff function, default `attempt → min(500 * 2^attempt, 16_000)`. */
|
|
2890
|
-
backoffMs?: (attempt: number) => number;
|
|
2891
|
-
/**
|
|
2892
|
-
* Predicate deciding whether an error should trigger a retry. Defaults to
|
|
2893
|
-
* `isTransientLlmError` — the package-wide classifier shared with
|
|
2894
|
-
* `callLlm` — which retries aborts/timeouts, network faults, HTTP/2
|
|
2895
|
-
* transport faults, and any `LlmCallError` with status in {429,502,503,504}.
|
|
2896
|
-
* JSON-parse and schema-rejection errors are NOT retriable (the model
|
|
2897
|
-
* needs prompt adjustment, not another shot).
|
|
2898
|
-
*/
|
|
2899
|
-
isRetryable?: (err: unknown) => boolean;
|
|
2900
|
-
}
|
|
2901
|
-
/** Outcome of a wrapped judge invocation. */
|
|
2902
|
-
interface JudgeRetryOutcome<T> {
|
|
2903
|
-
/** The judge's returned value when `succeeded === true`. */
|
|
2904
|
-
value: T | null;
|
|
2905
|
-
/** True iff one of the attempts completed without throwing. */
|
|
2906
|
-
succeeded: boolean;
|
|
2907
|
-
/** Total attempts made across all models. */
|
|
2908
|
-
attempts: number;
|
|
2909
|
-
/** Which model the successful attempt used (when succeeded). */
|
|
2910
|
-
modelUsed?: string;
|
|
2911
|
-
/** Last error captured when `succeeded === false`. */
|
|
2912
|
-
error?: Error;
|
|
2913
|
-
/** Per-attempt error log for forensics. */
|
|
2914
|
-
attemptErrors: Array<{
|
|
2915
|
-
attempt: number;
|
|
2916
|
-
model: string;
|
|
2917
|
-
error: string;
|
|
2918
|
-
}>;
|
|
2919
|
-
}
|
|
2920
|
-
/**
|
|
2921
|
-
* Wrap a judge call with retry + fallback-model + typed outcome semantics.
|
|
2922
|
-
*
|
|
2923
|
-
* The `judgeFn` signature is `(model: string, signal: AbortSignal) => Promise<T>`.
|
|
2924
|
-
* The signal will be aborted at `timeoutMs`. Callers should pass the signal
|
|
2925
|
-
* to their underlying fetch/SDK call so the abort actually fires.
|
|
2926
|
-
*
|
|
2927
|
-
* Returns a typed outcome — callers MUST inspect `succeeded` before using
|
|
2928
|
-
* `value`. The library refuses to default to a silent zero score because a
|
|
2929
|
-
* synthetic zero is indistinguishable from a real low score downstream.
|
|
2930
|
-
*/
|
|
2931
|
-
export declare function withJudgeRetry<T>(judgeFn: (model: string, signal: AbortSignal) => Promise<T>, policy?: JudgeRetryPolicy): Promise<JudgeRetryOutcome<T>>;
|
|
2932
|
-
interface EnsembleJudgeOptions<D extends string> {
|
|
2933
|
-
/** Judge name — becomes the returned `JudgeConfig.name`. */
|
|
2934
|
-
name: string;
|
|
2935
|
-
/** Rubric dimensions every model scores. Keys of the verdict's `perDimension`. */
|
|
2936
|
-
dimensions: D[];
|
|
2937
|
-
/** Judge model ids — one `scoreWith` call per entry. List a model twice to
|
|
2938
|
-
* sample it twice (votes are suffix-keyed `model#2` so none overwrite). */
|
|
2939
|
-
models: string[];
|
|
2940
|
-
/** Explicit scoring revision for closure state not visible in the static panel config. */
|
|
2941
|
-
judgeVersion?: string;
|
|
2942
|
-
/**
|
|
2943
|
-
* Score the artifact with one model. Throw (or reject) on failure — the
|
|
2944
|
-
* panel records that model as a failed judge; it is never folded into a
|
|
2945
|
-
* zero. Verdict scores are clamped to [0,1] by the reducer.
|
|
2946
|
-
*/
|
|
2947
|
-
scoreWith: (model: string, input: {
|
|
2948
|
-
artifact: unknown;
|
|
2949
|
-
scenario?: unknown;
|
|
2950
|
-
signal: AbortSignal;
|
|
2951
|
-
}) => Promise<JudgeVerdict<D>>;
|
|
2952
|
-
/** Recover usage from a failed provider response when its error retains one. */
|
|
2953
|
-
receiptFromError?: (error: Error, model: string) => CostReceiptInput | undefined;
|
|
2954
|
-
/** Used by direct score calls; campaigns supply their run ledger in score(). */
|
|
2955
|
-
costLedger?: CostLedgerHandle;
|
|
2956
|
-
/** Required per model when the shared ledger has a dollar cap. */
|
|
2957
|
-
maximumCharge?: MaximumCharge | ((model: string) => MaximumCharge);
|
|
2958
|
-
/**
|
|
2959
|
-
* Per-model retry policy, applied via `withJudgeRetry`. The panel's
|
|
2960
|
-
* `models` list drives the fan-out, so `retry.models` (the fallback
|
|
2961
|
-
* rotation) is overridden to each panel model in turn.
|
|
2962
|
-
*/
|
|
2963
|
-
retry?: JudgeRetryPolicy;
|
|
2964
|
-
/** Enforce `assertCrossFamily` over `models` at construction. Default true.
|
|
2965
|
-
* Opt out only for deliberate single-family panels (e.g. self-consistency
|
|
2966
|
-
* sampling of one model).
|
|
2967
|
-
*
|
|
2968
|
-
* Construction-time only, over the REQUESTED ids: it cannot see a gateway
|
|
2969
|
-
* that answers several ids from one provider. `scoreWith` owns the served
|
|
2970
|
-
* side — check the id the provider echoed with `assertServedModel`
|
|
2971
|
-
* (./integrity/served-model) inside your judge call. */
|
|
2972
|
-
crossFamily?: boolean;
|
|
2973
|
-
/** Composite weights forwarded to `aggregateJudgeVerdicts`: a partial map
|
|
2974
|
-
* selects AND weights exactly the named dimensions. Omit for uniform. */
|
|
2975
|
-
weights?: Partial<Record<D, number>>;
|
|
2976
|
-
}
|
|
2977
|
-
/**
|
|
2978
|
-
* Build a campaign-shaped `JudgeConfig` whose `score()` runs every panel
|
|
2979
|
-
* model in parallel and reduces the surviving verdicts to one canonical
|
|
2980
|
-
* `JudgeScore` in [0,1].
|
|
2981
|
-
*
|
|
2982
|
-
* Failure semantics: a model whose `scoreWith` throws (or exhausts `retry`)
|
|
2983
|
-
* lands in `failedJudges` and is excluded from the means. When EVERY model
|
|
2984
|
-
* fails, `aggregateJudgeVerdicts` throws — the campaign engine records a
|
|
2985
|
-
* failed cell instead of averaging a fabricated zero.
|
|
2986
|
-
*/
|
|
2987
|
-
export declare function ensembleJudge<D extends string>(opts: EnsembleJudgeOptions<D>): JudgeConfig<unknown>;
|
|
2988
|
-
/**
|
|
2989
|
-
* Keyword-coverage judge — baseline complement to the semantic concept
|
|
2990
|
-
* judge.
|
|
2991
|
-
*
|
|
2992
|
-
* Where {@link runSemanticConceptJudge} uses an LLM to read source code
|
|
2993
|
-
* and decide whether a concept is REALLY implemented (not just
|
|
2994
|
-
* keyword-mentioned), this judge does the cheap, deterministic version:
|
|
2995
|
-
* fetch the served preview, concatenate every linked CSS/JS asset, and
|
|
2996
|
-
* substring-match each expected concept's keywords against the
|
|
2997
|
-
* concatenated haystack. Optional `requiredElement` selector adds a
|
|
2998
|
-
* structural gate so "supply counter" can require an actual `<input>` or
|
|
2999
|
-
* `<table>`, not just a comment containing the word.
|
|
3000
|
-
*
|
|
3001
|
-
* Use both judges. Keyword coverage is a fast 0-cost gate — a stub page
|
|
3002
|
-
* with the right keywords passes here, fails the semantic judge. Score
|
|
3003
|
-
* divergence between the two is itself a signal: high keyword coverage
|
|
3004
|
-
* + low semantic = "the agent slapped the right words on the right
|
|
3005
|
-
* scaffold but didn't wire any of it up."
|
|
3006
|
-
*
|
|
3007
|
-
* Pure functions, soft-fail on fetch error, no LLM dependency.
|
|
3008
|
-
*/
|
|
3009
|
-
interface KeywordConceptSpec {
|
|
3010
|
-
name: string;
|
|
3011
|
-
keywords: string[];
|
|
3012
|
-
/**
|
|
3013
|
-
* Optional CSS selector that must match in the HTML for the concept
|
|
3014
|
-
* to count as present. Tiny subset:
|
|
3015
|
-
* - `tag` (e.g. `form`)
|
|
3016
|
-
* - `tag[attr="value"]` (e.g. `input[type="number"]`)
|
|
3017
|
-
* - `tag[attr]` (presence only)
|
|
3018
|
-
* Anything more complex is rejected with `null` (treated as
|
|
3019
|
-
* "unenforced", not "failed").
|
|
3020
|
-
*/
|
|
3021
|
-
requiredElement?: string;
|
|
3022
|
-
}
|
|
3023
|
-
interface KeywordCoverageFinding {
|
|
3024
|
-
concept: string;
|
|
3025
|
-
found: boolean;
|
|
3026
|
-
matchedKeywords: string[];
|
|
3027
|
-
/** True iff the optional requiredElement selector matched; null when no selector. */
|
|
3028
|
-
requiredElementPresent: boolean | null;
|
|
3029
|
-
}
|
|
3030
|
-
interface KeywordCoverageResult {
|
|
3031
|
-
/** 0..1 share of concepts satisfied. */
|
|
3032
|
-
score: number;
|
|
3033
|
-
presentCount: number;
|
|
3034
|
-
totalCount: number;
|
|
3035
|
-
findings: KeywordCoverageFinding[];
|
|
3036
|
-
durationMs: number;
|
|
3037
|
-
/** Total bytes assembled across html + linked assets. */
|
|
3038
|
-
totalAssembledBytes: number;
|
|
3039
|
-
/** Soft-failure reason if the audit couldn't run. */
|
|
3040
|
-
error?: string;
|
|
3041
|
-
}
|
|
3042
|
-
interface KeywordCoverageOptions {
|
|
3043
|
-
/** Override fetch implementation — for tests. */
|
|
3044
|
-
fetch?: typeof fetch;
|
|
3045
|
-
/** Per-asset fetch timeout (default 3s). */
|
|
3046
|
-
assetTimeoutMs?: number;
|
|
3047
|
-
/** Initial-HTML fetch timeout (default 5s). */
|
|
3048
|
-
htmlTimeoutMs?: number;
|
|
3049
|
-
}
|
|
3050
|
-
/**
|
|
3051
|
-
* Score expected concepts against an already-fetched HTML payload + any
|
|
3052
|
-
* pre-fetched CSS/JS assets. Use when the runner has the bytes in hand
|
|
3053
|
-
* and doesn't want a fresh HTTP round-trip — e.g. sandbox runtime where
|
|
3054
|
-
* the preview content was fetched via curl from inside the container.
|
|
3055
|
-
*/
|
|
3056
|
-
export declare function runKeywordCoverageJudge(html: string, expectedConcepts: ReadonlyArray<KeywordConceptSpec>, assets?: ReadonlyArray<string>): KeywordCoverageResult;
|
|
3057
|
-
/**
|
|
3058
|
-
* URL-fetch flavor — GET the preview, parallel-fetch every linked
|
|
3059
|
-
* stylesheet + script (with bounded timeouts, soft-fail individually),
|
|
3060
|
-
* then score via {@link runKeywordCoverageJudge}.
|
|
3061
|
-
*/
|
|
3062
|
-
export declare function runKeywordCoverageJudgeUrl(previewUrl: string, expectedConcepts: ReadonlyArray<KeywordConceptSpec>, options?: KeywordCoverageOptions): Promise<KeywordCoverageResult>;
|
|
3063
|
-
interface OracleObservation {
|
|
3064
|
-
/** Final observable text output from the agent (response, page snapshot, stdout). */
|
|
3065
|
-
text?: string;
|
|
3066
|
-
/** Final URL — for browser-style scenarios. */
|
|
3067
|
-
url?: string;
|
|
3068
|
-
/** Any structured JSON the agent produced. */
|
|
3069
|
-
json?: unknown;
|
|
3070
|
-
/** Free-form context used by custom oracles. */
|
|
3071
|
-
context?: Record<string, unknown>;
|
|
3072
|
-
}
|
|
3073
|
-
interface OracleResult {
|
|
3074
|
-
id: string;
|
|
3075
|
-
pass: boolean;
|
|
3076
|
-
detail: string;
|
|
3077
|
-
evidence?: string;
|
|
3078
|
-
}
|
|
3079
|
-
interface Oracle {
|
|
3080
|
-
id: string;
|
|
3081
|
-
check(obs: OracleObservation): OracleResult;
|
|
3082
|
-
}
|
|
3083
|
-
export declare function jsonShape(expected: Record<string, unknown>): Oracle;
|
|
3084
|
-
/** Extends the substrate verdict spine: `valid` = every oracle passed (and
|
|
3085
|
-
* at least one ran); `score` = ratio of oracles passed; `scores` = per-
|
|
3086
|
-
* oracle 0|1 keyed by oracle id. */
|
|
3087
|
-
interface OracleReport extends DefaultVerdict {
|
|
3088
|
-
results: OracleResult[];
|
|
3089
|
-
passCount: number;
|
|
3090
|
-
failCount: number;
|
|
3091
|
-
}
|
|
3092
|
-
/** Run all oracles against one observation and aggregate. */
|
|
3093
|
-
export declare function evaluateOracles(obs: OracleObservation, oracles: Oracle[]): OracleReport;
|
|
3094
|
-
/** A serializable law for one scalar draw. */
|
|
3095
|
-
type PairedValueLaw = {
|
|
3096
|
-
kind: 'point';
|
|
3097
|
-
value: number;
|
|
3098
|
-
} | {
|
|
3099
|
-
kind: 'atoms';
|
|
3100
|
-
atoms: ReadonlyArray<{
|
|
3101
|
-
value: number;
|
|
3102
|
-
probability: number;
|
|
3103
|
-
}>;
|
|
3104
|
-
} | {
|
|
3105
|
-
kind: 'normal';
|
|
3106
|
-
mean: number;
|
|
3107
|
-
sd: number;
|
|
3108
|
-
};
|
|
3109
|
-
interface PairedPromotionAlternativeCell {
|
|
3110
|
-
/** Probability of this cell. The cells' probabilities sum to 1. */
|
|
3111
|
-
probability: number;
|
|
3112
|
-
/** Pass/fail outcome of each arm in this cell. Required by every call whose
|
|
3113
|
-
* `outcome` is `'pass'`; ignored otherwise. */
|
|
3114
|
-
pass?: {
|
|
3115
|
-
control: boolean;
|
|
3116
|
-
treatment: boolean;
|
|
3117
|
-
};
|
|
3118
|
-
/** Law of the candidate-minus-baseline delta on the continuous scale, given
|
|
3119
|
-
* this cell. A tie is `{ kind: 'point', value: 0 }`. */
|
|
3120
|
-
delta: PairedValueLaw;
|
|
3121
|
-
}
|
|
3122
|
-
interface PairedPromotionAlternative {
|
|
3123
|
-
/** The registered joint law: the cell is drawn first, then the delta given
|
|
3124
|
-
* the cell, so pass/fail and delta are dependent exactly as registered. */
|
|
3125
|
-
cells: ReadonlyArray<PairedPromotionAlternativeCell>;
|
|
3126
|
-
/**
|
|
3127
|
-
* Law of the control arm's value on the continuous scale; the candidate is
|
|
3128
|
-
* control plus delta. Default `{ kind: 'point', value: 0 }`. The mean and
|
|
3129
|
-
* median bootstraps read only the deltas, so the baseline changes nothing
|
|
3130
|
-
* there; it matters only when a `'delta'` call infers its shape from the
|
|
3131
|
-
* observed values (see `continuous` on {@link PairedPromotionDecisionOptions}).
|
|
3132
|
-
*/
|
|
3133
|
-
baseline?: PairedValueLaw;
|
|
3134
|
-
}
|
|
3135
|
-
interface PairedPromotionPowerCall {
|
|
3136
|
-
/** What the call reads from each simulated pair: `'delta'` gives it
|
|
3137
|
-
* `(control, control + delta)` on the continuous scale, `'pass'` gives it
|
|
3138
|
-
* each arm's pass/fail as `0` or `options.binaryScale ?? 1`. */
|
|
3139
|
-
outcome: 'delta' | 'pass';
|
|
3140
|
-
/** The call's options, exactly as the caller will run it. `minPairs`
|
|
3141
|
-
* defaults to the simulated n, the value a gate seals; a caller-supplied
|
|
3142
|
-
* value is kept, and one above n refuses every simulation. A `'pass'` call
|
|
3143
|
-
* must declare `binaryScale`: the simulation never declares one on the
|
|
3144
|
-
* caller's behalf, because a declared scale routes an all-zero sample to
|
|
3145
|
-
* the score interval where an inferred one refuses it. */
|
|
3146
|
-
options: PairedPromotionDecisionOptions;
|
|
3147
|
-
}
|
|
3148
|
-
interface PairedPromotionPowerOptions {
|
|
3149
|
-
/** Total paired episodes, ties included. */
|
|
3150
|
-
n: number;
|
|
3151
|
-
alternative: PairedPromotionAlternative;
|
|
3152
|
-
/** Every call must return `promote: true` for a simulation to count as a
|
|
3153
|
-
* promotion. At least one call. */
|
|
3154
|
-
calls: ReadonlyArray<PairedPromotionPowerCall>;
|
|
3155
|
-
/** Simulated data sets. Default 1000. */
|
|
3156
|
-
simulations?: number;
|
|
3157
|
-
/** PRNG seed for the simulated draws (not the bootstrap's seed, which each
|
|
3158
|
-
* call carries in its own options). Default 1. */
|
|
3159
|
-
seed?: number;
|
|
3160
|
-
}
|
|
3161
|
-
interface PairedPromotionCallRates {
|
|
3162
|
-
outcome: 'delta' | 'pass';
|
|
3163
|
-
/** Fraction of simulations in which this call alone promoted. */
|
|
3164
|
-
promote: number;
|
|
3165
|
-
/** Fractions of simulations in which each refusal channel fired. */
|
|
3166
|
-
insufficient: number;
|
|
3167
|
-
indeterminate: number;
|
|
3168
|
-
exactTestVetoes: number;
|
|
3169
|
-
/** Fraction in which the call was sufficient, determinate, not vetoed, and
|
|
3170
|
-
* still did not clear its threshold. */
|
|
3171
|
-
hold: number;
|
|
3172
|
-
/** Fraction of simulations decided by each method; the regime the call
|
|
3173
|
-
* actually ran in at this n. */
|
|
3174
|
-
methods: Partial<Record<PairedDecisionMethod, number>>;
|
|
3175
|
-
}
|
|
3176
|
-
interface PairedPromotionPowerResult {
|
|
3177
|
-
n: number;
|
|
3178
|
-
simulations: number;
|
|
3179
|
-
seed: number;
|
|
3180
|
-
/** Fraction of simulations in which every call promoted: the joint power. */
|
|
3181
|
-
power: number;
|
|
3182
|
-
/** Monte Carlo standard error of `power`. */
|
|
3183
|
-
standardError: number;
|
|
3184
|
-
/** Wilson 95% interval on `power`. */
|
|
3185
|
-
low: number;
|
|
3186
|
-
high: number;
|
|
3187
|
-
/** Fraction in which at least one call refused (insufficient, indeterminate
|
|
3188
|
-
* or vetoed); the rest of the non-promotions are holds. */
|
|
3189
|
-
refuse: number;
|
|
3190
|
-
hold: number;
|
|
3191
|
-
/** Per-call rates, in the order the calls were supplied. */
|
|
3192
|
-
calls: PairedPromotionCallRates[];
|
|
3193
|
-
}
|
|
3194
|
-
interface RequiredPairsForPairedPromotionOptions {
|
|
3195
|
-
/** Target joint power. Default 0.8. */
|
|
3196
|
-
target?: number;
|
|
3197
|
-
alternative: PairedPromotionAlternative;
|
|
3198
|
-
calls: ReadonlyArray<PairedPromotionPowerCall>;
|
|
3199
|
-
/** Smallest n to consider. Default 1. */
|
|
3200
|
-
minPairs?: number;
|
|
3201
|
-
/** Largest n to consider; the scan stops there with `n: null` if the target
|
|
3202
|
-
* is never reached. Default 200. */
|
|
3203
|
-
maxPairs?: number;
|
|
3204
|
-
simulations?: number;
|
|
3205
|
-
seed?: number;
|
|
3206
|
-
}
|
|
3207
|
-
interface RequiredPairsForPairedPromotionResult {
|
|
3208
|
-
target: number;
|
|
3209
|
-
/** First n scanned whose estimated joint power reaches the target, or null
|
|
3210
|
-
* when no n up to `maxPairs` does. Descriptive only: power is not monotone
|
|
3211
|
-
* in n on the exact and discrete routes, the scan reads one noisy estimate
|
|
3212
|
-
* per n, and the first crossing of many is biased low. Read the curve. */
|
|
3213
|
-
n: number | null;
|
|
3214
|
-
/**
|
|
3215
|
-
* The conservative choice, which a preregistration should prefer: the first
|
|
3216
|
-
* scanned n whose Wilson lower bound reaches the target AND whose
|
|
3217
|
-
* independent confirmation (a second simulation at that n on a fresh seed,
|
|
3218
|
-
* `confirmation` below) also has its lower bound at or above the target. The
|
|
3219
|
-
* confirmation is what keeps the 95 % coverage: a scan over many n gives
|
|
3220
|
-
* Monte Carlo noise many chances to push one bound across, so the scan's own
|
|
3221
|
-
* bound selects a candidate and never certifies it. Never set while `n` is
|
|
3222
|
-
* null. Null when not reached by `maxPairs`.
|
|
3223
|
-
*/
|
|
3224
|
-
nAtLowerBound: number | null;
|
|
3225
|
-
/** The independent simulation at `nAtLowerBound`; null when not reached. */
|
|
3226
|
-
confirmation: PairedPromotionPowerResult | null;
|
|
3227
|
-
/** Every n scanned, in order, with its scan estimate; candidates whose
|
|
3228
|
-
* confirmation failed are in `rejected`. The scan stops at `nAtLowerBound`
|
|
3229
|
-
* when that is reached, else at `maxPairs`. */
|
|
3230
|
-
curve: PairedPromotionPowerResult[];
|
|
3231
|
-
/** Candidates the scan's bound selected and the confirmation refused. */
|
|
3232
|
-
rejected: PairedPromotionPowerResult[];
|
|
3233
|
-
}
|
|
3234
|
-
/**
|
|
3235
|
-
* Joint power of the configured calls at `n` under the registered alternative:
|
|
3236
|
-
* the fraction of simulated data sets on which every call promotes.
|
|
3237
|
-
*/
|
|
3238
|
-
export declare function pairedPromotionPower(options: PairedPromotionPowerOptions): PairedPromotionPowerResult;
|
|
3239
|
-
/**
|
|
3240
|
-
* First n at which {@link pairedPromotionPower} reaches the target, scanning
|
|
3241
|
-
* every n from `minPairs` upward. Both the point-estimate answer and the
|
|
3242
|
-
* confirmed lower-bound answer are returned; the scan runs until the latter is
|
|
3243
|
-
* reached (so the curve past `n` is retained) or `maxPairs` is exhausted. A
|
|
3244
|
-
* candidate selected by the scan's bound is certified only by an independent
|
|
3245
|
-
* simulation at that n on a different seed; a candidate that fails it is
|
|
3246
|
-
* recorded and the scan continues.
|
|
3247
|
-
*/
|
|
3248
|
-
export declare function requiredPairsForPairedPromotion(options: RequiredPairsForPairedPromotionOptions): RequiredPairsForPairedPromotionResult;
|
|
3249
|
-
/**
|
|
3250
|
-
* Treatment-applied gate — "did the treatment's tool actually fire this run?"
|
|
3251
|
-
*
|
|
3252
|
-
* A tool-treatment A/B (mount a search provider, a browser, a code-exec
|
|
3253
|
-
* sandbox, a retrieval MCP — anything one arm gets and the other doesn't) only
|
|
3254
|
-
* means something on the treatment arm if that arm actually EXERCISED the tool.
|
|
3255
|
-
* A treatment run that never called the mounted tool is not a weak data point
|
|
3256
|
-
* — it is a NON-data-point: the manipulation never happened, so the run cannot
|
|
3257
|
-
* speak to the treatment and must be excluded from the objective, the same way
|
|
3258
|
-
* an infra-tainted run is excluded.
|
|
3259
|
-
*
|
|
3260
|
-
* This is the manipulation/validity precondition that protects the paired A/B
|
|
3261
|
-
* tests downstream (`mcnemar`, `pairedRiskDifference`): they must only ever see
|
|
3262
|
-
* runs where the treatment was applied, or they measure noise and report it as
|
|
3263
|
-
* an effect.
|
|
3264
|
-
*
|
|
3265
|
-
* Shape mirrors `authenticity`'s `gateRealness`: a pure predicate over already-
|
|
3266
|
-
* computed signals, with explicit fail-open/fail-closed discipline. It is not a
|
|
3267
|
-
* trace parser — the tool-call telemetry it reads is the deterministic
|
|
3268
|
-
* `toolHistogram` that `computeTraceMetrics(spans)` already produces (OTLP
|
|
3269
|
-
* tool-name extraction via `TOOL_NAME_ATTR_KEYS`), or the `ToolSpan[]` a
|
|
3270
|
-
* `toolSpans(store, runId)` query returns. The gate never re-derives either.
|
|
3271
|
-
*
|
|
3272
|
-
* General by construction:
|
|
3273
|
-
* - The "which tool counts as the treatment" decision is a `matches` PARAMETER
|
|
3274
|
-
* — a `(toolName: string) => boolean`. There is no `search`/`web`/`fetch`
|
|
3275
|
-
* literal anywhere in this module; a search A/B passes its own matcher.
|
|
3276
|
-
* - The "is THIS run a treatment arm (vs a control)" decision is the caller's
|
|
3277
|
-
* policy and stays at the call site. The gate only answers the narrower,
|
|
3278
|
-
* domain-free question: "given this run's telemetry, did a matching tool
|
|
3279
|
-
* fire?" — so it generalizes to any tool-treatment, not search.
|
|
3280
|
-
*
|
|
3281
|
-
* Fail-open on telemetry absence: when NO tool calls were captured at all
|
|
3282
|
-
* (`sum(toolHistogram) === 0`), the gate cannot distinguish "the agent used no
|
|
3283
|
-
* tools" from "this harness's tool calls weren't recorded". Quarantining on a
|
|
3284
|
-
* telemetry gap would silently delete real runs, so the default is
|
|
3285
|
-
* applied=true / gated=false. Pass `failOpenWhenNoTelemetry: false` to flip to
|
|
3286
|
-
* fail-closed for harnesses where tool capture is guaranteed.
|
|
3287
|
-
*/
|
|
3288
|
-
/** A tool-name matcher: does this tool name belong to the treatment under test?
|
|
3289
|
-
* The caller supplies it — the substrate ships no `search` (or any) literal. */
|
|
3290
|
-
type ToolMatcher = (toolName: string) => boolean;
|
|
3291
|
-
interface TreatmentGateInput {
|
|
3292
|
-
/** Tool-call counts by tool name — exactly `computeTraceMetrics(spans).toolHistogram`.
|
|
3293
|
-
* The gate consumes this; it does not parse spans itself. */
|
|
3294
|
-
toolHistogram: Readonly<Record<string, number>>;
|
|
3295
|
-
/** Which tool names count as the treatment firing. A parameter, never baked in. */
|
|
3296
|
-
matches: ToolMatcher;
|
|
3297
|
-
}
|
|
3298
|
-
interface TreatmentGateOptions {
|
|
3299
|
-
/** When the histogram is empty (no tool telemetry captured), treat the run as
|
|
3300
|
-
* applied rather than quarantining it. Default true — a telemetry gap must
|
|
3301
|
-
* never be mistaken for "treatment not applied". Set false only when tool
|
|
3302
|
-
* capture is guaranteed for this harness. */
|
|
3303
|
-
failOpenWhenNoTelemetry?: boolean;
|
|
3304
|
-
}
|
|
3305
|
-
interface TreatmentGate {
|
|
3306
|
-
/** True iff the treatment's tool is considered to have fired this run. False
|
|
3307
|
-
* ONLY when telemetry was present and no matching call appears. */
|
|
3308
|
-
applied: boolean;
|
|
3309
|
-
/** Objective-exclusion flag, parallel to `outcome.realness.gated`: a gated run
|
|
3310
|
-
* is dropped from the objective denominator and reported as
|
|
3311
|
-
* treatment-not-applied (like infra-loss). `gated === !applied`. */
|
|
3312
|
-
gated: boolean;
|
|
3313
|
-
reason?: string;
|
|
3314
|
-
/** How many recorded tool calls matched the treatment matcher. */
|
|
3315
|
-
matchedCalls: number;
|
|
3316
|
-
/** Total recorded tool calls (`sum(toolHistogram)`) — 0 means no telemetry. */
|
|
3317
|
-
observedTools: number;
|
|
3318
|
-
}
|
|
3319
|
-
/**
|
|
3320
|
-
* Core predicate. Gated (treatment-not-applied) ONLY when telemetry was
|
|
3321
|
-
* captured AND zero matching calls appear; an empty histogram fails open.
|
|
3322
|
-
*/
|
|
3323
|
-
export declare function gateTreatmentApplied(input: TreatmentGateInput, opts?: TreatmentGateOptions): TreatmentGate;
|
|
3324
|
-
/**
|
|
3325
|
-
* Canonical JSON (RFC 8785): object keys sorted recursively, so two
|
|
3326
|
-
* semantically equal values produce byte-identical output regardless of key
|
|
3327
|
-
* insertion order. Throws `LedgerCanonicalizationError` on any value with no
|
|
3328
|
-
* faithful JSON form — see `ledger-core/canonical`.
|
|
3329
|
-
*/
|
|
3330
|
-
export declare function canonicalJson(value: unknown): string;
|
|
3331
|
-
/** Hex sha-256 over `canonicalJson(value)`. The content address used by the
|
|
3332
|
-
* verdict cache and report attestation. Equals `hashCanonical(value)` with
|
|
3333
|
-
* the `sha256:` prefix removed. */
|
|
3334
|
-
export declare function contentHash(value: unknown): string;
|
|
3335
|
-
/** Pluggable verdict store. Sync or async on both legs — `cachedJudge`
|
|
3336
|
-
* awaits the results either way. */
|
|
3337
|
-
interface VerdictCacheStore {
|
|
3338
|
-
get(key: string): Promise<JudgeScore | undefined> | JudgeScore | undefined;
|
|
3339
|
-
set(key: string, score: JudgeScore): Promise<void> | void;
|
|
3340
|
-
}
|
|
3341
|
-
/**
|
|
3342
|
-
* JSONL-file-backed store: the full file is loaded into an in-memory index at
|
|
3343
|
-
* construction; every `set` appends one line synchronously (durable before
|
|
3344
|
-
* the verdict is returned). A corrupt or malformed line throws at load with
|
|
3345
|
-
* file:line — a skipped line would silently re-judge (cost) or, worse, mask
|
|
3346
|
-
* a half-written file that needs operator attention.
|
|
3347
|
-
*/
|
|
3348
|
-
export declare function fileVerdictCache(path: string): VerdictCacheStore;
|
|
3349
|
-
/**
|
|
3350
|
-
* Strong, generically-useful baseline ROLES — the top zone of an `AgentProfile`
|
|
3351
|
-
* before any domain layer. A product composes one of these with its own
|
|
3352
|
-
* environment description (its sandbox) and its domain guidance, which lives in
|
|
3353
|
-
* the product repo (not here): a profile is `<baseline role> + <environment> +
|
|
3354
|
-
* <domain sections>`. Domain strength is NOT generalized into the substrate —
|
|
3355
|
-
* it is lifted here only once ≥2 products genuinely reuse it.
|
|
3356
|
-
*
|
|
3357
|
-
* Three roles cover the common shapes:
|
|
3358
|
-
* - `engineerRole` — builds + verifies real artifacts in a sandbox. Distilled
|
|
3359
|
-
* from agent-runtime's `coderProfile` doctrine (minimal
|
|
3360
|
-
* correct change, run the checks, fix the root cause,
|
|
3361
|
-
* never weaken a test or hide an error).
|
|
3362
|
-
* - `researcherRole` — gathers from real sources and grounds every claim
|
|
3363
|
-
* (cite or mark inferred; never fabricate).
|
|
3364
|
-
* - `generalistRole` — a strong default: helpful, grounded, verify-before-assert.
|
|
3365
|
-
*
|
|
3366
|
-
* All three are verification-first and domain-agnostic. They describe HOW a
|
|
3367
|
-
* capable IC operates, not WHAT domain it works in.
|
|
3368
|
-
*/
|
|
3369
|
-
/** Senior-IC engineer operating in a sandbox — produces real artifacts and
|
|
3370
|
-
* verifies them before declaring done. The shared operator foundation for any
|
|
3371
|
-
* file-producing, tool-using product agent. */
|
|
3372
|
-
declare const engineerRole: string;
|
|
3373
|
-
/** Researcher who grounds every claim in real sources — gathers, cites, and
|
|
3374
|
-
* distinguishes verified fact from inference. */
|
|
3375
|
-
declare const researcherRole: string;
|
|
3376
|
-
/** Strong general-purpose default — helpful, grounded, verifies before asserting. */
|
|
3377
|
-
declare const generalistRole: string;
|
|
3378
|
-
/** The named baseline roles, for selection by key (e.g. from a product config). */
|
|
3379
|
-
declare const BASELINE_ROLES: {
|
|
3380
|
-
readonly engineer: string;
|
|
3381
|
-
readonly researcher: string;
|
|
3382
|
-
readonly generalist: string;
|
|
3383
|
-
};
|
|
3384
|
-
type BaselineRoleKey = keyof typeof BASELINE_ROLES;
|
|
3385
|
-
declare namespace index_d_exports {
|
|
3386
|
-
export { AgentProfileSection, BASELINE_ROLES, BaselineRoleKey, ProfileSkill, PromptProfile, applyDomainPatch, baselineProfile, baselineProfileFromRole, engineerRole, generalistRole, prodProfile, profileToSurface, renderProfile, researcherRole, sectionHash };
|
|
3387
|
-
}
|
|
3388
|
-
/** A named, addressable region of the system prompt. `evolvable` marks whether
|
|
3389
|
-
* the self-improvement loop is allowed to patch its body; fixed scaffolding
|
|
3390
|
-
* (e.g. a compliance preamble) sets `evolvable: false`. */
|
|
3391
|
-
interface AgentProfileSection {
|
|
3392
|
-
id: string;
|
|
3393
|
-
title: string;
|
|
3394
|
-
body: string;
|
|
3395
|
-
evolvable: boolean;
|
|
3396
|
-
}
|
|
3397
|
-
/** A skill the agent can invoke. `triggers` are the phrases/conditions that
|
|
3398
|
-
* should activate it; `scriptsDir` points at its executable scripts when the
|
|
3399
|
-
* skill ships code (mirrors Harvey's `skills/<name>/scripts/`). */
|
|
3400
|
-
interface ProfileSkill {
|
|
3401
|
-
name: string;
|
|
3402
|
-
description: string;
|
|
3403
|
-
triggers: string[];
|
|
3404
|
-
scriptsDir?: string;
|
|
3405
|
-
}
|
|
3406
|
-
/** The structured system prompt. The first four fields are fixed scaffolding;
|
|
3407
|
-
* `domain` is the evolvable surface the loop optimizes. */
|
|
3408
|
-
interface PromptProfile {
|
|
3409
|
-
role: string;
|
|
3410
|
-
environment: string;
|
|
3411
|
-
toolConventions: string;
|
|
3412
|
-
skills: ProfileSkill[];
|
|
3413
|
-
domain: AgentProfileSection[];
|
|
3414
|
-
}
|
|
3415
|
-
/**
|
|
3416
|
-
* Emit the sectioned system prompt in fixed order: role text, then
|
|
3417
|
-
* `## Environment`, `## Tool conventions`, `## Skills` (each skill as
|
|
3418
|
-
* `### <name>` + description + triggers), `## Domain guidance` (each section as
|
|
3419
|
-
* `### <title>` + body). The order is load-bearing — the loop diffs rendered
|
|
3420
|
-
* text, and reordering would make every candidate look like a full rewrite.
|
|
3421
|
-
*/
|
|
3422
|
-
declare function renderProfile(p: PromptProfile): string;
|
|
3423
|
-
/** The string `MutableSurface` the self-improvement loop scores — a profile
|
|
3424
|
-
* renders to exactly the text a candidate is graded on. */
|
|
3425
|
-
declare function profileToSurface(p: PromptProfile): string;
|
|
3426
|
-
/**
|
|
3427
|
-
* The fixed-scaffolding baseline: a `role`/`environment`/`toolConventions`
|
|
3428
|
-
* profile with the stock skill roster and NO domain guidance. The
|
|
3429
|
-
* production profile is this plus shipped domain sections.
|
|
3430
|
-
*/
|
|
3431
|
-
declare function baselineProfile(args: {
|
|
3432
|
-
role: string;
|
|
3433
|
-
environment?: string;
|
|
3434
|
-
toolConventions?: string;
|
|
3435
|
-
skills?: ProfileSkill[];
|
|
3436
|
-
}): PromptProfile;
|
|
3437
|
-
/**
|
|
3438
|
-
* Baseline from one of the strong generic roles (`'engineer' | 'researcher' |
|
|
3439
|
-
* 'generalist'`) — the common case: pick a role foundation, optionally override
|
|
3440
|
-
* the environment to describe THIS product's sandbox, then layer domain via
|
|
3441
|
-
* `prodProfile`. Domain guidance stays in the product repo; this only supplies
|
|
3442
|
-
* the generically-useful role + stock scaffolding.
|
|
3443
|
-
*/
|
|
3444
|
-
declare function baselineProfileFromRole(role: BaselineRoleKey, args?: {
|
|
3445
|
-
environment?: string;
|
|
3446
|
-
toolConventions?: string;
|
|
3447
|
-
skills?: ProfileSkill[];
|
|
3448
|
-
}): PromptProfile;
|
|
3449
|
-
/** The production profile: the baseline scaffolding plus the domain sections
|
|
3450
|
-
* shipped after self-improvement. Differs from the baseline ONLY in `domain`
|
|
3451
|
-
* (and any skills the caller layered into the baseline) — the role,
|
|
3452
|
-
* environment, and tool conventions are carried through unchanged. */
|
|
3453
|
-
declare function prodProfile(baseline: PromptProfile, shipped: AgentProfileSection[]): PromptProfile;
|
|
3454
|
-
/**
|
|
3455
|
-
* Section-scoped edit — replace the body of ONE domain section by id, leaving
|
|
3456
|
-
* every other section byte-identical. This is how the loop targets a single
|
|
3457
|
-
* evolvable surface. Throws on an unknown section id (a patch that hits no
|
|
3458
|
-
* section is a silent no-op otherwise — fail loud). Throws when the targeted
|
|
3459
|
-
* section is `evolvable: false`.
|
|
3460
|
-
*/
|
|
3461
|
-
declare function applyDomainPatch(p: PromptProfile, sectionId: string, newBody: string): PromptProfile;
|
|
3462
|
-
/**
|
|
3463
|
-
* Content hash of a single section — its loop identity. Delegates to the
|
|
3464
|
-
* campaign provenance `surfaceContentHash` (the same helper the loop's
|
|
3465
|
-
* provenance record uses for full surfaces), so a section hash is byte-for-byte
|
|
3466
|
-
* comparable with the `sha256:`-prefixed content hashes that record carries.
|
|
3467
|
-
* Two sections that render identically (same title + body) share a hash; the
|
|
3468
|
-
* `id` and `evolvable` flag are excluded — they are routing metadata, not
|
|
3469
|
-
* content.
|
|
3470
|
-
*/
|
|
3471
|
-
declare function sectionHash(section: AgentProfileSection): string;
|
|
3472
|
-
export declare class BudgetBreachError extends AgentEvalError {
|
|
3473
|
-
dimension: keyof BudgetSpec;
|
|
3474
|
-
limit: number;
|
|
3475
|
-
attempted: number;
|
|
3476
|
-
constructor(dimension: keyof BudgetSpec, limit: number, attempted: number);
|
|
3477
|
-
}
|
|
3478
|
-
export declare class BudgetGuard {
|
|
3479
|
-
private consumed;
|
|
3480
|
-
private emitter;
|
|
3481
|
-
private budget;
|
|
3482
|
-
private startedAt;
|
|
3483
|
-
constructor(emitter: TraceEmitter, budget: BudgetSpec, now?: () => number);
|
|
3484
|
-
/** Record consumption. Throws `BudgetBreachError` if any dimension exceeds its cap. */
|
|
3485
|
-
charge(delta: Partial<Record<keyof BudgetSpec, number>>, spanId?: string): Promise<void>;
|
|
3486
|
-
/** Convenience: advance wall-clock budget based on elapsed wall time. */
|
|
3487
|
-
tickWall(nowMs: number, spanId?: string): Promise<void>;
|
|
3488
|
-
get state(): Record<keyof BudgetSpec, number>;
|
|
3489
|
-
}
|
|
3490
|
-
/**
|
|
3491
|
-
* ProductClient — configurable HTTP client for exercising any agent's APIs.
|
|
3492
|
-
*
|
|
3493
|
-
* Routes are config, not hardcoded. Each agent provides its own RouteMap.
|
|
3494
|
-
*
|
|
3495
|
-
* @deprecated A one-product REST client does not belong in the generic
|
|
3496
|
-
* substrate. Moves to the product repo in the next major
|
|
3497
|
-
* (tangle-network/agent-runtime#694); vendor it if you construct it directly.
|
|
3498
|
-
*/
|
|
3499
|
-
export declare class ProductClient {
|
|
3500
|
-
private baseUrl;
|
|
3501
|
-
private routes;
|
|
3502
|
-
private cookies;
|
|
3503
|
-
private timeoutMs;
|
|
3504
|
-
constructor(config: ProductClientConfig);
|
|
3505
|
-
private route;
|
|
3506
|
-
/**
|
|
3507
|
-
* Single HTTP boundary for every JSON request. Aborts after `timeoutMs`,
|
|
3508
|
-
* checks `res.ok` BEFORE parsing, and throws `${method} ${path} failed:
|
|
3509
|
-
* HTTP ${status} — ${body}` on a non-ok response so a 4xx/5xx error body
|
|
3510
|
-
* can never be parsed as a success shape. Callers inspect the resolved
|
|
3511
|
-
* value only after a successful return.
|
|
3512
|
-
*/
|
|
3513
|
-
private request;
|
|
3514
|
-
/**
|
|
3515
|
-
* Read a required collection field. A missing/non-array field is a contract
|
|
3516
|
-
* violation (wrong route, drift, partial body) — surface it loud instead of
|
|
3517
|
-
* masking it as a healthy empty set. A genuinely empty `[]` passes through.
|
|
3518
|
-
*/
|
|
3519
|
-
private requireArray;
|
|
3520
|
-
signup(name: string, email: string, password: string): Promise<{
|
|
3521
|
-
userId: string;
|
|
3522
|
-
}>;
|
|
3523
|
-
login(email: string, password: string): Promise<void>;
|
|
3524
|
-
createWorkspace(name: string, type?: string): Promise<string>;
|
|
3525
|
-
createThread(workspaceId: string): Promise<string>;
|
|
3526
|
-
chat(workspaceId: string, threadId: string, content: string, _opts?: {
|
|
3527
|
-
blockPatterns?: RegExp[];
|
|
3528
|
-
}): Promise<{
|
|
3529
|
-
text: string;
|
|
3530
|
-
blocks: {
|
|
3531
|
-
type: string;
|
|
3532
|
-
title: string;
|
|
3533
|
-
}[];
|
|
3534
|
-
}>;
|
|
3535
|
-
getTasks(workspaceId: string): Promise<{
|
|
3536
|
-
id: string;
|
|
3537
|
-
title: string;
|
|
3538
|
-
status: string;
|
|
3539
|
-
priority: string;
|
|
3540
|
-
}[]>;
|
|
3541
|
-
getEvents(workspaceId: string): Promise<{
|
|
3542
|
-
id: string;
|
|
3543
|
-
title: string;
|
|
3544
|
-
type: string;
|
|
3545
|
-
}[]>;
|
|
3546
|
-
getApprovals(workspaceId: string): Promise<{
|
|
3547
|
-
id: string;
|
|
3548
|
-
title: string;
|
|
3549
|
-
status: string;
|
|
3550
|
-
type: string;
|
|
3551
|
-
}[]>;
|
|
3552
|
-
getVaultTree(workspaceId: string): Promise<string[]>;
|
|
3553
|
-
approveAction(workspaceId: string, id: string): Promise<void>;
|
|
3554
|
-
rejectAction(workspaceId: string, id: string, reason: string): Promise<void>;
|
|
3555
|
-
getGenerations(workspaceId: string): Promise<{
|
|
3556
|
-
id: string;
|
|
3557
|
-
type: string;
|
|
3558
|
-
prompt: string;
|
|
3559
|
-
}[]>;
|
|
3560
|
-
/** Generic GET for custom routes */
|
|
3561
|
-
get(path: string): Promise<Record<string, unknown>>;
|
|
3562
|
-
/** Generic POST for custom routes */
|
|
3563
|
-
post(path: string, body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
3564
|
-
/** Generic PATCH for custom routes */
|
|
3565
|
-
patch(path: string, body: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
3566
|
-
}
|
|
3567
|
-
export declare function runAgentControlLoop<TState, TAction, TActionResult, TEval extends ControlEvalResult = ControlEvalResult>(config: ControlRuntimeConfig<TState, TAction, TActionResult, TEval>): Promise<ControlRunResult<TState, TAction, TActionResult, TEval>>;
|
|
3568
|
-
export declare function objectiveEval(input: Omit<ControlEvalResult, 'objective'>): ControlEvalResult;
|
|
3569
|
-
export declare function subjectiveEval(input: Omit<ControlEvalResult, 'objective'>): ControlEvalResult;
|
|
3570
|
-
interface ScoreKnowledgeReadinessOptions {
|
|
3571
|
-
taskId: string;
|
|
3572
|
-
requirements: KnowledgeRequirement[];
|
|
3573
|
-
evidenceIds?: string[];
|
|
3574
|
-
claimIds?: string[];
|
|
3575
|
-
wikiPageIds?: string[];
|
|
3576
|
-
userAnswers?: Record<string, string>;
|
|
3577
|
-
metadata?: Record<string, unknown>;
|
|
3578
|
-
now?: Date;
|
|
3579
|
-
}
|
|
3580
|
-
export declare function scoreKnowledgeReadiness(options: ScoreKnowledgeReadinessOptions): KnowledgeReadinessReport;
|
|
3581
|
-
export declare function blockingKnowledgeEval(report: KnowledgeReadinessReport, options?: {
|
|
3582
|
-
id?: string;
|
|
3583
|
-
minimumScore?: number;
|
|
3584
|
-
emitter?: TraceEmitter;
|
|
3585
|
-
}): ControlEvalResult;
|
|
3586
|
-
export declare function knowledgeReadinessTracePayload(report: KnowledgeReadinessReport, options?: {
|
|
3587
|
-
passed?: boolean;
|
|
3588
|
-
minimumScore?: number;
|
|
3589
|
-
}): Record<string, unknown>;
|
|
3590
|
-
export declare function userQuestionsForKnowledgeGaps(gaps: KnowledgeRequirement[]): UserQuestion[];
|
|
3591
|
-
export declare function acquisitionPlansForKnowledgeGaps(gaps: KnowledgeRequirement[]): DataAcquisitionPlan[];
|
|
3592
|
-
interface TokenPrice {
|
|
3593
|
-
input: number;
|
|
3594
|
-
output: number;
|
|
3595
|
-
}
|
|
3596
|
-
/** Per-1K token pricing for exact model ids. */
|
|
3597
|
-
export declare const MODEL_PRICING: Record<string, TokenPrice>;
|
|
3598
|
-
/** Resolve pricing for a model id: exact table, then family fallback.
|
|
3599
|
-
* Returns null when the id matches nothing (caller decides — never a
|
|
3600
|
-
* silent-zero masquerading as a real $0 cost). */
|
|
3601
|
-
export declare function resolveModelPricing(model: string): TokenPrice | null;
|
|
3602
|
-
/** True when `model` has known pricing (exact or family). Lets cost-aware
|
|
3603
|
-
* callers distinguish a real $0 from an unpriced model. */
|
|
3604
|
-
export declare function isModelPriced(model: string): boolean;
|
|
3605
|
-
/** Estimate token count from string length (chars / 4 approximation) */
|
|
3606
|
-
export declare function estimateTokens(text: string): number;
|
|
3607
|
-
/** Calculate cost in USD from token counts and model. Unknown models warn
|
|
3608
|
-
* once (not a silent zero) and return 0 so callers that ignore pricing keep
|
|
3609
|
-
* working; cost-sensitive callers should gate on {@link isModelPriced}. */
|
|
3610
|
-
export declare function estimateCost(inputTokens: number, outputTokens: number, model: string): number;
|
|
3611
|
-
interface AntiSlopConfig {
|
|
3612
|
-
/** Domain label — appears in the DimensionJudgeScore output */
|
|
3613
|
-
domain?: string;
|
|
3614
|
-
/** Case-insensitive substrings that must not appear. Each occurrence = penalty. */
|
|
3615
|
-
bannedPhrases?: string[];
|
|
3616
|
-
/** Regexes matching opening formulas to penalize (e.g. /^great question/i). */
|
|
3617
|
-
bannedOpenings?: RegExp[];
|
|
3618
|
-
/** Regexes matching hedges (e.g. /i could be wrong/i). Ratio of hedged sentences drives score. */
|
|
3619
|
-
hedgingPatterns?: RegExp[];
|
|
3620
|
-
/** Regexes matching apology padding. */
|
|
3621
|
-
apologyPatterns?: RegExp[];
|
|
3622
|
-
/** Fraction of sentences that can be duplicates before penalty (default 0.15 = 15%). */
|
|
3623
|
-
repetitionThreshold?: number;
|
|
3624
|
-
/** Min output length in chars; below this the turn is deemed too terse. */
|
|
3625
|
-
minLength?: number;
|
|
3626
|
-
/** Max output length in chars; above this the turn is deemed too verbose. */
|
|
3627
|
-
maxLength?: number;
|
|
3628
|
-
/** How heavily each violation class reduces the score (default 1). */
|
|
3629
|
-
penaltyWeights?: Partial<Record<SlopCategory, number>>;
|
|
3630
|
-
}
|
|
3631
|
-
type SlopCategory = 'banned_phrase' | 'banned_opening' | 'hedging' | 'apology' | 'repetition' | 'length';
|
|
3632
|
-
/** Create a reusable Judge function from an anti-slop config. */
|
|
3633
|
-
export declare function createAntiSlopJudge(config?: AntiSlopConfig): JudgeFn;
|
|
3634
|
-
interface AntiSlopIssue {
|
|
3635
|
-
category: SlopCategory;
|
|
3636
|
-
detail: string;
|
|
3637
|
-
example?: string;
|
|
3638
|
-
}
|
|
3639
|
-
interface AntiSlopReport {
|
|
3640
|
-
/** 0–10 score; 10 is clean, lower values mean more slop. */
|
|
3641
|
-
score: number;
|
|
3642
|
-
issues: AntiSlopIssue[];
|
|
3643
|
-
/** Count of each category for programmatic aggregation. */
|
|
3644
|
-
counts: Record<SlopCategory, number>;
|
|
3645
|
-
}
|
|
3646
|
-
/**
|
|
3647
|
-
* Pure function — analyze one or more outputs against the config. Exposed
|
|
3648
|
-
* separately so consumers can build their own reporters on top.
|
|
3649
|
-
*/
|
|
3650
|
-
export declare function analyzeAntiSlop(outputs: string[], config: Omit<Required<AntiSlopConfig>, 'domain'> & {
|
|
3651
|
-
penaltyWeights: Record<SlopCategory, number>;
|
|
3652
|
-
}): AntiSlopReport;
|
|
3653
|
-
export declare function assertHttpOk(name: string, res: Response): HarnessAssertion;
|
|
3654
|
-
export declare function assertStatus(name: string, actual: string, expected: string | string[]): HarnessAssertion;
|
|
3655
|
-
export declare function assertExists(name: string, value: unknown): HarnessAssertion;
|
|
3656
|
-
export declare function assertLatencyUnder(name: string, actualMs: number, targetMs: number): HarnessAssertion;
|
|
3657
|
-
export declare function assertContains(name: string, actual: string, expected: string): HarnessAssertion;
|
|
3658
|
-
export declare function assertNotContains(name: string, actual: string, forbidden: string): HarnessAssertion;
|
|
3659
|
-
export declare function assertEventCount(name: string, count: number, min: number, max?: number): HarnessAssertion;
|
|
3660
|
-
export declare function assertHasField(name: string, obj: Record<string, unknown>, field: string): HarnessAssertion;
|
|
3661
|
-
export { AGENT_PROFILE_KINDS, ATTESTATION_ALGORITHM, type ActionExecutionPolicy, type ActionPolicyDecision, type ActionableSideInfo, type ActiveLearningOptions, type AgentEvalAgent, AgentEvalError, type AgentEvalErrorCode, type AgentEvalEvaluateOptions, type AgentEvalImproveOptions, type AgentProfile, type AgentProfileCell, type AgentProfileCellInput, type AgentProfileDimensionValue, type AgentProfileJson, type AgentProfileSourceInput, type Analyst, type AnalystContext, type AnalystFeedbackTrajectoryOptions, type AnalystFinding, type AnalystFindingDigest, AnalystRegistry, type AnalystRegistryOptions, type AnalystReviewDecision, type AnalystReviewRequest, type AnalystRunDigest, type AnalystRunEvent, type AnalystRunInputs, type AnalystRunResult, type AnalystRunSummary, type AnalystSeverity, type AnalystUsageReceipt, type AnalyzeRunsOptions, type AnalyzeTracesResult, type ArgumentCheck, type ArmAssignment, type ArmPopulationReading, type ArmPopulationSummary, type Artifact, type ArtifactCheck, type ArtifactEventLike, type ArtifactResult, type AssertCapabilityHeadroomOptions, type AssertCrossFamilyOptions, type AssertCrossFamilyServedOptions, type AssertServedModelOptions, type AssertSingleBackendOptions, type AttestationProvenance, type AttestationVerification, type AttestedReport, BOOTSTRAP_GATE_MIN_N, type BackendDescriptor, BackendIntegrityError, type BackendIntegrityReport, type BenchmarkEvaluation, type BlendWeights, type BootstrapOptions, type BootstrapResult, type BoundedProcessInput, type BoundedProcessResult, type BudgetLedgerEntry, type BudgetPolicy, type BudgetSpec, CODING_HARNESSES, type CalibrationExample, type CalibrationMerge, type CalibrationResult, type CampaignCellFailureReceipt, type CampaignCellRetryPolicy, type CampaignFactoryParams, type CampaignIntegrityPolicy, type CampaignResult, type CampaignRunContext, type CampaignRunOutcome, type CampaignScenario, type CampaignVariant, type CanaryAlert, type CanaryEvaluation, type CanaryKind, type CanaryLeak, type CanaryOptions, type CanaryReport, type CandidateScore, type CapabilityHeadroomOptions, type CapabilityHeadroomResult, type CaptureErrorHandler, type CaptureWrite, type CellVerdict, type ChannelRollup, type ChatCallOpts, type ChatClient, type ChatRequest, type ChatResponse, type ChatTraceEngineOptions, type ChatTransport, type CheckResult, type CheckerIdentity, type CheckerOutcome, type CliffsMagnitude, type CollectedArtifacts, type CommandRunner, type ComparePairedArmsOptions, type CompletionCriterion, type CompletionRequirement, type CompletionVerdict, type ConceptFinding, type ConceptSpec, ConfigError, type ContinuousAgreement, type ContinuousAgreementOptions, type ContinuousCalibrationResult, type ContractCheckResult, type ContractLintFinding, type ContractRule, type ContractRuleExecution, type ContractRun, type ContractSpan, type ContractStatus, type ContractVerdict, type ControlActionOutcome, type ControlBudget, type ControlContext, type ControlDecision, type ControlEvalResult, type ControlRunResult, type ControlRuntimeConfig, type ControlRuntimeError, type ControlStep, type CorpusAgreementOptions, type CorpusAgreementPerDimension, type CorpusAgreementReport, type CorpusScoreRecord, type CorrectnessChecker, type CostChannel, type CostEntry, CostLedger, type CostLedgerFilter, type CostLedgerHandle, type CostLedgerOptions, type CostLedgerPersistence, type CostLedgerSummary, type CostProvenance, type CostReceipt, type CostReceiptInput, type CostResult, type CostSummary, type CostUsage, type CounterfactualContext, type CounterfactualMutation, type CounterfactualResult, type CounterfactualRunner, type CreateChatClientOpts, type CreateTraceAnalystOptions, CrossFamilyError, type CustomTokenPricing, type CustomTransportOpts, DEFAULT_JUDGE_GATE_POLICY, DEFAULT_RED_TEAM_CORPUS, DEFAULT_TRACE_ANALYST_BUDGETS, DEFAULT_TRACE_ANALYST_KINDS, type DataAcquisitionPlan, type DatasetManifest, type DatasetOverview, type DatasetScenario, type DatasetSplit, type DefaultAnalystRegistryOptions, type DefaultVerdict, type DefineAgentEvalOptions, type DefinedAgentEval, type DeployGateLayerInput, type DeployRunResult, type DeployRunner, type DetectorEvent, type DetectorSignal, type DiffPolicy, type DiffScorecardOptions, type DimensionJudgeScore, type DirEntry, type DiscoverPersonasOptions, type DiscoveredPersona, type DriverState, type DspyRlmTraceEngineOptions, type EProcess, type EProcessOptions, type EProcessState, type EProcessStep, type EnsembleAggregate, type EnsembleJudgeOptions, type EquivalenceArm, type EquivalenceCheckDefinition, type EquivalenceCheckSpec, type EquivalenceChecker, type EquivalenceCheckerInput, type EquivalenceCheckerResult, type EquivalenceObligation, type EquivalenceObligationStatus, EquivalenceProtocolError, type EquivalenceRecord, type ErrorCluster, type ErrorCountPattern, type ErrorStreakOptions, type EvalCampaignOptions, type EvalCampaignResult, type EventFilter, type EvidenceRef, type ExactAnalystRunEvent, type ExactAnalystRunResult, type ExactCapableAnalyst, type ExactRegistryRunOpts, type ExactRiskDifferenceResult, type ExperimentPlan, type ExperimentRep, type ExperimentResult, type ExperimentStats, type ExtractOptions, type ExtractResult, type ExtractedUsage, FAILURE_CLASSES, FAILURE_MODE_KIND_SPEC, type FailedRun, type FailureBlame, type FailureClass, type FailureClassification, type FailureContext, type FailureMode, type FailureReasonRule, type FailureRule, type FeedbackArtifactType, type FeedbackAttempt, type FeedbackLabel, type FeedbackLabelKind, type FeedbackLabelSource, type FeedbackOptimizerRow, type FeedbackOutcome, type FeedbackSplitPolicy, type FeedbackTask, type FeedbackTrajectory, type FeedbackTrajectoryFilter, type FeedbackTrajectoryStore, type FieldDestination, FileSystemFeedbackTrajectoryStore, FileSystemRawProviderSink, FileSystemTraceStore, type Finding, type FindingSubject, type FindingSubjectKind, type FindingToPolicyEditOptions, type FindingsDiff, FindingsStore, type GainDistributionBin, type GainDistributionFigureSpec, type GainDistributionOptions, type GateDecision, type GateEvidence, type GenericSpan, type GoldenItem, HARNESS_NATIVE_MODEL, type HarnessType, type HeadroomInput, HeldOutGate, type HeldOutGateConfig, type HeldOutGateDecision, type HeldOutGateRejectionCode, type HeldOutPartition, type HiddenCriteriaGrader, type HiddenGradeResult, type HiddenLeak, type ImprovementThresholds, type ImprovementVerdictResult, InMemoryFeedbackTrajectoryStore, InMemoryRawProviderSink, InMemoryTraceStore, type InsightReport, type IntentMatchInput, type IntentMatchOptions, type IntentMatchResult, type InterimReleaseConfidence, type InterimReleaseConfidenceInput, type JudgeAgreement, type JudgeCalibrationSet, type JudgeConfusion, JudgeError, type JudgeExampleAgreement, type JudgeFamily, type JudgeFn, type JudgeGateDecision, type JudgeGateInput, type JudgeGatePolicy, JudgeGateRefusedError, type JudgeGateStatus, type JudgeInput, type JudgeRetryOutcome, type JudgeRetryPolicy, type JudgeRubric, type JudgeRun, type JudgeRunMeta, type JudgeScore, type JudgeScoreInput, type JudgeScoresRecord, type JudgeSpan, type JudgeVerdict, type KeywordConceptSpec, type KeywordCoverageFinding, type KeywordCoverageOptions, type KeywordCoverageResult, type KnowledgeAcquisitionMode, type KnowledgeBundle, type KnowledgeFreshness, type KnowledgeImportance, type KnowledgeReadinessReport, type KnowledgeRequirement, type KnowledgeRequirementCategory, type KnowledgeSensitivity, type Layer, type LayerResult, type LayerStatus, type LeaderboardOptions, type LeaderboardRow, type LinearRegressionResult, type LlmCallMetadata, type LlmCallRequest, type LlmCallResult, type LlmChargeBounds, type LlmCorrectnessCheckerOpts, type LlmJudgeOptions, type LlmMessage, type LlmReviewerConfig, type LlmSpan, type LlmTokenLogprob, type LlmToolCall, type LlmToolChoice, type LlmToolDefinition, type LlmUsage, type MannWhitneyResult, type MatchedPair, type MatchedRunRecordPair, type MaximumCharge, type McNemarResult, type MeanConfidenceInterval, type MintRolloutOptions, type MintRolloutResult, type MintedRolloutLine, type MockTransportOpts, type ModelEndpointCheck, type ModelEndpointRequest, type ModelSeats, ModelSubstitutionError, MultiLayerVerifier, type NoLeakOptions, NoopRawProviderSink, NotFoundError, OUTPUT_VALUE, type Objective, type OpenAiCompatibleTransportOpts, type Oracle, type OracleObservation, type OracleReport, type OracleResult, type OrderMode, type OtlpExport, OtlpFileTraceStore, type OtlpFlatLine, type OtlpSpan, type OwnerVerdict, type PaidCallResult, type PairArmsOptions, type PairArmsResult, type PairRunRecordsResult, type PairedArmRow, type PairedArmsComparison, type PairedBootstrapOptions, type PairedBootstrapResult, type PairedCorrectness, type PairedDecisionMethod, type PairedDecisionShape, type PairedDecisionStatistic, type PairedDeltaTestOptions, type PairedDeltaTestResult, type PairedEvalueOptions, type PairedEvalueSequence, type PairedEvalueStep, type PairedMcNemarEvidence, type PairedMetricDelta, type PairedPromotionAlternative, type PairedPromotionAlternativeCell, type PairedPromotionCallRates, type PairedPromotionDecision, type PairedPromotionDecisionOptions, type PairedPromotionPowerCall, type PairedPromotionPowerOptions, type PairedPromotionPowerResult, type PairedSignTestResult, type PairedTTestResult, type PairedValueLaw, type ParetoPoint, type ParetoResult, type PartitionHeldOutOptions, type PendingCostCall, type PendingCostCallView, type PersistedFinding, type PersonaConfig, type PolicyEdit, type PolicyEditAdmission, type PolicyEditAdmissionOptions, type PolicyEditAxis, type PolicyEditCandidateRecord, type PolicyEditChange, type PolicyEditExpectedGain, type PolicyEditGainDirection, type PolicyEditGainUnit, type PolicyEditInit, type PolicyEditRisk, type PolicyEditSchemaVersion, type PolicyEditSource, type PolicyEditTarget, type PolicyEditTargetSurface, type PreferenceMemoryEntry, type ProducedProposal, type ProducedState, type ProductBenchmarkExportOptions, type ProductBenchmarkExportResult, type ProductBenchmarkManifest, type ProductBenchmarkSingleRunExportOptions, type ProductBenchmarkSplit, type ProductBenchmarkValidationReport, type ProductClientConfig, type ProductScenario, type ProfileAxisSpec, type ProjectRuntimeTrajectoryEvidenceOptions, type PromptHandle, type ProportionInterval, type ProposalEventLike, type ProposalFinding, type ProposeFn, type ProposeInput, type ProposeOutput, type ProposeReviewConfig, type ProposeReviewReport, type ProposedSideEffect, type QueryTracesPage, REDACTION_VERSION, type RankTestMethod, type RankTestMethodRequest, type RankTestOptions, type RawAnalystFinding, type RawProviderEvent, type RawProviderSink, type RecordRunsOptions, type RedTeamCase, type RedTeamCategory, type RedTeamFinding, type RedTeamReport, type RedactOptions, type RedactionProfile, type RedactionReport, type ReferenceReplayCaseRun, type ReferenceReplayRun, type ReferenceReplaySplit, type ReflectionContext, type ReflectionProposal, type RegistryRunOpts, type ReleaseConfidenceInput, type ReleaseConfidenceIssue, type ReleaseConfidenceMetrics, type ReleaseConfidenceScorecard, type ReleaseTraceEvidence, type RepeatedActionOptions, type RequiredPairsForPairedPromotionOptions, type RequiredPairsForPairedPromotionResult, type RequirementCheck, type ResearchReport, type ResearchReportOptions, type Researcher, type RetryWrite, type Review, type ReviewFn, type ReviewInput, type ReviewMemoryEntry, type ReviewMemoryStore, type RiskDifferenceResult, type RolloutSearchLineage, type RouteMap, type RoutedField, type RubricDimension, type Run, type RunCampaignOptions, type RunCaptureReport, type RunCommandInput, type RunCommandResult, type RunCostProvenance, type RunFilter, RunIntegrityError, type RunIntegrityReport, type RunJudgeMetadata, type RunOutcome, type RunPaidCallInput, type RunRecord, type RunRecordBackend, RunRecordValidationError, type RunScore, type RunScoreWeights, type RunSearchCoordinates, type RunSplitTag, type RunStatus, type RunTaskFailure, type RunTerminalOutcome, type RunTokenUsage, type RunTraceRef, type RuntimeEventLike, type RuntimeTrajectoryEvidenceProjection, type RuntimeTrajectoryEvidenceSummary, type RuntimeTrajectoryHookEvent, type RuntimeTrajectoryRecord, type RuntimeTrajectoryRunRecord, SEMANTIC_CONCEPT_JUDGE_VERSION, type SampleDistribution, type SampleSummary, type SampleSummaryOptions, type SandboxDriver, type SandboxSdkTransportOpts, type SatisfiedBy, type Scenario, type ScenarioCost, type ScenarioFile, type ScenarioResult, type ScorePreference, type ScoreRiskDifferenceResult, type Scorecard, type ScorecardCell, type ScorecardCellDiff, type ScorecardDiff, type ScorecardEntry, type ScorecardLogLine, type SearchSpanResult, type SearchTraceResult, type SelfImproveBudget, type SelfImproveMethodOptions, type SelfImproveMethodProvenance, type SelfImproveMethodResult, type SelfImproveOptions, type SelfImproveProgressEvent, type SelfImproveProposerOptions, type SelfImproveProposerResult, type SelfImproveResult, type SemanticConceptJudgeInput, type SemanticConceptJudgeOptions, type SemanticConceptJudgeResult, type SequentialDecision, type SeriesConvergenceOptions, type SeriesConvergenceResult, type SeriesDistribution, type SeriesDistributionOptions, type ServedModelCheck, type ServedModelPolicy, type ServedModelVerdict, type Severity, type ShareSafetyStatus, type ShareSafetyVerdict, type SignTestAlternative, type SingleBackendDivergence, type SingleBackendReport, type Span, type SpanFilter, type SpanHandle, type SpanMatchRecord, type SpanPredicate, type SpanRecordsToTraceAnalysisStoreOptions, type SplitCoverage, type SteeringBundle, type SteeringChange, type SteeringOptimizationResult, type SteeringOptimizationRow, type StopDecision, type StrategyChecker, type StreamingDetector, type SummaryTable, type SummaryTableOptions, type SummaryTableRow, type SynthesisTarget, type TaskGold, type TaskHeadroom, type ToolCallEventLike, type ToolSpan, type ToolStats, type ToolUseMetrics, type ToolUseOptions, type TraceAnalysisEngine, type TraceAnalysisEngineResult, type TraceAnalysisStore, type TraceAnalystByteBudgets, type TraceAnalystDefinition, type TraceAnalystFilters, type TraceAnalystSpan, type TraceAnalystSpanKind, type TraceAnalystSpanStatus, type TraceAnalystTraceSummary, type TraceContract, type TraceContractSpec, TraceEmitter, type TraceEmitterOptions, type TraceEvent, type TraceInsightReadiness, type TraceInsightSuite, type TraceStore, type TrainSelectionTestOptions, type TrainSelectionTestPartition, type Trajectory, type TrajectoryStep, type TreatmentGate, type TreatmentGateInput, type TreatmentGateOptions, type TrialTrace, type Turn, type TurnResult, UNKNOWN_MODEL, type UserQuestion, VERIFICATION_STRATEGIES, VERIFICATION_STRATEGY_SOURCES, ValidationError, type VerbosityBiasResult, type Verdict, type VerdictCacheStore, type VerdictCertification, type Verification, type VerificationReport, type VerificationStrategyProfile, type VerificationStrategySource, type VerifyFn, type VerifyOptions, type ViewSpansResult, type ViewTraceOversized, type ViewTraceResult, type ViteDeployRunnerInput, type WeightedCompositeInput, type WeightedCompositeResult, type WelchTestResult, type WelchTestStatus, type WilcoxonSignedRankResult, type WranglerDeployRunnerInput, addCalibrationVerdicts, agentProfileCellKey, agentProfileHash, agentProfileId, analystRunDigest, analystRunToFeedbackTrajectory, analystRunToReviewRequests, analyzeRuns, analyzeSeries, analyzeTraces, argHash, assertCrossFamily, assertCrossFamilyServed, assertJudgeMayGate, assertRealBackend, assertRunCaptured, assertServedModel, assertServedModels, assessShareSafety, assignFeedbackSplit, attest, benjaminiHochberg, bonferroni, bootstrapCi, budgetBreachView, buildAgentProfileCell, buildDefaultAnalystRegistry, buildTraceInsightContext, buildTraceInsightPrompt, buildTrajectory, calibrateJudge, calibrateJudgeContinuous, captureFetchToRawSink, certificationEvidenceDigest, checkServedModel, classifyFailure, classifyFailureReason, comparePairedArms, completionVerdict, computeFindingId, computeToolUseMetrics, confidenceInterval, continuousAgreement, controlRunToFeedbackTrajectory, corpusInterRaterAgreement, corpusInterRaterAgreementFromJudgeScores, createBoundedTraceAnalysisStore, createChatClient, createChatTraceEngine, createDspyRlmTraceEngine, createFeedbackTrajectory, createLlmCorrectnessChecker, createTraceAnalyst, decidePairedPromotion, defineAgentEval, defineEquivalenceCheck, describeServedModelCheck, describeTraceInsightScope, diffFindings, domainEvidencePattern, dominates, eProcess, equivalenceVerdict, evaluateInterimReleaseConfidence, evaluateReleaseConfidence, expandProfileAxes, exportRunAsOtlp, extractProducedState, extractUsage, extractUsageFromSse, failureBlame, failureClusterView, feedbackTrajectoriesToDatasetScenarios, feedbackTrajectoriesToOptimizerRows, feedbackTrajectoryToOptimizerRow, gainHistogram, gradeSemanticStatus, groupRunsByAgentProfileCell, harnessAxisOf, hashJson, holm, inferDomainKeywords, interRaterReliability, iqr, isJudgeSpan, isLlmSpan, isRunRecord, isToolSpan, judgeAgreementView, judgeFamily, judgeGateDecision, judgeSpans, llmJudge, makeFinding, makeProposalFinding, manifestContentDigest, mannWhitneyU, mcnemar, mcnemarPower, mcnemarRequiredN, meanConfidenceInterval, measureJudgeAgreement, mintRolloutRows, modelHasSnapshot, mulberry32, otlpTextToTraceAnalysisStore, pairArms, pairRunRecords, pairedBootstrap, pairedEvalueSequence, pairedMde, pairedRiskDifference, pairedRiskDifferenceExact, pairedRiskDifferenceScore, pairedSignTest, pairedTTest, paretoFrontier, parseRunRecordSafe, partialCredit, passAtK, pearsonR, index_d_exports as profile, ranks, redTeamDataset, redTeamReport, redact, redactForShare, redactText, registerCalibrationSet, renderPreferenceMemoryMarkdown, requiredPairedSampleSize, requiredSampleSize, runCampaign, runCanaries, runEquivalenceCheck, runEvalCampaign, runSemanticConceptJudge, runTaskScore, runsForScenario, scoreRedTeamOutput, scoreTraceInsightReadiness, selfImprove, shareAllowed, snapshotFromJudgeAgreement, spanRecordsToTraceAnalysisStore, spearmanR, studentTCritical, summarizeBackendIntegrity, summarizeNumberSeries, summarizePreferenceMemory, summaryTable, toAgentProfileJson, tokenizeDomainWords, toolSpansToTraceAnalysisStore, toolWasteView, transientDispatchFailure, validateRunRecord, verbosityBias, verifyAgentProfileCell, verifyAttestation, verifyCompletion, weightedComposite, weightedMean, welchsTTest, wilcoxonSignedRank, wilson, withAssignedFeedbackSplit };
|
|
3662
|
-
//# sourceMappingURL=index.d.ts.map
|
|
48
|
+
export { AGENT_PROFILE_KINDS, ATTESTATION_ALGORITHM, type ActionExecutionPolicy, type ActionPolicyDecision, type ActionableSideInfo, type ActiveLearningOptions, type AgentEvalAgent, AgentEvalError, type AgentEvalErrorCode, type AgentEvalEvaluateOptions, type AgentEvalImproveOptions, type AgentProfile, type AgentProfileCell, type AgentProfileCellInput, type AgentProfileDimensionValue, type AgentProfileJson, type AgentProfileSourceInput, type Analyst, type AnalystContext, type AnalystFeedbackTrajectoryOptions, type AnalystFinding, type AnalystFindingDigest, AnalystRegistry, type AnalystRegistryOptions, type AnalystReviewDecision, type AnalystReviewRequest, type AnalystRunDigest, type AnalystRunEvent, type AnalystRunInputs, type AnalystRunResult, type AnalystRunSummary, type AnalystSeverity, type AnalystUsageReceipt, type AnalyzeRunsOptions, type AnalyzeTracesResult, type ArgumentCheck, type ArmAssignment, type ArmPopulationReading, type ArmPopulationSummary, type Artifact, type ArtifactCheck, type ArtifactEventLike, type ArtifactResult, type AssertCapabilityHeadroomOptions, type AssertCrossFamilyOptions, type AssertCrossFamilyServedOptions, type AssertServedModelOptions, type AssertSingleBackendOptions, type AttestationProvenance, type AttestationVerification, type AttestedReport, BOOTSTRAP_GATE_MIN_N, type BackendDescriptor, BackendIntegrityError, type BackendIntegrityReport, type BenchmarkEvaluation, type BlendWeights, type BootstrapOptions, type BootstrapResult, type BoundedProcessInput, type BoundedProcessResult, BudgetBreachError, BudgetGuard, type BudgetLedgerEntry, type BudgetPolicy, type BudgetSpec, CODING_HARNESSES, type CalibrationExample, type CalibrationMerge, type CalibrationResult, type CampaignCellFailureReceipt, type CampaignCellRetryPolicy, type CampaignFactoryParams, type CampaignIntegrityPolicy, type CampaignResult, type CampaignRunContext, type CampaignRunOutcome, type CampaignScenario, type CampaignVariant, type CanaryAlert, type CanaryEvaluation, type CanaryKind, type CanaryLeak, type CanaryOptions, type CanaryReport, type CandidateScore, type CapabilityHeadroomOptions, type CapabilityHeadroomResult, type CaptureErrorHandler, type CaptureWrite, type CellVerdict, type ChannelRollup, type ChatCallOpts, type ChatClient, type ChatRequest, type ChatResponse, type ChatTraceEngineOptions, type ChatTransport, type CheckResult, type CheckerIdentity, type CheckerOutcome, type CliffsMagnitude, type CollectedArtifacts, type CommandRunner, type ComparePairedArmsOptions, type CompletionCriterion, type CompletionRequirement, type CompletionVerdict, type ConceptFinding, type ConceptSpec, ConfigError, type ContinuousAgreement, type ContinuousAgreementOptions, type ContinuousCalibrationResult, type ContractCheckResult, type ContractLintFinding, type ContractRule, type ContractRuleExecution, type ContractRun, type ContractSpan, type ContractStatus, type ContractVerdict, type ControlActionOutcome, type ControlBudget, type ControlContext, type ControlDecision, type ControlEvalResult, type ControlRunResult, type ControlRuntimeConfig, type ControlRuntimeError, type ControlStep, type CorpusAgreementOptions, type CorpusAgreementPerDimension, type CorpusAgreementReport, type CorpusScoreRecord, type CorrectnessChecker, CostAccountingIncompleteError, CostCeilingReachedError, type CostChannel, type CostEntry, CostLedger, type CostLedgerFilter, type CostLedgerHandle, type CostLedgerOptions, type CostLedgerPersistence, type CostLedgerSummary, type CostProvenance, type CostReceipt, type CostReceiptInput, type CostResult, type CostSummary, CostTracker, type CostUsage, type CounterfactualContext, type CounterfactualMutation, type CounterfactualResult, type CounterfactualRunner, type CreateChatClientOpts, type CreateTraceAnalystOptions, CrossFamilyError, type CustomTokenPricing, type CustomTransportOpts, DEFAULT_BOUNDED_PROCESS_TIMEOUT_MS, DEFAULT_JUDGE_GATE_POLICY, DEFAULT_RED_TEAM_CORPUS, DEFAULT_TRACE_ANALYST_BUDGETS, DEFAULT_TRACE_ANALYST_KINDS, type DataAcquisitionPlan, type DatasetManifest, type DatasetOverview, type DatasetScenario, type DatasetSplit, type DefaultAnalystRegistryOptions, type DefaultVerdict, type DefineAgentEvalOptions, type DefinedAgentEval, type DeployGateLayerInput, type DeployRunResult, type DeployRunner, type DetectorEvent, type DetectorSignal, type DiffPolicy, type DiffScorecardOptions, type DimensionJudgeScore, type DirEntry, type DiscoverPersonasOptions, type DiscoveredPersona, type DriverState, type DspyRlmTraceEngineOptions, type EProcess, type EProcessOptions, type EProcessState, type EProcessStep, ERROR_COUNT_PATTERNS, type EnsembleAggregate, type EnsembleJudgeOptions, type EquivalenceArm, type EquivalenceCheckDefinition, type EquivalenceCheckSpec, type EquivalenceChecker, type EquivalenceCheckerInput, type EquivalenceCheckerResult, type EquivalenceObligation, type EquivalenceObligationStatus, EquivalenceProtocolError, type EquivalenceRecord, type ErrorCluster, type ErrorCountPattern, type ErrorStreakOptions, type EvalCampaignOptions, type EvalCampaignResult, type EventFilter, type EvidenceRef, type ExactAnalystRunEvent, type ExactAnalystRunResult, type ExactCapableAnalyst, type ExactRegistryRunOpts, type ExactRiskDifferenceResult, type ExperimentPlan, type ExperimentRep, type ExperimentResult, type ExperimentStats, type ExtractOptions, type ExtractResult, type ExtractedUsage, FAILURE_CLASSES, FAILURE_MODE_KIND_SPEC, type FailedRun, type FailureBlame, type FailureClass, type FailureClassification, type FailureContext, type FailureMode, type FailureReasonRule, type FailureRule, type FeedbackArtifactType, type FeedbackAttempt, type FeedbackLabel, type FeedbackLabelKind, type FeedbackLabelSource, type FeedbackOptimizerRow, type FeedbackOutcome, type FeedbackSplitPolicy, type FeedbackTask, type FeedbackTrajectory, type FeedbackTrajectoryFilter, type FeedbackTrajectoryStore, type FieldDestination, FileSystemFeedbackTrajectoryStore, FileSystemRawProviderSink, FileSystemTraceStore, type Finding, type FindingSubject, type FindingSubjectKind, type FindingToPolicyEditOptions, type FindingsDiff, FindingsStore, type GainDistributionBin, type GainDistributionFigureSpec, type GainDistributionOptions, type GateDecision, type GateEvidence, type GenericSpan, type GoldenItem, HARNESS_NATIVE_MODEL, type HarnessType, type HeadroomInput, HeldOutGate, type HeldOutGateConfig, type HeldOutGateDecision, type HeldOutGateRejectionCode, type HeldOutPartition, type HiddenCriteriaGrader, type HiddenGradeResult, type HiddenLeak, type ImprovementThresholds, type ImprovementVerdictResult, InMemoryFeedbackTrajectoryStore, InMemoryRawProviderSink, InMemoryTraceStore, type InsightReport, type IntentMatchInput, type IntentMatchOptions, type IntentMatchResult, type InterimReleaseConfidence, type InterimReleaseConfidenceInput, type JudgeAgreement, type JudgeCalibrationSet, type JudgeConfusion, JudgeError, type JudgeExampleAgreement, type JudgeFamily, type JudgeFn, type JudgeGateDecision, type JudgeGateInput, type JudgeGatePolicy, JudgeGateRefusedError, type JudgeGateStatus, type JudgeInput, type JudgeRetryOutcome, type JudgeRetryPolicy, type JudgeRubric, type JudgeRun, type JudgeRunMeta, type JudgeScore, type JudgeScoreInput, type JudgeScoresRecord, type JudgeSpan, type JudgeVerdict, type KeywordConceptSpec, type KeywordCoverageFinding, type KeywordCoverageOptions, type KeywordCoverageResult, type KnowledgeAcquisitionMode, type KnowledgeBundle, type KnowledgeFreshness, type KnowledgeImportance, type KnowledgeReadinessReport, type KnowledgeRequirement, type KnowledgeRequirementCategory, type KnowledgeSensitivity, type Layer, type LayerResult, type LayerStatus, type LeaderboardOptions, type LeaderboardRow, type LinearRegressionResult, LlmCallError, type LlmCallMetadata, type LlmCallRequest, type LlmCallResult, type LlmChargeBounds, type LlmCorrectnessCheckerOpts, type LlmJudgeOptions, type LlmMessage, LlmResponseError, type LlmReviewerConfig, type LlmSpan, type LlmTokenLogprob, type LlmToolCall, type LlmToolChoice, type LlmToolDefinition, type LlmUsage, MODEL_PRICING, type MannWhitneyResult, type MatchedPair, type MatchedRunRecordPair, type MaximumCharge, type McNemarResult, type MeanConfidenceInterval, type MintRolloutOptions, type MintRolloutResult, type MintedRolloutLine, type MockTransportOpts, type ModelEndpointCheck, type ModelEndpointRequest, type ModelSeats, ModelSubstitutionError, MultiLayerVerifier, type NoLeakOptions, NoopRawProviderSink, NotFoundError, OUTPUT_VALUE, type Objective, type OpenAiCompatibleTransportOpts, type Oracle, type OracleObservation, type OracleReport, type OracleResult, type OrderMode, type OtlpExport, OtlpFileTraceStore, type OtlpFlatLine, type OtlpSpan, type OwnerVerdict, type PaidCallResult, type PairArmsOptions, type PairArmsResult, type PairRunRecordsResult, type PairedArmRow, type PairedArmsComparison, type PairedBootstrapOptions, type PairedBootstrapResult, type PairedCorrectness, type PairedDecisionMethod, type PairedDecisionShape, type PairedDecisionStatistic, type PairedDeltaTestOptions, type PairedDeltaTestResult, type PairedEvalueOptions, type PairedEvalueSequence, type PairedEvalueStep, type PairedMcNemarEvidence, type PairedMetricDelta, type PairedPromotionAlternative, type PairedPromotionAlternativeCell, type PairedPromotionCallRates, type PairedPromotionDecision, type PairedPromotionDecisionOptions, type PairedPromotionPowerCall, type PairedPromotionPowerOptions, type PairedPromotionPowerResult, type PairedSignTestResult, type PairedTTestResult, type PairedValueLaw, PairwiseSteeringOptimizer, type ParetoPoint, type ParetoResult, type PartitionHeldOutOptions, type PendingCostCall, type PendingCostCallView, type PersistedFinding, type PersonaConfig, type PolicyEdit, type PolicyEditAdmission, type PolicyEditAdmissionOptions, type PolicyEditAxis, type PolicyEditCandidateRecord, type PolicyEditChange, type PolicyEditExpectedGain, type PolicyEditGainDirection, type PolicyEditGainUnit, type PolicyEditInit, type PolicyEditRisk, type PolicyEditSchemaVersion, type PolicyEditSource, type PolicyEditTarget, type PolicyEditTargetSurface, type PreferenceMemoryEntry, type ProducedProposal, type ProducedState, type ProductBenchmarkExportOptions, type ProductBenchmarkExportResult, type ProductBenchmarkManifest, type ProductBenchmarkSingleRunExportOptions, type ProductBenchmarkSplit, type ProductBenchmarkValidationReport, ProductClient, type ProductClientConfig, type ProductScenario, type ProfileAxisSpec, type ProjectRuntimeTrajectoryEvidenceOptions, type PromptHandle, PromptRegistry, type ProportionInterval, type ProposalEventLike, type ProposalFinding, type ProposeFn, type ProposeInput, type ProposeOutput, type ProposeReviewConfig, type ProposeReviewReport, type ProposedSideEffect, type QueryTracesPage, REDACTION_VERSION, type RankTestMethod, type RankTestMethodRequest, type RankTestOptions, type RawAnalystFinding, type RawProviderEvent, type RawProviderSink, type RecordRunsOptions, type RedTeamCase, type RedTeamCategory, type RedTeamFinding, type RedTeamReport, type RedactOptions, type RedactionProfile, type RedactionReport, type ReferenceReplayCaseRun, type ReferenceReplayRun, type ReferenceReplaySplit, type ReflectionContext, type ReflectionProposal, type RegistryRunOpts, type ReleaseConfidenceInput, type ReleaseConfidenceIssue, type ReleaseConfidenceMetrics, type ReleaseConfidenceScorecard, type ReleaseTraceEvidence, type RepeatedActionOptions, type RequiredPairsForPairedPromotionOptions, type RequiredPairsForPairedPromotionResult, type RequirementCheck, type ResearchReport, type ResearchReportOptions, type Researcher, type RetryWrite, type Review, type ReviewFn, type ReviewInput, type ReviewMemoryEntry, type ReviewMemoryStore, type RiskDifferenceResult, type RolloutSearchLineage, type RouteMap, type RoutedField, type RubricDimension, type Run, type RunCampaignOptions, type RunCaptureReport, type RunCommandInput, type RunCommandResult, type RunCostProvenance, type RunFilter, RunIntegrityError, type RunIntegrityReport, type RunJudgeMetadata, type RunOutcome, type RunPaidCallInput, type RunRecord, type RunRecordBackend, RunRecordValidationError, type RunScore, type RunScoreWeights, type RunSearchCoordinates, type RunSplitTag, type RunStatus, type RunTaskFailure, type RunTerminalOutcome, type RunTokenUsage, type RunTraceRef, type RuntimeEventLike, type RuntimeTrajectoryEvidenceProjection, type RuntimeTrajectoryEvidenceSummary, type RuntimeTrajectoryHookEvent, type RuntimeTrajectoryRecord, type RuntimeTrajectoryRunRecord, SEMANTIC_CONCEPT_JUDGE_VERSION, type SampleDistribution, type SampleSummary, type SampleSummaryOptions, type SandboxDriver, type SandboxSdkTransportOpts, type SatisfiedBy, type Scenario, type ScenarioCost, type ScenarioFile, type ScenarioResult, type ScorePreference, type ScoreRiskDifferenceResult, type Scorecard, type ScorecardCell, type ScorecardCellDiff, type ScorecardDiff, type ScorecardEntry, type ScorecardLogLine, type SearchSpanResult, type SearchTraceResult, type SelfImproveBudget, type SelfImproveMethodOptions, type SelfImproveMethodProvenance, type SelfImproveMethodResult, type SelfImproveOptions, type SelfImproveProgressEvent, type SelfImproveProposerOptions, type SelfImproveProposerResult, type SelfImproveResult, type SemanticConceptJudgeInput, type SemanticConceptJudgeOptions, type SemanticConceptJudgeResult, type SequentialDecision, type SeriesConvergenceOptions, type SeriesConvergenceResult, type SeriesDistribution, type SeriesDistributionOptions, type ServedModelCheck, type ServedModelPolicy, type ServedModelVerdict, type Severity, type ShareSafetyStatus, type ShareSafetyVerdict, type SignTestAlternative, type SingleBackendDivergence, type SingleBackendReport, type Span, type SpanFilter, type SpanHandle, type SpanMatchRecord, type SpanPredicate, type SpanRecordsToTraceAnalysisStoreOptions, type SplitCoverage, type SteeringBundle, type SteeringChange, type SteeringOptimizationResult, type SteeringOptimizationRow, type StopDecision, type StrategyChecker, type StreamingDetector, type SummaryTable, type SummaryTableOptions, type SummaryTableRow, type SynthesisTarget, type TaskGold, type TaskHeadroom, type ToolCallEventLike, type ToolSpan, type ToolStats, type ToolUseMetrics, type ToolUseOptions, type TraceAnalysisEngine, type TraceAnalysisEngineResult, type TraceAnalysisStore, type TraceAnalystByteBudgets, type TraceAnalystDefinition, type TraceAnalystFilters, type TraceAnalystSpan, type TraceAnalystSpanKind, type TraceAnalystSpanStatus, type TraceAnalystTraceSummary, type TraceContract, type TraceContractSpec, TraceEmitter, type TraceEmitterOptions, type TraceEvent, type TraceInsightReadiness, type TraceInsightSuite, type TraceStore, type TrainSelectionTestOptions, type TrainSelectionTestPartition, type Trajectory, type TrajectoryStep, type TreatmentGate, type TreatmentGateInput, type TreatmentGateOptions, type TrialTrace, type Turn, type TurnResult, UNKNOWN_MODEL, type UserQuestion, VERIFICATION_STRATEGIES, VERIFICATION_STRATEGY_SOURCES, ValidationError, type VerbosityBiasResult, type Verdict, type VerdictCacheStore, type VerdictCertification, type Verification, type VerificationReport, type VerificationStrategyProfile, type VerificationStrategySource, type VerifyFn, type VerifyOptions, type ViewSpansResult, type ViewTraceOversized, type ViewTraceResult, type ViteDeployRunnerInput, type WeightedCompositeInput, type WeightedCompositeResult, type WelchTestResult, type WelchTestStatus, type WilcoxonSignedRankResult, type WranglerDeployRunnerInput, acquisitionPlansForKnowledgeGaps, addCalibrationVerdicts, agentProfileCellKey, agentProfileHash, agentProfileId, aggregateJudgeVerdicts, aggregateRunScore, analystRunDigest, analystRunToFeedbackTrajectory, analystRunToReviewRequests, analyzeAntiSlop, analyzeRuns, analyzeSeries, analyzeTraces, argHash, assertCapabilityHeadroom, assertContains, assertCrossFamily, assertCrossFamilyServed, assertEventCount, assertExists, assertHasField, assertHttpOk, assertJudgeMayGate, assertLatencyUnder, assertNoHiddenLeak, assertNotContains, assertProductBenchmarkRun, assertRealBackend, assertRunCaptured, assertServedModel, assertServedModels, assertSingleBackend, assertStatus, assessShareSafety, assignFeedbackSplit, attest, benjaminiHochberg, blendHeldout, blockingKnowledgeEval, bonferroni, bootstrapCi, budgetBreachView, buildAgentProfileCell, buildDefaultAnalystRegistry, buildReflectionPrompt, buildTraceInsightContext, buildTraceInsightPrompt, buildTrajectory, calibrateJudge, calibrateJudgeContinuous, canonicalJson, capabilityHeadroom, captureFetchToRawSink, certificationEvidenceDigest, checkCanaries, checkServedModel, checkTraceContracts, chiSquared, chiSquaredPValue, clamp01, classifyFailure, classifyFailureReason, cliffsDelta, cohensD, comparePairedArms, compileTraceContractSpec, completionVerdict, computeFindingId, computeToolUseMetrics, confidenceInterval, contentHash, continuousAgreement, controlRunToFeedbackTrajectory, corpusInterRaterAgreement, corpusInterRaterAgreementFromJudgeScores, costForTokenPricing, costForUsage, costReceiptFromLlm, costReceiptFromLlmError, createAntiSlopJudge, createBoundedTraceAnalysisStore, createChatClient, createChatTraceEngine, createDspyRlmTraceEngine, createFeedbackTrajectory, createLlmCorrectnessChecker, createLlmReviewer, createTraceAnalyst, decidePairedPromotion, defineAgentEval, defineEquivalenceCheck, deployGateLayer, describeServedModelCheck, describeTraceInsightScope, diffFindings, diffScorecard, discoverPersonas, domainEvidencePattern, dominates, eProcess, ensembleJudge, equivalenceVerdict, errorStreakDetector, estimateCost, estimateTokens, evaluateActionPolicy, evaluateInterimReleaseConfidence, evaluateOracles, evaluateReleaseConfidence, evaluateTraceContract, expandProfileAxes, explainTraceContract, exportProductBenchmark, exportProductBenchmarkRuns, exportRunAsOtlp, extractErrorCount, extractProducedState, extractUsage, extractUsageFromSse, failureBlame, failureClusterView, feedbackTrajectoriesToDatasetScenarios, feedbackTrajectoriesToOptimizerRows, feedbackTrajectoryToOptimizerRow, fileVerdictCache, fisherExactTwoSided, formatScorecardDiff, gainHistogram, gateTreatmentApplied, gradeSemanticStatus, groupRunsByAgentProfileCell, harnessAxisOf, hashContent, hashJson, holm, inMemoryReviewStore, inferDomainKeywords, interRaterReliability, interpretCliffs, iqr, isJudgeSpan, isLlmSpan, isModelPriced, isRunRecord, isToolSpan, isTransientLlmError, jsonShape, jsonlReviewStore, jsonlRunRecordBackend, judgeAgreementView, judgeFamily, judgeGateDecision, judgeSpans, knowledgeReadinessTracePayload, leaderboard, linearRegressionSlope, lintTraceContractSpec, llmJudge, loadScorecard, localCommandRunner, makeFinding, makePolicyEditCandidateRecord, makeProposalFinding, manifestContentDigest, mannWhitneyU, maximumChargeForLlmRequest, mcnemar, mcnemarPower, mcnemarRequiredN, meanConfidenceInterval, measureJudgeAgreement, minimumPairsForPairedDeltaTest, mintRolloutRows, modelHasSnapshot, mulberry32, normalTwoSidedPValue, objectiveEval, observeAll, otlpTextToTraceAnalysisStore, pairArms, pairRunRecords, pairedBootstrap, pairedCohensDz, pairedDeltaTest, pairedEvalueSequence, pairedMde, pairedPromotionPower, pairedRiskDifference, pairedRiskDifferenceExact, pairedRiskDifferenceScore, pairedSignTest, pairedTTest, paretoFrontier, parseReflectionResponse, parseRunRecordSafe, partialCredit, partitionHeldOut, passAtK, pearsonR, percentileNearestRank, preflightModels, productBenchmarkRepoIdentity, index_d_exports as profile, projectRuntimeTrajectoryEvidence, proposeSynthesisTargets, ranks, readProductBenchmarkManifest, recordRuns, recordRunsToScorecard, redTeamDataset, redTeamReport, redact, redactForShare, redactText, registerCalibrationSet, renderPreferenceMemoryMarkdown, repeatedActionDetector, requiredPairedSampleSize, requiredPairsForPairedPromotion, requiredSampleSize, resolveModelPricing, resolveSeat, rocAuc, runAgentControlLoop, runBoundedProcess, runCampaign, runCanaries, runEquivalenceCheck, runEvalCampaign, runIntentMatchJudge, runKeywordCoverageJudge, runKeywordCoverageJudgeUrl, runProposeReview, runSemanticConceptJudge, runTaskScore, runsForScenario, sampleMedian, scoreKnowledgeReadiness, scoreRedTeamOutput, scoreTraceInsightReadiness, seatPresets, selfImprove, shareAllowed, snapshotFromJudgeAgreement, spanRecordsToTraceAnalysisStore, spearmanR, stripFencedJson, studentTCritical, studentTTwoSidedPValue, subjectiveEval, summarizeBackendIntegrity, summarizeDistribution, summarizeNumberSeries, summarizePreferenceMemory, summarizeSample, summaryTable, toAgentProfileJson, tokenizeDomainWords, toolSpansToTraceAnalysisStore, toolWasteView, traceContract, transientDispatchFailure, twoByTwoPValue, userQuestionsForKnowledgeGaps, validateRunRecord, verbosityBias, verifyAgentProfileCell, verifyAttestation, verifyCompletion, viteDeployRunner, weightedComposite, weightedMean, welchsTTest, wilcoxonSignedRank, wilson, withAssignedFeedbackSplit, withJudgeRetry, wranglerDeployRunner };
|