@novu/framework 2.13.0 → 2.13.1-rc.852194fa77

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 (92) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/{agent.types-Dqm2VBTO.d.cts → agent.types-CQKSD7NC.d.cts} +84 -3
  3. package/dist/cjs/ai-sdk/index.cjs +4 -1
  4. package/dist/cjs/ai-sdk/index.d.cts +16 -5
  5. package/dist/cjs/cards.cjs +28 -28
  6. package/dist/cjs/cards.d.cts +1 -1
  7. package/dist/cjs/{health-check.types-B9FbzRbm.d.cts → health-check.types-B6RuXNc8.d.cts} +72 -66
  8. package/dist/cjs/{index-CLZZRnNV.d.cts → index-phn3kJ9H.d.cts} +18 -6
  9. package/dist/cjs/index.cjs +112 -112
  10. package/dist/cjs/index.d.cts +6 -6
  11. package/dist/cjs/internal/index.cjs +46 -43
  12. package/dist/cjs/internal/index.d.cts +314 -28
  13. package/dist/cjs/langchain/index.cjs +4 -1
  14. package/dist/cjs/langchain/index.d.cts +38 -6
  15. package/dist/cjs/servers/express.cjs +102 -102
  16. package/dist/cjs/servers/express.d.cts +7 -7
  17. package/dist/cjs/servers/h3.cjs +106 -106
  18. package/dist/cjs/servers/h3.d.cts +7 -7
  19. package/dist/cjs/servers/hono.cjs +106 -106
  20. package/dist/cjs/servers/hono.d.cts +7 -7
  21. package/dist/cjs/servers/lambda.cjs +102 -102
  22. package/dist/cjs/servers/lambda.d.cts +7 -7
  23. package/dist/cjs/servers/nest.cjs +115 -115
  24. package/dist/cjs/servers/nest.d.cts +9 -9
  25. package/dist/cjs/servers/next.cjs +124 -124
  26. package/dist/cjs/servers/next.d.cts +7 -7
  27. package/dist/cjs/servers/nuxt.cjs +106 -106
  28. package/dist/cjs/servers/nuxt.d.cts +7 -7
  29. package/dist/cjs/servers/remix.cjs +117 -117
  30. package/dist/cjs/servers/remix.d.cts +7 -7
  31. package/dist/cjs/servers/sveltekit.cjs +114 -114
  32. package/dist/cjs/servers/sveltekit.d.cts +7 -7
  33. package/dist/cjs/step-resolver.cjs +4 -4
  34. package/dist/cjs/step-resolver.d.cts +18 -4
  35. package/dist/cjs/{subscriber.types-DubxcL8q.d.cts → subscriber.types-_eHz1E0m.d.cts} +738 -20
  36. package/dist/cjs/validators.cjs +1 -1
  37. package/dist/esm/{agent.types-E3sxq6xr.d.ts → agent.types-C17NUGxY.d.ts} +84 -3
  38. package/dist/esm/ai-sdk/index.d.ts +16 -5
  39. package/dist/esm/ai-sdk/index.js +1 -1
  40. package/dist/esm/cards.d.ts +1 -1
  41. package/dist/esm/cards.js +1 -1
  42. package/dist/esm/chunk-PU74XQ2P.js +1 -0
  43. package/dist/esm/chunk-Q3ALQWIF.js +1 -0
  44. package/dist/esm/chunk-QZ6TSYCK.js +4 -0
  45. package/dist/esm/{chunk-CANJPWLT.js → chunk-UXO4RWZV.js} +4 -4
  46. package/dist/esm/{chunk-FRWG7YTE.js → chunk-VY27ZAO7.js} +1 -1
  47. package/dist/esm/chunk-WJUYDVXH.js +98 -0
  48. package/dist/esm/{chunk-46AHJTS7.js → chunk-X5AZIKIR.js} +8 -8
  49. package/dist/esm/{chunk-22DBAEUX.js → chunk-XIVU4VDS.js} +1 -1
  50. package/dist/esm/{chunk-2M25EATE.js → chunk-YLCLZVYS.js} +1 -1
  51. package/dist/esm/chunk-YZ3P3MMZ.js +1 -0
  52. package/dist/esm/{health-check.types-BNocZ4Wk.d.ts → health-check.types-CL5-B_D4.d.ts} +72 -66
  53. package/dist/esm/{index-CWldA6G5.d.ts → index-CYtGHJJu.d.ts} +18 -6
  54. package/dist/esm/index.d.ts +6 -6
  55. package/dist/esm/index.js +1 -1
  56. package/dist/esm/internal/index.d.ts +306 -20
  57. package/dist/esm/internal/index.js +1 -1
  58. package/dist/esm/jsx-dev-runtime.js +1 -1
  59. package/dist/esm/{jsx-runtime-P2HN3TPO.js → jsx-runtime-5ZWEWA4A.js} +1 -1
  60. package/dist/esm/jsx-runtime.js +1 -1
  61. package/dist/esm/langchain/index.d.ts +38 -6
  62. package/dist/esm/langchain/index.js +1 -1
  63. package/dist/esm/servers/express.d.ts +7 -7
  64. package/dist/esm/servers/express.js +1 -1
  65. package/dist/esm/servers/h3.d.ts +7 -7
  66. package/dist/esm/servers/h3.js +1 -1
  67. package/dist/esm/servers/hono.d.ts +7 -7
  68. package/dist/esm/servers/hono.js +1 -1
  69. package/dist/esm/servers/lambda.d.ts +7 -7
  70. package/dist/esm/servers/lambda.js +1 -1
  71. package/dist/esm/servers/nest.d.ts +9 -9
  72. package/dist/esm/servers/nest.js +1 -1
  73. package/dist/esm/servers/next.d.ts +7 -7
  74. package/dist/esm/servers/next.js +1 -1
  75. package/dist/esm/servers/nuxt.d.ts +7 -7
  76. package/dist/esm/servers/nuxt.js +1 -1
  77. package/dist/esm/servers/remix.d.ts +7 -7
  78. package/dist/esm/servers/remix.js +1 -1
  79. package/dist/esm/servers/sveltekit.d.ts +7 -7
  80. package/dist/esm/servers/sveltekit.js +1 -1
  81. package/dist/esm/step-resolver.d.ts +18 -4
  82. package/dist/esm/step-resolver.js +1 -1
  83. package/dist/esm/{subscriber.types-CmybpXhA.d.ts → subscriber.types-D4PvRIKR.d.ts} +738 -20
  84. package/dist/esm/validators.js +1 -1
  85. package/langchain/package.json +4 -0
  86. package/nest/package.json +2 -1
  87. package/package.json +4 -3
  88. package/dist/esm/chunk-LHU5A7DI.js +0 -1
  89. package/dist/esm/chunk-W6DIBD4Z.js +0 -1
  90. package/dist/esm/chunk-WDBIT4NK.js +0 -98
  91. /package/dist/esm/{chunk-3ZWME5KT.js → chunk-7C3QBYLB.js} +0 -0
  92. /package/dist/esm/{chunk-XEHQJMMQ.js → chunk-RBTQQ5IZ.js} +0 -0
