@novu/framework 2.12.0 → 2.13.0-rc.28c6d223e1

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 (60) hide show
  1. package/README.md +7 -4
  2. package/dist/cjs/{index-1DobCKAF.d.cts → index-CLZZRnNV.d.cts} +33 -0
  3. package/dist/cjs/index.cjs +82 -82
  4. package/dist/cjs/index.d.cts +1 -1
  5. package/dist/cjs/internal/index.cjs +57 -1
  6. package/dist/cjs/internal/index.d.cts +1 -1
  7. package/dist/{esm/server.types-BRWsA1CA.d.ts → cjs/server.types-Cc6o5eYH.d.cts} +1 -1
  8. package/dist/cjs/servers/express.cjs +57 -57
  9. package/dist/cjs/servers/express.d.cts +3 -3
  10. package/dist/cjs/servers/h3.cjs +57 -57
  11. package/dist/cjs/servers/h3.d.cts +3 -3
  12. package/dist/cjs/servers/hono.cjs +564 -0
  13. package/dist/cjs/servers/hono.d.cts +18 -0
  14. package/dist/cjs/servers/lambda.cjs +82 -82
  15. package/dist/cjs/servers/lambda.d.cts +3 -3
  16. package/dist/cjs/servers/nest.cjs +57 -57
  17. package/dist/cjs/servers/nest.d.cts +6 -3
  18. package/dist/cjs/servers/next.cjs +54 -54
  19. package/dist/cjs/servers/next.d.cts +8 -3
  20. package/dist/cjs/servers/nuxt.cjs +57 -57
  21. package/dist/cjs/servers/nuxt.d.cts +3 -3
  22. package/dist/cjs/servers/remix.cjs +57 -57
  23. package/dist/cjs/servers/remix.d.cts +3 -3
  24. package/dist/cjs/servers/sveltekit.cjs +59 -59
  25. package/dist/cjs/servers/sveltekit.d.cts +3 -3
  26. package/dist/esm/cards.js +1 -1
  27. package/dist/esm/{chunk-C3P3ZH2I.js → chunk-46AHJTS7.js} +22 -22
  28. package/dist/esm/{chunk-TEOO6V72.js → chunk-BSFJB6OO.js} +49 -49
  29. package/dist/esm/chunk-LHU5A7DI.js +1 -0
  30. package/dist/esm/{chunk-3XT6S7TZ.js → chunk-XEHQJMMQ.js} +1 -1
  31. package/dist/esm/{index-aVljLqR4.d.ts → index-CWldA6G5.d.ts} +33 -0
  32. package/dist/esm/index.d.ts +1 -1
  33. package/dist/esm/index.js +1 -1
  34. package/dist/esm/internal/index.d.ts +1 -1
  35. package/dist/esm/internal/index.js +1 -1
  36. package/dist/esm/jsx-dev-runtime.js +1 -1
  37. package/dist/esm/{jsx-runtime-7EPQR56T.js → jsx-runtime-P2HN3TPO.js} +1 -1
  38. package/dist/esm/jsx-runtime.js +1 -1
  39. package/dist/{cjs/server.types-BRWsA1CA.d.cts → esm/server.types-Cc6o5eYH.d.ts} +1 -1
  40. package/dist/esm/servers/express.d.ts +3 -3
  41. package/dist/esm/servers/express.js +1 -1
  42. package/dist/esm/servers/h3.d.ts +3 -3
  43. package/dist/esm/servers/h3.js +1 -1
  44. package/dist/esm/servers/hono.d.ts +18 -0
  45. package/dist/esm/servers/hono.js +1 -0
  46. package/dist/esm/servers/lambda.d.ts +3 -3
  47. package/dist/esm/servers/lambda.js +1 -1
  48. package/dist/esm/servers/nest.d.ts +6 -3
  49. package/dist/esm/servers/nest.js +1 -1
  50. package/dist/esm/servers/next.d.ts +8 -3
  51. package/dist/esm/servers/next.js +1 -1
  52. package/dist/esm/servers/nuxt.d.ts +3 -3
  53. package/dist/esm/servers/nuxt.js +1 -1
  54. package/dist/esm/servers/remix.d.ts +3 -3
  55. package/dist/esm/servers/remix.js +1 -1
  56. package/dist/esm/servers/sveltekit.d.ts +3 -3
  57. package/dist/esm/servers/sveltekit.js +1 -1
  58. package/hono/package.json +3 -0
  59. package/package.json +18 -1
  60. package/dist/esm/chunk-E2MET7IR.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as U,b as D,c as F,d as M,e as $,f as L,g as H,h as B,i as j,j as W,k as V,l as q,m as G,n as X,o as K,p as z,q as Y,r as J}from"./chunk-46AHJTS7.js";import{d as Q,g,i as Z,q as ee,r as te,s as c,t as y,u as T,v as ne}from"./chunk-FRWG7YTE.js";import{a as re,c as oe,f as se}from"./chunk-W6DIBD4Z.js";var ie=class extends T{constructor(n){super("Unknown BridgeError",{cause:n});this.statusCode=500;this.code="BridgeError"}};var le=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}}},pe=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}},de=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}},ce=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}},ue=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}},ge=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}},me=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}},fe=class extends c{constructor(n,r,o,i){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=i}},ye=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 he=e=>Object.values(g).includes(e==null?void 0:e.code),bt=e=>!he(e)&&typeof e.statusCode=="number"&&e.statusCode>=400&&e.statusCode<500;var k=e=>Object.values(e).map(t=>`\`${t}\``).join(", "),E=e=>e.replaceAll(/(\w)(\w*)/g,(t,n,r)=>n.toUpperCase()+r.toLowerCase()).replaceAll(/[\s-]+/g,"");var Re=class extends ee{constructor(){super(...arguments);this.code="MethodNotAllowedError";this.statusCode=405;this.message=`Method not allowed. Please use one of ${k(Z)}`}},Ae=class extends c{constructor(n,r){super(`Invalid query string: \`action\`=\`${n}\`. Please use one of ${k(r)}`);this.code="InvalidActionError"}},Se=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 xe=class extends Error{constructor(t,n,r){super(),this.data={message:r},this.statusCode=t,this.code=n}};var h=class extends ne{constructor(t,n){super(`${E(t)} with id: \`${n}\` already exists. Please use a different id.`)}},m=class extends te{constructor(t,n){super(`${E(t)} with id: \`${n}\` does not exist. Please provide a valid id.`)}},R=class extends T{constructor(n,r,o,i){super(`Failed to ${o} ${E(n)} with id: \`${r}\``,{cause:i});this.statusCode=502}};var _e=class extends m{constructor(n){super("provider",n);this.code="ProviderNotFoundError"}},ve=class extends R{constructor(n,r,o){super("provider",n,r,o);this.code="ProviderExecutionFailedError"}};var Ee=class extends y{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"}},Ce=class extends y{constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");this.code="SignatureNotFoundError"}},we=class extends y{constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");this.code="SignatureInvalidError"}},Oe=class extends y{constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`novu-signature\` header`);this.code="SignatureExpiredError"}},Ie=class extends y{constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");this.code="SigningKeyNotFoundError"}},be=class extends y{constructor(){super("Signature version is invalid. Please provide a signature version with version `v1` in the `novu-signature` header");this.code="SignatureVersionInvalidError"}};var ke=class extends m{constructor(n){super("step",n);this.code="StepNotFoundError"}},Pe=class extends h{constructor(n){super("step",n);this.code="StepAlreadyExistsError"}},Ne=class extends R{constructor(n,r,o){super("step",n,r,o);this.code="StepExecutionFailedError"}};var Ue=class extends m{constructor(n){super("workflow",n);this.code="WorkflowNotFoundError"}},De=class extends h{constructor(n){super("workflow",n);this.code="WorkflowAlreadyExistsError"}};function nt(e,t){let n={...e};for(let r of Object.keys(t)){let o=t[r];o&&typeof o=="object"&&!Array.isArray(o)?n[r]=nt(n[r]||{},o):(Array.isArray(o),n[r]=o)}return n}function C(e,t){let n=t.split(".").reduce((r,o)=>{if(r&&typeof r=="object")return r[o]},e);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 Fe(e,t=2,n,r=", "){if(!Array.isArray(e)||e.length===0)return"";let o=n?e.map(a=>typeof a!="object"||!a?"":C(a,n)):e;if(o.length===1)return o[0];if(o.length===2)return`${o[0]} and ${o[1]}`;if(o.length===3&&t>=3)return`${o[0]}${r}${o[1]} and ${o[2]}`;let i=o.slice(0,t),p=o.length-t;return`${i.join(r)} and ${p} ${p===1?"other":"others"}`}import rt from"pluralize";function Me(e,t="",n="",r="true"){if(e==null)return"";let o=0;if(Array.isArray(e)?o=e.length:typeof e=="object"?o=Object.keys(e).length:typeof e=="string"?o=+e:typeof e=="number"?o=e:o=Number(e),Number.isNaN(o)&&(o=0),o<=0)return"";let i;return n?i=o===1?t:n:i=rt(t,o),r==="true"?`${o} ${i}`:i}import{TokenKind as $e}from"liquidjs";import ot from"pluralize";import{z as f}from"zod";var He="",Be=2,je="other",We=", ",Ve=" and ",qe=", and ",Le={0:"keyPath",1:"limit",2:"overflowSuffix",3:"wordsConnector",4:"twoWordsConnector",5:"lastWordConnector"};function Ge(e,t=He,n=Be,r=je,o=We,i=Ve,p=qe){if(!Array.isArray(e)||e.length===0)return"";let a=t?e.map(u=>typeof u!="object"||!u?"":C(u,t)):e,l=a.length;if(l===1)return a[0];if(l===2)return`${a[0]}${i}${a[1]}`;if(n>=l){let u=a.slice(0,l-1),N=a[l-1];return`${u.join(o)}${p}${N}`}let s=a.slice(0,n),d=l-n,v=n===1?i:p;return`${s.join(o)}${v}${d} ${ot(r,d)}`}function On(e={},...t){let{requireKeyPath:n=!1}=e,r=[];if(t.length<1)return r.push({message:"Expected at least 1 argument",begin:0,end:0,value:""}),r;let o=f.object({keyPath:n?f.string().min(1,"must be non-empty"):f.string().optional().default(He),limit:f.number().optional().default(Be).refine(a=>a>=0,"must be greater than or equal to 0"),overflowSuffix:f.string().optional().default(je),wordsConnector:f.string().optional().default(We),twoWordsConnector:f.string().optional().default(Ve),lastWordConnector:f.string().optional().default(qe)}),i={};t.forEach((a,l)=>{if(!Array.isArray(a)){let s=a.getText();(a.kind===$e.Quoted||a.kind===$e.Number)&&(s=a.content);let d=Le[l];i[d]=s}});let p=o.safeParse(i);if(!p.success)for(let a of p.error.issues){let l="string";"type"in a&&(l=a.type);let s=a.path[0],d=Object.entries(Le).find(([N,tt])=>tt===s),v=d?parseInt(d[0],10):null,u=typeof v=="number"?t[v]:null;u&&!Array.isArray(u)&&r.push({message:`"toSentence" expects a ${l}${a.message?` that ${a.message}`:""} for argument "${s}"`,begin:u.begin,end:u.end,value:u.getText()})}return r}import{Liquid as st}from"liquidjs";function it(e){return Array.isArray(e)||typeof e=="object"&&e!==null?Xe(e):typeof e=="string"?e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"):e==null?"":String(e)}var Xe=(e,t=0)=>Array.isArray(e)||typeof e=="object"&&e!==null?JSON.stringify(e,null,t).replace(/"/g,"'").replace(/\n/g,"\\n"):e==null?"":String(e);function Dn(e){let t=new st({outputEscape:it,...e});return t.registerFilter("json",(n,r)=>Xe(n,r)),t.registerFilter("digest",Fe),t.registerFilter("toSentence",Ge),t.registerFilter("pluralize",Me),t}var at={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 w(e){return typeof e=="string"&&e.trim()?e:!e||typeof e!="object"?null:w(e.message)}function lt(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!="object")return null;let n=t,r=w(n.message);if(r)return r;let o=w(n.error);if(o)return o;let i=n.errors;return Array.isArray(i)?w(i[0]):null}function pt(e,t){var o;let n=(o=at[e])!=null?o:e,r=lt(t);return r?`Delivery failed: ${n}: ${r}`:`Delivery failed: ${n}`}var A=class extends Error{constructor(t,n){super(t),this.name="AgentError",this.cause=n==null?void 0:n.cause,this.delivery=n==null?void 0:n.delivery}},O=class extends A{constructor(t,n){let r={statusCode:t,responseBody:n};super(pt(t,n),{delivery:r}),this.name="AgentDeliveryError",this.statusCode=t,this.responseBody=n}};function Mn(e){return e instanceof A?e:e instanceof Error?new A(e.message,{cause:e}):new A("Turn failed",{cause:e})}var dt=(o=>(o.ON_MESSAGE="onMessage",o.ON_ACTION="onAction",o.ON_RESOLVE="onResolve",o.ON_REACTION="onReaction",o))(dt||{}),I=class{constructor(){this.__novuPendingApproval=!0}};function Ln(e){return typeof e=="object"&&e!==null&&"suppress"in e&&e.suppress===!0}var ct=Symbol.for("chat.jsx.element"),ut=new Set([U,D,F,M,$,L,G,H,B,j,W,X,K,V,z,Y,q,J]);function gt(e){return typeof e=="object"&&e!==null&&e.$$typeof===ct}async function Ke(e){let t=b(e);if(t&&typeof t=="object"&&oe(t))return t;let{isJSX:n,toCardElement:r}=await import("./jsx-runtime-P2HN3TPO.js");return n(t)?r(t):null}function b(e){var t;if(Array.isArray(e))return e.map(n=>b(n));if(!gt(e))return e;if(typeof e.type=="function"&&!ut.has(e.type)){let n={...(t=e.props)!=null?t:{}};return e.children!==void 0&&(n.children=e.children),b(e.type(n))}return{...e,children:b(e.children)}}var mt=5*1024*1024,ft=5*1024*1024,ze=32768,yt=/^[A-Za-z0-9+/]*={0,2}$/;function _(e,t){return e.filename?`"${e.filename}"`:`at index ${t}`}function Qe(){return globalThis.Buffer}function ht(e){var t,n,r;return(r=(n=(t=Qe())==null?void 0:t.isBuffer)==null?void 0:n.call(t,e))!=null?r:!1}function Rt(e){return typeof Blob!="undefined"&&e instanceof Blob}function P(e){let t=Qe();if(t)return t.from(e).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<e.length;r+=ze){let o=e.subarray(r,r+ze);n+=String.fromCharCode(...o)}return btoa(n)}function Ze(e){let t=e.replace(/\s/g,""),n=t.length%4;if(!t||n===1||!yt.test(t))return null;let r=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.floor(t.length*3/4)-r}function S(e,t,n){if(e>mt)throw new Error(`Invalid file ${_(t,n)}: inline data must be 5 MB or smaller. Use a publicly-accessible URL for larger files.`)}async function At(e,t,n){if(typeof e=="string"){let r=Ze(e);if(r===null)throw new Error(`Invalid file ${_(t,n)}: data must be a base64-encoded string.`);return S(r,t,n),e}if(ht(e))return S(e.byteLength,t,n),e.toString("base64");if(e instanceof Uint8Array)return S(e.byteLength,t,n),P(e);if(e instanceof ArrayBuffer)return S(e.byteLength,t,n),P(new Uint8Array(e));if(Rt(e))return S(e.size,t,n),P(new Uint8Array(await e.arrayBuffer()));throw new Error(`Invalid file ${_(t,n)}: data must be a base64 string, Buffer, Uint8Array, ArrayBuffer, or Blob.`)}async function St(e){if(!(e!=null&&e.length))return;let t=[],n=0;for(let[r,o]of e.entries()){let i=o.data,p=o.url,a=i!=null,l=p!=null;if(a===l)throw new Error(`Invalid file ${_(o,r)}: provide exactly one of data or url.`);if(a){let s=await At(i,o,r),d=Ze(s);if(n+=d!=null?d:0,n>ft)throw new Error("Invalid files: total inline data must be 5 MB or smaller. Use publicly-accessible URLs for larger files.");t.push({...o,data:s});continue}if(l&&typeof p!="string")throw new Error(`Invalid file ${_(o,r)}: url must be a string.`);t.push(o)}return t}async function et(e,t){let n=await St(t);if(typeof e=="string")return n?{markdown:e,files:n}:{markdown:e};let r=await Ke(e);if(r)return n?{card:r,files:n}:{card:r};throw new Error("Invalid message content \u2014 expected string or CardElement")}var x=class{constructor(t,n,r,o,i){this.conversationId=r;this.integrationIdentifier=o;this.poster=i;this.editedByHandler=!1;this.messageId=t,this.platformThreadId=n}async edit(t,n){this.editedByHandler=!0;let r=await this.poster.post({conversationId:this.conversationId,integrationIdentifier:this.integrationIdentifier,edit:{messageId:this.messageId,content:await et(t,n==null?void 0:n.files)}});if(!r)throw new Error("Agent edit did not return a message handle");return this.messageId=r.messageId,this.platformThreadId=r.platformThreadId,this}async delete(){await this.poster.post({conversationId:this.conversationId,integrationIdentifier:this.integrationIdentifier,deleteMessages:[{messageId:this.messageId}]})}},Je;Je=re;var Ye=class{constructor(t,n,r){this[Je]=!0;this._signals=[];this._toolResults=[];this._pendingToolApprovalRequest=null;this._pendingReactions=[];this._pendingDeletes=[];this._resolveSignal=null;var a,l;this.event=t.event,this.action=(a=t.action)!=null?a:null,this.message=t.message,this.reaction=t.reaction,this.conversation=t.conversation,this.subscriber=t.subscriber,this.history=t.history,this.platform=t.platform,this.platformContext=t.platformContext,this._replyUrl=t.replyUrl,this._conversationId=t.conversationId,this._integrationIdentifier=t.integrationIdentifier,this._secretKey=n,this._poster={post:s=>this._post(s)},this._toolApprovalConfig=r,this._metadataState={...(l=t.conversation.metadata)!=null?l:{}};let o=this;this.metadata={get(s){return o._metadataState[s]},set(s,d){o._metadataState[s]=d,o._signals.push({type:"metadata",action:"set",key:s,value:d})},delete(s){delete o._metadataState[s],o._signals.push({type:"metadata",action:"delete",key:s})},clear(){o._metadataState={},o._signals.push({type:"metadata",action:"clear"})},get current(){return{...o._metadataState}}};let i=s=>this._post({conversationId:this._conversationId,integrationIdentifier:this._integrationIdentifier,typing:s}).then(()=>{}),p=(s=>i(s===void 0?{}:{status:s}));p.stop=()=>i("stop"),this.typing=p,this.toolApproval={request:async s=>(await se(this,s,this._toolApprovalConfig),new I)}}asMessageContext(){return this}async reply(t,n){let r=await et(t,n==null?void 0:n.files),o={conversationId:this._conversationId,integrationIdentifier:this._integrationIdentifier,reply:r};this._drainSideEffects(o);let i=await this._post(o);if(!i)throw new Error("Agent reply did not return a message handle");return new x(i.messageId,i.platformThreadId,this._conversationId,this._integrationIdentifier,this._poster)}async replyApprovalCard(t){let n={conversationId:this._conversationId,integrationIdentifier:this._integrationIdentifier,reply:{toolApprovalCard:t}};this._drainSideEffects(n);let r=await this._post(n);if(!r)throw new Error("Agent approval card reply did not return a message handle");return new x(r.messageId,r.platformThreadId,this._conversationId,this._integrationIdentifier,this._poster)}createReplyHandle(t){return new x(t,"",this._conversationId,this._integrationIdentifier,this._poster)}resolve(t){this._resolveSignal={summary:t}}trigger(t,n){this._signals.push({...n,type:"trigger",workflowId:t})}emitToolApprovalRequest(t){if(this._pendingToolApprovalRequest)throw new Error("Only one tool approval request can be queued before the next reply");this._pendingToolApprovalRequest=t}emitToolResult(t){this._toolResults.push(t)}addReaction(t,n){this._pendingReactions.push({messageId:t,emojiName:n})}deleteMessage(t){this._pendingDeletes.push({messageId:t})}async reportTurnError(){try{await this._post({conversationId:this._conversationId,integrationIdentifier:this._integrationIdentifier,error:!0})}catch(t){console.error("[agent] Failed to report turn error:",t)}}async flush(){if(!this._hasPendingSideEffects())return;let t={conversationId:this._conversationId,integrationIdentifier:this._integrationIdentifier};this._drainSideEffects(t),await this._post(t)}_hasPendingSideEffects(){return!!(this._pendingToolApprovalRequest||this._signals.length||this._toolResults.length||this._resolveSignal||this._pendingReactions.length||this._pendingDeletes.length)}_drainSideEffects(t){this._pendingToolApprovalRequest&&(t.toolApprovalRequest=this._pendingToolApprovalRequest,this._pendingToolApprovalRequest=null),this._signals.length&&(t.signals=this._signals,this._signals=[]),this._toolResults.length&&(t.toolResults=this._toolResults,this._toolResults=[]),this._pendingReactions.length&&(t.addReactions=this._pendingReactions,this._pendingReactions=[]),this._pendingDeletes.length&&(t.deleteMessages=this._pendingDeletes,this._pendingDeletes=[]),this._resolveSignal&&(t.resolve=this._resolveSignal,this._resolveSignal=null)}async _post(t){let n=await fetch(this._replyUrl,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${this._secretKey}`},body:JSON.stringify(t)});if(!n.ok){let o=await n.text().catch(()=>"");throw new O(n.status,o)}let r=await n.text().catch(()=>"");if(!r)return null;try{let o=JSON.parse(r),i=o&&typeof o=="object"&&"data"in o?o.data:o;if(i&&typeof i.messageId=="string"&&typeof i.platformThreadId=="string")return{messageId:i.messageId,platformThreadId:i.platformThreadId}}catch{}return null}};var Jn={type:"object",properties:{},required:[],additionalProperties:!1};var xt=(s=>(s.PENDING="pending",s.QUEUED="queued",s.RUNNING="running",s.COMPLETED="completed",s.FAILED="failed",s.DELAYED="delayed",s.CANCELED="canceled",s.MERGED="merged",s.SKIPPED="skipped",s))(xt||{});var _t=(o=>(o.NONE="none",o.LOW="low",o.MEDIUM="medium",o.HIGH="high",o))(_t||{});export{ie as a,le as b,pe as c,de as d,ce as e,ue as f,ge as g,me as h,fe as i,ye as j,he as k,bt as l,Re as m,Ae as n,Se as o,xe as p,h as q,m as r,R as s,_e as t,ve as u,Ee as v,Ce as w,we as x,Oe as y,Ie as z,be as A,ke as B,Pe as C,Ne as D,Ue as E,De as F,nt as G,Fe as H,Me as I,Ge as J,On as K,Dn as L,A as M,O as N,Mn as O,dt as P,I as Q,Ln as R,Ye as S,Jn as T,xt as U,_t as V};
@@ -19,4 +19,4 @@ import{a as $i,b as Qi,c as Wi}from"./chunk-FHYMHX3T.js";var mi=$i((cg,pi)=>{"us
19
19
  `)}function Qg(e){return Rn().use(gt).use(ht).parse(e)}function Wg(e){return me(e)}function Yg(e){return{type:"text",value:e}}function Jg(e){return{type:"paragraph",children:e}}function Zg(e){return{type:"root",children:e}}function eu(e={}){var n;return{type:"card",title:e.title,subtitle:e.subtitle,imageUrl:e.imageUrl,children:(n=e.children)!=null?n:[]}}function On(e,n={}){return{type:"text",content:e,style:n.style}}var Xg=On;function wi(e){return{type:"image",url:e.url,alt:e.alt}}function Si(){return{type:"divider"}}function Ei(e){return{type:"section",children:e}}function Ci(e){return{type:"actions",children:e}}function Ti(e){return{type:"button",id:e.id,label:e.label,style:e.style,value:e.value,disabled:e.disabled,actionType:e.actionType,callbackUrl:e.callbackUrl}}function Li(e){return{type:"link-button",id:e.id,url:e.url,label:e.label,style:e.style}}function Ii(e){return{type:"field",label:e.label,value:e.value}}function Ai(e){return{type:"fields",children:e}}function qi(e){return{type:"table",headers:e.headers,rows:e.rows,align:e.align}}function Fi(e){return{type:"link",url:e.url,label:e.label}}function Kg(e){let n=[];e.title&&n.push(`**${e.title}**`),e.subtitle&&n.push(e.subtitle);for(let t of e.children){let r=Mi(t);r&&n.push(r)}return n.join(`
20
20
  `)}function Mi(e){switch(e.type){case"text":return e.content;case"link":return`${e.label} (${e.url})`;case"fields":return e.children.map(n=>`${n.label}: ${n.value}`).join(`
21
21
  `);case"actions":return null;case"table":return Ka(e.headers,e.rows);case"section":return e.children.map(n=>Mi(n)).filter(Boolean).join(`
22
- `);default:return null}}var tu=["text_input","select","external_select","radio_select","text","fields"];function nu(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="modal"}function ru(e){let n=e.filter(t=>typeof t=="object"&&t!==null&&"type"in t&&tu.includes(t.type));return n.length<e.length&&console.warn("[chat] Modal contains unsupported child elements that were ignored"),n}function zi(e){var n;return{type:"modal",callbackId:e.callbackId,callbackUrl:e.callbackUrl,title:e.title,submitLabel:e.submitLabel,closeLabel:e.closeLabel,notifyOnClose:e.notifyOnClose,privateMetadata:e.privateMetadata,children:(n=e.children)!=null?n:[]}}function vi(e){return{type:"text_input",id:e.id,label:e.label,placeholder:e.placeholder,initialValue:e.initialValue,multiline:e.multiline,optional:e.optional,maxLength:e.maxLength}}function Di(e){if(!e.options||e.options.length===0)throw new Error("Select requires at least one option");return{type:"select",id:e.id,label:e.label,placeholder:e.placeholder,options:e.options,initialOption:e.initialOption,optional:e.optional}}function Pi(e){return{type:"external_select",id:e.id,initialOption:e.initialOption,label:e.label,placeholder:e.placeholder,minQueryLength:e.minQueryLength,optional:e.optional}}function Ri(e){return{label:e.label,value:e.value,description:e.description}}function Oi(e){if(!e.options||e.options.length===0)throw new Error("RadioSelect requires at least one option");return{type:"radio_select",id:e.id,label:e.label,options:e.options,initialOption:e.initialOption,optional:e.optional}}var Bn=Symbol.for("chat.jsx.element");function yt(e){return typeof e=="object"&&e!==null&&e.$$typeof===Bn}function Mn(e){if(e==null)return[];if(Array.isArray(e))return e.flatMap(Mn);if(yt(e)){let n=Nn(e);return n?[n]:[]}return typeof e=="object"&&"type"in e?[e]:typeof e=="string"||typeof e=="number"?[String(e)]:[]}function iu(e){return!("id"in e||"url"in e||"label"in e)}function ou(e){return"id"in e&&typeof e.id=="string"&&!("url"in e)}function lu(e){return"url"in e&&typeof e.url=="string"&&!("id"in e)}function au(e){return"url"in e&&typeof e.url=="string"&&!("id"in e)&&!("alt"in e)&&!("style"in e)}function uu(e){return"url"in e&&typeof e.url=="string"}function su(e){return"label"in e&&"value"in e&&typeof e.label=="string"&&typeof e.value=="string"}function cu(e){return!("id"in e||"url"in e||"callbackId"in e)&&("title"in e||"subtitle"in e||"imageUrl"in e)}function fu(e){return"callbackId"in e&&"title"in e}function pu(e){return"id"in e&&"label"in e&&!("options"in e)&&!("value"in e)}function Bi(e){return"id"in e&&"label"in e&&!("value"in e)}function mu(e){return"id"in e&&"label"in e&&!("value"in e)&&!("children"in e)}function hu(e){return"label"in e&&"value"in e&&!("id"in e)}function Nn(e){var o,a,u,s;let{type:n,props:t,children:r}=e,i=Mn(r);if(n===On){let c=iu(t)?t:{style:void 0},f=i.length>0?i.map(String).join(""):String((o=c.children)!=null?o:"");return On(f,{style:c.style})}if(n===Ei)return Ei(i);if(n===Ci)return Ci(i);if(n===Ai)return Ai(i);if(n===Ti){if(!ou(t))throw new Error("Button requires an 'id' prop");let c=i.length>0?i.map(String).join(""):(a=t.label)!=null?a:"";return Ti({id:t.id,label:c,style:t.style,value:t.value,actionType:t.actionType,callbackUrl:t.callbackUrl,disabled:t.disabled})}if(n===Li){if(!lu(t))throw new Error("LinkButton requires a 'url' prop");let c=i.length>0?i.map(String).join(""):(u=t.label)!=null?u:"";return Li({id:t.id,url:t.url,label:c,style:t.style})}if(n===Fi){if(!au(t))throw new Error("CardLink requires a 'url' prop");let c=i.length>0?i.map(String).join(""):(s=t.label)!=null?s:"";return Fi({url:t.url,label:c})}if(n===wi){if(!uu(t))throw new Error("Image requires a 'url' prop");return wi({url:t.url,alt:t.alt})}if(n===Ii){if(!su(t))throw new Error("Field requires 'label' and 'value' props");return Ii({label:t.label,value:t.value})}if(n===Si)return Si();if(n===zi){if(!fu(t))throw new Error("Modal requires 'callbackId' and 'title' props");return zi({callbackId:t.callbackId,callbackUrl:t.callbackUrl,title:t.title,submitLabel:t.submitLabel,closeLabel:t.closeLabel,notifyOnClose:t.notifyOnClose,privateMetadata:t.privateMetadata,children:ru(i)})}if(n===vi){if(!pu(t))throw new Error("TextInput requires 'id' and 'label' props");return vi({id:t.id,label:t.label,placeholder:t.placeholder,initialValue:t.initialValue,multiline:t.multiline,optional:t.optional,maxLength:t.maxLength})}if(n===Di){if(!Bi(t))throw new Error("Select requires 'id' and 'label' props");return Di({id:t.id,label:t.label,placeholder:t.placeholder,initialOption:t.initialOption,optional:t.optional,options:i})}if(n===Pi){if(!mu(t))throw new Error("ExternalSelect requires 'id' and 'label' props");return Pi({id:t.id,initialOption:t.initialOption,label:t.label,placeholder:t.placeholder,minQueryLength:t.minQueryLength,optional:t.optional})}if(n===Oi){if(!Bi(t))throw new Error("RadioSelect requires 'id' and 'label' props");return Oi({id:t.id,label:t.label,initialOption:t.initialOption,optional:t.optional,options:i})}if(n===Ri){if(!hu(t))throw new Error("SelectOption requires 'label' and 'value' props");return Ri({label:t.label,value:t.value,description:t.description})}if(n===qi){let c=t;return qi({headers:c.headers,rows:c.rows})}let l=cu(t)?t:{};return eu({title:l.title,subtitle:l.subtitle,imageUrl:l.imageUrl,children:i})}function gu(e,n,t){let{children:r,...i}=n;return{$$typeof:Bn,type:e,props:i,children:r!=null?[r]:[]}}function ed(e,n,t){let{children:r,...i}=n,l;return Array.isArray(r)?l=r:r!=null?l=[r]:l=[],{$$typeof:Bn,type:e,props:i,children:l}}var td=gu;function nd(e){return Mn(e.children)}function rd(e){if(yt(e)){let n=Nn(e);if(n&&typeof n=="object"&&"type"in n&&n.type==="card")return n}return typeof e=="object"&&e!==null&&"type"in e&&e.type==="card"?e:null}function id(e){if(yt(e)){let n=Nn(e);if(n&&typeof n=="object"&&"type"in n&&n.type==="modal")return n}return nu(e)?e:null}function od(e){if(yt(e))return!0;if(typeof e=="object"&&e!==null&&"$$typeof"in e&&typeof e.$$typeof=="symbol"){let n=e.$$typeof.toString();return n.includes("react.element")||n.includes("react.transitional.element")}return!1}export{Qg as a,Wg as b,Yg as c,Jg as d,Zg as e,eu as f,Xg as g,Si as h,Ci as i,Ti as j,Fi as k,Kg as l,vi as m,Di as n,Ri as o,au as p,gu as q,ed as r,td as s,nd as t,rd as u,id as v,od as w};
22
+ `);default:return null}}var tu=["text_input","select","external_select","radio_select","text","fields"];function nu(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="modal"}function ru(e){let n=e.filter(t=>typeof t=="object"&&t!==null&&"type"in t&&tu.includes(t.type));return n.length<e.length&&console.warn("[chat] Modal contains unsupported child elements that were ignored"),n}function zi(e){var n;return{type:"modal",callbackId:e.callbackId,callbackUrl:e.callbackUrl,title:e.title,submitLabel:e.submitLabel,closeLabel:e.closeLabel,notifyOnClose:e.notifyOnClose,privateMetadata:e.privateMetadata,children:(n=e.children)!=null?n:[]}}function vi(e){return{type:"text_input",id:e.id,label:e.label,placeholder:e.placeholder,initialValue:e.initialValue,multiline:e.multiline,optional:e.optional,maxLength:e.maxLength}}function Di(e){if(!e.options||e.options.length===0)throw new Error("Select requires at least one option");return{type:"select",id:e.id,label:e.label,placeholder:e.placeholder,options:e.options,initialOption:e.initialOption,optional:e.optional}}function Pi(e){return{type:"external_select",id:e.id,initialOption:e.initialOption,label:e.label,placeholder:e.placeholder,minQueryLength:e.minQueryLength,optional:e.optional}}function Ri(e){return{label:e.label,value:e.value,description:e.description}}function Oi(e){if(!e.options||e.options.length===0)throw new Error("RadioSelect requires at least one option");return{type:"radio_select",id:e.id,label:e.label,options:e.options,initialOption:e.initialOption,optional:e.optional}}var Bn=Symbol.for("chat.jsx.element");function yt(e){return typeof e=="object"&&e!==null&&e.$$typeof===Bn}function Mn(e){if(e==null)return[];if(Array.isArray(e))return e.flatMap(Mn);if(yt(e)){let n=Nn(e);return n?[n]:[]}return typeof e=="object"&&"type"in e?[e]:typeof e=="string"||typeof e=="number"?[String(e)]:[]}function iu(e){return!("id"in e||"url"in e||"label"in e)}function ou(e){return"id"in e&&typeof e.id=="string"&&!("url"in e)}function lu(e){return"url"in e&&typeof e.url=="string"&&!("id"in e)}function au(e){return"url"in e&&typeof e.url=="string"&&!("id"in e)&&!("alt"in e)&&!("style"in e)}function uu(e){return"url"in e&&typeof e.url=="string"}function su(e){return"label"in e&&"value"in e&&typeof e.label=="string"&&typeof e.value=="string"}function cu(e){return!("id"in e||"url"in e||"callbackId"in e)&&("title"in e||"subtitle"in e||"imageUrl"in e)}function fu(e){return"callbackId"in e&&"title"in e}function pu(e){return"id"in e&&"label"in e&&!("options"in e)&&!("value"in e)}function Bi(e){return"id"in e&&"label"in e&&!("value"in e)}function mu(e){return"id"in e&&"label"in e&&!("value"in e)&&!("children"in e)}function hu(e){return"label"in e&&"value"in e&&!("id"in e)}function Nn(e){var o,a,u,s;let{type:n,props:t,children:r}=e,i=Mn(r);if(n===On){let c=iu(t)?t:{style:void 0},f=i.length>0?i.map(String).join(""):String((o=c.children)!=null?o:"");return On(f,{style:c.style})}if(n===Ei)return Ei(i);if(n===Ci)return Ci(i);if(n===Ai)return Ai(i);if(n===Ti){if(!ou(t))throw new Error("Button requires an 'id' prop");let c=i.length>0?i.map(String).join(""):(a=t.label)!=null?a:"";return Ti({id:t.id,label:c,style:t.style,value:t.value,actionType:t.actionType,callbackUrl:t.callbackUrl,disabled:t.disabled})}if(n===Li){if(!lu(t))throw new Error("LinkButton requires a 'url' prop");let c=i.length>0?i.map(String).join(""):(u=t.label)!=null?u:"";return Li({id:t.id,url:t.url,label:c,style:t.style})}if(n===Fi){if(!au(t))throw new Error("CardLink requires a 'url' prop");let c=i.length>0?i.map(String).join(""):(s=t.label)!=null?s:"";return Fi({url:t.url,label:c})}if(n===wi){if(!uu(t))throw new Error("Image requires a 'url' prop");return wi({url:t.url,alt:t.alt})}if(n===Ii){if(!su(t))throw new Error("Field requires 'label' and 'value' props");return Ii({label:t.label,value:t.value})}if(n===Si)return Si();if(n===zi){if(!fu(t))throw new Error("Modal requires 'callbackId' and 'title' props");return zi({callbackId:t.callbackId,callbackUrl:t.callbackUrl,title:t.title,submitLabel:t.submitLabel,closeLabel:t.closeLabel,notifyOnClose:t.notifyOnClose,privateMetadata:t.privateMetadata,children:ru(i)})}if(n===vi){if(!pu(t))throw new Error("TextInput requires 'id' and 'label' props");return vi({id:t.id,label:t.label,placeholder:t.placeholder,initialValue:t.initialValue,multiline:t.multiline,optional:t.optional,maxLength:t.maxLength})}if(n===Di){if(!Bi(t))throw new Error("Select requires 'id' and 'label' props");return Di({id:t.id,label:t.label,placeholder:t.placeholder,initialOption:t.initialOption,optional:t.optional,options:i})}if(n===Pi){if(!mu(t))throw new Error("ExternalSelect requires 'id' and 'label' props");return Pi({id:t.id,initialOption:t.initialOption,label:t.label,placeholder:t.placeholder,minQueryLength:t.minQueryLength,optional:t.optional})}if(n===Oi){if(!Bi(t))throw new Error("RadioSelect requires 'id' and 'label' props");return Oi({id:t.id,label:t.label,initialOption:t.initialOption,optional:t.optional,options:i})}if(n===Ri){if(!hu(t))throw new Error("SelectOption requires 'label' and 'value' props");return Ri({label:t.label,value:t.value,description:t.description})}if(n===qi){let c=t;return qi({headers:c.headers,rows:c.rows})}let l=cu(t)?t:{};return eu({title:l.title,subtitle:l.subtitle,imageUrl:l.imageUrl,children:i})}function gu(e,n,t){let{children:r,...i}=n;return{$$typeof:Bn,type:e,props:i,children:r!=null?[r]:[]}}function ed(e,n,t){let{children:r,...i}=n,l;return Array.isArray(r)?l=r:r!=null?l=[r]:l=[],{$$typeof:Bn,type:e,props:i,children:l}}var td=gu;function nd(e){return Mn(e.children)}function rd(e){if(yt(e)){let n=Nn(e);if(n&&typeof n=="object"&&"type"in n&&n.type==="card")return n}return typeof e=="object"&&e!==null&&"type"in e&&e.type==="card"?e:null}function id(e){if(yt(e)){let n=Nn(e);if(n&&typeof n=="object"&&"type"in n&&n.type==="modal")return n}return nu(e)?e:null}function od(e){if(yt(e))return!0;if(typeof e=="object"&&e!==null&&"$$typeof"in e&&typeof e.$$typeof=="symbol"){let n=e.$$typeof.toString();return n.includes("react.element")||n.includes("react.transitional.element")}return!1}export{Qg as a,Wg as b,Yg as c,Jg as d,Zg as e,eu as f,Xg as g,wi as h,Si as i,Ei as j,Ci as k,Ti as l,Li as m,Ii as n,Ai as o,qi as p,Fi as q,Kg as r,zi as s,vi as t,Di as u,Pi as v,Ri as w,Oi as x,au as y,gu as z,ed as A,td as B,nd as C,rd as D,id as E,od as F};
@@ -106,6 +106,30 @@ interface ServeHandlerOptions {
106
106
  client?: Client;
107
107
  workflows?: Array<Workflow>;
108
108
  agents?: Array<Agent>;
109
+ /**
110
+ * Extends the lifetime of the request handler until the given promise settles.
111
+ *
112
+ * Agent events are acknowledged immediately while the turn (LLM calls, replies,
113
+ * tool use) continues in the background. On serverless platforms the runtime is
114
+ * frozen as soon as the response is sent, so the background work is silently
115
+ * dropped unless a platform `waitUntil` primitive is provided.
116
+ *
117
+ * The Next.js adapter (on Next.js >= 15.1) and the Hono adapter (on Cloudflare
118
+ * Workers) wire this automatically. Provide it explicitly for other serverless
119
+ * platforms, or to override the automatic detection.
120
+ *
121
+ * @example Cloudflare Workers (without Hono)
122
+ * ```ts
123
+ * export default {
124
+ * async fetch(request, env, ctx) {
125
+ * const handler = serve({ agents: [myAgent], waitUntil: (promise) => ctx.waitUntil(promise) });
126
+ *
127
+ * return handler(request);
128
+ * },
129
+ * };
130
+ * ```
131
+ */
132
+ waitUntil?: (promise: Promise<unknown>) => void;
109
133
  }
110
134
  type INovuRequestHandlerOptions<Input extends any[] = any[], Output = any> = ServeHandlerOptions & {
111
135
  frameworkName: string;
@@ -137,6 +161,7 @@ declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
137
161
  private readonly http;
138
162
  private readonly workflows;
139
163
  private readonly agents;
164
+ private readonly waitUntil?;
140
165
  constructor(options: INovuRequestHandlerOptions<Input, Output>);
141
166
  createHandler(): (...args: Input) => Promise<Output>;
142
167
  private getStaticHeaders;
@@ -144,6 +169,14 @@ declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
144
169
  private createError;
145
170
  private handleAction;
146
171
  private getPostActionMap;
172
+ /**
173
+ * Agent events are acknowledged immediately and the turn continues in the
174
+ * background. On serverless platforms the runtime freezes once the response
175
+ * is sent, so without a `waitUntil` primitive the turn is silently dropped
176
+ * mid-flight. Detecting the known freeze-prone platforms lets us surface an
177
+ * actionable warning instead of logs that just stop with no error.
178
+ */
179
+ private warnOnUnprotectedServerlessRuntime;
147
180
  triggerAction(triggerEvent: EventTriggerParams): () => Promise<IActionResponse<string>>;
148
181
  private getGetActionMap;
149
182
  private handlePostAction;
@@ -1,4 +1,4 @@
1
- export { C as Client, N as NovuRequestHandler, S as ServeHandlerOptions, a as agent, w as workflow } from './index-aVljLqR4.js';
1
+ export { C as Client, N as NovuRequestHandler, S as ServeHandlerOptions, a as agent, w as workflow } from './index-CWldA6G5.js';
2
2
  export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from './health-check.types-BNocZ4Wk.js';
3
3
  export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Select, SelectOption, TextInput } from 'chat';
4
4
  export { A as Agent, a as AgentAction, b as AgentActionContext, c as AgentAttachment, d as AgentContext, e as AgentConversation, f as AgentDeliveryError, g as AgentError, h as AgentHandlerContext, i as AgentHandlers, j as AgentHistoryEntry, k as AgentMessage, l as AgentMessageAuthor, m as AgentMessageContext, n as AgentPlatformContext, o as AgentReaction, p as AgentReactionContext, q as AgentResolveContext, r as AgentSubscriber, s as AgentToolCall, F as FileRef, M as MessageContent, R as ReplyHandle, T as ToolApprovalCard, t as ToolApprovalConfig, u as ToolApprovalDecision, v as toAgentError } from './agent.types-E3sxq6xr.js';
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{b as k,c as o,d as p,e as s}from"./chunk-TEOO6V72.js";import{a,b,c,d,e,f,g,h,i}from"./chunk-C3P3ZH2I.js";import"./chunk-3XT6S7TZ.js";import{a as t}from"./chunk-2M25EATE.js";import"./chunk-22DBAEUX.js";import{M as l,N as m,O as n,V as r}from"./chunk-E2MET7IR.js";import{a as q}from"./chunk-CANJPWLT.js";import{f as j}from"./chunk-FRWG7YTE.js";import"./chunk-W6DIBD4Z.js";import"./chunk-FHYMHX3T.js";export{a as Actions,m as AgentDeliveryError,l as AgentError,b as Button,c as Card,d as CardLink,e as CardText,k as Client,j as CronExpression,f as Divider,o as NovuRequestHandler,g as Select,h as SelectOption,r as SeverityLevelEnum,i as TextInput,p as agent,q as providerSchemas,t as step,n as toAgentError,s as workflow};
1
+ import{b as k,c as o,d as p,e as s}from"./chunk-BSFJB6OO.js";import{a as t}from"./chunk-2M25EATE.js";import"./chunk-22DBAEUX.js";import{M as l,N as m,O as n,V as r}from"./chunk-LHU5A7DI.js";import{a,b,c,d,e,f,p as g,q as h,r as i}from"./chunk-46AHJTS7.js";import"./chunk-XEHQJMMQ.js";import{a as q}from"./chunk-CANJPWLT.js";import{f as j}from"./chunk-FRWG7YTE.js";import"./chunk-W6DIBD4Z.js";import"./chunk-FHYMHX3T.js";export{a as Actions,m as AgentDeliveryError,l as AgentError,b as Button,c as Card,d as CardLink,e as CardText,k as Client,j as CronExpression,f as Divider,o as NovuRequestHandler,g as Select,h as SelectOption,r as SeverityLevelEnum,i as TextInput,p as agent,q as providerSchemas,t as step,n as toAgentError,s as workflow};
@@ -6,7 +6,7 @@ import { Emoji } from 'chat';
6
6
  import { h as AgentHandlerContext, z as ToolResult, B as ToolApprovalRequestPayload, T as ToolApprovalCard, R as ReplyHandle, m as AgentMessageContext, C as AgentEventEnum, a as AgentAction, k as AgentMessage, o as AgentReaction, e as AgentConversation, r as AgentSubscriber, j as AgentHistoryEntry, n as AgentPlatformContext, D as TypingControl, E as ToolApprovalControl, G as AgentBridgeRequest, t as ToolApprovalConfig, M as MessageContent, F as FileRef, H as AgentReplyPayload, S as SentMessageInfo, w as TriggerRecipientsPayload } from '../agent.types-E3sxq6xr.js';
7
7
  export { J as DeleteMessagePayload, K as EditPayload, L as MetadataSignal, P as ParsedApprovalAction, N as ReplyContent, O as Signal, Q as TriggerSignal, U as buildApprovalActionId, V as parseApprovalActionId } from '../agent.types-E3sxq6xr.js';
8
8
  export { a as FromSchema, F as FromSchemaUnvalidated, J as JsonSchema, S as Schema, Z as ZodSchema, b as ZodSchemaMinimal } from '../base.schema.types-BApIn9jr.js';
9
- export { S as SupportedFrameworkName } from '../server.types-BRWsA1CA.js';
9
+ export { S as SupportedFrameworkName } from '../server.types-Cc6o5eYH.js';
10
10
  export { A as Awaitable, C as ConditionalPartial, D as DeepPartial, b as DeepRequired, E as Either, I as Indexable, c as PickOptional, d as PickOptionalKeys, e as PickRequired, P as PickRequiredKeys, a as Prettify } from '../util.types-DaFfsxgy.js';
11
11
  export { a as ValidateFunction, V as ValidateResult, b as ValidationError, c as Validator } from '../validator.types-BIQli_m1.js';
12
12
  import 'json-schema-to-ts';
@@ -1 +1 @@
1
- import{A as oe,B as re,C as ae,D as pe,E as ne,F as ie,H as le,I as se,J as me,K as e,L as t,P as o,S as p,U as ge,V as fe,a as C,b as M,c as D,d as b,e as k,f as B,g as O,h as _,i as j,j as w,k as z,m as G,n as H,o as J,p as K,q as N,r as Q,s as U,t as W,u as X,v as Y,w as Z,x as $,y as ee,z as te}from"../chunk-E2MET7IR.js";import{e as n,f as i}from"../chunk-CANJPWLT.js";import{a as l,b as s,c as m,d as g,e as f,f as x,g as d,h as c,i as u,j as A,k as y,l as S,m as I,n as R,o as v,p as q,q as E,r as F,s as L,t as P,u as T,v as V,w as h}from"../chunk-FRWG7YTE.js";import{d as r,e as a}from"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";var de={toSentence:e};export{R as ActionStepEnum,p as AgentContextImpl,o as AgentEventEnum,L as BadRequestError,C as BridgeError,I as ChannelStepEnum,V as ConflictError,x as CronExpression,d as ErrorCodeEnum,b as ExecutionEventControlsInvalidError,D as ExecutionEventPayloadInvalidError,j as ExecutionProviderOutputInvalidError,k as ExecutionStateControlsInvalidError,M as ExecutionStateCorruptError,B as ExecutionStateOutputInvalidError,O as ExecutionStateResultInvalidError,de as FILTER_VALIDATORS,h as ForbiddenError,E as FrameworkError,s as GetActionEnum,c as HttpHeaderKeysEnum,u as HttpMethodEnum,A as HttpQueryKeysEnum,y as HttpStatusEnum,H as InvalidActionError,ge as JobStatusEnum,G as MethodNotAllowedError,J as MissingSecretKeyError,F as NotFoundError,m as NovuApiEndpointsEnum,K as PlatformError,l as PostActionEnum,X as ProviderExecutionFailedError,W as ProviderNotFoundError,N as ResourceConflictError,S as ResourceEnum,U as ResourceExecutionFailed,Q as ResourceNotFoundError,f as SIGNATURE_TIMESTAMP_TOLERANCE,g as SIGNATURE_TIMESTAMP_TOLERANCE_MINUTES,T as ServerError,fe as SeverityLevelEnum,ee as SignatureExpiredError,$ as SignatureInvalidError,Y as SignatureMismatchError,Z as SignatureNotFoundError,oe as SignatureVersionInvalidError,te as SigningKeyNotFoundError,ae as StepAlreadyExistsError,_ as StepControlCompilationFailedError,pe as StepExecutionFailedError,re as StepNotFoundError,P as UnauthorizedError,ie as WorkflowAlreadyExistsError,v as WorkflowChannelEnum,ne as WorkflowNotFoundError,w as WorkflowPayloadInvalidError,n as actionStepSchemas,r as buildApprovalActionId,i as channelStepSchemas,t as createLiquidEngine,le as digest,z as isFrameworkError,q as isNativeError,a as parseApprovalActionId,se as pluralize,me as toSentence,e as toSentenceArgsValidator};
1
+ import{A as oe,B as re,C as ae,D as pe,E as ne,F as ie,H as le,I as se,J as me,K as e,L as t,P as o,S as p,U as ge,V as fe,a as C,b as M,c as D,d as b,e as k,f as B,g as O,h as _,i as j,j as w,k as z,m as G,n as H,o as J,p as K,q as N,r as Q,s as U,t as W,u as X,v as Y,w as Z,x as $,y as ee,z as te}from"../chunk-LHU5A7DI.js";import"../chunk-46AHJTS7.js";import"../chunk-XEHQJMMQ.js";import{e as n,f as i}from"../chunk-CANJPWLT.js";import{a as l,b as s,c as m,d as g,e as f,f as x,g as d,h as c,i as u,j as A,k as y,l as S,m as I,n as R,o as v,p as q,q as E,r as F,s as L,t as P,u as T,v as V,w as h}from"../chunk-FRWG7YTE.js";import{d as r,e as a}from"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";var de={toSentence:e};export{R as ActionStepEnum,p as AgentContextImpl,o as AgentEventEnum,L as BadRequestError,C as BridgeError,I as ChannelStepEnum,V as ConflictError,x as CronExpression,d as ErrorCodeEnum,b as ExecutionEventControlsInvalidError,D as ExecutionEventPayloadInvalidError,j as ExecutionProviderOutputInvalidError,k as ExecutionStateControlsInvalidError,M as ExecutionStateCorruptError,B as ExecutionStateOutputInvalidError,O as ExecutionStateResultInvalidError,de as FILTER_VALIDATORS,h as ForbiddenError,E as FrameworkError,s as GetActionEnum,c as HttpHeaderKeysEnum,u as HttpMethodEnum,A as HttpQueryKeysEnum,y as HttpStatusEnum,H as InvalidActionError,ge as JobStatusEnum,G as MethodNotAllowedError,J as MissingSecretKeyError,F as NotFoundError,m as NovuApiEndpointsEnum,K as PlatformError,l as PostActionEnum,X as ProviderExecutionFailedError,W as ProviderNotFoundError,N as ResourceConflictError,S as ResourceEnum,U as ResourceExecutionFailed,Q as ResourceNotFoundError,f as SIGNATURE_TIMESTAMP_TOLERANCE,g as SIGNATURE_TIMESTAMP_TOLERANCE_MINUTES,T as ServerError,fe as SeverityLevelEnum,ee as SignatureExpiredError,$ as SignatureInvalidError,Y as SignatureMismatchError,Z as SignatureNotFoundError,oe as SignatureVersionInvalidError,te as SigningKeyNotFoundError,ae as StepAlreadyExistsError,_ as StepControlCompilationFailedError,pe as StepExecutionFailedError,re as StepNotFoundError,P as UnauthorizedError,ie as WorkflowAlreadyExistsError,v as WorkflowChannelEnum,ne as WorkflowNotFoundError,w as WorkflowPayloadInvalidError,n as actionStepSchemas,r as buildApprovalActionId,i as channelStepSchemas,t as createLiquidEngine,le as digest,z as isFrameworkError,q as isNativeError,a as parseApprovalActionId,se as pluralize,me as toSentence,e as toSentenceArgsValidator};
@@ -1 +1 @@
1
- import"./chunk-2GCKOQK4.js";import"./chunk-3ZWME5KT.js";import{q as s,r as x,s as e,t as j}from"./chunk-3XT6S7TZ.js";import"./chunk-FHYMHX3T.js";export{j as Fragment,s as jsx,e as jsxDEV,x as jsxs};
1
+ import"./chunk-2GCKOQK4.js";import"./chunk-3ZWME5KT.js";import{A as x,B as e,C as j,z as s}from"./chunk-XEHQJMMQ.js";import"./chunk-FHYMHX3T.js";export{j as Fragment,s as jsx,e as jsxDEV,x as jsxs};
@@ -1 +1 @@
1
- import"./chunk-3ZWME5KT.js";import{p as a,q as b,r as c,s as d,t as e,u as f,v as g,w as h}from"./chunk-3XT6S7TZ.js";import"./chunk-FHYMHX3T.js";export{e as Fragment,a as isCardLinkProps,h as isJSX,b as jsx,d as jsxDEV,c as jsxs,f as toCardElement,g as toModalElement};
1
+ import"./chunk-3ZWME5KT.js";import{A as c,B as d,C as e,D as f,E as g,F as h,y as a,z as b}from"./chunk-XEHQJMMQ.js";import"./chunk-FHYMHX3T.js";export{e as Fragment,a as isCardLinkProps,h as isJSX,b as jsx,d as jsxDEV,c as jsxs,f as toCardElement,g as toModalElement};
@@ -1 +1 @@
1
- import"./chunk-2GCKOQK4.js";import"./chunk-3ZWME5KT.js";import{q as a,r as b,s as c,t as d}from"./chunk-3XT6S7TZ.js";import"./chunk-FHYMHX3T.js";export{d as Fragment,a as jsx,c as jsxDEV,b as jsxs};
1
+ import"./chunk-2GCKOQK4.js";import"./chunk-3ZWME5KT.js";import{A as b,B as c,C as d,z as a}from"./chunk-XEHQJMMQ.js";import"./chunk-FHYMHX3T.js";export{d as Fragment,a as jsx,c as jsxDEV,b as jsxs};
@@ -1,3 +1,3 @@
1
- type SupportedFrameworkName = 'next' | 'express' | 'nuxt' | 'h3' | 'sveltekit' | 'remix' | 'lambda' | 'nest';
1
+ type SupportedFrameworkName = 'next' | 'express' | 'nuxt' | 'h3' | 'hono' | 'sveltekit' | 'remix' | 'lambda' | 'nest';
2
2
 
3
3
  export type { SupportedFrameworkName as S };
@@ -1,8 +1,8 @@
1
- import { S as ServeHandlerOptions } from '../index-aVljLqR4.js';
2
- export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-aVljLqR4.js';
1
+ import { S as ServeHandlerOptions } from '../index-CWldA6G5.js';
2
+ export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-CWldA6G5.js';
3
3
  export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-BNocZ4Wk.js';
4
4
  export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from '../subscriber.types-CmybpXhA.js';
5
- import { S as SupportedFrameworkName } from '../server.types-BRWsA1CA.js';
5
+ import { S as SupportedFrameworkName } from '../server.types-Cc6o5eYH.js';
6
6
  export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Select, SelectOption, TextInput } from 'chat';
7
7
  export { A as Agent, a as AgentAction, b as AgentActionContext, c as AgentAttachment, d as AgentContext, e as AgentConversation, f as AgentDeliveryError, g as AgentError, h as AgentHandlerContext, i as AgentHandlers, j as AgentHistoryEntry, k as AgentMessage, l as AgentMessageAuthor, m as AgentMessageContext, n as AgentPlatformContext, o as AgentReaction, p as AgentReactionContext, q as AgentResolveContext, r as AgentSubscriber, s as AgentToolCall, F as FileRef, M as MessageContent, R as ReplyHandle, T as ToolApprovalCard, t as ToolApprovalConfig, u as ToolApprovalDecision, v as toAgentError } from '../agent.types-E3sxq6xr.js';
8
8
  export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, step } from '../step-resolver.js';
@@ -1 +1 @@
1
- import{b as x,c as a,d as V,e as O}from"../chunk-TEOO6V72.js";import{a as y,b as h,c,d as m,e as f,f as H,g as v,h as w,i as E}from"../chunk-C3P3ZH2I.js";import"../chunk-3XT6S7TZ.js";import{a as $}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as A,N,O as R,V as k}from"../chunk-E2MET7IR.js";import{a as b}from"../chunk-CANJPWLT.js";import{f as S}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";var l="express",U=p=>new a({frameworkName:l,...p,handler:(t,o)=>({body:()=>t.body,headers:e=>{let r=t.headers[e];return Array.isArray(r)?r[0]:r},method:()=>t.method||"GET",url:()=>{let e=t.headers.host||"",r=e!=null&&e.includes("://")?"":`${t.protocol||"https"}://`;return new URL(t.originalUrl||t.url||"",`${r}${e||""}`)},queryString:e=>{let r=t.query[e];return Array.isArray(r)?r[0]:r},transformResponse:({body:e,headers:r,status:s})=>(Object.entries(r).forEach(([n,d])=>{o.setHeader(n,d)}),o.status(s).send(e))})}).createHandler();export{y as Actions,N as AgentDeliveryError,A as AgentError,h as Button,c as Card,m as CardLink,f as CardText,x as Client,S as CronExpression,H as Divider,a as NovuRequestHandler,v as Select,w as SelectOption,k as SeverityLevelEnum,E as TextInput,V as agent,l as frameworkName,b as providerSchemas,U as serve,$ as step,R as toAgentError,O as workflow};
1
+ import{b as x,c as a,d as V,e as O}from"../chunk-BSFJB6OO.js";import{a as $}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as A,N,O as R,V as k}from"../chunk-LHU5A7DI.js";import{a as y,b as h,c,d as m,e as f,f as H,p as v,q as w,r as E}from"../chunk-46AHJTS7.js";import"../chunk-XEHQJMMQ.js";import{a as b}from"../chunk-CANJPWLT.js";import{f as S}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";var l="express",U=p=>new a({frameworkName:l,...p,handler:(t,o)=>({body:()=>t.body,headers:e=>{let r=t.headers[e];return Array.isArray(r)?r[0]:r},method:()=>t.method||"GET",url:()=>{let e=t.headers.host||"",r=e!=null&&e.includes("://")?"":`${t.protocol||"https"}://`;return new URL(t.originalUrl||t.url||"",`${r}${e||""}`)},queryString:e=>{let r=t.query[e];return Array.isArray(r)?r[0]:r},transformResponse:({body:e,headers:r,status:s})=>(Object.entries(r).forEach(([n,d])=>{o.setHeader(n,d)}),o.status(s).send(e))})}).createHandler();export{y as Actions,N as AgentDeliveryError,A as AgentError,h as Button,c as Card,m as CardLink,f as CardText,x as Client,S as CronExpression,H as Divider,a as NovuRequestHandler,v as Select,w as SelectOption,k as SeverityLevelEnum,E as TextInput,V as agent,l as frameworkName,b as providerSchemas,U as serve,$ as step,R as toAgentError,O as workflow};
@@ -1,10 +1,10 @@
1
1
  import * as h3 from 'h3';
