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>
31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
|
|
import { ServerState } from "../api/state.js";
|
|
|
|
test("fleet: summarizes readiness + discovery for a list, flagging unknowns", async () => {
|
|
const state = new ServerState();
|
|
// The bootstrapped economy has a seller agent; include a bogus id too.
|
|
const seller = state.economy.seller.agent_id;
|
|
const overview = state.fleetOverview([seller, "definitely-not-real"]);
|
|
|
|
assert.equal(overview.count, 2);
|
|
assert.equal(overview.unknown, 1);
|
|
const sellerRow = overview.agents.find((a) => a.agent_id === seller)!;
|
|
assert.equal(sellerRow.exists, true);
|
|
assert.equal(typeof sellerRow.readiness_pct, "number");
|
|
assert.ok("discovery_score" in sellerRow);
|
|
const ghost = overview.agents.find((a) => a.agent_id === "definitely-not-real")!;
|
|
assert.equal(ghost.exists, false);
|
|
// counts reconcile
|
|
assert.equal(overview.ready + overview.not_ready + overview.unknown, overview.count);
|
|
});
|
|
|
|
test("fleet: an empty list returns a zeroed summary", () => {
|
|
const state = new ServerState();
|
|
const overview = state.fleetOverview([]);
|
|
assert.equal(overview.count, 0);
|
|
assert.equal(overview.ready, 0);
|
|
assert.deepEqual(overview.agents, []);
|
|
});
|