@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
|
@@ -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,258 @@ 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));
|
|
188
|
+
}
|
|
189
|
+
if (content &&
|
|
190
|
+
typeof content === 'object' &&
|
|
191
|
+
'parts' in content &&
|
|
192
|
+
Array.isArray(content.parts)) {
|
|
193
|
+
return contentToParts(content.parts);
|
|
194
|
+
}
|
|
195
|
+
return [];
|
|
196
|
+
}
|
|
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;
|
|
51
224
|
}
|
|
52
|
-
return '';
|
|
53
225
|
}
|
|
54
|
-
function toUIMessages(rows) {
|
|
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
|
-
|
|
270
|
+
function safeParseArray(value) {
|
|
271
|
+
if (typeof value !== 'string' || !value)
|
|
272
|
+
return undefined;
|
|
273
|
+
try {
|
|
274
|
+
const parsed = JSON.parse(value);
|
|
275
|
+
return Array.isArray(parsed) ? parsed : undefined;
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
return undefined;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Reconstruct the ModelMessage-shaped `content` that {@link toUIMessages}
|
|
283
|
+
* expects from the FLAT columns the public share endpoint returns raw.
|
|
284
|
+
*
|
|
285
|
+
* The authenticated path gets this reconstruction server-side
|
|
286
|
+
* (`ObjqlConversationService.toMessage`): an assistant turn's tool CALLS live
|
|
287
|
+
* in the separate `tool_calls` column, and a `tool` row's RESULTS are a
|
|
288
|
+
* JSON-stringified array in `content`. The share endpoint skips that step and
|
|
289
|
+
* dumps the rows verbatim — so the shared transcript previously rendered the
|
|
290
|
+
* raw `{"type":"tool-result",…}` envelope as text instead of a card. Mirroring
|
|
291
|
+
* `toMessage` here lets the share page reuse the exact same hydrate → render
|
|
292
|
+
* pipeline as the live chat. Keep this in lockstep with `toMessage`.
|
|
293
|
+
*/
|
|
294
|
+
export function aiMessageRowsToServerMessages(rows) {
|
|
295
|
+
if (!rows)
|
|
296
|
+
return [];
|
|
297
|
+
return rows.map((row) => {
|
|
298
|
+
const id = row.id;
|
|
299
|
+
const text = typeof row.content === 'string' ? row.content : '';
|
|
300
|
+
if (row.role === 'assistant') {
|
|
301
|
+
const toolCalls = safeParseArray(row.tool_calls);
|
|
302
|
+
if (toolCalls && toolCalls.length > 0) {
|
|
303
|
+
const content = [];
|
|
304
|
+
if (text)
|
|
305
|
+
content.push({ type: 'text', text });
|
|
306
|
+
content.push(...toolCalls);
|
|
307
|
+
return { id, role: 'assistant', content };
|
|
308
|
+
}
|
|
309
|
+
return { id, role: 'assistant', content: text };
|
|
310
|
+
}
|
|
311
|
+
if (row.role === 'tool') {
|
|
312
|
+
const results = safeParseArray(row.content);
|
|
313
|
+
if (results && results.length > 0 && results[0]?.type === 'tool-result') {
|
|
314
|
+
return { id, role: 'tool', content: results };
|
|
315
|
+
}
|
|
316
|
+
// Back-compat: pre-array tool rows persisted a plain string.
|
|
317
|
+
return {
|
|
318
|
+
id,
|
|
319
|
+
role: 'tool',
|
|
320
|
+
content: [
|
|
321
|
+
{
|
|
322
|
+
type: 'tool-result',
|
|
323
|
+
toolCallId: row.tool_call_id ?? '',
|
|
324
|
+
toolName: 'unknown',
|
|
325
|
+
output: { type: 'text', value: text },
|
|
326
|
+
},
|
|
327
|
+
],
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
return { id, role: row.role, content: text };
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
export async function fetchConversation(apiBase, id) {
|
|
74
334
|
const res = await fetch(`${apiBase}/conversations/${encodeURIComponent(id)}`, {
|
|
75
335
|
credentials: 'include',
|
|
76
336
|
});
|
|
@@ -100,15 +360,18 @@ async function deleteConversation(apiBase, id) {
|
|
|
100
360
|
});
|
|
101
361
|
}
|
|
102
362
|
export function useChatConversation(options) {
|
|
103
|
-
const { userId, scope, apiBase, activeId } = options;
|
|
363
|
+
const { userId, scope, apiBase, activeId, forceNew } = options;
|
|
104
364
|
const [conversationId, setConversationId] = useState(undefined);
|
|
105
365
|
const [initialMessages, setInitialMessages] = useState([]);
|
|
106
366
|
const [isLoading, setIsLoading] = useState(Boolean(userId));
|
|
107
367
|
const mountedRef = useRef(true);
|
|
108
|
-
// Tracks
|
|
109
|
-
//
|
|
110
|
-
//
|
|
368
|
+
// Tracks the (user, scope) we have already resolved a no-activeId
|
|
369
|
+
// conversation for. Keyed by SCOPE as well as user so a deliberate agent
|
|
370
|
+
// switch (the `/ai/:agent` launcher changes `scope`) re-resolves under the
|
|
371
|
+
// new agent's cache instead of clinging to the previous agent's conversation,
|
|
372
|
+
// while a no-op re-render under the same scope still short-circuits.
|
|
111
373
|
const resolvedForUserRef = useRef(undefined);
|
|
374
|
+
const resolvedScopeRef = useRef(undefined);
|
|
112
375
|
useEffect(() => {
|
|
113
376
|
mountedRef.current = true;
|
|
114
377
|
return () => {
|
|
@@ -121,15 +384,31 @@ export function useChatConversation(options) {
|
|
|
121
384
|
setInitialMessages([]);
|
|
122
385
|
setIsLoading(false);
|
|
123
386
|
resolvedForUserRef.current = undefined;
|
|
387
|
+
resolvedScopeRef.current = undefined;
|
|
124
388
|
return;
|
|
125
389
|
}
|
|
126
|
-
// Already resolved a conversation for this user during the
|
|
127
|
-
// window — don't re-create just because
|
|
128
|
-
|
|
390
|
+
// Already resolved a conversation for this (user, scope) during the
|
|
391
|
+
// no-activeId window — don't re-create just because an unrelated dep
|
|
392
|
+
// changed. A `forceNew` intent or a scope (agent) change overrides it.
|
|
393
|
+
const scopeChanged = resolvedScopeRef.current !== scope;
|
|
394
|
+
if (!activeId &&
|
|
395
|
+
!forceNew &&
|
|
396
|
+
!scopeChanged &&
|
|
397
|
+
resolvedForUserRef.current === userId &&
|
|
398
|
+
conversationId) {
|
|
129
399
|
return;
|
|
130
400
|
}
|
|
131
401
|
let cancelled = false;
|
|
132
402
|
const key = cacheKey(userId, scope);
|
|
403
|
+
// Drop the previous id NOW, before the async resolve, for both an explicit
|
|
404
|
+
// new-conversation intent AND an agent switch: the host page mirrors
|
|
405
|
+
// `conversationId` into the URL the moment `activeId` is empty, so a stale
|
|
406
|
+
// id left in state would be written onto the new agent's URL (`/ai/:agent`)
|
|
407
|
+
// and then resumed as that agent's conversation.
|
|
408
|
+
if (!activeId && (forceNew || (scopeChanged && resolvedForUserRef.current === userId))) {
|
|
409
|
+
setConversationId(undefined);
|
|
410
|
+
setInitialMessages([]);
|
|
411
|
+
}
|
|
133
412
|
setIsLoading(true);
|
|
134
413
|
(async () => {
|
|
135
414
|
try {
|
|
@@ -140,14 +419,17 @@ export function useChatConversation(options) {
|
|
|
140
419
|
if (existing) {
|
|
141
420
|
writeCache(key, existing.id);
|
|
142
421
|
setConversationId(existing.id);
|
|
143
|
-
|
|
422
|
+
const messages = toUIMessages(existing.messages);
|
|
423
|
+
setInitialMessages(messages.length > 0 ? messages : readMessageCache(existing.id));
|
|
144
424
|
resolvedForUserRef.current = userId;
|
|
425
|
+
resolvedScopeRef.current = scope;
|
|
145
426
|
return;
|
|
146
427
|
}
|
|
147
428
|
// Requested id is gone — fall through to create a fresh one.
|
|
148
429
|
writeCache(key, undefined);
|
|
430
|
+
writeConversationMessagesCache(activeId, []);
|
|
149
431
|
}
|
|
150
|
-
else {
|
|
432
|
+
else if (!forceNew) {
|
|
151
433
|
const cached = readCache(key);
|
|
152
434
|
if (cached) {
|
|
153
435
|
const existing = await fetchConversation(apiBase, cached);
|
|
@@ -155,11 +437,14 @@ export function useChatConversation(options) {
|
|
|
155
437
|
return;
|
|
156
438
|
if (existing) {
|
|
157
439
|
setConversationId(existing.id);
|
|
158
|
-
|
|
440
|
+
const messages = toUIMessages(existing.messages);
|
|
441
|
+
setInitialMessages(messages.length > 0 ? messages : readMessageCache(existing.id));
|
|
159
442
|
resolvedForUserRef.current = userId;
|
|
443
|
+
resolvedScopeRef.current = scope;
|
|
160
444
|
return;
|
|
161
445
|
}
|
|
162
446
|
writeCache(key, undefined);
|
|
447
|
+
writeConversationMessagesCache(cached, []);
|
|
163
448
|
}
|
|
164
449
|
}
|
|
165
450
|
const fresh = await createConversation(apiBase);
|
|
@@ -169,6 +454,7 @@ export function useChatConversation(options) {
|
|
|
169
454
|
setConversationId(fresh.id);
|
|
170
455
|
setInitialMessages(toUIMessages(fresh.messages));
|
|
171
456
|
resolvedForUserRef.current = userId;
|
|
457
|
+
resolvedScopeRef.current = scope;
|
|
172
458
|
}
|
|
173
459
|
catch {
|
|
174
460
|
if (!cancelled) {
|
|
@@ -188,7 +474,7 @@ export function useChatConversation(options) {
|
|
|
188
474
|
// short-circuit guard, which is governed by the ref. Including it would
|
|
189
475
|
// re-run the effect after we successfully resolved an id.
|
|
190
476
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
191
|
-
}, [userId, scope, apiBase, activeId]);
|
|
477
|
+
}, [userId, scope, apiBase, activeId, forceNew]);
|
|
192
478
|
const reset = useCallback(async () => {
|
|
193
479
|
if (!userId)
|
|
194
480
|
return;
|
|
@@ -197,9 +483,11 @@ export function useChatConversation(options) {
|
|
|
197
483
|
try {
|
|
198
484
|
if (conversationId)
|
|
199
485
|
await deleteConversation(apiBase, conversationId);
|
|
486
|
+
writeConversationMessagesCache(conversationId, []);
|
|
200
487
|
writeCache(key, undefined);
|
|
201
488
|
const fresh = await createConversation(apiBase);
|
|
202
489
|
writeCache(key, fresh.id);
|
|
490
|
+
writeConversationMessagesCache(fresh.id, []);
|
|
203
491
|
if (!mountedRef.current)
|
|
204
492
|
return;
|
|
205
493
|
setConversationId(fresh.id);
|
|
@@ -216,5 +504,8 @@ export function useChatConversation(options) {
|
|
|
216
504
|
setIsLoading(false);
|
|
217
505
|
}
|
|
218
506
|
}, [conversationId, userId, scope, apiBase]);
|
|
219
|
-
|
|
507
|
+
// `resolvedScopeRef` is updated in lockstep with every `setConversationId`
|
|
508
|
+
// (same async tick), so at render time it always describes the scope the
|
|
509
|
+
// current `conversationId` was resolved under.
|
|
510
|
+
return { conversationId, conversationScope: resolvedScopeRef.current, initialMessages, isLoading, reset };
|
|
220
511
|
}
|
|
@@ -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;
|