@kortix/ui 0.16.0 → 0.16.2

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 (285) hide show
  1. package/dist/_vendor/kortix-shared.js +157 -51
  2. package/dist/_vendor/shared/index.d.ts +1 -0
  3. package/dist/_vendor/shared/space-icon.d.ts +30 -0
  4. package/dist/_vendor/shared/space-slug.d.ts +12 -0
  5. package/dist/access/access/access-dialog.js +2 -2
  6. package/dist/access/share-dialog.d.ts +77 -0
  7. package/dist/access/share-dialog.js +160 -0
  8. package/dist/access/sharing-picker.d.ts +8 -1
  9. package/dist/access/sharing-picker.js +2 -2
  10. package/dist/changes/change-list.js +3 -3
  11. package/dist/customize/connectors/catalog/catalog-paging.d.ts +1 -1
  12. package/dist/customize/connectors/catalog/catalog-paging.js +1 -1
  13. package/dist/customize/providers/provider-sheet.js +17 -7
  14. package/dist/customize/sections/component/manifest-copy-block.js +1 -1
  15. package/dist/customize/sections/component/section-wrapper.d.ts +1 -8
  16. package/dist/customize/sections/component/section-wrapper.js +3 -3
  17. package/dist/customize/sections/llm-provider/model-capability-icons.js +1 -1
  18. package/dist/customize/sections/view/gateway/generation-controls.js +1 -1
  19. package/dist/customize/sections/view/git-view.js +1 -1
  20. package/dist/customize/settings/settings-tabs.js +0 -5
  21. package/dist/customize/settings/tabs/general-tab.js +2 -2
  22. package/dist/customize/shared/capability-page-shell.d.ts +2 -2
  23. package/dist/customize/shared/capability-page-shell.js +7 -5
  24. package/dist/customize/shared/capability-scroll-root.js +1 -2
  25. package/dist/customize/shared/catalog/catalog-card.js +1 -1
  26. package/dist/files/project/components/change-requests-panel.js +2 -2
  27. package/dist/files/project/components/checkpoint-detail-dialog.js +4 -4
  28. package/dist/files/project/components/checkpoints-panel.js +2 -2
  29. package/dist/files/project/components/drive-explorer.js +2 -2
  30. package/dist/files/project/components/file-breadcrumbs.js +1 -1
  31. package/dist/files/project/components/file-history-popover.js +2 -2
  32. package/dist/files/project/components/file-thumbnail.js +1 -1
  33. package/dist/files/project/components/open-change-request-dialog.js +1 -1
  34. package/dist/files/renderers/mermaid/mermaid-diagram.js +2 -2
  35. package/dist/files/renderers/show-content-renderer.js +6 -6
  36. package/dist/files/renderers/sqlite-renderer.js +8 -8
  37. package/dist/files/renderers/zip/zip-renderer.js +2 -2
  38. package/dist/files/viewer/file-content-renderer.js +5 -5
  39. package/dist/files/viewer/json-tree-view.js +3 -3
  40. package/dist/i18n/en.d.ts +133 -8
  41. package/dist/i18n/en.js +170 -45
  42. package/dist/i18n/ui-catalog/remaining-ui-translation-keys.generated.js +0 -3
  43. package/dist/internal/billing/use-cost-explorer.d.ts +9 -2
  44. package/dist/internal/billing/use-cost-explorer.js +22 -0
  45. package/dist/internal/billing/use-session-costs.d.ts +7 -2
  46. package/dist/internal/billing/use-session-costs.js +6 -0
  47. package/dist/internal/chrome/use-chrome-offered.d.ts +3 -3
  48. package/dist/internal/chrome/use-chrome-offered.js +3 -3
  49. package/dist/internal/components/nav-rail.d.ts +1 -20
  50. package/dist/internal/components/nav-rail.js +1 -15
  51. package/dist/internal/layout/project-page-header.d.ts +13 -9
  52. package/dist/internal/layout/project-page-header.js +14 -10
  53. package/dist/internal/lib/browser-noise/evidence.d.ts +2 -0
  54. package/dist/internal/lib/browser-noise/rules/injected-scripts.js +16 -1
  55. package/dist/internal/lib/error-handler.js +0 -9
  56. package/dist/internal/lib/interface-theme-defaults.js +2 -2
  57. package/dist/internal/lib/project-actions.d.ts +4 -5
  58. package/dist/internal/lib/project-actions.js +3 -5
  59. package/dist/internal/lib/project-preamble.d.ts +42 -4
  60. package/dist/internal/lib/project-preamble.js +49 -5
  61. package/dist/internal/lib/web-notifications.js +17 -29
  62. package/dist/internal/outcomes/outcome-vocabulary.js +1 -1
  63. package/dist/internal/stores/session-filter-store.d.ts +1 -1
  64. package/dist/internal/stores/user-preferences-store.d.ts +2 -2
  65. package/dist/internal/stores/workspace-settings-rail-store.d.ts +0 -8
  66. package/dist/internal/stores/workspace-settings-rail-store.js +0 -2
  67. package/dist/lib/routes.d.ts +7 -0
  68. package/dist/lib/routes.js +6 -1
  69. package/dist/markdown/doc-editor/doc-extensions.js +2 -0
  70. package/dist/markdown/doc-editor/doc-paste.d.ts +13 -0
  71. package/dist/markdown/doc-editor/doc-paste.js +67 -0
  72. package/dist/markdown/markdown-frontmatter.js +3 -3
  73. package/dist/markdown/markdown-policy.d.ts +1 -1
  74. package/dist/markdown/ordered-list.js +1 -1
  75. package/dist/primitives/context-menu.d.ts +1 -0
  76. package/dist/primitives/definition-list.js +1 -1
  77. package/dist/primitives/dropdown-menu.d.ts +1 -0
  78. package/dist/primitives/emoji-picker.js +1 -1
  79. package/dist/primitives/expandable-search.d.ts +57 -0
  80. package/dist/primitives/expandable-search.js +58 -0
  81. package/dist/primitives/favicon-avatar.js +1 -1
  82. package/dist/primitives/file-tree.d.ts +1 -1
  83. package/dist/primitives/file-tree.js +1 -1
  84. package/dist/primitives/glyph-picker.js +2 -2
  85. package/dist/primitives/input-group.js +1 -1
  86. package/dist/primitives/menu-base.d.ts +10 -0
  87. package/dist/primitives/menu-base.js +7 -2
  88. package/dist/primitives/phone-input.js +1 -1
  89. package/dist/primitives/profile-hover-card.d.ts +28 -0
  90. package/dist/primitives/profile-hover-card.js +22 -0
  91. package/dist/primitives/settings-section-header.d.ts +5 -5
  92. package/dist/primitives/settings-section-header.js +5 -5
  93. package/dist/primitives/sort-menu.d.ts +23 -0
  94. package/dist/primitives/sort-menu.js +54 -0
  95. package/dist/primitives/tabs.js +1 -1
  96. package/dist/primitives/toast-clearance.d.ts +12 -28
  97. package/dist/primitives/toast-clearance.js +23 -45
  98. package/dist/primitives/user-avatar.js +2 -3
  99. package/dist/session/agents/subagent-dialog-content.js +28 -70
  100. package/dist/session/composer/ComposerCard.d.ts +4 -1
  101. package/dist/session/composer/ComposerCard.js +51 -7
  102. package/dist/session/composer/composer-chat-input.js +3 -1
  103. package/dist/session/composer/composer-toolbar.d.ts +3 -1
  104. package/dist/session/composer/composer-toolbar.js +6 -2
  105. package/dist/session/composer/composer-underbar.d.ts +3 -1
  106. package/dist/session/composer/composer-underbar.js +2 -2
  107. package/dist/session/composer/composer.d.ts +12 -0
  108. package/dist/session/composer/composer.js +112 -6
  109. package/dist/session/composer/draft/composer-draft.d.ts +1 -0
  110. package/dist/session/composer/draft/composer-draft.js +10 -2
  111. package/dist/session/composer/draft/draft-uploads.js +13 -2
  112. package/dist/session/composer/draft/use-composer-draft.d.ts +2 -0
  113. package/dist/session/composer/draft/use-composer-draft.js +41 -6
  114. package/dist/session/composer/drive-mentions.d.ts +34 -0
  115. package/dist/session/composer/drive-mentions.js +98 -0
  116. package/dist/session/composer/editor/composer-editor.d.ts +3 -0
  117. package/dist/session/composer/editor/composer-editor.js +3 -1
  118. package/dist/session/composer/editor/serialize.js +3 -4
  119. package/dist/session/composer/menus/mention-controller.d.ts +3 -0
  120. package/dist/session/composer/menus/mention-controller.js +5 -0
  121. package/dist/session/composer/menus/mention-menu.d.ts +20 -3
  122. package/dist/session/composer/menus/mention-menu.js +33 -6
  123. package/dist/session/composer/menus/menu-items.d.ts +16 -1
  124. package/dist/session/composer/menus/menu-items.js +21 -1
  125. package/dist/session/composer/submit-latch.d.ts +3 -1
  126. package/dist/session/composer/submit-latch.js +5 -1
  127. package/dist/session/composer/types.d.ts +9 -2
  128. package/dist/session/header/session-changes-indicator.js +1 -1
  129. package/dist/session/header/session-site-header.js +2 -2
  130. package/dist/session/media/sandbox-url-detector.js +3 -3
  131. package/dist/session/models/model-connection-gate.d.ts +5 -0
  132. package/dist/session/models/model-connection-gate.js +12 -3
  133. package/dist/session/models/model-connection-layout.d.ts +7 -0
  134. package/dist/session/models/model-connection-layout.js +7 -0
  135. package/dist/session/models/provider-failure-recovery.js +1 -1
  136. package/dist/session/models/subscription-offer.d.ts +6 -5
  137. package/dist/session/models/subscription-offer.js +6 -6
  138. package/dist/session/panel/advanced/advanced-panel.js +1 -1
  139. package/dist/session/panel/session-detail-panel.js +1 -1
  140. package/dist/session/panel/session-diff-viewer.js +1 -1
  141. package/dist/session/panel/session-files-explorer.js +1 -1
  142. package/dist/session/panel/session-files-panel.js +3 -3
  143. package/dist/session/panel/shared/action-navigator.js +1 -1
  144. package/dist/session/status/provisioning-failure.d.ts +4 -4
  145. package/dist/session/status/provisioning-failure.js +4 -4
  146. package/dist/session/status/session-busy-indicator.js +1 -1
  147. package/dist/session/status/session-error-banner.js +6 -1
  148. package/dist/session/thread/mention-chip.d.ts +1 -1
  149. package/dist/session/thread/mention-segments.d.ts +4 -2
  150. package/dist/session/thread/mention-segments.js +28 -1
  151. package/dist/session/thread/message-parsing.d.ts +11 -0
  152. package/dist/session/thread/message-parsing.js +22 -3
  153. package/dist/session/thread/optimistic-turn.d.ts +4 -2
  154. package/dist/session/thread/optimistic-turn.js +13 -11
  155. package/dist/session/thread/session-chat.js +6 -1
  156. package/dist/session/thread/session-context-message-explorer.js +1 -1
  157. package/dist/session/thread/session-older-autoload.d.ts +2 -3
  158. package/dist/session/thread/session-older-autoload.js +2 -3
  159. package/dist/session/thread/transcript.js +8 -10
  160. package/dist/session/tool/shared/error-and-connector.js +1 -1
  161. package/dist/session/tool/shared/file-list.js +2 -2
  162. package/dist/session/tool/shared/infrastructure-parts.js +1 -1
  163. package/dist/session/tool/shared/infrastructure-preview.js +1 -1
  164. package/dist/session/tool/shared/infrastructure-row-header.js +3 -3
  165. package/dist/session/tool/shared/infrastructure-rows.js +2 -2
  166. package/dist/session/tool/shared/output-block.js +4 -4
  167. package/dist/session/tool/shared/session-helpers.js +3 -3
  168. package/dist/session/tool/shared/structured-output.js +3 -3
  169. package/dist/session/tool/shared/todo-helpers.js +1 -1
  170. package/dist/session/tool/tool-error.js +2 -2
  171. package/dist/session/tool/tools/agent-spawn-tool.js +3 -3
  172. package/dist/session/tool/tools/agent-status-tool.js +1 -1
  173. package/dist/session/tool/tools/apply-patch-tool.js +1 -1
  174. package/dist/session/tool/tools/connector-get-tool.js +1 -1
  175. package/dist/session/tool/tools/connector-list-tool.js +1 -1
  176. package/dist/session/tool/tools/connector-tools.js +1 -1
  177. package/dist/session/tool/tools/edit-tool.js +1 -1
  178. package/dist/session/tool/tools/get-mem-tool.js +1 -1
  179. package/dist/session/tool/tools/glob-tool.js +1 -1
  180. package/dist/session/tool/tools/image-search-tool.js +1 -1
  181. package/dist/session/tool/tools/memory-search-tool.js +1 -1
  182. package/dist/session/tool/tools/memory-tool.js +4 -4
  183. package/dist/session/tool/tools/presentation-gen-tool.js +2 -2
  184. package/dist/session/tool/tools/project-delete-tool.js +1 -1
  185. package/dist/session/tool/tools/project-list-tool.js +1 -1
  186. package/dist/session/tool/tools/pty-read-tool.js +1 -1
  187. package/dist/session/tool/tools/pty-spawn-tool.js +1 -1
  188. package/dist/session/tool/tools/pty-write-tool.js +1 -1
  189. package/dist/session/tool/tools/read-tool.js +1 -1
  190. package/dist/session/tool/tools/removed-connector-tool.js +1 -1
  191. package/dist/session/tool/tools/scrape-webpage-tool.js +1 -1
  192. package/dist/session/tool/tools/session-get-tool.js +3 -3
  193. package/dist/session/tool/tools/session-list-background-tool.js +1 -1
  194. package/dist/session/tool/tools/session-read-tool.js +1 -1
  195. package/dist/session/tool/tools/session-search-tool.js +1 -1
  196. package/dist/session/tool/tools/session-spawn-tool.js +1 -1
  197. package/dist/session/tool/tools/skill-tool.js +1 -1
  198. package/dist/session/tool/tools/todo-write-tool.js +1 -1
  199. package/dist/session/tool/tools/web-fetch-tool.js +1 -1
  200. package/dist/session/tool/tools/write-tool.js +1 -1
  201. package/dist/session/turn/activity-file-chips.js +7 -3
  202. package/dist/session/turn/activity-step.js +1 -1
  203. package/dist/session/turn/burst-summary-trigger.js +3 -3
  204. package/dist/session/turn/chain-step-trigger.js +1 -1
  205. package/dist/session/turn/plan-card.js +1 -1
  206. package/dist/session/turn/thought-chain-step.js +1 -1
  207. package/dist/session/turn/turn-work-accordion.js +1 -1
  208. package/dist/session/turn/user-message.js +13 -6
  209. package/dist/session/voice/use-call-card-position.d.ts +30 -0
  210. package/dist/session/voice/use-call-card-position.js +126 -0
  211. package/dist/session/voice/voice-call-card.js +10 -3
  212. package/dist/styles/theme.css +12 -0
  213. package/dist/styles/tokens.css +12 -6
  214. package/dist/styles.css +1 -1
  215. package/dist/terminal/session-terminal-panel.js +1 -1
  216. package/dist/test-utils/intl.d.ts +133 -8
  217. package/dist/workspace/admin/project-admin-dashboard.js +7 -24
  218. package/dist/workspace/calendar/calendar-page.js +1 -1
  219. package/dist/workspace/home/first-chat.d.ts +4 -3
  220. package/dist/workspace/home/first-chat.js +6 -6
  221. package/dist/workspace/home/welcome-body.js +2 -2
  222. package/dist/workspace/index.d.ts +1 -1
  223. package/dist/workspace/index.js +1 -1
  224. package/dist/workspace/layout/project-home.js +11 -4
  225. package/dist/workspace/layout/use-project-home-send.d.ts +3 -1
  226. package/dist/workspace/layout/use-project-home-send.js +6 -2
  227. package/dist/workspace/memory/company-memory-page.js +2 -4
  228. package/dist/workspace/new/github-source.js +0 -1
  229. package/dist/workspace/new/new-workspace-form.d.ts +0 -1
  230. package/dist/workspace/new/new-workspace-form.js +0 -3
  231. package/dist/workspace/new/use-create-workspace.d.ts +1 -1
  232. package/dist/workspace/new/use-create-workspace.js +1 -2
  233. package/dist/workspace/session-spaces/space-detail-page.d.ts +35 -0
  234. package/dist/workspace/session-spaces/space-detail-page.js +307 -0
  235. package/dist/workspace/session-spaces/space-form-modal.d.ts +16 -0
  236. package/dist/workspace/session-spaces/space-form-modal.js +92 -0
  237. package/dist/workspace/session-spaces/space-icon.d.ts +36 -0
  238. package/dist/workspace/session-spaces/space-icon.js +52 -0
  239. package/dist/workspace/session-spaces/space-people.d.ts +51 -0
  240. package/dist/workspace/session-spaces/space-people.js +91 -0
  241. package/dist/workspace/session-spaces/space-picker.d.ts +11 -0
  242. package/dist/workspace/session-spaces/space-picker.js +42 -0
  243. package/dist/workspace/session-spaces/space-share-modal.d.ts +14 -0
  244. package/dist/workspace/session-spaces/space-share-modal.js +93 -0
  245. package/dist/workspace/session-spaces/spaces-page.d.ts +8 -0
  246. package/dist/workspace/session-spaces/spaces-page.js +125 -0
  247. package/dist/workspace/sessions/session-owner-filters.d.ts +2 -0
  248. package/dist/workspace/sessions/session-owner-filters.js +2 -0
  249. package/dist/workspace/setup/setup-banner.d.ts +4 -0
  250. package/dist/workspace/setup/setup-banner.js +57 -0
  251. package/dist/workspace/setup/setup-steps.d.ts +14 -0
  252. package/dist/workspace/setup/setup-steps.js +15 -0
  253. package/dist/workspace/setup/use-setup-steps.d.ts +18 -0
  254. package/dist/workspace/setup/use-setup-steps.js +57 -0
  255. package/dist/workspace/setup/workspace-setup-page.js +8 -41
  256. package/dist/workspace/sidebar/footer/project-artifacts-nav.js +1 -1
  257. package/dist/workspace/sidebar/footer/project-promo-cards.d.ts +7 -2
  258. package/dist/workspace/sidebar/footer/project-promo-cards.js +4 -3
  259. package/dist/workspace/sidebar/footer/project-sandbox-alert.js +1 -1
  260. package/dist/workspace/sidebar/footer/promo-card.d.ts +10 -1
  261. package/dist/workspace/sidebar/footer/promo-card.js +31 -2
  262. package/dist/workspace/sidebar/footer/sandbox-health.js +1 -1
  263. package/dist/workspace/sidebar/modal/session-people-picker.d.ts +13 -0
  264. package/dist/workspace/sidebar/modal/session-people-picker.js +72 -0
  265. package/dist/workspace/sidebar/modal/share-session-modal.js +2 -1
  266. package/dist/workspace/sidebar/project-nav-items.d.ts +1 -3
  267. package/dist/workspace/sidebar/project-nav-items.js +3 -8
  268. package/dist/workspace/sidebar/project-session-list.js +19 -12
  269. package/dist/workspace/sidebar/project-sidebar.js +13 -13
  270. package/dist/workspace/sidebar/project-spaces-nav.js +1 -2
  271. package/dist/workspace/sidebar/session-filter-menu.js +19 -13
  272. package/dist/workspace/sidebar/session-group-sections.d.ts +12 -12
  273. package/dist/workspace/sidebar/session-group-sections.js +56 -75
  274. package/dist/workspace/sidebar/sidebar-more-group.js +1 -1
  275. package/dist/workspace/sidebar/workspace-settings-sidebar-nav.js +2 -2
  276. package/dist/workspace/spaces/space-tabs.d.ts +26 -6
  277. package/dist/workspace/spaces/space-tabs.js +19 -8
  278. package/package.json +27 -31
  279. package/skills/kortix-ui/references/modules.md +2 -2
  280. package/dist/workspace/new/clone-param.d.ts +0 -11
  281. package/dist/workspace/new/clone-param.js +0 -15
  282. package/dist/workspace/new/provision-new-workspace.d.ts +0 -14
  283. package/dist/workspace/new/provision-new-workspace.js +0 -14
  284. package/dist/workspace/sidebar/footer/project-inbox-nav.d.ts +0 -8
  285. package/dist/workspace/sidebar/footer/project-inbox-nav.js +0 -29
