@paybox-sh/sdk 1.0.0 → 2.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/README.md +56 -12
- package/SKILL.md +241 -235
- package/dist/{chunk-SMPW2GUM.js → chunk-OZ7KVOBT.js} +166 -30
- package/dist/chunk-OZ7KVOBT.js.map +1 -0
- package/dist/cli.js +760 -69
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +101 -6
- package/dist/index.js +3 -1
- package/package.json +2 -1
- package/dist/chunk-SMPW2GUM.js.map +0 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Typed Node SDK and `paybox` CLI for the PayBox agent API. It mirrors the MCP tool
|
|
4
4
|
surface — `list_credentials`, `request_payment`, `claim_payment_credentials`,
|
|
5
5
|
`request_wallet_sign`, `request_secret`, `request_swap`, `discover_services`,
|
|
6
|
-
`pay_x402`, `use_service`, `get_portfolio`, `get_buy_link`,
|
|
6
|
+
`pay_x402`, `use_service`, `get_portfolio`, `get_buy_link`, `get_deposit_link`,
|
|
7
7
|
`request_account_change`, `get_request`, and the generic plugin discovery,
|
|
8
8
|
contract, and invocation flow. Core operations use the REST API; plugins use
|
|
9
9
|
the same MCP tools as connector hosts, with no hardcoded per-plugin paths.
|
|
@@ -21,23 +21,24 @@ npx @paybox-sh/sdk login # or use the CLI directly
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Driving this CLI from an agent? [`SKILL.md`](SKILL.md) ships in the package and
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
routes wallet tasks through existing access or the required setup steps. It
|
|
25
|
+
preserves an explicit wallet choice and resumes the requested task after setup.
|
|
26
|
+
Use the CLI on **Muse**, **Grok Bot**, **Grok Computer**, and any agent on a
|
|
27
27
|
computer with no connector screen — not the grok.com MCP connector path.
|
|
28
28
|
|
|
29
29
|
## CLI
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
|
|
38
|
-
paybox login
|
|
32
|
+
# Setup is two commands. `login` authenticates; `connect` pairs a signing key.
|
|
33
|
+
# Pairing prints eight emoji and a link; you open the link and pick that same
|
|
34
|
+
# code in PayBox. The key is generated locally and never leaves this machine,
|
|
35
|
+
# so there is nothing to copy. Neither command needs a browser on the machine
|
|
36
|
+
# running the CLI — approve both from a phone if you like. Add --no-open to
|
|
37
|
+
# either command to print the link without launching a browser.
|
|
38
|
+
paybox login # device-code OAuth (browser + passkey)
|
|
39
39
|
paybox login --key pbx_live_… # personal API key instead (no OAuth)
|
|
40
|
-
|
|
40
|
+
paybox connect # pair a signing key
|
|
41
|
+
PAYBOX_SIGNING_KEY=pbxk1.… paybox … # headless: reuse an already-paired key
|
|
41
42
|
|
|
42
43
|
paybox credentials # list usable credentials
|
|
43
44
|
# `--credential <id>` below is the `credential.id` from that list, not the wallet name.
|
|
@@ -57,6 +58,7 @@ paybox buy-link --credential <id> --amount-usd 50 # defaults EVM funding to Ba
|
|
|
57
58
|
paybox buy-link --credential <id> --destination eip155:1 --currency eth
|
|
58
59
|
paybox account-change --note "need a wallet grant" # manage_url for the user to open
|
|
59
60
|
paybox request <request_id> --wait # poll a pending request
|
|
61
|
+
paybox request <request_id> --complete-signature # sign that parked wallet-sign request locally
|
|
60
62
|
|
|
61
63
|
# Plugins (enable them in the paybox app first)
|
|
62
64
|
paybox plugins list --status enabled
|
|
@@ -79,6 +81,17 @@ its own binary). For project installs use `pnpm up`/`pnpm rm`, or `npx
|
|
|
79
81
|
`sign`, `swap`, `pay-x402`, and `use-service` can complete in-process with a
|
|
80
82
|
configured `pbxk1.` key. Plugin calls return the raw MCP tool result.
|
|
81
83
|
|
|
84
|
+
An MCP host can declare its signing surface on each HTTP request with
|
|
85
|
+
`X-Paybox-Signing-Surface: in-process`, `browser`, or `none`. Omit the header to
|
|
86
|
+
keep the existing MCP Apps behavior. The value selects one advisory
|
|
87
|
+
`next_action`; it does not grant signing access. A host must use `in-process`
|
|
88
|
+
only when it has an eligible local callback for that operation. For a parked
|
|
89
|
+
wallet-sign request, call `paybox.completeWalletSignRequest(requestId)` from
|
|
90
|
+
that callback. The SDK reads the stored intent from PayBox and signs the same
|
|
91
|
+
request. It does not create another request. Do not put the signing key in an
|
|
92
|
+
MCP tool argument or model context. `pending_approval` still needs a person;
|
|
93
|
+
`denied` and `error` remain terminal request states.
|
|
94
|
+
|
|
82
95
|
For a Solana `swap` the SDK re-pins a fresh recent blockhash immediately before
|
|
83
96
|
signing (parity with the signing window — the quote-time blockhash expires
|
|
84
97
|
within ~60–90s, often before signing), so a swap that dwells for approval no
|
|
@@ -150,6 +163,37 @@ macOS/Linux). On Windows the POSIX mode bits don't restrict access — the file
|
|
|
150
163
|
is not access-protected there, so prefer `PAYBOX_API_KEY` / `PAYBOX_SIGNING_KEY`
|
|
151
164
|
env vars on shared Windows machines.
|
|
152
165
|
|
|
166
|
+
## Headless and CI
|
|
167
|
+
|
|
168
|
+
Pairing needs a human to confirm the code, so CI cannot pair at run time. Pair
|
|
169
|
+
once ahead of time **as the identity CI will use**, then carry both secrets:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# On a laptop. The pbx_live_ key comes from the PayBox app (Agents → create an
|
|
173
|
+
# agent, pick its wallets); it is shown once.
|
|
174
|
+
paybox login --key pbx_live_… # authenticate as the client CI will use
|
|
175
|
+
paybox connect # pick the code; approve on any device
|
|
176
|
+
grep signingKey ~/.config/paybox/config.json
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
```yaml
|
|
180
|
+
env:
|
|
181
|
+
PAYBOX_API_KEY: ${{ secrets.PAYBOX_API_KEY }} # pbx_live_…
|
|
182
|
+
PAYBOX_SIGNING_KEY: ${{ secrets.PAYBOX_SIGNING_KEY }} # pbxk1.…
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
`PayboxClient.fromConfig()` reads both from the environment, so the runner needs
|
|
186
|
+
no config file, no browser, and no TTY.
|
|
187
|
+
|
|
188
|
+
Those two secrets are a **matched pair**: a signer is bound to the client that
|
|
189
|
+
paired it. Present a `pbxk1.` to a different client — including the throwaway
|
|
190
|
+
client that a plain `paybox login` registers — and signing fails with `agent
|
|
191
|
+
signer belongs to another client`. It reads like a revocation but means you
|
|
192
|
+
paired under a different identity. Rotating the API key mints a new client, so
|
|
193
|
+
re-pair after rotation — `paybox login` drops the stored key when it does this
|
|
194
|
+
and tells you to run `paybox connect`, rather than leaving one that cannot
|
|
195
|
+
sign.
|
|
196
|
+
|
|
153
197
|
## Develop
|
|
154
198
|
|
|
155
199
|
`pnpm-lock.yaml` also contains the `../mcp-app` importer because this SDK
|