agents 0.0.0-82d5412 → 0.0.0-86dfe61

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,6 +1,6 @@
1
1
  import { Server, Connection, PartyServerOptions } from "partyserver";
2
2
  export { Connection, ConnectionContext, WSMessage } from "partyserver";
3
- import { WorkflowEntrypoint as WorkflowEntrypoint$1 } from "cloudflare:workers";
3
+ import { AsyncLocalStorage } from "node:async_hooks";
4
4
 
5
5
  /**
6
6
  * RPC request message from client
@@ -59,10 +59,6 @@ declare function unstable_callable(
59
59
  target: (this: This, ...args: Args) => Return,
60
60
  context: ClassMethodDecoratorContext
61
61
  ) => (this: This, ...args: Args) => Return;
62
- /**
63
- * A class for creating workflow entry points that can be used with Cloudflare Workers
64
- */
65
- declare class WorkflowEntrypoint extends WorkflowEntrypoint$1 {}
66
62
  /**
67
63
  * Represents a scheduled task within an Agent
68
64
  * @template T Type of the payload data
@@ -98,6 +94,11 @@ type Schedule<T = string> = {
98
94
  cron: string;
99
95
  }
100
96
  );
97
+ declare const unstable_context: AsyncLocalStorage<{
98
+ agent: Agent<unknown>;
99
+ connection: Connection | undefined;
100
+ request: Request | undefined;
101
+ }>;
101
102
  /**
102
103
  * Base class for creating Agent implementations
103
104
  * @template Env Environment type containing bindings
@@ -148,7 +149,7 @@ declare class Agent<Env, State = unknown> extends Server<Env> {
148
149
  * Called when the Agent receives an email
149
150
  * @param email Email message to process
150
151
  */
151
- onEmail(email: ForwardableEmailMessage): void;
152
+ onEmail(email: ForwardableEmailMessage): Promise<void>;
152
153
  onError(connection: Connection, error: unknown): void | Promise<void>;
153
154
  onError(error: unknown): void | Promise<void>;
154
155
  /**
@@ -182,7 +183,6 @@ declare class Agent<Env, State = unknown> extends Server<Env> {
182
183
  * @returns Array of matching Schedule objects
183
184
  */
184
185
  getSchedules<T = string>(criteria?: {
185
- description?: string;
186
186
  id?: string;
187
187
  type?: "scheduled" | "delayed" | "cron";
188
188
  timeRange?: {
@@ -294,9 +294,9 @@ export {
294
294
  type Schedule,
295
295
  type StateUpdateMessage,
296
296
  StreamingResponse,
297
- WorkflowEntrypoint,
298
297
  getAgentByName,
299
298
  routeAgentEmail,
300
299
  routeAgentRequest,
301
300
  unstable_callable,
301
+ unstable_context,
302
302
  };
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  Agent,
3
3
  StreamingResponse,
4
- WorkflowEntrypoint,
5
4
  getAgentByName,
6
5
  routeAgentEmail,
7
6
  routeAgentRequest,
8
- unstable_callable
9
- } from "./chunk-X6BBKLSC.js";
7
+ unstable_callable,
8
+ unstable_context
9
+ } from "./chunk-XG52S6YY.js";
10
10
  import "./chunk-HMLY7DHA.js";
11
11
  export {
12
12
  Agent,
13
13
  StreamingResponse,
14
- WorkflowEntrypoint,
15
14
  getAgentByName,
16
15
  routeAgentEmail,
17
16
  routeAgentRequest,
18
- unstable_callable
17
+ unstable_callable,
18
+ unstable_context
19
19
  };
20
20
  //# sourceMappingURL=index.js.map