Skip to content

Commit 3b8b23c

Browse files
refactor(plugin-chatbot)!: retire eight zero-consumer entry exports (#30576)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuDadpmv8nuw2HbLjjF77YBK)_ Part of #25921. The umbrella stays open; this is the second barrel batch of claim 6660204183 (amendment 6661865751, seat `domain:ui#6`). The first batch was #30541. Clause-②: no (narrowing) Metadata-protocol: none ## 维护者速读 - 改了什么:`@object-ui/plugin-chatbot` 的包入口不再导出 8 个名字:浮动聊天的上下文钩子 `useFloatingChatbot` 及其三个状态/动作/上下文类型、内部消息行的 `ChatMessageProps`、一个工具调用转换函数、两个工具结果展示辅助函数。模块全部保留,行为不变。 - 为什么改:这 8 个名字在仓内(包外)与 hotcrm 均零引用;本卡逐包收窄无人使用的公开导出。 - 风险与回滚:对外是 breaking 收窄,只影响直接从包入口 import 这些名字的外部宿主;控制台与所有 `@object-ui/*` 包不受影响。回滚即 revert 本 PR。 - 先看:`ui/packages/plugin-chatbot/src/index.tsx`(四处导出改写)、`.changeset/25921-plugin-chatbot-zero-consumer-exports.md`(迁移说明)。 - 两分钟验证:`git grep -l -w -e useFloatingChatbot -e unwrapToolResult -e summarizeChatError -e toRuntimeToolInvocation -- ':!ui/packages/plugin-chatbot' ':!**/CHANGELOG.md'` 应只命中本 PR 的 changeset。 - 需要你做的:无,席位落地。 ## What changes - `ui/packages/plugin-chatbot/src/index.tsx`: - the entry stops exporting `useFloatingChatbot` and the types `FloatingChatbotState`, `FloatingChatbotActions`, `FloatingChatbotContextValue` (`FloatingChatbotProvider` and `FloatingChatbotProviderProps` stay); - `ChatMessageProps`, the props of the internal `ChatMessageItem` row, becomes a local interface; - `toRuntimeToolInvocation` leaves the adapter export list (`toRuntimeMessages`, `authoredToRuntimeMessage`, `toRuntimeRole`, `toRuntimeTimestamp`, `toRuntimeToolState` stay; the README teaches the last three and `toRuntimeMessages`); - `unwrapToolResult` and `summarizeChatError` leave the display-helper export (`humanizeToolName` stays). - One new changeset, `.changeset/25921-plugin-chatbot-zero-consumer-exports.md`: patch level, `!` title, BREAKING paragraph, FROM/TO lines for every retired name, ADR-0087 marker `not-required (runtime-export-retired …)` naming all eight operands. - No module file is deleted and no test moves: no test imported a retired name from the entry. `FloatingChatbotTrigger` and `FloatingChatbotPanel` read the hook from its module, `toRuntimeMessages` calls `toRuntimeToolInvocation`, and `ChatbotEnhanced` calls the two display helpers. ## Tests Census on `origin/main` 75bbebb, re-read at this head on top of 48b3ae6 (same counts), with batch 1's method: the entry's 102 export names from the TypeScript checker; per name `git grep -o -w -F` outside `ui/packages/plugin-chatbot`, minus `**/CHANGELOG.md`, lockfiles and `.changeset/**`; the package README; keep rule 3 (a kept export's declared type reaches it, by a checker walk); hotcrm `6961ab1`. 44 names had zero outside hits: 2 are README-taught, 29 are reached by a kept export's declared type, 8 are retired here, and 5 are kept for a reason: | Name | Outside hits | hotcrm | Verdict | |:--|--:|--:|:--| | `useFloatingChatbot`, `FloatingChatbotState`, `FloatingChatbotActions`, `FloatingChatbotContextValue` | 0 each | 0 | retired | | `ChatMessageProps` | 0 | 0 | retired (now a local interface) | | `toRuntimeToolInvocation` | 0 | 0 | retired | | `unwrapToolResult`, `summarizeChatError` | 0 each | 0 | retired | | `TypingIndicator` | 0 | | kept: `TypingIndicatorProps` is named in a `plugin-dashboard` comment (prose counts), and the component and its props go together | | `emitAiUsageRefresh`, `AGENT_ALIAS_GROUPS` | 0 each | | kept: also published on the `./core` subpath entry, outside this claim's surface | | `authoredToRuntimeMessage`, `toRuntimeTimestamp` | 0 each | | kept: README-taught | | controls | `ChatbotEnhanced` 51, `humanizeToolName` 10, `FloatingChatbot` 8, `toRuntimeMessages` 3, `FloatingChatbotProvider` 1; hotcrm `ListView` 7 | | | Readings on the batch commit 94dc257f (cut from 75bbebb), before the move onto this branch: - `turbo run type-check` for `@object-ui/plugin-chatbot`, `@object-ui/app-shell`, `@object-ui/console` with their `^build` closure: 76 of 76 tasks; `vitest run packages/plugin-chatbot/`: Test Files 95 passed (95), Tests 880 passed (880); one lock VERDICT command-exit 0. - `vitest run scripts/` (ui): Test Files 170 passed, 2 skipped (172); Tests 4985 passed, 2 skipped (4987); VERDICT command-exit 0. - Reverse check on the rebuilt `.d.ts`: a temporary app-shell probe importing the eight retired names plus `FloatingChatbotProvider`, `FloatingChatbotProviderProps`, `toRuntimeMessages`, `humanizeToolName` and `TypingIndicator` gave exactly eight errors (`TS2305` / `TS2724 … has no exported member`), one per retired name; the controls resolved. Probe deleted; `git status` clean. - `check:readme-exports`: `0 fabricated, 0 stale omission(s)`; exit 1 only on the known `packages/cli` unbuilt prerequisite. `check-platform-checklist --changed-from origin/main`: exit 0, 0 anchored files. - Dogfood battery (closure plus `pnpm --filter @objectstack/dogfood test` under the lock): Test Files 420 passed, 3 skipped (423); Tests 3496 passed, 36 skipped (3532); VERDICT command-exit 0. - No ablation: export lines removed, no tested behaviour changed. The re-run on this branch's head 59fd4bf (the cherry-pick onto 48b3ae6) is recorded in the os-dev-report on #25921. ## Acceptance notes - `emitAiUsageRefresh` and `AGENT_ALIAS_GROUPS` have zero outside hits on both entries; retiring them means editing `src/core.ts` (the `./core` subpath), which a later batch can take. - Branch name is the platform-assigned `claude/project-thread-h719zv` (batch 1's branch, restarted from `main` after #30541 merged), not `claude/issue-25921-*`. - A contract-review-tier review is owed before the queue (narrowing batch); the seat runs it. ## Verification Derived gates and the head re-run are in the os-dev-report on #25921; CI check-runs on this PR are the record for every family CI runs. --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgTj6bWX8Rq5fpUGNv7)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 062236c commit 3b8b23c

2 files changed

Lines changed: 30 additions & 18 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
'@object-ui/plugin-chatbot': patch
3+
---
4+
5+
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)
6+
7+
Clause-②: no (narrowing)
8+
Metadata-protocol: none
9+
10+
<!-- 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 -->
11+
12+
**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.
13+
14+
What leaves, and what to write instead:
15+
16+
- 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.
17+
- FROM `ChatMessageProps` TO `ChatbotProps`: `Chatbot` renders the message rows itself.
18+
- FROM `toRuntimeToolInvocation` TO `toRuntimeMessages` or `authoredToRuntimeMessage`, which convert every tool invocation of a message.
19+
- FROM `unwrapToolResult`, `summarizeChatError` TO no replacement: `ChatbotEnhanced` applies both itself; keep a local copy if your own chat surface needs them.

