@novu/framework 2.12.1 → 2.13.0-rc.28c6d223e1

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.
Files changed (55) hide show
  1. package/dist/cjs/{index-1DobCKAF.d.cts → index-CLZZRnNV.d.cts} +33 -0
  2. package/dist/cjs/index.cjs +82 -82
  3. package/dist/cjs/index.d.cts +1 -1
  4. package/dist/cjs/internal/index.cjs +57 -1
  5. package/dist/cjs/internal/index.d.cts +9 -9
  6. package/dist/cjs/servers/express.cjs +57 -57
  7. package/dist/cjs/servers/express.d.cts +2 -2
  8. package/dist/cjs/servers/h3.cjs +57 -57
  9. package/dist/cjs/servers/h3.d.cts +2 -2
  10. package/dist/cjs/servers/hono.cjs +57 -57
  11. package/dist/cjs/servers/hono.d.cts +2 -25
  12. package/dist/cjs/servers/lambda.cjs +82 -82
  13. package/dist/cjs/servers/lambda.d.cts +2 -2
  14. package/dist/cjs/servers/nest.cjs +57 -57
  15. package/dist/cjs/servers/nest.d.cts +5 -2
  16. package/dist/cjs/servers/next.cjs +54 -54
  17. package/dist/cjs/servers/next.d.cts +7 -2
  18. package/dist/cjs/servers/nuxt.cjs +57 -57
  19. package/dist/cjs/servers/nuxt.d.cts +2 -2
  20. package/dist/cjs/servers/remix.cjs +57 -57
  21. package/dist/cjs/servers/remix.d.cts +2 -2
  22. package/dist/cjs/servers/sveltekit.cjs +59 -59
  23. package/dist/cjs/servers/sveltekit.d.cts +2 -2
  24. package/dist/esm/cards.js +1 -1
  25. package/dist/esm/{chunk-C3P3ZH2I.js → chunk-46AHJTS7.js} +22 -22
  26. package/dist/esm/{chunk-XC7ATSSO.js → chunk-BSFJB6OO.js} +49 -49
  27. package/dist/esm/chunk-LHU5A7DI.js +1 -0
  28. package/dist/esm/{chunk-3XT6S7TZ.js → chunk-XEHQJMMQ.js} +1 -1
  29. package/dist/esm/{index-aVljLqR4.d.ts → index-CWldA6G5.d.ts} +33 -0
  30. package/dist/esm/index.d.ts +1 -1
  31. package/dist/esm/index.js +1 -1
  32. package/dist/esm/internal/index.js +1 -1
  33. package/dist/esm/jsx-dev-runtime.js +1 -1
  34. package/dist/esm/{jsx-runtime-7EPQR56T.js → jsx-runtime-P2HN3TPO.js} +1 -1
  35. package/dist/esm/jsx-runtime.js +1 -1
  36. package/dist/esm/servers/express.d.ts +2 -2
  37. package/dist/esm/servers/express.js +1 -1
  38. package/dist/esm/servers/h3.d.ts +2 -2
  39. package/dist/esm/servers/h3.js +1 -1
  40. package/dist/esm/servers/hono.d.ts +2 -25
  41. package/dist/esm/servers/hono.js +1 -1
  42. package/dist/esm/servers/lambda.d.ts +2 -2
  43. package/dist/esm/servers/lambda.js +1 -1
  44. package/dist/esm/servers/nest.d.ts +5 -2
  45. package/dist/esm/servers/nest.js +1 -1
  46. package/dist/esm/servers/next.d.ts +7 -2
  47. package/dist/esm/servers/next.js +1 -1
  48. package/dist/esm/servers/nuxt.d.ts +2 -2
  49. package/dist/esm/servers/nuxt.js +1 -1
  50. package/dist/esm/servers/remix.d.ts +2 -2
  51. package/dist/esm/servers/remix.js +1 -1
  52. package/dist/esm/servers/sveltekit.d.ts +2 -2
  53. package/dist/esm/servers/sveltekit.js +1 -1
  54. package/package.json +1 -1
  55. 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;