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