‎ui/packages/plugin-chatbot/src/index.tsx‎

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ const Chatbot = React.forwardRef<HTMLDivElement, ChatbotProps>(
141141
)
142142
Chatbot.displayName = "Chatbot"
143143

144-
// Individual message component
145-
export interface ChatMessageProps {
144+
// Individual message component (its props are local: nothing outside the package named them)
145+
interface ChatMessageProps {
146146
message: ChatbotEnhancedMessage
147147
showTimestamp?: boolean
148148
userAvatarUrl?: string
@@ -284,13 +284,11 @@ export {
284284
// Export floating chatbot components
285285
export { FloatingChatbot } from './FloatingChatbot';
286286
export type { FloatingChatbotProps } from './FloatingChatbot';
287-
export { FloatingChatbotProvider, useFloatingChatbot } from './FloatingChatbotProvider';
288-
export type {
289-
FloatingChatbotProviderProps,
290-
FloatingChatbotState,
291-
FloatingChatbotActions,
292-
FloatingChatbotContextValue,
293-
} from './FloatingChatbotProvider';
287+
// `useFloatingChatbot` and its three state/action/context types left the entry
288+
// with zero importers outside the package; the trigger and panel read it from
289+
// the module.
290+
export { FloatingChatbotProvider } from './FloatingChatbotProvider';
291+
export type { FloatingChatbotProviderProps } from './FloatingChatbotProvider';
294292
export { FloatingChatbotTrigger } from './FloatingChatbotTrigger';
295293
export type { FloatingChatbotTriggerProps } from './FloatingChatbotTrigger';
296294
export { FloatingChatbotPanel } from './FloatingChatbotPanel';
@@ -385,7 +383,6 @@ export {
385383
toRuntimeMessages,
386384
toRuntimeRole,
387385
toRuntimeTimestamp,
388-
toRuntimeToolInvocation,
389386
toRuntimeToolState,
390387
} from './chatMessageAdapter';
391388

@@ -399,14 +396,10 @@ export {
399396
*/
400397
export type { SeamChatMessage, SeamToolInvocation } from './chatMessageAdapter';
401398

402-
// Display helpers used internally by ChatbotEnhanced. Exported so app
403-
// authors composing their own chat surface get the same pretty tool-call
404-
// rendering and friendly error summaries for free.
405-
export {
406-
humanizeToolName,
407-
unwrapToolResult,
408-
summarizeChatError,
409-
} from './tool-display';
399+
// Display helper used internally by ChatbotEnhanced, exported for app authors
400+
// composing their own chat surface. `unwrapToolResult` and `summarizeChatError`
401+
// left the entry with zero importers outside the package.
402+
export { humanizeToolName } from './tool-display';
410403

411404
// HITL (Human-In-The-Loop) pending-actions inbox. Talks to
412405
// `@objectstack/service-ai` at `/api/v1/ai/pending-actions/*`. Shared

0 commit comments

Comments
 (0)