@mgamadeus/ddd-agents 0.5.17 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -6
- package/boundary.json +13 -0
- package/dist/chat.js +148 -773
- package/dist/chat.js.map +1 -1
- package/dist/chunks/{canvas-title-slot-context-DK4sfhkl.js → ConversationMarkdown-BsCjyhj4.js} +14 -43
- package/dist/chunks/ConversationMarkdown-BsCjyhj4.js.map +1 -0
- package/dist/chunks/{ConversationMessageInputComposerWidgets-B3Zf69rD.js → ConversationMessageInputComposerWidgets-CE8LpyXY.js} +10 -37
- package/dist/chunks/ConversationMessageInputComposerWidgets-CE8LpyXY.js.map +1 -0
- package/dist/chunks/VoiceBarsIcon-BIcURsBF.js +643 -0
- package/dist/chunks/VoiceBarsIcon-BIcURsBF.js.map +1 -0
- package/dist/chunks/{WebSearchResultsConversationWidget-887v8Wen.js → WebSearchResultsConversationWidget-DXhfSikV.js} +2 -2
- package/dist/chunks/{WebSearchResultsConversationWidget-887v8Wen.js.map → WebSearchResultsConversationWidget-DXhfSikV.js.map} +1 -1
- package/dist/chunks/{browser-request-interception-BdKjYz31.js → browser-request-interception-BnzFbH0m.js} +2 -2
- package/dist/chunks/{browser-request-interception-BdKjYz31.js.map → browser-request-interception-BnzFbH0m.js.map} +1 -1
- package/dist/chunks/{canvas-reducers-CwFA3rQ6.js → canvas-reducers-D-YxAR4B.js} +2 -2
- package/dist/chunks/{canvas-reducers-CwFA3rQ6.js.map → canvas-reducers-D-YxAR4B.js.map} +1 -1
- package/dist/chunks/canvas-title-slot-context-D6UXrkdJ.js +36 -0
- package/dist/chunks/canvas-title-slot-context-D6UXrkdJ.js.map +1 -0
- package/dist/chunks/{canvasBodies-C7qqThc9.js → canvasBodies-CQEBkIVw.js} +4 -4
- package/dist/chunks/{canvasBodies-C7qqThc9.js.map → canvasBodies-CQEBkIVw.js.map} +1 -1
- package/dist/chunks/{canvasStorage-i2wKVSBf.js → canvasStorage-BbEI3h-8.js} +2 -2
- package/dist/chunks/{canvasStorage-i2wKVSBf.js.map → canvasStorage-BbEI3h-8.js.map} +1 -1
- package/dist/chunks/format-agent-voice-call-duration-C-3hRc9p.js +10 -0
- package/dist/chunks/format-agent-voice-call-duration-C-3hRc9p.js.map +1 -0
- package/dist/chunks/{link-navigation-CNX8Am2L.js → link-navigation-BUcy5qWW.js} +2 -2
- package/dist/chunks/{link-navigation-CNX8Am2L.js.map → link-navigation-BUcy5qWW.js.map} +1 -1
- package/dist/chunks/{realtime-arrival-BTLE3jjt.js → realtime-arrival-BfsAPwqQ.js} +8 -3
- package/dist/chunks/realtime-arrival-BfsAPwqQ.js.map +1 -0
- package/dist/chunks/use-agents-chat-store-CuIkCz9v.js +34 -0
- package/dist/chunks/use-agents-chat-store-CuIkCz9v.js.map +1 -0
- package/dist/chunks/{widget-name-resolver-BVEuAsW5.js → widget-name-resolver-B9k-s_cF.js} +3 -3
- package/dist/chunks/{widget-name-resolver-BVEuAsW5.js.map → widget-name-resolver-B9k-s_cF.js.map} +1 -1
- package/dist/chunks/withPollingChangeSubscription-CnQnubfK.js.map +1 -1
- package/dist/client-testing.js +4 -4
- package/dist/client.js +14 -3
- package/dist/client.js.map +1 -1
- package/dist/files/i18n-keys.json +1128 -100
- package/dist/image-render.js +7 -7
- package/dist/index.js +6 -6
- package/dist/kit.js +2 -2
- package/dist/preview.js +7 -7
- package/dist/provider.js +1 -1
- package/dist/renderer.js +25 -24
- package/dist/renderer.js.map +1 -1
- package/dist/styles.css +531 -93
- package/dist/types/client/AgentsConversationClient.d.ts +4 -1
- package/dist/types/client/http/createAgentsHttpConversationClient.d.ts +2 -1
- package/dist/types/entries/voice-admin.d.ts +7 -0
- package/dist/types/entries/voice.d.ts +24 -0
- package/dist/types/ui/account-realtime.d.ts +50 -11
- package/dist/types/voice/AgentVoiceCallBand/AgentVoiceCallBand.d.ts +49 -0
- package/dist/types/voice/AgentVoiceCallBand/agent-voice-call-outcome-title-text-key.d.ts +8 -0
- package/dist/types/voice/AgentVoiceCallCaptions/AgentVoiceCallCaptions.d.ts +15 -0
- package/dist/types/voice/AgentVoiceCallCaptions/saved-messages-of-agent-voice-chat.d.ts +12 -0
- package/dist/types/voice/AgentVoiceCallProvider/AgentVoiceCallProvider.d.ts +21 -0
- package/dist/types/voice/AgentVoiceCallProvider/agent-voice-call-context.d.ts +17 -0
- package/dist/types/voice/AgentVoiceChatStartButton/AgentVoiceChatStartButton.d.ts +15 -0
- package/dist/types/voice/AgentVoiceIcons/AgentVoiceIcons.d.ts +10 -0
- package/dist/types/voice/AgentVoiceIncomingCall/AgentVoiceIncomingCall.d.ts +28 -0
- package/dist/types/voice/AgentVoiceInputGlow/AgentVoiceInputGlow.d.ts +11 -0
- package/dist/types/voice/AgentVoiceInputGlow/agent-voice-input-glow-voice.d.ts +8 -0
- package/dist/types/voice/admin/AgentVoiceCallConversationLink/AgentVoiceCallConversationLink.d.ts +10 -0
- package/dist/types/voice/admin/AgentVoiceCallDetailScreen/AgentVoiceCallDetailScreen.d.ts +27 -0
- package/dist/types/voice/admin/AgentVoiceCallStateBadges/AgentVoiceCallStateBadges.d.ts +12 -0
- package/dist/types/voice/admin/AgentVoiceCallsScreen/AgentVoiceCallsScreen.d.ts +33 -0
- package/dist/types/voice/admin/agent-voice-admin-api.d.ts +59 -0
- package/dist/types/voice/admin/agent-voice-admin-format.d.ts +39 -0
- package/dist/types/voice/admin/agent-voice-admin-types.d.ts +114 -0
- package/dist/types/voice/agent-voice-api.d.ts +114 -0
- package/dist/types/voice/call/agent-voice-call-elapsed-seconds.d.ts +6 -0
- package/dist/types/voice/call/agent-voice-call-end-reasons.d.ts +3 -0
- package/dist/types/voice/call/agent-voice-call-store.d.ts +111 -0
- package/dist/types/voice/call/agent-voice-call-turn.d.ts +4 -0
- package/dist/types/voice/call/build-unsaved-agent-voice-call-lines.d.ts +14 -0
- package/dist/types/voice/call/format-agent-voice-call-duration.d.ts +2 -0
- package/dist/types/voice/call/use-agent-voice-call-elapsed-seconds.d.ts +3 -0
- package/dist/types/voice/call/use-agent-voice-call-server-end.d.ts +15 -0
- package/dist/types/voice/call/use-agent-voice-call.d.ts +12 -0
- package/dist/types/voice/call/use-follow-agent-voice-call-conversation.d.ts +9 -0
- package/dist/types/voice/ring/agent-voice-caller-label.d.ts +21 -0
- package/dist/types/voice/ring/agent-voice-incoming-ring-list.d.ts +10 -0
- package/dist/types/voice/ring/agent-voice-incoming-ring-store.d.ts +47 -0
- package/dist/types/voice/ring/agent-voice-ring-source.d.ts +60 -0
- package/dist/types/voice/ring/agent-voice-ring.d.ts +35 -0
- package/dist/types/voice/ring/answer-incoming-agent-voice-call.d.ts +13 -0
- package/dist/types/voice/ring/use-agent-voice-incoming-rings.d.ts +14 -0
- package/dist/types/voice/ring/use-agent-voice-ring-tone.d.ts +6 -0
- package/dist/ui.js +82 -19
- package/dist/ui.js.map +1 -1
- package/dist/voice-admin.js +738 -0
- package/dist/voice-admin.js.map +1 -0
- package/dist/voice.js +1568 -0
- package/dist/voice.js.map +1 -0
- package/dist/widgets.js +4 -4
- package/package.json +27 -1
- package/public-api.json +155 -0
- package/dist/chunks/ConversationMessageInputComposerWidgets-B3Zf69rD.js.map +0 -1
- package/dist/chunks/canvas-title-slot-context-DK4sfhkl.js.map +0 -1
- package/dist/chunks/realtime-arrival-BTLE3jjt.js.map +0 -1
package/dist/image-render.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import React, { useRef, useEffect } from "react";
|
|
4
|
-
import { G as resolveWidgetName, j as conversationWidgetRegistry } from "./chunks/widget-name-resolver-
|
|
5
|
-
import { H } from "./chunks/widget-name-resolver-
|
|
6
|
-
import { y as ConversationWidgetRenderContext, a6 as WidgetImageReadinessContext, R as ReadOnlyConversationWidgetProvider, a7 as WidgetImageRenderContext, a8 as WidgetImageLiveHydrationContext, z as buildWidgetAgentSpaceKeyProps } from "./chunks/WebSearchResultsConversationWidget-
|
|
7
|
-
import { a9, aa, ab } from "./chunks/WebSearchResultsConversationWidget-
|
|
8
|
-
import { r as readWidgetImageReadiness, p as publishWidgetImageReadiness, i as interceptXMLHttpRequests, a as interceptFetchRequests, c as createHeaderlessResponse, t as toSameRealmFetchInput } from "./chunks/browser-request-interception-
|
|
9
|
-
import { W, b } from "./chunks/browser-request-interception-
|
|
10
|
-
import { U as getGoogleMapWidgetNames, X as getWidgetImageCaptureReadPathPrefix } from "./chunks/link-navigation-
|
|
4
|
+
import { G as resolveWidgetName, j as conversationWidgetRegistry } from "./chunks/widget-name-resolver-B9k-s_cF.js";
|
|
5
|
+
import { H } from "./chunks/widget-name-resolver-B9k-s_cF.js";
|
|
6
|
+
import { y as ConversationWidgetRenderContext, a6 as WidgetImageReadinessContext, R as ReadOnlyConversationWidgetProvider, a7 as WidgetImageRenderContext, a8 as WidgetImageLiveHydrationContext, z as buildWidgetAgentSpaceKeyProps } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
|
|
7
|
+
import { a9, aa, ab } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
|
|
8
|
+
import { r as readWidgetImageReadiness, p as publishWidgetImageReadiness, i as interceptXMLHttpRequests, a as interceptFetchRequests, c as createHeaderlessResponse, t as toSameRealmFetchInput } from "./chunks/browser-request-interception-BnzFbH0m.js";
|
|
9
|
+
import { W, b } from "./chunks/browser-request-interception-BnzFbH0m.js";
|
|
10
|
+
import { U as getGoogleMapWidgetNames, X as getWidgetImageCaptureReadPathPrefix } from "./chunks/link-navigation-BUcy5qWW.js";
|
|
11
11
|
const root = "agents_root_prMo3u";
|
|
12
12
|
const styles = {
|
|
13
13
|
root
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { h, i } from "./chunks/widget-name-resolver-
|
|
3
|
-
import { r as registerCanvasBodies, c as canvasBodies } from "./chunks/canvasBodies-
|
|
4
|
-
import { g, a, b } from "./chunks/canvasBodies-
|
|
5
|
-
import { a as isPackageCanvasId, d as declareCanvasKind, f as forgetCanvasKind } from "./chunks/WebSearchResultsConversationWidget-
|
|
6
|
-
import { r, b as b2, c, e, g as g2 } from "./chunks/WebSearchResultsConversationWidget-
|
|
2
|
+
import { h, i } from "./chunks/widget-name-resolver-B9k-s_cF.js";
|
|
3
|
+
import { r as registerCanvasBodies, c as canvasBodies } from "./chunks/canvasBodies-CQEBkIVw.js";
|
|
4
|
+
import { g, a, b } from "./chunks/canvasBodies-CQEBkIVw.js";
|
|
5
|
+
import { a as isPackageCanvasId, d as declareCanvasKind, f as forgetCanvasKind } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
|
|
6
|
+
import { r, b as b2, c, e, g as g2 } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
|
|
7
7
|
import { r as registerCanvasFeatureFlags, c as canvasFeatureFlags } from "./chunks/canvas-feature-flags-Cn8xBliA.js";
|
|
8
8
|
import { A, i as i2 } from "./chunks/icon-names-Di6c4zLo.js";
|
|
9
9
|
import { A as A2, f } from "./chunks/host-color-scheme-Jhb7JZR7.js";
|
|
10
|
-
import { A as A3, a as a2, B, C, b as b3, D, c as c2, d, e as e2, f as f2, G, H, g as g3, I, h as h2, L, M, i as i3, j, k, P, R, l, S, m, n, o, p, q, r as r2, T, s, t, u, v, w, W, x, y, z, E, F, J, K, N, O, Q, U, V, X, Y, Z, _, $, a0, a1, a2 as a22, a3, a4, a5, a6, a7, a8, a9, aa, ab } from "./chunks/link-navigation-
|
|
10
|
+
import { A as A3, a as a2, B, C, b as b3, D, c as c2, d, e as e2, f as f2, G, H, g as g3, I, h as h2, L, M, i as i3, j, k, P, R, l, S, m, n, o, p, q, r as r2, T, s, t, u, v, w, W, x, y, z, E, F, J, K, N, O, Q, U, V, X, Y, Z, _, $, a0, a1, a2 as a22, a3, a4, a5, a6, a7, a8, a9, aa, ab } from "./chunks/link-navigation-BUcy5qWW.js";
|
|
11
11
|
import { u as u2, a as a10 } from "./chunks/AgentsConversationClientContext-C4T7g_Qk.js";
|
|
12
12
|
const registerCanvasKind = (kind) => {
|
|
13
13
|
if (isPackageCanvasId(kind.canvasId)) {
|
package/dist/kit.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { A, C, a, b, c, d, e, E, r, f, u, g } from "./chunks/widget-name-resolver-
|
|
3
|
-
import { M } from "./chunks/WebSearchResultsConversationWidget-
|
|
2
|
+
import { A, C, a, b, c, d, e, E, r, f, u, g } from "./chunks/widget-name-resolver-B9k-s_cF.js";
|
|
3
|
+
import { M } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
|
|
4
4
|
import { E as E2, u as u2 } from "./chunks/entity-detail-name-3A82gDAp.js";
|
|
5
5
|
export {
|
|
6
6
|
A as ApexChart,
|
package/dist/preview.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { s as Text, Y as getWidgetSelfHydrationKeyFieldName, e as DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME, V as getSandboxLegacyAliases } from "./chunks/link-navigation-
|
|
3
|
+
import { s as Text, Y as getWidgetSelfHydrationKeyFieldName, e as DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME, V as getSandboxLegacyAliases } from "./chunks/link-navigation-BUcy5qWW.js";
|
|
4
4
|
import { useRef, useState, useMemo, useEffect, useCallback } from "react";
|
|
5
|
-
import { Q as buildComposedViewComponentRegistry, R as composedViewComponents, G as resolveWidgetName, j as conversationWidgetRegistry, o as ConversationWidgetErrorBoundary, S as ComposedViewComponentsContext } from "./chunks/widget-name-resolver-
|
|
6
|
-
import { aE as WidgetSurface, Y as readWidgetAgentSpaceKeyAttribute, h as canvasBehaviourOf, W as WidgetRenderReportContext, z as buildWidgetAgentSpaceKeyProps, S as StandaloneConversationWidgetProvider, y as ConversationWidgetRenderContext, a7 as WidgetImageRenderContext, ac as CANVAS_VIABLE_MIN_WIDTH, l as listWidgetHydratorTypes, j as getWidgetHydrator, u as unregisterWidgetHydrator, g as registerWidgetHydrator } from "./chunks/WebSearchResultsConversationWidget-
|
|
7
|
-
import { c as canvasBodies, E as EntityMentionAskButton } from "./chunks/canvasBodies-
|
|
8
|
-
import { f as decideCanvasOpen } from "./chunks/canvas-reducers-
|
|
9
|
-
import { p as publishWidgetImageReadiness, i as interceptXMLHttpRequests, d as isFetchRequest, c as createHeaderlessResponse } from "./chunks/browser-request-interception-
|
|
10
|
-
import { C as ConversationWidgetProvider, a as ConversationMessageInputComposerWidgets } from "./chunks/ConversationMessageInputComposerWidgets-
|
|
5
|
+
import { Q as buildComposedViewComponentRegistry, R as composedViewComponents, G as resolveWidgetName, j as conversationWidgetRegistry, o as ConversationWidgetErrorBoundary, S as ComposedViewComponentsContext } from "./chunks/widget-name-resolver-B9k-s_cF.js";
|
|
6
|
+
import { aE as WidgetSurface, Y as readWidgetAgentSpaceKeyAttribute, h as canvasBehaviourOf, W as WidgetRenderReportContext, z as buildWidgetAgentSpaceKeyProps, S as StandaloneConversationWidgetProvider, y as ConversationWidgetRenderContext, a7 as WidgetImageRenderContext, ac as CANVAS_VIABLE_MIN_WIDTH, l as listWidgetHydratorTypes, j as getWidgetHydrator, u as unregisterWidgetHydrator, g as registerWidgetHydrator } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
|
|
7
|
+
import { c as canvasBodies, E as EntityMentionAskButton } from "./chunks/canvasBodies-CQEBkIVw.js";
|
|
8
|
+
import { f as decideCanvasOpen } from "./chunks/canvas-reducers-D-YxAR4B.js";
|
|
9
|
+
import { p as publishWidgetImageReadiness, i as interceptXMLHttpRequests, d as isFetchRequest, c as createHeaderlessResponse } from "./chunks/browser-request-interception-BnzFbH0m.js";
|
|
10
|
+
import { C as ConversationWidgetProvider, a as ConversationMessageInputComposerWidgets } from "./chunks/ConversationMessageInputComposerWidgets-CE8LpyXY.js";
|
|
11
11
|
const page$1 = "agents_page_5VMDeD";
|
|
12
12
|
const chatColumn = "agents_chatColumn_FWcgdJ";
|
|
13
13
|
const widget = "agents_widget_3qpgMy";
|
package/dist/provider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { A, i } from "./chunks/icon-names-Di6c4zLo.js";
|
|
3
3
|
import { A as A2, f } from "./chunks/host-color-scheme-Jhb7JZR7.js";
|
|
4
|
-
import { A as A3, a, B, C, b, D, c, d, e, f as f2, G, H, g, I, h, L, M, i as i2, j, k, P, R, l, S, m, n, o, p, q, r, T, s, t, u, v, w, W, x, y, z, E, F, J, K, N, O, Q, U, V, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab } from "./chunks/link-navigation-
|
|
4
|
+
import { A as A3, a, B, C, b, D, c, d, e, f as f2, G, H, g, I, h, L, M, i as i2, j, k, P, R, l, S, m, n, o, p, q, r, T, s, t, u, v, w, W, x, y, z, E, F, J, K, N, O, Q, U, V, X, Y, Z, _, $, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab } from "./chunks/link-navigation-BUcy5qWW.js";
|
|
5
5
|
import { u as u2, a as a10 } from "./chunks/AgentsConversationClientContext-C4T7g_Qk.js";
|
|
6
6
|
export {
|
|
7
7
|
A as AGENTS_ICON_NAMES,
|
package/dist/renderer.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { C, a,
|
|
3
|
-
import { m as findWidgetFenceByPayloadHash, n as findWidgetFencesInMarkdown } from "./chunks/widget-name-resolver-
|
|
4
|
-
import { o, p as p2, q, t, v, w, j, x, y, z, B, D, F, G } from "./chunks/widget-name-resolver-
|
|
5
|
-
import { m as useResolvedConversationWidgetAgentSpaceKey, p as payloadHashOfInstanceId } from "./chunks/WebSearchResultsConversationWidget-
|
|
6
|
-
import { C as C2, n, o as o2, q as q2, t as t2, v as v2, w as w2, x as x2, y as y2, D as D2, L, R, S, W as W2, z as z2, h, A, B as B2, E, F as F2, G as G2, H, I, J, K, N, O, j as j2, P, Q, i
|
|
7
|
-
import {
|
|
2
|
+
import { C, a, M, W, b, c, d, p, s } from "./chunks/ConversationMarkdown-BsCjyhj4.js";
|
|
3
|
+
import { m as findWidgetFenceByPayloadHash, n as findWidgetFencesInMarkdown } from "./chunks/widget-name-resolver-B9k-s_cF.js";
|
|
4
|
+
import { o, p as p2, q, t, v, w, j, x, y, z, B, D, F, G } from "./chunks/widget-name-resolver-B9k-s_cF.js";
|
|
5
|
+
import { m as useResolvedConversationWidgetAgentSpaceKey, p as payloadHashOfInstanceId } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
|
|
6
|
+
import { C as C2, n, o as o2, q as q2, t as t2, v as v2, w as w2, x as x2, y as y2, D as D2, L, R, S, W as W2, z as z2, h, A, B as B2, E, F as F2, G as G2, H, I, J, K, N, O, j as j2, P, Q, i, T, a as a2, U, V, X, Y, Z, g, _, s as s2, $, u, a0, a1, a2 as a22, a3, a4, a5 } from "./chunks/WebSearchResultsConversationWidget-DXhfSikV.js";
|
|
7
|
+
import { C as C3, d as d2, g as g2, i as i2, r, u as u2 } from "./chunks/canvas-title-slot-context-D6UXrkdJ.js";
|
|
8
|
+
import { c as c2, u as u3 } from "./chunks/canvasBodies-CQEBkIVw.js";
|
|
8
9
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
9
|
-
import { n as Skeleton } from "./chunks/link-navigation-
|
|
10
|
-
import { ac, ad, ae, af, ag } from "./chunks/link-navigation-
|
|
10
|
+
import { n as Skeleton } from "./chunks/link-navigation-BUcy5qWW.js";
|
|
11
|
+
import { ac, ad, ae, af, ag } from "./chunks/link-navigation-BUcy5qWW.js";
|
|
11
12
|
import { useMemo } from "react";
|
|
12
|
-
import { a as a6, b as b2, c as c3, d as
|
|
13
|
+
import { a as a6, b as b2, c as c3, d as d3, e } from "./chunks/canvas-reducers-D-YxAR4B.js";
|
|
13
14
|
import { a as a7 } from "./chunks/canvas-feature-flags-Cn8xBliA.js";
|
|
14
15
|
const pickSection = (payloadValue, fallback) => {
|
|
15
16
|
return payloadValue ?? fallback.data ?? void 0;
|
|
@@ -101,8 +102,8 @@ export {
|
|
|
101
102
|
n as CANVAS_FILLS_SCREEN_WIDTH_PERCENT,
|
|
102
103
|
o2 as CANVAS_MIN_WIDTH_PX,
|
|
103
104
|
q2 as CHAT_COLUMN_MIN_WIDTH_PX,
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
C3 as CanvasTitleSlotContext,
|
|
106
|
+
C as ConversationMarkdown,
|
|
106
107
|
t2 as ConversationWidgetActions,
|
|
107
108
|
v2 as ConversationWidgetAgentSpaceFrame,
|
|
108
109
|
w2 as ConversationWidgetAgentSpaceHeader,
|
|
@@ -110,7 +111,7 @@ export {
|
|
|
110
111
|
o as ConversationWidgetErrorBoundary,
|
|
111
112
|
p2 as ConversationWidgetFeatureGate,
|
|
112
113
|
ConversationWidgetGateSkeleton,
|
|
113
|
-
|
|
114
|
+
a as ConversationWidgetHost,
|
|
114
115
|
y2 as ConversationWidgetRenderContext,
|
|
115
116
|
D2 as DEFAULT_CANVAS_WIDTH_PERCENT,
|
|
116
117
|
L as LEGACY_CARD_CLICK_ORIGIN,
|
|
@@ -125,12 +126,12 @@ export {
|
|
|
125
126
|
a6 as applyClearCanvas,
|
|
126
127
|
b2 as applyCloseCanvas,
|
|
127
128
|
c3 as applyOpenCanvas,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
d3 as applyResetCanvasForNewTurn,
|
|
130
|
+
e as applySetCanvasCreatedEntityId,
|
|
131
|
+
b as buildComposerWidgetFenceBlock,
|
|
132
|
+
c as buildMessageTextWithComposerWidgets,
|
|
132
133
|
z2 as buildWidgetAgentSpaceKeyProps,
|
|
133
|
-
|
|
134
|
+
d as buildWidgetRenderReportSignal,
|
|
134
135
|
h as canvasBehaviourOf,
|
|
135
136
|
c2 as canvasBodies,
|
|
136
137
|
a7 as canvasFeatureFlagOf,
|
|
@@ -147,7 +148,7 @@ export {
|
|
|
147
148
|
w as composedViewTreeToWire,
|
|
148
149
|
j as conversationWidgetRegistry,
|
|
149
150
|
af as createAgentsWidgetHydrationStateStore,
|
|
150
|
-
|
|
151
|
+
d2 as deepLinkableWidgetNameForCanvas,
|
|
151
152
|
K as defaultConversationWidgetCallbacks,
|
|
152
153
|
N as entityIdOfInstanceId,
|
|
153
154
|
findWidgetFenceByPayloadHash,
|
|
@@ -156,16 +157,16 @@ export {
|
|
|
156
157
|
y as getConversationWidgetRegistryRevision,
|
|
157
158
|
O as getDeclaredCanvasIds,
|
|
158
159
|
ag as getDefaultAgentsStateStore,
|
|
159
|
-
|
|
160
|
+
g2 as getWidgetClickSignalSources,
|
|
160
161
|
j2 as getWidgetHydrator,
|
|
161
162
|
P as hasWidgetHydrator,
|
|
162
163
|
Q as isCanvasAnchorLoaded,
|
|
163
|
-
|
|
164
|
+
i as isCanvasId,
|
|
164
165
|
T as isCanvasReference,
|
|
165
166
|
a2 as isPackageCanvasId,
|
|
166
167
|
isSectionIncomplete,
|
|
167
168
|
isSectionLoading,
|
|
168
|
-
|
|
169
|
+
i2 as isWidgetClickSignalSource,
|
|
169
170
|
mergeSection,
|
|
170
171
|
mergeSectionValues,
|
|
171
172
|
U as messageAnchor,
|
|
@@ -179,7 +180,7 @@ export {
|
|
|
179
180
|
D as readOpenEntityActionTarget,
|
|
180
181
|
Y as readWidgetAgentSpaceKeyAttribute,
|
|
181
182
|
Z as referenceOfCanvasInstanceId,
|
|
182
|
-
|
|
183
|
+
g as registerWidgetHydrator,
|
|
183
184
|
F as resolveCanonicalWidgetName,
|
|
184
185
|
r as resolveDeepLinkableWidget,
|
|
185
186
|
G as resolveWidgetName,
|
|
@@ -188,11 +189,11 @@ export {
|
|
|
188
189
|
sectionCoversKeys,
|
|
189
190
|
$ as shortStringHash,
|
|
190
191
|
s as splitComposerWidgetFencesFromMessageText,
|
|
191
|
-
|
|
192
|
+
u as unregisterWidgetHydrator,
|
|
192
193
|
useAnchorWidgetAgentSpaceKey,
|
|
193
194
|
useAnchorWidgetFenceAgentSpaceKey,
|
|
194
195
|
u3 as useAnchorWidgetPayload,
|
|
195
|
-
|
|
196
|
+
u2 as useCanvasTitleSlot,
|
|
196
197
|
useConversationWidgetAgentSpaceFallback,
|
|
197
198
|
a0 as useConversationWidgetContext,
|
|
198
199
|
a1 as useIsEmailWidgetRender,
|
package/dist/renderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.js","sources":["../src/renderer/widget-hydration/section-hydration.ts","../src/renderer/_access/ConversationWidgetGateSkeleton.tsx","../src/renderer/_agent-space/use-conversation-widget-agent-space-fallback.ts","../src/renderer/canvas/use-anchor-widget-agent-space-key.ts","../src/renderer/read-conversation-widget-variant.ts"],"sourcesContent":["export interface SectionHydrationResult<T> {\n data: T | null;\n isLoading: boolean;\n error?: string | null;\n}\n\nexport type SectionHydrator<T> = () => SectionHydrationResult<T>;\n\n/**\n * Prefer payload-provided value; fall back to a hydrator result; undefined otherwise.\n * Callers should call the fallback hook unconditionally (React hook rules) and pass\n * its result here.\n */\nexport const pickSection = <T>(payloadValue: T | undefined, fallback: SectionHydrationResult<T>): T | undefined => {\n return payloadValue ?? fallback.data ?? undefined;\n};\n\n/**\n * True when payload is missing the value AND the fallback is still loading.\n */\nexport const isSectionLoading = <T>(payloadValue: T | undefined, fallback: SectionHydrationResult<T>): boolean => {\n return payloadValue === undefined && fallback.isLoading;\n};\n\n/**\n * Field-level merge of two section values. Payload fields (when defined) win\n * over hydrated fields; undefined payload fields are filled from the hydrated\n * value. Use when the agent sends partial section data (e.g. only a CTA) and\n * the client hydrates the remaining fields.\n */\nexport const mergeSectionValues = <T extends object>(\n payloadValue: T | undefined,\n hydratedValue: T | undefined,\n): T | undefined => {\n if (!hydratedValue) {\n return payloadValue;\n }\n if (!payloadValue) {\n return hydratedValue;\n }\n\n const defined: Partial<T> = {};\n for (const key of Object.keys(payloadValue) as Array<keyof T>) {\n const v = payloadValue[key];\n if (v !== undefined) {\n defined[key] = v;\n }\n }\n return { ...hydratedValue, ...defined } as T;\n};\n\n/**\n * Field-level merge for object sections. Payload fields (when defined) win over\n * fallback fields. Undefined payload fields are filled from the fallback. Use\n * this when the agent sends partial section data (e.g. only a CTA) and the\n * client needs to hydrate the remaining fields from app state.\n */\nexport const mergeSection = <T extends object>(\n payloadValue: T | undefined,\n fallback: SectionHydrationResult<T>,\n): T | undefined => {\n return mergeSectionValues(payloadValue, fallback.data ?? undefined);\n};\n\n/**\n * True when the payload provides every field in `requiredKeys` — the section\n * can render straight from the agent payload without waiting for hydration.\n */\nexport const sectionCoversKeys = <T extends object>(\n payloadValue: T | undefined,\n requiredKeys: ReadonlyArray<keyof T>,\n): boolean => {\n if (!payloadValue) {\n return false;\n }\n return requiredKeys.every((k) => payloadValue[k] !== undefined);\n};\n\n/**\n * True when the fallback is still loading AND the payload has not provided\n * every expected field (listed in `requiredKeys`). Use together with\n * `mergeSection` to decide whether to show a skeleton for the section.\n */\nexport const isSectionIncomplete = <T extends object>(\n payloadValue: T | undefined,\n fallback: SectionHydrationResult<T>,\n requiredKeys: ReadonlyArray<keyof T>,\n): boolean => {\n if (!fallback.isLoading) {\n return false;\n }\n if (!payloadValue) {\n return true;\n }\n return requiredKeys.some((k) => {\n return (payloadValue as T)[k] === undefined;\n });\n};\n","import { Skeleton } from \"../../provider/components\";\nimport React from \"react\";\n\n/**\n * Neutral loading state shown by ConversationWidgetFeatureGate while another agent space's feature\n * flags are being fetched. The gate can't know the gated widget's own skeleton, so this\n * is a generic widget-sized placeholder.\n */\nexport const ConversationWidgetGateSkeleton = () => (\n <div data-testid=\"ConversationWidgetGateSkeleton\">\n <Skeleton height=\"20px\" width=\"40%\" />\n <Skeleton height=\"64px\" width=\"100%\" borderRadius=\"8px\" />\n </div>\n);\n","import { SectionHydrationResult } from \"../widget-hydration\";\nimport { useResolvedConversationWidgetAgentSpaceKey } from \"./use-resolved-conversation-widget-agent-space-key\";\n\n/**\n * The empty fallback of a widget of another agent space: such a widget must not merge what the app holds for the\n * ACTIVE agent space into its own data.\n */\nconst ANOTHER_AGENT_SPACE_EMPTY_FALLBACK = { data: null, isLoading: false, error: null } as const;\n\n/**\n * Resolves the widget's agent space and picks the fallback every snapshot widget needs with it.\n *\n * - Active agent space → the caller's live `activeFallback`, so `mergeSection` keeps merging the app's fresher data.\n * - Another agent space → a static empty result, so the widget's own data passes through `mergeSection` unmixed.\n *\n * Pass the result of the active-fallback hook in directly:\n * useConversationWidgetAgentSpaceFallback(agentSpaceKeyAttribute, useSomeActiveHydration())\n * The hook order is the same on every render.\n */\nexport const useConversationWidgetAgentSpaceFallback = <T>(\n agentSpaceKeyAttribute: string | number | undefined,\n activeFallback: SectionHydrationResult<T>,\n): {\n anotherAgentSpaceKey: number | undefined;\n isAnotherAgentSpace: boolean;\n fallback: SectionHydrationResult<T>;\n} => {\n const { anotherAgentSpaceKey, isAnotherAgentSpace } = useResolvedConversationWidgetAgentSpaceKey(agentSpaceKeyAttribute);\n return {\n anotherAgentSpaceKey,\n isAnotherAgentSpace,\n fallback: isAnotherAgentSpace ? (ANOTHER_AGENT_SPACE_EMPTY_FALLBACK as SectionHydrationResult<T>) : activeFallback,\n };\n};\n","import { useMemo } from \"react\";\nimport { useResolvedConversationWidgetAgentSpaceKey } from \"../_agent-space/use-resolved-conversation-widget-agent-space-key\";\nimport type { CanvasState } from \"./canvas-state\";\nimport { payloadHashOfInstanceId } from \"./canvas-state\";\nimport { findWidgetFenceByPayloadHash, findWidgetFencesInMarkdown } from \"./find-widget-fences-in-markdown\";\n\n/**\n * The key of the agent space the fence of the anchor message names — unresolved, exactly what the inline widget\n * receives as its prop. Undefined for a page anchor, a missing anchor message or a fence that names no agent space.\n * For a body whose inline widget resolves the key itself, so both resolve it the same way.\n */\nexport const useAnchorWidgetFenceAgentSpaceKey = (\n canvas: CanvasState,\n anchorMessageMarkdown: string | null,\n widgetName: string,\n): string | undefined =>\n useMemo(() => {\n if (canvas.anchor.kind !== \"message\" || anchorMessageMarkdown === null) return undefined;\n const payloadHash = payloadHashOfInstanceId(canvas.instanceId);\n const fence =\n payloadHash !== undefined\n ? findWidgetFenceByPayloadHash(anchorMessageMarkdown, widgetName, payloadHash)\n : findWidgetFencesInMarkdown(anchorMessageMarkdown).find((candidate) => candidate.name === widgetName);\n return fence?.agentSpaceKey;\n }, [canvas.anchor, canvas.instanceId, anchorMessageMarkdown, widgetName]);\n\n/**\n * The agent space a message-anchored canvas body works on, resolved the way its inline widget resolves it: the agent\n * space the fence names when it is ANOTHER one than the active one, else the chat's agent space (`chatAgentSpaceKey`,\n * passed by the shell), else the active one. For a page anchor: the anchor's agent space.\n *\n * A fence that names the ACTIVE agent space is dropped here in favour of the chat's agent space — the order of the\n * inline widgets that compute `anotherAgentSpaceKey ?? chatAgentSpaceKey`. A widget whose inline render lets the\n * fence win reads {@link useAnchorWidgetFenceAgentSpaceKey} instead.\n */\nexport const useAnchorWidgetAgentSpaceKey = (\n canvas: CanvasState,\n anchorMessageMarkdown: string | null,\n widgetName: string,\n chatAgentSpaceKey: number | undefined,\n): number | undefined => {\n const fenceAgentSpaceKey = useAnchorWidgetFenceAgentSpaceKey(canvas, anchorMessageMarkdown, widgetName);\n const { anotherAgentSpaceKey, activeAgentSpaceKey } = useResolvedConversationWidgetAgentSpaceKey(fenceAgentSpaceKey);\n if (canvas.anchor.kind === \"page\") return canvas.anchor.agentSpaceKey;\n return anotherAgentSpaceKey ?? chatAgentSpaceKey ?? activeAgentSpaceKey;\n};\n","/**\n * Density flag shared by snapshot widgets. Lives on the payload, but it\n * is a PRESENTATION choice the agent makes — independent of whether the widget's data\n * came from the agent's payload or from live hydration.\n */\nexport type ConversationWidgetVariant = \"compact\" | \"full\";\n\ninterface WithVariant {\n variant?: ConversationWidgetVariant;\n}\n\n/**\n * Read just the `variant` flag out of a raw widget payload string, even when the\n * rest of the payload is incomplete (so the agent can request a density with a\n * minimal `{\"variant\":\"compact\"}` and let the data hydrate).\n */\nexport const readPayloadVariant = (rawPayload: string): ConversationWidgetVariant | undefined => {\n try {\n const parsed = JSON.parse(rawPayload) as { variant?: unknown };\n if (parsed && (parsed.variant === \"compact\" || parsed.variant === \"full\")) {\n return parsed.variant;\n }\n } catch {\n // Non-JSON or empty payload — no variant to read.\n }\n return undefined;\n};\n\n/**\n * Overlay the agent's requested `variant` onto the resolved widget data. The agent's\n * payload variant always wins; when the payload omits it the resolved data's own\n * variant (or the widget default) stands.\n */\nexport const withConversationWidgetVariant = <T extends WithVariant>(\n base: T | undefined,\n rawPayload: string,\n): T | undefined => {\n if (!base) {\n return base;\n }\n const variant = readPayloadVariant(rawPayload);\n return variant ? { ...base, variant } : base;\n};\n"],"names":["v"],"mappings":";;;;;;;;;;;;;AAaO,MAAM,cAAc,CAAI,cAA6B,aAAuD;AACjH,SAAO,gBAAgB,SAAS,QAAQ;AAC1C;AAKO,MAAM,mBAAmB,CAAI,cAA6B,aAAiD;AAChH,SAAO,iBAAiB,UAAa,SAAS;AAChD;AAQO,MAAM,qBAAqB,CAChC,cACA,kBACkB;AAClB,MAAI,CAAC,eAAe;AAClB,WAAO;AAAA,EACT;AACA,MAAI,CAAC,cAAc;AACjB,WAAO;AAAA,EACT;AAEA,QAAM,UAAsB,CAAA;AAC5B,aAAW,OAAO,OAAO,KAAK,YAAY,GAAqB;AAC7D,UAAMA,KAAI,aAAa,GAAG;AAC1B,QAAIA,OAAM,QAAW;AACnB,cAAQ,GAAG,IAAIA;AAAA,IACjB;AAAA,EACF;AACA,SAAO,EAAE,GAAG,eAAe,GAAG,QAAA;AAChC;AAQO,MAAM,eAAe,CAC1B,cACA,aACkB;AAClB,SAAO,mBAAmB,cAAc,SAAS,QAAQ,MAAS;AACpE;AAMO,MAAM,oBAAoB,CAC/B,cACA,iBACY;AACZ,MAAI,CAAC,cAAc;AACjB,WAA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QAAM,EAAE,sBAAsB,wBAAwB,2CAA2C,kBAAkB;AACnH,MAAI,OAAO,OAAO,SAAS,OAAQ,QAAO,OAAO,OAAO;AACxD,SAAO,wBAAwB,qBAAqB;AACtD;AC7BO,MAAM,qBAAqB,CAAC,eAA8D;AAC/F,MAAI;AACF,UAAM,SAAS,KAAK,MAAM,UAAU;AACpC,QAAI,WAAW,OAAO,YAAY,aAAa,OAAO,YAAY,SAAS;AACzE,aAAO,OAAO;AAAA,IAChB;AAAA,EACF,QAAQ;AAAA,EAER;AACA,SAAO;AACT;AAOO,MAAM,gCAAgC,CAC3C,MACA,eACkB;AAClB,MAAI,CAAC,MAAM;AACT,WAAO;AAAA,EACT;AACA,QAAM,UAAU,mBAAmB,UAAU;AAC7C,SAAO,UAAU,EAAE,GAAG,MAAM,YAAY;AAC1C;"}
|
|
1
|
+
{"version":3,"file":"renderer.js","sources":["../src/renderer/widget-hydration/section-hydration.ts","../src/renderer/_access/ConversationWidgetGateSkeleton.tsx","../src/renderer/_agent-space/use-conversation-widget-agent-space-fallback.ts","../src/renderer/canvas/use-anchor-widget-agent-space-key.ts","../src/renderer/read-conversation-widget-variant.ts"],"sourcesContent":["export interface SectionHydrationResult<T> {\n data: T | null;\n isLoading: boolean;\n error?: string | null;\n}\n\nexport type SectionHydrator<T> = () => SectionHydrationResult<T>;\n\n/**\n * Prefer payload-provided value; fall back to a hydrator result; undefined otherwise.\n * Callers should call the fallback hook unconditionally (React hook rules) and pass\n * its result here.\n */\nexport const pickSection = <T>(payloadValue: T | undefined, fallback: SectionHydrationResult<T>): T | undefined => {\n return payloadValue ?? fallback.data ?? undefined;\n};\n\n/**\n * True when payload is missing the value AND the fallback is still loading.\n */\nexport const isSectionLoading = <T>(payloadValue: T | undefined, fallback: SectionHydrationResult<T>): boolean => {\n return payloadValue === undefined && fallback.isLoading;\n};\n\n/**\n * Field-level merge of two section values. Payload fields (when defined) win\n * over hydrated fields; undefined payload fields are filled from the hydrated\n * value. Use when the agent sends partial section data (e.g. only a CTA) and\n * the client hydrates the remaining fields.\n */\nexport const mergeSectionValues = <T extends object>(\n payloadValue: T | undefined,\n hydratedValue: T | undefined,\n): T | undefined => {\n if (!hydratedValue) {\n return payloadValue;\n }\n if (!payloadValue) {\n return hydratedValue;\n }\n\n const defined: Partial<T> = {};\n for (const key of Object.keys(payloadValue) as Array<keyof T>) {\n const v = payloadValue[key];\n if (v !== undefined) {\n defined[key] = v;\n }\n }\n return { ...hydratedValue, ...defined } as T;\n};\n\n/**\n * Field-level merge for object sections. Payload fields (when defined) win over\n * fallback fields. Undefined payload fields are filled from the fallback. Use\n * this when the agent sends partial section data (e.g. only a CTA) and the\n * client needs to hydrate the remaining fields from app state.\n */\nexport const mergeSection = <T extends object>(\n payloadValue: T | undefined,\n fallback: SectionHydrationResult<T>,\n): T | undefined => {\n return mergeSectionValues(payloadValue, fallback.data ?? undefined);\n};\n\n/**\n * True when the payload provides every field in `requiredKeys` — the section\n * can render straight from the agent payload without waiting for hydration.\n */\nexport const sectionCoversKeys = <T extends object>(\n payloadValue: T | undefined,\n requiredKeys: ReadonlyArray<keyof T>,\n): boolean => {\n if (!payloadValue) {\n return false;\n }\n return requiredKeys.every((k) => payloadValue[k] !== undefined);\n};\n\n/**\n * True when the fallback is still loading AND the payload has not provided\n * every expected field (listed in `requiredKeys`). Use together with\n * `mergeSection` to decide whether to show a skeleton for the section.\n */\nexport const isSectionIncomplete = <T extends object>(\n payloadValue: T | undefined,\n fallback: SectionHydrationResult<T>,\n requiredKeys: ReadonlyArray<keyof T>,\n): boolean => {\n if (!fallback.isLoading) {\n return false;\n }\n if (!payloadValue) {\n return true;\n }\n return requiredKeys.some((k) => {\n return (payloadValue as T)[k] === undefined;\n });\n};\n","import { Skeleton } from \"../../provider/components\";\nimport React from \"react\";\n\n/**\n * Neutral loading state shown by ConversationWidgetFeatureGate while another agent space's feature\n * flags are being fetched. The gate can't know the gated widget's own skeleton, so this\n * is a generic widget-sized placeholder.\n */\nexport const ConversationWidgetGateSkeleton = () => (\n <div data-testid=\"ConversationWidgetGateSkeleton\">\n <Skeleton height=\"20px\" width=\"40%\" />\n <Skeleton height=\"64px\" width=\"100%\" borderRadius=\"8px\" />\n </div>\n);\n","import { SectionHydrationResult } from \"../widget-hydration\";\nimport { useResolvedConversationWidgetAgentSpaceKey } from \"./use-resolved-conversation-widget-agent-space-key\";\n\n/**\n * The empty fallback of a widget of another agent space: such a widget must not merge what the app holds for the\n * ACTIVE agent space into its own data.\n */\nconst ANOTHER_AGENT_SPACE_EMPTY_FALLBACK = { data: null, isLoading: false, error: null } as const;\n\n/**\n * Resolves the widget's agent space and picks the fallback every snapshot widget needs with it.\n *\n * - Active agent space → the caller's live `activeFallback`, so `mergeSection` keeps merging the app's fresher data.\n * - Another agent space → a static empty result, so the widget's own data passes through `mergeSection` unmixed.\n *\n * Pass the result of the active-fallback hook in directly:\n * useConversationWidgetAgentSpaceFallback(agentSpaceKeyAttribute, useSomeActiveHydration())\n * The hook order is the same on every render.\n */\nexport const useConversationWidgetAgentSpaceFallback = <T>(\n agentSpaceKeyAttribute: string | number | undefined,\n activeFallback: SectionHydrationResult<T>,\n): {\n anotherAgentSpaceKey: number | undefined;\n isAnotherAgentSpace: boolean;\n fallback: SectionHydrationResult<T>;\n} => {\n const { anotherAgentSpaceKey, isAnotherAgentSpace } = useResolvedConversationWidgetAgentSpaceKey(agentSpaceKeyAttribute);\n return {\n anotherAgentSpaceKey,\n isAnotherAgentSpace,\n fallback: isAnotherAgentSpace ? (ANOTHER_AGENT_SPACE_EMPTY_FALLBACK as SectionHydrationResult<T>) : activeFallback,\n };\n};\n","import { useMemo } from \"react\";\nimport { useResolvedConversationWidgetAgentSpaceKey } from \"../_agent-space/use-resolved-conversation-widget-agent-space-key\";\nimport type { CanvasState } from \"./canvas-state\";\nimport { payloadHashOfInstanceId } from \"./canvas-state\";\nimport { findWidgetFenceByPayloadHash, findWidgetFencesInMarkdown } from \"./find-widget-fences-in-markdown\";\n\n/**\n * The key of the agent space the fence of the anchor message names — unresolved, exactly what the inline widget\n * receives as its prop. Undefined for a page anchor, a missing anchor message or a fence that names no agent space.\n * For a body whose inline widget resolves the key itself, so both resolve it the same way.\n */\nexport const useAnchorWidgetFenceAgentSpaceKey = (\n canvas: CanvasState,\n anchorMessageMarkdown: string | null,\n widgetName: string,\n): string | undefined =>\n useMemo(() => {\n if (canvas.anchor.kind !== \"message\" || anchorMessageMarkdown === null) return undefined;\n const payloadHash = payloadHashOfInstanceId(canvas.instanceId);\n const fence =\n payloadHash !== undefined\n ? findWidgetFenceByPayloadHash(anchorMessageMarkdown, widgetName, payloadHash)\n : findWidgetFencesInMarkdown(anchorMessageMarkdown).find((candidate) => candidate.name === widgetName);\n return fence?.agentSpaceKey;\n }, [canvas.anchor, canvas.instanceId, anchorMessageMarkdown, widgetName]);\n\n/**\n * The agent space a message-anchored canvas body works on, resolved the way its inline widget resolves it: the agent\n * space the fence names when it is ANOTHER one than the active one, else the chat's agent space (`chatAgentSpaceKey`,\n * passed by the shell), else the active one. For a page anchor: the anchor's agent space.\n *\n * A fence that names the ACTIVE agent space is dropped here in favour of the chat's agent space — the order of the\n * inline widgets that compute `anotherAgentSpaceKey ?? chatAgentSpaceKey`. A widget whose inline render lets the\n * fence win reads {@link useAnchorWidgetFenceAgentSpaceKey} instead.\n */\nexport const useAnchorWidgetAgentSpaceKey = (\n canvas: CanvasState,\n anchorMessageMarkdown: string | null,\n widgetName: string,\n chatAgentSpaceKey: number | undefined,\n): number | undefined => {\n const fenceAgentSpaceKey = useAnchorWidgetFenceAgentSpaceKey(canvas, anchorMessageMarkdown, widgetName);\n const { anotherAgentSpaceKey, activeAgentSpaceKey } = useResolvedConversationWidgetAgentSpaceKey(fenceAgentSpaceKey);\n if (canvas.anchor.kind === \"page\") return canvas.anchor.agentSpaceKey;\n return anotherAgentSpaceKey ?? chatAgentSpaceKey ?? activeAgentSpaceKey;\n};\n","/**\n * Density flag shared by snapshot widgets. Lives on the payload, but it\n * is a PRESENTATION choice the agent makes — independent of whether the widget's data\n * came from the agent's payload or from live hydration.\n */\nexport type ConversationWidgetVariant = \"compact\" | \"full\";\n\ninterface WithVariant {\n variant?: ConversationWidgetVariant;\n}\n\n/**\n * Read just the `variant` flag out of a raw widget payload string, even when the\n * rest of the payload is incomplete (so the agent can request a density with a\n * minimal `{\"variant\":\"compact\"}` and let the data hydrate).\n */\nexport const readPayloadVariant = (rawPayload: string): ConversationWidgetVariant | undefined => {\n try {\n const parsed = JSON.parse(rawPayload) as { variant?: unknown };\n if (parsed && (parsed.variant === \"compact\" || parsed.variant === \"full\")) {\n return parsed.variant;\n }\n } catch {\n // Non-JSON or empty payload — no variant to read.\n }\n return undefined;\n};\n\n/**\n * Overlay the agent's requested `variant` onto the resolved widget data. The agent's\n * payload variant always wins; when the payload omits it the resolved data's own\n * variant (or the widget default) stands.\n */\nexport const withConversationWidgetVariant = <T extends WithVariant>(\n base: T | undefined,\n rawPayload: string,\n): T | undefined => {\n if (!base) {\n return base;\n }\n const variant = readPayloadVariant(rawPayload);\n return variant ? { ...base, variant } : base;\n};\n"],"names":["v"],"mappings":";;;;;;;;;;;;;;AAaO,MAAM,cAAc,CAAI,cAA6B,aAAuD;AACjH,SAAO,gBAAgB,SAAS,QAAQ;AAC1C;AAKO,MAAM,mBAAmB,CAAI,cAA6B,aAAiD;AAChH,SAAO,iBAAiB,UAAa,SAAS;AAChD;AAQO,MAAM,qBAAqB,CAChC,cACA,kBACkB;AAClB,MAAI,CAAC,eAAe;AAClB,WAAO;AAAA,EACT;AACA,MAAI,CAAC,cAAc;AACjB,WAAO;AAAA,EACT;AAEA,QAAM,UAAsB,CAAA;AAC5B,aAAW,OAAO,OAAO,KAAK,YAAY,GAAqB;AAC7D,UAAMA,KAAI,aAAa,GAAG;AAC1B,QAAIA,OAAM,QAAW;AACnB,cAAQ,GAAG,IAAIA;AAAA,IACjB;AAAA,EACF;AACA,SAAO,EAAE,GAAG,eAAe,GAAG,QAAA;AAChC;AAQO,MAAM,e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