@keyban/cli 0.3.0 → 0.4.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/README.md CHANGED
@@ -19,7 +19,7 @@ key.
19
19
 
20
20
  **This server drives a wallet Keyban provisions. It does not create one, and it
21
21
  has nothing to drive without one** — installing the package on its own gets you
22
- a server offering only `setup_instructions` and the guide tool `get_instructions`,
22
+ a server offering only `setup_instructions` and the guide tool `get_wallet_instructions`,
23
23
  which point back here. The
24
24
  threshold key is the reason: one share lives here, the other lives with us, so
25
25
  there is a Keyban side to every wallet by construction and no configuration can
@@ -75,7 +75,7 @@ invite key. That happens once per machine; the invite key is spent by it.
75
75
  Each wallet is one file, `$XDG_CONFIG_HOME/keyban/wallets/<wallet id>.json`;
76
76
  `$XDG_CONFIG_HOME/keyban/wallet.json`, `{"current": "<wallet id>"}`, names the
77
77
  one the server drives, and `keyban wallet use <name|id>` changes it. The server
78
- reads no other wallet configuration from its environment than the two variables below.
78
+ reads no other wallet entry from its environment than through `KEYBAN_WALLET_PATH` and `KEYBAN_CONFIG`, in the table below; the other variables there tune logging and telemetry. The one exception is `KEYBAN_BASE_URL`: when set in the environment, it also picks the API the relayed admin tools talk to (the wallet itself keeps using its own entry).
79
79
 
80
80
  A wallet's file holds these entries, all from step 2 — none of them is
81
81
  something you can pick yourself.
@@ -97,6 +97,10 @@ something you can pick yourself.
97
97
  | `KEYBAN_CONFIG` | A whole wallet file as one base64 JSON value, for runtimes like AgentCore that have nothing but their environment. Without its client share (a Claude Desktop `.mcpb`), the first start writes it to the wallet's own file, by its id, and keeps the share there. |
98
98
  | `MCP_LOG_FILE` | Path the server writes its log to. |
99
99
  | `MCP_LOG_LEVEL` | `debug`, `info`, `warn` or `error`. Defaults to `info` for `keyban mcp`, `warn` for `keyban wallet`. |
