@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.
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 +29 -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-UXO4RWZV.js → chunk-IREH6K2M.js} +2 -2
  35. package/dist/esm/{chunk-WJUYDVXH.js → chunk-PBC7WR2R.js} +46 -46
  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 +20 -5
  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 +1 -1
  65. package/dist/esm/chunk-Q3ALQWIF.js +0 -1
@@ -1,11 +1,11 @@
1
1
  import { RequestEvent } from '@sveltejs/kit';
2
- import { S as ServeHandlerOptions } from '../index-phn3kJ9H.cjs';
3
- export { C as Client, N as NovuRequestHandler, a as agent, i as isFromWorkflow, w as workflow } from '../index-phn3kJ9H.cjs';
4
- export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-B6RuXNc8.cjs';
5
- export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from '../subscriber.types-_eHz1E0m.cjs';
2
+ import { S as ServeHandlerOptions } from '../index-DVSB455a.cjs';
3
+ export { C as Client, N as NovuRequestHandler, a as agent, i as isFromWorkflow, w as workflow } from '../index-DVSB455a.cjs';
4
+ export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-C2XZ-Tpt.cjs';
5
+ export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from '../subscriber.types-BanvmGul.cjs';
6
6
  import { S as SupportedFrameworkName } from '../server.types-Cc6o5eYH.cjs';
7
7
  export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Image, ImageElement, Select, SelectOption, TextInput } from 'chat';
8
- export { A as Agent, a as AgentAction, b as AgentActionContext, c as AgentAttachment, d as AgentContext, e as AgentContextPayload, f as AgentContextValue, g as AgentConversation, h as AgentDeliveryError, i as AgentError, j as AgentHandlerContext, k as AgentHandlers, l as AgentHistoryEntry, m as AgentMessage, n as AgentMessageAuthor, o as AgentMessageContext, p as AgentNotification, q as AgentPlatformContext, r as AgentReaction, s as AgentReactionContext, t as AgentResolveContext, u as AgentSubscriber, v as AgentSubscriberAccess, w as AgentToolCall, F as FileRef, M as MessageContent, R as ReplyHandle, T as ToolApprovalCard, x as ToolApprovalConfig, y as ToolApprovalDecision, z as toAgentError } from '../agent.types-CQKSD7NC.cjs';
8
+ export { A as Agent, a as AgentAction, b as AgentActionContext, c as AgentAttachment, d as AgentContext, e as AgentContextPayload, f as AgentContextValue, g as AgentConversation, h as AgentDeliveryError, i as AgentError, j as AgentHandlerContext, k as AgentHandlers, l as AgentHistoryEntry, m as AgentHumanResponse, n as AgentMessage, o as AgentMessageAuthor, p as AgentMessageContext, q as AgentNotification, r as AgentPlatformContext, s as AgentReaction, t as AgentReactionContext, u as AgentResolveContext, v as AgentSubscriber, w as AgentSubscriberAccess, x as AgentToolCall, F as FileRef, H as HumanAskApproveOptions, y as HumanChooseOptions, z as HumanInteractionKind, B as HumanTellOptions, M as MessageContent, R as ReplyHandle, T as ToolApprovalCard, C as ToolApprovalConfig, D as ToolApprovalDecision, E as toAgentError } from '../agent.types-crcJBtCy.cjs';
9
9
  export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, ToolStepResolver, step } from '../step-resolver.cjs';
10
10
  import '../util.types-DaFfsxgy.cjs';
11
11
  import '../base.schema.types-BApIn9jr.cjs';
