Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .changeset/25921-plugin-chatbot-zero-consumer-exports.md
Original file line number Diff line number Diff line change
@@ -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

<!-- adr-0087: not-required (runtime-export-retired @object-ui/plugin-chatbot#useFloatingChatbot, @object-ui/plugin-chatbot#FloatingChatbotState, @object-ui/plugin-chatbot#FloatingChatbotActions, @object-ui/plugin-chatbot#FloatingChatbotContextValue, @object-ui/plugin-chatbot#ChatMessageProps, @object-ui/plugin-chatbot#toRuntimeToolInvocation, @object-ui/plugin-chatbot#unwrapToolResult, @object-ui/plugin-chatbot#summarizeChatError) the retired operands are a React context hook with its state, actions and context-value types, the props interface of an internal message row, one authored-to-runtime tool-invocation converter and two tool-call display helpers; nothing in the workspace or in hotcrm imports any of them from the package entry, and no packages/spec schema, registered node type, conversion surface or stored shape names them, so there is nothing for `objectstack migrate meta` to rewrite -->

**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.
29 changes: 11 additions & 18 deletions ui/packages/plugin-chatbot/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ const Chatbot = React.forwardRef<HTMLDivElement, ChatbotProps>(
)
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
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -385,7 +383,6 @@ export {
toRuntimeMessages,
toRuntimeRole,
toRuntimeTimestamp,
toRuntimeToolInvocation,
toRuntimeToolState,
} from './chatMessageAdapter';

Expand All @@ -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
Expand Down
Loading