@managoat/fountain-sdk 1.32.0 → 2.1.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/CHANGELOG.md +29 -0
- package/README.md +14 -1
- package/dist/errors.d.ts +3 -4
- package/dist/errors.js +4 -6
- package/dist/errors.js.map +1 -1
- package/dist/generated/openapi.d.ts +838 -65
- package/dist/http.d.ts +1 -1
- package/dist/http.js +1 -1
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,35 @@ server releases.
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
+
## [2.1.0] — 2026-09-13
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Wire types for inference credential sets (ADR 0053): the four operations
|
|
19
|
+
under `/api/account/inference-credential-sets`, the per-set credential write
|
|
20
|
+
and clear, `inference_credential_id` on the conversation-create request,
|
|
21
|
+
`inference_credential_id` and `allowed_inference_credential_ids` on the
|
|
22
|
+
agent, and the owner-authenticated principal credential write under
|
|
23
|
+
`/api/claimable-users/:id/inference-credentials/:provider`.
|
|
24
|
+
|
|
25
|
+
Generated types only. No hand-written client method changes, so nothing an
|
|
26
|
+
existing caller uses moves.
|
|
27
|
+
|
|
28
|
+
## [2.0.0] - 2026-09-13
|
|
29
|
+
|
|
30
|
+
### Breaking changes
|
|
31
|
+
|
|
32
|
+
Replace `SubscriptionRequiredError` imports and `instanceof` checks with
|
|
33
|
+
`InsufficientCreditsError`. The old export is removed. Read `error.upgradeUrl`
|
|
34
|
+
to offer the credit-purchase page; do not retry a 402 without adding credit.
|
|
35
|
+
|
|
36
|
+
For billing error handling, use Fountain v0.13.0 or newer.
|
|
37
|
+
[v0.13.0](https://github.com/managoat/fountain/releases/tag/v0.13.0) is the first
|
|
38
|
+
release containing the credit-only server contract (`c3349343`).
|
|
39
|
+
`insufficient_credits` and a generic HTTP 402 identify the credit gate.
|
|
40
|
+
`subscription_required` has no special mapping; it follows the HTTP status.
|
|
41
|
+
The response still exposes its original code and purchase URL.
|
|
42
|
+
|
|
14
43
|
## [1.32.0] - 2026-09-13
|
|
15
44
|
|
|
16
45
|
### Removed
|
package/README.md
CHANGED
|
@@ -296,7 +296,7 @@ Every error carries `status`, `code`, `body`, `retryAfter` and `retryable`.
|
|
|
296
296
|
| class | when |
|
|
297
297
|
|---|---|
|
|
298
298
|
| `AuthError` | 401, or no key configured at all |
|
|
299
|
-
| `
|
|
299
|
+
| `InsufficientCreditsError` | 402 — carries `upgradeUrl` |
|
|
300
300
|
| `NotFoundError` | 404 — wrong id, or it belongs to another account |
|
|
301
301
|
| `ValidationError` | 422 — read `fieldErrors` |
|
|
302
302
|
| `RateLimitError` | 429 |
|
|
@@ -443,3 +443,16 @@ published surface deliberately without releasing, label the PR
|
|
|
443
443
|
AGPL-3.0-or-later, and the clients — this SDK and the CLI — are Apache-2.0 on
|
|
444
444
|
purpose. Talking to the API, or shipping this SDK inside a proprietary
|
|
445
445
|
application, puts no licence obligation on your code.
|
|
446
|
+
|
|
447
|
+
## Credit error migration (2.0.0)
|
|
448
|
+
|
|
449
|
+
Replace `SubscriptionRequiredError` imports and `instanceof` checks with
|
|
450
|
+
`InsufficientCreditsError`. The old export is removed. Read `error.upgradeUrl`
|
|
451
|
+
to offer the credit-purchase page; do not retry a 402 without adding credit.
|
|
452
|
+
|
|
453
|
+
For billing error handling, use Fountain v0.13.0 or newer.
|
|
454
|
+
[v0.13.0](https://github.com/managoat/fountain/releases/tag/v0.13.0) is the first
|
|
455
|
+
release containing the credit-only server contract (`c3349343`).
|
|
456
|
+
`insufficient_credits` and a generic HTTP 402 identify the credit gate.
|
|
457
|
+
`subscription_required` has no special mapping; it follows the HTTP status.
|
|
458
|
+
The response still exposes its original code and purchase URL.
|
package/dist/errors.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* secondary one, and the conditions worth retrying say so themselves.
|
|
9
9
|
*/
|
|
10
10
|
/** The `error` strings the API sends. Open — a new one is a string, not a break. */
|
|
11
|
-
export type FountainErrorCode = "conversation_busy" | "provisioning" | "sprite_probe_failed" | "sandbox_quota_exceeded" | "sandbox_at_capacity" | "sandbox_not_found" | "sandbox_not_attachable" | "sandbox_identity_mismatch" | "sandbox_runtime_mismatch" | "insufficient_credits" | "fleet_full" | "
|
|
11
|
+
export type FountainErrorCode = "conversation_busy" | "provisioning" | "sprite_probe_failed" | "sandbox_quota_exceeded" | "sandbox_at_capacity" | "sandbox_not_found" | "sandbox_not_attachable" | "sandbox_identity_mismatch" | "sandbox_runtime_mismatch" | "insufficient_credits" | "fleet_full" | "rate_limited" | "account_suspended" | "environment_not_allowed" | "environment_not_found" | "vault_not_allowed" | "parent_conversation_not_found" | "not_found" | "unauthorized" | (string & {});
|
|
12
12
|
export interface FountainErrorInit {
|
|
13
13
|
status?: number;
|
|
14
14
|
code?: FountainErrorCode;
|
|
@@ -41,10 +41,9 @@ export declare class AuthError extends FountainError {
|
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* The account is out of credit (`insufficient_credits`, 402). `upgradeUrl` is
|
|
44
|
-
* the billing page, where credit is bought.
|
|
45
|
-
* callers written against the subscription era still catch it.
|
|
44
|
+
* the billing page, where credit is bought. A bare HTTP 402 uses this class too.
|
|
46
45
|
*/
|
|
47
|
-
export declare class
|
|
46
|
+
export declare class InsufficientCreditsError extends FountainError {
|
|
48
47
|
get upgradeUrl(): string | undefined;
|
|
49
48
|
}
|
|
50
49
|
/** Wrong id, or it belongs to another account — Fountain does not distinguish (404). */
|
package/dist/errors.js
CHANGED
|
@@ -64,10 +64,9 @@ export class AuthError extends FountainError {
|
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* The account is out of credit (`insufficient_credits`, 402). `upgradeUrl` is
|
|
67
|
-
* the billing page, where credit is bought.
|
|
68
|
-
* callers written against the subscription era still catch it.
|
|
67
|
+
* the billing page, where credit is bought. A bare HTTP 402 uses this class too.
|
|
69
68
|
*/
|
|
70
|
-
export class
|
|
69
|
+
export class InsufficientCreditsError extends FountainError {
|
|
71
70
|
get upgradeUrl() {
|
|
72
71
|
const url = this.body?.upgrade_url;
|
|
73
72
|
return typeof url === "string" ? url : undefined;
|
|
@@ -170,9 +169,8 @@ export function errorForStatus(status, body, method, url, headers) {
|
|
|
170
169
|
return new NotReadyError(message, init);
|
|
171
170
|
case "sandbox_quota_exceeded":
|
|
172
171
|
return new QuotaExceededError(message, init);
|
|
173
|
-
case "subscription_required":
|
|
174
172
|
case "insufficient_credits":
|
|
175
|
-
return new
|
|
173
|
+
return new InsufficientCreditsError(message, init);
|
|
176
174
|
case "fleet_full":
|
|
177
175
|
return new NotReadyError(message, init);
|
|
178
176
|
}
|
|
@@ -180,7 +178,7 @@ export function errorForStatus(status, body, method, url, headers) {
|
|
|
180
178
|
case 401:
|
|
181
179
|
return new AuthError(message, init);
|
|
182
180
|
case 402:
|
|
183
|
-
return new
|
|
181
|
+
return new InsufficientCreditsError(message, init);
|
|
184
182
|
case 404:
|
|
185
183
|
return new NotFoundError(message, init);
|
|
186
184
|
case 422:
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkCH,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,uDAAuD;IAC9C,MAAM,CAAS;IACxB,gDAAgD;IACvC,IAAI,CAAgC;IAC7C,uDAAuD;IAC9C,IAAI,CAAU;IACvB,6DAA6D;IACpD,UAAU,CAAgB;IAEnC,YAAY,OAAe,EAAE,OAA0B,EAAE;QACvD,KAAK,CAAC,OAA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