agents 0.3.0 → 0.3.2

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 (67) hide show
  1. package/README.md +12 -326
  2. package/dist/ai-chat-agent.d.ts +1 -324
  3. package/dist/ai-chat-agent.js +3 -1147
  4. package/dist/ai-chat-agent.js.map +1 -1
  5. package/dist/ai-chat-v5-migration.d.ts +1 -155
  6. package/dist/ai-chat-v5-migration.js +4 -151
  7. package/dist/ai-chat-v5-migration.js.map +1 -1
  8. package/dist/ai-react.d.ts +1 -286
  9. package/dist/ai-react.js +3 -632
  10. package/dist/ai-react.js.map +1 -1
  11. package/dist/ai-types.d.ts +7 -6
  12. package/dist/ai-types.js +12 -2
  13. package/dist/ai-types.js.map +1 -0
  14. package/dist/{client-QZa2Rq0l.js → client-C7SOlYfK.js} +2 -2
  15. package/dist/{client-QZa2Rq0l.js.map → client-C7SOlYfK.js.map} +1 -1
  16. package/dist/{client-DjTPRM8-.js → client-CEO0P7vN.js} +2 -2
  17. package/dist/client-CEO0P7vN.js.map +1 -0
  18. package/dist/{client-DFotUKH_.d.ts → client-CbcnyqCo.d.ts} +10 -10
  19. package/dist/client.d.ts +92 -7
  20. package/dist/client.js +1 -1
  21. package/dist/codemode/ai.d.ts +1 -27
  22. package/dist/codemode/ai.js +3 -146
  23. package/dist/codemode/ai.js.map +1 -1
  24. package/dist/{do-oauth-client-provider--To1Tsjj.d.ts → do-oauth-client-provider-BH9zFtSy.d.ts} +1 -1
  25. package/dist/{do-oauth-client-provider-B1fVIshX.js → do-oauth-client-provider-BfPFgQU0.js} +1 -1
  26. package/dist/{do-oauth-client-provider-B1fVIshX.js.map → do-oauth-client-provider-BfPFgQU0.js.map} +1 -1
  27. package/dist/{index-DLuxm_9W.d.ts → index-B7Ny-XfU.d.ts} +2 -2
  28. package/dist/index.d.ts +553 -38
  29. package/dist/index.js +5 -5
  30. package/dist/{context-DcbQ8o7k.d.ts → internal_context-neg89p5n.d.ts} +2 -2
  31. package/dist/{context-BkKbAa1R.js → internal_context-oN047Id3.js} +2 -2
  32. package/dist/internal_context-oN047Id3.js.map +1 -0
  33. package/dist/{context.d.ts → internal_context.d.ts} +1 -1
  34. package/dist/internal_context.js +3 -0
  35. package/dist/mcp/client.d.ts +1 -1
  36. package/dist/mcp/client.js +2 -2
  37. package/dist/mcp/do-oauth-client-provider.d.ts +1 -1
  38. package/dist/mcp/do-oauth-client-provider.js +1 -1
  39. package/dist/mcp/index.d.ts +3 -4
  40. package/dist/mcp/index.js +6 -6
  41. package/dist/mcp/index.js.map +1 -1
  42. package/dist/mcp/x402.d.ts +1 -1
  43. package/dist/{mcp-CPSfGUgd.d.ts → mcp-AK39tq6H.d.ts} +1 -1
  44. package/dist/observability/index.d.ts +1 -1
  45. package/dist/observability/index.js +5 -5
  46. package/dist/react.d.ts +14 -6
  47. package/dist/react.js +16 -8
  48. package/dist/react.js.map +1 -1
  49. package/dist/serializable.d.ts +33 -6
  50. package/dist/{src-BZDh910Z.js → src-CXf5SiV4.js} +6 -6
  51. package/dist/src-CXf5SiV4.js.map +1 -0
  52. package/dist/types-4b5tlB0u.js +15 -0
  53. package/dist/types-4b5tlB0u.js.map +1 -0
  54. package/dist/types-C5vR2Gzv.d.ts +13 -0
  55. package/dist/types.d.ts +2 -0
  56. package/dist/types.js +3 -0
  57. package/package.json +33 -25
  58. package/dist/ai-types-0OnT3FHg.d.ts +0 -127
  59. package/dist/ai-types-DEtF_8Km.js +0 -28
  60. package/dist/ai-types-DEtF_8Km.js.map +0 -1
  61. package/dist/client-CdM5I962.d.ts +0 -104
  62. package/dist/client-DjTPRM8-.js.map +0 -1
  63. package/dist/context-BkKbAa1R.js.map +0 -1
  64. package/dist/context.js +0 -3
  65. package/dist/index-CT2tCrLr.d.ts +0 -577
  66. package/dist/serializable-Crsj26mx.d.ts +0 -39
  67. package/dist/src-BZDh910Z.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { t as MessageType } from "./ai-types-DEtF_8Km.js";
1
+ import { t as MessageType } from "./types-4b5tlB0u.js";
2
2
  import { PartySocket } from "partysocket";
3
3
 
4
4
  //#region src/client.ts
