@dakota-xyz/ts-sdk 2.0.0 → 2.1.1

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.mjs CHANGED
@@ -134,6 +134,8 @@ var AuthMode = /* @__PURE__ */ ((AuthMode2) => {
134
134
  AuthMode2["ApplicationToken"] = "application_token";
135
135
  return AuthMode2;
136
136
  })(AuthMode || {});
137
+ var DEFAULT_TIMEOUT_MS = 15e3;
138
+ var AGENTIC_MODEL_TIMEOUT_MS = 18e4;
137
139
  var DEFAULT_RETRY_POLICY = {
138
140
  maxAttempts: 3,
139
141
  initialBackoffMs: 200,
@@ -191,7 +193,8 @@ function resolveConfig(config) {
191
193
  const env = config.environment ?? "sandbox" /* Sandbox */;
192
194
  baseURL = getEnvironmentURL(env);
193
195
  }
194
- const timeout = config.timeout ?? 15e3;
196
+ const timeoutWasExplicit = config.timeout !== void 0;
197
+ const timeout = config.timeout ?? DEFAULT_TIMEOUT_MS;
195
198
  if (timeout <= 0) {
196
199
  throw new ConfigurationError("Timeout must be greater than zero");
197
200
  }
@@ -218,6 +221,7 @@ function resolveConfig(config) {
218
221
  baseURL,
219
222
  authMode,
220
223
  timeout,
224
+ timeoutWasExplicit,
221
225
  retryPolicy,
222
226
  logger: config.logger ?? noopLogger,
223
227
  automaticIdempotency: config.automaticIdempotency ?? true,
@@ -243,12 +247,16 @@ var Transport = class {
243
247
  const url = this.buildURL(path, query);
244
248
  const requestHeaders = this.buildHeaders(method, path, headers, idempotencyKey);
245
249
  const requestBody = body !== void 0 ? JSON.stringify(body) : void 0;
246
- return this.executeWithRetry(url, {
247
- method,
248
- headers: requestHeaders,
249
- body: requestBody,
250
- signal
251
- });
250
+ return this.executeWithRetry(
251
+ url,
252
+ {
253
+ method,
254
+ headers: requestHeaders,
255
+ body: requestBody,
256
+ signal
257
+ },
258
+ this.resolveTimeout(options)
259
+ );
252
260
  }
253
261
  /**
254
262
  * Build the full URL with query parameters.
@@ -314,17 +322,47 @@ var Transport = class {
314
322
  break;
315
323
  }
316
324
  }
325
+ /**
326
+ * Resolve the deadline for one request, most specific intent first:
327
+ *
328
+ * 1. the caller's per-request `timeout`
329
+ * 2. an explicit client-wide `timeout`
330
+ * 3. the endpoint's own default (slow endpoints raise their own)
331
+ * 4. the client-wide default
332
+ *
333
+ * (2) sits above (3) on purpose: a caller who configured a timeout chose
334
+ * it, and an endpoint must not quietly overrule that. (3) exists so the
335
+ * far more common caller — the one who configured nothing — gets a
336
+ * deadline that matches what the endpoint actually does.
337
+ */
338
+ resolveTimeout(options) {
339
+ if (options.timeout !== void 0) {
340
+ return options.timeout;
341
+ }
342
+ if (this.config.timeoutWasExplicit) {
343
+ return this.config.timeout;
344
+ }
345
+ return options.endpointTimeout ?? this.config.timeout;
346
+ }
317
347
  /**
318
348
  * Execute request with exponential backoff retry.
349
+ *
350
+ * `timeout` is per ATTEMPT, not per call: each attempt gets its own
351
+ * deadline, so a request that keeps timing out can take up to
352
+ * `timeout × maxAttempts` before it throws.
319
353
  */
320
- async executeWithRetry(url, init) {
354
+ async executeWithRetry(url, init, timeout) {
321
355
  const { maxAttempts, initialBackoffMs, maxBackoffMs } = this.config.retryPolicy;
322
356
  const method = init.method ?? "GET";
323
357
  let lastError;
324
358
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
359
+ let timedOut = false;
325
360
  try {
326
361
  const controller = new AbortController();
327
- const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
362
+ const timeoutId = setTimeout(() => {
363
+ timedOut = true;
364
+ controller.abort();
365
+ }, timeout);
328
366
  const signal = init.signal ? this.mergeAbortSignals(init.signal, controller.signal) : controller.signal;
329
367
  this.logRequest(method, url, attempt);
330
368
  const response = await this.config.fetch(url, {
@@ -354,8 +392,13 @@ var Transport = class {
354
392
  if (error instanceof APIError) {
355
393
  throw error;
356
394
  }
357
- if (error instanceof Error && error.name === "AbortError") {
358
- lastError = new TransportError("Request timed out", error);
395
+ if (error instanceof Error && error.name === "AbortError" && timedOut) {
396
+ lastError = new TransportError(
397
+ `Request timed out after ${timeout}ms. This is the SDK's client-side deadline, not a server error \u2014 raise it with \`new DakotaClient({ timeout })\`, or per call with \`{ timeout }\` in the request options. Agent conversations are the usual cause: pass \`{ timeout }\` to \`newAgentConversation\`.`,
398
+ error
399
+ );
400
+ } else if (error instanceof Error && error.name === "AbortError") {
401
+ throw new TransportError("Request aborted by caller", error);
359
402
  } else if (error instanceof Error) {
360
403
  lastError = new TransportError("Network error", error);
361
404
  } else {
@@ -579,6 +622,9 @@ var BaseResource = class {
579
622
  path,
580
623
  query
581
624
  });
625
+ if (Array.isArray(response)) {
626
+ return { data: response, meta: void 0 };
627
+ }
582
628
  return {
583
629
  data: response.data ?? [],
584
630
  meta: response.meta
@@ -630,7 +676,8 @@ var CustomersResource = class extends BaseResource {
630
676
  method: "POST",
631
677
  path: "/customers",
632
678
  body: data,
633
- idempotencyKey: options?.idempotencyKey
679
+ idempotencyKey: options?.idempotencyKey,
680
+ timeout: options?.timeout
634
681
  });
635
682
  }
636
683
  /**
@@ -676,12 +723,88 @@ var CustomersResource = class extends BaseResource {
676
723
  path: `/customers/${customerId}`
677
724
  });
678
725
  }
726
+ /**
727
+ * Delete a customer record.
728
+ *
729
+ * Soft-deletes the customer. Blocked with a 409 if the customer still has
730
+ * associated accounts, or is referenced as a sub-client by another customer.
731
+ *
732
+ * @param customerId - Customer ID (KSUID)
733
+ *
734
+ * @example
735
+ * ```typescript
736
+ * await client.customers.delete('cust_abc123');
737
+ * ```
738
+ */
739
+ async delete(customerId) {
740
+ await this.transport.request({
741
+ method: "DELETE",
742
+ path: `/customers/${customerId}`
743
+ });
744
+ }
745
+ /**
746
+ * List a customer's capabilities and what is still needed to unlock each.
747
+ *
748
+ * Returns the customer's rails (e.g. `international_wire`) with a status and
749
+ * the OUTSTANDING requirements — terms to accept, documents to upload — that
750
+ * gate them. Partner-agnostic: requirements are keyed by an opaque terms id
751
+ * or document type, never a provider or partner name.
752
+ *
753
+ * @param customerId - Customer ID (KSUID)
754
+ * @returns The customer's capabilities and their outstanding requirements
755
+ *
756
+ * @example
757
+ * ```typescript
758
+ * const { capabilities } = await client.customers.getCapabilities(customerId);
759
+ * for (const cap of capabilities) {
760
+ * if (cap.status !== 'action_required') continue;
761
+ * for (const req of cap.requirements) {
762
+ * console.log(`${cap.capability}: ${req.title} → ${req.url}`);
763
+ * }
764
+ * }
765
+ * ```
766
+ */
767
+ async getCapabilities(customerId) {
768
+ return this.transport.request({
769
+ method: "GET",
770
+ path: `/customers/${customerId}/capabilities`
771
+ });
772
+ }
773
+ /**
774
+ * Mint a fresh application link for re-engaging an APPROVED customer.
775
+ *
776
+ * Issues a new onboarding token for an existing approved customer's
777
+ * application and returns the rebuilt `application_url` — use it when the
778
+ * original token has expired and the customer needs to come back through
779
+ * the hosted flow (e.g. to accept outstanding partner disclosures).
780
+ *
781
+ * @param customerId - Customer ID (KSUID)
782
+ * @param options - Request options (e.g., custom idempotency key)
783
+ * @returns The rebuilt application URL
784
+ *
785
+ * @example
786
+ * ```typescript
787
+ * const { application_url } = await client.customers.reEngage(customerId);
788
+ * ```
789
+ */
790
+ async reEngage(customerId, options) {
791
+ return this.transport.request({
792
+ method: "POST",
793
+ path: `/customers/${customerId}/re-engagement`,
794
+ idempotencyKey: options?.idempotencyKey,
795
+ timeout: options?.timeout
796
+ });
797
+ }
679
798
  /**
680
799
  * Update the sub-client association for a customer.
681
800
  *
682
801
  * Associates or disassociates a customer with a sub-client.
683
802
  * Set `sub_client_id` to associate, or set it to `null` to disassociate.
684
803
  *
804
+ * @deprecated The sub-client association can only be set when a customer is
805
+ * created (`is_sub_client` / `sub_client_id` on `create`) and can no longer
806
+ * be changed afterwards — this endpoint now returns 400.
807
+ *
685
808
  * @param customerId - Customer ID (KSUID)
686
809
  * @param data - Sub-client association data
687
810
  * @param options - Request options (e.g., custom idempotency key)
@@ -705,7 +828,8 @@ var CustomersResource = class extends BaseResource {
705
828
  method: "PATCH",
706
829
  path: `/customers/${customerId}/sub-client`,
707
830
  body: data,
708
- idempotencyKey: options?.idempotencyKey
831
+ idempotencyKey: options?.idempotencyKey,
832
+ timeout: options?.timeout
709
833
  });
710
834
  }
711
835
  /**
@@ -755,7 +879,96 @@ var CustomersResource = class extends BaseResource {
755
879
  method: "POST",
756
880
  path: "/customers/bulk-import-sumsub-tokens",
757
881
  body: data,
758
- idempotencyKey: options?.idempotencyKey
882
+ idempotencyKey: options?.idempotencyKey,
883
+ timeout: options?.timeout
884
+ });
885
+ }
886
+ /**
887
+ * Import customers from Persona Connect share tokens (`cnst_...`).
888
+ *
889
+ * Unlike the Sumsub import, Persona redemption is asynchronous on Persona's
890
+ * side, so this returns a JOB immediately (HTTP 202). Poll
891
+ * `getPersonaImportJob` for per-token results. Up to 5,000 tokens per
892
+ * request — split larger migrations into multiple batches.
893
+ *
894
+ * Tokens are validated and de-duplicated up front, and a skipped token
895
+ * never blocks an accepted one. A `skipped` entry is about the token STRING
896
+ * (malformed, duplicated in the batch, or already imported) — it is never a
897
+ * compliance decision about a person or application.
898
+ *
899
+ * @param data - The share tokens to import
900
+ * @param options - Request options (e.g., custom idempotency key)
901
+ * @returns The queued job, with any tokens that could not be enqueued
902
+ *
903
+ * @example
904
+ * ```typescript
905
+ * const job = await client.customers.importPersonaTokens({
906
+ * tokens: ['cnst_ABC123def456', 'cnst_GHI789jkl012'],
907
+ * });
908
+ * console.log(`${job.accepted}/${job.total} queued as ${job.job_id}`);
909
+ * ```
910
+ */
911
+ async importPersonaTokens(data, options) {
912
+ return this.transport.request({
913
+ method: "POST",
914
+ path: "/customers/import-persona-tokens",
915
+ body: data,
916
+ idempotencyKey: options?.idempotencyKey,
917
+ timeout: options?.timeout
918
+ });
919
+ }
920
+ /**
921
+ * List this client's Persona share-token import jobs, newest first.
922
+ *
923
+ * This endpoint pages on its own cursor (`starting_after` + `has_more`), not
924
+ * the standard list envelope, so it returns a single page rather than an
925
+ * async iterator.
926
+ *
927
+ * @param params - Optional `limit` and `starting_after` job-id cursor
928
+ * @returns One page of job summaries plus a `has_more` flag
929
+ *
930
+ * @example
931
+ * ```typescript
932
+ * const { jobs, has_more } = await client.customers.listPersonaImportJobs({ limit: 20 });
933
+ * ```
934
+ */
935
+ async listPersonaImportJobs(params) {
936
+ return this.transport.request({
937
+ method: "GET",
938
+ path: "/customers/persona-import-jobs",
939
+ query: { ...params }
940
+ });
941
+ }
942
+ /**
943
+ * Get a Persona import job's status and its per-token results.
944
+ *
945
+ * Result rows page on a row-index cursor: pass the last row's `index` as
946
+ * `results_after_index` while `has_more_results` is true.
947
+ *
948
+ * @param jobId - Import job ID (`pij_...`)
949
+ * @param params - Optional `results_limit` (1-500) and `results_after_index`
950
+ * @returns Job status, row counts, and one page of result rows
951
+ *
952
+ * @example
953
+ * ```typescript
954
+ * let after: number | undefined;
955
+ * do {
956
+ * const job = await client.customers.getPersonaImportJob(jobId, {
957
+ * results_after_index: after,
958
+ * });
959
+ * for (const row of job.results ?? []) {
960
+ * if (row.state === 'failed') console.error(row.token, row.error);
961
+ * after = row.index;
962
+ * }
963
+ * if (!job.has_more_results) break;
964
+ * } while (true);
965
+ * ```
966
+ */
967
+ async getPersonaImportJob(jobId, params) {
968
+ return this.transport.request({
969
+ method: "GET",
970
+ path: `/customers/persona-import-jobs/${jobId}`,
971
+ query: { ...params }
759
972
  });
760
973
  }
761
974
  };
@@ -783,7 +996,8 @@ var RecipientsResource = class extends BaseResource {
783
996
  method: "POST",
784
997
  path: `/customers/${customerId}/recipients`,
785
998
  body: data,
786
- idempotencyKey: options?.idempotencyKey
999
+ idempotencyKey: options?.idempotencyKey,
1000
+ timeout: options?.timeout
787
1001
  });
788
1002
  }
789
1003
  /**
@@ -839,7 +1053,8 @@ var RecipientsResource = class extends BaseResource {
839
1053
  method: "PUT",
840
1054
  path: `/recipients/${recipientId}`,
841
1055
  body: data,
842
- idempotencyKey: options?.idempotencyKey
1056
+ idempotencyKey: options?.idempotencyKey,
1057
+ timeout: options?.timeout
843
1058
  });
844
1059
  }
845
1060
  /**
@@ -905,7 +1120,8 @@ var DestinationsResource = class extends BaseResource {
905
1120
  method: "POST",
906
1121
  path: `/recipients/${recipientId}/destinations`,
907
1122
  body: data,
908
- idempotencyKey: options?.idempotencyKey
1123
+ idempotencyKey: options?.idempotencyKey,
1124
+ timeout: options?.timeout
909
1125
  });
910
1126
  }
911
1127
  /**
@@ -993,7 +1209,8 @@ var AccountsResource = class extends BaseResource {
993
1209
  method: "POST",
994
1210
  path: "/accounts",
995
1211
  body: data,
996
- idempotencyKey: options?.idempotencyKey
1212
+ idempotencyKey: options?.idempotencyKey,
1213
+ timeout: options?.timeout
997
1214
  });
998
1215
  }
999
1216
  /**
@@ -1052,7 +1269,8 @@ var AccountsResource = class extends BaseResource {
1052
1269
  method: "PATCH",
1053
1270
  path: `/accounts/${accountId}`,
1054
1271
  body: data,
1055
- idempotencyKey: options?.idempotencyKey
1272
+ idempotencyKey: options?.idempotencyKey,
1273
+ timeout: options?.timeout
1056
1274
  });
1057
1275
  }
1058
1276
  /**
@@ -1112,7 +1330,8 @@ var TransactionsResource = class extends BaseResource {
1112
1330
  method: "POST",
1113
1331
  path: "/transactions",
1114
1332
  body: data,
1115
- idempotencyKey: options?.idempotencyKey
1333
+ idempotencyKey: options?.idempotencyKey,
1334
+ timeout: options?.timeout
1116
1335
  });
1117
1336
  }
1118
1337
  /**
@@ -1182,7 +1401,8 @@ var TransactionsResource = class extends BaseResource {
1182
1401
  return this.transport.request({
1183
1402
  method: "POST",
1184
1403
  path: `/transactions/${transactionId}/cancellations`,
1185
- idempotencyKey: options?.idempotencyKey
1404
+ idempotencyKey: options?.idempotencyKey,
1405
+ timeout: options?.timeout
1186
1406
  });
1187
1407
  }
1188
1408
  };
@@ -1235,7 +1455,8 @@ var WalletsResource = class extends BaseResource {
1235
1455
  method: "POST",
1236
1456
  path: "/wallets",
1237
1457
  body: data,
1238
- idempotencyKey: options?.idempotencyKey
1458
+ idempotencyKey: options?.idempotencyKey,
1459
+ timeout: options?.timeout
1239
1460
  });
1240
1461
  }
1241
1462
  /**
@@ -1357,7 +1578,8 @@ var WalletsResource = class extends BaseResource {
1357
1578
  method: "POST",
1358
1579
  path: `/wallets/${walletId}/transactions`,
1359
1580
  body: data,
1360
- idempotencyKey: options?.idempotencyKey
1581
+ idempotencyKey: options?.idempotencyKey,
1582
+ timeout: options?.timeout
1361
1583
  });
1362
1584
  }
1363
1585
  };
@@ -1424,7 +1646,8 @@ var ApplicationsResource = class extends BaseResource {
1424
1646
  method: "POST",
1425
1647
  path: `/applications/${applicationId}/submissions`,
1426
1648
  body: data ?? {},
1427
- idempotencyKey: options?.idempotencyKey
1649
+ idempotencyKey: options?.idempotencyKey,
1650
+ timeout: options?.timeout
1428
1651
  });
1429
1652
  }
1430
1653
  // ==========================================================================
@@ -1444,7 +1667,8 @@ var ApplicationsResource = class extends BaseResource {
1444
1667
  method: "PUT",
1445
1668
  path: `/applications/${applicationId}/business-details`,
1446
1669
  body: data,
1447
- idempotencyKey: options?.idempotencyKey
1670
+ idempotencyKey: options?.idempotencyKey,
1671
+ timeout: options?.timeout
1448
1672
  });
1449
1673
  }
1450
1674
  // ==========================================================================
@@ -1465,7 +1689,8 @@ var ApplicationsResource = class extends BaseResource {
1465
1689
  method: "PUT",
1466
1690
  path: `/applications/${applicationId}/individual-details`,
1467
1691
  body: data,
1468
- idempotencyKey: options?.idempotencyKey
1692
+ idempotencyKey: options?.idempotencyKey,
1693
+ timeout: options?.timeout
1469
1694
  });
1470
1695
  }
1471
1696
  // ==========================================================================
@@ -1483,7 +1708,8 @@ var ApplicationsResource = class extends BaseResource {
1483
1708
  method: "POST",
1484
1709
  path: `/applications/${applicationId}/associated-individuals`,
1485
1710
  body: data,
1486
- idempotencyKey: options?.idempotencyKey
1711
+ idempotencyKey: options?.idempotencyKey,
1712
+ timeout: options?.timeout
1487
1713
  });
1488
1714
  }
1489
1715
  /**
@@ -1501,7 +1727,8 @@ var ApplicationsResource = class extends BaseResource {
1501
1727
  method: "PUT",
1502
1728
  path: `/applications/${applicationId}/associated-individuals/${individualId}`,
1503
1729
  body: data,
1504
- idempotencyKey: options?.idempotencyKey
1730
+ idempotencyKey: options?.idempotencyKey,
1731
+ timeout: options?.timeout
1505
1732
  });
1506
1733
  }
1507
1734
  /**
@@ -1522,15 +1749,26 @@ var ApplicationsResource = class extends BaseResource {
1522
1749
  /**
1523
1750
  * Submit an attestation for an application.
1524
1751
  *
1752
+ * Additionally supplying `disclosure_id` (a terms key the provider
1753
+ * declared, e.g. `partner_disclosures`) and `disclosure_version` records the
1754
+ * attestation as a PARTNER DISCLOSURE acknowledgment instead of a standard
1755
+ * onboarding one: acceptance is stamped `customer_online`, the
1756
+ * partner-onboarding substatus advances, and an already-approved
1757
+ * application is reprovisioned. The API stays partner-agnostic — callers
1758
+ * supply a terms key and version, never a partner name. Get the outstanding
1759
+ * ones from `customers.getCapabilities(customerId)`.
1760
+ *
1525
1761
  * @param applicationId - Application ID
1526
- * @param data - Attestation data (type, timestamp, applicant_id)
1762
+ * @param data - Attestation data (type, timestamp, applicant_id), plus
1763
+ * `disclosure_id` + `disclosure_version` to accept a partner disclosure
1527
1764
  */
1528
1765
  async submitAttestation(applicationId, data, options) {
1529
1766
  await this.transport.request({
1530
1767
  method: "POST",
1531
1768
  path: `/applications/${applicationId}/attestations`,
1532
1769
  body: data,
1533
- idempotencyKey: options?.idempotencyKey
1770
+ idempotencyKey: options?.idempotencyKey,
1771
+ timeout: options?.timeout
1534
1772
  });
1535
1773
  }
1536
1774
  // ==========================================================================
@@ -1562,7 +1800,8 @@ var ApplicationsResource = class extends BaseResource {
1562
1800
  method: "PUT",
1563
1801
  path: `/applications/${applicationId}/edd`,
1564
1802
  body: data,
1565
- idempotencyKey: options?.idempotencyKey
1803
+ idempotencyKey: options?.idempotencyKey,
1804
+ timeout: options?.timeout
1566
1805
  });
1567
1806
  }
1568
1807
  // ==========================================================================
@@ -1583,7 +1822,8 @@ var ApplicationsResource = class extends BaseResource {
1583
1822
  method: "POST",
1584
1823
  path: `/applications/${applicationId}/documents`,
1585
1824
  body: data,
1586
- idempotencyKey: options?.idempotencyKey
1825
+ idempotencyKey: options?.idempotencyKey,
1826
+ timeout: options?.timeout
1587
1827
  });
1588
1828
  }
1589
1829
  /**
@@ -1643,7 +1883,8 @@ var ApplicationsResource = class extends BaseResource {
1643
1883
  method: "POST",
1644
1884
  path: `/applications/${applicationId}/documents/${documentId}/verifications`,
1645
1885
  body: _data ?? {},
1646
- idempotencyKey: options?.idempotencyKey
1886
+ idempotencyKey: options?.idempotencyKey,
1887
+ timeout: options?.timeout
1647
1888
  });
1648
1889
  }
1649
1890
  /**
@@ -1661,7 +1902,8 @@ var ApplicationsResource = class extends BaseResource {
1661
1902
  method: "POST",
1662
1903
  path: `/applications/${applicationId}/document-uploads`,
1663
1904
  body: data,
1664
- idempotencyKey: options?.idempotencyKey
1905
+ idempotencyKey: options?.idempotencyKey,
1906
+ timeout: options?.timeout
1665
1907
  });
1666
1908
  }
1667
1909
  // ==========================================================================
@@ -1684,7 +1926,8 @@ var ApplicationsResource = class extends BaseResource {
1684
1926
  method: "POST",
1685
1927
  path: `/applications/${applicationId}/associated-individuals/${individualId}/documents`,
1686
1928
  body: data,
1687
- idempotencyKey: options?.idempotencyKey
1929
+ idempotencyKey: options?.idempotencyKey,
1930
+ timeout: options?.timeout
1688
1931
  });
1689
1932
  }
1690
1933
  /**
@@ -1703,7 +1946,8 @@ var ApplicationsResource = class extends BaseResource {
1703
1946
  method: "POST",
1704
1947
  path: `/applications/${applicationId}/associated-individuals/${individualId}/document-uploads`,
1705
1948
  body: data,
1706
- idempotencyKey: options?.idempotencyKey
1949
+ idempotencyKey: options?.idempotencyKey,
1950
+ timeout: options?.timeout
1707
1951
  });
1708
1952
  }
1709
1953
  };
@@ -1721,7 +1965,8 @@ var PoliciesResource = class extends BaseResource {
1721
1965
  method: "POST",
1722
1966
  path: "/policies",
1723
1967
  body: data,
1724
- idempotencyKey: options?.idempotencyKey
1968
+ idempotencyKey: options?.idempotencyKey,
1969
+ timeout: options?.timeout
1725
1970
  });
1726
1971
  }
1727
1972
  /**
@@ -1760,7 +2005,8 @@ var PoliciesResource = class extends BaseResource {
1760
2005
  method: "DELETE",
1761
2006
  path: `/policies/${policyId}`,
1762
2007
  body: options?.endorsement,
1763
- idempotencyKey: options?.idempotencyKey
2008
+ idempotencyKey: options?.idempotencyKey,
2009
+ timeout: options?.timeout
1764
2010
  });
1765
2011
  }
1766
2012
  /**
@@ -1775,7 +2021,8 @@ var PoliciesResource = class extends BaseResource {
1775
2021
  method: "POST",
1776
2022
  path: `/policies/${policyId}/rules`,
1777
2023
  body: options?.endorsement ?? data,
1778
- idempotencyKey: options?.idempotencyKey
2024
+ idempotencyKey: options?.idempotencyKey,
2025
+ timeout: options?.timeout
1779
2026
  });
1780
2027
  }
1781
2028
  /**
@@ -1791,7 +2038,8 @@ var PoliciesResource = class extends BaseResource {
1791
2038
  method: "PATCH",
1792
2039
  path: `/policies/${policyId}/rules/${ruleId}`,
1793
2040
  body: options?.endorsement ?? data,
1794
- idempotencyKey: options?.idempotencyKey
2041
+ idempotencyKey: options?.idempotencyKey,
2042
+ timeout: options?.timeout
1795
2043
  });
1796
2044
  }
1797
2045
  /**
@@ -1810,7 +2058,8 @@ var PoliciesResource = class extends BaseResource {
1810
2058
  method: "DELETE",
1811
2059
  path: `/policies/${policyId}/rules/${ruleId}`,
1812
2060
  body: options?.endorsement,
1813
- idempotencyKey: options?.idempotencyKey
2061
+ idempotencyKey: options?.idempotencyKey,
2062
+ timeout: options?.timeout
1814
2063
  });
1815
2064
  }
1816
2065
  /**
@@ -1843,7 +2092,8 @@ var PoliciesResource = class extends BaseResource {
1843
2092
  method: "PUT",
1844
2093
  path: `/policies/${policyId}/wallets/${walletId}`,
1845
2094
  body: options?.endorsement,
1846
- idempotencyKey: options?.idempotencyKey
2095
+ idempotencyKey: options?.idempotencyKey,
2096
+ timeout: options?.timeout
1847
2097
  });
1848
2098
  }
1849
2099
  /**
@@ -1862,7 +2112,8 @@ var PoliciesResource = class extends BaseResource {
1862
2112
  method: "DELETE",
1863
2113
  path: `/policies/${policyId}/wallets/${walletId}`,
1864
2114
  body: options?.endorsement,
1865
- idempotencyKey: options?.idempotencyKey
2115
+ idempotencyKey: options?.idempotencyKey,
2116
+ timeout: options?.timeout
1866
2117
  });
1867
2118
  }
1868
2119
  };
@@ -1880,7 +2131,8 @@ var SignerGroupsResource = class extends BaseResource {
1880
2131
  method: "POST",
1881
2132
  path: "/signer-groups",
1882
2133
  body: data,
1883
- idempotencyKey: options?.idempotencyKey
2134
+ idempotencyKey: options?.idempotencyKey,
2135
+ timeout: options?.timeout
1884
2136
  });
1885
2137
  }
1886
2138
  /**
@@ -1895,13 +2147,27 @@ var SignerGroupsResource = class extends BaseResource {
1895
2147
  /**
1896
2148
  * Get a signer group by ID.
1897
2149
  *
2150
+ * Pass `{ include_removed: true }` to also get a `removed_members` array of
2151
+ * signers that were removed from this group, each carrying its `removed_at`
2152
+ * timestamp. Defaults to active members only.
2153
+ *
1898
2154
  * @param signerGroupId - Signer group ID
2155
+ * @param params - Optional `{ include_removed }`
1899
2156
  * @returns Signer group record
2157
+ *
2158
+ * @example
2159
+ * ```typescript
2160
+ * const group = await client.signerGroups.get(groupId, { include_removed: true });
2161
+ * for (const s of group.removed_members ?? []) {
2162
+ * console.log(s.name, 'removed at', s.removed_at);
2163
+ * }
2164
+ * ```
1900
2165
  */
1901
- async get(signerGroupId) {
2166
+ async get(signerGroupId, params) {
1902
2167
  return this.transport.request({
1903
2168
  method: "GET",
1904
- path: `/signer-groups/${signerGroupId}`
2169
+ path: `/signer-groups/${signerGroupId}`,
2170
+ query: { ...params }
1905
2171
  });
1906
2172
  }
1907
2173
  /**
@@ -1920,14 +2186,16 @@ var SignerGroupsResource = class extends BaseResource {
1920
2186
  method: "POST",
1921
2187
  path: `/signer-groups/${signerGroupId}/signers`,
1922
2188
  body: data,
1923
- idempotencyKey: options?.idempotencyKey
2189
+ idempotencyKey: options?.idempotencyKey,
2190
+ timeout: options?.timeout
1924
2191
  });
1925
2192
  }
1926
2193
  /**
1927
2194
  * Remove a signer from a group.
1928
2195
  *
1929
2196
  * @param signerGroupId - Signer group ID
1930
- * @param signerId - Signer ID
2197
+ * @param signerId - The signer's KSUID `signer_id` — NOT its public key.
2198
+ * (The standalone `client.signers.delete()` takes the public key instead.)
1931
2199
  * @param options - Optional request options (e.g. an explicit idempotency
1932
2200
  * key — the platform requires one on this DELETE)
1933
2201
  */
@@ -1935,7 +2203,8 @@ var SignerGroupsResource = class extends BaseResource {
1935
2203
  await this.transport.request({
1936
2204
  method: "DELETE",
1937
2205
  path: `/signer-groups/${signerGroupId}/signers/${signerId}`,
1938
- idempotencyKey: options?.idempotencyKey
2206
+ idempotencyKey: options?.idempotencyKey,
2207
+ timeout: options?.timeout
1939
2208
  });
1940
2209
  }
1941
2210
  /**
@@ -1968,7 +2237,8 @@ var SignerGroupsResource = class extends BaseResource {
1968
2237
  method: "PUT",
1969
2238
  path: `/wallets/${walletId}/signer-groups/${signerGroupId}`,
1970
2239
  body: options?.endorsement,
1971
- idempotencyKey: options?.idempotencyKey
2240
+ idempotencyKey: options?.idempotencyKey,
2241
+ timeout: options?.timeout
1972
2242
  });
1973
2243
  }
1974
2244
  /**
@@ -1987,7 +2257,8 @@ var SignerGroupsResource = class extends BaseResource {
1987
2257
  method: "DELETE",
1988
2258
  path: `/wallets/${walletId}/signer-groups/${signerGroupId}`,
1989
2259
  body: options?.endorsement,
1990
- idempotencyKey: options?.idempotencyKey
2260
+ idempotencyKey: options?.idempotencyKey,
2261
+ timeout: options?.timeout
1991
2262
  });
1992
2263
  }
1993
2264
  /**
@@ -2014,7 +2285,8 @@ var SignersResource = class extends BaseResource {
2014
2285
  method: "POST",
2015
2286
  path: "/signers",
2016
2287
  body: data,
2017
- idempotencyKey: options?.idempotencyKey
2288
+ idempotencyKey: options?.idempotencyKey,
2289
+ timeout: options?.timeout
2018
2290
  });
2019
2291
  }
2020
2292
  /**
@@ -2045,7 +2317,8 @@ var ApiKeysResource = class extends BaseResource {
2045
2317
  method: "POST",
2046
2318
  path: "/api-keys",
2047
2319
  body: data,
2048
- idempotencyKey: options?.idempotencyKey
2320
+ idempotencyKey: options?.idempotencyKey,
2321
+ timeout: options?.timeout
2049
2322
  });
2050
2323
  }
2051
2324
  /**
@@ -2093,7 +2366,8 @@ var ApiKeysResource = class extends BaseResource {
2093
2366
  method: "POST",
2094
2367
  path: "/api-keys/admin",
2095
2368
  body: data,
2096
- idempotencyKey: options?.idempotencyKey
2369
+ idempotencyKey: options?.idempotencyKey,
2370
+ timeout: options?.timeout
2097
2371
  });
2098
2372
  }
2099
2373
  };
@@ -2111,7 +2385,8 @@ var UsersResource = class extends BaseResource {
2111
2385
  method: "POST",
2112
2386
  path: "/users",
2113
2387
  body: data,
2114
- idempotencyKey: options?.idempotencyKey
2388
+ idempotencyKey: options?.idempotencyKey,
2389
+ timeout: options?.timeout
2115
2390
  });
2116
2391
  }
2117
2392
  /**
@@ -2134,7 +2409,8 @@ var UsersResource = class extends BaseResource {
2134
2409
  method: "PATCH",
2135
2410
  path: `/users/${userId}`,
2136
2411
  body: data,
2137
- idempotencyKey: options?.idempotencyKey
2412
+ idempotencyKey: options?.idempotencyKey,
2413
+ timeout: options?.timeout
2138
2414
  });
2139
2415
  }
2140
2416
  /**
@@ -2163,7 +2439,8 @@ var WebhooksResource = class extends BaseResource {
2163
2439
  method: "POST",
2164
2440
  path: "/webhooks/targets",
2165
2441
  body: data,
2166
- idempotencyKey: options?.idempotencyKey
2442
+ idempotencyKey: options?.idempotencyKey,
2443
+ timeout: options?.timeout
2167
2444
  });
2168
2445
  }
2169
2446
  /**
@@ -2199,7 +2476,8 @@ var WebhooksResource = class extends BaseResource {
2199
2476
  method: "PATCH",
2200
2477
  path: `/webhooks/targets/${targetId}`,
2201
2478
  body: data,
2202
- idempotencyKey: options?.idempotencyKey
2479
+ idempotencyKey: options?.idempotencyKey,
2480
+ timeout: options?.timeout
2203
2481
  });
2204
2482
  }
2205
2483
  /**
@@ -2276,7 +2554,8 @@ var WebhooksResource = class extends BaseResource {
2276
2554
  return this.transport.request({
2277
2555
  method: "POST",
2278
2556
  path: `/webhooks/events/${eventId}/replay`,
2279
- idempotencyKey: options?.idempotencyKey
2557
+ idempotencyKey: options?.idempotencyKey,
2558
+ timeout: options?.timeout
2280
2559
  });
2281
2560
  }
2282
2561
  };
@@ -2387,7 +2666,8 @@ var SandboxResource = class extends BaseResource {
2387
2666
  method: "POST",
2388
2667
  path: "/sandbox/simulate/inbound",
2389
2668
  body: data,
2390
- idempotencyKey: options?.idempotencyKey
2669
+ idempotencyKey: options?.idempotencyKey,
2670
+ timeout: options?.timeout
2391
2671
  });
2392
2672
  }
2393
2673
  /**
@@ -2436,7 +2716,8 @@ var SandboxResource = class extends BaseResource {
2436
2716
  method: "POST",
2437
2717
  path: "/sandbox/simulate/onboarding",
2438
2718
  body: data,
2439
- idempotencyKey: options?.idempotencyKey
2719
+ idempotencyKey: options?.idempotencyKey,
2720
+ timeout: options?.timeout
2440
2721
  });
2441
2722
  }
2442
2723
  /**
@@ -2484,7 +2765,8 @@ var SandboxResource = class extends BaseResource {
2484
2765
  method: "POST",
2485
2766
  path: `/sandbox/simulations/${simulationId}/advance`,
2486
2767
  body: data,
2487
- idempotencyKey: options?.idempotencyKey
2768
+ idempotencyKey: options?.idempotencyKey,
2769
+ timeout: options?.timeout
2488
2770
  });
2489
2771
  }
2490
2772
  /**
@@ -2533,7 +2815,8 @@ var SelfServeResource = class extends BaseResource {
2533
2815
  method: "POST",
2534
2816
  path: "/self-serve/credits/purchase",
2535
2817
  body: data,
2536
- idempotencyKey: options?.idempotencyKey
2818
+ idempotencyKey: options?.idempotencyKey,
2819
+ timeout: options?.timeout
2537
2820
  });
2538
2821
  }
2539
2822
  /**
@@ -2632,6 +2915,75 @@ var SelfServeResource = class extends BaseResource {
2632
2915
  }
2633
2916
  };
2634
2917
 
2918
+ // src/client/resources/fee-payout-destination.ts
2919
+ var FeePayoutDestinationResource = class extends BaseResource {
2920
+ /**
2921
+ * Get the destination registered to receive your developer-fee payouts.
2922
+ *
2923
+ * @returns The registered destination
2924
+ *
2925
+ * @example
2926
+ * ```typescript
2927
+ * const dest = await client.feePayoutDestination.get();
2928
+ * console.log(dest.chain, dest.wallet_address);
2929
+ * ```
2930
+ */
2931
+ async get() {
2932
+ return this.transport.request({
2933
+ method: "GET",
2934
+ path: "/fee-payout-destination"
2935
+ });
2936
+ }
2937
+ /**
2938
+ * Register or replace your fee payout destination.
2939
+ *
2940
+ * There is exactly one destination per organization, so this REPLACES any
2941
+ * existing one. Emits `fee_payout_destination.updated`.
2942
+ *
2943
+ * `chain` is a CAIP-2 chain id (e.g. `eip155:8453`) from the supported
2944
+ * networks list — see `client.info.getNetworks()`.
2945
+ *
2946
+ * @param data - The USDC wallet to pay fees to
2947
+ * @param options - Request options (e.g., custom idempotency key)
2948
+ * @returns The stored destination
2949
+ *
2950
+ * @example
2951
+ * ```typescript
2952
+ * const dest = await client.feePayoutDestination.set({
2953
+ * usdc_wallet: {
2954
+ * chain: 'eip155:8453',
2955
+ * address: '0x1234567890123456789012345678901234567890',
2956
+ * },
2957
+ * });
2958
+ * ```
2959
+ */
2960
+ async set(data, options) {
2961
+ return this.transport.request({
2962
+ method: "PUT",
2963
+ path: "/fee-payout-destination",
2964
+ body: data,
2965
+ idempotencyKey: options?.idempotencyKey,
2966
+ timeout: options?.timeout
2967
+ });
2968
+ }
2969
+ /**
2970
+ * Remove the registered fee payout destination, if one exists.
2971
+ *
2972
+ * Emits `fee_payout_destination.deleted`.
2973
+ *
2974
+ * @example
2975
+ * ```typescript
2976
+ * await client.feePayoutDestination.delete();
2977
+ * ```
2978
+ */
2979
+ async delete() {
2980
+ await this.transport.request({
2981
+ method: "DELETE",
2982
+ path: "/fee-payout-destination"
2983
+ });
2984
+ }
2985
+ };
2986
+
2635
2987
  // src/client/resources/payment-agents.ts
2636
2988
  var PaymentAgentsResource = class extends BaseResource {
2637
2989
  /**
@@ -2645,7 +2997,8 @@ var PaymentAgentsResource = class extends BaseResource {
2645
2997
  method: "POST",
2646
2998
  path: "/payment-agents",
2647
2999
  body: data,
2648
- idempotencyKey: options?.idempotencyKey
3000
+ idempotencyKey: options?.idempotencyKey,
3001
+ timeout: options?.timeout
2649
3002
  });
2650
3003
  }
2651
3004
  /**
@@ -2684,7 +3037,8 @@ var PaymentAgentsResource = class extends BaseResource {
2684
3037
  return this.transport.request({
2685
3038
  method: "POST",
2686
3039
  path: `/payment-agents/${paymentAgentId}/revoke`,
2687
- idempotencyKey: options?.idempotencyKey
3040
+ idempotencyKey: options?.idempotencyKey,
3041
+ timeout: options?.timeout
2688
3042
  });
2689
3043
  }
2690
3044
  /**
@@ -2696,6 +3050,12 @@ var PaymentAgentsResource = class extends BaseResource {
2696
3050
  * `AgentConversation` for multi-turn chat; use this directly only for
2697
3051
  * one-shot proposals.
2698
3052
  *
3053
+ * SLOW BY NATURE. A turn is a sequence of model calls — read the payees,
3054
+ * check balances, draft, revise — so a multi-payee request legitimately
3055
+ * runs minutes. It therefore defaults to {@link AGENTIC_MODEL_TIMEOUT_MS}
3056
+ * rather than the client's ordinary deadline. Pass `{ timeout }` to
3057
+ * change it for one call; an explicit client-wide `timeout` still wins.
3058
+ *
2699
3059
  * @param paymentAgentId - Payment agent ID
2700
3060
  * @param data - Prompt and/or messages
2701
3061
  * @returns Proposals (at high confidence) and/or a conversational reply
@@ -2705,7 +3065,44 @@ var PaymentAgentsResource = class extends BaseResource {
2705
3065
  method: "POST",
2706
3066
  path: `/payment-agents/${paymentAgentId}/proposals`,
2707
3067
  body: data,
2708
- idempotencyKey: options?.idempotencyKey
3068
+ idempotencyKey: options?.idempotencyKey,
3069
+ timeout: options?.timeout,
3070
+ endpointTimeout: AGENTIC_MODEL_TIMEOUT_MS
3071
+ });
3072
+ }
3073
+ /**
3074
+ * Live progress of an in-flight drafting turn.
3075
+ *
3076
+ * A multi-payee drafting turn legitimately runs minutes (several sequential
3077
+ * model calls). While a `createProposals` call is in flight, poll this every
3078
+ * few seconds to show the customer what the agent is doing right now.
3079
+ *
3080
+ * Advisory display only. `active: false` means no turn is currently
3081
+ * publishing progress for this agent — idle, just finished, or served by
3082
+ * another instance — so fall back to a generic spinner. Never gate any
3083
+ * behaviour on this endpoint.
3084
+ *
3085
+ * The snapshot is coarse and customer-safe: a phase enum, one human
3086
+ * sentence, and the model round. Tool counts only — never payee names,
3087
+ * amounts, or addresses.
3088
+ *
3089
+ * @param paymentAgentId - Payment agent ID
3090
+ * @returns The current progress snapshot
3091
+ *
3092
+ * @example
3093
+ * ```typescript
3094
+ * const pending = client.paymentAgents.createProposals(agentId, { prompt });
3095
+ * const poll = setInterval(async () => {
3096
+ * const p = await client.paymentAgents.getProposalsProgress(agentId);
3097
+ * if (p.active) console.log(p.detail);
3098
+ * }, 3000);
3099
+ * const result = await pending.finally(() => clearInterval(poll));
3100
+ * ```
3101
+ */
3102
+ async getProposalsProgress(paymentAgentId) {
3103
+ return this.transport.request({
3104
+ method: "GET",
3105
+ path: `/payment-agents/${paymentAgentId}/proposals/progress`
2709
3106
  });
2710
3107
  }
2711
3108
  };
@@ -2724,7 +3121,8 @@ var InstructionsResource = class extends BaseResource {
2724
3121
  method: "POST",
2725
3122
  path: "/instructions",
2726
3123
  body: data,
2727
- idempotencyKey: options?.idempotencyKey
3124
+ idempotencyKey: options?.idempotencyKey,
3125
+ timeout: options?.timeout
2728
3126
  });
