@vertesia/ui 1.5.0-dev.20260714.072725Z → 1.5.0-dev.20260722.120446Z

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 (393) hide show
  1. package/lib/core/components/SidePanel.js +1 -1
  2. package/lib/core/components/SidePanel.js.map +1 -1
  3. package/lib/core/components/shadcn/button.d.ts +10 -3
  4. package/lib/core/components/shadcn/button.d.ts.map +1 -1
  5. package/lib/core/components/shadcn/button.js +41 -9
  6. package/lib/core/components/shadcn/button.js.map +1 -1
  7. package/lib/core/components/shadcn/modal/dialog.js +1 -1
  8. package/lib/core/components/shadcn/modal/dialog.js.map +1 -1
  9. package/lib/core/components/shadcn/theme/ThemeSwitcher.js +1 -1
  10. package/lib/core/components/shadcn/theme/ThemeSwitcher.js.map +1 -1
  11. package/lib/env/index.d.ts +19 -0
  12. package/lib/env/index.d.ts.map +1 -1
  13. package/lib/env/index.js +6 -0
  14. package/lib/env/index.js.map +1 -1
  15. package/lib/features/agent/chat/AgentChatPlaybackControls.d.ts.map +1 -1
  16. package/lib/features/agent/chat/AgentChatPlaybackControls.js +2 -2
  17. package/lib/features/agent/chat/AgentChatPlaybackControls.js.map +1 -1
  18. package/lib/features/agent/chat/AgentRequestInputOverlay.d.ts.map +1 -1
  19. package/lib/features/agent/chat/AgentRequestInputOverlay.js +2 -2
  20. package/lib/features/agent/chat/AgentRequestInputOverlay.js.map +1 -1
  21. package/lib/features/agent/chat/ArtifactsTab.d.ts.map +1 -1
  22. package/lib/features/agent/chat/ArtifactsTab.js +68 -11
  23. package/lib/features/agent/chat/ArtifactsTab.js.map +1 -1
  24. package/lib/features/agent/chat/ImageLightbox.d.ts.map +1 -1
  25. package/lib/features/agent/chat/ImageLightbox.js +1 -1
  26. package/lib/features/agent/chat/ImageLightbox.js.map +1 -1
  27. package/lib/features/agent/chat/ModernAgentConversation.js +52 -49
  28. package/lib/features/agent/chat/ModernAgentConversation.js.map +1 -1
  29. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
  30. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +5 -5
  31. package/lib/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
  32. package/lib/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
  33. package/lib/features/agent/chat/ModernAgentOutput/Header.js +4 -2
  34. package/lib/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
  35. package/lib/features/agent/chat/ModernAgentOutput/MessageInput.d.ts.map +1 -1
  36. package/lib/features/agent/chat/ModernAgentOutput/MessageInput.js +2 -2
  37. package/lib/features/agent/chat/ModernAgentOutput/MessageInput.js.map +1 -1
  38. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
  39. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js +2 -1
  40. package/lib/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
  41. package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.d.ts +6 -0
  42. package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.d.ts.map +1 -1
  43. package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.js +15 -1
  44. package/lib/features/agent/chat/ModernAgentOutput/requestInputMessages.js.map +1 -1
  45. package/lib/features/agent/chat/hooks/useArtifacts.d.ts +8 -1
  46. package/lib/features/agent/chat/hooks/useArtifacts.d.ts.map +1 -1
  47. package/lib/features/agent/chat/hooks/useArtifacts.js +28 -10
  48. package/lib/features/agent/chat/hooks/useArtifacts.js.map +1 -1
  49. package/lib/features/document-viewer/UniversalDocumentViewer.d.ts +73 -0
  50. package/lib/features/document-viewer/UniversalDocumentViewer.d.ts.map +1 -0
  51. package/lib/features/document-viewer/UniversalDocumentViewer.js +415 -0
  52. package/lib/features/document-viewer/UniversalDocumentViewer.js.map +1 -0
  53. package/lib/features/document-viewer/index.d.ts +2 -0
  54. package/lib/features/document-viewer/index.d.ts.map +1 -0
  55. package/lib/features/document-viewer/index.js +2 -0
  56. package/lib/features/document-viewer/index.js.map +1 -0
  57. package/lib/features/environment/SelectEnvironment.d.ts +28 -0
  58. package/lib/features/environment/SelectEnvironment.d.ts.map +1 -0
  59. package/lib/features/environment/SelectEnvironment.js +97 -0
  60. package/lib/features/environment/SelectEnvironment.js.map +1 -0
  61. package/lib/features/environment/index.d.ts +2 -0
  62. package/lib/features/environment/index.d.ts.map +1 -0
  63. package/lib/features/environment/index.js +2 -0
  64. package/lib/features/environment/index.js.map +1 -0
  65. package/lib/features/index.d.ts +3 -0
  66. package/lib/features/index.d.ts.map +1 -1
  67. package/lib/features/index.js +3 -0
  68. package/lib/features/index.js.map +1 -1
  69. package/lib/features/magic-pdf/AnnotatedImageSlider.js +12 -12
  70. package/lib/features/magic-pdf/AnnotatedImageSlider.js.map +1 -1
  71. package/lib/features/magic-pdf/DownloadPopover.d.ts.map +1 -1
  72. package/lib/features/magic-pdf/DownloadPopover.js +3 -17
  73. package/lib/features/magic-pdf/DownloadPopover.js.map +1 -1
  74. package/lib/features/magic-pdf/ExtractedContentView.js +2 -6
  75. package/lib/features/magic-pdf/ExtractedContentView.js.map +1 -1
  76. package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.d.ts +25 -0
  77. package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.d.ts.map +1 -0
  78. package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.js +42 -0
  79. package/lib/features/magic-pdf/GroundedExtractionAssistantPanel.js.map +1 -0
  80. package/lib/features/magic-pdf/GroundedExtractionView.d.ts +27 -0
  81. package/lib/features/magic-pdf/GroundedExtractionView.d.ts.map +1 -0
  82. package/lib/features/magic-pdf/GroundedExtractionView.js +377 -0
  83. package/lib/features/magic-pdf/GroundedExtractionView.js.map +1 -0
  84. package/lib/features/magic-pdf/MagicPdfProvider.d.ts +0 -2
  85. package/lib/features/magic-pdf/MagicPdfProvider.d.ts.map +1 -1
  86. package/lib/features/magic-pdf/MagicPdfProvider.js +15 -42
  87. package/lib/features/magic-pdf/MagicPdfProvider.js.map +1 -1
  88. package/lib/features/magic-pdf/MagicPdfView.d.ts.map +1 -1
  89. package/lib/features/magic-pdf/MagicPdfView.js +2 -19
  90. package/lib/features/magic-pdf/MagicPdfView.js.map +1 -1
  91. package/lib/features/magic-pdf/index.d.ts +1 -0
  92. package/lib/features/magic-pdf/index.d.ts.map +1 -1
  93. package/lib/features/magic-pdf/index.js +1 -0
  94. package/lib/features/magic-pdf/index.js.map +1 -1
  95. package/lib/features/magic-pdf/types.d.ts +1 -1
  96. package/lib/features/magic-pdf/types.d.ts.map +1 -1
  97. package/lib/features/oauth/McpConnectionsButton.d.ts.map +1 -1
  98. package/lib/features/oauth/McpConnectionsButton.js +2 -2
  99. package/lib/features/oauth/McpConnectionsButton.js.map +1 -1
  100. package/lib/features/oauth/McpConnectionsDialog.d.ts.map +1 -1
  101. package/lib/features/oauth/McpConnectionsDialog.js +1 -1
  102. package/lib/features/oauth/McpConnectionsDialog.js.map +1 -1
  103. package/lib/features/oauth/RemoteMcpConnectionButton.d.ts.map +1 -1
  104. package/lib/features/oauth/RemoteMcpConnectionButton.js +1 -1
  105. package/lib/features/oauth/RemoteMcpConnectionButton.js.map +1 -1
  106. package/lib/features/pdf-viewer/PdfPageSlider.js +2 -2
  107. package/lib/features/pdf-viewer/PdfPageSlider.js.map +1 -1
  108. package/lib/features/pdf-viewer/SimplePdfViewer.d.ts.map +1 -1
  109. package/lib/features/pdf-viewer/SimplePdfViewer.js +3 -3
  110. package/lib/features/pdf-viewer/SimplePdfViewer.js.map +1 -1
  111. package/lib/features/permissions/UserPermissionsProvider.d.ts +2 -3
  112. package/lib/features/permissions/UserPermissionsProvider.d.ts.map +1 -1
  113. package/lib/features/permissions/UserPermissionsProvider.js +31 -38
  114. package/lib/features/permissions/UserPermissionsProvider.js.map +1 -1
  115. package/lib/features/store/objects/DocumentQuickFilter.d.ts.map +1 -1
  116. package/lib/features/store/objects/DocumentQuickFilter.js +5 -5
  117. package/lib/features/store/objects/DocumentQuickFilter.js.map +1 -1
  118. package/lib/features/store/objects/DocumentSearchResults.d.ts.map +1 -1
  119. package/lib/features/store/objects/DocumentSearchResults.js +2 -2
  120. package/lib/features/store/objects/DocumentSearchResults.js.map +1 -1
  121. package/lib/features/store/objects/components/ContentDispositionButton.d.ts.map +1 -1
  122. package/lib/features/store/objects/components/ContentDispositionButton.js +1 -1
  123. package/lib/features/store/objects/components/ContentDispositionButton.js.map +1 -1
  124. package/lib/features/store/objects/components/ContentOverview.d.ts.map +1 -1
  125. package/lib/features/store/objects/components/ContentOverview.js +148 -31
  126. package/lib/features/store/objects/components/ContentOverview.js.map +1 -1
  127. package/lib/features/store/objects/components/DocumentIcon.js +1 -1
  128. package/lib/features/store/objects/components/VectorSearchWidget.js +1 -1
  129. package/lib/features/store/objects/components/VectorSearchWidget.js.map +1 -1
  130. package/lib/features/store/objects/components/useContentPanelHooks.d.ts +1 -2
  131. package/lib/features/store/objects/components/useContentPanelHooks.d.ts.map +1 -1
  132. package/lib/features/store/objects/components/useContentPanelHooks.js +4 -8
  133. package/lib/features/store/objects/components/useContentPanelHooks.js.map +1 -1
  134. package/lib/features/store/objects/layout/renderers.d.ts.map +1 -1
  135. package/lib/features/store/objects/layout/renderers.js +2 -2
  136. package/lib/features/store/objects/layout/renderers.js.map +1 -1
  137. package/lib/features/store/objects/selection/SelectionActions.js +1 -1
  138. package/lib/features/store/objects/selection/SelectionActions.js.map +1 -1
  139. package/lib/features/store/types/ContentObjectTypesTable.d.ts.map +1 -1
  140. package/lib/features/store/types/ContentObjectTypesTable.js +4 -4
  141. package/lib/features/store/types/ContentObjectTypesTable.js.map +1 -1
  142. package/lib/features/store/types/IntakePolicyEditor.d.ts +15 -0
  143. package/lib/features/store/types/IntakePolicyEditor.d.ts.map +1 -0
  144. package/lib/features/store/types/IntakePolicyEditor.js +455 -0
  145. package/lib/features/store/types/IntakePolicyEditor.js.map +1 -0
  146. package/lib/features/store/types/IntakePolicyForm.d.ts +11 -0
  147. package/lib/features/store/types/IntakePolicyForm.d.ts.map +1 -0
  148. package/lib/features/store/types/IntakePolicyForm.js +91 -0
  149. package/lib/features/store/types/IntakePolicyForm.js.map +1 -0
  150. package/lib/features/store/types/SelectContentTypeModal.js +1 -1
  151. package/lib/features/store/types/SelectContentTypeModal.js.map +1 -1
  152. package/lib/features/store/types/index.d.ts +2 -0
  153. package/lib/features/store/types/index.d.ts.map +1 -1
  154. package/lib/features/store/types/index.js +2 -0
  155. package/lib/features/store/types/index.js.map +1 -1
  156. package/lib/features/store/types/intake-policy-editor.logic.d.ts +7 -0
  157. package/lib/features/store/types/intake-policy-editor.logic.d.ts.map +1 -0
  158. package/lib/features/store/types/intake-policy-editor.logic.js +60 -0
  159. package/lib/features/store/types/intake-policy-editor.logic.js.map +1 -0
  160. package/lib/features/store/types/typeCatalogCache.d.ts +5 -0
  161. package/lib/features/store/types/typeCatalogCache.d.ts.map +1 -0
  162. package/lib/features/store/types/typeCatalogCache.js +40 -0
  163. package/lib/features/store/types/typeCatalogCache.js.map +1 -0
  164. package/lib/features/user/UserInfo.js +7 -3
  165. package/lib/features/user/UserInfo.js.map +1 -1
  166. package/lib/features/views/ViewExperience.d.ts +20 -0
  167. package/lib/features/views/ViewExperience.d.ts.map +1 -0
  168. package/lib/features/views/ViewExperience.js +188 -0
  169. package/lib/features/views/ViewExperience.js.map +1 -0
  170. package/lib/features/views/ViewNavigation.d.ts +3 -0
  171. package/lib/features/views/ViewNavigation.d.ts.map +1 -0
  172. package/lib/features/views/ViewNavigation.js +36 -0
  173. package/lib/features/views/ViewNavigation.js.map +1 -0
  174. package/lib/features/views/ViewResults.d.ts +9 -0
  175. package/lib/features/views/ViewResults.d.ts.map +1 -0
  176. package/lib/features/views/ViewResults.js +229 -0
  177. package/lib/features/views/ViewResults.js.map +1 -0
  178. package/lib/features/views/ViewSearch.d.ts +3 -0
  179. package/lib/features/views/ViewSearch.d.ts.map +1 -0
  180. package/lib/features/views/ViewSearch.js +74 -0
  181. package/lib/features/views/ViewSearch.js.map +1 -0
  182. package/lib/features/views/index.d.ts +7 -0
  183. package/lib/features/views/index.d.ts.map +1 -0
  184. package/lib/features/views/index.js +7 -0
  185. package/lib/features/views/index.js.map +1 -0
  186. package/lib/features/views/types.d.ts +39 -0
  187. package/lib/features/views/types.d.ts.map +1 -0
  188. package/lib/features/views/types.js +2 -0
  189. package/lib/features/views/types.js.map +1 -0
  190. package/lib/features/views/viewState.d.ts +14 -0
  191. package/lib/features/views/viewState.d.ts.map +1 -0
  192. package/lib/features/views/viewState.js +117 -0
  193. package/lib/features/views/viewState.js.map +1 -0
  194. package/lib/i18n/locales/ar.json +18 -0
  195. package/lib/i18n/locales/de.json +14 -0
  196. package/lib/i18n/locales/en.json +246 -32
  197. package/lib/i18n/locales/es.json +15 -0
  198. package/lib/i18n/locales/fr.json +15 -0
  199. package/lib/i18n/locales/it.json +15 -0
  200. package/lib/i18n/locales/ja.json +13 -0
  201. package/lib/i18n/locales/ko.json +13 -0
  202. package/lib/i18n/locales/pt.json +15 -0
  203. package/lib/i18n/locales/ru.json +16 -0
  204. package/lib/i18n/locales/tr.json +14 -0
  205. package/lib/i18n/locales/zh-TW.json +13 -0
  206. package/lib/i18n/locales/zh.json +13 -0
  207. package/lib/router/HistoryNavigator.d.ts.map +1 -1
  208. package/lib/router/HistoryNavigator.js +27 -14
  209. package/lib/router/HistoryNavigator.js.map +1 -1
  210. package/lib/router/Nav.d.ts.map +1 -1
  211. package/lib/router/Nav.js +21 -6
  212. package/lib/router/Nav.js.map +1 -1
  213. package/lib/router/Router.d.ts.map +1 -1
  214. package/lib/router/Router.js +19 -4
  215. package/lib/router/Router.js.map +1 -1
  216. package/lib/router/path.d.ts +15 -0
  217. package/lib/router/path.d.ts.map +1 -1
  218. package/lib/router/path.js +43 -0
  219. package/lib/router/path.js.map +1 -1
  220. package/lib/session/UserSession.d.ts +6 -0
  221. package/lib/session/UserSession.d.ts.map +1 -1
  222. package/lib/session/UserSession.js +36 -12
  223. package/lib/session/UserSession.js.map +1 -1
  224. package/lib/session/UserSessionProvider.d.ts.map +1 -1
  225. package/lib/session/UserSessionProvider.js +111 -49
  226. package/lib/session/UserSessionProvider.js.map +1 -1
  227. package/lib/session/auth/composable.d.ts.map +1 -1
  228. package/lib/session/auth/composable.js +52 -3
  229. package/lib/session/auth/composable.js.map +1 -1
  230. package/lib/session/auth/domainRouting.d.ts +25 -0
  231. package/lib/session/auth/domainRouting.d.ts.map +1 -1
  232. package/lib/session/auth/domainRouting.js +36 -0
  233. package/lib/session/auth/domainRouting.js.map +1 -1
  234. package/lib/shell/login/SignInRestrictedEnvStep.d.ts +1 -1
  235. package/lib/shell/login/SignInRestrictedEnvStep.js +1 -1
  236. package/lib/shell/login/SigninScreen.js +9 -1
  237. package/lib/shell/login/SigninScreen.js.map +1 -1
  238. package/lib/shell/login/productionUrl.d.ts +0 -14
  239. package/lib/shell/login/productionUrl.d.ts.map +1 -1
  240. package/lib/shell/login/productionUrl.js +14 -5
  241. package/lib/shell/login/productionUrl.js.map +1 -1
  242. package/lib/vertesia-ui-core.js +4 -4
  243. package/lib/vertesia-ui-core.js.map +1 -1
  244. package/lib/vertesia-ui-env.js +1 -1
  245. package/lib/vertesia-ui-env.js.map +1 -1
  246. package/lib/vertesia-ui-features.js +35 -28
  247. package/lib/vertesia-ui-features.js.map +1 -1
  248. package/lib/vertesia-ui-i18n.js +15 -15
  249. package/lib/vertesia-ui-i18n.js.map +1 -1
  250. package/lib/vertesia-ui-router.js +1 -1
  251. package/lib/vertesia-ui-router.js.map +1 -1
  252. package/lib/vertesia-ui-session.js +1 -1
  253. package/lib/vertesia-ui-session.js.map +1 -1
  254. package/lib/vertesia-ui-shell.js +1 -1
  255. package/lib/vertesia-ui-shell.js.map +1 -1
  256. package/lib/vertesia-ui-widgets.js +7 -7
  257. package/lib/vertesia-ui-widgets.js.map +1 -1
  258. package/lib/widgets/form/Form.js +1 -1
  259. package/lib/widgets/form/Form.js.map +1 -1
  260. package/lib/widgets/json-view/JSONSwitcher.js +1 -1
  261. package/lib/widgets/json-view/JSONSwitcher.js.map +1 -1
  262. package/lib/widgets/json-view/JSONView.js +6 -6
  263. package/lib/widgets/json-view/JSONView.js.map +1 -1
  264. package/lib/widgets/monacoEditor/MonacoEditor.d.ts.map +1 -1
  265. package/lib/widgets/monacoEditor/MonacoEditor.js +29 -0
  266. package/lib/widgets/monacoEditor/MonacoEditor.js.map +1 -1
  267. package/lib/widgets/schema-editor/ManagedSchema.d.ts +8 -0
  268. package/lib/widgets/schema-editor/ManagedSchema.d.ts.map +1 -1
  269. package/lib/widgets/schema-editor/ManagedSchema.js +16 -0
  270. package/lib/widgets/schema-editor/ManagedSchema.js.map +1 -1
  271. package/lib/widgets/schema-editor/editor/EditableSchemaProperty.d.ts +2 -0
  272. package/lib/widgets/schema-editor/editor/EditableSchemaProperty.d.ts.map +1 -1
  273. package/lib/widgets/schema-editor/editor/EditableSchemaProperty.js +1 -0
  274. package/lib/widgets/schema-editor/editor/EditableSchemaProperty.js.map +1 -1
  275. package/lib/widgets/schema-editor/editor/PropertyViewer.d.ts.map +1 -1
  276. package/lib/widgets/schema-editor/editor/PropertyViewer.js +4 -1
  277. package/lib/widgets/schema-editor/editor/PropertyViewer.js.map +1 -1
  278. package/lib/widgets/schema-editor/editor/SchemaEditor.d.ts.map +1 -1
  279. package/lib/widgets/schema-editor/editor/SchemaEditor.js +22 -11
  280. package/lib/widgets/schema-editor/editor/SchemaEditor.js.map +1 -1
  281. package/llms.txt +70 -70
  282. package/package.json +33 -32
  283. package/src/__tests__/a11y.test.tsx +73 -0
  284. package/src/core/components/SidePanel.tsx +1 -1
  285. package/src/core/components/shadcn/button.tsx +67 -12
  286. package/src/core/components/shadcn/modal/dialog.tsx +1 -1
  287. package/src/core/components/shadcn/theme/ThemeSwitcher.tsx +1 -1
  288. package/src/env/index.ts +24 -0
  289. package/src/features/agent/chat/AgentChatPlaybackControls.tsx +0 -5
  290. package/src/features/agent/chat/AgentRequestInputOverlay.test.tsx +31 -0
  291. package/src/features/agent/chat/AgentRequestInputOverlay.tsx +6 -2
  292. package/src/features/agent/chat/ArtifactsTab.tsx +165 -21
  293. package/src/features/agent/chat/ImageLightbox.tsx +0 -1
  294. package/src/features/agent/chat/ModernAgentConversation.test.tsx +48 -0
  295. package/src/features/agent/chat/ModernAgentConversation.tsx +53 -51
  296. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.test.tsx +6 -1
  297. package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +21 -15
  298. package/src/features/agent/chat/ModernAgentOutput/Header.tsx +3 -3
  299. package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +0 -2
  300. package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +4 -1
  301. package/src/features/agent/chat/ModernAgentOutput/requestInputMessages.test.ts +80 -0
  302. package/src/features/agent/chat/ModernAgentOutput/requestInputMessages.ts +21 -1
  303. package/src/features/agent/chat/hooks/useArtifacts.ts +44 -11
  304. package/src/features/document-viewer/UniversalDocumentViewer.test.tsx +123 -0
  305. package/src/features/document-viewer/UniversalDocumentViewer.tsx +746 -0
  306. package/src/features/document-viewer/index.ts +1 -0
  307. package/src/features/environment/SelectEnvironment.tsx +186 -0
  308. package/src/features/environment/index.ts +1 -0
  309. package/src/features/index.ts +3 -0
  310. package/src/features/magic-pdf/AnnotatedImageSlider.tsx +62 -66
  311. package/src/features/magic-pdf/DownloadPopover.tsx +5 -48
  312. package/src/features/magic-pdf/ExtractedContentView.tsx +2 -14
  313. package/src/features/magic-pdf/GroundedExtractionAssistantPanel.tsx +86 -0
  314. package/src/features/magic-pdf/GroundedExtractionView.test.tsx +65 -0
  315. package/src/features/magic-pdf/GroundedExtractionView.tsx +1055 -0
  316. package/src/features/magic-pdf/MagicPdfProvider.tsx +17 -47
  317. package/src/features/magic-pdf/MagicPdfView.tsx +3 -51
  318. package/src/features/magic-pdf/index.ts +1 -0
  319. package/src/features/magic-pdf/types.ts +1 -1
  320. package/src/features/oauth/McpConnectionsButton.tsx +0 -2
  321. package/src/features/oauth/McpConnectionsDialog.tsx +0 -1
  322. package/src/features/oauth/RemoteMcpConnectionButton.tsx +0 -1
  323. package/src/features/pdf-viewer/PdfPageSlider.tsx +5 -5
  324. package/src/features/pdf-viewer/SimplePdfViewer.tsx +11 -12
  325. package/src/features/permissions/UserPermissionsProvider.tsx +36 -39
  326. package/src/features/store/objects/DocumentQuickFilter.tsx +13 -15
  327. package/src/features/store/objects/DocumentSearchResults.tsx +3 -6
  328. package/src/features/store/objects/components/ContentDispositionButton.tsx +5 -1
  329. package/src/features/store/objects/components/ContentOverview.tsx +240 -67
  330. package/src/features/store/objects/components/DocumentIcon.tsx +1 -1
  331. package/src/features/store/objects/components/VectorSearchWidget.tsx +2 -2
  332. package/src/features/store/objects/components/useContentPanelHooks.ts +3 -15
  333. package/src/features/store/objects/layout/renderers.tsx +1 -2
  334. package/src/features/store/objects/selection/SelectionActions.tsx +1 -1
  335. package/src/features/store/types/ContentObjectTypesTable.tsx +12 -14
  336. package/src/features/store/types/IntakePolicyEditor.tsx +679 -0
  337. package/src/features/store/types/IntakePolicyForm.tsx +838 -0
  338. package/src/features/store/types/SelectContentTypeModal.tsx +2 -2
  339. package/src/features/store/types/index.ts +2 -0
  340. package/src/features/store/types/intake-policy-editor.logic.test.ts +109 -0
  341. package/src/features/store/types/intake-policy-editor.logic.ts +87 -0
  342. package/src/features/store/types/typeCatalogCache.ts +45 -0
  343. package/src/features/user/UserInfo.tsx +7 -7
  344. package/src/features/views/ViewExperience.test.tsx +273 -0
  345. package/src/features/views/ViewExperience.tsx +408 -0
  346. package/src/features/views/ViewNavigation.test.tsx +86 -0
  347. package/src/features/views/ViewNavigation.tsx +187 -0
  348. package/src/features/views/ViewResults.test.ts +82 -0
  349. package/src/features/views/ViewResults.tsx +609 -0
  350. package/src/features/views/ViewSearch.test.tsx +147 -0
  351. package/src/features/views/ViewSearch.tsx +205 -0
  352. package/src/features/views/index.ts +6 -0
  353. package/src/features/views/types.ts +57 -0
  354. package/src/features/views/viewState.test.ts +111 -0
  355. package/src/features/views/viewState.ts +132 -0
  356. package/src/i18n/locales/ar.json +18 -0
  357. package/src/i18n/locales/de.json +14 -0
  358. package/src/i18n/locales/en.json +965 -751
  359. package/src/i18n/locales/es.json +15 -0
  360. package/src/i18n/locales/fr.json +15 -0
  361. package/src/i18n/locales/it.json +15 -0
  362. package/src/i18n/locales/ja.json +13 -0
  363. package/src/i18n/locales/ko.json +13 -0
  364. package/src/i18n/locales/pt.json +15 -0
  365. package/src/i18n/locales/ru.json +16 -0
  366. package/src/i18n/locales/tr.json +14 -0
  367. package/src/i18n/locales/zh-TW.json +13 -0
  368. package/src/i18n/locales/zh.json +13 -0
  369. package/src/router/HistoryNavigator.test.ts +48 -0
  370. package/src/router/HistoryNavigator.ts +28 -14
  371. package/src/router/Nav.tsx +24 -8
  372. package/src/router/Router.tsx +18 -4
  373. package/src/router/path.test.ts +87 -0
  374. package/src/router/path.ts +38 -0
  375. package/src/session/UserSession.test.ts +39 -0
  376. package/src/session/UserSession.ts +37 -12
  377. package/src/session/UserSessionProvider.tsx +138 -62
  378. package/src/session/auth/composable.test.ts +111 -0
  379. package/src/session/auth/composable.ts +58 -3
  380. package/src/session/auth/domainRouting.test.ts +28 -1
  381. package/src/session/auth/domainRouting.ts +38 -0
  382. package/src/shell/login/SignInRestrictedEnvStep.tsx +1 -1
  383. package/src/shell/login/SigninScreen.tsx +9 -1
  384. package/src/shell/login/productionUrl.test.ts +8 -5
  385. package/src/shell/login/productionUrl.ts +15 -5
  386. package/src/widgets/form/Form.tsx +1 -1
  387. package/src/widgets/json-view/JSONSwitcher.tsx +2 -2
  388. package/src/widgets/json-view/JSONView.tsx +7 -7
  389. package/src/widgets/monacoEditor/MonacoEditor.tsx +29 -0
  390. package/src/widgets/schema-editor/ManagedSchema.ts +22 -0
  391. package/src/widgets/schema-editor/editor/EditableSchemaProperty.tsx +3 -0
  392. package/src/widgets/schema-editor/editor/PropertyViewer.tsx +14 -3
  393. package/src/widgets/schema-editor/editor/SchemaEditor.tsx +80 -29
