@opencxh/domain 1.124.0 → 1.125.0

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.
@@ -1,3 +1,4 @@
1
+ import { ActingIdentity } from '../../platform/identity';
1
2
  import { AIMessageInput, AIMessageOutput } from '../ai-message/types';
2
3
  import { TranscriptSegment } from '../../platform/media';
3
4
  export type CallStatus = "new" | "connecting" | "ringing" | "connected" | "held" | "ended" | "failed";
@@ -198,6 +199,8 @@ export type AIActionProposedPayload = {
198
199
  params?: Record<string, unknown>;
199
200
  }[];
200
201
  status: "pending" | "approved" | "rejected";
202
+ /** Namens wie het voorstel is gedaan, zodat de kaart "namens Finance" kan tonen. */
203
+ actor?: ActingIdentity;
201
204
  };
202
205
  /** Playbook lifecycle marker in the interaction timeline (system-authored). */
203
206
  export type PlaybookLifecyclePayload = {
@@ -205,6 +208,8 @@ export type PlaybookLifecyclePayload = {
205
208
  playbookId?: string;
206
209
  playbookName?: string;
207
210
  status?: string;
211
+ /** Namens wie de run handelde; voorkomt dat de UI de playbook opnieuw moet ophalen. */
212
+ actor?: ActingIdentity;
208
213
  };
209
214
  export type Activity = (BaseActivity & {
210
215
  type: "VOICE_CALL_STARTED";
@@ -0,0 +1,16 @@
1
+ import { ActingIdentity } from '../../platform/identity';
2
+ import { OwnerScope } from '../contact/types';
3
+ /**
4
+ * `ownerScope` **is** de actor van een playbook: er is geen apart `runAs`-veld.
5
+ * Zichtbaarheid, werkgebied en toeschrijving volgen dus uit hetzelfde veld.
6
+ *
7
+ * Aan de bewaarkant heet de persoonlijke variant `personal` (zoals bij elke andere
8
+ * entity), aan de uitvoerkant `user` (zoals elke andere acting identity). Deze
9
+ * functie is die vertaling, en de enige plek waar hij hoort.
10
+ */
11
+ export declare function playbookActor(scope: OwnerScope): ActingIdentity;
12
+ /**
13
+ * Stabiele sleutel om actors te groeperen. Tien playbooks van hetzelfde team horen
14
+ * één autorisatie-call te kosten, niet tien.
15
+ */
16
+ export declare function actorKey(actor: ActingIdentity): string;
@@ -1 +1,4 @@
1
+ export * from './labels';
2
+ export * from './trigger-vars';
3
+ export * from './actor';
1
4
  export * from './types';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Leesbare naam van een actie/tool voor een mens: `tool:communication__update_interaction`
3
+ * wordt `communication · update interaction`.
4
+ *
5
+ * Gedeeld, want de proposal-kaart in comms had deze helper al terwijl de run-timeline in
6
+ * de AI-app de rauwe id printte — dus daar las je letterlijk
7
+ * `voorstel: tool:mcp__jira__create_issue`.
8
+ */
9
+ export declare function humanizeAction(action: string): string;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * De variabelen die de engine onder `vars.trigger` zet bij een activity-trigger.
3
+ *
4
+ * Contract tussen `buildTriggerVars` (server) en de variabelen-picker (builder). Die
5
+ * twee waren uiteengelopen: de picker bood `trigger.fromEmail` en `trigger.channel`
6
+ * aan — die bestaan niet — en miste `subject`, `textRaw`, `direction`, `authorType` en
7
+ * `activityId`. Elk pad dat hij aanbood leverde dus `undefined` op. Eén lijst, aan
8
+ * beide kanten geïmporteerd, kan niet opnieuw uiteenlopen.
9
+ */
10
+ export declare const TRIGGER_VARS: readonly [{
11
+ readonly name: "text";
12
+ readonly type: "string";
13
+ }, {
14
+ readonly name: "subject";
15
+ readonly type: "string";
16
+ }, {
17
+ readonly name: "from";
18
+ readonly type: "string";
19
+ }, {
20
+ readonly name: "type";
21
+ readonly type: "string";
22
+ }, {
23
+ readonly name: "direction";
24
+ readonly type: "string";
25
+ }, {
26
+ readonly name: "channelId";
27
+ readonly type: "string";
28
+ }, {
29
+ readonly name: "interactionId";
30
+ readonly type: "string";
31
+ }, {
32
+ readonly name: "activityId";
33
+ readonly type: "string";
34
+ }, {
35
+ readonly name: "authorType";
36
+ readonly type: "string";
37
+ }, {
38
+ readonly name: "authorName";
39
+ readonly type: "string";
40
+ }, {
41
+ readonly name: "textRaw";
42
+ readonly type: "string";
43
+ }];
44
+ /** De variabelen die een classify-stap oplevert, per mode. */
45
+ export declare const CLASSIFY_VARS: {
46
+ readonly topics: readonly [{
47
+ readonly name: "topic";
48
+ readonly type: "string";
49
+ }, {
50
+ readonly name: "confidence";
51
+ readonly type: "number";
52
+ }];
53
+ readonly question: readonly [{
54
+ readonly name: "answer";
55
+ readonly type: "boolean";
56
+ }, {
57
+ readonly name: "confidence";
58
+ readonly type: "number";
59
+ }];
60
+ readonly extract: readonly [];
61
+ };
@@ -1,3 +1,4 @@
1
+ import { ActingIdentity } from '../../platform/identity';
1
2
  import { OwnerScope } from '../contact/types';
2
3
  /**
3
4
  * Playbooks — event-driven automation with AI steps. See docs/PLAYBOOKS.md.
@@ -19,7 +20,6 @@ export type PlaybookTrigger = {
19
20
  export interface Guardrails {
20
21
  maxSteps?: number;
21
22
  maxToolCalls?: number;
22
- policyCaps?: Record<string, unknown>;
23
23
  }
24
24
  export interface ConditionStep {
25
25
  type: "condition";
@@ -143,6 +143,13 @@ export interface PlaybookRun {
143
143
  trace: RunStepTrace[];
144
144
  /** Snapshot of the playbook steps at run start — version-pinned resume (docs 11.4). */
145
145
  steps?: Step[];
146
+ /**
147
+ * Namens wie deze run handelt, vastgepind bij de start — net als `steps`. Anders
148
+ * wisselt een lopende of geparkeerde run stilletjes van identiteit zodra iemand de
149
+ * playbook van "Alleen ik" naar "Team Finance" zet. `resume`/`retry` lezen dit veld,
150
+ * niet `playbook.ownerScope`.
151
+ */
152
+ actor?: ActingIdentity;
146
153
  /**
147
154
  * Held action(s) awaiting human approval (autonomy: suggest) — a batch per paused
148
155
  * step. `null` wanneer het veld gewist is; de store schrijft `null`, dus dat staat
package/dist/index.cjs CHANGED
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=140;function A(e){return e.replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<[^>]+>/g," ").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/\s+/g," ").trim()}function M(e){const t=e.trim();return t.length<=c?t:t.slice(0,c-1).trimEnd()+"…"}function i(e){if(!e||e<0)return"";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${n.toString().padStart(2,"0")}`}function C(e){switch(e.type){case"EMAIL_RECEIVED":case"EMAIL_SENT":{const t=e.payload,n=t.bodySnippet?.trim()||A(t.body??"");return t.subject?`${t.subject} — ${n}`:n}case"CHAT_MESSAGE_SENT":case"CHAT_MESSAGE_RECEIVED":return e.payload.text??"";case"CHAT_RENAMED":return`Hernoemd naar "${e.payload.newName}"`;case"CHAT_MEMBER_JOINED":return`${e.payload.members.map(t=>t.name).join(", ")} toegevoegd`;case"CHAT_MEMBER_LEFT":return`${e.payload.members.map(t=>t.name).join(", ")} verlaten`;case"CHAT_CALL_STARTED":return"Gesprek gestart";case"CHAT_CALL_ENDED":return`Gesprek beëindigd${e.payload.duration?` (${i(e.payload.duration)})`:""}`;case"CHAT_EVENT":return e.payload.text??e.payload.eventType;case"VOICE_CALL_STARTED":case"VIDEO_CALL_STARTED":return"Gesprek gestart";case"VOICE_CALL_ANSWERED":case"VIDEO_CALL_ANSWERED":return"Gesprek aangenomen";case"VOICE_CALL_HOLD":case"VIDEO_CALL_HOLD":return"In de wacht";case"VOICE_CALL_UNHOLD":case"VIDEO_CALL_UNHOLD":return"Hervat";case"VOICE_CALL_ENDED":case"VIDEO_CALL_ENDED":return`Gesprek beëindigd${e.payload.duration?` (${i(e.payload.duration)})`:""}`;case"VOICE_CALL_MISSED":case"VIDEO_CALL_MISSED":return"Gemiste oproep";case"VOICE_CALL_FAILED":case"VIDEO_CALL_FAILED":return"Gesprek mislukt";case"VOICE_CALL_VOICEMAIL":return e.payload.transcription?.trim()?e.payload.transcription:"Voicemail ontvangen";case"TRANSCRIPT_ADDED":return(e.payload.segments??[]).map(t=>t.text).join(" ");case"AI_MESSAGE_ADDED":return e.payload.output?.text??e.payload.input?.text??"";case"AI_ACTION_PROPOSED":return`Voorstel wacht op goedkeuring (${e.payload.actions?.length??0} actie(s))`;case"PLAYBOOK_STARTED":return`Playbook gestart${e.payload.playbookName?`: ${e.payload.playbookName}`:""}`;case"PLAYBOOK_COMPLETED":return"Playbook afgerond";case"PLAYBOOK_ESCALATED":return"Playbook geëscaleerd naar een mens";case"MEETING_SCHEDULED":return`Vergadering gepland: ${e.payload.title}`;case"MEETING_STARTED":return`Vergadering gestart: ${e.payload.title}`;case"MEETING_ENDED":return`Vergadering beëindigd${e.payload.duration?` (${i(e.payload.duration)})`:""}`;case"MEETING_PARTICIPANT_JOINED":return`${e.payload.name} deelgenomen`;case"MEETING_PARTICIPANT_LEFT":return`${e.payload.name} verlaten`;case"COMMENT_ADDED":return e.payload.text??"";case"FILE_UPLOADED":return`Bestand: ${e.payload.fileName}`;case"INTERACTION_CREATED":return"Interactie aangemaakt";case"INTERACTION_STATUS_CHANGED":return`Status: ${e.payload.fromStatus} → ${e.payload.toStatus}`;case"INTERACTION_ASSIGNED":return"Interactie toegewezen";default:return""}}function y(e){return{activityId:e.id,type:e.type,snippet:M(C(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now()}}function U(e,t,n=[]){const r=e.createdAt;if(!r)return[];const s=new Set(n);return e.author.type==="user"&&e.author.id&&s.add(e.author.id),Object.entries(t).filter(([a,o])=>o>=r&&!s.has(a)).map(([a])=>a)}const P=[{id:"agent",label:"Agent",labelSource:"user"},{id:"team",label:"Team",labelSource:"team"},{id:"inbox",label:"Inbox",labelSource:"inbox"},{id:"channel",label:"Kanaal",labelSource:"channel"},{id:"provider",label:"Provider",labelSource:"raw"},{id:"status",label:"Status",labelSource:"raw"},{id:"handledBy",label:"Afhandelaar",labelSource:"raw"},{id:"time",label:"Tijd",labelSource:"raw"}];function h(e){const t=[];for(const n of Object.keys(e))for(const r of Object.keys(e[n]))t.push({lang:n,key:r,value:e[n][r]});return t}function l(e){return e<10?`0${e}`:`${e}`}function g(e,t){const n=new Date(e),r=`${n.getUTCFullYear()}-${l(n.getUTCMonth()+1)}-${l(n.getUTCDate())}`;return t==="day"?r:`${r}T${l(n.getUTCHours())}`}function f(e,t){const n=new Date(e);return n.setUTCMinutes(0,0,0),t==="day"&&n.setUTCHours(0),n.getTime()}const $=36e5,G=864e5;function H(e,t,n){const r=n==="hour"?$:G,s=[];for(let a=f(e,n);a<=t;a+=r)s.push(g(a,n));return s}const _=["done","escalated","failed","timed_out","stopped"],I=["awaiting_approval","awaiting_reply"];function T(e){return _.includes(e)}function k(e){return T(e)}function V(e){return I.includes(e)}const w=new Set(["mail","message"]);function S(e,t){const n=e.settings?.signatures?.[t];return!n||!n.enabled||!n.body||n.body.trim()===""?null:n}function B(e,t,n,r="html"){if(!e)return n;const s=S(e,t);return s?`${n}${r==="text"?`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=140;function g(e){return e.replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<script[\s\S]*?<\/script>/gi," ").replace(/<[^>]+>/g," ").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/\s+/g," ").trim()}function M(e){const t=e.trim();return t.length<=c?t:t.slice(0,c-1).trimEnd()+"…"}function i(e){if(!e||e<0)return"";const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${n.toString().padStart(2,"0")}`}function C(e){switch(e.type){case"EMAIL_RECEIVED":case"EMAIL_SENT":{const t=e.payload,n=t.bodySnippet?.trim()||g(t.body??"");return t.subject?`${t.subject} — ${n}`:n}case"CHAT_MESSAGE_SENT":case"CHAT_MESSAGE_RECEIVED":return e.payload.text??"";case"CHAT_RENAMED":return`Hernoemd naar "${e.payload.newName}"`;case"CHAT_MEMBER_JOINED":return`${e.payload.members.map(t=>t.name).join(", ")} toegevoegd`;case"CHAT_MEMBER_LEFT":return`${e.payload.members.map(t=>t.name).join(", ")} verlaten`;case"CHAT_CALL_STARTED":return"Gesprek gestart";case"CHAT_CALL_ENDED":return`Gesprek beëindigd${e.payload.duration?` (${i(e.payload.duration)})`:""}`;case"CHAT_EVENT":return e.payload.text??e.payload.eventType;case"VOICE_CALL_STARTED":case"VIDEO_CALL_STARTED":return"Gesprek gestart";case"VOICE_CALL_ANSWERED":case"VIDEO_CALL_ANSWERED":return"Gesprek aangenomen";case"VOICE_CALL_HOLD":case"VIDEO_CALL_HOLD":return"In de wacht";case"VOICE_CALL_UNHOLD":case"VIDEO_CALL_UNHOLD":return"Hervat";case"VOICE_CALL_ENDED":case"VIDEO_CALL_ENDED":return`Gesprek beëindigd${e.payload.duration?` (${i(e.payload.duration)})`:""}`;case"VOICE_CALL_MISSED":case"VIDEO_CALL_MISSED":return"Gemiste oproep";case"VOICE_CALL_FAILED":case"VIDEO_CALL_FAILED":return"Gesprek mislukt";case"VOICE_CALL_VOICEMAIL":return e.payload.transcription?.trim()?e.payload.transcription:"Voicemail ontvangen";case"TRANSCRIPT_ADDED":return(e.payload.segments??[]).map(t=>t.text).join(" ");case"AI_MESSAGE_ADDED":return e.payload.output?.text??e.payload.input?.text??"";case"AI_ACTION_PROPOSED":return`Voorstel wacht op goedkeuring (${e.payload.actions?.length??0} actie(s))`;case"PLAYBOOK_STARTED":return`Playbook gestart${e.payload.playbookName?`: ${e.payload.playbookName}`:""}`;case"PLAYBOOK_COMPLETED":return"Playbook afgerond";case"PLAYBOOK_ESCALATED":return"Playbook geëscaleerd naar een mens";case"MEETING_SCHEDULED":return`Vergadering gepland: ${e.payload.title}`;case"MEETING_STARTED":return`Vergadering gestart: ${e.payload.title}`;case"MEETING_ENDED":return`Vergadering beëindigd${e.payload.duration?` (${i(e.payload.duration)})`:""}`;case"MEETING_PARTICIPANT_JOINED":return`${e.payload.name} deelgenomen`;case"MEETING_PARTICIPANT_LEFT":return`${e.payload.name} verlaten`;case"COMMENT_ADDED":return e.payload.text??"";case"FILE_UPLOADED":return`Bestand: ${e.payload.fileName}`;case"INTERACTION_CREATED":return"Interactie aangemaakt";case"INTERACTION_STATUS_CHANGED":return`Status: ${e.payload.fromStatus} → ${e.payload.toStatus}`;case"INTERACTION_ASSIGNED":return"Interactie toegewezen";default:return""}}function h(e){return{activityId:e.id,type:e.type,snippet:M(C(e)),authorName:e.author?.name??"",direction:e.direction,createdAt:e.createdAt??Date.now()}}function U(e,t,n=[]){const r=e.createdAt;if(!r)return[];const s=new Set(n);return e.author.type==="user"&&e.author.id&&s.add(e.author.id),Object.entries(t).filter(([a,o])=>o>=r&&!s.has(a)).map(([a])=>a)}const P=[{id:"agent",label:"Agent",labelSource:"user"},{id:"team",label:"Team",labelSource:"team"},{id:"inbox",label:"Inbox",labelSource:"inbox"},{id:"channel",label:"Kanaal",labelSource:"channel"},{id:"provider",label:"Provider",labelSource:"raw"},{id:"status",label:"Status",labelSource:"raw"},{id:"handledBy",label:"Afhandelaar",labelSource:"raw"},{id:"time",label:"Tijd",labelSource:"raw"}];function $(e){const t=[];for(const n of Object.keys(e))for(const r of Object.keys(e[n]))t.push({lang:n,key:r,value:e[n][r]});return t}function l(e){return e<10?`0${e}`:`${e}`}function A(e,t){const n=new Date(e),r=`${n.getUTCFullYear()}-${l(n.getUTCMonth()+1)}-${l(n.getUTCDate())}`;return t==="day"?r:`${r}T${l(n.getUTCHours())}`}function f(e,t){const n=new Date(e);return n.setUTCMinutes(0,0,0),t==="day"&&n.setUTCHours(0),n.getTime()}const k=36e5,G=864e5;function V(e,t,n){const r=n==="hour"?k:G,s=[];for(let a=f(e,n);a<=t;a+=r)s.push(A(a,n));return s}function H(e){return(e.startsWith("tool:")?e.slice(5):e).replace(/__/g," · ").replace(/\./g," · ").replace(/_/g," ")}const w=[{name:"text",type:"string"},{name:"subject",type:"string"},{name:"from",type:"string"},{name:"type",type:"string"},{name:"direction",type:"string"},{name:"channelId",type:"string"},{name:"interactionId",type:"string"},{name:"activityId",type:"string"},{name:"authorType",type:"string"},{name:"authorName",type:"string"},{name:"textRaw",type:"string"}],F={topics:[{name:"topic",type:"string"},{name:"confidence",type:"number"}],question:[{name:"answer",type:"boolean"},{name:"confidence",type:"number"}],extract:[]};function I(e){switch(e.kind){case"user":return`user:${e.userId}`;case"team":return`team:${e.teamId}`;case"org":return"org"}}function x(e){if(typeof e!="string")return;const t=e.trim();if(t==="org")return{kind:"org"};const n=t.indexOf(":");if(n<=0)return;const r=t.slice(0,n),s=t.slice(n+1).trim();if(s){if(r==="user")return{kind:"user",userId:s};if(r==="team")return{kind:"team",teamId:s}}}function _(e){return I(e)}function B(e){switch(e.kind){case"personal":return{kind:"user",userId:e.userId};case"team":return{kind:"team",teamId:e.teamId};case"org":return{kind:"org"}}}function j(e){return _(e)}const S=["done","escalated","failed","timed_out","stopped"],T=["awaiting_approval","awaiting_reply"];function m(e){return S.includes(e)}function W(e){return m(e)}function K(e){return T.includes(e)}const Y=new Set(["mail","message"]);function R(e,t){const n=e.settings?.signatures?.[t];return!n||!n.enabled||!n.body||n.body.trim()===""?null:n}function q(e,t,n,r="html"){if(!e)return n;const s=R(e,t);return s?`${n}${r==="text"?`
2
2
 
3
- `:t==="mail"?"<br><br>-- <br>":"<br><br>"}${s.body}`:n}function F(e){return e.endpoints??[]}const x=e=>!!e.assignedUserId||!!e.assignedInboxId,j=e=>e.status==="closed",W=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,K=(e,t=30)=>e.title?.length<=t?e.title:`${e.title.substring(0,t)}...`;function Y(e,t){return e.lastActivityAt?!(e.seenBy??[]).includes(t):!1}const q=[/<blockquote/i,/class="?gmail_quote/i,/id="?[^"]*divRplyFwdMsg/i,/id="?[^"]*mail-editor-reference-message-container/i,/-{3,}\s*Original Message\s*-{3,}/i,/\n_{5,}\s*\n/,/\bOn\b[\s\S]{0,200}?\bwrote:/i],u=/^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i,v=/^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;function z(e){const t=e.split(`
4
- `);for(let n=0;n<t.length;n++)if(v.test(t[n])||u.test(t[n])&&t.slice(n+1,n+4).some(r=>u.test(r)))return t.slice(0,n).join(`
3
+ `:t==="mail"?"<br><br>-- <br>":"<br><br>"}${s.body}`:n}function z(e){return e.endpoints??[]}const v=e=>!!e.assignedUserId||!!e.assignedInboxId,J=e=>e.status==="closed",Q=e=>({urgent:10,high:5,normal:2,low:1})[e.priority]||0,X=(e,t=30)=>e.title?.length<=t?e.title:`${e.title.substring(0,t)}...`;function Z(e,t){return e.lastActivityAt?!(e.seenBy??[]).includes(t):!1}const ee=[/<blockquote/i,/class="?gmail_quote/i,/id="?[^"]*divRplyFwdMsg/i,/id="?[^"]*mail-editor-reference-message-container/i,/-{3,}\s*Original Message\s*-{3,}/i,/\n_{5,}\s*\n/,/\bOn\b[\s\S]{0,200}?\bwrote:/i],u=/^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i,te=/^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;function ne(e){const t=e.split(`
4
+ `);for(let n=0;n<t.length;n++)if(te.test(t[n])||u.test(t[n])&&t.slice(n+1,n+4).some(r=>u.test(r)))return t.slice(0,n).join(`
5
5
  `).trim();return e}function E(e){let t=e;return t=t.replace(/<(script|style)[\s\S]*?<\/\1>/gi,""),t=t.replace(/<br\s*\/?>/gi,`
6
6
  `),t=t.replace(/<\/(p|div|li|tr|h[1-6]|ul|ol|table)>/gi,`
7
7
  `),t=t.replace(/<[^>]+>/g,""),t=t.replace(/<[^>]*$/,""),t}function d(e){return e.replace(/&nbsp;/gi," ").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&#39;/gi,"'").replace(/&#(\d+);/g,(t,n)=>String.fromCharCode(Number(n))).replace(/&amp;/gi,"&")}function p(e){return e.replace(/\r/g,"").replace(/[ \t]+/g," ").replace(/ *\n */g,`
8
8
  `).replace(/\n{3,}/g,`
9
9
 
10
- `).trim()}function J(e){if(typeof e!="string"||!e)return"";let t=e.length;for(const a of q){const o=e.search(a);o>=0&&o<t&&(t=o)}const n=e.slice(0,t);let r=p(d(E(n)));return r||(r=p(d(E(e)))),z(r)||r}const Q=/(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i,X=/\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;function Z(e,t){return!!(e&&Q.test(e)||t&&X.test(t))}const R=3,N=600;function ee(e,t){return e>=R||t>=N}function b(e,t){const n=new Set(e.disabledIntents??[]),r=e.intentOverrides??{},s=t.intents.filter(o=>!n.has(o.intent)).map(o=>ne(o,r[o.intent]));if(!e.extraIntents||e.extraIntents.length===0)return s;const a=new Set(s.map(o=>o.intent));for(const o of e.extraIntents)a.has(o.intent)||(s.push(o),a.add(o.intent));return s}function D(e,t){const n={};for(const r of e.intents){if(!r.togglable)continue;const s=t?.[r.intent];n[r.intent]=s??r.defaultEnabled??!0}return n}function te(e,t){const n=D(e,t);return Object.entries(n).filter(([,r])=>!r).map(([r])=>r)}function ne(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function re(e,t){const n=[];for(const r of e){if(!r.enabled)continue;const s=t[r.providerId];if(s)for(const a of b(r,s))n.push({channel:r,description:s,capability:a})}return n}function se(e,t){return t.filter(n=>n.capability.intent===e)}function m(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function ae(e,t){return m(e.scheme,t)}function oe(e,t,n){const r=[];for(const s of e)for(const a of n)a.capability.intent===t&&a.capability.targetSchemes.includes(s.scheme)&&r.push({channelIntent:a,endpoint:s});return r}var O=(e=>(e.MAILTO="mailto",e.SIP="sip",e.TEL="tel",e.WEBHOOK="webhook",e.USERNAME="username",e.ID="id",e.CUSTOM="custom",e.URL="url",e.TELEGRAM="telegram",e.WHATSAPP="whatsapp",e.MESSENGER="messenger",e.INSTAGRAM="instagram",e.VIBER="viber",e.SMS="sms",e.FAX="fax",e.TEAMS="teams",e.CALENDAR="calendar",e))(O||{});const ie="message_window",le="message_templates",ce={FROM:"from",TO:"to",CC:"cc",BCC:"bcc",ORGANIZER:"organizer",PRESENTER:"presenter",ATTENDEE:"attendee",OWNER:"owner",MEMBER:"member",GUEST:"guest",HOST:"host",PARTICIPANT:"participant"},ue=(e,t)=>({intent:e,...t}),Ee="folder_management",de="remote_search",pe={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"};function L(e){switch(e.kind){case"user":return`user:${e.userId}`;case"team":return`team:${e.teamId}`;case"org":return"org"}}function Ae(e){if(typeof e!="string")return;const t=e.trim();if(t==="org")return{kind:"org"};const n=t.indexOf(":");if(n<=0)return;const r=t.slice(0,n),s=t.slice(n+1).trim();if(s){if(r==="user")return{kind:"user",userId:s};if(r==="team")return{kind:"team",teamId:s}}}function ge(e){return L(e)}const fe=9e4,_e="installation-id";exports.CORE_DIMENSIONS=P;exports.CommunicationScheme=O;exports.FEATURE_FOLDER_MANAGEMENT=Ee;exports.FEATURE_REMOTE_SEARCH=de;exports.INSTALLATION_HEADER=_e;exports.InteractionParticipantRole=ce;exports.PAUSED_RUN_STATUSES=I;exports.PRESENCE_ONLINE_WINDOW_MS=fe;exports.PROVIDER_FEATURE_MESSAGE_TEMPLATES=le;exports.PROVIDER_FEATURE_MESSAGE_WINDOW=ie;exports.SIGNATURE_INTENTS=w;exports.SUMMARY_MIN_LAST_CHARS=N;exports.SUMMARY_MIN_MESSAGES=R;exports.TERMINAL_RUN_STATUSES=_;exports.UNSUPPORTED=pe;exports.actingIdentityKey=ge;exports.applySignature=B;exports.buildActivityPreview=y;exports.buildChannelIntents=re;exports.cleanMessageText=J;exports.defineIntent=ue;exports.disabledIntentsFromCapabilities=te;exports.filterByEndpoint=ae;exports.filterByIntent=se;exports.filterByTargetScheme=m;exports.flattenLocales=h;exports.floorToPeriod=f;exports.formatActingIdentity=L;exports.formatPeriod=g;exports.getActivitySeenUserIds=U;exports.getContactEndpoints=F;exports.getShortTitle=K;exports.getUrgencyScore=W;exports.isAssigned=x;exports.isClosed=j;exports.isInteractionUnseen=Y;exports.isLikelyBulk=Z;exports.isPaused=V;exports.isRetryable=k;exports.isTerminal=T;exports.isThreadLongEnough=ee;exports.matchContactToIntents=oe;exports.parseActingIdentity=Ae;exports.periodsInRange=H;exports.resolveAccountCapabilities=D;exports.resolveChannelIntents=b;exports.resolveSignature=S;exports.stripHtml=A;
10
+ `).trim()}function re(e){if(typeof e!="string"||!e)return"";let t=e.length;for(const a of ee){const o=e.search(a);o>=0&&o<t&&(t=o)}const n=e.slice(0,t);let r=p(d(E(n)));return r||(r=p(d(E(e)))),ne(r)||r}const se=/(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i,ae=/\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;function oe(e,t){return!!(e&&se.test(e)||t&&ae.test(t))}const b=3,N=600;function ie(e,t){return e>=b||t>=N}function D(e,t){const n=new Set(e.disabledIntents??[]),r=e.intentOverrides??{},s=t.intents.filter(o=>!n.has(o.intent)).map(o=>ce(o,r[o.intent]));if(!e.extraIntents||e.extraIntents.length===0)return s;const a=new Set(s.map(o=>o.intent));for(const o of e.extraIntents)a.has(o.intent)||(s.push(o),a.add(o.intent));return s}function y(e,t){const n={};for(const r of e.intents){if(!r.togglable)continue;const s=t?.[r.intent];n[r.intent]=s??r.defaultEnabled??!0}return n}function le(e,t){const n=y(e,t);return Object.entries(n).filter(([,r])=>!r).map(([r])=>r)}function ce(e,t){return t?{intent:t.intent??e.intent,targetSchemes:t.targetSchemes??e.targetSchemes,transport:t.transport??e.transport}:e}function ue(e,t){const n=[];for(const r of e){if(!r.enabled)continue;const s=t[r.providerId];if(s)for(const a of D(r,s))n.push({channel:r,description:s,capability:a})}return n}function Ee(e,t){return t.filter(n=>n.capability.intent===e)}function L(e,t){return t.filter(n=>n.capability.targetSchemes.includes(e))}function de(e,t){return L(e.scheme,t)}function pe(e,t,n){const r=[];for(const s of e)for(const a of n)a.capability.intent===t&&a.capability.targetSchemes.includes(s.scheme)&&r.push({channelIntent:a,endpoint:s});return r}var O=(e=>(e.MAILTO="mailto",e.SIP="sip",e.TEL="tel",e.WEBHOOK="webhook",e.USERNAME="username",e.ID="id",e.CUSTOM="custom",e.URL="url",e.TELEGRAM="telegram",e.WHATSAPP="whatsapp",e.MESSENGER="messenger",e.INSTAGRAM="instagram",e.VIBER="viber",e.SMS="sms",e.FAX="fax",e.TEAMS="teams",e.CALENDAR="calendar",e))(O||{});const ge="message_window",Ae="message_templates",fe={FROM:"from",TO:"to",CC:"cc",BCC:"bcc",ORGANIZER:"organizer",PRESENTER:"presenter",ATTENDEE:"attendee",OWNER:"owner",MEMBER:"member",GUEST:"guest",HOST:"host",PARTICIPANT:"participant"},Ie=(e,t)=>({intent:e,...t}),_e="folder_management",Se="remote_search",Te={ok:!1,code:"UNSUPPORTED",message:"Provider does not support this op"},me=9e4,Re="installation-id";exports.CLASSIFY_VARS=F;exports.CORE_DIMENSIONS=P;exports.CommunicationScheme=O;exports.FEATURE_FOLDER_MANAGEMENT=_e;exports.FEATURE_REMOTE_SEARCH=Se;exports.INSTALLATION_HEADER=Re;exports.InteractionParticipantRole=fe;exports.PAUSED_RUN_STATUSES=T;exports.PRESENCE_ONLINE_WINDOW_MS=me;exports.PROVIDER_FEATURE_MESSAGE_TEMPLATES=Ae;exports.PROVIDER_FEATURE_MESSAGE_WINDOW=ge;exports.SIGNATURE_INTENTS=Y;exports.SUMMARY_MIN_LAST_CHARS=N;exports.SUMMARY_MIN_MESSAGES=b;exports.TERMINAL_RUN_STATUSES=S;exports.TRIGGER_VARS=w;exports.UNSUPPORTED=Te;exports.actingIdentityKey=_;exports.actorKey=j;exports.applySignature=q;exports.buildActivityPreview=h;exports.buildChannelIntents=ue;exports.cleanMessageText=re;exports.defineIntent=Ie;exports.disabledIntentsFromCapabilities=le;exports.filterByEndpoint=de;exports.filterByIntent=Ee;exports.filterByTargetScheme=L;exports.flattenLocales=$;exports.floorToPeriod=f;exports.formatActingIdentity=I;exports.formatPeriod=A;exports.getActivitySeenUserIds=U;exports.getContactEndpoints=z;exports.getShortTitle=X;exports.getUrgencyScore=Q;exports.humanizeAction=H;exports.isAssigned=v;exports.isClosed=J;exports.isInteractionUnseen=Z;exports.isLikelyBulk=oe;exports.isPaused=K;exports.isRetryable=W;exports.isTerminal=m;exports.isThreadLongEnough=ie;exports.matchContactToIntents=pe;exports.parseActingIdentity=x;exports.periodsInRange=V;exports.playbookActor=B;exports.resolveAccountCapabilities=y;exports.resolveChannelIntents=D;exports.resolveSignature=R;exports.stripHtml=g;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- function p(e) {
1
+ function E(e) {
2
2
  return e.replace(/<style[\s\S]*?<\/style>/gi, " ").replace(/<script[\s\S]*?<\/script>/gi, " ").replace(/<[^>]+>/g, " ").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/\s+/g, " ").trim();
3
3
  }
4
- function f(e) {
4
+ function g(e) {
5
5
  const t = e.trim();
6
6
  return t.length <= 140 ? t : t.slice(0, 139).trimEnd() + "…";
7
7
  }
@@ -10,11 +10,11 @@ function i(e) {
10
10
  const t = Math.floor(e / 60), n = Math.floor(e % 60);
11
11
  return `${t}:${n.toString().padStart(2, "0")}`;
12
12
  }
13
- function g(e) {
13
+ function f(e) {
14
14
  switch (e.type) {
15
15
  case "EMAIL_RECEIVED":
16
16
  case "EMAIL_SENT": {
17
- const t = e.payload, n = t.bodySnippet?.trim() || p(t.body ?? "");
17
+ const t = e.payload, n = t.bodySnippet?.trim() || E(t.body ?? "");
18
18
  return t.subject ? `${t.subject} — ${n}` : n;
19
19
  }
20
20
  case "CHAT_MESSAGE_SENT":
@@ -91,23 +91,23 @@ function g(e) {
91
91
  return "";
92
92
  }
93
93
  }
94
- function w(e) {
94
+ function H(e) {
95
95
  return {
96
96
  activityId: e.id,
97
97
  type: e.type,
98
- snippet: f(g(e)),
98
+ snippet: g(f(e)),
99
99
  authorName: e.author?.name ?? "",
100
100
  direction: e.direction,
101
101
  createdAt: e.createdAt ?? Date.now()
102
102
  };
103
103
  }
104
- function G(e, t, n = []) {
104
+ function V(e, t, n = []) {
105
105
  const r = e.createdAt;
106
106
  if (!r) return [];
107
107
  const s = new Set(n);
108
108
  return e.author.type === "user" && e.author.id && s.add(e.author.id), Object.entries(t).filter(([a, o]) => o >= r && !s.has(a)).map(([a]) => a);
109
109
  }
110
- const V = [
110
+ const x = [
111
111
  { id: "agent", label: "Agent", labelSource: "user" },
112
112
  { id: "team", label: "Team", labelSource: "team" },
113
113
  { id: "inbox", label: "Inbox", labelSource: "inbox" },
@@ -117,7 +117,7 @@ const V = [
117
117
  { id: "handledBy", label: "Afhandelaar", labelSource: "raw" },
118
118
  { id: "time", label: "Tijd", labelSource: "raw" }
119
119
  ];
120
- function x(e) {
120
+ function B(e) {
121
121
  const t = [];
122
122
  for (const n of Object.keys(e))
123
123
  for (const r of Object.keys(e[n]))
@@ -136,47 +136,111 @@ function _(e, t) {
136
136
  return n.setUTCMinutes(0, 0, 0), t === "day" && n.setUTCHours(0), n.getTime();
137
137
  }
138
138
  const I = 36e5, T = 864e5;
139
- function B(e, t, n) {
139
+ function F(e, t, n) {
140
140
  const r = n === "hour" ? I : T, s = [];
141
141
  for (let a = _(e, n); a <= t; a += r)
142
142
  s.push(A(a, n));
143
143
  return s;
144
144
  }
145
- const S = ["done", "escalated", "failed", "timed_out", "stopped"], b = ["awaiting_approval", "awaiting_reply"];
146
- function N(e) {
147
- return S.includes(e);
145
+ function j(e) {
146
+ return (e.startsWith("tool:") ? e.slice(5) : e).replace(/__/g, " · ").replace(/\./g, " · ").replace(/_/g, " ");
147
+ }
148
+ const W = [
149
+ { name: "text", type: "string" },
150
+ { name: "subject", type: "string" },
151
+ { name: "from", type: "string" },
152
+ { name: "type", type: "string" },
153
+ { name: "direction", type: "string" },
154
+ { name: "channelId", type: "string" },
155
+ { name: "interactionId", type: "string" },
156
+ { name: "activityId", type: "string" },
157
+ { name: "authorType", type: "string" },
158
+ { name: "authorName", type: "string" },
159
+ { name: "textRaw", type: "string" }
160
+ ], K = {
161
+ topics: [
162
+ { name: "topic", type: "string" },
163
+ { name: "confidence", type: "number" }
164
+ ],
165
+ question: [
166
+ { name: "answer", type: "boolean" },
167
+ { name: "confidence", type: "number" }
168
+ ],
169
+ extract: []
170
+ };
171
+ function S(e) {
172
+ switch (e.kind) {
173
+ case "user":
174
+ return `user:${e.userId}`;
175
+ case "team":
176
+ return `team:${e.teamId}`;
177
+ case "org":
178
+ return "org";
179
+ }
148
180
  }
149
- function F(e) {
150
- return N(e);
181
+ function Y(e) {
182
+ if (typeof e != "string") return;
183
+ const t = e.trim();
184
+ if (t === "org") return { kind: "org" };
185
+ const n = t.indexOf(":");
186
+ if (n <= 0) return;
187
+ const r = t.slice(0, n), s = t.slice(n + 1).trim();
188
+ if (s) {
189
+ if (r === "user") return { kind: "user", userId: s };
190
+ if (r === "team") return { kind: "team", teamId: s };
191
+ }
151
192
  }
152
- function j(e) {
193
+ function m(e) {
194
+ return S(e);
195
+ }
196
+ function q(e) {
197
+ switch (e.kind) {
198
+ case "personal":
199
+ return { kind: "user", userId: e.userId };
200
+ case "team":
201
+ return { kind: "team", teamId: e.teamId };
202
+ case "org":
203
+ return { kind: "org" };
204
+ }
205
+ }
206
+ function z(e) {
207
+ return m(e);
208
+ }
209
+ const b = ["done", "escalated", "failed", "timed_out", "stopped"], N = ["awaiting_approval", "awaiting_reply"];
210
+ function D(e) {
153
211
  return b.includes(e);
154
212
  }
155
- const W = /* @__PURE__ */ new Set(["mail", "message"]);
156
- function D(e, t) {
213
+ function X(e) {
214
+ return D(e);
215
+ }
216
+ function J(e) {
217
+ return N.includes(e);
218
+ }
219
+ const Q = /* @__PURE__ */ new Set(["mail", "message"]);
220
+ function R(e, t) {
157
221
  const n = e.settings?.signatures?.[t];
158
222
  return !n || !n.enabled || !n.body || n.body.trim() === "" ? null : n;
159
223
  }
160
- function K(e, t, n, r = "html") {
224
+ function Z(e, t, n, r = "html") {
161
225
  if (!e) return n;
162
- const s = D(e, t);
226
+ const s = R(e, t);
163
227
  return s ? `${n}${r === "text" ? `
164
228
 
165
229
  ` : t === "mail" ? "<br><br>-- <br>" : "<br><br>"}${s.body}` : n;
166
230
  }
167
- function Y(e) {
231
+ function v(e) {
168
232
  return e.endpoints ?? [];
169
233
  }
170
- const q = (e) => !!e.assignedUserId || !!e.assignedInboxId, X = (e) => e.status === "closed", z = (e) => ({
234
+ const ee = (e) => !!e.assignedUserId || !!e.assignedInboxId, te = (e) => e.status === "closed", ne = (e) => ({
171
235
  urgent: 10,
172
236
  high: 5,
173
237
  normal: 2,
174
238
  low: 1
175
- })[e.priority] || 0, J = (e, t = 30) => e.title?.length <= t ? e.title : `${e.title.substring(0, t)}...`;
176
- function Q(e, t) {
239
+ })[e.priority] || 0, re = (e, t = 30) => e.title?.length <= t ? e.title : `${e.title.substring(0, t)}...`;
240
+ function se(e, t) {
177
241
  return e.lastActivityAt ? !(e.seenBy ?? []).includes(t) : !1;
178
242
  }
179
- const m = [
243
+ const L = [
180
244
  /<blockquote/i,
181
245
  /class="?gmail_quote/i,
182
246
  // Gmail quote container
@@ -189,12 +253,12 @@ const m = [
189
253
  // Outlook underscore separator before "From:"
190
254
  /\bOn\b[\s\S]{0,200}?\bwrote:/i
191
255
  // Gmail "On <date> <name> wrote:"
192
- ], u = /^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i, L = /^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;
193
- function O(e) {
256
+ ], u = /^\s*(?:>+\s*)?(?:from|van|sent|verzonden|to|aan|cc|subject|onderwerp|date|datum)\s*:/i, O = /^\s*(?:on|op)\b.{0,200}?\b(?:wrote|schreef|geschreven)\s*:?\s*$/i;
257
+ function y(e) {
194
258
  const t = e.split(`
195
259
  `);
196
260
  for (let n = 0; n < t.length; n++)
197
- if (L.test(t[n]) || u.test(t[n]) && t.slice(n + 1, n + 4).some((r) => u.test(r)))
261
+ if (O.test(t[n]) || u.test(t[n]) && t.slice(n + 1, n + 4).some((r) => u.test(r)))
198
262
  return t.slice(0, n).join(`
199
263
  `).trim();
200
264
  return e;
@@ -208,40 +272,40 @@ function c(e) {
208
272
  function d(e) {
209
273
  return e.replace(/&nbsp;/gi, " ").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&#39;/gi, "'").replace(/&#(\d+);/g, (t, n) => String.fromCharCode(Number(n))).replace(/&amp;/gi, "&");
210
274
  }
211
- function E(e) {
275
+ function p(e) {
212
276
  return e.replace(/\r/g, "").replace(/[ \t]+/g, " ").replace(/ *\n */g, `
213
277
  `).replace(/\n{3,}/g, `
214
278
 
215
279
  `).trim();
216
280
  }
217
- function Z(e) {
281
+ function ae(e) {
218
282
  if (typeof e != "string" || !e) return "";
219
283
  let t = e.length;
220
- for (const a of m) {
284
+ for (const a of L) {
221
285
  const o = e.search(a);
222
286
  o >= 0 && o < t && (t = o);
223
287
  }
224
288
  const n = e.slice(0, t);
225
- let r = E(d(c(n)));
226
- return r || (r = E(d(c(e)))), O(r) || r;
289
+ let r = p(d(c(n)));
290
+ return r || (r = p(d(c(e)))), y(r) || r;
227
291
  }
228
- const R = /(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i, C = /\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;
229
- function v(e, t) {
230
- return !!(e && R.test(e) || t && C.test(t));
292
+ const C = /(^|[._+-])(no-?reply|noreply|donotreply|do-not-reply|newsletter|nieuwsbrief|mailer|mailing|notifications?|bounce|postmaster|marketing)@/i, M = /\b(unsubscribe|afmelden|uitschrijven|opt[\s-]?out|manage (your )?preferences|geen (e-?mails?|nieuwsbrief|berichten) meer)\b/i;
293
+ function oe(e, t) {
294
+ return !!(e && C.test(e) || t && M.test(t));
231
295
  }
232
- const M = 3, y = 600;
233
- function ee(e, t) {
234
- return e >= M || t >= y;
296
+ const h = 3, P = 600;
297
+ function ie(e, t) {
298
+ return e >= h || t >= P;
235
299
  }
236
- function h(e, t) {
237
- const n = new Set(e.disabledIntents ?? []), r = e.intentOverrides ?? {}, s = t.intents.filter((o) => !n.has(o.intent)).map((o) => U(o, r[o.intent]));
300
+ function U(e, t) {
301
+ const n = new Set(e.disabledIntents ?? []), r = e.intentOverrides ?? {}, s = t.intents.filter((o) => !n.has(o.intent)).map((o) => k(o, r[o.intent]));
238
302
  if (!e.extraIntents || e.extraIntents.length === 0) return s;
239
303
  const a = new Set(s.map((o) => o.intent));
240
304
  for (const o of e.extraIntents)
241
305
  a.has(o.intent) || (s.push(o), a.add(o.intent));
242
306
  return s;
243
307
  }
244
- function P(e, t) {
308
+ function $(e, t) {
245
309
  const n = {};
246
310
  for (const r of e.intents) {
247
311
  if (!r.togglable) continue;
@@ -250,46 +314,46 @@ function P(e, t) {
250
314
  }
251
315
  return n;
252
316
  }
253
- function te(e, t) {
254
- const n = P(e, t);
317
+ function le(e, t) {
318
+ const n = $(e, t);
255
319
  return Object.entries(n).filter(([, r]) => !r).map(([r]) => r);
256
320
  }
257
- function U(e, t) {
321
+ function k(e, t) {
258
322
  return t ? {
259
323
  intent: t.intent ?? e.intent,
260
324
  targetSchemes: t.targetSchemes ?? e.targetSchemes,
261
325
  transport: t.transport ?? e.transport
262
326
  } : e;
263
327
  }
264
- function ne(e, t) {
328
+ function ue(e, t) {
265
329
  const n = [];
266
330
  for (const r of e) {
267
331
  if (!r.enabled) continue;
268
332
  const s = t[r.providerId];
269
333
  if (s)
270
- for (const a of h(r, s))
334
+ for (const a of U(r, s))
271
335
  n.push({ channel: r, description: s, capability: a });
272
336
  }
273
337
  return n;
274
338
  }
275
- function re(e, t) {
339
+ function ce(e, t) {
276
340
  return t.filter((n) => n.capability.intent === e);
277
341
  }
278
- function $(e, t) {
342
+ function w(e, t) {
279
343
  return t.filter((n) => n.capability.targetSchemes.includes(e));
280
344
  }
281
- function se(e, t) {
282
- return $(e.scheme, t);
345
+ function de(e, t) {
346
+ return w(e.scheme, t);
283
347
  }
284
- function ae(e, t, n) {
348
+ function pe(e, t, n) {
285
349
  const r = [];
286
350
  for (const s of e)
287
351
  for (const a of n)
288
352
  a.capability.intent === t && a.capability.targetSchemes.includes(s.scheme) && r.push({ channelIntent: a, endpoint: s });
289
353
  return r;
290
354
  }
291
- var k = /* @__PURE__ */ ((e) => (e.MAILTO = "mailto", e.SIP = "sip", e.TEL = "tel", e.WEBHOOK = "webhook", e.USERNAME = "username", e.ID = "id", e.CUSTOM = "custom", e.URL = "url", e.TELEGRAM = "telegram", e.WHATSAPP = "whatsapp", e.MESSENGER = "messenger", e.INSTAGRAM = "instagram", e.VIBER = "viber", e.SMS = "sms", e.FAX = "fax", e.TEAMS = "teams", e.CALENDAR = "calendar", e))(k || {});
292
- const oe = "message_window", ie = "message_templates", le = {
355
+ var G = /* @__PURE__ */ ((e) => (e.MAILTO = "mailto", e.SIP = "sip", e.TEL = "tel", e.WEBHOOK = "webhook", e.USERNAME = "username", e.ID = "id", e.CUSTOM = "custom", e.URL = "url", e.TELEGRAM = "telegram", e.WHATSAPP = "whatsapp", e.MESSENGER = "messenger", e.INSTAGRAM = "instagram", e.VIBER = "viber", e.SMS = "sms", e.FAX = "fax", e.TEAMS = "teams", e.CALENDAR = "calendar", e))(G || {});
356
+ const Ee = "message_window", ge = "message_templates", fe = {
293
357
  // E-mail
294
358
  FROM: "from",
295
359
  TO: "to",
@@ -306,80 +370,59 @@ const oe = "message_window", ie = "message_templates", le = {
306
370
  // Voice/conference
307
371
  HOST: "host",
308
372
  PARTICIPANT: "participant"
309
- }, ue = (e, t) => ({ intent: e, ...t }), ce = "folder_management", de = "remote_search", Ee = { ok: !1, code: "UNSUPPORTED", message: "Provider does not support this op" };
310
- function H(e) {
311
- switch (e.kind) {
312
- case "user":
313
- return `user:${e.userId}`;
314
- case "team":
315
- return `team:${e.teamId}`;
316
- case "org":
317
- return "org";
318
- }
319
- }
320
- function pe(e) {
321
- if (typeof e != "string") return;
322
- const t = e.trim();
323
- if (t === "org") return { kind: "org" };
324
- const n = t.indexOf(":");
325
- if (n <= 0) return;
326
- const r = t.slice(0, n), s = t.slice(n + 1).trim();
327
- if (s) {
328
- if (r === "user") return { kind: "user", userId: s };
329
- if (r === "team") return { kind: "team", teamId: s };
330
- }
331
- }
332
- function fe(e) {
333
- return H(e);
334
- }
335
- const ge = 9e4, Ae = "installation-id";
373
+ }, Ae = (e, t) => ({ intent: e, ...t }), _e = "folder_management", Ie = "remote_search", Te = { ok: !1, code: "UNSUPPORTED", message: "Provider does not support this op" }, Se = 9e4, me = "installation-id";
336
374
  export {
337
- V as CORE_DIMENSIONS,
338
- k as CommunicationScheme,
339
- ce as FEATURE_FOLDER_MANAGEMENT,
340
- de as FEATURE_REMOTE_SEARCH,
341
- Ae as INSTALLATION_HEADER,
342
- le as InteractionParticipantRole,
343
- b as PAUSED_RUN_STATUSES,
344
- ge as PRESENCE_ONLINE_WINDOW_MS,
345
- ie as PROVIDER_FEATURE_MESSAGE_TEMPLATES,
346
- oe as PROVIDER_FEATURE_MESSAGE_WINDOW,
347
- W as SIGNATURE_INTENTS,
348
- y as SUMMARY_MIN_LAST_CHARS,
349
- M as SUMMARY_MIN_MESSAGES,
350
- S as TERMINAL_RUN_STATUSES,
351
- Ee as UNSUPPORTED,
352
- fe as actingIdentityKey,
353
- K as applySignature,
354
- w as buildActivityPreview,
355
- ne as buildChannelIntents,
356
- Z as cleanMessageText,
357
- ue as defineIntent,
358
- te as disabledIntentsFromCapabilities,
359
- se as filterByEndpoint,
360
- re as filterByIntent,
361
- $ as filterByTargetScheme,
362
- x as flattenLocales,
375
+ K as CLASSIFY_VARS,
376
+ x as CORE_DIMENSIONS,
377
+ G as CommunicationScheme,
378
+ _e as FEATURE_FOLDER_MANAGEMENT,
379
+ Ie as FEATURE_REMOTE_SEARCH,
380
+ me as INSTALLATION_HEADER,
381
+ fe as InteractionParticipantRole,
382
+ N as PAUSED_RUN_STATUSES,
383
+ Se as PRESENCE_ONLINE_WINDOW_MS,
384
+ ge as PROVIDER_FEATURE_MESSAGE_TEMPLATES,
385
+ Ee as PROVIDER_FEATURE_MESSAGE_WINDOW,
386
+ Q as SIGNATURE_INTENTS,
387
+ P as SUMMARY_MIN_LAST_CHARS,
388
+ h as SUMMARY_MIN_MESSAGES,
389
+ b as TERMINAL_RUN_STATUSES,
390
+ W as TRIGGER_VARS,
391
+ Te as UNSUPPORTED,
392
+ m as actingIdentityKey,
393
+ z as actorKey,
394
+ Z as applySignature,
395
+ H as buildActivityPreview,
396
+ ue as buildChannelIntents,
397
+ ae as cleanMessageText,
398
+ Ae as defineIntent,
399
+ le as disabledIntentsFromCapabilities,
400
+ de as filterByEndpoint,
401
+ ce as filterByIntent,
402
+ w as filterByTargetScheme,
403
+ B as flattenLocales,
363
404
  _ as floorToPeriod,
364
- H as formatActingIdentity,
405
+ S as formatActingIdentity,
365
406
  A as formatPeriod,
366
- G as getActivitySeenUserIds,
367
- Y as getContactEndpoints,
368
- J as getShortTitle,
369
- z as getUrgencyScore,
370
- q as isAssigned,
371
- X as isClosed,
372
- Q as isInteractionUnseen,
373
- v as isLikelyBulk,
374
- j as isPaused,
375
- F as isRetryable,
376
- N as isTerminal,
377
- ee as isThreadLongEnough,
378
- ae as matchContactToIntents,
379
- pe as parseActingIdentity,
380
- B as periodsInRange,
381
- P as resolveAccountCapabilities,
382
- h as resolveChannelIntents,
383
- D as resolveSignature,
384
- p as stripHtml
407
+ V as getActivitySeenUserIds,
408
+ v as getContactEndpoints,
409
+ re as getShortTitle,
410
+ ne as getUrgencyScore,
411
+ j as humanizeAction,
412
+ ee as isAssigned,
413
+ te as isClosed,
414
+ se as isInteractionUnseen,
415
+ oe as isLikelyBulk,
416
+ J as isPaused,
417
+ X as isRetryable,
418
+ D as isTerminal,
419
+ ie as isThreadLongEnough,
420
+ pe as matchContactToIntents,
421
+ Y as parseActingIdentity,
422
+ F as periodsInRange,
423
+ q as playbookActor,
424
+ $ as resolveAccountCapabilities,
425
+ U as resolveChannelIntents,
426
+ R as resolveSignature,
427
+ E as stripHtml
385
428
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.124.0",
3
+ "version": "1.125.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",