Rate limiting was per-API-key, so an org's `plan` field was decorative — a
free-plan org that minted 5 teammate keys got 5x the effective request
budget of a single-key free org. Org-scoped keys now share ONE rate-limit
bucket per org (`org:<id>`), sized by plan (free=120, pro=1000,
enterprise=10000 per window); orgless credentials (platform admin key,
anonymous dev identities) keep the prior per-identity behavior unchanged.
Adds GET /v1/orgs/usage (bucket status + total request count across an
org's keys) and a shared-bucket meter in the Orgs self-service console
panel.
Verified against a running dev server: 130 concurrent requests on a
free-plan org's owner key yielded exactly 120 successes + 10 real 429s,
and the org's teammate key immediately inherited the same depleted
remaining count (proving the bucket is shared, not per-key). A parallel
enterprise-plan org was unaffected. tsc + frontend build clean, 450/450
existing tests unchanged.
Backlog item 13: API keys had no tenant boundary — any valid admin key (or,
in dev, no key at all) could see or mutate every key, webhook, and resource
in the process, which isn't multi-tenant for real paying integrators.
Adds a real org layer: the platform operator onboards a new org once
(POST /v1/orgs, admin-scoped) and gets its first owner key back; from then
on the org is fully self-service through its OWN key — GET /v1/orgs/me,
POST /v1/orgs/keys (mint a sibling key for a teammate, capped to a subset of
the caller's own scopes, no self-escalation), DELETE /v1/orgs/keys/:id
(revoke, but only inside the caller's own org_id — a different org's valid
key gets a 404, not the target's real state). The platform admin key is
never touched again after the initial onboarding call.
Also fixes a related gap this surfaced: lib/gateway/index.ts's authenticate()
previously ignored any presented API key entirely when
CRED402_AUTH_REQUIRED=false (dev), skipping scope checks even for a valid
key. A valid presented key is now resolved onto AuthContext and still scope-
checked in dev; a missing key still never blocks, so the existing zero-key
console workflow is unaffected.
Frontend: new Orgs.tsx (operator onboarding + self-service panels), wired
into Developer.tsx; api.ts helpers for all five new routes.
Verified for real against a running dev server: onboarded two orgs, had one
self-mint a teammate key with no admin key involved, confirmed scope-
escalation is rejected (403), confirmed cross-tenant revoke is rejected
(404), and confirmed the admin-only org-detail route rejects a non-admin
org's own valid key (403) — this one actually leaked before the
authenticate() fix above, caught by running the flow, not by inspection.
tsc --noEmit + frontend vite build clean, 450/450 existing tests unchanged.
Backlog item 14: outbound webhook deliveries (success and failure) are now
logged with their original payload, surfaced via GET /v1/webhooks/deliveries,
and individually replayable via POST /v1/webhooks/deliveries/:id/retry so an
integrator can fix a receiving endpoint and resend a failed event without
waiting for the protocol event to fire again. Subscriptions can be disabled
(DELETE /v1/webhooks/:id) and re-enabled (POST /v1/webhooks/:id/enable)
without losing their id/secret/filters.
Frontend: new Webhooks.tsx (extracted from Developer.tsx) renders the
delivery log with a per-subscription filter, auto-refresh, and a retry
button on failed deliveries; subscription table shows active/disabled
status with a toggle.
Verified for real: full tsc typecheck + frontend vite build clean, 450/450
existing tests still pass, exercised POST/DELETE/enable/deliveries routes
against a running dev server with curl, and ran the WebhookService directly
against a local HTTP receiver that rejects then accepts to confirm a failed
delivery logs correctly and a manual replay flips it to delivered.
Round 1 against STRATEGY-2026-10-23.md's backlog:
- Wire register_agent/stake/set_credit_score/deposit_liquidity to the real
Casper Testnet contracts (lib/casper/live_bridge.ts), verified live against
the real RPC node with a freshly generated (unfunded) keypair
(npm run casper:keygen). Honesty flags built in for the Odra payable
calling convention and the admin-gated set_credit_score call.
- Unblock NEAR's paid x402 route (npm run near:keygen generates a real
implicit account id); QIE stays correctly flagged as blocked on unconfirmed
external facts (asset contract, facilitator), not env plumbing.
- New public Home tab: live-stats hero, how-it-works, a real competitor
comparison table, and a "90-second proof" that calls the real API live in
the browser (verified end-to-end with gstack browse).
- Cold-start UX: visible retry state in X402Playground + the TS SDK, plus a
keep-warm self-ping (lib/services/keepalive.ts) so the free Render dyno
rarely idles out from under a real first-time caller.
- New GET /v1/credit-score/:agentId alias + docs/integrations/ samples for
Skyfire/Nevermined/Coinbase x402.
- Self-hosting quickstart: root docker-compose.yml + scripts/bootstrap.sh,
both run for real; fixed a real EACCES crash-loop bug in infra/Dockerfile
(non-root user never owned the /data volume mount) found while verifying.
450/450 tests pass, typecheck clean, frontend build clean.
Cross-surface parity for on-chain observability: the chain manifest (contracts +
real install deploy transactions, each with cspr.live links) was only on the
console /api. Add it to the versioned /v1 surface so integrators can fetch it
programmatically through the authenticated, rate-limited, enveloped API.
- GET /v1/chain via ServerState.chainManifest() (read scope)
- documented in packages/openapi (cred402.v1.yaml + cred402.http)
- test: ServerState.chainManifest parity (245 pass)
Wires the new bureau services into the production read surfaces (REST/MCP
parity with the rest of the protocol):
- GET /v1/credit/check/:id + POST /v1/credit/check (p3 oracle, 'Cred402 Inside')
- GET /v1/agents/:id/risk-score (p7 ML risk-engine v2)
- GET /v1/credit/data-commons (p6 anonymized public good)
- GET /v1/credit/exposure + /v1/agents/:id/exposure (p5 omnichain reconciliation)
- GET /v1/verticals + /v1/verticals/:vertical (p10 underwriting profiles)
- MCP: cred402.credit_check, risk_score_v2, credit_data_commons,
agent_exposure, service_verticals (54 tools total)
ServerState gets thin delegators; ServiceVerticals persists as a field so
governance tuning survives across requests. tsc clean, full suite 233 green.
Smoke-tested all endpoints against a live server.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- media/cred402-demo.mp4: 720p screencast of https://cred402.vercel.app driving the
full loop with the Casper streaming-events feed updating live (proves the
direct-CORS SSE end to end).
- scripts/record_demo.mjs + `npm run record:demo`: Playwright records the live site,
ffmpeg muxes to MP4. Raw .webm is gitignored.
- README: link the demo video.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- render.yaml: always-on web service `cred402-api` (node runtime, installs dev
deps so tsx is present, health check /v1/health) — Render runs the long-lived
node:http + SSE server the serverless Vercel deploy can't.
- api/server.ts: honor the platform-provided PORT (Render) before CRED402_PORT.
- frontend/vercel.json: rewrite /api/*, /v1/*, /graphql → https://cred402-api.onrender.com
so the deployed console reaches the backend same-origin (no CORS, no code change).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the design-note docs (p1–p7) with the implemented "make it real" phase
docs (p8–p10) and wire production-grade, env-gated real integrations:
- p8 Casper Testnet: byte-exact deploys + WASM install via casper-js-sdk; live
node reads (node.testnet.casper.network); CRED402_CHAIN=sim|testnet transport.
- p9 x402 + data + MCP: real EIP-712 typed-data digests (@casper-ecosystem/
casper-eip-712); casper-x402 facilitator client (x402 V2); live Open-Meteo GHI;
official @modelcontextprotocol/sdk server; casper-sidecar SSE event feed.
- p10 RealFi + cross-chain: real Stripe test-mode webhooks (HMAC-verified) and
Plaid sandbox → privacy-preserving on-chain envelopes; Base Sepolia EVM deploy
(Foundry); reachable via /api/realfi/* and /api/x402/facilitator routes.
- Sign-in with Casper Wallet: real extension provider + challenge/ed25519/session
flow (/v1/auth/wallet/*), console connect + sign-in button.
- Branding: Cred402 logo mark, favicon, OG image; Vercel config for the console.
All env-gated with sim/free-API fallbacks; full suite green, all toolchains
(TS/Rust/Go/Solidity) build.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>