lane-sdk 0.1.8 → 0.1.9

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 (55) hide show
  1. package/SKILL.md +238 -18
  2. package/dist/adapters/crewai/index.cjs +436 -24
  3. package/dist/adapters/crewai/index.cjs.map +1 -1
  4. package/dist/adapters/crewai/index.d.cts +1 -1
  5. package/dist/adapters/crewai/index.d.ts +1 -1
  6. package/dist/adapters/crewai/index.js +436 -24
  7. package/dist/adapters/crewai/index.js.map +1 -1
  8. package/dist/adapters/langchain/index.cjs +436 -24
  9. package/dist/adapters/langchain/index.cjs.map +1 -1
  10. package/dist/adapters/langchain/index.d.cts +1 -1
  11. package/dist/adapters/langchain/index.d.ts +1 -1
  12. package/dist/adapters/langchain/index.js +436 -24
  13. package/dist/adapters/langchain/index.js.map +1 -1
  14. package/dist/adapters/openai/index.cjs +436 -24
  15. package/dist/adapters/openai/index.cjs.map +1 -1
  16. package/dist/adapters/openai/index.d.cts +1 -1
  17. package/dist/adapters/openai/index.d.ts +1 -1
  18. package/dist/adapters/openai/index.js +436 -24
  19. package/dist/adapters/openai/index.js.map +1 -1
  20. package/dist/adapters/vercel-ai/index.cjs +436 -24
  21. package/dist/adapters/vercel-ai/index.cjs.map +1 -1
  22. package/dist/adapters/vercel-ai/index.d.cts +1 -1
  23. package/dist/adapters/vercel-ai/index.d.ts +1 -1
  24. package/dist/adapters/vercel-ai/index.js +436 -24
  25. package/dist/adapters/vercel-ai/index.js.map +1 -1
  26. package/dist/cli/index.js +4900 -283
  27. package/dist/cli/index.js.map +1 -1
  28. package/dist/cli/postinstall.js +1 -0
  29. package/dist/cli/postinstall.js.map +1 -1
  30. package/dist/index.cjs +457 -25
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +48 -3
  33. package/dist/index.d.ts +48 -3
  34. package/dist/index.js +455 -26
  35. package/dist/index.js.map +1 -1
  36. package/dist/{lane-DcrwjgWf.d.cts → lane-mzNZj0DM.d.cts} +47 -2
  37. package/dist/{lane-DcrwjgWf.d.ts → lane-mzNZj0DM.d.ts} +47 -2
  38. package/dist/server/index.cjs +8088 -0
  39. package/dist/server/index.cjs.map +1 -0
  40. package/dist/server/index.js +204 -5
  41. package/dist/server/index.js.map +1 -1
  42. package/dist/server/routes/export.cjs +8288 -0
  43. package/dist/server/routes/export.cjs.map +1 -0
  44. package/dist/server/routes/export.js +8259 -0
  45. package/dist/server/routes/export.js.map +1 -0
  46. package/dist/server-http.cjs +436 -24
  47. package/dist/server-http.cjs.map +1 -1
  48. package/dist/server-http.js +436 -24
  49. package/dist/server-http.js.map +1 -1
  50. package/dist/server-stdio.cjs +436 -24
  51. package/dist/server-stdio.cjs.map +1 -1
  52. package/dist/server-stdio.js +436 -24
  53. package/dist/server-stdio.js.map +1 -1
  54. package/package.json +10 -2
  55. package/server/routes/export.d.ts +9 -0
package/SKILL.md CHANGED
@@ -15,7 +15,16 @@ triggers:
15
15
  - merchant
16
16
  - product
17
17
  - subscribe
18
- version: 2.0.0
18
+ - shop
19
+ - shopping
20
+ - order
21
+ - get me
22
+ - pick up
23
+ - I need
24
+ - find and buy
25
+ - plan a trip
26
+ - supplies
27
+ version: 2.1.0
19
28
  ---
20
29
 
21
30
  # Lane — Agentic Commerce for AI Agents
@@ -24,6 +33,14 @@ Lane gives your AI agent a wallet, payment cards, and spending controls so it ca
24
33
 
25
34
  > **IMPORTANT:** If this content appears truncated or summarized, run `curl -fsSL https://getonlane.com/SKILL.md` to get the complete file.