2729
3127
  }
2730
3128
  /**
@@ -2785,7 +3183,8 @@ var MandatesResource = class extends BaseResource {
2785
3183
  method: "POST",
2786
3184
  path: "/mandates",
2787
3185
  body: data,
2788
- idempotencyKey: options?.idempotencyKey
3186
+ idempotencyKey: options?.idempotencyKey,
3187
+ timeout: options?.timeout
2789
3188
  });
2790
3189
  }
2791
3190
  /**
@@ -2803,7 +3202,8 @@ var MandatesResource = class extends BaseResource {
2803
3202
  method: "POST",
2804
3203
  path: `/mandates/${mandateId}/approve`,
2805
3204
  body: data,
2806
- idempotencyKey: options?.idempotencyKey
3205
+ idempotencyKey: options?.idempotencyKey,
3206
+ timeout: options?.timeout
2807
3207
  });
2808
3208
  }
2809
3209
  /**
@@ -2821,7 +3221,105 @@ var MandatesResource = class extends BaseResource {
2821
3221
  method: "POST",
2822
3222
  path: `/mandates/${mandateId}/cancel`,
2823
3223
  body: data,
2824
- idempotencyKey: options?.idempotencyKey
3224
+ idempotencyKey: options?.idempotencyKey,
3225
+ timeout: options?.timeout
3226
+ });
3227
+ }
3228
+ /**
3229
+ * Amend a mandate — append a new signed version of its rule.
3230
+ *
3231
+ * Carries a changed rule into force with ONE signature and WITHOUT resetting
3232
+ * the spend already made in the current window: usage accrues to the
3233
+ * MANDATE, so an agent that has spent 9,000 of a 10,000 monthly limit and is
3234
+ * amended to 20,000 has 11,000 left, not 20,000.
3235
+ *
3236
+ * The `rule` is stored and verified VERBATIM — this endpoint does not
3237
+ * normalize it. It must already be canonical: `window` present and non-empty
3238
+ * (send `'NONE'` for a lifetime window), `targets` as recipient ids rather
3239
+ * than payee names, and `asset` uppercase. `target_type`, `window`, `asset`
3240
+ * and `network_id` must also match the current version exactly; only the
3241
+ * amount fields and `targets` may differ. Anything else is a 400 naming the
3242
+ * offending field.
3243
+ *
3244
+ * Build `signature` from `mandateAmendSignPayload(mandate, version, rule)` —
3245
+ * the amend payload commits to the version being created, so a signature for
3246
+ * v2 can never be replayed to append v3.
3247
+ *
3248
+ * @param mandateId - Mandate ID
3249
+ * @param data - Amending signer public key + signature + the complete NEW rule
3250
+ * @returns The mandate at its new current version
3251
+ *
3252
+ * @example
3253
+ * ```typescript
3254
+ * const mandate = await client.mandates.get(mandateId);
3255
+ * const nextVersion = (mandate.version ?? 1) + 1;
3256
+ * const rule = { ...mandate.rule, max_amount_in_window: '20000' };
3257
+ * const payload = mandateAmendSignPayload(mandate, nextVersion, rule);
3258
+ *
3259
+ * const amended = await client.mandates.amend(mandateId, {
3260
+ * signer_public_key: signer.publicKeyBase64(),
3261
+ * signature: await signer.sign(payload),
3262
+ * rule,
3263
+ * });
3264
+ * ```
3265
+ */
3266
+ async amend(mandateId, data, options) {
3267
+ return this.transport.request({
3268
+ method: "POST",
3269
+ path: `/mandates/${mandateId}/amend`,
3270
+ body: data,
3271
+ idempotencyKey: options?.idempotencyKey,
3272
+ timeout: options?.timeout
3273
+ });
3274
+ }
3275
+ /**
3276
+ * List a mandate's versions, oldest first.
3277
+ *
3278
+ * The append-only history of every rule that was ever in force under this
3279
+ * mandate, and the §8 signer that put each one there. Versions are
3280
+ * immutable, so a rule listed here never changes — this is what makes an
3281
+ * executed payment's `mandate_version` audit stamp legible.
3282
+ *
3283
+ * @param mandateId - Mandate ID
3284
+ * @returns Every version, oldest first
3285
+ */
3286
+ async listVersions(mandateId) {
3287
+ return this.transport.request({
3288
+ method: "GET",
3289
+ path: `/mandates/${mandateId}/versions`
3290
+ });
3291
+ }
3292
+ /**
3293
+ * Get a mandate's remaining budget right now.
3294
+ *
3295
+ * The mandate's `rule` gives the ceilings; this gives the CONSUMPTION — what
3296
+ * has already been spent, what is earmarked by scheduled payments that have
3297
+ * not fired yet, and therefore what is left. Read it before scheduling:
3298
+ * otherwise an over-budget payment is only discovered when the gate denies
3299
+ * it at its due date, days later, with the payee unpaid.
3300
+ *
3301
+ * Advisory — nothing here reserves budget, and the gate remains the
3302
+ * authority at fire time. Two things to honour when reading a line:
3303
+ * an ABSENT `remaining_amount` / `remaining_count` means "not capped", never
3304
+ * "nothing left"; a `remaining_amount` of `'?'` means the figure could not
3305
+ * be summed and MUST be treated as no headroom (the gate fails closed on the
3306
+ * same data).
3307
+ *
3308
+ * @param mandateId - Mandate ID
3309
+ * @returns Per-target and aggregate budget lines, as of a stated instant
3310
+ *
3311
+ * @example
3312
+ * ```typescript
3313
+ * const budget = await client.mandates.getBudget(mandateId);
3314
+ * for (const line of budget.aggregate) {
3315
+ * console.log(line.bucket, line.remaining_amount ?? 'uncapped');
3316
+ * }
3317
+ * ```
3318
+ */
3319
+ async getBudget(mandateId) {
3320
+ return this.transport.request({
3321
+ method: "GET",
3322
+ path: `/mandates/${mandateId}/budget`
2825
3323
  });
2826
3324
  }
