Skip to content

Add x402 paid-action → CLAS receipt example#285

Merged
GsCommand merged 1 commit into
mainfrom
codex/create-x402-paid-action-receipt-example
May 22, 2026
Merged

Add x402 paid-action → CLAS receipt example#285
GsCommand merged 1 commit into
mainfrom
codex/create-x402-paid-action-receipt-example

Conversation

@GsCommand
Copy link
Copy Markdown
Contributor

Motivation

  • Provide an educational, local example that demonstrates how an x402 paid-action request can be correlated to a CommandLayer CLAS-style action receipt while preserving the payment vs execution trust boundary.
  • Show required metadata (metadata.trace, metadata.proof) and signature role placeholders without implementing production settlement or real signing.

Description

  • Add a new example at examples/x402-paid-action-receipt/ including README.md, server.js, mockX402Payment.js, mockAgentAction.js, receiptBuilder.js, sample-paid-action-request.json, sample-payment-accepted.json, and .env.example to demonstrate the full flow.
  • Implement a minimal HTTP server (POST /paid-action) that validates a mock x402 payment.accepted event, executes a mock summarize.text agent action, and returns a CLAS-style receipt built by receiptBuilder.js with metadata.trace, metadata.proof, and proof.signature placeholders for payer, agent, runtime, and verifier.
  • Enforce idempotency using an in-memory dedupe map keyed by request_id + payment_id, and return duplicate: true with the original receipt on replay.
  • Document setup, env vars, running locally, sample curl, expected output, trust boundary, failure modes, idempotency, and a production-hardening path in README.md while intentionally leaving signing and payment verification as placeholders.

Testing

  • Ran the repository test suite with npm test at the repo root and all tests passed (43 tests, including the new tests/x402-paid-action-receipt.test.js).
  • The new automated test tests/x402-paid-action-receipt.test.js validates receipt emission and idempotent behavior and passed as part of the suite.
  • The example can be exercised locally via node examples/x402-paid-action-receipt/server.js and validated with the included sample payloads and the curl command documented in README.md.

Codex Task

@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
commandlayer-commandlayer-org Ready Ready Preview, Comment May 22, 2026 8:32pm
commandlayer-org Ready Ready Preview, Comment May 22, 2026 8:32pm
commandlayer-org111 Ready Ready Preview, Comment May 22, 2026 8:32pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant