web/packages/shared-business/PLUGIN.md
apps/<plugin-name>/
├── package.json
├── vite.config.ts
├── index.html
├── src/
│ ├── main.tsx # 入口,挂载 React
│ ├── App.tsx # useAuthGuard + LoginForm/ChatView 切换
│ ├── config.ts # 插件配置(PluginConfig)
│ ├── adapters/
│ │ ├── index.ts # 导出所有适配器
│ │ ├── conversation.ts # IConversationApi 实现
│ │ ├── agent.ts # IAgentApi 实现
│ │ └── upload.ts # IUploadApi 实现
│ └── ChatView.tsx # 组合 BubbleList、Sender,注入 adapters
import { ChatProvider, LoginForm, useAuthGuard } from '@km/shared-business'
import { config } from './config'
import { adapters } from './adapters'
function App() {
const { isLoggedIn, isLoading } = useAuthGuard()
if (isLoading) return <div>Loading...</div>
if (!isLoggedIn) return <LoginForm />
return (
<ChatProvider config={config} adapters={adapters}>
<ChatView />
</ChatProvider>
)
}