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

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 (40) hide show
  1. package/dist/cjs/{index-naFCU9MB.d.cts → index-gi0_Wcu3.d.cts} +98 -5
  2. package/dist/cjs/index.cjs +52 -52
  3. package/dist/cjs/index.d.cts +1 -1
  4. package/dist/cjs/servers/express.cjs +52 -52
  5. package/dist/cjs/servers/express.d.cts +2 -2
  6. package/dist/cjs/servers/h3.cjs +52 -52
  7. package/dist/cjs/servers/h3.d.cts +2 -2
  8. package/dist/cjs/servers/lambda.cjs +52 -52
  9. package/dist/cjs/servers/lambda.d.cts +2 -2
  10. package/dist/cjs/servers/nest.cjs +52 -52
  11. package/dist/cjs/servers/nest.d.cts +2 -2
  12. package/dist/cjs/servers/next.cjs +52 -52
  13. package/dist/cjs/servers/next.d.cts +2 -2
  14. package/dist/cjs/servers/nuxt.cjs +52 -52
  15. package/dist/cjs/servers/nuxt.d.cts +2 -2
  16. package/dist/cjs/servers/remix.cjs +52 -52
  17. package/dist/cjs/servers/remix.d.cts +2 -2
  18. package/dist/cjs/servers/sveltekit.cjs +52 -52
  19. package/dist/cjs/servers/sveltekit.d.cts +2 -2
  20. package/dist/esm/{chunk-TW2732SM.js → chunk-FURRAVE4.js} +63 -63
  21. package/dist/esm/{index-cfmN-nqZ.d.ts → index-DBjXwxNK.d.ts} +98 -5
  22. package/dist/esm/index.d.ts +1 -1
  23. package/dist/esm/index.js +1 -1
  24. package/dist/esm/servers/express.d.ts +2 -2
  25. package/dist/esm/servers/express.js +1 -1
  26. package/dist/esm/servers/h3.d.ts +2 -2
  27. package/dist/esm/servers/h3.js +1 -1
  28. package/dist/esm/servers/lambda.d.ts +2 -2
  29. package/dist/esm/servers/lambda.js +1 -1
  30. package/dist/esm/servers/nest.d.ts +2 -2
  31. package/dist/esm/servers/nest.js +1 -1
  32. package/dist/esm/servers/next.d.ts +2 -2
  33. package/dist/esm/servers/next.js +1 -1
  34. package/dist/esm/servers/nuxt.d.ts +2 -2
  35. package/dist/esm/servers/nuxt.js +1 -1
  36. package/dist/esm/servers/remix.d.ts +2 -2
  37. package/dist/esm/servers/remix.js +1 -1
  38. package/dist/esm/servers/sveltekit.d.ts +2 -2
  39. package/dist/esm/servers/sveltekit.js +1 -1
  40. package/package.json +1 -1
@@ -1,20 +1,34 @@
1
- import { ChatElement } from 'chat';
1
+ import { ChatElement, CardElement } from 'chat';
2
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
3
  import { g as Awaitable } from './subscriber.types-CNLicO8m.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
 
7
+ declare enum AgentEventEnum {
8
+ ON_MESSAGE = "onMessage",
9
+ ON_ACTION = "onAction",
10
+ ON_RESOLVE = "onResolve",
11
+ ON_REACTION = "onReaction"
12
+ }
7
13
  interface AgentMessageAuthor {
8
14
  userId: string;
9
15
  fullName: string;
10
16
  userName: string;
11
17
  isBot: boolean | 'unknown';
12
18
  }
19
+ interface AgentAttachment {
20
+ type: string;
21
+ url?: string;
22
+ name?: string;
23
+ mimeType?: string;
24
+ size?: number;
25
+ }
13
26
  interface AgentMessage {
14
27
  text: string;
15
28
  platformMessageId: string;
16
29
  author: AgentMessageAuthor;
17
30
  timestamp: string;
31
+ attachments?: AgentAttachment[];
18
32
  }
