agents 0.11.0 → 0.11.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.
- package/dist/{client-QBjFV5de.js → client-PEDsNnfY.js} +47 -23
- package/dist/client-PEDsNnfY.js.map +1 -0
- package/dist/client.d.ts +1 -1
- package/dist/{index-CrOzHA2T.d.ts → index-BBh8iKgk.d.ts} +137 -55
- package/dist/{index-Cubsi2Qv.d.ts → index-Biv6K70p.d.ts} +9 -1
- package/dist/index.d.ts +27 -23
- package/dist/index.js +58 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/client.d.ts +1 -1
- package/dist/mcp/client.js +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/observability/index.d.ts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/package.json +7 -7
- package/dist/client-QBjFV5de.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
1
|
import { r as __DO_NOT_USE_WILL_BREAK__agentContext } from "./internal_context-BvuGZieY.js";
|
|
2
2
|
import { t as RetryOptions } from "./retries-JlwH9mnV.js";
|
|
3
3
|
import {
|
|
4
|
-
A as
|
|
5
|
-
C as
|
|
6
|
-
D as
|
|
7
|
-
E as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
A as callable,
|
|
5
|
+
C as SendEmailOptions,
|
|
6
|
+
D as SubAgentClass,
|
|
7
|
+
E as StreamingResponse,
|
|
8
|
+
F as unstable_callable,
|
|
9
|
+
M as getCurrentAgent,
|
|
10
|
+
N as routeAgentEmail,
|
|
11
|
+
O as SubAgentStub,
|
|
12
|
+
P as routeAgentRequest,
|
|
13
|
+
S as Schedule,
|
|
14
|
+
T as StateUpdateMessage,
|
|
15
|
+
_ as MCPServerMessage,
|
|
14
16
|
a as AgentNamespace,
|
|
15
|
-
b as
|
|
17
|
+
b as RPCRequest,
|
|
16
18
|
c as CallableMetadata,
|
|
17
19
|
d as DEFAULT_AGENT_STATIC_OPTIONS,
|
|
18
|
-
dt as TransportType,
|
|
19
20
|
f as EmailRoutingOptions,
|
|
20
|
-
g as
|
|
21
|
-
h as
|
|
21
|
+
g as MCPServer,
|
|
22
|
+
h as FiberRecoveryContext,
|
|
22
23
|
i as AgentContext,
|
|
23
|
-
j as
|
|
24
|
-
k as
|
|
24
|
+
j as getAgentByName,
|
|
25
|
+
k as WSMessage,
|
|
25
26
|
l as Connection,
|
|
26
|
-
m as
|
|
27
|
+
m as FiberContext,
|
|
27
28
|
n as AddRpcMcpServerOptions,
|
|
28
29
|
o as AgentOptions,
|
|
29
|
-
p as
|
|
30
|
+
p as EmailSendBinding,
|
|
31
|
+
pt as TransportType,
|
|
30
32
|
r as Agent,
|
|
31
33
|
s as AgentStaticOptions,
|
|
32
34
|
t as AddMcpServerOptions,
|
|
33
35
|
u as ConnectionContext,
|
|
34
|
-
v as
|
|
35
|
-
w as
|
|
36
|
-
x as
|
|
37
|
-
y as
|
|
38
|
-
} from "./index-
|
|
36
|
+
v as MCPServersState,
|
|
37
|
+
w as SqlError,
|
|
38
|
+
x as RPCResponse,
|
|
39
|
+
y as QueueItem
|
|
40
|
+
} from "./index-BBh8iKgk.js";
|
|
39
41
|
import {
|
|
40
42
|
n as AgentsOAuthProvider,
|
|
41
43
|
r as DurableObjectOAuthClientProvider,
|
|
@@ -59,6 +61,7 @@ export {
|
|
|
59
61
|
DEFAULT_AGENT_STATIC_OPTIONS,
|
|
60
62
|
DurableObjectOAuthClientProvider,
|
|
61
63
|
EmailRoutingOptions,
|
|
64
|
+
EmailSendBinding,
|
|
62
65
|
FiberContext,
|
|
63
66
|
FiberRecoveryContext,
|
|
64
67
|
MCPServer,
|
|
@@ -70,6 +73,7 @@ export {
|
|
|
70
73
|
RPCResponse,
|
|
71
74
|
RetryOptions,
|
|
72
75
|
Schedule,
|
|
76
|
+
SendEmailOptions,
|
|
73
77
|
SqlError,
|
|
74
78
|
StateUpdateMessage,
|
|
75
79
|
StreamingResponse,
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createHeaderBasedEmailResolver, signAgentHeaders } from "./email.js";
|
|
|
4
4
|
import { __DO_NOT_USE_WILL_BREAK__agentContext } from "./internal_context.js";
|
|
5
5
|
import { i as _classPrivateFieldInitSpec, n as _classPrivateFieldSet2, t as _classPrivateFieldGet2 } from "./classPrivateFieldGet2-BVdP0e3Z.js";
|
|
6
6
|
import { isErrorRetryable, tryN, validateRetryOptions } from "./retries.js";
|
|
7
|
-
import { o as RPC_DO_PREFIX, r as MCPConnectionState, s as DisposableStore, t as MCPClientManager } from "./client-
|
|
7
|
+
import { o as RPC_DO_PREFIX, r as MCPConnectionState, s as DisposableStore, t as MCPClientManager } from "./client-PEDsNnfY.js";
|
|
8
8
|
import { DurableObjectOAuthClientProvider } from "./mcp/do-oauth-client-provider.js";
|
|
9
9
|
import { genericObservability } from "./observability/index.js";
|
|
10
10
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -1075,6 +1075,63 @@ var Agent = class Agent extends Server {
|
|
|
1075
1075
|
});
|
|
1076
1076
|
});
|
|
1077
1077
|
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Send an outbound email via an Email Service binding.
|
|
1080
|
+
*
|
|
1081
|
+
* Automatically injects agent routing headers (X-Agent-Name, X-Agent-ID).
|
|
1082
|
+
* When `secret` is provided, signs headers with HMAC-SHA256 so that replies
|
|
1083
|
+
* can be routed back to this agent instance via createSecureReplyEmailResolver.
|
|
1084
|
+
*
|
|
1085
|
+
* @param options.binding The send_email binding (e.g. this.env.EMAIL)
|
|
1086
|
+
* @param options.to Recipient address(es)
|
|
1087
|
+
* @param options.from Sender address or {email, name} object
|
|
1088
|
+
* @param options.subject Email subject line
|
|
1089
|
+
* @param options.text Plain text body (at least one of text/html required)
|
|
1090
|
+
* @param options.html HTML body (at least one of text/html required)
|
|
1091
|
+
* @param options.replyTo Reply-to address
|
|
1092
|
+
* @param options.cc CC recipient(s)
|
|
1093
|
+
* @param options.bcc BCC recipient(s)
|
|
1094
|
+
* @param options.inReplyTo Message-ID of the email this is replying to (for threading)
|
|
1095
|
+
* @param options.headers Additional custom headers
|
|
1096
|
+
* @param options.secret Secret for signing agent routing headers
|
|
1097
|
+
* @returns The messageId from Email Service
|
|
1098
|
+
*/
|
|
1099
|
+
async sendEmail(options) {
|
|
1100
|
+
return this._tryCatch(async () => {
|
|
1101
|
+
if (!options.binding) throw new Error("binding is required. Pass your send_email binding, e.g. this.sendEmail({ binding: this.env.EMAIL, ... }).");
|
|
1102
|
+
const agentName = camelCaseToKebabCase(this._ParentClass.name);
|
|
1103
|
+
const agentId = this.name;
|
|
1104
|
+
const headers = {
|
|
1105
|
+
...options.headers,
|
|
1106
|
+
"X-Agent-Name": agentName,
|
|
1107
|
+
"X-Agent-ID": agentId
|
|
1108
|
+
};
|
|
1109
|
+
if (options.inReplyTo) headers["In-Reply-To"] = options.inReplyTo;
|
|
1110
|
+
if (typeof options.secret === "string") {
|
|
1111
|
+
const signedHeaders = await signAgentHeaders(options.secret, agentName, agentId);
|
|
1112
|
+
headers["X-Agent-Sig"] = signedHeaders["X-Agent-Sig"];
|
|
1113
|
+
headers["X-Agent-Sig-Ts"] = signedHeaders["X-Agent-Sig-Ts"];
|
|
1114
|
+
}
|
|
1115
|
+
const result = await options.binding.send({
|
|
1116
|
+
from: options.from,
|
|
1117
|
+
to: options.to,
|
|
1118
|
+
subject: options.subject,
|
|
1119
|
+
text: options.text,
|
|
1120
|
+
html: options.html,
|
|
1121
|
+
replyTo: options.replyTo,
|
|
1122
|
+
cc: options.cc,
|
|
1123
|
+
bcc: options.bcc,
|
|
1124
|
+
headers
|
|
1125
|
+
});
|
|
1126
|
+
const fromAddr = typeof options.from === "string" ? options.from : options.from.email;
|
|
1127
|
+
this._emit("email:send", {
|
|
1128
|
+
from: fromAddr,
|
|
1129
|
+
to: options.to,
|
|
1130
|
+
subject: options.subject
|
|
1131
|
+
});
|
|
1132
|
+
return result;
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1078
1135
|
async _tryCatch(fn) {
|
|
1079
1136
|
try {
|
|
1080
1137
|
return await fn();
|