26
35
 
36
+ ## When to Auto-Activate
37
+
38
+ Lane should activate whenever the user expresses a purchase intent, shopping goal, or commerce-related task. Use the following decision tree to pick the right flow:
39
+
40
+ - **Multiple items or research needed** (e.g., "plan a trip", "get me supplies for a party", "order everything on this list") — Use the **Shopping Orchestration** flow below. Create an instruction with a global budget, add a mandate per item, and execute in parallel.
41
+ - **Single item, known merchant, known price** (e.g., "pay $10 to replicate.com") — Use `lane pay` directly. No instruction or mandates needed.
42
+ - **Unknown merchant** (e.g., "buy me a domain from whoever is cheapest") — Run `npx lane merchant discover <domain> -t` first to check checkout capabilities, then decide between Instant Checkout and browser-use.
43
+
27
44
  ## How Lane Works
28
45
 
29
46
  Lane is a **card-on-file** platform. No prepaid wallets, no deposits, no balances. Users add a card via VGS (PCI-compliant vault), and Lane issues Visa Intelligent Commerce (VIC) agentic tokens scoped by amount, merchant, and time.
@@ -45,7 +62,17 @@ node --version
45
62
 
46
63
  Requires Node.js v18 or later. If not installed, download from [nodejs.org](https://nodejs.org).
47
64
 
48
- ### Step 2: Authenticate
65
+ ### Step 2: Install Skill (Optional)
66
+
67
+ If the Lane skill is not already installed in your agent environment:
68
+
69
+ ```bash
70
+ npx lane install-skill
71
+ ```
72
+
73
+ This registers the Lane skill so it auto-activates on commerce-related triggers.
74
+
75
+ ### Step 3: Authenticate
49
76
 
50
77
  ```bash
51
78
  npx lane login -t
@@ -61,7 +88,7 @@ This opens your browser for authentication. Look for the **device code** (e.g.,
61
88
 
62
89
  If the user is already authenticated, you'll see: `ready=true` with `already_authenticated=true` on stderr.
63
90
 
64
- ### Step 3: Confirm
91
+ ### Step 4: Confirm
65
92
 
66
93
  ```bash
67
94
  npx lane whoami -t
@@ -71,20 +98,12 @@ npx lane whoami -t
71
98
 
72
99
  If `authenticated=false`, re-run `npx lane login -t`.
73
100
 
74
- ## After Setup
101
+ ## Your Current Status
75
102
 
76
- Report the user's status and suggest what they can do:
103
+ - Account: !`npx lane whoami -t 2>/dev/null || echo "authenticated=false"`
104
+ - Readiness: !`npx lane status -t 2>/dev/null || echo "ready=false"`
77
105
 
78
- ```bash
79
- npx lane status -t
80
- ```
81
-
82
- This returns a full readiness check:
83
- - `ready=true/false` — overall readiness
84
- - `email`, `plan`, `mode` — account info
85
- - `wallet_id` — wallet state
86
- - `has_card` — whether a payment card is linked (card-on-file)
87
- - `next_step` — what to do next (`add_card` or `none`)
106
+ If `ready=false` or `authenticated=false`, guide the user through setup above before proceeding.
88
107
 
89
108
  **Starter prompts to suggest:**
90
109
  - "Search for cloud hosting products"
@@ -114,6 +133,16 @@ npx lane merchant discover <domain> -t
114
133
 
115
134
  Checks if a domain supports ACP, UCP, or x402 protocols. If found, you can use Lane Instant Checkout. If not, use browser-use with VIC credentials.
116
135
 
136
+ ### Batch Merchant Discovery
137
+
138
+ When you need to check multiple domains at once (common during the Research phase of shopping), use batch mode:
139
+
140
+ ```bash
141
+ npx lane batch -t
142
+ ```
143
+
144
+ This runs parallel merchant discovery across multiple domains simultaneously, returning results for all in a single call. Much faster than sequential `merchant discover` calls when researching several merchants.
145
+
117
146
  ### List Merchant Verticals
118
147
 
119
148
  ```bash
@@ -157,6 +186,8 @@ npx lane pay --amount <dollars> --recipient <merchant> -t [--test] [--dry-run]
157
186
 
158
187
  **Always confirm with the user before executing a payment.** Show the amount, recipient, and currency, and wait for explicit approval.
159
188
 
189
+ > **Biometric verification** is now required before payment execution. The CLI prompts automatically (Touch ID → macOS password → passkey → PIN). No additional flags needed.
190
+
160
191
  ### Provision VIC Credentials (for Browser-Use Checkout)
161
192
 
162
193
  ```bash
@@ -165,7 +196,11 @@ npx lane pay --amount <dollars> --recipient <merchant> --provision -t
165
196
 
166
197
  Returns a DPAN (Visa network token) + single-use cryptogram that can be used at **any Visa-accepting merchant's checkout**. Use this when the merchant doesn't support Lane Instant Checkout.
167
198
 
168
- **Output:** `token_id=<id> dpan_last4=<last4> cryptogram=<masked> eci=05 expires_at=<iso>`
199
+ > **Biometric verification** is required before provisioning. The CLI prompts automatically. Use `--skip-biometric` in test mode only (`--test --skip-biometric`).
200
+
201
+ **Output:** `token_id=<id> dpan_last4=<last4> cryptogram=•••••••• eci=05 expires_at=<iso>`
202
+
203
+ Credentials are masked in terminal output — only the last 4 digits of the DPAN are shown, and the cryptogram is fully masked. Full credentials are available programmatically via the SDK.
169
204
 
170
205
  ### Checkout from Catalog
171
206
 
@@ -175,6 +210,122 @@ npx lane checkout --product <product_id> -t [--plan <plan_id>] [--dry-run]
175
210
 
176
211
  For software subscriptions, the output includes `api_key` and `endpoint`.
177
212
 
213
+ ## Shopping Orchestration (Multi-Item Purchases)
214
+
215
+ When the user needs to buy multiple items, plan a trip, stock up on supplies, or any task that requires researching and purchasing across multiple merchants, use the shopping orchestration flow. This creates a single instruction with a global budget and individual mandates per item.
216
+
217
+ ### Phase 1: Decompose (Plan Mode)
218
+
219
+ Break the user's prompt into a structured plan:
220
+
221
+ - **Global budget** — Extract the dollar amount from the user's intent (e.g., "under $900" becomes a $900 budget).
222
+ - **Line items** — Decompose the goal into individual items to purchase.
223
+ - For each item: name, estimated price range, max price (leave ~15% headroom for taxes/fees).
224
+
225
+ Present the plan to the user for approval before proceeding.
226
+
227
+ ### Phase 2: Research (Parallel Agents)
228
+
229
+ After plan approval, fan out **one agent per item** in parallel. Each agent should:
230
+
231
+ 1. `npx lane product search "<item name>" -t` — Find matching products in the Lane catalog.
232
+ 2. `npx lane merchant list -t --vertical <relevant>` — Find merchants in relevant verticals.
233
+ 3. `npx lane merchant discover <domain> -t` — Check checkout capability for candidate merchants.
234
+ 4. Report back: best product match, price, merchant, and protocol support.
235
+
236
+ Use `npx lane batch -t` for parallel merchant discovery when checking multiple domains.
237
+
238
+ ### Phase 3: Create Instruction + Mandates
239
+
240
+ After research completes, create the Lane primitives:
241
+
242
+ 1. **Create the instruction** (global budget):
243
+ ```bash
244
+ npx lane instruction create -t --wallet-id <id> --amount <budget_cents> --expires-in 7d
245
+ ```
246
+
247
+ 2. **Add a mandate for each item:**
248
+ ```bash
249
+ npx lane instruction mandate add <instruction_id> -t \
250
+ --type purchase \
251
+ --config '{"maxAmount":<max_cents>,"allowedMerchants":["<domain>"],"purposeDescription":"<item>"}'
252
+ ```
253
+
254
+ 3. Display the instruction with all mandates and a budget breakdown for user confirmation.
255
+
256
+ ### Phase 4: Execute (Parallel Agents)
257
+
258
+ Fan out **one agent per mandate** to execute purchases in parallel:
259
+
260
+ Each agent:
261
+ 1. **Biometric confirmation:** The CLI prompts automatically before credential retrieval. A single confirmation is valid for 60 seconds — if executing multiple mandates in rapid succession, one verification covers them all.
262
+ 2. Get credential: `npx lane instruction credential <instruction_id> -t`
263
+ 3. Execute checkout via Lane Instant Checkout or use VIC credentials at the merchant.
264
+ 4. Confirm: `npx lane instruction confirmation create <instruction_id> -t`
265
+
266
+ ### Shopping Budget Rules
267
+
268
+ - Never exceed the global instruction budget.
269
+ - Never exceed any individual mandate's `maxAmount`.
270
+ - If an item costs more than its mandate allows, report it to the user — do not split or work around.
271
+ - Track the running total: after each purchase, report spent vs. remaining.
272
+ - If remaining budget is insufficient for the next item, skip it and report.
273
+
274
+ ## Session Management
275
+
276
+ For structured shopping sessions with built-in budget tracking, use the `session` commands:
277
+
278
+ ### Active Session
279
+
280
+ !`npx lane session snapshot -t 2>/dev/null || echo "no_active_session=true"`
281
+
282
+ If `no_active_session=true`, create one with `npx lane session create`. Otherwise, use the session state above to track budget and mandates.
283
+
284
+ ### Create a Session
285
+
286
+ ```bash
287
+ npx lane session create --budget <cents> --expires-in <duration> -t
288
+ ```
289
+
290
+ Creates a new shopping session with a global budget ceiling and expiration. Returns a `session_id` used for all subsequent session operations.
291
+
292
+ ### Add Items to a Session
293
+
294
+ ```bash
295
+ npx lane session add-item <session_id> --purpose "<item>" --max <cents> --merchants <domains> -t
296
+ ```
297
+
298
+ Adds a line item to the session with a per-item budget cap and optional merchant restrictions.
299
+
300
+ ### View Session Snapshot
301
+
302
+ ```bash
303
+ npx lane session snapshot -t
304
+ ```
305
+
306
+ Shows the current session state: all items, per-item spend, remaining budget, and execution status.
307
+
308
+ ## Browser Integration
309
+
310
+ When a merchant does not support Lane Instant Checkout (ACP/UCP/x402), the agent must complete checkout through a browser.
311
+
312
+ ### Checkout Bridge
313
+
314
+ Use the `checkout-bridge` command to initiate a browser-based checkout:
315
+
316
+ ```bash
317
+ npx lane checkout-bridge -t
318
+ ```
319
+
320
+ This provisions VIC credentials and prepares the checkout session.
321
+
322
+ ### Checkout Modes
323
+
324
+ When a checkout returns `checkout_mode=browser`:
325
+
326
+ 1. **If agent-browser / Playwright MCP is available** — The agent should use the browser automation tool to navigate to the checkout URL, fill in the VIC credentials (DPAN, expiry, cryptogram), and complete the purchase programmatically.
327
+ 2. **If no browser automation is available** — Present the checkout URL to the user along with the masked VIC credentials and ask them to complete the purchase manually. Never display the full unmasked DPAN or cryptogram to the user; show only the last 4 digits and instruct them to copy from the secure session.
328
+
178
329
  ## Manage Cards
179
330
 
180
331
  ### List Cards
@@ -243,8 +394,72 @@ Creates a VIC instruction — a standing authorization for a specific purchase s
243
394
  npx lane instruction list -t [--limit <n>]
244
395
  ```
245
396
 
397
+ ## Biometric Confirmation
398
+
399
+ All payments and credential retrievals now require biometric verification before execution. This prevents unauthorized agent spending even if credentials are compromised.
400
+
401
+ ### How It Works
402
+
403
+ Lane uses a 4-tier fallback chain to verify the user's identity:
404
+
405
+ 1. **Touch ID** (macOS) — Fingerprint via the system biometric sensor
406
+ 2. **macOS System Password** — System password dialog if Touch ID is unavailable
407
+ 3. **WebAuthn Passkey** — Opens a browser for passkey verification
408
+ 4. **CLI PIN** — Manual 4+ digit PIN entry as a last resort
409
+
410
+ The CLI prompts automatically — no flags or extra commands needed. The first available method in the chain is used.
411
+
412
+ ### Confirmation Reuse Window
413
+
414
+ A biometric confirmation is valid for **60 seconds**. Multiple payments or credential retrievals within that window reuse the same verification — the user is not prompted again.
415
+
416
+ ### Per-Environment Usage
417
+
418
+ **CLI:** Biometric prompts automatically before `lane pay` or `lane pay --provision`. No action needed from the agent.
419
+
420
+ ```bash
421
+ # Biometric prompt happens automatically before execution
422
+ npx lane pay --amount 10 --recipient anthropic.com -t
423
+ ```
424
+
425
+ **MCP:** Use the `confirm_instruction` tool before `pay` or `provision_payment`:
426
+
427
+ ```
428
+ confirm_instruction → { instructionId: "inst_..." }
429
+ # Returns: confirmed=true method=touchid validForSeconds=60
430
+ # Then call pay or provision_payment within the 60-second window
431
+ ```
432
+
433
+ **SDK:**
434
+
435
+ ```typescript
436
+ import Lane, { requireBiometricConfirmation } from 'lane'
437
+
438
+ const lane = await Lane.create()
439
+ const instruction = await lane.instructions.create({ walletId, amount: 2500 })
440
+
441
+ // Biometric verification before credential retrieval
442
+ await requireBiometricConfirmation(lane, instruction.id)
443
+
444
+ const credential = await lane.instructions.getCredential(instruction.id)
445
+ ```
446
+
447
+ ### Test Mode
448
+
449
+ Use `--skip-biometric` with `--test` to bypass verification in test mode only:
450
+
451
+ ```bash
452
+ npx lane pay --amount 5 --recipient test.com --skip-biometric --test -t
453
+ ```
454
+
455
+ This flag is ignored in live mode — biometric verification cannot be bypassed in production.
456
+
246
457
  ## Budget Controls
247
458
 
459
+ ### Your Current Budget
460
+
461
+ !`npx lane budget get -t 2>/dev/null || echo "budget=not_set"`
462
+
248
463
  ### View Budget
249
464
 
250
465
  ```bash
@@ -286,7 +501,7 @@ npx lane transaction refund <txn_id> -t [--amount <cents>] [--reason <text>]
286
501
  If you're building an agent app, use the Lane SDK instead of the CLI:
287
502
 
288
503
  ```typescript
289
- import Lane from 'lane'
504
+ import Lane, { requireBiometricConfirmation } from 'lane'
290
505
 
291
506
  const lane = await Lane.create()
292
507
 
@@ -308,6 +523,9 @@ const instruction = await lane.instructions.create({
308
523
  merchant: 'Legendary SaaS',
309
524
  })
310
525
 
526
+ // Biometric verification before credential retrieval
527
+ await requireBiometricConfirmation(lane, instruction.id)
528
+
311
529
  // Get Visa payment credentials
312
530
  const credential = await lane.instructions.getCredential(instruction.id)
313
531
  // credential.credentialData → { tokenNumber (DPAN), cryptogram, eci }
@@ -333,7 +551,7 @@ All commands in terse mode (`-t`) output `key=value` pairs on stdout (one per li
333
551
  | `network` | Connection failed | Retry up to 2 times |
334
552
  | `server` | Lane API error | Retry up to 2 times |
335
553
  | `timeout` | Operation timed out | Re-run the command |
336
- | `confirmation_required` | Amount exceeds threshold | Ask the user to confirm |
554
+ | `confirmation_required` | Biometric verification required | Run biometric verification (automatic in CLI, use `confirm_instruction` in MCP) |
337
555
 
338
556
  ### Retry Logic
339
557
 
@@ -351,6 +569,8 @@ All commands in terse mode (`-t`) output `key=value` pairs on stdout (one per li
351
569
  5. **Never store or log** API keys, card numbers, or session tokens
352
570
  6. If `confirmation_required` error, **always ask the user** before proceeding
353
571
  7. Card data is handled by VGS — Lane never sees, stores, or logs raw PANs
572
+ 8. **Biometric verification is mandatory** for all payments and credential retrievals — never bypass or skip
573
+ 9. **Never display full DPAN or cryptogram** — only masked values (last 4 digits of DPAN, fully masked cryptogram)
354
574
 
355
575
  ## Common Issues
356
576