2
2
  import { H3Event } from 'h3';
3
- import { S as ServeHandlerOptions } from '../index-aVljLqR4.js';
4
- export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-aVljLqR4.js';
3
+ import { S as ServeHandlerOptions } from '../index-CWldA6G5.js';
4
+ export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-CWldA6G5.js';
5
5
  export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-BNocZ4Wk.js';
6
6
  export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from '../subscriber.types-CmybpXhA.js';
7
- import { S as SupportedFrameworkName } from '../server.types-BRWsA1CA.js';
7
+ import { S as SupportedFrameworkName } from '../server.types-Cc6o5eYH.js';
8
8
  export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Select, SelectOption, TextInput } from 'chat';
9
9
  export { A as Agent, a as AgentAction, b as AgentActionContext, c as AgentAttachment, d as AgentContext, e as AgentConversation, f as AgentDeliveryError, g as AgentError, h as AgentHandlerContext, i as AgentHandlers, j as AgentHistoryEntry, k as AgentMessage, l as AgentMessageAuthor, m as AgentMessageContext, n as AgentPlatformContext, o as AgentReaction, p as AgentReactionContext, q as AgentResolveContext, r as AgentSubscriber, s as AgentToolCall, F as FileRef, M as MessageContent, R as ReplyHandle, T as ToolApprovalCard, t as ToolApprovalConfig, u as ToolApprovalDecision, v as toAgentError } from '../agent.types-E3sxq6xr.js';
