agents 0.28.0 → 0.29.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 (121) hide show
  1. package/dist/{agent-routing-QDcchcQP.d.ts → agent-routing-CDbpVjYq.d.ts} +18 -8
  2. package/dist/agent-routing.d.ts +1 -1
  3. package/dist/agent-tool-types.d.ts +1 -1
  4. package/dist/{agent-tools-DHL2XI7u.d.ts → agent-tools-C8DH8Yii.d.ts} +2 -2
  5. package/dist/agent-tools.d.ts +1 -1
  6. package/dist/{ai-ahruGw7e.d.ts → ai-iXw0uOGj.d.ts} +3 -3
  7. package/dist/{ai-sdk-Bdsf6mSA.js → ai-sdk-DRPh2rRa.js} +218 -132
  8. package/dist/ai-sdk-DRPh2rRa.js.map +1 -0
  9. package/dist/browser/ai.d.ts +1 -1
  10. package/dist/browser/ai.js +2 -2
  11. package/dist/browser/index.d.ts +8 -8
  12. package/dist/browser/index.js +3 -3
  13. package/dist/browser/tools/ai-sdk.d.ts +2 -2
  14. package/dist/browser/tools/ai-sdk.js +1 -1
  15. package/dist/browser/tools/pi.d.ts +1 -1
  16. package/dist/browser/tools/pi.js +3 -3
  17. package/dist/browser/tools/pi.js.map +1 -1
  18. package/dist/browser/tools/tanstack-ai.d.ts +2 -2
  19. package/dist/browser/tools/tanstack-ai.js +1 -1
  20. package/dist/{browser-CEdNlsaD.js → browser-DccPw_wW.js} +130 -79
  21. package/dist/browser-DccPw_wW.js.map +1 -0
  22. package/dist/{browser-D30VlpcA.d.ts → browser-DlXhSAdf.d.ts} +41 -37
  23. package/dist/{browser-tool-4iomavs_.js → browser-tool-B1mhifin.js} +3 -3
  24. package/dist/{browser-tool-4iomavs_.js.map → browser-tool-B1mhifin.js.map} +1 -1
  25. package/dist/{browser-tool-vtrPOV8e.d.ts → browser-tool-Cxjk5sgG.d.ts} +2 -2
  26. package/dist/chat/index.d.ts +143 -71
  27. package/dist/chat/index.js +269 -110
  28. package/dist/chat/index.js.map +1 -1
  29. package/dist/chat-sdk/index.d.ts +1 -1
  30. package/dist/chat-sdk/index.js +1 -1
  31. package/dist/cli.js +33 -33
  32. package/dist/{client-BGIQKJhX.d.ts → client-C27CtRZr.d.ts} +2 -2
  33. package/dist/client.d.ts +1 -1
  34. package/dist/{connector-DEXzVoaY.d.ts → connector-20DJ6p4k.d.ts} +2 -2
  35. package/dist/{connector-CtZylXdk.js → connector-DAXBOIIi.js} +2 -2
  36. package/dist/{connector-CtZylXdk.js.map → connector-DAXBOIIi.js.map} +1 -1
  37. package/dist/experimental/channels/web/index.js +1 -1
  38. package/dist/{handler-stateless-VvrWSAVA.js → handler-stateless-Bly_nSH3.js} +12 -3
  39. package/dist/handler-stateless-Bly_nSH3.js.map +1 -0
  40. package/dist/harness/container/index.js +1 -1
  41. package/dist/harness/container/index.js.map +1 -1
  42. package/dist/harness/opencode/index.d.ts +182 -6
  43. package/dist/harness/opencode/index.js +354 -23
  44. package/dist/harness/opencode/index.js.map +1 -1
  45. package/dist/harness/pi/index.d.ts +13 -5
  46. package/dist/harness/pi/index.js +8 -214
  47. package/dist/harness/pi/index.js.map +1 -1
  48. package/dist/{images-Ce9SCu3X.js → images-xaDv2Fqe.js} +662 -152
  49. package/dist/images-xaDv2Fqe.js.map +1 -0
  50. package/dist/index-DCxk3OSJ.d.ts +378 -0
  51. package/dist/{index-kbSUIer3.d.ts → index-iv9FTXX9.d.ts} +80 -112
  52. package/dist/index.d.ts +1 -1
  53. package/dist/index.js +1 -1
  54. package/dist/{input-schema-D2QAtHZH.js → input-schema-B0Etuo-o.js} +2 -2
  55. package/dist/{input-schema-D2QAtHZH.js.map → input-schema-B0Etuo-o.js.map} +1 -1
  56. package/dist/lifecycle/index.js +1 -1
  57. package/dist/{lifecycle-DGorpAmA.js → lifecycle-ClT4DmF2.js} +11 -3
  58. package/dist/lifecycle-ClT4DmF2.js.map +1 -0
  59. package/dist/mcp/client/index.d.ts +1 -1
  60. package/dist/mcp/index.d.ts +1 -1
  61. package/dist/mcp/index.js +17 -3
  62. package/dist/mcp/index.js.map +1 -1
  63. package/dist/mcp/server/index.js +1 -1
  64. package/dist/models/ai-sdk/index.d.ts +31 -326
  65. package/dist/models/ai-sdk/index.js +1 -1
  66. package/dist/models/opencode/index.d.ts +25 -13
  67. package/dist/models/opencode/index.js +16 -11
  68. package/dist/models/opencode/index.js.map +1 -1
  69. package/dist/models/pi-ai/index.d.ts +17 -13
  70. package/dist/models/pi-ai/index.js +89 -36
  71. package/dist/models/pi-ai/index.js.map +1 -1
  72. package/dist/react.d.ts +2 -2
  73. package/dist/routing/index.d.ts +1 -1
  74. package/dist/serializable.d.ts +1 -1
  75. package/dist/{session-store-DoPY12xM.d.ts → session-store-_IK6dV-w.d.ts} +14 -2
  76. package/dist/{session-store-Do4xkDcf.js → session-store-yvwq1f9x.js} +55 -2
  77. package/dist/session-store-yvwq1f9x.js.map +1 -0
  78. package/dist/{settings-C45hDliX.js → settings-Dk2il2Hf.js} +10 -4
  79. package/dist/settings-Dk2il2Hf.js.map +1 -0
  80. package/dist/skills/index.d.ts +22 -28
  81. package/dist/skills/index.js +183 -143
  82. package/dist/skills/index.js.map +1 -1
  83. package/dist/{src-CQxJFv4l.js → src-6lr7MtM_.js} +3 -3
  84. package/dist/src-6lr7MtM_.js.map +1 -0
  85. package/dist/sub-routing.d.ts +1 -1
  86. package/dist/{tool-cQRkwSZZ.js → tool-DkT_DJBm.js} +2 -2
  87. package/dist/tool-DkT_DJBm.js.map +1 -0
  88. package/dist/transport-CPh7YGiw.d.ts +623 -0
  89. package/dist/voice/index.d.ts +1 -1
  90. package/dist/web/fetch/tools/pi.js +2 -2
  91. package/dist/web/fetch/tools/pi.js.map +1 -1
  92. package/dist/web/search/index.js +1 -1
  93. package/dist/web/search/tools/ai-sdk.js +2 -2
  94. package/dist/web/search/tools/pi.js +3 -3
  95. package/dist/web/search/tools/pi.js.map +1 -1
  96. package/dist/web/search/tools/tanstack-ai.js +2 -2
  97. package/dist/websockets/index.js +1 -1
  98. package/dist/{websockets-C3zy8YR0.js → websockets-CqxnntmE.js} +2 -2
  99. package/dist/{websockets-C3zy8YR0.js.map → websockets-CqxnntmE.js.map} +1 -1
  100. package/dist/workflow-types.d.ts +1 -1
  101. package/dist/workflows.d.ts +1 -1
  102. package/dist/workflows.js +1 -1
  103. package/docs/browse-the-web.md +1 -1
  104. package/docs/chat-agents.md +19 -18
  105. package/docs/harnesses/pi.md +47 -18
  106. package/docs/mcp-client.md +1 -1
  107. package/docs/mcp-servers.md +1 -1
  108. package/docs/models-pi-ai.md +70 -17
  109. package/docs/models.md +219 -152
  110. package/package.json +14 -14
  111. package/dist/ai-sdk-Bdsf6mSA.js.map +0 -1
  112. package/dist/browser-CEdNlsaD.js.map +0 -1
  113. package/dist/handler-stateless-VvrWSAVA.js.map +0 -1
  114. package/dist/images-Ce9SCu3X.js.map +0 -1
  115. package/dist/lifecycle-DGorpAmA.js.map +0 -1
  116. package/dist/session-store-Do4xkDcf.js.map +0 -1
  117. package/dist/settings-C45hDliX.js.map +0 -1
  118. package/dist/settings-NgGwF7Qt.d.ts +0 -331
  119. package/dist/src-CQxJFv4l.js.map +0 -1
  120. package/dist/tool-cQRkwSZZ.js.map +0 -1
  121. package/dist/transport-k2mFrtL8.d.ts +0 -200
