@visa/cli 4.1.0-rc.159 → 4.1.0-rc.160

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.
@@ -128,6 +128,18 @@ export type CliStartMandateInput = {
128
128
  * "written by the agent" block — provenance for the human, never trusted.
129
129
  */
130
130
  intent?: string;
131
+ /**
132
+ * Per-call relay of the hosted-approval URL, the moment it is known and
133
+ * BEFORE the (up-to-timeout) wait. Takes precedence over the engine-level
134
+ * `deps.onApprovalUrl`.
135
+ *
136
+ * The engine seam was deps-only, and the MCP surface builds its engine once
137
+ * per process without it — so `start_card_mandate` produced an approval URL,
138
+ * printed it to stderr, and blocked the agent's turn for minutes with no way
139
+ * to tell the human what to open. A per-call hook lets one caller relay the
140
+ * URL without every caller sharing one engine-wide callback.
141
+ */
142
+ onApprovalUrl?: (url: string) => void;
131
143
  };
132
144
  export type CliClaimMandateInput = {
133
145
  /** Optional local card-capability selector (legacy name or exact request-key JKT). */
@@ -379,7 +379,7 @@ export function createCliCheckoutEngine(deps = {}) {
379
379
  consumerEmail: input.contact.email,
380
380
  budget: true,
381
381
  agentJkt: registerCap.agentJkt,
382
- onApprovalUrl: deps.onApprovalUrl,
382
+ onApprovalUrl: input.onApprovalUrl ?? deps.onApprovalUrl,
383
383
  maxDraws: DEFAULT_MANDATE_MAX_DRAWS,
384
384
  ...(input.perTransaction !== undefined ? { perTransaction: input.perTransaction } : {}),
385
385
  ...(input.intent !== undefined ? { intent: input.intent } : {}),