caelum0x 35f2bf60cb feat: GraphQL + CLI + SDK parity for p3/p5/p6/p7/p10 services
Brings the five new bureau services to full surface parity with REST/MCP:

GraphQL (lib/graphql): Query.creditCheck, creditChecks, riskScore, dataCommons,
exposure, agentExposure, verticals, vertical(name) — plus the matching
GraphQLDataSource methods (ServerState already satisfies them).

CLI (cred402 bureau): credit-check, risk-score, data-commons, exposure
[agent_id], verticals — each rendering a compact human view or --json.

TS SDK (packages/ts-sdk): client.creditCheck/creditChecks/riskScore/dataCommons/
exposure/agentExposure/verticals/vertical.

ServerState.verticalProfile(name) added for the GraphQL single-vertical field.
tsc clean, full suite 233 green; GraphQL + CLI smoke-tested live.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 23:09:43 +03:00
..

@cred402/sdk

Official TypeScript SDK for the Cred402 agent-credit protocol. Isomorphic (global fetch), typed, with envelope unwrapping, bearer auth, idempotency, a GraphQL helper, and webhook signature verification.

import { Cred402Client, motesToCspr } from "@cred402/sdk";

const c = new Cred402Client({ baseUrl: "http://localhost:4021", apiKey: "c402_..." });

const explain = await c.explainCredit("EvidenceSellerAgent");
console.log("line:", motesToCspr(explain.decision.credit_line), "CSPR");
for (const r of explain.decision.reason_codes ?? [])
  console.log(r.polarity === "positive" ? "+" : "-", r.code, r.detail);

// open + draw + repay
await c.openCreditLine("EvidenceSellerAgent");
await c.drawCredit("EvidenceSellerAgent", 6);
await c.repayCredit("EvidenceSellerAgent", 2);

// GraphQL one-shot
const data = await c.graphql<{ agents: { agent_id: string }[] }>(`{ agents { agent_id } }`);

Webhook receivers:

import { verifyWebhookSignature } from "@cred402/sdk";
const ok = verifyWebhookSignature({ secret, signatureHeader: req.headers["x-cred402-signature"], rawBody });

Covers every /v1 route (agents, credit, marketplace, economics, analytics, notifications, search, realfi, compliance, disputes, admin keys, webhooks) plus /graphql. See packages/openapi/cred402.v1.yaml for the full contract.