@@ -0,0 +1,378 @@
1
+ import {
2
+ _ as DynamicRouteId,
3
+ a as CloudflareAIError$1,
4
+ b as WorkersAIModelId,
5
+ d as CatalogModelId,
6
+ f as CloudflareEmbeddingModelId,
7
+ g as CloudflareTranscriptionModelId,
8
+ h as CloudflareSpeechModelId,
9
+ i as CloudflareAIAttempt,
10
+ l as ModelOptions$1,
11
+ m as CloudflareRerankingModelId,
12
+ o as CloudflareAIErrorCode,
13
+ p as CloudflareImageModelId,
14
+ s as AISettings,
15
+ t as Transport$1,
16
+ u as ProviderGatewaySettings
17
+ } from "./transport-CPh7YGiw.js";
18
+ import {
19
+ APICallError,
20
+ EmbeddingModelV4,
21
+ ImageModelV4,
22
+ LanguageModelV4,
23
+ LanguageModelV4CallOptions,
24
+ LanguageModelV4GenerateResult,
25
+ LanguageModelV4StreamResult,
26
+ RerankingModelV4,
27
+ SpeechModelV4,
28
+ TranscriptionModelV4
29
+ } from "@ai-sdk/provider";
30
+
31
+ //#region src/models/ai-sdk/settings.d.ts
32
+ /**
33
+ * A language model id: a Workers AI id, an AI Gateway catalog id
34
+ * (`<author>/<model>`), or a dynamic route (`dynamic/<route>`). All three run
35
+ * on `env.AI.run`.
36
+ *
37
+ * @experimental This surface is experimental and may change.
38
+ */
39
+ type CloudflareLanguageModelId =
40
+ | WorkersAIModelId
41
+ | DynamicRouteId
42
+ | (CatalogModelId & {});
43
+ /**
44
+ * One leg of a fallback chain: a language model id, or any AI SDK language
45
+ * model — which is routed through AI Gateway like `ai(model)`.
46
+ *
47
+ * @experimental This surface is experimental and may change.
48
+ */
49
+ type FallbackLeg = CloudflareLanguageModelId | LanguageModelV4;
50
+ /**
51
+ * Per-model and per-call options: the framework-neutral options, with the
52
+ * fallback leg type this module accepts.
53
+ *
54
+ * @experimental This surface is experimental and may change.
55
+ */
56
+ type ModelOptions = ModelOptions$1<FallbackLeg>;
57
+ /**
58
+ * Which key authenticates a vendor model object routed through AI Gateway.
59
+ *
60
+ * @experimental This surface is experimental and may change.
61
+ */
62
+ interface VendorKeyOptions {
63
+ /**
64
+ * `"gateway"` (the default) strips the key the vendor's provider put on the
65
+ * request, so the gateway supplies one: Unified Billing, or a BYOK key
66
+ * stored on the gateway. `"request"` forwards that key to the vendor, for a
67
+ * key you hold yourself, e.g. `createAnthropic({ apiKey: env.ANTHROPIC_KEY })`.
68
+ *
69
+ * It belongs to the model it is set on, so a fallback leg keeps its own.
70
+ */
71
+ vendorKey?: "gateway" | "request";
72
+ }
73
+ /**
74
+ * The options accepted next to a model object — `ai(anthropic("…"), { … })`.
75
+ * {@link ModelOptions} plus {@link VendorKeyOptions.vendorKey}; the
76
+ * Workers-AI-only knobs (`reasoningEffort`, `chatTemplateKwargs`) are ignored
77
+ * with a warning.
78
+ *
79
+ * @experimental This surface is experimental and may change.
80
+ */
81
+ type GatewayModelOptions = ModelOptions & VendorKeyOptions;
82
+ /**
83
+ * The options `ai.routed()` takes: the gateway options, `headers`,
84
+ * `sessionAffinity` and `vendorKey`.
85
+ *
86
+ * A routed embedding, image, speech or transcription model is the vendor's
87
+ * own, and only its transport is ours — there is no chain to fall back through
88
+ * and no Workers AI reasoning knob to apply. They are absent from the type
89
+ * rather than dropped at runtime, so the mistake is a compile error naming the
90
+ * option.
91
+ *
92
+ * @experimental This surface is experimental and may change.
93
+ */
94
+ type RoutedModelOptions = Omit<
95
+ ModelOptions,
96
+ "fallback" | "reasoningEffort" | "chatTemplateKwargs"
97
+ > &
98
+ VendorKeyOptions;
99
+ /**
100
+ * The options the Workers-AI-only methods take — `ai.embedding`, `ai.image`,
101
+ * `ai.speech`, `ai.transcription`, `ai.reranking`.
102
+ *
103
+ * Their fallback legs are ids: those models run through the Workers AI run
104
+ * path, which resolves a leg by id, so a model object would type-check and
105
+ * then be silently dropped.
106
+ *
107
+ * @experimental This surface is experimental and may change.
108
+ */
109
+ type ModalityOptions = ModelOptions$1<WorkersAIModelId>;
110
+ //#endregion
111
+ //#region src/models/ai-sdk/errors.d.ts
112
+ /**
113
+ * Error thrown for every failed Cloudflare AI call, whether it came back as a
114
+ * non-2xx `Response` or as a thrown Workers AI binding error.
115
+ *
116
+ * Extends the AI SDK's `APICallError` so `ai`'s built-in retry loop honours
117
+ * {@link CloudflareAIError.isRetryable} without any extra wiring.
118
+ *
119
+ * @experimental This surface is experimental and may change.
120
+ */
121
+ declare class CloudflareAIError extends APICallError {
122
+ /** HTTP status, when the failure carried one. */
123
+ readonly status: number | undefined;
124
+ /** Coarse classification used for routing and fallback decisions. */
125
+ readonly code: CloudflareAIErrorCode;
126
+ /** `cf-aig-log-id` of the failed request, when the response carried one. */
127
+ readonly logId: string | undefined;
128
+ /** The model id that produced this error. */
129
+ readonly model: string;
130
+ /** Every leg tried, when this error ends a fallback chain. */
131
+ readonly attempts: CloudflareAIAttempt[] | undefined;
132
+ constructor(options: {
133
+ message: string;
134
+ model: string;
135
+ url: string;
136
+ requestBodyValues: unknown;
137
+ status?: number;
138
+ code: CloudflareAIErrorCode;
139
+ logId?: string;
140
+ responseHeaders?: Record<string, string>;
141
+ responseBody?: string;
142
+ isRetryable?: boolean;
143
+ data?: unknown;
144
+ cause?: unknown;
145
+ attempts?: CloudflareAIAttempt[];
146
+ });
147
+ /** Lifts the framework-neutral core error into the AI SDK error type. */
148
+ static fromCore(error: CloudflareAIError$1): CloudflareAIError;
149
+ }
150
+ //#endregion
151
+ //#region src/models/ai-sdk/transport.d.ts
152
+ /**
153
+ * The transport this module uses: the run path for a model id, and the
154
+ * provider-native path for a vendor's own model object, through the binding
155
+ * or over HTTP.
156
+ *
157
+ * @experimental This surface is experimental and may change.
158
+ */
159
+ type Transport = Transport$1;
160
+ //#endregion
161
+ //#region src/models/ai-sdk/models/language.d.ts
162
+ /**
163
+ * Typed observability attached to every result under
164
+ * `providerMetadata.cloudflare`, so consumers never have to walk response
165
+ * objects looking for a gateway log id.
166
+ *
167
+ * @experimental This surface is experimental and may change.
168
+ */
169
+ interface CloudflareMetadata {
170
+ /** The model that actually answered — the fallback leg, when one was used. */
171
+ model: string;
172
+ /** The gateway id the request went through. Absent when none handled it. */
173
+ gateway?: string;
174
+ /**
175
+ * The gateway provider slug, for a vendor's model object sent to the
176
+ * provider-native path. Absent for a model id.
177
+ */
178
+ provider?: string;
179
+ /** `cf-aig-log-id`, or the binding's last log id. */
180
+ logId?: string;
181
+ /** `cf-aig-event-id` — correlates the requests of one gateway event. */
182
+ eventId?: string;
183
+ /** `cf-aig-request-id` — the gateway's id for this request. */
184
+ requestId?: string;
185
+ /** `cf-aig-trace-id` — the trace this request belongs to. */
186
+ traceId?: string;
187
+ /** `cf-aig-run-id`, when the gateway sends one. */
188
+ runId?: string;
189
+ /** `cf-aig-cache-status`, e.g. `HIT` or `MISS`. */
190
+ cacheStatus?: string;
191
+ /** `cf-aig-step` — which step of a gateway route answered. */
192
+ step?: number;
193
+ }
194
+ /** Everything a language model needs from the provider that created it. */
195
+ interface LanguageModelConfig {
196
+ transport: Transport;
197
+ /**
198
+ * The provider-wide gateway defaults, in any of the spellings `createAI`
199
+ * takes: a bare id, a `gateway` object, or the whole settings object with
200
+ * the flat gateway keys on it.
201
+ */
202
+ providerGateway: string | ProviderGatewaySettings | undefined;
203
+ }
204
+ //#endregion
205
+ //#region src/models/ai-sdk/models/gateway.d.ts
206
+ /**
207
+ * A `LanguageModelV4` that is the user's own vendor model, routed through AI
208
+ * Gateway. Generation, parsing, tool handling and error shapes stay the
209
+ * vendor's; only the transport is Cloudflare's.
210
+ *
211
+ * @experimental This surface is experimental and may change.
212
+ */
213
+ declare class GatewayLanguageModel implements LanguageModelV4 {
214
+ #private;
215
+ readonly specificationVersion: "v4";
216
+ constructor(
217
+ model: LanguageModelV4,
218
+ options: GatewayModelOptions | undefined,
219
+ config: LanguageModelConfig
220
+ );
221
+ /** The vendor's own provider name — `anthropic.messages`, `openai.responses`. */
222
+ get provider(): string;
223
+ /** The vendor's own id spelling, which the gateway requires verbatim. */
224
+ get modelId(): string;
225
+ get supportedUrls(): LanguageModelV4["supportedUrls"];
226
+ /** The model this wraps, for callers that need the vendor object back. */
227
+ get model(): LanguageModelV4;
228
+ doGenerate(
229
+ options: LanguageModelV4CallOptions
230
+ ): Promise<LanguageModelV4GenerateResult>;
231
+ doStream(
232
+ options: LanguageModelV4CallOptions
233
+ ): Promise<LanguageModelV4StreamResult>;
234
+ }
235
+ //#endregion
236
+ //#region src/models/ai-sdk/index.d.ts
237
+ /**
238
+ * The provider `createAI` returns. Call it with a model id — a Workers AI id,
239
+ * an AI Gateway catalog id, or a dynamic route — or with a model another
240
+ * provider built.
241
+ *
242
+ * It satisfies `ProviderV4`, so it drops into
243
+ * `createProviderRegistry({ cloudflare: ai })` and into
244
+ * `globalThis.AI_SDK_DEFAULT_PROVIDER`, where the AI SDK resolves a bare
245
+ * `model: "@cf/…"` or `"openai/gpt-5.5"` string through it.
246
+ *
247
+ * @experimental This surface is experimental and may change.
248
+ */
249
+ interface AI {
250
+ /**
251
+ * A language model: `@cf/…` (Workers AI), `<author>/<model>` (the AI
252
+ * Gateway catalog, in its spelling), or `dynamic/<route>`.
253
+ */
254
+ (modelId: CloudflareLanguageModelId, options?: ModelOptions): LanguageModelV4;
255
+ /**
256
+ * Any AI SDK v4 language model, sent to AI Gateway's provider-native path
257
+ * with its own request and parser.
258
+ */
259
+ (model: LanguageModelV4, options?: GatewayModelOptions): LanguageModelV4;
260
+ /** The AI SDK provider specification this implements. */
261
+ readonly specificationVersion: "v4";
262
+ /** Same as calling the provider directly. */
263
+ languageModel(
264
+ modelId: CloudflareLanguageModelId,
265
+ options?: ModelOptions
266
+ ): LanguageModelV4;
267
+ languageModel(
268
+ model: LanguageModelV4,
269
+ options?: GatewayModelOptions
270
+ ): LanguageModelV4;
271
+ /** The `ProviderV4` shape: a registry resolves models by string alone. */
272
+ languageModel(modelId: string, options?: ModelOptions): LanguageModelV4;
273
+ /**
274
+ * Any other v4 model a vendor built — embedding, image, speech,
275
+ * transcription — sent to AI Gateway's provider-native path with its own
276
+ * code intact.
277
+ */
278
+ routed<T extends object>(model: T, options?: RoutedModelOptions): T;
279
+ /** A text-embedding model from the Workers AI catalog. */
280
+ embedding(
281
+ modelId: CloudflareEmbeddingModelId,
282
+ options?: ModalityOptions
283
+ ): EmbeddingModelV4;
284
+ /** Alias of {@link AI.embedding}, the `ProviderV4` method name. */
285
+ embeddingModel(
286
+ modelId: CloudflareEmbeddingModelId,
287
+ options?: ModalityOptions
288
+ ): EmbeddingModelV4;
289
+ /**
290
+ * Alias of {@link AI.embedding}.
291
+ *
292
+ * @deprecated `embeddingModel` is the `ProviderV4` name; this is the older
293
+ * `ProviderV2`/`ProviderV3` spelling, kept for one release.
294
+ */
295
+ textEmbeddingModel(
296
+ modelId: CloudflareEmbeddingModelId,
297
+ options?: ModalityOptions
298
+ ): EmbeddingModelV4;
299
+ /** A text-to-image model from the Workers AI catalog. */
300
+ image(
301
+ modelId: CloudflareImageModelId,
302
+ options?: ModalityOptions
303
+ ): ImageModelV4;
304
+ /** Alias of {@link AI.image}, the `ProviderV4` method name. */
305
+ imageModel(
306
+ modelId: CloudflareImageModelId,
307
+ options?: ModalityOptions
308
+ ): ImageModelV4;
309
+ /** A speech-recognition model from the Workers AI catalog. */
310
+ transcription(
311
+ modelId: CloudflareTranscriptionModelId,
312
+ options?: ModalityOptions
313
+ ): TranscriptionModelV4;
314
+ /** Alias of {@link AI.transcription}, the `ProviderV4` method name. */
315
+ transcriptionModel(
316
+ modelId: CloudflareTranscriptionModelId,
317
+ options?: ModalityOptions
318
+ ): TranscriptionModelV4;
319
+ /** A text-to-speech model from the Workers AI catalog. */
320
+ speech(
321
+ modelId: CloudflareSpeechModelId,
322
+ options?: ModalityOptions
323
+ ): SpeechModelV4;
324
+ /** Alias of {@link AI.speech}, the `ProviderV4` method name. */
325
+ speechModel(
326
+ modelId: CloudflareSpeechModelId,
327
+ options?: ModalityOptions
328
+ ): SpeechModelV4;
329
+ /** A reranking model from the Workers AI catalog. */
330
+ reranking(
331
+ modelId: CloudflareRerankingModelId,
332
+ options?: ModalityOptions
333
+ ): RerankingModelV4;
334
+ /** Alias of {@link AI.reranking}, the `ProviderV4` method name. */
335
+ rerankingModel(
336
+ modelId: CloudflareRerankingModelId,
337
+ options?: ModalityOptions
338
+ ): RerankingModelV4;
339
+ }
340
+ /**
341
+ * Creates a provider over Workers AI and the AI Gateway catalog.
342
+ *
343
+ * A Workers AI id goes to Workers AI and a catalog id or dynamic route to AI
344
+ * Gateway's `/run`, both on `env.AI.run`; a vendor's model object goes to AI
345
+ * Gateway's provider-native path. With `{ accountId, apiToken }` instead of
346
+ * `binding`, the same requests go to the REST API and to
347
+ * `gateway.ai.cloudflare.com`. Gateway
348
+ * options are flat (`id`, `cacheTtl`, …) or nested under `gateway`; per-model
349
+ * options and per-call `providerOptions.cloudflare` override them in that
350
+ * order.
351
+ *
352
+ * ```ts
353
+ * const ai = createAI({ binding: env.AI, id: "prod", cacheTtl: 60 });
354
+ *
355
+ * ai("@cf/zai-org/glm-4.7-flash");
356
+ * ai("anthropic/claude-opus-4.8", { fallback: ["openai/gpt-5.5"] });
357
+ * ai.embedding("@cf/baai/bge-base-en-v1.5");
358
+ * ```
359
+ *
360
+ * @experimental This surface is experimental and may change.
361
+ */
362
+ declare function createAI(settings: AISettings): AI;
363
+ //#endregion
364
+ export {
365
+ CloudflareAIError as a,
366
+ GatewayModelOptions as c,
367
+ RoutedModelOptions as d,
368
+ VendorKeyOptions as f,
369
+ CloudflareMetadata as i,
370
+ ModalityOptions as l,
371
+ createAI as n,
372
+ CloudflareLanguageModelId as o,
373
+ GatewayLanguageModel as r,
374
+ FallbackLeg as s,
375
+ AI as t,
376
+ ModelOptions as u
377
+ };
378
+ //# sourceMappingURL=index-DCxk3OSJ.d.ts.map
@@ -144,22 +144,65 @@ declare function r2(
144
144
  options?: R2SkillSourceOptions
145
145
  ): SkillSource;
