@mgamadeus/ddd-agents 0.1.0-alpha.22 → 0.1.0-alpha.24

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 (164) hide show
  1. package/README.md +3 -2
  2. package/dist/chat.js +87 -893
  3. package/dist/chat.js.map +1 -1
  4. package/dist/chunks/ConversationMessageInputComposerWidgets-BxyaFBA6.js +631 -0
  5. package/dist/chunks/ConversationMessageInputComposerWidgets-BxyaFBA6.js.map +1 -0
  6. package/dist/chunks/{WebSearchResultsConversationWidget-BvnLWHyi.js → WebSearchResultsConversationWidget-as3p5bHw.js} +147 -1125
  7. package/dist/chunks/WebSearchResultsConversationWidget-as3p5bHw.js.map +1 -0
  8. package/dist/chunks/{canvas-behaviours-BRFR1ALE.js → canvas-behaviours-AvzKSYyv.js} +4 -4
  9. package/dist/chunks/{canvas-behaviours-BRFR1ALE.js.map → canvas-behaviours-AvzKSYyv.js.map} +1 -1
  10. package/dist/chunks/canvas-reducers-Bfp_i7lc.js +88 -0
  11. package/dist/chunks/canvas-reducers-Bfp_i7lc.js.map +1 -0
  12. package/dist/chunks/{canvasBodies-9SuF6NAB.js → canvasBodies-Cvu3l38p.js} +12 -6
  13. package/dist/chunks/canvasBodies-Cvu3l38p.js.map +1 -0
  14. package/dist/chunks/canvasStorage-EvQsGdto.js +65 -0
  15. package/dist/chunks/canvasStorage-EvQsGdto.js.map +1 -0
  16. package/dist/chunks/contract-BxmMxYPF.js +96 -0
  17. package/dist/chunks/contract-BxmMxYPF.js.map +1 -0
  18. package/dist/chunks/conversation-BEF0aesf.js +31 -0
  19. package/dist/chunks/conversation-BEF0aesf.js.map +1 -0
  20. package/dist/chunks/entity-detail-name-3A82gDAp.js +15 -0
  21. package/dist/chunks/entity-detail-name-3A82gDAp.js.map +1 -0
  22. package/dist/chunks/icon-names-Di6c4zLo.js +86 -0
  23. package/dist/chunks/icon-names-Di6c4zLo.js.map +1 -0
  24. package/dist/chunks/index-7Qc_3GbG.js +1046 -0
  25. package/dist/chunks/index-7Qc_3GbG.js.map +1 -0
  26. package/dist/chunks/{ConversationMarkdown-W7NHglmL.js → widget-click-signal-sources-DulRkNvZ.js} +54 -7
  27. package/dist/chunks/widget-click-signal-sources-DulRkNvZ.js.map +1 -0
  28. package/dist/chunks/{widget-image-readiness-signal-DeOuL89j.js → widget-image-readiness-signal-D3ci53xr.js} +2 -2
  29. package/dist/chunks/{widget-image-readiness-signal-DeOuL89j.js.map → widget-image-readiness-signal-D3ci53xr.js.map} +1 -1
  30. package/dist/chunks/{widget-name-resolver-DyIY6Zu4.js → widget-name-resolver-BGN3HpoG.js} +80 -117
  31. package/dist/chunks/widget-name-resolver-BGN3HpoG.js.map +1 -0
  32. package/dist/chunks/{withPollingChangeSubscription-BLDAWF-o.js → withPollingChangeSubscription-B16htQGd.js} +2 -2
  33. package/dist/chunks/{withPollingChangeSubscription-BLDAWF-o.js.map → withPollingChangeSubscription-B16htQGd.js.map} +1 -1
  34. package/dist/client-testing.js +91 -2
  35. package/dist/client-testing.js.map +1 -1
  36. package/dist/client.js +1 -1
  37. package/dist/contract.js +8 -27
  38. package/dist/contract.js.map +1 -1
  39. package/dist/files/chat/Conversation.module.scss +268 -0
  40. package/dist/files/chat/ConversationViewBody/ConversationViewBody.module.scss +336 -0
  41. package/dist/files/chat/_conversation-tokens.scss +37 -0
  42. package/dist/files/image-render/WidgetImageRender.module.scss +22 -0
  43. package/dist/files/kit/ComposedViewConversationWidget.md +59 -0
  44. package/dist/files/kit/components/data/data.preview-fixtures.json +3298 -0
  45. package/dist/files/kit/components/embedding/widget.preview-fixtures.json +147 -0
  46. package/dist/files/kit/components/entity/entity-link.preview-fixtures.json +340 -0
  47. package/dist/files/kit/components/form/form.preview-fixtures.json +319 -0
  48. package/dist/files/kit/components/inputs/button.preview-fixtures.json +301 -0
  49. package/dist/files/kit/components/inputs/checkbox.preview-fixtures.json +35 -0
  50. package/dist/files/kit/components/inputs/date-picker.preview-fixtures.json +36 -0
  51. package/dist/files/kit/components/inputs/input.preview-fixtures.json +55 -0
  52. package/dist/files/kit/components/inputs/radio-group.preview-fixtures.json +76 -0
  53. package/dist/files/kit/components/inputs/select.preview-fixtures.json +314 -0
  54. package/dist/files/kit/components/inputs/slider.preview-fixtures.json +178 -0
  55. package/dist/files/kit/components/inputs/tabs.preview-fixtures.json +304 -0
  56. package/dist/files/kit/components/inputs/textarea.preview-fixtures.json +37 -0
  57. package/dist/files/kit/components/layout/layout.preview-fixtures.json +892 -0
  58. package/dist/files/kit/components/map/map.preview-fixtures.json +339 -0
  59. package/dist/files/kit/components/media/image-group.preview-fixtures.json +228 -0
  60. package/dist/files/kit/components/media/image.preview-fixtures.json +61 -0
  61. package/dist/files/kit/components/media/video-card/video-card.preview-fixtures.json +121 -0
  62. package/dist/files/kit/components/media/video.preview-fixtures.json +68 -0
  63. package/dist/files/kit/components/rich/code.preview-fixtures.json +105 -0
  64. package/dist/files/kit/components/rich/diagram.preview-fixtures.json +89 -0
  65. package/dist/files/kit/components/rich/math.preview-fixtures.json +152 -0
  66. package/dist/files/kit/components/rich/svg.preview-fixtures.json +243 -0
  67. package/dist/files/kit/components/text/badge.preview-fixtures.json +44 -0
  68. package/dist/files/kit/components/text/caption.preview-fixtures.json +31 -0
  69. package/dist/files/kit/components/text/favicon.preview-fixtures.json +69 -0
  70. package/dist/files/kit/components/text/label.preview-fixtures.json +48 -0
  71. package/dist/files/kit/components/text/link.preview-fixtures.json +103 -0
  72. package/dist/files/kit/components/text/markdown.preview-fixtures.json +29 -0
  73. package/dist/files/kit/components/text/source-ref.preview-fixtures.json +51 -0
  74. package/dist/files/kit/components/text/text.preview-fixtures.json +106 -0
  75. package/dist/files/kit/components/text/title.preview-fixtures.json +172 -0
  76. package/dist/files/kit/composed-view-widget-contract.json +88 -0
  77. package/dist/files/kit/composed-view.preview-fixtures.json +376 -0
  78. package/dist/files/renderer/conversation-widget-layout.module.scss +47 -0
  79. package/dist/files/renderer/widget-tree/composed-node-schema.json +3428 -0
  80. package/dist/files/styles/_conversation-widget-container.scss +6 -0
  81. package/dist/files/styles/_media.scss +50 -0
  82. package/dist/files/styles/_spacings.scss +23 -0
  83. package/dist/files/styles/_surfaces.scss +28 -0
  84. package/dist/files/widgets/ClockConversationWidget/ClockConversationWidget.md +53 -0
  85. package/dist/files/widgets/ClockConversationWidget/clock.preview-fixtures.json +76 -0
  86. package/dist/files/widgets/ConceptExplainerConversationWidget/ConceptExplainerConversationWidget.md +86 -0
  87. package/dist/files/widgets/ConceptExplainerConversationWidget/concept-explainer.preview-fixtures.json +23 -0
  88. package/dist/files/widgets/ConversationSearchResultsConversationWidget/ConversationSearchResultsConversationWidget.md +59 -0
  89. package/dist/files/widgets/ConversationSearchResultsConversationWidget/conversation-search-results.preview-fixtures.json +85 -0
  90. package/dist/files/widgets/CurrencyConverterConversationWidget/CurrencyConverterConversationWidget.md +51 -0
  91. package/dist/files/widgets/CurrencyConverterConversationWidget/currency-converter.preview-fixtures.json +73 -0
  92. package/dist/files/widgets/CustomVisualizationConversationWidget/CustomVisualizationConversationWidget.md +83 -0
  93. package/dist/files/widgets/CustomVisualizationConversationWidget/custom-visualization.preview-fixtures.json +227 -0
  94. package/dist/files/widgets/CustomVisualizationConversationWidget/sandbox-frame/custom-visualization-frame.html +188 -0
  95. package/dist/files/widgets/EntityMentionConversationWidget/EntityMentionConversationWidget.md +55 -0
  96. package/dist/files/widgets/EntityMentionConversationWidget/entity-mention.preview-fixtures.json +55 -0
  97. package/dist/files/widgets/MultiChoiceConversationWidget/MultiChoiceConversationWidget.md +61 -0
  98. package/dist/files/widgets/MultiChoiceConversationWidget/multi-choice-widget-contract.json +43 -0
  99. package/dist/files/widgets/MultiChoiceConversationWidget/multi-choice.preview-fixtures.json +103 -0
  100. package/dist/files/widgets/QuickRepliesConversationWidget/QuickRepliesConversationWidget.md +65 -0
  101. package/dist/files/widgets/QuickRepliesConversationWidget/quick-replies-widget-contract.json +43 -0
  102. package/dist/files/widgets/QuickRepliesConversationWidget/quick-replies.preview-fixtures.json +45 -0
  103. package/dist/files/widgets/SuggestedActions/SuggestedActions.md +60 -0
  104. package/dist/files/widgets/SuggestedActions/suggested-actions.preview-fixtures.json +19 -0
  105. package/dist/files/widgets/ToolTraceConversationWidget/ToolTraceConversationWidget.md +48 -0
  106. package/dist/files/widgets/ToolTraceConversationWidget/tool-trace.preview-fixtures.json +32 -0
  107. package/dist/files/widgets/WebSearchResultsConversationWidget/WebSearchResultsConversationWidget.md +49 -0
  108. package/dist/files/widgets/WebSearchResultsConversationWidget/web-search-results.preview-fixtures.json +57 -0
  109. package/dist/files/widgets/WritingDraftConversationWidget/WritingDraftConversationWidget.md +66 -0
  110. package/dist/files/widgets/WritingDraftConversationWidget/writing-draft.preview-fixtures.json +129 -0
  111. package/dist/image-render.js +11 -10
  112. package/dist/image-render.js.map +1 -1
  113. package/dist/index.js +32 -27
  114. package/dist/index.js.map +1 -1
  115. package/dist/kit.js +11 -2
  116. package/dist/kit.js.map +1 -1
  117. package/dist/preview.js +47 -18
  118. package/dist/preview.js.map +1 -1
  119. package/dist/provider.js +71 -0
  120. package/dist/provider.js.map +1 -0
  121. package/dist/renderer.js +142 -62
  122. package/dist/renderer.js.map +1 -1
  123. package/dist/styles.css +86 -38
  124. package/dist/types/client/testing/test-conversation-widgets.d.ts +25 -0
  125. package/dist/types/client/testing/widget-hydration-stand-ins.d.ts +42 -0
  126. package/dist/types/entries/chat.d.ts +12 -0
  127. package/dist/types/entries/client-testing.d.ts +4 -0
  128. package/dist/types/entries/contract.d.ts +1 -0
  129. package/dist/types/entries/index.d.ts +4 -3
  130. package/dist/types/entries/kit.d.ts +7 -0
  131. package/dist/types/entries/preview.d.ts +2 -0
  132. package/dist/types/entries/provider.d.ts +1 -0
  133. package/dist/types/entries/renderer.d.ts +19 -1
  134. package/dist/types/entries/widgets.d.ts +13 -0
  135. package/dist/types/kit/components/data/apex-chart-component.d.ts +3 -0
  136. package/dist/types/kit/components/data/chart-model.d.ts +164 -0
  137. package/dist/types/kit/components/data/data-value-format.d.ts +44 -0
  138. package/dist/types/kit/components/data/use-chart-palette.d.ts +9 -0
  139. package/dist/types/kit/components/data/use-number-locale.d.ts +5 -0
  140. package/dist/types/kit/components/map/use-google-maps-auth-failure.d.ts +18 -0
  141. package/dist/types/kit/entity-detail/entity-detail-bodies.d.ts +2 -0
  142. package/dist/types/provider/index.d.ts +1 -0
  143. package/dist/types/renderer/_access/ConversationWidgetGateSkeleton.d.ts +6 -0
  144. package/dist/types/renderer/_agent-space/use-conversation-widget-agent-space-fallback.d.ts +16 -0
  145. package/dist/types/renderer/canvas/entity-detail-instance.d.ts +5 -3
  146. package/dist/types/renderer/canvas/use-anchor-widget-agent-space-key.d.ts +17 -0
  147. package/dist/types/renderer/conversationWidgetRegistry.d.ts +6 -0
  148. package/dist/types/renderer/read-conversation-widget-variant.d.ts +22 -0
  149. package/dist/types/renderer/widget-hydration/use-widget-hydration.d.ts +5 -0
  150. package/dist/types/widgets/EntityMentionConversationWidget/stories/EntityMentionAskFlowStory.d.ts +8 -0
  151. package/dist/types/widgets/_shared/CardFooter.d.ts +6 -0
  152. package/dist/types/widgets/_shared/WidgetLabel.d.ts +8 -0
  153. package/dist/types/widgets/_shared/entity-update-channel.d.ts +17 -0
  154. package/dist/types/widgets/_shared/use-element-visible.d.ts +6 -0
  155. package/dist/widgets.js +120 -27
  156. package/dist/widgets.js.map +1 -1
  157. package/package.json +74 -1
  158. package/public-api.json +779 -0
  159. package/dist/chunks/ConversationMarkdown-W7NHglmL.js.map +0 -1
  160. package/dist/chunks/WebSearchResultsConversationWidget-BvnLWHyi.js.map +0 -1
  161. package/dist/chunks/canvasBodies-9SuF6NAB.js.map +0 -1
  162. package/dist/chunks/decide-canvas-open-Ct-wnNEJ.js +0 -20
  163. package/dist/chunks/decide-canvas-open-Ct-wnNEJ.js.map +0 -1
  164. package/dist/chunks/widget-name-resolver-DyIY6Zu4.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-7Qc_3GbG.js","sources":["../../src/renderer/widget-hydration/widget-hydration.reducer.ts","../../src/renderer/widget-hydration/widget-hydration-state-store.ts","../../src/provider/class-names.ts","../../src/provider/components/default-components.tsx","../../src/provider/environment.ts","../../src/provider/AgentsProvider.tsx","../../src/provider/components/index.tsx"],"sourcesContent":["import type { AgentsStateAction } from \"../../provider/environment\";\nimport { WidgetHydrationSliceState, WidgetMemory } from \"./widget-hydration.types\";\n\n/**\n * The widget hydration state: one memory per hydration key. A plain reducer under the key\n * `AIExtensionsWidgetHydration` of a state store: the app's own (`AgentsEnvironment.stateStore`, the host application mounts it in\n * its Redux store) or, without one, the package's default store (`widget-hydration-state-store.ts`).\n */\n\nconst SLICE_NAME = \"widgetHydrationSlice\";\n\nconst emptyMemory = (): WidgetMemory => {\n return {\n data: null,\n status: \"idle\",\n error: null,\n loadingInstanceId: null,\n inFlight: false,\n requestId: 0,\n lastLoadedAt: null,\n };\n};\n\nconst initialState: WidgetHydrationSliceState = {\n widgets: {},\n};\n\nconst readMemory = (state: WidgetHydrationSliceState, key: string): WidgetMemory => state.widgets[key] ?? emptyMemory();\n\nconst withMemory = (state: WidgetHydrationSliceState, key: string, memory: WidgetMemory): WidgetHydrationSliceState => ({\n ...state,\n widgets: { ...state.widgets, [key]: memory },\n});\n\n/** Does a result still belong to the request the memory tracks? (0 = the memory was reset since.) */\nconst isCurrentRequest = (memory: WidgetMemory, requestId: number): boolean =>\n memory.requestId === 0 || memory.requestId === requestId;\n\ninterface MemoryEnsuredPayload {\n key: string;\n}\ninterface InstanceAttachedPayload {\n key: string;\n instanceId: string;\n}\ninterface HydrationStartedPayload {\n key: string;\n instanceId: string;\n requestId: number;\n}\ninterface HydrationSucceededPayload {\n key: string;\n requestId: number;\n data: unknown;\n}\ninterface HydrationFailedPayload {\n key: string;\n requestId: number;\n error: string;\n}\ninterface WidgetResetPayload {\n key: string;\n}\n\nconst actionType = (name: string): string => `${SLICE_NAME}/${name}`;\n\n/** The action creators (the action types are the ones the former Redux Toolkit slice used). */\nexport const WidgetHydrationSlice = {\n memoryEnsured: (payload: MemoryEnsuredPayload): AgentsStateAction => ({ type: actionType(\"memoryEnsured\"), payload }),\n instanceAttached: (payload: InstanceAttachedPayload): AgentsStateAction => ({\n type: actionType(\"instanceAttached\"),\n payload,\n }),\n hydrationStarted: (payload: HydrationStartedPayload): AgentsStateAction => ({\n type: actionType(\"hydrationStarted\"),\n payload,\n }),\n hydrationSucceeded: (payload: HydrationSucceededPayload): AgentsStateAction => ({\n type: actionType(\"hydrationSucceeded\"),\n payload,\n }),\n hydrationFailed: (payload: HydrationFailedPayload): AgentsStateAction => ({\n type: actionType(\"hydrationFailed\"),\n payload,\n }),\n widgetReset: (payload: WidgetResetPayload): AgentsStateAction => ({ type: actionType(\"widgetReset\"), payload }),\n allWidgetsReset: (): AgentsStateAction => ({ type: actionType(\"allWidgetsReset\") }),\n};\n\nexport const WidgetHydrationReducer = (\n state: WidgetHydrationSliceState = initialState,\n action: AgentsStateAction,\n): WidgetHydrationSliceState => {\n switch (action.type) {\n case actionType(\"memoryEnsured\"): {\n const { key } = action.payload as MemoryEnsuredPayload;\n return state.widgets[key] ? state : withMemory(state, key, emptyMemory());\n }\n case actionType(\"instanceAttached\"): {\n const { key, instanceId } = action.payload as InstanceAttachedPayload;\n return withMemory(state, key, { ...readMemory(state, key), loadingInstanceId: instanceId });\n }\n case actionType(\"hydrationStarted\"): {\n const { key, instanceId, requestId } = action.payload as HydrationStartedPayload;\n return withMemory(state, key, {\n ...readMemory(state, key),\n status: \"loading\",\n error: null,\n inFlight: true,\n loadingInstanceId: instanceId,\n requestId,\n });\n }\n case actionType(\"hydrationSucceeded\"): {\n const { key, requestId, data } = action.payload as HydrationSucceededPayload;\n const memory = readMemory(state, key);\n if (!isCurrentRequest(memory, requestId)) return state.widgets[key] ? state : withMemory(state, key, memory);\n return withMemory(state, key, {\n ...memory,\n status: \"success\",\n error: null,\n inFlight: false,\n data,\n loadingInstanceId: null,\n requestId,\n lastLoadedAt: Date.now(),\n });\n }\n case actionType(\"hydrationFailed\"): {\n const { key, requestId, error } = action.payload as HydrationFailedPayload;\n const memory = readMemory(state, key);\n if (!isCurrentRequest(memory, requestId)) return state.widgets[key] ? state : withMemory(state, key, memory);\n return withMemory(state, key, {\n ...memory,\n status: \"error\",\n error,\n inFlight: false,\n loadingInstanceId: null,\n requestId,\n });\n }\n case actionType(\"widgetReset\"): {\n const { key } = action.payload as WidgetResetPayload;\n if (!(key in state.widgets)) return state;\n const { [key]: removedMemory, ...remainingWidgets } = state.widgets;\n return { ...state, widgets: remainingWidgets };\n }\n case actionType(\"allWidgetsReset\"):\n return { ...state, widgets: {} };\n default:\n return state;\n }\n};\n","import { useSyncExternalStore } from \"react\";\nimport type { AgentsStateAction, AgentsStateStore } from \"../../provider/environment\";\nimport { WidgetHydrationReducer } from \"./widget-hydration.reducer\";\nimport type { WidgetHydrationSliceState } from \"./widget-hydration.types\";\n\n/** The state of the package's default store: the widget hydration state under the key package code reads. */\nexport interface AgentsWidgetHydrationState {\n AIExtensionsWidgetHydration: WidgetHydrationSliceState;\n}\n\n/**\n * The package's own state store (widget hydration is one store per app): the widget hydration reducer\n * behind `useSyncExternalStore`, no Redux. Package code reads and dispatches through it whenever the app supplies no\n * `AgentsEnvironment.stateStore` (the host application supplies its Redux store, which mounts the same reducer). Actions the\n * reducer does not know (the app's \"a chat surface is open\" action) change nothing.\n */\nexport class AgentsWidgetHydrationStateContainer implements AgentsStateStore {\n protected state: AgentsWidgetHydrationState = {\n AIExtensionsWidgetHydration: WidgetHydrationReducer(undefined, { type: \"agents/widgetHydrationStoreCreated\" }),\n };\n protected readonly listeners = new Set<() => void>();\n\n getState = (): AgentsWidgetHydrationState => this.state;\n\n subscribe = (listener: () => void): (() => void) => {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n };\n\n dispatch = (action: AgentsStateAction): AgentsStateAction => {\n const nextHydrationState = WidgetHydrationReducer(this.state.AIExtensionsWidgetHydration, action);\n if (nextHydrationState === this.state.AIExtensionsWidgetHydration) return action;\n this.state = { AIExtensionsWidgetHydration: nextHydrationState };\n for (const notifyListener of [...this.listeners]) notifyListener();\n return action;\n };\n\n /** `AgentsStateStore.useSelector`: one value of the state, re-rendering when it changes. */\n useSelector = <Selected,>(selector: (state: AgentsWidgetHydrationState) => Selected): Selected => {\n const readSelectedValue = () => selector(this.state);\n return useSyncExternalStore(this.subscribe, readSelectedValue, readSelectedValue);\n };\n\n /** `AgentsStateStore.useDispatch`. */\n useDispatch = (): ((action: AgentsStateAction) => AgentsStateAction) => this.dispatch;\n}\n\n/** A new widget hydration store (a test, a second app on one page). */\nexport const createAgentsWidgetHydrationStateStore = (): AgentsStateStore =>\n new AgentsWidgetHydrationStateContainer();\n\nlet defaultStateStore: AgentsStateStore | null = null;\n\n/** The one default store of the page, created on first use. */\nexport const getDefaultAgentsStateStore = (): AgentsStateStore => {\n defaultStateStore ??= createAgentsWidgetHydrationStateStore();\n return defaultStateStore;\n};\n","type ClassNameValue = string | undefined | null | false | Readonly<Record<string, boolean | undefined | null>>;\n\n/** The class names one argument contributes: a set string, or every key of an object whose value is truthy. */\nconst readClassNamesOfValue = (value: ClassNameValue): string[] => {\n if (typeof value === \"string\") return value.length > 0 ? [value] : [];\n if (!value) return [];\n return Object.keys(value).filter((className) => className.length > 0 && Boolean(value[className]));\n};\n\n/**\n * Joins the class names that are set, skipping empty and falsy values; an object adds each key whose value is truthy\n * (`classNames(styles.card, { [styles.selected]: isSelected })`), in argument order, as the `classnames` package does.\n */\nexport const classNames = (...args: ClassNameValue[]): string => args.flatMap(readClassNamesOfValue).join(\" \");\n","import { useMemo, useState } from \"react\";\nimport ReactMarkdown, { type Components } from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\nimport type { PluggableList } from \"unified\";\nimport type {\n AgentsButtonProps,\n AgentsCheckboxProps,\n AgentsComponents,\n AgentsConversationSearchResultsListProps,\n AgentsHeroRowProps,\n AgentsHeroValueProps,\n AgentsMarkdownProps,\n AgentsSegmentBarProps,\n AgentsSkeletonTextProps,\n AgentsStatusBadgeStatus,\n AgentsStatusChipProps,\n AgentsStatusChipTone,\n AgentsWidgetFeatureGateProps,\n AgentsWidgetTextProps,\n AgentsDateInputProps,\n AgentsGlowFrameProps,\n AgentsIconProps,\n AgentsInteractiveSurfaceProps,\n AgentsLoadingSpinnerProps,\n AgentsMapMarkerProps,\n AgentsMapProps,\n AgentsModalLayerProps,\n AgentsProgressBarProps,\n AgentsRadioGroupProps,\n AgentsRangeSliderProps,\n AgentsSelectProps,\n AgentsSkeletonProps,\n AgentsSplitViewProps,\n AgentsStatusBadgeProps,\n AgentsTabsProps,\n AgentsTextAreaProps,\n AgentsTextInputProps,\n AgentsTextProps,\n AgentsTextReplacements,\n AgentsTooltipProps,\n AgentsTrendDeltaProps,\n} from \"./types\";\nimport { useAgentsTexts } from \"../AgentsProvider\";\nimport { classNames } from \"../class-names\";\n\nconst TEXT_ELEMENT_BY_ROLE = {\n title: \"h4\",\n intro: \"p\",\n body: \"span\",\n help: \"span\",\n caption: \"span\",\n} as const;\n\n/** `--token` stands for `var(--token)`; any other value is a CSS colour. */\nconst readCssColor = (color: string | undefined): string | undefined =>\n color?.startsWith(\"--\") ? `var(${color})` : color;\n\nconst readPlainReplacements = (replacements?: AgentsTextReplacements): Record<string, string | number> => {\n const plainReplacements: Record<string, string | number> = {};\n for (const [name, value] of Object.entries(replacements ?? {})) {\n if (typeof value === \"string\" || typeof value === \"number\") plainReplacements[name] = value;\n }\n return plainReplacements;\n};\n\nconst useTranslatedText = (\n text: string | undefined,\n translate = true,\n replacements?: AgentsTextReplacements,\n context?: string,\n): string | undefined => {\n const texts = useAgentsTexts();\n if (text === undefined) return undefined;\n return translate ? texts.translate(text, readPlainReplacements(replacements), context) : text;\n};\n\n/** The package's own text: an element per role, styled by `agents-text--*` classes of the package stylesheet. */\nconst DefaultText = (props: AgentsTextProps) => {\n const {\n children,\n role = \"body\",\n weight,\n color,\n translate = true,\n replacements,\n context,\n ellipsis,\n display,\n textAlign,\n textWrap,\n allowNewLines,\n headingLevel,\n ariaHidden,\n className,\n testId,\n } = props;\n const texts = useAgentsTexts();\n const Element = TEXT_ELEMENT_BY_ROLE[role];\n const content =\n typeof children === \"string\" && translate\n ? texts.translate(children, readPlainReplacements(replacements), context)\n : children;\n return (\n <Element\n data-testid={testId}\n role={headingLevel ? \"heading\" : undefined}\n aria-level={headingLevel}\n aria-hidden={ariaHidden || undefined}\n className={classNames(\n \"agents-text\",\n `agents-text--${role}`,\n weight && `agents-text--weight-${weight}`,\n ellipsis && \"agents-text--ellipsis\",\n allowNewLines && \"agents-text--new-lines\",\n className,\n )}\n style={{\n color: readCssColor(color),\n display,\n textAlign,\n whiteSpace: textWrap === \"nowrap\" || ellipsis ? \"nowrap\" : allowNewLines ? \"pre-line\" : undefined,\n }}\n >\n {content}\n </Element>\n );\n};\n\nconst DefaultIcon = (props: AgentsIconProps) => {\n const { name, hostIconName, size, pixelSize, color, className, style } = props;\n const iconName = name ?? hostIconName;\n return (\n <span\n aria-hidden\n data-icon={iconName}\n className={classNames(\"agents-icon\", size && `agents-icon--${size}`, className)}\n style={{ color: readCssColor(color), ...(pixelSize ? { width: pixelSize, height: pixelSize } : null), ...style }}\n />\n );\n};\n\nconst DefaultButton = (props: AgentsButtonProps) => {\n const {\n children,\n variant = \"primary\",\n size = \"medium\",\n onClick,\n disabled,\n isLoading,\n rounded,\n pressed,\n onDark,\n blurred,\n inverted,\n icon,\n iconPosition = \"left\",\n htmlType = \"button\",\n fullWidth,\n wrapsLabel,\n translate,\n replacements,\n className,\n testId,\n ariaLabel,\n } = props;\n const label = useTranslatedText(children, translate, replacements);\n return (\n <button\n type={htmlType}\n aria-label={ariaLabel}\n aria-pressed={pressed}\n aria-busy={isLoading || undefined}\n disabled={disabled || isLoading}\n data-testid={testId}\n onClick={onClick}\n className={classNames(\n \"agents-button\",\n `agents-button--${variant}`,\n `agents-button--${size}`,\n rounded && \"agents-button--rounded\",\n pressed && \"agents-button--pressed\",\n onDark && \"agents-button--on-dark\",\n blurred && \"agents-button--blurred\",\n inverted && \"agents-button--inverted\",\n fullWidth && \"agents-button--full-width\",\n wrapsLabel && \"agents-button--wraps-label\",\n className,\n )}\n >\n {icon && iconPosition === \"left\" ? <DefaultIcon name={icon} size=\"small\" /> : null}\n {label}\n {icon && iconPosition === \"right\" ? <DefaultIcon name={icon} size=\"small\" /> : null}\n </button>\n );\n};\n\nconst DefaultInteractiveSurface = (props: AgentsInteractiveSurfaceProps) => {\n const { children, hoverable, className, style, testId } = props;\n return (\n <div\n data-testid={testId}\n className={classNames(\"agents-interactive-surface\", hoverable && \"agents-interactive-surface--hoverable\", className)}\n style={style}\n >\n {children}\n </div>\n );\n};\n\nconst DefaultSkeleton = (props: AgentsSkeletonProps) => {\n const { width, height, borderRadius = 4, className, style } = props;\n return (\n <div\n aria-hidden\n className={classNames(\"agents-skeleton\", className)}\n style={{ width, height, borderRadius, ...style }}\n />\n );\n};\n\nconst DefaultLoadingSpinner = (_props: AgentsLoadingSpinnerProps) => (\n <span role=\"progressbar\" aria-busy className=\"agents-loading-spinner\" />\n);\n\nconst DefaultTooltip = (props: AgentsTooltipProps) => {\n const { children, text, replacements, placement = \"top\", dark } = props;\n const [isShown, setIsShown] = useState(false);\n const shownText = useTranslatedText(text, true, replacements);\n return (\n <span\n className=\"agents-tooltip\"\n style={{ position: \"relative\", display: \"inline-flex\" }}\n onMouseEnter={() => setIsShown(true)}\n onMouseLeave={() => setIsShown(false)}\n onFocus={() => setIsShown(true)}\n onBlur={() => setIsShown(false)}\n >\n {children}\n {shownText && isShown ? (\n <span\n role=\"tooltip\"\n className={classNames(\"agents-tooltip__panel\", `agents-tooltip__panel--${placement}`, dark && \"agents-tooltip__panel--dark\")}\n style={{ position: \"absolute\", bottom: \"100%\", left: \"50%\", transform: \"translateX(-50%)\" }}\n >\n {shownText}\n </span>\n ) : null}\n </span>\n );\n};\n\nconst DefaultGlowFrame = (props: AgentsGlowFrameProps) => {\n const { children, className, color, borderRadius, borderWidth } = props;\n return (\n <div\n className={classNames(\"agents-glow-frame\", className)}\n style={{ borderRadius, borderWidth, borderStyle: borderWidth ? \"solid\" : undefined, borderColor: color }}\n >\n {children}\n </div>\n );\n};\n\nconst DefaultProgressBar = (props: AgentsProgressBarProps) => {\n const { value, height, color, indeterminate } = props;\n return (\n <progress\n className=\"agents-progress-bar\"\n max={100}\n value={indeterminate ? undefined : value}\n style={{ height, accentColor: color, width: \"100%\" }}\n />\n );\n};\n\nconst DefaultSplitView = (props: AgentsSplitViewProps) => {\n const { isSideOpen, main, side, sideToggle } = props;\n return (\n <div className=\"agents-split-view\" style={{ display: \"flex\", width: \"100%\", height: \"100%\" }}>\n <div\n className=\"agents-split-view__main\"\n style={{ width: isSideOpen ? (main.narrowedWidth ?? main.width) : main.width, background: main.background }}\n >\n {main.content}\n </div>\n {sideToggle ? (\n <button type=\"button\" className=\"agents-split-view__toggle\" onClick={sideToggle.onToggle} aria-expanded={isSideOpen} />\n ) : null}\n {isSideOpen ? (\n <div className=\"agents-split-view__side\" style={{ width: side.narrowedWidth ?? side.width, background: side.background }}>\n {side.content}\n </div>\n ) : null}\n </div>\n );\n};\n\nconst DefaultTrendDelta = (props: AgentsTrendDeltaProps) => {\n const { current, previous = 0, higherIsBetter = true, format } = props;\n const change = current - previous;\n const magnitude = Math.abs(change);\n const isGood = change === 0 ? undefined : (change > 0) === higherIsBetter;\n return (\n <span\n className={classNames(\n \"agents-trend-delta\",\n isGood === true && \"agents-trend-delta--good\",\n isGood === false && \"agents-trend-delta--bad\",\n )}\n >\n {change > 0 ? \"▲ \" : change < 0 ? \"▼ \" : \"\"}\n {format ? format(magnitude) : String(magnitude)}\n </span>\n );\n};\n\nconst DefaultCheckbox = (props: AgentsCheckboxProps) => {\n const { checked, disabled, label, translate, onChange, testId } = props;\n const translatedLabel = useTranslatedText(typeof label === \"string\" ? label : undefined, translate);\n return (\n <label className=\"agents-checkbox\" data-testid={testId}>\n <input type=\"checkbox\" checked={checked ?? false} disabled={disabled} onChange={onChange} />\n {typeof label === \"string\" ? translatedLabel : label}\n </label>\n );\n};\n\nconst DefaultTextInput = (props: AgentsTextInputProps) => {\n const { id, value, type = \"text\", label, placeholder, maxLength, onChange, testId } = props;\n const translatedLabel = useTranslatedText(label);\n return (\n <label className=\"agents-text-input\">\n {translatedLabel ? <span className=\"agents-text-input__label\">{translatedLabel}</span> : null}\n <input\n id={id}\n type={type}\n value={value ?? \"\"}\n placeholder={placeholder}\n maxLength={maxLength}\n data-testid={testId}\n onChange={(event) => onChange?.(event.target.value)}\n />\n </label>\n );\n};\n\nconst DefaultTextArea = (props: AgentsTextAreaProps) => {\n const { id, value, label, placeholder, maxLength, rows, minRows, showsCounter, autoFocus, onChange, testId } = props;\n const translatedLabel = useTranslatedText(label);\n return (\n <label className=\"agents-text-area\">\n {translatedLabel ? <span className=\"agents-text-area__label\">{translatedLabel}</span> : null}\n <textarea\n id={id}\n value={value ?? \"\"}\n placeholder={placeholder}\n maxLength={maxLength}\n rows={rows ?? minRows}\n autoFocus={autoFocus}\n data-testid={testId}\n onChange={(event) => onChange?.(event.target.value)}\n />\n {showsCounter && maxLength ? (\n <span className=\"agents-text-area__counter\">{`${(value ?? \"\").length} / ${maxLength}`}</span>\n ) : null}\n </label>\n );\n};\n\nconst DefaultRangeSlider = (props: AgentsRangeSliderProps) => {\n const { value, min, max, step, onMove, onRelease } = props;\n return (\n <input\n type=\"range\"\n className=\"agents-range-slider\"\n value={value}\n min={min}\n max={max}\n step={step}\n onChange={(event) => onMove?.(Number(event.target.value))}\n onPointerUp={(event) => onRelease?.(Number(event.currentTarget.value))}\n onKeyUp={(event) => onRelease?.(Number(event.currentTarget.value))}\n />\n );\n};\n\nconst toIsoDay = (timestamp: number | undefined): string | undefined => {\n if (timestamp === undefined) return undefined;\n const day = new Date(timestamp);\n const month = String(day.getMonth() + 1).padStart(2, \"0\");\n const dayOfMonth = String(day.getDate()).padStart(2, \"0\");\n return `${day.getFullYear()}-${month}-${dayOfMonth}`;\n};\n\nconst DefaultDateInput = (props: AgentsDateInputProps) => {\n const { value, minDate, maxDate, onChange } = props;\n return (\n <input\n type=\"date\"\n className=\"agents-date-input\"\n value={toIsoDay(value) ?? \"\"}\n min={toIsoDay(minDate)}\n max={toIsoDay(maxDate)}\n onChange={(event) => {\n const [year, month, day] = event.target.value.split(\"-\").map(Number);\n onChange?.(event.target.value ? new Date(year, month - 1, day).getTime() : null);\n }}\n />\n );\n};\n\nconst DefaultRadioGroup = (props: AgentsRadioGroupProps) => {\n const { name, value, options, direction = \"column\", onChange } = props;\n return (\n <div className=\"agents-radio-group\" style={{ display: \"flex\", flexDirection: direction }}>\n {options.map((option) => (\n <label key={option.value} className=\"agents-radio-group__option\">\n <input\n type=\"radio\"\n name={name}\n value={option.value}\n checked={option.value === value}\n disabled={option.disabled}\n onChange={() => onChange(option.value)}\n />\n {option.label}\n </label>\n ))}\n </div>\n );\n};\n\nconst DefaultSelect = (props: AgentsSelectProps) => {\n const { id, value, options, placeholder, onChange, testId } = props;\n return (\n <select\n id={id}\n className=\"agents-select\"\n value={value}\n data-testid={testId}\n onChange={(event) => onChange(event.target.value)}\n >\n {placeholder !== undefined ? (\n <option value=\"\" disabled>\n {placeholder}\n </option>\n ) : null}\n {options.map((option) => (\n <option key={option.value} value={option.value} disabled={option.disabled} title={option.description}>\n {option.label}\n </option>\n ))}\n </select>\n );\n};\n\nconst DefaultTabs = (props: AgentsTabsProps) => {\n const { options, value, onChange, ariaLabel } = props;\n return (\n <div role=\"tablist\" aria-label={ariaLabel} className=\"agents-tabs\">\n {options\n .filter((option) => !option.disabled)\n .map((option) => (\n <button\n key={option.value}\n type=\"button\"\n role=\"tab\"\n aria-selected={option.value === value}\n data-testid={option.testId}\n className={classNames(\"agents-tabs__tab\", option.value === value && \"agents-tabs__tab--selected\")}\n onClick={() => onChange(option.value)}\n >\n {option.label}\n </button>\n ))}\n </div>\n );\n};\n\nconst DefaultStatusBadge = (props: AgentsStatusBadgeProps) => {\n const { status, text, translate, size, className } = props;\n const shownText = useTranslatedText(text, translate);\n return (\n <span\n className={classNames(\n \"agents-status-badge\",\n `agents-status-badge--${status}`,\n size && `agents-status-badge--${size}`,\n className,\n )}\n >\n {shownText}\n </span>\n );\n};\n\n/** No map without the app's map: a placeholder that says so. */\nconst DefaultMap = (props: AgentsMapProps) => {\n const { className, testId } = props;\n const noMapText = useTranslatedText(\"No map available.\");\n return (\n <div className={classNames(\"agents-map-placeholder\", className)} data-testid={testId} data-map=\"none\">\n {noMapText}\n </div>\n );\n};\n\nconst DefaultMapMarker = (_props: AgentsMapMarkerProps) => null;\n\nconst DefaultModalLayer = (props: AgentsModalLayerProps) => {\n const { children } = props;\n return <>{children}</>;\n};\n\nconst DefaultHeroRow = (props: AgentsHeroRowProps) => {\n const { children, className } = props;\n return (\n <div data-hero-row=\"\" className={classNames(\"agents-hero-row\", className)}>\n {children}\n </div>\n );\n};\n\nconst DefaultHeroValue = (props: AgentsHeroValueProps) => {\n const { children, color } = props;\n return (\n <span data-hero=\"\" data-hero-value=\"\" className=\"agents-hero-value\" style={{ color: readCssColor(color) }}>\n {children}\n </span>\n );\n};\n\nconst DefaultWidgetText = (props: AgentsWidgetTextProps) => {\n const {\n children,\n variant = \"inherit\",\n tone,\n color,\n weight,\n uppercase,\n tabular,\n strikethrough,\n inline = variant === \"inherit\",\n translate = typeof children === \"string\",\n context,\n replacements,\n className,\n testId,\n } = props;\n const texts = useAgentsTexts();\n const plainReplacements: Record<string, string | number> = {};\n for (const [name, value] of Object.entries(replacements ?? {})) {\n if (value !== null && value !== undefined) plainReplacements[name] = value;\n }\n const content =\n typeof children === \"string\" && translate ? texts.translate(children, plainReplacements, context) : children;\n const Element = inline ? \"span\" : \"div\";\n return (\n <Element\n data-testid={testId}\n className={classNames(\n \"agents-widget-text\",\n `agents-widget-text--${variant}`,\n tone && !color && `agents-widget-text--${tone}`,\n weight && `agents-widget-text--weight-${weight}`,\n uppercase && \"agents-widget-text--uppercase\",\n tabular && \"agents-widget-text--tabular\",\n strikethrough && \"agents-widget-text--strikethrough\",\n className,\n )}\n style={color ? { color: readCssColor(color) } : undefined}\n >\n {content}\n </Element>\n );\n};\n\nconst DefaultSkeletonText = (props: AgentsSkeletonTextProps) => {\n const { width = \"4.5em\", height = \"1em\", className } = props;\n return (\n <span\n aria-hidden\n className={classNames(\"agents-skeleton\", className)}\n style={{ display: \"inline-block\", width, height, borderRadius: 999 }}\n />\n );\n};\n\nconst STATUS_BADGE_STATUS_BY_CHIP_TONE: Record<AgentsStatusChipTone, AgentsStatusBadgeStatus> = {\n success: \"success\",\n warning: \"warning\",\n danger: \"danger\",\n neutral: \"neutral\",\n info: \"info\",\n error: \"danger\",\n};\n\nconst DefaultStatusChip = (props: AgentsStatusChipProps) => {\n const { tone = \"neutral\", children, compact = false, translate = true } = props;\n return (\n <DefaultStatusBadge\n status={STATUS_BADGE_STATUS_BY_CHIP_TONE[tone]}\n text={children}\n translate={translate}\n size=\"small\"\n hideIcon={compact || tone !== \"error\"}\n />\n );\n};\n\nconst DefaultSegmentBar = (props: AgentsSegmentBarProps) => {\n const { segments, height = 6, className, loading = false, testId } = props;\n const total = segments.reduce((sum, segment) => sum + Math.max(0, segment.value), 0);\n return (\n <div\n className={classNames(\"agents-segment-bar\", className)}\n style={{ display: \"flex\", height, borderRadius: height, overflow: \"hidden\" }}\n data-segment-bar=\"\"\n data-testid={testId}\n >\n {total > 0 || loading\n ? segments.map((segment, segmentIndex) => (\n <div\n key={segmentIndex}\n style={{\n width: loading\n ? `${100 / segments.length}%`\n : `${(Math.max(0, segment.value) / total) * 100}%`,\n background: segment.color,\n opacity: segment.muted || loading ? 0.5 : undefined,\n }}\n />\n ))\n : null}\n </div>\n );\n};\n\nconst NO_MARKDOWN_PLUGINS: PluggableList = [];\n\n/** Drops an image without a source: streamed Markdown emits a partial `![alt](` that would fetch the page itself. */\nconst MarkdownImage: Components[\"img\"] = (imageProps) => {\n const { src, node, ...otherProps } = imageProps;\n return src ? <img src={src} {...otherProps} /> : null;\n};\n\nconst DefaultMarkdown = (props: AgentsMarkdownProps) => {\n const { markdown, color, remarkPlugins = NO_MARKDOWN_PLUGINS, rehypePlugins = NO_MARKDOWN_PLUGINS, components } = props;\n const markdownComponents = useMemo(() => ({ img: MarkdownImage, ...components }) as Components, [components]);\n const markdownRemarkPlugins = useMemo(() => [remarkGfm, ...remarkPlugins], [remarkPlugins]);\n return (\n <div style={{ color }} className=\"agents-markdown\" data-markdown-blocks-root>\n <ReactMarkdown\n remarkPlugins={markdownRemarkPlugins}\n rehypePlugins={rehypePlugins}\n components={markdownComponents}\n >\n {markdown}\n </ReactMarkdown>\n </div>\n );\n};\n\n/** Without an app gate every widget is available. */\nconst DefaultWidgetFeatureGate = (props: AgentsWidgetFeatureGateProps) => {\n const { children } = props;\n return <>{children}</>;\n};\n\nconst DefaultConversationSearchResultsList = (props: AgentsConversationSearchResultsListProps) => {\n const { groups, onOpenConversation } = props;\n return (\n <ul className=\"agents-conversation-search-results\">\n {groups.map((group, groupIndex) => (\n <li key={group.conversationId ?? groupIndex} className=\"agents-conversation-search-results__group\">\n <DefaultText role=\"body\" weight=\"bold\" translate={false}>\n {group.title ?? \"\"}\n </DefaultText>\n {group.hits.map((hit, hitIndex) => (\n <button\n key={hit.messageId ?? hitIndex}\n type=\"button\"\n className=\"agents-conversation-search-results__hit\"\n onClick={() => {\n if (group.conversationId !== undefined) onOpenConversation(group.conversationId, hit.messageId);\n }}\n >\n <DefaultText role=\"help\" translate={false}>\n {hit.excerpt ?? \"\"}\n </DefaultText>\n </button>\n ))}\n </li>\n ))}\n </ul>\n );\n};\n\n/** The package default of every replaceable component. */\nexport const DEFAULT_AGENTS_COMPONENTS: AgentsComponents = {\n Text: DefaultText,\n Button: DefaultButton,\n Icon: DefaultIcon,\n InteractiveSurface: DefaultInteractiveSurface,\n Skeleton: DefaultSkeleton,\n LoadingSpinner: DefaultLoadingSpinner,\n Tooltip: DefaultTooltip,\n GlowFrame: DefaultGlowFrame,\n ProgressBar: DefaultProgressBar,\n SplitView: DefaultSplitView,\n TrendDelta: DefaultTrendDelta,\n Checkbox: DefaultCheckbox,\n TextInput: DefaultTextInput,\n TextArea: DefaultTextArea,\n RangeSlider: DefaultRangeSlider,\n DateInput: DefaultDateInput,\n RadioGroup: DefaultRadioGroup,\n Select: DefaultSelect,\n Tabs: DefaultTabs,\n StatusBadge: DefaultStatusBadge,\n Map: DefaultMap,\n MapMarker: DefaultMapMarker,\n ModalLayer: DefaultModalLayer,\n HeroRow: DefaultHeroRow,\n HeroValue: DefaultHeroValue,\n WidgetText: DefaultWidgetText,\n SkeletonText: DefaultSkeletonText,\n StatusChip: DefaultStatusChip,\n SegmentBar: DefaultSegmentBar,\n Markdown: DefaultMarkdown,\n WidgetFeatureGate: DefaultWidgetFeatureGate,\n ConversationSearchResultsList: DefaultConversationSearchResultsList,\n};\n","import type { ComponentType, ErrorInfo, ReactNode } from \"react\";\nimport type { AgentsComponents } from \"./components/types\";\nimport type { ConversationWidgetStatePartition } from \"../renderer/conversation-widget-state-partition\";\nimport type { ChatAssistantCategory } from \"../chat/chat-assistant-identity\";\nimport type { ComposedNodeSchemaApplicationPart } from \"../renderer/widget-tree/composed-node-schema\";\nimport type { CanvasBehaviour } from \"../renderer/canvas/canvas-behaviours\";\n\n/** Translates interface copy. The key is the English source text. */\nexport interface AgentsTexts {\n translate: (key: string, replacements?: Record<string, string | number>, context?: string) => string;\n}\n\n/** One image of a gallery the app opens over the page. */\nexport interface AgentsGalleryImage {\n /** Identifies the image within the gallery. */\n id: string;\n url: string;\n name?: string;\n}\n\n/** An action the package dispatches into the state store. */\nexport interface AgentsStateAction {\n type: string;\n payload?: unknown;\n}\n\n/**\n * A state store as React hooks: the package keeps its widget hydration state in it, and an app's older chat state\n * partitions are read through it (`defaultChatStatePartition`). Without an app store the package uses its own.\n */\nexport interface AgentsStateStore {\n useSelector: <Selected>(selector: (state: any) => Selected) => Selected;\n useDispatch: () => (action: AgentsStateAction) => unknown;\n}\n\n/** The owner's language and the active agent space's date and time settings. Every field may be missing. */\nexport interface AgentsOwnerSettings {\n /** The owner's language (`de`). */\n languageCode?: string | null;\n /** The owner's locale (`de-DE`). */\n locale?: string | null;\n /** The date locale of the active agent space (`de-DE`). */\n dateLocale?: string | null;\n /** The time zone of the active agent space. */\n timeZone?: string | null;\n /** The active agent space writes times with AM/PM. */\n usesAmPm?: boolean | null;\n}\n\n/** What the error card of a reached budget offers (the error card's upgrade data). */\nexport interface AgentsBudgetLimit {\n /** An upgrade lifts the limit: the card offers it. */\n canUpgrade: boolean;\n /** Opens the app's upgrade flow. */\n openUpgrade: () => void;\n /** The app presents the budget as a fair-use allowance (the card uses that wording). */\n showsFairUseWording: boolean;\n}\n\n/** The badge of a named assistant's icon (its intro card, its openings). */\nexport interface AgentsAssistantIconBadgeProps {\n /** The icon's name in the app's icon set (`ChatAssistantIdentity.iconClass`). */\n iconName: string;\n color: string;\n backgroundColor: string;\n /** Larger on the intro card than on an opening. */\n isLarge?: boolean;\n}\n\n/** The background of a chat with a named assistant's category (or with none, the overview of every category). */\nexport interface AgentsAssistantBackgroundProps {\n category?: ChatAssistantCategory;\n /** The category's alias; undefined for a chat without a category. */\n categoryAlias?: string;\n}\n\n/** The state of the app's map script loader. */\nexport interface AgentsMapsLoaderState {\n isLoaded: boolean;\n loadError: Error | undefined;\n languageCode: string | undefined;\n}\n\n/**\n * Further names of the sandbox and readiness signals that an app declares beside the package's own (`AGENTS_VISUALIZATION`,\n * `--agents-*`, `__AGENTS_WIDGET_IMAGE_V1__`, `__AGENTS_WIDGET_PREVIEW_V1__`): the names its stored visualization scripts,\n * its skill texts or its headless capture already use. Every list is optional; the package's names always exist.\n */\nexport type AgentsSandboxLegacyAliases = {\n /** Further names of the sandbox global, e.g. the name stored scripts of the app read. */\n visualizationGlobalNames?: string[];\n /** Further prefixes of the frame's theme variables, e.g. `--app-` (each variable is set under every prefix). */\n themeVariablePrefixes?: string[];\n /** Further names of the image-capture readiness signal on `window`. */\n imageReadinessGlobalNames?: string[];\n /** Further names of the preview readiness signal on `window`. */\n previewReadinessGlobalNames?: string[];\n};\n\n/**\n * Everything an app supplies to the package. Every member is optional: the package has a default for each.\n * An app sets it once at start (`setAgentsEnvironment`) or per subtree (`AgentsProvider`); the functions are read\n * from the app-wide environment only.\n */\nexport interface AgentsEnvironment {\n /**\n * The state store hooks (see `AgentsStateStore`). Default: the package's own widget hydration store (one per page,\n * `createAgentsWidgetHydrationStateStore`). An app supplies its own to keep the hydration state in its store\n * (host application: its Redux store, which mounts `WidgetHydrationReducer` under `AIExtensionsWidgetHydration`).\n */\n stateStore?: AgentsStateStore;\n /**\n * The partition of the app's own chat state a widget provider reads when its host passes neither a chat store nor a\n * partition (host application: the AI-Extensions chat's slice). Default: none — such a provider keeps a store of its own.\n */\n defaultChatStatePartition?: ConversationWidgetStatePartition;\n /** A React hook returning the owner's settings. Default: none known (the browser's language stands in). */\n useOwnerSettings?: () => AgentsOwnerSettings;\n /**\n * A React hook returning the key of the agent space the owner works in. The key of an agent space is what the\n * client knows it by: the id of the space, unless the app's backend hands out another key\n * (`AgentSpace::getWidgetSelfHydrationKey()`). Default: no agent space.\n */\n useActiveAgentSpaceKey?: () => number | undefined;\n /** Reads the display name of an agent space (the header of a widget of another agent space). Default: no name. */\n readAgentSpaceName?: (agentSpaceKey: number, signal: AbortSignal) => Promise<string | undefined>;\n /**\n * The field of a widget block that carries the key of the block's agent space, as the app's backend writes it\n * (`WidgetBlockFieldNames::WIDGET_SELF_HYDRATION_KEY`). An app whose stored conversations use another field name\n * declares it here and in its backend class. Default: `agentSpaceId`.\n */\n widgetSelfHydrationKeyFieldName?: string;\n /**\n * The owner's text for a click on a widget of another agent space than the active one: returns the text with the\n * suffix the app's backend reads that agent space from\n * (`WidgetBlockFieldNames::OWNER_TEXT_SUFFIX_PATTERN_OF_ANOTHER_SPACE`). Default: the text unchanged.\n */\n appendAnotherAgentSpaceToOwnerText?: (ownerText: string, anotherAgentSpaceKey: number) => string;\n /** The label of an agent space whose name is not known. Default: `#<key>`. */\n buildUnnamedAgentSpaceLabel?: (agentSpaceKey: number) => string;\n /**\n * The sentence that tells the owner that a widget shows another agent space than the active one; `agentSpaceLabel`\n * is its name or the label above. Default: a sentence that names no kind of agent space.\n */\n buildWidgetOfAnotherAgentSpaceExplanation?: (agentSpaceLabel: string) => string;\n /** The name the owner knows the agent by, for the interface texts that name it. Default: `the assistant`. */\n agentDisplayName?: string;\n /** A React hook returning what the error card of a reached budget offers. Default: no upgrade, the plain wording. */\n useBudgetLimit?: () => AgentsBudgetLimit;\n /** A React hook returning the map script loader's state. Default: no maps. */\n useMapsLoader?: () => AgentsMapsLoaderState;\n /**\n * The action that tells the app whether an agent chat surface is open (dispatched into the state store when the\n * first surface mounts and the last unmounts). Default: nothing is dispatched.\n */\n buildChatSurfaceOpenChangedAction?: (isOpen: boolean) => AgentsStateAction;\n components?: Partial<AgentsComponents>;\n texts?: AgentsTexts;\n /**\n * Prepares a plain text (a model's words, a business name) for the app's `Text`, `Button` and `StatusBadge`\n * replacements, which may read a string as markup. Default: the text unchanged.\n */\n escapePlainTextForText?: (text: string) => string;\n /** Opens the images in the app's lightbox, starting at `startIndex`. Default: the start image in a new tab. */\n openImageGallery?: (images: AgentsGalleryImage[], startIndex: number) => void;\n /** Reports a widget that crashed while rendering. Default: nothing (the crash is logged to the console). */\n reportWidgetCrash?: (widgetName: string, error: Error, errorInfo: ErrorInfo) => void;\n /**\n * The footer under an assistant message (host application: the admin's forensics panel, which gates itself). Receives the\n * message as the message view got it. Default: none.\n */\n MessageFooter?: ComponentType<{ message?: unknown }>;\n /**\n * The colour theme class of a named assistant's category (the assistant identity and theme). Default:\n * none — the generic chat colours.\n */\n readAssistantThemeClassName?: (categoryAlias: string) => string;\n /** The badge of a named assistant's icon. Default: none. */\n AssistantIconBadge?: ComponentType<AgentsAssistantIconBadgeProps>;\n /** The chat's own background when the host paints none (host application: the category illustrations). Default: none. */\n AssistantBackground?: ComponentType<AgentsAssistantBackgroundProps>;\n /**\n * Wraps the body of an open canvas (host application: page components inside a canvas must not mirror their filters into\n * the page URL). Default: no wrapper.\n */\n CanvasBodyContainer?: ComponentType<{ children: ReactNode }>;\n /**\n * Tells the app that a turn of the agent runs in an open chat (the host application keeps the tab \"ambient active\" then);\n * returns the release the chat calls when the turn ends. Default: nothing.\n */\n reportRunningTurn?: () => () => void;\n /**\n * Further names of the CustomVisualization sandbox (its global, its theme variable prefixes) and of the image and\n * preview readiness signals, beside the package's own names (see `AgentsSandboxLegacyAliases`). An app whose stored\n * scripts or capture read older names declares them here. Default: none — only the package's names exist.\n */\n sandboxLegacyAliases?: AgentsSandboxLegacyAliases;\n /**\n * The app's part of the ComposedView node schema: the node types, widgets (which embed, at which size), data sources\n * and entity types its own classes declare, as its backend generates them beside the package's\n * `composed-node-schema.json`. The tree readers and the kit read the package's schema with this part added\n * (`getComposedNodeSchema`). Default: none — only the package's own types exist.\n */\n composedNodeSchemaApplicationPart?: ComposedNodeSchemaApplicationPart;\n /**\n * The path prefix of the app's API reads a live widget image capture lets through (same origin, GET only, sent with\n * the capture's bearer; every other request of the capture fails it). Default: `/api/`.\n */\n widgetImageCaptureReadPathPrefix?: string;\n /**\n * The app's widgets that draw a Google map: a widget image capture of one of them, or of a `ComposedView` that embeds\n * one, may load the Maps SDK (the narrow transport exception of the capture; the twin of the backend's list that opens\n * the capture page's CSP). A `ComposedView` holding a `Map` node always may. Default: none.\n */\n googleMapWidgetNames?: string[];\n /**\n * Further `signalSource`s a widget click of the app posts (`injectSignal`), beside the package's own\n * (`FRONTEND_WIDGET_CLICK`, `OWNER_ACTION_CONFIRM`): the message list reads every one of them as the owner's answer to\n * a widget, so an answered widget never comes back interactive after a reload. Default: none.\n */\n furtherWidgetClickSignalSources?: string[];\n /**\n * The canvases of the app's widgets (canvas id → behaviour), beside the package's own (`packageCanvasBehaviours`):\n * every canvas an app widget lists in `opensCanvases`. The app registers each one's body with `registerCanvasBodies`\n * and, when gated, its requirement with `registerCanvasFeatureFlags`. A package canvas id here is ignored. Default:\n * none.\n */\n furtherCanvasBehaviours?: Readonly<Record<string, CanvasBehaviour>>;\n}\n\nlet appEnvironment: AgentsEnvironment = {};\nconst environmentListeners = new Set<() => void>();\n\n/** Sets the app-wide environment. Call it once before the first render; a later call re-renders the readers. */\nexport const setAgentsEnvironment = (environment: AgentsEnvironment): void => {\n appEnvironment = environment;\n for (const notifyListener of environmentListeners) notifyListener();\n};\n\nexport const getAgentsEnvironment = (): AgentsEnvironment => appEnvironment;\n\nexport const subscribeToAgentsEnvironment = (listener: () => void): (() => void) => {\n environmentListeners.add(listener);\n return () => {\n environmentListeners.delete(listener);\n };\n};\n\nconst substitutePlaceholders = (key: string, replacements?: Record<string, string | number>): string =>\n replacements\n ? key.replace(/%([A-Za-z0-9_]+)%/g, (placeholder, name: string) =>\n name in replacements ? String(replacements[name]) : placeholder,\n )\n : key;\n\n/** The package default: the English key with its placeholders substituted. */\nexport const DEFAULT_AGENTS_TEXTS: AgentsTexts = { translate: substitutePlaceholders };\n\n/** Translates an interface text through the app-wide environment, for a string a component hands on (a label). */\nexport const translateText = (key: string, replacements?: Record<string, string | number>, context?: string): string =>\n (appEnvironment.texts ?? DEFAULT_AGENTS_TEXTS).translate(key, replacements, context);\n\n/** A plain text as the app's text components take it (`AgentsEnvironment.escapePlainTextForText`). */\nexport const escapePlainTextForText = (text: string): string =>\n appEnvironment.escapePlainTextForText ? appEnvironment.escapePlainTextForText(text) : text;\n\n/** Opens an image gallery over the page (`AgentsEnvironment.openImageGallery`). */\nexport const openImageGallery = (images: AgentsGalleryImage[], startIndex: number): void => {\n if (appEnvironment.openImageGallery) {\n appEnvironment.openImageGallery(images, startIndex);\n return;\n }\n const startImage = images[startIndex];\n if (startImage) window.open(startImage.url, \"_blank\", \"noopener,noreferrer\");\n};\n\n/** The block field of the package's backend default (`WidgetBlockFieldNames::WIDGET_SELF_HYDRATION_KEY`). */\nexport const DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME = \"agentSpaceId\";\n\n/** The field of a widget block that carries the key of its agent space (`AgentsEnvironment.widgetSelfHydrationKeyFieldName`). */\nexport const getWidgetSelfHydrationKeyFieldName = (): string =>\n appEnvironment.widgetSelfHydrationKeyFieldName ?? DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME;\n\n/** The owner's text for a click on a widget of another agent space (`AgentsEnvironment.appendAnotherAgentSpaceToOwnerText`). */\nexport const appendAnotherAgentSpaceToOwnerText = (ownerText: string, anotherAgentSpaceKey: number): string =>\n appEnvironment.appendAnotherAgentSpaceToOwnerText\n ? appEnvironment.appendAnotherAgentSpaceToOwnerText(ownerText, anotherAgentSpaceKey)\n : ownerText;\n\n/** The label of an agent space without a known name (`AgentsEnvironment.buildUnnamedAgentSpaceLabel`). */\nexport const buildUnnamedAgentSpaceLabel = (agentSpaceKey: number): string =>\n appEnvironment.buildUnnamedAgentSpaceLabel ? appEnvironment.buildUnnamedAgentSpaceLabel(agentSpaceKey) : `#${agentSpaceKey}`;\n\n/** The sentence under a widget of another agent space (`AgentsEnvironment.buildWidgetOfAnotherAgentSpaceExplanation`). */\nexport const buildWidgetOfAnotherAgentSpaceExplanation = (agentSpaceLabel: string): string =>\n appEnvironment.buildWidgetOfAnotherAgentSpaceExplanation\n ? appEnvironment.buildWidgetOfAnotherAgentSpaceExplanation(agentSpaceLabel)\n : translateText(\"This widget shows data for %label%, not for what you currently have selected.\", {\n label: agentSpaceLabel,\n });\n\n/** The further sandbox and readiness names the app declares (`AgentsEnvironment.sandboxLegacyAliases`). */\nexport const getSandboxLegacyAliases = (): AgentsSandboxLegacyAliases => appEnvironment.sandboxLegacyAliases ?? {};\n\n/** The package default of `AgentsEnvironment.widgetImageCaptureReadPathPrefix`. */\nexport const DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX = \"/api/\";\n\n/** The path prefix of the API reads a live widget image capture lets through (`AgentsEnvironment.widgetImageCaptureReadPathPrefix`). */\nexport const getWidgetImageCaptureReadPathPrefix = (): string =>\n appEnvironment.widgetImageCaptureReadPathPrefix ?? DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX;\n\n/** The app's widgets that draw a Google map (`AgentsEnvironment.googleMapWidgetNames`). */\nexport const getGoogleMapWidgetNames = (): readonly string[] => appEnvironment.googleMapWidgetNames ?? [];\n\n/** The app's further widget click signal sources (`AgentsEnvironment.furtherWidgetClickSignalSources`). */\nexport const getFurtherWidgetClickSignalSources = (): readonly string[] =>\n appEnvironment.furtherWidgetClickSignalSources ?? [];\n\n/** The canvases of the app's widgets (`AgentsEnvironment.furtherCanvasBehaviours`). */\nexport const getFurtherCanvasBehaviours = (): Readonly<Record<string, CanvasBehaviour>> =>\n appEnvironment.furtherCanvasBehaviours ?? {};\n\n/** The name the owner knows the agent by (`AgentsEnvironment.agentDisplayName`). */\nexport const getAgentDisplayName = (): string => appEnvironment.agentDisplayName ?? translateText(\"the assistant\");\n\n/** Reports a running turn of an open chat (`AgentsEnvironment.reportRunningTurn`); returns the release. */\nexport const reportRunningTurn = (): (() => void) | undefined => appEnvironment.reportRunningTurn?.();\n\n/** Reports a crashed widget (`AgentsEnvironment.reportWidgetCrash`). */\nexport const reportWidgetCrash = (widgetName: string, error: Error, errorInfo: ErrorInfo): void => {\n appEnvironment.reportWidgetCrash?.(widgetName, error, errorInfo);\n};\n","import { createContext, type ReactNode, useContext, useMemo, useSyncExternalStore } from \"react\";\nimport type { AgentsConversationClient } from \"../client/AgentsConversationClient\";\nimport { AgentsConversationClientProvider } from \"../client/AgentsConversationClientContext\";\nimport { getDefaultAgentsStateStore } from \"../renderer/widget-hydration/widget-hydration-state-store\";\nimport { DEFAULT_AGENTS_COMPONENTS } from \"./components/default-components\";\nimport type { AgentsComponents } from \"./components/types\";\nimport {\n type AgentsBudgetLimit,\n type AgentsEnvironment,\n type AgentsMapsLoaderState,\n type AgentsOwnerSettings,\n type AgentsStateAction,\n type AgentsTexts,\n DEFAULT_AGENTS_TEXTS,\n getAgentsEnvironment,\n subscribeToAgentsEnvironment,\n} from \"./environment\";\n\nconst AgentsEnvironmentContext = createContext<AgentsEnvironment | null>(null);\n\nexport interface AgentsProviderProps {\n /** The subtree's environment; members it leaves out fall back to the app-wide one, then to the defaults. */\n environment?: AgentsEnvironment;\n /** The conversation client the chat below reads and sends through (the one required input of a chat). */\n client?: AgentsConversationClient;\n children: ReactNode;\n}\n\nconst NO_SUBTREE_ENVIRONMENT: AgentsEnvironment = {};\n\n/**\n * Supplies an environment and the conversation client to one subtree. `<AgentsProvider client={client}><AgentChat />\n * </AgentsProvider>` is a whole chat with the package defaults.\n */\nexport const AgentsProvider = (props: AgentsProviderProps) => {\n const { environment = NO_SUBTREE_ENVIRONMENT, client, children } = props;\n const environmentTree = <AgentsEnvironmentContext.Provider value={environment}>{children}</AgentsEnvironmentContext.Provider>;\n return client ? (\n <AgentsConversationClientProvider client={client}>{environmentTree}</AgentsConversationClientProvider>\n ) : (\n environmentTree\n );\n};\n\nconst useAppEnvironment = (): AgentsEnvironment =>\n useSyncExternalStore(subscribeToAgentsEnvironment, getAgentsEnvironment, getAgentsEnvironment);\n\n/** The components package code renders: the subtree's replacements over the app's over the package defaults. */\nexport const useAgentsComponents = (): AgentsComponents => {\n const subtreeEnvironment = useContext(AgentsEnvironmentContext);\n const appEnvironment = useAppEnvironment();\n return useMemo(\n () => ({ ...DEFAULT_AGENTS_COMPONENTS, ...appEnvironment.components, ...subtreeEnvironment?.components }),\n [appEnvironment, subtreeEnvironment],\n );\n};\n\nexport const useAgentsTexts = (): AgentsTexts => {\n const subtreeEnvironment = useContext(AgentsEnvironmentContext);\n const appEnvironment = useAppEnvironment();\n return subtreeEnvironment?.texts ?? appEnvironment.texts ?? DEFAULT_AGENTS_TEXTS;\n};\n\n/** The environment of this subtree: its own members over the app-wide ones. */\nexport const useAgentsEnvironment = (): AgentsEnvironment => {\n const subtreeEnvironment = useContext(AgentsEnvironmentContext);\n const appEnvironment = useAppEnvironment();\n return useMemo(\n () => (subtreeEnvironment ? { ...appEnvironment, ...subtreeEnvironment } : appEnvironment),\n [appEnvironment, subtreeEnvironment],\n );\n};\n\n/** The app's state store, else the package's own widget hydration store. */\nconst readStateStore = (environment: AgentsEnvironment) => environment.stateStore ?? getDefaultAgentsStateStore();\n\n/** Reads from the state store (`AgentsEnvironment.stateStore`, else the package's default store). */\nexport const useAgentsStateSelector = <Selected,>(selector: (state: any) => Selected): Selected =>\n readStateStore(useAgentsEnvironment()).useSelector(selector);\n\n/** The dispatch of the state store (`AgentsEnvironment.stateStore`, else the package's default store). */\nexport const useAgentsStateDispatch = (): ((action: AgentsStateAction) => unknown) =>\n readStateStore(useAgentsEnvironment()).useDispatch();\n\nconst NO_OWNER_SETTINGS: AgentsOwnerSettings = {};\nconst useNoOwnerSettings = (): AgentsOwnerSettings => NO_OWNER_SETTINGS;\n\n/** The owner's language and the active agent space's date and time settings (`AgentsEnvironment.useOwnerSettings`). */\nexport const useAgentsOwnerSettings = (): AgentsOwnerSettings => {\n const useOwnerSettings = useAgentsEnvironment().useOwnerSettings ?? useNoOwnerSettings;\n return useOwnerSettings();\n};\n\nconst useNoActiveAgentSpaceKey = (): number | undefined => undefined;\n\n/** The key of the agent space the owner works in (`AgentsEnvironment.useActiveAgentSpaceKey`). */\nexport const useAgentsActiveAgentSpaceKey = (): number | undefined => {\n const useActiveAgentSpaceKey = useAgentsEnvironment().useActiveAgentSpaceKey ?? useNoActiveAgentSpaceKey;\n return useActiveAgentSpaceKey();\n};\n\nconst NO_MAPS: AgentsMapsLoaderState = {\n isLoaded: false,\n loadError: new Error(\"The agents environment has no maps loader.\"),\n languageCode: undefined,\n};\nconst useNoMapsLoader = (): AgentsMapsLoaderState => NO_MAPS;\n\n/** The map script loader's state (`AgentsEnvironment.useMapsLoader`). */\nexport const useAgentsMapsLoader = (): AgentsMapsLoaderState => {\n const useMapsLoader = useAgentsEnvironment().useMapsLoader ?? useNoMapsLoader;\n return useMapsLoader();\n};\n\nconst NO_BUDGET_UPGRADE: AgentsBudgetLimit = { canUpgrade: false, openUpgrade: () => undefined, showsFairUseWording: false };\nconst useNoBudgetLimit = (): AgentsBudgetLimit => NO_BUDGET_UPGRADE;\n\n/** What the error card of a reached budget offers (`AgentsEnvironment.useBudgetLimit`). */\nexport const useAgentsBudgetLimit = (): AgentsBudgetLimit => {\n const useBudgetLimit = useAgentsEnvironment().useBudgetLimit ?? useNoBudgetLimit;\n return useBudgetLimit();\n};\n","import { useAgentsComponents } from \"../AgentsProvider\";\nimport type {\n AgentsButtonProps,\n AgentsCheckboxProps,\n AgentsDateInputProps,\n AgentsGlowFrameProps,\n AgentsIconProps,\n AgentsInteractiveSurfaceProps,\n AgentsLoadingSpinnerProps,\n AgentsMapMarkerProps,\n AgentsMapProps,\n AgentsModalLayerProps,\n AgentsProgressBarProps,\n AgentsRadioGroupProps,\n AgentsRangeSliderProps,\n AgentsSelectProps,\n AgentsSkeletonProps,\n AgentsSplitViewProps,\n AgentsStatusBadgeProps,\n AgentsTabsProps,\n AgentsTextAreaProps,\n AgentsTextInputProps,\n AgentsTextProps,\n AgentsTooltipProps,\n AgentsTrendDeltaProps,\n AgentsHeroRowProps,\n AgentsHeroValueProps,\n AgentsWidgetTextProps,\n AgentsSkeletonTextProps,\n AgentsStatusChipProps,\n AgentsSegmentBarProps,\n AgentsMarkdownProps,\n AgentsWidgetFeatureGateProps,\n AgentsConversationSearchResultsListProps,\n} from \"./types\";\n\n/**\n * The components package code imports. Each renders the app's replacement when the environment has one, else the\n * package default — package code never imports an app's component library.\n */\nexport const Text = (props: AgentsTextProps) => {\n const { Text: TextComponent } = useAgentsComponents();\n return <TextComponent {...props} />;\n};\n\nexport const Button = (props: AgentsButtonProps) => {\n const { Button: ButtonComponent } = useAgentsComponents();\n return <ButtonComponent {...props} />;\n};\n\nexport const Icon = (props: AgentsIconProps) => {\n const { Icon: IconComponent } = useAgentsComponents();\n return <IconComponent {...props} />;\n};\n\nexport const InteractiveSurface = (props: AgentsInteractiveSurfaceProps) => {\n const { InteractiveSurface: InteractiveSurfaceComponent } = useAgentsComponents();\n return <InteractiveSurfaceComponent {...props} />;\n};\n\nexport const Skeleton = (props: AgentsSkeletonProps) => {\n const { Skeleton: SkeletonComponent } = useAgentsComponents();\n return <SkeletonComponent {...props} />;\n};\n\nexport const LoadingSpinner = (props: AgentsLoadingSpinnerProps) => {\n const { LoadingSpinner: LoadingSpinnerComponent } = useAgentsComponents();\n return <LoadingSpinnerComponent {...props} />;\n};\n\nexport const Tooltip = (props: AgentsTooltipProps) => {\n const { Tooltip: TooltipComponent } = useAgentsComponents();\n return <TooltipComponent {...props} />;\n};\n\nexport const GlowFrame = (props: AgentsGlowFrameProps) => {\n const { GlowFrame: GlowFrameComponent } = useAgentsComponents();\n return <GlowFrameComponent {...props} />;\n};\n\nexport const ProgressBar = (props: AgentsProgressBarProps) => {\n const { ProgressBar: ProgressBarComponent } = useAgentsComponents();\n return <ProgressBarComponent {...props} />;\n};\n\nexport const SplitView = (props: AgentsSplitViewProps) => {\n const { SplitView: SplitViewComponent } = useAgentsComponents();\n return <SplitViewComponent {...props} />;\n};\n\nexport const TrendDelta = (props: AgentsTrendDeltaProps) => {\n const { TrendDelta: TrendDeltaComponent } = useAgentsComponents();\n return <TrendDeltaComponent {...props} />;\n};\n\nexport const Checkbox = (props: AgentsCheckboxProps) => {\n const { Checkbox: CheckboxComponent } = useAgentsComponents();\n return <CheckboxComponent {...props} />;\n};\n\nexport const TextInput = (props: AgentsTextInputProps) => {\n const { TextInput: TextInputComponent } = useAgentsComponents();\n return <TextInputComponent {...props} />;\n};\n\nexport const TextArea = (props: AgentsTextAreaProps) => {\n const { TextArea: TextAreaComponent } = useAgentsComponents();\n return <TextAreaComponent {...props} />;\n};\n\nexport const RangeSlider = (props: AgentsRangeSliderProps) => {\n const { RangeSlider: RangeSliderComponent } = useAgentsComponents();\n return <RangeSliderComponent {...props} />;\n};\n\nexport const DateInput = (props: AgentsDateInputProps) => {\n const { DateInput: DateInputComponent } = useAgentsComponents();\n return <DateInputComponent {...props} />;\n};\n\nexport const RadioGroup = (props: AgentsRadioGroupProps) => {\n const { RadioGroup: RadioGroupComponent } = useAgentsComponents();\n return <RadioGroupComponent {...props} />;\n};\n\nexport const Select = (props: AgentsSelectProps) => {\n const { Select: SelectComponent } = useAgentsComponents();\n return <SelectComponent {...props} />;\n};\n\nexport const Tabs = (props: AgentsTabsProps) => {\n const { Tabs: TabsComponent } = useAgentsComponents();\n return <TabsComponent {...props} />;\n};\n\nexport const StatusBadge = (props: AgentsStatusBadgeProps) => {\n const { StatusBadge: StatusBadgeComponent } = useAgentsComponents();\n return <StatusBadgeComponent {...props} />;\n};\n\nexport const Map = (props: AgentsMapProps) => {\n const { Map: MapComponent } = useAgentsComponents();\n return <MapComponent {...props} />;\n};\n\nexport const MapMarker = (props: AgentsMapMarkerProps) => {\n const { MapMarker: MapMarkerComponent } = useAgentsComponents();\n return <MapMarkerComponent {...props} />;\n};\n\nexport const ModalLayer = (props: AgentsModalLayerProps) => {\n const { ModalLayer: ModalLayerComponent } = useAgentsComponents();\n return <ModalLayerComponent {...props} />;\n};\n\nexport const HeroRow = (props: AgentsHeroRowProps) => {\n const { HeroRow: HeroRowComponent } = useAgentsComponents();\n return <HeroRowComponent {...props} />;\n};\n\nexport const HeroValue = (props: AgentsHeroValueProps) => {\n const { HeroValue: HeroValueComponent } = useAgentsComponents();\n return <HeroValueComponent {...props} />;\n};\n\nexport const WidgetText = (props: AgentsWidgetTextProps) => {\n const { WidgetText: WidgetTextComponent } = useAgentsComponents();\n return <WidgetTextComponent {...props} />;\n};\n\nexport const SkeletonText = (props: AgentsSkeletonTextProps) => {\n const { SkeletonText: SkeletonTextComponent } = useAgentsComponents();\n return <SkeletonTextComponent {...props} />;\n};\n\nexport const StatusChip = (props: AgentsStatusChipProps) => {\n const { StatusChip: StatusChipComponent } = useAgentsComponents();\n return <StatusChipComponent {...props} />;\n};\n\nexport const SegmentBar = (props: AgentsSegmentBarProps) => {\n const { SegmentBar: SegmentBarComponent } = useAgentsComponents();\n return <SegmentBarComponent {...props} />;\n};\n\nexport const Markdown = (props: AgentsMarkdownProps) => {\n const { Markdown: MarkdownComponent } = useAgentsComponents();\n return <MarkdownComponent {...props} />;\n};\n\nexport const WidgetFeatureGate = (props: AgentsWidgetFeatureGateProps) => {\n const { WidgetFeatureGate: WidgetFeatureGateComponent } = useAgentsComponents();\n return <WidgetFeatureGateComponent {...props} />;\n};\n\nexport const ConversationSearchResultsList = (props: AgentsConversationSearchResultsListProps) => {\n const { ConversationSearchResultsList: ConversationSearchResultsListComponent } = useAgentsComponents();\n return <ConversationSearchResultsListComponent {...props} />;\n};\n\nexport type * from \"./types\";\nexport { AGENTS_ICON_NAMES, isAgentsIconName } from \"./icon-names\";\n"],"names":["appEnvironment"],"mappings":";;;;;;AASA,MAAM,aAAa;AAEnB,MAAM,cAAc,MAAoB;AACtC,SAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,mBAAmB;AAAA,IACnB,UAAU;AAAA,IACV,WAAW;AAAA,IACX,cAAc;AAAA,EAAA;AAElB;AAEA,MAAM,eAA0C;AAAA,EAC9C,SAAS,CAAA;AACX;AAEA,MAAM,aAAa,CAAC,OAAkC,QAA8B,MAAM,QAAQ,GAAG,KAAK,YAAA;AAE1G,MAAM,aAAa,CAAC,OAAkC,KAAa,YAAqD;AAAA,EACtH,GAAG;AAAA,EACH,SAAS,EAAE,GAAG,MAAM,SAAS,CAAC,GAAG,GAAG,OAAA;AACtC;AAGA,MAAM,mBAAmB,CAAC,QAAsB,cAC9C,OAAO,cAAc,KAAK,OAAO,cAAc;AA4BjD,MAAM,aAAa,CAAC,SAAyB,GAAG,UAAU,IAAI,IAAI;AAG3D,MAAM,uBAAuB;AAAA,EAClC,eAAe,CAAC,aAAsD,EAAE,MAAM,WAAW,eAAe,GAAG;EAC3G,kBAAkB,CAAC,aAAyD;AAAA,IAC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AEO,MAAM,aAAa,CAAC,UAAiC;AAC1D,QAAM,EAAE,YAAY,oBAAA,IAAwB,oBAAA;AAC5C,SAAO,oBAAC,qBAAA,EAAqB,GAAG,MAAA,CAAO;AACzC;AAEO,MAAM,eAAe,CAAC,UAAmC;AAC9D,QAAM,EAAE,cAAc,sBAAA,IAA0B,oBAAA;AAChD,SAAO,oBAAC,uBAAA,EAAuB,GAAG,MAAA,CAAO;AAC3C;AAEO,MAAM,aAAa,CAAC,UAAiC;AAC1D,QAAM,EAAE,YAAY,oBAAA,IAAwB,oBAAA;AAC5C,SAAO,oBAAC,qBAAA,EAAqB,GAAG,MAAA,CAAO;AACzC;AAEO,MAAM,aAAa,CAAC,UAAiC;AAC1D,QAAM,EAAE,YAAY,oBAAA,IAAwB,oBAAA;AAC5C,SAAO,oBAAC,qBAAA,EAAqB,GAAG,MAAA,CAAO;AACzC;AAEO,MAAM,WAAW,CAAC,UAA+B;AACtD,QAAM,EAAE,UAAU,kBAAA,IAAsB,oBAAA;AACxC,SAAO,oBAAC,mBAAA,EAAmB,GAAG,MAAA,CAAO;AACvC;AAEO,MAAM,oBAAoB,CAAC,UAAwC;AACxE,QAAM,EAAE,mBAAmB,2BAAA,IAA+B,oBAAA;AAC1D,SAAO,oBAAC,4BAAA,EAA4B,GAAG,MAAA,CAAO;AAChD;AAEO,MAAM,gCAAgC,CAAC,UAAoD;AAChG,QAAM,EAAE,+BAA+B,uCAAA,IAA2C,oBAAA;AAClF,SAAO,oBAAC,wCAAA,EAAwC,GAAG,MAAA,CAAO;AAC5D;"}
