@helpai/elements 6.5.1 → 6.6.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/elements-web-component.esm.js +28 -27
- package/elements-web-component.esm.js.map +3 -3
- package/elements.cjs.js +28 -27
- package/elements.cjs.js.map +3 -3
- package/elements.esm.js +28 -27
- package/elements.esm.js.map +3 -3
- package/elements.js +28 -27
- package/elements.js.map +3 -3
- package/index.d.ts +1 -1
- package/index.mjs +20 -19
- package/llms-full.txt +140 -140
- package/llms.txt +19 -19
- package/package.json +1 -1
- package/react.d.ts +1 -1
- package/react.mjs +37 -36
- package/step-display.d.ts +31 -7
- package/step-display.mjs +2 -1
- package/style.css +1 -1
- package/web-component.d.ts +1 -1
- package/web-component.mjs +20 -19
package/step-display.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* widget (the dashboard's AI Chat, AI Agent Chat and Inbox). They draw the same views the widget draws, from the same
|
|
4
4
|
* settings and words, so the two never decide differently (docs/features/step-display.md). Framework-free.
|
|
5
5
|
*/
|
|
6
|
-
type StringKey = 'launcherOpen' | 'launcherAsk' | 'panelTitle' | 'composerPlaceholder' | 'send' | 'stop' | 'queueMessage' | 'removeQueuedMessage' | 'removeAttachment' | 'suggestedReplies' | 'compactingContext' | 'attach' | 'file' | 'micBlocked' | 'micStart' | 'micStop' | 'expand' | 'collapse' | 'fullscreen' | 'exitFullscreen' | 'popOut' | 'resizeHandle' | 'scrollToBottom' | 'close' | 'moreActions' | 'soundOn' | 'soundOff' | 'language' | 'theme' | 'themeAuto' | 'themeLight' | 'themeDark' | 'textSize' | 'textSizeSmall' | 'textSizeNormal' | 'textSizeLarge' | 'history' | 'historyTitle' | 'historyEmpty' | 'historyLoading' | 'historyBack' | 'historyContinue' | 'loadMoreConversations' | 'conversationLoading' | 'loadPreviousMessages' | 'talkToOperator' | 'connectingOperator' | 'noOperatorAvailable' | 'chattingWithOperator' | 'operatorBadgeTitle' | 'chatNotice' | 'cancelOperatorRequest' | 'loginPrompt' | 'loginAction' | 'loginRequired' | 'loginExpired' | 'loginExpiredGuest' | 'startAsGuest' | 'loggedInAs' | 'loggedIn' | 'dismissLoginPrompt' | 'emailTranscript' | 'emailTranscriptPrompt' | 'emailTranscriptEmailLabel' | 'emailTranscriptSend' | 'emailTranscriptSending' | 'emailTranscriptSent' | 'emailTranscriptAlreadySent' | 'emailTranscriptLimited' | 'emailTranscriptFailed' | 'emailTranscriptNotDelivered' | 'emailTranscriptCancel' | 'emailTranscriptDone' | 'dateToday' | 'dateYesterday' | 'dateLastWeek' | 'dateOlder' | 'newConversation' | 'dropZone' | 'dropZoneRejected' | 'attachmentTooLarge' | 'poweredBy' | 'attachmentTooMany' | 'attachmentMimeRejected' | 'attachmentUploadFailed' | 'errorRetry' | 'errorGeneric' | 'errorRateLimited' | 'errorRateLimitedIn' | 'errorOffline' | 'errorServer' | 'errorOriginNotAllowed' | 'errorMessageTooLong' | 'errorReconnecting' | 'loading' | 'visualPreparing' | 'visualError' | 'visualPartial' | 'visualSoldOut' | 'visualCartEmpty' | 'visualQuantity' | 'visualChoose' | 'thinking' | 'thought' | 'thoughtFor' | 'toolResult' | 'sources' | 'feedbackUp' | 'feedbackDown' | 'feedbackThanks' | 'copy' | 'copied' | 'copyTicketReference' | 'collapseSidebar' | 'expandSidebar' | 'formRequired' | 'formInvalidEmail' | 'formInvalidTel' | 'formInvalidNumber' | 'formOtherPlaceholder' | 'inputRequired' | 'askFallbackQuestion' | 'inputBadge' | 'inputAnswered' | 'inputSkipped' | 'inputSubmit' | 'inputSubmitHint' | 'inputSkip' | 'showOptions' | 'hideOptions' | 'qtypeText' | 'qtypeEmail' | 'qtypePhone' | 'qtypeNumber' | 'qtypeDate' | 'qtypeChooseOne' | 'qtypeChooseAny' | 'qtypeBoolean' | 'confirmYes' | 'confirmNo' | 'approve' | 'decline' | 'changeAnswer' | 'approvalPrompt' | 'approvalEditHint' | 'stepInput' | 'stepWorking' | 'stepWorkingOnIt' | 'stepNeedsYourApproval' | 'stepWaitingForVisitor' | 'stepApproved' | 'stepDeclined' | 'stepReplaced' | 'stepFailed' | 'stepDidNotWork' | 'decidedYouApproved' | 'decidedYouDeclined' | 'decidedVisitorApproved' | 'decidedVisitorDeclined' | 'decidedTeamApproved' | 'decidedTeamDeclined' | 'decidedRulesApproved' | 'decidedRulesDeclined' | 'edit' | 'statusError' | 'toolStepsFailed' | 'statusStopped' | 'toolStepsStopped' | 'toolStepsStoppedOne' | 'tabHome' | 'tabConversations' | 'tabHelp' | 'tabNews' | 'modulesEmpty' | 'chatUnavailable' | 'moduleBack' | 'contentLoading' | 'contentHelpful' | 'homeGreeting' | 'homeGreetingNamed' | 'homeGreetingLead' | 'homeSearchPlaceholder' | 'homeAskPlaceholder' | 'homeWhatsNew' | 'homeContentTitle' | 'homeStatus' | 'helpTitle' | 'helpSearchPlaceholder' | 'helpEmpty' | 'helpLoading' | 'helpSearchEmpty' | 'helpShowMore' | 'newsTitle' | 'newsEmpty' | 'newsLoading' | 'newsShowMore' | 'newsUnseen' | 'unread';
|
|
6
|
+
type StringKey = 'launcherOpen' | 'launcherAsk' | 'panelTitle' | 'composerPlaceholder' | 'send' | 'stop' | 'queueMessage' | 'removeQueuedMessage' | 'removeAttachment' | 'suggestedReplies' | 'compactingContext' | 'attach' | 'file' | 'micBlocked' | 'micStart' | 'micStop' | 'expand' | 'collapse' | 'fullscreen' | 'exitFullscreen' | 'popOut' | 'resizeHandle' | 'scrollToBottom' | 'close' | 'moreActions' | 'soundOn' | 'soundOff' | 'language' | 'theme' | 'themeAuto' | 'themeLight' | 'themeDark' | 'textSize' | 'textSizeSmall' | 'textSizeNormal' | 'textSizeLarge' | 'history' | 'historyTitle' | 'historyEmpty' | 'historyLoading' | 'historyBack' | 'historyContinue' | 'loadMoreConversations' | 'conversationLoading' | 'loadPreviousMessages' | 'talkToOperator' | 'connectingOperator' | 'noOperatorAvailable' | 'chattingWithOperator' | 'operatorBadgeTitle' | 'chatNotice' | 'cancelOperatorRequest' | 'loginPrompt' | 'loginAction' | 'loginRequired' | 'loginExpired' | 'loginExpiredGuest' | 'startAsGuest' | 'loggedInAs' | 'loggedIn' | 'dismissLoginPrompt' | 'emailTranscript' | 'emailTranscriptPrompt' | 'emailTranscriptEmailLabel' | 'emailTranscriptSend' | 'emailTranscriptSending' | 'emailTranscriptSent' | 'emailTranscriptAlreadySent' | 'emailTranscriptLimited' | 'emailTranscriptFailed' | 'emailTranscriptNotDelivered' | 'emailTranscriptCancel' | 'emailTranscriptDone' | 'dateToday' | 'dateYesterday' | 'dateLastWeek' | 'dateOlder' | 'newConversation' | 'dropZone' | 'dropZoneRejected' | 'attachmentTooLarge' | 'poweredBy' | 'attachmentTooMany' | 'attachmentMimeRejected' | 'attachmentUploadFailed' | 'errorRetry' | 'errorGeneric' | 'errorRateLimited' | 'errorRateLimitedIn' | 'errorOffline' | 'errorServer' | 'errorOriginNotAllowed' | 'errorMessageTooLong' | 'errorReconnecting' | 'loading' | 'visualPreparing' | 'visualError' | 'visualPartial' | 'visualSoldOut' | 'visualCartEmpty' | 'visualQuantity' | 'visualChoose' | 'thinking' | 'thought' | 'thoughtFor' | 'toolResult' | 'sources' | 'feedbackUp' | 'feedbackDown' | 'feedbackThanks' | 'copy' | 'copied' | 'copyTicketReference' | 'collapseSidebar' | 'expandSidebar' | 'formRequired' | 'formInvalidEmail' | 'formInvalidTel' | 'formInvalidNumber' | 'formOtherPlaceholder' | 'inputRequired' | 'askFallbackQuestion' | 'inputBadge' | 'inputAnswered' | 'inputSkipped' | 'inputSubmit' | 'inputSubmitHint' | 'inputSkip' | 'showOptions' | 'hideOptions' | 'qtypeText' | 'qtypeEmail' | 'qtypePhone' | 'qtypeNumber' | 'qtypeDate' | 'qtypeChooseOne' | 'qtypeChooseAny' | 'qtypeBoolean' | 'confirmYes' | 'confirmNo' | 'approve' | 'decline' | 'changeAnswer' | 'approvalPrompt' | 'approvalEditHint' | 'stepInput' | 'stepWorking' | 'stepWorkingOnIt' | 'stepNeedsYourApproval' | 'stepWaitingForVisitor' | 'stepApproved' | 'stepDeclined' | 'stepReplaced' | 'stepFailed' | 'stepDidNotWork' | 'decidedYouApproved' | 'decidedYouDeclined' | 'decidedVisitorApproved' | 'decidedVisitorDeclined' | 'decidedTeamApproved' | 'decidedTeamDeclined' | 'decidedMemberApproved' | 'decidedMemberDeclined' | 'stepRawData' | 'decidedRulesApproved' | 'decidedRulesDeclined' | 'edit' | 'statusError' | 'toolStepsFailed' | 'statusStopped' | 'toolStepsStopped' | 'toolStepsStoppedOne' | 'tabHome' | 'tabConversations' | 'tabHelp' | 'tabNews' | 'modulesEmpty' | 'chatUnavailable' | 'moduleBack' | 'contentLoading' | 'contentHelpful' | 'homeGreeting' | 'homeGreetingNamed' | 'homeGreetingLead' | 'homeSearchPlaceholder' | 'homeAskPlaceholder' | 'homeWhatsNew' | 'homeContentTitle' | 'homeStatus' | 'helpTitle' | 'helpSearchPlaceholder' | 'helpEmpty' | 'helpLoading' | 'helpSearchEmpty' | 'helpShowMore' | 'newsTitle' | 'newsEmpty' | 'newsLoading' | 'newsShowMore' | 'newsUnseen' | 'unread';
|
|
7
7
|
/**
|
|
8
8
|
* The post-resolution map — every key guaranteed present. UI components
|
|
9
9
|
* receive this shape and read it via direct property access (no `t()`).
|
|
@@ -92,7 +92,10 @@ export interface StepCall {
|
|
|
92
92
|
output?: unknown;
|
|
93
93
|
errorText?: string;
|
|
94
94
|
approval?: StepApproval;
|
|
95
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* The server's marks: `system` (who ran it), `nameShared` (another integration offers an action of this name),
|
|
97
|
+
* `card` (a card of its own), `execution: "client"` (a page tool).
|
|
98
|
+
*/
|
|
96
99
|
toolMetadata?: Record<string, unknown>;
|
|
97
100
|
}
|
|
98
101
|
/** Where a call stands in its turn, as only the surface can tell. */
|
|
@@ -120,8 +123,10 @@ export type StepDecider = 'you' | 'visitor' | 'teamMember' | 'rules';
|
|
|
120
123
|
export interface StepDecision {
|
|
121
124
|
approved: boolean;
|
|
122
125
|
by: StepDecider;
|
|
123
|
-
/** "You approved", "Approved by the visitor", "Approved automatically". */
|
|
126
|
+
/** "You approved", "Approved by Sara Kim", "Approved by the visitor", "Approved automatically". */
|
|
124
127
|
label: string;
|
|
128
|
+
/** The team member who decided, when it was someone else: a surface shows who they are (their picture, their email). */
|
|
129
|
+
userId?: string;
|
|
125
130
|
}
|
|
126
131
|
export interface StepField {
|
|
127
132
|
label: string;
|
|
@@ -134,7 +139,7 @@ export interface StepCallView {
|
|
|
134
139
|
/** The call has a card of its own (`questions`): the surface draws that card in place of the generic one. */
|
|
135
140
|
card?: string;
|
|
136
141
|
name: string;
|
|
137
|
-
/** Who ran it, with Show which system on. */
|
|
142
|
+
/** Who ran it, with Show which system on, or always when another integration shares the action's name. */
|
|
138
143
|
system?: string;
|
|
139
144
|
status: StepStatus;
|
|
140
145
|
/** The status in words; empty for a finished step, whose icon says it. */
|
|
@@ -147,11 +152,14 @@ export interface StepCallView {
|
|
|
147
152
|
summary?: string;
|
|
148
153
|
/** What the call does, in labelled lines: every value except ids, which only Show step details adds. */
|
|
149
154
|
fields: StepField[];
|
|
150
|
-
/**
|
|
155
|
+
/** What came back, in labelled lines, with Show step details on: the result read through its envelope. */
|
|
156
|
+
resultFields?: StepField[];
|
|
157
|
+
/** Why it failed, in the words the tool or its server gave. */
|
|
158
|
+
error?: string;
|
|
159
|
+
/** Raw input and result as indented JSON, with Show step details on: the result read through its envelope. */
|
|
151
160
|
raw?: {
|
|
152
161
|
input?: string;
|
|
153
162
|
output?: string;
|
|
154
|
-
error?: string;
|
|
155
163
|
};
|
|
156
164
|
/** The approval card: its question, the buttons it offers and the line under them. */
|
|
157
165
|
approval?: {
|
|
@@ -160,7 +168,7 @@ export interface StepCallView {
|
|
|
160
168
|
note?: string;
|
|
161
169
|
};
|
|
162
170
|
}
|
|
163
|
-
export type StepStringKey = 'approvalPrompt' | 'approvalEditHint' | 'stepWorking' | 'stepWorkingOnIt' | 'stepNeedsYourApproval' | 'stepWaitingForVisitor' | 'stepApproved' | 'stepDeclined' | 'stepReplaced' | 'stepFailed' | 'stepDidNotWork' | 'statusStopped' | 'decidedYouApproved' | 'decidedYouDeclined' | 'decidedVisitorApproved' | 'decidedVisitorDeclined' | 'decidedTeamApproved' | 'decidedTeamDeclined' | 'decidedRulesApproved' | 'decidedRulesDeclined' | 'toolStepsFailed' | 'toolStepsStopped' | 'toolStepsStoppedOne';
|
|
171
|
+
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';
|
|
164
172
|
export type StepStrings = Pick<Strings, StepStringKey>;
|
|
165
173
|
/** `place_order` / `getIssue` / `list-repos` → "Place order" / "Get issue" / "List repos". */
|
|
166
174
|
export declare function nameInWords(name: string): string;
|
|
@@ -176,12 +184,26 @@ export declare function stepFields(input: unknown, opts: {
|
|
|
176
184
|
}): StepField[];
|
|
177
185
|
/** A payload as raw text: indented JSON, a string as it is; nothing for an empty one. */
|
|
178
186
|
export declare function rawText(value: unknown, maxChars?: number): string | undefined;
|
|
187
|
+
/** A result read through its envelope: what came back (a failure's too, for its raw data), and why it failed. */
|
|
188
|
+
interface StepResult {
|
|
189
|
+
value?: unknown;
|
|
190
|
+
error?: string;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* What a result says, read from its shape, never its tool: a large result saved by reference (`{ storage:
|
|
194
|
+
* "tool-result-ref", summary }`) as its summary; an MCP result (`content` parts) as its `structuredContent`, else its
|
|
195
|
+
* text parsed when it holds JSON, and as failed when it says `isError`; help.ai's tool error (`{ error, instruction }`)
|
|
196
|
+
* as failed with its `error`. The model-facing `instruction` is never a reader's to see.
|
|
197
|
+
*/
|
|
198
|
+
export declare function stepResult(output: unknown): StepResult;
|
|
179
199
|
/** Everything a surface draws for one call, under the given settings. */
|
|
180
200
|
export declare function stepCallView(call: StepCall, ctx: {
|
|
181
201
|
turn: StepTurn;
|
|
182
202
|
reader: StepReader;
|
|
183
203
|
display: StepDisplay;
|
|
184
204
|
strings: StepStrings;
|
|
205
|
+
/** Team members' names by user id, where the surface knows them, so a decision names who made it. */
|
|
206
|
+
names?: ReadonlyMap<string, string>;
|
|
185
207
|
}): StepCallView;
|
|
186
208
|
export interface StepGroupLine {
|
|
187
209
|
/** Each action once, in first-seen order, with how often it ran. */
|
|
@@ -192,6 +214,7 @@ export interface StepGroupLine {
|
|
|
192
214
|
/** A group of one call names it with what it ran on, like its row, and how it ended when no decision says it. */
|
|
193
215
|
single?: {
|
|
194
216
|
name: string;
|
|
217
|
+
system?: string;
|
|
195
218
|
summary?: string;
|
|
196
219
|
outcome?: string;
|
|
197
220
|
};
|
|
@@ -199,6 +222,7 @@ export interface StepGroupLine {
|
|
|
199
222
|
marks: Array<{
|
|
200
223
|
approved: boolean;
|
|
201
224
|
label: string;
|
|
225
|
+
userId?: string;
|
|
202
226
|
}>;
|
|
203
227
|
failed: number;
|
|
204
228
|
/** The reply was cut off with a call in progress: how many calls finished first. */
|
package/step-display.mjs
CHANGED
|
@@ -1,2 +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:`Approved by the visitor`,decidedVisitorDeclined:`Declined by the visitor`,decidedTeamApproved:`Approved by a team member`,decidedTeamDeclined:`Declined by a team member`,decidedRulesApproved:`Approved automatically`,decidedRulesDeclined:`Declined automatically`,edit:`Edit`,statusError:`Error`,toolStepsFailed:`{count} failed`,statusStopped:`Stopped`,toolStepsStopped:`Stopped after {count} steps`,toolStepsStoppedOne:`Stopped after 1 step`},t={simple:{showSteps:!1,showStepDetails:!1,showStepSystem:!1,showDecidedBy:!1,foldApprovals:!0},technical:{showSteps:!0,showStepDetails:!0,showStepSystem:!0,showDecidedBy:!0,foldApprovals:!0}},n=[`showSteps`,`showStepDetails`,`showStepSystem`,`showDecidedBy`,`foldApprovals`];function r(e){return Object.hasOwn(t,e)}function i(e,n){return{...t[n],...e}}function a(e){return Object.keys(t).filter(r).find(r=>n.every(n=>t[r][n]===e[n]))}const o=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function s(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 c(e){if(e.title)return e.title;let t=e.toolName.replace(/^tool[:-]/,``),n=t.indexOf(`__`);return s(n>0?t.slice(n+2):t)}function l(e,t){let n=e.approval;return n?.replacedByMessageId?`replaced`:e.state===`output-available`?`done`:e.state===`output-error`?t.interrupted?`stopped`:`failed`:e.state===`output-denied`||n?.approved===!1?`declined`:e.state===`approval-responded`||n?.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 u(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`}const d={you:[`decidedYouApproved`,`decidedYouDeclined`],visitor:[`decidedVisitorApproved`,`decidedVisitorDeclined`],teamMember:[`decidedTeamApproved`,`decidedTeamDeclined`],rules:[`decidedRulesApproved`,`decidedRulesDeclined`]};function f(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.showStepDetails?t.strings.stepFailed:t.strings.stepDidNotWork;case`done`:return``;default:return e}}function p(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function m(e){return typeof e==`string`?e.trim():typeof e==`number`||typeof e==`boolean`?String(e):``}function h(e){return m(e)||(typeof e==`object`&&e?JSON.stringify(e):``)}function g(e){if(!p(e))return h(e);let[t,...n]=Object.values(e).map(h).filter(Boolean);return t===void 0?``:n.length>0?`${t} (${n.join(`, `)})`:t}function _(e,t){if(!p(e))return[];let n=[];function r(e,i){if(Array.isArray(e)){let t=e.map(g).filter(Boolean).join(`, `);t&&n.push({path:i,value:t});return}if(p(e)){for(let[t,n]of Object.entries(e))r(n,[...i,t]);return}let a=m(e);a&&(t.withIds||!o.test(a))&&n.push({path:i,value:a})}r(e,[]);let i=n.map(({path:e})=>s(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?`${s(e.at(-2)??``)} · ${r.toLowerCase()}`:r,value:t}})}function v(e){if(p(e))return Object.values(e).find(e=>typeof e==`string`&&e.trim().length>0&&!o.test(e.trim()))?.trim()}function y(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 b(e){return p(e)&&e.storage===`tool-result-ref`&&`summary`in e?e.summary:e}function x(e){return y(e.input)!==void 0||y(b(e.output))!==void 0||!!e.errorText}function S(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&&C(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&&x(e)?`step`:`hidden`}function C(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 w(e,t){let{turn:n,reader:r,display:i,strings:a}=t,o=l(e,n),s=e.approval,p=s?.replacedByMessageId?void 0:s?.approved,m=s&&p!==void 0?u(s,r):void 0,h=m&&p!==void 0&&(m===`you`||i.showDecidedBy)?{approved:p,by:m,label:a[d[m][+!p]]}:void 0,g=c(e),x=typeof e.toolMetadata?.system==`string`&&i.showStepSystem?e.toolMetadata.system:void 0,w=v(e.input),E=b(e.output),D=i.showStepDetails?{input:y(e.input),output:y(E,4e3),error:e.errorText}:void 0,O=s!==void 0&&!s.isAutomatic&&!e.toolMetadata?.card,k={toolCallId:e.toolCallId,placement:`hidden`,...typeof e.toolMetadata?.card==`string`&&s?{card:e.toolMetadata.card}:{},name:g,...x?{system:x}:{},status:o,statusLabel:f(o,{reader:r,display:i,strings:a}),...h?{decision:h}:{},...h?.by===`rules`&&s?.reason?{reason:s.reason}:{},...w?{summary:w}:{},fields:_(e.input,{withIds:i.showStepDetails||s!==void 0&&!s.isAutomatic&&C(e,n)}),...D?{raw:D}:{},...O?{approval:T(e,o,{turn:n,reader:r,strings:a,name:g})}:{}};return{...k,placement:S(e,k,{turn:n,reader:r,display:i})}}function T(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`||!C(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 E(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.label)??{approved:t.approved,label:t.label,count:0};n.set(t.label,{...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.summary?{summary:r.summary}:{},...D(r)}}:{},marks:[...n.values()].map(({approved:e,label:t,count:n})=>({approved:e,label:n>1?`${t} ×${n}`:t})),failed:e.filter(e=>e.status===`failed`).length,...i?{stopped:{finished:e.filter(e=>e.status!==`stopped`).length}}:{}}}function D(e){return!e.decision&&(e.status===`replaced`||e.status===`declined`)?{outcome:e.statusLabel}:{}}function O(e,t){return e===0?t.statusStopped:e===1?t.toolStepsStoppedOne:t.toolStepsStopped.replace(`{count}`,String(e))}const k=e;export{n as STEP_DISPLAY_KEYS,t as STEP_DISPLAY_PRESETS,k as STEP_STRINGS_EN,r as isStepDisplayPreset,a as matchStepDisplayPreset,s as nameInWords,y as rawText,i as resolveStepDisplay,w as stepCallView,_ as stepFields,E as stepGroupLine,c as stepName,O 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:`Approved by the visitor`,decidedVisitorDeclined:`Declined by the visitor`,decidedTeamApproved:`Approved by a team member`,decidedTeamDeclined:`Declined by a team member`,decidedMemberApproved:`Approved by {name}`,decidedMemberDeclined:`Declined by {name}`,stepRawData:`Raw data`,decidedRulesApproved:`Approved automatically`,decidedRulesDeclined:`Declined automatically`,edit:`Edit`,statusError:`Error`,toolStepsFailed:`{count} failed`,statusStopped:`Stopped`,toolStepsStopped:`Stopped after {count} steps`,toolStepsStoppedOne:`Stopped after 1 step`},t={simple:{showSteps:!1,showStepDetails:!1,showStepSystem:!1,showDecidedBy:!1,foldApprovals:!0},technical:{showSteps:!0,showStepDetails:!0,showStepSystem:!0,showDecidedBy:!0,foldApprovals:!0}},n=[`showSteps`,`showStepDetails`,`showStepSystem`,`showDecidedBy`,`foldApprovals`];function r(e){return Object.hasOwn(t,e)}function i(e,n){return{...t[n],...e}}function a(e){return Object.keys(t).filter(r).find(r=>n.every(n=>t[r][n]===e[n]))}const o=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function s(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 c(e){if(e.title)return e.title;let t=e.toolName.replace(/^tool[:-]/,``),n=t.indexOf(`__`);return s(n>0?t.slice(n+2):t)}function l(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 u(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 d(e,t,n,r){return e===`teamMember`&&n?r[t?`decidedMemberApproved`:`decidedMemberDeclined`].replace(`{name}`,n):r[f[e][+!t]]}const f={you:[`decidedYouApproved`,`decidedYouDeclined`],visitor:[`decidedVisitorApproved`,`decidedVisitorDeclined`],teamMember:[`decidedTeamApproved`,`decidedTeamDeclined`],rules:[`decidedRulesApproved`,`decidedRulesDeclined`]};function p(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.showStepDetails?t.strings.stepFailed:t.strings.stepDidNotWork;case`done`:return``;default:return e}}function m(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function h(e){return typeof e==`string`?e.trim():typeof e==`number`||typeof e==`boolean`?String(e):``}function g(e){return h(e)||(typeof e==`object`&&e?JSON.stringify(e):``)}function _(e){if(!m(e))return g(e);let[t,...n]=Object.values(e).map(g).filter(Boolean);return t===void 0?``:n.length>0?`${t} (${n.join(`, `)})`:t}function v(e,t){if(!m(e))return[];let n=[];function r(e,i){if(Array.isArray(e)){let t=e.map(_).filter(Boolean).join(`, `);t&&n.push({path:i,value:t});return}if(m(e)){for(let[t,n]of Object.entries(e))r(n,[...i,t]);return}let a=h(e);a&&(t.withIds||!o.test(a))&&n.push({path:i,value:a})}r(e,[]);let i=n.map(({path:e})=>s(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?`${s(e.at(-2)??``)} · ${r.toLowerCase()}`:r,value:t}})}function y(e){if(m(e))return Object.values(e).find(e=>typeof e==`string`&&e.trim().length>0&&!o.test(e.trim()))?.trim()}function b(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 x(e){let t=e.trim();if(!t.startsWith(`{`)&&!t.startsWith(`[`))return e;try{return JSON.parse(t)}catch{return e}}function S(e){if(m(e)&&e.storage===`tool-result-ref`&&`summary`in e)return{value:e.summary};if(m(e)&&Array.isArray(e.content)){let t=e.content.flatMap(e=>m(e)&&typeof e.text==`string`?[e.text]:[]).join(`
|
|
2
|
+
`),n=m(e.structuredContent)?e.structuredContent:x(t);return e.isError===!0?{value:n,error:m(n)&&typeof n.error==`string`?n.error:t}:{value:n}}return m(e)&&typeof e.error==`string`&&typeof e.instruction==`string`?{value:e,error:e.error}:{value:e}}function C(e){return b(e.input)!==void 0||b(e.output)!==void 0||!!e.errorText}function w(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&&T(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&&C(e)?`step`:`hidden`}function T(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 E(e,t){let{turn:n,reader:r,display:i,strings:a}=t,o=S(e.output),s=l(e,n,o),f=e.approval,m=f?.replacedByMessageId?void 0:f?.approved,h=f&&m!==void 0?u(f,r):void 0,g=h===`teamMember`?f?.respondedBy?.userId:void 0,_=h&&m!==void 0&&(h===`you`||i.showDecidedBy)?{approved:m,by:h,label:d(h,m,g&&t.names?.get(g),a),...g?{userId:g}:{}}:void 0,x=c(e),C=typeof e.toolMetadata?.system==`string`&&(i.showStepSystem||e.toolMetadata.nameShared===!0)?e.toolMetadata.system:void 0,E=y(e.input),O=e.errorText??o.error,k=i.showStepDetails&&o.error===void 0?v(o.value,{withIds:!0}):[],A=i.showStepDetails?{input:b(e.input),output:b(o.value,4e3)}:void 0,j=f!==void 0&&!f.isAutomatic&&!e.toolMetadata?.card,M={toolCallId:e.toolCallId,placement:`hidden`,...typeof e.toolMetadata?.card==`string`&&f?{card:e.toolMetadata.card}:{},name:x,...C?{system:C}:{},status:s,statusLabel:p(s,{reader:r,display:i,strings:a}),..._?{decision:_}:{},..._?.by===`rules`&&f?.reason?{reason:f.reason}:{},...E?{summary:E}:{},fields:v(e.input,{withIds:i.showStepDetails||f!==void 0&&!f.isAutomatic&&T(e,n)}),...k.length>0?{resultFields:k}:{},...O&&i.showStepDetails?{error:O}:{},...A?{raw:A}:{},...j?{approval:D(e,s,{turn:n,reader:r,strings:a,name:x})}:{}};return{...M,placement:w(e,M,{turn:n,reader:r,display:i})}}function D(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`||!T(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 O(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.label)??{approved:t.approved,label:t.label,...t.userId?{userId:t.userId}:{},count:0};n.set(t.label,{...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}:{},...k(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 k(e){return!e.decision&&(e.status===`replaced`||e.status===`declined`)?{outcome:e.statusLabel}:{}}function A(e,t){return e===0?t.statusStopped:e===1?t.toolStepsStoppedOne:t.toolStepsStopped.replace(`{count}`,String(e))}const j=e;export{n as STEP_DISPLAY_KEYS,t as STEP_DISPLAY_PRESETS,j as STEP_STRINGS_EN,r as isStepDisplayPreset,a as matchStepDisplayPreset,s as nameInWords,b as rawText,i as resolveStepDisplay,E as stepCallView,v as stepFields,O as stepGroupLine,c as stepName,S as stepResult,A as stoppedLineLabel};
|
|
2
3
|
//# sourceMappingURL=step-display.mjs.map
|