@novu/framework 2.13.1-rc.852194fa77 → 2.13.2-rc.dc9caee828

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 (65) hide show
  1. package/dist/cjs/{agent.types-CQKSD7NC.d.cts → agent.types-crcJBtCy.d.cts} +119 -3
  2. package/dist/cjs/ai-sdk/index.d.cts +1 -1
  3. package/dist/cjs/{health-check.types-B6RuXNc8.d.cts → health-check.types-C2XZ-Tpt.d.cts} +2 -2
  4. package/dist/cjs/{index-phn3kJ9H.d.cts → index-DVSB455a.d.cts} +3 -3
  5. package/dist/cjs/index.cjs +96 -96
  6. package/dist/cjs/index.d.cts +4 -4
  7. package/dist/cjs/internal/index.cjs +36 -36
  8. package/dist/cjs/internal/index.d.cts +139 -14
  9. package/dist/cjs/langchain/index.d.cts +1 -1
  10. package/dist/cjs/servers/express.cjs +97 -97
  11. package/dist/cjs/servers/express.d.cts +5 -5
  12. package/dist/cjs/servers/h3.cjs +106 -106
  13. package/dist/cjs/servers/h3.d.cts +5 -5
  14. package/dist/cjs/servers/hono.cjs +103 -103
  15. package/dist/cjs/servers/hono.d.cts +5 -5
  16. package/dist/cjs/servers/lambda.cjs +97 -97
  17. package/dist/cjs/servers/lambda.d.cts +5 -5
  18. package/dist/cjs/servers/nest.cjs +99 -99
  19. package/dist/cjs/servers/nest.d.cts +7 -7
  20. package/dist/cjs/servers/next.cjs +116 -116
  21. package/dist/cjs/servers/next.d.cts +5 -5
  22. package/dist/cjs/servers/nuxt.cjs +106 -106
  23. package/dist/cjs/servers/nuxt.d.cts +5 -5
  24. package/dist/cjs/servers/remix.cjs +110 -110
  25. package/dist/cjs/servers/remix.d.cts +5 -5
  26. package/dist/cjs/servers/sveltekit.cjs +110 -110
  27. package/dist/cjs/servers/sveltekit.d.cts +5 -5
  28. package/dist/cjs/step-resolver.cjs +1 -1
  29. package/dist/cjs/step-resolver.d.cts +2 -2
  30. package/dist/cjs/{subscriber.types-_eHz1E0m.d.cts → subscriber.types-BanvmGul.d.cts} +1 -1
  31. package/dist/esm/{agent.types-C17NUGxY.d.ts → agent.types-DFLG1_vb.d.ts} +119 -3
  32. package/dist/esm/ai-sdk/index.d.ts +1 -1
  33. package/dist/esm/chunk-4ETX7FIT.js +1 -0
  34. package/dist/esm/{chunk-WJUYDVXH.js → chunk-BXKRUYUB.js} +46 -46
  35. package/dist/esm/{chunk-UXO4RWZV.js → chunk-IREH6K2M.js} +2 -2
  36. package/dist/esm/{health-check.types-CL5-B_D4.d.ts → health-check.types-DORn4djx.d.ts} +2 -2
  37. package/dist/esm/{index-CYtGHJJu.d.ts → index-BvRGmHFw.d.ts} +3 -3
  38. package/dist/esm/index.d.ts +4 -4
  39. package/dist/esm/index.js +1 -1
  40. package/dist/esm/internal/index.d.ts +131 -6
  41. package/dist/esm/internal/index.js +1 -1
  42. package/dist/esm/langchain/index.d.ts +1 -1
  43. package/dist/esm/servers/express.d.ts +5 -5
  44. package/dist/esm/servers/express.js +1 -1
  45. package/dist/esm/servers/h3.d.ts +5 -5
  46. package/dist/esm/servers/h3.js +1 -1
  47. package/dist/esm/servers/hono.d.ts +5 -5
  48. package/dist/esm/servers/hono.js +1 -1
  49. package/dist/esm/servers/lambda.d.ts +5 -5
  50. package/dist/esm/servers/lambda.js +1 -1
  51. package/dist/esm/servers/nest.d.ts +7 -7
  52. package/dist/esm/servers/nest.js +1 -1
  53. package/dist/esm/servers/next.d.ts +5 -5
  54. package/dist/esm/servers/next.js +1 -1
  55. package/dist/esm/servers/nuxt.d.ts +5 -5
  56. package/dist/esm/servers/nuxt.js +1 -1
  57. package/dist/esm/servers/remix.d.ts +5 -5
  58. package/dist/esm/servers/remix.js +1 -1
  59. package/dist/esm/servers/sveltekit.d.ts +5 -5
  60. package/dist/esm/servers/sveltekit.js +1 -1
  61. package/dist/esm/step-resolver.d.ts +2 -2
  62. package/dist/esm/step-resolver.js +1 -1
  63. package/dist/esm/{subscriber.types-D4PvRIKR.d.ts → subscriber.types-Drf26WPA.d.ts} +1 -1
  64. package/package.json +3 -2
  65. package/dist/esm/chunk-Q3ALQWIF.js +0 -1