@@ -3,6 +3,7 @@ import type { Agent, Command, Session } from '@kortix/sdk/react';
3
3
  import type { Editor, JSONContent } from '@tiptap/core';
4
4
  import type { EditorView } from '@tiptap/pm/view';
5
5
  import type { SpaceMentionSource } from '../menus/space-mentions.js';
6
+ import type { DriveMentionSource } from '../menus/mention-menu.js';
6
7
  import type { SlashAction } from '../menus/slash-actions.js';
7
8
  import type { SlashFile } from '../menus/slash-files.js';
8
9
  import type { TrackedMention } from '../types.js';
@@ -139,6 +140,8 @@ export interface ComposerEditorProps {
139
140
  currentSessionId?: string;
140
141
  /** Inside a space: the `@` menu lists the space's people and agents only. */
141
142
  spaceMentions?: SpaceMentionSource | null;
143
+ /** The project's Drive files in the `@` menu; null where Drive is off. */
144
+ driveMentions?: DriveMentionSource | null;
142
145
  /** `/` menu data + the two things a row selection can produce — see `menus/slash-controller.ts`. */
143
146
  commands?: Command[];
144
147
  /**
@@ -183,7 +183,7 @@ function dismissKeyLabel() {
183
183
  const platform = typeof navigator !== 'undefined' ? navigator.platform || navigator.userAgent : '';
184
184
  return /Mac|iPhone|iPad/.test(platform) ? '⌥W' : 'Alt+W';
185
185
  }
186
- export const ComposerEditor = forwardRef(function ComposerEditor({ placeholder, disabled, autoFocus = false, onSubmit, onArrowUpAtStart, onArrowDownAtEnd, onEmptyChange, onDocChange, agents, sessions, currentSessionId, spaceMentions, commands, onSelectCommand, onSelectAction, actions, files, slashDockSelector, onMenuOpenChange, }, ref) {
186
+ export const ComposerEditor = forwardRef(function ComposerEditor({ placeholder, disabled, autoFocus = false, onSubmit, onArrowUpAtStart, onArrowDownAtEnd, onEmptyChange, onDocChange, agents, sessions, currentSessionId, spaceMentions, driveMentions, commands, onSelectCommand, onSelectAction, actions, files, slashDockSelector, onMenuOpenChange, }, ref) {
187
187
  const t = useTranslations('threads');
188
188
  const tUltracode = useTranslations('multiAgent.ultracode');
189
189
  // A marked `ultracode` keyword: the one-line hint under the text says what it does.
@@ -212,6 +212,7 @@ export const ComposerEditor = forwardRef(function ComposerEditor({ placeholder,
212
212
  const agentsRef = useLatestRef(agents ?? []);
213
213
  const sessionsRef = useLatestRef(sessions ?? []);
214
214
  const spaceMentionsRef = useLatestRef(spaceMentions ?? null);
215
+ const driveMentionsRef = useLatestRef(driveMentions ?? null);
215
216
  const currentSessionIdRef = useLatestRef(currentSessionId);
216
217
  const commandsRef = useLatestRef(commands ?? []);
217
218
  // Same live-getter reasoning as commandsRef — defaults to SLASH_ACTIONS
@@ -318,6 +319,7 @@ export const ComposerEditor = forwardRef(function ComposerEditor({ placeholder,
318
319
  getSessions: () => sessionsRef.current,
319
320
  getCurrentSessionId: () => currentSessionIdRef.current,
320
321
  getSpaceMentions: () => spaceMentionsRef.current,
322
+ getDriveMentions: () => driveMentionsRef.current,
321
323
  onOwnsEnterChange: (ownsEnter) => {
322
324
  mentionOwnsEnterRef.current = ownsEnter;
323
325
  },
@@ -27,10 +27,9 @@ export function collectMentions(nodes) {
27
27
  const kind = (node.attrs?.kind ?? 'file');
28
28
  // A space's agent chip shows the display name and carries the slug in `value`.
29
29
  const label = kind === 'agent' ? node.attrs?.value || node.attrs?.label || '' : (node.attrs?.label ?? '');
30
- // Only sessions round-trip an id — files and agents are addressed by
31
- // label, matching TrackedMention's existing shape (types.ts) and what
32
- // session-chat.tsx's send path already expects.
33
- mentions.push(kind === 'session' ? { kind, label, value: node.attrs?.value ?? '' } : { kind, label });
30
+ // Sessions round-trip their id and Drive files their path — workspace
31
+ // files and agents are addressed by label (types.ts).
32
+ mentions.push(kind === 'session' || kind === 'drive' ? { kind, label, value: node.attrs?.value ?? '' } : { kind, label });
34
33
  }
35
34
  return mentions;
36
35
  }
@@ -1,6 +1,7 @@
1
1
  import type { Agent, Session } from '@kortix/sdk/react';
2
2
  import { PluginKey } from '@tiptap/pm/state';
3
3
  import type { SuggestionOptions } from '@tiptap/suggestion';
4
+ import type { DriveMentionSource } from './mention-menu.js';
4
5
  import type { MenuRow } from './menu-items.js';
5
6
  import type { SpaceMentionSource } from './space-mentions.js';
6
7
  export declare const MENTION_PLUGIN_KEY: PluginKey<any>;
@@ -10,6 +11,8 @@ export interface CreateMentionSuggestionOptions {
10
11
  getCurrentSessionId: () => string | undefined;
11
12
  /** Inside a space: People and Agents only (`space-mentions.ts`). Null elsewhere. */
12
13
  getSpaceMentions?: () => SpaceMentionSource | null;
14
+ /** The project's Drive as a source of `@` rows. Null where Drive is off. */
15
+ getDriveMentions?: () => DriveMentionSource | null;
13
16
  /**
14
17
  * Fires ONLY on the false<->true boundary of "does at least one row exist
15
18
  * right now" — NOT "is a trigger match active". See `MenuNavState`'s own
@@ -76,6 +76,7 @@ export function createMentionSuggestion(opts) {
76
76
  sessions: opts.getSessions(),
77
77
  currentSessionId: opts.getCurrentSessionId(),
78
78
  spaceMentions: opts.getSpaceMentions?.() ?? null,
79
+ drive: opts.getDriveMentions?.() ?? null,
79
80
  // Fixed for the lifetime of this open menu — see
80
81
  // `MentionMenuHostProps.now`'s own doc comment.
81
82
  now: Date.now(),
@@ -119,6 +120,7 @@ export function createMentionSuggestion(opts) {
119
120
  sessions: opts.getSessions(),
120
121
  currentSessionId: opts.getCurrentSessionId(),
121
122
  spaceMentions: opts.getSpaceMentions?.() ?? null,
123
+ drive: opts.getDriveMentions?.() ?? null,
122
124
  selectedIndex: nav.getSelectedIndex(),
123
125
  onSelect,
124
126
  onHover,
@@ -140,6 +142,9 @@ export function createMentionSuggestion(opts) {
140
142
  editor.chain().focus().deleteRange(range).run();
141
143
  // An agent from outside the space only gets named: the composer asks to add it after the send.
142
144
  insertMention(editor, { kind: row.kind, label: row.label, value: row.value });
145
+ // A Drive file rides as an attachment: the composer fetches it with the viewer's access.
146
+ if (row.kind === 'drive')
147
+ opts.getDriveMentions?.()?.onPick({ path: row.value, name: row.label, size: row.size });
143
148
  },
144
149
  };
145
150
  }
@@ -1,4 +1,4 @@
1
- import type { Agent, Session } from '@kortix/sdk/react';
1
+ import { type Agent, type Session } from '@kortix/sdk/react';
2
2
  import type { MentionSection, MenuRow } from './menu-items.js';
3
3
  import { type SpaceMentionSource } from './space-mentions.js';
4
4
  /**
@@ -7,10 +7,12 @@ import { type SpaceMentionSource } from './space-mentions.js';
7
7
  * `aria-selected` per row: this is the accessibility neither
8
8
  * `mention-popover.tsx` nor `slash-command-popover.tsx` had.
9
9
  */
10
- export declare function MentionMenu({ sections, selectedIndex, loading, onSelect, onHover, space, }: {
10
+ export declare function MentionMenu({ sections, selectedIndex, loading, onSelect, onHover, space, notice, }: {
11
11
  sections: MentionSection[];
12
12
  selectedIndex: number;
13
13
  loading: boolean;
14
+ /** One quiet status line under the rows, e.g. a Drive search that failed. */
15
+ notice?: string;
14
16
  /** A space's menu: each row is a face, a name and a quiet second line. */
15
17
  space?: boolean;
16
18
  onSelect: (row: MenuRow) => void;
@@ -19,6 +21,19 @@ export declare function MentionMenu({ sections, selectedIndex, loading, onSelect
19
21
  * highlight honest: what you point at is what Enter takes. */
20
22
  onHover?: (row: MenuRow) => void;
21
23
  }): import("react").JSX.Element;
24
+ /**
25
+ * The project's Drive as an `@` source: the host's project, and what a picked
26
+ * file does (the composer attaches it). Null where Drive is off or the
27
+ * composer has no project.
28
+ */
29
+ export interface DriveMentionSource {
30
+ projectId: string;
31
+ onPick: (file: {
32
+ path: string;
33
+ name: string;
34
+ size?: number;
35
+ }) => void;
36
+ }
22
37
  export interface MentionMenuHostProps {
23
38
  query: string;
24
39
  agents: Agent[];
@@ -26,6 +41,8 @@ export interface MentionMenuHostProps {
26
41
  currentSessionId: string | undefined;
27
42
  /** Inside a space: People and Agents only. */
28
43
  spaceMentions?: SpaceMentionSource | null;
44
+ /** The project's Drive files the viewer may read, searched by `query`. */
45
+ drive?: DriveMentionSource | null;
29
46
  /** Fixed at the moment the menu opened (`Date.now()`, computed in
30
47
  * `mention-controller.ts`'s `onStart` — never inside this component's
31
48
  * render, and never refreshed on every keystroke) so this prop's identity
@@ -47,4 +64,4 @@ export interface MentionMenuHostProps {
47
64
  * rows exist and what Enter/Tab should select. `selectedIndex` stays an
48
65
  * external prop; this component never owns it.
49
66
  */
50
- export declare function MentionMenuHost({ query, agents, sessions, currentSessionId, spaceMentions, now, selectedIndex, onSelect, onHover, onRowsChange, }: MentionMenuHostProps): import("react").JSX.Element;
67
+ export declare function MentionMenuHost({ query, agents, sessions, currentSessionId, spaceMentions, drive, now, selectedIndex, onSelect, onHover, onRowsChange, }: MentionMenuHostProps): import("react").JSX.Element;
@@ -2,9 +2,13 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import Loading from '../../../primitives/loading.js';
4
4
  import { getFileIcon } from '../../../files/project/components/file-icon.js';
5
+ import { useProjectSearch } from '@kortix/sdk/react';
6
+ import { useDriveFolder, useProjectDrive } from '../../../files/drives/use-drives.js';
5
7
  import { ChatIcon, FolderIcon } from '@phosphor-icons/react';
6
8
  import { useTranslations } from '../../../i18n/index.js';
9
+ import { cn } from '../../../lib/utils.js';
7
10
  import { useEffect, useMemo } from 'react';
11
+ import { useDebouncedValue } from '../hooks/use-debounced-value.js';
8
12
  import { useFileSearch } from '../hooks/use-file-search.js';
9
13
  import { buildMentionSections } from './menu-items.js';
10
14
  import { MenuCard, MenuRow as MenuRowButton, MenuSectionHeading } from './menu-shell.js';
@@ -17,14 +21,14 @@ import { buildSpaceMentionSections } from './space-mentions.js';
17
21
  * `aria-selected` per row: this is the accessibility neither
18
22
  * `mention-popover.tsx` nor `slash-command-popover.tsx` had.
19
23
  */
20
- export function MentionMenu({ sections, selectedIndex, loading, onSelect, onHover, space = false, }) {
24
+ export function MentionMenu({ sections, selectedIndex, loading, onSelect, onHover, space = false, notice, }) {
21
25
  const t = useTranslations('sessionUi.composerMenus');
22
26
  const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
23
27
  // A query that matches nothing keeps the card, with one dead row saying so.
24
28
  // Returning `null` made the menu DISAPPEAR mid-word — indistinguishable from
25
29
  // the menu having closed, and one backspace brought it back from nowhere.
26
30
  if (!sections.length && !loading) {
27
- return (_jsx(MenuCard, { className: "w-[min(26rem,calc(100vw-1.5rem))] rounded-lg", children: _jsx("p", { role: "status", className: "text-muted-foreground px-3 py-2.5 text-sm", children: space ? t('noOneMatches') : t('noMatches') }) }));
31
+ return (_jsxs(MenuCard, { className: "w-[min(26rem,calc(100vw-1.5rem))] rounded-lg", children: [_jsx("p", { role: "status", className: "text-muted-foreground px-3 py-2.5 text-sm", children: space ? t('noOneMatches') : t('noMatches') }), notice && _jsx("p", { className: "text-muted-foreground px-3 pb-2.5 text-xs", children: notice })] }));
28
32
  }
29
33
  return (
30
34
  // `rounded-lg` (8px) — the cap `menu-shell.tsx` documents for app
@@ -35,7 +39,9 @@ export function MentionMenu({ sections, selectedIndex, loading, onSelect, onHove
35
39
  _jsx(MenuCard, { className: "w-[min(26rem,calc(100vw-1.5rem))] rounded-lg", children: _jsxs("div", { role: "listbox", "aria-label": t('mentionSuggestions'), "aria-activedescendant": `mention-row-${selectedIndex}`,
36
40
  // Focusable for AT, but not a tab stop — keyboard interaction stays in
37
41
  // the composer textarea, which proxies arrow/Enter to this listbox.
38
- tabIndex: -1, className: "max-h-[19rem] overflow-y-auto p-1.5", children: [sections.map((section) => (_jsxs("div", { children: [_jsx(MenuSectionHeading, { children: section.heading }), section.items.map((row) => (_jsx(MenuRowButton, { id: `mention-row-${row.index}`, selected: row.index === selectedIndex, onSelect: () => onSelect(row), onHover: () => onHover?.(row), children: space && row.avatar ? (_jsxs(_Fragment, { children: [_jsx(RowAvatar, { avatar: row.avatar }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx("span", { className: "truncate text-sm", children: row.label }), row.description ? (_jsx("span", { className: "text-muted-foreground truncate text-xs", title: row.description, children: row.description })) : null] })] })) : (_jsxs(_Fragment, { children: [_jsx(RowIcon, { row: row }), _jsx("span", { className: "min-w-0 truncate text-sm", children: rowTitle(row) }), row.description && (_jsx("span", { className: "text-muted-foreground ml-auto shrink-0 truncate text-xs", children: row.description }))] })) }, `${row.kind}-${row.value}-${row.index}`)))] }, section.kind))), loading && (_jsxs("div", { className: "text-muted-foreground flex items-center gap-2 px-2 py-2 text-xs", children: [_jsx(Loading, { className: "size-3.5" }), t('searching')] }))] }) }));
42
+ tabIndex: -1, className: "max-h-[19rem] overflow-y-auto p-1.5", children: [sections.map((section) => (_jsxs("div", { children: [_jsx(MenuSectionHeading, { children: section.heading }), section.items.map((row) => (_jsx(MenuRowButton, { id: `mention-row-${row.index}`, selected: row.index === selectedIndex, onSelect: () => onSelect(row), onHover: () => onHover?.(row), children: space && row.avatar ? (_jsxs(_Fragment, { children: [_jsx(RowAvatar, { avatar: row.avatar }), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx("span", { className: "truncate text-sm", children: row.label }), row.description ? (_jsx("span", { className: "text-muted-foreground truncate text-xs", title: row.description, children: row.description })) : null] })] })) : (_jsxs(_Fragment, { children: [_jsx(RowIcon, { row: row }), _jsx("span", { className: "min-w-0 truncate text-sm", children: rowTitle(row) }), row.description && (_jsx("span", { className: cn('text-muted-foreground ml-auto truncate text-xs',
43
+ // A Drive file's folder can be long: it gives way, the name does not.
44
+ row.kind === 'drive' ? 'min-w-0' : 'shrink-0'), title: row.kind === 'drive' ? row.value : undefined, children: row.description }))] })) }, `${row.kind}-${row.value}-${row.index}`)))] }, section.kind))), loading && (_jsxs("div", { className: "text-muted-foreground flex items-center gap-2 px-2 py-2 text-xs", children: [_jsx(Loading, { className: "size-3.5" }), t('searching')] })), notice && _jsx("p", { className: "text-muted-foreground px-2 py-2 text-xs", children: notice })] }) }));
39
45
  }
