@object-ui/plugin-chatbot 4.0.1 → 4.0.4
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/CHANGELOG.md +37 -0
- package/README.md +51 -1
- package/dist/index.js +460 -33614
- package/dist/index.umd.cjs +1 -115
- package/dist/packages/plugin-chatbot/src/FloatingChatbot.d.ts +11 -1
- package/dist/packages/plugin-chatbot/src/FloatingChatbot.d.ts.map +1 -1
- package/dist/packages/plugin-chatbot/src/FloatingChatbotPanel.d.ts +3 -1
- package/dist/packages/plugin-chatbot/src/FloatingChatbotPanel.d.ts.map +1 -1
- package/dist/packages/plugin-chatbot/src/index.d.ts +2 -0
- package/dist/packages/plugin-chatbot/src/index.d.ts.map +1 -1
- package/dist/packages/plugin-chatbot/src/useAgents.d.ts +50 -0
- package/dist/packages/plugin-chatbot/src/useAgents.d.ts.map +1 -0
- package/dist/packages/plugin-chatbot/src/useObjectChat.d.ts.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @object-ui/plugin-chatbot
|
|
2
2
|
|
|
3
|
+
## 4.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d2b6ece: fix: externalize all bare imports in library builds
|
|
8
|
+
|
|
9
|
+
Library builds (vite lib mode) now externalize every non-relative import instead of bundling third-party CJS dependencies into the published dist. This avoids inlined `require("react")` / `require("react-dom")` calls that cause `Calling \`require\` for "react" in an environment that doesn't expose the \`require\` function` runtime errors when consumer apps re-bundle the published dist.
|
|
10
|
+
|
|
11
|
+
Specifically fixes:
|
|
12
|
+
- `@object-ui/plugin-dashboard` no longer inlines `react-grid-layout` (and its transitive `react-draggable` / `react-resizable` CJS bundles). `react-grid-layout` is now declared as a peer dependency so consumers install a single ESM-friendly copy.
|
|
13
|
+
- `@object-ui/components`, `@object-ui/plugin-calendar`, `@object-ui/plugin-charts`, `@object-ui/plugin-designer` no longer inline `react-i18next` / `i18next` / `use-sync-external-store` CJS shims.
|
|
14
|
+
- All plugin packages now use a unified `external: (id) => !/^[./]/.test(id) && !id.startsWith(__dirname)` rule, ensuring future additions of CJS deps are automatically externalized.
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [d2b6ece]
|
|
17
|
+
- @object-ui/components@4.0.4
|
|
18
|
+
- @object-ui/types@4.0.4
|
|
19
|
+
- @object-ui/core@4.0.4
|
|
20
|
+
- @object-ui/react@4.0.4
|
|
21
|
+
|
|
22
|
+
## 4.0.3
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- 4be43e2: **Page-mode record forms (`editMode: 'page'`).** New per-object metadata flag that opts a record's create/edit form into a dedicated full-screen route (`/apps/:appName/:objectName/new`, `/apps/:appName/:objectName/record/:recordId/edit`). Two new declarative actions `navigate_create` and `navigate_edit` open these routes from JSON action buttons. Default modal behavior is preserved for objects that do not set `editMode`.
|
|
27
|
+
|
|
28
|
+
**`@object-ui/plugin-list` & `@object-ui/plugin-detail`: `ComponentRegistry` singleton fix.** Both plugins' Vite configs now mark all `@object-ui/*` packages as external so each plugin no longer bundles its own private copy of `@object-ui/core`. Cross-plugin component lookups now resolve correctly from the same singleton registry. `plugin-list` dist shrank from multi-MB to 67 kB (gzip 16 kB); `plugin-detail` to 124 kB (gzip 28 kB).
|
|
29
|
+
|
|
30
|
+
**`@object-ui/app-shell` `CreateViewDialog` churn fix.** `existingSet` is now memoised on the joined string key of `existingLabels` rather than the raw array reference, preventing the name-suggest `useEffect` from re-firing on every parent render.
|
|
31
|
+
|
|
32
|
+
**CI fixes.** `ReportViewer` conditional-formatting test now accepts both `rgb(...)` and hex color representations. `ObjectView` i18n mocks rewritten to mirror the real hook shapes (`useObjectTranslation`, `useObjectLabel`).
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [4be43e2]
|
|
35
|
+
- @object-ui/types@4.0.3
|
|
36
|
+
- @object-ui/core@4.0.3
|
|
37
|
+
- @object-ui/react@4.0.3
|
|
38
|
+
- @object-ui/components@4.0.3
|
|
39
|
+
|
|
3
40
|
## 4.0.1
|
|
4
41
|
|
|
5
42
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -46,7 +46,8 @@ function App() {
|
|
|
46
46
|
### AI Streaming Mode (service-ai)
|
|
47
47
|
|
|
48
48
|
When `api` is set in the schema, the chatbot connects to a backend SSE endpoint
|
|
49
|
-
using `@ai-sdk/react`
|
|
49
|
+
using `@ai-sdk/react` v3 (Vercel UI Message Stream protocol) for streaming,
|
|
50
|
+
tool-calling, and production-grade chat:
|
|
50
51
|
|
|
51
52
|
```tsx
|
|
52
53
|
import '@object-ui/plugin-chatbot';
|
|
@@ -102,6 +103,55 @@ function MyChat() {
|
|
|
102
103
|
|
|
103
104
|
## Schema-Driven Usage
|
|
104
105
|
|
|
106
|
+
### Discovering Backend Agents
|
|
107
|
+
|
|
108
|
+
Use `useAgents` to fetch the list of agents exposed by `@objectstack/service-ai`
|
|
109
|
+
at `GET {apiBase}/agents`. This is what the global console FAB uses to populate
|
|
110
|
+
its in-header agent picker:
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import { useAgents } from '@object-ui/plugin-chatbot';
|
|
114
|
+
|
|
115
|
+
function AgentPicker() {
|
|
116
|
+
const { agents, isLoading, error } = useAgents({
|
|
117
|
+
apiBase: 'http://localhost:3000/api/v1/ai',
|
|
118
|
+
// Optional fallback list shown when the backend is unreachable
|
|
119
|
+
fallback: [{ name: 'data_chat', label: 'Data Chat' }],
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
if (isLoading) return <span>Loading agents…</span>;
|
|
123
|
+
if (error) return <span>Backend unreachable</span>;
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<select>
|
|
127
|
+
{agents.map(a => (
|
|
128
|
+
<option key={a.name} value={a.name}>{a.label}</option>
|
|
129
|
+
))}
|
|
130
|
+
</select>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Each agent's chat endpoint is `POST {apiBase}/agents/{name}/chat` — pass that
|
|
136
|
+
URL as the `api` option to `useObjectChat` to talk to it.
|
|
137
|
+
|
|
138
|
+
### Console Integration
|
|
139
|
+
|
|
140
|
+
The console (`@object-ui/app-shell`) auto-mounts a global floating chatbot
|
|
141
|
+
when `useDiscovery().isAiEnabled` is true. Configure the backend in your
|
|
142
|
+
console `.env`:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# AI service endpoint (defaults to ${VITE_SERVER_URL}/api/v1/ai when unset)
|
|
146
|
+
VITE_AI_BASE_URL=http://localhost:3000/api/v1/ai
|
|
147
|
+
# Default agent to select on first open (must match an agent name returned
|
|
148
|
+
# by GET ${VITE_AI_BASE_URL}/agents)
|
|
149
|
+
VITE_AI_DEFAULT_AGENT=sales_copilot
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The picker lets the user switch agents at runtime; switching transparently
|
|
153
|
+
remounts the chat hook against the new agent's `/chat` endpoint.
|
|
154
|
+
|
|
105
155
|
This plugin automatically registers with ObjectUI's component registry when imported:
|
|
106
156
|
|
|
107
157
|
```tsx
|