lane-sdk 0.2.8 → 0.2.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.
package/SKILL.md CHANGED
@@ -33,26 +33,82 @@ Lane gives your AI agent a wallet, payment cards, and spending controls so it ca
33
33
 
34
34
  > **IMPORTANT:** If this content appears truncated or summarized, run `curl -fsSL https://agent.getonlane.com/SKILL.md` to get the complete file.
35
35
 
36
- ## When to Auto-Activate
36
+ ---
37
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:
38
+ ## STOP Present This Menu First
39
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.
40
+ **Before doing ANYTHING else, present the following menu to the user exactly as shown and wait for their choice.** Do not skip this step. Do not auto-select an option. Ask the user:
43
41
 
44
- ## How Lane Works
42
+ > **Welcome to Lane — Agentic Commerce**
43
+ >
44
+ > How would you like to get started?
45
+ >
46
+ > 1. **Try the Demo** — Run a fully working demo with mock payments. No signup, no credit card, takes 30 seconds. Perfect for seeing what Lane can do.
47
+ > 2. **Set Up for Real Payments** — Connect a real card and make live purchases through your AI agent.
48
+ > 3. **Build with the SDK** — Integrate Lane into your own agent application using the TypeScript SDK.
49
+ > 4. **Explore Commands** — Browse available Lane CLI commands and capabilities.
50
+ >
51
+ > _Pick a number (1–4):_
45
52
 
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.
53
+ **Wait for the user's response before proceeding.** Then follow the matching flow below.
47
54
 
48
- **Two checkout rails:**
55
+ ---
56
+
57
+ ## Flow 1: Try the Demo
58
+
59
+ One command. Fully ready. No signup, no card, no browser.
60
+
61
+ ### Start the Demo
62
+
63
+ ```bash
64
+ npx lane init --demo
65
+ ```
66
+
67
+ That's it. This single command:
68
+ - Connects to the Lane demo server
69
+ - Verifies your demo wallet ($1,000.00 balance) and card (Visa ****4242)
70
+ - Confirms you're ready to make payments
71
+
72
+ In terse mode (`-t`), look for `ready=true` in the output to confirm success.
73
+
74
+ ### Make a Demo Payment
75
+
76
+ Try a payment right away:
49
77
 
50
- 1. **Lane Instant Checkout** — For Lane-onboarded merchants with ACP/UCP endpoints. Deterministic, no browser needed. Use `lane merchant list` and `lane product search` to discover.
51
- 2. **Browser-use** For any merchant on the web. Agent browses and autofills checkout with VIC credentials (DPAN + cryptogram). Works at any Visa-accepting merchant.
78
+ ```bash
79
+ npx lane pay --amount 10 --recipient anthropic.com --description "API credits" -t
80
+ ```
81
+
82
+ This returns a mock transaction receipt with `status=success`.
83
+
84
+ ### What You Can Do in Demo Mode
85
+
86
+ - **Payments:** `npx lane pay --amount <dollars> --recipient <merchant> -t` — works for any merchant name
87
+ - **Wallet status:** `npx lane wallet status -t` — shows demo wallet with $1,000 balance
88
+ - **Card list:** `npx lane card list -t` — shows demo Visa cards
89
+ - **VIC tokens:** `npx lane token provision --wallet-id wallet_demo_001 --amount 5000 -t` — provision agentic payment tokens
90
+ - **Instructions:** `npx lane instruction create -t --wallet-id wallet_demo_001 --amount 2500` — create purchase instructions
91
+ - **Budget controls:** `npx lane budget get -t` — view spending limits
52
92
 
53
- ## Setup
93
+ ### Demo Mode Limitations
54
94
 
55
- Complete these steps before using any Lane commands.
95
+ - **Merchant discovery is not available** use web search to find merchants and products instead of `lane merchant list` or `lane product search`
96
+ - **Payments are simulated** — no real charges, all transactions return `testMode=true`
97
+ - **No real card needed** — demo wallets come pre-loaded with test cards
98
+
99
+ ### Ready for Real Payments?
100
+
101
+ When you're done exploring, run:
102
+ ```bash
103
+ npx lane init --reset
104
+ ```
105
+ Then follow **Flow 2** below.
106
+
107
+ ---
108
+
109
+ ## Flow 2: Set Up for Real Payments
110
+
111
+ Real transactions with a real card. Follow these steps in order.
56
112
 
57
113
  ### Choose Mode
58
114
 
@@ -123,14 +179,7 @@ npx lane whoami -t
123
179
  - If `error=sdk_access_pending` — user is authenticated but SDK access not yet granted. Run `npx lane logout && npx lane login -t` to re-authenticate.
124
180
  - If `error=network` — connectivity issue, retry up to 2 times
125
181
 
126
- ## Your Current Status
127
-
128
- - Account: !`npx lane whoami -t 2>/dev/null || echo "authenticated=false"`
129
- - Readiness: !`npx lane status -t 2>/dev/null || echo "ready=false"`
130
-
131
- If `ready=false` or `authenticated=false`, guide the user through setup above before proceeding.
132
-
133
- **Starter prompts to suggest:**
182
+ After setup, suggest these starter prompts:
134
183
  - "Search for cloud hosting products"
