agents 0.14.4 → 0.15.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/{agent-tool-types-V25Z_HcX.d.ts → agent-tool-types-VPsjVYL0.d.ts} +126 -109
- package/dist/agent-tool-types.d.ts +1 -1
- package/dist/{agent-tools-C-9s151X.d.ts → agent-tools-BGpgfpJT.d.ts} +2 -2
- package/dist/agent-tools.d.ts +1 -1
- package/dist/chat/index.d.ts +2 -2
- package/dist/chat-sdk/index.d.ts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/client.d.ts +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +261 -486
- package/dist/mcp/index.js.map +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/serializable.d.ts +1 -1
- package/dist/skills/compile.d.ts +40 -0
- package/dist/skills/compile.js +65 -0
- package/dist/skills/compile.js.map +1 -0
- package/dist/skills/index.d.ts +8 -0
- package/dist/skills/index.js +20 -23
- package/dist/skills/index.js.map +1 -1
- package/dist/sub-routing.d.ts +1 -1
- package/dist/utils-CGtGDSgA.d.ts +34 -0
- package/dist/utils.d.ts +5 -29
- package/dist/vite.js +16 -3
- package/dist/vite.js.map +1 -1
- package/dist/workflows.d.ts +1 -1
- package/package.json +7 -6
|
@@ -60,6 +60,12 @@ import {
|
|
|
60
60
|
Tool as Tool$1
|
|
61
61
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
62
62
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
63
|
+
import {
|
|
64
|
+
EventStore as EventStore$1,
|
|
65
|
+
StreamId as StreamId$1,
|
|
66
|
+
WebStandardStreamableHTTPServerTransport,
|
|
67
|
+
WebStandardStreamableHTTPServerTransportOptions
|
|
68
|
+
} from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
63
69
|
import { RequestOptions } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
64
70
|
import {
|
|
65
71
|
Transport,
|
|
@@ -72,10 +78,7 @@ import {
|
|
|
72
78
|
EventStore,
|
|
73
79
|
StreamId
|
|
74
80
|
} from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
75
|
-
import {
|
|
76
|
-
EventStore as EventStore$1,
|
|
77
|
-
StreamId as StreamId$1
|
|
78
|
-
} from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
81
|
+
import { AuthInfo } from "@modelcontextprotocol/sdk/server/auth/types.js";
|
|
79
82
|
|
|
80
83
|
//#region src/sub-routing.d.ts
|
|
81
84
|
/**
|
|
@@ -240,136 +243,150 @@ declare class StreamableHTTPEdgeClientTransport extends StreamableHTTPClientTran
|
|
|
240
243
|
}
|
|
241
244
|
//#endregion
|
|
242
245
|
//#region src/mcp/worker-transport.d.ts
|
|
246
|
+
/**
|
|
247
|
+
* Pluggable storage adapter for persisting `WorkerTransport` state across
|
|
248
|
+
* Durable Object hibernation / restart cycles.
|
|
249
|
+
*
|
|
250
|
+
* A typical implementation reads/writes a single key on `this.ctx.storage`
|
|
251
|
+
* inside a Durable Object or Agent.
|
|
252
|
+
*/
|
|
243
253
|
interface MCPStorageApi {
|
|
244
254
|
get(): Promise<TransportState | undefined> | TransportState | undefined;
|
|
245
255
|
set(state: TransportState): Promise<void> | void;
|
|
246
256
|
}
|
|
257
|
+
/** Shape of the persisted transport state. */
|
|
247
258
|
interface TransportState {
|
|
248
259
|
sessionId?: string;
|
|
249
260
|
initialized: boolean;
|
|
250
261
|
initializeParams?: InitializeRequestParams;
|
|
251
262
|
}
|
|
252
|
-
interface WorkerTransportOptions {
|
|
253
|
-
/**
|
|
254
|
-
* Function that generates a session ID for the transport.
|
|
255
|
-
* The session ID SHOULD be globally unique and cryptographically secure.
|
|
256
|
-
* Return undefined to disable session management (stateless mode).
|
|
257
|
-
*/
|
|
258
|
-
sessionIdGenerator?: () => string;
|
|
259
|
-
/**
|
|
260
|
-
* Enable traditional Request/Response mode, this will disable streaming.
|
|
261
|
-
*/
|
|
262
|
-
enableJsonResponse?: boolean;
|
|
263
|
-
/**
|
|
264
|
-
* Callback fired when a new session is initialized.
|
|
265
|
-
*/
|
|
266
|
-
onsessioninitialized?: (sessionId: string) => void;
|
|
263
|
+
interface WorkerTransportOptions extends WebStandardStreamableHTTPServerTransportOptions {
|
|
267
264
|
/**
|
|
268
|
-
*
|
|
265
|
+
* CORS options applied to every response and to OPTIONS preflight.
|
|
266
|
+
* Defaults: `origin: *`, expose `mcp-session-id`, allow the standard MCP
|
|
267
|
+
* methods/headers, max-age 86400.
|
|
269
268
|
*/
|
|
270
|
-
onsessionclosed?: (sessionId: string) => void;
|
|
271
269
|
corsOptions?: CORSOptions;
|
|
272
270
|
/**
|
|
273
|
-
* Optional storage
|
|
274
|
-
* Use this to
|
|
275
|
-
*
|
|
271
|
+
* Optional storage adapter for persisting transport state across DO
|
|
272
|
+
* hibernation / restart. Use this to keep an MCP session alive across
|
|
273
|
+
* Durable Object wake-ups.
|
|
276
274
|
*/
|
|
277
275
|
storage?: MCPStorageApi;
|
|
278
|
-
/**
|
|
279
|
-
* Event store for SSE resumability.
|
|
280
|
-
*
|
|
281
|
-
* When set, the transport assigns a globally-unique `id:` to each SSE
|
|
282
|
-
* event and replays missed events when a client reconnects with the
|
|
283
|
-
* `Last-Event-ID` header. Both GET (standalone listen stream) and POST
|
|
284
|
-
* (tool response stream) events are stored and replayable per the
|
|
285
|
-
* MCP 2025-03-26 spec.
|
|
286
|
-
*
|
|
287
|
-
* Configuring an event store **disables the server-side keepalive**
|
|
288
|
-
* on the standalone GET stream — idle drops are recovered by
|
|
289
|
-
* reconnect rather than prevented by writing bytes. Without an event
|
|
290
|
-
* store, the GET stream still gets the 25s comment-frame keepalive
|
|
291
|
-
* so long-lived idle listeners aren't closed by the Cloudflare edge
|
|
292
|
-
* ~5min watchdog.
|
|
293
|
-
*
|
|
294
|
-
* POST response streams always get the keepalive regardless of this
|
|
295
|
-
* setting: in-progress tool calls have no way to recover
|
|
296
|
-
* mid-execution without staying connected, so we don't let the
|
|
297
|
-
* stream drop in the first place.
|
|
298
|
-
*
|
|
299
|
-
* Bring your own {@link EventStore} implementation — e.g.
|
|
300
|
-
* `new DurableObjectEventStore(this.ctx.storage)` when embedding
|
|
301
|
-
* `WorkerTransport` inside a Durable Object / Agent. See
|
|
302
|
-
* cloudflare/agents#1583.
|
|
303
|
-
*/
|
|
304
|
-
eventStore?: EventStore;
|
|
305
|
-
/**
|
|
306
|
-
* Retry interval in milliseconds to suggest to clients in SSE retry field.
|
|
307
|
-
* Controls client reconnection timing for polling behavior.
|
|
308
|
-
*/
|
|
309
|
-
retryInterval?: number;
|
|
310
276
|
}
|
|
311
|
-
declare class WorkerTransport
|
|
312
|
-
|
|
313
|
-
private
|
|
314
|
-
private
|
|
315
|
-
private
|
|
316
|
-
private
|
|
317
|
-
private
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
private
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
277
|
+
declare class WorkerTransport extends WebStandardStreamableHTTPServerTransport {
|
|
278
|
+
private readonly _corsOptions?;
|
|
279
|
+
private readonly _storage?;
|
|
280
|
+
private _stateRestored;
|
|
281
|
+
private _capturedInitializeParams?;
|
|
282
|
+
private _userOnSessionInitialized?;
|
|
283
|
+
private _bridgeInstalled;
|
|
284
|
+
/**
|
|
285
|
+
* Tracks keepalive interval cleanups so we can fire them eagerly when the
|
|
286
|
+
* SDK closes the underlying SSE stream via `closeSSEStream(requestId)` or
|
|
287
|
+
* `closeStandaloneSSEStream()`. Keyed by the JSON-RPC request id that
|
|
288
|
+
* triggered the stream, or the sentinel for the standalone GET stream.
|
|
289
|
+
*/
|
|
290
|
+
private readonly _keepaliveCleanups;
|
|
291
|
+
/**
|
|
292
|
+
* Most recent JSON-RPC request id seen on an incoming POST. Used to key
|
|
293
|
+
* keepalive cleanups when the response is an SSE stream tied to that
|
|
294
|
+
* request (so `closeSSEStream(id)` can find and clear the interval).
|
|
295
|
+
*/
|
|
296
|
+
private _pendingRequestId?;
|
|
297
|
+
/**
|
|
298
|
+
* Request ids whose SSE stream was deliberately torn down via
|
|
299
|
+
* `closeSSEStream`. The SDK's `send()` throws "No connection established"
|
|
300
|
+
* when a request id has no stream — a race that surfaces whenever the
|
|
301
|
+
* server's tool handler resolves *after* the caller closed the stream
|
|
302
|
+
* (e.g. polling-style early-close, or test fixtures closing mid-flight).
|
|
303
|
+
* We swallow `send()` for these ids so the rejection doesn't bubble out
|
|
304
|
+
* of the protocol layer as an unhandled rejection. Mirrors the
|
|
305
|
+
* silent-noop behaviour of the pre-refactor `WorkerTransport`.
|
|
306
|
+
*/
|
|
307
|
+
private readonly _closedRequestIds;
|
|
332
308
|
constructor(options?: WorkerTransportOptions);
|
|
333
309
|
/**
|
|
334
|
-
*
|
|
335
|
-
*
|
|
310
|
+
* Backwards-compatible alias for the SDK's internal `_started` flag.
|
|
311
|
+
* Several callers and tests check `transport.started` directly.
|
|
336
312
|
*/
|
|
337
|
-
|
|
313
|
+
get started(): boolean;
|
|
338
314
|
/**
|
|
339
|
-
*
|
|
315
|
+
* Top-level request entry point. Handles CORS preflight, restores any
|
|
316
|
+
* persisted state on first invocation, then delegates to the SDK transport
|
|
317
|
+
* and finally appends CORS headers + keepalive to whatever response comes
|
|
318
|
+
* back.
|
|
340
319
|
*/
|
|
341
|
-
|
|
342
|
-
|
|
320
|
+
handleRequest(
|
|
321
|
+
request: Request,
|
|
322
|
+
options?: {
|
|
323
|
+
parsedBody?: unknown;
|
|
324
|
+
authInfo?: AuthInfo;
|
|
325
|
+
}
|
|
326
|
+
): Promise<Response>;
|
|
343
327
|
/**
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
*
|
|
352
|
-
* - Header present and supported: Accept
|
|
353
|
-
* - Header present and unsupported: 400 Bad Request
|
|
354
|
-
* - Header missing: Accept (version validation is optional)
|
|
355
|
-
*/
|
|
356
|
-
private validateProtocolVersion;
|
|
357
|
-
private getHeaders;
|
|
358
|
-
handleRequest(request: Request, parsedBody?: unknown): Promise<Response>;
|
|
359
|
-
private handleGetRequest;
|
|
360
|
-
private handlePostRequest;
|
|
361
|
-
private handleDeleteRequest;
|
|
362
|
-
private handleOptionsRequest;
|
|
363
|
-
private handleUnsupportedRequest;
|
|
364
|
-
private validateSession;
|
|
328
|
+
* The SDK's 405 responses advertise `Allow: GET, POST, DELETE` because
|
|
329
|
+
* OPTIONS is handled outside the SDK. Since our wrapper *does* handle
|
|
330
|
+
* OPTIONS, advertise it in `Allow` so clients can probe accurately.
|
|
331
|
+
*/
|
|
332
|
+
private normalizeAllowHeader;
|
|
333
|
+
closeSSEStream(requestId: RequestId): void;
|
|
334
|
+
closeStandaloneSSEStream(): void;
|
|
365
335
|
close(): Promise<void>;
|
|
366
336
|
/**
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
337
|
+
* Swallow two classes of message that would otherwise surface as
|
|
338
|
+
* unhandled rejections from the SDK transport's `send()`:
|
|
339
|
+
*
|
|
340
|
+
* 1. Replayed initialize responses (the `RESTORE_REQUEST_ID` sentinel)
|
|
341
|
+
* — we synthesise these in `restoreState()` to rebuild server
|
|
342
|
+
* capabilities; there's no real client waiting for the response.
|
|
343
|
+
* 2. Sends for a request id whose SSE stream has been deliberately
|
|
344
|
+
* closed via `closeSSEStream`. The protocol layer's tool-handler
|
|
345
|
+
* promise may settle after the close, and the SDK's `send()` throws
|
|
346
|
+
* "No connection established" — a race the pre-refactor transport
|
|
347
|
+
* silently swallowed.
|
|
348
|
+
*
|
|
349
|
+
* Everything else is delegated. We use `await super.send(...)` rather
|
|
350
|
+
* than `return super.send(...)` so any rejection is observed inside this
|
|
351
|
+
* async frame; without the await, the test runner's
|
|
352
|
+
* unhandled-rejection tracker can fire before the caller's own `await`
|
|
353
|
+
* observes it.
|
|
370
354
|
*/
|
|
371
|
-
closeSSEStream(requestId: RequestId): void;
|
|
372
355
|
send(message: JSONRPCMessage, options?: TransportSendOptions): Promise<void>;
|
|
356
|
+
/**
|
|
357
|
+
* If the response is an SSE stream, tee the body through a TransformStream
|
|
358
|
+
* that injects a `: keepalive\n\n` comment frame every 25s. The interval
|
|
359
|
+
* is cleared when the wrapped stream closes — which happens both when the
|
|
360
|
+
* SDK ends the underlying stream naturally and when `closeSSEStream` is
|
|
361
|
+
* called.
|
|
362
|
+
*
|
|
363
|
+
* Keepalive policy:
|
|
364
|
+
* - POST response streams (`key` is a request id): always keepalive.
|
|
365
|
+
* In-progress tool calls have no recovery path — if the stream drops
|
|
366
|
+
* mid-execution the result is lost — so we keep it under the
|
|
367
|
+
* Cloudflare edge ~5min idle watchdog.
|
|
368
|
+
* - Standalone GET stream (`key === "_standalone"`): keepalive only
|
|
369
|
+
* when no `eventStore` is configured. When resumability is enabled,
|
|
370
|
+
* clients reconnect with `Last-Event-ID` after an idle drop, so we
|
|
371
|
+
* skip the keepalive and let the DO hibernate.
|
|
372
|
+
*
|
|
373
|
+
* Uses the shared `sse-keepalive` constants so both this wrapper and
|
|
374
|
+
* `McpAgent.serve()` write identical frames at the same cadence.
|
|
375
|
+
* See cloudflare/agents#1583.
|
|
376
|
+
*/
|
|
377
|
+
private withKeepalive;
|
|
378
|
+
/**
|
|
379
|
+
* Does the SDK transport have an `eventStore`? Reaches into the SDK's
|
|
380
|
+
* private field because the option isn't surfaced on the public API —
|
|
381
|
+
* we only need a yes/no for keepalive policy.
|
|
382
|
+
*/
|
|
383
|
+
private eventStoreConfigured;
|
|
384
|
+
private getCorsHeaders;
|
|
385
|
+
private withCorsHeaders;
|
|
386
|
+
private installOnSessionInitializedBridge;
|
|
387
|
+
private captureInitializeParams;
|
|
388
|
+
private restoreState;
|
|
389
|
+
private saveState;
|
|
373
390
|
}
|
|
374
391
|
//#endregion
|
|
375
392
|
//#region src/mcp/auth-context.d.ts
|
|
@@ -4777,4 +4794,4 @@ export {
|
|
|
4777
4794
|
MCPServer as z,
|
|
4778
4795
|
WorkerTransport as zt
|
|
4779
4796
|
};
|
|
4780
|
-
//# sourceMappingURL=agent-tool-types-
|
|
4797
|
+
//# sourceMappingURL=agent-tool-types-VPsjVYL0.d.ts.map
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
s as AgentToolInterruptedReason,
|
|
17
17
|
t as AgentToolChildAdapter,
|
|
18
18
|
u as AgentToolRunInspection
|
|
19
|
-
} from "./agent-tool-types-
|
|
19
|
+
} from "./agent-tool-types-VPsjVYL0.js";
|
|
20
20
|
export {
|
|
21
21
|
AgentToolChildAdapter,
|
|
22
22
|
AgentToolDisplayMetadata,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
a as AgentToolEventState,
|
|
3
3
|
i as AgentToolEventMessage
|
|
4
|
-
} from "./agent-tool-types-
|
|
4
|
+
} from "./agent-tool-types-VPsjVYL0.js";
|
|
5
5
|
|
|
6
6
|
//#region src/chat/agent-tools.d.ts
|
|
7
7
|
declare function createAgentToolEventState(): AgentToolEventState;
|
|
@@ -11,4 +11,4 @@ declare function applyAgentToolEvent(
|
|
|
11
11
|
): AgentToolEventState;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { createAgentToolEventState as n, applyAgentToolEvent as t };
|
|
14
|
-
//# sourceMappingURL=agent-tools-
|
|
14
|
+
//# sourceMappingURL=agent-tools-BGpgfpJT.d.ts.map
|
package/dist/agent-tools.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
s as AgentToolInterruptedReason,
|
|
17
17
|
t as AgentToolChildAdapter,
|
|
18
18
|
u as AgentToolRunInspection
|
|
19
|
-
} from "./agent-tool-types-
|
|
19
|
+
} from "./agent-tool-types-VPsjVYL0.js";
|
|
20
20
|
import { Tool } from "ai";
|
|
21
21
|
|
|
22
22
|
//#region src/agent-tools.d.ts
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
d as AgentToolRunState,
|
|
4
4
|
i as AgentToolEventMessage,
|
|
5
5
|
r as AgentToolEvent
|
|
6
|
-
} from "../agent-tool-types-
|
|
6
|
+
} from "../agent-tool-types-VPsjVYL0.js";
|
|
7
7
|
import {
|
|
8
8
|
n as createAgentToolEventState,
|
|
9
9
|
t as applyAgentToolEvent
|
|
10
|
-
} from "../agent-tools-
|
|
10
|
+
} from "../agent-tools-BGpgfpJT.js";
|
|
11
11
|
import { JSONSchema7, Tool, ToolSet, UIMessage } from "ai";
|
|
12
12
|
import { Connection } from "agents";
|
|
13
13
|
|
package/dist/chat-sdk/index.d.ts
CHANGED
package/dist/client.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -71,7 +71,8 @@ import {
|
|
|
71
71
|
xt as normalizeServerId,
|
|
72
72
|
y as AddRpcMcpServerOptions,
|
|
73
73
|
z as MCPServer
|
|
74
|
-
} from "./agent-tool-types-
|
|
74
|
+
} from "./agent-tool-types-VPsjVYL0.js";
|
|
75
|
+
import { n as camelCaseToKebabCase } from "./utils-CGtGDSgA.js";
|
|
75
76
|
import { t as RetryOptions } from "./retries-CF_HKSlJ.js";
|
|
76
77
|
import {
|
|
77
78
|
n as AgentsOAuthProvider,
|
|
@@ -148,6 +149,7 @@ export {
|
|
|
148
149
|
type WSMessage,
|
|
149
150
|
__DO_NOT_USE_WILL_BREAK__agentContext,
|
|
150
151
|
callable,
|
|
152
|
+
camelCaseToKebabCase,
|
|
151
153
|
createHeaderBasedEmailResolver,
|
|
152
154
|
getAgentByName,
|
|
153
155
|
getCurrentAgent,
|
package/dist/index.js
CHANGED
|
@@ -6374,6 +6374,6 @@ var StreamingResponse = class {
|
|
|
6374
6374
|
}
|
|
6375
6375
|
};
|
|
6376
6376
|
//#endregion
|
|
6377
|
-
export { Agent, DEFAULT_AGENT_STATIC_OPTIONS, DurableObjectOAuthClientProvider, MCP_SERVER_ID_MAX_LENGTH, MessageType, SUB_PREFIX, SqlError, StreamingResponse, __DO_NOT_USE_WILL_BREAK__agentContext, callable, createHeaderBasedEmailResolver, getAgentByName, getCurrentAgent, getSubAgentByName, normalizeServerId, parseSubAgentPath, routeAgentEmail, routeAgentRequest, routeSubAgentRequest, unstable_callable };
|
|
6377
|
+
export { Agent, DEFAULT_AGENT_STATIC_OPTIONS, DurableObjectOAuthClientProvider, MCP_SERVER_ID_MAX_LENGTH, MessageType, SUB_PREFIX, SqlError, StreamingResponse, __DO_NOT_USE_WILL_BREAK__agentContext, callable, camelCaseToKebabCase, createHeaderBasedEmailResolver, getAgentByName, getCurrentAgent, getSubAgentByName, normalizeServerId, parseSubAgentPath, routeAgentEmail, routeAgentRequest, routeSubAgentRequest, unstable_callable };
|
|
6378
6378
|
|
|
6379
6379
|
//# sourceMappingURL=index.js.map
|