@kaleidorg/mind 0.0.1 → 0.1.0
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/dist/engine.d.ts +9 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +18 -2
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/skills/bundle.d.ts +30 -0
- package/dist/skills/bundle.d.ts.map +1 -0
- package/dist/skills/bundle.js +24 -0
- package/dist/skills/bundle.js.map +1 -0
- package/dist/skills/loader.d.ts +33 -0
- package/dist/skills/loader.d.ts.map +1 -0
- package/dist/skills/loader.js +59 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/skills/reference-source.d.ts +18 -0
- package/dist/skills/reference-source.d.ts.map +1 -0
- package/dist/skills/reference-source.js +53 -0
- package/dist/skills/reference-source.js.map +1 -0
- package/dist/skills/registry.d.ts +41 -0
- package/dist/skills/registry.d.ts.map +1 -0
- package/dist/skills/registry.js +167 -0
- package/dist/skills/registry.js.map +1 -0
- package/dist/skills/types.d.ts +53 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +18 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/tools/l402.d.ts +47 -0
- package/dist/tools/l402.d.ts.map +1 -0
- package/dist/tools/l402.js +84 -0
- package/dist/tools/l402.js.map +1 -0
- package/package.json +9 -2
- package/scripts/bundle-skills.mjs +84 -0
- package/skills/README.md +74 -0
- package/skills/bitrefill/SKILL.md +66 -0
- package/skills/bitrefill/references/api.md +99 -0
- package/skills/bitrefill/references/browse.md +71 -0
- package/skills/bitrefill/references/capability-matrix.md +115 -0
- package/skills/bitrefill/references/cli-headless-auth.md +133 -0
- package/skills/bitrefill/references/cli.md +237 -0
- package/skills/bitrefill/references/host-openclaw.md +167 -0
- package/skills/bitrefill/references/mcp.md +150 -0
- package/skills/bitrefill/references/safeguards.md +138 -0
- package/skills/bitrefill/references/troubleshooting.md +182 -0
- package/skills/kaleido-trading/SKILL.md +31 -0
- package/skills/kaleido-wallet/SKILL.md +28 -0
- package/src/engine.test.ts +204 -0
- package/src/engine.ts +27 -2
- package/src/index.ts +17 -0
- package/src/skills/bundle.ts +42 -0
- package/src/skills/loader.ts +63 -0
- package/src/skills/reference-source.ts +60 -0
- package/src/skills/registry.ts +183 -0
- package/src/skills/skills.test.ts +191 -0
- package/src/skills/types.ts +55 -0
- package/src/tools/l402.test.ts +113 -0
- package/src/tools/l402.ts +122 -0
- package/dist/providers/qvac.d.ts +0 -89
- package/dist/providers/qvac.d.ts.map +0 -1
- package/dist/providers/qvac.js +0 -150
- package/dist/providers/qvac.js.map +0 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Host: OpenClaw
|
|
2
|
+
|
|
3
|
+
[OpenClaw](https://docs.openclaw.ai/) is a self-hosted Gateway that bridges chat apps (Telegram, WhatsApp, Slack, Discord, iMessage, Signal, Matrix, Teams, etc.) to coding agents like **Pi**. It is a **superset host**: full host shell, agentskills.io-compatible skill loader, first-class MCP, mobile-node camera/canvas, cron, and multi-channel routing.
|
|
4
|
+
|
|
5
|
+
This file explains how to install + harden the Bitrefill skill inside OpenClaw and lists scenarios no other host can do. After setup, use the regular path files for the actual workflow.
|
|
6
|
+
|
|
7
|
+
**OpenClaw path priority:** **guest CLI via `exec`** (no auth, fastest try) → signed-in CLI (`login`/`verify`, `balance`, cashback) → MCP → API → Browse. OpenClaw has shell + MCP — prefer guest CLI for purchases unless you need typed MCP tool calls or are already signed in for `balance`.
|
|
8
|
+
|
|
9
|
+
## 1. Detect OpenClaw
|
|
10
|
+
|
|
11
|
+
Check **any** of:
|
|
12
|
+
|
|
13
|
+
- File: `~/.openclaw/openclaw.json` exists.
|
|
14
|
+
- Dir: `~/.openclaw/skills/` exists.
|
|
15
|
+
- Binary: `command -v openclaw` succeeds.
|
|
16
|
+
- Tools in agent loop: `gateway`, `cron`, `nodes`, `canvas`, `sessions_*` (OpenClaw-only).
|
|
17
|
+
|
|
18
|
+
If yes → continue here. Otherwise → return to [SKILL.md](../SKILL.md) and pick a path.
|
|
19
|
+
|
|
20
|
+
## 2. Install this skill
|
|
21
|
+
|
|
22
|
+
Loader paths (increasing precedence): `skills.load.extraDirs` → bundled → `~/.openclaw/skills/` → `~/.agents/skills/` → `<workspace>/.agents/skills/` → `<workspace>/skills/`.
|
|
23
|
+
|
|
24
|
+
Manual:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
cp -r path/to/bitrefill ~/.openclaw/skills/bitrefill
|
|
28
|
+
openclaw skills list # verify
|
|
29
|
+
openclaw gateway restart # or /new in chat
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
ClawHub (if/when published):
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
openclaw skills install bitrefill
|
|
36
|
+
openclaw skills update --all
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Skill is **agentskills.io-compatible** — no rewriting needed. Source: <https://docs.openclaw.ai/tools/skills.md>.
|
|
40
|
+
|
|
41
|
+
## 3. Install Bitrefill CLI (preferred — guest checkout)
|
|
42
|
+
|
|
43
|
+
Pi has first-class `exec` tool on Gateway host (sandboxing **off** by default). **Start here:** no login, no MCP config — search, buy, pay crypto or send payment link.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
exec: npm install -g @bitrefill/cli
|
|
47
|
+
exec: bitrefill search-products --query "Netflix" --country US
|
|
48
|
+
exec: bitrefill buy-products \
|
|
49
|
+
--cart_items '[{"product_id":"steam-usa","package_id":10}]' \
|
|
50
|
+
--payment_method lightning \
|
|
51
|
+
--return_payment_link true \
|
|
52
|
+
--email "user@example.com"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Guest flow → [cli.md](cli.md) § Guest checkout. Optional: `bitrefill init --openclaw` (skill + MCP stub only — not required for guest).
|
|
56
|
+
|
|
57
|
+
**Upgrade to signed-in** when human wants store-credit cap (`balance`), cashback, or order history:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
exec: bitrefill login --email you@example.com
|
|
61
|
+
exec: bitrefill verify --code <email-code> [--otp <totp>]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Headless sign-in inbox → [cli-headless-auth.md](cli-headless-auth.md) (AgentMail or equivalent).
|
|
65
|
+
|
|
66
|
+
Docker sandbox: `setupCommand: "npm install -g @bitrefill/cli"`, `network` not `none`. Source: <https://docs.openclaw.ai/gateway/sandboxing.md>.
|
|
67
|
+
|
|
68
|
+
## 4. Install Bitrefill MCP (optional)
|
|
69
|
+
|
|
70
|
+
Use when: typed MCP tool calls in Pi loop without shell, or MCP-native integrations. **Not required for guest try** — guest CLI is faster (zero config).
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
openclaw mcp set bitrefill --url "https://api.bitrefill.com/mcp"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Or hand-edit `~/.openclaw/openclaw.json`:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"mcp": {
|
|
81
|
+
"servers": {
|
|
82
|
+
"bitrefill": {
|
|
83
|
+
"url": "https://api.bitrefill.com/mcp"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Developer API key (optional): see [mcp.md](mcp.md). Guest MCP checkout may still need OAuth; **guest CLI avoids this.**
|
|
91
|
+
|
|
92
|
+
Transport: SSE/HTTP or `transport: "streamable-http"`. Restrict per-agent via `agents.list[].tools.allow`/`deny`. Source: <https://docs.openclaw.ai/cli/mcp.md>.
|
|
93
|
+
|
|
94
|
+
Then: see [mcp.md](mcp.md).
|
|
95
|
+
|
|
96
|
+
## 5. Raw API path
|
|
97
|
+
|
|
98
|
+
`exec` + `curl`, or built-in `web_fetch` tool. No special config. See [api.md](api.md).
|
|
99
|
+
|
|
100
|
+
## 6. Browser
|
|
101
|
+
|
|
102
|
+
Pi has `browser` tool. **It uses the Gateway host's IP** — usually residential when Gateway runs on user's machine, but a VPS will hit Cloudflare 403. For richer DOM control attach a Playwright/Chrome MCP. The Mac menubar app drives user's actual Chrome and is fully residential. See [browse.md](browse.md).
|
|
103
|
+
|
|
104
|
+
## 7. OpenClaw-only scenarios
|
|
105
|
+
|
|
106
|
+
These are the differentiators. None of the other hosts can do them.
|
|
107
|
+
|
|
108
|
+
### Buy a gift card from Telegram (away from desk)
|
|
109
|
+
|
|
110
|
+
User DMs the bot: "buy a $50 Steam US card for me". Pi runs guest CLI via `exec` (or signed-in CLI with `balance` if human pre-funded account), prompts confirmation in chat, returns payment link or redemption code after poll.
|
|
111
|
+
|
|
112
|
+
**Risk**: redemption codes are cash-like. Never deliver to group chats or via `MEDIA:` URLs. Lock down channel:
|
|
113
|
+
|
|
114
|
+
```jsonc
|
|
115
|
+
{
|
|
116
|
+
"channels": {
|
|
117
|
+
"telegram": {
|
|
118
|
+
"botToken": "${TELEGRAM_BOT_TOKEN}",
|
|
119
|
+
"dmPolicy": "pairing",
|
|
120
|
+
"allowFrom": ["123456789"],
|
|
121
|
+
"groups": { "*": { "requireMention": true } }
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Source: <https://docs.openclaw.ai/channels/telegram>.
|
|
128
|
+
|
|
129
|
+
### Auto-renew mobile top-up monthly
|
|
130
|
+
|
|
131
|
+
Use `cron` + `exec: bitrefill buy-products ...` for fixed SKU. Guest: crypto + poll `get-invoice-by-id`. Signed-in: `--payment_method balance` for instant pay without on-chain wait.
|
|
132
|
+
|
|
133
|
+
### Multi-channel handoff
|
|
134
|
+
|
|
135
|
+
Trigger purchase from Slack, deliver redemption code only to user's private Signal DM. Same Gateway, isolated session per channel/sender.
|
|
136
|
+
|
|
137
|
+
### Mobile camera context
|
|
138
|
+
|
|
139
|
+
Paired iOS/Android node exposes `camera.snap` and `canvas.*`. User photographs a request ("100 EUR Decathlon France"), Pi OCRs/parses, runs `exec: bitrefill search-products` + `exec: bitrefill buy-products` (guest or signed-in). Source: <https://docs.openclaw.ai/nodes/index.md>.
|
|
140
|
+
|
|
141
|
+
### Heartbeat-driven invoice polling
|
|
142
|
+
|
|
143
|
+
Default 30-min heartbeat or custom `cron` runs `exec: bitrefill get-invoice-by-id` until `status: complete`, then pushes redemption code to originating channel.
|
|
144
|
+
|
|
145
|
+
## 8. OpenClaw-specific safeguards
|
|
146
|
+
|
|
147
|
+
OpenClaw defaults are permissive: sandboxing off, `security: full`, `ask: off`. **Tighten before letting an agent buy on your behalf.**
|
|
148
|
+
|
|
149
|
+
- **Restrict who triggers purchases**: `channels.<ch>.allowFrom: ["<your_id>"]` + `dmPolicy: "pairing"`. Same for WhatsApp, Signal, Slack, Discord.
|
|
150
|
+
- **Require approval for buys**: `~/.openclaw/exec-approvals.json` with `security: allowlist` + `ask: on-miss`. Allowlist read-only CLI (`bitrefill search-products`, `bitrefill get-product-details`, `bitrefill get-invoice-by-id`); force `/approve` for `bitrefill buy-products`. Same pattern if using MCP `buy-products`.
|
|
151
|
+
- **Isolate Bitrefill agent**: under `agents.list[]` declare a Bitrefill-scoped persona with `tools.deny: ["gateway"]` so the agent **cannot rewrite Gateway config** to bypass approvals. Source: <https://docs.openclaw.ai/tools/exec-approvals.md>.
|
|
152
|
+
- **Guest first, balance when ready**: guest CLI + payment link = lowest friction; human pre-funds account + `login`/`verify` when agent needs capped `balance` spend. **Never** give the agent crypto wallet seeds. Skill is not a wallet.
|
|
153
|
+
- **No voice readback of codes**: disable `audio_as_voice` / TTS for the Bitrefill agent. Pi's media pipeline could otherwise speak a cash-like code aloud over Telegram voice notes.
|
|
154
|
+
- **No `MEDIA:<url>` for redemption codes**: enforce text-only delivery for the redemption tool output.
|
|
155
|
+
|
|
156
|
+
## Source of truth
|
|
157
|
+
|
|
158
|
+
- OpenClaw docs: <https://docs.openclaw.ai/>
|
|
159
|
+
- Skills loader: <https://docs.openclaw.ai/tools/skills.md>
|
|
160
|
+
- Creating skills: <https://docs.openclaw.ai/tools/creating-skills.md>
|
|
161
|
+
- MCP CLI: <https://docs.openclaw.ai/cli/mcp.md>
|
|
162
|
+
- Exec tool: <https://docs.openclaw.ai/tools/exec.md>
|
|
163
|
+
- Sandboxing: <https://docs.openclaw.ai/gateway/sandboxing.md>
|
|
164
|
+
- Exec approvals: <https://docs.openclaw.ai/tools/exec-approvals.md>
|
|
165
|
+
- Nodes: <https://docs.openclaw.ai/nodes/index.md>
|
|
166
|
+
- Channels: <https://docs.openclaw.ai/channels/telegram>
|
|
167
|
+
- Bitrefill skill paths: [mcp.md](mcp.md), [cli.md](cli.md), [api.md](api.md), [browse.md](browse.md), [safeguards.md](safeguards.md)
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Path: MCP
|
|
2
|
+
|
|
3
|
+
**Preferred purchase channel.** Typed tool calls, OAuth or API key, no shell, works in 10+ hosts.
|
|
4
|
+
|
|
5
|
+
## Two MCP servers
|
|
6
|
+
|
|
7
|
+
### eCommerce MCP — for purchases
|
|
8
|
+
|
|
9
|
+
URL: `https://api.bitrefill.com/mcp` (OAuth) **or** `https://api.bitrefill.com/mcp/YOUR_API_KEY` (header-less, key-in-path).
|
|
10
|
+
|
|
11
|
+
7 tools:
|
|
12
|
+
|
|
13
|
+
- `search-products` — keyword + country + category
|
|
14
|
+
- `product-details` — packages (denominations) + pricing
|
|
15
|
+
- `buy-products` — create invoice
|
|
16
|
+
- `get-invoice-by-id` — poll payment status
|
|
17
|
+
- `get-order-by-id` — get redemption info (codes, eSIM QR)
|
|
18
|
+
- `list-invoices` — invoice history
|
|
19
|
+
- `list-orders` — order history
|
|
20
|
+
|
|
21
|
+
Auth: OAuth (recommended for interactive use) or API key from <https://www.bitrefill.com/account/developers>.
|
|
22
|
+
|
|
23
|
+
### Development MCP — for docs only
|
|
24
|
+
|
|
25
|
+
URL: `https://docs.bitrefill.com/mcp`. Indexes the docs site for code-help. **Not for purchases.** Use only when authoring an integration against the Bitrefill API/CLI.
|
|
26
|
+
|
|
27
|
+
## Per-client setup
|
|
28
|
+
|
|
29
|
+
### Cursor — `.cursor/mcp.json` (project) or `~/.cursor/mcp.json` (global)
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"mcpServers": {
|
|
34
|
+
"bitrefill": {
|
|
35
|
+
"url": "https://api.bitrefill.com/mcp",
|
|
36
|
+
"autoApprove": [
|
|
37
|
+
"search-products", "product-details",
|
|
38
|
+
"list-invoices", "get-invoice-by-id",
|
|
39
|
+
"list-orders", "get-order-by-id"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Keep `buy-products` **out** of `autoApprove`. Cursor caps at 40 active tools across all servers.
|
|
47
|
+
|
|
48
|
+
### Claude Code
|
|
49
|
+
|
|
50
|
+
With the **bitrefill** plugin installed from this repo’s marketplace, the eCommerce MCP is auto-registered; `claude mcp add` below is for manual-only setups.
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
claude mcp add bitrefill --url https://api.bitrefill.com/mcp
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Or edit `~/.claude.json`. Override output cap with `MAX_MCP_OUTPUT_TOKENS` (default 25 000).
|
|
57
|
+
|
|
58
|
+
### Claude Desktop — `claude_desktop_config.json`
|
|
59
|
+
|
|
60
|
+
macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`. Windows: `%APPDATA%\Claude\claude_desktop_config.json`.
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"bitrefill": { "url": "https://api.bitrefill.com/mcp" }
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Claude.ai (web) — Pro / Max / Team / Enterprise
|
|
71
|
+
|
|
72
|
+
Settings → Connectors → Add custom connector → URL `https://api.bitrefill.com/mcp`. Free tier cannot add custom URLs.
|
|
73
|
+
|
|
74
|
+
### ChatGPT (Plus / Pro / Business / Enterprise / Edu)
|
|
75
|
+
|
|
76
|
+
Settings → Apps & Connectors → Add → URL `https://api.bitrefill.com/mcp`. Toggle **Developer Mode** to allow `buy-products` (write tool). Free tier blocked.
|
|
77
|
+
|
|
78
|
+
### Codex CLI — `~/.codex/config.toml`
|
|
79
|
+
|
|
80
|
+
```toml
|
|
81
|
+
[mcp_servers.bitrefill]
|
|
82
|
+
url = "https://api.bitrefill.com/mcp"
|
|
83
|
+
bearer_token_env_var = "BITREFILL_API_KEY"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
OAuth: `codex mcp login bitrefill`.
|
|
87
|
+
|
|
88
|
+
### Gemini CLI — `~/.gemini/settings.json` (or project `.gemini/settings.json`)
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"mcpServers": {
|
|
93
|
+
"bitrefill": {
|
|
94
|
+
"url": "https://api.bitrefill.com/mcp",
|
|
95
|
+
"headers": { "Authorization": "Bearer ${BITREFILL_API_KEY}" }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
OAuth: `gemini mcp auth bitrefill`.
|
|
102
|
+
|
|
103
|
+
### OpenCode — `opencode.jsonc`
|
|
104
|
+
|
|
105
|
+
```jsonc
|
|
106
|
+
{
|
|
107
|
+
"mcp": {
|
|
108
|
+
"bitrefill": {
|
|
109
|
+
"url": "https://api.bitrefill.com/mcp",
|
|
110
|
+
"headers": { "Authorization": "Bearer ${BITREFILL_API_KEY}" }
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### OpenClaw — see [host-openclaw.md](host-openclaw.md)
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
openclaw mcp set bitrefill --url "https://api.bitrefill.com/mcp/$BITREFILL_API_KEY"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Workflow
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
search-products → product-details → buy-products → get-invoice-by-id → get-order-by-id
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
1. **Search**: `search-products(query="Steam", country="US", product_type="giftcard")`. `country` is uppercase Alpha-2.
|
|
129
|
+
2. **Details**: `product-details(product_id="steam-usa", currency="USDC")`. Returns `packages` array with `package_id` in form `{product_id}<&>{value}`.
|
|
130
|
+
3. **Buy**: `buy-products(cart_items=[{product_id, package_id}], payment_method, return_payment_link=true)`. Max 15 items per call.
|
|
131
|
+
- For instant fulfillment: `payment_method: "balance"` + `auto_pay: true`.
|
|
132
|
+
- For agent-driven crypto: `payment_method: "usdc_base"` + `return_payment_link: true` → use `x402_payment_url`.
|
|
133
|
+
4. **Poll**: `get-invoice-by-id(invoice_id)`. Statuses: `unpaid` → `payment_detected` → `payment_confirmed` → `complete`.
|
|
134
|
+
5. **Redeem**: `get-order-by-id(order_id, include_redemption_info=true)` → returns code / link / eSIM install URL.
|
|
135
|
+
|
|
136
|
+
Confirm with user before step 3. Logging per [safeguards.md](safeguards.md).
|
|
137
|
+
|
|
138
|
+
## Caveats
|
|
139
|
+
|
|
140
|
+
- **ChatGPT** custom MCP requires Plus+; write tools require Developer Mode (admin-enabled on workspaces).
|
|
141
|
+
- **Cursor** 40-tool cap across all servers.
|
|
142
|
+
- **Claude.ai** consumer needs Pro+ for custom URLs.
|
|
143
|
+
- **Code-execution sandboxes** (Claude.ai analysis tool, ChatGPT Code Interpreter) have **no network egress** — they can't call MCP servers; install MCP at the chat level instead.
|
|
144
|
+
|
|
145
|
+
## Source of truth
|
|
146
|
+
|
|
147
|
+
- <https://docs.bitrefill.com/docs/ecommerce-mcp>
|
|
148
|
+
- <https://docs.bitrefill.com/docs/development-mcp>
|
|
149
|
+
- <https://docs.bitrefill.com/docs/setup-guides>
|
|
150
|
+
- Per-client setup: <https://docs.bitrefill.com/docs/use-with-cursor>, `/use-with-claude-chat`, `/use-with-claude-code`, `/use-with-chatgpt`
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Spending Safeguards
|
|
2
|
+
|
|
3
|
+
This skill enables **real-money transactions**. Purchases are fulfilled instantly after payment confirms. Digital codes are non-refundable per EU consumer rights once delivered.
|
|
4
|
+
|
|
5
|
+
This page is the **agent-policy layer** — not in upstream Bitrefill or host docs. Read fully before any purchase tool call.
|
|
6
|
+
|
|
7
|
+
## Universal rules
|
|
8
|
+
|
|
9
|
+
- **Default: always confirm before purchasing.** Present product, denomination, price, payment method. Wait for explicit user approval. Autonomous purchasing only when user explicitly opts in for the current session.
|
|
10
|
+
- **Codes are cash-like.** A gift card code or eSIM QR is bearer money. Store securely. Never share publicly.
|
|
11
|
+
- **Prefer in-memory storage.** Don't write codes to plain-text logs, transcripts, or unencrypted files. Programmatically read code → use it → discard.
|
|
12
|
+
- **If user asks for the code**: return it but advise to (a) store securely, (b) not share, (c) redeem ASAP.
|
|
13
|
+
- **Dedicated, low-balance account.** Never give the agent access to high-balance accounts. Pre-fund only what the agent may spend in the current session.
|
|
14
|
+
- **Headless CLI: agent-owned inbox.** Register Bitrefill with an agent inbox ([AgentMail](https://www.agentmail.to/) or equivalent — [cli-headless-auth.md](cli-headless-auth.md)), not the human's primary email. Inbox compromise = account takeover.
|
|
15
|
+
- **Not a wallet.** This skill does not store private keys or manage crypto wallets. Never give the agent seed phrases, hardware-wallet PINs, or signing keys.
|
|
16
|
+
- **Log every purchase.** `invoice_id`, product slug, amount, payment method, timestamp.
|
|
17
|
+
- **Refunds**: digital goods refundable only if they don't work as expected (defective code). EU 14-day change-of-mind does **not** apply.
|
|
18
|
+
- **Browser redemption fallback.** If trying to redeem on a brand site triggers anti-bot, ask the user to complete redemption manually and return the code.
|
|
19
|
+
|
|
20
|
+
Terms: <https://www.bitrefill.com/terms/>.
|
|
21
|
+
|
|
22
|
+
## Per-host hardening
|
|
23
|
+
|
|
24
|
+
### OpenClaw
|
|
25
|
+
|
|
26
|
+
Defaults are permissive (sandboxing off, `security: full`, `ask: off`). Tighten:
|
|
27
|
+
|
|
28
|
+
- **Prefer guest CLI via `exec`** for first purchases (no auth); sign in only when human wants `balance` cap or cashback. See [host-openclaw.md](host-openclaw.md).
|
|
29
|
+
|
|
30
|
+
- `channels.<ch>.allowFrom: ["<your_id>"]` + `dmPolicy: "pairing"` on every channel.
|
|
31
|
+
- `~/.openclaw/exec-approvals.json`: `security: allowlist` + `ask: on-miss`. Allowlist read tools (`bitrefill search-products`, `bitrefill list-*`, `bitrefill get-*`). Force `/approve` for `bitrefill buy-products` and the MCP `buy-products` call.
|
|
32
|
+
- `agents.list[]` Bitrefill persona with `tools.deny: ["gateway"]` so the agent cannot rewrite Gateway config.
|
|
33
|
+
- Disable voice readback (`audio_as_voice` / TTS) for the Bitrefill agent. Codes spoken aloud over voice notes leak.
|
|
34
|
+
- Force text-only delivery — no `MEDIA:<url>` for redemption code output.
|
|
35
|
+
|
|
36
|
+
Full detail in [host-openclaw.md](host-openclaw.md) §8.
|
|
37
|
+
|
|
38
|
+
### Cursor
|
|
39
|
+
|
|
40
|
+
`.cursor/mcp.json` `autoApprove` may include read tools. **Never** include `buy-products`:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"mcpServers": {
|
|
45
|
+
"bitrefill": {
|
|
46
|
+
"url": "https://api.bitrefill.com/mcp",
|
|
47
|
+
"autoApprove": [
|
|
48
|
+
"search-products", "product-details",
|
|
49
|
+
"list-invoices", "get-invoice-by-id",
|
|
50
|
+
"list-orders", "get-order-by-id"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Codex CLI
|
|
58
|
+
|
|
59
|
+
Run with sandbox + approval:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
codex --sandbox workspace-write --ask-for-approval on-request
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Put `BITREFILL_API_KEY` in a profile (`~/.codex/config.toml` `[profiles.bitrefill]`), not in committed config.
|
|
66
|
+
|
|
67
|
+
### Claude Code
|
|
68
|
+
|
|
69
|
+
In `~/.claude/settings.json` (or project `.claude/settings.json`):
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"sandbox": {
|
|
74
|
+
"filesystem": {
|
|
75
|
+
"denyRead": ["~/.ssh", ".env", "*.pem", "**/.bitrefill_token"],
|
|
76
|
+
"denyWrite": ["~/.ssh", ".env"]
|
|
77
|
+
},
|
|
78
|
+
"network": {
|
|
79
|
+
"allow": ["api.bitrefill.com", "registry.npmjs.org"]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Claude Desktop / Claude.ai web
|
|
86
|
+
|
|
87
|
+
Per-tool approval prompts on by default. Keep them on. Don't whitelist `buy-products`.
|
|
88
|
+
|
|
89
|
+
### ChatGPT (web / Desktop / Atlas / Agent)
|
|
90
|
+
|
|
91
|
+
Developer Mode required for write tools. Keep it **off** unless actively purchasing. Confirm in-chat before every `buy-products`.
|
|
92
|
+
|
|
93
|
+
### Gemini CLI
|
|
94
|
+
|
|
95
|
+
Run with `--sandbox` (Seatbelt / Docker / gVisor). Per-shell command confirmation prompts on by default.
|
|
96
|
+
|
|
97
|
+
### OpenCode
|
|
98
|
+
|
|
99
|
+
Set permissions per agent:
|
|
100
|
+
|
|
101
|
+
```jsonc
|
|
102
|
+
{
|
|
103
|
+
"agents": {
|
|
104
|
+
"bitrefill": {
|
|
105
|
+
"permissions": {
|
|
106
|
+
"edit": "ask",
|
|
107
|
+
"bash": { "*": "ask", "bitrefill list-*": "allow", "bitrefill get-*": "allow" },
|
|
108
|
+
"webfetch": "ask"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Payment method risk
|
|
116
|
+
|
|
117
|
+
- `balance` — instant, capped by pre-funded amount. **Lowest blast radius.**
|
|
118
|
+
- `usdc_base` via x402 — autonomous payment from agent-controlled wallet. Bound the wallet balance.
|
|
119
|
+
- `lightning` — fast, low fee. Manual pay or Lightning-capable agent.
|
|
120
|
+
- Other on-chain crypto — slow, requires polling. Higher chance of expired invoices (180 min).
|
|
121
|
+
|
|
122
|
+
Default recommendation: pre-fund `balance` with low cap → use `payment_method: "balance"` + `auto_pay: true`.
|
|
123
|
+
|
|
124
|
+
## What to NEVER do
|
|
125
|
+
|
|
126
|
+
- Pass redemption codes through group chats, public channels, screen-shared sessions, or shared documents.
|
|
127
|
+
- Speak codes aloud via TTS / voice notes.
|
|
128
|
+
- Store codes in version control, even private repos.
|
|
129
|
+
- Give the agent seed phrases or hardware-wallet PINs.
|
|
130
|
+
- Auto-approve `buy-products` in any host's MCP config.
|
|
131
|
+
- Run the Bitrefill skill from an account with stored payment cards or high balances.
|
|
132
|
+
|
|
133
|
+
## Source of truth
|
|
134
|
+
|
|
135
|
+
- Bitrefill ToS: <https://www.bitrefill.com/terms/>
|
|
136
|
+
- Refund policy: <https://docs.bitrefill.com/docs/refunds>
|
|
137
|
+
- Path setup: [mcp.md](mcp.md), [cli.md](cli.md), [api.md](api.md), [browse.md](browse.md)
|
|
138
|
+
- OpenClaw hardening: [host-openclaw.md](host-openclaw.md)
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
Common errors across all paths. Full enum: <https://docs.bitrefill.com/docs/error-codes> and <https://docs.bitrefill.com/docs/References>.
|
|
4
|
+
|
|
5
|
+
## Browse path
|
|
6
|
+
|
|
7
|
+
### `403 Forbidden` when fetching bitrefill.com
|
|
8
|
+
|
|
9
|
+
Cloudflare blocks datacenter IPs. Fix: switch to residential browser (ChatGPT Atlas, Cursor browser, Claude+Chrome ext, OpenClaw on user host) or pivot to MCP/CLI/API.
|
|
10
|
+
|
|
11
|
+
### Product appears in listing but not purchasable
|
|
12
|
+
|
|
13
|
+
Geolock at IP level. URL country only filters listed inventory; checkout enforces user's IP. Tell user to access from the matching country (or VPN) — but warn this may violate ToS.
|
|
14
|
+
|
|
15
|
+
## MCP path
|
|
16
|
+
|
|
17
|
+
### Tool not visible to agent
|
|
18
|
+
|
|
19
|
+
- Cursor: 40-tool cap exceeded across all servers. Disable an unused MCP server.
|
|
20
|
+
- ChatGPT: Developer Mode off → write tools (`buy-products`) hidden. Toggle in Settings.
|
|
21
|
+
- Claude.ai consumer: Free tier cannot add custom MCP URLs. Upgrade to Pro+.
|
|
22
|
+
- OpenClaw: `tools.deny: ["bundle-mcp"]` accidentally hiding the server, or per-agent `tools.allow` whitelist excluding it.
|
|
23
|
+
|
|
24
|
+
### `StreamableHTTPError` with HTML body
|
|
25
|
+
|
|
26
|
+
Wrong `MCP_URL` — pointing at non-Bitrefill endpoint. Unset `MCP_URL` env var or set to `https://api.bitrefill.com/mcp`.
|
|
27
|
+
|
|
28
|
+
### OAuth loop in Cursor / Claude.ai
|
|
29
|
+
|
|
30
|
+
Clear browser cookies for `bitrefill.com`, try a different browser, ensure pop-ups not blocked.
|
|
31
|
+
|
|
32
|
+
### MCP server filtered out (OpenClaw)
|
|
33
|
+
|
|
34
|
+
OpenClaw startup safety filter rejects env keys: `NODE_OPTIONS`, `PYTHONSTARTUP`, `PYTHONPATH`, `PERL5OPT`, `RUBYOPT`, `SHELLOPTS`, `PS4`. Use only standard `*_API_KEY` / `GITHUB_TOKEN` / proxy vars in MCP server `env` blocks.
|
|
35
|
+
|
|
36
|
+
### MCP output truncated
|
|
37
|
+
|
|
38
|
+
Default cap varies by host. Claude Code: `MAX_MCP_OUTPUT_TOKENS=50000` to raise. OpenClaw: `tools.toolResultMaxChars` (default 16000). Use pagination: `--per_page 25`, multiple `list-orders` calls.
|
|
39
|
+
|
|
40
|
+
## CLI path
|
|
41
|
+
|
|
42
|
+
### `cart_items` JSON shape error
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
# WRONG (object)
|
|
46
|
+
--cart_items '{"product_id": "steam-usa", "package_id": 5}'
|
|
47
|
+
|
|
48
|
+
# RIGHT (array)
|
|
49
|
+
--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### `Invalid denomination 'undefined'`
|
|
53
|
+
|
|
54
|
+
Both `product_id` AND `package_id` required per item.
|
|
55
|
+
|
|
56
|
+
### `Too big: expected array to have <=15 items`
|
|
57
|
+
|
|
58
|
+
Split into multiple `buy-products` calls.
|
|
59
|
+
|
|
60
|
+
### `per_page must be less than 500`
|
|
61
|
+
|
|
62
|
+
Server limit. Use 500 max.
|
|
63
|
+
|
|
64
|
+
### `error: required option '--<name>' not specified`
|
|
65
|
+
|
|
66
|
+
Client-side validation. Add the missing option.
|
|
67
|
+
|
|
68
|
+
### "Must be one of" enum errors
|
|
69
|
+
|
|
70
|
+
| Option | Valid values | Common mistakes |
|
|
71
|
+
|--------|--------------|-----------------|
|
|
72
|
+
| `--payment_method` | `bitcoin`, `lightning`, `ethereum`, `usdc_polygon`, `usdt_polygon`, `usdc_erc20`, `usdt_erc20`, `usdc_arbitrum`, `usdc_solana`, `usdc_base`, `eth_base`, `balance` | `paypal`, `visa`, `USDC_BASE` (case-sensitive) |
|
|
73
|
+
| `--product_type` | `giftcard`, `esim` | `giftcards`, `gift_card`, `sim` |
|
|
74
|
+
| `--country` | `US`, `IT`, `BR` (uppercase Alpha-2) | `us`, `USA`, `"United States"` |
|
|
75
|
+
|
|
76
|
+
### Wrong `package_id` for named denominations
|
|
77
|
+
|
|
78
|
+
Exact, case-sensitive. WRONG `"1GB"`, `"300 nc"`. RIGHT `"1GB, 7 Days"`, `"PUBG New State 300 NC"`. Get exact strings from `get-product-details` `packages` array.
|
|
79
|
+
|
|
80
|
+
### Compound key in `package_id`
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
# WRONG
|
|
84
|
+
--cart_items '[{"product_id": "steam-usa", "package_id": "steam-usa<&>5"}]'
|
|
85
|
+
|
|
86
|
+
# RIGHT (value after <&>)
|
|
87
|
+
--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### CLI auth failure (≥ 0.3.0)
|
|
91
|
+
|
|
92
|
+
CLI uses OAuth client_credentials + email magic link — not API keys, not browser OAuth.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
bitrefill reset # clear corrupt state
|
|
96
|
+
bitrefill login --email you@example.com
|
|
97
|
+
bitrefill verify --code 123456 # add --otp for TOTP
|
|
98
|
+
bitrefill whoami --json
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
| Error | Fix |
|
|
102
|
+
|-------|-----|
|
|
103
|
+
| `Access token is required for login/verify` | Any command first (MCP connect), or `reset` then retry |
|
|
104
|
+
| `No pending login` | Run `login --email` before `verify` |
|
|
105
|
+
| `No OTP code provided` on verify | Account has 2FA — add `--otp` (authenticator), keep `--code` (email magic link) |
|
|
106
|
+
| `Invalid code` on verify | Wrong email code or wrong TOTP; don't swap them — email code → `--code`, authenticator → `--otp` |
|
|
107
|
+
| `unknown option '--code'` on login | Code goes on `verify --code`, not `login` |
|
|
108
|
+
| `unknown command 'login'` | Already signed in — `logout` first |
|
|
109
|
+
| `Failed to establish a session` | `reset`, then retry |
|
|
110
|
+
| Invalid / expired code | Re-run `login --email`; headless → poll agent inbox (AgentMail or equivalent — [cli-headless-auth.md](cli-headless-auth.md)) |
|
|
111
|
+
| Missing TOTP | `verify --code … --otp "$(op read 'op://Vault/Item/one-time password?attribute=otp')"` |
|
|
112
|
+
|
|
113
|
+
State: `~/.config/bitrefill-cli/<host>.v1.json`. `logout` revokes session; `reset` clears everything.
|
|
114
|
+
|
|
115
|
+
Pre-0.3.0 (`credentials.json`, `--api-key`): upgrade CLI. Developer API keys still work for [mcp.md](mcp.md) / [api.md](api.md) paths only.
|
|
116
|
+
|
|
117
|
+
### Empty search results, no error
|
|
118
|
+
|
|
119
|
+
`found: 0` with no error message. Causes:
|
|
120
|
+
|
|
121
|
+
- `--category` slug doesn't exist (silent miss).
|
|
122
|
+
- Product not available in `--country`.
|
|
123
|
+
- `--in_stock true` (default) filters out-of-stock.
|
|
124
|
+
|
|
125
|
+
Fix: drop `--category`, change `--country`, or `--in_stock false`.
|
|
126
|
+
|
|
127
|
+
### Unpaid invoices missing from list
|
|
128
|
+
|
|
129
|
+
`list-invoices` defaults `--only_paid true`. Use `--only_paid false`.
|
|
130
|
+
|
|
131
|
+
## API path
|
|
132
|
+
|
|
133
|
+
### `401 Unauthorized`
|
|
134
|
+
|
|
135
|
+
- Personal: `Authorization: Bearer $BITREFILL_API_KEY` missing or wrong key.
|
|
136
|
+
- Business / Affiliate: `Authorization: Basic $(echo -n "$ID:$SECRET" | base64)` malformed.
|
|
137
|
+
|
|
138
|
+
### `429 Too Many Requests`
|
|
139
|
+
|
|
140
|
+
Rate limited. Defaults: 60 req / 10 min on most endpoints, 60 req/min on `/products` + `/products/search` plus 1000 product req/hr quota, 1 req / 3 s on `/ping`. Back off + retry. Cache product catalog locally.
|
|
141
|
+
|
|
142
|
+
### `RESOURCE_NOT_FOUND` on `GET /invoices/{id}`
|
|
143
|
+
|
|
144
|
+
Bad invoice ID. Verify via `list-invoices`.
|
|
145
|
+
|
|
146
|
+
### `Product '{slug}' is not available`
|
|
147
|
+
|
|
148
|
+
Bad product slug. Verify via `search-products`.
|
|
149
|
+
|
|
150
|
+
### Invoice expired
|
|
151
|
+
|
|
152
|
+
Invoices expire after **180 minutes**. Cannot re-pay. Create new one.
|
|
153
|
+
|
|
154
|
+
## OpenClaw-specific
|
|
155
|
+
|
|
156
|
+
### Cron purchase failed silently
|
|
157
|
+
|
|
158
|
+
`exec-approvals.json` set to `ask: on-miss` but no operator online to `/approve`. Either pre-approve `bitrefill buy-products` for trusted SKU/amount, or schedule when operator available.
|
|
159
|
+
|
|
160
|
+
### Pi agent can't see the Bitrefill MCP
|
|
161
|
+
|
|
162
|
+
Check:
|
|
163
|
+
|
|
164
|
+
1. `openclaw mcp list` shows entry.
|
|
165
|
+
2. `~/.openclaw/openclaw.json` parses (no trailing commas).
|
|
166
|
+
3. Agent profile not denying `bundle-mcp` or whitelisting tools narrowly.
|
|
167
|
+
4. CLI signed in (`bitrefill whoami --json`) or MCP OAuth completed — not just shell env vars.
|
|
168
|
+
|
|
169
|
+
### Mobile node camera tool unavailable
|
|
170
|
+
|
|
171
|
+
Node not paired or paired but offline. Check `openclaw nodes list`. Re-pair via Control UI (`openclaw dashboard`).
|
|
172
|
+
|
|
173
|
+
### Telegram message not reaching agent
|
|
174
|
+
|
|
175
|
+
`channels.telegram.dmPolicy: "pairing"` and sender not paired. Run `openclaw pairing approve telegram <CODE>` (codes expire 1 hr).
|
|
176
|
+
|
|
177
|
+
## Source of truth
|
|
178
|
+
|
|
179
|
+
- Bitrefill error codes: <https://docs.bitrefill.com/docs/error-codes>
|
|
180
|
+
- Bitrefill error handling: <https://docs.bitrefill.com/docs/References>
|
|
181
|
+
- Rate limits: <https://docs.bitrefill.com/docs/rate-limits>
|
|
182
|
+
- OpenClaw troubleshooting: <https://docs.openclaw.ai/help> + per-tool pages
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: kaleido-trading
|
|
3
|
+
description: "Trade and manage a portfolio on KaleidoSwap: get live prices and market data, quote and place atomic swaps between BTC and RGB assets (USDT, XAUT), acquire inbound liquidity from the LSP, and check positions. Triggers when the user wants a price, a quote, to swap or trade assets, to rebalance a portfolio, or to acquire a Lightning channel from the LSP."
|
|
4
|
+
tools: get_price, get_market_data, kaleidoswap_get_pairs, kaleidoswap_get_quote, kaleidoswap_place_order, kaleidoswap_get_order_status, kaleidoswap_get_position, kaleidoswap_lsp_get_info, kaleidoswap_lsp_create_order
|
|
5
|
+
triggers: price, quote, swap, trade, rebalance, portfolio, market, slippage, liquidity, channel order
|
|
6
|
+
metadata:
|
|
7
|
+
author: kaleidoswap
|
|
8
|
+
version: "0.1.0"
|
|
9
|
+
surface: "kaleido-mcp (KaleidoSwap maker + market data)"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# KaleidoSwap trading
|
|
13
|
+
|
|
14
|
+
Quote, swap, and manage a portfolio through the KaleidoSwap maker and market
|
|
15
|
+
data MCP tools.
|
|
16
|
+
|
|
17
|
+
## Flow
|
|
18
|
+
|
|
19
|
+
1. **Price first.** Use `get_price` / `get_market_data` for context and
|
|
20
|
+
`kaleidoswap_get_quote` for an executable price before proposing a trade.
|
|
21
|
+
2. **Confirm the trade.** Show pair, direction, amount in, expected amount out,
|
|
22
|
+
and fees. Wait for explicit approval before `kaleidoswap_place_order`.
|
|
23
|
+
3. **Track it.** After placing, poll `kaleidoswap_get_order_status` until the
|
|
24
|
+
swap settles, then report the result and the new `kaleidoswap_get_position`.
|
|
25
|
+
4. **Need inbound liquidity?** If a swap can't route for lack of a channel, use
|
|
26
|
+
`kaleidoswap_lsp_get_info` then `kaleidoswap_lsp_create_order` to buy one.
|
|
27
|
+
|
|
28
|
+
## Rules
|
|
29
|
+
|
|
30
|
+
- Never trade on a stale quote — re-quote if the user hesitates.
|
|
31
|
+
- Surface slippage and fees explicitly; small local models must not hide cost.
|