10
10
  export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, step } from '../step-resolver.js';
@@ -1 +1 @@
1
- import{b as E,c as t,d as b,e as $}from"../chunk-TEOO6V72.js";import{a as l,b as y,c as H,d as S,e as i,f,g,h as N,i as w}from"../chunk-C3P3ZH2I.js";import"../chunk-3XT6S7TZ.js";import{a as B}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as k,N as x,O,V as F}from"../chunk-E2MET7IR.js";import{a as q}from"../chunk-CANJPWLT.js";import{f as c}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";import{getHeader as o,getQuery as a,readBody as p,send as n,setHeaders as m}from"h3";var h="h3",L=d=>new t({frameworkName:h,...d,handler:r=>({body:()=>p(r),headers:e=>o(r,e),method:()=>r.method,url:()=>new URL(String(r.path),`${process.env.NODE_ENV==="development"?"http":"https"}://${String(o(r,"host"))}`),queryString:e=>String(a(r)[e]),transformResponse:e=>{let{res:s}=r.node;return s.statusCode=e.status,m(r,e.headers),n(r,e.body)}})}).createHandler();export{l as Actions,x as AgentDeliveryError,k as AgentError,y as Button,H as Card,S as CardLink,i as CardText,E as Client,c as CronExpression,f as Divider,t as NovuRequestHandler,g as Select,N as SelectOption,F as SeverityLevelEnum,w as TextInput,b as agent,h as frameworkName,q as providerSchemas,L as serve,B as step,O as toAgentError,$ as workflow};
1
+ import{b as E,c as t,d as b,e as $}from"../chunk-BSFJB6OO.js";import{a as B}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as k,N as x,O,V as F}from"../chunk-LHU5A7DI.js";import{a as l,b as y,c as H,d as S,e as i,f,p as g,q as N,r as w}from"../chunk-46AHJTS7.js";import"../chunk-XEHQJMMQ.js";import{a as q}from"../chunk-CANJPWLT.js";import{f as c}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";import{getHeader as o,getQuery as a,readBody as p,send as n,setHeaders as m}from"h3";var h="h3",L=d=>new t({frameworkName:h,...d,handler:r=>({body:()=>p(r),headers:e=>o(r,e),method:()=>r.method,url:()=>new URL(String(r.path),`${process.env.NODE_ENV==="development"?"http":"https"}://${String(o(r,"host"))}`),queryString:e=>String(a(r)[e]),transformResponse:e=>{let{res:s}=r.node;return s.statusCode=e.status,m(r,e.headers),n(r,e.body)}})}).createHandler();export{l as Actions,x as AgentDeliveryError,k as AgentError,y as Button,H as Card,S as CardLink,i as CardText,E as Client,c as CronExpression,f as Divider,t as NovuRequestHandler,g as Select,N as SelectOption,F as SeverityLevelEnum,w as TextInput,b as agent,h as frameworkName,q as providerSchemas,L as serve,B as step,O as toAgentError,$ as workflow};
@@ -0,0 +1,18 @@
1
+ import { Context } from 'hono';
2
+ import { S as ServeHandlerOptions } from '../index-CWldA6G5.js';
3
+ export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-CWldA6G5.js';
4
+ export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-BNocZ4Wk.js';
5
+ export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from '../subscriber.types-CmybpXhA.js';
6
+ import { S as SupportedFrameworkName } from '../server.types-Cc6o5eYH.js';
7
+ export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Select, SelectOption, TextInput } from 'chat';
8
+ export { A as Agent, a as AgentAction, b as AgentActionContext, c as AgentAttachment, d as AgentContext, e as AgentConversation, f as AgentDeliveryError, g as AgentError, h as AgentHandlerContext, i as AgentHandlers, j as AgentHistoryEntry, k as AgentMessage, l as AgentMessageAuthor, m as AgentMessageContext, n as AgentPlatformContext, o as AgentReaction, p as AgentReactionContext, q as AgentResolveContext, r as AgentSubscriber, s as AgentToolCall, F as FileRef, M as MessageContent, R as ReplyHandle, T as ToolApprovalCard, t as ToolApprovalConfig, u as ToolApprovalDecision, v as toAgentError } from '../agent.types-E3sxq6xr.js';
9
+ export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, step } from '../step-resolver.js';
10
+ import '../util.types-DaFfsxgy.js';
11
+ import '../base.schema.types-BApIn9jr.js';
12
+ import 'json-schema-to-ts';
13
+ import 'zod';
14
+
15
+ declare const frameworkName: SupportedFrameworkName;
16
+ declare const serve: (options: ServeHandlerOptions) => ((c: Context) => Promise<Response>);
17
+
18
+ export { ServeHandlerOptions, frameworkName, serve };
@@ -0,0 +1 @@
1
+ import{a as s,b as N,c as p,d as E,e as H}from"../chunk-BSFJB6OO.js";import{a as O}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as R,N as C,O as U,V as k}from"../chunk-LHU5A7DI.js";import{a as m,b as h,c as l,d as c,e as f,f as x,p as w,q as y,r as q}from"../chunk-46AHJTS7.js";import"../chunk-XEHQJMMQ.js";import{a as S}from"../chunk-CANJPWLT.js";import{f as v}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";var u="hono",d=o=>{try{let n=o.executionCtx;if(typeof n.waitUntil=="function")return e=>n.waitUntil(e)}catch{}},F=o=>new p({frameworkName:u,...o,handler:e=>({body:()=>e.req.json(),waitUntil:d(e),headers:t=>e.req.header(t),method:()=>e.req.method,queryString:t=>e.req.query(t),url:()=>{try{return new URL(e.req.url)}catch{}let t=e.req.header("host")||"localhost",r="https";try{(process.env.NODE_ENV==="development"||process.env.NODE_ENV==="dev")&&(r="http")}catch{}return new URL(e.req.url,`${r}://${t}`)},transformResponse:({body:t,status:r,headers:a})=>{let i=s();return new i(t,{status:r,headers:a})}})}).createHandler();export{m as Actions,C as AgentDeliveryError,R as AgentError,h as Button,l as Card,c as CardLink,f as CardText,N as Client,v as CronExpression,x as Divider,p as NovuRequestHandler,w as Select,y as SelectOption,k as SeverityLevelEnum,q as TextInput,E as agent,u as frameworkName,S as providerSchemas,F as serve,O as step,U as toAgentError,H as workflow};
@@ -1,11 +1,11 @@
1
1
  import * as aws_lambda from 'aws-lambda';
