@providerkit/core 0.21.1 → 0.22.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.
Files changed (92) hide show
  1. package/README.md +7 -7
  2. package/dist/attribution.d.ts +2 -2
  3. package/dist/capability.d.ts +9 -9
  4. package/dist/capability.js +9 -9
  5. package/dist/capability.js.map +1 -1
  6. package/dist/context.d.ts +4 -4
  7. package/dist/context.js +4 -4
  8. package/dist/errors.d.ts +15 -15
  9. package/dist/errors.d.ts.map +1 -1
  10. package/dist/errors.js +14 -14
  11. package/dist/image.d.ts +1 -1
  12. package/dist/image.d.ts.map +1 -1
  13. package/dist/jev.d.ts +9 -9
  14. package/dist/jev.d.ts.map +1 -1
  15. package/dist/jev.js +1 -1
  16. package/dist/key-pool.d.ts +4 -4
  17. package/dist/key-pool.js +6 -6
  18. package/dist/key-pool.js.map +1 -1
  19. package/dist/presets.d.ts +26 -22
  20. package/dist/presets.d.ts.map +1 -1
  21. package/dist/presets.js +13 -12
  22. package/dist/presets.js.map +1 -1
  23. package/dist/providers/anthropic.d.ts +5 -5
  24. package/dist/providers/anthropic.d.ts.map +1 -1
  25. package/dist/providers/anthropic.js +9 -9
  26. package/dist/providers/factory.d.ts +2 -2
  27. package/dist/providers/factory.d.ts.map +1 -1
  28. package/dist/providers/factory.js +2 -1
  29. package/dist/providers/factory.js.map +1 -1
  30. package/dist/providers/gemini.d.ts +2 -2
  31. package/dist/providers/gemini.d.ts.map +1 -1
  32. package/dist/providers/gemini.js +15 -14
  33. package/dist/providers/gemini.js.map +1 -1
  34. package/dist/providers/openai.d.ts +12 -9
  35. package/dist/providers/openai.d.ts.map +1 -1
  36. package/dist/providers/openai.js +9 -7
  37. package/dist/providers/openai.js.map +1 -1
  38. package/dist/providers/responses.d.ts +3 -3
  39. package/dist/providers/responses.js +5 -5
  40. package/dist/providers/responses.js.map +1 -1
  41. package/dist/providers/zai.d.ts +2 -2
  42. package/dist/providers/zai.js +2 -2
  43. package/dist/rate-limit.d.ts +3 -3
  44. package/dist/rate-limit.js +3 -3
  45. package/dist/retry.d.ts +5 -5
  46. package/dist/retry.js +4 -4
  47. package/dist/schema.d.ts +6 -6
  48. package/dist/schema.js +8 -8
  49. package/dist/tool-args.d.ts +1 -1
  50. package/dist/tool-args.js +2 -2
  51. package/dist/tools.d.ts +3 -3
  52. package/dist/tools.js +2 -2
  53. package/dist/tools.js.map +1 -1
  54. package/dist/transport.d.ts +7 -7
  55. package/dist/transport.js +6 -6
  56. package/dist/types.d.ts +24 -23
  57. package/dist/types.d.ts.map +1 -1
  58. package/dist/types.js +3 -3
  59. package/dist/types.js.map +1 -1
  60. package/dist/usage.d.ts +4 -4
  61. package/dist/usage.d.ts.map +1 -1
  62. package/dist/usage.js +3 -3
  63. package/dist/usage.js.map +1 -1
  64. package/dist/watchdog.d.ts +12 -12
  65. package/dist/watchdog.js +10 -10
  66. package/dist/zod.d.ts +4 -4
  67. package/dist/zod.js +3 -3
  68. package/package.json +1 -1
  69. package/src/attribution.ts +2 -2
  70. package/src/capability.ts +12 -12
  71. package/src/context.ts +4 -4
  72. package/src/errors.ts +18 -18
  73. package/src/image.ts +1 -1
  74. package/src/jev.ts +11 -11
  75. package/src/key-pool.ts +7 -7
  76. package/src/presets.ts +26 -22
  77. package/src/providers/anthropic.ts +14 -14
  78. package/src/providers/factory.ts +4 -3
  79. package/src/providers/gemini.ts +19 -16
  80. package/src/providers/openai.ts +17 -12
  81. package/src/providers/responses.ts +11 -11
  82. package/src/providers/zai.ts +2 -2
  83. package/src/rate-limit.ts +4 -4
  84. package/src/retry.ts +5 -5
  85. package/src/schema.ts +8 -8
  86. package/src/tool-args.ts +2 -2
  87. package/src/tools.ts +4 -4
  88. package/src/transport.ts +7 -7
  89. package/src/types.ts +24 -23
  90. package/src/usage.ts +5 -5
  91. package/src/watchdog.ts +13 -13
  92. package/src/zod.ts +4 -4
package/dist/retry.d.ts CHANGED
@@ -30,12 +30,12 @@ export declare function backoffMs(attempt: number, base?: number, cap?: number):
30
30
  * abort reason rather than resolving into work nobody wants any more. */
