@remnic/bench 9.7.5 → 9.7.7
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/dist/index.js +18 -5
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5930,6 +5930,7 @@ function isBenchmarkRunBlockedError(error) {
|
|
|
5930
5930
|
|
|
5931
5931
|
// src/providers/codex-credit-budget.ts
|
|
5932
5932
|
var MAX_BOUNDED_CALL_CREDITS = 300;
|
|
5933
|
+
var LEGACY_LEDGER_FLOAT_DRIFT_TOLERANCE = 1e-9;
|
|
5933
5934
|
var SOL_MODEL = /^gpt-5\.6-sol$/i;
|
|
5934
5935
|
var CREDIT_RATES = [
|
|
5935
5936
|
[/^gpt-5\.6-sol$/i, { input: 125, cachedInput: 12.5, output: 750 }],
|
|
@@ -6502,18 +6503,17 @@ function isLedgerV1(value) {
|
|
|
6502
6503
|
const candidate = value;
|
|
6503
6504
|
const entries = candidate.entries;
|
|
6504
6505
|
const reconciliations = candidate.reconciliations;
|
|
6505
|
-
return candidate.schemaVersion === 1 && isPositiveFinite(candidate.budgetCredits) && isSupportedBudgetUnits(candidate.budgetCredits) && isNonNegativeFinite(candidate.reserveCredits) && isSupportedBudgetUnits(candidate.reserveCredits) && candidate.reserveCredits < candidate.budgetCredits && isNonNegativeFinite(candidate.spentCredits) &&
|
|
6506
|
-
entries.reduce((sum, entry) => sum + entry.credits, 0) + (reconciliations ?? []).reduce((sum, item) => sum + item.credits, 0) - candidate.spentCredits
|
|
6507
|
-
) <= 1e-9 && (candidate.blockedReason === void 0 || typeof candidate.blockedReason === "string" && candidate.blockedReason.length > 0);
|
|
6506
|
+
return candidate.schemaVersion === 1 && isPositiveFinite(candidate.budgetCredits) && isSupportedBudgetUnits(candidate.budgetCredits) && isNonNegativeFinite(candidate.reserveCredits) && isSupportedBudgetUnits(candidate.reserveCredits) && candidate.reserveCredits < candidate.budgetCredits && isNonNegativeFinite(candidate.spentCredits) && Array.isArray(entries) && entries.every(isLedgerEntryV1) && (reconciliations === void 0 || Array.isArray(reconciliations) && reconciliations.every((item) => isLedgerReconciliationWithinBudgetV1(item, candidate.budgetCredits))) && isLedgerV1SpentConsistent(candidate) && (candidate.blockedReason === void 0 || typeof candidate.blockedReason === "string" && candidate.blockedReason.length > 0);
|
|
6508
6507
|
}
|
|
6509
6508
|
function migrateLedgerV1(ledger, sourceContents) {
|
|
6510
6509
|
const source = sourceContents ? Buffer.from(sourceContents).toString("utf8") : `${JSON.stringify(ledger)}
|
|
6511
6510
|
`;
|
|
6511
|
+
const spentUnits = nanounitsToBudgetUnits(ledgerV1SpentNanounits(ledger));
|
|
6512
6512
|
return {
|
|
6513
6513
|
schemaVersion: 2,
|
|
6514
6514
|
budgetUnits: ledger.budgetCredits,
|
|
6515
6515
|
reserveUnits: ledger.reserveCredits,
|
|
6516
|
-
spentUnits
|
|
6516
|
+
spentUnits,
|
|
6517
6517
|
entries: ledger.entries.map(({ credits, ...entry }) => ({ ...entry, budgetUnits: credits })),
|
|
6518
6518
|
...ledger.reconciliations?.length ? { legacyReconciliations: ledger.reconciliations } : {},
|
|
6519
6519
|
migratedFromV1Sha256: sha256(source),
|
|
@@ -6610,7 +6610,7 @@ function isDirectV1PredecessorResolution(ledger, resolution) {
|
|
|
6610
6610
|
} catch {
|
|
6611
6611
|
return false;
|
|
6612
6612
|
}
|
|
6613
|
-
return isLedgerV1(predecessor) && resolution.priorEntryCount === predecessor.entries.length && resolution.priorLedgerSha256 === ledger.migratedFromV1Sha256 && budgetUnitsToNanounits(resolution.priorRecordedSpentUnits) ===
|
|
6613
|
+
return isLedgerV1(predecessor) && resolution.priorEntryCount === predecessor.entries.length && resolution.priorLedgerSha256 === ledger.migratedFromV1Sha256 && budgetUnitsToNanounits(resolution.priorRecordedSpentUnits) === ledgerV1SpentNanounits(predecessor) && predecessor.blockedReason === resolution.affectedBlockedEvent.reason;
|
|
6614
6614
|
}
|
|
6615
6615
|
function isBlockedEvent(value) {
|
|
6616
6616
|
if (!value || typeof value !== "object") return false;
|
|
@@ -6817,6 +6817,19 @@ function nanounitsToBudgetUnits(value) {
|
|
|
6817
6817
|
function sumBudgetUnitNanounits(values) {
|
|
6818
6818
|
return values.reduce((sum, value) => sum + budgetUnitsToNanounits(value), 0n);
|
|
6819
6819
|
}
|
|
6820
|
+
function ledgerV1SpentNanounits(ledger) {
|
|
6821
|
+
return sumBudgetUnitNanounits(ledger.entries.map((entry) => entry.credits)) + sumBudgetUnitNanounits((ledger.reconciliations ?? []).map((reconciliation) => reconciliation.credits));
|
|
6822
|
+
}
|
|
6823
|
+
function isLedgerV1SpentConsistent(ledger) {
|
|
6824
|
+
try {
|
|
6825
|
+
const exactSpentNanounits = ledgerV1SpentNanounits(ledger);
|
|
6826
|
+
if (exactSpentNanounits > BigInt(Number.MAX_SAFE_INTEGER)) return false;
|
|
6827
|
+
const exactSpentUnits = nanounitsToBudgetUnits(exactSpentNanounits);
|
|
6828
|
+
return Math.abs(exactSpentUnits - ledger.spentCredits) <= LEGACY_LEDGER_FLOAT_DRIFT_TOLERANCE;
|
|
6829
|
+
} catch {
|
|
6830
|
+
return false;
|
|
6831
|
+
}
|
|
6832
|
+
}
|
|
6820
6833
|
function ledgerSpentNanounits(ledger) {
|
|
6821
6834
|
return sumBudgetUnitNanounits(ledger.entries.map((entry) => entry.budgetUnits)) + sumBudgetUnitNanounits((ledger.resolutions ?? []).map((resolution) => resolution.localBudgetChargeUnits)) + sumBudgetUnitNanounits((ledger.legacyReconciliations ?? []).map((reconciliation) => reconciliation.credits));
|
|
6822
6835
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remnic/bench",
|
|
3
|
-
"version": "9.7.
|
|
3
|
+
"version": "9.7.7",
|
|
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.7.
|
|
43
|
-
"@remnic/core": "^9.7.
|
|
42
|
+
"@remnic/coding-graph": "^9.7.7",
|
|
43
|
+
"@remnic/core": "^9.7.7"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"tsup": "^8.5.1",
|