@@ -1,10 +1,10 @@
1
- import { P as PostActionEnum } from '../health-check.types-B6RuXNc8.cjs';
2
- export { b as CancelEventTriggerResponse, c as ChannelPreference, C as ClientOptions, d as CodeResult, a as CronExpression, D as DiscoverAgentOutput, e as DiscoverOutput, f as DiscoverProviderOutput, g as DiscoverStepOutput, h as DiscoverWorkflowOutput, i as Event, j as EventTriggerParams, k as EventTriggerResponse, l as EventTriggerResult, m as Execute, E as ExecuteInput, n as ExecuteOutput, o as ExecuteOutputMetadata, p as ExecuteOutputOptions, G as GetActionEnum, H as HealthCheck, L as Logger, S as SeverityLevelEnum, q as State, r as StepType, W as Workflow, s as WorkflowChannelEnum, t as WorkflowOptions, u as WorkflowPreference, v as WorkflowPreferences } from '../health-check.types-B6RuXNc8.cjs';
3
- export { e as ActionStep, A as ActionStepEnum, f as ChannelStep, c as ChannelStepEnum, g as ChatOutput, h as ChatOutputUnvalidated, i as ChatResult, a as ContextPayload, C as ContextResolved, j as ContextValue, k as CustomStep, D as DelayDynamicOutput, l as DelayDynamicOutputUnvalidated, m as DelayOutput, n as DelayOutputUnvalidated, o as DelayRegularOutput, q as DelayRegularOutputUnvalidated, r as DelayResult, s as DelayTimedOutput, t as DelayTimedOutputUnvalidated, u as DigestOutput, v as DigestOutputUnvalidated, w as DigestRegularOutput, x as DigestRegularOutputUnvalidated, y as DigestResult, z as DigestTimedOutput, B as DigestTimedOutputUnvalidated, F as EmailOutput, G as EmailOutputUnvalidated, H as EmailResult, E as EnvironmentSystemVariables, I as InAppOutput, J as InAppOutputUnvalidated, K as InAppResult, L as JobStatusEnum, P as PushOutput, M as PushOutputUnvalidated, N as PushResult, O as Skip, Q as SmsOutput, R as SmsOutputUnvalidated, T as SmsResult, b as Step, U as StepContext, d as StepOptions, V as StepOutput, S as Subscriber, X as ThrottleOutput, Y as ThrottleOutputUnvalidated, Z as ThrottleResult, _ as ToolOutput, $ as ToolOutputUnvalidated, a0 as actionStepSchemas, a1 as channelStepSchemas } from '../subscriber.types-_eHz1E0m.cjs';
1
+ import { P as PostActionEnum } from '../health-check.types-C2XZ-Tpt.cjs';
2
+ export { b as CancelEventTriggerResponse, c as ChannelPreference, C as ClientOptions, d as CodeResult, a as CronExpression, D as DiscoverAgentOutput, e as DiscoverOutput, f as DiscoverProviderOutput, g as DiscoverStepOutput, h as DiscoverWorkflowOutput, i as Event, j as EventTriggerParams, k as EventTriggerResponse, l as EventTriggerResult, m as Execute, E as ExecuteInput, n as ExecuteOutput, o as ExecuteOutputMetadata, p as ExecuteOutputOptions, G as GetActionEnum, H as HealthCheck, L as Logger, S as SeverityLevelEnum, q as State, r as StepType, W as Workflow, s as WorkflowChannelEnum, t as WorkflowOptions, u as WorkflowPreference, v as WorkflowPreferences } from '../health-check.types-C2XZ-Tpt.cjs';
3
+ export { e as ActionStep, A as ActionStepEnum, f as ChannelStep, c as ChannelStepEnum, g as ChatOutput, h as ChatOutputUnvalidated, i as ChatResult, a as ContextPayload, C as ContextResolved, j as ContextValue, k as CustomStep, D as DelayDynamicOutput, l as DelayDynamicOutputUnvalidated, m as DelayOutput, n as DelayOutputUnvalidated, o as DelayRegularOutput, q as DelayRegularOutputUnvalidated, r as DelayResult, s as DelayTimedOutput, t as DelayTimedOutputUnvalidated, u as DigestOutput, v as DigestOutputUnvalidated, w as DigestRegularOutput, x as DigestRegularOutputUnvalidated, y as DigestResult, z as DigestTimedOutput, B as DigestTimedOutputUnvalidated, F as EmailOutput, G as EmailOutputUnvalidated, H as EmailResult, E as EnvironmentSystemVariables, I as InAppOutput, J as InAppOutputUnvalidated, K as InAppResult, L as JobStatusEnum, P as PushOutput, M as PushOutputUnvalidated, N as PushResult, O as Skip, Q as SmsOutput, R as SmsOutputUnvalidated, T as SmsResult, b as Step, U as StepContext, d as StepOptions, V as StepOutput, S as Subscriber, X as ThrottleOutput, Y as ThrottleOutputUnvalidated, Z as ThrottleResult, _ as ToolOutput, $ as ToolOutputUnvalidated, a0 as actionStepSchemas, a1 as channelStepSchemas } from '../subscriber.types-BanvmGul.cjs';
4
4
  import { Filter, LiquidOptions, Liquid } from 'liquidjs';
