@helpai/elements 6.9.0 → 6.10.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.
package/step-display.mjs CHANGED
@@ -1,3 +1,3 @@
1
- const e={attach:`Attach files`,file:`File`,attachmentMimeRejected:`{name} isn't a file type this chat accepts.`,attachmentTooLarge:`{name} is too large. Files can be up to {max} together.`,poweredBy:`Powered by {name}`,attachmentTooMany:`The attachment limit is {count}.`,attachmentUploadFailed:`{name} couldn't be uploaded.`,conversationLoading:`Loading chat…`,loadPreviousMessages:`Load previous messages`,close:`Close`,collapse:`Collapse`,collapseSidebar:`Collapse sidebar`,composerPlaceholder:`Type a message…`,dateLastWeek:`Last 7 days`,dateOlder:`Older`,dateToday:`Today`,dateYesterday:`Yesterday`,dropZone:`Drop files to attach`,dropZoneRejected:`These files can't be attached here`,errorGeneric:`Something went wrong`,errorRateLimited:`Too many requests — please try again in a moment.`,errorRateLimitedIn:`Too many requests — please try again in {seconds} s.`,errorOffline:`Can't reach the server. Check your connection and try again.`,errorServer:`Something went wrong on our side. Please try again.`,errorOriginNotAllowed:`This chat isn't set up for this website yet.`,errorMessageTooLong:`That message is too long. Shorten it and send it again.`,errorReconnecting:`Connection lost. Reconnecting…`,errorRetry:`Retry`,expand:`Expand`,expandSidebar:`Expand sidebar`,exitFullscreen:`Exit fullscreen`,fullscreen:`Fullscreen`,history:`History`,historyBack:`Back to chat`,historyEmpty:`No previous chats yet`,historyLoading:`Loading your chats…`,historyContinue:`Continue the chat`,historyTitle:`Chat history`,loadMoreConversations:`Load more conversations`,language:`Language`,launcherOpen:`Open chat`,launcherAsk:`Ask {name}`,micBlocked:`The microphone is blocked for this site, so voice input can't start.`,micStart:`Start voice input`,micStop:`Stop voice input`,moreActions:`More actions`,newConversation:`New chat`,panelTitle:`Chat`,popOut:`Open in new tab`,resizeHandle:`Drag to resize`,scrollToBottom:`Scroll to latest`,send:`Send`,queueMessage:`Queue message`,removeQueuedMessage:`Remove queued message`,removeAttachment:`Remove {name}`,suggestedReplies:`Suggested replies`,compactingContext:`Optimizing conversation context…`,soundOff:`Sound off`,soundOn:`Sound on`,talkToOperator:`Talk to a person`,connectingOperator:`Connecting you to a person…`,noOperatorAvailable:`No one's available right now — leave your details and we'll follow up.`,chattingWithOperator:`You're chatting with {operator}`,operatorBadgeTitle:`Live chat`,chatNotice:`You're chatting with an AI assistant.`,cancelOperatorRequest:`Keep chatting with the AI`,loginPrompt:`Log in for faster, more personalized support`,loginAction:`Log in`,loginRequired:`Log in to chat with us`,loginExpired:`Your login expired. Log in to continue this chat.`,loginExpiredGuest:`Your login expired. Log in to continue this chat, or start a new conversation as a guest.`,startAsGuest:`Start new conversation`,loggedInAs:`Logged in as {name}`,loggedIn:`Logged in`,dismissLoginPrompt:`Hide`,emailTranscript:`Email transcript`,emailTranscriptPrompt:`Get a copy of this conversation by email.`,emailTranscriptEmailLabel:`Email address`,emailTranscriptSend:`Send transcript`,emailTranscriptSending:`Sending…`,emailTranscriptSent:`Sent to {email}.`,emailTranscriptAlreadySent:`This conversation was already emailed. Send a new message to email it again.`,emailTranscriptLimited:`You've reached the limit for now. Try again later.`,emailTranscriptFailed:`Couldn't send it. Try again.`,emailTranscriptNotDelivered:`Couldn't send to this address. Check it and try again.`,emailTranscriptCancel:`Cancel`,emailTranscriptDone:`Done`,stop:`Stop`,theme:`Theme`,themeAuto:`Auto`,themeDark:`Dark`,themeLight:`Light`,textSize:`Text size`,textSizeSmall:`Small`,textSizeNormal:`Normal`,textSizeLarge:`Large`,loading:`Loading…`,visualPreparing:`Preparing visual…`,visualError:`This visual could not be displayed.`,visualPartial:`Some parts of this visual could not be displayed.`,visualSoldOut:`Sold out`,visualCartEmpty:`Your cart is empty.`,visualQuantity:`Qty`,visualChoose:`Choose`,thinking:`Thinking…`,thought:`Thought`,thoughtFor:`Thought for {time}`,toolResult:`Result`,sources:`Sources`,feedbackUp:`Good response`,feedbackDown:`Bad response`,feedbackThanks:`Thanks for your feedback`,copy:`Copy`,copied:`Copied`,copyTicketReference:`Ticket {reference}, copy`,tabHome:`Home`,tabConversations:`Chats`,tabHelp:`Help`,tabNews:`News`,modulesEmpty:`Nothing here yet`,chatUnavailable:`This chat isn't available right now`,moduleBack:`Back`,contentLoading:`Loading…`,contentHelpful:`Was this helpful?`,homeGreeting:`How can we help?`,homeGreetingNamed:`Hi {name} 👋`,homeGreetingLead:`How can we help?`,homeSearchPlaceholder:`Search for help`,homeAskPlaceholder:`Ask a question…`,homeWhatsNew:`What's new`,homeContentTitle:`Popular articles`,homeStatus:`Status`,helpTitle:`Help`,helpSearchPlaceholder:`Search for help`,helpEmpty:`No help articles yet`,helpLoading:`Loading help…`,helpSearchEmpty:`No results for “{query}”`,helpShowMore:`Show more`,newsTitle:`News`,newsEmpty:`No news yet`,newsLoading:`Loading news…`,newsShowMore:`Show more`,newsUnseen:`New post`,unread:`Unread`,formRequired:`This field is required`,formInvalidEmail:`Enter a valid email address`,formInvalidTel:`Enter a valid phone number`,formInvalidNumber:`Enter a valid number`,formOtherPlaceholder:`Type your answer…`,inputRequired:`Questions for you`,askFallbackQuestion:`Please provide the missing information.`,inputBadge:`Questions`,inputAnswered:`Answered`,inputSkipped:`Skipped`,showOptions:`Show options`,hideOptions:`Hide options`,qtypeText:`Your answer`,qtypeEmail:`Email address`,qtypePhone:`Phone number`,qtypeNumber:`Number`,qtypeDate:`Date`,qtypeChooseOne:`Pick one`,qtypeChooseAny:`Pick any`,qtypeBoolean:`Yes / No`,inputSubmit:`Submit answers`,inputSubmitHint:`Enter to send · Shift+Enter = new line`,inputSkip:`Skip`,confirmYes:`Yes`,confirmNo:`No`,approve:`Approve`,decline:`Decline`,changeAnswer:`Change answer`,approvalPrompt:`{action}?`,approvalEditHint:`You can change your answer until this step continues.`,stepInput:`Input`,stepWorking:`Working`,stepWorkingOnIt:`Working on it…`,stepNeedsYourApproval:`Needs your approval`,stepWaitingForVisitor:`Waiting for the visitor`,stepApproved:`Approved`,stepDeclined:`Declined`,stepReplaced:`Replaced`,stepFailed:`Failed`,stepDidNotWork:`Didn't work`,decidedYouApproved:`You approved`,decidedYouDeclined:`You declined`,decidedVisitorApproved:`Visitor approved`,decidedVisitorDeclined:`Visitor declined`,decidedTeamApproved:`Approved by a team member`,decidedTeamDeclined:`Declined by a team member`,decidedMemberApproved:`Approved by {name}`,decidedMemberDeclined:`Declined by {name}`,stepRawData:`Raw data`,decidedRulesApproved:`Auto-approved`,decidedRulesDeclined:`Auto-declined`,edit:`Edit`,statusError:`Error`,toolStepsFailed:`{count} failed`,statusStopped:`Stopped`,toolStepsStopped:`Stopped after {count} steps`,toolStepsStoppedOne:`Stopped after 1 step`},t=[`none`,`values`,`table`,`json`,`table-and-json`];function n(e){return typeof e==`string`&&t.some(t=>t===e)}const r={simple:{showSteps:!1,stepDetails:`values`,showStepSystem:!1,showDecidedBy:!1,foldApprovals:!0},technical:{showSteps:!0,stepDetails:`table-and-json`,showStepSystem:!0,showDecidedBy:!0,foldApprovals:!0}},i=[`showSteps`,`showStepSystem`,`showDecidedBy`,`foldApprovals`],a=[...i,`stepDetails`];function o(e){let t={};if(typeof e!=`object`||!e)return t;for(let n of i){let r=Reflect.get(e,n);typeof r==`boolean`&&(t[n]=r)}let r=Reflect.get(e,`stepDetails`);return n(r)&&(t.stepDetails=r),t}function s(e){return Object.hasOwn(r,e)}function c(e,t){return{...r[t],...e}}function l(e){return Object.keys(r).filter(s).find(t=>a.every(n=>r[t][n]===e[n]))}const u=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function d(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim().toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function f(e){if(e.title)return e.title;let t=e.toolName.replace(/^tool[:-]/,``),n=t.indexOf(`__`);return d(n>0?t.slice(n+2):t)}function p(e,t,n){let r=e.approval;return r?.replacedByMessageId?`replaced`:e.state===`output-available`?n.error===void 0?`done`:`failed`:e.state===`output-error`?t.interrupted?`stopped`:`failed`:e.state===`output-denied`||r?.approved===!1?`declined`:e.state===`approval-responded`||r?.approved===!0?t.cutOff?`stopped`:`approved`:e.state===`approval-requested`?t.submitted?`submitted`:t.cutOff?`stopped`:t.superseded?`replaced`:`waiting`:t.live?`running`:`stopped`}function m(e,t){if(e.isAutomatic)return`rules`;let n=e.respondedBy;return n?.visitorId?`visitor`:n?.userId?n.userId===t.userId?`you`:`teamMember`:t.decides?`you`:`visitor`}function h(e,t,n,r){let i=r[t?`stepApproved`:`stepDeclined`];if(e===`teamMember`&&n)return{label:i,title:r[t?`decidedMemberApproved`:`decidedMemberDeclined`].replace(`{name}`,n)};let a=r[g[e][+!t]];return e===`you`?{label:i,title:a}:{label:a,title:a}}const g={you:[`decidedYouApproved`,`decidedYouDeclined`],visitor:[`decidedVisitorApproved`,`decidedVisitorDeclined`],teamMember:[`decidedTeamApproved`,`decidedTeamDeclined`],rules:[`decidedRulesApproved`,`decidedRulesDeclined`]};function _(e,t){switch(e){case`running`:return t.strings.stepWorking;case`waiting`:return t.reader.decides?t.strings.stepNeedsYourApproval:t.strings.stepWaitingForVisitor;case`submitted`:return t.strings.stepWorkingOnIt;case`approved`:return t.strings.stepApproved;case`declined`:return t.strings.stepDeclined;case`replaced`:return t.strings.stepReplaced;case`stopped`:return t.strings.statusStopped;case`failed`:return t.display.stepDetails===`none`||t.display.stepDetails===`values`?t.strings.stepDidNotWork:t.strings.stepFailed;case`done`:return``;default:return e}}function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function y(e){return typeof e==`string`?e.trim():typeof e==`number`||typeof e==`boolean`?String(e):``}function b(e){return y(e)||(typeof e==`object`&&e?JSON.stringify(e):``)}function x(e){if(!v(e))return b(e);let[t,...n]=Object.values(e).map(b).filter(Boolean);return t===void 0?``:n.length>0?`${t} (${n.join(`, `)})`:t}function S(e,t){if(!v(e))return[];let n=[];function r(e,i){if(Array.isArray(e)){let t=e.map(x).filter(Boolean).join(`, `);t&&n.push({path:i,value:t});return}if(v(e)){for(let[t,n]of Object.entries(e))r(n,[...i,t]);return}let a=y(e);a&&(t.withIds||!u.test(a))&&n.push({path:i,value:a})}r(e,[]);let i=n.map(({path:e})=>d(e.at(-1)??``));return n.map(({path:e,value:t},n)=>{let r=i[n]??``;return{label:i.filter(e=>e===r).length>1&&e.length>1?`${d(e.at(-2)??``)} · ${r.toLowerCase()}`:r,value:t}})}function C(e,t){if(v(e))return Object.entries(e).find(e=>e[0]!==t&&typeof e[1]==`string`&&e[1].trim().length>0&&!u.test(e[1].trim()))?.[1].trim()}function w(e){if(typeof e.toolMetadata?.system==`string`)return e.toolMetadata.system;let t=e.toolMetadata?.systemField,n=typeof t==`string`&&v(e.input)?e.input[t]:void 0;return typeof n==`string`&&n.trim()?n.trim():void 0}function T(e,t=1/0){if(e==null)return;let n=typeof e==`string`?e:JSON.stringify(e,null,2);if(n&&n!==`{}`&&n!==`[]`&&n!==`""`)return n.length>t?`${n.slice(0,t)}…`:n}function E(e){let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return e;try{return JSON.parse(t)}catch{return e}}function D(e){if(v(e)&&e.storage===`tool-result-ref`&&`summary`in e)return D(e.summary);if(v(e)&&Array.isArray(e.content)){let t=e.content.flatMap(e=>v(e)&&typeof e.text==`string`?[e.text]:[]).join(`
2
- `),n=v(e.structuredContent)?e.structuredContent:E(t);return e.isError===!0?{value:n,error:v(n)&&typeof n.error==`string`?n.error:t}:{value:n}}return v(e)&&typeof e.error==`string`&&typeof e.instruction==`string`?{value:e,error:e.error}:{value:e}}function O(e){return T(e.input)!==void 0||T(e.output)!==void 0||!!e.errorText}function k(e,t,n){let{display:r}=n,i=e.approval;if(typeof e.toolMetadata?.card==`string`&&i)return`card`;let a=i!==void 0&&!i.isAutomatic;if(a&&A(e,n.turn))return`card`;let o=t.decision?.by===`you`||a&&t.decision===void 0&&n.reader.decides;return a&&o?r.foldApprovals?`step`:`card`:a?r.showSteps||r.showDecidedBy?r.foldApprovals?`step`:`card`:`hidden`:i?.isAutomatic?r.showSteps||r.showDecidedBy?`step`:`hidden`:r.showSteps&&O(e)?`step`:`hidden`}function A(e,t){return e.approval?.replacedByMessageId||(t.superseded||t.cutOff)&&e.approval?.approved===void 0?!1:e.state===`approval-requested`||e.state===`approval-responded`}function j(e,t){let{turn:n,reader:r,display:i,strings:a}=t,o=D(e.output),s=p(e,n,o),c=e.approval,l=c?.replacedByMessageId?void 0:c?.approved,u=c&&l!==void 0?m(c,r):void 0,d=u===`teamMember`?c?.respondedBy?.userId:void 0,g=u&&l!==void 0&&(u===`you`||i.showDecidedBy)?{approved:l,by:u,...h(u,l,d&&t.names?.get(d),a),...d?{userId:d}:{}}:void 0,v=f(e),y=i.showStepSystem||e.toolMetadata?.nameShared===!0?w(e):void 0,b=C(e.input,typeof e.toolMetadata?.systemField==`string`?e.toolMetadata.systemField:void 0),x=e.errorText??o.error,E=i.stepDetails===`table`||i.stepDetails===`table-and-json`,O=E&&o.error===void 0?S(o.value,{withIds:!0}):[],j=i.stepDetails===`json`||i.stepDetails===`table-and-json`?{input:T(e.input),output:T(o.value,4e3)}:void 0,N=c!==void 0&&!c.isAutomatic&&!e.toolMetadata?.card,P=c!==void 0&&!c.isAutomatic&&A(e,n),F=i.stepDetails===`none`&&!P?[]:S(e.input,{withIds:E||P}),I=x!==void 0&&x!==``&&i.stepDetails!==`none`&&i.stepDetails!==`values`,L=g?.by===`rules`&&i.stepDetails!==`none`?c?.reason:void 0,R={toolCallId:e.toolCallId,placement:`hidden`,...typeof e.toolMetadata?.card==`string`&&c?{card:e.toolMetadata.card}:{},name:v,...y?{system:y}:{},status:s,statusLabel:_(s,{reader:r,display:i,strings:a}),...g?{decision:g}:{},...L?{reason:L}:{},...b?{summary:b}:{},fields:F,tables:E,...O.length>0?{resultFields:O}:{},...I?{error:x}:{},...j?{raw:j}:{},opens:F.length>0||O.length>0||j!==void 0||I||L!==void 0,...N?{approval:M(e,s,{turn:n,reader:r,strings:a,name:v})}:{}};return{...R,placement:k(e,R,{turn:n,reader:r,display:i})}}function M(e,t,n){let r=n.strings.approvalPrompt.replace(`{action}`,n.name);return t===`waiting`?{ask:r,buttons:n.reader.decides?`decide`:`none`}:t===`submitted`||!A(e,n.turn)?{ask:r,buttons:`none`}:n.turn.canAct&&n.reader.decides?{ask:r,buttons:`change`,note:n.strings.approvalEditHint}:t===`approved`?{ask:r,buttons:`none`,note:n.strings.stepWorkingOnIt}:{ask:r,buttons:`none`}}function N(e){let t=/* @__PURE__ */ new Map;for(let n of e)t.set(n.name,(t.get(n.name)??0)+1);let n=/* @__PURE__ */ new Map;for(let{decision:t}of e){if(!t)continue;let e=n.get(t.title)??{approved:t.approved,label:t.label,title:t.title,...t.userId?{userId:t.userId}:{},count:0};n.set(t.title,{...e,count:e.count+1})}let[r]=e,i=e.some(e=>e.status===`stopped`);return{tools:[...t].map(([e,t])=>({name:e,count:t})),...e.length===1&&r?{single:{name:r.name,...r.system?{system:r.system}:{},...r.summary?{summary:r.summary}:{},...P(r)}}:{},marks:[...n.values()].map(({count:e,...t})=>Object.assign(t,{label:e>1?`${t.label} ×${e}`:t.label})),failed:e.filter(e=>e.status===`failed`).length,...i?{stopped:{finished:e.filter(e=>e.status!==`stopped`).length}}:{}}}function P(e){return!e.decision&&(e.status===`replaced`||e.status===`declined`)?{outcome:e.statusLabel}:{}}function F(e,t){return e===0?t.statusStopped:e===1?t.toolStepsStoppedOne:t.toolStepsStopped.replace(`{count}`,String(e))}const I=e;export{t as STEP_DETAILS,a as STEP_DISPLAY_KEYS,r as STEP_DISPLAY_PRESETS,i as STEP_DISPLAY_SWITCHES,I as STEP_STRINGS_EN,n as isStepDetails,s as isStepDisplayPreset,l as matchStepDisplayPreset,d as nameInWords,T as rawText,o as readStepDisplay,c as resolveStepDisplay,j as stepCallView,S as stepFields,N as stepGroupLine,f as stepName,D as stepResult,F as stoppedLineLabel};
1
+ const e={attach:`Attach files`,file:`File`,attachmentMimeRejected:`{name} isn't a file type this chat accepts.`,attachmentTooLarge:`{name} is too large. Files can be up to {max} together.`,poweredBy:`Powered by {name}`,attachmentTooMany:`The attachment limit is {count}.`,attachmentUploadFailed:`{name} couldn't be uploaded.`,conversationLoading:`Loading chat…`,loadPreviousMessages:`Load previous messages`,close:`Close`,collapse:`Collapse`,collapseSidebar:`Collapse sidebar`,composerPlaceholder:`Type a message…`,dateLastWeek:`Last 7 days`,dateOlder:`Older`,dateToday:`Today`,dateYesterday:`Yesterday`,dropZone:`Drop files to attach`,dropZoneRejected:`These files can't be attached here`,errorGeneric:`Something went wrong`,errorRateLimited:`Too many requests — please try again in a moment.`,errorRateLimitedIn:`Too many requests — please try again in {seconds} s.`,errorOffline:`Can't reach the server. Check your connection and try again.`,errorServer:`Something went wrong on our side. Please try again.`,errorOriginNotAllowed:`This chat isn't set up for this website yet.`,errorMessageTooLong:`That message is too long. Shorten it and send it again.`,errorReconnecting:`Connection lost. Reconnecting…`,errorRetry:`Retry`,expand:`Expand`,expandSidebar:`Expand sidebar`,exitFullscreen:`Exit fullscreen`,fullscreen:`Fullscreen`,history:`History`,historyBack:`Back to chat`,historyEmpty:`No previous chats yet`,historyLoading:`Loading your chats…`,historyContinue:`Continue the chat`,historyTitle:`Chat history`,loadMoreConversations:`Load more conversations`,language:`Language`,launcherOpen:`Open chat`,launcherAsk:`Ask {name}`,micBlocked:`The microphone is blocked for this site, so voice input can't start.`,micStart:`Start voice input`,micStop:`Stop voice input`,moreActions:`More actions`,newConversation:`New chat`,panelTitle:`Chat`,popOut:`Open in new tab`,resizeHandle:`Drag to resize`,scrollToBottom:`Scroll to latest`,send:`Send`,queueMessage:`Queue message`,removeQueuedMessage:`Remove queued message`,removeAttachment:`Remove {name}`,suggestedReplies:`Suggested replies`,compactingContext:`Optimizing conversation context…`,soundOff:`Sound off`,soundOn:`Sound on`,talkToOperator:`Talk to a person`,connectingOperator:`Connecting you to a person…`,noOperatorAvailable:`No one's available right now — leave your details and we'll follow up.`,chattingWithOperator:`You're chatting with {operator}`,operatorBadgeTitle:`Live chat`,chatNotice:`You're chatting with an AI assistant.`,cancelOperatorRequest:`Keep chatting with the AI`,loginPrompt:`Log in for faster, more personalized support`,loginAction:`Log in`,loginRequired:`Log in to chat with us`,loginExpired:`Your login expired. Log in to continue this chat.`,loginExpiredGuest:`Your login expired. Log in to continue this chat, or start a new conversation as a guest.`,startAsGuest:`Start new conversation`,loggedInAs:`Logged in as {name}`,loggedIn:`Logged in`,dismissLoginPrompt:`Hide`,emailTranscript:`Email transcript`,emailTranscriptPrompt:`Get a copy of this conversation by email.`,emailTranscriptEmailLabel:`Email address`,emailTranscriptSend:`Send transcript`,emailTranscriptSending:`Sending…`,emailTranscriptSent:`Sent to {email}.`,emailTranscriptAlreadySent:`This conversation was already emailed. Send a new message to email it again.`,emailTranscriptLimited:`You've reached the limit for now. Try again later.`,emailTranscriptFailed:`Couldn't send it. Try again.`,emailTranscriptNotDelivered:`Couldn't send to this address. Check it and try again.`,emailTranscriptCancel:`Cancel`,emailTranscriptDone:`Done`,stop:`Stop`,theme:`Theme`,themeAuto:`Auto`,themeDark:`Dark`,themeLight:`Light`,textSize:`Text size`,textSizeSmall:`Small`,textSizeNormal:`Normal`,textSizeLarge:`Large`,loading:`Loading…`,visualPreparing:`Preparing visual…`,visualError:`This visual could not be displayed.`,visualPartial:`Some parts of this visual could not be displayed.`,visualSoldOut:`Sold out`,visualCartEmpty:`Your cart is empty.`,visualQuantity:`Qty`,visualChoose:`Choose`,thinking:`Thinking…`,thought:`Thought`,thoughtFor:`Thought for {time}`,toolResult:`Result`,sources:`Sources`,feedbackUp:`Good response`,feedbackDown:`Bad response`,feedbackThanks:`Thanks for your feedback`,copy:`Copy`,copied:`Copied`,copyTicketReference:`Ticket {reference}, copy`,tabHome:`Home`,tabConversations:`Chats`,tabHelp:`Help`,tabNews:`News`,modulesEmpty:`Nothing here yet`,chatUnavailable:`This chat isn't available right now`,moduleBack:`Back`,contentLoading:`Loading…`,contentHelpful:`Was this helpful?`,homeGreeting:`How can we help?`,homeGreetingNamed:`Hi {name} 👋`,homeGreetingLead:`How can we help?`,homeSearchPlaceholder:`Search for help`,homeAskPlaceholder:`Ask a question…`,homeWhatsNew:`What's new`,homeContentTitle:`Popular articles`,homeStatus:`Status`,helpTitle:`Help`,helpSearchPlaceholder:`Search for help`,helpEmpty:`No help articles yet`,helpLoading:`Loading help…`,helpSearchEmpty:`No results for “{query}”`,helpShowMore:`Show more`,newsTitle:`News`,newsEmpty:`No news yet`,newsLoading:`Loading news…`,newsShowMore:`Show more`,newsUnseen:`New post`,unread:`Unread`,formRequired:`This field is required`,formInvalidEmail:`Enter a valid email address`,formInvalidTel:`Enter a valid phone number`,formInvalidNumber:`Enter a valid number`,formOtherPlaceholder:`Type your answer…`,inputRequired:`Questions for you`,askFallbackQuestion:`Please provide the missing information.`,inputBadge:`Questions`,inputAnswered:`Answered`,inputSkipped:`Skipped`,showOptions:`Show options`,hideOptions:`Hide options`,qtypeText:`Your answer`,qtypeEmail:`Email address`,qtypePhone:`Phone number`,qtypeNumber:`Number`,qtypeDate:`Date`,qtypeChooseOne:`Pick one`,qtypeChooseAny:`Pick any`,qtypeBoolean:`Yes / No`,inputSubmit:`Submit answers`,inputSubmitHint:`Enter to send · Shift+Enter = new line`,inputSkip:`Skip`,confirmYes:`Yes`,confirmNo:`No`,approve:`Approve`,decline:`Decline`,changeAnswer:`Change answer`,approvalPrompt:`{action}?`,approvalEditHint:`You can change your answer until this step continues.`,stepInput:`Input`,stepWorking:`Working`,stepWorkingOnIt:`Working on it…`,stepNeedsYourApproval:`Needs your approval`,stepWaitingForVisitor:`Waiting for the visitor`,stepApproved:`Approved`,stepDeclined:`Declined`,stepReplaced:`Replaced`,stepFailed:`Failed`,stepDidNotWork:`Didn't work`,decidedYouApproved:`You approved`,decidedYouDeclined:`You declined`,decidedVisitorApproved:`Visitor approved`,decidedVisitorDeclined:`Visitor declined`,decidedTeamApproved:`Approved by a team member`,decidedTeamDeclined:`Declined by a team member`,decidedMemberApproved:`Approved by {name}`,decidedMemberDeclined:`Declined by {name}`,stepRawData:`Raw data`,decidedRulesApproved:`Auto-approved`,decidedRulesDeclined:`Auto-declined`,edit:`Edit`,statusError:`Error`,toolStepsFailed:`{count} failed`,statusStopped:`Stopped`,toolStepsStopped:`Stopped after {count} steps`,toolStepsStoppedOne:`Stopped after 1 step`},t=[`decided`,`auto-decided`,`unasked`,`failed`],n=[`platform`,`mcp`,`api`,`webmcp`],r=[`none`,`values`,`table`,`json`,`table-and-json`];function i(e,t){return typeof t==`string`&&e.some(e=>e===t)}const a={visitor:{stepsFrom:n,stepsShown:[],stepDetails:`values`,showStepSystem:!1,showDecidedBy:!1,foldApprovals:!0},member:{stepsFrom:n,stepsShown:t,stepDetails:`table-and-json`,showStepSystem:!0,showDecidedBy:!0,foldApprovals:!0}},o=[`showStepSystem`,`showDecidedBy`,`foldApprovals`];function s(e){let a={};if(typeof e!=`object`||!e)return a;for(let t of o){let n=Reflect.get(e,t);typeof n==`boolean`&&(a[t]=n)}let s=Reflect.get(e,`stepsFrom`);Array.isArray(s)&&(a.stepsFrom=n.filter(e=>s.includes(e)));let c=Reflect.get(e,`stepsShown`);Array.isArray(c)&&(a.stepsShown=t.filter(e=>c.includes(e)));let l=Reflect.get(e,`stepDetails`);return i(r,l)&&(a.stepDetails=l),a}function c(e,t){return{...a[t],...e}}const l=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function u(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).trim().toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function d(e){if(e.title)return e.title;let t=e.toolName.replace(/^tool[:-]/,``),n=t.indexOf(`__`);return u(n>0?t.slice(n+2):t)}function f(e,t,n){let r=e.approval;return r?.replacedByMessageId?`replaced`:e.state===`output-available`?n.error===void 0?`done`:`failed`:e.state===`output-error`?t.interrupted?`stopped`:`failed`:e.state===`output-denied`||r?.approved===!1?`declined`:e.state===`approval-responded`||r?.approved===!0?t.cutOff?`stopped`:`approved`:e.state===`approval-requested`?t.submitted?`submitted`:t.cutOff?`stopped`:t.superseded?`replaced`:`waiting`:t.live?`running`:`stopped`}function p(e,t){if(e.isAutomatic)return`rules`;let n=e.respondedBy;return n?.visitorId?`visitor`:n?.userId?n.userId===t.userId?`you`:`teamMember`:t.decides?`you`:`visitor`}function m(e,t,n,r,i){if(i)return{label:r[t?`inputAnswered`:`inputSkipped`],title:r[t?`inputAnswered`:`inputSkipped`]};let a=r[t?`stepApproved`:`stepDeclined`];if(e===`teamMember`&&n)return{label:a,title:r[t?`decidedMemberApproved`:`decidedMemberDeclined`].replace(`{name}`,n)};let o=r[h[e][+!t]];return e===`you`?{label:a,title:o}:{label:o,title:o}}const h={you:[`decidedYouApproved`,`decidedYouDeclined`],visitor:[`decidedVisitorApproved`,`decidedVisitorDeclined`],teamMember:[`decidedTeamApproved`,`decidedTeamDeclined`],rules:[`decidedRulesApproved`,`decidedRulesDeclined`]};function g(e,t){switch(e){case`running`:return t.strings.stepWorking;case`waiting`:return t.reader.decides?t.strings.stepNeedsYourApproval:t.strings.stepWaitingForVisitor;case`submitted`:return t.strings.stepWorkingOnIt;case`approved`:return t.strings.stepApproved;case`declined`:return t.card?t.strings.inputSkipped:t.strings.stepDeclined;case`replaced`:return t.card?t.strings.inputSkipped:t.strings.stepReplaced;case`stopped`:return t.strings.statusStopped;case`failed`:return t.display.stepDetails===`none`||t.display.stepDetails===`values`?t.strings.stepDidNotWork:t.strings.stepFailed;case`done`:return``;default:return e}}function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function v(e){return typeof e==`string`?e.trim():typeof e==`number`||typeof e==`boolean`?String(e):``}function y(e){return v(e)||(typeof e==`object`&&e?JSON.stringify(e):``)}function b(e){if(!_(e))return y(e);let[t,...n]=Object.values(e).map(y).filter(Boolean);return t===void 0?``:n.length>0?`${t} (${n.join(`, `)})`:t}function x(e,t){if(!_(e))return[];let n=[];function r(e,i){if(Array.isArray(e)){let t=e.map(b).filter(Boolean).join(`, `);t&&n.push({path:i,value:t});return}if(_(e)){for(let[t,n]of Object.entries(e))r(n,[...i,t]);return}let a=v(e);a&&(t.withIds||!l.test(a))&&n.push({path:i,value:a})}r(e,[]);let i=n.map(({path:e})=>u(e.at(-1)??``));return n.map(({path:e,value:t},n)=>{let r=i[n]??``;return{label:i.filter(e=>e===r).length>1&&e.length>1?`${u(e.at(-2)??``)} · ${r.toLowerCase()}`:r,value:t}})}function S(e,t){if(_(e))return Object.entries(e).find(e=>e[0]!==t&&typeof e[1]==`string`&&e[1].trim().length>0&&!l.test(e[1].trim()))?.[1].trim()}function C(e){if(typeof e.toolMetadata?.system==`string`)return e.toolMetadata.system;let t=e.toolMetadata?.systemField,n=typeof t==`string`&&_(e.input)?e.input[t]:void 0;return typeof n==`string`&&n.trim()?n.trim():void 0}function w(e,t=1/0){if(e==null)return;let n=typeof e==`string`?e:JSON.stringify(e,null,2);if(n&&n!==`{}`&&n!==`[]`&&n!==`""`)return n.length>t?`${n.slice(0,t)}…`:n}function T(e){let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return e;try{return JSON.parse(t)}catch{return e}}function E(e){if(_(e)&&e.storage===`tool-result-ref`&&`summary`in e)return E(e.summary);if(_(e)&&Array.isArray(e.content)){let t=e.content.flatMap(e=>_(e)&&typeof e.text==`string`?[e.text]:[]).join(`
2
+ `),n=_(e.structuredContent)?e.structuredContent:T(t);return e.isError===!0?{value:n,error:_(n)&&typeof n.error==`string`?n.error:t}:{value:n}}return _(e)&&typeof e.error==`string`&&typeof e.instruction==`string`?{value:e,error:e.error}:{value:e}}function D(e){return w(e.input)!==void 0||w(e.output)!==void 0||!!e.errorText}function O(e,t){let n=e.approval?`decided`:`unasked`,r=e.approval?.isAutomatic?`auto-decided`:n;return t===`failed`?[r,`failed`]:[r]}function k(e){let t=e.toolMetadata?.origin;return i(n,t)?t:void 0}function A(e,t,n){let{display:r}=n,i=e.approval,a=i!==void 0&&!i.isAutomatic;if(a&&j(e,n.turn))return`card`;let o=n.by===`you`||a&&n.by===void 0&&n.reader.decides,s=k(e),c=(s===void 0||r.stepsFrom.includes(s))&&O(e,t.status).some(e=>r.stepsShown.includes(e));return!(o||c)||!i&&!D(e)?`hidden`:a&&!r.foldApprovals?`card`:`step`}function j(e,t){return e.approval?.replacedByMessageId||(t.superseded||t.cutOff)&&e.approval?.approved===void 0?!1:e.state===`approval-requested`||e.state===`approval-responded`}function M(e,t){let{turn:n,reader:r,display:i,strings:a}=t,o=E(e.output),s=f(e,n,o),c=e.approval,l=c?.replacedByMessageId?void 0:c?.approved,u=c&&l!==void 0?p(c,r):void 0,h=u===`teamMember`?c?.respondedBy?.userId:void 0,_=u&&l!==void 0&&(u===`you`||u===`rules`||i.showDecidedBy)?{approved:l,by:u,...m(u,l,h&&t.names?.get(h),a,typeof e.toolMetadata?.card==`string`),...h?{userId:h}:{}}:void 0,v=d(e),y=i.showStepSystem||e.toolMetadata?.nameShared===!0?C(e):void 0,b=S(e.input,typeof e.toolMetadata?.systemField==`string`?e.toolMetadata.systemField:void 0),T=e.errorText??o.error,D=i.stepDetails===`table`||i.stepDetails===`table-and-json`,O=D&&o.error===void 0?x(o.value,{withIds:!0}):[],k=i.stepDetails===`json`||i.stepDetails===`table-and-json`?{input:w(e.input),output:w(o.value,4e3)}:void 0,M=c!==void 0&&!c.isAutomatic&&!e.toolMetadata?.card,P=c!==void 0&&!c.isAutomatic&&j(e,n),F=i.stepDetails===`none`&&!P?[]:x(e.input,{withIds:D||P}),I=T!==void 0&&T!==``&&i.stepDetails!==`none`&&i.stepDetails!==`values`,L=_?.by===`rules`&&i.stepDetails!==`none`?c?.reason:void 0,R={toolCallId:e.toolCallId,placement:`hidden`,...typeof e.toolMetadata?.card==`string`&&c?{card:e.toolMetadata.card}:{},name:v,...y?{system:y}:{},status:s,statusLabel:g(s,{reader:r,display:i,strings:a,card:typeof e.toolMetadata?.card==`string`}),..._?{decision:_}:{},...L?{reason:L}:{},...b?{summary:b}:{},fields:F,tables:D,...O.length>0?{resultFields:O}:{},...I?{error:T}:{},...k?{raw:k}:{},opens:F.length>0||O.length>0||k!==void 0||I||L!==void 0,...M?{approval:N(e,s,{turn:n,reader:r,strings:a,name:v})}:{}};return{...R,placement:A(e,R,{turn:n,reader:r,display:i,by:u})}}function N(e,t,n){let r=n.strings.approvalPrompt.replace(`{action}`,n.name);return t===`waiting`?{ask:r,buttons:n.reader.decides?`decide`:`none`}:t===`submitted`||!j(e,n.turn)?{ask:r,buttons:`none`}:n.turn.canAct&&n.reader.decides?{ask:r,buttons:`change`,note:n.strings.approvalEditHint}:t===`approved`?{ask:r,buttons:`none`,note:n.strings.stepWorkingOnIt}:{ask:r,buttons:`none`}}function P(e){let t=/* @__PURE__ */ new Map;for(let n of e)t.set(n.name,(t.get(n.name)??0)+1);let n=/* @__PURE__ */ new Map;for(let{decision:t}of e){if(!t)continue;let e=n.get(t.title)??{approved:t.approved,label:t.label,title:t.title,...t.userId?{userId:t.userId}:{},count:0};n.set(t.title,{...e,count:e.count+1})}let[r]=e,i=e.some(e=>e.status===`stopped`);return{tools:[...t].map(([e,t])=>({name:e,count:t})),...e.length===1&&r?{single:{name:r.name,...r.system?{system:r.system}:{},...r.summary?{summary:r.summary}:{},...F(r)}}:{},marks:[...n.values()].map(({count:e,...t})=>Object.assign(t,{label:e>1?`${t.label} ×${e}`:t.label})),failed:e.filter(e=>e.status===`failed`).length,...i?{stopped:{finished:e.filter(e=>e.status!==`stopped`).length}}:{}}}function F(e){return!e.decision&&(e.status===`replaced`||e.status===`declined`)?{outcome:e.statusLabel}:{}}function I(e,t){return e===0?t.statusStopped:e===1?t.toolStepsStoppedOne:t.toolStepsStopped.replace(`{count}`,String(e))}const L=e;export{r as STEP_DETAILS,a as STEP_DISPLAY_DEFAULTS,o as STEP_DISPLAY_SWITCHES,t as STEP_KINDS,n as STEP_ORIGINS,L as STEP_STRINGS_EN,u as nameInWords,w as rawText,s as readStepDisplay,c as resolveStepDisplay,M as stepCallView,x as stepFields,P as stepGroupLine,O as stepKinds,d as stepName,k as stepOrigin,E as stepResult,I as stoppedLineLabel};
3
3
  //# sourceMappingURL=step-display.mjs.map
@@ -474,6 +474,23 @@ interface PresentationOptions {
474
474
  type PageToolCallStatus = 'completed' | 'failed' | 'interrupted';
475
475
  /** A 👍/👎 reaction on a rateable (assistant/operator) message; `null` clears a prior choice. */
476
476
  type FeedbackValue = 'up' | 'down' | null;
477
+ /**
478
+ * The kinds of steps a reader may choose to see, folded into one line under the reply: `decided`, it asked a person
479
+ * (a visitor or another member); `auto-decided`, the rules decided it; `unasked`, it ran without asking; `failed`, it
480
+ * failed, whoever decided it. A step has every kind that applies ("auto-decided" and "failed" both, for an approved
481
+ * call that then failed) and shows when any of them is chosen. The reader's own decisions and anything waiting on
482
+ * someone always show.
483
+ */
484
+ declare const STEP_KINDS: readonly ['decided', 'auto-decided', 'unasked', 'failed'];
485
+ type StepKind = (typeof STEP_KINDS)[number];
486
+ /**
487
+ * Where a step came from, as the server marks every call (`toolMetadata.origin`), set once where each family of tools
488
+ * is built: `platform`, help.ai's own tools; `mcp`, an MCP server's (an integration, help.ai's own MCP included);
489
+ * `api`, a call to an API integration; `webmcp`, the page's own tools, run in the visitor's browser (those the site
490
+ * hands the widget and those the browser offers through WebMCP).
491
+ */
492
+ declare const STEP_ORIGINS: readonly ['platform', 'mcp', 'api', 'webmcp'];
493
+ type StepOrigin = (typeof STEP_ORIGINS)[number];
477
494
  /**
478
495
  * What an opened step shows: `none`, nothing (the step line alone, for a business that never shows a visitor's data
479
496
  * back); `values`, its values as quiet label and value lines without ids; `table`, tables of what it ran on (ids
@@ -484,13 +501,15 @@ declare const STEP_DETAILS: readonly ['none', 'values', 'table', 'json', 'table-
484
501
  type StepDetails = (typeof STEP_DETAILS)[number];
485
502
  /** The settings, the same keys on a Deployment (`config.behavior.stepDisplay`) and in a member's Preferences. */
486
503
  interface StepDisplay {
487
- /** Every step appears as one folded line under the reply; off, only the steps that involve the reader do. */
488
- showSteps: boolean;
504
+ /** The origins whose steps may appear (`STEP_ORIGINS`), in any combination. */
505
+ stepsFrom: readonly StepOrigin[];
506
+ /** The kinds of steps that appear (`STEP_KINDS`), in any combination: a step from a chosen origin shows when any of its kinds is chosen. */
507
+ stepsShown: readonly StepKind[];
489
508
  /** What an opened step shows (`STEP_DETAILS`). */
490
509
  stepDetails: StepDetails;
491
510
  /** The system that ran a step follows its name: "Ship an order · BC Co. back office". */
492
511
  showStepSystem: boolean;
493
- /** Each approval says who decided it, and steps the rules decided show as steps. */
512
+ /** Each decision someone else or the rules made says who made it. */
494
513
  showDecidedBy: boolean;
495
514
  /** A decided approval folds into the steps line; off, it stays in the reply as a card. */
496
515
  foldApprovals: boolean;
@@ -506,7 +525,7 @@ interface BehaviorOptions {
506
525
  responseMode?: ResponseMode;
507
526
  /** Show the model's reasoning ("thoughts") as a collapsible block. Default `false`. */
508
527
  showReasoning?: boolean;
509
- /** How the AI's steps and approvals show; unset keys take the Simple preset. */
528
+ /** How the AI's steps and approvals show; unset keys take the visitor defaults. */
510
529
  stepDisplay?: Partial<StepDisplay>;
511
530
  /** Show citation sources (web links + document references) in the transcript. Default `false`. */
512
531
  showSources?: boolean;
@@ -868,8 +887,7 @@ interface ChatWidgetOptions {
868
887
  }
869
888
  /** `true` for any string other than the literal `"false"`. Useful for boolean attrs. */
870
889
  declare function boolAttr(v: string): boolean;
871
- /** A preset's name (`simple`, `technical`) → its five step settings; any other value leaves the Deployment's. */
872
- /** A preset's name (`technical`), or the settings as JSON (`{"stepDetails":"table"}`): known keys of the right kind only. */
890
+ /** The settings as JSON (`{"stepsShown":["failed"],"stepDetails":"table"}`): known keys of the right kind only. */
873
891
  declare function stepDisplayAttr(v: string): Partial<StepDisplay> | undefined;
874
892
  /** A whole number of seconds, 0 or more; anything else is left unset so the default applies. */
875
893
  declare function secondsAttr(v: string): number | undefined;
@@ -957,7 +975,18 @@ declare const handshakeResponseSchema: z.ZodObject<{
957
975
  }>>;
958
976
  showReasoning: z.ZodDefault<z.ZodBoolean>;
959
977
  stepDisplay: z.ZodOptional<z.ZodObject<{
960
- showSteps: z.ZodOptional<z.ZodBoolean>;
978
+ stepsFrom: z.ZodOptional<z.ZodArray<z.ZodEnum<{
979
+ api: "api";
980
+ mcp: "mcp";
981
+ platform: "platform";
982
+ webmcp: "webmcp";
983
+ }>>>;
984
+ stepsShown: z.ZodOptional<z.ZodArray<z.ZodEnum<{
985
+ "auto-decided": "auto-decided";
986
+ decided: "decided";
987
+ failed: "failed";
988
+ unasked: "unasked";
989
+ }>>>;
961
990
  stepDetails: z.ZodOptional<z.ZodEnum<{
962
991
  json: "json";
963
992
  none: "none";