@conto_finance/sdk 0.8.1 → 0.8.2

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/README.md CHANGED
@@ -250,12 +250,16 @@ await admin.spending.createBudget({
250
250
  });
251
251
  ```
252
252
 
253
+ **Checkouts hold on a budget.** Checkout checkpoints, including `checkout.getLinkCard()`, and guarded
254
+ browser checkout (`runGuardedCheckout()`) hold spend against each budget that covers the agent. Reported
255
+ paid settles it, and closing unpaid gives it back. The agent runs the checkout, so Conto declines
256
+ approval at the limit, and a payment made without asking Conto is not counted.
257
+
253
258
  **A budget stops other payment paths.** While it exists, it stops x402, MPP, external wallet
254
- payments, agent-to-agent payments, payment grants, checkout relay, hosted Stripe Link, guarded browser
255
- checkout (`runGuardedCheckout()`), card overlays and checkout checkpoints, including
256
- `checkout.getLinkCard()`, for every agent it covers. A paused, expired or not yet started budget still
257
- stops them. Until its start date, while paused, and after its end date, a budget also refuses the
258
- managed wallet payments and connected card draws it covers, for those agents. A task's budget stops nothing on other paths. It applies only to a managed wallet payment or connected card draw that names the task, and it refuses that payment or draw while it is paused.
259
+ payments, agent-to-agent payments, payment grants, checkout relay, hosted Stripe Link and card overlays,
260
+ for every agent it covers. A paused or expired budget still stops them. While paused and after its end
261
+ date, a budget also refuses the managed wallet payments, connected card draws and checkouts it covers,
262
+ for those agents. A task's budget stops nothing on other paths. It applies only to a managed wallet payment or connected card draw that names the task, and it refuses that payment or draw while it is paused.
259
263
  `updateBudget()` can resume a paused budget or extend an
260
264
  expired one, and a start date cannot be changed. To end a budget, call `admin.spending.deleteBudget(id, { version })`. It fails with
261
265
  `reasonCode` `BUDGET_HAS_HOLDS` while a purchase holds spend against the budget. Try a budget first on one agent with a Tempo Testnet wallet.
@@ -294,7 +298,7 @@ expired one, and a start date cannot be changed. To end a budget, call `admin.sp
294
298
  purchases.
295
299
  - Most budget errors have `code` `POLICY_VIOLATION`, so read `reasonCode` on `ContoError` and
296
300
  `ContoAdminError`. Some also have `nextActions`, such as `SHARED_BUDGET_EXCEEDED` with
297
- `REQUEST_BUDGET_INCREASE`. `checkout.begin()`, `getLinkCard()` and `replaceLinkCard()` have `code` `CHECKPOINT_BUDGET_NOT_SUPPORTED` and `reasonCode` `EXECUTION_PATH_NOT_CONNECTED`. `payments.execute()` has `code`
301
+ `REQUEST_BUDGET_INCREASE`. A refused `checkout.begin()`, `getLinkCard()` or `replaceLinkCard()` closes the checkpoint, so use a new `idempotencyKey`. `payments.execute()` has `code`
298
302
  `SHARED_BUDGET_BLOCKED` and no `reasonCode`.
299
303
  - A `VALIDATION_ERROR` on a spending call usually lists the fields in `fieldErrors`. It does not when
300
304
  the call got a field it does not accept, such as `periodStart` or `currency` on `updateBudget()`. A
