@mgamadeus/ddd-agents 0.1.0-alpha.51 → 0.1.0-alpha.53
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 +30 -29
- package/dist/chat.js.map +1 -1
- package/dist/chunks/{ConversationMessageInputComposerWidgets-CzQnpW0h.js → ConversationMessageInputComposerWidgets-CFU9Bxjr.js} +5 -5
- package/dist/chunks/ConversationMessageInputComposerWidgets-CFU9Bxjr.js.map +1 -0
- package/dist/chunks/{WebSearchResultsConversationWidget-tDhawe9f.js → WebSearchResultsConversationWidget-H6cbTapV.js} +85 -83
- package/dist/chunks/WebSearchResultsConversationWidget-H6cbTapV.js.map +1 -0
- package/dist/chunks/{canvas-reducers-BdIPZW_6.js → canvas-reducers-Cdxt8yDF.js} +2 -2
- package/dist/chunks/canvas-reducers-Cdxt8yDF.js.map +1 -0
- package/dist/chunks/{canvasBodies-BiUt8MUG.js → canvasBodies-BY1uT2og.js} +4 -4
- package/dist/chunks/{canvasBodies-BiUt8MUG.js.map → canvasBodies-BY1uT2og.js.map} +1 -1
- package/dist/chunks/{widget-click-signal-sources-BR82QygL.js → widget-click-signal-sources-DOpjIWdO.js} +3 -3
- package/dist/chunks/{widget-click-signal-sources-BR82QygL.js.map → widget-click-signal-sources-DOpjIWdO.js.map} +1 -1
- package/dist/chunks/{widget-name-resolver-BaxKaRa3.js → widget-name-resolver-BFHZuaYL.js} +4 -4
- package/dist/chunks/{widget-name-resolver-BaxKaRa3.js.map → widget-name-resolver-BFHZuaYL.js.map} +1 -1
- package/dist/client-testing.js +3 -3
- package/dist/image-render.js +7 -7
- package/dist/index.js +3 -3
- package/dist/kit.js +2 -2
- package/dist/preview.js +5 -5
- package/dist/preview.js.map +1 -1
- package/dist/renderer.js +8 -7
- package/dist/styles.css +50 -50
- package/dist/types/chat/{ConversationErrorCard/ConversationErrorCard.d.ts → ConversationErrorWidget/ConversationErrorWidget.d.ts} +2 -2
- package/dist/types/chat/{ConversationIntroCard/ConversationIntroCard.d.ts → ConversationIntroWidget/ConversationIntroWidget.d.ts} +2 -2
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/{ConversationMessageInputAttachmentPreviewCard.d.ts → ConversationMessageInputAttachmentPreviewWidget.d.ts} +2 -2
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentsPreviewStrip.d.ts +1 -1
- package/dist/types/chat/ConversationSuggestionWidget/ConversationSuggestionWidget.d.ts +7 -0
- package/dist/types/entries/chat.d.ts +4 -2
- package/dist/types/entries/widgets.d.ts +10 -6
- package/dist/types/preview/widget-preview-hydration.d.ts +1 -1
- package/dist/types/renderer/ConversationWidgetCallbacksContext.d.ts +1 -1
- package/dist/types/renderer/canvas/canvas-state.d.ts +4 -2
- package/dist/types/renderer/canvas/decide-canvas-open.d.ts +1 -1
- package/dist/types/widgets/{CanvasWidgetCard/CanvasWidgetCard.d.ts → CanvasLauncherWidget/CanvasLauncherWidget.d.ts} +4 -4
- package/dist/types/widgets/{CanvasWidgetCard → CanvasLauncherWidget}/CanvasWidgetSwitch.d.ts +8 -8
- package/dist/types/widgets/{CanvasWidgetCard → CanvasLauncherWidget}/canvas-for-message-widget.d.ts +2 -2
- package/dist/types/widgets/EntityMentionConversationWidget/{EntityMentionCard/EntityMentionCard.d.ts → EntityMentionWidgetBody/EntityMentionWidgetBody.d.ts} +2 -2
- package/dist/types/widgets/_shared/{CardFooter.d.ts → WidgetFooter.d.ts} +1 -1
- package/dist/widgets.js +40 -38
- package/dist/widgets.js.map +1 -1
- package/package.json +1 -1
- package/public-api.json +18 -11
- package/dist/chunks/ConversationMessageInputComposerWidgets-CzQnpW0h.js.map +0 -1
- package/dist/chunks/WebSearchResultsConversationWidget-tDhawe9f.js.map +0 -1
- package/dist/chunks/canvas-reducers-BdIPZW_6.js.map +0 -1
- package/dist/types/chat/ConversationSuggestionCard/ConversationSuggestionCard.d.ts +0 -7
- /package/dist/types/widgets/{CanvasWidgetCard → CanvasLauncherWidget}/use-canvas-viable.d.ts +0 -0
package/dist/widgets.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { V as WidgetSurface, X as SkeletonCircle, Y as SkeletonLine, F as useIsEmailWidgetRender } from "./chunks/WebSearchResultsConversationWidget-H6cbTapV.js";
|
|
3
|
+
import { U, Z, _, _ as _2, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap, aq, ar, as } from "./chunks/WebSearchResultsConversationWidget-H6cbTapV.js";
|
|
4
4
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5
5
|
import { z as classNames, q as Text, p as StatusChip } from "./chunks/index-7Qc_3GbG.js";
|
|
6
6
|
import { e, v } from "./chunks/index-7Qc_3GbG.js";
|
|
@@ -78,11 +78,11 @@ const WidgetLabel = (props) => {
|
|
|
78
78
|
}
|
|
79
79
|
);
|
|
80
80
|
};
|
|
81
|
-
const cardFooter = "
|
|
81
|
+
const cardFooter = "agents_cardFooter_7HSIGK";
|
|
82
82
|
const styles = {
|
|
83
83
|
cardFooter
|
|
84
84
|
};
|
|
85
|
-
const
|
|
85
|
+
const WidgetFooter = (props) => {
|
|
86
86
|
const { children, actionOnly = true, className } = props;
|
|
87
87
|
const isEmailRender = useIsEmailWidgetRender();
|
|
88
88
|
if (isEmailRender && actionOnly) return null;
|
|
@@ -130,50 +130,52 @@ const useElementVisible = (ref) => {
|
|
|
130
130
|
return intersecting && documentVisible;
|
|
131
131
|
};
|
|
132
132
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
a0 as
|
|
140
|
-
a1 as
|
|
141
|
-
a2 as
|
|
142
|
-
a3 as
|
|
143
|
-
a4 as
|
|
144
|
-
a5 as
|
|
133
|
+
U as CANVAS_VIABLE_MIN_WIDTH,
|
|
134
|
+
Z as CUSTOM_VISUALIZATION_SANDBOX_CONFIG,
|
|
135
|
+
_ as CanvasLauncherWidget,
|
|
136
|
+
_2 as CanvasWidgetCard,
|
|
137
|
+
$ as CanvasWidgetSwitch,
|
|
138
|
+
WidgetFooter as CardFooter,
|
|
139
|
+
a0 as ClockConversationWidget,
|
|
140
|
+
a1 as ConceptExplainerConversationWidget,
|
|
141
|
+
a2 as ConversationSearchResultsConversationWidget,
|
|
142
|
+
a3 as CurrencyConverterConversationWidget,
|
|
143
|
+
a4 as CustomVisualizationConversationWidget,
|
|
144
|
+
a5 as DonePill,
|
|
145
|
+
a6 as EntityMentionConversationWidget,
|
|
145
146
|
e as HeroValue,
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
a7 as MultiChoiceConversationWidget,
|
|
148
|
+
a8 as QuickRepliesConversationWidget,
|
|
148
149
|
SkeletonCircle,
|
|
149
150
|
SkeletonLine,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
a9 as SkeletonPill,
|
|
152
|
+
aa as SkeletonWidgetLabel,
|
|
153
|
+
ab as SuggestedActions,
|
|
154
|
+
ac as ToolTraceConversationWidget,
|
|
155
|
+
ad as WebSearchResultsConversationWidget,
|
|
156
|
+
WidgetFooter,
|
|
157
|
+
ae as WidgetKpiValue,
|
|
156
158
|
WidgetLabel,
|
|
157
159
|
WidgetListRow,
|
|
158
160
|
WidgetStatusChip,
|
|
159
161
|
WidgetSurface,
|
|
160
162
|
WidgetSurfaceSkeleton,
|
|
161
163
|
v as WidgetText,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
af as WritingDraftConversationWidget,
|
|
165
|
+
ag as canvasForMessageWidget,
|
|
164
166
|
createEntityUpdateChannel,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
167
|
+
ah as formatConceptExplainerNumber,
|
|
168
|
+
ai as normalizeSearchHitExcerpt,
|
|
169
|
+
aj as pickAllowed,
|
|
170
|
+
ak as pickAllowedValue,
|
|
171
|
+
al as pickReviewExternalId,
|
|
172
|
+
am as pickSafeAlias,
|
|
173
|
+
an as pickSafeAliases,
|
|
174
|
+
ao as pickText,
|
|
175
|
+
ap as readConceptExplainerNumber,
|
|
176
|
+
aq as readConceptExplainerValue,
|
|
177
|
+
ar as resolveCustomVisualizationFrameUrl,
|
|
178
|
+
as as useCanvasViable,
|
|
177
179
|
useElementVisible
|
|
178
180
|
};
|
|
179
181
|
//# sourceMappingURL=widgets.js.map
|
package/dist/widgets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgets.js","sources":["../src/widgets/_shared/modern/WidgetListRow.tsx","../src/widgets/_shared/modern/WidgetStatusChip.tsx","../src/widgets/_shared/modern/WidgetSurfaceSkeleton.tsx","../src/widgets/_shared/WidgetLabel.tsx","../src/widgets/_shared/CardFooter.tsx","../src/widgets/_shared/entity-update-channel.ts","../src/widgets/_shared/use-element-visible.ts"],"sourcesContent":["import { Text } from \"../../../provider/components\";\nimport { classNames } from \"../../../provider/class-names\";\nimport type { ReactNode } from \"react\";\nimport styles from \"./WidgetListRow.module.scss\";\n\nexport interface WidgetListRowProps {\n /** Business content in the owner's language (no translation). */\n title: ReactNode;\n meta?: ReactNode;\n leading?: ReactNode;\n trailing?: ReactNode;\n /** Makes the row a native button (keyboard and screen reader included); never an onClick on a div. */\n onClick?: () => void;\n className?: string;\n testId?: string;\n}\n\n/** One row of a list inside a widget surface: title over muted meta, hairline-divided. */\nexport const WidgetListRow = (props: WidgetListRowProps) => {\n const { title, meta, leading, trailing, onClick, className, testId } = props;\n const rowClassName = classNames(\n styles.row,\n leading === undefined && styles.withoutLeading,\n onClick && styles.clickable,\n className,\n );\n const content = (\n <>\n {leading}\n <span className={styles.text}>\n <Text role=\"body\" weight=\"bold\" translate={false}>\n {title}\n </Text>\n {meta ? (\n <Text role=\"caption\" color=\"var(--agents-fg-light)\" translate={false}>\n {meta}\n </Text>\n ) : null}\n </span>\n {trailing ? <span className={styles.trailing}>{trailing}</span> : <span />}\n </>\n );\n if (onClick) {\n return (\n <button type=\"button\" className={rowClassName} onClick={onClick} data-testid={testId}>\n {content}\n </button>\n );\n }\n return (\n <div className={rowClassName} data-testid={testId}>\n {content}\n </div>\n );\n};\n","import { StatusChip, type AgentsStatusChipProps, type AgentsStatusChipTone } from \"../../../provider/components\";\n\nexport type WidgetStatusTone = AgentsStatusChipTone;\n\nexport type WidgetStatusChipProps = AgentsStatusChipProps;\n\n/**\n * The status chip of the chat widgets: the `StatusChip` component (in the app: the dashboard's status\n * pill), so the chat and the dashboard read the same.\n */\nexport const WidgetStatusChip = (props: WidgetStatusChipProps) => <StatusChip {...props} />;\n","import { Text } from \"../../../provider/components\";\nimport type { ReactNode } from \"react\";\nimport { SkeletonCircle, SkeletonLine } from \"../skeleton-primitives\";\nimport { WidgetSurface, type WidgetSurfaceLevel } from \"./WidgetSurface\";\nimport styles from \"./WidgetSurfaceSkeleton.module.scss\";\n\nexport interface WidgetSurfaceSkeletonProps {\n /** The widget's title — known before the data, so it is real text, never a skeleton. */\n title?: ReactNode;\n rowCount?: number;\n level?: WidgetSurfaceLevel;\n testId?: string;\n}\n\n/** The loading state shaped like the surface it stands for: the same surface, the title, then row-shaped blocks. */\nexport const WidgetSurfaceSkeleton = (props: WidgetSurfaceSkeletonProps) => {\n const { title, rowCount = 3, level = \"elevated\", testId } = props;\n return (\n <WidgetSurface level={level} testId={testId}>\n {title ? (\n <Text role=\"intro\" weight=\"bold\" translate={false}>\n {title}\n </Text>\n ) : null}\n <div className={styles.rows} aria-busy=\"true\">\n {Array.from({ length: rowCount }, (unused, rowIndex) => (\n <div key={rowIndex} className={styles.row}>\n <SkeletonCircle size={32} />\n <span className={styles.rowText}>\n <SkeletonLine width=\"60%\" height={12} />\n <SkeletonLine width=\"35%\" height={10} />\n </span>\n </div>\n ))}\n </div>\n </WidgetSurface>\n );\n};\n","import { Text, type AgentsTextReplacements } from \"../../provider/components\";\nimport React from \"react\";\nimport styles from \"./WidgetLabel.module.scss\";\n\ninterface WidgetLabelProps {\n children: React.ReactNode;\n replacements?: AgentsTextReplacements;\n}\n\nexport const WidgetLabel = (props: WidgetLabelProps) => {\n const { children, replacements } = props;\n return (\n <Text\n className={styles.widgetLabel}\n role=\"help\"\n weight=\"medium\"\n color={\"--agents-fg-light\"}\n replacements={replacements}\n >\n {children}\n </Text>\n );\n};\n","import { classNames } from \"../../provider/class-names\";\nimport React from \"react\";\nimport { useIsEmailWidgetRender } from \"../../renderer/ConversationWidgetRenderContext\";\nimport styles from \"./CardFooter.module.scss\";\n\nexport const CardFooter = (props: { children: React.ReactNode; actionOnly?: boolean; className?: string }) => {\n const { children, actionOnly = true, className } = props;\n const isEmailRender = useIsEmailWidgetRender();\n if (isEmailRender && actionOnly) return null;\n return <div className={classNames(styles.cardFooter, className)}>{children}</div>;\n};\n","import { useSyncExternalStore } from \"react\";\n\n/** One published update: a strictly increasing revision, so a consumer reacts to each publication exactly once. */\nexport interface EntityUpdate<TUpdate> {\n readonly revision: number;\n readonly update: TUpdate;\n}\n\n/**\n * A tiny shared channel between a canvas BODY and the inline widget that opened it: the body publishes\n * \"this entity changed\" / \"this entity was removed\", the inline list applies or refetches. Stands in for callbacks\n * captured into a rendered canvas node: a body mounted from the canvas model has no closure into the\n * widget instance, and the widget instance may have been windowed out meanwhile. Module state with\n * `useSyncExternalStore`.\n */\nexport const createEntityUpdateChannel = <TUpdate>() => {\n let latest: EntityUpdate<TUpdate> | null = null;\n const listeners = new Set<() => void>();\n const subscribe = (listener: () => void) => {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n };\n const read = () => latest;\n return {\n publish: (update: TUpdate): void => {\n latest = { revision: (latest?.revision ?? 0) + 1, update };\n listeners.forEach((listener) => listener());\n },\n /** The latest publication (null before the first). Re-renders the consumer on every publication. */\n useLatestUpdate: (): EntityUpdate<TUpdate> | null => useSyncExternalStore(subscribe, read, read),\n };\n};\n","import { RefObject, useEffect, useState } from \"react\";\n\n/**\n * True while the element is in the viewport (IntersectionObserver) AND the document is visible — the widget polls only\n * when someone can see it. Environments without IntersectionObserver (jsdom) count as visible.\n */\nexport const useElementVisible = (ref: RefObject<HTMLElement | null>): boolean => {\n const [intersecting, setIntersecting] = useState<boolean>(true);\n const [documentVisible, setDocumentVisible] = useState<boolean>(\n typeof document === \"undefined\" || document.visibilityState !== \"hidden\",\n );\n\n useEffect(() => {\n const element = ref.current;\n if (!element || typeof IntersectionObserver === \"undefined\") return undefined;\n const observer = new IntersectionObserver((entries) => {\n setIntersecting(entries.some((entry) => entry.isIntersecting));\n });\n observer.observe(element);\n return () => observer.disconnect();\n }, [ref]);\n\n useEffect(() => {\n if (typeof document === \"undefined\") return undefined;\n const onChange = () => setDocumentVisible(document.visibilityState !== \"hidden\");\n document.addEventListener(\"visibilitychange\", onChange);\n return () => document.removeEventListener(\"visibilitychange\", onChange);\n }, []);\n\n return intersecting && documentVisible;\n};\n"],"names":["trailing","styles"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBO,MAAM,gBAAgB,CAAC,UAA8B;AAC1D,QAAM,EAAE,OAAO,MAAM,SAAS,UAAAA,WAAU,SAAS,WAAW,WAAW;AACvE,QAAM,eAAe;AAAA,IACnBC,SAAO;AAAA,IACP,YAAY,UAAaA,SAAO;AAAA,IAChC,WAAWA,SAAO;AAAA,IAClB;AAAA,EAAA;AAEF,QAAM,UACJ,qBAAA,UAAA,EACG,UAAA;AAAA,IAAA;AAAA,IACD,qBAAC,QAAA,EAAK,WAAWA,SAAO,MACtB,UAAA;AAAA,MAAA,oBAAC,QAAK,MAAK,QAAO,QAAO,QAAO,WAAW,OACxC,UAAA,MAAA,CACH;AAAA,MACC,OACC,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AAC;AAAA,IAC/D,CAAC;AACD,aAAS,QAAQ,OAAO;AACxB,WAAO,MAAM,SAAS,WAAA;AAAA,EACxB,GAAG,CAAC,GAAG,CAAC;AAER,YAAU,MAAM;AACd,QAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,UAAM,WAAW,MAAM,mBAAmB,SAAS,oBAAoB,QAAQ;AAC/E,aAAS,iBAAiB,oBAAoB,QAAQ;AACtD,WAAO,MAAM,SAAS,oBAAoB,oBAAoB,QAAQ;AAAA,EACxE,GAAG,CAAA,CAAE;AAEL,SAAO,gBAAgB;AACzB;"}
|
|
1
|
+
{"version":3,"file":"widgets.js","sources":["../src/widgets/_shared/modern/WidgetListRow.tsx","../src/widgets/_shared/modern/WidgetStatusChip.tsx","../src/widgets/_shared/modern/WidgetSurfaceSkeleton.tsx","../src/widgets/_shared/WidgetLabel.tsx","../src/widgets/_shared/WidgetFooter.tsx","../src/widgets/_shared/entity-update-channel.ts","../src/widgets/_shared/use-element-visible.ts"],"sourcesContent":["import { Text } from \"../../../provider/components\";\nimport { classNames } from \"../../../provider/class-names\";\nimport type { ReactNode } from \"react\";\nimport styles from \"./WidgetListRow.module.scss\";\n\nexport interface WidgetListRowProps {\n /** Business content in the owner's language (no translation). */\n title: ReactNode;\n meta?: ReactNode;\n leading?: ReactNode;\n trailing?: ReactNode;\n /** Makes the row a native button (keyboard and screen reader included); never an onClick on a div. */\n onClick?: () => void;\n className?: string;\n testId?: string;\n}\n\n/** One row of a list inside a widget surface: title over muted meta, hairline-divided. */\nexport const WidgetListRow = (props: WidgetListRowProps) => {\n const { title, meta, leading, trailing, onClick, className, testId } = props;\n const rowClassName = classNames(\n styles.row,\n leading === undefined && styles.withoutLeading,\n onClick && styles.clickable,\n className,\n );\n const content = (\n <>\n {leading}\n <span className={styles.text}>\n <Text role=\"body\" weight=\"bold\" translate={false}>\n {title}\n </Text>\n {meta ? (\n <Text role=\"caption\" color=\"var(--agents-fg-light)\" translate={false}>\n {meta}\n </Text>\n ) : null}\n </span>\n {trailing ? <span className={styles.trailing}>{trailing}</span> : <span />}\n </>\n );\n if (onClick) {\n return (\n <button type=\"button\" className={rowClassName} onClick={onClick} data-testid={testId}>\n {content}\n </button>\n );\n }\n return (\n <div className={rowClassName} data-testid={testId}>\n {content}\n </div>\n );\n};\n","import { StatusChip, type AgentsStatusChipProps, type AgentsStatusChipTone } from \"../../../provider/components\";\n\nexport type WidgetStatusTone = AgentsStatusChipTone;\n\nexport type WidgetStatusChipProps = AgentsStatusChipProps;\n\n/**\n * The status chip of the chat widgets: the `StatusChip` component (in the app: the dashboard's status\n * pill), so the chat and the dashboard read the same.\n */\nexport const WidgetStatusChip = (props: WidgetStatusChipProps) => <StatusChip {...props} />;\n","import { Text } from \"../../../provider/components\";\nimport type { ReactNode } from \"react\";\nimport { SkeletonCircle, SkeletonLine } from \"../skeleton-primitives\";\nimport { WidgetSurface, type WidgetSurfaceLevel } from \"./WidgetSurface\";\nimport styles from \"./WidgetSurfaceSkeleton.module.scss\";\n\nexport interface WidgetSurfaceSkeletonProps {\n /** The widget's title — known before the data, so it is real text, never a skeleton. */\n title?: ReactNode;\n rowCount?: number;\n level?: WidgetSurfaceLevel;\n testId?: string;\n}\n\n/** The loading state shaped like the surface it stands for: the same surface, the title, then row-shaped blocks. */\nexport const WidgetSurfaceSkeleton = (props: WidgetSurfaceSkeletonProps) => {\n const { title, rowCount = 3, level = \"elevated\", testId } = props;\n return (\n <WidgetSurface level={level} testId={testId}>\n {title ? (\n <Text role=\"intro\" weight=\"bold\" translate={false}>\n {title}\n </Text>\n ) : null}\n <div className={styles.rows} aria-busy=\"true\">\n {Array.from({ length: rowCount }, (unused, rowIndex) => (\n <div key={rowIndex} className={styles.row}>\n <SkeletonCircle size={32} />\n <span className={styles.rowText}>\n <SkeletonLine width=\"60%\" height={12} />\n <SkeletonLine width=\"35%\" height={10} />\n </span>\n </div>\n ))}\n </div>\n </WidgetSurface>\n );\n};\n","import { Text, type AgentsTextReplacements } from \"../../provider/components\";\nimport React from \"react\";\nimport styles from \"./WidgetLabel.module.scss\";\n\ninterface WidgetLabelProps {\n children: React.ReactNode;\n replacements?: AgentsTextReplacements;\n}\n\nexport const WidgetLabel = (props: WidgetLabelProps) => {\n const { children, replacements } = props;\n return (\n <Text\n className={styles.widgetLabel}\n role=\"help\"\n weight=\"medium\"\n color={\"--agents-fg-light\"}\n replacements={replacements}\n >\n {children}\n </Text>\n );\n};\n","import { classNames } from \"../../provider/class-names\";\nimport React from \"react\";\nimport { useIsEmailWidgetRender } from \"../../renderer/ConversationWidgetRenderContext\";\nimport styles from \"./WidgetFooter.module.scss\";\n\nexport const WidgetFooter = (props: { children: React.ReactNode; actionOnly?: boolean; className?: string }) => {\n const { children, actionOnly = true, className } = props;\n const isEmailRender = useIsEmailWidgetRender();\n if (isEmailRender && actionOnly) return null;\n return <div className={classNames(styles.cardFooter, className)}>{children}</div>;\n};\n","import { useSyncExternalStore } from \"react\";\n\n/** One published update: a strictly increasing revision, so a consumer reacts to each publication exactly once. */\nexport interface EntityUpdate<TUpdate> {\n readonly revision: number;\n readonly update: TUpdate;\n}\n\n/**\n * A tiny shared channel between a canvas BODY and the inline widget that opened it: the body publishes\n * \"this entity changed\" / \"this entity was removed\", the inline list applies or refetches. Stands in for callbacks\n * captured into a rendered canvas node: a body mounted from the canvas model has no closure into the\n * widget instance, and the widget instance may have been windowed out meanwhile. Module state with\n * `useSyncExternalStore`.\n */\nexport const createEntityUpdateChannel = <TUpdate>() => {\n let latest: EntityUpdate<TUpdate> | null = null;\n const listeners = new Set<() => void>();\n const subscribe = (listener: () => void) => {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n };\n const read = () => latest;\n return {\n publish: (update: TUpdate): void => {\n latest = { revision: (latest?.revision ?? 0) + 1, update };\n listeners.forEach((listener) => listener());\n },\n /** The latest publication (null before the first). Re-renders the consumer on every publication. */\n useLatestUpdate: (): EntityUpdate<TUpdate> | null => useSyncExternalStore(subscribe, read, read),\n };\n};\n","import { RefObject, useEffect, useState } from \"react\";\n\n/**\n * True while the element is in the viewport (IntersectionObserver) AND the document is visible — the widget polls only\n * when someone can see it. Environments without IntersectionObserver (jsdom) count as visible.\n */\nexport const useElementVisible = (ref: RefObject<HTMLElement | null>): boolean => {\n const [intersecting, setIntersecting] = useState<boolean>(true);\n const [documentVisible, setDocumentVisible] = useState<boolean>(\n typeof document === \"undefined\" || document.visibilityState !== \"hidden\",\n );\n\n useEffect(() => {\n const element = ref.current;\n if (!element || typeof IntersectionObserver === \"undefined\") return undefined;\n const observer = new IntersectionObserver((entries) => {\n setIntersecting(entries.some((entry) => entry.isIntersecting));\n });\n observer.observe(element);\n return () => observer.disconnect();\n }, [ref]);\n\n useEffect(() => {\n if (typeof document === \"undefined\") return undefined;\n const onChange = () => setDocumentVisible(document.visibilityState !== \"hidden\");\n document.addEventListener(\"visibilitychange\", onChange);\n return () => document.removeEventListener(\"visibilitychange\", onChange);\n }, []);\n\n return intersecting && documentVisible;\n};\n"],"names":["trailing","styles"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBO,MAAM,gBAAgB,CAAC,UAA8B;AAC1D,QAAM,EAAE,OAAO,MAAM,SAAS,UAAAA,WAAU,SAAS,WAAW,WAAW;AACvE,QAAM,eAAe;AAAA,IACnBC,SAAO;AAAA,IACP,YAAY,UAAaA,SAAO;AAAA,IAChC,WAAWA,SAAO;AAAA,IAClB;AAAA,EAAA;AAEF,QAAM,UACJ,qBAAA,UAAA,EACG,UAAA;AAAA,IAAA;AAAA,IACD,qBAAC,QAAA,EAAK,WAAWA,SAAO,MACtB,UAAA;AAAA,MAAA,oBAAC,QAAK,MAAK,QAAO,QAAO,QAAO,WAAW,OACxC,UAAA,MAAA,CACH;AAAA,MACC,OACC,oBAAC,MAAA,EAAK,MAAK,WAAU,OAAM,0BAAyB,WAAW,OAC5D,UAAA,KAAA,CACH,IACE;AAAA,IAAA,GACN;AAAA,IACCD,gCAAY,QAAA,EAAK,WAAWC,SAAO,UAAW,UAAA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,YAAa,QAAO;AAC5C,UAAM,WAAW,MAAM,mBAAmB,SAAS,oBAAoB,QAAQ;AAC/E,aAAS,iBAAiB,oBAAoB,QAAQ;AACtD,WAAO,MAAM,SAAS,oBAAoB,oBAAoB,QAAQ;AAAA,EACxE,GAAG,CAAA,CAAE;AAEL,SAAO,gBAAgB;AACzB;"}
|
package/package.json
CHANGED
package/public-api.json
CHANGED
|
@@ -244,7 +244,8 @@
|
|
|
244
244
|
"useWidgetHydration",
|
|
245
245
|
"useWidgetMemory",
|
|
246
246
|
"useWidgetRenderReporter",
|
|
247
|
-
"withConversationWidgetVariant"
|
|
247
|
+
"withConversationWidgetVariant",
|
|
248
|
+
"LEGACY_CARD_CLICK_ORIGIN"
|
|
248
249
|
],
|
|
249
250
|
"types": [
|
|
250
251
|
"AgentsWidgetHydrationState",
|
|
@@ -335,9 +336,9 @@
|
|
|
335
336
|
"values": [
|
|
336
337
|
"CANVAS_VIABLE_MIN_WIDTH",
|
|
337
338
|
"CUSTOM_VISUALIZATION_SANDBOX_CONFIG",
|
|
338
|
-
"
|
|
339
|
+
"CanvasLauncherWidget",
|
|
339
340
|
"CanvasWidgetSwitch",
|
|
340
|
-
"
|
|
341
|
+
"WidgetFooter",
|
|
341
342
|
"ClockConversationWidget",
|
|
342
343
|
"ConceptExplainerConversationWidget",
|
|
343
344
|
"ConversationSearchResultsConversationWidget",
|
|
@@ -377,11 +378,13 @@
|
|
|
377
378
|
"readConceptExplainerValue",
|
|
378
379
|
"resolveCustomVisualizationFrameUrl",
|
|
379
380
|
"useCanvasViable",
|
|
380
|
-
"useElementVisible"
|
|
381
|
+
"useElementVisible",
|
|
382
|
+
"CanvasWidgetCard",
|
|
383
|
+
"CardFooter"
|
|
381
384
|
],
|
|
382
385
|
"types": [
|
|
383
|
-
"
|
|
384
|
-
"
|
|
386
|
+
"CanvasLauncherWidgetCanvas",
|
|
387
|
+
"CanvasLauncherWidgetProps",
|
|
385
388
|
"ConceptExplainerStep",
|
|
386
389
|
"ConceptExplainerStepsInput",
|
|
387
390
|
"ConceptExplainerText",
|
|
@@ -396,7 +399,9 @@
|
|
|
396
399
|
"WidgetStatusTone",
|
|
397
400
|
"WidgetSurfaceLevel",
|
|
398
401
|
"WidgetSurfaceProps",
|
|
399
|
-
"WidgetSurfaceSkeletonProps"
|
|
402
|
+
"WidgetSurfaceSkeletonProps",
|
|
403
|
+
"CanvasWidgetCardProps",
|
|
404
|
+
"CanvasWidgetCardCanvas"
|
|
400
405
|
]
|
|
401
406
|
},
|
|
402
407
|
"./contract": {
|
|
@@ -504,7 +509,7 @@
|
|
|
504
509
|
"CanvasRestoreOnMount",
|
|
505
510
|
"ConversationClosedBar",
|
|
506
511
|
"ConversationDeepLinkedWidget",
|
|
507
|
-
"
|
|
512
|
+
"ConversationErrorWidget",
|
|
508
513
|
"ConversationErrorType",
|
|
509
514
|
"ConversationMessageInput",
|
|
510
515
|
"ConversationMessageInputAttachmentsErrorBox",
|
|
@@ -535,7 +540,8 @@
|
|
|
535
540
|
"useAgentsConversationRunStatus",
|
|
536
541
|
"useConversationMessageSearch",
|
|
537
542
|
"useConversationsSearch",
|
|
538
|
-
"useOptionalAgentsChatStore"
|
|
543
|
+
"useOptionalAgentsChatStore",
|
|
544
|
+
"ConversationErrorCard"
|
|
539
545
|
],
|
|
540
546
|
"types": [
|
|
541
547
|
"ActivityTicker",
|
|
@@ -560,7 +566,7 @@
|
|
|
560
566
|
"ChatScrollTarget",
|
|
561
567
|
"ConversationClosedBarProps",
|
|
562
568
|
"ConversationDeepLinkedWidgetProps",
|
|
563
|
-
"
|
|
569
|
+
"ConversationErrorWidgetProps",
|
|
564
570
|
"ConversationMessageInputAttachmentPreview",
|
|
565
571
|
"ConversationMessageInputAttachmentUploadStatus",
|
|
566
572
|
"ConversationMessageInputHandle",
|
|
@@ -574,7 +580,8 @@
|
|
|
574
580
|
"ConversationWidgetProviderProps",
|
|
575
581
|
"ConversationsSearchState",
|
|
576
582
|
"SendMessageHandler",
|
|
577
|
-
"SendMessageOptions"
|
|
583
|
+
"SendMessageOptions",
|
|
584
|
+
"ConversationErrorCardProps"
|
|
578
585
|
]
|
|
579
586
|
},
|
|
580
587
|
"./preview": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationMessageInputComposerWidgets-CzQnpW0h.js","sources":["../../src/chat/store/agents-chat-state.ts","../../src/chat/store/conversation-error-type.ts","../../src/chat/store/merge-chat-messages.ts","../../src/chat/store/reduce-agents-chat-state.ts","../../src/chat/store/create-agents-chat-store.ts","../../src/chat/store/use-agents-chat-store.tsx","../../src/renderer/ConversationWidgetContext.tsx","../../src/chat/ConversationMessageInput/ConversationMessageInputComposerWidgets/ConversationMessageInputComposerWidgets.tsx"],"sourcesContent":["import type {\n AgentsClientError,\n AgentsConversation,\n AgentsConversationMessage,\n PostedMessage,\n StartedConversation,\n} from \"../../contract/conversation\";\nimport type { ChatMessage } from \"../chat-message\";\nimport type { CanvasCreatedEntity, CanvasSliceState } from \"../../renderer/canvas/canvas-reducers\";\nimport type { CanvasOpenRequest } from \"../../renderer/canvas/canvas-state\";\nimport type { ConversationErrorType } from \"./conversation-error-type\";\n\n/**\n * How an entry point outside the chat hands a job over to the chat that opens next (one generic opening\n * request): the first visible message, or an invisible start signal so the agent speaks first, the entry point the\n * start comes from, and a widget to mount without a message (a page handing over a tool). Set before the chat mounts,\n * so a reset keeps it; the chat clears each part once it consumed it.\n */\nexport interface AgentsChatOpeningRequest {\n /** The first visible owner message of the next started conversation. */\n userMessage: string | null;\n /** The invisible start signal of the next started conversation (an empty visible message carries it). */\n startSignalText: string | null;\n /** The entry point the start comes from; the server reopens that entry point's recent conversation instead. */\n entryPointKey: string | null;\n /** The canonical wire name of a deep-linkable widget the chat mounts once, without a message. */\n deepLinkedWidgetName: string | null;\n}\n\n/** The state of one chat instance. */\nexport interface AgentsChatState extends CanvasSliceState {\n /** The conversation shown; null for a cold chat until a start or the metadata read brings it. */\n conversation: AgentsConversation | null;\n /** Null until the first page or a send; ordered by `indexInConversation`, the optimistic message last. */\n messages: ChatMessage[] | null;\n /** A send is on its way. */\n conversationLoading: boolean;\n /** The last read or send for this conversation came back. */\n conversationLoaded: boolean;\n /** An older page exists: the scroll-up load stays armed. */\n hasMoreOlder: boolean;\n /** The agent works on a turn (the controller mirrors the derived activity here; read by the launcher). */\n aiThinking: boolean;\n error: ConversationErrorType | null;\n /** Seconds until the quota frees up again; set only while `error` is RATE_LIMIT. */\n rateLimitRetryAfterSeconds: number | null;\n /**\n * The conversation the newest metadata or page read asked for; null after a reset. A late answer for another\n * conversation — or one that lands after a reset — is dropped.\n */\n requestedConversationId: number | null;\n /** A start is on its way; no second start is sent meanwhile. */\n startingNewConversation: boolean;\n /** The token of the start on its way; its answer applies only while it is still the pending one. */\n pendingStartToken: number | null;\n /**\n * How many starts this chat instance sent — the source of `pendingStartToken`. Survives a reset (like\n * `canvasMountCount`): the store outlives a remount of the chat, so a token is never reused for another start.\n */\n startTokenCount: number;\n openingRequest: AgentsChatOpeningRequest;\n}\n\nexport const EMPTY_AGENTS_CHAT_OPENING_REQUEST: AgentsChatOpeningRequest = {\n userMessage: null,\n startSignalText: null,\n entryPointKey: null,\n deepLinkedWidgetName: null,\n};\n\nexport const INITIAL_AGENTS_CHAT_STATE: AgentsChatState = {\n conversation: null,\n messages: null,\n conversationLoading: false,\n conversationLoaded: false,\n hasMoreOlder: false,\n aiThinking: false,\n error: null,\n rateLimitRetryAfterSeconds: null,\n requestedConversationId: null,\n startingNewConversation: false,\n pendingStartToken: null,\n startTokenCount: 0,\n openingRequest: EMPTY_AGENTS_CHAT_OPENING_REQUEST,\n canvas: null,\n lastClosedCanvas: null,\n canvasMountCount: 0,\n};\n\n/**\n * What happens to a chat instance. The read and send events carry the port's answers (`AgentsConversationClient`);\n * the controller dispatches the `…Requested` event before it calls the port and the `…Received` / `…Failed` event\n * with the answer.\n */\nexport type AgentsChatEvent =\n /** A conversation switch, an empty chat, the chat's unmount: everything goes except the opening request and the two counters. */\n | { type: \"reset\" }\n | { type: \"conversationMetadataRequested\"; conversationId: number }\n | { type: \"conversationMetadataReceived\"; conversationId: number; conversation: AgentsConversation }\n | { type: \"conversationMetadataFailed\"; conversationId: number }\n | { type: \"messagesPageRequested\"; conversationId: number }\n /** `hasMoreOlder` null: a changed-messages read, which says nothing about older pages. */\n | {\n type: \"messagesPageReceived\";\n conversationId: number;\n messages: AgentsConversationMessage[];\n hasMoreOlder: boolean | null;\n }\n | { type: \"messagePostRequested\"; message: ChatMessage }\n | { type: \"messagePostReceived\"; conversationId: number; posted: PostedMessage }\n | { type: \"messagePostFailed\"; error: AgentsClientError }\n /** Takes the next start token (`pendingStartToken`); the controller reads it after the dispatch. */\n | { type: \"startRequested\"; message: ChatMessage }\n | { type: \"startReceived\"; startToken: number; started: StartedConversation }\n | { type: \"startFailed\"; error: AgentsClientError }\n | { type: \"errorSet\"; error: ConversationErrorType | null }\n | { type: \"aiThinkingSet\"; aiThinking: boolean }\n /** Sets the named parts of the opening request; the others stay. */\n | { type: \"openingRequestSet\"; openingRequest: Partial<AgentsChatOpeningRequest> }\n | { type: \"canvasOpened\"; request: CanvasOpenRequest }\n | { type: \"canvasClosed\"; byCustomer: boolean }\n | { type: \"canvasResetForNewTurn\" }\n | { type: \"canvasCleared\" }\n | { type: \"canvasCreatedEntityIdSet\"; created: CanvasCreatedEntity };\n","import type { AgentsClientError } from \"../../contract/conversation\";\n\n/**\n * The error card the chat shows. A plain object with string values (not a TypeScript `enum`), so the chat store, the\n * view and an app's older chat state share one vocabulary without a nominal type in between.\n */\nexport const ConversationErrorType = {\n AI_BUDGET: \"AI_BUDGET\",\n /**\n * HTTP 429 from an AI endpoint — a per-minute/hour/day usage quota was hit. Distinct from AI_BUDGET (monthly budget):\n * this one clears on its own after the Retry-After window.\n */\n RATE_LIMIT: \"RATE_LIMIT\",\n NETWORK_ERROR: \"NETWORK_ERROR\",\n CONVERSATION_NOT_FOUND: \"CONVERSATION_NOT_FOUND\",\n /**\n * The backend run FAILED (e.g. the model provider returned an error). The raw provider error is admin-only (never\n * shown here); the owner gets a generic \"something went wrong\" card.\n */\n AGENT_ERROR: \"AGENT_ERROR\",\n /**\n * The conversation is COMPLETED/CANCELLED and refuses further owner input. Set from the server's stable error code\n * `CONVERSATION_CLOSED` or by the chat's own pre-send guard; the error card owns the copy.\n */\n CONVERSATION_CLOSED: \"CONVERSATION_CLOSED\",\n} as const;\n\nexport type ConversationErrorType = (typeof ConversationErrorType)[keyof typeof ConversationErrorType];\n\n/**\n * The error card of a refused send (post or start), read from the port's error. Only the stable outcomes select a\n * dedicated card; every other refusal is a generic network error — the same classification the older chat applies to\n * the server's error codes (`AI_BUDGET_REACHED`, `RATE_LIMIT_EXCEEDED`, `CONVERSATION_CLOSED`).\n */\nexport const readConversationErrorTypeOfRefusedSend = (error: AgentsClientError): ConversationErrorType => {\n if (error.kind === \"budget\") return ConversationErrorType.AI_BUDGET;\n if (error.kind === \"rateLimit\") return ConversationErrorType.RATE_LIMIT;\n if (error.kind === \"closed\") return ConversationErrorType.CONVERSATION_CLOSED;\n return ConversationErrorType.NETWORK_ERROR;\n};\n","import type { ChatMessage } from \"../chat-message\";\n\n/**\n * Merges two message lists by `indexInConversation`, preferring `incoming` on a collision, sorted ascending by index.\n * Messages without an index (the optimistic owner message) cannot be matched, so they follow the indexed ones in order.\n * A start or post answer carries the whole list and a live read brings it again: concatenating would show every\n * message twice.\n */\nexport const mergeChatMessagesByIndex = (existing: ChatMessage[], incoming: ChatMessage[]): ChatMessage[] => {\n const messagesByIndex = new Map<number, ChatMessage>();\n const messagesWithoutIndex: ChatMessage[] = [];\n const collectMessage = (message: ChatMessage) => {\n if (message.indexInConversation != null) {\n messagesByIndex.set(message.indexInConversation, message);\n } else {\n messagesWithoutIndex.push(message);\n }\n };\n existing.forEach(collectMessage);\n incoming.forEach(collectMessage);\n const indexedMessages = Array.from(messagesByIndex.values()).sort(\n (first, second) => (first.indexInConversation ?? 0) - (second.indexInConversation ?? 0),\n );\n return [...indexedMessages, ...messagesWithoutIndex];\n};\n\n/**\n * Tags the messages of a send's answer: `fresh` when the id was not in the list before — the server just delivered it,\n * so its one-shot widgets may fire; a replayed message never fires them again.\n */\nexport const tagFreshChatMessages = (incoming: ChatMessage[], previousMessages: ChatMessage[]): ChatMessage[] => {\n const previousIds = new Set(previousMessages.map((message) => message.id).filter((id): id is number => id != null));\n return incoming.map((message) => ({ ...message, fresh: message.id != null && !previousIds.has(message.id) }));\n};\n\n/**\n * Merges a page of a keyset read (the newest page, an older page, the changed tail) into the loaded messages by index.\n * A message is `fresh` only when it is a live arrival: never shown before and newer than everything loaded — so the\n * streamed reply opens its canvas while a scroll-up page and the first page on open stay history. A message already\n * shown keeps its tag. A page of another conversation than the one shown replaces the list.\n */\nexport const mergeMessagesPage = (\n loadedMessages: ChatMessage[] | null,\n page: ChatMessage[],\n requestedConversationId: number,\n): ChatMessage[] => {\n const shownConversationId = loadedMessages?.find((message) => message.conversationId != null)?.conversationId;\n const replacesShownConversation = shownConversationId != null && shownConversationId !== requestedConversationId;\n const existingMessages = replacesShownConversation ? [] : (loadedMessages ?? []);\n const messagesByIndex = new Map<number, ChatMessage>();\n for (const existingMessage of existingMessages) {\n if (existingMessage.indexInConversation != null) {\n messagesByIndex.set(existingMessage.indexInConversation, existingMessage);\n }\n }\n const hadMessagesBeforeMerge = existingMessages.length > 0;\n const highestShownIndex = Math.max(-1, ...existingMessages.map((message) => message.indexInConversation ?? -1));\n for (const incomingMessage of page) {\n if (incomingMessage.indexInConversation == null) continue;\n const previousMessage = messagesByIndex.get(incomingMessage.indexInConversation);\n const isLiveArrival =\n hadMessagesBeforeMerge && previousMessage == null && incomingMessage.indexInConversation > highestShownIndex;\n messagesByIndex.set(incomingMessage.indexInConversation, {\n ...incomingMessage,\n fresh: previousMessage?.fresh ?? isLiveArrival,\n });\n }\n return Array.from(messagesByIndex.values()).sort(\n (first, second) => (first.indexInConversation ?? 0) - (second.indexInConversation ?? 0),\n );\n};\n","import {\n applyClearCanvas,\n applyCloseCanvas,\n applyOpenCanvas,\n applyResetCanvasForNewTurn,\n applySetCanvasCreatedEntityId,\n} from \"../../renderer/canvas/canvas-reducers\";\nimport type { AgentsClientError } from \"../../contract/conversation\";\nimport type { ChatMessage } from \"../chat-message\";\nimport { type AgentsChatEvent, type AgentsChatState, INITIAL_AGENTS_CHAT_STATE } from \"./agents-chat-state\";\nimport { ConversationErrorType, readConversationErrorTypeOfRefusedSend } from \"./conversation-error-type\";\nimport { mergeChatMessagesByIndex, mergeMessagesPage, tagFreshChatMessages } from \"./merge-chat-messages\";\n\n/** The error card and the quota wait of a refused send. */\nconst withRefusedSendError = (state: AgentsChatState, error: AgentsClientError): AgentsChatState => {\n const conversationErrorType = readConversationErrorTypeOfRefusedSend(error);\n return {\n ...state,\n error: conversationErrorType,\n rateLimitRetryAfterSeconds:\n conversationErrorType === ConversationErrorType.RATE_LIMIT ? (error.retryAfterSeconds ?? null) : null,\n };\n};\n\n/** The messages a send's answer brings, merged over the loaded ones without the optimistic message (the last one). */\nconst mergeSendAnswer = (loadedMessages: ChatMessage[] | null, answerMessages: ChatMessage[]): ChatMessage[] => {\n const messagesWithoutOptimisticMessage = loadedMessages ? loadedMessages.slice(0, loadedMessages.length - 1) : [];\n return mergeChatMessagesByIndex(\n messagesWithoutOptimisticMessage,\n tagFreshChatMessages(answerMessages, messagesWithoutOptimisticMessage),\n );\n};\n\n/** The canvas transitions mutate the fields of the object they get (`canvas-reducers.ts`); this keeps the state immutable. */\nconst withCanvasTransition = (\n state: AgentsChatState,\n applyCanvasTransition: (nextState: AgentsChatState) => void,\n): AgentsChatState => {\n const nextState = { ...state };\n applyCanvasTransition(nextState);\n const changed =\n nextState.canvas !== state.canvas ||\n nextState.lastClosedCanvas !== state.lastClosedCanvas ||\n nextState.canvasMountCount !== state.canvasMountCount;\n return changed ? nextState : state;\n};\n\n/**\n * The chat store's reducer: plain functions over the contract types. Each case is the one of the older\n * chat state (a Redux slice and its cases) it replaces, reading the port's answers instead of the\n * generated client's actions; the replay spec feeds both the same recorded sequence.\n */\nexport const reduceAgentsChatState = (state: AgentsChatState, event: AgentsChatEvent): AgentsChatState => {\n switch (event.type) {\n case \"reset\":\n // The opening request is set from outside before the chat mounts (a cold chat resets as it comes up); the canvas\n // mount count and the start token count are monotonic sources of identities: all three survive.\n return {\n ...INITIAL_AGENTS_CHAT_STATE,\n openingRequest: state.openingRequest,\n canvasMountCount: state.canvasMountCount,\n startTokenCount: state.startTokenCount,\n };\n\n case \"conversationMetadataRequested\":\n case \"messagesPageRequested\":\n return state.requestedConversationId === event.conversationId\n ? state\n : { ...state, requestedConversationId: event.conversationId };\n\n case \"conversationMetadataReceived\":\n // Dropped after a reset or when another conversation was asked for since: a late answer would put the old\n // conversation back, and the next send would post into it instead of starting a new one.\n if (state.requestedConversationId === null || state.requestedConversationId !== event.conversationId) {\n return state;\n }\n return { ...state, conversation: event.conversation, conversationLoaded: true };\n\n case \"conversationMetadataFailed\":\n // A metadata read is best-effort: the chat stays as it is.\n return { ...state, conversationLoaded: true };\n\n case \"messagesPageReceived\": {\n if (state.requestedConversationId === null || state.requestedConversationId !== event.conversationId) {\n return state;\n }\n if (state.conversation !== null && state.conversation.id !== event.conversationId) {\n return state;\n }\n return {\n ...state,\n messages: mergeMessagesPage(state.messages, event.messages, event.conversationId),\n hasMoreOlder: event.hasMoreOlder ?? state.hasMoreOlder,\n conversationLoaded: true,\n };\n }\n\n case \"messagePostRequested\":\n return {\n ...state,\n conversationLoading: true,\n conversationLoaded: false,\n aiThinking: true,\n error: null,\n rateLimitRetryAfterSeconds: null,\n messages: [...(state.messages ?? []), event.message],\n };\n\n case \"messagePostReceived\":\n if (event.conversationId !== state.conversation?.id) {\n return state;\n }\n // The reply arrives through live updates, not in this answer: `aiThinking` stays as it is.\n return {\n ...state,\n messages: mergeSendAnswer(state.messages, event.posted.messages),\n conversationLoading: false,\n conversationLoaded: true,\n error: null,\n };\n\n case \"messagePostFailed\":\n return withRefusedSendError(\n { ...state, conversationLoading: false, conversationLoaded: true, aiThinking: false },\n event.error,\n );\n\n case \"startRequested\":\n return {\n ...state,\n conversation: null,\n conversationLoading: true,\n conversationLoaded: false,\n aiThinking: true,\n error: null,\n rateLimitRetryAfterSeconds: null,\n startingNewConversation: true,\n startTokenCount: state.startTokenCount + 1,\n pendingStartToken: state.startTokenCount + 1,\n // A signal-only start (an empty visible message carries the start signal) seeds no empty bubble.\n messages: event.message.message ? [event.message] : [],\n };\n\n case \"startReceived\": {\n if (event.startToken !== state.pendingStartToken) {\n return state;\n }\n const { started } = event;\n if (started.reopenedExisting) {\n // The recent conversation of the start's entry point: nothing was appended, no turn started. Its messages are\n // not in the answer — the controller reads its newest page — so the optimistic bubble goes.\n return {\n ...state,\n conversation: started.conversation,\n messages: [],\n conversationLoading: false,\n conversationLoaded: true,\n aiThinking: false,\n startingNewConversation: false,\n pendingStartToken: null,\n };\n }\n // The reply arrives through live updates: `aiThinking` stays on.\n return {\n ...state,\n conversation: started.conversation,\n messages: mergeSendAnswer(state.messages, started.messages),\n conversationLoading: false,\n conversationLoaded: true,\n startingNewConversation: false,\n pendingStartToken: null,\n };\n }\n\n case \"startFailed\":\n return withRefusedSendError(\n {\n ...state,\n conversation: null,\n conversationLoading: false,\n conversationLoaded: true,\n aiThinking: false,\n startingNewConversation: false,\n pendingStartToken: null,\n },\n event.error,\n );\n\n case \"errorSet\":\n return state.error === event.error ? state : { ...state, error: event.error };\n\n case \"aiThinkingSet\":\n return state.aiThinking === event.aiThinking ? state : { ...state, aiThinking: event.aiThinking };\n\n case \"openingRequestSet\":\n return { ...state, openingRequest: { ...state.openingRequest, ...event.openingRequest } };\n\n case \"canvasOpened\":\n return withCanvasTransition(state, (nextState) => {\n applyOpenCanvas(nextState, event.request);\n });\n\n case \"canvasClosed\":\n return withCanvasTransition(state, (nextState) => applyCloseCanvas(nextState, event.byCustomer));\n\n case \"canvasResetForNewTurn\":\n return withCanvasTransition(state, applyResetCanvasForNewTurn);\n\n case \"canvasCleared\":\n return withCanvasTransition(state, applyClearCanvas);\n\n case \"canvasCreatedEntityIdSet\":\n return withCanvasTransition(state, (nextState) => {\n applySetCanvasCreatedEntityId(nextState, event.created);\n });\n }\n};\n","import { type AgentsChatEvent, type AgentsChatState, INITIAL_AGENTS_CHAT_STATE } from \"./agents-chat-state\";\nimport { reduceAgentsChatState } from \"./reduce-agents-chat-state\";\n\n/**\n * The state handle of one chat instance. The app creates one per chat (host application: one per agent\n * window, created before the window's chat mounts) and releases it with the chat; the chat and the app's code outside\n * the chat read and dispatch through the same handle. React reads it through `useAgentsChatSelector`.\n */\nexport interface AgentsChatStore {\n getState: () => AgentsChatState;\n /** Calls the listener after every state change; returns the unsubscribe. */\n subscribe: (listener: () => void) => () => void;\n dispatch: (event: AgentsChatEvent) => void;\n}\n\n/** The plain implementation of `AgentsChatStore`: one state object, replaced by the reducer on every event. */\nexport class AgentsChatStateContainer implements AgentsChatStore {\n protected state: AgentsChatState;\n protected readonly listeners = new Set<() => void>();\n\n constructor(initialState: AgentsChatState = INITIAL_AGENTS_CHAT_STATE) {\n this.state = initialState;\n }\n\n getState = (): AgentsChatState => this.state;\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n dispatch = (event: AgentsChatEvent): void => {\n const nextState = reduceAgentsChatState(this.state, event);\n if (nextState === this.state) return;\n this.state = nextState;\n for (const notifyListener of [...this.listeners]) notifyListener();\n };\n}\n\n/** Creates the state handle of one chat instance. */\nexport const createAgentsChatStore = (initialState?: AgentsChatState): AgentsChatStore =>\n new AgentsChatStateContainer(initialState);\n","import { createContext, type ReactNode, useCallback, useContext, useSyncExternalStore } from \"react\";\nimport type { AgentsChatState } from \"./agents-chat-state\";\nimport type { AgentsChatStore } from \"./create-agents-chat-store\";\n\nconst AgentsChatStoreContext = createContext<AgentsChatStore | null>(null);\n\nexport interface AgentsChatStoreProviderProps {\n /** The state handle of the chat below (the app creates and releases it). */\n chatStore: AgentsChatStore;\n children?: ReactNode;\n}\n\n/** Puts one chat instance's state handle in reach of the chat and of the app's components inside it. */\nexport const AgentsChatStoreProvider = (props: AgentsChatStoreProviderProps) => {\n const { chatStore, children } = props;\n return <AgentsChatStoreContext.Provider value={chatStore}>{children}</AgentsChatStoreContext.Provider>;\n};\n\n/** The state handle of the chat this component renders in; throws outside `AgentsChatStoreProvider`. */\nexport const useAgentsChatStore = (): AgentsChatStore => {\n const chatStore = useContext(AgentsChatStoreContext);\n if (chatStore === null) {\n throw new Error(\"A chat component rendered outside AgentsChatStoreProvider: the app has to mount its chat store.\");\n }\n return chatStore;\n};\n\n/** The state handle of the chat this component renders in, or null outside a chat. */\nexport const useOptionalAgentsChatStore = (): AgentsChatStore | null => useContext(AgentsChatStoreContext);\n\nconst subscribeToNothing = () => () => undefined;\n\n/**\n * Reads one value of a chat instance's state and re-renders when it changes. The selector must return a value that\n * keeps its identity while the state does not change (a state field, not a new object). Without a store it returns\n * `valueWithoutStore`.\n */\nexport const useAgentsChatSelector = <Selected,>(\n chatStore: AgentsChatStore | null | undefined,\n selector: (state: AgentsChatState) => Selected,\n valueWithoutStore?: Selected,\n): Selected => {\n const subscribe = chatStore ? chatStore.subscribe : subscribeToNothing;\n const readSelectedValue = useCallback(\n () => (chatStore ? selector(chatStore.getState()) : (valueWithoutStore as Selected)),\n [chatStore, selector, valueWithoutStore],\n );\n return useSyncExternalStore(subscribe, readSelectedValue, readSelectedValue);\n};\n\n/** Reads one value of the state of the chat this component renders in. */\nexport const useAgentsChatState = <Selected,>(selector: (state: AgentsChatState) => Selected): Selected =>\n useAgentsChatSelector(useAgentsChatStore(), selector);\n","import React, { ReactNode, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { useAgentsEnvironment, useAgentsStateDispatch, useAgentsStateSelector } from \"../provider/AgentsProvider\";\nimport type { ConversationWidgetStatePartition } from \"./conversation-widget-state-partition\";\nimport { createAgentsChatStore } from \"../chat/store/create-agents-chat-store\";\nimport type { AgentsChatEvent } from \"../chat/store/agents-chat-state\";\nimport type { AgentsChatStore } from \"../chat/store/create-agents-chat-store\";\nimport { useAgentsChatSelector } from \"../chat/store/use-agents-chat-store\";\nimport type { CanvasState, LastClosedCanvas } from \"./canvas/canvas-state\";\nimport { CANVAS_VIABLE_MIN_WIDTH } from \"../widgets/CanvasWidgetCard/use-canvas-viable\";\nimport { ConversationComposerWidget } from \"./conversation-composer-widget\";\nimport type { CanvasCreatedEntity } from \"./canvas/canvas-reducers\";\nimport { clearStoredCanvas, storeOpenCanvas } from \"./canvas/canvasStorage\";\nimport {\n type CanvasOpenRequestFromOpener,\n type ConversationWidgetCallbacks,\n ConversationWidgetContext,\n defaultConversationWidgetCallbacks,\n type InjectSignalOptions,\n} from \"./ConversationWidgetCallbacksContext\";\n\n// The callbacks, their context and the chat-free hosts live in `ConversationWidgetCallbacksContext.tsx`; this module\n// adds the provider that reads the chat's state (the package chat store or an app's partition) and re-exports the rest.\nexport * from \"./ConversationWidgetCallbacksContext\";\n\n// Number of mounted agentic chat surfaces (widget, full-page chat, dashboard). Drives the app's \"a chat surface is\n// open\" action (`buildChatSurfaceOpenChangedAction`, e.g. a flag of the app's own flows): true while ≥1 is open.\n// Module-level so multiple providers share one count.\nlet agenticChatMountCount = 0;\n\nexport interface ConversationWidgetProviderProps {\n children: ReactNode;\n callbacks: Partial<ConversationWidgetCallbacks>;\n /**\n * The chat slice partition this provider's canvas lives in. The shell is shared by the two chat doors, so the door\n * says which partition: `AgentChat` passes `AgentChatInstance`; the AI-Extensions chat, every story and every spec\n * keep the default. A prop, not a callback — `callbacks` is `Partial`, and the partition is not optional.\n */\n sliceInstance?: ConversationWidgetStatePartition;\n /**\n * The package chat store of the chat: the agent chat passes its window's store and the provider reads\n * and writes the canvas there. Without it the provider reads a partition of the app's own chat state\n * (`sliceInstance`, else the environment's `defaultChatStatePartition`).\n */\n chatStore?: AgentsChatStore;\n /**\n * False for a host that renders the chat without the split (`ConversationView.disableSplitView`): there is nowhere\n * to open a canvas, so every open request is ignored with reason `noSurface`. Default true.\n */\n hostHasCanvasSurface?: boolean;\n}\n\n/** The canvas transitions the provider dispatches — the canvas events of the package chat store. */\ntype ConversationWidgetCanvasEvent = Extract<\n AgentsChatEvent,\n { type: \"canvasOpened\" | \"canvasClosed\" | \"canvasResetForNewTurn\" | \"canvasCleared\" | \"canvasCreatedEntityIdSet\" }\n>;\n\n/** What the provider reads from the chat's state and how it writes a canvas transition back. */\ninterface ConversationWidgetChatState {\n canvas: CanvasState | null;\n lastClosedCanvas: LastClosedCanvas | null;\n isConversationRunning: boolean;\n runState: string | null | undefined;\n messages: ConversationWidgetCallbacks[\"messages\"];\n dispatchCanvasEvent: (event: ConversationWidgetCanvasEvent) => void;\n}\n\ntype ConversationWidgetProviderBodyProps = Omit<ConversationWidgetProviderProps, \"sliceInstance\" | \"chatStore\"> & {\n chatState: ConversationWidgetChatState;\n};\n\nconst selectCanvas = (state: { canvas: CanvasState | null }) => state.canvas;\nconst selectLastClosedCanvas = (state: { lastClosedCanvas: LastClosedCanvas | null }) => state.lastClosedCanvas;\nconst selectAiThinking = (state: { aiThinking: boolean }) => state.aiThinking;\nconst selectRunState = (state: { conversation: { runState?: string | null } | null }) => state.conversation?.runState;\nconst selectMessages = (state: { messages: ConversationWidgetCallbacks[\"messages\"] }) => state.messages;\n\n/** The provider over the package chat store of the chat. */\nconst ChatStoreConversationWidgetProvider = (\n props: Omit<ConversationWidgetProviderProps, \"sliceInstance\" | \"chatStore\"> & { chatStore: AgentsChatStore },\n) => {\n const { chatStore, ...bodyProps } = props;\n const canvas = useAgentsChatSelector(chatStore, selectCanvas);\n const lastClosedCanvas = useAgentsChatSelector(chatStore, selectLastClosedCanvas);\n const isConversationRunning = useAgentsChatSelector(chatStore, selectAiThinking);\n const runState = useAgentsChatSelector(chatStore, selectRunState);\n const messages = useAgentsChatSelector(chatStore, selectMessages);\n const chatState = useMemo<ConversationWidgetChatState>(\n () => ({\n canvas,\n lastClosedCanvas,\n isConversationRunning,\n runState,\n messages,\n dispatchCanvasEvent: chatStore.dispatch,\n }),\n [canvas, lastClosedCanvas, isConversationRunning, runState, messages, chatStore],\n );\n return <ConversationWidgetProviderBody {...bodyProps} chatState={chatState} />;\n};\n\n/** The provider over a partition of the older chat state (the AI-Extensions chat, stories, specs). */\nconst SliceConversationWidgetProvider = (\n props: Omit<ConversationWidgetProviderProps, \"sliceInstance\" | \"chatStore\"> & {\n sliceInstance: ConversationWidgetStatePartition;\n },\n) => {\n const { sliceInstance, ...bodyProps } = props;\n const dispatch = useAgentsStateDispatch();\n // One selector per field, not one returning an object, so an unrelated store change does not re-render every widget\n // through a fresh object identity.\n const canvas = useAgentsStateSelector((state) => sliceInstance.selectState(state).canvas);\n const lastClosedCanvas = useAgentsStateSelector((state) => sliceInstance.selectState(state).lastClosedCanvas);\n const isConversationRunning = useAgentsStateSelector((state) => sliceInstance.selectState(state).aiThinking);\n const runState = useAgentsStateSelector((state) => sliceInstance.selectState(state).conversation?.runState);\n const messages = useAgentsStateSelector((state) => sliceInstance.selectState(state).messages);\n const dispatchCanvasEvent = useCallback(\n (event: ConversationWidgetCanvasEvent) => {\n const { actions } = sliceInstance;\n if (event.type === \"canvasOpened\") dispatch(actions.openCanvas(event.request));\n else if (event.type === \"canvasClosed\") dispatch(actions.closeCanvas({ byCustomer: event.byCustomer }));\n else if (event.type === \"canvasResetForNewTurn\") dispatch(actions.resetCanvasForNewTurn());\n else if (event.type === \"canvasCleared\") dispatch(actions.clearCanvas());\n else dispatch(actions.setCanvasCreatedEntityId(event.created));\n },\n [dispatch, sliceInstance],\n );\n const chatState = useMemo<ConversationWidgetChatState>(\n () => ({ canvas, lastClosedCanvas, isConversationRunning, runState, messages, dispatchCanvasEvent }),\n [canvas, lastClosedCanvas, isConversationRunning, runState, messages, dispatchCanvasEvent],\n );\n return <ConversationWidgetProviderBody {...bodyProps} chatState={chatState} />;\n};\n\n/** The provider over a chat store of its own — a host that brings neither a chat store nor a partition (a story). */\nconst OwnChatStoreConversationWidgetProvider = (\n props: Omit<ConversationWidgetProviderProps, \"sliceInstance\" | \"chatStore\">,\n) => {\n const [ownChatStore] = useState(createAgentsChatStore);\n return <ChatStoreConversationWidgetProvider {...props} chatStore={ownChatStore} />;\n};\n\n/**\n * The widget callbacks of one chat, the canvas model included. Reads the chat's state from the package chat store when\n * the host passes one (`chatStore`), else from a partition of the app's own chat state (`sliceInstance`, or the\n * environment's `defaultChatStatePartition` — host application: the AI-Extensions chat), else from a store of its own.\n */\nexport const ConversationWidgetProvider = (props: ConversationWidgetProviderProps) => {\n const { sliceInstance, chatStore, ...bodyProps } = props;\n const { defaultChatStatePartition } = useAgentsEnvironment();\n const statePartition = sliceInstance ?? defaultChatStatePartition;\n if (chatStore) return <ChatStoreConversationWidgetProvider {...bodyProps} chatStore={chatStore} />;\n if (statePartition) return <SliceConversationWidgetProvider {...bodyProps} sliceInstance={statePartition} />;\n return <OwnChatStoreConversationWidgetProvider {...bodyProps} />;\n};\n\nconst ConversationWidgetProviderBody = ({\n children,\n callbacks,\n hostHasCanvasSurface = true,\n chatState,\n}: ConversationWidgetProviderBodyProps) => {\n const dispatch = useAgentsStateDispatch();\n const { buildChatSurfaceOpenChangedAction } = useAgentsEnvironment();\n const { canvas, lastClosedCanvas, isConversationRunning, runState, messages } = chatState;\n const isConversationClosed = runState === \"COMPLETED\" || runState === \"CANCELLED\";\n const dispatchCanvasEventRef = useRef(chatState.dispatchCanvasEvent);\n dispatchCanvasEventRef.current = chatState.dispatchCanvasEvent;\n const hostHasCanvasSurfaceRef = useRef(hostHasCanvasSurface);\n hostHasCanvasSurfaceRef.current = hostHasCanvasSurface;\n\n // An agentic chat surface is open: the app hears it through its action (e.g. a flag every connect/create/verify flow\n // launched from inside the chat reads to stay in-widget instead of navigating away).\n // Set here (not at the connect button) so it also covers the verify path, where there is no connect click.\n // Ref-counted so concurrently-mounted chat surfaces don't clear each other's flag.\n const buildChatSurfaceOpenChangedActionRef = useRef(buildChatSurfaceOpenChangedAction);\n buildChatSurfaceOpenChangedActionRef.current = buildChatSurfaceOpenChangedAction;\n useEffect(() => {\n agenticChatMountCount += 1;\n if (agenticChatMountCount === 1 && buildChatSurfaceOpenChangedActionRef.current) {\n dispatch(buildChatSurfaceOpenChangedActionRef.current(true));\n }\n return () => {\n agenticChatMountCount -= 1;\n if (agenticChatMountCount === 0 && buildChatSurfaceOpenChangedActionRef.current) {\n dispatch(buildChatSurfaceOpenChangedActionRef.current(false));\n }\n };\n }, [dispatch]);\n\n // Mirror the latest callbacks in a ref so the exposed functions stay stable across\n // renders even if the parent passes a fresh `callbacks` object every render.\n const callbacksRef = useRef(callbacks);\n callbacksRef.current = callbacks;\n\n // Composer-widget ownership — controlled when the host supplies `composerWidgets` (the builder page, click-bridge\n // F), otherwise uncontrolled: the provider owns the state so a descendant (e.g. an app's editor drawer) can\n // mutate it directly. See ConversationWidgetCallbacks.\n const isComposerWidgetsControlled = callbacks.composerWidgets !== undefined;\n const [internalComposerWidgets, setInternalComposerWidgets] = useState<ConversationComposerWidget[]>([]);\n const composerWidgets = isComposerWidgetsControlled\n ? (callbacks.composerWidgets as ConversationComposerWidget[])\n : internalComposerWidgets;\n\n // Mirrors the latest resolved composerWidgets + controlled flag so the mutator callbacks below can compute the\n // next array off REAL current state while keeping stable identities across renders ([] deps) — same trick as\n // `callbacksRef` above.\n const composerWidgetsStateRef = useRef({ composerWidgets, isComposerWidgetsControlled });\n composerWidgetsStateRef.current = { composerWidgets, isComposerWidgetsControlled };\n\n const publishComposerWidgets = useCallback((next: ConversationComposerWidget[]) => {\n if (composerWidgetsStateRef.current.isComposerWidgetsControlled) {\n callbacksRef.current.onComposerWidgetsChange?.(next);\n } else {\n setInternalComposerWidgets(next);\n }\n }, []);\n\n const addComposerWidget = useCallback(\n (widgetName: string, fields: Record<string, unknown>): string => {\n const composerWidgetId = crypto.randomUUID();\n publishComposerWidgets([\n ...composerWidgetsStateRef.current.composerWidgets,\n { composerWidgetId, widgetName, fields },\n ]);\n return composerWidgetId;\n },\n [publishComposerWidgets],\n );\n\n const replaceComposerWidgetFields = useCallback(\n (composerWidgetId: string, fields: Record<string, unknown>) => {\n publishComposerWidgets(\n composerWidgetsStateRef.current.composerWidgets.map((widget) =>\n widget.composerWidgetId === composerWidgetId ? { ...widget, fields } : widget,\n ),\n );\n },\n [publishComposerWidgets],\n );\n\n const removeComposerWidget = useCallback(\n (composerWidgetId: string) => {\n publishComposerWidgets(\n composerWidgetsStateRef.current.composerWidgets.filter(\n (widget) => widget.composerWidgetId !== composerWidgetId,\n ),\n );\n },\n [publishComposerWidgets],\n );\n\n const clearComposerWidgets = useCallback(() => {\n publishComposerWidgets([]);\n }, [publishComposerWidgets]);\n\n // The one way to open a canvas (all four origins). The provider supplies what only it knows — the split's viability\n // (measured on the window, like `useCanvasViable`) and whether this host has a canvas surface — and the reducer\n // applies the opening rule. Ignored requests change nothing.\n const openCanvas = useCallback(\n (request: CanvasOpenRequestFromOpener) => {\n dispatchCanvasEventRef.current({\n type: \"canvasOpened\",\n request: {\n ...request,\n viewportViable: window.innerWidth >= CANVAS_VIABLE_MIN_WIDTH,\n hostHasCanvasSurface: hostHasCanvasSurfaceRef.current,\n },\n });\n },\n [],\n );\n\n // Close the open canvas; it stays re-openable as `lastClosedCanvas`. `byCustomer` = the canvas's own close control,\n // which vetoes a live re-delivery of the same identity until the next send / click / page hand-over.\n const closeCanvas = useCallback(\n (byCustomer: boolean) => {\n dispatchCanvasEventRef.current({ type: \"canvasClosed\", byCustomer });\n },\n [],\n );\n\n const lastClosedCanvasRef = useRef(lastClosedCanvas);\n lastClosedCanvasRef.current = lastClosedCanvas;\n const reopenLastClosedCanvas = useCallback(() => {\n const last = lastClosedCanvasRef.current;\n if (last === null) return;\n dispatchCanvasEventRef.current({\n type: \"canvasOpened\",\n request: {\n canvasId: last.canvasId,\n instanceId: last.instanceId,\n anchor: last.anchor,\n origin: \"cardClick\",\n justDelivered: false,\n viewportViable: window.innerWidth >= CANVAS_VIABLE_MIN_WIDTH,\n hostHasCanvasSurface: hostHasCanvasSurfaceRef.current,\n ...(last.createdEntityId !== undefined ? { createdEntityId: last.createdEntityId } : {}),\n },\n });\n }, []);\n\n const setCanvasCreatedEntityId = useCallback(\n (created: CanvasCreatedEntity) => {\n dispatchCanvasEventRef.current({ type: \"canvasCreatedEntityIdSet\", created });\n },\n [],\n );\n\n // The pointer of the OPEN canvas is remembered per conversation for a reload (`canvasStorage.ts`), for any\n // lifetime. Cleared when the canvas closes INSIDE the same conversation; a conversation switch clears the slice too,\n // but the LEFT conversation keeps its entry so coming back restores it.\n const storedCanvasConversationIdRef = useRef<number | undefined>(undefined);\n const conversationIdForStorage = callbacks.conversationId;\n useEffect(() => {\n if (canvas !== null) {\n storeOpenCanvas(conversationIdForStorage, canvas);\n storedCanvasConversationIdRef.current = conversationIdForStorage;\n return;\n }\n if (\n storedCanvasConversationIdRef.current !== undefined &&\n storedCanvasConversationIdRef.current === conversationIdForStorage\n ) {\n clearStoredCanvas(conversationIdForStorage);\n }\n storedCanvasConversationIdRef.current = undefined;\n }, [canvas, conversationIdForStorage]);\n\n // A conversation switch forgets the canvas and the last closed one (the LEFT conversation keeps its stored pointer).\n const resetCanvas = useCallback(() => {\n dispatchCanvasEventRef.current({ type: \"canvasCleared\" });\n }, []);\n\n // The SEND boundary: a turn canvas is over for good, a pinned one stays (`canvas-reducers.ts`).\n const resetCanvasForNewTurn = useCallback(() => {\n dispatchCanvasEventRef.current({ type: \"canvasResetForNewTurn\" });\n }, []);\n\n const sendMessageToChat = useCallback((message: string) => {\n return callbacksRef.current.sendMessageToChat?.(message);\n }, []);\n\n const prefillComposer = useCallback((text: string) => {\n callbacksRef.current.prefillComposer?.(text);\n }, []);\n\n const injectSignal = useCallback((signalText: string, options?: InjectSignalOptions) => {\n return callbacksRef.current.injectSignal?.(signalText, options);\n }, []);\n\n const minimizeChatHost = useCallback(() => {\n callbacksRef.current.minimizeChatHost?.();\n }, []);\n\n const contextValue = useMemo<ConversationWidgetCallbacks>(\n () => ({\n canvas,\n hostHasCanvasSurface,\n lastClosedCanvas,\n openCanvas,\n closeCanvas,\n reopenLastClosedCanvas,\n setCanvasCreatedEntityId,\n resetCanvas,\n resetCanvasForNewTurn,\n sendMessageToChat,\n prefillComposer,\n injectSignal,\n minimizeChatHost,\n chatAgentSpaceKey: callbacks.chatAgentSpaceKey,\n isConversationRunning,\n isConversationClosed,\n conversationId: callbacks.conversationId,\n composerWidgets,\n addComposerWidget,\n replaceComposerWidgetFields,\n removeComposerWidget,\n clearComposerWidgets,\n onOpenConversation: callbacks.onOpenConversation,\n onSwitchConversation: callbacks.onSwitchConversation,\n isOnboardingSetupConversation: callbacks.isOnboardingSetupConversation ?? false,\n messages,\n }),\n [\n canvas,\n hostHasCanvasSurface,\n lastClosedCanvas,\n openCanvas,\n closeCanvas,\n reopenLastClosedCanvas,\n setCanvasCreatedEntityId,\n resetCanvas,\n resetCanvasForNewTurn,\n sendMessageToChat,\n prefillComposer,\n injectSignal,\n minimizeChatHost,\n callbacks.chatAgentSpaceKey,\n isConversationRunning,\n isConversationClosed,\n callbacks.conversationId,\n composerWidgets,\n addComposerWidget,\n replaceComposerWidgetFields,\n removeComposerWidget,\n clearComposerWidgets,\n callbacks.onOpenConversation,\n callbacks.onSwitchConversation,\n callbacks.isOnboardingSetupConversation,\n messages,\n ],\n );\n\n return <ConversationWidgetContext.Provider value={contextValue}>{children}</ConversationWidgetContext.Provider>;\n};\n\n","import React from \"react\";\nimport { classNames } from \"../../../provider/class-names\";\nimport styles from \"./ConversationMessageInputComposerWidgets.module.scss\";\nimport { useConversationWidgetContext } from \"../../../renderer/ConversationWidgetContext\";\nimport { conversationWidgetRegistry } from \"../../../renderer/conversationWidgetRegistry\";\n\nexport interface ConversationMessageInputComposerWidgetsProps {\n testId?: string;\n}\n\n/**\n * Generic strip of composer widgets above the chat input's text area — the composer-side twin of\n * `ConversationMessageInputAttachmentsPreviewStrip`, same grid-rows 0fr→1fr reveal. Reads `composerWidgets` from the\n * widget context itself (so every ConversationView host gets it for free, mirroring the deleted selection chip),\n * and for each widget resolves the registry entry by `widgetName` and renders its `composerComponent` with\n * `{ composerWidgetId, fields, replaceFields, remove }`. An unknown name, or an entry without a `composerComponent`,\n * renders nothing for that widget — the same kill switch the fence plugin applies.\n */\nexport const ConversationMessageInputComposerWidgets = (props: ConversationMessageInputComposerWidgetsProps) => {\n const { testId = \"chat-input\" } = props;\n const { composerWidgets, replaceComposerWidgetFields, removeComposerWidget } = useConversationWidgetContext();\n\n const renderableWidgets = composerWidgets.flatMap((widget) => {\n const entry = conversationWidgetRegistry.widgets.find((candidate) => candidate.name === widget.widgetName);\n return entry?.composerComponent ? [{ widget, Component: entry.composerComponent }] : [];\n });\n\n return (\n <div\n className={classNames(styles.stripReveal, { [styles.stripRevealOpen]: renderableWidgets.length > 0 })}\n data-testid={`${testId}-composer-widgets-strip`}\n >\n <div className={styles.stripRevealInner}>\n <div className={styles.strip}>\n {renderableWidgets.map(({ widget, Component }) => (\n <Component\n key={widget.composerWidgetId}\n composerWidgetId={widget.composerWidgetId}\n fields={widget.fields}\n replaceFields={(nextFields) => replaceComposerWidgetFields(widget.composerWidgetId, nextFields)}\n remove={() => removeComposerWidget(widget.composerWidgetId)}\n testId={`${testId}-composer-widget-${widget.composerWidgetId}`}\n />\n ))}\n </div>\n </div>\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA+DO,MAAM,oCAA8D;AAAA,EACzE,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,sBAAsB;AACxB;AAEO,MAAM,4BAA6C;AAAA,EACxD,cAAc;AAAA,EACd,UAAU;AAAA,EACV,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,4BAA4B;AAAA,EAC5B,yBAAyB;AAAA,EACzB,yBAAyB;AAAA,EACzB,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,gB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