5
5
  import { Emoji } from 'chat';
6
- import { j as AgentHandlerContext, E as ToolResult, G as ToolApprovalRequestPayload, T as ToolApprovalCard, R as ReplyHandle, o as AgentMessageContext, H as AgentEventEnum, a as AgentAction, m as AgentMessage, r as AgentReaction, g as AgentConversation, u as AgentSubscriber, e as AgentContextPayload, p as AgentNotification, l as AgentHistoryEntry, q as AgentPlatformContext, J as TypingControl, K as ToolApprovalControl, L as AgentBridgeRequest, x as ToolApprovalConfig, M as MessageContent, F as FileRef, N as ReplyContent, S as Signal, O as AddReactionPayload, P as DeleteMessagePayload, Q as SentMessageInfo, U as TypingOp, B as TriggerRecipientsPayload } from '../agent.types-CQKSD7NC.cjs';
7
- export { V as AgentReplyPayload, X as EditPayload, Y as MetadataSignal, Z as ParsedApprovalAction, _ as TriggerSignal, $ as buildApprovalActionId, a0 as parseApprovalActionId } from '../agent.types-CQKSD7NC.cjs';
6
+ import { j as AgentHandlerContext, L as ToolResult, N as ToolApprovalRequestPayload, T as ToolApprovalCard, R as ReplyHandle, p as AgentMessageContext, O as AgentEventEnum, a as AgentAction, n as AgentMessage, s as AgentReaction, g as AgentConversation, v as AgentSubscriber, e as AgentContextPayload, q as AgentNotification, l as AgentHistoryEntry, r as AgentPlatformContext, m as AgentHumanResponse, P as TypingControl, Q as ToolApprovalControl, S as AgentBridgeRequest, C as ToolApprovalConfig, M as MessageContent, F as FileRef, U as ReplyContent, V as Signal, X as AddReactionPayload, Y as DeleteMessagePayload, Z as SentMessageInfo, _ as TypingOp, G as TriggerRecipientsPayload, H as HumanAskApproveOptions, y as HumanChooseOptions, B as HumanTellOptions } from '../agent.types-crcJBtCy.cjs';
7
+ export { $ as AgentReplyPayload, a0 as EditPayload, a1 as HumanSignal, a2 as MetadataSignal, a3 as ParsedApprovalAction, a4 as TriggerSignal, a5 as buildApprovalActionId, a6 as parseApprovalActionId } from '../agent.types-crcJBtCy.cjs';
8
8
  export { a as FromSchema, F as FromSchemaUnvalidated, J as JsonSchema, S as Schema, Z as ZodSchema, b as ZodSchemaMinimal } from '../base.schema.types-BApIn9jr.cjs';
9
9
  export { S as SupportedFrameworkName } from '../server.types-Cc6o5eYH.cjs';
10
10
  export { A as Awaitable, C as ConditionalPartial, D as DeepPartial, b as DeepRequired, E as Either, I as Indexable, c as PickOptional, d as PickOptionalKeys, e as PickRequired, P as PickRequiredKeys, a as Prettify } from '../util.types-DaFfsxgy.cjs';
@@ -137,14 +137,115 @@ declare enum ResourceEnum {
137
137
  STEP = "step"
138
138
  }
139
139
 
