@kortix/ui 0.14.8 → 0.14.10

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 (567) hide show
  1. package/README.md +2 -2
  2. package/dist/_vendor/kortix-shared.js +116 -3
  3. package/dist/_vendor/shared/app-config.d.ts +175 -0
  4. package/dist/_vendor/shared/artifact-comments.d.ts +235 -0
  5. package/dist/_vendor/shared/channel-descriptors.d.ts +96 -0
  6. package/dist/_vendor/shared/channel-message.d.ts +45 -5
  7. package/dist/_vendor/shared/index.d.ts +2 -0
  8. package/dist/_vendor/shared/space-slug.d.ts +37 -0
  9. package/dist/access/access/access-detail-shell.js +1 -1
  10. package/dist/access/access/principal-picker.d.ts +11 -0
  11. package/dist/access/access/principal-picker.js +3 -2
  12. package/dist/apps/app-preview-pool.d.ts +7 -2
  13. package/dist/apps/app-preview-pool.js +30 -7
  14. package/dist/apps/app-shared.d.ts +22 -15
  15. package/dist/apps/app-shared.js +37 -19
  16. package/dist/apps/index.d.ts +2 -2
  17. package/dist/apps/index.js +2 -2
  18. package/dist/artifacts/artifact-frame.d.ts +16 -0
  19. package/dist/artifacts/artifact-frame.js +55 -0
  20. package/dist/artifacts/artifact-session.d.ts +18 -0
  21. package/dist/artifacts/artifact-session.js +101 -0
  22. package/dist/artifacts/frame-policy.d.ts +30 -0
  23. package/dist/artifacts/frame-policy.js +61 -0
  24. package/dist/artifacts/index.d.ts +3 -0
  25. package/dist/artifacts/index.js +5 -0
  26. package/dist/browser/sandbox-browser-chrome.d.ts +4 -1
  27. package/dist/browser/sandbox-browser-chrome.js +2 -2
  28. package/dist/customize/agents/agent-grant-pages.d.ts +5 -1
  29. package/dist/customize/agents/agent-grant-pages.js +30 -4
  30. package/dist/customize/agents/agent-page.js +3 -1
  31. package/dist/customize/agents/agent-policy-sets.d.ts +43 -0
  32. package/dist/customize/agents/agent-policy-sets.js +72 -0
  33. package/dist/customize/agents/agent-triggers-section.js +2 -1
  34. package/dist/customize/connectors/add-mcp/add-mcp-server-dialog.d.ts +6 -1
  35. package/dist/customize/connectors/add-mcp/add-mcp-server-dialog.js +10 -4
  36. package/dist/customize/connectors/agent-access.d.ts +35 -0
  37. package/dist/customize/connectors/agent-access.js +77 -0
  38. package/dist/customize/connectors/catalog/browse-sections.d.ts +2 -29
  39. package/dist/customize/connectors/catalog/browse-sections.js +7 -74
  40. package/dist/customize/connectors/catalog/catalog-entry.d.ts +18 -37
  41. package/dist/customize/connectors/catalog/catalog-entry.js +28 -40
  42. package/dist/customize/connectors/catalog/connector-browse.d.ts +3 -32
  43. package/dist/customize/connectors/catalog/connector-browse.js +19 -50
  44. package/dist/customize/connectors/catalog/use-catalog.d.ts +20 -59
  45. package/dist/customize/connectors/catalog/use-catalog.js +48 -175
  46. package/dist/customize/connectors/connector-identity.d.ts +9 -11
  47. package/dist/customize/connectors/connector-identity.js +13 -42
  48. package/dist/customize/connectors/connector-moves-banner.d.ts +2 -1
  49. package/dist/customize/connectors/connector-moves-banner.js +4 -6
  50. package/dist/customize/connectors/connector-routes.d.ts +21 -9
  51. package/dist/customize/connectors/connector-routes.js +29 -20
  52. package/dist/customize/connectors/connectors-page.js +53 -82
  53. package/dist/customize/connectors/detail/app-page.js +226 -98
  54. package/dist/customize/connectors/detail/computer-app-page.d.ts +16 -0
  55. package/dist/customize/connectors/detail/computer-app-page.js +39 -0
  56. package/dist/customize/connectors/detail/connector-accounts.js +3 -1
  57. package/dist/customize/connectors/detail/connector-advanced-tools.d.ts +4 -1
  58. package/dist/customize/connectors/detail/connector-advanced-tools.js +2 -2
  59. package/dist/customize/connectors/detail/connector-agents.d.ts +14 -0
  60. package/dist/customize/connectors/detail/connector-agents.js +69 -0
  61. package/dist/customize/connectors/detail/connector-detail-tabs.js +2 -1
  62. package/dist/customize/connectors/detail/connector-move-row.d.ts +8 -5
  63. package/dist/customize/connectors/detail/connector-move-row.js +23 -14
  64. package/dist/customize/connectors/detail/connector-page.d.ts +4 -1
  65. package/dist/customize/connectors/detail/connector-page.js +14 -10
  66. package/dist/customize/connectors/detail/connector-policy-sets.d.ts +28 -0
  67. package/dist/customize/connectors/detail/connector-policy-sets.js +203 -0
  68. package/dist/customize/connectors/detail/connector-settings.d.ts +4 -1
  69. package/dist/customize/connectors/detail/connector-settings.js +7 -3
  70. package/dist/customize/connectors/detail/connector-status.d.ts +19 -6
  71. package/dist/customize/connectors/detail/connector-status.js +34 -10
  72. package/dist/customize/connectors/detail/connector-tabs.d.ts +4 -1
  73. package/dist/customize/connectors/detail/connector-tabs.js +8 -2
  74. package/dist/customize/connectors/detail/connector-tools.d.ts +3 -3
  75. package/dist/customize/connectors/detail/connector-tools.js +105 -48
  76. package/dist/customize/connectors/detail/email-inboxes.d.ts +43 -0
  77. package/dist/customize/connectors/detail/email-inboxes.js +184 -0
  78. package/dist/customize/connectors/detail/provider-info.d.ts +1 -1
  79. package/dist/customize/connectors/detail/provider-info.js +2 -2
  80. package/dist/customize/connectors/detail/status-badge.d.ts +1 -1
  81. package/dist/customize/connectors/detail/status-badge.js +4 -5
  82. package/dist/customize/connectors/detail/use-connector-detail.d.ts +6 -0
  83. package/dist/customize/connectors/detail/use-connector-detail.js +14 -4
  84. package/dist/customize/connectors/install/install-dialog.d.ts +23 -0
  85. package/dist/customize/connectors/install/install-dialog.js +40 -0
  86. package/dist/customize/connectors/install/install.d.ts +13 -2
  87. package/dist/customize/connectors/install/install.js +9 -4
  88. package/dist/customize/connectors/install/use-install.d.ts +19 -2
  89. package/dist/customize/connectors/install/use-install.js +65 -37
  90. package/dist/customize/connectors/install/way-kind.d.ts +5 -0
  91. package/dist/customize/connectors/install/way-kind.js +16 -0
  92. package/dist/customize/connectors/provider-label.d.ts +2 -1
  93. package/dist/customize/connectors/provider-label.js +13 -3
  94. package/dist/customize/connectors/tools/pattern-rule-draft.d.ts +4 -0
  95. package/dist/customize/connectors/tools/pattern-rule-draft.js +12 -3
  96. package/dist/customize/connectors/tools/policy-sets.d.ts +27 -0
  97. package/dist/customize/connectors/tools/policy-sets.js +41 -0
  98. package/dist/customize/connectors/tools/tool-groups.d.ts +32 -9
  99. package/dist/customize/connectors/tools/tool-groups.js +78 -16
  100. package/dist/customize/connectors/tools/tool-policy-control.d.ts +11 -10
  101. package/dist/customize/connectors/tools/tool-policy-control.js +15 -16
  102. package/dist/customize/connectors/tools/tool-policy-labels.d.ts +6 -5
  103. package/dist/customize/connectors/tools/tool-policy-labels.js +17 -16
  104. package/dist/customize/connectors/tools/tool-policy.d.ts +50 -4
  105. package/dist/customize/connectors/tools/tool-policy.js +74 -8
  106. package/dist/customize/connectors/use-agent-access.d.ts +85 -0
  107. package/dist/customize/connectors/use-agent-access.js +72 -0
  108. package/dist/customize/migrate-to-v2/index.d.ts +1 -2
  109. package/dist/customize/migrate-to-v2/index.js +1 -2
  110. package/dist/customize/migrate-to-v2/migration-prompt.d.ts +12 -25
  111. package/dist/customize/migrate-to-v2/migration-prompt.js +34 -236
  112. package/dist/customize/migrate-to-v2/upgrade-defs.d.ts +1 -1
  113. package/dist/customize/migrate-to-v2/upgrade-defs.js +7 -6
  114. package/dist/customize/migrate-to-v2/upgrade-view.js +7 -7
  115. package/dist/customize/migrate-to-v2/use-run-upgrade.d.ts +3 -3
  116. package/dist/customize/providers/provider-accordion.js +17 -2
  117. package/dist/customize/sections/component/channel-access-panel.d.ts +16 -0
  118. package/dist/customize/sections/component/channel-access-panel.js +146 -0
  119. package/dist/customize/sections/component/channel-connect-hero.d.ts +3 -2
  120. package/dist/customize/sections/component/channel-connect-hero.js +3 -2
  121. package/dist/customize/sections/component/channel-hero-frame.d.ts +31 -0
  122. package/dist/customize/sections/component/channel-hero-frame.js +40 -0
  123. package/dist/customize/sections/component/channel-mocks.d.ts +6 -0
  124. package/dist/customize/sections/component/channel-mocks.js +46 -0
  125. package/dist/customize/sections/component/channel-row.d.ts +13 -3
  126. package/dist/customize/sections/component/channel-row.js +10 -4
  127. package/dist/customize/sections/component/email-connect-form.d.ts +27 -0
  128. package/dist/customize/sections/component/email-connect-form.js +183 -0
  129. package/dist/customize/sections/component/slack-connect-card.d.ts +7 -0
  130. package/dist/customize/sections/component/slack-connect-card.js +2 -3
  131. package/dist/customize/sections/component/teams-connect-card.d.ts +7 -0
  132. package/dist/customize/sections/component/teams-connect-card.js +2 -3
  133. package/dist/customize/sections/component/telegram-channel-row.js +21 -28
  134. package/dist/customize/sections/connectors-view.d.ts +1 -15
  135. package/dist/customize/sections/connectors-view.js +81 -314
  136. package/dist/customize/sections/view/agent-editor-catalog.js +10 -0
  137. package/dist/customize/sections/view/channels-view.d.ts +6 -1
  138. package/dist/customize/sections/view/channels-view.js +72 -81
  139. package/dist/customize/sections/view/gateway/gateway-overview.js +10 -2
  140. package/dist/customize/settings/rail.js +9 -0
  141. package/dist/customize/settings/settings-tabs.d.ts +1 -1
  142. package/dist/customize/settings/settings-tabs.js +1 -0
  143. package/dist/customize/settings/tabs/chrome-connections-tab.d.ts +6 -0
  144. package/dist/customize/settings/tabs/chrome-connections-tab.js +99 -0
  145. package/dist/customize/settings/tabs/experimental-tab.js +35 -16
  146. package/dist/customize/shared/catalog/catalog-empty-state.d.ts +4 -15
  147. package/dist/customize/shared/catalog/catalog-empty-state.js +9 -7
  148. package/dist/customize/shared/channels-switch-dialog.d.ts +18 -0
  149. package/dist/customize/shared/channels-switch-dialog.js +30 -0
  150. package/dist/customize/shared/feature-gate-screen.js +27 -9
  151. package/dist/customize/shared/use-customize-prefetch.d.ts +2 -3
  152. package/dist/customize/shared/use-customize-prefetch.js +9 -27
  153. package/dist/customize/triggers/schedule/post-to-field.d.ts +18 -0
  154. package/dist/customize/triggers/schedule/post-to-field.js +49 -0
  155. package/dist/customize/triggers/schedule/schedule-copy.d.ts +10 -6
  156. package/dist/customize/triggers/schedule/schedule-copy.js +42 -11
  157. package/dist/customize/triggers/schedule/schedule-detail-sheet.js +2 -1
  158. package/dist/customize/triggers/schedule/trigger-composer-logic.d.ts +22 -0
  159. package/dist/customize/triggers/schedule/trigger-composer-logic.js +25 -0
  160. package/dist/customize/triggers/schedule/trigger-composer.d.ts +5 -0
  161. package/dist/customize/triggers/schedule/trigger-composer.js +23 -14
  162. package/dist/customize/triggers/schedule/trigger-edit-logic.js +3 -0
  163. package/dist/customize/triggers/schedule/trigger-filter.js +1 -1
  164. package/dist/customize/triggers/schedule/trigger-runs-logic.d.ts +2 -2
  165. package/dist/customize/triggers/schedule/trigger-runs-panel.js +1 -0
  166. package/dist/customize/triggers/schedule/trigger-toast.js +2 -1
  167. package/dist/customize/triggers/schedule-view.js +5 -2
  168. package/dist/files/index.d.ts +1 -0
  169. package/dist/files/index.js +1 -0
  170. package/dist/files/project/change-request-recovery.d.ts +1 -26
  171. package/dist/files/project/change-request-recovery.js +1 -59
  172. package/dist/files/project/components/change-request-detail-dialog.js +13 -3
  173. package/dist/files/project/components/drive-explorer.js +15 -15
  174. package/dist/files/project/components/drive-toolbar.d.ts +16 -2
  175. package/dist/files/project/components/drive-toolbar.js +14 -5
  176. package/dist/files/project/hooks/use-change-request-recovery.js +3 -19
  177. package/dist/files/project/hooks/use-change-requests.d.ts +1 -0
  178. package/dist/files/project/hooks/use-change-requests.js +11 -2
  179. package/dist/files/renderers/image-frame.d.ts +48 -0
  180. package/dist/files/renderers/image-frame.js +59 -0
  181. package/dist/files/renderers/image-renderer.d.ts +11 -1
  182. package/dist/files/renderers/image-renderer.js +13 -3
  183. package/dist/files/renderers/pdf/pdf-clipboard.d.ts +2 -0
  184. package/dist/files/renderers/pdf/pdf-clipboard.js +21 -0
  185. package/dist/files/renderers/pdf/pdf-viewer.js +4 -2
  186. package/dist/files/renderers/show-content-renderer.d.ts +9 -1
  187. package/dist/files/renderers/show-content-renderer.js +56 -14
  188. package/dist/files/runtime/file-source.js +2 -0
  189. package/dist/files/runtime/hooks/use-binary-blob.d.ts +10 -1
  190. package/dist/files/runtime/hooks/use-binary-blob.js +10 -4
  191. package/dist/files/runtime/hooks/use-shared-image.d.ts +41 -0
  192. package/dist/files/runtime/hooks/use-shared-image.js +177 -0
  193. package/dist/files/viewer/file-content-renderer.d.ts +22 -1
  194. package/dist/files/viewer/file-content-renderer.js +50 -7
  195. package/dist/files/viewer/file-header.d.ts +7 -3
  196. package/dist/files/viewer/file-header.js +20 -11
  197. package/dist/files/viewer/file-preview-modal.d.ts +1 -1
  198. package/dist/files/viewer/file-preview-modal.js +10 -22
  199. package/dist/files/viewer/file-source.d.ts +13 -0
  200. package/dist/files/viewer/use-file-content-state.d.ts +2 -0
  201. package/dist/files/viewer/use-file-content-state.js +28 -10
  202. package/dist/files/viewer/viewer-actions.d.ts +3 -1
  203. package/dist/files/viewer/viewer-actions.js +2 -2
  204. package/dist/hooks/use-media-query.d.ts +1 -0
  205. package/dist/hooks/use-mobile.d.ts +5 -0
  206. package/dist/hooks/use-mobile.js +8 -0
  207. package/dist/i18n/en.d.ts +1062 -85
  208. package/dist/i18n/en.js +1078 -101
  209. package/dist/i18n/ui-catalog/localize-ui-catalog.js +4 -0
  210. package/dist/i18n/ui-catalog/remaining-ui-translation-keys.generated.js +15 -3
  211. package/dist/index.d.ts +2 -2
  212. package/dist/index.js +2 -2
  213. package/dist/internal/account-hub/account-settings-sidebar.js +1 -1
  214. package/dist/internal/account-hub/hub-sheet.d.ts +9 -1
  215. package/dist/internal/account-hub/hub-sheet.js +21 -5
  216. package/dist/internal/account-hub/sections.d.ts +1 -1
  217. package/dist/internal/account-hub/sections.js +2 -1
  218. package/dist/internal/apps-and-extensions/apps-modal.d.ts +9 -0
  219. package/dist/internal/apps-and-extensions/apps-modal.js +107 -0
  220. package/dist/internal/auth/auth-card-shell.js +3 -3
  221. package/dist/internal/chrome/browser-icon.d.ts +24 -0
  222. package/dist/internal/chrome/browser-icon.js +58 -0
  223. package/dist/internal/chrome/chrome-card-state.d.ts +16 -0
  224. package/dist/internal/chrome/chrome-card-state.js +9 -0
  225. package/dist/internal/chrome/chrome-connect.d.ts +69 -0
  226. package/dist/internal/chrome/chrome-connect.js +178 -0
  227. package/dist/internal/chrome/chrome-mock.d.ts +4 -0
  228. package/dist/internal/chrome/chrome-mock.js +15 -0
  229. package/dist/internal/chrome/chrome-names.d.ts +15 -0
  230. package/dist/internal/chrome/chrome-names.js +35 -0
  231. package/dist/internal/chrome/extension.d.ts +47 -0
  232. package/dist/internal/chrome/extension.js +91 -0
  233. package/dist/internal/chrome/use-chrome-offered.d.ts +11 -0
  234. package/dist/internal/chrome/use-chrome-offered.js +22 -0
  235. package/dist/internal/components/agent-mark.js +5 -2
  236. package/dist/internal/connector-logo/connector-logo-source.d.ts +64 -0
  237. package/dist/internal/connector-logo/connector-logo-source.js +49 -0
  238. package/dist/internal/connector-logo/connector-logo.d.ts +39 -0
  239. package/dist/internal/connector-logo/connector-logo.js +56 -0
  240. package/dist/internal/connector-logo/connector-mark-files.d.ts +11 -0
  241. package/dist/internal/connector-logo/connector-mark-files.js +35 -0
  242. package/dist/internal/files/file-read-retry.d.ts +13 -0
  243. package/dist/internal/files/file-read-retry.js +23 -3
  244. package/dist/internal/files/session-drive-files.d.ts +5 -1
  245. package/dist/internal/files/session-drive-files.js +7 -2
  246. package/dist/internal/hooks/channels/use-channels-installations.d.ts +32 -5
  247. package/dist/internal/hooks/channels/use-channels-installations.js +55 -7
  248. package/dist/internal/hooks/channels/use-email-inboxes.d.ts +19 -0
  249. package/dist/internal/hooks/channels/use-email-inboxes.js +48 -0
  250. package/dist/internal/hooks/connectors/use-add-account.js +1 -1
  251. package/dist/internal/hooks/index.d.ts +1 -1
  252. package/dist/internal/hooks/index.js +1 -1
  253. package/dist/internal/hooks/projects/use-new-project-session.d.ts +9 -0
  254. package/dist/internal/hooks/projects/use-new-project-session.js +28 -12
  255. package/dist/internal/hooks/use-auto-scroll.d.ts +8 -1
  256. package/dist/internal/hooks/use-auto-scroll.js +4 -4
  257. package/dist/internal/icons/edge.d.ts +5 -0
  258. package/dist/internal/icons/edge.js +10 -0
  259. package/dist/internal/icons/telegram.d.ts +5 -0
  260. package/dist/internal/icons/telegram.js +6 -1
  261. package/dist/internal/layout/nav-hover-card.d.ts +35 -0
  262. package/dist/internal/layout/nav-hover-card.js +84 -0
  263. package/dist/internal/layout/project-nav-row.d.ts +3 -1
  264. package/dist/internal/layout/project-nav-row.js +3 -2
  265. package/dist/internal/layout/project-page-header.d.ts +4 -2
  266. package/dist/internal/layout/project-page-header.js +4 -3
  267. package/dist/internal/layout/project-settings-nav.js +59 -2
  268. package/dist/internal/lib/browser-error-noise.d.ts +1 -1
  269. package/dist/internal/lib/browser-error-noise.js +1 -1
  270. package/dist/internal/lib/browser-noise/rules/extensions.js +17 -3
  271. package/dist/internal/lib/browser-noise/rules/injected-scripts.d.ts +7 -0
  272. package/dist/internal/lib/browser-noise/rules/injected-scripts.js +15 -0
  273. package/dist/internal/lib/detect-os.d.ts +43 -0
  274. package/dist/internal/lib/detect-os.js +70 -0
  275. package/dist/internal/lib/manifest-version.d.ts +1 -1
  276. package/dist/internal/lib/manifest-version.js +2 -2
  277. package/dist/internal/lib/memory-href.d.ts +16 -0
  278. package/dist/internal/lib/memory-href.js +46 -0
  279. package/dist/internal/lib/use-project-feature-flags.js +13 -9
  280. package/dist/internal/lib/utils/heic-convert.d.ts +1 -1
  281. package/dist/internal/lib/utils/heic-convert.js +3 -4
  282. package/dist/internal/lib/web-notifications.d.ts +20 -0
  283. package/dist/internal/lib/web-notifications.js +48 -4
  284. package/dist/internal/notifications/notification-bell.d.ts +4 -1
  285. package/dist/internal/notifications/notification-bell.js +2 -2
  286. package/dist/internal/selection/selection-bar.d.ts +2 -1
  287. package/dist/internal/selection/selection-bar.js +1 -1
  288. package/dist/internal/stores/apps-modal-store.d.ts +8 -0
  289. package/dist/internal/stores/apps-modal-store.js +6 -0
  290. package/dist/internal/stores/composer-prefill-store.d.ts +12 -5
  291. package/dist/internal/stores/file-preview-store.d.ts +29 -2
  292. package/dist/internal/stores/file-preview-store.js +19 -1
  293. package/dist/internal/stores/kortix-computer-store.js +3 -0
  294. package/dist/internal/stores/sidebar-nav-store.d.ts +1 -1
  295. package/dist/internal/stores/sidebar-nav-store.js +3 -1
  296. package/dist/lib/routes.d.ts +13 -1
  297. package/dist/lib/routes.js +13 -0
  298. package/dist/markdown/index.d.ts +2 -1
  299. package/dist/markdown/index.js +2 -1
  300. package/dist/markdown/setup-links/approval-decision.d.ts +1 -0
  301. package/dist/markdown/setup-links/approval-decision.js +9 -3
  302. package/dist/markdown/setup-links/connector-handshake.d.ts +3 -1
  303. package/dist/markdown/setup-links/connector-handshake.js +12 -10
  304. package/dist/markdown/setup-links/secret-intake-form.d.ts +0 -10
  305. package/dist/markdown/setup-links/secret-intake-form.js +1 -1
  306. package/dist/markdown/setup-links/show-connect-hero.d.ts +28 -0
  307. package/dist/markdown/setup-links/show-connect-hero.js +91 -0
  308. package/dist/markdown/unified-markdown.js +5 -5
  309. package/dist/primitives/badge.d.ts +1 -1
  310. package/dist/primitives/badge.js +2 -0
  311. package/dist/primitives/disclosure.js +14 -2
  312. package/dist/primitives/empty-art.d.ts +12 -0
  313. package/dist/primitives/empty-art.js +11 -0
  314. package/dist/primitives/empty-state.d.ts +2 -2
  315. package/dist/primitives/empty-state.js +6 -5
  316. package/dist/primitives/mermaid-renderer.d.ts +2 -0
  317. package/dist/primitives/mermaid-renderer.js +21 -15
  318. package/dist/primitives/resizable.js +6 -1
  319. package/dist/primitives/resize-seam.d.ts +11 -0
  320. package/dist/primitives/resize-seam.js +12 -0
  321. package/dist/primitives/sidebar-panel.js +4 -7
  322. package/dist/primitives/tabs.d.ts +14 -1
  323. package/dist/primitives/tabs.js +1 -1
  324. package/dist/providers/ui-provider.d.ts +9 -0
  325. package/dist/session/composer/ComposerAboveCard.d.ts +1 -1
  326. package/dist/session/composer/ComposerAboveCard.js +2 -2
  327. package/dist/session/composer/ComposerCard.d.ts +1 -1
  328. package/dist/session/composer/ComposerCard.js +3 -3
  329. package/dist/session/composer/agent-selector.d.ts +13 -1
  330. package/dist/session/composer/agent-selector.js +25 -5
  331. package/dist/session/composer/composer-agent-access.d.ts +15 -0
  332. package/dist/session/composer/composer-agent-access.js +27 -0
  333. package/dist/session/composer/composer-chat-input.d.ts +8 -2
  334. package/dist/session/composer/composer-chat-input.js +8 -6
  335. package/dist/session/composer/composer-logic.d.ts +16 -0
  336. package/dist/session/composer/composer-logic.js +12 -0
  337. package/dist/session/composer/composer-underbar.d.ts +3 -1
  338. package/dist/session/composer/composer-underbar.js +4 -3
  339. package/dist/session/composer/composer.d.ts +15 -1
  340. package/dist/session/composer/composer.js +19 -1
  341. package/dist/session/composer/draft/composer-draft.d.ts +6 -2
  342. package/dist/session/composer/draft/composer-draft.js +5 -1
  343. package/dist/session/composer/reasoning-effort-selector.js +1 -1
  344. package/dist/session/models/chatgpt-connection-button.d.ts +11 -0
  345. package/dist/session/models/chatgpt-connection-button.js +54 -0
  346. package/dist/session/models/model-selector.js +5 -2
  347. package/dist/session/models/use-model-connection-gate.d.ts +5 -5
  348. package/dist/session/models/use-model-connection-gate.js +5 -5
  349. package/dist/session/outcomes/jump-to-outcome.d.ts +10 -0
  350. package/dist/session/outcomes/jump-to-outcome.js +11 -0
  351. package/dist/session/outcomes/session-outcomes-bridge.d.ts +14 -0
  352. package/dist/session/outcomes/session-outcomes-bridge.js +12 -0
  353. package/dist/session/outcomes/session-outcomes-provider.d.ts +3 -1
  354. package/dist/session/outcomes/session-outcomes-provider.js +33 -3
  355. package/dist/session/panel/easy/app-preview.d.ts +10 -0
  356. package/dist/session/panel/easy/app-preview.js +31 -12
  357. package/dist/session/panel/easy/change-requests-card.d.ts +7 -0
  358. package/dist/session/panel/easy/change-requests-card.js +17 -0
  359. package/dist/session/panel/easy/easy-panel-logic.js +7 -1
  360. package/dist/session/panel/easy/easy-panel.js +5 -2
  361. package/dist/session/panel/easy/file-preview.js +1 -1
  362. package/dist/session/panel/easy/outputs-card.d.ts +2 -1
  363. package/dist/session/panel/easy/outputs-card.js +3 -2
  364. package/dist/session/panel/mobile-tool-drawer.js +7 -1
  365. package/dist/session/panel/session-audit-panel.js +9 -2
  366. package/dist/session/panel/session-audit-shared.js +3 -1
  367. package/dist/session/panel/session-detail-panel.js +9 -3
  368. package/dist/session/panel/session-files-explorer.d.ts +9 -0
  369. package/dist/session/panel/session-files-explorer.js +12 -3
  370. package/dist/session/panel/session-panel-provider.d.ts +15 -1
  371. package/dist/session/panel/session-panel-provider.js +32 -7
  372. package/dist/session/panel/shared/derive-panels.d.ts +8 -1
  373. package/dist/session/panel/shared/derive-panels.js +12 -2
  374. package/dist/session/panel/shared/output-priority.js +2 -0
  375. package/dist/session/participants/session-participants.d.ts +8 -2
  376. package/dist/session/participants/session-participants.js +11 -4
  377. package/dist/session/prompts/approval-request.d.ts +5 -0
  378. package/dist/session/prompts/approval-request.js +9 -1
  379. package/dist/session/prompts/session-approval-review.d.ts +9 -0
  380. package/dist/session/prompts/session-approval-review.js +18 -0
  381. package/dist/session/status/session-error-banner.js +2 -49
  382. package/dist/session/status/session-starting-loader.d.ts +14 -2
  383. package/dist/session/status/session-starting-loader.js +16 -4
  384. package/dist/session/thread/after-first-prompt.d.ts +7 -0
  385. package/dist/session/thread/after-first-prompt.js +8 -0
  386. package/dist/session/thread/detect-command.d.ts +12 -0
  387. package/dist/session/thread/detect-command.js +20 -0
  388. package/dist/session/thread/session-chat.d.ts +3 -1
  389. package/dist/session/thread/session-chat.js +377 -252
  390. package/dist/session/thread/session-thread.d.ts +15 -1
  391. package/dist/session/thread/session-thread.js +20 -3
  392. package/dist/session/thread/session-transcript-class.d.ts +5 -1
  393. package/dist/session/thread/session-transcript-class.js +5 -1
  394. package/dist/session/thread/thread-boot-rows.d.ts +36 -0
  395. package/dist/session/thread/thread-boot-rows.js +89 -0
  396. package/dist/session/thread/transcript-rows.d.ts +31 -0
  397. package/dist/session/thread/transcript-rows.js +3 -0
  398. package/dist/session/thread/transcript.d.ts +0 -9
  399. package/dist/session/thread/transcript.js +104 -19
  400. package/dist/session/tool/shared/infrastructure-contexts.d.ts +28 -0
  401. package/dist/session/tool/shared/infrastructure-contexts.js +31 -3
  402. package/dist/session/tool/tool-part-renderer.d.ts +5 -4
  403. package/dist/session/tool/tool-part-renderer.js +8 -3
  404. package/dist/session/tool/tools/bash-tool.js +7 -6
  405. package/dist/session/tool/tools/channel-send-card.d.ts +1 -2
  406. package/dist/session/tool/tools/channel-send.d.ts +2 -1
  407. package/dist/session/tool/tools/codemode-tool.js +1 -1
  408. package/dist/session/tool/tools/connector-tools.js +1 -1
  409. package/dist/session/tool/tools/image-gen-tool.d.ts +1 -1
  410. package/dist/session/tool/tools/image-gen-tool.js +241 -53
  411. package/dist/session/tool/tools/show-tool.js +19 -8
  412. package/dist/session/turn/channel-brand.d.ts +8 -3
  413. package/dist/session/turn/channel-brand.js +20 -4
  414. package/dist/session/turn/message-author.d.ts +8 -0
  415. package/dist/session/turn/message-author.js +24 -0
  416. package/dist/session/turn/message-row.d.ts +52 -0
  417. package/dist/session/turn/message-row.js +44 -0
  418. package/dist/session/turn/plan-anchor.d.ts +1 -1
  419. package/dist/session/turn/plan-anchor.js +1 -1
  420. package/dist/session/turn/user-message.d.ts +14 -6
  421. package/dist/session/turn/user-message.js +35 -15
  422. package/dist/styles.css +1 -1
  423. package/dist/workspace/home/access-requests-bell.d.ts +9 -2
  424. package/dist/workspace/home/access-requests-bell.js +20 -6
  425. package/dist/workspace/home/first-chat.d.ts +8 -21
  426. package/dist/workspace/home/first-chat.js +22 -72
  427. package/dist/workspace/index.d.ts +6 -0
  428. package/dist/workspace/index.js +6 -0
  429. package/dist/workspace/layout/project-home.d.ts +14 -2
  430. package/dist/workspace/layout/project-home.js +60 -21
  431. package/dist/workspace/layout/use-project-home-send.d.ts +9 -1
  432. package/dist/workspace/layout/use-project-home-send.js +82 -3
  433. package/dist/workspace/memory/body-doc.d.ts +17 -0
  434. package/dist/workspace/memory/body-doc.js +208 -0
  435. package/dist/workspace/memory/body-extensions.d.ts +38 -0
  436. package/dist/workspace/memory/body-extensions.js +103 -0
  437. package/dist/workspace/memory/company-memory-page.d.ts +8 -0
  438. package/dist/workspace/memory/company-memory-page.js +16 -0
  439. package/dist/workspace/memory/memory-all.d.ts +20 -0
  440. package/dist/workspace/memory/memory-all.js +27 -0
  441. package/dist/workspace/memory/memory-body.d.ts +19 -0
  442. package/dist/workspace/memory/memory-body.js +139 -0
  443. package/dist/workspace/memory/memory-empty.d.ts +13 -0
  444. package/dist/workspace/memory/memory-empty.js +28 -0
  445. package/dist/workspace/memory/memory-history.d.ts +27 -0
  446. package/dist/workspace/memory/memory-history.js +108 -0
  447. package/dist/workspace/memory/memory-labels.d.ts +16 -0
  448. package/dist/workspace/memory/memory-labels.js +47 -0
  449. package/dist/workspace/memory/memory-page-list.d.ts +34 -0
  450. package/dist/workspace/memory/memory-page-list.js +156 -0
  451. package/dist/workspace/memory/memory-reader.d.ts +58 -0
  452. package/dist/workspace/memory/memory-reader.js +123 -0
  453. package/dist/workspace/memory/memory-view.d.ts +21 -0
  454. package/dist/workspace/memory/memory-view.js +124 -0
  455. package/dist/workspace/memory/remember-popover.d.ts +19 -0
  456. package/dist/workspace/memory/remember-popover.js +61 -0
  457. package/dist/workspace/memory/remember-this.d.ts +12 -0
  458. package/dist/workspace/memory/remember-this.js +89 -0
  459. package/dist/workspace/memory/source-mark.d.ts +18 -0
  460. package/dist/workspace/memory/source-mark.js +79 -0
  461. package/dist/workspace/memory/used-memory-chip.d.ts +14 -0
  462. package/dist/workspace/memory/used-memory-chip.js +61 -0
  463. package/dist/workspace/new/advanced-fields.d.ts +2 -1
  464. package/dist/workspace/new/advanced-fields.js +2 -2
  465. package/dist/workspace/new/source-param.d.ts +1 -1
  466. package/dist/workspace/new/source-param.js +3 -1
  467. package/dist/workspace/new/use-create-workspace.d.ts +8 -10
  468. package/dist/workspace/new/use-create-workspace.js +3 -3
  469. package/dist/workspace/projects/onboarding/app-logo.d.ts +7 -2
  470. package/dist/workspace/projects/onboarding/app-logo.js +6 -13
  471. package/dist/workspace/projects/policies-panel.js +5 -3
  472. package/dist/workspace/review/review-actions.d.ts +4 -2
  473. package/dist/workspace/review/review-actions.js +8 -2
  474. package/dist/workspace/review/review-center.js +11 -7
  475. package/dist/workspace/review/review-detail.d.ts +10 -0
  476. package/dist/workspace/review/review-detail.js +101 -13
  477. package/dist/workspace/saved-session-skeleton.d.ts +2 -2
  478. package/dist/workspace/saved-session-skeleton.js +3 -3
  479. package/dist/workspace/session-workspace.js +15 -13
  480. package/dist/workspace/sessions/project-sessions-view.js +3 -2
  481. package/dist/workspace/sessions/session-label-badges.js +2 -1
  482. package/dist/workspace/sessions/sessions-toolbar.d.ts +3 -1
  483. package/dist/workspace/sessions/sessions-toolbar.js +2 -2
  484. package/dist/workspace/sidebar/footer/project-apps-nav.d.ts +5 -0
  485. package/dist/workspace/sidebar/footer/project-apps-nav.js +41 -2
  486. package/dist/workspace/sidebar/footer/project-artifacts-nav.d.ts +6 -0
  487. package/dist/workspace/sidebar/footer/project-artifacts-nav.js +22 -0
  488. package/dist/workspace/sidebar/footer/project-chrome-nav.d.ts +10 -0
  489. package/dist/workspace/sidebar/footer/project-chrome-nav.js +56 -0
  490. package/dist/workspace/sidebar/footer/project-manifest-upgrade-alert.js +13 -13
  491. package/dist/workspace/sidebar/footer/project-memory-nav.d.ts +7 -0
  492. package/dist/workspace/sidebar/footer/project-memory-nav.js +19 -0
  493. package/dist/workspace/sidebar/nav-row-meta.js +14 -2
  494. package/dist/workspace/sidebar/project-nav-items.js +3 -0
  495. package/dist/workspace/sidebar/project-session-list.js +68 -56
  496. package/dist/workspace/sidebar/project-sidebar.js +13 -2
  497. package/dist/workspace/sidebar/project-spaces-nav.d.ts +8 -0
  498. package/dist/workspace/sidebar/project-spaces-nav.js +69 -0
  499. package/dist/workspace/sidebar/session-group-order.d.ts +9 -0
  500. package/dist/workspace/sidebar/session-group-order.js +25 -0
  501. package/dist/workspace/sidebar/session-group-sections.d.ts +62 -0
  502. package/dist/workspace/sidebar/session-group-sections.js +267 -0
  503. package/dist/workspace/sidebar/session-list-chrome.d.ts +28 -0
  504. package/dist/workspace/sidebar/session-list-chrome.js +50 -0
  505. package/dist/workspace/spaces/channel-glyph.d.ts +5 -0
  506. package/dist/workspace/spaces/channel-glyph.js +6 -0
  507. package/dist/workspace/spaces/channel-setup.d.ts +16 -0
  508. package/dist/workspace/spaces/channel-setup.js +105 -0
  509. package/dist/workspace/spaces/channels-onboarding.d.ts +13 -0
  510. package/dist/workspace/spaces/channels-onboarding.js +37 -0
  511. package/dist/workspace/spaces/create-channel-dialog.d.ts +16 -0
  512. package/dist/workspace/spaces/create-channel-dialog.js +158 -0
  513. package/dist/workspace/spaces/private-channels-not-in.d.ts +9 -0
  514. package/dist/workspace/spaces/private-channels-not-in.js +69 -0
  515. package/dist/workspace/spaces/space-agents.d.ts +10 -0
  516. package/dist/workspace/spaces/space-agents.js +10 -0
  517. package/dist/workspace/spaces/space-details-dialog.d.ts +20 -0
  518. package/dist/workspace/spaces/space-details-dialog.js +176 -0
  519. package/dist/workspace/spaces/space-link-label.d.ts +49 -0
  520. package/dist/workspace/spaces/space-link-label.js +73 -0
  521. package/dist/workspace/spaces/space-links.d.ts +19 -0
  522. package/dist/workspace/spaces/space-links.js +230 -0
  523. package/dist/workspace/spaces/space-members.d.ts +46 -0
  524. package/dist/workspace/spaces/space-members.js +182 -0
  525. package/dist/workspace/spaces/space-roster.d.ts +15 -0
  526. package/dist/workspace/spaces/space-roster.js +44 -0
  527. package/dist/workspace/spaces/space-threads-tab.d.ts +56 -0
  528. package/dist/workspace/spaces/space-threads-tab.js +156 -0
  529. package/dist/workspace/spaces/space-timeline-view.d.ts +254 -0
  530. package/dist/workspace/spaces/space-timeline-view.js +235 -0
  531. package/dist/workspace/spaces/space-timeline.d.ts +106 -0
  532. package/dist/workspace/spaces/space-timeline.js +183 -0
  533. package/dist/workspace/spaces/space-triggers.d.ts +13 -0
  534. package/dist/workspace/spaces/space-triggers.js +78 -0
  535. package/dist/workspace/spaces/space-view.d.ts +37 -0
  536. package/dist/workspace/spaces/space-view.js +436 -0
  537. package/package.json +67 -36
  538. package/skills/kortix-ui/SKILL.md +3 -3
  539. package/skills/kortix-ui/references/custom-dashboard.md +3 -3
  540. package/skills/kortix-ui/references/modules.md +29 -5
  541. package/skills/kortix-ui/references/theming.md +1 -1
  542. package/dist/customize/connectors/catalog/merge-search.d.ts +0 -10
  543. package/dist/customize/connectors/catalog/merge-search.js +0 -26
  544. package/dist/customize/connectors/detail/find-easy-connect-app.d.ts +0 -29
  545. package/dist/customize/connectors/detail/find-easy-connect-app.js +0 -22
  546. package/dist/customize/migrate-to-v2/use-migrate-to-v2.d.ts +0 -9
  547. package/dist/customize/migrate-to-v2/use-migrate-to-v2.js +0 -24
  548. package/dist/customize/sections/connector-connection-header.d.ts +0 -36
  549. package/dist/customize/sections/connector-connection-header.js +0 -33
  550. package/dist/customize/sections/connector-connection-modal.d.ts +0 -34
  551. package/dist/customize/sections/connector-connection-modal.js +0 -72
  552. package/dist/customize/sections/discover-catalogue-card.d.ts +0 -19
  553. package/dist/customize/sections/discover-catalogue-card.js +0 -26
  554. package/dist/customize/sections/discover-catalogue-detail.d.ts +0 -15
  555. package/dist/customize/sections/discover-catalogue-detail.js +0 -24
  556. package/dist/customize/sections/discover-catalogue.d.ts +0 -17
  557. package/dist/customize/sections/discover-catalogue.js +0 -132
  558. package/dist/customize/sections/llm-provider/provider-access-menu.d.ts +0 -10
  559. package/dist/customize/sections/llm-provider/provider-access-menu.js +0 -23
  560. package/dist/files/project/components/drive-empty-art.d.ts +0 -2
  561. package/dist/files/project/components/drive-empty-art.js +0 -5
  562. package/dist/internal/hooks/use-media-query.d.ts +0 -2
  563. package/dist/internal/share/public-share-link-button.d.ts +0 -14
  564. package/dist/internal/share/public-share-link-button.js +0 -17
  565. package/dist/markdown/setup-links/app-credentials-form.d.ts +0 -12
  566. package/dist/markdown/setup-links/app-credentials-form.js +0 -115
  567. /package/dist/{internal/hooks → hooks}/use-media-query.js +0 -0
