@novu/framework 2.13.0 → 2.13.1-rc.852194fa77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cjs/{agent.types-Dqm2VBTO.d.cts → agent.types-CQKSD7NC.d.cts} +84 -3
- package/dist/cjs/ai-sdk/index.cjs +4 -1
- package/dist/cjs/ai-sdk/index.d.cts +16 -5
- package/dist/cjs/cards.cjs +28 -28
- package/dist/cjs/cards.d.cts +1 -1
- package/dist/cjs/{health-check.types-B9FbzRbm.d.cts → health-check.types-B6RuXNc8.d.cts} +72 -66
- package/dist/cjs/{index-CLZZRnNV.d.cts → index-phn3kJ9H.d.cts} +18 -6
- package/dist/cjs/index.cjs +112 -112
- package/dist/cjs/index.d.cts +6 -6
- package/dist/cjs/internal/index.cjs +46 -43
- package/dist/cjs/internal/index.d.cts +314 -28
- package/dist/cjs/langchain/index.cjs +4 -1
- package/dist/cjs/langchain/index.d.cts +38 -6
- package/dist/cjs/servers/express.cjs +102 -102
- package/dist/cjs/servers/express.d.cts +7 -7
- package/dist/cjs/servers/h3.cjs +106 -106
- package/dist/cjs/servers/h3.d.cts +7 -7
- package/dist/cjs/servers/hono.cjs +106 -106
- package/dist/cjs/servers/hono.d.cts +7 -7
- package/dist/cjs/servers/lambda.cjs +102 -102
- package/dist/cjs/servers/lambda.d.cts +7 -7
- package/dist/cjs/servers/nest.cjs +115 -115
- package/dist/cjs/servers/nest.d.cts +9 -9
- package/dist/cjs/servers/next.cjs +124 -124
- package/dist/cjs/servers/next.d.cts +7 -7
- package/dist/cjs/servers/nuxt.cjs +106 -106
- package/dist/cjs/servers/nuxt.d.cts +7 -7
- package/dist/cjs/servers/remix.cjs +117 -117
- package/dist/cjs/servers/remix.d.cts +7 -7
- package/dist/cjs/servers/sveltekit.cjs +114 -114
- package/dist/cjs/servers/sveltekit.d.cts +7 -7
- package/dist/cjs/step-resolver.cjs +4 -4
- package/dist/cjs/step-resolver.d.cts +18 -4
- package/dist/cjs/{subscriber.types-DubxcL8q.d.cts → subscriber.types-_eHz1E0m.d.cts} +738 -20
- package/dist/cjs/validators.cjs +1 -1
- package/dist/esm/{agent.types-E3sxq6xr.d.ts → agent.types-C17NUGxY.d.ts} +84 -3
- package/dist/esm/ai-sdk/index.d.ts +16 -5
- package/dist/esm/ai-sdk/index.js +1 -1
- package/dist/esm/cards.d.ts +1 -1
- package/dist/esm/cards.js +1 -1
- package/dist/esm/chunk-PU74XQ2P.js +1 -0
- package/dist/esm/chunk-Q3ALQWIF.js +1 -0
- package/dist/esm/chunk-QZ6TSYCK.js +4 -0
- package/dist/esm/{chunk-CANJPWLT.js → chunk-UXO4RWZV.js} +4 -4
- package/dist/esm/{chunk-FRWG7YTE.js → chunk-VY27ZAO7.js} +1 -1
- package/dist/esm/chunk-WJUYDVXH.js +98 -0
- package/dist/esm/{chunk-46AHJTS7.js → chunk-X5AZIKIR.js} +8 -8
- package/dist/esm/{chunk-22DBAEUX.js → chunk-XIVU4VDS.js} +1 -1
- package/dist/esm/{chunk-2M25EATE.js → chunk-YLCLZVYS.js} +1 -1
- package/dist/esm/chunk-YZ3P3MMZ.js +1 -0
- package/dist/esm/{health-check.types-BNocZ4Wk.d.ts → health-check.types-CL5-B_D4.d.ts} +72 -66
- package/dist/esm/{index-CWldA6G5.d.ts → index-CYtGHJJu.d.ts} +18 -6
- package/dist/esm/index.d.ts +6 -6
- package/dist/esm/index.js +1 -1
- package/dist/esm/internal/index.d.ts +306 -20
- package/dist/esm/internal/index.js +1 -1
- package/dist/esm/jsx-dev-runtime.js +1 -1
- package/dist/esm/{jsx-runtime-P2HN3TPO.js → jsx-runtime-5ZWEWA4A.js} +1 -1
- package/dist/esm/jsx-runtime.js +1 -1
- package/dist/esm/langchain/index.d.ts +38 -6
- package/dist/esm/langchain/index.js +1 -1
- package/dist/esm/servers/express.d.ts +7 -7
- package/dist/esm/servers/express.js +1 -1
- package/dist/esm/servers/h3.d.ts +7 -7
- package/dist/esm/servers/h3.js +1 -1
- package/dist/esm/servers/hono.d.ts +7 -7
- package/dist/esm/servers/hono.js +1 -1
- package/dist/esm/servers/lambda.d.ts +7 -7
- package/dist/esm/servers/lambda.js +1 -1
- package/dist/esm/servers/nest.d.ts +9 -9
- package/dist/esm/servers/nest.js +1 -1
- package/dist/esm/servers/next.d.ts +7 -7
- package/dist/esm/servers/next.js +1 -1
- package/dist/esm/servers/nuxt.d.ts +7 -7
- package/dist/esm/servers/nuxt.js +1 -1
- package/dist/esm/servers/remix.d.ts +7 -7
- package/dist/esm/servers/remix.js +1 -1
- package/dist/esm/servers/sveltekit.d.ts +7 -7
- package/dist/esm/servers/sveltekit.js +1 -1
- package/dist/esm/step-resolver.d.ts +18 -4
- package/dist/esm/step-resolver.js +1 -1
- package/dist/esm/{subscriber.types-CmybpXhA.d.ts → subscriber.types-D4PvRIKR.d.ts} +738 -20
- package/dist/esm/validators.js +1 -1
- package/langchain/package.json +4 -0
- package/nest/package.json +2 -1
- package/package.json +4 -3
- package/dist/esm/chunk-LHU5A7DI.js +0 -1
- package/dist/esm/chunk-W6DIBD4Z.js +0 -1
- package/dist/esm/chunk-WDBIT4NK.js +0 -98
- /package/dist/esm/{chunk-3ZWME5KT.js → chunk-7C3QBYLB.js} +0 -0
- /package/dist/esm/{chunk-XEHQJMMQ.js → chunk-RBTQQ5IZ.js} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{D as
|
|
1
|
+
import{D as y,F as _,a as P,b as L,c as w,d as b,e as k,f as Z,g as Y,h as tt,i as et,j as at,k as rt,l as st,m as it,n as nt,o as ot,p as lt,q as ct,r as R,s as dt,t as ht,u as ut,v as ft,w as gt,x as pt}from"./chunk-RBTQQ5IZ.js";import{f as c}from"./chunk-FHYMHX3T.js";var C=Symbol.for("workflow-serialize"),x=Symbol.for("workflow-deserialize");var jt=Object.defineProperty,zt=Object.defineProperties,Bt=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,Kt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable,yt=(t,e,a)=>e in t?jt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,kt=(t,e)=>{for(var a in e||(e={}))Kt.call(e,a)&&yt(t,a,e[a]);if(mt)for(var a of mt(e))Xt.call(e,a)&&yt(t,a,e[a]);return t},Mt=(t,e)=>zt(t,Bt(e)),p=(t,e)=>{let a=!1,r=!1;for(let s=0;s<e;s+=1){if(t[s]==="\\"&&s+1<t.length&&t[s+1]==="`"){s+=1;continue}if(t.substring(s,s+3)==="```"){r=!r,s+=2;continue}!r&&t[s]==="`"&&(a=!a)}return a||r},qt=(t,e)=>{let a=t.substring(e,e+3)==="```",r=e>0&&t.substring(e-1,e+2)==="```",s=e>1&&t.substring(e-2,e+1)==="```";return a||r||s},Gt=t=>{let e=0;for(let a=0;a<t.length;a+=1){if(t[a]==="\\"&&a+1<t.length&&t[a+1]==="`"){a+=1;continue}t[a]==="`"&&!qt(t,a)&&(e+=1)}return e},M=(t,e)=>{let a=!1,r=!1,s=-1;for(let i=0;i<t.length;i+=1){if(t[i]==="\\"&&i+1<t.length&&t[i+1]==="`"){i+=1;continue}if(t.substring(i,i+3)==="```"){r=!r,i+=2;continue}if(!r&&t[i]==="`")if(a){if(s<e&&e<i)return!0;a=!1,s=-1}else a=!0,s=i}return!1},Vt=/^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm,Qt=t=>!t||typeof t!="string"||!t.includes(">")?t:t.replace(Vt,(e,a,r,s)=>p(t,s)?e:`${a}\\>${r}`),Zt=/(\*\*)([^*]*\*?)$/,Yt=/(__)([^_]*?)$/,te=/(\*\*\*)([^*]*?)$/,ee=/(\*)([^*]*?)$/,ae=/(_)([^_]*?)$/,re=/(`)([^`]*?)$/,se=/(~~)([^~]*?)$/,S=/^[\s_~*`]*$/,It=/^[\s]*[-*+][\s]+$/,ie=/[\p{L}\p{N}_]/u,ne=/^```[^`\n]*```?$/,oe=/^\*{4,}$/,le=/(__)([^_]+)_$/,ce=/(~~)([^~]+)~$/,_t=/~~/g,I=t=>{if(!t)return!1;let e=t.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95?!0:ie.test(t)};var de=(t,e)=>{let a=1;for(let r=e-1;r>=0;r-=1)if(t[r]==="]")a+=1;else if(t[r]==="["&&(a-=1,a===0))return r;return-1},St=(t,e)=>{let a=1;for(let r=e+1;r<t.length;r+=1)if(t[r]==="[")a+=1;else if(t[r]==="]"&&(a-=1,a===0))return r;return-1},$=(t,e)=>{let a=!1,r=!1;for(let s=0;s<t.length&&s<e;s+=1){if(t[s]==="\\"&&t[s+1]==="$"){s+=1;continue}t[s]==="$"&&(t[s+1]==="$"?(r=!r,s+=1,a=!1):r||(a=!a))}return a||r},he=(t,e)=>{for(let a=e;a<t.length;a+=1){if(t[a]===")")return!0;if(t[a]===`
|
|
2
2
|
`)return!1}return!1},Tt=(t,e)=>{for(let a=e-1;a>=0;a-=1){if(t[a]===")")return!1;if(t[a]==="(")return a>0&&t[a-1]==="]"?he(t,e):!1;if(t[a]===`
|
|
3
3
|
`)return!1}return!1},ue=(t,e)=>{for(let a=e-1;a>=0;a-=1){if(t[a]===">")return!1;if(t[a]==="<"){let r=a+1<t.length?t[a+1]:"";return r>="a"&&r<="z"||r>="A"&&r<="Z"||r==="/"}if(t[a]===`
|
|
4
4
|
`)return!1}return!1},W=(t,e,a)=>{let r=0;for(let l=e-1;l>=0;l-=1)if(t[l]===`
|
|
5
5
|
`){r=l+1;break}let s=t.length;for(let l=e;l<t.length;l+=1)if(t[l]===`
|
|
6
6
|
`){s=l;break}let i=t.substring(r,s),n=0,o=!1;for(let l of i)if(l===a)n+=1;else if(l!==" "&&l!==" "){o=!0;break}return n>=3&&!o},fe=(t,e,a,r)=>a==="\\"||t.includes("$")&&$(t,e)?!0:a!=="*"&&r==="*"?(e<t.length-2?t[e+2]:"")!=="*":!!(a==="*"||a&&r&&I(a)&&I(r)||(!a||a===" "||a===" "||a===`
|
|
7
7
|
`)&&(!r||r===" "||r===" "||r===`
|
|
8
|
-
`)),Et=t=>{let e=0,a=!1,r=t.length;for(let s=0;s<r;s+=1){if(t[s]==="`"&&s+2<r&&t[s+1]==="`"&&t[s+2]==="`"){a=!a,s+=2;continue}if(a||t[s]!=="*")continue;let i=s>0?t[s-1]:"",n=s<r-1?t[s+1]:"";fe(t,s,i,n)||(e+=1)}return e},ge=(t,e,a,r)=>!!(a==="\\"||t.includes("$")&&$(t,e)||Tt(t,e)||ue(t,e)||a==="_"||r==="_"||a&&r&&I(a)&&I(r)),pe=t=>{let e=0,a=!1,r=t.length;for(let s=0;s<r;s+=1){if(t[s]==="`"&&s+2<r&&t[s+1]==="`"&&t[s+2]==="`"){a=!a,s+=2;continue}if(a||t[s]!=="_")continue;let i=s>0?t[s-1]:"",n=s<r-1?t[s+1]:"";ge(t,s,i,n)||(e+=1)}return e},me=t=>{let e=0,a=0,r=!1;for(let s=0;s<t.length;s+=1){if(t[s]==="`"&&s+2<t.length&&t[s+1]==="`"&&t[s+2]==="`"){a>=3&&(e+=Math.floor(a/3)),a=0,r=!r,s+=2;continue}r||(t[s]==="*"?a+=1:(a>=3&&(e+=Math.floor(a/3)),a=0))}return a>=3&&(e+=Math.floor(a/3)),e},J=t=>{let e=0,a=!1;for(let r=0;r<t.length;r+=1){if(t[r]==="`"&&r+2<t.length&&t[r+1]==="`"&&t[r+2]==="`"){a=!a,r+=2;continue}a||t[r]==="*"&&r+1<t.length&&t[r+1]==="*"&&(e+=1,r+=1)}return e},wt=t=>{let e=0,a=!1;for(let r=0;r<t.length;r+=1){if(t[r]==="`"&&r+2<t.length&&t[r+1]==="`"&&t[r+2]==="`"){a=!a,r+=2;continue}a||t[r]==="_"&&r+1<t.length&&t[r+1]==="_"&&(e+=1,r+=1)}return e},
|
|
8
|
+
`)),Et=t=>{let e=0,a=!1,r=t.length;for(let s=0;s<r;s+=1){if(t[s]==="`"&&s+2<r&&t[s+1]==="`"&&t[s+2]==="`"){a=!a,s+=2;continue}if(a||t[s]!=="*")continue;let i=s>0?t[s-1]:"",n=s<r-1?t[s+1]:"";fe(t,s,i,n)||(e+=1)}return e},ge=(t,e,a,r)=>!!(a==="\\"||t.includes("$")&&$(t,e)||Tt(t,e)||ue(t,e)||a==="_"||r==="_"||a&&r&&I(a)&&I(r)),pe=t=>{let e=0,a=!1,r=t.length;for(let s=0;s<r;s+=1){if(t[s]==="`"&&s+2<r&&t[s+1]==="`"&&t[s+2]==="`"){a=!a,s+=2;continue}if(a||t[s]!=="_")continue;let i=s>0?t[s-1]:"",n=s<r-1?t[s+1]:"";ge(t,s,i,n)||(e+=1)}return e},me=t=>{let e=0,a=0,r=!1;for(let s=0;s<t.length;s+=1){if(t[s]==="`"&&s+2<t.length&&t[s+1]==="`"&&t[s+2]==="`"){a>=3&&(e+=Math.floor(a/3)),a=0,r=!r,s+=2;continue}r||(t[s]==="*"?a+=1:(a>=3&&(e+=Math.floor(a/3)),a=0))}return a>=3&&(e+=Math.floor(a/3)),e},J=t=>{let e=0,a=!1;for(let r=0;r<t.length;r+=1){if(t[r]==="`"&&r+2<t.length&&t[r+1]==="`"&&t[r+2]==="`"){a=!a,r+=2;continue}a||t[r]==="*"&&r+1<t.length&&t[r+1]==="*"&&(e+=1,r+=1)}return e},wt=t=>{let e=0,a=!1;for(let r=0;r<t.length;r+=1){if(t[r]==="`"&&r+2<t.length&&t[r+1]==="`"&&t[r+2]==="`"){a=!a,r+=2;continue}a||t[r]==="_"&&r+1<t.length&&t[r+1]==="_"&&(e+=1,r+=1)}return e},ye=(t,e,a)=>{if(!e||S.test(e))return!0;let r=t.substring(0,a).lastIndexOf(`
|
|
9
9
|
`),s=r===-1?0:r+1,i=t.substring(s,a);return It.test(i)&&e.includes(`
|
|
10
|
-
`)?!0:W(t,a,"*")},
|
|
10
|
+
`)?!0:W(t,a,"*")},_e=t=>{let e=t.match(Zt);if(!e)return t;let a=e[2],r=t.lastIndexOf(e[1]);return p(t,r)||M(t,r)||ye(t,a,r)?t:J(t)%2===1?a.endsWith("*")?`${t}*`:`${t}**`:t},we=(t,e,a)=>{if(!e||S.test(e))return!0;let r=t.substring(0,a).lastIndexOf(`
|
|
11
11
|
`),s=r===-1?0:r+1,i=t.substring(s,a);return It.test(i)&&e.includes(`
|
|
12
12
|
`)?!0:W(t,a,"_")},be=t=>{let e=t.match(Yt);if(!e){let s=t.match(le);if(s){let i=t.lastIndexOf(s[1]);if(!(p(t,i)||M(t,i))&&wt(t)%2===1)return`${t}_`}return t}let a=e[2],r=t.lastIndexOf(e[1]);return p(t,r)||M(t,r)||we(t,a,r)?t:wt(t)%2===1?`${t}__`:t},ke=t=>{let e=!1;for(let a=0;a<t.length;a+=1){if(t[a]==="`"&&a+2<t.length&&t[a+1]==="`"&&t[a+2]==="`"){e=!e,a+=2;continue}if(!e&&t[a]==="*"&&t[a-1]!=="*"&&t[a+1]!=="*"&&t[a-1]!=="\\"&&!$(t,a)){let r=a>0?t[a-1]:"",s=a<t.length-1?t[a+1]:"";if((!r||r===" "||r===" "||r===`
|
|
13
13
|
`)&&(!s||s===" "||s===" "||s===`
|
|
@@ -19,18 +19,18 @@ import{D as _,F as y,a as P,b as L,c as w,d as b,e as k,f as Z,g as Y,h as tt,i
|
|
|
19
19
|
$$`:`${t}$$`},ve=t=>Oe(t)%2===0?t:De(t),Ue=t=>$e(t)%2===1?`${t}$`:t,Pe=(t,e,a)=>{if(t.substring(e+2).includes(")"))return null;let r=de(t,e);if(r===-1||p(t,r))return null;let s=r>0&&t[r-1]==="!",i=s?r-1:r,n=t.substring(0,i);if(s)return n;let o=t.substring(r+1,e);return a==="text-only"?`${n}${o}`:`${n}[${o}](streamdown:incomplete-link)`},bt=(t,e)=>{for(let a=0;a<e;a++)if(t[a]==="["&&!p(t,a)){if(a>0&&t[a-1]==="!")continue;let r=St(t,a);if(r===-1)return a;if(r+1<t.length&&t[r+1]==="("){let s=t.indexOf(")",r+2);s!==-1&&(a=s)}}return e},He=(t,e,a)=>{let r=e>0&&t[e-1]==="!",s=r?e-1:e;if(!t.substring(e+1).includes("]")){let i=t.substring(0,s);if(r)return i;if(a==="text-only"){let n=bt(t,e);return t.substring(0,n)+t.substring(n+1)}return`${t}](streamdown:incomplete-link)`}if(St(t,e)===-1){let i=t.substring(0,s);if(r)return i;if(a==="text-only"){let n=bt(t,e);return t.substring(0,n)+t.substring(n+1)}return`${t}](streamdown:incomplete-link)`}return null},xt=(t,e="protocol")=>{let a=t.lastIndexOf("](");if(a!==-1&&!p(t,a)){let r=Pe(t,a,e);if(r!==null)return r}for(let r=t.length-1;r>=0;r-=1)if(t[r]==="["&&!p(t,r)){let s=He(t,r,e);if(s!==null)return s}return t},We=/^-{1,2}$/,Je=/^[\s]*-{1,2}[\s]+$/,je=/^={1,2}$/,ze=/^[\s]*={1,2}[\s]+$/,Be=t=>{if(!t||typeof t!="string")return t;let e=t.lastIndexOf(`
|
|
20
20
|
`);if(e===-1)return t;let a=t.substring(e+1),r=t.substring(0,e),s=a.trim();if(We.test(s)&&!a.match(Je)){let i=r.split(`
|
|
21
21
|
`).at(-1);if(i&&i.trim().length>0)return`${t}\u200B`}if(je.test(s)&&!a.match(ze)){let i=r.split(`
|
|
22
|
-
`).at(-1);if(i&&i.trim().length>0)return`${t}\u200B`}return t},Ke=new RegExp("(?<=[\\p{L}\\p{N}_])~(?!~)(?=[\\p{L}\\p{N}_])","gu"),Xe=t=>!t||typeof t!="string"||!t.includes("~")?t:t.replace(Ke,(e,a)=>p(t,a)?e:"\\~"),qe=t=>{var e,a;let r=t.match(se);if(r){let s=r[2];if(!s||S.test(s))return t;let i=t.lastIndexOf(r[1]);if(p(t,i)||M(t,i))return t;if(((e=t.match(
|
|
22
|
+
`).at(-1);if(i&&i.trim().length>0)return`${t}\u200B`}return t},Ke=new RegExp("(?<=[\\p{L}\\p{N}_])~(?!~)(?=[\\p{L}\\p{N}_])","gu"),Xe=t=>!t||typeof t!="string"||!t.includes("~")?t:t.replace(Ke,(e,a)=>p(t,a)?e:"\\~"),qe=t=>{var e,a;let r=t.match(se);if(r){let s=r[2];if(!s||S.test(s))return t;let i=t.lastIndexOf(r[1]);if(p(t,i)||M(t,i))return t;if(((e=t.match(_t))==null?void 0:e.length)%2===1)return`${t}~~`}else{let s=t.match(ce);if(s){let i=t.lastIndexOf(s[0].slice(0,2));if(p(t,i)||M(t,i))return t;if(((a=t.match(_t))==null?void 0:a.length)%2===1)return`${t}~`}}return t},H=t=>t!==!1,Ge=t=>t===!0,g={SINGLE_TILDE:0,COMPARISON_OPERATORS:5,HTML_TAGS:10,SETEXT_HEADINGS:15,LINKS:20,BOLD_ITALIC:30,BOLD:35,ITALIC_DOUBLE_UNDERSCORE:40,ITALIC_SINGLE_ASTERISK:41,ITALIC_SINGLE_UNDERSCORE:42,INLINE_CODE:50,STRIKETHROUGH:60,KATEX:70,INLINE_KATEX:75,DEFAULT:100},Ve=[{handler:{name:"singleTilde",handle:Xe,priority:g.SINGLE_TILDE},optionKey:"singleTilde"},{handler:{name:"comparisonOperators",handle:Qt,priority:g.COMPARISON_OPERATORS},optionKey:"comparisonOperators"},{handler:{name:"htmlTags",handle:Fe,priority:g.HTML_TAGS},optionKey:"htmlTags"},{handler:{name:"setextHeadings",handle:Be,priority:g.SETEXT_HEADINGS},optionKey:"setextHeadings"},{handler:{name:"links",handle:xt,priority:g.LINKS},optionKey:"links",earlyReturn:t=>t.endsWith("](streamdown:incomplete-link)")},{handler:{name:"boldItalic",handle:Ce,priority:g.BOLD_ITALIC},optionKey:"boldItalic"},{handler:{name:"bold",handle:_e,priority:g.BOLD},optionKey:"bold"},{handler:{name:"italicDoubleUnderscore",handle:be,priority:g.ITALIC_DOUBLE_UNDERSCORE},optionKey:"italic"},{handler:{name:"italicSingleAsterisk",handle:Me,priority:g.ITALIC_SINGLE_ASTERISK},optionKey:"italic"},{handler:{name:"italicSingleUnderscore",handle:Te,priority:g.ITALIC_SINGLE_UNDERSCORE},optionKey:"italic"},{handler:{name:"inlineCode",handle:Re,priority:g.INLINE_CODE},optionKey:"inlineCode"},{handler:{name:"strikethrough",handle:qe,priority:g.STRIKETHROUGH},optionKey:"strikethrough"},{handler:{name:"katex",handle:ve,priority:g.KATEX},optionKey:"katex"},{handler:{name:"inlineKatex",handle:Ue,priority:g.INLINE_KATEX},optionKey:"inlineKatex"}],Qe=t=>{var e;let a=(e=t==null?void 0:t.linkMode)!=null?e:"protocol";return Ve.filter(({handler:r,optionKey:s})=>r.name==="links"?H(t==null?void 0:t.links)||H(t==null?void 0:t.images):r.name==="inlineKatex"?Ge(t==null?void 0:t.inlineKatex):H(t==null?void 0:t[s])).map(({handler:r,earlyReturn:s})=>r.name==="links"?{handler:Mt(kt({},r),{handle:i=>xt(i,a)}),earlyReturn:a==="protocol"?s:void 0}:{handler:r,earlyReturn:s})},Ze=(t,e)=>{var a;if(!t||typeof t!="string")return t;let r=t.endsWith(" ")&&!t.endsWith(" ")?t.slice(0,-1):t,s=Qe(e),i=((a=e==null?void 0:e.handlers)!=null?a:[]).map(o=>{var l;return{handler:Mt(kt({},o),{priority:(l=o.priority)!=null?l:g.DEFAULT}),earlyReturn:void 0}}),n=[...s,...i].sort((o,l)=>{var h,f;return((h=o.handler.priority)!=null?h:0)-((f=l.handler.priority)!=null?f:0)});for(let{handler:o,earlyReturn:l}of n)if(r=o.handle(r),l!=null&&l(r))return r;return r},O=Ze;var Ye="__cb:",ta="chat:callback:",ea=720*60*60*1e3;function aa(t){return`${Ye}${t}`}function ra(){return crypto.randomUUID().replace(/-/g,"").slice(0,16)}async function sa(t,e){return{type:"actions",children:await Promise.all(t.children.map(async a=>{if(a.type!=="button"||!a.callbackUrl)return a;let r=ra(),s={url:a.callbackUrl,originalValue:a.value};return await e.set(`${ta}${r}`,s,ea),{type:"button",id:a.id,label:a.label,style:a.style,disabled:a.disabled,value:aa(r),actionType:a.actionType}}))}}function Dt(t){for(let e of t){if(e.type==="actions"){for(let a of e.children)if(a.type==="button"&&a.callbackUrl)return!0}if(e.type==="section"&&"children"in e&&Dt(e.children))return!0}return!1}async function vt(t,e){let a=[];for(let r of t)r.type==="actions"?a.push(await sa(r,e)):r.type==="section"&&"children"in r?a.push({...r,children:await vt(r.children,e)}):a.push(r);return a}async function D(t,e){return Dt(t.children)?{...t,children:await vt(t.children,e)}:t}var Ft=null;function v(){if(!Ft)throw new Error("No Chat singleton registered. Call chat.registerSingleton() first.");return Ft}var ia=new Set(["markdown_text","task_update","plan_update"]);async function*Ut(t){var r,s;let e=!1,a=!1;for await(let i of t){if(typeof i=="string"){yield i;continue}if(i===null||typeof i!="object"||!("type"in i))continue;let n=i;if(ia.has(n.type)){yield i;continue}let o=(s=(r=n.text)!=null?r:n.delta)!=null?s:n.textDelta;n.type==="text-delta"&&typeof o=="string"?(e&&a&&(yield`
|
|
23
23
|
|
|
24
|
-
`),e=!1,a=!0,yield o):n.type==="finish-step"&&(e=!0)}}var na=new WeakMap;var T=class z{constructor(e){c(this,"id");c(this,"threadId");c(this,"text");c(this,"formatted");c(this,"raw");c(this,"author");c(this,"metadata");c(this,"attachments");c(this,"isMention");c(this,"userKey");c(this,"links");c(this,"_subjectPromise");var a;this.id=e.id,this.threadId=e.threadId,this.text=e.text,this.formatted=e.formatted,this.raw=e.raw,this.author=e.author,this.metadata=e.metadata,this.attachments=e.attachments,this.isMention=e.isMention,this.links=(a=e.links)!=null?a:[]}get subject(){if(this._subjectPromise)return this._subjectPromise;let e=na.get(this);return e!=null&&e.fetchSubject?(this._subjectPromise=e.fetchSubject(this.raw).catch(()=>null),this._subjectPromise):(this._subjectPromise=Promise.resolve(null),this._subjectPromise)}toJSON(){var e;return{_type:"chat:Message",id:this.id,threadId:this.threadId,text:this.text,formatted:this.formatted,raw:this.raw,author:{userId:this.author.userId,userName:this.author.userName,fullName:this.author.fullName,isBot:this.author.isBot,isMe:this.author.isMe},metadata:{dateSent:this.metadata.dateSent.toISOString(),edited:this.metadata.edited,editedAt:(e=this.metadata.editedAt)==null?void 0:e.toISOString()},attachments:this.attachments.map(a=>({type:a.type,url:a.url,name:a.name,mimeType:a.mimeType,size:a.size,width:a.width,height:a.height,fetchMetadata:a.fetchMetadata})),isMention:this.isMention,links:this.links.length>0?this.links.map(a=>({url:a.url,title:a.title,description:a.description,imageUrl:a.imageUrl,siteName:a.siteName})):void 0}}static fromJSON(e){return new z({id:e.id,threadId:e.threadId,text:e.text,formatted:e.formatted,raw:e.raw,author:e.author,metadata:{dateSent:new Date(e.metadata.dateSent),edited:e.metadata.edited,editedAt:e.metadata.editedAt?new Date(e.metadata.editedAt):void 0},attachments:e.attachments,isMention:e.isMention,links:e.links})}static[C](e){return e.toJSON()}static[x](e){return z.fromJSON(e)}},oa=Symbol.for("chat.postable");function Pt(t){return typeof t=="object"&&t!==null&&t.$$typeof===oa}async function Ht(t,e,a,r,s){let i=n=>{var o;return{adapter:e,logger:s,messageId:n.id,threadId:(o=n.threadId)!=null?o:a}};if(t.isSupported(e)&&e.postObject){let n=await e.postObject(a,t.kind,t.getPostData());t.onPosted(i(n))}else{let n=await r(a,t.getFallbackText());t.onPosted(i(n))}}var la=class extends Error{constructor(e,a,r){super(e);c(this,"code");c(this,"cause");this.name="ChatError",this.code=a,this.cause=r}};var Wt=class extends la{constructor(e,a,r){super(e,"NOT_IMPLEMENTED",r);c(this,"feature");this.name="NotImplementedError",this.feature=a}};var U=720*60*60*1e3,Nt="channel-state:";function ca(t){return"adapterName"in t&&!("adapter"in t)}function da(t){return t!==null&&typeof t=="object"&&Symbol.asyncIterator in t}var ha=class B{constructor(e){c(this,"id");c(this,"isDM");c(this,"channelVisibility");c(this,"_adapter");c(this,"_adapterName");c(this,"_stateAdapterInstance");c(this,"_name",null);c(this,"_threadHistory");var a,r;this.id=e.id,this.isDM=(a=e.isDM)!=null?a:!1,this.channelVisibility=(r=e.channelVisibility)!=null?r:"unknown",ca(e)?this._adapterName=e.adapterName:(this._adapter=e.adapter,this._stateAdapterInstance=e.stateAdapter,this._threadHistory=e.threadHistory)}get adapter(){if(this._adapter)return this._adapter;if(!this._adapterName)throw new Error("Channel has no adapter configured");let a=v().getAdapter(this._adapterName);if(!a)throw new Error(`Adapter "${this._adapterName}" not found in Chat singleton`);return this._adapter=a,a}get _stateAdapter(){if(this._stateAdapterInstance)return this._stateAdapterInstance;let e=v();return this._stateAdapterInstance=e.getState(),this._stateAdapterInstance}get name(){return this._name}get state(){return this._stateAdapter.get(`${Nt}${this.id}`)}async setState(e,a){let r=`${Nt}${this.id}`;if(a!=null&&a.replace)await this._stateAdapter.set(r,e,U);else{let i={...await this._stateAdapter.get(r),...e};await this._stateAdapter.set(r,i,U)}}get messages(){let e=this.adapter,a=this.id,r=this._threadHistory;return{async*[Symbol.asyncIterator](){let s,i=!1;for(;;){let n={cursor:s,direction:"backward"},o=e.fetchChannelMessages?await e.fetchChannelMessages(a,n):await e.fetchMessages(a,n),l=[...o.messages].reverse();for(let h of l)i=!0,yield h;if(!o.nextCursor||o.messages.length===0)break;s=o.nextCursor}if(!i&&r){let n=await r.getMessages(a);for(let o=n.length-1;o>=0;o--)yield n[o]}}}}threads(){let e=this.adapter,a=this.id;return{async*[Symbol.asyncIterator](){if(!e.listThreads)return;let r;for(;;){let s=await e.listThreads(a,{cursor:r});for(let i of s.threads)yield i;if(!s.nextCursor||s.threads.length===0)break;r=s.nextCursor}}}}async fetchMetadata(){var e;if(this.adapter.fetchChannelInfo){let a=await this.adapter.fetchChannelInfo(this.id);return this._name=(e=a.name)!=null?e:null,a}return{id:this.id,isDM:this.isDM,metadata:{}}}async post(e){if(Pt(e))return await this.handlePostableObject(e),e;if(da(e)){let r="";for await(let s of Ut(e))typeof s=="string"?r+=s:s.type==="markdown_text"&&(r+=s.text);return this.postSingleMessage({markdown:r})}let a=e;if(
|
|
24
|
+
`),e=!1,a=!0,yield o):n.type==="finish-step"&&(e=!0)}}var na=new WeakMap;var T=class z{constructor(e){c(this,"id");c(this,"threadId");c(this,"text");c(this,"formatted");c(this,"raw");c(this,"author");c(this,"metadata");c(this,"attachments");c(this,"isMention");c(this,"userKey");c(this,"links");c(this,"_subjectPromise");var a;this.id=e.id,this.threadId=e.threadId,this.text=e.text,this.formatted=e.formatted,this.raw=e.raw,this.author=e.author,this.metadata=e.metadata,this.attachments=e.attachments,this.isMention=e.isMention,this.links=(a=e.links)!=null?a:[]}get subject(){if(this._subjectPromise)return this._subjectPromise;let e=na.get(this);return e!=null&&e.fetchSubject?(this._subjectPromise=e.fetchSubject(this.raw).catch(()=>null),this._subjectPromise):(this._subjectPromise=Promise.resolve(null),this._subjectPromise)}toJSON(){var e;return{_type:"chat:Message",id:this.id,threadId:this.threadId,text:this.text,formatted:this.formatted,raw:this.raw,author:{userId:this.author.userId,userName:this.author.userName,fullName:this.author.fullName,isBot:this.author.isBot,isMe:this.author.isMe},metadata:{dateSent:this.metadata.dateSent.toISOString(),edited:this.metadata.edited,editedAt:(e=this.metadata.editedAt)==null?void 0:e.toISOString()},attachments:this.attachments.map(a=>({type:a.type,url:a.url,name:a.name,mimeType:a.mimeType,size:a.size,width:a.width,height:a.height,fetchMetadata:a.fetchMetadata})),isMention:this.isMention,links:this.links.length>0?this.links.map(a=>({url:a.url,title:a.title,description:a.description,imageUrl:a.imageUrl,siteName:a.siteName})):void 0}}static fromJSON(e){return new z({id:e.id,threadId:e.threadId,text:e.text,formatted:e.formatted,raw:e.raw,author:e.author,metadata:{dateSent:new Date(e.metadata.dateSent),edited:e.metadata.edited,editedAt:e.metadata.editedAt?new Date(e.metadata.editedAt):void 0},attachments:e.attachments,isMention:e.isMention,links:e.links})}static[C](e){return e.toJSON()}static[x](e){return z.fromJSON(e)}},oa=Symbol.for("chat.postable");function Pt(t){return typeof t=="object"&&t!==null&&t.$$typeof===oa}async function Ht(t,e,a,r,s){let i=n=>{var o;return{adapter:e,logger:s,messageId:n.id,threadId:(o=n.threadId)!=null?o:a}};if(t.isSupported(e)&&e.postObject){let n=await e.postObject(a,t.kind,t.getPostData());t.onPosted(i(n))}else{let n=await r(a,t.getFallbackText());t.onPosted(i(n))}}var la=class extends Error{constructor(e,a,r){super(e);c(this,"code");c(this,"cause");this.name="ChatError",this.code=a,this.cause=r}};var Wt=class extends la{constructor(e,a,r){super(e,"NOT_IMPLEMENTED",r);c(this,"feature");this.name="NotImplementedError",this.feature=a}};var U=720*60*60*1e3,Nt="channel-state:";function ca(t){return"adapterName"in t&&!("adapter"in t)}function da(t){return t!==null&&typeof t=="object"&&Symbol.asyncIterator in t}var ha=class B{constructor(e){c(this,"id");c(this,"isDM");c(this,"channelVisibility");c(this,"_adapter");c(this,"_adapterName");c(this,"_stateAdapterInstance");c(this,"_name",null);c(this,"_threadHistory");var a,r;this.id=e.id,this.isDM=(a=e.isDM)!=null?a:!1,this.channelVisibility=(r=e.channelVisibility)!=null?r:"unknown",ca(e)?this._adapterName=e.adapterName:(this._adapter=e.adapter,this._stateAdapterInstance=e.stateAdapter,this._threadHistory=e.threadHistory)}get adapter(){if(this._adapter)return this._adapter;if(!this._adapterName)throw new Error("Channel has no adapter configured");let a=v().getAdapter(this._adapterName);if(!a)throw new Error(`Adapter "${this._adapterName}" not found in Chat singleton`);return this._adapter=a,a}get _stateAdapter(){if(this._stateAdapterInstance)return this._stateAdapterInstance;let e=v();return this._stateAdapterInstance=e.getState(),this._stateAdapterInstance}get name(){return this._name}get state(){return this._stateAdapter.get(`${Nt}${this.id}`)}async setState(e,a){let r=`${Nt}${this.id}`;if(a!=null&&a.replace)await this._stateAdapter.set(r,e,U);else{let i={...await this._stateAdapter.get(r),...e};await this._stateAdapter.set(r,i,U)}}get messages(){let e=this.adapter,a=this.id,r=this._threadHistory;return{async*[Symbol.asyncIterator](){let s,i=!1;for(;;){let n={cursor:s,direction:"backward"},o=e.fetchChannelMessages?await e.fetchChannelMessages(a,n):await e.fetchMessages(a,n),l=[...o.messages].reverse();for(let h of l)i=!0,yield h;if(!o.nextCursor||o.messages.length===0)break;s=o.nextCursor}if(!i&&r){let n=await r.getMessages(a);for(let o=n.length-1;o>=0;o--)yield n[o]}}}}threads(){let e=this.adapter,a=this.id;return{async*[Symbol.asyncIterator](){if(!e.listThreads)return;let r;for(;;){let s=await e.listThreads(a,{cursor:r});for(let i of s.threads)yield i;if(!s.nextCursor||s.threads.length===0)break;r=s.nextCursor}}}}async fetchMetadata(){var e;if(this.adapter.fetchChannelInfo){let a=await this.adapter.fetchChannelInfo(this.id);return this._name=(e=a.name)!=null?e:null,a}return{id:this.id,isDM:this.isDM,metadata:{}}}async post(e){if(Pt(e))return await this.handlePostableObject(e),e;if(da(e)){let r="";for await(let s of Ut(e))typeof s=="string"?r+=s:s.type==="markdown_text"&&(r+=s.text);return this.postSingleMessage({markdown:r})}let a=e;if(_(e)){let r=y(e);if(!r)throw new Error("Invalid JSX element: must be a Card element");a=r}return a=await this.processCallbackUrls(a),this.postSingleMessage(a)}async handlePostableObject(e){await Ht(e,this.adapter,this.id,(a,r)=>this.adapter.postChannelMessage?this.adapter.postChannelMessage(a,r):this.adapter.postMessage(a,r))}async postSingleMessage(e){let a=this.adapter.postChannelMessage?await this.adapter.postChannelMessage(this.id,e):await this.adapter.postMessage(this.id,e),r=this.createSentMessage(a.id,e,a.threadId);return this._threadHistory&&await this._threadHistory.append(this.id,new T(r)),r}async postEphemeral(e,a,r){let{fallbackToDM:s}=r,i=typeof e=="string"?e:e.userId,n;if(_(a)){let o=y(a);if(!o)throw new Error("Invalid JSX element: must be a Card element");n=o}else n=a;if(n=await this.processCallbackUrls(n),this.adapter.postEphemeral)return this.adapter.postEphemeral(this.id,i,n);if(!s)return null;if(this.adapter.openDM){let o=await this.adapter.openDM(i),l=await this.adapter.postMessage(o,n);return{id:l.id,threadId:o,usedFallback:!0,raw:l.raw}}return null}async schedule(e,a){let r;if(_(e)){let s=y(e);if(!s)throw new Error("Invalid JSX element: must be a Card element");r=s}else r=e;if(r=await this.processCallbackUrls(r),!this.adapter.scheduleMessage)throw new Wt("Scheduled messages are not supported by this adapter","scheduling");return this.adapter.scheduleMessage(this.id,r,a)}async processCallbackUrls(e){var a;if(typeof e=="string")return e;if("type"in e&&e.type==="card")return D(e,this._stateAdapter);if("card"in e&&((a=e.card)==null?void 0:a.type)==="card"){let r=await D(e.card,this._stateAdapter);if(r!==e.card)return{...e,card:r}}return e}async startTyping(e){await this.adapter.startTyping(this.id,e)}mentionUser(e){return`<@${e}>`}toJSON(){var e;return{_type:"chat:Channel",id:this.id,adapterName:(e=this._adapterName)!=null?e:this.adapter.name,channelVisibility:this.channelVisibility,isDM:this.isDM}}static fromJSON(e,a){let r=new B({id:e.id,adapterName:e.adapterName,channelVisibility:e.channelVisibility,isDM:e.isDM});return a&&(r._adapter=a),r}static[C](e){return e.toJSON()}static[x](e){return B.fromJSON(e)}createSentMessage(e,a,r){let s=this.adapter,i=r||this.id,n=this,{plainText:o,formatted:l,attachments:h}=fa(a);return{id:e,threadId:i,text:o,formatted:l,raw:null,author:{userId:"self",userName:s.userName,fullName:s.userName,isBot:!0,isMe:!0},metadata:{dateSent:new Date,edited:!1},attachments:h,links:[],toJSON(){return new T(this).toJSON()},async edit(d){let u=d;if(_(d)){let m=y(d);if(!m)throw new Error("Invalid JSX element: must be a Card element");u=m}return u=await n.processCallbackUrls(u),await s.editMessage(i,e,u),n.createSentMessage(e,u)},async delete(){await s.deleteMessage(i,e)},async addReaction(d){await s.addReaction(i,e,d)},async removeReaction(d){await s.removeReaction(i,e,d)}}}};function ua(t,e){return t.channelIdFromThreadId(e)}function fa(t){if(typeof t=="string")return{plainText:t,formatted:k([b([w(t)])]),attachments:[]};if("raw"in t)return{plainText:t.raw,formatted:k([b([w(t.raw)])]),attachments:t.attachments||[]};if("markdown"in t){let e=P(t.markdown);return{plainText:L(e),formatted:e,attachments:t.attachments||[]}}if("ast"in t)return{plainText:L(t.ast),formatted:t.ast,attachments:t.attachments||[]};if("card"in t){let e=t.fallbackText||R(t.card);return{plainText:e,formatted:k([b([w(e)])]),attachments:[]}}if("type"in t&&t.type==="card"){let e=R(t);return{plainText:e,formatted:k([b([w(e)])]),attachments:[]}}throw new Error("Invalid PostableMessage format")}var ga=class{constructor(t={}){c(this,"accumulated","");c(this,"dirty",!0);c(this,"cachedRender","");c(this,"finished",!1);c(this,"fenceToggles",0);c(this,"incompleteLine","");c(this,"options");var e;this.options={wrapTablesForAppend:(e=t.wrapTablesForAppend)!=null?e:!0}}push(t){var a;this.accumulated+=t,this.dirty=!0,this.incompleteLine+=t;let e=this.incompleteLine.split(`
|
|
25
25
|
`);this.incompleteLine=(a=e.pop())!=null?a:"";for(let r of e){let s=r.trimStart();(s.startsWith("```")||s.startsWith("~~~"))&&this.fenceToggles++}}isAccumulatedInsideFence(){let t=this.fenceToggles%2===1,e=this.incompleteLine.trimStart();return(e.startsWith("```")||e.startsWith("~~~"))&&(t=!t),t}render(){if(!this.dirty)return this.cachedRender;if(this.dirty=!1,this.finished)return this.cachedRender=O(this.accumulated),this.cachedRender;if(this.isAccumulatedInsideFence())return this.cachedRender=O(this.accumulated),this.cachedRender;let t=Rt(this.accumulated);return this.cachedRender=O(t),this.cachedRender}getCommittableText(){if(this.finished)return this.formatAppendOnlyText(this.accumulated,!0);let t=this.accumulated;if(t.length>0&&!t.endsWith(`
|
|
26
26
|
`)){let r=t.lastIndexOf(`
|
|
27
|
-
`),s=r>=0?t.slice(0,r+1):"";if(j(s))return this.formatAppendOnlyText(t);t=s}if(j(t))return this.formatAppendOnlyText(t);let e=Rt(t),a=this.formatAppendOnlyText(e);return j(a)?a:ma(a)}getText(){return this.accumulated}finish(){return this.finished=!0,this.dirty=!0,this.render()}formatAppendOnlyText(t,e=!1){return this.options.wrapTablesForAppend?
|
|
27
|
+
`),s=r>=0?t.slice(0,r+1):"";if(j(s))return this.formatAppendOnlyText(t);t=s}if(j(t))return this.formatAppendOnlyText(t);let e=Rt(t),a=this.formatAppendOnlyText(e);return j(a)?a:ma(a)}getText(){return this.accumulated}finish(){return this.finished=!0,this.dirty=!0,this.render()}formatAppendOnlyText(t,e=!1){return this.options.wrapTablesForAppend?ya(t,e):t}},pa=new Set(["*","~","`","["]);function Lt(t){return O(t).length<=t.length}function ma(t){if(t.length===0||Lt(t))return t;for(let e=t.length-1;e>=0;e--)if(pa.has(t[e])){for(;e>0&&t[e-1]===t[e];)e--;let a=t.slice(0,e);if(Lt(a))return a}return""}var K=/^\|.*\|$/,X=/^\|[\s:]*-{1,}[\s:]*(\|[\s:]*-{1,}[\s:]*)*\|$/;function j(t){let e=!1;for(let a of t.split(`
|
|
28
28
|
`)){let r=a.trimStart();(r.startsWith("```")||r.startsWith("~~~"))&&(e=!e)}return e}function Rt(t){let e=t.endsWith(`
|
|
29
29
|
`),a=t.split(`
|
|
30
30
|
`);!e&&a.length>0&&a.pop(),e&&a.length>0&&a.at(-1)===""&&a.pop();let r=0,s=!1;for(let l=a.length-1;l>=0;l--){let h=a[l].trim();if(h==="")break;if(X.test(h)){s=!0;break}if(K.test(h))r++;else break}if(s||r===0)return t;let i=a.length-r,n=a.slice(0,i),o=n.join(`
|
|
31
31
|
`);return n.length>0&&(o+=`
|
|
32
|
-
`),o}function
|
|
32
|
+
`),o}function ya(t,e=!1){let a=t.endsWith(`
|
|
33
33
|
`),r=t.split(`
|
|
34
34
|
`);a&&r.length>0&&r.at(-1)===""&&r.pop();let s=[],i=!1,n=!1;for(let l=0;l<r.length;l++){let h=r[l].trim();if(!i&&(h.startsWith("```")||h.startsWith("~~~"))){n=!n,s.push(r[l]);continue}if(n){s.push(r[l]);continue}let f=h!==""&&(K.test(h)||X.test(h));if(f&&!i){let d=!1;for(let u=l;u<r.length;u++){let m=r[u].trim();if(X.test(m)){d=!0;break}if(m===""||!K.test(m))break}d&&(s.push("```"),i=!0)}else!f&&i&&(s.push("```"),i=!1);s.push(r[l])}i&&e&&s.push("```");let o=s.join(`
|
|
35
35
|
`);return a&&(o+=`
|
|
36
|
-
`),o}function ya(t){return"adapterName"in t&&!("adapter"in t)}var Ot="thread-state:";function wa(t){return t!==null&&typeof t=="object"&&Symbol.asyncIterator in t}var mr=class q{constructor(e){c(this,"id");c(this,"channelId");c(this,"isDM");c(this,"channelVisibility");c(this,"_adapter");c(this,"_adapterName");c(this,"_stateAdapterInstance");c(this,"_recentMessages",[]);c(this,"_isSubscribedContext");c(this,"_currentMessage");c(this,"_streamingUpdateIntervalMs");c(this,"_fallbackStreamingPlaceholderText");c(this,"_channel");c(this,"_threadHistory");c(this,"_logger");var a,r,s,i;this.id=e.id,this.channelId=e.channelId,this.isDM=(a=e.isDM)!=null?a:!1,this.channelVisibility=(r=e.channelVisibility)!=null?r:"unknown",this._isSubscribedContext=(s=e.isSubscribedContext)!=null?s:!1,this._currentMessage=e.currentMessage,this._logger=e.logger,this._streamingUpdateIntervalMs=(i=e.streamingUpdateIntervalMs)!=null?i:500,this._fallbackStreamingPlaceholderText=e.fallbackStreamingPlaceholderText!==void 0?e.fallbackStreamingPlaceholderText:"...",ya(e)?this._adapterName=e.adapterName:(this._adapter=e.adapter,this._stateAdapterInstance=e.stateAdapter,this._threadHistory=e.threadHistory),e.initialMessage&&(this._recentMessages=[e.initialMessage])}get adapter(){if(this._adapter)return this._adapter;if(!this._adapterName)throw new Error("Thread has no adapter configured");let a=v().getAdapter(this._adapterName);if(!a)throw new Error(`Adapter "${this._adapterName}" not found in Chat singleton`);return this._adapter=a,a}get _stateAdapter(){if(this._stateAdapterInstance)return this._stateAdapterInstance;let e=v();return this._stateAdapterInstance=e.getState(),this._stateAdapterInstance}get recentMessages(){return this._recentMessages}set recentMessages(e){this._recentMessages=e}get state(){return this._stateAdapter.get(`${Ot}${this.id}`)}async setState(e,a){let r=`${Ot}${this.id}`;if(a!=null&&a.replace)await this._stateAdapter.set(r,e,U);else{let i={...await this._stateAdapter.get(r),...e};await this._stateAdapter.set(r,i,U)}}get channel(){if(!this._channel){let e=ua(this.adapter,this.id);this._channel=new ha({id:e,adapter:this.adapter,stateAdapter:this._stateAdapter,isDM:this.isDM,channelVisibility:this.channelVisibility,threadHistory:this._threadHistory})}return this._channel}get messages(){let e=this.adapter,a=this.id,r=this._threadHistory;return{async*[Symbol.asyncIterator](){let s,i=!1;for(;;){let n=await e.fetchMessages(a,{cursor:s,direction:"backward"}),o=[...n.messages].reverse();for(let l of o)i=!0,yield l;if(!n.nextCursor||n.messages.length===0)break;s=n.nextCursor}if(!i&&r){let n=await r.getMessages(a);for(let o=n.length-1;o>=0;o--)yield n[o]}}}}get allMessages(){let e=this.adapter,a=this.id,r=this._threadHistory;return{async*[Symbol.asyncIterator](){let s,i=!1;for(;;){let n=await e.fetchMessages(a,{limit:100,cursor:s,direction:"forward"});for(let o of n.messages)i=!0,yield o;if(!n.nextCursor||n.messages.length===0)break;s=n.nextCursor}if(!i&&r){let n=await r.getMessages(a);for(let o of n)yield o}}}}async getParticipants(){let e=new Map;this._currentMessage&&!this._currentMessage.author.isMe&&!this._currentMessage.author.isBot&&e.set(this._currentMessage.author.userId,this._currentMessage.author);for await(let a of this.allMessages)a.author.isMe||a.author.isBot||e.has(a.author.userId)||e.set(a.author.userId,a.author);return[...e.values()]}async isSubscribed(){return this._isSubscribedContext?!0:this._stateAdapter.isSubscribed(this.id)}async subscribe(){await this._stateAdapter.subscribe(this.id),this.adapter.onThreadSubscribe&&await this.adapter.onThreadSubscribe(this.id)}async unsubscribe(){await this._stateAdapter.unsubscribe(this.id)}async post(e){if(Pt(e)){if(e.kind==="stream"){let i=e.getPostData(),n={...i.options.updateIntervalMs?{updateIntervalMs:i.options.updateIntervalMs}:{},...i.options.groupTasks?{taskDisplayMode:i.options.groupTasks}:{},...i.options.endWith?{stopBlocks:i.options.endWith}:{}};return await this.handleStream(i.stream,n),e}return await this.handlePostableObject(e),e}if(wa(e))return this.handleStream(e);let a=e;if(y(e)){let i=_(e);if(!i)throw new Error("Invalid JSX element: must be a Card element");a=i}a=await this.processCallbackUrls(a);let r=await this.adapter.postMessage(this.id,a),s=this.createSentMessage(r.id,a,r.threadId);return this._threadHistory&&await this._threadHistory.append(this.id,new T(s)),s}async handlePostableObject(e){await Ht(e,this.adapter,this.id,(a,r)=>this.adapter.postMessage(a,r),this._logger)}async postEphemeral(e,a,r){let{fallbackToDM:s}=r,i=typeof e=="string"?e:e.userId,n;if(y(a)){let o=_(a);if(!o)throw new Error("Invalid JSX element: must be a Card element");n=o}else n=a;if(n=await this.processCallbackUrls(n),this.adapter.postEphemeral)return this.adapter.postEphemeral(this.id,i,n);if(!s)return null;if(this.adapter.openDM){let o=await this.adapter.openDM(i),l=await this.adapter.postMessage(o,n);return{id:l.id,threadId:o,usedFallback:!0,raw:l.raw}}return null}async processCallbackUrls(e){var a;if(typeof e=="string")return e;if("type"in e&&e.type==="card")return D(e,this._stateAdapter);if("card"in e&&((a=e.card)==null?void 0:a.type)==="card"){let r=await D(e.card,this._stateAdapter);if(r!==e.card)return{...e,card:r}}return e}async schedule(e,a){let r;if(y(e)){let s=_(e);if(!s)throw new Error("Invalid JSX element: must be a Card element");r=s}else r=e;if(r=await this.processCallbackUrls(r),!this.adapter.scheduleMessage)throw new Wt("Scheduled messages are not supported by this adapter","scheduling");return this.adapter.scheduleMessage(this.id,r,a)}async handleStream(e,a){let r=Ut(e),s={updateIntervalMs:this._streamingUpdateIntervalMs,...a};if(this._currentMessage&&(s.recipientUserId=this._currentMessage.author.userId,s.recipientTeamId=this.extractSlackRecipientTeamId(this._currentMessage.raw)),this.adapter.stream){let n="",o={[Symbol.asyncIterator]:()=>{let h=r[Symbol.asyncIterator]();return{async next(){let f=await h.next();if(!f.done){let d=f.value;typeof d=="string"?n+=d:d.type==="markdown_text"&&(n+=d.text)}return f}}}},l=await this.adapter.stream(this.id,o,s);if(l){let h=this.createSentMessage(l.id,{markdown:n},l.threadId);return this._threadHistory&&await this._threadHistory.append(this.id,new T(h)),h}}let i={[Symbol.asyncIterator]:()=>{let n=r[Symbol.asyncIterator]();return{async next(){for(;;){let o=await n.next();if(o.done)return{value:void 0,done:!0};let l=o.value;if(typeof l=="string")return{value:l,done:!1};if(l.type==="markdown_text")return{value:l.text,done:!1}}}}}};return this.fallbackStream(i,s)}extractSlackRecipientTeamId(e){var r;if(!e||typeof e!="object")return;let a=e;if(typeof a.team_id=="string"&&a.team_id)return a.team_id;if(typeof a.team=="string"&&a.team)return a.team;if(a.team&&typeof a.team=="object"&&typeof a.team.id=="string"&&a.team.id)return a.team.id;if(typeof((r=a.user)==null?void 0:r.team_id)=="string"&&a.user.team_id)return a.user.team_id}async startTyping(e){await this.adapter.startTyping(this.id,e)}async fallbackStream(e,a){var Q;let r=(Q=a==null?void 0:a.updateIntervalMs)!=null?Q:this._streamingUpdateIntervalMs,s=this._fallbackStreamingPlaceholderText,i=s===null?null:await this.adapter.postMessage(this.id,s),n=this.id,o=new ga,l="",h=!1,f=null,d=null;i&&(n=i.threadId||this.id,l=s!=null?s:"");let u=()=>{d=setTimeout(()=>{f=m()},r)},m=async()=>{var A;if(h||!i)return;let E=o.render();if(E.trim()&&E!==l)try{await this.adapter.editMessage(n,i.id,{markdown:E}),l=E}catch(Jt){(A=this._logger)==null||A.warn("fallbackStream edit failed",Jt)}h||u()};i&&u();try{for await(let E of e)if(o.push(E),!i){let A=o.render();A.trim()&&(i=await this.adapter.postMessage(this.id,{markdown:A}),n=i.threadId||this.id,l=A,u())}}finally{h=!0,d&&(clearTimeout(d),d=null)}f&&await f;let N=o.getText(),G=o.finish();i||(i=await this.adapter.postMessage(this.id,{markdown:N.trim()?N:" "}),n=i.threadId||this.id,l=N),G.trim()&&G!==l&&await this.adapter.editMessage(n,i.id,{markdown:N});let V=this.createSentMessage(i.id,{markdown:N},n);return this._threadHistory&&await this._threadHistory.append(this.id,new T(V)),V}async refresh(){let e=await this.adapter.fetchMessages(this.id,{limit:50});e.messages.length>0?this._recentMessages=e.messages:this._threadHistory?this._recentMessages=await this._threadHistory.getMessages(this.id,50):this._recentMessages=[]}mentionUser(e){return`<@${e}>`}toJSON(){var e,a;return{_type:"chat:Thread",id:this.id,channelId:this.channelId,channelVisibility:this.channelVisibility,currentMessage:(e=this._currentMessage)==null?void 0:e.toJSON(),isDM:this.isDM,adapterName:(a=this._adapterName)!=null?a:this.adapter.name}}static fromJSON(e,a){let r=new q({id:e.id,adapterName:e.adapterName,channelId:e.channelId,channelVisibility:e.channelVisibility,currentMessage:e.currentMessage?T.fromJSON(e.currentMessage):void 0,isDM:e.isDM});return a&&(r._adapter=a),r}static[C](e){return e.toJSON()}static[x](e){return q.fromJSON(e)}createSentMessage(e,a,r){let s=this.adapter,i=r||this.id,n=this,{plainText:o,formatted:l,attachments:h}=ba(a);return{id:e,threadId:i,text:o,formatted:l,raw:null,links:[],author:{userId:"self",userName:s.userName,fullName:s.userName,isBot:!0,isMe:!0},metadata:{dateSent:new Date,edited:!1},attachments:h,toJSON(){return new T(this).toJSON()},async edit(d){let u=d;if(y(d)){let m=_(d);if(!m)throw new Error("Invalid JSX element: must be a Card element");u=m}return u=await n.processCallbackUrls(u),await s.editMessage(i,e,u),n.createSentMessage(e,u)},async delete(){await s.deleteMessage(i,e)},async addReaction(d){await s.addReaction(i,e,d)},async removeReaction(d){await s.removeReaction(i,e,d)}}}createSentMessageFromMessage(e){let a=this.adapter,r=this.id,s=e.id,i=this;return{id:e.id,threadId:e.threadId,text:e.text,formatted:e.formatted,raw:e.raw,author:e.author,metadata:e.metadata,attachments:e.attachments,links:e.links,isMention:e.isMention,toJSON(){return e.toJSON()},async edit(n){let o=n;if(y(n)){let l=_(n);if(!l)throw new Error("Invalid JSX element: must be a Card element");o=l}return o=await i.processCallbackUrls(o),await a.editMessage(r,s,o),i.createSentMessage(s,o,r)},async delete(){await a.deleteMessage(r,s)},async addReaction(n){await a.addReaction(r,s,n)},async removeReaction(n){await a.removeReaction(r,s,n)}}}};function ba(t){if(typeof t=="string")return{plainText:t,formatted:k([b([w(t)])]),attachments:[]};if("raw"in t)return{plainText:t.raw,formatted:k([b([w(t.raw)])]),attachments:t.attachments||[]};if("markdown"in t){let e=P(t.markdown);return{plainText:L(e),formatted:e,attachments:t.attachments||[]}}if("ast"in t)return{plainText:L(t.ast),formatted:t.ast,attachments:t.attachments||[]};if("card"in t){let e=t.fallbackText||R(t.card);return{plainText:e,formatted:k([b([w(e)])]),attachments:[]}}if("type"in t&&t.type==="card"){let e=R(t);return{plainText:e,formatted:k([b([w(e)])]),attachments:[]}}throw new Error("Invalid PostableMessage format")}var _r=10080*60*1e3;var yr=300*1e3,wr=1440*60*1e3;var $t=new Map;function F(t){let e=$t.get(t);return e||(e=Object.freeze({name:t,toString:()=>`{{emoji:${t}}}`,toJSON:()=>`{{emoji:${t}}}`}),$t.set(t,e)),e}var ka={thumbs_up:{slack:["+1","thumbsup"],gchat:"\u{1F44D}"},thumbs_down:{slack:["-1","thumbsdown"],gchat:"\u{1F44E}"},clap:{slack:"clap",gchat:"\u{1F44F}"},wave:{slack:"wave",gchat:"\u{1F44B}"},pray:{slack:"pray",gchat:"\u{1F64F}"},muscle:{slack:"muscle",gchat:"\u{1F4AA}"},ok_hand:{slack:"ok_hand",gchat:"\u{1F44C}"},point_up:{slack:"point_up",gchat:"\u{1F446}"},point_down:{slack:"point_down",gchat:"\u{1F447}"},point_left:{slack:"point_left",gchat:"\u{1F448}"},point_right:{slack:"point_right",gchat:"\u{1F449}"},raised_hands:{slack:"raised_hands",gchat:"\u{1F64C}"},shrug:{slack:"shrug",gchat:"\u{1F937}"},facepalm:{slack:"facepalm",gchat:"\u{1F926}"},heart:{slack:"heart",gchat:["\u2764\uFE0F","\u2764"]},smile:{slack:["smile","slightly_smiling_face"],gchat:"\u{1F60A}"},laugh:{slack:["laughing","satisfied","joy"],gchat:["\u{1F602}","\u{1F606}"]},thinking:{slack:"thinking_face",gchat:"\u{1F914}"},sad:{slack:["cry","sad","white_frowning_face"],gchat:"\u{1F622}"},cry:{slack:"sob",gchat:"\u{1F62D}"},angry:{slack:"angry",gchat:"\u{1F620}"},love_eyes:{slack:"heart_eyes",gchat:"\u{1F60D}"},cool:{slack:"sunglasses",gchat:"\u{1F60E}"},wink:{slack:"wink",gchat:"\u{1F609}"},surprised:{slack:"open_mouth",gchat:"\u{1F62E}"},worried:{slack:"worried",gchat:"\u{1F61F}"},confused:{slack:"confused",gchat:"\u{1F615}"},neutral:{slack:"neutral_face",gchat:"\u{1F610}"},sleeping:{slack:"sleeping",gchat:"\u{1F634}"},sick:{slack:"nauseated_face",gchat:"\u{1F922}"},mind_blown:{slack:"exploding_head",gchat:"\u{1F92F}"},relieved:{slack:"relieved",gchat:"\u{1F60C}"},grimace:{slack:"grimacing",gchat:"\u{1F62C}"},rolling_eyes:{slack:"rolling_eyes",gchat:"\u{1F644}"},hug:{slack:"hugging_face",gchat:"\u{1F917}"},zany:{slack:"zany_face",gchat:"\u{1F92A}"},check:{slack:["white_check_mark","heavy_check_mark"],gchat:["\u2705","\u2714\uFE0F"]},x:{slack:["x","heavy_multiplication_x"],gchat:["\u274C","\u2716\uFE0F"]},question:{slack:"question",gchat:["\u2753","?"]},exclamation:{slack:"exclamation",gchat:"\u2757"},warning:{slack:"warning",gchat:"\u26A0\uFE0F"},stop:{slack:"octagonal_sign",gchat:"\u{1F6D1}"},info:{slack:"information_source",gchat:"\u2139\uFE0F"},100:{slack:"100",gchat:"\u{1F4AF}"},fire:{slack:"fire",gchat:"\u{1F525}"},star:{slack:"star",gchat:"\u2B50"},sparkles:{slack:"sparkles",gchat:"\u2728"},lightning:{slack:"zap",gchat:"\u26A1"},boom:{slack:"boom",gchat:"\u{1F4A5}"},eyes:{slack:"eyes",gchat:"\u{1F440}"},green_circle:{slack:"large_green_circle",gchat:"\u{1F7E2}"},yellow_circle:{slack:"large_yellow_circle",gchat:"\u{1F7E1}"},red_circle:{slack:"red_circle",gchat:"\u{1F534}"},blue_circle:{slack:"large_blue_circle",gchat:"\u{1F535}"},white_circle:{slack:"white_circle",gchat:"\u26AA"},black_circle:{slack:"black_circle",gchat:"\u26AB"},rocket:{slack:"rocket",gchat:"\u{1F680}"},party:{slack:["tada","partying_face"],gchat:["\u{1F389}","\u{1F973}"]},confetti:{slack:"confetti_ball",gchat:"\u{1F38A}"},balloon:{slack:"balloon",gchat:"\u{1F388}"},gift:{slack:"gift",gchat:"\u{1F381}"},trophy:{slack:"trophy",gchat:"\u{1F3C6}"},medal:{slack:"first_place_medal",gchat:"\u{1F947}"},lightbulb:{slack:"bulb",gchat:"\u{1F4A1}"},gear:{slack:"gear",gchat:"\u2699\uFE0F"},wrench:{slack:"wrench",gchat:"\u{1F527}"},hammer:{slack:"hammer",gchat:"\u{1F528}"},bug:{slack:"bug",gchat:"\u{1F41B}"},link:{slack:"link",gchat:"\u{1F517}"},lock:{slack:"lock",gchat:"\u{1F512}"},unlock:{slack:"unlock",gchat:"\u{1F513}"},key:{slack:"key",gchat:"\u{1F511}"},pin:{slack:"pushpin",gchat:"\u{1F4CC}"},memo:{slack:"memo",gchat:"\u{1F4DD}"},clipboard:{slack:"clipboard",gchat:"\u{1F4CB}"},calendar:{slack:"calendar",gchat:"\u{1F4C5}"},clock:{slack:"clock1",gchat:"\u{1F550}"},hourglass:{slack:"hourglass",gchat:"\u23F3"},bell:{slack:"bell",gchat:"\u{1F514}"},megaphone:{slack:"mega",gchat:"\u{1F4E2}"},speech_bubble:{slack:"speech_balloon",gchat:"\u{1F4AC}"},email:{slack:"email",gchat:"\u{1F4E7}"},inbox:{slack:"inbox_tray",gchat:"\u{1F4E5}"},outbox:{slack:"outbox_tray",gchat:"\u{1F4E4}"},package:{slack:"package",gchat:"\u{1F4E6}"},folder:{slack:"file_folder",gchat:"\u{1F4C1}"},file:{slack:"page_facing_up",gchat:"\u{1F4C4}"},chart_up:{slack:"chart_with_upwards_trend",gchat:"\u{1F4C8}"},chart_down:{slack:"chart_with_downwards_trend",gchat:"\u{1F4C9}"},coffee:{slack:"coffee",gchat:"\u2615"},pizza:{slack:"pizza",gchat:"\u{1F355}"},beer:{slack:"beer",gchat:"\u{1F37A}"},arrow_up:{slack:"arrow_up",gchat:"\u2B06\uFE0F"},arrow_down:{slack:"arrow_down",gchat:"\u2B07\uFE0F"},arrow_left:{slack:"arrow_left",gchat:"\u2B05\uFE0F"},arrow_right:{slack:"arrow_right",gchat:"\u27A1\uFE0F"},refresh:{slack:"arrows_counterclockwise",gchat:"\u{1F504}"},sun:{slack:"sunny",gchat:"\u2600\uFE0F"},cloud:{slack:"cloud",gchat:"\u2601\uFE0F"},rain:{slack:"rain_cloud",gchat:"\u{1F327}\uFE0F"},snow:{slack:"snowflake",gchat:"\u2744\uFE0F"},rainbow:{slack:"rainbow",gchat:"\u{1F308}"}},Ma=class{constructor(t){c(this,"emojiMap");c(this,"slackToNormalized");c(this,"gchatToNormalized");this.emojiMap={...ka,...t},this.slackToNormalized=new Map,this.gchatToNormalized=new Map,this.buildReverseMaps()}buildReverseMaps(){for(let[t,e]of Object.entries(this.emojiMap)){let a=Array.isArray(e.slack)?e.slack:[e.slack];for(let s of a)this.slackToNormalized.set(s.toLowerCase(),t);let r=Array.isArray(e.gchat)?e.gchat:[e.gchat];for(let s of r)this.gchatToNormalized.set(s,t)}}fromSlack(t){var r;let e=t.replace(/^:|:$/g,"").toLowerCase(),a=(r=this.slackToNormalized.get(e))!=null?r:t;return F(a)}fromGChat(t){var a;let e=(a=this.gchatToNormalized.get(t))!=null?a:t;return F(e)}fromTeams(t){var r;let a=(r={like:"thumbs_up",heart:"heart",laugh:"laugh",surprised:"surprised",sad:"sad",angry:"angry"}[t])!=null?r:t;return F(a)}toSlack(t){let e=typeof t=="string"?t:t.name,a=this.emojiMap[e];return a?Array.isArray(a.slack)?a.slack[0]:a.slack:e}toGChat(t){let e=typeof t=="string"?t:t.name,a=this.emojiMap[e];return a?Array.isArray(a.gchat)?a.gchat[0]:a.gchat:e}toDiscord(t){return this.toGChat(t)}matches(t,e){let a=typeof e=="string"?e:e.name,r=this.emojiMap[a];if(!r)return t===a;let s=Array.isArray(r.slack)?r.slack:[r.slack],i=Array.isArray(r.gchat)?r.gchat:[r.gchat],n=t.replace(/^:|:$/g,"").toLowerCase();return s.some(o=>o.toLowerCase()===n)||i.includes(t)}extend(t){Object.assign(this.emojiMap,t),this.buildReverseMaps()}},Ia=new Ma;function Sa(t){let e=["thumbs_up","thumbs_down","clap","wave","pray","muscle","ok_hand","point_up","point_down","point_left","point_right","raised_hands","shrug","facepalm","heart","smile","laugh","thinking","sad","cry","angry","love_eyes","cool","wink","surprised","worried","confused","neutral","sleeping","sick","mind_blown","relieved","grimace","rolling_eyes","hug","zany","check","x","question","exclamation","warning","stop","info","100","fire","star","sparkles","lightning","boom","eyes","green_circle","yellow_circle","red_circle","blue_circle","white_circle","black_circle","rocket","party","confetti","balloon","gift","trophy","medal","lightbulb","gear","wrench","hammer","bug","link","lock","unlock","key","pin","memo","clipboard","calendar","clock","hourglass","bell","megaphone","speech_bubble","email","inbox","outbox","package","folder","file","chart_up","chart_down","coffee","pizza","beer","arrow_up","arrow_down","arrow_left","arrow_right","refresh","sun","cloud","rain","snow","rainbow"],a={custom:r=>F(r)};for(let r of e)a[r]=F(r);if(t){for(let r of Object.keys(t))a[r]=F(r);Ia.extend(t)}return a}var br=Sa(),kr=rt,Mr=st,Ir=Z;var Sr=ct,Tr=Y,Er=et,Ar=nt,Cr=ot;var xr=tt;var Fr=it,Nr=at,Lr=lt;var Rr=ft,Or=dt,$r=pt,Dr=ut,vr=gt,Ur=ht;export{kr as a,Mr as b,Ir as c,Sr as d,Tr as e,Er as f,Ar as g,Cr as h,xr as i,Fr as j,Nr as k,Lr as l,Rr as m,Or as n,$r as o,Dr as p,vr as q,Ur as r};
|
|
36
|
+
`),o}function _a(t){return"adapterName"in t&&!("adapter"in t)}var Ot="thread-state:";function wa(t){return t!==null&&typeof t=="object"&&Symbol.asyncIterator in t}var mr=class q{constructor(e){c(this,"id");c(this,"channelId");c(this,"isDM");c(this,"channelVisibility");c(this,"_adapter");c(this,"_adapterName");c(this,"_stateAdapterInstance");c(this,"_recentMessages",[]);c(this,"_isSubscribedContext");c(this,"_currentMessage");c(this,"_streamingUpdateIntervalMs");c(this,"_fallbackStreamingPlaceholderText");c(this,"_channel");c(this,"_threadHistory");c(this,"_logger");var a,r,s,i;this.id=e.id,this.channelId=e.channelId,this.isDM=(a=e.isDM)!=null?a:!1,this.channelVisibility=(r=e.channelVisibility)!=null?r:"unknown",this._isSubscribedContext=(s=e.isSubscribedContext)!=null?s:!1,this._currentMessage=e.currentMessage,this._logger=e.logger,this._streamingUpdateIntervalMs=(i=e.streamingUpdateIntervalMs)!=null?i:500,this._fallbackStreamingPlaceholderText=e.fallbackStreamingPlaceholderText!==void 0?e.fallbackStreamingPlaceholderText:"...",_a(e)?this._adapterName=e.adapterName:(this._adapter=e.adapter,this._stateAdapterInstance=e.stateAdapter,this._threadHistory=e.threadHistory),e.initialMessage&&(this._recentMessages=[e.initialMessage])}get adapter(){if(this._adapter)return this._adapter;if(!this._adapterName)throw new Error("Thread has no adapter configured");let a=v().getAdapter(this._adapterName);if(!a)throw new Error(`Adapter "${this._adapterName}" not found in Chat singleton`);return this._adapter=a,a}get _stateAdapter(){if(this._stateAdapterInstance)return this._stateAdapterInstance;let e=v();return this._stateAdapterInstance=e.getState(),this._stateAdapterInstance}get recentMessages(){return this._recentMessages}set recentMessages(e){this._recentMessages=e}get state(){return this._stateAdapter.get(`${Ot}${this.id}`)}async setState(e,a){let r=`${Ot}${this.id}`;if(a!=null&&a.replace)await this._stateAdapter.set(r,e,U);else{let i={...await this._stateAdapter.get(r),...e};await this._stateAdapter.set(r,i,U)}}get channel(){if(!this._channel){let e=ua(this.adapter,this.id);this._channel=new ha({id:e,adapter:this.adapter,stateAdapter:this._stateAdapter,isDM:this.isDM,channelVisibility:this.channelVisibility,threadHistory:this._threadHistory})}return this._channel}get messages(){let e=this.adapter,a=this.id,r=this._threadHistory;return{async*[Symbol.asyncIterator](){let s,i=!1;for(;;){let n=await e.fetchMessages(a,{cursor:s,direction:"backward"}),o=[...n.messages].reverse();for(let l of o)i=!0,yield l;if(!n.nextCursor||n.messages.length===0)break;s=n.nextCursor}if(!i&&r){let n=await r.getMessages(a);for(let o=n.length-1;o>=0;o--)yield n[o]}}}}get allMessages(){let e=this.adapter,a=this.id,r=this._threadHistory;return{async*[Symbol.asyncIterator](){let s,i=!1;for(;;){let n=await e.fetchMessages(a,{limit:100,cursor:s,direction:"forward"});for(let o of n.messages)i=!0,yield o;if(!n.nextCursor||n.messages.length===0)break;s=n.nextCursor}if(!i&&r){let n=await r.getMessages(a);for(let o of n)yield o}}}}async getParticipants(){let e=new Map;this._currentMessage&&!this._currentMessage.author.isMe&&!this._currentMessage.author.isBot&&e.set(this._currentMessage.author.userId,this._currentMessage.author);for await(let a of this.allMessages)a.author.isMe||a.author.isBot||e.has(a.author.userId)||e.set(a.author.userId,a.author);return[...e.values()]}async isSubscribed(){return this._isSubscribedContext?!0:this._stateAdapter.isSubscribed(this.id)}async subscribe(){await this._stateAdapter.subscribe(this.id),this.adapter.onThreadSubscribe&&await this.adapter.onThreadSubscribe(this.id)}async unsubscribe(){await this._stateAdapter.unsubscribe(this.id)}async post(e){if(Pt(e)){if(e.kind==="stream"){let i=e.getPostData(),n={...i.options.updateIntervalMs?{updateIntervalMs:i.options.updateIntervalMs}:{},...i.options.groupTasks?{taskDisplayMode:i.options.groupTasks}:{},...i.options.endWith?{stopBlocks:i.options.endWith}:{}};return await this.handleStream(i.stream,n),e}return await this.handlePostableObject(e),e}if(wa(e))return this.handleStream(e);let a=e;if(_(e)){let i=y(e);if(!i)throw new Error("Invalid JSX element: must be a Card element");a=i}a=await this.processCallbackUrls(a);let r=await this.adapter.postMessage(this.id,a),s=this.createSentMessage(r.id,a,r.threadId);return this._threadHistory&&await this._threadHistory.append(this.id,new T(s)),s}async handlePostableObject(e){await Ht(e,this.adapter,this.id,(a,r)=>this.adapter.postMessage(a,r),this._logger)}async postEphemeral(e,a,r){let{fallbackToDM:s}=r,i=typeof e=="string"?e:e.userId,n;if(_(a)){let o=y(a);if(!o)throw new Error("Invalid JSX element: must be a Card element");n=o}else n=a;if(n=await this.processCallbackUrls(n),this.adapter.postEphemeral)return this.adapter.postEphemeral(this.id,i,n);if(!s)return null;if(this.adapter.openDM){let o=await this.adapter.openDM(i),l=await this.adapter.postMessage(o,n);return{id:l.id,threadId:o,usedFallback:!0,raw:l.raw}}return null}async processCallbackUrls(e){var a;if(typeof e=="string")return e;if("type"in e&&e.type==="card")return D(e,this._stateAdapter);if("card"in e&&((a=e.card)==null?void 0:a.type)==="card"){let r=await D(e.card,this._stateAdapter);if(r!==e.card)return{...e,card:r}}return e}async schedule(e,a){let r;if(_(e)){let s=y(e);if(!s)throw new Error("Invalid JSX element: must be a Card element");r=s}else r=e;if(r=await this.processCallbackUrls(r),!this.adapter.scheduleMessage)throw new Wt("Scheduled messages are not supported by this adapter","scheduling");return this.adapter.scheduleMessage(this.id,r,a)}async handleStream(e,a){let r=Ut(e),s={updateIntervalMs:this._streamingUpdateIntervalMs,...a};if(this._currentMessage&&(s.recipientUserId=this._currentMessage.author.userId,s.recipientTeamId=this.extractSlackRecipientTeamId(this._currentMessage.raw)),this.adapter.stream){let n="",o={[Symbol.asyncIterator]:()=>{let h=r[Symbol.asyncIterator]();return{async next(){let f=await h.next();if(!f.done){let d=f.value;typeof d=="string"?n+=d:d.type==="markdown_text"&&(n+=d.text)}return f}}}},l=await this.adapter.stream(this.id,o,s);if(l){let h=this.createSentMessage(l.id,{markdown:n},l.threadId);return this._threadHistory&&await this._threadHistory.append(this.id,new T(h)),h}}let i={[Symbol.asyncIterator]:()=>{let n=r[Symbol.asyncIterator]();return{async next(){for(;;){let o=await n.next();if(o.done)return{value:void 0,done:!0};let l=o.value;if(typeof l=="string")return{value:l,done:!1};if(l.type==="markdown_text")return{value:l.text,done:!1}}}}}};return this.fallbackStream(i,s)}extractSlackRecipientTeamId(e){var r;if(!e||typeof e!="object")return;let a=e;if(typeof a.team_id=="string"&&a.team_id)return a.team_id;if(typeof a.team=="string"&&a.team)return a.team;if(a.team&&typeof a.team=="object"&&typeof a.team.id=="string"&&a.team.id)return a.team.id;if(typeof((r=a.user)==null?void 0:r.team_id)=="string"&&a.user.team_id)return a.user.team_id}async startTyping(e){await this.adapter.startTyping(this.id,e)}async fallbackStream(e,a){var Q;let r=(Q=a==null?void 0:a.updateIntervalMs)!=null?Q:this._streamingUpdateIntervalMs,s=this._fallbackStreamingPlaceholderText,i=s===null?null:await this.adapter.postMessage(this.id,s),n=this.id,o=new ga,l="",h=!1,f=null,d=null;i&&(n=i.threadId||this.id,l=s!=null?s:"");let u=()=>{d=setTimeout(()=>{f=m()},r)},m=async()=>{var A;if(h||!i)return;let E=o.render();if(E.trim()&&E!==l)try{await this.adapter.editMessage(n,i.id,{markdown:E}),l=E}catch(Jt){(A=this._logger)==null||A.warn("fallbackStream edit failed",Jt)}h||u()};i&&u();try{for await(let E of e)if(o.push(E),!i){let A=o.render();A.trim()&&(i=await this.adapter.postMessage(this.id,{markdown:A}),n=i.threadId||this.id,l=A,u())}}finally{h=!0,d&&(clearTimeout(d),d=null)}f&&await f;let N=o.getText(),G=o.finish();i||(i=await this.adapter.postMessage(this.id,{markdown:N.trim()?N:" "}),n=i.threadId||this.id,l=N),G.trim()&&G!==l&&await this.adapter.editMessage(n,i.id,{markdown:N});let V=this.createSentMessage(i.id,{markdown:N},n);return this._threadHistory&&await this._threadHistory.append(this.id,new T(V)),V}async refresh(){let e=await this.adapter.fetchMessages(this.id,{limit:50});e.messages.length>0?this._recentMessages=e.messages:this._threadHistory?this._recentMessages=await this._threadHistory.getMessages(this.id,50):this._recentMessages=[]}mentionUser(e){return`<@${e}>`}toJSON(){var e,a;return{_type:"chat:Thread",id:this.id,channelId:this.channelId,channelVisibility:this.channelVisibility,currentMessage:(e=this._currentMessage)==null?void 0:e.toJSON(),isDM:this.isDM,adapterName:(a=this._adapterName)!=null?a:this.adapter.name}}static fromJSON(e,a){let r=new q({id:e.id,adapterName:e.adapterName,channelId:e.channelId,channelVisibility:e.channelVisibility,currentMessage:e.currentMessage?T.fromJSON(e.currentMessage):void 0,isDM:e.isDM});return a&&(r._adapter=a),r}static[C](e){return e.toJSON()}static[x](e){return q.fromJSON(e)}createSentMessage(e,a,r){let s=this.adapter,i=r||this.id,n=this,{plainText:o,formatted:l,attachments:h}=ba(a);return{id:e,threadId:i,text:o,formatted:l,raw:null,links:[],author:{userId:"self",userName:s.userName,fullName:s.userName,isBot:!0,isMe:!0},metadata:{dateSent:new Date,edited:!1},attachments:h,toJSON(){return new T(this).toJSON()},async edit(d){let u=d;if(_(d)){let m=y(d);if(!m)throw new Error("Invalid JSX element: must be a Card element");u=m}return u=await n.processCallbackUrls(u),await s.editMessage(i,e,u),n.createSentMessage(e,u)},async delete(){await s.deleteMessage(i,e)},async addReaction(d){await s.addReaction(i,e,d)},async removeReaction(d){await s.removeReaction(i,e,d)}}}createSentMessageFromMessage(e){let a=this.adapter,r=this.id,s=e.id,i=this;return{id:e.id,threadId:e.threadId,text:e.text,formatted:e.formatted,raw:e.raw,author:e.author,metadata:e.metadata,attachments:e.attachments,links:e.links,isMention:e.isMention,toJSON(){return e.toJSON()},async edit(n){let o=n;if(_(n)){let l=y(n);if(!l)throw new Error("Invalid JSX element: must be a Card element");o=l}return o=await i.processCallbackUrls(o),await a.editMessage(r,s,o),i.createSentMessage(s,o,r)},async delete(){await a.deleteMessage(r,s)},async addReaction(n){await a.addReaction(r,s,n)},async removeReaction(n){await a.removeReaction(r,s,n)}}}};function ba(t){if(typeof t=="string")return{plainText:t,formatted:k([b([w(t)])]),attachments:[]};if("raw"in t)return{plainText:t.raw,formatted:k([b([w(t.raw)])]),attachments:t.attachments||[]};if("markdown"in t){let e=P(t.markdown);return{plainText:L(e),formatted:e,attachments:t.attachments||[]}}if("ast"in t)return{plainText:L(t.ast),formatted:t.ast,attachments:t.attachments||[]};if("card"in t){let e=t.fallbackText||R(t.card);return{plainText:e,formatted:k([b([w(e)])]),attachments:[]}}if("type"in t&&t.type==="card"){let e=R(t);return{plainText:e,formatted:k([b([w(e)])]),attachments:[]}}throw new Error("Invalid PostableMessage format")}var yr=10080*60*1e3;var _r=600*1e3,wr=1440*60*1e3;var $t=new Map;function F(t){let e=$t.get(t);return e||(e=Object.freeze({name:t,toString:()=>`{{emoji:${t}}}`,toJSON:()=>`{{emoji:${t}}}`}),$t.set(t,e)),e}var ka={thumbs_up:{slack:["+1","thumbsup"],gchat:"\u{1F44D}"},thumbs_down:{slack:["-1","thumbsdown"],gchat:"\u{1F44E}"},clap:{slack:"clap",gchat:"\u{1F44F}"},wave:{slack:"wave",gchat:"\u{1F44B}"},pray:{slack:"pray",gchat:"\u{1F64F}"},muscle:{slack:"muscle",gchat:"\u{1F4AA}"},ok_hand:{slack:"ok_hand",gchat:"\u{1F44C}"},point_up:{slack:"point_up",gchat:"\u{1F446}"},point_down:{slack:"point_down",gchat:"\u{1F447}"},point_left:{slack:"point_left",gchat:"\u{1F448}"},point_right:{slack:"point_right",gchat:"\u{1F449}"},raised_hands:{slack:"raised_hands",gchat:"\u{1F64C}"},shrug:{slack:"shrug",gchat:"\u{1F937}"},facepalm:{slack:"facepalm",gchat:"\u{1F926}"},heart:{slack:"heart",gchat:["\u2764\uFE0F","\u2764"]},smile:{slack:["smile","slightly_smiling_face"],gchat:"\u{1F60A}"},laugh:{slack:["laughing","satisfied","joy"],gchat:["\u{1F602}","\u{1F606}"]},thinking:{slack:"thinking_face",gchat:"\u{1F914}"},sad:{slack:["cry","sad","white_frowning_face"],gchat:"\u{1F622}"},cry:{slack:"sob",gchat:"\u{1F62D}"},angry:{slack:"angry",gchat:"\u{1F620}"},love_eyes:{slack:"heart_eyes",gchat:"\u{1F60D}"},cool:{slack:"sunglasses",gchat:"\u{1F60E}"},wink:{slack:"wink",gchat:"\u{1F609}"},surprised:{slack:"open_mouth",gchat:"\u{1F62E}"},worried:{slack:"worried",gchat:"\u{1F61F}"},confused:{slack:"confused",gchat:"\u{1F615}"},neutral:{slack:"neutral_face",gchat:"\u{1F610}"},sleeping:{slack:"sleeping",gchat:"\u{1F634}"},sick:{slack:"nauseated_face",gchat:"\u{1F922}"},mind_blown:{slack:"exploding_head",gchat:"\u{1F92F}"},relieved:{slack:"relieved",gchat:"\u{1F60C}"},grimace:{slack:"grimacing",gchat:"\u{1F62C}"},rolling_eyes:{slack:"rolling_eyes",gchat:"\u{1F644}"},hug:{slack:"hugging_face",gchat:"\u{1F917}"},zany:{slack:"zany_face",gchat:"\u{1F92A}"},check:{slack:["white_check_mark","heavy_check_mark"],gchat:["\u2705","\u2714\uFE0F"]},x:{slack:["x","heavy_multiplication_x"],gchat:["\u274C","\u2716\uFE0F"]},question:{slack:"question",gchat:["\u2753","?"]},exclamation:{slack:"exclamation",gchat:"\u2757"},warning:{slack:"warning",gchat:"\u26A0\uFE0F"},stop:{slack:"octagonal_sign",gchat:"\u{1F6D1}"},info:{slack:"information_source",gchat:"\u2139\uFE0F"},100:{slack:"100",gchat:"\u{1F4AF}"},fire:{slack:"fire",gchat:"\u{1F525}"},star:{slack:"star",gchat:"\u2B50"},sparkles:{slack:"sparkles",gchat:"\u2728"},lightning:{slack:"zap",gchat:"\u26A1"},boom:{slack:"boom",gchat:"\u{1F4A5}"},eyes:{slack:"eyes",gchat:"\u{1F440}"},green_circle:{slack:"large_green_circle",gchat:"\u{1F7E2}"},yellow_circle:{slack:"large_yellow_circle",gchat:"\u{1F7E1}"},red_circle:{slack:"red_circle",gchat:"\u{1F534}"},blue_circle:{slack:"large_blue_circle",gchat:"\u{1F535}"},white_circle:{slack:"white_circle",gchat:"\u26AA"},black_circle:{slack:"black_circle",gchat:"\u26AB"},rocket:{slack:"rocket",gchat:"\u{1F680}"},party:{slack:["tada","partying_face"],gchat:["\u{1F389}","\u{1F973}"]},confetti:{slack:"confetti_ball",gchat:"\u{1F38A}"},balloon:{slack:"balloon",gchat:"\u{1F388}"},gift:{slack:"gift",gchat:"\u{1F381}"},trophy:{slack:"trophy",gchat:"\u{1F3C6}"},medal:{slack:"first_place_medal",gchat:"\u{1F947}"},lightbulb:{slack:"bulb",gchat:"\u{1F4A1}"},gear:{slack:"gear",gchat:"\u2699\uFE0F"},wrench:{slack:"wrench",gchat:"\u{1F527}"},hammer:{slack:"hammer",gchat:"\u{1F528}"},bug:{slack:"bug",gchat:"\u{1F41B}"},link:{slack:"link",gchat:"\u{1F517}"},lock:{slack:"lock",gchat:"\u{1F512}"},unlock:{slack:"unlock",gchat:"\u{1F513}"},key:{slack:"key",gchat:"\u{1F511}"},pin:{slack:"pushpin",gchat:"\u{1F4CC}"},memo:{slack:"memo",gchat:"\u{1F4DD}"},clipboard:{slack:"clipboard",gchat:"\u{1F4CB}"},calendar:{slack:"calendar",gchat:"\u{1F4C5}"},clock:{slack:"clock1",gchat:"\u{1F550}"},hourglass:{slack:"hourglass",gchat:"\u23F3"},bell:{slack:"bell",gchat:"\u{1F514}"},megaphone:{slack:"mega",gchat:"\u{1F4E2}"},speech_bubble:{slack:"speech_balloon",gchat:"\u{1F4AC}"},email:{slack:"email",gchat:"\u{1F4E7}"},inbox:{slack:"inbox_tray",gchat:"\u{1F4E5}"},outbox:{slack:"outbox_tray",gchat:"\u{1F4E4}"},package:{slack:"package",gchat:"\u{1F4E6}"},folder:{slack:"file_folder",gchat:"\u{1F4C1}"},file:{slack:"page_facing_up",gchat:"\u{1F4C4}"},chart_up:{slack:"chart_with_upwards_trend",gchat:"\u{1F4C8}"},chart_down:{slack:"chart_with_downwards_trend",gchat:"\u{1F4C9}"},coffee:{slack:"coffee",gchat:"\u2615"},pizza:{slack:"pizza",gchat:"\u{1F355}"},beer:{slack:"beer",gchat:"\u{1F37A}"},arrow_up:{slack:"arrow_up",gchat:"\u2B06\uFE0F"},arrow_down:{slack:"arrow_down",gchat:"\u2B07\uFE0F"},arrow_left:{slack:"arrow_left",gchat:"\u2B05\uFE0F"},arrow_right:{slack:"arrow_right",gchat:"\u27A1\uFE0F"},refresh:{slack:"arrows_counterclockwise",gchat:"\u{1F504}"},sun:{slack:"sunny",gchat:"\u2600\uFE0F"},cloud:{slack:"cloud",gchat:"\u2601\uFE0F"},rain:{slack:"rain_cloud",gchat:"\u{1F327}\uFE0F"},snow:{slack:"snowflake",gchat:"\u2744\uFE0F"},rainbow:{slack:"rainbow",gchat:"\u{1F308}"}},Ma=class{constructor(t){c(this,"emojiMap");c(this,"slackToNormalized");c(this,"gchatToNormalized");this.emojiMap={...ka,...t},this.slackToNormalized=new Map,this.gchatToNormalized=new Map,this.buildReverseMaps()}buildReverseMaps(){for(let[t,e]of Object.entries(this.emojiMap)){let a=Array.isArray(e.slack)?e.slack:[e.slack];for(let s of a)this.slackToNormalized.set(s.toLowerCase(),t);let r=Array.isArray(e.gchat)?e.gchat:[e.gchat];for(let s of r)this.gchatToNormalized.set(s,t)}}fromSlack(t){var r;let e=t.replace(/^:|:$/g,"").toLowerCase(),a=(r=this.slackToNormalized.get(e))!=null?r:t;return F(a)}fromGChat(t){var a;let e=(a=this.gchatToNormalized.get(t))!=null?a:t;return F(e)}fromTeams(t){var r;let a=(r={like:"thumbs_up",heart:"heart",laugh:"laugh",surprised:"surprised",sad:"sad",angry:"angry"}[t])!=null?r:t;return F(a)}toSlack(t){let e=typeof t=="string"?t:t.name,a=this.emojiMap[e];return a?Array.isArray(a.slack)?a.slack[0]:a.slack:e}toGChat(t){let e=typeof t=="string"?t:t.name,a=this.emojiMap[e];return a?Array.isArray(a.gchat)?a.gchat[0]:a.gchat:e}toDiscord(t){return this.toGChat(t)}matches(t,e){let a=typeof e=="string"?e:e.name,r=this.emojiMap[a];if(!r)return t===a;let s=Array.isArray(r.slack)?r.slack:[r.slack],i=Array.isArray(r.gchat)?r.gchat:[r.gchat],n=t.replace(/^:|:$/g,"").toLowerCase();return s.some(o=>o.toLowerCase()===n)||i.includes(t)}extend(t){Object.assign(this.emojiMap,t),this.buildReverseMaps()}},Ia=new Ma;function Sa(t){let e=["thumbs_up","thumbs_down","clap","wave","pray","muscle","ok_hand","point_up","point_down","point_left","point_right","raised_hands","shrug","facepalm","heart","smile","laugh","thinking","sad","cry","angry","love_eyes","cool","wink","surprised","worried","confused","neutral","sleeping","sick","mind_blown","relieved","grimace","rolling_eyes","hug","zany","check","x","question","exclamation","warning","stop","info","100","fire","star","sparkles","lightning","boom","eyes","green_circle","yellow_circle","red_circle","blue_circle","white_circle","black_circle","rocket","party","confetti","balloon","gift","trophy","medal","lightbulb","gear","wrench","hammer","bug","link","lock","unlock","key","pin","memo","clipboard","calendar","clock","hourglass","bell","megaphone","speech_bubble","email","inbox","outbox","package","folder","file","chart_up","chart_down","coffee","pizza","beer","arrow_up","arrow_down","arrow_left","arrow_right","refresh","sun","cloud","rain","snow","rainbow"],a={custom:r=>F(r)};for(let r of e)a[r]=F(r);if(t){for(let r of Object.keys(t))a[r]=F(r);Ia.extend(t)}return a}var br=Sa(),kr=rt,Mr=st,Ir=Z;var Sr=ct,Tr=Y,Er=et,Ar=nt,Cr=ot;var xr=tt;var Fr=it,Nr=at,Lr=lt;var Rr=ft,Or=dt,$r=pt,Dr=ut,vr=gt,Ur=ht;export{kr as a,Mr as b,Ir as c,Sr as d,Tr as e,Er as f,Ar as g,Cr as h,xr as i,Fr as j,Nr as k,Lr as l,Rr as m,Or as n,$r as o,Dr as p,vr as q,Ur as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as h}from"./chunk-
|
|
1
|
+
import{u as h}from"./chunk-VY27ZAO7.js";import f from"ajv";import y from"ajv-formats";var S=t=>typeof structuredClone=="function"?structuredClone(t):JSON.parse(JSON.stringify(t));var n=class extends h{constructor(a,o){let r=o.length===1?"it":"them";super(`Tried to use a ${a} in @novu/framework without ${o.join(", ")} installed. Please install ${r} by running \`npm install ${o.join(" ")}\`.`);this.statusCode=500;this.code="MissingDependencyError"}};var m=async(t,e)=>{let a=new Set;if((await Promise.allSettled(t.map(r=>r.import))).forEach((r,p)=>{let s=t[p];r.status==="fulfilled"&&s.exports.every(u=>r.value[u]!==void 0)||a.add(s.name)}),a.size>0)throw new n(e,Array.from(a))};var i=class{constructor(){this.requiredImports=[];this.ajv=new f({useDefaults:!0,removeAdditional:"failing",strict:!1}),y(this.ajv),this.compiledSchemas=new Map}async canHandle(e){let a=e.type==="object"||!!e.anyOf||!!e.allOf||!!e.oneOf;return a&&await m(this.requiredImports,"JSON schema"),a}async validate(e,a){let o=this.compiledSchemas.get(a);o||(o=this.ajv.compile(a),this.compiledSchemas.set(a,o));let r=S(e);return o(r)?{success:!0,data:r}:{success:!1,errors:o.errors.map(s=>({path:s.instancePath,message:s.message}))}}async transformToJsonSchema(e){return e}};var c=class{constructor(){this.requiredImports=[{name:"zod",import:import("zod"),exports:["ZodType"]},{name:"zod-to-json-schema",import:import("zod-to-json-schema"),exports:["zodToJsonSchema"]}]}async canHandle(e){let a=e.safeParseAsync!==void 0;return a&&await m(this.requiredImports,"Zod schema"),a}async validate(e,a){let o=await a.safeParseAsync(e);return o.success?{success:!0,data:o.data}:{success:!1,errors:o.error.issues.map(r=>({path:`/${r.path.join("/")}`,message:r.message}))}}async transformToJsonSchema(e){let{zodToJsonSchema:a}=await import("zod-to-json-schema");return a(e)}};var d=new c,l=new i,v=async(t,e)=>{if(await d.canHandle(t))return d.validate(e,t);if(await l.canHandle(t))return l.validate(e,t);throw new Error("Invalid schema")},T=async t=>{if(await d.canHandle(t))return d.transformToJsonSchema(t);if(await l.canHandle(t))return l.transformToJsonSchema(t);throw new Error("Invalid schema")};export{v as a,T as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function l(a,n,e){return{type:"email",stepId:a,resolve:n,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function d(a,n,e){return{type:"sms",stepId:a,resolve:n,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function t(a,n,e){return{type:"chat",stepId:a,resolve:n,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function S(a,n,e){return{type:"push",stepId:a,resolve:n,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function c(a,n,e){return{type:"in_app",stepId:a,resolve:n,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function m(a,n,e){return{type:"tool",stepId:a,resolve:n,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip,providers:e==null?void 0:e.providers,disableOutputSanitization:e==null?void 0:e.disableOutputSanitization}}function r(a,n,e){return{type:"delay",stepId:a,resolve:n,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip}}function h(a,n,e){return{type:"digest",stepId:a,resolve:n,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip}}function o(a,n,e){return{type:"throttle",stepId:a,resolve:n,controlSchema:e==null?void 0:e.controlSchema,payloadSchema:e==null?void 0:e.payloadSchema,envSchema:e==null?void 0:e.envSchema,skip:e==null?void 0:e.skip}}var v={email:l,sms:d,chat:t,push:S,inApp:c,tool:m,delay:r,digest:h,throttle:o};export{v as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function A(n){var t;return Array.isArray(n)?{history:n,notification:null}:{history:n.history,notification:(t=n.notification)!=null?t:null}}var s=new Set(["localhost","127.0.0.1","::1","0.0.0.0"]),c=new Set(["localhost","127.0.0.1","::1"]),u="4566",a=25*1024*1024;function w(n){try{let t=new URL(n);return t.protocol==="https:"&&!s.has(t.hostname.toLowerCase())}catch{return!1}}function f(n){try{if(process.env.NODE_ENV==="production")return!1;let t=new URL(n);if(t.protocol!=="http:"&&t.protocol!=="https:"||t.username||t.password)return!1;let e=t.hostname.toLowerCase().replace(/^\[|\]$/g,"");return c.has(e)?t.port===u:!1}catch{return!1}}async function l(n){var o;if(!f(n))return null;let t;try{t=await fetch(n,{redirect:"error",credentials:"omit"})}catch{return null}if(!t.ok)throw new Error(`Failed to fetch attachment (${t.status})`);let e=Number((o=t.headers)==null?void 0:o.get("content-length"));if(Number.isFinite(e)&&e>a)return null;let r=new Uint8Array(await t.arrayBuffer());return r.byteLength>a?null:r}async function H(n){let t=await l(n);return t?Buffer.from(t).toString("base64"):null}var p=new Set(["image/jpeg","image/png","image/gif","image/webp"]),y="application/pdf";function h(n){return p.has(n)}function g(n){var e;return typeof n!="string"?void 0:((e=n.split(";")[0])==null?void 0:e.trim().toLowerCase())||void 0}function m(n){if(!n||typeof n!="object")return;let t=n,e=g(t.mimeType);if(!(!e||!h(e)&&e!==y)&&!(typeof t.url!="string"||!t.url)){try{new URL(t.url)}catch{return}return{url:t.url,mediaType:e,name:typeof t.name=="string"?t.name:void 0}}}function E(n){var r;let t=(r=n.richContent)==null?void 0:r.attachments;if(!Array.isArray(t))return[];let e=[];for(let o of t){let i=m(o);i&&e.push(i)}return e}export{A as a,h as b,E as c,w as d,l as e,H as f};
|
|
@@ -1,71 +1,8 @@
|
|
|
1
|
-
import { a as ContextPayload, b as Step, S as Subscriber, E as EnvironmentSystemVariables, C as ContextResolved, c as ChannelStepEnum, A as ActionStepEnum, W as WithPassthrough, d as StepOptions } from './subscriber.types-
|
|
2
|
-
import { I as ITriggerPayload,
|
|
1
|
+
import { a as ContextPayload, b as Step, S as Subscriber, E as EnvironmentSystemVariables, C as ContextResolved, c as ChannelStepEnum, A as ActionStepEnum, W as WithPassthrough, d as StepOptions } from './subscriber.types-D4PvRIKR.js';
|
|
2
|
+
import { I as ITriggerPayload, B as TriggerRecipientsPayload, C as ISubscriberPayload, D as TriggerEventStatusEnum, W as WorkflowPreferencesPartial } from './agent.types-C17NUGxY.js';
|
|
3
3
|
import { C as ConditionalPartial, P as PickRequiredKeys, a as Prettify, D as DeepPartial, A as Awaitable } from './util.types-DaFfsxgy.js';
|
|
4
4
|
import { S as Schema, J as JsonSchema } from './base.schema.types-BApIn9jr.js';
|
|
5
5
|
|
|
6
|
-
type CodeResult = {
|
|
7
|
-
code: string;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* A minimal logger interface used for all of the framework's internal logging
|
|
12
|
-
* (workflow discovery, execution and bridge error reporting).
|
|
13
|
-
*
|
|
14
|
-
* The methods (`info`/`warn`/`error`) are chosen so that both the global
|
|
15
|
-
* `console` and common structured loggers (pino, winston, ...) satisfy this
|
|
16
|
-
* interface directly, with no adapter. The global `console` is the default;
|
|
17
|
-
* provide your own to route Novu's internal logs wherever the rest of your
|
|
18
|
-
* application logs go.
|
|
19
|
-
*/
|
|
20
|
-
type Logger = {
|
|
21
|
-
info: typeof console.info;
|
|
22
|
-
warn: typeof console.warn;
|
|
23
|
-
error: typeof console.error;
|
|
24
|
-
};
|
|
25
|
-
type ClientOptions = {
|
|
26
|
-
/**
|
|
27
|
-
* Use Novu Cloud US (https://api.novu.co) or EU deployment (https://eu.api.novu.co). Defaults to US.
|
|
28
|
-
*/
|
|
29
|
-
apiUrl?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Specify your Novu secret key, to secure the Bridge Endpoint, and Novu API communication.
|
|
32
|
-
* Novu communicates securely with your endpoint using a signed HMAC header,
|
|
33
|
-
* ensuring that only trusted requests from Novu are actioned by your Bridge API.
|
|
34
|
-
* The secret key is used to sign the HMAC header.
|
|
35
|
-
*/
|
|
36
|
-
secretKey?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Explicitly use HMAC signature verification.
|
|
39
|
-
* Setting this to `false` will enable Novu to communicate with your Bridge API
|
|
40
|
-
* without requiring a valid HMAC signature.
|
|
41
|
-
* This is useful for local development and testing.
|
|
42
|
-
*
|
|
43
|
-
* In production you must specify an `secretKey` and set this to `true`.
|
|
44
|
-
*
|
|
45
|
-
* Defaults to true.
|
|
46
|
-
*/
|
|
47
|
-
strictAuthentication?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Enable verbose logging for workflow discovery and execution.
|
|
50
|
-
* When set to `false`, discovery and execution logs will be suppressed.
|
|
51
|
-
* Defaults to `true` in development, `false` in production.
|
|
52
|
-
*/
|
|
53
|
-
verbose?: boolean;
|
|
54
|
-
/**
|
|
55
|
-
* A custom logger used for all of the framework's internal logging
|
|
56
|
-
* (workflow discovery, execution and bridge error reporting).
|
|
57
|
-
*
|
|
58
|
-
* Defaults to the global `console`. Provide your own logger to route Novu's
|
|
59
|
-
* internal logs through your application's structured logger.
|
|
60
|
-
*
|
|
61
|
-
* Note: `verbose` still controls *whether* discovery and execution logs are
|
|
62
|
-
* emitted; `logger` only controls *where* all logs are written. Bridge errors
|
|
63
|
-
* (HTTP status >= 500) are always logged via this logger, regardless of
|
|
64
|
-
* `verbose`.
|
|
65
|
-
*/
|
|
66
|
-
logger?: Logger;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
6
|
declare enum PostActionEnum {
|
|
70
7
|
TRIGGER = "trigger",
|
|
71
8
|
EXECUTE = "execute",
|
|
@@ -178,7 +115,8 @@ declare enum WorkflowChannelEnum {
|
|
|
178
115
|
PUSH = "push",
|
|
179
116
|
CHAT = "chat",
|
|
180
117
|
/** Differs from ChannelTypeEnum in capitalization / snake_case */
|
|
181
|
-
IN_APP = "inApp"
|
|
118
|
+
IN_APP = "inApp",
|
|
119
|
+
TOOL = "tool"
|
|
182
120
|
}
|
|
183
121
|
|
|
184
122
|
type EventPayload = ITriggerPayload;
|
|
@@ -223,6 +161,11 @@ type EventTriggerParams<T_Payload = EventPayload> = {
|
|
|
223
161
|
* Overrides for trigger
|
|
224
162
|
*/
|
|
225
163
|
overrides?: Record<string, unknown>;
|
|
164
|
+
/**
|
|
165
|
+
* Override the workflow-assigned agent for this trigger using the public agent identifier.
|
|
166
|
+
* Omit to use the workflow default; pass null to disable agent routing for this execution.
|
|
167
|
+
*/
|
|
168
|
+
agentId?: string | null;
|
|
226
169
|
/**
|
|
227
170
|
* Controls for the step execution
|
|
228
171
|
*/
|
|
@@ -545,6 +488,69 @@ type DiscoverOutput = {
|
|
|
545
488
|
agents: Array<DiscoverAgentOutput>;
|
|
546
489
|
};
|
|
547
490
|
|
|
491
|
+
type CodeResult = {
|
|
492
|
+
code: string;
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* A minimal logger interface used for all of the framework's internal logging
|
|
497
|
+
* (workflow discovery, execution and bridge error reporting).
|
|
498
|
+
*
|
|
499
|
+
* The methods (`info`/`warn`/`error`) are chosen so that both the global
|
|
500
|
+
* `console` and common structured loggers (pino, winston, ...) satisfy this
|
|
501
|
+
* interface directly, with no adapter. The global `console` is the default;
|
|
502
|
+
* provide your own to route Novu's internal logs wherever the rest of your
|
|
503
|
+
* application logs go.
|
|
504
|
+
*/
|
|
505
|
+
type Logger = {
|
|
506
|
+
info: typeof console.info;
|
|
507
|
+
warn: typeof console.warn;
|
|
508
|
+
error: typeof console.error;
|
|
509
|
+
};
|
|
510
|
+
type ClientOptions = {
|
|
511
|
+
/**
|
|
512
|
+
* Use Novu Cloud US (https://api.novu.co) or EU deployment (https://eu.api.novu.co). Defaults to US.
|
|
513
|
+
*/
|
|
514
|
+
apiUrl?: string;
|
|
515
|
+
/**
|
|
516
|
+
* Specify your Novu secret key, to secure the Bridge Endpoint, and Novu API communication.
|
|
517
|
+
* Novu communicates securely with your endpoint using a signed HMAC header,
|
|
518
|
+
* ensuring that only trusted requests from Novu are actioned by your Bridge API.
|
|
519
|
+
* The secret key is used to sign the HMAC header.
|
|
520
|
+
*/
|
|
521
|
+
secretKey?: string;
|
|
522
|
+
/**
|
|
523
|
+
* Explicitly use HMAC signature verification.
|
|
524
|
+
* Setting this to `false` will enable Novu to communicate with your Bridge API
|
|
525
|
+
* without requiring a valid HMAC signature.
|
|
526
|
+
* This is useful for local development and testing.
|
|
527
|
+
*
|
|
528
|
+
* In production you must specify an `secretKey` and set this to `true`.
|
|
529
|
+
*
|
|
530
|
+
* Defaults to true.
|
|
531
|
+
*/
|
|
532
|
+
strictAuthentication?: boolean;
|
|
533
|
+
/**
|
|
534
|
+
* Enable verbose logging for workflow discovery and execution.
|
|
535
|
+
* When set to `false`, discovery and execution logs will be suppressed.
|
|
536
|
+
* Defaults to `true` in development, `false` in production.
|
|
537
|
+
*/
|
|
538
|
+
verbose?: boolean;
|
|
539
|
+
/**
|
|
540
|
+
* A custom logger used for all of the framework's internal logging
|
|
541
|
+
* (workflow discovery, execution and bridge error reporting).
|
|
542
|
+
*
|
|
543
|
+
* Defaults to the global `console`. Provide your own logger to route Novu's
|
|
544
|
+
* internal logs through your application's structured logger.
|
|
545
|
+
*
|
|
546
|
+
* Note: `verbose` still controls *whether* discovery and execution logs are
|
|
547
|
+
* emitted; `logger` only controls *where* all logs are written. Bridge errors
|
|
548
|
+
* (HTTP status >= 500) are always logged via this logger, regardless of
|
|
549
|
+
* `verbose`.
|
|
550
|
+
*/
|
|
551
|
+
logger?: Logger;
|
|
552
|
+
};
|
|
553
|
+
|
|
548
554
|
type Event = {
|
|
549
555
|
payload: Record<string, unknown>;
|
|
550
556
|
workflowId: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { k as AgentHandlers, A as Agent, p as AgentNotification } from './agent.types-C17NUGxY.js';
|
|
2
|
+
import { W as Workflow, L as Logger, C as ClientOptions, H as HealthCheck, e as DiscoverOutput, i as Event, n as ExecuteOutput, d as CodeResult, j as EventTriggerParams, m as Execute, t as WorkflowOptions } from './health-check.types-CL5-B_D4.js';
|
|
3
3
|
import { A as Awaitable } from './util.types-DaFfsxgy.js';
|
|
4
4
|
import 'chat';
|
|
5
5
|
import { S as Schema, a as FromSchema, F as FromSchemaUnvalidated } from './base.schema.types-BApIn9jr.js';
|
|
6
6
|
import './step-resolver.js';
|
|
7
|
-
import './subscriber.types-
|
|
7
|
+
import './subscriber.types-D4PvRIKR.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Define a new conversational agent.
|
|
@@ -14,6 +14,11 @@ import './subscriber.types-CmybpXhA.js';
|
|
|
14
14
|
*/
|
|
15
15
|
declare function agent(agentId: string, handlers: AgentHandlers): Agent;
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Narrows `notification.payload` to the workflow's schema when `workflowId` matches `workflow.id`.
|
|
19
|
+
*/
|
|
20
|
+
declare function isFromWorkflow<T extends Record<string, unknown>>(notification: AgentNotification | null, workflow: Workflow<T>): notification is AgentNotification<T>;
|
|
21
|
+
|
|
17
22
|
declare class Client {
|
|
18
23
|
private discoveredWorkflows;
|
|
19
24
|
private discoverWorkflowPromises;
|
|
@@ -64,9 +69,16 @@ declare class Client {
|
|
|
64
69
|
private createExecutionPayload;
|
|
65
70
|
private prettyPrintExecute;
|
|
66
71
|
private executeProviders;
|
|
67
|
-
private
|
|
68
|
-
private
|
|
72
|
+
private runProvider;
|
|
73
|
+
private resolveProviderOutput;
|
|
69
74
|
private executeStep;
|
|
75
|
+
/**
|
|
76
|
+
* Code-first chat steps may return `card` as a `chat` JSX element (e.g. `Card(...)`) or a plain
|
|
77
|
+
* `CardElement`. Normalize it to plain `CardElement` JSON before validation so it matches the
|
|
78
|
+
* chat output schema and can cross the bridge unchanged. Non-chat steps and card-less outputs
|
|
79
|
+
* pass through untouched.
|
|
80
|
+
*/
|
|
81
|
+
private normalizeChatCardOutput;
|
|
70
82
|
private compileControls;
|
|
71
83
|
/**
|
|
72
84
|
* Preprocesses standalone translation patterns.
|
|
@@ -190,4 +202,4 @@ declare class NovuRequestHandler<Input extends any[] = any[], Output = any> {
|
|
|
190
202
|
*/
|
|
191
203
|
declare function workflow<T_PayloadSchema extends Schema, T_ControlSchema extends Schema, T_EnvSchema extends Schema, T_PayloadValidated extends Record<string, unknown> = FromSchema<T_PayloadSchema>, T_PayloadUnvalidated extends Record<string, unknown> = FromSchemaUnvalidated<T_PayloadSchema>, T_Controls extends Record<string, unknown> = FromSchema<T_ControlSchema>, T_Env extends Record<string, unknown> = FromSchema<T_EnvSchema>>(workflowId: string, execute: Execute<T_PayloadValidated, T_Controls, T_Env>, workflowOptions?: WorkflowOptions<T_PayloadSchema, T_ControlSchema, T_EnvSchema>): Workflow<T_PayloadUnvalidated>;
|
|
192
204
|
|
|
193
|
-
export { Client as C, type INovuRequestHandlerOptions as I, NovuRequestHandler as N, type ServeHandlerOptions as S, agent as a, workflow as w };
|
|
205
|
+
export { Client as C, type INovuRequestHandlerOptions as I, NovuRequestHandler as N, type ServeHandlerOptions as S, agent as a, isFromWorkflow as i, workflow as w };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { C as Client, N as NovuRequestHandler, S as ServeHandlerOptions, a as agent, w as workflow } from './index-
|
|
2
|
-
export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from './health-check.types-
|
|
3
|
-
export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Select, SelectOption, TextInput } from 'chat';
|
|
4
|
-
export { A as Agent, a as AgentAction, b as AgentActionContext, c as AgentAttachment, d as AgentContext, e as
|
|
5
|
-
export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, step } from './step-resolver.js';
|
|
6
|
-
export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from './subscriber.types-
|
|
1
|
+
export { C as Client, N as NovuRequestHandler, S as ServeHandlerOptions, a as agent, i as isFromWorkflow, w as workflow } from './index-CYtGHJJu.js';
|
|
2
|
+
export { C as ClientOptions, a as CronExpression, E as ExecuteInput, S as SeverityLevelEnum, W as Workflow } from './health-check.types-CL5-B_D4.js';
|
|
3
|
+
export { Actions, Button, Card, CardChild, CardElement, CardLink, CardText, Divider, Image, ImageElement, Select, SelectOption, TextInput } from 'chat';
|
|
4
|
+
export { A as Agent, a as AgentAction, b as AgentActionContext, c as AgentAttachment, d as AgentContext, e as AgentContextPayload, f as AgentContextValue, g as AgentConversation, h as AgentDeliveryError, i as AgentError, j as AgentHandlerContext, k as AgentHandlers, l as AgentHistoryEntry, m as AgentMessage, n as AgentMessageAuthor, o as AgentMessageContext, p as AgentNotification, q as AgentPlatformContext, r as AgentReaction, s as AgentReactionContext, t as AgentResolveContext, u as AgentSubscriber, v as AgentSubscriberAccess, w as AgentToolCall, F as FileRef, M as MessageContent, R as ReplyHandle, T as ToolApprovalCard, x as ToolApprovalConfig, y as ToolApprovalDecision, z as toAgentError } from './agent.types-C17NUGxY.js';
|
|
5
|
+
export { AnyStepResolver, ChatStepResolver, EmailStepResolver, InAppStepResolver, PushStepResolver, SmsStepResolver, StepResolverContext, ToolStepResolver, step } from './step-resolver.js';
|
|
6
|
+
export { C as ContextResolved, E as EnvironmentSystemVariables, S as Subscriber, p as providerSchemas } from './subscriber.types-D4PvRIKR.js';
|
|
7
7
|
import './util.types-DaFfsxgy.js';
|
|
8
8
|
import './base.schema.types-BApIn9jr.js';
|
|
9
9
|
import 'json-schema-to-ts';
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as m,c as q,d as r,e as u}from"./chunk-WJUYDVXH.js";import{a as v}from"./chunk-YLCLZVYS.js";import"./chunk-XIVU4VDS.js";import{N as n,O as o,P as p,W as t}from"./chunk-Q3ALQWIF.js";import{a,b,c,d,e,f,i as g,p as h,q as i,r as j}from"./chunk-X5AZIKIR.js";import"./chunk-RBTQQ5IZ.js";import{a as s}from"./chunk-UXO4RWZV.js";import{f as k}from"./chunk-VY27ZAO7.js";import{b as l}from"./chunk-PU74XQ2P.js";import"./chunk-FHYMHX3T.js";export{a as Actions,o as AgentDeliveryError,n as AgentError,b as Button,c as Card,d as CardLink,e as CardText,m as Client,k as CronExpression,f as Divider,g as Image,q as NovuRequestHandler,h as Select,i as SelectOption,t as SeverityLevelEnum,j as TextInput,r as agent,l as isFromWorkflow,s as providerSchemas,v as step,p as toAgentError,u as workflow};
|