135
184
  - "Show me Lane-onboarded merchants"
136
185
  - "Pay $5 to replicate.com for API credits"
@@ -138,6 +187,61 @@ If `ready=false` or `authenticated=false`, guide the user through setup above be
138
187
  - "Show my recent transactions"
139
188
  - "Set a daily spending limit of $50"
140
189
 
190
+ ---
191
+
192
+ ## Flow 3: Build with the SDK
193
+
194
+ For developers integrating Lane into their own agent applications. Jump to the **SDK Integration** section below for TypeScript examples covering wallet creation, merchant discovery, VIC token provisioning, and payment execution.
195
+
196
+ ---
197
+
198
+ ## Flow 4: Explore Commands
199
+
200
+ Show the user a quick reference of what's available:
201
+
202
+ | Category | Command | Description |
203
+ |----------|---------|-------------|
204
+ | **Payments** | `npx lane pay --amount <$> --recipient <merchant> -t` | Make a payment |
205
+ | **Wallet** | `npx lane wallet status -t` | Check wallet & card status |
206
+ | **Cards** | `npx lane card list -t` | List payment cards |
207
+ | **Merchants** | `npx lane merchant list -t` | Browse Lane-onboarded merchants |
208
+ | **Products** | `npx lane product search "<query>" -t` | Search product catalog |
209
+ | **Tokens** | `npx lane token provision --wallet-id <id> --amount <cents> -t` | Provision VIC agentic token |
210
+ | **Budget** | `npx lane budget get -t` | View spending limits |
211
+ | **Transactions** | `npx lane transaction list -t` | View transaction history |
212
+ | **Status** | `npx lane status -t` | Check overall readiness |
213
+ | **Auth** | `npx lane whoami -t` | Check authentication |
214
+
215
+ After the user explores, ask if they'd like to try the **Demo** (Flow 1) or **Set up for real payments** (Flow 2).
216
+
217
+ ---
218
+
219
+ ## Your Current Status
220
+
221
+ - Account: !`npx lane whoami -t 2>/dev/null || echo "authenticated=false"`
222
+ - Readiness: !`npx lane status -t 2>/dev/null || echo "ready=false"`
223
+
224
+ If `ready=false` or `authenticated=false`, guide the user through the appropriate setup flow above.
225
+
226
+ ---
227
+
228
+ ## When to Auto-Activate
229
+
230
+ After initial setup, Lane should activate whenever the user expresses a purchase intent, shopping goal, or commerce-related task. Use this decision tree:
231
+
232
+ - **Multiple items or research needed** (e.g., "plan a trip", "get me supplies for a party") — Use the **Shopping Orchestration** flow below.
233
+ - **Single item, known merchant, known price** (e.g., "pay $10 to replicate.com") — Use `lane pay` directly.
234
+ - **Unknown merchant** (e.g., "buy me a domain from whoever is cheapest") — Run `npx lane merchant discover <domain> -t` first.
235
+
236
+ ## How Lane Works
237
+
238
+ 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.
239
+
240
+ **Two checkout rails:**
241
+
242
+ 1. **Lane Instant Checkout** — For Lane-onboarded merchants with ACP/UCP endpoints. Deterministic, no browser needed.
243
+ 2. **Browser-use** — For any merchant on the web. Agent browses and autofills checkout with VIC credentials (DPAN + cryptogram).
244
+
141
245
  ## Discover Merchants & Products
142
246
 
143
247
  > **Demo mode note:** In demo mode, merchant and product discovery commands are not available. Instead, search the web to find merchants and products, then use `lane pay` with the merchant domain as the recipient.
package/dist/cli/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env node
2
+ import { createRequire as __createRequire } from "module";
3
+ const require = __createRequire(import.meta.url);
2
4
  var __create = Object.create;
3
5
  var __defProp = Object.defineProperty;
