Skip to content

E1-A: computeClass + canonical pricing engine - #34

Merged
Mayakovsky merged 3 commits into
mainfrom
expansion-e1-a-computeclass
Aug 2, 2026
Merged

E1-A: computeClass + canonical pricing engine#34
Mayakovsky merged 3 commits into
mainfrom
expansion-e1-a-computeclass

Conversation

@Mayakovsky

Copy link
Copy Markdown
Owner

Summary

  • New @grey/schemas/pricing: ComputeClass (CACHE_ONLY/LIVE_ALLOWED/LIVE_PRIORITY), canonical price table classifying all 9 offerings, networkMultiplier resolution (x402/acp both 1.00x, grandfathered).
  • Invariant M6 Phase D — run acp-adapter under node --import tsx (FDQ-70) #30 enforced at the cacheOrLive.ts boundary: CACHE_ONLY offerings can never trigger live compute, including a paid retry. Type-level guarantee (O extends ComputeOfferingSlug) backed by a runtime fail-closed assertion.
  • Invariant M6 — FDQ-70 root-cause SDK import fix (drop tsx) + FDQ-70b setBudget idempotency guard #31: x402-middleware/prices.ts and acp-adapter/pricing.ts now resolve price via the canonical table x each channel's own multiplier, instead of holding hardcoded literals.
  • No external surface change on this phase — existing x402/ACP request/response behavior is byte-identical (asserted by the pre-existing prices.test.ts passing unmodified).

Test plan

  • pnpm build && pnpm test && pnpm typecheck && pnpm lint green across all 7 workspace packages
  • New tests: pricing.test.ts, cacheOrLive.test.ts Invariant M6 Phase D — run acp-adapter under node --import tsx (FDQ-70) #30 block, acp-adapter pricing.test.ts
  • Existing x402-middleware/prices.test.ts passes unmodified (byte-identical output proof)

EXPANSION-E1-A-KOV-directive.md.

🤖 Generated with Claude Code

New ./pricing subpath (Invariant #31 single source): ComputeClass
('CACHE_ONLY' | 'LIVE_ALLOWED' | 'LIVE_PRIORITY'), OfferingPricing,
PRICING_TABLE classifying all 9 offerings, and networkMultiplier
resolution (x402/acp both 1.00x, grandfathered per spec 2.3).

Canonicalizes the existing 7 prices as-is -- no repricing. The 2
offerings with no existing canonical price (daily_greenlight_list,
scam_alert_feed) carry canonicalUsd: null, flagged for Desktop to
source before merge rather than invented.

EXPANSION-E1-A-KOV-directive.md Task 1.
Invariant #30: CACHE_ONLY offerings never trigger live compute, incl.
a paid retry. O extends ComputeOfferingSlug already makes the 5
CACHE_ONLY slugs uncallable at compile time -- adds the runtime
fail-closed assertion as defense-in-depth (same posture as Invariant
#27's fail-open guards, inverted), plus tests proving every CACHE_ONLY
offering is rejected before any discovery/pipeline side effect runs.

EXPANSION-E1-A-KOV-directive.md Task 2.
Invariant #31: adapters never hold a hardcoded price literal now.
x402-middleware/prices.ts derives its PRICE_TABLE from
@grey/schemas/pricing's resolvePriceUsd(slug, 'x402') instead of
holding the literal USD/atomic table; priceAtomicFor/priceUsdFor
resolve through the canonical table at call time. acp-adapter gets
its own resolver (pricing.ts, channel 'acp') instead of borrowing
x402's priceUsdFor -- both channels are 1.00x today, so output is
byte-identical, but a future per-channel multiplier (E3 Olas 0.65x)
is now a config entry in @grey/schemas, not new code in either
adapter.

No external surface change: existing prices.test.ts (7 slugs' usd +
atomic values) passes unmodified: request/response behavior is
byte-identical pre/post.

EXPANSION-E1-A-KOV-directive.md Task 3.
@Mayakovsky
Mayakovsky merged commit c4a7185 into main Aug 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant