@mgamadeus/ddd-agents 0.1.5 → 0.1.6
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/dist/chat.js +99 -120
- package/dist/chat.js.map +1 -1
- package/dist/chunks/{ConversationMessageInputComposerWidgets-BbpB0fZl.js → ConversationMessageInputComposerWidgets-Brm9t2n7.js} +4 -2
- package/dist/chunks/{ConversationMessageInputComposerWidgets-BbpB0fZl.js.map → ConversationMessageInputComposerWidgets-Brm9t2n7.js.map} +1 -1
- package/dist/chunks/WebSearchResultsConversationWidget-BXt98hGu.js.map +1 -1
- package/dist/chunks/canvas-behaviours-BpN_1xdZ.js.map +1 -1
- package/dist/chunks/{widget-click-signal-sources-cjIjjftL.js → canvas-title-slot-context-DV9gzj3u.js} +98 -10
- package/dist/chunks/canvas-title-slot-context-DV9gzj3u.js.map +1 -0
- package/dist/chunks/{canvasBodies-C_pdv17v.js → canvasBodies-DXQI9l9v.js} +2 -2
- package/dist/chunks/{canvasBodies-C_pdv17v.js.map → canvasBodies-DXQI9l9v.js.map} +1 -1
- package/dist/chunks/{widget-name-resolver-7WnzCpdG.js → widget-name-resolver-2_qV5T39.js} +9 -9
- package/dist/chunks/{widget-name-resolver-7WnzCpdG.js.map → widget-name-resolver-2_qV5T39.js.map} +1 -1
- package/dist/client-testing.js +2 -2
- package/dist/files/i18n-keys.json +9 -0
- package/dist/image-render.js +2 -2
- package/dist/index.js +2 -2
- package/dist/kit.js +1 -1
- package/dist/preview.js +3 -3
- package/dist/renderer.js +28 -23
- package/dist/styles.css +43 -14
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInput.d.ts +26 -4
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentPreviewWidget.d.ts +6 -3
- package/dist/types/chat/ConversationView.d.ts +9 -0
- package/dist/types/chat/ConversationViewBody/ConversationViewBody.d.ts +12 -0
- package/dist/types/chat/controller/AgentChatController.d.ts +19 -1
- package/dist/types/chat/conversation-send-message.d.ts +2 -2
- package/dist/types/entries/chat.d.ts +1 -1
- package/dist/types/entries/renderer.d.ts +4 -0
- package/dist/types/renderer/ConversationWidgetCallbacksContext.d.ts +7 -0
- package/dist/types/renderer/canvas/canvas-behaviours.d.ts +5 -0
- package/dist/types/renderer/canvas/canvas-title-slot-context.d.ts +6 -0
- package/dist/types/renderer/composer-library-file.d.ts +12 -0
- package/dist/types/renderer/composer-widget-fence.d.ts +4 -4
- package/dist/types/renderer/conversationWidgetRegistry.d.ts +12 -0
- package/package.json +1 -1
- package/public-api.json +10 -0
- package/dist/chunks/widget-click-signal-sources-cjIjjftL.js.map +0 -1
package/dist/chat.js
CHANGED
|
@@ -5,15 +5,15 @@ import { u as useAgentsConversationClient, a as useOptionalAgentsConversationCli
|
|
|
5
5
|
import { w as withPollingChangeSubscription } from "./chunks/withPollingChangeSubscription-CWavoKjJ.js";
|
|
6
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
7
|
import { i as isAgentsClientError, a as AgentsClientError } from "./chunks/conversation-CbWEHPbL.js";
|
|
8
|
-
import {
|
|
8
|
+
import { h as findBalancedJsonObjectEnd, r as resolveDeepLinkableWidget, d as buildMessageTextWithComposerWidgets, s as splitComposerWidgetFencesFromMessageText, j as WidgetWindowRootContext, a as ConversationMarkdown, i as isWidgetClickSignalSource, C as CanvasTitleSlotContext, e as buildWidgetRenderReportSignal, W as WIDGET_RENDER_REPORT_SIGNAL_SOURCE, k as createWidgetRenderReportCollector, l as WidgetRenderReportCollectorContext } from "./chunks/canvas-title-slot-context-DV9gzj3u.js";
|
|
9
|
+
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-2_qV5T39.js";
|
|
9
10
|
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
11
|
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
12
|
import { r as readStoredCanvas, c as clearStoredCanvas } from "./chunks/canvasStorage-DHNluopA.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { A, d, E, I, r, e, f, g, h } from "./chunks/ConversationMessageInputComposerWidgets-BbpB0fZl.js";
|
|
13
|
+
import { b as ConversationErrorType, a as ConversationMessageInputComposerWidgets, u as useAgentsChatSelector, C as ConversationWidgetProvider, c as createAgentsChatStore } from "./chunks/ConversationMessageInputComposerWidgets-Brm9t2n7.js";
|
|
14
|
+
import { A, d, E, I, r, e, f, g, h } from "./chunks/ConversationMessageInputComposerWidgets-Brm9t2n7.js";
|
|
15
15
|
import { t as textKey } from "./chunks/text-key-DnoZ4lAk.js";
|
|
16
|
-
import { c as canvasBodies } from "./chunks/canvasBodies-
|
|
16
|
+
import { c as canvasBodies } from "./chunks/canvasBodies-DXQI9l9v.js";
|
|
17
17
|
import { c as canvasFeatureFlagOf } from "./chunks/canvas-feature-flags-BmmxC3bz.js";
|
|
18
18
|
import { flushSync } from "react-dom";
|
|
19
19
|
import { b as buildChangedMessagesRequest, d as deriveAgentActivity } from "./chunks/contract-kmmw_19Y.js";
|
|
@@ -73,34 +73,6 @@ const ConversationClosedBar = (props) => {
|
|
|
73
73
|
/* @__PURE__ */ jsx(Text, { children: text })
|
|
74
74
|
] });
|
|
75
75
|
};
|
|
76
|
-
const findBalancedJsonObjectEnd = (text, fromIndex, maxScanLength = 5e3) => {
|
|
77
|
-
let objectStart = fromIndex;
|
|
78
|
-
while (objectStart < text.length && /\s/.test(text[objectStart])) objectStart++;
|
|
79
|
-
if (objectStart >= text.length || text[objectStart] !== "{") return null;
|
|
80
|
-
let depth = 0;
|
|
81
|
-
let inString = false;
|
|
82
|
-
let escaped = false;
|
|
83
|
-
const scanEnd = Math.min(text.length, objectStart + maxScanLength);
|
|
84
|
-
for (let index = objectStart; index < scanEnd; index++) {
|
|
85
|
-
const char = text[index];
|
|
86
|
-
if (escaped) {
|
|
87
|
-
escaped = false;
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
if (char === "\\") {
|
|
91
|
-
escaped = true;
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
if (char === '"') inString = !inString;
|
|
95
|
-
if (inString) continue;
|
|
96
|
-
if (char === "{") depth++;
|
|
97
|
-
if (char === "}") {
|
|
98
|
-
depth--;
|
|
99
|
-
if (depth === 0) return index;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return null;
|
|
103
|
-
};
|
|
104
76
|
const ANY_FENCE_DELIM_LINE = /^ {0,3}(`{3,}|~{3,})(.*)$/;
|
|
105
77
|
const parseFenceDelimiterLine = (line2) => {
|
|
106
78
|
const match = ANY_FENCE_DELIM_LINE.exec(line2);
|
|
@@ -444,6 +416,10 @@ const statusRow = "agents_statusRow_xoILly";
|
|
|
444
416
|
const characterCounter = "agents_characterCounter_VbCSLM";
|
|
445
417
|
const sendBlocked = "agents_sendBlocked_rNqOKm";
|
|
446
418
|
const compact = "agents_compact_ZBtAbD";
|
|
419
|
+
const compactStacked = "agents_compactStacked_XxL484";
|
|
420
|
+
const compactWithActionsStart = "agents_compactWithActionsStart_WXtqy0";
|
|
421
|
+
const compactTopSlot = "agents_compactTopSlot_x57yOL";
|
|
422
|
+
const compactActionsStart = "agents_compactActionsStart_3SeY5C";
|
|
447
423
|
const collapsed = "agents_collapsed_v3Ekqz";
|
|
448
424
|
const collapsedPillSizer = "agents_collapsedPillSizer_aqw7WI";
|
|
449
425
|
const styles$i = {
|
|
@@ -457,61 +433,13 @@ const styles$i = {
|
|
|
457
433
|
characterCounter,
|
|
458
434
|
sendBlocked,
|
|
459
435
|
compact,
|
|
436
|
+
compactStacked,
|
|
437
|
+
compactWithActionsStart,
|
|
438
|
+
compactTopSlot,
|
|
439
|
+
compactActionsStart,
|
|
460
440
|
collapsed,
|
|
461
441
|
collapsedPillSizer
|
|
462
442
|
};
|
|
463
|
-
const buildComposerWidgetFenceBlock = (widget) => "```" + WIDGET_FENCE_LANG + "\n" + JSON.stringify({ type: widget.widgetName, ...widget.fields }) + "\n```";
|
|
464
|
-
const buildMessageTextWithComposerWidgets = (text, widgets) => [text.trim(), ...widgets.map(buildComposerWidgetFenceBlock)].filter(Boolean).join("\n\n");
|
|
465
|
-
const composableWidgetNames = () => new Set(
|
|
466
|
-
conversationWidgetRegistry.widgets.filter((entry) => entry.composerComponent !== void 0).map((entry) => entry.name)
|
|
467
|
-
);
|
|
468
|
-
const splitComposerWidgetFencesFromMessageText = (text) => {
|
|
469
|
-
const composableNames = composableWidgetNames();
|
|
470
|
-
const widgets = [];
|
|
471
|
-
const fenceOpen = "```" + WIDGET_FENCE_LANG;
|
|
472
|
-
let remaining = "";
|
|
473
|
-
let cursor = 0;
|
|
474
|
-
while (cursor < text.length) {
|
|
475
|
-
const openIndex = text.indexOf(fenceOpen, cursor);
|
|
476
|
-
if (openIndex === -1) {
|
|
477
|
-
remaining += text.slice(cursor);
|
|
478
|
-
break;
|
|
479
|
-
}
|
|
480
|
-
const afterOpen = openIndex + fenceOpen.length;
|
|
481
|
-
const jsonStart = afterOpen + 1;
|
|
482
|
-
const objectEnd = text[afterOpen] === "\n" ? findBalancedJsonObjectEnd(text, jsonStart) : null;
|
|
483
|
-
if (objectEnd === null) {
|
|
484
|
-
remaining += text.slice(cursor, afterOpen);
|
|
485
|
-
cursor = afterOpen;
|
|
486
|
-
continue;
|
|
487
|
-
}
|
|
488
|
-
const afterJson = objectEnd + 1;
|
|
489
|
-
const closeMatch = /^\s*```/.exec(text.slice(afterJson));
|
|
490
|
-
if (!closeMatch) {
|
|
491
|
-
remaining += text.slice(cursor, afterOpen);
|
|
492
|
-
cursor = afterOpen;
|
|
493
|
-
continue;
|
|
494
|
-
}
|
|
495
|
-
const fenceEnd = afterJson + closeMatch[0].length;
|
|
496
|
-
let parsed;
|
|
497
|
-
try {
|
|
498
|
-
parsed = JSON.parse(text.slice(jsonStart, objectEnd + 1));
|
|
499
|
-
} catch {
|
|
500
|
-
parsed = void 0;
|
|
501
|
-
}
|
|
502
|
-
const { type, ...fields } = typeof parsed === "object" && parsed !== null ? parsed : {};
|
|
503
|
-
const widgetName = typeof type === "string" ? resolveWidgetName(type) : void 0;
|
|
504
|
-
if (!widgetName || !composableNames.has(widgetName)) {
|
|
505
|
-
remaining += text.slice(cursor, fenceEnd);
|
|
506
|
-
cursor = fenceEnd;
|
|
507
|
-
continue;
|
|
508
|
-
}
|
|
509
|
-
remaining += text.slice(cursor, openIndex);
|
|
510
|
-
widgets.push({ composerWidgetId: `${widgetName}:${widgets.length}`, widgetName, fields });
|
|
511
|
-
cursor = fenceEnd;
|
|
512
|
-
}
|
|
513
|
-
return { text: remaining.trim(), widgets };
|
|
514
|
-
};
|
|
515
443
|
const COMPACT_INPUT_RADIUS_PX = 28;
|
|
516
444
|
const MAX_MESSAGE_LENGTH = 1e4;
|
|
517
445
|
const CHARACTER_COUNTER_SHOWN_FROM_LENGTH = Math.floor(MAX_MESSAGE_LENGTH * 0.9);
|
|
@@ -523,6 +451,7 @@ const ConversationMessageInput = (props) => {
|
|
|
523
451
|
isProcessing = false,
|
|
524
452
|
testId = "chat-input",
|
|
525
453
|
className,
|
|
454
|
+
inputContainerClassName,
|
|
526
455
|
actionsSlot,
|
|
527
456
|
actionsSlotStart,
|
|
528
457
|
topSlot,
|
|
@@ -530,10 +459,12 @@ const ConversationMessageInput = (props) => {
|
|
|
530
459
|
glowUnderlay,
|
|
531
460
|
sendDisabled = false,
|
|
532
461
|
outgoingAttachmentImages,
|
|
462
|
+
hostComposerWidgets,
|
|
533
463
|
outgoingComposerWidgets,
|
|
534
464
|
onComposerWidgetsSent,
|
|
535
465
|
apiRef,
|
|
536
466
|
compact: compact2 = false,
|
|
467
|
+
compactStackedSlots = false,
|
|
537
468
|
collapsed: collapsed2 = false,
|
|
538
469
|
onCollapsedPillWidthChange
|
|
539
470
|
} = props;
|
|
@@ -546,8 +477,10 @@ const ConversationMessageInput = (props) => {
|
|
|
546
477
|
const sendButtonAccessibleName = texts.translate("Send message");
|
|
547
478
|
const collapsedPillSizerRef = useRef(null);
|
|
548
479
|
const measuresCollapsedPillWidth = compact2 && !!onCollapsedPillWidthChange;
|
|
480
|
+
const isCompactStacked = compact2 && compactStackedSlots;
|
|
549
481
|
const isMessageTooLong = inputValue.length > MAX_MESSAGE_LENGTH;
|
|
550
|
-
const
|
|
482
|
+
const composerWidgetsToSend = [...outgoingComposerWidgets ?? [], ...hostComposerWidgets ?? []];
|
|
483
|
+
const hasSendableContent = inputValue.trim() !== "" || composerWidgetsToSend.length > 0;
|
|
551
484
|
const focusInputAtEnd = () => {
|
|
552
485
|
if (!inputRef.current) return;
|
|
553
486
|
inputRef.current.focus();
|
|
@@ -565,14 +498,15 @@ const ConversationMessageInput = (props) => {
|
|
|
565
498
|
focusInputAtEnd();
|
|
566
499
|
}
|
|
567
500
|
};
|
|
568
|
-
useImperativeHandle(apiRef, () => ({ insertTextIntoInput: setInputText }));
|
|
501
|
+
useImperativeHandle(apiRef, () => ({ insertTextIntoInput: setInputText, focusInput: focusInputAtEnd }));
|
|
569
502
|
const handleSendMessage = () => {
|
|
570
|
-
const messageText = buildMessageTextWithComposerWidgets(inputValue,
|
|
503
|
+
const messageText = buildMessageTextWithComposerWidgets(inputValue, composerWidgetsToSend);
|
|
571
504
|
if (!messageText || disabled || isProcessing || isMessageTooLong || sendDisabled) return;
|
|
572
|
-
onSendMessage?.(messageText, {
|
|
505
|
+
const accepted = onSendMessage?.(messageText, {
|
|
573
506
|
attachments: outgoingAttachmentImages?.length ? outgoingAttachmentImages : void 0,
|
|
574
|
-
composerWidgets:
|
|
507
|
+
composerWidgets: composerWidgetsToSend.length ? composerWidgetsToSend : void 0
|
|
575
508
|
});
|
|
509
|
+
if (accepted === false) return;
|
|
576
510
|
onComposerWidgetsSent?.();
|
|
577
511
|
setInputValue("");
|
|
578
512
|
if (inputRef.current) {
|
|
@@ -681,13 +615,21 @@ const ConversationMessageInput = (props) => {
|
|
|
681
615
|
children: /* @__PURE__ */ jsxs(
|
|
682
616
|
"div",
|
|
683
617
|
{
|
|
684
|
-
className: classNames(
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
618
|
+
className: classNames(
|
|
619
|
+
styles$i.inputContainer,
|
|
620
|
+
{
|
|
621
|
+
[styles$i.compact]: compact2,
|
|
622
|
+
[styles$i.compactStacked]: isCompactStacked,
|
|
623
|
+
[styles$i.compactWithActionsStart]: isCompactStacked && !!actionsSlotStart,
|
|
624
|
+
[styles$i.collapsed]: compact2 && collapsed2
|
|
625
|
+
},
|
|
626
|
+
inputContainerClassName
|
|
627
|
+
),
|
|
688
628
|
onMouseDown: handleContainerMouseDown,
|
|
689
629
|
children: [
|
|
690
|
-
topSlot,
|
|
630
|
+
isCompactStacked && !!topSlot && /* @__PURE__ */ jsx("div", { className: styles$i.compactTopSlot, children: topSlot }),
|
|
631
|
+
!isCompactStacked && topSlot,
|
|
632
|
+
isCompactStacked && !!actionsSlotStart && /* @__PURE__ */ jsx("div", { className: styles$i.compactActionsStart, children: actionsSlotStart }),
|
|
691
633
|
/* @__PURE__ */ jsx(
|
|
692
634
|
"span",
|
|
693
635
|
{
|
|
@@ -714,7 +656,7 @@ const ConversationMessageInput = (props) => {
|
|
|
714
656
|
}
|
|
715
657
|
) }),
|
|
716
658
|
/* @__PURE__ */ jsxs("div", { className: styles$i.actions, children: [
|
|
717
|
-
actionsSlotStart && /* @__PURE__ */ jsx("div", { className: styles$i.actionsStart, children: actionsSlotStart }),
|
|
659
|
+
!isCompactStacked && !!actionsSlotStart && /* @__PURE__ */ jsx("div", { className: styles$i.actionsStart, children: actionsSlotStart }),
|
|
718
660
|
actionsSlot,
|
|
719
661
|
sendReplacementWhenEmpty && !hasSendableContent ? sendReplacementWhenEmpty : /* @__PURE__ */ jsx("div", { className: classNames({ [styles$i.sendBlocked]: isMessageTooLong }), children: /* @__PURE__ */ jsx(
|
|
720
662
|
Tooltip,
|
|
@@ -808,11 +750,13 @@ const ConversationLoading = () => {
|
|
|
808
750
|
] });
|
|
809
751
|
};
|
|
810
752
|
const message = "agents_message_BScH1l";
|
|
753
|
+
const messageWithWidgetsAboveBubble = "agents_messageWithWidgetsAboveBubble_bWTYWp";
|
|
811
754
|
const whiteBubble = "agents_whiteBubble_4-I21V";
|
|
812
755
|
const darkBubble = "agents_darkBubble_YdEIoi";
|
|
813
756
|
const primaryBubble = "agents_primaryBubble_jo9Zj-";
|
|
814
757
|
const styles$h = {
|
|
815
758
|
message,
|
|
759
|
+
messageWithWidgetsAboveBubble,
|
|
816
760
|
whiteBubble,
|
|
817
761
|
darkBubble,
|
|
818
762
|
primaryBubble
|
|
@@ -827,14 +771,22 @@ const ConversationMessageUserWidgets = (props) => {
|
|
|
827
771
|
return /* @__PURE__ */ jsx(ConversationWidgetErrorBoundary, { widgetName: entry.name, children: /* @__PURE__ */ jsx(Component, { payload: JSON.stringify(widget.fields), fresh: false }) }, widget.composerWidgetId);
|
|
828
772
|
}) });
|
|
829
773
|
};
|
|
774
|
+
const isShownAboveBubble = (widget) => conversationWidgetRegistry.widgets.find((entry) => entry.name === widget.widgetName)?.customerMessagePlacement === "aboveBubble";
|
|
830
775
|
const ConversationMessageUser = (props) => {
|
|
831
776
|
const { text, isGenericChat, theme = "default" } = props;
|
|
832
777
|
const { text: proseText, widgets } = useMemo(() => splitComposerWidgetFencesFromMessageText(text), [text]);
|
|
778
|
+
const widgetsAboveBubble = useMemo(() => widgets.filter(isShownAboveBubble), [widgets]);
|
|
779
|
+
const widgetsInsideBubble = useMemo(() => widgets.filter((widget) => !isShownAboveBubble(widget)), [widgets]);
|
|
833
780
|
const bubbleClass = theme === "light" ? styles$h.whiteBubble : theme === "dark" ? styles$h.darkBubble : theme === "primary" ? styles$h.primaryBubble : void 0;
|
|
834
781
|
const textColor = theme === "light" ? "var(--agents-fg)" : theme === "dark" ? "var(--agents-chat-user-bubble-text)" : "var(--agents-fg-on-accent)";
|
|
835
|
-
|
|
836
|
-
/* @__PURE__ */ jsx(ConversationMessageUserWidgets, { widgets }),
|
|
837
|
-
/* @__PURE__ */ jsx(Text, { allowNewLines: true, translate: false, color: textColor, children: proseText })
|
|
782
|
+
const bubble = /* @__PURE__ */ jsxs("div", { className: classNames(styles$h.message, bubbleClass), "data-testid": "chat-message-user", children: [
|
|
783
|
+
/* @__PURE__ */ jsx(ConversationMessageUserWidgets, { widgets: widgetsInsideBubble }),
|
|
784
|
+
proseText !== "" && /* @__PURE__ */ jsx(Text, { allowNewLines: true, translate: false, color: textColor, children: proseText })
|
|
785
|
+
] });
|
|
786
|
+
if (widgetsAboveBubble.length === 0) return bubble;
|
|
787
|
+
return /* @__PURE__ */ jsxs("div", { className: styles$h.messageWithWidgetsAboveBubble, children: [
|
|
788
|
+
/* @__PURE__ */ jsx(ConversationMessageUserWidgets, { widgets: widgetsAboveBubble }),
|
|
789
|
+
(proseText !== "" || widgetsInsideBubble.length > 0) && bubble
|
|
838
790
|
] });
|
|
839
791
|
};
|
|
840
792
|
const responseContainer$2 = "agents_responseContainer_1-FSNs";
|
|
@@ -1849,6 +1801,7 @@ const ConversationViewBody = (props) => {
|
|
|
1849
1801
|
background,
|
|
1850
1802
|
backgroundPaintedByHost: backgroundPaintedByHost2,
|
|
1851
1803
|
progressStepperSlot,
|
|
1804
|
+
fileDropHintSlot,
|
|
1852
1805
|
scrollRef,
|
|
1853
1806
|
scrollToBottomNonce,
|
|
1854
1807
|
followBottomRef,
|
|
@@ -1872,6 +1825,7 @@ const ConversationViewBody = (props) => {
|
|
|
1872
1825
|
contentOverlaySlot,
|
|
1873
1826
|
isContentOverlayShown = false,
|
|
1874
1827
|
outgoingAttachmentImages,
|
|
1828
|
+
hostComposerWidgets,
|
|
1875
1829
|
conversationMessageInputApiRef,
|
|
1876
1830
|
allowSendWhileAiThinking,
|
|
1877
1831
|
enablePinQuestionAndRevealAnswer = false,
|
|
@@ -2164,6 +2118,7 @@ const ConversationViewBody = (props) => {
|
|
|
2164
2118
|
children: [
|
|
2165
2119
|
background ? /* @__PURE__ */ jsx("div", { className: styles$j.backgroundLayer, children: background }) : backgroundPaintedByHost2 ? null : AssistantBackground ? /* @__PURE__ */ jsx(AssistantBackground, { category: currentCategory, categoryAlias: currentCategory?.alias ?? void 0 }) : null,
|
|
2166
2120
|
progressStepperSlot,
|
|
2121
|
+
fileDropHintSlot,
|
|
2167
2122
|
contentOverlaySlot !== void 0 ? /* @__PURE__ */ jsxs("div", { className: styles$j.contentLayers, "data-overlay-shown": isContentOverlayShown || void 0, children: [
|
|
2168
2123
|
messageColumn,
|
|
2169
2124
|
/* @__PURE__ */ jsx(
|
|
@@ -2199,6 +2154,7 @@ const ConversationViewBody = (props) => {
|
|
|
2199
2154
|
] }),
|
|
2200
2155
|
sendDisabled: inputSendDisabled,
|
|
2201
2156
|
outgoingAttachmentImages,
|
|
2157
|
+
hostComposerWidgets,
|
|
2202
2158
|
outgoingComposerWidgets: composerWidgets,
|
|
2203
2159
|
onComposerWidgetsSent: clearComposerWidgets,
|
|
2204
2160
|
apiRef: conversationMessageInputApiRef,
|
|
@@ -2215,6 +2171,7 @@ const ConversationViewBody = (props) => {
|
|
|
2215
2171
|
const root = "agents_root_1zXxaE";
|
|
2216
2172
|
const rootBoxed = "agents_rootBoxed_WyFSTZ";
|
|
2217
2173
|
const closeButtonRow = "agents_closeButtonRow_Ra3aXk";
|
|
2174
|
+
const titleSlot = "agents_titleSlot_ZFjpZe";
|
|
2218
2175
|
const rootFullBleedContent = "agents_rootFullBleedContent_-D9E-y";
|
|
2219
2176
|
const rootOverlayCloseButton = "agents_rootOverlayCloseButton_qUiHhW";
|
|
2220
2177
|
const content = "agents_content_N-4-2W";
|
|
@@ -2223,6 +2180,7 @@ const classes = {
|
|
|
2223
2180
|
root,
|
|
2224
2181
|
rootBoxed,
|
|
2225
2182
|
closeButtonRow,
|
|
2183
|
+
titleSlot,
|
|
2226
2184
|
rootFullBleedContent,
|
|
2227
2185
|
rootOverlayCloseButton,
|
|
2228
2186
|
content,
|
|
@@ -2239,6 +2197,7 @@ const CanvasPane = ({ messages, boxed = false }) => {
|
|
|
2239
2197
|
const { canvas, closeCanvas, chatAgentSpaceKey } = useConversationWidgetContext();
|
|
2240
2198
|
const mountGeneration = canvas?.mountGeneration;
|
|
2241
2199
|
const [contentReady, setContentReady] = useState(false);
|
|
2200
|
+
const [titleSlot2, setTitleSlot] = useState(null);
|
|
2242
2201
|
useEffect(() => {
|
|
2243
2202
|
setContentReady(false);
|
|
2244
2203
|
const timer = window.setTimeout(() => setContentReady(true), CANVAS_OPEN_SETTLE_MS);
|
|
@@ -2266,23 +2225,26 @@ const CanvasPane = ({ messages, boxed = false }) => {
|
|
|
2266
2225
|
"data-testid": "chat-canvas-pane",
|
|
2267
2226
|
"data-canvas-id": canvas.canvasId,
|
|
2268
2227
|
children: [
|
|
2269
|
-
/* @__PURE__ */
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2228
|
+
/* @__PURE__ */ jsxs("div", { className: classes.closeButtonRow, children: [
|
|
2229
|
+
behaviour?.titleBesideCloseButton && /* @__PURE__ */ jsx("div", { ref: setTitleSlot, className: classes.titleSlot }),
|
|
2230
|
+
/* @__PURE__ */ jsx(
|
|
2231
|
+
Button,
|
|
2232
|
+
{
|
|
2233
|
+
variant: "muted",
|
|
2234
|
+
inverted: behaviour?.overlayCloseButton,
|
|
2235
|
+
onDark: behaviour?.overlayCloseButton,
|
|
2236
|
+
icon: "closeCanvas",
|
|
2237
|
+
iconPosition: "right",
|
|
2238
|
+
rounded: true,
|
|
2239
|
+
blurred: true,
|
|
2240
|
+
onClick: () => closeCanvas(true),
|
|
2241
|
+
children: "Close canvas"
|
|
2242
|
+
}
|
|
2243
|
+
)
|
|
2244
|
+
] }),
|
|
2283
2245
|
/* @__PURE__ */ jsx("div", { className: classes.content, children: contentReady ? (
|
|
2284
2246
|
// The app's wrapper of a canvas body (host application: canvas-hosted list pages must not rewrite the page URL).
|
|
2285
|
-
/* @__PURE__ */ jsx(CanvasBodyContainer, { children: /* @__PURE__ */ jsx(ConversationWidgetErrorBoundary, { widgetName: `canvas:${canvas.canvasId}`, children: featureFlag ? (
|
|
2247
|
+
/* @__PURE__ */ jsx(CanvasBodyContainer, { children: /* @__PURE__ */ jsx(CanvasTitleSlotContext.Provider, { value: behaviour?.titleBesideCloseButton ? titleSlot2 : null, children: /* @__PURE__ */ jsx(ConversationWidgetErrorBoundary, { widgetName: `canvas:${canvas.canvasId}`, children: featureFlag ? (
|
|
2286
2248
|
// The canvas owns its gate (not inherited from an opener): a restored or page-opened canvas has no
|
|
2287
2249
|
// widget mount to inherit it from. A page anchor's agent space is the gate's agent space.
|
|
2288
2250
|
/* @__PURE__ */ jsx(
|
|
@@ -2293,7 +2255,7 @@ const CanvasPane = ({ messages, boxed = false }) => {
|
|
|
2293
2255
|
children: body
|
|
2294
2256
|
}
|
|
2295
2257
|
)
|
|
2296
|
-
) : body }) })
|
|
2258
|
+
) : body }) }) })
|
|
2297
2259
|
) : /* @__PURE__ */ jsx(OpeningLoader, {}) }, canvas.mountGeneration)
|
|
2298
2260
|
]
|
|
2299
2261
|
}
|
|
@@ -3708,6 +3670,8 @@ const AgentChatController = (props) => {
|
|
|
3708
3670
|
isOnboardingSetupConversation = false,
|
|
3709
3671
|
sendModelSource,
|
|
3710
3672
|
onAttachmentsSent,
|
|
3673
|
+
onComposerWidgetsSent,
|
|
3674
|
+
attachLibraryFilesToComposer,
|
|
3711
3675
|
startingIdeasMarkdown,
|
|
3712
3676
|
followBottom = false,
|
|
3713
3677
|
chatScrollRef,
|
|
@@ -3715,8 +3679,11 @@ const AgentChatController = (props) => {
|
|
|
3715
3679
|
confineTopBlurBandToChatPane: confineTopBlurBandToChatPane2 = false,
|
|
3716
3680
|
chatAreaClassName,
|
|
3717
3681
|
chatWrapClassName,
|
|
3682
|
+
chatAreaProps,
|
|
3718
3683
|
progressStepperSlot,
|
|
3684
|
+
fileDropHintSlot,
|
|
3719
3685
|
inputActionsSlot,
|
|
3686
|
+
inputActionsSlotStart,
|
|
3720
3687
|
inputTopSlot,
|
|
3721
3688
|
inputSendDisabled,
|
|
3722
3689
|
inputReplacementSlot,
|
|
@@ -3727,6 +3694,7 @@ const AgentChatController = (props) => {
|
|
|
3727
3694
|
isContentOverlayShown,
|
|
3728
3695
|
isQuestionPinSuspended,
|
|
3729
3696
|
outgoingAttachments,
|
|
3697
|
+
hostComposerWidgets,
|
|
3730
3698
|
ThinkingIndicator,
|
|
3731
3699
|
ContentOverlay,
|
|
3732
3700
|
ActivityHistory,
|
|
@@ -3741,7 +3709,8 @@ const AgentChatController = (props) => {
|
|
|
3741
3709
|
useImperativeHandle(
|
|
3742
3710
|
composerRef,
|
|
3743
3711
|
() => ({
|
|
3744
|
-
setComposerDraft: (text) => conversationMessageInputApiRef.current?.insertTextIntoInput(text)
|
|
3712
|
+
setComposerDraft: (text) => conversationMessageInputApiRef.current?.insertTextIntoInput(text),
|
|
3713
|
+
focusComposer: () => conversationMessageInputApiRef.current?.focusInput?.()
|
|
3745
3714
|
}),
|
|
3746
3715
|
[]
|
|
3747
3716
|
);
|
|
@@ -3874,7 +3843,7 @@ const AgentChatController = (props) => {
|
|
|
3874
3843
|
setScrollToBottomNonce((nonce) => nonce + 1);
|
|
3875
3844
|
}, [chatStore]);
|
|
3876
3845
|
const handleSendMessage = useCallback(
|
|
3877
|
-
(message2, { startSignalText, attachments, entryPointKey }) => {
|
|
3846
|
+
(message2, { startSignalText, attachments, composerWidgets, entryPointKey }) => {
|
|
3878
3847
|
if (isConversationRunEnded) {
|
|
3879
3848
|
rejectAsConversationClosed();
|
|
3880
3849
|
return false;
|
|
@@ -3884,6 +3853,7 @@ const AgentChatController = (props) => {
|
|
|
3884
3853
|
const sentMessageText = client.composeSentMessageText ? client.composeSentMessageText(message2, attachments) : message2;
|
|
3885
3854
|
const reportSentAttachments = () => {
|
|
3886
3855
|
if (attachments?.length) onAttachmentsSent?.();
|
|
3856
|
+
if (composerWidgets?.length) onComposerWidgetsSent?.(composerWidgets);
|
|
3887
3857
|
};
|
|
3888
3858
|
if (conversation?.id) {
|
|
3889
3859
|
const postConversationId = conversation.id;
|
|
@@ -3921,6 +3891,7 @@ const AgentChatController = (props) => {
|
|
|
3921
3891
|
agentSpaceKey,
|
|
3922
3892
|
sendModelSource,
|
|
3923
3893
|
onAttachmentsSent,
|
|
3894
|
+
onComposerWidgetsSent,
|
|
3924
3895
|
isConversationRunEnded,
|
|
3925
3896
|
rejectAsConversationClosed,
|
|
3926
3897
|
fetchOpeningPage,
|
|
@@ -3997,6 +3968,7 @@ const AgentChatController = (props) => {
|
|
|
3997
3968
|
sendMessageToChat: (message2) => Promise.resolve(handleSendMessage(message2, {}) === true),
|
|
3998
3969
|
injectSignal: handleInjectSignal,
|
|
3999
3970
|
prefillComposer: (text) => conversationMessageInputApiRef.current?.insertTextIntoInput(text),
|
|
3971
|
+
attachLibraryFilesToComposer,
|
|
4000
3972
|
chatAgentSpaceKey: agentSpaceKey,
|
|
4001
3973
|
conversationId: liveConversationId,
|
|
4002
3974
|
onOpenConversation,
|
|
@@ -4006,6 +3978,7 @@ const AgentChatController = (props) => {
|
|
|
4006
3978
|
[
|
|
4007
3979
|
handleSendMessage,
|
|
4008
3980
|
handleInjectSignal,
|
|
3981
|
+
attachLibraryFilesToComposer,
|
|
4009
3982
|
agentSpaceKey,
|
|
4010
3983
|
liveConversationId,
|
|
4011
3984
|
onOpenConversation,
|
|
@@ -4081,7 +4054,7 @@ const AgentChatController = (props) => {
|
|
|
4081
4054
|
),
|
|
4082
4055
|
/* @__PURE__ */ jsx(CanvasRestoreOnMount, { conversationId: liveConversationId, messages }),
|
|
4083
4056
|
children,
|
|
4084
|
-
/* @__PURE__ */ jsx("div", { className: chatAreaClassName, ref: canvasViability.observe, children: /* @__PURE__ */ jsx("div", { className: chatWrapClassName, children: /* @__PURE__ */ jsx(
|
|
4057
|
+
/* @__PURE__ */ jsx("div", { ...chatAreaProps, className: chatAreaClassName, ref: canvasViability.observe, children: /* @__PURE__ */ jsx("div", { className: chatWrapClassName, children: /* @__PURE__ */ jsx(
|
|
4085
4058
|
ConversationView,
|
|
4086
4059
|
{
|
|
4087
4060
|
enableCanvasToggle: true,
|
|
@@ -4089,6 +4062,7 @@ const AgentChatController = (props) => {
|
|
|
4089
4062
|
disableSplitView,
|
|
4090
4063
|
confineTopBlurBandToChatPane: confineTopBlurBandToChatPane2,
|
|
4091
4064
|
progressStepperSlot,
|
|
4065
|
+
fileDropHintSlot,
|
|
4092
4066
|
enablePinQuestionAndRevealAnswer: true,
|
|
4093
4067
|
isQuestionPinSuspended,
|
|
4094
4068
|
scrollRef: chatScrollRef,
|
|
@@ -4120,6 +4094,7 @@ const AgentChatController = (props) => {
|
|
|
4120
4094
|
autoScroll: !!conversationId || (messages?.length ?? 0) > 0,
|
|
4121
4095
|
isCompact,
|
|
4122
4096
|
inputActionsSlot,
|
|
4097
|
+
inputActionsSlotStart,
|
|
4123
4098
|
inputTopSlot,
|
|
4124
4099
|
inputSendDisabled,
|
|
4125
4100
|
inputReplacementSlot,
|
|
@@ -4130,6 +4105,7 @@ const AgentChatController = (props) => {
|
|
|
4130
4105
|
contentOverlaySlot: ContentOverlay ? /* @__PURE__ */ jsx(ContentOverlay, { ...activityProps }) : void 0,
|
|
4131
4106
|
isContentOverlayShown,
|
|
4132
4107
|
outgoingAttachmentImages: outgoingAttachments,
|
|
4108
|
+
hostComposerWidgets,
|
|
4133
4109
|
taskInstructionMessageId,
|
|
4134
4110
|
isConversationClosed: isConversationRunEnded,
|
|
4135
4111
|
conversationMessageInputApiRef,
|
|
@@ -4461,6 +4437,7 @@ const convertBytesToSizeString = (bytes) => {
|
|
|
4461
4437
|
};
|
|
4462
4438
|
const ConversationMessageInputAttachmentPreviewWidget = (props) => {
|
|
4463
4439
|
const { attachment, onRemove, testId = "chat-input-attachment" } = props;
|
|
4440
|
+
const texts = useAgentsTexts();
|
|
4464
4441
|
const isUploading = attachment.uploadStatus === "uploading";
|
|
4465
4442
|
const hasFailed = attachment.uploadStatus === "failed";
|
|
4466
4443
|
const isProcessingAfterUpload = isUploading && attachment.uploadProgressPercent >= 100;
|
|
@@ -4510,13 +4487,14 @@ const ConversationMessageInputAttachmentPreviewWidget = (props) => {
|
|
|
4510
4487
|
children: "Upload failed"
|
|
4511
4488
|
}
|
|
4512
4489
|
),
|
|
4513
|
-
/* @__PURE__ */ jsx("span", { className: styles.removeButtonHolder, children: /* @__PURE__ */ jsx(
|
|
4490
|
+
onRemove !== void 0 && /* @__PURE__ */ jsx("span", { className: styles.removeButtonHolder, children: /* @__PURE__ */ jsx(
|
|
4514
4491
|
Button,
|
|
4515
4492
|
{
|
|
4516
4493
|
className: styles.removeButton,
|
|
4517
4494
|
variant: "muted",
|
|
4518
4495
|
size: "small",
|
|
4519
|
-
icon: "
|
|
4496
|
+
icon: "trash",
|
|
4497
|
+
ariaLabel: texts.translate("Remove file"),
|
|
4520
4498
|
onClick: onRemove,
|
|
4521
4499
|
testId: `${testId}-remove-button`,
|
|
4522
4500
|
rounded: true
|
|
@@ -4563,6 +4541,7 @@ export {
|
|
|
4563
4541
|
ConversationErrorType,
|
|
4564
4542
|
ConversationErrorWidget,
|
|
4565
4543
|
ConversationMessageInput,
|
|
4544
|
+
ConversationMessageInputAttachmentPreviewWidget,
|
|
4566
4545
|
ConversationMessageInputAttachmentsErrorBox,
|
|
4567
4546
|
ConversationMessageInputAttachmentsPreviewStrip,
|
|
4568
4547
|
ConversationMessageList,
|