@@ -114,4 +114,4 @@ function agentFetch(opts, init) {
114
114
 
115
115
  //#endregion
116
116
  export { agentFetch as n, camelCaseToKebabCase as r, AgentClient as t };
117
- //# sourceMappingURL=client-DjTPRM8-.js.map
117
+ //# sourceMappingURL=client-CEO0P7vN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-CEO0P7vN.js","names":["parsedMessage: Record<string, unknown>","request: RPCRequest"],"sources":["../src/client.ts"],"sourcesContent":["import {\n type PartyFetchOptions,\n PartySocket,\n type PartySocketOptions\n} from \"partysocket\";\nimport type { RPCRequest, RPCResponse } from \"./\";\nimport type {\n SerializableReturnValue,\n SerializableValue\n} from \"./serializable\";\nimport { MessageType } from \"./types\";\n\n/**\n * Options for creating an AgentClient\n */\nexport type AgentClientOptions<State = unknown> = Omit<\n PartySocketOptions,\n \"party\" | \"room\"\n> & {\n /** Name of the agent to connect to */\n agent: string;\n /** Name of the specific Agent instance */\n name?: string;\n /** Called when the Agent's state is updated */\n onStateUpdate?: (state: State, source: \"server\" | \"client\") => void;\n};\n\n/**\n * Options for streaming RPC calls\n */\nexport type StreamOptions = {\n /** Called when a chunk of data is received */\n onChunk?: (chunk: unknown) => void;\n /** Called when the stream ends */\n onDone?: (finalChunk: unknown) => void;\n /** Called when an error occurs */\n onError?: (error: string) => void;\n};\n\n/**\n * Options for the agentFetch function\n */\nexport type AgentClientFetchOptions = Omit<\n PartyFetchOptions,\n \"party\" | \"room\"\n> & {\n /** Name of the agent to connect to */\n agent: string;\n /** Name of the specific Agent instance */\n name?: string;\n};\n\n/**\n * Convert a camelCase string to a kebab-case string\n * @param str The string to convert\n * @returns The kebab-case string\n */\nexport function camelCaseToKebabCase(str: string): string {\n // If string is all uppercase, convert to lowercase\n if (str === str.toUpperCase() && str !== str.toLowerCase()) {\n return str.toLowerCase().replace(/_/g, \"-\");\n }\n\n // Otherwise handle camelCase to kebab-case\n let kebabified = str.replace(\n /[A-Z]/g,\n (letter) => `-${letter.toLowerCase()}`\n );\n kebabified = kebabified.startsWith(\"-\") ? kebabified.slice(1) : kebabified;\n // Convert any remaining underscores to hyphens and remove trailing -'s\n return kebabified.replace(/_/g, \"-\").replace(/-$/, \"\");\n}\n\n/**\n * WebSocket client for connecting to an Agent\n */\nexport class AgentClient<State = unknown> extends PartySocket {\n /**\n * @deprecated Use agentFetch instead\n */\n static fetch(_opts: PartyFetchOptions): Promise<Response> {\n throw new Error(\n \"AgentClient.fetch is not implemented, use agentFetch instead\"\n );\n }\n agent: string;\n name: string;\n private options: AgentClientOptions<State>;\n private _pendingCalls = new Map<\n string,\n {\n resolve: (value: unknown) => void;\n reject: (error: Error) => void;\n stream?: StreamOptions;\n type?: unknown;\n }\n >();\n\n constructor(options: AgentClientOptions<State>) {\n const agentNamespace = camelCaseToKebabCase(options.agent);\n super({\n party: agentNamespace,\n prefix: \"agents\",\n room: options.name || \"default\",\n ...options\n });\n this.agent = agentNamespace;\n this.name = options.name || \"default\";\n this.options = options;\n\n this.addEventListener(\"message\", (event) => {\n if (typeof event.data === \"string\") {\n let parsedMessage: Record<string, unknown>;\n try {\n parsedMessage = JSON.parse(event.data);\n } catch (_error) {\n // silently ignore invalid messages for now\n // TODO: log errors with log levels\n return;\n }\n if (parsedMessage.type === MessageType.CF_AGENT_STATE) {\n this.options.onStateUpdate?.(parsedMessage.state as State, \"server\");\n return;\n }\n if (parsedMessage.type === MessageType.RPC) {\n const response = parsedMessage as RPCResponse;\n const pending = this._pendingCalls.get(response.id);\n if (!pending) return;\n\n if (!response.success) {\n pending.reject(new Error(response.error));\n this._pendingCalls.delete(response.id);\n pending.stream?.onError?.(response.error);\n return;\n }\n\n // Handle streaming responses\n if (\"done\" in response) {\n if (response.done) {\n pending.resolve(response.result);\n this._pendingCalls.delete(response.id);\n pending.stream?.onDone?.(response.result);\n } else {\n pending.stream?.onChunk?.(response.result);\n }\n } else {\n // Non-streaming response\n pending.resolve(response.result);\n this._pendingCalls.delete(response.id);\n }\n }\n }\n });\n }\n\n setState(state: State) {\n this.send(JSON.stringify({ state, type: MessageType.CF_AGENT_STATE }));\n this.options.onStateUpdate?.(state, \"client\");\n }\n\n /**\n * Call a method on the Agent\n * @param method Name of the method to call\n * @param args Arguments to pass to the method\n * @param streamOptions Options for handling streaming responses\n * @returns Promise that resolves with the method's return value\n */\n call<T extends SerializableReturnValue>(\n method: string,\n args?: SerializableValue[],\n streamOptions?: StreamOptions\n ): Promise<T>;\n call<T = unknown>(\n method: string,\n args?: unknown[],\n streamOptions?: StreamOptions\n ): Promise<T>;\n async call<T>(\n method: string,\n args: unknown[] = [],\n streamOptions?: StreamOptions\n ): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const id = Math.random().toString(36).slice(2);\n this._pendingCalls.set(id, {\n reject,\n resolve: (value: unknown) => resolve(value as T),\n stream: streamOptions,\n type: null as T\n });\n\n const request: RPCRequest = {\n args,\n id,\n method,\n type: MessageType.RPC\n };\n\n this.send(JSON.stringify(request));\n });\n }\n}\n\n/**\n * Make an HTTP request to an Agent\n * @param opts Connection options\n * @param init Request initialization options\n * @returns Promise resolving to a Response\n */\nexport function agentFetch(opts: AgentClientFetchOptions, init?: RequestInit) {\n const agentNamespace = camelCaseToKebabCase(opts.agent);\n\n return PartySocket.fetch(\n {\n party: agentNamespace,\n prefix: \"agents\",\n room: opts.name || \"default\",\n ...opts\n },\n init\n );\n}\n"],"mappings":";;;;;;;;;AAyDA,SAAgB,qBAAqB,KAAqB;AAExD,KAAI,QAAQ,IAAI,aAAa,IAAI,QAAQ,IAAI,aAAa,CACxD,QAAO,IAAI,aAAa,CAAC,QAAQ,MAAM,IAAI;CAI7C,IAAI,aAAa,IAAI,QACnB,WACC,WAAW,IAAI,OAAO,aAAa,GACrC;AACD,cAAa,WAAW,WAAW,IAAI,GAAG,WAAW,MAAM,EAAE,GAAG;AAEhE,QAAO,WAA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AK,KAAK,UAAU;GAAE;GAAO,MAAM,YAAY;GAAgB,CAAC,CAAC;AACtE,OAAK,QAAQ,gBAAgB,OAAO,SAAS;;CAoB/C,MAAM,KACJ,QACA,OAAkB,EAAE,EACpB,eACY;AACZ,SAAO,IAAI,SAAY,SAAS,WAAW;GACzC,MAAM,KAAK,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE;AAC9C,QAAK,cAAc,IAAI,IAAI;IACzB;IACA,UAAU,UAAmB,QAAQ,MAAW;IAChD,QAAQ;IACR,MAAM;IACP,CAAC;GAEF,MAAMC,UAAsB;IAC1B;IACA;IACA;IACA,MAAM,YAAY;IACnB;AAED,QAAK,KAAK,KAAK,UAAU,QAAQ,CAAC;IAClC;;;;;;;;;AAUN,SAAgB,WAAW,MAA+B,MAAoB;CAC5E,MAAM,iBAAiB,qBAAqB,KAAK,MAAM;AAEvD,QAAO,YAAY,MACjB;EACE,OAAO;EACP,QAAQ;EACR,MAAM,KAAK,QAAQ;EACnB,GAAG;EACJ,EACD,KACD"}
@@ -1,7 +1,5 @@
1
- import { t as MCPObservabilityEvent } from "./mcp-CPSfGUgd.js";
2
- import { t as AgentsOAuthProvider } from "./do-oauth-client-provider--To1Tsjj.js";
3
- import * as ai0 from "ai";
4
- import { ToolSet } from "ai";
1
+ import { t as MCPObservabilityEvent } from "./mcp-AK39tq6H.js";
2
+ import { t as AgentsOAuthProvider } from "./do-oauth-client-provider-BH9zFtSy.js";
5
3
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
6
4
  import {
7
5
  SSEClientTransport,
@@ -23,8 +21,10 @@ import {
23
21
  Resource,
24
22
  ResourceTemplate,
25
23
  ServerCapabilities,
26
- Tool as Tool$1
24
+ Tool
27
25
  } from "@modelcontextprotocol/sdk/types.js";
26
+ import * as ai0 from "ai";
27
+ import { ToolSet } from "ai";
28
28
  import { RequestOptions } from "@modelcontextprotocol/sdk/shared/protocol.js";
29
29
 
30
30
  //#region src/core/events.d.ts
@@ -111,7 +111,7 @@ declare class MCPClientConnection {
111
111
  connectionState: MCPConnectionState;
112
112
  lastConnectedTransport: BaseTransportType | undefined;
113
113
  instructions?: string;
114
- tools: Tool$1[];
114
+ tools: Tool[];
115
115
  prompts: Prompt[];
116
116
  resources: Resource[];
117
117
  resourceTemplates: ResourceTemplate[];
@@ -168,7 +168,7 @@ declare class MCPClientConnection {
168
168
  * Notification handler registration for tools
169
169
  * Should only be called if serverCapabilities.tools exists
170
170
  */
171
- registerTools(): Promise<Tool$1[]>;
171
+ registerTools(): Promise<Tool[]>;
172
172
  /**
173
173
  * Notification handler registration for resources
174
174
  * Should only be called if serverCapabilities.resources exists
@@ -310,7 +310,7 @@ declare class MCPClientConnection {
310
310
  */
311
311
  getTransport(
312
312
  transportType: BaseTransportType
313
- ): StreamableHTTPClientTransport | SSEClientTransport;
313
+ ): SSEClientTransport | StreamableHTTPClientTransport;
314
314
  private tryConnect;
315
315
  private _capabilityErrorHandler;
316
316
  }
@@ -796,7 +796,7 @@ declare class MCPClientManager {
796
796
  }>;
797
797
  }
798
798
  type NamespacedData = {
799
- tools: (Tool$1 & {
799
+ tools: (Tool & {
800
800
  serverId: string;
801
801
  })[];
802
802
  prompts: (Prompt & {
@@ -831,4 +831,4 @@ export {
831
831
  MCPClientManager as t,
832
832
  MCPConnectionState as u
833
833
  };
834
- //# sourceMappingURL=client-DFotUKH_.d.ts.map
834
+ //# sourceMappingURL=client-CbcnyqCo.d.ts.map
package/dist/client.d.ts CHANGED
@@ -1,11 +1,95 @@
1
+ import { SerializableReturnValue, SerializableValue } from "./serializable.js";
1
2
  import {
2
- a as agentFetch,
3
- i as StreamOptions,
4
- n as AgentClientFetchOptions,
5
- o as camelCaseToKebabCase,
6
- r as AgentClientOptions,
7
- t as AgentClient
8
- } from "./client-CdM5I962.js";
3
+ PartyFetchOptions,
4
+ PartySocket,
5
+ PartySocketOptions
6
+ } from "partysocket";
7
+
8
+ //#region src/client.d.ts
9
+
10
+ /**
11
+ * Options for creating an AgentClient
12
+ */
13
+ type AgentClientOptions<State = unknown> = Omit<
14
+ PartySocketOptions,
15
+ "party" | "room"
16
+ > & {
17
+ /** Name of the agent to connect to */
18
+ agent: string;
19
+ /** Name of the specific Agent instance */
20
+ name?: string;
21
+ /** Called when the Agent's state is updated */
22
+ onStateUpdate?: (state: State, source: "server" | "client") => void;
23
+ };
24
+ /**
25
+ * Options for streaming RPC calls
26
+ */
27
+ type StreamOptions = {
28
+ /** Called when a chunk of data is received */
29
+ onChunk?: (chunk: unknown) => void;
30
+ /** Called when the stream ends */
31
+ onDone?: (finalChunk: unknown) => void;
32
+ /** Called when an error occurs */
33
+ onError?: (error: string) => void;
34
+ };
35
+ /**
36
+ * Options for the agentFetch function
37
+ */
38
+ type AgentClientFetchOptions = Omit<PartyFetchOptions, "party" | "room"> & {
39
+ /** Name of the agent to connect to */
40
+ agent: string;
41
+ /** Name of the specific Agent instance */
42
+ name?: string;
43
+ };
44
+ /**
45
+ * Convert a camelCase string to a kebab-case string
46
+ * @param str The string to convert
47
+ * @returns The kebab-case string
48
+ */
49
+ declare function camelCaseToKebabCase(str: string): string;
50
+ /**
51
+ * WebSocket client for connecting to an Agent
52
+ */
53
+ declare class AgentClient<State = unknown> extends PartySocket {
54
+ /**
55
+ * @deprecated Use agentFetch instead
56
+ */
57
+ static fetch(_opts: PartyFetchOptions): Promise<Response>;
58
+ agent: string;
59
+ name: string;
60
+ private options;
61
+ private _pendingCalls;
62
+ constructor(options: AgentClientOptions<State>);
63
+ setState(state: State): void;
64
+ /**
65
+ * Call a method on the Agent
66
+ * @param method Name of the method to call
67
+ * @param args Arguments to pass to the method
68
+ * @param streamOptions Options for handling streaming responses
69
+ * @returns Promise that resolves with the method's return value
70
+ */
71
+ call<T extends SerializableReturnValue>(
72
+ method: string,
73
+ args?: SerializableValue[],
74
+ streamOptions?: StreamOptions
75
+ ): Promise<T>;
76
+ call<T = unknown>(
77
+ method: string,
78
+ args?: unknown[],
79
+ streamOptions?: StreamOptions
80
+ ): Promise<T>;
81
+ }
82
+ /**
83
+ * Make an HTTP request to an Agent
84
+ * @param opts Connection options
85
+ * @param init Request initialization options
86
+ * @returns Promise resolving to a Response
87
+ */
88
+ declare function agentFetch(
89
+ opts: AgentClientFetchOptions,
90
+ init?: RequestInit
91
+ ): Promise<Response>;
92
+ //#endregion
9
93
  export {
10
94
  AgentClient,
11
95
  AgentClientFetchOptions,
@@ -14,3 +98,4 @@ export {
14
98
  agentFetch,
15
99
  camelCaseToKebabCase
16
100
  };
101
+ //# sourceMappingURL=client.d.ts.map
package/dist/client.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as agentFetch, r as camelCaseToKebabCase, t as AgentClient } from "./client-DjTPRM8-.js";
1
+ import { n as agentFetch, r as camelCaseToKebabCase, t as AgentClient } from "./client-CEO0P7vN.js";
2
2
 
3
3
  export { AgentClient, agentFetch, camelCaseToKebabCase };
@@ -1,27 +1 @@
1
- import { ToolSet } from "ai";
2
- import { WorkerEntrypoint } from "cloudflare:workers";
3
-
4
- //#region src/codemode/ai.d.ts
5
- declare class CodeModeProxy extends WorkerEntrypoint<Cloudflare.Env, {
6
- binding: string;
7
- name: string;
8
- callback: string;
9
- }> {
10
- callFunction(options: {
11
- functionName: string;
12
- args: unknown[];
13
- }): Promise<any>;
14
- }
15
- declare function experimental_codemode(options: {
16
- tools: ToolSet;
17
- prompt: string;
18
- globalOutbound: Fetcher;
19
- loader: WorkerLoader;
20
- proxy: Fetcher<CodeModeProxy>;
21
- }): Promise<{
22
- prompt: string;
23
- tools: ToolSet;
24
- }>;
25
- //#endregion
26
- export { CodeModeProxy, experimental_codemode };
27
- //# sourceMappingURL=ai.d.ts.map
1
+ export * from "@cloudflare/codemode/ai";
@@ -1,151 +1,8 @@
1
- import "../context-BkKbAa1R.js";
2
- import "../client-DjTPRM8-.js";
3
- import "../client-QZa2Rq0l.js";
4
- import "../do-oauth-client-provider-B1fVIshX.js";
5
- import { s as getAgentByName } from "../src-BZDh910Z.js";
6
- import { generateObject, tool } from "ai";
7
- import { openai } from "@ai-sdk/openai";
8
- import { z } from "zod";
9
- import { compile } from "json-schema-to-typescript";
10
- import { createTypeAlias, printNode, zodToTs } from "zod-to-ts";
11
- import { WorkerEntrypoint, env } from "cloudflare:workers";
1
+ export * from "@cloudflare/codemode/ai"
12
2
 
13
3
  //#region src/codemode/ai.ts
14
- function toCamelCase(str) {
15
- return str.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()).replace(/^[a-z]/, (letter) => letter.toUpperCase());
16
- }
17
- var CodeModeProxy = class extends WorkerEntrypoint {
18
- async callFunction(options) {
19
- return (await getAgentByName(env[this.ctx.props.binding], this.ctx.props.name))[this.ctx.props.callback](options.functionName, options.args);
20
- }
21
- };
22
- async function experimental_codemode(options) {
23
- const generatedTypes = await generateTypes(options.tools);
24
- return {
25
- prompt: `You are a helpful assistant. You have access to the "codemode" tool that can do different things:
26
-
27
- ${getToolDescriptions(options.tools)}
28
-
29
- If the user asks to do anything that be achieveable by the codemode tool, then simply pass over control to it by giving it a simple function description. Don't be too verbose.
30
-
31
- `,
32
- tools: { codemode: tool({
33
- description: "codemode: a tool that can generate code to achieve a goal",
34
- inputSchema: z.object({ functionDescription: z.string() }),
35
- outputSchema: z.object({
36
- code: z.string(),
37
- result: z.any()
38
- }),
39
- execute: async ({ functionDescription }) => {
40
- try {
41
- const response = await generateObject({
42
- model: openai("gpt-4.1"),
43
- schema: z.object({ code: z.string() }),
44
- prompt: `You are a code generating machine.
45
-
46
- In addition to regular javascript, you can also use the following functions:
47
-
48
- ${generatedTypes}
49
-
50
- Respond only with the code, nothing else. Output javascript code.
51
-
52
- Generate an async function that achieves the goal. This async function doesn't accept any arguments.
53
-
54
- Here is user input: ${functionDescription}`
55
- });
56
- const result = await createEvaluator(response.object.code, {
57
- proxy: options.proxy,
58
- loader: options.loader
59
- })();
60
- return {
61
- code: response.object.code,
62
- result
63
- };
64
- } catch (error) {
65
- console.error("error", error);
66
- throw error;
67
- }
68
- }
69
- }) }
70
- };
71
- }
72
- function createEvaluator(code, options) {
73
- return async () => {
74
- return await options.loader.get(`code-${Math.random()}`, () => {
75
- return {
76
- compatibilityDate: "2025-06-01",
77
- compatibilityFlags: ["nodejs_compat"],
78
- mainModule: "foo.js",
79
- modules: { "foo.js": `
80
- import { env, WorkerEntrypoint } from "cloudflare:workers";
81
-
82
- export default class CodeModeWorker extends WorkerEntrypoint {
83
- async evaluate() {
84
- try {
85
- const { CodeModeProxy } = env;
86
- const codemode = new Proxy(
87
- {},
88
- {
89
- get: (target, prop) => {
90
- return (args) => {
91
- return CodeModeProxy.callFunction({
92
- functionName: prop,
93
- args: args,
94
- });
95
- };
96
- }
97
- }
98
- );
99
-
100
- return await ${code}();
101
- } catch (err) {
102
- return {
103
- err: err.message,
104
- stack: err.stack
105
- };
106
- }
107
- }
108
- }
109
-
110
- ` },
111
- env: { CodeModeProxy: options.proxy },
112
- globalOutbound: null
113
- };
114
- }).getEntrypoint().evaluate();
115
- };
116
- }
117
- async function generateTypes(tools) {
118
- let availableTools = "";
119
- let availableTypes = "";
120
- for (const [toolName, tool$1] of Object.entries(tools)) {
121
- const inputJsonType = tool$1.inputSchema.jsonSchema ? await compile(tool$1.inputSchema.jsonSchema, `${toCamelCase(toolName)}Input`, {
122
- format: false,
123
- bannerComment: " "
124
- }) : printNode(createTypeAlias(zodToTs(tool$1.inputSchema, `${toCamelCase(toolName)}Input`).node, `${toCamelCase(toolName)}Input`));
125
- const outputJsonType = tool$1.outputSchema?.jsonSchema ? await compile(tool$1.outputSchema?.jsonSchema, `${toCamelCase(toolName)}Output`, {
126
- format: false,
127
- bannerComment: " "
128
- }) : tool$1.outputSchema ? printNode(createTypeAlias(zodToTs(tool$1.outputSchema, `${toCamelCase(toolName)}Output`).node, `${toCamelCase(toolName)}Output`)) : `interface ${toCamelCase(toolName)}Output { [key: string]: any }`;
129
- const InputType = inputJsonType.trim().replace("export interface", "interface");
130
- const OutputType = outputJsonType.trim().replace("export interface", "interface");
131
- availableTypes += `\n${InputType}`;
132
- availableTypes += `\n${OutputType}`;
133
- availableTools += `\n\t/*\n\t${tool$1.description?.trim()}\n\t*/`;
134
- availableTools += `\n\t${toolName}: (input: ${toCamelCase(toolName)}Input) => Promise<${toCamelCase(toolName)}Output>;`;
135
- availableTools += "\n";
136
- }
137
- availableTools = `\ndeclare const codemode: {${availableTools}}`;
138
- return `
139
- ${availableTypes}
140
- ${availableTools}
141
- `;
142
- }
143
- function getToolDescriptions(tools) {
144
- return Object.entries(tools).map(([_toolName, tool$1]) => {
145
- return `\n- ${tool$1.description?.trim()}`;
146
- }).join("");
147
- }
4
+ console.log("Codemode is now in @cloudflare/codemode. This module is deprecated and will be removed in the next major version.");
148
5
 
149
6
  //#endregion
150
- export { CodeModeProxy, experimental_codemode };
7
+ export { };
151
8
  //# sourceMappingURL=ai.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai.js","names":["tool","compileJsonSchemaToTs","printNodeZodToTs"],"sources":["../../src/codemode/ai.ts"],"sourcesContent":["import { generateObject, tool, type ToolSet } from \"ai\";\nimport { openai } from \"@ai-sdk/openai\";\nimport { z } from \"zod\";\nimport { compile as compileJsonSchemaToTs } from \"json-schema-to-typescript\";\nimport {\n zodToTs,\n printNode as printNodeZodToTs,\n createTypeAlias\n} from \"zod-to-ts\";\nimport { getAgentByName } from \"..\";\nimport { env, WorkerEntrypoint } from \"cloudflare:workers\";\n\nfunction toCamelCase(str: string) {\n return str\n .replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())\n .replace(/^[a-z]/, (letter) => letter.toUpperCase());\n}\n\nexport class CodeModeProxy extends WorkerEntrypoint<\n Cloudflare.Env,\n {\n binding: string;\n name: string;\n callback: string;\n }\n> {\n async callFunction(options: { functionName: string; args: unknown[] }) {\n const stub = (await getAgentByName(\n // @ts-expect-error\n env[this.ctx.props.binding] as DurableObjectNamespace<T>,\n this.ctx.props.name\n )) as DurableObjectStub;\n // @ts-expect-error\n return stub[this.ctx.props.callback](options.functionName, options.args);\n }\n}\n\nexport async function experimental_codemode(options: {\n tools: ToolSet;\n prompt: string;\n globalOutbound: Fetcher;\n loader: WorkerLoader;\n proxy: Fetcher<CodeModeProxy>;\n}): Promise<{\n prompt: string;\n tools: ToolSet;\n}> {\n const generatedTypes = await generateTypes(options.tools);\n const prompt = `You are a helpful assistant. You have access to the \"codemode\" tool that can do different things: \n \n ${getToolDescriptions(options.tools)} \n \n If the user asks to do anything that be achieveable by the codemode tool, then simply pass over control to it by giving it a simple function description. Don't be too verbose.\n \n `;\n\n const codemodeTool = tool({\n description: \"codemode: a tool that can generate code to achieve a goal\",\n inputSchema: z.object({\n functionDescription: z.string()\n }),\n outputSchema: z.object({\n code: z.string(),\n result: z.any()\n }),\n execute: async ({ functionDescription }) => {\n try {\n const response = await generateObject({\n model: openai(\"gpt-4.1\"),\n schema: z.object({\n code: z.string()\n }),\n prompt: `You are a code generating machine.\n\n In addition to regular javascript, you can also use the following functions:\n\n ${generatedTypes} \n\n Respond only with the code, nothing else. Output javascript code.\n\n Generate an async function that achieves the goal. This async function doesn't accept any arguments.\n\n Here is user input: ${functionDescription}` // insert ts types for the tools here\n });\n\n // console.log(\"args\", response.object.args);\n const evaluator = createEvaluator(response.object.code, {\n proxy: options.proxy,\n loader: options.loader\n });\n const result = await evaluator();\n return { code: response.object.code, result: result };\n } catch (error) {\n console.error(\"error\", error);\n throw error;\n // return { code: \"\", result: error };\n }\n }\n });\n\n return { prompt, tools: { codemode: codemodeTool } };\n}\n\nfunction createEvaluator(\n code: string,\n options: {\n loader: WorkerLoader;\n proxy: Fetcher<CodeModeProxy>;\n }\n) {\n return async () => {\n const worker = options.loader.get(`code-${Math.random()}`, () => {\n return {\n compatibilityDate: \"2025-06-01\",\n compatibilityFlags: [\"nodejs_compat\"],\n mainModule: \"foo.js\",\n modules: {\n \"foo.js\": `\nimport { env, WorkerEntrypoint } from \"cloudflare:workers\";\n\nexport default class CodeModeWorker extends WorkerEntrypoint {\n async evaluate() {\n try {\n const { CodeModeProxy } = env;\n const codemode = new Proxy(\n {},\n {\n get: (target, prop) => {\n return (args) => {\n return CodeModeProxy.callFunction({\n functionName: prop,\n args: args, \n });\n };\n }\n }\n );\n\n return await ${code}();\n } catch (err) {\n return {\n err: err.message,\n stack: err.stack\n };\n }\n }\n}\n \n `\n },\n env: {\n // insert keys and bindings to tools/ts functions here\n CodeModeProxy: options.proxy\n },\n globalOutbound: null\n };\n });\n\n // @ts-expect-error TODO: fix this\n return await worker.getEntrypoint().evaluate();\n };\n}\n\nasync function generateTypes(tools: ToolSet) {\n let availableTools = \"\";\n let availableTypes = \"\";\n\n for (const [toolName, tool] of Object.entries(tools)) {\n // @ts-expect-error TODO: fix this\n const inputJsonType = tool.inputSchema.jsonSchema\n ? await compileJsonSchemaToTs(\n // @ts-expect-error TODO: fix this\n tool.inputSchema.jsonSchema,\n `${toCamelCase(toolName)}Input`,\n {\n format: false,\n bannerComment: \" \"\n }\n )\n : printNodeZodToTs(\n createTypeAlias(\n zodToTs(\n // @ts-expect-error TODO: fix this\n tool.inputSchema,\n `${toCamelCase(toolName)}Input`\n ).node,\n `${toCamelCase(toolName)}Input`\n )\n );\n\n const outputJsonType =\n // @ts-expect-error TODO: fix this\n tool.outputSchema?.jsonSchema\n ? await compileJsonSchemaToTs(\n // @ts-expect-error TODO: fix this\n tool.outputSchema?.jsonSchema,\n `${toCamelCase(toolName)}Output`,\n {\n format: false,\n bannerComment: \" \"\n }\n )\n : tool.outputSchema\n ? printNodeZodToTs(\n createTypeAlias(\n zodToTs(\n // @ts-expect-error TODO: fix this\n tool.outputSchema,\n `${toCamelCase(toolName)}Output`\n ).node,\n `${toCamelCase(toolName)}Output`\n )\n )\n : `interface ${toCamelCase(toolName)}Output { [key: string]: any }`;\n\n const InputType = inputJsonType\n .trim()\n .replace(\"export interface\", \"interface\");\n\n const OutputType = outputJsonType\n .trim()\n .replace(\"export interface\", \"interface\");\n\n availableTypes += `\\n${InputType}`;\n availableTypes += `\\n${OutputType}`;\n availableTools += `\\n\\t/*\\n\\t${tool.description?.trim()}\\n\\t*/`;\n availableTools += `\\n\\t${toolName}: (input: ${toCamelCase(toolName)}Input) => Promise<${toCamelCase(toolName)}Output>;`;\n availableTools += \"\\n\";\n }\n\n availableTools = `\\ndeclare const codemode: {${availableTools}}`;\n\n return `\n${availableTypes}\n${availableTools}\n `;\n}\n\nfunction getToolDescriptions(tools: ToolSet) {\n return Object.entries(tools)\n .map(([_toolName, tool]) => {\n return `\\n- ${tool.description?.trim()}`;\n })\n .join(\"\");\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAS,YAAY,KAAa;AAChC,QAAO,IACJ,QAAQ,cAAc,GAAG,WAAW,OAAO,aAAa,CAAC,CACzD,QAAQ,WAAW,WAAW,OAAO,aAAa,CAAC;;AAGxD,IAAa,gBAAb,cAAmC,iBAOjC;CACA,MAAM,aAAa,SAAoD;AAOrE,UANc,MAAM,eAElB,IAAI,KAAK,IAAI,MAAM,UACnB,KAAK,IAAI,MAAM,KAChB,EAEW,KAAK,IAAI,MAAM,UAAU,QAAQ,cAAc,QAAQ,KAAK;;;AAI5E,eAAsB,sBAAsB,SASzC;CACD,MAAM,iBAAiB,MAAM,cAAc,QAAQ,MAAM;AAqDzD,QAAO;EAAE,QApDM;;IAEb,oBAAoB,QAAQ,MAAM,CAAC;;;;;EAkDpB,OAAO,EAAE,UA5CL,KAAK;GACxB,aAAa;GACb,aAAa,EAAE,OAAO,EACpB,qBAAqB,EAAE,QAAQ,EAChC,CAAC;GACF,cAAc,EAAE,OAAO;IACrB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,KAAK;IAChB,CAAC;GACF,SAAS,OAAO,EAAE,0BAA0B;AAC1C,QAAI;KACF,MAAM,WAAW,MAAM,eAAe;MACpC,OAAO,OAAO,UAAU;MACxB,QAAQ,EAAE,OAAO,EACf,MAAM,EAAE,QAAQ,EACjB,CAAC;MACF,QAAQ;;;;QAIV,eAAe;;;;;;4BAMK;MACnB,CAAC;K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GACD,aAAa,YAAY,SAAS,CAAC;EAE3C,MAAM,YAAY,cACf,MAAM,CACN,QAAQ,oBAAoB,YAAY;EAE3C,MAAM,aAAa,eAChB,MAAM,CACN,QAAQ,oBAAoB,YAAY;AAE3C,oBAAkB,KAAK;AACvB,oBAAkB,KAAK;AACvB,oBAAkB,aAAaA,OAAK,aAAa,MAAM,CAAC;AACxD,oBAAkB,OAAO,SAAS,YAAY,YAAY,SAAS,CAAC,oBAAoB,YAAY,SAAS,CAAC;AAC9G,oBAAkB;;AAGpB,kBAAiB,8BAA8B,eAAe;AAE9D,QAAO;EACP,eAAe;EACf,eAAe;;;AAIjB,SAAS,oBAAoB,OAAgB;AAC3C,QAAO,OAAO,QAAQ,MAAM,CACzB,KAAK,CAAC,WAAWA,YAAU;AAC1B,SAAO,OAAOA,OAAK,aAAa,MAAM;GACtC,CACD,KAAK,GAAG"}
1
+ {"version":3,"file":"ai.js","names":[],"sources":["../../src/codemode/ai.ts"],"sourcesContent":["export * from \"@cloudflare/codemode/ai\";\n\nconsole.log(\n \"Codemode is now in @cloudflare/codemode. This module is deprecated and will be removed in the next major version.\"\n);\n"],"mappings":";;;AAEA,QAAQ,IACN,oHACD"}
@@ -67,4 +67,4 @@ declare class DurableObjectOAuthClientProvider implements AgentsOAuthProvider {
67
67
  }
68
68
  //#endregion
69
69
  export { DurableObjectOAuthClientProvider as n, AgentsOAuthProvider as t };
70
- //# sourceMappingURL=do-oauth-client-provider--To1Tsjj.d.ts.map
70
+ //# sourceMappingURL=do-oauth-client-provider-BH9zFtSy.d.ts.map
@@ -152,4 +152,4 @@ var DurableObjectOAuthClientProvider = class {
152
152
 
153
153
  //#endregion
154
154
  export { DurableObjectOAuthClientProvider as t };
155
- //# sourceMappingURL=do-oauth-client-provider-B1fVIshX.js.map
155
+ //# sourceMappingURL=do-oauth-client-provider-BfPFgQU0.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"do-oauth-client-provider-B1fVIshX.js","names":["storage: DurableObjectStorage","clientName: string","baseRedirectUrl: string","storedState: StoredState","deleteKeys: string[]"],"sources":["../src/mcp/do-oauth-client-provider.ts"],"sourcesContent":["import type { OAuthClientProvider } from \"@modelcontextprotocol/sdk/client/auth.js\";\nimport type {\n OAuthClientInformation,\n OAuthClientInformationFull,\n OAuthClientMetadata,\n OAuthTokens\n} from \"@modelcontextprotocol/sdk/shared/auth.js\";\nimport { nanoid } from \"nanoid\";\n\nconst STATE_EXPIRATION_MS = 10 * 60 * 1000; // 10 minutes\n\ninterface StoredState {\n nonce: string;\n serverId: string;\n createdAt: number;\n}\n\n// A slight extension to the standard OAuthClientProvider interface because `redirectToAuthorization` doesn't give us the interface we need\n// This allows us to track authentication for a specific server and associated dynamic client registration\nexport interface AgentsOAuthProvider extends OAuthClientProvider {\n authUrl: string | undefined;\n clientId: string | undefined;\n serverId: string | undefined;\n checkState(\n state: string\n ): Promise<{ valid: boolean; serverId?: string; error?: string }>;\n consumeState(state: string): Promise<void>;\n deleteCodeVerifier(): Promise<void>;\n}\n\nexport class DurableObjectOAuthClientProvider implements AgentsOAuthProvider {\n private _authUrl_: string | undefined;\n private _serverId_: string | undefined;\n private _clientId_: string | undefined;\n\n constructor(\n public storage: DurableObjectStorage,\n public clientName: string,\n public baseRedirectUrl: string\n ) {\n if (!storage) {\n throw new Error(\n \"DurableObjectOAuthClientProvider requires a valid DurableObjectStorage instance\"\n );\n }\n }\n\n get clientMetadata(): OAuthClientMetadata {\n return {\n client_name: this.clientName,\n client_uri: this.clientUri,\n grant_types: [\"authorization_code\", \"refresh_token\"],\n redirect_uris: [this.redirectUrl],\n response_types: [\"code\"],\n token_endpoint_auth_method: \"none\"\n };\n }\n\n get clientUri() {\n return new URL(this.redirectUrl).origin;\n }\n\n get redirectUrl() {\n return this.baseRedirectUrl;\n }\n\n get clientId() {\n if (!this._clientId_) {\n throw new Error(\"Trying to access clientId before it was set\");\n }\n return this._clientId_;\n }\n\n set clientId(clientId_: string) {\n this._clientId_ = clientId_;\n }\n\n get serverId() {\n if (!this._serverId_) {\n throw new Error(\"Trying to access serverId before it was set\");\n }\n return this._serverId_;\n }\n\n set serverId(serverId_: string) {\n this._serverId_ = serverId_;\n }\n\n keyPrefix(clientId: string) {\n return `/${this.clientName}/${this.serverId}/${clientId}`;\n }\n\n clientInfoKey(clientId: string) {\n return `${this.keyPrefix(clientId)}/client_info/`;\n }\n\n async clientInformation(): Promise<OAuthClientInformation | undefined> {\n if (!this._clientId_) {\n return undefined;\n }\n return (\n (await this.storage.get<OAuthClientInformation>(\n this.clientInfoKey(this.clientId)\n )) ?? undefined\n );\n }\n\n async saveClientInformation(\n clientInformation: OAuthClientInformationFull\n ): Promise<void> {\n await this.storage.put(\n this.clientInfoKey(clientInformation.client_id),\n clientInformation\n );\n this.clientId = clientInformation.client_id;\n }\n\n tokenKey(clientId: string) {\n return `${this.keyPrefix(clientId)}/token`;\n }\n\n async tokens(): Promise<OAuthTokens | undefined> {\n if (!this._clientId_) {\n return undefined;\n }\n return (\n (await this.storage.get<OAuthTokens>(this.tokenKey(this.clientId))) ??\n undefined\n );\n }\n\n async saveTokens(tokens: OAuthTokens): Promise<void> {\n await this.storage.put(this.tokenKey(this.clientId), tokens);\n }\n\n get authUrl() {\n return this._authUrl_;\n }\n\n stateKey(nonce: string) {\n return `/${this.clientName}/${this.serverId}/state/${nonce}`;\n }\n\n async state(): Promise<string> {\n const nonce = nanoid();\n const state = `${nonce}.${this.serverId}`;\n const storedState: StoredState = {\n nonce,\n serverId: this.serverId,\n createdAt: Date.now()\n };\n await this.storage.put(this.stateKey(nonce), storedState);\n return state;\n }\n\n async checkState(\n state: string\n ): Promise<{ valid: boolean; serverId?: string; error?: string }> {\n const parts = state.split(\".\");\n if (parts.length !== 2) {\n return { valid: false, error: \"Invalid state format\" };\n }\n\n const [nonce, serverId] = parts;\n const key = this.stateKey(nonce);\n const storedState = await this.storage.get<StoredState>(key);\n\n if (!storedState) {\n return { valid: false, error: \"State not found or already used\" };\n }\n\n if (storedState.serverId !== serverId) {\n await this.storage.delete(key);\n return { valid: false, error: \"State serverId mismatch\" };\n }\n\n const age = Date.now() - storedState.createdAt;\n if (age > STATE_EXPIRATION_MS) {\n await this.storage.delete(key);\n return { valid: false, error: \"State expired\" };\n }\n\n return { valid: true, serverId };\n }\n\n async consumeState(state: string): Promise<void> {\n const parts = state.split(\".\");\n if (parts.length !== 2) {\n // This should never happen since checkState validates format first.\n // Log for debugging but don't throw - state consumption is best-effort.\n console.warn(\n `[OAuth] consumeState called with invalid state format: ${state.substring(0, 20)}...`\n );\n return;\n }\n const [nonce] = parts;\n await this.storage.delete(this.stateKey(nonce));\n }\n\n async redirectToAuthorization(authUrl: URL): Promise<void> {\n this._authUrl_ = authUrl.toString();\n }\n\n async invalidateCredentials(\n scope: \"all\" | \"client\" | \"tokens\" | \"verifier\"\n ): Promise<void> {\n if (!this._clientId_) return;\n\n const deleteKeys: string[] = [];\n\n if (scope === \"all\" || scope === \"client\") {\n deleteKeys.push(this.clientInfoKey(this.clientId));\n }\n if (scope === \"all\" || scope === \"tokens\") {\n deleteKeys.push(this.tokenKey(this.clientId));\n }\n if (scope === \"all\" || scope === \"verifier\") {\n deleteKeys.push(this.codeVerifierKey(this.clientId));\n }\n\n if (deleteKeys.length > 0) {\n await this.storage.delete(deleteKeys);\n }\n }\n\n codeVerifierKey(clientId: string) {\n return `${this.keyPrefix(clientId)}/code_verifier`;\n }\n\n async saveCodeVerifier(verifier: string): Promise<void> {\n const key = this.codeVerifierKey(this.clientId);\n\n // Don't overwrite existing verifier to preserve first PKCE verifier\n const existing = await this.storage.get<string>(key);\n if (existing) {\n return;\n }\n\n await this.storage.put(key, verifier);\n }\n\n async codeVerifier(): Promise<string> {\n const codeVerifier = await this.storage.get<string>(\n this.codeVerifierKey(this.clientId)\n );\n if (!codeVerifier) {\n throw new Error(\"No code verifier found\");\n }\n return codeVerifier;\n }\n\n async deleteCodeVerifier(): Promise<void> {\n await this.storage.delete(this.codeVerifierKey(this.clientId));\n }\n}\n"],"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,KACN,0DAA0D,MAAM,UAAU,GAAG,GAAG,CAAC,KAClF;AACD;;EAEF,MAAM,CAAC,SAAS;AAChB,QAAM,KAAK,QAAQ,OAAO,KAAK,SAAS,MAAM,CAAC;;CAGjD,MAAM,wBAAwB,SAA6B;AACzD,OAAK,YAAY,QAAQ,UAAU;;CAGrC,MAAM,sBACJ,OACe;AACf,MAAI,CAAC,KAAK,WAAY;EAEtB,MAAMC,aAAuB,EAAE;AAE/B,MAAI,UAAU,SAAS,UAAU,SAC/B,YAAW,KAAK,KAAK,cAAc,KAAK,SAAS,CAAC;AAEpD,MAAI,UAAU,SAAS,UAAU,SAC/B,YAAW,KAAK,KAAK,SAAS,KAAK,SAAS,CAAC;AAE/C,MAAI,UAAU,SAAS,UAAU,WAC/B,YAAW,KAAK,KAAK,gBAAgB,KAAK,SAAS,CAAC;AAGtD,MAAI,WAAW,SAAS,EACtB,OAAM,KAAK,QAAQ,OAAO,WAAW;;CAIzC,gBAAgB,UAAkB;AAChC,SAAO,GAAG,KAAK,UAAU,SAAS,CAAC;;CAGrC,MAAM,iBAAiB,UAAiC;EACtD,MAAM,MAAM,KAAK,gBAAgB,KAAK,SAAS;AAI/C,MADiB,MAAM,KAAK,QAAQ,IAAY,IAAI,CAElD;AAGF,QAAM,KAAK,QAAQ,IAAI,KAAK,SAAS;;CAGvC,MAAM,eAAgC;EACpC,MAAM,eAAe,MAAM,KAAK,QAAQ,IACtC,KAAK,gBAAgB,KAAK,SAAS,CACpC;AACD,MAAI,CAAC,aACH,OAAM,IAAI,MAAM,yBAAyB;AAE3C,SAAO;;CAGT,MAAM,qBAAoC;AACxC,QAAM,KAAK,QAAQ,OAAO,KAAK,gBAAgB,KAAK,SAAS,CAAC"}
1
+ {"version":3,"file":"do-oauth-client-provider-BfPFgQU0.js","names":["storage: DurableObjectStorage","clientName: string","baseRedirectUrl: string","storedState: StoredState","deleteKeys: string[]"],"sources":["../src/mcp/do-oauth-client-provider.ts"],"sourcesContent":["import type { OAuthClientProvider } from \"@modelcontextprotocol/sdk/client/auth.js\";\nimport type {\n OAuthClientInformation,\n OAuthClientInformationFull,\n OAuthClientMetadata,\n OAuthTokens\n} from \"@modelcontextprotocol/sdk/shared/auth.js\";\nimport { nanoid } from \"nanoid\";\n\nconst STATE_EXPIRATION_MS = 10 * 60 * 1000; // 10 minutes\n\ninterface StoredState {\n nonce: string;\n serverId: string;\n createdAt: number;\n}\n\n// A slight extension to the standard OAuthClientProvider interface because `redirectToAuthorization` doesn't give us the interface we need\n// This allows us to track authentication for a specific server and associated dynamic client registration\nexport interface AgentsOAuthProvider extends OAuthClientProvider {\n authUrl: string | undefined;\n clientId: string | undefined;\n serverId: string | undefined;\n checkState(\n state: string\n ): Promise<{ valid: boolean; serverId?: string; error?: string }>;\n consumeState(state: string): Promise<void>;\n deleteCodeVerifier(): Promise<void>;\n}\n\nexport class DurableObjectOAuthClientProvider implements AgentsOAuthProvider {\n private _authUrl_: string | undefined;\n private _serverId_: string | undefined;\n private _clientId_: string | undefined;\n\n constructor(\n public storage: DurableObjectStorage,\n public clientName: string,\n public baseRedirectUrl: string\n ) {\n if (!storage) {\n throw new Error(\n \"DurableObjectOAuthClientProvider requires a valid DurableObjectStorage instance\"\n );\n }\n }\n\n get clientMetadata(): OAuthClientMetadata {\n return {\n client_name: this.clientName,\n client_uri: this.clientUri,\n grant_types: [\"authorization_code\", \"refresh_token\"],\n redirect_uris: [this.redirectUrl],\n response_types: [\"code\"],\n token_endpoint_auth_method: \"none\"\n };\n }\n\n get clientUri() {\n return new URL(this.redirectUrl).origin;\n }\n\n get redirectUrl() {\n return this.baseRedirectUrl;\n }\n\n get clientId() {\n if (!this._clientId_) {\n throw new Error(\"Trying to access clientId before it was set\");\n }\n return this._clientId_;\n }\n\n set clientId(clientId_: string) {\n this._clientId_ = clientId_;\n }\n\n get serverId() {\n if (!this._serverId_) {\n throw new Error(\"Trying to access serverId before it was set\");\n }\n return this._serverId_;\n }\n\n set serverId(serverId_: string) {\n this._serverId_ = serverId_;\n }\n\n keyPrefix(clientId: string) {\n return `/${this.clientName}/${this.serverId}/${clientId}`;\n }\n\n clientInfoKey(clientId: string) {\n return `${this.keyPrefix(clientId)}/client_info/`;\n }\n\n async clientInformation(): Promise<OAuthClientInformation | undefined> {\n if (!this._clientId_) {\n return undefined;\n }\n return (\n (await this.storage.get<OAuthClientInformation>(\n this.clientInfoKey(this.clientId)\n )) ?? undefined\n );\n }\n\n async saveClientInformation(\n clientInformation: OAuthClientInformationFull\n ): Promise<void> {\n await this.storage.put(\n this.clientInfoKey(clientInformation.client_id),\n clientInformation\n );\n this.clientId = clientInformation.client_id;\n }\n\n tokenKey(clientId: string) {\n return `${this.keyPrefix(clientId)}/token`;\n }\n\n async tokens(): Promise<OAuthTokens | undefined> {\n if (!this._clientId_) {\n return undefined;\n }\n return (\n (await this.storage.get<OAuthTokens>(this.tokenKey(this.clientId))) ??\n undefined\n );\n }\n\n async saveTokens(tokens: OAuthTokens): Promise<void> {\n await this.storage.put(this.tokenKey(this.clientId), tokens);\n }\n\n get authUrl() {\n return this._authUrl_;\n }\n\n stateKey(nonce: string) {\n return `/${this.clientName}/${this.serverId}/state/${nonce}`;\n }\n\n async state(): Promise<string> {\n const nonce = nanoid();\n const state = `${nonce}.${this.serverId}`;\n const storedState: StoredState = {\n nonce,\n serverId: this.serverId,\n createdAt: Date.now()\n };\n await this.storage.put(this.stateKey(nonce), storedState);\n return state;\n }\n\n async checkState(\n state: string\n ): Promise<{ valid: boolean; serverId?: string; error?: string }> {\n const parts = state.split(\".\");\n if (parts.length !== 2) {\n return { valid: false, error: \"Invalid state format\" };\n }\n\n const [nonce, serverId] = parts;\n const key = this.stateKey(nonce);\n const storedState = await this.storage.get<StoredState>(key);\n\n if (!storedState) {\n return { valid: false, error: \"State not found or already used\" };\n }\n\n if (storedState.serverId !== serverId) {\n await this.storage.delete(key);\n return { valid: false, error: \"State serverId mismatch\" };\n }\n\n const age = Date.now() - storedState.createdAt;\n if (age > STATE_EXPIRATION_MS) {\n await this.storage.delete(key);\n return { valid: false, error: \"State expired\" };\n }\n\n return { valid: true, serverId };\n }\n\n async consumeState(state: string): Promise<void> {\n const parts = state.split(\".\");\n if (parts.length !== 2) {\n // This should never happen since checkState validates format first.\n // Log for debugging but don't throw - state consumption is best-effort.\n console.warn(\n `[OAuth] consumeState called with invalid state format: ${state.substring(0, 20)}...`\n );\n return;\n }\n const [nonce] = parts;\n await this.storage.delete(this.stateKey(nonce));\n }\n\n async redirectToAuthorization(authUrl: URL): Promise<void> {\n this._authUrl_ = authUrl.toString();\n }\n\n async invalidateCredentials(\n scope: \"all\" | \"client\" | \"tokens\" | \"verifier\"\n ): Promise<void> {\n if (!this._clientId_) return;\n\n const deleteKeys: string[] = [];\n\n if (scope === \"all\" || scope === \"client\") {\n deleteKeys.push(this.clientInfoKey(this.clientId));\n }\n if (scope === \"all\" || scope === \"tokens\") {\n deleteKeys.push(this.tokenKey(this.clientId));\n }\n if (scope === \"all\" || scope === \"verifier\") {\n deleteKeys.push(this.codeVerifierKey(this.clientId));\n }\n\n if (deleteKeys.length > 0) {\n await this.storage.delete(deleteKeys);\n }\n }\n\n codeVerifierKey(clientId: string) {\n return `${this.keyPrefix(clientId)}/code_verifier`;\n }\n\n async saveCodeVerifier(verifier: string): Promise<void> {\n const key = this.codeVerifierKey(this.clientId);\n\n // Don't overwrite existing verifier to preserve first PKCE verifier\n const existing = await this.storage.get<string>(key);\n if (existing) {\n return;\n }\n\n await this.storage.put(key, verifier);\n }\n\n async codeVerifier(): Promise<string> {\n const codeVerifier = await this.storage.get<string>(\n this.codeVerifierKey(this.clientId)\n );\n if (!codeVerifier) {\n throw new Error(\"No code verifier found\");\n }\n return codeVerifier;\n }\n\n async deleteCodeVerifier(): Promise<void> {\n await this.storage.delete(this.codeVerifierKey(this.clientId));\n }\n}\n"],"mappings":";;;AASA,MAAM,sBAAsB,MAAU;AAqBtC,IAAa,mCAAb,MAA6E;CAK3E,YACE,AAAOA,SACP,AAAOC,YACP,A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AAQ,OAAO,KAAK,SAAS,MAAM,CAAC;;CAGjD,MAAM,wBAAwB,SAA6B;AACzD,OAAK,YAAY,QAAQ,UAAU;;CAGrC,MAAM,sBACJ,OACe;AACf,MAAI,CAAC,KAAK,WAAY;EAEtB,MAAMC,aAAuB,EAAE;AAE/B,MAAI,UAAU,SAAS,UAAU,SAC/B,YAAW,KAAK,KAAK,cAAc,KAAK,SAAS,CAAC;AAEpD,MAAI,UAAU,SAAS,UAAU,SAC/B,YAAW,KAAK,KAAK,SAAS,KAAK,SAAS,CAAC;AAE/C,MAAI,UAAU,SAAS,UAAU,WAC/B,YAAW,KAAK,KAAK,gBAAgB,KAAK,SAAS,CAAC;AAGtD,MAAI,WAAW,SAAS,EACtB,OAAM,KAAK,QAAQ,OAAO,WAAW;;CAIzC,gBAAgB,UAAkB;AAChC,SAAO,GAAG,KAAK,UAAU,SAAS,CAAC;;CAGrC,MAAM,iBAAiB,UAAiC;EACtD,MAAM,MAAM,KAAK,gBAAgB,KAAK,SAAS;AAI/C,MADiB,MAAM,KAAK,QAAQ,IAAY,IAAI,CAElD;AAGF,QAAM,KAAK,QAAQ,IAAI,KAAK,SAAS;;CAGvC,MAAM,eAAgC;EACpC,MAAM,eAAe,MAAM,KAAK,QAAQ,IACtC,KAAK,gBAAgB,KAAK,SAAS,CACpC;AACD,MAAI,CAAC,aACH,OAAM,IAAI,MAAM,yBAAyB;AAE3C,SAAO;;CAGT,MAAM,qBAAoC;AACxC,QAAM,KAAK,QAAQ,OAAO,KAAK,gBAAgB,KAAK,SAAS,CAAC"}
@@ -1,4 +1,4 @@
1
- import { n as BaseEvent, t as MCPObservabilityEvent } from "./mcp-CPSfGUgd.js";
1
+ import { n as BaseEvent, t as MCPObservabilityEvent } from "./mcp-AK39tq6H.js";
2
2
 
3
3
  //#region src/observability/agent.d.ts
4
4
 
@@ -55,4 +55,4 @@ export {
55
55
  genericObservability as r,
56
56
  Observability as t
57
57
  };
58
- //# sourceMappingURL=index-DLuxm_9W.d.ts.map
58
+ //# sourceMappingURL=index-B7Ny-XfU.d.ts.map