2
2
  import { APIGatewayProxyEventV2, APIGatewayProxyResult } from 'aws-lambda';
3
- import { S as ServeHandlerOptions } from '../index-aVljLqR4.js';
4
- export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-aVljLqR4.js';
3
+ import { S as ServeHandlerOptions } from '../index-CWldA6G5.js';
4
+ export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-CWldA6G5.js';
5
5
  export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-BNocZ4Wk.js';
6
6
  export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from '../subscriber.types-CmybpXhA.js';
7
7
  import { E as Either } from '../util.types-DaFfsxgy.js';
8
- import { S as SupportedFrameworkName } from '../server.types-BRWsA1CA.js';
8
+ import { S as SupportedFrameworkName } from '../server.types-Cc6o5eYH.js';
9
9
  export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Select, SelectOption, TextInput } from 'chat';
10
10
  export { A as Agent, a as AgentAction, b as AgentActionContext, c as AgentAttachment, d as AgentContext, e as AgentConversation, f as AgentDeliveryError, g as AgentError, h as AgentHandlerContext, i as AgentHandlers, j as AgentHistoryEntry, k as AgentMessage, l as AgentMessageAuthor, m as AgentMessageContext, n as AgentPlatformContext, o as AgentReaction, p as AgentReactionContext, q as AgentResolveContext, r as AgentSubscriber, s as AgentToolCall, F as FileRef, M as MessageContent, R as ReplyHandle, T as ToolApprovalCard, t as ToolApprovalConfig, u as ToolApprovalDecision, v as toAgentError } from '../agent.types-E3sxq6xr.js';
