@object-ui/app-shell 6.2.3 → 7.1.0
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 +1229 -0
- package/README.md +292 -0
- package/dist/assistant/assistantBus.d.ts +72 -0
- package/dist/assistant/assistantBus.js +133 -0
- package/dist/chrome/CommandPalette.d.ts +1 -1
- package/dist/chrome/CommandPalette.js +26 -22
- package/dist/chrome/ConditionalAuthWrapper.d.ts +1 -1
- package/dist/chrome/ConsoleToaster.d.ts +1 -1
- package/dist/chrome/ConsoleToaster.js +3 -1
- package/dist/chrome/ErrorBoundary.d.ts +1 -1
- package/dist/chrome/KeyboardShortcutsDialog.d.ts +1 -1
- package/dist/chrome/KeyboardShortcutsDialog.js +16 -5
- package/dist/chrome/LoadingScreen.d.ts +1 -1
- package/dist/chrome/LoadingScreen.js +22 -26
- package/dist/chrome/RouteFader.d.ts +1 -1
- package/dist/chrome/ThemeProvider.d.ts +1 -1
- package/dist/components/ManagedByBadge.d.ts +1 -1
- package/dist/console/AppContent.d.ts +1 -1
- package/dist/console/AppContent.js +184 -39
- package/dist/console/ConsoleShell.d.ts +7 -7
- package/dist/console/ConsoleShell.js +32 -3
- package/dist/console/ai/AiChatPage.d.ts +88 -1
- package/dist/console/ai/AiChatPage.js +747 -66
- package/dist/console/ai/ConversationsSidebar.d.ts +26 -1
- package/dist/console/ai/ConversationsSidebar.js +149 -34
- package/dist/console/ai/LiveCanvas.d.ts +28 -0
- package/dist/console/ai/LiveCanvas.js +80 -0
- package/dist/console/ai/reconcileTurn.d.ts +8 -0
- package/dist/console/ai/reconcileTurn.js +20 -0
- package/dist/console/auth/AuthPageLayout.d.ts +1 -1
- package/dist/console/auth/ForgotPasswordPage.d.ts +1 -1
- package/dist/console/auth/LoginPage.d.ts +1 -1
- package/dist/console/auth/RegisterPage.d.ts +1 -1
- package/dist/console/auth/RegisterPage.js +23 -3
- package/dist/console/cloud-connection/CloudConnectionPanel.d.ts +1 -0
- package/dist/console/cloud-connection/CloudConnectionPanel.js +169 -0
- package/dist/console/home/AppCard.d.ts +1 -1
- package/dist/console/home/AppCard.js +6 -12
- package/dist/console/home/HomeAppsStrip.d.ts +8 -0
- package/dist/console/home/HomeAppsStrip.js +61 -0
- package/dist/console/home/HomeLayout.d.ts +1 -1
- package/dist/console/home/HomeLayout.js +3 -1
- package/dist/console/home/HomePage.d.ts +1 -2
- package/dist/console/home/HomePage.js +149 -21
- package/dist/console/home/HomeRail.d.ts +22 -0
- package/dist/console/home/HomeRail.js +62 -0
- package/dist/console/home/QuickActions.d.ts +1 -1
- package/dist/console/home/QuickActions.js +3 -11
- package/dist/console/home/RecentApps.d.ts +1 -1
- package/dist/console/home/RecentApps.js +2 -2
- package/dist/console/home/StarredApps.d.ts +1 -1
- package/dist/console/home/StarredApps.js +2 -2
- package/dist/console/marketplace/InstalledListWidget.d.ts +1 -0
- package/dist/console/marketplace/InstalledListWidget.js +93 -0
- package/dist/console/marketplace/MarkdownText.d.ts +1 -1
- package/dist/console/marketplace/MarketplaceAccessDenied.d.ts +1 -1
- package/dist/console/marketplace/MarketplaceInstalledPage.d.ts +8 -14
- package/dist/console/marketplace/MarketplaceInstalledPage.js +14 -66
- package/dist/console/marketplace/MarketplacePackagePage.d.ts +1 -1
- package/dist/console/marketplace/MarketplacePackagePage.js +249 -8
- package/dist/console/marketplace/MarketplacePage.d.ts +1 -1
- package/dist/console/marketplace/MarketplacePage.js +60 -3
- package/dist/console/marketplace/PackageIcon.d.ts +1 -1
- package/dist/console/marketplace/PluginDisclosure.d.ts +14 -0
- package/dist/console/marketplace/PluginDisclosure.js +38 -0
- package/dist/console/marketplace/marketplaceApi.d.ts +123 -0
- package/dist/console/marketplace/marketplaceApi.js +254 -1
- package/dist/console/organizations/CreateWorkspaceDialog.d.ts +1 -1
- package/dist/console/organizations/OrganizationsLayout.d.ts +1 -1
- package/dist/console/organizations/OrganizationsPage.d.ts +1 -1
- package/dist/console/organizations/manage/AcceptInvitationPage.d.ts +1 -1
- package/dist/console/organizations/manage/InvitationsPage.d.ts +1 -1
- package/dist/console/organizations/manage/InviteMemberDialog.d.ts +1 -1
- package/dist/console/organizations/manage/MembersPage.d.ts +1 -1
- package/dist/console/organizations/manage/OrganizationLayout.d.ts +1 -1
- package/dist/console/organizations/manage/SettingsPage.d.ts +1 -1
- package/dist/context/CommandPaletteProvider.d.ts +44 -0
- package/dist/context/CommandPaletteProvider.js +71 -0
- package/dist/context/FavoritesProvider.d.ts +1 -1
- package/dist/context/NavigationContext.d.ts +1 -1
- package/dist/context/RecentItemsProvider.d.ts +2 -2
- package/dist/context/UserStateAdapters.d.ts +1 -1
- package/dist/context/index.d.ts +2 -0
- package/dist/context/index.js +1 -0
- package/dist/hooks/index.d.ts +5 -2
- package/dist/hooks/index.js +4 -1
- package/dist/hooks/useActionModal.d.ts +53 -0
- package/dist/hooks/useActionModal.js +111 -0
- package/dist/hooks/useChatConversation.d.ts +137 -4
- package/dist/hooks/useChatConversation.js +316 -25
- package/dist/hooks/useConsoleActionRuntime.d.ts +70 -0
- package/dist/hooks/useConsoleActionRuntime.js +564 -0
- package/dist/hooks/useConversationList.js +61 -3
- package/dist/hooks/useHomeInbox.d.ts +13 -0
- package/dist/hooks/useHomeInbox.js +142 -0
- package/dist/hooks/useNavPins.js +17 -23
- package/dist/hooks/useNavigationSync.d.ts +33 -0
- package/dist/hooks/useNavigationSync.js +98 -12
- package/dist/hooks/useReconcileOnError.d.ts +40 -0
- package/dist/hooks/useReconcileOnError.js +37 -0
- package/dist/hooks/useRecordApprovals.d.ts +18 -19
- package/dist/hooks/useRecordApprovals.js +24 -40
- package/dist/hooks/useResponsiveSidebar.js +14 -5
- package/dist/hooks/useSettleSignal.d.ts +19 -0
- package/dist/hooks/useSettleSignal.js +20 -0
- package/dist/hooks/useTrackRouteAsRecent.js +35 -0
- package/dist/hooks/useUrlOverlay.d.ts +62 -0
- package/dist/hooks/useUrlOverlay.js +88 -0
- package/dist/index.d.ts +18 -8
- package/dist/index.js +17 -5
- package/dist/layout/ActivityFeed.d.ts +1 -1
- package/dist/layout/AppHeader.d.ts +3 -2
- package/dist/layout/AppHeader.js +237 -72
- package/dist/layout/AppSidebar.d.ts +2 -1
- package/dist/layout/AppSidebar.js +26 -46
- package/dist/layout/AppSwitcher.d.ts +2 -1
- package/dist/layout/AppSwitcher.js +9 -5
- package/dist/layout/AuthPageLayout.d.ts +1 -1
- package/dist/layout/ConnectionStatus.d.ts +1 -1
- package/dist/layout/ConnectionStatus.js +9 -6
- package/dist/layout/ConsoleChatbotFab.d.ts +19 -1
- package/dist/layout/ConsoleChatbotFab.js +16 -2
- package/dist/layout/ConsoleFloatingChatbot.d.ts +34 -2
- package/dist/layout/ConsoleFloatingChatbot.js +391 -41
- package/dist/layout/ConsoleLayout.d.ts +1 -1
- package/dist/layout/ConsoleLayout.js +27 -11
- package/dist/layout/ContextSelectors.d.ts +44 -0
- package/dist/layout/ContextSelectors.js +242 -0
- package/dist/layout/InboxPopover.d.ts +6 -1
- package/dist/layout/InboxPopover.js +25 -6
- package/dist/layout/LocaleSwitcher.d.ts +1 -1
- package/dist/layout/LocalizedSidebarTrigger.d.ts +2 -0
- package/dist/layout/LocalizedSidebarTrigger.js +15 -0
- package/dist/layout/MobileViewSwitcherContext.d.ts +1 -1
- package/dist/layout/ModeToggle.d.ts +1 -1
- package/dist/layout/PageHeader.d.ts +1 -1
- package/dist/layout/UnifiedSidebar.d.ts +2 -1
- package/dist/layout/UnifiedSidebar.js +116 -15
- package/dist/layout/agentPicker.d.ts +56 -0
- package/dist/layout/agentPicker.js +40 -0
- package/dist/observability/index.d.ts +1 -0
- package/dist/observability/index.js +1 -0
- package/dist/observability/settleSignal.d.ts +64 -0
- package/dist/observability/settleSignal.js +131 -0
- package/dist/preview/CommitTimeline.d.ts +15 -0
- package/dist/preview/CommitTimeline.js +82 -0
- package/dist/preview/DraftChangesPanel.d.ts +19 -0
- package/dist/preview/DraftChangesPanel.js +114 -0
- package/dist/preview/DraftPreviewBar.d.ts +8 -0
- package/dist/preview/DraftPreviewBar.js +86 -0
- package/dist/preview/PreviewDraftEmptyState.d.ts +16 -0
- package/dist/preview/PreviewDraftEmptyState.js +47 -0
- package/dist/preview/PreviewModeContext.d.ts +57 -0
- package/dist/preview/PreviewModeContext.js +99 -0
- package/dist/preview/UnpublishedAppBar.d.ts +8 -0
- package/dist/preview/UnpublishedAppBar.js +83 -0
- package/dist/preview/commitHistory.d.ts +28 -0
- package/dist/preview/commitHistory.js +48 -0
- package/dist/preview/draftStatus.d.ts +20 -0
- package/dist/preview/draftStatus.js +27 -0
- package/dist/preview/usePublishAllDrafts.d.ts +18 -0
- package/dist/preview/usePublishAllDrafts.js +106 -0
- package/dist/providers/AdapterProvider.d.ts +1 -1
- package/dist/providers/AdapterProvider.js +6 -1
- package/dist/providers/ExpressionProvider.d.ts +1 -1
- package/dist/providers/MetadataProvider.d.ts +17 -2
- package/dist/providers/MetadataProvider.js +192 -12
- package/dist/runtime-config.d.ts +46 -2
- package/dist/runtime-config.js +39 -2
- package/dist/services/builtinComponents.js +68 -59
- package/dist/skeletons/SkeletonDashboard.d.ts +1 -1
- package/dist/skeletons/SkeletonDetail.d.ts +1 -1
- package/dist/skeletons/SkeletonGrid.d.ts +1 -1
- package/dist/utils/appRoute.d.ts +21 -0
- package/dist/utils/appRoute.js +25 -0
- package/dist/utils/deriveRelatedLists.d.ts +54 -0
- package/dist/utils/deriveRelatedLists.js +91 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/managedByEmptyState.d.ts +8 -1
- package/dist/utils/managedByEmptyState.js +13 -7
- package/dist/utils/preferLocal.d.ts +18 -0
- package/dist/utils/preferLocal.js +24 -0
- package/dist/views/ActionConfirmDialog.d.ts +1 -1
- package/dist/views/ActionConfirmDialog.js +3 -1
- package/dist/views/ActionParamDialog.d.ts +6 -1
- package/dist/views/ActionParamDialog.js +9 -3
- package/dist/views/ActionResultDialog.d.ts +13 -0
- package/dist/views/ActionResultDialog.js +134 -0
- package/dist/views/ComponentNavView.d.ts +14 -1
- package/dist/views/CreateViewDialog.d.ts +1 -1
- package/dist/views/DashboardConfigPanel.d.ts +28 -0
- package/dist/views/DashboardConfigPanel.js +81 -0
- package/dist/views/DashboardView.d.ts +4 -3
- package/dist/views/DashboardView.js +38 -239
- package/dist/views/FlowRunner.d.ts +31 -0
- package/dist/views/FlowRunner.js +121 -0
- package/dist/views/InterfaceListPage.d.ts +49 -0
- package/dist/views/InterfaceListPage.js +347 -0
- package/dist/views/MetadataInspector.d.ts +2 -2
- package/dist/views/ObjectView.d.ts +1 -1
- package/dist/views/ObjectView.js +209 -532
- package/dist/views/PageView.d.ts +8 -3
- package/dist/views/PageView.js +45 -32
- package/dist/views/RecordDetailView.d.ts +1 -1
- package/dist/views/RecordDetailView.js +363 -148
- package/dist/views/RecordFormPage.d.ts +1 -1
- package/dist/views/RecordFormPage.js +26 -1
- package/dist/views/ReportConfigPanel.d.ts +37 -0
- package/dist/views/ReportConfigPanel.js +85 -0
- package/dist/views/ReportView.d.ts +1 -1
- package/dist/views/ReportView.js +116 -7
- package/dist/views/RuntimeDraftBar.d.ts +30 -0
- package/dist/views/RuntimeDraftBar.js +112 -0
- package/dist/views/ScreenView.d.ts +70 -0
- package/dist/views/ScreenView.js +73 -0
- package/dist/views/SearchResultsPage.d.ts +1 -1
- package/dist/views/SearchResultsPage.js +8 -18
- package/dist/views/ViewConfigPanel.d.ts +24 -17
- package/dist/views/ViewConfigPanel.js +121 -77
- package/dist/views/index.d.ts +1 -1
- package/dist/views/index.js +1 -1
- package/dist/views/metadata-admin/AuditPanel.d.ts +28 -0
- package/dist/views/metadata-admin/AuditPanel.js +79 -0
- package/dist/views/metadata-admin/DiagnosticsPage.d.ts +20 -0
- package/dist/views/metadata-admin/DiagnosticsPage.js +69 -0
- package/dist/views/metadata-admin/DirectoryPage.d.ts +16 -1
- package/dist/views/metadata-admin/DirectoryPage.js +101 -24
- package/dist/views/metadata-admin/DraftReviewPanel.d.ts +33 -0
- package/dist/views/metadata-admin/DraftReviewPanel.js +77 -0
- package/dist/views/metadata-admin/EmbeddedItemEditor.d.ts +17 -1
- package/dist/views/metadata-admin/EmbeddedItemEditor.js +15 -8
- package/dist/views/metadata-admin/JsonSourceEditor.d.ts +39 -0
- package/dist/views/metadata-admin/JsonSourceEditor.js +196 -0
- package/dist/views/metadata-admin/LayeredDiff.d.ts +39 -1
- package/dist/views/metadata-admin/LayeredDiff.js +171 -5
- package/dist/views/metadata-admin/MetadataDetailDrawer.d.ts +15 -1
- package/dist/views/metadata-admin/MetadataTypeActions.d.ts +48 -0
- package/dist/views/metadata-admin/MetadataTypeActions.js +165 -0
- package/dist/views/metadata-admin/PackagesPage.d.ts +18 -0
- package/dist/views/metadata-admin/PackagesPage.js +403 -0
- package/dist/views/metadata-admin/PageShell.d.ts +1 -1
- package/dist/views/metadata-admin/PageShell.js +9 -4
- package/dist/views/metadata-admin/PermissionMatrixEditor.d.ts +35 -1
- package/dist/views/metadata-admin/QuickFind.d.ts +21 -1
- package/dist/views/metadata-admin/QuickFind.js +6 -3
- package/dist/views/metadata-admin/RelatedPanel.d.ts +24 -1
- package/dist/views/metadata-admin/RelatedPanel.js +20 -18
- package/dist/views/metadata-admin/ResourceEditPage.d.ts +40 -1
- package/dist/views/metadata-admin/ResourceEditPage.js +1250 -60
- package/dist/views/metadata-admin/ResourceHistoryPage.d.ts +39 -1
- package/dist/views/metadata-admin/ResourceHistoryPage.js +66 -16
- package/dist/views/metadata-admin/ResourceListPage.d.ts +13 -1
- package/dist/views/metadata-admin/ResourceListPage.js +258 -30
- package/dist/views/metadata-admin/ResourceRouter.d.ts +23 -1
- package/dist/views/metadata-admin/SchemaForm.d.ts +34 -1
- package/dist/views/metadata-admin/SchemaForm.js +559 -49
- package/dist/views/metadata-admin/StudioHomePage.d.ts +22 -0
- package/dist/views/metadata-admin/StudioHomePage.js +205 -0
- package/dist/views/metadata-admin/anchors.js +255 -24
- package/dist/views/metadata-admin/clientValidation.d.ts +50 -0
- package/dist/views/metadata-admin/clientValidation.js +169 -0
- package/dist/views/metadata-admin/color-variant-field.d.ts +30 -0
- package/dist/views/metadata-admin/color-variant-field.js +38 -0
- package/dist/views/metadata-admin/createDerive.d.ts +75 -0
- package/dist/views/metadata-admin/createDerive.js +179 -0
- package/dist/views/metadata-admin/dashboard-schema.d.ts +12 -0
- package/dist/views/metadata-admin/dashboard-schema.js +80 -0
- package/dist/views/metadata-admin/datasource/DatasourceResourcePage.d.ts +35 -0
- package/dist/views/metadata-admin/datasource/DatasourceResourcePage.js +327 -0
- package/dist/views/metadata-admin/datasource/register.d.ts +1 -0
- package/dist/views/metadata-admin/datasource/register.js +24 -0
- package/dist/views/metadata-admin/default-inspector-registry.d.ts +49 -0
- package/dist/views/metadata-admin/default-inspector-registry.js +8 -0
- package/dist/views/metadata-admin/default-schemas.js +115 -10
- package/dist/views/metadata-admin/external/ExternalDatasourcePanel.d.ts +27 -0
- package/dist/views/metadata-admin/external/ExternalDatasourcePanel.js +69 -0
- package/dist/views/metadata-admin/external/ImportObjectDialog.d.ts +27 -0
- package/dist/views/metadata-admin/external/ImportObjectDialog.js +77 -0
- package/dist/views/metadata-admin/external/SchemaBrowser.d.ts +16 -0
- package/dist/views/metadata-admin/external/SchemaBrowser.js +74 -0
- package/dist/views/metadata-admin/external/ValidationPanel.d.ts +16 -0
- package/dist/views/metadata-admin/external/ValidationPanel.js +68 -0
- package/dist/views/metadata-admin/external/api.d.ts +100 -0
- package/dist/views/metadata-admin/external/api.js +124 -0
- package/dist/views/metadata-admin/i18n.d.ts +1 -0
- package/dist/views/metadata-admin/i18n.js +1252 -2
- package/dist/views/metadata-admin/index.d.ts +8 -5
- package/dist/views/metadata-admin/index.js +12 -2
- package/dist/views/metadata-admin/inspector-registry.d.ts +51 -0
- package/dist/views/metadata-admin/inspector-registry.js +11 -0
- package/dist/views/metadata-admin/inspectors/ActionDefaultInspector.d.ts +30 -0
- package/dist/views/metadata-admin/inspectors/ActionDefaultInspector.js +180 -0
- package/dist/views/metadata-admin/inspectors/AppNavInspector.d.ts +16 -0
- package/dist/views/metadata-admin/inspectors/AppNavInspector.js +110 -0
- package/dist/views/metadata-admin/inspectors/ConditionBuilder.d.ts +29 -0
- package/dist/views/metadata-admin/inspectors/ConditionBuilder.js +154 -0
- package/dist/views/metadata-admin/inspectors/DashboardDefaultInspector.d.ts +28 -0
- package/dist/views/metadata-admin/inspectors/DashboardDefaultInspector.js +110 -0
- package/dist/views/metadata-admin/inspectors/DashboardWidgetInspector.d.ts +18 -0
- package/dist/views/metadata-admin/inspectors/DashboardWidgetInspector.js +139 -0
- package/dist/views/metadata-admin/inspectors/DatasetDefaultInspector.d.ts +21 -0
- package/dist/views/metadata-admin/inspectors/DatasetDefaultInspector.js +221 -0
- package/dist/views/metadata-admin/inspectors/FlowEdgeInspector.d.ts +16 -0
- package/dist/views/metadata-admin/inspectors/FlowEdgeInspector.js +126 -0
- package/dist/views/metadata-admin/inspectors/FlowInspector.d.ts +12 -0
- package/dist/views/metadata-admin/inspectors/FlowInspector.js +9 -0
- package/dist/views/metadata-admin/inspectors/FlowKeyValueField.d.ts +30 -0
- package/dist/views/metadata-admin/inspectors/FlowKeyValueField.js +125 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeConfigField.d.ts +18 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeConfigField.js +40 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeInspector.d.ts +14 -0
- package/dist/views/metadata-admin/inspectors/FlowNodeInspector.js +205 -0
- package/dist/views/metadata-admin/inspectors/FlowObjectListField.d.ts +26 -0
- package/dist/views/metadata-admin/inspectors/FlowObjectListField.js +105 -0
- package/dist/views/metadata-admin/inspectors/FlowReferenceField.d.ts +83 -0
- package/dist/views/metadata-admin/inspectors/FlowReferenceField.js +181 -0
- package/dist/views/metadata-admin/inspectors/FlowStringListField.d.ts +21 -0
- package/dist/views/metadata-admin/inspectors/FlowStringListField.js +60 -0
- package/dist/views/metadata-admin/inspectors/InspectorComboField.d.ts +40 -0
- package/dist/views/metadata-admin/inspectors/InspectorComboField.js +61 -0
- package/dist/views/metadata-admin/inspectors/ObjectDefaultInspector.d.ts +21 -0
- package/dist/views/metadata-admin/inspectors/ObjectDefaultInspector.js +55 -0
- package/dist/views/metadata-admin/inspectors/ObjectFieldInspector.d.ts +23 -0
- package/dist/views/metadata-admin/inspectors/ObjectFieldInspector.js +365 -0
- package/dist/views/metadata-admin/inspectors/PageBlockInspector.d.ts +48 -0
- package/dist/views/metadata-admin/inspectors/PageBlockInspector.js +332 -0
- package/dist/views/metadata-admin/inspectors/ReportDefaultInspector.d.ts +58 -0
- package/dist/views/metadata-admin/inspectors/ReportDefaultInspector.js +218 -0
- package/dist/views/metadata-admin/inspectors/ViewColumnInspector.d.ts +19 -0
- package/dist/views/metadata-admin/inspectors/ViewColumnInspector.js +144 -0
- package/dist/views/metadata-admin/inspectors/ViewInspector.d.ts +19 -0
- package/dist/views/metadata-admin/inspectors/ViewInspector.js +21 -0
- package/dist/views/metadata-admin/inspectors/ViewVariantInspector.d.ts +54 -0
- package/dist/views/metadata-admin/inspectors/ViewVariantInspector.js +191 -0
- package/dist/views/metadata-admin/inspectors/_shared.d.ts +128 -0
- package/dist/views/metadata-admin/inspectors/_shared.js +113 -0
- package/dist/views/metadata-admin/inspectors/datasetFilterCondition.d.ts +24 -0
- package/dist/views/metadata-admin/inspectors/datasetFilterCondition.js +97 -0
- package/dist/views/metadata-admin/inspectors/expression-validate.d.ts +26 -0
- package/dist/views/metadata-admin/inspectors/expression-validate.js +66 -0
- package/dist/views/metadata-admin/inspectors/flow-node-config.d.ts +143 -0
- package/dist/views/metadata-admin/inspectors/flow-node-config.js +506 -0
- package/dist/views/metadata-admin/inspectors/index.d.ts +1 -0
- package/dist/views/metadata-admin/inspectors/index.js +45 -0
- package/dist/views/metadata-admin/inspectors/json-schema-to-fields.d.ts +40 -0
- package/dist/views/metadata-admin/inspectors/json-schema-to-fields.js +227 -0
- package/dist/views/metadata-admin/inspectors/useDatasetFields.d.ts +72 -0
- package/dist/views/metadata-admin/inspectors/useDatasetFields.js +0 -0
- package/dist/views/metadata-admin/issuePath.d.ts +22 -0
- package/dist/views/metadata-admin/issuePath.js +65 -0
- package/dist/views/metadata-admin/mergeServerFields.d.ts +65 -0
- package/dist/views/metadata-admin/mergeServerFields.js +56 -0
- package/dist/views/metadata-admin/package-scope.d.ts +26 -0
- package/dist/views/metadata-admin/package-scope.js +43 -0
- package/dist/views/metadata-admin/preview-registry.d.ts +55 -0
- package/dist/views/metadata-admin/previews/ActionPreview.d.ts +25 -0
- package/dist/views/metadata-admin/previews/ActionPreview.js +238 -0
- package/dist/views/metadata-admin/previews/AddWidgetPicker.d.ts +12 -0
- package/dist/views/metadata-admin/previews/AddWidgetPicker.js +56 -0
- package/dist/views/metadata-admin/previews/AgentPreview.d.ts +24 -0
- package/dist/views/metadata-admin/previews/AgentPreview.js +100 -0
- package/dist/views/metadata-admin/previews/AppNavCanvas.d.ts +31 -0
- package/dist/views/metadata-admin/previews/AppNavCanvas.js +260 -0
- package/dist/views/metadata-admin/previews/AppPreview.d.ts +16 -1
- package/dist/views/metadata-admin/previews/AppPreview.js +23 -14
- package/dist/views/metadata-admin/previews/BookPreview.d.ts +20 -0
- package/dist/views/metadata-admin/previews/BookPreview.js +132 -0
- package/dist/views/metadata-admin/previews/DashboardPreview.d.ts +16 -1
- package/dist/views/metadata-admin/previews/DashboardPreview.js +110 -8
- package/dist/views/metadata-admin/previews/DatasetPreview.d.ts +18 -0
- package/dist/views/metadata-admin/previews/DatasetPreview.js +105 -0
- package/dist/views/metadata-admin/previews/DatasourcePreview.d.ts +23 -0
- package/dist/views/metadata-admin/previews/DatasourcePreview.js +68 -0
- package/dist/views/metadata-admin/previews/EmailTemplatePreview.d.ts +14 -1
- package/dist/views/metadata-admin/previews/FieldStub.d.ts +30 -0
- package/dist/views/metadata-admin/previews/FieldStub.js +104 -0
- package/dist/views/metadata-admin/previews/FieldsListEditor.d.ts +50 -0
- package/dist/views/metadata-admin/previews/FieldsListEditor.js +97 -0
- package/dist/views/metadata-admin/previews/FlowCanvas.d.ts +49 -0
- package/dist/views/metadata-admin/previews/FlowCanvas.js +416 -0
- package/dist/views/metadata-admin/previews/FlowPreview.d.ts +20 -0
- package/dist/views/metadata-admin/previews/FlowPreview.js +120 -0
- package/dist/views/metadata-admin/previews/FlowRunsPanel.d.ts +46 -0
- package/dist/views/metadata-admin/previews/FlowRunsPanel.js +97 -0
- package/dist/views/metadata-admin/previews/FlowSimulatorPanel.d.ts +25 -0
- package/dist/views/metadata-admin/previews/FlowSimulatorPanel.js +204 -0
- package/dist/views/metadata-admin/previews/JobPreview.d.ts +28 -0
- package/dist/views/metadata-admin/previews/JobPreview.js +290 -0
- package/dist/views/metadata-admin/previews/ObjectFormCanvas.d.ts +30 -0
- package/dist/views/metadata-admin/previews/ObjectFormCanvas.js +547 -0
- package/dist/views/metadata-admin/previews/ObjectPreview.d.ts +14 -1
- package/dist/views/metadata-admin/previews/ObjectPreview.js +5 -30
- package/dist/views/metadata-admin/previews/OutlineStrip.d.ts +32 -0
- package/dist/views/metadata-admin/previews/OutlineStrip.js +8 -0
- package/dist/views/metadata-admin/previews/PageBlockCanvas.d.ts +49 -0
- package/dist/views/metadata-admin/previews/PageBlockCanvas.js +510 -0
- package/dist/views/metadata-admin/previews/PagePreview.d.ts +10 -1
- package/dist/views/metadata-admin/previews/PagePreview.js +200 -5
- package/dist/views/metadata-admin/previews/PermissionPreview.d.ts +27 -0
- package/dist/views/metadata-admin/previews/PermissionPreview.js +115 -0
- package/dist/views/metadata-admin/previews/PreviewShell.d.ts +29 -6
- package/dist/views/metadata-admin/previews/PreviewShell.js +16 -3
- package/dist/views/metadata-admin/previews/ReportPreview.d.ts +18 -1
- package/dist/views/metadata-admin/previews/ReportPreview.js +23 -15
- package/dist/views/metadata-admin/previews/RolePreview.d.ts +19 -0
- package/dist/views/metadata-admin/previews/RolePreview.js +14 -0
- package/dist/views/metadata-admin/previews/ScreenPreview.d.ts +38 -0
- package/dist/views/metadata-admin/previews/ScreenPreview.js +61 -0
- package/dist/views/metadata-admin/previews/SkillPreview.d.ts +22 -0
- package/dist/views/metadata-admin/previews/SkillPreview.js +34 -0
- package/dist/views/metadata-admin/previews/ToolPreview.d.ts +25 -0
- package/dist/views/metadata-admin/previews/ToolPreview.js +122 -0
- package/dist/views/metadata-admin/previews/TranslationPreview.d.ts +25 -0
- package/dist/views/metadata-admin/previews/TranslationPreview.js +52 -0
- package/dist/views/metadata-admin/previews/ValidationPreview.d.ts +27 -0
- package/dist/views/metadata-admin/previews/ValidationPreview.js +110 -0
- package/dist/views/metadata-admin/previews/ViewColumnPanes.d.ts +62 -0
- package/dist/views/metadata-admin/previews/ViewColumnPanes.js +140 -0
- package/dist/views/metadata-admin/previews/ViewPreview.d.ts +23 -1
- package/dist/views/metadata-admin/previews/ViewPreview.js +101 -73
- package/dist/views/metadata-admin/previews/block-config.d.ts +82 -0
- package/dist/views/metadata-admin/previews/block-config.js +324 -0
- package/dist/views/metadata-admin/previews/block-types.d.ts +40 -0
- package/dist/views/metadata-admin/previews/block-types.js +110 -0
- package/dist/views/metadata-admin/previews/field-types.d.ts +53 -0
- package/dist/views/metadata-admin/previews/field-types.js +97 -0
- package/dist/views/metadata-admin/previews/flow-canvas-layout.d.ts +102 -0
- package/dist/views/metadata-admin/previews/flow-canvas-layout.js +227 -0
- package/dist/views/metadata-admin/previews/flow-canvas-parts.d.ts +96 -0
- package/dist/views/metadata-admin/previews/flow-canvas-parts.js +373 -0
- package/dist/views/metadata-admin/previews/form-preview.d.ts +24 -0
- package/dist/views/metadata-admin/previews/form-preview.js +29 -0
- package/dist/views/metadata-admin/previews/index.js +43 -0
- package/dist/views/metadata-admin/previews/object-fields-bridge.d.ts +66 -0
- package/dist/views/metadata-admin/previews/object-fields-bridge.js +171 -0
- package/dist/views/metadata-admin/previews/object-fields-io.d.ts +130 -0
- package/dist/views/metadata-admin/previews/object-fields-io.js +243 -0
- package/dist/views/metadata-admin/previews/screen-spec.d.ts +43 -0
- package/dist/views/metadata-admin/previews/screen-spec.js +108 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-types.d.ts +102 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-types.js +2 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-validate.d.ts +15 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-validate.js +185 -0
- package/dist/views/metadata-admin/previews/simulator/flow-simulator.d.ts +73 -0
- package/dist/views/metadata-admin/previews/simulator/flow-simulator.js +426 -0
- package/dist/views/metadata-admin/previews/useDatasetCatalog.d.ts +47 -0
- package/dist/views/metadata-admin/previews/useDatasetCatalog.js +133 -0
- package/dist/views/metadata-admin/previews/useFlowNodePalette.d.ts +44 -0
- package/dist/views/metadata-admin/previews/useFlowNodePalette.js +124 -0
- package/dist/views/metadata-admin/previews/useMetaOptions.d.ts +8 -0
- package/dist/views/metadata-admin/previews/useMetaOptions.js +50 -0
- package/dist/views/metadata-admin/previews/useObjectFields.d.ts +23 -0
- package/dist/views/metadata-admin/previews/useObjectFields.js +79 -0
- package/dist/views/metadata-admin/previews/useObjectOptions.d.ts +8 -0
- package/dist/views/metadata-admin/previews/useObjectOptions.js +43 -0
- package/dist/views/metadata-admin/previews/view-column-io.d.ts +42 -0
- package/dist/views/metadata-admin/previews/view-column-io.js +73 -0
- package/dist/views/metadata-admin/previews/widget-types.d.ts +24 -0
- package/dist/views/metadata-admin/previews/widget-types.js +40 -0
- package/dist/views/metadata-admin/registry.d.ts +140 -19
- package/dist/views/metadata-admin/report-schema.d.ts +26 -0
- package/dist/views/metadata-admin/report-schema.js +121 -0
- package/dist/views/metadata-admin/useMetadata.d.ts +100 -2
- package/dist/views/metadata-admin/useMetadata.js +155 -4
- package/dist/views/metadata-admin/view-item-normalize.d.ts +20 -0
- package/dist/views/metadata-admin/view-item-normalize.js +68 -0
- package/dist/views/metadata-admin/view-schema.d.ts +16 -0
- package/dist/views/metadata-admin/view-schema.js +107 -0
- package/dist/views/metadata-admin/view-variant-model.d.ts +23 -0
- package/dist/views/metadata-admin/view-variant-model.js +64 -0
- package/dist/views/metadata-admin/widgets.d.ts +89 -1
- package/dist/views/metadata-admin/widgets.js +491 -17
- package/dist/views/runtime-metadata-persistence.d.ts +78 -0
- package/dist/views/runtime-metadata-persistence.js +89 -0
- package/dist/views/useOpenRecordList.d.ts +18 -0
- package/dist/views/useOpenRecordList.js +36 -0
- package/dist/views/userFilterUrlState.d.ts +15 -0
- package/dist/views/userFilterUrlState.js +53 -0
- package/dist/views/view-config-adapter.d.ts +38 -0
- package/dist/views/view-config-adapter.js +80 -0
- package/package.json +52 -34
- package/dist/views/DesignDrawer.d.ts +0 -28
- package/dist/views/DesignDrawer.js +0 -51
- package/dist/views/metadata-admin/DesignerEditorWrapper.d.ts +0 -68
- package/dist/views/metadata-admin/DesignerEditorWrapper.js +0 -158
|
@@ -12,10 +12,167 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
14
|
import React from 'react';
|
|
15
|
-
import {
|
|
15
|
+
import { useReconcileOnError } from '../hooks/useReconcileOnError';
|
|
16
|
+
import { FloatingChatbot, useObjectChat, useAgents, useHitlInChat, resolveDefaultAgentName, uiMessagesToChatMessages, publishHealthFromResponse, agentRouteName, } from '@object-ui/plugin-chatbot';
|
|
16
17
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, Button, ShareDialog, } from '@object-ui/components';
|
|
17
|
-
import { Share2 } from 'lucide-react';
|
|
18
|
-
import {
|
|
18
|
+
import { Share2, SquarePen } from 'lucide-react';
|
|
19
|
+
import { useObjectTranslation } from '@object-ui/i18n';
|
|
20
|
+
import { toast } from 'sonner';
|
|
21
|
+
import { useNavigate, useLocation } from 'react-router-dom';
|
|
22
|
+
import { sanitizeChatMessagesForCache, useChatConversation, writeConversationMessagesCache, } from '../hooks';
|
|
23
|
+
import { useAssistant, requestAssistantReview, emitCanvasInvalidate } from '../assistant/assistantBus';
|
|
24
|
+
import { fetchPendingDraftCount } from '../preview/draftStatus';
|
|
25
|
+
import { getRuntimeConfig } from '../runtime-config';
|
|
26
|
+
import { cloudPricingDeepLink } from '../console/marketplace/marketplaceApi';
|
|
27
|
+
import { shouldShowAgentPicker } from './agentPicker';
|
|
28
|
+
/**
|
|
29
|
+
* Display names for the two built-in platform agents (ADR-0063: `ask` / `build`,
|
|
30
|
+
* bound by surface). The backend ships English labels ("Assistant" / "Builder");
|
|
31
|
+
* we localize the known ones here so the whole surface reads natively. Custom
|
|
32
|
+
* app agents fall back to whatever label the backend provides.
|
|
33
|
+
*
|
|
34
|
+
* Keyed by the FRIENDLY name (alias-group head) so the canonical id
|
|
35
|
+
* (`ask`/`build`) and the legacy alias (`data_chat`/`metadata_assistant`) both
|
|
36
|
+
* resolve — independent of whatever label the backend record carries.
|
|
37
|
+
*/
|
|
38
|
+
const PLATFORM_AGENT_LABELS = {
|
|
39
|
+
ask: { zh: '智能助手', en: 'Assistant' },
|
|
40
|
+
build: { zh: '构建助手', en: 'Build assistant' },
|
|
41
|
+
};
|
|
42
|
+
function localizeAgentLabel(isZh, agentName, fallbackLabel) {
|
|
43
|
+
const known = agentName ? PLATFORM_AGENT_LABELS[agentRouteName(agentName)] : undefined;
|
|
44
|
+
if (known)
|
|
45
|
+
return isZh ? known.zh : known.en;
|
|
46
|
+
return fallbackLabel;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Localized UI strings + starter prompts for the floating assistant.
|
|
50
|
+
* Keeps the chat surface in the user's language and gives non-expert users
|
|
51
|
+
* concrete things to click instead of a blank input — the modern AI pattern.
|
|
52
|
+
*/
|
|
53
|
+
function buildChatLocale(language, appLabel, agentName, fallbackAgentLabel, objects) {
|
|
54
|
+
const isZh = (language ?? '').toLowerCase().startsWith('zh');
|
|
55
|
+
const agentLabel = localizeAgentLabel(isZh, agentName, fallbackAgentLabel);
|
|
56
|
+
const sampleObjects = objects.slice(0, 2).map((o) => o.label || o.name);
|
|
57
|
+
if (isZh) {
|
|
58
|
+
const suggestions = [
|
|
59
|
+
sampleObjects[0] ? `查询最近创建的${sampleObjects[0]}` : '帮我查询最近的数据',
|
|
60
|
+
sampleObjects[0] ? `统计${sampleObjects[0]}的总数量` : '统计各对象的记录数量',
|
|
61
|
+
sampleObjects[1]
|
|
62
|
+
? `${sampleObjects[1]}有哪些字段?`
|
|
63
|
+
: '当前应用里有哪些数据对象?',
|
|
64
|
+
].filter(Boolean);
|
|
65
|
+
return {
|
|
66
|
+
agentLabel,
|
|
67
|
+
labels: {
|
|
68
|
+
emptyTitle: `你好,我是${agentLabel}`,
|
|
69
|
+
emptyDescription: `随时帮你查询和分析「${appLabel}」中的数据。试试下面的问题,或直接输入你的需求。`,
|
|
70
|
+
clear: '清空对话',
|
|
71
|
+
sendHint: '发送',
|
|
72
|
+
agentActivity: '执行过程',
|
|
73
|
+
toolCompleted: '已完成',
|
|
74
|
+
toolRunning: '运行中',
|
|
75
|
+
toolAwaitingApproval: '等待确认',
|
|
76
|
+
toolFailed: '失败',
|
|
77
|
+
connectionWaiting: '正在等待服务器响应…',
|
|
78
|
+
connectionStalledLabel: '仍在处理中…',
|
|
79
|
+
connectionOfflineLabel: '网络已断开,正在重连…',
|
|
80
|
+
toolDetailsHidden: '已隐藏工具参数和原始结果,仅保留过程摘要。',
|
|
81
|
+
copy: '复制',
|
|
82
|
+
copied: '已复制',
|
|
83
|
+
regenerate: '重新生成',
|
|
84
|
+
model: '模型',
|
|
85
|
+
submit: '发送',
|
|
86
|
+
uploadFiles: '上传文件',
|
|
87
|
+
stopResponse: '停止生成',
|
|
88
|
+
trace: '调试 trace',
|
|
89
|
+
viewTrace: '查看调试 trace',
|
|
90
|
+
},
|
|
91
|
+
placeholder: `向${agentLabel}提问…`,
|
|
92
|
+
loadingPlaceholder: '正在加载助手…',
|
|
93
|
+
title: `${appLabel} 智能助手`,
|
|
94
|
+
newChat: '开启新对话',
|
|
95
|
+
share: '分享对话',
|
|
96
|
+
reviewDraft: (n) => `查看 ${n} 项变更`,
|
|
97
|
+
publishDrafts: '发布',
|
|
98
|
+
published: '已发布',
|
|
99
|
+
nextSteps: '下一步',
|
|
100
|
+
planTitle: '方案预览',
|
|
101
|
+
planQuestions: '搭建前请确认',
|
|
102
|
+
planAssumptions: '假设',
|
|
103
|
+
planApproveHint: '回复以确认或调整该方案。',
|
|
104
|
+
planApprove: '开始搭建',
|
|
105
|
+
planAdjust: '调整方案',
|
|
106
|
+
planBuilt: '已搭建',
|
|
107
|
+
planApproveMessage: '就按这个方案搭建吧。',
|
|
108
|
+
planApproveDefaultsMessage: '就按你的合理假设直接搭建,未决问题用默认即可。',
|
|
109
|
+
planAnswer: (question, option) => `关于「${question}」,我选择「${option}」。`,
|
|
110
|
+
publishOk: '已发布,对象已生效。',
|
|
111
|
+
publishFailed: '发布失败',
|
|
112
|
+
seedWarn: '已发布,但部分示例数据未能载入。',
|
|
113
|
+
openBuiltApp: '打开应用',
|
|
114
|
+
suggestions,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const suggestions = [
|
|
118
|
+
sampleObjects[0] ? `Show the latest ${sampleObjects[0]}` : 'Show my most recent records',
|
|
119
|
+
sampleObjects[0] ? `How many ${sampleObjects[0]} are there?` : 'Count records by status',
|
|
120
|
+
sampleObjects[1]
|
|
121
|
+
? `What fields does ${sampleObjects[1]} have?`
|
|
122
|
+
: 'What data can I work with here?',
|
|
123
|
+
].filter(Boolean);
|
|
124
|
+
return {
|
|
125
|
+
agentLabel,
|
|
126
|
+
labels: {
|
|
127
|
+
emptyTitle: `Hi, I'm ${agentLabel}`,
|
|
128
|
+
emptyDescription: `I can help you query and analyze your ${appLabel} data. Try a prompt below, or just type your question.`,
|
|
129
|
+
clear: 'Clear',
|
|
130
|
+
sendHint: 'to send',
|
|
131
|
+
agentActivity: 'Agent activity',
|
|
132
|
+
toolCompleted: 'Completed',
|
|
133
|
+
toolRunning: 'Running',
|
|
134
|
+
toolAwaitingApproval: 'Awaiting approval',
|
|
135
|
+
toolFailed: 'Failed',
|
|
136
|
+
connectionWaiting: 'Waiting for server…',
|
|
137
|
+
connectionStalledLabel: 'Still working…',
|
|
138
|
+
connectionOfflineLabel: 'Connection lost — reconnecting…',
|
|
139
|
+
toolDetailsHidden: 'Tool inputs and raw results are hidden in this view.',
|
|
140
|
+
copy: 'Copy',
|
|
141
|
+
copied: 'Copied',
|
|
142
|
+
regenerate: 'Regenerate',
|
|
143
|
+
model: 'Model',
|
|
144
|
+
submit: 'Submit',
|
|
145
|
+
uploadFiles: 'Upload files',
|
|
146
|
+
stopResponse: 'Stop response',
|
|
147
|
+
trace: 'trace',
|
|
148
|
+
viewTrace: 'View trace',
|
|
149
|
+
},
|
|
150
|
+
placeholder: `Ask ${agentLabel}...`,
|
|
151
|
+
loadingPlaceholder: 'Loading assistant...',
|
|
152
|
+
title: `${appLabel} Assistant`,
|
|
153
|
+
newChat: 'New chat',
|
|
154
|
+
share: 'Share conversation',
|
|
155
|
+
reviewDraft: (n) => `Review ${n} change${n === 1 ? '' : 's'}`,
|
|
156
|
+
publishDrafts: 'Publish',
|
|
157
|
+
published: 'Published',
|
|
158
|
+
nextSteps: "What's next",
|
|
159
|
+
planTitle: 'Proposed plan',
|
|
160
|
+
planQuestions: 'Confirm before building',
|
|
161
|
+
planAssumptions: 'Assumptions',
|
|
162
|
+
planApproveHint: 'Reply to approve or adjust this plan.',
|
|
163
|
+
planApprove: 'Build it',
|
|
164
|
+
planAdjust: 'Adjust',
|
|
165
|
+
planBuilt: 'Built',
|
|
166
|
+
planApproveMessage: 'Looks good — build it as proposed.',
|
|
167
|
+
planApproveDefaultsMessage: 'Build it with your best assumptions; use sensible defaults for the open questions.',
|
|
168
|
+
planAnswer: (question, option) => `For "${question}", go with: ${option}.`,
|
|
169
|
+
publishOk: 'Published — objects are now live.',
|
|
170
|
+
publishFailed: 'Publish failed',
|
|
171
|
+
seedWarn: 'Published, but some sample data failed to load.',
|
|
172
|
+
openBuiltApp: 'Open app',
|
|
173
|
+
suggestions,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
19
176
|
const DEFAULT_AI_PATH = '/api/v1/ai';
|
|
20
177
|
function resolveApiBase(explicit) {
|
|
21
178
|
if (explicit)
|
|
@@ -27,53 +184,139 @@ function resolveApiBase(explicit) {
|
|
|
27
184
|
const serverUrl = env.VITE_SERVER_URL ?? '';
|
|
28
185
|
return `${serverUrl.replace(/\/$/, '')}${DEFAULT_AI_PATH}`;
|
|
29
186
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
187
|
+
/**
|
|
188
|
+
* Inner component that owns the chat hook. Re-mounted (via `key`) whenever
|
|
189
|
+
* the active agent changes so `useObjectChat`'s first-render mode lock
|
|
190
|
+
* (api vs local) picks up the new endpoint.
|
|
191
|
+
*/
|
|
192
|
+
/**
|
|
193
|
+
* Starter prompts tailored to the metadata item currently open in a
|
|
194
|
+
* designer. Returns null when nothing relevant is being edited, so the
|
|
195
|
+
* caller falls back to the generic agent suggestions.
|
|
196
|
+
*/
|
|
197
|
+
function buildEditorSuggestions(editor, language) {
|
|
198
|
+
if (!editor || editor.type !== 'object')
|
|
199
|
+
return null;
|
|
200
|
+
const subject = editor.label || editor.name || 'this object';
|
|
201
|
+
const zh = (language ?? '').toLowerCase().startsWith('zh');
|
|
202
|
+
return zh
|
|
203
|
+
? [`为「${subject}」补充字段`, `为「${subject}」建议校验规则`, '添加一个状态选项字段']
|
|
204
|
+
: [`Add fields to ${subject}`, `Suggest validations for ${subject}`, 'Add a status picklist field'];
|
|
205
|
+
}
|
|
206
|
+
/** Segments after `:appName` that are route prefixes, not object names. */
|
|
207
|
+
const NON_OBJECT_ROUTE_SEGMENTS = new Set([
|
|
208
|
+
'view', 'record', 'page', 'dashboard', 'design', 'report', 'metadata',
|
|
209
|
+
]);
|
|
210
|
+
/** Decode a URL segment, falling back to the raw value on malformed input. */
|
|
211
|
+
function safeDecodeSegment(value) {
|
|
212
|
+
try {
|
|
213
|
+
return decodeURIComponent(value);
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
return value;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Derive the object (and record) the user is currently viewing from the
|
|
221
|
+
* console URL, so the agent can act on "this object" without the user
|
|
222
|
+
* restating it. Mirrors the URL layout parsed by `useTrackRouteAsRecent`:
|
|
223
|
+
*
|
|
224
|
+
* /apps/:appName/:objectName
|
|
225
|
+
* /apps/:appName/:objectName/:recordId
|
|
226
|
+
* /apps/:appName/:objectName/new
|
|
227
|
+
*
|
|
228
|
+
* Tolerates an optional shell prefix (e.g. `/_console`) by locating the
|
|
229
|
+
* `apps` segment dynamically. Returns an empty object when the path isn't an
|
|
230
|
+
* object route (dashboard/page/report/metadata) or the segment doesn't match
|
|
231
|
+
* a known object in the current app.
|
|
232
|
+
*/
|
|
233
|
+
function resolveCurrentRouteObject(pathname, objects) {
|
|
234
|
+
const parts = pathname.split('/').filter(Boolean);
|
|
235
|
+
const appsIdx = parts.indexOf('apps');
|
|
236
|
+
// Need at least [apps, appName, objectName].
|
|
237
|
+
if (appsIdx === -1 || parts.length < appsIdx + 3)
|
|
238
|
+
return {};
|
|
239
|
+
const objectSeg = safeDecodeSegment(parts[appsIdx + 2]);
|
|
240
|
+
if (NON_OBJECT_ROUTE_SEGMENTS.has(objectSeg))
|
|
241
|
+
return {};
|
|
242
|
+
if (!objects.some((o) => o.name === objectSeg))
|
|
243
|
+
return {};
|
|
244
|
+
const recordSeg = parts[appsIdx + 3] ? safeDecodeSegment(parts[appsIdx + 3]) : undefined;
|
|
245
|
+
const recordId = recordSeg && recordSeg !== 'new' ? recordSeg : undefined;
|
|
246
|
+
return { objectName: objectSeg, ...(recordId ? { recordId } : {}) };
|
|
247
|
+
}
|
|
248
|
+
function ChatbotInner({ appLabel, appName, objects, agents, agentsLoading, activeAgent, onAgentChange, showAgentPicker, chatApi, apiBase, defaultOpen = false, conversationId, initialMessages: persistedMessages, }) {
|
|
249
|
+
const { language } = useObjectTranslation();
|
|
250
|
+
const navigate = useNavigate();
|
|
251
|
+
const location = useLocation();
|
|
252
|
+
// The object/record the user is currently viewing in the runtime console,
|
|
253
|
+
// derived from the route. Lets the agent answer "analyse this object" and
|
|
254
|
+
// scope data queries to the open page without the user naming it.
|
|
255
|
+
const currentRouteObject = React.useMemo(() => resolveCurrentRouteObject(location.pathname, objects), [location.pathname, objects]);
|
|
256
|
+
// What the user is currently editing in a designer (if any). Merged into
|
|
257
|
+
// the agent context so "add a priority field" acts on the open object,
|
|
258
|
+
// and drives context-aware starter suggestions.
|
|
259
|
+
const { editor } = useAssistant();
|
|
260
|
+
// Replay persisted history when present.
|
|
34
261
|
const hydratedHistory = React.useMemo(() => {
|
|
35
262
|
if (!persistedMessages || persistedMessages.length === 0)
|
|
36
263
|
return [];
|
|
37
|
-
return persistedMessages
|
|
38
|
-
id: m.id,
|
|
39
|
-
role: m.role,
|
|
40
|
-
content: m.parts.map((p) => p.text).join(''),
|
|
41
|
-
}));
|
|
264
|
+
return uiMessagesToChatMessages(persistedMessages);
|
|
42
265
|
}, [persistedMessages]);
|
|
43
266
|
const activeAgentLabel = React.useMemo(() => {
|
|
44
267
|
const found = agents.find((a) => a.name === activeAgent);
|
|
45
268
|
return found?.label ?? activeAgent ?? appLabel;
|
|
46
269
|
}, [agents, activeAgent, appLabel]);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
270
|
+
// Localized labels, placeholder, title and contextual starter prompts.
|
|
271
|
+
const locale = React.useMemo(() => buildChatLocale(language, appLabel, activeAgent, activeAgentLabel, objects), [language, appLabel, activeAgent, activeAgentLabel, objects]);
|
|
272
|
+
// When a designer is open, prefer starter prompts about that item.
|
|
273
|
+
const editorSuggestions = React.useMemo(() => buildEditorSuggestions(editor, language), [editor, language]);
|
|
274
|
+
// ADR-0013 D2: reconcile a stream-transport failure instead of blindly
|
|
275
|
+
// retrying. Shared across chat surfaces — see useReconcileOnError.
|
|
276
|
+
const { errorSuppressed, handleChatError, setMessagesRef, resetSuppression } = useReconcileOnError({ chatApi, conversationId });
|
|
277
|
+
const { messages, isLoading, error, sendMessage, stop, reload, clear, setMessages, } = useObjectChat({
|
|
51
278
|
api: chatApi,
|
|
52
279
|
conversationId,
|
|
280
|
+
onError: handleChatError,
|
|
53
281
|
body: {
|
|
54
282
|
context: {
|
|
55
283
|
activeApp: appLabel,
|
|
284
|
+
appName,
|
|
56
285
|
objects: objects.map((o) => ({ name: o.name, label: o.label })),
|
|
57
286
|
agentName: activeAgent,
|
|
287
|
+
// Publish posture, so the agent's narration matches reality (an
|
|
288
|
+
// auto-published build is live, not "to publish").
|
|
289
|
+
autoPublishAiBuilds: getRuntimeConfig().features.autoPublishAiBuilds,
|
|
290
|
+
// The object/record currently open in the runtime console — the
|
|
291
|
+
// backend injects its schema and scopes data queries to it, so
|
|
292
|
+
// "analyse this object" works without the user naming it.
|
|
293
|
+
...(currentRouteObject.objectName ? { objectName: currentRouteObject.objectName } : {}),
|
|
294
|
+
...(currentRouteObject.recordId ? { recordId: currentRouteObject.recordId } : {}),
|
|
295
|
+
// The metadata item currently open in a designer, so the agent
|
|
296
|
+
// can act on "this object/view/…" without the user restating it.
|
|
297
|
+
...(editor ? { editing: editor } : {}),
|
|
58
298
|
},
|
|
59
299
|
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
id: 'welcome',
|
|
65
|
-
role: 'assistant',
|
|
66
|
-
content: welcomeContent,
|
|
67
|
-
},
|
|
68
|
-
],
|
|
300
|
+
// Start empty so the modern empty-state + starter prompts render. We no
|
|
301
|
+
// longer inject a synthetic "welcome" bubble — the agent identity now
|
|
302
|
+
// lives in the empty-state title, matching mainstream AI tools.
|
|
303
|
+
initialMessages: hydratedHistory,
|
|
69
304
|
// Local-mode fallback: only used when `chatApi` is undefined (no agent
|
|
70
305
|
// resolved yet, or no backend available). Keeps the UI usable.
|
|
71
306
|
autoResponse: !chatApi,
|
|
72
|
-
autoResponseText:
|
|
73
|
-
? `I can help you work with ${
|
|
307
|
+
autoResponseText: objects.length > 0
|
|
308
|
+
? `I can help you work with ${objects
|
|
309
|
+
.map((o) => o.label || o.name)
|
|
310
|
+
.join(', ')}. What would you like to do?`
|
|
74
311
|
: "Thanks for your message! I'm here to help you navigate and manage your data.",
|
|
75
312
|
autoResponseDelay: 600,
|
|
76
313
|
});
|
|
314
|
+
React.useEffect(() => {
|
|
315
|
+
setMessagesRef.current = setMessages;
|
|
316
|
+
}, [setMessages]);
|
|
317
|
+
React.useEffect(() => {
|
|
318
|
+
writeConversationMessagesCache(conversationId, sanitizeChatMessagesForCache(messages));
|
|
319
|
+
}, [conversationId, messages]);
|
|
77
320
|
// HITL bridge — turns the pending-approval tool result envelope from the
|
|
78
321
|
// framework's action-tools.ts into inline approve/reject buttons that talk
|
|
79
322
|
// directly to /api/v1/ai/pending-actions/:id/{approve,reject}. After a
|
|
@@ -83,40 +326,145 @@ function ChatbotInner({ appLabel, objects, agents, agentsLoading, agentsError, a
|
|
|
83
326
|
messages: messages,
|
|
84
327
|
apiBase,
|
|
85
328
|
continueConversation: (prompt) => {
|
|
329
|
+
resetSuppression();
|
|
86
330
|
sendMessage(prompt);
|
|
87
331
|
},
|
|
88
332
|
});
|
|
89
|
-
|
|
333
|
+
// Agent switcher — Ask ↔ Build (plus any custom agents). Restrained by
|
|
334
|
+
// design: end users bound to a single agent never see it. `showAgentPicker`
|
|
335
|
+
// is true when AI development is unlocked (catalog serves both ask & build)
|
|
336
|
+
// or forced on; it still needs more than one agent to be a real choice.
|
|
337
|
+
const headerExtra = showAgentPicker && agents.length > 1 ? (_jsxs(Select, { value: activeAgent, onValueChange: onAgentChange, disabled: agentsLoading, children: [_jsx(SelectTrigger, { className: "h-7 w-[180px] text-xs", "data-testid": "floating-chatbot-agent-picker", children: _jsx(SelectValue, { placeholder: "Choose agent..." }) }), _jsx(SelectContent, { align: "end", children: agents.map((agent) => (_jsxs(SelectItem, { value: agent.name, className: "text-xs", children: [_jsx("span", { className: "font-medium", children: agent.label }), agent.description ? (_jsx("span", { className: "block text-muted-foreground text-[10px] truncate max-w-[220px]", children: agent.description })) : null] }, agent.name))) })] })) : null;
|
|
90
338
|
// Share-link control. Sits to the left of the panel's built-in
|
|
91
339
|
// fullscreen / close buttons so users can mint a public link without
|
|
92
340
|
// jumping out to the full `/ai/:id` page.
|
|
93
341
|
const [shareOpen, setShareOpen] = React.useState(false);
|
|
94
342
|
const restApiBase = React.useMemo(() => apiBase.replace(/\/v1\/ai$/, '').replace(/\/ai$/, '') || '/api', [apiBase]);
|
|
95
|
-
const headerActions =
|
|
96
|
-
return (_jsxs(_Fragment, { children: [_jsx(FloatingChatbot, { floatingConfig: {
|
|
343
|
+
const headerActions = (_jsxs(_Fragment, { children: [messages.length > 0 ? (_jsx(Button, { variant: "ghost", size: "icon", className: "h-7 w-7", "aria-label": locale.newChat, title: locale.newChat, "data-testid": "floating-chatbot-new", onClick: clear, children: _jsx(SquarePen, { className: "h-4 w-4" }) })) : null, conversationId ? (_jsx(Button, { variant: "ghost", size: "icon", className: "h-7 w-7", "aria-label": locale.share, title: locale.share, "data-testid": "floating-chatbot-share", onClick: () => setShareOpen(true), children: _jsx(Share2, { className: "h-4 w-4" }) })) : null] }));
|
|
344
|
+
return (_jsxs(_Fragment, { children: [_jsx(FloatingChatbot, { onUpgrade: () => window.open(cloudPricingDeepLink(), '_blank', 'noopener,noreferrer'), floatingConfig: {
|
|
97
345
|
position: 'bottom-right',
|
|
98
346
|
defaultOpen,
|
|
99
347
|
panelWidth: 420,
|
|
100
348
|
panelHeight: 560,
|
|
101
|
-
title:
|
|
349
|
+
title: locale.title,
|
|
102
350
|
triggerSize: 56,
|
|
103
|
-
}, headerExtra: headerExtra, headerActions: headerActions, messages: messages, placeholder: activeAgent
|
|
104
|
-
?
|
|
351
|
+
}, headerExtra: headerExtra, headerActions: headerActions, messages: messages, labels: locale.labels, showAvatars: true, hideClearBar: true, assistantAvatarFallback: locale.agentLabel, suggestions: messages.length === 0 ? (editorSuggestions ?? locale.suggestions) : undefined, placeholder: activeAgent
|
|
352
|
+
? locale.placeholder
|
|
105
353
|
: agentsLoading
|
|
106
|
-
?
|
|
107
|
-
:
|
|
354
|
+
? locale.loadingPlaceholder
|
|
355
|
+
: locale.placeholder, onSendMessage: (content) => { resetSuppression(); sendMessage(content); }, onClear: clear, onStop: isLoading ? stop : undefined, onReload: reload, isLoading: isLoading, error: errorSuppressed ? undefined : error, enableMarkdown: true, onToolApprove: hitl.decide, toolDecisions: hitl.decisions, toolApproveLabel: "Approve & run", toolDenyLabel: "Reject", toolDenyReason: "Operator rejected from chat", onReviewDraft: (items) => {
|
|
356
|
+
// ADR-0033 Phase B: open the first drafted item in the designer's
|
|
357
|
+
// review/diff. The remaining items stay drafted and surface their
|
|
358
|
+
// own review when opened. The host navigator (AppContent) knows the
|
|
359
|
+
// app base and performs the routing.
|
|
360
|
+
if (items[0])
|
|
361
|
+
requestAssistantReview(items[0]);
|
|
362
|
+
}, toolReviewLabel: locale.reviewDraft,
|
|
363
|
+
// Build-tree "Open app": jump straight into the app the agent just
|
|
364
|
+
// built (the panel only shows this once the build reports done).
|
|
365
|
+
onOpenBuiltApp: (appName) => navigate(`/apps/${encodeURIComponent(appName)}`), openBuiltAppLabel: locale.openBuiltApp,
|
|
366
|
+
// ADR-0037: see the drafted app as-if-published before Publish — same
|
|
367
|
+
// route, draft overlay, watermark bar on top.
|
|
368
|
+
onPreviewDraftApp: (appName, opts) => navigate(
|
|
369
|
+
// ADR-0045: a materialized build is a REAL (unlisted) app — open it
|
|
370
|
+
// directly; the UnpublishedAppBar narrates. Drafts keep the overlay.
|
|
371
|
+
opts?.materialized
|
|
372
|
+
? `/apps/${encodeURIComponent(appName)}`
|
|
373
|
+
: `/apps/${encodeURIComponent(appName)}?preview=draft`),
|
|
374
|
+
// ADR-0037 P2.5: announce drafted artifacts so an open ?preview=draft
|
|
375
|
+
// page (same document) drops its cache and refetches the new draft.
|
|
376
|
+
onDraftArtifacts: (artifacts) => {
|
|
377
|
+
for (const a of artifacts)
|
|
378
|
+
emitCanvasInvalidate(a);
|
|
379
|
+
},
|
|
380
|
+
// Live lifecycle truth for draft cards: the server's pending count per
|
|
381
|
+
// package, so reloaded conversations show Published/Publish honestly.
|
|
382
|
+
fetchPendingDraftCount: fetchPendingDraftCount, onPublishDrafts: async (packageId) => {
|
|
383
|
+
// ADR-0033 — promote the conversation's staged drafts to live in one
|
|
384
|
+
// click (the human still confirms here). Mirrors PackagesPage's
|
|
385
|
+
// publish-drafts call; cookie-authenticated like the rest of the SPA.
|
|
386
|
+
try {
|
|
387
|
+
const res = await fetch(`/api/v1/packages/${encodeURIComponent(packageId)}/publish-drafts`, {
|
|
388
|
+
method: 'POST',
|
|
389
|
+
credentials: 'include',
|
|
390
|
+
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
|
|
391
|
+
body: '{}',
|
|
392
|
+
});
|
|
393
|
+
const payload = await res.json().catch(() => null);
|
|
394
|
+
if (!res.ok || payload?.success === false) {
|
|
395
|
+
throw new Error(payload?.error?.message || `HTTP ${res.status}`);
|
|
396
|
+
}
|
|
397
|
+
const failed = payload?.data?.failedCount ?? payload?.failedCount ?? 0;
|
|
398
|
+
if (failed)
|
|
399
|
+
throw new Error(String(failed));
|
|
400
|
+
// The protocol materializes published `seed` rows and reports under
|
|
401
|
+
// `seedApplied` — a data problem never fails the publish, so it
|
|
402
|
+
// must be surfaced HERE or the user lands on an app with silently
|
|
403
|
+
// empty tables (the staging "No rows" incident).
|
|
404
|
+
const seedApplied = payload?.data?.seedApplied ?? payload?.seedApplied;
|
|
405
|
+
if (seedApplied && seedApplied.success === false) {
|
|
406
|
+
toast.warning(locale.seedWarn, {
|
|
407
|
+
description: seedApplied.error ??
|
|
408
|
+
(Array.isArray(seedApplied.errors) && seedApplied.errors.length
|
|
409
|
+
? String(seedApplied.errors[0])
|
|
410
|
+
: undefined),
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
toast.success(locale.publishOk);
|
|
415
|
+
}
|
|
416
|
+
// Publish & Open: land the user ON the thing they just built rather
|
|
417
|
+
// than leaving them on an empty home with only a toast. Prefer the
|
|
418
|
+
// published App (a full navigable surface); the bare-object case has
|
|
419
|
+
// no app to open yet, so the toast is the only feedback there.
|
|
420
|
+
const published = payload?.data?.published ?? payload?.published ?? [];
|
|
421
|
+
const app = published.find((p) => p?.type === 'app' && p?.name);
|
|
422
|
+
if (app?.name)
|
|
423
|
+
navigate(`/apps/${encodeURIComponent(app.name)}`);
|
|
424
|
+
// ADR-0038 L3 — hand the runtime verification (seedApplied +
|
|
425
|
+
// probes) back to the chat so the Published card grows a
|
|
426
|
+
// build-health line instead of claiming bare success.
|
|
427
|
+
return { ok: true, health: publishHealthFromResponse(payload) };
|
|
428
|
+
}
|
|
429
|
+
catch (e) {
|
|
430
|
+
toast.error(locale.publishFailed, {
|
|
431
|
+
description: e instanceof Error ? e.message : undefined,
|
|
432
|
+
});
|
|
433
|
+
return false;
|
|
434
|
+
}
|
|
435
|
+
}, publishDraftsLabel: locale.publishDrafts, nextStepsLabel: locale.nextSteps, planTitleLabel: locale.planTitle, planQuestionsLabel: locale.planQuestions, planAssumptionsLabel: locale.planAssumptions, planApproveHintLabel: locale.planApproveHint, planApproveLabel: locale.planApprove, planAdjustLabel: locale.planAdjust, planBuiltLabel: locale.planBuilt, planApproveMessage: locale.planApproveMessage, planApproveDefaultsMessage: locale.planApproveDefaultsMessage, planAnswerMessage: locale.planAnswer, publishedLabel: locale.published,
|
|
436
|
+
// Self-use "magic moment": when the plan enables it, auto-publish the
|
|
437
|
+
// drafted app the instant the agent finishes — the success path above
|
|
438
|
+
// then navigates straight to the live app, so "build" lands the user on
|
|
439
|
+
// a populated, running app with no manual Publish click.
|
|
440
|
+
autoPublishDrafts: getRuntimeConfig().features.autoPublishAiBuilds }), conversationId && (_jsx(ShareDialog, { open: shareOpen, onOpenChange: setShareOpen, objectName: "ai_conversations", recordId: conversationId, recordLabel: "this conversation", apiBase: restApiBase }))] }));
|
|
108
441
|
}
|
|
109
|
-
export default function ConsoleFloatingChatbot({ appLabel, objects, apiBase: apiBaseProp, defaultAgent: defaultAgentProp, defaultOpen = false, userId, }) {
|
|
442
|
+
export default function ConsoleFloatingChatbot({ appLabel, appName, objects, apiBase: apiBaseProp, defaultAgent: defaultAgentProp, showAgentPicker: showAgentPickerProp, defaultOpen = false, userId, }) {
|
|
110
443
|
const apiBase = React.useMemo(() => resolveApiBase(apiBaseProp), [apiBaseProp]);
|
|
111
444
|
const env = import.meta.env ?? {};
|
|
112
445
|
const envDefaultAgent = env.VITE_AI_DEFAULT_AGENT;
|
|
113
446
|
const { agents, isLoading: agentsLoading, error: agentsError } = useAgents({ apiBase });
|
|
447
|
+
// Reveal the Build/Ask switcher only when AI development is unlocked for this
|
|
448
|
+
// viewer — the live catalog serves BOTH an `ask` and a `build` agent and
|
|
449
|
+
// authoring isn't deployment-disabled. Pure end-user apps (only `ask`) stay
|
|
450
|
+
// clean; builders can flip "ask about my data" ↔ "extend my app" inline. An
|
|
451
|
+
// explicit prop or `VITE_AI_SHOW_AGENT_PICKER` still forces it. See agentPicker.
|
|
452
|
+
const showAgentPicker = shouldShowAgentPicker({
|
|
453
|
+
agents,
|
|
454
|
+
showAgentPickerProp,
|
|
455
|
+
envOptIn: env.VITE_AI_SHOW_AGENT_PICKER === 'true',
|
|
456
|
+
aiStudioEnabled: getRuntimeConfig().features.aiStudio !== false,
|
|
457
|
+
});
|
|
114
458
|
const [activeAgent, setActiveAgent] = React.useState(undefined);
|
|
115
459
|
React.useEffect(() => {
|
|
116
460
|
if (!activeAgent && agents.length > 0) {
|
|
461
|
+
// Mirror the backend's resolution: app.defaultAgent → data_chat →
|
|
462
|
+
// first agent. This binds the right copilot per app instead of
|
|
463
|
+
// landing on whichever agent happens to be first in the catalog.
|
|
117
464
|
const preferred = defaultAgentProp ?? envDefaultAgent;
|
|
118
|
-
const
|
|
119
|
-
|
|
465
|
+
const resolved = resolveDefaultAgentName(agents, preferred);
|
|
466
|
+
if (resolved)
|
|
467
|
+
setActiveAgent(resolved);
|
|
120
468
|
}
|
|
121
469
|
}, [agents, activeAgent, defaultAgentProp, envDefaultAgent]);
|
|
122
470
|
const chatApi = activeAgent
|
|
@@ -124,14 +472,16 @@ export default function ConsoleFloatingChatbot({ appLabel, objects, apiBase: api
|
|
|
124
472
|
: undefined;
|
|
125
473
|
// Server-backed conversation. Scoped by agent so each agent gets its own
|
|
126
474
|
// persistent history. Hook is inert until `userId` is provided; without it
|
|
127
|
-
// the FAB continues to work in local-only mode (no persistence).
|
|
475
|
+
// the FAB continues to work in local-only mode (no persistence). Gate `userId`
|
|
476
|
+
// on the agent being resolved so the conversation binds to the right scope
|
|
477
|
+
// from the first resolve (not a scopeless one during the catalog load).
|
|
128
478
|
const { conversationId, initialMessages } = useChatConversation({
|
|
129
|
-
userId,
|
|
479
|
+
userId: activeAgent ? userId : undefined,
|
|
130
480
|
scope: activeAgent,
|
|
131
481
|
apiBase,
|
|
132
482
|
});
|
|
133
483
|
// `key` forces a clean remount whenever the chat endpoint OR the resolved
|
|
134
484
|
// conversation id changes — required because `useObjectChat` locks its mode
|
|
135
485
|
// (api vs local) and its `conversationId` on first render.
|
|
136
|
-
return (_jsx(ChatbotInner, { appLabel: appLabel, objects: objects, agents: agents, agentsLoading: agentsLoading, agentsError: agentsError, activeAgent: activeAgent, onAgentChange: setActiveAgent, chatApi: chatApi, apiBase: apiBase, defaultOpen: defaultOpen, conversationId: conversationId, initialMessages: initialMessages }, `${chatApi ?? 'local'}:${conversationId ?? 'pending'}`));
|
|
486
|
+
return (_jsx(ChatbotInner, { appLabel: appLabel, appName: appName, objects: objects, agents: agents, agentsLoading: agentsLoading, agentsError: agentsError, activeAgent: activeAgent, onAgentChange: setActiveAgent, showAgentPicker: showAgentPicker, chatApi: chatApi, apiBase: apiBase, defaultOpen: defaultOpen, conversationId: conversationId, initialMessages: initialMessages }, `${chatApi ?? 'local'}:${conversationId ?? 'pending'}`));
|
|
137
487
|
}
|
|
@@ -23,5 +23,5 @@ interface ConsoleLayoutProps {
|
|
|
23
23
|
userId?: string;
|
|
24
24
|
}
|
|
25
25
|
/** Floating chatbot wired with useObjectChat for demo auto-response */
|
|
26
|
-
export declare function ConsoleLayout({ children, activeAppName, activeApp, onAppChange, objects, connectionState, userId, }: ConsoleLayoutProps):
|
|
26
|
+
export declare function ConsoleLayout({ children, activeAppName, activeApp, onAppChange, objects, connectionState, userId, }: ConsoleLayoutProps): React.JSX.Element;
|
|
27
27
|
export {};
|
|
@@ -11,16 +11,21 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
11
11
|
import { useEffect } from 'react';
|
|
12
12
|
import { AppShell } from '@object-ui/layout';
|
|
13
13
|
import { useDiscovery } from '@object-ui/react';
|
|
14
|
+
import { isBuildAgent } from '@object-ui/plugin-chatbot';
|
|
14
15
|
// Lightweight FAB stub — the heavy chat chunk graph (plugin-chatbot,
|
|
15
16
|
// shiki, streamdown, mermaid, @ai-sdk, ~20MB) only downloads on first
|
|
16
17
|
// hover/click. See ConsoleChatbotFab.tsx.
|
|
17
18
|
import { ConsoleChatbotFab } from './ConsoleChatbotFab';
|
|
19
|
+
import { DraftPreviewBar } from '../preview/DraftPreviewBar';
|
|
20
|
+
import { UnpublishedAppBar } from '../preview/UnpublishedAppBar';
|
|
18
21
|
import { UnifiedSidebar } from './UnifiedSidebar';
|
|
19
22
|
import { AppHeader } from './AppHeader';
|
|
20
23
|
import { MobileViewSwitcherProvider } from './MobileViewSwitcherContext';
|
|
21
24
|
import { useResponsiveSidebar } from '../hooks/useResponsiveSidebar';
|
|
22
25
|
import { useNavigationContext } from '../context/NavigationContext';
|
|
26
|
+
import { CommandPaletteProvider } from '../context/CommandPaletteProvider';
|
|
23
27
|
import { resolveI18nLabel } from '../utils';
|
|
28
|
+
import { getProductName, getRuntimeConfig } from '../runtime-config';
|
|
24
29
|
/** Inner component that can access SidebarProvider context */
|
|
25
30
|
function ConsoleLayoutInner({ children }) {
|
|
26
31
|
useResponsiveSidebar();
|
|
@@ -35,21 +40,32 @@ export function ConsoleLayout({ children, activeAppName, activeApp, onAppChange,
|
|
|
35
40
|
// AI as disabled (e.g. framework started without `--preset full`).
|
|
36
41
|
const aiBaseUrlConfigured = Boolean(import.meta.env?.VITE_AI_BASE_URL);
|
|
37
42
|
const showChatbot = isAiEnabled || aiBaseUrlConfigured;
|
|
43
|
+
// AI Studio (AI-driven metadata authoring / "online development") can be
|
|
44
|
+
// turned off per deployment. When off, suppress the metadata-authoring
|
|
45
|
+
// assistant so the chatbot falls back to the generic data assistant — the
|
|
46
|
+
// generic data-chat experience stays available.
|
|
47
|
+
const aiStudioEnabled = getRuntimeConfig().features.aiStudio !== false;
|
|
48
|
+
// Alias-aware: the build/authoring agent is `build` (new) or
|
|
49
|
+
// `metadata_assistant` (legacy). When AI Studio is off, drop it so the FAB
|
|
50
|
+
// falls back to the generic data assistant.
|
|
51
|
+
const effectiveDefaultAgent = !aiStudioEnabled && isBuildAgent(activeApp?.defaultAgent)
|
|
52
|
+
? undefined
|
|
53
|
+
: activeApp?.defaultAgent;
|
|
38
54
|
const { setContext, setCurrentAppName } = useNavigationContext();
|
|
39
55
|
// Set navigation context to 'app' when this layout mounts
|
|
40
56
|
useEffect(() => {
|
|
41
57
|
setContext('app');
|
|
42
58
|
setCurrentAppName(activeAppName);
|
|
43
59
|
}, [setContext, setCurrentAppName, activeAppName]);
|
|
44
|
-
return (_jsx(MobileViewSwitcherProvider, { children: _jsxs(AppShell, { sidebar: _jsx(UnifiedSidebar, { activeAppName: activeAppName, onAppChange: onAppChange }), navbar: _jsx(AppHeader, { variant: "app", appName: appLabel, objects: objects, connectionState: connectionState, activeAppName: activeAppName, onAppChange: onAppChange }), className: "!p-0 overflow-y-auto overflow-x-hidden bg-muted/5", branding: activeApp?.branding
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
return (_jsx(CommandPaletteProvider, { children: _jsx(MobileViewSwitcherProvider, { children: _jsxs(AppShell, { sidebar: _jsx(UnifiedSidebar, { activeAppName: activeAppName, onAppChange: onAppChange }), navbar: _jsx(AppHeader, { variant: "app", appName: appLabel, objects: objects, connectionState: connectionState, activeAppName: activeAppName, onAppChange: onAppChange }), className: "!p-0 overflow-y-auto overflow-x-hidden bg-muted/5", branding: activeApp?.branding
|
|
61
|
+
? {
|
|
62
|
+
primaryColor: activeApp.branding.primaryColor,
|
|
63
|
+
accentColor: activeApp.branding.accentColor,
|
|
64
|
+
favicon: activeApp.branding.favicon,
|
|
65
|
+
logo: activeApp.branding.logo,
|
|
66
|
+
title: activeApp.label
|
|
67
|
+
? `${resolveI18nLabel(activeApp.label)} — ${getProductName()}`
|
|
68
|
+
: undefined,
|
|
69
|
+
}
|
|
70
|
+
: undefined, children: [_jsxs(ConsoleLayoutInner, { children: [_jsx(DraftPreviewBar, {}), _jsx(UnpublishedAppBar, {}), children] }), showChatbot && (_jsx(ConsoleChatbotFab, { appLabel: appLabel, appName: activeAppName, defaultAgent: effectiveDefaultAgent, objects: objects, userId: userId }))] }) }) }));
|
|
55
71
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AppContextSelectors — renders the app-level "scope" dropdowns declared
|
|
3
|
+
* in `App.contextSelectors` (e.g. the Studio package filter) and exposes
|
|
4
|
+
* their current values so the sidebar can feed them into
|
|
5
|
+
* `NavigationRenderer`'s `templateContext.contextValues`.
|
|
6
|
+
*
|
|
7
|
+
* Each selector's value is published under its `id` and referenced by
|
|
8
|
+
* nav items as `{<id>}` (e.g. `{active_package}`), exactly like the
|
|
9
|
+
* built-in `{current_user_id}` / `{current_org_id}` template vars.
|
|
10
|
+
* Selecting an option therefore transparently scopes every child nav
|
|
11
|
+
* item — no per-item wiring required.
|
|
12
|
+
*
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
export interface ContextSelectorFilter {
|
|
17
|
+
key: string;
|
|
18
|
+
op?: 'eq' | 'ne' | 'in' | 'nin';
|
|
19
|
+
value: string | string[];
|
|
20
|
+
}
|
|
21
|
+
export interface ContextSelectorDef {
|
|
22
|
+
id: string;
|
|
23
|
+
label?: unknown;
|
|
24
|
+
icon?: string;
|
|
25
|
+
optionsSource: {
|
|
26
|
+
endpoint: string;
|
|
27
|
+
valueKey?: string;
|
|
28
|
+
labelKey?: string;
|
|
29
|
+
filter?: ContextSelectorFilter[];
|
|
30
|
+
};
|
|
31
|
+
includeAll?: boolean;
|
|
32
|
+
allValue?: string;
|
|
33
|
+
persist?: 'query' | 'session' | 'none';
|
|
34
|
+
placement?: 'sidebar_header' | 'topbar';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Hook: resolves the active values for an app's context selectors and
|
|
38
|
+
* returns a ready-to-render UI element plus the `contextValues` map for
|
|
39
|
+
* `NavigationRenderer`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useAppContextSelectors(appName: string, selectors: ContextSelectorDef[] | undefined, t?: (key: string, options?: any) => string): {
|
|
42
|
+
contextValues: Record<string, string>;
|
|
43
|
+
element: React.ReactNode;
|
|
44
|
+
};
|