@kortix/ui 0.16.1 → 0.16.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/dist/_vendor/kortix-shared.js +133 -26
  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 +131 -8
  41. package/dist/i18n/en.js +167 -44
  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 +131 -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 +9 -3
  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/sidebar/footer/project-artifacts-nav.js +1 -1
  250. package/dist/workspace/sidebar/footer/project-promo-cards.d.ts +7 -2
  251. package/dist/workspace/sidebar/footer/project-promo-cards.js +4 -3
  252. package/dist/workspace/sidebar/footer/project-sandbox-alert.js +1 -1
  253. package/dist/workspace/sidebar/footer/promo-card.d.ts +10 -1
  254. package/dist/workspace/sidebar/footer/promo-card.js +31 -2
  255. package/dist/workspace/sidebar/modal/session-people-picker.d.ts +13 -0
  256. package/dist/workspace/sidebar/modal/session-people-picker.js +72 -0
  257. package/dist/workspace/sidebar/modal/share-session-modal.js +2 -1
  258. package/dist/workspace/sidebar/project-nav-items.d.ts +1 -3
  259. package/dist/workspace/sidebar/project-nav-items.js +3 -8
  260. package/dist/workspace/sidebar/project-session-list.js +19 -12
  261. package/dist/workspace/sidebar/project-sidebar.js +13 -13
  262. package/dist/workspace/sidebar/project-spaces-nav.js +1 -2
  263. package/dist/workspace/sidebar/session-filter-menu.js +19 -13
  264. package/dist/workspace/sidebar/session-group-sections.d.ts +12 -12
  265. package/dist/workspace/sidebar/session-group-sections.js +56 -75
  266. package/dist/workspace/sidebar/sidebar-more-group.js +1 -1
  267. package/dist/workspace/sidebar/workspace-settings-sidebar-nav.js +2 -2
  268. package/dist/workspace/spaces/space-tabs.d.ts +26 -6
  269. package/dist/workspace/spaces/space-tabs.js +19 -8
  270. package/package.json +27 -31
  271. package/skills/kortix-ui/references/modules.md +2 -2
  272. package/dist/workspace/new/clone-param.d.ts +0 -11
  273. package/dist/workspace/new/clone-param.js +0 -15
  274. package/dist/workspace/new/provision-new-workspace.d.ts +0 -14
  275. package/dist/workspace/new/provision-new-workspace.js +0 -14
  276. package/dist/workspace/sidebar/footer/project-inbox-nav.d.ts +0 -8
  277. package/dist/workspace/sidebar/footer/project-inbox-nav.js +0 -29
@@ -0,0 +1,54 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ArrowsDownUpIcon } from '@phosphor-icons/react';
4
+ import { useSyncExternalStore } from 'react';
5
+ import { Button } from './button.js';
6
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger, } from './dropdown-menu.js';
7
+ import Hint from './hint.js';
8
+ /**
9
+ * A list page's sort: one outline icon button (the size of `ExpandableSearch`'s
10
+ * closed button) that opens the orders as radio rows. The tooltip and the
11
+ * accessible name say the order in use, e.g. "Sort: Last activity".
12
+ */
13
+ export function SortMenu({ value, onValueChange, options, label, }) {
14
+ return (_jsxs(DropdownMenu, { children: [_jsx(Hint, { label: label, children: _jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "outline", size: "icon-base", "aria-label": label, className: "text-muted-foreground hover:text-foreground shrink-0", children: _jsx(ArrowsDownUpIcon, { className: "size-4" }) }) }) }), _jsx(DropdownMenuContent, { align: "end", className: "w-44", children: _jsx(DropdownMenuRadioGroup, { value: value, onValueChange: (next) => onValueChange(next), children: options.map((option) => (_jsx(DropdownMenuRadioItem, { value: option.value, className: "cursor-pointer", children: option.label }, option.value))) }) })] }));
15
+ }
16
+ const SORT_EVENT = 'kortix:stored-sort';
17
+ // The orders picked this visit, for a browser that blocks storage.
18
+ const pickedThisVisit = new Map();
19
+ function readStored(storageKey) {
20
+ try {
21
+ return window.localStorage.getItem(storageKey) ?? pickedThisVisit.get(storageKey) ?? null;
22
+ }
23
+ catch {
24
+ return pickedThisVisit.get(storageKey) ?? null;
25
+ }
26
+ }
27
+ /**
28
+ * The order a viewer picked last on one page, kept in this browser only
29
+ * (`storageKey`). The server and the first render use `fallback`, so the HTML
30
+ * matches; blocked storage, or an order the page no longer offers, also gives
31
+ * `fallback`.
32
+ */
33
+ export function useStoredSort(storageKey, orders, fallback) {
34
+ const stored = useSyncExternalStore((onChange) => {
35
+ window.addEventListener('storage', onChange);
36
+ window.addEventListener(SORT_EVENT, onChange);
37
+ return () => {
38
+ window.removeEventListener('storage', onChange);
39
+ window.removeEventListener(SORT_EVENT, onChange);
40
+ };
41
+ }, () => readStored(storageKey), () => null);
42
+ const sort = orders.includes(stored) ? stored : fallback;
43
+ const update = (next) => {
44
+ pickedThisVisit.set(storageKey, next);
45
+ try {
46
+ window.localStorage.setItem(storageKey, next);
47
+ }
48
+ catch {
49
+ // Blocked storage: the order lasts this visit (`pickedThisVisit`).
50
+ }
51
+ window.dispatchEvent(new Event(SORT_EVENT));
52
+ };
53
+ return [sort, update];
54
+ }
@@ -229,6 +229,6 @@ function FilterBar({ className, ...props }) {
229
229
  }
230
230
  /** Standalone filter pill — works WITHOUT a <Tabs> root. Pair with FilterBar. */
231
231
  function FilterBarItem({ className, ...props }) {
232
- return (_jsx("button", { "data-slot": "filter-bar-item", role: "tab", type: "button", className: cn('duration-normal inline-flex h-[calc(100%-4px)] flex-1 cursor-pointer items-center justify-center gap-1.5 border border-transparent px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-colors', 'text-muted-foreground/60 hover:text-foreground/80', 'data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:ring-foreground/6 data-[state=active]:shadow-sm data-[state=active]:ring-1', 'disabled:pointer-events-none disabled:opacity-50', "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5", className), ...props }));
232
+ return (_jsx("button", { "data-slot": "filter-bar-item", role: "tab", type: "button", className: cn('duration-normal inline-flex h-[calc(100%-4px)] flex-1 cursor-pointer items-center justify-center gap-1.5 border border-transparent px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-colors', 'text-muted-foreground hover:text-foreground/80', 'data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:ring-foreground/6 data-[state=active]:shadow-sm data-[state=active]:ring-1', 'disabled:pointer-events-none disabled:opacity-50', "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5", className), ...props }));
233
233
  }
234
234
  export { FilterBar, FilterBarItem, Tabs, TabsContent, TabsList, tabsSegmentedChipClasses, tabsSegmentedTrackClasses, TabsTrigger, tabsTriggerHeightVariants, tabsTriggerPaddingVariants, tabsTriggerTextVariants, };
@@ -4,49 +4,33 @@ import { type RefObject } from 'react';
4
4
  * window. The app's `<Toaster>` reads its bottom offset from
5
5
  * `--toast-offset-bottom` (`apps/web/src/app/[locale]/layout.tsx`); a docked
6
6
  * composer sets that variable to the distance from its top edge to the window
7
- * bottom while it shares the toast lane. Before this, a toast covered the
7
+ * bottom while it reaches into the toast lane. Before this, a toast covered the
8
8
  * session composer's Send/Stop button (dev audit, 2026-11-14).
9
+ *
10
+ * Toasts always stay in the window's bottom-right corner. They never follow
11
+ * the composer sideways: right-aligning them with the composer pinned them
12
+ * inside the chat column, away from the corner.
9
13
  */
10
14
  export declare const TOAST_OFFSET_VAR = "--toast-offset-bottom";
11
- /**
12
- * The toast's right offset while it is lifted. A lifted toast aligns its right
13
- * edge with the composer's right edge, so it sits flush above the composer
14
- * instead of straddling whatever is docked to the composer's right (the
15
- * session's side panel).
16
- */
17
- export declare const TOAST_OFFSET_RIGHT_VAR = "--toast-offset-right";
18
15
  /** The element whose resize moves a docked composer (the chat column). */
