@visa/cli 4.1.0-rc.26 → 4.1.0-rc.260

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.
Files changed (83) hide show
  1. package/README.md +202 -46
  2. package/dist/checkout-engine/adapters/generic.d.ts +69 -0
  3. package/dist/checkout-engine/adapters/generic.js +383 -58
  4. package/dist/checkout-engine/adapters/index.d.ts +4 -1
  5. package/dist/checkout-engine/adapters/index.js +10 -3
  6. package/dist/checkout-engine/adapters/shopify.d.ts +80 -0
  7. package/dist/checkout-engine/adapters/shopify.js +688 -0
  8. package/dist/checkout-engine/amount.d.ts +15 -0
  9. package/dist/checkout-engine/amount.js +72 -0
  10. package/dist/checkout-engine/browser-launch.d.ts +9 -4
  11. package/dist/checkout-engine/browser-launch.js +19 -4
  12. package/dist/checkout-engine/browserbase-browser.d.ts +24 -0
  13. package/dist/checkout-engine/browserbase-browser.js +186 -0
  14. package/dist/checkout-engine/cli-engine.d.ts +206 -32
  15. package/dist/checkout-engine/cli-engine.js +772 -216
  16. package/dist/checkout-engine/confirmed-merchants.d.ts +31 -0
  17. package/dist/checkout-engine/confirmed-merchants.js +165 -0
  18. package/dist/checkout-engine/detect.d.ts +1 -1
  19. package/dist/checkout-engine/detect.js +6 -0
  20. package/dist/checkout-engine/evidence.d.ts +1 -1
  21. package/dist/checkout-engine/executor.d.ts +61 -3
  22. package/dist/checkout-engine/executor.js +550 -144
  23. package/dist/checkout-engine/hosted-approval.d.ts +69 -9
  24. package/dist/checkout-engine/hosted-approval.js +211 -21
  25. package/dist/checkout-engine/index.d.ts +6 -2
  26. package/dist/checkout-engine/index.js +5 -1
  27. package/dist/checkout-engine/instrument.d.ts +6 -0
  28. package/dist/checkout-engine/known-merchants.d.ts +10 -0
  29. package/dist/checkout-engine/known-merchants.js +38 -0
  30. package/dist/checkout-engine/live-fill-approval.d.ts +5 -11
  31. package/dist/checkout-engine/live-fill-approval.js +20 -34
  32. package/dist/checkout-engine/mandate/card-mandate.d.ts +6 -2
  33. package/dist/checkout-engine/mandate/card-mandate.js +10 -5
  34. package/dist/checkout-engine/mandate/mandate-ledger.d.ts +63 -23
  35. package/dist/checkout-engine/mandate/mandate-ledger.js +124 -17
  36. package/dist/checkout-engine/receipt-dir.d.ts +6 -0
  37. package/dist/checkout-engine/receipt-dir.js +8 -0
  38. package/dist/checkout-engine/receipt.d.ts +56 -2
  39. package/dist/checkout-engine/receipt.js +55 -16
  40. package/dist/checkout-engine/shopify-primary-domain.d.ts +25 -0
  41. package/dist/checkout-engine/shopify-primary-domain.js +96 -0
  42. package/dist/checkout-engine/trace-handles.d.ts +8 -0
  43. package/dist/checkout-engine/trace-handles.js +12 -0
  44. package/dist/checkout-engine/types.d.ts +15 -2
  45. package/dist/checkout-engine/unresolved-charges.d.ts +34 -0
  46. package/dist/checkout-engine/unresolved-charges.js +134 -0
  47. package/dist/checkout-engine/vgs-gateway/server-mint-client.d.ts +26 -7
  48. package/dist/checkout-engine/vgs-gateway/server-mint-client.js +43 -3
  49. package/dist/checkout-engine/vgs-live-instrument.d.ts +11 -35
  50. package/dist/checkout-engine/vgs-live-instrument.js +14 -74
  51. package/dist/checkout-engine/vic-confirmation.d.ts +18 -0
  52. package/dist/checkout-engine/vic-confirmation.js +9 -3
  53. package/dist/checkout-engine/web-bot-auth.d.ts +98 -0
  54. package/dist/checkout-engine/web-bot-auth.js +218 -0
  55. package/dist/cli.js +899 -387
  56. package/dist/mcp-apps/ucp-checkout.html +280 -0
  57. package/dist/mcp-server/index.js +725 -254
  58. package/dist/merchant-ucp-mcp/index.js +6 -0
  59. package/dist/skills/pair-visa-agent/RUNTIMES.md +122 -79
  60. package/dist/skills/pair-visa-agent/SKILL.md +433 -318
  61. package/dist/skills/pair-visa-agent/scripts/__tests__/setup.test.mjs +407 -0
  62. package/dist/skills/pair-visa-agent/scripts/setup.mjs +310 -30
  63. package/dist/skills/visa-shopify-checkout/SKILL.md +122 -0
  64. package/dist/skills/visa-shopify-checkout/references/evidence-and-states.md +37 -0
  65. package/dist/skills/visa-ucp-shopping/SKILL.md +86 -0
  66. package/dist/subway-direct.mjs +1 -0
  67. package/install.ps1 +7 -6
  68. package/install.sh +3 -3
  69. package/native/bin/win32-x64/visa-keychain-win.exe +0 -0
  70. package/package.json +31 -28
  71. package/server.json +4 -4
  72. package/dist/checkout-engine/inline-target.d.ts +0 -13
  73. package/dist/checkout-engine/inline-target.js +0 -37
  74. package/dist/checkout-engine/pay-args.d.ts +0 -14
  75. package/dist/checkout-engine/pay-args.js +0 -44
  76. package/dist/checkout-engine/pay.d.ts +0 -1
  77. package/dist/checkout-engine/pay.js +0 -13
  78. package/dist/checkout-engine/repo-env.d.ts +0 -11
  79. package/dist/checkout-engine/repo-env.js +0 -23
  80. package/dist/checkout-engine/run-live-fill.d.ts +0 -1
  81. package/dist/checkout-engine/run-live-fill.js +0 -493
  82. package/dist/checkout-engine/vgs-gateway/fetch-credential.d.mts +0 -74
  83. package/dist/checkout-engine/vgs-gateway/fetch-credential.mjs +0 -248
