agents 0.0.0-9069759 → 0.0.0-956c772

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/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Server, Connection, PartyServerOptions } from "partyserver";
2
2
  export { Connection, ConnectionContext, WSMessage } from "partyserver";
3
+ import { AsyncLocalStorage } from "node:async_hooks";
3
4
  import { WorkflowEntrypoint as WorkflowEntrypoint$1 } from "cloudflare:workers";
4
5
 
5
6
  /**
@@ -98,6 +99,11 @@ type Schedule<T = string> = {
98
99
  cron: string;
99
100
  }
100
101
  );
102
+ declare const unstable_context: AsyncLocalStorage<{
103
+ agent: Agent<unknown>;
104
+ connection: Connection | undefined;
105
+ request: Request | undefined;
106
+ }>;
101
107
  /**
102
108
  * Base class for creating Agent implementations
103
109
  * @template Env Environment type containing bindings
@@ -148,7 +154,7 @@ declare class Agent<Env, State = unknown> extends Server<Env> {
148
154
  * Called when the Agent receives an email
149
155
  * @param email Email message to process
150
156
  */
151
- onEmail(email: ForwardableEmailMessage): void;
157
+ onEmail(email: ForwardableEmailMessage): Promise<void>;
152
158
  onError(connection: Connection, error: unknown): void | Promise<void>;
153
159
  onError(error: unknown): void | Promise<void>;
154
160
  /**
@@ -182,7 +188,6 @@ declare class Agent<Env, State = unknown> extends Server<Env> {
182
188
  * @returns Array of matching Schedule objects
183
189
  */
184
190
  getSchedules<T = string>(criteria?: {
185
- description?: string;
186
191
  id?: string;
187
192
  type?: "scheduled" | "delayed" | "cron";
188
193
  timeRange?: {
@@ -299,4 +304,5 @@ export {
299
304
  routeAgentEmail,
300
305
  routeAgentRequest,
301
306
  unstable_callable,
307
+ unstable_context,
302
308
  };
package/dist/index.js CHANGED
@@ -5,8 +5,9 @@ import {
5
5
  getAgentByName,
6
6
  routeAgentEmail,
7
7
  routeAgentRequest,
8
- unstable_callable
9
- } from "./chunk-X6BBKLSC.js";
8
+ unstable_callable,
9
+ unstable_context
10
+ } from "./chunk-YMUU7QHV.js";
10
11
  import "./chunk-HMLY7DHA.js";
11
12
  export {
12
13
  Agent,
@@ -15,6 +16,7 @@ export {
15
16
  getAgentByName,
16
17
  routeAgentEmail,
17
18
  routeAgentRequest,
18
- unstable_callable
19
+ unstable_callable,
20
+ unstable_context
19
21
  };
20
22
  //# sourceMappingURL=index.js.map