@mgamadeus/ddd-agents 0.5.16 → 0.6.0

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.
Files changed (109) hide show
  1. package/README.md +170 -6
  2. package/boundary.json +13 -0
  3. package/dist/chat.js +148 -773
  4. package/dist/chat.js.map +1 -1
  5. package/dist/chunks/{canvas-title-slot-context-DK4sfhkl.js → ConversationMarkdown-BsCjyhj4.js} +14 -43
  6. package/dist/chunks/ConversationMarkdown-BsCjyhj4.js.map +1 -0
  7. package/dist/chunks/{ConversationMessageInputComposerWidgets-B3Zf69rD.js → ConversationMessageInputComposerWidgets-CE8LpyXY.js} +10 -37
  8. package/dist/chunks/ConversationMessageInputComposerWidgets-CE8LpyXY.js.map +1 -0
  9. package/dist/chunks/VoiceBarsIcon-BIcURsBF.js +643 -0
  10. package/dist/chunks/VoiceBarsIcon-BIcURsBF.js.map +1 -0
  11. package/dist/chunks/{WebSearchResultsConversationWidget-887v8Wen.js → WebSearchResultsConversationWidget-DXhfSikV.js} +2 -2
  12. package/dist/chunks/{WebSearchResultsConversationWidget-887v8Wen.js.map → WebSearchResultsConversationWidget-DXhfSikV.js.map} +1 -1
  13. package/dist/chunks/browser-request-interception-BnzFbH0m.js +335 -0
  14. package/dist/chunks/browser-request-interception-BnzFbH0m.js.map +1 -0
  15. package/dist/chunks/{canvas-reducers-CwFA3rQ6.js → canvas-reducers-D-YxAR4B.js} +2 -2
  16. package/dist/chunks/{canvas-reducers-CwFA3rQ6.js.map → canvas-reducers-D-YxAR4B.js.map} +1 -1
  17. package/dist/chunks/canvas-title-slot-context-D6UXrkdJ.js +36 -0
  18. package/dist/chunks/canvas-title-slot-context-D6UXrkdJ.js.map +1 -0
  19. package/dist/chunks/{canvasBodies-C7qqThc9.js → canvasBodies-CQEBkIVw.js} +4 -4
  20. package/dist/chunks/{canvasBodies-C7qqThc9.js.map → canvasBodies-CQEBkIVw.js.map} +1 -1
  21. package/dist/chunks/{canvasStorage-i2wKVSBf.js → canvasStorage-BbEI3h-8.js} +2 -2
  22. package/dist/chunks/{canvasStorage-i2wKVSBf.js.map → canvasStorage-BbEI3h-8.js.map} +1 -1
  23. package/dist/chunks/format-agent-voice-call-duration-C-3hRc9p.js +10 -0
  24. package/dist/chunks/format-agent-voice-call-duration-C-3hRc9p.js.map +1 -0
  25. package/dist/chunks/{link-navigation-CNX8Am2L.js → link-navigation-BUcy5qWW.js} +2 -2
  26. package/dist/chunks/{link-navigation-CNX8Am2L.js.map → link-navigation-BUcy5qWW.js.map} +1 -1
  27. package/dist/chunks/{realtime-arrival-BTLE3jjt.js → realtime-arrival-BfsAPwqQ.js} +8 -3
  28. package/dist/chunks/realtime-arrival-BfsAPwqQ.js.map +1 -0
  29. package/dist/chunks/use-agents-chat-store-CuIkCz9v.js +34 -0
  30. package/dist/chunks/use-agents-chat-store-CuIkCz9v.js.map +1 -0
  31. package/dist/chunks/{widget-name-resolver-BVEuAsW5.js → widget-name-resolver-B9k-s_cF.js} +3 -3
  32. package/dist/chunks/{widget-name-resolver-BVEuAsW5.js.map → widget-name-resolver-B9k-s_cF.js.map} +1 -1
  33. package/dist/chunks/withPollingChangeSubscription-CnQnubfK.js.map +1 -1
  34. package/dist/client-testing.js +4 -4
  35. package/dist/client.js +14 -3
  36. package/dist/client.js.map +1 -1
  37. package/dist/files/i18n-keys.json +1128 -100
  38. package/dist/image-render.js +65 -38
  39. package/dist/image-render.js.map +1 -1
  40. package/dist/index.js +6 -6
  41. package/dist/kit.js +2 -2
  42. package/dist/preview.js +23 -26
  43. package/dist/preview.js.map +1 -1
  44. package/dist/provider.js +1 -1
  45. package/dist/renderer.js +25 -24
  46. package/dist/renderer.js.map +1 -1
  47. package/dist/styles.css +531 -93
  48. package/dist/types/client/AgentsConversationClient.d.ts +4 -1
  49. package/dist/types/client/http/createAgentsHttpConversationClient.d.ts +2 -1
  50. package/dist/types/entries/voice-admin.d.ts +7 -0
  51. package/dist/types/entries/voice.d.ts +24 -0
  52. package/dist/types/image-render/frozen-widget-requests.d.ts +11 -2
  53. package/dist/types/image-render/widget-image-google-map.d.ts +5 -0
  54. package/dist/types/image-render/widget-image-static-assets.d.ts +2 -0
  55. package/dist/types/preview/widget-preview-requests.d.ts +6 -5
  56. package/dist/types/request-interception/browser-request-interception.d.ts +48 -0
  57. package/dist/types/request-interception/intercepted-xml-http-request-upload.d.ts +15 -0
  58. package/dist/types/ui/account-realtime.d.ts +50 -11
  59. package/dist/types/voice/AgentVoiceCallBand/AgentVoiceCallBand.d.ts +49 -0
  60. package/dist/types/voice/AgentVoiceCallBand/agent-voice-call-outcome-title-text-key.d.ts +8 -0
  61. package/dist/types/voice/AgentVoiceCallCaptions/AgentVoiceCallCaptions.d.ts +15 -0
  62. package/dist/types/voice/AgentVoiceCallCaptions/saved-messages-of-agent-voice-chat.d.ts +12 -0
  63. package/dist/types/voice/AgentVoiceCallProvider/AgentVoiceCallProvider.d.ts +21 -0
  64. package/dist/types/voice/AgentVoiceCallProvider/agent-voice-call-context.d.ts +17 -0
  65. package/dist/types/voice/AgentVoiceChatStartButton/AgentVoiceChatStartButton.d.ts +15 -0
  66. package/dist/types/voice/AgentVoiceIcons/AgentVoiceIcons.d.ts +10 -0
  67. package/dist/types/voice/AgentVoiceIncomingCall/AgentVoiceIncomingCall.d.ts +28 -0
  68. package/dist/types/voice/AgentVoiceInputGlow/AgentVoiceInputGlow.d.ts +11 -0
  69. package/dist/types/voice/AgentVoiceInputGlow/agent-voice-input-glow-voice.d.ts +8 -0
  70. package/dist/types/voice/admin/AgentVoiceCallConversationLink/AgentVoiceCallConversationLink.d.ts +10 -0
  71. package/dist/types/voice/admin/AgentVoiceCallDetailScreen/AgentVoiceCallDetailScreen.d.ts +27 -0
  72. package/dist/types/voice/admin/AgentVoiceCallStateBadges/AgentVoiceCallStateBadges.d.ts +12 -0
  73. package/dist/types/voice/admin/AgentVoiceCallsScreen/AgentVoiceCallsScreen.d.ts +33 -0
  74. package/dist/types/voice/admin/agent-voice-admin-api.d.ts +59 -0
  75. package/dist/types/voice/admin/agent-voice-admin-format.d.ts +38 -0
  76. package/dist/types/voice/admin/agent-voice-admin-types.d.ts +110 -0
  77. package/dist/types/voice/agent-voice-api.d.ts +114 -0
  78. package/dist/types/voice/call/agent-voice-call-elapsed-seconds.d.ts +6 -0
  79. package/dist/types/voice/call/agent-voice-call-end-reasons.d.ts +3 -0
  80. package/dist/types/voice/call/agent-voice-call-store.d.ts +111 -0
  81. package/dist/types/voice/call/agent-voice-call-turn.d.ts +4 -0
  82. package/dist/types/voice/call/build-unsaved-agent-voice-call-lines.d.ts +14 -0
  83. package/dist/types/voice/call/format-agent-voice-call-duration.d.ts +2 -0
  84. package/dist/types/voice/call/use-agent-voice-call-elapsed-seconds.d.ts +3 -0
  85. package/dist/types/voice/call/use-agent-voice-call-server-end.d.ts +15 -0
  86. package/dist/types/voice/call/use-agent-voice-call.d.ts +12 -0
  87. package/dist/types/voice/call/use-follow-agent-voice-call-conversation.d.ts +9 -0
  88. package/dist/types/voice/ring/agent-voice-caller-label.d.ts +21 -0
  89. package/dist/types/voice/ring/agent-voice-incoming-ring-list.d.ts +10 -0
  90. package/dist/types/voice/ring/agent-voice-incoming-ring-store.d.ts +47 -0
  91. package/dist/types/voice/ring/agent-voice-ring-source.d.ts +75 -0
  92. package/dist/types/voice/ring/agent-voice-ring.d.ts +35 -0
  93. package/dist/types/voice/ring/answer-incoming-agent-voice-call.d.ts +13 -0
  94. package/dist/types/voice/ring/use-agent-voice-incoming-rings.d.ts +14 -0
  95. package/dist/types/voice/ring/use-agent-voice-ring-tone.d.ts +6 -0
  96. package/dist/ui.js +82 -19
  97. package/dist/ui.js.map +1 -1
  98. package/dist/voice-admin.js +738 -0
  99. package/dist/voice-admin.js.map +1 -0
  100. package/dist/voice.js +1586 -0
  101. package/dist/voice.js.map +1 -0
  102. package/dist/widgets.js +4 -4
  103. package/package.json +23 -4
  104. package/public-api.json +156 -0
  105. package/dist/chunks/ConversationMessageInputComposerWidgets-B3Zf69rD.js.map +0 -1
  106. package/dist/chunks/canvas-title-slot-context-DK4sfhkl.js.map +0 -1
  107. package/dist/chunks/realtime-arrival-BTLE3jjt.js.map +0 -1
  108. package/dist/chunks/widget-image-readiness-signal-C58JkCQA.js +0 -25
  109. package/dist/chunks/widget-image-readiness-signal-C58JkCQA.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"preview.js","sources":["../src/preview/preview-stub-components.tsx","../src/renderer/_agent-space/declared-agent-space-key-field-name.ts","../src/preview/widget-preview-fixtures.ts","../src/preview/WidgetPreviewHost.tsx","../src/preview/widget-preview-signal.ts","../src/preview/widget-preview-readiness.ts","../src/preview/widget-preview-requests.ts","../src/preview/widget-preview-hydration.ts","../src/widgets/EntityMentionConversationWidget/stories/EntityMentionAskFlowStory.tsx"],"sourcesContent":["import { Text } from \"../provider/components\";\nimport type {\n ComposedViewComponentDefinition,\n ComposedViewComponentProps,\n} from \"../kit/composed-view-component-types\";\nimport {\n buildComposedViewComponentRegistry,\n composedViewComponents,\n} from \"../kit/composed-view-components\";\nimport { WidgetSurface } from \"../widgets/_shared/modern\";\nimport styles from \"./WidgetPreview.module.scss\";\n\n/**\n * Stand-ins for kit node types that have a schema but no component yet — only the preview uses\n * them, and only for a fixture that asks (`stubComposedViewComponents`). A real component always wins.\n */\nconst formatDuration = (durationSeconds: unknown): string | null => {\n if (typeof durationSeconds !== \"number\" || !Number.isFinite(durationSeconds) || durationSeconds < 0) return null;\n const minutes = Math.floor(durationSeconds / 60);\n const seconds = Math.floor(durationSeconds % 60);\n return `${minutes}:${String(seconds).padStart(2, \"0\")}`;\n};\n\nconst StubVideo = ({ props }: ComposedViewComponentProps) => {\n const duration = formatDuration(props.durationSeconds);\n return (\n <WidgetSurface level=\"flat\" compact>\n <div className={styles.stubVideo}>\n {typeof props.thumbnail === \"string\" ? (\n <img className={styles.stubVideoThumbnail} src={props.thumbnail} alt=\"\" />\n ) : null}\n <div className={styles.stubVideoText}>\n <Text role=\"body\" weight=\"bold\" translate={false}>\n {typeof props.title === \"string\" ? props.title : \"\"}\n </Text>\n <Text role=\"caption\" color=\"var(--agents-fg-light)\" translate={false}>\n {[typeof props.channel === \"string\" ? props.channel : null, duration].filter(Boolean).join(\" · \")}\n </Text>\n </div>\n </div>\n </WidgetSurface>\n );\n};\n\nconst PREVIEW_STUB_COMPONENTS: ComposedViewComponentDefinition[] = [{ nodeType: \"Video\", component: StubVideo }];\n\n/** The folder registry with a stub for every node type that has no component of its own. */\nexport const buildPreviewComposedViewComponents = () =>\n buildComposedViewComponentRegistry([\n ...Object.values(composedViewComponents),\n ...PREVIEW_STUB_COMPONENTS.filter(\n (stub) => !Object.prototype.hasOwnProperty.call(composedViewComponents, stub.nodeType),\n ),\n ]);\n","import {\n DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME,\n getWidgetSelfHydrationKeyFieldName,\n} from \"../../provider/environment\";\n\nconst DEFAULT_FIELD_NAME_PATTERN = new RegExp(`\\\\b${DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME}\\\\b`, \"g\");\n\n/**\n * A fixture of the package as the app reads it. The package's fixtures name the key of a block's agent space with the\n * package default field (`agentSpaceId`): as a key of an object, as a field in a block's JSON, as an attribute of a\n * block's markdown. An app that declares another field name (`AgentsEnvironment.widgetSelfHydrationKeyFieldName`)\n * reads every occurrence under its own name, so a fixture is mapped once, when it is loaded. Without a declaration\n * the fixture is returned as it is.\n */\nexport const mapFixtureToDeclaredAgentSpaceKeyFieldName = <Fixture>(fixture: Fixture): Fixture => {\n const declaredFieldName = getWidgetSelfHydrationKeyFieldName();\n if (declaredFieldName === DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME || fixture === undefined) return fixture;\n return JSON.parse(JSON.stringify(fixture).replace(DEFAULT_FIELD_NAME_PATTERN, declaredFieldName)) as Fixture;\n};\n","import { mapFixtureToDeclaredAgentSpaceKeyFieldName } from \"../renderer/_agent-space/declared-agent-space-key-field-name\";\nimport type { WidgetPreviewFixture, WidgetPreviewFixtureFile } from \"./widget-preview.types\";\n\n/**\n * Every `*.preview-fixtures.json` below the package's `widgets/` and `kit/`, by wire name — read by folder glob, so the\n * fixtures of a widget are added as one new file next to it; an app adds the fixtures of its widgets with\n * `registerWidgetPreviewFixtureFiles`. Imports nothing from the app, so the preview entry can read it before the\n * request transport is installed.\n */\nconst fixtureModules = import.meta.glob<WidgetPreviewFixtureFile>(\n [\"../widgets/**/*.preview-fixtures.json\", \"../kit/**/*.preview-fixtures.json\"],\n {\n eager: true,\n import: \"default\",\n },\n);\n\nconst sortByWireName = (fixtureFiles: WidgetPreviewFixtureFile[]): WidgetPreviewFixtureFile[] =>\n fixtureFiles.sort((first, second) => first.wireName.localeCompare(second.wireName));\n\n/** Every fixture file, sorted by wire name; filled in place by `registerWidgetPreviewFixtureFiles`. */\nexport const widgetPreviewFixtureFiles: WidgetPreviewFixtureFile[] = sortByWireName(Object.values(fixtureModules));\n\n/** Adds an app's fixture files (its glob stays in its code). Runs before the preview reads a fixture. */\nexport const registerWidgetPreviewFixtureFiles = (fixtureFiles: readonly WidgetPreviewFixtureFile[]): void => {\n widgetPreviewFixtureFiles.push(...fixtureFiles);\n sortByWireName(widgetPreviewFixtureFiles);\n};\n\n/**\n * The fixtures of a widget from EVERY file naming it — a `ComposedView` component can add its own file next to it\n * instead of editing the widget's — or an empty list. A fixture an app registers under the name of a package fixture\n * of the same widget replaces it in place (an app's copy with its own entity types and endpoints). Each is read under\n * the agent space key field the app declares (`mapFixtureToDeclaredAgentSpaceKeyFieldName`; the package's files name\n * `agentSpaceId`), at call time: an app installs its environment after this module is loaded.\n */\nexport const findWidgetPreviewFixtures = (widgetName: string): readonly WidgetPreviewFixture[] => {\n const fixturesByName = new Map<string, WidgetPreviewFixture>();\n for (const fixtureFile of widgetPreviewFixtureFiles) {\n if (fixtureFile.wireName !== widgetName) continue;\n for (const fixture of fixtureFile.fixtures) fixturesByName.set(fixture.name, fixture);\n }\n return [...fixturesByName.values()].map(mapFixtureToDeclaredAgentSpaceKeyFieldName);\n};\n\n/** One named fixture, or undefined. */\nexport const findWidgetPreviewFixture = (widgetName: string, fixtureName: string): WidgetPreviewFixture | undefined =>\n findWidgetPreviewFixtures(widgetName).find((fixture) => fixture.name === fixtureName);\n\n/** The fence the fixture stands for — what a canvas body re-reads as its anchor message. */\nexport const buildWidgetPreviewFence = (widgetName: string, fixture: WidgetPreviewFixture): string =>\n \"```widget\\n\" + JSON.stringify({ type: widgetName, ...fixture.payload }) + \"\\n```\";\n","import { Text } from \"../provider/components\";\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { conversationWidgetRegistry } from \"../renderer/conversationWidgetRegistry\";\nimport { resolveWidgetName } from \"../renderer/widget-name-resolver\";\nimport {\n buildWidgetAgentSpaceKeyProps,\n readWidgetAgentSpaceKeyAttribute,\n} from \"../renderer/_agent-space/widget-agent-space-key-attribute\";\nimport {\n CanvasOpenRequestFromOpener,\n ConversationWidgetCallbacks,\n StandaloneConversationWidgetProvider,\n} from \"../renderer/ConversationWidgetContext\";\nimport { ConversationWidgetRenderContext } from \"../renderer/ConversationWidgetRenderContext\";\nimport { ConversationWidgetErrorBoundary } from \"../renderer/ConversationWidgetErrorBoundary\";\nimport {\n WidgetRenderReporter,\n WidgetRenderReportContext,\n} from \"../renderer/render-report/widget-render-report\";\nimport type { CanvasState } from \"../renderer/canvas/canvas-state\";\nimport { canvasBodies } from \"../renderer/canvas/canvasBodies\";\nimport { canvasBehaviourOf } from \"../renderer/canvas/canvas-behaviours\";\nimport { decideCanvasOpen } from \"../renderer/canvas/decide-canvas-open\";\nimport { CANVAS_VIABLE_MIN_WIDTH } from \"../widgets/CanvasLauncherWidget/use-canvas-viable\";\nimport { WidgetImageRenderContext } from \"../image-render/WidgetImageRenderContext\";\nimport { ComposedViewComponentsContext } from \"../kit/composed-view-components\";\nimport { buildPreviewComposedViewComponents } from \"./preview-stub-components\";\nimport { buildWidgetPreviewFence } from \"./widget-preview-fixtures\";\nimport type { WidgetPreviewReadiness } from \"./widget-preview-readiness\";\nimport type { WidgetPreviewBootstrap, WidgetPreviewFixture } from \"./widget-preview.types\";\nimport styles from \"./WidgetPreview.module.scss\";\n\n/**\n * The widget preview host: ONE widget from ONE fixture, outside the chat, in the mode the script\n * asks for. Unlike the e-mail capture host it keeps a working canvas pane (an `openCanvas` request mounts the canvas\n * body beside the widget, its anchor message being the fixture's fence) and a composer log (what the widget sent,\n * prefilled or signalled), so the interactions of the ChatGPT reference can be driven and checked. The app mounts it in\n * its store (the capture's store state); every request is served from the fixture (`widget-preview-requests.ts`). The fixture's\n * `hydration` is the capture's frozen hydration only in `email` mode; `interactive` and `replay` serve it through the\n * preview's hydrators (`widget-preview-hydration.ts`), so the widget runs as in the chat (a canvas auto-opens).\n */\n\n/** The key of the agent space a fixture without its own renders for. */\nexport const PREVIEW_AGENT_SPACE_KEY = 1;\nconst PREVIEW_MESSAGE_ID = 1;\n\ninterface ComposerLogEntry {\n kind: \"message\" | \"prefill\" | \"signal\";\n text: string;\n}\n\nexport interface WidgetPreviewProps {\n bootstrap: WidgetPreviewBootstrap;\n fixture: WidgetPreviewFixture;\n readiness: WidgetPreviewReadiness;\n hasHydrationError: () => boolean;\n}\n\nexport const WidgetPreview = (props: WidgetPreviewProps) => {\n const { bootstrap, fixture, readiness, hasHydrationError } = props;\n const widgetRef = useRef<HTMLDivElement>(null);\n const widgetName = resolveWidgetName(bootstrap.widgetName);\n const entry = conversationWidgetRegistry.widgets.find((widget) => widget.name === widgetName);\n const [canvas, setCanvas] = useState<CanvasState | null>(null);\n const [composerLog, setComposerLog] = useState<ComposerLogEntry[]>([]);\n const agentSpaceKey = Number(readWidgetAgentSpaceKeyAttribute(fixture) ?? PREVIEW_AGENT_SPACE_KEY);\n const fence = useMemo(\n () => buildWidgetPreviewFence(widgetName ?? bootstrap.widgetName, fixture),\n [widgetName, bootstrap.widgetName, fixture],\n );\n const isEmail = bootstrap.mode === \"email\";\n const isInteractive = bootstrap.mode === \"interactive\";\n // The capture context switches every widget to its static e-mail branch (no canvas, no auto-open): e-mail mode only.\n const frozenHydration =\n isEmail && fixture.hydration && Object.keys(fixture.hydration).length > 0 ? fixture.hydration : null;\n\n useEffect(() => {\n if (!entry) readiness.fail(\"UNKNOWN_WIDGET\");\n // The whole page document: the canvas pane and a modal (the lightbox renders into the modal root) settle too.\n else if (widgetRef.current) return readiness.observe(document.body, widgetRef.current, hasHydrationError);\n }, [entry, readiness, hasHydrationError]);\n // The block's render report reaches the readiness as in the chat it reaches the collector.\n const renderReporter = useMemo<WidgetRenderReporter>(() => ({ report: readiness.recordRenderReport }), [readiness]);\n\n const appendComposerLog = useCallback(\n (kind: ComposerLogEntry[\"kind\"], text: string) => setComposerLog((entries) => [...entries, { kind, text }]),\n [],\n );\n // The chat's opening rule decides, as in the conversation slice: a live delivery on a narrow window does not take\n // over for a canvas without an overlay, so the narrow shot shows the inline rows and the \"Open in canvas\" card.\n const openCanvas = useCallback((request: CanvasOpenRequestFromOpener) => {\n setCanvas((current) => {\n const decision = decideCanvasOpen(canvasBehaviourOf(request.canvasId), current, null, {\n ...request,\n viewportViable: window.innerWidth >= CANVAS_VIABLE_MIN_WIDTH,\n hostHasCanvasSurface: true,\n });\n if (decision.kind === \"ignore\") return current;\n return {\n canvasId: request.canvasId,\n instanceId: request.instanceId,\n anchor: request.anchor,\n origin: request.origin,\n mountGeneration: (current?.mountGeneration ?? 0) + 1,\n };\n });\n }, []);\n const callbacks = useMemo<Partial<ConversationWidgetCallbacks>>(\n () => ({\n canvas,\n hostHasCanvasSurface: !isEmail,\n openCanvas: isEmail ? () => {} : openCanvas,\n closeCanvas: () => setCanvas(null),\n chatAgentSpaceKey: agentSpaceKey,\n messages: [],\n sendMessageToChat: (text: string) => appendComposerLog(\"message\", text),\n prefillComposer: (text: string) => appendComposerLog(\"prefill\", text),\n injectSignal: (text: string) => {\n appendComposerLog(\"signal\", text);\n return Promise.resolve(true);\n },\n }),\n [canvas, isEmail, openCanvas, agentSpaceKey, appendComposerLog],\n );\n\n if (!entry) return null;\n const WidgetComponent = entry.component;\n const CanvasBody = canvas ? canvasBodies[canvas.canvasId] : null;\n const widget = (\n <ConversationWidgetErrorBoundary widgetName={entry.name} onCrash={readiness.recordWidgetCrash}>\n <WidgetRenderReportContext.Provider value={renderReporter}>\n <WidgetComponent\n payload={JSON.stringify(fixture.payload)}\n {...buildWidgetAgentSpaceKeyProps(String(agentSpaceKey))}\n interactive={isInteractive}\n fresh={isInteractive}\n justDelivered={isInteractive}\n messageId={String(PREVIEW_MESSAGE_ID)}\n openedByPage={false}\n />\n </WidgetRenderReportContext.Provider>\n </ConversationWidgetErrorBoundary>\n );\n return (\n <StandaloneConversationWidgetProvider callbacks={callbacks}>\n <ConversationWidgetRenderContext.Provider value={isEmail ? \"email\" : \"conversation\"}>\n <WidgetImageRenderContext.Provider value={frozenHydration}>\n <div className={styles.page} data-testid=\"widget-preview-page\">\n <div className={styles.chatColumn} data-testid=\"widget-preview-frame\">\n <div\n ref={widgetRef}\n className={styles.widget}\n data-testid=\"widget-preview-widget\"\n inert={isEmail || undefined}\n >\n {fixture.stubComposedViewComponents ? (\n <ComposedViewComponentsContext.Provider value={buildPreviewComposedViewComponents()}>\n {widget}\n </ComposedViewComponentsContext.Provider>\n ) : (\n widget\n )}\n </div>\n {composerLog.length > 0 ? (\n <div className={styles.composerLog} data-testid=\"widget-preview-composer-log\">\n {composerLog.map((composerEntry, entryIndex) => (\n <Text\n key={entryIndex}\n role=\"caption\"\n translate={false}\n className={styles.composerEntry}\n >\n {`${composerEntry.kind}: ${composerEntry.text}`}\n </Text>\n ))}\n </div>\n ) : null}\n </div>\n {canvas && CanvasBody ? (\n <div className={styles.canvasPane} data-testid=\"widget-preview-canvas\" data-canvas-id={canvas.canvasId}>\n <CanvasBody\n key={`${canvas.instanceId}#${canvas.mountGeneration}`}\n canvas={canvas}\n agentSpaceKey={agentSpaceKey}\n anchorMessageMarkdown={fence}\n />\n </div>\n ) : null}\n </div>\n </WidgetImageRenderContext.Provider>\n </ConversationWidgetRenderContext.Provider>\n </StandaloneConversationWidgetProvider>\n );\n};\n","import { getSandboxLegacyAliases } from \"../provider/environment\";\nimport type { WidgetPreviewSignal } from \"./widget-preview.types\";\n\n/** The `window` property a preview script waits on. */\nexport const WIDGET_PREVIEW_SIGNAL_GLOBAL_NAME = \"__AGENTS_WIDGET_PREVIEW_V1__\";\n\ntype WindowSignals = Record<string, WidgetPreviewSignal | undefined>;\n\n/**\n * Every name the preview signal is published under: the package's own, then each name the app declares\n * (`AgentsEnvironment.sandboxLegacyAliases.previewReadinessGlobalNames`), read at each publish.\n */\nexport const readWidgetPreviewSignalGlobalNames = (): string[] => [\n WIDGET_PREVIEW_SIGNAL_GLOBAL_NAME,\n ...(getSandboxLegacyAliases().previewReadinessGlobalNames ?? []).filter(\n (aliasName) => aliasName !== WIDGET_PREVIEW_SIGNAL_GLOBAL_NAME,\n ),\n];\n\n/** Publishes (or with `undefined` clears) the preview signal under every name. */\nexport const publishWidgetPreviewSignal = (signal: WidgetPreviewSignal | undefined): void => {\n const windowSignals = window as unknown as WindowSignals;\n for (const globalName of readWidgetPreviewSignalGlobalNames()) windowSignals[globalName] = signal;\n};\n","import { publishWidgetImageReadiness } from \"../image-render/widget-image-readiness-signal\";\nimport type { WidgetRenderReportEntry } from \"../renderer/render-report/widget-render-report\";\nimport { publishWidgetPreviewSignal } from \"./widget-preview-signal\";\nimport type { WidgetPreviewExpectedState, WidgetPreviewSignal } from \"./widget-preview.types\";\n\n/** A loading placeholder: the component library's `Skeleton` (its test id; its class is a hashed module name) and the kit's own. */\nconst SKELETON_SELECTOR = '[data-testid=\"Skeleton\"], [class*=\"Skeleton\"], [class*=\"skeleton\"]';\nconst LOADING_SELECTOR = `[aria-busy=\"true\"], [role=\"progressbar\"]:not([aria-valuenow]), ${SKELETON_SELECTOR}`;\n/** The DOM must stay unchanged this long before the preview counts as settled. */\nconst SETTLE_MS = 400;\n\n/**\n * Whether a loading marker is actually rendered: the component library's `ImgWithLoader` keeps its Skeleton in the DOM inside a\n * `display: none` wrapper once the image has loaded, so a marker under a hidden ancestor is no loading state. Without\n * a layout engine (jsdom: no client rects for any element) every marker counts as before.\n */\nconst hasRenderedLoadingMarker = (element: HTMLElement): boolean => {\n const markers = Array.from(element.querySelectorAll(LOADING_SELECTOR));\n if (markers.length === 0) return false;\n const hasLayout = element.getClientRects().length > 0;\n return !hasLayout || markers.some((marker) => marker.getClientRects().length > 0);\n};\n\n/**\n * The state an element shows — the same loading markers the e-mail capture refuses to shoot. `hasError` is true when\n * the widget is known to be in an error: a failed hydration, a crash caught by the error boundary, or a request the\n * fixture failed on purpose — a widget that renders nothing on an error would otherwise read as `empty`.\n * `renderReport` is the block's own render report when the widget sent one: `failed` reads as `error`,\n * `pending` as `loading` and `empty` as `empty` — a widget that shows one muted line (\"No data to show.\") for its empty\n * state is empty, whatever text the line holds.\n */\nexport const observeWidgetPreviewState = (\n element: HTMLElement,\n hasError: boolean,\n renderReport?: WidgetRenderReportEntry,\n): WidgetPreviewExpectedState => {\n if (hasError || renderReport?.status === \"failed\") return \"error\";\n if (renderReport?.status === \"pending\") return \"loading\";\n if (hasRenderedLoadingMarker(element)) return \"loading\";\n if (renderReport?.status === \"empty\") return \"empty\";\n if (!element.textContent?.trim() && !element.querySelector(\"img,svg,canvas,iframe\")) return \"empty\";\n return \"data\";\n};\n\n/**\n * A mutation the settle ignores: a style or attribute change inside a loading placeholder — the component library's `Skeleton`\n * animates its shimmer by rewriting its style every frame, so a loading fixture would never be still otherwise.\n */\nconst isSkeletonAnimation = (mutation: MutationRecord): boolean => {\n if (mutation.type !== \"attributes\") return false;\n const target = mutation.target;\n return target instanceof Element && target.closest(SKELETON_SELECTOR) !== null;\n};\n\n/**\n * The preview's ready signal: after every change it waits until the DOM is still for `SETTLE_MS`, then publishes what\n * it shows — `window.__AGENTS_WIDGET_PREVIEW_V1__` (observed against the fixture's expected state, with every request\n * the fixture had no response for) and the e-mail capture's `window.__AGENTS_WIDGET_IMAGE_V1__` (`ready` when the\n * expected state was reached), so the same script conventions work for both. Both are also published under the names\n * the app declares (`AgentsEnvironment.sandboxLegacyAliases`).\n */\nexport const createWidgetPreviewReadiness = (expectedState: WidgetPreviewExpectedState) => {\n const missingResponses: string[] = [];\n const failedRequests: string[] = [];\n let widgetCrashed = false;\n let renderReport: WidgetRenderReportEntry | undefined;\n let scheduleSettleAgain: () => void = () => {};\n let revision = 0;\n const publish = (\n signal: Omit<\n WidgetPreviewSignal,\n \"version\" | \"missingResponses\" | \"failedRequests\" | \"widgetCrashed\" | \"expectedState\"\n >,\n ) => {\n publishWidgetPreviewSignal({\n version: 1,\n expectedState,\n missingResponses: [...missingResponses],\n failedRequests: [...failedRequests],\n widgetCrashed,\n ...(renderReport ? { renderReport } : {}),\n ...signal,\n });\n document.documentElement.dataset.widgetPreviewState = signal.state;\n };\n publish({ state: \"loading\", revision });\n\n const fail = (errorCode: string) => {\n publish({ state: \"failed\", revision, error_code: errorCode });\n publishWidgetImageReadiness({ version: 1, state: \"failed\", error_code: errorCode });\n };\n\n const recordMissingResponse = (requestKey: string) => {\n if (!missingResponses.includes(requestKey)) missingResponses.push(requestKey);\n };\n\n /** A request (or a preview hydration) the fixture answered with a failing `__status`. */\n const recordFailedRequest = (requestKey: string) => {\n if (!failedRequests.includes(requestKey)) failedRequests.push(requestKey);\n };\n\n /** The error boundary caught the widget (`ConversationWidgetErrorBoundary` `onCrash`). */\n const recordWidgetCrash = () => {\n widgetCrashed = true;\n };\n\n /** The block's render report (`WidgetRenderReportContext` of the host); a new status settles again. */\n const recordRenderReport = (entry: WidgetRenderReportEntry) => {\n renderReport = entry;\n scheduleSettleAgain();\n };\n\n const settle = (element: HTMLElement, hasHydrationError: () => boolean) => {\n const hasError = hasHydrationError() || widgetCrashed || failedRequests.length > 0;\n const observedState = observeWidgetPreviewState(element, hasError, renderReport);\n const { x, y, width, height } = element.getBoundingClientRect();\n const rect = { x, y, width, height };\n revision += 1;\n const expectedStateReached = observedState === expectedState;\n publish({ state: \"settled\", revision, observedState, expectedStateReached, rect });\n publishWidgetImageReadiness(\n expectedStateReached\n ? { version: 1, state: \"ready\", rect }\n : {\n version: 1,\n state: \"failed\",\n error_code: `EXPECTED_${expectedState.toUpperCase()}_SAW_${observedState.toUpperCase()}`,\n rect,\n },\n );\n };\n\n /**\n * Watches `watchedElement` (the whole preview document, so an interaction that changes only the canvas pane or opens\n * a modal settles too)\n * and classifies `widgetElement` (the widget alone, the screenshot); returns the disposer.\n */\n const observe = (watchedElement: HTMLElement, widgetElement: HTMLElement, hasHydrationError: () => boolean) => {\n let settleTimer: ReturnType<typeof setTimeout> | null = null;\n const scheduleSettle = () => {\n if (settleTimer !== null) clearTimeout(settleTimer);\n settleTimer = setTimeout(() => settle(widgetElement, hasHydrationError), SETTLE_MS);\n };\n const mutationObserver = new MutationObserver((mutations) => {\n if (mutations.some((mutation) => !isSkeletonAnimation(mutation))) scheduleSettle();\n });\n mutationObserver.observe(watchedElement, {\n subtree: true,\n childList: true,\n attributes: true,\n characterData: true,\n });\n scheduleSettleAgain = scheduleSettle;\n scheduleSettle();\n return () => {\n mutationObserver.disconnect();\n scheduleSettleAgain = () => {};\n if (settleTimer !== null) clearTimeout(settleTimer);\n };\n };\n\n return { observe, fail, recordMissingResponse, recordFailedRequest, recordWidgetCrash, recordRenderReport };\n};\n\nexport type WidgetPreviewReadiness = ReturnType<typeof createWidgetPreviewReadiness>;\n","import axios, { AxiosRequestConfig } from \"axios\";\nimport type { WidgetPreviewResponse } from \"./widget-preview.types\";\n\n/** The key a fixture response is stored under: method, path and the sorted query (`GET /api/example/…?a=1&b=2`). */\nexport const widgetPreviewRequestKey = (method: string, url: URL): string => {\n const sortedUrl = new URL(url.toString());\n sortedUrl.searchParams.sort();\n return `${method.toUpperCase()} ${sortedUrl.pathname}${sortedUrl.search}`;\n};\n\n/** The app's own error log: answered empty and never reported — a fixture's error state must not count as a gap. */\nconst SILENTLY_ANSWERED_PATHS = [\"/rest_api/v1/log\"];\nconst isSilentlyAnswered = (url: URL): boolean => SILENTLY_ANSWERED_PATHS.includes(url.pathname);\n\nexport const isStatusResponse = (response: unknown): response is { __status: number; __body?: unknown } =>\n typeof response === \"object\" &&\n response !== null &&\n typeof (response as { __status?: unknown }).__status === \"number\";\nexport const isPendingResponse = (response: unknown): boolean =>\n typeof response === \"object\" && response !== null && (response as { __pending?: unknown }).__pending === true;\n\n/**\n * Serves every request of the preview — axios and `fetch` — from the fixture: a known request gets its body (a copy), a\n * `__status` entry fails with that status (a status of 400 or more is reported as a failed request — the error state the\n * fixture asked for), a `__pending` entry never answers (the loading state), and anything else — an unknown read, a\n * write the fixture does not answer — fails as a missing response and is reported. A write is answered only when the\n * fixture names it (`\"POST /api/example/…\"`, e.g. a widget's fire-and-forget measurement event). Nothing reaches a server.\n */\nexport const installWidgetPreviewRequests = (\n responses: Record<string, WidgetPreviewResponse>,\n onMissingResponse: (requestKey: string) => void,\n onFailedRequest: (requestKey: string) => void = () => {},\n): (() => void) => {\n const originalAdapter = axios.defaults.adapter;\n axios.defaults.adapter = async (config: AxiosRequestConfig) => {\n const method = (config.method ?? \"get\").toLowerCase();\n const requestUrl = new URL(axios.getUri(config), window.location.origin);\n if (isSilentlyAnswered(requestUrl)) return { data: {}, status: 200, statusText: \"OK\", config, headers: {} };\n const requestKey = widgetPreviewRequestKey(method, requestUrl);\n const response = Object.prototype.hasOwnProperty.call(responses, requestKey) ? responses[requestKey] : undefined;\n if (response === undefined) {\n onMissingResponse(requestKey);\n return Promise.reject(Object.assign(new Error(`no preview response for ${requestKey}`), { config }));\n }\n if (isPendingResponse(response)) return new Promise(() => {});\n if (isStatusResponse(response)) {\n if (response.__status >= 400) onFailedRequest(requestKey);\n return Promise.reject(\n Object.assign(new Error(`preview response ${response.__status}`), {\n config,\n response: { status: response.__status, data: response.__body ?? null, config, headers: {} },\n }),\n );\n }\n return { data: structuredClone(response), status: 200, statusText: \"OK\", config, headers: {} };\n };\n // `fetch` is answered the same way (a few modules bypass axios); a missing response is a 404, reported.\n const originalFetch = window.fetch;\n window.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {\n const method = (init?.method ?? (input instanceof Request ? input.method : \"GET\")).toLowerCase();\n const url = new URL(input instanceof Request ? input.url : String(input), window.location.origin);\n if (isSilentlyAnswered(url)) return new Response(\"{}\", { status: 200 });\n const requestKey = widgetPreviewRequestKey(method, url);\n const response = Object.prototype.hasOwnProperty.call(responses, requestKey) ? responses[requestKey] : undefined;\n if (response === undefined) {\n onMissingResponse(requestKey);\n return new Response(null, { status: 404 });\n }\n if (isPendingResponse(response)) return new Promise<Response>(() => {});\n if (isStatusResponse(response)) {\n if (response.__status >= 400) onFailedRequest(requestKey);\n return new Response(JSON.stringify(response.__body ?? null), { status: response.__status });\n }\n return new Response(JSON.stringify(response), { status: 200, headers: { \"Content-Type\": \"application/json\" } });\n };\n return () => {\n axios.defaults.adapter = originalAdapter;\n window.fetch = originalFetch;\n };\n};\n","import {\n getWidgetHydrator,\n listWidgetHydratorTypes,\n registerWidgetHydrator,\n unregisterWidgetHydrator,\n} from \"../renderer/widget-hydration/widget-hydration.registry\";\nimport type { RegisteredWidget } from \"../renderer/widget-hydration/widget-hydration.types\";\nimport { isPendingResponse, isStatusResponse } from \"./widget-preview-requests\";\nimport type { WidgetPreviewResponse } from \"./widget-preview.types\";\n\n/** The fixture's entry for one hydration: the exact derived key first, then the hydrator type (as the capture reads). */\nconst findFixtureHydration = (\n hydration: Record<string, WidgetPreviewResponse>,\n type: string,\n key: string,\n): { found: boolean; value?: WidgetPreviewResponse; hydrationKey: string } => {\n if (Object.prototype.hasOwnProperty.call(hydration, key))\n return { found: true, value: hydration[key], hydrationKey: key };\n if (Object.prototype.hasOwnProperty.call(hydration, type))\n return { found: true, value: hydration[type], hydrationKey: type };\n return { found: false, hydrationKey: key };\n};\n\n/** One fixture value as a hydrator result: a copy of the body, a failing `__status`, or a `__pending` that never ends. */\nconst answerFromFixture = (\n value: WidgetPreviewResponse,\n hydrationKey: string,\n onFailedRequest: (requestKey: string) => void,\n): Promise<unknown> => {\n if (isPendingResponse(value)) return new Promise(() => {});\n if (isStatusResponse(value)) {\n onFailedRequest(`HYDRATION ${hydrationKey}`);\n return Promise.reject(new Error(`preview hydration ${value.__status}`));\n }\n return Promise.resolve(structuredClone(value));\n};\n\n/**\n * The preview's hydration transport for the `interactive` and `replay` modes: every registered hydrator is replaced by\n * one that answers from the fixture's `hydration` (by derived key, else by type) and otherwise runs the real hydrator,\n * whose requests the request transport answers from `responses`. The widget therefore runs its live code path —\n * `useWidgetHydration` with the store's hydration slice, no frozen capture context — so a self-hydrating canvas widget\n * auto-opens its canvas like in the chat (`CanvasLauncherWidget`). The `email` mode keeps the capture's frozen hydration.\n * Returns the disposer that puts the real hydrators back.\n */\nexport const installWidgetPreviewHydration = (\n hydration: Record<string, WidgetPreviewResponse>,\n onFailedRequest: (requestKey: string) => void,\n): (() => void) => {\n const replacedHydrators = new Map<string, RegisteredWidget<unknown, unknown>>();\n for (const type of listWidgetHydratorTypes()) {\n const registered = getWidgetHydrator<unknown, unknown>(type);\n if (!registered) continue;\n replacedHydrators.set(type, registered);\n unregisterWidgetHydrator(type);\n registerWidgetHydrator<unknown, unknown>(type, {\n ...registered,\n hydrator: (payload, context) => {\n const fixtureHydration = findFixtureHydration(hydration, type, registered.deriveKey(type, payload));\n return fixtureHydration.found\n ? answerFromFixture(fixtureHydration.value, fixtureHydration.hydrationKey, onFailedRequest)\n : registered.hydrator(payload, context);\n },\n });\n }\n return () => {\n for (const [type, registered] of replacedHydrators) {\n unregisterWidgetHydrator(type);\n registerWidgetHydrator(type, registered);\n }\n };\n};\n","import { Text } from \"../../../provider/components\";\nimport { ConversationWidgetProvider } from \"../../../renderer/ConversationWidgetContext\";\nimport { ConversationMessageInputComposerWidgets } from \"../../../chat/ConversationMessageInput/ConversationMessageInputComposerWidgets/ConversationMessageInputComposerWidgets\";\nimport { EntityMentionAskButton } from \"../EntityMentionAskButton/EntityMentionAskButton\";\nimport styles from \"./EntityMentionAskFlowStory.module.scss\";\n\nconst ENTITIES = [\n { entityType: \"competitor\", entityId: \"8812\", label: \"Altes Gasthaus Leve\", agentSpaceKey: 1 },\n { entityType: \"competitor\", entityId: \"9001\", label: \"Kleiner Kiepenkerl\", agentSpaceKey: 1 },\n];\n\n/**\n * The \"Ask about this\" flow for the story and the browser check: a stand-in for the detail panel's\n * footer (the `entityDetail` shell is the canvas shell's, the bodies come from the entity types) with the real button, and the real\n * composer strip of the chat input, so a click shows the chip where the owner types.\n */\nexport const EntityMentionAskFlowStory = (props: { maxWidth?: number }) => (\n <ConversationWidgetProvider callbacks={{}}>\n <div className={styles.page} style={{ maxWidth: props.maxWidth ?? 720 }}>\n {ENTITIES.map((entity) => (\n <div key={entity.entityId} className={styles.panel}>\n <Text role=\"intro\" weight=\"bold\" translate={false}>\n {entity.label}\n </Text>\n <Text role=\"help\" color=\"var(--agents-fg-light)\" translate={false}>\n {\"detail panel body\"}\n </Text>\n <div className={styles.footer}>\n <EntityMentionAskButton {...entity} testId={`entity-mention-ask-${entity.entityId}`} />\n </div>\n </div>\n ))}\n <div className={styles.composer} data-testid=\"story-composer\">\n <ConversationMessageInputComposerWidgets testId=\"story-input\" />\n <Text role=\"help\" color=\"var(--agents-fg-lightest)\" translate={false}>\n {\"Ask anything…\"}\n </Text>\n </div>\n </div>\n </ConversationWidgetProvider>\n);\n"],"names":["styles","widget","composerLog","composerEntry"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,iBAAiB,CAAC,oBAA4C;AAClE,MAAI,OAAO,oBAAoB,YAAY,CAAC,OAAO,SAAS,eAAe,KAAK,kBAAkB,EAAG,QAAO;AAC5G,QAAM,UAAU,KAAK,MAAM,kBAAkB,EAAE;AAC/C,QAAM,UAAU,KAAK,MAAM,kBAAkB,EAAE;AAC/C,SAAO,GAAG,OAAO,IAAI,OAAO,OAAO,EAAE,SAAS,GAAG,GAAG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,sBAAsB,OAAO,QAAQ,IAAI,EAAA,CACvF;AAAA,EAAA,KATQ,OAAO,QAUjB,CACD;AAAA,uBACA,OAAA,EAAI,WAAW,OAAO,UAAU,eAAY,kBAC3C,UAAA;AAAA,IAAA,oBAAC,yCAAA,EAAwC,QAAO,cAAA,CAAc;AAAA,IAC9D,oBAAC,QAAK,MAAK,QAAO,OAAM,6BAA4B,WAAW,OAC5D,UAAA,gBAAA,CACH;AAAA,EAAA,EAAA,CACF;AAAA,EAAA,CACF,EAAA,CACF;"}
1
+ {"version":3,"file":"preview.js","sources":["../src/preview/preview-stub-components.tsx","../src/renderer/_agent-space/declared-agent-space-key-field-name.ts","../src/preview/widget-preview-fixtures.ts","../src/preview/WidgetPreviewHost.tsx","../src/preview/widget-preview-signal.ts","../src/preview/widget-preview-readiness.ts","../src/preview/widget-preview-requests.ts","../src/preview/widget-preview-hydration.ts","../src/widgets/EntityMentionConversationWidget/stories/EntityMentionAskFlowStory.tsx"],"sourcesContent":["import { Text } from \"../provider/components\";\nimport type {\n ComposedViewComponentDefinition,\n ComposedViewComponentProps,\n} from \"../kit/composed-view-component-types\";\nimport {\n buildComposedViewComponentRegistry,\n composedViewComponents,\n} from \"../kit/composed-view-components\";\nimport { WidgetSurface } from \"../widgets/_shared/modern\";\nimport styles from \"./WidgetPreview.module.scss\";\n\n/**\n * Stand-ins for kit node types that have a schema but no component yet — only the preview uses\n * them, and only for a fixture that asks (`stubComposedViewComponents`). A real component always wins.\n */\nconst formatDuration = (durationSeconds: unknown): string | null => {\n if (typeof durationSeconds !== \"number\" || !Number.isFinite(durationSeconds) || durationSeconds < 0) return null;\n const minutes = Math.floor(durationSeconds / 60);\n const seconds = Math.floor(durationSeconds % 60);\n return `${minutes}:${String(seconds).padStart(2, \"0\")}`;\n};\n\nconst StubVideo = ({ props }: ComposedViewComponentProps) => {\n const duration = formatDuration(props.durationSeconds);\n return (\n <WidgetSurface level=\"flat\" compact>\n <div className={styles.stubVideo}>\n {typeof props.thumbnail === \"string\" ? (\n <img className={styles.stubVideoThumbnail} src={props.thumbnail} alt=\"\" />\n ) : null}\n <div className={styles.stubVideoText}>\n <Text role=\"body\" weight=\"bold\" translate={false}>\n {typeof props.title === \"string\" ? props.title : \"\"}\n </Text>\n <Text role=\"caption\" color=\"var(--agents-fg-light)\" translate={false}>\n {[typeof props.channel === \"string\" ? props.channel : null, duration].filter(Boolean).join(\" · \")}\n </Text>\n </div>\n </div>\n </WidgetSurface>\n );\n};\n\nconst PREVIEW_STUB_COMPONENTS: ComposedViewComponentDefinition[] = [{ nodeType: \"Video\", component: StubVideo }];\n\n/** The folder registry with a stub for every node type that has no component of its own. */\nexport const buildPreviewComposedViewComponents = () =>\n buildComposedViewComponentRegistry([\n ...Object.values(composedViewComponents),\n ...PREVIEW_STUB_COMPONENTS.filter(\n (stub) => !Object.prototype.hasOwnProperty.call(composedViewComponents, stub.nodeType),\n ),\n ]);\n","import {\n DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME,\n getWidgetSelfHydrationKeyFieldName,\n} from \"../../provider/environment\";\n\nconst DEFAULT_FIELD_NAME_PATTERN = new RegExp(`\\\\b${DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME}\\\\b`, \"g\");\n\n/**\n * A fixture of the package as the app reads it. The package's fixtures name the key of a block's agent space with the\n * package default field (`agentSpaceId`): as a key of an object, as a field in a block's JSON, as an attribute of a\n * block's markdown. An app that declares another field name (`AgentsEnvironment.widgetSelfHydrationKeyFieldName`)\n * reads every occurrence under its own name, so a fixture is mapped once, when it is loaded. Without a declaration\n * the fixture is returned as it is.\n */\nexport const mapFixtureToDeclaredAgentSpaceKeyFieldName = <Fixture>(fixture: Fixture): Fixture => {\n const declaredFieldName = getWidgetSelfHydrationKeyFieldName();\n if (declaredFieldName === DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME || fixture === undefined) return fixture;\n return JSON.parse(JSON.stringify(fixture).replace(DEFAULT_FIELD_NAME_PATTERN, declaredFieldName)) as Fixture;\n};\n","import { mapFixtureToDeclaredAgentSpaceKeyFieldName } from \"../renderer/_agent-space/declared-agent-space-key-field-name\";\nimport type { WidgetPreviewFixture, WidgetPreviewFixtureFile } from \"./widget-preview.types\";\n\n/**\n * Every `*.preview-fixtures.json` below the package's `widgets/` and `kit/`, by wire name — read by folder glob, so the\n * fixtures of a widget are added as one new file next to it; an app adds the fixtures of its widgets with\n * `registerWidgetPreviewFixtureFiles`. Imports nothing from the app, so the preview entry can read it before the\n * request transport is installed.\n */\nconst fixtureModules = import.meta.glob<WidgetPreviewFixtureFile>(\n [\"../widgets/**/*.preview-fixtures.json\", \"../kit/**/*.preview-fixtures.json\"],\n {\n eager: true,\n import: \"default\",\n },\n);\n\nconst sortByWireName = (fixtureFiles: WidgetPreviewFixtureFile[]): WidgetPreviewFixtureFile[] =>\n fixtureFiles.sort((first, second) => first.wireName.localeCompare(second.wireName));\n\n/** Every fixture file, sorted by wire name; filled in place by `registerWidgetPreviewFixtureFiles`. */\nexport const widgetPreviewFixtureFiles: WidgetPreviewFixtureFile[] = sortByWireName(Object.values(fixtureModules));\n\n/** Adds an app's fixture files (its glob stays in its code). Runs before the preview reads a fixture. */\nexport const registerWidgetPreviewFixtureFiles = (fixtureFiles: readonly WidgetPreviewFixtureFile[]): void => {\n widgetPreviewFixtureFiles.push(...fixtureFiles);\n sortByWireName(widgetPreviewFixtureFiles);\n};\n\n/**\n * The fixtures of a widget from EVERY file naming it — a `ComposedView` component can add its own file next to it\n * instead of editing the widget's — or an empty list. A fixture an app registers under the name of a package fixture\n * of the same widget replaces it in place (an app's copy with its own entity types and endpoints). Each is read under\n * the agent space key field the app declares (`mapFixtureToDeclaredAgentSpaceKeyFieldName`; the package's files name\n * `agentSpaceId`), at call time: an app installs its environment after this module is loaded.\n */\nexport const findWidgetPreviewFixtures = (widgetName: string): readonly WidgetPreviewFixture[] => {\n const fixturesByName = new Map<string, WidgetPreviewFixture>();\n for (const fixtureFile of widgetPreviewFixtureFiles) {\n if (fixtureFile.wireName !== widgetName) continue;\n for (const fixture of fixtureFile.fixtures) fixturesByName.set(fixture.name, fixture);\n }\n return [...fixturesByName.values()].map(mapFixtureToDeclaredAgentSpaceKeyFieldName);\n};\n\n/** One named fixture, or undefined. */\nexport const findWidgetPreviewFixture = (widgetName: string, fixtureName: string): WidgetPreviewFixture | undefined =>\n findWidgetPreviewFixtures(widgetName).find((fixture) => fixture.name === fixtureName);\n\n/** The fence the fixture stands for — what a canvas body re-reads as its anchor message. */\nexport const buildWidgetPreviewFence = (widgetName: string, fixture: WidgetPreviewFixture): string =>\n \"```widget\\n\" + JSON.stringify({ type: widgetName, ...fixture.payload }) + \"\\n```\";\n","import { Text } from \"../provider/components\";\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { conversationWidgetRegistry } from \"../renderer/conversationWidgetRegistry\";\nimport { resolveWidgetName } from \"../renderer/widget-name-resolver\";\nimport {\n buildWidgetAgentSpaceKeyProps,\n readWidgetAgentSpaceKeyAttribute,\n} from \"../renderer/_agent-space/widget-agent-space-key-attribute\";\nimport {\n CanvasOpenRequestFromOpener,\n ConversationWidgetCallbacks,\n StandaloneConversationWidgetProvider,\n} from \"../renderer/ConversationWidgetContext\";\nimport { ConversationWidgetRenderContext } from \"../renderer/ConversationWidgetRenderContext\";\nimport { ConversationWidgetErrorBoundary } from \"../renderer/ConversationWidgetErrorBoundary\";\nimport {\n WidgetRenderReporter,\n WidgetRenderReportContext,\n} from \"../renderer/render-report/widget-render-report\";\nimport type { CanvasState } from \"../renderer/canvas/canvas-state\";\nimport { canvasBodies } from \"../renderer/canvas/canvasBodies\";\nimport { canvasBehaviourOf } from \"../renderer/canvas/canvas-behaviours\";\nimport { decideCanvasOpen } from \"../renderer/canvas/decide-canvas-open\";\nimport { CANVAS_VIABLE_MIN_WIDTH } from \"../widgets/CanvasLauncherWidget/use-canvas-viable\";\nimport { WidgetImageRenderContext } from \"../image-render/WidgetImageRenderContext\";\nimport { ComposedViewComponentsContext } from \"../kit/composed-view-components\";\nimport { buildPreviewComposedViewComponents } from \"./preview-stub-components\";\nimport { buildWidgetPreviewFence } from \"./widget-preview-fixtures\";\nimport type { WidgetPreviewReadiness } from \"./widget-preview-readiness\";\nimport type { WidgetPreviewBootstrap, WidgetPreviewFixture } from \"./widget-preview.types\";\nimport styles from \"./WidgetPreview.module.scss\";\n\n/**\n * The widget preview host: ONE widget from ONE fixture, outside the chat, in the mode the script\n * asks for. Unlike the e-mail capture host it keeps a working canvas pane (an `openCanvas` request mounts the canvas\n * body beside the widget, its anchor message being the fixture's fence) and a composer log (what the widget sent,\n * prefilled or signalled), so the interactions of the ChatGPT reference can be driven and checked. The app mounts it in\n * its store (the capture's store state); every request is served from the fixture (`widget-preview-requests.ts`). The fixture's\n * `hydration` is the capture's frozen hydration only in `email` mode; `interactive` and `replay` serve it through the\n * preview's hydrators (`widget-preview-hydration.ts`), so the widget runs as in the chat (a canvas auto-opens).\n */\n\n/** The key of the agent space a fixture without its own renders for. */\nexport const PREVIEW_AGENT_SPACE_KEY = 1;\nconst PREVIEW_MESSAGE_ID = 1;\n\ninterface ComposerLogEntry {\n kind: \"message\" | \"prefill\" | \"signal\";\n text: string;\n}\n\nexport interface WidgetPreviewProps {\n bootstrap: WidgetPreviewBootstrap;\n fixture: WidgetPreviewFixture;\n readiness: WidgetPreviewReadiness;\n hasHydrationError: () => boolean;\n}\n\nexport const WidgetPreview = (props: WidgetPreviewProps) => {\n const { bootstrap, fixture, readiness, hasHydrationError } = props;\n const widgetRef = useRef<HTMLDivElement>(null);\n const widgetName = resolveWidgetName(bootstrap.widgetName);\n const entry = conversationWidgetRegistry.widgets.find((widget) => widget.name === widgetName);\n const [canvas, setCanvas] = useState<CanvasState | null>(null);\n const [composerLog, setComposerLog] = useState<ComposerLogEntry[]>([]);\n const agentSpaceKey = Number(readWidgetAgentSpaceKeyAttribute(fixture) ?? PREVIEW_AGENT_SPACE_KEY);\n const fence = useMemo(\n () => buildWidgetPreviewFence(widgetName ?? bootstrap.widgetName, fixture),\n [widgetName, bootstrap.widgetName, fixture],\n );\n const isEmail = bootstrap.mode === \"email\";\n const isInteractive = bootstrap.mode === \"interactive\";\n // The capture context switches every widget to its static e-mail branch (no canvas, no auto-open): e-mail mode only.\n const frozenHydration =\n isEmail && fixture.hydration && Object.keys(fixture.hydration).length > 0 ? fixture.hydration : null;\n\n useEffect(() => {\n if (!entry) readiness.fail(\"UNKNOWN_WIDGET\");\n // The whole page document: the canvas pane and a modal (the lightbox renders into the modal root) settle too.\n else if (widgetRef.current) return readiness.observe(document.body, widgetRef.current, hasHydrationError);\n }, [entry, readiness, hasHydrationError]);\n // The block's render report reaches the readiness as in the chat it reaches the collector.\n const renderReporter = useMemo<WidgetRenderReporter>(() => ({ report: readiness.recordRenderReport }), [readiness]);\n\n const appendComposerLog = useCallback(\n (kind: ComposerLogEntry[\"kind\"], text: string) => setComposerLog((entries) => [...entries, { kind, text }]),\n [],\n );\n // The chat's opening rule decides, as in the conversation slice: a live delivery on a narrow window does not take\n // over for a canvas without an overlay, so the narrow shot shows the inline rows and the \"Open in canvas\" card.\n const openCanvas = useCallback((request: CanvasOpenRequestFromOpener) => {\n setCanvas((current) => {\n const decision = decideCanvasOpen(canvasBehaviourOf(request.canvasId), current, null, {\n ...request,\n viewportViable: window.innerWidth >= CANVAS_VIABLE_MIN_WIDTH,\n hostHasCanvasSurface: true,\n });\n if (decision.kind === \"ignore\") return current;\n return {\n canvasId: request.canvasId,\n instanceId: request.instanceId,\n anchor: request.anchor,\n origin: request.origin,\n mountGeneration: (current?.mountGeneration ?? 0) + 1,\n };\n });\n }, []);\n const callbacks = useMemo<Partial<ConversationWidgetCallbacks>>(\n () => ({\n canvas,\n hostHasCanvasSurface: !isEmail,\n openCanvas: isEmail ? () => {} : openCanvas,\n closeCanvas: () => setCanvas(null),\n chatAgentSpaceKey: agentSpaceKey,\n messages: [],\n sendMessageToChat: (text: string) => appendComposerLog(\"message\", text),\n prefillComposer: (text: string) => appendComposerLog(\"prefill\", text),\n injectSignal: (text: string) => {\n appendComposerLog(\"signal\", text);\n return Promise.resolve(true);\n },\n }),\n [canvas, isEmail, openCanvas, agentSpaceKey, appendComposerLog],\n );\n\n if (!entry) return null;\n const WidgetComponent = entry.component;\n const CanvasBody = canvas ? canvasBodies[canvas.canvasId] : null;\n const widget = (\n <ConversationWidgetErrorBoundary widgetName={entry.name} onCrash={readiness.recordWidgetCrash}>\n <WidgetRenderReportContext.Provider value={renderReporter}>\n <WidgetComponent\n payload={JSON.stringify(fixture.payload)}\n {...buildWidgetAgentSpaceKeyProps(String(agentSpaceKey))}\n interactive={isInteractive}\n fresh={isInteractive}\n justDelivered={isInteractive}\n messageId={String(PREVIEW_MESSAGE_ID)}\n openedByPage={false}\n />\n </WidgetRenderReportContext.Provider>\n </ConversationWidgetErrorBoundary>\n );\n return (\n <StandaloneConversationWidgetProvider callbacks={callbacks}>\n <ConversationWidgetRenderContext.Provider value={isEmail ? \"email\" : \"conversation\"}>\n <WidgetImageRenderContext.Provider value={frozenHydration}>\n <div className={styles.page} data-testid=\"widget-preview-page\">\n <div className={styles.chatColumn} data-testid=\"widget-preview-frame\">\n <div\n ref={widgetRef}\n className={styles.widget}\n data-testid=\"widget-preview-widget\"\n inert={isEmail || undefined}\n >\n {fixture.stubComposedViewComponents ? (\n <ComposedViewComponentsContext.Provider value={buildPreviewComposedViewComponents()}>\n {widget}\n </ComposedViewComponentsContext.Provider>\n ) : (\n widget\n )}\n </div>\n {composerLog.length > 0 ? (\n <div className={styles.composerLog} data-testid=\"widget-preview-composer-log\">\n {composerLog.map((composerEntry, entryIndex) => (\n <Text\n key={entryIndex}\n role=\"caption\"\n translate={false}\n className={styles.composerEntry}\n >\n {`${composerEntry.kind}: ${composerEntry.text}`}\n </Text>\n ))}\n </div>\n ) : null}\n </div>\n {canvas && CanvasBody ? (\n <div className={styles.canvasPane} data-testid=\"widget-preview-canvas\" data-canvas-id={canvas.canvasId}>\n <CanvasBody\n key={`${canvas.instanceId}#${canvas.mountGeneration}`}\n canvas={canvas}\n agentSpaceKey={agentSpaceKey}\n anchorMessageMarkdown={fence}\n />\n </div>\n ) : null}\n </div>\n </WidgetImageRenderContext.Provider>\n </ConversationWidgetRenderContext.Provider>\n </StandaloneConversationWidgetProvider>\n );\n};\n","import { getSandboxLegacyAliases } from \"../provider/environment\";\nimport type { WidgetPreviewSignal } from \"./widget-preview.types\";\n\n/** The `window` property a preview script waits on. */\nexport const WIDGET_PREVIEW_SIGNAL_GLOBAL_NAME = \"__AGENTS_WIDGET_PREVIEW_V1__\";\n\ntype WindowSignals = Record<string, WidgetPreviewSignal | undefined>;\n\n/**\n * Every name the preview signal is published under: the package's own, then each name the app declares\n * (`AgentsEnvironment.sandboxLegacyAliases.previewReadinessGlobalNames`), read at each publish.\n */\nexport const readWidgetPreviewSignalGlobalNames = (): string[] => [\n WIDGET_PREVIEW_SIGNAL_GLOBAL_NAME,\n ...(getSandboxLegacyAliases().previewReadinessGlobalNames ?? []).filter(\n (aliasName) => aliasName !== WIDGET_PREVIEW_SIGNAL_GLOBAL_NAME,\n ),\n];\n\n/** Publishes (or with `undefined` clears) the preview signal under every name. */\nexport const publishWidgetPreviewSignal = (signal: WidgetPreviewSignal | undefined): void => {\n const windowSignals = window as unknown as WindowSignals;\n for (const globalName of readWidgetPreviewSignalGlobalNames()) windowSignals[globalName] = signal;\n};\n","import { publishWidgetImageReadiness } from \"../image-render/widget-image-readiness-signal\";\nimport type { WidgetRenderReportEntry } from \"../renderer/render-report/widget-render-report\";\nimport { publishWidgetPreviewSignal } from \"./widget-preview-signal\";\nimport type { WidgetPreviewExpectedState, WidgetPreviewSignal } from \"./widget-preview.types\";\n\n/** A loading placeholder: the component library's `Skeleton` (its test id; its class is a hashed module name) and the kit's own. */\nconst SKELETON_SELECTOR = '[data-testid=\"Skeleton\"], [class*=\"Skeleton\"], [class*=\"skeleton\"]';\nconst LOADING_SELECTOR = `[aria-busy=\"true\"], [role=\"progressbar\"]:not([aria-valuenow]), ${SKELETON_SELECTOR}`;\n/** The DOM must stay unchanged this long before the preview counts as settled. */\nconst SETTLE_MS = 400;\n\n/**\n * Whether a loading marker is actually rendered: the component library's `ImgWithLoader` keeps its Skeleton in the DOM inside a\n * `display: none` wrapper once the image has loaded, so a marker under a hidden ancestor is no loading state. Without\n * a layout engine (jsdom: no client rects for any element) every marker counts as before.\n */\nconst hasRenderedLoadingMarker = (element: HTMLElement): boolean => {\n const markers = Array.from(element.querySelectorAll(LOADING_SELECTOR));\n if (markers.length === 0) return false;\n const hasLayout = element.getClientRects().length > 0;\n return !hasLayout || markers.some((marker) => marker.getClientRects().length > 0);\n};\n\n/**\n * The state an element shows — the same loading markers the e-mail capture refuses to shoot. `hasError` is true when\n * the widget is known to be in an error: a failed hydration, a crash caught by the error boundary, or a request the\n * fixture failed on purpose — a widget that renders nothing on an error would otherwise read as `empty`.\n * `renderReport` is the block's own render report when the widget sent one: `failed` reads as `error`,\n * `pending` as `loading` and `empty` as `empty` — a widget that shows one muted line (\"No data to show.\") for its empty\n * state is empty, whatever text the line holds.\n */\nexport const observeWidgetPreviewState = (\n element: HTMLElement,\n hasError: boolean,\n renderReport?: WidgetRenderReportEntry,\n): WidgetPreviewExpectedState => {\n if (hasError || renderReport?.status === \"failed\") return \"error\";\n if (renderReport?.status === \"pending\") return \"loading\";\n if (hasRenderedLoadingMarker(element)) return \"loading\";\n if (renderReport?.status === \"empty\") return \"empty\";\n if (!element.textContent?.trim() && !element.querySelector(\"img,svg,canvas,iframe\")) return \"empty\";\n return \"data\";\n};\n\n/**\n * A mutation the settle ignores: a style or attribute change inside a loading placeholder — the component library's `Skeleton`\n * animates its shimmer by rewriting its style every frame, so a loading fixture would never be still otherwise.\n */\nconst isSkeletonAnimation = (mutation: MutationRecord): boolean => {\n if (mutation.type !== \"attributes\") return false;\n const target = mutation.target;\n return target instanceof Element && target.closest(SKELETON_SELECTOR) !== null;\n};\n\n/**\n * The preview's ready signal: after every change it waits until the DOM is still for `SETTLE_MS`, then publishes what\n * it shows — `window.__AGENTS_WIDGET_PREVIEW_V1__` (observed against the fixture's expected state, with every request\n * the fixture had no response for) and the e-mail capture's `window.__AGENTS_WIDGET_IMAGE_V1__` (`ready` when the\n * expected state was reached), so the same script conventions work for both. Both are also published under the names\n * the app declares (`AgentsEnvironment.sandboxLegacyAliases`).\n */\nexport const createWidgetPreviewReadiness = (expectedState: WidgetPreviewExpectedState) => {\n const missingResponses: string[] = [];\n const failedRequests: string[] = [];\n let widgetCrashed = false;\n let renderReport: WidgetRenderReportEntry | undefined;\n let scheduleSettleAgain: () => void = () => {};\n let revision = 0;\n const publish = (\n signal: Omit<\n WidgetPreviewSignal,\n \"version\" | \"missingResponses\" | \"failedRequests\" | \"widgetCrashed\" | \"expectedState\"\n >,\n ) => {\n publishWidgetPreviewSignal({\n version: 1,\n expectedState,\n missingResponses: [...missingResponses],\n failedRequests: [...failedRequests],\n widgetCrashed,\n ...(renderReport ? { renderReport } : {}),\n ...signal,\n });\n document.documentElement.dataset.widgetPreviewState = signal.state;\n };\n publish({ state: \"loading\", revision });\n\n const fail = (errorCode: string) => {\n publish({ state: \"failed\", revision, error_code: errorCode });\n publishWidgetImageReadiness({ version: 1, state: \"failed\", error_code: errorCode });\n };\n\n const recordMissingResponse = (requestKey: string) => {\n if (!missingResponses.includes(requestKey)) missingResponses.push(requestKey);\n };\n\n /** A request (or a preview hydration) the fixture answered with a failing `__status`. */\n const recordFailedRequest = (requestKey: string) => {\n if (!failedRequests.includes(requestKey)) failedRequests.push(requestKey);\n };\n\n /** The error boundary caught the widget (`ConversationWidgetErrorBoundary` `onCrash`). */\n const recordWidgetCrash = () => {\n widgetCrashed = true;\n };\n\n /** The block's render report (`WidgetRenderReportContext` of the host); a new status settles again. */\n const recordRenderReport = (entry: WidgetRenderReportEntry) => {\n renderReport = entry;\n scheduleSettleAgain();\n };\n\n const settle = (element: HTMLElement, hasHydrationError: () => boolean) => {\n const hasError = hasHydrationError() || widgetCrashed || failedRequests.length > 0;\n const observedState = observeWidgetPreviewState(element, hasError, renderReport);\n const { x, y, width, height } = element.getBoundingClientRect();\n const rect = { x, y, width, height };\n revision += 1;\n const expectedStateReached = observedState === expectedState;\n publish({ state: \"settled\", revision, observedState, expectedStateReached, rect });\n publishWidgetImageReadiness(\n expectedStateReached\n ? { version: 1, state: \"ready\", rect }\n : {\n version: 1,\n state: \"failed\",\n error_code: `EXPECTED_${expectedState.toUpperCase()}_SAW_${observedState.toUpperCase()}`,\n rect,\n },\n );\n };\n\n /**\n * Watches `watchedElement` (the whole preview document, so an interaction that changes only the canvas pane or opens\n * a modal settles too)\n * and classifies `widgetElement` (the widget alone, the screenshot); returns the disposer.\n */\n const observe = (watchedElement: HTMLElement, widgetElement: HTMLElement, hasHydrationError: () => boolean) => {\n let settleTimer: ReturnType<typeof setTimeout> | null = null;\n const scheduleSettle = () => {\n if (settleTimer !== null) clearTimeout(settleTimer);\n settleTimer = setTimeout(() => settle(widgetElement, hasHydrationError), SETTLE_MS);\n };\n const mutationObserver = new MutationObserver((mutations) => {\n if (mutations.some((mutation) => !isSkeletonAnimation(mutation))) scheduleSettle();\n });\n mutationObserver.observe(watchedElement, {\n subtree: true,\n childList: true,\n attributes: true,\n characterData: true,\n });\n scheduleSettleAgain = scheduleSettle;\n scheduleSettle();\n return () => {\n mutationObserver.disconnect();\n scheduleSettleAgain = () => {};\n if (settleTimer !== null) clearTimeout(settleTimer);\n };\n };\n\n return { observe, fail, recordMissingResponse, recordFailedRequest, recordWidgetCrash, recordRenderReport };\n};\n\nexport type WidgetPreviewReadiness = ReturnType<typeof createWidgetPreviewReadiness>;\n","import { createHeaderlessResponse, interceptXMLHttpRequests, isFetchRequest } from \"../request-interception/browser-request-interception\";\nimport type { WidgetPreviewResponse } from \"./widget-preview.types\";\n\n/** The key a fixture response is stored under: method, path and the sorted query (`GET /api/example/…?a=1&b=2`). */\nexport const widgetPreviewRequestKey = (method: string, url: URL): string => {\n const sortedUrl = new URL(url.toString());\n sortedUrl.searchParams.sort();\n return `${method.toUpperCase()} ${sortedUrl.pathname}${sortedUrl.search}`;\n};\n\n/** The app's own error log: answered empty and never reported — a fixture's error state must not count as a gap. */\nconst SILENTLY_ANSWERED_PATHS = [\"/rest_api/v1/log\"];\nconst isSilentlyAnswered = (url: URL): boolean => SILENTLY_ANSWERED_PATHS.includes(url.pathname);\n\nexport const isStatusResponse = (response: unknown): response is { __status: number; __body?: unknown } =>\n typeof response === \"object\" &&\n response !== null &&\n typeof (response as { __status?: unknown }).__status === \"number\";\nexport const isPendingResponse = (response: unknown): boolean =>\n typeof response === \"object\" && response !== null && (response as { __pending?: unknown }).__pending === true;\n\n/** A fixture answer as an `XMLHttpRequest` reads it; a status a `Response` cannot carry fails like a network error. */\nconst xhrAnswer = (body: unknown, status: number): Response => {\n if (status < 200 || status > 599) throw new TypeError(`preview response ${status}`);\n if ([204, 205, 304].includes(status)) return createHeaderlessResponse(null, status);\n return createHeaderlessResponse(JSON.stringify(body), status, status === 200 ? \"OK\" : \"\");\n};\n\n/**\n * Serves every request of the preview — `XMLHttpRequest` (the transport of axios's browser adapter) and `fetch` — from\n * the fixture: a known request gets its body (a copy), a `__status` entry fails with that status (a status of 400 or\n * more is reported as a failed request — the error state the fixture asked for), a `__pending` entry never answers (the\n * loading state), and anything else — an unknown read, a write the fixture does not answer — fails as a missing\n * response and is reported. A write is answered only when the fixture names it (`\"POST /api/example/…\"`, e.g. a\n * widget's fire-and-forget measurement event). Nothing reaches a server.\n */\nexport const installWidgetPreviewRequests = (\n responses: Record<string, WidgetPreviewResponse>,\n onMissingResponse: (requestKey: string) => void,\n onFailedRequest: (requestKey: string) => void = () => {},\n): (() => void) => {\n // XMLHttpRequest: a missing response fails like a network error (no response), a `__status` entry answers with its\n // status and `__body`.\n const restoreXMLHttpRequest = interceptXMLHttpRequests(async (request) => {\n if (isSilentlyAnswered(request.url)) return xhrAnswer({}, 200);\n const requestKey = widgetPreviewRequestKey(request.method, request.url);\n const response = Object.prototype.hasOwnProperty.call(responses, requestKey) ? responses[requestKey] : undefined;\n if (response === undefined) {\n onMissingResponse(requestKey);\n throw new Error(`no preview response for ${requestKey}`);\n }\n if (isPendingResponse(response)) return new Promise<Response>(() => {});\n if (isStatusResponse(response)) {\n if (response.__status >= 400) onFailedRequest(requestKey);\n return xhrAnswer(response.__body ?? null, response.__status);\n }\n return xhrAnswer(response, 200);\n });\n // `fetch` is answered the same way (a few modules bypass the XMLHttpRequest client); a missing response is a 404,\n // reported. A `Request` of another realm is read by its brand, not by `instanceof`.\n const originalFetch = window.fetch;\n window.fetch = async (input: RequestInfo | URL, init?: RequestInit) => {\n const fromRequest = isFetchRequest(input) ? input : undefined;\n const method = (init?.method ?? (fromRequest ? fromRequest.method : \"GET\")).toLowerCase();\n const url = new URL(fromRequest ? fromRequest.url : String(input), window.location.origin);\n if (isSilentlyAnswered(url)) return new Response(\"{}\", { status: 200 });\n const requestKey = widgetPreviewRequestKey(method, url);\n const response = Object.prototype.hasOwnProperty.call(responses, requestKey) ? responses[requestKey] : undefined;\n if (response === undefined) {\n onMissingResponse(requestKey);\n return new Response(null, { status: 404 });\n }\n if (isPendingResponse(response)) return new Promise<Response>(() => {});\n if (isStatusResponse(response)) {\n if (response.__status >= 400) onFailedRequest(requestKey);\n return new Response(JSON.stringify(response.__body ?? null), { status: response.__status });\n }\n return new Response(JSON.stringify(response), { status: 200, headers: { \"Content-Type\": \"application/json\" } });\n };\n return () => {\n restoreXMLHttpRequest();\n window.fetch = originalFetch;\n };\n};\n","import {\n getWidgetHydrator,\n listWidgetHydratorTypes,\n registerWidgetHydrator,\n unregisterWidgetHydrator,\n} from \"../renderer/widget-hydration/widget-hydration.registry\";\nimport type { RegisteredWidget } from \"../renderer/widget-hydration/widget-hydration.types\";\nimport { isPendingResponse, isStatusResponse } from \"./widget-preview-requests\";\nimport type { WidgetPreviewResponse } from \"./widget-preview.types\";\n\n/** The fixture's entry for one hydration: the exact derived key first, then the hydrator type (as the capture reads). */\nconst findFixtureHydration = (\n hydration: Record<string, WidgetPreviewResponse>,\n type: string,\n key: string,\n): { found: boolean; value?: WidgetPreviewResponse; hydrationKey: string } => {\n if (Object.prototype.hasOwnProperty.call(hydration, key))\n return { found: true, value: hydration[key], hydrationKey: key };\n if (Object.prototype.hasOwnProperty.call(hydration, type))\n return { found: true, value: hydration[type], hydrationKey: type };\n return { found: false, hydrationKey: key };\n};\n\n/** One fixture value as a hydrator result: a copy of the body, a failing `__status`, or a `__pending` that never ends. */\nconst answerFromFixture = (\n value: WidgetPreviewResponse,\n hydrationKey: string,\n onFailedRequest: (requestKey: string) => void,\n): Promise<unknown> => {\n if (isPendingResponse(value)) return new Promise(() => {});\n if (isStatusResponse(value)) {\n onFailedRequest(`HYDRATION ${hydrationKey}`);\n return Promise.reject(new Error(`preview hydration ${value.__status}`));\n }\n return Promise.resolve(structuredClone(value));\n};\n\n/**\n * The preview's hydration transport for the `interactive` and `replay` modes: every registered hydrator is replaced by\n * one that answers from the fixture's `hydration` (by derived key, else by type) and otherwise runs the real hydrator,\n * whose requests the request transport answers from `responses`. The widget therefore runs its live code path —\n * `useWidgetHydration` with the store's hydration slice, no frozen capture context — so a self-hydrating canvas widget\n * auto-opens its canvas like in the chat (`CanvasLauncherWidget`). The `email` mode keeps the capture's frozen hydration.\n * Returns the disposer that puts the real hydrators back.\n */\nexport const installWidgetPreviewHydration = (\n hydration: Record<string, WidgetPreviewResponse>,\n onFailedRequest: (requestKey: string) => void,\n): (() => void) => {\n const replacedHydrators = new Map<string, RegisteredWidget<unknown, unknown>>();\n for (const type of listWidgetHydratorTypes()) {\n const registered = getWidgetHydrator<unknown, unknown>(type);\n if (!registered) continue;\n replacedHydrators.set(type, registered);\n unregisterWidgetHydrator(type);\n registerWidgetHydrator<unknown, unknown>(type, {\n ...registered,\n hydrator: (payload, context) => {\n const fixtureHydration = findFixtureHydration(hydration, type, registered.deriveKey(type, payload));\n return fixtureHydration.found\n ? answerFromFixture(fixtureHydration.value, fixtureHydration.hydrationKey, onFailedRequest)\n : registered.hydrator(payload, context);\n },\n });\n }\n return () => {\n for (const [type, registered] of replacedHydrators) {\n unregisterWidgetHydrator(type);\n registerWidgetHydrator(type, registered);\n }\n };\n};\n","import { Text } from \"../../../provider/components\";\nimport { ConversationWidgetProvider } from \"../../../renderer/ConversationWidgetContext\";\nimport { ConversationMessageInputComposerWidgets } from \"../../../chat/ConversationMessageInput/ConversationMessageInputComposerWidgets/ConversationMessageInputComposerWidgets\";\nimport { EntityMentionAskButton } from \"../EntityMentionAskButton/EntityMentionAskButton\";\nimport styles from \"./EntityMentionAskFlowStory.module.scss\";\n\nconst ENTITIES = [\n { entityType: \"competitor\", entityId: \"8812\", label: \"Altes Gasthaus Leve\", agentSpaceKey: 1 },\n { entityType: \"competitor\", entityId: \"9001\", label: \"Kleiner Kiepenkerl\", agentSpaceKey: 1 },\n];\n\n/**\n * The \"Ask about this\" flow for the story and the browser check: a stand-in for the detail panel's\n * footer (the `entityDetail` shell is the canvas shell's, the bodies come from the entity types) with the real button, and the real\n * composer strip of the chat input, so a click shows the chip where the owner types.\n */\nexport const EntityMentionAskFlowStory = (props: { maxWidth?: number }) => (\n <ConversationWidgetProvider callbacks={{}}>\n <div className={styles.page} style={{ maxWidth: props.maxWidth ?? 720 }}>\n {ENTITIES.map((entity) => (\n <div key={entity.entityId} className={styles.panel}>\n <Text role=\"intro\" weight=\"bold\" translate={false}>\n {entity.label}\n </Text>\n <Text role=\"help\" color=\"var(--agents-fg-light)\" translate={false}>\n {\"detail panel body\"}\n </Text>\n <div className={styles.footer}>\n <EntityMentionAskButton {...entity} testId={`entity-mention-ask-${entity.entityId}`} />\n </div>\n </div>\n ))}\n <div className={styles.composer} data-testid=\"story-composer\">\n <ConversationMessageInputComposerWidgets testId=\"story-input\" />\n <Text role=\"help\" color=\"var(--agents-fg-lightest)\" translate={false}>\n {\"Ask anything…\"}\n </Text>\n </div>\n </div>\n </ConversationWidgetProvider>\n);\n"],"names":["styles","widget","composerLog","composerEntry"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QAAO,OAAM,0BAAyB,WAAW,OACzD,UAAA,oBAAA,CACH;AAAA,IACA,oBAAC,OAAA,EAAI,WAAW,OAAO,QACrB,UAAA,oBAAC,wBAAA,EAAwB,GAAG,QAAQ,QAAQ,sBAAsB,OAAO,QAAQ,IAAI,EAAA,CACvF;AAAA,EAAA,KATQ,OAAO,QAUjB,CACD;AAAA,uBACA,OAAA,EAAI,WAAW,OAAO,UAAU,eAAY,kBAC3C,UAAA;AAAA,IAAA,oBAAC,yCAAA,EAAwC,QAAO,cAAA,CAAc;AAAA,IAC9D,oBAAC,QAAK,MAAK,QAAO,OAAM,6BAA4B,WAAW,OAC5D,UAAA,gBAAA,CACH;AAAA,EAAA,EAAA,CACF;AAAA,EAAA,CACF,EAAA,CACF;"}
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-CNX8Am2L.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-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, b, M, W, c, d, e, f, g, i, p, r, s, u } from "./chunks/canvas-title-slot-context-DK4sfhkl.js";
3
- import { m as findWidgetFenceByPayloadHash, n as findWidgetFencesInMarkdown } from "./chunks/widget-name-resolver-BVEuAsW5.js";
4
- import { o, p as p2, q, t, v, w, j, x, y, z, B, D, F, G } from "./chunks/widget-name-resolver-BVEuAsW5.js";
5
- import { m as useResolvedConversationWidgetAgentSpaceKey, p as payloadHashOfInstanceId } from "./chunks/WebSearchResultsConversationWidget-887v8Wen.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 as i2, T, a as a2, U, V, X, Y, Z, g as g2, _, s as s2, $, u as u2, a0, a1, a2 as a22, a3, a4, a5 } from "./chunks/WebSearchResultsConversationWidget-887v8Wen.js";
7
- import { c as c2, u as u3 } from "./chunks/canvasBodies-C7qqThc9.js";
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-CNX8Am2L.js";
10
- import { ac, ad, ae, af, ag } from "./chunks/link-navigation-CNX8Am2L.js";
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 d2, e as e2 } from "./chunks/canvas-reducers-CwFA3rQ6.js";
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
- C as CanvasTitleSlotContext,
105
- a as ConversationMarkdown,
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
- b as ConversationWidgetHost,
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
- d2 as applyResetCanvasForNewTurn,
129
- e2 as applySetCanvasCreatedEntityId,
130
- c as buildComposerWidgetFenceBlock,
131
- d as buildMessageTextWithComposerWidgets,
129
+ d3 as applyResetCanvasForNewTurn,
130
+ e as applySetCanvasCreatedEntityId,
131
+ b as buildComposerWidgetFenceBlock,
132
+ c as buildMessageTextWithComposerWidgets,
132
133
  z2 as buildWidgetAgentSpaceKeyProps,
133
- e as buildWidgetRenderReportSignal,
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
- f as deepLinkableWidgetNameForCanvas,
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
- g as getWidgetClickSignalSources,
160
+ g2 as getWidgetClickSignalSources,
160
161
  j2 as getWidgetHydrator,
161
162
  P as hasWidgetHydrator,
162
163
  Q as isCanvasAnchorLoaded,
163
- i2 as isCanvasId,
164
+ i as isCanvasId,
164
165
  T as isCanvasReference,
165
166
  a2 as isPackageCanvasId,
166
167
  isSectionIncomplete,
167
168
  isSectionLoading,
168
- i as isWidgetClickSignalSource,
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
- g2 as registerWidgetHydrator,
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
- u2 as unregisterWidgetHydrator,
192
+ u as unregisterWidgetHydrator,
192
193
  useAnchorWidgetAgentSpaceKey,
193
194
  useAnchorWidgetFenceAgentSpaceKey,
194
195
  u3 as useAnchorWidgetPayload,
195
- u as useCanvasTitleSlot,
196
+ u2 as useCanvasTitleSlot,
196
197
  useConversationWidgetAgentSpaceFallback,
197
198
  a0 as useConversationWidgetContext,
198
199
  a1 as useIsEmailWidgetRender,
@@ -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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AC1C,QACA,uBACA,YACA,sBACuB;AACvB,QAAM,qBAAqB,kCAAkC,QAAQ,uBAAuB,UAAU;AACtG,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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