How alike001/agentpay-casper works
AgentPay Casper lets an owner define, activate, and revoke bounded spending authority for AI agents, then evaluate paid-service actions and retain settlement evidence. The main workflow is wallet authentication, optional AI drafting, deterministic mandate validation, owner-signed Casper activation, agent authorization through REST or MCP, and optional x402 settlement with Casper transaction evidence. The graph preserves the documented Odra contract and browser workbench capabilities; their unsampled connections are omitted or shown as unverified. Edges reflect the supplied excerpts and README, not a full inspection of all runtime source.
Main entry points: server.js API Server · gateway/index.js Authorization Gateway · mandate-engine/index.js Mandate Engine · workbench.js Workbench UI
Components 18
Owner Workbench
- Workbench UI
apps/web/workbench.js - Wallet Adapter
apps/web/wallet-adapter.js
Mandate Services
- API Server
apps/api/server.js - Wallet Authentication
packages/wallet-auth/index.js - AI Draft Compiler
packages/ai-policy-compiler/index.js - Mandate Engine
packages/mandate-engine/index.js - Mandate Store
packages/mandate-store/index.js - Runtime Capabilities
packages/config/index.js
Agent Access
- MCP Server
apps/mcp-server/server.js - MCP Tools
apps/mcp-server/tools.js - Authorization Gateway
packages/gateway/index.js - Policy Engine
packages/policy-engine/index.js
Casper Authority
- Casper Transactions
packages/casper-transactions/index.js - MandateGuard Contract
contracts/agent-safe-odra/src/lib.rs
Settlement Evidence
- Casper x402 Middleware
packages/casper-x402/index.js - ReceiptLedger Contract
contracts/agent-safe-odra/src/lib.rs
Other components
- Wallet Owner
- Paid Service
Connections 23
- Wallet Owner → Workbench UI: uses
README.md - Workbench UI → API Server: sends requests
- Workbench UI → Wallet Adapter: signs client-side
README.md - API Server → Wallet Authentication: authenticates
apps/api/server.js - API Server → AI Draft Compiler: compiles intent
apps/api/server.js - AI Draft Compiler → Mandate Engine: creates and validates
packages/ai-policy-compiler/index.js - API Server → Mandate Engine: validates mandates
packages/mandate-engine/index.js - API Server → Mandate Store: persists mandates
apps/api/server.js - API Server → Casper Transactions: builds and submits
apps/api/server.js - Casper Transactions → Mandate Engine: validates mandate
packages/casper-transactions/index.js - Wallet Owner → MandateGuard Contract: activates authority
README.md - Casper Transactions → MandateGuard Contract: builds unsigned calls
README.md - API Server → MCP Server: routes MCP requests
apps/api/server.js - MCP Tools → Policy Engine: uses policy engine
apps/mcp-server/tools.js - MCP Server → Mandate Engine: validates mandate
apps/mcp-server/server.js - MCP Server → Authorization Gateway: authorizes action
apps/mcp-server/server.js - API Server → Authorization Gateway: authorizes REST action
apps/api/server.js - Authorization Gateway → Mandate Engine: evaluates action
packages/gateway/index.js - Authorization Gateway → Mandate Store: records execution
- Authorization Gateway → Casper x402 Middleware: may settle service call
- Casper x402 Middleware → Paid Service: protects paid endpoint
packages/casper-x402/index.js - API Server → Runtime Capabilities: reports capabilities
apps/api/server.js - API Server → ReceiptLedger Contract: exposes proof status