@novu/framework 2.13.1-rc.852194fa77 → 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.
- package/dist/cjs/{agent.types-CQKSD7NC.d.cts → agent.types-crcJBtCy.d.cts} +119 -3
- package/dist/cjs/ai-sdk/index.d.cts +1 -1
- package/dist/cjs/{health-check.types-B6RuXNc8.d.cts → health-check.types-C2XZ-Tpt.d.cts} +2 -2
- package/dist/cjs/{index-phn3kJ9H.d.cts → index-DVSB455a.d.cts} +3 -3
- package/dist/cjs/index.cjs +96 -96
- package/dist/cjs/index.d.cts +4 -4
- package/dist/cjs/internal/index.cjs +36 -36
- package/dist/cjs/internal/index.d.cts +29 -14
- package/dist/cjs/langchain/index.d.cts +1 -1
- package/dist/cjs/servers/express.cjs +97 -97
- package/dist/cjs/servers/express.d.cts +5 -5
- package/dist/cjs/servers/h3.cjs +106 -106
- package/dist/cjs/servers/h3.d.cts +5 -5
- package/dist/cjs/servers/hono.cjs +103 -103
- package/dist/cjs/servers/hono.d.cts +5 -5
- package/dist/cjs/servers/lambda.cjs +97 -97
- package/dist/cjs/servers/lambda.d.cts +5 -5
- package/dist/cjs/servers/nest.cjs +99 -99
- package/dist/cjs/servers/nest.d.cts +7 -7
- package/dist/cjs/servers/next.cjs +116 -116
- package/dist/cjs/servers/next.d.cts +5 -5
- package/dist/cjs/servers/nuxt.cjs +106 -106
- package/dist/cjs/servers/nuxt.d.cts +5 -5
- package/dist/cjs/servers/remix.cjs +110 -110
- package/dist/cjs/servers/remix.d.cts +5 -5
- package/dist/cjs/servers/sveltekit.cjs +110 -110
- package/dist/cjs/servers/sveltekit.d.cts +5 -5
- package/dist/cjs/step-resolver.cjs +1 -1
- package/dist/cjs/step-resolver.d.cts +2 -2
- package/dist/cjs/{subscriber.types-_eHz1E0m.d.cts → subscriber.types-BanvmGul.d.cts} +1 -1
- package/dist/esm/{agent.types-C17NUGxY.d.ts → agent.types-DFLG1_vb.d.ts} +119 -3
- package/dist/esm/ai-sdk/index.d.ts +1 -1
- package/dist/esm/chunk-4ETX7FIT.js +1 -0
- package/dist/esm/{chunk-UXO4RWZV.js → chunk-IREH6K2M.js} +2 -2
- package/dist/esm/{chunk-WJUYDVXH.js → chunk-PBC7WR2R.js} +46 -46
- package/dist/esm/{health-check.types-CL5-B_D4.d.ts → health-check.types-DORn4djx.d.ts} +2 -2
- package/dist/esm/{index-CYtGHJJu.d.ts → index-BvRGmHFw.d.ts} +3 -3
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +1 -1
- package/dist/esm/internal/index.d.ts +20 -5
- package/dist/esm/internal/index.js +1 -1
- package/dist/esm/langchain/index.d.ts +1 -1
- package/dist/esm/servers/express.d.ts +5 -5
- package/dist/esm/servers/express.js +1 -1
- package/dist/esm/servers/h3.d.ts +5 -5
- package/dist/esm/servers/h3.js +1 -1
- package/dist/esm/servers/hono.d.ts +5 -5
- package/dist/esm/servers/hono.js +1 -1
- package/dist/esm/servers/lambda.d.ts +5 -5
- package/dist/esm/servers/lambda.js +1 -1
- package/dist/esm/servers/nest.d.ts +7 -7
- package/dist/esm/servers/nest.js +1 -1
- package/dist/esm/servers/next.d.ts +5 -5
- package/dist/esm/servers/next.js +1 -1
- package/dist/esm/servers/nuxt.d.ts +5 -5
- package/dist/esm/servers/nuxt.js +1 -1
- package/dist/esm/servers/remix.d.ts +5 -5
- package/dist/esm/servers/remix.js +1 -1
- package/dist/esm/servers/sveltekit.d.ts +5 -5
- package/dist/esm/servers/sveltekit.js +1 -1
- package/dist/esm/step-resolver.d.ts +2 -2
- package/dist/esm/step-resolver.js +1 -1
- package/dist/esm/{subscriber.types-D4PvRIKR.d.ts → subscriber.types-Drf26WPA.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/esm/chunk-Q3ALQWIF.js +0 -1
|
@@ -114,7 +114,7 @@ declare enum ChatProviderIdEnum {
|
|
|
114
114
|
Novu = "novu-slack",
|
|
115
115
|
Telegram = "telegram",
|
|
116
116
|
Sendblue = "sendblue",
|
|
117
|
-
|
|
117
|
+
NovuWebChat = "novu-web-chat"
|
|
118
118
|
}
|
|
119
119
|
declare enum PushProviderIdEnum {
|
|
120
120
|
FCM = "fcm",
|
|
@@ -205,6 +205,51 @@ declare enum AgentEventEnum {
|
|
|
205
205
|
ON_RESOLVE = "onResolve",
|
|
206
206
|
ON_REACTION = "onReaction"
|
|
207
207
|
}
|
|
208
|
+
type HumanInteractionKind = 'ask' | 'approve' | 'choose' | 'tell';
|
|
209
|
+
type HumanAskApproveOptions = {
|
|
210
|
+
/** Attribution label shown to the human (e.g. `"deploy-bot"`). */
|
|
211
|
+
from?: string;
|
|
212
|
+
/** Time until the request expires, in seconds (max 72h; default 24h). */
|
|
213
|
+
ttlSeconds?: number;
|
|
214
|
+
/**
|
|
215
|
+
* Novu `subscriberId`(s) allowed to settle this request. First valid answer
|
|
216
|
+
* wins. When omitted, the conversation's first subscriber participant is used.
|
|
217
|
+
* The maximum number of subscribers is 50.
|
|
218
|
+
*/
|
|
219
|
+
to?: string | string[];
|
|
220
|
+
};
|
|
221
|
+
type HumanChooseOptions = HumanAskApproveOptions;
|
|
222
|
+
type HumanTellOptions = {
|
|
223
|
+
/** Attribution label shown to the human (e.g. `"deploy-bot"`). */
|
|
224
|
+
from?: string;
|
|
225
|
+
/**
|
|
226
|
+
* Novu `subscriberId`(s) this notice is addressed to. In-thread delivery
|
|
227
|
+
* still posts one card on the current conversation.
|
|
228
|
+
*/
|
|
229
|
+
to?: string | string[];
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* Outcome of a `ctx.ask` / `ctx.approve` / `ctx.choose` request, attached to
|
|
233
|
+
* the later `onMessage` (ask) or `onAction` (approve / choose) turn.
|
|
234
|
+
*/
|
|
235
|
+
type AgentHumanResponse = {
|
|
236
|
+
/** Client-minted id returned by `ctx.ask` / `ctx.approve` / `ctx.choose`. */
|
|
237
|
+
requestId: string;
|
|
238
|
+
/** Public interaction identifier (`hi_...`). */
|
|
239
|
+
interactionId: string;
|
|
240
|
+
kind: HumanInteractionKind;
|
|
241
|
+
/** Terminal status: `answered` | `approved` | `denied` | `expired` | `canceled` | `delivered`. */
|
|
242
|
+
status: string;
|
|
243
|
+
/** True when the TTL elapsed before a valid answer. Do not treat `text` / `optionId` as a verdict. */
|
|
244
|
+
expired: boolean;
|
|
245
|
+
/** Freeform reply text for `ask`. */
|
|
246
|
+
text?: string;
|
|
247
|
+
/** `approve`: `'approve'` | `'deny'`; `choose`: the picked option id. */
|
|
248
|
+
optionId?: string;
|
|
249
|
+
respondedBy?: string;
|
|
250
|
+
/** Stable Novu subscriberId of whoever settled the interaction. */
|
|
251
|
+
respondedBySubscriberId?: string;
|
|
252
|
+
};
|
|
208
253
|
/** Identity of the user or bot that authored a message. */
|
|
209
254
|
interface AgentMessageAuthor {
|
|
210
255
|
userId: string;
|
|
@@ -553,6 +598,12 @@ interface AgentHandlerContext {
|
|
|
553
598
|
* conversation was not opened from a workflow send.
|
|
554
599
|
*/
|
|
555
600
|
readonly notification: AgentNotification | null;
|
|
601
|
+
/**
|
|
602
|
+
* Settled `ctx.ask` / `ctx.approve` / `ctx.choose` payload when this
|
|
603
|
+
* `onMessage` or `onAction` turn answered (or expired) a human interaction.
|
|
604
|
+
* `null` on ordinary chat and button clicks.
|
|
605
|
+
*/
|
|
606
|
+
readonly humanResponse: AgentHumanResponse | null;
|
|
556
607
|
/**
|
|
557
608
|
* Full conversation history as an ordered array of entries.
|
|
558
609
|
* Map to your LLM's message format before making a model call:
|
|
@@ -633,6 +684,50 @@ interface AgentHandlerContext {
|
|
|
633
684
|
to?: TriggerRecipientsPayload;
|
|
634
685
|
payload?: Record<string, unknown>;
|
|
635
686
|
}): void;
|
|
687
|
+
/**
|
|
688
|
+
* Ask the conversation subscriber a freeform question. Queued and flushed
|
|
689
|
+
* with the next `ctx.reply()`, or automatically when the handler completes.
|
|
690
|
+
* The answer arrives later on `onMessage` with `ctx.humanResponse` set.
|
|
691
|
+
* Pass `to` to let any listed subscriber settle (first valid answer wins).
|
|
692
|
+
*
|
|
693
|
+
* @returns A `requestId` you can match against `ctx.humanResponse.requestId`.
|
|
694
|
+
*
|
|
695
|
+
* @example
|
|
696
|
+
* ctx.ask('What environment should we deploy to?');
|
|
697
|
+
* ctx.ask('Which environment?', { to: 'alice' });
|
|
698
|
+
*/
|
|
699
|
+
ask(question: string, opts?: HumanAskApproveOptions): string;
|
|
700
|
+
/**
|
|
701
|
+
* Ask the conversation subscriber to approve or deny an action.
|
|
702
|
+
* The verdict arrives later on `onAction` with `ctx.humanResponse` set.
|
|
703
|
+
* Pass `to` to let any listed subscriber settle (first valid answer wins).
|
|
704
|
+
*
|
|
705
|
+
* @returns A `requestId` you can match against `ctx.humanResponse.requestId`.
|
|
706
|
+
*
|
|
707
|
+
* @example
|
|
708
|
+
* ctx.approve('Deploy v2.4.1 to production?');
|
|
709
|
+
* ctx.approve('Deploy v2.4.1?', { to: ['alice', 'bob'] });
|
|
710
|
+
*/
|
|
711
|
+
approve(action: string, opts?: HumanAskApproveOptions): string;
|
|
712
|
+
/**
|
|
713
|
+
* Ask the conversation subscriber to pick one of several options (2–10).
|
|
714
|
+
* The pick arrives later on `onAction` with `ctx.humanResponse` set.
|
|
715
|
+
* Pass `to` to let any listed subscriber settle (first valid answer wins).
|
|
716
|
+
*
|
|
717
|
+
* @returns A `requestId` you can match against `ctx.humanResponse.requestId`.
|
|
718
|
+
*
|
|
719
|
+
* @example
|
|
720
|
+
* ctx.choose('Which region?', ['us-east', 'eu-west', 'ap-south']);
|
|
721
|
+
*/
|
|
722
|
+
choose(question: string, options: string[], opts?: HumanChooseOptions): string;
|
|
723
|
+
/**
|
|
724
|
+
* Send a one-way notification to the conversation subscriber. Nothing to wait
|
|
725
|
+
* on — `tell` never sets `ctx.humanResponse`.
|
|
726
|
+
*
|
|
727
|
+
* @example
|
|
728
|
+
* ctx.tell('Deploy finished. v2.4.1 is live.');
|
|
729
|
+
*/
|
|
730
|
+
tell(message: string, opts?: HumanTellOptions): string;
|
|
636
731
|
/**
|
|
637
732
|
* Add an emoji reaction to any platform message.
|
|
638
733
|
* Reactions are queued and sent with the next `ctx.reply()`, or flushed automatically
|
|
@@ -809,6 +904,12 @@ interface AgentBridgeRequest {
|
|
|
809
904
|
* absent → `ctx.notification` is `null`.
|
|
810
905
|
*/
|
|
811
906
|
notification?: AgentNotification | null;
|
|
907
|
+
/**
|
|
908
|
+
* Settled human-interaction payload when this `onMessage` / `onAction` turn
|
|
909
|
+
* answered or expired a `ctx.ask` / `ctx.approve` / `ctx.choose`. Optional on
|
|
910
|
+
* the wire for backward compatibility; absent → `ctx.humanResponse` is `null`.
|
|
911
|
+
*/
|
|
912
|
+
humanResponse?: AgentHumanResponse | null;
|
|
812
913
|
history: AgentHistoryEntry[];
|
|
813
914
|
platform: string;
|
|
814
915
|
platformContext: AgentPlatformContext;
|
|
@@ -841,7 +942,22 @@ type TriggerSignal = {
|
|
|
841
942
|
to?: TriggerRecipientsPayload;
|
|
842
943
|
payload?: Record<string, unknown>;
|
|
843
944
|
};
|
|
844
|
-
|
|
945
|
+
/**
|
|
946
|
+
* Queued by `ctx.ask` / `ctx.approve` / `ctx.choose` / `ctx.tell` — instructs
|
|
947
|
+
* Novu to create a human interaction in the current conversation thread.
|
|
948
|
+
*/
|
|
949
|
+
type HumanSignal = {
|
|
950
|
+
type: 'human';
|
|
951
|
+
kind: HumanInteractionKind;
|
|
952
|
+
prompt: string;
|
|
953
|
+
requestId: string;
|
|
954
|
+
options?: string[];
|
|
955
|
+
from?: string;
|
|
956
|
+
ttlSeconds?: number;
|
|
957
|
+
/** Novu subscriberId(s) allowed to settle. Omitted = conversation subscriber. */
|
|
958
|
+
to?: string | string[];
|
|
959
|
+
};
|
|
960
|
+
type Signal = MetadataSignal | TriggerSignal | HumanSignal;
|
|
845
961
|
/** The outcome of a tool call, reported back so it's saved in the conversation history. */
|
|
846
962
|
type ToolResult = {
|
|
847
963
|
/** Id of the tool call this result belongs to. */
|
|
@@ -904,4 +1020,4 @@ interface SentMessageInfo {
|
|
|
904
1020
|
platformThreadId: string;
|
|
905
1021
|
}
|
|
906
1022
|
|
|
907
|
-
export {
|
|
1023
|
+
export { type AgentReplyPayload as $, type Agent as A, type HumanTellOptions as B, type ToolApprovalConfig as C, type ToolApprovalDecision as D, toAgentError as E, type FileRef as F, type TriggerRecipientsPayload as G, type HumanAskApproveOptions as H, type ITriggerPayload as I, type ISubscriberPayload as J, TriggerEventStatusEnum as K, type ToolResult as L, type MessageContent as M, type ToolApprovalRequestPayload as N, AgentEventEnum as O, type TypingControl as P, type ToolApprovalControl as Q, type ReplyHandle as R, type AgentBridgeRequest as S, type ToolApprovalCard as T, type ReplyContent as U, type Signal as V, type WorkflowPreferencesPartial as W, type AddReactionPayload as X, type DeleteMessagePayload as Y, type SentMessageInfo as Z, type TypingOp as _, type AgentAction as a, type EditPayload as a0, type HumanSignal as a1, type MetadataSignal as a2, type ParsedApprovalAction as a3, type TriggerSignal as a4, buildApprovalActionId as a5, parseApprovalActionId as a6, type AgentActionContext as b, type AgentAttachment as c, type AgentContext as d, type AgentContextPayload as e, type AgentContextValue as f, type AgentConversation as g, AgentDeliveryError as h, AgentError as i, type AgentHandlerContext as j, type AgentHandlers as k, type AgentHistoryEntry as l, type AgentHumanResponse as m, type AgentMessage as n, type AgentMessageAuthor as o, type AgentMessageContext as p, type AgentNotification as q, type AgentPlatformContext as r, type AgentReaction as s, type AgentReactionContext as t, type AgentResolveContext as u, type AgentSubscriber as v, type AgentSubscriberAccess as w, type AgentToolCall as x, type HumanChooseOptions as y, type HumanInteractionKind as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { k as AgentHandlers,
|
|
1
|
+
import { k as AgentHandlers, n as AgentMessage, p as AgentMessageContext, M as MessageContent, D as ToolApprovalDecision, b as AgentActionContext, R as ReplyHandle, A as Agent, l as AgentHistoryEntry, j as AgentHandlerContext } from '../agent.types-crcJBtCy.cjs';
|
|
2
2
|
import { streamText, generateText, ModelMessage } from 'ai';
|
|
3
3
|
import { A as Awaitable } from '../util.types-DaFfsxgy.cjs';
|
|
4
4
|
import 'chat';
|
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
2
|
-
import { I as ITriggerPayload,
|
|
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
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { k as AgentHandlers, A as Agent,
|
|
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-
|
|
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-
|
|
7
|
+
import './subscriber.types-BanvmGul.cjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Define a new conversational agent.
|