agents 0.0.0-6de101a → 0.0.0-6e0420c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +255 -27
  2. package/dist/ai-chat-agent.d.ts +59 -11
  3. package/dist/ai-chat-agent.js +548 -163
  4. package/dist/ai-chat-agent.js.map +1 -1
  5. package/dist/ai-chat-v5-migration-gdyLiTd8.js +155 -0
  6. package/dist/ai-chat-v5-migration-gdyLiTd8.js.map +1 -0
  7. package/dist/ai-chat-v5-migration.d.ts +155 -0
  8. package/dist/ai-chat-v5-migration.js +3 -0
  9. package/dist/ai-react.d.ts +73 -72
  10. package/dist/ai-react.js +260 -183
  11. package/dist/ai-react.js.map +1 -1
  12. package/dist/ai-types-B0GBFDwi.js +20 -0
  13. package/dist/ai-types-B0GBFDwi.js.map +1 -0
  14. package/dist/ai-types-BWW4umHY.d.ts +95 -0
  15. package/dist/ai-types.d.ts +6 -69
  16. package/dist/ai-types.js +3 -1
  17. package/dist/client-C-u-lCFT.d.ts +5311 -0
  18. package/dist/client-CmMi85Sj.d.ts +104 -0
  19. package/dist/client-WbaRgKYN.js +788 -0
  20. package/dist/client-WbaRgKYN.js.map +1 -0
  21. package/dist/client-zS-OCVJA.js +117 -0
  22. package/dist/client-zS-OCVJA.js.map +1 -0
  23. package/dist/client.d.ts +12 -79
  24. package/dist/client.js +4 -131
  25. package/dist/codemode/ai.d.ts +27 -0
  26. package/dist/codemode/ai.js +151 -0
  27. package/dist/codemode/ai.js.map +1 -0
  28. package/dist/do-oauth-client-provider-B2jr6UNq.js +93 -0
  29. package/dist/do-oauth-client-provider-B2jr6UNq.js.map +1 -0
  30. package/dist/do-oauth-client-provider-CCwGwnrA.d.ts +55 -0
  31. package/dist/index-DWcUTPtX.d.ts +558 -0
  32. package/dist/index-W4JUkafc.d.ts +54 -0
  33. package/dist/index.d.ts +63 -301
  34. package/dist/index.js +7 -21
  35. package/dist/mcp/client.d.ts +4 -675
  36. package/dist/mcp/client.js +2 -785
  37. package/dist/mcp/do-oauth-client-provider.d.ts +2 -0
  38. package/dist/mcp/do-oauth-client-provider.js +3 -0
  39. package/dist/mcp/index.d.ts +73 -39
  40. package/dist/mcp/index.js +841 -129
  41. package/dist/mcp/index.js.map +1 -1
  42. package/dist/mcp/x402.d.ts +34 -0
  43. package/dist/mcp/x402.js +194 -0
  44. package/dist/mcp/x402.js.map +1 -0
  45. package/dist/mcp-BEwaCsxO.d.ts +61 -0
  46. package/dist/observability/index.d.ts +3 -0
  47. package/dist/observability/index.js +7 -0
  48. package/dist/react-B8BT6PYZ.d.ts +113 -0
  49. package/dist/react.d.ts +10 -39
  50. package/dist/react.js +185 -91
  51. package/dist/react.js.map +1 -1
  52. package/dist/schedule.d.ts +89 -12
  53. package/dist/schedule.js +46 -21
  54. package/dist/schedule.js.map +1 -1
  55. package/dist/serializable-gtr9YMhp.d.ts +34 -0
  56. package/dist/serializable.d.ts +7 -0
  57. package/dist/serializable.js +1 -0
  58. package/dist/src-C9xZ0CrH.js +1179 -0
  59. package/dist/src-C9xZ0CrH.js.map +1 -0
  60. package/package.json +114 -52
  61. package/src/index.ts +1268 -156
  62. package/dist/ai-types.js.map +0 -1
  63. package/dist/chunk-EZ76ZGDB.js +0 -1721
  64. package/dist/chunk-EZ76ZGDB.js.map +0 -1
  65. package/dist/chunk-SZEXGW6W.js +0 -580
  66. package/dist/chunk-SZEXGW6W.js.map +0 -1
  67. package/dist/client.js.map +0 -1
  68. package/dist/index.js.map +0 -1
  69. package/dist/mcp/client.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import { AgentsOAuthProvider, DurableObjectOAuthClientProvider } from "../do-oauth-client-provider-CCwGwnrA.js";
