@visa/cli 4.1.0-rc.25 → 4.1.0-rc.250
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 +273 -227
- package/dist/checkout-engine/adapters/generic.d.ts +69 -0
- package/dist/checkout-engine/adapters/generic.js +383 -58
- package/dist/checkout-engine/adapters/index.d.ts +4 -1
- package/dist/checkout-engine/adapters/index.js +10 -3
- package/dist/checkout-engine/adapters/shopify.d.ts +80 -0
- package/dist/checkout-engine/adapters/shopify.js +688 -0
- package/dist/checkout-engine/amount.d.ts +15 -0
- package/dist/checkout-engine/amount.js +72 -0
- package/dist/checkout-engine/browser-launch.d.ts +9 -4
- package/dist/checkout-engine/browser-launch.js +19 -4
- package/dist/checkout-engine/browserbase-browser.d.ts +24 -0
- package/dist/checkout-engine/browserbase-browser.js +186 -0
- package/dist/checkout-engine/cli-engine.d.ts +297 -4
- package/dist/checkout-engine/cli-engine.js +942 -48
- package/dist/checkout-engine/confirmed-merchants.d.ts +31 -0
- package/dist/checkout-engine/confirmed-merchants.js +165 -0
- package/dist/checkout-engine/detect.d.ts +1 -1
- package/dist/checkout-engine/detect.js +26 -0
- package/dist/checkout-engine/evidence.d.ts +4 -1
- package/dist/checkout-engine/evidence.js +51 -6
- package/dist/checkout-engine/executor.d.ts +64 -4
- package/dist/checkout-engine/executor.js +625 -146
- package/dist/checkout-engine/hosted-approval.d.ts +124 -7
- package/dist/checkout-engine/hosted-approval.js +384 -54
- package/dist/checkout-engine/index.d.ts +9 -2
- package/dist/checkout-engine/index.js +8 -1
- package/dist/checkout-engine/instrument.d.ts +7 -0
- package/dist/checkout-engine/instrument.js +4 -0
- package/dist/checkout-engine/known-merchants.d.ts +10 -0
- package/dist/checkout-engine/known-merchants.js +38 -0
- package/dist/checkout-engine/live-fill-approval.d.ts +5 -20
- package/dist/checkout-engine/live-fill-approval.js +20 -51
- package/dist/checkout-engine/mandate/card-mandate.d.ts +121 -0
- package/dist/checkout-engine/mandate/card-mandate.js +226 -0
- package/dist/checkout-engine/mandate/mandate-ledger.d.ts +174 -0
- package/dist/checkout-engine/mandate/mandate-ledger.js +410 -0
- package/dist/checkout-engine/outcome.d.ts +2 -2
- package/dist/checkout-engine/outcome.js +36 -1
- package/dist/checkout-engine/owner-only-file.d.ts +9 -0
- package/dist/checkout-engine/owner-only-file.js +20 -1
- package/dist/checkout-engine/receipt-dir.d.ts +6 -0
- package/dist/checkout-engine/receipt-dir.js +8 -0
- package/dist/checkout-engine/receipt.d.ts +56 -2
- package/dist/checkout-engine/receipt.js +55 -16
- package/dist/checkout-engine/shopify-primary-domain.d.ts +25 -0
- package/dist/checkout-engine/shopify-primary-domain.js +96 -0
- package/dist/checkout-engine/trace-handles.d.ts +8 -0
- package/dist/checkout-engine/trace-handles.js +12 -0
- package/dist/checkout-engine/types.d.ts +28 -2
- package/dist/checkout-engine/unresolved-charges.d.ts +34 -0
- package/dist/checkout-engine/unresolved-charges.js +134 -0
- package/dist/checkout-engine/vgs-gateway/server-mint-client.d.ts +53 -1
- package/dist/checkout-engine/vgs-gateway/server-mint-client.js +78 -10
- package/dist/checkout-engine/vgs-live-instrument.d.ts +38 -35
- package/dist/checkout-engine/vgs-live-instrument.js +51 -74
- package/dist/checkout-engine/vic-confirmation.d.ts +18 -0
- package/dist/checkout-engine/vic-confirmation.js +9 -3
- package/dist/checkout-engine/web-bot-auth.d.ts +98 -0
- package/dist/checkout-engine/web-bot-auth.js +218 -0
- package/dist/cli.js +905 -505
- package/dist/mcp-apps/ucp-checkout.html +280 -0
- package/dist/mcp-server/index.js +744 -175
- package/dist/merchant-ucp-mcp/index.js +6 -0
- package/dist/skills/pair-visa-agent/RUNTIMES.md +122 -79
- package/dist/skills/pair-visa-agent/SKILL.md +436 -279
- package/dist/skills/pair-visa-agent/scripts/__tests__/setup.test.mjs +407 -0
- package/dist/skills/pair-visa-agent/scripts/setup.mjs +310 -30
- package/dist/skills/visa-shopify-checkout/SKILL.md +122 -0
- package/dist/skills/visa-shopify-checkout/references/evidence-and-states.md +37 -0
- package/dist/skills/visa-ucp-shopping/SKILL.md +86 -0
- package/dist/subway-direct.mjs +1 -0
- package/install.ps1 +9 -46
- package/install.sh +5 -37
- package/native/bin/win32-x64/visa-keychain-win.exe +0 -0
- package/package.json +32 -28
- package/server.json +4 -4
- package/dist/checkout-engine/inline-target.d.ts +0 -13
- package/dist/checkout-engine/inline-target.js +0 -37
- package/dist/checkout-engine/pay-args.d.ts +0 -14
- package/dist/checkout-engine/pay-args.js +0 -44
- package/dist/checkout-engine/pay.d.ts +0 -1
- package/dist/checkout-engine/pay.js +0 -13
- package/dist/checkout-engine/repo-env.d.ts +0 -11
- package/dist/checkout-engine/repo-env.js +0 -23
- package/dist/checkout-engine/run-live-fill.d.ts +0 -1
- package/dist/checkout-engine/run-live-fill.js +0 -443
- package/dist/checkout-engine/vgs-gateway/fetch-credential.d.mts +0 -74
- package/dist/checkout-engine/vgs-gateway/fetch-credential.mjs +0 -248
|
@@ -26,15 +26,51 @@ import type { PurchaseAssurance, VgsCheckoutTarget } from './vgs-live-instrument
|
|
|
26
26
|
* hang the runner past the advertised timeout.
|
|
27
27
|
*/
|
|
28
28
|
export type HostedApprovalOptions = {
|
|
29
|
-
/** The
|
|
29
|
+
/** The enrollment web deployment origin (apps/web), e.g. https://web-….up.railway.app */
|
|
30
30
|
baseUrl: string;
|
|
31
31
|
/** Durable agentic token id from the CLI agent credential. */
|
|
32
32
|
tokenId: string;
|
|
33
33
|
target: VgsCheckoutTarget;
|
|
34
34
|
/** Prefills the approval page's enrollment-email field (optional). */
|
|
35
35
|
consumerEmail?: string;
|
|
36
|
+
/**
|
|
37
|
+
* BUDGET/mandate approval — the only kind since #7348 retired the
|
|
38
|
+
* single-purchase plane: `target.transactionAmount` is the approved spend
|
|
39
|
+
* CEILING (not one charge), so the server mints a BUDGET mint token that
|
|
40
|
+
* later accepts many sub-ceiling draws tap-free.
|
|
41
|
+
*/
|
|
42
|
+
budget: true;
|
|
43
|
+
/**
|
|
44
|
+
* Exact current request-key thumbprint receiving the budget; the
|
|
45
|
+
* authenticated page resolves it to the owner's stable agent before
|
|
46
|
+
* displaying or signing.
|
|
47
|
+
*/
|
|
48
|
+
agentJkt: string;
|
|
49
|
+
/** Max draws the ceiling intent may fulfil — carried onto the token. */
|
|
50
|
+
maxDraws: number;
|
|
51
|
+
/**
|
|
52
|
+
* Per-purchase cap (decimal string, <= the ceiling) — shown on the approval
|
|
53
|
+
* page as a worst-case term and carried onto the mint token so the displayed
|
|
54
|
+
* cap is the enforced cap.
|
|
55
|
+
*/
|
|
56
|
+
perTransaction?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Agent-supplied one-liner describing what this approval is for. Sanitized
|
|
59
|
+
* here (control chars stripped, trimmed, capped) and rendered by the approval
|
|
60
|
+
* page in a clearly-labeled "written by the agent" block — provenance for the
|
|
61
|
+
* human to cross-check, never a trusted field.
|
|
62
|
+
*/
|
|
63
|
+
intent?: string;
|
|
36
64
|
log?: (line: string) => void;
|
|
37
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Called once with the approval URL as DATA (not a log line) the instant it is
|
|
67
|
+
* known — before any polling. A headless agent (OpenClaw/Hermes) has no browser
|
|
68
|
+
* and no passkey; its whole job is to relay this URL to its human operator, so
|
|
69
|
+
* the URL must be capturable as a value, not just printed. The interactive CLI
|
|
70
|
+
* leaves this unset and relies on `log` + `openUrl`.
|
|
71
|
+
*/
|
|
72
|
+
onApprovalUrl?: (url: string) => void;
|
|
73
|
+
/** Injectable for tests; default opens the operator's default browser, best-effort. */
|
|
38
74
|
openUrl?: (url: string) => void;
|
|
39
75
|
fetchImpl?: typeof fetch;
|
|
40
76
|
/** Injectable for tests — never wall-clock-sleep in a unit test. */
|
|
@@ -43,15 +79,43 @@ export type HostedApprovalOptions = {
|
|
|
43
79
|
pollIntervalMs?: number;
|
|
44
80
|
timeoutMs?: number;
|
|
45
81
|
};
|
|
82
|
+
/** One short sentence — must match the relay's cap (agent-approval.ts). */
|
|
83
|
+
export declare const APPROVAL_INTENT_MAX_CHARS = 200;
|
|
84
|
+
/**
|
|
85
|
+
* Sanitize an agent-supplied intent to what the relay will accept and the page
|
|
86
|
+
* will display: control chars (and JS line separators) stripped, trimmed,
|
|
87
|
+
* TRUNCATED to the cap (the runner is the agent's own side, so truncating here
|
|
88
|
+
* beats a failed registration; the server still rejects an over-cap value).
|
|
89
|
+
* Returns undefined when nothing displayable remains.
|
|
90
|
+
*/
|
|
91
|
+
export declare function sanitizeApprovalIntent(value: string | undefined): string | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* The operator saw the request and said NO. Terminal and non-retryable: the
|
|
94
|
+
* relay entry is consumed, re-running would only re-ask a human who already
|
|
95
|
+
* refused. Callers must not classify this as transient.
|
|
96
|
+
*/
|
|
97
|
+
export declare class HostedApprovalDeclinedError extends Error {
|
|
98
|
+
constructor();
|
|
99
|
+
}
|
|
46
100
|
export declare const HOSTED_APPROVAL_TIMEOUT_MS: number;
|
|
47
101
|
export declare const HOSTED_APPROVAL_POLL_MS = 3000;
|
|
102
|
+
/** Emit a "still waiting" heartbeat roughly every this-many ms during the poll. */
|
|
103
|
+
export declare const HOSTED_APPROVAL_HEARTBEAT_MS = 30000;
|
|
48
104
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
105
|
+
* Resolve the approval timeout: `CHECKOUT_APPROVAL_TIMEOUT_MS` (seconds*1000, an
|
|
106
|
+
* integer ms) overrides the default when it parses to a positive integer.
|
|
107
|
+
* Lets an operator widen the window for separate-device / headless approval
|
|
108
|
+
* without threading a flag through every caller. Invalid values fall back.
|
|
53
109
|
*/
|
|
54
|
-
export declare
|
|
110
|
+
export declare function resolveApprovalTimeoutMs(): number;
|
|
111
|
+
/**
|
|
112
|
+
* The staging apps/web deploy (which now hosts the /agent/enroll/approve page
|
|
113
|
+
* after the v4-verify-web GA graduation) — hosted approval is the NORMAL path
|
|
114
|
+
* (no local certs, no vendored SDK, no localhost anywhere), so its origin is a
|
|
115
|
+
* built-in default rather than per-machine config. Not a secret: it's the
|
|
116
|
+
* public page the operator's browser opens anyway.
|
|
117
|
+
*/
|
|
118
|
+
export declare const DEFAULT_APPROVAL_BASE_URL = "https://web-visa-code-preview.up.railway.app";
|
|
55
119
|
/**
|
|
56
120
|
* Flag > environment > built-in default. An explicitly EMPTY value
|
|
57
121
|
* (CHECKOUT_APPROVAL_BASE_URL='') opts out of hosted approval entirely —
|
|
@@ -75,4 +139,57 @@ export declare function assertApprovalBaseUrl(value: string): string;
|
|
|
75
139
|
*/
|
|
76
140
|
export declare function runHostedApproval(opts: HostedApprovalOptions): Promise<PurchaseAssurance & {
|
|
77
141
|
mintToken?: string;
|
|
142
|
+
validUntil?: number;
|
|
78
143
|
}>;
|
|
144
|
+
/**
|
|
145
|
+
* A panel-initiated mandate handoff, released by its single-use pickup code.
|
|
146
|
+
* The context here is SERVER truth (an owner-authenticated panel session parked
|
|
147
|
+
* it, and the code is the credential that releases it) — the runner had no part
|
|
148
|
+
* in registering it, so unlike {@link runHostedApproval} the fields are
|
|
149
|
+
* returned for the caller to act on rather than compared against a local run.
|
|
150
|
+
* What IS verified here is the binding: the entry must be a budget approval
|
|
151
|
+
* minted for exactly THIS runtime's request key and THIS device's card token.
|
|
152
|
+
*/
|
|
153
|
+
export type MandatePickupClaim = {
|
|
154
|
+
/** Null only when {@link assuranceExempt} — a code-verified card runs no ceremony. */
|
|
155
|
+
assuranceData: unknown;
|
|
156
|
+
assuranceExempt: boolean;
|
|
157
|
+
mintToken: string;
|
|
158
|
+
/** Unix seconds — the mandate lapse the owner approved in the panel. */
|
|
159
|
+
validUntil: number;
|
|
160
|
+
/** Decimal ceiling string exactly as approved (the context's `amount`). */
|
|
161
|
+
ceiling: string;
|
|
162
|
+
currency: string;
|
|
163
|
+
maxDraws: number;
|
|
164
|
+
perTransaction?: string;
|
|
165
|
+
merchant: {
|
|
166
|
+
name: string;
|
|
167
|
+
url: string;
|
|
168
|
+
countryCode: string;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
export type ClaimMandatePickupOptions = {
|
|
172
|
+
/** The enrollment web deployment origin (apps/web). */
|
|
173
|
+
baseUrl: string;
|
|
174
|
+
/** Single-use pickup code (the approval verifier) the owner handed over. */
|
|
175
|
+
pickupCode: string;
|
|
176
|
+
/** This runtime's exact current request-key JKT — the only key the code may fund. */
|
|
177
|
+
agentJkt: string;
|
|
178
|
+
/**
|
|
179
|
+
* The agent handoff this runtime just redeemed, when the code came from one.
|
|
180
|
+
* A budget minted in the Add-agent dialog exists before the agent does, so it
|
|
181
|
+
* pins the handoff rather than a key; this is the value that pin is compared
|
|
182
|
+
* against. Absent for the panel flow, whose budgets pin a key instead.
|
|
183
|
+
*/
|
|
184
|
+
expectedHandoffId?: string;
|
|
185
|
+
/** The card token id this runtime's card authority points at. */
|
|
186
|
+
tokenId: string;
|
|
187
|
+
fetchImpl?: typeof fetch;
|
|
188
|
+
/** Injectable for tests — never wall-clock-sleep in a unit test. */
|
|
189
|
+
sleep?: (ms: number) => Promise<void>;
|
|
190
|
+
now?: () => number;
|
|
191
|
+
/** Bounded retries for transient 429/5xx; the claim itself is single-use. */
|
|
192
|
+
attempts?: number;
|
|
193
|
+
retryDelayMs?: number;
|
|
194
|
+
};
|
|
195
|
+
export declare function claimMandatePickup(opts: ClaimMandatePickupOptions): Promise<MandatePickupClaim>;
|