11
11
  export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, step } from '../step-resolver.js';
@@ -1 +1 @@
1
- import{b as E,c as n,d as S,e as g}from"../chunk-TEOO6V72.js";import{a as m,b as u,c as P,d as h,e as i,f as w,g as l,h as f,i as x}from"../chunk-C3P3ZH2I.js";import"../chunk-3XT6S7TZ.js";import{a as V}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as I,N as A,O as G,V as q}from"../chunk-E2MET7IR.js";import{a as b}from"../chunk-CANJPWLT.js";import{f as c}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";var p="lambda",N=y=>new n({frameworkName:p,...y,handler:r=>{let s=(e=>e.version==="2.0")(r);return{url:()=>{let e=s?r.requestContext.http.path:r.path,t=r.headers["x-forwarded-proto"]||"https",a=new URL(e,`${t}://${r.headers.host||r.headers.Host||""}`);for(let o in r.queryStringParameters)o&&a.searchParams.set(o,r.queryStringParameters[o]);return a},body:()=>{let e="{}";return r.body&&(e=r.isBase64Encoded?Buffer.from(r.body,"base64").toString():r.body),JSON.parse(e)},headers:e=>r.headers[e],queryString:e=>{var t;return(t=r.queryStringParameters)==null?void 0:t[e]},transformResponse:({body:e,status:t,headers:a})=>Promise.resolve({body:e,statusCode:t,headers:a}),method:()=>s?r.requestContext.http.method:r.httpMethod}}}).createHandler();export{m as Actions,A as AgentDeliveryError,I as AgentError,u as Button,P as Card,h as CardLink,i as CardText,E as Client,c as CronExpression,w as Divider,n as NovuRequestHandler,l as Select,f as SelectOption,q as SeverityLevelEnum,x as TextInput,S as agent,p as frameworkName,b as providerSchemas,N as serve,V as step,G as toAgentError,g as workflow};
1
+ import{b as E,c as n,d as S,e as g}from"../chunk-BSFJB6OO.js";import{a as V}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as I,N as A,O as G,V as q}from"../chunk-LHU5A7DI.js";import{a as m,b as u,c as P,d as h,e as i,f as w,p as l,q as f,r as x}from"../chunk-46AHJTS7.js";import"../chunk-XEHQJMMQ.js";import{a as b}from"../chunk-CANJPWLT.js";import{f as c}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";var p="lambda",N=y=>new n({frameworkName:p,...y,handler:r=>{let s=(e=>e.version==="2.0")(r);return{url:()=>{let e=s?r.requestContext.http.path:r.path,t=r.headers["x-forwarded-proto"]||"https",a=new URL(e,`${t}://${r.headers.host||r.headers.Host||""}`);for(let o in r.queryStringParameters)o&&a.searchParams.set(o,r.queryStringParameters[o]);return a},body:()=>{let e="{}";return r.body&&(e=r.isBase64Encoded?Buffer.from(r.body,"base64").toString():r.body),JSON.parse(e)},headers:e=>r.headers[e],queryString:e=>{var t;return(t=r.queryStringParameters)==null?void 0:t[e]},transformResponse:({body:e,status:t,headers:a})=>Promise.resolve({body:e,statusCode:t,headers:a}),method:()=>s?r.requestContext.http.method:r.httpMethod}}}).createHandler();export{m as Actions,A as AgentDeliveryError,I as AgentError,u as Button,P as Card,h as CardLink,i as CardText,E as Client,c as CronExpression,w as Divider,n as NovuRequestHandler,l as Select,f as SelectOption,q as SeverityLevelEnum,x as TextInput,S as agent,p as frameworkName,b as providerSchemas,N as serve,V as step,G as toAgentError,g as workflow};
@@ -1,5 +1,5 @@
1
- import { I as INovuRequestHandlerOptions, N as NovuRequestHandler, S as ServeHandlerOptions, C as Client } from '../index-aVljLqR4.js';
2
- export { a as agent, w as workflow } from '../index-aVljLqR4.js';
1
+ import { I as INovuRequestHandlerOptions, N as NovuRequestHandler, S as ServeHandlerOptions, C as Client } from '../index-CWldA6G5.js';
2
+ export { a as agent, w as workflow } from '../index-CWldA6G5.js';
3
3
  import { W as Workflow } from '../health-check.types-BNocZ4Wk.js';