2827
3325
  };
@@ -2857,7 +3355,8 @@ var ScheduledPaymentsResource = class extends BaseResource {
2857
3355
  method: "POST",
2858
3356
  path: "/scheduled-payments",
2859
3357
  body: data,
2860
- idempotencyKey: options?.idempotencyKey
3358
+ idempotencyKey: options?.idempotencyKey,
3359
+ timeout: options?.timeout
2861
3360
  });
2862
3361
  }
2863
3362
  /**
@@ -2873,7 +3372,8 @@ var ScheduledPaymentsResource = class extends BaseResource {
2873
3372
  await this.transport.request({
2874
3373
  method: "POST",
2875
3374
  path: `/scheduled-payments/${scheduledPaymentId}/cancel`,
2876
- idempotencyKey: options?.idempotencyKey
3375
+ idempotencyKey: options?.idempotencyKey,
3376
+ timeout: options?.timeout
2877
3377
  });
2878
3378
  }
2879
3379
  };
@@ -2909,6 +3409,10 @@ var InsightsResource = class extends BaseResource {
2909
3409
  * never moves money. Rate-limited per customer (hourly burst + daily
2910
3410
  * window) — a 429 means back off and retry later.
2911
3411
  *
3412
+ * Model-backed, so it defaults to {@link AGENTIC_MODEL_TIMEOUT_MS} rather
3413
+ * than the client's ordinary deadline. Pass `{ timeout }` to change it for
3414
+ * one call; an explicit client-wide `timeout` still wins.
3415
+ *
2912
3416
  * @param customerId - Customer ID
2913
3417
  * @param data - The conversation so far (1–40 messages)
2914
3418
  * @returns The assistant's reply (+ how the boundary screen treated the turn)
@@ -2918,7 +3422,9 @@ var InsightsResource = class extends BaseResource {
2918
3422
  method: "POST",
2919
3423
  path: `/customers/${customerId}/insights/chat`,
2920
3424
  body: data,
2921
- idempotencyKey: options?.idempotencyKey
3425
+ idempotencyKey: options?.idempotencyKey,
3426
+ timeout: options?.timeout,
3427
+ endpointTimeout: AGENTIC_MODEL_TIMEOUT_MS
2922
3428
  });
2923
3429
  }
2924
3430
  };
@@ -2927,10 +3433,14 @@ var InsightsResource = class extends BaseResource {
2927
3433
  var AgentConversation = class {
2928
3434
  client;
2929
3435
  paymentAgentId;
3436
+ timezone;
3437
+ timeout;
2930
3438
  history = [];
2931
- constructor(client, paymentAgentId, history) {
3439
+ constructor(client, paymentAgentId, history, options) {
2932
3440
  this.client = client;
2933
3441
  this.paymentAgentId = paymentAgentId;
3442
+ this.timezone = options?.timezone;
3443
+ this.timeout = options?.timeout;
2934
3444
  if (history && history.length > 0) {
2935
3445
  this.history = history.map(cloneMessage);
2936
3446
  }
@@ -2971,9 +3481,16 @@ var AgentConversation = class {
2971
3481
  }
2972
3482
  let result;
2973
3483
  try {
2974
- result = await this.client.paymentAgents.createProposals(this.paymentAgentId, {
2975
- messages
2976
- });
3484
+ result = await this.client.paymentAgents.createProposals(
3485
+ this.paymentAgentId,
3486
+ {
3487
+ messages,
3488
+ // Resent on EVERY turn — the endpoint is stateless, so a zone given
3489
+ // once would be forgotten on the next one.
3490
+ ...this.timezone ? { timezone: this.timezone } : {}
3491
+ },
3492
+ this.timeout !== void 0 ? { timeout: this.timeout } : void 0
3493
+ );
2977
3494
  } catch (err) {
2978
3495
  this.history.pop();
2979
3496
  throw err;
@@ -3113,6 +3630,8 @@ var DakotaClient = class {
3113
3630
  sandbox;
3114
3631
  /** Self-Serve Credits API - manage prepaid transfer credits */