146
146
  //#endregion
147
- //#region src/skills/runner.d.ts
147
+ //#region src/skills/workspace.d.ts
148
148
  /**
149
- * Minimal workspace surface the skill runner needs. A concrete `Workspace`
150
- * from `@cloudflare/shell` (or Think's `WorkspaceLike`) satisfies this
151
- * structurally, so the runner does not depend on a filesystem package.
149
+ * The Workspace Agent Skills read and write: a `Workspace` from
150
+ * `@cloudflare/computer`, or anything with the same `fs` methods.
152
151
  */
153
152
  interface SkillWorkspace {
154
- readFile(path: string): Promise<string | null>;
155
- writeFile(path: string, content: string): Promise<void>;
156
- readDir(path: string): Promise<unknown>;
157
- glob(pattern: string): Promise<unknown>;
158
- stat(path: string): Promise<{
159
- type: string;
160
- size?: number;
161
- } | null>;
153
+ readonly fs: {
154
+ stat(path: string): Promise<{
155
+ size: number;
156
+ isDirectory: boolean;
157
+ }>;
158
+ readFile(path: string): Promise<ReadableStream<Uint8Array>>;
159
+ writeFile(path: string, content: Uint8Array): Promise<void>;
160
+ mkdir(
161
+ path: string,
162
+ options?: {
163
+ recursive?: boolean;
164
+ }
165
+ ): Promise<void>;
166
+ readdir(path: string): Promise<
167
+ Array<{
168
+ name: string;
169
+ size: number;
170
+ isDirectory: boolean;
171
+ }>
172
+ >;
173
+ find(
174
+ directory: string,
175
+ pattern?: string
176
+ ): Promise<
177
+ Array<{
178
+ path: string;
179
+ type: "file" | "dir";
180
+ }>
181
+ >;
182
+ };
183
+ }
184
+ /** Options for projecting Agent Skills into a Workspace. */
185
+ interface SkillWorkspaceSeedOptions {
186
+ /** Destination directory. Defaults to `/workspace/.agents/skills`. */
187
+ readonly root?: string;
188
+ /** Existing-file policy. Default `"preserve"` keeps Workspace edits. */
189
+ readonly onConflict?: "preserve" | "replace";
190
+ }
191
+ /** Summary returned after projecting Agent Skills into a Workspace. */
192
+ interface SkillWorkspaceSeedResult {
193
+ /** Files written from source content. */
194
+ readonly written: number;
195
+ /** Existing files preserved without a write. */
196
+ readonly preserved: number;
197
+ /** Files skipped because their source content could not be read or written. */
198
+ readonly skipped: number;
199
+ /** Non-fatal per-file diagnostics. */
200
+ readonly warnings: readonly string[];
201
+ /** Absolute Workspace directory containing the projected skills. */
202
+ readonly root: string;
162
203
  }