4
4
  export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum } from '../health-check.types-BNocZ4Wk.js';
5
5
  export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Select, SelectOption, TextInput } from 'chat';
@@ -8,7 +8,7 @@ export { a as AgentAction, b as AgentActionContext, c as AgentAttachment, d as A
8
8
  export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, step } from '../step-resolver.js';
9
9
  export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from '../subscriber.types-CmybpXhA.js';
10
10
  import { Request, Response } from 'express';
11
- import { S as SupportedFrameworkName } from '../server.types-BRWsA1CA.js';
11
+ import { S as SupportedFrameworkName } from '../server.types-Cc6o5eYH.js';
12
12
  import { VercelRequest, VercelResponse } from '@vercel/node';
13
13
  import { E as Either } from '../util.types-DaFfsxgy.js';
14
14
  import * as _nestjs_common from '@nestjs/common';
@@ -40,6 +40,7 @@ declare const NovuBaseModule: _nestjs_common.ConfigurableModuleCls<NovuModuleOpt
40
40
  client?: Client;
41
41
  workflows?: Array<Workflow>;
42
42
  agents?: Array<Agent>;
43
+ waitUntil?: (promise: Promise<unknown>) => void;
43
44
  apiPath: string;
44
45
  controllerDecorators?: ClassDecorator[];
45
46
  }>;
@@ -52,6 +53,7 @@ declare const OPTIONS_TYPE: ServeHandlerOptions & {
52
53
  client?: Client;
53
54
  workflows?: Array<Workflow>;
54
55
  agents?: Array<Agent>;
56
+ waitUntil?: (promise: Promise<unknown>) => void;
55
57
  apiPath: string;
56
58
  controllerDecorators?: ClassDecorator[];
57
59
  }>;
@@ -60,6 +62,7 @@ declare const ASYNC_OPTIONS_TYPE: _nestjs_common.ConfigurableModuleAsyncOptions<
60
62
  client?: Client;
61
63
  workflows?: Array<Workflow>;
62
64
  agents?: Array<Agent>;
65
+ waitUntil?: (promise: Promise<unknown>) => void;
63
66
  apiPath: string;
64
67
  controllerDecorators?: ClassDecorator[];
65
68
  }>;
@@ -1 +1 @@
1
- import{b as J,c as P,d as Z,e as te}from"../chunk-TEOO6V72.js";import{a as j,b as F,c as L,d as V,e as U,f as k,g as B,h as $,i as K}from"../chunk-C3P3ZH2I.js";import"../chunk-3XT6S7TZ.js";import{a as oe}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as Q,N as W,O as X,V as re}from"../chunk-E2MET7IR.js";import{a as ee}from"../chunk-CANJPWLT.js";import{f as z}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import{d as n,e as i}from"../chunk-FHYMHX3T.js";import{Inject as N,Injectable as H}from"@nestjs/common";import{ConfigurableModuleBuilder as x}from"@nestjs/common";var{ConfigurableModuleClass:u,MODULE_OPTIONS_TOKEN:m,OPTIONS_TYPE:pe,ASYNC_OPTIONS_TYPE:ae}=new x().setClassMethodName("register").setFactoryMethodName("createNovuModuleOptions").setExtras(o=>({...o,isGlobal:!0})).build();var h="REGISTER_API_PATH",E="REGISTER_CONTROLLER_DECORATORS";import{Injectable as A}from"@nestjs/common";var c=class{handler(e,r){return{body:()=>e.body,headers:t=>{let a=e.headers[t.toLowerCase()];return Array.isArray(a)?a[0]:a},method:()=>e.method||"GET",queryString:t=>{let a=e.query[t];return Array.isArray(a)?a[0]:a},url:()=>{let t=e.headers.host||"",a=t!=null&&t.includes("://")?"":`${e.protocol||"https"}://`;return new URL(e.originalUrl||e.url||"",`${a}${t||""}`)},transformResponse:({body:t,headers:a,status:y})=>(Object.entries(a).forEach(([I,_])=>{r.setHeader(I,_)}),r.status(y).send(t))}}};c=n([A()],c);var q="nest",l=class{constructor(e,r){this.options=e;this.novuHandler=r;this.novuRequestHandler=new P({frameworkName:q,...this.options,handler:this.novuHandler.handler})}async handleRequest(e,r){await this.novuRequestHandler.createHandler()(e,r)}};l=n([H(),i(0,N(m)),i(1,N(c))],l);import{Controller as M,Get as D,Inject as C,Options as b,Post as w,Req as f,Res as O}from"@nestjs/common";var p=class{constructor(e){this.novuService=e}async handleGet(e,r){await this.novuService.handleRequest(e,r)}async handlePost(e,r){await this.novuService.handleRequest(e,r)}async handleOptions(e,r){await this.novuService.handleRequest(e,r)}};n([D(),i(0,f()),i(1,O())],p.prototype,"handleGet",1),n([w(),i(0,f()),i(1,O())],p.prototype,"handlePost",1),n([b(),i(0,f()),i(1,O())],p.prototype,"handleOptions",1),p=n([M(),i(0,C(l))],p);import{Module as G}from"@nestjs/common";import{PATH_METADATA as Y}from"@nestjs/common/constants";var R={provide:h,useFactory:o=>{if(!o.apiPath)throw new Error("`apiPath` must be provided to set the controller path");Reflect.defineMetadata(Y,o.apiPath,p)},inject:[m]};function T(o,e=[]){return e.reduce((r,s)=>{let t=s(r);return t!=null?t:r},o)}function g(o,e){var r;for(let s of(r=Reflect.getMetadataKeys(o))!=null?r:[])Reflect.defineMetadata(s,Reflect.getMetadata(s,o),e)}function S(o,e=[]){let r=T(o,e);r!==o&&g(r,o)}var v={provide:E,useFactory:o=>{var e;S(p,(e=o.controllerDecorators)!=null?e:[])},inject:[m]};var d=class extends u{static register(e,r){var t;let s=u.register(e);return s.controllers=[T(p,e.controllerDecorators||[])],(t=s.providers)==null||t.push(R,l,c,...r||[]),s.exports=[l,c],s}static registerAsync(e,r){var t;let s=u.registerAsync(e);return s.controllers=[p],(t=s.providers)==null||t.push(R,v,l,c,...r||[]),s.exports=[l,c],s}};d=n([G({})],d);export{j as Actions,W as AgentDeliveryError,Q as AgentError,F as Button,L as Card,V as CardLink,U as CardText,J as Client,z as CronExpression,k as Divider,m as NOVU_OPTIONS,l as NovuClient,p as NovuController,c as NovuHandler,d as NovuModule,P as NovuRequestHandler,h as REGISTER_API_PATH,E as REGISTER_CONTROLLER_DECORATORS,B as Select,$ as SelectOption,re as SeverityLevelEnum,K as TextInput,Z as agent,q as frameworkName,ee as providerSchemas,R as registerApiPath,v as registerControllerDecorators,oe as step,X as toAgentError,te as workflow};
1
+ import{b as J,c as P,d as Z,e as te}from"../chunk-BSFJB6OO.js";import{a as oe}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as Q,N as W,O as X,V as re}from"../chunk-LHU5A7DI.js";import{a as j,b as F,c as L,d as V,e as U,f as k,p as B,q as $,r as K}from"../chunk-46AHJTS7.js";import"../chunk-XEHQJMMQ.js";import{a as ee}from"../chunk-CANJPWLT.js";import{f as z}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import{d as n,e as i}from"../chunk-FHYMHX3T.js";import{Inject as N,Injectable as H}from"@nestjs/common";import{ConfigurableModuleBuilder as x}from"@nestjs/common";var{ConfigurableModuleClass:u,MODULE_OPTIONS_TOKEN:m,OPTIONS_TYPE:pe,ASYNC_OPTIONS_TYPE:ae}=new x().setClassMethodName("register").setFactoryMethodName("createNovuModuleOptions").setExtras(o=>({...o,isGlobal:!0})).build();var h="REGISTER_API_PATH",E="REGISTER_CONTROLLER_DECORATORS";import{Injectable as A}from"@nestjs/common";var c=class{handler(e,r){return{body:()=>e.body,headers:t=>{let a=e.headers[t.toLowerCase()];return Array.isArray(a)?a[0]:a},method:()=>e.method||"GET",queryString:t=>{let a=e.query[t];return Array.isArray(a)?a[0]:a},url:()=>{let t=e.headers.host||"",a=t!=null&&t.includes("://")?"":`${e.protocol||"https"}://`;return new URL(e.originalUrl||e.url||"",`${a}${t||""}`)},transformResponse:({body:t,headers:a,status:y})=>(Object.entries(a).forEach(([I,_])=>{r.setHeader(I,_)}),r.status(y).send(t))}}};c=n([A()],c);var q="nest",l=class{constructor(e,r){this.options=e;this.novuHandler=r;this.novuRequestHandler=new P({frameworkName:q,...this.options,handler:this.novuHandler.handler})}async handleRequest(e,r){await this.novuRequestHandler.createHandler()(e,r)}};l=n([H(),i(0,N(m)),i(1,N(c))],l);import{Controller as M,Get as D,Inject as C,Options as b,Post as w,Req as f,Res as O}from"@nestjs/common";var p=class{constructor(e){this.novuService=e}async handleGet(e,r){await this.novuService.handleRequest(e,r)}async handlePost(e,r){await this.novuService.handleRequest(e,r)}async handleOptions(e,r){await this.novuService.handleRequest(e,r)}};n([D(),i(0,f()),i(1,O())],p.prototype,"handleGet",1),n([w(),i(0,f()),i(1,O())],p.prototype,"handlePost",1),n([b(),i(0,f()),i(1,O())],p.prototype,"handleOptions",1),p=n([M(),i(0,C(l))],p);import{Module as G}from"@nestjs/common";import{PATH_METADATA as Y}from"@nestjs/common/constants";var R={provide:h,useFactory:o=>{if(!o.apiPath)throw new Error("`apiPath` must be provided to set the controller path");Reflect.defineMetadata(Y,o.apiPath,p)},inject:[m]};function T(o,e=[]){return e.reduce((r,s)=>{let t=s(r);return t!=null?t:r},o)}function g(o,e){var r;for(let s of(r=Reflect.getMetadataKeys(o))!=null?r:[])Reflect.defineMetadata(s,Reflect.getMetadata(s,o),e)}function S(o,e=[]){let r=T(o,e);r!==o&&g(r,o)}var v={provide:E,useFactory:o=>{var e;S(p,(e=o.controllerDecorators)!=null?e:[])},inject:[m]};var d=class extends u{static register(e,r){var t;let s=u.register(e);return s.controllers=[T(p,e.controllerDecorators||[])],(t=s.providers)==null||t.push(R,l,c,...r||[]),s.exports=[l,c],s}static registerAsync(e,r){var t;let s=u.registerAsync(e);return s.controllers=[p],(t=s.providers)==null||t.push(R,v,l,c,...r||[]),s.exports=[l,c],s}};d=n([G({})],d);export{j as Actions,W as AgentDeliveryError,Q as AgentError,F as Button,L as Card,V as CardLink,U as CardText,J as Client,z as CronExpression,k as Divider,m as NOVU_OPTIONS,l as NovuClient,p as NovuController,c as NovuHandler,d as NovuModule,P as NovuRequestHandler,h as REGISTER_API_PATH,E as REGISTER_CONTROLLER_DECORATORS,B as Select,$ as SelectOption,re as SeverityLevelEnum,K as TextInput,Z as agent,q as frameworkName,ee as providerSchemas,R as registerApiPath,v as registerControllerDecorators,oe as step,X as toAgentError,te as workflow};
@@ -1,9 +1,9 @@
1
1
  import { NextRequest } from 'next/server';
