@dzhechkov/harness-core 0.3.145 → 0.3.147
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/.dz-manifest.json +82 -34
- package/README.md +3 -1
- package/dist/compounding.d.ts +27 -0
- package/dist/compounding.d.ts.map +1 -1
- package/dist/compounding.js +29 -0
- package/dist/compounding.js.map +1 -1
- package/dist/cost-ledger.d.ts +318 -0
- package/dist/cost-ledger.d.ts.map +1 -0
- package/dist/cost-ledger.js +871 -0
- package/dist/cost-ledger.js.map +1 -0
- package/dist/cost-scoring.d.ts +9 -0
- package/dist/cost-scoring.d.ts.map +1 -1
- package/dist/cost-scoring.js +18 -0
- package/dist/cost-scoring.js.map +1 -1
- package/dist/event-chain.d.ts +302 -0
- package/dist/event-chain.d.ts.map +1 -0
- package/dist/event-chain.js +663 -0
- package/dist/event-chain.js.map +1 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +26 -0
- package/dist/operations.js.map +1 -1
- package/dist/recall-usage.d.ts +52 -4
- package/dist/recall-usage.d.ts.map +1 -1
- package/dist/recall-usage.js +106 -21
- package/dist/recall-usage.js.map +1 -1
- package/dist/usage.d.ts +32 -0
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js +59 -10
- package/dist/usage.js.map +1 -1
- package/package.json +3 -3
- package/sbom.json +153 -33
- package/src/compounding.ts +61 -0
- package/src/cost-ledger.ts +1105 -0
- package/src/cost-scoring.ts +17 -0
- package/src/event-chain.ts +870 -0
- package/src/index.ts +86 -0
- package/src/operations.ts +25 -0
- package/src/recall-usage.ts +142 -24
- package/src/usage.ts +74 -12
package/src/cost-scoring.ts
CHANGED
|
@@ -78,6 +78,23 @@ const FALLBACK_PRICING = priced(3 / 1e6, 15 / 1e6);
|
|
|
78
78
|
* Resolve a model id to its pricing by longest-prefix match.
|
|
79
79
|
* `bedrock/anthropic.claude-3-opus...` → strips a leading `provider/` segment.
|
|
80
80
|
*/
|
|
81
|
+
/**
|
|
82
|
+
* Whether {@link pricingFor} will find a REAL entry for this model id, or silently fall back to
|
|
83
|
+
* {@link FALLBACK_PRICING} (sonnet-class).
|
|
84
|
+
*
|
|
85
|
+
* Exists so a cost surface can REPORT the fallback instead of hiding it: `claude-fable-*` has no
|
|
86
|
+
* entry in {@link MODEL_PRICES} and is the default model of every recorded feature-adr run, so its
|
|
87
|
+
* dollar figures are priced at a fallback rate (feature `cost-ledger`, ADR-003).
|
|
88
|
+
*/
|
|
89
|
+
export function hasKnownPricing(modelId: string): boolean {
|
|
90
|
+
if (typeof modelId !== 'string' || modelId.length === 0) return false;
|
|
91
|
+
const id = modelId.toLowerCase().replace(/^[a-z0-9-]+\//, '');
|
|
92
|
+
for (const key of Object.keys(MODEL_PRICES)) {
|
|
93
|
+
if (id.startsWith(key)) return true;
|
|
94
|
+
}
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
|
|
81
98
|
export function pricingFor(modelId: string): ModelPricing {
|
|
82
99
|
// Strip a leading `provider/` segment (e.g. `bedrock/`, `us-east-1/`).
|
|
83
100
|
const id = modelId.toLowerCase().replace(/^[a-z0-9-]+\//, '');
|