@@ -1,10 +1,21 @@
1
1
  "use client";
2
+ import { j as conversationWidgetRegistry, F as resolveCanonicalWidgetName, I as exceedsJsonContainerDepth, p as ConversationWidgetFeatureGate, o as ConversationWidgetErrorBoundary, J as remarkWidgetFencePlugin, y as getConversationWidgetRegistryRevision } from "./widget-name-resolver-BGN3HpoG.js";
2
3
  import { jsx, jsxs } from "react/jsx-runtime";
3
4
  import React, { createContext, useContext, useState, useEffect, useRef, useMemo } from "react";
4
- import { f as InteractiveSurface, q as Text, a1 as translateText, b4 as readWidgetAgentSpaceKeyAttribute, ai as WidgetRenderReportContext, h as Markdown } from "./WebSearchResultsConversationWidget-BvnLWHyi.js";
5
+ import { f as InteractiveSurface, q as Text, $ as translateText, h as Markdown, N as getFurtherWidgetClickSignalSources } from "./index-7Qc_3GbG.js";
5
6
  import remarkDirective from "remark-directive";
6
- import { o as conversationWidgetRegistry, u as resolveCanonicalWidgetName, x as exceedsJsonContainerDepth, k as ConversationWidgetFeatureGate, j as ConversationWidgetErrorBoundary, y as remarkWidgetFencePlugin, q as getConversationWidgetRegistryRevision } from "./widget-name-resolver-DyIY6Zu4.js";
7
7
  import { visit } from "unist-util-visit";