31
31
  export declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
32
32
  /**
33
- * Run `fn`, retrying transient failures with backoff. For one-shot calls —
34
- * a title, a summary, a compaction pass.
33
+ * Run `fn`, retrying transient failures with backoff. For one-shot calls such
34
+ * as a title, a summary or a compaction pass.
35
35
  */
36
36
  export declare function withRetry<T>(fn: (attempt: number) => Promise<T>, opts?: RetryOptions): Promise<T>;
37
37
  /**
38
- * The streaming twin — with the rule that makes it safe: a retry happens only
38
+ * The streaming twin of `withRetry`. A retry happens only
39
39
  * while NOTHING has been yielded yet.
40
40
  *
41
41
  * `factory` is re-invoked per attempt and gets a fresh signal, so an abandoned
@@ -49,7 +49,7 @@ export interface BackupModelOptions {
49
49
  models: string[];
50
50
  /**
51
51
  * Whether a failure may fall through to the remaining models. Default:
52
- * overload and rate limits only — those are per-model-endpoint, and nothing
52
+ * overload and rate limits only. Those are per-model-endpoint, and nothing
53
53
  * else on the list is. An auth failure or an invalid request would land
54
54
  * identically on every backup.
55
55
  */
@@ -69,7 +69,7 @@ export interface BackupModelOptions {
69
69
  /** Walk `[primary, ...backups]` until one succeeds. Rethrows the last error. */
70
70
  export declare function withBackupModels<T>(attempt: (model: string) => Promise<T>, opts: BackupModelOptions): Promise<T>;
71
71
  /**
72
- * The streaming twin — carrying the same commitment rule as `withStreamRetry`.
72
+ * The streaming twin of `withBackupModels`, with the same commitment rule as `withStreamRetry`.
73
73
  *
74
74
  * This is the correction worth naming: walking to a backup model AFTER chunks
75
75
  * have already reached the consumer replays the answer from the top, in a
package/dist/retry.js CHANGED
@@ -61,8 +61,8 @@ function delayFor(err, attempt, opts) {
61
61
  }
62
62
  const defaultShouldRetry = (err, _attempt) => isRetryable(err);
63
63
  /**
64
- * Run `fn`, retrying transient failures with backoff. For one-shot calls —
65
- * a title, a summary, a compaction pass.
64
+ * Run `fn`, retrying transient failures with backoff. For one-shot calls such
65
+ * as a title, a summary or a compaction pass.
66
66
  */
67
67
  export async function withRetry(fn, opts = {}) {
68
68
  const maxAttempts = opts.maxAttempts ?? DEFAULT_MAX_ATTEMPTS;
@@ -92,7 +92,7 @@ export async function withRetry(fn, opts = {}) {
92
92
  throw lastError;
93
93
  }
94
94
  /**
95
- * The streaming twin — with the rule that makes it safe: a retry happens only
95
+ * The streaming twin of `withRetry`. A retry happens only
96
96
  * while NOTHING has been yielded yet.
97
97
  *
98
98
  * `factory` is re-invoked per attempt and gets a fresh signal, so an abandoned
@@ -172,7 +172,7 @@ export async function withBackupModels(attempt, opts) {
172
172
  throw lastError;
173
173
  }
174
174
  /**
175
- * The streaming twin — carrying the same commitment rule as `withStreamRetry`.
175
+ * The streaming twin of `withBackupModels`, with the same commitment rule as `withStreamRetry`.
176
176
  *
177
177
  * This is the correction worth naming: walking to a backup model AFTER chunks
178
178
  * have already reached the consumer replays the answer from the top, in a
package/dist/schema.d.ts CHANGED
@@ -3,19 +3,19 @@ export declare function clampToSchema(value: unknown, node: unknown): unknown;
3
3
  * Whether OpenAI's `strict` schema mode will accept this schema.
4
4
  *
5
5
  * Strict is the only JSON mode that actually guarantees the shape, so it is
6
- * worth having — but it demands more than JSON Schema does: every property an
6
+ * worth having, but it demands more than JSON Schema does: every property an
7
7
  * object lists must ALSO be required, and every object must close itself with
8
8
  * `additionalProperties: false`, all the way down. A schema with one optional
9
9
  * field is not "mostly strict"; it is a flat 400 naming a nested path rather
10
10
  * than the rule it broke.
11
11
  *
12
12
  * That trap is the reason this exists. An agent's response schema grows
13
- * optional fields naturally — a `data` block only some flows fill, the fields
14
- * one step collects — and a caller who adds one wants their answer, not a
13
+ * optional fields naturally (a `data` block only some flows fill, the fields
14
+ * one step collects). A caller who adds one wants their answer, not a
15
15
  * lecture about a mode they never asked for. So the OpenAI-shape adapters ask
16
16
  * this and drop to plain (unenforced) schema mode instead of failing the turn.
17
17
  *
18
- * Anything it cannot verify — a `$ref`, a composed `allOf` — answers false:
18
+ * Anything it cannot verify (a `$ref`, a composed `allOf`) answers false:
19
19
  * the cost of guessing wrong that way is unenforced output, and the cost of
20
20
  * guessing wrong the other way is a request that cannot succeed at all.
21
21
  */
@@ -30,7 +30,7 @@ export declare function clampToSchema(value: unknown, node: unknown): unknown;
30
30
  *
31
31
  * Two shapes need it, which is why the wording lives here rather than in one of
32
32
  * them. Anthropic has never had a schema mode. The OpenAI dialect falls back to
33
- * plain JSON mode on every gateway — `json_object` asks for valid JSON and says
33
+ * plain JSON mode on every gateway: `json_object` asks for valid JSON and says
34
34
  * nothing whatsoever about its shape.
35
35
  */
36
36
  export declare function schemaPrompt(schema: unknown): string;
@@ -39,7 +39,7 @@ export declare function isStrictSchema(node: unknown): boolean;
39
39
  * A tool schema with every `pattern` constraint removed.
40
40
  *
41
41
  * The ChatGPT backend compiles tool schemas with OpenAI's own regex dialect and
42
- * answers a pattern it cannot read with a 400 for the WHOLE request — strict
42
+ * answers a pattern it cannot read with a 400 for the whole request, strict
43
43
  * or not. Claude Code's Artifact tool carries one, and every request that
44
44
  * offered it failed (cc-proxy #141/#142). Losing the constraint costs a
45
45
  * validation the caller's tool runner repeats anyway; the 400 costs the turn.
package/dist/schema.js CHANGED
@@ -49,19 +49,19 @@ export function clampToSchema(value, node) {
49
49
  * Whether OpenAI's `strict` schema mode will accept this schema.
50
50
  *
51
51
  * Strict is the only JSON mode that actually guarantees the shape, so it is
52
- * worth having — but it demands more than JSON Schema does: every property an
52
+ * worth having, but it demands more than JSON Schema does: every property an
53
53
  * object lists must ALSO be required, and every object must close itself with
54
54
  * `additionalProperties: false`, all the way down. A schema with one optional
55
55
  * field is not "mostly strict"; it is a flat 400 naming a nested path rather
56
56
  * than the rule it broke.
57
57
  *
58
58
  * That trap is the reason this exists. An agent's response schema grows
59
- * optional fields naturally — a `data` block only some flows fill, the fields
60
- * one step collects — and a caller who adds one wants their answer, not a
59
+ * optional fields naturally (a `data` block only some flows fill, the fields
60
+ * one step collects). A caller who adds one wants their answer, not a
61
61
  * lecture about a mode they never asked for. So the OpenAI-shape adapters ask
62
62
  * this and drop to plain (unenforced) schema mode instead of failing the turn.
63
63
  *
64
- * Anything it cannot verify — a `$ref`, a composed `allOf` — answers false:
64
+ * Anything it cannot verify (a `$ref`, a composed `allOf`) answers false:
65
65
  * the cost of guessing wrong that way is unenforced output, and the cost of
66
66
  * guessing wrong the other way is a request that cannot succeed at all.
67
67
  */
@@ -76,7 +76,7 @@ export function clampToSchema(value, node) {
76
76
  *
77
77
  * Two shapes need it, which is why the wording lives here rather than in one of
78
78
  * them. Anthropic has never had a schema mode. The OpenAI dialect falls back to
79
- * plain JSON mode on every gateway — `json_object` asks for valid JSON and says
79
+ * plain JSON mode on every gateway: `json_object` asks for valid JSON and says
80
80
  * nothing whatsoever about its shape.
81
81
  */
82
82
  export function schemaPrompt(schema) {
@@ -109,8 +109,8 @@ export function isStrictSchema(node) {
109
109
  const required = new Set(Array.isArray(schema.required) ? schema.required : []);
110
110
  return Object.entries(properties).every(([key, value]) => required.has(key) && isStrictSchema(value));
111
111
  }
112
- /** Keywords whose value is a schema, a list of schemas, or a map of them —
113
- * the only places a `pattern` can mean a regex. Everything else (`default`,
112
+ /** Keywords whose value is a schema, a list of schemas, or a map of them.
113
+ * These are the only places a `pattern` can mean a regex. Everything else (`default`,
114
114
  * `examples`, `enum`, property NAMES) is data and is left alone. */
115
115
  const SCHEMA_SLOTS = [
116
116
  "items",
@@ -130,7 +130,7 @@ const SCHEMA_MAPS = ["properties", "patternProperties", "$defs", "definitions",
130
130
  * A tool schema with every `pattern` constraint removed.
131
131
  *
132
132
  * The ChatGPT backend compiles tool schemas with OpenAI's own regex dialect and
133
- * answers a pattern it cannot read with a 400 for the WHOLE request — strict
133
+ * answers a pattern it cannot read with a 400 for the whole request, strict
134
134
  * or not. Claude Code's Artifact tool carries one, and every request that
135
135
  * offered it failed (cc-proxy #141/#142). Losing the constraint costs a
136
136
  * validation the caller's tool runner repeats anyway; the 400 costs the turn.
@@ -18,7 +18,7 @@ export declare function normalizeToolId(id: string | undefined | null, prefix?:
18
18
  * about, not an exception in the transport.
19
19
  */
20
20
  export declare function parseToolArgs(raw: string): Record<string, unknown>;
21
- /** Whether `raw` parses at all — how a caller tells a truncated tool call from
21
+ /** Whether `raw` parses at all. Lets a caller tell a truncated tool call from
22
22
  * an intact one, since `parseToolArgs` deliberately never throws. */
23
23
  export declare function isCompleteJson(raw: string): boolean;
24
24
  //# sourceMappingURL=tool-args.d.ts.map
package/dist/tool-args.js CHANGED
@@ -53,7 +53,7 @@ function unescapeJson(text) {
53
53
  /**
54
54
  * Best-effort recovery of `"key": "value"` string fields from truncated JSON.
55
55
  *
56
- * Only strings: they are what a summary field — the one worth rescuing — is
56
+ * Only strings: they are what a summary field (the one worth rescuing) is
57
57
  * made of, and a closing quote is the single reliable boundary in a partial
58
58
  * stream. Numbers, booleans and objects are dropped, because a salvaged
59
59
  * half-value is worse than none.
@@ -146,7 +146,7 @@ export function parseToolArgs(raw) {
146
146
  // A non-object payload is a protocol violation, not a value to pass on.
147
147
  return healArgs(isRecord(parsed) ? parsed : {});
148
148
  }
149
- /** Whether `raw` parses at all — how a caller tells a truncated tool call from
149
+ /** Whether `raw` parses at all. Lets a caller tell a truncated tool call from
150
150
  * an intact one, since `parseToolArgs` deliberately never throws. */
151
151
  export function isCompleteJson(raw) {
152
152
  if (!raw.trim())
package/dist/tools.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { JsonObjectSchema, ToolDefinition } from "./types.ts";
2
2
  export interface ToolContext {
3
- /** The model's own call id when there is one — the event, any approval row
3
+ /** The model's own call id when there is one. The event, any approval row
4
4
  * and the tool message must all key on what the provider expects back. */
5
5
  callId?: string;
6
6
  signal?: AbortSignal;
@@ -18,7 +18,7 @@ export type ToolOutcome<O> = {
18
18
  ok: false;
19
19
  callId: string;
20
20
  kind: ToolFailure;
21
- /** Fed back to the model verbatim — so it must read as an instruction to
21
+ /** Fed back to the model verbatim, so it must read as an instruction to
22
22
  * a reader who cannot see our stack trace. */
23
23
  error: string;
24
24
  durationMs: number;
@@ -72,7 +72,7 @@ export declare class ToolRegistry {
72
72
  has(name: string): boolean;
73
73
  get names(): string[];
74
74
  /**
75
- * Definitions for an allow-list, in the order given — which is the order the
75
+ * Definitions for an allow-list, in the order given. This is the order the
76
76
  * model reads them in, and it is part of the cached prompt prefix. Reordering
77
77
  * or appending mid-conversation invalidates that prefix, so a caller that
78
78
  * cares should freeze the list when the session opens.
package/dist/tools.js CHANGED
@@ -6,7 +6,7 @@ export class ToolTimeoutError extends Error {
6
6
  this.name = "ToolTimeoutError";
7
7
  }
8
8
  }
9
- /** Rejects when `signal` aborts — races a `run` that ignores its own signal. */
9
+ /** Rejects when `signal` aborts. Races a `run` that ignores its own signal. */
10
10
  function abortion(signal) {
11
11
  return new Promise((_resolve, reject) => {
12
12
  if (signal.aborted)
@@ -136,7 +136,7 @@ export class ToolRegistry {
136
136
  return [...this.tools.keys()];
137
137
  }
138
138
  /**
139
- * Definitions for an allow-list, in the order given — which is the order the
139
+ * Definitions for an allow-list, in the order given. This is the order the
140
140
  * model reads them in, and it is part of the cached prompt prefix. Reordering
141
141
  * or appending mid-conversation invalidates that prefix, so a caller that
142
142
  * cares should freeze the list when the session opens.
package/dist/tools.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAgExC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC,YAAY,IAAY,EAAE,EAAU;QAClC,KAAK,CAAC,SAAS,IAAI,qBAAqB,EAAE,IAAI,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED,gFAAgF;AAChF,SAAS,QAAQ,CAAC,MAAmB;IACnC,OAAO,IAAI,OAAO,CAAC,CAAC,QAAQ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OAKG;IACH,WAAW,CAAC,KAAyB;QACnC,MAAM,KAAK,GAAG,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC;QAClC,MAAM,GAAG,GAAqB,EAAE,CAAC;QACjC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAClC,IAAI,IAAI;gBAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
@@ -7,7 +7,7 @@ export interface RequestInit_ {
7
7
  signal?: AbortSignal;
8
8
  /** Swapped in tests, or to route through a proxy. Defaults to global fetch. */
9
9
  fetchImpl?: typeof fetch;
10
- /** Called when the response headers arrive and on every body read after —
10
+ /** Called when the response headers arrive and on every body read after,
11
11
  * keep-alives included. What the watchdog's idle clock runs on. */
12
12
  onActivity?: () => void;
13
13
  /** Called when the body states `[DONE]`. See `SseHooks.onDone`. */
@@ -30,15 +30,15 @@ export interface SseHooks {
30
30
  }
31
31
  /**
32
32
  * One frame larger than this is not a frame. Without a cap a malformed or
33
- * runaway upstream grows the buffer until the runtime dies — an MV3 worker
34
- * first. cc-proxy caps the ChatGPT backend at the same 8 MiB.
33
+ * runaway upstream grows the buffer until the runtime dies, starting with an
34
+ * MV3 worker. cc-proxy caps the ChatGPT backend at the same 8 MiB.
35
35
  */
36
36
  export declare const MAX_SSE_FRAME_CHARS: number;
37
37
  /** Join a base URL and a path without doubling or dropping the slash. */
38
38
  export declare function apiUrl(baseUrl: string, path: string): string;
39
39
  /**
40
40
  * How long the provider says to wait, read from the RESPONSE rather than from
41
- * a thrown error. Headers are authoritative — `Retry-After` first, then the
41
+ * a thrown error. Headers are authoritative: `Retry-After` first, then the
42
42
  * vendor reset headers that name a subscription window rather than a
43
43
  * per-minute throttle, because "try again in a moment" is a lie for those.
44
44
  */
@@ -46,21 +46,21 @@ export declare function retryAfterFromHeaders(headers: Headers, now?: number): n
46
46
  /** POST and parse one JSON response. For the endpoints that do not stream. */
47
47
  export declare function postJson<T = unknown>(opts: RequestInit_): Promise<T>;
48
48
  /**
49
- * Yield each `data:` payload of an SSE body, trimmed — plus the bare JSON
49
+ * Yield each `data:` payload of an SSE body, trimmed, plus the bare JSON
50
50
  * object a vendor appends outside the framing, which is only ever an error
51
51
  * (see `payloadOf`).
52
52
  *
53
53
  * Frames are split on the blank line the spec requires, so a payload containing
54
54
  * a bare newline survives; `[DONE]` is swallowed here rather than in every
55
55
  * adapter, and reported through `hooks.onDone`. CRLF and bare CR are
56
- * normalized — some gateways send them, and a `\r` left on the end of a JSON
56
+ * normalized: some gateways send them, and a `\r` left on the end of a JSON
57
57
  * payload is a parse error nobody enjoys debugging.
58
58
  *
59
59
  * Exported apart from `streamSse` because the envelope above it is the half an
60
60
  * adopting app most often cannot take: an app with its own translated error
61
61
  * copy, its own log levels, or its own auth refresh has to keep building the
62
62
  * request and reading the failure itself. Framing is the half nobody should
63
- * write twice — hand it a `res.body` and keep your own envelope.
63
+ * write twice. Hand it a `res.body` and keep your own envelope.
64
64
  */
65
65
  export declare function parseSseStream(body: ReadableStream<Uint8Array>, hooks?: SseHooks): AsyncGenerator<string>;
66
66
  /**
package/dist/transport.js CHANGED
@@ -8,8 +8,8 @@ import { classifyHttp, isTransportFailure, parseRetryAfterMs, ProviderError } fr
8
8
  import { parseRateLimitReset, parseRateLimitResponse } from "./rate-limit.js";
9
9
  /**
10
10
  * One frame larger than this is not a frame. Without a cap a malformed or
11
- * runaway upstream grows the buffer until the runtime dies — an MV3 worker
12
- * first. cc-proxy caps the ChatGPT backend at the same 8 MiB.
11
+ * runaway upstream grows the buffer until the runtime dies, starting with an
12
+ * MV3 worker. cc-proxy caps the ChatGPT backend at the same 8 MiB.
13
13
  */
14
14
  export const MAX_SSE_FRAME_CHARS = 8 * 1024 * 1024;
15
15
  /** Join a base URL and a path without doubling or dropping the slash. */
@@ -18,7 +18,7 @@ export function apiUrl(baseUrl, path) {
18
18
  }
19
19
  /**
20
20
  * How long the provider says to wait, read from the RESPONSE rather than from
21
- * a thrown error. Headers are authoritative — `Retry-After` first, then the
21
+ * a thrown error. Headers are authoritative: `Retry-After` first, then the
22
22
  * vendor reset headers that name a subscription window rather than a
23
23
  * per-minute throttle, because "try again in a moment" is a lie for those.
24
24
  */
@@ -135,21 +135,21 @@ function payloadOf(frame) {
135
135
  return payload.length > 0 ? payload : null;
136
136
  }
137
137
  /**
138
- * Yield each `data:` payload of an SSE body, trimmed — plus the bare JSON
138
+ * Yield each `data:` payload of an SSE body, trimmed, plus the bare JSON
139
139
  * object a vendor appends outside the framing, which is only ever an error
140
140
  * (see `payloadOf`).
141
141
  *
142
142
  * Frames are split on the blank line the spec requires, so a payload containing
143
143
  * a bare newline survives; `[DONE]` is swallowed here rather than in every
144
144
  * adapter, and reported through `hooks.onDone`. CRLF and bare CR are
145
- * normalized — some gateways send them, and a `\r` left on the end of a JSON
145
+ * normalized: some gateways send them, and a `\r` left on the end of a JSON
146
146
  * payload is a parse error nobody enjoys debugging.
147
147
  *
148
148
  * Exported apart from `streamSse` because the envelope above it is the half an
149
149
  * adopting app most often cannot take: an app with its own translated error
150
150
  * copy, its own log levels, or its own auth refresh has to keep building the
151
151
  * request and reading the failure itself. Framing is the half nobody should
152
- * write twice — hand it a `res.body` and keep your own envelope.
152
+ * write twice. Hand it a `res.body` and keep your own envelope.
153
153
  */
154
154
  export async function* parseSseStream(body, hooks = {}) {
155
155
  const reader = body.getReader();
package/dist/types.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * `output_config.effort` for current Claude models, where `none` is the lowest
6
6
  * effort on a model that cannot stop thinking; and to thinking budgets for
7
7
  * Claude 4.5 and older and for every other vendor on that wire.
8
- * Support varies per model — an unsupported level comes back as a clean 400.
8
+ * Support varies per model. An unsupported level comes back as a clean 400.
9
9
  *
10
10
  * Ordered least → most; the type derives from the array so the runtime guard
11
11
  * and the union can never drift apart.
@@ -19,7 +19,7 @@ export interface TextPart {
19
19
  type: "text";
20
20
  text: string;
21
21
  }
22
- /** An image the model looks at (vision) — bytes as base64, never a URL the
22
+ /** An image the model looks at (vision), with bytes as base64, never a URL the
23
23
  * provider would have to fetch on our behalf. */
24
24
  export interface ImagePart {
25
25
  type: "image";
@@ -30,7 +30,7 @@ export interface ImagePart {
30
30
  * `ImagePart`, which every adapter can send. */
31
31
  export type FileMimeType = `application/${string}` | `audio/${string}` | `video/${string}` | `text/${string}`;
32
32
  /**
33
- * A file the model reads — a PDF, a recording, a video — as base64 bytes,
33
+ * A file the model reads (a PDF, a recording, a video) as base64 bytes,
34
34
  * never a URL. Only the Gemini adapter sends one, as `inlineData`, the way it
35
35
  * sends an image. Every other adapter refuses it with an `invalid`
36
36
  * ProviderError before any request goes out, rather than drop it: a dropped
@@ -76,7 +76,7 @@ export type ChatMessage = {
76
76
  * OpenAI-shape serializes it as `reasoning_content`; Anthropic-shape
77
77
  * drops it, since its thinking blocks carry signatures we never capture.
78
78
  *
79
- * A turn that DISABLES thinking must not carry it — mixing the two is
79
+ * A turn that disables thinking must not carry it. Mixing the two is
80
80
  * unsupported. `stripReasoning` below is that rule, once.
81
81
  */
82
82
  reasoning?: string;
@@ -84,7 +84,7 @@ export type ChatMessage = {
84
84
  * OpenRouter's normalized reasoning payload, arriving on the stream and
85
85
  * riding back UNMODIFIED on the next turn's assistant message.
86
86
  *
87
- * Opaque on purpose — the same contract as Gemini's `thoughtSignature`,
87
+ * Opaque on purpose, with the same contract as Gemini's `thoughtSignature`,
88
88
  * and for the same reason: it is the provider's own record of how it got
89
89
  * here, and reading, reshaping or dropping it costs the model its
90
90
  * continuity across a tool round. Absent on every other dialect.
@@ -112,7 +112,7 @@ export interface ReasoningItems {
112
112
  provider: string;
113
113
  items: unknown[];
114
114
  }
115
- /** JSON Schema for an object — what every provider's tool contract wants. */
115
+ /** JSON Schema for an object, as every provider's tool contract requires. */
116
116
  export interface JsonObjectSchema {
117
117
  type: "object";
118
118
  properties?: Record<string, unknown>;
@@ -136,19 +136,19 @@ export interface ToolCallDelta {
136
136
  }
137
137
  export interface TokenUsage {
138
138
  inputTokens: number;
139
- /** Cache-HIT subset of `inputTokens` — providers auto-cache repeated
139
+ /** Cache-hit subset of `inputTokens`. Providers auto-cache repeated
140
140
  * prefixes and bill the hit portion far cheaper, so it must be tracked
141
141
  * separately to cost a turn correctly. 0 when the provider reports none. */
142
142
  cachedInputTokens: number;
143
- /** Tokens WRITTEN to cache — also a subset of `inputTokens`, so the total
143
+ /** Tokens written to cache, also a subset of `inputTokens`, so the total
144
144
  * stays the whole prompt the window has to hold. Anthropic bills these
145
145
  * above the input rate; the OpenAI-shape auto-cachers bill them at it.
146
146
  * 0 when not reported. */
147
147
  cacheWriteTokens?: number;
148
148
  outputTokens: number;
149
149
  /**
150
- * The part of `outputTokens` spent thinking, when the provider reports it —
151
- * already INSIDE `outputTokens`, so never add it again. It is the number
150
+ * The part of `outputTokens` spent thinking, when the provider reports it.
151
+ * Already inside `outputTokens`, so never add it again. It is the number
152
152
  * that explains a turn that came back empty with a length finish: the
153
153
  * reasoning ate the budget. Anthropic does not report it; absent there.
154
154
  */
@@ -164,7 +164,7 @@ export interface TokenUsage {
164
164
  reportedCostUsd?: number;
165
165
  }
166
166
  export declare const EMPTY_USAGE: TokenUsage;
167
- /** Normalized streaming chunk — every provider's shape collapses into this. */
167
+ /** Normalized streaming chunk. Every provider's shape maps to this. */
168
168
  export interface ProviderChunk {
169
169
  type: "delta" | "usage" | "finish";
170
170
  /** The selected endpoint and model when a fallback provider emits this chunk.
@@ -175,7 +175,7 @@ export interface ProviderChunk {
175
175
  };
176
176
  content?: string;
177
177
  reasoning?: string;
178
- /** OpenRouter's normalized reasoning payload — hand it back on the next
178
+ /** OpenRouter's normalized reasoning payload. Hand it back on the next
179
179
  * turn's assistant message verbatim. See ChatMessage.reasoningDetails. */
180
180
  reasoningDetails?: unknown[];
181
181
  /** Once per turn, where a provider replays its reasoning. See ChatMessage.reasoningItems. */
@@ -184,7 +184,7 @@ export interface ProviderChunk {
184
184
  usage?: TokenUsage;
185
185
  finishReason?: FinishReason;
186
186
  }
187
- /** Pin or deny tool use. `{ name }` forces one specific tool — how a run is
187
+ /** Pin or deny tool use. `{ name }` forces one specific tool, so a run is
188
188
  * made to commit an answer at its step budget's edge. */
189
189
  export type ToolChoice = "auto" | "none" | "required" | {
190
190
  name: string;
@@ -192,15 +192,15 @@ export type ToolChoice = "auto" | "none" | "required" | {
192
192
  /**
193
193
  * Ask for a JSON object matching `schema`. Providers that enforce schemas get
194
194
  * it verbatim; the rest get JSON mode plus the schema in the prompt. Either
195
- * way the CALLER validates — a provider's "guaranteed" JSON is not one.
195
+ * way the caller validates: a provider's "guaranteed" JSON is not one.
196
196
  */
197
197
  export interface JsonOutput {
198
198
  name: string;
199
199
  schema: JsonObjectSchema;
200
200
  /**
201
201
  * Force OpenAI's strict schema mode on or off. Left unset, the adapters ask
202
- * `isStrictSchema` and enforce whenever the schema actually qualifies —
203
- * which is what keeps an optional field from turning a working call into a
202
+ * `isStrictSchema` and enforce whenever the schema actually qualifies.
203
+ * This keeps an optional field from turning a working call into a
204
204
  * 400. Set it only to overrule that reading.
205
205
  */
206
206
  strict?: boolean;
@@ -230,13 +230,13 @@ export declare class JsonAnswerError extends Error {
230
230
  /**
231
231
  * How the schema rides on a call that ALSO carries tools.
232
232
  *
233
- * `"response_format"` sends both — what the shapes document, what most models
233
+ * `"response_format"` sends both, as the shapes document and most models
234
234
  * honour. `"prompt"` leaves the format off that call and sends the schema as
235
235
  * prompt instead, which is what the Anthropic shape has always done.
236
236
  *
237
237
  * It is a setting because a model that cannot serve both never says so: its
238
238
  * decoder is pinned to the schema, the tool call has nowhere to go, and it
239
- * writes the announcement instead — "let me look that up" — and stops. Nothing
239
+ * writes the announcement instead ("let me look that up") and stops. Nothing
240
240
  * is logged, because nothing failed. `probeJsonWithTools` answers it in one
241
241
  * call; there is no default that is right for every model.
242
242
  */
@@ -249,9 +249,10 @@ export interface StreamOptions {
249
249
  * task emitting a large artifact must raise it or the tool-call JSON is
250
250
  * silently truncated mid-argument. */
251
251
  maxTokens?: number;
252
+ /** Not sent to Gemini, which fixes its own sampling. Same for `topP`. */
252
253
  temperature?: number;
253
254
  /**
254
- * Nucleus sampling. Set this OR `temperature`, not both — the vendors all
255
+ * Nucleus sampling. Set this or `temperature`, not both. The vendors all
255
256
  * document them as alternatives and some reject the pair outright.
256
257
  */
257
258
  topP?: number;
@@ -268,7 +269,7 @@ export interface StreamOptions {
268
269
  toolChoice?: ToolChoice;
269
270
  json?: JsonOutput;
270
271
  /**
271
- * Overrides the provider's own setting for this call — how `probeJsonWithTools`
272
+ * Overrides the provider's own setting for this call, so `probeJsonWithTools`
272
273
  * asks the same model both ways. See {@link JsonWithTools}.
273
274
  */
274
275
  jsonWithTools?: JsonWithTools;
@@ -287,7 +288,7 @@ export interface StreamOptions {
287
288
  */
288
289
  onActivity?: () => void;
289
290
  /**
290
- * `false` asks for at most one tool call per turn — for tools that must run
291
+ * `false` asks for at most one tool call per turn, for tools that must run
291
292
  * in order, or a backend lane that refuses parallel calls. Absent or `true`
292
293
  * is every vendor's default and sends nothing. Gemini has no such switch,
293
294
  * so it refuses `false` rather than silently ignore it.
@@ -330,13 +331,13 @@ export declare function drainStream(stream: AsyncIterable<ProviderChunk>, model:
330
331
  *
331
332
  * The chain-of-thought belongs only to thinking turns. A provider that
332
333
  * requires it replayed while thinking is ON (DeepSeek) rejects it when
333
- * thinking is OFF — which is exactly the shape of a forced-submit salvage
334
+ * thinking is off. This is exactly the shape of a forced-submit salvage
334
335
  * turn, where a run reasons through its whole investigation and then drops
335
336
  * thinking to serialize what it already found.
336
337
  *
337
338
  * Returns a shallow-cleaned copy; the caller's array is left untouched.
338
339
  */
339
340
  export declare function stripReasoning(messages: readonly ChatMessage[]): ChatMessage[];
340
- /** `data:` URI for an image part — what the OpenAI dialect wants inline. */
341
+ /** `data:` URI for an image part, as the OpenAI dialect requires inline. */
341
342
  export declare function toDataUri(part: ImagePart): string;
342
343
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,OAAO,mDAAoD,CAAC;AACzE,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9C,2EAA2E;AAC3E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,MAAM,CAEvD;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,CAAC;AAEpF,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;kDACkD;AAClD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;iDACiD;AACjD,MAAM,MAAM,YAAY,GACtB,eAAe,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,GAAG,QAAQ,MAAM,EAAE,CAAC;AAErF;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,YAAY,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB;gEAC4D;IAC5D,gBAAgB,CAAC,EAAE,MAAM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EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC;IAC7B,iFAAiF;IACjF,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,KAAK,EAAE,UAAU,CAAC;IAClB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;kEACkE;AAClE,wBAAsB,WAAW,CAC/B,MAAM,EAAE,aAAa,CAAC,aAAa,CAAC,EACpC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,UAAU,CAAC,CAmCrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,WAAW,EAAE,GAAG,WAAW,EAAE,CAsB9E;AAED,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAEjD"}
package/dist/types.js CHANGED
@@ -13,7 +13,7 @@
13
13
  * `output_config.effort` for current Claude models, where `none` is the lowest
14
14
  * effort on a model that cannot stop thinking; and to thinking budgets for
15
15
  * Claude 4.5 and older and for every other vendor on that wire.
16
- * Support varies per model — an unsupported level comes back as a clean 400.
16
+ * Support varies per model. An unsupported level comes back as a clean 400.
17
17
  *
18
18
  * Ordered least → most; the type derives from the array so the runtime guard
19
19
  * and the union can never drift apart.
@@ -187,7 +187,7 @@ export async function drainStream(stream, model) {
187
187
  *
188
188
  * The chain-of-thought belongs only to thinking turns. A provider that
189
189
  * requires it replayed while thinking is ON (DeepSeek) rejects it when
190
- * thinking is OFF — which is exactly the shape of a forced-submit salvage
190
+ * thinking is off. This is exactly the shape of a forced-submit salvage
191
191
  * turn, where a run reasons through its whole investigation and then drops
192
192
  * thinking to serialize what it already found.
193
193
  *
@@ -210,7 +210,7 @@ export function stripReasoning(messages) {
210
210
  return rest;
211
211
  });
212
212
  }
213
- /** `data:` URI for an image part — what the OpenAI dialect wants inline. */
213
+ /** `data:` URI for an image part, as the OpenAI dialect requires inline. */
214
214
  export function toDataUri(part) {
215
215
  return `data:${part.mimeType};base64,${part.data}`;
216
216
  }
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,2EAA2E;AAC3E,mEAAmE;AACnE,EAAE;AACF,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,0BAA0B;AAE1B;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AAGzE,2EAA2E;AAC3E,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC;AACpD,CAAC;AAoKD,MAAM,CAAC,MAAM,WAAW,GAAe;IACrC,WAAW,EAAE,CAAC;IACd,iBAAiB,EAAE,CAAC;IACpB,YAAY,EAAE,CAAC;CAChB,CAAC;AAyCF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACnE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAC7B,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACvD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,IAAI,EAAE,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,WAAW,EAAE,CAAC;QACrB,I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