@mgamadeus/ddd-agents 0.0.0-stage → 0.1.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +14 -2
- package/dist/chat.js +5263 -0
- package/dist/chat.js.map +1 -0
- package/dist/chunks/AgentsConversationClientContext-C4T7g_Qk.js +22 -0
- package/dist/chunks/AgentsConversationClientContext-C4T7g_Qk.js.map +1 -0
- package/dist/chunks/ConversationMarkdown-W7NHglmL.js +399 -0
- package/dist/chunks/ConversationMarkdown-W7NHglmL.js.map +1 -0
- package/dist/chunks/WebSearchResultsConversationWidget-BvnLWHyi.js +5059 -0
- package/dist/chunks/WebSearchResultsConversationWidget-BvnLWHyi.js.map +1 -0
- package/dist/chunks/canvas-behaviours-BRFR1ALE.js +45 -0
- package/dist/chunks/canvas-behaviours-BRFR1ALE.js.map +1 -0
- package/dist/chunks/canvas-feature-flags-BmmxC3bz.js +11 -0
- package/dist/chunks/canvas-feature-flags-BmmxC3bz.js.map +1 -0
- package/dist/chunks/canvasBodies-9SuF6NAB.js +289 -0
- package/dist/chunks/canvasBodies-9SuF6NAB.js.map +1 -0
- package/dist/chunks/d3-7.6.1.min.js-DTmPafrl.js +6 -0
- package/dist/chunks/d3-7.6.1.min.js-DTmPafrl.js.map +1 -0
- package/dist/chunks/decide-canvas-open-Ct-wnNEJ.js +20 -0
- package/dist/chunks/decide-canvas-open-Ct-wnNEJ.js.map +1 -0
- package/dist/chunks/widget-image-readiness-signal-DeOuL89j.js +25 -0
- package/dist/chunks/widget-image-readiness-signal-DeOuL89j.js.map +1 -0
- package/dist/chunks/widget-name-resolver-DyIY6Zu4.js +9736 -0
- package/dist/chunks/widget-name-resolver-DyIY6Zu4.js.map +1 -0
- package/dist/chunks/withPollingChangeSubscription-BLDAWF-o.js +251 -0
- package/dist/chunks/withPollingChangeSubscription-BLDAWF-o.js.map +1 -0
- package/dist/client-testing.js +346 -0
- package/dist/client-testing.js.map +1 -0
- package/dist/client.js +16 -0
- package/dist/client.js.map +1 -0
- package/dist/contract.js +31 -0
- package/dist/contract.js.map +1 -0
- package/dist/image-render.js +334 -0
- package/dist/image-render.js.map +1 -0
- package/dist/index.js +80 -0
- package/dist/index.js.map +1 -0
- package/dist/kit.js +13 -0
- package/dist/kit.js.map +1 -0
- package/dist/preview.js +733 -0
- package/dist/preview.js.map +1 -0
- package/dist/renderer.js +115 -0
- package/dist/renderer.js.map +1 -0
- package/dist/styles.css +6768 -0
- package/dist/types/chat/AgentChat/AgentChat.d.ts +37 -0
- package/dist/types/chat/AgentChatActivityHistory/AgentChatActivityHistory.d.ts +6 -0
- package/dist/types/chat/AgentChatActivityIndicator/AgentChatActivityIndicator.d.ts +8 -0
- package/dist/types/chat/CanvasPane/CanvasPane.d.ts +15 -0
- package/dist/types/chat/CanvasResizeHandle/CanvasResizeHandle.d.ts +10 -0
- package/dist/types/chat/CanvasResizeHandle/use-canvas-resize.d.ts +43 -0
- package/dist/types/chat/ConversationClosedBar/ConversationClosedBar.d.ts +10 -0
- package/dist/types/chat/ConversationErrorCard/ConversationErrorCard.d.ts +13 -0
- package/dist/types/chat/ConversationIntroCard/ConversationIntroCard.d.ts +10 -0
- package/dist/types/chat/ConversationLoadingStates.d.ts +2 -0
- package/dist/types/chat/ConversationMessage/ConversationCallMarkerChip/ConversationCallMarkerChip.d.ts +14 -0
- package/dist/types/chat/ConversationMessage/ConversationCallMarkerChip/VoiceBarsIcon/VoiceBarsIcon.d.ts +8 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageSystem/ConversationMessageSystem.d.ts +8 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageSystem/ConversationMessageSystemHeader/ConversationMessageSystemHeader.d.ts +9 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageUser/ConversationMessageUser.d.ts +7 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageUser/ConversationMessageUserWidgets.d.ts +14 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/ConversationMessageHeader/ConversationMessageHeader.d.ts +7 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/ConversationMessageThinking/ConversationMessageThinking.d.ts +7 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/ConversationMessageWidgets.d.ts +29 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/copyRichToClipboard.d.ts +1 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/hooks/useFreshMessageBlockReveal.d.ts +14 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/hooks/useStreamingText.d.ts +8 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/hooks/useTypewriter.d.ts +12 -0
- package/dist/types/chat/ConversationMessage/ConversationTaskInstructionDisclosure/ConversationTaskInstructionDisclosure.d.ts +12 -0
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInput.d.ts +111 -0
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentPreviewCard.d.ts +34 -0
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentsErrorBox.d.ts +22 -0
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentsPreviewStrip.d.ts +12 -0
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/convert-bytes-to-size-string.d.ts +2 -0
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputComposerWidgets/ConversationMessageInputComposerWidgets.d.ts +12 -0
- package/dist/types/chat/ConversationMessageList/ConversationMessageList.d.ts +75 -0
- package/dist/types/chat/ConversationScrollToLatestMessageButton/ConversationScrollToLatestMessageButton.d.ts +6 -0
- package/dist/types/chat/ConversationSuggestionCard/ConversationSuggestionCard.d.ts +7 -0
- package/dist/types/chat/ConversationView.d.ts +216 -0
- package/dist/types/chat/ConversationViewBody/ConversationViewBody.d.ts +214 -0
- package/dist/types/chat/ConversationViewBody/hooks/useIsMessagesBottomOutOfView.d.ts +2 -0
- package/dist/types/chat/ConversationViewBody/hooks/usePinQuestionOnSend.d.ts +24 -0
- package/dist/types/chat/assistant-message-has-renderable-markdown.d.ts +13 -0
- package/dist/types/chat/chat-assistant-identity.d.ts +24 -0
- package/dist/types/chat/chat-message.d.ts +11 -0
- package/dist/types/chat/controller/AgentChatController.d.ts +97 -0
- package/dist/types/chat/controller/activity-ticker.d.ts +120 -0
- package/dist/types/chat/controller/changed-messages-request.d.ts +12 -0
- package/dist/types/chat/controller/chat-scroll-target.d.ts +10 -0
- package/dist/types/chat/controller/conversation-change-signal-rules.d.ts +64 -0
- package/dist/types/chat/controller/derive-agent-activity.d.ts +31 -0
- package/dist/types/chat/controller/merge-activity-elements.d.ts +25 -0
- package/dist/types/chat/controller/pending-start-request.d.ts +38 -0
- package/dist/types/chat/controller/use-activity-ticker.d.ts +60 -0
- package/dist/types/chat/controller/use-conversation-activity.d.ts +38 -0
- package/dist/types/chat/controller/use-conversation-live-updates.d.ts +30 -0
- package/dist/types/chat/controller/use-conversation-message-pages.d.ts +24 -0
- package/dist/types/chat/controller/use-conversation-scroll-jump.d.ts +47 -0
- package/dist/types/chat/controller/use-conversation-search.d.ts +31 -0
- package/dist/types/chat/controller/use-conversation-signals.d.ts +44 -0
- package/dist/types/chat/controller/use-debounced-semantic-search.d.ts +15 -0
- package/dist/types/chat/conversation-send-message.d.ts +43 -0
- package/dist/types/chat/last-wire-message-is-unanswered-user-message.d.ts +22 -0
- package/dist/types/chat/normalize-server-message-to-markdown.d.ts +23 -0
- package/dist/types/chat/store/agents-chat-state.d.ts +132 -0
- package/dist/types/chat/store/conversation-error-type.d.ts +32 -0
- package/dist/types/chat/store/create-agents-chat-store.d.ts +23 -0
- package/dist/types/chat/store/index.d.ts +5 -0
- package/dist/types/chat/store/merge-chat-messages.d.ts +20 -0
- package/dist/types/chat/store/reduce-agents-chat-state.d.ts +7 -0
- package/dist/types/chat/store/use-agents-chat-store.d.ts +22 -0
- package/dist/types/chat/strip-pre-call-message-marker.d.ts +12 -0
- package/dist/types/chat/use-canvas-shell-transitions.d.ts +25 -0
- package/dist/types/client/AgentsConversationClient.d.ts +93 -0
- package/dist/types/client/AgentsConversationClientContext.d.ts +17 -0
- package/dist/types/client/polling/createPollingConversationChangeSubscription.d.ts +62 -0
- package/dist/types/client/polling/withPollingChangeSubscription.d.ts +11 -0
- package/dist/types/client/testing/createInMemoryAgentsConversationClient.d.ts +139 -0
- package/dist/types/contract/conversation.d.ts +370 -0
- package/dist/types/entries/chat.d.ts +21 -0
- package/dist/types/entries/client-testing.d.ts +1 -0
- package/dist/types/entries/client.d.ts +4 -0
- package/dist/types/entries/contract.d.ts +1 -0
- package/dist/types/entries/image-render.d.ts +9 -0
- package/dist/types/entries/index.d.ts +9 -0
- package/dist/types/entries/kit.d.ts +4 -0
- package/dist/types/entries/preview.d.ts +8 -0
- package/dist/types/entries/renderer.d.ts +15 -0
- package/dist/types/entries/widgets.d.ts +16 -0
- package/dist/types/image-render/ComposedViewEmailDataTimes/ComposedViewEmailDataTimes.d.ts +15 -0
- package/dist/types/image-render/WidgetImageRender.d.ts +55 -0
- package/dist/types/image-render/WidgetImageRenderContext.d.ts +14 -0
- package/dist/types/image-render/composed-view-data-times.d.ts +20 -0
- package/dist/types/image-render/frozen-widget-requests.d.ts +2 -0
- package/dist/types/image-render/live-widget-requests.d.ts +4 -0
- package/dist/types/image-render/widget-image-google-map.d.ts +7 -0
- package/dist/types/image-render/widget-image-readiness-signal.d.ts +16 -0
- package/dist/types/image-render/widget-image-readiness.d.ts +9 -0
- package/dist/types/image-render/widget-image-render.types.d.ts +47 -0
- package/dist/types/kit/ComposedViewConversationWidget.d.ts +14 -0
- package/dist/types/kit/ComposedViewDataSourceLoader.d.ts +20 -0
- package/dist/types/kit/ComposedViewRenderer.d.ts +30 -0
- package/dist/types/kit/ComposedViewSlotErrorBoundary.d.ts +23 -0
- package/dist/types/kit/ModelText/ModelText.d.ts +12 -0
- package/dist/types/kit/components/embedding/EmbeddedConversationWidget.d.ts +26 -0
- package/dist/types/kit/components/map/map-full-screen-instance.d.ts +26 -0
- package/dist/types/kit/components/map/map-presentation-context.d.ts +8 -0
- package/dist/types/kit/components/text/shared/text-node-values.d.ts +39 -0
- package/dist/types/kit/composed-view-component-types.d.ts +61 -0
- package/dist/types/kit/composed-view-components.d.ts +7 -0
- package/dist/types/kit/composed-view-tones.d.ts +20 -0
- package/dist/types/kit/entity-detail/EntityDetailCanvasBody.d.ts +9 -0
- package/dist/types/kit/entity-detail/entity-detail-bodies.d.ts +32 -0
- package/dist/types/kit/entity-detail/entity-detail-name.d.ts +9 -0
- package/dist/types/kit/hooks/use-debounced-value.d.ts +2 -0
- package/dist/types/kit/map-full-screen/MapFullScreenCanvasBody.d.ts +11 -0
- package/dist/types/preview/WidgetPreviewHost.d.ts +20 -0
- package/dist/types/preview/preview-stub-components.d.ts +3 -0
- package/dist/types/preview/widget-preview-fixtures.d.ts +17 -0
- package/dist/types/preview/widget-preview-hydration.d.ts +10 -0
- package/dist/types/preview/widget-preview-readiness.d.ts +27 -0
- package/dist/types/preview/widget-preview-requests.d.ts +16 -0
- package/dist/types/preview/widget-preview-signal.d.ts +10 -0
- package/dist/types/preview/widget-preview.types.d.ts +134 -0
- package/dist/types/provider/AgentsProvider.d.ts +33 -0
- package/dist/types/provider/class-names.d.ts +7 -0
- package/dist/types/provider/components/default-components.d.ts +3 -0
- package/dist/types/provider/components/icon-names.d.ts +9 -0
- package/dist/types/provider/components/index.d.ts +39 -0
- package/dist/types/provider/components/types.d.ts +463 -0
- package/dist/types/provider/environment.d.ts +262 -0
- package/dist/types/provider/index.d.ts +4 -0
- package/dist/types/renderer/ConversationDeepLinkedWidget.d.ts +18 -0
- package/dist/types/renderer/ConversationMarkdown.d.ts +21 -0
- package/dist/types/renderer/ConversationWidgetActions/ConversationWidgetActions.d.ts +7 -0
- package/dist/types/renderer/ConversationWidgetCallbacksContext.d.ts +234 -0
- package/dist/types/renderer/ConversationWidgetContext.d.ts +32 -0
- package/dist/types/renderer/ConversationWidgetErrorBoundary.d.ts +25 -0
- package/dist/types/renderer/ConversationWidgetHost.d.ts +36 -0
- package/dist/types/renderer/ConversationWidgetRenderContext.d.ts +3 -0
- package/dist/types/renderer/MarkdownLink.d.ts +6 -0
- package/dist/types/renderer/WindowedWidget/WindowedWidget.d.ts +16 -0
- package/dist/types/renderer/_access/ConversationWidgetFeatureGate.d.ts +21 -0
- package/dist/types/renderer/_agent-space/ConversationWidgetAgentSpaceFrame.d.ts +12 -0
- package/dist/types/renderer/_agent-space/ConversationWidgetAgentSpaceHeader.d.ts +15 -0
- package/dist/types/renderer/_agent-space/agent-space-name.hydrator.d.ts +7 -0
- package/dist/types/renderer/_agent-space/declared-agent-space-key-field-name.d.ts +8 -0
- package/dist/types/renderer/_agent-space/use-resolved-conversation-widget-agent-space-key.d.ts +16 -0
- package/dist/types/renderer/_agent-space/widget-agent-space-key-attribute.d.ts +13 -0
- package/dist/types/renderer/balanced-json-object.d.ts +12 -0
- package/dist/types/renderer/canvas/CanvasRestoreOnMount.d.ts +19 -0
- package/dist/types/renderer/canvas/canvas-behaviours.d.ts +84 -0
- package/dist/types/renderer/canvas/canvas-body-props.d.ts +18 -0
- package/dist/types/renderer/canvas/canvas-feature-flags.d.ts +11 -0
- package/dist/types/renderer/canvas/canvas-reducers.d.ts +46 -0
- package/dist/types/renderer/canvas/canvas-state.d.ts +107 -0
- package/dist/types/renderer/canvas/canvasBodies.d.ts +19 -0
- package/dist/types/renderer/canvas/canvasStorage.d.ts +25 -0
- package/dist/types/renderer/canvas/decide-canvas-open.d.ts +32 -0
- package/dist/types/renderer/canvas/entity-detail-instance.d.ts +27 -0
- package/dist/types/renderer/canvas/find-widget-fences-in-markdown.d.ts +32 -0
- package/dist/types/renderer/canvas/use-anchor-widget-payload.d.ts +8 -0
- package/dist/types/renderer/composer-widget-fence.d.ts +30 -0
- package/dist/types/renderer/conversation-composer-widget.d.ts +13 -0
- package/dist/types/renderer/conversation-widget-props.d.ts +54 -0
- package/dist/types/renderer/conversation-widget-state-partition.d.ts +31 -0
- package/dist/types/renderer/conversationWidgetAstPlugin.d.ts +11 -0
- package/dist/types/renderer/conversationWidgetRegistry.d.ts +74 -0
- package/dist/types/renderer/detect-unrendered-widgets.d.ts +42 -0
- package/dist/types/renderer/markdown-contains-widget.d.ts +13 -0
- package/dist/types/renderer/reference-naked-widget-json.d.ts +1 -0
- package/dist/types/renderer/remarkWidgetFencePlugin.d.ts +22 -0
- package/dist/types/renderer/render-report/widget-render-report-collector.d.ts +57 -0
- package/dist/types/renderer/render-report/widget-render-report.d.ts +29 -0
- package/dist/types/renderer/repair-malformed-widget-fences.d.ts +11 -0
- package/dist/types/renderer/resolve-deep-linkable-widget.d.ts +25 -0
- package/dist/types/renderer/restoreTextDirectivesPlugin.d.ts +12 -0
- package/dist/types/renderer/widget-click-signal-sources.d.ts +15 -0
- package/dist/types/renderer/widget-fence-json.d.ts +16 -0
- package/dist/types/renderer/widget-fence-syntax.d.ts +25 -0
- package/dist/types/renderer/widget-hydration/index.d.ts +8 -0
- package/dist/types/renderer/widget-hydration/section-hydration.d.ts +41 -0
- package/dist/types/renderer/widget-hydration/use-widget-hydration.d.ts +27 -0
- package/dist/types/renderer/widget-hydration/widget-hydration-state-store.d.ts +27 -0
- package/dist/types/renderer/widget-hydration/widget-hydration.reducer.d.ts +39 -0
- package/dist/types/renderer/widget-hydration/widget-hydration.registry.d.ts +7 -0
- package/dist/types/renderer/widget-hydration/widget-hydration.slice.d.ts +8 -0
- package/dist/types/renderer/widget-hydration/widget-hydration.types.d.ts +27 -0
- package/dist/types/renderer/widget-name-resolver.d.ts +22 -0
- package/dist/types/renderer/widget-tree/bounded-json.d.ts +23 -0
- package/dist/types/renderer/widget-tree/composed-node-schema.d.ts +143 -0
- package/dist/types/renderer/widget-tree/composed-view-data-sources.d.ts +41 -0
- package/dist/types/renderer/widget-tree/composed-view-tree.d.ts +111 -0
- package/dist/types/renderer/widget-tree/expression/evaluate-expression.d.ts +65 -0
- package/dist/types/renderer/widget-tree/expression/parse-expression.d.ts +71 -0
- package/dist/types/renderer/widget-tree/resolve-composed-view-values.d.ts +49 -0
- package/dist/types/renderer/widget-tree/use-composed-view-state.d.ts +16 -0
- package/dist/types/renderer/widget-windowing.d.ts +25 -0
- package/dist/types/widgets/CanvasWidgetCard/CanvasWidgetCard.d.ts +79 -0
- package/dist/types/widgets/CanvasWidgetCard/CanvasWidgetSwitch.d.ts +61 -0
- package/dist/types/widgets/CanvasWidgetCard/canvas-for-message-widget.d.ts +8 -0
- package/dist/types/widgets/CanvasWidgetCard/use-canvas-viable.d.ts +15 -0
- package/dist/types/widgets/ClockConversationWidget/ClockConversationWidget.d.ts +11 -0
- package/dist/types/widgets/ClockConversationWidget/ClockWidget/AnalogClockFace.d.ts +12 -0
- package/dist/types/widgets/ClockConversationWidget/ClockWidget/ClockRow.d.ts +23 -0
- package/dist/types/widgets/ClockConversationWidget/ClockWidget/ClockWidget.d.ts +21 -0
- package/dist/types/widgets/ClockConversationWidget/ClockWidget/DayNightGlyph.d.ts +8 -0
- package/dist/types/widgets/ClockConversationWidget/shared/clock-time.d.ts +52 -0
- package/dist/types/widgets/ClockConversationWidget/shared/clock-widget-payload.d.ts +23 -0
- package/dist/types/widgets/ClockConversationWidget/shared/use-clock-settings.d.ts +18 -0
- package/dist/types/widgets/ConceptExplainerConversationWidget/ConceptExplainerConversationWidget.d.ts +14 -0
- package/dist/types/widgets/ConceptExplainerConversationWidget/ConceptExplainerWidget/ConceptExplainerWidget.d.ts +27 -0
- package/dist/types/widgets/ConceptExplainerConversationWidget/shared/ConceptExplainerTextView.d.ts +11 -0
- package/dist/types/widgets/ConceptExplainerConversationWidget/shared/concept-explainer-type.d.ts +89 -0
- package/dist/types/widgets/ConceptExplainerConversationWidget/shared/concept-explainer-types.d.ts +17 -0
- package/dist/types/widgets/ConceptExplainerConversationWidget/shared/concept-explainer-widget-payload.d.ts +25 -0
- package/dist/types/widgets/ConceptExplainerConversationWidget/shared/use-concept-explainer-language.d.ts +8 -0
- package/dist/types/widgets/ConversationSearchResultsConversationWidget/ConversationSearchResultsCanvas.d.ts +9 -0
- package/dist/types/widgets/ConversationSearchResultsConversationWidget/ConversationSearchResultsCanvasBody.d.ts +7 -0
- package/dist/types/widgets/ConversationSearchResultsConversationWidget/ConversationSearchResultsConversationWidget.d.ts +15 -0
- package/dist/types/widgets/ConversationSearchResultsConversationWidget/shared/conversation-search-results-widget-payload.d.ts +42 -0
- package/dist/types/widgets/ConversationSearchResultsConversationWidget/shared/search-hit-excerpt.d.ts +1 -0
- package/dist/types/widgets/CurrencyConverterConversationWidget/CurrencyConverterConversationWidget.d.ts +8 -0
- package/dist/types/widgets/CurrencyConverterConversationWidget/CurrencyConverterWidget/CurrencyConverterWidget.d.ts +17 -0
- package/dist/types/widgets/CurrencyConverterConversationWidget/CurrencyConverterWidget/CurrencyLabel/CurrencyLabel.d.ts +9 -0
- package/dist/types/widgets/CurrencyConverterConversationWidget/shared/currency-converter-widget-payload.d.ts +22 -0
- package/dist/types/widgets/CurrencyConverterConversationWidget/shared/currency-display.d.ts +30 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/CustomVisualizationConversationWidget.d.ts +11 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/CustomVisualizationWidget/CustomVisualizationFrame.d.ts +14 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/CustomVisualizationWidget/CustomVisualizationWidget.d.ts +15 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/shared/custom-visualization-frame-protocol.d.ts +77 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/shared/custom-visualization-libraries.d.ts +25 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/shared/custom-visualization-sandbox-config.d.ts +21 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/shared/custom-visualization-widget-payload.d.ts +55 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/shared/read-custom-visualization-theme.d.ts +5 -0
- package/dist/types/widgets/EntityMentionConversationWidget/EntityMentionAskButton/EntityMentionAskButton.d.ts +13 -0
- package/dist/types/widgets/EntityMentionConversationWidget/EntityMentionCard/EntityMentionCard.d.ts +11 -0
- package/dist/types/widgets/EntityMentionConversationWidget/EntityMentionConversationWidget.d.ts +9 -0
- package/dist/types/widgets/EntityMentionConversationWidget/shared/entity-mention-presentation.d.ts +4 -0
- package/dist/types/widgets/EntityMentionConversationWidget/shared/entity-mention.d.ts +33 -0
- package/dist/types/widgets/EntityMentionConversationWidget/shared/use-entity-mention-composer.d.ts +17 -0
- package/dist/types/widgets/MultiChoiceConversationWidget/MultiChoiceConversationWidget.d.ts +2 -0
- package/dist/types/widgets/MultiChoiceConversationWidget/shared/multi-choice-widget-payload.d.ts +16 -0
- package/dist/types/widgets/QuickRepliesConversationWidget/QuickRepliesConversationWidget.d.ts +38 -0
- package/dist/types/widgets/QuickRepliesConversationWidget/shared/quick-replies-widget-payload.d.ts +20 -0
- package/dist/types/widgets/SuggestedActions/SuggestedActions.d.ts +10 -0
- package/dist/types/widgets/ToolTraceConversationWidget/ToolTraceConversationWidget.d.ts +8 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/SourceFavicon.d.ts +10 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchAnswer.d.ts +6 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchReferences.d.ts +12 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchResultsCanvas.d.ts +10 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchResultsCanvasBody.d.ts +7 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchResultsConversationWidget.d.ts +14 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchSourcesList.d.ts +10 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/shared/display-hostname.d.ts +9 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/shared/web-search-results-widget-payload.d.ts +30 -0
- package/dist/types/widgets/WritingDraftConversationWidget/WritingDraftConversationWidget.d.ts +14 -0
- package/dist/types/widgets/WritingDraftConversationWidget/WritingDraftWidget/WritingDraftBody.d.ts +9 -0
- package/dist/types/widgets/WritingDraftConversationWidget/WritingDraftWidget/WritingDraftWidget.d.ts +44 -0
- package/dist/types/widgets/WritingDraftConversationWidget/shared/draft-mail-link.d.ts +17 -0
- package/dist/types/widgets/WritingDraftConversationWidget/shared/draft-plain-text.d.ts +7 -0
- package/dist/types/widgets/WritingDraftConversationWidget/shared/remark-draft-line-breaks.d.ts +13 -0
- package/dist/types/widgets/WritingDraftConversationWidget/shared/writing-draft-widget-payload.d.ts +23 -0
- package/dist/types/widgets/_shared/ConversationWidgetButton.d.ts +4 -0
- package/dist/types/widgets/_shared/DonePill.d.ts +14 -0
- package/dist/types/widgets/_shared/modern/WidgetKpiValue.d.ts +24 -0
- package/dist/types/widgets/_shared/modern/WidgetListRow.d.ts +14 -0
- package/dist/types/widgets/_shared/modern/WidgetStatusChip.d.ts +8 -0
- package/dist/types/widgets/_shared/modern/WidgetSurface.d.ts +13 -0
- package/dist/types/widgets/_shared/modern/WidgetSurfaceSkeleton.d.ts +11 -0
- package/dist/types/widgets/_shared/modern/index.d.ts +16 -0
- package/dist/types/widgets/_shared/skeleton-primitives.d.ts +20 -0
- package/dist/types/widgets/_shared/use-stack-when-wrapped.d.ts +6 -0
- package/dist/types/widgets/_shared/widget-payload-validation.d.ts +22 -0
- package/dist/widgets.js +84 -0
- package/dist/widgets.js.map +1 -0
- package/package.json +147 -3
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { ActivityElement } from "./merge-activity-elements";
|
|
2
|
+
/**
|
|
3
|
+
* The least time a line stands beside the face before the next one takes its place — the concept's rhythm (the agent
|
|
4
|
+
* prototype's ThinkingIndicator swaps its line every 2.2 s), so every sentence can be read between two swaps.
|
|
5
|
+
*/
|
|
6
|
+
export declare const LINE_PACE_MS = 2200;
|
|
7
|
+
/** The shorter wait while more than {@link BACKLOG_THRESHOLD} lines are queued, so a burst catches up. */
|
|
8
|
+
export declare const BACKLOG_LINE_PACE_MS = 1400;
|
|
9
|
+
/**
|
|
10
|
+
* More queued lines than this are shown at once, oldest first: one narrator answer carries up to 8 lines, and the
|
|
11
|
+
* ticker must never trail the turn by more than a few seconds.
|
|
12
|
+
*/
|
|
13
|
+
export declare const MAX_WAITING_LINES = 4;
|
|
14
|
+
/** Finished turns kept in the thread at most (keepActivityHistoryAfterAnswer); the oldest one falls away beyond. */
|
|
15
|
+
export declare const MAX_KEPT_TURNS = 30;
|
|
16
|
+
/** One sentence the ticker shows: the started or the finished line of one step. */
|
|
17
|
+
export interface ActivityTickerLine {
|
|
18
|
+
toolCallMessageId: number;
|
|
19
|
+
/** The step's state when this line was told: queued / running / finished / failed. */
|
|
20
|
+
state: string;
|
|
21
|
+
line: string;
|
|
22
|
+
kind: string | null;
|
|
23
|
+
/** The delegation helper that ran the step (1-based); null for the assistant's own steps. */
|
|
24
|
+
helperIndex: number | null;
|
|
25
|
+
}
|
|
26
|
+
/** Whether the line's step was still at work (queued or running) when the line was told, not finished or failed. */
|
|
27
|
+
export declare const isStepStillRunning: (line: ActivityTickerLine) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* What the ticker shows and what still waits to be shown. The endpoint delivers lines in bursts (one request per 3 s,
|
|
30
|
+
* up to 8 lines per narrator answer); this queue hands them to the screen one at a time.
|
|
31
|
+
*/
|
|
32
|
+
export interface ActivityTickerQueue {
|
|
33
|
+
/** The line each step shows right now, keyed by its tool-call message id. */
|
|
34
|
+
shownLines: Record<number, ActivityTickerLine>;
|
|
35
|
+
/** The steps shown before the newest one, oldest first; never contains {@link currentId}. */
|
|
36
|
+
trailIds: number[];
|
|
37
|
+
/** The step whose line was shown last: the one beside the face. */
|
|
38
|
+
currentId: number | null;
|
|
39
|
+
/** Lines not shown yet, oldest first, at most one per step (a newer line of the same step replaces the waiting one). */
|
|
40
|
+
waitingLines: ActivityTickerLine[];
|
|
41
|
+
/** When the newest line last changed (ms since epoch); the pace counts from here. */
|
|
42
|
+
lastShownAt: number;
|
|
43
|
+
}
|
|
44
|
+
export declare const EMPTY_ACTIVITY_TICKER_QUEUE: ActivityTickerQueue;
|
|
45
|
+
/** Every shown line in the order it was told, oldest first. */
|
|
46
|
+
export declare const shownLinesInOrder: (queue: ActivityTickerQueue) => ActivityTickerLine[];
|
|
47
|
+
/**
|
|
48
|
+
* Put one line on screen. A line of a step already told replaces that step's line in place (the history keeps every
|
|
49
|
+
* step once); any other line becomes the newest one, beside the face, and the previous newest one moves up into the
|
|
50
|
+
* trail.
|
|
51
|
+
*/
|
|
52
|
+
export declare const showActivityLine: (queue: ActivityTickerQueue, line: ActivityTickerLine, now: number) => ActivityTickerQueue;
|
|
53
|
+
/**
|
|
54
|
+
* Take the endpoint's elements in: every line not shown yet waits in the queue, except the finished line of a step
|
|
55
|
+
* already in the trail, which replaces that row in place at once. Skipped elements and elements of a step never told
|
|
56
|
+
* a sentence never show (only generated sentences appear).
|
|
57
|
+
*/
|
|
58
|
+
export declare const receiveActivityElements: (queue: ActivityTickerQueue, elements: ActivityElement[], now: number) => ActivityTickerQueue;
|
|
59
|
+
/** Milliseconds until the next waiting line may be shown; null when nothing waits. */
|
|
60
|
+
export declare const msUntilNextActivityLine: (queue: ActivityTickerQueue, now: number) => number | null;
|
|
61
|
+
/** Show the oldest waiting line. The caller's timer decides when (see {@link msUntilNextActivityLine}). */
|
|
62
|
+
export declare const releaseNextActivityLine: (queue: ActivityTickerQueue, now: number) => ActivityTickerQueue;
|
|
63
|
+
/** Show every waiting line at once, oldest first — the turn has ended and the answer is on screen. */
|
|
64
|
+
export declare const releaseAllActivityLines: (queue: ActivityTickerQueue, now: number) => ActivityTickerQueue;
|
|
65
|
+
/** Steps the turn has finished or failed, the count the ticker reports. */
|
|
66
|
+
export declare const countFinishedSteps: (elements: ActivityElement[]) => number;
|
|
67
|
+
/**
|
|
68
|
+
* Delegation helpers with a step queued or running right now; a helper running several tool calls counts once. The
|
|
69
|
+
* helper number restarts at 1 for every delegate call, so a helper is told apart by the delegate call its steps follow
|
|
70
|
+
* (the endpoint lists each delegate call's helper steps right after it).
|
|
71
|
+
*/
|
|
72
|
+
export declare const countWorkingHelpers: (elements: ActivityElement[]) => number;
|
|
73
|
+
/** "0:42" / "2:04" — elapsed time as a clock, no unit to translate. */
|
|
74
|
+
export declare const formatElapsedClock: (elapsedMs: number) => string;
|
|
75
|
+
/** Nothing on screen · lines beside the face while the turn runs · the face's success beat after it ended. */
|
|
76
|
+
export type ActivityTickerPhase = "idle" | "live" | "done";
|
|
77
|
+
/** A finished turn whose lines stay in the thread, above its answer, under the message that started it. */
|
|
78
|
+
export interface KeptActivityTurn {
|
|
79
|
+
turnMessageId: number;
|
|
80
|
+
/** Every line the turn told, oldest first. */
|
|
81
|
+
lines: ActivityTickerLine[];
|
|
82
|
+
}
|
|
83
|
+
export interface ActivityTickerState {
|
|
84
|
+
queue: ActivityTickerQueue;
|
|
85
|
+
phase: ActivityTickerPhase;
|
|
86
|
+
/** The message that started the turn on screen, as the endpoint named it; null until it did. */
|
|
87
|
+
turnMessageId: number | null;
|
|
88
|
+
/** When the running turn started on this screen (ms since epoch), for the elapsed clock; null before any turn. */
|
|
89
|
+
liveSince: number | null;
|
|
90
|
+
/** Finished turns that stay in the thread, oldest first; filled only while the history is kept. */
|
|
91
|
+
keptTurns: KeptActivityTurn[];
|
|
92
|
+
/** The `running` of the previous input, to see where a turn starts and ends. */
|
|
93
|
+
wasRunning: boolean;
|
|
94
|
+
}
|
|
95
|
+
export declare const INITIAL_ACTIVITY_TICKER_STATE: ActivityTickerState;
|
|
96
|
+
export type ActivityTickerAction = {
|
|
97
|
+
type: "elementsReceived";
|
|
98
|
+
elements: ActivityElement[];
|
|
99
|
+
running: boolean;
|
|
100
|
+
failed: boolean;
|
|
101
|
+
turnMessageId: number | null;
|
|
102
|
+
/** A turn in its success beat that the next turn replaces goes into {@link ActivityTickerState.keptTurns} first. */
|
|
103
|
+
keepHistory: boolean;
|
|
104
|
+
now: number;
|
|
105
|
+
} | {
|
|
106
|
+
type: "nextLineDue";
|
|
107
|
+
now: number;
|
|
108
|
+
} | {
|
|
109
|
+
type: "doneBeatOver";
|
|
110
|
+
keepHistory: boolean;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* The ticker's life across turns. A turn starts when `running` rises: the queue starts clean and the phase goes live.
|
|
114
|
+
* Within a turn the endpoint's snapshot only grows (mergeActivityElements keeps every row it has seen), so a shown step
|
|
115
|
+
* missing from the elements means another turn or another conversation: the queue starts clean. When `running` falls,
|
|
116
|
+
* the waiting lines are shown at once and the face's success beat follows — unless the turn failed or never told a
|
|
117
|
+
* line. After the beat the turn's lines either stay in the thread ({@link KeptActivityTurn}) or are gone, as
|
|
118
|
+
* `keepHistory` says.
|
|
119
|
+
*/
|
|
120
|
+
export declare const activityTickerReducer: (state: ActivityTickerState, action: ActivityTickerAction) => ActivityTickerState;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChangedMessagesRequest } from "../../contract/conversation";
|
|
2
|
+
import type { ChatMessage } from "../chat-message";
|
|
3
|
+
/**
|
|
4
|
+
* What a live update reads, given the loaded messages: every row written since the newest loaded one, plus every
|
|
5
|
+
* message from the lowest one that can still change. "Written since" goes by id, not index: ids grow with every write,
|
|
6
|
+
* while an index can be taken below the newest loaded one (a call row persisted after the row its execution emitted)
|
|
7
|
+
* or reused (a re-drive after an admin delete-from). The index start never lies below the newest page (a newest-first
|
|
8
|
+
* page of `pageSize` cannot return older rows anyway), so a row a dead worker left pending cannot pin it. Nothing
|
|
9
|
+
* loaded yet → null: the caller reads the newest page as on open. How the request reaches the wire (the filter string)
|
|
10
|
+
* is the binding's matter (`AgentsConversationClient.getChangedMessages`).
|
|
11
|
+
*/
|
|
12
|
+
export declare const buildChangedMessagesRequest: (messages: ChatMessage[] | null, pageSize: number) => ChangedMessagesRequest | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A request to scroll the chat to a specific message and flash it. Produced when a search result is clicked
|
|
3
|
+
* (the app's search → the chat host) and consumed by the chat controller. `nonce` changes on every request so clicking the
|
|
4
|
+
* same result twice re-triggers the scroll even though messageId/indexInConversation are unchanged.
|
|
5
|
+
*/
|
|
6
|
+
export type ChatScrollTarget = {
|
|
7
|
+
messageId?: number | null;
|
|
8
|
+
indexInConversation?: number | null;
|
|
9
|
+
nonce: number;
|
|
10
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ConversationChangeSignal, ConversationRunStatus, ConversationSubscriptionEndReason } from "../../contract/conversation";
|
|
2
|
+
/** While a turn streams, per-message signals arrive in bursts — the re-read is coalesced to one per this window. */
|
|
3
|
+
export declare const LIVE_READ_THROTTLE_MS = 1200;
|
|
4
|
+
/** Grace before the first convergence re-read (lets the terminal status' own immediate read land first). */
|
|
5
|
+
export declare const CONVERGENCE_BASE_DELAY_MS = 700;
|
|
6
|
+
/** Backoff ceiling between convergence re-reads. */
|
|
7
|
+
export declare const CONVERGENCE_MAX_DELAY_MS = 2500;
|
|
8
|
+
/** Stop re-reading for a missing terminal `lastMessageId` after this many attempts (the next action recovers). */
|
|
9
|
+
export declare const CONVERGENCE_MAX_ATTEMPTS = 6;
|
|
10
|
+
/** What the live-update rules make the chat do. */
|
|
11
|
+
export interface ConversationLiveUpdateReads {
|
|
12
|
+
/** Read the rows that changed (the chat's changed-tail read). */
|
|
13
|
+
readChangedMessages: () => void;
|
|
14
|
+
/** Read the conversation's metadata again (title, run state). */
|
|
15
|
+
readConversationMetadata: () => void;
|
|
16
|
+
/** Whether a message is loaded — the convergence check of a terminal signal's `lastMessageId`. */
|
|
17
|
+
hasLoadedMessage: (messageId: number) => boolean;
|
|
18
|
+
/** The run status the chat shows; null once the subscription ended. */
|
|
19
|
+
showRunStatus: (runStatus: ConversationRunStatus | null) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The package's rules over a conversation's live updates — one instance per subscription:
|
|
23
|
+
* - the first pushed signal reads once (a turn may have moved between the chat's open and the subscription), and is
|
|
24
|
+
* the baseline of the counter and of `summaryUpdatedAt`;
|
|
25
|
+
* - a counter advance reads again, throttled to one read per `LIVE_READ_THROTTLE_MS` with one trailing read;
|
|
26
|
+
* - a terminal status reads at once, re-reads the metadata (on the baseline and on every terminal signal that
|
|
27
|
+
* advances the counter: the server closes a conversation after the turn and publishes one more idle signal), and
|
|
28
|
+
* keeps reading with backoff until the signal's `lastMessageId` is loaded (a reply that beat its own commit);
|
|
29
|
+
* - a changed `summaryUpdatedAt` after the baseline re-reads the metadata only;
|
|
30
|
+
* - a status-check emission (`isStatusCheck`) sets the status, and reads again — at once on a terminal status — only
|
|
31
|
+
* while the push path is not alive (the binding's `isPushPathAlive`; without it: no pushed signal arrived yet) and
|
|
32
|
+
* its status differs from the previous check's;
|
|
33
|
+
* - an ended subscription clears the status.
|
|
34
|
+
* The transport's health (reconnect, a dead path, token refresh) is the binding's.
|
|
35
|
+
*/
|
|
36
|
+
export declare class ConversationChangeSignalRules {
|
|
37
|
+
protected readonly reads: ConversationLiveUpdateReads;
|
|
38
|
+
protected lastChangeCounter: number | null;
|
|
39
|
+
protected hasSummaryBaseline: boolean;
|
|
40
|
+
protected lastSummaryUpdatedAt: number | null;
|
|
41
|
+
protected hasPushedSignalArrived: boolean;
|
|
42
|
+
protected lastStatusCheckRunStatus: ConversationRunStatus | null;
|
|
43
|
+
protected lastReadAt: number;
|
|
44
|
+
protected trailingReadTimer: ReturnType<typeof setTimeout> | null;
|
|
45
|
+
protected convergenceTimer: ReturnType<typeof setTimeout> | null;
|
|
46
|
+
protected convergenceAttempt: number;
|
|
47
|
+
protected convergenceMessageId: number | null;
|
|
48
|
+
protected disposed: boolean;
|
|
49
|
+
constructor(reads: ConversationLiveUpdateReads);
|
|
50
|
+
receiveSignal: (signal: ConversationChangeSignal) => void;
|
|
51
|
+
receiveEnd: (_reason: ConversationSubscriptionEndReason) => void;
|
|
52
|
+
/** Reads now, bypassing the throttle (the chat's safety poll). */
|
|
53
|
+
readNow: () => void;
|
|
54
|
+
dispose: () => void;
|
|
55
|
+
protected receiveStatusCheck(runStatus: ConversationRunStatus | null, isPushPathAlive: boolean): void;
|
|
56
|
+
/** One coordinated read path: `immediate` (a terminal status) cancels a pending trailing read and reads now. */
|
|
57
|
+
protected requestRead(immediate: boolean): void;
|
|
58
|
+
protected readThrottled(): void;
|
|
59
|
+
protected readTrailing: () => void;
|
|
60
|
+
protected clearTrailingRead(): void;
|
|
61
|
+
protected convergeOnMessage(messageId: number | null): void;
|
|
62
|
+
protected checkConvergence: () => void;
|
|
63
|
+
protected clearConvergence(): void;
|
|
64
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ChatMessage } from "../chat-message";
|
|
2
|
+
/** How many sub-agents spawned by this message are still working. */
|
|
3
|
+
export declare const countOutstandingChildren: (message: ChatMessage) => number;
|
|
4
|
+
/** A tool call whose result is still to come — its progress lives in `toolCall.status`, never in the row's status. */
|
|
5
|
+
export declare const hasUnresolvedToolCall: (message: ChatMessage) => boolean;
|
|
6
|
+
/** Whether this message's delegation can still change: a child is still working, or the call is not resolved yet. */
|
|
7
|
+
export declare const hasDelegationInFlight: (message: ChatMessage) => boolean;
|
|
8
|
+
export type AgentActivity = {
|
|
9
|
+
/** Whether a turn is in flight — drives the indicator's visibility (ConversationView aiThinking). */
|
|
10
|
+
active: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Translation source string for "what the agent is doing right now" (empty when nothing to show). Rendered through
|
|
13
|
+
* the chat's `Text`, so this is the translatable key with %placeholders% — NOT pre-interpolated. The dynamic values
|
|
14
|
+
* arrive via {@link AgentActivity.replacements} and plural form via {@link AgentActivity.context}.
|
|
15
|
+
*/
|
|
16
|
+
label: string;
|
|
17
|
+
/** Dynamic values substituted into the %placeholders% of {@link AgentActivity.label} by <Text>. */
|
|
18
|
+
replacements?: Record<string, string | number>;
|
|
19
|
+
/** Plural selector for <Text> when the label is count-dependent. */
|
|
20
|
+
context?: "one" | "other";
|
|
21
|
+
/** A non-delegate tool is running → show the ASCII wrench spinner instead of a text label. */
|
|
22
|
+
toolRunning?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Derive "what the agent is doing right now" for the agent activity indicator PURELY from the
|
|
26
|
+
* live conversation data: the message tree (refreshed on each realtime-signal tick / on open) plus the signal's
|
|
27
|
+
* coarse runStatus ("running" | "idle" | "failed" | null). No network. Mirrors the backend truth —
|
|
28
|
+
* AIConversation.runState (IDLE/RUNNING/AWAITING_DELEGATES/…) and per-message status/messageType/toolCall — but reads
|
|
29
|
+
* it off the messages the FE already holds, so the indicator is correct even before the first signal emission.
|
|
30
|
+
*/
|
|
31
|
+
export declare const deriveAgentActivity: (messages: ChatMessage[] | null, runStatus: string | null) => AgentActivity;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ConversationActivityElement } from "../../contract/conversation";
|
|
2
|
+
/**
|
|
3
|
+
* What the activity read sends per element and the stack reads (`ConversationActivityElement`); every field may be
|
|
4
|
+
* missing on an element a caller builds by hand (stories, specs).
|
|
5
|
+
*/
|
|
6
|
+
export type ActivityLineInput = Partial<ConversationActivityElement>;
|
|
7
|
+
/** One row of the stack: the element as the endpoint sent it last, keyed by its tool-call message id. */
|
|
8
|
+
export type ActivityElement = ActivityLineInput & {
|
|
9
|
+
toolCallMessageId: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Merge a response into the stack: a later state replaces an earlier one, a line never disappears once told (an
|
|
13
|
+
* element answered without a line, because the narrator was late, keeps the sentence it already had), and an element
|
|
14
|
+
* the response no longer carries stays (the turn snapshot is complete, so this only happens on a pinned turn that a
|
|
15
|
+
* later turn pushed out of the window). Row order is the endpoint's: the order of the persisted rows.
|
|
16
|
+
*/
|
|
17
|
+
export declare const mergeActivityElements: (previous: ActivityElement[], incoming: ActivityLineInput[] | null | undefined) => ActivityElement[];
|
|
18
|
+
/** The rows the customer reads: skipped elements carry nothing. */
|
|
19
|
+
export declare const visibleActivityElements: (elements: ActivityElement[]) => ActivityElement[];
|
|
20
|
+
/**
|
|
21
|
+
* Whether a response names a turn different from the one pinned locally — the stack must start clean instead of
|
|
22
|
+
* merging the new turn's rows into the previous (already folded) one. False until a turn is pinned, and false while
|
|
23
|
+
* the response has not named a turn yet (a request still in flight for the newly pinned, not-yet-answered turn).
|
|
24
|
+
*/
|
|
25
|
+
export declare const isDifferentTurn: (pinnedTurnMessageId: number | null, answeredTurnMessageId: number | null) => boolean;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A start an agent entry point outside the widget handed over: a visible USER message (`message`), or the invisible
|
|
3
|
+
* START signal behind an EMPTY visible message (`signal`), which makes the agent speak first.
|
|
4
|
+
*/
|
|
5
|
+
export interface PendingStartRequest {
|
|
6
|
+
kind: "message" | "signal";
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The one start the chat should send from the two hand-over fields (the opening request's `userMessage` and
|
|
11
|
+
* `startSignalText`). The app's openers keep at most one of the two set — each clears the
|
|
12
|
+
* other's leftover on the way in — but the message still wins here if both somehow are, since the customer's own words
|
|
13
|
+
* are the stronger request.
|
|
14
|
+
*/
|
|
15
|
+
export declare const pickPendingStartRequest: (pendingStartUserMessage: string | null, pendingStartSignalText: string | null) => PendingStartRequest | null;
|
|
16
|
+
export interface ChatStateForPendingStartRequest {
|
|
17
|
+
/** The start an agent entry point outside the widget handed over (`pickPendingStartRequest`). */
|
|
18
|
+
pendingStartRequest: PendingStartRequest | null;
|
|
19
|
+
/** The conversation the widget currently wants open (the chat's `conversationId` prop). */
|
|
20
|
+
activeConversationId: number | null | undefined;
|
|
21
|
+
/** The conversation the chat slice currently holds — set until a new-chat reset clears it. */
|
|
22
|
+
loadedConversationId: number | null | undefined;
|
|
23
|
+
/** A start-with-message POST is already in flight (the chat store's `startingNewConversation`). */
|
|
24
|
+
startingNewConversation: boolean;
|
|
25
|
+
/** The start this chat has already sent, so the same one is never posted twice. */
|
|
26
|
+
alreadySentStartRequest: PendingStartRequest | null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Whether the chat should send `pendingStartRequest` as the start of a NEW conversation right now. Called on every
|
|
30
|
+
* relevant state change — NOT once on mount: the widget is often already open (and mounted) when an entry point
|
|
31
|
+
* outside it hands over a request, which is what BUF-4009 was.
|
|
32
|
+
*
|
|
33
|
+
* "Not yet" (false) and "never" (false) deliberately look the same to the caller: the request stays in the slice, and
|
|
34
|
+
* this is asked again on the next change. A conversation still being open is the "not yet" case — Agent drops to a new
|
|
35
|
+
* chat when a request arrives, because every incentive CTA promises a fresh chat for its job, and this then says yes
|
|
36
|
+
* on the cold chat that follows.
|
|
37
|
+
*/
|
|
38
|
+
export declare const isChatReadyToSendPendingStartRequest: ({ pendingStartRequest, activeConversationId, loadedConversationId, startingNewConversation, alreadySentStartRequest, }: ChatStateForPendingStartRequest) => boolean;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ActivityTickerLine, ActivityTickerPhase } from "./activity-ticker";
|
|
2
|
+
import { ActivityElement } from "./merge-activity-elements";
|
|
3
|
+
/**
|
|
4
|
+
* How long the face's success beat rests before the face turns back to idle — counted from the start of the success
|
|
5
|
+
* roll. The ticker keeps or drops the turn's lines once it is over; an app's face times its success roll by it.
|
|
6
|
+
*/
|
|
7
|
+
export declare const SUCCESS_BEAT_MS = 1400;
|
|
8
|
+
interface UseActivityTickerParams {
|
|
9
|
+
/** The rows of the running turn from {@link useConversationActivity}, in row order. */
|
|
10
|
+
elements: ActivityElement[];
|
|
11
|
+
/** Whether the endpoint says the turn is still in flight. */
|
|
12
|
+
running: boolean;
|
|
13
|
+
/** The message that started the turn, as the endpoint named it; null until it did. */
|
|
14
|
+
turnMessageId?: number | null;
|
|
15
|
+
/** The turn ended in an error: no success beat, nothing kept. */
|
|
16
|
+
failed?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* After the answer, each finished turn's lines stay in the thread above its answer, under the message that started
|
|
19
|
+
* it; false = they fade out with the line beside the face and nothing remains.
|
|
20
|
+
*/
|
|
21
|
+
keepActivityHistoryAfterAnswer?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** One turn's lines — the turn running now, in the face's success beat, or kept in the thread. */
|
|
24
|
+
export interface ActivityTickerTurn {
|
|
25
|
+
/** The message that started the turn: its kept history stands right after it. Null until the endpoint named it. */
|
|
26
|
+
turnMessageId: number | null;
|
|
27
|
+
/** live = the turn runs; done = it ended. */
|
|
28
|
+
phase: "live" | "done";
|
|
29
|
+
/** Every line told in the turn, oldest first; while live, the last one stands beside the face. */
|
|
30
|
+
lines: ActivityTickerLine[];
|
|
31
|
+
/** Steps finished or failed so far. */
|
|
32
|
+
stepCount: number;
|
|
33
|
+
/** Steps delegation helpers are running right now. */
|
|
34
|
+
helperCount: number;
|
|
35
|
+
/** When the running turn started on this screen (ms since epoch), for the elapsed clock; null once it ended. */
|
|
36
|
+
liveSince: number | null;
|
|
37
|
+
}
|
|
38
|
+
/** What the ticker shows right now — read by AgentActivity (the face and its lines) and the history in the thread. */
|
|
39
|
+
export interface ActivityTicker {
|
|
40
|
+
/** The phase of the turn on screen; the face keeps working while it is live. */
|
|
41
|
+
phase: ActivityTickerPhase;
|
|
42
|
+
/** The turn running now or in the face's success beat; null when idle and before the turn's first line. */
|
|
43
|
+
currentTurn: ActivityTickerTurn | null;
|
|
44
|
+
/**
|
|
45
|
+
* The finished turns whose lines stand in the thread, under the message that started each, oldest first: every kept
|
|
46
|
+
* turn plus the turn in the face's success beat. Empty unless the history is kept; a turn the endpoint never named
|
|
47
|
+
* is never among them (it has no message to stand under).
|
|
48
|
+
*/
|
|
49
|
+
historyTurns: ActivityTickerTurn[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Paces the activity lines of a running turn at the prototype's ThinkingIndicator rhythm. The
|
|
53
|
+
* endpoint delivers lines in bursts; the ticker puts them beside the face one at a time — each stays at least 2.2 s,
|
|
54
|
+
* or 1.4 s while more than two wait — and never falls more than a few lines behind. When the turn ends, the rest is
|
|
55
|
+
* shown at once and the face plays its success beat ({@link SUCCESS_BEAT_MS}); the turn's lines then stay in the
|
|
56
|
+
* thread or are gone, as `keepActivityHistoryAfterAnswer` says. The state machine lives in
|
|
57
|
+
* {@link activityTickerReducer}; this hook only owns the timers.
|
|
58
|
+
*/
|
|
59
|
+
export declare const useActivityTicker: (params: UseActivityTickerParams) => ActivityTicker;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ActivityElement } from "./merge-activity-elements";
|
|
2
|
+
/** At most one activity request per this many milliseconds per conversation, whatever the tick rate. */
|
|
3
|
+
export declare const ACTIVITY_REQUEST_WINDOW_MS = 3000;
|
|
4
|
+
/** While a turn runs, a request also fires on this cadence: the floor for a dead signal. */
|
|
5
|
+
export declare const RUNNING_FLOOR_MS = 4000;
|
|
6
|
+
/**
|
|
7
|
+
* Once the signal no longer says "running", this many failed requests in a row end the turn on screen: an endpoint that
|
|
8
|
+
* keeps failing must not keep the face working and ask again every {@link RUNNING_FLOOR_MS} while the chat is open.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MAX_FAILED_REQUESTS_AFTER_SIGNAL_ENDED = 3;
|
|
11
|
+
type Params = {
|
|
12
|
+
conversationId: number;
|
|
13
|
+
/** The signal's run status: "running" while a turn drives, "idle" / "failed" when it ended, null before the first read. */
|
|
14
|
+
runStatus: string | null;
|
|
15
|
+
/** Advances on every signal tick the host acts on (its message refetch); each advance asks for the activity too. */
|
|
16
|
+
signalVersion: number;
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
};
|
|
19
|
+
type Result = {
|
|
20
|
+
/** The rows of the stack in row order; empty before the first turn of this mount. */
|
|
21
|
+
elements: ActivityElement[];
|
|
22
|
+
/** Whether the narrated turn is still in flight. */
|
|
23
|
+
running: boolean;
|
|
24
|
+
/** The message that started the narrated turn, as the endpoint named it; null before its first answer. */
|
|
25
|
+
turnMessageId: number | null;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* What the agent is doing for the customer right now: pulls the conversation client's
|
|
29
|
+
* `getConversationActivity` (`AgentsConversationClientProvider`) while the customer watches a running turn and merges the answer into the stack. Frontend-driven on purpose: nothing is
|
|
30
|
+
* generated for a hidden tab or a closed chat. The turn is pinned when it starts (`turnMessageId` from the first
|
|
31
|
+
* answer), so a message the customer sends mid-turn does not move the window. Debounced to one request per
|
|
32
|
+
* {@link ACTIVITY_REQUEST_WINDOW_MS} with one trailing request after a burst; a terminal status fires one request for
|
|
33
|
+
* the finished lines, and the requests go on until the endpoint answers that the turn ended — then the stack rests
|
|
34
|
+
* until the next turn. A failed run ends the turn with that last request, whatever it answers, and so do
|
|
35
|
+
* {@link MAX_FAILED_REQUESTS_AFTER_SIGNAL_ENDED} failed requests in a row once the signal stopped saying "running".
|
|
36
|
+
*/
|
|
37
|
+
export declare const useConversationActivity: ({ conversationId, runStatus, signalVersion, enabled, }: Params) => Result;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AgentsConversationClient } from "../../client/AgentsConversationClient";
|
|
2
|
+
import type { ConversationRunStatus } from "../../contract/conversation";
|
|
3
|
+
import type { AgentsChatStore } from "../store/create-agents-chat-store";
|
|
4
|
+
import type { ConversationMessagePages } from "./use-conversation-message-pages";
|
|
5
|
+
export interface ConversationLiveUpdatesInputs {
|
|
6
|
+
client: AgentsConversationClient;
|
|
7
|
+
chatStore: AgentsChatStore;
|
|
8
|
+
/** The reads the rules trigger (`useConversationMessagePages`). */
|
|
9
|
+
messagePages: ConversationMessagePages;
|
|
10
|
+
/** The conversation to follow; undefined for a cold chat (no subscription). */
|
|
11
|
+
conversationId: number | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface ConversationLiveUpdates {
|
|
14
|
+
/** The run status the signal (or the binding's run-state check) reported last; null before the first and once ended. */
|
|
15
|
+
runStatus: ConversationRunStatus | null;
|
|
16
|
+
/** Counts the live reads the rules triggered — the activity read follows it (one activity read per signal tick). */
|
|
17
|
+
liveReadCount: number;
|
|
18
|
+
/** Reads the changed tail now, bypassing the throttle, and counts it (the chat's safety poll). */
|
|
19
|
+
readChangedTailNow: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The chat's live updates over `subscribeToConversationChanges`: one subscription per conversation,
|
|
23
|
+
* the rules of `ConversationChangeSignalRules`, the reads written into the chat store.
|
|
24
|
+
*/
|
|
25
|
+
export declare const useConversationLiveUpdates: (inputs: ConversationLiveUpdatesInputs) => ConversationLiveUpdates;
|
|
26
|
+
/**
|
|
27
|
+
* The run status of a conversation for code outside the chat (the launcher button, the end of a voice call), over the
|
|
28
|
+
* same port function and the same status rules as the chat — without reading any message.
|
|
29
|
+
*/
|
|
30
|
+
export declare const useAgentsConversationRunStatus: (client: AgentsConversationClient, conversationId: number | undefined) => ConversationRunStatus | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AgentsConversationClient } from "../../client/AgentsConversationClient";
|
|
2
|
+
import type { AgentsChatStore } from "../store/create-agents-chat-store";
|
|
3
|
+
/** The page size of every message read of the chat: the newest page, the changed tail and an older page. */
|
|
4
|
+
export declare const CONVERSATION_MESSAGE_PAGE_SIZE = 50;
|
|
5
|
+
export interface ConversationMessagePages {
|
|
6
|
+
/** Reads the conversation without messages into the store; resolves false when the read was refused. */
|
|
7
|
+
readConversationMetadata: (conversationId: number) => Promise<boolean>;
|
|
8
|
+
/** The newest page an open reads; a changed-tail read asked meanwhile waits for it. */
|
|
9
|
+
fetchOpeningPage: (conversationId: number) => void;
|
|
10
|
+
/** The rows written since the newest loaded one and the rows that can still change (a live update). */
|
|
11
|
+
refetchChangedTail: (conversationId: number) => void;
|
|
12
|
+
/** The page before the oldest loaded message (scroll-up); guarded against a second load and an exhausted history. */
|
|
13
|
+
loadOlder: (conversationId: number | undefined) => Promise<void>;
|
|
14
|
+
/** An older page is on its way. */
|
|
15
|
+
loadingOlder: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The chat's message reads over the conversation client port, written into the chat store: the newest page of an
|
|
19
|
+
* open, the changed tail every live update asks for, an older page on scroll-up, and the metadata read. A changed-tail
|
|
20
|
+
* read asked while the open's newest page is still on its way would read that same page again (nothing is loaded yet,
|
|
21
|
+
* so it has no filter): it is held instead and sent once the page is in, reading past what the page brought, so a
|
|
22
|
+
* reply stored in between still arrives. A failed page read changes nothing (the next live update reads again).
|
|
23
|
+
*/
|
|
24
|
+
export declare const useConversationMessagePages: (chatStore: AgentsChatStore, client: AgentsConversationClient, pageSize?: number) => ConversationMessagePages;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
import type { ChatMessage } from "../chat-message";
|
|
3
|
+
import type { ChatScrollTarget } from "./chat-scroll-target";
|
|
4
|
+
/** What the scroll follow reads of the activity ticker: its phase and the lines of the turn on screen. */
|
|
5
|
+
export interface ConversationScrollActivityTicker {
|
|
6
|
+
phase: string;
|
|
7
|
+
currentTurn: {
|
|
8
|
+
lines: {
|
|
9
|
+
toolCallMessageId: number;
|
|
10
|
+
state: string | null;
|
|
11
|
+
}[];
|
|
12
|
+
} | null;
|
|
13
|
+
}
|
|
14
|
+
export interface ConversationScrollJumpInputs {
|
|
15
|
+
/** The top-bar search's request to scroll a message into view and flash it; re-applied whenever its nonce changes. */
|
|
16
|
+
scrollTarget: ChatScrollTarget | undefined;
|
|
17
|
+
/** The conversation the host asked for (the chat's `conversationId` prop) — the one a request is armed for. */
|
|
18
|
+
conversationId: number | undefined;
|
|
19
|
+
/** The conversation the chat store holds right now; differs from `conversationId` for a beat after a switch. */
|
|
20
|
+
conversation: {
|
|
21
|
+
id?: number | null;
|
|
22
|
+
} | null;
|
|
23
|
+
/** The loaded messages: every change retries a pending request. */
|
|
24
|
+
messages: ChatMessage[] | null;
|
|
25
|
+
/** The loaded messages as of the last render, read where the retry runs. */
|
|
26
|
+
messagesRef: RefObject<ChatMessage[] | null>;
|
|
27
|
+
/** Whether an older page exists, as of the last render. */
|
|
28
|
+
hasMoreOlderRef: RefObject<boolean>;
|
|
29
|
+
/** Pages the next older page in (self-guarded against concurrent and exhausted loads). */
|
|
30
|
+
loadOlder: () => Promise<void>;
|
|
31
|
+
/** The chat's scroll container (the host may own it, e.g. for a scroll-linked background). */
|
|
32
|
+
chatScrollRef: RefObject<HTMLDivElement | null>;
|
|
33
|
+
/** What the activity ticker shows; a new line scrolls it into view while the chat follows the bottom. */
|
|
34
|
+
activityTicker: ConversationScrollActivityTicker;
|
|
35
|
+
}
|
|
36
|
+
export interface ConversationScrollJump {
|
|
37
|
+
/** Bottom-follow flag shared with ConversationViewBody; false while a jump is armed and after it. */
|
|
38
|
+
followBottomRef: RefObject<boolean>;
|
|
39
|
+
/** "A programmatic jump is in flight" gate shared with ConversationViewBody. */
|
|
40
|
+
scrollJumpActiveRef: RefObject<boolean>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The chat's programmatic scrolling: the jump to a requested message (paging older pages in until it is rendered, then
|
|
44
|
+
* the flash once the smooth scroll settled) and keeping the activity ticker in view as it grows. Owns the two refs it
|
|
45
|
+
* shares with ConversationViewBody, which suspend the bottom-follow while a jump is armed.
|
|
46
|
+
*/
|
|
47
|
+
export declare const useConversationScrollJump: (inputs: ConversationScrollJumpInputs) => ConversationScrollJump;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ConversationMessageSearchHit, ConversationSearchGroup } from "../../contract/conversation";
|
|
2
|
+
export interface ConversationMessageSearchState {
|
|
3
|
+
query: string;
|
|
4
|
+
setQuery: (query: string) => void;
|
|
5
|
+
trimmedQuery: string;
|
|
6
|
+
hits: ConversationMessageSearchHit[] | null;
|
|
7
|
+
searching: boolean;
|
|
8
|
+
isSearchActive: boolean;
|
|
9
|
+
/** Wipe query + hits. The caller runs this in the click handler that OPENS the panel (see hook doc). */
|
|
10
|
+
clearSearch: () => void;
|
|
11
|
+
}
|
|
12
|
+
export interface ConversationsSearchState {
|
|
13
|
+
query: string;
|
|
14
|
+
setQuery: (query: string) => void;
|
|
15
|
+
trimmedQuery: string;
|
|
16
|
+
searchGroups: ConversationSearchGroup[] | null;
|
|
17
|
+
searching: boolean;
|
|
18
|
+
isSearchActive: boolean;
|
|
19
|
+
/** Wipe query + results. The caller runs this in the click handler that OPENS the panel (see hook doc). */
|
|
20
|
+
clearSearch: () => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* In-conversation "find in this chat" search state: the conversation client's `searchConversationMessages` returns
|
|
24
|
+
* the matched hits of one conversation.
|
|
25
|
+
*/
|
|
26
|
+
export declare const useConversationMessageSearch: (conversationId: number, enabled: boolean) => ConversationMessageSearchState;
|
|
27
|
+
/**
|
|
28
|
+
* Cross-conversation "search all my chats" state: the conversation client's `searchConversations` returns the
|
|
29
|
+
* matches grouped by conversation.
|
|
30
|
+
*/
|
|
31
|
+
export declare const useConversationsSearch: (enabled: boolean) => ConversationsSearchState;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import type { AgentsConversationClient } from "../../client/AgentsConversationClient";
|
|
3
|
+
import type { ChatMessage } from "../chat-message";
|
|
4
|
+
import type { SendMessageHandler } from "../conversation-send-message";
|
|
5
|
+
import type { InjectSignalOptions } from "../../renderer/ConversationWidgetCallbacksContext";
|
|
6
|
+
import { createWidgetRenderReportCollector } from "../../renderer/render-report/widget-render-report-collector";
|
|
7
|
+
export interface ConversationSignalsInputs {
|
|
8
|
+
/** The conversation client the signals go through (`injectSignal`). */
|
|
9
|
+
client: AgentsConversationClient;
|
|
10
|
+
/** The conversation the host asked for (the chat's `conversationId` prop); a signal targets it while none is loaded. */
|
|
11
|
+
conversationId: number | undefined;
|
|
12
|
+
/** The conversation the chat store holds right now. */
|
|
13
|
+
conversation: {
|
|
14
|
+
id?: number | null;
|
|
15
|
+
} | null;
|
|
16
|
+
/** The loaded messages; the newest settled assistant message is checked for a dropped widget block. */
|
|
17
|
+
messages: ChatMessage[] | null;
|
|
18
|
+
/** The signal's run status ("running" | "idle" | "failed" | null). */
|
|
19
|
+
runStatus: string | null;
|
|
20
|
+
/** A start is in flight; a signal is not sent into a conversation that does not exist yet then. */
|
|
21
|
+
startingNewConversation: boolean;
|
|
22
|
+
/** The run is over; the backend refuses further input. */
|
|
23
|
+
isConversationRunEnded: boolean;
|
|
24
|
+
/** The chat's send — a signal without a conversation starts one through it. */
|
|
25
|
+
handleSendMessage: SendMessageHandler;
|
|
26
|
+
/** Shows the closed-conversation refusal on the error card. */
|
|
27
|
+
rejectAsConversationClosed: () => void;
|
|
28
|
+
/** Re-reads the conversation's metadata (the closed run state locks the widget controls). */
|
|
29
|
+
refetchConversationSummary: () => void;
|
|
30
|
+
/** The chat's jump-to-bottom request counter; a customer's click follows the turn it starts. */
|
|
31
|
+
setScrollToBottomNonce: Dispatch<SetStateAction<number>>;
|
|
32
|
+
}
|
|
33
|
+
export interface ConversationSignals {
|
|
34
|
+
/** Injects a model-visible, customer-invisible signal into the current conversation (the widget context's `injectSignal`). */
|
|
35
|
+
handleInjectSignal: (signalText: string, options?: InjectSignalOptions) => Promise<boolean>;
|
|
36
|
+
/** The widget render report collector of the current conversation (one per conversation). */
|
|
37
|
+
renderReportCollector: ReturnType<typeof createWidgetRenderReportCollector>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The signals the chat sends besides the customer's messages: a widget's injected signal (with the closed-conversation
|
|
41
|
+
* guard and the cold start through a START signal), a context-only signal parked until a turn is observed running,
|
|
42
|
+
* the corrective signal for a widget block the renderer dropped, and the widget render report.
|
|
43
|
+
*/
|
|
44
|
+
export declare const useConversationSignals: (inputs: ConversationSignalsInputs) => ConversationSignals;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared semantic-search state with a hard 700ms debounce and a minimum three-character query because every request
|
|
3
|
+
* runs an LLM reranker and consumes AI credits. `enabled` mirrors whether the owning panel is open; the caller runs
|
|
4
|
+
* `clearSearch` in the open handler so it renders clean immediately, while a rising-edge reset effect would flash the
|
|
5
|
+
* previous session's query and results.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useDebouncedSemanticSearch: <TResult>(fetcher: (trimmedQuery: string) => Promise<TResult[]>, enabled: boolean) => {
|
|
8
|
+
query: string;
|
|
9
|
+
setQuery: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
10
|
+
trimmedQuery: string;
|
|
11
|
+
results: TResult[] | null;
|
|
12
|
+
searching: boolean;
|
|
13
|
+
isSearchActive: boolean;
|
|
14
|
+
clearSearch: () => void;
|
|
15
|
+
};
|