100
+ | `KEYBAN_TELEMETRY_DISABLED` | `1`, `true`, `yes` or `on` turns [telemetry](#telemetry) off. |
101
+ | `KEYBAN_TELEMETRY_DEBUG` | `1`, `true`, `yes` or `on` prints each telemetry event on stderr instead of sending it. |
102
+ | `KEYBAN_TELEMETRY_URL` | Send telemetry to this URL instead of Keyban's. For testing a collector. |
103
+ | `DO_NOT_TRACK` | `1`, `true`, `yes` or `on` turns telemetry off, like `KEYBAN_TELEMETRY_DISABLED`. |
100
104
 
101
105
  `keyban mcp --http` serves stateless streamable-HTTP on `0.0.0.0:8000`,
102
106
  `POST /mcp`, for Amazon Bedrock AgentCore. It has no authentication of its own:
@@ -106,13 +110,16 @@ open wallet endpoint, so use it on AgentCore only.
106
110
  ## Tools
107
111
 
108
112
  Each tool is also a `keyban wallet` subcommand, its name in kebab-case
109
- (`x402_pay` → `keyban wallet x402-pay`) and its arguments as options.
113
+ (`x402_pay` → `keyban wallet x402-pay`) and its arguments as options, but
114
+ `list_my_wallets` and `use_wallet`: `keyban wallet list` and
115
+ `keyban wallet use <name|id>`.
110
116
 
111
117
  Read-only:
112
118
 
113
119
  | Tool | What it does |
114
120
  |---|---|
115
- | `get_instructions` | Read the agent wallet guide (the `keyban-agent-wallet` skill) |
121
+ | `list_my_wallets` | List the wallets kept on this machine, and which one is current |
122
+ | `get_wallet_instructions` | Read the agent wallet guide (the `keyban-agent-wallet` skill) |
116
123
  | `api_status` | Check Keyban API status |
117
124
  | `get_account_info` | Get wallet account info |
118
125
  | `balance` | Check wallet balance |
@@ -131,6 +138,7 @@ Writing:
131
138
 
132
139
  | Tool | What it does |
133
140
  |---|---|
141
+ | `use_wallet` | Drive another kept wallet: `keyban mcp` reloads its tools for it, in this server only unless `global`, which also makes it current; `keyban wallet use` always makes it current. Refused for an incomplete wallet, while a payment waits, or when `KEYBAN_WALLET_PATH` or `KEYBAN_CONFIG` names the wallet |
134
142
  | `sign_message` | Sign a message |
135
143
  | `cancel_intent` | Cancel a pending payment intent |
136
144
  | `transfer_usdc` | Transfer USDC — moves funds |
@@ -190,6 +198,72 @@ to the wallet, set it up, then delete the old signer. Deleting it removes its
190
198
  key from the wallet on chain and revokes its API key, so the leaked pair can
191
199
  no longer sign nor reach the API. The wallet address does not change.
192
200
 
201
+ ## Telemetry
202
+
203
+ The CLI sends a small number of diagnostic events to Keyban, so that we can see
204
+ where an installation fails. They carry no secret, but they are not anonymous:
205
+ each one names your installation and, when known, your wallet (see below).
206
+ Telemetry is sent only when the command talks to Keyban's production or testing
207
+ API; a custom API URL or a local stack sends nothing, unless you set
208
+ `KEYBAN_TELEMETRY_URL`. Events go to the API the command talks to: the wallet's
209
+ `KEYBAN_BASE_URL` for `keyban mcp` and `keyban wallet <tool>`; `--api`, then
210
+ the `KEYBAN_BASE_URL` environment variable, then production for
211
+ `keyban admin`, `wallet import` and `wallet use`.
212
+
213
+ **What is sent**, on every event: the CLI version, the OS, the CPU architecture,
214
+ the Node.js version, a random installation id (created on first run, kept in
215
+ `$XDG_CONFIG_HOME/keyban/telemetry.json`), and the wallet's application id and
216
+ address whenever its configuration holds them, even an incomplete one (neither
217
+ is a secret; a value that is not a well-formed id or `0x` address, or that
218
+ holds a secret, is left out). Then, per event:
219
+
220
+ | Event | When | Attributes |
221
+ |---|---|---|
222
+ | `cli.started` | `keyban mcp` starts | `transport` (`stdio` or `http`), `configured`, `config.problems` (names of the faulty entries, never their values), `funding` |
223
+ | `mcp.client_connected` | the MCP client finished its handshake | `mcp.client.name`, `mcp.client.version` (`unknown` when not a short plain name) |
224
+ | `wallet.init_succeeded` | `keyban mcp` initialised the wallet (a `keyban wallet <tool>` command never sends it) | `signer.already_registered` |
225
+ | `wallet.init_failed` | initialisation failed | `step` (`config`, `metadata`, `dkg`, `store_share`, `register_signer` or `rpc`), `error.kind`, `error.message`, `http.status` |
226
+ | `tool.failed` | an MCP tool returned an error | `tool.name`, `error.kind`, `error.message`, `http.status` (a relayed tool, such as missions or admin, sends no message: only the name, kind, status and, if any, its `policy/<code>` reason) |
227
+ | `command.failed` | a `keyban wallet …` or `keyban admin …` command failed | `command` (its name, no arguments), `error.kind`, `error.message`, `http.status` |
228
+ | `cli.fatal` | an error ended the process | `error.kind`, `error.message`, `http.status` |
229
+
230
+ `error.kind` is one of `config`, `network`, `http`, `wasm`,
231
+ `filesystem`, `policy` or `unknown`; `http.status` is present only for an HTTP
232
+ error. Successful tool calls are not sent.
233
+
234
+ **What is never sent**: your API key, invite key, key share, `KEYBAN_CONFIG` or
235
+ admin session token; tool and command arguments, amounts and recipients; the
236
+ URLs `x402_pay` and `x402_info` call (beyond the origin, scheme and host, an
237
+ error message may mention); HTTP response bodies; what an x402 seller says; the free-text message of a relayed tool.
238
+ `error.message` is the only free text, and it is cleaned before it leaves your
239
+ machine: only the first line of the message and of each cause is kept, cut
240
+ right after the HTTP status (`(403)`, `failed: 403`…); a JSON or HTML body is
241
+ cut; a seller's refusal keeps only `seller rejected the request`; values the
242
+ CLI holds as secrets become `<redacted>`; quoted values become `"<value>"`;
243
+ amounts such as `12.50 USDC` or `€5` become `<amount>`; e-mail addresses become `<email>` and UUIDs `<uuid>`; a `policy/<code>` refusal reason is kept; URLs are reduced to their
244
+ origin, query strings to `?<query>`, Keyban API paths to their first segment
245
+ (`/v1/missions/<path>`); long hexadecimal strings become `<hex>`; JSON excerpts
246
+ become `<json>`; unquoted file paths inside your home directory are shortened
247
+ to `~` (other unquoted paths are kept); and the message is capped at 300
248
+ characters.
249
+
250
+ **Inspect it**: `KEYBAN_TELEMETRY_DEBUG=1` prints every event on stderr, as it
251
+ would be sent, and sends nothing. It writes no file.
252
+
253
+ **Turn it off**: set `KEYBAN_TELEMETRY_DISABLED=1` (`true`, `yes` and `on` work too), or the
254
+ standard `DO_NOT_TRACK=1`. Either one wins over everything else, including
255
+ `KEYBAN_TELEMETRY_DEBUG`. Nothing is initialised and nothing is sent.
256
+
257
+ On the very first run, the CLI prints one line on stderr announcing the
258
+ telemetry and this switch; it never writes to stdout, which carries the MCP
259
+ protocol. If the installation id cannot be saved (read-only directory,
260
+ container), the line is printed on every run. The same event is sent at most
261
+ once per process. An unhandled crash of a long-running `keyban mcp` and
262
+ command-line usage errors (unknown option, missing argument) are not reported. A command that succeeds does not wait for telemetry. A command that
263
+ fails, or `keyban mcp` when it stops, waits at most about one second for its
264
+ events to leave, retries included. A failure to send is silent: it never breaks
265
+ a command nor changes its exit code.
266
+
193
267
  ## Documentation
194
268
 
195
269
  <https://docs.keyban.io/>
package/SKILL.md CHANGED
@@ -12,6 +12,9 @@ destination rules, and a threshold above which a human must approve. The key is
12
12
  a threshold key: one share stays on the machine that runs the agent, the other at
13
13
  Keyban, and neither side can sign alone.
14
14
 
15
+ Daily and weekly budgets exist per wallet only. The budgets shared above a wallet,
16
+ by its application or its organization, are monthly envelopes.
17
+
15
18
  ## Two MCP servers, two roles
16
19
 
17
20
  | | Keyban admin MCP | Agent wallet MCP |
@@ -21,7 +24,7 @@ Keyban, and neither side can sign alone.
21
24
  | Default server name | `keyban` | `agent-wallet` |
22
25
  | Does | organization, applications, agent wallets, destination rules, x402 catalogue, quotas, billing | balance, spending, USDC transfers, x402 payments, approval waits, missions |
23
26
  | Does not | spend, install the wallet's signer, approve payments, edit an existing wallet's spending caps | create or configure wallets, approve its own payments |
24
- | Guide | `keyban:get_instructions`, the `keyban-admin` skill | `agent-wallet:get_instructions`, this skill |
27
+ | Guide | `keyban:get_instructions`, the `keyban-admin` skill | `agent-wallet:get_wallet_instructions`, this skill |
25
28
 
26
29
  Tools are written `server:tool` with the default server names. If the user gave
27
30
  the servers other names, use theirs.
@@ -360,7 +363,9 @@ that payment.
360
363
  |---|---|---|
361
364
  | `policy/amount-exceeded` | above the per-payment cap | raise the cap on the wallet page |
362
365
  | `policy/budget-day-exceeded`, `-week-`, `-month-` | the period's budget is used | wait, or raise the budget on the wallet page |
363
- | `policy/budget-application-…-exceeded`, `policy/budget-organization-…-exceeded` | the budget shared by every wallet of the application (or of the whole organization) is used for the period, not this wallet's own | wait for the next period, or ask an owner or admin to raise it in Settings → Policies of the application or organization; never split the payment |
366
+ | `policy/budget-application-month-exceeded`, `policy/budget-organization-month-exceeded` | the monthly envelope of the application (or of the whole organization) is used up: every wallet below it spends from it together, not only this one | wait for the next month, or ask an owner or admin to raise it: the application envelope on the Budget page of the application, the organization one by an owner only; never split the payment |
367
+ | `policy/budget-application-free-share-exceeded`, `policy/budget-organization-free-share-exceeded` | this wallet has no envelope of its own and shares what the application (or the organization) keeps unallocated, the free share. Other wallets' reservations are untouchable, so it can run out while the envelope above still has room | tell the user the free share is used; do not retry or try another wallet to get round it. The user gives this wallet an envelope of its own (wallet page, Spending rules → Edit → Monthly budget) or asks for a larger one, which may need an owner to raise the organization; never split the payment |
368
+ | `policy/budget-currency-mismatch` | the wallet policy is in another currency than its organization's budget envelopes, so they cannot be compared: no payment goes through until that is fixed | do not retry; tell the user an owner or admin must put the wallet policy in the organization currency (wallet page, Spending rules → Edit) |
364
369
  | `policy/recipient-…`, `policy/domain-…` | destination not allowed at some scope | change a destination rule, through the admin MCP only if the user asks |
365
370
  | `policy/mission-required` | this wallet only pays inside a mission run, and the payment named none | pay inside a run of the mission this task belongs to: start one with `agent-wallet:start_mission_run` if none is active, or ask the user which mission it is; never start a run of an unrelated mission to get the payment through; do not retry without a run |
366
371
  | `policy/mission-run-not-found` | the run id is unknown, belongs to another wallet, or missions are not available | check the id with `agent-wallet:list_mission_runs`; do not guess another |
@@ -377,6 +382,7 @@ that payment.
377
382
  | `policy/x402-…` | the seller's x402 offer cannot be paid (unreachable, malformed, invalid recipient, wrong asset or chain, above `maxAmount`) | pick another provider |
378
383
  | `policy/prepaid-balance-insufficient` | the prepaid credit of the organization does not cover the payment; even a fraction of a cent short refuses | tell the user an admin must buy a pack in Billing → Prepaid credit; never retry or split the payment |
379
384
  | `policy/prepaid-payer-unavailable`, `policy/prepaid-suspended` | Keyban cannot pay prepaid payments for now | report it; do not retry |
385
+ | `policy/terms-not-accepted` | the organization has not accepted Keyban's terms yet; the welcome offer can't pay until then | ask the user to accept the terms in the Keyban dashboard (the welcome flow shows them), then retry; do not suggest funding the wallet for this |
380
386
 
381
387
  A destination refused with `mission` as scope is the mission's list; with
382
388
  `wallet`, `application` or `organization`, it is that rule.