diff --git a/.changeset/25921-plugin-chatbot-zero-consumer-exports.md b/.changeset/25921-plugin-chatbot-zero-consumer-exports.md new file mode 100644 index 00000000000..e5fe3bea3df --- /dev/null +++ b/.changeset/25921-plugin-chatbot-zero-consumer-exports.md @@ -0,0 +1,19 @@ +--- +'@object-ui/plugin-chatbot': patch +--- + +refactor(plugin-chatbot)!: retire eight zero-consumer exports (the floating chatbot context hook and its three types, the message item props, one adapter helper and two display helpers) + +Clause-②: no (narrowing) +Metadata-protocol: none + + + +**BREAKING** for a host that imports any of these eight names from `@object-ui/plugin-chatbot`. None had an importer anywhere in the workspace or in hotcrm, so the Console and every `@object-ui/*` package are unaffected. Every module stays in the package: `FloatingChatbotTrigger` and `FloatingChatbotPanel` keep reading the floating state through the hook, `toRuntimeMessages` keeps converting tool invocations, and `ChatbotEnhanced` keeps rendering tool results and error summaries with the two helpers. Only the entry stops publishing them. `FloatingChatbot`, `FloatingChatbotProvider`, `FloatingChatbotTrigger`, `FloatingChatbotPanel` and their `…Props` types, `toRuntimeMessages`, `authoredToRuntimeMessage`, `toRuntimeRole`, `toRuntimeTimestamp`, `toRuntimeToolState`, `humanizeToolName`, `TypingIndicator`, `emitAiUsageRefresh` and `AGENT_ALIAS_GROUPS` stay exported unchanged. + +What leaves, and what to write instead: + +- FROM `useFloatingChatbot`, `FloatingChatbotState`, `FloatingChatbotActions`, `FloatingChatbotContextValue` TO `FloatingChatbotTrigger` and `FloatingChatbotPanel` inside a `FloatingChatbotProvider`, which open, close and toggle the panel themselves; for a control of your own, hold the open state in your own component. +- FROM `ChatMessageProps` TO `ChatbotProps`: `Chatbot` renders the message rows itself. +- FROM `toRuntimeToolInvocation` TO `toRuntimeMessages` or `authoredToRuntimeMessage`, which convert every tool invocation of a message. +- FROM `unwrapToolResult`, `summarizeChatError` TO no replacement: `ChatbotEnhanced` applies both itself; keep a local copy if your own chat surface needs them. diff --git a/ui/packages/plugin-chatbot/src/index.tsx b/ui/packages/plugin-chatbot/src/index.tsx index 8bdaa160490..b1b2604a809 100644 --- a/ui/packages/plugin-chatbot/src/index.tsx +++ b/ui/packages/plugin-chatbot/src/index.tsx @@ -141,8 +141,8 @@ const Chatbot = React.forwardRef( ) Chatbot.displayName = "Chatbot" -// Individual message component -export interface ChatMessageProps { +// Individual message component (its props are local: nothing outside the package named them) +interface ChatMessageProps { message: ChatbotEnhancedMessage showTimestamp?: boolean userAvatarUrl?: string @@ -284,13 +284,11 @@ export { // Export floating chatbot components export { FloatingChatbot } from './FloatingChatbot'; export type { FloatingChatbotProps } from './FloatingChatbot'; -export { FloatingChatbotProvider, useFloatingChatbot } from './FloatingChatbotProvider'; -export type { - FloatingChatbotProviderProps, - FloatingChatbotState, - FloatingChatbotActions, - FloatingChatbotContextValue, -} from './FloatingChatbotProvider'; +// `useFloatingChatbot` and its three state/action/context types left the entry +// with zero importers outside the package; the trigger and panel read it from +// the module. +export { FloatingChatbotProvider } from './FloatingChatbotProvider'; +export type { FloatingChatbotProviderProps } from './FloatingChatbotProvider'; export { FloatingChatbotTrigger } from './FloatingChatbotTrigger'; export type { FloatingChatbotTriggerProps } from './FloatingChatbotTrigger'; export { FloatingChatbotPanel } from './FloatingChatbotPanel'; @@ -385,7 +383,6 @@ export { toRuntimeMessages, toRuntimeRole, toRuntimeTimestamp, - toRuntimeToolInvocation, toRuntimeToolState, } from './chatMessageAdapter'; @@ -399,14 +396,10 @@ export { */ export type { SeamChatMessage, SeamToolInvocation } from './chatMessageAdapter'; -// Display helpers used internally by ChatbotEnhanced. Exported so app -// authors composing their own chat surface get the same pretty tool-call -// rendering and friendly error summaries for free. -export { - humanizeToolName, - unwrapToolResult, - summarizeChatError, -} from './tool-display'; +// Display helper used internally by ChatbotEnhanced, exported for app authors +// composing their own chat surface. `unwrapToolResult` and `summarizeChatError` +// left the entry with zero importers outside the package. +export { humanizeToolName } from './tool-display'; // HITL (Human-In-The-Loop) pending-actions inbox. Talks to // `@objectstack/service-ai` at `/api/v1/ai/pending-actions/*`. Shared