@conto_finance/sdk 0.3.1 → 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.ts CHANGED
@@ -5,6 +5,11 @@ interface ApiErrorMetadata {
5
5
  retryAfter?: number;
6
6
  retryGuidance?: string;
7
7
  actionUrl?: string;
8
+ fieldErrors?: Array<{
9
+ field: string;
10
+ message: string;
11
+ }>;
12
+ reasons?: string[];
8
13
  }
9
14
 
10
15
  /**
@@ -68,6 +73,8 @@ type AgentAttestationMode = 'KEY_ONLY' | 'SIGNED_REQUEST' | 'SIGNED_REQUEST_WITH
68
73
  type DelegationType = 'FULL' | 'LIMITED' | 'VIEW_ONLY' | 'PREAPPROVED' | 'ALLOWLIST';
69
74
  type ChainType = 'EVM' | 'SOLANA';
70
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';
71
78
  /** @deprecated Use CustomerCustodyMode. */
72
79
  type CustodyType = CustomerCustodyMode;
73
80
  type WalletType = 'EOA' | 'SMART_WALLET' | 'MULTISIG';
@@ -190,6 +197,8 @@ interface AgentWalletLink {
190
197
  usdcBalance: number;
191
198
  status: string;
192
199
  custodyMode?: CustomerCustodyMode;
200
+ controlModel?: CustomerWalletControlModel;
201
+ keyAccess?: CustomerWalletKeyAccess;
193
202
  };
194
203
  createdAt: string;
195
204
  updatedAt: string;
