@dakota-xyz/ts-sdk 2.2.1 → 3.0.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.js CHANGED
@@ -39,6 +39,26 @@ var APIError = class _APIError extends Error {
39
39
  rawBody;
40
40
  /** Whether this error is safe to retry */
41
41
  retryable;
42
+ /**
43
+ * A plain-language rendition of the problem, written for the END CUSTOMER,
44
+ * when one exists for this error.
45
+ *
46
+ * `message` names request fields and actions so a machine caller can
47
+ * self-correct. This says the same thing without API vocabulary. Show it
48
+ * when relaying an error into a human surface (chat, email, UI), and fall
49
+ * back to `message` when it is null.
50
+ */
51
+ userMessage;
52
+ /**
53
+ * A link the customer can follow to CLEAR this error, present only on
54
+ * problems with a concrete self-service remedy.
55
+ *
56
+ * Today `terms-not-accepted` returns one, pointing at the hosted flow where
57
+ * the outstanding agreement can be signed. It is token-gated and usable
58
+ * as-is — send the customer to it rather than parsing one out of the
59
+ * message.
60
+ */
61
+ resolutionUrl;
42
62
  constructor(statusCode, code, message, options) {
43
63
  super(message);
44
64
  this.name = "APIError";
@@ -48,6 +68,8 @@ var APIError = class _APIError extends Error {
48
68
  this.requestId = options?.requestId ?? null;
49
69
  this.rawBody = options?.rawBody ?? null;
50
70
  this.retryable = RETRYABLE_STATUS_CODES.has(statusCode);
71
+ this.userMessage = options?.userMessage ?? null;
72
+ this.resolutionUrl = options?.resolutionUrl ?? null;
51
73
  if (Error.captureStackTrace) {
52
74
  Error.captureStackTrace(this, _APIError);
53
75
  }
@@ -61,6 +83,8 @@ var APIError = class _APIError extends Error {
61
83
  let code = `http_${response.status}`;
62
84
  let message = response.statusText || "Unknown error";
63
85
  let details = null;
86
+ let userMessage = null;
87
+ let resolutionUrl = null;
64
88
  try {
65
89
  rawBody = await response.text();
66
90
  const parsed = JSON.parse(rawBody);
@@ -86,12 +110,20 @@ var APIError = class _APIError extends Error {
86
110
  if (parsed.details && typeof parsed.details === "object") {
87
111
  details = parsed.details;
88
112
  }
113
+ if (typeof parsed.user_message === "string") {
114
+ userMessage = parsed.user_message;
115
+ }
116
+ if (typeof parsed.resolution_url === "string") {
117
+ resolutionUrl = parsed.resolution_url;
118
+ }
89
119
  } catch {
90
120
  }
91
121
  return new _APIError(response.status, code, message, {
92
122
  details,
93
123
  requestId,
94
- rawBody
124
+ rawBody,
125
+ userMessage,
126
+ resolutionUrl
95
127
  });
96
128
  }
97
129
  toString() {
@@ -605,8 +637,12 @@ var BaseResource = class {
605
637
  }
606
638
  /**
607
639
  * Create a paginated iterator for a list endpoint.
640
+ *
641
+ * `inspectMeta` is called with each page's raw `meta` before the page is
642
+ * yielded, for endpoints whose meta says something the caller must act on.
643
+ * Throw from it to fail the page.
608
644
  */
609
- paginate(path, params, cursorExtractor) {
645
+ paginate(path, params, cursorExtractor, inspectMeta) {
610
646
  const fetcher = async (cursor) => {
611
647
  const query = {};
612
648
  if (params) {
@@ -625,8 +661,10 @@ var BaseResource = class {
625
661
  query
626
662
  });
627
663
  if (Array.isArray(response)) {
664
+ inspectMeta?.(void 0);
628
665
  return { data: response, meta: void 0 };
629
666
  }
667
+ inspectMeta?.(response.meta);
630
668
  return {
631
669
  data: response.data ?? [],
632
670
  meta: response.meta
@@ -700,6 +738,11 @@ var CustomersResource = class extends BaseResource {
700
738
  * // With filters
701
739
  * const active = client.customers.list({ kyb_status: 'active' });
702
740
  *
741
+ * // Several statuses at once — one comma-separated string, not an array
742
+ * const needsAttention = client.customers.list({
743
+ * status: 'info_requested,frozen',
744
+ * });
745
+ *
703
746
  * // Collect all to array
704
747
  * const all = await client.customers.list().toArray();
705
748
  * ```
@@ -707,6 +750,38 @@ var CustomersResource = class extends BaseResource {
707
750
  list(params) {
708
751
  return this.paginate("/customers", params);
709
752
  }
753
+ /**
754
+ * One page of customers, with the per-status counts.
755
+ *
756
+ * {@link list} iterates rows and drops the envelope, so `status_counts` —
757
+ * the counts a dashboard's status header renders — is unreachable through
758
+ * it. This returns the raw page instead: same filters, one request, no
759
+ * iteration.
760
+ *
761
+ * The counts are computed under the same filters but IGNORING the `status`
762
+ * selection, so every chip keeps its count while one of them is the active
763
+ * filter.
764
+ *
765
+ * @param params - The same filters {@link list} accepts
766
+ * @returns One page: rows, pagination meta, and `status_counts`
767
+ *
768
+ * @example
769
+ * ```typescript
770
+ * const page = await client.customers.listPage({ limit: 25 });
771
+ * console.log(page.status_counts?.info_requested ?? 0);
772
+ * for (const customer of page.data) {
773
+ * console.log(customer.name, customer.status);
774
+ * }
775
+ * ```
776
+ */
777
+ async listPage(params) {
778
+ const page = await this.transport.request({
779
+ method: "GET",
780
+ path: "/customers",
781
+ query: params
782
+ });
783
+ return { ...page, data: page.data ?? [] };
784
+ }
710
785
  /**
711
786
  * Get a customer by ID.
712
787
  *
@@ -1345,25 +1420,56 @@ var TransactionsResource = class extends BaseResource {
1345
1420
  });
1346
1421
  }
1347
1422
  /**
1348
- * List one-off transactions.
1423
+ * List transactions.
1424
+ *
1425
+ * `GET /transactions` serves three resource families from one path, and the
1426
+ * family decides the row shape — so the family you ask for decides what this
1427
+ * iterator yields:
1428
+ *
1429
+ * | `transaction_type` | Yields |
1430
+ * |--------------------|--------|
1431
+ * | omitted or `'one_off'` | {@link OneOffTransaction} |
1432
+ * | `'wallet'` | {@link WalletTransaction} |
1433
+ * | `'auto_account'` | {@link AutoTransaction} (requires `customer_id`) |
1434
+ *
1435
+ * **The family is always named on the wire.** Left to the server, it is
1436
+ * INFERRED from the other filters, and `customer_id` on its own infers
1437
+ * `auto_account` — so `list({ customer_id })` would return that customer's
1438
+ * auto-account transactions while this method's type promised one-off ones.
1439
+ * Those rows parse into `OneOffTransaction` with missing fields rather than
1440
+ * failing, so nothing surfaced the substitution. Omitting the family here
1441
+ * therefore sends `transaction_type=one_off` rather than leaving it open.
1442
+ *
1443
+ * The family the server reports back (`meta.transaction_type`) is checked
1444
+ * against the one requested, and a mismatch throws instead of yielding rows
1445
+ * of the wrong shape.
1349
1446
  *
1350
1447
  * @param params - Filter and pagination parameters
1351
- * @returns Async iterator of transactions
1448
+ * @returns Async iterator over the requested family
1352
1449
  *
1353
1450
  * @example
1354
1451
  * ```typescript
1355
- * // List all transactions
1452
+ * // One-off transactions (the default family)
1356
1453
  * for await (const tx of client.transactions.list()) {
1357
1454
  * console.log(tx.id, tx.status);
1358
1455
  * }
1359
1456
  *
1360
- * // Filter by customer and status
1457
+ * // This customer's ONE-OFF transactions
1361
1458
  * const completed = client.transactions.list({
1362
1459
  * customer_id: customerId,
1363
1460
  * status: 'completed',
1364
1461
  * });
1365
1462
  *
1366
- * // Wallet-scoped filters (require transaction_type: 'wallet')
1463
+ * // This customer's AUTO-ACCOUNT transactions — a different family,
1464
+ * // and a different row shape
1465
+ * for await (const tx of client.transactions.list({
1466
+ * transaction_type: 'auto_account',
1467
+ * customer_id: customerId,
1468
+ * })) {
1469
+ * console.log(tx.id);
1470
+ * }
1471
+ *
1472
+ * // Wallet transactions
1367
1473
  * const sent = client.transactions.list({
1368
1474
  * transaction_type: 'wallet',
1369
1475
  * wallet_id: walletId,
@@ -1372,7 +1478,13 @@ var TransactionsResource = class extends BaseResource {
1372
1478
  * ```
1373
1479
  */
1374
1480
  list(params) {
1375
- return this.paginate("/transactions", params);
1481
+ const requested = params?.transaction_type ?? "one_off";
1482
+ return this.paginate(
1483
+ "/transactions",
1484
+ { ...params, transaction_type: requested },
1485
+ void 0,
1486
+ (meta) => assertFamily(meta, requested)
1487
+ );
1376
1488
  }
1377
1489
  /**
1378
1490
  * Get a transaction by ID.
@@ -1416,12 +1528,36 @@ var TransactionsResource = class extends BaseResource {
1416
1528
  });
1417
1529
  }
1418
1530
  };
1531
+ function assertFamily(meta, requested) {
1532
+ const served = meta?.transaction_type;
1533
+ if (typeof served !== "string" || served === requested) return;
1534
+ throw new APIError(
1535
+ 200,
1536
+ "transaction_family_mismatch",
1537
+ `Asked for ${requested} transactions but the server listed ${served}. The rows in this page are not the shape this iterator yields, so they are not returned.`,
1538
+ { details: { requested, served } }
1539
+ );
1540
+ }
1419
1541
  var AutoTransactionsResource = class extends BaseResource {
1420
1542
  /**
1421
1543
  * List auto transactions.
1422
1544
  *
1423
- * @param params - Pagination parameters
1545
+ * `statuses` and `types` take a comma-separated string, not an array, and
1546
+ * `start_date` / `end_date` are Unix epoch SECONDS rather than the ISO
1547
+ * strings the other list endpoints take.
1548
+ *
1549
+ * @param params - Filter and pagination parameters
1424
1550
  * @returns Async iterator of auto transactions
1551
+ *
1552
+ * @example
1553
+ * ```typescript
1554
+ * const recent = client.autoTransactions.list({
1555
+ * auto_account_id: accountId,
1556
+ * statuses: 'pending,processing',
1557
+ * start_date: Math.floor(Date.now() / 1000) - 86_400,
1558
+ * sort_dir: 'desc',
1559
+ * });
1560
+ * ```
1425
1561
  */
1426
1562
  list(params) {
1427
1563
  return this.paginate("/auto-transactions", params);
@@ -1635,13 +1771,32 @@ var ApplicationsResource = class extends BaseResource {
1635
1771
  /**
1636
1772
  * Get an application by ID.
1637
1773
  *
1774
+ * `include` inlines extra sections — a comma-separated list of `entities`,
1775
+ * `validation`, `edd`, `attestations`, or `all`. Each adds weight, and
1776
+ * `'all'` carries the full KYB record including every associated
1777
+ * individual's date of birth, nationality and email, so ask for what the
1778
+ * page renders.
1779
+ *
1780
+ * To render an accept-agreements page, use {@link getLegalAcceptance}
1781
+ * instead: it returns exactly that page's inputs and none of the personal
1782
+ * data.
1783
+ *
1638
1784
  * @param applicationId - Application ID
1785
+ * @param params - Optional `{ include }`
1639
1786
  * @returns Application record
1787
+ *
1788
+ * @example
1789
+ * ```typescript
1790
+ * const app = await client.applications.get(applicationId, {
1791
+ * include: 'entities,validation',
1792
+ * });
1793
+ * ```
1640
1794
  */
1641
- async get(applicationId) {
1795
+ async get(applicationId, params) {
1642
1796
  return this.transport.request({
1643
1797
  method: "GET",
1644
- path: `/applications/${applicationId}`
1798
+ path: `/applications/${applicationId}`,
1799
+ query: { ...params }
1645
1800
  });
1646
1801
  }
1647
1802
  /**
@@ -1756,6 +1911,48 @@ var ApplicationsResource = class extends BaseResource {
1756
1911
  // ==========================================================================
1757
1912
  // Attestations
1758
1913
  // ==========================================================================
1914
+ /**
1915
+ * What this application still needs to accept, and who may accept it.
1916
+ *
1917
+ * Exactly what an accept-agreements page renders, and deliberately nothing
1918
+ * more. `get(applicationId)` would answer with the full KYB record — the
1919
+ * business entity, and every associated individual's date of birth,
1920
+ * nationality and email — none of which that page displays. The link that
1921
+ * reaches this endpoint is EMAILED and travels in a URL query string, so its
1922
+ * credential is scoped to this call and the attestation submission, and
1923
+ * cannot read the application.
1924
+ *
1925
+ * Authenticates with an Application Token (`X-Application-Token`), including
1926
+ * the narrow legal-acceptance token a terms refusal issues.
1927
+ *
1928
+ * The documents come back as identity only. Fetch the text to display with
1929
+ * `client.legal.get(key)`, then pass the `version` you displayed back as
1930
+ * `legal_document_version` on {@link submitAttestation}.
1931
+ *
1932
+ * @param applicationId - Application ID
1933
+ * @returns Outstanding agreements, prior acceptances, and permitted attestors
1934
+ *
1935
+ * @example
1936
+ * ```typescript
1937
+ * const ctx = await client.applications.getLegalAcceptance(applicationId);
1938
+ *
1939
+ * for (const doc of ctx.outstanding_documents) {
1940
+ * const text = await client.legal.get(doc.key, doc.version);
1941
+ * render(text.content);
1942
+ * }
1943
+ *
1944
+ * // A business may have several control persons; an individual application
1945
+ * // has exactly one permissible attestor, so there is nobody to pick.
1946
+ * const attestor =
1947
+ * ctx.application_type === 'individual' ? ctx.attestors[0] : await pick(ctx.attestors);
1948
+ * ```
1949
+ */
1950
+ async getLegalAcceptance(applicationId) {
1951
+ return this.transport.request({
1952
+ method: "GET",
1953
+ path: `/applications/${applicationId}/legal-acceptance`
1954
+ });
1955
+ }
1759
1956
  /**
1760
1957
  * Submit an attestation for an application.
1761
1958
  *
@@ -2609,6 +2806,133 @@ var InfoResource = class extends BaseResource {
2609
2806
  }
2610
2807
  };
2611
2808
 
2809
+ // src/client/resources/legal.ts
2810
+ var LegalResource = class extends BaseResource {
2811
+ /**
2812
+ * List the revision of every legal document currently in force.
2813
+ *
2814
+ * An INDEX, not a bundle: each entry names a document and its in-force
2815
+ * revision, without the text. Fetch {@link get} for the one document you
2816
+ * are about to display — inlining every document would put the whole corpus
2817
+ * on every call.
2818
+ *
2819
+ * Not safe to cache indefinitely: it names whichever revision is in force
2820
+ * NOW, and that changes when a new one is published. A specific
2821
+ * `(key, version)` from {@link get} is a different matter — revisions are
2822
+ * immutable, so that text can be cached for as long as you like.
2823
+ *
2824
+ * @returns The in-force revision of each document, without its text
2825
+ *
2826
+ * @example
2827
+ * ```typescript
2828
+ * for (const doc of await client.legal.list()) {
2829
+ * console.log(doc.key, doc.version, doc.title);
2830
+ * }
2831
+ * ```
2832
+ */
2833
+ async list() {
2834
+ const response = await this.transport.request({
2835
+ method: "GET",
2836
+ path: "/legal/documents"
2837
+ });
2838
+ return response.data ?? [];
2839
+ }
2840
+ /**
2841
+ * Get one legal document — the revision in force, or a specific one.
2842
+ *
2843
+ * Pass the `version` you displayed back as `legal_document_version` when
2844
+ * submitting an attestation, so the acceptance record names the exact text
2845
+ * the customer saw rather than whichever revision happened to be current
2846
+ * when the request arrived.
2847
+ *
2848
+ * @param documentKey - Document identifier, e.g. `'dakota_tos'`
2849
+ * @param version - A specific published revision. Omit for the one in force
2850
+ * @returns The requested revision, including its text
2851
+ *
2852
+ * @example
2853
+ * ```typescript
2854
+ * const tos = await client.legal.get('dakota_tos');
2855
+ * render(tos.content);
2856
+ *
2857
+ * await client.applications.submitAttestation(applicationId, {
2858
+ * attestation_type: 'terms_of_service',
2859
+ * legal_document_version: tos.version, // records what they actually saw
2860
+ * // ...
2861
+ * });
2862
+ * ```
2863
+ */
2864
+ async get(documentKey, version) {
2865
+ return this.transport.request({
2866
+ method: "GET",
2867
+ path: `/legal/documents/${documentKey}`,
2868
+ query: version !== void 0 ? { version } : void 0
2869
+ });
2870
+ }
2871
+ };
2872
+
2873
+ // src/client/resources/rd-marketing-fee.ts
2874
+ var RDMarketingFeeResource = class extends BaseResource {
2875
+ /**
2876
+ * The months this client has a statement for, newest first.
2877
+ *
2878
+ * Runs from the start of their contract to the running month, and the
2879
+ * RUNNING month IS included. It cannot be priced yet — the bank's interest
2880
+ * posts in the month after it is earned — but the balance is real and
2881
+ * accruing, and a client checking mid-month has to be able to see it. Its
2882
+ * fee figures come back absent rather than zero.
2883
+ *
2884
+ * An EMPTY list means the contract is real but no month has started yet.
2885
+ * That is different from a 404, which means no contract at all.
2886
+ *
2887
+ * @returns Statement months as `YYYY-MM-DD` (first day of the month, UTC)
2888
+ *
2889
+ * @example
2890
+ * ```typescript
2891
+ * const months = await client.rdMarketingFee.listMonths();
2892
+ * if (months.length === 0) {
2893
+ * // Contract starts next month or later — "starting soon", not an error.
2894
+ * }
2895
+ * ```
2896
+ */
2897
+ async listMonths() {
2898
+ const response = await this.transport.request({
2899
+ method: "GET",
2900
+ path: "/rd-marketing-fee/statements"
2901
+ });
2902
+ return response.months ?? [];
2903
+ }
2904
+ /**
2905
+ * One month's statement — one row per calendar day: the date, the RD
2906
+ * balance, and that day's fee.
2907
+ *
2908
+ * The rows are the STORED daily principals, read rather than recomputed, so
2909
+ * what the client reads and what Dakota priced cannot drift.
2910
+ *
2911
+ * Absent is not zero. A balance is absent when the day has not been derived
2912
+ * yet and `'0'` when the client genuinely held no RD; fees are absent for
2913
+ * every day of a month whose rate has not been derived. Neither unknown is
2914
+ * reported as a zero, so render an absent figure as unknown rather than
2915
+ * defaulting it.
2916
+ *
2917
+ * @param month - First day of the month, UTC, as `YYYY-MM-DD`
2918
+ * @returns The month's statement, one row per day
2919
+ *
2920
+ * @example
2921
+ * ```typescript
2922
+ * const statement = await client.rdMarketingFee.getStatement('2026-08-01');
2923
+ * for (const day of statement.daily) {
2924
+ * console.log(day.date, day.balance_minor ?? 'not yet derived');
2925
+ * }
2926
+ * ```
2927
+ */
2928
+ async getStatement(month) {
2929
+ return this.transport.request({
2930
+ method: "GET",
2931
+ path: `/rd-marketing-fee/statements/${month}`
2932
+ });
2933
+ }
2934
+ };
2935
+
2612
2936
  // src/client/resources/sandbox.ts
2613
2937
  var SandboxResource = class extends BaseResource {
2614
2938
  /**
@@ -2868,11 +3192,23 @@ var SelfServeResource = class extends BaseResource {
2868
3192
  * type: 'purchase',
2869
3193
  * limit: 50,
2870
3194
  * });
3195
+ *
3196
+ * // Paging: carry BOTH halves of the cursor. Entries written in one
3197
+ * // transaction share a created_at, so a page boundary inside such a
3198
+ * // group drops rows when only `cursor` is sent.
3199
+ * const last = purchases.entries[purchases.entries.length - 1];
3200
+ * const next = await client.selfServe.listLedger({
3201
+ * type: 'purchase',
3202
+ * limit: 50,
3203
+ * cursor: last.created_at,
3204
+ * cursor_id: last.id,
3205
+ * });
2871
3206
  * ```
2872
3207
  */
2873
3208
  async listLedger(params) {
2874
3209
  const query = {};
2875
3210
  if (params?.cursor !== void 0) query.cursor = params.cursor;
3211
+ if (params?.cursor_id !== void 0) query.cursor_id = params.cursor_id;
2876
3212
  if (params?.limit !== void 0) query.limit = params.limit;
2877
3213
  if (params?.type !== void 0) query.type = params.type;
2878
3214
  return this.transport.request({
@@ -3070,10 +3406,10 @@ var PaymentAgentsResource = class extends BaseResource {
3070
3406
  * alternatives. Branch on `blocker.code`, not on `reply`, and ignore codes
3071
3407
  * you do not recognize.
3072
3408
  *
3073
- * `data.client_policy` is a DEVELOPMENT override of the vocabulary the
3074
- * agent drafts under; prefer registering it once with
3075
- * `client.agenticPolicy.set()`, since forgetting to send it here fails
3076
- * silently.
3409
+ * The vocabulary the agent drafts under is the one registered with
3410
+ * `client.agenticPolicy.set()`. It is not a property of this request —
3411
+ * a policy sent here is ignored, which is why the option to send one is
3412
+ * gone.
3077
3413
  *
3078
3414
  * @param paymentAgentId - Payment agent ID
3079
3415
  * @param data - Prompt and/or messages
@@ -3131,7 +3467,7 @@ var InstructionsResource = class extends BaseResource {
3131
3467
  /**
3132
3468
  * Accept proposals — actuate them into persisted instructions.
3133
3469
  *
3134
- * Two optional fields shape the actuation:
3470
+ * One optional field shapes the actuation:
3135
3471
  *
3136
3472
  * - `developer_fee` declares your fee PER PAYOUT TYPE — `swap_bps` for a
3137
3473
  * crypto payout, `offramp_bps` for a bank payout. They are independent,
@@ -3141,8 +3477,10 @@ var InstructionsResource = class extends BaseResource {
3141
3477
  * amount, and the agent is told nothing about a fee it could mention.
3142
3478
  * Both are DEFAULTS for the auto-accounts this request creates — an
3143
3479
  * action-level `fee_bps` still wins outright.
3144
- * - `client_policy` is the same development override the proposals call
3145
- * takes. Prefer registering it once with `client.agenticPolicy.set()`.
3480
+ *
3481
+ * The vocabulary the actuation is judged against comes from the policy
3482
+ * registered with `client.agenticPolicy.set()` — the same one the drafting
3483
+ * turn used, which is the point of registering it rather than sending it.
3146
3484
  *
3147
3485
  * @param data - The payment agent id and the proposals to accept
3148
3486
  * @returns instruction_ids + the mandates the batch drafted (in full
@@ -3431,34 +3769,6 @@ var InsightsResource = class extends BaseResource {
3431
3769
  path: `/customers/${customerId}/insights`
3432
3770
  });
3433
3771
  }
3434
- /**
3435
- * Ask about the customer's account.
3436
- *
3437
- * A read-only, advisory conversation. Stateless: send the conversation so
3438
- * far in `messages` on each call; the response is the assistant's next
3439
- * plain-text `reply`. The assistant narrates the same deterministic report
3440
- * {@link get} returns — it never originates a number, never proposes, and
3441
- * never moves money. Rate-limited per customer (hourly burst + daily
3442
- * window) — a 429 means back off and retry later.
3443
- *
3444
- * Model-backed, so it defaults to {@link AGENTIC_MODEL_TIMEOUT_MS} rather
3445
- * than the client's ordinary deadline. Pass `{ timeout }` to change it for
3446
- * one call; an explicit client-wide `timeout` still wins.
3447
- *
3448
- * @param customerId - Customer ID
3449
- * @param data - The conversation so far (1–40 messages)
3450
- * @returns The assistant's reply (+ how the boundary screen treated the turn)
3451
- */
3452
- async chat(customerId, data, options) {
3453
- return this.transport.request({
3454
- method: "POST",
3455
- path: `/customers/${customerId}/insights/chat`,
3456
- body: data,
3457
- idempotencyKey: options?.idempotencyKey,
3458
- timeout: options?.timeout,
3459
- endpointTimeout: AGENTIC_MODEL_TIMEOUT_MS
3460
- });
3461
- }
3462
3772
  };
3463
3773
 
3464
3774
  // src/client/resources/agentic-policy.ts
@@ -3493,11 +3803,13 @@ var AgenticPolicyResource = class extends BaseResource {
3493
3803
  /**
3494
3804
  * Register — or fully replace — this client's agentic policy.
3495
3805
  *
3496
- * Declaring the vocabulary once removes a silent failure mode. Sending
3497
- * `client_policy` in each proposals request still works and still wins, but
3498
- * FORGETTING to send it fails silently: the agent just narrates in the
3499
- * platform's nouns again ("destination", "mandate") and nothing errors
3500
- * anywhere. A registration makes that impossible.
3806
+ * Registration is the ONLY way to set a policy. A policy is a property of
3807
+ * the CLIENT, not of a request: carried per request, a drafting turn and
3808
+ * the accept that followed it could be judged by different rules. The
3809
+ * platform accordingly stopped reading `client_policy` from request bodies,
3810
+ * and one sent there is now ignored — silently, since the agent simply
3811
+ * narrates in the platform's nouns again ("destination", "mandate") with no
3812
+ * error anywhere. Registering once removes that failure mode.
3501
3813
  *
3502
3814
  * FULL REPLACE, not a merge — the registration IS your declared vocabulary,
3503
3815
  * so an omitted field means you no longer want it, and an empty body (`{}`)
@@ -3536,19 +3848,20 @@ var AgenticPolicyResource = class extends BaseResource {
3536
3848
  };
3537
3849
 
3538
3850
  // src/agentic/chat.ts
3851
+ var REJECTED_INPUT = "rejected_input";
3539
3852
  var AgentConversation = class {
3540
3853
  client;
3541
3854
  paymentAgentId;
3542
3855
  timezone;
3543
3856
  timeout;
3544
- clientPolicy;
3857
+ developerFee;
3545
3858
  history = [];
3546
3859
  constructor(client, paymentAgentId, history, options) {
3547
3860
  this.client = client;
3548
3861
  this.paymentAgentId = paymentAgentId;
3549
3862
  this.timezone = options?.timezone;
3550
3863
  this.timeout = options?.timeout;
3551
- this.clientPolicy = options?.clientPolicy;
3864
+ this.developerFee = options?.developerFee;
3552
3865
  if (history && history.length > 0) {
3553
3866
  this.history = history.map(cloneMessage);
3554
3867
  }
@@ -3593,12 +3906,10 @@ var AgentConversation = class {
3593
3906
  this.paymentAgentId,
3594
3907
  {
3595
3908
  messages,
3596
- // Resent on EVERY turn — the endpoint is stateless, so a zone given
3597
- // once would be forgotten on the next one. Same for the policy
3598
- // override: an omitted one silently falls back to the client's
3599
- // registration (or platform defaults).
3909
+ // Resent on EVERY turn — the endpoint is stateless, so a value
3910
+ // given once would be forgotten on the next one.
3600
3911
  ...this.timezone ? { timezone: this.timezone } : {},
3601
- ...this.clientPolicy ? { client_policy: this.clientPolicy } : {}
3912
+ ...this.developerFee ? { developer_fee: this.developerFee } : {}
3602
3913
  },
3603
3914
  this.timeout !== void 0 ? { timeout: this.timeout } : void 0
3604
3915
  );
@@ -3614,6 +3925,10 @@ var AgentConversation = class {
3614
3925
  hasBlockers: !!result.blockers && result.blockers.length > 0,
3615
3926
  conversationStatus: result.conversation_status ?? ""
3616
3927
  };
3928
+ if (turn.conversationStatus === REJECTED_INPUT) {
3929
+ this.history.pop();
3930
+ return turn;
3931
+ }
3617
3932
  let assistant = turn.reply;
3618
3933
  if (!assistant) {
3619
3934
  assistant = turn.hasProposals ? "(drafted proposals for your review)" : "(no reply)";
@@ -3739,6 +4054,10 @@ var DakotaClient = class {
3739
4054
  webhooks;
3740
4055
  /** Info API - query platform capabilities */
3741
4056
  info;
4057
+ /** Legal API - the published terms customers accept (unauthenticated) */
4058
+ legal;
4059
+ /** RD Marketing Fee API - this client's reserve-management statements */
4060
+ rdMarketingFee;
3742
4061
  /** Sandbox API - testing simulations (sandbox only) */
3743
4062
  sandbox;
3744
4063
  /** Self-Serve Credits API - manage prepaid transfer credits */
@@ -3808,6 +4127,8 @@ var DakotaClient = class {
3808
4127
  this.users = new UsersResource(this.transport);
3809
4128
  this.webhooks = new WebhooksResource(this.transport);
3810
4129
  this.info = new InfoResource(this.transport);
4130
+ this.legal = new LegalResource(this.transport);
4131
+ this.rdMarketingFee = new RDMarketingFeeResource(this.transport);
3811
4132
  this.sandbox = new SandboxResource(this.transport);
3812
4133
  this.selfServe = new SelfServeResource(this.transport);
3813
4134
  this.feePayoutDestination = new FeePayoutDestinationResource(this.transport);