package/dist/index.d.mts CHANGED
@@ -1055,16 +1055,16 @@ declare class AdminSpendingClient {
1055
1055
  /**
1056
1056
  * Create a shared budget. Needs an organization API key with `policies:write`.
1057
1057
  *
1058
+ * Checkout checkpoints, including `checkout.getLinkCard()`, and guarded browser checkout
1059
+ * (`runGuardedCheckout()`) hold spend against each budget that covers the agent.
1060
+ *
1058
1061
  * While a budget exists, it stops x402, MPP, external wallet payments, agent-to-agent payments,
1059
- * payment grants, checkout relay, hosted Stripe Link, guarded browser checkout
1060
- * (`runGuardedCheckout()`), card overlays and checkout checkpoints, including
1061
- * `checkout.getLinkCard()`, for every agent it covers. A paused, expired or not yet started budget
1062
- * still stops them. Until its start date, while paused, and after its end date, it also refuses
1063
- * the managed wallet payments and connected card draws it covers, for those agents. A start date
1064
- * cannot be changed.
1065
- * `deleteBudget()` ends a budget. Fails with `reasonCode`
1066
- * `ENROLLMENT_RECONCILIATION_REQUIRED` while the organization or a participating agent has an
1067
- * open commitment.
1062
+ * payment grants, checkout relay, hosted Stripe Link and card overlays, for every agent it covers.
1063
+ * A paused or expired budget still stops them. While paused and after its end date, it also
1064
+ * refuses the managed wallet payments, connected card draws and checkouts it covers, for those
1065
+ * agents. A start date cannot be changed.
1066
+ * `deleteBudget()` ends a budget. Fails with `reasonCode` `BUDGET_HAS_HOLDS` while a purchase holds
1067
+ * spend against it.
1068
1068
  */
1069
1069
  createBudget(input: BudgetInput): Promise<{
1070
1070
  id: string;
package/dist/index.d.ts CHANGED
@@ -1055,16 +1055,16 @@ declare class AdminSpendingClient {
1055
1055
  /**
1056
1056
  * Create a shared budget. Needs an organization API key with `policies:write`.
1057
1057
  *
1058
+ * Checkout checkpoints, including `checkout.getLinkCard()`, and guarded browser checkout
1059
+ * (`runGuardedCheckout()`) hold spend against each budget that covers the agent.
1060
+ *
1058
1061
  * While a budget exists, it stops x402, MPP, external wallet payments, agent-to-agent payments,
1059
- * payment grants, checkout relay, hosted Stripe Link, guarded browser checkout
1060
- * (`runGuardedCheckout()`), card overlays and checkout checkpoints, including
1061
- * `checkout.getLinkCard()`, for every agent it covers. A paused, expired or not yet started budget
1062
- * still stops them. Until its start date, while paused, and after its end date, it also refuses
1063
- * the managed wallet payments and connected card draws it covers, for those agents. A start date
1064
- * cannot be changed.
1065
- * `deleteBudget()` ends a budget. Fails with `reasonCode`
1066
- * `ENROLLMENT_RECONCILIATION_REQUIRED` while the organization or a participating agent has an
1067
- * open commitment.
1062
+ * payment grants, checkout relay, hosted Stripe Link and card overlays, for every agent it covers.
1063
+ * A paused or expired budget still stops them. While paused and after its end date, it also
1064
+ * refuses the managed wallet payments, connected card draws and checkouts it covers, for those
1065
+ * agents. A start date cannot be changed.
1066
+ * `deleteBudget()` ends a budget. Fails with `reasonCode` `BUDGET_HAS_HOLDS` while a purchase holds
1067
+ * spend against it.
1068
1068
  */
1069
1069
  createBudget(input: BudgetInput): Promise<{
1070
1070
  id: string;
package/dist/index.js CHANGED
@@ -47,7 +47,7 @@ var require_package = __commonJS({
47
47
  "package.json"(exports2, module2) {
48
48
  module2.exports = {
49
49
  name: "@conto_finance/sdk",
50
- version: "0.8.1",
50
+ version: "0.8.2",
51
51
  description: "Conto SDK for AI agent payment authorization",
52
52
  main: "./dist/index.js",
53
53
  module: "./dist/index.mjs",
@@ -804,16 +804,16 @@ var AdminSpendingClient = class {
804
804
  /**
805
805
  * Create a shared budget. Needs an organization API key with `policies:write`.
806
806
  *
807
+ * Checkout checkpoints, including `checkout.getLinkCard()`, and guarded browser checkout
808
+ * (`runGuardedCheckout()`) hold spend against each budget that covers the agent.
809
+ *
807
810
  * While a budget exists, it stops x402, MPP, external wallet payments, agent-to-agent payments,
808
- * payment grants, checkout relay, hosted Stripe Link, guarded browser checkout
809
- * (`runGuardedCheckout()`), card overlays and checkout checkpoints, including
810
- * `checkout.getLinkCard()`, for every agent it covers. A paused, expired or not yet started budget
811
- * still stops them. Until its start date, while paused, and after its end date, it also refuses
812
- * the managed wallet payments and connected card draws it covers, for those agents. A start date
813
- * cannot be changed.
814
- * `deleteBudget()` ends a budget. Fails with `reasonCode`
815
- * `ENROLLMENT_RECONCILIATION_REQUIRED` while the organization or a participating agent has an
816
- * open commitment.
811
+ * payment grants, checkout relay, hosted Stripe Link and card overlays, for every agent it covers.
812
+ * A paused or expired budget still stops them. While paused and after its end date, it also
813
+ * refuses the managed wallet payments, connected card draws and checkouts it covers, for those
814
+ * agents. A start date cannot be changed.
815
+ * `deleteBudget()` ends a budget. Fails with `reasonCode` `BUDGET_HAS_HOLDS` while a purchase holds
816
+ * spend against it.
817
817
  */
818
818
  createBudget(input) {
819
819
  return this.client.request("POST", "/api/spending/budgets", {
@@ -1110,12 +1110,18 @@ function responseErrorMessage(_data, status) {
1110
1110
  }
1111
1111
  var SHARED_REASON_CODES = /* @__PURE__ */ new Set([
1112
1112
  "AGENT_NOT_AUTHORIZED",
1113
+ "AGENT_LIMIT_EXCEEDED",
1113
1114
  "AGENT_UNAVAILABLE",
1115
+ "BUDGET_CHANGE_NOT_ALLOWED",
1114
1116
  "BUDGET_CURRENCY_UNSUPPORTED",
1115
1117
  "BUDGET_EXPIRED",
1116
1118
  "BUDGET_HAS_HOLDS",
1119
+ "BUDGET_METHOD_NOT_ALLOWED",
1117
1120
  "BUDGET_PAUSED",
1121
+ "BUDGET_SOURCE_NOT_ATTACHED",
1118
1122
  "BUYER_LINK_REVOKED",
1123
+ "CATEGORY_NOT_AUTHORIZED",
1124
+ "CATEGORY_UNKNOWN",
1119
1125
  "DUPLICATE_PURCHASE",
1120
1126
  "ENROLLMENT_RECONCILIATION_REQUIRED",
1121
1127
  "EVIDENCE_CONFLICT",
@@ -1124,6 +1130,7 @@ var SHARED_REASON_CODES = /* @__PURE__ */ new Set([
1124
1130
  "EXECUTION_PATH_NOT_CONNECTED",
1125
1131
  "EXPORT_TOO_LARGE",
1126
1132
  "INVALID_AMOUNT",
1133
+ "INVALID_BUDGET",
1127
1134
  "INVALID_EXPIRY",
1128
1135
  "INVALID_FILE",
1129
1136
  "INVALID_PARTICIPANTS",
@@ -1132,6 +1139,7 @@ var SHARED_REASON_CODES = /* @__PURE__ */ new Set([
1132
1139
  "LEGACY_BUDGET_REQUEST",
1133
1140
  "LINKED_BUDGET_REQUIRED",
1134
1141
  "LINKED_TASK_UNSUPPORTED",
1142
+ "MEMBER_LIMIT_EXCEEDED",
1135
1143
  "MERCHANT_NOT_AUTHORIZED",
1136
1144
  "NOT_FOUND",
1137
1145
  "PURCHASE_ALREADY_SUBMITTED",
package/dist/index.mjs CHANGED
@@ -22,7 +22,7 @@ var require_package = __commonJS({
22
22
  "package.json"(exports, module) {
23
23
  module.exports = {
24
24
  name: "@conto_finance/sdk",
25
- version: "0.8.1",
25
+ version: "0.8.2",
26
26
  description: "Conto SDK for AI agent payment authorization",
27
27
  main: "./dist/index.js",
28
28
  module: "./dist/index.mjs",
@@ -712,16 +712,16 @@ var AdminSpendingClient = class {
712
712
  /**
713
713
  * Create a shared budget. Needs an organization API key with `policies:write`.
714
714
  *
715
+ * Checkout checkpoints, including `checkout.getLinkCard()`, and guarded browser checkout
716
+ * (`runGuardedCheckout()`) hold spend against each budget that covers the agent.
717
+ *
715
718
  * While a budget exists, it stops x402, MPP, external wallet payments, agent-to-agent payments,
716
- * payment grants, checkout relay, hosted Stripe Link, guarded browser checkout
717
- * (`runGuardedCheckout()`), card overlays and checkout checkpoints, including
718
- * `checkout.getLinkCard()`, for every agent it covers. A paused, expired or not yet started budget
719
- * still stops them. Until its start date, while paused, and after its end date, it also refuses
720
- * the managed wallet payments and connected card draws it covers, for those agents. A start date
721
- * cannot be changed.
722
- * `deleteBudget()` ends a budget. Fails with `reasonCode`
723
- * `ENROLLMENT_RECONCILIATION_REQUIRED` while the organization or a participating agent has an
724
- * open commitment.
719
+ * payment grants, checkout relay, hosted Stripe Link and card overlays, for every agent it covers.
720
+ * A paused or expired budget still stops them. While paused and after its end date, it also
721
+ * refuses the managed wallet payments, connected card draws and checkouts it covers, for those
722
+ * agents. A start date cannot be changed.
723
+ * `deleteBudget()` ends a budget. Fails with `reasonCode` `BUDGET_HAS_HOLDS` while a purchase holds
724
+ * spend against it.
725
725
  */
726
726
  createBudget(input) {
727
727
  return this.client.request("POST", "/api/spending/budgets", {
@@ -1018,12 +1018,18 @@ function responseErrorMessage(_data, status) {
1018
1018
  }
1019
1019
  var SHARED_REASON_CODES = /* @__PURE__ */ new Set([
1020
1020
  "AGENT_NOT_AUTHORIZED",
1021
+ "AGENT_LIMIT_EXCEEDED",
1021
1022
  "AGENT_UNAVAILABLE",
1023
+ "BUDGET_CHANGE_NOT_ALLOWED",
1022
1024
  "BUDGET_CURRENCY_UNSUPPORTED",
1023
1025
  "BUDGET_EXPIRED",
1024
1026
  "BUDGET_HAS_HOLDS",
1027
+ "BUDGET_METHOD_NOT_ALLOWED",
1025
1028
  "BUDGET_PAUSED",
1029
+ "BUDGET_SOURCE_NOT_ATTACHED",
1026
1030
  "BUYER_LINK_REVOKED",
1031
+ "CATEGORY_NOT_AUTHORIZED",
1032
+ "CATEGORY_UNKNOWN",
1027
1033
  "DUPLICATE_PURCHASE",
1028
1034
  "ENROLLMENT_RECONCILIATION_REQUIRED",
1029
1035
  "EVIDENCE_CONFLICT",
@@ -1032,6 +1038,7 @@ var SHARED_REASON_CODES = /* @__PURE__ */ new Set([
1032
1038
  "EXECUTION_PATH_NOT_CONNECTED",
1033
1039
  "EXPORT_TOO_LARGE",
1034
1040
  "INVALID_AMOUNT",
1041
+ "INVALID_BUDGET",
1035
1042
  "INVALID_EXPIRY",
1036
1043
  "INVALID_FILE",
1037
1044
  "INVALID_PARTICIPANTS",
@@ -1040,6 +1047,7 @@ var SHARED_REASON_CODES = /* @__PURE__ */ new Set([
1040
1047
  "LEGACY_BUDGET_REQUEST",
1041
1048
  "LINKED_BUDGET_REQUIRED",
1042
1049
  "LINKED_TASK_UNSUPPORTED",
1050
+ "MEMBER_LIMIT_EXCEEDED",
1043
1051
  "MERCHANT_NOT_AUTHORIZED",
1044
1052
  "NOT_FOUND",
1045
1053
  "PURCHASE_ALREADY_SUBMITTED",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conto_finance/sdk",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "Conto SDK for AI agent payment authorization",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",