@providerkit/core 0.29.1 → 0.31.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 (163) hide show
  1. package/README.md +58 -9
  2. package/THIRD_PARTY_NOTICES +144 -0
  3. package/dist/auth/chatgpt-models.js.map +1 -1
  4. package/dist/auth/oauth.d.ts.map +1 -1
  5. package/dist/auth/oauth.js.map +1 -1
  6. package/dist/capability.js.map +1 -1
  7. package/dist/context.d.ts +4 -3
  8. package/dist/context.d.ts.map +1 -1
  9. package/dist/context.js +19 -5
  10. package/dist/context.js.map +1 -1
  11. package/dist/decisions.js.map +1 -1
  12. package/dist/errors.d.ts.map +1 -1
  13. package/dist/errors.js +29 -2
  14. package/dist/errors.js.map +1 -1
  15. package/dist/fallback.d.ts +3 -0
  16. package/dist/fallback.d.ts.map +1 -1
  17. package/dist/fallback.js +9 -5
  18. package/dist/fallback.js.map +1 -1
  19. package/dist/gate.js.map +1 -1
  20. package/dist/hosted/anthropic.d.ts +30 -0
  21. package/dist/hosted/anthropic.d.ts.map +1 -0
  22. package/dist/hosted/anthropic.js +465 -0
  23. package/dist/hosted/anthropic.js.map +1 -0
  24. package/dist/hosted/gemini.d.ts +22 -0
  25. package/dist/hosted/gemini.d.ts.map +1 -0
  26. package/dist/hosted/gemini.js +440 -0
  27. package/dist/hosted/gemini.js.map +1 -0
  28. package/dist/hosted/openai.d.ts +33 -0
  29. package/dist/hosted/openai.d.ts.map +1 -0
  30. package/dist/hosted/openai.js +107 -0
  31. package/dist/hosted/openai.js.map +1 -0
  32. package/dist/hosted/responses.d.ts +28 -0
  33. package/dist/hosted/responses.d.ts.map +1 -0
  34. package/dist/hosted/responses.js +358 -0
  35. package/dist/hosted/responses.js.map +1 -0
  36. package/dist/hosted/shared.d.ts +107 -0
  37. package/dist/hosted/shared.d.ts.map +1 -0
  38. package/dist/hosted/shared.js +264 -0
  39. package/dist/hosted/shared.js.map +1 -0
  40. package/dist/hosted/types.d.ts +191 -0
  41. package/dist/hosted/types.d.ts.map +1 -0
  42. package/dist/hosted/types.js +10 -0
  43. package/dist/hosted/types.js.map +1 -0
  44. package/dist/hosted.d.ts +33 -0
  45. package/dist/hosted.d.ts.map +1 -0
  46. package/dist/hosted.js +61 -0
  47. package/dist/hosted.js.map +1 -0
  48. package/dist/index.d.ts +8 -7
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +8 -7
  51. package/dist/index.js.map +1 -1
  52. package/dist/key-pool.d.ts.map +1 -1
  53. package/dist/key-pool.js.map +1 -1
  54. package/dist/presets.d.ts +36 -5
  55. package/dist/presets.d.ts.map +1 -1
  56. package/dist/presets.js +32 -8
  57. package/dist/presets.js.map +1 -1
  58. package/dist/providers/anthropic.d.ts +75 -1
  59. package/dist/providers/anthropic.d.ts.map +1 -1
  60. package/dist/providers/anthropic.js +207 -135
  61. package/dist/providers/anthropic.js.map +1 -1
  62. package/dist/providers/deepgram-transcription.d.ts +24 -0
  63. package/dist/providers/deepgram-transcription.d.ts.map +1 -0
  64. package/dist/providers/deepgram-transcription.js +84 -0
  65. package/dist/providers/deepgram-transcription.js.map +1 -0
  66. package/dist/providers/factory.d.ts +10 -0
  67. package/dist/providers/factory.d.ts.map +1 -1
  68. package/dist/providers/factory.js +31 -23
  69. package/dist/providers/factory.js.map +1 -1
  70. package/dist/providers/gemini.d.ts +123 -1
  71. package/dist/providers/gemini.d.ts.map +1 -1
  72. package/dist/providers/gemini.js +114 -54
  73. package/dist/providers/gemini.js.map +1 -1
  74. package/dist/providers/hosted-codecs.d.ts +10 -0
  75. package/dist/providers/hosted-codecs.d.ts.map +1 -0
  76. package/dist/providers/hosted-codecs.js +8 -0
  77. package/dist/providers/hosted-codecs.js.map +1 -0
  78. package/dist/providers/openai-transcription.d.ts +21 -0
  79. package/dist/providers/openai-transcription.d.ts.map +1 -0
  80. package/dist/providers/openai-transcription.js +144 -0
  81. package/dist/providers/openai-transcription.js.map +1 -0
  82. package/dist/providers/openai.d.ts +69 -0
  83. package/dist/providers/openai.d.ts.map +1 -1
  84. package/dist/providers/openai.js +38 -14
  85. package/dist/providers/openai.js.map +1 -1
  86. package/dist/providers/responses.d.ts +123 -0
  87. package/dist/providers/responses.d.ts.map +1 -1
  88. package/dist/providers/responses.js +57 -22
  89. package/dist/providers/responses.js.map +1 -1
  90. package/dist/providers/speech-factory.js.map +1 -1
  91. package/dist/providers/transcription-factory.d.ts +30 -0
  92. package/dist/providers/transcription-factory.d.ts.map +1 -0
  93. package/dist/providers/transcription-factory.js +38 -0
  94. package/dist/providers/transcription-factory.js.map +1 -0
  95. package/dist/registry.d.ts +3 -0
  96. package/dist/registry.d.ts.map +1 -1
  97. package/dist/registry.js +8 -4
  98. package/dist/registry.js.map +1 -1
  99. package/dist/retry.js.map +1 -1
  100. package/dist/speech-core.d.ts +2 -17
  101. package/dist/speech-core.d.ts.map +1 -1
  102. package/dist/speech-core.js +10 -50
  103. package/dist/speech-core.js.map +1 -1
  104. package/dist/tools.d.ts.map +1 -1
  105. package/dist/tools.js.map +1 -1
  106. package/dist/transcription-core.d.ts +146 -0
  107. package/dist/transcription-core.d.ts.map +1 -0
  108. package/dist/transcription-core.js +193 -0
  109. package/dist/transcription-core.js.map +1 -0
  110. package/dist/transcription.d.ts +7 -0
  111. package/dist/transcription.d.ts.map +1 -0
  112. package/dist/transcription.js +12 -0
  113. package/dist/transcription.js.map +1 -0
  114. package/dist/transport.d.ts +26 -0
  115. package/dist/transport.d.ts.map +1 -1
  116. package/dist/transport.js +57 -2
  117. package/dist/transport.js.map +1 -1
  118. package/dist/turn.d.ts +10 -1
  119. package/dist/turn.d.ts.map +1 -1
  120. package/dist/turn.js +53 -1
  121. package/dist/turn.js.map +1 -1
  122. package/dist/types.d.ts +51 -0
  123. package/dist/types.d.ts.map +1 -1
  124. package/dist/types.js.map +1 -1
  125. package/dist/usage.d.ts +10 -1
  126. package/dist/usage.d.ts.map +1 -1
  127. package/dist/usage.js +40 -2
  128. package/dist/usage.js.map +1 -1
  129. package/dist/watchdog.d.ts +6 -0
  130. package/dist/watchdog.d.ts.map +1 -1
  131. package/dist/watchdog.js +10 -2
  132. package/dist/watchdog.js.map +1 -1
  133. package/package.json +14 -5
  134. package/src/context.ts +21 -5
  135. package/src/errors.ts +35 -2
  136. package/src/fallback.ts +21 -6
  137. package/src/hosted/anthropic.ts +512 -0
  138. package/src/hosted/gemini.ts +510 -0
  139. package/src/hosted/openai.ts +137 -0
  140. package/src/hosted/responses.ts +420 -0
  141. package/src/hosted/shared.ts +341 -0
  142. package/src/hosted/types.ts +214 -0
  143. package/src/hosted.ts +101 -0
  144. package/src/index.ts +64 -7
  145. package/src/presets.ts +54 -8
  146. package/src/providers/anthropic.ts +252 -143
  147. package/src/providers/deepgram-transcription.ts +109 -0
  148. package/src/providers/factory.ts +127 -82
  149. package/src/providers/gemini.ts +184 -60
  150. package/src/providers/hosted-codecs.ts +29 -0
  151. package/src/providers/openai-transcription.ts +177 -0
  152. package/src/providers/openai.ts +52 -15
  153. package/src/providers/responses.ts +93 -24
  154. package/src/providers/transcription-factory.ts +68 -0
  155. package/src/registry.ts +14 -4
  156. package/src/speech-core.ts +9 -47
  157. package/src/transcription-core.ts +345 -0
  158. package/src/transcription.ts +24 -0
  159. package/src/transport.ts +77 -3
  160. package/src/turn.ts +55 -1
  161. package/src/types.ts +62 -1
  162. package/src/usage.ts +32 -2
  163. package/src/watchdog.ts +12 -2
