@novu/framework 2.10.1-alpha.2 → 2.10.1-alpha.4

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 (48) hide show
  1. package/dist/cjs/{health-check.types-Nhsa_lGZ.d.cts → health-check.types-S8oS3AQZ.d.cts} +138 -138
  2. package/dist/cjs/{index-gi0_Wcu3.d.cts → index-ZVAtl8F3.d.cts} +102 -21
  3. package/dist/cjs/index.cjs +59 -59
  4. package/dist/cjs/index.d.cts +3 -3
  5. package/dist/cjs/internal/index.d.cts +3 -3
  6. package/dist/cjs/servers/express.cjs +59 -59
  7. package/dist/cjs/servers/express.d.cts +4 -4
  8. package/dist/cjs/servers/h3.cjs +59 -59
  9. package/dist/cjs/servers/h3.d.cts +4 -4
  10. package/dist/cjs/servers/lambda.cjs +59 -59
  11. package/dist/cjs/servers/lambda.d.cts +5 -5
  12. package/dist/cjs/servers/nest.cjs +59 -59
  13. package/dist/cjs/servers/nest.d.cts +6 -6
  14. package/dist/cjs/servers/next.cjs +59 -59
  15. package/dist/cjs/servers/next.d.cts +4 -4
  16. package/dist/cjs/servers/nuxt.cjs +59 -59
  17. package/dist/cjs/servers/nuxt.d.cts +4 -4
  18. package/dist/cjs/servers/remix.cjs +59 -59
  19. package/dist/cjs/servers/remix.d.cts +4 -4
  20. package/dist/cjs/servers/sveltekit.cjs +59 -59
  21. package/dist/cjs/servers/sveltekit.d.cts +4 -4
  22. package/dist/cjs/step-resolver.d.cts +2 -2
  23. package/dist/esm/{chunk-FURRAVE4.js → chunk-FI2YN7IA.js} +56 -56
  24. package/dist/esm/{health-check.types-zMcfbkrA.d.ts → health-check.types-C5lg4csi.d.ts} +138 -138
  25. package/dist/esm/{index-DBjXwxNK.d.ts → index-D0d-O6LJ.d.ts} +102 -21
  26. package/dist/esm/index.d.ts +3 -3
  27. package/dist/esm/index.js +1 -1
  28. package/dist/esm/internal/index.d.ts +3 -3
  29. package/dist/esm/servers/express.d.ts +4 -4
  30. package/dist/esm/servers/express.js +1 -1
  31. package/dist/esm/servers/h3.d.ts +4 -4
  32. package/dist/esm/servers/h3.js +1 -1
  33. package/dist/esm/servers/lambda.d.ts +5 -5
  34. package/dist/esm/servers/lambda.js +1 -1
  35. package/dist/esm/servers/nest.d.ts +6 -6
  36. package/dist/esm/servers/nest.js +1 -1
  37. package/dist/esm/servers/next.d.ts +4 -4
  38. package/dist/esm/servers/next.js +1 -1
  39. package/dist/esm/servers/nuxt.d.ts +4 -4
  40. package/dist/esm/servers/nuxt.js +1 -1
  41. package/dist/esm/servers/remix.d.ts +4 -4
  42. package/dist/esm/servers/remix.js +1 -1
  43. package/dist/esm/servers/sveltekit.d.ts +4 -4
  44. package/dist/esm/servers/sveltekit.js +1 -1
  45. package/dist/esm/step-resolver.d.ts +2 -2
  46. package/package.json +2 -2
  47. package/dist/cjs/{subscriber.types-CNLicO8m.d.cts → subscriber.types-DgRgSKMw.d.cts} +77 -77
  48. package/dist/esm/{subscriber.types-B0sKq6v3.d.ts → subscriber.types-CbMgjzR-.d.ts} +77 -77
