@novu/framework 2.13.1-rc.72c80d5b17 → 2.13.1

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 (79) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/{agent.types-B5VnP69G.d.cts → agent.types-crcJBtCy.d.cts} +154 -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-CtWQ_YSy.d.cts → health-check.types-C2XZ-Tpt.d.cts} +70 -65
  8. package/dist/cjs/{index-vgb88C84.d.cts → index-DVSB455a.d.cts} +18 -6
  9. package/dist/cjs/index.cjs +111 -111
  10. package/dist/cjs/index.d.cts +5 -5
  11. package/dist/cjs/internal/index.cjs +42 -39
  12. package/dist/cjs/internal/index.d.cts +324 -27
  13. package/dist/cjs/langchain/index.cjs +4 -1
  14. package/dist/cjs/langchain/index.d.cts +24 -6
  15. package/dist/cjs/servers/express.cjs +109 -109
  16. package/dist/cjs/servers/express.d.cts +6 -6
  17. package/dist/cjs/servers/h3.cjs +110 -110
  18. package/dist/cjs/servers/h3.d.cts +6 -6
  19. package/dist/cjs/servers/hono.cjs +109 -109
  20. package/dist/cjs/servers/hono.d.cts +6 -6
  21. package/dist/cjs/servers/lambda.cjs +109 -109
  22. package/dist/cjs/servers/lambda.d.cts +6 -6
  23. package/dist/cjs/servers/nest.cjs +120 -120
  24. package/dist/cjs/servers/nest.d.cts +8 -8
  25. package/dist/cjs/servers/next.cjs +109 -109
  26. package/dist/cjs/servers/next.d.cts +6 -6
  27. package/dist/cjs/servers/nuxt.cjs +110 -110
  28. package/dist/cjs/servers/nuxt.d.cts +6 -6
  29. package/dist/cjs/servers/remix.cjs +109 -109
  30. package/dist/cjs/servers/remix.d.cts +6 -6
  31. package/dist/cjs/servers/sveltekit.cjs +109 -109
  32. package/dist/cjs/servers/sveltekit.d.cts +6 -6
  33. package/dist/cjs/step-resolver.cjs +4 -4
  34. package/dist/cjs/step-resolver.d.cts +3 -2
  35. package/dist/cjs/{subscriber.types-CyNKT0nZ.d.cts → subscriber.types-BanvmGul.d.cts} +680 -27
  36. package/dist/esm/{agent.types-HUDhyXrV.d.ts → agent.types-DFLG1_vb.d.ts} +154 -3
  37. package/dist/esm/ai-sdk/index.d.ts +16 -5
  38. package/dist/esm/ai-sdk/index.js +1 -1
  39. package/dist/esm/cards.d.ts +1 -1
  40. package/dist/esm/cards.js +1 -1
  41. package/dist/esm/chunk-4ETX7FIT.js +1 -0
  42. package/dist/esm/{chunk-SPS3KBKF.js → chunk-IREH6K2M.js} +4 -4
  43. package/dist/esm/chunk-PBC7WR2R.js +98 -0
  44. package/dist/esm/chunk-PU74XQ2P.js +1 -0
  45. package/dist/esm/chunk-QZ6TSYCK.js +4 -0
  46. package/dist/esm/chunk-YZ3P3MMZ.js +1 -0
  47. package/dist/esm/{health-check.types-0Rv-l8yD.d.ts → health-check.types-DORn4djx.d.ts} +70 -65
  48. package/dist/esm/{index-C0oUWDlb.d.ts → index-BvRGmHFw.d.ts} +18 -6
  49. package/dist/esm/index.d.ts +5 -5
  50. package/dist/esm/index.js +1 -1
  51. package/dist/esm/internal/index.d.ts +317 -20
  52. package/dist/esm/internal/index.js +1 -1
  53. package/dist/esm/langchain/index.d.ts +24 -6
  54. package/dist/esm/langchain/index.js +1 -1
  55. package/dist/esm/servers/express.d.ts +6 -6
  56. package/dist/esm/servers/express.js +1 -1
  57. package/dist/esm/servers/h3.d.ts +6 -6
  58. package/dist/esm/servers/h3.js +1 -1
  59. package/dist/esm/servers/hono.d.ts +6 -6
  60. package/dist/esm/servers/hono.js +1 -1
  61. package/dist/esm/servers/lambda.d.ts +6 -6
  62. package/dist/esm/servers/lambda.js +1 -1
  63. package/dist/esm/servers/nest.d.ts +8 -8
  64. package/dist/esm/servers/nest.js +1 -1
  65. package/dist/esm/servers/next.d.ts +6 -6
  66. package/dist/esm/servers/next.js +1 -1
  67. package/dist/esm/servers/nuxt.d.ts +6 -6
  68. package/dist/esm/servers/nuxt.js +1 -1
  69. package/dist/esm/servers/remix.d.ts +6 -6
  70. package/dist/esm/servers/remix.js +1 -1
  71. package/dist/esm/servers/sveltekit.d.ts +6 -6
  72. package/dist/esm/servers/sveltekit.js +1 -1
  73. package/dist/esm/step-resolver.d.ts +3 -2
  74. package/dist/esm/step-resolver.js +1 -1
  75. package/dist/esm/{subscriber.types-g7VnI_ZQ.d.ts → subscriber.types-Drf26WPA.d.ts} +680 -27
  76. package/package.json +3 -2
  77. package/dist/esm/chunk-CGZ5P44A.js +0 -98
  78. package/dist/esm/chunk-FMKD6TON.js +0 -1
  79. package/dist/esm/chunk-W6DIBD4Z.js +0 -1
@@ -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-CyNKT0nZ.cjs';
2
- import { I as ITriggerPayload, z as TriggerRecipientsPayload, B as ISubscriberPayload, C as TriggerEventStatusEnum, W as WorkflowPreferencesPartial } from './agent.types-B5VnP69G.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-BanvmGul.cjs';
2
+ import { I as ITriggerPayload, G as TriggerRecipientsPayload, J as ISubscriberPayload, K as TriggerEventStatusEnum, W as WorkflowPreferencesPartial } from './agent.types-crcJBtCy.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",
@@ -224,6 +161,11 @@ type EventTriggerParams<T_Payload = EventPayload> = {
224
161
  * Overrides for trigger
225
162
  */
226
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;
227
169
  /**
228
170
  * Controls for the step execution
229
171
  */
@@ -546,6 +488,69 @@ type DiscoverOutput = {
546
488
  agents: Array<DiscoverAgentOutput>;
547
489
  };
548
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
+
549
554
  type Event = {
550
555
  payload: Record<string, unknown>;
551
556
  workflowId: string;
@@ -1,10 +1,10 @@
1
- import { k as AgentHandlers, A as Agent } from './agent.types-B5VnP69G.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-CtWQ_YSy.cjs';
1
+ import { k as AgentHandlers, A as Agent, q as AgentNotification } from './agent.types-crcJBtCy.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-C2XZ-Tpt.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-CyNKT0nZ.cjs';
7
+ import './subscriber.types-BanvmGul.cjs';
8
8
 
9
9
  /**
10
10
  * Define a new conversational agent.
@@ -14,6 +14,11 @@ import './subscriber.types-CyNKT0nZ.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 };