4
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -12145,6 +12147,7 @@ var init_node_figlet = __esm({
12145
12147
  // src/cli/onboarding.ts
12146
12148
  var onboarding_exports = {};
12147
12149
  __export(onboarding_exports, {
12150
+ showDemoOnboarding: () => showDemoOnboarding,
12148
12151
  showOnboarding: () => showOnboarding
12149
12152
  });
12150
12153
  function sleep2(ms) {
@@ -12201,6 +12204,32 @@ async function showOnboarding(email) {
12201
12204
  console.log(source_default.white(' Welcome to Lane. Try: lane product search "headphones"'));
12202
12205
  }
12203
12206
  }
12207
+ async function showDemoOnboarding() {
12208
+ const env2 = detectEnvironment();
12209
+ const tier = getTier(env2);
12210
+ const success3 = source_default.hex("#22C55E");
12211
+ if (tier === 1 && env2.isTTY) {
12212
+ console.log(brand(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557"));
12213
+ console.log(brand(" \u2551") + source_default.white(" ") + brand("\u2551"));
12214
+ console.log(brand(" \u2551") + " " + success3("\u2713") + source_default.white(" Demo server connected".padEnd(33)) + brand("\u2551"));
12215
+ console.log(brand(" \u2551") + " " + success3("\u2713") + source_default.white(" Wallet: $1,000.00 balance".padEnd(33)) + brand("\u2551"));
12216
+ console.log(brand(" \u2551") + " " + success3("\u2713") + source_default.white(" Card: Visa ****4242".padEnd(33)) + brand("\u2551"));
12217
+ console.log(brand(" \u2551") + " " + success3("\u2713") + source_default.white(" Ready to make payments".padEnd(33)) + brand("\u2551"));
12218
+ console.log(brand(" \u2551") + source_default.white(" ") + brand("\u2551"));
12219
+ console.log(brand(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"));
12220
+ console.log();
12221
+ console.log(laneBold.primary(" Try these:"));
12222
+ console.log(source_default.white(" lane pay --amount 10 --recipient anthropic.com -t"));
12223
+ console.log(source_default.white(" lane wallet status"));
12224
+ console.log(source_default.white(" lane card list"));
12225
+ console.log(source_default.white(" lane budget get"));
12226
+ console.log();
12227
+ } else {
12228
+ console.log(success3(" \u2713 Demo ready \u2014 wallet $1,000, card Visa ****4242"));
12229
+ console.log(source_default.white(" Try: lane pay --amount 10 --recipient anthropic.com -t"));
12230
+ console.log();
12231
+ }
12232
+ }
12204
12233
  var brand, muted, THEN_DIAGRAM, NOW_DIAGRAM, FUTURE_DIAGRAM, PHASES;
12205
12234
  var init_onboarding = __esm({
12206
12235
  "src/cli/onboarding.ts"() {
@@ -28245,6 +28274,7 @@ init_token_store();
28245
28274
 
28246
28275
  // src/cli/commands/init.ts
28247
28276
  init_source();
28277
+ init_lane();
28248
28278
  import { readFile as readFile4, writeFile as writeFile2, mkdir as mkdir2, unlink } from "fs/promises";
28249
28279
  import { join as join4 } from "path";
28250
28280
  import { homedir as homedir3 } from "os";
@@ -28283,8 +28313,8 @@ var initCommand = new Command("init").description("Initialize Lane CLI configura
28283
28313
  `));
28284
28314
  return;
28285
28315
  }
28286
- if (options.demo) {
28287
- const demoUrl = options.url ?? DEFAULT_DEMO_URL;
28316
+ if (options.demo || globalOpts.demo) {
28317
+ const demoUrl = options.url ?? globalOpts.url ?? DEFAULT_DEMO_URL;
28288
28318
  const spinner = await createSpinner("Checking demo server...", outputOpts);
28289
28319
  let healthy = false;
28290
28320
  try {
@@ -28303,12 +28333,33 @@ var initCommand = new Command("init").description("Initialize Lane CLI configura
28303
28333
  await writePersistentConfig({ demo: true, demoUrl });
28304
28334
  process.env["LANE_DEMO"] = "true";
28305
28335
  process.env["LANE_DEMO_URL"] = demoUrl;
28336
+ let readyStatus = { email: "demo@getonlane.com", walletId: "wallet_demo_001", hasCard: true };
28337
+ if (healthy) {
28338
+ try {
28339
+ const lane6 = await Lane.create();
28340
+ const profile = await lane6.auth.whoami();
28341
+ const wallets = await lane6.wallets.list({ limit: 1 });
28342
+ const cards = await lane6.cards.list();
28343
+ readyStatus = {
28344
+ email: profile.email,
28345
+ walletId: wallets.data[0]?.id ?? "wallet_demo_001",
28346
+ hasCard: cards.data.length > 0
28347
+ };
28348
+ } catch {
28349
+ }
28350
+ }
28306
28351
  if (terse2) {
28307
28352
  terseOut({
28308
28353
  demo: true,
28309
28354
  demo_url: demoUrl,
28310
28355
  config_path: CONFIG_FILE,
28311
- server_healthy: healthy
28356
+ server_healthy: healthy,
28357
+ ready: true,
28358
+ email: readyStatus.email,
28359
+ wallet_id: readyStatus.walletId,
28360
+ has_card: readyStatus.hasCard,
28361
+ mode: "test",
28362
+ next_step: "make_payment"
28312
28363
  });
28313
28364
  return;
28314
28365
  }
@@ -28322,9 +28373,8 @@ var initCommand = new Command("init").description("Initialize Lane CLI configura
28322
28373
  console.log(source_default.dim(` Start locally: npm run dev:vic-demo`));
28323
28374
  console.log();
28324
28375
  }
28325
- console.log(laneBold.primary(" Try: ") + source_default.white("lane status"));
28326
- console.log(lane.info(" Reset: lane init --reset"));
28327
- console.log();
28376
+ const { showDemoOnboarding: showDemoOnboarding2 } = await Promise.resolve().then(() => (init_onboarding(), onboarding_exports));
28377
+ await showDemoOnboarding2();
28328
28378
  return;
28329
28379
  }
28330
28380
  cmd.help();