@@ -1,6 +1,142 @@
1
- import { b as ContextPayload, c as ConditionalPartial, P as PickRequiredKeys, d as Step, e as Prettify, S as Subscriber, E as EnvironmentSystemVariables, C as ContextResolved, D as DeepPartial$1, f as ChannelStepEnum, A as ActionStepEnum, g as Awaitable, W as WithPassthrough, h as StepOptions } from './subscriber.types-CNLicO8m.cjs';
1
+ import { b as ContextPayload, c as ConditionalPartial, P as PickRequiredKeys, d as Step, e as Prettify, S as Subscriber, E as EnvironmentSystemVariables, C as ContextResolved, D as DeepPartial$1, f as ChannelStepEnum, A as ActionStepEnum, g as Awaitable, W as WithPassthrough, h as StepOptions } from './subscriber.types-DgRgSKMw.cjs';
2
2
  import { S as Schema, J as JsonSchema } from './base.schema.types-BApIn9jr.cjs';
3
3
 
4
+ declare enum ChannelTypeEnum {
5
+ IN_APP = "in_app",
6
+ EMAIL = "email",
7
+ SMS = "sms",
8
+ CHAT = "chat",
9
+ PUSH = "push"
10
+ }
11
+ interface IAttachmentOptions {
12
+ mime: string;
13
+ file: Buffer;
14
+ name?: string;
15
+ channels?: ChannelTypeEnum[];
16
+ cid?: string;
17
+ disposition?: string;
18
+ }
19
+ interface ITriggerPayload {
20
+ attachments?: IAttachmentOptions[];
21
+ [key: string]: string | string[] | boolean | number | undefined | IAttachmentOptions | IAttachmentOptions[] | Record<string, unknown>;
22
+ }
23
+ interface ISubscriberPayload {
24
+ subscriberId: string;
25
+ firstName?: string;
26
+ lastName?: string;
27
+ email?: string;
28
+ phone?: string;
29
+ avatar?: string;
30
+ locale?: string;
31
+ data?: Record<string, unknown>;
32
+ channels?: ISubscriberChannel[];
33
+ }
34
+ interface ISubscriberChannel {
35
+ providerId: ChatProviderIdEnum | PushProviderIdEnum;
36
+ integrationIdentifier?: string;
37
+ credentials: IChannelCredentials;
38
+ }
39
+ interface IChannelCredentials {
40
+ webhookUrl?: string;
41
+ deviceTokens?: string[];
42
+ }
43
+ interface ITopic {
44
+ type: 'Topic';
45
+ topicKey: string;
46
+ exclude?: string[];
47
+ }
48
+ type TriggerRecipientsPayload = string | ISubscriberPayload | ITopic | ISubscriberPayload[] | ITopic[];
49
+ declare enum TriggerEventStatusEnum {
50
+ ERROR = "error",
51
+ NOT_ACTIVE = "trigger_not_active",
52
+ NO_WORKFLOW_ACTIVE_STEPS = "no_workflow_active_steps_defined",
53
+ NO_WORKFLOW_STEPS = "no_workflow_steps_defined",
54
+ PROCESSED = "processed",
55
+ SUBSCRIBER_MISSING = "subscriber_id_missing",
56
+ TENANT_MISSING = "no_tenant_found"
57
+ }
58
+ declare enum ChatProviderIdEnum {
59
+ Slack = "slack",
60
+ Discord = "discord",
61
+ MsTeams = "msteams",
62
+ Mattermost = "mattermost",
63
+ Ryver = "ryver",
64
+ Zulip = "zulip",
65
+ GrafanaOnCall = "grafana-on-call",
66
+ GetStream = "getstream",
67
+ RocketChat = "rocket-chat",
68
+ WhatsAppBusiness = "whatsapp-business",
69
+ ChatWebhook = "chat-webhook"
70
+ }
71
+ declare enum PushProviderIdEnum {
72
+ FCM = "fcm",
73
+ APNS = "apns",
74
+ EXPO = "expo",
75
+ OneSignal = "one-signal",
76
+ Pushpad = "pushpad",
77
+ PushWebhook = "push-webhook",
78
+ PusherBeams = "pusher-beams",
79
+ AppIO = "appio"
80
+ }
81
+ /**
82
+ * A preference for a notification delivery workflow.
83
+ *
84
+ * This provides a shortcut to setting all channels to the same preference.
85
+ */
86
+ type WorkflowPreference$1 = {
87
+ /**
88
+ * A flag specifying if notification delivery is enabled for the workflow.
89
+ *
90
+ * If `true`, notification delivery is enabled by default for all channels.
91
+ *
92
+ * This setting can be overridden by the channel preferences.
93
+ *
94
+ * @default true
95
+ */
96
+ enabled: boolean;
97
+ /**
98
+ * A flag specifying if the preference is read-only.
99
+ *
100
+ * If `true`, the preference cannot be changed by the Subscriber.
101
+ *
102
+ * @default false
103
+ */
104
+ readOnly: boolean;
105
+ };
106
+ /** A preference for a notification delivery channel. */
107
+ type ChannelPreference$1 = {
108
+ /**
109
+ * A flag specifying if notification delivery is enabled for the channel.
110
+ *
111
+ * If `true`, notification delivery is enabled.
112
+ *
113
+ * @default true
114
+ */
115
+ enabled: boolean;
116
+ };
117
+ type WorkflowPreferences$1 = {
118
+ /**
119
+ * A preference for the workflow.
120
+ *
121
+ * The values specified here will be used if no preference is specified for a channel.
122
+ */
123
+ all: WorkflowPreference$1;
124
+ /**
125
+ * A preference for each notification delivery channel.
126
+ *
127
+ * If no preference is specified for a channel, the `all` preference will be used.
128
+ */
129
+ channels: Record<ChannelTypeEnum, ChannelPreference$1>;
130
+ };
131
+ /**
132
+ * Recursively make all properties of type `T` optional.
133
+ */
134
+ type DeepPartial<T> = T extends object ? {
135
+ [P in keyof T]?: DeepPartial<T[P]>;
136
+ } : T;
137
+ /** A partial set of workflow preferences. */
138
+ type WorkflowPreferencesPartial = DeepPartial<WorkflowPreferences$1>;
139
+
4
140
  type CodeResult = {
5
141
  code: string;
6
142
  };