@@ -439,6 +448,8 @@ interface Wallet {
439
448
  chainId: string;
440
449
  walletType: WalletType;
441
450
  custodyMode: CustomerCustodyMode;
451
+ controlModel: CustomerWalletControlModel;
452
+ keyAccess: CustomerWalletKeyAccess;
442
453
  usdcBalance: number;
443
454
  status: WalletStatus;
444
455
  createdAt: string;
@@ -450,6 +461,8 @@ interface CreateWalletInput {
450
461
  chainType?: ChainType;
451
462
  chainId?: string;
452
463
  custodyMode?: Extract<CustomerCustodyMode, 'MANAGED' | 'EXTERNAL'>;
464
+ /** Root authority for a newly created managed wallet. */
465
+ controlModel?: Extract<CustomerWalletControlModel, 'CONTO_MANAGED' | 'ORGANIZATION_CONTROLLED'>;
453
466
  walletType?: WalletType;
454
467
  address?: string;
455
468
  }
@@ -476,6 +489,8 @@ interface ProvisionWalletResult {
476
489
  chainId: string;
477
490
  chainType: string;
478
491
  custodyMode: CustomerCustodyMode;
492
+ controlModel?: CustomerWalletControlModel;
493
+ keyAccess?: CustomerWalletKeyAccess;
479
494
  balance: number;
480
495
  currency: string;
481
496
  };
@@ -569,6 +584,94 @@ interface UpdatePolicyRuleInput {
569
584
  value?: string;
570
585
  action?: RuleAction;
571
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
+ }
572
675
  declare class ContoAdmin {
573
676
  private orgApiKey;
574
677
  private baseUrl;
@@ -578,10 +681,22 @@ declare class ContoAdmin {
578
681
  cards: AdminCardsClient;
579
682
  policies: PoliciesClient;
580
683
  team: TeamClient;
684
+ paymentRails: PaymentRailsClient;
581
685
  constructor(config: ContoAdminConfig);
582
686
  /** Make an authenticated request to the Conto API */
583
687
  request<T>(method: string, path: string, body?: Record<string, unknown>): Promise<T>;
584
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
+ }
585
700
  declare class AdminCardsClient {
586
701
  private client;
587
702
  constructor(client: ContoAdmin);
@@ -752,6 +867,20 @@ declare class PoliciesClient {
752
867
  success: boolean;
753
868
  deletedCount: number;
754
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>;
755
884
  }
756
885
  declare class TeamClient {
757
886
  private client;
@@ -762,6 +891,68 @@ declare class TeamClient {
762
891
  }>;
763
892
  }
764
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
+
765
956
  /**
766
957
  * Conto SDK
767
958
  *
@@ -837,6 +1028,105 @@ interface PaymentRequestInput {
837
1028
  /** Client-supplied key for idempotent retries */
838
1029
  idempotencyKey?: string;
839
1030
  }
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<{
1040
+ id: string;
1041
+ address: string;
1042
+ custodyMode: CustomerCustodyMode;
1043
+ chainId: string;
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;
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
+ }
840
1130
  interface PaymentRequestResult {
841
1131
  /** Unique request ID - use this to execute or check status */
842
1132
  requestId: string;
@@ -864,7 +1154,8 @@ interface PaymentRequestResult {
864
1154
  receipt?: {
865
1155
  /** Stable Conto transaction ID for status checks and reconciliation */
866
1156
  transactionId: string;
867
- txHash: string;
1157
+ /** Present only for an onchain transfer. Simulations use transactionId. */
1158
+ txHash?: string;
868
1159
  /** Whether this receipt represents live settlement or a test-mode payment */
869
1160
  settlementMode: 'live' | 'test';
870
1161
  explorerUrl?: string;
@@ -885,7 +1176,8 @@ interface PaymentExecuteResult {
885
1176
  receipt: {
886
1177
  /** Stable Conto transaction ID for status checks and reconciliation */
887
1178
  transactionId: string;
888
- txHash: string;
1179
+ /** Present only for an onchain transfer. Simulations use transactionId. */
1180
+ txHash?: string;
889
1181
  /** Whether this receipt represents live settlement or a test-mode payment */
890
1182
  settlementMode: 'live' | 'test';
891
1183
  explorerUrl?: string;
@@ -893,6 +1185,8 @@ interface PaymentExecuteResult {
893
1185
  }
894
1186
  interface PaymentStatusResult {
895
1187
  requestId: string;
1188
+ /** Unknown for legacy records without execution evidence, or before execution. */
1189
+ settlementMode: 'live' | 'test' | 'unknown';
896
1190
  status: 'approved' | 'declined' | 'review_required' | 'action_required' | 'reconciliation_required' | 'processing' | 'completed' | 'failed' | 'expired';
897
1191
  amount: number;
898
1192
  currency: string;
@@ -909,6 +1203,7 @@ interface PaymentStatusResult {
909
1203
  transaction: {
910
1204
  /** Stable Conto transaction ID */
911
1205
  id: string;
1206
+ settlementMode: 'live' | 'test' | 'unknown';
912
1207
  txHash: string | null;
913
1208
  status: 'processing' | 'completed' | 'failed';
914
1209
  confirmedAt: string | null;
@@ -1039,6 +1334,8 @@ interface ExternalCardConfirmationResult {
1039
1334
  */
1040
1335
  interface ApprovedExternalCardExecution {
1041
1336
  requestId: string;
1337
+ /** Stable purchase key to pass through to the customer payment processor. */
1338
+ idempotencyKey: string;
1042
1339
  cardId: string;
1043
1340
  amount: number;
1044
1341
  currency: 'USD';
@@ -1063,6 +1360,500 @@ interface ControlledExternalCardPaymentResult<TReceipt = unknown> {
1063
1360
  confirmation: ExternalCardConfirmationResult;
1064
1361
  receipt: TReceipt;
1065
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
+ }
1066
1857
  interface ProtocolPreAuthorizeResult {
1067
1858
  authorized: boolean;
1068
1859
  decision: 'approved' | 'declined' | 'review_required';
@@ -1076,8 +1867,15 @@ interface X402PreAuthorizeInput {
1076
1867
  department?: string;
1077
1868
  project?: string;
1078
1869
  };
1870
+ facilitator?: string;
1871
+ scheme?: string;
1079
1872
  /** Customer-supplied ID used to group authorization, recording, and spend reporting. */
1080
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;
1081
1879
  }
1082
1880
  interface X402PreAuthorizeResult extends ProtocolPreAuthorizeResult {
1083
1881
  x402: {
@@ -1096,6 +1894,10 @@ interface X402RecordInput {
1096
1894
  paymentId: string;
1097
1895
  /** Customer-supplied ID used to group related x402 payments. */
1098
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;
1099
1901
  context?: {
1100
1902
  department?: string;
1101
1903
  project?: string;
@@ -1125,6 +1927,10 @@ interface MppPreAuthorizeInput {
1125
1927
  depositAmount?: number;
1126
1928
  /** Customer-supplied ID used to group authorization, recording, and spend reporting. */
1127
1929
  sessionId?: string;
1930
+ scheme?: string;
1931
+ credentialId?: string;
1932
+ challengeId?: string;
1933
+ paymentMethod?: string;
1128
1934
  }
1129
1935
  interface MppPreAuthorizeResult extends ProtocolPreAuthorizeResult {
1130
1936
  mpp: {
@@ -1149,6 +1955,10 @@ interface MppRecordInput {
1149
1955
  };
1150
1956
  paymentReceipt?: string;
1151
1957
  intent?: 'charge' | 'session';
1958
+ scheme?: string;
1959
+ challengeId?: string;
1960
+ paymentMethod?: string;
1961
+ depositAmount?: number;
1152
1962
  batchItems?: Array<{
1153
1963
  amount: number;
1154
1964
  resourceUrl: string;
@@ -1226,6 +2036,8 @@ declare class ContoError extends Error {
1226
2036
  readonly retryAfter?: number;
1227
2037
  readonly retryGuidance?: string;
1228
2038
  readonly actionUrl?: string;
2039
+ readonly fieldErrors?: ApiErrorMetadata['fieldErrors'];
2040
+ readonly reasons?: string[];
1229
2041
  constructor(message: string, metadata: ApiErrorMetadata);
1230
2042
  }
1231
2043
  /**
@@ -1238,6 +2050,23 @@ declare class ExternalCardConfirmationPendingError<TReceipt = unknown> extends C
1238
2050
  readonly receipt: TReceipt;
1239
2051
  constructor(requestId: string, confirmationInput: ExternalCardConfirmationInput, receipt: TReceipt);
1240
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
+ }
1241
2070
  interface ContoRequestOptions {
1242
2071
  /** Set only when repeating this request cannot create an additional side effect. */
1243
2072
  idempotent?: boolean;
@@ -1250,10 +2079,85 @@ declare class Conto {
1250
2079
  private timeout;
1251
2080
  payments: PaymentsClient;
1252
2081
  cards: CardsClient;
2082
+ connectedCards: ConnectedCardsClient;
1253
2083
  x402: X402Client;
1254
2084
  mpp: MppClient;
1255
2085
  constructor(config: ContoConfig);
1256
- /** Make an authenticated request to the Giro API */
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 */
1257
2161
  request<T>(method: string, path: string, body?: Record<string, unknown>, options?: ContoRequestOptions): Promise<T>;
1258
2162
  }
1259
2163
  /** Agent client for the cooperative external-card policy overlay. */
@@ -1290,9 +2194,76 @@ declare class ControlledExternalCardPaymentTool<TReceipt = unknown> {
1290
2194
  constructor(cardsClient: CardsClient, executor: ExternalCardExecutor<TReceipt>);
1291
2195
  pay(input: ExternalCardApprovalInput): Promise<ControlledExternalCardPaymentResult<TReceipt>>;
1292
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>;
2259
+ }
1293
2260
  /** Client for payment operations */
1294
2261
  declare class PaymentsClient {
1295
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>;
1296
2267
  constructor(client: Conto);
1297
2268
  /**
1298
2269
  * Request authorization for a payment.
@@ -1411,4 +2382,4 @@ declare class MppClient {
1411
2382
  }): Promise<ProtocolServicesResult>;
1412
2383
  }
1413
2384
 
1414
- export { type AdminExternalCardOverlayEnforcement, type Agent, type AgentExternalCard, type AgentStatus, type AgentType, type AgentWalletLink, type ApprovedExternalCardExecution, type AssignExternalCardInput, type AssignedPolicy, CardsClient, type ChainType, 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 DelegationType, type ExternalCard, type ExternalCardApprovalInput, type ExternalCardApprovalResult, type ExternalCardConfirmationInput, ExternalCardConfirmationPendingError, type ExternalCardConfirmationResult, type ExternalCardExecutionClaimResult, type ExternalCardExecutionResult, type ExternalCardExecutor, type ExternalCardOverlayEnforcement, type ExternalCardRequestStatusResult, type FreezeAgentInput, Conto as Giro, type ContoConfig as GiroConfig, ContoError as GiroError, type LinkWalletInput, type ListAgentsParams, type ListAgentsResponse, type ListPoliciesParams, type ListPoliciesResponse, type ListWalletsParams, type ListWalletsResponse, type MppBudgetResult, type MppPreAuthorizeInput, type MppPreAuthorizeResult, type MppRecordInput, type MppRecordResult, type OrganizationMember, type PaginatedResponse, type PaginationParams, type PauseExternalCardAssignmentResult, type PaymentExecuteResult, type PaymentRequestInput, type PaymentRequestResult, type PaymentStatusResult, type Policy, type PolicyRule, type PolicyType, type ProtocolBudgetResult, type ProtocolPreAuthorizeResult, type ProtocolServiceSummary, type ProtocolServicesResult, type ProvisionWalletResult, type RefreshBalanceResult, type RegisterExternalCardInput, type RuleAction, type RuleOperator, type RuleType, type SdkKey, type SdkKeyType, type UnfreezeAgentInput, type UpdateAgentInput, type UpdateExternalCardAssignmentInput, type UpdatePolicyInput, type UpdatePolicyRuleInput, type UpdateWalletInput, type Wallet, type WalletChainBalanceSnapshot, type WalletStatus, type WalletType, type X402BudgetResult, type X402PreAuthorizeInput, type X402PreAuthorizeResult, type X402RecordInput, type X402RecordResult, 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 };