@@ -1,2 +1,2 @@
1
- export { Actions, ActionsElement, Button, ButtonElement, Card, CardChild, CardElement, CardLink, CardText, Divider, DividerElement, LinkElement, Select, SelectElement, SelectOption, SelectOptionElement, TextElement, TextInput, TextInputElement } from 'chat';
1
+ export { Actions, ActionsElement, Button, ButtonElement, Card, CardChild, CardElement, CardLink, CardText, Divider, DividerElement, Image, ImageElement, LinkElement, Select, SelectElement, SelectOption, SelectOptionElement, TextElement, TextInput, TextInputElement } from 'chat';
2
2
  import 'chat/jsx-runtime';
@@ -1,71 +1,8 @@
1
- import { a as ContextPayload, b as Step, S as Subscriber, E as EnvironmentSystemVariables, C as ContextResolved, c as ChannelStepEnum, A as ActionStepEnum, W as WithPassthrough, d as StepOptions } from './subscriber.types-DubxcL8q.cjs';
2
- import { I as ITriggerPayload, w as TriggerRecipientsPayload, x as ISubscriberPayload, y as TriggerEventStatusEnum, W as WorkflowPreferencesPartial } from './agent.types-Dqm2VBTO.cjs';
1
+ import { a as ContextPayload, b as Step, S as Subscriber, E as EnvironmentSystemVariables, C as ContextResolved, c as ChannelStepEnum, A as ActionStepEnum, W as WithPassthrough, d as StepOptions } from './subscriber.types-_eHz1E0m.cjs';
2
+ import { I as ITriggerPayload, B as TriggerRecipientsPayload, C as ISubscriberPayload, D as TriggerEventStatusEnum, W as WorkflowPreferencesPartial } from './agent.types-CQKSD7NC.cjs';
3
3
  import { C as ConditionalPartial, P as PickRequiredKeys, a as Prettify, D as DeepPartial, A as Awaitable } from './util.types-DaFfsxgy.cjs';
4
4
  import { S as Schema, J as JsonSchema } from './base.schema.types-BApIn9jr.cjs';
5
5
 