40
46
  function rowTitle(row) {
41
47
  if (row.kind !== 'file')
@@ -67,22 +73,43 @@ function RowIcon({ row }) {
67
73
  * rows exist and what Enter/Tab should select. `selectedIndex` stays an
68
74
  * external prop; this component never owns it.
69
75
  */
70
- export function MentionMenuHost({ query, agents, sessions, currentSessionId, spaceMentions = null, now, selectedIndex, onSelect, onHover, onRowsChange, }) {
76
+ export function MentionMenuHost({ query, agents, sessions, currentSessionId, spaceMentions = null, drive = null, now, selectedIndex, onSelect, onHover, onRowsChange, }) {
71
77
  const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
78
+ const t = useTranslations('sessionUi.composerMenus');
72
79
  // A space's menu lists no files.
73
80
  const { files, isLoading } = useFileSearch(query, !spaceMentions);
81
+ const driveOn = !!drive && !spaceMentions;
82
+ // Both reads answer only with what the viewer may read. Typed text searches
83
+ // the whole Drive (`GET /v1/projects/:id/search`, which needs a 1+ character
84
+ // `q`); a bare `@` lists the viewer's own folder, newest first, the way the
85
+ // Drive page opens (`GET /v1/drives/:id/files`). The listing also stands in
86
+ // until the first search answers.
87
+ const driveQuery = useDebouncedValue(query, 150);
88
+ const browsing = query.trim() === '';
89
+ const driveSearch = useProjectSearch(drive?.projectId, { q: driveQuery, limit: 20 }, { enabled: driveOn });
90
+ const workspaceDrive = useProjectDrive(drive?.projectId, driveOn);
91
+ const folder = useDriveFolder(driveOn ? (workspaceDrive.data?.driveId ?? null) : null, workspaceDrive.data?.personalFolder ?? '/');
92
+ const folderFiles = useMemo(() => folder.data?.entries
93
+ .filter((entry) => entry.type === 'file')
94
+ .sort((a, b) => b.mtime - a.mtime)
95
+ .map(({ path, name, size }) => ({ path, name, kind: 'file', size })), [folder.data]);
96
+ const driveFiles = !driveOn ? undefined : browsing || !driveSearch.data ? folderFiles : driveSearch.data.hits;
74
97
  const sections = useMemo(() => spaceMentions ? buildSpaceMentionSections(spaceMentions, query) : buildMentionSections({
75
98
  agents,
76
99
  sessions,
77
100
  files,
101
+ driveFiles,
102
+ driveHeading: t('drive'),
78
103
  query,
79
104
  currentSessionId,
80
105
  now,
81
106
  tI18nComplete,
82
- }), [agents, sessions, files, query, currentSessionId, now, tI18nComplete, spaceMentions]);
107
+ }), [agents, sessions, files, driveFiles, t, query, currentSessionId, now, tI18nComplete, spaceMentions]);
108
+ const driveLoading = driveOn && (browsing ? workspaceDrive.isLoading || folder.isLoading : driveSearch.isFetching && !driveSearch.data);
109
+ const driveFailed = driveOn && (browsing ? workspaceDrive.isError || folder.isError : driveSearch.isError);
83
110
  const rows = useMemo(() => sections.flatMap((s) => s.items), [sections]);
84
111
  useEffect(() => {
85
112
  onRowsChange(rows);
86
113
  }, [rows, onRowsChange]);
87
- return (_jsx(MentionMenu, { sections: sections, selectedIndex: selectedIndex, loading: spaceMentions ? false : isLoading, onSelect: onSelect, onHover: onHover, space: !!spaceMentions }));
114
+ return (_jsx(MentionMenu, { sections: sections, selectedIndex: selectedIndex, loading: spaceMentions ? false : isLoading || driveLoading, onSelect: onSelect, onHover: onHover, space: !!spaceMentions, notice: driveFailed ? t('driveSearchFailed') : undefined }));
88
115
  }