204
+ //#endregion
205
+ //#region src/skills/runner.d.ts
163
206
  /**
164
207
  * Options for {@link runner}.
165
208
  *
@@ -190,78 +233,6 @@ declare function runner(
190
233
  options: WorkerSkillScriptRunnerOptions
191
234
  ): SkillScriptRunner;
192
235
  //#endregion
193
- //#region src/skills/workspace.d.ts
194
- /**
195
- * Computer-style Workspace shape used for Agent Skills projection.
196
- * `@cloudflare/computer.Workspace` satisfies this through `workspace.fs`.
197
- */
198
- interface ComputerSkillWorkspace {
199
- readonly fs: {
200
- stat(path: string): Promise<unknown>;
201
- readFile(
202
- path: string,
203
- options?: {
204
- byteOffset?: number;
205
- byteLength?: number;
206
- }
207
- ): Promise<ReadableStream<Uint8Array>>;
208
- readFile(path: string, encoding: "utf8"): Promise<string>;
209
- writeFile(path: string, content: string | Uint8Array): Promise<void>;
210
- mkdir(
211
- path: string,
212
- options?: {
213
- recursive?: boolean;
214
- }
215
- ): Promise<void>;
216
- };
217
- }
218
- /**
219
- * Legacy direct filesystem shape used for Agent Skills projection.
220
- * `@cloudflare/shell.Workspace` and Think `WorkspaceLike` satisfy this shape.
221
- */
222
- interface LegacySkillWorkspace {
223
- stat(path: string): Promise<unknown | null>;
224
- readFile(path: string): Promise<string | null>;
225
- readFileBytes(path: string): Promise<Uint8Array | null>;
226
- writeFile(path: string, content: string): Promise<void>;
227
- writeFileBytes(
228
- path: string,
229
- content: Uint8Array | ArrayBuffer,
230
- mediaType?: string
231
- ): Promise<void>;
232
- mkdir(
233
- path: string,
234
- options?: {
235
- recursive?: boolean;
236
- }
237
- ): Promise<void>;
238
- }
239
- /** Workspace accepted by `SkillRegistry.seedWorkspace()`. */
240
- type SkillProjectionWorkspace = ComputerSkillWorkspace | LegacySkillWorkspace;
241
- /** Options for projecting Agent Skills into a Workspace. */
242
- interface SkillWorkspaceSeedOptions {
243
- /**
244
- * Destination directory. Defaults to `/workspace/.agents/skills` for a
245
- * Computer Workspace and `/.agents/skills` for a legacy Shell Workspace.
246
- */
247
- readonly root?: string;
248
- /** Existing-file policy. Default `"preserve"` keeps Workspace edits. */
249
- readonly onConflict?: "preserve" | "replace";
250
- }
251
- /** Summary returned after projecting Agent Skills into a Workspace. */
252
- interface SkillWorkspaceSeedResult {
253
- /** Files written from source content. */
254
- readonly written: number;
255
- /** Existing files preserved without a write. */
256
- readonly preserved: number;
257
- /** Files skipped because their source content could not be read or written. */
258
- readonly skipped: number;
259
- /** Non-fatal per-file diagnostics. */
260
- readonly warnings: readonly string[];
261
- /** Absolute Workspace directory containing the projected skills. */
262
- readonly root: string;
263
- }
264
- //#endregion
265
236
  //#region src/skills/registry.d.ts
