diff --git a/server.mjs b/server.mjs index f295a30..4a07207 100644 --- a/server.mjs +++ b/server.mjs @@ -257,7 +257,7 @@ async function handleMessageSend(rpcId, params, res) { const { message } = params || {}; if (!message?.parts?.length) return res.json({ jsonrpc: '2.0', id: rpcId, error: { code: -32602, message: 'message.parts required' } }); - const textPart = message.parts.find(p => p.kind === 'text'); + const textPart = message.parts.find(p => p.kind === 'text' || p.type === 'text'); if (!textPart) return res.json({ jsonrpc: '2.0', id: rpcId, error: { code: -32602, message: 'text part required' } }); const taskId = uuidv4(); @@ -388,6 +388,7 @@ app.use(express.json({ limit: '10mb' })); app.use('/public', express.static(new URL('./public', import.meta.url).pathname)); app.get('/.well-known/agent-card.json', (req, res) => res.json(agentCard)); app.post('/', handleJsonRpc); +app.get('/', (req, res) => res.redirect('/dashboard')); app.get('/dashboard', (req, res) => res.type('html').send(getDashboardHtml())); app.get('/api/info', (req, res) => res.json({ agent: agentCard, @@ -480,121 +481,332 @@ async function go(){const i=document.getElementById('ti').value,b=document.getEl // === Demo Page: Human-Facing Hackathon Demo === function getDemoHtml() { + const publicUrl = PUBLIC_URL.replace(/\/$/, ''); return ` -OpSpawn Demo — Agent Commerce in Action +A2A x402 Gateway — Live Demo +
-

Agent Commerce in Action

-

Watch AI agents discover each other, negotiate payments, and deliver results — all in seconds, for a fraction of a cent.

-
A2A Protocol + x402 Micropayments + SIWx Sessions
+

A2A x402 Gateway

+

AI agents discover, negotiate, and pay each other for services — live, in real time, for fractions of a cent.

+
The first A2A agent with native x402 V2 micropayments
+
+ LIVE + A2A v0.3 + x402 V2 + Base USDC + SKALE Gasless + SIWx Sessions +
+
-
0
Tasks Completed
+
0
Tasks
0
Payments
0
SIWx Sessions
0s
Uptime
-
-

How It Works

-
-
🔍

Discover

Agents find each other via A2A agent cards — standard protocol, no marketplace needed

-
💬

Request

Client agent sends a natural language task via JSON-RPC message

-
💰

Pay

Gateway returns x402 payment requirements. Client signs $0.01 USDC on Base.

-

Deliver

Service executes immediately. SIWx session means no repaying for repeat access.

+ +
+

Watch the Demo

+
+
+ +
+

Architecture

+
+
AI Agent
Any A2A client
+
+
A2A Gateway
JSON-RPC v0.3
+
+
x402 Payment
USDC on Base
+
+
Service Result
PNG / PDF / HTML
+
+
+
+

A2A Protocol v0.3

+

Google's Agent-to-Agent standard. Discovery via /.well-known/agent-card.json, communication via JSON-RPC message/send.

+
+
+

x402 V2 Payments

+

Coinbase's HTTP payment protocol. CAIP-2 network IDs, multi-chain USDC, PayAI facilitator for verification.

+
+
+

SIWx Sessions

+

Sign-In-With-X (CAIP-122). Pay once for a skill, reuse forever. No API keys, no subscriptions.

+
+
+

Multi-Chain

+

Base eip155:8453 ($0.01 per screenshot) or SKALE eip155:324705682 (gasless).

+
+
+
+ +
-

Demo: Convert Markdown to HTML FREE

-

This skill is free — no payment needed. Watch a complete A2A round-trip in real time.

+

Interactive Demo: Markdown to HTML FREE

+

Free skill — no payment needed. Watch the A2A protocol exchange in real time, with full JSON-RPC payloads visible.

-
1

Agent discovers OpSpawn via agent card

GET /.well-known/agent-card.json — standard A2A discovery
-
2

Agent sends markdown conversion request

POST / with JSON-RPC message/send — natural language task
-
3

Gateway processes and returns HTML

No payment required — task completes immediately
+
+
1
+
+

Discover agent via standard A2A endpoint

+
GET /.well-known/agent-card.json
+
+
+
+
+
2
+
+

Send A2A message/send request

+
POST / — JSON-RPC 2.0 with markdown content
+
+
+
+
+
3
+
+

Gateway returns HTML result

+
Task state: completed — no payment needed for free skills
+
+
+
-

Result

+

Rendered Output

+
-

Demo: Screenshot a Website $0.01 USDC

-

This skill costs money. Watch the x402 payment flow: request → 402 payment required → pay → result delivered.

+

Interactive Demo: Screenshot a Website $0.01 USDC

+

Paid skill — watch the full x402 payment flow: request → 402 payment required → sign USDC → result delivered.

-
1

Agent requests a screenshot of example.com

POST / with message/send — "Take a screenshot of https://example.com"
-
2

Gateway returns payment requirements

Task state: input-required. x402 V2 accepts: Base USDC ($0.01) or SKALE (gasless)
-
3

Agent signs USDC payment

Client signs x402 payment authorization (simulated in demo)
-
4

Gateway delivers screenshot + records SIWx session

Payment settled. Wallet gets SIWx session — future requests are free.
+
+
1
+
+

Request screenshot of example.com

+
POST / — message/send with URL in natural language
+
+
+
+
+
2
+
+

Gateway returns x402 payment requirements

+
Task state: input-required — x402 V2 accepts Base USDC or SKALE gasless
+
+
+
+
+
3
+
+

Agent signs x402 USDC payment

+
Client creates payment authorization for $0.01 USDC on Base
+
+
+
+
+
4
+
+

Screenshot delivered + SIWx session created

+
Payment settled, wallet gets session access for future requests
+
+
+
-

Result

+

Screenshot Result

+
+ + +
+

Try It Yourself

+

This is a live API. Copy these commands and run them against the real endpoint.

+ +
+

1. Discover the agent

+ +
curl -s ${publicUrl}/.well-known/agent-card.json | jq '.'
+
+ +
+

2. Send a free A2A message (markdown to HTML)

+ +
curl -s -X POST ${publicUrl}/ \\ + -H "Content-Type: application/json" \\ + -d '{"jsonrpc":"2.0","id":"1","method":"message/send","params":{"message":{"messageId":"demo-1","role":"user","parts":[{"kind":"text","text":"Convert to HTML: # Hello World"}],"kind":"message"}}}' | jq '.'
+
+ +
+

3. Request a paid screenshot (returns payment requirements)

+ +
curl -s -X POST ${publicUrl}/ \\ + -H "Content-Type: application/json" \\ + -d '{"jsonrpc":"2.0","id":"1","method":"message/send","params":{"message":{"messageId":"demo-2","role":"user","parts":[{"kind":"text","text":"Take a screenshot of https://example.com"}],"kind":"message"}}}' | jq '.result.status'
+
+ +
+

4. View the x402 service catalog

+ +
curl -s ${publicUrl}/x402 | jq '.'
+