agents 0.30.0 → 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.
- package/README.md +4 -2
- package/dist/{agent-routing-CDbpVjYq.d.ts → agent-routing-wS1TimZ_.d.ts} +64 -603
- package/dist/agent-routing.d.ts +1 -1
- package/dist/agent-tool-types.d.ts +1 -1
- package/dist/{agent-tools-C8DH8Yii.d.ts → agent-tools-Bamxxb6Y.d.ts} +2 -2
- package/dist/agent-tools.d.ts +1 -1
- package/dist/{ai-iXw0uOGj.d.ts → ai-CDn3Abax.d.ts} +30 -4
- package/dist/{ai-sdk-DRPh2rRa.js → ai-sdk-Kon40i0q.js} +2 -36
- package/dist/ai-sdk-Kon40i0q.js.map +1 -0
- package/dist/ai-sdk-hW3vntnk.d.ts +72 -0
- package/dist/browser/ai.d.ts +1 -1
- package/dist/browser/ai.js +16 -3
- package/dist/browser/ai.js.map +1 -1
- package/dist/browser/index.d.ts +64 -16
- package/dist/browser/index.js +4 -4
- package/dist/browser/tools/ai-sdk.d.ts +7 -70
- package/dist/browser/tools/ai-sdk.js +4 -4
- package/dist/browser/tools/ai-sdk.js.map +1 -1
- package/dist/browser/tools/pi.d.ts +9 -15
- package/dist/browser/tools/pi.js +6 -14
- package/dist/browser/tools/pi.js.map +1 -1
- package/dist/browser/tools/tanstack-ai.d.ts +46 -23
- package/dist/browser/tools/tanstack-ai.js +8 -4
- package/dist/browser/tools/tanstack-ai.js.map +1 -1
- package/dist/{browser-DccPw_wW.js → browser-1eUbPvC2.js} +413 -14
- package/dist/browser-1eUbPvC2.js.map +1 -0
- package/dist/{browser-DlXhSAdf.d.ts → browser-D9RNpJuT.d.ts} +254 -20
- package/dist/browser-tool-BhjCcNVE.d.ts +71 -0
- package/dist/browser-tool-lGnvEBLJ.js +497 -0
- package/dist/browser-tool-lGnvEBLJ.js.map +1 -0
- package/dist/capability-id-B3J8Nok_.js +13 -0
- package/dist/capability-id-B3J8Nok_.js.map +1 -0
- package/dist/chat/index.d.ts +2 -2
- package/dist/chat-sdk/index.d.ts +3 -3
- package/dist/chat-sdk/index.js +1 -1
- package/dist/client-4OlMIJx-.js.map +1 -1
- package/dist/{client-BnYbNT3z.js → client-DMWujQJ1.js} +68 -244
- package/dist/client-DMWujQJ1.js.map +1 -0
- package/dist/{client-C27CtRZr.d.ts → client-wn4-yqGz.d.ts} +9 -7
- package/dist/client.d.ts +1 -1
- package/dist/{connector-DAXBOIIi.js → connector-CM-uuxKM.js} +96 -8
- package/dist/connector-CM-uuxKM.js.map +1 -0
- package/dist/{connector-20DJ6p4k.d.ts → connector-DZ71EjE-.d.ts} +109 -9
- package/dist/experimental/webmcp.js +1 -1
- package/dist/{handler-stateless-Bly_nSH3.js → handler-stateless-B5hU3dxK.js} +35 -2
- package/dist/handler-stateless-B5hU3dxK.js.map +1 -0
- package/dist/{handler-stateless-DxYpJ_XF.d.ts → handler-stateless-C90kD5_R.d.ts} +3 -47
- package/dist/harness/container/index.d.ts +15 -15
- package/dist/harness/opencode/index.js.map +1 -1
- package/dist/harness/pi/index.d.ts +7 -3
- package/dist/harness/pi/index.js +46 -15
- package/dist/harness/pi/index.js.map +1 -1
- package/dist/harness/think/index.d.ts +2 -1
- package/dist/{images-xaDv2Fqe.js → images-CfuRCjwq.js} +1 -5
- package/dist/images-CfuRCjwq.js.map +1 -0
- package/dist/{index-DCxk3OSJ.d.ts → index-8k4qsX1T.d.ts} +2 -28
- package/dist/index.d.ts +14 -14
- package/dist/index.js +2 -2
- package/dist/internal-hosts-Kfp5A392.d.ts +230 -0
- package/dist/internal-kmw70xwR.js.map +1 -1
- package/dist/invoker-BC1SZ3q1.js +26 -0
- package/dist/invoker-BC1SZ3q1.js.map +1 -0
- package/dist/invoker-DoLFPJZV.d.ts +21 -0
- package/dist/mcp/client/index.d.ts +15 -1
- package/dist/mcp/client/index.js +2 -2
- package/dist/mcp/client/x402.d.ts +7 -5
- package/dist/mcp/client/x402.js +34 -1
- package/dist/mcp/client/x402.js.map +1 -1
- package/dist/mcp/index.d.ts +561 -27
- package/dist/mcp/index.js +180 -3
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/server/index.d.ts +1 -1
- package/dist/mcp/server/index.js +1 -1
- package/dist/models/ai-sdk/index.d.ts +2 -2
- package/dist/models/ai-sdk/index.js +1 -1
- package/dist/models/opencode/index.d.ts +2 -2
- package/dist/models/opencode/index.js +1 -1
- package/dist/models/pi-ai/index.d.ts +3 -28
- package/dist/models/pi-ai/index.js +31 -16
- package/dist/models/pi-ai/index.js.map +1 -1
- package/dist/protocol-BEgrJYC5.d.ts +29 -29
- package/dist/react.d.ts +2 -2
- package/dist/routing/index.d.ts +1 -1
- package/dist/serializable.d.ts +1 -1
- package/dist/{session-store-yvwq1f9x.js → session-7CDgVE0z.js} +455 -33
- package/dist/session-7CDgVE0z.js.map +1 -0
- package/dist/{session-store-_IK6dV-w.d.ts → session-store-B7Ca-u1t.d.ts} +8 -1
- package/dist/settings-Dk2il2Hf.js.map +1 -1
- package/dist/{src-DfLzdwlK.js → src-BGolXG_H.js} +18 -2
- package/dist/src-BGolXG_H.js.map +1 -0
- package/dist/sub-routing.d.ts +12 -12
- package/dist/tool-CTp72Jb_.d.ts +10 -10
- package/dist/tool-DoVberpN.d.ts +22 -22
- package/dist/tool-helpers-BodWi4gd.js +256 -0
- package/dist/tool-helpers-BodWi4gd.js.map +1 -0
- package/dist/{transport-CPh7YGiw.d.ts → transport-5moD2pW5.d.ts} +1 -43
- package/dist/types-D2naO3rA.d.ts +49 -0
- package/dist/voice/index.d.ts +1 -1
- package/dist/workflow-types.d.ts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/dist/workflows.js +1 -1
- package/docs/browse-the-web.md +247 -413
- package/docs/get-current-agent.md +4 -7
- package/docs/harnesses/pi.md +28 -28
- package/docs/human-in-the-loop.md +3 -7
- package/docs/index.md +6 -6
- package/docs/mcp-client.md +4 -28
- package/docs/mcp-servers.md +137 -411
- package/docs/mcp-transports.md +30 -289
- package/docs/models-pi-ai.md +9 -11
- package/docs/models.md +1 -8
- package/docs/routing.md +0 -2
- package/docs/securing-mcp-servers.md +120 -304
- package/package.json +8 -3
- package/dist/ai-sdk-DRPh2rRa.js.map +0 -1
- package/dist/browser-DccPw_wW.js.map +0 -1
- package/dist/browser-tool-B1mhifin.js +0 -616
- package/dist/browser-tool-B1mhifin.js.map +0 -1
- package/dist/browser-tool-Cxjk5sgG.d.ts +0 -92
- package/dist/client-BnYbNT3z.js.map +0 -1
- package/dist/connector-DAXBOIIi.js.map +0 -1
- package/dist/handler-stateless-Bly_nSH3.js.map +0 -1
- package/dist/images-xaDv2Fqe.js.map +0 -1
- package/dist/invoker-CG0_p_Wq.d.ts +0 -20
- package/dist/invoker-CHMnoxIA.js +0 -57
- package/dist/invoker-CHMnoxIA.js.map +0 -1
- package/dist/session-store-yvwq1f9x.js.map +0 -1
- package/dist/src-DfLzdwlK.js.map +0 -1
- package/dist/tool-helpers-O5BDVEAY.js +0 -58
- package/dist/tool-helpers-O5BDVEAY.js.map +0 -1
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
o as getMcpAuthContext,
|
|
6
6
|
r as StatelessMcpServerInput,
|
|
7
7
|
t as CreateStatelessMcpHandlerOptions
|
|
8
|
-
} from "../../handler-stateless-
|
|
8
|
+
} from "../../handler-stateless-C90kD5_R.js";
|
|
9
9
|
export {
|
|
10
10
|
type CreateStatelessMcpHandlerOptions as CreateMcpHandlerOptions,
|
|
11
11
|
type CreateStatelessMcpHandlerOptions,
|
package/dist/mcp/server/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as getMcpAuthContext, t as createStatelessMcpHandler } from "../../handler-stateless-
|
|
1
|
+
import { n as getMcpAuthContext, t as createStatelessMcpHandler } from "../../handler-stateless-B5hU3dxK.js";
|
|
2
2
|
export { createStatelessMcpHandler as createMcpHandler, getMcpAuthContext };
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
u as ProviderGatewaySettings,
|
|
15
15
|
v as KnownImageModelId,
|
|
16
16
|
y as KnownSpeechModelId
|
|
17
|
-
} from "../../transport-
|
|
17
|
+
} from "../../transport-5moD2pW5.js";
|
|
18
18
|
import {
|
|
19
19
|
a as CloudflareAIError,
|
|
20
20
|
c as GatewayModelOptions,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
s as FallbackLeg,
|
|
29
29
|
t as AI,
|
|
30
30
|
u as ModelOptions
|
|
31
|
-
} from "../../index-
|
|
31
|
+
} from "../../index-8k4qsX1T.js";
|
|
32
32
|
export {
|
|
33
33
|
AI,
|
|
34
34
|
type AISettings,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as GatewayLanguageModel, r as CloudflareAIError, t as createAI } from "../../ai-sdk-
|
|
1
|
+
import { n as GatewayLanguageModel, r as CloudflareAIError, t as createAI } from "../../ai-sdk-Kon40i0q.js";
|
|
2
2
|
export { CloudflareAIError, GatewayLanguageModel, createAI };
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
c as GatewayOptions,
|
|
5
5
|
d as CatalogModelId,
|
|
6
6
|
s as AISettings
|
|
7
|
-
} from "../../transport-
|
|
7
|
+
} from "../../transport-5moD2pW5.js";
|
|
8
8
|
import {
|
|
9
9
|
o as CloudflareLanguageModelId,
|
|
10
10
|
u as ModelOptions
|
|
11
|
-
} from "../../index-
|
|
11
|
+
} from "../../index-8k4qsX1T.js";
|
|
12
12
|
import { Plugin } from "@opencode/plugin";
|
|
13
13
|
|
|
14
14
|
//#region src/models/opencode/index.d.ts
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
o as CloudflareAIErrorCode,
|
|
11
11
|
r as GatewayProviderName,
|
|
12
12
|
s as AISettings
|
|
13
|
-
} from "../../transport-
|
|
13
|
+
} from "../../transport-5moD2pW5.js";
|
|
14
14
|
import {
|
|
15
15
|
Api,
|
|
16
16
|
AssistantImages,
|
|
@@ -43,18 +43,13 @@ interface CompatWarning {
|
|
|
43
43
|
//#region src/models/pi-ai/models/image.d.ts
|
|
44
44
|
/**
|
|
45
45
|
* The `api` marker on image models from this provider.
|
|
46
|
-
*
|
|
47
|
-
* @beta This surface is in beta and may change.
|
|
48
46
|
*/
|
|
49
47
|
declare const CLOUDFLARE_AI_IMAGES_API = "cloudflare-ai-images";
|
|
50
|
-
/** @beta This surface is in beta and may change. */
|
|
51
48
|
type CloudflareImagesModel = ImageModel<typeof CLOUDFLARE_AI_IMAGES_API>;
|
|
52
49
|
/**
|
|
53
50
|
* Per-model options for image models: gateway options plus the generation
|
|
54
51
|
* knobs Workers AI understands. Anything given here is the default for every
|
|
55
52
|
* call; `generateImages` options override it.
|
|
56
|
-
*
|
|
57
|
-
* @beta This surface is in beta and may change.
|
|
58
53
|
*/
|
|
59
54
|
interface PiImagesModelOptions extends ModelOptions {
|
|
60
55
|
name?: string;
|
|
@@ -80,8 +75,6 @@ interface PiImagesCallOptions extends ImagesOptions {
|
|
|
80
75
|
* pi-ai's `AssistantImages` has no warnings channel, so a knob this catalog
|
|
81
76
|
* drops is reported the way the language wires report theirs: as a diagnostic
|
|
82
77
|
* of type {@link COMPAT_DIAGNOSTIC}.
|
|
83
|
-
*
|
|
84
|
-
* @beta This surface is in beta and may change.
|
|
85
78
|
*/
|
|
86
79
|
interface CloudflareAssistantImages extends AssistantImages {
|
|
87
80
|
diagnostics?: {
|
|
@@ -98,33 +91,23 @@ interface CloudflareAssistantImages extends AssistantImages {
|
|
|
98
91
|
* The `api` marker Workers AI models from this provider carry. It is not a
|
|
99
92
|
* wire format: Workers AI runs on `env.AI.run`, and the compat layer maps that
|
|
100
93
|
* onto strict OpenAI chat completions.
|
|
101
|
-
*
|
|
102
|
-
* @beta This surface is in beta and may change.
|
|
103
94
|
*/
|
|
104
95
|
declare const CLOUDFLARE_AI_API = "cloudflare-ai";
|
|
105
|
-
/** @beta This surface is in beta and may change. */
|
|
106
96
|
type CloudflareAIApi = typeof CLOUDFLARE_AI_API;
|
|
107
97
|
/**
|
|
108
98
|
* The pi-ai provider id. A `Models` registry resolves specifiers as
|
|
109
99
|
* `cloudflare/<id>`, e.g. `cloudflare/anthropic/claude-opus-4.8`.
|
|
110
|
-
*
|
|
111
|
-
* @beta This surface is in beta and may change.
|
|
112
100
|
*/
|
|
113
101
|
declare const CLOUDFLARE_PROVIDER_ID = "cloudflare";
|
|
114
102
|
/**
|
|
115
103
|
* A Workers AI model produced by this provider. `id` is the `@cf/` id exactly
|
|
116
104
|
* as given; `api` is {@link CLOUDFLARE_AI_API}.
|
|
117
|
-
*
|
|
118
|
-
* @beta This surface is in beta and may change.
|
|
119
105
|
*/
|
|
120
106
|
type CloudflareModel = Model<CloudflareAIApi>;
|
|
121
|
-
/** @beta This surface is in beta and may change. */
|
|
122
107
|
type ModelCost = Model<Api>["cost"];
|
|
123
108
|
/**
|
|
124
109
|
* A model this provider routes: a Workers AI model or any pi-ai model the
|
|
125
110
|
* caller handed to `ai(model)`.
|
|
126
|
-
*
|
|
127
|
-
* @beta This surface is in beta and may change.
|
|
128
111
|
*/
|
|
129
112
|
type RoutedModel = Model<Api>;
|
|
130
113
|
/**
|
|
@@ -132,8 +115,6 @@ type RoutedModel = Model<Api>;
|
|
|
132
115
|
* session affinity, plus pi-ai model metadata overrides and the stream idle
|
|
133
116
|
* deadline. Metadata overrides only apply to the `@cf/` form — a model object
|
|
134
117
|
* brings its own metadata, and this module never second-guesses it.
|
|
135
|
-
*
|
|
136
|
-
* @beta This surface is in beta and may change.
|
|
137
118
|
*/
|
|
138
119
|
/**
|
|
139
120
|
* A fallback leg: a Workers AI id, a `<slug>/<id>` pi-ai's gateway registry
|
|
@@ -181,8 +162,6 @@ declare const CLOUDFLARE_DIAGNOSTIC = "cloudflare";
|
|
|
181
162
|
//#region src/models/pi-ai/index.d.ts
|
|
182
163
|
/**
|
|
183
164
|
* pi-agent-core's `streamFn` shape: what `Agent` calls to run a turn.
|
|
184
|
-
*
|
|
185
|
-
* @beta This surface is in beta and may change.
|
|
186
165
|
*/
|
|
187
166
|
type StreamFn = (
|
|
188
167
|
model: Model<string>,
|
|
@@ -194,8 +173,6 @@ type StreamFn = (
|
|
|
194
173
|
* pi-ai model to get a model this instance routes; use `stream`/`complete` to
|
|
195
174
|
* run it, `streamFn` with pi-agent-core's `Agent`, and `provider` with a pi-ai
|
|
196
175
|
* `Models` registry.
|
|
197
|
-
*
|
|
198
|
-
* @beta This surface is in beta and may change.
|
|
199
176
|
*/
|
|
200
177
|
interface AI {
|
|
201
178
|
/** A Workers AI model: Cloudflare's own catalog, on the run path. */
|
|
@@ -275,12 +252,10 @@ interface AI {
|
|
|
275
252
|
*
|
|
276
253
|
* ```ts
|
|
277
254
|
* const ai = createAI({ binding: env.AI, id: "prod" });
|
|
278
|
-
* ai("@cf/zai-org/glm-
|
|
279
|
-
* ai(anthropicModel, { fallback: ["@cf/zai-org/glm-
|
|
255
|
+
* ai("@cf/zai-org/glm-5.3-flash");
|
|
256
|
+
* ai(anthropicModel, { fallback: ["@cf/zai-org/glm-5.3-flash"] });
|
|
280
257
|
* new Agent({ streamFn: ai.streamFn, initialState: { model: ai(openaiModel) } });
|
|
281
258
|
* ```
|
|
282
|
-
*
|
|
283
|
-
* @beta This surface is in beta and may change.
|
|
284
259
|
*/
|
|
285
260
|
declare function createAI(settings: AISettings): AI;
|
|
286
261
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as isCatalogModelId, T as isRunPathLanguageModelId, _ as isGatewayErrorEnvelope, a as normalizeChatCompletion, c as gatewaySlugForBaseUrl, d as resolveGatewayProvider, f as createTransport, g as headersToObject, h as errorFromResponse, i as normalizeChatCompletionsStream, l as isGatewayShapedUrl, m as errorFromGatewayEnvelope, n as imageMediaTypeOf, o as prepareChatCompletionsRequest, r as sseDataStream, s as GATEWAY_PROVIDER_NAMES, t as buildImageInput, v as unwrapEnvelope, x as isAbortError, y as CloudflareAIError } from "../../images-
|
|
1
|
+
import { C as isCatalogModelId, T as isRunPathLanguageModelId, _ as isGatewayErrorEnvelope, a as normalizeChatCompletion, c as gatewaySlugForBaseUrl, d as resolveGatewayProvider, f as createTransport, g as headersToObject, h as errorFromResponse, i as normalizeChatCompletionsStream, l as isGatewayShapedUrl, m as errorFromGatewayEnvelope, n as imageMediaTypeOf, o as prepareChatCompletionsRequest, r as sseDataStream, s as GATEWAY_PROVIDER_NAMES, t as buildImageInput, v as unwrapEnvelope, x as isAbortError, y as CloudflareAIError } from "../../images-CfuRCjwq.js";
|
|
2
2
|
import { i as mergeModelOptions, o as resolveOptions, r as gatewayLayerOf } from "../../settings-Dk2il2Hf.js";
|
|
3
3
|
import { calculateCost, clampThinkingLevel, createAssistantMessageEventStream, createProvider, getCurrentTools, normalizeContext, parseStreamingJson } from "@earendil-works/pi-ai";
|
|
4
4
|
import { CLOUDFLARE_AI_GATEWAY_MODELS } from "@earendil-works/pi-ai/providers/cloudflare-ai-gateway.models";
|
|
@@ -13,15 +13,11 @@ import { clampOpenAIPromptCacheKey } from "@earendil-works/pi-ai/api/openai-prom
|
|
|
13
13
|
* The `api` marker Workers AI models from this provider carry. It is not a
|
|
14
14
|
* wire format: Workers AI runs on `env.AI.run`, and the compat layer maps that
|
|
15
15
|
* onto strict OpenAI chat completions.
|
|
16
|
-
*
|
|
17
|
-
* @beta This surface is in beta and may change.
|
|
18
16
|
*/
|
|
19
17
|
const CLOUDFLARE_AI_API = "cloudflare-ai";
|
|
20
18
|
/**
|
|
21
19
|
* The pi-ai provider id. A `Models` registry resolves specifiers as
|
|
22
20
|
* `cloudflare/<id>`, e.g. `cloudflare/anthropic/claude-opus-4.8`.
|
|
23
|
-
*
|
|
24
|
-
* @beta This surface is in beta and may change.
|
|
25
21
|
*/
|
|
26
22
|
const CLOUDFLARE_PROVIDER_ID = "cloudflare";
|
|
27
23
|
const MODEL_OPTIONS = Symbol.for("agents.models.pi-ai.options");
|
|
@@ -487,6 +483,32 @@ function anthropicVendorHeaders(betas) {
|
|
|
487
483
|
"content-type": "application/json"
|
|
488
484
|
};
|
|
489
485
|
}
|
|
486
|
+
/**
|
|
487
|
+
* The vendor headers `/run` also carries. The rest (`anthropic-version`,
|
|
488
|
+
* `accept`, `content-type`) belong to the gateway there, but `anthropic-beta`
|
|
489
|
+
* holds the beta features the body was built for: without it Anthropic refuses
|
|
490
|
+
* a body that uses one, or quietly drops the feature. The binding sends
|
|
491
|
+
* `extraHeaders` as request headers, and AI Gateway passes this one on.
|
|
492
|
+
*/
|
|
493
|
+
const RUN_VENDOR_HEADERS = ["anthropic-beta"];
|
|
494
|
+
/**
|
|
495
|
+
* The headers a `/run` request sends: the vendor headers in
|
|
496
|
+
* {@link RUN_VENDOR_HEADERS}, then the caller's own, which win. Names compare
|
|
497
|
+
* case-insensitively, so a caller's `Anthropic-Beta` replaces the wire's
|
|
498
|
+
* rather than being sent alongside it.
|
|
499
|
+
*/
|
|
500
|
+
function runHeaders(vendorHeaders, callerHeaders) {
|
|
501
|
+
const callerNames = new Set(Object.keys(callerHeaders).map((name) => name.toLowerCase()));
|
|
502
|
+
const headers = {};
|
|
503
|
+
for (const name of RUN_VENDOR_HEADERS) {
|
|
504
|
+
const value = vendorHeaders[name];
|
|
505
|
+
if (value !== void 0 && !callerNames.has(name)) headers[name] = value;
|
|
506
|
+
}
|
|
507
|
+
return {
|
|
508
|
+
...headers,
|
|
509
|
+
...callerHeaders
|
|
510
|
+
};
|
|
511
|
+
}
|
|
490
512
|
/** The vendor headers an OpenAI-shaped request needs. */
|
|
491
513
|
function openAIVendorHeaders() {
|
|
492
514
|
return {
|
|
@@ -526,7 +548,7 @@ async function sendGateway(request, transport, body, vendorHeaders, format, onRe
|
|
|
526
548
|
const response = await transport.run({
|
|
527
549
|
format,
|
|
528
550
|
gateway: resolved.gateway,
|
|
529
|
-
headers: request.headers,
|
|
551
|
+
headers: runHeaders(vendorHeaders, request.headers),
|
|
530
552
|
input,
|
|
531
553
|
model: catalogId,
|
|
532
554
|
signal: options.signal
|
|
@@ -1078,8 +1100,6 @@ function streamCompletions(request, transport) {
|
|
|
1078
1100
|
//#region src/models/pi-ai/models/image.ts
|
|
1079
1101
|
/**
|
|
1080
1102
|
* The `api` marker on image models from this provider.
|
|
1081
|
-
*
|
|
1082
|
-
* @beta This surface is in beta and may change.
|
|
1083
1103
|
*/
|
|
1084
1104
|
const CLOUDFLARE_AI_IMAGES_API = "cloudflare-ai-images";
|
|
1085
1105
|
const IMAGE_OPTIONS = Symbol.for("agents.models.pi-ai.image-options");
|
|
@@ -1745,7 +1765,7 @@ function createStreams(config) {
|
|
|
1745
1765
|
*
|
|
1746
1766
|
* const ai = createAI({ binding: env.AI, id: "prod" });
|
|
1747
1767
|
*
|
|
1748
|
-
* ai("@cf/zai-org/glm-
|
|
1768
|
+
* ai("@cf/zai-org/glm-5.3-flash"); // Workers AI: ours
|
|
1749
1769
|
* ai(getBuiltinModel("anthropic", "claude-opus-4-8")); // theirs, our transport
|
|
1750
1770
|
* ai("anthropic/claude-opus-4-8"); // same, via pi's catalog
|
|
1751
1771
|
* ```
|
|
@@ -1758,9 +1778,6 @@ function createStreams(config) {
|
|
|
1758
1778
|
* metadata (`api`, `compat`, `thinkingLevelMap`, cost, limits) is whatever its
|
|
1759
1779
|
* own registry says, and pi-ai's converters and stream processors do the rest.
|
|
1760
1780
|
*
|
|
1761
|
-
* @beta Everything exported here is in beta: the surface may
|
|
1762
|
-
* change in a minor release while the design settles.
|
|
1763
|
-
*
|
|
1764
1781
|
* @module
|
|
1765
1782
|
*/
|
|
1766
1783
|
/** The prefixes a bare vendor id is most often written with, for the error. */
|
|
@@ -1802,12 +1819,10 @@ function buildModel(target, options) {
|
|
|
1802
1819
|
*
|
|
1803
1820
|
* ```ts
|
|
1804
1821
|
* const ai = createAI({ binding: env.AI, id: "prod" });
|
|
1805
|
-
* ai("@cf/zai-org/glm-
|
|
1806
|
-
* ai(anthropicModel, { fallback: ["@cf/zai-org/glm-
|
|
1822
|
+
* ai("@cf/zai-org/glm-5.3-flash");
|
|
1823
|
+
* ai(anthropicModel, { fallback: ["@cf/zai-org/glm-5.3-flash"] });
|
|
1807
1824
|
* new Agent({ streamFn: ai.streamFn, initialState: { model: ai(openaiModel) } });
|
|
1808
1825
|
* ```
|
|
1809
|
-
*
|
|
1810
|
-
* @beta This surface is in beta and may change.
|
|
1811
1826
|
*/
|
|
1812
1827
|
function createAI(settings) {
|
|
1813
1828
|
const transport = createTransport(settings);
|