agents 0.3.6 → 0.3.8
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 +303 -314
- package/dist/ai-types.js +1 -1
- package/dist/{client-0lfEZpSQ.js → client-BA8NJB6l.js} +17 -4
- package/dist/client-BA8NJB6l.js.map +1 -0
- package/dist/{client-Cxno-5sH.d.ts → client-DGpERepg.d.ts} +8 -14
- package/dist/client.d.ts +93 -24
- package/dist/client.js +202 -2
- package/dist/client.js.map +1 -0
- package/dist/{do-oauth-client-provider-BH9zFtSy.d.ts → do-oauth-client-provider-BqnOQzjy.d.ts} +1 -1
- package/dist/{do-oauth-client-provider-BfPFgQU0.js → do-oauth-client-provider-DDg8QrEA.js} +1 -1
- package/dist/{do-oauth-client-provider-BfPFgQU0.js.map → do-oauth-client-provider-DDg8QrEA.js.map} +1 -1
- package/dist/email-8ljcpvwV.d.ts +157 -0
- package/dist/email-XHsSYsTO.js +223 -0
- package/dist/email-XHsSYsTO.js.map +1 -0
- package/dist/email.d.ts +30 -0
- package/dist/email.js +3 -0
- package/dist/{index-B7Ny-XfU.d.ts → index-N6791tVt.d.ts} +18 -3
- package/dist/index.d.ts +543 -87
- package/dist/index.js +6 -6
- package/dist/{internal_context-neg89p5n.d.ts → internal_context-CEu5ji80.d.ts} +8 -3
- package/dist/{internal_context-oN047Id3.js → internal_context-D9eKFth1.js} +1 -1
- package/dist/internal_context-D9eKFth1.js.map +1 -0
- package/dist/internal_context.d.ts +1 -1
- package/dist/internal_context.js +1 -1
- package/dist/mcp/client.d.ts +1 -1
- package/dist/mcp/client.js +2 -2
- package/dist/mcp/do-oauth-client-provider.d.ts +1 -1
- package/dist/mcp/do-oauth-client-provider.js +1 -1
- package/dist/mcp/index.d.ts +4 -2
- package/dist/mcp/index.js +35 -35
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/x402.d.ts +0 -1
- package/dist/mcp/x402.js.map +1 -1
- package/dist/{mcp-AK39tq6H.d.ts → mcp-BwPscEiF.d.ts} +1 -1
- package/dist/observability/index.d.ts +1 -1
- package/dist/observability/index.js +5 -5
- package/dist/react.d.ts +70 -26
- package/dist/react.js +83 -21
- package/dist/react.js.map +1 -1
- package/dist/schedule.d.ts +23 -2
- package/dist/schedule.js +23 -1
- package/dist/schedule.js.map +1 -1
- package/dist/serializable.d.ts +68 -3
- package/dist/src-CqnVUbg1.js +2146 -0
- package/dist/src-CqnVUbg1.js.map +1 -0
- package/dist/types-BITaDFf-.js +16 -0
- package/dist/{types-4b5tlB0u.js.map → types-BITaDFf-.js.map} +1 -1
- package/dist/{types-C5vR2Gzv.d.ts → types-DSSHBW6w.d.ts} +2 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utils-B49TmLCI.js +16 -0
- package/dist/utils-B49TmLCI.js.map +1 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.js +3 -0
- package/dist/workflow-types-Z_Oem1FJ.d.ts +260 -0
- package/dist/workflow-types.d.ts +48 -0
- package/dist/workflow-types.js +16 -0
- package/dist/workflow-types.js.map +1 -0
- package/dist/workflows.d.ts +163 -0
- package/dist/workflows.js +240 -0
- package/dist/workflows.js.map +1 -0
- package/package.json +22 -12
- package/dist/client-0lfEZpSQ.js.map +0 -1
- package/dist/client-CEO0P7vN.js +0 -117
- package/dist/client-CEO0P7vN.js.map +0 -1
- package/dist/internal_context-oN047Id3.js.map +0 -1
- package/dist/src-C_iKczoR.js +0 -1191
- package/dist/src-C_iKczoR.js.map +0 -1
- package/dist/types-4b5tlB0u.js +0 -15
package/dist/client.js
CHANGED
|
@@ -1,3 +1,203 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as MessageType } from "./types-BITaDFf-.js";
|
|
2
|
+
import { t as camelCaseToKebabCase } from "./utils-B49TmLCI.js";
|
|
3
|
+
import { PartySocket } from "partysocket";
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
//#region src/client.ts
|
|
6
|
+
/**
|
|
7
|
+
* WebSocket client for connecting to an Agent
|
|
8
|
+
*/
|
|
9
|
+
var AgentClient = class extends PartySocket {
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated Use agentFetch instead
|
|
12
|
+
*/
|
|
13
|
+
static fetch(_opts) {
|
|
14
|
+
throw new Error("AgentClient.fetch is not implemented, use agentFetch instead");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Promise that resolves when identity has been received from the server.
|
|
18
|
+
* Useful for waiting before making calls that depend on knowing the instance.
|
|
19
|
+
* Resets on connection close so it can be awaited again after reconnect.
|
|
20
|
+
*/
|
|
21
|
+
get ready() {
|
|
22
|
+
return this._readyPromise;
|
|
23
|
+
}
|
|
24
|
+
_resetReady() {
|
|
25
|
+
this._readyPromise = new Promise((resolve) => {
|
|
26
|
+
this._resolveReady = resolve;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
constructor(options) {
|
|
30
|
+
const agentNamespace = camelCaseToKebabCase(options.agent);
|
|
31
|
+
const socketOptions = options.basePath ? {
|
|
32
|
+
basePath: options.basePath,
|
|
33
|
+
path: options.path,
|
|
34
|
+
...options
|
|
35
|
+
} : {
|
|
36
|
+
party: agentNamespace,
|
|
37
|
+
prefix: "agents",
|
|
38
|
+
room: options.name || "default",
|
|
39
|
+
path: options.path,
|
|
40
|
+
...options
|
|
41
|
+
};
|
|
42
|
+
super(socketOptions);
|
|
43
|
+
this.identified = false;
|
|
44
|
+
this._pendingCalls = /* @__PURE__ */ new Map();
|
|
45
|
+
this._previousName = null;
|
|
46
|
+
this._previousAgent = null;
|
|
47
|
+
this.agent = agentNamespace;
|
|
48
|
+
this.name = options.name || "default";
|
|
49
|
+
this.options = options;
|
|
50
|
+
this._resetReady();
|
|
51
|
+
this.addEventListener("message", (event) => {
|
|
52
|
+
if (typeof event.data === "string") {
|
|
53
|
+
let parsedMessage;
|
|
54
|
+
try {
|
|
55
|
+
parsedMessage = JSON.parse(event.data);
|
|
56
|
+
} catch (_error) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (parsedMessage.type === MessageType.CF_AGENT_IDENTITY) {
|
|
60
|
+
const oldName = this._previousName;
|
|
61
|
+
const oldAgent = this._previousAgent;
|
|
62
|
+
const newName = parsedMessage.name;
|
|
63
|
+
const newAgent = parsedMessage.agent;
|
|
64
|
+
this.identified = true;
|
|
65
|
+
this._resolveReady();
|
|
66
|
+
if (oldName !== null && oldAgent !== null && (oldName !== newName || oldAgent !== newAgent)) if (this.options.onIdentityChange) this.options.onIdentityChange(oldName, newName, oldAgent, newAgent);
|
|
67
|
+
else {
|
|
68
|
+
const agentChanged = oldAgent !== newAgent;
|
|
69
|
+
const nameChanged = oldName !== newName;
|
|
70
|
+
let changeDescription = "";
|
|
71
|
+
if (agentChanged && nameChanged) changeDescription = `agent "${oldAgent}" → "${newAgent}", instance "${oldName}" → "${newName}"`;
|
|
72
|
+
else if (agentChanged) changeDescription = `agent "${oldAgent}" → "${newAgent}"`;
|
|
73
|
+
else changeDescription = `instance "${oldName}" → "${newName}"`;
|
|
74
|
+
console.warn(`[agents] Identity changed on reconnect: ${changeDescription}. This can happen with server-side routing (e.g., basePath with getAgentByName) where the instance is determined by auth/session. Provide onIdentityChange callback to handle this explicitly, or ignore if this is expected for your routing pattern.`);
|
|
75
|
+
}
|
|
76
|
+
this._previousName = newName;
|
|
77
|
+
this._previousAgent = newAgent;
|
|
78
|
+
this.name = newName;
|
|
79
|
+
this.agent = newAgent;
|
|
80
|
+
this.options.onIdentity?.(newName, newAgent);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (parsedMessage.type === MessageType.CF_AGENT_STATE) {
|
|
84
|
+
this.options.onStateUpdate?.(parsedMessage.state, "server");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (parsedMessage.type === MessageType.RPC) {
|
|
88
|
+
const response = parsedMessage;
|
|
89
|
+
const pending = this._pendingCalls.get(response.id);
|
|
90
|
+
if (!pending) return;
|
|
91
|
+
if (!response.success) {
|
|
92
|
+
pending.reject(new Error(response.error));
|
|
93
|
+
this._pendingCalls.delete(response.id);
|
|
94
|
+
pending.stream?.onError?.(response.error);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if ("done" in response) if (response.done) {
|
|
98
|
+
pending.resolve(response.result);
|
|
99
|
+
this._pendingCalls.delete(response.id);
|
|
100
|
+
pending.stream?.onDone?.(response.result);
|
|
101
|
+
} else pending.stream?.onChunk?.(response.result);
|
|
102
|
+
else {
|
|
103
|
+
pending.resolve(response.result);
|
|
104
|
+
this._pendingCalls.delete(response.id);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
this.addEventListener("close", () => {
|
|
110
|
+
this.identified = false;
|
|
111
|
+
this._resetReady();
|
|
112
|
+
this._rejectPendingCalls("Connection closed");
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Reject all pending RPC calls with the given reason.
|
|
117
|
+
*/
|
|
118
|
+
_rejectPendingCalls(reason) {
|
|
119
|
+
const error = new Error(reason);
|
|
120
|
+
for (const pending of this._pendingCalls.values()) {
|
|
121
|
+
pending.reject(error);
|
|
122
|
+
pending.stream?.onError?.(reason);
|
|
123
|
+
}
|
|
124
|
+
this._pendingCalls.clear();
|
|
125
|
+
}
|
|
126
|
+
setState(state) {
|
|
127
|
+
this.send(JSON.stringify({
|
|
128
|
+
state,
|
|
129
|
+
type: MessageType.CF_AGENT_STATE
|
|
130
|
+
}));
|
|
131
|
+
this.options.onStateUpdate?.(state, "client");
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Close the connection and immediately reject all pending RPC calls.
|
|
135
|
+
* This provides immediate feedback on intentional close rather than
|
|
136
|
+
* waiting for the WebSocket close handshake to complete.
|
|
137
|
+
*
|
|
138
|
+
* Note: Any calls made after `close()` will be rejected when the
|
|
139
|
+
* underlying WebSocket close event fires.
|
|
140
|
+
*/
|
|
141
|
+
close(code, reason) {
|
|
142
|
+
this._rejectPendingCalls("Connection closed");
|
|
143
|
+
super.close(code, reason);
|
|
144
|
+
}
|
|
145
|
+
async call(method, args = [], options) {
|
|
146
|
+
return new Promise((resolve, reject) => {
|
|
147
|
+
const id = crypto.randomUUID();
|
|
148
|
+
let timeoutId;
|
|
149
|
+
const isLegacyFormat = options && ("onChunk" in options || "onDone" in options || "onError" in options);
|
|
150
|
+
const streamOptions = isLegacyFormat ? options : options?.stream;
|
|
151
|
+
const timeout = isLegacyFormat ? void 0 : options?.timeout;
|
|
152
|
+
if (timeout) timeoutId = setTimeout(() => {
|
|
153
|
+
const pending = this._pendingCalls.get(id);
|
|
154
|
+
this._pendingCalls.delete(id);
|
|
155
|
+
const errorMessage = `RPC call to ${method} timed out after ${timeout}ms`;
|
|
156
|
+
pending?.stream?.onError?.(errorMessage);
|
|
157
|
+
reject(new Error(errorMessage));
|
|
158
|
+
}, timeout);
|
|
159
|
+
this._pendingCalls.set(id, {
|
|
160
|
+
reject: (e) => {
|
|
161
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
162
|
+
reject(e);
|
|
163
|
+
},
|
|
164
|
+
resolve: (value) => {
|
|
165
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
166
|
+
resolve(value);
|
|
167
|
+
},
|
|
168
|
+
stream: streamOptions,
|
|
169
|
+
type: null
|
|
170
|
+
});
|
|
171
|
+
const request = {
|
|
172
|
+
args,
|
|
173
|
+
id,
|
|
174
|
+
method,
|
|
175
|
+
type: MessageType.RPC
|
|
176
|
+
};
|
|
177
|
+
this.send(JSON.stringify(request));
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Make an HTTP request to an Agent
|
|
183
|
+
* @param opts Connection options
|
|
184
|
+
* @param init Request initialization options
|
|
185
|
+
* @returns Promise resolving to a Response
|
|
186
|
+
*/
|
|
187
|
+
function agentFetch(opts, init) {
|
|
188
|
+
const agentNamespace = camelCaseToKebabCase(opts.agent);
|
|
189
|
+
if (opts.basePath) return PartySocket.fetch({
|
|
190
|
+
basePath: opts.basePath,
|
|
191
|
+
...opts
|
|
192
|
+
}, init);
|
|
193
|
+
return PartySocket.fetch({
|
|
194
|
+
party: agentNamespace,
|
|
195
|
+
prefix: "agents",
|
|
196
|
+
room: opts.name || "default",
|
|
197
|
+
...opts
|
|
198
|
+
}, init);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
//#endregion
|
|
202
|
+
export { AgentClient, agentFetch };
|
|
203
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"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 (ignored if basePath is set) */\n agent: string;\n /** Name of the specific Agent instance (ignored if basePath is set) */\n name?: string;\n /**\n * Full URL path - bypasses agent/name URL construction.\n * When set, the client connects to this path directly.\n * Server must handle routing manually (e.g., with getAgentByName + fetch).\n * @example\n * // Client connects to /user, server routes based on session\n * useAgent({ agent: \"UserAgent\", basePath: \"user\" })\n */\n basePath?: string;\n /** Called when the Agent's state is updated */\n onStateUpdate?: (state: State, source: \"server\" | \"client\") => void;\n /**\n * Called when the server sends the agent's identity on connect.\n * Useful when using basePath, as the actual instance name is determined server-side.\n * @param name The actual agent instance name\n * @param agent The agent class name (kebab-case)\n */\n onIdentity?: (name: string, agent: string) => void;\n /**\n * Called when identity changes on reconnect (different instance than before).\n * If not provided and identity changes, a warning will be logged.\n * @param oldName Previous instance name\n * @param newName New instance name\n * @param oldAgent Previous agent class name\n * @param newAgent New agent class name\n */\n onIdentityChange?: (\n oldName: string,\n newName: string,\n oldAgent: string,\n newAgent: string\n ) => void;\n /**\n * Additional path to append to the URL.\n * Works with both standard routing and basePath.\n * @example\n * // With basePath: /user/settings\n * { basePath: \"user\", path: \"settings\" }\n * // Standard: /agents/my-agent/room/settings\n * { agent: \"MyAgent\", name: \"room\", path: \"settings\" }\n */\n path?: string;\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 RPC calls\n */\nexport type CallOptions = {\n /** Timeout in milliseconds. If the call doesn't complete within this time, it will be rejected. */\n timeout?: number;\n /** Streaming options for handling streaming responses */\n stream?: StreamOptions;\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 (ignored if basePath is set) */\n agent: string;\n /** Name of the specific Agent instance (ignored if basePath is set) */\n name?: string;\n /**\n * Full URL path - bypasses agent/name URL construction.\n * When set, the request is made to this path directly.\n */\n basePath?: string;\n};\n\nimport { camelCaseToKebabCase } from \"./utils\";\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\n /**\n * Whether the client has received identity from the server.\n * Becomes true after the first identity message is received.\n * Resets to false on connection close.\n */\n identified = false;\n\n /**\n * Promise that resolves when identity has been received from the server.\n * Useful for waiting before making calls that depend on knowing the instance.\n * Resets on connection close so it can be awaited again after reconnect.\n */\n get ready(): Promise<void> {\n return this._readyPromise;\n }\n\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 private _readyPromise!: Promise<void>;\n private _resolveReady!: () => void;\n private _previousName: string | null = null;\n private _previousAgent: string | null = null;\n\n private _resetReady() {\n this._readyPromise = new Promise((resolve) => {\n this._resolveReady = resolve;\n });\n }\n\n constructor(options: AgentClientOptions<State>) {\n const agentNamespace = camelCaseToKebabCase(options.agent);\n\n // If basePath is provided, use it directly; otherwise construct from agent/name\n const socketOptions = options.basePath\n ? { basePath: options.basePath, path: options.path, ...options }\n : {\n party: agentNamespace,\n prefix: \"agents\",\n room: options.name || \"default\",\n path: options.path,\n ...options\n };\n\n super(socketOptions);\n this.agent = agentNamespace;\n this.name = options.name || \"default\";\n this.options = options;\n\n // Initialize ready promise\n this._resetReady();\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_IDENTITY) {\n const oldName = this._previousName;\n const oldAgent = this._previousAgent;\n const newName = parsedMessage.name as string;\n const newAgent = parsedMessage.agent as string;\n\n // Resolve ready/identified\n this.identified = true;\n this._resolveReady();\n\n // Detect identity change on reconnect\n if (\n oldName !== null &&\n oldAgent !== null &&\n (oldName !== newName || oldAgent !== newAgent)\n ) {\n if (this.options.onIdentityChange) {\n this.options.onIdentityChange(\n oldName,\n newName,\n oldAgent,\n newAgent\n );\n } else {\n const agentChanged = oldAgent !== newAgent;\n const nameChanged = oldName !== newName;\n let changeDescription = \"\";\n if (agentChanged && nameChanged) {\n changeDescription = `agent \"${oldAgent}\" → \"${newAgent}\", instance \"${oldName}\" → \"${newName}\"`;\n } else if (agentChanged) {\n changeDescription = `agent \"${oldAgent}\" → \"${newAgent}\"`;\n } else {\n changeDescription = `instance \"${oldName}\" → \"${newName}\"`;\n }\n console.warn(\n `[agents] Identity changed on reconnect: ${changeDescription}. ` +\n \"This can happen with server-side routing (e.g., basePath with getAgentByName) \" +\n \"where the instance is determined by auth/session. \" +\n \"Provide onIdentityChange callback to handle this explicitly, \" +\n \"or ignore if this is expected for your routing pattern.\"\n );\n }\n }\n\n // Always update from server identity (server is authoritative)\n this._previousName = newName;\n this._previousAgent = newAgent;\n this.name = newName;\n this.agent = newAgent;\n\n // Call onIdentity callback\n this.options.onIdentity?.(newName, newAgent);\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 // Clean up pending calls and reset ready state when connection closes\n this.addEventListener(\"close\", () => {\n // Reset ready state for next connection\n this.identified = false;\n this._resetReady();\n\n // Reject any remaining pending calls (e.g., from unexpected disconnect)\n this._rejectPendingCalls(\"Connection closed\");\n });\n }\n\n /**\n * Reject all pending RPC calls with the given reason.\n */\n private _rejectPendingCalls(reason: string) {\n const error = new Error(reason);\n for (const pending of this._pendingCalls.values()) {\n pending.reject(error);\n pending.stream?.onError?.(reason);\n }\n this._pendingCalls.clear();\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 * Close the connection and immediately reject all pending RPC calls.\n * This provides immediate feedback on intentional close rather than\n * waiting for the WebSocket close handshake to complete.\n *\n * Note: Any calls made after `close()` will be rejected when the\n * underlying WebSocket close event fires.\n */\n close(code?: number, reason?: string) {\n // Immediately reject all pending calls on intentional close\n this._rejectPendingCalls(\"Connection closed\");\n\n // Then close the underlying socket\n super.close(code, reason);\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 options Options for the call (timeout, streaming) or legacy StreamOptions\n * @returns Promise that resolves with the method's return value\n */\n call<T extends SerializableReturnValue>(\n method: string,\n args?: SerializableValue[],\n options?: CallOptions | StreamOptions\n ): Promise<T>;\n call<T = unknown>(\n method: string,\n args?: unknown[],\n options?: CallOptions | StreamOptions\n ): Promise<T>;\n async call<T>(\n method: string,\n args: unknown[] = [],\n options?: CallOptions | StreamOptions\n ): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const id = crypto.randomUUID();\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n\n // Detect legacy format: { onChunk?, onDone?, onError? } vs new format: { timeout?, stream? }\n const isLegacyFormat =\n options &&\n (\"onChunk\" in options || \"onDone\" in options || \"onError\" in options);\n const streamOptions = isLegacyFormat\n ? (options as StreamOptions)\n : (options as CallOptions | undefined)?.stream;\n const timeout = isLegacyFormat\n ? undefined\n : (options as CallOptions | undefined)?.timeout;\n\n // Set up timeout if specified\n if (timeout) {\n timeoutId = setTimeout(() => {\n const pending = this._pendingCalls.get(id);\n this._pendingCalls.delete(id);\n const errorMessage = `RPC call to ${method} timed out after ${timeout}ms`;\n // Call stream onError callback if present (for streaming calls)\n pending?.stream?.onError?.(errorMessage);\n reject(new Error(errorMessage));\n }, timeout);\n }\n\n this._pendingCalls.set(id, {\n reject: (e: Error) => {\n if (timeoutId) clearTimeout(timeoutId);\n reject(e);\n },\n resolve: (value: unknown) => {\n if (timeoutId) clearTimeout(timeoutId);\n resolve(value as T);\n },\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 // If basePath is provided, use it directly; otherwise construct from agent/name\n // When basePath is set, room/party aren't used by PartySocket (basePath replaces the URL)\n if (opts.basePath) {\n return PartySocket.fetch(\n { basePath: opts.basePath, ...opts } as unknown as PartyFetchOptions,\n init\n );\n }\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":";;;;;;;;AAgHA,IAAa,cAAb,cAAkD,YAAY;;;;CAI5D,OAAO,MAAM,OAA6C;AACxD,QAAM,IAAI,MACR,+DACD;;;;;;;CAiBH,IAAI,QAAuB;AACzB,SAAO,KAAK;;CAkBd,AAAQ,cAAc;AACpB,OAAK,gBAAgB,IAAI,SAAS,YAAY;AAC5C,QAAK,gBAAgB;IACrB;;CAGJ,YAAY,SAAoC;EAC9C,MAAM,iBAAiB,qBAAqB,QAAQ,MAAM;EAG1D,MAAM,gBAAgB,QAAQ,WAC1B;GAAE,UAAU,QAAQ;GAAU,MAAM,QAAQ;GAAM,GAAG;GAAS,GAC9D;GACE,OAAO;GACP,QAAQ;GACR,MAAM,QAAQ,QAAQ;GACtB,MAAM,QAAQ;GACd,GAAG;GACJ;AAEL,QAAM,cAAc;oBA9CT;uCAYW,IAAI,KAQzB;uBAGoC;wBACC;AAuBtC,OAAK,QAAQ;AACb,OAAK,OAAO,QAAQ,QAAQ;AAC5B,OAAK,UAAU;AAGf,OAAK,aAAa;AAElB,OAAK,iBAAiB,YAAY,UAAU;AAC1C,OAAI,OAAO,MAAM,SAAS,UAAU;IAClC,IAAI;AACJ,QAAI;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AQ;AAGb,QAAK,cAAc,IAAI,IAAI;IACzB,SAAS,MAAa;AACpB,SAAI,UAAW,cAAa,UAAU;AACtC,YAAO,EAAE;;IAEX,UAAU,UAAmB;AAC3B,SAAI,UAAW,cAAa,UAAU;AACtC,aAAQ,MAAW;;IAErB,QAAQ;IACR,MAAM;IACP,CAAC;GAEF,MAAM,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;AAIvD,KAAI,KAAK,SACP,QAAO,YAAY,MACjB;EAAE,UAAU,KAAK;EAAU,GAAG;EAAM,EACpC,KACD;AAGH,QAAO,YAAY,MACjB;EACE,OAAO;EACP,QAAQ;EACR,MAAM,KAAK,QAAQ;EACnB,GAAG;EACJ,EACD,KACD"}
|
package/dist/{do-oauth-client-provider-BH9zFtSy.d.ts → do-oauth-client-provider-BqnOQzjy.d.ts}
RENAMED
|
@@ -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-
|
|
70
|
+
//# sourceMappingURL=do-oauth-client-provider-BqnOQzjy.d.ts.map
|
package/dist/{do-oauth-client-provider-BfPFgQU0.js.map → do-oauth-client-provider-DDg8QrEA.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
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,AAAOC,iBACP;EAHO;EACA;EACA;AAEP,MAAI,CAAC,QAC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M,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-DDg8QrEA.js","names":[],"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,AAAO,SACP,AAAO,YACP,AAAO,iBACP;EAHO;EACA;EACA;AAEP,MAAI,CAAC,QACH,OAAM,IAAI,MACR,kFACD;;CAIL,IAAI,iBAAsC;AACxC,SAAO;GACL,aAAa,KAAK;GAClB,YAAY,KAAK;GACjB,aAAa,CAAC,sBAAsB,gBAAgB;GACpD,eAAe,CAAC,KAAK,YAAY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AU,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"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
//#region src/email.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Header object as returned by postal-mime and similar email parsing libraries.
|
|
4
|
+
* Each header has a lowercase key and a string value.
|
|
5
|
+
*/
|
|
6
|
+
type EmailHeader = {
|
|
7
|
+
/** Lowercase header name (e.g., "content-type", "x-custom-header") */ key: string; /** Header value */
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Check if an email appears to be an auto-reply based on standard headers.
|
|
12
|
+
* Checks for Auto-Submitted (RFC 3834), X-Auto-Response-Suppress, and Precedence headers.
|
|
13
|
+
*
|
|
14
|
+
* @param headers - Headers array from postal-mime Email.headers or similar format
|
|
15
|
+
* @returns true if email appears to be an auto-reply
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* if (isAutoReplyEmail(parsed.headers)) {
|
|
20
|
+
* // Skip processing auto-replies
|
|
21
|
+
* return;
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function isAutoReplyEmail(headers: EmailHeader[]): boolean;
|
|
26
|
+
/** Default signature expiration: 30 days in seconds */
|
|
27
|
+
declare const DEFAULT_MAX_AGE_SECONDS: number;
|
|
28
|
+
/**
|
|
29
|
+
* Sign agent routing headers for secure reply flows.
|
|
30
|
+
* Use this when sending outbound emails to ensure replies can be securely routed back.
|
|
31
|
+
*
|
|
32
|
+
* @param secret - Secret key for HMAC signing (store in environment variables)
|
|
33
|
+
* @param agentName - Name of the agent
|
|
34
|
+
* @param agentId - ID of the agent instance
|
|
35
|
+
* @returns Headers object with X-Agent-Name, X-Agent-ID, X-Agent-Sig, and X-Agent-Sig-Ts
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const headers = await signAgentHeaders(env.EMAIL_SECRET, "MyAgent", this.name);
|
|
40
|
+
* // Use these headers when sending outbound emails
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare function signAgentHeaders(
|
|
44
|
+
secret: string,
|
|
45
|
+
agentName: string,
|
|
46
|
+
agentId: string
|
|
47
|
+
): Promise<Record<string, string>>;
|
|
48
|
+
type EmailResolverResult = {
|
|
49
|
+
agentName: string;
|
|
50
|
+
agentId: string; /** @internal Indicates this resolver requires secure reply signing */
|
|
51
|
+
_secureRouted?: boolean;
|
|
52
|
+
} | null;
|
|
53
|
+
type EmailResolver<Env> = (
|
|
54
|
+
email: ForwardableEmailMessage,
|
|
55
|
+
env: Env
|
|
56
|
+
) => Promise<EmailResolverResult>;
|
|
57
|
+
/**
|
|
58
|
+
* Reason for signature verification failure
|
|
59
|
+
*/
|
|
60
|
+
type SignatureFailureReason =
|
|
61
|
+
| "missing_headers"
|
|
62
|
+
| "expired"
|
|
63
|
+
| "invalid"
|
|
64
|
+
| "malformed_timestamp";
|
|
65
|
+
/**
|
|
66
|
+
* Options for createSecureReplyEmailResolver
|
|
67
|
+
*/
|
|
68
|
+
type SecureReplyResolverOptions = {
|
|
69
|
+
/**
|
|
70
|
+
* Maximum age of signature in seconds.
|
|
71
|
+
* Signatures older than this will be rejected.
|
|
72
|
+
* Default: 30 days (2592000 seconds)
|
|
73
|
+
*/
|
|
74
|
+
maxAge?: number;
|
|
75
|
+
/**
|
|
76
|
+
* Callback invoked when signature verification fails.
|
|
77
|
+
* Useful for logging and debugging.
|
|
78
|
+
*/
|
|
79
|
+
onInvalidSignature?: (
|
|
80
|
+
email: ForwardableEmailMessage,
|
|
81
|
+
reason: SignatureFailureReason
|
|
82
|
+
) => void;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated REMOVED due to security vulnerability (IDOR via spoofed headers).
|
|
86
|
+
* @throws Always throws an error with migration guidance.
|
|
87
|
+
*/
|
|
88
|
+
declare function createHeaderBasedEmailResolver<Env>(): EmailResolver<Env>;
|
|
89
|
+
/**
|
|
90
|
+
* Create a resolver for routing email replies with signature verification.
|
|
91
|
+
* This resolver verifies that replies contain a valid HMAC signature, preventing
|
|
92
|
+
* attackers from routing emails to arbitrary agent instances.
|
|
93
|
+
*
|
|
94
|
+
* @param secret - Secret key for HMAC verification (must match the key used with signAgentHeaders)
|
|
95
|
+
* @param options - Optional configuration for signature verification
|
|
96
|
+
* @returns A function that resolves the agent to route the email to, or null if signature is invalid
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* // In your email handler
|
|
101
|
+
* const secureResolver = createSecureReplyEmailResolver(env.EMAIL_SECRET, {
|
|
102
|
+
* maxAge: 7 * 24 * 60 * 60, // 7 days
|
|
103
|
+
* onInvalidSignature: (email, reason) => {
|
|
104
|
+
* console.warn(`Invalid signature from ${email.from}: ${reason}`);
|
|
105
|
+
* }
|
|
106
|
+
* });
|
|
107
|
+
* const addressResolver = createAddressBasedEmailResolver("MyAgent");
|
|
108
|
+
*
|
|
109
|
+
* await routeAgentEmail(email, env, {
|
|
110
|
+
* resolver: async (email, env) => {
|
|
111
|
+
* // Try secure reply routing first
|
|
112
|
+
* const replyRouting = await secureResolver(email, env);
|
|
113
|
+
* if (replyRouting) return replyRouting;
|
|
114
|
+
* // Fall back to address-based routing
|
|
115
|
+
* return addressResolver(email, env);
|
|
116
|
+
* }
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
declare function createSecureReplyEmailResolver<Env>(
|
|
121
|
+
secret: string,
|
|
122
|
+
options?: SecureReplyResolverOptions
|
|
123
|
+
): EmailResolver<Env>;
|
|
124
|
+
/**
|
|
125
|
+
* Create a resolver that uses the email address to determine the agent to route the email to
|
|
126
|
+
* @param defaultAgentName The default agent name to use if the email address does not contain a sub-address
|
|
127
|
+
* @returns A function that resolves the agent to route the email to
|
|
128
|
+
*/
|
|
129
|
+
declare function createAddressBasedEmailResolver<Env>(
|
|
130
|
+
defaultAgentName: string
|
|
131
|
+
): EmailResolver<Env>;
|
|
132
|
+
/**
|
|
133
|
+
* Create a resolver that uses the agentName and agentId to determine the agent to route the email to
|
|
134
|
+
* @param agentName The name of the agent to route the email to
|
|
135
|
+
* @param agentId The id of the agent to route the email to
|
|
136
|
+
* @returns A function that resolves the agent to route the email to
|
|
137
|
+
*/
|
|
138
|
+
declare function createCatchAllEmailResolver<Env>(
|
|
139
|
+
agentName: string,
|
|
140
|
+
agentId: string
|
|
141
|
+
): EmailResolver<Env>;
|
|
142
|
+
//#endregion
|
|
143
|
+
export {
|
|
144
|
+
SecureReplyResolverOptions as a,
|
|
145
|
+
createCatchAllEmailResolver as c,
|
|
146
|
+
isAutoReplyEmail as d,
|
|
147
|
+
signAgentHeaders as f,
|
|
148
|
+
EmailResolverResult as i,
|
|
149
|
+
createHeaderBasedEmailResolver as l,
|
|
150
|
+
EmailHeader as n,
|
|
151
|
+
SignatureFailureReason as o,
|
|
152
|
+
EmailResolver as r,
|
|
153
|
+
createAddressBasedEmailResolver as s,
|
|
154
|
+
DEFAULT_MAX_AGE_SECONDS as t,
|
|
155
|
+
createSecureReplyEmailResolver as u
|
|
156
|
+
};
|
|
157
|
+
//# sourceMappingURL=email-8ljcpvwV.d.ts.map
|