lane-sdk 0.2.3 → 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.
Files changed (36) hide show
  1. package/SKILL.md +148 -20
  2. package/dist/adapters/crewai/index.cjs +36 -4
  3. package/dist/adapters/crewai/index.cjs.map +1 -1
  4. package/dist/adapters/crewai/index.js +36 -4
  5. package/dist/adapters/crewai/index.js.map +1 -1
  6. package/dist/adapters/langchain/index.cjs +36 -4
  7. package/dist/adapters/langchain/index.cjs.map +1 -1
  8. package/dist/adapters/langchain/index.js +36 -4
  9. package/dist/adapters/langchain/index.js.map +1 -1
  10. package/dist/adapters/openai/index.cjs +36 -4
  11. package/dist/adapters/openai/index.cjs.map +1 -1
  12. package/dist/adapters/openai/index.js +36 -4
  13. package/dist/adapters/openai/index.js.map +1 -1
  14. package/dist/adapters/vercel-ai/index.cjs +36 -4
  15. package/dist/adapters/vercel-ai/index.cjs.map +1 -1
  16. package/dist/adapters/vercel-ai/index.js +36 -4
  17. package/dist/adapters/vercel-ai/index.js.map +1 -1
  18. package/dist/cli/index.js +264 -40
  19. package/dist/cli/index.js.map +1 -1
  20. package/dist/cli/postinstall.js +2 -0
  21. package/dist/cli/postinstall.js.map +1 -1
  22. package/dist/index.cjs +36 -4
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.js +36 -4
  25. package/dist/index.js.map +1 -1
  26. package/dist/server/vic-demo.js +1052 -0
  27. package/dist/server/vic-demo.js.map +1 -0
  28. package/dist/server-http.cjs +36 -4
  29. package/dist/server-http.cjs.map +1 -1
  30. package/dist/server-http.js +36 -4
  31. package/dist/server-http.js.map +1 -1
  32. package/dist/server-stdio.cjs +36 -4
  33. package/dist/server-stdio.cjs.map +1 -1
  34. package/dist/server-stdio.js +36 -4
  35. package/dist/server-stdio.js.map +1 -1
  36. package/package.json +6 -2
package/SKILL.md CHANGED
@@ -33,26 +33,104 @@ 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:
77
+
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`.
49
83
 
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.
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
92
+
93
+ ### Demo Mode Limitations
94
+
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.
112
+
113
+ ### Choose Mode
114
+
115
+ Before setup, determine which mode to use. **Ask the user:**
116
+
117
+ > Would you like to use **demo mode** (no real card required, mock payments) or **production mode** (real payments with a real card)?
118
+
119
+ **Demo mode** — For trying out Lane without real credentials:
120
+
121
+ ```bash
122
+ npx lane init --demo
123
+ npx lane login -t
124
+ npx lane status -t
125
+ ```
52
126
 
53
- ## Setup
127
+ In demo mode:
128
+ - No real card or wallet setup needed — payments are simulated against the demo server
129
+ - **Use web search** to find merchants and products (not `lane merchant list` or `lane product search`)
130
+ - All `lane pay` commands work and return mock transaction receipts
131
+ - After running `lane init --demo`, skip Steps 1–4 below and go straight to **Make Payments**
54
132
 
55
- Complete these steps before using any Lane commands.
133
+ **Production mode** For real transactions with a real card, continue with Steps 1–4 below.
56
134
 
57
135
  ### Step 1: Verify Node.js
58
136
 
@@ -101,14 +179,7 @@ npx lane whoami -t
101
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.
102
180
  - If `error=network` — connectivity issue, retry up to 2 times
103
181
 
104
- ## Your Current Status
105
-
106
- - Account: !`npx lane whoami -t 2>/dev/null || echo "authenticated=false"`
107
- - Readiness: !`npx lane status -t 2>/dev/null || echo "ready=false"`
108
-
109
- If `ready=false` or `authenticated=false`, guide the user through setup above before proceeding.
110
-
111
- **Starter prompts to suggest:**
182
+ After setup, suggest these starter prompts:
112
183
  - "Search for cloud hosting products"
113
184
  - "Show me Lane-onboarded merchants"
114
185
  - "Pay $5 to replicate.com for API credits"
@@ -116,8 +187,65 @@ If `ready=false` or `authenticated=false`, guide the user through setup above be
116
187
  - "Show my recent transactions"
117
188
  - "Set a daily spending limit of $50"
118
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
+
119
245
  ## Discover Merchants & Products
120
246
 
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.
248
+
121
249
  ### List Lane-Onboarded Merchants (Instant Checkout)
122
250
 
123
251
  ```bash
