agents 0.30.1 → 0.32.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 +2 -1
- package/dist/{agent-routing-CDbpVjYq.d.ts → agent-routing-vVMA7m8Y.d.ts} +69 -608
- 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-gGXXkf1z.d.ts} +2 -2
- package/dist/agent-tools.d.ts +1 -1
- package/dist/agent-tools.js +0 -1
- package/dist/agent-tools.js.map +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/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 -5
- 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 +48 -25
- 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-DRan7Lk6.js +497 -0
- package/dist/browser-tool-DRan7Lk6.js.map +1 -0
- package/dist/capability-id-B3J8Nok_.js +13 -0
- package/dist/capability-id-B3J8Nok_.js.map +1 -0
- package/dist/catalog-BpOejOsE.js +239 -0
- package/dist/catalog-BpOejOsE.js.map +1 -0
- package/dist/catalog-BpiVV1OF.d.ts +173 -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-eSfgYvd3.d.ts} +9 -7
- package/dist/client.d.ts +1 -1
- package/dist/{cloudflare-Dzvc7V2N.js → cloudflare-CUUm_9q9.js} +26 -4
- package/dist/cloudflare-CUUm_9q9.js.map +1 -0
- 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/{do-oauth-client-provider-DfsUcpc3.d.ts → do-oauth-client-provider-DtNqv7oj.d.ts} +26 -2
- package/dist/{index-YSKgfgg9.d.ts → emitter-BJZtCVjQ.d.ts} +6 -140
- package/dist/emitter-DPOVcCln.js +15 -0
- package/dist/emitter-DPOVcCln.js.map +1 -0
- package/dist/experimental/channels/web/index.js +1 -1
- 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/container/index.js +0 -1
- package/dist/harness/container/index.js.map +1 -1
- package/dist/harness/container/runtime/index.js +2 -2
- package/dist/harness/opencode/index.js +0 -1
- package/dist/harness/opencode/index.js.map +1 -1
- package/dist/harness/pi/index.d.ts +15 -7
- package/dist/harness/pi/index.js +74 -151
- 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 +15 -16
- package/dist/index.js +3 -3
- 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/markdown-BZ-VLtA1.js +86 -0
- package/dist/markdown-BZ-VLtA1.js.map +1 -0
- package/dist/mcp/client/do-oauth-client-provider.d.ts +4 -2
- package/dist/mcp/client/do-oauth-client-provider.js +15 -1
- package/dist/mcp/client/do-oauth-client-provider.js.map +1 -1
- 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 +160 -18
- package/dist/models/pi-ai/index.js.map +1 -1
- package/dist/observability/ai/index.js +1 -2
- package/dist/observability/ai/index.js.map +1 -1
- package/dist/observability/index.d.ts +170 -9
- package/dist/observability/index.js +386 -11
- package/dist/observability/index.js.map +1 -1
- package/dist/protocol-BEgrJYC5.d.ts +29 -29
- package/dist/react.d.ts +2 -2
- package/dist/resource-B59OV2a2.js +325 -0
- package/dist/resource-B59OV2a2.js.map +1 -0
- package/dist/routing/index.d.ts +1 -1
- package/dist/script-CFDLTk5b.d.ts +91 -0
- package/dist/script-workspace-BpdAYq1R.d.ts +41 -0
- 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/skill-DRBcIBjC.d.ts +221 -0
- package/dist/skills/index.d.ts +275 -36
- package/dist/skills/index.js +265 -1534
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/runner.d.ts +37 -0
- package/dist/skills/runner.js +912 -0
- package/dist/skills/runner.js.map +1 -0
- package/dist/skills/tools/ai-sdk.d.ts +36 -0
- package/dist/skills/tools/ai-sdk.js +94 -0
- package/dist/skills/tools/ai-sdk.js.map +1 -0
- package/dist/source-9RQzlEhM.d.ts +112 -0
- package/dist/{src-DfLzdwlK.js → src-DoGNJ4Ud.js} +21 -6
- package/dist/src-DoGNJ4Ud.js.map +1 -0
- package/dist/sub-routing.d.ts +12 -12
- package/dist/tool-CTp72Jb_.d.ts +10 -10
- package/dist/tool-CxKsvxjm.js.map +1 -1
- package/dist/tool-DkT_DJBm.js.map +1 -1
- package/dist/tool-DoVberpN.d.ts +22 -22
- package/dist/tool-helpers-BI7ifO2S.js +255 -0
- package/dist/tool-helpers-BI7ifO2S.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/vite.d.ts +2 -2
- package/dist/vite.js +10 -258
- package/dist/vite.js.map +1 -1
- package/dist/voice/index.d.ts +1 -1
- package/dist/websockets/index.js +1 -1
- package/dist/{websockets-CyoeosdO.js → websockets-C6SJtWCJ.js} +1 -2
- package/dist/{websockets-CyoeosdO.js.map → websockets-C6SJtWCJ.js.map} +1 -1
- package/dist/workflow-types.d.ts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/dist/workflows.js +0 -1
- package/dist/workflows.js.map +1 -1
- package/docs/browse-the-web.md +247 -413
- package/docs/harnesses/pi.md +36 -30
- package/docs/index.md +4 -4
- package/docs/mcp-client.md +25 -1
- package/docs/mcp-servers.md +26 -7
- package/docs/models-pi-ai.md +9 -11
- package/docs/models.md +1 -8
- package/docs/observability.md +5 -3
- package/docs/securing-mcp-servers.md +113 -302
- package/package.json +31 -17
- 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/cloudflare-Dzvc7V2N.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/index-iv9FTXX9.d.ts +0 -311
- 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/skills/compile.d.ts +0 -40
- package/dist/skills/compile.js +0 -65
- package/dist/skills/compile.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
- package/skills-module.d.ts +0 -22
|
@@ -96,8 +96,6 @@ type RerankingCatalogId = {
|
|
|
96
96
|
*
|
|
97
97
|
* Third-party models are not ids here — they are model objects built by their
|
|
98
98
|
* own provider package and routed through AI Gateway.
|
|
99
|
-
*
|
|
100
|
-
* @experimental This surface is experimental and may change.
|
|
101
99
|
*/
|
|
102
100
|
type WorkersAIModelId =
|
|
103
101
|
| Extract<
|
|
@@ -116,8 +114,6 @@ type WorkersAIModelId =
|
|
|
116
114
|
* which order, with what rate limits or budgets — and called through the
|
|
117
115
|
* Workers AI run path like a model. It answers in the OpenAI chat-completions
|
|
118
116
|
* shape whatever model served it, so it is a language model only.
|
|
119
|
-
*
|
|
120
|
-
* @experimental This surface is experimental and may change.
|
|
121
117
|
*/
|
|
122
118
|
type DynamicRouteId = `dynamic/${string}`;
|
|
123
119
|
/**
|
|
@@ -130,8 +126,6 @@ type DynamicRouteId = `dynamic/${string}`;
|
|
|
130
126
|
* `env.AI.run`, where AI Gateway's `/run` engine picks the provider, converts
|
|
131
127
|
* the request, and bills through Unified Billing or a key stored on the
|
|
132
128
|
* gateway.
|
|
133
|
-
*
|
|
134
|
-
* @experimental This surface is experimental and may change.
|
|
135
129
|
*/
|
|
136
130
|
type CatalogModelId = `${string}/${string}`;
|
|
137
131
|
/**
|
|
@@ -139,8 +133,6 @@ type CatalogModelId = `${string}/${string}`;
|
|
|
139
133
|
*
|
|
140
134
|
* The modality methods are Workers AI only — there is no vendor route for them
|
|
141
135
|
* — so, like {@link WorkersAIModelId}, they take `@cf/` ids and nothing else.
|
|
142
|
-
*
|
|
143
|
-
* @experimental This surface is experimental and may change.
|
|
144
136
|
*/
|
|
145
137
|
type CloudflareEmbeddingModelId =
|
|
146
138
|
| Extract<
|
|
@@ -161,8 +153,6 @@ type CloudflareEmbeddingModelId =
|
|
|
161
153
|
* `prompt`, which the JSON run path cannot carry — live, the run path answers
|
|
162
154
|
* `400 Bad input: required properties at "/" are 'multipart'`. Suggesting an
|
|
163
155
|
* id that always 400s is worse than not suggesting it.
|
|
164
|
-
*
|
|
165
|
-
* @experimental This surface is experimental and may change.
|
|
166
156
|
*/
|
|
167
157
|
type KnownImageModelId =
|
|
168
158
|
| "@cf/black-forest-labs/flux-1-schnell"
|
|
@@ -170,8 +160,6 @@ type KnownImageModelId =
|
|
|
170
160
|
| "@cf/leonardo/phoenix-1.0";
|
|
171
161
|
/**
|
|
172
162
|
* An image model id accepted by `ai.image()`.
|
|
173
|
-
*
|
|
174
|
-
* @experimental This surface is experimental and may change.
|
|
175
163
|
*/
|
|
176
164
|
type CloudflareImageModelId =
|
|
177
165
|
| Extract<
|
|
@@ -182,8 +170,6 @@ type CloudflareImageModelId =
|
|
|
182
170
|
/**
|
|
183
171
|
* Workers AI text-to-speech ids without a {@link BaseAiTextToSpeech} entry.
|
|
184
172
|
* Curated for autocomplete only.
|
|
185
|
-
*
|
|
186
|
-
* @experimental This surface is experimental and may change.
|
|
187
173
|
*/
|
|
188
174
|
type KnownSpeechModelId =
|
|
189
175
|
| "@cf/deepgram/aura-1"
|
|
@@ -191,8 +177,6 @@ type KnownSpeechModelId =
|
|
|
191
177
|
| "@cf/deepgram/aura-2-es";
|
|
192
178
|
/**
|
|
193
179
|
* A text-to-speech model id accepted by `ai.speech()`.
|
|
194
|
-
*
|
|
195
|
-
* @experimental This surface is experimental and may change.
|
|
196
180
|
*/
|
|
197
181
|
type CloudflareSpeechModelId =
|
|
198
182
|
| Extract<
|
|
@@ -211,8 +195,6 @@ type UnsupportedTranscriptionId = "@cf/deepgram/flux";
|
|
|
211
195
|
* Deepgram's Flux (`@cf/deepgram/flux`) is deliberately not suggested: it
|
|
212
196
|
* takes websocket connections only, so this provider answers a clear error
|
|
213
197
|
* for it rather than a 400.
|
|
214
|
-
*
|
|
215
|
-
* @experimental This surface is experimental and may change.
|
|
216
198
|
*/
|
|
217
199
|
type CloudflareTranscriptionModelId =
|
|
218
200
|
| Extract<
|
|
@@ -226,8 +208,6 @@ type CloudflareTranscriptionModelId =
|
|
|
226
208
|
| (`@cf/${string}` & {});
|
|
227
209
|
/**
|
|
228
210
|
* A reranking model id accepted by `ai.reranking()`.
|
|
229
|
-
*
|
|
230
|
-
* @experimental This surface is experimental and may change.
|
|
231
211
|
*/
|
|
232
212
|
type CloudflareRerankingModelId =
|
|
233
213
|
| Extract<RerankingCatalogId, `@cf/${string}`>
|
|
@@ -238,8 +218,6 @@ type CloudflareRerankingModelId =
|
|
|
238
218
|
* AI Gateway settings for a request. The gateway is an option, not a separate
|
|
239
219
|
* product: every call goes through one, and `id` defaults to `"default"`,
|
|
240
220
|
* which Cloudflare creates on first use.
|
|
241
|
-
*
|
|
242
|
-
* @experimental This surface is experimental and may change.
|
|
243
221
|
*/
|
|
244
222
|
interface GatewayOptions {
|
|
245
223
|
/** Gateway id. Defaults to `"default"` (auto-created on first use). */
|
|
@@ -283,15 +261,11 @@ interface GatewayOptions {
|
|
|
283
261
|
* API token. Both take the same routes — a model id to the run path, a
|
|
284
262
|
* vendor's model object to the provider-native path — and the same gateway
|
|
285
263
|
* options.
|
|
286
|
-
*
|
|
287
|
-
* @experimental This surface is experimental and may change.
|
|
288
264
|
*/
|
|
289
265
|
type AISettings = (BindingAccess | AccountAccess) & ProviderGatewaySettings;
|
|
290
266
|
/**
|
|
291
267
|
* Reach Cloudflare through the `AI` binding: no account id or token to hold,
|
|
292
268
|
* and the gateway is the Worker's own account's.
|
|
293
|
-
*
|
|
294
|
-
* @experimental This surface is experimental and may change.
|
|
295
269
|
*/
|
|
296
270
|
interface BindingAccess {
|
|
297
271
|
/** The `AI` binding from a Worker's env. */
|
|
@@ -306,8 +280,6 @@ interface BindingAccess {
|
|
|
306
280
|
* a model object to the provider-native path
|
|
307
281
|
* (`gateway.ai.cloudflare.com/v1/{accountId}/{gateway}/...`). The token is
|
|
308
282
|
* only ever sent to those two hosts.
|
|
309
|
-
*
|
|
310
|
-
* @experimental This surface is experimental and may change.
|
|
311
283
|
*/
|
|
312
284
|
interface AccountAccess {
|
|
313
285
|
/** The account the gateway belongs to. */
|
|
@@ -323,8 +295,6 @@ interface AccountAccess {
|
|
|
323
295
|
/**
|
|
324
296
|
* Provider-wide gateway defaults, in either spelling: nested under `gateway`,
|
|
325
297
|
* or flat (`{ id: "prod", cacheTtl: 60 }`). Both merge, the flat key winning.
|
|
326
|
-
*
|
|
327
|
-
* @experimental This surface is experimental and may change.
|
|
328
298
|
*/
|
|
329
299
|
interface ProviderGatewaySettings extends GatewayOptions {
|
|
330
300
|
/** Gateway id or full gateway options. */
|
|
@@ -343,8 +313,6 @@ interface ProviderGatewaySettings extends GatewayOptions {
|
|
|
343
313
|
* default; a module whose legs may also be model objects says so
|
|
344
314
|
* (`ModelOptions<WorkersAIModelId | LanguageModelV4>`) rather than rebuilding
|
|
345
315
|
* the type.
|
|
346
|
-
*
|
|
347
|
-
* @experimental This surface is experimental and may change.
|
|
348
316
|
*/
|
|
349
317
|
interface ModelOptions<Leg = WorkersAIModelId> extends ProviderGatewaySettings {
|
|
350
318
|
/**
|
|
@@ -382,8 +350,6 @@ interface ResolvedGateway extends GatewayOptions {
|
|
|
382
350
|
//#region src/models/core/errors.d.ts
|
|
383
351
|
/**
|
|
384
352
|
* Coarse classification of a failed Cloudflare AI call.
|
|
385
|
-
*
|
|
386
|
-
* @experimental This surface is experimental and may change.
|
|
387
353
|
*/
|
|
388
354
|
type CloudflareAIErrorCode =
|
|
389
355
|
| "auth"
|
|
@@ -395,8 +361,6 @@ type CloudflareAIErrorCode =
|
|
|
395
361
|
| "unknown";
|
|
396
362
|
/**
|
|
397
363
|
* One leg of a {@link CloudflareAIError} fallback chain.
|
|
398
|
-
*
|
|
399
|
-
* @experimental This surface is experimental and may change.
|
|
400
364
|
*/
|
|
401
365
|
interface CloudflareAIAttempt {
|
|
402
366
|
/** The model id that was tried. */
|
|
@@ -410,8 +374,6 @@ interface CloudflareAIAttempt {
|
|
|
410
374
|
* modules wrap it into their own error type at their boundary (the AI SDK
|
|
411
375
|
* module into an `APICallError`, so `ai`'s retry loop honours
|
|
412
376
|
* {@link CloudflareAIError.isRetryable}).
|
|
413
|
-
*
|
|
414
|
-
* @experimental This surface is experimental and may change.
|
|
415
377
|
*/
|
|
416
378
|
declare class CloudflareAIError extends Error {
|
|
417
379
|
/** HTTP status, when the failure carried one. */
|
|
@@ -473,8 +435,6 @@ declare class CloudflareAIError extends Error {
|
|
|
473
435
|
/**
|
|
474
436
|
* The gateway provider slugs this table maps onto. A subset of the ambient
|
|
475
437
|
* `AIGatewayProviders` union; {@link GatewayProviderNameCheck} keeps it one.
|
|
476
|
-
*
|
|
477
|
-
* @experimental This surface is experimental and may change.
|
|
478
438
|
*/
|
|
479
439
|
declare const GATEWAY_PROVIDER_NAMES: readonly [
|
|
480
440
|
"workers-ai",
|
|
@@ -499,8 +459,6 @@ declare const GATEWAY_PROVIDER_NAMES: readonly [
|
|
|
499
459
|
];
|
|
500
460
|
/**
|
|
501
461
|
* A gateway provider slug.
|
|
502
|
-
*
|
|
503
|
-
* @experimental This surface is experimental and may change.
|
|
504
462
|
*/
|
|
505
463
|
type GatewayProviderName = (typeof GATEWAY_PROVIDER_NAMES)[number];
|
|
506
464
|
//#endregion
|
|
@@ -620,4 +578,4 @@ export {
|
|
|
620
578
|
KnownImageModelId as v,
|
|
621
579
|
KnownSpeechModelId as y
|
|
622
580
|
};
|
|
623
|
-
//# sourceMappingURL=transport-
|
|
581
|
+
//# sourceMappingURL=transport-5moD2pW5.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ClientOptions } from "@modelcontextprotocol/client";
|
|
2
|
+
|
|
3
|
+
//#region src/mcp/types.d.ts
|
|
4
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
5
|
+
type HttpTransportType = "sse" | "streamable-http";
|
|
6
|
+
type BaseTransportType = HttpTransportType | "rpc";
|
|
7
|
+
type TransportType = BaseTransportType | "auto";
|
|
8
|
+
/**
|
|
9
|
+
* Agents-owned MCP client configuration. Only these SDK behaviours are part of
|
|
10
|
+
* the supported interface; new beta SDK fields are not persisted or exposed
|
|
11
|
+
* accidentally.
|
|
12
|
+
*/
|
|
13
|
+
interface McpClientOptions {
|
|
14
|
+
capabilities?: ClientOptions["capabilities"];
|
|
15
|
+
jsonSchemaValidator?: ClientOptions["jsonSchemaValidator"];
|
|
16
|
+
versionNegotiation?: ClientOptions["versionNegotiation"];
|
|
17
|
+
inputRequired?: ClientOptions["inputRequired"];
|
|
18
|
+
listChanged?: ClientOptions["listChanged"];
|
|
19
|
+
supportedProtocolVersions?: ClientOptions["supportedProtocolVersions"];
|
|
20
|
+
enforceStrictCapabilities?: ClientOptions["enforceStrictCapabilities"];
|
|
21
|
+
debouncedNotificationMethods?: ClientOptions["debouncedNotificationMethods"];
|
|
22
|
+
listMaxPages?: ClientOptions["listMaxPages"];
|
|
23
|
+
responseCacheStore?: ClientOptions["responseCacheStore"];
|
|
24
|
+
cachePartition?: ClientOptions["cachePartition"];
|
|
25
|
+
defaultCacheTtlMs?: ClientOptions["defaultCacheTtlMs"];
|
|
26
|
+
}
|
|
27
|
+
interface CORSOptions {
|
|
28
|
+
origin?: string;
|
|
29
|
+
methods?: string;
|
|
30
|
+
headers?: string;
|
|
31
|
+
maxAge?: number;
|
|
32
|
+
exposeHeaders?: string;
|
|
33
|
+
}
|
|
34
|
+
interface ServeOptions {
|
|
35
|
+
binding?: string;
|
|
36
|
+
corsOptions?: CORSOptions;
|
|
37
|
+
transport?: TransportType;
|
|
38
|
+
jurisdiction?: DurableObjectJurisdiction;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export {
|
|
42
|
+
ServeOptions as a,
|
|
43
|
+
McpClientOptions as i,
|
|
44
|
+
CORSOptions as n,
|
|
45
|
+
TransportType as o,
|
|
46
|
+
MaybePromise as r,
|
|
47
|
+
BaseTransportType as t
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=types-D2naO3rA.d.ts.map
|
package/dist/vite.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ interface AgentsPluginOptions {
|
|
|
15
15
|
* Vite plugin for Agents SDK projects.
|
|
16
16
|
*
|
|
17
17
|
* Handles TC39 decorator transforms (Oxc doesn't support them yet, oxc#9170) so
|
|
18
|
-
* `@callable()` works at runtime,
|
|
19
|
-
*
|
|
18
|
+
* `@callable()` works at runtime, and stubs `turndown` to keep Workers
|
|
19
|
+
* deploys clean. Will grow to cover other
|
|
20
20
|
* Agents-specific build concerns as needed.
|
|
21
21
|
*/
|
|
22
22
|
declare function agents(options?: AgentsPluginOptions): Plugin[];
|
package/dist/vite.js
CHANGED
|
@@ -1,248 +1,5 @@
|
|
|
1
|
-
import { compileSkillScript, isCompilableSkillScript } from "./skills/compile.js";
|
|
2
1
|
import babel from "@rolldown/plugin-babel";
|
|
3
|
-
import { createHash } from "node:crypto";
|
|
4
|
-
import { readFile, readdir, stat } from "node:fs/promises";
|
|
5
|
-
import { basename, join, resolve } from "node:path";
|
|
6
|
-
import { parse } from "yaml";
|
|
7
2
|
//#region src/vite.ts
|
|
8
|
-
const SKILLS_SPECIFIER = "agents:skills";
|
|
9
|
-
const SKILLS_VIRTUAL_PREFIX = "\0agents:skills:";
|
|
10
|
-
const SKILL_RESOURCE_ROOTS = /* @__PURE__ */ new Set([
|
|
11
|
-
"references",
|
|
12
|
-
"scripts",
|
|
13
|
-
"assets",
|
|
14
|
-
"graphics",
|
|
15
|
-
"fonts",
|
|
16
|
-
"templates",
|
|
17
|
-
"rendered-files",
|
|
18
|
-
"illustrations"
|
|
19
|
-
]);
|
|
20
|
-
const SKILL_IGNORED_ROOTS = /* @__PURE__ */ new Set([
|
|
21
|
-
".git",
|
|
22
|
-
".hg",
|
|
23
|
-
".svn",
|
|
24
|
-
".DS_Store",
|
|
25
|
-
".idea",
|
|
26
|
-
".vscode",
|
|
27
|
-
"dist",
|
|
28
|
-
"build",
|
|
29
|
-
"coverage",
|
|
30
|
-
"node_modules"
|
|
31
|
-
]);
|
|
32
|
-
const SPEC_RESOURCE_ROOTS = /* @__PURE__ */ new Set([
|
|
33
|
-
"references",
|
|
34
|
-
"scripts",
|
|
35
|
-
"assets"
|
|
36
|
-
]);
|
|
37
|
-
const SKILL_ASSET_WARN_BYTES = 256 * 1024;
|
|
38
|
-
const SKILL_BUNDLE_WARN_BYTES = 1024 * 1024;
|
|
39
|
-
function formatBytes(bytes) {
|
|
40
|
-
if (bytes >= 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
|
|
41
|
-
if (bytes >= 1024) return `${(bytes / 1024).toFixed(0)}KB`;
|
|
42
|
-
return `${bytes}B`;
|
|
43
|
-
}
|
|
44
|
-
function parseFrontmatter(raw) {
|
|
45
|
-
const match = raw.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
|
|
46
|
-
if (!match) return {
|
|
47
|
-
data: {},
|
|
48
|
-
body: raw
|
|
49
|
-
};
|
|
50
|
-
const parsed = parse(match[1] ?? "");
|
|
51
|
-
return {
|
|
52
|
-
data: parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {},
|
|
53
|
-
body: match[2] ?? ""
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function stringField(value) {
|
|
57
|
-
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
58
|
-
}
|
|
59
|
-
function recordField(value) {
|
|
60
|
-
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
61
|
-
}
|
|
62
|
-
function resourceKind(path) {
|
|
63
|
-
if (path.startsWith("references/")) return "reference";
|
|
64
|
-
if (path.startsWith("scripts/")) return "script";
|
|
65
|
-
if (path.startsWith("assets/") || path.startsWith("graphics/") || path.startsWith("fonts/") || path.startsWith("templates/") || path.startsWith("rendered-files/") || path.startsWith("illustrations/")) return "asset";
|
|
66
|
-
return "file";
|
|
67
|
-
}
|
|
68
|
-
const TEXT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
69
|
-
".bash",
|
|
70
|
-
".css",
|
|
71
|
-
".csv",
|
|
72
|
-
".html",
|
|
73
|
-
".js",
|
|
74
|
-
".json",
|
|
75
|
-
".jsx",
|
|
76
|
-
".md",
|
|
77
|
-
".mjs",
|
|
78
|
-
".py",
|
|
79
|
-
".sh",
|
|
80
|
-
".svg",
|
|
81
|
-
".ts",
|
|
82
|
-
".tsx",
|
|
83
|
-
".txt",
|
|
84
|
-
".xml",
|
|
85
|
-
".yaml",
|
|
86
|
-
".yml"
|
|
87
|
-
]);
|
|
88
|
-
const MIME_TYPES = /* @__PURE__ */ new Map([
|
|
89
|
-
[".css", "text/css"],
|
|
90
|
-
[".gif", "image/gif"],
|
|
91
|
-
[".html", "text/html"],
|
|
92
|
-
[".jpg", "image/jpeg"],
|
|
93
|
-
[".jpeg", "image/jpeg"],
|
|
94
|
-
[".js", "text/javascript"],
|
|
95
|
-
[".json", "application/json"],
|
|
96
|
-
[".md", "text/markdown"],
|
|
97
|
-
[".mjs", "text/javascript"],
|
|
98
|
-
[".pdf", "application/pdf"],
|
|
99
|
-
[".png", "image/png"],
|
|
100
|
-
[".py", "text/x-python"],
|
|
101
|
-
[".sh", "text/x-shellscript"],
|
|
102
|
-
[".svg", "image/svg+xml"],
|
|
103
|
-
[".ts", "text/typescript"],
|
|
104
|
-
[".tsx", "text/typescript"],
|
|
105
|
-
[".txt", "text/plain"],
|
|
106
|
-
[".webp", "image/webp"],
|
|
107
|
-
[".woff", "font/woff"],
|
|
108
|
-
[".woff2", "font/woff2"],
|
|
109
|
-
[".xml", "application/xml"],
|
|
110
|
-
[".yaml", "application/yaml"],
|
|
111
|
-
[".yml", "application/yaml"]
|
|
112
|
-
]);
|
|
113
|
-
function extensionOf(path) {
|
|
114
|
-
const file = path.split("/").at(-1) ?? path;
|
|
115
|
-
const index = file.lastIndexOf(".");
|
|
116
|
-
return index === -1 ? "" : file.slice(index).toLowerCase();
|
|
117
|
-
}
|
|
118
|
-
function resourceEncoding(path) {
|
|
119
|
-
return TEXT_EXTENSIONS.has(extensionOf(path)) ? "text" : "base64";
|
|
120
|
-
}
|
|
121
|
-
function resourceMimeType(path) {
|
|
122
|
-
return MIME_TYPES.get(extensionOf(path));
|
|
123
|
-
}
|
|
124
|
-
async function collectFiles(root, relativeRoot = "", warn) {
|
|
125
|
-
const entries = await readdir(join(root, relativeRoot), { withFileTypes: true }).catch(() => []);
|
|
126
|
-
const files = [];
|
|
127
|
-
for (const entry of entries) {
|
|
128
|
-
if (SKILL_IGNORED_ROOTS.has(entry.name)) continue;
|
|
129
|
-
const relativePath = relativeRoot ? `${relativeRoot}/${entry.name}` : entry.name;
|
|
130
|
-
const absolutePath = join(root, relativePath);
|
|
131
|
-
if (entry.isDirectory()) {
|
|
132
|
-
const resourceRoot = relativePath.split("/")[0];
|
|
133
|
-
if (!resourceRoot || SKILL_IGNORED_ROOTS.has(resourceRoot)) continue;
|
|
134
|
-
if (!SKILL_RESOURCE_ROOTS.has(resourceRoot)) {
|
|
135
|
-
if (!relativeRoot) warn?.(`Ignoring skill directory "${relativePath}". Bundled skill resources should live under references/, scripts/, assets/, or a known asset root.`);
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
if (!SPEC_RESOURCE_ROOTS.has(resourceRoot) && !relativeRoot) warn?.(`Bundling non-standard skill resource root "${resourceRoot}/". Prefer assets/ for portable Agent Skills when possible.`);
|
|
139
|
-
files.push(...await collectFiles(root, relativePath, warn));
|
|
140
|
-
} else if (entry.isFile() && relativePath !== "SKILL.md") {
|
|
141
|
-
const resourceRoot = relativePath.split("/")[0];
|
|
142
|
-
if (!resourceRoot || SKILL_IGNORED_ROOTS.has(resourceRoot)) continue;
|
|
143
|
-
if (!SKILL_RESOURCE_ROOTS.has(resourceRoot)) {
|
|
144
|
-
warn?.(`Ignoring skill file "${relativePath}". Bundled skill resources should live under references/, scripts/, assets/, or a known asset root.`);
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
const info = await stat(absolutePath);
|
|
148
|
-
files.push({
|
|
149
|
-
path: relativePath,
|
|
150
|
-
absolutePath,
|
|
151
|
-
size: info.size
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return files.sort((a, b) => a.path.localeCompare(b.path));
|
|
156
|
-
}
|
|
157
|
-
async function collectWatchTargets(root, relativeRoot = "") {
|
|
158
|
-
const directory = join(root, relativeRoot);
|
|
159
|
-
const entries = await readdir(directory, { withFileTypes: true }).catch(() => []);
|
|
160
|
-
const targets = [directory];
|
|
161
|
-
for (const entry of entries) {
|
|
162
|
-
if (SKILL_IGNORED_ROOTS.has(entry.name)) continue;
|
|
163
|
-
const relativePath = relativeRoot ? `${relativeRoot}/${entry.name}` : entry.name;
|
|
164
|
-
const resourceRoot = relativePath.split("/")[0];
|
|
165
|
-
if (!resourceRoot || SKILL_IGNORED_ROOTS.has(resourceRoot)) continue;
|
|
166
|
-
const absolutePath = join(root, relativePath);
|
|
167
|
-
targets.push(absolutePath);
|
|
168
|
-
if (entry.isDirectory()) targets.push(...await collectWatchTargets(root, relativePath));
|
|
169
|
-
}
|
|
170
|
-
return targets;
|
|
171
|
-
}
|
|
172
|
-
async function readSkill(skillDir, warn) {
|
|
173
|
-
const rawContent = await readFile(join(skillDir, "SKILL.md"), "utf8").catch(() => null);
|
|
174
|
-
if (rawContent === null) return null;
|
|
175
|
-
const { data, body } = parseFrontmatter(rawContent);
|
|
176
|
-
const name = stringField(data.name);
|
|
177
|
-
const description = stringField(data.description);
|
|
178
|
-
if (!name || !description) return null;
|
|
179
|
-
const resources = await Promise.all((await collectFiles(skillDir, "", warn)).map(async (file) => {
|
|
180
|
-
const encoding = resourceEncoding(file.path);
|
|
181
|
-
const bytes = await readFile(file.absolutePath);
|
|
182
|
-
const kind = resourceKind(file.path);
|
|
183
|
-
let content = encoding === "base64" ? bytes.toString("base64") : bytes.toString();
|
|
184
|
-
let precompiled = false;
|
|
185
|
-
let size = file.size;
|
|
186
|
-
if (kind === "script" && encoding === "text" && isCompilableSkillScript(file.path)) try {
|
|
187
|
-
content = (await compileSkillScript(file.absolutePath)).content;
|
|
188
|
-
precompiled = true;
|
|
189
|
-
size = Buffer.byteLength(content);
|
|
190
|
-
} catch (error) {
|
|
191
|
-
warn?.(`Failed to compile skill script "${file.path}": ${error instanceof Error ? error.message : String(error)}. Skill scripts must be self-contained, compilable modules to run at runtime.`);
|
|
192
|
-
}
|
|
193
|
-
return {
|
|
194
|
-
path: file.path,
|
|
195
|
-
kind,
|
|
196
|
-
size,
|
|
197
|
-
encoding,
|
|
198
|
-
mimeType: resourceMimeType(file.path),
|
|
199
|
-
content,
|
|
200
|
-
precompiled
|
|
201
|
-
};
|
|
202
|
-
}));
|
|
203
|
-
return {
|
|
204
|
-
name,
|
|
205
|
-
description,
|
|
206
|
-
body,
|
|
207
|
-
rawContent,
|
|
208
|
-
compatibility: stringField(data.compatibility),
|
|
209
|
-
license: stringField(data.license),
|
|
210
|
-
allowedTools: stringField(data["allowed-tools"]),
|
|
211
|
-
metadata: recordField(data.metadata),
|
|
212
|
-
resources
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
async function buildSkillsModule(dir, warn) {
|
|
216
|
-
const entries = await readdir(dir, { withFileTypes: true });
|
|
217
|
-
const skills = [];
|
|
218
|
-
const seen = /* @__PURE__ */ new Set();
|
|
219
|
-
for (const entry of entries) {
|
|
220
|
-
if (!entry.isDirectory()) continue;
|
|
221
|
-
const skill = await readSkill(join(dir, entry.name), warn);
|
|
222
|
-
if (!skill) continue;
|
|
223
|
-
if (seen.has(skill.name)) {
|
|
224
|
-
warn?.(`Duplicate bundled skill name "${skill.name}" in "${entry.name}/"; keeping the first occurrence and ignoring this one.`);
|
|
225
|
-
continue;
|
|
226
|
-
}
|
|
227
|
-
seen.add(skill.name);
|
|
228
|
-
skills.push(skill);
|
|
229
|
-
}
|
|
230
|
-
skills.sort((a, b) => a.name.localeCompare(b.name));
|
|
231
|
-
let totalBytes = 0;
|
|
232
|
-
for (const skill of skills) for (const resource of skill.resources) {
|
|
233
|
-
totalBytes += resource.size;
|
|
234
|
-
if (resource.size > SKILL_ASSET_WARN_BYTES) warn?.(`Bundled skill resource "${skill.name}/${resource.path}" is ${formatBytes(resource.size)}; large assets bloat the Worker bundle (base64, ~1.33x). Prefer an R2-backed source via skills.r2().`);
|
|
235
|
-
}
|
|
236
|
-
if (totalBytes > SKILL_BUNDLE_WARN_BYTES) warn?.(`Bundled skills total ${formatBytes(totalBytes)} of embedded resources; this competes with the Worker bundle-size budget. Consider serving large skills from R2 via skills.r2().`);
|
|
237
|
-
const hash = createHash("sha256");
|
|
238
|
-
hash.update(JSON.stringify(skills));
|
|
239
|
-
const manifest = {
|
|
240
|
-
id: `bundle:${basename(dir)}`,
|
|
241
|
-
fingerprint: hash.digest("hex"),
|
|
242
|
-
skills
|
|
243
|
-
};
|
|
244
|
-
return `const manifest = ${JSON.stringify(manifest)};\nexport default {\n id: manifest.id,\n fingerprint: manifest.fingerprint,\n async list() {\n return manifest.skills.map(({ body, rawContent, resources, ...skill }) => skill);\n },\n async load(name) {\n const skill = manifest.skills.find((entry) => entry.name === name);\n if (!skill) return null;\n return {\n ...skill,\n resources: skill.resources.map(({ content, ...resource }) => resource)\n };\n },\n async readResource(name, path) {\n const skill = manifest.skills.find((entry) => entry.name === name);\n const resource = skill?.resources.find((entry) => entry.path === path);\n return resource ? { ...resource } : null;\n }\n};\n`;
|
|
245
|
-
}
|
|
246
3
|
const TURNDOWN_STUB_ID = "\0agents:turndown-stub";
|
|
247
4
|
const TURNDOWN_STUB_MESSAGE = "The Agents Vite plugin stubbed the 'turndown' package to keep Workers bundles compatible with just-bash. If your app uses turndown directly, configure the plugin with agents({ stubTurndown: false }).";
|
|
248
5
|
function turndownStubPlugin() {
|
|
@@ -269,19 +26,14 @@ export default TurndownService;
|
|
|
269
26
|
}
|
|
270
27
|
};
|
|
271
28
|
}
|
|
272
|
-
|
|
29
|
+
const REMOVED_SKILLS_IMPORT_MESSAGE = "The \"agents:skills\" import has been removed. Skills are now files: store them in a Computer Workspace and return skills.workspace(this.workspace) from getSkills(), or load them with skills.r2(bucket) or skills.manifest({ id, skills }). See https://developers.cloudflare.com/agents/skills/";
|
|
30
|
+
function removedSkillsImportPlugin() {
|
|
273
31
|
return {
|
|
274
|
-
name: "agents-skills-import",
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
if (
|
|
278
|
-
return
|
|
279
|
-
},
|
|
280
|
-
async load(id) {
|
|
281
|
-
if (!id.startsWith(SKILLS_VIRTUAL_PREFIX)) return null;
|
|
282
|
-
const dir = id.slice(15);
|
|
283
|
-
for (const target of await collectWatchTargets(dir)) this.addWatchFile(target);
|
|
284
|
-
return buildSkillsModule(dir, (message) => this.warn(message));
|
|
32
|
+
name: "agents-removed-skills-import",
|
|
33
|
+
enforce: "pre",
|
|
34
|
+
resolveId(source) {
|
|
35
|
+
if (source === "agents:skills" || source.startsWith("agents:skills/")) this.error(REMOVED_SKILLS_IMPORT_MESSAGE);
|
|
36
|
+
return null;
|
|
285
37
|
}
|
|
286
38
|
};
|
|
287
39
|
}
|
|
@@ -289,15 +41,15 @@ function skillsImportPlugin() {
|
|
|
289
41
|
* Vite plugin for Agents SDK projects.
|
|
290
42
|
*
|
|
291
43
|
* Handles TC39 decorator transforms (Oxc doesn't support them yet, oxc#9170) so
|
|
292
|
-
* `@callable()` works at runtime,
|
|
293
|
-
*
|
|
44
|
+
* `@callable()` works at runtime, and stubs `turndown` to keep Workers
|
|
45
|
+
* deploys clean. Will grow to cover other
|
|
294
46
|
* Agents-specific build concerns as needed.
|
|
295
47
|
*/
|
|
296
48
|
function agents(options = {}) {
|
|
297
49
|
const { stubTurndown = true } = options;
|
|
298
50
|
return [
|
|
299
51
|
...stubTurndown ? [turndownStubPlugin()] : [],
|
|
300
|
-
|
|
52
|
+
removedSkillsImportPlugin(),
|
|
301
53
|
babel({ presets: [{
|
|
302
54
|
preset: () => ({ plugins: [["@babel/plugin-proposal-decorators", { version: "2023-11" }]] }),
|
|
303
55
|
rolldown: { filter: { code: "@" } }
|
package/dist/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","names":["parseYaml"],"sources":["../src/vite.ts"],"sourcesContent":["import babel from \"@rolldown/plugin-babel\";\nimport { createHash } from \"node:crypto\";\nimport { readdir, readFile, stat } from \"node:fs/promises\";\nimport { basename, join, resolve } from \"node:path\";\nimport { parse as parseYaml } from \"yaml\";\nimport type { Plugin } from \"vite\";\nimport { compileSkillScript, isCompilableSkillScript } from \"./skills/compile\";\n\nconst SKILLS_SPECIFIER = \"agents:skills\";\nconst SKILLS_VIRTUAL_PREFIX = \"\\0agents:skills:\";\nconst SKILL_RESOURCE_ROOTS = new Set([\n \"references\",\n \"scripts\",\n \"assets\",\n \"graphics\",\n \"fonts\",\n \"templates\",\n \"rendered-files\",\n \"illustrations\"\n]);\nconst SKILL_IGNORED_ROOTS = new Set([\n \".git\",\n \".hg\",\n \".svn\",\n \".DS_Store\",\n \".idea\",\n \".vscode\",\n \"dist\",\n \"build\",\n \"coverage\",\n \"node_modules\"\n]);\nconst SPEC_RESOURCE_ROOTS = new Set([\"references\", \"scripts\", \"assets\"]);\n\n// Bundled skill resources are base64-embedded into the Worker bundle, which\n// inflates them by ~1.33x and competes with app code for the bundle-size\n// budget. These heuristic thresholds (raw bytes) trigger a recommendation to\n// move large assets to an R2-backed skill source instead.\nconst SKILL_ASSET_WARN_BYTES = 256 * 1024;\nconst SKILL_BUNDLE_WARN_BYTES = 1024 * 1024;\n\nfunction formatBytes(bytes: number): string {\n if (bytes >= 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;\n if (bytes >= 1024) return `${(bytes / 1024).toFixed(0)}KB`;\n return `${bytes}B`;\n}\n\ninterface SkillFile {\n name: string;\n description: string;\n body: string;\n rawContent: string;\n compatibility?: string;\n license?: string;\n allowedTools?: string;\n metadata?: Record<string, unknown>;\n resources: Array<{\n path: string;\n kind: \"reference\" | \"script\" | \"asset\" | \"file\";\n size: number;\n encoding: \"text\" | \"base64\";\n mimeType?: string;\n content: string;\n precompiled?: boolean;\n }>;\n}\n\nfunction parseFrontmatter(raw: string): {\n data: Record<string, unknown>;\n body: string;\n} {\n const match = raw.match(/^---\\r?\\n([\\s\\S]*?)\\r?\\n---\\r?\\n?([\\s\\S]*)$/);\n if (!match) return { data: {}, body: raw };\n const parsed = parseYaml(match[1] ?? \"\");\n const data =\n parsed !== null && typeof parsed === \"object\" && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : {};\n return { data, body: match[2] ?? \"\" };\n}\n\nfunction stringField(value: unknown): string | undefined {\n return typeof value === \"string\" && value.trim() ? value.trim() : undefined;\n}\n\nfunction recordField(value: unknown): Record<string, unknown> | undefined {\n return value !== null && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\nfunction resourceKind(path: string): \"reference\" | \"script\" | \"asset\" | \"file\" {\n if (path.startsWith(\"references/\")) return \"reference\";\n if (path.startsWith(\"scripts/\")) return \"script\";\n if (\n path.startsWith(\"assets/\") ||\n path.startsWith(\"graphics/\") ||\n path.startsWith(\"fonts/\") ||\n path.startsWith(\"templates/\") ||\n path.startsWith(\"rendered-files/\") ||\n path.startsWith(\"illustrations/\")\n ) {\n return \"asset\";\n }\n return \"file\";\n}\n\nconst TEXT_EXTENSIONS = new Set([\n \".bash\",\n \".css\",\n \".csv\",\n \".html\",\n \".js\",\n \".json\",\n \".jsx\",\n \".md\",\n \".mjs\",\n \".py\",\n \".sh\",\n \".svg\",\n \".ts\",\n \".tsx\",\n \".txt\",\n \".xml\",\n \".yaml\",\n \".yml\"\n]);\n\nconst MIME_TYPES = new Map([\n [\".css\", \"text/css\"],\n [\".gif\", \"image/gif\"],\n [\".html\", \"text/html\"],\n [\".jpg\", \"image/jpeg\"],\n [\".jpeg\", \"image/jpeg\"],\n [\".js\", \"text/javascript\"],\n [\".json\", \"application/json\"],\n [\".md\", \"text/markdown\"],\n [\".mjs\", \"text/javascript\"],\n [\".pdf\", \"application/pdf\"],\n [\".png\", \"image/png\"],\n [\".py\", \"text/x-python\"],\n [\".sh\", \"text/x-shellscript\"],\n [\".svg\", \"image/svg+xml\"],\n [\".ts\", \"text/typescript\"],\n [\".tsx\", \"text/typescript\"],\n [\".txt\", \"text/plain\"],\n [\".webp\", \"image/webp\"],\n [\".woff\", \"font/woff\"],\n [\".woff2\", \"font/woff2\"],\n [\".xml\", \"application/xml\"],\n [\".yaml\", \"application/yaml\"],\n [\".yml\", \"application/yaml\"]\n]);\n\nfunction extensionOf(path: string): string {\n const file = path.split(\"/\").at(-1) ?? path;\n const index = file.lastIndexOf(\".\");\n return index === -1 ? \"\" : file.slice(index).toLowerCase();\n}\n\nfunction resourceEncoding(path: string): \"text\" | \"base64\" {\n return TEXT_EXTENSIONS.has(extensionOf(path)) ? \"text\" : \"base64\";\n}\n\nfunction resourceMimeType(path: string): string | undefined {\n return MIME_TYPES.get(extensionOf(path));\n}\n\nasync function collectFiles(\n root: string,\n relativeRoot = \"\",\n warn?: (message: string) => void\n): Promise<Array<{ path: string; absolutePath: string; size: number }>> {\n const entries = await readdir(join(root, relativeRoot), {\n withFileTypes: true\n }).catch(() => []);\n const files: Array<{ path: string; absolutePath: string; size: number }> = [];\n\n for (const entry of entries) {\n if (SKILL_IGNORED_ROOTS.has(entry.name)) continue;\n const relativePath = relativeRoot\n ? `${relativeRoot}/${entry.name}`\n : entry.name;\n const absolutePath = join(root, relativePath);\n if (entry.isDirectory()) {\n const resourceRoot = relativePath.split(\"/\")[0];\n if (!resourceRoot || SKILL_IGNORED_ROOTS.has(resourceRoot)) continue;\n if (!SKILL_RESOURCE_ROOTS.has(resourceRoot)) {\n if (!relativeRoot) {\n warn?.(\n `Ignoring skill directory \"${relativePath}\". Bundled skill resources should live under references/, scripts/, assets/, or a known asset root.`\n );\n }\n continue;\n }\n if (!SPEC_RESOURCE_ROOTS.has(resourceRoot) && !relativeRoot) {\n warn?.(\n `Bundling non-standard skill resource root \"${resourceRoot}/\". Prefer assets/ for portable Agent Skills when possible.`\n );\n }\n files.push(...(await collectFiles(root, relativePath, warn)));\n } else if (entry.isFile() && relativePath !== \"SKILL.md\") {\n const resourceRoot = relativePath.split(\"/\")[0];\n if (!resourceRoot || SKILL_IGNORED_ROOTS.has(resourceRoot)) continue;\n if (!SKILL_RESOURCE_ROOTS.has(resourceRoot)) {\n warn?.(\n `Ignoring skill file \"${relativePath}\". Bundled skill resources should live under references/, scripts/, assets/, or a known asset root.`\n );\n continue;\n }\n const info = await stat(absolutePath);\n files.push({ path: relativePath, absolutePath, size: info.size });\n }\n }\n\n return files.sort((a, b) => a.path.localeCompare(b.path));\n}\n\nasync function collectWatchTargets(\n root: string,\n relativeRoot = \"\"\n): Promise<string[]> {\n const directory = join(root, relativeRoot);\n const entries = await readdir(directory, { withFileTypes: true }).catch(\n () => []\n );\n const targets = [directory];\n\n for (const entry of entries) {\n if (SKILL_IGNORED_ROOTS.has(entry.name)) continue;\n const relativePath = relativeRoot\n ? `${relativeRoot}/${entry.name}`\n : entry.name;\n const resourceRoot = relativePath.split(\"/\")[0];\n if (!resourceRoot || SKILL_IGNORED_ROOTS.has(resourceRoot)) continue;\n\n const absolutePath = join(root, relativePath);\n targets.push(absolutePath);\n\n if (entry.isDirectory()) {\n targets.push(...(await collectWatchTargets(root, relativePath)));\n }\n }\n\n return targets;\n}\n\nasync function readSkill(\n skillDir: string,\n warn?: (message: string) => void\n): Promise<SkillFile | null> {\n const skillPath = join(skillDir, \"SKILL.md\");\n const rawContent = await readFile(skillPath, \"utf8\").catch(() => null);\n if (rawContent === null) return null;\n\n const { data, body } = parseFrontmatter(rawContent);\n const name = stringField(data.name);\n const description = stringField(data.description);\n if (!name || !description) return null;\n\n const resources = await Promise.all(\n (await collectFiles(skillDir, \"\", warn)).map(async (file) => {\n const encoding = resourceEncoding(file.path);\n const bytes = await readFile(file.absolutePath);\n const kind = resourceKind(file.path);\n let content =\n encoding === \"base64\" ? bytes.toString(\"base64\") : bytes.toString();\n let precompiled = false;\n\n // Compile text script resources to self-contained JS at build time so the\n // runtime never needs an in-Worker bundler to run them.\n let size = file.size;\n if (\n kind === \"script\" &&\n encoding === \"text\" &&\n isCompilableSkillScript(file.path)\n ) {\n try {\n content = (await compileSkillScript(file.absolutePath)).content;\n precompiled = true;\n // The compiled bundle (which may inline sibling files and bundled\n // dependencies) is what actually ships, so report its size for the\n // bundle-size warnings rather than the raw source size.\n size = Buffer.byteLength(content);\n } catch (error) {\n warn?.(\n `Failed to compile skill script \"${file.path}\": ${\n error instanceof Error ? error.message : String(error)\n }. Skill scripts must be self-contained, compilable modules to run at runtime.`\n );\n }\n }\n\n return {\n path: file.path,\n kind,\n size,\n encoding,\n mimeType: resourceMimeType(file.path),\n content,\n precompiled\n };\n })\n );\n\n return {\n name,\n description,\n body,\n rawContent,\n compatibility: stringField(data.compatibility),\n license: stringField(data.license),\n allowedTools: stringField(data[\"allowed-tools\"]),\n metadata: recordField(data.metadata),\n resources\n };\n}\n\nasync function buildSkillsModule(\n dir: string,\n warn?: (message: string) => void\n): Promise<string> {\n const entries = await readdir(dir, { withFileTypes: true });\n const skills: SkillFile[] = [];\n const seen = new Set<string>();\n\n for (const entry of entries) {\n if (!entry.isDirectory()) continue;\n const skill = await readSkill(join(dir, entry.name), warn);\n if (!skill) continue;\n if (seen.has(skill.name)) {\n warn?.(\n `Duplicate bundled skill name \"${skill.name}\" in \"${entry.name}/\"; keeping the first occurrence and ignoring this one.`\n );\n continue;\n }\n seen.add(skill.name);\n skills.push(skill);\n }\n\n skills.sort((a, b) => a.name.localeCompare(b.name));\n\n let totalBytes = 0;\n for (const skill of skills) {\n for (const resource of skill.resources) {\n totalBytes += resource.size;\n if (resource.size > SKILL_ASSET_WARN_BYTES) {\n warn?.(\n `Bundled skill resource \"${skill.name}/${resource.path}\" is ${formatBytes(resource.size)}; large assets bloat the Worker bundle (base64, ~1.33x). Prefer an R2-backed source via skills.r2().`\n );\n }\n }\n }\n if (totalBytes > SKILL_BUNDLE_WARN_BYTES) {\n warn?.(\n `Bundled skills total ${formatBytes(totalBytes)} of embedded resources; this competes with the Worker bundle-size budget. Consider serving large skills from R2 via skills.r2().`\n );\n }\n\n const hash = createHash(\"sha256\");\n hash.update(JSON.stringify(skills));\n\n const manifest = {\n id: `bundle:${basename(dir)}`,\n fingerprint: hash.digest(\"hex\"),\n skills\n };\n\n return `const manifest = ${JSON.stringify(manifest)};\\nexport default {\\n id: manifest.id,\\n fingerprint: manifest.fingerprint,\\n async list() {\\n return manifest.skills.map(({ body, rawContent, resources, ...skill }) => skill);\\n },\\n async load(name) {\\n const skill = manifest.skills.find((entry) => entry.name === name);\\n if (!skill) return null;\\n return {\\n ...skill,\\n resources: skill.resources.map(({ content, ...resource }) => resource)\\n };\\n },\\n async readResource(name, path) {\\n const skill = manifest.skills.find((entry) => entry.name === name);\\n const resource = skill?.resources.find((entry) => entry.path === path);\\n return resource ? { ...resource } : null;\\n }\\n};\\n`;\n}\n\nconst TURNDOWN_STUB_ID = \"\\0agents:turndown-stub\";\nconst TURNDOWN_STUB_MESSAGE =\n \"The Agents Vite plugin stubbed the 'turndown' package to keep Workers \" +\n \"bundles compatible with just-bash. If your app uses turndown directly, \" +\n \"configure the plugin with agents({ stubTurndown: false }).\";\n\n// `just-bash` (pulled in by the workspace bash tool / skill runner) statically\n// depends on `turndown`, whose ESM build runs a top-level `require()` on its\n// Node DOM fallback. Workers is ESM with no global `require`, so the module\n// throws at startup — even when the bash tool is never used. turndown is only\n// needed by just-bash's niche `html-to-markdown` command, so we replace it with\n// a diagnostic stub by default to keep Workers deploys clean. Opt out with\n// `agents({ stubTurndown: false })` if you rely on turndown elsewhere.\nfunction turndownStubPlugin(): Plugin {\n return {\n name: \"agents-turndown-stub\",\n enforce: \"pre\",\n resolveId(source) {\n if (source === \"turndown\") return TURNDOWN_STUB_ID;\n return null;\n },\n load(id) {\n if (id !== TURNDOWN_STUB_ID) return null;\n return `const message = ${JSON.stringify(TURNDOWN_STUB_MESSAGE)};\nclass TurndownService {\n constructor() {}\n use() { return this; }\n addRule() { return this; }\n keep() { return this; }\n remove() { return this; }\n turndown() { throw new Error(message); }\n}\nexport default TurndownService;\n`;\n }\n };\n}\n\nfunction skillsImportPlugin(): Plugin {\n return {\n name: \"agents-skills-import\",\n async resolveId(source, importer) {\n // `agents:skills` resolves to a `./skills` directory next to the\n // importer; `agents:skills/<dir>` points at a sibling directory.\n if (\n source !== SKILLS_SPECIFIER &&\n !source.startsWith(`${SKILLS_SPECIFIER}/`)\n ) {\n return null;\n }\n if (!importer) return null;\n const relative =\n source === SKILLS_SPECIFIER\n ? \"skills\"\n : source.slice(SKILLS_SPECIFIER.length + 1);\n const resolved = resolve(importer, \"..\", relative);\n return `${SKILLS_VIRTUAL_PREFIX}${resolved}`;\n },\n async load(id) {\n if (!id.startsWith(SKILLS_VIRTUAL_PREFIX)) return null;\n const dir = id.slice(SKILLS_VIRTUAL_PREFIX.length);\n for (const target of await collectWatchTargets(dir)) {\n this.addWatchFile(target);\n }\n return buildSkillsModule(dir, (message) => this.warn(message));\n }\n };\n}\n\nexport interface AgentsPluginOptions {\n /**\n * Replace `turndown` with a diagnostic stub so `just-bash` (workspace bash\n * tool / skill runner) doesn't drag turndown's `require()`-using DOM fallback\n * into the Worker's module-init path and break deploys. Enabled by default.\n * Set to `false` if your app uses turndown directly and needs the real\n * implementation.\n */\n stubTurndown?: boolean;\n}\n\n/**\n * Vite plugin for Agents SDK projects.\n *\n * Handles TC39 decorator transforms (Oxc doesn't support them yet, oxc#9170) so\n * `@callable()` works at runtime, the `agents:skills` import transform, and\n * stubbing `turndown` to keep Workers deploys clean. Will grow to cover other\n * Agents-specific build concerns as needed.\n */\nexport default function agents(options: AgentsPluginOptions = {}): Plugin[] {\n const { stubTurndown = true } = options;\n return [\n ...(stubTurndown ? [turndownStubPlugin()] : []),\n skillsImportPlugin(),\n babel({\n presets: [\n {\n preset: () => ({\n plugins: [\n [\"@babel/plugin-proposal-decorators\", { version: \"2023-11\" }]\n ]\n }),\n rolldown: { filter: { code: \"@\" } }\n }\n ]\n }) as unknown as Plugin\n ];\n}\n"],"mappings":";;;;;;;AAQA,MAAM,mBAAmB;AACzB,MAAM,wBAAwB;AAC9B,MAAM,uCAAuB,IAAI,IAAI;CACnC;C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ACnB,MAAM,EACJ,SAAS,CACP;GACE,eAAe,EACb,SAAS,CACP,CAAC,qCAAqC,EAAE,SAAS,UAAU,CAAC,CAC9D,EACF;GACA,UAAU,EAAE,QAAQ,EAAE,MAAM,IAAI,EAAE;EACpC,CACF,EACF,CAAC;CACH;AACF"}
|
|
1
|
+
{"version":3,"file":"vite.js","names":[],"sources":["../src/vite.ts"],"sourcesContent":["import babel from \"@rolldown/plugin-babel\";\nimport type { Plugin } from \"vite\";\n\nconst TURNDOWN_STUB_ID = \"\\0agents:turndown-stub\";\nconst TURNDOWN_STUB_MESSAGE =\n \"The Agents Vite plugin stubbed the 'turndown' package to keep Workers \" +\n \"bundles compatible with just-bash. If your app uses turndown directly, \" +\n \"configure the plugin with agents({ stubTurndown: false }).\";\n\n// `just-bash` (pulled in by the workspace bash tool / skill runner) statically\n// depends on `turndown`, whose ESM build runs a top-level `require()` on its\n// Node DOM fallback. Workers is ESM with no global `require`, so the module\n// throws at startup — even when the bash tool is never used. turndown is only\n// needed by just-bash's niche `html-to-markdown` command, so we replace it with\n// a diagnostic stub by default to keep Workers deploys clean. Opt out with\n// `agents({ stubTurndown: false })` if you rely on turndown elsewhere.\nfunction turndownStubPlugin(): Plugin {\n return {\n name: \"agents-turndown-stub\",\n enforce: \"pre\",\n resolveId(source) {\n if (source === \"turndown\") return TURNDOWN_STUB_ID;\n return null;\n },\n load(id) {\n if (id !== TURNDOWN_STUB_ID) return null;\n return `const message = ${JSON.stringify(TURNDOWN_STUB_MESSAGE)};\nclass TurndownService {\n constructor() {}\n use() { return this; }\n addRule() { return this; }\n keep() { return this; }\n remove() { return this; }\n turndown() { throw new Error(message); }\n}\nexport default TurndownService;\n`;\n }\n };\n}\n\nconst REMOVED_SKILLS_IMPORT_MESSAGE =\n 'The \"agents:skills\" import has been removed. Skills are now files: store them in a Computer Workspace ' +\n \"and return skills.workspace(this.workspace) from getSkills(), or load them with skills.r2(bucket) or \" +\n \"skills.manifest({ id, skills }). See https://developers.cloudflare.com/agents/skills/\";\n\n// `agents:skills` used to bundle a skills directory at build time. Fail with\n// a migration message instead of Vite's generic \"failed to resolve import\".\nfunction removedSkillsImportPlugin(): Plugin {\n return {\n name: \"agents-removed-skills-import\",\n enforce: \"pre\",\n resolveId(source) {\n if (source === \"agents:skills\" || source.startsWith(\"agents:skills/\")) {\n this.error(REMOVED_SKILLS_IMPORT_MESSAGE);\n }\n return null;\n }\n };\n}\n\nexport interface AgentsPluginOptions {\n /**\n * Replace `turndown` with a diagnostic stub so `just-bash` (workspace bash\n * tool / skill runner) doesn't drag turndown's `require()`-using DOM fallback\n * into the Worker's module-init path and break deploys. Enabled by default.\n * Set to `false` if your app uses turndown directly and needs the real\n * implementation.\n */\n stubTurndown?: boolean;\n}\n\n/**\n * Vite plugin for Agents SDK projects.\n *\n * Handles TC39 decorator transforms (Oxc doesn't support them yet, oxc#9170) so\n * `@callable()` works at runtime, and stubs `turndown` to keep Workers\n * deploys clean. Will grow to cover other\n * Agents-specific build concerns as needed.\n */\nexport default function agents(options: AgentsPluginOptions = {}): Plugin[] {\n const { stubTurndown = true } = options;\n return [\n ...(stubTurndown ? [turndownStubPlugin()] : []),\n removedSkillsImportPlugin(),\n babel({\n presets: [\n {\n preset: () => ({\n plugins: [\n [\"@babel/plugin-proposal-decorators\", { version: \"2023-11\" }]\n ]\n }),\n rolldown: { filter: { code: \"@\" } }\n }\n ]\n }) as unknown as Plugin\n ];\n}\n"],"mappings":";;AAGA,MAAM,mBAAmB;AACzB,MAAM,wBACJ;AAWF,SAAS,qBAA6B;CACpC,OAAO;EACL,MAAM;EACN,SAAS;EACT,UAAU,QAAQ;GAChB,IAAI,WAAW,YAAY,OAAO;GAClC,OAAO;EACT;EACA,KAAK,IAAI;GACP,IAAI,OAAO,kBAAkB,OAAO;GACpC,OAAO,mBAAmB,KAAK,UAAU,qBAAqB,EAAE;;;;;;;;;;;EAWlE;CACF;AACF;AAEA,MAAM,gCACJ;AAMF,SAAS,4BAAoC;CAC3C,OAAO;EACL,MAAM;EACN,SAAS;EACT,UAAU,QAAQ;GAChB,IAAI,WAAW,mBAAmB,OAAO,WAAW,gBAAgB,GAClE,KAAK,MAAM,6BAA6B;GAE1C,OAAO;EACT;CACF;AACF;;;;;;;;;AAqBA,SAAwB,OAAO,UAA+B,CAAC,GAAa;CAC1E,MAAM,EAAE,eAAe,SAAS;CAChC,OAAO;EACL,GAAI,eAAe,CAAC,mBAAmB,CAAC,IAAI,CAAC;EAC7C,0BAA0B;EAC1B,MAAM,EACJ,SAAS,CACP;GACE,eAAe,EACb,SAAS,CACP,CAAC,qCAAqC,EAAE,SAAS,UAAU,CAAC,CAC9D,EACF;GACA,UAAU,EAAE,QAAQ,EAAE,MAAM,IAAI,EAAE;EACpC,CACF,EACF,CAAC;CACH;AACF"}
|
package/dist/voice/index.d.ts
CHANGED
package/dist/websockets/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as isCapnWebTransportUpgrade, i as capnWebTransportUrl, r as CAPNWEB_TRANSPORT_VALUE, t as CAPNWEB_TRANSPORT_QUERY } from "../transport-protocol-BxyngQ_R.js";
|
|
2
|
-
import { l as registerInternalConnectionKeys, n as CF_NO_PROTOCOL_KEY, r as CF_READONLY_KEY, t as WebSockets } from "../websockets-
|
|
2
|
+
import { l as registerInternalConnectionKeys, n as CF_NO_PROTOCOL_KEY, r as CF_READONLY_KEY, t as WebSockets } from "../websockets-C6SJtWCJ.js";
|
|
3
3
|
export { CAPNWEB_TRANSPORT_QUERY, CAPNWEB_TRANSPORT_VALUE, CF_NO_PROTOCOL_KEY, CF_READONLY_KEY, WebSockets, capnWebTransportUrl, isCapnWebTransportUpgrade, registerInternalConnectionKeys };
|
|
@@ -4,7 +4,6 @@ import { a as isCapnWebTransportUpgrade, n as CAPNWEB_TRANSPORT_SEND } from "./t
|
|
|
4
4
|
import { i as _classPrivateFieldInitSpec, n as _classPrivateFieldSet2, r as _assertClassBrand, t as _classPrivateFieldGet2 } from "./classPrivateFieldGet2-DZBYAB34.js";
|
|
5
5
|
import { t as _classPrivateMethodInitSpec } from "./classPrivateMethodInitSpec-qMjJ6sHQ.js";
|
|
6
6
|
import { t as LifecycleCapability } from "./capability-DBAKc6UZ.js";
|
|
7
|
-
import "./lifecycle-v1rKHV2C.js";
|
|
8
7
|
import { newWebSocketRpcSession } from "capnweb";
|
|
9
8
|
import { RpcTarget as RpcTarget$1 } from "cloudflare:workers";
|
|
10
9
|
import { nanoid } from "nanoid";
|
|
@@ -1039,4 +1038,4 @@ async function _dispatchCallable(name, invoke, connection) {
|
|
|
1039
1038
|
//#endregion
|
|
1040
1039
|
export { getConnectionFlag as a, isConnectionReadonly as c, setConnectionProtocolEnabled as d, setConnectionReadonly as f, ensureConnectionWrapped as i, registerInternalConnectionKeys as l, CF_NO_PROTOCOL_KEY as n, getConnectionRawState as o, CF_READONLY_KEY as r, isConnectionProtocolEnabled as s, WebSockets as t, setConnectionFlag as u };
|
|
1041
1040
|
|
|
1042
|
-
//# sourceMappingURL=websockets-
|
|
1041
|
+
//# sourceMappingURL=websockets-C6SJtWCJ.js.map
|