@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.
Files changed (43) hide show
  1. package/.dz-manifest.json +82 -34
  2. package/README.md +3 -1
  3. package/dist/compounding.d.ts +27 -0
  4. package/dist/compounding.d.ts.map +1 -1
  5. package/dist/compounding.js +29 -0
  6. package/dist/compounding.js.map +1 -1
  7. package/dist/cost-ledger.d.ts +318 -0
  8. package/dist/cost-ledger.d.ts.map +1 -0
  9. package/dist/cost-ledger.js +871 -0
  10. package/dist/cost-ledger.js.map +1 -0
  11. package/dist/cost-scoring.d.ts +9 -0
  12. package/dist/cost-scoring.d.ts.map +1 -1
  13. package/dist/cost-scoring.js +18 -0
  14. package/dist/cost-scoring.js.map +1 -1
  15. package/dist/event-chain.d.ts +302 -0
  16. package/dist/event-chain.d.ts.map +1 -0
  17. package/dist/event-chain.js +663 -0
  18. package/dist/event-chain.js.map +1 -0
  19. package/dist/index.d.ts +9 -3
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +6 -2
  22. package/dist/index.js.map +1 -1
  23. package/dist/operations.d.ts.map +1 -1
  24. package/dist/operations.js +26 -0
  25. package/dist/operations.js.map +1 -1
  26. package/dist/recall-usage.d.ts +52 -4
  27. package/dist/recall-usage.d.ts.map +1 -1
  28. package/dist/recall-usage.js +106 -21
  29. package/dist/recall-usage.js.map +1 -1
  30. package/dist/usage.d.ts +32 -0
  31. package/dist/usage.d.ts.map +1 -1
  32. package/dist/usage.js +59 -10
  33. package/dist/usage.js.map +1 -1
  34. package/package.json +3 -3
  35. package/sbom.json +153 -33
  36. package/src/compounding.ts +61 -0
  37. package/src/cost-ledger.ts +1105 -0
  38. package/src/cost-scoring.ts +17 -0
  39. package/src/event-chain.ts +870 -0
  40. package/src/index.ts +86 -0
  41. package/src/operations.ts +25 -0
  42. package/src/recall-usage.ts +142 -24
  43. package/src/usage.ts +74 -12
@@ -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-]+\//, '');