@@ -151,142 +287,6 @@ declare enum WorkflowChannelEnum {
151
287
  IN_APP = "inApp"
152
288
  }
153
289
 
154
- declare enum ChannelTypeEnum {
155
- IN_APP = "in_app",
156
- EMAIL = "email",
157
- SMS = "sms",
158
- CHAT = "chat",
159
- PUSH = "push"
160
- }
161
- interface IAttachmentOptions {
162
- mime: string;
163
- file: Buffer;
164
- name?: string;
165
- channels?: ChannelTypeEnum[];
166
- cid?: string;
167
- disposition?: string;
168
- }
169
- interface ITriggerPayload {
170
- attachments?: IAttachmentOptions[];
171
- [key: string]: string | string[] | boolean | number | undefined | IAttachmentOptions | IAttachmentOptions[] | Record<string, unknown>;
172
- }
173
- interface ISubscriberPayload {
174
- subscriberId: string;
175
- firstName?: string;
176
- lastName?: string;
177
- email?: string;
178
- phone?: string;
179
- avatar?: string;
180
- locale?: string;
181
- data?: Record<string, unknown>;
182
- channels?: ISubscriberChannel[];
183
- }
184
- interface ISubscriberChannel {
185
- providerId: ChatProviderIdEnum | PushProviderIdEnum;
186
- integrationIdentifier?: string;
187
- credentials: IChannelCredentials;
188
- }
189
- interface IChannelCredentials {
190
- webhookUrl?: string;
191
- deviceTokens?: string[];
192
- }
193
- interface ITopic {
194
- type: 'Topic';
195
- topicKey: string;
196
- exclude?: string[];
197
- }
198
- type TriggerRecipientsPayload = string | ISubscriberPayload | ITopic | ISubscriberPayload[] | ITopic[];
199
- declare enum TriggerEventStatusEnum {
200
- ERROR = "error",
201
- NOT_ACTIVE = "trigger_not_active",
202
- NO_WORKFLOW_ACTIVE_STEPS = "no_workflow_active_steps_defined",
203
- NO_WORKFLOW_STEPS = "no_workflow_steps_defined",
204
- PROCESSED = "processed",
205
- SUBSCRIBER_MISSING = "subscriber_id_missing",
206
- TENANT_MISSING = "no_tenant_found"
207
- }
208
- declare enum ChatProviderIdEnum {
209
- Slack = "slack",
210
- Discord = "discord",
211
- MsTeams = "msteams",
212
- Mattermost = "mattermost",
213
- Ryver = "ryver",
214
- Zulip = "zulip",
215
- GrafanaOnCall = "grafana-on-call",
216
- GetStream = "getstream",
217
- RocketChat = "rocket-chat",
218
- WhatsAppBusiness = "whatsapp-business",
219
- ChatWebhook = "chat-webhook"
220
- }
221
- declare enum PushProviderIdEnum {
222
- FCM = "fcm",
223
- APNS = "apns",
224
- EXPO = "expo",
225
- OneSignal = "one-signal",
226
- Pushpad = "pushpad",
227
- PushWebhook = "push-webhook",
228
- PusherBeams = "pusher-beams",
229
- AppIO = "appio"
230
- }
231
- /**
232
- * A preference for a notification delivery workflow.
233
- *
234
- * This provides a shortcut to setting all channels to the same preference.
235
- */
236
- type WorkflowPreference$1 = {
237
- /**
238
- * A flag specifying if notification delivery is enabled for the workflow.
239
- *
240
- * If `true`, notification delivery is enabled by default for all channels.
241
- *
242
- * This setting can be overridden by the channel preferences.
243
- *
244
- * @default true
245
- */
246
- enabled: boolean;
247
- /**
248
- * A flag specifying if the preference is read-only.
249
- *
250
- * If `true`, the preference cannot be changed by the Subscriber.
251
- *
252
- * @default false
253
- */
254
- readOnly: boolean;
255
- };
256
- /** A preference for a notification delivery channel. */
257
- type ChannelPreference$1 = {
258
- /**
259
- * A flag specifying if notification delivery is enabled for the channel.
260
- *
261
- * If `true`, notification delivery is enabled.
262
- *
263
- * @default true
264
- */
265
- enabled: boolean;
266
- };
267
- type WorkflowPreferences$1 = {
268
- /**
269
- * A preference for the workflow.
270
- *
271
- * The values specified here will be used if no preference is specified for a channel.
272
- */
273
- all: WorkflowPreference$1;
274
- /**
275
- * A preference for each notification delivery channel.
276
- *
277
- * If no preference is specified for a channel, the `all` preference will be used.
278
- */
279
- channels: Record<ChannelTypeEnum, ChannelPreference$1>;
280
- };
281
- /**
282
- * Recursively make all properties of type `T` optional.
283
- */
284
- type DeepPartial<T> = T extends object ? {
285
- [P in keyof T]?: DeepPartial<T[P]>;
286
- } : T;
287
- /** A partial set of workflow preferences. */
288
- type WorkflowPreferencesPartial = DeepPartial<WorkflowPreferences$1>;
289
-
290
290
  type EventPayload = ITriggerPayload;