@@ -1,4 +1,4 @@
1
- "use strict";var l=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var Y=(n,i)=>{for(var e in i)l(n,e,{get:i[e],enumerable:!0})},$=(n,i,e,d)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of K(i))!V.call(n,o)&&o!==e&&l(n,o,{get:()=>i[o],enumerable:!(d=X(i,o))||d.enumerable});return n};var Q=n=>$(l({},"__esModule",{value:!0}),n);var at={};Y(at,{actionStepSchemas:()=>M,channelStepSchemas:()=>G,providerSchemas:()=>I,step:()=>c});module.exports=Q(at);function Z(n,i,e){return{type:"email",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function ee(n,i,e){return{type:"sms",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function te(n,i,e){return{type:"chat",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function ie(n,i,e){return{type:"push",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function ne(n,i,e){return{type:"in_app",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function se(n,i,e){return{type:"tool",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function ae(n,i,e){return{type:"delay",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip}}function oe(n,i,e){return{type:"digest",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip}}function re(n,i,e){return{type:"throttle",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip}}var c={email:Z,sms:ee,chat:te,push:ie,inApp:ne,tool:se,delay:ae,digest:oe,throttle:re};var t={output:{type:"object",properties:{},required:[],additionalProperties:!0}};var le={type:"object",properties:{webhookUrl:{type:"string",format:"uri"},text:{type:"string"},blocks:{type:"array",items:{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!0}}},additionalProperties:!0},p={output:le};var m={"chat-webhook":t,discord:t,getstream:t,"grafana-on-call":t,line:t,mattermost:t,msteams:t,"novu-slack":t,"novu-agent-chat":t,"rocket-chat":t,ryver:t,sendblue:t,slack:p,"webex-messaging":t,"whatsapp-business":t,zulip:t,telegram:t};var de={type:"object",properties:{to:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:'Email address of the recipient(s). Example: "Bob bob@host.com". You can use commas to separate multiple recipients (e.g.: "test@example.com,test@example.com" or ["test@example.com", "test@example.com"]).'},from:{type:"string"},subject:{type:"string",description:"Subject of the message."},text:{type:"string",description:"Text version of the message."},html:{type:"string",description:"HTML version of the message."},message:{type:"string",description:"MIME string of the message. Make sure to use multipart/form-data to send this as a file upload."},cc:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"Same as To but for carbon copy"},bcc:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"Same as To but for blind carbon copy"},ampHtml:{type:"string"},tVersion:{type:"string"},tText:{anyOf:[{type:"string",enum:["yes","no"]},{type:"boolean"}]},oTag:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"Tag string. See Tagging for more information."},oDkim:{anyOf:[{type:"string",enum:["yes","no"]},{type:"boolean"}],description:"Enables/disabled DKIM signatures on per-message basis. Pass yes or no"},oDeliverytime:{type:"string",description:"Desired time of delivery. See Date Format. Note: Messages can be scheduled for a maximum of 3 days in the future."},oDeliverytimeOptimizePeriod:{type:"string"},oTimeZoneLocalize:{type:"string"},oTestmode:{anyOf:[{type:"string",enum:["yes","no"]},{type:"boolean"}],description:"Enables sending in test mode. Pass yes if needed. See Sending in Test Mode"},oTracking:{anyOf:[{type:"string",enum:["yes","no"]},{type:"boolean"}],description:"Toggles tracking on a per-message basis, see Tracking Messages for details. Pass yes or no."},oTrackingClicks:{anyOf:[{type:"string",enum:["yes","no","htmlonly"]},{type:"boolean"}],description:"Toggles clicks tracking on a per-message basis. Has higher priority than domain-level setting. Pass yes, no or htmlonly."},oTrackingOpens:{anyOf:[{type:"string",enum:["yes","no"]},{type:"boolean"}],description:"Toggles opens tracking on a per-message basis. Has higher priority than domain-level setting. Pass yes or no."},oRequireTls:{anyOf:[{type:"string",enum:["yes","no"]},{type:"boolean"}]},oSkipVerification:{anyOf:[{type:"string",enum:["yes","no"]},{type:"boolean"}]},recipientVariables:{type:"string"}},required:[],additionalProperties:!0},h={output:de};var a={type:"object",properties:{name:{type:"string"},email:{type:"string"}},description:'JSON object, containing 2 properties: Name and Email address of a previously validated and active sender. Including the Name property in the JSON is optional. This property is not mandatory in case you use TemplateID and you specified a From address for the template. Format : { "Email":"value", "Name":"value" }.',required:["Email"],additionalProperties:!0},ce={type:"object",properties:{contentType:{type:"string"},filename:{type:"string"},base64Content:{type:"string"}},required:["ContentType","Filename","Base64Content"],additionalProperties:!0},pe={type:"object",properties:{filename:{type:"string"},contentType:{type:"string"},contentId:{type:"string"},base64Content:{type:"string"}},required:["ContentType","Filename","Base64Content"],additionalProperties:!0},me={type:"object",properties:{from:a,sender:a,to:{type:"array",items:a},cc:{type:"array",items:a},bcc:{type:"array",items:a},replyTo:a,subject:{type:"string"},textPart:{type:"string",description:"Content of the message, sent in Text and/or HTML format. At least one of these content types needs to be specified. When the HTML part is the only part provided, Mailjet will not generate a Text-part from the HTML version. The property can't be set when you use TemplateID"},htmlPart:{type:"string",description:"Content of the message, sent in Text and/or HTML format. At least one of these content types needs to be specified. When the HTML part is the only part provided, Mailjet will not generate a Text-part from the HTML version. The property can't be set when you use TemplateID"},templateId:{type:"number",description:"an ID for a template that is previously created and stored in Mailjet's system. It is mandatory when From and TextPart and/or HtmlPart are not provided. "},templateLanguage:{type:"boolean"},templateErrorReporting:a,templateErrorDeliver:{type:"boolean"},attachments:{type:"array",items:ce},inlineAttachments:{type:"array",items:pe},priority:{type:"number"},customCampaign:{type:"string"},deduplicateCampaign:{type:"boolean"},trackOpens:{type:"string",enum:["account_default","disabled","enabled"]},trackClicks:{type:"string",enum:["account_default","disabled","enabled"]},customId:{type:"string"},eventPayload:{type:"string"},urlTags:{type:"string"},headers:{type:"object",additionalProperties:!0},variables:{type:"object",additionalProperties:!0}},required:[],additionalProperties:!0},u={output:me};var s={type:"object",properties:{address:{type:"string"},name:{type:"string"}},additionalProperties:!0},r={type:"object",properties:{content:{type:"string"},path:{type:"string"}},additionalProperties:!0},he={type:"object",properties:{from:{anyOf:[{type:"string"},s]},sender:{anyOf:[{type:"string"},s]},to:{anyOf:[{type:"string"},s,{type:"array",items:s}]},cc:{anyOf:[{type:"string"},s,{type:"array",items:s}]},bcc:{anyOf:[{type:"string"},s,{type:"array",items:s}]},replyTo:{anyOf:[{type:"string"},s,{type:"array",items:s}]},inReplyTo:{anyOf:[{type:"string"},s]},references:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},subject:{type:"string"},text:{anyOf:[{type:"string"},r]},html:{anyOf:[{type:"string"},r]},watchHtml:{anyOf:[{type:"string"},r]},amp:{anyOf:[{type:"string"},{type:"object",properties:{content:{type:"string"},path:{type:"string"},href:{type:"string"},encoding:{type:"string"},contentType:{type:"string"},raw:{anyOf:[{type:"string"},r]}}}]},icalEvent:{anyOf:[{type:"string"},{type:"object",properties:{content:{type:"string"},path:{type:"string"},method:{type:"string"},filename:{anyOf:[{type:"string"},{type:"boolean"}]},href:{type:"string"},encoding:{type:"string"}}}]},headers:{anyOf:[{type:"object",additionalProperties:!0},{type:"array",items:{type:"object",additionalProperties:!0}}]},list:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},attachments:{type:"array",items:{type:"object",properties:{content:{type:"string"},path:{type:"string"}},additionalProperties:!0}}},required:[],additionalProperties:!0},y={output:he};var ue={type:"object",properties:{},required:[],additionalProperties:!1},f={output:ue};var ye={type:"object",properties:{personalizations:{type:"array",description:"An array of messages and their metadata. Each object within personalizations can be thought of as an envelope - it defines who should receive an individual message and how that message should be handled. See our [Personalizations documentation](https://sendgrid.com/docs/for-developers/sending-email/personalizations/) for examples.",uniqueItems:!1,maxItems:1e3,items:{type:"object",properties:{from:{title:"From Email Object",type:"object",properties:{email:{type:"string",format:"email",description:"The 'From' email address used to deliver the message. This address should be a verified sender in your Twilio SendGrid account."},name:{type:"string",description:"A name or title associated with the sending email address."}},required:["email"]},to:{title:"To Email Array",type:"array",items:{type:"object",properties:{email:{type:"string",format:"email",description:"The intended recipient's email address."},name:{type:"string",description:"The intended recipient's name."}},required:["email"]}},cc:{type:"array",description:"An array of recipients who will receive a copy of your email. Each object in this array must contain the recipient's email address. Each object in the array may optionally contain the recipient's name.",maxItems:1e3,items:{title:"CC BCC Email Object",type:"object",properties:{email:{type:"string",format:"email",description:"The intended recipient's email address."},name:{type:"string",description:"The intended recipient's name."}},required:["email"]}},bcc:{type:"array",description:"An array of recipients who will receive a blind carbon copy of your email. Each object in this array must contain the recipient's email address. Each object in the array may optionally contain the recipient's name.",maxItems:1e3,items:{title:"CC BCC Email Object",type:"object",properties:{email:{type:"string",format:"email",description:"The intended recipient's email address."},name:{type:"string",description:"The intended recipient's name."}},required:["email"]}},subject:{type:"string",description:"The subject of your email. See character length requirements according to [RFC 2822](http://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit#answer-1592310).",minLength:1},headers:{type:"object",description:"A collection of JSON key/value pairs allowing you to specify handling instructions for your email. You may not overwrite the following headers: `x-sg-id`, `x-sg-eid`, `received`, `dkim-signature`, `Content-Type`, `Content-Transfer-Encoding`, `To`, `From`, `Subject`, `Reply-To`, `CC`, `BCC`"},substitutions:{type:"object",description:'Substitutions allow you to insert data without using Dynamic Transactional Templates. This field should **not** be used in combination with a Dynamic Transactional Template, which can be identified by a `templateId` starting with `d-`. This field is a collection of key/value pairs following the pattern "substitutionTag":"value to substitute". The key/value pairs must be strings. These substitutions will apply to the text and html content of the body of your email, in addition to the `subject` and `reply-to` parameters. The total collective size of your substitutions may not exceed 10,000 bytes per personalization object.',maxProperties:1e4},dynamicTemplateData:{type:"object",description:'Dynamic template data is available using Handlebars syntax in Dynamic Transactional Templates. This field should be used in combination with a Dynamic Transactional Template, which can be identified by a `templateId` starting with `d-`. This field is a collection of key/value pairs following the pattern "variable_name":"value to insert".'},customArgs:{type:"object",description:"Values that are specific to this personalization that will be carried along with the email and its activity data. Substitutions will not be made on custom arguments, so any string that is entered into this parameter will be assumed to be the custom argument that you would like to be used. This field may not exceed 10,000 bytes.",maxProperties:1e4},sendAt:{type:"integer",description:"A unix timestamp allowing you to specify when your email should be delivered. Scheduling delivery more than 72 hours in advance is forbidden."}},required:["to"]}},from:{title:"From Email Object",type:"object",properties:{email:{type:"string",format:"email",description:"The 'From' email address used to deliver the message. This address should be a verified sender in your Twilio SendGrid account."},name:{type:"string",description:"A name or title associated with the sending email address."}},required:["email"]},replyTo:{title:"Reply_to Email Object",type:"object",properties:{email:{type:"string",format:"email",description:"The email address where any replies or bounces will be returned."},name:{type:"string",description:"A name or title associated with the `replyTo` email address."}},required:["email"]},replyToList:{type:"array",description:"An array of recipients who will receive replies and/or bounces. Each object in this array must contain the recipient's email address. Each object in the array may optionally contain the recipient's name. You can either choose to use \u201CreplyTo\u201D field or \u201CreplyToList\u201D but not both.",uniqueItems:!0,maxItems:1e3,items:{type:"object",properties:{email:{type:"string",description:"The email address where any replies or bounces will be returned.",format:"email"},name:{type:"string",description:"A name or title associated with the `replyToList` email address."}},required:["email"]}},subject:{type:"string",description:"The global or 'message level' subject of your email. This may be overridden by subject lines set in personalizations.",minLength:1},content:{type:"array",description:"An array where you can specify the content of your email. You can include multiple [MIME types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of content, but you must specify at least one MIME type. To include more than one MIME type, add another object to the array containing the `type` and `value` parameters.",items:{type:"object",properties:{type:{type:"string",description:"The MIME type of the content you are including in your email (e.g., `\u201Ctext/plain\u201D` or `\u201Ctext/html\u201D`).",minLength:1},value:{type:"string",description:"The actual content of the specified MIME type that you are including in your email.",minLength:1}},required:["type","value"]}},attachments:{type:"array",description:"An array of objects where you can specify any attachments you want to include.",items:{type:"object",properties:{content:{type:"string",description:"The Base64 encoded content of the attachment.",minLength:1},type:{type:"string",description:"The MIME type of the content you are attaching (e.g., `\u201Ctext/plain\u201D` or `\u201Ctext/html\u201D`).",minLength:1},filename:{type:"string",description:"The attachment's filename."},disposition:{type:"string",default:"attachment",description:"The attachment's content-disposition, specifying how you would like the attachment to be displayed. For example, `\u201Cinline\u201D` results in the attached file are displayed automatically within the message while `\u201Cattachment\u201D` results in the attached file require some action to be taken before it is displayed, such as opening or downloading the file.",enum:["inline","attachment"]},contentId:{type:"string",description:"The attachment's content ID. This is used when the disposition is set to `\u201Cinline\u201D` and the attachment is an image, allowing the file to be displayed within the body of your email."}},required:["content","filename"]}},templateId:{type:"string",description:"An email template ID. A template that contains a subject and content \u2014 either text or html \u2014 will override any subject and content values specified at the personalizations or message level."},headers:{description:"An object containing key/value pairs of header names and the value to substitute for them. The key/value pairs must be strings. You must ensure these are properly encoded if they contain unicode characters. These headers cannot be one of the reserved headers.",type:"object"},categories:{type:"array",description:"An array of category names for this message. Each category name may not exceed 255 characters. ",uniqueItems:!0,maxItems:10,items:{type:"string",maxLength:255}},customArgs:{description:"Values that are specific to the entire send that will be carried along with the email and its activity data. Key/value pairs must be strings. Substitutions will not be made on custom arguments, so any string that is entered into this parameter will be assumed to be the custom argument that you would like to be used. This parameter is overridden by `customArgs` set at the personalizations level. Total `customArgs` size may not exceed 10,000 bytes.",type:"string"},sendAt:{type:"integer",description:"A unix timestamp allowing you to specify when you want your email to be delivered. This may be overridden by the `sendAt` parameter set at the personalizations level. Delivery cannot be scheduled more than 72 hours in advance. If you have the flexibility, it's better to schedule mail for off-peak times. Most emails are scheduled and sent at the top of the hour or half hour. Scheduling email to avoid peak times \u2014 for example, scheduling at 10:53 \u2014 can result in lower deferral rates due to the reduced traffic during off-peak times."},batchId:{type:"string",description:"An ID representing a batch of emails to be sent at the same time. Including a `batchId` in your request allows you include this email in that batch. It also enables you to cancel or pause the delivery of that batch. For more information, see the [Cancel Scheduled Sends API](https://sendgrid.com/docs/api-reference/)."},asm:{type:"object",description:"An object allowing you to specify how to handle unsubscribes.",properties:{groupId:{type:"integer",description:"The unsubscribe group to associate with this email."},groupsToDisplay:{type:"array",description:"An array containing the unsubscribe groups that you would like to be displayed on the unsubscribe preferences page.",maxItems:25,items:{type:"integer"}}},required:["groupId"]},ipPoolName:{type:"string",description:"The IP Pool that you would like to send this email from.",minLength:2,maxLength:64},mailSettings:{type:"object",description:"A collection of different mail settings that you can use to specify how you would like this email to be handled.",properties:{bypassListManagement:{type:"object",description:"Allows you to bypass all unsubscribe groups and suppressions to ensure that the email is delivered to every single recipient. This should only be used in emergencies when it is absolutely necessary that every recipient receives your email. This filter cannot be combined with any other bypass filters. See our [documentation](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) for more about bypass filters.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."}}},bypassSpamManagement:{type:"object",description:"Allows you to bypass the spam report list to ensure that the email is delivered to recipients. Bounce and unsubscribe lists will still be checked; addresses on these other lists will not receive the message. This filter cannot be combined with the `bypassListManagement` filter. See our [documentation](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) for more about bypass filters.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."}}},bypassBounceManagement:{type:"object",description:"Allows you to bypass the bounce list to ensure that the email is delivered to recipients. Spam report and unsubscribe lists will still be checked; addresses on these other lists will not receive the message. This filter cannot be combined with the `bypassListManagement` filter. See our [documentation](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) for more about bypass filters.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."}}},bypassUnsubscribeManagement:{type:"object",description:"Allows you to bypass the global unsubscribe list to ensure that the email is delivered to recipients. Bounce and spam report lists will still be checked; addresses on these other lists will not receive the message. This filter applies only to global unsubscribes and will not bypass group unsubscribes. This filter cannot be combined with the `bypassListManagement` filter. See our [documentation](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) for more about bypass filters.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."}}},footer:{type:"object",description:"The default footer that you would like included on every email.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."},text:{type:"string",description:"The plain text content of your footer."},html:{type:"string",description:"The HTML content of your footer."}}},sandboxMode:{type:"object",description:"Sandbox Mode allows you to send a test email to ensure that your request body is valid and formatted correctly.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."}}}}},trackingSettings:{type:"object",description:"Settings to determine how you would like to track the metrics of how your recipients interact with your email.",properties:{clickTracking:{type:"object",description:"Allows you to track if a recipient clicked a link in your email.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."},enableText:{type:"boolean",description:"Indicates if this setting should be included in the `text/plain` portion of your email."}}},openTracking:{type:"object",description:"Allows you to track if the email was opened by including a single pixel image in the body of the content. When the pixel is loaded, Twilio SendGrid can log that the email was opened.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."},substitutionTag:{type:"string",description:"Allows you to specify a substitution tag that you can insert in the body of your email at a location that you desire. This tag will be replaced by the open tracking pixel."}}},subscriptionTracking:{type:"object",description:"Allows you to insert a subscription management link at the bottom of the text and HTML bodies of your email. If you would like to specify the location of the link within your email, you may use the `substitutionTag`.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."},text:{type:"string",description:"Text to be appended to the email with the subscription tracking link. You may control where the link is by using the tag <% %>"},html:{type:"string",description:"HTML to be appended to the email with the subscription tracking link. You may control where the link is by using the tag <% %>"},substitutionTag:{type:"string",description:"A tag that will be replaced with the unsubscribe URL. for example: `[unsubscribe_url]`. If this parameter is used, it will override both the `text` and `html` parameters. The URL of the link will be placed at the substitution tag\u2019s location with no additional formatting."}}},ganalytics:{type:"object",description:"Allows you to enable tracking provided by Google Analytics.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."},utmSource:{type:"string",description:"Name of the referrer source. (e.g. Google, SomeDomain.com, or Marketing Email)"},utmMedium:{type:"string",description:"Name of the marketing medium. (e.g. Email)"},utmTerm:{type:"string",description:"Used to identify any paid keywords."},utmContent:{type:"string",description:"Used to differentiate your campaign from advertisements."},utmCampaign:{type:"string",description:"The name of the campaign."}}}}}},required:[],additionalProperties:!1},g={output:ye};var S={anypost:t,braze:t,clickatell:t,nodemailer:y,emailjs:t,"email-webhook":t,"infobip-email":t,mailersend:t,mailgun:h,mailjet:u,mailtrap:t,mandrill:t,netcore:t,"novu-email":f,outlook365:t,plunk:t,postmark:t,resend:t,sendgrid:g,sendinblue:t,ses:t,sparkpost:t};var fe={type:"object",properties:{},required:[],additionalProperties:!1},b={output:fe};var v={novu:b};var T={anyOf:[{type:"string"},{type:"object",additionalProperties:!0,properties:{name:{type:"string"},volume:{type:"number"},critical:{type:"number"}},required:["name","volume","critical"]}]},ge={type:"object",properties:{topic:{type:"string",description:"The destination topic for the notification."},id:{type:"string",description:"A UUID to identify the notification with APNS. If an id is not supplied, APNS will generate one automatically. If an error occurs the response will contain the id. This property populates the apns-id header."},expiry:{type:"number",description:"A UNIX timestamp when the notification should expire. If the notification cannot be delivered to the device, APNS will retry until it expires. An expiry of 0 indicates that the notification expires immediately, therefore no retries will be attempted."},priority:{type:"number",description:`Provide one of the following values:
1
+ "use strict";var l=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var Y=(n,i)=>{for(var e in i)l(n,e,{get:i[e],enumerable:!0})},$=(n,i,e,d)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of K(i))!V.call(n,o)&&o!==e&&l(n,o,{get:()=>i[o],enumerable:!(d=X(i,o))||d.enumerable});return n};var Q=n=>$(l({},"__esModule",{value:!0}),n);var at={};Y(at,{actionStepSchemas:()=>M,channelStepSchemas:()=>G,providerSchemas:()=>I,step:()=>c});module.exports=Q(at);function Z(n,i,e){return{type:"email",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function ee(n,i,e){return{type:"sms",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function te(n,i,e){return{type:"chat",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function ie(n,i,e){return{type:"push",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function ne(n,i,e){return{type:"in_app",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function se(n,i,e){return{type:"tool",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function ae(n,i,e){return{type:"delay",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip}}function oe(n,i,e){return{type:"digest",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip}}function re(n,i,e){return{type:"throttle",stepId:n,resolve:i,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip}}var c={email:Z,sms:ee,chat:te,push:ie,inApp:ne,tool:se,delay:ae,digest:oe,throttle:re};var t={output:{type:"object",properties:{},required:[],additionalProperties:!0}};var le={type:"object",properties:{webhookUrl:{type:"string",format:"uri"},text:{type:"string"},blocks:{type:"array",items:{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!0}}},additionalProperties:!0},p={output:le};var m={"chat-webhook":t,discord:t,getstream:t,"grafana-on-call":t,line:t,mattermost:t,msteams:t,"novu-slack":t,"novu-web-chat":t,"rocket-chat":t,ryver:t,sendblue:t,slack:p,"webex-messaging":t,"whatsapp-business":t,zulip:t,telegram:t};var de={type:"object",properties:{to:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:'Email address of the recipient(s). Example: "Bob bob@host.com". You can use commas to separate multiple recipients (e.g.: "test@example.com,test@example.com" or ["test@example.com", "test@example.com"]).'},from:{type:"string"},subject:{type:"string",description:"Subject of the message."},text:{type:"string",description:"Text version of the message."},html:{type:"string",description:"HTML version of the message."},message:{type:"string",description:"MIME string of the message. Make sure to use multipart/form-data to send this as a file upload."},cc:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"Same as To but for carbon copy"},bcc:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"Same as To but for blind carbon copy"},ampHtml:{type:"string"},tVersion:{type:"string"},tText:{anyOf:[{type:"string",enum:["yes","no"]},{type:"boolean"}]},oTag:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:"Tag string. See Tagging for more information."},oDkim:{anyOf:[{type:"string",enum:["yes","no"]},{type:"boolean"}],description:"Enables/disabled DKIM signatures on per-message basis. Pass yes or no"},oDeliverytime:{type:"string",description:"Desired time of delivery. See Date Format. Note: Messages can be scheduled for a maximum of 3 days in the future."},oDeliverytimeOptimizePeriod:{type:"string"},oTimeZoneLocalize:{type:"string"},oTestmode:{anyOf:[{type:"string",enum:["yes","no"]},{type:"boolean"}],description:"Enables sending in test mode. Pass yes if needed. See Sending in Test Mode"},oTracking:{anyOf:[{type:"string",enum:["yes","no"]},{type:"boolean"}],description:"Toggles tracking on a per-message basis, see Tracking Messages for details. Pass yes or no."},oTrackingClicks:{anyOf:[{type:"string",enum:["yes","no","htmlonly"]},{type:"boolean"}],description:"Toggles clicks tracking on a per-message basis. Has higher priority than domain-level setting. Pass yes, no or htmlonly."},oTrackingOpens:{anyOf:[{type:"string",enum:["yes","no"]},{type:"boolean"}],description:"Toggles opens tracking on a per-message basis. Has higher priority than domain-level setting. Pass yes or no."},oRequireTls:{anyOf:[{type:"string",enum:["yes","no"]},{type:"boolean"}]},oSkipVerification:{anyOf:[{type:"string",enum:["yes","no"]},{type:"boolean"}]},recipientVariables:{type:"string"}},required:[],additionalProperties:!0},h={output:de};var a={type:"object",properties:{name:{type:"string"},email:{type:"string"}},description:'JSON object, containing 2 properties: Name and Email address of a previously validated and active sender. Including the Name property in the JSON is optional. This property is not mandatory in case you use TemplateID and you specified a From address for the template. Format : { "Email":"value", "Name":"value" }.',required:["Email"],additionalProperties:!0},ce={type:"object",properties:{contentType:{type:"string"},filename:{type:"string"},base64Content:{type:"string"}},required:["ContentType","Filename","Base64Content"],additionalProperties:!0},pe={type:"object",properties:{filename:{type:"string"},contentType:{type:"string"},contentId:{type:"string"},base64Content:{type:"string"}},required:["ContentType","Filename","Base64Content"],additionalProperties:!0},me={type:"object",properties:{from:a,sender:a,to:{type:"array",items:a},cc:{type:"array",items:a},bcc:{type:"array",items:a},replyTo:a,subject:{type:"string"},textPart:{type:"string",description:"Content of the message, sent in Text and/or HTML format. At least one of these content types needs to be specified. When the HTML part is the only part provided, Mailjet will not generate a Text-part from the HTML version. The property can't be set when you use TemplateID"},htmlPart:{type:"string",description:"Content of the message, sent in Text and/or HTML format. At least one of these content types needs to be specified. When the HTML part is the only part provided, Mailjet will not generate a Text-part from the HTML version. The property can't be set when you use TemplateID"},templateId:{type:"number",description:"an ID for a template that is previously created and stored in Mailjet's system. It is mandatory when From and TextPart and/or HtmlPart are not provided. "},templateLanguage:{type:"boolean"},templateErrorReporting:a,templateErrorDeliver:{type:"boolean"},attachments:{type:"array",items:ce},inlineAttachments:{type:"array",items:pe},priority:{type:"number"},customCampaign:{type:"string"},deduplicateCampaign:{type:"boolean"},trackOpens:{type:"string",enum:["account_default","disabled","enabled"]},trackClicks:{type:"string",enum:["account_default","disabled","enabled"]},customId:{type:"string"},eventPayload:{type:"string"},urlTags:{type:"string"},headers:{type:"object",additionalProperties:!0},variables:{type:"object",additionalProperties:!0}},required:[],additionalProperties:!0},u={output:me};var s={type:"object",properties:{address:{type:"string"},name:{type:"string"}},additionalProperties:!0},r={type:"object",properties:{content:{type:"string"},path:{type:"string"}},additionalProperties:!0},he={type:"object",properties:{from:{anyOf:[{type:"string"},s]},sender:{anyOf:[{type:"string"},s]},to:{anyOf:[{type:"string"},s,{type:"array",items:s}]},cc:{anyOf:[{type:"string"},s,{type:"array",items:s}]},bcc:{anyOf:[{type:"string"},s,{type:"array",items:s}]},replyTo:{anyOf:[{type:"string"},s,{type:"array",items:s}]},inReplyTo:{anyOf:[{type:"string"},s]},references:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},subject:{type:"string"},text:{anyOf:[{type:"string"},r]},html:{anyOf:[{type:"string"},r]},watchHtml:{anyOf:[{type:"string"},r]},amp:{anyOf:[{type:"string"},{type:"object",properties:{content:{type:"string"},path:{type:"string"},href:{type:"string"},encoding:{type:"string"},contentType:{type:"string"},raw:{anyOf:[{type:"string"},r]}}}]},icalEvent:{anyOf:[{type:"string"},{type:"object",properties:{content:{type:"string"},path:{type:"string"},method:{type:"string"},filename:{anyOf:[{type:"string"},{type:"boolean"}]},href:{type:"string"},encoding:{type:"string"}}}]},headers:{anyOf:[{type:"object",additionalProperties:!0},{type:"array",items:{type:"object",additionalProperties:!0}}]},list:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},attachments:{type:"array",items:{type:"object",properties:{content:{type:"string"},path:{type:"string"}},additionalProperties:!0}}},required:[],additionalProperties:!0},y={output:he};var ue={type:"object",properties:{},required:[],additionalProperties:!1},f={output:ue};var ye={type:"object",properties:{personalizations:{type:"array",description:"An array of messages and their metadata. Each object within personalizations can be thought of as an envelope - it defines who should receive an individual message and how that message should be handled. See our [Personalizations documentation](https://sendgrid.com/docs/for-developers/sending-email/personalizations/) for examples.",uniqueItems:!1,maxItems:1e3,items:{type:"object",properties:{from:{title:"From Email Object",type:"object",properties:{email:{type:"string",format:"email",description:"The 'From' email address used to deliver the message. This address should be a verified sender in your Twilio SendGrid account."},name:{type:"string",description:"A name or title associated with the sending email address."}},required:["email"]},to:{title:"To Email Array",type:"array",items:{type:"object",properties:{email:{type:"string",format:"email",description:"The intended recipient's email address."},name:{type:"string",description:"The intended recipient's name."}},required:["email"]}},cc:{type:"array",description:"An array of recipients who will receive a copy of your email. Each object in this array must contain the recipient's email address. Each object in the array may optionally contain the recipient's name.",maxItems:1e3,items:{title:"CC BCC Email Object",type:"object",properties:{email:{type:"string",format:"email",description:"The intended recipient's email address."},name:{type:"string",description:"The intended recipient's name."}},required:["email"]}},bcc:{type:"array",description:"An array of recipients who will receive a blind carbon copy of your email. Each object in this array must contain the recipient's email address. Each object in the array may optionally contain the recipient's name.",maxItems:1e3,items:{title:"CC BCC Email Object",type:"object",properties:{email:{type:"string",format:"email",description:"The intended recipient's email address."},name:{type:"string",description:"The intended recipient's name."}},required:["email"]}},subject:{type:"string",description:"The subject of your email. See character length requirements according to [RFC 2822](http://stackoverflow.com/questions/1592291/what-is-the-email-subject-length-limit#answer-1592310).",minLength:1},headers:{type:"object",description:"A collection of JSON key/value pairs allowing you to specify handling instructions for your email. You may not overwrite the following headers: `x-sg-id`, `x-sg-eid`, `received`, `dkim-signature`, `Content-Type`, `Content-Transfer-Encoding`, `To`, `From`, `Subject`, `Reply-To`, `CC`, `BCC`"},substitutions:{type:"object",description:'Substitutions allow you to insert data without using Dynamic Transactional Templates. This field should **not** be used in combination with a Dynamic Transactional Template, which can be identified by a `templateId` starting with `d-`. This field is a collection of key/value pairs following the pattern "substitutionTag":"value to substitute". The key/value pairs must be strings. These substitutions will apply to the text and html content of the body of your email, in addition to the `subject` and `reply-to` parameters. The total collective size of your substitutions may not exceed 10,000 bytes per personalization object.',maxProperties:1e4},dynamicTemplateData:{type:"object",description:'Dynamic template data is available using Handlebars syntax in Dynamic Transactional Templates. This field should be used in combination with a Dynamic Transactional Template, which can be identified by a `templateId` starting with `d-`. This field is a collection of key/value pairs following the pattern "variable_name":"value to insert".'},customArgs:{type:"object",description:"Values that are specific to this personalization that will be carried along with the email and its activity data. Substitutions will not be made on custom arguments, so any string that is entered into this parameter will be assumed to be the custom argument that you would like to be used. This field may not exceed 10,000 bytes.",maxProperties:1e4},sendAt:{type:"integer",description:"A unix timestamp allowing you to specify when your email should be delivered. Scheduling delivery more than 72 hours in advance is forbidden."}},required:["to"]}},from:{title:"From Email Object",type:"object",properties:{email:{type:"string",format:"email",description:"The 'From' email address used to deliver the message. This address should be a verified sender in your Twilio SendGrid account."},name:{type:"string",description:"A name or title associated with the sending email address."}},required:["email"]},replyTo:{title:"Reply_to Email Object",type:"object",properties:{email:{type:"string",format:"email",description:"The email address where any replies or bounces will be returned."},name:{type:"string",description:"A name or title associated with the `replyTo` email address."}},required:["email"]},replyToList:{type:"array",description:"An array of recipients who will receive replies and/or bounces. Each object in this array must contain the recipient's email address. Each object in the array may optionally contain the recipient's name. You can either choose to use \u201CreplyTo\u201D field or \u201CreplyToList\u201D but not both.",uniqueItems:!0,maxItems:1e3,items:{type:"object",properties:{email:{type:"string",description:"The email address where any replies or bounces will be returned.",format:"email"},name:{type:"string",description:"A name or title associated with the `replyToList` email address."}},required:["email"]}},subject:{type:"string",description:"The global or 'message level' subject of your email. This may be overridden by subject lines set in personalizations.",minLength:1},content:{type:"array",description:"An array where you can specify the content of your email. You can include multiple [MIME types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of content, but you must specify at least one MIME type. To include more than one MIME type, add another object to the array containing the `type` and `value` parameters.",items:{type:"object",properties:{type:{type:"string",description:"The MIME type of the content you are including in your email (e.g., `\u201Ctext/plain\u201D` or `\u201Ctext/html\u201D`).",minLength:1},value:{type:"string",description:"The actual content of the specified MIME type that you are including in your email.",minLength:1}},required:["type","value"]}},attachments:{type:"array",description:"An array of objects where you can specify any attachments you want to include.",items:{type:"object",properties:{content:{type:"string",description:"The Base64 encoded content of the attachment.",minLength:1},type:{type:"string",description:"The MIME type of the content you are attaching (e.g., `\u201Ctext/plain\u201D` or `\u201Ctext/html\u201D`).",minLength:1},filename:{type:"string",description:"The attachment's filename."},disposition:{type:"string",default:"attachment",description:"The attachment's content-disposition, specifying how you would like the attachment to be displayed. For example, `\u201Cinline\u201D` results in the attached file are displayed automatically within the message while `\u201Cattachment\u201D` results in the attached file require some action to be taken before it is displayed, such as opening or downloading the file.",enum:["inline","attachment"]},contentId:{type:"string",description:"The attachment's content ID. This is used when the disposition is set to `\u201Cinline\u201D` and the attachment is an image, allowing the file to be displayed within the body of your email."}},required:["content","filename"]}},templateId:{type:"string",description:"An email template ID. A template that contains a subject and content \u2014 either text or html \u2014 will override any subject and content values specified at the personalizations or message level."},headers:{description:"An object containing key/value pairs of header names and the value to substitute for them. The key/value pairs must be strings. You must ensure these are properly encoded if they contain unicode characters. These headers cannot be one of the reserved headers.",type:"object"},categories:{type:"array",description:"An array of category names for this message. Each category name may not exceed 255 characters. ",uniqueItems:!0,maxItems:10,items:{type:"string",maxLength:255}},customArgs:{description:"Values that are specific to the entire send that will be carried along with the email and its activity data. Key/value pairs must be strings. Substitutions will not be made on custom arguments, so any string that is entered into this parameter will be assumed to be the custom argument that you would like to be used. This parameter is overridden by `customArgs` set at the personalizations level. Total `customArgs` size may not exceed 10,000 bytes.",type:"string"},sendAt:{type:"integer",description:"A unix timestamp allowing you to specify when you want your email to be delivered. This may be overridden by the `sendAt` parameter set at the personalizations level. Delivery cannot be scheduled more than 72 hours in advance. If you have the flexibility, it's better to schedule mail for off-peak times. Most emails are scheduled and sent at the top of the hour or half hour. Scheduling email to avoid peak times \u2014 for example, scheduling at 10:53 \u2014 can result in lower deferral rates due to the reduced traffic during off-peak times."},batchId:{type:"string",description:"An ID representing a batch of emails to be sent at the same time. Including a `batchId` in your request allows you include this email in that batch. It also enables you to cancel or pause the delivery of that batch. For more information, see the [Cancel Scheduled Sends API](https://sendgrid.com/docs/api-reference/)."},asm:{type:"object",description:"An object allowing you to specify how to handle unsubscribes.",properties:{groupId:{type:"integer",description:"The unsubscribe group to associate with this email."},groupsToDisplay:{type:"array",description:"An array containing the unsubscribe groups that you would like to be displayed on the unsubscribe preferences page.",maxItems:25,items:{type:"integer"}}},required:["groupId"]},ipPoolName:{type:"string",description:"The IP Pool that you would like to send this email from.",minLength:2,maxLength:64},mailSettings:{type:"object",description:"A collection of different mail settings that you can use to specify how you would like this email to be handled.",properties:{bypassListManagement:{type:"object",description:"Allows you to bypass all unsubscribe groups and suppressions to ensure that the email is delivered to every single recipient. This should only be used in emergencies when it is absolutely necessary that every recipient receives your email. This filter cannot be combined with any other bypass filters. See our [documentation](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) for more about bypass filters.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."}}},bypassSpamManagement:{type:"object",description:"Allows you to bypass the spam report list to ensure that the email is delivered to recipients. Bounce and unsubscribe lists will still be checked; addresses on these other lists will not receive the message. This filter cannot be combined with the `bypassListManagement` filter. See our [documentation](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) for more about bypass filters.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."}}},bypassBounceManagement:{type:"object",description:"Allows you to bypass the bounce list to ensure that the email is delivered to recipients. Spam report and unsubscribe lists will still be checked; addresses on these other lists will not receive the message. This filter cannot be combined with the `bypassListManagement` filter. See our [documentation](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) for more about bypass filters.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."}}},bypassUnsubscribeManagement:{type:"object",description:"Allows you to bypass the global unsubscribe list to ensure that the email is delivered to recipients. Bounce and spam report lists will still be checked; addresses on these other lists will not receive the message. This filter applies only to global unsubscribes and will not bypass group unsubscribes. This filter cannot be combined with the `bypassListManagement` filter. See our [documentation](https://sendgrid.com/docs/ui/sending-email/index-suppressions/#bypass-suppressions) for more about bypass filters.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."}}},footer:{type:"object",description:"The default footer that you would like included on every email.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."},text:{type:"string",description:"The plain text content of your footer."},html:{type:"string",description:"The HTML content of your footer."}}},sandboxMode:{type:"object",description:"Sandbox Mode allows you to send a test email to ensure that your request body is valid and formatted correctly.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."}}}}},trackingSettings:{type:"object",description:"Settings to determine how you would like to track the metrics of how your recipients interact with your email.",properties:{clickTracking:{type:"object",description:"Allows you to track if a recipient clicked a link in your email.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."},enableText:{type:"boolean",description:"Indicates if this setting should be included in the `text/plain` portion of your email."}}},openTracking:{type:"object",description:"Allows you to track if the email was opened by including a single pixel image in the body of the content. When the pixel is loaded, Twilio SendGrid can log that the email was opened.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."},substitutionTag:{type:"string",description:"Allows you to specify a substitution tag that you can insert in the body of your email at a location that you desire. This tag will be replaced by the open tracking pixel."}}},subscriptionTracking:{type:"object",description:"Allows you to insert a subscription management link at the bottom of the text and HTML bodies of your email. If you would like to specify the location of the link within your email, you may use the `substitutionTag`.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."},text:{type:"string",description:"Text to be appended to the email with the subscription tracking link. You may control where the link is by using the tag <% %>"},html:{type:"string",description:"HTML to be appended to the email with the subscription tracking link. You may control where the link is by using the tag <% %>"},substitutionTag:{type:"string",description:"A tag that will be replaced with the unsubscribe URL. for example: `[unsubscribe_url]`. If this parameter is used, it will override both the `text` and `html` parameters. The URL of the link will be placed at the substitution tag\u2019s location with no additional formatting."}}},ganalytics:{type:"object",description:"Allows you to enable tracking provided by Google Analytics.",properties:{enable:{type:"boolean",description:"Indicates if this setting is enabled."},utmSource:{type:"string",description:"Name of the referrer source. (e.g. Google, SomeDomain.com, or Marketing Email)"},utmMedium:{type:"string",description:"Name of the marketing medium. (e.g. Email)"},utmTerm:{type:"string",description:"Used to identify any paid keywords."},utmContent:{type:"string",description:"Used to differentiate your campaign from advertisements."},utmCampaign:{type:"string",description:"The name of the campaign."}}}}}},required:[],additionalProperties:!1},g={output:ye};var S={anypost:t,braze:t,clickatell:t,nodemailer:y,emailjs:t,"email-webhook":t,"infobip-email":t,mailersend:t,mailgun:h,mailjet:u,mailtrap:t,mandrill:t,netcore:t,"novu-email":f,outlook365:t,plunk:t,postmark:t,resend:t,sendgrid:g,sendinblue:t,ses:t,sparkpost:t};var fe={type:"object",properties:{},required:[],additionalProperties:!1},b={output:fe};var v={novu:b};var T={anyOf:[{type:"string"},{type:"object",additionalProperties:!0,properties:{name:{type:"string"},volume:{type:"number"},critical:{type:"number"}},required:["name","volume","critical"]}]},ge={type:"object",properties:{topic:{type:"string",description:"The destination topic for the notification."},id:{type:"string",description:"A UUID to identify the notification with APNS. If an id is not supplied, APNS will generate one automatically. If an error occurs the response will contain the id. This property populates the apns-id header."},expiry:{type:"number",description:"A UNIX timestamp when the notification should expire. If the notification cannot be delivered to the device, APNS will retry until it expires. An expiry of 0 indicates that the notification expires immediately, therefore no retries will be attempted."},priority:{type:"number",description:`Provide one of the following values:
2
2
 
3
3
  10 - The push notification is sent to the device immediately. (Default)
4
4
  The push notification must trigger an alert, sound, or badge on the device. It is an error to use this priority for a push notification that contains only the content-available key.
@@ -1,5 +1,5 @@
1
- import { S as Subscriber, C as ContextResolved, E as EnvironmentSystemVariables, G as EmailOutputUnvalidated, p as providerSchemas, W as WithPassthrough, R as SmsOutputUnvalidated, h as ChatOutputUnvalidated, M as PushOutputUnvalidated, J as InAppOutputUnvalidated, $ as ToolOutputUnvalidated, n as DelayOutputUnvalidated, v as DigestOutputUnvalidated, Y as ThrottleOutputUnvalidated } from './subscriber.types-_eHz1E0m.cjs';
2
- export { a0 as actionStepSchemas, a1 as channelStepSchemas } from './subscriber.types-_eHz1E0m.cjs';
1
+ import { S as Subscriber, C as ContextResolved, E as EnvironmentSystemVariables, G as EmailOutputUnvalidated, p as providerSchemas, W as WithPassthrough, R as SmsOutputUnvalidated, h as ChatOutputUnvalidated, M as PushOutputUnvalidated, J as InAppOutputUnvalidated, $ as ToolOutputUnvalidated, n as DelayOutputUnvalidated, v as DigestOutputUnvalidated, Y as ThrottleOutputUnvalidated } from './subscriber.types-BanvmGul.cjs';
2
+ export { a0 as actionStepSchemas, a1 as channelStepSchemas } from './subscriber.types-BanvmGul.cjs';
3
3
  import { A as Awaitable } from './util.types-DaFfsxgy.cjs';
4
4
  import { S as Schema, a as FromSchema } from './base.schema.types-BApIn9jr.cjs';
5
5
  import 'chat';
@@ -181,7 +181,7 @@ declare const providerSchemas: {
181
181
  readonly additionalProperties: true;
182
182
  };
183
183
  };
184
- readonly 'novu-agent-chat': {
184
+ readonly 'novu-web-chat': {
185
185
  output: {
186
186
  readonly type: "object";
187
187
  readonly properties: {};
@@ -114,7 +114,7 @@ declare enum ChatProviderIdEnum {
114
114
  Novu = "novu-slack",
115
115
  Telegram = "telegram",
116
116
  Sendblue = "sendblue",
117
- NovuAgentChat = "novu-agent-chat"
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
- type Signal = MetadataSignal | TriggerSignal;
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 { buildApprovalActionId as $, type Agent as A, type TriggerRecipientsPayload as B, type ISubscriberPayload as C, TriggerEventStatusEnum as D, type ToolResult as E, type FileRef as F, type ToolApprovalRequestPayload as G, AgentEventEnum as H, type ITriggerPayload as I, type TypingControl as J, type ToolApprovalControl as K, type AgentBridgeRequest as L, type MessageContent as M, type ReplyContent as N, type AddReactionPayload as O, type DeleteMessagePayload as P, type SentMessageInfo as Q, type ReplyHandle as R, type Signal as S, type ToolApprovalCard as T, type TypingOp as U, type AgentReplyPayload as V, type WorkflowPreferencesPartial as W, type EditPayload as X, type MetadataSignal as Y, type ParsedApprovalAction as Z, type TriggerSignal as _, type AgentAction as a, parseApprovalActionId as a0, 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 AgentMessage as m, type AgentMessageAuthor as n, type AgentMessageContext as o, type AgentNotification as p, type AgentPlatformContext as q, type AgentReaction as r, type AgentReactionContext as s, type AgentResolveContext as t, type AgentSubscriber as u, type AgentSubscriberAccess as v, type AgentToolCall as w, type ToolApprovalConfig as x, type ToolApprovalDecision as y, toAgentError as z };
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, m as AgentMessage, o as AgentMessageContext, M as MessageContent, y as ToolApprovalDecision, b as AgentActionContext, R as ReplyHandle, A as Agent, l as AgentHistoryEntry, j as AgentHandlerContext } from '../agent.types-C17NUGxY.js';
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-DFLG1_vb.js';
2
2
  import { streamText, generateText, ModelMessage } from 'ai';
3
3
  import { A as Awaitable } from '../util.types-DaFfsxgy.js';
4
4
  import 'chat';
@@ -0,0 +1 @@
1
+ import{a as L,b as q,c as B,d as j,e as W,f as V,g as G,h as X,i as K,j as z,k as Y,l as J,m as Q,n as Z,o as ee,p as te,q as ne,r as re}from"./chunk-X5AZIKIR.js";import{d as oe,g,i as se,q as ae,r as ie,s as c,t as R,u as C,v as le}from"./chunk-VY27ZAO7.js";import{a as pe,c as ue,g as de}from"./chunk-PU74XQ2P.js";var ce=class extends C{constructor(n){super("Unknown BridgeError",{cause:n});this.statusCode=500;this.code="BridgeError"}};var me=class extends c{constructor(n,r){super(`Workflow with id: \`${n}\` has a corrupt state. Step with id: \`${r}\` does not exist. Please provide the missing state.`);this.code="ExecutionStateCorruptError";this.data={workflowId:n,stepId:r}}},fe=class extends c{constructor(n,r){super(`Workflow with id: \`${n}\` has invalid \`payload\`. Please provide the correct event payload.`);this.code="ExecutionEventPayloadInvalidError";this.data=r}},he=class extends c{constructor(n,r){super(`Workflow with id: \`${n}\` has invalid \`controls\`. Please provide the correct event controls.`);this.code="ExecutionEventControlInvalidError";this.data=r}},ye=class extends c{constructor(n,r,o){super(`Workflow with id: \`${n}\` has an invalid state. Step with id: \`${r}\` has invalid \`controls\`. Please provide the correct step controls.`);this.code="ExecutionStateControlInvalidError";this.data=o}},Re=class extends c{constructor(n,r,o){super(`Workflow with id: \`${n}\` has an invalid state. Step with id: \`${r}\` has invalid output. Please provide the correct step output.`);this.code="ExecutionStateOutputInvalidError";this.data=o}},Ae=class extends c{constructor(n,r,o){super(`Workflow with id: \`${n}\` has an invalid state. Step with id: \`${r}\` has invalid result. Please provide the correct step result.`);this.code="ExecutionStateResultInvalidError";this.data=o}},ve=class extends c{constructor(n,r,o){super(`Workflow with id: \`${n}\` has invalid controls syntax in step with id: \`${r}\`. Please correct step control syntax.`);this.code="StepControlCompilationFailedError";this.data=o}},Se=class extends c{constructor(n,r,o,s){super(`Workflow with id: \`${n}\` has an invalid state. Step with id: \`${r}\` and provider with id: \`${o}\` has invalid output. Please provide the correct provider output.`);this.code="ExecutionProviderOutputInvalidError";this.data=s}},xe=class extends c{constructor(n,r){super(`Workflow with id: \`${n}\` has invalid \`payload\`. Please provide the correct payload.`);this.code="WorkflowPayloadInvalidError";this.data=r}};var Te=t=>Object.values(g).includes(t==null?void 0:t.code),Vt=t=>!Te(t)&&typeof t.statusCode=="number"&&t.statusCode>=400&&t.statusCode<500;var N=t=>Object.values(t).map(e=>`\`${e}\``).join(", "),w=t=>t.replaceAll(/(\w)(\w*)/g,(e,n,r)=>n.toUpperCase()+r.toLowerCase()).replaceAll(/[\s-]+/g,"");var Ee=class extends ae{constructor(){super(...arguments);this.code="MethodNotAllowedError";this.statusCode=405;this.message=`Method not allowed. Please use one of ${N(se)}`}},_e=class extends c{constructor(n,r){super(`Invalid query string: \`action\`=\`${n}\`. Please use one of ${N(r)}`);this.code="InvalidActionError"}},Ce=class extends c{constructor(){super("Missing secret key. Set the `NOVU_SECRET_KEY` environment variable or pass `secretKey` to the client options.");this.code="MissingSecretKeyError"}};var we=class extends Error{constructor(e,n,r){super(),this.data={message:r},this.statusCode=e,this.code=n}};var A=class extends le{constructor(e,n){super(`${w(e)} with id: \`${n}\` already exists. Please use a different id.`)}},f=class extends ie{constructor(e,n){super(`${w(e)} with id: \`${n}\` does not exist. Please provide a valid id.`)}},v=class extends C{constructor(n,r,o,s){super(`Failed to ${o} ${w(n)} with id: \`${r}\``,{cause:s});this.statusCode=502}};var Oe=class extends f{constructor(n){super("provider",n);this.code="ProviderNotFoundError"}},Ie=class extends v{constructor(n,r,o){super("provider",n,r,o);this.code="ProviderExecutionFailedError"}};var Pe=class extends R{constructor(){super("Signature does not match the expected signature. Please ensure the signature provided in the `novu-signature` header is correct and try again.");this.code="SignatureMismatchError"}},ke=class extends R{constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");this.code="SignatureNotFoundError"}},Ne=class extends R{constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");this.code="SignatureInvalidError"}},Ue=class extends R{constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`novu-signature\` header`);this.code="SignatureExpiredError"}},Fe=class extends R{constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");this.code="SigningKeyNotFoundError"}},De=class extends R{constructor(){super("Signature version is invalid. Please provide a signature version with version `v1` in the `novu-signature` header");this.code="SignatureVersionInvalidError"}};var Me=class extends f{constructor(n){super("step",n);this.code="StepNotFoundError"}},He=class extends A{constructor(n){super("step",n);this.code="StepAlreadyExistsError"}},$e=class extends v{constructor(n,r,o){super("step",n,r,o);this.code="StepExecutionFailedError"}};var Le=class extends f{constructor(n){super("workflow",n);this.code="WorkflowNotFoundError"}},qe=class extends A{constructor(n){super("workflow",n);this.code="WorkflowAlreadyExistsError"}};function gt(t,e){let n={...t};for(let r of Object.keys(e)){let o=e[r];o&&typeof o=="object"&&!Array.isArray(o)?n[r]=gt(n[r]||{},o):(Array.isArray(o),n[r]=o)}return n}function O(t,e){let n=e.split(".").reduce((r,o)=>{if(r&&typeof r=="object")return r[o]},t);if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);if(typeof n=="object"){let r=JSON.stringify(n);return r==="{}"?"":r}return""}function Be(t,e=2,n,r=", "){if(!Array.isArray(t)||t.length===0)return"";let o=n?t.map(a=>typeof a!="object"||!a?"":O(a,n)):t;if(o.length===1)return o[0];if(o.length===2)return`${o[0]} and ${o[1]}`;if(e>=o.length){let a=o.slice(0,-1),p=o[o.length-1];return`${a.join(r)} and ${p}`}let s=o.slice(0,e),u=o.length-e;return`${s.join(r)} and ${u} ${u===1?"other":"others"}`}import mt from"pluralize";function je(t,e="",n="",r="true"){if(t==null)return"";let o=0;if(Array.isArray(t)?o=t.length:typeof t=="object"?o=Object.keys(t).length:typeof t=="string"?o=+t:typeof t=="number"?o=t:o=Number(t),Number.isNaN(o)&&(o=0),o<=0)return"";let s;return n?s=o===1?e:n:s=mt(e,o),r==="true"?`${o} ${s}`:s}import{TokenKind as We}from"liquidjs";import ft from"pluralize";import{z as h}from"zod";var Ge="",Xe=2,Ke="other",ze=", ",Ye=" and ",Je=", and ",Ve={0:"keyPath",1:"limit",2:"overflowSuffix",3:"wordsConnector",4:"twoWordsConnector",5:"lastWordConnector"};function Qe(t,e=Ge,n=Xe,r=Ke,o=ze,s=Ye,u=Je){if(!Array.isArray(t)||t.length===0)return"";let a=e?t.map(i=>typeof i!="object"||!i?"":O(i,e)):t,p=a.length;if(p===1)return a[0];if(p===2)return`${a[0]}${s}${a[1]}`;if(n>=p){let i=a.slice(0,p-1),x=a[p-1];return`${i.join(o)}${u}${x}`}let l=a.slice(0,n),d=p-n,y=n===1?s:u;return`${l.join(o)}${y}${d} ${ft(r,d)}`}function jn(t={},...e){let{requireKeyPath:n=!1}=t,r=[];if(e.length<1)return r.push({message:"Expected at least 1 argument",begin:0,end:0,value:""}),r;let o=h.object({keyPath:n?h.string().min(1,"must be non-empty"):h.string().optional().default(Ge),limit:h.number().optional().default(Xe).refine(a=>a>=0,"must be greater than or equal to 0"),overflowSuffix:h.string().optional().default(Ke),wordsConnector:h.string().optional().default(ze),twoWordsConnector:h.string().optional().default(Ye),lastWordConnector:h.string().optional().default(Je)}),s={};e.forEach((a,p)=>{if(!Array.isArray(a)){let l=a.getText();(a.kind===We.Quoted||a.kind===We.Number)&&(l=a.content);let d=Ve[p];s[d]=l}});let u=o.safeParse(s);if(!u.success)for(let a of u.error.issues){let p="string";"type"in a&&(p=a.type);let l=a.path[0],d=Object.entries(Ve).find(([x,ct])=>ct===l),y=d?parseInt(d[0],10):null,i=typeof y=="number"?e[y]:null;i&&!Array.isArray(i)&&r.push({message:`"toSentence" expects a ${p}${a.message?` that ${a.message}`:""} for argument "${l}"`,begin:i.begin,end:i.end,value:i.getText()})}return r}import{Liquid as ht}from"liquidjs";function yt(t){return Array.isArray(t)||typeof t=="object"&&t!==null?Ze(t):typeof t=="string"?t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"):t==null?"":String(t)}var Ze=(t,e=0)=>Array.isArray(t)||typeof t=="object"&&t!==null?JSON.stringify(t,null,e).replace(/"/g,"'").replace(/\n/g,"\\n"):t==null?"":String(t);function Yn(t){let e=new ht({outputEscape:yt,...t});return e.registerFilter("json",(n,r)=>Ze(n,r)),e.registerFilter("digest",Be),e.registerFilter("toSentence",Qe),e.registerFilter("pluralize",je),e}var Rt={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",408:"Request Timeout",409:"Conflict",422:"Unprocessable Entity",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout"};function I(t){return typeof t=="string"&&t.trim()?t:!t||typeof t!="object"?null:I(t.message)}function At(t){if(!t)return null;let e;try{e=JSON.parse(t)}catch{return null}if(!e||typeof e!="object")return null;let n=e,r=I(n.message);if(r)return r;let o=I(n.error);if(o)return o;let s=n.errors;return Array.isArray(s)?I(s[0]):null}function vt(t,e){var o;let n=(o=Rt[t])!=null?o:t,r=At(e);return r?`Delivery failed: ${n}: ${r}`:`Delivery failed: ${n}`}var S=class extends Error{constructor(e,n){super(e),this.name="AgentError",this.cause=n==null?void 0:n.cause,this.delivery=n==null?void 0:n.delivery}},m=class extends S{constructor(e,n){let r={statusCode:e,responseBody:n};super(vt(e,n),{delivery:r}),this.name="AgentDeliveryError",this.statusCode=e,this.responseBody=n}};function Qn(t){return t instanceof S?t:t instanceof Error?new S(t.message,{cause:t}):new S("Turn failed",{cause:t})}var St=(o=>(o.ON_MESSAGE="onMessage",o.ON_ACTION="onAction",o.ON_RESOLVE="onResolve",o.ON_REACTION="onReaction",o))(St||{}),b=class{constructor(){this.__novuPendingApproval=!0}};function er(t){return typeof t=="object"&&t!==null&&"suppress"in t&&t.suppress===!0}var et=1;function xt(t){return new Promise(e=>{setTimeout(e,t)})}function Tt(t){return t>=500||t===408||t===429}var P=class{constructor(e){this.sequence=0;this.buffer=[];this.chain=Promise.resolve();var n,r;this.runId=`run_${crypto.randomUUID()}`,this.eventsUrl=e.eventsUrl,this.secretKey=e.secretKey,this.conversationId=e.conversationId,this.agentId=e.agentId,this.turnId=e.turnId,this.fetchFn=(n=e.fetchFn)!=null?n:fetch,this.maxRetries=(r=e.maxRetries)!=null?r:3}enqueue(e){this.sequence+=1,this.buffer.push({version:et,conversationId:this.conversationId,agentId:this.agentId,runId:this.runId,turnId:this.turnId,sequence:this.sequence,timestamp:new Date().toISOString(),event:e})}flush(){if(this.buffer.length===0)return this.chain;let e=this.buffer;return this.buffer=[],this.chain=this.chain.then(()=>this.postBatchWithRetry(e)),this.chain}async emit(e){this.enqueue(e),await this.flush()}async postBatchWithRetry(e){let n;for(let r=1;r<=this.maxRetries;r+=1)try{await this.postBatch(e);return}catch(o){if(n=o,!Et(o))throw o;r<this.maxRetries&&await xt(250*r)}throw n}async postBatch(e){let n;try{n=await this.fetchFn(this.eventsUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${this.secretKey}`},body:JSON.stringify({events:e})})}catch(o){throw _t(o)}let r=await n.text().catch(()=>"");if(!n.ok)throw new m(n.status,r)}};function Et(t){return!(t instanceof m)||t.statusCode===0?!0:Tt(t.statusCode)}function _t(t){if(t instanceof m)return t;let e=t instanceof Error?t.message:"Network request failed";return new m(0,e)}function tt(t){let e=typeof t=="string"?[t]:t,n=[],r=new Set;for(let o of e){if(typeof o!="string")throw new Error("`to` must be a subscriberId string or an array of subscriberIds");let s=o.trim();!s||r.has(s)||(r.add(s),n.push(s))}if(n.length===0)throw new Error("`to` must include at least one subscriberId");if(n.length>50)throw new Error("`to` supports at most 50 subscriberIds");return n}var Ct=Symbol.for("chat.jsx.element"),wt=new Set([L,q,B,j,W,V,Q,G,X,K,z,Z,ee,Y,te,ne,J,re]);function Ot(t){return typeof t=="object"&&t!==null&&t.$$typeof===Ct}async function nt(t){let e=k(t);if(e&&typeof e=="object"&&pe(e))return e;let{isJSX:n,toCardElement:r}=await import("./jsx-runtime-5ZWEWA4A.js");return n(e)?r(e):null}function k(t){var e;if(Array.isArray(t))return t.map(n=>k(n));if(!Ot(t))return t;if(typeof t.type=="function"&&!wt.has(t.type)){let n={...(e=t.props)!=null?e:{}};return t.children!==void 0&&(n.children=t.children),k(t.type(n))}return{...t,children:k(t.children)}}var It=5*1024*1024,bt=5*1024*1024,rt=32768,Pt=/^[A-Za-z0-9+/]*={0,2}$/;function _(t,e){return t.filename?`"${t.filename}"`:`at index ${e}`}function lt(){return globalThis.Buffer}function kt(t){var e,n,r;return(r=(n=(e=lt())==null?void 0:e.isBuffer)==null?void 0:n.call(e,t))!=null?r:!1}function Nt(t){return typeof Blob!="undefined"&&t instanceof Blob}function U(t){let e=lt();if(e)return e.from(t).toString("base64");if(typeof btoa!="function")throw new Error("Unable to encode file data: base64 encoding is not available in this runtime.");let n="";for(let r=0;r<t.length;r+=rt){let o=t.subarray(r,r+rt);n+=String.fromCharCode(...o)}return btoa(n)}function pt(t){let e=t.replace(/\s/g,""),n=e.length%4;if(!e||n===1||!Pt.test(e))return null;let r=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(e.length*3/4)-r}function T(t,e,n){if(t>It)throw new Error(`Invalid file ${_(e,n)}: inline data must be 5 MB or smaller. Use a publicly-accessible URL for larger files.`)}async function Ut(t,e,n){if(typeof t=="string"){let r=pt(t);if(r===null)throw new Error(`Invalid file ${_(e,n)}: data must be a base64-encoded string.`);return T(r,e,n),t}if(kt(t))return T(t.byteLength,e,n),t.toString("base64");if(t instanceof Uint8Array)return T(t.byteLength,e,n),U(t);if(t instanceof ArrayBuffer)return T(t.byteLength,e,n),U(new Uint8Array(t));if(Nt(t))return T(t.size,e,n),U(new Uint8Array(await t.arrayBuffer()));throw new Error(`Invalid file ${_(e,n)}: data must be a base64 string, Buffer, Uint8Array, ArrayBuffer, or Blob.`)}async function Ft(t){if(!(t!=null&&t.length))return;let e=[],n=0;for(let[r,o]of t.entries()){let s=o.data,u=o.url,a=s!=null,p=u!=null;if(a===p)throw new Error(`Invalid file ${_(o,r)}: provide exactly one of data or url.`);if(a){let l=await Ut(s,o,r),d=pt(l);if(n+=d!=null?d:0,n>bt)throw new Error("Invalid files: total inline data must be 5 MB or smaller. Use publicly-accessible URLs for larger files.");e.push({...o,data:l});continue}if(p&&typeof u!="string")throw new Error(`Invalid file ${_(o,r)}: url must be a string.`);e.push(o)}return e}async function ut(t,e){let n=await Ft(e);if(typeof t=="string")return n?{markdown:t,files:n}:{markdown:t};let r=await nt(t);if(r)return n?{card:r,files:n}:{card:r};throw new Error("Invalid message content \u2014 expected string or CardElement")}function dt(t){return`${t}_${crypto.randomUUID()}`}function ot(t){if(t.markdown!==void 0)return{markdown:t.markdown};if(t.card!==void 0)return{card:t.card};throw new Error("Invalid reply content \u2014 expected markdown or card")}function st(t){if(t!=null&&t.length)return t.map((e,n)=>({fileId:e.filename||`file_${n}`,name:e.filename,mediaType:e.mimeType,...e.data!==void 0?{data:typeof e.data=="string"?e.data:void 0}:{},...e.url!==void 0?{url:e.url}:{}}))}function F(t,e){e.toolApprovalRequest&&(t.toolApprovalRequest=e.toolApprovalRequest),e.signals.length&&(t.signals=e.signals),e.toolResults.length&&(t.toolResults=e.toolResults),e.addReactions.length&&(t.addReactions=e.addReactions),e.deleteMessages.length&&(t.deleteMessages=e.deleteMessages),e.resolve&&(t.resolve=e.resolve)}function D(t,e){var r;let n=[];if(t.toolApprovalRequest){let o=t.toolApprovalRequest;n.push({type:"tool-approval-request",approvalId:o.approvalId,toolUseId:o.toolCallId,toolName:o.name,input:o.input,...e!=null&&e.deliverApprovalCard?{deliverCard:!0}:{}})}for(let o of t.toolResults)n.push({type:"tool-use-result",toolUseId:o.toolCallId,content:[{type:"text",text:String((r=o.preview)!=null?r:"")},{type:"json",value:o.output}]});for(let o of t.signals)n.push({type:"signal",signal:o});for(let o of t.addReactions)n.push({type:"channel.reaction",messageId:o.messageId,emoji:o.emojiName,op:"add"});for(let o of t.deleteMessages)n.push({type:"channel.delete",messageId:o.messageId});return t.resolve&&n.push({type:"resolve",summary:t.resolve.summary}),n}var M=class{constructor(e,n,r,o){this.replyUrl=e;this.secretKey=n;this.conversationId=r;this.integrationIdentifier=o}async sendReply(e,n){let r=this._baseBody();return r.reply=e,F(r,n),this._post(r)}async sendApprovalCard(e,n){let r=this._baseBody();return r.reply={toolApprovalCard:e},F(r,n),this._post(r)}async editMessage(e,n){return this._post({...this._baseBody(),edit:{messageId:e,content:n}})}async deleteMessage(e){await this._post({...this._baseBody(),deleteMessages:[{messageId:e}]})}async setTyping(e){await this._post({...this._baseBody(),typing:e})}async flushSideEffects(e){let n=this._baseBody();F(n,e),await this._post(n)}async emitCustom(){}queueRunStart(){}async emitRunFinish(){}async reportTurnError(){await this._post({...this._baseBody(),error:!0})}_baseBody(){return{conversationId:this.conversationId,integrationIdentifier:this.integrationIdentifier}}async _post(e){let n=await fetch(this.replyUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${this.secretKey}`},body:JSON.stringify(e)});if(!n.ok){let o=await n.text().catch(()=>"");throw new m(n.status,o)}let r=await n.text().catch(()=>"");if(!r)return null;try{let o=JSON.parse(r),s=o&&typeof o=="object"&&"data"in o?o.data:o;if(s&&typeof s.messageId=="string"&&typeof s.platformThreadId=="string")return{messageId:s.messageId,platformThreadId:s.platformThreadId}}catch{}return null}},H=class{constructor(e){this.outbox=e}async sendReply(e,n){let r=dt("msg"),o=D(n);return o.push({type:"message",role:"assistant",messageId:r,content:ot(e),files:st(e.files)}),await this._emitAndFlush(o),{messageId:r,platformThreadId:""}}async sendApprovalCard(e,n){return await this._emitAndFlush(D(n,{deliverApprovalCard:!0})),"unaddressable"}async editMessage(e,n){return await this.outbox.emit({type:"channel.edit",messageId:e,content:ot(n),files:st(n.files)}),{messageId:e,platformThreadId:""}}async deleteMessage(e){await this.outbox.emit({type:"channel.delete",messageId:e})}async setTyping(e){if(e==="stop"){await this.outbox.emit({type:"channel.typing",state:"off"});return}let n=typeof e=="object"&&"status"in e?e.status:void 0;await this.outbox.emit({type:"channel.typing",state:"on",status:n})}async flushSideEffects(e){await this._emitAndFlush(D(e))}async emitCustom(e,n){await this.outbox.emit({type:"custom",name:e,data:n})}queueRunStart(){this.outbox.enqueue({type:"run-start"})}async emitRunFinish(e){await this.outbox.emit({type:"run-finish",outcome:e})}async reportTurnError(e){await this.outbox.emit({type:"run-error",message:e!=null?e:"agent handler failed"})}async _emitAndFlush(e){if(e.length!==0){for(let n of e)this.outbox.enqueue(n);await this.outbox.flush()}}},E=class{constructor(e,n,r){this.transport=r;this.editedByHandler=!1;this.messageId=e,this.platformThreadId=n}async edit(e,n){this.editedByHandler=!0;let r=await ut(e,n==null?void 0:n.files),o=await this.transport.editMessage(this.messageId,r);if(!o)throw new Error("Agent edit did not return a message handle");return this.messageId=o.messageId,this.platformThreadId=o.platformThreadId,this}async delete(){await this.transport.deleteMessage(this.messageId)}},$=class{constructor(){this.messageId="";this.platformThreadId=""}async edit(){return this}async delete(){}},it;it=ue;var at=class{constructor(e,n,r){this[it]=!0;this._signals=[];this._toolResults=[];this._pendingToolApprovalRequest=null;this._pendingReactions=[];this._pendingDeletes=[];this._resolveSignal=null;var a,p,l,d,y;this.event=e.event,this.action=(a=e.action)!=null?a:null,this.message=e.message,this.reaction=e.reaction,this.conversation=e.conversation,this.subscriber=e.subscriber,this.context=(p=e.context)!=null?p:null,this.notification=(l=e.notification)!=null?l:null,this.history=e.history,this.platform=e.platform,this.platformContext=e.platformContext,this.humanResponse=(d=e.humanResponse)!=null?d:null,this._toolApprovalConfig=r,this._transport=e.eventsUrl?new H(new P({eventsUrl:e.eventsUrl,secretKey:n,conversationId:e.conversationId,agentId:e.agentId,turnId:e.deliveryId})):new M(e.replyUrl,n,e.conversationId,e.integrationIdentifier),this._metadataState={...(y=e.conversation.metadata)!=null?y:{}};let o=this;this.metadata={get(i){return o._metadataState[i]},set(i,x){o._metadataState[i]=x,o._signals.push({type:"metadata",action:"set",key:i,value:x})},delete(i){delete o._metadataState[i],o._signals.push({type:"metadata",action:"delete",key:i})},clear(){o._metadataState={},o._signals.push({type:"metadata",action:"clear"})},get current(){return{...o._metadataState}}};let s=i=>this._transport.setTyping(i),u=(i=>s(i===void 0?{}:{status:i}));u.stop=()=>s("stop"),this.typing=u,this.toolApproval={request:async i=>(await de(this,i,this._toolApprovalConfig),new b)}}asMessageContext(){return this}async reply(e,n){let r=await ut(e,n==null?void 0:n.files),o=this._drainSideEffectsSnapshot(),s=await this._transport.sendReply(r,o);if(!s)throw new Error("Agent reply did not return a message handle");return new E(s.messageId,s.platformThreadId,this._transport)}async replyApprovalCard(e){let n=this._drainSideEffectsSnapshot(),r=await this._transport.sendApprovalCard(e,n);if(r==="unaddressable")return new $;if(!r)throw new Error("Agent approval card reply did not return a message handle");return new E(r.messageId,r.platformThreadId,this._transport)}createReplyHandle(e){return new E(e,"",this._transport)}async emit(e){await this._transport.emitCustom(e.name,e.data)}resolve(e){this._resolveSignal={summary:e}}trigger(e,n){this._signals.push({...n,type:"trigger",workflowId:e})}ask(e,n){return this.queueHumanSignal("ask",e,n)}approve(e,n){return this.queueHumanSignal("approve",e,n)}choose(e,n,r){if(n.length<2||n.length>10)throw new Error("ctx.choose requires between 2 and 10 options");if(n.some(o=>typeof o!="string"||o.trim().length===0))throw new Error("ctx.choose options must be non-empty strings");return this.queueHumanSignal("choose",e,r,n)}tell(e,n){return this.queueHumanSignal("tell",e,n)}queueHumanSignal(e,n,r,o){let s=dt("hr"),u=(r==null?void 0:r.to)!==void 0?tt(r.to):void 0;return this._signals.push({type:"human",kind:e,prompt:n,requestId:s,...o?{options:o}:{},...r!=null&&r.from?{from:r.from}:{},...r&&"ttlSeconds"in r&&r.ttlSeconds!==void 0?{ttlSeconds:r.ttlSeconds}:{},...u!==void 0?{to:u}:{}}),s}emitToolApprovalRequest(e){if(this._pendingToolApprovalRequest)throw new Error("Only one tool approval request can be queued before the next reply");this._pendingToolApprovalRequest=e}emitToolResult(e){this._toolResults.push(e)}addReaction(e,n){this._pendingReactions.push({messageId:e,emojiName:n})}deleteMessage(e){this._pendingDeletes.push({messageId:e})}queueRunStart(){this._transport.queueRunStart()}async emitRunFinish(e){try{await this._transport.emitRunFinish(e.outcome)}catch(n){console.error("[agent] Failed to emit run finish:",n)}}async reportTurnError(e){try{await this._transport.reportTurnError(e)}catch(n){console.error("[agent] Failed to report turn error:",n)}}async flush(){if(!this._hasPendingSideEffects())return;let e=this._drainSideEffectsSnapshot();await this._transport.flushSideEffects(e)}_hasPendingSideEffects(){return!!(this._pendingToolApprovalRequest||this._signals.length||this._toolResults.length||this._resolveSignal||this._pendingReactions.length||this._pendingDeletes.length)}_drainSideEffectsSnapshot(){let e={toolApprovalRequest:this._pendingToolApprovalRequest,signals:this._signals,toolResults:this._toolResults,addReactions:this._pendingReactions,deleteMessages:this._pendingDeletes,resolve:this._resolveSignal};return this._pendingToolApprovalRequest=null,this._signals=[],this._toolResults=[],this._pendingReactions=[],this._pendingDeletes=[],this._resolveSignal=null,e}};var Ar={type:"object",properties:{},required:[],additionalProperties:!1};var Dt=(l=>(l.PENDING="pending",l.QUEUED="queued",l.RUNNING="running",l.COMPLETED="completed",l.FAILED="failed",l.DELAYED="delayed",l.CANCELED="canceled",l.MERGED="merged",l.SKIPPED="skipped",l))(Dt||{});var Mt=(o=>(o.NONE="none",o.LOW="low",o.MEDIUM="medium",o.HIGH="high",o))(Mt||{});export{ce as a,me as b,fe as c,he as d,ye as e,Re as f,Ae as g,ve as h,Se as i,xe as j,Te as k,Vt as l,Ee as m,_e as n,Ce as o,we as p,A as q,f as r,v as s,Oe as t,Ie as u,Pe as v,ke as w,Ne as x,Ue as y,Fe as z,De as A,Me as B,He as C,$e as D,Le as E,qe as F,nt as G,gt as H,Be as I,je as J,Qe as K,jn as L,Yn as M,S as N,m as O,Qn as P,St as Q,b as R,er as S,at as T,Ar as U,Dt as V,Mt as W};