3115
3632
  selfServe;
3633
+ /** Fee Payout Destination API - where Dakota pays your accrued developer fees */
3634
+ feePayoutDestination;
3116
3635
  /** Payment Agents API (ALPHA) - hosted signing agents that draft payments */
3117
3636
  paymentAgents;
3118
3637
  /** Instructions API (ALPHA) - accept and inspect actuated proposals */
@@ -3176,6 +3695,7 @@ var DakotaClient = class {
3176
3695
  this.info = new InfoResource(this.transport);
3177
3696
  this.sandbox = new SandboxResource(this.transport);
3178
3697
  this.selfServe = new SelfServeResource(this.transport);
3698
+ this.feePayoutDestination = new FeePayoutDestinationResource(this.transport);
3179
3699
  this.paymentAgents = new PaymentAgentsResource(this.transport);
3180
3700
  this.instructions = new InstructionsResource(this.transport);
3181
3701
  this.mandates = new MandatesResource(this.transport);
@@ -3192,17 +3712,24 @@ var DakotaClient = class {
3192
3712
  /**
3193
3713
  * Start a fresh multi-turn conversation with a payment agent.
3194
3714
  *
3715
+ * Pass `{ timezone }` (an IANA zone) so the agent resolves "tomorrow" and
3716
+ * "10 am" in the customer's local time rather than UTC. The conversation
3717
+ * resends it on every turn.
3718
+ *
3195
3719
  * @see AgentConversation
3196
3720
  */
3197
- newAgentConversation(paymentAgentId) {
3198
- return new AgentConversation(this, paymentAgentId);
3721
+ newAgentConversation(paymentAgentId, options) {
3722
+ return new AgentConversation(this, paymentAgentId, void 0, options);
3199
3723
  }
3200
3724
  /**
3201
3725
  * Rebuild a conversation from a persisted transcript (oldest first) —
3202
3726
  * for backends that store the history between requests.
3727
+ *
3728
+ * A stateless backend must pass `{ timezone }` again here: the transcript
3729
+ * carries the messages, not the zone.
3203
3730
  */
3204
- resumeAgentConversation(paymentAgentId, history) {
3205
- return new AgentConversation(this, paymentAgentId, history);
3731
+ resumeAgentConversation(paymentAgentId, history, options) {
3732
+ return new AgentConversation(this, paymentAgentId, history, options);
3206
3733
  }
3207
3734
  /**
3208
3735
  * Grant a principal (user or agent — both are just signers) permission to
@@ -3289,6 +3816,27 @@ function mandateSignPayload(mandate, action) {
3289
3816
  });
3290
3817
  return new TextEncoder().encode(encoded);
3291
3818
  }
3819
+ function mandateAmendSignPayload(mandate, version, rule) {
3820
+ if (!mandate.id) {
3821
+ throw new Error("mandate has no id");
3822
+ }
3823
+ if (!mandate.bound_signer_id) {
3824
+ throw new Error("mandate has no bound_signer_id");
3825
+ }
3826
+ if (!Number.isInteger(version) || version < 2) {
3827
+ throw new Error("amend version must be an integer >= 2 (the version being created)");
3828
+ }
3829
+ const encoded = canonicalJSON({
3830
+ action: "amend",
3831
+ id: mandate.id,
3832
+ bound_signer: mandate.bound_signer_id,
3833
+ rule,
3834
+ valid_from: mandate.valid_from ?? 0,
3835
+ valid_until: mandate.valid_until ?? 0,
3836
+ version
3837
+ });
3838
+ return new TextEncoder().encode(encoded);
3839
+ }
3292
3840
  function attachGroupPayload(walletId, groupId, idempotencyKey) {
3293
3841
  return textBytes(
3294
3842
  canonicalJSON({
@@ -3454,6 +4002,6 @@ function verifyMandateSignature(publicKeyBase64, payload, signatureBase64) {
3454
4002
  }
3455
4003
  }
3456
4004
 
3457
- export { APIError, AccountsResource, AgentConversation, ApiKeysResource, ApplicationsResource, AuthMode, AutoTransactionsResource, ConfigurationError, CustomersResource, DEFAULT_RETRY_POLICY, DakotaClient, DestinationsResource, Environment, EventsResource, InfoResource, InsightsResource, InstructionsResource, MandatesResource, P256MandateSigner, PaginatedIterator, PaymentAgentsResource, PoliciesResource, RecipientsResource, SandboxResource, ScheduledPaymentsResource, SelfServeResource, SignerGroupsResource, SignersResource, TransactionsResource, TransportError, UsersResource, WalletsResource, WebhooksResource, addPolicyRulePayload, attachGroupPayload, attachPolicyPayload, attachUserToWallet, canonicalJSON, consoleLogger, deletePolicyPayload, detachGroupPayload, detachPolicyPayload, detachUserFromWallet, getEnvironmentURL, mandateSignPayload, noopLogger, paginate, removePolicyRulePayload, updatePolicyRulePayload, verifyMandateSignature };
4005
+ export { APIError, AccountsResource, AgentConversation, ApiKeysResource, ApplicationsResource, AuthMode, AutoTransactionsResource, ConfigurationError, CustomersResource, DEFAULT_RETRY_POLICY, DakotaClient, DestinationsResource, Environment, EventsResource, FeePayoutDestinationResource, InfoResource, InsightsResource, InstructionsResource, MandatesResource, P256MandateSigner, PaginatedIterator, PaymentAgentsResource, PoliciesResource, RecipientsResource, SandboxResource, ScheduledPaymentsResource, SelfServeResource, SignerGroupsResource, SignersResource, TransactionsResource, TransportError, UsersResource, WalletsResource, WebhooksResource, addPolicyRulePayload, attachGroupPayload, attachPolicyPayload, attachUserToWallet, canonicalJSON, consoleLogger, deletePolicyPayload, detachGroupPayload, detachPolicyPayload, detachUserFromWallet, getEnvironmentURL, mandateAmendSignPayload, mandateSignPayload, noopLogger, paginate, removePolicyRulePayload, updatePolicyRulePayload, verifyMandateSignature };
3458
4006
  //# sourceMappingURL=index.mjs.map
3459
4007
  //# sourceMappingURL=index.mjs.map