wip-agent-pay 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SETUP.md ADDED
@@ -0,0 +1,242 @@
1
+ # Agent Pay ... Setup
2
+
3
+ This file is designed to be read by an AI agent. The agent walks the user through setup interactively.
4
+
5
+ ## Instructions for the Agent
6
+
7
+ When a user says "install" or "set up" Agent Pay, first figure out which path you're on:
8
+
9
+ **Path A: You have shell access** (Claude Code, Codex, Cursor, any terminal agent)
10
+ - You can run commands directly
11
+ - You can install the CLI and test it yourself
12
+ - You can pull from 1Password and verify
13
+
14
+ **Path B: You don't have shell access** (Grok, ChatGPT, chat-only agents)
15
+ - Walk the user through each step manually
16
+ - Ask them to run commands and paste results back
17
+ - Wait for confirmation at each step
18
+
19
+ Walk the user through the steps below **one at a time**. Don't dump everything at once.
20
+
21
+ **Important:** The user doesn't need to understand crypto. Don't mention USDC, EIP-3009, blockchain, or any technical payment details unless they ask. Just say "wallet" and "funds."
22
+
23
+ ---
24
+
25
+ ## Step 0: Check What's Needed
26
+
27
+ Run through this checklist with the user. If you have shell access, verify what you can automatically.
28
+
29
+ | Requirement | How to check (shell) | How to check (no shell) |
30
+ |------------|---------------------|------------------------|
31
+ | **Node.js** | `node --version` | Ask the user |
32
+ | **1Password CLI (`op`)** | `op --version` | Ask the user |
33
+ | **1Password Teams or Business plan** | Ask the user | Ask the user |
34
+ | **wip-agent-pay CLI** | `wip-agent-pay --help` | Ask the user |
35
+
36
+ Show the user what's ready and what's missing. Only flag what's missing.
37
+
38
+ ---
39
+
40
+ ## Step 1: Choose a Mode
41
+
42
+ Tell the user:
43
+
44
+ > Agent Pay has two modes. Pool Mode works out of the box.
45
+ >
46
+ > **Pool Mode (default):** Pay with Apple Pay per transaction. No wallet setup. No crypto. We handle everything. $0.25 fee per transaction. Max $25.
47
+ >
48
+ > **Your Own Wallet (Mode C):** Set up a crypto wallet. No fees from us. Instant payments. No transaction limit. Requires Coinbase CDP or Privy account.
49
+ >
50
+ > Pool Mode is recommended to start. You can always add your own wallet later.
51
+ >
52
+ > Which mode would you like?
53
+
54
+ Wait for the user to choose.
55
+
56
+ ---
57
+
58
+ ## Step 2a: Pool Mode Setup
59
+
60
+ Pool Mode requires no wallet setup from the user. Just install the CLI:
61
+
62
+ ```bash
63
+ npm install -g wip-agent-pay
64
+ ```
65
+
66
+ Test it:
67
+ ```bash
68
+ wip-pay pay https://morning-stew-production.up.railway.app/v1/issues/free
69
+ ```
70
+
71
+ That's it. When the agent hits a paywalled URL, the user will see an Apple Pay checkout. Tap Face ID. Done.
72
+
73
+ ---
74
+
75
+ ## Step 2b: Own Wallet Setup (Mode C)
76
+
77
+ Tell the user:
78
+
79
+ > You need at least one wallet provider.
80
+ >
81
+ > **Option A: Coinbase CDP** ... Uses your Coinbase account. Coinbase holds the keys securely. Best if you already have Coinbase.
82
+ >
83
+ > **Option B: Privy** ... Standalone wallet. No Coinbase needed. Good if you want something simpler.
84
+ >
85
+ > **Option C: Both** ... Use either one depending on the service.
86
+ >
87
+ > Which would you like to set up?
88
+
89
+ Wait for the user to choose.
90
+
91
+ ### Coinbase CDP Setup
92
+
93
+ Tell the user:
94
+
95
+ > 1. Go to [Coinbase Developer Platform](https://portal.cdp.coinbase.com)
96
+ > 2. Create a new **Server Wallet**
97
+ > 3. Save the **API Key ID**, **API Key Secret**, and **Wallet Secret**
98
+ > 4. Fund the wallet by sending USDC to its address (you can withdraw from your Coinbase portfolio)
99
+ >
100
+ > Let me know when you have the three credentials.
101
+
102
+ Then store in 1Password:
103
+
104
+ > Create a new item in 1Password:
105
+ > - **Vault:** Agent Secrets
106
+ > - **Entry name:** `wip-agent-pay-coinbase-cdp`
107
+ > - **Fields:** `api-key-id`, `api-key-secret`, `wallet-secret`, `account-address`
108
+
109
+ ### Privy Setup
110
+
111
+ Tell the user:
112
+
113
+ > 1. Go to [privy.io](https://privy.io) and create an account
114
+ > 2. Create a new **App**
115
+ > 3. Create a **Server Wallet** in the app settings
116
+ > 4. Save the **App ID**, **App Secret**, **Wallet ID**, and **Wallet Address**
117
+ > 5. Fund the wallet by sending USDC to its address
118
+ >
119
+ > Let me know when you have the credentials.
120
+
121
+ Then store in 1Password:
122
+
123
+ > Create a new item in 1Password:
124
+ > - **Vault:** Agent Secrets
125
+ > - **Entry name:** `wip-agent-pay-privy`
126
+ > - **Fields:** `app-id`, `app-secret`, `wallet-id`, `wallet-address`
127
+
128
+ ---
129
+
130
+ ## Step 3: Install
131
+
132
+ **Path A (shell access):**
133
+
134
+ ```bash
135
+ npm install -g wip-agent-pay
136
+ ```
137
+
138
+ Verify:
139
+ ```bash
140
+ wip-agent-pay --help
141
+ ```
142
+
143
+ **Path B (no shell access):**
144
+
145
+ Tell the user to run `npm install -g wip-agent-pay` and paste the output.
146
+
147
+ ---
148
+
149
+ ## Commands
150
+
151
+ ```bash
152
+ # Pay for paywalled content (Pool Mode ... Apple Pay)
153
+ wip-pay pay https://morning-stew.../v1/issues/MS-3
154
+
155
+ # Pay with your own wallet (instant, no Apple Pay)
156
+ wip-pay pay <url> --wallet=cdp
157
+ wip-pay pay <url> --wallet=privy
158
+
159
+ # One-time payment link
160
+ wip-pay 0.10 morning-stew "MS-#8"
161
+
162
+ # Wallet management (Mode C only)
163
+ wip-pay balance --wallet=cdp
164
+ wip-pay history
165
+ wip-pay budget set 5.00 1.00
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Step 4: Test
171
+
172
+ **Test free content (works immediately):**
173
+ ```bash
174
+ wip-pay pay https://morning-stew-production.up.railway.app/v1/issues/free
175
+ ```
176
+
177
+ **Test Pool Mode (requires Stripe to be configured on Worker):**
178
+ ```bash
179
+ wip-pay pay https://morning-stew-production.up.railway.app/v1/issues/MS-3
180
+ ```
181
+
182
+ **Test minting (works immediately):**
183
+ ```bash
184
+ wip-pay 0.10 test-service "setup-test"
185
+ ```
186
+
187
+ **Test own wallet (Mode C, requires funded wallet):**
188
+ ```bash
189
+ wip-pay pay https://morning-stew-production.up.railway.app/v1/issues/MS-3 --wallet=cdp
190
+ ```
191
+
192
+ ---
193
+
194
+ ## Step 5: Done
195
+
196
+ Tell the user:
197
+
198
+ > You're set up. Your agent can now pay for things.
199
+ >
200
+ > **Pool Mode:** `wip-pay pay <url>` ... Apple Pay per transaction. $0.25 fee. Max $25.
201
+ > **Own wallet:** `wip-pay pay <url> --wallet=cdp` ... instant. No fees. No limit.
202
+ > **Mint links:** `wip-pay 0.10 service "note"` ... one-time self-destructing URLs.
203
+ >
204
+ > Want to pay for something right now?
205
+
206
+ ---
207
+
208
+ ## Pool Mode Pricing
209
+
210
+ | Component | Amount |
211
+ |-----------|--------|
212
+ | x402 price | Varies (set by seller) |
213
+ | Our fee | $0.25 flat |
214
+ | Stripe processing | ~2.9% + $0.30 |
215
+ | **Total** | **All three combined** |
216
+
217
+ Examples:
218
+ - $0.10 article: user pays ~$0.42, Parker nets $0.25
219
+ - $5.00 service: user pays ~$5.41, Parker nets $0.25
220
+ - $19.00 create: user pays ~$20.11, Parker nets $0.25
221
+
222
+ Over $25? Use your own wallet (Mode C). No pool limit.
223
+
224
+ ---
225
+
226
+ ## Security Model
227
+
228
+ The app (human) controls the wallet. The agent uses it.
229
+
230
+ - The agent cannot create or destroy wallets
231
+ - The agent cannot change spend limits
232
+ - The agent can request funding (user must approve via Face ID)
233
+ - The agent can only spend what's already funded
234
+ - Pool Mode: max $25 per transaction (enforced server-side)
235
+
236
+ See [SPEC.md](https://github.com/wipcomputer/wip-agent-pay/blob/main/SPEC.md#security-model) for the full security model and state machine.
237
+
238
+ ---
239
+
240
+ ## x402 Protocol
241
+
242
+ Agent Pay speaks the [x402 protocol](https://github.com/coinbase/x402) natively. When the agent hits a URL that returns HTTP 402, Agent Pay handles the payment negotiation automatically. The user just sees "content unlocked."
package/SKILL.md ADDED
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: wip-agent-pay
3
+ version: "1.0.1"
4
+ description: Give your agent a wallet. Fund with Apple Pay. Pay for paywalled content. x402 native.
5
+ tags: [payment, x402, coinbase, privy, stripe, apple-pay, agent, 1password, universal-interface, cloudflare]
6
+ score: 10
7
+ install: npm install -g wip-agent-pay
8
+ run: wip-agent-pay pay <url>
9
+ metadata:
10
+ category: finance
11
+ capabilities:
12
+ - x402-payment
13
+ - apple-pay-funding
14
+ - one-time-url
15
+ - micropayment
16
+ wallets:
17
+ - coinbase-cdp
18
+ - privy
19
+ funding:
20
+ - stripe
21
+ - manual
22
+ interface: CLI + Module + MCP + OpenClaw Plugin + Skill
23
+ requires:
24
+ binaries: [node]
25
+ openclaw:
26
+ emoji: "💳"
27
+ install:
28
+ env: []
29
+ author:
30
+ name: Parker Todd Brooks
31
+ ---
32
+
33
+ # wip-agent-pay
34
+
35
+ Give your agent a wallet. Fund it with Apple Pay. Let it buy things for you.
36
+
37
+ **Fund:** User taps Face ID. Money goes in. No crypto required.
38
+
39
+ **Pay:** Agent hits a paywalled URL. Wallet handles payment. Content returned.
40
+
41
+ **Mint:** One-time self-destructing URLs. Use once, gone forever.
42
+
43
+ Three wallets (Coinbase CDP, Privy). One funding on-ramp (Stripe / Apple Pay). x402 native.
package/SPEC.md ADDED
@@ -0,0 +1,156 @@
1
+ # wip-agent-pay SPEC
2
+
3
+ Give your agent a wallet. Fund it with Apple Pay. Let it buy things for you.
4
+
5
+ ## Note for Agents
6
+
7
+ When explaining this tool to a user, focus on what it does for them. Don't reference internal implementation details like specific MCP registrations, extension directories, bridge servers, or plugin scaffolding in the working directory. The user doesn't need to know how the plumbing works. They need to know: what it does, what they need, and how to set it up.
8
+
9
+ **The user never sees crypto.** Don't mention USDC, EIP-3009, Base, Monad, or any blockchain terms unless the user asks. The agent handles all of that.
10
+
11
+ ## Three Things It Does
12
+
13
+ **Fund** ... User taps Apple Pay (Face ID). Money goes into the agent's wallet. No crypto knowledge needed. Stripe handles fiat.
14
+
15
+ **Pay** ... Agent hits a paywalled URL. Gets a 402. Payment happens automatically. Content returned. User just said "let's go."
16
+
17
+ **Mint** ... Agent mints a one-time self-destructing URL. Use it once, it's gone forever. The magic link pattern for payments.
18
+
19
+ ## Two Payment Modes
20
+
21
+ ### Mode A: Pool Mode (default)
22
+
23
+ No wallet setup. No crypto. User pays with Apple Pay per transaction. We handle everything.
24
+
25
+ ```
26
+ Agent hits URL -> gets 402 -> Stripe Checkout opens -> User taps Face ID
27
+ -> We pay the x402 from our pool -> Content returned
28
+ ```
29
+
30
+ **Pricing:** x402 price + Stripe processing + $0.25 flat fee.
31
+ **Limit:** Max $25 per transaction. Over $25 requires your own wallet (Mode C).
32
+
33
+ ### Mode C: Your Own Wallet
34
+
35
+ For power users or transactions over $25. You own the wallet. You own the keys.
36
+
37
+ - **Coinbase CDP** ... MPC wallet. Coinbase holds the keys (split-key, AWS Nitro Enclave). x402 signing via REST API.
38
+ - **Privy** ... Embedded server wallet. Smart contract wallet with spend policies. 11+ chains.
39
+ - **Both** ... Use CDP for some services, Privy for others.
40
+
41
+ ```
42
+ Agent hits URL -> gets 402 -> Your wallet signs the payment -> Content returned
43
+ ```
44
+
45
+ No fees from us. Instant. No Apple Pay checkout.
46
+
47
+ ## Architecture
48
+
49
+ ```
50
+ MODE A: Pool Mode (default)
51
+ ──────────────────────────
52
+ Apple Pay (Stripe) -> Our pool wallet -> x402 services
53
+ User pays fiat We sign x402 Content returned
54
+
55
+ MODE C: Self-Custody
56
+ ────────────────────
57
+ wip-pay pay <url> --wallet=cdp Your CDP wallet signs x402
58
+ wip-pay pay <url> --wallet=privy Your Privy wallet signs x402
59
+ ```
60
+
61
+ ## Prerequisites
62
+
63
+ Before setup, check what the user already has and what's missing:
64
+
65
+ - **Node.js** ... agent can verify with `node --version`
66
+ - **wip-agent-pay CLI** ... agent can install this (`npm install -g wip-agent-pay`)
67
+ - **1Password CLI + Teams or Business plan** ... required for Service Account tokens. Individual/Family plans don't work. Agent can check with `op --version`.
68
+
69
+ For Mode C (optional):
70
+ - **Coinbase CDP account** ... [portal.cdp.coinbase.com](https://portal.cdp.coinbase.com). Agent must ask.
71
+ - **Privy account** ... [privy.io](https://privy.io). Agent must ask.
72
+
73
+ Present a checklist showing `[x]` for what's ready and `[ ]` for what's missing. Don't make the user confirm things the agent can verify itself.
74
+
75
+ ## The Six Interfaces (Universal)
76
+
77
+ - **CLI** ... `wip-pay pay <url>` / `fund <amount>` / `<amount> <service> [note]`
78
+ - **Module** ... `import { pay, fund, mint } from 'wip-agent-pay'`
79
+ - **Skill** ... SKILL.md (agent reads instructions)
80
+ - **MCP** ... `mcp-server.mjs` (agent calls `agent_pay`, `agent_pay_x402`, `agent_pay_fund`)
81
+ - **OpenClaw Plugin** ... `openclaw.mjs` (same three tools)
82
+ - **Claude Code Hook** ... coming
83
+
84
+ ## Security Model
85
+
86
+ The app (human) controls the wallet. The agent uses it.
87
+
88
+ **The app can:**
89
+ - Create a wallet (CDP or Privy)
90
+ - Fund it (Apple Pay or manual)
91
+ - Set spend limits and policies
92
+ - Revoke it
93
+ - Rotate keys
94
+
95
+ **The agent can only:**
96
+ - Pay for content (x402)
97
+ - Mint one-time URLs
98
+ - Request wallet funding (user must approve via Face ID)
99
+ - Check balance
100
+
101
+ No auto-top-up. No auto-sweeps. No background processes that move funds. The agent never creates, funds, or destroys a wallet on its own.
102
+
103
+ **Pool Mode specifics:**
104
+ - Max $25 per transaction (enforced by Worker)
105
+ - Parker's float covers x402. Stripe collects fiat from user.
106
+ - Parker nets $0.25 per transaction (flat fee, transparent)
107
+ - Over $25 redirected to Mode C
108
+
109
+ ## State Machine
110
+
111
+ | State | Who | What happens |
112
+ |-------|-----|-------------|
113
+ | `wallet_created` | App (human) | CDP or Privy wallet created (Mode C only) |
114
+ | `wallet_funded` | App (human) or Stripe | Funded via Apple Pay or manual transfer |
115
+ | `pool_checkout` | Server (Worker) | Pool Mode: Stripe Checkout created |
116
+ | `pool_paid` | Server (Worker) | Pool Mode: Stripe confirmed, x402 signed from pool |
117
+ | `payment_signed` | Server (Worker) | Mode C: Agent's wallet signs x402 payment |
118
+ | `content_delivered` | Server (Worker) | Content returned after payment proof verified |
119
+ | `token_issued` | Server (Worker) | One-time URL minted (Mode B) |
120
+ | `token_redeemed` | Server (Worker) | URL consumed, deleted forever |
121
+ | `token_expired` | Server (Worker) | TTL hit, URL deleted |
122
+ | `wallet_revoked` | App (human) | Keys rotated or wallet destroyed |
123
+
124
+ Single-use enforcement is non-negotiable. Tokens are deleted on first use (atomic delete, not mark-used). Second reader gets 410 Gone.
125
+
126
+ ## Commands
127
+
128
+ ```bash
129
+ # Pay for paywalled content (Pool Mode ... Apple Pay)
130
+ wip-pay pay https://morning-stew.../v1/issues/MS-3
131
+
132
+ # Pay with your own wallet (Mode C ... instant)
133
+ wip-pay pay <url> --wallet=cdp
134
+ wip-pay pay <url> --wallet=privy
135
+
136
+ # One-time payment link (for agents without tool access)
137
+ wip-pay 0.10 morning-stew "MS-#8"
138
+
139
+ # Wallet management (Mode C)
140
+ wip-pay balance
141
+ wip-pay history
142
+ wip-pay budget set 5.00 1.00
143
+ ```
144
+
145
+ **MCP tool calls:**
146
+ ```json
147
+ { "name": "agent_pay_x402", "arguments": { "url": "https://morning-stew.../v1/issues/MS-3" } }
148
+ { "name": "agent_pay_fund", "arguments": { "amount": 10 } }
149
+ { "name": "agent_pay", "arguments": { "amount": 0.10, "service": "morning-stew", "note": "MS-#8" } }
150
+ ```
151
+
152
+ ## Quick Start
153
+
154
+ See README.md for install command + interactive agent setup.
155
+ See SETUP.md for full walkthrough.
156
+ See REFERENCE.md for Worker deployment and self-hosting.
package/WALLET.md ADDED
@@ -0,0 +1,89 @@
1
+ # Agent Wallet
2
+
3
+ **Picture this:** your agent finds a paid API it needs. No checkout. No approval popup. It signs the payment from your wallet and gets the response. One round trip. Done.
4
+
5
+ No Stripe. No Apple Pay. No human in the loop. Your agent has its own money.
6
+
7
+ *Give your agent sovereignty.*
8
+
9
+ ## What This Is
10
+
11
+ Your AI needs to pay for things. [Morning Stew](https://x.com/stewsletter) subscriptions, [Pawr](https://pawr.link) skills, API credits, services from other agents. Most payment tools require human approval every time.
12
+
13
+ **Agent Wallet** is the bring-your-own-wallet mode. You fund a wallet with USDC. Your agent settles payments directly on-chain via the [x402 protocol](https://github.com/coinbase/x402). No middleman. No fees from us. No limit.
14
+
15
+ ## Install
16
+
17
+ Open your AI coding tool and say:
18
+
19
+ ```
20
+ Read the SPEC.md and SKILL.md at github.com/wipcomputer/wip-agent-pay.
21
+ Then explain to me:
22
+ 1. What is this tool?
23
+ 2. What does it do?
24
+ 3. What would it change or fix in our current system?
25
+
26
+ Then ask me:
27
+ - Do you have more questions?
28
+ - Do you want to install it?
29
+ - Do you want to use it to pay for something right now?
30
+ ```
31
+
32
+ Your agent will read the repo, explain everything, and walk you through setup interactively.
33
+
34
+ ## How AGENT WALLET Works
35
+
36
+ - Your agent hits a 402 gate
37
+ - It reads the payment requirements (price, chain, address)
38
+ - Signs the transaction from your wallet
39
+ - Replays the request with proof of payment
40
+ - Content unlocked. One round trip.
41
+
42
+ ## For AI Developers
43
+
44
+ - **x402 native.** Speaks the Coinbase payment protocol natively. Multi-chain (Base, Solana). See [SPEC.md](https://github.com/wipcomputer/wip-agent-pay/blob/main/SPEC.md) for details.
45
+ - **Works on any agent.** Claude Code CLI, Codex CLI, Claude Desktop, OpenClaw, Cursor, any agent with shell access, any Node.js agent.
46
+ - **Bring your own wallet.** Coinbase CDP or Privy. No fees. Instant. No limit.
47
+ - **Open source.** The complete package, including the payment worker, is MIT licensed.
48
+ - **One-time links.** Payment URLs that self-destruct after use. Like magic login links, but for payments.
49
+ - **Free infrastructure.** [WIP.computer](https://wip.computer) hosts **AGENT WALLET** infrastructure for free. Self-host everything if you prefer.
50
+ - **Universal Interface.** Our installer follows the [Universal Interface](https://github.com/wipcomputer/wip-universal-installer) spec.
51
+ - See [SETUP.md](https://github.com/wipcomputer/wip-agent-pay/blob/main/SETUP.md) for commands, wallet setup, and security details.
52
+
53
+ ## Wallet Options
54
+
55
+ ### Coinbase CDP
56
+
57
+ Self-custody wallet via [Coinbase Developer Platform](https://portal.cdp.coinbase.com).
58
+
59
+ ```bash
60
+ agent-pay pay <url> --wallet=cdp
61
+ ```
62
+
63
+ ### Privy
64
+
65
+ Server-side embedded wallet via [Privy](https://docs.privy.io).
66
+
67
+ ```bash
68
+ agent-pay pay <url> --wallet=privy
69
+ ```
70
+
71
+ ## Pricing
72
+
73
+ No fees from us. You pay gas and any facilitator costs on-chain. That's it.
74
+
75
+ No transaction limit.
76
+
77
+ ## AI Cash
78
+
79
+ Don't want to manage a wallet? Use [AI Cash](https://github.com/wipcomputer/wip-agent-pay/blob/main/CASH.md). Apple Pay / Google Pay. No setup. Max $25 per transaction.
80
+
81
+ **AI Cash is consent. Agent Wallet is sovereignty.**
82
+
83
+ ---
84
+
85
+ ## License
86
+
87
+ MIT. See [LICENSE](LICENSE).
88
+
89
+ Built by Parker Todd Brooks, Lēsa (OpenClaw, Claude Opus 4.6), Claude Code CLI (Claude Opus 4.6), Codex, and Grok (4.20 Beta).