140
- declare const RUNTIME_CONTEXT_BRAND: unique symbol;
141
- interface AgentRuntimeContext extends AgentHandlerContext {
142
- readonly [RUNTIME_CONTEXT_BRAND]: true;
143
- emitToolResult(result: ToolResult): void;
144
- emitToolApprovalRequest(request: ToolApprovalRequestPayload): void;
145
- replyApprovalCard(card: ToolApprovalCard): Promise<ReplyHandle>;
146
- asMessageContext(): AgentMessageContext;
147
- }
140
+ /**
141
+ * Novu-owned card JSON on the agent wire.
142
+ *
143
+ * Matches the full Chat SDK kit agents emit (`section` / `fields` / `table` /
144
+ * `button` / `select` / `radio_select`) plus Novu fields on buttons
145
+ * (`actionType`, `callbackUrl`, `disabled`). Chat SDK stays the authoring
146
+ * frontend (`@novu/framework`); this type is the contract `@novu/js` and the
147
+ * event protocol share. The dashboard Maily editor still authors the smaller
148
+ * `@novu/shared` v1 subset (link-buttons only).
149
+ *
150
+ * Compatibility locks in `packages/framework/src/resources/agent/card-element-compat.test-d.ts`:
151
+ * `chat.CardElement` and `@novu/stateless` `CardElement` must assign to this type.
152
+ * Do not add `chat` or `@novu/stateless` as a dependency here.
153
+ */
154
+ type CardElementTextElement = {
155
+ type: 'text';
156
+ content: string;
157
+ style?: 'plain' | 'bold' | 'muted';
158
+ };
159
+ type CardElementImageElement = {
160
+ type: 'image';
161
+ url: string;
162
+ alt?: string;
163
+ };
164
+ type CardElementDividerElement = {
165
+ type: 'divider';
166
+ };
167
+ /** Presentational inline hyperlink (Chat SDK `CardLink`). */
168
+ type CardElementLinkElement = {
169
+ type: 'link';
170
+ label: string;
171
+ url: string;
172
+ };
173
+ type CardElementLinkButtonElement = {
174
+ type: 'link-button';
175
+ label: string;
176
+ url: string;
177
+ style?: 'primary' | 'danger' | 'default';
178
+ /** Optional author-provided id; platform serializers use it (e.g. Slack `action_id`). */
179
+ id?: string;
180
+ };
181
+ /** Interactive action button (Chat SDK `Button`). Drives `sendAction` in web chat. */
182
+ type CardElementButtonElement = {
183
+ type: 'button';
184
+ id: string;
185
+ label: string;
186
+ style?: 'primary' | 'danger' | 'default';
187
+ actionType?: 'action' | 'modal';
188
+ callbackUrl?: string;
189
+ value?: string;
190
+ disabled?: boolean;
191
+ };
192
+ type CardElementSelectOptionElement = {
193
+ label: string;
194
+ value: string;
195
+ description?: string;
196
+ };
197
+ /** Chat SDK `Select`. */
198
+ type CardElementSelectElement = {
199
+ type: 'select';
200
+ id: string;
201
+ label: string;
202
+ options: CardElementSelectOptionElement[];
203
+ initialOption?: string;
204
+ optional?: boolean;
205
+ placeholder?: string;
206
+ };
207
+ /** Chat SDK `RadioSelect`. */
208
+ type CardElementRadioSelectElement = {
209
+ type: 'radio_select';
210
+ id: string;
211
+ label: string;
212
+ options: CardElementSelectOptionElement[];
213
+ initialOption?: string;
214
+ optional?: boolean;
215
+ };
216
+ type CardElementActionChild = CardElementLinkButtonElement | CardElementButtonElement | CardElementSelectElement | CardElementRadioSelectElement;
217
+ type CardElementActionsElement = {
218
+ type: 'actions';
219
+ children: CardElementActionChild[];
220
+ };
221
+ type CardElementFieldElement = {
222
+ type: 'field';
223
+ label: string;
224
+ value: string;
225
+ };
226
+ type CardElementFieldsElement = {
227
+ type: 'fields';
228
+ children: CardElementFieldElement[];
229
+ };
230
+ type CardElementTableElement = {
231
+ type: 'table';
232
+ headers: string[];
233
+ rows: string[][];
234
+ align?: Array<'left' | 'center' | 'right'>;
235
+ };
236
+ type CardElementSectionElement = {
237
+ type: 'section';
238
+ children: CardElementChild[];
239
+ };
240
+ /** Includes top-level `button` — agents emit that shape, not only `actions` wrappers. */
241
+ type CardElementChild = CardElementTextElement | CardElementImageElement | CardElementDividerElement | CardElementLinkElement | CardElementButtonElement | CardElementActionsElement | CardElementSectionElement | CardElementFieldsElement | CardElementTableElement;
242
+ type CardElement = {
243
+ type: 'card';
244
+ title?: string;
245
+ subtitle?: string;
246
+ imageUrl?: string;
247
+ children: CardElementChild[];
248
+ };
148
249
 
