From 885db2fd8cedcaaa4d86c010fbef6fe54bf0e6a3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 06:02:48 +0000 Subject: [PATCH 1/2] Initial plan From ff437078f8d395f87df380e4cc3dadd42c042e6a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 31 Mar 2026 06:30:57 +0000 Subject: [PATCH 2/2] fix: resolve all CI build errors (types, console, fields SSR) - Fix TS2430: Rename ChatbotSchema.body to requestBody to avoid conflict with BaseSchema.body - Fix TS2322: Add type assertion for DesignerFieldType in ObjectManagerPage.tsx - Fix SSR: Add react/jsx-runtime to fields package vite externals for Next.js compatibility - Update CHANGELOG.md Agent-Logs-Url: https://github.com/objectstack-ai/objectui/sessions/f91e232a-9e03-48ed-9599-fcc920e1e008 Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com> --- CHANGELOG.md | 8 +++++++- apps/console/src/pages/system/ObjectManagerPage.tsx | 4 ++-- packages/fields/vite.config.ts | 2 ++ packages/plugin-chatbot/src/renderer.tsx | 6 +++--- packages/types/src/complex.ts | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e903f7ad..0fc610ebc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **AI SDUI Chatbot integration** (`@object-ui/plugin-chatbot`): Refactored chatbot plugin to support full AI streaming via `service-ai` backend and `vercel/ai` SDK (`@ai-sdk/react`). New `useObjectChat` composable hook wraps `@ai-sdk/react`'s `useChat` for SSE streaming, tool-calling, and production-grade chat. Auto-detects API mode (when `api` schema field is set) vs legacy local auto-response mode. ChatbotEnhanced component now supports stop, reload, error display, and streaming state indicators. 44 unit tests (19 new hook tests, 10 new streaming tests). -- **New ChatbotSchema fields** (`@object-ui/types`): Extended `ChatbotSchema` with `api`, `conversationId`, `systemPrompt`, `model`, `streamingEnabled`, `headers`, `body`, `maxToolRoundtrips`, and `onError` fields for service-ai integration. Extended `ChatMessage` with `streaming`, `toolInvocations` fields and added `ChatToolInvocation` interface for tool-calling flows. +- **New ChatbotSchema fields** (`@object-ui/types`): Extended `ChatbotSchema` with `api`, `conversationId`, `systemPrompt`, `model`, `streamingEnabled`, `headers`, `requestBody`, `maxToolRoundtrips`, and `onError` fields for service-ai integration. Extended `ChatMessage` with `streaming`, `toolInvocations` fields and added `ChatToolInvocation` interface for tool-calling flows. - **New Storybook stories for AI chatbot** (`@object-ui/components`): Added `AIStreamingMode`, `AIWithSystemPrompt`, and `AIWithToolCalls` stories demonstrating the new AI SDUI chat modes alongside existing local/demo stories. @@ -33,6 +33,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- **TypeScript build error in ObjectManagerPage** (`apps/console`): Fixed `TS2322: Type 'string' is not assignable to type 'DesignerFieldType'` by adding proper type assertion and missing import for `DesignerFieldType`. + +- **ChatbotSchema `body` property conflict with BaseSchema** (`@object-ui/types`): Renamed `ChatbotSchema.body` to `requestBody` to resolve `TS2430: Interface 'ChatbotSchema' incorrectly extends interface 'BaseSchema'` — the chatbot's HTTP request body parameter conflicted with `BaseSchema.body` (child schema nodes). Updated all references in `@object-ui/plugin-chatbot` renderer accordingly. + +- **Fields package SSR compatibility for Next.js docs site** (`@object-ui/fields`): Added `react/jsx-runtime` to the Vite build externals configuration to prevent it from being bundled. This fixes the `Error: dynamic usage of require is not supported` failure during Next.js static page prerendering of the `/docs/components/overlay/tooltip` page. + - **Dashboard widgets now surface API errors instead of showing hardcoded data** (`@object-ui/plugin-dashboard`, `@object-ui/plugin-charts`): - **ObjectChart**: Added error state tracking. When `dataSource.aggregate()` or `dataSource.find()` fails, the chart now shows a prominent error message with a red alert icon instead of silently swallowing errors and rendering an empty chart. - **MetricWidget / MetricCard**: Added `loading` and `error` props. When provided, the widget shows a loading spinner or a destructive-colored error message instead of the metric value, making API failures immediately visible. diff --git a/apps/console/src/pages/system/ObjectManagerPage.tsx b/apps/console/src/pages/system/ObjectManagerPage.tsx index 9b44bb3e3..b5c77da88 100644 --- a/apps/console/src/pages/system/ObjectManagerPage.tsx +++ b/apps/console/src/pages/system/ObjectManagerPage.tsx @@ -15,7 +15,7 @@ import { useNavigate, useParams } from 'react-router-dom'; import { Button, Badge } from '@object-ui/components'; import { ArrowLeft, Database, Settings2, Link2 } from 'lucide-react'; import { ObjectManager, FieldDesigner } from '@object-ui/plugin-designer'; -import type { ObjectDefinition, DesignerFieldDefinition } from '@object-ui/types'; +import type { ObjectDefinition, DesignerFieldDefinition, DesignerFieldType } from '@object-ui/types'; import { toast } from 'sonner'; import { useMetadata } from '../../context/MetadataProvider'; @@ -103,7 +103,7 @@ function toFieldDefinition(field: MetadataField, index: number): DesignerFieldDe id: field.name || `fld_${index}`, name: field.name || '', label: typeof field.label === 'object' ? field.label.defaultValue || field.label.key || '' : (field.label || field.name || ''), - type: field.type || 'text', + type: (field.type || 'text') as DesignerFieldType, group: field.group || undefined, sortOrder: index, description: field.description || field.help || undefined, diff --git a/packages/fields/vite.config.ts b/packages/fields/vite.config.ts index 52beae749..79b612b83 100644 --- a/packages/fields/vite.config.ts +++ b/packages/fields/vite.config.ts @@ -33,6 +33,7 @@ export default defineConfig({ external: [ 'react', 'react-dom', + 'react/jsx-runtime', '@object-ui/components', '@object-ui/core', '@object-ui/react', @@ -43,6 +44,7 @@ export default defineConfig({ globals: { react: 'React', 'react-dom': 'ReactDOM', + 'react/jsx-runtime': 'jsxRuntime', '@object-ui/components': 'ObjectUIComponents', }, }, diff --git a/packages/plugin-chatbot/src/renderer.tsx b/packages/plugin-chatbot/src/renderer.tsx index cf68491fd..3f3ae325e 100644 --- a/packages/plugin-chatbot/src/renderer.tsx +++ b/packages/plugin-chatbot/src/renderer.tsx @@ -22,7 +22,7 @@ import { useObjectChat } from './useObjectChat'; * - Uses @ai-sdk/react for SSE streaming, tool-calling, and production-grade chat * - Connects to service-ai backend (e.g., /api/v1/ai/chat) * - Supports streaming, stop, reload, clear actions - * - Schema fields: api, conversationId, systemPrompt, model, streamingEnabled, headers, body, maxToolRoundtrips + * - Schema fields: api, conversationId, systemPrompt, model, streamingEnabled, headers, requestBody, maxToolRoundtrips * * **Legacy Mode** (when `api` is not set): * - Local auto-response for demo/playground use @@ -57,7 +57,7 @@ ComponentRegistry.register('chatbot', model: schema.model, streamingEnabled: schema.streamingEnabled, headers: schema.headers, - body: schema.body, + body: schema.requestBody, maxToolRoundtrips: schema.maxToolRoundtrips, onError: schema.onError, showTimestamp: schema.showTimestamp, @@ -260,7 +260,7 @@ ComponentRegistry.register('chatbot-enhanced', model: schema.model, streamingEnabled: schema.streamingEnabled, headers: schema.headers, - body: schema.body, + body: schema.requestBody, maxToolRoundtrips: schema.maxToolRoundtrips, onError: schema.onError, showTimestamp: schema.showTimestamp, diff --git a/packages/types/src/complex.ts b/packages/types/src/complex.ts index df540e7be..a8761e313 100644 --- a/packages/types/src/complex.ts +++ b/packages/types/src/complex.ts @@ -528,7 +528,7 @@ export interface ChatbotSchema extends BaseSchema { /** * Additional body parameters to include with each API request. */ - body?: Record; + requestBody?: Record; /** * Maximum number of tool-calling round-trips per user message. * @default 5