@novu/framework 2.12.1 → 2.13.0
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/cjs/{index-1DobCKAF.d.cts → index-CLZZRnNV.d.cts} +33 -0
- package/dist/cjs/index.cjs +82 -82
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/internal/index.cjs +57 -1
- package/dist/cjs/internal/index.d.cts +9 -9
- package/dist/cjs/servers/express.cjs +57 -57
- package/dist/cjs/servers/express.d.cts +2 -2
- package/dist/cjs/servers/h3.cjs +57 -57
- package/dist/cjs/servers/h3.d.cts +2 -2
- package/dist/cjs/servers/hono.cjs +57 -57
- package/dist/cjs/servers/hono.d.cts +2 -25
- package/dist/cjs/servers/lambda.cjs +82 -82
- package/dist/cjs/servers/lambda.d.cts +2 -2
- package/dist/cjs/servers/nest.cjs +57 -57
- package/dist/cjs/servers/nest.d.cts +5 -2
- package/dist/cjs/servers/next.cjs +54 -54
- package/dist/cjs/servers/next.d.cts +7 -2
- package/dist/cjs/servers/nuxt.cjs +57 -57
- package/dist/cjs/servers/nuxt.d.cts +2 -2
- package/dist/cjs/servers/remix.cjs +57 -57
- package/dist/cjs/servers/remix.d.cts +2 -2
- package/dist/cjs/servers/sveltekit.cjs +59 -59
- package/dist/cjs/servers/sveltekit.d.cts +2 -2
- package/dist/esm/cards.js +1 -1
- package/dist/esm/{chunk-C3P3ZH2I.js → chunk-46AHJTS7.js} +22 -22
- package/dist/esm/chunk-LHU5A7DI.js +1 -0
- package/dist/esm/{chunk-XC7ATSSO.js → chunk-WDBIT4NK.js} +49 -49
- package/dist/esm/{chunk-3XT6S7TZ.js → chunk-XEHQJMMQ.js} +1 -1
- package/dist/esm/{index-aVljLqR4.d.ts → index-CWldA6G5.d.ts} +33 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/internal/index.js +1 -1
- package/dist/esm/jsx-dev-runtime.js +1 -1
- package/dist/esm/{jsx-runtime-7EPQR56T.js → jsx-runtime-P2HN3TPO.js} +1 -1
- package/dist/esm/jsx-runtime.js +1 -1
- package/dist/esm/servers/express.d.ts +2 -2
- package/dist/esm/servers/express.js +1 -1
- package/dist/esm/servers/h3.d.ts +2 -2
- package/dist/esm/servers/h3.js +1 -1
- package/dist/esm/servers/hono.d.ts +2 -25
- package/dist/esm/servers/hono.js +1 -1
- package/dist/esm/servers/lambda.d.ts +2 -2
- package/dist/esm/servers/lambda.js +1 -1
- package/dist/esm/servers/nest.d.ts +5 -2
- package/dist/esm/servers/nest.js +1 -1
- package/dist/esm/servers/next.d.ts +7 -2
- package/dist/esm/servers/next.js +1 -1
- package/dist/esm/servers/nuxt.d.ts +2 -2
- package/dist/esm/servers/nuxt.js +1 -1
- package/dist/esm/servers/remix.d.ts +2 -2
- package/dist/esm/servers/remix.js +1 -1
- package/dist/esm/servers/sveltekit.d.ts +2 -2
- package/dist/esm/servers/sveltekit.js +1 -1
- package/package.json +1 -1
- package/dist/esm/chunk-T4QVGWWK.js +0 -1
|
@@ -106,6 +106,30 @@ interface ServeHandlerOptions {
|
|
|
106
106
|
client?: Client;
|
|
107
107
|
workflows?: Array<Workflow>;
|
|
108
108
|
agents?: Array<Agent>;
|
|
109
|
+
/**
|
|
110
|
+
* Extends the lifetime of the request handler until the given promise settles.
|
|
111
|
+
*
|
|
112
|
+
* Agent events are acknowledged immediately while the turn (LLM calls, replies,
|
|
113
|
+
* tool use) continues in the background. On serverless platforms the runtime is
|
|
114
|
+
* frozen as soon as the response is sent, so the background work is silently
|
|
115
|
+
* dropped unless a platform `waitUntil` primitive is provided.
|
|
116
|
+
*
|
|
117
|
+
* The Next.js adapter (on Next.js >= 15.1) and the Hono adapter (on Cloudflare
|
|
118
|
+
* Workers) wire this automatically. Provide it explicitly for other serverless
|
|
119
|
+
* platforms, or to override the automatic detection.
|
|
120
|
+
*
|
|
121
|
+
* @example Cloudflare Workers (without Hono)
|
|
122
|
+
* ```ts
|
|
123
|
+
* export default {
|
|
124
|
+
* async fetch(request, env, ctx) {
|
|
125
|
+
* const handler = serve({ agents: [myAgent], waitUntil: (promise) => ctx.waitUntil(promise) });
|
|
126
|
+
*
|
|
127
|
+
* return handler(request);
|
|
128
|
+
* },
|
|
129
|
+
* };
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
waitUntil?: (promise: Promise<unknown>) => void;
|
|
109
133
|
}
|
|
110
134
|
type INovuRequestHandlerOptions<Input extends any[] = any[], Output = any> = ServeHandlerOptions & {
|
|
111
135
|
frameworkName: string;
|
|
@@ -137,6 +161,7 @@ declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
|
|
|
137
161
|
private readonly http;
|
|
138
162
|
private readonly workflows;
|
|
139
163
|
private readonly agents;
|
|
164
|
+
private readonly waitUntil?;
|
|
140
165
|
constructor(options: INovuRequestHandlerOptions<Input, Output>);
|
|
141
166
|
createHandler(): (...args: Input) => Promise<Output>;
|
|
142
167
|
private getStaticHeaders;
|
|
@@ -144,6 +169,14 @@ declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
|
|
|
144
169
|
private createError;
|
|
145
170
|
private handleAction;
|
|
146
171
|
private getPostActionMap;
|
|
172
|
+
/**
|
|
173
|
+
* Agent events are acknowledged immediately and the turn continues in the
|
|
174
|
+
* background. On serverless platforms the runtime freezes once the response
|
|
175
|
+
* is sent, so without a `waitUntil` primitive the turn is silently dropped
|
|
176
|
+
* mid-flight. Detecting the known freeze-prone platforms lets us surface an
|
|
177
|
+
* actionable warning instead of logs that just stop with no error.
|
|
178
|
+
*/
|
|
179
|
+
private warnOnUnprotectedServerlessRuntime;
|
|
147
180
|
triggerAction(triggerEvent: EventTriggerParams): () => Promise<IActionResponse<string>>;
|
|
148
181
|
private getGetActionMap;
|
|
149
182
|
private handlePostAction;
|