19
33
  interface AgentConversation {
20
34
  identifier: string;
@@ -38,6 +52,7 @@ interface AgentHistoryEntry {
38
52
  role: string;
39
53
  type: string;
40
54
  content: string;
55
+ richContent?: Record<string, unknown>;
41
56
  senderName?: string;
42
57
  signalData?: {
43
58
  type: string;
@@ -59,7 +74,7 @@ interface FileRef {
59
74
  url?: string;
60
75
  }
61
76
  /**
62
- * Content accepted by ctx.reply() and ctx.update().
77
+ * Content accepted by ctx.reply() and handle.edit().
63
78
  *
64
79
  * - `string` — plain text
65
80
  * - `{ markdown, files? }` — markdown-formatted text, optionally with file attachments
@@ -70,6 +85,13 @@ type MessageContent = string | {
70
85
  markdown: string;
71
86
  files?: FileRef[];
72
87
  } | ChatElement;
88
+ /** Normalized content shape sent over HTTP to the reply endpoint. */
89
+ interface ReplyContent {
90
+ text?: string;
91
+ markdown?: string;
92
+ card?: CardElement;
93
+ files?: FileRef[];
94
+ }
73
95
  interface AgentAction {
74
96
  actionId: string;
75
97
  value?: string;
@@ -82,6 +104,19 @@ interface AgentReaction {
82
104
  added: boolean;
83
105
  message: AgentMessage | null;
84
106
  }
107
+ /**
108
+ * Handle to a message posted via ctx.reply(). Mirrors the chat SDK's `SentMessage`
109
+ * primitive: edits apply in-place on the platform (same platform message, content changes)
110
+ * and never post a new message.
111
+ */
112
+ interface ReplyHandle {
113
+ /** Platform-native message id (e.g. Slack ts, Teams activityId). */
114
+ readonly messageId: string;
115
+ /** Platform-native thread id this message lives in. */
116
+ readonly platformThreadId: string;
117
+ /** Edit this message in place with new content. Returns the same handle for chaining. */
118
+ edit(content: MessageContent): Promise<ReplyHandle>;
119
+ }
85
120
  interface AgentContext {
86
121
  readonly event: string;
87
122
  readonly action: AgentAction | null;
@@ -92,8 +127,16 @@ interface AgentContext {
92
127
  readonly history: AgentHistoryEntry[];
93
128
  readonly platform: string;
94
129
  readonly platformContext: AgentPlatformContext;
95
- reply(content: MessageContent): Promise<void>;
96
- update(content: MessageContent): Promise<void>;
130
+ /**
131
+ * Post a message to the conversation and return a handle to it.
132
+ * Use the handle to edit the message in place later — no second post.
133
+ *
134
+ * @example
135
+ * const msg = await ctx.reply('Thinking…');
136
+ * // ... do work ...
137
+ * await msg.edit('Here is the answer');
138
+ */
139
+ reply(content: MessageContent): Promise<ReplyHandle>;
97
140
  resolve(summary?: string): void;
98
141
  metadata: {
99
142
  set(key: string, value: unknown): void;
@@ -113,6 +156,56 @@ interface Agent {
113
156
  id: string;
114
157
  handlers: AgentHandlers;
115
158
  }
159
+ interface AgentBridgeRequest {
160
+ version: number;
161
+ timestamp: string;
162
+ deliveryId: string;
163
+ event: string;
164
+ agentId: string;
165
+ replyUrl: string;
166
+ conversationId: string;
167
+ integrationIdentifier: string;
168
+ action: AgentAction | null;
169
+ message: AgentMessage | null;
170
+ reaction: AgentReaction | null;
171
+ conversation: AgentConversation;
172
+ subscriber: AgentSubscriber | null;
173
+ history: AgentHistoryEntry[];
174
+ platform: string;
175
+ platformContext: AgentPlatformContext;
176
+ }
177
+ type MetadataSignal = {
178
+ type: 'metadata';
179
+ key: string;
180
+ value: unknown;
181
+ };
182
+ type TriggerSignal = {
183
+ type: 'trigger';
184
+ workflowId: string;
185
+ to?: string;
186
+ payload?: Record<string, unknown>;
187
+ };
188
+ type Signal = MetadataSignal | TriggerSignal;
189
+ /** In-place edit of a previously posted agent message. Identified by platform message id. */
190
+ interface EditPayload {
191
+ messageId: string;
192
+ content: ReplyContent;
193
+ }
194
+ interface AgentReplyPayload {
195
+ conversationId: string;
196
+ integrationIdentifier: string;
197
+ reply?: ReplyContent;
198
+ edit?: EditPayload;
199
+ resolve?: {
200
+ summary?: string;
201
+ };
202
+ signals?: Signal[];
203
+ }
204
+ /** Shape returned by /agents/:id/reply when a reply or edit was delivered. */
205
+ interface SentMessageInfo {
206
+ messageId: string;
207
+ platformThreadId: string;
208
+ }
116
209
 
117
210
  /**
118
211
  * Define a new conversational agent.
@@ -265,4 +358,4 @@ declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
265
358
  */
266
359
  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>;
267
360
 
268
- export { type Agent as A, Client as C, type FileRef as F, type INovuRequestHandlerOptions as I, type MessageContent as M, NovuRequestHandler as N, type ServeHandlerOptions as S, type AgentContext as a, type AgentHandlers as b, type AgentReaction as c, agent as d, workflow as w };
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 };