266
237
  declare class SkillRegistry {
267
238
  readonly contextLabel = "think_skills";
@@ -284,12 +255,12 @@ declare class SkillRegistry {
284
255
  load(): Promise<void>;
285
256
  refresh(): Promise<void>;
286
257
  /**
287
- * Seed resolved Agent Skills into Computer or legacy Shell storage.
258
+ * Seed resolved Agent Skills into a Workspace.
288
259
  * Existing files are preserved by default, and become authoritative for
289
260
  * activation, resource reads, and script execution.
290
261
  */
291
262
  seedWorkspace(
292
- workspace: SkillProjectionWorkspace,
263
+ workspace: SkillWorkspace,
293
264
  options?: SkillWorkspaceSeedOptions
294
265
  ): Promise<SkillWorkspaceSeedResult>;
295
266
  /**
@@ -298,7 +269,7 @@ declare class SkillRegistry {
298
269
  * matches the recorded projection fingerprint.
299
270
  */
300
271
  useWorkspace(
301
- workspace: SkillProjectionWorkspace,
272
+ workspace: SkillWorkspace,
302
273
  options?: SkillWorkspaceSeedOptions
303
274
  ): Promise<void>;
304
275
  private writeSeedFile;
@@ -312,32 +283,29 @@ declare class SkillRegistry {
312
283
  }
313
284
  //#endregion
314
285
  export {
315
- SkillScriptRequest as C,
316
- parseSkillMarkdown as D,
317
- parseSkillFrontmatter as E,
318
- SkillScriptContext as S,
319
- SkillSource as T,
320
- SkillManifestResource as _,
286
+ parseSkillFrontmatter as C,
287
+ SkillSource as S,
288
+ SkillResourceDescriptor as _,
321
289
  SkillWorkspaceSeedOptions as a,
322
- SkillResourceDescriptor as b,
323
- WorkerSkillScriptRunnerOptions as c,
324
- r2 as d,
325
- fromManifest as f,
326
- SkillManifestEntry as g,
327
- SkillManifest as h,
328
- SkillProjectionWorkspace as i,
329
- runner as l,
330
- SkillDescriptor as m,
331
- ComputerSkillWorkspace as n,
290
+ SkillScriptRequest as b,
291
+ r2 as c,
292
+ SkillDescriptor as d,
293
+ SkillManifest as f,
294
+ SkillResource as g,
295
+ SkillRegistrySnapshot as h,
296
+ SkillWorkspace as i,
297
+ fromManifest as l,
298
+ SkillManifestResource as m,
299
+ WorkerSkillScriptRunnerOptions as n,
332
300
  SkillWorkspaceSeedResult as o,
333
- SkillContent as p,
334
- LegacySkillWorkspace as r,
335
- SkillWorkspace as s,
301
+ SkillManifestEntry as p,
302
+ runner as r,
303
+ R2SkillSourceOptions as s,
336
304
  SkillRegistry as t,
337
- R2SkillSourceOptions as u,
338
- SkillRegistrySnapshot as v,
339
- SkillScriptRunner as w,
340
- SkillRunContext as x,
341
- SkillResource as y
305
+ SkillContent as u,
306
+ SkillRunContext as v,
307
+ parseSkillMarkdown as w,
308
+ SkillScriptRunner as x,
309
+ SkillScriptContext as y
342
310
  };
343
- //# sourceMappingURL=index-kbSUIer3.d.ts.map
311
+ //# sourceMappingURL=index-iv9FTXX9.d.ts.map
package/dist/index.d.ts CHANGED
@@ -86,7 +86,7 @@ import {
86
86
  xn as DynamicAgentStub,
87
87
  y as FiberStatus,
88
88
  z as AgentToolEventState
89
- } from "./agent-routing-QDcchcQP.js";
89
+ } from "./agent-routing-CDbpVjYq.js";
90
90
  import {
91
91
  a as EmailSendBinding,
92
92
  d as createHeaderBasedEmailResolver,
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import { MessageType } from "./types.js";
7
7
  import { createHeaderBasedEmailResolver } from "./email.js";
8
8
  import { n as withInvocationScope } from "./cloudflare-Dzvc7V2N.js";
9
9
  import { SUB_PREFIX, buildAgentPath, buildAgentUrl, getSubAgentByName, parseSubAgentPath, routeSubAgentRequest } from "./sub-routing.js";
10
- import { a as routeAgentEmail, i as getCurrentAgent, n as DEFAULT_AGENT_STATIC_OPTIONS, r as StreamingResponse, t as Agent } from "./src-CQxJFv4l.js";
10
+ import { a as routeAgentEmail, i as getCurrentAgent, n as DEFAULT_AGENT_STATIC_OPTIONS, r as StreamingResponse, t as Agent } from "./src-6lr7MtM_.js";
11
11
  import { isDurableObjectCodeUpdateReset, isDurableObjectMemoryLimitReset, isDurableObjectStorageReset, isPlatformTransientError } from "./retries.js";
12
12
  import { SqlError } from "./sql-error.js";
13
13
  import { i as normalizeServerId, n as MCP_SERVER_ID_MAX_LENGTH } from "./client-BnYbNT3z.js";
@@ -1,4 +1,4 @@
1
- import { u as MAX_WEB_SEARCH_QUERY_LENGTH } from "./tool-cQRkwSZZ.js";
1
+ import { u as MAX_WEB_SEARCH_QUERY_LENGTH } from "./tool-DkT_DJBm.js";
2
2
  import { z } from "zod";
3
3
  //#region src/web/search/tools/input-schema.ts
4
4
  /**
@@ -20,4 +20,4 @@ function webSearchInputSchema(maxLimit) {
20
20
  //#endregion
21
21
  export { webSearchInputSchema as t };
22
22
 
23
- //# sourceMappingURL=input-schema-D2QAtHZH.js.map
23
+ //# sourceMappingURL=input-schema-B0Etuo-o.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"input-schema-D2QAtHZH.js","names":[],"sources":["../src/web/search/tools/input-schema.ts"],"sourcesContent":["/**\n * The zod input schema shared by the AI SDK and TanStack AI adapters. Kept\n * out of the core so the pi adapter, which uses TypeBox, does not need zod.\n * Internal — not an entry point.\n */\nimport { z } from \"zod\";\nimport {\n MAX_WEB_SEARCH_QUERY_LENGTH,\n type WebSearchToolInput\n} from \"../contract\";\n\n/**\n * The model's input schema. The description tells the model the host's\n * `limit`; a larger value is not rejected (which would cost a validation\n * round trip) but capped by the core.\n */\nexport function webSearchInputSchema(maxLimit: number) {\n return z.object({\n query: z\n .string()\n .min(1)\n .max(MAX_WEB_SEARCH_QUERY_LENGTH)\n .describe(\"What to search for.\"),\n limit: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe(`How many results to return (at most ${maxLimit}).`)\n }) satisfies z.ZodType<WebSearchToolInput>;\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,SAAgB,qBAAqB,UAAkB;CACrD,OAAO,EAAE,OAAO;EACd,OAAO,EACJ,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,IAAI,2BAA2B,CAAC,CAChC,SAAS,qBAAqB;EACjC,OAAO,EACJ,OAAO,CAAC,CACR,IAAI,CAAC,CACL,IAAI,CAAC,CAAC,CACN,SAAS,CAAC,CACV,SAAS,uCAAuC,SAAS,GAAG;CACjE,CAAC;AACH"}
1
+ {"version":3,"file":"input-schema-B0Etuo-o.js","names":[],"sources":["../src/web/search/tools/input-schema.ts"],"sourcesContent":["/**\n * The zod input schema shared by the AI SDK and TanStack AI adapters. Kept\n * out of the core so the pi adapter, which uses TypeBox, does not need zod.\n * Internal — not an entry point.\n */\nimport { z } from \"zod\";\nimport {\n MAX_WEB_SEARCH_QUERY_LENGTH,\n type WebSearchToolInput\n} from \"../contract\";\n\n/**\n * The model's input schema. The description tells the model the host's\n * `limit`; a larger value is not rejected (which would cost a validation\n * round trip) but capped by the core.\n */\nexport function webSearchInputSchema(maxLimit: number) {\n return z.object({\n query: z\n .string()\n .min(1)\n .max(MAX_WEB_SEARCH_QUERY_LENGTH)\n .describe(\"What to search for.\"),\n limit: z\n .number()\n .int()\n .min(1)\n .optional()\n .describe(`How many results to return (at most ${maxLimit}).`)\n }) satisfies z.ZodType<WebSearchToolInput>;\n}\n"],"mappings":";;;;;;;;;;;;;AAgBA,SAAgB,qBAAqB,UAAkB;CACrD,OAAO,EAAE,OAAO;EACd,OAAO,EACJ,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,IAAI,2BAA2B,CAAC,CAChC,SAAS,qBAAqB;EACjC,OAAO,EACJ,OAAO,CAAC,CACR,IAAI,CAAC,CACL,IAAI,CAAC,CAAC,CACN,SAAS,CAAC,CACV,SAAS,uCAAuC,SAAS,GAAG;CACjE,CAAC;AACH"}
@@ -1,4 +1,4 @@
1
1
  import { n as getCurrentAgent } from "../current-agent-DhoDkSnH.js";
2
2
  import { t as LifecycleCapability } from "../capability-DBAKc6UZ.js";
3
- import { t as Lifecycle } from "../lifecycle-DGorpAmA.js";
3
+ import { t as Lifecycle } from "../lifecycle-ClT4DmF2.js";
4
4
  export { Lifecycle, LifecycleCapability, getCurrentAgent };