@@ -0,0 +1,139 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ApiError } from '@kortix/sdk';
4
+ import { useUpdateProjectMemoryPage } from '@kortix/sdk/react';
5
+ import { WarningCircleIcon } from '@phosphor-icons/react';
6
+ import { EditorContent, NodeViewWrapper, ReactNodeViewRenderer, useEditor, useEditorState, } from '@tiptap/react';
7
+ import { createContext, useContext, useEffect, useRef, useState } from 'react';
8
+ import { useTranslations } from '../../i18n/index.js';
9
+ import { Button } from '../../primitives/button.js';
10
+ import { InfoBanner } from '../../primitives/info-banner.js';
11
+ import Loading from '../../primitives/loading.js';
12
+ import { successToast } from '../../primitives/toast.js';
13
+ import { docToMarkdown, markdownToDoc, memoryLinkTarget, superscript } from './body-doc.js';
14
+ import { BODY_CLASS, memoryBodyExtensions } from './body-extensions.js';
15
+ import { SourceMark } from './source-mark.js';
16
+ const ERROR_BY_CODE = {
17
+ version_conflict: 'conflict',
18
+ page_too_large: 'tooLarge',
19
+ secret_detected: 'secret',
20
+ layer_read_only: 'readOnly',
21
+ };
22
+ /** What a source number's view needs: the page's sources and the project. */
23
+ const SourcesContext = createContext(null);
24
+ /** A source number: `SourceMark` (its hint, its link) while reading; a plain superscript while editing. */
25
+ function SourceNode({ node, editor }) {
26
+ const ctx = useContext(SourcesContext);
27
+ const editable = useEditorState({ editor, selector: (state) => state.editor.isEditable });
28
+ const number = Number(node.attrs.number);
29
+ const source = ctx?.sources.get(number);
30
+ return (_jsx(NodeViewWrapper, { as: "span", children: !source ? null : editable || !ctx ? (_jsx("span", { className: BODY_CLASS.source, children: superscript(number) })) : (_jsx(SourceMark, { source: source, projectId: ctx.projectId })) }));
31
+ }
32
+ /**
33
+ * The page's body, read and edited with one renderer: the reader's look is
34
+ * the editor's, so Edit changes nothing but the caret. While editing: Markdown
35
+ * shortcuts, no toolbar, Cancel and Save under it; Esc cancels, ⌘Enter saves.
36
+ * A link opens while reading: a URL in a new tab, a relative path as the
37
+ * memory page it names. Save sends the version it started from; a page
38
+ * changed meanwhile answers `version_conflict`, and Reload loads it.
39
+ */
40
+ export function MemoryBody({ projectId, page, pages, editing, onSelectPage, onDone, onReload, }) {
41
+ const t = useTranslations('spaces.memory');
42
+ const update = useUpdateProjectMemoryPage(projectId);
43
+ const [error, setError] = useState(null);
44
+ const [initial] = useState(() => markdownToDoc(page.body));
45
+ const [sources] = useState(() => new Map(page.sources.map((source) => [source.number, source])));
46
+ // Handlers bound once by the editor: they read the newest props.
47
+ const latest = useRef({
48
+ save: () => { },
49
+ cancel: () => { },
50
+ open: () => false,
51
+ });
52
+ const editor = useEditor({
53
+ extensions: memoryBodyExtensions({
54
+ known: new Set(sources.keys()),
55
+ view: ReactNodeViewRenderer(SourceNode, { as: 'span' }),
56
+ }),
57
+ content: initial,
58
+ editable: false,
59
+ immediatelyRender: true,
60
+ editorProps: {
61
+ attributes: { class: BODY_CLASS.root, 'aria-label': t('editor.body') },
62
+ handleKeyDown: (view, event) => {
63
+ if (!view.editable)
64
+ return false;
65
+ if (event.key === 'Escape') {
66
+ event.preventDefault();
67
+ event.stopPropagation();
68
+ latest.current.cancel();
69
+ return true;
70
+ }
71
+ if (event.key === 'Enter' && (event.metaKey || event.ctrlKey)) {
72
+ event.preventDefault();
73
+ latest.current.save();
74
+ return true;
75
+ }
76
+ return false;
77
+ },
78
+ handleDOMEvents: {
79
+ click: (view, event) => {
80
+ if (view.editable)
81
+ return false;
82
+ const anchor = event.target.closest('a');
83
+ const href = anchor?.getAttribute('href');
84
+ if (!anchor || !href || anchor.closest('[data-node-view-wrapper]'))
85
+ return false;
86
+ if (!latest.current.open(href))
87
+ return false;
88
+ event.preventDefault();
89
+ return true;
90
+ },
91
+ },
92
+ },
93
+ onUpdate: () => setError(null),
94
+ });
95
+ // Edit turns the same document editable; Cancel puts the page back as it was.
96
+ useEffect(() => {
97
+ if (!editor)
98
+ return;
99
+ editor.setEditable(editing);
100
+ if (editing)
101
+ editor.commands.focus('end', { scrollIntoView: false });
102
+ else
103
+ editor.commands.setContent(initial, { emitUpdate: false });
104
+ }, [editor, editing, initial]);
105
+ const save = () => {
106
+ if (update.isPending || !editor)
107
+ return;
108
+ const body = docToMarkdown(editor.getJSON());
109
+ if (body === docToMarkdown(initial))
110
+ return onDone();
111
+ // `mutateAsync`, not `mutate`'s callbacks: the save bumps the page's
112
+ // version, which remounts this body (its key), and TanStack drops the
113
+ // call-time callbacks of an unmounted caller, so the editor stayed open.
114
+ update.mutateAsync({ pageId: page.page_id, input: { base_version: page.version_no, body } }).then(() => {
115
+ successToast(t('editor.saved'));
116
+ onDone();
117
+ }, (err) => setError((err instanceof ApiError && err.code && ERROR_BY_CODE[err.code]) || 'failed'));
118
+ };
119
+ const open = (href) => {
120
+ const target = memoryLinkTarget(href, page.path);
121
+ if (!target)
122
+ return false;
123
+ if ('url' in target)
124
+ window.open(target.url, '_blank', 'noopener,noreferrer');
125
+ else {
126
+ const linked = pages.find((p) => p.path === target.path);
127
+ if (linked)
128
+ onSelectPage(linked.page_id);
129
+ }
130
+ return true;
131
+ };
132
+ useEffect(() => {
133
+ latest.current = { save, cancel: onDone, open };
134
+ });
135
+ return (_jsx(SourcesContext.Provider, { value: { sources, projectId }, children: _jsxs("form", { className: "flex flex-col gap-4 pt-8", onSubmit: (event) => {
136
+ event.preventDefault();
137
+ save();
138
+ }, children: [!editing && !page.body.trim() ? _jsx("p", { className: "text-muted-foreground text-sm", children: t('emptyPage') }) : null, _jsx(EditorContent, { editor: editor, className: !editing && !page.body.trim() ? 'hidden' : undefined }), editing && error === 'conflict' ? (_jsx(InfoBanner, { tone: "warning", icon: WarningCircleIcon, title: t('editor.conflict'), action: _jsx(Button, { type: "button", variant: "outline", size: "toolbar", onClick: onReload, children: t('editor.reload') }) })) : editing && error ? (_jsx("p", { role: "alert", className: "text-destructive text-xs", children: t(`editor.error.${error}`) })) : null, editing ? (_jsxs("div", { className: "flex items-center justify-end gap-2", children: [_jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: onDone, disabled: update.isPending, children: t('editor.cancel') }), _jsxs(Button, { type: "submit", size: "sm", disabled: update.isPending, "aria-busy": update.isPending || undefined, children: [update.isPending ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, t('editor.save')] })] })) : null] }) }));
139
+ }
@@ -0,0 +1,13 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * A layer with no pages: the empty-folder layout of Files, with what memory
4
+ * is in one sentence. `action` is "Remember this…" for a writer; a channel or
5
+ * DM adds "Open Company memory", the layer its agent also reads.
6
+ */
7
+ export declare function MemoryEmpty({ projectId, kind, place, action, }: {
8
+ projectId: string;
9
+ kind: 'company' | 'channel' | 'dm';
10
+ /** "#marketing" or the DM's agent. */
11
+ place: string;
12
+ action?: ReactNode;
13
+ }): import("react").JSX.Element;
@@ -0,0 +1,28 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useProjectMemoryPages } from '@kortix/sdk/react';
4
+ import { BuildingsIcon, SunDimIcon } from '@phosphor-icons/react';
5
+ import { useTranslations } from '../../i18n/index.js';
6
+ import { uiRoutes } from '../../lib/routes.js';
7
+ import { Button } from '../../primitives/button.js';
8
+ import { EmptyArt } from '../../primitives/empty-art.js';
9
+ import { EmptyState } from '../../primitives/empty-state.js';
10
+ import { UiLink } from '../../providers/ui-provider.js';
11
+ /**
12
+ * A layer with no pages: the empty-folder layout of Files, with what memory
13
+ * is in one sentence. `action` is "Remember this…" for a writer; a channel or
14
+ * DM adds "Open Company memory", the layer its agent also reads.
15
+ */
16
+ export function MemoryEmpty({ projectId, kind, place, action, }) {
17
+ const t = useTranslations('spaces.memory.empty');
18
+ return (_jsx(EmptyState, { className: "min-h-full", media: _jsx(EmptyArt, { icon: SunDimIcon }), title: t(kind === 'dm' ? 'titleDm' : kind === 'company' ? 'titleCompany' : 'title', { place }), description: t('description'), action: action, secondaryAction: kind === 'company' ? undefined : _jsx(CompanyMemoryButton, { projectId: projectId }) }));
19
+ }
20
+ /** "Open Company memory · 16 pages": hidden until the count loads. */
21
+ function CompanyMemoryButton({ projectId }) {
22
+ const t = useTranslations('spaces.memory');
23
+ const company = useProjectMemoryPages(projectId, 'company');
24
+ const href = uiRoutes().memory(projectId);
25
+ if (!href || !company.data)
26
+ return null;
27
+ return (_jsx(Button, { asChild: true, variant: "outline", size: "sm", className: "gap-1.5 tabular-nums", title: t('companyLinkHint'), children: _jsxs(UiLink, { href: href, children: [_jsx(BuildingsIcon, { className: "size-3.5 shrink-0" }), t('empty.openCompany', { count: company.data.length })] }) }));
28
+ }
@@ -0,0 +1,27 @@
1
+ import type { ProjectMemoryPage, ProjectMemoryVersion } from '@kortix/sdk';
2
+ /** The versions History shows; the reader reads the same cache for the one it previews. */
3
+ export declare function useMemoryVersions(projectId: string, pageId: string | undefined): {
4
+ history: import("@tanstack/react-query").UseQueryResult<import("@kortix/sdk").ProjectMemoryVersionList, Error>;
5
+ versions: ProjectMemoryVersion[];
6
+ };
7
+ /** "Restore this version": the version's body comes back as a new edit (the title is the file's and does not change). */
8
+ export declare function useRestoreMemoryVersion(projectId: string, page: ProjectMemoryPage, onRestored: () => void): {
9
+ restore: (version: ProjectMemoryVersion) => void;
10
+ restoring: boolean;
11
+ };
12
+ /**
13
+ * The page's History in a sheet beside the reader: every version, newest
14
+ * first. Preview shows a version in the reader, as the page looked then;
15
+ * Restore makes it the current version. `previewId` is the previewed
16
+ * version (null: the current page). Esc while previewing returns to the
17
+ * current page; a second Esc closes the sheet. Where the sheet covers the
18
+ * reader (a narrow container), Preview passes `covered`: the view closes the
19
+ * sheet so the reader can show the version.
20
+ */
21
+ export declare function MemoryHistory({ projectId, page, previewId, onPreview, onRestored, }: {
22
+ projectId: string;
23
+ page: ProjectMemoryPage;
24
+ previewId: string | null;
25
+ onPreview: (versionId: string | null, covered?: boolean) => void;
26
+ onRestored: () => void;
27
+ }): import("react").JSX.Element;
@@ -0,0 +1,108 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useProjectMemoryHistory, useUpdateProjectMemoryPage } from '@kortix/sdk/react';
4
+ import { diffLines } from 'diff';
5
+ import { useMemo } from 'react';
6
+ import { useLocale, useTranslations } from '../../i18n/index.js';
7
+ import { relativeTime } from '../../internal/lib/relative-time.js';
8
+ import { cn } from '../../lib/utils.js';
9
+ import { hasOpenFloatingLayer } from '../../lib/z-stack.js';
10
+ import { Badge } from '../../primitives/badge.js';
11
+ import { Button } from '../../primitives/button.js';
12
+ import { ErrorState } from '../../primitives/error-state.js';
13
+ import Loading from '../../primitives/loading.js';
14
+ import { SplitSheetBody, SplitSheetContent, SplitSheetDescription, SplitSheetHeader, SplitSheetTitle, } from '../../primitives/split-sheet.js';
15
+ import { errorToast, successToast } from '../../primitives/toast.js';
16
+ import { hasMemoryAuthor, MemoryAuthorAvatar, useMemoryAuthorName } from './memory-labels.js';
17
+ /** The row's quiet bordered buttons, as the reader's Edit · History · Delete. */
18
+ const ACTION = 'text-muted-foreground hover:text-foreground font-normal';
19
+ /** A version as one text, so a title or summary change counts with the body. */
20
+ function versionText(version) {
21
+ if (!version)
22
+ return '';
23
+ const { title, summary, body } = version.snapshot;
24
+ return `${[`# ${title}`, summary, body].filter(Boolean).join('\n\n')}\n`;
25
+ }
26
+ /** Lines a version added and removed against the one before it. */
27
+ function lineChanges(version, previous) {
28
+ let added = 0;
29
+ let removed = 0;
30
+ for (const part of diffLines(versionText(previous), versionText(version))) {
31
+ if (part.added)
32
+ added += part.count ?? 0;
33
+ else if (part.removed)
34
+ removed += part.count ?? 0;
35
+ }
36
+ return { added, removed };
37
+ }
38
+ /**
39
+ * The sheet covers the reader: the split sheet's container is too narrow for
40
+ * two columns (`@max-3xl/split-sheet`), so its main cell is `invisible`. A
41
+ * preview shown behind the sheet would then show nothing.
42
+ */
43
+ function coversReader(from) {
44
+ const main = from
45
+ .closest('[data-slot="split-sheet-grid"]')
46
+ ?.querySelector(':scope > [data-slot="split-sheet-main"]');
47
+ return !!main && getComputedStyle(main).visibility === 'hidden';
48
+ }
49
+ /** The versions History shows; the reader reads the same cache for the one it previews. */
50
+ export function useMemoryVersions(projectId, pageId) {
51
+ const history = useProjectMemoryHistory(projectId, pageId);
52
+ return { history, versions: history.data?.versions ?? [] };
53
+ }
54
+ /** "Restore this version": the version's body comes back as a new edit (the title is the file's and does not change). */
55
+ export function useRestoreMemoryVersion(projectId, page, onRestored) {
56
+ const t = useTranslations('spaces.memory');
57
+ const update = useUpdateProjectMemoryPage(projectId);
58
+ const restore = (version) => update.mutate({ pageId: page.page_id, input: { base_version: page.version_no, body: version.snapshot.body } }, {
59
+ onSuccess: () => {
60
+ successToast(t('history.restored'));
61
+ onRestored();
62
+ },
63
+ onError: () => errorToast(t('history.restoreFailed')),
64
+ });
65
+ return { restore, restoring: update.isPending };
66
+ }
67
+ /**
68
+ * The page's History in a sheet beside the reader: every version, newest
69
+ * first. Preview shows a version in the reader, as the page looked then;
70
+ * Restore makes it the current version. `previewId` is the previewed
71
+ * version (null: the current page). Esc while previewing returns to the
72
+ * current page; a second Esc closes the sheet. Where the sheet covers the
73
+ * reader (a narrow container), Preview passes `covered`: the view closes the
74
+ * sheet so the reader can show the version.
75
+ */
76
+ export function MemoryHistory({ projectId, page, previewId, onPreview, onRestored, }) {
77
+ const t = useTranslations('spaces.memory');
78
+ const { history, versions } = useMemoryVersions(projectId, page.page_id);
79
+ const { restore, restoring } = useRestoreMemoryVersion(projectId, page, onRestored);
80
+ return (_jsxs(SplitSheetContent, { onKeyDown: (event) => {
81
+ if (event.key !== 'Escape' || !previewId || hasOpenFloatingLayer())
82
+ return;
83
+ // Handled here, so the sheet stays open.
84
+ event.preventDefault();
85
+ onPreview(null);
86
+ }, children: [_jsxs(SplitSheetHeader, { closeLabel: t('close'), children: [_jsx(SplitSheetTitle, { children: t('history.title') }), _jsx(SplitSheetDescription, { children: t('history.description', { title: page.title }) })] }), _jsx(SplitSheetBody, { className: "px-2 py-2", children: history.isError && !history.data ? (_jsx(ErrorState, { size: "sm", title: t('history.loadError'), action: _jsx(Button, { variant: "outline", size: "sm", onClick: () => history.refetch(), children: t('retry') }) })) : !history.data ? (_jsx("div", { className: "flex justify-center py-8", children: _jsx(Loading, { className: "size-4 shrink-0" }) })) : (_jsx("ol", { className: "flex flex-col gap-0.5", children: versions.map((version, index) => (_jsx(VersionRow, { version: version, previous: versions[index + 1], current: index === 0, previewed: version.version_id === previewId, canRestore: page.can_edit && index > 0 && !version.snapshot.deleted, restoring: restoring, onPreview: (event) => {
87
+ // Covered: Preview always shows the version (the reader is hidden, so a second press is not "back").
88
+ const covered = coversReader(event.currentTarget);
89
+ const toggleOff = !covered && version.version_id === previewId;
90
+ onPreview(toggleOff ? null : version.version_id, covered);
91
+ }, onRestore: () => restore(version) }, version.version_id))) })) })] }));
92
+ }
93
+ function VersionRow({ version, previous, current, previewed, canRestore, restoring, onPreview, onRestore, }) {
94
+ const t = useTranslations('spaces.memory');
95
+ const locale = useLocale();
96
+ const authorName = useMemoryAuthorName();
97
+ const name = authorName(version.author);
98
+ const changes = useMemo(() => lineChanges(version, previous), [version, previous]);
99
+ const meta = [
100
+ relativeTime(version.created_at, locale),
101
+ changes.added ? t('history.added', { count: changes.added }) : null,
102
+ changes.removed ? t('history.removed', { count: changes.removed }) : null,
103
+ ].filter(Boolean);
104
+ const canPreview = !current && !version.snapshot.deleted;
105
+ return (_jsxs("li", { "aria-current": previewed || undefined, className: cn('flex items-start gap-2.5 rounded-md px-2.5 py-2', previewed && 'bg-active'), children: [_jsx(MemoryAuthorAvatar, { author: version.author, name: name }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [_jsxs("span", { className: "flex items-center gap-1.5 text-xs", children: [_jsx("span", { className: "truncate font-medium", children: hasMemoryAuthor(version.author)
106
+ ? t(`history.op.${version.op}`, { author: name })
107
+ : t(version.op === 'create' ? 'history.created' : 'history.edited') }), current ? _jsx(Badge, { variant: "muted", children: t('history.current') }) : null] }), _jsx("span", { className: "text-muted-foreground truncate text-xs tabular-nums", children: meta.join(' · ') }), canPreview || canRestore ? (_jsxs("div", { className: "flex flex-wrap items-center gap-1.5 pt-1.5", children: [canPreview ? (_jsx(Button, { variant: "outline", size: "toolbar", className: ACTION, "aria-pressed": previewed, onClick: onPreview, children: t('history.preview') })) : null, canRestore ? (_jsx(Button, { variant: "outline", size: "toolbar", className: ACTION, disabled: restoring, "aria-busy": restoring || undefined, onClick: onRestore, children: t('history.restoreShort') })) : null] })) : null] })] }));
108
+ }
@@ -0,0 +1,16 @@
1
+ import type { ProjectMemoryAuthor, ProjectMemoryPageType } from '@kortix/sdk';
2
+ import { type Icon } from '@phosphor-icons/react';
3
+ export declare const MEMORY_TYPE_ICON: Record<ProjectMemoryPageType, Icon>;
4
+ /**
5
+ * A named person or agent wrote the change. A file with no front-matter author
6
+ * (a Remember note, a Drive sync) has none: the reader shows no "by …" and
7
+ * History shows the change without an author, never an invented "A member".
8
+ */
9
+ export declare function hasMemoryAuthor(author: ProjectMemoryAuthor): boolean;
10
+ /** Who wrote a change, as a name: the agent, the person (the app's `participantLabel` rule), or "Kortix" for an import. */
11
+ export declare function useMemoryAuthorName(): (author: ProjectMemoryAuthor) => string;
12
+ /** The author's tile: an agent's pixel mark, a person's initials, a page glyph when nobody is named. */
13
+ export declare function MemoryAuthorAvatar({ author, name }: {
14
+ author: ProjectMemoryAuthor;
15
+ name: string;
16
+ }): import("react").JSX.Element;
@@ -0,0 +1,47 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { BookOpenIcon, BriefcaseIcon, FileTextIcon, NoteIcon, SignpostIcon, UserIcon } from '@phosphor-icons/react';
4
+ import { AgentMark } from '../../internal/components/agent-mark.js';
5
+ import { useTranslations } from '../../i18n/index.js';
6
+ import { UserAvatar } from '../../primitives/user-avatar.js';
7
+ import { participantLabel } from '../../session/participants/session-participants.js';
8
+ import { agentLabel } from '../spaces/space-timeline.js';
9
+ export const MEMORY_TYPE_ICON = {
10
+ people: UserIcon,
11
+ decisions: SignpostIcon,
12
+ workstreams: BriefcaseIcon,
13
+ playbooks: BookOpenIcon,
14
+ note: NoteIcon,
15
+ other: FileTextIcon,
16
+ };
17
+ /**
18
+ * A named person or agent wrote the change. A file with no front-matter author
19
+ * (a Remember note, a Drive sync) has none: the reader shows no "by …" and
20
+ * History shows the change without an author, never an invented "A member".
21
+ */
22
+ export function hasMemoryAuthor(author) {
23
+ return author.kind === 'agent' ? !!author.agent : author.kind === 'person' && !!author.name;
24
+ }
25
+ /** Who wrote a change, as a name: the agent, the person (the app's `participantLabel` rule), or "Kortix" for an import. */
26
+ export function useMemoryAuthorName() {
27
+ const t = useTranslations('spaces.memory');
28
+ return (author) => {
29
+ if (author.kind === 'agent' && author.agent)
30
+ return agentLabel(author.agent);
31
+ if (author.kind === 'person' && author.name)
32
+ return participantLabel({ name: author.name, email: null });
33
+ if (author.kind === 'agent')
34
+ return t('author.agent');
35
+ return author.kind === 'system' ? t('author.system') : t('author.unknown');
36
+ };
37
+ }
38
+ /** The author's tile: an agent's pixel mark, a person's initials, a page glyph when nobody is named. */
39
+ export function MemoryAuthorAvatar({ author, name }) {
40
+ if (author.kind === 'agent' && author.agent)
41
+ return _jsx(AgentMark, { slug: author.agent, label: name });
42
+ if (!hasMemoryAuthor(author)) {
43
+ // Neutral, not `EntityAvatar`: its hashed pastel would read as a person.
44
+ return (_jsx("span", { className: "bg-muted text-muted-foreground flex size-5 shrink-0 items-center justify-center rounded-sm border", children: _jsx(FileTextIcon, { className: "size-3", "aria-hidden": true }) }));
45
+ }
46
+ return _jsx(UserAvatar, { email: author.user_id ?? name, name: name, size: "xs" });
47
+ }
@@ -0,0 +1,34 @@
1
+ import type { ProjectMemoryPageSummary, ProjectMemoryPageType } from '@kortix/sdk';
2
+ import { type ReactElement, type ReactNode } from 'react';
3
+ /** The layer's pages, newest updated first. */
4
+ export declare function sortMemoryPages(pages: readonly ProjectMemoryPageSummary[]): ProjectMemoryPageSummary[];
5
+ /** Sorted pages split into their type's group, in `MEMORY_GROUP_ORDER`, without empty groups. */
6
+ export declare function groupMemoryPages(pages: readonly ProjectMemoryPageSummary[]): {
7
+ type: ProjectMemoryPageType;
8
+ pages: ProjectMemoryPageSummary[];
9
+ }[];
10
+ /**
11
+ * The Memory tab's middle column: "5 pages" with a search button (it turns
12
+ * the header into a search field), "All" (the layer at a glance), then the
13
+ * page titles in groups by type
14
+ * (About, People, Decisions, Projects, How we work, Notes), newest first in
15
+ * each. A search of 2 characters or more shows the server's hits as one
16
+ * flat list.
17
+ */
18
+ export declare function MemoryPageList({ projectId, layerKey, pages, selectedId, onSelect, anchor, className, }: {
19
+ projectId: string;
20
+ layerKey: string;
21
+ /** Sorted by `sortMemoryPages`. */
22
+ pages: readonly ProjectMemoryPageSummary[];
23
+ /** null: the All view. */
24
+ selectedId: string | null;
25
+ /** null: the All view. */
26
+ onSelect: (pageId: string | null) => void;
27
+ /** Wraps the header row: "Remember this…" anchors to it when a link opens it. */
28
+ anchor?: (header: ReactElement) => ReactNode;
29
+ className?: string;
30
+ }): import("react").JSX.Element;
31
+ /** A channel's or DM's list ends with the Company memory its agent also reads; hidden until its count loads. */
32
+ export declare function CompanyMemoryLink({ projectId }: {
33
+ projectId: string;
34
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,156 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useProjectMemoryPages, useProjectMemorySearch } from '@kortix/sdk/react';
4
+ import { CaretRightIcon, MagnifyingGlassIcon } from '@phosphor-icons/react';
5
+ import { useReducedMotion } from 'motion/react';
6
+ import { useEffect, useMemo, useState } from 'react';
7
+ import { useTranslations } from '../../i18n/index.js';
8
+ import { useDebounce } from '../../internal/hooks/use-debounced-value.js';
9
+ import { uiRoutes } from '../../lib/routes.js';
10
+ import { cn } from '../../lib/utils.js';
11
+ import { Button } from '../../primitives/button.js';
12
+ import { Disclosure, DisclosureContent, DisclosureTrigger } from '../../primitives/disclosure.js';
13
+ import { ErrorState } from '../../primitives/error-state.js';
14
+ import Loading from '../../primitives/loading.js';
15
+ import { InputGroupSearch, InputGroupSearchClear, InputGroupSearchIcon, InputGroupSearchInput, } from '../../primitives/input-group.js';
16
+ import { UiLink } from '../../providers/ui-provider.js';
17
+ /** The layer's pages, newest updated first. */
18
+ export function sortMemoryPages(pages) {
19
+ return [...pages].sort((a, b) => Date.parse(b.updated_at) - Date.parse(a.updated_at));
20
+ }
21
+ /** The list's groups, in this order. Empty groups are not shown. */
22
+ const MEMORY_GROUP_ORDER = [
23
+ 'other',
24
+ 'people',
25
+ 'decisions',
26
+ 'workstreams',
27
+ 'playbooks',
28
+ 'note',
29
+ ];
30
+ /** Sorted pages split into their type's group, in `MEMORY_GROUP_ORDER`, without empty groups. */
31
+ export function groupMemoryPages(pages) {
32
+ return MEMORY_GROUP_ORDER.map((type) => ({ type, pages: pages.filter((page) => page.type === type) })).filter((group) => group.pages.length > 0);
33
+ }
34
+ /** The collapsed groups of one layer, per viewer. Storage can be absent or throw: then every group starts open. */
35
+ function readCollapsed(key) {
36
+ try {
37
+ const value = JSON.parse(window.localStorage.getItem(key) ?? '[]');
38
+ return Array.isArray(value) ? value.filter((type) => typeof type === 'string') : [];
39
+ }
40
+ catch {
41
+ return [];
42
+ }
43
+ }
44
+ function writeCollapsed(key, collapsed) {
45
+ try {
46
+ window.localStorage.setItem(key, JSON.stringify(collapsed));
47
+ }
48
+ catch {
49
+ // Private mode or blocked storage: the state lasts until reload.
50
+ }
51
+ }
52
+ /** Collapsed groups, remembered per project and layer; the selected page's group opens when it is collapsed. */
53
+ function useCollapsedGroups(projectId, layerKey, selected) {
54
+ const key = `kortix:memory-groups-collapsed:${projectId}:${layerKey}`;
55
+ const [state, setState] = useState(() => ({ key, collapsed: readCollapsed(key) }));
56
+ let collapsed = state.key === key ? state.collapsed : readCollapsed(key);
57
+ const [openedFor, setOpenedFor] = useState(null);
58
+ if ((selected?.id ?? null) !== openedFor) {
59
+ // Adjusting state during render: a page chosen elsewhere (a link, the palette) shows inside an open group.
60
+ setOpenedFor(selected?.id ?? null);
61
+ if (selected && collapsed.includes(selected.type))
62
+ collapsed = collapsed.filter((type) => type !== selected.type);
63
+ }
64
+ if (state.key !== key || state.collapsed !== collapsed)
65
+ setState({ key, collapsed });
66
+ // A toggle and an auto-open both persist, so a reload shows what the viewer last saw.
67
+ useEffect(() => writeCollapsed(state.key, state.collapsed), [state]);
68
+ const toggle = (type) => {
69
+ setState({ key, collapsed: collapsed.includes(type) ? collapsed.filter((item) => item !== type) : [...collapsed, type] });
70
+ };
71
+ return { collapsed, toggle };
72
+ }
73
+ const ROW = 'focus-visible:ring-ring flex h-8 w-full shrink-0 items-center gap-2 rounded-md px-2 text-left text-sm outline-none focus-visible:ring-2';
74
+ /**
75
+ * The Memory tab's middle column: "5 pages" with a search button (it turns
76
+ * the header into a search field), "All" (the layer at a glance), then the
77
+ * page titles in groups by type
78
+ * (About, People, Decisions, Projects, How we work, Notes), newest first in
79
+ * each. A search of 2 characters or more shows the server's hits as one
80
+ * flat list.
81
+ */
82
+ export function MemoryPageList({ projectId, layerKey, pages, selectedId, onSelect, anchor, className, }) {
83
+ const t = useTranslations('spaces.memory');
84
+ const [searchOpen, setSearchOpen] = useState(false);
85
+ const [query, setQuery] = useState('');
86
+ // 2 characters or more: the server's search (titles, summaries and text).
87
+ // 1 character: the titles, filtered here.
88
+ const trimmed = query.trim();
89
+ const searching = trimmed.length >= 2;
90
+ const debounced = useDebounce(trimmed, 250);
91
+ const search = useProjectMemorySearch(projectId, { q: debounced, layer: layerKey }, { enabled: searching });
92
+ const needle = searching ? '' : trimmed.toLowerCase();
93
+ const shown = useMemo(() => (needle ? pages.filter((page) => page.title.toLowerCase().includes(needle)) : pages), [pages, needle]);
94
+ const groups = useMemo(() => groupMemoryPages(shown), [shown]);
95
+ const selectedPage = pages.find((page) => page.page_id === selectedId);
96
+ const { collapsed, toggle } = useCollapsedGroups(projectId, layerKey, selectedPage ? { id: selectedPage.page_id, type: selectedPage.type } : null);
97
+ const closeSearch = () => {
98
+ setQuery('');
99
+ setSearchOpen(false);
100
+ };
101
+ // One box in both states (the rows' height, `mb-1.5` above the first group), so opening search moves nothing below.
102
+ const headerBox = 'mb-1.5 flex h-8 shrink-0 items-center';
103
+ const header = searchOpen ? (_jsx("div", { className: headerBox, children: _jsxs(InputGroupSearch, { className: "flex-1", children: [_jsx(InputGroupSearchIcon, { children: _jsx(MagnifyingGlassIcon, {}) }), _jsx(InputGroupSearchInput, { size: "xs", autoFocus: true, placeholder: t('search'), "aria-label": t('search'), value: query, onChange: (event) => setQuery(event.target.value), onBlur: () => !query && setSearchOpen(false), onKeyDown: (event) => {
104
+ if (event.key === 'Escape') {
105
+ event.stopPropagation();
106
+ closeSearch();
107
+ }
108
+ } }), _jsx(InputGroupSearchClear, { onClick: closeSearch })] }) })) : (_jsxs("div", { className: cn(headerBox, 'justify-between pr-1 pl-2'), children: [_jsx("p", { className: "text-muted-foreground text-xs tabular-nums", children: t('pageCount', { count: pages.length }) }), _jsx(Button, { variant: "ghost", size: "icon-xs", "aria-label": t('search'), className: "text-muted-foreground hover:text-foreground", onClick: () => setSearchOpen(true), children: _jsx(MagnifyingGlassIcon, { className: "size-3.5" }) })] }));
109
+ return (_jsxs("nav", { "aria-label": t('pagesLabel'), className: cn('flex w-72 shrink-0 flex-col border-r px-3.5 pt-5 pb-4', className), children: [anchor ? anchor(header) : header, searching ? (_jsx(SearchResults, { query: trimmed, search: search, ready: debounced.length >= 2, selectedId: selectedId, onSelect: onSelect })) : (_jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-1.5 overflow-y-auto", children: [needle ? null : (_jsx("button", { type: "button", "aria-current": selectedId === null ? 'page' : undefined, onClick: () => onSelect(null), className: cn(ROW, selectedId === null
110
+ ? 'bg-active text-foreground font-medium'
111
+ : 'text-muted-foreground hover:bg-hover hover:text-foreground transition-colors duration-fast'), children: t('all.title') })), groups.map((group) => (_jsx(MemoryPageGroup, { label: t(`group.${group.type}`), open: !collapsed.includes(group.type), onToggle: () => toggle(group.type), children: group.pages.map((page) => (_jsx("li", { children: _jsx("button", { type: "button", "aria-current": page.page_id === selectedId ? 'page' : undefined, onClick: () => onSelect(page.page_id), title: page.title, className: cn(ROW, page.page_id === selectedId
112
+ ? 'bg-active text-foreground font-medium'
113
+ : 'text-muted-foreground hover:bg-hover hover:text-foreground transition-colors duration-fast'), children: _jsx("span", { className: "min-w-0 flex-1 truncate", children: page.title }) }) }, page.page_id))) }, group.type))), needle && shown.length === 0 ? (_jsx("p", { className: "text-muted-foreground px-2 py-8 text-xs", children: t('noMatches', { query: trimmed }) })) : null] })), layerKey === 'company' ? null : _jsx(CompanyMemoryLink, { projectId: projectId })] }));
114
+ }
115
+ /**
116
+ * One type's pages under a ghost header row: the muted label on the page
117
+ * titles' text edge (same `h-8 px-2 rounded-md` box as the rows), the caret
118
+ * at the far right, pointing down while open. Hover fills it with
119
+ * `bg-secondary`. Height and opacity fold in 200ms ease-out; with reduced
120
+ * motion the height snaps and only the fade stays.
121
+ */
122
+ function MemoryPageGroup({ label, open, onToggle, children, }) {
123
+ const reduceMotion = useReducedMotion();
124
+ return (_jsxs(Disclosure, { open: open, onOpenChange: onToggle, className: "group/memory-group flex shrink-0 flex-col gap-px", transition: { duration: 0.2, ease: 'easeOut', ...(reduceMotion ? { height: { duration: 0 } } : null) }, children: [_jsx(DisclosureTrigger, { children: _jsxs(Button, { variant: "ghost", size: "sm", className: "text-muted-foreground hover:bg-secondary hover:text-foreground focus-visible:ring-ring duration-fast h-8 w-full justify-between gap-2 px-2 text-left text-xs font-normal transition-colors focus-visible:ring-2 has-[>svg]:px-2", children: [_jsx("span", { className: "min-w-0 truncate", children: label }), _jsx(CaretRightIcon, { "aria-hidden": true, className: "duration-moderate size-3.5 shrink-0 transition-[rotate] ease-out group-data-[state=open]/memory-group:rotate-90 motion-reduce:transition-none" })] }) }), _jsx(DisclosureContent, { children: _jsx("ul", { className: "flex flex-col", children: children }) })] }));
125
+ }
126
+ /** A channel's or DM's list ends with the Company memory its agent also reads; hidden until its count loads. */
127
+ export function CompanyMemoryLink({ projectId }) {
128
+ const t = useTranslations('spaces.memory');
129
+ const company = useProjectMemoryPages(projectId, 'company');
130
+ const href = uiRoutes().memory(projectId);
131
+ if (!href || !company.data)
132
+ return null;
133
+ return (_jsx(UiLink, { href: href, title: t('companyLinkHint'), className: "text-muted-foreground hover:text-foreground focus-visible:ring-ring mt-3 shrink-0 truncate rounded-md px-2 text-xs tabular-nums outline-none transition-colors duration-fast focus-visible:ring-2", children: t('companyLink', { count: company.data.length }) }));
134
+ }
135
+ /**
136
+ * The server's hits for the search field, best first: title and summary. The
137
+ * hits of the previous query stay while the next one loads.
138
+ */
139
+ function SearchResults({ query, search, ready, selectedId, onSelect, }) {
140
+ const t = useTranslations('spaces.memory');
141
+ const hits = ready ? search.data?.hits : undefined;
142
+ let body;
143
+ if (search.isError && !hits) {
144
+ body = (_jsx(ErrorState, { size: "sm", title: t('searchError'), action: _jsx(Button, { variant: "outline", size: "sm", onClick: () => search.refetch(), children: t('retry') }) }));
145
+ }
146
+ else if (!hits) {
147
+ body = (_jsx("div", { className: "flex justify-center py-8", children: _jsx(Loading, { className: "size-4 shrink-0" }) }));
148
+ }
149
+ else if (hits.length === 0) {
150
+ body = _jsx("p", { className: "text-muted-foreground px-2 py-8 text-xs", children: t('noMatches', { query }) });
151
+ }
152
+ else {
153
+ body = (_jsx("ul", { "aria-label": t('searchResults'), className: "flex flex-col", children: hits.map((hit) => (_jsx("li", { children: _jsxs("button", { type: "button", "aria-current": hit.page_id === selectedId ? 'page' : undefined, onClick: () => onSelect(hit.page_id), className: cn('focus-visible:ring-ring flex w-full flex-col gap-0.5 rounded-md px-2 py-1.5 text-left text-sm outline-none focus-visible:ring-2', hit.page_id === selectedId ? 'bg-active' : 'hover:bg-hover'), children: [_jsx("span", { className: "text-foreground truncate font-medium", children: hit.title }), hit.summary || hit.snippet ? (_jsx("span", { className: "text-muted-foreground line-clamp-2 text-xs", children: hit.summary || hit.snippet })) : null] }) }, hit.page_id))) }));
154
+ }
155
+ return _jsx("div", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto", children: body });
156
+ }
@@ -0,0 +1,58 @@
1
+ import type { ProjectMemoryPage, ProjectMemoryPageSummary } from '@kortix/sdk';
2
+ /**
3
+ * One page, across the reader's width: the title and "Updated 2h ago by
4
+ * Writer" top left, Edit · History · Delete top right, then the body with its
5
+ * source numbers, the numbered sources and the related pages. `editor`
6
+ * replaces the body while it is edited (the buttons hide; Cancel and Save sit
7
+ * under it). Delete asks once and deletes for good. The header draws from
8
+ * the list's summary at once; the body arrives with the page. `previewId`
9
+ * (a version picked in History) shows that version instead, read-only, under
10
+ * a bar with "Restore this version" and "Back to current" (Esc). Where the
11
+ * History sheet covers the reader (a narrow container), Preview closes the
12
+ * sheet first, so the version shows here; History reopens it on that version.
13
+ */
14
+ export declare function MemoryReader({ projectId, summary, page, pageError, pages, editing, editorRun, onRetry, onSelectPage, onBack, onEdit, onHistory, onEditDone, onReload, onRemoved, previewId, previewFocus, onPreviewEnd, }: {
15
+ projectId: string;
16
+ summary: ProjectMemoryPageSummary;
17
+ page: ProjectMemoryPage | undefined;
18
+ pageError: boolean;
19
+ /** The layer's pages: where a relative link in the body goes. */
20
+ pages: readonly ProjectMemoryPageSummary[];
21
+ /** The body is being edited in place. */
22
+ editing: boolean;
23
+ /** Bumped by the editor's Reload: a fresh body on the newest version. */
24
+ editorRun: number;
25
+ onRetry: () => void;
26
+ onSelectPage: (pageId: string) => void;
27
+ /** Back to the list, on a container too narrow to show both. */
28
+ onBack: () => void;
29
+ onEdit: () => void;
30
+ onHistory: () => void;
31
+ /** Editing ended: saved or cancelled. */
32
+ onEditDone: () => void;
33
+ /** Reload after `version_conflict`. */
34
+ onReload: () => void;
35
+ /** The page is gone: leave it. */
36
+ onRemoved: () => void;
37
+ /** A version picked in History to preview; null: the current page. */
38
+ previewId?: string | null;
39
+ /**
40
+ * The preview replaced a History sheet that covered the reader: focus goes
41
+ * to "Back to current", and back to History when the preview ends.
42
+ */
43
+ previewFocus?: boolean;
44
+ /** Back to the current page. */
45
+ onPreviewEnd?: () => void;
46
+ }): import("react").JSX.Element;
47
+ /** A text line's placeholder inside the line box of `line` (its font size and line height), so the real line lands where it sat. */
48
+ export declare function Line({ line, className }: {
49
+ line: string;
50
+ className: string;
51
+ }): import("react").JSX.Element;
52
+ /**
53
+ * The reader before the layer has loaded: the title's and "Updated …"'s line
54
+ * boxes, then the body. No Edit, History or Delete: they come with the page.
55
+ */
56
+ export declare function MemoryReaderSkeleton({ className }: {
57
+ className?: string;
58
+ }): import("react").JSX.Element;