@mgamadeus/ddd-agents 0.1.1 → 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 +129 -0
- package/dist/chat.js +407 -265
- package/dist/chat.js.map +1 -1
- package/dist/chunks/{ConversationMessageInputComposerWidgets-BO3jS0eZ.js → ConversationMessageInputComposerWidgets-r_RwCqr7.js} +11 -8
- package/dist/chunks/ConversationMessageInputComposerWidgets-r_RwCqr7.js.map +1 -0
- package/dist/chunks/{WebSearchResultsConversationWidget-H6cbTapV.js → WebSearchResultsConversationWidget-BXt98hGu.js} +161 -102
- package/dist/chunks/WebSearchResultsConversationWidget-BXt98hGu.js.map +1 -0
- package/dist/chunks/{canvas-behaviours-AvzKSYyv.js → canvas-behaviours-BpN_1xdZ.js} +2 -2
- package/dist/chunks/{canvas-behaviours-AvzKSYyv.js.map → canvas-behaviours-BpN_1xdZ.js.map} +1 -1
- package/dist/chunks/{canvas-reducers-Cdxt8yDF.js → canvas-reducers-CuX6L1zg.js} +3 -3
- package/dist/chunks/{canvas-reducers-Cdxt8yDF.js.map → canvas-reducers-CuX6L1zg.js.map} +1 -1
- package/dist/chunks/{canvasBodies-CsLrZ-M-.js → canvasBodies-Ds-cTn47.js} +9 -6
- package/dist/chunks/{canvasBodies-CsLrZ-M-.js.map → canvasBodies-Ds-cTn47.js.map} +1 -1
- package/dist/chunks/{canvasStorage-EvQsGdto.js → canvasStorage-DHNluopA.js} +2 -2
- package/dist/chunks/{canvasStorage-EvQsGdto.js.map → canvasStorage-DHNluopA.js.map} +1 -1
- package/dist/chunks/compose-attachment-message-text-FvVJbrge.js +8 -0
- package/dist/chunks/compose-attachment-message-text-FvVJbrge.js.map +1 -0
- package/dist/chunks/{contract-BxmMxYPF.js → contract-kmmw_19Y.js} +5 -4
- package/dist/chunks/contract-kmmw_19Y.js.map +1 -0
- package/dist/chunks/{conversation-BEF0aesf.js → conversation-CbWEHPbL.js} +12 -3
- package/dist/chunks/conversation-CbWEHPbL.js.map +1 -0
- package/dist/chunks/host-color-scheme-Jhb7JZR7.js +30 -0
- package/dist/chunks/host-color-scheme-Jhb7JZR7.js.map +1 -0
- package/dist/chunks/{index-7Qc_3GbG.js → link-navigation-DyTApNeA.js} +156 -73
- package/dist/chunks/link-navigation-DyTApNeA.js.map +1 -0
- package/dist/chunks/text-key-DnoZ4lAk.js +6 -0
- package/dist/chunks/text-key-DnoZ4lAk.js.map +1 -0
- package/dist/chunks/{widget-click-signal-sources-1gIs1yiN.js → widget-click-signal-sources-Ch-y8gxw.js} +9 -5
- package/dist/chunks/{widget-click-signal-sources-1gIs1yiN.js.map → widget-click-signal-sources-Ch-y8gxw.js.map} +1 -1
- package/dist/chunks/{widget-image-readiness-signal-D3ci53xr.js → widget-image-readiness-signal-C5yaKpJJ.js} +2 -2
- package/dist/chunks/{widget-image-readiness-signal-D3ci53xr.js.map → widget-image-readiness-signal-C5yaKpJJ.js.map} +1 -1
- package/dist/chunks/{widget-name-resolver-D_ZzXy-Q.js → widget-name-resolver-DboFMAq2.js} +25 -25
- package/dist/chunks/widget-name-resolver-DboFMAq2.js.map +1 -0
- package/dist/chunks/{withPollingChangeSubscription-B16htQGd.js → withPollingChangeSubscription-CWavoKjJ.js} +7 -3
- package/dist/chunks/withPollingChangeSubscription-CWavoKjJ.js.map +1 -0
- package/dist/client-testing.js +7 -8
- package/dist/client-testing.js.map +1 -1
- package/dist/client.js +470 -2
- package/dist/client.js.map +1 -1
- package/dist/contract.js +6 -5
- package/dist/files/chat/Conversation.module.scss +1 -1
- package/dist/files/chat/ConversationViewBody/ConversationViewBody.module.scss +1 -1
- package/dist/files/i18n-keys.json +1636 -0
- package/dist/files/image-render/WidgetImageRender.module.scss +9 -3
- package/dist/files/styles/_surfaces.scss +6 -6
- package/dist/image-render.js +7 -7
- package/dist/index.js +64 -55
- package/dist/index.js.map +1 -1
- package/dist/kit.js +2 -2
- package/dist/preview.js +8 -8
- package/dist/provider.js +61 -52
- package/dist/provider.js.map +1 -1
- package/dist/renderer.js +16 -15
- package/dist/styles.css +318 -122
- package/dist/types/chat/AgentChat/AgentChat.d.ts +6 -0
- 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 +38 -1
- 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/AgentsConversationClient.d.ts +7 -1
- package/dist/types/client/compose-attachment-message-text.d.ts +7 -0
- package/dist/types/client/http/agents-http-mappers.d.ts +30 -0
- package/dist/types/client/http/agents-http-wire.d.ts +201 -0
- package/dist/types/client/http/createAgentsHttpConversationClient.d.ts +64 -0
- package/dist/types/client/polling/createPollingConversationChangeSubscription.d.ts +7 -4
- package/dist/types/client/polling/withPollingChangeSubscription.d.ts +3 -2
- package/dist/types/contract/conversation.d.ts +35 -0
- package/dist/types/entries/chat.d.ts +6 -2
- package/dist/types/entries/client.d.ts +4 -0
- package/dist/types/entries/renderer.d.ts +1 -0
- package/dist/types/entries/widgets.d.ts +1 -1
- package/dist/types/provider/components/types.d.ts +5 -2
- package/dist/types/provider/environment.d.ts +20 -0
- package/dist/types/provider/host-color-scheme.d.ts +24 -0
- package/dist/types/provider/index.d.ts +4 -0
- package/dist/types/provider/link-navigation.d.ts +28 -0
- package/dist/types/provider/text-key.d.ts +6 -0
- package/dist/types/renderer/MarkdownLink.d.ts +8 -6
- package/dist/types/widgets/CanvasLauncherWidget/use-canvas-viable.d.ts +43 -9
- package/dist/types/widgets/EntityMentionConversationWidget/shared/entity-mention-presentation.d.ts +1 -1
- package/dist/types/widgets/_shared/modern/WidgetKpiValue.d.ts +2 -1
- package/dist/widgets.js +43 -40
- package/package.json +4 -2
- package/public-api.json +101 -18
- package/dist/chunks/ConversationMessageInputComposerWidgets-BO3jS0eZ.js.map +0 -1
- package/dist/chunks/WebSearchResultsConversationWidget-H6cbTapV.js.map +0 -1
- package/dist/chunks/contract-BxmMxYPF.js.map +0 -1
- package/dist/chunks/conversation-BEF0aesf.js.map +0 -1
- package/dist/chunks/index-7Qc_3GbG.js.map +0 -1
- package/dist/chunks/widget-name-resolver-D_ZzXy-Q.js.map +0 -1
- package/dist/chunks/withPollingChangeSubscription-B16htQGd.js.map +0 -1
package/dist/chat.js
CHANGED
|
@@ -1,58 +1,74 @@
|
|
|
1
1
|
"use client";
|
|
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
|
-
import { u as useAgentsConversationClient, a as useOptionalAgentsConversationClient } from "./chunks/AgentsConversationClientContext-C4T7g_Qk.js";
|
|
5
|
-
import { w as withPollingChangeSubscription } from "./chunks/withPollingChangeSubscription-
|
|
6
|
-
import {
|
|
7
|
-
import { i as isAgentsClientError,
|
|
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-
|
|
9
|
-
import { E as useConversationWidgetContext, p as payloadHashOfInstanceId, j as buildWidgetAgentSpaceKeyProps,
|
|
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-
|
|
11
|
-
import { r as readStoredCanvas, c as clearStoredCanvas } from "./chunks/canvasStorage-
|
|
12
|
-
import { r as resolveDeepLinkableWidget, c as WidgetWindowRootContext, C as ConversationMarkdown, i as isWidgetClickSignalSource, b as buildWidgetRenderReportSignal, W as WIDGET_RENDER_REPORT_SIGNAL_SOURCE, e as createWidgetRenderReportCollector, f as WidgetRenderReportCollectorContext } from "./chunks/widget-click-signal-sources-
|
|
13
|
-
import { b as ConversationErrorType, a as ConversationMessageInputComposerWidgets, u as useAgentsChatSelector, C as ConversationWidgetProvider, c as createAgentsChatStore } from "./chunks/ConversationMessageInputComposerWidgets-
|
|
14
|
-
import { A, d, E, I, r, e, f, g, h } from "./chunks/ConversationMessageInputComposerWidgets-
|
|
15
|
-
import {
|
|
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-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
|
+
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
|
+
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
|
+
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";
|
|
11
|
+
import { r as readStoredCanvas, c as clearStoredCanvas } from "./chunks/canvasStorage-DHNluopA.js";
|
|
12
|
+
import { r as resolveDeepLinkableWidget, c as WidgetWindowRootContext, C as ConversationMarkdown, i as isWidgetClickSignalSource, b as buildWidgetRenderReportSignal, W as WIDGET_RENDER_REPORT_SIGNAL_SOURCE, e as createWidgetRenderReportCollector, f as WidgetRenderReportCollectorContext } from "./chunks/widget-click-signal-sources-Ch-y8gxw.js";
|
|
13
|
+
import { b as ConversationErrorType, a as ConversationMessageInputComposerWidgets, u as useAgentsChatSelector, C as ConversationWidgetProvider, c as createAgentsChatStore } from "./chunks/ConversationMessageInputComposerWidgets-r_RwCqr7.js";
|
|
14
|
+
import { A, d, E, I, r, e, f, g, h } from "./chunks/ConversationMessageInputComposerWidgets-r_RwCqr7.js";
|
|
15
|
+
import { t as textKey } from "./chunks/text-key-DnoZ4lAk.js";
|
|
16
|
+
import { c as canvasBodies } from "./chunks/canvasBodies-Ds-cTn47.js";
|
|
16
17
|
import { c as canvasFeatureFlagOf } from "./chunks/canvas-feature-flags-BmmxC3bz.js";
|
|
17
18
|
import { flushSync } from "react-dom";
|
|
18
|
-
import { b as buildChangedMessagesRequest, d as deriveAgentActivity } from "./chunks/contract-
|
|
19
|
+
import { b as buildChangedMessagesRequest, d as deriveAgentActivity } from "./chunks/contract-kmmw_19Y.js";
|
|
19
20
|
const history = "agents_history_BIbikt";
|
|
20
|
-
const styles$
|
|
21
|
+
const styles$n = {
|
|
21
22
|
history
|
|
22
23
|
};
|
|
23
24
|
const AgentChatActivityHistory = (props) => {
|
|
24
25
|
const { turn } = props;
|
|
25
26
|
if (turn === null || turn.lines.length === 0) return null;
|
|
26
|
-
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
|
|
27
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
|
+
);
|
|
28
50
|
const activity = "agents_activity_Gv-0ee";
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
activity,
|
|
32
|
-
dots
|
|
51
|
+
const styles$l = {
|
|
52
|
+
activity
|
|
33
53
|
};
|
|
34
54
|
const AgentChatActivityIndicator = (props) => {
|
|
35
|
-
const { active, failed, activityTicker } = props;
|
|
55
|
+
const { active, failed, activityTicker, dotsVariant = "bounce" } = props;
|
|
36
56
|
const isWorking = !failed && (active || activityTicker.phase === "live");
|
|
37
57
|
if (!isWorking) return null;
|
|
38
58
|
const currentLines = activityTicker.currentTurn?.lines ?? [];
|
|
39
59
|
const currentLine = currentLines.length > 0 ? currentLines[currentLines.length - 1].line : null;
|
|
40
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */ jsx("span", {}),
|
|
43
|
-
/* @__PURE__ */ jsx("span", {}),
|
|
44
|
-
/* @__PURE__ */ jsx("span", {})
|
|
45
|
-
] }),
|
|
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 }),
|
|
46
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…" })
|
|
47
63
|
] });
|
|
48
64
|
};
|
|
49
65
|
const bar = "agents_bar_DAkgRp";
|
|
50
|
-
const styles$
|
|
66
|
+
const styles$k = {
|
|
51
67
|
bar
|
|
52
68
|
};
|
|
53
69
|
const ConversationClosedBar = (props) => {
|
|
54
70
|
const { text = "This conversation is closed." } = props;
|
|
55
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
71
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$k.bar, "data-testid": "agent-chat-closed-bar", children: [
|
|
56
72
|
/* @__PURE__ */ jsx(Icon, { name: "check", color: "--agents-success-500" }),
|
|
57
73
|
/* @__PURE__ */ jsx(Text, { children: text })
|
|
58
74
|
] });
|
|
@@ -86,8 +102,8 @@ const findBalancedJsonObjectEnd = (text, fromIndex, maxScanLength = 5e3) => {
|
|
|
86
102
|
return null;
|
|
87
103
|
};
|
|
88
104
|
const ANY_FENCE_DELIM_LINE = /^ {0,3}(`{3,}|~{3,})(.*)$/;
|
|
89
|
-
const parseFenceDelimiterLine = (
|
|
90
|
-
const match = ANY_FENCE_DELIM_LINE.exec(
|
|
105
|
+
const parseFenceDelimiterLine = (line2) => {
|
|
106
|
+
const match = ANY_FENCE_DELIM_LINE.exec(line2);
|
|
91
107
|
if (!match) return null;
|
|
92
108
|
const marker = match[1];
|
|
93
109
|
const char = marker[0];
|
|
@@ -198,13 +214,13 @@ const repairMalformedWidgetFences = (text) => {
|
|
|
198
214
|
};
|
|
199
215
|
const scanLineStartingJsonSpans = (text) => {
|
|
200
216
|
const spans = [];
|
|
201
|
-
const
|
|
217
|
+
const lines2 = text.split("\n");
|
|
202
218
|
let offset = 0;
|
|
203
|
-
for (const
|
|
219
|
+
for (const line2 of lines2) {
|
|
204
220
|
const lineStart = offset;
|
|
205
|
-
offset +=
|
|
206
|
-
if (!
|
|
207
|
-
const openIndex = lineStart +
|
|
221
|
+
offset += line2.length + 1;
|
|
222
|
+
if (!line2.trimStart().startsWith("{")) continue;
|
|
223
|
+
const openIndex = lineStart + line2.indexOf("{");
|
|
208
224
|
const jsonObjectEnd = findBalancedJsonObjectEnd(text, openIndex);
|
|
209
225
|
if (jsonObjectEnd !== null) {
|
|
210
226
|
spans.push({ json: text.slice(openIndex, jsonObjectEnd + 1), start: openIndex, end: jsonObjectEnd + 1 });
|
|
@@ -400,7 +416,7 @@ const input = "agents_input_GCtiXU";
|
|
|
400
416
|
const inputReplacement = "agents_inputReplacement_EAhjsv";
|
|
401
417
|
const inputInCategory = "agents_inputInCategory_RDuOYA";
|
|
402
418
|
const olderLoading = "agents_olderLoading_5X7nMg";
|
|
403
|
-
const styles$
|
|
419
|
+
const styles$j = {
|
|
404
420
|
chat,
|
|
405
421
|
genericChat,
|
|
406
422
|
customBg,
|
|
@@ -430,7 +446,7 @@ const sendBlocked = "agents_sendBlocked_rNqOKm";
|
|
|
430
446
|
const compact = "agents_compact_ZBtAbD";
|
|
431
447
|
const collapsed = "agents_collapsed_v3Ekqz";
|
|
432
448
|
const collapsedPillSizer = "agents_collapsedPillSizer_aqw7WI";
|
|
433
|
-
const styles$
|
|
449
|
+
const styles$i = {
|
|
434
450
|
inputContainer,
|
|
435
451
|
aiGlow,
|
|
436
452
|
editableInput,
|
|
@@ -523,10 +539,11 @@ const ConversationMessageInput = (props) => {
|
|
|
523
539
|
} = props;
|
|
524
540
|
const { removeComposerWidget, replaceComposerWidgetFields } = useConversationWidgetContext();
|
|
525
541
|
const [inputValue, setInputValue] = useState("");
|
|
526
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
527
542
|
const inputRef = useRef(null);
|
|
528
543
|
const isComposingRef = useRef(false);
|
|
529
|
-
const
|
|
544
|
+
const texts = useAgentsTexts();
|
|
545
|
+
const translatedPlaceholder = useMemo(() => texts.translate(placeholder), [texts, placeholder]);
|
|
546
|
+
const sendButtonAccessibleName = texts.translate("Send message");
|
|
530
547
|
const collapsedPillSizerRef = useRef(null);
|
|
531
548
|
const measuresCollapsedPillWidth = compact2 && !!onCollapsedPillWidthChange;
|
|
532
549
|
const isMessageTooLong = inputValue.length > MAX_MESSAGE_LENGTH;
|
|
@@ -603,12 +620,6 @@ const ConversationMessageInput = (props) => {
|
|
|
603
620
|
isComposingRef.current = false;
|
|
604
621
|
handleInput();
|
|
605
622
|
};
|
|
606
|
-
const handleFocus = () => {
|
|
607
|
-
setIsFocused(true);
|
|
608
|
-
};
|
|
609
|
-
const handleBlur = () => {
|
|
610
|
-
setIsFocused(false);
|
|
611
|
-
};
|
|
612
623
|
const handleContainerMouseDown = (e2) => {
|
|
613
624
|
const target = e2.target;
|
|
614
625
|
if (target === inputRef.current || inputRef.current?.contains(target)) return;
|
|
@@ -662,7 +673,7 @@ const ConversationMessageInput = (props) => {
|
|
|
662
673
|
/* @__PURE__ */ jsx(
|
|
663
674
|
GlowFrame,
|
|
664
675
|
{
|
|
665
|
-
className: classNames(styles$
|
|
676
|
+
className: classNames(styles$i.aiGlow),
|
|
666
677
|
color: isMessageTooLong ? "var(--agents-danger-500)" : void 0,
|
|
667
678
|
borderRadius: compact2 ? COMPACT_INPUT_RADIUS_PX : void 0,
|
|
668
679
|
borderWidth: 2,
|
|
@@ -670,9 +681,9 @@ const ConversationMessageInput = (props) => {
|
|
|
670
681
|
children: /* @__PURE__ */ jsxs(
|
|
671
682
|
"div",
|
|
672
683
|
{
|
|
673
|
-
className: classNames(styles$
|
|
674
|
-
[styles$
|
|
675
|
-
[styles$
|
|
684
|
+
className: classNames(styles$i.inputContainer, {
|
|
685
|
+
[styles$i.compact]: compact2,
|
|
686
|
+
[styles$i.collapsed]: compact2 && collapsed2
|
|
676
687
|
}),
|
|
677
688
|
onMouseDown: handleContainerMouseDown,
|
|
678
689
|
children: [
|
|
@@ -686,28 +697,26 @@ const ConversationMessageInput = (props) => {
|
|
|
686
697
|
onCompositionStart: handleCompositionStart,
|
|
687
698
|
onCompositionEnd: handleCompositionEnd,
|
|
688
699
|
onKeyDown: handleKeyPress,
|
|
689
|
-
|
|
690
|
-
onBlur: handleBlur,
|
|
691
|
-
className: `${styles$h.editableInput} ${!inputValue && !isFocused ? styles$h.showPlaceholder : ""}`,
|
|
700
|
+
className: `${styles$i.editableInput} ${!inputValue ? styles$i.showPlaceholder : ""}`,
|
|
692
701
|
"data-placeholder": translatedPlaceholder,
|
|
693
702
|
"data-testid": `${testId}-textarea`
|
|
694
703
|
}
|
|
695
704
|
),
|
|
696
|
-
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(
|
|
697
706
|
Text,
|
|
698
707
|
{
|
|
699
708
|
role: "caption",
|
|
700
709
|
translate: false,
|
|
701
710
|
color: isMessageTooLong ? "var(--agents-danger-500)" : "var(--agents-fg-lightest)",
|
|
702
|
-
className: styles$
|
|
711
|
+
className: styles$i.characterCounter,
|
|
703
712
|
testId: `${testId}-character-counter`,
|
|
704
713
|
children: `${inputValue.length.toLocaleString()} / ${MAX_MESSAGE_LENGTH.toLocaleString()}`
|
|
705
714
|
}
|
|
706
715
|
) }),
|
|
707
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
708
|
-
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 }),
|
|
709
718
|
actionsSlot,
|
|
710
|
-
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(
|
|
711
720
|
Tooltip,
|
|
712
721
|
{
|
|
713
722
|
text: isMessageTooLong ? "Your message is over the %maxLength% character limit" : void 0,
|
|
@@ -720,6 +729,7 @@ const ConversationMessageInput = (props) => {
|
|
|
720
729
|
onClick: handleSendMessage,
|
|
721
730
|
icon: "arrowUp",
|
|
722
731
|
testId: `${testId}-send-button`,
|
|
732
|
+
ariaLabel: sendButtonAccessibleName,
|
|
723
733
|
disabled: !hasSendableContent || disabled || isProcessing || isMessageTooLong || sendDisabled,
|
|
724
734
|
size: hasSendableContent && !isMessageTooLong && !sendDisabled ? "medium" : void 0,
|
|
725
735
|
rounded: true
|
|
@@ -733,7 +743,7 @@ const ConversationMessageInput = (props) => {
|
|
|
733
743
|
)
|
|
734
744
|
}
|
|
735
745
|
),
|
|
736
|
-
measuresCollapsedPillWidth && /* @__PURE__ */ jsx("span", { ref: collapsedPillSizerRef, className: styles$
|
|
746
|
+
measuresCollapsedPillWidth && /* @__PURE__ */ jsx("span", { ref: collapsedPillSizerRef, className: styles$i.collapsedPillSizer, "aria-hidden": "true", children: translatedPlaceholder })
|
|
737
747
|
] });
|
|
738
748
|
};
|
|
739
749
|
const canvasReopenControl = "agents_canvasReopenControl_7vGS8F";
|
|
@@ -801,7 +811,7 @@ const message = "agents_message_BScH1l";
|
|
|
801
811
|
const whiteBubble = "agents_whiteBubble_4-I21V";
|
|
802
812
|
const darkBubble = "agents_darkBubble_YdEIoi";
|
|
803
813
|
const primaryBubble = "agents_primaryBubble_jo9Zj-";
|
|
804
|
-
const styles$
|
|
814
|
+
const styles$h = {
|
|
805
815
|
message,
|
|
806
816
|
whiteBubble,
|
|
807
817
|
darkBubble,
|
|
@@ -820,16 +830,16 @@ const ConversationMessageUserWidgets = (props) => {
|
|
|
820
830
|
const ConversationMessageUser = (props) => {
|
|
821
831
|
const { text, isGenericChat, theme = "default" } = props;
|
|
822
832
|
const { text: proseText, widgets } = useMemo(() => splitComposerWidgetFencesFromMessageText(text), [text]);
|
|
823
|
-
const bubbleClass = theme === "light" ? styles$
|
|
824
|
-
const textColor = theme === "light" ? "var(--agents-fg)" : theme === "dark" ? "var(--agents-chat-user-bubble-text)" : "var(--agents-fg-on-
|
|
825
|
-
return /* @__PURE__ */ jsxs("div", { className: classNames(styles$
|
|
833
|
+
const bubbleClass = theme === "light" ? styles$h.whiteBubble : theme === "dark" ? styles$h.darkBubble : theme === "primary" ? styles$h.primaryBubble : void 0;
|
|
834
|
+
const textColor = theme === "light" ? "var(--agents-fg)" : theme === "dark" ? "var(--agents-chat-user-bubble-text)" : "var(--agents-fg-on-accent)";
|
|
835
|
+
return /* @__PURE__ */ jsxs("div", { className: classNames(styles$h.message, bubbleClass), "data-testid": "chat-message-user", children: [
|
|
826
836
|
/* @__PURE__ */ jsx(ConversationMessageUserWidgets, { widgets }),
|
|
827
837
|
/* @__PURE__ */ jsx(Text, { allowNewLines: true, translate: false, color: textColor, children: proseText })
|
|
828
838
|
] });
|
|
829
839
|
};
|
|
830
840
|
const responseContainer$2 = "agents_responseContainer_1-FSNs";
|
|
831
841
|
const responseMessage = "agents_responseMessage_Xrs7fL";
|
|
832
|
-
const styles$
|
|
842
|
+
const styles$g = {
|
|
833
843
|
responseContainer: responseContainer$2,
|
|
834
844
|
responseMessage
|
|
835
845
|
};
|
|
@@ -1052,15 +1062,15 @@ const useFreshMessageBlockReveal = (options) => {
|
|
|
1052
1062
|
};
|
|
1053
1063
|
const iconContainer$1 = "agents_iconContainer_JupHNn";
|
|
1054
1064
|
const responseHeader$1 = "agents_responseHeader_ulXYcn";
|
|
1055
|
-
const styles$
|
|
1065
|
+
const styles$f = {
|
|
1056
1066
|
iconContainer: iconContainer$1,
|
|
1057
1067
|
responseHeader: responseHeader$1
|
|
1058
1068
|
};
|
|
1059
1069
|
const ConversationMessageHeader = memo((props) => {
|
|
1060
1070
|
const { aiPromptExtensionCategory, aiPromptExtension } = props;
|
|
1061
1071
|
const iconName = aiPromptExtension?.iconClass ?? "ai";
|
|
1062
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1063
|
-
/* @__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 }) }),
|
|
1064
1074
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1065
1075
|
/* @__PURE__ */ jsx(Text, { role: "help", weight: "bold", children: aiPromptExtension?.name ?? "AI Extensions" }),
|
|
1066
1076
|
aiPromptExtensionCategory !== void 0 ? /* @__PURE__ */ jsx(Text, { role: "caption", replacements: { productName: aiPromptExtensionCategory?.name }, children: "%productName% Assistant" }) : null,
|
|
@@ -1139,7 +1149,7 @@ const ConversationMessageWidgets = memo((props) => {
|
|
|
1139
1149
|
if (timeoutRef.current != null) window.clearTimeout(timeoutRef.current);
|
|
1140
1150
|
timeoutRef.current = window.setTimeout(() => setCopied(false), 2e3);
|
|
1141
1151
|
}, [textToRender]);
|
|
1142
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1152
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$g.responseContainer, children: [
|
|
1143
1153
|
!hideAssistantMeta ? /* @__PURE__ */ jsx(
|
|
1144
1154
|
ConversationMessageHeader,
|
|
1145
1155
|
{
|
|
@@ -1147,7 +1157,7 @@ const ConversationMessageWidgets = memo((props) => {
|
|
|
1147
1157
|
aiPromptExtension
|
|
1148
1158
|
}
|
|
1149
1159
|
) : null,
|
|
1150
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
1160
|
+
/* @__PURE__ */ jsxs("div", { className: styles$g.responseMessage, children: [
|
|
1151
1161
|
/* @__PURE__ */ jsx("div", { ref: renderedRef, children: /* @__PURE__ */ jsx(
|
|
1152
1162
|
ConversationMarkdown,
|
|
1153
1163
|
{
|
|
@@ -1254,22 +1264,22 @@ const lastWireMessageIsUnansweredUserMessage = (messages) => {
|
|
|
1254
1264
|
return false;
|
|
1255
1265
|
};
|
|
1256
1266
|
const responseContainer$1 = "agents_responseContainer_LFzKoO";
|
|
1257
|
-
const styles$
|
|
1267
|
+
const styles$e = {
|
|
1258
1268
|
responseContainer: responseContainer$1
|
|
1259
1269
|
};
|
|
1260
1270
|
const responseHeaderLayout = "agents_responseHeaderLayout_WuoaNs";
|
|
1261
1271
|
const iconContainer = "agents_iconContainer_C1c9yQ";
|
|
1262
1272
|
const responseHeader = "agents_responseHeader_-CQw8U";
|
|
1263
|
-
const styles$
|
|
1273
|
+
const styles$d = {
|
|
1264
1274
|
responseHeaderLayout,
|
|
1265
1275
|
iconContainer,
|
|
1266
1276
|
responseHeader
|
|
1267
1277
|
};
|
|
1268
1278
|
const ConversationMessageSystemHeader = memo((props) => {
|
|
1269
1279
|
const { aiPromptExtensionCategory, aiPromptExtension, isContentExpanded, onExpandContentClick } = props;
|
|
1270
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1271
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
1272
|
-
/* @__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" }) }),
|
|
1273
1283
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1274
1284
|
/* @__PURE__ */ jsx(Text, { role: "help", weight: "bold", children: aiPromptExtension?.name ?? "AI Extensions" }),
|
|
1275
1285
|
aiPromptExtensionCategory !== void 0 ? /* @__PURE__ */ jsxs(Text, { role: "caption", children: [
|
|
@@ -1279,7 +1289,7 @@ const ConversationMessageSystemHeader = memo((props) => {
|
|
|
1279
1289
|
aiPromptExtensionCategory === void 0 ? /* @__PURE__ */ jsx(Text, { role: "caption", children: "System" }) : null
|
|
1280
1290
|
] })
|
|
1281
1291
|
] }),
|
|
1282
|
-
/* @__PURE__ */ jsx("div", { className: styles$
|
|
1292
|
+
/* @__PURE__ */ jsx("div", { className: styles$d.responseHeaderAction, children: /* @__PURE__ */ jsx(
|
|
1283
1293
|
Button,
|
|
1284
1294
|
{
|
|
1285
1295
|
variant: "muted",
|
|
@@ -1292,7 +1302,7 @@ const ConversationMessageSystemHeader = memo((props) => {
|
|
|
1292
1302
|
const ConversationMessageSystem = memo((props) => {
|
|
1293
1303
|
const { aiPromptExtensionCategory, aiPromptExtension, message: message2 } = props;
|
|
1294
1304
|
const [isContentExpanded, setIsContentExpanded] = useState(false);
|
|
1295
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1305
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$e.responseContainer, children: [
|
|
1296
1306
|
/* @__PURE__ */ jsx(
|
|
1297
1307
|
ConversationMessageSystemHeader,
|
|
1298
1308
|
{
|
|
@@ -1302,22 +1312,22 @@ const ConversationMessageSystem = memo((props) => {
|
|
|
1302
1312
|
isContentExpanded
|
|
1303
1313
|
}
|
|
1304
1314
|
),
|
|
1305
|
-
/* @__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 }) }) })
|
|
1306
1316
|
] });
|
|
1307
1317
|
});
|
|
1308
1318
|
const icon = "agents_icon_DD3OXD";
|
|
1309
|
-
const styles$
|
|
1319
|
+
const styles$c = {
|
|
1310
1320
|
icon
|
|
1311
1321
|
};
|
|
1312
1322
|
const VoiceBarsIcon = (props) => {
|
|
1313
1323
|
const { size = 18 } = props;
|
|
1314
|
-
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" }) });
|
|
1315
1325
|
};
|
|
1316
1326
|
const markerRow = "agents_markerRow_zl8Pcg";
|
|
1317
1327
|
const markerChip = "agents_markerChip_u9Z-aO";
|
|
1318
1328
|
const markerIcon = "agents_markerIcon_En-miz";
|
|
1319
1329
|
const markerDuration = "agents_markerDuration_Nbff92";
|
|
1320
|
-
const styles$
|
|
1330
|
+
const styles$b = {
|
|
1321
1331
|
markerRow,
|
|
1322
1332
|
markerChip,
|
|
1323
1333
|
markerIcon,
|
|
@@ -1330,11 +1340,11 @@ const formatCallDuration = (durationSeconds) => {
|
|
|
1330
1340
|
return `${minutes}:${String(seconds).padStart(2, "0")} min`;
|
|
1331
1341
|
};
|
|
1332
1342
|
const MARKER_LABELS = {
|
|
1333
|
-
started: { inApp: "Voice chat started", phoneLine: "Phone call started" },
|
|
1334
|
-
ended: { inApp: "Voice chat ended", phoneLine: "Phone call ended" },
|
|
1335
|
-
declined: { inApp: "You declined a voice chat with %agentName%", phoneLine: "Phone call declined" },
|
|
1336
|
-
missed: { inApp: "You missed a voice chat with %agentName%", phoneLine: "Phone call not answered" },
|
|
1337
|
-
notConnected: { inApp: "Voice chat did not connect", phoneLine: "Phone call not answered" }
|
|
1343
|
+
started: { inApp: textKey("Voice chat started"), phoneLine: textKey("Phone call started") },
|
|
1344
|
+
ended: { inApp: textKey("Voice chat ended"), phoneLine: textKey("Phone call ended") },
|
|
1345
|
+
declined: { inApp: textKey("You declined a voice chat with %agentName%"), phoneLine: textKey("Phone call declined") },
|
|
1346
|
+
missed: { inApp: textKey("You missed a voice chat with %agentName%"), phoneLine: textKey("Phone call not answered") },
|
|
1347
|
+
notConnected: { inApp: textKey("Voice chat did not connect"), phoneLine: textKey("Phone call not answered") }
|
|
1338
1348
|
};
|
|
1339
1349
|
const callMarkerStateOf = (isCallEnd, endReason) => {
|
|
1340
1350
|
if (!isCallEnd) return "started";
|
|
@@ -1350,15 +1360,15 @@ const ConversationCallMarkerChip = memo(({ signalSource, signalText }) => {
|
|
|
1350
1360
|
const durationSeconds = /(\d+)s\b/.exec(signalText)?.[1];
|
|
1351
1361
|
const markerState = callMarkerStateOf(isCallEnd, endReason);
|
|
1352
1362
|
const markerLabel = isInAppCall ? MARKER_LABELS[markerState].inApp : MARKER_LABELS[markerState].phoneLine;
|
|
1353
|
-
return /* @__PURE__ */ jsx("div", { className: styles$
|
|
1354
|
-
/* @__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" }) }),
|
|
1355
1365
|
/* @__PURE__ */ jsx(Text, { role: "caption", replacements: { agentName: getAgentDisplayName() }, children: markerLabel }),
|
|
1356
|
-
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)) }) })
|
|
1357
1367
|
] }) });
|
|
1358
1368
|
});
|
|
1359
1369
|
const disclosure = "agents_disclosure_rVPB-y";
|
|
1360
1370
|
const instructionPanel = "agents_instructionPanel_G2fM1K";
|
|
1361
|
-
const styles$
|
|
1371
|
+
const styles$a = {
|
|
1362
1372
|
disclosure,
|
|
1363
1373
|
instructionPanel
|
|
1364
1374
|
};
|
|
@@ -1366,15 +1376,15 @@ const ConversationTaskInstructionDisclosure = ({
|
|
|
1366
1376
|
instructionText
|
|
1367
1377
|
}) => {
|
|
1368
1378
|
const [expanded, setExpanded] = useState(false);
|
|
1369
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1370
|
-
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,
|
|
1371
1381
|
/* @__PURE__ */ jsx(Button, { variant: "muted", onClick: () => setExpanded((wasExpanded) => !wasExpanded), children: expanded ? "Hide task instruction" : "Show task instruction" })
|
|
1372
1382
|
] });
|
|
1373
1383
|
};
|
|
1374
1384
|
const responseContainer = "agents_responseContainer_DP5-nh";
|
|
1375
1385
|
const thinkingMessage = "agents_thinkingMessage_8Z3pN0";
|
|
1376
1386
|
const thinkingDots = "agents_thinkingDots_9rZMzX";
|
|
1377
|
-
const styles$
|
|
1387
|
+
const styles$9 = {
|
|
1378
1388
|
responseContainer,
|
|
1379
1389
|
thinkingMessage,
|
|
1380
1390
|
thinkingDots
|
|
@@ -1396,7 +1406,7 @@ const ConversationMessageThinking = memo((props) => {
|
|
|
1396
1406
|
}, 2500);
|
|
1397
1407
|
return () => clearInterval(interval);
|
|
1398
1408
|
}, []);
|
|
1399
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1409
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$9.responseContainer, children: [
|
|
1400
1410
|
/* @__PURE__ */ jsx(
|
|
1401
1411
|
ConversationMessageHeader,
|
|
1402
1412
|
{
|
|
@@ -1404,8 +1414,8 @@ const ConversationMessageThinking = memo((props) => {
|
|
|
1404
1414
|
aiPromptExtension
|
|
1405
1415
|
}
|
|
1406
1416
|
),
|
|
1407
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
1408
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
1417
|
+
/* @__PURE__ */ jsxs("div", { className: styles$9.thinkingMessage, children: [
|
|
1418
|
+
/* @__PURE__ */ jsxs("div", { className: styles$9.thinkingDots, children: [
|
|
1409
1419
|
/* @__PURE__ */ jsx("span", {}),
|
|
1410
1420
|
/* @__PURE__ */ jsx("span", {}),
|
|
1411
1421
|
/* @__PURE__ */ jsx("span", {})
|
|
@@ -1416,7 +1426,7 @@ const ConversationMessageThinking = memo((props) => {
|
|
|
1416
1426
|
});
|
|
1417
1427
|
const errorMessageContainer = "agents_errorMessageContainer_SW0BKU";
|
|
1418
1428
|
const errorMessageTitle = "agents_errorMessageTitle_c--G2K";
|
|
1419
|
-
const styles$
|
|
1429
|
+
const styles$8 = {
|
|
1420
1430
|
errorMessageContainer,
|
|
1421
1431
|
errorMessageTitle
|
|
1422
1432
|
};
|
|
@@ -1487,9 +1497,9 @@ const ConversationErrorWidget = (props) => {
|
|
|
1487
1497
|
replacements: replacements2
|
|
1488
1498
|
};
|
|
1489
1499
|
}, [errorType, isUpSellPossible, rateLimitRetryAfterSeconds, showFairUsageMessage, canRetry]);
|
|
1490
|
-
return /* @__PURE__ */ jsxs("div", { className: styles$
|
|
1500
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$8.errorMessageContainer, children: [
|
|
1491
1501
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1492
|
-
/* @__PURE__ */ jsxs("div", { className: styles$
|
|
1502
|
+
/* @__PURE__ */ jsxs("div", { className: styles$8.errorMessageTitle, children: [
|
|
1493
1503
|
/* @__PURE__ */ jsx(Icon, { name: icon2 }),
|
|
1494
1504
|
/* @__PURE__ */ jsx(Text, { weight: "bold", children: title2 })
|
|
1495
1505
|
] }),
|
|
@@ -1644,7 +1654,7 @@ const ConversationMessageList = ({
|
|
|
1644
1654
|
const suggestionCard = "agents_suggestionCard_mrCOnL";
|
|
1645
1655
|
const suggestionCardButton = "agents_suggestionCardButton_Vs0fh3";
|
|
1646
1656
|
const arrowIcon = "agents_arrowIcon_KmN-nZ";
|
|
1647
|
-
const styles$
|
|
1657
|
+
const styles$7 = {
|
|
1648
1658
|
suggestionCard,
|
|
1649
1659
|
suggestionCardButton,
|
|
1650
1660
|
arrowIcon
|
|
@@ -1652,20 +1662,20 @@ const styles$6 = {
|
|
|
1652
1662
|
const ConversationSuggestionWidget = (props) => {
|
|
1653
1663
|
const { suggestion, onClick, testId } = props;
|
|
1654
1664
|
const { AssistantIconBadge } = useAgentsEnvironment();
|
|
1655
|
-
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: [
|
|
1656
1666
|
AssistantIconBadge ? /* @__PURE__ */ jsx(
|
|
1657
1667
|
AssistantIconBadge,
|
|
1658
1668
|
{
|
|
1659
1669
|
iconName: suggestion.iconClass ?? "",
|
|
1660
|
-
color: "
|
|
1661
|
-
backgroundColor: "
|
|
1670
|
+
color: "var(--agents-fg-on-accent)",
|
|
1671
|
+
backgroundColor: "color-mix(in srgb, var(--agents-neutral-000) 20%, transparent)"
|
|
1662
1672
|
}
|
|
1663
1673
|
) : null,
|
|
1664
1674
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
1665
|
-
/* @__PURE__ */ jsx(Text, { role: "help", weight: "bold", color: "
|
|
1666
|
-
/* @__PURE__ */ jsx(Text, { role: "caption", color: "
|
|
1675
|
+
/* @__PURE__ */ jsx(Text, { role: "help", weight: "bold", color: "var(--agents-fg-on-accent)", children: suggestion.name }),
|
|
1676
|
+
/* @__PURE__ */ jsx(Text, { role: "caption", color: "var(--agents-fg-on-accent)", children: suggestion.description })
|
|
1667
1677
|
] }),
|
|
1668
|
-
/* @__PURE__ */ jsx(Icon, { color: "
|
|
1678
|
+
/* @__PURE__ */ jsx(Icon, { color: "var(--agents-fg-on-accent)", className: styles$7.arrowIcon, name: "arrowRight" })
|
|
1669
1679
|
] }) });
|
|
1670
1680
|
};
|
|
1671
1681
|
const ConversationIntroWidget = ({
|
|
@@ -1680,7 +1690,7 @@ const ConversationIntroWidget = ({
|
|
|
1680
1690
|
AssistantIconBadge,
|
|
1681
1691
|
{
|
|
1682
1692
|
iconName: aiPromptExtensionIcon,
|
|
1683
|
-
color: "
|
|
1693
|
+
color: "var(--agents-fg-on-accent)",
|
|
1684
1694
|
backgroundColor: "var(--agents-assistant-400)",
|
|
1685
1695
|
isLarge: true
|
|
1686
1696
|
}
|
|
@@ -1717,13 +1727,14 @@ const ConversationIntroWidget = ({
|
|
|
1717
1727
|
};
|
|
1718
1728
|
const scrollToLatest = "agents_scrollToLatest_j2xJO9";
|
|
1719
1729
|
const visible = "agents_visible_bwj0Gp";
|
|
1720
|
-
const styles$
|
|
1730
|
+
const styles$6 = {
|
|
1721
1731
|
scrollToLatest,
|
|
1722
1732
|
visible
|
|
1723
1733
|
};
|
|
1724
1734
|
const ConversationScrollToLatestMessageButton = (props) => {
|
|
1725
1735
|
const { visible: visible2, onClick } = props;
|
|
1726
|
-
|
|
1736
|
+
const texts = useAgentsTexts();
|
|
1737
|
+
return /* @__PURE__ */ jsx("div", { className: classNames(styles$6.scrollToLatest, visible2 ? styles$6.visible : void 0), children: /* @__PURE__ */ jsx(
|
|
1727
1738
|
Button,
|
|
1728
1739
|
{
|
|
1729
1740
|
variant: "muted",
|
|
@@ -1731,7 +1742,9 @@ const ConversationScrollToLatestMessageButton = (props) => {
|
|
|
1731
1742
|
rounded: true,
|
|
1732
1743
|
blurred: true,
|
|
1733
1744
|
size: "extraLarge",
|
|
1734
|
-
onClick
|
|
1745
|
+
onClick,
|
|
1746
|
+
ariaLabel: texts.translate("Scroll to the latest message"),
|
|
1747
|
+
testId: "chat-scroll-to-latest-button"
|
|
1735
1748
|
}
|
|
1736
1749
|
) });
|
|
1737
1750
|
};
|
|
@@ -1888,7 +1901,7 @@ const ConversationViewBody = (props) => {
|
|
|
1888
1901
|
);
|
|
1889
1902
|
const { readAssistantThemeClassName, AssistantBackground } = useAgentsEnvironment();
|
|
1890
1903
|
const colorPalette = useMemo(
|
|
1891
|
-
() => currentCategory?.alias ? readAssistantThemeClassName?.(currentCategory.alias) ?? styles$
|
|
1904
|
+
() => currentCategory?.alias ? readAssistantThemeClassName?.(currentCategory.alias) ?? styles$j.genericChat : styles$j.genericChat,
|
|
1892
1905
|
[currentCategory, readAssistantThemeClassName]
|
|
1893
1906
|
);
|
|
1894
1907
|
const isMessageListVisible = !!messages && (!!conversationId || !!showMessagesWithoutConversation) || startingNewConversation || !!error && error !== ConversationErrorType.CONVERSATION_NOT_FOUND;
|
|
@@ -2093,7 +2106,7 @@ const ConversationViewBody = (props) => {
|
|
|
2093
2106
|
const messageColumn = /* @__PURE__ */ jsxs(
|
|
2094
2107
|
"div",
|
|
2095
2108
|
{
|
|
2096
|
-
className: styles$
|
|
2109
|
+
className: styles$j.contentWrapper,
|
|
2097
2110
|
"data-agents-chat-scroll": "",
|
|
2098
2111
|
"data-testid": "chat-messages-scroll",
|
|
2099
2112
|
ref: handleContentWrapperRef,
|
|
@@ -2111,11 +2124,11 @@ const ConversationViewBody = (props) => {
|
|
|
2111
2124
|
onSuggestionClick
|
|
2112
2125
|
}
|
|
2113
2126
|
) : null,
|
|
2114
|
-
!!loadingOlder ? /* @__PURE__ */ jsx("span", { className: styles$
|
|
2127
|
+
!!loadingOlder ? /* @__PURE__ */ jsx("span", { className: styles$j.olderLoading, children: /* @__PURE__ */ jsx(Text, { children: "Loading older messages…" }) }) : null,
|
|
2115
2128
|
isMessageListVisible ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(WidgetWindowRootContext.Provider, { value: scrollContainer, children: /* @__PURE__ */ jsx(
|
|
2116
2129
|
ConversationMessageList,
|
|
2117
2130
|
{
|
|
2118
|
-
className: enablePinQuestionAndRevealAnswer && (conversationId || startingNewConversation || aiThinking || error) ? styles$
|
|
2131
|
+
className: enablePinQuestionAndRevealAnswer && (conversationId || startingNewConversation || aiThinking || error) ? styles$j.topAlignedMessages : void 0,
|
|
2119
2132
|
messages,
|
|
2120
2133
|
currentCategory,
|
|
2121
2134
|
aiPromptExtension,
|
|
@@ -2142,40 +2155,40 @@ const ConversationViewBody = (props) => {
|
|
|
2142
2155
|
"div",
|
|
2143
2156
|
{
|
|
2144
2157
|
className: classNames(
|
|
2145
|
-
styles$
|
|
2146
|
-
background || backgroundPaintedByHost2 ? styles$
|
|
2147
|
-
backgroundPaintedByHost2 ? styles$
|
|
2148
|
-
isCompact ? styles$
|
|
2149
|
-
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
|
|
2150
2163
|
),
|
|
2151
2164
|
children: [
|
|
2152
|
-
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,
|
|
2153
2166
|
progressStepperSlot,
|
|
2154
|
-
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: [
|
|
2155
2168
|
messageColumn,
|
|
2156
2169
|
/* @__PURE__ */ jsx(
|
|
2157
2170
|
"div",
|
|
2158
2171
|
{
|
|
2159
|
-
className: styles$
|
|
2172
|
+
className: styles$j.contentOverlay,
|
|
2160
2173
|
"aria-hidden": !isContentOverlayShown || void 0,
|
|
2161
2174
|
inert: !isContentOverlayShown || void 0,
|
|
2162
2175
|
children: contentOverlaySlot
|
|
2163
2176
|
}
|
|
2164
2177
|
)
|
|
2165
2178
|
] }) : messageColumn,
|
|
2166
|
-
enablePinQuestionAndRevealAnswer && /* @__PURE__ */ jsx("div", { className: styles$
|
|
2179
|
+
enablePinQuestionAndRevealAnswer && /* @__PURE__ */ jsx("div", { className: styles$j.scrollToLatestAnchor, children: /* @__PURE__ */ jsx(
|
|
2167
2180
|
ConversationScrollToLatestMessageButton,
|
|
2168
2181
|
{
|
|
2169
2182
|
visible: isMessagesBottomOutOfView,
|
|
2170
2183
|
onClick: scrollToLatestMessage
|
|
2171
2184
|
}
|
|
2172
2185
|
) }),
|
|
2173
|
-
inputReplacementSlot ? /* @__PURE__ */ jsx("div", { className: styles$
|
|
2186
|
+
inputReplacementSlot ? /* @__PURE__ */ jsx("div", { className: styles$j.inputReplacement, children: inputReplacementSlot }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2174
2187
|
inputBandSlot,
|
|
2175
2188
|
/* @__PURE__ */ jsx(
|
|
2176
2189
|
ConversationMessageInput,
|
|
2177
2190
|
{
|
|
2178
|
-
className: classNames(styles$
|
|
2191
|
+
className: classNames(styles$j.input, currentCategory?.alias ? styles$j.inputInCategory : void 0),
|
|
2179
2192
|
isProcessing: allowSendWhileAiThinking ? !!startingNewConversation : aiThinking,
|
|
2180
2193
|
onSendMessage,
|
|
2181
2194
|
actionsSlot: inputActionsSlot,
|
|
@@ -2489,7 +2502,7 @@ const tab = "agents_tab_XzVXlj";
|
|
|
2489
2502
|
const tabTop = "agents_tabTop_mAtOHf";
|
|
2490
2503
|
const tabBottom = "agents_tabBottom_JLQcsf";
|
|
2491
2504
|
const tabCircle = "agents_tabCircle_J5jxeo";
|
|
2492
|
-
const styles$
|
|
2505
|
+
const styles$5 = {
|
|
2493
2506
|
handle,
|
|
2494
2507
|
tab,
|
|
2495
2508
|
tabTop,
|
|
@@ -2503,13 +2516,13 @@ const CanvasResizeHandle = (props) => {
|
|
|
2503
2516
|
"div",
|
|
2504
2517
|
{
|
|
2505
2518
|
...handleProps,
|
|
2506
|
-
className: styles$
|
|
2519
|
+
className: styles$5.handle,
|
|
2507
2520
|
"data-tab": tab2,
|
|
2508
2521
|
"aria-label": translateText("Resize canvas"),
|
|
2509
|
-
children: /* @__PURE__ */ jsxs("span", { className: styles$
|
|
2510
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
2511
|
-
/* @__PURE__ */ jsx("span", { className: styles$
|
|
2512
|
-
/* @__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 })
|
|
2513
2526
|
] })
|
|
2514
2527
|
}
|
|
2515
2528
|
);
|
|
@@ -2618,30 +2631,6 @@ const ConversationView = (props) => {
|
|
|
2618
2631
|
) : null
|
|
2619
2632
|
] });
|
|
2620
2633
|
};
|
|
2621
|
-
const pickPendingStartRequest = (pendingStartUserMessage, pendingStartSignalText) => {
|
|
2622
|
-
if (pendingStartUserMessage) {
|
|
2623
|
-
return { kind: "message", text: pendingStartUserMessage };
|
|
2624
|
-
}
|
|
2625
|
-
if (pendingStartSignalText) {
|
|
2626
|
-
return { kind: "signal", text: pendingStartSignalText };
|
|
2627
|
-
}
|
|
2628
|
-
return null;
|
|
2629
|
-
};
|
|
2630
|
-
const isChatReadyToSendPendingStartRequest = ({
|
|
2631
|
-
pendingStartRequest,
|
|
2632
|
-
activeConversationId,
|
|
2633
|
-
loadedConversationId,
|
|
2634
|
-
startingNewConversation,
|
|
2635
|
-
alreadySentStartRequest
|
|
2636
|
-
}) => {
|
|
2637
|
-
if (!pendingStartRequest) {
|
|
2638
|
-
return false;
|
|
2639
|
-
}
|
|
2640
|
-
if (activeConversationId || loadedConversationId || startingNewConversation) {
|
|
2641
|
-
return false;
|
|
2642
|
-
}
|
|
2643
|
-
return alreadySentStartRequest?.kind !== pendingStartRequest.kind || alreadySentStartRequest.text !== pendingStartRequest.text;
|
|
2644
|
-
};
|
|
2645
2634
|
const STATE_RANK = { queued: 0, running: 1, finished: 2, failed: 2, skipped: 2 };
|
|
2646
2635
|
const mergeActivityElements = (previous, incoming) => {
|
|
2647
2636
|
const byId = new Map(previous.map((element) => [element.toolCallMessageId, element]));
|
|
@@ -2678,7 +2667,7 @@ const LINE_PACE_MS = 2200;
|
|
|
2678
2667
|
const BACKLOG_LINE_PACE_MS = 1400;
|
|
2679
2668
|
const BACKLOG_THRESHOLD = 2;
|
|
2680
2669
|
const MAX_WAITING_LINES = 4;
|
|
2681
|
-
const isStepStillRunning = (
|
|
2670
|
+
const isStepStillRunning = (line2) => line2.state === "queued" || line2.state === "running";
|
|
2682
2671
|
const EMPTY_ACTIVITY_TICKER_QUEUE = {
|
|
2683
2672
|
shownLines: {},
|
|
2684
2673
|
trailIds: [],
|
|
@@ -2698,10 +2687,12 @@ const toTickerLine = (element, toldLine) => {
|
|
|
2698
2687
|
};
|
|
2699
2688
|
};
|
|
2700
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);
|
|
2701
2692
|
const shownLinesInOrder = (queue) => [...queue.trailIds, ...queue.currentId !== null ? [queue.currentId] : []].map((stepId) => queue.shownLines[stepId]).filter(Boolean);
|
|
2702
|
-
const showActivityLine = (queue,
|
|
2703
|
-
const stepId =
|
|
2704
|
-
const shownLines = { ...queue.shownLines, [stepId]:
|
|
2693
|
+
const showActivityLine = (queue, line2, now) => {
|
|
2694
|
+
const stepId = line2.toolCallMessageId;
|
|
2695
|
+
const shownLines = { ...queue.shownLines, [stepId]: line2 };
|
|
2705
2696
|
if (queue.currentId === stepId) {
|
|
2706
2697
|
return { ...queue, shownLines, lastShownAt: now };
|
|
2707
2698
|
}
|
|
@@ -2715,23 +2706,24 @@ const receiveActivityElements = (queue, elements, now) => {
|
|
|
2715
2706
|
let nextQueue = queue;
|
|
2716
2707
|
visibleActivityElements(elements).forEach((element) => {
|
|
2717
2708
|
const stepId = element.toolCallMessageId;
|
|
2718
|
-
const waitingLine = nextQueue.waitingLines.find((
|
|
2709
|
+
const waitingLine = nextQueue.waitingLines.find((line2) => line2.toolCallMessageId === stepId);
|
|
2719
2710
|
const incomingLine = toTickerLine(element, waitingLine ?? nextQueue.shownLines[stepId]);
|
|
2720
2711
|
if (!incomingLine) return;
|
|
2721
|
-
|
|
2712
|
+
const toldLine = waitingLine ?? nextQueue.shownLines[stepId];
|
|
2713
|
+
if (isSameLine(toldLine, incomingLine) || isOlderStateThan(toldLine, incomingLine)) {
|
|
2722
2714
|
return;
|
|
2723
2715
|
}
|
|
2724
2716
|
if (nextQueue.trailIds.includes(stepId)) {
|
|
2725
2717
|
nextQueue = {
|
|
2726
2718
|
...nextQueue,
|
|
2727
2719
|
shownLines: { ...nextQueue.shownLines, [stepId]: incomingLine },
|
|
2728
|
-
waitingLines: nextQueue.waitingLines.filter((
|
|
2720
|
+
waitingLines: nextQueue.waitingLines.filter((line2) => line2.toolCallMessageId !== stepId)
|
|
2729
2721
|
};
|
|
2730
2722
|
return;
|
|
2731
2723
|
}
|
|
2732
2724
|
nextQueue = {
|
|
2733
2725
|
...nextQueue,
|
|
2734
|
-
waitingLines: waitingLine ? nextQueue.waitingLines.map((
|
|
2726
|
+
waitingLines: waitingLine ? nextQueue.waitingLines.map((line2) => line2.toolCallMessageId === stepId ? incomingLine : line2) : [...nextQueue.waitingLines, incomingLine]
|
|
2735
2727
|
};
|
|
2736
2728
|
});
|
|
2737
2729
|
while (nextQueue.waitingLines.length > MAX_WAITING_LINES) {
|
|
@@ -2740,9 +2732,9 @@ const receiveActivityElements = (queue, elements, now) => {
|
|
|
2740
2732
|
}
|
|
2741
2733
|
return nextQueue;
|
|
2742
2734
|
};
|
|
2743
|
-
const msUntilNextActivityLine = (queue, now) => {
|
|
2735
|
+
const msUntilNextActivityLine = (queue, now, linePaceMs = LINE_PACE_MS, backlogLinePaceMs = BACKLOG_LINE_PACE_MS) => {
|
|
2744
2736
|
if (queue.waitingLines.length === 0) return null;
|
|
2745
|
-
const pace = queue.waitingLines.length > BACKLOG_THRESHOLD ?
|
|
2737
|
+
const pace = queue.waitingLines.length > BACKLOG_THRESHOLD ? backlogLinePaceMs : linePaceMs;
|
|
2746
2738
|
return Math.max(0, queue.lastShownAt + pace - now);
|
|
2747
2739
|
};
|
|
2748
2740
|
const releaseNextActivityLine = (queue, now) => {
|
|
@@ -2784,9 +2776,9 @@ const INITIAL_ACTIVITY_TICKER_STATE = {
|
|
|
2784
2776
|
keptTurns: [],
|
|
2785
2777
|
wasRunning: false
|
|
2786
2778
|
};
|
|
2787
|
-
const
|
|
2788
|
-
|
|
2789
|
-
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);
|
|
2790
2782
|
};
|
|
2791
2783
|
const keptTurnsWithFinishedTurn = (state) => {
|
|
2792
2784
|
const { phase, turnMessageId, queue, keptTurns } = state;
|
|
@@ -2802,7 +2794,7 @@ const activityTickerReducer = (state, action) => {
|
|
|
2802
2794
|
const { elements, running, failed, keepHistory, now } = action;
|
|
2803
2795
|
const turnStarted = running && !state.wasRunning;
|
|
2804
2796
|
const turnEnded = !running && state.wasRunning;
|
|
2805
|
-
const startsClean =
|
|
2797
|
+
const startsClean = isReadOfAnotherTurn(state, action.turnMessageId, turnStarted);
|
|
2806
2798
|
const queue = receiveActivityElements(startsClean ? EMPTY_ACTIVITY_TICKER_QUEUE : state.queue, elements, now);
|
|
2807
2799
|
let nextState = {
|
|
2808
2800
|
...state,
|
|
@@ -2852,7 +2844,16 @@ const toKeptTurn = (keptTurn) => ({
|
|
|
2852
2844
|
liveSince: null
|
|
2853
2845
|
});
|
|
2854
2846
|
const useActivityTicker = (params) => {
|
|
2855
|
-
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;
|
|
2856
2857
|
const [state, dispatch] = useReducer(activityTickerReducer, INITIAL_ACTIVITY_TICKER_STATE);
|
|
2857
2858
|
useEffect(() => {
|
|
2858
2859
|
dispatch({
|
|
@@ -2867,26 +2868,26 @@ const useActivityTicker = (params) => {
|
|
|
2867
2868
|
}, [elements, running, failed, turnMessageId]);
|
|
2868
2869
|
useEffect(() => {
|
|
2869
2870
|
if (state.phase !== "live") return void 0;
|
|
2870
|
-
const waitMs = msUntilNextActivityLine(state.queue, Date.now());
|
|
2871
|
+
const waitMs = msUntilNextActivityLine(state.queue, Date.now(), linePaceMs, backlogLinePaceMs);
|
|
2871
2872
|
if (waitMs === null) return void 0;
|
|
2872
2873
|
const timer = setTimeout(() => dispatch({ type: "nextLineDue", now: Date.now() }), waitMs);
|
|
2873
2874
|
return () => clearTimeout(timer);
|
|
2874
|
-
}, [state.phase, state.queue]);
|
|
2875
|
+
}, [state.phase, state.queue, linePaceMs, backlogLinePaceMs]);
|
|
2875
2876
|
useEffect(() => {
|
|
2876
2877
|
if (state.phase !== "done") return void 0;
|
|
2877
2878
|
const timer = setTimeout(
|
|
2878
2879
|
() => dispatch({ type: "doneBeatOver", keepHistory: keepActivityHistoryAfterAnswer }),
|
|
2879
|
-
|
|
2880
|
+
successBeatMs
|
|
2880
2881
|
);
|
|
2881
2882
|
return () => clearTimeout(timer);
|
|
2882
|
-
}, [state.phase, keepActivityHistoryAfterAnswer]);
|
|
2883
|
+
}, [state.phase, keepActivityHistoryAfterAnswer, successBeatMs]);
|
|
2883
2884
|
return useMemo(() => {
|
|
2884
2885
|
const { queue, phase } = state;
|
|
2885
|
-
const
|
|
2886
|
-
const currentTurn = phase !== "idle" &&
|
|
2886
|
+
const lines2 = shownLinesInOrder(queue);
|
|
2887
|
+
const currentTurn = phase !== "idle" && lines2.length > 0 ? {
|
|
2887
2888
|
turnMessageId: state.turnMessageId,
|
|
2888
2889
|
phase,
|
|
2889
|
-
lines,
|
|
2890
|
+
lines: lines2,
|
|
2890
2891
|
stepCount: countFinishedSteps(elements),
|
|
2891
2892
|
helperCount: phase === "live" ? countWorkingHelpers(elements) : 0,
|
|
2892
2893
|
liveSince: phase === "live" ? state.liveSince : null
|
|
@@ -2904,7 +2905,9 @@ const useConversationActivity = ({
|
|
|
2904
2905
|
conversationId,
|
|
2905
2906
|
runStatus,
|
|
2906
2907
|
signalVersion,
|
|
2907
|
-
enabled = true
|
|
2908
|
+
enabled = true,
|
|
2909
|
+
activityRequestWindowMs = ACTIVITY_REQUEST_WINDOW_MS,
|
|
2910
|
+
runningFloorMs = RUNNING_FLOOR_MS
|
|
2908
2911
|
}) => {
|
|
2909
2912
|
const conversationClient = useAgentsConversationClient();
|
|
2910
2913
|
const [elements, setElements] = useState([]);
|
|
@@ -2970,7 +2973,7 @@ const useConversationActivity = ({
|
|
|
2970
2973
|
return;
|
|
2971
2974
|
}
|
|
2972
2975
|
const sinceLast = Date.now() - lastRequestAtRef.current;
|
|
2973
|
-
if (sinceLast >=
|
|
2976
|
+
if (sinceLast >= activityRequestWindowMs) {
|
|
2974
2977
|
void performRequest();
|
|
2975
2978
|
return;
|
|
2976
2979
|
}
|
|
@@ -2978,10 +2981,10 @@ const useConversationActivity = ({
|
|
|
2978
2981
|
trailingTimerRef.current = setTimeout(() => {
|
|
2979
2982
|
trailingTimerRef.current = null;
|
|
2980
2983
|
void performRequest();
|
|
2981
|
-
},
|
|
2984
|
+
}, activityRequestWindowMs - sinceLast);
|
|
2982
2985
|
}
|
|
2983
2986
|
},
|
|
2984
|
-
[performRequest]
|
|
2987
|
+
[performRequest, activityRequestWindowMs]
|
|
2985
2988
|
);
|
|
2986
2989
|
useEffect(() => {
|
|
2987
2990
|
requestActivityRef.current = requestActivity;
|
|
@@ -3012,7 +3015,7 @@ const useConversationActivity = ({
|
|
|
3012
3015
|
}, [signalVersion, requestActivity]);
|
|
3013
3016
|
useEffect(() => {
|
|
3014
3017
|
if (!enabled || runStatus !== "running" && !running) return;
|
|
3015
|
-
const interval = setInterval(() => requestActivity(),
|
|
3018
|
+
const interval = setInterval(() => requestActivity(), runningFloorMs);
|
|
3016
3019
|
const onVisibilityChange = () => {
|
|
3017
3020
|
if (!document.hidden) requestActivity(true);
|
|
3018
3021
|
};
|
|
@@ -3021,7 +3024,7 @@ const useConversationActivity = ({
|
|
|
3021
3024
|
clearInterval(interval);
|
|
3022
3025
|
document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
3023
3026
|
};
|
|
3024
|
-
}, [enabled, runStatus, running, requestActivity]);
|
|
3027
|
+
}, [enabled, runStatus, running, requestActivity, runningFloorMs]);
|
|
3025
3028
|
useEffect(() => {
|
|
3026
3029
|
turnMessageIdRef.current = null;
|
|
3027
3030
|
setTurnMessageId(null);
|
|
@@ -3038,6 +3041,46 @@ const useConversationActivity = ({
|
|
|
3038
3041
|
}, [conversationId]);
|
|
3039
3042
|
return { elements, running, turnMessageId };
|
|
3040
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
|
+
};
|
|
3041
3084
|
const LIVE_READ_THROTTLE_MS = 1200;
|
|
3042
3085
|
const CONVERGENCE_BASE_DELAY_MS = 700;
|
|
3043
3086
|
const CONVERGENCE_MAX_DELAY_MS = 2500;
|
|
@@ -3454,13 +3497,13 @@ const parseWidgetType = (jsonCandidate) => {
|
|
|
3454
3497
|
};
|
|
3455
3498
|
const extractNakedJsonCandidates = (plainText) => {
|
|
3456
3499
|
const candidates = [];
|
|
3457
|
-
const
|
|
3500
|
+
const lines2 = plainText.split("\n");
|
|
3458
3501
|
let offset = 0;
|
|
3459
|
-
for (const
|
|
3502
|
+
for (const line2 of lines2) {
|
|
3460
3503
|
const lineStart = offset;
|
|
3461
|
-
offset +=
|
|
3462
|
-
if (!
|
|
3463
|
-
const openIndex = lineStart +
|
|
3504
|
+
offset += line2.length + 1;
|
|
3505
|
+
if (!line2.trimStart().startsWith("{")) continue;
|
|
3506
|
+
const openIndex = lineStart + line2.indexOf("{");
|
|
3464
3507
|
const jsonObjectEnd = findBalancedJsonObjectEnd(plainText, openIndex);
|
|
3465
3508
|
if (jsonObjectEnd !== null) {
|
|
3466
3509
|
candidates.push(plainText.slice(openIndex, jsonObjectEnd + 1));
|
|
@@ -3660,6 +3703,7 @@ const AgentChatController = (props) => {
|
|
|
3660
3703
|
initialComposerPrompt,
|
|
3661
3704
|
scrollTarget,
|
|
3662
3705
|
keepActivityHistoryAfterAnswer = false,
|
|
3706
|
+
activityTiming,
|
|
3663
3707
|
isPinnedToSingleConversation = false,
|
|
3664
3708
|
isOnboardingSetupConversation = false,
|
|
3665
3709
|
sendModelSource,
|
|
@@ -3686,9 +3730,21 @@ const AgentChatController = (props) => {
|
|
|
3686
3730
|
ThinkingIndicator,
|
|
3687
3731
|
ContentOverlay,
|
|
3688
3732
|
ActivityHistory,
|
|
3689
|
-
children
|
|
3733
|
+
children,
|
|
3734
|
+
disableSplitView = false,
|
|
3735
|
+
hostHasCanvasSurface = !disableSplitView,
|
|
3736
|
+
backgroundPaintedByHost: backgroundPaintedByHost2 = true,
|
|
3737
|
+
composerRef
|
|
3690
3738
|
} = props;
|
|
3739
|
+
const [canvasViability] = useState(() => new ElementWidthCanvasViability());
|
|
3691
3740
|
const conversationMessageInputApiRef = useRef(null);
|
|
3741
|
+
useImperativeHandle(
|
|
3742
|
+
composerRef,
|
|
3743
|
+
() => ({
|
|
3744
|
+
setComposerDraft: (text) => conversationMessageInputApiRef.current?.insertTextIntoInput(text)
|
|
3745
|
+
}),
|
|
3746
|
+
[]
|
|
3747
|
+
);
|
|
3692
3748
|
useEffect(() => {
|
|
3693
3749
|
if (!initialComposerPrompt) return;
|
|
3694
3750
|
conversationMessageInputApiRef.current?.insertTextIntoInput(initialComposerPrompt);
|
|
@@ -3763,6 +3819,11 @@ const AgentChatController = (props) => {
|
|
|
3763
3819
|
messagePages,
|
|
3764
3820
|
conversationId: liveConversationId
|
|
3765
3821
|
});
|
|
3822
|
+
const { chatActivityTiming: environmentActivityTiming } = useAgentsEnvironment();
|
|
3823
|
+
const resolvedActivityTiming = useMemo(
|
|
3824
|
+
() => resolveAgentChatActivityTiming(activityTiming, environmentActivityTiming),
|
|
3825
|
+
[activityTiming, environmentActivityTiming]
|
|
3826
|
+
);
|
|
3766
3827
|
const {
|
|
3767
3828
|
elements: activityElements,
|
|
3768
3829
|
running: activityRunning,
|
|
@@ -3770,16 +3831,21 @@ const AgentChatController = (props) => {
|
|
|
3770
3831
|
} = useConversationActivity({
|
|
3771
3832
|
conversationId: liveConversationId ?? 0,
|
|
3772
3833
|
runStatus,
|
|
3773
|
-
// 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).
|
|
3774
3835
|
signalVersion: liveReadCount,
|
|
3775
|
-
enabled: Boolean(liveConversationId)
|
|
3836
|
+
enabled: Boolean(liveConversationId),
|
|
3837
|
+
activityRequestWindowMs: resolvedActivityTiming.activityRequestWindowMs,
|
|
3838
|
+
runningFloorMs: resolvedActivityTiming.runningFloorMs
|
|
3776
3839
|
});
|
|
3777
3840
|
const activityTicker = useActivityTicker({
|
|
3778
3841
|
elements: activityElements,
|
|
3779
3842
|
running: activityRunning,
|
|
3780
3843
|
turnMessageId: activityTurnMessageId,
|
|
3781
3844
|
failed: !!error,
|
|
3782
|
-
keepActivityHistoryAfterAnswer
|
|
3845
|
+
keepActivityHistoryAfterAnswer,
|
|
3846
|
+
linePaceMs: resolvedActivityTiming.linePaceMs,
|
|
3847
|
+
backlogLinePaceMs: resolvedActivityTiming.backlogLinePaceMs,
|
|
3848
|
+
successBeatMs: resolvedActivityTiming.successBeatMs
|
|
3783
3849
|
});
|
|
3784
3850
|
useEffect(() => {
|
|
3785
3851
|
if (runStatus === "failed") {
|
|
@@ -3995,81 +4061,93 @@ const AgentChatController = (props) => {
|
|
|
3995
4061
|
failed: !!error,
|
|
3996
4062
|
activityTicker,
|
|
3997
4063
|
isAgentWorkingOnTask: agentActivity.active || activityTicker.phase === "live",
|
|
3998
|
-
agentSpaceKey
|
|
4064
|
+
agentSpaceKey,
|
|
4065
|
+
activityTiming: resolvedActivityTiming
|
|
3999
4066
|
};
|
|
4000
|
-
return /* @__PURE__ */ jsx(
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4067
|
+
return /* @__PURE__ */ jsx(CanvasViabilityContext.Provider, { value: canvasViability, children: /* @__PURE__ */ jsx(WidgetRenderReportCollectorContext.Provider, { value: renderReportCollector, children: /* @__PURE__ */ jsxs(
|
|
4068
|
+
ConversationWidgetProvider,
|
|
4069
|
+
{
|
|
4070
|
+
callbacks: widgetCallbacks,
|
|
4071
|
+
chatStore,
|
|
4072
|
+
hostHasCanvasSurface,
|
|
4073
|
+
children: [
|
|
4074
|
+
/* @__PURE__ */ jsx(
|
|
4075
|
+
ConversationDeepLinkedWidget,
|
|
4076
|
+
{
|
|
4077
|
+
widgetName: deepLinkedWidget?.name,
|
|
4078
|
+
agentSpaceKey
|
|
4079
|
+
},
|
|
4080
|
+
deepLinkedWidget?.mountKey ?? 0
|
|
4081
|
+
),
|
|
4082
|
+
/* @__PURE__ */ jsx(CanvasRestoreOnMount, { conversationId: liveConversationId, messages }),
|
|
4083
|
+
children,
|
|
4084
|
+
/* @__PURE__ */ jsx("div", { className: chatAreaClassName, ref: canvasViability.observe, children: /* @__PURE__ */ jsx("div", { className: chatWrapClassName, children: /* @__PURE__ */ jsx(
|
|
4085
|
+
ConversationView,
|
|
4086
|
+
{
|
|
4087
|
+
enableCanvasToggle: true,
|
|
4088
|
+
boxCanvasBelowTopBar: true,
|
|
4089
|
+
disableSplitView,
|
|
4090
|
+
confineTopBlurBandToChatPane: confineTopBlurBandToChatPane2,
|
|
4091
|
+
progressStepperSlot,
|
|
4092
|
+
enablePinQuestionAndRevealAnswer: true,
|
|
4093
|
+
isQuestionPinSuspended,
|
|
4094
|
+
scrollRef: chatScrollRef,
|
|
4095
|
+
scrollToBottomNonce,
|
|
4096
|
+
followBottomRef,
|
|
4097
|
+
scrollJumpActiveRef,
|
|
4098
|
+
backgroundPaintedByHost: backgroundPaintedByHost2,
|
|
4099
|
+
currentCategory: void 0,
|
|
4100
|
+
aiPromptExtension: void 0,
|
|
4101
|
+
suggestions: void 0,
|
|
4102
|
+
messages: chatMessages2,
|
|
4103
|
+
aiThinking: agentActivity.active,
|
|
4104
|
+
allowSendWhileAiThinking: true,
|
|
4105
|
+
thinkingIndicator: /* @__PURE__ */ jsx(ThinkingIndicator, { ...activityProps }),
|
|
4106
|
+
renderAfterMessage: keepActivityHistoryAfterAnswer ? renderActivityHistoryAfterMessage : void 0,
|
|
4107
|
+
hideAssistantMeta: true,
|
|
4108
|
+
userMessageTheme: "dark",
|
|
4109
|
+
error,
|
|
4110
|
+
rateLimitRetryAfterSeconds,
|
|
4111
|
+
onRetryFailedRun: handleRetryFailedRun,
|
|
4112
|
+
isDebugMode: false,
|
|
4113
|
+
categoriesLoaded: true,
|
|
4114
|
+
conversationId: conversationId ?? conversation?.id ?? void 0,
|
|
4115
|
+
startingNewConversation,
|
|
4116
|
+
showMessagesWithoutConversation: true,
|
|
4117
|
+
hasMoreOlder,
|
|
4118
|
+
loadingOlder,
|
|
4119
|
+
onLoadOlder: loadOlderOfLiveConversation,
|
|
4120
|
+
autoScroll: !!conversationId || (messages?.length ?? 0) > 0,
|
|
4121
|
+
isCompact,
|
|
4122
|
+
inputActionsSlot,
|
|
4123
|
+
inputTopSlot,
|
|
4124
|
+
inputSendDisabled,
|
|
4125
|
+
inputReplacementSlot,
|
|
4126
|
+
inputBandSlot,
|
|
4127
|
+
inputPlaceholder,
|
|
4128
|
+
inputSendReplacementWhenEmpty,
|
|
4129
|
+
inputGlowUnderlay,
|
|
4130
|
+
contentOverlaySlot: ContentOverlay ? /* @__PURE__ */ jsx(ContentOverlay, { ...activityProps }) : void 0,
|
|
4131
|
+
isContentOverlayShown,
|
|
4132
|
+
outgoingAttachmentImages: outgoingAttachments,
|
|
4133
|
+
taskInstructionMessageId,
|
|
4134
|
+
isConversationClosed: isConversationRunEnded,
|
|
4135
|
+
conversationMessageInputApiRef,
|
|
4136
|
+
onSuggestionClick: () => {
|
|
4137
|
+
},
|
|
4138
|
+
onSendMessage: handleSendMessage
|
|
4139
|
+
}
|
|
4140
|
+
) }) })
|
|
4141
|
+
]
|
|
4142
|
+
}
|
|
4143
|
+
) }) });
|
|
4068
4144
|
};
|
|
4069
4145
|
const chatArea = "agents_chatArea_4XiCda";
|
|
4146
|
+
const chatAreaWithTopBlurBand = "agents_chatAreaWithTopBlurBand_W-AdU0";
|
|
4070
4147
|
const chatWrap = "agents_chatWrap_yS-zs5";
|
|
4071
|
-
const styles$
|
|
4148
|
+
const styles$4 = {
|
|
4072
4149
|
chatArea,
|
|
4150
|
+
chatAreaWithTopBlurBand,
|
|
4073
4151
|
chatWrap
|
|
4074
4152
|
};
|
|
4075
4153
|
const selectConversation = (state) => state.conversation;
|
|
@@ -4085,8 +4163,10 @@ const AgentChat = (props) => {
|
|
|
4085
4163
|
conversationId: appConversationId,
|
|
4086
4164
|
onNewConversation,
|
|
4087
4165
|
inputReplacementSlot,
|
|
4088
|
-
chatAreaClassName
|
|
4089
|
-
chatWrapClassName = styles$
|
|
4166
|
+
chatAreaClassName,
|
|
4167
|
+
chatWrapClassName = styles$4.chatWrap,
|
|
4168
|
+
showsTopBlurBand = false,
|
|
4169
|
+
confineTopBlurBandToChatPane: confineTopBlurBandToChatPane2 = showsTopBlurBand,
|
|
4090
4170
|
...controllerProps
|
|
4091
4171
|
} = props;
|
|
4092
4172
|
const mountedClient = useOptionalAgentsConversationClient();
|
|
@@ -4120,10 +4200,11 @@ const AgentChat = (props) => {
|
|
|
4120
4200
|
if (client === null) {
|
|
4121
4201
|
throw new Error("AgentChat has no conversation client: pass `client`, or mount it in <AgentsProvider client={…}>.");
|
|
4122
4202
|
}
|
|
4123
|
-
return /* @__PURE__ */ jsx(
|
|
4203
|
+
return /* @__PURE__ */ jsx(AgentsConversationClientProvider, { client, children: /* @__PURE__ */ jsx(
|
|
4124
4204
|
AgentChatController,
|
|
4125
4205
|
{
|
|
4126
4206
|
...controllerProps,
|
|
4207
|
+
confineTopBlurBandToChatPane: confineTopBlurBandToChatPane2,
|
|
4127
4208
|
chatStore,
|
|
4128
4209
|
client,
|
|
4129
4210
|
agentSpaceKey,
|
|
@@ -4133,9 +4214,63 @@ const AgentChat = (props) => {
|
|
|
4133
4214
|
ThinkingIndicator,
|
|
4134
4215
|
ActivityHistory,
|
|
4135
4216
|
inputReplacementSlot: inputReplacementSlot ?? (isConversationRunEnded ? /* @__PURE__ */ jsx(ConversationClosedBar, {}) : void 0),
|
|
4136
|
-
chatAreaClassName,
|
|
4217
|
+
chatAreaClassName: chatAreaClassName ?? classNames(styles$4.chatArea, showsTopBlurBand ? styles$4.chatAreaWithTopBlurBand : void 0),
|
|
4137
4218
|
chatWrapClassName
|
|
4138
4219
|
}
|
|
4220
|
+
) });
|
|
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
|
+
}
|
|
4139
4274
|
);
|
|
4140
4275
|
};
|
|
4141
4276
|
const useDebouncedSemanticSearch = (fetcher, enabled) => {
|
|
@@ -4411,9 +4546,12 @@ const ConversationMessageInputAttachmentsPreviewStrip = (props) => {
|
|
|
4411
4546
|
);
|
|
4412
4547
|
};
|
|
4413
4548
|
export {
|
|
4549
|
+
ACTIVITY_STACK_VISIBLE_LINES,
|
|
4414
4550
|
AgentChat,
|
|
4551
|
+
AgentChatActivityDots,
|
|
4415
4552
|
AgentChatActivityHistory,
|
|
4416
4553
|
AgentChatActivityIndicator,
|
|
4554
|
+
AgentChatActivityStack,
|
|
4417
4555
|
AgentChatController,
|
|
4418
4556
|
A as AgentsChatStateContainer,
|
|
4419
4557
|
d as AgentsChatStoreProvider,
|
|
@@ -4433,6 +4571,7 @@ export {
|
|
|
4433
4571
|
ConversationMessageWidgets,
|
|
4434
4572
|
ConversationView,
|
|
4435
4573
|
ConversationWidgetProvider,
|
|
4574
|
+
DEFAULT_AGENT_CHAT_ACTIVITY_TIMING,
|
|
4436
4575
|
E as EMPTY_AGENTS_CHAT_OPENING_REQUEST,
|
|
4437
4576
|
I as INITIAL_AGENTS_CHAT_STATE,
|
|
4438
4577
|
MAX_MESSAGE_LENGTH,
|
|
@@ -4446,13 +4585,16 @@ export {
|
|
|
4446
4585
|
normalizeServerMessageToMarkdown,
|
|
4447
4586
|
r as readConversationErrorTypeOfRefusedSend,
|
|
4448
4587
|
e as reduceAgentsChatState,
|
|
4588
|
+
resolveAgentChatActivityTiming,
|
|
4449
4589
|
useActivityTicker,
|
|
4450
4590
|
useAgentsChatSelector,
|
|
4451
4591
|
f as useAgentsChatState,
|
|
4452
4592
|
g as useAgentsChatStore,
|
|
4593
|
+
useAgentsConversationClient,
|
|
4453
4594
|
useAgentsConversationRunStatus,
|
|
4454
4595
|
useConversationMessageSearch,
|
|
4455
4596
|
useConversationsSearch,
|
|
4456
|
-
h as useOptionalAgentsChatStore
|
|
4597
|
+
h as useOptionalAgentsChatStore,
|
|
4598
|
+
useOptionalAgentsConversationClient
|
|
4457
4599
|
};
|
|
4458
4600
|
//# sourceMappingURL=chat.js.map
|