@object-ui/app-shell 6.2.3 → 7.0.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 +948 -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 +170 -37
- 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 +743 -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 +22 -0
- package/dist/console/ai/LiveCanvas.js +78 -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 +107 -4
- package/dist/hooks/useChatConversation.js +253 -25
- package/dist/hooks/useConsoleActionRuntime.d.ts +70 -0
- package/dist/hooks/useConsoleActionRuntime.js +560 -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 +16 -7
- package/dist/index.js +12 -4
- 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 +32 -2
- package/dist/layout/ConsoleFloatingChatbot.js +374 -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 +218 -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/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/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 +79 -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 +183 -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 +59 -0
- package/dist/views/FlowRunner.js +153 -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/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 +113 -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 +37 -0
- package/dist/views/metadata-admin/JsonSourceEditor.js +178 -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 +395 -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 +1223 -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 +266 -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 +213 -0
- package/dist/views/metadata-admin/anchors.js +237 -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 +1166 -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 +107 -0
- package/dist/views/metadata-admin/inspectors/FlowEdgeInspector.d.ts +16 -0
- package/dist/views/metadata-admin/inspectors/FlowEdgeInspector.js +45 -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 +140 -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 +54 -0
- package/dist/views/metadata-admin/inspectors/ObjectFieldInspector.d.ts +23 -0
- package/dist/views/metadata-admin/inspectors/ObjectFieldInspector.js +330 -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 +160 -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 +124 -0
- package/dist/views/metadata-admin/inspectors/_shared.js +113 -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 +461 -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/mergeServerFields.d.ts +65 -0
- package/dist/views/metadata-admin/mergeServerFields.js +56 -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 +89 -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 +43 -0
- package/dist/views/metadata-admin/previews/FlowCanvas.js +328 -0
- package/dist/views/metadata-admin/previews/FlowPreview.d.ts +20 -0
- package/dist/views/metadata-admin/previews/FlowPreview.js +92 -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 +170 -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 +90 -4
- 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/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 +88 -0
- package/dist/views/metadata-admin/previews/flow-canvas-layout.js +190 -0
- package/dist/views/metadata-admin/previews/flow-canvas-parts.d.ts +88 -0
- package/dist/views/metadata-admin/previews/flow-canvas-parts.js +358 -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 +109 -0
- package/dist/views/metadata-admin/previews/object-fields-io.js +208 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-types.d.ts +91 -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 +8 -0
- package/dist/views/metadata-admin/previews/simulator/flow-sim-validate.js +113 -0
- package/dist/views/metadata-admin/previews/simulator/flow-simulator.d.ts +44 -0
- package/dist/views/metadata-admin/previews/simulator/flow-simulator.js +316 -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
|
@@ -8,7 +8,55 @@
|
|
|
8
8
|
* (404/403).
|
|
9
9
|
*/
|
|
10
10
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
11
|
+
/**
|
|
12
|
+
* Rebuild the MINIMAL `{ status:'drafted', … }` envelope that
|
|
13
|
+
* `mapMessages.detectDraftResult` re-parses, from the already-derived
|
|
14
|
+
* `DraftReview`. Inverse of the detector: we keep only the fields it reads, so
|
|
15
|
+
* the draft "Review N changes / Publish" card and the ADR-0038 verification
|
|
16
|
+
* chip survive without re-storing the (potentially large) blueprint JSON.
|
|
17
|
+
* `failed` is materialized to the right length because the detector counts
|
|
18
|
+
* `failed.length`.
|
|
19
|
+
*/
|
|
20
|
+
function draftReviewToCachedResult(dr) {
|
|
21
|
+
return {
|
|
22
|
+
status: 'drafted',
|
|
23
|
+
drafted: dr.items,
|
|
24
|
+
...(dr.summary ? { summary: dr.summary } : {}),
|
|
25
|
+
...(dr.packageId ? { packageId: dr.packageId } : {}),
|
|
26
|
+
...(dr.autoPublishable ? { autoPublishable: true } : {}),
|
|
27
|
+
...(dr.failedCount ? { failed: Array.from({ length: dr.failedCount }, () => null) } : {}),
|
|
28
|
+
...(dr.materialized ? { materialized: true } : {}),
|
|
29
|
+
...(dr.verification ? { verification: dr.verification } : {}),
|
|
30
|
+
...(dr.issues && dr.issues.length ? { issues: dr.issues } : {}),
|
|
31
|
+
...(dr.nextSteps && dr.nextSteps.length ? { nextSteps: dr.nextSteps } : {}),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Rebuild the MINIMAL `{ status:'blueprint_proposed', … }` envelope that
|
|
36
|
+
* `mapMessages.detectProposedPlan` re-parses, from the already-derived
|
|
37
|
+
* `ProposedPlan`. Object `fields` are materialized to the right length because
|
|
38
|
+
* the detector reads `fields.length` as the per-object field count — the field
|
|
39
|
+
* definitions themselves are dropped (the lean win).
|
|
40
|
+
*/
|
|
41
|
+
function proposedPlanToCachedResult(pp) {
|
|
42
|
+
return {
|
|
43
|
+
status: 'blueprint_proposed',
|
|
44
|
+
...(pp.summary ? { summary: pp.summary } : {}),
|
|
45
|
+
counts: pp.counts,
|
|
46
|
+
questions: pp.questions,
|
|
47
|
+
...(pp.targetApp ? { targetApp: pp.targetApp } : {}),
|
|
48
|
+
blueprint: {
|
|
49
|
+
objects: pp.objects.map((o) => ({
|
|
50
|
+
name: o.name,
|
|
51
|
+
...(o.label ? { label: o.label } : {}),
|
|
52
|
+
fields: Array.from({ length: o.fieldCount }, () => null),
|
|
53
|
+
})),
|
|
54
|
+
assumptions: pp.assumptions,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
11
58
|
const CACHE_PREFIX = 'objectstack:ai-chat-conversation-id';
|
|
59
|
+
const MESSAGE_CACHE_PREFIX = 'objectstack:ai-chat-messages';
|
|
12
60
|
function cacheKey(userId, scope) {
|
|
13
61
|
return scope ? `${CACHE_PREFIX}:${userId}:${scope}` : `${CACHE_PREFIX}:${userId}`;
|
|
14
62
|
}
|
|
@@ -31,46 +79,195 @@ function writeCache(key, value) {
|
|
|
31
79
|
/* ignore — private mode, quota, etc. */
|
|
32
80
|
}
|
|
33
81
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
82
|
+
function messageCacheKey(conversationId) {
|
|
83
|
+
return `${MESSAGE_CACHE_PREFIX}:${conversationId}`;
|
|
84
|
+
}
|
|
85
|
+
function readMessageCache(conversationId) {
|
|
86
|
+
try {
|
|
87
|
+
const raw = localStorage.getItem(messageCacheKey(conversationId));
|
|
88
|
+
if (!raw)
|
|
89
|
+
return [];
|
|
90
|
+
const parsed = JSON.parse(raw);
|
|
91
|
+
if (!Array.isArray(parsed))
|
|
92
|
+
return [];
|
|
93
|
+
return parsed.filter((msg) => {
|
|
94
|
+
return (Boolean(msg) &&
|
|
95
|
+
typeof msg === 'object' &&
|
|
96
|
+
typeof msg.id === 'string' &&
|
|
97
|
+
(msg.role === 'user' ||
|
|
98
|
+
msg.role === 'assistant' ||
|
|
99
|
+
msg.role === 'system') &&
|
|
100
|
+
Array.isArray(msg.parts));
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export function writeConversationMessagesCache(conversationId, messages) {
|
|
108
|
+
if (!conversationId)
|
|
109
|
+
return;
|
|
110
|
+
try {
|
|
111
|
+
if (messages.length === 0) {
|
|
112
|
+
localStorage.removeItem(messageCacheKey(conversationId));
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
localStorage.setItem(messageCacheKey(conversationId), JSON.stringify(messages));
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
/* ignore — private mode, quota, etc. */
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export function sanitizeChatMessagesForCache(messages) {
|
|
122
|
+
return messages
|
|
123
|
+
.map((message) => {
|
|
124
|
+
const parts = [];
|
|
125
|
+
if (message.content) {
|
|
126
|
+
parts.push({ type: 'text', text: message.content });
|
|
127
|
+
}
|
|
128
|
+
if (message.role === 'assistant') {
|
|
129
|
+
for (const tool of message.toolInvocations ?? []) {
|
|
130
|
+
// Re-serialize the draft/plan affordance into a compact tool `output`.
|
|
131
|
+
// Without it, a cache-fallback reload (server returns no messages →
|
|
132
|
+
// `readMessageCache`) drops the draft "Review N changes / Publish"
|
|
133
|
+
// card, the ADR-0038 verification chip, and the "Proposed plan" card,
|
|
134
|
+
// because `mapMessages.detect*` read the result `output` that the
|
|
135
|
+
// earlier cache shape never kept. `output` (not a custom part field)
|
|
136
|
+
// is used because the AI SDK preserves it through `useChat` init,
|
|
137
|
+
// exactly as the server-backed tool-result merge relies on.
|
|
138
|
+
const cachedOutput = tool.draftReview
|
|
139
|
+
? draftReviewToCachedResult(tool.draftReview)
|
|
140
|
+
: tool.proposedPlan
|
|
141
|
+
? proposedPlanToCachedResult(tool.proposedPlan)
|
|
142
|
+
: undefined;
|
|
143
|
+
parts.push({
|
|
144
|
+
type: `tool-${tool.toolName}`,
|
|
145
|
+
toolCallId: tool.toolCallId,
|
|
146
|
+
toolName: tool.toolName,
|
|
147
|
+
state: tool.state ?? (tool.errorText ? 'output-error' : 'output-available'),
|
|
148
|
+
...(tool.errorText ? { errorText: tool.errorText } : {}),
|
|
149
|
+
...(cachedOutput !== undefined ? { output: cachedOutput } : {}),
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (parts.length === 0)
|
|
154
|
+
return undefined;
|
|
155
|
+
return {
|
|
156
|
+
id: message.id,
|
|
157
|
+
role: message.role,
|
|
158
|
+
parts,
|
|
159
|
+
};
|
|
160
|
+
})
|
|
161
|
+
.filter((message) => Boolean(message));
|
|
162
|
+
}
|
|
163
|
+
function contentToParts(content) {
|
|
164
|
+
if (typeof content === 'string') {
|
|
165
|
+
return content ? [{ type: 'text', text: content }] : [];
|
|
166
|
+
}
|
|
37
167
|
if (Array.isArray(content)) {
|
|
38
168
|
return content
|
|
39
169
|
.map((part) => {
|
|
40
|
-
if (typeof part === 'string')
|
|
170
|
+
if (typeof part === 'string') {
|
|
171
|
+
return part ? { type: 'text', text: part } : undefined;
|
|
172
|
+
}
|
|
173
|
+
if (part &&
|
|
174
|
+
typeof part === 'object' &&
|
|
175
|
+
'type' in part &&
|
|
176
|
+
typeof part.type === 'string') {
|
|
41
177
|
return part;
|
|
178
|
+
}
|
|
42
179
|
if (part &&
|
|
43
180
|
typeof part === 'object' &&
|
|
44
181
|
'text' in part &&
|
|
45
182
|
typeof part.text === 'string') {
|
|
46
|
-
return part.text;
|
|
183
|
+
return { type: 'text', text: part.text };
|
|
47
184
|
}
|
|
48
|
-
return
|
|
185
|
+
return undefined;
|
|
49
186
|
})
|
|
50
|
-
.
|
|
187
|
+
.filter((part) => Boolean(part));
|
|
51
188
|
}
|
|
52
|
-
|
|
189
|
+
if (content &&
|
|
190
|
+
typeof content === 'object' &&
|
|
191
|
+
'parts' in content &&
|
|
192
|
+
Array.isArray(content.parts)) {
|
|
193
|
+
return contentToParts(content.parts);
|
|
194
|
+
}
|
|
195
|
+
return [];
|
|
53
196
|
}
|
|
54
|
-
|
|
197
|
+
/**
|
|
198
|
+
* Merge a `tool`-role message's tool-result outputs back onto the assistant
|
|
199
|
+
* tool-call parts that requested them. The server persists conversations in
|
|
200
|
+
* ModelMessage format, where a tool CALL (assistant message) and its RESULT (a
|
|
201
|
+
* separate `tool` row) live in different messages. The chat UI needs the output
|
|
202
|
+
* ON the call part so `detectDraftResult` can rebuild the publish/preview
|
|
203
|
+
* affordances after a reload — otherwise the result, and the whole `tool` row
|
|
204
|
+
* (which the UI never renders directly), is dropped and the build card + publish
|
|
205
|
+
* button vanish on refresh.
|
|
206
|
+
*/
|
|
207
|
+
function mergeToolResultsInto(content, byCallId) {
|
|
208
|
+
for (const part of contentToParts(content)) {
|
|
209
|
+
const callId = typeof part.toolCallId === 'string' ? part.toolCallId : undefined;
|
|
210
|
+
if (!callId)
|
|
211
|
+
continue;
|
|
212
|
+
const target = byCallId.get(callId);
|
|
213
|
+
if (!target)
|
|
214
|
+
continue;
|
|
215
|
+
const output = part.output ?? part.result;
|
|
216
|
+
if (output === undefined)
|
|
217
|
+
continue;
|
|
218
|
+
target.output = output;
|
|
219
|
+
const errorText = part.errorText;
|
|
220
|
+
const isError = Boolean(part.isError) || typeof errorText === 'string';
|
|
221
|
+
target.state = isError ? 'output-error' : 'output-available';
|
|
222
|
+
if (typeof errorText === 'string')
|
|
223
|
+
target.errorText = errorText;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
export function toUIMessages(rows) {
|
|
55
227
|
if (!rows)
|
|
56
228
|
return [];
|
|
57
229
|
const out = [];
|
|
230
|
+
// Index assistant tool-call parts by id so a later `tool`-role result row can
|
|
231
|
+
// merge its output onto the matching call (see mergeToolResultsInto).
|
|
232
|
+
const toolPartByCallId = new Map();
|
|
58
233
|
rows.forEach((row, idx) => {
|
|
59
234
|
const role = row.role;
|
|
235
|
+
if (role === 'tool') {
|
|
236
|
+
mergeToolResultsInto(row.content, toolPartByCallId);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
60
239
|
if (role !== 'user' && role !== 'assistant' && role !== 'system')
|
|
61
240
|
return;
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
241
|
+
const parts = contentToParts(row.content);
|
|
242
|
+
if (parts.length === 0)
|
|
64
243
|
return;
|
|
244
|
+
if (role === 'assistant') {
|
|
245
|
+
for (const part of parts) {
|
|
246
|
+
// ModelMessage format persists an assistant tool CALL as the literal
|
|
247
|
+
// `type:'tool-call'` with the real tool in `toolName`. Left as-is, the
|
|
248
|
+
// chat humanizes the step title to "Call" (and downstream toolName
|
|
249
|
+
// extraction yields "call"). Remap to the AI SDK UI part type
|
|
250
|
+
// `tool-<toolName>` so the step reads "Apply blueprint" / "Propose
|
|
251
|
+
// blueprint" after a clean server-backed reload; the result-merge below
|
|
252
|
+
// and `detect*` are unaffected (they key off toolCallId / output).
|
|
253
|
+
if (part.type === 'tool-call' && typeof part.toolName === 'string' && part.toolName) {
|
|
254
|
+
part.type = `tool-${part.toolName}`;
|
|
255
|
+
}
|
|
256
|
+
const callId = typeof part.toolCallId === 'string' ? part.toolCallId : undefined;
|
|
257
|
+
if (callId && (part.type === 'tool-call' || part.type.startsWith('tool-'))) {
|
|
258
|
+
toolPartByCallId.set(callId, part);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
65
262
|
out.push({
|
|
66
263
|
id: row.id ?? `msg-${idx}`,
|
|
67
264
|
role,
|
|
68
|
-
parts
|
|
265
|
+
parts,
|
|
69
266
|
});
|
|
70
267
|
});
|
|
71
268
|
return out;
|
|
72
269
|
}
|
|
73
|
-
async function fetchConversation(apiBase, id) {
|
|
270
|
+
export async function fetchConversation(apiBase, id) {
|
|
74
271
|
const res = await fetch(`${apiBase}/conversations/${encodeURIComponent(id)}`, {
|
|
75
272
|
credentials: 'include',
|
|
76
273
|
});
|
|
@@ -100,15 +297,18 @@ async function deleteConversation(apiBase, id) {
|
|
|
100
297
|
});
|
|
101
298
|
}
|
|
102
299
|
export function useChatConversation(options) {
|
|
103
|
-
const { userId, scope, apiBase, activeId } = options;
|
|
300
|
+
const { userId, scope, apiBase, activeId, forceNew } = options;
|
|
104
301
|
const [conversationId, setConversationId] = useState(undefined);
|
|
105
302
|
const [initialMessages, setInitialMessages] = useState([]);
|
|
106
303
|
const [isLoading, setIsLoading] = useState(Boolean(userId));
|
|
107
304
|
const mountedRef = useRef(true);
|
|
108
|
-
// Tracks
|
|
109
|
-
//
|
|
110
|
-
//
|
|
305
|
+
// Tracks the (user, scope) we have already resolved a no-activeId
|
|
306
|
+
// conversation for. Keyed by SCOPE as well as user so a deliberate agent
|
|
307
|
+
// switch (the `/ai/:agent` launcher changes `scope`) re-resolves under the
|
|
308
|
+
// new agent's cache instead of clinging to the previous agent's conversation,
|
|
309
|
+
// while a no-op re-render under the same scope still short-circuits.
|
|
111
310
|
const resolvedForUserRef = useRef(undefined);
|
|
311
|
+
const resolvedScopeRef = useRef(undefined);
|
|
112
312
|
useEffect(() => {
|
|
113
313
|
mountedRef.current = true;
|
|
114
314
|
return () => {
|
|
@@ -121,15 +321,31 @@ export function useChatConversation(options) {
|
|
|
121
321
|
setInitialMessages([]);
|
|
122
322
|
setIsLoading(false);
|
|
123
323
|
resolvedForUserRef.current = undefined;
|
|
324
|
+
resolvedScopeRef.current = undefined;
|
|
124
325
|
return;
|
|
125
326
|
}
|
|
126
|
-
// Already resolved a conversation for this user during the
|
|
127
|
-
// window — don't re-create just because
|
|
128
|
-
|
|
327
|
+
// Already resolved a conversation for this (user, scope) during the
|
|
328
|
+
// no-activeId window — don't re-create just because an unrelated dep
|
|
329
|
+
// changed. A `forceNew` intent or a scope (agent) change overrides it.
|
|
330
|
+
const scopeChanged = resolvedScopeRef.current !== scope;
|
|
331
|
+
if (!activeId &&
|
|
332
|
+
!forceNew &&
|
|
333
|
+
!scopeChanged &&
|
|
334
|
+
resolvedForUserRef.current === userId &&
|
|
335
|
+
conversationId) {
|
|
129
336
|
return;
|
|
130
337
|
}
|
|
131
338
|
let cancelled = false;
|
|
132
339
|
const key = cacheKey(userId, scope);
|
|
340
|
+
// Drop the previous id NOW, before the async resolve, for both an explicit
|
|
341
|
+
// new-conversation intent AND an agent switch: the host page mirrors
|
|
342
|
+
// `conversationId` into the URL the moment `activeId` is empty, so a stale
|
|
343
|
+
// id left in state would be written onto the new agent's URL (`/ai/:agent`)
|
|
344
|
+
// and then resumed as that agent's conversation.
|
|
345
|
+
if (!activeId && (forceNew || (scopeChanged && resolvedForUserRef.current === userId))) {
|
|
346
|
+
setConversationId(undefined);
|
|
347
|
+
setInitialMessages([]);
|
|
348
|
+
}
|
|
133
349
|
setIsLoading(true);
|
|
134
350
|
(async () => {
|
|
135
351
|
try {
|
|
@@ -140,14 +356,17 @@ export function useChatConversation(options) {
|
|
|
140
356
|
if (existing) {
|
|
141
357
|
writeCache(key, existing.id);
|
|
142
358
|
setConversationId(existing.id);
|
|
143
|
-
|
|
359
|
+
const messages = toUIMessages(existing.messages);
|
|
360
|
+
setInitialMessages(messages.length > 0 ? messages : readMessageCache(existing.id));
|
|
144
361
|
resolvedForUserRef.current = userId;
|
|
362
|
+
resolvedScopeRef.current = scope;
|
|
145
363
|
return;
|
|
146
364
|
}
|
|
147
365
|
// Requested id is gone — fall through to create a fresh one.
|
|
148
366
|
writeCache(key, undefined);
|
|
367
|
+
writeConversationMessagesCache(activeId, []);
|
|
149
368
|
}
|
|
150
|
-
else {
|
|
369
|
+
else if (!forceNew) {
|
|
151
370
|
const cached = readCache(key);
|
|
152
371
|
if (cached) {
|
|
153
372
|
const existing = await fetchConversation(apiBase, cached);
|
|
@@ -155,11 +374,14 @@ export function useChatConversation(options) {
|
|
|
155
374
|
return;
|
|
156
375
|
if (existing) {
|
|
157
376
|
setConversationId(existing.id);
|
|
158
|
-
|
|
377
|
+
const messages = toUIMessages(existing.messages);
|
|
378
|
+
setInitialMessages(messages.length > 0 ? messages : readMessageCache(existing.id));
|
|
159
379
|
resolvedForUserRef.current = userId;
|
|
380
|
+
resolvedScopeRef.current = scope;
|
|
160
381
|
return;
|
|
161
382
|
}
|
|
162
383
|
writeCache(key, undefined);
|
|
384
|
+
writeConversationMessagesCache(cached, []);
|
|
163
385
|
}
|
|
164
386
|
}
|
|
165
387
|
const fresh = await createConversation(apiBase);
|
|
@@ -169,6 +391,7 @@ export function useChatConversation(options) {
|
|
|
169
391
|
setConversationId(fresh.id);
|
|
170
392
|
setInitialMessages(toUIMessages(fresh.messages));
|
|
171
393
|
resolvedForUserRef.current = userId;
|
|
394
|
+
resolvedScopeRef.current = scope;
|
|
172
395
|
}
|
|
173
396
|
catch {
|
|
174
397
|
if (!cancelled) {
|
|
@@ -188,7 +411,7 @@ export function useChatConversation(options) {
|
|
|
188
411
|
// short-circuit guard, which is governed by the ref. Including it would
|
|
189
412
|
// re-run the effect after we successfully resolved an id.
|
|
190
413
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
191
|
-
}, [userId, scope, apiBase, activeId]);
|
|
414
|
+
}, [userId, scope, apiBase, activeId, forceNew]);
|
|
192
415
|
const reset = useCallback(async () => {
|
|
193
416
|
if (!userId)
|
|
194
417
|
return;
|
|
@@ -197,9 +420,11 @@ export function useChatConversation(options) {
|
|
|
197
420
|
try {
|
|
198
421
|
if (conversationId)
|
|
199
422
|
await deleteConversation(apiBase, conversationId);
|
|
423
|
+
writeConversationMessagesCache(conversationId, []);
|
|
200
424
|
writeCache(key, undefined);
|
|
201
425
|
const fresh = await createConversation(apiBase);
|
|
202
426
|
writeCache(key, fresh.id);
|
|
427
|
+
writeConversationMessagesCache(fresh.id, []);
|
|
203
428
|
if (!mountedRef.current)
|
|
204
429
|
return;
|
|
205
430
|
setConversationId(fresh.id);
|
|
@@ -216,5 +441,8 @@ export function useChatConversation(options) {
|
|
|
216
441
|
setIsLoading(false);
|
|
217
442
|
}
|
|
218
443
|
}, [conversationId, userId, scope, apiBase]);
|
|
219
|
-
|
|
444
|
+
// `resolvedScopeRef` is updated in lockstep with every `setConversationId`
|
|
445
|
+
// (same async tick), so at render time it always describes the scope the
|
|
446
|
+
// current `conversationId` was resolved under.
|
|
447
|
+
return { conversationId, conversationScope: resolvedScopeRef.current, initialMessages, isLoading, reset };
|
|
220
448
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useConsoleActionRuntime — the reusable console "action runtime".
|
|
3
|
+
*
|
|
4
|
+
* ObjectView historically owned all the wiring needed to make schema-driven
|
|
5
|
+
* `action:button`s actually *do* something: confirm/param/result dialogs, an
|
|
6
|
+
* authenticated API caller, flow + server-action handlers, SPA navigation, and
|
|
7
|
+
* the paused screen-flow runner. SDUI pages (PageView) render the same
|
|
8
|
+
* `action:button` widgets but lacked that runtime, so their actions could not
|
|
9
|
+
* collect params, call authenticated APIs, show result dialogs, refresh, or
|
|
10
|
+
* navigate (#1605).
|
|
11
|
+
*
|
|
12
|
+
* This hook extracts that generic wiring so BOTH ObjectView and PageView can
|
|
13
|
+
* mount it. It owns the dialog state and handlers, and returns:
|
|
14
|
+
* - `actionProviderProps` — spread onto `<ActionProvider>`;
|
|
15
|
+
* - `dialogs` — the confirm/param/result/flow dialogs to render inside it;
|
|
16
|
+
* - the individual handlers (e.g. `confirmHandler`, `toastHandler`) so a
|
|
17
|
+
* caller like ObjectView can also feed them into `useObjectActions`.
|
|
18
|
+
*
|
|
19
|
+
* `objectName` is optional: pages run global (or action-scoped) actions, while
|
|
20
|
+
* ObjectView passes its current object so object-scoped actions resolve their
|
|
21
|
+
* target + param defaults.
|
|
22
|
+
*/
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { createAuthenticatedFetch } from '@object-ui/auth';
|
|
25
|
+
import type { ActionContext, ActionDef, ActionResult, ConfirmationHandler, NavigationHandler, ParamCollectionHandler, ResultDialogHandler, ToastHandler } from '@object-ui/core';
|
|
26
|
+
export interface ConsoleActionRuntimeOptions {
|
|
27
|
+
/** Adapter for generic CRUD / execute calls. */
|
|
28
|
+
dataSource: any;
|
|
29
|
+
/** All object definitions — used to resolve param defaults from row/object. */
|
|
30
|
+
objects?: any[];
|
|
31
|
+
/** Current object name (ObjectView). Omit for pages running global actions. */
|
|
32
|
+
objectName?: string;
|
|
33
|
+
/** Invoked after a successful action that requests a refresh (`refreshAfter`
|
|
34
|
+
* !== false) — bump a refresh key to re-fetch embedded data. */
|
|
35
|
+
onRefresh?: () => void;
|
|
36
|
+
}
|
|
37
|
+
export interface ConsoleActionRuntime {
|
|
38
|
+
confirmHandler: ConfirmationHandler;
|
|
39
|
+
toastHandler: ToastHandler;
|
|
40
|
+
navigateHandler: NavigationHandler;
|
|
41
|
+
paramCollectionHandler: ParamCollectionHandler;
|
|
42
|
+
resultDialogHandler: ResultDialogHandler;
|
|
43
|
+
apiHandler: (action: ActionDef) => Promise<ActionResult>;
|
|
44
|
+
flowHandler: (action: ActionDef, context?: ActionContext) => Promise<ActionResult>;
|
|
45
|
+
serverActionHandler: (action: ActionDef, context?: ActionContext) => Promise<ActionResult>;
|
|
46
|
+
/** Authenticated fetch wrapper (Bearer + tenant + cookies). */
|
|
47
|
+
authFetch: ReturnType<typeof createAuthenticatedFetch>;
|
|
48
|
+
/** Props to spread onto `<ActionProvider>`. */
|
|
49
|
+
actionProviderProps: {
|
|
50
|
+
context: Record<string, any>;
|
|
51
|
+
onConfirm: ConfirmationHandler;
|
|
52
|
+
onToast: ToastHandler;
|
|
53
|
+
onNavigate: NavigationHandler;
|
|
54
|
+
onParamCollection: ParamCollectionHandler;
|
|
55
|
+
onResultDialog: ResultDialogHandler;
|
|
56
|
+
handlers: Record<string, (action: ActionDef) => Promise<ActionResult>>;
|
|
57
|
+
};
|
|
58
|
+
/** Confirm / param / result / paused-flow dialogs — render inside the provider. */
|
|
59
|
+
dialogs: React.ReactNode;
|
|
60
|
+
}
|
|
61
|
+
export declare function useConsoleActionRuntime(opts: ConsoleActionRuntimeOptions): ConsoleActionRuntime;
|
|
62
|
+
/**
|
|
63
|
+
* ConsoleActionRuntimeProvider — convenience wrapper for callers (e.g. PageView)
|
|
64
|
+
* that only need to wrap a subtree in the console action runtime. ObjectView
|
|
65
|
+
* uses {@link useConsoleActionRuntime} directly because it also feeds the
|
|
66
|
+
* handlers into `useObjectActions`.
|
|
67
|
+
*/
|
|
68
|
+
export declare function ConsoleActionRuntimeProvider({ children, ...opts }: ConsoleActionRuntimeOptions & {
|
|
69
|
+
children: React.ReactNode;
|
|
70
|
+
}): React.JSX.Element;
|