@jini-ai/ui 0.7.3-next.2 → 0.7.3-next.3

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 (281) hide show
  1. package/README.md +3 -3
  2. package/dist/browser/index.d.ts +2 -0
  3. package/dist/browser/index.js +2 -0
  4. package/dist/browser/mount-renderer.d.ts +33 -0
  5. package/dist/browser/mount-renderer.js +14 -0
  6. package/dist/browser/useDismissibleDropdown.d.ts +50 -0
  7. package/dist/browser/useDismissibleDropdown.js +49 -0
  8. package/dist/core.d.ts +4 -4
  9. package/dist/core.js +4 -1
  10. package/dist/features/admin-widgets/components/InfoTip.js +5 -5
  11. package/dist/features/admin-widgets/components/InfoTip.rules.d.ts +1 -1
  12. package/dist/features/admin-widgets/components/InfoTip.rules.js +1 -1
  13. package/dist/features/admin-widgets/components/SeeMore/SeeMore.js +3 -3
  14. package/dist/features/admin-widgets/components/Select/Select.js +7 -7
  15. package/dist/features/app-shell/SiteToast.d.ts +24 -0
  16. package/dist/features/app-shell/SiteToast.js +9 -0
  17. package/dist/features/app-shell/copyable-details.d.ts +12 -0
  18. package/dist/features/app-shell/copyable-details.js +17 -0
  19. package/dist/features/app-shell/expanded-mode.d.ts +76 -0
  20. package/dist/features/app-shell/expanded-mode.js +70 -0
  21. package/dist/features/app-shell/index.d.ts +8 -0
  22. package/dist/features/app-shell/index.js +8 -0
  23. package/dist/features/app-shell/use-delete-confirmation.hooks.d.ts +48 -0
  24. package/dist/features/app-shell/use-delete-confirmation.hooks.js +57 -0
  25. package/dist/features/app-shell/use-expanded-mode.hooks.d.ts +19 -0
  26. package/dist/features/app-shell/use-expanded-mode.hooks.js +39 -0
  27. package/dist/features/app-shell/use-site-toast.hooks.d.ts +56 -0
  28. package/dist/features/app-shell/use-site-toast.hooks.js +44 -0
  29. package/dist/features/app-shell/use-theme-preference.hooks.d.ts +30 -0
  30. package/dist/features/app-shell/use-theme-preference.hooks.js +42 -0
  31. package/dist/features/app-version/use-app-version.d.ts +53 -0
  32. package/dist/features/app-version/use-app-version.js +42 -0
  33. package/dist/features/asset-grid/react/components/AssetGrid.d.ts +1 -1
  34. package/dist/features/asset-grid/react/components/AssetGrid.js +1 -1
  35. package/dist/features/asset-grid/react/components/DeleteConfirmDialog.d.ts +1 -1
  36. package/dist/features/asset-grid/react/components/DeleteConfirmDialog.js +1 -1
  37. package/dist/features/asset-tree-browser/react/components/AssetTreeBrowser.d.ts +2 -2
  38. package/dist/features/asset-tree-browser/react/components/AssetTreeBrowser.js +1 -1
  39. package/dist/features/asset-tree-browser/react/components/FilePreviewPane.d.ts +1 -1
  40. package/dist/features/browser-chrome/react/components/BrowserViewportControls.d.ts +1 -1
  41. package/dist/features/browser-chrome/react/components/BrowserViewportControls.js +1 -1
  42. package/dist/features/charts/table.js +4 -4
  43. package/dist/features/command-palette/index.d.ts +1 -0
  44. package/dist/features/command-palette/index.js +1 -0
  45. package/dist/features/command-palette/react/components/CommandPalette.d.ts +9 -9
  46. package/dist/features/command-palette/react/components/CommandPalette.hooks.js +28 -1
  47. package/dist/features/command-palette/react/components/CommandPalette.js +3 -5
  48. package/dist/features/connectors/ConnectorsBrowser.d.ts +1 -1
  49. package/dist/features/connectors/ConnectorsBrowser.js +2 -2
  50. package/dist/features/connectors/components/ConnectorCard.hooks.js +2 -2
  51. package/dist/features/connectors/components/ConnectorCard.js +4 -4
  52. package/dist/features/connectors/components/ConnectorDetailDrawer.d.ts +1 -1
  53. package/dist/features/connectors/components/ConnectorDetailDrawer.js +7 -7
  54. package/dist/features/connectors/components/ConnectorGrid.js +1 -1
  55. package/dist/features/connectors/components/ConnectorLogo.js +1 -1
  56. package/dist/features/connectors/components/ConnectorSearchBar.js +1 -1
  57. package/dist/features/connectors/components/ProviderTabBar.js +1 -1
  58. package/dist/features/execution/claude/env-fields.d.ts +1 -1
  59. package/dist/features/execution/codex/env-fields.d.ts +1 -1
  60. package/dist/features/execution/constants.d.ts +2 -2
  61. package/dist/features/execution/constants.js +1 -1
  62. package/dist/features/execution/dependencies.d.ts +2 -3
  63. package/dist/features/execution/http-adapter.d.ts +2 -3
  64. package/dist/features/execution/index.d.ts +0 -2
  65. package/dist/features/execution/react/components/AgentCliEnvFields.d.ts +1 -1
  66. package/dist/features/execution/react/components/AgentDiagnosticRow.d.ts +1 -1
  67. package/dist/features/execution/react/components/AgentDiagnosticRow.js +3 -1
  68. package/dist/features/execution/react/components/ByokProviderForm.d.ts +10 -2
  69. package/dist/features/execution/react/components/ByokProviderForm.hooks.d.ts +2 -2
  70. package/dist/features/execution/react/components/ByokProviderForm.js +15 -4
  71. package/dist/features/execution/react/components/ExecutionTab.d.ts +2 -3
  72. package/dist/features/execution/react/components/ExecutionTab.hooks.d.ts +14 -4
  73. package/dist/features/execution/react/components/ExecutionTab.hooks.js +66 -9
  74. package/dist/features/execution/react/components/ExecutionTab.js +27 -10
  75. package/dist/features/execution/react/components/LocalCliAgentCard.d.ts +4 -4
  76. package/dist/features/execution/react/components/LocalCliAgentList.d.ts +4 -4
  77. package/dist/features/execution/react/components/LocalCliAgentList.hooks.d.ts +3 -3
  78. package/dist/features/execution/react/components/LocalCliAgentSettings.d.ts +2 -2
  79. package/dist/features/execution/react/components/ProviderChipGroup.d.ts +1 -1
  80. package/dist/features/execution/react/components/SearchableModelSelect.d.ts +1 -1
  81. package/dist/features/execution/react/hooks/use-byok-field-validation.hooks.d.ts +2 -2
  82. package/dist/features/execution/react/hooks/use-execution-credential.hooks.d.ts +1 -1
  83. package/dist/features/execution/react/hooks/useExecutionTab.d.ts +2 -3
  84. package/dist/features/execution/react/hooks/useLocalCliAgentCard.d.ts +4 -4
  85. package/dist/features/execution/react/hooks/useLocalCliAgentList.d.ts +4 -4
  86. package/dist/features/execution/react/hooks/useReasoningControl.d.ts +3 -3
  87. package/dist/features/execution/rules.d.ts +6 -6
  88. package/dist/features/execution/rules.js +1 -1
  89. package/dist/features/external-mcp/react/components/ExternalMcpTab.js +4 -4
  90. package/dist/features/file-dropzone/react/components/FileDropzone.d.ts +1 -1
  91. package/dist/features/file-dropzone/react/components/FileDropzone.js +1 -1
  92. package/dist/features/find/find-bar-state.d.ts +58 -0
  93. package/dist/features/find/find-bar-state.js +45 -0
  94. package/dist/features/find/find-focus-clock.d.ts +19 -0
  95. package/dist/features/find/find-focus-clock.js +9 -0
  96. package/dist/features/find/find-input-focus.d.ts +88 -0
  97. package/dist/features/find/find-input-focus.js +88 -0
  98. package/dist/features/find/find-target.d.ts +141 -0
  99. package/dist/features/find/find-target.js +160 -0
  100. package/dist/features/find/index.d.ts +10 -0
  101. package/dist/features/find/index.js +10 -0
  102. package/dist/features/find/use-find-bar-effects.hooks.d.ts +14 -0
  103. package/dist/features/find/use-find-bar-effects.hooks.js +92 -0
  104. package/dist/features/find/use-find-bar-state.hooks.d.ts +43 -0
  105. package/dist/features/find/use-find-bar-state.hooks.js +49 -0
  106. package/dist/features/find/use-find-focus-reclaim.hooks.d.ts +21 -0
  107. package/dist/features/find/use-find-focus-reclaim.hooks.js +64 -0
  108. package/dist/features/find/use-find-input-binding.hooks.d.ts +18 -0
  109. package/dist/features/find/use-find-input-binding.hooks.js +76 -0
  110. package/dist/features/find-bar/FindBar.d.ts +41 -0
  111. package/dist/features/find-bar/FindBar.js +31 -0
  112. package/dist/features/find-bar/index.d.ts +2 -0
  113. package/dist/features/find-bar/index.js +2 -0
  114. package/dist/features/folder-path-drop/index.d.ts +3 -1
  115. package/dist/features/folder-path-drop/index.js +1 -0
  116. package/dist/features/folder-path-drop/react/hooks/useClassifiedPathDrop.d.ts +50 -0
  117. package/dist/features/folder-path-drop/react/hooks/useClassifiedPathDrop.js +50 -0
  118. package/dist/features/folder-path-drop/types.d.ts +14 -0
  119. package/dist/features/i18n/context.d.ts +1 -1
  120. package/dist/features/i18n/context.js +1 -1
  121. package/dist/features/iframe-pool/react/dom-sync.d.ts +13 -3
  122. package/dist/features/iframe-pool/react/dom-sync.js +7 -7
  123. package/dist/features/import-handoff/use-import-handoff.d.ts +38 -0
  124. package/dist/features/import-handoff/use-import-handoff.js +40 -0
  125. package/dist/features/integrations/rules.js +39 -41
  126. package/dist/features/interactive-ui/interactive-ui.css +1 -1
  127. package/dist/features/interactive-ui/providers/native/data-table.js +1 -1
  128. package/dist/features/interactive-ui/providers/shadcn/checkbox-field.js +1 -1
  129. package/dist/features/interactive-ui/providers/shadcn/data-table.js +3 -3
  130. package/dist/features/interactive-ui/providers/shadcn/radio-group-field.js +1 -1
  131. package/dist/features/live-views/index.d.ts +6 -0
  132. package/dist/features/live-views/index.js +6 -0
  133. package/dist/features/live-views/use-live-views.d.ts +31 -0
  134. package/dist/features/live-views/use-live-views.js +88 -0
  135. package/dist/features/live-views/use-site-view-preference.d.ts +33 -0
  136. package/dist/features/live-views/use-site-view-preference.js +32 -0
  137. package/dist/features/live-views/use-webview-load-failure.d.ts +90 -0
  138. package/dist/features/live-views/use-webview-load-failure.js +122 -0
  139. package/dist/features/mcp-ui/credential-card.d.ts +1 -0
  140. package/dist/features/mcp-ui/credential-card.js +1 -1
  141. package/dist/features/mcp-ui/surfaces/tool-approval.d.ts +10 -0
  142. package/dist/features/mcp-ui/surfaces/tool-approval.js +15 -0
  143. package/dist/features/media-providers/dependencies.d.ts +7 -1
  144. package/dist/features/media-providers/dependencies.js +43 -0
  145. package/dist/features/media-providers/index.d.ts +2 -2
  146. package/dist/features/media-providers/index.js +1 -1
  147. package/dist/features/media-providers/ports.d.ts +39 -5
  148. package/dist/features/media-providers/react/components/MediaProvidersTab.d.ts +4 -3
  149. package/dist/features/media-providers/react/components/MediaProvidersTab.js +1 -1
  150. package/dist/features/media-providers/react/hooks/useMediaProvidersTab.d.ts +3 -2
  151. package/dist/features/media-providers/react/hooks/useMediaProvidersTab.js +41 -3
  152. package/dist/features/memory/react/components/MemoryConnectedPanel.js +2 -2
  153. package/dist/features/memory/react/components/MemoryEntryCard.js +1 -1
  154. package/dist/features/memory/react/components/MemoryHooksPanel.js +2 -2
  155. package/dist/features/memory/react/components/MemoryList.js +2 -2
  156. package/dist/features/memory/react/components/MemorySettingsPanel.js +2 -2
  157. package/dist/features/memory/react/components/MemorySuggestionPanel.js +1 -1
  158. package/dist/features/memory/react/hooks/useMemoryConnectors.hooks.js +3 -3
  159. package/dist/features/memory/react/hooks/useMemoryConnectors.rules.d.ts +4 -1
  160. package/dist/features/memory/react/hooks/useMemoryConnectors.rules.js +1 -1
  161. package/dist/features/memory/react/render-markdown.js +1 -1
  162. package/dist/features/nav-availability/nav-availability.d.ts +18 -0
  163. package/dist/features/nav-availability/nav-availability.js +12 -0
  164. package/dist/features/number-stepper/NumberStepper.d.ts +39 -0
  165. package/dist/features/number-stepper/NumberStepper.js +16 -0
  166. package/dist/features/number-stepper/index.d.ts +5 -0
  167. package/dist/features/number-stepper/index.js +5 -0
  168. package/dist/features/number-stepper/number-stepper.d.ts +34 -0
  169. package/dist/features/number-stepper/number-stepper.js +32 -0
  170. package/dist/features/number-stepper/use-number-stepper.hooks.d.ts +20 -0
  171. package/dist/features/number-stepper/use-number-stepper.hooks.js +29 -0
  172. package/dist/features/number-stepper/use-optimistic-number-setting.hooks.d.ts +36 -0
  173. package/dist/features/number-stepper/use-optimistic-number-setting.hooks.js +25 -0
  174. package/dist/features/panel-kit/ErrorNotice.js +8 -1
  175. package/dist/features/panel-kit/helpers/standing-draft-local-backup.d.ts +1 -1
  176. package/dist/features/panel-kit/helpers/standing-draft-recovery-message.d.ts +1 -1
  177. package/dist/features/panel-kit/hooks/use-standing-draft-autosave.hooks.d.ts +1 -37
  178. package/dist/features/panel-kit/hooks/use-standing-draft-recovery.hooks.d.ts +2 -1
  179. package/dist/features/panel-kit/hooks/use-standing-draft-state.hooks.d.ts +2 -1
  180. package/dist/features/panel-kit/hooks/use-standing-draft-writes.hooks.d.ts +2 -1
  181. package/dist/features/panel-kit/index.d.ts +2 -1
  182. package/dist/features/privacy/react/components/PrivacyTab.d.ts +1 -1
  183. package/dist/features/privacy/react/components/PrivacyTab.js +1 -1
  184. package/dist/features/progress-card/components/ProgressCard.d.ts +1 -1
  185. package/dist/features/progress-card/components/ProgressCard.js +1 -1
  186. package/dist/features/resource-dashboard/react/components/ResourceBoard.d.ts +1 -1
  187. package/dist/features/resource-dashboard/react/components/ResourceBoardToolbar.d.ts +1 -1
  188. package/dist/features/resource-dashboard/react/components/ResourceBoardToolbar.js +1 -1
  189. package/dist/features/resource-dashboard/react/components/ResourceCardParts.d.ts +1 -1
  190. package/dist/features/resource-dashboard/react/components/ResourceCardParts.js +7 -2
  191. package/dist/features/resource-dashboard/react/components/ResourceRowListView.d.ts +1 -1
  192. package/dist/features/resource-dashboard/react/components/ResourceRowListView.js +1 -1
  193. package/dist/features/resource-dashboard/react/components/ResourceRunHistoryList.d.ts +1 -1
  194. package/dist/features/resource-dashboard/react/components/ResourceRunHistoryList.js +1 -1
  195. package/dist/features/resource-dashboard/react/components/StatusPill.d.ts +1 -1
  196. package/dist/features/resource-dashboard/react/components/StatusPill.js +1 -1
  197. package/dist/features/resource-dashboard/react/hooks/useResourceBoard.js +6 -1
  198. package/dist/features/resource-monitor/ResourceTable.d.ts +67 -0
  199. package/dist/features/resource-monitor/ResourceTable.js +25 -0
  200. package/dist/features/resource-monitor/index.d.ts +4 -0
  201. package/dist/features/resource-monitor/index.js +4 -0
  202. package/dist/features/resource-monitor/resource-stop.d.ts +16 -0
  203. package/dist/features/resource-monitor/resource-stop.js +11 -0
  204. package/dist/features/resource-monitor/use-resource-readings.hooks.d.ts +44 -0
  205. package/dist/features/resource-monitor/use-resource-readings.hooks.js +91 -0
  206. package/dist/features/settings/dialog/styles/settings-dialog.css +251 -251
  207. package/dist/features/site-card/index.d.ts +4 -1
  208. package/dist/features/site-card/index.js +3 -0
  209. package/dist/features/site-card/use-created-site-return.hooks.d.ts +36 -0
  210. package/dist/features/site-card/use-created-site-return.hooks.js +43 -0
  211. package/dist/features/site-card/use-site-card-preview.hooks.d.ts +39 -0
  212. package/dist/features/site-card/use-site-card-preview.hooks.js +31 -0
  213. package/dist/features/site-card/use-site-list-prefs.hooks.d.ts +29 -8
  214. package/dist/features/site-card/use-site-list-prefs.hooks.js +56 -9
  215. package/dist/features/site-card/use-site-preview.hooks.d.ts +67 -0
  216. package/dist/features/site-card/use-site-preview.hooks.js +94 -0
  217. package/dist/features/sketch-editor/react/components/SketchEditor.d.ts +2 -2
  218. package/dist/features/sketch-editor/react/components/SketchEditor.js +1 -1
  219. package/dist/features/skills/react/components/SkillRow.js +1 -1
  220. package/dist/features/source-config-list/react/components/SourceConfigAddForm.js +2 -2
  221. package/dist/features/source-config-list/react/components/SourceConfigField.js +1 -1
  222. package/dist/features/source-config-list/react/components/SourceConfigItemCard.js +5 -5
  223. package/dist/features/source-config-list/react/components/SourceConfigList.d.ts +1 -1
  224. package/dist/features/source-config-list/react/components/SourceConfigList.js +1 -1
  225. package/dist/features/source-config-list/react/components/SourceConfigListView.js +3 -3
  226. package/dist/features/source-config-list/react/components/SourceConfigTestControl.d.ts +1 -1
  227. package/dist/features/source-config-list/react/components/SourceConfigTestControl.js +1 -1
  228. package/dist/features/tab-launcher-menu/react/components/TabLauncherMenu.d.ts +1 -1
  229. package/dist/features/tab-launcher-menu/react/components/TabLauncherMenu.js +1 -1
  230. package/dist/features/tab-strip/react/components/TabBar.js +2 -2
  231. package/dist/features/tab-strip/react/components/TabStrip.d.ts +1 -1
  232. package/dist/features/tab-strip/react/components/TabStrip.js +1 -1
  233. package/dist/features/tab-strip/scrollable.js +0 -2
  234. package/dist/features/tabbed-dialog/react/components/TabbedDialog.d.ts +1 -1
  235. package/dist/features/tabbed-dialog/react/components/TabbedDialog.js +1 -1
  236. package/dist/features/version-manager/react/components/VersionManagerModal.d.ts +1 -1
  237. package/dist/features/version-manager/react/components/VersionManagerModal.js +1 -1
  238. package/dist/features/viewer-shell/react/components/CommentSidePanel.d.ts +2 -2
  239. package/dist/features/viewer-shell/react/components/CommentSidePanel.js +1 -1
  240. package/dist/features/viewer-shell/react/components/MarkdownSplitPane.d.ts +1 -1
  241. package/dist/features/viewer-shell/react/components/MarkdownSplitPane.js +1 -1
  242. package/dist/features/viewer-shell/react/components/SegmentedToggle.d.ts +1 -1
  243. package/dist/features/viewer-shell/react/components/SegmentedToggle.js +1 -1
  244. package/dist/features/viewer-shell/react/components/ViewportSwitcher.d.ts +1 -1
  245. package/dist/features/viewer-shell/react/components/ViewportSwitcher.js +1 -1
  246. package/dist/features/viewer-shell/react/components/ViewportToggleGroup.d.ts +1 -1
  247. package/dist/features/viewer-shell/react/components/ViewportToggleGroup.js +1 -1
  248. package/dist/features/zoom/use-zoom.d.ts +141 -0
  249. package/dist/features/zoom/use-zoom.js +204 -0
  250. package/dist/index.d.ts +1 -0
  251. package/dist/index.js +1 -0
  252. package/dist/react/components/ComponentKitPreview.d.ts +1 -1
  253. package/dist/react/components/ComponentKitPreview.js +1 -1
  254. package/dist/react/components/CustomSelect.js +1 -1
  255. package/dist/react/components/ExportDiagnosticsButton.d.ts +6 -2
  256. package/dist/react/components/ExportDiagnosticsButton.js +3 -3
  257. package/dist/react/components/FileImportPanel.js +1 -1
  258. package/dist/react/components/IconFrame.d.ts +15 -0
  259. package/dist/react/components/IconFrame.js +11 -0
  260. package/dist/react/components/ImportChoice.js +1 -1
  261. package/dist/react/components/Notice.js +1 -1
  262. package/dist/react/components/OnboardingDropdown.js +1 -1
  263. package/dist/react/components/PaletteTweaks.js +1 -1
  264. package/dist/react/components/TooltipLayer.d.ts +13 -3
  265. package/dist/react/components/TooltipLayer.js +12 -12
  266. package/dist/react/mcp-ui/host-message-source.d.ts +3 -1
  267. package/dist/react/mcp-ui/host-message-source.js +1 -1
  268. package/dist/react/testing.js +3 -1
  269. package/dist/renderers/annotation-canvas/rules.js +30 -27
  270. package/dist/renderers/react/components/ArtifactView.js +1 -1
  271. package/dist/renderers/renderers/markdown.d.ts +3 -1
  272. package/dist/renderers/renderers/markdown.js +2 -2
  273. package/dist/styles/admin.css +54 -54
  274. package/dist/utils/zip.js +43 -36
  275. package/package.json +66 -9
  276. package/dist/features/execution/ports.d.ts +0 -71
  277. package/dist/features/execution/ports.js +0 -2
  278. package/dist/features/execution/types.d.ts +0 -472
  279. package/dist/features/execution/types.js +0 -2
  280. package/dist/react/components/CustomSelectMarkup.d.ts +0 -27
  281. package/dist/react/components/CustomSelectMarkup.js +0 -35