2
+ export { AgentsOAuthProvider, DurableObjectOAuthClientProvider };
@@ -0,0 +1,3 @@
1
+ import { DurableObjectOAuthClientProvider } from "../do-oauth-client-provider-B2jr6UNq.js";
2
+
3
+ export { DurableObjectOAuthClientProvider };
@@ -1,41 +1,75 @@
1
- import { DurableObject } from 'cloudflare:workers';
2
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
- import { Connection } from 'partyserver';
1
+ import { BaseTransportType, MCPClientOAuthCallbackConfig, MCPClientOAuthResult, MaybePromise, SSEEdgeClientTransport, ServeOptions, StreamableHTTPEdgeClientTransport } from "../client-C-u-lCFT.js";
2
+ import "../mcp-BEwaCsxO.js";
3
+ import "../do-oauth-client-provider-CCwGwnrA.js";
4
+ import "../index-W4JUkafc.js";
5
+ import "../ai-types-BWW4umHY.js";
6
+ import { Agent, Connection, ConnectionContext } from "../index-DWcUTPtX.js";
7
+ import { ElicitRequest, ElicitRequestSchema, ElicitResult, ElicitResult as ElicitResult$1, JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";
8
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
9
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
10
 
5
- interface CORSOptions {
6
- origin?: string;
7
- methods?: string;
8
- headers?: string;
9
- maxAge?: number;
11
+ //#region src/mcp/index.d.ts
12
+ declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends Agent<Env, State, Props> {
13
+ private _transport?;
14
+ props?: Props;
15
+ abstract server: MaybePromise<McpServer | Server>;
16
+ abstract init(): Promise<void>;
17
+ setInitializeRequest(initializeRequest: JSONRPCMessage): Promise<void>;
18
+ getInitializeRequest(): Promise<JSONRPCMessage | undefined>;
19
+ /** Read the transport type for this agent.
20
+ * This relies on the naming scheme being `sse:${sessionId}`
21
+ * or `streamable-http:${sessionId}`.
22
+ */
23
+ getTransportType(): BaseTransportType;
24
+ /** Read the sessionId for this agent.
25
+ * This relies on the naming scheme being `sse:${sessionId}`
26
+ * or `streamable-http:${sessionId}`.
27
+ */
28
+ getSessionId(): string;
29
+ /** Get the unique WebSocket. SSE transport only. */
30
+ private getWebSocket;
31
+ /** Returns a new transport matching the type of the Agent. */
32
+ private initTransport;
33
+ /** Update and store the props */
34
+ updateProps(props?: Props): Promise<void>;
35
+ reinitializeServer(): Promise<void>;
36
+ /** Sets up the MCP transport and server every time the Agent is started.*/
37
+ onStart(props?: Props): Promise<void>;
38
+ /** Validates new WebSocket connections. */
39
+ onConnect(conn: Connection, {
40
+ request: req
41
+ }: ConnectionContext): Promise<void>;
42
+ /** Handles MCP Messages for the legacy SSE transport. */
43
+ onSSEMcpMessage(_sessionId: string, messageBody: unknown): Promise<Error | null>;
44
+ /** Elicit user input with a message and schema */
45
+ elicitInput(params: {
46
+ message: string;
47
+ requestedSchema: unknown;
48
+ }): Promise<ElicitResult$1>;
49
+ /** Wait for elicitation response through storage polling */
50
+ private _waitForElicitationResponse;
51
+ /** Handle elicitation responses */
52
+ private _handleElicitationResponse;
53
+ /** Return a handler for the given path for this MCP.
54
+ * Defaults to Streamable HTTP transport.
55
+ */
56
+ static serve(path: string, {
57
+ binding,
58
+ corsOptions,
59
+ transport
60
+ }?: ServeOptions): {
61
+ fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
62
+ };
63
+ /**
64
+ * Legacy api
65
+ **/
66
+ static mount(path: string, opts?: Omit<ServeOptions, "transport">): {
67
+ fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
68
+ };
69
+ static serveSSE(path: string, opts?: Omit<ServeOptions, "transport">): {
70
+ fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
71
+ };
10
72
  }
11
- declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends DurableObject<Env> {
12
- #private;
13
- protected constructor(ctx: DurableObjectState, env: Env);
14
- /**
15
- * Agents API allowlist
16
- */
17
- initialState: State;
18
- get state(): State;
19
- sql<T = Record<string, string | number | boolean | null>>(strings: TemplateStringsArray, ...values: (string | number | boolean | null)[]): T[];
20
- setState(state: State): void;
21
- onStateUpdate(state: State | undefined, source: Connection | "server"): void;
22
- /**
23
- * McpAgent API
24
- */
25
- abstract server: McpServer;
26
- private transport;
27
- props: Props;
28
- initRun: boolean;
29
- abstract init(): Promise<void>;
30
- _init(props: Props): Promise<void>;
31
- onSSE(path: string): Promise<Response>;
32
- onMCPMessage(request: Request): Promise<Response>;
33
- static mount(path: string, { binding, corsOptions, }?: {
34
- binding?: string;
35
- corsOptions?: CORSOptions;
36
- }): {
37
- fetch: (request: Request, env: Record<string, DurableObjectNamespace<McpAgent>>, ctx: ExecutionContext) => Promise<Response>;
38
- };
39
- }
40
-
41
- export { McpAgent };
73
+ //#endregion
74
+ export { type ElicitRequest, ElicitRequestSchema, type ElicitResult, type MCPClientOAuthCallbackConfig, type MCPClientOAuthResult, McpAgent, SSEEdgeClientTransport, StreamableHTTPEdgeClientTransport };
75
+ //# sourceMappingURL=index.d.ts.map