@lunora/agent 1.0.0-alpha.281 → 1.0.0-alpha.282

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.
@@ -14,6 +14,19 @@ interface AgentEmailTarget {
14
14
  /** The agent's export key (its generated class name), resolved off `ctx.exports` or `env`. */
15
15
  className: string;
16
16
  }
17
+ /**
18
+ * Options for {@link dispatchAgentEmail}.
19
+ * @experimental
20
+ */
21
+ interface DispatchAgentEmailOptions {
22
+ /**
23
+ * Largest message, in bytes, that is parsed and offered to the agents; a bigger
24
+ * one bounces before it is read. Default 10 MiB (see `@lunora/mail/inbound`'s
25
+ * `createInboundEmailHandler`), since parsing holds the raw message, its decoded
26
+ * parts and every attachment in the isolate's memory at once.
27
+ */
28
+ maxRawBytes?: number;
29
+ }
17
30
  /**
18
31
  * The worker `email(message, env, ctx)` callback. Typed with `unknown`
19
32
  * parameters so it drops straight onto the generated `composed.email` slot
@@ -32,5 +45,5 @@ type InboundAgentEmailHandler = (message: unknown, env: unknown, context: unknow
32
45
  * {@link rejectPermanently}.
33
46
  * @experimental
34
47
  */
35
- declare const dispatchAgentEmail: (targets: ReadonlyArray<AgentEmailTarget>) => InboundAgentEmailHandler;
36
- export { type AgentEmailTarget, type InboundAgentEmailHandler, dispatchAgentEmail };
48
+ declare const dispatchAgentEmail: (targets: ReadonlyArray<AgentEmailTarget>, options?: DispatchAgentEmailOptions) => InboundAgentEmailHandler;
49
+ export { type AgentEmailTarget, type DispatchAgentEmailOptions, type InboundAgentEmailHandler, dispatchAgentEmail };
package/dist/inbound.d.ts CHANGED
@@ -14,6 +14,19 @@ interface AgentEmailTarget {
14
14
  /** The agent's export key (its generated class name), resolved off `ctx.exports` or `env`. */
15
15
  className: string;
16
16
  }
17
+ /**
18
+ * Options for {@link dispatchAgentEmail}.
19
+ * @experimental
20
+ */
21
+ interface DispatchAgentEmailOptions {
22
+ /**
23
+ * Largest message, in bytes, that is parsed and offered to the agents; a bigger
24
+ * one bounces before it is read. Default 10 MiB (see `@lunora/mail/inbound`'s
25
+ * `createInboundEmailHandler`), since parsing holds the raw message, its decoded
26
+ * parts and every attachment in the isolate's memory at once.
27
+ */
28
+ maxRawBytes?: number;
29
+ }
17
30
  /**
18
31
  * The worker `email(message, env, ctx)` callback. Typed with `unknown`
19
32
  * parameters so it drops straight onto the generated `composed.email` slot
@@ -32,5 +45,5 @@ type InboundAgentEmailHandler = (message: unknown, env: unknown, context: unknow
32
45
  * {@link rejectPermanently}.
33
46
  * @experimental
34
47
  */
35
- declare const dispatchAgentEmail: (targets: ReadonlyArray<AgentEmailTarget>) => InboundAgentEmailHandler;
36
- export { type AgentEmailTarget, type InboundAgentEmailHandler, dispatchAgentEmail };
48
+ declare const dispatchAgentEmail: (targets: ReadonlyArray<AgentEmailTarget>, options?: DispatchAgentEmailOptions) => InboundAgentEmailHandler;
49
+ export { type AgentEmailTarget, type DispatchAgentEmailOptions, type InboundAgentEmailHandler, dispatchAgentEmail };
package/dist/inbound.mjs CHANGED
@@ -1 +1 @@
1
- import{createInboundEmailHandler as m,authenticatesFrom as d,parseInboundEmail as u}from"@lunora/mail/inbound";import{h as p,B as g}from"./packem_shared/branch-marker-boZ00zmk.mjs";import{w as f}from"./packem_shared/run-shard-B7iMrAI0.mjs";import{r as E}from"./packem_shared/workflow-binding-Dm9hBzx_.mjs";import{r as h}from"./packem_shared/inbound-shard-A7S7dnf_.mjs";const v="message could not be processed",c=(o,s)=>{console.error("@lunora/agent/inbound: bouncing message —",s),o.message.setReject(v)},I=o=>{const s=m({dispatch:async(a,e)=>{for(const r of o){const t=r.agent.onEmail;if(!t)continue;const n=await t(a);if(n==null)continue;const i=E(e.env,e.ctx?.exports,r.className,["create"]);if(i===void 0){c(e,`@lunora/agent: no "${r.className}" on ctx.exports or env for an inbound agent — run codegen/dev so wrangler.jsonc declares it`);return}if(p(n)){c(e,`@lunora/agent: inbound run params ${g}`);return}const l=await h(r.agent.resolveEmailShard,{email:a,envelopeTo:e.message.to},"resolveEmailShard");await i.create({params:f(n,l)});return}},parse:u,verify:d});return async(a,e,r)=>s(a,e,r)};export{I as dispatchAgentEmail};
1
+ import{createInboundEmailHandler as d,authenticatesFrom as u,parseInboundEmail as p}from"@lunora/mail/inbound";import{h as g,B as f}from"./packem_shared/branch-marker-boZ00zmk.mjs";import{w as E}from"./packem_shared/run-shard-B7iMrAI0.mjs";import{r as h}from"./packem_shared/workflow-binding-Dm9hBzx_.mjs";import{r as v}from"./packem_shared/inbound-shard-A7S7dnf_.mjs";const R="message could not be processed",c=(o,s)=>{console.error("@lunora/agent/inbound: bouncing message —",s),o.message.setReject(R)},I=(o,s={})=>{const m=d({dispatch:async(r,e)=>{for(const a of o){const t=a.agent.onEmail;if(!t)continue;const n=await t(r);if(n==null)continue;const i=h(e.env,e.ctx?.exports,a.className,["create"]);if(i===void 0){c(e,`@lunora/agent: no "${a.className}" on ctx.exports or env for an inbound agent — run codegen/dev so wrangler.jsonc declares it`);return}if(g(n)){c(e,`@lunora/agent: inbound run params ${f}`);return}const l=await v(a.agent.resolveEmailShard,{email:r,envelopeTo:e.message.to},"resolveEmailShard");await i.create({params:E(n,l)});return}},maxRawBytes:s.maxRawBytes,parse:p,verify:u});return async(r,e,a)=>m(r,e,a)};export{I as dispatchAgentEmail};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/agent",
3
- "version": "1.0.0-alpha.281",
3
+ "version": "1.0.0-alpha.282",
4
4
  "description": "Durable AI agents for Lunora: defineAgent compiles a replay-safe tool-loop onto Cloudflare Workflows, with DO SQLite threads and live message subscriptions",
5
5
  "keywords": [
6
6
  "agent",
@@ -96,7 +96,7 @@
96
96
  "@lunora/server": "^1.0.0-alpha.268",
97
97
  "@lunora/values": "^1.0.0-alpha.95",
98
98
  "@lunora/workflow": "^1.0.0-alpha.111",
99
- "@modelcontextprotocol/sdk": "^1.32.0",
99
+ "@modelcontextprotocol/sdk": "^1.32.2",
100
100
  "ai": "7.0.127",
101
101
  "yaml": "^2.9.1"
102
102
  },