@conto_finance/sdk 0.1.0 → 0.4.0

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/dist/index.d.mts CHANGED
@@ -1,3 +1,17 @@
1
+ interface ApiErrorMetadata {
2
+ code: string;
3
+ status: number;
4
+ requestId?: string;
5
+ retryAfter?: number;
6
+ retryGuidance?: string;
7
+ actionUrl?: string;
8
+ fieldErrors?: Array<{
9
+ field: string;
10
+ message: string;
11
+ }>;
12
+ reasons?: string[];
13
+ }
14
+
1
15
  /**
2
16
  * Conto Admin SDK
3
17
  *
@@ -24,6 +38,7 @@
24
38
  * await admin.agents.assignPolicy(agentId, policy.id);
25
39
  * ```
26
40
  */
41
+
27
42
  interface ContoAdminConfig {
28
43
  /** Your organization API key (conto_xxx...) */
29
44
  orgApiKey: string;
@@ -32,9 +47,13 @@ interface ContoAdminConfig {
32
47
  /** Request timeout in milliseconds. Defaults to 30000 */
33
48
  timeout?: number;
34
49
  }
35
- interface ContoAdminError extends Error {
36
- code: string;
37
- status: number;
50
+ declare class ContoAdminError extends Error {
51
+ readonly code: string;
52
+ readonly status: number;
53
+ readonly requestId?: string;
54
+ readonly retryAfter?: number;
55
+ readonly retryGuidance?: string;
56
+ constructor(message: string, metadata: ApiErrorMetadata);
38
57
  }
39
58
  interface PaginationParams {
40
59
  limit?: number;
@@ -53,7 +72,11 @@ type AgentRiskTier = 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
53
72
  type AgentAttestationMode = 'KEY_ONLY' | 'SIGNED_REQUEST' | 'SIGNED_REQUEST_WITH_CONTEXT';
54
73
  type DelegationType = 'FULL' | 'LIMITED' | 'VIEW_ONLY' | 'PREAPPROVED' | 'ALLOWLIST';
55
74
  type ChainType = 'EVM' | 'SOLANA';
56
- type CustodyType = 'PRIVY' | 'SPONGE' | 'EXTERNAL' | 'SMART_CONTRACT';
75
+ type CustomerCustodyMode = 'MANAGED' | 'EXTERNAL' | 'SMART_CONTRACT';
76
+ type CustomerWalletControlModel = 'CONTO_MANAGED' | 'ORGANIZATION_CONTROLLED' | 'EXTERNAL' | 'CONTRACT_ENFORCED';
77
+ type CustomerWalletKeyAccess = 'NO_SELF_SERVICE_EXPORT' | 'OWNER_AUTHORIZED_EXPORT' | 'EXPORT_RECONCILIATION_REQUIRED' | 'CUSTOMER_CONTROLLED' | 'CONTRACT_ADMINISTRATED' | 'EXPORTED';
78
+ /** @deprecated Use CustomerCustodyMode. */
79
+ type CustodyType = CustomerCustodyMode;
57
80
  type WalletType = 'EOA' | 'SMART_WALLET' | 'MULTISIG';
58
81
  type WalletStatus = 'ACTIVE' | 'FROZEN' | 'CLOSED' | 'ARCHIVED';
59
82
  type PolicyType = 'SPEND_LIMIT' | 'MERCHANT' | 'TIME_WINDOW' | 'CATEGORY' | 'VELOCITY' | 'COMPOSITE' | 'GEOGRAPHIC' | 'APPROVAL_THRESHOLD' | 'COUNTERPARTY' | 'BUDGET_ALLOCATION' | 'WHITELIST' | 'EXPIRATION' | 'CONTRACT_ALLOWLIST' | 'BLACKOUT_PERIOD';
@@ -72,25 +95,37 @@ interface Agent {
72
95
  riskTier?: AgentRiskTier;
73
96
  publicKey: string;
74
97
  status: AgentStatus;
75
- externalId: string | null;
76
98
  attestationMode?: AgentAttestationMode;
77
99
  identityTags?: string[];
78
- ownerMembershipId?: string | null;
100
+ externalId: string | null;
101
+ allowedContexts: string[];
102
+ webhookConfigured: boolean;
103
+ /** Callback query and fragment values are redacted in API responses. */
104
+ callbackUrl: string | null;
79
105
  owner?: {
80
106
  membershipId: string;
81
- role: string;
82
- userId?: string | null;
83
107
  name?: string | null;
84
- email?: string | null;
85
108
  } | null;
86
- allowedContexts: string | null;
87
- organizationId: string;
109
+ setup: {
110
+ status: 'READY' | 'ACTION_REQUIRED';
111
+ issueCount: number;
112
+ issues: Array<{
113
+ code: 'OWNER_REQUIRED' | 'IDENTITY_SLUG_REQUIRED' | 'PURPOSE_REQUIRED';
114
+ field: 'ownerMembershipId' | 'agentIdSlug' | 'purpose';
115
+ severity: 'BLOCKING' | 'RECOMMENDED';
116
+ message: string;
117
+ }>;
118
+ };
88
119
  createdAt: string;
89
120
  updatedAt: string;
121
+ linkedWalletCount: number;
122
+ transactionCount: number;
90
123
  wallets?: AgentWalletLink[];
91
- _count?: {
92
- sentTransactions: number;
93
- };
124
+ nextSteps?: Record<'createSdkKey' | 'linkWallet' | 'assignPolicy', {
125
+ method: 'POST';
126
+ path: string;
127
+ description: string;
128
+ }>;
94
129
  }
95
130
  interface CreateAgentInput {
96
131
  name: string;
@@ -106,6 +141,7 @@ interface CreateAgentInput {
106
141
  attestationMode?: AgentAttestationMode;
107
142
  identityTags?: string[];
108
143
  allowedContexts?: string[];
144
+ callbackUrl?: string;
109
145
  }
110
146
  interface UpdateAgentInput {
111
147
  name?: string;
@@ -120,6 +156,7 @@ interface UpdateAgentInput {
120
156
  attestationMode?: AgentAttestationMode;
121
157
  identityTags?: string[] | null;
122
158
  allowedContexts?: string[];
159
+ callbackUrl?: string | null;
123
160
  }
124
161
  interface ListAgentsParams extends PaginationParams {
125
162
  status?: string;
@@ -132,23 +169,26 @@ interface ListAgentsResponse {
132
169
  offset: number;
133
170
  }
134
171
  interface FreezeAgentInput {
135
- reason: string;
136
172
  freezeWallets?: boolean;
137
173
  }
138
174
  interface UnfreezeAgentInput {
139
- reason: string;
140
175
  unfreezeWallets?: boolean;
141
- resetCounters?: boolean;
142
176
  }
143
177
  interface AgentWalletLink {
144
178
  id: string;
145
- agentId: string;
146
179
  walletId: string;
147
180
  delegationType: DelegationType;
148
- spendLimitPerTx: number;
149
- spendLimitDaily: number;
181
+ spendLimitPerTx: number | null;
182
+ spendLimitDaily: number | null;
150
183
  spendLimitWeekly: number | null;
151
184
  spendLimitMonthly: number | null;
185
+ spentToday: number;
186
+ spentThisWeek: number;
187
+ spentThisMonth: number;
188
+ allowedHoursStart: number;
189
+ allowedHoursEnd: number;
190
+ allowedDays: string[];
191
+ timezone: string;
152
192
  isActive: boolean;
153
193
  wallet?: {
154
194
  id: string;
@@ -156,13 +196,205 @@ interface AgentWalletLink {
156
196
  address: string;
157
197
  usdcBalance: number;
158
198
  status: string;
159
- custodyType?: string;
199
+ custodyMode?: CustomerCustodyMode;
200
+ controlModel?: CustomerWalletControlModel;
201
+ keyAccess?: CustomerWalletKeyAccess;
202
+ };
203
+ createdAt: string;
204
+ updatedAt: string;
205
+ }
206
+ interface AdminExternalCardOverlayEnforcement {
207
+ enforcementMode: 'POLICY_OVERLAY';
208
+ integrationMode: 'SDK_REQUIRED';
209
+ canBypass: true;
210
+ credentialStored: false;
211
+ credentialReleased: false;
212
+ executionResponsibility: 'CUSTOMER';
213
+ transactionVerification: 'SELF_REPORTED';
214
+ }
215
+ interface ExternalCard {
216
+ id: string;
217
+ name: string;
218
+ last4: string;
219
+ brand: 'VISA' | 'MASTERCARD' | 'AMEX' | 'DISCOVER' | 'OTHER' | null;
220
+ cardType: 'VIRTUAL' | 'PHYSICAL';
221
+ fundingType: 'DEBIT' | 'CREDIT';
222
+ status: 'ACTIVE' | 'PAUSED' | 'LOCKED' | 'EXPIRED' | 'CANCELLED';
223
+ isActive: boolean;
224
+ spendLimitDaily: number;
225
+ spendLimitWeekly: number | null;
226
+ spendLimitMonthly: number | null;
227
+ spendLimitPerTx: number;
228
+ spentToday: number;
229
+ spentThisWeek: number;
230
+ spentThisMonth: number;
231
+ remainingToday: number;
232
+ agentCount: number;
233
+ transactionCount: number;
234
+ enforcement: AdminExternalCardOverlayEnforcement;
235
+ createdAt: string;
236
+ updatedAt: string;
237
+ }
238
+ interface RegisterExternalCardInput {
239
+ name: string;
240
+ last4: string;
241
+ brand?: 'VISA' | 'MASTERCARD' | 'AMEX' | 'DISCOVER' | 'OTHER';
242
+ cardType?: 'VIRTUAL' | 'PHYSICAL';
243
+ fundingType?: 'DEBIT' | 'CREDIT';
244
+ spendLimitDaily?: number;
245
+ spendLimitWeekly?: number;
246
+ spendLimitMonthly?: number;
247
+ spendLimitPerTx?: number;
248
+ notes?: string;
249
+ }
250
+ interface AssignExternalCardInput {
251
+ cardId: string;
252
+ spendLimitDaily?: number;
253
+ spendLimitWeekly?: number;
254
+ spendLimitMonthly?: number;
255
+ spendLimitPerTx?: number;
256
+ allowedDays?: Array<'Sun' | 'Mon' | 'Tue' | 'Wed' | 'Thu' | 'Fri' | 'Sat'>;
257
+ allowedHoursStart?: number;
258
+ allowedHoursEnd?: number;
259
+ timezone: string;
260
+ allowedCategories?: string[];
261
+ blockedCategories?: string[];
262
+ allowedMerchants?: string[];
263
+ blockedMerchants?: string[];
264
+ activeFrom?: string | null;
265
+ activeUntil?: string | null;
266
+ }
267
+ type UpdateExternalCardAssignmentInput = Partial<Omit<AssignExternalCardInput, 'cardId'>>;
268
+ interface AgentExternalCard {
269
+ id: string;
270
+ cardId: string;
271
+ cardName: string;
272
+ last4: string;
273
+ brand: string | null;
274
+ cardType: string;
275
+ fundingType: string;
276
+ cardStatus: string;
277
+ accessStatus: 'ACTIVE' | 'PAUSED' | 'REVOKED';
278
+ spendLimitDaily: number;
279
+ spendLimitWeekly: number | null;
280
+ spendLimitMonthly: number | null;
281
+ spendLimitPerTx: number;
282
+ spentToday: number;
283
+ spentThisWeek: number;
284
+ spentThisMonth: number;
285
+ remainingToday: number;
286
+ allowedDays: string[];
287
+ allowedHoursStart: number;
288
+ allowedHoursEnd: number;
289
+ timezone: string;
290
+ allowedCategories: string[] | null;
291
+ blockedCategories: string[] | null;
292
+ allowedMerchants: string[] | null;
293
+ blockedMerchants: string[] | null;
294
+ activeFrom: string | null;
295
+ activeUntil: string | null;
296
+ isActive: boolean;
297
+ enforcement: AdminExternalCardOverlayEnforcement;
298
+ createdAt: string;
299
+ }
300
+ interface RevokeExternalCardAssignmentResult {
301
+ unassigned: true;
302
+ cardId: string;
303
+ agentId: string;
304
+ revokedApprovals: number;
305
+ executingRequests: number;
306
+ reconciliationRequired: boolean;
307
+ enforcement: AdminExternalCardOverlayEnforcement;
308
+ }
309
+ interface PauseExternalCardAssignmentResult {
310
+ accessStatus: 'PAUSED';
311
+ cardId: string;
312
+ agentId: string;
313
+ revokedApprovals: number;
314
+ executingRequests: number;
315
+ reconciliationRequired: boolean;
316
+ enforcement: AdminExternalCardOverlayEnforcement;
317
+ }
318
+ type ExternalCardRequestStatus = 'APPROVED' | 'EXECUTING' | 'CONFIRMING' | 'COMPLETED' | 'DENIED' | 'EXPIRED' | 'CANCELLED';
319
+ interface ExternalCardOverlayRequest {
320
+ requestId: string;
321
+ status: ExternalCardRequestStatus;
322
+ decision: string;
323
+ amount: number;
324
+ currency: string;
325
+ merchantName: string | null;
326
+ merchantId: string | null;
327
+ merchantCategory: string | null;
328
+ purpose: string | null;
329
+ expiresAt: string | null;
330
+ executionClaimedAt: string | null;
331
+ reconciliationRequired: boolean;
332
+ nextAction: 'BEGIN_EXECUTION' | 'CONFIRM_OR_RECONCILE' | 'POLL' | 'NONE';
333
+ transactionId: string | null;
334
+ transaction: {
335
+ id: string;
336
+ status: string;
337
+ amount: number;
338
+ currency: string;
339
+ externalTxId: string | null;
340
+ authorizedAt: string | null;
341
+ } | null;
342
+ card: {
343
+ id: string;
344
+ name: string;
345
+ last4: string;
346
+ brand: string | null;
347
+ };
348
+ agent: {
349
+ id: string;
350
+ name: string;
351
+ };
352
+ createdAt: string;
353
+ updatedAt: string;
354
+ enforcement: AdminExternalCardOverlayEnforcement;
355
+ }
356
+ interface ListExternalCardRequestsInput {
357
+ status?: ExternalCardRequestStatus;
358
+ limit?: number;
359
+ }
360
+ interface ListExternalCardRequestsResponse {
361
+ requests: ExternalCardOverlayRequest[];
362
+ summary: Partial<Record<ExternalCardRequestStatus, number>>;
363
+ enforcement: AdminExternalCardOverlayEnforcement;
364
+ }
365
+ interface ResolveExternalCardRequestInput {
366
+ resolution: 'EXECUTED' | 'NOT_EXECUTED';
367
+ reason: string;
368
+ externalTxId?: string;
369
+ authorizationCode?: string;
370
+ actualAmount?: number;
371
+ merchantDetails?: {
372
+ name?: string;
373
+ id?: string;
374
+ category?: string;
375
+ address?: string;
376
+ city?: string;
377
+ state?: string;
378
+ country?: string;
379
+ postalCode?: string;
160
380
  };
161
381
  }
382
+ interface ResolveExternalCardRequestResult {
383
+ resolved: true;
384
+ requestId?: string;
385
+ status: string;
386
+ reservationReleased?: boolean;
387
+ releasedAmount?: number;
388
+ confirmed?: true;
389
+ replayed?: boolean;
390
+ transactionId?: string;
391
+ amount?: number;
392
+ currency?: string;
393
+ verificationStatus?: 'SELF_REPORTED';
394
+ enforcement?: AdminExternalCardOverlayEnforcement;
395
+ }
162
396
  interface OrganizationMember {
163
397
  id: string;
164
- organizationId: string;
165
- userId: string;
166
398
  role: 'OWNER' | 'ADMIN' | 'MANAGER' | 'VIEWER' | 'MEMBER';
167
399
  createdAt: string;
168
400
  updatedAt: string;
@@ -215,24 +447,24 @@ interface Wallet {
215
447
  chainType: ChainType;
216
448
  chainId: string;
217
449
  walletType: WalletType;
218
- custodyType: CustodyType;
450
+ custodyMode: CustomerCustodyMode;
451
+ controlModel: CustomerWalletControlModel;
452
+ keyAccess: CustomerWalletKeyAccess;
219
453
  usdcBalance: number;
220
454
  status: WalletStatus;
221
- externalWalletId: string | null;
222
- organizationId: string;
223
455
  createdAt: string;
224
456
  updatedAt: string;
457
+ linkedAgentCount?: number;
225
458
  }
226
459
  interface CreateWalletInput {
227
460
  name: string;
228
461
  chainType?: ChainType;
229
462
  chainId?: string;
230
- custodyType?: CustodyType;
463
+ custodyMode?: Extract<CustomerCustodyMode, 'MANAGED' | 'EXTERNAL'>;
464
+ /** Root authority for a newly created managed wallet. */
465
+ controlModel?: Extract<CustomerWalletControlModel, 'CONTO_MANAGED' | 'ORGANIZATION_CONTROLLED'>;
231
466
  walletType?: WalletType;
232
467
  address?: string;
233
- externalWalletId?: string;
234
- importAddress?: string;
235
- isWatchOnly?: boolean;
236
468
  }
237
469
  interface UpdateWalletInput {
238
470
  name?: string;
@@ -256,7 +488,9 @@ interface ProvisionWalletResult {
256
488
  address: string;
257
489
  chainId: string;
258
490
  chainType: string;
259
- custodyType: string;
491
+ custodyMode: CustomerCustodyMode;
492
+ controlModel?: CustomerWalletControlModel;
493
+ keyAccess?: CustomerWalletKeyAccess;
260
494
  balance: number;
261
495
  currency: string;
262
496
  };
@@ -286,21 +520,32 @@ interface PolicyRule {
286
520
  value: string;
287
521
  action: RuleAction;
288
522
  createdAt: string;
523
+ updatedAt: string;
289
524
  }
290
525
  interface Policy {
291
526
  id: string;
292
527
  name: string;
293
528
  description: string | null;
294
529
  policyType: PolicyType;
530
+ scope: 'organization' | 'assigned';
295
531
  priority: number;
296
532
  isActive: boolean;
297
- organizationId: string;
298
533
  rules?: PolicyRule[];
534
+ assignedAgents?: Array<{
535
+ id: string;
536
+ name: string;
537
+ }>;
538
+ assignedWallets?: Array<{
539
+ id: string;
540
+ name: string;
541
+ }>;
299
542
  createdAt: string;
300
543
  updatedAt: string;
301
- _count?: {
302
- agentPolicies: number;
303
- };
544
+ }
545
+ interface AssignedPolicy {
546
+ policyId: string;
547
+ assignedAt: string;
548
+ policy: Policy;
304
549
  }
305
550
  interface CreatePolicyInput {
306
551
  name: string;
@@ -308,6 +553,7 @@ interface CreatePolicyInput {
308
553
  description?: string;
309
554
  priority?: number;
310
555
  isActive?: boolean;
556
+ scope?: 'organization' | 'assigned';
311
557
  rules?: CreatePolicyRuleInput[];
312
558
  agentIds?: string[];
313
559
  }
@@ -316,6 +562,7 @@ interface UpdatePolicyInput {
316
562
  description?: string;
317
563
  priority?: number;
318
564
  isActive?: boolean;
565
+ scope?: 'organization' | 'assigned';
319
566
  }
320
567
  interface ListPoliciesParams extends PaginationParams {
321
568
  }
@@ -337,19 +584,179 @@ interface UpdatePolicyRuleInput {
337
584
  value?: string;
338
585
  action?: RuleAction;
339
586
  }
587
+ type PolicyVersionChangeType = 'CREATED' | 'UPDATED' | 'RULES_CHANGED' | 'ROLLED_BACK';
588
+ interface PolicyVersionSnapshotRule {
589
+ ruleType: string;
590
+ operator: string;
591
+ value: string;
592
+ action: string;
593
+ }
594
+ interface PolicyVersionSnapshot {
595
+ name: string;
596
+ description: string | null;
597
+ policyType: string;
598
+ scope: 'organization' | 'assigned';
599
+ priority: number;
600
+ isActive: boolean;
601
+ rules: PolicyVersionSnapshotRule[];
602
+ }
603
+ interface PolicyVersionSummary {
604
+ version: number;
605
+ changeType: PolicyVersionChangeType;
606
+ note: string | null;
607
+ createdBy: string | null;
608
+ createdByType: string | null;
609
+ createdAt: string;
610
+ rulesCount: number;
611
+ }
612
+ interface PolicyVersionDetail extends Omit<PolicyVersionSummary, 'rulesCount'> {
613
+ snapshot: PolicyVersionSnapshot;
614
+ }
615
+ interface ListPolicyVersionsResponse {
616
+ versions: PolicyVersionSummary[];
617
+ total: number;
618
+ limit: number;
619
+ offset: number;
620
+ }
621
+ interface PolicyVersionFieldChange {
622
+ field: string;
623
+ from: unknown;
624
+ to: unknown;
625
+ }
626
+ interface PolicyVersionDiff {
627
+ fields: PolicyVersionFieldChange[];
628
+ rulesAdded: PolicyVersionSnapshotRule[];
629
+ rulesRemoved: PolicyVersionSnapshotRule[];
630
+ unchanged: boolean;
631
+ }
632
+ interface ComparePolicyVersionsResponse {
633
+ from: number;
634
+ to: number;
635
+ diff: PolicyVersionDiff;
636
+ }
637
+ interface RollbackPolicyVersionResponse extends Policy {
638
+ restoredFromVersion: number;
639
+ newVersion: number | null;
640
+ }
641
+ type StripeLinkCheckoutReadinessStatus = 'NOT_READY' | 'READY_FOR_VERIFICATION' | 'VERIFIED' | 'VERIFICATION_FAILED';
642
+ type StripeLinkCheckoutVerification = 'NOT_RUN' | 'NOT_READY' | 'VERIFIED' | 'ACCOUNT_MISMATCH' | 'PROVIDER_UNAVAILABLE';
643
+ /**
644
+ * Non-identifying readiness projection for the configured Stripe Link
645
+ * Checkout adapter. Merchant/account identifiers, URLs, credentials, hashes,
646
+ * Stripe objects, and raw provider errors are intentionally absent.
647
+ */
648
+ interface StripeLinkCheckoutReadiness {
649
+ readonly status: StripeLinkCheckoutReadinessStatus;
650
+ readonly mode: 'TEST' | 'LIVE' | null;
651
+ readonly checks: {
652
+ readonly providerEnabled: boolean;
653
+ readonly checkoutEnabled: boolean;
654
+ readonly organizationAllowed: boolean;
655
+ readonly configurationValid: boolean;
656
+ readonly accountVerified: boolean;
657
+ };
658
+ readonly canVerify: boolean;
659
+ readonly verifiedAt: string | null;
660
+ readonly verification: StripeLinkCheckoutVerification;
661
+ readonly scope: {
662
+ readonly configuredMerchantCheckoutOnly: true;
663
+ readonly statement: string;
664
+ };
665
+ readonly link: {
666
+ readonly eligibilityGuaranteed: false;
667
+ readonly displayGuaranteed: false;
668
+ readonly selectionGuaranteed: false;
669
+ readonly statement: string;
670
+ };
671
+ }
672
+ interface StripeLinkCheckoutReadinessResult {
673
+ readonly readiness: StripeLinkCheckoutReadiness;
674
+ }
340
675
  declare class ContoAdmin {
341
676
  private orgApiKey;
342
677
  private baseUrl;
343
678
  private timeout;
344
679
  agents: AgentsClient;
345
680
  wallets: WalletsClient;
681
+ cards: AdminCardsClient;
346
682
  policies: PoliciesClient;
347
683
  team: TeamClient;
684
+ paymentRails: PaymentRailsClient;
348
685
  constructor(config: ContoAdminConfig);
349
- private fetchWithRetry;
350
686
  /** Make an authenticated request to the Conto API */
351
687
  request<T>(method: string, path: string, body?: Record<string, unknown>): Promise<T>;
352
688
  }
689
+ declare class PaymentRailsClient {
690
+ private client;
691
+ constructor(client: ContoAdmin);
692
+ /** Read gate and configuration readiness without calling Stripe. */
693
+ getStripeLinkCheckoutReadiness(): Promise<StripeLinkCheckoutReadinessResult>;
694
+ /**
695
+ * Ask Conto to verify that its configured Stripe credential resolves to its
696
+ * configured merchant account. This call never returns either identifier.
697
+ */
698
+ verifyStripeLinkCheckoutAccount(): Promise<StripeLinkCheckoutReadinessResult>;
699
+ }
700
+ declare class AdminCardsClient {
701
+ private client;
702
+ constructor(client: ContoAdmin);
703
+ /** List masked external-card aliases. No card credentials are returned. */
704
+ list(): Promise<{
705
+ cards: ExternalCard[];
706
+ enforcement: AdminExternalCardOverlayEnforcement;
707
+ }>;
708
+ /** Register a masked alias for a customer card. Never pass PAN or CVC. */
709
+ register(input: RegisterExternalCardInput): Promise<{
710
+ card: ExternalCard;
711
+ enforcement: AdminExternalCardOverlayEnforcement;
712
+ }>;
713
+ /** Assign a card alias and cooperative policy controls to an agent. */
714
+ assignToAgent(agentId: string, input: AssignExternalCardInput): Promise<{
715
+ agentCard: AgentExternalCard;
716
+ enforcement: AdminExternalCardOverlayEnforcement;
717
+ }>;
718
+ listForAgent(agentId: string): Promise<{
719
+ cards: AgentExternalCard[];
720
+ enforcement: AdminExternalCardOverlayEnforcement;
721
+ }>;
722
+ /** Update limits, merchant rules, hours, and optional start or end dates. */
723
+ updateAgentAssignment(agentId: string, cardId: string, input: UpdateExternalCardAssignmentInput): Promise<{
724
+ agentCard: AgentExternalCard;
725
+ enforcement: AdminExternalCardOverlayEnforcement;
726
+ }>;
727
+ /** Pause an assignment and cancel its unused approvals. */
728
+ pauseForAgent(agentId: string, cardId: string): Promise<PauseExternalCardAssignmentResult>;
729
+ /** Resume a paused assignment when its alias and date range permit it. */
730
+ resumeForAgent(agentId: string, cardId: string): Promise<{
731
+ agentCard: AgentExternalCard;
732
+ enforcement: AdminExternalCardOverlayEnforcement;
733
+ }>;
734
+ /**
735
+ * Revoke an agent's overlay assignment. Unused grants are cancelled; claimed
736
+ * executions remain visible for reconciliation.
737
+ */
738
+ revokeFromAgent(agentId: string, cardId: string): Promise<RevokeExternalCardAssignmentResult>;
739
+ /** List overlay requests, including executions that need receipt reconciliation. */
740
+ listRequests(input?: ListExternalCardRequestsInput): Promise<ListExternalCardRequestsResponse>;
741
+ /**
742
+ * Resolve a claimed execution after checking the customer's processor or
743
+ * receipt. Resolving NOT_EXECUTED releases the reserved policy amount.
744
+ */
745
+ resolveRequest(requestId: string, input: ResolveExternalCardRequestInput): Promise<ResolveExternalCardRequestResult>;
746
+ /** Pause the Conto-controlled path and revoke live overlay grants. */
747
+ pause(cardId: string): Promise<{
748
+ card: Pick<ExternalCard, 'id' | 'name' | 'last4' | 'brand' | 'fundingType' | 'status' | 'isActive' | 'updatedAt'>;
749
+ revokedApprovals: number;
750
+ enforcement: AdminExternalCardOverlayEnforcement;
751
+ }>;
752
+ /** Resume the Conto-controlled path. This does not activate a card at its issuer. */
753
+ resume(cardId: string): Promise<{
754
+ card: Pick<ExternalCard, 'id' | 'name' | 'last4' | 'brand' | 'fundingType' | 'status' | 'isActive' | 'updatedAt'>;
755
+ revokedApprovals: number;
756
+ enforcement: AdminExternalCardOverlayEnforcement;
757
+ }>;
758
+ private setState;
759
+ }
353
760
  declare class AgentsClient {
354
761
  private client;
355
762
  constructor(client: ContoAdmin);
@@ -366,9 +773,13 @@ declare class AgentsClient {
366
773
  message: string;
367
774
  }>;
368
775
  /** Freeze an agent, blocking all transactions */
369
- freeze(agentId: string, input: FreezeAgentInput): Promise<Record<string, unknown>>;
776
+ freeze(agentId: string, input: FreezeAgentInput): Promise<{
777
+ frozen: boolean;
778
+ }>;
370
779
  /** Unfreeze an agent, restoring transaction ability */
371
- unfreeze(agentId: string, input: UnfreezeAgentInput): Promise<Record<string, unknown>>;
780
+ unfreeze(agentId: string, input: UnfreezeAgentInput): Promise<{
781
+ frozen: boolean;
782
+ }>;
372
783
  /** List wallets linked to an agent */
373
784
  listWallets(agentId: string): Promise<{
374
785
  wallets: AgentWalletLink[];
@@ -381,10 +792,10 @@ declare class AgentsClient {
381
792
  }>;
382
793
  /** List policies assigned to an agent */
383
794
  listPolicies(agentId: string): Promise<{
384
- policies: Array<Record<string, unknown>>;
795
+ policies: AssignedPolicy[];
385
796
  }>;
386
797
  /** Assign a policy to an agent */
387
- assignPolicy(agentId: string, policyId: string, overrides?: Record<string, unknown>): Promise<Record<string, unknown>>;
798
+ assignPolicy(agentId: string, policyId: string): Promise<AssignedPolicy>;
388
799
  /** Unassign a policy from an agent */
389
800
  unassignPolicy(agentId: string, policyId: string): Promise<{
390
801
  success: boolean;
@@ -403,7 +814,7 @@ declare class WalletsClient {
403
814
  constructor(client: ContoAdmin);
404
815
  /** List wallets in the organization */
405
816
  list(params?: ListWalletsParams): Promise<ListWalletsResponse>;
406
- /** Create a new wallet or attach an existing provider/self-custodied wallet */
817
+ /** Create a managed wallet or register an external address. */
407
818
  create(input: CreateWalletInput): Promise<Wallet>;
408
819
  /** Get a single wallet by ID */
409
820
  get(walletId: string): Promise<Wallet>;
@@ -456,17 +867,92 @@ declare class PoliciesClient {
456
867
  success: boolean;
457
868
  deletedCount: number;
458
869
  }>;
870
+ /** List the version history for a policy (newest first). */
871
+ listVersions(policyId: string, params?: PaginationParams): Promise<ListPolicyVersionsResponse>;
872
+ /** Get a single version's snapshot. */
873
+ getVersion(policyId: string, version: number): Promise<PolicyVersionDetail>;
874
+ /** Diff two versions of a policy. */
875
+ compareVersions(policyId: string, from: number, to: number): Promise<ComparePolicyVersionsResponse>;
876
+ /**
877
+ * Restore an earlier version. Appends a new ROLLED_BACK version. If the
878
+ * organization requires governance approval for policy changes, the API
879
+ * returns a pending-approval response instead of applying the rollback.
880
+ */
881
+ rollbackVersion(policyId: string, version: number, options?: {
882
+ note?: string;
883
+ }): Promise<RollbackPolicyVersionResponse>;
459
884
  }
460
885
  declare class TeamClient {
461
886
  private client;
462
887
  constructor(client: ContoAdmin);
463
888
  /** List organization memberships for the authenticated organization */
464
889
  listMembers(): Promise<{
465
- organizationId: string;
466
890
  members: OrganizationMember[];
467
891
  }>;
468
892
  }
469
893
 
894
+ type BrowserCheckoutTargetVerificationCode = 'BROWSER_CHECKOUT_TARGET_INVALID' | 'BROWSER_CHECKOUT_TARGET_NOT_FOUND' | 'BROWSER_CHECKOUT_TARGET_CHANGED' | 'BROWSER_CHECKOUT_TARGET_DISABLED';
895
+ declare class BrowserCheckoutTargetVerificationError extends Error {
896
+ readonly code: BrowserCheckoutTargetVerificationCode;
897
+ constructor(code: BrowserCheckoutTargetVerificationCode, message: string);
898
+ }
899
+ /**
900
+ * Credential-free description of one payment-sensitive DOM target. The
901
+ * snapshot is created during proposal discovery and recomputed by the
902
+ * privileged browser process immediately before dispatch.
903
+ */
904
+ interface BrowserCheckoutTargetSnapshot {
905
+ /** Current top-level page URL. Fragments are ignored. */
906
+ pageUrl: string;
907
+ /** Runtime-owned exact locator identity, such as a stable DOM path. */
908
+ locator: string;
909
+ tagName: string;
910
+ role?: string;
911
+ accessibleName?: string;
912
+ /** Resolved navigation target for anchors or controls, when present. */
913
+ targetUrl?: string;
914
+ /** Resolved form submission target, when present. */
915
+ formAction?: string;
916
+ /** Whether the exact control declares a new browsing context such as target=_blank. */
917
+ opensNewPage?: boolean;
918
+ disabled: boolean;
919
+ }
920
+ interface VerifiedBrowserCheckoutTarget<T> {
921
+ snapshot: BrowserCheckoutTargetSnapshot;
922
+ /** Performs the one payment-sensitive side effect and observes its result. */
923
+ dispatch(): Promise<GuardedBrowserDispatchResult<T>>;
924
+ }
925
+ /** Port implemented inside the isolated browser process. */
926
+ interface BrowserCheckoutTargetResolver<T> {
927
+ resolve(input: {
928
+ authorization: CheckoutActionAuthorization;
929
+ browserSessionId: string;
930
+ action: AgentCheckoutAction | BrowserCheckoutAction;
931
+ }): Promise<VerifiedBrowserCheckoutTarget<T> | null>;
932
+ }
933
+ interface CanonicalBrowserCheckoutTargetSnapshot {
934
+ pageUrl: string;
935
+ locator: string;
936
+ tagName: string;
937
+ role: string | null;
938
+ accessibleName: string | null;
939
+ targetUrl: string | null;
940
+ formAction: string | null;
941
+ opensNewPage: boolean;
942
+ disabled: boolean;
943
+ }
944
+ declare function canonicalizeBrowserCheckoutTarget(snapshot: BrowserCheckoutTargetSnapshot): CanonicalBrowserCheckoutTargetSnapshot;
945
+ /**
946
+ * Generates the exact opaque fingerprint sent as action.targetFingerprint.
947
+ * The raw DOM locator and target details stay inside the customer runtime.
948
+ */
949
+ declare function fingerprintBrowserCheckoutTarget(snapshot: BrowserCheckoutTargetSnapshot): string;
950
+ /**
951
+ * Creates a driver that re-resolves and verifies the exact DOM target after
952
+ * Conto's one-use claim and before the payment-sensitive browser side effect.
953
+ */
954
+ declare function createVerifiedBrowserCheckoutDriver<T>(resolver: BrowserCheckoutTargetResolver<T>): PrivilegedBrowserCheckoutDriver<T>;
955
+
470
956
  /**
471
957
  * Conto SDK
472
958
  *
@@ -491,10 +977,11 @@ declare class TeamClient {
491
977
  * // Execute if approved
492
978
  * if (request.status === 'APPROVED') {
493
979
  * const result = await conto.payments.execute(request.requestId);
494
- * console.log(`Payment sent: ${result.txHash}`);
980
+ * console.log(result.receipt?.txHash ? `Payment sent: ${result.receipt.txHash}` : `Payment ${result.status}`);
495
981
  * }
496
982
  * ```
497
983
  */
984
+
498
985
  interface ContoConfig {
499
986
  /** Your agent's SDK API key (conto_agent_xxx...) */
500
987
  apiKey: string;
@@ -514,8 +1001,20 @@ interface PaymentRequestInput {
514
1001
  purpose?: string;
515
1002
  /** Spend category for analytics */
516
1003
  category?: string;
517
- /** Additional context (will be stored) */
518
- context?: Record<string, unknown>;
1004
+ /** Typed invoice context associated with the payment */
1005
+ context?: {
1006
+ invoice?: {
1007
+ vendorId?: string;
1008
+ vendorAddress?: string;
1009
+ id?: string;
1010
+ hash?: string;
1011
+ sourceUrl?: string;
1012
+ payload?: unknown;
1013
+ expectedAmount?: number | string;
1014
+ currency?: string;
1015
+ dueDate?: string;
1016
+ };
1017
+ };
519
1018
  /** Specific wallet ID to use (optional) */
520
1019
  walletId?: string;
521
1020
  /** Payment urgency */
@@ -529,140 +1028,1242 @@ interface PaymentRequestInput {
529
1028
  /** Client-supplied key for idempotent retries */
530
1029
  idempotencyKey?: string;
531
1030
  }
532
- interface PaymentRequestResult {
533
- /** Unique request ID - use this to execute or check status */
534
- requestId: string;
535
- /** Current status */
536
- status: 'APPROVED' | 'DENIED' | 'REQUIRES_APPROVAL' | 'EXECUTED';
537
- /** True when the server returned a previously-created request for the same idempotency key */
538
- idempotent?: boolean;
539
- /** Wallet that will be used for payment (if approved) */
540
- wallet?: {
1031
+ interface AgentSetupResult {
1032
+ agent: {
1033
+ id: string;
1034
+ name: string;
1035
+ status: 'active' | 'paused' | 'unavailable';
1036
+ lastActiveAt: string | null;
1037
+ createdAt: string;
1038
+ };
1039
+ wallets: Array<{
541
1040
  id: string;
542
1041
  address: string;
1042
+ custodyMode: CustomerCustodyMode;
543
1043
  chainId: string;
544
- custodyType: string;
545
- availableBalance: number;
1044
+ chainName: string;
1045
+ chainType: string;
1046
+ isTestnet: boolean;
1047
+ balance: number;
1048
+ currency: string;
1049
+ status: 'active' | 'paused' | 'unavailable';
1050
+ limits: {
1051
+ perTransaction: number | null;
1052
+ daily: number | null;
1053
+ weekly: number | null;
1054
+ monthly: number | null;
1055
+ };
1056
+ spent: {
1057
+ today: number;
1058
+ thisWeek: number;
1059
+ thisMonth: number;
1060
+ };
1061
+ }>;
1062
+ policies: Array<{
1063
+ id: string;
1064
+ name: string;
1065
+ description: string | null;
1066
+ scope: 'organization' | 'assigned';
1067
+ appliesVia: string[];
1068
+ walletIds: string[];
1069
+ }>;
1070
+ counterparties: Array<{
1071
+ id: string;
1072
+ name: string;
1073
+ address: string;
1074
+ category: string;
1075
+ trustScore: number;
1076
+ trustLevel: 'trusted' | 'verified' | 'blocked' | 'unverified';
1077
+ transactionCount: number;
1078
+ totalVolume: number;
1079
+ }>;
1080
+ scopes: string[];
1081
+ }
1082
+ interface ExternalWalletApprovalInput {
1083
+ amount: number;
1084
+ senderAddress: string;
1085
+ recipientAddress: string;
1086
+ /** Numeric chain ID accepted by the external approval endpoint. */
1087
+ chainId: number | `${number}`;
1088
+ recipientName?: string;
1089
+ purpose?: string;
1090
+ category?: string;
1091
+ context?: PaymentRequestInput['context'];
1092
+ }
1093
+ interface ExternalWalletApprovalResult {
1094
+ approved: boolean;
1095
+ decision: 'approved' | 'review_required' | 'declined';
1096
+ status: 'ready_to_send' | 'review_required' | 'declined';
1097
+ /** Budget denials can occur before a request is created. */
1098
+ approvalId?: string;
1099
+ approvalToken?: string;
1100
+ expiresAt?: string;
1101
+ confirmUrl?: string;
1102
+ statusUrl?: string;
1103
+ approvalRequestId?: string;
1104
+ reasons: string[];
1105
+ reasonCodes: string[];
1106
+ requiresHumanApproval: boolean;
1107
+ network?: {
1108
+ type: 'evm' | 'solana';
1109
+ id: string;
546
1110
  };
1111
+ }
1112
+ interface ExternalWalletConfirmationInput {
1113
+ txHash: string;
1114
+ approvalToken?: string;
1115
+ }
1116
+ interface ExternalWalletConfirmationResult {
1117
+ accepted: true;
1118
+ confirmed: false;
1119
+ requestId: string;
1120
+ transactionId: string;
1121
+ status: 'processing';
1122
+ txHash: string;
1123
+ network: {
1124
+ type: 'evm' | 'solana';
1125
+ id: string;
1126
+ };
1127
+ explorerUrl: string;
1128
+ statusUrl: string;
1129
+ }
1130
+ interface PaymentRequestResult {
1131
+ /** Unique request ID - use this to execute or check status */
1132
+ requestId: string;
1133
+ /** Current status */
1134
+ status: 'APPROVED' | 'DENIED' | 'REQUIRES_APPROVAL' | 'ACTION_REQUIRED' | 'PROCESSING';
1135
+ /** Requested amount */
1136
+ amount: number;
1137
+ /** Currency selected for the payment */
1138
+ currency: string;
1139
+ /** Recipient wallet address */
1140
+ recipient: string;
1141
+ /** Customer-facing custody model for the selected payment wallet */
1142
+ custodyMode?: CustomerCustodyMode;
547
1143
  /** When the approval expires (ISO timestamp) */
548
1144
  expiresAt?: string;
549
- /** Explanation of the decision */
1145
+ /** Customer-facing explanation when action is required or the payment is denied */
550
1146
  reasons: string[];
551
- /** Policy violations (if denied) */
552
- violations?: PolicyViolation[];
553
- /** Currency used for the payment (e.g., 'USDC', 'USDC.e', 'pathUSD') */
554
- currency?: string;
555
- /** Chain information for the selected wallet */
556
- chain?: {
557
- chainId: string;
558
- chainName: string;
559
- chainType: string;
560
- explorerUrl: string;
561
- };
562
- /** URL to execute this payment (convenience) */
563
- executeUrl?: string;
564
- /** Session ID for tracking (used in x402/MPP flows) */
565
- sessionId?: string | null;
566
- /** Explanation of why this wallet was selected */
567
- walletSelectionReason?: string;
568
- /** If autoExecute was true and approved, contains the execution result */
569
- execution?: {
1147
+ /** Approval workflow reference when a team decision is required */
1148
+ approvalRequestId?: string;
1149
+ /** Stable URL for polling and reconciliation */
1150
+ statusUrl: string;
1151
+ /** Next URL to follow for the returned status */
1152
+ actionUrl?: string;
1153
+ /** Public receipt data when execution has started */
1154
+ receipt?: {
1155
+ /** Stable Conto transaction ID for status checks and reconciliation */
570
1156
  transactionId: string;
571
- txHash: string;
572
- explorerUrl: string;
573
- status: string;
574
- };
575
- /** If autoExecute failed, the payment is still approved and can be executed manually */
576
- autoExecuteError?: {
577
- error: string;
578
- code?: string;
579
- };
580
- /** Human-readable recovery hint for denied requests */
581
- hint?: string;
582
- /** Additional structured context for recovery or debugging */
583
- context?: {
584
- wallets?: Array<{
585
- id: string;
586
- address: string;
587
- chainId?: string | null;
588
- custodyType?: string | null;
589
- balance: number;
590
- }>;
591
- nextSteps?: string[];
1157
+ /** Present only for an onchain transfer. Simulations use transactionId. */
1158
+ txHash?: string;
1159
+ /** Whether this receipt represents live settlement or a test-mode payment */
1160
+ settlementMode: 'live' | 'test';
1161
+ explorerUrl?: string;
592
1162
  };
593
1163
  }
594
- interface PolicyViolation {
595
- type: string;
596
- limit: number;
597
- current: number;
598
- message: string;
599
- }
600
1164
  interface PaymentExecuteResult {
601
- /** Internal transaction ID */
602
- transactionId: string;
603
- /** Onchain transaction hash */
604
- txHash: string;
605
- /** Transaction status */
606
- status: 'CONFIRMING' | 'CONFIRMED' | 'FAILED';
1165
+ /** Payment request ID */
1166
+ requestId: string;
1167
+ /** Customer-facing execution state */
1168
+ status: 'processing' | 'completed';
607
1169
  /** Amount sent */
608
1170
  amount: number;
609
1171
  /** Currency (USDC) */
610
1172
  currency: string;
611
1173
  /** Recipient address */
612
1174
  recipient: string;
613
- /** Recipient name if provided */
614
- recipientName?: string;
615
- /** Wallet used */
616
- wallet: {
617
- address: string;
1175
+ /** Public transaction receipt */
1176
+ receipt: {
1177
+ /** Stable Conto transaction ID for status checks and reconciliation */
1178
+ transactionId: string;
1179
+ /** Present only for an onchain transfer. Simulations use transactionId. */
1180
+ txHash?: string;
1181
+ /** Whether this receipt represents live settlement or a test-mode payment */
1182
+ settlementMode: 'live' | 'test';
1183
+ explorerUrl?: string;
618
1184
  };
619
- /** Block explorer URL */
620
- explorerUrl: string;
621
1185
  }
622
1186
  interface PaymentStatusResult {
623
1187
  requestId: string;
624
- status: string;
625
- policyResult: string;
1188
+ /** Unknown for legacy records without execution evidence, or before execution. */
1189
+ settlementMode: 'live' | 'test' | 'unknown';
1190
+ status: 'approved' | 'declined' | 'review_required' | 'action_required' | 'reconciliation_required' | 'processing' | 'completed' | 'failed' | 'expired';
626
1191
  amount: number;
627
1192
  currency: string;
628
1193
  recipient: string;
629
- recipientName?: string;
1194
+ recipientName: string | null;
1195
+ purpose: string | null;
1196
+ category: string | null;
1197
+ expiresAt: string | null;
1198
+ createdAt: string;
1199
+ action: {
1200
+ type: 'complete_verification';
1201
+ url: string;
1202
+ } | null;
1203
+ transaction: {
1204
+ /** Stable Conto transaction ID */
1205
+ id: string;
1206
+ settlementMode: 'live' | 'test' | 'unknown';
1207
+ txHash: string | null;
1208
+ status: 'processing' | 'completed' | 'failed';
1209
+ confirmedAt: string | null;
1210
+ blockNumber: number | null;
1211
+ chain: {
1212
+ type: 'evm' | 'solana';
1213
+ id: string;
1214
+ };
1215
+ explorerUrl: string | null;
1216
+ detailsUrl: string;
1217
+ } | null;
1218
+ }
1219
+ interface ExternalCardOverlayEnforcement {
1220
+ enforcementMode: 'POLICY_OVERLAY';
1221
+ integrationMode: 'SDK_REQUIRED';
1222
+ canBypass: true;
1223
+ credentialStored: false;
1224
+ credentialReleased: false;
1225
+ executionResponsibility: 'CUSTOMER';
1226
+ transactionVerification: 'SELF_REPORTED';
1227
+ }
1228
+ interface ExternalCardApprovalInput {
1229
+ /** Stable caller-generated identifier, reused for every retry of this purchase intent. */
1230
+ idempotencyKey: string;
1231
+ cardId: string;
1232
+ amount: number;
1233
+ currency?: 'USD';
1234
+ merchantName: string;
1235
+ merchantId?: string;
1236
+ merchantCategory?: string;
1237
+ merchantAddress?: string;
1238
+ merchantCountry?: string;
630
1239
  purpose?: string;
631
- category?: string;
632
- wallet?: {
633
- address: string;
1240
+ context?: Record<string, unknown>;
1241
+ }
1242
+ interface ExternalCardApprovalResult {
1243
+ approved: boolean;
1244
+ decision: 'APPROVED' | 'DENIED' | 'REQUIRES_APPROVAL' | 'EXECUTING' | 'CONFIRMING' | 'COMPLETED' | 'EXPIRED' | 'CANCELLED';
1245
+ requestId: string;
1246
+ approvalToken?: string;
1247
+ expiresAt?: string;
1248
+ reasons: string[];
1249
+ replayed: boolean;
1250
+ transactionId?: string | null;
1251
+ card: {
1252
+ last4: string;
1253
+ brand: string | null;
1254
+ cardholderName: string | null;
634
1255
  };
1256
+ limits?: {
1257
+ remainingDaily: number;
1258
+ remainingPerTransaction: number;
1259
+ };
1260
+ enforcement: ExternalCardOverlayEnforcement;
1261
+ }
1262
+ interface ExternalCardExecutionClaimResult {
1263
+ requestId: string;
1264
+ claimed: boolean;
1265
+ replayed: boolean;
1266
+ state: string;
1267
+ reconciliationRequired: boolean;
1268
+ claimedAt?: string;
1269
+ enforcement: ExternalCardOverlayEnforcement;
1270
+ }
1271
+ interface ExternalCardRequestStatusResult {
1272
+ requestId: string;
1273
+ status: string;
1274
+ decision: string;
1275
+ amount: number;
1276
+ currency: string;
1277
+ merchantName: string | null;
1278
+ merchantId: string | null;
1279
+ merchantCategory: string | null;
1280
+ purpose: string | null;
1281
+ reasons: string[];
635
1282
  requiresApproval: boolean;
636
- approvedAt?: string;
637
- deniedAt?: string;
638
- denialReason?: string;
639
- expiresAt?: string;
640
- createdAt: string;
641
- transaction?: {
1283
+ reviewed: boolean;
1284
+ expiresAt: string | null;
1285
+ executionClaimedAt: string | null;
1286
+ reconciliationRequired: boolean;
1287
+ nextAction: 'WAIT_FOR_APPROVAL' | 'BEGIN_EXECUTION' | 'CONFIRM_OR_RECONCILE' | 'POLL' | 'NONE';
1288
+ transactionId: string | null;
1289
+ transaction: {
642
1290
  id: string;
643
- txHash: string;
644
1291
  status: string;
645
- confirmedAt?: string;
646
- blockNumber?: number;
1292
+ amount: number;
1293
+ currency: string;
1294
+ externalTxId: string | null;
1295
+ authorizedAt: string | null;
1296
+ } | null;
1297
+ enforcement: ExternalCardOverlayEnforcement;
1298
+ }
1299
+ interface ExternalCardConfirmationInput {
1300
+ approvalToken: string;
1301
+ /** Customer receipt, processor, or authorization reference. Never send PAN or CVC. */
1302
+ externalTxId: string;
1303
+ authorizationCode?: string;
1304
+ actualAmount?: number;
1305
+ /**
1306
+ * Verification/enrichment only. Policy-bearing merchant fields must match
1307
+ * the approval; confirmation cannot substitute the merchant, MCC, or country.
1308
+ */
1309
+ merchantDetails?: {
1310
+ name?: string;
1311
+ id?: string;
1312
+ category?: string;
1313
+ address?: string;
1314
+ city?: string;
1315
+ state?: string;
1316
+ country?: string;
1317
+ postalCode?: string;
647
1318
  };
648
1319
  }
649
- interface ContoError extends Error {
650
- code: string;
651
- status: number;
1320
+ interface ExternalCardConfirmationResult {
1321
+ confirmed: true;
1322
+ replayed: boolean;
1323
+ transactionId: string;
1324
+ status: string;
1325
+ amount: number;
1326
+ currency: string;
1327
+ verificationStatus: 'SELF_REPORTED';
1328
+ enforcement: ExternalCardOverlayEnforcement;
1329
+ }
1330
+ /**
1331
+ * Input delivered to the customer's credential-using executor. The callback is
1332
+ * invoked only after Conto approves the purchase. It deliberately excludes the
1333
+ * Conto approval token and all card credential fields.
1334
+ */
1335
+ interface ApprovedExternalCardExecution {
1336
+ requestId: string;
1337
+ /** Stable purchase key to pass through to the customer payment processor. */
1338
+ idempotencyKey: string;
1339
+ cardId: string;
1340
+ amount: number;
1341
+ currency: 'USD';
1342
+ merchantName: string;
1343
+ merchantId?: string;
1344
+ merchantCategory?: string;
1345
+ merchantAddress?: string;
1346
+ merchantCountry?: string;
1347
+ purpose?: string;
1348
+ context?: Record<string, unknown>;
1349
+ }
1350
+ interface ExternalCardExecutionResult<TReceipt = unknown> {
1351
+ externalTxId: string;
1352
+ authorizationCode?: string;
1353
+ actualAmount?: number;
1354
+ merchantDetails?: ExternalCardConfirmationInput['merchantDetails'];
1355
+ receipt: TReceipt;
1356
+ }
1357
+ type ExternalCardExecutor<TReceipt = unknown> = (approvedPurchase: ApprovedExternalCardExecution) => Promise<ExternalCardExecutionResult<TReceipt>>;
1358
+ interface ControlledExternalCardPaymentResult<TReceipt = unknown> {
1359
+ approval: ExternalCardApprovalResult;
1360
+ confirmation: ExternalCardConfirmationResult;
1361
+ receipt: TReceipt;
1362
+ }
1363
+ interface ConnectedCardDrawMerchant {
1364
+ /** Merchant name for policy evaluation. */
1365
+ merchantName?: string;
1366
+ /** Network merchant identifier. */
1367
+ merchantId?: string;
1368
+ /** Four-digit MCC string (e.g. "5411"). */
1369
+ merchantCategory?: string;
1370
+ /** Two- or three-letter country code. */
1371
+ merchantCountry?: string;
1372
+ }
1373
+ interface ConnectedCardDrawInput {
1374
+ /** Connected card id delegated to this agent. */
1375
+ cardId: string;
1376
+ /** Verified mandate id the draw is charged against. */
1377
+ mandateId: string;
1378
+ /**
1379
+ * Stable 8 to 128 character key. The server is idempotent on this key: a
1380
+ * replay of the same key returns the decision WITHOUT the credential, so
1381
+ * reuse it only to reconcile the exact same draw, never to fetch the card
1382
+ * material again.
1383
+ */
1384
+ idempotencyKey: string;
1385
+ /** Integer amount in minor units (cents), greater than zero. */
1386
+ amountMinor: number;
1387
+ /** Only USD is supported. Defaults to USD. */
1388
+ currency?: 'USD';
1389
+ merchant: ConnectedCardDrawMerchant;
1390
+ }
1391
+ /**
1392
+ * Live single-use card material returned by {@link ConnectedCardsClient.draw}.
1393
+ *
1394
+ * CREDENTIAL SAFETY (this is the product boundary): these fields are the real,
1395
+ * usable card. They are returned exactly ONCE, on the successful mint, and can
1396
+ * never be re-fetched. A replay of the same idempotencyKey returns the decision
1397
+ * with no `credential`. Use these fields in-process at the intended merchant
1398
+ * checkout only. Never log, print, serialize, persist, cache, or send them
1399
+ * anywhere else. Do not place this object in an error, a Sentry breadcrumb, an
1400
+ * analytics event, or any structured output that a host might record.
1401
+ */
1402
+ interface ConnectedCardCredential {
1403
+ /** The card number (PAN). Live card material. */
1404
+ number: string;
1405
+ /** The card security value. Live card material. */
1406
+ securityValue: string;
1407
+ expirationMonth: string;
1408
+ expirationYear: string;
1409
+ cardholderName?: string;
1410
+ }
1411
+ interface ConnectedCardDrawResult {
1412
+ requestId: string;
1413
+ /** True when this draw has issued a credential, including a replay without the secret. */
1414
+ minted: boolean;
1415
+ /** True when this call replayed a prior draw for the same idempotencyKey. */
1416
+ replayed: boolean;
1417
+ decision: 'APPROVED' | 'DENIED' | 'REQUIRES_APPROVAL';
1418
+ reasons: string[];
1419
+ /** Present when the draw outcome is ambiguous and needs reconciliation. */
1420
+ reconciliationRequired?: boolean;
1421
+ /**
1422
+ * Live single-use card material. Present ONLY on a successful mint and
1423
+ * returned exactly once. Absent on a replay, a denial, or a review decision.
1424
+ * See {@link ConnectedCardCredential} for the handling rules.
1425
+ */
1426
+ credential?: ConnectedCardCredential;
1427
+ /** Provider expiration of the one-time credential; present with a fresh credential. */
1428
+ credentialExpiresAt?: string;
1429
+ }
1430
+ interface ConnectedCardMandateMerchant {
1431
+ name: string | null;
1432
+ categoryCode: string | null;
1433
+ countryCode: string | null;
1434
+ checkoutOrigin: string | null;
1435
+ }
1436
+ interface ConnectedCardMandate {
1437
+ id: string;
1438
+ providerReferenceId: string;
1439
+ bindingId: string;
1440
+ status: string;
1441
+ verificationStatus: string;
1442
+ amountMinor: number;
1443
+ currency: string;
1444
+ description: string;
1445
+ merchant: ConnectedCardMandateMerchant;
1446
+ expiresAt: string;
1447
+ verifiedAt: string | null;
1448
+ exhaustedAt: string | null;
1449
+ revokedAt: string | null;
1450
+ createdAt: string;
1451
+ updatedAt: string;
1452
+ }
1453
+ interface ConnectedCardBrief {
1454
+ last4: string;
1455
+ brand: string | null;
1456
+ fundingType: string;
1457
+ cardType: string;
1458
+ status: string;
1459
+ spendLimitDaily: number | null;
1460
+ spendLimitWeekly: number | null;
1461
+ spendLimitMonthly: number | null;
1462
+ spendLimitPerTx: number | null;
1463
+ }
1464
+ interface ConnectedCardReference {
1465
+ id: string;
1466
+ provider: string;
1467
+ lifecycleState: string;
1468
+ railStatus: string | null;
1469
+ }
1470
+ interface ConnectedCardDrawable {
1471
+ bindingId: string;
1472
+ agentId: string;
1473
+ status: string;
1474
+ cardId: string;
1475
+ reference: ConnectedCardReference;
1476
+ card: ConnectedCardBrief;
1477
+ mandates: ConnectedCardMandate[];
1478
+ createdAt: string;
1479
+ updatedAt: string;
1480
+ }
1481
+ interface ConnectedCardListResult {
1482
+ /** Masked drawable cards and their active mandates. No PAN or provider token. */
1483
+ cards: ConnectedCardDrawable[];
1484
+ }
1485
+ interface StripeLinkPaymentMethod {
1486
+ id: string;
1487
+ type: string;
1488
+ isDefault: boolean;
1489
+ displayLabel: string;
1490
+ last4?: string;
1491
+ eligibleCredentialTypes: string[];
1492
+ }
1493
+ interface ListStripeLinkPaymentMethodsResult {
1494
+ /** Authenticated tenant context, returned so operators can verify a target before writes. */
1495
+ organizationId: string;
1496
+ connectionId: string;
1497
+ /** Masked Link payment methods eligible for the bound agent. */
1498
+ paymentMethods: StripeLinkPaymentMethod[];
1499
+ }
1500
+ type CommerceTotalType = 'subtotal' | 'tax' | 'total' | 'items_base_amount' | 'items_discount' | 'discount' | 'fulfillment' | 'shipping' | 'fee' | 'gift_wrap' | 'tip' | 'store_credit';
1501
+ interface CommerceLineItemInput {
1502
+ name: string;
1503
+ quantity: number;
1504
+ unitAmountMinor: number;
1505
+ description?: string;
1506
+ sku?: string;
1507
+ productUrl?: string;
1508
+ }
1509
+ interface CommerceTotalInput {
1510
+ type: CommerceTotalType;
1511
+ label: string;
1512
+ amountMinor: number;
1513
+ }
1514
+ interface CommerceFulfillmentInput {
1515
+ recipient?: string;
1516
+ addressLine1?: string;
1517
+ addressLine2?: string;
1518
+ locality?: string;
1519
+ region?: string;
1520
+ postalCode?: string;
1521
+ countryCode?: string;
1522
+ }
1523
+ /** Exact Stripe Link purchase intent evaluated and bound by Conto policy. */
1524
+ interface BeginCommerceExecutionCommonInput {
1525
+ /** Stable key for this exact intent. Reuse it when reconciling or retrying begin. */
1526
+ idempotencyKey: string;
1527
+ intentId?: string;
1528
+ /** Integer amount in minor units (cents). */
1529
+ amountMinor: number;
1530
+ currency: 'USD';
1531
+ purpose: string;
1532
+ /** Optional semantic policy category, such as OFFICE_SUPPLIES. */
1533
+ category?: string;
1534
+ cart: {
1535
+ lineItems: CommerceLineItemInput[];
1536
+ totals: CommerceTotalInput[];
1537
+ fulfillment?: CommerceFulfillmentInput;
1538
+ };
1539
+ providerPresentation: {
1540
+ approvalSummary: string;
1541
+ lineItemLabels: string[];
1542
+ };
1543
+ }
1544
+ type AgentCheckoutActionKind = 'INITIATE_CHECKOUT' | 'OPEN_LINK' | 'CONFIRM_PAYMENT' | 'PLACE_ORDER';
1545
+ interface BrowserCheckoutAction {
1546
+ kind: AgentCheckoutActionKind;
1547
+ checkoutMethod: CommerceCheckoutMethod;
1548
+ pageUrl: string;
1549
+ /** Runtime-generated fingerprint of the exact DOM/action target. */
1550
+ targetFingerprint: string;
1551
+ targetUrl?: string;
1552
+ targetLabel?: string;
1553
+ }
1554
+ interface AgentCheckoutAction extends Omit<BrowserCheckoutAction, 'checkoutMethod'> {
1555
+ /** @deprecated Compatibility marker for executionMethod: 'AGENT_CHECKOUT'. */
1556
+ provider: 'STRIPE_LINK';
1557
+ checkoutMethod?: CommerceCheckoutMethod;
1558
+ }
1559
+ type BeginConnectedLinkExecutionInput = BeginCommerceExecutionCommonInput & {
1560
+ connectionId: string;
1561
+ paymentMethodId: string;
1562
+ };
1563
+ type BeginCommerceExecutionInput = (BeginConnectedLinkExecutionInput & {
1564
+ /** Primary path: the server resolves the immutable Stripe seller profile. */
1565
+ executionMethod: 'STRIPE_PAYMENT_INTENT';
1566
+ counterparty: {
1567
+ canonicalId: string;
1568
+ displayName: string;
1569
+ };
1570
+ }) | (BeginConnectedLinkExecutionInput & {
1571
+ /** Optional compatibility transport for a configured MPP merchant. */
1572
+ executionMethod?: 'MPP';
1573
+ counterparty: {
1574
+ canonicalId: string;
1575
+ displayName: string;
1576
+ checkoutUrl: string;
1577
+ mppNetworkId: string;
1578
+ };
1579
+ }) | (BeginCommerceExecutionCommonInput & {
1580
+ /** Public Stripe-hosted Checkout with Link offered when eligible. */
1581
+ executionMethod: 'LINK_CHECKOUT';
1582
+ counterparty: {
1583
+ /** Identifier for the merchant profile configured by the Conto operator. */
1584
+ canonicalId: string;
1585
+ };
1586
+ }) | (BeginCommerceExecutionCommonInput & {
1587
+ /** Merchant-independent guard for an exact privileged browser action. */
1588
+ executionMethod: 'AGENT_CHECKOUT';
1589
+ browserSessionId: string;
1590
+ action: AgentCheckoutAction;
1591
+ counterparty: {
1592
+ canonicalId: string;
1593
+ displayName: string;
1594
+ checkoutUrl: string;
1595
+ };
1596
+ }) | (BeginCommerceExecutionCommonInput & {
1597
+ /** Provider-neutral guard for one exact privileged browser action. */
1598
+ executionMethod: 'BROWSER_CHECKOUT';
1599
+ browserSessionId: string;
1600
+ action: BrowserCheckoutAction;
1601
+ counterparty: {
1602
+ canonicalId: string;
1603
+ displayName: string;
1604
+ checkoutUrl: string;
1605
+ };
1606
+ });
1607
+ type CommerceExecutionStatus = 'DRAFT' | 'ACTION_REQUIRED' | 'AUTHORIZING' | 'AWAITING_APPROVAL' | 'READY' | 'PROCESSING' | 'SETTLED' | 'COMPLETED' | 'DENIED' | 'CANCELLED' | 'FAILED' | 'RETURNED' | 'EXPIRED' | 'NEEDS_RECONCILIATION';
1608
+ type CommerceExecutionProvider = 'STABLECOIN' | 'TOKENIZED_CARD' | 'STRIPE_LINK';
1609
+ type CommerceExecutionChannel = 'BROWSER' | 'MERCHANT_API' | 'CREDENTIAL_BROKER' | 'BANK_API' | 'WALLET_SIGNER';
1610
+ type CommerceCheckoutMethod = 'LINK' | 'CARD' | 'SHOP_PAY' | 'PAYPAL';
1611
+ type CommerceSettlementRail = 'CARD' | 'ACH' | 'WIRE' | 'STABLECOIN';
1612
+ type CommerceProposalState = 'DRAFT' | 'NEEDS_CONTEXT' | 'READY_FOR_POLICY' | 'CANCELLED';
1613
+ type CommerceProposalMissingFact = 'AGENT' | 'AMOUNT' | 'CURRENCY' | 'PURPOSE' | 'COUNTERPARTY_ID' | 'COUNTERPARTY_NAME' | 'CART_LINE_ITEMS' | 'CART_TOTAL' | 'PROVIDER_PRESENTATION';
1614
+ type CommerceFactSource = 'USER_ASSERTED' | 'AGENT_INFERRED' | 'BROWSER_OBSERVED' | 'MERCHANT_SIGNED' | 'PROVIDER_CONFIRMED' | 'ISSUER_CONFIRMED';
1615
+ type CommerceFactConfidence = 'LOW' | 'MEDIUM' | 'HIGH' | 'VERIFIED';
1616
+ type CommerceProposalFactKey = 'AMOUNT' | 'CURRENCY' | 'PURPOSE' | 'CATEGORY' | 'COUNTERPARTY' | 'CART' | 'EXECUTION';
1617
+ interface CommerceFactProvenanceInput {
1618
+ source: CommerceFactSource;
1619
+ confidence: CommerceFactConfidence;
1620
+ observedAt?: string;
1621
+ evidenceFingerprint?: string;
1622
+ }
1623
+ interface NormalizeCommerceProposalInput {
1624
+ /** Stable caller-selected key for this evolving proposal. */
1625
+ proposalKey: string;
1626
+ proposalId?: string;
1627
+ /** Zero for a caller-confirmed create, or the exact revision being replaced. */
1628
+ expectedRevision?: number;
1629
+ draft?: boolean;
1630
+ amountMinor?: number;
1631
+ maximumAmountMinor?: number;
1632
+ currency?: string;
1633
+ purpose?: string;
1634
+ category?: string;
1635
+ counterparty?: {
1636
+ canonicalId?: string;
1637
+ displayName?: string;
1638
+ checkoutUrl?: string;
1639
+ };
1640
+ cart?: {
1641
+ lineItems?: CommerceLineItemInput[];
1642
+ totals?: CommerceTotalInput[];
1643
+ fulfillment?: CommerceFulfillmentInput;
1644
+ };
1645
+ providerPresentation?: {
1646
+ approvalSummary: string;
1647
+ lineItemLabels: string[];
1648
+ };
1649
+ execution?: {
1650
+ executionChannel?: CommerceExecutionChannel;
1651
+ checkoutMethod?: CommerceCheckoutMethod;
1652
+ settlementRail?: CommerceSettlementRail;
1653
+ };
1654
+ provenance?: Partial<Record<CommerceProposalFactKey, CommerceFactProvenanceInput>>;
1655
+ /** Organization-registered semantic facts validated before policy evaluation. */
1656
+ extensions?: Array<{
1657
+ namespace: string;
1658
+ value: unknown;
1659
+ }>;
1660
+ }
1661
+ interface CommerceContextRequirement {
1662
+ fact: CommerceProposalMissingFact;
1663
+ reasonCode: `MISSING_${CommerceProposalMissingFact}`;
1664
+ prompt: string;
1665
+ }
1666
+ interface CommerceProposalResolution {
1667
+ proposal: {
1668
+ id: string;
1669
+ organizationId: string;
1670
+ actorUserId: string;
1671
+ agentId?: string;
1672
+ state: CommerceProposalState;
1673
+ amountMinor?: number;
1674
+ maximumAmountMinor?: number;
1675
+ currency?: string;
1676
+ purpose?: string;
1677
+ category?: string;
1678
+ counterparty?: NormalizeCommerceProposalInput['counterparty'];
1679
+ cart?: NormalizeCommerceProposalInput['cart'];
1680
+ providerPresentation?: NormalizeCommerceProposalInput['providerPresentation'];
1681
+ execution?: NormalizeCommerceProposalInput['execution'];
1682
+ provenance: Partial<Record<CommerceProposalFactKey, CommerceFactProvenanceInput>>;
1683
+ extensions: Array<{
1684
+ namespace: string;
1685
+ value: unknown;
1686
+ schemaRevision?: number;
1687
+ schemaFingerprint?: string;
1688
+ }>;
1689
+ missingFacts: CommerceProposalMissingFact[];
1690
+ };
1691
+ proposalFingerprint: string;
1692
+ /** Durable, monotonically increasing proposal revision. */
1693
+ revision: number;
1694
+ /** True only when this request created the proposal head. */
1695
+ created: boolean;
1696
+ outcome: 'NEEDS_CONTEXT' | 'READY_FOR_POLICY';
1697
+ requirements: CommerceContextRequirement[];
1698
+ nextAction: 'COLLECT_CONTEXT' | 'BEGIN_POLICY_EVALUATION';
1699
+ }
1700
+ type CommerceExecutionAdapterKind = 'STABLECOIN' | 'TOKENIZED_CARD' | 'STRIPE_LINK' | 'LINK_CHECKOUT' | 'CHECKOUT_GUARD';
1701
+ type CommerceExecutionSourceKind = 'STABLECOIN_WALLET' | 'TOKENIZED_CARD' | 'STRIPE_LINK' | 'STRIPE_LINK_CHECKOUT' | 'AGENT_BROWSER_CHECKOUT';
1702
+ type CommerceExecutionArtifactKind = 'CARD' | 'LINK_PAY_TOKEN' | 'SHARED_PAYMENT_TOKEN';
1703
+ type CommerceExecutionDeliveryMode = 'SERVER_ONLY_ARTIFACT' | 'PROVIDER_DIRECT' | 'USER_INTERACTIVE';
1704
+ type CommerceExecutionConstraint = 'AMOUNT' | 'CURRENCY' | 'COUNTERPARTY' | 'CART' | 'PURPOSE' | 'EXPIRY' | 'SINGLE_USE';
1705
+ type CommerceExecutionConstraintCoverageLevel = 'UNSUPPORTED' | 'OBSERVE_ONLY' | 'CONTO_PRECHECK' | 'PROVIDER_ENFORCED';
1706
+ type CommerceExecutionConstraintCoverage = Readonly<Record<CommerceExecutionConstraint, CommerceExecutionConstraintCoverageLevel>>;
1707
+ /** Provider-independent, allowlisted evidence. It contains no Link credential material. */
1708
+ interface CommerceExecutionEvidence {
1709
+ schemaVersion: 'conto.commerce-evidence.v1';
1710
+ traceId: string;
1711
+ executionId: string;
1712
+ intentId: string;
1713
+ organizationId: string;
1714
+ actorUserId: string;
1715
+ agentId?: string;
1716
+ provider: CommerceExecutionProvider;
1717
+ sourceKind: CommerceExecutionSourceKind;
1718
+ amountMinor: number;
1719
+ currency: string;
1720
+ purpose: string;
1721
+ counterpartyId: string;
1722
+ counterpartyName: string;
1723
+ intentFingerprint: string;
1724
+ policyDecisionId: string;
1725
+ policySnapshotHash: string;
1726
+ grantId: string;
1727
+ deliveryMode?: CommerceExecutionDeliveryMode;
1728
+ artifactKind?: CommerceExecutionArtifactKind;
1729
+ enforcementCoverage?: CommerceExecutionConstraintCoverage;
1730
+ status: CommerceExecutionStatus;
1731
+ providerStatus?: string;
1732
+ providerReference?: string;
1733
+ transactionReference?: string;
1734
+ checkoutReference?: string;
1735
+ /** Actual method observed after Stripe settlement; Link cannot be forced to display or win. */
1736
+ actualPaymentMethod?: 'LINK' | 'CARD';
1737
+ browserAction?: {
1738
+ kind: AgentCheckoutActionKind;
1739
+ provider: 'STRIPE_LINK';
1740
+ checkoutMethod?: CommerceCheckoutMethod;
1741
+ trustPolicyRevision?: number;
1742
+ trustPolicyFingerprint?: string;
1743
+ merchantOrigin: string;
1744
+ actionFingerprint: string;
1745
+ };
1746
+ refund?: {
1747
+ amountMinor: number;
1748
+ currency: string;
1749
+ state: string;
1750
+ };
1751
+ }
1752
+ /** Safe execution projection. Raw provider responses and payment artifacts are excluded. */
1753
+ interface CommerceExecution {
1754
+ id: string;
1755
+ intentId: string;
1756
+ organizationId: string;
1757
+ agentId?: string;
1758
+ provider: CommerceExecutionProvider;
1759
+ /** Execution path selected before settlement; distinct from actualPaymentMethod. */
1760
+ executionAdapter: CommerceExecutionAdapterKind;
1761
+ /** Provider-neutral channel that must consume the Conto authorization. */
1762
+ executionChannel: CommerceExecutionChannel;
1763
+ /** Selected checkout method, or the method observed after a dynamic checkout settles. */
1764
+ checkoutMethod?: CommerceCheckoutMethod;
1765
+ /** Expected settlement rail when the current execution source establishes it. */
1766
+ settlementRail?: CommerceSettlementRail;
1767
+ status: CommerceExecutionStatus;
1768
+ providerStatus?: string;
1769
+ providerReference?: string;
1770
+ /** Sanitized Link approval or Stripe-hosted Checkout URL. */
1771
+ approvalUrl?: string;
1772
+ artifactKind?: CommerceExecutionArtifactKind;
1773
+ deliveryMode?: CommerceExecutionDeliveryMode;
1774
+ amountMinor: number;
1775
+ currency: string;
1776
+ purpose: string;
1777
+ category?: string;
1778
+ counterparty: {
1779
+ id: string;
1780
+ name: string;
1781
+ };
1782
+ evidence: CommerceExecutionEvidence;
1783
+ evidenceFingerprint: string;
1784
+ }
1785
+ interface CommerceExecutionResult {
1786
+ execution: CommerceExecution;
1787
+ }
1788
+ interface ExecuteCommerceExecutionResult extends CommerceExecutionResult {
1789
+ checkout: {
1790
+ submitted: boolean;
1791
+ deliveryMode: 'SERVER_ONLY_ARTIFACT';
1792
+ accepted: boolean;
1793
+ } | {
1794
+ submitted: true;
1795
+ deliveryMode: 'PROVIDER_DIRECT';
1796
+ };
1797
+ }
1798
+ interface CheckoutActionAuthorization {
1799
+ /** Durable single-use record consumed by the privileged browser runtime. */
1800
+ authorizationId: string;
1801
+ executionId: string;
1802
+ browserSessionId: string;
1803
+ grantId: string;
1804
+ intentFingerprint: string;
1805
+ actionFingerprint: string;
1806
+ merchantOrigin: string;
1807
+ actionKind: AgentCheckoutActionKind;
1808
+ provider: 'STRIPE_LINK';
1809
+ checkoutMethod?: CommerceCheckoutMethod;
1810
+ expiresAt: string;
1811
+ singleUse: true;
1812
+ }
1813
+ interface AuthorizeCheckoutActionResult extends CommerceExecutionResult {
1814
+ authorization: CheckoutActionAuthorization;
1815
+ }
1816
+ interface BrowserActionClaimResult {
1817
+ authorization: {
1818
+ authorizationId: string;
1819
+ state: 'DISPATCHING';
1820
+ actionFingerprint: string;
1821
+ expiresAt: string;
1822
+ };
1823
+ }
1824
+ interface BrowserActionFinalizeResult {
1825
+ authorization: {
1826
+ authorizationId: string;
1827
+ state: 'CONSUMED' | 'INDETERMINATE';
1828
+ };
1829
+ }
1830
+ interface BrowserActionDispatchObservationInput {
1831
+ reference: string;
1832
+ observedAt: string;
1833
+ pageUrl: string;
1834
+ }
1835
+ interface GuardCheckoutResult<T> extends AuthorizeCheckoutActionResult {
1836
+ result: T;
1837
+ }
1838
+ interface GuardedBrowserDispatchResult<T> {
1839
+ result: T;
1840
+ observation: BrowserActionDispatchObservationInput;
1841
+ }
1842
+ type GuardedCheckoutInput = Extract<BeginCommerceExecutionInput, {
1843
+ executionMethod: 'AGENT_CHECKOUT' | 'BROWSER_CHECKOUT';
1844
+ }>;
1845
+ /** Privileged runtime port; the agent model must not receive this driver directly. */
1846
+ interface PrivilegedBrowserCheckoutDriver<T> {
1847
+ dispatch(input: {
1848
+ authorization: CheckoutActionAuthorization;
1849
+ browserSessionId: string;
1850
+ action: AgentCheckoutAction | BrowserCheckoutAction;
1851
+ }): Promise<GuardedBrowserDispatchResult<T>>;
1852
+ }
1853
+ interface RunGuardedCheckoutResult<T> extends GuardCheckoutResult<T> {
1854
+ dispatchAttemptId: string;
1855
+ observation: BrowserActionDispatchObservationInput;
1856
+ }
1857
+ interface ProtocolPreAuthorizeResult {
1858
+ authorized: boolean;
1859
+ decision: 'approved' | 'declined' | 'review_required';
1860
+ message: string;
1861
+ }
1862
+ interface X402PreAuthorizeInput {
1863
+ amount: number;
1864
+ recipientAddress: string;
1865
+ resourceUrl: string;
1866
+ context?: {
1867
+ department?: string;
1868
+ project?: string;
1869
+ };
1870
+ facilitator?: string;
1871
+ scheme?: string;
1872
+ /** Customer-supplied ID used to group authorization, recording, and spend reporting. */
1873
+ sessionId?: string;
1874
+ paymentId?: string;
1875
+ /** Exact wallet address that will sign. Provide together with network. */
1876
+ payerAddress?: string;
1877
+ /** CAIP-2 network from the x402 challenge, for example eip155:8453. */
1878
+ network?: string;
1879
+ }
1880
+ interface X402PreAuthorizeResult extends ProtocolPreAuthorizeResult {
1881
+ x402: {
1882
+ serviceDomain?: string;
1883
+ amount: number;
1884
+ sessionId?: string;
1885
+ };
1886
+ }
1887
+ interface X402RecordInput {
1888
+ amount: number;
1889
+ currency?: string;
1890
+ recipientAddress: string;
1891
+ txHash: string;
1892
+ resourceUrl: string;
1893
+ /** Stable x402 payment identifier. Reuse this value to reconcile an ambiguous failure. */
1894
+ paymentId: string;
1895
+ /** Customer-supplied ID used to group related x402 payments. */
1896
+ sessionId?: string;
1897
+ /** Exact wallet address that signed. Provide together with network. */
1898
+ payerAddress?: string;
1899
+ /** CAIP-2 network from the x402 challenge, for example eip155:8453. */
1900
+ network?: string;
1901
+ context?: {
1902
+ department?: string;
1903
+ project?: string;
1904
+ };
1905
+ batchItems?: Array<{
1906
+ amount: number;
1907
+ resourceUrl: string;
1908
+ paymentId: string;
1909
+ }>;
1910
+ }
1911
+ interface X402RecordResult {
1912
+ recorded: true;
1913
+ confirmed: true;
1914
+ txHash: string;
1915
+ explorerUrl: string;
1916
+ sessionId?: string;
1917
+ }
1918
+ interface MppPreAuthorizeInput {
1919
+ amount: number;
1920
+ recipientAddress: string;
1921
+ resourceUrl: string;
1922
+ context?: {
1923
+ department?: string;
1924
+ project?: string;
1925
+ };
1926
+ intent?: 'charge' | 'session';
1927
+ depositAmount?: number;
1928
+ /** Customer-supplied ID used to group authorization, recording, and spend reporting. */
1929
+ sessionId?: string;
1930
+ scheme?: string;
1931
+ credentialId?: string;
1932
+ challengeId?: string;
1933
+ paymentMethod?: string;
1934
+ }
1935
+ interface MppPreAuthorizeResult extends ProtocolPreAuthorizeResult {
1936
+ mpp: {
1937
+ serviceDomain?: string;
1938
+ amount: number;
1939
+ sessionId?: string;
1940
+ };
1941
+ }
1942
+ interface MppRecordInput {
1943
+ amount: number;
1944
+ currency?: string;
1945
+ recipientAddress: string;
1946
+ txHash?: string;
1947
+ resourceUrl: string;
1948
+ /** Stable MPP credential identifier. Reuse this value to reconcile an ambiguous failure. */
1949
+ credentialId: string;
1950
+ /** Customer-supplied ID used to group related MPP payments. */
1951
+ sessionId?: string;
1952
+ context?: {
1953
+ department?: string;
1954
+ project?: string;
1955
+ };
1956
+ paymentReceipt?: string;
1957
+ intent?: 'charge' | 'session';
1958
+ scheme?: string;
1959
+ challengeId?: string;
1960
+ paymentMethod?: string;
1961
+ depositAmount?: number;
1962
+ batchItems?: Array<{
1963
+ amount: number;
1964
+ resourceUrl: string;
1965
+ credentialId: string;
1966
+ }>;
1967
+ }
1968
+ interface MppRecordResult {
1969
+ recorded: true;
1970
+ txHash?: string;
1971
+ explorerUrl?: string;
1972
+ sessionId?: string;
1973
+ }
1974
+ interface ProtocolBudgetResult {
1975
+ spend: {
1976
+ daily: {
1977
+ calls: number;
1978
+ amount: number;
1979
+ };
1980
+ weekly: {
1981
+ calls: number;
1982
+ amount: number;
1983
+ };
1984
+ monthly: {
1985
+ calls: number;
1986
+ amount: number;
1987
+ };
1988
+ session: {
1989
+ sessionId: string;
1990
+ calls: number;
1991
+ amount: number;
1992
+ } | null;
1993
+ };
1994
+ limits: {
1995
+ daily: number | null;
1996
+ weekly: number | null;
1997
+ monthly: number | null;
1998
+ perPayment: number | null;
1999
+ };
2000
+ trend: {
2001
+ spendPerHour: number;
2002
+ callsPerHour: number;
2003
+ averageCost: number;
2004
+ estimatedHoursRemaining: number | null;
2005
+ };
2006
+ }
2007
+ type X402BudgetResult = ProtocolBudgetResult;
2008
+ type MppBudgetResult = ProtocolBudgetResult;
2009
+ interface ProtocolServiceSummary {
2010
+ domain: string;
2011
+ name: string | null;
2012
+ totalCalls: number;
2013
+ totalSpend: number;
2014
+ averageCost: number;
2015
+ lastUsedAt: string | null;
2016
+ recent: {
2017
+ calls: number;
2018
+ spend: number;
2019
+ averageCost: number;
2020
+ };
2021
+ }
2022
+ interface ProtocolServicesResult {
2023
+ services: ProtocolServiceSummary[];
2024
+ summary: {
2025
+ serviceCount: number;
2026
+ totalCalls: number;
2027
+ totalSpend: number;
2028
+ averageCost: number;
2029
+ };
2030
+ period: '24h' | '7d' | '30d' | '90d';
2031
+ }
2032
+ declare class ContoError extends Error {
2033
+ readonly code: string;
2034
+ readonly status: number;
2035
+ readonly requestId?: string;
2036
+ readonly retryAfter?: number;
2037
+ readonly retryGuidance?: string;
2038
+ readonly actionUrl?: string;
2039
+ readonly fieldErrors?: ApiErrorMetadata['fieldErrors'];
2040
+ readonly reasons?: string[];
2041
+ constructor(message: string, metadata: ApiErrorMetadata);
2042
+ }
2043
+ /**
2044
+ * The customer executor returned a receipt, but Conto did not acknowledge the
2045
+ * confirmation. Persist confirmationInput and retry cards.confirm(); never run
2046
+ * the customer executor again for this request.
2047
+ */
2048
+ declare class ExternalCardConfirmationPendingError<TReceipt = unknown> extends ContoError {
2049
+ readonly confirmationInput: ExternalCardConfirmationInput;
2050
+ readonly receipt: TReceipt;
2051
+ constructor(requestId: string, confirmationInput: ExternalCardConfirmationInput, receipt: TReceipt);
2052
+ }
2053
+ /**
2054
+ * The privileged browser action ran, but Conto did not acknowledge its final
2055
+ * observation. Retry finalizeBrowserAction with these exact fields; never run
2056
+ * the browser action again.
2057
+ */
2058
+ declare class BrowserActionFinalizationPendingError<TResult = unknown> extends ContoError {
2059
+ readonly authorizationId: string;
2060
+ readonly dispatchAttemptId: string;
2061
+ readonly result: TResult;
2062
+ readonly observation: BrowserActionDispatchObservationInput;
2063
+ constructor(input: {
2064
+ authorizationId: string;
2065
+ dispatchAttemptId: string;
2066
+ result: TResult;
2067
+ observation: BrowserActionDispatchObservationInput;
2068
+ });
2069
+ }
2070
+ interface ContoRequestOptions {
2071
+ /** Set only when repeating this request cannot create an additional side effect. */
2072
+ idempotent?: boolean;
2073
+ /** Number of retries after the initial attempt. Defaults to 3. */
2074
+ maxRetries?: number;
652
2075
  }
653
2076
  declare class Conto {
654
2077
  private apiKey;
655
2078
  private baseUrl;
656
2079
  private timeout;
657
2080
  payments: PaymentsClient;
2081
+ cards: CardsClient;
2082
+ connectedCards: ConnectedCardsClient;
2083
+ x402: X402Client;
2084
+ mpp: MppClient;
658
2085
  constructor(config: ContoConfig);
659
- private fetchWithRetry;
660
- /** Make an authenticated request to the Giro API */
661
- request<T>(method: string, path: string, body?: Record<string, unknown>): Promise<T>;
2086
+ /**
2087
+ * List masked Link payment methods for a session-created connection that is
2088
+ * explicitly bound to this agent. No Link token or payment artifact is
2089
+ * returned through the agent SDK.
2090
+ */
2091
+ listStripeLinkPaymentMethods(connectionId: string): Promise<ListStripeLinkPaymentMethodsResult>;
2092
+ /**
2093
+ * Normalize and durably revise a partial agent purchase proposal without
2094
+ * creating a payment side effect. Missing facts return as NEEDS_CONTEXT
2095
+ * requirements; changed writes require the exact prior revision.
2096
+ */
2097
+ normalizeCommerceProposal(input: NormalizeCommerceProposalInput): Promise<CommerceProposalResolution>;
2098
+ /** Reload one durable proposal head in this agent and tenant scope. */
2099
+ getCommerceProposal(proposalId: string): Promise<CommerceProposalResolution>;
2100
+ /**
2101
+ * Evaluate policy and begin one exact Stripe Link commerce intent.
2102
+ *
2103
+ * The stable idempotency key makes transport retries safe. Reusing it with a
2104
+ * different intent is rejected by the API.
2105
+ */
2106
+ beginCommerceExecution(input: BeginCommerceExecutionInput): Promise<CommerceExecutionResult>;
2107
+ /** Atomically consume the Conto authorization for one exact browser action. */
2108
+ authorizeCheckoutAction(executionId: string, browserSessionId: string, action: AgentCheckoutAction | BrowserCheckoutAction): Promise<AuthorizeCheckoutActionResult>;
2109
+ /** Claim a durable browser action for one stable privileged-runtime attempt. */
2110
+ claimBrowserAction(authorizationId: string, dispatchAttemptId: string, browserSessionId: string, action: AgentCheckoutAction | BrowserCheckoutAction): Promise<BrowserActionClaimResult>;
2111
+ /** Finalize the exact dispatch attempt; this never performs the browser side effect. */
2112
+ finalizeBrowserAction(authorizationId: string, input: {
2113
+ dispatchAttemptId: string;
2114
+ outcome: 'CONSUMED' | 'INDETERMINATE';
2115
+ observation?: BrowserActionDispatchObservationInput;
2116
+ }): Promise<BrowserActionFinalizeResult>;
2117
+ /**
2118
+ * Own the complete privileged-browser enforcement sequence. The stable
2119
+ * dispatchAttemptId must be persisted by the runtime before this call.
2120
+ */
2121
+ runGuardedCheckout<T>(input: GuardedCheckoutInput, runtime: {
2122
+ dispatchAttemptId: string;
2123
+ execute: (authorization: CheckoutActionAuthorization) => Promise<GuardedBrowserDispatchResult<T>>;
2124
+ }): Promise<RunGuardedCheckoutResult<T>>;
2125
+ /**
2126
+ * Reference privileged-driver integration. Only this wrapper should be
2127
+ * exposed as the agent's payment-sensitive browser tool.
2128
+ */
2129
+ runGuardedCheckoutWithDriver<T>(input: GuardedCheckoutInput, runtime: {
2130
+ dispatchAttemptId: string;
2131
+ driver: PrivilegedBrowserCheckoutDriver<T>;
2132
+ }): Promise<RunGuardedCheckoutResult<T>>;
2133
+ /**
2134
+ * Policy-check and authorize an exact action before invoking a legacy callback.
2135
+ * @deprecated Use runGuardedCheckout so the durable claim and final
2136
+ * observation cannot be omitted.
2137
+ */
2138
+ guardCheckout<T>(input: GuardedCheckoutInput, executor: (authorization: CheckoutActionAuthorization) => Promise<T>): Promise<GuardCheckoutResult<T>>;
2139
+ /** Read one agent-scoped commerce execution and its normalized evidence. */
2140
+ getCommerceExecution(executionId: string): Promise<CommerceExecutionResult>;
2141
+ /**
2142
+ * Observe Link state and reconcile terminal accounting. This operation is
2143
+ * safe to retry because it does not request another checkout execution.
2144
+ */
2145
+ refreshCommerceExecution(executionId: string): Promise<CommerceExecutionResult>;
2146
+ /**
2147
+ * Execute the approved provider-direct or server-only checkout handoff. Transport retries are
2148
+ * deliberately disabled. Read or refresh the execution after an ambiguous
2149
+ * failure before taking another execution action.
2150
+ */
2151
+ executeCommerceExecution(executionId: string): Promise<ExecuteCommerceExecutionResult>;
2152
+ /**
2153
+ * Request cancellation and release reserved spend after Link confirms it.
2154
+ * Transport retries are disabled because a lost provider response requires
2155
+ * reconciliation.
2156
+ */
2157
+ cancelCommerceExecution(executionId: string): Promise<CommerceExecutionResult>;
2158
+ /** Read credentials, linked wallets, effective policies, and scopes without creating a payment. */
2159
+ setup(): Promise<AgentSetupResult>;
2160
+ /** Make an authenticated request to the Conto API */
2161
+ request<T>(method: string, path: string, body?: Record<string, unknown>, options?: ContoRequestOptions): Promise<T>;
2162
+ }
2163
+ /** Agent client for the cooperative external-card policy overlay. */
2164
+ declare class CardsClient {
2165
+ private client;
2166
+ constructor(client: Conto);
2167
+ approve(input: ExternalCardApprovalInput): Promise<ExternalCardApprovalResult>;
2168
+ confirm(requestId: string, input: ExternalCardConfirmationInput): Promise<ExternalCardConfirmationResult>;
2169
+ /**
2170
+ * Atomically claim the approved intent before customer code accesses or uses
2171
+ * the card credential. A request can be claimed only once.
2172
+ */
2173
+ begin(requestId: string, input: {
2174
+ approvalToken: string;
2175
+ }): Promise<ExternalCardExecutionClaimResult>;
2176
+ /** Read execution and reconciliation state without exposing card credentials. */
2177
+ status(requestId: string): Promise<ExternalCardRequestStatusResult>;
2178
+ /**
2179
+ * Create a reference payment tool whose executor callback is unreachable
2180
+ * until Conto has returned a live approval grant.
2181
+ *
2182
+ * @deprecated Use the separate `@conto_finance/card-access` product package for
2183
+ * customer-hosted card enforcement. This helper remains for compatibility.
2184
+ */
2185
+ controlled<TReceipt>(executor: ExternalCardExecutor<TReceipt>): ControlledExternalCardPaymentTool<TReceipt>;
2186
+ }
2187
+ /**
2188
+ * Cooperative control for an existing customer credential store. The executor is
2189
+ * customer-owned and remains bypassable if another code path can call it.
2190
+ */
2191
+ declare class ControlledExternalCardPaymentTool<TReceipt = unknown> {
2192
+ private cardsClient;
2193
+ private executor;
2194
+ constructor(cardsClient: CardsClient, executor: ExternalCardExecutor<TReceipt>);
2195
+ pay(input: ExternalCardApprovalInput): Promise<ControlledExternalCardPaymentResult<TReceipt>>;
2196
+ }
2197
+ /**
2198
+ * Agent client for connected cards (gated pilot).
2199
+ *
2200
+ * A connected card is a customer card enrolled through the provider and
2201
+ * delegated to this agent. `draw` mints one single-use credential against a
2202
+ * verified mandate; `list` returns the masked cards and mandates the agent may
2203
+ * draw against. This is a separate rail from {@link CardsClient}: it does not
2204
+ * share endpoints, scopes, or types with the external-card policy overlay.
2205
+ *
2206
+ * These methods return 404 until the tenant is enabled for the pilot.
2207
+ */
2208
+ declare class ConnectedCardsClient {
2209
+ private client;
2210
+ constructor(client: Conto);
2211
+ /**
2212
+ * Draw one single-use card credential against a verified mandate.
2213
+ *
2214
+ * On an APPROVED, minted draw the result carries live card material in
2215
+ * `credential`, returned exactly ONCE.
2216
+ *
2217
+ * CREDENTIAL SAFETY (load-bearing): the credential is the real, usable card.
2218
+ * It is revealed a single time and cannot be re-fetched. Use it in-process at
2219
+ * the intended merchant checkout only. Never log, print, serialize, persist,
2220
+ * cache, or forward it, and never place it in an error, a monitoring event,
2221
+ * or any other sink. See {@link ConnectedCardCredential}.
2222
+ *
2223
+ * Transport-level retry is deliberately OFF for this call. The server is
2224
+ * idempotent on `idempotencyKey`, so an automatic retry after a successful
2225
+ * mint would replay the draw and return the decision WITHOUT the credential,
2226
+ * silently losing the one-shot card material. If a `draw` fails ambiguously,
2227
+ * do not blindly retry: check the outcome, and reuse the same
2228
+ * `idempotencyKey` only to reconcile the same draw.
2229
+ *
2230
+ * @example
2231
+ * ```typescript
2232
+ * const draw = await conto.connectedCards.draw({
2233
+ * cardId: 'cmm59z8fj000l49h7bjqza11p',
2234
+ * mandateId: 'cmm5a1b2c000m49h7defgh22q',
2235
+ * idempotencyKey: 'checkout_01J8...',
2236
+ * amountMinor: 4999,
2237
+ * merchant: { merchantName: 'Example Store', merchantCategory: '5311' },
2238
+ * });
2239
+ * if (draw.decision === 'APPROVED' && draw.credential) {
2240
+ * // Keep the credential in memory, acknowledge receipt, then use it at checkout.
2241
+ * await conto.connectedCards.acknowledgeDelivery(draw.requestId);
2242
+ * // Do not log or store draw.credential.
2243
+ * }
2244
+ * ```
2245
+ */
2246
+ draw(input: ConnectedCardDrawInput): Promise<ConnectedCardDrawResult>;
2247
+ /**
2248
+ * List the connected cards and active mandates this agent may draw against.
2249
+ *
2250
+ * The response is masked: no PAN and no provider tokens. This is a read-only
2251
+ * GET, so transport retry on transient failures is safe.
2252
+ */
2253
+ /** Record receipt after a fresh draw. Does not confirm checkout or payment settlement. */
2254
+ acknowledgeDelivery(requestId: string): Promise<{
2255
+ acknowledged: boolean;
2256
+ settlementVerified: false;
2257
+ }>;
2258
+ list(): Promise<ConnectedCardListResult>;
662
2259
  }
663
2260
  /** Client for payment operations */
664
2261
  declare class PaymentsClient {
665
2262
  private client;
2263
+ /** Authorize an externally signed transfer. This write is not automatically retried. */
2264
+ approve(input: ExternalWalletApprovalInput): Promise<ExternalWalletApprovalResult>;
2265
+ /** Record an existing transfer. Never sends funds; reconcile conflicts using status(). */
2266
+ confirm(requestId: string, input: ExternalWalletConfirmationInput): Promise<ExternalWalletConfirmationResult>;
666
2267
  constructor(client: Conto);
667
2268
  /**
668
2269
  * Request authorization for a payment.
@@ -704,8 +2305,11 @@ declare class PaymentsClient {
704
2305
  * @example
705
2306
  * ```typescript
706
2307
  * const result = await conto.payments.execute(request.requestId);
707
- * console.log(`Transaction: ${result.txHash}`);
708
- * console.log(`Explorer: ${result.explorerUrl}`);
2308
+ * console.log(`Status: ${result.status}`);
2309
+ * console.log(`Conto transaction: ${result.receipt.transactionId}`);
2310
+ * console.log(`Settlement mode: ${result.receipt.settlementMode}`);
2311
+ * console.log(`Transaction: ${result.receipt.txHash}`);
2312
+ * if (result.receipt.explorerUrl) console.log(`Explorer: ${result.receipt.explorerUrl}`);
709
2313
  * ```
710
2314
  */
711
2315
  execute(requestId: string): Promise<PaymentExecuteResult>;
@@ -717,8 +2321,8 @@ declare class PaymentsClient {
717
2321
  * @example
718
2322
  * ```typescript
719
2323
  * const status = await conto.payments.status(requestId);
720
- * if (status.transaction?.status === 'CONFIRMED') {
721
- * console.log('Payment confirmed at block', status.transaction.blockNumber);
2324
+ * if (status.transaction?.status === 'completed') {
2325
+ * console.log('Payment confirmed', status.transaction.txHash);
722
2326
  * }
723
2327
  * ```
724
2328
  */
@@ -737,7 +2341,9 @@ declare class PaymentsClient {
737
2341
  * recipientAddress: '0x...',
738
2342
  * purpose: 'Service fee'
739
2343
  * });
740
- * console.log(`Paid! TX: ${result.txHash}`);
2344
+ * console.log(`Payment status: ${result.status}`);
2345
+ * console.log(`Conto transaction: ${result.receipt.transactionId}`);
2346
+ * console.log(`Transaction: ${result.receipt.txHash}`);
741
2347
  * } catch (error) {
742
2348
  * if (error.code === 'REQUIRES_APPROVAL') {
743
2349
  * console.log('Payment needs human approval');
@@ -749,5 +2355,31 @@ declare class PaymentsClient {
749
2355
  */
750
2356
  pay(input: PaymentRequestInput): Promise<PaymentExecuteResult>;
751
2357
  }
2358
+ declare class X402Client {
2359
+ private client;
2360
+ constructor(client: Conto);
2361
+ preAuthorize(input: X402PreAuthorizeInput): Promise<X402PreAuthorizeResult>;
2362
+ record(input: X402RecordInput): Promise<X402RecordResult>;
2363
+ budget(options?: {
2364
+ sessionId?: string;
2365
+ }): Promise<X402BudgetResult>;
2366
+ services(options?: {
2367
+ period?: '24h' | '7d' | '30d' | '90d';
2368
+ limit?: number;
2369
+ }): Promise<ProtocolServicesResult>;
2370
+ }
2371
+ declare class MppClient {
2372
+ private client;
2373
+ constructor(client: Conto);
2374
+ preAuthorize(input: MppPreAuthorizeInput): Promise<MppPreAuthorizeResult>;
2375
+ record(input: MppRecordInput): Promise<MppRecordResult>;
2376
+ budget(options?: {
2377
+ sessionId?: string;
2378
+ }): Promise<MppBudgetResult>;
2379
+ services(options?: {
2380
+ period?: '24h' | '7d' | '30d' | '90d';
2381
+ limit?: number;
2382
+ }): Promise<ProtocolServicesResult>;
2383
+ }
752
2384
 
753
- export { type Agent, type AgentStatus, type AgentType, type AgentWalletLink, type ChainType, Conto, ContoAdmin, type ContoAdminConfig, type ContoAdminError, type ContoConfig, type ContoError, type CreateAgentInput, type CreatePolicyInput, type CreatePolicyRuleInput, type CreateSdkKeyInput, type CreateSdkKeyResult, type CreateWalletInput, type CustodyType, type DelegationType, type FreezeAgentInput, Conto as Giro, type ContoConfig as GiroConfig, type ContoError as GiroError, type LinkWalletInput, type ListAgentsParams, type ListAgentsResponse, type ListPoliciesParams, type ListPoliciesResponse, type ListWalletsParams, type ListWalletsResponse, type PaginatedResponse, type PaginationParams, type PaymentExecuteResult, type PaymentRequestInput, type PaymentRequestResult, type PaymentStatusResult, type Policy, type PolicyRule, type PolicyType, type PolicyViolation, type ProvisionWalletResult, type RefreshBalanceResult, type RuleAction, type RuleOperator, type RuleType, type SdkKey, type SdkKeyType, type UnfreezeAgentInput, type UpdateAgentInput, type UpdatePolicyInput, type UpdatePolicyRuleInput, type UpdateWalletInput, type Wallet, type WalletChainBalanceSnapshot, type WalletStatus, type WalletType, Conto as default };
2385
+ export { type AdminExternalCardOverlayEnforcement, type Agent, type AgentCheckoutAction, type AgentCheckoutActionKind, type AgentExternalCard, type AgentSetupResult, type AgentStatus, type AgentType, type AgentWalletLink, type ApprovedExternalCardExecution, type AssignExternalCardInput, type AssignedPolicy, type AuthorizeCheckoutActionResult, type BeginCommerceExecutionInput, type BrowserActionClaimResult, type BrowserActionDispatchObservationInput, BrowserActionFinalizationPendingError, type BrowserActionFinalizeResult, type BrowserCheckoutAction, type BrowserCheckoutTargetResolver, type BrowserCheckoutTargetSnapshot, type BrowserCheckoutTargetVerificationCode, BrowserCheckoutTargetVerificationError, type CanonicalBrowserCheckoutTargetSnapshot, CardsClient, type ChainType, type CheckoutActionAuthorization, type CommerceCheckoutMethod, type CommerceContextRequirement, type CommerceExecution, type CommerceExecutionAdapterKind, type CommerceExecutionArtifactKind, type CommerceExecutionChannel, type CommerceExecutionConstraint, type CommerceExecutionConstraintCoverage, type CommerceExecutionConstraintCoverageLevel, type CommerceExecutionDeliveryMode, type CommerceExecutionEvidence, type CommerceExecutionProvider, type CommerceExecutionResult, type CommerceExecutionSourceKind, type CommerceExecutionStatus, type CommerceFactConfidence, type CommerceFactProvenanceInput, type CommerceFactSource, type CommerceFulfillmentInput, type CommerceLineItemInput, type CommerceProposalFactKey, type CommerceProposalMissingFact, type CommerceProposalResolution, type CommerceProposalState, type CommerceSettlementRail, type CommerceTotalInput, type CommerceTotalType, type ComparePolicyVersionsResponse, type ConnectedCardBrief, type ConnectedCardCredential, type ConnectedCardDrawInput, type ConnectedCardDrawMerchant, type ConnectedCardDrawResult, type ConnectedCardDrawable, type ConnectedCardListResult, type ConnectedCardMandate, type ConnectedCardMandateMerchant, type ConnectedCardReference, ConnectedCardsClient, Conto, ContoAdmin, type ContoAdminConfig, ContoAdminError, type ContoConfig, ContoError, type ContoRequestOptions, type ControlledExternalCardPaymentResult, ControlledExternalCardPaymentTool, type CreateAgentInput, type CreatePolicyInput, type CreatePolicyRuleInput, type CreateSdkKeyInput, type CreateSdkKeyResult, type CreateWalletInput, type CustodyType, type CustomerCustodyMode, type CustomerWalletControlModel, type CustomerWalletKeyAccess, type DelegationType, type ExecuteCommerceExecutionResult, type ExternalCard, type ExternalCardApprovalInput, type ExternalCardApprovalResult, type ExternalCardConfirmationInput, ExternalCardConfirmationPendingError, type ExternalCardConfirmationResult, type ExternalCardExecutionClaimResult, type ExternalCardExecutionResult, type ExternalCardExecutor, type ExternalCardOverlayEnforcement, type ExternalCardRequestStatusResult, type ExternalWalletApprovalInput, type ExternalWalletApprovalResult, type ExternalWalletConfirmationInput, type ExternalWalletConfirmationResult, type FreezeAgentInput, Conto as Giro, type ContoConfig as GiroConfig, ContoError as GiroError, type GuardCheckoutResult, type GuardedBrowserDispatchResult, type GuardedCheckoutInput, type LinkWalletInput, type ListAgentsParams, type ListAgentsResponse, type ListPoliciesParams, type ListPoliciesResponse, type ListPolicyVersionsResponse, type ListStripeLinkPaymentMethodsResult, type ListWalletsParams, type ListWalletsResponse, type MppBudgetResult, type MppPreAuthorizeInput, type MppPreAuthorizeResult, type MppRecordInput, type MppRecordResult, type NormalizeCommerceProposalInput, type OrganizationMember, type PaginatedResponse, type PaginationParams, type PauseExternalCardAssignmentResult, type PaymentExecuteResult, type PaymentRequestInput, type PaymentRequestResult, type PaymentStatusResult, type Policy, type PolicyRule, type PolicyType, type PolicyVersionChangeType, type PolicyVersionDetail, type PolicyVersionDiff, type PolicyVersionFieldChange, type PolicyVersionSnapshot, type PolicyVersionSnapshotRule, type PolicyVersionSummary, type PrivilegedBrowserCheckoutDriver, type ProtocolBudgetResult, type ProtocolPreAuthorizeResult, type ProtocolServiceSummary, type ProtocolServicesResult, type ProvisionWalletResult, type RefreshBalanceResult, type RegisterExternalCardInput, type RollbackPolicyVersionResponse, type RuleAction, type RuleOperator, type RuleType, type RunGuardedCheckoutResult, type SdkKey, type SdkKeyType, type StripeLinkCheckoutReadiness, type StripeLinkCheckoutReadinessResult, type StripeLinkCheckoutReadinessStatus, type StripeLinkCheckoutVerification, type StripeLinkPaymentMethod, type UnfreezeAgentInput, type UpdateAgentInput, type UpdateExternalCardAssignmentInput, type UpdatePolicyInput, type UpdatePolicyRuleInput, type UpdateWalletInput, type VerifiedBrowserCheckoutTarget, type Wallet, type WalletChainBalanceSnapshot, type WalletStatus, type WalletType, type X402BudgetResult, type X402PreAuthorizeInput, type X402PreAuthorizeResult, type X402RecordInput, type X402RecordResult, canonicalizeBrowserCheckoutTarget, createVerifiedBrowserCheckoutDriver, Conto as default, fingerprintBrowserCheckoutTarget };