@@ -0,0 +1,90 @@
1
+ /** The fields of Electron's `did-fail-load` event this hook reads. */
2
+ export interface LoadFailureEvent {
3
+ readonly isMainFrame: boolean;
4
+ readonly errorCode: number;
5
+ }
6
+ /** The slice of Electron's `<webview>` this hook listens to. Structural, so this browser package
7
+ * never imports Electron; a real `<webview>` satisfies it, and the hook hands back the caller's
8
+ * own element type `G` for listeners that need more of it. */
9
+ export interface LoadFailureGuest {
10
+ addEventListener(type: 'did-fail-load', listener: (event: LoadFailureEvent) => void): void;
11
+ addEventListener(type: 'did-finish-load', listener: () => void): void;
12
+ removeEventListener(type: 'did-fail-load', listener: (event: LoadFailureEvent) => void): void;
13
+ removeEventListener(type: 'did-finish-load', listener: () => void): void;
14
+ }
15
+ /**
16
+ * Detects a guest that is alive-but-not-answering, and tells apart the two different ways that
17
+ * can happen — `failed`, a FACT: `did-fail-load` fired on the `<webview>`'s main frame with a
18
+ * real error, as opposed to a normal in-flight navigation being cancelled. `stalled`, a GUESS:
19
+ * neither `did-fail-load` nor `did-finish-load` showed up at all within `STALL_TIMEOUT_MS`, which
20
+ * means exactly nothing — Chromium never told this hook anything either way, and the guest may
21
+ * still be about to answer on its own. The host's workspace view treats the two accordingly: `failed`
22
+ * swaps the guest out outright, the same way a stopped project does, because there is nothing left
23
+ * to wait for. `stalled` only lays a recovery panel over the still-loading guest, because there
24
+ * might be.
25
+ *
26
+ * Two Electron quirks make `isMainFrame`/`errorCode` filtering load-bearing rather than optional.
27
+ * `did-fail-load` fires for sub-resources too — a missing favicon, a failed XHR inside the admin —
28
+ * and `isMainFrame` is what tells those apart from the guest itself being unreachable. It also
29
+ * fires with `errorCode === -3` (`ABORTED`) on completely ordinary navigations: the view toggle
30
+ * and the reload button both cancel whatever load was already in flight, and Chromium reports that
31
+ * cancellation exactly the way it reports a real failure. Counting either as a failure would swap
32
+ * a perfectly good admin for an error panel on every ordinary click.
33
+ *
34
+ * `STALL_TIMEOUT_MS` is this hook's own ceiling on "still loading, no verdict yet" — ported
35
+ * unchanged from the original host's own measurement of a freshly created project's slowest real
36
+ * first admin request (see that host's own history for the live numbers): comfortably past how long a
37
+ * local admin normally takes to answer, comfortably short of leaving the operator staring at a
38
+ * blank pane for the rest of the session.
39
+ *
40
+ * `resetKey` is the host workspace's load reset key (reload nonce, view, soft loads), not read
41
+ * here for its value — only for when it changes. A recovery remount replaces the guest (new DOM
42
+ * node, so listeners must move with it), while a view switch or a soft load (`reload()`,
43
+ * `loadURL()`) renavigates the same node; all of them deserve a clean slate, since
44
+ * without one a single transient failure would pin the recovery panel in place even after the
45
+ * operator's next click plainly asked for another try. The same reset also re-arms the stall timer,
46
+ * which is what lets the recovery panel's own "Start site" retry get a second, fresh judgment.
47
+ *
48
+ * **The guest arrives through `guestRef`, a callback ref, and that is the D-03 fix.** This used to
49
+ * take a `RefObject` and depend on `[webviewRef, resetKey]`. A ref OBJECT is stable for the
50
+ * component's whole life, and the host's workspace view renders the `<webview>` only when
51
+ * `running && !failed` — so on the two ordinary paths that mount a guest (a stopped tab whose 4 s
52
+ * poll flips to `running`, and the failure panel's own retry) neither dependency changed, the
53
+ * effect never re-ran, and NO listener and no stall timer were ever installed on the node actually
54
+ * on screen. Only "Reload while healthy" — where `key` remounts the guest in the same commit the
55
+ * effect follows — attached them, which is the path that needs recovery least. The hook was right
56
+ * in form and wrong in binding: its own doc said the listeners "must move with" the node, and
57
+ * nothing in its inputs changed when the node appeared. Holding the node in STATE makes it a
58
+ * dependency that really does change on attach, so the effect's lifetime IS the node's.
59
+ *
60
+ * The failure reset is deliberately a SECOND effect keyed on `resetKey` alone. Folding it back into the
61
+ * node-keyed effect looks tidier and reintroduces a worse bug: `failed` going true unmounts the
62
+ * guest, which fires `guestRef(null)`, which would re-run a combined effect and clear the very
63
+ * flag that unmounted it — the guest remounts, fails again, and the panel flickers forever.
64
+ *
65
+ * **`loaded` is the third flag, added alongside `failed`/`stalled` for the same reason those two
66
+ * exist: "the guest is mounted" is not "the admin is on screen".** Before it, a fresh guest gave
67
+ * the operator nothing to look at from the moment it mounted until either `did-finish-load` swapped
68
+ * in real content or `STALL_TIMEOUT_MS` ran out and guessed something was wrong — a blank pane for
69
+ * up to 8 seconds on every ordinary open, indistinguishable from a hang. `loaded` is what a caller
70
+ * checks to show its OWN "still loading" state in that window, instead of leaving it silent.
71
+ * `true` only once `did-finish-load` has actually fired for the CURRENT `resetKey`; it resets to
72
+ * `false` in lockstep with `failed`/`stalled` so a remount, a view switch, or a soft load all start
73
+ * from "not loaded yet" rather than carrying over a previous navigation's finished state.
74
+ *
75
+ * @returns `guestRef` alongside the three flags — the caller MUST put it on the `<webview>`; there
76
+ * is no other way for this hook to see the node. `guest` is that node, for the host workspace's
77
+ * history listeners, which need the same lifetime and cannot take a second ref on one element.
78
+ */
79
+ export declare function useWebviewLoadFailure<G extends LoadFailureGuest = LoadFailureGuest>({ resetKey }: {
80
+ resetKey: unknown;
81
+ }, { timers }?: {
82
+ timers?: Pick<Window, 'setTimeout' | 'clearTimeout'>;
83
+ }): {
84
+ failed: boolean;
85
+ stalled: boolean;
86
+ loaded: boolean;
87
+ guest: G | null;
88
+ guestRef: (node: G | null) => void;
89
+ };
90
+ //# sourceMappingURL=use-webview-load-failure.d.ts.map
@@ -0,0 +1,122 @@
1
+ /**
2
+ * @file Telling a guest `<webview>` that failed apart from one that stalled or loaded. Split out of
3
+ * the host's app hooks barrel (which still re-exports it) with no behaviour change.
4
+ */
5
+ import { useEffect, useState } from 'react';
6
+ /**
7
+ * Detects a guest that is alive-but-not-answering, and tells apart the two different ways that
8
+ * can happen — `failed`, a FACT: `did-fail-load` fired on the `<webview>`'s main frame with a
9
+ * real error, as opposed to a normal in-flight navigation being cancelled. `stalled`, a GUESS:
10
+ * neither `did-fail-load` nor `did-finish-load` showed up at all within `STALL_TIMEOUT_MS`, which
11
+ * means exactly nothing — Chromium never told this hook anything either way, and the guest may
12
+ * still be about to answer on its own. The host's workspace view treats the two accordingly: `failed`
13
+ * swaps the guest out outright, the same way a stopped project does, because there is nothing left
14
+ * to wait for. `stalled` only lays a recovery panel over the still-loading guest, because there
15
+ * might be.
16
+ *
17
+ * Two Electron quirks make `isMainFrame`/`errorCode` filtering load-bearing rather than optional.
18
+ * `did-fail-load` fires for sub-resources too — a missing favicon, a failed XHR inside the admin —
19
+ * and `isMainFrame` is what tells those apart from the guest itself being unreachable. It also
20
+ * fires with `errorCode === -3` (`ABORTED`) on completely ordinary navigations: the view toggle
21
+ * and the reload button both cancel whatever load was already in flight, and Chromium reports that
22
+ * cancellation exactly the way it reports a real failure. Counting either as a failure would swap
23
+ * a perfectly good admin for an error panel on every ordinary click.
24
+ *
25
+ * `STALL_TIMEOUT_MS` is this hook's own ceiling on "still loading, no verdict yet" — ported
26
+ * unchanged from the original host's own measurement of a freshly created project's slowest real
27
+ * first admin request (see that host's own history for the live numbers): comfortably past how long a
28
+ * local admin normally takes to answer, comfortably short of leaving the operator staring at a
29
+ * blank pane for the rest of the session.
30
+ *
31
+ * `resetKey` is the host workspace's load reset key (reload nonce, view, soft loads), not read
32
+ * here for its value — only for when it changes. A recovery remount replaces the guest (new DOM
33
+ * node, so listeners must move with it), while a view switch or a soft load (`reload()`,
34
+ * `loadURL()`) renavigates the same node; all of them deserve a clean slate, since
35
+ * without one a single transient failure would pin the recovery panel in place even after the
36
+ * operator's next click plainly asked for another try. The same reset also re-arms the stall timer,
37
+ * which is what lets the recovery panel's own "Start site" retry get a second, fresh judgment.
38
+ *
39
+ * **The guest arrives through `guestRef`, a callback ref, and that is the D-03 fix.** This used to
40
+ * take a `RefObject` and depend on `[webviewRef, resetKey]`. A ref OBJECT is stable for the
41
+ * component's whole life, and the host's workspace view renders the `<webview>` only when
42
+ * `running && !failed` — so on the two ordinary paths that mount a guest (a stopped tab whose 4 s
43
+ * poll flips to `running`, and the failure panel's own retry) neither dependency changed, the
44
+ * effect never re-ran, and NO listener and no stall timer were ever installed on the node actually
45
+ * on screen. Only "Reload while healthy" — where `key` remounts the guest in the same commit the
46
+ * effect follows — attached them, which is the path that needs recovery least. The hook was right
47
+ * in form and wrong in binding: its own doc said the listeners "must move with" the node, and
48
+ * nothing in its inputs changed when the node appeared. Holding the node in STATE makes it a
49
+ * dependency that really does change on attach, so the effect's lifetime IS the node's.
50
+ *
51
+ * The failure reset is deliberately a SECOND effect keyed on `resetKey` alone. Folding it back into the
52
+ * node-keyed effect looks tidier and reintroduces a worse bug: `failed` going true unmounts the
53
+ * guest, which fires `guestRef(null)`, which would re-run a combined effect and clear the very
54
+ * flag that unmounted it — the guest remounts, fails again, and the panel flickers forever.
55
+ *
56
+ * **`loaded` is the third flag, added alongside `failed`/`stalled` for the same reason those two
57
+ * exist: "the guest is mounted" is not "the admin is on screen".** Before it, a fresh guest gave
58
+ * the operator nothing to look at from the moment it mounted until either `did-finish-load` swapped
59
+ * in real content or `STALL_TIMEOUT_MS` ran out and guessed something was wrong — a blank pane for
60
+ * up to 8 seconds on every ordinary open, indistinguishable from a hang. `loaded` is what a caller
61
+ * checks to show its OWN "still loading" state in that window, instead of leaving it silent.
62
+ * `true` only once `did-finish-load` has actually fired for the CURRENT `resetKey`; it resets to
63
+ * `false` in lockstep with `failed`/`stalled` so a remount, a view switch, or a soft load all start
64
+ * from "not loaded yet" rather than carrying over a previous navigation's finished state.
65
+ *
66
+ * @returns `guestRef` alongside the three flags — the caller MUST put it on the `<webview>`; there
67
+ * is no other way for this hook to see the node. `guest` is that node, for the host workspace's
68
+ * history listeners, which need the same lifetime and cannot take a second ref on one element.
69
+ */
70
+ export function useWebviewLoadFailure({ resetKey }, { timers = window } = {}) {
71
+ const [failed, setFailed] = useState(false);
72
+ const [stalled, setStalled] = useState(false);
73
+ const [loaded, setLoaded] = useState(false);
74
+ const [guest, setGuest] = useState(null);
75
+ useEffect(() => {
76
+ // Not read for its value — only for when it changes. `resetKey` is what makes reload and a
77
+ // view switch a clean slate rather than a permanent black mark; without a genuine reference
78
+ // to it here, Biome's exhaustive-deps rule reads the dependency as dead weight and asks to
79
+ // drop it, which would drop the reset along with it.
80
+ resetKey;
81
+ setLoaded(false);
82
+ setFailed(false);
83
+ setStalled(false);
84
+ }, [resetKey]);
85
+ useEffect(() => {
86
+ if (guest === null)
87
+ return undefined;
88
+ // A stopped site can remount a guest without changing resetKey. Reset only on attach:
89
+ // detaching a failed guest must keep the recovery panel's failure flag intact.
90
+ setLoaded(false);
91
+ setStalled(false);
92
+ const STALL_TIMEOUT_MS = 8000;
93
+ const stallTimer = timers.setTimeout(() => setStalled(true), STALL_TIMEOUT_MS);
94
+ const onFailLoad = (event) => {
95
+ if (!event.isMainFrame || event.errorCode === -3)
96
+ return;
97
+ timers.clearTimeout(stallTimer);
98
+ // A fact arriving after a guess: the guess was wrong (or overtaken), so withdraw it rather
99
+ // than leave both true and ask the host's workspace view to decide which one wins.
100
+ setStalled(false);
101
+ setFailed(true);
102
+ };
103
+ const onFinishLoad = () => {
104
+ timers.clearTimeout(stallTimer);
105
+ setFailed(false);
106
+ setStalled(false);
107
+ setLoaded(true);
108
+ };
109
+ guest.addEventListener('did-fail-load', onFailLoad);
110
+ guest.addEventListener('did-finish-load', onFinishLoad);
111
+ return () => {
112
+ timers.clearTimeout(stallTimer);
113
+ guest.removeEventListener('did-fail-load', onFailLoad);
114
+ guest.removeEventListener('did-finish-load', onFinishLoad);
115
+ };
116
+ // `resetKey` as well as the node: a VIEW switch or a soft load navigates the guest that is
117
+ // already mounted, so the node is unchanged and only this re-arms the stall timer for the new
118
+ // navigation. A recovery remount changes both (`key` remounts the element).
119
+ }, [guest, resetKey, timers]);
120
+ return { failed, stalled, loaded, guest, guestRef: setGuest };
121
+ }
122
+ //# sourceMappingURL=use-webview-load-failure.js.map
@@ -22,6 +22,7 @@ export declare function buildPluginCredentialForm({ card, app }: {
22
22
  }, _optional?: {}): SecretCardForm & {
23
23
  preferredFrameSize: readonly [string, string];
24
24
  description: string;
25
+ details: NonNullable<SecretCardForm['details']>;
25
26
  };
