@managoat/fountain-sdk 1.31.1 → 2.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/CHANGELOG.md +21 -0
- package/README.md +15 -2
- 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 +6 -6
- 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/dist/turn.d.ts +2 -5
- package/dist/turn.js +7 -11
- package/dist/turn.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,27 @@ server releases.
|
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
+
## [2.0.0] - 2026-09-13
|
|
15
|
+
|
|
16
|
+
### Breaking changes
|
|
17
|
+
|
|
18
|
+
Replace `SubscriptionRequiredError` imports and `instanceof` checks with
|
|
19
|
+
`InsufficientCreditsError`. The old export is removed. Read `error.upgradeUrl`
|
|
20
|
+
to offer the credit-purchase page; do not retry a 402 without adding credit.
|
|
21
|
+
|
|
22
|
+
For billing error handling, use Fountain v0.13.0 or newer.
|
|
23
|
+
[v0.13.0](https://github.com/managoat/fountain/releases/tag/v0.13.0) is the first
|
|
24
|
+
release containing the credit-only server contract (`c3349343`).
|
|
25
|
+
`insufficient_credits` and a generic HTTP 402 identify the credit gate.
|
|
26
|
+
`subscription_required` has no special mapping; it follows the HTTP status.
|
|
27
|
+
The response still exposes its original code and purchase URL.
|
|
28
|
+
|
|
29
|
+
## [1.32.0] - 2026-09-13
|
|
30
|
+
|
|
31
|
+
### Removed
|
|
32
|
+
|
|
33
|
+
- Legacy stdout row paragraph separators when assembling run text. Text now joins as ACP chunks on every stream, with paragraph breaks after tool calls preserved. Historical stdout rows no longer receive automatic blank lines.
|
|
34
|
+
|
|
14
35
|
## [1.31.1] - 2026-09-13
|
|
15
36
|
|
|
16
37
|
### Fixed
|
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ CONV=$(curl -sH "$AUTH" -H 'Content-Type: application/json' \
|
|
|
73
73
|
# - page /events?blocks=true&after=N until has_more is false
|
|
74
74
|
# - keep only events whose turn_id is *your* turn's
|
|
75
75
|
# - keep only `text` blocks; `tool_use` is not the answer, `thinking` is not either
|
|
76
|
-
# - join
|
|
76
|
+
# - join ACP chunks without an added separator,
|
|
77
77
|
# and start a new paragraph after any tool call
|
|
78
78
|
# - stop on stage/turn/done — or failed, or interrupted
|
|
79
79
|
# - and when the connection drops mid-turn, resume from the last event id
|
|
@@ -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,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AAO,IAAI,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC1C,KAAK,wBAAwB;YAC3B,OAAO,IAAI,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC/C,KAAK,sBAAsB;YACzB,OAAO,IAAI,wBAAwB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACrD,KAAK,YAAY;YACf,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,GAAG;YACN,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACtC,KAAK,GAAG;YACN,OAAO,IAAI,wBAAwB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACrD,KAAK,GAAG;YACN,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC1C,KAAK,GAAG;YACN,OAAO,IAAI,eAAe,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC5C,KAAK,GAAG;YACN,OAAO,IAAI,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC3C;YACE,OAAO,IAAI,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,IAAa,EAAE,GAAW;IAC5C,MAAM,KAAK,GAAI,IAAuC,EAAE,CAAC,GAAG,CAAC,CAAC;IAC9D,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CAAC"}
|
|
@@ -1093,7 +1093,7 @@ export interface paths {
|
|
|
1093
1093
|
};
|
|
1094
1094
|
/**
|
|
1095
1095
|
* List connections
|
|
1096
|
-
* @description Every provider account the tenant has connected, active or revoked. Only
|
|
1096
|
+
* @description Every provider account the tenant has connected, active or revoked. Only on a deployment that runs the egress broker (ADR 0019); 404 otherwise.
|
|
1097
1097
|
*/
|
|
1098
1098
|
get: operations["FountainWeb.ConnectionController.index"];
|
|
1099
1099
|
put?: never;
|
|
@@ -1157,7 +1157,7 @@ export interface paths {
|
|
|
1157
1157
|
put?: never;
|
|
1158
1158
|
/**
|
|
1159
1159
|
* Start a conversation
|
|
1160
|
-
* @description Creates a sandbox + conversation pair, starts the runtime in a fresh sprite, and (if `prompt` is supplied) sends it as turn 1. With `channel_id`, resumes the latest live conversation already bound to that channel for the same agent and vault (200, `meta.resumed: true`) instead of opening a new one (201). `labels` (#1637) are stamped on the new conversation; with `channel_id`, a resume merges them into the conversation it hands back, and a sandbox callback token resuming a conversation it was not minted for is refused with 403. Pass `X-Fountain-Parent-Conversation-Id` header to record which conversation spawned this one.
|
|
1160
|
+
* @description Creates a sandbox + conversation pair, starts the runtime in a fresh sprite, and (if `prompt` is supplied) sends it as turn 1. With `channel_id`, resumes the latest live conversation already bound to that channel for the same agent and vault (200, `meta.resumed: true`) instead of opening a new one (201). `labels` (#1637) are stamped on the new conversation; with `channel_id`, a resume merges them into the conversation it hands back, and a sandbox callback token resuming a conversation it was not minted for is refused with 403. Pass `X-Fountain-Parent-Conversation-Id` header to record which conversation spawned this one.
|
|
1161
1161
|
*/
|
|
1162
1162
|
post: operations["FountainWeb.ConversationController.create"];
|
|
1163
1163
|
delete?: never;
|
|
@@ -1905,7 +1905,7 @@ export interface paths {
|
|
|
1905
1905
|
};
|
|
1906
1906
|
/**
|
|
1907
1907
|
* List secret bindings
|
|
1908
|
-
* @description Every binding on the account: a secret name, the host it is attached to at the egress broker, and the auth shape. A secret with at least one enabled binding reaches the sandbox as a placeholder; one with none reaches it in the clear. Only
|
|
1908
|
+
* @description Every binding on the account: a secret name, the host it is attached to at the egress broker, and the auth shape. A secret with at least one enabled binding reaches the sandbox as a placeholder; one with none reaches it in the clear. Only on a deployment that runs the broker (ADR 0019); 404 otherwise.
|
|
1909
1909
|
*/
|
|
1910
1910
|
get: operations["FountainWeb.SecretBindingController.index"];
|
|
1911
1911
|
put?: never;
|
|
@@ -2069,7 +2069,7 @@ export interface paths {
|
|
|
2069
2069
|
};
|
|
2070
2070
|
/**
|
|
2071
2071
|
* Stream the whole team's events (SSE)
|
|
2072
|
-
* @description One `text/event-stream` carrying the log events of every teammate's conversation, each payload the shape of `GET /api/conversations/:id/stream` plus `conversation_id` and `agent_id`. A `team` event (data `{reason: changed}`) is sent when the roster changes — a teammate added or removed, or a fresh conversation opened for one, or a self-hosted runner connecting or dropping (presence changes for the teammates on it) — and the stream follows the new conversation on its own; the client re-lists. A `schedule` event (same data) is sent when a team schedule is created, updated, deleted or fired (#825); the client re-lists `/api/team/schedules`. `Last-Event-ID` (a log event id) replays what was missed on each teammate's conversation. `?blocks=true` adds server-parsed blocks
|
|
2072
|
+
* @description One `text/event-stream` carrying the log events of every teammate's conversation, each payload the shape of `GET /api/conversations/:id/stream` plus `conversation_id` and `agent_id`. A `team` event (data `{reason: changed}`) is sent when the roster changes — a teammate added or removed, or a fresh conversation opened for one, or a self-hosted runner connecting or dropping (presence changes for the teammates on it) — and the stream follows the new conversation on its own; the client re-lists. A `schedule` event (same data) is sent when a team schedule is created, updated, deleted or fired (#825); the client re-lists `/api/team/schedules`. `Last-Event-ID` (a log event id) replays what was missed on each teammate's conversation. `?blocks=true` adds server-parsed ACP blocks per event. Other streams produce no blocks. Heartbeats every 15s; closes after 60s idle so the client reconnects.
|
|
2073
2073
|
*/
|
|
2074
2074
|
get: operations["FountainWeb.TeamController.stream"];
|
|
2075
2075
|
put?: never;
|
|
@@ -3507,7 +3507,7 @@ export interface components {
|
|
|
3507
3507
|
};
|
|
3508
3508
|
/**
|
|
3509
3509
|
* Connection
|
|
3510
|
-
* @description A provider account the tenant signed in to once, whose credential Fountain holds (#1178). Agents get the capability, never the token: an agent's `mcp_servers` names the connection (`{"gmail": {"connection": "<id>"}}`) and Fountain serves the Gmail tools; and the access token is brokered under `env_key` for an MCP server the tenant runs. Only
|
|
3510
|
+
* @description A provider account the tenant signed in to once, whose credential Fountain holds (#1178). Agents get the capability, never the token: an agent's `mcp_servers` names the connection (`{"gmail": {"connection": "<id>"}}`) and Fountain serves the Gmail tools; and the access token is brokered under `env_key` for an MCP server the tenant runs. Only on a deployment that runs the egress broker.
|
|
3511
3511
|
*/
|
|
3512
3512
|
Connection: {
|
|
3513
3513
|
/** @description The connected account: an address, or the label the provider gave. */
|
|
@@ -14944,7 +14944,7 @@ export interface operations {
|
|
|
14944
14944
|
query?: {
|
|
14945
14945
|
/** @description Comma-separated stream allow-list (`stdout,stderr,acp,stage,...`). */
|
|
14946
14946
|
streams?: string;
|
|
14947
|
-
/** @description Add `blocks` to each event payload — its `data` parsed server-side into the structured blocks a transcript renders, as on `/api/conversations/:id/stream?blocks=true`.
|
|
14947
|
+
/** @description Add `blocks` to each event payload — its `data` parsed server-side into the structured blocks a transcript renders, as on `/api/conversations/:id/stream?blocks=true`. Only ACP output events produce blocks. Defaults to false. */
|
|
14948
14948
|
blocks?: boolean;
|
|
14949
14949
|
};
|
|
14950
14950
|
header?: {
|
package/dist/http.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface RequestOptions {
|
|
|
15
15
|
* this string is already what Fountain's request logs are keyed on. The
|
|
16
16
|
* version half is asserted against `package.json` by a test.
|
|
17
17
|
*/
|
|
18
|
-
export declare const USER_AGENT = "fountain-sdk-js/
|
|
18
|
+
export declare const USER_AGENT = "fountain-sdk-js/2.0.0";
|
|
19
19
|
export declare class HttpClient {
|
|
20
20
|
readonly config: ResolvedConfig;
|
|
21
21
|
private readonly fetchImpl;
|
package/dist/http.js
CHANGED
|
@@ -5,7 +5,7 @@ import { AuthError, ConnectionError, FountainError, errorForStatus } from "./err
|
|
|
5
5
|
* this string is already what Fountain's request logs are keyed on. The
|
|
6
6
|
* version half is asserted against `package.json` by a test.
|
|
7
7
|
*/
|
|
8
|
-
export const USER_AGENT = "fountain-sdk-js/
|
|
8
|
+
export const USER_AGENT = "fountain-sdk-js/2.0.0";
|
|
9
9
|
/**
|
|
10
10
|
* The thin layer everything else is built on: one bearer token, JSON in and
|
|
11
11
|
* out, and errors that say which call failed. `Fountain#api` exposes it
|
package/dist/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAexF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAexF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAElD;;;;GAIG;AACH,sGAAsG;AACtG,SAAS,SAAS;IAChB,OAAO,OAAQ,UAAqC,CAAC,QAAQ,KAAK,WAAW,CAAC;AAChF,CAAC;AAED,MAAM,OAAO,UAAU;IACZ,MAAM,CAAiB;IACf,SAAS,CAAY;IACrB,gBAAgB,CAAS;IAE1C,YAAY,MAAsB,EAAE,OAAkD,EAAE;QACtF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;QAChF,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC;IACnD,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IAC7B,CAAC;IAED,GAAG,CAAC,IAAY,EAAE,KAA+B;QAC/C,MAAM,GAAG,GAAG,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AAS,QAAQ,CAAC,IAAY;IAC5B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,KAAK,CAAC,OAAO,CAAC;IACjD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW,CAAC,MAA+B,EAAE,SAAiB;IACrE,IAAI,CAAC,SAAS,IAAI,SAAS,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC;IAChD,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC/C,OAAO,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AAC/D,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { Team, TeamSchedules, type MessageOptions } from "./team.ts";
|
|
|
7
7
|
export { resolveConfig, conversationUrl, DEFAULT_BASE_URL, DEFAULT_APP_URL, type ConfigOptions, type ResolvedConfig, } from "./config.ts";
|
|
8
8
|
export { streamEvents, streamPath, parseSse, type StreamOptions, type SseMessage } from "./sse.ts";
|
|
9
9
|
export { TurnFollower } from "./turn.ts";
|
|
10
|
-
export { FountainError, AuthError,
|
|
10
|
+
export { FountainError, AuthError, InsufficientCreditsError, NotFoundError, ValidationError, RateLimitError, ConversationBusyError, NotReadyError, QuotaExceededError, ConnectionError, TimeoutError, ResolutionError, type FountainErrorCode, } from "./errors.ts";
|
|
11
11
|
export type * from "./schemas.ts";
|
|
12
12
|
export type { Agent, AgentInput, Block, ConversationRecord, ConversationStatus, Environment, EnvironmentInput, LogEvent, NamedResource, PermissionOption, PermissionRequest, Stream, TeamEvent, Repository, Runtime, RunEvent, RunResult, SandboxChange, SandboxDiff, SandboxEntry, SandboxFile, SandboxListing, SandboxProvider, SandboxRecord, SandboxStatus, Secret, SkillInput, Turn, TurnState, Vault, VaultInput, VaultSecretMetadataPatch, } from "./types.ts";
|
|
13
13
|
import { Fountain } from "./client.ts";
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ export { Team, TeamSchedules } from "./team.js";
|
|
|
7
7
|
export { resolveConfig, conversationUrl, DEFAULT_BASE_URL, DEFAULT_APP_URL, } from "./config.js";
|
|
8
8
|
export { streamEvents, streamPath, parseSse } from "./sse.js";
|
|
9
9
|
export { TurnFollower } from "./turn.js";
|
|
10
|
-
export { FountainError, AuthError,
|
|
10
|
+
export { FountainError, AuthError, InsufficientCreditsError, NotFoundError, ValidationError, RateLimitError, ConversationBusyError, NotReadyError, QuotaExceededError, ConnectionError, TimeoutError, ResolutionError, } from "./errors.js";
|
|
11
11
|
import { Fountain } from "./client.js";
|
|
12
12
|
export default Fountain;
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAwC,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,GAAG,EAAmB,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,YAAY,EAAyC,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,UAAU,EAAuC,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,IAAI,EAAE,aAAa,EAAuB,MAAM,WAAW,CAAC;AACrE,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,eAAe,GAGhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAuC,MAAM,UAAU,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,aAAa,EACb,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAwC,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,GAAG,EAAmB,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,YAAY,EAAyC,MAAM,mBAAmB,CAAC;AACxF,OAAO,EAAE,UAAU,EAAuC,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,IAAI,EAAE,aAAa,EAAuB,MAAM,WAAW,CAAC;AACrE,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,eAAe,GAGhB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAuC,MAAM,UAAU,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EACL,aAAa,EACb,SAAS,EACT,wBAAwB,EACxB,aAAa,EACb,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,eAAe,GAEhB,MAAM,aAAa,CAAC;AAqCrB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,eAAe,QAAQ,CAAC"}
|
package/dist/turn.d.ts
CHANGED
|
@@ -13,10 +13,7 @@ import type { LogEvent, RunEvent, TurnState } from "./types.ts";
|
|
|
13
13
|
* - text that follows a tool call is a new message, so it gets a paragraph
|
|
14
14
|
* break — the rule that stops a transcript reading as one run-on sentence.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* against real runtimes: ACP streams one message as chunks that join with
|
|
18
|
-
* nothing, while a legacy stdout row is a whole message and joins as a
|
|
19
|
-
* paragraph.
|
|
16
|
+
* ACP streams one message as chunks that join without an added separator.
|
|
20
17
|
*/
|
|
21
18
|
export declare class TurnFollower {
|
|
22
19
|
readonly turnNumber: number;
|
|
@@ -40,7 +37,7 @@ export declare class TurnFollower {
|
|
|
40
37
|
private applyBlock;
|
|
41
38
|
/**
|
|
42
39
|
* ACP chunks are pieces of one message and join with nothing; anything after
|
|
43
|
-
* a tool call is a new message.
|
|
40
|
+
* a tool call is a new message.
|
|
44
41
|
*/
|
|
45
42
|
private paragraphBreak;
|
|
46
43
|
}
|
package/dist/turn.js
CHANGED
|
@@ -13,10 +13,7 @@ const TERMINAL_TURN_STATES = new Set(["done", "failed", "interrupted"]);
|
|
|
13
13
|
* - text that follows a tool call is a new message, so it gets a paragraph
|
|
14
14
|
* break — the rule that stops a transcript reading as one run-on sentence.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* against real runtimes: ACP streams one message as chunks that join with
|
|
18
|
-
* nothing, while a legacy stdout row is a whole message and joins as a
|
|
19
|
-
* paragraph.
|
|
16
|
+
* ACP streams one message as chunks that join without an added separator.
|
|
20
17
|
*/
|
|
21
18
|
export class TurnFollower {
|
|
22
19
|
turnNumber;
|
|
@@ -87,20 +84,19 @@ export class TurnFollower {
|
|
|
87
84
|
// Output from before our turn opened is the tail of an older one.
|
|
88
85
|
if (!this.started && !this.turnId)
|
|
89
86
|
return [];
|
|
90
|
-
const acp = event.stream === "acp";
|
|
91
87
|
const out = [];
|
|
92
88
|
for (const block of event.blocks ?? []) {
|
|
93
89
|
out.push({ type: "block", block, event });
|
|
94
|
-
out.push(...this.applyBlock(block
|
|
90
|
+
out.push(...this.applyBlock(block));
|
|
95
91
|
}
|
|
96
92
|
return out;
|
|
97
93
|
}
|
|
98
|
-
applyBlock(block
|
|
94
|
+
applyBlock(block) {
|
|
99
95
|
const body = block.body ?? "";
|
|
100
96
|
if (block.kind === "text") {
|
|
101
97
|
if (!body)
|
|
102
98
|
return [];
|
|
103
|
-
const prefix = this.paragraphBreak(
|
|
99
|
+
const prefix = this.paragraphBreak();
|
|
104
100
|
if (prefix)
|
|
105
101
|
this.chunks.push(prefix);
|
|
106
102
|
this.chunks.push(body);
|
|
@@ -143,12 +139,12 @@ export class TurnFollower {
|
|
|
143
139
|
}
|
|
144
140
|
/**
|
|
145
141
|
* ACP chunks are pieces of one message and join with nothing; anything after
|
|
146
|
-
* a tool call is a new message.
|
|
142
|
+
* a tool call is a new message.
|
|
147
143
|
*/
|
|
148
|
-
paragraphBreak(
|
|
144
|
+
paragraphBreak() {
|
|
149
145
|
if (!this.chunks.length)
|
|
150
146
|
return "";
|
|
151
|
-
if (
|
|
147
|
+
if (!this.breakBeforeText)
|
|
152
148
|
return "";
|
|
153
149
|
const last = this.chunks[this.chunks.length - 1] ?? "";
|
|
154
150
|
return last.endsWith("\n") ? "" : "\n\n";
|
package/dist/turn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turn.js","sourceRoot":"","sources":["../src/turn.ts"],"names":[],"mappings":"AAEA,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;AAExE
|
|
1
|
+
{"version":3,"file":"turn.js","sourceRoot":"","sources":["../src/turn.ts"],"names":[],"mappings":"AAEA,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;AAExE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,YAAY;IACd,UAAU,CAAS;IAC5B,MAAM,GAAkB,IAAI,CAAC;IAC7B,OAAO,GAAG,KAAK,CAAC;IAChB,KAAK,GAAqB,IAAI,CAAC;IAC/B,QAAQ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