149
250
  type AgentMessageRole = 'user' | 'assistant';
150
251
  type AgentToolSource = {
@@ -179,7 +280,7 @@ type AgentToolResultContent = {
179
280
  type AgentMessageContent = {
180
281
  markdown: string;
181
282
  } | {
182
- card: Record<string, unknown>;
283
+ card: CardElement;
183
284
  };
184
285
  interface AgentFileRef {
185
286
  fileId: string;
@@ -233,6 +334,15 @@ type AgentSignal = {
233
334
  workflowId: string;
234
335
  to?: unknown;
235
336
  payload?: Record<string, unknown>;
337
+ } | {
338
+ type: 'human';
339
+ kind: 'ask' | 'approve' | 'choose' | 'tell';
340
+ prompt: string;
341
+ requestId: string;
342
+ options?: string[];
343
+ from?: string;
344
+ ttlSeconds?: number;
345
+ to?: string | string[];
236
346
  };
237
347
  type AgentEvent = {
238
348
  type: 'run-start';
@@ -673,6 +783,15 @@ type FilterValidators = {
673
783
  };
674
784
  declare const FILTER_VALIDATORS: FilterValidators;
675
785
 
786
+ declare const RUNTIME_CONTEXT_BRAND: unique symbol;
787
+ interface AgentRuntimeContext extends AgentHandlerContext {
788
+ readonly [RUNTIME_CONTEXT_BRAND]: true;
789
+ emitToolResult(result: ToolResult): void;
790
+ emitToolApprovalRequest(request: ToolApprovalRequestPayload): void;
791
+ replyApprovalCard(card: ToolApprovalCard): Promise<ReplyHandle>;
792
+ asMessageContext(): AgentMessageContext;
793
+ }
794
+
676
795
  /** Pending side effects queued between replies, drained atomically before each turn action. */
677
796
  interface SideEffectsSnapshot {
678
797
  toolApprovalRequest: ToolApprovalRequestPayload | null;
@@ -731,6 +850,7 @@ declare class AgentContextImpl implements AgentRuntimeContext {
731
850
  readonly history: AgentHistoryEntry[];
732
851
  readonly platform: string;
733
852
  readonly platformContext: AgentPlatformContext;
853
+ readonly humanResponse: AgentHumanResponse | null;
734
854
  readonly typing: TypingControl;
735
855
  readonly toolApproval: ToolApprovalControl;
736
856
  readonly metadata: {
@@ -766,6 +886,11 @@ declare class AgentContextImpl implements AgentRuntimeContext {
766
886
  to?: TriggerRecipientsPayload;
767
887
  payload?: Record<string, unknown>;
768
888
  }): void;
889
+ ask(question: string, opts?: HumanAskApproveOptions): string;
890
+ approve(action: string, opts?: HumanAskApproveOptions): string;
891
+ choose(question: string, options: string[], opts?: HumanChooseOptions): string;
892
+ tell(message: string, opts?: HumanTellOptions): string;
893
+ private queueHumanSignal;
769
894
  /** @internal Queue a gated tool call for the ledger; flushed with the next reply. */
770
895
  emitToolApprovalRequest(request: ToolApprovalRequestPayload): void;
771
896
  /** @internal Queue a tool-call outcome to be recorded in history; flushed with the next reply. */
@@ -1,5 +1,5 @@
1
1
  import { BaseMessage } from '@langchain/core/messages';
2
- import { l as AgentHistoryEntry, j as AgentHandlerContext, M as MessageContent, k as AgentHandlers, m as AgentMessage, o as AgentMessageContext, y as ToolApprovalDecision, b as AgentActionContext, R as ReplyHandle, A as Agent } from '../agent.types-CQKSD7NC.cjs';
2
+ import { l as AgentHistoryEntry, j as AgentHandlerContext, M as MessageContent, k as AgentHandlers, n as AgentMessage, p as AgentMessageContext, D as ToolApprovalDecision, b as AgentActionContext, R as ReplyHandle, A as Agent } from '../agent.types-crcJBtCy.cjs';
3
3
  import { LanguageModelLike } from '@langchain/core/language_models/base';
4
4
  import { RunnableConfig } from '@langchain/core/runnables';
5
5
  import { StructuredToolInterface } from '@langchain/core/tools';