26
27
  /** Apply plugin copy to an existing domain form, preserving its fields, update and blank-token rules.
27
28
  * Domain stores remain authoritative for connection validation. @complexity O(f) form fields.
@@ -30,7 +30,7 @@ export function applyPluginCredentialCard({ card, form, app }, _options = {}) {
30
30
  if (!card)
31
31
  return form;
32
32
  const pluginForm = buildPluginCredentialForm({ card, app });
33
- return { ...form, title: pluginForm.title, description: form.description ? `${card.intro ?? ""} ${form.description}`.trim() : pluginForm.description, details: [...(form.details ?? []), ...(pluginForm.details ?? [])],
33
+ return { ...form, title: pluginForm.title, description: form.description ? `${card.intro ?? ""} ${form.description}`.trim() : pluginForm.description, details: [...(form.details ?? []), ...pluginForm.details],
34
34
  fields: form.fields.map(field => field.kind === "string" && field.name === "token" && field.secret ? { ...field, ...(card.keyHint === undefined ? {} : { hint: card.keyHint }) } : field) };
35
35
  }
36
36
  /** API rows have a fixed label; domain owners choose their own connection identity. */
@@ -1,3 +1,5 @@
1
+ import type { HumanConfirmSpec } from '@jini-ai/core/contracts/site/human-confirm';
2
+ import type { SurfaceDetail } from '@jini-ai/core/contracts/cards';
1
3
  import { type ToolDescriptor } from '@jini-ai/core';
