@remnic/bench 9.6.22 → 9.6.23

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/README.md CHANGED
@@ -91,7 +91,7 @@ status` to report ChatGPT authentication. A 473-credit safety reserve leaves
91
91
  then measure a quick task before choosing a workload bound:
92
92
 
93
93
  ```bash
94
- BUILD_WEEK_RUN_ROOT="$HOME/.remnic/bench/build-week-2026"
94
+ export BUILD_WEEK_RUN_ROOT="$HOME/.remnic/bench/build-week-2026"
95
95
  export BUILD_WEEK_RESULTS_DIR="$BUILD_WEEK_RUN_ROOT/results"
96
96
  umask 077
97
97
  mkdir -p "$BUILD_WEEK_RUN_ROOT" "$BUILD_WEEK_RESULTS_DIR"
@@ -101,8 +101,10 @@ export REMNIC_BENCH_CODEX_CREDIT_BUDGET=2473
101
101
  export REMNIC_BENCH_CODEX_CREDIT_RESERVE=473
102
102
  export REMNIC_BENCH_CODEX_CREDIT_LEDGER="$BUILD_WEEK_RUN_ROOT/codex-credit-ledger.json"
103
103
 
104
- remnic bench run --quick longmemeval \
104
+ remnic bench run longmemeval \
105
105
  --runtime-profile real \
106
+ --limit 1 \
107
+ --dataset-dir ./bench-datasets/longmemeval \
106
108
  --results-dir "$BUILD_WEEK_RESULTS_DIR" \
107
109
  --drain-timeout 600000 \
108
110
  --system-provider codex-cli --system-model gpt-5.6-luna \
@@ -114,6 +116,7 @@ remnic bench run --quick longmemeval \
114
116
 
115
117
  remnic bench run longmemeval \
116
118
  --runtime-profile real --limit <LEDGER_DERIVED_LIMIT> \
119
+ --dataset-dir ./bench-datasets/longmemeval \
117
120
  --results-dir "$BUILD_WEEK_RESULTS_DIR" \
118
121
  --drain-timeout 600000 \
119
122
  --system-provider codex-cli --system-model gpt-5.6-luna \
@@ -130,6 +133,11 @@ actual `turn.completed` JSONL usage. Stop dispatching at 2,000 spent; the
130
133
  473-credit reserve absorbs only a final in-flight call whose exact cost becomes
131
134
  known after completion. Missing exact terminal usage blocks the ledger pending
132
135
  manual account reconciliation.
136
+ The measured probe is a full-mode run bounded to one staged LongMemEval item.
137
+ Full mode fails before provider dispatch if that explicit dataset directory is
138
+ missing or unreadable, so it cannot fall back to the bundled quick fixture.
139
+ Both commands pin the same gitignored dataset source and do not fall back to
140
+ the CLI-managed dataset store.
133
141
  Rates per one million tokens are Luna: 25 input, 2.5 cached input, 150 output;
134
142
  Terra: 62.5 input, 6.25 cached input, 375 output. A bounded result is a trial,
135
143
  not a full leaderboard artifact.