@@ -0,0 +1,264 @@
1
+ export * from "./types.js";
2
+ import { ProviderError } from "../errors.js";
3
+ /**
4
+ * A hosted tool the wire can't send. Refused, never dropped: see the module
5
+ * comment. `wire` names the adapter, because `provider` is often a gateway's id.
6
+ */
7
+ export function hostedRefused(provider, wire, tool, why) {
8
+ return new ProviderError(provider, "invalid", `${provider}: the ${wire} adapter can't send ${tool}: ${why}`);
9
+ }
10
+ const FORCED = 'a forced toolChoice can\'t be combined with hosted tools, because each vendor reads it differently. Use toolChoice "auto", or leave the hosted tools off this call.';
11
+ /**
12
+ * The hosted tools one request sends: each tool the caller asked for that this
13
+ * wire can send with every field it set. One it can't is refused with an
14
+ * `invalid` error before any request, unless it is `optional`, which drops it.
15
+ *
16
+ * `toolChoice: "none"` sends none, on every wire. A forced choice (`required`
17
+ * or a named tool) with hosted tools is refused: Anthropic's `any` and
18
+ * Responses' `required` can be met by a vendor tool, Gemini's `ANY` cannot, so
19
+ * the pair has no one meaning. A type listed twice is refused everywhere.
20
+ *
21
+ * Ported from PydanticAI (MIT, Pydantic Services Inc.): the refusal rule and
22
+ * `optional`, models/__init__.py:4080-4130 and native_tools/__init__.py:155-207.
23
+ */
24
+ export function planHostedTools(provider, wire, opts) {
25
+ const asked = opts.hostedTools ?? [];
26
+ const seen = new Set();
27
+ for (const tool of asked) {
28
+ if (seen.has(tool.type)) {
29
+ throw hostedRefused(provider, wire.name, tool.type, "it is listed twice. List each type once.");
30
+ }
31
+ seen.add(tool.type);
32
+ }
33
+ if (opts.toolChoice === "none")
34
+ return [];
35
+ const forced = opts.toolChoice === "required" || typeof opts.toolChoice === "object";
36
+ return asked.filter((tool) => {
37
+ const why = forced ? FORCED : unsendable(tool, wire);
38
+ if (why === undefined)
39
+ return true;
40
+ if (tool.optional)
41
+ return false;
42
+ throw hostedRefused(provider, wire.name, tool.type, why);
43
+ });
44
+ }
45
+ function unsendable(tool, wire) {
46
+ if (!wire.serves.includes(tool.type)) {
47
+ return ("this endpoint doesn't run it. Send the request to one that does, list the type in " +
48
+ "servesHostedTools if this endpoint runs it, or mark the tool optional.");
49
+ }
50
+ const applied = wire.fields[tool.type] ?? [];
51
+ const unapplied = Object.entries(tool)
52
+ .filter(([key, value]) => key !== "type" && key !== "optional" && value !== undefined)
53
+ .map(([key]) => key)
54
+ .filter((key) => !applied.includes(key));
55
+ if (unapplied.length > 0) {
56
+ const fields = unapplied.join(" and ");
57
+ return (`this wire can't apply ${fields}, so the tool would run without ${fields}. ` +
58
+ `Remove ${fields}, or mark the tool optional.`);
59
+ }
60
+ return wire.refuse?.(tool);
61
+ }
62
+ /** The types an endpoint runs when its config doesn't say: the vendor's own API
63
+ * host runs its documented set, and every other host none. A gateway that
64
+ * ignores an unknown tool answers unsearched and says nothing, so a host runs
65
+ * hosted tools only once someone has measured it (`servesHostedTools`). */
66
+ export function servedAt(baseUrl, host, types) {
67
+ try {
68
+ return new URL(baseUrl).hostname === host ? types : [];
69
+ }
70
+ catch {
71
+ return [];
72
+ }
73
+ }
74
+ /** A search's input: one query as `query`, several as `queries`, so a reader
75
+ * that shows one string finds it in the same place on every wire. */
76
+ export function queryInput(queries) {
77
+ const stated = queries.filter((query) => typeof query === "string" && !!query);
78
+ if (stated.length === 0)
79
+ return {};
80
+ return stated.length === 1 ? { query: stated[0] } : { queries: stated };
81
+ }
82
+ /**
83
+ * The hosted calls one stream opened, keyed by the vendor's id, so a result
84
+ * finds its call and the end of the turn can settle the ones that never got
85
+ * one. It also counts what the stream showed, per type, for
86
+ * `TokenUsage.hostedCalls` on a wire that does not state its own counts.
87
+ */
88
+ export class HostedRecorder {
89
+ next = 0;
90
+ open = new Map();
91
+ counts = new Map();
92
+ /** A call the vendor started. One with no id of its own gets `hosted_{index}`,
93
+ * which depends on nothing but its position (invariant 14). */
94
+ start(id, type, at, input) {
95
+ const index = this.next++;
96
+ const key = id || `hosted_${index}`;
97
+ this.open.set(key, index);
98
+ this.counts.set(type, (this.counts.get(type) ?? 0) + 1);
99
+ return { index, id: key, type, status: "running", at, ...(input ? { input } : {}) };
100
+ }
101
+ /** A call the vendor reports only once it is over (Gemini's grounding, a
102
+ * backend that sends only the finished item), in one delta. */
103
+ whole(id, type, at, delta) {
104
+ const started = this.start(id, type, at);
105
+ this.open.delete(started.id);
106
+ return { ...started, ...delta };
107
+ }
108
+ /** The seam index of a call still open, by the vendor's id. */
109
+ indexOf(id) {
110
+ return id === undefined ? undefined : this.open.get(id);
111
+ }
112
+ /** A call the vendor finished, or undefined for an id it never opened. */
113
+ end(id, delta) {
114
+ if (id === undefined)
115
+ return undefined;
116
+ const index = this.open.get(id);
117
+ if (index === undefined)
118
+ return undefined;
119
+ this.open.delete(id);
120
+ return { index, ...delta };
121
+ }
122
+ /** The ids still open. */
123
+ unsettled() {
124
+ return new Set(this.open.keys());
125
+ }
126
+ /** Every call still open at the end of the turn, failed: the vendor never
127
+ * said how it went, so nothing it returned can be shown or replayed. */
128
+ settle() {
129
+ const failed = [...this.open.values()].map((index) => ({
130
+ index,
131
+ status: "failed",
132
+ error: "no_result",
133
+ }));
134
+ this.open.clear();
135
+ return failed;
136
+ }
137
+ /** The calls the stream showed, by type, or undefined when it showed none. */
138
+ shown() {
139
+ return this.counts.size > 0 ? Object.fromEntries(this.counts) : undefined;
140
+ }
141
+ }
142
+ /** The counts a usage record carries, with the types at zero left out, or
143
+ * undefined when every type is. A turn that ran nothing keeps its usage
144
+ * exactly as it was before hosted tools existed. */
145
+ export function hostedCounts(...counts) {
146
+ const merged = {};
147
+ for (const count of counts)
148
+ Object.assign(merged, count);
149
+ const kept = Object.entries(merged).filter(([, count]) => (count ?? 0) > 0);
150
+ return kept.length > 0 ? Object.fromEntries(kept) : undefined;
151
+ }
152
+ /** A JSON object off the wire, as opposed to an array, a scalar or null. */
153
+ export function isRecord(value) {
154
+ return typeof value === "object" && value !== null && !Array.isArray(value);
155
+ }
156
+ /** `{ length }`: answer text, cut back out of `content` on replay. A vendor item
157
+ * always carries a `type` or a part key of its own, so a placeholder can't be
158
+ * mistaken for one. */
159
+ function textSlot(item) {
160
+ if (!isRecord(item) || "type" in item)
161
+ return undefined;
162
+ const { length } = item;
163
+ return typeof length === "number" ? { slot: item, length } : undefined;
164
+ }
165
+ /** `{ call: i }`: the message's i-th tool call, whatever its id is now. */
166
+ function callSlot(item) {
167
+ if (!isRecord(item) || "type" in item)
168
+ return undefined;
169
+ const { call } = item;
170
+ return typeof call === "number" ? call : undefined;
171
+ }
172
+ /**
173
+ * The hosted items a message replays to `provider`, placeholders filled back
174
+ * in, or undefined when it replays none: another provider made them, or the
175
+ * message no longer matches them. Matching means the recorded text lengths sum
176
+ * to `content.length` and every call placeholder names a distinct call the
177
+ * message still has. An edited answer fails that and goes back as plain text,
178
+ * because a citation replayed over edited text vouches for words its source
179
+ * never backed.
180
+ *
181
+ * ponytail: an edit that keeps the length passes. PydanticAI and TanStack use
182
+ * the same length test (anthropic/_citations.py:202-211, responses-text.ts:172-212);
183
+ * the upgrade is a hash of the text in each placeholder.
184
+ */
185
+ export function hostedReplay(message, provider) {
186
+ const recorded = message.hostedItems;
187
+ if (!recorded || recorded.provider !== provider)
188
+ return undefined;
189
+ const calls = message.toolCalls ?? [];
190
+ let length = 0;
191
+ const paired = new Set();
192
+ for (const item of recorded.items) {
193
+ const slot = textSlot(item);
194
+ if (slot)
195
+ length += slot.length;
196
+ const call = callSlot(item);
197
+ if (call === undefined)
198
+ continue;
199
+ if (!Number.isInteger(call) || call < 0 || call >= calls.length || paired.has(call)) {
200
+ return undefined;
201
+ }
202
+ paired.add(call);
203
+ }
204
+ if (length !== message.content.length || paired.size !== calls.length)
205
+ return undefined;
206
+ let offset = 0;
207
+ return recorded.items.map((item) => {
208
+ const text = textSlot(item);
209
+ if (text) {
210
+ offset += text.length;
211
+ return { text: message.content.slice(offset - text.length, offset), slot: text.slot };
212
+ }
213
+ const call = callSlot(item);
214
+ return call === undefined ? { item } : { call: calls[call] };
215
+ });
216
+ }
217
+ /**
218
+ * A UTF-8 byte offset into `text` as a JS string index, or undefined when it
219
+ * falls inside a character or past the end. Gemini counts its grounding
220
+ * segments in bytes; a JS string counts UTF-16 units, so the two part at the
221
+ * first character outside ASCII.
222
+ *
223
+ * Ported from PydanticAI (MIT, Pydantic Services Inc.), models/google.py:2347-2405.
224
+ */
225
+ export function utf8Index(text, bytes) {
226
+ if (!Number.isInteger(bytes) || bytes < 0)
227
+ return undefined;
228
+ let seen = 0;
229
+ let index = 0;
230
+ for (const char of text) {
231
+ if (seen >= bytes)
232
+ break;
233
+ seen += utf8Length(char.codePointAt(0) ?? 0);
234
+ index += char.length;
235
+ }
236
+ return seen === bytes ? index : undefined;
237
+ }
238
+ /** How many bytes UTF-8 spends on one code point. */
239
+ function utf8Length(point) {
240
+ if (point < 0x80)
241
+ return 1;
242
+ if (point < 0x800)
243
+ return 2;
244
+ if (point < 0x10000)
245
+ return 3;
246
+ return 4;
247
+ }
248
+ /** A code point offset into `text` as a JS string index, or undefined past the
249
+ * end. OpenAI's annotation offsets count code points, which differ from JS
250
+ * indices at the first emoji or other character outside the BMP. */
251
+ export function codePointIndex(text, points) {
252
+ if (!Number.isInteger(points) || points < 0)
253
+ return undefined;
254
+ let seen = 0;
255
+ let index = 0;
256
+ for (const char of text) {
257
+ if (seen === points)
258
+ return index;
259
+ seen += 1;
260
+ index += char.length;
261
+ }
262
+ return seen === points ? index : undefined;
263
+ }
264
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/hosted/shared.ts"],"names":[],"mappings":"AAyBA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,QAAgB,EAChB,IAAY,EACZ,IAAoB,EACpB,GAAW;IAEX,OAAO,IAAI,aAAa,CACtB,QAAQ,EACR,SAAS,EACT,GAAG,QAAQ,SAAS,IAAI,uBAAuB,IAAI,KAAK,GAAG,EAAE,CAC9D,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GACV,qKAAqK,CAAC;AAExK;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAgB,EAChB,IAAgB,EAChB,IAAuD;IAEvD,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC;IACrC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,I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c;IACzD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9D,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;QACxB,IAAI,IAAI,KAAK,MAAM;YAAE,OAAO,KAAK,CAAC;QAClC,IAAI,IAAI,CAAC,CAAC;QACV,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IACD,OAAO,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,191 @@
1
+ import type { ImagePart } from "../types.ts";
2
+ /** Every hosted tool type, least to most invasive. The union derives from the
3
+ * array, so a runtime check and the type can never drift apart. */
4
+ export declare const HOSTED_TOOL_TYPES: readonly ["web_search", "web_fetch", "code_execution", "file_search", "image_generation"];
5
+ export type HostedToolType = (typeof HOSTED_TOOL_TYPES)[number];
6
+ /** Roughly where the person asking is, so a search can rank local results. */
7
+ export interface UserLocation {
8
+ city?: string;
9
+ region?: string;
10
+ /** Two-letter ISO country code, such as `US`. */
11
+ country?: string;
12
+ /** IANA time zone, such as `America/New_York`. */
13
+ timezone?: string;
14
+ }
15
+ /**
16
+ * A tool the model vendor runs inside its own turn.
17
+ *
18
+ * Which wire runs which type, and which fields each applies, is in the hosted
19
+ * tools guide. A type the endpoint doesn't run, or a field the wire can't
20
+ * apply, is refused with an `invalid` error before any request goes out. Set
21
+ * `optional` to drop the tool there instead.
22
+ */
23
+ export type HostedTool = {
24
+ /**
25
+ * Drop this tool, rather than refuse the request, where the endpoint can't
26
+ * run it or can't apply one of its fields. The whole tool goes, never one
27
+ * field: sending it without a domain filter or a use cap would widen what the
28
+ * vendor does, and leaving it out only narrows it.
29
+ */
30
+ optional?: boolean;
31
+ } & ({
32
+ type: "web_search";
33
+ allowedDomains?: readonly string[];
34
+ blockedDomains?: readonly string[];
35
+ /** At most this many searches in one turn. */
36
+ maxUses?: number;
37
+ userLocation?: UserLocation;
38
+ } | {
39
+ type: "web_fetch";
40
+ allowedDomains?: readonly string[];
41
+ blockedDomains?: readonly string[];
42
+ /** At most this many fetches in one turn. */
43
+ maxUses?: number;
44
+ /** Cut each fetched page to about this many tokens. */
45
+ maxContentTokens?: number;
46
+ } | {
47
+ type: "code_execution";
48
+ /** Files the code may read, by the vendor's file id. */
49
+ fileIds?: readonly string[];
50
+ } | {
51
+ type: "file_search";
52
+ /** The vendor's vector stores (Responses) or file search stores (Gemini). */
53
+ storeIds: readonly string[];
54
+ maxResults?: number;
55
+ } | {
56
+ type: "image_generation";
57
+ size?: "auto" | "1024x1024" | "1024x1536" | "1536x1024";
58
+ quality?: "auto" | "low" | "medium" | "high";
59
+ format?: "png" | "jpeg" | "webp";
60
+ background?: "auto" | "opaque" | "transparent";
61
+ });
62
+ /** What a hosted call read: a web page, or a file in a store or a container. */
63
+ export interface Source {
64
+ type: "url" | "file";
65
+ url?: string;
66
+ title?: string;
67
+ fileId?: string;
68
+ containerId?: string;
69
+ /** The passage the vendor quoted from it, when it quoted one. */
70
+ excerpt?: string;
71
+ }
72
+ /**
73
+ * A source tied to the answer.
74
+ *
75
+ * `start` and `end` are JS string indices into the turn's `content`, converted
76
+ * from whatever the vendor counts in (UTF-8 bytes on Gemini, code points on
77
+ * OpenAI) and checked against the text. A span that doesn't check out is left
78
+ * off, never guessed: the citation still names its source. `start` equal to
79
+ * `end` is a point.
80
+ *
81
+ * `anchor` says what the span covers. `claim` is text the source backs:
82
+ * Anthropic cites whole text blocks, Gemini sentences. `marker` is a link the
83
+ * model wrote into the answer, which is what OpenAI's offsets select.
84
+ */
85
+ export interface Citation {
86
+ source: Source;
87
+ start?: number;
88
+ end?: number;
89
+ anchor?: "claim" | "marker";
90
+ }
91
+ /** What a hosted call was asked to do, in the fields its type uses. */
92
+ export interface HostedInput {
93
+ /** A search's query, when it ran one. */
94
+ query?: string;
95
+ /** A search's queries, when it ran several. */
96
+ queries?: string[];
97
+ /** The page a fetch read. */
98
+ url?: string;
99
+ /** The code a run executed. */
100
+ code?: string;
101
+ language?: string;
102
+ /** The file a code run's editor touched. */
103
+ path?: string;
104
+ /** What an image generation drew, in the vendor's words. */
105
+ prompt?: string;
106
+ }
107
+ /** A file a hosted call made. Downloading it needs the vendor's own files or
108
+ * containers API, which this package does not wrap, and containers expire. */
109
+ export interface HostedFile {
110
+ id?: string;
111
+ url?: string;
112
+ name?: string;
113
+ containerId?: string;
114
+ }
115
+ export interface HostedOutput {
116
+ sources?: Source[];
117
+ stdout?: string;
118
+ stderr?: string;
119
+ exitCode?: number;
120
+ /** Images the call made, as base64. A generated image is an answer. */
121
+ images?: ImagePart[];
122
+ files?: HostedFile[];
123
+ /** Gemini's search suggestions, as the HTML Google sends for them. */
124
+ searchSuggestions?: string;
125
+ }
126
+ /**
127
+ * One hosted run, assembled. Display data, with the sensitivity of `content`:
128
+ * an excerpt can quote the caller's own documents.
129
+ *
130
+ * A failed call is data (`status: "failed"`, `error` the vendor's code, such as
131
+ * `max_uses_exceeded`) and the turn goes on, as a failing function tool's does
132
+ * (invariant 7). A call the vendor never finished fails with `no_result`.
133
+ */
134
+ export interface HostedCall {
135
+ id: string;
136
+ type: HostedToolType;
137
+ status: "running" | "completed" | "failed";
138
+ input?: HostedInput;
139
+ output?: HostedOutput;
140
+ error?: string;
141
+ /** Where in `content` the call ran: the text's length when it started. */
142
+ at: number;
143
+ }
144
+ /**
145
+ * A fragment of a hosted call, assembled by `index` (`collectTurn` does it).
146
+ * Each field takes the last value stated, `codeDelta` appends to `input.code`,
147
+ * and `output` is always stated whole.
148
+ */
149
+ export interface HostedCallDelta {
150
+ index: number;
151
+ id?: string;
152
+ type?: HostedToolType;
153
+ status?: HostedCall["status"];
154
+ input?: HostedInput;
155
+ codeDelta?: string;
156
+ output?: HostedOutput;
157
+ error?: string;
158
+ at?: number;
159
+ }
160
+ /**
161
+ * The vendor's own record of a hosted turn, in the order it sent it: search
162
+ * results, fetched pages, code output. Opaque, provider-owned, and replayed
163
+ * only to the provider that made it, like `reasoningItems`. Never echo it to a
164
+ * browser, and drop it from history a browser hands back.
165
+ *
166
+ * Answer text is stored as `{ length }` and function calls as `{ call: i }`,
167
+ * so replay cuts the text from `content` and pairs the calls that
168
+ * `repairHistory` may have renamed. When the lengths no longer sum to
169
+ * `content.length`, or the calls no longer match, the message goes back as
170
+ * plain text instead.
171
+ */
172
+ export interface HostedItems {
173
+ provider: string;
174
+ items: unknown[];
175
+ /** The code execution container the turn ran in, which the next request in
176
+ * the same turn has to name. */
177
+ container?: string;
178
+ }
179
+ /** What one adapter, at one endpoint, can send. */
180
+ export interface HostedWire {
181
+ /** The adapter's name in a refusal: `Anthropic`, `Responses`, `Gemini`, `OpenAI chat`. */
182
+ name: string;
183
+ /** The types this endpoint runs. */
184
+ serves: readonly HostedToolType[];
185
+ /** The fields this wire applies, for each type it sends. Any other field set
186
+ * on a tool is one the wire would silently leave out. */
187
+ fields: Partial<Record<HostedToolType, readonly string[]>>;
188
+ /** This wire's own reason to refuse a tool, beyond the two above. */
189
+ refuse?: (tool: HostedTool) => string | undefined;
190
+ }
191
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/hosted/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;oEACoE;AACpE,eAAO,MAAM,iBAAiB,YAC5B,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,kBAAkB,CACV,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,8EAA8E;AAC9E,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;I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D;IAC1D,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;IAC3D,qEAAqE;IACrE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,MAAM,GAAG,SAAS,CAAC;CACnD"}
@@ -0,0 +1,10 @@
1
+ /** Every hosted tool type, least to most invasive. The union derives from the
2
+ * array, so a runtime check and the type can never drift apart. */
3
+ export const HOSTED_TOOL_TYPES = [
4
+ "web_search",
5
+ "web_fetch",
6
+ "code_execution",
7
+ "file_search",
8
+ "image_generation",
9
+ ];
10
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/hosted/types.ts"],"names":[],"mappings":"AAEA;oEACoE;AACpE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,YAAY;IACZ,WAAW;IACX,gBAAgB;IAChB,aAAa;IACb,kBAAkB;CACV,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { anthropicMessages, type AnthropicConfig } from "./providers/anthropic.ts";
2
+ import { geminiContents, type GeminiConfig } from "./providers/gemini.ts";
3
+ import { type OpenAIConfig } from "./providers/openai.ts";
4
+ import { type ResponsesConfig } from "./providers/responses.ts";
5
+ import { type PresetProviderConfig, type PresetAdapterConfig } from "./providers/factory.ts";
6
+ import { type ProviderFallbackConfig } from "./fallback.ts";
7
+ import type { ProviderPresetId } from "./presets.ts";
8
+ import type { ChatMessage, Provider } from "./types.ts";
9
+ import { type Registry, type RegistryOptions } from "./registry.ts";
10
+ export * from "./hosted/types.ts";
11
+ export { hostedRefused, planHostedTools } from "./hosted/shared.ts";
12
+ export type { AnthropicConfig, GeminiConfig, OpenAIConfig, ResponsesConfig, PresetProviderConfig, PresetAdapterConfig, };
13
+ /** An Anthropic provider with hosted tools and paused-turn continuation. */
14
+ export declare function createAnthropicProvider(config: AnthropicConfig): Provider;
15
+ /** A Gemini provider with built-in tools, grounding and replay. */
16
+ export declare function createGeminiProvider(config: GeminiConfig): Provider;
17
+ /** A Chat Completions provider with hosted search and citations. */
18
+ export declare function createOpenAIProvider(config: OpenAIConfig): Provider;
19
+ /** A Responses provider with hosted tools and generated images. */
20
+ export declare function createResponsesProvider(config: ResponsesConfig): Provider;
21
+ /** A preset provider whose model chain and preset fallbacks also opt in. */
22
+ export declare function createPresetProvider(id: ProviderPresetId, config: PresetProviderConfig): Provider;
23
+ /** One bare preset adapter with hosted tools, without a pool or watchdog. */
24
+ export declare function presetAdapter(id: ProviderPresetId, config: PresetAdapterConfig): Provider;
25
+ /** Opt preset fallback specs in. Hand-built providers keep their own setup. */
26
+ export declare function withConfiguredFallbacks(primary: Provider, config?: ProviderFallbackConfig): Provider;
27
+ /** A registry whose connections, key rotation and token refresh keep the opt-in. */
28
+ export declare function createRegistry(options: RegistryOptions): Registry;
29
+ /** Convert history with Anthropic's hosted replay records. */
30
+ export declare function toAnthropicMessages(messages: readonly ChatMessage[], provider?: string): ReturnType<typeof anthropicMessages>;
31
+ /** Convert history with Gemini's hosted replay records. */
32
+ export declare function toGeminiContents(messages: readonly ChatMessage[], provider?: string): ReturnType<typeof geminiContents>;
33
+ //# sourceMappingURL=hosted.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted.d.ts","sourceRoot":"","sources":["../src/hosted.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,iBAAiB,EAEjB,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAkB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAuB,KAAK,sBAAsB,EAA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SAAc,GACrB,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAEtC;AAED,2DAA2D;AAC3D,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,SAAS,WAAW,EAAE,EAChC,QAAQ,CAAC,EAAE,MAAM,GAChB,UAAU,CAAC,OAAO,cAAc,CAAC,CAEnC"}
package/dist/hosted.js ADDED
@@ -0,0 +1,61 @@
1
+ // Explicit opt-in: plain chat imports no hosted encoder or parser.
2
+ import { anthropicHosted } from "./hosted/anthropic.js";
3
+ import { geminiHosted } from "./hosted/gemini.js";
4
+ import { openaiHosted } from "./hosted/openai.js";
5
+ import { responsesHosted } from "./hosted/responses.js";
6
+ import { anthropicMessages, anthropicProvider, } from "./providers/anthropic.js";
7
+ import { geminiContents, geminiProvider } from "./providers/gemini.js";
8
+ import { openaiProvider } from "./providers/openai.js";
9
+ import { responsesProvider } from "./providers/responses.js";
10
+ import { presetProvider, buildPresetAdapter, } from "./providers/factory.js";
11
+ import { configuredFallbacks } from "./fallback.js";
12
+ import { providerRegistry } from "./registry.js";
13
+ export * from "./hosted/types.js";
14
+ export { hostedRefused, planHostedTools } from "./hosted/shared.js";
15
+ const codecs = {
16
+ anthropic: anthropicHosted,
17
+ gemini: geminiHosted,
18
+ openai: openaiHosted,
19
+ responses: responsesHosted,
20
+ };
21
+ /** An Anthropic provider with hosted tools and paused-turn continuation. */
22
+ export function createAnthropicProvider(config) {
23
+ return anthropicProvider(config, codecs);
24
+ }
25
+ /** A Gemini provider with built-in tools, grounding and replay. */
26
+ export function createGeminiProvider(config) {
27
+ return geminiProvider(config, codecs);
28
+ }
29
+ /** A Chat Completions provider with hosted search and citations. */
30
+ export function createOpenAIProvider(config) {
31
+ return openaiProvider(config, codecs);
32
+ }
33
+ /** A Responses provider with hosted tools and generated images. */
34
+ export function createResponsesProvider(config) {
35
+ return responsesProvider(config, codecs);
36
+ }
37
+ /** A preset provider whose model chain and preset fallbacks also opt in. */
38
+ export function createPresetProvider(id, config) {
39
+ return presetProvider(id, config, codecs);
40
+ }
41
+ /** One bare preset adapter with hosted tools, without a pool or watchdog. */
42
+ export function presetAdapter(id, config) {
43
+ return buildPresetAdapter(id, config, codecs);
44
+ }
45
+ /** Opt preset fallback specs in. Hand-built providers keep their own setup. */
46
+ export function withConfiguredFallbacks(primary, config) {
47
+ return configuredFallbacks(primary, config, codecs);
48
+ }
49
+ /** A registry whose connections, key rotation and token refresh keep the opt-in. */
50
+ export function createRegistry(options) {
51
+ return providerRegistry(options, codecs);
52
+ }
53
+ /** Convert history with Anthropic's hosted replay records. */
54
+ export function toAnthropicMessages(messages, provider = "anthropic") {
55
+ return anthropicMessages(messages, provider, codecs.anthropic.replay);
56
+ }
57
+ /** Convert history with Gemini's hosted replay records. */
58
+ export function toGeminiContents(messages, provider) {
59
+ return geminiContents(messages, provider, codecs.gemini.replay);
60
+ }
61
+ //# sourceMappingURL=hosted.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted.js","sourceRoot":"","sources":["../src/hosted.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAElB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAqB,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAqB,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAwB,MAAM,0BAA0B,CAAC;AACnF,OAAO,EACL,cAAc,EACd,kBAAkB,GAGnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAA+B,MAAM,eAAe,CAAC;AAIjF,OAAO,EAAE,gBA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,OAAwB;IACrD,OAAO,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC3C,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,mBAAmB,CACjC,QAAgC,EAChC,QAAQ,GAAG,WAAW;IAEtB,OAAO,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AACxE,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,gBAAgB,CAC9B,QAAgC,EAChC,QAAiB;IAEjB,OAAO,cAAc,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAClE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  export * from "./types.ts";
2
+ export * from "./hosted/types.ts";
2
3
  export * from "./turn.ts";