@@ -0,0 +1,455 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { ContentTypeIntakePolicySchema } from '@vertesia/common';
3
+ import { Badge, Button, Dropdown, errorMessage, MenuGroup, MenuItem, Panel, Tabs, TabsBar, TabsPanel, useTheme, useToast, } from '@vertesia/ui/core';
4
+ import { useUITranslation } from '@vertesia/ui/i18n';
5
+ import { useUserSession } from '@vertesia/ui/session';
6
+ import { MonacoEditor } from '@vertesia/ui/widgets';
7
+ import Ajv from 'ajv';
8
+ import addFormats from 'ajv-formats';
9
+ import { Braces, CheckCircle2, FileText, RotateCcw, Save, WandSparkles } from 'lucide-react';
10
+ import { useMemo, useRef, useState } from 'react';
11
+ import { IntakePolicyForm } from './IntakePolicyForm.js';
12
+ const INTAKE_EXAMPLES = [
13
+ {
14
+ key: 'minimal',
15
+ value: {
16
+ identification: {
17
+ guidance: 'Documents that match this content type.',
18
+ distinguish_from: 'Do not select this type for unrelated documents.',
19
+ },
20
+ },
21
+ },
22
+ {
23
+ key: 'extraction_only',
24
+ value: {
25
+ text_conversion: {
26
+ enabled: false,
27
+ },
28
+ extraction: {
29
+ enabled: true,
30
+ source: 'vision',
31
+ instructions: 'Extract required fields only. Ignore cover pages, appendices, legal boilerplate, and marketing content.',
32
+ },
33
+ rendering_template: '# {{properties.title}}\n\n{{properties.summary}}',
34
+ embeddings: {
35
+ text: true,
36
+ properties: true,
37
+ },
38
+ default_view: 'pdf',
39
+ },
40
+ },
41
+ {
42
+ key: 'grounded',
43
+ value: {
44
+ extraction: {
45
+ enabled: true,
46
+ grounding: {
47
+ enabled: true,
48
+ use_vision: true,
49
+ // Easy tier: Gemini Flash for clean digital / light scans.
50
+ config: {
51
+ model: 'publishers/google/models/gemini-3.5-flash',
52
+ model_options: {
53
+ _option_id: 'vertexai-gemini',
54
+ max_tokens: 32000,
55
+ thinking_level: 'LOW',
56
+ temperature: 0,
57
+ },
58
+ },
59
+ // Hard tier: Gemini Pro when hardness escalates (handwriting, degraded OCR).
60
+ hard_config: {
61
+ model: 'publishers/google/models/gemini-3.1-pro-preview',
62
+ model_options: {
63
+ _option_id: 'vertexai-gemini',
64
+ max_tokens: 32000,
65
+ thinking_level: 'LOW',
66
+ temperature: 0,
67
+ },
68
+ },
69
+ hardness_threshold: 0.5,
70
+ min_citation_density: 0.3,
71
+ window_pages: 3,
72
+ review: {
73
+ enabled: true,
74
+ // Flash + MEDIUM thinking: strong review quality at flash cost.
75
+ config: {
76
+ model: 'publishers/google/models/gemini-3.5-flash',
77
+ model_options: {
78
+ _option_id: 'vertexai-gemini',
79
+ thinking_level: 'MEDIUM',
80
+ max_tokens: 32000,
81
+ temperature: 0,
82
+ },
83
+ },
84
+ coverage_threshold: 0.2,
85
+ },
86
+ },
87
+ },
88
+ default_view: 'pdf',
89
+ },
90
+ },
91
+ {
92
+ key: 'visual_first',
93
+ value: {
94
+ identification: {
95
+ guidance: 'Presentation decks or visual reports with slides, charts, diagrams, tables, or callouts.',
96
+ },
97
+ text_conversion: {
98
+ enabled: true,
99
+ method: 'auto',
100
+ },
101
+ extraction: {
102
+ enabled: true,
103
+ source: 'auto',
104
+ instructions: 'Use visual evidence when layout, charts, diagrams, or slide structure contain material information.',
105
+ },
106
+ default_view: 'pdf',
107
+ },
108
+ },
109
+ {
110
+ key: 'structured_spreadsheet',
111
+ value: {
112
+ text_conversion: {
113
+ enabled: true,
114
+ method: 'auto',
115
+ instructions: 'Preserve sheet names, headers, row labels, totals, and period columns.',
116
+ },
117
+ extraction: {
118
+ enabled: true,
119
+ source: 'text',
120
+ instructions: 'Extract values from worksheet text. Do not infer values from charts.',
121
+ },
122
+ default_view: 'properties',
123
+ },
124
+ },
125
+ {
126
+ key: 'media_no_transcript',
127
+ value: {
128
+ text_conversion: {
129
+ enabled: false,
130
+ },
131
+ extraction: {
132
+ enabled: true,
133
+ source: 'auto',
134
+ instructions: 'Analyze available metadata and source evidence without creating a transcript.',
135
+ },
136
+ default_view: 'properties',
137
+ },
138
+ },
139
+ {
140
+ key: 'full_reference',
141
+ value: {
142
+ mode: 'programmatic',
143
+ identification: {
144
+ guidance: 'Supplier invoices: billing documents with an invoice number, line items, ' +
145
+ 'amounts due, tax breakdown, and payment terms.',
146
+ distinguish_from: 'Quotes and estimates are offers, not payment requests. Credit notes carry ' +
147
+ 'negative amounts. Receipts confirm a payment already made.',
148
+ examples: [],
149
+ },
150
+ text_conversion: {
151
+ enabled: true,
152
+ method: 'auto',
153
+ instructions: 'Keep the commercial terms and totals. Drop boilerplate and legal footers.',
154
+ output_format: 'markdown',
155
+ custom: {
156
+ interaction: 'my-project:ConvertSpecialDocument',
157
+ agent: 'my-project:DocumentConversionAgent',
158
+ },
159
+ },
160
+ extraction: {
161
+ enabled: true,
162
+ source: 'auto',
163
+ instructions: 'Extract totals from the summary block, not from line items. ' +
164
+ 'Amounts include currency. Dates use ISO 8601.',
165
+ interaction: 'sys:ExtractInformation',
166
+ verification: {
167
+ enabled: false,
168
+ model: 'publishers/anthropic/models/claude-sonnet',
169
+ environment: 'default',
170
+ materiality: 'Amounts, dates, identifiers, and party names are material. Typos in free text are not.',
171
+ threshold: 0.85,
172
+ max_retries: 1,
173
+ on_fail: 'flag',
174
+ },
175
+ grounding: {
176
+ enabled: true,
177
+ interaction: 'sys:ExtractInformationGrounded',
178
+ max_pages: 20,
179
+ force_ocr: false,
180
+ use_vision: true,
181
+ omit_block_boxes: false,
182
+ // Easy / hard extraction models
183
+ config: {
184
+ model: 'publishers/google/models/gemini-3.5-flash',
185
+ },
186
+ hard_config: {
187
+ model: 'publishers/google/models/gemini-3.1-pro-preview',
188
+ },
189
+ hardness_threshold: 0.5,
190
+ window_pages: 3,
191
+ update_properties: true,
192
+ min_citation_density: 0.3,
193
+ refresh_ocr: false,
194
+ review: {
195
+ enabled: true,
196
+ config: {
197
+ model: 'publishers/google/models/gemini-3.5-flash',
198
+ },
199
+ coverage_threshold: 0.2,
200
+ },
201
+ },
202
+ },
203
+ rendering_template: '# Invoice {{properties.invoice_number}}\n\n' +
204
+ '- Vendor: {{properties.vendor_name}}\n' +
205
+ '- Total: {{properties.currency}} {{properties.total_amount}}\n' +
206
+ '- Due: {{properties.due_date}}',
207
+ embeddings: {
208
+ text: true,
209
+ image: false,
210
+ properties: true,
211
+ },
212
+ generate_toc: false,
213
+ default_view: 'auto',
214
+ },
215
+ },
216
+ ];
217
+ const EMPTY_POLICY = {};
218
+ export function IntakePolicyEditor({ objectType, value, onSave: onSaveProp, onIntakeUpdate, readonly = false, }) {
219
+ const { store } = useUserSession();
220
+ const { t } = useUITranslation();
221
+ const toast = useToast();
222
+ const { theme } = useTheme();
223
+ const editorRef = useRef(undefined);
224
+ const validatePolicy = useMemo(() => createPolicyValidator(), []);
225
+ const [isUpdating, setUpdating] = useState(false);
226
+ const initialPolicy = objectType?.intake ?? value;
227
+ const [editorValue, setEditorValue] = useState(() => stringifyPolicy(initialPolicy));
228
+ const [savedValue, setSavedValue] = useState(() => stringifyPolicy(initialPolicy));
229
+ const [validationMessage, setValidationMessage] = useState(undefined);
230
+ const [activeTab, setActiveTab] = useState('overview');
231
+ const isDirty = editorValue !== savedValue;
232
+ const currentPolicy = useMemo(() => {
233
+ const result = parseAndValidatePolicy(editorValue, validatePolicy);
234
+ return result.ok ? result.policy : undefined;
235
+ }, [editorValue, validatePolicy]);
236
+ const summaryPolicy = currentPolicy ?? initialPolicy ?? EMPTY_POLICY;
237
+ const beforeMount = (monaco) => {
238
+ const namespace = monaco;
239
+ const jsonDefaults = namespace.languages?.json?.jsonDefaults ?? namespace.json?.jsonDefaults;
240
+ // ContentTypeIntakePolicySchema (from @vertesia/common) drives autocomplete,
241
+ // hover docs, and validation. Clone so Monaco cannot mutate the shared export.
242
+ const schema = structuredClone(ContentTypeIntakePolicySchema);
243
+ jsonDefaults?.setDiagnosticsOptions({
244
+ validate: true,
245
+ allowComments: false,
246
+ schemas: [
247
+ {
248
+ uri: 'vertesia://schemas/content-type-intake-policy.json',
249
+ fileMatch: ['*'],
250
+ schema,
251
+ },
252
+ ],
253
+ });
254
+ };
255
+ const validateCurrentEditorValue = () => {
256
+ const value = activeTab === 'json' ? (editorRef.current?.getValue() ?? editorValue) : editorValue;
257
+ const result = parseAndValidatePolicy(value, validatePolicy);
258
+ if (!result.ok) {
259
+ setValidationMessage(result.message);
260
+ return undefined;
261
+ }
262
+ setValidationMessage(undefined);
263
+ return result.policy;
264
+ };
265
+ const onSave = () => {
266
+ const policy = validateCurrentEditorValue();
267
+ if (!policy) {
268
+ return;
269
+ }
270
+ const persist = onSaveProp ??
271
+ (objectType
272
+ ? (next) => store.types.update(objectType.id, { intake: next }).then((response) => response.intake)
273
+ : undefined);
274
+ if (!persist) {
275
+ return;
276
+ }
277
+ setUpdating(true);
278
+ persist(policy)
279
+ .then((saved) => {
280
+ const nextValue = stringifyPolicy(saved ?? policy);
281
+ setEditorValue(nextValue);
282
+ setSavedValue(nextValue);
283
+ onIntakeUpdate?.(saved ?? policy);
284
+ toast({
285
+ status: 'success',
286
+ title: t('intakePolicy.toast.updated'),
287
+ description: t('intakePolicy.toast.saved'),
288
+ duration: 2000,
289
+ });
290
+ })
291
+ .catch((err) => {
292
+ toast({
293
+ status: 'error',
294
+ title: t('intakePolicy.toast.updateFailed'),
295
+ description: errorMessage(err),
296
+ duration: 5000,
297
+ });
298
+ })
299
+ .finally(() => {
300
+ setUpdating(false);
301
+ });
302
+ };
303
+ const onValidate = () => {
304
+ const value = activeTab === 'json' ? (editorRef.current?.getValue() ?? editorValue) : editorValue;
305
+ const result = parseAndValidatePolicy(value, validatePolicy);
306
+ setValidationMessage(result.ok ? undefined : result.message);
307
+ toast({
308
+ status: result.ok ? 'success' : 'error',
309
+ title: result.ok ? t('intakePolicy.toast.valid') : t('intakePolicy.toast.invalid'),
310
+ description: result.ok ? t('intakePolicy.toast.schemaValid') : result.message,
311
+ duration: 3000,
312
+ });
313
+ };
314
+ const onRevert = () => {
315
+ setEditorValue(savedValue);
316
+ editorRef.current?.setValue(savedValue);
317
+ setValidationMessage(undefined);
318
+ };
319
+ const onFormat = () => {
320
+ const policy = validateCurrentEditorValue();
321
+ if (!policy) {
322
+ return;
323
+ }
324
+ const value = stringifyPolicy(policy);
325
+ setEditorValue(value);
326
+ editorRef.current?.setValue(value);
327
+ };
328
+ const insertExample = (example) => {
329
+ const value = stringifyPolicy(example.value);
330
+ setEditorValue(value);
331
+ editorRef.current?.setValue(value);
332
+ setValidationMessage(undefined);
333
+ setActiveTab('overview');
334
+ };
335
+ const onFormChange = (policy) => {
336
+ setEditorValue(stringifyPolicy(policy));
337
+ setValidationMessage(undefined);
338
+ };
339
+ const onTabChange = (tab) => {
340
+ const nextTab = tab;
341
+ if (nextTab !== 'json' && !currentPolicy) {
342
+ setValidationMessage(t('intakePolicy.error.fixJsonBeforeForm'));
343
+ setActiveTab('json');
344
+ return;
345
+ }
346
+ setActiveTab(nextTab);
347
+ };
348
+ const title = (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "text-base font-semibold", children: t('intakePolicy.title') }), isDirty && _jsx(Badge, { variant: "attention", children: t('intakePolicy.status.unsaved') })] }));
349
+ const action = !readonly ? (_jsxs(_Fragment, { children: [_jsx(Dropdown, { align: "right", trigger: _jsxs(Button, { variant: "outline", size: "sm", children: [_jsx(WandSparkles, { className: "size-4" }), t('intakePolicy.action.examples')] }), children: _jsx(MenuGroup, { label: t('intakePolicy.action.insertExample'), children: INTAKE_EXAMPLES.map((example) => (_jsxs(MenuItem, { onClick: () => insertExample(example), children: [_jsx(FileText, { className: "size-4" }), _jsxs("div", { className: "flex flex-col", children: [_jsx("span", { children: t(`intakePolicy.example.${example.key}.label`) }), _jsx("span", { className: "text-xs text-muted", children: t(`intakePolicy.example.${example.key}.description`) })] })] }, example.key))) }) }), activeTab === 'json' && (_jsxs(_Fragment, { children: [_jsxs(Button, { variant: "outline", size: "sm", onClick: onFormat, children: [_jsx(Braces, { className: "size-4" }), t('intakePolicy.action.format')] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: onValidate, children: [_jsx(CheckCircle2, { className: "size-4" }), t('intakePolicy.action.validate')] })] })), _jsxs(Button, { variant: "outline", size: "sm", onClick: onRevert, disabled: !isDirty, children: [_jsx(RotateCcw, { className: "size-4" }), t('intakePolicy.action.revert')] }), _jsxs(Button, { isLoading: isUpdating, size: "sm", onClick: onSave, disabled: !isDirty, children: [_jsx(Save, { className: "size-4" }), t('intakePolicy.action.save')] })] })) : undefined;
350
+ return (_jsx(Panel, { title: title, className: "bg-background! h-full", action: action, children: _jsxs("div", { className: "flex h-full min-h-0 flex-col gap-3", children: [_jsx(IntakeSummary, { policy: summaryPolicy }), validationMessage && (_jsx("div", { className: "rounded-sm border border-destructive bg-mixer-destructive/10 px-3 py-2 text-sm whitespace-pre-line text-destructive", children: validationMessage })), _jsxs(Tabs, { tabs: createEditorTabs(t, currentPolicy ?? EMPTY_POLICY, readonly, onFormChange, editorValue, {
351
+ editorRef,
352
+ beforeMount,
353
+ onChange: (value) => {
354
+ setEditorValue(value);
355
+ setValidationMessage(undefined);
356
+ },
357
+ theme,
358
+ }), current: activeTab, onTabChange: onTabChange, updateHash: false, responsive: true, fullHeight: true, className: "px-0", children: [_jsx(TabsBar, { sticky: true }), _jsx(TabsPanel, { className: "min-h-0 flex-1 overflow-auto pt-1" })] })] }) }));
359
+ }
360
+ function createEditorTabs(t, policy, readonly, onChange, editorValue, json) {
361
+ const formTab = (name, label) => ({
362
+ name,
363
+ label,
364
+ content: _jsx(IntakePolicyForm, { policy: policy, section: name, onChange: onChange, readonly: readonly }),
365
+ });
366
+ return [
367
+ formTab('overview', t('intakePolicy.tab.overview')),
368
+ formTab('conversion', t('intakePolicy.tab.conversion')),
369
+ formTab('extraction', t('intakePolicy.tab.extraction')),
370
+ formTab('grounding', t('intakePolicy.tab.grounding')),
371
+ formTab('output', t('intakePolicy.tab.output')),
372
+ {
373
+ name: 'json',
374
+ label: t('intakePolicy.tab.json'),
375
+ content: (_jsxs("div", { className: "flex h-full min-h-[36rem] gap-4 py-3", children: [_jsx("div", { className: "min-w-0 flex-1 overflow-hidden rounded-sm border", children: _jsx(MonacoEditor, { value: editorValue, language: "json", editorRef: json.editorRef, beforeMount: json.beforeMount, onChange: (update) => json.onChange(update.state.doc.toString()), theme: json.theme === 'dark' ? 'vs-dark' : 'vs', options: {
376
+ readOnly: readonly,
377
+ minimap: { enabled: false },
378
+ scrollBeyondLastLine: false,
379
+ wordWrap: 'on',
380
+ lineNumbers: 'on',
381
+ automaticLayout: true,
382
+ formatOnPaste: true,
383
+ formatOnType: true,
384
+ tabSize: 2,
385
+ } }) }), _jsx(IntakeHelp, {})] })),
386
+ },
387
+ ];
388
+ }
389
+ function IntakeSummary({ policy }) {
390
+ const { t } = useUITranslation();
391
+ const grounding = policy.extraction?.grounding;
392
+ const values = [
393
+ [t('intakePolicy.summary.mode'), optionLabel(t, policy.mode)],
394
+ [t('intakePolicy.summary.conversion'), enabledLabel(t, policy.text_conversion?.enabled)],
395
+ [t('intakePolicy.summary.method'), optionLabel(t, policy.text_conversion?.method)],
396
+ [t('intakePolicy.summary.source'), optionLabel(t, policy.extraction?.source)],
397
+ [t('intakePolicy.summary.extraction'), enabledLabel(t, policy.extraction?.enabled)],
398
+ [t('intakePolicy.summary.grounding'), enabledLabel(t, grounding?.enabled)],
399
+ [t('intakePolicy.summary.defaultView'), optionLabel(t, policy.default_view)],
400
+ [t('intakePolicy.summary.toc'), enabledLabel(t, policy.generate_toc)],
401
+ [
402
+ t('intakePolicy.summary.template'),
403
+ policy.rendering_template ? t('intakePolicy.option.set') : t('intakePolicy.option.inherit'),
404
+ ],
405
+ ];
406
+ return (_jsx("div", { className: "flex flex-wrap gap-2", children: values.map(([label, value]) => (_jsxs(Badge, { variant: "outline", className: "gap-1", children: [_jsxs("span", { className: "text-muted", children: [label, ":"] }), _jsx("span", { children: value })] }, label))) }));
407
+ }
408
+ function IntakeHelp() {
409
+ const { t } = useUITranslation();
410
+ return (_jsxs("aside", { className: "hidden w-80 shrink-0 overflow-y-auto rounded-sm border bg-mixer-muted/20 p-3 text-sm lg:block", children: [_jsx("div", { className: "mb-3 font-semibold", children: t('intakePolicy.help.title') }), _jsxs("div", { className: "space-y-3 text-muted", children: [_jsx(HelpItem, { label: "identification", text: t('intakePolicy.help.identification') }), _jsx(HelpItem, { label: "text_conversion", text: t('intakePolicy.help.textConversion') }), _jsx(HelpItem, { label: "extraction.source", text: t('intakePolicy.help.extractionSource') }), _jsx(HelpItem, { label: "extraction.grounding", text: t('intakePolicy.help.grounding') }), _jsx(HelpItem, { label: "extraction.grounding.review", text: t('intakePolicy.help.review') }), _jsx(HelpItem, { label: "rendering_template", text: t('intakePolicy.help.renderingTemplate') }), _jsx(HelpItem, { label: "embeddings", text: t('intakePolicy.help.embeddings') }), _jsx(HelpItem, { label: "default_view", text: t('intakePolicy.help.defaultView') })] })] }));
411
+ }
412
+ function HelpItem({ label, text }) {
413
+ return (_jsxs("div", { children: [_jsx("div", { className: "font-medium text-foreground", children: label }), _jsx("div", { children: text })] }));
414
+ }
415
+ function enabledLabel(t, value) {
416
+ if (value === true)
417
+ return t('intakePolicy.option.enabled');
418
+ if (value === false)
419
+ return t('intakePolicy.option.disabled');
420
+ return t('intakePolicy.option.inherit');
421
+ }
422
+ function optionLabel(t, value) {
423
+ return value ? t(`intakePolicy.option.${value}`) : t('intakePolicy.option.inherit');
424
+ }
425
+ function stringifyPolicy(policy) {
426
+ return JSON.stringify(policy ?? EMPTY_POLICY, null, 2);
427
+ }
428
+ function createPolicyValidator() {
429
+ const ajv = new Ajv({
430
+ strict: false,
431
+ allErrors: true,
432
+ });
433
+ addFormats(ajv);
434
+ return ajv.compile(ContentTypeIntakePolicySchema);
435
+ }
436
+ function parseAndValidatePolicy(content, validatePolicy) {
437
+ let parsed;
438
+ try {
439
+ parsed = content.trim() ? JSON.parse(content) : {};
440
+ }
441
+ catch (err) {
442
+ return { ok: false, message: `Invalid JSON: ${errorMessage(err)}` };
443
+ }
444
+ if (!validatePolicy(parsed)) {
445
+ return { ok: false, message: formatAjvErrors(validatePolicy.errors) };
446
+ }
447
+ return { ok: true, policy: parsed };
448
+ }
449
+ function formatAjvErrors(errors) {
450
+ if (!errors?.length) {
451
+ return 'The intake policy does not match the schema.';
452
+ }
453
+ return errors.map((err) => `${err.instancePath || '/'} ${err.message ?? 'is invalid'}`).join('\n');
454
+ }
455
+ //# sourceMappingURL=IntakePolicyEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntakePolicyEditor.js","sourceRoot":"","sources":["../../../../src/features/store/types/IntakePolicyEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAwD,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACvH,OAAO,EACH,KAAK,EACL,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAA+B,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,GAAgD,MAAM,KAAK,CAAC;AACnE,OAAO,UAAU,MAAM,aAAa,CAAC;AAErC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAgC,MAAM,uBAAuB,CAAC;AA4BvF,MAAM,eAAe,GAAoB;IACrC;QACI,GAAG,EAAE,SAAS;QACd,KAAK,EAAE;YACH,cAAc,EAA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AC;IACH,UAAU,CAAC,GAAG,CAAC,CAAC;IAChB,OAAO,GAAG,CAAC,OAAO,CAAC,6BAA6B,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,sBAAsB,CAC3B,OAAe,EACf,cAAyD;IAEzD,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACD,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvD,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACpB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,iBAAiB,YAAY,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;IACxE,CAAC;IAED,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1E,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAiC,EAAE,CAAC;AACnE,CAAC;AAED,SAAS,eAAe,CAAC,MAAwC;IAC7D,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,8CAA8C,CAAC;IAC1D,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,YAAY,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,IAAI,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvG,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { ContentTypeIntakePolicy } from '@vertesia/common';
2
+ export type IntakePolicyFormSection = 'overview' | 'conversion' | 'extraction' | 'grounding' | 'output';
3
+ interface IntakePolicyFormProps {
4
+ policy: ContentTypeIntakePolicy;
5
+ section: IntakePolicyFormSection;
6
+ onChange: (policy: ContentTypeIntakePolicy) => void;
7
+ readonly?: boolean;
8
+ }
9
+ export declare function IntakePolicyForm({ policy, section, onChange, readonly }: IntakePolicyFormProps): import("react").JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=IntakePolicyForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntakePolicyForm.d.ts","sourceRoot":"","sources":["../../../../src/features/store/types/IntakePolicyForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,uBAAuB,EAI1B,MAAM,kBAAkB,CAAC;AAc1B,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,YAAY,GAAG,YAAY,GAAG,WAAW,GAAG,QAAQ,CAAC;AAExG,UAAU,qBAAqB;IAC3B,MAAM,EAAE,uBAAuB,CAAC;IAChC,OAAO,EAAE,uBAAuB,CAAC;IACjC,QAAQ,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI,CAAC;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAOD,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAgB,EAAE,EAAE,qBAAqB,+BAiftG"}
@@ -0,0 +1,91 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, FormItem, Input, NumberInput, SelectBox, TagsInput, Textarea, VTooltip } from '@vertesia/ui/core';
3
+ import { useUITranslation } from '@vertesia/ui/i18n';
4
+ import { Plus, Trash2 } from 'lucide-react';
5
+ import { SelectEnvironment, SelectModel } from '../../environment/SelectEnvironment.js';
6
+ import { replaceIntakeRange, updateExecutionEnvironment, updateExecutionModel, updateIntakePolicy, } from './intake-policy-editor.logic.js';
7
+ export function IntakePolicyForm({ policy, section, onChange, readonly = false }) {
8
+ const { t } = useUITranslation();
9
+ const setValue = (path, value) => onChange(updateIntakePolicy(policy, path, value));
10
+ if (section === 'overview') {
11
+ return (_jsxs(FormSurface, { children: [_jsxs(FormSection, { title: t('intakePolicy.section.classification'), children: [_jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [_jsx(SelectField, { label: t('intakePolicy.field.mode'), description: t('intakePolicy.help.mode'), value: policy.mode, options: options(t, ['programmatic', 'agentic']), onChange: (value) => setValue(['mode'], value), readonly: readonly }), _jsx(SelectField, { label: t('intakePolicy.field.defaultView'), value: policy.default_view, options: options(t, ['auto', 'text', 'pdf', 'image', 'properties']), onChange: (value) => setValue(['default_view'], value), readonly: readonly })] }), _jsx(TextAreaField, { label: t('intakePolicy.field.identificationGuidance'), description: t('intakePolicy.help.identificationGuidance'), value: policy.identification?.guidance, onChange: (value) => setValue(['identification', 'guidance'], value), readonly: readonly }), _jsx(TextAreaField, { label: t('intakePolicy.field.distinguishFrom'), value: policy.identification?.distinguish_from, onChange: (value) => setValue(['identification', 'distinguish_from'], value), readonly: readonly }), _jsx(FormItem, { label: t('intakePolicy.field.examples'), description: t('intakePolicy.help.examples'), children: _jsx(TagsInput, { options: policy.identification?.examples ?? [], value: policy.identification?.examples ?? [], onChange: (value) => setValue(['identification', 'examples'], value.length ? value : undefined), onOptionsChange: (value) => setValue(['identification', 'examples'], value.length ? value : undefined), creatable: true, disabled: readonly, placeholder: t('intakePolicy.placeholder.objectId') }) })] }), _jsxs(FormSection, { title: t('intakePolicy.section.locate'), last: true, children: [_jsx(TextAreaField, { label: t('intakePolicy.field.locateInstructions'), description: t('intakePolicy.help.locateInstructions'), value: policy.locate?.instructions, onChange: (value) => setValue(['locate'], value ? { ...policy.locate, instructions: value } : undefined), readonly: readonly }), _jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [_jsx(SelectField, { label: t('intakePolicy.field.contactSheetDetail'), value: policy.locate?.detail, options: [
12
+ { value: 8, label: t('intakePolicy.option.pagesPerSheet', { count: 8 }) },
13
+ { value: 16, label: t('intakePolicy.option.pagesPerSheet', { count: 16 }) },
14
+ ], onChange: (value) => setValue(['locate', 'detail'], value), readonly: readonly || !policy.locate }), _jsx(NumberField, { label: t('intakePolicy.field.locateMinPages'), value: policy.locate?.min_pages, min: 0, onChange: (value) => setValue(['locate', 'min_pages'], value), readonly: readonly || !policy.locate })] })] })] }));
15
+ }
16
+ if (section === 'conversion') {
17
+ return (_jsxs(FormSurface, { children: [_jsxs(FormSection, { title: t('intakePolicy.section.conversion'), children: [_jsxs("div", { className: "grid gap-4 md:grid-cols-2 xl:grid-cols-4", children: [_jsx(TriStateField, { label: t('intakePolicy.field.enabled'), value: policy.text_conversion?.enabled, onChange: (value) => setValue(['text_conversion', 'enabled'], value), readonly: readonly }), _jsx(SelectField, { label: t('intakePolicy.field.method'), value: policy.text_conversion?.method, options: options(t, ['auto', 'basic', 'llm', 'custom']), onChange: (value) => setValue(['text_conversion', 'method'], value), readonly: readonly }), _jsx(SelectField, { label: t('intakePolicy.field.outputFormat'), value: policy.text_conversion?.output_format, options: options(t, ['markdown', 'text']), onChange: (value) => setValue(['text_conversion', 'output_format'], value), readonly: readonly }), _jsx(SelectField, { label: t('intakePolicy.field.pageScope'), value: policy.text_conversion?.scope, options: options(t, ['all', 'located']), onChange: (value) => setValue(['text_conversion', 'scope'], value), readonly: readonly })] }), _jsx(TextAreaField, { label: t('intakePolicy.field.instructions'), value: policy.text_conversion?.instructions, onChange: (value) => setValue(['text_conversion', 'instructions'], value), readonly: readonly })] }), policy.text_conversion?.method === 'custom' && (_jsx(FormSection, { title: t('intakePolicy.section.customConversion'), children: _jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [_jsx(InputField, { label: t('intakePolicy.field.interaction'), value: policy.text_conversion.custom?.interaction, onChange: (value) => setValue(['text_conversion', 'custom', 'interaction'], value), readonly: readonly }), _jsx(InputField, { label: t('intakePolicy.field.agent'), value: policy.text_conversion.custom?.agent, onChange: (value) => setValue(['text_conversion', 'custom', 'agent'], value), readonly: readonly })] }) })), _jsx(FormSection, { title: t('intakePolicy.section.pageRanges'), last: true, children: _jsx(PageRangesField, { value: policy.text_conversion?.page_ranges, onChange: (value) => setValue(['text_conversion', 'page_ranges'], value), readonly: readonly }) })] }));
18
+ }
19
+ if (section === 'extraction') {
20
+ return (_jsxs(FormSurface, { children: [_jsxs(FormSection, { title: t('intakePolicy.section.extraction'), children: [_jsxs("div", { className: "grid gap-4 md:grid-cols-2 xl:grid-cols-4", children: [_jsx(TriStateField, { label: t('intakePolicy.field.enabled'), value: policy.extraction?.enabled, onChange: (value) => setValue(['extraction', 'enabled'], value), readonly: readonly }), _jsx(SelectField, { label: t('intakePolicy.field.source'), value: policy.extraction?.source, options: options(t, ['auto', 'text', 'vision', 'mixed']), onChange: (value) => setValue(['extraction', 'source'], value), readonly: readonly }), _jsx(SelectField, { label: t('intakePolicy.field.pageScope'), value: policy.extraction?.scope, options: options(t, ['all', 'located']), onChange: (value) => setValue(['extraction', 'scope'], value), readonly: readonly }), _jsx(NumberField, { label: t('intakePolicy.field.maxPages'), value: policy.extraction?.max_pages, min: 1, onChange: (value) => setValue(['extraction', 'max_pages'], value), readonly: readonly })] }), _jsx(InputField, { label: t('intakePolicy.field.interaction'), value: policy.extraction?.interaction, onChange: (value) => setValue(['extraction', 'interaction'], value), readonly: readonly }), _jsx(TextAreaField, { label: t('intakePolicy.field.instructions'), value: policy.extraction?.instructions, onChange: (value) => setValue(['extraction', 'instructions'], value), readonly: readonly }), _jsx(PageRangesField, { value: policy.extraction?.page_ranges, onChange: (value) => setValue(['extraction', 'page_ranges'], value), readonly: readonly })] }), _jsx(FormSection, { title: t('intakePolicy.section.visionBudget'), children: _jsxs("div", { className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3", children: [_jsx(SelectField, { label: t('intakePolicy.field.defaultDetail'), value: policy.extraction?.vision?.default_detail, options: options(t, ['low', 'standard', 'high']), onChange: (value) => setValue(['extraction', 'vision', 'default_detail'], value), readonly: readonly }), _jsx(VisionDetailsField, { value: policy.extraction?.vision?.allowed_details, onChange: (value) => setValue(['extraction', 'vision', 'allowed_details'], value), readonly: readonly }), _jsx(NumberField, { label: t('intakePolicy.field.maxImageTokens'), value: policy.extraction?.vision?.max_image_tokens, min: 1, onChange: (value) => setValue(['extraction', 'vision', 'max_image_tokens'], value), readonly: readonly }), _jsx(NumberField, { label: t('intakePolicy.field.maxPayloadMb'), value: policy.extraction?.vision?.max_payload_mb, min: 1, onChange: (value) => setValue(['extraction', 'vision', 'max_payload_mb'], value), readonly: readonly }), _jsx(NumberField, { label: t('intakePolicy.field.maxPagesPerCall'), value: policy.extraction?.vision?.max_pages_per_call, min: 1, onChange: (value) => setValue(['extraction', 'vision', 'max_pages_per_call'], value), readonly: readonly })] }) }), _jsxs(FormSection, { title: t('intakePolicy.section.verification'), last: true, children: [_jsxs("div", { className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3", children: [_jsx(TriStateField, { label: t('intakePolicy.field.enabled'), value: policy.extraction?.verification?.enabled, onChange: (value) => setValue(['extraction', 'verification', 'enabled'], value), readonly: readonly }), _jsx(InputField, { label: t('intakePolicy.field.model'), value: policy.extraction?.verification?.model, onChange: (value) => setValue(['extraction', 'verification', 'model'], value), readonly: readonly }), _jsx(InputField, { label: t('intakePolicy.field.environment'), value: policy.extraction?.verification?.environment, onChange: (value) => setValue(['extraction', 'verification', 'environment'], value), readonly: readonly }), _jsx(NumberField, { label: t('intakePolicy.field.threshold'), value: policy.extraction?.verification?.threshold, min: 0, max: 1, step: 0.05, onChange: (value) => setValue(['extraction', 'verification', 'threshold'], value), readonly: readonly }), _jsx(NumberField, { label: t('intakePolicy.field.maxRetries'), value: policy.extraction?.verification?.max_retries, min: 0, onChange: (value) => setValue(['extraction', 'verification', 'max_retries'], value), readonly: readonly }), _jsx(SelectField, { label: t('intakePolicy.field.onFailure'), value: policy.extraction?.verification?.on_fail, options: options(t, ['flag', 'block']), onChange: (value) => setValue(['extraction', 'verification', 'on_fail'], value), readonly: readonly })] }), _jsx(TextAreaField, { label: t('intakePolicy.field.materiality'), value: policy.extraction?.verification?.materiality, onChange: (value) => setValue(['extraction', 'verification', 'materiality'], value), readonly: readonly })] })] }));
21
+ }
22
+ if (section === 'grounding') {
23
+ const grounding = policy.extraction?.grounding;
24
+ const review = grounding?.review;
25
+ return (_jsxs(FormSurface, { children: [_jsxs(FormSection, { title: t('intakePolicy.section.grounding'), children: [_jsxs("div", { className: "grid gap-4 md:grid-cols-2 xl:grid-cols-4", children: [_jsx(TriStateField, { label: t('intakePolicy.field.enabled'), value: grounding?.enabled, onChange: (value) => setValue(['extraction', 'grounding', 'enabled'], value), readonly: readonly }), _jsx(NumberField, { label: t('intakePolicy.field.maxPages'), value: grounding?.max_pages, min: 1, onChange: (value) => setValue(['extraction', 'grounding', 'max_pages'], value), readonly: readonly }), _jsx(NumberField, { label: t('intakePolicy.field.windowPages'), value: grounding?.window_pages, min: 1, onChange: (value) => setValue(['extraction', 'grounding', 'window_pages'], value), readonly: readonly }), _jsx(InputField, { label: t('intakePolicy.field.interaction'), value: grounding?.interaction, onChange: (value) => setValue(['extraction', 'grounding', 'interaction'], value), readonly: readonly })] }), _jsxs("div", { className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3", children: [_jsx(TriStateField, { label: t('intakePolicy.field.useVision'), value: grounding?.use_vision, onChange: (value) => setValue(['extraction', 'grounding', 'use_vision'], value), readonly: readonly }), _jsx(TriStateField, { label: t('intakePolicy.field.forceOcr'), value: grounding?.force_ocr, onChange: (value) => setValue(['extraction', 'grounding', 'force_ocr'], value), readonly: readonly }), _jsx(TriStateField, { label: t('intakePolicy.field.refreshOcr'), value: grounding?.refresh_ocr, onChange: (value) => setValue(['extraction', 'grounding', 'refresh_ocr'], value), readonly: readonly }), _jsx(TriStateField, { label: t('intakePolicy.field.omitBlockBoxes'), value: grounding?.omit_block_boxes, onChange: (value) => setValue(['extraction', 'grounding', 'omit_block_boxes'], value), readonly: readonly }), _jsx(TriStateField, { label: t('intakePolicy.field.updateProperties'), value: grounding?.update_properties, onChange: (value) => setValue(['extraction', 'grounding', 'update_properties'], value), readonly: readonly })] })] }), _jsxs(FormSection, { title: t('intakePolicy.section.models'), children: [_jsx(ModelConfigFields, { title: t('intakePolicy.field.primaryModel'), config: grounding?.config, onChange: (value) => setValue(['extraction', 'grounding', 'config'], value), readonly: readonly }), _jsx(ModelConfigFields, { title: t('intakePolicy.field.hardModel'), config: grounding?.hard_config, onChange: (value) => setValue(['extraction', 'grounding', 'hard_config'], value), readonly: readonly }), _jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [_jsx(NumberField, { label: t('intakePolicy.field.hardnessThreshold'), value: grounding?.hardness_threshold, min: 0, max: 1, step: 0.05, onChange: (value) => setValue(['extraction', 'grounding', 'hardness_threshold'], value), readonly: readonly }), _jsx(NumberField, { label: t('intakePolicy.field.minCitationDensity'), value: grounding?.min_citation_density, min: 0, max: 1, step: 0.05, onChange: (value) => setValue(['extraction', 'grounding', 'min_citation_density'], value), readonly: readonly })] })] }), _jsxs(FormSection, { title: t('intakePolicy.section.review'), last: true, children: [_jsxs("div", { className: "grid gap-4 md:grid-cols-2 xl:grid-cols-4", children: [_jsx(TriStateField, { label: t('intakePolicy.field.enabled'), value: review?.enabled, onChange: (value) => setValue(['extraction', 'grounding', 'review', 'enabled'], value), readonly: readonly }), _jsx(TriStateField, { label: t('intakePolicy.field.forceReview'), value: review?.force, onChange: (value) => setValue(['extraction', 'grounding', 'review', 'force'], value), readonly: readonly }), _jsx(NumberField, { label: t('intakePolicy.field.reviewThreshold'), value: review?.threshold, min: 0, max: 1, step: 0.05, onChange: (value) => setValue(['extraction', 'grounding', 'review', 'threshold'], value), readonly: readonly }), _jsx(NumberField, { label: t('intakePolicy.field.coverageThreshold'), value: review?.coverage_threshold, min: 0, max: 1, step: 0.05, onChange: (value) => setValue(['extraction', 'grounding', 'review', 'coverage_threshold'], value), readonly: readonly })] }), _jsx(ModelConfigFields, { title: t('intakePolicy.field.reviewModel'), config: review?.config, onChange: (value) => setValue(['extraction', 'grounding', 'review', 'config'], value), readonly: readonly })] })] }));
26
+ }
27
+ return (_jsxs(FormSurface, { children: [_jsx(FormSection, { title: t('intakePolicy.section.rendering'), children: _jsx(TextAreaField, { label: t('intakePolicy.field.renderingTemplate'), description: t('intakePolicy.help.renderingTemplate'), value: policy.rendering_template, onChange: (value) => setValue(['rendering_template'], value), readonly: readonly, monospace: true, minLines: 8 }) }), _jsx(FormSection, { title: t('intakePolicy.section.embeddings'), last: true, children: _jsxs("div", { className: "grid gap-4 md:grid-cols-2 xl:grid-cols-4", children: [_jsx(TriStateField, { label: t('intakePolicy.field.textEmbedding'), value: policy.embeddings?.text, onChange: (value) => setValue(['embeddings', 'text'], value), readonly: readonly }), _jsx(TriStateField, { label: t('intakePolicy.field.imageEmbedding'), value: policy.embeddings?.image, onChange: (value) => setValue(['embeddings', 'image'], value), readonly: readonly }), _jsx(TriStateField, { label: t('intakePolicy.field.propertiesEmbedding'), value: policy.embeddings?.properties, onChange: (value) => setValue(['embeddings', 'properties'], value), readonly: readonly }), _jsx(TriStateField, { label: t('intakePolicy.field.generateToc'), value: policy.generate_toc, onChange: (value) => setValue(['generate_toc'], value), readonly: readonly })] }) })] }));
28
+ }
29
+ function FormSurface({ children }) {
30
+ return _jsx("div", { className: "mx-auto w-full max-w-6xl px-1 py-4", children: children });
31
+ }
32
+ function FormSection({ title, children, last = false }) {
33
+ return (_jsxs("section", { className: last ? 'pb-3' : 'mb-6 border-b pb-6', children: [_jsx("h3", { className: "mb-4 text-sm font-semibold", children: title }), _jsx("div", { className: "space-y-4", children: children })] }));
34
+ }
35
+ function InputField({ label, value, onChange, readonly, description, }) {
36
+ return (_jsx(FormItem, { label: label, description: description, children: _jsx(Input, { value: value ?? '', onChange: (value) => onChange(value || undefined), disabled: readonly }) }));
37
+ }
38
+ function TextAreaField({ label, value, onChange, readonly, description, minLines = 3, monospace = false, }) {
39
+ return (_jsx(FormItem, { label: label, description: description, children: _jsx(Textarea, { value: value ?? '', onChange: (event) => onChange(event.target.value || undefined), disabled: readonly, minLines: minLines, maxLines: 14, className: monospace ? 'font-mono' : undefined }) }));
40
+ }
41
+ function NumberField({ label, value, onChange, readonly, min, max, step, }) {
42
+ return (_jsx(FormItem, { label: label, children: _jsx(NumberInput, { value: value, onChange: (value) => onChange(value === undefined || Number.isFinite(value) ? value : undefined), disabled: readonly, min: min, max: max, step: step ?? 1, noScroll: true }) }));
43
+ }
44
+ function SelectField({ label, description, value, options, onChange, readonly, }) {
45
+ const { t } = useUITranslation();
46
+ const choices = [
47
+ { value: '__inherit__', label: t('intakePolicy.option.inherit') },
48
+ ...options,
49
+ ];
50
+ const selected = choices.find((option) => option.value === value) ?? choices[0];
51
+ return (_jsx(FormItem, { label: label, description: description, children: _jsx(SelectBox, { options: choices, value: selected, by: "value", optionLabel: (option) => option.label, onChange: (option) => onChange(option.value === '__inherit__' ? undefined : option.value), disabled: readonly }) }));
52
+ }
53
+ function TriStateField({ label, value, onChange, readonly, }) {
54
+ const { t } = useUITranslation();
55
+ const choices = [
56
+ { value: 'inherit', label: t('intakePolicy.option.inherit') },
57
+ { value: 'enabled', label: t('intakePolicy.option.enabled') },
58
+ { value: 'disabled', label: t('intakePolicy.option.disabled') },
59
+ ];
60
+ const selectedValue = value === undefined ? 'inherit' : value ? 'enabled' : 'disabled';
61
+ return (_jsx(FormItem, { label: label, children: _jsx(SelectBox, { options: [...choices], value: choices.find((option) => option.value === selectedValue), by: "value", optionLabel: (option) => option.label, onChange: (option) => onChange(option.value === 'inherit' ? undefined : option.value === 'enabled'), disabled: readonly }) }));
62
+ }
63
+ function VisionDetailsField({ value, onChange, readonly, }) {
64
+ const { t } = useUITranslation();
65
+ const choices = options(t, ['low', 'standard', 'high']);
66
+ return (_jsx(FormItem, { label: t('intakePolicy.field.allowedDetails'), children: _jsx(SelectBox, { multiple: true, options: choices, value: choices.filter((option) => value?.includes(option.value)), by: "value", optionLabel: (option) => option.label, onChange: (selected) => onChange(selected.length ? selected.map((option) => option.value) : undefined), disabled: readonly }) }));
67
+ }
68
+ function PageRangesField({ value, onChange, readonly, }) {
69
+ const { t } = useUITranslation();
70
+ const remove = (index) => {
71
+ const next = value?.filter((_, rangeIndex) => rangeIndex !== index);
72
+ onChange(next?.length ? next : undefined);
73
+ };
74
+ return (_jsx(FormItem, { label: t('intakePolicy.field.pageRanges'), description: t('intakePolicy.help.pageRanges'), children: _jsxs("div", { className: "space-y-2", children: [value?.map((range, index) => (_jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_2.25rem] gap-2", children: [_jsx(NumberInput, { "aria-label": t('intakePolicy.field.rangeStart'), value: range[0], onChange: (next) => {
75
+ if (next !== undefined && Number.isFinite(next)) {
76
+ onChange(replaceIntakeRange(value, index, 0, next));
77
+ }
78
+ }, disabled: readonly, step: 1, noScroll: true }), _jsx(NumberInput, { "aria-label": t('intakePolicy.field.rangeEnd'), value: range[1], onChange: (next) => {
79
+ if (next !== undefined && Number.isFinite(next)) {
80
+ onChange(replaceIntakeRange(value, index, 1, next));
81
+ }
82
+ }, disabled: readonly, step: 1, noScroll: true }), _jsx(VTooltip, { description: t('intakePolicy.action.removeRange'), children: _jsx(Button, { type: "button", variant: "ghost", size: "icon", "aria-label": t('intakePolicy.action.removeRange'), onClick: () => remove(index), disabled: readonly, children: _jsx(Trash2, { className: "size-4" }) }) })] }, `${index}`))), _jsxs(Button, { type: "button", variant: "outline", size: "sm", onClick: () => onChange([...(value ?? []), [1, 1]]), disabled: readonly, children: [_jsx(Plus, { className: "size-4" }), t('intakePolicy.action.addRange')] })] }) }));
83
+ }
84
+ function ModelConfigFields({ title, config, onChange, readonly, }) {
85
+ const { t } = useUITranslation();
86
+ return (_jsxs("div", { children: [_jsx("div", { className: "mb-2 text-xs font-medium text-muted", children: title }), _jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [_jsx(FormItem, { label: t('intakePolicy.field.environment'), children: _jsx(SelectEnvironment, { selectedEnvId: config?.environment, onChange: (environment) => onChange(updateExecutionEnvironment(config, environment?.id)), isClearable: true, disabled: readonly }) }), _jsx(FormItem, { label: t('intakePolicy.field.model'), children: _jsx(SelectModel, { envId: config?.environment, selectedModelId: config?.model, onChange: (model) => onChange(updateExecutionModel(config, model?.id)), isClearable: true, disabled: readonly || !config?.environment }) })] })] }));
87
+ }
88
+ function options(t, values) {
89
+ return values.map((value) => ({ value, label: t(`intakePolicy.option.${value}`) }));
90
+ }
91
+ //# sourceMappingURL=IntakePolicyForm.js.map