291
291
  type Actor = string | ISubscriberPayload;
292
292
  type Recipients = TriggerRecipientsPayload;
@@ -699,4 +699,4 @@ type HealthCheck = {
699
699
  };
700
700
  };
701
701
 
702
- export { type ClientOptions as C, type DiscoverAgentOutput as D, type ExecuteInput as E, GetActionEnum as G, type HealthCheck as H, PostActionEnum as P, SeverityLevelEnum as S, type Workflow as W, CronExpression as a, type CancelEventTriggerResponse as b, type ChannelPreference as c, type CodeResult as d, type DiscoverOutput as e, type DiscoverProviderOutput as f, type DiscoverStepOutput as g, type DiscoverWorkflowOutput as h, type Event as i, type EventTriggerParams as j, type EventTriggerResponse as k, type EventTriggerResult as l, type Execute as m, type ExecuteOutput as n, type ExecuteOutputMetadata as o, type ExecuteOutputOptions as p, type State as q, type StepType as r, WorkflowChannelEnum as s, type WorkflowOptions as t, type WorkflowPreference as u, type WorkflowPreferences as v };
702
+ export { type ClientOptions as C, type DiscoverAgentOutput as D, type ExecuteInput as E, GetActionEnum as G, type HealthCheck as H, PostActionEnum as P, SeverityLevelEnum as S, type TriggerRecipientsPayload as T, type Workflow as W, CronExpression as a, type CancelEventTriggerResponse as b, type ChannelPreference as c, type CodeResult as d, type DiscoverOutput as e, type DiscoverProviderOutput as f, type DiscoverStepOutput as g, type DiscoverWorkflowOutput as h, type Event as i, type EventTriggerParams as j, type EventTriggerResponse as k, type EventTriggerResult as l, type Execute as m, type ExecuteOutput as n, type ExecuteOutputMetadata as o, type ExecuteOutputOptions as p, type State as q, type StepType as r, WorkflowChannelEnum as s, type WorkflowOptions as t, type WorkflowPreference as u, type WorkflowPreferences as v };
@@ -1,6 +1,6 @@
1
- import { ChatElement, CardElement } from 'chat';
2
- import { C as ClientOptions, W as Workflow, H as HealthCheck, e as DiscoverOutput, i as Event, n as ExecuteOutput, d as CodeResult, j as EventTriggerParams, m as Execute, t as WorkflowOptions } from './health-check.types-Nhsa_lGZ.cjs';
3
- import { g as Awaitable } from './subscriber.types-CNLicO8m.cjs';
1
+ import { ChatElement, Emoji, CardElement } from 'chat';
2
+ import { T as TriggerRecipientsPayload, C as ClientOptions, W as Workflow, H as HealthCheck, e as DiscoverOutput, i as Event, n as ExecuteOutput, d as CodeResult, j as EventTriggerParams, m as Execute, t as WorkflowOptions } from './health-check.types-S8oS3AQZ.cjs';
3
+ import { g as Awaitable } from './subscriber.types-DgRgSKMw.cjs';
4
4
  import { S as Schema, a as FromSchema, F as FromSchemaUnvalidated } from './base.schema.types-BApIn9jr.cjs';