@@ -1127,13 +1127,38 @@ var FileTokenStore = class {
1127
1127
  function isNodeError(err) {
1128
1128
  return err instanceof Error && "code" in err;
1129
1129
  }
1130
-
1131
- // src/config.ts
1132
1130
  var DEFAULT_BASE_URL = "https://api.getonlane.com";
1133
1131
  var DEFAULT_API_URL = "https://api.getonlane.com";
1134
1132
  var DEFAULT_TIMEOUT = 3e4;
1135
1133
  var DEFAULT_MAX_RETRIES = 2;
1134
+ async function readPersistentConfig() {
1135
+ try {
1136
+ const raw = await promises.readFile(path.join(os.homedir(), ".lane", "config.json"), "utf-8");
1137
+ return JSON.parse(raw);
1138
+ } catch {
1139
+ return null;
1140
+ }
1141
+ }
1136
1142
  async function resolveConfig(options = {}, tokenStore) {
1143
+ const persistent = await readPersistentConfig();
1144
+ if (persistent?.demo && process.env["LANE_DEMO"] !== "false") {
1145
+ process.env["LANE_DEMO"] = "true";
1146
+ if (persistent.demoUrl && !process.env["LANE_DEMO_URL"]) {
1147
+ process.env["LANE_DEMO_URL"] = persistent.demoUrl;
1148
+ }
1149
+ }
1150
+ if (process.env["LANE_DEMO"] === "true") {
1151
+ const demoBaseUrl = process.env["LANE_DEMO_URL"] ?? "http://localhost:3020";
1152
+ return Object.freeze({
1153
+ apiKey: options.apiKey ?? process.env["LANE_API_KEY"] ?? "lane_sk_demo_000000000000",
1154
+ baseUrl: demoBaseUrl,
1155
+ apiUrl: demoBaseUrl,
1156
+ testMode: true,
1157
+ timeout: options.timeout ?? DEFAULT_TIMEOUT,
1158
+ maxRetries: options.maxRetries ?? DEFAULT_MAX_RETRIES,
1159
+ circuitBreaker: void 0
1160
+ });
1161
+ }
1137
1162
  let apiKey = options.apiKey;
1138
1163
  if (!apiKey) {
1139
1164
  apiKey = process.env["LANE_API_KEY"];
@@ -2716,7 +2741,9 @@ var Lane = class _Lane {
2716
2741
  } catch {
2717
2742
  _Lane._throwWaitlistError();
2718
2743
  }
2719
- await _Lane._verifyAccess(config);
2744
+ if (process.env["LANE_DEMO"] !== "true") {
2745
+ await _Lane._verifyAccess(config);
2746
+ }
2720
2747
  return new _Lane(config);
2721
2748
  }
2722
2749
  /**
@@ -3190,6 +3217,7 @@ var BiometricVerifier = class {
3190
3217
  async tryWebAuthn(reason, instructionId) {
3191
3218
  const { createServer } = await import('http');
3192
3219
  const open = (await import('open')).default;
3220
+ const { hostname } = await import('os');
3193
3221
  return new Promise((resolve, reject) => {
3194
3222
  const server = createServer((req, res) => {
3195
3223
  const url = new URL(req.url ?? "/", "http://localhost");
@@ -3201,7 +3229,11 @@ var BiometricVerifier = class {
3201
3229
  '<!DOCTYPE html><html><body style="font-family:sans-serif;display:flex;justify-content:center;align-items:center;height:100vh"><h1 style="color:#10b981">Verified</h1></body></html>'
3202
3230
  );
3203
3231
  cleanup();
3204
- resolve({ method: "webauthn_passkey", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
3232
+ resolve({
3233
+ method: "webauthn_passkey",
3234
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
3235
+ machineId: `webauthn_${hostname()}`
3236
+ });
3205
3237
  return;
3206
3238
  }
3207
3239
  res.writeHead(200, { "Content-Type": "text/html" });