package/dist/index.d.ts CHANGED
@@ -1521,12 +1521,29 @@ interface CodexCliNativeUsage {
1521
1521
  interface CodexCreditReceiptScope extends CodexCliNativeUsage {
1522
1522
  calls: number;
1523
1523
  credits: number;
1524
+ unattributedReconciliationCount: number;
1525
+ unattributedReconciledCredits: number;
1524
1526
  models: Array<CodexCliNativeUsage & {
1525
1527
  model: string;
1526
1528
  calls: number;
1527
1529
  credits: number;
1528
1530
  }>;
1529
1531
  }
1532
+ interface CodexCreditReconciliationReceipt {
1533
+ schemaVersion: 1;
1534
+ priorLedgerSha256: string;
1535
+ ledgerSha256: string;
1536
+ at: string;
1537
+ attribution: "account-wide-unattributed";
1538
+ affectedRunId: string;
1539
+ originalBudgetCredits: number;
1540
+ priorRecordedSpentCredits: number;
1541
+ observedRemainingCredits: number;
1542
+ unattributedCredits: number;
1543
+ totalSpentCredits: number;
1544
+ totalRemainingCredits: number;
1545
+ affectedBlockedEventSha256: string;
1546
+ }
1530
1547
  interface CodexCreditReceipt {
1531
1548
  schemaVersion: 1;
1532
1549
  ledgerSha256: string;
@@ -1541,6 +1558,16 @@ interface CodexCreditReceipt {
1541
1558
  id: string;
1542
1559
  };
1543
1560
  }
1561
+ declare function reconcileCodexCreditLedger(args: {
1562
+ ledgerPath: string;
1563
+ priorLedgerSha256: string;
1564
+ observedRemainingCredits: number;
1565
+ originalBudgetBalanceConfirmed: true;
1566
+ noCreditsAddedOrRefundedConfirmed: true;
1567
+ accountWideUnattributedChargeAccepted: true;
1568
+ affectedRunId: string;
1569
+ }): Promise<CodexCreditReconciliationReceipt>;
1570
+ declare function buildCodexCreditReceipt(ledgerPath: string, runId?: string): Promise<CodexCreditReceipt>;
1544
1571
 
1545
1572
  declare const BENCHMARK_REPRO_MANIFEST_FILENAME = "MANIFEST.json";
1546
1573
  declare const BENCHMARK_REPRO_MANIFEST_SCHEMA_VERSION = 1;
@@ -5224,4 +5251,4 @@ declare function checkCodingGraphRegression(report: CodingGraphBenchReport, base
5224
5251
  */
5225
5252
  declare function buildBaselineFromReport(report: CodingGraphBenchReport, note: string): CodingGraphBaseline;
5226
5253
 
5227
- export { AMA_BENCH_DIAGNOSTIC_VARIANTS, ASSISTANT_AGENT_CONFIG_KEY, ASSISTANT_JUDGE_CONFIG_KEY, ASSISTANT_MEETING_PREP_SCENARIOS, ASSISTANT_MEETING_PREP_SMOKE_SCENARIOS, ASSISTANT_MORNING_BRIEF_SCENARIOS, ASSISTANT_MORNING_BRIEF_SMOKE_SCENARIOS, ASSISTANT_NEXT_BEST_ACTION_SCENARIOS, ASSISTANT_NEXT_BEST_ACTION_SMOKE_SCENARIOS, ASSISTANT_RUBRIC_DIMENSIONS, ASSISTANT_RUBRIC_ID_KEY, ASSISTANT_SEEDS_CONFIG_KEY, ASSISTANT_SPOT_CHECK_DIR_KEY, ASSISTANT_SYNTHESIS_SCENARIOS, ASSISTANT_SYNTHESIS_SMOKE_SCENARIOS, type AblationConfigOverrides, type AbstentionRetrievalCase, type AggregateMetrics, type AmaBenchDiagnosticAdapterOptions, type AmaBenchDiagnosticAnswererMode, type AmaBenchDiagnosticBreakdown, type AmaBenchDiagnosticMatrixArtifact, type AmaBenchDiagnosticRecallMode, type AmaBenchDiagnosticRunContext, type AmaBenchDiagnosticTaskEvidence, type AmaBenchDiagnosticTaskRow, type AmaBenchDiagnosticVariant, type AmaBenchDiagnosticVariantSummary, type AnthropicProviderConfig, type AssistantAgent, type AssistantMemoryFact, type AssistantMemoryGraph, type AssistantRubricDimension, type AssistantRubricRequest, type AssistantRubricScores, type AssistantRunnerOptions, type AssistantScenario, type AssistantStance, type AttackRecallOptions, type AttackRetrievalHit, type AttackerMode, BENCHMARK_ARTIFACT_SCHEMA_VERSION, BENCHMARK_INTEGRITY_META_SCHEMA, BENCHMARK_REPRO_MANIFEST_FILENAME, BENCHMARK_REPRO_MANIFEST_SCHEMA_VERSION, BENCHMARK_RESULT_SCHEMA, BENCHMARK_SPLIT_TYPES, type BaselineRow, type BaselineScenario, type BeamDatasetPreview, type BenchConfig, type BenchJudge, type BenchJudgeResult, type BenchMemoryAdapter, type BenchModelSource, type BenchReasoningEffort, type BenchRecallOptions, type BenchRecallSupportAssessment, type BenchRecallSupportRequest, type BenchRecallSupportStatus, type BenchResponder, type BenchResponse, type BenchRuntimeProfile, type BenchTier, type BenchmarkArtifact, type BenchmarkArtifactEnvironment, type BenchmarkArtifactHardware, type BenchmarkArtifactJudgeCalibration, type BenchmarkArtifactPerTaskScore, type BenchmarkArtifactSystem, type BenchmarkArtifactTier, type BenchmarkCategory, type BenchmarkDefinition, type BenchmarkIntegrityMeta, type BenchmarkMeta, type BenchmarkMode, type BenchmarkReport, type BenchmarkReproManifest, type BenchmarkReproManifestDataset, type BenchmarkReproManifestFile, type BenchmarkReproManifestResult, type BenchmarkResult, type BenchmarkSplitType, type BenchmarkStatus, type BenchmarkSuiteResult, type BenchmarkTier, type BootstrapKappaOptions, type BootstrapKappaResult, type BuildBenchmarkArtifactInput, type BuildBenchmarkPublishFeedOptions, type BuildBenchmarkReproManifestOptions, type BuiltInProvider, CALIBRATION_SLICE_SIZE, CANARY_FIXED_RECALL, CANARY_SCORE_FLOOR, DEFAULT_10K_FIXTURE as CODING_GRAPH_10K_FIXTURE, CODING_GRAPH_BENCH_SCHEMA_VERSION, DEFAULT_TOLERANCE_PERCENT as CODING_GRAPH_DEFAULT_TOLERANCE, MIN_ITERATIONS as CODING_GRAPH_MIN_ITERATIONS, DEFAULT_SMOKE_FIXTURE as CODING_GRAPH_SMOKE_FIXTURE, type CalibrationAnswer, type CalibrationVerdictPair, type CanaryAdapterOptions, type CanaryFloorCheck, type ClaudeCliProviderConfig, type CodexCliProviderConfig, type CodingGraphBaseline, type CodingGraphBenchConfig, type CodingGraphBenchReport, type MachineFingerprint as CodingGraphMachineFingerprint, type CodingGraphMetricKey, type RegressionMetricDetail as CodingGraphRegressionDetail, type RegressionMetricKey as CodingGraphRegressionKey, type RegressionGateResult as CodingGraphRegressionResult, type CohenKappaResult, type ComparisonMetricDelta, type ComparisonResult, type CompletionOpts, type CompletionResult, type ConfidenceInterval, type ContaminationCheckResult, type ContaminationEntry, type ContaminationManifest, type CustomBenchmarkScoring, type CustomBenchmarkSpec, type CustomBenchmarkTask, DEFAULT_ABLATION_BENCHMARK, DEFAULT_ABLATION_BOOTSTRAP_SEED, DEFAULT_ASSISTANT_RUBRIC_ID, DEFAULT_BASELINE_SCENARIOS, DEFAULT_JUDGE_BINARIZATION_THRESHOLD, DEFAULT_KAPPA_BOOTSTRAP_SAMPLES, DEFAULT_KAPPA_CONFIDENCE_LEVEL, DEFAULT_OPENAI_RESPONSES_JUDGE_MODEL, type DatasetSource, type DiagnoseLoComoProfileDeltaOptions, type DiagnoseLoComoRecallDeltaOptions, type DiscoveredModel, EMPTY_CONTAMINATION_MANIFEST, type EffectSizeInterpretation, type EffectSizeSummary, type ExplainResult, type ExtractedEntity, type ExtractedLink, type ExtractedPage, type ExtractionAttackOptions, type ExtractionAttackResult, type ExtractionAttackTarget, type FixtureGenerator, type FixtureOutput, type FixtureVariant, GENERAL_ANSWER_JUDGE_RUBRIC, type GeneratedFile, type GeneratedRepo, type GoldEntity, type GoldEntityType, type GoldGraph, type GoldLink, type GoldPage, type HarnessRng, INTEGRITY_CIPHER_ALGORITHM, INTEGRITY_HASH_ALGORITHM, INTEGRITY_META_FIELDS, type IngestionBenchAdapter, type IngestionLog, JUDGE_CALIBRATION_KAPPA_THRESHOLD, type JudgeCalibrationIdentities, type JudgeCalibrationResult, type JudgeCategory, type KappaConfidenceInterval, LOCAL_LAB_PROVIDER_KINDS, LOCOMO_DATASET_FILENAMES, LOCOMO_FULL_TASK_COUNT, LOCOMO_RECALL_DIFF_LINE_LIMIT, LOCOMO_RECALL_EXCERPT_CHARS, LONG_MEM_EVAL_DATASET_FILENAMES, type LeaderboardArtifactWrite, type LettaAdapterConfig, LettaMemCorrectAdapter, type LlmJudge, type LlmProvider, type LoComoCategoryDelta, type LoComoFinalContextRegression, type LoComoMetricDelta, type LoComoProfileArtifactEvidence, type LoComoProfileDeltaReport, type LoComoRawResultEvidence, type LoComoRecallCategoryDelta, type LoComoRecallContextSummary, type LoComoRecallDeltaReport, type LoComoRecallLineDelta, type LoComoRecallLineEvidence, type LoComoRecallMetricDelta, type LoComoRecallResultProvenance, type LoComoRecallTextDigest, type LoComoTaskRegression, type LoadDatasetOptions, type LoadSealedQrelsOptions, type LoadedDataset, type LoadedJudgeCalibrationState, type LocalLabManifest, type LocalLabManifestNotes, type LocalLabPhase, type LocalLabPhaseDescriptor, type LocalLabPhaseExecute, type LocalLabPhaseName, type LocalLabPhaseOutcome, LocalLabPreflightError, type LocalLabPreflightFailure, type LocalLabPreflightInput, type LocalLabPreflightOptions, type LocalLabPreflightResult, type LocalLabPreflightSuccess, type LocalLabProviderKind, type LocalLabRoleConfig, type LocalLlmProviderConfig, MEMCORRECT_CORRECTION_ACCEPTANCE_RUBRIC, MEMCORRECT_CORRECTION_ACCEPTANCE_RUBRIC_VERSION, MEMCORRECT_STALE_HARM_RUBRIC, MEMCORRECT_STALE_HARM_RUBRIC_VERSION, MEMORY_EVAL_DIMENSIONS, MEMORY_EVAL_PUBLIC_LINE, MIN_CALIBRATION_SOURCE_TASKS, MITIGATED_BASELINE_SCENARIOS, type McpArgumentSemantic, type McpBackendErrorCode, type McpBackendResult, type McpBenchMemoryAdapter, type McpConformanceResult, type McpHttpTransportConfig, type McpListedTool, type McpMemCorrectAdapter, type McpMemoryAdapterOptions, McpMemoryBackendError, type McpMemoryToolMapping, type McpMemoryTransportConfig, type McpStdioTransportConfig, type McpToolCallResult, type McpToolClient, type McpToolMappingEntry, type McpToolMappingValue, type McpToolOperation, type Mem0AdapterConfig, Mem0MemCorrectAdapter, type MemCorrectGeneratorOptions, type MemCorrectJudgeRequest, type MemCorrectJudgeResult, type MemCorrectSystemAdapter, type MemoryEvalCategory, type MemoryEvalDimension, type MemoryEvalDimensionId, type MemoryEvalMetric, type MemoryGraph, type MemoryStats, type MemorySystem, type Message, type MetricAggregate, type MicroMetric, MissingCredentialError, type MitigatedBaselineConfig, type MitigatedTargetConfig, type MultipleChoiceQuestion, OPENAI_RESPONSES_JUDGE_RUBRIC_VERSION, OTHER_NAMESPACE_MEMORIES, type OllamaProviderConfig, type OpenAiCompatibleProviderConfig, OpenAiResponsesJudgeError, type OpenAiResponsesJudgeErrorCode, type OpenAiResponsesJudgeTelemetry, OpenAiResponsesProvider, type OpenAiResponsesProviderConfig, type OpenAiResponsesVerdict, type OpenAiResponsesVerdictResult, PROCEDURAL_REAL_SCENARIOS, PROCEDURAL_REAL_SCENARIOS_SMOKE, PUBLISHED_BENCHMARK_ARTIFACT_IDS, type PersonalizationRetrievalCase, type PreflightDiscoveredModel, type ProceduralAblationArtifact, type ProceduralAblationPerCase, type ProceduralAblationScenario, type ProceduralRealScenario, type ProceduralRealScenarioCategory, type ProviderBaseConfig, type ProviderConfig, type ProviderDiscoveryResult, type ProviderFactoryConfig, type PublishSkipReason, type PublishSkipRecord, type PublishedBenchmarkFeed, type PublishedBenchmarkFeedEntry, type PublishedBenchmarkId, REQUIRED_FRONTMATTER_FIELDS, type RecallMetrics, type RecoveredMemory, type RegressionDetail, type RegressionGateResult$1 as RegressionGateResult, type RemnicAdapterOptions, type ReportCardProvenanceContext, type ResolveBenchRuntimeProfileOptions, type ResolvedBenchRuntimeProfile, type ResolvedLocalLabProfile, type ResolvedLocalLabRole, type ResolvedRunBenchmarkOptions, type RotatedChoices, type RunBenchmarkOptions, type RunJudgeCalibrationOptions, type RunProceduralAblationCliArgs, type RunProceduralAblationOptions, type RunSequentialPhasesOptions, SCHEMA_TIER_FIXTURE, SCHEMA_TIER_SMOKE_FIXTURE, SEALED_PROMPT_REGISTRY, SINGLE_FLAG_ABLATION_MATRIX, SYNTHETIC_MEMORIES, type SanitizedDiagnosticProvider, type SavedBaseline, type SchemaTierCorpus, type SchemaTierFixture, type SchemaTierName, type SchemaTierPage, type SchemaTierPageFrontmatter, type SealedArtifact, type SealedJudgeDecision, type SealedJudgeInput, type SealedQrelsArtifact, type SealedQrelsHandle, type SealedRubric, type SearchResult, type SeededMemory, type SeededRng, type SequentialPhaseHooks, type SingleFlagAblationCell, type SingleFlagAblationId, type SpotCheckLogger, type StatisticalReport, type StructuredJudge, StructuredJudgeError, type StructuredJudgeErrorCode, type StructuredJudgeProvider, type StructuredJudgeTelemetry, type StructuredJudgeVerdict, type StructuredJudgeVerdictResult, type StructuredVerdictRequest, type SyntheticEdge, type SyntheticEmailIngestionAdapterOptions, type SyntheticFileIR, type SyntheticRepoConfig, type SyntheticSymbol, type SyntheticTargetOptions, type TaskResult, type TaskTokenUsage, type TemporalRetrievalCase, type ThirdPartyAdapterConfig, type TierDetail, type TimelineEntry, type TokenUsage, type WallMetric, type WriteBenchmarkArtifactResult, type ZepAdapterConfig, ZepMemCorrectAdapter, addContaminationEntry, aggregateTaskScores, answerBenchmarkQuestion, assertCanaryUnderFloor, assertIntegrityMetaPresent, assertPublishableIntegrity, assertSha256Hex, assistantMeetingPrepDefinition, assistantMorningBriefDefinition, assistantNextBestActionDefinition, assistantSynthesisDefinition, backlinkF1, binarizeJudgeScore, bootstrapCohensKappaConfidenceInterval, bootstrapMeanConfidenceInterval, buildAmaBenchDiagnosticMatrixArtifact, buildAmaBenchDiagnosticVariantSummary, buildAmaBenchLeaderboardRows, buildBaselineFromReport, buildBenchmarkArtifact, buildBenchmarkArtifactFilename, buildBenchmarkPublishFeed, buildBenchmarkReproManifest, buildBenchmarkRunSeeds, buildJudgePayload, buildOracleTrajectoryRecall, buildSchemaTierFixture, buildSchemaTierSmokeFixture, calendarFixture, canonicalJsonStringify, captureMachineFingerprint, chatFixture, checkCodingGraphRegression, checkDatasetContamination, checkRegression, clampScore, cohensD, compareResults, computeCohensKappa, computeSealHash, containsAnswer, createSeededRng$1 as createAdamSeededRng, createAmaBenchDiagnosticAdapter, createAnthropicProvider, createCanaryAdapter, createClaudeCliProvider, createCodexCliProvider, createSeededRng as createCodingGraphSeededRng, createDeterministicSpotCheckLogger, createGatewayResponder, createLightweightAdapter, createLiteLlmProvider, createLocalLlmProvider, createMcpDemoMemCorrectAdapter, createMcpDemoMemoryAdapter, createMcpMemCorrectAdapter, createMcpMemoryAdapter, createMitigatedTarget, createOllamaProvider, createOpenAiCompatibleProvider, createOpenAiResponsesBenchJudge, createOpenAiResponsesProvider, createSeededRandom as createProceduralAblationSeededRandom, createProvider, createProviderBackedAmaBenchRecommendedJudge, createProviderBackedJudge, createProviderBackedResponder, createProviderBackedStructuredJudge, createRemnicAdapter, createResponderFromProvider, createSeededRng$2 as createSeededRng, createSpotCheckFileLogger, createStructuredBenchJudge, createStructuredJudgeFromProvider, createSyntheticEmailIngestionAdapter, createSyntheticTarget, createTimeoutGuardedAdapter, defaultBenchmarkBaselineDir, defaultBenchmarkPublishPath, deleteBenchmarkResults, diagnoseLoComoProfileDelta, diagnoseLoComoRecallDelta, discoverAllProviders, discoveryEndpointFor, emailFixture, entityRecall, exactMatch, extractMetrics as extractCodingGraphMetrics, extractMarkdownSectionsByTitle, f1Score, fixtureToAblationScenarios, formatHandoffNote, formatMissingDatasetError, generateReport, generateSyntheticRepo, getAblationCell, getBenchmark, getBenchmarkLowerIsBetter, getMemoryEvalDimension, getRemnicVersion, hashBenchmarkArtifact, hashBytes, hashCanonicalJson, hashString, integrityMetaIsComplete, interpretEffectSize, isAmaBenchUnknownLikeAnswer, isContaminationEntry, isContaminationManifest, isSealedQrelsArtifact, isSha256Hex, isStructuredJudgeProvider, judgeMemCorrectCorrectionAcceptance, judgeMemCorrectStaleMemoryHarm, linkMatches, listBenchmarkBaselines, listBenchmarkResults, listBenchmarks, listMemoryEvalBenchmarkIds, listMemoryEvalDimensions, llmJudgeScore, llmJudgeScoreDetailed, loadAblationFixture, loadBaseline, loadBeamDatasetPreview, loadBenchmarkArtifact, loadBenchmarkBaseline, loadBenchmarkReportCardProvenance, loadBenchmarkResult, loadCustomBenchmarkFile, loadJudgeCalibrationState, loadLoCoMo10, loadLocalLabManifest, loadLongMemEvalS, loadSealKeyFromEnv, loadSealedQrels, loadSealedRubric, matchEntity, mergeContaminationManifests, openSeal, orchestrateBenchmarkRuns, pairedDeltaConfidenceInterval, parseBenchmarkArtifact, parseCustomBenchmark, parseLocalLabManifest, parseRubricResponse, parseSealedQrels, pickStableQualifiedName, precisionAtK, preflightLocalLabRole, projectFolderFixture, recallAtK, redactBenchmarkResultSecrets, renderBaselineMarkdown, renderBenchmarkResultExport, renderLoComoProfileDeltaMarkdown, renderLoComoRecallDeltaMarkdown, renderMemorySummaryForJudge, renderMemoryViewForAgent, resolveAssistantAgent, resolveAssistantRubricId, resolveAssistantSeeds, resolveAssistantSpotCheckDir, resolveBenchRuntimeProfile, resolveBenchmarkPhaseTimeoutMs, resolveBenchmarkProgressLogging, resolveBenchmarkResultReference, resolveBenchmarkRunCount, resolveLocalLabProfile, resolveLocalLabRole, resolveStructuredJudge, rotateDistractors, rougeL, runAssistantBenchmark, runAssistantMeetingPrepBenchmark, runAssistantMorningBriefBenchmark, runAssistantNextBestActionBenchmark, runAssistantSynthesisBenchmark, runBaseline, runBenchSuite, runBenchmark, runCodingGraphBenchmark, runCustomBenchmarkFile, runExplain, runExtractionAttack, runJudgeCalibration, runMitigatedBaseline, runProceduralAblation, runProceduralAblationCli, runSealedJudge, runSequentialPhases, safeHexEqual, sanitizeLoComoResultReference, saveBaseline, saveBenchmarkBaseline, schemaCompleteness, sealPayload, selectAmaBenchDiagnosticVariants, selectCalibrationSlice, selectFixtureVariant, serializeBenchmarkArtifact, serializeJsonl, serializeSealedQrels, shuffleTasks, timed, verifyRubricDigest, writeBenchmarkArtifact, writeBenchmarkPublishFeed, writeBenchmarkReproManifest, writeBenchmarkResult, writeJudgeCalibrationState, writeLeaderboardArtifactsForResult, zeroScores };
5254
+ export { AMA_BENCH_DIAGNOSTIC_VARIANTS, ASSISTANT_AGENT_CONFIG_KEY, ASSISTANT_JUDGE_CONFIG_KEY, ASSISTANT_MEETING_PREP_SCENARIOS, ASSISTANT_MEETING_PREP_SMOKE_SCENARIOS, ASSISTANT_MORNING_BRIEF_SCENARIOS, ASSISTANT_MORNING_BRIEF_SMOKE_SCENARIOS, ASSISTANT_NEXT_BEST_ACTION_SCENARIOS, ASSISTANT_NEXT_BEST_ACTION_SMOKE_SCENARIOS, ASSISTANT_RUBRIC_DIMENSIONS, ASSISTANT_RUBRIC_ID_KEY, ASSISTANT_SEEDS_CONFIG_KEY, ASSISTANT_SPOT_CHECK_DIR_KEY, ASSISTANT_SYNTHESIS_SCENARIOS, ASSISTANT_SYNTHESIS_SMOKE_SCENARIOS, type AblationConfigOverrides, type AbstentionRetrievalCase, type AggregateMetrics, type AmaBenchDiagnosticAdapterOptions, type AmaBenchDiagnosticAnswererMode, type AmaBenchDiagnosticBreakdown, type AmaBenchDiagnosticMatrixArtifact, type AmaBenchDiagnosticRecallMode, type AmaBenchDiagnosticRunContext, type AmaBenchDiagnosticTaskEvidence, type AmaBenchDiagnosticTaskRow, type AmaBenchDiagnosticVariant, type AmaBenchDiagnosticVariantSummary, type AnthropicProviderConfig, type AssistantAgent, type AssistantMemoryFact, type AssistantMemoryGraph, type AssistantRubricDimension, type AssistantRubricRequest, type AssistantRubricScores, type AssistantRunnerOptions, type AssistantScenario, type AssistantStance, type AttackRecallOptions, type AttackRetrievalHit, type AttackerMode, BENCHMARK_ARTIFACT_SCHEMA_VERSION, BENCHMARK_INTEGRITY_META_SCHEMA, BENCHMARK_REPRO_MANIFEST_FILENAME, BENCHMARK_REPRO_MANIFEST_SCHEMA_VERSION, BENCHMARK_RESULT_SCHEMA, BENCHMARK_SPLIT_TYPES, type BaselineRow, type BaselineScenario, type BeamDatasetPreview, type BenchConfig, type BenchJudge, type BenchJudgeResult, type BenchMemoryAdapter, type BenchModelSource, type BenchReasoningEffort, type BenchRecallOptions, type BenchRecallSupportAssessment, type BenchRecallSupportRequest, type BenchRecallSupportStatus, type BenchResponder, type BenchResponse, type BenchRuntimeProfile, type BenchTier, type BenchmarkArtifact, type BenchmarkArtifactEnvironment, type BenchmarkArtifactHardware, type BenchmarkArtifactJudgeCalibration, type BenchmarkArtifactPerTaskScore, type BenchmarkArtifactSystem, type BenchmarkArtifactTier, type BenchmarkCategory, type BenchmarkDefinition, type BenchmarkIntegrityMeta, type BenchmarkMeta, type BenchmarkMode, type BenchmarkReport, type BenchmarkReproManifest, type BenchmarkReproManifestDataset, type BenchmarkReproManifestFile, type BenchmarkReproManifestResult, type BenchmarkResult, type BenchmarkSplitType, type BenchmarkStatus, type BenchmarkSuiteResult, type BenchmarkTier, type BootstrapKappaOptions, type BootstrapKappaResult, type BuildBenchmarkArtifactInput, type BuildBenchmarkPublishFeedOptions, type BuildBenchmarkReproManifestOptions, type BuiltInProvider, CALIBRATION_SLICE_SIZE, CANARY_FIXED_RECALL, CANARY_SCORE_FLOOR, DEFAULT_10K_FIXTURE as CODING_GRAPH_10K_FIXTURE, CODING_GRAPH_BENCH_SCHEMA_VERSION, DEFAULT_TOLERANCE_PERCENT as CODING_GRAPH_DEFAULT_TOLERANCE, MIN_ITERATIONS as CODING_GRAPH_MIN_ITERATIONS, DEFAULT_SMOKE_FIXTURE as CODING_GRAPH_SMOKE_FIXTURE, type CalibrationAnswer, type CalibrationVerdictPair, type CanaryAdapterOptions, type CanaryFloorCheck, type ClaudeCliProviderConfig, type CodexCliProviderConfig, type CodexCreditReceipt, type CodexCreditReceiptScope, type CodexCreditReconciliationReceipt, type CodingGraphBaseline, type CodingGraphBenchConfig, type CodingGraphBenchReport, type MachineFingerprint as CodingGraphMachineFingerprint, type CodingGraphMetricKey, type RegressionMetricDetail as CodingGraphRegressionDetail, type RegressionMetricKey as CodingGraphRegressionKey, type RegressionGateResult as CodingGraphRegressionResult, type CohenKappaResult, type ComparisonMetricDelta, type ComparisonResult, type CompletionOpts, type CompletionResult, type ConfidenceInterval, type ContaminationCheckResult, type ContaminationEntry, type ContaminationManifest, type CustomBenchmarkScoring, type CustomBenchmarkSpec, type CustomBenchmarkTask, DEFAULT_ABLATION_BENCHMARK, DEFAULT_ABLATION_BOOTSTRAP_SEED, DEFAULT_ASSISTANT_RUBRIC_ID, DEFAULT_BASELINE_SCENARIOS, DEFAULT_JUDGE_BINARIZATION_THRESHOLD, DEFAULT_KAPPA_BOOTSTRAP_SAMPLES, DEFAULT_KAPPA_CONFIDENCE_LEVEL, DEFAULT_OPENAI_RESPONSES_JUDGE_MODEL, type DatasetSource, type DiagnoseLoComoProfileDeltaOptions, type DiagnoseLoComoRecallDeltaOptions, type DiscoveredModel, EMPTY_CONTAMINATION_MANIFEST, type EffectSizeInterpretation, type EffectSizeSummary, type ExplainResult, type ExtractedEntity, type ExtractedLink, type ExtractedPage, type ExtractionAttackOptions, type ExtractionAttackResult, type ExtractionAttackTarget, type FixtureGenerator, type FixtureOutput, type FixtureVariant, GENERAL_ANSWER_JUDGE_RUBRIC, type GeneratedFile, type GeneratedRepo, type GoldEntity, type GoldEntityType, type GoldGraph, type GoldLink, type GoldPage, type HarnessRng, INTEGRITY_CIPHER_ALGORITHM, INTEGRITY_HASH_ALGORITHM, INTEGRITY_META_FIELDS, type IngestionBenchAdapter, type IngestionLog, JUDGE_CALIBRATION_KAPPA_THRESHOLD, type JudgeCalibrationIdentities, type JudgeCalibrationResult, type JudgeCategory, type KappaConfidenceInterval, LOCAL_LAB_PROVIDER_KINDS, LOCOMO_DATASET_FILENAMES, LOCOMO_FULL_TASK_COUNT, LOCOMO_RECALL_DIFF_LINE_LIMIT, LOCOMO_RECALL_EXCERPT_CHARS, LONG_MEM_EVAL_DATASET_FILENAMES, type LeaderboardArtifactWrite, type LettaAdapterConfig, LettaMemCorrectAdapter, type LlmJudge, type LlmProvider, type LoComoCategoryDelta, type LoComoFinalContextRegression, type LoComoMetricDelta, type LoComoProfileArtifactEvidence, type LoComoProfileDeltaReport, type LoComoRawResultEvidence, type LoComoRecallCategoryDelta, type LoComoRecallContextSummary, type LoComoRecallDeltaReport, type LoComoRecallLineDelta, type LoComoRecallLineEvidence, type LoComoRecallMetricDelta, type LoComoRecallResultProvenance, type LoComoRecallTextDigest, type LoComoTaskRegression, type LoadDatasetOptions, type LoadSealedQrelsOptions, type LoadedDataset, type LoadedJudgeCalibrationState, type LocalLabManifest, type LocalLabManifestNotes, type LocalLabPhase, type LocalLabPhaseDescriptor, type LocalLabPhaseExecute, type LocalLabPhaseName, type LocalLabPhaseOutcome, LocalLabPreflightError, type LocalLabPreflightFailure, type LocalLabPreflightInput, type LocalLabPreflightOptions, type LocalLabPreflightResult, type LocalLabPreflightSuccess, type LocalLabProviderKind, type LocalLabRoleConfig, type LocalLlmProviderConfig, MEMCORRECT_CORRECTION_ACCEPTANCE_RUBRIC, MEMCORRECT_CORRECTION_ACCEPTANCE_RUBRIC_VERSION, MEMCORRECT_STALE_HARM_RUBRIC, MEMCORRECT_STALE_HARM_RUBRIC_VERSION, MEMORY_EVAL_DIMENSIONS, MEMORY_EVAL_PUBLIC_LINE, MIN_CALIBRATION_SOURCE_TASKS, MITIGATED_BASELINE_SCENARIOS, type McpArgumentSemantic, type McpBackendErrorCode, type McpBackendResult, type McpBenchMemoryAdapter, type McpConformanceResult, type McpHttpTransportConfig, type McpListedTool, type McpMemCorrectAdapter, type McpMemoryAdapterOptions, McpMemoryBackendError, type McpMemoryToolMapping, type McpMemoryTransportConfig, type McpStdioTransportConfig, type McpToolCallResult, type McpToolClient, type McpToolMappingEntry, type McpToolMappingValue, type McpToolOperation, type Mem0AdapterConfig, Mem0MemCorrectAdapter, type MemCorrectGeneratorOptions, type MemCorrectJudgeRequest, type MemCorrectJudgeResult, type MemCorrectSystemAdapter, type MemoryEvalCategory, type MemoryEvalDimension, type MemoryEvalDimensionId, type MemoryEvalMetric, type MemoryGraph, type MemoryStats, type MemorySystem, type Message, type MetricAggregate, type MicroMetric, MissingCredentialError, type MitigatedBaselineConfig, type MitigatedTargetConfig, type MultipleChoiceQuestion, OPENAI_RESPONSES_JUDGE_RUBRIC_VERSION, OTHER_NAMESPACE_MEMORIES, type OllamaProviderConfig, type OpenAiCompatibleProviderConfig, OpenAiResponsesJudgeError, type OpenAiResponsesJudgeErrorCode, type OpenAiResponsesJudgeTelemetry, OpenAiResponsesProvider, type OpenAiResponsesProviderConfig, type OpenAiResponsesVerdict, type OpenAiResponsesVerdictResult, PROCEDURAL_REAL_SCENARIOS, PROCEDURAL_REAL_SCENARIOS_SMOKE, PUBLISHED_BENCHMARK_ARTIFACT_IDS, type PersonalizationRetrievalCase, type PreflightDiscoveredModel, type ProceduralAblationArtifact, type ProceduralAblationPerCase, type ProceduralAblationScenario, type ProceduralRealScenario, type ProceduralRealScenarioCategory, type ProviderBaseConfig, type ProviderConfig, type ProviderDiscoveryResult, type ProviderFactoryConfig, type PublishSkipReason, type PublishSkipRecord, type PublishedBenchmarkFeed, type PublishedBenchmarkFeedEntry, type PublishedBenchmarkId, REQUIRED_FRONTMATTER_FIELDS, type RecallMetrics, type RecoveredMemory, type RegressionDetail, type RegressionGateResult$1 as RegressionGateResult, type RemnicAdapterOptions, type ReportCardProvenanceContext, type ResolveBenchRuntimeProfileOptions, type ResolvedBenchRuntimeProfile, type ResolvedLocalLabProfile, type ResolvedLocalLabRole, type ResolvedRunBenchmarkOptions, type RotatedChoices, type RunBenchmarkOptions, type RunJudgeCalibrationOptions, type RunProceduralAblationCliArgs, type RunProceduralAblationOptions, type RunSequentialPhasesOptions, SCHEMA_TIER_FIXTURE, SCHEMA_TIER_SMOKE_FIXTURE, SEALED_PROMPT_REGISTRY, SINGLE_FLAG_ABLATION_MATRIX, SYNTHETIC_MEMORIES, type SanitizedDiagnosticProvider, type SavedBaseline, type SchemaTierCorpus, type SchemaTierFixture, type SchemaTierName, type SchemaTierPage, type SchemaTierPageFrontmatter, type SealedArtifact, type SealedJudgeDecision, type SealedJudgeInput, type SealedQrelsArtifact, type SealedQrelsHandle, type SealedRubric, type SearchResult, type SeededMemory, type SeededRng, type SequentialPhaseHooks, type SingleFlagAblationCell, type SingleFlagAblationId, type SpotCheckLogger, type StatisticalReport, type StructuredJudge, StructuredJudgeError, type StructuredJudgeErrorCode, type StructuredJudgeProvider, type StructuredJudgeTelemetry, type StructuredJudgeVerdict, type StructuredJudgeVerdictResult, type StructuredVerdictRequest, type SyntheticEdge, type SyntheticEmailIngestionAdapterOptions, type SyntheticFileIR, type SyntheticRepoConfig, type SyntheticSymbol, type SyntheticTargetOptions, type TaskResult, type TaskTokenUsage, type TemporalRetrievalCase, type ThirdPartyAdapterConfig, type TierDetail, type TimelineEntry, type TokenUsage, type WallMetric, type WriteBenchmarkArtifactResult, type ZepAdapterConfig, ZepMemCorrectAdapter, addContaminationEntry, aggregateTaskScores, answerBenchmarkQuestion, assertCanaryUnderFloor, assertIntegrityMetaPresent, assertPublishableIntegrity, assertSha256Hex, assistantMeetingPrepDefinition, assistantMorningBriefDefinition, assistantNextBestActionDefinition, assistantSynthesisDefinition, backlinkF1, binarizeJudgeScore, bootstrapCohensKappaConfidenceInterval, bootstrapMeanConfidenceInterval, buildAmaBenchDiagnosticMatrixArtifact, buildAmaBenchDiagnosticVariantSummary, buildAmaBenchLeaderboardRows, buildBaselineFromReport, buildBenchmarkArtifact, buildBenchmarkArtifactFilename, buildBenchmarkPublishFeed, buildBenchmarkReproManifest, buildBenchmarkRunSeeds, buildCodexCreditReceipt, buildJudgePayload, buildOracleTrajectoryRecall, buildSchemaTierFixture, buildSchemaTierSmokeFixture, calendarFixture, canonicalJsonStringify, captureMachineFingerprint, chatFixture, checkCodingGraphRegression, checkDatasetContamination, checkRegression, clampScore, cohensD, compareResults, computeCohensKappa, computeSealHash, containsAnswer, createSeededRng$1 as createAdamSeededRng, createAmaBenchDiagnosticAdapter, createAnthropicProvider, createCanaryAdapter, createClaudeCliProvider, createCodexCliProvider, createSeededRng as createCodingGraphSeededRng, createDeterministicSpotCheckLogger, createGatewayResponder, createLightweightAdapter, createLiteLlmProvider, createLocalLlmProvider, createMcpDemoMemCorrectAdapter, createMcpDemoMemoryAdapter, createMcpMemCorrectAdapter, createMcpMemoryAdapter, createMitigatedTarget, createOllamaProvider, createOpenAiCompatibleProvider, createOpenAiResponsesBenchJudge, createOpenAiResponsesProvider, createSeededRandom as createProceduralAblationSeededRandom, createProvider, createProviderBackedAmaBenchRecommendedJudge, createProviderBackedJudge, createProviderBackedResponder, createProviderBackedStructuredJudge, createRemnicAdapter, createResponderFromProvider, createSeededRng$2 as createSeededRng, createSpotCheckFileLogger, createStructuredBenchJudge, createStructuredJudgeFromProvider, createSyntheticEmailIngestionAdapter, createSyntheticTarget, createTimeoutGuardedAdapter, defaultBenchmarkBaselineDir, defaultBenchmarkPublishPath, deleteBenchmarkResults, diagnoseLoComoProfileDelta, diagnoseLoComoRecallDelta, discoverAllProviders, discoveryEndpointFor, emailFixture, entityRecall, exactMatch, extractMetrics as extractCodingGraphMetrics, extractMarkdownSectionsByTitle, f1Score, fixtureToAblationScenarios, formatHandoffNote, formatMissingDatasetError, generateReport, generateSyntheticRepo, getAblationCell, getBenchmark, getBenchmarkLowerIsBetter, getMemoryEvalDimension, getRemnicVersion, hashBenchmarkArtifact, hashBytes, hashCanonicalJson, hashString, integrityMetaIsComplete, interpretEffectSize, isAmaBenchUnknownLikeAnswer, isContaminationEntry, isContaminationManifest, isSealedQrelsArtifact, isSha256Hex, isStructuredJudgeProvider, judgeMemCorrectCorrectionAcceptance, judgeMemCorrectStaleMemoryHarm, linkMatches, listBenchmarkBaselines, listBenchmarkResults, listBenchmarks, listMemoryEvalBenchmarkIds, listMemoryEvalDimensions, llmJudgeScore, llmJudgeScoreDetailed, loadAblationFixture, loadBaseline, loadBeamDatasetPreview, loadBenchmarkArtifact, loadBenchmarkBaseline, loadBenchmarkReportCardProvenance, loadBenchmarkResult, loadCustomBenchmarkFile, loadJudgeCalibrationState, loadLoCoMo10, loadLocalLabManifest, loadLongMemEvalS, loadSealKeyFromEnv, loadSealedQrels, loadSealedRubric, matchEntity, mergeContaminationManifests, openSeal, orchestrateBenchmarkRuns, pairedDeltaConfidenceInterval, parseBenchmarkArtifact, parseCustomBenchmark, parseLocalLabManifest, parseRubricResponse, parseSealedQrels, pickStableQualifiedName, precisionAtK, preflightLocalLabRole, projectFolderFixture, recallAtK, reconcileCodexCreditLedger, redactBenchmarkResultSecrets, renderBaselineMarkdown, renderBenchmarkResultExport, renderLoComoProfileDeltaMarkdown, renderLoComoRecallDeltaMarkdown, renderMemorySummaryForJudge, renderMemoryViewForAgent, resolveAssistantAgent, resolveAssistantRubricId, resolveAssistantSeeds, resolveAssistantSpotCheckDir, resolveBenchRuntimeProfile, resolveBenchmarkPhaseTimeoutMs, resolveBenchmarkProgressLogging, resolveBenchmarkResultReference, resolveBenchmarkRunCount, resolveLocalLabProfile, resolveLocalLabRole, resolveStructuredJudge, rotateDistractors, rougeL, runAssistantBenchmark, runAssistantMeetingPrepBenchmark, runAssistantMorningBriefBenchmark, runAssistantNextBestActionBenchmark, runAssistantSynthesisBenchmark, runBaseline, runBenchSuite, runBenchmark, runCodingGraphBenchmark, runCustomBenchmarkFile, runExplain, runExtractionAttack, runJudgeCalibration, runMitigatedBaseline, runProceduralAblation, runProceduralAblationCli, runSealedJudge, runSequentialPhases, safeHexEqual, sanitizeLoComoResultReference, saveBaseline, saveBenchmarkBaseline, schemaCompleteness, sealPayload, selectAmaBenchDiagnosticVariants, selectCalibrationSlice, selectFixtureVariant, serializeBenchmarkArtifact, serializeJsonl, serializeSealedQrels, shuffleTasks, timed, verifyRubricDigest, writeBenchmarkArtifact, writeBenchmarkPublishFeed, writeBenchmarkReproManifest, writeBenchmarkResult, writeJudgeCalibrationState, writeLeaderboardArtifactsForResult, zeroScores };
package/dist/index.js CHANGED
@@ -5509,6 +5509,7 @@ import { mkdir as mkdir2, open, readFile as readFile3, rename as rename2, rmdir,
5509
5509
  import os from "os";
5510
5510
  import path3 from "path";
5511
5511
  var ONE_MILLION = 1e6;
5512
+ var CREDIT_EPSILON = 1e-9;
5512
5513
  var MAX_BOUNDED_CALL_CREDITS = 300;
5513
5514
  var SOL_MODEL = /^gpt-5\.6-sol$/i;
5514
5515
  var CREDIT_RATES = [
@@ -5534,6 +5535,123 @@ var CodexCreditDispatchError = class extends Error {
5534
5535
  this.name = "CodexCreditDispatchError";
5535
5536
  }
5536
5537
  };
5538
+ async function reconcileCodexCreditLedger(args) {
5539
+ if (args.originalBudgetBalanceConfirmed !== true) {
5540
+ throw new Error(
5541
+ "Codex credit reconciliation requires confirmation that the observed balance belongs to the ledger's original budget"
5542
+ );
5543
+ }
5544
+ if (args.noCreditsAddedOrRefundedConfirmed !== true) {
5545
+ throw new Error(
5546
+ "Codex credit reconciliation requires confirmation that no credits were added or refunded after the original budget was established"
5547
+ );
5548
+ }
5549
+ if (args.accountWideUnattributedChargeAccepted !== true) {
5550
+ throw new Error(
5551
+ "Codex credit reconciliation requires acknowledgment that all unexplained account activity will be charged as account-wide unattributed spend"
5552
+ );
5553
+ }
5554
+ if (!isSha256(args.priorLedgerSha256)) {
5555
+ throw new Error("priorLedgerSha256 must be a lowercase SHA-256 digest");
5556
+ }
5557
+ if (!Number.isFinite(args.observedRemainingCredits) || args.observedRemainingCredits < 0) {
5558
+ throw new Error("observedRemainingCredits must be a finite non-negative number");
5559
+ }
5560
+ const affectedRunId = parseRequiredRunId(args.affectedRunId, "affectedRunId");
5561
+ const ledgerPath = path3.resolve(expandHomeRelativePath(args.ledgerPath));
5562
+ const previous = completionQueue;
5563
+ let release;
5564
+ completionQueue = new Promise((resolve) => {
5565
+ release = resolve;
5566
+ });
5567
+ await previous;
5568
+ const lockPath = `${ledgerPath}.lock`;
5569
+ let lock;
5570
+ try {
5571
+ await mkdir2(path3.dirname(lockPath), { recursive: true, mode: 448 });
5572
+ lock = await acquireLedgerLock(lockPath);
5573
+ const contents = await readFile3(ledgerPath);
5574
+ const currentSha256 = sha256(contents);
5575
+ if (currentSha256 !== args.priorLedgerSha256) {
5576
+ throw new Error(
5577
+ `Codex credit ledger changed since operator observation: expected ${args.priorLedgerSha256}, found ${currentSha256}; obtain a fresh ledger hash and remaining balance`
5578
+ );
5579
+ }
5580
+ const ledger = parseLedger(JSON.parse(contents.toString("utf8")));
5581
+ if (!ledger.blockedReason) {
5582
+ throw new Error("Codex credit ledger is not blocked; reconciliation is not permitted");
5583
+ }
5584
+ if (args.observedRemainingCredits > ledger.budgetCredits) {
5585
+ throw new Error("observedRemainingCredits cannot exceed the ledger budget");
5586
+ }
5587
+ const rawUnattributedCredits = ledger.budgetCredits - args.observedRemainingCredits - ledger.spentCredits;
5588
+ if (!Number.isFinite(rawUnattributedCredits) || rawUnattributedCredits < -CREDIT_EPSILON) {
5589
+ throw new Error(
5590
+ "observedRemainingCredits implies less spend than the ledger already records; reconciliation refused"
5591
+ );
5592
+ }
5593
+ const unattributedCredits = Math.abs(rawUnattributedCredits) <= CREDIT_EPSILON ? 0 : rawUnattributedCredits;
5594
+ const observedSpentCredits = ledger.spentCredits + unattributedCredits;
5595
+ const at = (/* @__PURE__ */ new Date()).toISOString();
5596
+ const reconciliation = {
5597
+ at,
5598
+ basis: "operator-observed-original-budget-balance",
5599
+ attribution: "account-wide-unattributed",
5600
+ priorLedgerSha256: currentSha256,
5601
+ originalBudgetCredits: ledger.budgetCredits,
5602
+ priorRecordedSpentCredits: ledger.spentCredits,
5603
+ observedRemainingCredits: args.observedRemainingCredits,
5604
+ credits: normalizeZero(unattributedCredits),
5605
+ confirmations: {
5606
+ observedBalanceBelongsToOriginalBudget: true,
5607
+ noCreditsAddedOrRefunded: true,
5608
+ accountWideUnattributedChargeAccepted: true
5609
+ },
5610
+ affectedBlockedEvent: {
5611
+ runId: affectedRunId,
5612
+ blockedReason: ledger.blockedReason
5613
+ }
5614
+ };
5615
+ const nextLedger = {
5616
+ ...ledger,
5617
+ spentCredits: observedSpentCredits,
5618
+ reconciliations: [...ledger.reconciliations ?? [], reconciliation],
5619
+ blockedReason: void 0
5620
+ };
5621
+ await writeLedger(ledgerPath, nextLedger);
5622
+ await writeLockState(lock, "settled");
5623
+ const nextContents = await readFile3(ledgerPath);
5624
+ return {
5625
+ schemaVersion: 1,
5626
+ priorLedgerSha256: currentSha256,
5627
+ ledgerSha256: sha256(nextContents),
5628
+ at,
5629
+ attribution: "account-wide-unattributed",
5630
+ affectedRunId,
5631
+ originalBudgetCredits: ledger.budgetCredits,
5632
+ priorRecordedSpentCredits: ledger.spentCredits,
5633
+ observedRemainingCredits: args.observedRemainingCredits,
5634
+ unattributedCredits: reconciliation.credits,
5635
+ totalSpentCredits: observedSpentCredits,
5636
+ totalRemainingCredits: args.observedRemainingCredits,
5637
+ affectedBlockedEventSha256: sha256(
5638
+ JSON.stringify(reconciliation.affectedBlockedEvent)
5639
+ )
5640
+ };
5641
+ } finally {
5642
+ try {
5643
+ if (lock) {
5644
+ try {
5645
+ await lock.close();
5646
+ } finally {
5647
+ await removeOwnedLedgerLock(lockPath);
5648
+ }
5649
+ }
5650
+ } finally {
5651
+ release();
5652
+ }
5653
+ }
5654
+ }
5537
5655
  function resolveCodexCreditBudgetConfig(env = process.env, fallbackRunId) {
5538
5656
  const rawBudget = env.REMNIC_BENCH_CODEX_CREDIT_BUDGET?.trim();
5539
5657
  if (!rawBudget) return void 0;
@@ -5793,11 +5911,12 @@ async function buildCodexCreditReceipt(ledgerPath, runId) {
5793
5911
  const contents = await readFile3(resolvedPath);
5794
5912
  const ledger = parseLedger(JSON.parse(contents.toString("utf8")));
5795
5913
  const normalizedRunId = parseOptionalRunId(runId);
5796
- const cumulative = summarizeLedgerEntries(ledger.entries);
5914
+ const reconciliations = ledger.reconciliations ?? [];
5915
+ const cumulative = summarizeLedgerEntries(ledger.entries, reconciliations);
5797
5916
  const runEntries = normalizedRunId ? ledger.entries.filter((entry) => entry.runId === normalizedRunId) : [];
5798
5917
  return {
5799
5918
  schemaVersion: 1,
5800
- ledgerSha256: createHash3("sha256").update(contents).digest("hex"),
5919
+ ledgerSha256: sha256(contents),
5801
5920
  budgetCredits: ledger.budgetCredits,
5802
5921
  reserveCredits: ledger.reserveCredits,
5803
5922
  plannedSpendCeilingCredits: ledger.budgetCredits - ledger.reserveCredits,
@@ -5805,7 +5924,12 @@ async function buildCodexCreditReceipt(ledgerPath, runId) {
5805
5924
  totalRemainingCredits: ledger.budgetCredits - ledger.spentCredits,
5806
5925
  blocked: ledger.blockedReason !== void 0,
5807
5926
  cumulative,
5808
- ...normalizedRunId ? { run: { id: normalizedRunId, ...summarizeLedgerEntries(runEntries) } } : {}
5927
+ ...normalizedRunId ? {
5928
+ run: {
5929
+ id: normalizedRunId,
5930
+ ...summarizeLedgerEntries(runEntries)
5931
+ }
5932
+ } : {}
5809
5933
  };
5810
5934
  }
5811
5935
  function resolveRate(model) {
@@ -5852,11 +5976,36 @@ function parseLedger(parsed) {
5852
5976
  (sum, entry) => sum + (typeof entry?.credits === "number" ? entry.credits ?? 0 : 0),
5853
5977
  0
5854
5978
  ) : Number.NaN;
5855
- if (parsed.schemaVersion !== 1 || typeof parsed.budgetCredits !== "number" || !Number.isFinite(parsed.budgetCredits) || parsed.budgetCredits <= 0 || typeof parsed.reserveCredits !== "number" || !Number.isFinite(parsed.reserveCredits) || parsed.reserveCredits < 0 || parsed.reserveCredits >= parsed.budgetCredits || typeof parsed.spentCredits !== "number" || !Number.isFinite(parsed.spentCredits) || parsed.spentCredits < 0 || !Array.isArray(parsed.entries) || !parsed.entries.every(isLedgerEntry) || Math.abs(entryCredits - parsed.spentCredits) > 1e-9 || parsed.blockedReason !== void 0 && typeof parsed.blockedReason !== "string") {
5979
+ const reconciliationCredits = parsed.reconciliations === void 0 ? 0 : Array.isArray(parsed.reconciliations) ? parsed.reconciliations.reduce(
5980
+ (sum, reconciliation) => sum + (typeof reconciliation?.credits === "number" ? reconciliation.credits ?? 0 : 0),
5981
+ 0
5982
+ ) : Number.NaN;
5983
+ if (parsed.schemaVersion !== 1 || typeof parsed.budgetCredits !== "number" || !Number.isFinite(parsed.budgetCredits) || parsed.budgetCredits <= 0 || typeof parsed.reserveCredits !== "number" || !Number.isFinite(parsed.reserveCredits) || parsed.reserveCredits < 0 || parsed.reserveCredits >= parsed.budgetCredits || typeof parsed.spentCredits !== "number" || !Number.isFinite(parsed.spentCredits) || parsed.spentCredits < 0 || !Array.isArray(parsed.entries) || !parsed.entries.every(isLedgerEntry) || parsed.reconciliations !== void 0 && (!Array.isArray(parsed.reconciliations) || !parsed.reconciliations.every(
5984
+ (reconciliation) => isLedgerReconciliationWithinBudget(reconciliation, parsed.budgetCredits)
5985
+ )) || Math.abs(entryCredits + reconciliationCredits - parsed.spentCredits) > 1e-9 || parsed.blockedReason !== void 0 && typeof parsed.blockedReason !== "string") {
5856
5986
  throw new Error("ledger schema is invalid");
5857
5987
  }
5858
5988
  return parsed;
5859
5989
  }
5990
+ function isLedgerReconciliation(value) {
5991
+ if (!value || typeof value !== "object") return false;
5992
+ const candidate = value;
5993
+ const forbiddenUsageFields = [
5994
+ "runId",
5995
+ "unknownEvent",
5996
+ "model",
5997
+ "inputTokens",
5998
+ "cachedInputTokens",
5999
+ "outputTokens",
6000
+ "reasoningOutputTokens"
6001
+ ];
6002
+ return forbiddenUsageFields.every((field) => !Object.prototype.hasOwnProperty.call(candidate, field)) && isIsoTimestamp(candidate.at) && candidate.basis === "operator-observed-original-budget-balance" && candidate.attribution === "account-wide-unattributed" && isSha256(candidate.priorLedgerSha256) && typeof candidate.originalBudgetCredits === "number" && Number.isFinite(candidate.originalBudgetCredits) && candidate.originalBudgetCredits > 0 && typeof candidate.priorRecordedSpentCredits === "number" && Number.isFinite(candidate.priorRecordedSpentCredits) && candidate.priorRecordedSpentCredits >= 0 && typeof candidate.observedRemainingCredits === "number" && Number.isFinite(candidate.observedRemainingCredits) && candidate.observedRemainingCredits >= 0 && typeof candidate.credits === "number" && Number.isFinite(candidate.credits) && candidate.credits >= 0 && candidate.confirmations?.observedBalanceBelongsToOriginalBudget === true && candidate.confirmations.noCreditsAddedOrRefunded === true && candidate.confirmations.accountWideUnattributedChargeAccepted === true && isValidStoredRunId(candidate.affectedBlockedEvent?.runId) && typeof candidate.affectedBlockedEvent?.blockedReason === "string" && candidate.affectedBlockedEvent.blockedReason.length > 0;
6003
+ }
6004
+ function isLedgerReconciliationWithinBudget(value, budget) {
6005
+ return typeof budget === "number" && isLedgerReconciliation(value) && value.originalBudgetCredits === budget && value.observedRemainingCredits <= budget && value.credits <= budget && Math.abs(
6006
+ value.priorRecordedSpentCredits + value.credits + value.observedRemainingCredits - budget
6007
+ ) <= 1e-9;
6008
+ }
5860
6009
  function isLedgerEntry(entry) {
5861
6010
  if (!entry || typeof entry !== "object") return false;
5862
6011
  const candidate = entry;
@@ -5869,7 +6018,7 @@ function isEntryCreditConsistent(entry) {
5869
6018
  return false;
5870
6019
  }
5871
6020
  }
5872
- function summarizeLedgerEntries(entries) {
6021
+ function summarizeLedgerEntries(entries, reconciliations = []) {
5873
6022
  const byModel = /* @__PURE__ */ new Map();
5874
6023
  for (const entry of entries) {
5875
6024
  const modelEntries = byModel.get(entry.model) ?? [];
@@ -5879,7 +6028,12 @@ function summarizeLedgerEntries(entries) {
5879
6028
  const totals = summarizeUsage(entries);
5880
6029
  return {
5881
6030
  calls: entries.length,
5882
- credits: entries.reduce((sum, entry) => sum + entry.credits, 0),
6031
+ credits: entries.reduce((sum, entry) => sum + entry.credits, 0) + reconciliations.reduce((sum, reconciliation) => sum + reconciliation.credits, 0),
6032
+ unattributedReconciliationCount: reconciliations.length,
6033
+ unattributedReconciledCredits: reconciliations.reduce(
6034
+ (sum, reconciliation) => sum + reconciliation.credits,
6035
+ 0
6036
+ ),
5883
6037
  ...totals,
5884
6038
  models: [...byModel.entries()].sort(([left], [right]) => left.localeCompare(right)).map(([model, modelEntries]) => ({
5885
6039
  model,
@@ -5958,6 +6112,30 @@ function hasControlCharacters(value) {
5958
6112
  }
5959
6113
  return false;
5960
6114
  }
6115
+ function parseRequiredRunId(value, name) {
6116
+ const runId = value?.trim();
6117
+ if (!runId || !isValidStoredRunId(runId)) {
6118
+ throw new Error(`${name} must be 1 to 128 trimmed characters without control characters`);
6119
+ }
6120
+ return runId;
6121
+ }
6122
+ function isSha256(value) {
6123
+ return typeof value === "string" && /^[a-f0-9]{64}$/.test(value);
6124
+ }
6125
+ function sha256(value) {
6126
+ return createHash3("sha256").update(value).digest("hex");
6127
+ }
6128
+ function normalizeZero(value) {
6129
+ return Object.is(value, -0) ? 0 : value;
6130
+ }
6131
+ function isIsoTimestamp(value) {
6132
+ if (typeof value !== "string") return false;
6133
+ try {
6134
+ return new Date(value).toISOString() === value;
6135
+ } catch {
6136
+ return false;
6137
+ }
6138
+ }
5961
6139
 
5962
6140
  // src/results-store.ts
5963
6141
  import { mkdir as mkdir3, readdir as readdir3, readFile as readFile4, unlink as unlink3, writeFile as writeFile3 } from "fs/promises";
@@ -32106,9 +32284,9 @@ function loadSealedRubric(id = DEFAULT_ASSISTANT_RUBRIC_ID, options = {}) {
32106
32284
  if (typeof prompt !== "string" || prompt.length === 0) {
32107
32285
  throw new Error(`sealed rubric not found in registry: ${id}`);
32108
32286
  }
32109
- const sha2562 = createHash9("sha256").update(prompt, "utf8").digest("hex");
32287
+ const sha2563 = createHash9("sha256").update(prompt, "utf8").digest("hex");
32110
32288
  const version = parseVersionFromId(id);
32111
- return { id, version, prompt, sha256: sha2562 };
32289
+ return { id, version, prompt, sha256: sha2563 };
32112
32290
  }
32113
32291
  function verifyRubricDigest(expectedSha256, options = {}) {
32114
32292
  const rubric = loadSealedRubric(options.id, { registry: options.registry });
@@ -38325,8 +38503,8 @@ function buildRegression(task, metric, excerptChars, maxDiffLines) {
38325
38503
  baselineScore,
38326
38504
  realScore,
38327
38505
  delta: realScore - baselineScore,
38328
- questionSha256: sha256(normalizeText3(task.baseline.question)),
38329
- expectedAnswerSha256: sha256(normalizeText3(task.baseline.expected)),
38506
+ questionSha256: sha2562(normalizeText3(task.baseline.question)),
38507
+ expectedAnswerSha256: sha2562(normalizeText3(task.baseline.expected)),
38330
38508
  baseline: {
38331
38509
  answer: textDigest(task.baseline.actual, excerptChars),
38332
38510
  recall: recallSummary(baselineRecall, task.baseline.expected)
@@ -38360,7 +38538,7 @@ function buildProvenance(evidence, profile, joined, side) {
38360
38538
  judgeProvider: judge.provider,
38361
38539
  judgeModel: judge.model,
38362
38540
  seeds: [...evidence.result.meta.seeds],
38363
- taskPayloadSha256: sha256(stableJson(payload))
38541
+ taskPayloadSha256: sha2562(stableJson(payload))
38364
38542
  };
38365
38543
  }
38366
38544
  function summarizeMetric(tasks, metric) {
@@ -38400,7 +38578,7 @@ function recallSummary(text, expected) {
38400
38578
  const normalized = normalizeText3(text);
38401
38579
  const lines = normalized.split("\n").map((line) => line.trim()).filter(Boolean);
38402
38580
  return {
38403
- sha256: sha256(normalized),
38581
+ sha256: sha2562(normalized),
38404
38582
  charCount: normalized.length,
38405
38583
  lineCount: lines.length,
38406
38584
  headings: [...new Set(lines.filter(isHeading))],
@@ -38411,7 +38589,7 @@ function recallSummary(text, expected) {
38411
38589
  function textDigest(text, excerptChars) {
38412
38590
  const normalized = normalizeText3(text);
38413
38591
  return {
38414
- sha256: sha256(normalized),
38592
+ sha256: sha2562(normalized),
38415
38593
  charCount: normalized.length,
38416
38594
  excerpt: normalized.slice(0, excerptChars)
38417
38595
  };
@@ -38523,7 +38701,7 @@ function isHeading(line) {
38523
38701
  function normalizeText3(value) {
38524
38702
  return value.replaceAll("\r\n", "\n").replaceAll("\r", "\n");
38525
38703
  }
38526
- function sha256(value) {
38704
+ function sha2562(value) {
38527
38705
  return createHash13("sha256").update(value).digest("hex");
38528
38706
  }
38529
38707
  function stableJson(value) {
@@ -42293,6 +42471,7 @@ export {
42293
42471
  buildBenchmarkPublishFeed,
42294
42472
  buildBenchmarkReproManifest,
42295
42473
  buildBenchmarkRunSeeds,
42474
+ buildCodexCreditReceipt,
42296
42475
  buildJudgePayload,
42297
42476
  buildOracleTrajectoryRecall,
42298
42477
  buildSchemaTierFixture,
@@ -42421,6 +42600,7 @@ export {
42421
42600
  preflightLocalLabRole,
42422
42601
  projectFolderFixture,
42423
42602
  recallAtK,
42603
+ reconcileCodexCreditLedger,
42424
42604
  redactBenchmarkResultSecrets,
42425
42605
  renderBaselineMarkdown,
42426
42606
  renderBenchmarkResultExport,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnic/bench",
3
- "version": "9.6.22",
3
+ "version": "9.6.23",
4
4
  "description": "Retrieval latency ladder benchmarks + CI regression gates for @remnic/core",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -39,8 +39,8 @@
39
39
  "hyparquet": "^1.25.7",
40
40
  "yaml": "^2.4.2",
41
41
  "zod": "^3.24.0",
42
- "@remnic/coding-graph": "^9.6.22",
43
- "@remnic/core": "^9.6.22"
42
+ "@remnic/coding-graph": "^9.6.23",
43
+ "@remnic/core": "^9.6.23"
44
44
  },
45
45
  "devDependencies": {
46
46
  "tsup": "^8.5.1",