3
4
  export * from "./errors.ts";
4
5
  export * from "./retry.ts";
5
- export * from "./fallback.ts";
6
+ export { DEFAULT_FALLBACK_COOLDOWNS, FallbackPool, NoAvailableProviderError, withConfiguredFallbacks, withFallbackProviders, type FallbackOptions, type FallbackSpec, type FallbackCandidate, type ProviderFallbackConfig, type Cooldown, type CooldownStore, type FallbackProvider, } from "./fallback.ts";
6
7
  export * from "./key-pool.ts";
7
8
  export * from "./watchdog.ts";
8
9
  export * from "./gate.ts";
@@ -17,11 +18,11 @@ export * from "./image.ts";
17
18
  export * from "./capability.ts";
18
19
  export * from "./attribution.ts";
19
20
  export * from "./presets.ts";
20
- export * from "./providers/anthropic.ts";
21
- export * from "./providers/openai.ts";
22
- export * from "./providers/responses.ts";
23
- export * from "./providers/gemini.ts";
21
+ export { createAnthropicProvider, toAnthropicMessages, type AnthropicConfig, } from "./providers/anthropic.ts";
22
+ export { createOpenAIProvider, toOpenAIMessages, effortParams, openRouterCostUsd, openRouterHostFor, type OpenAIConfig, type EffortDialect, } from "./providers/openai.ts";
23
+ export { createResponsesProvider, toResponsesInput, type ResponsesConfig, } from "./providers/responses.ts";
24
+ export { createGeminiProvider, toGeminiContents, antigravityUserAgent, antigravitySessionId, resolveAntigravityWireModel, type GeminiConfig, type GeminiContent, } from "./providers/gemini.ts";
24
25
  export * from "./providers/zai.ts";
25
- export * from "./providers/factory.ts";
26
- export * from "./registry.ts";
26
+ export { createPresetProvider, presetAdapter, OPENCODE_CLI_USER_AGENT, OPENCODE_PUBLIC_API_KEY, isZenFreeModel, forgeOpenCodeSessionId, type PresetProviderConfig, type PresetAdapterConfig, } from "./providers/factory.ts";
27
+ export { createRegistry, type ConnectionCredential, type ConnectionConfig, type RegistryCooldownInfo, type RegistryOptions, type ViewOptions, type CandidateStatus, type ConnectionStatus, type Registry, } from "./registry.ts";
27
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAG3B,OAAO,EACL,MAAM,EACN,OAAO,EACP,mBAAmB,EACnB,UAAU,EACV,cAAc,EACd,QAAQ,EACR,qBAAqB,EACrB,SAAS,EACT,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,QAAQ,GACd,MAAM,gBAAgB,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC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