@@ -16,6 +16,8 @@ export interface MenuRow {
16
16
  };
17
17
  /** A space's `@` menu: an agent not in the space yet; picking it adds it. */
18
18
  addToSpace?: boolean;
19
+ /** A Drive file's bytes: one past the message limit is refused before it downloads. */
20
+ size?: number;
19
21
  }
20
22
  export interface MentionSection {
21
23
  kind: MentionKind;
@@ -23,14 +25,27 @@ export interface MentionSection {
23
25
  items: MenuRow[];
24
26
  }
25
27
  export declare function formatRelativeTime(timestamp: number, now: number): string;
28
+ /** A Drive search hit (`searchProject`), as the `@` menu reads it. */
29
+ export interface DriveFileHit {
30
+ path: string;
31
+ name: string;
32
+ kind: 'file' | 'dir';
33
+ size: number;
34
+ }
26
35
  export interface BuildMentionSectionsInput {
27
36
  agents: Agent[];
28
37
  sessions: Session[];
29
38
  files: string[];
39
+ /** Drive hits for `query`, already filtered by the server to what the viewer may read. */
40
+ driveFiles?: readonly DriveFileHit[];
41
+ /** The Drive section's heading, in the host's words. */
42
+ driveHeading?: string;
30
43
  query: string;
31
44
  currentSessionId: string | undefined;
32
45
  /** Injected so the test is deterministic. */
33
46
  now?: number;
34
47
  tI18nComplete?: UiTranslator;
35
48
  }
36
- export declare function buildMentionSections({ agents, sessions, files, query, currentSessionId, now, tI18nComplete, }: BuildMentionSectionsInput): MentionSection[];
49
+ /** The folder a Drive path sits in: `/Company/a.png` → `/Company`, `/a.png` → `/`. */
50
+ export declare function driveFolderOf(path: string): string;
51
+ export declare function buildMentionSections({ agents, sessions, files, driveFiles, driveHeading, query, currentSessionId, now, tI18nComplete, }: BuildMentionSectionsInput): MentionSection[];
@@ -17,6 +17,12 @@ export function formatRelativeTime(timestamp, now) {
17
17
  }
18
18
  const SESSION_LIMIT = 5;
19
19
  const FILE_LIMIT = 20;
20
+ const DRIVE_LIMIT = 8;
21
+ /** The folder a Drive path sits in: `/Company/a.png` → `/Company`, `/a.png` → `/`. */
22
+ export function driveFolderOf(path) {
23
+ const cut = path.lastIndexOf('/');
24
+ return cut > 0 ? path.slice(0, cut) : '/';
25
+ }
20
26
  /**
21
27
  * A session also matches when the query hits a file path it changed
22
28
  * (`summary.diffs[].file`) — not just its title or id. This preserves a real
@@ -36,7 +42,7 @@ function sessionMatchesQuery(session, q) {
36
42
  }
37
43
  return false;
38
44
  }
39
- export function buildMentionSections({ agents, sessions, files, query, currentSessionId, now = 0, tI18nComplete, }) {
45
+ export function buildMentionSections({ agents, sessions, files, driveFiles = [], driveHeading = 'Drive', query, currentSessionId, now = 0, tI18nComplete, }) {
40
46
  const heading = (value) => tI18nComplete
41
47
  ? translateUiCatalogText(value, tI18nComplete, REMAINING_UI_TRANSLATION_KEYS)
42
48
  : value;
@@ -89,5 +95,19 @@ export function buildMentionSections({ agents, sessions, files, query, currentSe
89
95
  .map((f) => ({ index: index++, kind: 'file', label: f, value: f }));
90
96
  if (fileRows.length)
91
97
  sections.push({ kind: 'file', heading: heading('Files'), items: fileRows });
98
+ // Files only, matched by name or folder (the search also matches text), one
99
+ // row per path. The folder is always shown: two `logo.png` differ only there.
100
+ const seen = new Set();
101
+ const driveRows = [];
102
+ for (const hit of driveFiles) {
103
+ if (driveRows.length >= DRIVE_LIMIT)
104
+ break;
105
+ if (hit.kind !== 'file' || seen.has(hit.path) || !hit.path.toLowerCase().includes(q))
106
+ continue;
107
+ seen.add(hit.path);
108
+ driveRows.push({ index: index++, kind: 'drive', label: hit.name, value: hit.path, description: driveFolderOf(hit.path), size: hit.size });
109
+ }
110
+ if (driveRows.length)
111
+ sections.push({ kind: 'drive', heading: driveHeading, items: driveRows });
92
112
  return sections;
93
113
  }
@@ -6,4 +6,6 @@
6
6
  */
7
7
  export declare function createSubmitLatch<Draft>(dispatch: (stashed?: Draft) => Promise<void>,
8
8
  /** Capture and clear a distinct draft, or return null for a double-fire. */
9
- captureDraft: () => Draft | null): () => Promise<void>;
9
+ captureDraft: () => Draft | null,
10
+ /** True refuses this submit before anything is captured or cleared: the draft stays in the editor. */
11
+ refuse?: () => boolean): () => Promise<void>;
@@ -6,7 +6,9 @@
6
6
  */
