agents 0.25.0 → 0.26.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/dist/{harnesses → harness}/pi/index.d.ts +84 -88
- package/dist/{harnesses → harness}/pi/index.js +196 -77
- package/dist/harness/pi/index.js.map +1 -0
- package/dist/models/pi-ai/index.d.ts +14 -14
- package/dist/models/pi-ai/index.js +5 -5
- package/dist/models/pi-ai/index.js.map +1 -1
- package/docs/harnesses/pi.md +114 -32
- package/docs/index.md +2 -2
- package/docs/models-pi-ai.md +5 -5
- package/package.json +10 -10
- package/dist/harnesses/pi/index.js.map +0 -1
|
@@ -43,17 +43,17 @@ interface CompatWarning {
|
|
|
43
43
|
/**
|
|
44
44
|
* The `api` marker on image models from this provider.
|
|
45
45
|
*
|
|
46
|
-
* @
|
|
46
|
+
* @beta This surface is in beta and may change.
|
|
47
47
|
*/
|
|
48
48
|
declare const CLOUDFLARE_AI_IMAGES_API = "cloudflare-ai-images";
|
|
49
|
-
/** @
|
|
49
|
+
/** @beta This surface is in beta and may change. */
|
|
50
50
|
type CloudflareImagesModel = ImageModel<typeof CLOUDFLARE_AI_IMAGES_API>;
|
|
51
51
|
/**
|
|
52
52
|
* Per-model options for image models: gateway options plus the generation
|
|
53
53
|
* knobs Workers AI understands. Anything given here is the default for every
|
|
54
54
|
* call; `generateImages` options override it.
|
|
55
55
|
*
|
|
56
|
-
* @
|
|
56
|
+
* @beta This surface is in beta and may change.
|
|
57
57
|
*/
|
|
58
58
|
interface PiImagesModelOptions extends ModelOptions {
|
|
59
59
|
name?: string;
|
|
@@ -80,7 +80,7 @@ interface PiImagesCallOptions extends ImagesOptions {
|
|
|
80
80
|
* drops is reported the way the language wires report theirs: as a diagnostic
|
|
81
81
|
* of type {@link COMPAT_DIAGNOSTIC}.
|
|
82
82
|
*
|
|
83
|
-
* @
|
|
83
|
+
* @beta This surface is in beta and may change.
|
|
84
84
|
*/
|
|
85
85
|
interface CloudflareAssistantImages extends AssistantImages {
|
|
86
86
|
diagnostics?: {
|
|
@@ -98,32 +98,32 @@ interface CloudflareAssistantImages extends AssistantImages {
|
|
|
98
98
|
* wire format: Workers AI runs on `env.AI.run`, and the compat layer maps that
|
|
99
99
|
* onto strict OpenAI chat completions.
|
|
100
100
|
*
|
|
101
|
-
* @
|
|
101
|
+
* @beta This surface is in beta and may change.
|
|
102
102
|
*/
|
|
103
103
|
declare const CLOUDFLARE_AI_API = "cloudflare-ai";
|
|
104
|
-
/** @
|
|
104
|
+
/** @beta This surface is in beta and may change. */
|
|
105
105
|
type CloudflareAIApi = typeof CLOUDFLARE_AI_API;
|
|
106
106
|
/**
|
|
107
107
|
* The pi-ai provider id. A `Models` registry resolves specifiers as
|
|
108
108
|
* `cloudflare/<id>`, e.g. `cloudflare/anthropic/claude-opus-4-8`.
|
|
109
109
|
*
|
|
110
|
-
* @
|
|
110
|
+
* @beta This surface is in beta and may change.
|
|
111
111
|
*/
|
|
112
112
|
declare const CLOUDFLARE_PROVIDER_ID = "cloudflare";
|
|
113
113
|
/**
|
|
114
114
|
* A Workers AI model produced by this provider. `id` is the `@cf/` id exactly
|
|
115
115
|
* as given; `api` is {@link CLOUDFLARE_AI_API}.
|
|
116
116
|
*
|
|
117
|
-
* @
|
|
117
|
+
* @beta This surface is in beta and may change.
|
|
118
118
|
*/
|
|
119
119
|
type CloudflareModel = Model<CloudflareAIApi>;
|
|
120
|
-
/** @
|
|
120
|
+
/** @beta This surface is in beta and may change. */
|
|
121
121
|
type ModelCost = Model<Api>["cost"];
|
|
122
122
|
/**
|
|
123
123
|
* A model this provider routes: a Workers AI model or any pi-ai model the
|
|
124
124
|
* caller handed to `ai(model)`.
|
|
125
125
|
*
|
|
126
|
-
* @
|
|
126
|
+
* @beta This surface is in beta and may change.
|
|
127
127
|
*/
|
|
128
128
|
type RoutedModel = Model<Api>;
|
|
129
129
|
/**
|
|
@@ -132,7 +132,7 @@ type RoutedModel = Model<Api>;
|
|
|
132
132
|
* deadline. Metadata overrides only apply to the `@cf/` form — a model object
|
|
133
133
|
* brings its own metadata, and this module never second-guesses it.
|
|
134
134
|
*
|
|
135
|
-
* @
|
|
135
|
+
* @beta This surface is in beta and may change.
|
|
136
136
|
*/
|
|
137
137
|
/**
|
|
138
138
|
* A fallback leg: a Workers AI id, a `<slug>/<id>` pi-ai's gateway registry
|
|
@@ -181,7 +181,7 @@ declare const CLOUDFLARE_DIAGNOSTIC = "cloudflare";
|
|
|
181
181
|
/**
|
|
182
182
|
* pi-agent-core's `streamFn` shape: what `Agent` calls to run a turn.
|
|
183
183
|
*
|
|
184
|
-
* @
|
|
184
|
+
* @beta This surface is in beta and may change.
|
|
185
185
|
*/
|
|
186
186
|
type StreamFn = (
|
|
187
187
|
model: Model<string>,
|
|
@@ -194,7 +194,7 @@ type StreamFn = (
|
|
|
194
194
|
* run it, `streamFn` with pi-agent-core's `Agent`, and `provider` with a pi-ai
|
|
195
195
|
* `Models` registry.
|
|
196
196
|
*
|
|
197
|
-
* @
|
|
197
|
+
* @beta This surface is in beta and may change.
|
|
198
198
|
*/
|
|
199
199
|
interface AI {
|
|
200
200
|
/** A Workers AI model: Cloudflare's own catalog, on the run path. */
|
|
@@ -275,7 +275,7 @@ interface AI {
|
|
|
275
275
|
* new Agent({ streamFn: ai.streamFn, initialState: { model: ai(openaiModel) } });
|
|
276
276
|
* ```
|
|
277
277
|
*
|
|
278
|
-
* @
|
|
278
|
+
* @beta This surface is in beta and may change.
|
|
279
279
|
*/
|
|
280
280
|
declare function createAI(settings: AISettings): AI;
|
|
281
281
|
//#endregion
|
|
@@ -13,14 +13,14 @@ import { clampOpenAIPromptCacheKey } from "@earendil-works/pi-ai/api/openai-prom
|
|
|
13
13
|
* wire format: Workers AI runs on `env.AI.run`, and the compat layer maps that
|
|
14
14
|
* onto strict OpenAI chat completions.
|
|
15
15
|
*
|
|
16
|
-
* @
|
|
16
|
+
* @beta This surface is in beta and may change.
|
|
17
17
|
*/
|
|
18
18
|
const CLOUDFLARE_AI_API = "cloudflare-ai";
|
|
19
19
|
/**
|
|
20
20
|
* The pi-ai provider id. A `Models` registry resolves specifiers as
|
|
21
21
|
* `cloudflare/<id>`, e.g. `cloudflare/anthropic/claude-opus-4-8`.
|
|
22
22
|
*
|
|
23
|
-
* @
|
|
23
|
+
* @beta This surface is in beta and may change.
|
|
24
24
|
*/
|
|
25
25
|
const CLOUDFLARE_PROVIDER_ID = "cloudflare";
|
|
26
26
|
const MODEL_OPTIONS = Symbol.for("agents.models.pi-ai.options");
|
|
@@ -1029,7 +1029,7 @@ function streamCompletions(request, transport) {
|
|
|
1029
1029
|
/**
|
|
1030
1030
|
* The `api` marker on image models from this provider.
|
|
1031
1031
|
*
|
|
1032
|
-
* @
|
|
1032
|
+
* @beta This surface is in beta and may change.
|
|
1033
1033
|
*/
|
|
1034
1034
|
const CLOUDFLARE_AI_IMAGES_API = "cloudflare-ai-images";
|
|
1035
1035
|
const IMAGE_OPTIONS = Symbol.for("agents.models.pi-ai.image-options");
|
|
@@ -1705,7 +1705,7 @@ function createStreams(config) {
|
|
|
1705
1705
|
* metadata (`api`, `compat`, `thinkingLevelMap`, cost, limits) is whatever its
|
|
1706
1706
|
* own registry says, and pi-ai's converters and stream processors do the rest.
|
|
1707
1707
|
*
|
|
1708
|
-
* @
|
|
1708
|
+
* @beta Everything exported here is in beta: the surface may
|
|
1709
1709
|
* change in a minor release while the design settles.
|
|
1710
1710
|
*
|
|
1711
1711
|
* @module
|
|
@@ -1753,7 +1753,7 @@ function buildModel(target, options) {
|
|
|
1753
1753
|
* new Agent({ streamFn: ai.streamFn, initialState: { model: ai(openaiModel) } });
|
|
1754
1754
|
* ```
|
|
1755
1755
|
*
|
|
1756
|
-
* @
|
|
1756
|
+
* @beta This surface is in beta and may change.
|
|
1757
1757
|
*/
|
|
1758
1758
|
function createAI(settings) {
|
|
1759
1759
|
const transport = createTransport(settings);
|