5
5
  import './step-resolver.cjs';
6
6
 
@@ -76,18 +76,14 @@ interface FileRef {
76
76
  /**
77
77
  * Content accepted by ctx.reply() and handle.edit().
78
78
  *
79
- * - `string` — plain text
80
- * - `{ markdown, files? }` — markdown-formatted text, optionally with file attachments
79
+ * - `string` — plain text or markdown; converted to platform format by the chat SDK
81
80
  * - `ChatElement` — interactive card built with Card(), Button(), etc.
82
- * (must be a CardElement at runtime; validated by serializeContent)
81
+ *
82
+ * For file attachments, pass a `files` array as the second argument to reply()/edit().
83
83
  */
84
- type MessageContent = string | {
85
- markdown: string;
86
- files?: FileRef[];
87
- } | ChatElement;
84
+ type MessageContent = string | ChatElement;
88
85
  /** Normalized content shape sent over HTTP to the reply endpoint. */
89
86
  interface ReplyContent {
90
- text?: string;
91
87
  markdown?: string;
92
88
  card?: CardElement;
93
89
  files?: FileRef[];
@@ -115,7 +111,9 @@ interface ReplyHandle {
115
111
  /** Platform-native thread id this message lives in. */
116
112
  readonly platformThreadId: string;
117
113
  /** Edit this message in place with new content. Returns the same handle for chaining. */
118
- edit(content: MessageContent): Promise<ReplyHandle>;
114
+ edit(content: MessageContent, options?: {
115
+ files?: FileRef[];
116
+ }): Promise<ReplyHandle>;
119
117
  }
120
118
  interface AgentContext {
121
119
  readonly event: string;
@@ -133,24 +131,63 @@ interface AgentContext {
133
131
  *
134
132
  * @example
135
133
  * const msg = await ctx.reply('Thinking…');
136
- * // ... do work ...
137
134
  * await msg.edit('Here is the answer');
135
+ *
136
+ * @example with file attachment
137
+ * await ctx.reply('Here is your report', {
138
+ * files: [{ filename: 'report.pdf', url: 'https://...' }],
139
+ * });
138
140
  */
139
- reply(content: MessageContent): Promise<ReplyHandle>;
141
+ reply(content: MessageContent, options?: {
142
+ files?: FileRef[];
143
+ }): Promise<ReplyHandle>;
140
144
  resolve(summary?: string): void;
141
145
  metadata: {
142
146
  set(key: string, value: unknown): void;
143
147
  };
148
+ /**
149
+ * Trigger a Novu workflow from within this agent handler.
150
+ *
151
+ * Signals are batched and flushed with the next `ctx.reply()`, or automatically when the
152
+ * handler completes. The workflow executes asynchronously — the agent reply is not blocked.
153
+ *
154
+ * @param workflowId - Workflow identifier (e.g. `'escalation-email'`).
155
+ * @param opts.to - Recipient(s). Omit to target the conversation's resolved subscriber.
156
+ * @param opts.payload - Data forwarded to the workflow payload schema.
157
+ *
158
+ * @example
159
+ * // Target the conversation subscriber automatically
160
+ * ctx.trigger('follow-up-email', { payload: { reason: 'unresolved' } });
161
+ *
162
+ * // Explicit recipient
163
+ * ctx.trigger('escalation-email', { to: 'agent-inbox', payload: { priority: 'high' } });
164
+ *
165
+ * // Topic broadcast
166
+ * ctx.trigger('team-alert', { to: { type: 'Topic', topicKey: 'support-team' } });
167
+ */
144
168
  trigger(workflowId: string, opts?: {
145
- to?: string;
169
+ to?: TriggerRecipientsPayload;
146
170
  payload?: Record<string, unknown>;
147
171
  }): void;
172
+ /**
173
+ * Add an emoji reaction to any platform message.
174
+ * Reactions are queued and sent with the next `ctx.reply()`, or flushed automatically
175
+ * when the handler completes (same batching contract as `ctx.trigger()`).
176
+ *
177
+ * @param messageId - Platform-native message ID to react to (e.g. Slack `ts`).
178
+ * @param emojiName - Emoji short-name (e.g. `'thumbs_up'`, `'check_mark'`).
179
+ *
180
+ * @example
181
+ * ctx.addReaction(ctx.reaction!.messageId, 'check_mark');
182
+ * await ctx.reply('Done!');
183
+ */
184
+ addReaction(messageId: string, emojiName: Emoji): void;
148
185
  }
149
186
  interface AgentHandlers {
150
- onMessage: (ctx: AgentContext) => Promise<void>;
151
- onReaction?: (ctx: AgentContext) => Promise<void>;
152
- onAction?: (ctx: AgentContext) => Promise<void>;
153
- onResolve?: (ctx: AgentContext) => Promise<void>;
187
+ onMessage: (ctx: AgentContext) => Awaitable<MessageContent | void>;
188
+ onReaction?: (ctx: AgentContext) => Awaitable<MessageContent | void>;
189
+ onAction?: (ctx: AgentContext) => Awaitable<MessageContent | void>;
190
+ onResolve?: (ctx: AgentContext) => Awaitable<MessageContent | void>;
154
191
  }
155
192
  interface Agent {
156
193
  id: string;
@@ -179,10 +216,19 @@ type MetadataSignal = {
179
216
  key: string;
180
217
  value: unknown;
181
218
  };
219
+ /**
220
+ * Queued by `ctx.trigger()` — instructs Novu to fire a workflow from inside an agent handler.
221
+ *
222
+ * - `workflowId` — the workflow identifier (same string used in `novu.events.trigger()`).
223
+ * - `to` — recipient(s) for the workflow. Accepts a subscriberId string, a subscriber object,
224
+ * a topic, or arrays thereof. When omitted, Novu falls back to the conversation's resolved
225
+ * subscriber. If no subscriber can be resolved, the trigger is skipped and a warning is logged.
226
+ * - `payload` — arbitrary data forwarded to the workflow's payload schema.
227
+ */
182
228
  type TriggerSignal = {
183
229
  type: 'trigger';
184
230
  workflowId: string;
185
- to?: string;
231
+ to?: TriggerRecipientsPayload;
186
232
  payload?: Record<string, unknown>;
187
233
  };
188
234
  type Signal = MetadataSignal | TriggerSignal;
@@ -191,6 +237,11 @@ interface EditPayload {
191
237
  messageId: string;
192
238
  content: ReplyContent;
193
239
  }
240
+ /** An emoji reaction to be added to a platform message. */
241
+ interface AddReactionPayload {
242
+ messageId: string;
243
+ emojiName: Emoji;
244
+ }
194
245
  interface AgentReplyPayload {
195
246
  conversationId: string;
196
247
  integrationIdentifier: string;
@@ -200,6 +251,7 @@ interface AgentReplyPayload {
200
251
  summary?: string;
201
252
  };
202
253
  signals?: Signal[];
254
+ addReactions?: AddReactionPayload[];
203
255
  }
204
256
  /** Shape returned by /agents/:id/reply when a reply or edit was delivered. */
205
257
  interface SentMessageInfo {
@@ -207,6 +259,35 @@ interface SentMessageInfo {
207
259
  platformThreadId: string;
208
260
  }
209
261
 
262
+ /**
263
+ * Thrown by `ctx.reply()` and `handle.edit()` when the upstream message delivery
264
+ * fails — e.g. the configured email provider returns 401, Slack rejects the token,
265
+ * or Teams rejects the request.
266
+ *
267
+ * `message` is always a short, human-readable summary.
268
+ * `responseBody` preserves the raw upstream body for debugging.
269
+ *
270
+ * @example
271
+ * ```ts
272
+ * import { AgentDeliveryError } from '@novu/framework';
273
+ *
274
+ * try {
275
+ * await ctx.reply('Hello!');
276
+ * } catch (err) {
277
+ * if (err instanceof AgentDeliveryError) {
278
+ * console.error('Delivery failed:', err.message);
279
+ * return;
280
+ * }
281
+ * throw err;
282
+ * }
283
+ * ```
284
+ */
285
+ declare class AgentDeliveryError extends Error {
286
+ readonly statusCode: number;
287
+ readonly responseBody: string;
288
+ constructor(statusCode: number, responseBody: string);
289
+ }
290
+
210
291
  /**
211
292
  * Define a new conversational agent.
212
293
  *
@@ -358,4 +439,4 @@ declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
358
439
  */
359
440
  declare function workflow<T_PayloadSchema extends Schema, T_ControlSchema extends Schema, T_EnvSchema extends Schema, T_PayloadValidated extends Record<string, unknown> = FromSchema<T_PayloadSchema>, T_PayloadUnvalidated extends Record<string, unknown> = FromSchemaUnvalidated<T_PayloadSchema>, T_Controls extends Record<string, unknown> = FromSchema<T_ControlSchema>, T_Env extends Record<string, unknown> = FromSchema<T_EnvSchema>>(workflowId: string, execute: Execute<T_PayloadValidated, T_Controls, T_Env>, workflowOptions?: WorkflowOptions<T_PayloadSchema, T_ControlSchema, T_EnvSchema>): Workflow<T_PayloadUnvalidated>;
360
441
 
361
- export { type Agent as A, Client as C, type EditPayload as E, type FileRef as F, type INovuRequestHandlerOptions as I, type MessageContent as M, NovuRequestHandler as N, type ReplyContent as R, type ServeHandlerOptions as S, type TriggerSignal as T, type AgentAction as a, type AgentAttachment as b, type AgentBridgeRequest as c, type AgentContext as d, type AgentConversation as e, AgentEventEnum as f, type AgentHandlers as g, type AgentHistoryEntry as h, type AgentMessage as i, type AgentMessageAuthor as j, type AgentPlatformContext as k, type AgentReaction as l, type AgentReplyPayload as m, type AgentSubscriber as n, type MetadataSignal as o, type ReplyHandle as p, type SentMessageInfo as q, type Signal as r, agent as s, workflow as w };
442
+ export { type Agent as A, Client as C, type EditPayload as E, type FileRef as F, type INovuRequestHandlerOptions as I, type MessageContent as M, NovuRequestHandler as N, type ReplyContent as R, type ServeHandlerOptions as S, type TriggerSignal as T, type AgentAction as a, type AgentAttachment as b, type AgentBridgeRequest as c, type AgentContext as d, type AgentConversation as e, AgentDeliveryError as f, AgentEventEnum as g, type AgentHandlers as h, type AgentHistoryEntry as i, type AgentMessage as j, type AgentMessageAuthor as k, type AgentPlatformContext as l, type AgentReaction as m, type AgentReplyPayload as n, type AgentSubscriber as o, type MetadataSignal as p, type ReplyHandle as q, type SentMessageInfo as r, type Signal as s, agent as t, workflow as w };