6
- type CodeResult = {
7
- code: string;
8
- };
9
-
10
- /**
11
- * A minimal logger interface used for all of the framework's internal logging
12
- * (workflow discovery, execution and bridge error reporting).
13
- *
14
- * The methods (`info`/`warn`/`error`) are chosen so that both the global
15
- * `console` and common structured loggers (pino, winston, ...) satisfy this
16
- * interface directly, with no adapter. The global `console` is the default;
17
- * provide your own to route Novu's internal logs wherever the rest of your
18
- * application logs go.
19
- */
20
- type Logger = {
21
- info: typeof console.info;
22
- warn: typeof console.warn;
23
- error: typeof console.error;
24
- };
25
- type ClientOptions = {
26
- /**
27
- * Use Novu Cloud US (https://api.novu.co) or EU deployment (https://eu.api.novu.co). Defaults to US.
28
- */
29
- apiUrl?: string;
30
- /**
31
- * Specify your Novu secret key, to secure the Bridge Endpoint, and Novu API communication.
32
- * Novu communicates securely with your endpoint using a signed HMAC header,
33
- * ensuring that only trusted requests from Novu are actioned by your Bridge API.
34
- * The secret key is used to sign the HMAC header.
35
- */
36
- secretKey?: string;
37
- /**
38
- * Explicitly use HMAC signature verification.
39
- * Setting this to `false` will enable Novu to communicate with your Bridge API
40
- * without requiring a valid HMAC signature.
41
- * This is useful for local development and testing.
42
- *
43
- * In production you must specify an `secretKey` and set this to `true`.
44
- *
45
- * Defaults to true.
46
- */
47
- strictAuthentication?: boolean;
48
- /**
49
- * Enable verbose logging for workflow discovery and execution.
50
- * When set to `false`, discovery and execution logs will be suppressed.
51
- * Defaults to `true` in development, `false` in production.
52
- */
53
- verbose?: boolean;
54
- /**
55
- * A custom logger used for all of the framework's internal logging
56
- * (workflow discovery, execution and bridge error reporting).
57
- *
58
- * Defaults to the global `console`. Provide your own logger to route Novu's
59
- * internal logs through your application's structured logger.
60
- *
61
- * Note: `verbose` still controls *whether* discovery and execution logs are
62
- * emitted; `logger` only controls *where* all logs are written. Bridge errors
63
- * (HTTP status >= 500) are always logged via this logger, regardless of
64
- * `verbose`.
65
- */
66
- logger?: Logger;
67
- };
68
-
69
6
  declare enum PostActionEnum {
70
7
  TRIGGER = "trigger",
71
8
  EXECUTE = "execute",
@@ -178,7 +115,8 @@ declare enum WorkflowChannelEnum {
178
115
  PUSH = "push",
179
116
  CHAT = "chat",
180
117
  /** Differs from ChannelTypeEnum in capitalization / snake_case */
181
- IN_APP = "inApp"
118
+ IN_APP = "inApp",
119
+ TOOL = "tool"
182
120
  }
183
121
 
184
122
  type EventPayload = ITriggerPayload;
@@ -223,6 +161,11 @@ type EventTriggerParams<T_Payload = EventPayload> = {
223
161
  * Overrides for trigger
224
162
  */
225
163
  overrides?: Record<string, unknown>;
164
+ /**
165
+ * Override the workflow-assigned agent for this trigger using the public agent identifier.
166
+ * Omit to use the workflow default; pass null to disable agent routing for this execution.
167
+ */
168
+ agentId?: string | null;
226
169
  /**
227
170
  * Controls for the step execution
228
171
  */
@@ -545,6 +488,69 @@ type DiscoverOutput = {
545
488
  agents: Array<DiscoverAgentOutput>;
546
489
  };
547
490
 
491
+ type CodeResult = {
492
+ code: string;
493
+ };
494
+
495
+ /**
496
+ * A minimal logger interface used for all of the framework's internal logging
497
+ * (workflow discovery, execution and bridge error reporting).
498
+ *
499
+ * The methods (`info`/`warn`/`error`) are chosen so that both the global
500
+ * `console` and common structured loggers (pino, winston, ...) satisfy this
501
+ * interface directly, with no adapter. The global `console` is the default;
502
+ * provide your own to route Novu's internal logs wherever the rest of your
503
+ * application logs go.
504
+ */
505
+ type Logger = {
506
+ info: typeof console.info;
507
+ warn: typeof console.warn;
508
+ error: typeof console.error;
509
+ };
510
+ type ClientOptions = {
511
+ /**
512
+ * Use Novu Cloud US (https://api.novu.co) or EU deployment (https://eu.api.novu.co). Defaults to US.
513
+ */
514
+ apiUrl?: string;
515
+ /**
516
+ * Specify your Novu secret key, to secure the Bridge Endpoint, and Novu API communication.
517
+ * Novu communicates securely with your endpoint using a signed HMAC header,
518
+ * ensuring that only trusted requests from Novu are actioned by your Bridge API.
519
+ * The secret key is used to sign the HMAC header.
520
+ */
521
+ secretKey?: string;
522
+ /**
523
+ * Explicitly use HMAC signature verification.
524
+ * Setting this to `false` will enable Novu to communicate with your Bridge API
525
+ * without requiring a valid HMAC signature.
526
+ * This is useful for local development and testing.
527
+ *
528
+ * In production you must specify an `secretKey` and set this to `true`.
529
+ *
530
+ * Defaults to true.
531
+ */
532
+ strictAuthentication?: boolean;
533
+ /**
534
+ * Enable verbose logging for workflow discovery and execution.
535
+ * When set to `false`, discovery and execution logs will be suppressed.
536
+ * Defaults to `true` in development, `false` in production.
537
+ */
538
+ verbose?: boolean;
539
+ /**
540
+ * A custom logger used for all of the framework's internal logging
541
+ * (workflow discovery, execution and bridge error reporting).
542
+ *
543
+ * Defaults to the global `console`. Provide your own logger to route Novu's
544
+ * internal logs through your application's structured logger.
545
+ *
546
+ * Note: `verbose` still controls *whether* discovery and execution logs are
547
+ * emitted; `logger` only controls *where* all logs are written. Bridge errors
548
+ * (HTTP status >= 500) are always logged via this logger, regardless of
549
+ * `verbose`.
550
+ */
551
+ logger?: Logger;
552
+ };
553
+
548
554
  type Event = {
549
555
  payload: Record<string, unknown>;
550
556
  workflowId: string;
@@ -1,10 +1,10 @@
1
- import { i as AgentHandlers, A as Agent } from './agent.types-Dqm2VBTO.cjs';
2
- import { L as Logger, 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-B9FbzRbm.cjs';
1
+ import { k as AgentHandlers, A as Agent, p as AgentNotification } from './agent.types-CQKSD7NC.cjs';
2
+ import { W as Workflow, L as Logger, C as ClientOptions, 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-B6RuXNc8.cjs';
3
3
  import { A as Awaitable } from './util.types-DaFfsxgy.cjs';
4
4
  import 'chat';
5
5
  import { S as Schema, a as FromSchema, F as FromSchemaUnvalidated } from './base.schema.types-BApIn9jr.cjs';
6
6
  import './step-resolver.cjs';
7
- import './subscriber.types-DubxcL8q.cjs';
7
+ import './subscriber.types-_eHz1E0m.cjs';
8
8
 
9
9
  /**
10
10
  * Define a new conversational agent.
@@ -14,6 +14,11 @@ import './subscriber.types-DubxcL8q.cjs';
14
14
  */
15
15
  declare function agent(agentId: string, handlers: AgentHandlers): Agent;
16
16
 
17
+ /**
18
+ * Narrows `notification.payload` to the workflow's schema when `workflowId` matches `workflow.id`.
19
+ */
20
+ declare function isFromWorkflow<T extends Record<string, unknown>>(notification: AgentNotification | null, workflow: Workflow<T>): notification is AgentNotification<T>;
21
+
17
22
  declare class Client {
18
23
  private discoveredWorkflows;
19
24
  private discoverWorkflowPromises;
@@ -64,9 +69,16 @@ declare class Client {
64
69
  private createExecutionPayload;
65
70
  private prettyPrintExecute;
66
71
  private executeProviders;
67
- private previewProvider;
68
- private executeProvider;
72
+ private runProvider;
73
+ private resolveProviderOutput;
69
74
  private executeStep;
75
+ /**
76
+ * Code-first chat steps may return `card` as a `chat` JSX element (e.g. `Card(...)`) or a plain
77
+ * `CardElement`. Normalize it to plain `CardElement` JSON before validation so it matches the
78
+ * chat output schema and can cross the bridge unchanged. Non-chat steps and card-less outputs
79
+ * pass through untouched.
80
+ */
81
+ private normalizeChatCardOutput;
70
82
  private compileControls;
71
83
  /**
72
84
  * Preprocesses standalone translation patterns.
@@ -190,4 +202,4 @@ declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
190
202
  */
191
203
  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>;
192
204
 
193
- export { Client as C, type INovuRequestHandlerOptions as I, NovuRequestHandler as N, type ServeHandlerOptions as S, agent as a, workflow as w };
205
+ export { Client as C, type INovuRequestHandlerOptions as I, NovuRequestHandler as N, type ServeHandlerOptions as S, agent as a, isFromWorkflow as i, workflow as w };