8
+ import { A as readWidgetAgentSpaceKeyAttribute, W as WidgetRenderReportContext } from "./WebSearchResultsConversationWidget-as3p5bHw.js";
9
+ const resolveDeepLinkableWidget = (widgetName) => {
10
+ if (!widgetName) return null;
11
+ return conversationWidgetRegistry.widgets.find((entry) => entry.name === widgetName && entry.deepLinkable === true) ?? null;
12
+ };
13
+ const deepLinkableWidgetNameForCanvas = (canvasId) => {
14
+ if (!canvasId) return null;
15
+ return conversationWidgetRegistry.widgets.find(
16
+ (entry) => entry.deepLinkable === true && entry.opensCanvases?.includes(canvasId)
17
+ )?.name ?? null;
18
+ };
8
19
  const createWidgetRenderReportCollector = (options) => {
9
20
  const { onSettled, settleMs = 1500, maxWaitMs = 2e4 } = options;
10
21
  const reportsByMessageId = /* @__PURE__ */ new Map();
@@ -94,6 +105,26 @@ const buildWidgetRenderReportSignal = (messageId, blocks) => {
94
105
  ${keptLines.join("\n")}
95
106
  ${closing}`;
96
107
  };
108
+ const REPORT_LINE = /^- widget (\d+) \(([A-Za-z]+) #(\d+)\): (mounted|empty|failed|pending)(?: \(did not finish loading\))?(?: ([A-Z_]+))?(?: — (.*))?$/;
109
+ const parseWidgetRenderReportSignal = (signalText) => {
110
+ const lines = signalText.split("\n");
111
+ const header = new RegExp(`^${WIDGET_RENDER_REPORT_SIGNAL_PREFIX} (\\S+):$`).exec(lines[0] ?? "");
112
+ if (!header) return null;
113
+ const blocks = [];
114
+ for (const line of lines.slice(1)) {
115
+ const match = REPORT_LINE.exec(line);
116
+ if (!match) continue;
117
+ blocks.push({
118
+ position: Number(match[1]),
119
+ widgetName: match[2],
120
+ occurrence: Number(match[3]),
121
+ status: match[4],
122
+ code: match[5] ?? null,
123
+ detail: match[6] ?? null
124
+ });
125
+ }
126
+ return { messageId: header[1], blocks };
127
+ };
97
128
  const WidgetWindowRootContext = createContext(null);
98
129
  const REVEAL_MARGIN_PX = 600;
99
130
  const HIDE_MARGIN_PX = 2e3;
@@ -387,13 +418,29 @@ const ConversationMarkdown = (props) => {
387
418
  );
388
419
  return /* @__PURE__ */ jsx(ConversationWidgetRenderContext.Provider, { value: renderContext, children: /* @__PURE__ */ jsx(Markdown, { remarkPlugins, components: getMarkdownComponents(), markdown }) });
389
420
  };
421
+ const FRONTEND_WIDGET_CLICK_SIGNAL_SOURCE = "FRONTEND_WIDGET_CLICK";
422
+ const OWNER_ACTION_CONFIRM_SIGNAL_SOURCE = "OWNER_ACTION_CONFIRM";
423
+ const PACKAGE_WIDGET_CLICK_SIGNAL_SOURCES = [
424
+ FRONTEND_WIDGET_CLICK_SIGNAL_SOURCE,
425
+ OWNER_ACTION_CONFIRM_SIGNAL_SOURCE
426
+ ];
427
+ const getWidgetClickSignalSources = () => [
428
+ ...PACKAGE_WIDGET_CLICK_SIGNAL_SOURCES,
429
+ ...getFurtherWidgetClickSignalSources()
430
+ ];
431
+ const isWidgetClickSignalSource = (signalSource) => signalSource != null && getWidgetClickSignalSources().includes(signalSource);
390
432
  export {
391
433
  ConversationMarkdown as C,
392
- WidgetWindowRootContext as W,
434
+ WIDGET_RENDER_REPORT_SIGNAL_SOURCE as W,
393
435
  ConversationWidgetHost as a,
394
436
  buildWidgetRenderReportSignal as b,
395
- WIDGET_RENDER_REPORT_SIGNAL_SOURCE as c,
396
- createWidgetRenderReportCollector as d,
397
- WidgetRenderReportCollectorContext as e
437
+ WidgetWindowRootContext as c,
438
+ deepLinkableWidgetNameForCanvas as d,
439
+ createWidgetRenderReportCollector as e,
440
+ WidgetRenderReportCollectorContext as f,
441
+ getWidgetClickSignalSources as g,
442
+ isWidgetClickSignalSource as i,
443
+ parseWidgetRenderReportSignal as p,
444
+ resolveDeepLinkableWidget as r
398
445
  };
399
- //# sourceMappingURL=ConversationMarkdown-W7NHglmL.js.map
446
+ //# sourceMappingURL=widget-click-signal-sources-DulRkNvZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-click-signal-sources-DulRkNvZ.js","sources":["../../src/renderer/resolve-deep-linkable-widget.ts","../../src/renderer/render-report/widget-render-report-collector.ts","../../src/renderer/widget-windowing.tsx","../../src/renderer/conversationWidgetAstPlugin.ts","../../src/renderer/restoreTextDirectivesPlugin.ts","../../src/renderer/WindowedWidget/WindowedWidget.tsx","../../src/renderer/ConversationWidgetHost.tsx","../../src/renderer/MarkdownLink.tsx","../../src/renderer/ConversationMarkdown.tsx","../../src/renderer/widget-click-signal-sources.ts"],"sourcesContent":["import type { CanvasId } from \"./canvas/canvas-behaviours\";\nimport { ConversationWidgetEntry, conversationWidgetRegistry } from \"./conversationWidgetRegistry\";\n\n/**\n * Resolves the widget a `?agentWidget=<name>` deep-link (or a restored pinned canvas) may mount, by its CANONICAL\n * registry wire name.\n *\n * A URL is untrusted input, so this is an allow-list rather than a registry lookup: only an entry that declares\n * `deepLinkable: true` can be opened this way. Every other widget is emitted by the agent inside a message, where the\n * conversation itself is the authorisation — a link must not be able to mount an arbitrary widget (some carry\n * mount-time side effects) just because its name was typed into the address bar.\n *\n * Returns the entry (the caller renders its `component`, applying the feature gate the entry declares) or null when the\n * name is empty, unknown, or not deep-linkable.\n */\nexport const resolveDeepLinkableWidget = (widgetName?: string | null): ConversationWidgetEntry | null => {\n if (!widgetName) return null;\n return (\n conversationWidgetRegistry.widgets.find((entry) => entry.name === widgetName && entry.deepLinkable === true) ?? null\n );\n};\n\n/**\n * The reverse direction: which deep-linkable widget re-opens THIS canvas. The open canvas of the agent chat is\n * mirrored into `?agentWidget=` (AgentTrigger) so a reload brings the customer back to the surface they were working\n * on — an editor a cold chat opened has no conversation id yet, so the canvas model's own pointer storage\n * has nothing to restore from.\n *\n * Null for every canvas no deep-linkable widget declares: it is the agent's to open inside a message, and a URL must\n * not be able to mount it (the allow-list above).\n */\nexport const deepLinkableWidgetNameForCanvas = (canvasId: CanvasId | null | undefined): string | null => {\n if (!canvasId) return null;\n return (\n conversationWidgetRegistry.widgets.find(\n (entry) => entry.deepLinkable === true && entry.opensCanvases?.includes(canvasId),\n )?.name ?? null\n );\n};\n","import { createContext } from \"react\";\nimport type { WidgetRenderReporter, WidgetRenderReportEntry } from \"./widget-render-report\";\n\n/**\n * The render reports of the widget blocks of live messages, collected per message. The chat host\n * (`AgentChat`) owns one collector and hands it down; `ConversationWidgetHost` registers every block of a JUST-DELIVERED\n * message (never a replayed one) and gives the widget a reporter for it. A block that reports nothing counts as\n * `mounted`. Once a message's blocks have settled — none `pending` for `settleMs`, or `maxWaitMs` after the first block\n * at the latest — the collector calls `onSettled` ONCE for that message with its blocks in document order; the host\n * sends the signal only when a block is not `mounted` or rendered with a note (a `mounted` entry with a code: figures\n * without a source), so a clean render costs nothing.\n */\n\nexport interface WidgetRenderBlockReport {\n widgetName: string;\n /** The block's offset in the message's markdown — document order, and the block's identity in the message. */\n sourceOffset: number;\n entry: WidgetRenderReportEntry;\n}\n\nexport interface WidgetRenderReportCollector {\n /** Counts one block of one live message as `mounted` unless it already reported (a child reports before its host mounts). */\n registerBlock: (messageId: string | number, widgetName: string, sourceOffset: number) => void;\n /** The reporter of one block of one live message. */\n reporterForBlock: (messageId: string | number, widgetName: string, sourceOffset: number) => WidgetRenderReporter;\n /** Forget every pending timer (the host unmounts or the conversation switches). */\n dispose: () => void;\n}\n\nexport interface WidgetRenderReportCollectorOptions {\n onSettled: (messageId: string, blocks: WidgetRenderBlockReport[]) => void;\n settleMs?: number;\n maxWaitMs?: number;\n}\n\ninterface MessageReports {\n blocksByKey: Map<string, WidgetRenderBlockReport>;\n firstReportAt: number;\n settleTimer: ReturnType<typeof setTimeout> | null;\n isSent: boolean;\n}\n\nexport const createWidgetRenderReportCollector = (\n options: WidgetRenderReportCollectorOptions,\n): WidgetRenderReportCollector => {\n const { onSettled, settleMs = 1500, maxWaitMs = 20000 } = options;\n const reportsByMessageId = new Map<string, MessageReports>();\n\n const scheduleSettleCheck = (messageId: string) => {\n const messageReports = reportsByMessageId.get(messageId);\n if (!messageReports || messageReports.isSent) return;\n if (messageReports.settleTimer !== null) clearTimeout(messageReports.settleTimer);\n const hasPendingBlock = [...messageReports.blocksByKey.values()].some((block) => block.entry.status === \"pending\");\n const waitedMs = Date.now() - messageReports.firstReportAt;\n const delayMs = hasPendingBlock ? Math.max(0, Math.min(settleMs * 4, maxWaitMs - waitedMs)) : settleMs;\n messageReports.settleTimer = setTimeout(() => {\n messageReports.settleTimer = null;\n const isStillPending = [...messageReports.blocksByKey.values()].some((block) => block.entry.status === \"pending\");\n if (isStillPending && Date.now() - messageReports.firstReportAt < maxWaitMs) {\n scheduleSettleCheck(messageId);\n return;\n }\n messageReports.isSent = true;\n onSettled(\n messageId,\n [...messageReports.blocksByKey.values()].sort((first, second) => first.sourceOffset - second.sourceOffset),\n );\n }, delayMs);\n };\n\n const recordBlock = (\n messageId: string,\n widgetName: string,\n sourceOffset: number,\n entry: WidgetRenderReportEntry | null,\n ) => {\n let messageReports = reportsByMessageId.get(messageId);\n if (!messageReports) {\n messageReports = { blocksByKey: new Map(), firstReportAt: Date.now(), settleTimer: null, isSent: false };\n reportsByMessageId.set(messageId, messageReports);\n }\n if (messageReports.isSent) return;\n const blockKey = `${widgetName}@${sourceOffset}`;\n const knownBlock = messageReports.blocksByKey.get(blockKey);\n if (entry === null && knownBlock) return;\n messageReports.blocksByKey.set(blockKey, { widgetName, sourceOffset, entry: entry ?? { status: \"mounted\" } });\n scheduleSettleCheck(messageId);\n };\n\n return {\n registerBlock: (messageId, widgetName, sourceOffset) =>\n recordBlock(String(messageId), widgetName, sourceOffset, null),\n reporterForBlock: (messageId, widgetName, sourceOffset) => ({\n report: (entry: WidgetRenderReportEntry) => recordBlock(String(messageId), widgetName, sourceOffset, entry),\n }),\n dispose: () => {\n for (const messageReports of reportsByMessageId.values()) {\n if (messageReports.settleTimer !== null) clearTimeout(messageReports.settleTimer);\n }\n reportsByMessageId.clear();\n },\n };\n};\n\n/** The collector of the chat the widget lives in; absent = nobody listens (another host, a story, the e-mail capture). */\nexport const WidgetRenderReportCollectorContext = createContext<WidgetRenderReportCollector | null>(null);\n\n/** The stored prefix of a render-report signal — the inspector and the tests read it; never reworded. */\nexport const WIDGET_RENDER_REPORT_SIGNAL_PREFIX = \"Widget render report for message\";\n\n/** The signal source (backend `AIConversationSignalSource::FRONTEND_WIDGET_RENDER_REPORT`). */\nexport const WIDGET_RENDER_REPORT_SIGNAL_SOURCE = \"FRONTEND_WIDGET_RENDER_REPORT\";\n\nconst MAX_DETAIL_CHARACTERS = 400;\n\n/** The backend's cap on a signal text (`AIConversationMessage::MAX_SIGNAL_TEXT_CHARS`). */\nconst MAX_SIGNAL_TEXT_CHARS = 2000;\n/** Room kept for the \"… and N more\" line. */\nconst OMITTED_LINE_RESERVE = 80;\n\n/**\n * The model-visible signal for a settled message — null when every block mounted cleanly (nothing to tell). One line\n * per block that is not `mounted`, or that mounted with a note (a code: `INLINE_VALUE_WITHOUT_SOURCE`): its position\n * among the message's widgets, its name and its occurrence among widgets of that name, its status and code, the\n * detail. The closing sentence asks for the honest answer about a block the owner did not see, and for\n * a note that the next widget fixes it.\n */\nexport const buildWidgetRenderReportSignal = (messageId: string, blocks: WidgetRenderBlockReport[]): string | null => {\n const occurrenceByName = new Map<string, number>();\n const blockLines: string[] = [];\n blocks.forEach((block, blockPosition) => {\n const occurrence = (occurrenceByName.get(block.widgetName) ?? 0) + 1;\n occurrenceByName.set(block.widgetName, occurrence);\n if (block.entry.status === \"mounted\" && !block.entry.code) return;\n const status = block.entry.status === \"pending\" ? \"pending (did not finish loading)\" : block.entry.status;\n const code = block.entry.code ? ` ${block.entry.code}` : \"\";\n const detail = block.entry.detail ? ` — ${block.entry.detail.slice(0, MAX_DETAIL_CHARACTERS)}` : \"\";\n blockLines.push(`- widget ${blockPosition + 1} (${block.widgetName} #${occurrence}): ${status}${code}${detail}`);\n });\n if (blockLines.length === 0) return null;\n const header = `${WIDGET_RENDER_REPORT_SIGNAL_PREFIX} ${messageId}:`;\n const hasBlockNotShown = blocks.some((block) => block.entry.status !== \"mounted\");\n const hasNote = blocks.some((block) => block.entry.status === \"mounted\" && block.entry.code);\n const closing = [\n hasBlockNotShown\n ? \"The owner did not see these widgets as intended. In your next answer say so in one line where it matters and \" +\n 'give the content in prose; never refer to \"the widget above\" for them.'\n : \"\",\n hasNote\n ? \"The widgets marked mounted were shown; fix the noted part in every widget you write from now on (a figure you \" +\n \"researched names its publisher and page in `source`). Do not resend the widget for the note alone.\"\n : \"\",\n ]\n .filter((sentence) => sentence !== \"\")\n .join(\" \");\n // The backend keeps the first MAX_SIGNAL_TEXT_CHARS of a signal: whole lines only, the rest counted in one line.\n const keptLines: string[] = [];\n let signalLength = header.length + 1 + closing.length + OMITTED_LINE_RESERVE;\n for (const blockLine of blockLines) {\n if (signalLength + blockLine.length + 1 > MAX_SIGNAL_TEXT_CHARS) break;\n keptLines.push(blockLine);\n signalLength += blockLine.length + 1;\n }\n const omittedCount = blockLines.length - keptLines.length;\n if (omittedCount > 0) keptLines.push(`- … and ${omittedCount} more widget(s) that did not render as intended`);\n return `${header}\\n${keptLines.join(\"\\n\")}\\n${closing}`;\n};\n\nexport interface ParsedWidgetRenderReport {\n messageId: string;\n blocks: Array<{\n position: number;\n widgetName: string;\n occurrence: number;\n status: string;\n code: string | null;\n detail: string | null;\n }>;\n}\n\nconst REPORT_LINE =\n /^- widget (\\d+) \\(([A-Za-z]+) #(\\d+)\\): (mounted|empty|failed|pending)(?: \\(did not finish loading\\))?(?: ([A-Z_]+))?(?: — (.*))?$/;\n\n/** The report a stored signal text carries, or null for another text — the admin inspector's reader. */\nexport const parseWidgetRenderReportSignal = (signalText: string): ParsedWidgetRenderReport | null => {\n const lines = signalText.split(\"\\n\");\n const header = new RegExp(`^${WIDGET_RENDER_REPORT_SIGNAL_PREFIX} (\\\\S+):$`).exec(lines[0] ?? \"\");\n if (!header) return null;\n const blocks: ParsedWidgetRenderReport[\"blocks\"] = [];\n for (const line of lines.slice(1)) {\n const match = REPORT_LINE.exec(line);\n if (!match) continue;\n blocks.push({\n position: Number(match[1]),\n widgetName: match[2],\n occurrence: Number(match[3]),\n status: match[4],\n code: match[5] ?? null,\n detail: match[6] ?? null,\n });\n }\n return { messageId: header[1], blocks };\n};\n","import React, { createContext, RefObject, useContext, useEffect, useState } from \"react\";\n\n/**\n * Viewport-windowing for chat widgets. Heavy interactive widgets (maps, lists, hydrating components) are mounted ONLY\n * while near the viewport and unmounted back to a placeholder when far away — so a long conversation keeps a CONSTANT\n * number of widgets mounted no matter how far you scroll. Two thresholds give hysteresis (reveal early, hide late) so a\n * small scroll wobble never thrashes mount/unmount.\n *\n * The IntersectionObserver root is the chat scroll container, supplied via {@link WidgetWindowRootContext} by the chat\n * host (ConversationViewBody). Observers are POOLED per (root, margin): all placeholders share two observers, not two each.\n */\nexport const WidgetWindowRootContext = createContext<HTMLElement | null>(null);\n\n/** Mount when the widget is within this margin of the viewport. */\nconst REVEAL_MARGIN_PX = 600;\n/** Unmount only once it is beyond this (larger) margin — the gap to REVEAL is the hysteresis band. */\nconst HIDE_MARGIN_PX = 2000;\n\ntype Pool = { observer: IntersectionObserver; callbacks: Map<Element, (entry: IntersectionObserverEntry) => void> };\n// Keyed by root (null = viewport) → margin string → the shared observer + its per-element callbacks.\nconst poolsByRoot = new Map<Element | null, Map<string, Pool>>();\n\n/** Register `element` with the shared observer for (root, rootMargin); returns a disposer. */\nconst observeShared = (\n root: Element | null,\n rootMargin: string,\n element: Element,\n onEntry: (entry: IntersectionObserverEntry) => void,\n): (() => void) => {\n let byMargin = poolsByRoot.get(root);\n if (!byMargin) {\n byMargin = new Map();\n poolsByRoot.set(root, byMargin);\n }\n let pool = byMargin.get(rootMargin);\n if (!pool) {\n const callbacks = new Map<Element, (entry: IntersectionObserverEntry) => void>();\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n callbacks.get(entry.target)?.(entry);\n }\n },\n { root, rootMargin },\n );\n pool = { observer, callbacks };\n byMargin.set(rootMargin, pool);\n }\n pool.callbacks.set(element, onEntry);\n pool.observer.observe(element);\n\n return () => {\n const currentByMargin = poolsByRoot.get(root);\n const currentPool = currentByMargin?.get(rootMargin);\n if (!currentPool) return;\n currentPool.observer.unobserve(element);\n currentPool.callbacks.delete(element);\n if (currentPool.callbacks.size === 0) {\n currentPool.observer.disconnect();\n currentByMargin!.delete(rootMargin);\n if (currentByMargin!.size === 0) poolsByRoot.delete(root);\n }\n };\n};\n\n/**\n * Drives a widget's mounted/unmounted state from its viewport proximity.\n *\n * - `pinned` (the freshly-delivered widget) → always revealed, never observed: a live widget must not unmount while its\n * one-shot effects (canvas auto-open) are in play, and re-mounting it later would re-fire them.\n * - otherwise: starts at `initialRevealed` (the cheap index-window guess for first paint), then the reveal observer\n * mounts it when it scrolls within REVEAL_MARGIN and the hide observer unmounts it past HIDE_MARGIN.\n *\n * Returns `[revealed, reveal]` — `reveal` lets the placeholder force a manual mount (the \"Show\" affordance).\n */\nexport const useWidgetWindow = (\n targetRef: RefObject<HTMLElement | null>,\n options: { initialRevealed: boolean; pinned: boolean },\n): [boolean, () => void] => {\n const { initialRevealed, pinned } = options;\n const root = useContext(WidgetWindowRootContext);\n const [revealed, setRevealed] = useState(initialRevealed || pinned);\n\n useEffect(() => {\n if (pinned) {\n setRevealed(true);\n return undefined;\n }\n const element = targetRef.current;\n if (!element || typeof IntersectionObserver === \"undefined\") return undefined;\n\n const disposeReveal = observeShared(root, `${REVEAL_MARGIN_PX}px 0px`, element, (entry) => {\n if (entry.isIntersecting) setRevealed(true);\n });\n const disposeHide = observeShared(root, `${HIDE_MARGIN_PX}px 0px`, element, (entry) => {\n if (!entry.isIntersecting) setRevealed(false);\n });\n return () => {\n disposeReveal();\n disposeHide();\n };\n // Re-attach when the scroll root resolves (it is null on the first frame, then the container element).\n }, [root, pinned, targetRef]);\n\n return [revealed, () => setRevealed(true)];\n};\n","import { visit } from \"unist-util-visit\";\nimport { conversationWidgetRegistry, type ConversationWidgetEntry } from \"./conversationWidgetRegistry\";\nimport { resolveCanonicalWidgetName } from \"./widget-name-resolver\";\nimport { exceedsJsonContainerDepth } from \"./widget-tree/bounded-json\";\n\n/** Whether a `::Name{payload='…'}` payload nests deeper than the backend decodes — MALFORMED there, dropped here. */\nconst isPayloadTooDeep = (payload: unknown): boolean => {\n if (typeof payload !== \"string\") return false;\n try {\n return exceedsJsonContainerDepth(JSON.parse(payload));\n } catch {\n return false;\n }\n};\n\n/**\n * Maps the `::Name` nodes a message carries onto the registered components by rewriting `data.hName` to the CANONICAL\n * registry name — which is what `ConversationMarkdown` keys its component map by.\n *\n * The name on the node is whatever the message contains, so a stored conversation delivers the legacy\n * `::ExampleWidgetDirective{payload='…'}` form (and stored server `component` parts carry `\"name\":\"<Canonical>Directive\"`,\n * which `normalize-server-message-to-markdown` turns into exactly that). Resolution therefore goes\n * through `resolveCanonicalWidgetName` — the one legacy rule — never a direct set lookup, or every old message would\n * degrade to the `:name` plain-text fallback.\n */\nexport default function conversationWidgetAstPlugin() {\n const canonicalNames = new Set(conversationWidgetRegistry.widgets.map((w: ConversationWidgetEntry) => w.name));\n\n return (tree: any) => {\n // `\"leafDirective\"` is remark-directive's node type — its contract, not our vocabulary. It is the only form a\n // widget ever travels in: `remarkWidgetFencePlugin` produces it from a ```widget fence, and the stored `::Name`\n // syntax parses into it.\n visit(tree, [\"leafDirective\"], (node, index, parent) => {\n const canonicalName = resolveCanonicalWidgetName(node.name, canonicalNames);\n\n if (\n canonicalName &&\n index !== undefined &&\n index !== null &&\n parent &&\n isPayloadTooDeep(node.attributes?.payload)\n ) {\n parent.children[index] = { type: \"text\", value: \"\" };\n return;\n }\n\n if (canonicalName) {\n // Map properties to attributes for react-markdown\n node.data = {\n hName: canonicalName,\n hProperties: node.attributes || {},\n ...node.data,\n };\n return node;\n }\n\n // `index === 0` is falsy — a plain `!index` check would skip the text\n // fallback for a node that is its parent's first child.\n if (index === undefined || index === null || !parent) {\n return node;\n }\n\n // An unknown name becomes plain text. Keep the node's children so a `::Unknown[label]` form degrades to its\n // label instead of silently swallowing it.\n const asText = { type: \"text\", value: `:${node.name}` };\n parent.children.splice(index, 1, asText, ...(node.children ?? []));\n const prev = parent.children[index - 1];\n if (prev?.type === \"text\") {\n prev.value += asText.value;\n parent.children.splice(index, 1);\n }\n });\n };\n}\n","import { visit } from \"unist-util-visit\";\n\n/**\n * remark-directive parses EVERY `:name` run as a text directive — including the `:00` / `:30` inside a time such as\n * `08:00–16:30` (digits are valid directive names). Text directives are not part of our widget vocabulary (widgets\n * travel as leaf directives only, see `conversationWidgetAstPlugin`), so a text directive is always prose that the\n * parser misread: without this pass the customer chat rendered \"Montag: 08:00–16:30\" as \"08\" / \"–16\" (the `:00`\n * and `:30` swallowed, the unknown nodes rendered as breaks) while the admin inspector, which does not load\n * remark-directive, showed the line intact.\n *\n * Restores every text directive to the exact source slice it was parsed from, merging it into the neighbouring text\n * nodes so the paragraph reads as one run again.\n */\nexport default function restoreTextDirectivesPlugin() {\n return (tree: any, file: any) => {\n const source = String(file?.value ?? \"\");\n visit(tree, \"textDirective\", (node: any, index: number | undefined, parent: any) => {\n if (index === undefined || index === null || !parent) {\n return;\n }\n const start = node.position?.start?.offset;\n const end = node.position?.end?.offset;\n const literal =\n typeof start === \"number\" && typeof end === \"number\" && end > start\n ? source.slice(start, end)\n : `:${node.name}${node.children?.length ? `[${node.children.map((c: any) => c.value ?? \"\").join(\"\")}]` : \"\"}`;\n const asText = { type: \"text\", value: literal };\n parent.children.splice(index, 1, asText);\n // Merge with the neighbours so \"08\" + \":00\" + \"–16\" becomes one text node again.\n const prev = parent.children[index - 1];\n if (prev?.type === \"text\") {\n prev.value += asText.value;\n parent.children.splice(index, 1);\n const next = parent.children[index];\n if (next?.type === \"text\") {\n prev.value += next.value;\n parent.children.splice(index, 1);\n }\n return index - 1;\n }\n const next = parent.children[index + 1];\n if (next?.type === \"text\") {\n asText.value += next.value;\n parent.children.splice(index + 1, 1);\n }\n return index;\n });\n };\n}\n","import { InteractiveSurface, Text } from \"../../provider/components\";\nimport React, { useEffect, useRef } from \"react\";\nimport { translateText } from \"../../provider/environment\";\nimport { useWidgetWindow } from \"../widget-windowing\";\nimport styles from \"../HiddenWidgetPlaceholder/HiddenWidgetPlaceholder.module.scss\";\n\nexport interface WindowedWidgetProps {\n children: React.ReactNode;\n /** First-paint guess from the index window: recent messages start mounted, older ones start as a placeholder. */\n initialRevealed: boolean;\n /** The freshly-delivered widget — kept mounted (never windowed out) so its one-shot effects don't re-fire. */\n pinned: boolean;\n}\n\n/** Default reserved height for a widget that has never been measured (an old one that has not been scrolled to yet). */\nconst DEFAULT_PLACEHOLDER_MIN_HEIGHT = 80;\n\n/**\n * Mounts a chat widget only while it is near the viewport (see {@link useWidgetWindow}); far from the viewport it\n * collapses to a lightweight placeholder. The wrapper element is STABLE across the toggle so the shared\n * IntersectionObserver keeps tracking it. The placeholder reserves the widget's last measured height, so re-hiding it\n * causes ZERO layout shift (no scroll jump); revealing again restores the real widget (self-hydrating widgets re-fetch\n * with a brief skeleton).\n */\nexport const WindowedWidget = ({ children, initialRevealed, pinned }: WindowedWidgetProps) => {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const [revealed, reveal] = useWidgetWindow(wrapperRef, { initialRevealed, pinned });\n // Remembered so the placeholder can reserve exactly the height the widget occupied.\n const lastHeightRef = useRef<number | undefined>(undefined);\n\n useEffect(() => {\n const element = wrapperRef.current;\n if (!revealed || !element || typeof ResizeObserver === \"undefined\") return undefined;\n const measure = () => {\n if (wrapperRef.current) lastHeightRef.current = wrapperRef.current.offsetHeight;\n };\n measure();\n const resizeObserver = new ResizeObserver(measure);\n resizeObserver.observe(element);\n return () => resizeObserver.disconnect();\n }, [revealed]);\n\n return (\n <div ref={wrapperRef}>\n {revealed ? (\n children\n ) : (\n <InteractiveSurface\n hoverable\n className={styles.placeholder}\n style={{ minHeight: lastHeightRef.current ?? DEFAULT_PLACEHOLDER_MIN_HEIGHT }}\n >\n <button\n type=\"button\"\n className={styles.placeholderButton}\n onClick={reveal}\n aria-label={translateText(\"Show hidden widget\")}\n >\n <Text>Older interactive content is hidden.</Text>\n <span className={styles.cta}>\n <Text>Show</Text>\n </span>\n </button>\n </InteractiveSurface>\n )}\n </div>\n );\n};\n","import React, { useContext, useEffect, useMemo } from \"react\";\nimport styles from \"./ConversationMarkdown.module.scss\";\nimport { ConversationWidgetEntry } from \"./conversationWidgetRegistry\";\nimport { ConversationWidgetFeatureGate } from \"./_access/ConversationWidgetFeatureGate\";\nimport { readWidgetAgentSpaceKeyAttribute } from \"./_agent-space/widget-agent-space-key-attribute\";\nimport { ConversationWidgetErrorBoundary } from \"./ConversationWidgetErrorBoundary\";\nimport { WindowedWidget } from \"./WindowedWidget/WindowedWidget\";\nimport { WidgetRenderReportContext } from \"./render-report/widget-render-report\";\nimport { WidgetRenderReportCollectorContext } from \"./render-report/widget-render-report-collector\";\n\nexport type ConversationWidgetRenderProps = Record<string, unknown> & {\n children?: React.ReactNode;\n fresh?: boolean;\n interactive?: boolean;\n justDelivered?: boolean;\n messageId?: string | number;\n};\n\ninterface ConversationWidgetHostProps {\n widget: ConversationWidgetEntry;\n /** Forwarded into the widget (and as its deprecated alias `fresh`): the widget's controls may be used. */\n interactive: boolean;\n /** Forwarded into the widget: the host message was delivered live right now — the one-shot side-effect gate. */\n justDelivered: boolean;\n /** Id of the host message, forwarded so a widget can identify the canvas it opens. */\n messageId?: string | number;\n /** When true, the widget renders as a lightweight placeholder (cheap scroll). */\n hideWidgets: boolean;\n /** Parsed markdown attributes for this widget instance. */\n conversationWidgetRenderProps: ConversationWidgetRenderProps;\n}\n\n/**\n * Single render path for every widget. Each concern is applied as a sequential gate\n * (innermost → outermost):\n * 1. the widget itself, with `interactive` / `justDelivered`\n * 2. feature-flag gate\n * 3. viewport-windowing (mount near the viewport, placeholder when far — WindowedWidget)\n * 4. block spacing wrapper\n *\n * A block of a JUST-DELIVERED message is also registered with the chat's render-report collector: it\n * counts as `mounted` unless the widget reports otherwise through `useReportWidgetRenderStatus`, and a crash caught by\n * the error boundary reports `failed` (`RENDER_FAILED`). A replayed message reports nothing.\n */\nexport const ConversationWidgetHost = ({\n widget,\n interactive,\n justDelivered,\n messageId,\n hideWidgets,\n conversationWidgetRenderProps,\n}: ConversationWidgetHostProps) => {\n const { component: Component, featureFlag, upsellTrigger } = widget;\n const renderReportCollector = useContext(WidgetRenderReportCollectorContext);\n // The block's offset in the message markdown (react-markdown hands every component its hast node) — its identity and\n // its document order in the render report.\n const sourceOffset = (\n conversationWidgetRenderProps.node as { position?: { start?: { offset?: number } } } | undefined\n )?.position?.start?.offset;\n const isReported = renderReportCollector !== null && justDelivered && messageId !== undefined;\n const renderReporter = useMemo(\n () =>\n isReported && messageId !== undefined\n ? renderReportCollector.reporterForBlock(messageId, widget.name, sourceOffset ?? 0)\n : null,\n [isReported, renderReportCollector, messageId, widget.name, sourceOffset],\n );\n useEffect(() => {\n if (isReported && messageId !== undefined)\n renderReportCollector.registerBlock(messageId, widget.name, sourceOffset ?? 0);\n }, [isReported, renderReportCollector, messageId, widget.name, sourceOffset]);\n\n let node = (\n <Component\n {...conversationWidgetRenderProps}\n fresh={interactive}\n interactive={interactive}\n justDelivered={justDelivered}\n messageId={messageId}\n />\n );\n\n if (featureFlag) {\n node = (\n <ConversationWidgetFeatureGate\n featureFlag={featureFlag}\n UpsellTrigger={upsellTrigger}\n agentSpaceKeyAttribute={readWidgetAgentSpaceKeyAttribute(conversationWidgetRenderProps)}\n >\n {node}\n </ConversationWidgetFeatureGate>\n );\n }\n\n // Viewport-windowing: a widget is mounted only while near the viewport and collapses to a height-preserving\n // placeholder when far away — so a long conversation keeps a constant number of widgets mounted. The INTERACTIVE\n // widget (the live reply, and the newest reply after a reload) is pinned — never unmounted, so its controls stay\n // and its one-shot effects don't re-fire; older widgets start from the cheap index-window guess and reveal/hide as\n // they scroll in and out. The feature gate lives INSIDE, so it only runs once the widget is actually mounted.\n node = (\n // Pinned on delivery as well as on controls: a just-delivered widget that lost its controls (a newer widget of the\n // same type superseded it) must not unmount when scrolled past, or its remount re-fires the one-shot canvas open.\n <WindowedWidget initialRevealed={!hideWidgets} pinned={interactive || justDelivered}>\n {node}\n </WindowedWidget>\n );\n\n // Outermost gate: widget props come from LLM output, so any throw inside the\n // widget (or its gates) must not unmount the whole chat message.\n node = (\n <ConversationWidgetErrorBoundary\n widgetName={widget.name}\n onCrash={() =>\n renderReporter?.report({ status: \"failed\", code: \"RENDER_FAILED\", detail: \"the widget threw while rendering\" })\n }\n >\n <WidgetRenderReportContext.Provider value={renderReporter}>{node}</WidgetRenderReportContext.Provider>\n </ConversationWidgetErrorBoundary>\n );\n\n return <div className={styles.conversationWidgetWrapper}>{node}</div>;\n};\n","import React from \"react\";\nimport styles from \"./ConversationMarkdown.module.scss\";\n\nexport type MarkdownLinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n /** The hast node react-markdown passes to every custom component; not a valid DOM attribute. */\n node?: unknown;\n};\n\n// Render every markdown link as a new-tab anchor with a dashed underline. `node` is dropped before the\n// rest is spread onto <a> so react-markdown's hast node never lands on the DOM element.\nexport const MarkdownLink = ({ node, children, ...anchorProps }: MarkdownLinkProps) => (\n <a {...anchorProps} target=\"_blank\" rel=\"noopener noreferrer\" className={styles.markdownLink}>\n {children}\n </a>\n);\n","import React, { useContext, useMemo } from \"react\";\nimport { type AgentsMarkdownProps, Markdown } from \"../provider/components\";\nimport remarkDirective from \"remark-directive\";\nimport remarkWidgetFencePlugin from \"./remarkWidgetFencePlugin\";\nimport conversationWidgetAstPlugin from \"./conversationWidgetAstPlugin\";\nimport restoreTextDirectivesPlugin from \"./restoreTextDirectivesPlugin\";\nimport { conversationWidgetRegistry, getConversationWidgetRegistryRevision } from \"./conversationWidgetRegistry\";\nimport { ConversationWidgetHost, ConversationWidgetRenderProps } from \"./ConversationWidgetHost\";\nimport { MarkdownLink } from \"./MarkdownLink\";\n\nexport interface ConversationMarkdownProps {\n markdown: string;\n /**\n * Forwarded into every widget instance as `interactive` (and its deprecated alias `fresh`): the widget's controls\n * may be used. True for a live-delivered message and for the newest assistant reply after a reload.\n */\n interactive?: boolean;\n /**\n * Forwarded into every widget instance as `justDelivered`: the message was delivered live right now. The only gate\n * for one-shot side effects (canvas open, draft creation); never true after a reload or on replay.\n */\n justDelivered?: boolean;\n /** Id of the host message, forwarded so a widget can identify the canvas it opens. */\n messageId?: string | number;\n /**\n * When true, widgets are replaced with a lightweight placeholder.\n * Used for old messages to keep the chat scroll cheap.\n */\n hideWidgets?: boolean;\n}\n\n/**\n * Render flags delivered via context so the widget component map can live at module\n * scope. The map must keep stable component identities across renders: react-markdown\n * reconciles by element type, so a per-render `Wrapped` closure makes React unmount and\n * remount every widget on each streaming tick — resetting one-shot refs (duplicate\n * drawer opens / POSTs) and re-triggering hydration.\n */\nconst ConversationWidgetRenderContext = React.createContext<{\n interactive: boolean;\n justDelivered: boolean;\n hideWidgets: boolean;\n messageId?: string | number;\n}>({\n interactive: false,\n justDelivered: false,\n hideWidgets: false,\n});\n\n// Map every widget name to a component that delegates rendering to ConversationWidgetHost,\n// which owns the per-widget concerns (interactive / justDelivered, feature-flag gate, hidden placeholder, block spacing).\n// Built lazily: the registry imports every widget and a widget can import AgentChat, which renders this file.\nconst buildConversationWidgetComponents = () =>\n conversationWidgetRegistry.widgets.reduce<Record<string, React.ComponentType<ConversationWidgetRenderProps>>>(\n (acc, widget) => {\n const Wrapped: React.ComponentType<ConversationWidgetRenderProps> = (innerProps) => {\n const { interactive, justDelivered, hideWidgets, messageId } = useContext(ConversationWidgetRenderContext);\n\n return (\n <ConversationWidgetHost\n widget={widget}\n interactive={interactive}\n justDelivered={justDelivered}\n messageId={messageId}\n hideWidgets={hideWidgets}\n conversationWidgetRenderProps={innerProps}\n />\n );\n };\n Wrapped.displayName = `ConversationWidget(${widget.name})`;\n acc[widget.name] = Wrapped;\n return acc;\n },\n {},\n );\n\nlet markdownComponents: AgentsMarkdownProps[\"components\"] | undefined;\nlet markdownComponentsRevision = -1;\n\n// Rebuilt only when an app registered more widgets since (`registerConversationWidgets`): the identities stay stable.\nconst getMarkdownComponents = (): AgentsMarkdownProps[\"components\"] => {\n if (markdownComponents === undefined || markdownComponentsRevision !== getConversationWidgetRegistryRevision()) {\n markdownComponents = {\n ...buildConversationWidgetComponents(),\n a: MarkdownLink,\n } as AgentsMarkdownProps[\"components\"];\n markdownComponentsRevision = getConversationWidgetRegistryRevision();\n }\n return markdownComponents;\n};\n\n// remarkWidgetFencePlugin rewrites ```widget fenced blocks into the node type remark-directive parses `::Name{}` into,\n// BEFORE conversationWidgetAstPlugin maps them to components — so the model's ```widget egress and the legacy\n// `::Name{}` egress share one render path (ConversationWidgetHost + feature-gate + hydration).\n// restoreTextDirectivesPlugin runs LAST: remark-directive also parses the `:00` inside \"08:00–16:30\" as a text\n// directive (digits are valid names) and swallowed it in the customer chat — text directives are never widgets.\nconst remarkPlugins = [\n remarkDirective,\n remarkWidgetFencePlugin,\n conversationWidgetAstPlugin,\n restoreTextDirectivesPlugin,\n];\n\nexport const ConversationMarkdown = (props: ConversationMarkdownProps) => {\n const { markdown, interactive = false, justDelivered = false, hideWidgets = false, messageId } = props;\n\n const renderContext = useMemo(\n () => ({ interactive, justDelivered, hideWidgets, messageId }),\n [interactive, justDelivered, hideWidgets, messageId],\n );\n\n return (\n <ConversationWidgetRenderContext.Provider value={renderContext}>\n <Markdown remarkPlugins={remarkPlugins} components={getMarkdownComponents()} markdown={markdown} />\n </ConversationWidgetRenderContext.Provider>\n );\n};\n","import { getFurtherWidgetClickSignalSources } from \"../provider/environment\";\n\n/**\n * The `signalSource`s a widget CLICK posts into the conversation (`injectSignal`): the generic widget click and the\n * dedicated source the former owner-action consent widget sent (no component posts it any more; stored rows keep it),\n * plus the further sources an app's own widgets post (`AgentsEnvironment.furtherWidgetClickSignalSources`, e.g. a form\n * submit that starts its own owner turn). The message list reads them to tell an answered widget from an open one after\n * a reload — a widget the owner already clicked must never come back interactive (a consent widget re-armed is a second\n * confirmation for a destructive tool). Add a source here when a widget of the package starts posting a new one.\n */\nexport const FRONTEND_WIDGET_CLICK_SIGNAL_SOURCE = \"FRONTEND_WIDGET_CLICK\";\nexport const OWNER_ACTION_CONFIRM_SIGNAL_SOURCE = \"OWNER_ACTION_CONFIRM\";\n\n/** The package's own widget click sources (the backend's sources of the package that carry an owner statement). */\nexport const PACKAGE_WIDGET_CLICK_SIGNAL_SOURCES: readonly string[] = [\n FRONTEND_WIDGET_CLICK_SIGNAL_SOURCE,\n OWNER_ACTION_CONFIRM_SIGNAL_SOURCE,\n];\n\n/** Every widget click source: the package's own and the app's further ones. */\nexport const getWidgetClickSignalSources = (): readonly string[] => [\n ...PACKAGE_WIDGET_CLICK_SIGNAL_SOURCES,\n ...getFurtherWidgetClickSignalSources(),\n];\n\nexport const isWidgetClickSignalSource = (signalSource: string | undefined | null): boolean =>\n signalSource != null && getWidgetClickSignalSources().includes(signalSource);\n"],"names":["next","styles"],"mappings":";;;;;;;;AAeO,MAAM,4BAA4B,CAAC,eAA+D;AACvG,MAAI,CAAC,WAAY,QAAO;AACxB,SACE,2BAA2B,QAAQ,KAAK,CAAC,UAAU,MAAM,SAAS,cAAc,MAAM,iBAAiB,IAAI,KAAK;AAEpH;AAWO,MAAM,kCAAkC,CAAC,aAAyD;AACvG,MAAI,CAAC,SAAU,QAAO;AACtB,SACE,2BAA2B,QAAQ;AAAA,IACjC,CAAC,UAAU,MAA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AA;AAAA,IAGrC;AACA,YAAQ,cAAc,sBAAsB,OAAO,IAAI;AACvD,QAAI,OAAO,IAAI,IAAI;AACnB,WAAO;AAAA,EACT;AAAA,EACA,CAAA;AACF;AAEF,IAAI;AACJ,IAAI,6BAA6B;AAGjC,MAAM,wBAAwB,MAAyC;AACrE,MAAI,uBAAuB,UAAa,+BAA+B,sCAAA,GAAyC;AAC9G,yBAAqB;AAAA,MACnB,GAAG,kCAAA;AAAA,MACH,GAAG;AAAA,IAAA;AAEL,iCAA6B,sCAAA;AAAA,EAC/B;AACA,SAAO;AACT;AAOA,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,MAAM,uBAAuB,CAAC,UAAqC;AACxE,QAAM,EAAE,UAAU,cAAc,OAAO,gBAAgB,OAAO,cAAc,OAAO,UAAA,IAAc;AAEjG,QAAM,gBAAgB;AAAA,IACpB,OAAO,EAAE,aAAa,eAAe,aAAa,UAAA;AAAA,IAClD,CAAC,aAAa,eAAe,aAAa,SAAS;AAAA,EAAA;AAGrD,SACE,oBAAC,gCAAgC,UAAhC,EAAyC,OAAO,eAC/C,UAAA,oBAAC,UAAA,EAAS,eAA8B,YAAY,sBAAA,GAAyB,UAAoB,GACnG;AAEJ;AC1GO,MAAM,sCAAsC;AAC5C,MAAM,qCAAqC;AAG3C,MAAM,sCAAyD;AAAA,EACpE;AAAA,EACA;AACF;AAGO,MAAM,8BAA8B,MAAyB;AAAA,EAClE,GAAG;AAAA,EACH,GAAG,mCAAA;AACL;AAEO,MAAM,4BAA4B,CAAC,iBACxC,gBAAgB,QAAQ,4BAAA,EAA8B,SAAS,YAAY;"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { Q as getSandboxLegacyAliases } from "./WebSearchResultsConversationWidget-BvnLWHyi.js";
2
+ import { Q as getSandboxLegacyAliases } from "./index-7Qc_3GbG.js";
3
3
  const WIDGET_IMAGE_READINESS_GLOBAL_NAME = "__AGENTS_WIDGET_IMAGE_V1__";
4
4
  const readWidgetImageReadinessGlobalNames = () => [
5
5
  WIDGET_IMAGE_READINESS_GLOBAL_NAME,
@@ -22,4 +22,4 @@ export {
22
22
  publishWidgetImageReadiness as p,
23
23
  readWidgetImageReadiness as r
24
24
  };
25
- //# sourceMappingURL=widget-image-readiness-signal-DeOuL89j.js.map
25
+ //# sourceMappingURL=widget-image-readiness-signal-D3ci53xr.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"widget-image-readiness-signal-DeOuL89j.js","sources":["../../src/image-render/widget-image-readiness-signal.ts"],"sourcesContent":["import { getSandboxLegacyAliases } from \"../provider/environment\";\nimport type { WidgetImageReadiness } from \"./widget-image-render.types\";\n\n/** The `window` property the image capture waits on. */\nexport const WIDGET_IMAGE_READINESS_GLOBAL_NAME = \"__AGENTS_WIDGET_IMAGE_V1__\";\n\ntype WindowSignals = Record<string, WidgetImageReadiness | undefined>;\n\n/**\n * Every name the image readiness signal is published under: the package's own, then each name the app declares\n * (`AgentsEnvironment.sandboxLegacyAliases.imageReadinessGlobalNames`) — read at each publish, so an app may declare\n * them after a readiness was created.\n */\nexport const readWidgetImageReadinessGlobalNames = (): string[] => [\n WIDGET_IMAGE_READINESS_GLOBAL_NAME,\n ...(getSandboxLegacyAliases().imageReadinessGlobalNames ?? []).filter(\n (aliasName) => aliasName !== WIDGET_IMAGE_READINESS_GLOBAL_NAME,\n ),\n];\n\n/** Publishes (or with `undefined` clears) the image readiness signal under every name. */\nexport const publishWidgetImageReadiness = (readiness: WidgetImageReadiness | undefined): void => {\n const windowSignals = window as unknown as WindowSignals;\n for (const globalName of readWidgetImageReadinessGlobalNames()) windowSignals[globalName] = readiness;\n};\n\n/**\n * The published image readiness signal. A `failed` value under ANY name wins — the app's own capture code may have\n * written it under a name it declared — otherwise the value under the package's name, otherwise the first value found.\n */\nexport const readWidgetImageReadiness = (): WidgetImageReadiness | undefined => {\n const windowSignals = window as unknown as WindowSignals;\n const publishedSignals = readWidgetImageReadinessGlobalNames()\n .map((globalName) => windowSignals[globalName])\n .filter((signal): signal is WidgetImageReadiness => signal !== undefined && signal !== null);\n return publishedSignals.find((signal) => signal.state === \"failed\") ?? publishedSignals[0];\n};\n"],"names":[],"mappings":";;AAIO,MAAM,qCAAqC;AAS3C,MAAM,sCAAsC,MAAgB;AAAA,EACjE;AAAA,EACA,IAAI,wBAAA,EAA0B,6BAA6B,CAAA,GAAI;AAAA,IAC7D,CAAC,cAAc,cAAc;AAAA,EAAA;AAEjC;AAGO,MAAM,8BAA8B,CAAC,cAAsD;AAChG,QAAM,gBAAgB;AACtB,aAAW,cAAc,oCAAA,EAAuC,eAAc,UAAU,IAAI;AAC9F;AAMO,MAAM,2BAA2B,MAAwC;AAC9E,QAAM,gBAAgB;AACtB,QAAM,mBAAmB,oCAAA,EACtB,IAAI,CAAC,eAAe,cAAc,UAAU,CAAC,EAC7C,OAAO,CAAC,WAA2C,WAAW,UAAa,WAAW,IAAI;AAC7F,SAAO,iBAAiB,KAAK,CAAC,WAAW,OAAO,UAAU,QAAQ,KAAK,iBAAiB,CAAC;AAC3F;"}
1
+ {"version":3,"file":"widget-image-readiness-signal-D3ci53xr.js","sources":["../../src/image-render/widget-image-readiness-signal.ts"],"sourcesContent":["import { getSandboxLegacyAliases } from \"../provider/environment\";\nimport type { WidgetImageReadiness } from \"./widget-image-render.types\";\n\n/** The `window` property the image capture waits on. */\nexport const WIDGET_IMAGE_READINESS_GLOBAL_NAME = \"__AGENTS_WIDGET_IMAGE_V1__\";\n\ntype WindowSignals = Record<string, WidgetImageReadiness | undefined>;\n\n/**\n * Every name the image readiness signal is published under: the package's own, then each name the app declares\n * (`AgentsEnvironment.sandboxLegacyAliases.imageReadinessGlobalNames`) — read at each publish, so an app may declare\n * them after a readiness was created.\n */\nexport const readWidgetImageReadinessGlobalNames = (): string[] => [\n WIDGET_IMAGE_READINESS_GLOBAL_NAME,\n ...(getSandboxLegacyAliases().imageReadinessGlobalNames ?? []).filter(\n (aliasName) => aliasName !== WIDGET_IMAGE_READINESS_GLOBAL_NAME,\n ),\n];\n\n/** Publishes (or with `undefined` clears) the image readiness signal under every name. */\nexport const publishWidgetImageReadiness = (readiness: WidgetImageReadiness | undefined): void => {\n const windowSignals = window as unknown as WindowSignals;\n for (const globalName of readWidgetImageReadinessGlobalNames()) windowSignals[globalName] = readiness;\n};\n\n/**\n * The published image readiness signal. A `failed` value under ANY name wins — the app's own capture code may have\n * written it under a name it declared — otherwise the value under the package's name, otherwise the first value found.\n */\nexport const readWidgetImageReadiness = (): WidgetImageReadiness | undefined => {\n const windowSignals = window as unknown as WindowSignals;\n const publishedSignals = readWidgetImageReadinessGlobalNames()\n .map((globalName) => windowSignals[globalName])\n .filter((signal): signal is WidgetImageReadiness => signal !== undefined && signal !== null);\n return publishedSignals.find((signal) => signal.state === \"failed\") ?? publishedSignals[0];\n};\n"],"names":[],"mappings":";;AAIO,MAAM,qCAAqC;AAS3C,MAAM,sCAAsC,MAAgB;AAAA,EACjE;AAAA,EACA,IAAI,wBAAA,EAA0B,6BAA6B,CAAA,GAAI;AAAA,IAC7D,CAAC,cAAc,cAAc;AAAA,EAAA;AAEjC;AAGO,MAAM,8BAA8B,CAAC,cAAsD;AAChG,QAAM,gBAAgB;AACtB,aAAW,cAAc,oCAAA,EAAuC,eAAc,UAAU,IAAI;AAC9F;AAMO,MAAM,2BAA2B,MAAwC;AAC9E,QAAM,gBAAgB;AACtB,QAAM,mBAAmB,oCAAA,EACtB,IAAI,CAAC,eAAe,cAAc,UAAU,CAAC,EAC7C,OAAO,CAAC,WAA2C,WAAW,UAAa,WAAW,IAAI;AAC7F,SAAO,iBAAiB,KAAK,CAAC,WAAW,OAAO,UAAU,QAAQ,KAAK,iBAAiB,CAAC;AAC3F;"}