2
4
  type ApprovalText = (required: {
3
5
  key: string;
@@ -17,5 +19,13 @@ export declare function toolApprovalPresentation({ descriptor }: {
17
19
  confirmLabel: string;
18
20
  labels: Readonly<Record<string, string>>;
19
21
  };
22
+ /** Shared operator-language presentation for policy approvals and domain-owned tool plans. */
23
+ export declare function toolApprovalConfirmation({ descriptor, input, locale, details, danger }: {
24
+ descriptor: Parameters<typeof toolApprovalPresentation>[0]['descriptor'];
25
+ input: unknown;
26
+ locale: string;
27
+ details?: readonly SurfaceDetail[];
28
+ danger?: boolean;
29
+ }, _options?: {}): HumanConfirmSpec;
20
30
  export {};
21
31
  //# sourceMappingURL=tool-approval.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { approvalText } from '@jini-ai/core/contracts/site/approval-i18n';
1
2
  import { isNonArrayRecord } from '@jini-ai/core';
2
3
  import { surfaceDetailLabel } from './structured-details.js';
3
4
  function nonBlank({ value }, _options = {}) {
@@ -39,4 +40,18 @@ export function toolApprovalPresentation({ descriptor }, { text }) {
39
40
  labels: schemaLabels({ schema: descriptor.inputSchema }, { text }),
40
41
  };
41
42
  }
43
+ /** Shared operator-language presentation for policy approvals and domain-owned tool plans. */
44
+ export function toolApprovalConfirmation({ descriptor, input, locale, details = [], danger = false }, _options = {}) {
45
+ const toolId = descriptor.id;
46
+ const presentation = toolApprovalPresentation({ descriptor }, { text: ({ key }) => approvalText({ locale, key }) });
47
+ return {
48
+ toolId, errorCode: 'TOOL_APPROVAL', title: presentation.title,
49
+ ...(presentation.summary ? { description: presentation.summary } : {}), details, danger,
50
+ detailDisclosure: { label: approvalText({ locale, key: 'Details' }), details: [
51
+ { label: approvalText({ locale, key: 'Input' }), value: input ?? {}, labels: presentation.labels,
52
+ description: `${approvalText({ locale, key: 'Technical name' })}: ${toolId}` },
53
+ ] },
54
+ confirmLabel: presentation.confirmLabel, cancelLabel: approvalText({ locale, key: 'Cancel' }),
55
+ };
56
+ }
42
57
  //# sourceMappingURL=tool-approval.js.map
@@ -1,4 +1,4 @@
1
- import type { MediaProvidersPort } from './ports.js';
1
+ import type { MediaProviderRowsPort, MediaProvidersPort } from './ports.js';
2
2
  import type { MediaProviderMap } from './types.js';
3
3
  export interface FakeMediaProvidersPortOptions {
4
4
  /** Seed daemon-held providers. Defaults to an empty map — REACHED, manages
@@ -24,4 +24,10 @@ export interface FakeMediaProvidersPortOptions {
24
24
  * endpoints.
25
25
  */
26
26
  export declare function createFakeMediaProvidersPort(options?: FakeMediaProvidersPortOptions): MediaProvidersPort;
27
+ /**
28
+ * The per-provider twin of {@link createFakeMediaProvidersPort}, with the same options: a patch
29
+ * merges into one entry and a removal drops one entry, so a test can prove another provider was
30
+ * left alone. `saveError` rejects both writes without persisting.
31
+ */
32
+ export declare function createFakeMediaProviderRowsPort(options?: FakeMediaProvidersPortOptions): MediaProviderRowsPort;
27
33
  //# sourceMappingURL=dependencies.d.ts.map
@@ -27,4 +27,47 @@ export function createFakeMediaProvidersPort(options = {}) {
27
27
  },
28
28
  };
29
29
  }
30
+ /**
31
+ * The per-provider twin of {@link createFakeMediaProvidersPort}, with the same options: a patch
32
+ * merges into one entry and a removal drops one entry, so a test can prove another provider was
33
+ * left alone. `saveError` rejects both writes without persisting.
34
+ */
35
+ export function createFakeMediaProviderRowsPort(options = {}) {
36
+ let providers = { ...(options.providers ?? {}) };
37
+ const latencyMs = options.latencyMs ?? 0;
38
+ const delay = fakeLatencyDelay({}, { latencyMs });
39
+ const write = (apply) => {
40
+ if (options.saveError)
41
+ return Promise.reject(new Error(options.saveError));
42
+ apply();
43
+ return delay({ value: { ...providers } });
44
+ };
45
+ return {
46
+ fetchMediaProviders() {
47
+ if (options.unreachable)
48
+ return delay({ value: null });
49
+ return delay({ value: { ...providers } });
50
+ },
51
+ applyProviderChanges({ removes, patches }, _optional = {}) {
52
+ return write(() => {
53
+ const next = { ...providers };
54
+ for (const providerId of removes)
55
+ delete next[providerId];
56
+ for (const { providerId, fields } of patches)
57
+ next[providerId] = { ...next[providerId], ...fields };
58
+ providers = next;
59
+ });
60
+ },
61
+ patchProvider({ providerId, fields }) {
62
+ return write(() => {
63
+ providers = { ...providers, [providerId]: { ...providers[providerId], ...fields } };
64
+ });
65
+ },
66
+ removeProvider({ providerId }) {
67
+ return write(() => {
68
+ providers = Object.fromEntries(Object.entries(providers).filter(([id]) => id !== providerId));
69
+ });
70
+ },
71
+ };
72
+ }
30
73
  //# sourceMappingURL=dependencies.js.map
@@ -1,6 +1,6 @@
1
1
  export { DEFAULT_MEDIA_PROVIDER_CATALOG } from './constants.js';
2
- export { createFakeMediaProvidersPort, type FakeMediaProvidersPortOptions } from './dependencies.js';
3
- export type { MediaProvidersPort, MediaProviderCatalogPolicy } from './ports.js';
2
+ export { createFakeMediaProviderRowsPort, createFakeMediaProvidersPort, type FakeMediaProvidersPortOptions } from './dependencies.js';
3
+ export type { AnyMediaProvidersPort, MediaProviderFields, MediaProviderRowsPort, MediaProvidersPort, MediaProviderCatalogPolicy } from './ports.js';
4
4
  export { hasAnyConfiguredProvider, hasRecoverableFields, isEntryEmpty, isEntryPresent, isMarkerOnlyEntry, maskedKeyLabel, mergeDaemonProviders, resolveProviderBaseUrl, shouldSyncLocalProvidersToDaemon, sortProvidersByConfigured, isProviderBaseUrlInvalid, invalidBaseUrlProviderIds, } from './rules.js';
5
5
  export type { MediaProviderCredentials, MediaProviderMap, MediaProviderOption, MediaProvidersLoadState, MediaProvidersSaveState, } from './types.js';
6
6
  export { useMediaProvidersTab } from './react/hooks/useMediaProvidersTab.js';
@@ -1,5 +1,5 @@
1
1
  export { DEFAULT_MEDIA_PROVIDER_CATALOG } from './constants.js';
2
- export { createFakeMediaProvidersPort } from './dependencies.js';
2
+ export { createFakeMediaProviderRowsPort, createFakeMediaProvidersPort } from './dependencies.js';
3
3
  export { hasAnyConfiguredProvider, hasRecoverableFields, isEntryEmpty, isEntryPresent, isMarkerOnlyEntry, maskedKeyLabel, mergeDaemonProviders, resolveProviderBaseUrl, shouldSyncLocalProvidersToDaemon, sortProvidersByConfigured, isProviderBaseUrlInvalid, invalidBaseUrlProviderIds, } from './rules.js';
4
4
  export { useMediaProvidersTab } from './react/hooks/useMediaProvidersTab.js';
5
5
  export { MediaProvidersTab } from './react/components/MediaProvidersTab.js';
@@ -1,6 +1,6 @@
1
1
  /** Catalog policy is UI-owned; the shared contract lives once in core. */
2
2
  export type { MediaProviderCatalogPolicy } from '@jini-ai/core';
3
- import type { MediaProviderMap } from './types.js';
3
+ import type { MediaProviderCredentials, MediaProviderMap } from './types.js';
4
4
  /**
5
5
  * The daemon-side transport this tab needs: reading the server's current
6
6
  * provider credentials and persisting the operator's local edits back to it.
@@ -43,11 +43,45 @@ export interface MediaProvidersPort {
43
43
  * build each payload when it is sent rather than when it is queued
44
44
  * (`useMediaProvidersTab`'s `persist`/`flushNow` is the reference).
45
45
  *
46
- * Adding an expected-revision parameter would let the host reject staleness
47
- * outright, but this port is host-implemented, so that is a breaking change
48
- * and deliberately not taken; caller-side serialization closes the same race
49
- * without one.
46
+ * Serialization only orders THIS tab's writes. A whole map from a tab opened
47
+ * earlier still omits a key another window saved since, and omission deletes.
48
+ * A host keeps this shape only if it can make the write conditional on what
49
+ * the tab last read (its last-read revision) and refuse a stale one; otherwise
50
+ * it implements {@link MediaProviderRowsPort} instead, which never needs one.
50
51
  */
51
52
  saveMediaProviders(providers: MediaProviderMap): Promise<MediaProviderMap>;
52
53
  }
54
+ /** The operator-editable fields of one provider; server markers never travel back. An omitted `apiKey` keeps the stored key. */
55
+ export type MediaProviderFields = Pick<MediaProviderCredentials, 'apiKey' | 'baseUrl' | 'model'>;
56
+ /**
57
+ * The per-provider alternative to {@link MediaProvidersPort}: the same read, and one write per
58
+ * provider instead of a whole-map replace. A save sends only the provider that changed and a
59
+ * removal names the provider it removes, so another window's write to a different provider can
60
+ * never be undone by this tab, and deletion is never inferred from a provider's absence.
61
+ *
62
+ * Both writes REJECT on failure and resolve the server's authoritative map afterward (markers only),
63
+ * like `saveMediaProviders`. `useMediaProvidersTab` still issues one write at a time.
64
+ */
65
+ export interface MediaProviderRowsPort {
66
+ /** Same contract as {@link MediaProvidersPort.fetchMediaProviders}, including `null` for unreachable. */
67
+ fetchMediaProviders(): Promise<MediaProviderMap | null>;
68
+ applyProviderChanges(required: {
69
+ removes: readonly string[];
70
+ patches: readonly {
71
+ providerId: string;
72
+ fields: MediaProviderFields;
73
+ }[];
74
+ }, optional?: Record<string, never>): Promise<MediaProviderMap>;
75
+ /** Merges `fields` into one provider's stored credentials; no other provider is touched. */
76
+ patchProvider(required: {
77
+ providerId: string;
78
+ fields: MediaProviderFields;
79
+ }, optional?: Record<string, never>): Promise<MediaProviderMap>;
80
+ /** Deletes exactly one provider's stored credentials. */
81
+ removeProvider(required: {
82
+ providerId: string;
83
+ }, optional?: Record<string, never>): Promise<MediaProviderMap>;
84
+ }
85
+ /** Either transport the media-providers tab can drive. */
86
+ export type AnyMediaProvidersPort = MediaProvidersPort | MediaProviderRowsPort;
53
87
  //# sourceMappingURL=ports.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import { useT } from '../../../i18n/index.js';
2
- import type { MediaProviderCatalogPolicy, MediaProvidersPort } from '../../ports.js';
2
+ import type { AnyMediaProvidersPort, MediaProviderCatalogPolicy } from '../../ports.js';
3
3
  import type { MediaProviderMap, MediaProviderOption } from '../../types.js';
4
4
  import { useMediaProvidersTab } from '../hooks/useMediaProvidersTab.js';
5
5
  import { useMediaProviderKeyVisibility } from './MediaProvidersTab.hooks.js';
@@ -34,7 +34,8 @@ export interface MediaProvidersTabLabels {
34
34
  saveErrorLabel?: string;
35
35
  }
36
36
  export interface MediaProvidersTabProps {
37
- port: MediaProvidersPort;
37
+ /** A whole-map `MediaProvidersPort` or a per-provider `MediaProviderRowsPort`. */
38
+ port: AnyMediaProvidersPort;
38
39
  /** Host-owned provider catalog and its matching identity policy. */
39
40
  catalog: readonly MediaProviderOption[];
40
41
  catalogPolicy: MediaProviderCatalogPolicy;
@@ -51,7 +52,7 @@ export interface MediaProvidersTabProps {
51
52
  * provider's own catalog id via `buildAgentListHandles`. */
52
53
  agentHandle?: string;
53
54
  useTHook?: typeof useT;
54
- useMediaProvidersTabHook?: typeof useMediaProvidersTab;
55
+ useMediaProvidersTabHook: typeof useMediaProvidersTab;
55
56
  useMediaProviderKeyVisibilityHook?: typeof useMediaProviderKeyVisibility;
56
57
  }
57
58
  /**
@@ -16,7 +16,7 @@ import { resolveMediaProvidersTabLabels } from './media-providers-tab-labels.js'
16
16
  * decorations outside this package's boundary; see `MediaProviderOption`'s
17
17
  * doc and this tab's `ports.ts` header for the full provenance note.
18
18
  */
19
- export function MediaProvidersTab({ port, catalog, catalogPolicy, initialProviders, pinnedProviderIds, labels, agentHandle, useTHook = useT, useMediaProvidersTabHook = useMediaProvidersTab, useMediaProviderKeyVisibilityHook = useMediaProviderKeyVisibility, }) {
19
+ export function MediaProvidersTab({ port, catalog, catalogPolicy, initialProviders, pinnedProviderIds, labels, agentHandle, useTHook = useT, useMediaProvidersTabHook, useMediaProviderKeyVisibilityHook = useMediaProviderKeyVisibility, }) {
20
20
  const t = useTHook();
21
21
  const { providers, load, save, hasAnyConfigured, pendingProviderIds, updateProvider, clearProvider, saveChanges, reload } = useMediaProvidersTabHook({ port, catalogPolicy, initialProviders });
22
22
  const { canonicalMediaProviderId } = catalogPolicy;
@@ -1,4 +1,4 @@
1
- import type { MediaProviderCatalogPolicy, MediaProvidersPort } from '../../ports.js';
1
+ import type { AnyMediaProvidersPort, MediaProviderCatalogPolicy } from '../../ports.js';
2
2
  import type { MediaProviderCredentials, MediaProviderMap, MediaProvidersLoadState, MediaProvidersSaveState } from '../../types.js';
3
3
  /** The operator-editable fields of a provider entry. Server markers
4
4
  * (`apiKeyConfigured`/`apiKeyTail`) are deliberately excluded — they only
@@ -7,7 +7,8 @@ import type { MediaProviderCredentials, MediaProviderMap, MediaProvidersLoadStat
7
7
  * distinction this narrows around. */
8
8
  export type MediaProviderEditPatch = Pick<MediaProviderCredentials, 'apiKey' | 'baseUrl' | 'model'>;
9
9
  export interface UseMediaProvidersTabOptions {
10
- port: MediaProvidersPort;
10
+ /** A whole-map `MediaProvidersPort`, or a per-provider `MediaProviderRowsPort` (see `sendProviders`). */
11
+ port: AnyMediaProvidersPort;
11
12
  /** Identity rules shared by catalog rows, local edits and daemon responses. Stable while mounted. */
12
13
  catalogPolicy: MediaProviderCatalogPolicy;
13
14
  /** Host-persisted local edits from before this tab mounted (e.g. the
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useEffect, useRef, useState } from 'react';
2
- import { hasAnyConfiguredProvider, isEntryEmpty, mergeDaemonProviders, shouldSyncLocalProvidersToDaemon, } from '../../rules.js';
2
+ import { hasAnyConfiguredProvider, hasRecoverableFields, isEntryEmpty, mergeDaemonProviders, shouldSyncLocalProvidersToDaemon, } from '../../rules.js';
3
3
  /**
4
4
  * Releases the tombstones a successful write carried. The server has now accepted a map without
5
5
  * these, so the local absence is no longer a claim waiting to be defended — the daemon agrees.
@@ -24,6 +24,38 @@ function overlayTouchedProviders({ saved, local, touched, }) {
24
24
  }
25
25
  return saved;
26
26
  }
27
+ /** The operator-editable fields of one entry, without server markers; an absent field is left out, so the host keeps it. */
28
+ function editableFields({ entry }) {
29
+ return {
30
+ ...(entry.apiKey === undefined ? {} : { apiKey: entry.apiKey }),
31
+ ...(entry.baseUrl === undefined ? {} : { baseUrl: entry.baseUrl }),
32
+ ...(entry.model === undefined ? {} : { model: entry.model }),
33
+ };
34
+ }
35
+ /**
36
+ * Sends one write's worth of changes and resolves the server's resulting map. A whole-map port gets
37
+ * the send-time map, as it always has. A per-provider port gets one batch of explicit changes:
38
+ * a removal for each clear this write carries, and a patch for each pending provider that still
39
+ * has an entry.
40
+ *
41
+ * A provider missing from the local map is NOT removed unless the operator cleared it. Map omission
42
+ * is not evidence of intent to delete: an edit can empty an entry that was never saved, and a map
43
+ * read before another window's save simply never contained that provider. Only an explicit Clear
44
+ * says "delete this one", so only a clear becomes a removal.
45
+ */
46
+ async function sendProviders({ port, sent, clears, pending }) {
47
+ // A whole-map port has no `patchProvider`; `in` narrows the union to the per-provider shape.
48
+ if (!('patchProvider' in port))
49
+ return port.saveMediaProviders(sent);
50
+ const patches = pending.flatMap(providerId => {
51
+ const entry = sent[providerId];
52
+ return entry === undefined ? [] : [{ providerId, fields: editableFields({ entry }) }];
53
+ });
54
+ // Nothing changed: the local map is already what the server holds for this write.
55
+ if (clears.length === 0 && patches.length === 0)
56
+ return sent;
57
+ return port.applyProviderChanges({ removes: clears, patches });
58
+ }
27
59
  /** A save rejection as display text; a non-`Error` rejection is stringified rather than read as `.message`. */
28
60
  function saveErrorMessage({ error }) {
29
61
  return error instanceof Error ? error.message : String(error);
@@ -131,7 +163,7 @@ export function useMediaProvidersTab({ port, catalogPolicy, initialProviders })
131
163
  // request never told the server about it.
132
164
  const clearsInFlight = [...clearedProviderIds.current].filter((providerId) => sent[providerId] === undefined);
133
165
  try {
134
- const saved = await portRef.current.saveMediaProviders(sent);
166
+ const saved = await sendProviders({ port: portRef.current, sent, clears: clearsInFlight, pending: [...pendingRef.current] });
135
167
  if (!alive.current)
136
168
  return { status: 'abandoned' };
137
169
  const touched = mutatedSinceSend.current;
@@ -228,10 +260,16 @@ export function useMediaProvidersTab({ port, catalogPolicy, initialProviders })
228
260
  applyProviders(merged);
229
261
  setLoad({ status: 'ok' });
230
262
  if (migrateOnFirstUpload && shouldSyncLocalProvidersToDaemon({ localProviders: localBeforeMerge, daemonProviders: daemonResult })) {
263
+ // A per-provider port uploads only pending providers, so the migration marks the ones with
264
+ // something to upload; a whole-map port sends the entire map regardless.
265
+ if ('patchProvider' in portRef.current) {
266
+ const uploadable = Object.keys(merged).filter((providerId) => hasRecoverableFields({ entry: merged[providerId] }));
267
+ applyPending(new Set([...pendingRef.current, ...uploadable]));
268
+ }
231
269
  void persist();
232
270
  }
233
271
  });
234
- }, [persist, applyProviders, normalizeMediaProviderMap]);
272
+ }, [persist, applyProviders, applyPending, normalizeMediaProviderMap]);
235
273
  useEffect(() => {
236
274
  // Mount (or host-supplied port swap): migration is a one-time boot
237
275
  // check, matching the origin's App.tsx boot sequence — a manual
@@ -65,7 +65,7 @@ function MemoryConnectorRow({ connector, context, toggleConnectorSelection, onCo
65
65
  }
66
66
  function MemoryConnectedSummary({ connectorsLoading, connectedCount, onOpenConnectors, useTHook = useT, }) {
67
67
  const t = useTHook();
68
- return (_jsxs("div", { className: "jini-memory-source-summary jini-memory-connected-summary", children: [_jsx("span", { className: "jini-memory-block-icon", children: _jsx(Icon, { name: "link", size: 15 }) }), _jsxs("div", { children: [_jsx("h4", { children: t('Import from apps') }), _jsx("p", { className: "hint", children: t('Choose apps to scan for design preferences, project context, and visual references. Nothing is scanned until you select an app.') })] }), _jsx("span", { className: "memory-source-badge", children: connectorsLoading ? t('Loading') : `${connectedCount} ${t('connected')}` }), _jsx("button", { type: "button", className: "ghost memory-source-action", onClick: onOpenConnectors, disabled: !onOpenConnectors, children: t('Manage') })] }));
68
+ return (_jsxs("div", { className: "jini-memory-source-summary jini-memory-connected-summary", children: [_jsx("span", { className: "jini-memory-block-icon", children: _jsx(Icon, { name: "link", size: 15 }) }), _jsxs("div", { children: [_jsx("h4", { children: t('Import from apps') }), _jsx("p", { className: "hint", children: t('Choose apps to scan for design preferences, project context, and visual references. Nothing is scanned until you select an app.') })] }), _jsx("span", { className: "jini-ui-memory-source-badge", children: connectorsLoading ? t('Loading') : `${connectedCount} ${t('connected')}` }), _jsx("button", { type: "button", className: "ghost memory-source-action", onClick: onOpenConnectors, disabled: !onOpenConnectors, children: t('Manage') })] }));
69
69
  }
70
70
  function MemoryConnectorRunBar({ enabled, connectorExtracting, connectorSaving, connectedCount, selectedCount, connectorScanLabel, onSuggestConnectorMemory, useTHook = useT, }) {
71
71
  const t = useTHook();
@@ -81,7 +81,7 @@ function MemoryScanHistory({ connectorExtractions, nowClock, onOpenPreview, onDe
81
81
  }
82
82
  function MemoryConnectorPickerHead({ selectedCount, useTHook = useT }) {
83
83
  const t = useTHook();
84
- return (_jsxs("div", { className: "jini-memory-connector-picker-head", children: [_jsxs("div", { children: [_jsx("h4", { children: t('Choose sources') }), _jsx("p", { className: "hint", children: t('Select connected apps first. Only the apps you choose are scanned.') })] }), _jsxs("span", { className: "memory-source-badge", children: [selectedCount, " ", t('selected')] })] }));
84
+ return (_jsxs("div", { className: "jini-memory-connector-picker-head", children: [_jsxs("div", { children: [_jsx("h4", { children: t('Choose sources') }), _jsx("p", { className: "hint", children: t('Select connected apps first. Only the apps you choose are scanned.') })] }), _jsxs("span", { className: "jini-ui-memory-source-badge", children: [selectedCount, " ", t('selected')] })] }));
85
85
  }
86
86
  function MemoryConnectorWorkbench({ useTHook = useT, ...props }) {
87
87
  const t = useTHook();
@@ -5,7 +5,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  // scoped-down local reimplementation of OD's `runtime/markdown.tsx` (2,881
6
6
  // lines, chat/artifact-rendering territory, explicitly deferred to
7
7
  // `@jini-ai/chat`'s `./react` subpath (formerly this package's own `./chat` export, extracted
8
- // 2026-08-03)/this package's own `./renderers` subpath — see `archived UI source map`)
8
+ // 2026-08-03)/this package's own `./renderers` subpath — see `070311a07^:packages/ui/source-map.md` (section "features/memory/"))
9
9
  // — just enough to render a saved memory's plain-text/Markdown body safely.
10
10
  import { agentHandleProps } from '@jini-ai/core/agent-handles';
11
11
  import { Icon } from '../../../../react/components/Icon.js';
@@ -12,7 +12,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  // the reload()/SSE wiring; this panel is presentational and calls the passed
13
13
  // toggle callbacks. Folded into this slice from OD's separate
14
14
  // `components/MemoryHooksPanel.tsx` (single consumer, `MemoryHowPanel`) — see
15
- // `archived UI source map`.
15
+ // `070311a07^:packages/ui/source-map.md` (section "features/memory/").
16
16
  import { agentHandleProps } from '@jini-ai/core/agent-handles';
17
17
  import { Icon } from '../../../../react/components/Icon.js';
18
18
  import { useT } from '../../../i18n/index.js';
@@ -48,6 +48,6 @@ const HOOKS = [
48
48
  ];
49
49
  export function MemoryHooksPanel({ enabled, flags, onToggle, agentHandle, useTHook = useT, }) {
50
50
  const t = useTHook();
51
- return (_jsxs("div", { className: "memory-hooks-panel", "data-testid": "memory-hooks-panel", children: [_jsxs("div", { className: "memory-hooks-panel-head", children: [_jsx("span", { className: "memory-hooks-panel-head-icon", "aria-hidden": "true", children: _jsx(Icon, { name: "sliders", size: 15 }) }), _jsxs("div", { children: [_jsx("h4", { className: "memory-hooks-panel-title", children: t('Memory hooks') }), _jsx("p", { className: "memory-hooks-panel-hint", children: t('Fine-tune how memory is captured and used, without turning it off entirely.') })] })] }), _jsx("ul", { className: "memory-hooks-panel-list", children: HOOKS.map((hook) => (_jsxs("li", { className: "memory-hooks-panel-row", children: [_jsx("span", { className: "memory-hooks-panel-row-icon", "aria-hidden": "true", children: _jsx(Icon, { name: hook.icon, size: 14 }) }), _jsxs("span", { className: "memory-hooks-panel-row-copy", children: [_jsx("span", { className: "memory-hooks-panel-row-label", children: t(hook.label) }), _jsx("small", { className: "memory-hooks-panel-row-desc", children: t(hook.description) })] }), _jsx("label", { className: "memory-hooks-panel-toggle", title: t(hook.label), children: _jsxs("span", { className: "toggle-switch toggle-switch-sm", children: [_jsx("input", { type: "checkbox", "aria-label": t(hook.label), checked: flags[hook.key], disabled: !enabled, onChange: (e) => onToggle(hook.key, e.target.checked), ...agentHandleProps({}, { base: agentHandle, ...({ action: `hook-${hook.action}`, role: 'checkbox', label: t(hook.label) }) }) }), _jsx("span", { className: "toggle-slider" })] }) })] }, hook.key))) })] }));
51
+ return (_jsxs("div", { className: "jini-ui-memory-hooks-panel", "data-testid": "memory-hooks-panel", children: [_jsxs("div", { className: "jini-ui-memory-hooks-panel-head", children: [_jsx("span", { className: "jini-ui-memory-hooks-panel-head-icon", "aria-hidden": "true", children: _jsx(Icon, { name: "sliders", size: 15 }) }), _jsxs("div", { children: [_jsx("h4", { className: "jini-ui-memory-hooks-panel-title", children: t('Memory hooks') }), _jsx("p", { className: "jini-ui-memory-hooks-panel-hint", children: t('Fine-tune how memory is captured and used, without turning it off entirely.') })] })] }), _jsx("ul", { className: "jini-ui-memory-hooks-panel-list", children: HOOKS.map((hook) => (_jsxs("li", { className: "jini-ui-memory-hooks-panel-row", children: [_jsx("span", { className: "jini-ui-memory-hooks-panel-row-icon", "aria-hidden": "true", children: _jsx(Icon, { name: hook.icon, size: 14 }) }), _jsxs("span", { className: "jini-ui-memory-hooks-panel-row-copy", children: [_jsx("span", { className: "jini-ui-memory-hooks-panel-row-label", children: t(hook.label) }), _jsx("small", { className: "jini-ui-memory-hooks-panel-row-desc", children: t(hook.description) })] }), _jsx("label", { className: "jini-ui-memory-hooks-panel-toggle", title: t(hook.label), children: _jsxs("span", { className: "jini-ui-toggle-switch jini-ui-toggle-switch-sm", children: [_jsx("input", { type: "checkbox", "aria-label": t(hook.label), checked: flags[hook.key], disabled: !enabled, onChange: (e) => onToggle(hook.key, e.target.checked), ...agentHandleProps({}, { base: agentHandle, ...({ action: `hook-${hook.action}`, role: 'checkbox', label: t(hook.label) }) }) }), _jsx("span", { className: "jini-ui-toggle-slider" })] }) })] }, hook.key))) })] }));
52
52
  }
53
53
  //# sourceMappingURL=MemoryHooksPanel.js.map