@@ -1,79 +1,122 @@
1
- # Running the Visa pairing skill in OpenClaw **and** Hermes
2
-
3
- `@visa/visa-cli-openclaw` is packaged for OpenClaw, but the v4 **pairing** capability
4
- (`skills/pair-visa-agent/`) is deliberately runtime-agnostic: one skill works in OpenClaw,
5
- [Hermes](https://github.com/NousResearch/hermes-agent), or any runtime that can run the
6
- `visa` CLI or mount its MCP server. This doc is the map of how the two runtimes differ and
7
- why a single skill suffices.
8
-
9
- ## The blunt fact: plugins are NOT portable
10
-
11
- | Axis | OpenClaw | Hermes (NousResearch) |
12
- | --------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
13
- | Language | **JavaScript/TypeScript** | **Python** |
14
- | Plugin manifest | `openclaw.plugin.json` + `definePluginEntry` (`index.ts`) | `~/.hermes/plugins/<name>/plugin.yaml` + `__init__.py`, `ctx.register_tool(...)` |
15
- | Config file | `~/.openclaw/openclaw.json` | `~/.hermes/config.yaml` |
16
- | Skills | markdown `SKILL.md` (+ optional UV scripts) | markdown `~/.hermes/skills/<name>/` (agent-authored + curated Skills Hub) |
17
- | MCP | `openclaw.json` `mcp.servers.*` | `config.yaml` → `mcp_servers.*` |
18
- | Persona | `SOUL.md` | `SOUL.md` |
19
- | Migration | — | `hermes claw migrate` (v0.3.0+): imports SOUL, memory, **skills `~/.hermes/skills/openclaw-imports/`**, allowlists, and **MCP servers** |
20
-
21
- You cannot ship one plugin binary for both — the OpenClaw JS `pair_agent_*` tools in this
22
- package do not load in Hermes. **Do not try.**
23
-
24
- ## What IS portable: markdown skills + MCP
25
-
26
- Both runtimes (a) read markdown skills natively and (b) mount MCP servers via an
27
- equivalent config block (`mcp.servers.*` `mcp_servers.*`, same `command`/`args`/`env`,
28
- same tool include/exclude). So the cross-runtime bridge is:
29
-
30
- 1. **The `visa` CLI** `visa agent enroll|enroll-claim --format json` (piped, load-bearing
31
- exit codes). Any runtime that can execute a command can pair.
32
- 2. **The `visa` MCP server** the bundled `dist/mcp-server/index.js` entrypoint (there is
33
- **no `visa mcp` subcommand**; `visa-cli connect <client>` registers it, or configure it
34
- by hand). Mount it identically in either runtime:
35
-
36
- **OpenClaw** (`~/.openclaw/openclaw.json`):
37
-
38
- ```json
39
- {
40
- "mcp": {
41
- "servers": {
42
- "visa-cli": {
43
- "command": "node",
44
- "args": ["<npm root -g>/@visa/cli/dist/mcp-server/index.js"]
45
- }
46
- }
47
- }
48
- }
49
- ```
50
-
51
- **Hermes** (`~/.hermes/config.yaml`):
52
-
53
- ```yaml
54
- mcp_servers:
55
- visa-cli:
56
- command: node
57
- args: ['<npm root -g>/@visa/cli/dist/mcp-server/index.js']
58
- ```
59
-
60
- 3. **One `pair-visa-agent/SKILL.md`** — runtime-agnostic. It tells the agent to use
61
- whichever pairing surface is present (`pair_agent_*` OpenClaw tools → `enroll_agent`
62
- MCP tool → raw `visa agent …` CLI), all wrapping the same on-device hand-off.
63
-
64
- ## So: how each runtime gets the capability
65
-
66
- | Runtime | How it pairs |
67
- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
68
- | **OpenClaw** | Install this package → the JS `pair_agent_start`/`pair_agent_poll` tools + the skill. (Or just the `visa` MCP server + the skill, no plugin.) |
69
- | **Hermes** | Mount the `visa` MCP server in `config.yaml` (→ `enroll_agent`) and drop `pair-visa-agent/SKILL.md` into `~/.hermes/skills/`. `hermes claw migrate` will also import the skill from an existing OpenClaw install. No Python plugin required. |
70
- | **Anything else** | `visa` on PATH + the skill. The skill's raw-CLI path is the universal fallback. |
71
-
72
- ## Optional: a symmetric Hermes plugin
73
-
74
- Not required Hermes users get the full capability via the MCP server + skill above. If
75
- you want the _same named tools_ (`pair_agent_start`/`pair_agent_poll`) in Hermes, a thin
76
- `~/.hermes/plugins/visa-cli/` Python plugin (`plugin.yaml` + `__init__.py`) that shells out
77
- to `visa agent enroll|enroll-claim --format json` and registers the tools via
78
- `ctx.register_tool(...)` would mirror the OpenClaw plugin. Tracked as a fast-follow; the
79
- CLI + MCP + skill already make pairing "just work" in Hermes.
1
+ # Running Visa agent setup in OpenClaw and Hermes
2
+
3
+ `@visa/visa-cli-openclaw` is packaged for OpenClaw, but the skill is runtime-agnostic.
4
+ OpenClaw, Hermes, and any runtime that can execute the `visa` CLI or mount its MCP server
5
+ all drive the same setup operation: identity plus every requested rail, behind one owner
6
+ approval.
7
+
8
+ ## Plugins are runtime-specific
9
+
10
+ | Axis | OpenClaw | Hermes |
11
+ | --------------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
12
+ | Language | JavaScript/TypeScript | Python |
13
+ | Plugin manifest | `openclaw.plugin.json` + `definePluginEntry` (`index.ts`) | `~/.hermes/plugins/<name>/plugin.yaml` + `__init__.py`, `ctx.register_tool(...)` |
14
+ | Config file | `~/.openclaw/openclaw.json` | `~/.hermes/config.yaml` |
15
+ | Skills | Markdown `SKILL.md` | Markdown under `~/.hermes/skills/<name>/` |
16
+ | MCP | `mcp.servers.*` | `mcp_servers.*` |
17
+ | Migration | — | `hermes claw migrate` imports skills, allowlists, compatible MCP servers, memory, and `SOUL.md` |
18
+
19
+ The OpenClaw JavaScript tools do not load as a Hermes plugin. Portability comes from the
20
+ Markdown skill, CLI, and MCP protocol instead.
21
+
22
+ ## One ceremony, two surfaces
23
+
24
+ Both supported surfaces share the same local pending record and the same server-owned
25
+ setup operation:
26
+
27
+ 1. Visa MCP server: `setup_start`, then `setup_status` until it reports done
28
+ (`setup_resume` / `setup_cancel` for the interrupted and abandoned cases).
29
+ 2. Raw CLI: `visa setup start "<name>" --rails card,wallet --format json`, then
30
+ `visa setup status --format json`.
31
+
32
+ The start operation returns a review URL for the human. The browser receives only that
33
+ URL. The runtime retains its private Ed25519 key and local claim material. Polling both
34
+ resumes the same pending identity after an interruption and performs the runtime's own
35
+ steps — a setup nothing polls is a setup that never finishes.
36
+
37
+ Use `agentId` as the stable identity. `identityKeyJkt` identifies the currently bound
38
+ Ed25519 public key and can change after key rotation. Only the rails named in the
39
+ operation are configured; email, `.visa` names, and tap bindings remain separate
40
+ follow-up configuration.
41
+
42
+ The older `pair_agent_start` / `pair_agent_poll` and `enroll_agent` surfaces still exist
43
+ for published clients, but they pair identity ALONE and cost the owner one further
44
+ approval per rail. Do not use them to connect a new agent.
45
+
46
+ ## Install and mount
47
+
48
+ Install the prerelease CLI, which provides both command names and the MCP server:
49
+
50
+ ```sh
51
+ npm install -g @visa/cli@rc
52
+ ```
53
+
54
+ There is no `visa mcp` subcommand. Run `visa-cli connect <runtime>` when supported, or
55
+ configure `@visa/cli/dist/mcp-server/index.js` directly. Replace `<npm root -g>` below
56
+ with the output of `npm root -g`.
57
+
58
+ OpenClaw (`~/.openclaw/openclaw.json`):
59
+
60
+ ```json
61
+ {
62
+ "mcp": {
63
+ "servers": {
64
+ "visa-cli": {
65
+ "command": "node",
66
+ "args": ["<npm root -g>/@visa/cli/dist/mcp-server/index.js"]
67
+ }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ Hermes (`~/.hermes/config.yaml`). Hermes passes a filtered platform-safe baseline
74
+ (`PATH`, `HOME`, platform variables, and `XDG_*`) plus this server's `env:` map.
75
+ Arbitrary gateway variables are excluded, so map `VISA_RC_CODE` explicitly. The
76
+ placeholder keeps its value in `~/.hermes/.env` instead of `config.yaml`:
77
+
78
+ ```yaml
79
+ mcp_servers:
80
+ visa-cli:
81
+ command: node
82
+ args: ['<npm root -g>/@visa/cli/dist/mcp-server/index.js']
83
+ env:
84
+ VISA_RC_CODE: ${VISA_RC_CODE}
85
+ # Optional overrides for a different state directory or toolchain:
86
+ # HOME: /home/<user>
87
+ # PATH: /usr/local/bin:/usr/bin:/bin
88
+ ```
89
+
90
+ ### Keep one local-state namespace
91
+
92
+ The gateway shell and the Visa MCP subprocess must resolve the same `HOME` and
93
+ `VISA_CLI_HOME`. Set that boundary before pairing and keep it stable. Changing
94
+ `VISA_CLI_HOME` later also changes where paired identity and grant records are
95
+ read; it is not a safe way to make an old contact file visible.
96
+
97
+ For example, with `HOME=/opt/data/home` and no `VISA_CLI_HOME`, identity lives
98
+ under `/opt/data/home/.visa-cli` and checkout contact under
99
+ `/opt/data/home/.visa-mcp`. A profile at `/opt/data/.visa-mcp` belongs to a
100
+ different state namespace. Do not scan, copy, or auto-adopt it: contact files
101
+ contain owner PII. Save the profile explicitly through `checkout_profile` in
102
+ the running MCP process, or run the CLI command with the exact same environment.
103
+ `visa agent preflight --format json` reports the non-secret path and source it
104
+ checked.
105
+
106
+ ## Runtime setup map
107
+
108
+ | Runtime | Setup surface |
109
+ | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
110
+ | OpenClaw | Install `@visa/visa-cli-openclaw` for the bundled skill. The plugin auto-mounts the Visa MCP server, which serves `setup_start` / `setup_status`. |
111
+ | Hermes | Run `visa-cli connect hermes`, install the skill with `visa agent skill --runtime hermes` (it resolves the per-profile dir), and use `setup_start`. `hermes claw migrate` can import an existing OpenClaw setup. |
112
+ | Codex | Run `visa agent skill --runtime codex`. It plants the skill under `~/.codex/skills/` and mounts the Visa MCP server into `~/.codex/config.toml` in the same step. |
113
+ | Other runtime | Put `visa` on `PATH`, mount the same MCP server if supported, or use the raw `visa setup start` and `visa setup status` commands as the universal fallback. |
114
+
115
+ The skill itself can be installed with `visa agent skill`. Pass `--runtime <name>` or
116
+ `--dir <path>` when auto-detection is not appropriate, then reload the runtime.
117
+
118
+ ## Optional Hermes wrapper
119
+
120
+ A Hermes Python plugin may wrap the canonical raw CLI commands and register tools with
121
+ `ctx.register_tool(...)`. It is optional: the MCP server and skill already expose the
122
+ same operation and persisted local state without a second implementation.