feat(agentswarm): M5 — x402 billing wrapper for the swarm route

withX402() wraps the Web handler so unpaid calls get a standard HTTP 402
challenge (x402Version + accepts[]) and paid calls fall through to the agent.
Payment verification is injectable (host wires CoinPay/x402); CORS preflight
passes through untouched; custom challenge responses supported. README documents
the optional c0mpute.com GPU backend.

4 new tests; 38/38 pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-06-25 17:48:12 +00:00
parent fbbb323477
commit 0e5a13f5fb
4 changed files with 137 additions and 0 deletions

View file

@ -6,6 +6,8 @@
*/
export { createSwarmHandler } from "./handler.js";
export type { SwarmHandlerOptions } from "./handler.js";
export { withX402 } from "./x402.js";
export type { X402Options, X402Accept } from "./x402.js";
export { createDeepAgentRunner } from "./runner.js";
export type { DeepAgentRunnerOptions } from "./runner.js";
export { createSwarm, createLLMRouter } from "./swarm.js";