@mgamadeus/ddd-agents 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -2
- package/dist/chat.js +284 -163
- package/dist/chat.js.map +1 -1
- package/dist/chunks/{contract-Z08LBOqt.js → contract-kmmw_19Y.js} +2 -2
- package/dist/chunks/{contract-Z08LBOqt.js.map → contract-kmmw_19Y.js.map} +1 -1
- package/dist/chunks/{conversation-BEF0aesf.js → conversation-CbWEHPbL.js} +12 -3
- package/dist/chunks/{conversation-BEF0aesf.js.map → conversation-CbWEHPbL.js.map} +1 -1
- package/dist/chunks/link-navigation-DyTApNeA.js.map +1 -1
- package/dist/chunks/{withPollingChangeSubscription-CNXgt3Ri.js → withPollingChangeSubscription-CWavoKjJ.js} +2 -2
- package/dist/chunks/{withPollingChangeSubscription-CNXgt3Ri.js.map → withPollingChangeSubscription-CWavoKjJ.js.map} +1 -1
- package/dist/client-testing.js +1 -1
- package/dist/client.js +45 -6
- package/dist/client.js.map +1 -1
- package/dist/contract.js +6 -5
- package/dist/files/i18n-keys.json +19 -0
- package/dist/styles.css +148 -15
- package/dist/types/chat/AgentChatActivityDots/AgentChatActivityDots.d.ts +11 -0
- package/dist/types/chat/AgentChatActivityIndicator/AgentChatActivityIndicator.d.ts +7 -2
- package/dist/types/chat/AgentChatActivityStack/AgentChatActivityStack.d.ts +15 -0
- package/dist/types/chat/controller/AgentChatController.d.ts +10 -0
- package/dist/types/chat/controller/activity-ticker.d.ts +5 -2
- package/dist/types/chat/controller/chat-activity-timing.d.ts +30 -0
- package/dist/types/chat/controller/use-activity-ticker.d.ts +6 -0
- package/dist/types/chat/controller/use-conversation-activity.d.ts +6 -2
- package/dist/types/client/http/agents-http-mappers.d.ts +9 -2
- package/dist/types/client/http/agents-http-wire.d.ts +13 -0
- package/dist/types/client/http/createAgentsHttpConversationClient.d.ts +9 -0
- package/dist/types/contract/conversation.d.ts +27 -0
- package/dist/types/entries/chat.d.ts +4 -1
- package/dist/types/provider/environment.d.ts +7 -0
- package/package.json +1 -1
- package/public-api.json +16 -0
package/dist/chat.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useRef, useEffect, useMemo, useState, useImperativeHandle, useLayoutEffect, useCallback, useContext, memo, Fragment as Fragment$1, useReducer } from "react";
|
|
4
4
|
import { u as useAgentsConversationClient, a as useOptionalAgentsConversationClient, A as AgentsConversationClientProvider } from "./chunks/AgentsConversationClientContext-C4T7g_Qk.js";
|
|
5
|
-
import { w as withPollingChangeSubscription } from "./chunks/withPollingChangeSubscription-
|
|
6
|
-
import { s as Text, I as Icon, ab as useAgentsTexts, G as GlowFrame, v as Tooltip, B as Button,
|
|
7
|
-
import { i as isAgentsClientError,
|
|
5
|
+
import { w as withPollingChangeSubscription } from "./chunks/withPollingChangeSubscription-CWavoKjJ.js";
|
|
6
|
+
import { s as Text, F as classNames, I as Icon, ab as useAgentsTexts, G as GlowFrame, v as Tooltip, B as Button, n as Skeleton, a5 as useAgentsEnvironment, j as Markdown, K as getAgentDisplayName, a3 as useAgentsBudgetLimit, h as InteractiveSurface, L as LoadingSpinner, a1 as translateText, p as SplitView, _ as reportRunningTurn, a2 as useAgentsActiveAgentSpaceKey, P as ProgressBar } from "./chunks/link-navigation-DyTApNeA.js";
|
|
7
|
+
import { i as isAgentsClientError, a as AgentsClientError } from "./chunks/conversation-CbWEHPbL.js";
|
|
8
8
|
import { W as WIDGET_FENCE_LANG, G as resolveWidgetName, j as conversationWidgetRegistry, n as findWidgetFencesInMarkdown, o as ConversationWidgetErrorBoundary, p as ConversationWidgetFeatureGate, T as parseWidgetJsonObject, F as resolveCanonicalWidgetName, y as getConversationWidgetRegistryRevision, U as BARE_WIDGET_LINE_GLOBAL, t as closestWidgetNames } from "./chunks/widget-name-resolver-DboFMAq2.js";
|
|
9
9
|
import { E as useConversationWidgetContext, p as payloadHashOfInstanceId, j as buildWidgetAgentSpaceKeyProps, av as useCanvasViable, a8 as ElementWidthCanvasViability, U as CanvasViabilityContext } from "./chunks/WebSearchResultsConversationWidget-BXt98hGu.js";
|
|
10
10
|
import { c as canvasBehaviourOf, d as CHAT_COLUMN_MIN_WIDTH_PX, b as CANVAS_MIN_WIDTH_PX, D as DEFAULT_CANVAS_WIDTH_PERCENT, e as canvasWidthPercentOf, C as CANVAS_BOXED_INSET_PX } from "./chunks/canvas-behaviours-BpN_1xdZ.js";
|
|
@@ -16,44 +16,59 @@ import { t as textKey } from "./chunks/text-key-DnoZ4lAk.js";
|
|
|
16
16
|
import { c as canvasBodies } from "./chunks/canvasBodies-Ds-cTn47.js";
|
|
17
17
|
import { c as canvasFeatureFlagOf } from "./chunks/canvas-feature-flags-BmmxC3bz.js";
|
|
18
18
|
import { flushSync } from "react-dom";
|
|
19
|
-
import { b as buildChangedMessagesRequest, d as deriveAgentActivity } from "./chunks/contract-
|
|
19
|
+
import { b as buildChangedMessagesRequest, d as deriveAgentActivity } from "./chunks/contract-kmmw_19Y.js";
|
|
20
20
|
const history = "agents_history_BIbikt";
|
|
21
|
-
const styles$
|
|
21
|
+
const styles$n = {
|
|
22
22
|
history
|
|
23
23
|
};
|
|
24
24
|
const AgentChatActivityHistory = (props) => {
|
|
25
25
|
const { turn } = props;
|
|
26
26
|
if (turn === null || turn.lines.length === 0) return null;
|
|
27
|
-
return /* @__PURE__ */ jsx("div", { className: styles$
|
|
27
|
+
return /* @__PURE__ */ jsx("div", { className: styles$n.history, "data-testid": "agent-chat-activity-history", children: turn.lines.map((line2) => /* @__PURE__ */ jsx(Text, { role: "help", color: "--agents-fg-light", translate: false, children: line2.line }, `${line2.toolCallMessageId}-${line2.state}`)) });
|
|
28
|
+
};
|
|
29
|
+
const dots = "agents_dots_ndE4a-";
|
|
30
|
+
const bounce = "agents_bounce_rAVWhT";
|
|
31
|
+
const pulse = "agents_pulse_r0EheQ";
|
|
32
|
+
const styles$m = {
|
|
33
|
+
dots,
|
|
34
|
+
bounce,
|
|
35
|
+
pulse
|
|
28
36
|
};
|
|
37
|
+
const AgentChatActivityDots = ({ variant = "bounce" }) => /* @__PURE__ */ jsxs(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: classNames(styles$m.dots, variant === "pulse" ? styles$m.pulse : styles$m.bounce),
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
"data-agents-activity-dots": variant,
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx("span", {}),
|
|
45
|
+
/* @__PURE__ */ jsx("span", {}),
|
|
46
|
+
/* @__PURE__ */ jsx("span", {})
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
);
|
|
29
50
|
const activity = "agents_activity_Gv-0ee";
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
activity,
|
|
33
|
-
dots
|
|
51
|
+
const styles$l = {
|
|
52
|
+
activity
|
|
34
53
|
};
|
|
35
54
|
const AgentChatActivityIndicator = (props) => {
|
|
36
|
-
const { active, failed, activityTicker } = props;
|
|
55
|
+
const { active, failed, activityTicker, dotsVariant = "bounce" } = props;
|
|
37
56
|
const isWorking = !failed && (active || activityTicker.phase === "live");
|
|
38
57
|
if (!isWorking) return null;
|
|
39
58
|
const currentLines = activityTicker.currentTurn?.lines ?? [];
|
|
40
59
|
const currentLine = currentLines.length > 0 ? currentLines[currentLines.length - 1].line : null;
|
|
41
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */ jsx("span", {}),
|
|
44
|
-
/* @__PURE__ */ jsx("span", {}),
|
|
45
|
-
/* @__PURE__ */ jsx("span", {})
|
|
46
|
-
] }),
|
|
60
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$l.activity, role: "status", "aria-live": "polite", "data-testid": "agent-chat-activity", children: [
|
|
61
|
+
/* @__PURE__ */ jsx(AgentChatActivityDots, { variant: dotsVariant }),
|
|
47
62
|
currentLine !== null ? /* @__PURE__ */ jsx(Text, { role: "help", color: "--agents-fg-light", translate: false, children: currentLine }) : /* @__PURE__ */ jsx(Text, { role: "help", color: "--agents-fg-light", children: "Working on it…" })
|
|
48
63
|
] });
|
|
49
64
|
};
|
|
50
65
|
const bar = "agents_bar_DAkgRp";
|
|
51
|
-
const styles$
|
|
66
|
+
const styles$k = {
|
|
52
67
|
bar
|
|
53
68
|
};
|
|
54
69
|
const ConversationClosedBar = (props) => {
|
|
55
70
|
const { text = "This conversation is closed." } = props;
|
|
56
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
71
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$k.bar, "data-testid": "agent-chat-closed-bar", children: [
|
|
57
72
|
/* @__PURE__ */ jsx(Icon, { name: "check", color: "--agents-success-500" }),
|
|
58
73
|
/* @__PURE__ */ jsx(Text, { children: text })
|
|
59
74
|
] });
|
|
@@ -87,8 +102,8 @@ const findBalancedJsonObjectEnd = (text, fromIndex, maxScanLength = 5e3) => {
|
|
|
87
102
|
return null;
|
|
88
103
|
};
|
|
89
104
|
const ANY_FENCE_DELIM_LINE = /^ {0,3}(`{3,}|~{3,})(.*)$/;
|
|
90
|
-
const parseFenceDelimiterLine = (
|
|
91
|
-
const match = ANY_FENCE_DELIM_LINE.exec(
|
|
105
|
+
const parseFenceDelimiterLine = (line2) => {
|
|
106
|
+
const match = ANY_FENCE_DELIM_LINE.exec(line2);
|
|
92
107
|
if (!match) return null;
|
|
93
108
|
const marker = match[1];
|
|
94
109
|
const char = marker[0];
|
|
@@ -199,13 +214,13 @@ const repairMalformedWidgetFences = (text) => {
|
|
|
199
214
|
};
|
|
200
215
|
const scanLineStartingJsonSpans = (text) => {
|
|
201
216
|
const spans = [];
|
|
202
|
-
const
|
|
217
|
+
const lines2 = text.split("\n");
|
|
203
218
|
let offset = 0;
|
|
204
|
-
for (const
|
|
219
|
+
for (const line2 of lines2) {
|
|
205
220
|
const lineStart = offset;
|
|
206
|
-
offset +=
|
|
207
|
-
if (!
|
|
208
|
-
const openIndex = lineStart +
|
|
221
|
+
offset += line2.length + 1;
|
|
222
|
+
if (!line2.trimStart().startsWith("{")) continue;
|
|
223
|
+
const openIndex = lineStart + line2.indexOf("{");
|
|
209
224
|
const jsonObjectEnd = findBalancedJsonObjectEnd(text, openIndex);
|
|
210
225
|
if (jsonObjectEnd !== null) {
|
|
211
226
|
spans.push({ json: text.slice(openIndex, jsonObjectEnd + 1), start: openIndex, end: jsonObjectEnd + 1 });
|
|
@@ -401,7 +416,7 @@ const input = "agents_input_GCtiXU";
|
|
|
401
416
|
const inputReplacement = "agents_inputReplacement_EAhjsv";
|
|
402
417
|
const inputInCategory = "agents_inputInCategory_RDuOYA";
|
|
403
418
|
const olderLoading = "agents_olderLoading_5X7nMg";
|
|
404
|
-
const styles$
|
|
419
|
+
const styles$j = {
|
|
405
420
|
chat,
|
|
406
421
|
genericChat,
|
|
407
422
|
customBg,
|
|
@@ -431,7 +446,7 @@ const sendBlocked = "agents_sendBlocked_rNqOKm";
|
|
|
431
446
|
const compact = "agents_compact_ZBtAbD";
|
|
432
447
|
const collapsed = "agents_collapsed_v3Ekqz";
|
|
433
448
|
const collapsedPillSizer = "agents_collapsedPillSizer_aqw7WI";
|
|
434
|
-
const styles$
|
|
449
|
+
const styles$i = {
|
|
435
450
|
inputContainer,
|
|
436
451
|
aiGlow,
|
|
437
452
|
editableInput,
|
|
@@ -528,6 +543,7 @@ const ConversationMessageInput = (props) => {
|
|
|
528
543
|
const isComposingRef = useRef(false);
|
|
529
544
|
const texts = useAgentsTexts();
|
|
530
545
|
const translatedPlaceholder = useMemo(() => texts.translate(placeholder), [texts, placeholder]);
|
|
546
|
+
const sendButtonAccessibleName = texts.translate("Send message");
|
|
531
547
|
const collapsedPillSizerRef = useRef(null);
|
|
532
548
|
const measuresCollapsedPillWidth = compact2 && !!onCollapsedPillWidthChange;
|
|
533
549
|
const isMessageTooLong = inputValue.length > MAX_MESSAGE_LENGTH;
|
|
@@ -657,7 +673,7 @@ const ConversationMessageInput = (props) => {
|
|
|
657
673
|
/* @__PURE__ */ jsx(
|
|
658
674
|
GlowFrame,
|
|
659
675
|
{
|
|
660
|
-
className: classNames(styles$
|
|
676
|
+
className: classNames(styles$i.aiGlow),
|
|
661
677
|
color: isMessageTooLong ? "var(--agents-danger-500)" : void 0,
|
|
662
678
|
borderRadius: compact2 ? COMPACT_INPUT_RADIUS_PX : void 0,
|
|
663
679
|
borderWidth: 2,
|
|
@@ -665,9 +681,9 @@ const ConversationMessageInput = (props) => {
|
|
|
665
681
|
children: /* @__PURE__ */ jsxs(
|
|
666
682
|
"div",
|
|
667
683
|
{
|
|
668
|
-
className: classNames(styles$
|
|
669
|
-
[styles$
|
|
670
|
-
[styles$
|
|
684
|
+
className: classNames(styles$i.inputContainer, {
|
|
685
|
+
[styles$i.compact]: compact2,
|
|
686
|
+
[styles$i.collapsed]: compact2 && collapsed2
|
|
671
687
|
}),
|
|
672
688
|
onMouseDown: handleContainerMouseDown,
|
|
673
689
|
children: [
|
|
@@ -681,26 +697,26 @@ const ConversationMessageInput = (props) => {
|
|
|
681
697
|
onCompositionStart: handleCompositionStart,
|
|
682
698
|
onCompositionEnd: handleCompositionEnd,
|
|
683
699
|
onKeyDown: handleKeyPress,
|
|
684
|
-
className: `${styles$
|
|
700
|
+
className: `${styles$i.editableInput} ${!inputValue ? styles$i.showPlaceholder : ""}`,
|
|
685
701
|
"data-placeholder": translatedPlaceholder,
|
|
686
702
|
"data-testid": `${testId}-textarea`
|
|
687
703
|
}
|
|
688
704
|
),
|
|
689
|
-
inputValue.length >= CHARACTER_COUNTER_SHOWN_FROM_LENGTH && /* @__PURE__ */ jsx("div", { className: styles$
|
|
705
|
+
inputValue.length >= CHARACTER_COUNTER_SHOWN_FROM_LENGTH && /* @__PURE__ */ jsx("div", { className: styles$i.statusRow, children: /* @__PURE__ */ jsx(
|
|
690
706
|
Text,
|
|
691
707
|
{
|
|
692
708
|
role: "caption",
|
|
693
709
|
translate: false,
|
|
694
710
|
color: isMessageTooLong ? "var(--agents-danger-500)" : "var(--agents-fg-lightest)",
|
|
695
|
-
className: styles$
|
|
711
|
+
className: styles$i.characterCounter,
|
|
696
712
|
testId: `${testId}-character-counter`,
|
|
697
713
|
children: `${inputValue.length.toLocaleString()} / ${MAX_MESSAGE_LENGTH.toLocaleString()}`
|
|
698
714
|
}
|
|
699
715
|
) }),
|
|
700
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
701
|
-
actionsSlotStart && /* @__PURE__ */ jsx("div", { className: styles$
|
|
716
|
+
/* @__PURE__ */ jsxs("div", { className: styles$i.actions, children: [
|
|
717
|
+
actionsSlotStart && /* @__PURE__ */ jsx("div", { className: styles$i.actionsStart, children: actionsSlotStart }),
|
|
702
718
|
actionsSlot,
|
|
703
|
-
sendReplacementWhenEmpty && !hasSendableContent ? sendReplacementWhenEmpty : /* @__PURE__ */ jsx("div", { className: classNames({ [styles$
|
|
719
|
+
sendReplacementWhenEmpty && !hasSendableContent ? sendReplacementWhenEmpty : /* @__PURE__ */ jsx("div", { className: classNames({ [styles$i.sendBlocked]: isMessageTooLong }), children: /* @__PURE__ */ jsx(
|
|
704
720
|
Tooltip,
|
|
705
721
|
{
|
|
706
722
|
text: isMessageTooLong ? "Your message is over the %maxLength% character limit" : void 0,
|
|
@@ -713,6 +729,7 @@ const ConversationMessageInput = (props) => {
|
|
|
713
729
|
onClick: handleSendMessage,
|
|
714
730
|
icon: "arrowUp",
|
|
715
731
|
testId: `${testId}-send-button`,
|
|
732
|
+
ariaLabel: sendButtonAccessibleName,
|
|
716
733
|
disabled: !hasSendableContent || disabled || isProcessing || isMessageTooLong || sendDisabled,
|
|
717
734
|
size: hasSendableContent && !isMessageTooLong && !sendDisabled ? "medium" : void 0,
|
|
718
735
|
rounded: true
|
|
@@ -726,7 +743,7 @@ const ConversationMessageInput = (props) => {
|
|
|
726
743
|
)
|
|
727
744
|
}
|
|
728
745
|
),
|
|
729
|
-
measuresCollapsedPillWidth && /* @__PURE__ */ jsx("span", { ref: collapsedPillSizerRef, className: styles$
|
|
746
|
+
measuresCollapsedPillWidth && /* @__PURE__ */ jsx("span", { ref: collapsedPillSizerRef, className: styles$i.collapsedPillSizer, "aria-hidden": "true", children: translatedPlaceholder })
|
|
730
747
|
] });
|
|
731
748
|
};
|
|
732
749
|
const canvasReopenControl = "agents_canvasReopenControl_7vGS8F";
|
|
@@ -794,7 +811,7 @@ const message = "agents_message_BScH1l";
|
|
|
794
811
|
const whiteBubble = "agents_whiteBubble_4-I21V";
|
|
795
812
|
const darkBubble = "agents_darkBubble_YdEIoi";
|
|
796
813
|
const primaryBubble = "agents_primaryBubble_jo9Zj-";
|
|
797
|
-
const styles$
|
|
814
|
+
const styles$h = {
|
|
798
815
|
message,
|
|
799
816
|
whiteBubble,
|
|
800
817
|
darkBubble,
|
|
@@ -813,16 +830,16 @@ const ConversationMessageUserWidgets = (props) => {
|
|
|
813
830
|
const ConversationMessageUser = (props) => {
|
|
814
831
|
const { text, isGenericChat, theme = "default" } = props;
|
|
815
832
|
const { text: proseText, widgets } = useMemo(() => splitComposerWidgetFencesFromMessageText(text), [text]);
|
|
816
|
-
const bubbleClass = theme === "light" ? styles$
|
|
833
|
+
const bubbleClass = theme === "light" ? styles$h.whiteBubble : theme === "dark" ? styles$h.darkBubble : theme === "primary" ? styles$h.primaryBubble : void 0;
|
|
817
834
|
const textColor = theme === "light" ? "var(--agents-fg)" : theme === "dark" ? "var(--agents-chat-user-bubble-text)" : "var(--agents-fg-on-accent)";
|
|
818
|
-
return /* @__PURE__ */ jsxs("div", { className: classNames(styles$
|
|
835
|
+
return /* @__PURE__ */ jsxs("div", { className: classNames(styles$h.message, bubbleClass), "data-testid": "chat-message-user", children: [
|
|
819
836
|
/* @__PURE__ */ jsx(ConversationMessageUserWidgets, { widgets }),
|
|
820
837
|
/* @__PURE__ */ jsx(Text, { allowNewLines: true, translate: false, color: textColor, children: proseText })
|
|
821
838
|
] });
|
|
822
839
|
};
|
|
823
840
|
const responseContainer$2 = "agents_responseContainer_1-FSNs";
|
|
824
841
|
const responseMessage = "agents_responseMessage_Xrs7fL";
|
|
825
|
-
const styles$
|
|
842
|
+
const styles$g = {
|
|
826
843
|
responseContainer: responseContainer$2,
|
|
827
844
|
responseMessage
|
|
828
845
|
};
|
|
@@ -1045,15 +1062,15 @@ const useFreshMessageBlockReveal = (options) => {
|
|
|
1045
1062
|
};
|
|
1046
1063
|
const iconContainer$1 = "agents_iconContainer_JupHNn";
|
|
1047
1064
|
const responseHeader$1 = "agents_responseHeader_ulXYcn";
|
|
1048
|
-
const styles$
|
|
1065
|
+
const styles$f = {
|
|
1049
1066
|
iconContainer: iconContainer$1,
|
|
1050
1067
|
responseHeader: responseHeader$1
|
|
1051
1068
|
};
|
|
1052
1069
|
const ConversationMessageHeader = memo((props) => {
|
|
1053
1070
|
const { aiPromptExtensionCategory, aiPromptExtension } = props;
|
|
1054
1071
|
const iconName = aiPromptExtension?.iconClass ?? "ai";
|
|
1055
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1056
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
1072
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$f.responseHeader, children: [
|
|
1073
|
+
/* @__PURE__ */ jsx("span", { className: styles$f.iconContainer, children: /* @__PURE__ */ jsx(Icon, { color: "var(--agents-fg-on-accent)", hostIconName: iconName }) }),
|
|
1057
1074
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1058
1075
|
/* @__PURE__ */ jsx(Text, { role: "help", weight: "bold", children: aiPromptExtension?.name ?? "AI Extensions" }),
|
|
1059
1076
|
aiPromptExtensionCategory !== void 0 ? /* @__PURE__ */ jsx(Text, { role: "caption", replacements: { productName: aiPromptExtensionCategory?.name }, children: "%productName% Assistant" }) : null,
|
|
@@ -1132,7 +1149,7 @@ const ConversationMessageWidgets = memo((props) => {
|
|
|
1132
1149
|
if (timeoutRef.current != null) window.clearTimeout(timeoutRef.current);
|
|
1133
1150
|
timeoutRef.current = window.setTimeout(() => setCopied(false), 2e3);
|
|
1134
1151
|
}, [textToRender]);
|
|
1135
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1152
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$g.responseContainer, children: [
|
|
1136
1153
|
!hideAssistantMeta ? /* @__PURE__ */ jsx(
|
|
1137
1154
|
ConversationMessageHeader,
|
|
1138
1155
|
{
|
|
@@ -1140,7 +1157,7 @@ const ConversationMessageWidgets = memo((props) => {
|
|
|
1140
1157
|
aiPromptExtension
|
|
1141
1158
|
}
|
|
1142
1159
|
) : null,
|
|
1143
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
1160
|
+
/* @__PURE__ */ jsxs("div", { className: styles$g.responseMessage, children: [
|
|
1144
1161
|
/* @__PURE__ */ jsx("div", { ref: renderedRef, children: /* @__PURE__ */ jsx(
|
|
1145
1162
|
ConversationMarkdown,
|
|
1146
1163
|
{
|
|
@@ -1247,22 +1264,22 @@ const lastWireMessageIsUnansweredUserMessage = (messages) => {
|
|
|
1247
1264
|
return false;
|
|
1248
1265
|
};
|
|
1249
1266
|
const responseContainer$1 = "agents_responseContainer_LFzKoO";
|
|
1250
|
-
const styles$
|
|
1267
|
+
const styles$e = {
|
|
1251
1268
|
responseContainer: responseContainer$1
|
|
1252
1269
|
};
|
|
1253
1270
|
const responseHeaderLayout = "agents_responseHeaderLayout_WuoaNs";
|
|
1254
1271
|
const iconContainer = "agents_iconContainer_C1c9yQ";
|
|
1255
1272
|
const responseHeader = "agents_responseHeader_-CQw8U";
|
|
1256
|
-
const styles$
|
|
1273
|
+
const styles$d = {
|
|
1257
1274
|
responseHeaderLayout,
|
|
1258
1275
|
iconContainer,
|
|
1259
1276
|
responseHeader
|
|
1260
1277
|
};
|
|
1261
1278
|
const ConversationMessageSystemHeader = memo((props) => {
|
|
1262
1279
|
const { aiPromptExtensionCategory, aiPromptExtension, isContentExpanded, onExpandContentClick } = props;
|
|
1263
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1264
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
1265
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
1280
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$d.responseHeaderLayout, children: [
|
|
1281
|
+
/* @__PURE__ */ jsxs("div", { className: styles$d.responseHeader, children: [
|
|
1282
|
+
/* @__PURE__ */ jsx("span", { className: styles$d.iconContainer, children: /* @__PURE__ */ jsx(Icon, { color: "var(--agents-fg-on-accent)", name: "wizard" }) }),
|
|
1266
1283
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1267
1284
|
/* @__PURE__ */ jsx(Text, { role: "help", weight: "bold", children: aiPromptExtension?.name ?? "AI Extensions" }),
|
|
1268
1285
|
aiPromptExtensionCategory !== void 0 ? /* @__PURE__ */ jsxs(Text, { role: "caption", children: [
|
|
@@ -1272,7 +1289,7 @@ const ConversationMessageSystemHeader = memo((props) => {
|
|
|
1272
1289
|
aiPromptExtensionCategory === void 0 ? /* @__PURE__ */ jsx(Text, { role: "caption", children: "System" }) : null
|
|
1273
1290
|
] })
|
|
1274
1291
|
] }),
|
|
1275
|
-
/* @__PURE__ */ jsx("div", { className: styles$
|
|
1292
|
+
/* @__PURE__ */ jsx("div", { className: styles$d.responseHeaderAction, children: /* @__PURE__ */ jsx(
|
|
1276
1293
|
Button,
|
|
1277
1294
|
{
|
|
1278
1295
|
variant: "muted",
|
|
@@ -1285,7 +1302,7 @@ const ConversationMessageSystemHeader = memo((props) => {
|
|
|
1285
1302
|
const ConversationMessageSystem = memo((props) => {
|
|
1286
1303
|
const { aiPromptExtensionCategory, aiPromptExtension, message: message2 } = props;
|
|
1287
1304
|
const [isContentExpanded, setIsContentExpanded] = useState(false);
|
|
1288
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1305
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$e.responseContainer, children: [
|
|
1289
1306
|
/* @__PURE__ */ jsx(
|
|
1290
1307
|
ConversationMessageSystemHeader,
|
|
1291
1308
|
{
|
|
@@ -1295,22 +1312,22 @@ const ConversationMessageSystem = memo((props) => {
|
|
|
1295
1312
|
isContentExpanded
|
|
1296
1313
|
}
|
|
1297
1314
|
),
|
|
1298
|
-
/* @__PURE__ */ jsx("div", { style: { display: isContentExpanded ? void 0 : "none" }, children: /* @__PURE__ */ jsx("div", { className: styles$
|
|
1315
|
+
/* @__PURE__ */ jsx("div", { style: { display: isContentExpanded ? void 0 : "none" }, children: /* @__PURE__ */ jsx("div", { className: styles$e.responseMessage, children: /* @__PURE__ */ jsx(Markdown, { markdown: message2 }) }) })
|
|
1299
1316
|
] });
|
|
1300
1317
|
});
|
|
1301
1318
|
const icon = "agents_icon_DD3OXD";
|
|
1302
|
-
const styles$
|
|
1319
|
+
const styles$c = {
|
|
1303
1320
|
icon
|
|
1304
1321
|
};
|
|
1305
1322
|
const VoiceBarsIcon = (props) => {
|
|
1306
1323
|
const { size = 18 } = props;
|
|
1307
|
-
return /* @__PURE__ */ jsx("svg", { className: styles$
|
|
1324
|
+
return /* @__PURE__ */ jsx("svg", { className: styles$c.icon, width: size, height: size, viewBox: "0 0 24 24", "aria-hidden": true, focusable: "false", children: /* @__PURE__ */ jsx("path", { d: "M3.5 10.5v3M7.75 8v8M12 4.5v15M16.25 8v8M20.5 10.5v3" }) });
|
|
1308
1325
|
};
|
|
1309
1326
|
const markerRow = "agents_markerRow_zl8Pcg";
|
|
1310
1327
|
const markerChip = "agents_markerChip_u9Z-aO";
|
|
1311
1328
|
const markerIcon = "agents_markerIcon_En-miz";
|
|
1312
1329
|
const markerDuration = "agents_markerDuration_Nbff92";
|
|
1313
|
-
const styles$
|
|
1330
|
+
const styles$b = {
|
|
1314
1331
|
markerRow,
|
|
1315
1332
|
markerChip,
|
|
1316
1333
|
markerIcon,
|
|
@@ -1343,15 +1360,15 @@ const ConversationCallMarkerChip = memo(({ signalSource, signalText }) => {
|
|
|
1343
1360
|
const durationSeconds = /(\d+)s\b/.exec(signalText)?.[1];
|
|
1344
1361
|
const markerState = callMarkerStateOf(isCallEnd, endReason);
|
|
1345
1362
|
const markerLabel = isInAppCall ? MARKER_LABELS[markerState].inApp : MARKER_LABELS[markerState].phoneLine;
|
|
1346
|
-
return /* @__PURE__ */ jsx("div", { className: styles$
|
|
1347
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
1363
|
+
return /* @__PURE__ */ jsx("div", { className: styles$b.markerRow, "data-testid": "conversation-call-marker", children: /* @__PURE__ */ jsxs("span", { className: styles$b.markerChip, "data-state": markerState, children: [
|
|
1364
|
+
/* @__PURE__ */ jsx("span", { className: styles$b.markerIcon, children: isInAppCall ? /* @__PURE__ */ jsx(VoiceBarsIcon, { size: 16 }) : /* @__PURE__ */ jsx(Icon, { name: "phone" }) }),
|
|
1348
1365
|
/* @__PURE__ */ jsx(Text, { role: "caption", replacements: { agentName: getAgentDisplayName() }, children: markerLabel }),
|
|
1349
|
-
markerState === "ended" && durationSeconds != null && /* @__PURE__ */ jsx("span", { className: styles$
|
|
1366
|
+
markerState === "ended" && durationSeconds != null && /* @__PURE__ */ jsx("span", { className: styles$b.markerDuration, children: /* @__PURE__ */ jsx(Text, { role: "caption", translate: false, children: formatCallDuration(Number(durationSeconds)) }) })
|
|
1350
1367
|
] }) });
|
|
1351
1368
|
});
|
|
1352
1369
|
const disclosure = "agents_disclosure_rVPB-y";
|
|
1353
1370
|
const instructionPanel = "agents_instructionPanel_G2fM1K";
|
|
1354
|
-
const styles$
|
|
1371
|
+
const styles$a = {
|
|
1355
1372
|
disclosure,
|
|
1356
1373
|
instructionPanel
|
|
1357
1374
|
};
|
|
@@ -1359,15 +1376,15 @@ const ConversationTaskInstructionDisclosure = ({
|
|
|
1359
1376
|
instructionText
|
|
1360
1377
|
}) => {
|
|
1361
1378
|
const [expanded, setExpanded] = useState(false);
|
|
1362
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1363
|
-
expanded ? /* @__PURE__ */ jsx("div", { className: styles$
|
|
1379
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$a.disclosure, children: [
|
|
1380
|
+
expanded ? /* @__PURE__ */ jsx("div", { className: styles$a.instructionPanel, children: /* @__PURE__ */ jsx(Text, { role: "caption", color: "var(--agents-fg-light)", allowNewLines: true, translate: false, children: instructionText }) }) : null,
|
|
1364
1381
|
/* @__PURE__ */ jsx(Button, { variant: "muted", onClick: () => setExpanded((wasExpanded) => !wasExpanded), children: expanded ? "Hide task instruction" : "Show task instruction" })
|
|
1365
1382
|
] });
|
|
1366
1383
|
};
|
|
1367
1384
|
const responseContainer = "agents_responseContainer_DP5-nh";
|
|
1368
1385
|
const thinkingMessage = "agents_thinkingMessage_8Z3pN0";
|
|
1369
1386
|
const thinkingDots = "agents_thinkingDots_9rZMzX";
|
|
1370
|
-
const styles$
|
|
1387
|
+
const styles$9 = {
|
|
1371
1388
|
responseContainer,
|
|
1372
1389
|
thinkingMessage,
|
|
1373
1390
|
thinkingDots
|
|
@@ -1389,7 +1406,7 @@ const ConversationMessageThinking = memo((props) => {
|
|
|
1389
1406
|
}, 2500);
|
|
1390
1407
|
return () => clearInterval(interval);
|
|
1391
1408
|
}, []);
|
|
1392
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1409
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$9.responseContainer, children: [
|
|
1393
1410
|
/* @__PURE__ */ jsx(
|
|
1394
1411
|
ConversationMessageHeader,
|
|
1395
1412
|
{
|
|
@@ -1397,8 +1414,8 @@ const ConversationMessageThinking = memo((props) => {
|
|
|
1397
1414
|
aiPromptExtension
|
|
1398
1415
|
}
|
|
1399
1416
|
),
|
|
1400
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
1401
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
1417
|
+
/* @__PURE__ */ jsxs("div", { className: styles$9.thinkingMessage, children: [
|
|
1418
|
+
/* @__PURE__ */ jsxs("div", { className: styles$9.thinkingDots, children: [
|
|
1402
1419
|
/* @__PURE__ */ jsx("span", {}),
|
|
1403
1420
|
/* @__PURE__ */ jsx("span", {}),
|
|
1404
1421
|
/* @__PURE__ */ jsx("span", {})
|
|
@@ -1409,7 +1426,7 @@ const ConversationMessageThinking = memo((props) => {
|
|
|
1409
1426
|
});
|
|
1410
1427
|
const errorMessageContainer = "agents_errorMessageContainer_SW0BKU";
|
|
1411
1428
|
const errorMessageTitle = "agents_errorMessageTitle_c--G2K";
|
|
1412
|
-
const styles$
|
|
1429
|
+
const styles$8 = {
|
|
1413
1430
|
errorMessageContainer,
|
|
1414
1431
|
errorMessageTitle
|
|
1415
1432
|
};
|
|
@@ -1480,9 +1497,9 @@ const ConversationErrorWidget = (props) => {
|
|
|
1480
1497
|
replacements: replacements2
|
|
1481
1498
|
};
|
|
1482
1499
|
}, [errorType, isUpSellPossible, rateLimitRetryAfterSeconds, showFairUsageMessage, canRetry]);
|
|
1483
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1500
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$8.errorMessageContainer, children: [
|
|
1484
1501
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1485
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
1502
|
+
/* @__PURE__ */ jsxs("div", { className: styles$8.errorMessageTitle, children: [
|
|
1486
1503
|
/* @__PURE__ */ jsx(Icon, { name: icon2 }),
|
|
1487
1504
|
/* @__PURE__ */ jsx(Text, { weight: "bold", children: title2 })
|
|
1488
1505
|
] }),
|
|
@@ -1637,7 +1654,7 @@ const ConversationMessageList = ({
|
|
|
1637
1654
|
const suggestionCard = "agents_suggestionCard_mrCOnL";
|
|
1638
1655
|
const suggestionCardButton = "agents_suggestionCardButton_Vs0fh3";
|
|
1639
1656
|
const arrowIcon = "agents_arrowIcon_KmN-nZ";
|
|
1640
|
-
const styles$
|
|
1657
|
+
const styles$7 = {
|
|
1641
1658
|
suggestionCard,
|
|
1642
1659
|
suggestionCardButton,
|
|
1643
1660
|
arrowIcon
|
|
@@ -1645,7 +1662,7 @@ const styles$6 = {
|
|
|
1645
1662
|
const ConversationSuggestionWidget = (props) => {
|
|
1646
1663
|
const { suggestion, onClick, testId } = props;
|
|
1647
1664
|
const { AssistantIconBadge } = useAgentsEnvironment();
|
|
1648
|
-
return /* @__PURE__ */ jsx(InteractiveSurface, { hoverable: true, className: classNames(styles$
|
|
1665
|
+
return /* @__PURE__ */ jsx(InteractiveSurface, { hoverable: true, className: classNames(styles$7.suggestionCard), testId, children: /* @__PURE__ */ jsxs("button", { type: "button", className: styles$7.suggestionCardButton, onClick, children: [
|
|
1649
1666
|
AssistantIconBadge ? /* @__PURE__ */ jsx(
|
|
1650
1667
|
AssistantIconBadge,
|
|
1651
1668
|
{
|
|
@@ -1658,7 +1675,7 @@ const ConversationSuggestionWidget = (props) => {
|
|
|
1658
1675
|
/* @__PURE__ */ jsx(Text, { role: "help", weight: "bold", color: "var(--agents-fg-on-accent)", children: suggestion.name }),
|
|
1659
1676
|
/* @__PURE__ */ jsx(Text, { role: "caption", color: "var(--agents-fg-on-accent)", children: suggestion.description })
|
|
1660
1677
|
] }),
|
|
1661
|
-
/* @__PURE__ */ jsx(Icon, { color: "var(--agents-fg-on-accent)", className: styles$
|
|
1678
|
+
/* @__PURE__ */ jsx(Icon, { color: "var(--agents-fg-on-accent)", className: styles$7.arrowIcon, name: "arrowRight" })
|
|
1662
1679
|
] }) });
|
|
1663
1680
|
};
|
|
1664
1681
|
const ConversationIntroWidget = ({
|
|
@@ -1710,13 +1727,14 @@ const ConversationIntroWidget = ({
|
|
|
1710
1727
|
};
|
|
1711
1728
|
const scrollToLatest = "agents_scrollToLatest_j2xJO9";
|
|
1712
1729
|
const visible = "agents_visible_bwj0Gp";
|
|
1713
|
-
const styles$
|
|
1730
|
+
const styles$6 = {
|
|
1714
1731
|
scrollToLatest,
|
|
1715
1732
|
visible
|
|
1716
1733
|
};
|
|
1717
1734
|
const ConversationScrollToLatestMessageButton = (props) => {
|
|
1718
1735
|
const { visible: visible2, onClick } = props;
|
|
1719
|
-
|
|
1736
|
+
const texts = useAgentsTexts();
|
|
1737
|
+
return /* @__PURE__ */ jsx("div", { className: classNames(styles$6.scrollToLatest, visible2 ? styles$6.visible : void 0), children: /* @__PURE__ */ jsx(
|
|
1720
1738
|
Button,
|
|
1721
1739
|
{
|
|
1722
1740
|
variant: "muted",
|
|
@@ -1724,7 +1742,9 @@ const ConversationScrollToLatestMessageButton = (props) => {
|
|
|
1724
1742
|
rounded: true,
|
|
1725
1743
|
blurred: true,
|
|
1726
1744
|
size: "extraLarge",
|
|
1727
|
-
onClick
|
|
1745
|
+
onClick,
|
|
1746
|
+
ariaLabel: texts.translate("Scroll to the latest message"),
|
|
1747
|
+
testId: "chat-scroll-to-latest-button"
|
|
1728
1748
|
}
|
|
1729
1749
|
) });
|
|
1730
1750
|
};
|
|
@@ -1881,7 +1901,7 @@ const ConversationViewBody = (props) => {
|
|
|
1881
1901
|
);
|
|
1882
1902
|
const { readAssistantThemeClassName, AssistantBackground } = useAgentsEnvironment();
|
|
1883
1903
|
const colorPalette = useMemo(
|
|
1884
|
-
() => currentCategory?.alias ? readAssistantThemeClassName?.(currentCategory.alias) ?? styles$
|
|
1904
|
+
() => currentCategory?.alias ? readAssistantThemeClassName?.(currentCategory.alias) ?? styles$j.genericChat : styles$j.genericChat,
|
|
1885
1905
|
[currentCategory, readAssistantThemeClassName]
|
|
1886
1906
|
);
|
|
1887
1907
|
const isMessageListVisible = !!messages && (!!conversationId || !!showMessagesWithoutConversation) || startingNewConversation || !!error && error !== ConversationErrorType.CONVERSATION_NOT_FOUND;
|
|
@@ -2086,7 +2106,7 @@ const ConversationViewBody = (props) => {
|
|
|
2086
2106
|
const messageColumn = /* @__PURE__ */ jsxs(
|
|
2087
2107
|
"div",
|
|
2088
2108
|
{
|
|
2089
|
-
className: styles$
|
|
2109
|
+
className: styles$j.contentWrapper,
|
|
2090
2110
|
"data-agents-chat-scroll": "",
|
|
2091
2111
|
"data-testid": "chat-messages-scroll",
|
|
2092
2112
|
ref: handleContentWrapperRef,
|
|
@@ -2104,11 +2124,11 @@ const ConversationViewBody = (props) => {
|
|
|
2104
2124
|
onSuggestionClick
|
|
2105
2125
|
}
|
|
2106
2126
|
) : null,
|
|
2107
|
-
!!loadingOlder ? /* @__PURE__ */ jsx("span", { className: styles$
|
|
2127
|
+
!!loadingOlder ? /* @__PURE__ */ jsx("span", { className: styles$j.olderLoading, children: /* @__PURE__ */ jsx(Text, { children: "Loading older messages…" }) }) : null,
|
|
2108
2128
|
isMessageListVisible ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(WidgetWindowRootContext.Provider, { value: scrollContainer, children: /* @__PURE__ */ jsx(
|
|
2109
2129
|
ConversationMessageList,
|
|
2110
2130
|
{
|
|
2111
|
-
className: enablePinQuestionAndRevealAnswer && (conversationId || startingNewConversation || aiThinking || error) ? styles$
|
|
2131
|
+
className: enablePinQuestionAndRevealAnswer && (conversationId || startingNewConversation || aiThinking || error) ? styles$j.topAlignedMessages : void 0,
|
|
2112
2132
|
messages,
|
|
2113
2133
|
currentCategory,
|
|
2114
2134
|
aiPromptExtension,
|
|
@@ -2135,40 +2155,40 @@ const ConversationViewBody = (props) => {
|
|
|
2135
2155
|
"div",
|
|
2136
2156
|
{
|
|
2137
2157
|
className: classNames(
|
|
2138
|
-
styles$
|
|
2139
|
-
background || backgroundPaintedByHost2 ? styles$
|
|
2140
|
-
backgroundPaintedByHost2 ? styles$
|
|
2141
|
-
isCompact ? styles$
|
|
2142
|
-
confineTopBlurBandToChatPane2 ? styles$
|
|
2158
|
+
styles$j.chat,
|
|
2159
|
+
background || backgroundPaintedByHost2 ? styles$j.customBg : colorPalette,
|
|
2160
|
+
backgroundPaintedByHost2 ? styles$j.backgroundPaintedByHost : void 0,
|
|
2161
|
+
isCompact ? styles$j.chatCompact : void 0,
|
|
2162
|
+
confineTopBlurBandToChatPane2 ? styles$j.confineTopBlurBandToChatPane : void 0
|
|
2143
2163
|
),
|
|
2144
2164
|
children: [
|
|
2145
|
-
background ? /* @__PURE__ */ jsx("div", { className: styles$
|
|
2165
|
+
background ? /* @__PURE__ */ jsx("div", { className: styles$j.backgroundLayer, children: background }) : backgroundPaintedByHost2 ? null : AssistantBackground ? /* @__PURE__ */ jsx(AssistantBackground, { category: currentCategory, categoryAlias: currentCategory?.alias ?? void 0 }) : null,
|
|
2146
2166
|
progressStepperSlot,
|
|
2147
|
-
contentOverlaySlot !== void 0 ? /* @__PURE__ */ jsxs("div", { className: styles$
|
|
2167
|
+
contentOverlaySlot !== void 0 ? /* @__PURE__ */ jsxs("div", { className: styles$j.contentLayers, "data-overlay-shown": isContentOverlayShown || void 0, children: [
|
|
2148
2168
|
messageColumn,
|
|
2149
2169
|
/* @__PURE__ */ jsx(
|
|
2150
2170
|
"div",
|
|
2151
2171
|
{
|
|
2152
|
-
className: styles$
|
|
2172
|
+
className: styles$j.contentOverlay,
|
|
2153
2173
|
"aria-hidden": !isContentOverlayShown || void 0,
|
|
2154
2174
|
inert: !isContentOverlayShown || void 0,
|
|
2155
2175
|
children: contentOverlaySlot
|
|
2156
2176
|
}
|
|
2157
2177
|
)
|
|
2158
2178
|
] }) : messageColumn,
|
|
2159
|
-
enablePinQuestionAndRevealAnswer && /* @__PURE__ */ jsx("div", { className: styles$
|
|
2179
|
+
enablePinQuestionAndRevealAnswer && /* @__PURE__ */ jsx("div", { className: styles$j.scrollToLatestAnchor, children: /* @__PURE__ */ jsx(
|
|
2160
2180
|
ConversationScrollToLatestMessageButton,
|
|
2161
2181
|
{
|
|
2162
2182
|
visible: isMessagesBottomOutOfView,
|
|
2163
2183
|
onClick: scrollToLatestMessage
|
|
2164
2184
|
}
|
|
2165
2185
|
) }),
|
|
2166
|
-
inputReplacementSlot ? /* @__PURE__ */ jsx("div", { className: styles$
|
|
2186
|
+
inputReplacementSlot ? /* @__PURE__ */ jsx("div", { className: styles$j.inputReplacement, children: inputReplacementSlot }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2167
2187
|
inputBandSlot,
|
|
2168
2188
|
/* @__PURE__ */ jsx(
|
|
2169
2189
|
ConversationMessageInput,
|
|
2170
2190
|
{
|
|
2171
|
-
className: classNames(styles$
|
|
2191
|
+
className: classNames(styles$j.input, currentCategory?.alias ? styles$j.inputInCategory : void 0),
|
|
2172
2192
|
isProcessing: allowSendWhileAiThinking ? !!startingNewConversation : aiThinking,
|
|
2173
2193
|
onSendMessage,
|
|
2174
2194
|
actionsSlot: inputActionsSlot,
|
|
@@ -2482,7 +2502,7 @@ const tab = "agents_tab_XzVXlj";
|
|
|
2482
2502
|
const tabTop = "agents_tabTop_mAtOHf";
|
|
2483
2503
|
const tabBottom = "agents_tabBottom_JLQcsf";
|
|
2484
2504
|
const tabCircle = "agents_tabCircle_J5jxeo";
|
|
2485
|
-
const styles$
|
|
2505
|
+
const styles$5 = {
|
|
2486
2506
|
handle,
|
|
2487
2507
|
tab,
|
|
2488
2508
|
tabTop,
|
|
@@ -2496,13 +2516,13 @@ const CanvasResizeHandle = (props) => {
|
|
|
2496
2516
|
"div",
|
|
2497
2517
|
{
|
|
2498
2518
|
...handleProps,
|
|
2499
|
-
className: styles$
|
|
2519
|
+
className: styles$5.handle,
|
|
2500
2520
|
"data-tab": tab2,
|
|
2501
2521
|
"aria-label": translateText("Resize canvas"),
|
|
2502
|
-
children: /* @__PURE__ */ jsxs("span", { className: styles$
|
|
2503
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
2504
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
2505
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
2522
|
+
children: /* @__PURE__ */ jsxs("span", { className: styles$5.tab, style: { "--agents-resize-tab-x": `${tabX}px` }, "aria-hidden": "true", children: [
|
|
2523
|
+
/* @__PURE__ */ jsx("span", { className: styles$5.tabCircle }),
|
|
2524
|
+
/* @__PURE__ */ jsx("span", { className: styles$5.tabTop }),
|
|
2525
|
+
/* @__PURE__ */ jsx("span", { className: styles$5.tabBottom })
|
|
2506
2526
|
] })
|
|
2507
2527
|
}
|
|
2508
2528
|
);
|
|
@@ -2611,30 +2631,6 @@ const ConversationView = (props) => {
|
|
|
2611
2631
|
) : null
|
|
2612
2632
|
] });
|
|
2613
2633
|
};
|
|
2614
|
-
const pickPendingStartRequest = (pendingStartUserMessage, pendingStartSignalText) => {
|
|
2615
|
-
if (pendingStartUserMessage) {
|
|
2616
|
-
return { kind: "message", text: pendingStartUserMessage };
|
|
2617
|
-
}
|
|
2618
|
-
if (pendingStartSignalText) {
|
|
2619
|
-
return { kind: "signal", text: pendingStartSignalText };
|
|
2620
|
-
}
|
|
2621
|
-
return null;
|
|
2622
|
-
};
|
|
2623
|
-
const isChatReadyToSendPendingStartRequest = ({
|
|
2624
|
-
pendingStartRequest,
|
|
2625
|
-
activeConversationId,
|
|
2626
|
-
loadedConversationId,
|
|
2627
|
-
startingNewConversation,
|
|
2628
|
-
alreadySentStartRequest
|
|
2629
|
-
}) => {
|
|
2630
|
-
if (!pendingStartRequest) {
|
|
2631
|
-
return false;
|
|
2632
|
-
}
|
|
2633
|
-
if (activeConversationId || loadedConversationId || startingNewConversation) {
|
|
2634
|
-
return false;
|
|
2635
|
-
}
|
|
2636
|
-
return alreadySentStartRequest?.kind !== pendingStartRequest.kind || alreadySentStartRequest.text !== pendingStartRequest.text;
|
|
2637
|
-
};
|
|
2638
2634
|
const STATE_RANK = { queued: 0, running: 1, finished: 2, failed: 2, skipped: 2 };
|
|
2639
2635
|
const mergeActivityElements = (previous, incoming) => {
|
|
2640
2636
|
const byId = new Map(previous.map((element) => [element.toolCallMessageId, element]));
|
|
@@ -2671,7 +2667,7 @@ const LINE_PACE_MS = 2200;
|
|
|
2671
2667
|
const BACKLOG_LINE_PACE_MS = 1400;
|
|
2672
2668
|
const BACKLOG_THRESHOLD = 2;
|
|
2673
2669
|
const MAX_WAITING_LINES = 4;
|
|
2674
|
-
const isStepStillRunning = (
|
|
2670
|
+
const isStepStillRunning = (line2) => line2.state === "queued" || line2.state === "running";
|
|
2675
2671
|
const EMPTY_ACTIVITY_TICKER_QUEUE = {
|
|
2676
2672
|
shownLines: {},
|
|
2677
2673
|
trailIds: [],
|
|
@@ -2691,10 +2687,12 @@ const toTickerLine = (element, toldLine) => {
|
|
|
2691
2687
|
};
|
|
2692
2688
|
};
|
|
2693
2689
|
const isSameLine = (shown, incoming) => !!shown && shown.state === incoming.state && shown.line === incoming.line;
|
|
2690
|
+
const LINE_STATE_RANK = { queued: 0, running: 1, finished: 2, failed: 2, skipped: 2 };
|
|
2691
|
+
const isOlderStateThan = (told, incoming) => !!told && (LINE_STATE_RANK[incoming.state] ?? 0) < (LINE_STATE_RANK[told.state] ?? 0);
|
|
2694
2692
|
const shownLinesInOrder = (queue) => [...queue.trailIds, ...queue.currentId !== null ? [queue.currentId] : []].map((stepId) => queue.shownLines[stepId]).filter(Boolean);
|
|
2695
|
-
const showActivityLine = (queue,
|
|
2696
|
-
const stepId =
|
|
2697
|
-
const shownLines = { ...queue.shownLines, [stepId]:
|
|
2693
|
+
const showActivityLine = (queue, line2, now) => {
|
|
2694
|
+
const stepId = line2.toolCallMessageId;
|
|
2695
|
+
const shownLines = { ...queue.shownLines, [stepId]: line2 };
|
|
2698
2696
|
if (queue.currentId === stepId) {
|
|
2699
2697
|
return { ...queue, shownLines, lastShownAt: now };
|
|
2700
2698
|
}
|
|
@@ -2708,23 +2706,24 @@ const receiveActivityElements = (queue, elements, now) => {
|
|
|
2708
2706
|
let nextQueue = queue;
|
|
2709
2707
|
visibleActivityElements(elements).forEach((element) => {
|
|
2710
2708
|
const stepId = element.toolCallMessageId;
|
|
2711
|
-
const waitingLine = nextQueue.waitingLines.find((
|
|
2709
|
+
const waitingLine = nextQueue.waitingLines.find((line2) => line2.toolCallMessageId === stepId);
|
|
2712
2710
|
const incomingLine = toTickerLine(element, waitingLine ?? nextQueue.shownLines[stepId]);
|
|
2713
2711
|
if (!incomingLine) return;
|
|
2714
|
-
|
|
2712
|
+
const toldLine = waitingLine ?? nextQueue.shownLines[stepId];
|
|
2713
|
+
if (isSameLine(toldLine, incomingLine) || isOlderStateThan(toldLine, incomingLine)) {
|
|
2715
2714
|
return;
|
|
2716
2715
|
}
|
|
2717
2716
|
if (nextQueue.trailIds.includes(stepId)) {
|
|
2718
2717
|
nextQueue = {
|
|
2719
2718
|
...nextQueue,
|
|
2720
2719
|
shownLines: { ...nextQueue.shownLines, [stepId]: incomingLine },
|
|
2721
|
-
waitingLines: nextQueue.waitingLines.filter((
|
|
2720
|
+
waitingLines: nextQueue.waitingLines.filter((line2) => line2.toolCallMessageId !== stepId)
|
|
2722
2721
|
};
|
|
2723
2722
|
return;
|
|
2724
2723
|
}
|
|
2725
2724
|
nextQueue = {
|
|
2726
2725
|
...nextQueue,
|
|
2727
|
-
waitingLines: waitingLine ? nextQueue.waitingLines.map((
|
|
2726
|
+
waitingLines: waitingLine ? nextQueue.waitingLines.map((line2) => line2.toolCallMessageId === stepId ? incomingLine : line2) : [...nextQueue.waitingLines, incomingLine]
|
|
2728
2727
|
};
|
|
2729
2728
|
});
|
|
2730
2729
|
while (nextQueue.waitingLines.length > MAX_WAITING_LINES) {
|
|
@@ -2733,9 +2732,9 @@ const receiveActivityElements = (queue, elements, now) => {
|
|
|
2733
2732
|
}
|
|
2734
2733
|
return nextQueue;
|
|
2735
2734
|
};
|
|
2736
|
-
const msUntilNextActivityLine = (queue, now) => {
|
|
2735
|
+
const msUntilNextActivityLine = (queue, now, linePaceMs = LINE_PACE_MS, backlogLinePaceMs = BACKLOG_LINE_PACE_MS) => {
|
|
2737
2736
|
if (queue.waitingLines.length === 0) return null;
|
|
2738
|
-
const pace = queue.waitingLines.length > BACKLOG_THRESHOLD ?
|
|
2737
|
+
const pace = queue.waitingLines.length > BACKLOG_THRESHOLD ? backlogLinePaceMs : linePaceMs;
|
|
2739
2738
|
return Math.max(0, queue.lastShownAt + pace - now);
|
|
2740
2739
|
};
|
|
2741
2740
|
const releaseNextActivityLine = (queue, now) => {
|
|
@@ -2777,9 +2776,9 @@ const INITIAL_ACTIVITY_TICKER_STATE = {
|
|
|
2777
2776
|
keptTurns: [],
|
|
2778
2777
|
wasRunning: false
|
|
2779
2778
|
};
|
|
2780
|
-
const
|
|
2781
|
-
|
|
2782
|
-
return
|
|
2779
|
+
const isReadOfAnotherTurn = (state, turnMessageId, turnStarted) => {
|
|
2780
|
+
if (state.turnMessageId !== null && turnMessageId !== null && turnMessageId !== state.turnMessageId) return true;
|
|
2781
|
+
return turnStarted && state.phase !== "live" && (turnMessageId === null || turnMessageId !== state.turnMessageId);
|
|
2783
2782
|
};
|
|
2784
2783
|
const keptTurnsWithFinishedTurn = (state) => {
|
|
2785
2784
|
const { phase, turnMessageId, queue, keptTurns } = state;
|
|
@@ -2795,7 +2794,7 @@ const activityTickerReducer = (state, action) => {
|
|
|
2795
2794
|
const { elements, running, failed, keepHistory, now } = action;
|
|
2796
2795
|
const turnStarted = running && !state.wasRunning;
|
|
2797
2796
|
const turnEnded = !running && state.wasRunning;
|
|
2798
|
-
const startsClean =
|
|
2797
|
+
const startsClean = isReadOfAnotherTurn(state, action.turnMessageId, turnStarted);
|
|
2799
2798
|
const queue = receiveActivityElements(startsClean ? EMPTY_ACTIVITY_TICKER_QUEUE : state.queue, elements, now);
|
|
2800
2799
|
let nextState = {
|
|
2801
2800
|
...state,
|
|
@@ -2845,7 +2844,16 @@ const toKeptTurn = (keptTurn) => ({
|
|
|
2845
2844
|
liveSince: null
|
|
2846
2845
|
});
|
|
2847
2846
|
const useActivityTicker = (params) => {
|
|
2848
|
-
const {
|
|
2847
|
+
const {
|
|
2848
|
+
elements,
|
|
2849
|
+
running,
|
|
2850
|
+
turnMessageId = null,
|
|
2851
|
+
failed = false,
|
|
2852
|
+
keepActivityHistoryAfterAnswer = false,
|
|
2853
|
+
linePaceMs = LINE_PACE_MS,
|
|
2854
|
+
backlogLinePaceMs = BACKLOG_LINE_PACE_MS,
|
|
2855
|
+
successBeatMs = SUCCESS_BEAT_MS
|
|
2856
|
+
} = params;
|
|
2849
2857
|
const [state, dispatch] = useReducer(activityTickerReducer, INITIAL_ACTIVITY_TICKER_STATE);
|
|
2850
2858
|
useEffect(() => {
|
|
2851
2859
|
dispatch({
|
|
@@ -2860,26 +2868,26 @@ const useActivityTicker = (params) => {
|
|
|
2860
2868
|
}, [elements, running, failed, turnMessageId]);
|
|
2861
2869
|
useEffect(() => {
|
|
2862
2870
|
if (state.phase !== "live") return void 0;
|
|
2863
|
-
const waitMs = msUntilNextActivityLine(state.queue, Date.now());
|
|
2871
|
+
const waitMs = msUntilNextActivityLine(state.queue, Date.now(), linePaceMs, backlogLinePaceMs);
|
|
2864
2872
|
if (waitMs === null) return void 0;
|
|
2865
2873
|
const timer = setTimeout(() => dispatch({ type: "nextLineDue", now: Date.now() }), waitMs);
|
|
2866
2874
|
return () => clearTimeout(timer);
|
|
2867
|
-
}, [state.phase, state.queue]);
|
|
2875
|
+
}, [state.phase, state.queue, linePaceMs, backlogLinePaceMs]);
|
|
2868
2876
|
useEffect(() => {
|
|
2869
2877
|
if (state.phase !== "done") return void 0;
|
|
2870
2878
|
const timer = setTimeout(
|
|
2871
2879
|
() => dispatch({ type: "doneBeatOver", keepHistory: keepActivityHistoryAfterAnswer }),
|
|
2872
|
-
|
|
2880
|
+
successBeatMs
|
|
2873
2881
|
);
|
|
2874
2882
|
return () => clearTimeout(timer);
|
|
2875
|
-
}, [state.phase, keepActivityHistoryAfterAnswer]);
|
|
2883
|
+
}, [state.phase, keepActivityHistoryAfterAnswer, successBeatMs]);
|
|
2876
2884
|
return useMemo(() => {
|
|
2877
2885
|
const { queue, phase } = state;
|
|
2878
|
-
const
|
|
2879
|
-
const currentTurn = phase !== "idle" &&
|
|
2886
|
+
const lines2 = shownLinesInOrder(queue);
|
|
2887
|
+
const currentTurn = phase !== "idle" && lines2.length > 0 ? {
|
|
2880
2888
|
turnMessageId: state.turnMessageId,
|
|
2881
2889
|
phase,
|
|
2882
|
-
lines,
|
|
2890
|
+
lines: lines2,
|
|
2883
2891
|
stepCount: countFinishedSteps(elements),
|
|
2884
2892
|
helperCount: phase === "live" ? countWorkingHelpers(elements) : 0,
|
|
2885
2893
|
liveSince: phase === "live" ? state.liveSince : null
|
|
@@ -2897,7 +2905,9 @@ const useConversationActivity = ({
|
|
|
2897
2905
|
conversationId,
|
|
2898
2906
|
runStatus,
|
|
2899
2907
|
signalVersion,
|
|
2900
|
-
enabled = true
|
|
2908
|
+
enabled = true,
|
|
2909
|
+
activityRequestWindowMs = ACTIVITY_REQUEST_WINDOW_MS,
|
|
2910
|
+
runningFloorMs = RUNNING_FLOOR_MS
|
|
2901
2911
|
}) => {
|
|
2902
2912
|
const conversationClient = useAgentsConversationClient();
|
|
2903
2913
|
const [elements, setElements] = useState([]);
|
|
@@ -2963,7 +2973,7 @@ const useConversationActivity = ({
|
|
|
2963
2973
|
return;
|
|
2964
2974
|
}
|
|
2965
2975
|
const sinceLast = Date.now() - lastRequestAtRef.current;
|
|
2966
|
-
if (sinceLast >=
|
|
2976
|
+
if (sinceLast >= activityRequestWindowMs) {
|
|
2967
2977
|
void performRequest();
|
|
2968
2978
|
return;
|
|
2969
2979
|
}
|
|
@@ -2971,10 +2981,10 @@ const useConversationActivity = ({
|
|
|
2971
2981
|
trailingTimerRef.current = setTimeout(() => {
|
|
2972
2982
|
trailingTimerRef.current = null;
|
|
2973
2983
|
void performRequest();
|
|
2974
|
-
},
|
|
2984
|
+
}, activityRequestWindowMs - sinceLast);
|
|
2975
2985
|
}
|
|
2976
2986
|
},
|
|
2977
|
-
[performRequest]
|
|
2987
|
+
[performRequest, activityRequestWindowMs]
|
|
2978
2988
|
);
|
|
2979
2989
|
useEffect(() => {
|
|
2980
2990
|
requestActivityRef.current = requestActivity;
|
|
@@ -3005,7 +3015,7 @@ const useConversationActivity = ({
|
|
|
3005
3015
|
}, [signalVersion, requestActivity]);
|
|
3006
3016
|
useEffect(() => {
|
|
3007
3017
|
if (!enabled || runStatus !== "running" && !running) return;
|
|
3008
|
-
const interval = setInterval(() => requestActivity(),
|
|
3018
|
+
const interval = setInterval(() => requestActivity(), runningFloorMs);
|
|
3009
3019
|
const onVisibilityChange = () => {
|
|
3010
3020
|
if (!document.hidden) requestActivity(true);
|
|
3011
3021
|
};
|
|
@@ -3014,7 +3024,7 @@ const useConversationActivity = ({
|
|
|
3014
3024
|
clearInterval(interval);
|
|
3015
3025
|
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
3016
3026
|
};
|
|
3017
|
-
}, [enabled, runStatus, running, requestActivity]);
|
|
3027
|
+
}, [enabled, runStatus, running, requestActivity, runningFloorMs]);
|
|
3018
3028
|
useEffect(() => {
|
|
3019
3029
|
turnMessageIdRef.current = null;
|
|
3020
3030
|
setTurnMessageId(null);
|
|
@@ -3031,6 +3041,46 @@ const useConversationActivity = ({
|
|
|
3031
3041
|
}, [conversationId]);
|
|
3032
3042
|
return { elements, running, turnMessageId };
|
|
3033
3043
|
};
|
|
3044
|
+
const DEFAULT_AGENT_CHAT_ACTIVITY_TIMING = {
|
|
3045
|
+
activityRequestWindowMs: ACTIVITY_REQUEST_WINDOW_MS,
|
|
3046
|
+
runningFloorMs: RUNNING_FLOOR_MS,
|
|
3047
|
+
linePaceMs: LINE_PACE_MS,
|
|
3048
|
+
backlogLinePaceMs: BACKLOG_LINE_PACE_MS,
|
|
3049
|
+
successBeatMs: SUCCESS_BEAT_MS
|
|
3050
|
+
};
|
|
3051
|
+
const isUsableMilliseconds = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
3052
|
+
const resolveAgentChatActivityTiming = (...sources) => {
|
|
3053
|
+
const resolved = { ...DEFAULT_AGENT_CHAT_ACTIVITY_TIMING };
|
|
3054
|
+
Object.keys(resolved).forEach((key) => {
|
|
3055
|
+
const source = sources.find((candidate) => isUsableMilliseconds(candidate?.[key]));
|
|
3056
|
+
if (source) resolved[key] = source[key];
|
|
3057
|
+
});
|
|
3058
|
+
return resolved;
|
|
3059
|
+
};
|
|
3060
|
+
const pickPendingStartRequest = (pendingStartUserMessage, pendingStartSignalText) => {
|
|
3061
|
+
if (pendingStartUserMessage) {
|
|
3062
|
+
return { kind: "message", text: pendingStartUserMessage };
|
|
3063
|
+
}
|
|
3064
|
+
if (pendingStartSignalText) {
|
|
3065
|
+
return { kind: "signal", text: pendingStartSignalText };
|
|
3066
|
+
}
|
|
3067
|
+
return null;
|
|
3068
|
+
};
|
|
3069
|
+
const isChatReadyToSendPendingStartRequest = ({
|
|
3070
|
+
pendingStartRequest,
|
|
3071
|
+
activeConversationId,
|
|
3072
|
+
loadedConversationId,
|
|
3073
|
+
startingNewConversation,
|
|
3074
|
+
alreadySentStartRequest
|
|
3075
|
+
}) => {
|
|
3076
|
+
if (!pendingStartRequest) {
|
|
3077
|
+
return false;
|
|
3078
|
+
}
|
|
3079
|
+
if (activeConversationId || loadedConversationId || startingNewConversation) {
|
|
3080
|
+
return false;
|
|
3081
|
+
}
|
|
3082
|
+
return alreadySentStartRequest?.kind !== pendingStartRequest.kind || alreadySentStartRequest.text !== pendingStartRequest.text;
|
|
3083
|
+
};
|
|
3034
3084
|
const LIVE_READ_THROTTLE_MS = 1200;
|
|
3035
3085
|
const CONVERGENCE_BASE_DELAY_MS = 700;
|
|
3036
3086
|
const CONVERGENCE_MAX_DELAY_MS = 2500;
|
|
@@ -3447,13 +3497,13 @@ const parseWidgetType = (jsonCandidate) => {
|
|
|
3447
3497
|
};
|
|
3448
3498
|
const extractNakedJsonCandidates = (plainText) => {
|
|
3449
3499
|
const candidates = [];
|
|
3450
|
-
const
|
|
3500
|
+
const lines2 = plainText.split("\n");
|
|
3451
3501
|
let offset = 0;
|
|
3452
|
-
for (const
|
|
3502
|
+
for (const line2 of lines2) {
|
|
3453
3503
|
const lineStart = offset;
|
|
3454
|
-
offset +=
|
|
3455
|
-
if (!
|
|
3456
|
-
const openIndex = lineStart +
|
|
3504
|
+
offset += line2.length + 1;
|
|
3505
|
+
if (!line2.trimStart().startsWith("{")) continue;
|
|
3506
|
+
const openIndex = lineStart + line2.indexOf("{");
|
|
3457
3507
|
const jsonObjectEnd = findBalancedJsonObjectEnd(plainText, openIndex);
|
|
3458
3508
|
if (jsonObjectEnd !== null) {
|
|
3459
3509
|
candidates.push(plainText.slice(openIndex, jsonObjectEnd + 1));
|
|
@@ -3653,6 +3703,7 @@ const AgentChatController = (props) => {
|
|
|
3653
3703
|
initialComposerPrompt,
|
|
3654
3704
|
scrollTarget,
|
|
3655
3705
|
keepActivityHistoryAfterAnswer = false,
|
|
3706
|
+
activityTiming,
|
|
3656
3707
|
isPinnedToSingleConversation = false,
|
|
3657
3708
|
isOnboardingSetupConversation = false,
|
|
3658
3709
|
sendModelSource,
|
|
@@ -3768,6 +3819,11 @@ const AgentChatController = (props) => {
|
|
|
3768
3819
|
messagePages,
|
|
3769
3820
|
conversationId: liveConversationId
|
|
3770
3821
|
});
|
|
3822
|
+
const { chatActivityTiming: environmentActivityTiming } = useAgentsEnvironment();
|
|
3823
|
+
const resolvedActivityTiming = useMemo(
|
|
3824
|
+
() => resolveAgentChatActivityTiming(activityTiming, environmentActivityTiming),
|
|
3825
|
+
[activityTiming, environmentActivityTiming]
|
|
3826
|
+
);
|
|
3771
3827
|
const {
|
|
3772
3828
|
elements: activityElements,
|
|
3773
3829
|
running: activityRunning,
|
|
@@ -3775,16 +3831,21 @@ const AgentChatController = (props) => {
|
|
|
3775
3831
|
} = useConversationActivity({
|
|
3776
3832
|
conversationId: liveConversationId ?? 0,
|
|
3777
3833
|
runStatus,
|
|
3778
|
-
// Every live read also asks for the activity lines; the hook throttles to one request per 3 s.
|
|
3834
|
+
// Every live read also asks for the activity lines; the hook throttles to one request per read window (3 s default).
|
|
3779
3835
|
signalVersion: liveReadCount,
|
|
3780
|
-
enabled: Boolean(liveConversationId)
|
|
3836
|
+
enabled: Boolean(liveConversationId),
|
|
3837
|
+
activityRequestWindowMs: resolvedActivityTiming.activityRequestWindowMs,
|
|
3838
|
+
runningFloorMs: resolvedActivityTiming.runningFloorMs
|
|
3781
3839
|
});
|
|
3782
3840
|
const activityTicker = useActivityTicker({
|
|
3783
3841
|
elements: activityElements,
|
|
3784
3842
|
running: activityRunning,
|
|
3785
3843
|
turnMessageId: activityTurnMessageId,
|
|
3786
3844
|
failed: !!error,
|
|
3787
|
-
keepActivityHistoryAfterAnswer
|
|
3845
|
+
keepActivityHistoryAfterAnswer,
|
|
3846
|
+
linePaceMs: resolvedActivityTiming.linePaceMs,
|
|
3847
|
+
backlogLinePaceMs: resolvedActivityTiming.backlogLinePaceMs,
|
|
3848
|
+
successBeatMs: resolvedActivityTiming.successBeatMs
|
|
3788
3849
|
});
|
|
3789
3850
|
useEffect(() => {
|
|
3790
3851
|
if (runStatus === "failed") {
|
|
@@ -4000,7 +4061,8 @@ const AgentChatController = (props) => {
|
|
|
4000
4061
|
failed: !!error,
|
|
4001
4062
|
activityTicker,
|
|
4002
4063
|
isAgentWorkingOnTask: agentActivity.active || activityTicker.phase === "live",
|
|
4003
|
-
agentSpaceKey
|
|
4064
|
+
agentSpaceKey,
|
|
4065
|
+
activityTiming: resolvedActivityTiming
|
|
4004
4066
|
};
|
|
4005
4067
|
return /* @__PURE__ */ jsx(CanvasViabilityContext.Provider, { value: canvasViability, children: /* @__PURE__ */ jsx(WidgetRenderReportCollectorContext.Provider, { value: renderReportCollector, children: /* @__PURE__ */ jsxs(
|
|
4006
4068
|
ConversationWidgetProvider,
|
|
@@ -4083,7 +4145,7 @@ const AgentChatController = (props) => {
|
|
|
4083
4145
|
const chatArea = "agents_chatArea_4XiCda";
|
|
4084
4146
|
const chatAreaWithTopBlurBand = "agents_chatAreaWithTopBlurBand_W-AdU0";
|
|
4085
4147
|
const chatWrap = "agents_chatWrap_yS-zs5";
|
|
4086
|
-
const styles$
|
|
4148
|
+
const styles$4 = {
|
|
4087
4149
|
chatArea,
|
|
4088
4150
|
chatAreaWithTopBlurBand,
|
|
4089
4151
|
chatWrap
|
|
@@ -4102,7 +4164,7 @@ const AgentChat = (props) => {
|
|
|
4102
4164
|
onNewConversation,
|
|
4103
4165
|
inputReplacementSlot,
|
|
4104
4166
|
chatAreaClassName,
|
|
4105
|
-
chatWrapClassName = styles$
|
|
4167
|
+
chatWrapClassName = styles$4.chatWrap,
|
|
4106
4168
|
showsTopBlurBand = false,
|
|
4107
4169
|
confineTopBlurBandToChatPane: confineTopBlurBandToChatPane2 = showsTopBlurBand,
|
|
4108
4170
|
...controllerProps
|
|
@@ -4152,11 +4214,65 @@ const AgentChat = (props) => {
|
|
|
4152
4214
|
ThinkingIndicator,
|
|
4153
4215
|
ActivityHistory,
|
|
4154
4216
|
inputReplacementSlot: inputReplacementSlot ?? (isConversationRunEnded ? /* @__PURE__ */ jsx(ConversationClosedBar, {}) : void 0),
|
|
4155
|
-
chatAreaClassName: chatAreaClassName ?? classNames(styles$
|
|
4217
|
+
chatAreaClassName: chatAreaClassName ?? classNames(styles$4.chatArea, showsTopBlurBand ? styles$4.chatAreaWithTopBlurBand : void 0),
|
|
4156
4218
|
chatWrapClassName
|
|
4157
4219
|
}
|
|
4158
4220
|
) });
|
|
4159
4221
|
};
|
|
4222
|
+
const stack = "agents_stack_qYED72";
|
|
4223
|
+
const visual = "agents_visual_44ItL8";
|
|
4224
|
+
const waiting = "agents_waiting_jFvZ9-";
|
|
4225
|
+
const lines = "agents_lines_cZJ4if";
|
|
4226
|
+
const line = "agents_line_kzizwA";
|
|
4227
|
+
const fadingOut = "agents_fadingOut_5YOpm-";
|
|
4228
|
+
const statusRegion = "agents_statusRegion_8U17AD";
|
|
4229
|
+
const styles$3 = {
|
|
4230
|
+
stack,
|
|
4231
|
+
visual,
|
|
4232
|
+
waiting,
|
|
4233
|
+
lines,
|
|
4234
|
+
line,
|
|
4235
|
+
fadingOut,
|
|
4236
|
+
statusRegion
|
|
4237
|
+
};
|
|
4238
|
+
const ACTIVITY_STACK_VISIBLE_LINES = 4;
|
|
4239
|
+
const MIN_RANK_MOVE_MS = 160;
|
|
4240
|
+
const MAX_RANK_MOVE_MS = 520;
|
|
4241
|
+
const AgentChatActivityStack = (props) => {
|
|
4242
|
+
const { active, failed, activityTicker, activityTiming = DEFAULT_AGENT_CHAT_ACTIVITY_TIMING } = props;
|
|
4243
|
+
const texts = useAgentsTexts();
|
|
4244
|
+
const { phase, currentTurn } = activityTicker;
|
|
4245
|
+
const lines2 = currentTurn?.lines ?? [];
|
|
4246
|
+
const isWorking = !failed && (active || phase === "live");
|
|
4247
|
+
const isFadingOut = !failed && phase === "done" && lines2.length > 0;
|
|
4248
|
+
if (!isWorking && !isFadingOut) return null;
|
|
4249
|
+
const stackedLines = lines2.slice(-ACTIVITY_STACK_VISIBLE_LINES);
|
|
4250
|
+
const newestSentence = lines2.length > 0 ? lines2[lines2.length - 1].line : null;
|
|
4251
|
+
const rankMoveMs = Math.min(MAX_RANK_MOVE_MS, Math.max(MIN_RANK_MOVE_MS, Math.round(activityTiming.linePaceMs / 4)));
|
|
4252
|
+
const timingStyle = {
|
|
4253
|
+
"--agents-activity-stack-move-duration": `${rankMoveMs}ms`,
|
|
4254
|
+
"--agents-activity-stack-fade-duration": `${activityTiming.successBeatMs}ms`
|
|
4255
|
+
};
|
|
4256
|
+
return /* @__PURE__ */ jsxs(
|
|
4257
|
+
"div",
|
|
4258
|
+
{
|
|
4259
|
+
className: classNames(styles$3.stack, isFadingOut && styles$3.fadingOut),
|
|
4260
|
+
style: timingStyle,
|
|
4261
|
+
"data-testid": "agent-chat-activity-stack",
|
|
4262
|
+
"data-phase": isFadingOut ? "done" : "live",
|
|
4263
|
+
children: [
|
|
4264
|
+
/* @__PURE__ */ jsx("div", { className: styles$3.visual, "aria-hidden": "true", children: stackedLines.length === 0 ? /* @__PURE__ */ jsxs("div", { className: styles$3.waiting, children: [
|
|
4265
|
+
/* @__PURE__ */ jsx(AgentChatActivityDots, { variant: "pulse" }),
|
|
4266
|
+
/* @__PURE__ */ jsx(Text, { role: "help", color: "--agents-fg-light", children: "Working on it…" })
|
|
4267
|
+
] }) : /* @__PURE__ */ jsx("ol", { className: styles$3.lines, children: stackedLines.map((line2, index) => {
|
|
4268
|
+
const rank = stackedLines.length - 1 - index;
|
|
4269
|
+
return /* @__PURE__ */ jsx("li", { className: styles$3.line, "data-rank": rank, children: /* @__PURE__ */ jsx(Text, { role: "help", color: rank === 0 ? "--agents-fg" : "--agents-fg-light", translate: false, ellipsis: true, children: line2.line }) }, line2.toolCallMessageId);
|
|
4270
|
+
}) }) }),
|
|
4271
|
+
/* @__PURE__ */ jsx("div", { className: styles$3.statusRegion, role: "status", "aria-live": "polite", "data-testid": "agent-chat-activity-stack-status", children: newestSentence ?? texts.translate("Working on it…") })
|
|
4272
|
+
]
|
|
4273
|
+
}
|
|
4274
|
+
);
|
|
4275
|
+
};
|
|
4160
4276
|
const useDebouncedSemanticSearch = (fetcher, enabled) => {
|
|
4161
4277
|
const [query, setQuery] = useState("");
|
|
4162
4278
|
const [results, setResults] = useState(null);
|
|
@@ -4430,9 +4546,12 @@ const ConversationMessageInputAttachmentsPreviewStrip = (props) => {
|
|
|
4430
4546
|
);
|
|
4431
4547
|
};
|
|
4432
4548
|
export {
|
|
4549
|
+
ACTIVITY_STACK_VISIBLE_LINES,
|
|
4433
4550
|
AgentChat,
|
|
4551
|
+
AgentChatActivityDots,
|
|
4434
4552
|
AgentChatActivityHistory,
|
|
4435
4553
|
AgentChatActivityIndicator,
|
|
4554
|
+
AgentChatActivityStack,
|
|
4436
4555
|
AgentChatController,
|
|
4437
4556
|
A as AgentsChatStateContainer,
|
|
4438
4557
|
d as AgentsChatStoreProvider,
|
|
@@ -4452,6 +4571,7 @@ export {
|
|
|
4452
4571
|
ConversationMessageWidgets,
|
|
4453
4572
|
ConversationView,
|
|
4454
4573
|
ConversationWidgetProvider,
|
|
4574
|
+
DEFAULT_AGENT_CHAT_ACTIVITY_TIMING,
|
|
4455
4575
|
E as EMPTY_AGENTS_CHAT_OPENING_REQUEST,
|
|
4456
4576
|
I as INITIAL_AGENTS_CHAT_STATE,
|
|
4457
4577
|
MAX_MESSAGE_LENGTH,
|
|
@@ -4465,6 +4585,7 @@ export {
|
|
|
4465
4585
|
normalizeServerMessageToMarkdown,
|
|
4466
4586
|
r as readConversationErrorTypeOfRefusedSend,
|
|
4467
4587
|
e as reduceAgentsChatState,
|
|
4588
|
+
resolveAgentChatActivityTiming,
|
|
4468
4589
|
useActivityTicker,
|
|
4469
4590
|
useAgentsChatSelector,
|
|
4470
4591
|
f as useAgentsChatState,
|