2
- import { S as ServeHandlerOptions } from '../index-aVljLqR4.js';
3
- export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-aVljLqR4.js';
2
+ import { S as ServeHandlerOptions } from '../index-CWldA6G5.js';
3
+ export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-CWldA6G5.js';
4
4
  export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-BNocZ4Wk.js';
5
5
  export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from '../subscriber.types-CmybpXhA.js';
6
- import { S as SupportedFrameworkName } from '../server.types-BRWsA1CA.js';
6
+ import { S as SupportedFrameworkName } from '../server.types-Cc6o5eYH.js';
7
7
  export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Select, SelectOption, TextInput } from 'chat';
8
8
  export { A as Agent, a as AgentAction, b as AgentActionContext, c as AgentAttachment, d as AgentContext, e as AgentConversation, f as AgentDeliveryError, g as AgentError, h as AgentHandlerContext, i as AgentHandlers, j as AgentHistoryEntry, k as AgentMessage, l as AgentMessageAuthor, m as AgentMessageContext, n as AgentPlatformContext, o as AgentReaction, p as AgentReactionContext, q as AgentResolveContext, r as AgentSubscriber, s as AgentToolCall, F as FileRef, M as MessageContent, R as ReplyHandle, T as ToolApprovalCard, t as ToolApprovalConfig, u as ToolApprovalDecision, v as toAgentError } from '../agent.types-E3sxq6xr.js';
9
9
  export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, step } from '../step-resolver.js';
@@ -28,6 +28,11 @@ type RequestHandler = (expectedReq: NextRequest, res: unknown) => Promise<Respon
28
28
  *
29
29
  * Supports Next.js 12+, both serverless and edge.
30
30
  *
31
+ * On Next.js >= 15.1 (App Router), background agent turns are kept alive after
32
+ * the acknowledgement response via `after()` from `next/server`, so agents work
33
+ * on serverless platforms such as Vercel without extra configuration. On older
34
+ * versions, pass `waitUntil` to `serve()` when deploying to serverless.
35
+ *
31
36
  * @example Next.js <=12 or the pages router can export the handler directly
32
37
  * ```ts
33
38
  * import { serve } from "@novu/framework/next";
@@ -1 +1 @@
1
- import{a as l,b as v,c,d as k,e as U}from"../chunk-TEOO6V72.js";import{a as O,b as x,c as q,d as S,e as T,f as w,g as P,h as A,i as E}from"../chunk-C3P3ZH2I.js";import"../chunk-3XT6S7TZ.js";import{a as L}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as g,N as F,O as j,V as I}from"../chunk-E2MET7IR.js";import{a as G}from"../chunk-CANJPWLT.js";import{f as b}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";var m="next",N=o=>typeof o=="object"&&o!==null&&typeof o.setHeader=="function"&&typeof o.status=="function"&&typeof o.send=="function",V=o=>{let p=new c({frameworkName:m,...o,handler:(h,R,d)=>{let n=R,i=e=>{let t=typeof n.headers.get=="function"?n.headers.get(e):n.headers[e];return Array.isArray(t)?t[0]:t};return{body:()=>typeof n.json=="function"?n.json():n.body,headers:i,method:()=>h||n.method||"",queryString:(e,t)=>{var a;let r=((a=n.query)==null?void 0:a[e])||t.searchParams.get(e);return Array.isArray(r)?r[0]:r},url:()=>{let e;try{e=new URL(n.url)}catch{}if(e){let s=i("host");if(s){let u=new URL(s.includes("://")?s:`${e.protocol}//${s}`);e.protocol=u.protocol,e.host=u.host,e.port=u.port,e.username=u.username,e.password=u.password}return e}let t="https",r=i("host")||"";try{(process.env.NODE_ENV==="development"||process.env.NODE_ENV==="dev")&&(t="http")}catch{}return new URL(n.url,`${t}://${r}`)},transformResponse:({body:e,headers:t,status:r})=>{if(N(d)){Object.entries(t).forEach(([s,u])=>{d.setHeader(s,u)}),d.status(r).send(e);return}let a=l();return new a(e,{status:r,headers:t})}}}}).createHandler(),f=p.bind(null,void 0);return Object.defineProperties(f,{GET:{value:p.bind(null,"GET")},POST:{value:p.bind(null,"POST")},OPTIONS:{value:p.bind(null,"OPTIONS")}})};export{O as Actions,F as AgentDeliveryError,g as AgentError,x as Button,q as Card,S as CardLink,T as CardText,v as Client,b as CronExpression,w as Divider,c as NovuRequestHandler,P as Select,A as SelectOption,I as SeverityLevelEnum,E as TextInput,k as agent,m as frameworkName,G as providerSchemas,V as serve,L as step,j as toAgentError,U as workflow};
1
+ import{a as c,b as F,c as f,d as G,e as $}from"../chunk-BSFJB6OO.js";import{a as D}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as U,N as k,O as j,V as L}from"../chunk-LHU5A7DI.js";import{a as S,b as q,c as w,d as P,e as T,f as v,p as A,q as E,r as b}from"../chunk-46AHJTS7.js";import"../chunk-XEHQJMMQ.js";import{a as I}from"../chunk-CANJPWLT.js";import{f as g}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";import*as l from"next/server";var N="next",y=()=>{if(typeof l.after=="function")return r=>{try{l.after(r)}catch{}}},H=r=>typeof r=="object"&&r!==null&&typeof r.setHeader=="function"&&typeof r.status=="function"&&typeof r.send=="function",_=r=>{let i=new f({frameworkName:N,...r,handler:(h,R,d)=>{let n=R,p=e=>{let t=typeof n.headers.get=="function"?n.headers.get(e):n.headers[e];return Array.isArray(t)?t[0]:t};return{body:()=>typeof n.json=="function"?n.json():n.body,waitUntil:y(),headers:p,method:()=>h||n.method||"",queryString:(e,t)=>{var a;let o=((a=n.query)==null?void 0:a[e])||t.searchParams.get(e);return Array.isArray(o)?o[0]:o},url:()=>{let e;try{e=new URL(n.url)}catch{}if(e){let s=p("host");if(s){let u=new URL(s.includes("://")?s:`${e.protocol}//${s}`);e.protocol=u.protocol,e.host=u.host,e.port=u.port,e.username=u.username,e.password=u.password}return e}let t="https",o=p("host")||"";try{(process.env.NODE_ENV==="development"||process.env.NODE_ENV==="dev")&&(t="http")}catch{}return new URL(n.url,`${t}://${o}`)},transformResponse:({body:e,headers:t,status:o})=>{if(H(d)){Object.entries(t).forEach(([s,u])=>{d.setHeader(s,u)}),d.status(o).send(e);return}let a=c();return new a(e,{status:o,headers:t})}}}}).createHandler(),m=i.bind(null,void 0);return Object.defineProperties(m,{GET:{value:i.bind(null,"GET")},POST:{value:i.bind(null,"POST")},OPTIONS:{value:i.bind(null,"OPTIONS")}})};export{S as Actions,k as AgentDeliveryError,U as AgentError,q as Button,w as Card,P as CardLink,T as CardText,F as Client,g as CronExpression,v as Divider,f as NovuRequestHandler,A as Select,E as SelectOption,L as SeverityLevelEnum,b as TextInput,G as agent,N as frameworkName,I as providerSchemas,_ as serve,D as step,j as toAgentError,$ as workflow};
@@ -1,10 +1,10 @@
1
1
  import * as h3 from 'h3';
2
2
  import { H3Event } from 'h3';
3
- import { S as ServeHandlerOptions } from '../index-aVljLqR4.js';
4
- export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-aVljLqR4.js';
3
+ import { S as ServeHandlerOptions } from '../index-CWldA6G5.js';
4
+ export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-CWldA6G5.js';
5
5
  export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-BNocZ4Wk.js';
6
6
  export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from '../subscriber.types-CmybpXhA.js';
7
- import { S as SupportedFrameworkName } from '../server.types-BRWsA1CA.js';
7
+ import { S as SupportedFrameworkName } from '../server.types-Cc6o5eYH.js';
8
8
  export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Select, SelectOption, TextInput } from 'chat';
9
9
  export { A as Agent, a as AgentAction, b as AgentActionContext, c as AgentAttachment, d as AgentContext, e as AgentConversation, f as AgentDeliveryError, g as AgentError, h as AgentHandlerContext, i as AgentHandlers, j as AgentHistoryEntry, k as AgentMessage, l as AgentMessageAuthor, m as AgentMessageContext, n as AgentPlatformContext, o as AgentReaction, p as AgentReactionContext, q as AgentResolveContext, r as AgentSubscriber, s as AgentToolCall, F as FileRef, M as MessageContent, R as ReplyHandle, T as ToolApprovalCard, t as ToolApprovalConfig, u as ToolApprovalDecision, v as toAgentError } from '../agent.types-E3sxq6xr.js';
10
10
  export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, step } from '../step-resolver.js';
