@helpai/elements 6.8.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.d.ts CHANGED
@@ -38,53 +38,74 @@ interface ToolApproval {
38
38
  */
39
39
  type ToolState = 'input-streaming' | 'input-available' | 'approval-requested' | 'approval-responded' | 'output-available' | 'output-error' | 'output-denied';
40
40
  /**
41
- * What an opened step shows: `values`, its values as quiet label and value lines without ids; `table`, tables of what
42
- * it ran on (ids included) and what came back; `json`, its raw input and result; `table-and-json`, the tables with
43
- * the JSON folded under Raw data.
41
+ * The kinds of steps a reader may choose to see, folded into one line under the reply: `decided`, it asked a person
42
+ * (a visitor or another member); `auto-decided`, the rules decided it; `unasked`, it ran without asking; `failed`, it
43
+ * failed, whoever decided it. A step has every kind that applies ("auto-decided" and "failed" both, for an approved
44
+ * call that then failed) and shows when any of them is chosen. The reader's own decisions and anything waiting on
45
+ * someone always show.
44
46
  */
45
- export declare const STEP_DETAILS: readonly ['values', 'table', 'json', 'table-and-json'];
47
+ export declare const STEP_KINDS: readonly ['decided', 'auto-decided', 'unasked', 'failed'];
48
+ export type StepKind = (typeof STEP_KINDS)[number];
49
+ /**
50
+ * Where a step came from, as the server marks every call (`toolMetadata.origin`), set once where each family of tools
51
+ * is built: `platform`, help.ai's own tools; `mcp`, an MCP server's (an integration, help.ai's own MCP included);
52
+ * `api`, a call to an API integration; `webmcp`, the page's own tools, run in the visitor's browser (those the site
53
+ * hands the widget and those the browser offers through WebMCP).
54
+ */
55
+ export declare const STEP_ORIGINS: readonly ['platform', 'mcp', 'api', 'webmcp'];
56
+ export type StepOrigin = (typeof STEP_ORIGINS)[number];
57
+ /**
58
+ * What an opened step shows: `none`, nothing (the step line alone, for a business that never shows a visitor's data
59
+ * back); `values`, its values as quiet label and value lines without ids; `table`, tables of what it ran on (ids
60
+ * included) and what came back; `json`, its raw input and result; `table-and-json`, the tables with the JSON folded
61
+ * under Raw data. A step waiting on a decision shows its values whatever this says.
62
+ */
63
+ export declare const STEP_DETAILS: readonly ['none', 'values', 'table', 'json', 'table-and-json'];
46
64
  export type StepDetails = (typeof STEP_DETAILS)[number];
47
- export declare function isStepDetails(value: unknown): value is StepDetails;
48
65
  /** The settings, the same keys on a Deployment (`config.behavior.stepDisplay`) and in a member's Preferences. */
49
66
  export interface StepDisplay {
50
- /** Every step appears as one folded line under the reply; off, only the steps that involve the reader do. */
51
- showSteps: boolean;
67
+ /** The origins whose steps may appear (`STEP_ORIGINS`), in any combination. */
68
+ stepsFrom: readonly StepOrigin[];
69
+ /** 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. */
70
+ stepsShown: readonly StepKind[];
52
71
  /** What an opened step shows (`STEP_DETAILS`). */
53
72
  stepDetails: StepDetails;
54
73
  /** The system that ran a step follows its name: "Ship an order · BC Co. back office". */
55
74
  showStepSystem: boolean;
56
- /** Each approval says who decided it, and steps the rules decided show as steps. */
75
+ /** Each decision someone else or the rules made says who made it. */
57
76
  showDecidedBy: boolean;
58
77
  /** A decided approval folds into the steps line; off, it stays in the reply as a card. */
59
78
  foldApprovals: boolean;
60
79
  }
61
- export declare const STEP_DISPLAY_PRESETS: {
62
- readonly simple: {
63
- readonly showSteps: false;
80
+ /**
81
+ * Each audience's settings where nothing is stored: a visitor sees only their own decisions, as plain values; a member
82
+ * sees every step from everywhere, with tables and the raw JSON, which system ran it and who decided.
83
+ */
84
+ export declare const STEP_DISPLAY_DEFAULTS: {
85
+ readonly visitor: {
86
+ readonly stepsFrom: readonly ["platform", "mcp", "api", "webmcp"];
87
+ readonly stepsShown: readonly [];
64
88
  readonly stepDetails: 'values';
65
89
  readonly showStepSystem: false;
66
90
  readonly showDecidedBy: false;
67
91
  readonly foldApprovals: true;
68
92
  };
69
- readonly technical: {
70
- readonly showSteps: true;
93
+ readonly member: {
94
+ readonly stepsFrom: readonly ["platform", "mcp", "api", "webmcp"];
95
+ readonly stepsShown: readonly ["decided", "auto-decided", "unasked", "failed"];
71
96
  readonly stepDetails: 'table-and-json';
72
97
  readonly showStepSystem: true;
73
98
  readonly showDecidedBy: true;
74
99
  readonly foldApprovals: true;
75
100
  };
76
101
  };
77
- export type StepDisplayPreset = keyof typeof STEP_DISPLAY_PRESETS;
78
- /** The on/off settings; `stepDetails` is the one choice. */
79
- export declare const STEP_DISPLAY_SWITCHES: readonly ["showSteps", "showStepSystem", "showDecidedBy", "foldApprovals"];
80
- export declare const STEP_DISPLAY_KEYS: readonly ["showSteps", "showStepSystem", "showDecidedBy", "foldApprovals", "stepDetails"];
102
+ export type StepDisplayAudience = keyof typeof STEP_DISPLAY_DEFAULTS;
103
+ /** The on/off settings; `stepsFrom`, `stepsShown` and `stepDetails` are the choices. */
104
+ export declare const STEP_DISPLAY_SWITCHES: readonly ["showStepSystem", "showDecidedBy", "foldApprovals"];
81
105
  /** The settings found in an untyped stored bag (a member's preferences, a host's attribute): known keys of the right kind only. */
82
106
  export declare function readStepDisplay(stored: unknown): Partial<StepDisplay>;
83
- export declare function isStepDisplayPreset(name: string): name is StepDisplayPreset;
84
- /** The settings a surface uses: what was stored over its default preset, so a partial or absent setting reads whole. */
85
- export declare function resolveStepDisplay(stored: Partial<StepDisplay> | undefined, preset: StepDisplayPreset): StepDisplay;
86
- /** The preset these settings match, for the editor's preset picker; none is a custom mix. */
87
- export declare function matchStepDisplayPreset(display: StepDisplay): StepDisplayPreset | undefined;
107
+ /** The settings a surface uses: what was stored over its audience's defaults, so a partial or absent setting reads whole. */
108
+ export declare function resolveStepDisplay(stored: Partial<StepDisplay> | undefined, audience: StepDisplayAudience): StepDisplay;
88
109
  /** Who made an approval's decision, as the stored approval records it. The visitor's own view never carries it. */
89
110
  export interface StepApproval extends ToolApproval {
90
111
  respondedBy?: {
@@ -105,9 +126,9 @@ export interface StepCall {
105
126
  errorText?: string;
106
127
  approval?: StepApproval;
107
128
  /**
108
- * The server's marks: `system` (who ran it), `systemField` (the input field that names who runs each call, such as
109
- * the integration an API call signs in with), `nameShared` (another integration offers an action of this name),
110
- * `card` (a card of its own), `execution: "client"` (a page tool).
129
+ * The server's marks: `origin` (`STEP_ORIGINS`), `system` (who ran it), `systemField` (the input field that names
130
+ * who runs each call, such as the integration an API call signs in with), `nameShared` (another integration offers
131
+ * an action of this name), `card` (it asks for input on a card of its own), `execution: "client"` (the browser runs it).
111
132
  */
112
133
  toolMetadata?: Record<string, unknown>;
113
134
  }
@@ -172,6 +193,8 @@ export interface StepCallView {
172
193
  fields: StepField[];
173
194
  /** Step details Table or Table and JSON: the values read as tables; otherwise as quiet lines. */
174
195
  tables: boolean;
196
+ /** Whether the step has anything to open to: false with step details `none` (unless a person decides), or nothing to show. */
197
+ opens: boolean;
175
198
  /** What came back, in labelled lines, with tables: the result read through its envelope. */
176
199
  resultFields?: StepField[];
177
200
  /** Why it failed, in the words the tool or its server gave. */
@@ -188,7 +211,7 @@ export interface StepCallView {
188
211
  note?: string;
189
212
  };
190
213
  }
191
- export type StepStringKey = 'approvalPrompt' | 'approvalEditHint' | 'stepWorking' | 'stepWorkingOnIt' | 'stepNeedsYourApproval' | 'stepWaitingForVisitor' | 'stepApproved' | 'stepDeclined' | 'stepReplaced' | 'stepFailed' | 'stepDidNotWork' | 'statusStopped' | 'decidedYouApproved' | 'decidedYouDeclined' | 'decidedVisitorApproved' | 'decidedVisitorDeclined' | 'decidedTeamApproved' | 'decidedTeamDeclined' | 'decidedMemberApproved' | 'decidedMemberDeclined' | 'stepRawData' | 'decidedRulesApproved' | 'decidedRulesDeclined' | 'toolStepsFailed' | 'toolStepsStopped' | 'toolStepsStoppedOne';
214
+ export type StepStringKey = 'approvalPrompt' | 'approvalEditHint' | 'stepWorking' | 'stepWorkingOnIt' | 'stepNeedsYourApproval' | 'stepWaitingForVisitor' | 'stepApproved' | 'stepDeclined' | 'stepReplaced' | 'inputSkipped' | 'inputAnswered' | 'stepFailed' | 'stepDidNotWork' | 'statusStopped' | 'decidedYouApproved' | 'decidedYouDeclined' | 'decidedVisitorApproved' | 'decidedVisitorDeclined' | 'decidedTeamApproved' | 'decidedTeamDeclined' | 'decidedMemberApproved' | 'decidedMemberDeclined' | 'stepRawData' | 'decidedRulesApproved' | 'decidedRulesDeclined' | 'toolStepsFailed' | 'toolStepsStopped' | 'toolStepsStoppedOne';
192
215
  export type StepStrings = Pick<Strings, StepStringKey>;
193
216
  /** `place_order` / `getIssue` / `list-repos` → "Place order" / "Get issue" / "List repos". */
194
217
  export declare function nameInWords(name: string): string;
@@ -216,6 +239,10 @@ interface StepResult {
216
239
  * as failed with its `error`. The model-facing `instruction` is never a reader's to see.
217
240
  */
218
241
  export declare function stepResult(output: unknown): StepResult;
242
+ /** Every kind a settled call has, for Steps shown: who decided it, and failed when it failed. */
243
+ export declare function stepKinds(call: Pick<StepCall, 'approval'>, status: StepStatus): StepKind[];
244
+ /** The call's origin as the server marked it; a call stored before calls carried one has none. */
245
+ export declare function stepOrigin(call: Pick<StepCall, 'toolMetadata'>): StepOrigin | undefined;
219
246
  /** Everything a surface draws for one call, under the given settings. */
220
247
  export declare function stepCallView(call: StepCall, ctx: {
221
248
  turn: StepTurn;
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=[`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===`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={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}:{},...g?.by===`rules`&&c?.reason?{reason:c.reason}:{},...b?{summary:b}:{},fields:S(e.input,{withIds:E||c!==void 0&&!c.isAutomatic&&A(e,n)}),tables:E,...O.length>0?{resultFields:O}:{},...x&&i.stepDetails!==`values`?{error:x}:{},...j?{raw:j}:{},...N?{approval:M(e,s,{turn:n,reader:r,strings:a,name:v})}:{}};return{...P,placement:k(e,P,{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
@@ -475,21 +475,41 @@ 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
477
  /**
478
- * What an opened step shows: `values`, its values as quiet label and value lines without ids; `table`, tables of what
479
- * it ran on (ids included) and what came back; `json`, its raw input and result; `table-and-json`, the tables with
480
- * the JSON folded under Raw data.
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.
481
483
  */
482
- declare const STEP_DETAILS: readonly ['values', 'table', 'json', 'table-and-json'];
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];
494
+ /**
495
+ * What an opened step shows: `none`, nothing (the step line alone, for a business that never shows a visitor's data
496
+ * back); `values`, its values as quiet label and value lines without ids; `table`, tables of what it ran on (ids
497
+ * included) and what came back; `json`, its raw input and result; `table-and-json`, the tables with the JSON folded
498
+ * under Raw data. A step waiting on a decision shows its values whatever this says.
499
+ */
500
+ declare const STEP_DETAILS: readonly ['none', 'values', 'table', 'json', 'table-and-json'];
483
501
  type StepDetails = (typeof STEP_DETAILS)[number];
484
502
  /** The settings, the same keys on a Deployment (`config.behavior.stepDisplay`) and in a member's Preferences. */
485
503
  interface StepDisplay {
486
- /** Every step appears as one folded line under the reply; off, only the steps that involve the reader do. */
487
- 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[];
488
508
  /** What an opened step shows (`STEP_DETAILS`). */
489
509
  stepDetails: StepDetails;
490
510
  /** The system that ran a step follows its name: "Ship an order · BC Co. back office". */
491
511
  showStepSystem: boolean;
492
- /** 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. */
493
513
  showDecidedBy: boolean;
494
514
  /** A decided approval folds into the steps line; off, it stays in the reply as a card. */
495
515
  foldApprovals: boolean;
@@ -505,7 +525,7 @@ interface BehaviorOptions {
505
525
  responseMode?: ResponseMode;
506
526
  /** Show the model's reasoning ("thoughts") as a collapsible block. Default `false`. */
507
527
  showReasoning?: boolean;
508
- /** 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. */
509
529
  stepDisplay?: Partial<StepDisplay>;
510
530
  /** Show citation sources (web links + document references) in the transcript. Default `false`. */
511
531
  showSources?: boolean;
@@ -867,8 +887,7 @@ interface ChatWidgetOptions {
867
887
  }
868
888
  /** `true` for any string other than the literal `"false"`. Useful for boolean attrs. */
869
889
  declare function boolAttr(v: string): boolean;
870
- /** A preset's name (`simple`, `technical`) → its five step settings; any other value leaves the Deployment's. */
871
- /** 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. */
872
891
  declare function stepDisplayAttr(v: string): Partial<StepDisplay> | undefined;
873
892
  /** A whole number of seconds, 0 or more; anything else is left unset so the default applies. */
874
893
  declare function secondsAttr(v: string): number | undefined;
@@ -956,9 +975,21 @@ declare const handshakeResponseSchema: z.ZodObject<{
956
975
  }>>;
957
976
  showReasoning: z.ZodDefault<z.ZodBoolean>;
958
977
  stepDisplay: z.ZodOptional<z.ZodObject<{
959
- 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
+ }>>>;
960
990
  stepDetails: z.ZodOptional<z.ZodEnum<{
961
991
  json: "json";
992
+ none: "none";
962
993
  table: "table";
963
994
  "table-and-json": "table-and-json";
964
995
  values: "values";