7
7
  export function createSubmitLatch(dispatch,
8
8
  /** Capture and clear a distinct draft, or return null for a double-fire. */
9
- captureDraft) {
9
+ captureDraft,
10
+ /** True refuses this submit before anything is captured or cleared: the draft stays in the editor. */
11
+ refuse = () => false) {
10
12
  let inFlight = 0;
11
13
  const run = async (draft) => {
12
14
  inFlight += 1;
@@ -18,6 +20,8 @@ captureDraft) {
18
20
  }
19
21
  };
20
22
  return () => {
23
+ if (refuse())
24
+ return Promise.resolve();
21
25
  if (inFlight > 0) {
22
26
  const draft = captureDraft();
23
27
  return draft === null ? Promise.resolve() : run(draft);
@@ -15,6 +15,8 @@ export type AttachedFile = {
15
15
  file: File;
16
16
  localUrl: string;
17
17
  isImage: boolean;
18
+ /** Staged from the project's Drive by an `@` pick: the file's Drive path. */
19
+ drivePath?: string;
18
20
  } | {
19
21
  kind: 'remote';
20
22
  url: string;
@@ -34,9 +36,14 @@ export type AttachedFile = {
34
36
  /** Bytes on the server: the tray counts them toward the message limits. */
35
37
  size: number;
36
38
  isImage: boolean;
39
+ /** Staged from the project's Drive by an `@` pick: the file's Drive path. */
40
+ drivePath?: string;
37
41
  };
38
- /** `person`: a member of a space (`@` menu inside a space only); it leaves the composer as plain `@token` text. */
39
- export type MentionKind = 'file' | 'agent' | 'session' | 'person';
42
+ /**
43
+ * `person`: a member of a space (`@` menu inside a space only); it leaves the composer as plain `@token` text.
44
+ * `drive`: a file in the project's Drive. `label` is its name, `value` its Drive path.
45
+ */
46
+ export type MentionKind = 'file' | 'agent' | 'session' | 'person' | 'drive';
40
47
  /**
41
48
  * Every kind of chip the editor document can hold.
42
49
  *
@@ -77,6 +77,6 @@ export function SessionChangesIndicator({ sessionId }) {
77
77
  ? 'text6b02e0d363a4'
78
78
  : meta.label === 'Removed'
79
79
  ? 'text4118fb4fed0e'
80
- : 'text7117f0807129') }), dir && (_jsx("span", { className: "text-muted-foreground/60 ml-auto max-w-[45%] shrink-0 truncate", children: dir }))] }, file.file));
80
+ : 'text7117f0807129') }), dir && (_jsx("span", { className: "text-muted-foreground ml-auto max-w-[45%] shrink-0 truncate", children: dir }))] }, file.file));
81
81
  }) }) }), _jsxs("div", { className: "border-border flex items-center justify-between gap-2 border-t px-3 py-2.5", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: viewChanges, children: tI18nHardcoded.raw('autoFeaturesSessionHeaderSessionChangesIndicatorJsxTextViewChangesaf192a3b') }), canOpen ? (_jsxs(Button, { size: "sm", onClick: openChangeRequest, disabled: asking, children: [asking ? _jsx(Loading, { className: "size-3.5 shrink-0" }) : null, tI18nHardcoded.raw('autoFeaturesSessionHeaderSessionChangesIndicatorJsxTextOpenChangedc3b8624')] })) : null] })] })] }));
82
82
  }
@@ -45,7 +45,7 @@ import { SESSION_BAR_CLASS } from '../../internal/layout/panel-chrome.js';
45
45
  import { Kbd, KbdGroup } from '../../primitives/kbd.js';
46
46
  import { createProjectSession, directSubsessions, restartProjectSession, stopProjectSession } from '@kortix/sdk';
47
47
  import { qk, useHasSessionDesktop, useProjectSession, useRuntimeSupports, useSessionChildren, useSessionParticipants, useSessionWatch, } from '@kortix/sdk/react';
48
- import { ArchiveIcon, ArrowsClockwiseIcon, BellIcon, BellSlashIcon, GitForkIcon, LinkSimpleIcon, ListBulletsIcon, CaretDownIcon, CodeSimpleIcon as Code2, FileArrowDownIcon as FileDown, FolderSimpleIcon, GlobeSimpleIcon, MonitorIcon, StackIcon as Layers, PencilSimpleIcon, PushPinIcon, PushPinSlashIcon, ArrowCounterClockwiseIcon as RotateCcw, ShareIcon as Share, SquareIcon as Square, TerminalIcon, TrashIcon, } from '@phosphor-icons/react';
48
+ import { ArchiveIcon, ArrowsClockwiseIcon, BellIcon, BellSlashIcon, GitForkIcon, LinkSimpleIcon, ListBulletsIcon, CaretDownIcon, CodeSimpleIcon as Code2, FileArrowDownIcon as FileDown, FolderSimpleIcon, GlobeSimpleIcon, MonitorIcon, StackIcon as Layers, PencilSimpleIcon, PushPinIcon, PushPinSlashIcon, ArrowCounterClockwiseIcon as RotateCcw, ShareNetworkIcon as Share, SquareIcon as Square, TerminalIcon, TrashIcon, } from '@phosphor-icons/react';
49
49
  import { useMutation, useQueryClient } from '@tanstack/react-query';
50
50
  import { useMemo, useRef, useState } from 'react';
51
51
  const modKey = typeof navigator !== 'undefined' && /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? '⌘' : 'Ctrl';
@@ -316,7 +316,7 @@ export function SessionSiteHeader({ sessionId, sessionTitle, isMobileView, leadi
316
316
  return;
317
317
  renameFromMenu.current = false;
318
318
  e.preventDefault();
319
- }, children: sessionActionItems })] })] }), leadingAction] }), _jsxs("div", { className: cn('pointer-events-auto flex items-center gap-1.5', sidebarHidden && 'h-[var(--kx-titlebar-control-size)]'), children: [_jsx(SessionChangesIndicator, { sessionId: sessionId }), _jsx(SessionPendingApprovalsIndicator, { sessionId: sessionId }), isProjectSession ? _jsx(SessionGoalIndicator, {}) : null, isProjectSession ? _jsx(SessionRemindersIndicator, { runtimeSessionId: sessionId }) : null, isProjectSession && (_jsx(SessionConfigIndicator, { projectId: projectId, sessionId: projectSessionId, chatSessionId: sessionId, baseRef: projectSession?.base_ref, reload: reloadConfig.reload, isPending: reloadConfig.isPending, phase: reloadConfig.phase, canReload: canManageLifecycle })), _jsx(Hint, { side: "bottom", sideOffset: 4, delayDuration: 300, label: _jsxs("span", { className: "flex items-center gap-1.5", children: [rightPaneLabel, !isMobileViewport && (_jsxs(KbdGroup, { children: [_jsx(Kbd, { className: "font-mono", children: modKey }), _jsx(Kbd, { className: "font-mono", children: "I" })] }))] }), children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": rightPaneLabel, "aria-expanded": rightPaneOpen, "aria-keyshortcuts": isMobileViewport ? undefined : 'Meta+I Control+I', onClick: !isMobileViewport && isDetailPanelOpen ? toggleRightPanel : toggleActionPanel, "data-state": rightPaneOpen ? 'open' : 'closed', className: "text-foreground data-[state=open]:bg-card cursor-pointer transition-colors active:scale-[0.96]", children: _jsxs("span", { className: "relative inline-flex", children: [_jsx(ListBulletsIcon, { className: "size-4" }), readyChip?.sessionId === sessionId && !rightPaneOpen && (_jsx("span", { className: "bg-kortix-green ring-background absolute -top-1 -right-1 size-2 rounded-full ring-2", "aria-hidden": true }))] }) }) }), _jsx("div", { className: "hidden items-center gap-1.5 lg:flex", children: devTools.map(({ view, label, Icon }) => (_jsx(Hint, { side: "bottom", sideOffset: 4, delayDuration: 300, label: label, children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": label, onClick: () => openSessionQuickView(view, 'header'), className: "text-foreground cursor-pointer transition-colors active:scale-[0.96]", children: _jsx(Icon, { className: "h-4 w-4" }) }) }, view))) }), _jsxs(DropdownMenu, { children: [_jsx(Hint, { side: "bottom", sideOffset: 4, delayDuration: 300, label: tI18nHardcoded.raw('i18nComplete.text96f0c06bbcb7'), children: _jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": tI18nHardcoded.raw('i18nComplete.text96f0c06bbcb7'), className: "text-foreground cursor-pointer transition-colors active:scale-[0.96] lg:hidden", children: _jsx(Code2, { className: "h-4 w-4" }) }) }) }), _jsx(DropdownMenuContent, { align: "end", className: "w-44", children: devTools.map(({ view, label, Icon }) => (_jsxs(DropdownMenuItem, { className: "cursor-pointer", onClick: () => openSessionQuickView(view, 'header'), children: [_jsx(Icon, {}), label] }, view))) })] }), isProjectSession && projectSession && (_jsx(SessionParticipantStack, { participants: sessionParticipants })), isProjectSession && projectSession && ShareSessionModal && (_jsx(Hint, { side: "bottom", sideOffset: 4, delayDuration: 300, label: shareLabel, open: isMobileViewport ? undefined : false, children: _jsxs(Button, { variant: "ghost", size: "xs", "aria-label": shareLabel, onClick: () => setShareOpen(true), className: "cursor-pointer rounded-md active:scale-[0.96] max-md:w-7 max-md:has-[>svg]:px-0", children: [_jsx(Share, {}), _jsx("span", { className: "hidden md:inline", children: tI18nHardcoded.raw('i18nComplete.text29887a5ff984') })] }) }))] })] }), isProjectSession && _jsx(PreviousRepositoryNotice, {})] }), _jsx(ExportTranscriptModal, { sessionId: sessionId, kortixSessionScope: isProjectSession ? `${projectId}/${projectSessionId}` : undefined, open: exportOpen, onOpenChange: setExportOpen }), _jsx(CompactModal, { sessionId: sessionId, open: compactOpen, onOpenChange: setCompactOpen }), isProjectSession && (_jsxs(_Fragment, { children: [_jsx(SessionConfigReloadConfirm, { busyReason: reloadConfig.busyReason, isPending: reloadConfig.isPending, onConfirm: () => reloadConfig.reload({ force: true }), onDismiss: reloadConfig.clearBusy }), ShareSessionModal && (_jsx(ShareSessionModal, { projectId: projectId, session: projectSession, open: shareOpen, onOpenChange: setShareOpen, onSaved: () => queryClient.invalidateQueries({
319
+ }, children: sessionActionItems })] })] }), leadingAction] }), _jsxs("div", { className: cn('pointer-events-auto flex items-center gap-1.5', sidebarHidden && 'h-[var(--kx-titlebar-control-size)]'), children: [_jsx(SessionChangesIndicator, { sessionId: sessionId }), _jsx(SessionPendingApprovalsIndicator, { sessionId: sessionId }), isProjectSession ? _jsx(SessionGoalIndicator, {}) : null, isProjectSession ? _jsx(SessionRemindersIndicator, { runtimeSessionId: sessionId }) : null, isProjectSession && (_jsx(SessionConfigIndicator, { projectId: projectId, sessionId: projectSessionId, chatSessionId: sessionId, baseRef: projectSession?.base_ref, reload: reloadConfig.reload, isPending: reloadConfig.isPending, phase: reloadConfig.phase, canReload: canManageLifecycle })), _jsx(Hint, { side: "bottom", sideOffset: 4, delayDuration: 300, label: _jsxs("span", { className: "flex items-center gap-1.5", children: [rightPaneLabel, !isMobileViewport && (_jsxs(KbdGroup, { children: [_jsx(Kbd, { className: "font-mono", children: modKey }), _jsx(Kbd, { className: "font-mono", children: "I" })] }))] }), children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": rightPaneLabel, "aria-expanded": rightPaneOpen, "aria-keyshortcuts": isMobileViewport ? undefined : 'Meta+I Control+I', onClick: !isMobileViewport && isDetailPanelOpen ? toggleRightPanel : toggleActionPanel, "data-state": rightPaneOpen ? 'open' : 'closed', className: "text-foreground data-[state=open]:bg-card cursor-pointer transition-colors active:scale-[0.96]", children: _jsxs("span", { className: "relative inline-flex", children: [_jsx(ListBulletsIcon, { className: "size-4" }), readyChip?.sessionId === sessionId && !rightPaneOpen && (_jsx("span", { className: "bg-kortix-green ring-background absolute -top-1 -right-1 size-2 rounded-full ring-2", "aria-hidden": true }))] }) }) }), _jsx("div", { className: "hidden items-center gap-1.5 lg:flex", children: devTools.map(({ view, label, Icon }) => (_jsx(Hint, { side: "bottom", sideOffset: 4, delayDuration: 300, label: label, children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": label, onClick: () => openSessionQuickView(view, 'header'), className: "text-foreground cursor-pointer transition-colors active:scale-[0.96]", children: _jsx(Icon, { className: "h-4 w-4" }) }) }, view))) }), _jsxs(DropdownMenu, { children: [_jsx(Hint, { side: "bottom", sideOffset: 4, delayDuration: 300, label: tI18nHardcoded.raw('i18nComplete.text96f0c06bbcb7'), children: _jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": tI18nHardcoded.raw('i18nComplete.text96f0c06bbcb7'), className: "text-foreground cursor-pointer transition-colors active:scale-[0.96] lg:hidden", children: _jsx(Code2, { className: "h-4 w-4" }) }) }) }), _jsx(DropdownMenuContent, { align: "end", className: "w-44", children: devTools.map(({ view, label, Icon }) => (_jsxs(DropdownMenuItem, { className: "cursor-pointer", onClick: () => openSessionQuickView(view, 'header'), children: [_jsx(Icon, {}), label] }, view))) })] }), isProjectSession && projectSession && (_jsx(SessionParticipantStack, { participants: sessionParticipants })), isProjectSession && projectSession && ShareSessionModal && (_jsx(Hint, { side: "bottom", sideOffset: 4, delayDuration: 300, label: shareLabel, open: isMobileViewport ? undefined : false, children: _jsxs(Button, { variant: "secondary", size: "xs", "aria-label": shareLabel, onClick: () => setShareOpen(true), className: "cursor-pointer rounded-md active:scale-[0.96] max-md:w-7 max-md:has-[>svg]:px-0", children: [_jsx(Share, {}), _jsx("span", { className: "hidden md:inline", children: tI18nHardcoded.raw('i18nComplete.text29887a5ff984') })] }) }))] })] }), isProjectSession && _jsx(PreviousRepositoryNotice, {})] }), _jsx(ExportTranscriptModal, { sessionId: sessionId, kortixSessionScope: isProjectSession ? `${projectId}/${projectSessionId}` : undefined, open: exportOpen, onOpenChange: setExportOpen }), _jsx(CompactModal, { sessionId: sessionId, open: compactOpen, onOpenChange: setCompactOpen }), isProjectSession && (_jsxs(_Fragment, { children: [_jsx(SessionConfigReloadConfirm, { busyReason: reloadConfig.busyReason, isPending: reloadConfig.isPending, onConfirm: () => reloadConfig.reload({ force: true }), onDismiss: reloadConfig.clearBusy }), ShareSessionModal && (_jsx(ShareSessionModal, { projectId: projectId, session: projectSession, open: shareOpen, onOpenChange: setShareOpen, onSaved: () => queryClient.invalidateQueries({
320
320
  queryKey: qk.project.sessionsScope(projectId ?? ''),
321
321
  }) })), _jsx(SessionDeleteModal, { projectId: projectId, sessionId: projectSessionId, sessionLabel: projectTitle, open: deleteOpen, onOpenChange: setDeleteOpen, onDeleted: () => router.push(uiRoutes().project(projectId)) })] }))] }));
322
322
  }
@@ -94,11 +94,11 @@ function InlineIframePreview({ proxyUrl, port }) {
94
94
  }, 5000);
95
95
  return clearLoadTimeout;
96
96
  }, [isLoading, refreshKey, clearLoadTimeout]);
97
- return (_jsxs("div", { className: cn('border-border/50 mt-2 overflow-hidden rounded-md border transition-colors duration-200', expanded ? 'h-[480px]' : 'h-[280px]'), children: [_jsxs("div", { className: "bg-muted/40 border-border/30 flex h-8 shrink-0 items-center gap-1.5 border-b px-2.5", children: [_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1.5", children: [_jsx(Globe, { className: "text-muted-foreground/50 h-3 w-3 shrink-0" }), _jsxs("span", { className: "text-muted-foreground truncate font-mono text-xs", children: [tHardcodedUi.raw('i18nComplete.text91901080526c'), port] })] }), _jsx(Hint, { side: "top", label: tHardcodedUi.raw('i18nComplete.text5b529abadacc'), children: _jsx("button", { type: "button", onClick: handleRefresh, "aria-label": tHardcodedUi.raw('i18nComplete.text5b529abadacc'), className: "hover:bg-muted/60 text-muted-foreground/50 hover:text-muted-foreground hit-area-2 rounded p-1 transition-colors active:scale-[0.96]", children: isLoading ? (_jsx(Loading, { className: "in-[button]:text-muted-foreground size-3" })) : (_jsx(RefreshCw, { className: "size-3" })) }) }), _jsx(Hint, { side: "top", label: expanded
97
+ return (_jsxs("div", { className: cn('border-border/50 mt-2 overflow-hidden rounded-md border transition-colors duration-200', expanded ? 'h-[480px]' : 'h-[280px]'), children: [_jsxs("div", { className: "bg-muted/40 border-border/30 flex h-8 shrink-0 items-center gap-1.5 border-b px-2.5", children: [_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-1.5", children: [_jsx(Globe, { className: "text-muted-foreground h-3 w-3 shrink-0" }), _jsxs("span", { className: "text-muted-foreground truncate font-mono text-xs", children: [tHardcodedUi.raw('i18nComplete.text91901080526c'), port] })] }), _jsx(Hint, { side: "top", label: tHardcodedUi.raw('i18nComplete.text5b529abadacc'), children: _jsx("button", { type: "button", onClick: handleRefresh, "aria-label": tHardcodedUi.raw('i18nComplete.text5b529abadacc'), className: "hover:bg-muted/60 text-muted-foreground hover:text-foreground hit-area-2 rounded p-1 transition-colors active:scale-[0.96]", children: isLoading ? (_jsx(Loading, { className: "in-[button]:text-muted-foreground size-3" })) : (_jsx(RefreshCw, { className: "size-3" })) }) }), _jsx(Hint, { side: "top", label: expanded
98
98
  ? tHardcodedUi.raw('i18nComplete.text90e8d06c0309')
99
99
  : tHardcodedUi.raw('i18nComplete.text59edd3fe9cc5'), children: _jsx("button", { type: "button", onClick: () => setExpanded((v) => !v), "aria-label": expanded
100
100
  ? tHardcodedUi.raw('i18nComplete.text90e8d06c0309')
101
- : tHardcodedUi.raw('i18nComplete.text59edd3fe9cc5'), className: "hover:bg-muted/60 text-muted-foreground/50 hover:text-muted-foreground hit-area-2 rounded p-1 transition-colors active:scale-[0.96]", children: expanded ? _jsx(Minimize2, { className: "size-3" }) : _jsx(Maximize2, { className: "size-3" }) }) })] }), _jsxs("div", { className: "relative h-[calc(100%-2rem)] flex-1", children: [(isLoading || !isAuthReady) && (_jsx("div", { className: "bg-background/60 absolute inset-0 z-10 flex items-center justify-center", children: _jsxs("div", { className: "text-muted-foreground flex items-center gap-2", children: [_jsx(Loading, { className: "size-4 shrink-0" }), _jsx("span", { className: "text-xs", children: !isAuthReady ? 'Authenticating...' : 'Loading...' })] }) })), hasError && (_jsx("div", { className: "bg-background absolute inset-0 z-10 flex items-center justify-center", children: _jsxs("div", { className: "text-muted-foreground text-center", children: [_jsx("p", { className: "text-xs", children: tHardcodedUi.raw('componentsThreadContentSandboxUrlDetector.line186JsxTextFailedToLoad') }), _jsx("button", { onClick: handleRefresh, className: "text-primary mt-1 text-xs hover:underline", children: tHardcodedUi.raw('i18nComplete.text942087cc2d41') })] }) })), isAuthReady && (_jsx("iframe", { ref: iframeRef, src: authenticatedUrl, title: tHardcodedUi('i18nComplete.text8d0218f233bb', { value0: port }), className: "h-full w-full border-0 bg-white", sandbox: framePolicy('app', authenticatedUrl).sandbox, onLoad: handleLoad, onError: handleError }, refreshKey))] })] }));
101
+ : tHardcodedUi.raw('i18nComplete.text59edd3fe9cc5'), className: "hover:bg-muted/60 text-muted-foreground hover:text-foreground hit-area-2 rounded p-1 transition-colors active:scale-[0.96]", children: expanded ? _jsx(Minimize2, { className: "size-3" }) : _jsx(Maximize2, { className: "size-3" }) }) })] }), _jsxs("div", { className: "relative h-[calc(100%-2rem)] flex-1", children: [(isLoading || !isAuthReady) && (_jsx("div", { className: "bg-background/60 absolute inset-0 z-10 flex items-center justify-center", children: _jsxs("div", { className: "text-muted-foreground flex items-center gap-2", children: [_jsx(Loading, { className: "size-4 shrink-0" }), _jsx("span", { className: "text-xs", children: !isAuthReady ? 'Authenticating...' : 'Loading...' })] }) })), hasError && (_jsx("div", { className: "bg-background absolute inset-0 z-10 flex items-center justify-center", children: _jsxs("div", { className: "text-muted-foreground text-center", children: [_jsx("p", { className: "text-xs", children: tHardcodedUi.raw('componentsThreadContentSandboxUrlDetector.line186JsxTextFailedToLoad') }), _jsx("button", { onClick: handleRefresh, className: "text-primary mt-1 text-xs hover:underline", children: tHardcodedUi.raw('i18nComplete.text942087cc2d41') })] }) })), isAuthReady && (_jsx("iframe", { ref: iframeRef, src: authenticatedUrl, title: tHardcodedUi('i18nComplete.text8d0218f233bb', { value0: port }), className: "h-full w-full border-0 bg-white", sandbox: framePolicy('app', authenticatedUrl).sandbox, onLoad: handleLoad, onError: handleError }, refreshKey))] })] }));
102
102
  }
103
103
  function SandboxUrlChip({ detected, proxyUrl, }) {
104
104
  const tHardcodedUi = useTranslations('hardcodedUi');
@@ -126,7 +126,7 @@ function SandboxUrlChip({ detected, proxyUrl, }) {
126
126
  window.open(proxyUrl, '_blank', 'noopener,noreferrer');
127
127
  }, [openPreview, detected.originalUrl, proxyUrl]);
128
128
  const displayPath = detected.path !== '/' ? detected.path : '';
129
- return (_jsxs("div", { className: "group/chip hover:bg-sidebar flex items-center gap-2 px-3 py-2", children: [_jsx(Globe, { className: "text-muted-foreground size-3.5 shrink-0" }), _jsxs("button", { onClick: navigateToPreviewTab, className: "group/link flex min-w-0 items-baseline gap-1 text-left", children: [_jsxs("span", { className: "text-foreground/80 group-hover/link:text-primary text-xs font-medium whitespace-nowrap tabular-nums transition-colors", children: [tHardcodedUi.raw('i18nComplete.text91901080526c'), detected.port] }), displayPath && (_jsx("span", { className: "text-muted-foreground/60 group-hover/link:text-primary/70 truncate font-mono text-xs transition-colors", children: displayPath }))] }), _jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/chip:opacity-100", children: [_jsx(CopyButton, { code: proxyUrl }), _jsx(Hint, { label: tHardcodedUi.raw('componentsThreadContentSandboxUrlDetector.line509JsxTextOpenInBrowser'), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", onClick: handleOpenExternal, "aria-label": tHardcodedUi.raw('componentsThreadContentSandboxUrlDetector.line509JsxTextOpenInBrowser'), children: _jsx(ExternalLink, { className: "size-4" }) }) }), _jsx(Hint, { label: tHardcodedUi.raw('componentsThreadContentSandboxUrlDetector.line521JsxTextOpenPreview'), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", onClick: navigateToPreviewTab, "aria-label": tHardcodedUi.raw('componentsThreadContentSandboxUrlDetector.line521JsxTextOpenPreview'), children: _jsx(MonitorPlay, { className: "size-4" }) }) })] })] }));
129
+ return (_jsxs("div", { className: "group/chip hover:bg-sidebar flex items-center gap-2 px-3 py-2", children: [_jsx(Globe, { className: "text-muted-foreground size-3.5 shrink-0" }), _jsxs("button", { onClick: navigateToPreviewTab, className: "group/link flex min-w-0 items-baseline gap-1 text-left", children: [_jsxs("span", { className: "text-foreground/80 group-hover/link:text-primary text-xs font-medium whitespace-nowrap tabular-nums transition-colors", children: [tHardcodedUi.raw('i18nComplete.text91901080526c'), detected.port] }), displayPath && (_jsx("span", { className: "text-muted-foreground group-hover/link:text-primary/70 truncate font-mono text-xs transition-colors", children: displayPath }))] }), _jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/chip:opacity-100", children: [_jsx(CopyButton, { code: proxyUrl }), _jsx(Hint, { label: tHardcodedUi.raw('componentsThreadContentSandboxUrlDetector.line509JsxTextOpenInBrowser'), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", onClick: handleOpenExternal, "aria-label": tHardcodedUi.raw('componentsThreadContentSandboxUrlDetector.line509JsxTextOpenInBrowser'), children: _jsx(ExternalLink, { className: "size-4" }) }) }), _jsx(Hint, { label: tHardcodedUi.raw('componentsThreadContentSandboxUrlDetector.line521JsxTextOpenPreview'), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", onClick: navigateToPreviewTab, "aria-label": tHardcodedUi.raw('componentsThreadContentSandboxUrlDetector.line521JsxTextOpenPreview'), children: _jsx(MonitorPlay, { className: "size-4" }) }) })] })] }));
130
130
  }
131
131
  /**
132
132
  * Detects localhost URLs inside markdown code blocks and renders compact chips.
@@ -10,6 +10,11 @@
10
10
  * click away in the model picker and the provider dialog.
11
11
  *
12
12
  * `show` must only flip on settled data (see `entitlementsPending`).
13
+ *
14
+ * On project home (`SubscriptionOfferContext`) the bar also owns the optional
15
+ * `SubscriptionOffer`, in the same slot, when the composer has a model. One
16
+ * owner, one decision: the composer's selection. The page's `/model-picker`
17
+ * read can disagree with it, and then both sets of rows rendered.
13
18
  */
14
19
  export declare function ModelConnectionBar({ show }: {
15
20
  show: boolean;
@@ -6,8 +6,8 @@ import { useReducedMotion } from '../../internal/hooks/use-reduced-motion.js';
6
6
  import { useContext, useState } from 'react';
7
7
  import { useTranslations } from '../../i18n/index.js';
8
8
  import { Button } from '../../primitives/button.js';
9
- import { ModelConnectionLayoutContext } from './model-connection-layout.js';
10
- import { ConnectPlanRows } from './subscription-offer.js';
9
+ import { ModelConnectionLayoutContext, SubscriptionOfferContext } from './model-connection-layout.js';
10
+ import { ConnectPlanRows, SubscriptionOffer } from './subscription-offer.js';
11
11
  import { useModelConnectionGate } from './use-model-connection-gate.js';
12
12
  // Enter waits a beat (delay) so the composer paints first, then the bar slides
13
13
  // out from under it — height opens the space while the strip translates down,
@@ -27,10 +27,19 @@ const BAR_EXIT = { type: 'spring', duration: 0.35, bounce: 0 };
27
27
  * click away in the model picker and the provider dialog.
28
28
  *
29
29
  * `show` must only flip on settled data (see `entitlementsPending`).
30
+ *
31
+ * On project home (`SubscriptionOfferContext`) the bar also owns the optional
32
+ * `SubscriptionOffer`, in the same slot, when the composer has a model. One
33
+ * owner, one decision: the composer's selection. The page's `/model-picker`
34
+ * read can disagree with it, and then both sets of rows rendered.
30
35
  */
31
36
  export function ModelConnectionBar({ show }) {
32
37
  const above = useContext(ModelConnectionLayoutContext) === 'above';
33
- return show ? (_jsxs("div", { className: above ? 'mb-4 flex flex-col gap-2' : 'mt-4 flex flex-col gap-1', children: [_jsx(NoModelReason, {}), _jsx(ConnectPlanRows, { dismissible: false })] })) : null;
38
+ const offerProjectId = useContext(SubscriptionOfferContext);
39
+ if (show) {
40
+ return (_jsxs("div", { className: above ? 'mb-4 flex flex-col gap-2' : 'mt-4 flex flex-col gap-1', children: [_jsx(NoModelReason, {}), _jsx(ConnectPlanRows, { dismissible: false })] }));
41
+ }
42
+ return offerProjectId ? (_jsx(SubscriptionOffer, { projectId: offerProjectId, className: above ? 'mb-4' : 'mt-4' })) : null;
34
43
  }
35
44
  /**
36
45
  * Why Send is disabled, and the two ways out. A Free account sees no Kortix
@@ -1,2 +1,9 @@
1
1
  /** Only the first-chat home puts connection actions above its composer. */
2
2
  export declare const ModelConnectionLayoutContext: import("react").Context<"above" | "below">;
3
+ /**
4
+ * The project whose dismissible `SubscriptionOffer` the composer shows when it
5
+ * has a model. Only project home provides it. The composer is then the one
6
+ * owner of the connect rows: its `ModelConnectionBar` shows the no-model rows
7
+ * or the offer, never both.
8
+ */
9
+ export declare const SubscriptionOfferContext: import("react").Context<string | null>;
@@ -2,3 +2,10 @@
2
2
  import { createContext } from 'react';
3
3
  /** Only the first-chat home puts connection actions above its composer. */
4
4
  export const ModelConnectionLayoutContext = createContext('below');
5
+ /**
6
+ * The project whose dismissible `SubscriptionOffer` the composer shows when it
7
+ * has a model. Only project home provides it. The composer is then the one
8
+ * owner of the connect rows: its `ModelConnectionBar` shows the no-model rows
9
+ * or the offer, never both.
10
+ */
11
+ export const SubscriptionOfferContext = createContext(null);
@@ -8,5 +8,5 @@ import { useTranslations } from '../../i18n/index.js';
8
8
  export function ProviderFailureRecovery({ pendingPrompt, isRetrying, onRetry, onCopy, onDelete, }) {
9
9
  const t = useTranslations('sessionUi.providerRecovery');
10
10
  const attachmentNames = pendingPrompt?.attachment_names ?? [];
11
- return (_jsxs("div", { className: "flex w-full max-w-md flex-col items-center gap-3", children: [pendingPrompt ? (_jsxs("div", { className: "border-border/60 bg-muted/40 w-full rounded-md border px-3 py-2.5 text-left", children: [_jsx("p", { className: "text-muted-foreground mb-1 text-xs font-medium", children: t('savedPrompt') }), pendingPrompt.text ? (_jsx("p", { className: "text-foreground max-h-40 overflow-y-auto text-xs leading-relaxed wrap-break-word whitespace-pre-wrap", children: pendingPrompt.text })) : (_jsx("p", { className: "text-muted-foreground text-xs", children: t('noText') })), attachmentNames.length > 0 ? (_jsxs("div", { className: "border-border/60 mt-2 border-t pt-2", children: [_jsx("p", { className: "text-muted-foreground mb-1 text-xs font-medium", children: t('attachments', { count: attachmentNames.length }) }), _jsx("ul", { className: "text-muted-foreground/70 space-y-0.5 text-xs", children: attachmentNames.map((name, index) => (_jsx("li", { className: "break-all", children: name }, `${name}-${index}`))) }), _jsx("p", { className: "text-muted-foreground/70 mt-1 text-xs", children: t('reattach') })] })) : null] })) : (_jsx("p", { className: "text-muted-foreground text-xs", children: t('unavailable') })), _jsxs("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [_jsxs(Button, { type: "button", size: "sm", variant: "outline", onClick: onRetry, disabled: isRetrying, "aria-busy": isRetrying, children: [isRetrying ? (_jsx(Loading, { className: "size-3.5 shrink-0" })) : (_jsx(ArrowCounterClockwiseIcon, { className: "size-3.5 shrink-0" })), isRetrying ? t('retrying') : t('retry')] }), _jsxs(Button, { type: "button", size: "sm", variant: "outline", onClick: onCopy, disabled: !pendingPrompt?.text, children: [_jsx(CopyIcon, { className: "size-3.5 shrink-0" }), t('copy')] }), _jsxs(Button, { type: "button", size: "sm", variant: "destructive", onClick: onDelete, children: [_jsx(TrashIcon, { className: "size-3.5 shrink-0" }), t('delete')] })] })] }));
11
+ return (_jsxs("div", { className: "flex w-full max-w-md flex-col items-center gap-3", children: [pendingPrompt ? (_jsxs("div", { className: "border-border/60 bg-muted/40 w-full rounded-md border px-3 py-2.5 text-left", children: [_jsx("p", { className: "text-muted-foreground mb-1 text-xs font-medium", children: t('savedPrompt') }), pendingPrompt.text ? (_jsx("p", { className: "text-foreground max-h-40 overflow-y-auto text-xs leading-relaxed wrap-break-word whitespace-pre-wrap", children: pendingPrompt.text })) : (_jsx("p", { className: "text-muted-foreground text-xs", children: t('noText') })), attachmentNames.length > 0 ? (_jsxs("div", { className: "border-border/60 mt-2 border-t pt-2", children: [_jsx("p", { className: "text-muted-foreground mb-1 text-xs font-medium", children: t('attachments', { count: attachmentNames.length }) }), _jsx("ul", { className: "text-muted-foreground space-y-0.5 text-xs", children: attachmentNames.map((name, index) => (_jsx("li", { className: "break-all", children: name }, `${name}-${index}`))) }), _jsx("p", { className: "text-muted-foreground mt-1 text-xs", children: t('reattach') })] })) : null] })) : (_jsx("p", { className: "text-muted-foreground text-xs", children: t('unavailable') })), _jsxs("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [_jsxs(Button, { type: "button", size: "sm", variant: "outline", onClick: onRetry, disabled: isRetrying, "aria-busy": isRetrying, children: [isRetrying ? (_jsx(Loading, { className: "size-3.5 shrink-0" })) : (_jsx(ArrowCounterClockwiseIcon, { className: "size-3.5 shrink-0" })), isRetrying ? t('retrying') : t('retry')] }), _jsxs(Button, { type: "button", size: "sm", variant: "outline", onClick: onCopy, disabled: !pendingPrompt?.text, children: [_jsx(CopyIcon, { className: "size-3.5 shrink-0" }), t('copy')] }), _jsxs(Button, { type: "button", size: "sm", variant: "destructive", onClick: onDelete, children: [_jsx(TrashIcon, { className: "size-3.5 shrink-0" }), t('delete')] })] })] }));
12
12
  }
@@ -29,11 +29,12 @@ export declare function ConnectPlanRows({ projectId, dismissible, className, }:
29
29
  * composer. New projects run on Kortix models, and most people already pay
30
30
  * for ChatGPT or Claude.
31
31
  *
32
- * Shown only when a model already runs (with none, the composer's own
33
- * `ModelConnectionBar` shows the same rows, undismissible), no ChatGPT or
34
- * Claude plan serves one yet, and the viewer may change the project's models.
35
- * `px-4` is the composer shell's gutter, so the rows span the card's width.
32
+ * The composer's `ModelConnectionBar` renders it, only when the composer has a
33
+ * model (with none, the bar shows the same rows, undismissible). It then shows
34
+ * when a model already runs, no ChatGPT or Claude plan serves one yet, and the
35
+ * viewer may change the project's models.
36
36
  */
37
- export declare function SubscriptionOffer({ projectId }: {
37
+ export declare function SubscriptionOffer({ projectId, className }: {
38
38
  projectId: string;
39
+ className?: string;
39
40
  }): import("react").JSX.Element | null;