@@ -1 +1 @@
1
- import{b as x,c as t,d as b,e as $}from"../chunk-TEOO6V72.js";import{a as l,b as H,c as S,d as i,e as y,f,g,h as N,i as w}from"../chunk-C3P3ZH2I.js";import"../chunk-3XT6S7TZ.js";import{a as B}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as E,N as k,O,V as F}from"../chunk-E2MET7IR.js";import{a as q}from"../chunk-CANJPWLT.js";import{f as c}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";import{getHeader as o,getQuery as a,readBody as n,send as p,setHeaders as m}from"h3";var u="nuxt",Q=d=>new t({frameworkName:u,...d,handler:r=>({queryString:e=>String(a(r)[e]),body:()=>n(r),headers:e=>o(r,e),url:()=>new URL(String(r.path),`${process.env.NODE_ENV==="development"?"http":"https"}://${String(o(r,"host"))}`),method:()=>r.method,transformResponse:e=>{let{res:s}=r.node;return s.statusCode=e.status,m(r,e.headers),p(r,e.body)}})}).createHandler();export{l as Actions,k as AgentDeliveryError,E as AgentError,H as Button,S as Card,i as CardLink,y as CardText,x as Client,c as CronExpression,f as Divider,t as NovuRequestHandler,g as Select,N as SelectOption,F as SeverityLevelEnum,w as TextInput,b as agent,u as frameworkName,q as providerSchemas,Q as serve,B as step,O as toAgentError,$ as workflow};
1
+ import{b as x,c as t,d as b,e as $}from"../chunk-BSFJB6OO.js";import{a as B}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as E,N as k,O,V as F}from"../chunk-LHU5A7DI.js";import{a as l,b as H,c as S,d as i,e as y,f,p as g,q as N,r as w}from"../chunk-46AHJTS7.js";import"../chunk-XEHQJMMQ.js";import{a as q}from"../chunk-CANJPWLT.js";import{f as c}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";import{getHeader as o,getQuery as a,readBody as n,send as p,setHeaders as m}from"h3";var u="nuxt",Q=d=>new t({frameworkName:u,...d,handler:r=>({queryString:e=>String(a(r)[e]),body:()=>n(r),headers:e=>o(r,e),url:()=>new URL(String(r.path),`${process.env.NODE_ENV==="development"?"http":"https"}://${String(o(r,"host"))}`),method:()=>r.method,transformResponse:e=>{let{res:s}=r.node;return s.statusCode=e.status,m(r,e.headers),p(r,e.body)}})}).createHandler();export{l as Actions,k as AgentDeliveryError,E as AgentError,H as Button,S as Card,i as CardLink,y as CardText,x as Client,c as CronExpression,f as Divider,t as NovuRequestHandler,g as Select,N as SelectOption,F as SeverityLevelEnum,w as TextInput,b as agent,u as frameworkName,q as providerSchemas,Q as serve,B as step,O as toAgentError,$ as workflow};
@@ -1,8 +1,8 @@
1
- import { S as ServeHandlerOptions } from '../index-aVljLqR4.js';
2
- export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-aVljLqR4.js';
1
+ import { S as ServeHandlerOptions } from '../index-CWldA6G5.js';
2
+ export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-CWldA6G5.js';
3
3
  export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-BNocZ4Wk.js';
4
4
  export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from '../subscriber.types-CmybpXhA.js';
5
- import { S as SupportedFrameworkName } from '../server.types-BRWsA1CA.js';
5
+ import { S as SupportedFrameworkName } from '../server.types-Cc6o5eYH.js';
6
6
  export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Select, SelectOption, TextInput } from 'chat';
7
7
  export { A as Agent, a as AgentAction, b as AgentActionContext, c as AgentAttachment, d as AgentContext, e as AgentConversation, f as AgentDeliveryError, g as AgentError, h as AgentHandlerContext, i as AgentHandlers, j as AgentHistoryEntry, k as AgentMessage, l as AgentMessageAuthor, m as AgentMessageContext, n as AgentPlatformContext, o as AgentReaction, p as AgentReactionContext, q as AgentResolveContext, r as AgentSubscriber, s as AgentToolCall, F as FileRef, M as MessageContent, R as ReplyHandle, T as ToolApprovalCard, t as ToolApprovalConfig, u as ToolApprovalDecision, v as toAgentError } from '../agent.types-E3sxq6xr.js';
8
8
  export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, step } from '../step-resolver.js';
@@ -1 +1 @@
1
- import{a as t,b as v,c as o,d as g,e as F}from"../chunk-TEOO6V72.js";import{a as u,b as h,c as l,d as R,e as c,f as i,g as w,h as f,i as x}from"../chunk-C3P3ZH2I.js";import"../chunk-3XT6S7TZ.js";import{a as O}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as H,N,O as S,V as q}from"../chunk-E2MET7IR.js";import{a as y}from"../chunk-CANJPWLT.js";import{f as k}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";var m="remix",L=s=>new o({frameworkName:m,...s,handler:({request:e})=>({body:()=>e.json(),headers:r=>e.headers.get(r),method:()=>e.method,url:()=>new URL(e.url,`https://${e.headers.get("host")||""}`),transformResponse:({body:r,status:n,headers:p})=>{let a=t();return new a(r,{status:n,headers:p})}})}).createHandler();export{u as Actions,N as AgentDeliveryError,H as AgentError,h as Button,l as Card,R as CardLink,c as CardText,v as Client,k as CronExpression,i as Divider,o as NovuRequestHandler,w as Select,f as SelectOption,q as SeverityLevelEnum,x as TextInput,g as agent,m as frameworkName,y as providerSchemas,L as serve,O as step,S as toAgentError,F as workflow};
1
+ import{a as t,b as v,c as o,d as g,e as F}from"../chunk-BSFJB6OO.js";import{a as O}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as H,N,O as S,V as q}from"../chunk-LHU5A7DI.js";import{a as u,b as h,c as l,d as R,e as c,f as i,p as w,q as f,r as x}from"../chunk-46AHJTS7.js";import"../chunk-XEHQJMMQ.js";import{a as y}from"../chunk-CANJPWLT.js";import{f as k}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";var m="remix",L=s=>new o({frameworkName:m,...s,handler:({request:e})=>({body:()=>e.json(),headers:r=>e.headers.get(r),method:()=>e.method,url:()=>new URL(e.url,`https://${e.headers.get("host")||""}`),transformResponse:({body:r,status:n,headers:p})=>{let a=t();return new a(r,{status:n,headers:p})}})}).createHandler();export{u as Actions,N as AgentDeliveryError,H as AgentError,h as Button,l as Card,R as CardLink,c as CardText,v as Client,k as CronExpression,i as Divider,o as NovuRequestHandler,w as Select,f as SelectOption,q as SeverityLevelEnum,x as TextInput,g as agent,m as frameworkName,y as providerSchemas,L as serve,O as step,S as toAgentError,F as workflow};
@@ -1,9 +1,9 @@
1
1
  import { RequestEvent } from '@sveltejs/kit';
2
- import { S as ServeHandlerOptions } from '../index-aVljLqR4.js';
3
- export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-aVljLqR4.js';
2
+ import { S as ServeHandlerOptions } from '../index-CWldA6G5.js';
3
+ export { C as Client, N as NovuRequestHandler, a as agent, w as workflow } from '../index-CWldA6G5.js';
4
4
  export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from '../health-check.types-BNocZ4Wk.js';
5
5
  export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from '../subscriber.types-CmybpXhA.js';
6
- import { S as SupportedFrameworkName } from '../server.types-BRWsA1CA.js';
6
+ import { S as SupportedFrameworkName } from '../server.types-Cc6o5eYH.js';
7
7
  export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Select, SelectOption, TextInput } from 'chat';
8
8
  export { A as Agent, a as AgentAction, b as AgentActionContext, c as AgentAttachment, d as AgentContext, e as AgentConversation, f as AgentDeliveryError, g as AgentError, h as AgentHandlerContext, i as AgentHandlers, j as AgentHistoryEntry, k as AgentMessage, l as AgentMessageAuthor, m as AgentMessageContext, n as AgentPlatformContext, o as AgentReaction, p as AgentReactionContext, q as AgentResolveContext, r as AgentSubscriber, s as AgentToolCall, F as FileRef, M as MessageContent, R as ReplyHandle, T as ToolApprovalCard, t as ToolApprovalConfig, u as ToolApprovalDecision, v as toAgentError } from '../agent.types-E3sxq6xr.js';
9
9
  export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, step } from '../step-resolver.js';
@@ -1 +1 @@
1
- import{a as r,b as q,c as s,d as y,e as k}from"../chunk-TEOO6V72.js";import{a as v,b as E,c as P,d as R,e as T,f as S,g as c,h as f,i as h}from"../chunk-C3P3ZH2I.js";import"../chunk-3XT6S7TZ.js";import{a as H}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as F,N as b,O as w,V as I}from"../chunk-E2MET7IR.js";import{a as G}from"../chunk-CANJPWLT.js";import{f as N}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";var m="sveltekit",j=o=>{let t=new s({frameworkName:m,...o,handler:(u,e)=>({method:()=>u||e.request.method||"",body:()=>e.request.json(),headers:n=>e.request.headers.get(n),url:()=>{let n=process.env.NODE_ENV==="development"||process.env.NODE_ENV==="dev"?"http":"https";return new URL(e.request.url,`${n}://${e.request.headers.get("host")||""}`)},transformResponse:({body:n,headers:d,status:a})=>{let l=r();return new l(n,{status:a,headers:d})}})}).createHandler(),p=t.bind(null,void 0);return Object.defineProperties(p,{GET:{value:t.bind(null,"GET")},POST:{value:t.bind(null,"POST")},OPTIONS:{value:t.bind(null,"OPTIONS")}})};export{v as Actions,b as AgentDeliveryError,F as AgentError,E as Button,P as Card,R as CardLink,T as CardText,q as Client,N as CronExpression,S as Divider,s as NovuRequestHandler,c as Select,f as SelectOption,I as SeverityLevelEnum,h as TextInput,y as agent,m as frameworkName,G as providerSchemas,j as serve,H as step,w as toAgentError,k as workflow};
1
+ import{a as r,b as q,c as s,d as y,e as k}from"../chunk-BSFJB6OO.js";import{a as H}from"../chunk-2M25EATE.js";import"../chunk-22DBAEUX.js";import{M as F,N as b,O as w,V as I}from"../chunk-LHU5A7DI.js";import{a as v,b as E,c as P,d as R,e as T,f as S,p as c,q as f,r as h}from"../chunk-46AHJTS7.js";import"../chunk-XEHQJMMQ.js";import{a as G}from"../chunk-CANJPWLT.js";import{f as N}from"../chunk-FRWG7YTE.js";import"../chunk-W6DIBD4Z.js";import"../chunk-FHYMHX3T.js";var m="sveltekit",j=o=>{let t=new s({frameworkName:m,...o,handler:(u,e)=>({method:()=>u||e.request.method||"",body:()=>e.request.json(),headers:n=>e.request.headers.get(n),url:()=>{let n=process.env.NODE_ENV==="development"||process.env.NODE_ENV==="dev"?"http":"https";return new URL(e.request.url,`${n}://${e.request.headers.get("host")||""}`)},transformResponse:({body:n,headers:d,status:a})=>{let l=r();return new l(n,{status:a,headers:d})}})}).createHandler(),p=t.bind(null,void 0);return Object.defineProperties(p,{GET:{value:t.bind(null,"GET")},POST:{value:t.bind(null,"POST")},OPTIONS:{value:t.bind(null,"OPTIONS")}})};export{v as Actions,b as AgentDeliveryError,F as AgentError,E as Button,P as Card,R as CardLink,T as CardText,q as Client,N as CronExpression,S as Divider,s as NovuRequestHandler,c as Select,f as SelectOption,I as SeverityLevelEnum,h as TextInput,y as agent,m as frameworkName,G as providerSchemas,j as serve,H as step,w as toAgentError,k as workflow};
@@ -0,0 +1,3 @@
1
+ {
2
+ "main": "../dist/cjs/servers/hono.cjs"
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@novu/framework",
3
- "version": "2.12.0",
3
+ "version": "2.13.0-rc.28c6d223e1",
4
4
  "description": "The Code-First Notifications Workflow SDK.",
5
5
  "main": "./dist/cjs/index.cjs",
6
6
  "types": "./dist/cjs/index.d.cts",
@@ -18,6 +18,7 @@
18
18
  "dist",
19
19
  "express",
20
20
  "h3",
21
+ "hono",
21
22
  "internal",
22
23
  "lambda",
23
24
  "nest",
@@ -48,6 +49,7 @@
48
49
  "next",
49
50
  "nuxt",
50
51
  "h3",
52
+ "hono",
51
53
  "express"
52
54
  ],
53
55
  "author": "Novu Team <engineering@novu.co>",
@@ -133,6 +135,16 @@
133
135
  "default": "./dist/esm/servers/h3.js"
134
136
  }
135
137
  },
138
+ "./hono": {
139
+ "require": {
140
+ "types": "./dist/cjs/servers/hono.d.cts",
141
+ "default": "./dist/cjs/servers/hono.cjs"
142
+ },
143
+ "import": {
144
+ "types": "./dist/esm/servers/hono.d.ts",
145
+ "default": "./dist/esm/servers/hono.js"
146
+ }
147
+ },
136
148
  "./lambda": {
137
149
  "require": {
138
150
  "types": "./dist/cjs/servers/lambda.d.cts",
@@ -233,6 +245,7 @@
233
245
  "aws-lambda": ">=1.0.7",
234
246
  "express": ">=4.19.2",
235
247
  "h3": ">=1.8.1",
248
+ "hono": ">=4.0.0",
236
249
  "langchain": ">=1.0.0",
237
250
  "next": ">=12.0.0",
238
251
  "zod": ">=3.0.0",
@@ -263,6 +276,9 @@
263
276
  "h3": {
264
277
  "optional": true
265
278
  },
279
+ "hono": {
280
+ "optional": true
281
+ },
266
282
  "aws-lambda": {
267
283
  "optional": true
268
284
  },
@@ -295,6 +311,7 @@
295
311
  "aws-lambda": "^1.0.7",
296
312
  "express": "^4.19.2",
297
313
  "h3": "^1.11.1",
314
+ "hono": "^4.12.25",
298
315
  "langchain": "^1.2.16",
299
316
  "madge": "^8.0.0",
300
317
  "next": "^16.2.1",