19
16
  export declare const TOAST_ANCHOR_ATTR = "data-toast-anchor";
20
17
  export interface ClearanceRect {
21
18
  top: number;
19
+ bottom: number;
20
+ left: number;
22
21
  right: number;
23
22
  width: number;
24
23
  height: number;
25
24
  }
26
25
  /**
27
- * The bottom offset that puts a toast just above `rect`, or 0 when the element
28
- * is hidden or not docked at the window bottom. A docked composer always
29
- * hosts the toast, wherever it sits horizontally: the toast stands above it,
30
- * right-aligned with it (`toastRightOffset`). Anchoring to the window corner
31
- * instead left the toast straddling whatever is docked beside the composer
32
- * (the session's side panel). A tall composer (long draft, attachments) still
33
- * counts: only its bottom edge says whether it is docked.
26
+ * The bottom offset that puts a corner toast just above `rect`, or 0 when the
27
+ * element is hidden, not docked at the window bottom, or entirely left of the
28
+ * toast lane (the window's right 380px). A tall composer (long draft,
29
+ * attachments) still counts: only its bottom edge says whether it is docked.
34
30
  */
35
- export declare function toastClearance(rect: ClearanceRect & {
36
- bottom: number;
37
- }, viewport: {
31
+ export declare function toastClearance(rect: ClearanceRect, viewport: {
38
32
  width: number;
39
33
  height: number;
40
34
  }): number;
41
- /**
42
- * The right offset that aligns a lifted toast with `rect`'s right edge, or 0
43
- * (keep the default) when nothing lifts it or the viewport stacks toasts full
44
- * width. Never closer to the window edge than Sonner's own 24px.
45
- */
46
- export declare function toastRightOffset(rect: {
47
- right: number;
48
- }, viewport: {
49
- width: number;
50
- }, bottom: number): number;
51
35
  /** Registers `ref`'s element as a docked composer while `active`. */
52
36
  export declare function useToastClearance(ref: RefObject<HTMLElement | null>, active: boolean): void;
@@ -5,17 +5,14 @@ import { useEffect } from 'react';
5
5
  * window. The app's `<Toaster>` reads its bottom offset from
6
6
  * `--toast-offset-bottom` (`apps/web/src/app/[locale]/layout.tsx`); a docked
7
7
  * composer sets that variable to the distance from its top edge to the window
8
- * bottom while it shares the toast lane. Before this, a toast covered the
8
+ * bottom while it reaches into the toast lane. Before this, a toast covered the
9
9
  * session composer's Send/Stop button (dev audit, 2026-11-14).
10
+ *
11
+ * Toasts always stay in the window's bottom-right corner. They never follow
12
+ * the composer sideways: right-aligning them with the composer pinned them
13
+ * inside the chat column, away from the corner.
10
14
  */
11
15
  export const TOAST_OFFSET_VAR = '--toast-offset-bottom';
12
- /**
13
- * The toast's right offset while it is lifted. A lifted toast aligns its right
14
- * edge with the composer's right edge, so it sits flush above the composer
15
- * instead of straddling whatever is docked to the composer's right (the
16
- * session's side panel).
17
- */
18
- export const TOAST_OFFSET_RIGHT_VAR = '--toast-offset-right';
19
16
  /** Sonner's default edge offset on desktop. */
20
17
  const EDGE_PX = 24;
21
18
  /** Sonner's toast width. */
@@ -29,53 +26,37 @@ const GAP_PX = 12;
29
26
  /** A composer whose bottom edge is this close to the window bottom is docked there. */
30
27
  const DOCKED_BOTTOM_PX = 160;
31
28
  /**
32
- * The bottom offset that puts a toast just above `rect`, or 0 when the element
33
- * is hidden or not docked at the window bottom. A docked composer always
34
- * hosts the toast, wherever it sits horizontally: the toast stands above it,
35
- * right-aligned with it (`toastRightOffset`). Anchoring to the window corner
36
- * instead left the toast straddling whatever is docked beside the composer
37
- * (the session's side panel). A tall composer (long draft, attachments) still
38
- * counts: only its bottom edge says whether it is docked.
29
+ * The bottom offset that puts a corner toast just above `rect`, or 0 when the
30
+ * element is hidden, not docked at the window bottom, or entirely left of the
31
+ * toast lane (the window's right 380px). A tall composer (long draft,
32
+ * attachments) still counts: only its bottom edge says whether it is docked.
39
33
  */
40
34
  export function toastClearance(rect, viewport) {
41
35
  if (rect.width === 0 || rect.height === 0)
42
36
  return 0;
43
37
  if (viewport.height - rect.bottom > DOCKED_BOTTOM_PX)
44
38
  return 0;
45
- return Math.max(0, Math.ceil(viewport.height - rect.top + GAP_PX));
46
- }
47
- /**
48
- * The right offset that aligns a lifted toast with `rect`'s right edge, or 0
49
- * (keep the default) when nothing lifts it or the viewport stacks toasts full
50
- * width. Never closer to the window edge than Sonner's own 24px.
51
- */
52
- export function toastRightOffset(rect, viewport, bottom) {
53
- if (bottom <= 0 || viewport.width <= MOBILE_BREAKPOINT_PX)
39
+ const laneLeft = viewport.width <= MOBILE_BREAKPOINT_PX ? 0 : viewport.width - EDGE_PX - TOAST_WIDTH_PX;
40
+ const laneRight = viewport.width <= MOBILE_BREAKPOINT_PX ? viewport.width : viewport.width - EDGE_PX;
41
+ if (rect.right <= laneLeft || rect.left >= laneRight)
54
42
  return 0;
55
- // Never past the left window edge either: a narrow window with a wide side
56
- // panel leaves less than a toast's width left of the composer's right edge.
57
- const max = viewport.width - TOAST_WIDTH_PX - EDGE_PX;
58
- return Math.max(EDGE_PX, Math.min(max, Math.ceil(viewport.width - rect.right)));
43
+ return Math.max(0, Math.ceil(viewport.height - rect.top + GAP_PX));
59
44
  }
60
45
  // replica-local: one entry per mounted docked composer in this window.
61
46
  const clearances = new Map();
62
47
  function apply() {
63
48
  if (typeof document === 'undefined')
64
49
  return;
65
- // The composer that lifts the toast highest decides both offsets.
66
- let top = { bottom: 0, right: 0 };
50
+ // The composer that lifts the toast highest decides the offset.
51
+ let bottom = 0;
67
52
  for (const c of clearances.values())
68
- if (c.bottom > top.bottom)
69
- top = c;
53
+ if (c > bottom)
54
+ bottom = c;
70
55
  const root = document.documentElement.style;
71
- if (top.bottom > 0)
72
- root.setProperty(TOAST_OFFSET_VAR, `${top.bottom}px`);
56
+ if (bottom > 0)
57
+ root.setProperty(TOAST_OFFSET_VAR, `${bottom}px`);
73
58
  else
74
59
  root.removeProperty(TOAST_OFFSET_VAR);
75
- if (top.right > 0)
76
- root.setProperty(TOAST_OFFSET_RIGHT_VAR, `${top.right}px`);
77
- else
78
- root.removeProperty(TOAST_OFFSET_RIGHT_VAR);
79
60
  }
80
61
  /** Registers `ref`'s element as a docked composer while `active`. */
81
62
  export function useToastClearance(ref, active) {
@@ -86,13 +67,10 @@ export function useToastClearance(ref, active) {
86
67
  const id = Symbol('toast-clearance');
87
68
  const measure = () => {
88
69
  const rect = el.getBoundingClientRect();
89
- const viewport = { width: window.innerWidth, height: window.innerHeight };
90
- const bottom = toastClearance(rect, viewport);
91
- const right = toastRightOffset(rect, viewport, bottom);
92
- const prev = clearances.get(id);
93
- if (prev && prev.bottom === bottom && prev.right === right)
70
+ const bottom = toastClearance(rect, { width: window.innerWidth, height: window.innerHeight });
71
+ if (clearances.get(id) === bottom)
94
72
  return;
95
- clearances.set(id, { bottom, right });
73
+ clearances.set(id, bottom);
96
74
  apply();
97
75
  };
98
76
  measure();
@@ -100,7 +78,7 @@ export function useToastClearance(ref, active) {
100
78
  observer?.observe(el);
101
79
  // The composer is width-capped and centered, so a side panel opening
102
80
  // MOVES it without resizing it. The column it sits in (marked with
103
- // `data-toast-anchor`) does resize, so watch that too, or the right offset
81
+ // `data-toast-anchor`) does resize, so watch that too, or the lane check
104
82
  // keeps the pre-panel position.
105
83
  const anchor = el.closest(`[${TOAST_ANCHOR_ATTR}]`);
106
84
  if (anchor)
@@ -41,8 +41,7 @@ export function UserAvatar({ hint, email, name, avatarUrl, size = 'md', variant
41
41
  // Avatar v2: a solid fill keyed on the email, so a rename keeps the colour.
42
42
  const fill = avatarFill(colorKey || email || name || '');
43
43
  const avatar = (_jsxs(Avatar, { className: cn(sizes.box, 'shrink-0 overflow-hidden rounded-sm p-0 font-medium', ring && 'ring-background ring-2',
44
- // A photo keeps an edge on a light page: a 1px inset hairline over it.
45
- avatarUrl &&
46
- 'after:ring-border after:pointer-events-none after:absolute after:inset-0 after:rounded-sm after:ring-1 after:ring-inset', variant === 'primary' && 'bg-primary text-primary-foreground', className), children: [avatarUrl ? _jsx(AvatarImage, { src: avatarUrl, alt: name || email }) : null, _jsx(AvatarFallback, { className: cn('rounded-sm font-medium', sizes.text), style: { backgroundColor: fill, color: AVATAR_INK }, children: initials || '?' })] }));
44
+ // No ring over a photo: avatar tiles draw no border anywhere.
45
+ variant === 'primary' && 'bg-primary text-primary-foreground', className), children: [avatarUrl ? _jsx(AvatarImage, { src: avatarUrl, alt: name || email }) : null, _jsx(AvatarFallback, { className: cn('rounded-sm font-medium', sizes.text), style: { backgroundColor: fill, color: AVATAR_INK }, children: initials || '?' })] }));
47
46
  return hint ? (_jsx(Hint, { side: "top", sideOffset: 6, alignOffset: 0, label: hint, children: avatar })) : (avatar);
48
47
  }
@@ -1,23 +1,26 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { stopProjectSession } from '@kortix/sdk';
4
4
  import { qk, useNow, useProjectSession, usePromptAttachments } from '@kortix/sdk/react';
5
- import { ArrowUpIcon, ArrowSquareOutIcon, ImageIcon, PlusIcon, SquareIcon, WarningCircleIcon, XIcon } from '@phosphor-icons/react';
5
+ import { ArrowSquareOutIcon, SquareIcon, XIcon } from '@phosphor-icons/react';
6
6
  import { useMutation, useQueryClient } from '@tanstack/react-query';
7
- import { useRef, useState } from 'react';
8
7
  import { useTranslations } from '../../i18n/index.js';
9
8
  import { agentDisplayName } from '../../internal/components/agent-mark.js';
9
+ import { SESSION_BAR_CLASS } from '../../internal/layout/panel-chrome.js';
10
10
  import { uiRoutes } from '../../lib/routes.js';
11
11
  import { cn } from '../../lib/utils.js';
12
12
  import { Button } from '../../primitives/button.js';
13
13
  import { ButtonGroup } from '../../primitives/button-group.js';
14
14
  import { ErrorState } from '../../primitives/error-state.js';
15
15
  import { Hint } from '../../primitives/hint.js';
16
+ import { HoverCard, HoverCardContent, HoverCardTrigger } from '../../primitives/hover-card.js';
16
17
  import { Modal, ModalContent, ModalDescription, ModalTitle } from '../../primitives/modal.js';
17
18
  import { Skeleton } from '../../primitives/skeleton.js';
18
19
  import { errorToast, successToast } from '../../primitives/toast.js';
19
20
  import { UiLink } from '../../providers/ui-provider.js';
20
21
  import { useSessionIds } from '../../providers/session-ids.js';
22
+ import { appendMentionRefs } from '../../internal/lib/project-preamble.js';
23
+ import { SessionChatInput } from '../composer/session-chat-input.js';
21
24
  import { agentRowOf, isActive, shortElapsed } from './agent-model.js';
22
25
  import { AgentFace, AgentFailure } from './agent-surface.js';
23
26
  import { AgentStateMark } from './agent-state-mark.js';
@@ -80,7 +83,7 @@ function SubagentActions({ sub, projectId, sessionId, onLeave, children, }) {
80
83
  return (
81
84
  // One group, secondary buttons: Open page, Stop while it works, Close. On a phone Open page is its icon.
82
85
  // Two groups a gap apart (the primitive spaces nested groups with gap-2): a missed tap on Close never stops the agent.
83
- _jsxs(ButtonGroup, { className: "shrink-0", children: [_jsxs(ButtonGroup, { children: [projectId && sub.kind === 'peek' && (_jsx(Button, { asChild: true, variant: "secondary", size: "xs", children: _jsxs(UiLink, { href: uiRoutes().session(projectId, sessionId), onClick: onLeave, "aria-label": t('openPage'), children: [_jsx(ArrowSquareOutIcon, { className: "size-3.5 shrink-0" }), _jsx("span", { className: "max-sm:sr-only", children: t('openPage') })] }) })), sub.agent && isActive(sub.agent.state) && (_jsx(Hint, { label: tStrip('stopHint'), side: "bottom", children: _jsx(Button, { type: "button", variant: "secondary", size: "icon", "aria-label": tStrip('stopAgent', { name: sub.name }), disabled: sub.stop.isPending, "aria-busy": sub.stop.isPending, onClick: () => sub.stop.mutate(), children: _jsx(SquareIcon, { weight: "fill", className: "size-2.5" }) }) }))] }), _jsx(ButtonGroup, { children: children })] }));
86
+ _jsxs(ButtonGroup, { className: "shrink-0", children: [_jsxs(ButtonGroup, { children: [projectId && sub.kind === 'peek' && (_jsx(Hint, { label: t('openPage'), side: "bottom", children: _jsx(Button, { asChild: true, variant: "secondary", size: "icon", children: _jsx(UiLink, { href: uiRoutes().session(projectId, sessionId), onClick: onLeave, "aria-label": t('openPage'), children: _jsx(ArrowSquareOutIcon, { className: "size-3.5 shrink-0" }) }) }) })), sub.agent && isActive(sub.agent.state) && (_jsx(Hint, { label: tStrip('stopHint'), side: "bottom", children: _jsx(Button, { type: "button", variant: "secondary", size: "icon", "aria-label": tStrip('stopAgent', { name: sub.name }), disabled: sub.stop.isPending, "aria-busy": sub.stop.isPending, onClick: () => sub.stop.mutate(), children: _jsx(SquareIcon, { weight: "fill", className: "size-2.5" }) }) }))] }), _jsx(ButtonGroup, { children: children })] }));
84
87
  }
85
88
  function CloseAction({ onClose }) {
86
89
  const t = useTranslations('multiAgent.subagent');
@@ -146,7 +149,7 @@ export function SubagentPanel({ sessionId, title, handle, projectId: projectIdPr
146
149
  // The chat row's state words ("Done", "Working"), so the row and its panel read the same.
147
150
  const stateText = sub.agent ? tAgent(`state.${sub.agent.state}`) : null;
148
151
  const elapsed = sub.agent?.state === 'working' && sub.agent.workingSinceMs !== null ? shortElapsed(now - sub.agent.workingSinceMs) : null;
149
- return (_jsxs("section", { "data-testid": "subagent-panel", "data-body": sub.kind, "aria-label": name, className: "flex h-full min-h-0 min-w-0 flex-col", children: [_jsxs("header", { className: "flex shrink-0 items-center gap-2 px-3 py-2.5", children: [leading, _jsx(AgentFace, { handle: face }), _jsx("h2", { className: "text-foreground max-w-40 min-w-0 shrink-0 truncate text-sm font-semibold", title: name, children: name }), task && (_jsx("span", { className: "text-muted-foreground min-w-0 truncate text-sm", title: task, children: task })), sub.agent && (_jsxs("span", { "data-agent-state": sub.agent.state, className: "text-muted-foreground flex shrink-0 items-center gap-1.5 pl-1 text-xs tabular-nums", children: [_jsx(AgentStateMark, { state: sub.agent.state }), _jsx("span", { "aria-hidden": true, className: "max-sm:hidden", children: stateText }), elapsed && _jsx("span", { className: "max-sm:hidden", children: elapsed })] })), _jsx("span", { className: "min-w-0 flex-1" }), _jsx(SubagentActions, { sub: sub, projectId: projectId, sessionId: sessionId, onLeave: onClose, children: _jsx(CloseAction, { onClose: onClose }) })] }), failure && (_jsx("div", { "data-testid": "subagent-panel-failure", className: "shrink-0 px-3 pb-2.5 text-sm", children: _jsx(AgentFailure, { sentence: tNotice('failedSentence'), raw: failure }) })), _jsx("div", { className: "flex min-h-0 flex-1 flex-col", children: _jsx(SubagentBody, { sub: sub, projectId: projectId, sessionId: sessionId, density: "compact" }) }), sub.kind === 'peek' && projectId && (_jsx(SubagentMessageBox, { projectId: projectId, sessionId: sessionId, name: name, onSent: sub.refreshRow, className: "px-3 pb-3", autoFocus: false }, sessionId))] }));
152
+ return (_jsxs("section", { "data-testid": "subagent-panel", "data-body": sub.kind, "aria-label": name, className: "flex h-full min-h-0 min-w-0 flex-col", children: [_jsxs("header", { className: cn(SESSION_BAR_CLASS, 'gap-2 px-3'), children: [leading, _jsxs(HoverCard, { openDelay: 300, closeDelay: 100, children: [_jsx(HoverCardTrigger, { asChild: true, children: _jsxs("div", { tabIndex: 0, className: "hover:bg-secondary focus-visible:ring-ring duration-fast -ml-1.5 flex h-8 min-w-0 cursor-default items-center gap-2 rounded-md px-1.5 transition-colors outline-none focus-visible:ring-2", children: [_jsx(AgentFace, { handle: face }), _jsx("h2", { "data-agent-state": sub.agent?.state, className: "text-foreground min-w-0 truncate text-sm font-semibold", children: name })] }) }), _jsxs(HoverCardContent, { side: "bottom", align: "start", sideOffset: 6, animated: false, className: "w-64 p-3", children: [_jsx("p", { className: "text-foreground truncate text-sm font-medium", children: name }), sub.agent ? (_jsxs("p", { className: "text-muted-foreground mt-1 flex items-center gap-1.5 text-xs tabular-nums", children: [_jsx(AgentStateMark, { state: sub.agent.state }), _jsx("span", { children: [stateText, elapsed].filter(Boolean).join(' · ') })] })) : null, task ? _jsx("p", { className: "text-muted-foreground border-border mt-2.5 line-clamp-3 border-t pt-2.5 text-xs text-pretty", children: task }) : null] })] }), _jsx("span", { className: "min-w-0 flex-1" }), _jsx(SubagentActions, { sub: sub, projectId: projectId, sessionId: sessionId, onLeave: onClose, children: _jsx(CloseAction, { onClose: onClose }) })] }), failure && (_jsx("div", { "data-testid": "subagent-panel-failure", className: "shrink-0 px-3 pb-2.5 text-sm", children: _jsx(AgentFailure, { sentence: tNotice('failedSentence'), raw: failure }) })), _jsx("div", { className: "flex min-h-0 flex-1 flex-col", children: _jsx(SubagentBody, { sub: sub, projectId: projectId, sessionId: sessionId, density: "compact" }) }), sub.kind === 'peek' && projectId && (_jsx(SubagentMessageBox, { projectId: projectId, sessionId: sessionId, name: name, onSent: sub.refreshRow, className: "px-3 pb-3", autoFocus: false }, sessionId))] }));
150
153
  }
151
154
  function SessionPeekRowError({ onRetry }) {
152
155
  const t = useTranslations('multiAgent.subagent');
@@ -159,70 +162,25 @@ function SessionPeekRowError({ onRetry }) {
159
162
  */
160
163
  function SubagentMessageBox({ projectId, sessionId, name, onSent, className, autoFocus = true, }) {
161
164
  const t = useTranslations('multiAgent.subagent');
162
- const [text, setText] = useState('');
163
- const fileInput = useRef(null);
164
165
  const uploads = usePromptAttachments(projectId);
165
- const [waiting, setWaiting] = useState(false);
166
- const send = useSteerSession(projectId, {
167
- onSent: () => {
168
- setText('');
169
- successToast(t('sent'));
170
- onSent();
171
- },
172
- onError: (error) => errorToast(t('sendFailed'), { description: error instanceof Error ? error.message : undefined }),
173
- });
174
- const busy = send.isPending || waiting;
175
- const images = uploads.attachments;
176
- const submit = async () => {
177
- const message = text.trim();
178
- if ((!message && images.length === 0) || busy)
179
- return;
180
- const ids = images.map((image) => image.id);
181
- let files = [];
182
- if (ids.length > 0) {
183
- // The send owns its uploads from here: closing the dialog while they finish does not cancel them.
184
- uploads.submit(ids);
185
- setWaiting(true);
186
- try {
187
- files = await uploads.whenReady(ids);
188
- }
189
- catch (error) {
190
- uploads.reclaim(ids);
191
- errorToast(t('sendFailed'), { description: error instanceof Error ? error.message : undefined });
192
- return;
193
- }
194
- finally {
195
- setWaiting(false);
196
- }
197
- }
198
- // Delivered, the uploads are released; refused, they go back to the box for a retry.
199
- // Settled in this function, not in per-call callbacks (those skip once the dialog unmounts).
200
- try {
201
- await send.mutateAsync({ sessionId, text: message, files });
202
- uploads.forget(ids);
203
- }
204
- catch {
205
- uploads.reclaim(ids);
206
- }
207
- };
208
- const canSend = (!!text.trim() || images.length > 0) && !busy;
209
- return (_jsx("form", { className: cn('shrink-0 px-4 pt-2 pb-4', className), onSubmit: (event) => {
210
- event.preventDefault();
211
- void submit();
212
- }, children: _jsxs("div", { className: "border-border bg-muted focus-within:border-ring focus-within:ring-ring/15 flex min-w-0 flex-col rounded-xl border transition-[border-color,box-shadow] focus-within:ring-3", children: [images.length > 0 && (_jsx("ul", { "aria-label": t('attachments'), className: "flex min-w-0 flex-wrap gap-1.5 px-3 pt-2.5", children: images.map((image) => (_jsxs("li", { className: "bg-background text-muted-foreground flex h-7 max-w-64 min-w-0 items-center gap-1.5 rounded-md pr-1 pl-2 text-xs", children: [image.status === 'error' ? (_jsx(WarningCircleIcon, { weight: "fill", "aria-hidden": true, className: "text-kortix-red size-3.5 shrink-0" })) : (_jsx(ImageIcon, { className: "size-3.5 shrink-0" })), _jsx("span", { className: "min-w-0 truncate", title: image.error?.message, children: image.filename }), image.status === 'error' && (_jsxs(_Fragment, { children: [_jsx("span", { className: "sr-only", children: t('attachFailed') }), _jsx("button", { type: "button", onClick: () => uploads.retry(image.id), className: "text-foreground hover:bg-muted shrink-0 cursor-pointer rounded-sm px-1 outline-none focus-visible:ring-kortix-base focus-visible:ring-[0.6px]", children: t('retry') })] })), _jsx("button", { type: "button", "aria-label": t('removeAttachment', { name: image.filename }), onClick: () => void uploads.remove(image.id), className: "hover:text-foreground flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm outline-none focus-visible:ring-kortix-base focus-visible:ring-[0.6px]", children: _jsx(XIcon, { className: "size-3" }) })] }, image.id))) })), _jsxs("div", { className: "flex min-w-0 items-center gap-1 p-1.5", children: [_jsx(Hint, { label: t('attachImages'), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-base", "aria-label": t('attachImages'), disabled: busy, onClick: () => fileInput.current?.click(), className: "text-muted-foreground hover:text-foreground shrink-0", children: _jsx(PlusIcon, { className: "size-4" }) }) }), _jsx("input", { ref: fileInput, type: "file", accept: "image/*", multiple: true, hidden: true, onChange: (event) => {
213
- const files = Array.from(event.target.files ?? []);
214
- event.target.value = '';
215
- if (files.length === 0)
216
- return;
217
- try {
218
- uploads.addMany(files);
219
- }
220
- catch (error) {
221
- errorToast(t('attachFailed'), { description: error instanceof Error ? error.message : undefined });
222
- }
223
- } }), _jsx("input", { "data-testid": "subagent-dialog-message",
224
- // The box mounts once the agent's row loads: with a mouse it takes the focus then (onOpenAutoFocus covers a cached row).
225
- autoFocus: autoFocus && finePointer(), value: text, onChange: (event) => setText(event.target.value), placeholder: t('messagePlaceholder', { name }), "aria-label": t('messageLabel', { name }),
226
- // Read-only, not disabled, while a send runs: the field keeps the focus for the next message.
227
- readOnly: busy, "aria-disabled": busy, className: "text-foreground placeholder:text-muted-foreground h-8 min-w-0 flex-1 bg-transparent px-1.5 text-sm outline-none" }), _jsx(Hint, { label: t('send'), side: "top", children: _jsx(Button, { type: "submit", size: "icon-base", "aria-label": t('send'), disabled: !canSend, "aria-busy": busy, className: "shrink-0 transition-[color,background-color,opacity,scale] duration-(--duration-slow) ease-out active:scale-[0.96] active:duration-(--duration-normal)", children: _jsx(ArrowUpIcon, { className: "size-4" }) }) })] })] }) }));
166
+ const send = useSteerSession(projectId);
167
+ // The main composer in its one-row `inline` mode: the same @ menu, paste and
168
+ // attachments, growing into the card when the text wraps. A message steers
169
+ // the sub-agent through the API's prompt route.
170
+ return (_jsx("div", { "data-testid": "subagent-dialog-message", className: cn('shrink-0 px-4 pb-4', className), children: _jsx(SessionChatInput, { inline: true, hideAgentPicker: true, projectId: projectId, sessionId: sessionId, promptAttachments: uploads, placeholder: t('messagePlaceholder', { name }),
171
+ // Static: the composer's rotating tips (⌘K, / commands) are for the main chat.
172
+ hint: t('messagePlaceholder', { name }), autoFocus: autoFocus && finePointer(), isSending: send.isPending, clearOnSend: true, cardClassName: "rounded-lg", underbarPlacement: "inline", slashMenuPlacement: "above", onSend: async (text, _files, mentions, attachments) => {
173
+ const message = appendMentionRefs(text.trim(), mentions);
174
+ try {
175
+ const files = attachments ? await attachments.whenReady() : [];
176
+ await send.mutateAsync({ sessionId, text: message, files });
177
+ attachments?.release();
178
+ successToast(t('sent'));
179
+ onSent();
180
+ }
181
+ catch (error) {
182
+ errorToast(t('sendFailed'), { description: error instanceof Error ? error.message : undefined });
183
+ throw error;
184
+ }
185
+ } }) }));
228
186
  }
@@ -3,6 +3,7 @@ import type { Agent, UsePromptAttachmentsResult, useRuntimeSessions } from '@kor
3
3
  import type { PastedContent } from '../../_vendor/shared/index.js';
4
4
  import type { JSONContent } from '@tiptap/core';
5
5
  import type { ChangeEventHandler, Dispatch, DragEventHandler, RefObject, SetStateAction } from 'react';
6
+ import type { DriveMentionSource } from './menus/mention-menu.js';
6
7
  import { type SessionChatInputProps } from './composer.js';
7
8
  import type { ComposerEditorHandle } from './editor/composer-editor.js';
8
9
  import type { SlashAction } from './menus/slash-actions.js';
@@ -28,6 +29,8 @@ export interface ComposerCardDerived {
28
29
  attachedFiles: AttachedFile[];
29
30
  promptAttachmentItems: UsePromptAttachmentsResult['attachments'];
30
31
  removeAttachedFile: (index: number) => void;
32
+ /** The project's Drive files in the `@` menu; null where Drive is off. */
33
+ driveMentions: DriveMentionSource | null;
31
34
  retryAttachedFile: (id: string) => void;
32
35
  pastes: PastedContent[];
33
36
  removePaste: (id: string) => void;
@@ -77,4 +80,4 @@ export interface ComposerCardDerived {
77
80
  noModelsConnected: boolean;
78
81
  }
79
82
  export type ComposerCardProps = SessionChatInputProps & ComposerCardDerived;
80
- export declare function ComposerCard({ tHardcodedUi, isDragOver, handleDragEnter, handleDragOver, handleDragLeave, handleDropFiles, attachedFiles, promptAttachmentItems, removeAttachedFile, retryAttachedFile, pastes, removePaste, onOpenPastedContent, commandAttachmentPlan, editorDisabled, editorRef, setEditorRef, editorPlaceholder, animatePlaceholder, handleSubmit, handleArrowUpAtStart, handleArrowDownAtEnd, historyPosition, setIsEmpty, handleDocChange, allSessions, slashActions, handleSelectAction, dockId, setMenuOpen, fileInputRef, handleFileSelect, sessionId, handleAttachClick, primaryAgents, availableSelectedModel, agentMenuOpen, setAgentMenuOpen, modelMenuOpen, setModelMenuOpen, reasoningMenuOpen, setReasoningMenuOpen, isEmpty, canSubmit, submitDisabled, attachmentFailed, modelRejectingImages, imagesUnsupportedReason, modelUnavailable, agentUnavailable, noModelsConnected, agents, commands, slashFiles, models, notice, disabled, lockForQuestion, lockForApproval, questionButtonLabel, questionActive, submitLabel, questionCanAct, escCount, isBusy, isSending, onStop, stopDisabled, canStop, modelsLoading, modelRequired, onModelChange, modelDefaultControls, inheritedModel, providers, variants, selectedVariant, onVariantChange, projectId, toolbarSlot, underbarSlot, rewind, selectedAgent, onAgentChange, noAccessibleAgents, agentLocked, onContextClick, messages, underbarPlacement, agentPickerCompact, slashMenuPlacement, cardClassName, call, }: ComposerCardProps): import("react").JSX.Element;
83
+ export declare function ComposerCard({ tHardcodedUi, isDragOver, handleDragEnter, handleDragOver, handleDragLeave, handleDropFiles, attachedFiles, promptAttachmentItems, removeAttachedFile, driveMentions, retryAttachedFile, pastes, removePaste, onOpenPastedContent, commandAttachmentPlan, editorDisabled, editorRef, setEditorRef, editorPlaceholder, animatePlaceholder, handleSubmit, handleArrowUpAtStart, handleArrowDownAtEnd, historyPosition, setIsEmpty, handleDocChange, allSessions, slashActions, handleSelectAction, dockId, setMenuOpen, fileInputRef, handleFileSelect, sessionId, handleAttachClick, primaryAgents, availableSelectedModel, agentMenuOpen, setAgentMenuOpen, modelMenuOpen, setModelMenuOpen, reasoningMenuOpen, setReasoningMenuOpen, isEmpty, canSubmit, submitDisabled, attachmentFailed, modelRejectingImages, imagesUnsupportedReason, modelUnavailable, agentUnavailable, noModelsConnected, agents, commands, slashFiles, models, notice, disabled, lockForQuestion, lockForApproval, questionButtonLabel, questionActive, submitLabel, questionCanAct, escCount, isBusy, isSending, onStop, stopDisabled, canStop, modelsLoading, modelRequired, onModelChange, modelDefaultControls, inheritedModel, providers, variants, selectedVariant, onVariantChange, projectId, toolbarSlot, underbarSlot, rewind, selectedAgent, onAgentChange, noAccessibleAgents, agentLocked, onContextClick, messages, underbarPlacement, agentPickerCompact, slashMenuPlacement, cardClassName, call, inline, hideAgentPicker, }: ComposerCardProps): import("react").JSX.Element;
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { cn } from '../../lib/utils.js';
4
4
  import { WarningIcon } from '@phosphor-icons/react';
5
- import { lazy, Suspense, useContext, useMemo, useRef } from 'react';
5
+ import { lazy, Suspense, useContext, useEffect, useMemo, useRef, useState } from 'react';
6
6
  import { useToastClearance } from '../../primitives/toast-clearance.js';
7
7
  import { SpaceMentionContext } from './menus/space-mentions.js';
8
8
  import { useFeatureFlag } from '@kortix/sdk/react';
@@ -23,17 +23,45 @@ const ComposerEditorLazy = lazy(() => import('./editor/composer-editor.js').then
23
23
  function ComposerEditorFallback() {
24
24
  return _jsx("div", { className: "min-h-[1.5em]", "aria-hidden": true });
25
25
  }
26
- export function ComposerCard({ tHardcodedUi, isDragOver, handleDragEnter, handleDragOver, handleDragLeave, handleDropFiles, attachedFiles, promptAttachmentItems, removeAttachedFile, retryAttachedFile, pastes, removePaste, onOpenPastedContent, commandAttachmentPlan, editorDisabled, editorRef, setEditorRef, editorPlaceholder, animatePlaceholder, handleSubmit, handleArrowUpAtStart, handleArrowDownAtEnd, historyPosition, setIsEmpty, handleDocChange, allSessions, slashActions, handleSelectAction, dockId, setMenuOpen, fileInputRef, handleFileSelect, sessionId, handleAttachClick, primaryAgents, availableSelectedModel, agentMenuOpen, setAgentMenuOpen, modelMenuOpen, setModelMenuOpen, reasoningMenuOpen, setReasoningMenuOpen, isEmpty, canSubmit, submitDisabled, attachmentFailed, modelRejectingImages, imagesUnsupportedReason, modelUnavailable, agentUnavailable, noModelsConnected,
26
+ export function ComposerCard({ tHardcodedUi, isDragOver, handleDragEnter, handleDragOver, handleDragLeave, handleDropFiles, attachedFiles, promptAttachmentItems, removeAttachedFile, driveMentions, retryAttachedFile, pastes, removePaste, onOpenPastedContent, commandAttachmentPlan, editorDisabled, editorRef, setEditorRef, editorPlaceholder, animatePlaceholder, handleSubmit, handleArrowUpAtStart, handleArrowDownAtEnd, historyPosition, setIsEmpty, handleDocChange, allSessions, slashActions, handleSelectAction, dockId, setMenuOpen, fileInputRef, handleFileSelect, sessionId, handleAttachClick, primaryAgents, availableSelectedModel, agentMenuOpen, setAgentMenuOpen, modelMenuOpen, setModelMenuOpen, reasoningMenuOpen, setReasoningMenuOpen, isEmpty, canSubmit, submitDisabled, attachmentFailed, modelRejectingImages, imagesUnsupportedReason, modelUnavailable, agentUnavailable, noModelsConnected,
27
27
  // Raw props the moved JSX reads; `{...props}` carries the rest. These
28
28
  // defaults mirror `ComposerImpl`'s, because the spread passes the raw
29
29
  // values, not the component's defaulted locals.
30
- agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES, models = EMPTY_MODELS, notice = null, disabled = false, lockForQuestion = false, lockForApproval = false, questionButtonLabel = null, questionActive = false, submitLabel = null, questionCanAct = true, escCount = 0, isBusy = false, isSending = false, onStop, stopDisabled = false, canStop = true, modelsLoading = false, modelRequired = false, onModelChange, modelDefaultControls, inheritedModel, providers, variants = EMPTY_VARIANTS, selectedVariant = null, onVariantChange, projectId, toolbarSlot, underbarSlot, rewind, selectedAgent = null, onAgentChange, noAccessibleAgents = false, agentLocked = false, onContextClick, messages, underbarPlacement = 'below', agentPickerCompact = false, slashMenuPlacement = 'above', cardClassName, call, }) {
30
+ agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES, models = EMPTY_MODELS, notice = null, disabled = false, lockForQuestion = false, lockForApproval = false, questionButtonLabel = null, questionActive = false, submitLabel = null, questionCanAct = true, escCount = 0, isBusy = false, isSending = false, onStop, stopDisabled = false, canStop = true, modelsLoading = false, modelRequired = false, onModelChange, modelDefaultControls, inheritedModel, providers, variants = EMPTY_VARIANTS, selectedVariant = null, onVariantChange, projectId, toolbarSlot, underbarSlot, rewind, selectedAgent = null, onAgentChange, noAccessibleAgents = false, agentLocked = false, onContextClick, messages, underbarPlacement = 'below', agentPickerCompact = false, slashMenuPlacement = 'above', cardClassName, call, inline = false, hideAgentPicker = false, }) {
31
31
  const connectionsAbove = useContext(ModelConnectionLayoutContext) === 'above';
32
32
  const cardRef = useRef(null);
33
33
  // A composer docked at the window bottom keeps toasts above its Send/Stop button.
34
34
  useToastClearance(cardRef, slashMenuPlacement === 'above');
35
35
  const { attachAccept, modelPickerEnabled } = useUiHostConfig();
36
36
  const inlineUnderbar = underbarPlacement === 'inline';
37
+ // `inline`: one row while the text fits a line. Once it wraps, or anything is
38
+ // attached, the card opens to its two rows and stays open until the box is
39
+ // empty again: closing on width alone would flicker, since the one-row editor
40
+ // is narrower than the card's and wraps sooner.
41
+ const editorBoxRef = useRef(null);
42
+ const [wrapped, setWrapped] = useState(false);
43
+ useEffect(() => {
44
+ if (!inline)
45
+ return;
46
+ if (isEmpty) {
47
+ setWrapped(false);
48
+ return;
49
+ }
50
+ const box = editorBoxRef.current;
51
+ const editable = box?.querySelector('[contenteditable]');
52
+ if (!editable)
53
+ return;
54
+ const measure = () => {
55
+ const lineHeight = Number.parseFloat(getComputedStyle(editable).lineHeight) || 20;
56
+ if (editable.scrollHeight > lineHeight * 1.5)
57
+ setWrapped(true);
58
+ };
59
+ measure();
60
+ const observer = new ResizeObserver(measure);
61
+ observer.observe(editable);
62
+ return () => observer.disconnect();
63
+ }, [inline, isEmpty]);
64
+ const collapsed = inline && !wrapped && attachedFiles.length === 0 && pastes.length === 0 && commandAttachmentPlan.kind !== 'refuse';
37
65
  /*
38
66
  `chat_input` on: one control under the card for the agent, model, effort
39
67
  and every session override (`chat-input/chat-input-control.tsx`). The
@@ -103,7 +131,10 @@ agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES
103
131
  // `globals.css` and `shadow-xl` was dead — twMerge dropped it for the
104
132
  // arbitrary `shadow-[…oklch…]` that followed, which was the only
105
133
  // raw colour left in the composer.
106
- 'bg-background border-border relative isolate z-10 w-full rounded-xl border', 'pt-3',
134
+ 'bg-background border-border relative isolate z-10 w-full rounded-xl border',
135
+ // `inline` draws its own even inset (below); the full composer keeps its top band,
136
+ // and so does `inline` while tiles sit above the text.
137
+ collapsed || (inline && attachedFiles.length === 0 && pastes.length === 0) ? 'pt-0' : 'pt-3',
107
138
  // The drag border swaps colour AND gains a ring. Without this it
108
139
  // snapped: a hard flash the moment a file crossed the card.
109
140
  'duration-normal ease-default transition-[border-color]', 'motion-reduce:transition-none', cardClassName, isDragOver && 'border-ring ring-ring/15 border ring',
@@ -113,7 +144,20 @@ agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES
113
144
  'rounded-t-none', '[[data-composer-stack]:has(>[data-composer-strip]:not(:empty))+&]:rounded-t-none',
114
145
  // The bottom half of the ring the docked question starts (see
115
146
  // `ComposerAboveCard`); the clip drops it along the seam.
116
- questionActive && 'ring-muted/15 ring-3 [clip-path:inset(0_-8px_-8px_-8px)]'), children: [isDragOver && (_jsx("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-0 z-[2] flex items-center justify-center", children: _jsx("span", { className: "text-foreground bg-sidebar/80 rounded-md px-3 py-1.5 text-sm font-medium", children: tHardcodedUi.raw('i18nComplete.text1ab1b095c1ed') }) })), _jsxs("div", { className: cn('relative z-[1] flex w-full flex-col overflow-visible', 'transition-opacity duration-(--duration-normal) ease-[cubic-bezier(0.23,1,0.32,1)]', 'motion-reduce:transition-none', isDragOver && 'opacity-30'), children: [historyPosition && (_jsx("div", { "aria-live": "polite", className: "text-muted-foreground px-4 pb-1 text-xs tabular-nums select-none", children: tHardcodedUi('promptHistory', historyPosition) })), _jsx(AttachmentTiles, { files: attachedFiles, uploads: promptAttachmentItems, onRemove: removeAttachedFile, onRetry: retryAttachedFile, pastes: pastes, onRemovePaste: removePaste, onOpenPaste: onOpenPastedContent ? (paste) => onOpenPastedContent(paste.id, paste.text) : undefined }), commandAttachmentPlan.kind === 'refuse' && (_jsxs("div", { role: "alert", className: "text-muted-foreground flex items-start gap-2 px-4 pt-3 text-xs", children: [_jsx(WarningIcon, { className: "mt-px size-3.5 shrink-0" }), _jsxs("span", { className: "min-w-0 flex-1 text-balance", children: [_jsxs("span", { className: "text-foreground font-medium", children: [commandAttachmentPlan.message, "."] }), ' ', commandAttachmentPlan.description] })] })), _jsxs("div", { className: cn('flex min-w-0 flex-col px-2 pb-2', lockForApproval && 'composer-locked-approval', (attachedFiles.length > 0 || pastes.length > 0) && 'pt-3'), children: [_jsxs("div", { className: "relative min-w-0 cursor-text px-1 pb-9", onMouseDown: (e) => {
147
+ questionActive && 'ring-muted/15 ring-3 [clip-path:inset(0_-8px_-8px_-8px)]'), children: [isDragOver && (_jsx("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-0 z-[2] flex items-center justify-center", children: _jsx("span", { className: "text-foreground bg-sidebar/80 rounded-md px-3 py-1.5 text-sm font-medium", children: tHardcodedUi.raw('i18nComplete.text1ab1b095c1ed') }) })), _jsxs("div", { className: cn('relative z-[1] flex w-full flex-col overflow-visible', 'transition-opacity duration-(--duration-normal) ease-[cubic-bezier(0.23,1,0.32,1)]', 'motion-reduce:transition-none', isDragOver && 'opacity-30'), children: [historyPosition && (_jsx("div", { "aria-live": "polite", className: "text-muted-foreground px-4 pb-1 text-xs tabular-nums select-none", children: tHardcodedUi('promptHistory', historyPosition) })), _jsx(AttachmentTiles, { files: attachedFiles, uploads: promptAttachmentItems, onRemove: removeAttachedFile, onRetry: retryAttachedFile, pastes: pastes, onRemovePaste: removePaste, onOpenPaste: onOpenPastedContent ? (paste) => onOpenPastedContent(paste.id, paste.text) : undefined }), commandAttachmentPlan.kind === 'refuse' && (_jsxs("div", { role: "alert", className: "text-muted-foreground flex items-start gap-2 px-4 pt-3 text-xs", children: [_jsx(WarningIcon, { className: "mt-px size-3.5 shrink-0" }), _jsxs("span", { className: "min-w-0 flex-1 text-balance", children: [_jsxs("span", { className: "text-foreground font-medium", children: [commandAttachmentPlan.message, "."] }), ' ', commandAttachmentPlan.description] })] })), _jsxs("div", { className: cn(
148
+ // Collapsed: attach | text | send in one row. The toolbar's two halves
149
+ // take the outer columns (`ComposerToolbar collapsed`); the editor the middle.
150
+ collapsed
151
+ ? 'grid min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-0 p-1.5'
152
+ : inline
153
+ ? // Open: the same inset as one row on every side, and a shorter scroll (70% of the full composer's).
154
+ 'flex min-w-0 flex-col p-1.5 [&_[contenteditable]]:max-h-[31vh] sm:[&_[contenteditable]]:max-h-[28vh]'
155
+ : 'flex min-w-0 flex-col px-2 pb-2', lockForApproval && 'composer-locked-approval', (attachedFiles.length > 0 || pastes.length > 0) && 'pt-3'), children: [_jsxs("div", { ref: editorBoxRef, className: cn('relative min-w-0 cursor-text',
156
+ // Inline, the text starts where the paperclip's glyph starts: one left edge in both states.
157
+ collapsed
158
+ ? // One line, centred on the buttons: no empty min-height under it, and the paperclip's own inset as the gap.
159
+ // Up 1px: the line box centres the descenders too, so the letters sat ~1.5px under the icons' centre.
160
+ 'col-start-2 row-start-1 -translate-y-px py-1 pr-1 pl-0 [&_[contenteditable]]:min-h-0' : inline ? 'px-1.5 pt-2 pb-3' : 'px-1 pb-9'), onMouseDown: (e) => {
117
161
  if (!shouldFocusEditorFromPadding({
118
162
  onWrapperItself: e.target === e.currentTarget,
119
163
  disabled: editorDisabled,
@@ -124,7 +168,7 @@ agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES
124
168
  // the div and immediately fights the caret we are placing.
125
169
  e.preventDefault();
126
170
  editorRef.current?.focus();
127
- }, children: [_jsx(AnimatedComposerPlaceholder, { placeholder: editorPlaceholder, active: animatePlaceholder }), _jsx(Suspense, { fallback: _jsx(ComposerEditorFallback, {}), children: _jsx(ComposerEditorLazy, { ref: setEditorRef, placeholder: animatePlaceholder ? '' : editorPlaceholder, disabled: editorDisabled, onSubmit: handleSubmit, onArrowUpAtStart: handleArrowUpAtStart, onArrowDownAtEnd: handleArrowDownAtEnd, onEmptyChange: setIsEmpty, onDocChange: handleDocChange, agents: agents, sessions: allSessions ?? [], currentSessionId: sessionId, spaceMentions: spaceMentions, commands: commands, actions: slashActions, files: slashFiles, onSelectAction: handleSelectAction, slashDockSelector: `#${dockId}`, onMenuOpenChange: setMenuOpen }) })] }), _jsx("input", { ref: fileInputRef, type: "file", accept: attachAccept ?? DEFAULT_ATTACH_ACCEPT, multiple: true, className: "hidden", onChange: handleFileSelect }), _jsx(ComposerToolbar, { noModel: programAgent, leading: inlineUnderbar ? (_jsx(ComposerUnderbar, { variant: "inline", agentPickerCompact: agentPickerCompact, onAttachClick: handleAttachClick, agents: primaryAgents, selectedAgent: selectedAgent, onAgentChange: onAgentChange, agentMenuOpen: agentMenuOpen, onAgentMenuOpenChange: setAgentMenuOpen, noAccessibleAgents: noAccessibleAgents, agentLocked: agentLocked, messages: messages, models: models, selectedModel: availableSelectedModel, onContextClick: onContextClick, agentsSlot: underbarSlot, chatInput: chatInput })) : null, pickersInChatInput: chatInputEnabled, modelsLoading: modelsLoading, models: models, selectedModel: availableSelectedModel, onModelChange: onModelChange, modelDefaultControls: modelDefaultControls, providers: providers, modelRequired: modelRequired, modelMenuOpen: modelMenuOpen, onModelMenuOpenChange: setModelMenuOpen, reasoningMenuOpen: reasoningMenuOpen, onReasoningMenuOpenChange: setReasoningMenuOpen, variants: variants, selectedVariant: selectedVariant, onVariantChange: onVariantChange, projectId: projectId,
171
+ }, children: [_jsx(AnimatedComposerPlaceholder, { placeholder: editorPlaceholder, active: animatePlaceholder }), _jsx(Suspense, { fallback: _jsx(ComposerEditorFallback, {}), children: _jsx(ComposerEditorLazy, { ref: setEditorRef, placeholder: animatePlaceholder ? '' : editorPlaceholder, disabled: editorDisabled, onSubmit: handleSubmit, onArrowUpAtStart: handleArrowUpAtStart, onArrowDownAtEnd: handleArrowDownAtEnd, onEmptyChange: setIsEmpty, onDocChange: handleDocChange, agents: agents, sessions: allSessions ?? [], currentSessionId: sessionId, spaceMentions: spaceMentions, driveMentions: driveMentions, commands: commands, actions: slashActions, files: slashFiles, onSelectAction: handleSelectAction, slashDockSelector: `#${dockId}`, onMenuOpenChange: setMenuOpen }) })] }), _jsx("input", { ref: fileInputRef, type: "file", accept: attachAccept ?? DEFAULT_ATTACH_ACCEPT, multiple: true, className: "hidden", onChange: handleFileSelect }), _jsx(ComposerToolbar, { collapsed: collapsed, noModel: programAgent, leading: inlineUnderbar ? (_jsx(ComposerUnderbar, { hideAgentPicker: hideAgentPicker, variant: "inline", agentPickerCompact: agentPickerCompact, onAttachClick: handleAttachClick, agents: primaryAgents, selectedAgent: selectedAgent, onAgentChange: onAgentChange, agentMenuOpen: agentMenuOpen, onAgentMenuOpenChange: setAgentMenuOpen, noAccessibleAgents: noAccessibleAgents, agentLocked: agentLocked, messages: messages, models: models, selectedModel: availableSelectedModel, onContextClick: onContextClick, agentsSlot: underbarSlot, chatInput: chatInput })) : null, pickersInChatInput: chatInputEnabled, modelsLoading: modelsLoading, models: models, selectedModel: availableSelectedModel, onModelChange: onModelChange, modelDefaultControls: modelDefaultControls, providers: providers, modelRequired: modelRequired, modelMenuOpen: modelMenuOpen, onModelMenuOpenChange: setModelMenuOpen, reasoningMenuOpen: reasoningMenuOpen, onReasoningMenuOpenChange: setReasoningMenuOpen, variants: variants, selectedVariant: selectedVariant, onVariantChange: onVariantChange, projectId: projectId,
128
172
  // Inline placement has no under-row, so the slot (the session
129
173
  // overrides gear, meta indicator) rides the toolbar itself. With
130
174
  // the 'below' placement the ComposerUnderbar further down renders
@@ -132,5 +176,5 @@ agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES
132
176
  toolbarSlot: inlineUnderbar ? toolbarSlot : undefined, rewind: rewind, isSending: isSending, isBusy: isBusy, onStop: onStop, stopDisabled: stopDisabled, canStop: canStop, escCount: escCount, lockForQuestion: lockForQuestion, questionButtonLabel: questionButtonLabel, submitLabel: submitLabel, questionCanAct: questionCanAct, hasText: !isEmpty, canSubmit: canSubmit, submitDisabled: submitDisabled ||
133
177
  attachmentFailed ||
134
178
  modelRejectingImages !== null ||
135
- commandAttachmentPlan.kind === 'refuse', attachmentFailed: attachmentFailed, attachmentUnsupported: imagesUnsupportedReason, disabled: disabled, modelUnavailable: modelUnavailable, agentUnavailable: agentUnavailable, call: call, onSubmit: () => handleSubmit() })] })] })] }), _jsx(ImagesUnsupportedBar, { modelName: noModelsConnected ? null : modelRejectingImages }), inlineUnderbar ? null : (_jsx(ComposerUnderbar, { onAttachClick: handleAttachClick, agents: primaryAgents, selectedAgent: selectedAgent, onAgentChange: onAgentChange, agentMenuOpen: agentMenuOpen, onAgentMenuOpenChange: setAgentMenuOpen, noAccessibleAgents: noAccessibleAgents, agentLocked: agentLocked, messages: messages, models: models, selectedModel: availableSelectedModel, onContextClick: onContextClick, toolbarSlot: toolbarSlot, agentsSlot: underbarSlot, chatInput: chatInput })), connectionsAbove ? null : _jsx(ModelConnectionBar, { show: noModelsConnected }), slashMenuPlacement === 'below' && (_jsx("div", { id: dockId, className: "absolute top-full right-4 left-4 z-99 mt-3.5" }))] }));
179
+ commandAttachmentPlan.kind === 'refuse', attachmentFailed: attachmentFailed, attachmentUnsupported: imagesUnsupportedReason, disabled: disabled, modelUnavailable: modelUnavailable, agentUnavailable: agentUnavailable, call: call, onSubmit: () => handleSubmit() })] })] })] }), _jsx(ImagesUnsupportedBar, { modelName: noModelsConnected ? null : modelRejectingImages }), inlineUnderbar ? null : (_jsx(ComposerUnderbar, { hideAgentPicker: hideAgentPicker, onAttachClick: handleAttachClick, agents: primaryAgents, selectedAgent: selectedAgent, onAgentChange: onAgentChange, agentMenuOpen: agentMenuOpen, onAgentMenuOpenChange: setAgentMenuOpen, noAccessibleAgents: noAccessibleAgents, agentLocked: agentLocked, messages: messages, models: models, selectedModel: availableSelectedModel, onContextClick: onContextClick, toolbarSlot: toolbarSlot, agentsSlot: underbarSlot, chatInput: chatInput })), connectionsAbove ? null : _jsx(ModelConnectionBar, { show: noModelsConnected }), slashMenuPlacement === 'below' && (_jsx("div", { id: dockId, className: "absolute top-full right-4 left-4 z-99 mt-3.5" }))] }));
136
180
  }
@@ -6,6 +6,7 @@ import { SessionOverridesComposer } from '../overrides/session-overrides-compose
6
6
  import { SessionChatInput, } from './session-chat-input.js';
7
7
  import { useProjectConfig, useRuntimeAgents, useRuntimeCommands, useRuntimeConfig, useRuntimeProviders, useSessionModelSelection } from '@kortix/sdk/react';
8
8
  import { appendMentionRefs } from '../../internal/lib/project-preamble.js';
9
+ import { driveUploadsOf } from './drive-mentions.js';
9
10
  import { chatStartAgent, resolveComposerAgent, withChannelAgents } from './composer-agent-access.js';
10
11
  import { inheritedModelFor } from './chat-input/chat-input-summary.js';
11
12
  /**
@@ -32,6 +33,7 @@ export function ComposerChatInput({ onSend, onCommand, sessionId, projectId, isB
32
33
  providers,
33
34
  config,
34
35
  sessionId,
36
+ projectSessionId: sessionId,
35
37
  boundAgentName,
36
38
  defaultAgentName: startAgent,
37
39
  // A new workspace chat remembers the person's pick and starts the next one
@@ -152,7 +154,7 @@ export function ComposerChatInput({ onSend, onCommand, sessionId, projectId, isB
152
154
  , {
153
155
  // A first message has no session send to write the `@` mention blocks
154
156
  // (`session-chat.tsx` `handleSend`), so they go into the text here.
155
- onSend: (text, files, mentions, attachments, placement) => onSend(appendMentionRefs(text, mentions), files, { ...options(), placement }, attachments), promptAttachments: promptAttachments, onCommand: onCommand ? (cmd, args) => onCommand(cmd, args, options()) : undefined, clearOnSend: clearOnSend, isBusy: isBusy, sessionWorking: sessionWorking, runtimeReady: runtimeReady, stopDisabled: stopDisabled, isSending: isSending, disabled: disabled,
157
+ onSend: (text, files, mentions, attachments, placement) => onSend(appendMentionRefs(text, mentions, driveUploadsOf(files)), files, { ...options(), placement }, attachments), promptAttachments: promptAttachments, onCommand: onCommand ? (cmd, args) => onCommand(cmd, args, options()) : undefined, clearOnSend: clearOnSend, isBusy: isBusy, sessionWorking: sessionWorking, runtimeReady: runtimeReady, stopDisabled: stopDisabled, isSending: isSending, disabled: disabled,
156
158
  // A thread a space's chat opened by itself does not take the focus (`ComposerAutoFocusContext`).
157
159
  autoFocus: autoFocus ?? (contextAutoFocus ? undefined : false), placeholder: placeholder, hint: hint, prefill: deliveredPrefill, onPrefillApplied: onPrefillApplied, aboveSlot: aboveSlot, inputSlot: inputSlot, toolbarSlot: combinedToolbarSlot, underbarPlacement: underbarPlacement, slashMenuPlacement: slashMenuPlacement, cardClassName: cardClassName, parentClassName: parentClassName, sessionId: sessionId, projectId: projectId, providers: providers, agents: local.agent.list, selectedAgent: selectedAgentName, noAccessibleAgents: noAccessibleAgents, agentLocked: agentLocked,
158
160
  // A locked agent has nothing to switch to: no handler is the composer's "fixed agent" signal.