@kortix/ui 0.15.7 → 0.15.9

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 (262) hide show
  1. package/README.md +7 -7
  2. package/dist/_vendor/kortix-shared.js +39 -1
  3. package/dist/_vendor/shared/my-kortix-agent.d.ts +7 -0
  4. package/dist/_vendor/shared/pixel-mark.d.ts +18 -0
  5. package/dist/access/access/access-dialog-share.js +12 -6
  6. package/dist/access/access/share-selection.d.ts +9 -0
  7. package/dist/access/access/share-selection.js +64 -0
  8. package/dist/customize/connectors/catalog/connector-categories.d.ts +2 -2
  9. package/dist/customize/connectors/catalog/connector-categories.js +2 -2
  10. package/dist/customize/connectors/connector-identity.js +3 -3
  11. package/dist/customize/connectors/detail/app-page.js +2 -2
  12. package/dist/customize/connectors/detail/connector-accounts.d.ts +3 -1
  13. package/dist/customize/connectors/detail/connector-accounts.js +2 -2
  14. package/dist/customize/connectors/detail/connector-modal.js +1 -1
  15. package/dist/customize/connectors/detail/connector-notice-view.d.ts +4 -0
  16. package/dist/customize/connectors/detail/connector-notice-view.js +4 -0
  17. package/dist/customize/connectors/detail/connector-notice.d.ts +31 -4
  18. package/dist/customize/connectors/detail/connector-notice.js +23 -4
  19. package/dist/customize/connectors/detail/connector-page.js +27 -7
  20. package/dist/customize/connectors/detail/connector-status.d.ts +12 -1
  21. package/dist/customize/connectors/detail/connector-status.js +11 -0
  22. package/dist/customize/connectors/detail/status-badge.d.ts +3 -3
  23. package/dist/customize/connectors/detail/status-badge.js +2 -1
  24. package/dist/customize/connectors/detail/use-connector-detail.js +10 -2
  25. package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.d.ts +13 -0
  26. package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.js +29 -0
  27. package/dist/customize/providers/provider-accordion.js +5 -4
  28. package/dist/customize/providers/provider-connect.js +3 -1
  29. package/dist/customize/providers/provider-sheet.js +9 -4
  30. package/dist/customize/sections/component/email-connect-form.js +4 -2
  31. package/dist/customize/sections/connectors-view.d.ts +4 -1
  32. package/dist/customize/sections/connectors-view.js +42 -7
  33. package/dist/customize/sections/gateway-view.d.ts +1 -1
  34. package/dist/customize/sections/gateway-view.js +1 -1
  35. package/dist/customize/sections/view/account-secret-resources-panel.d.ts +15 -0
  36. package/dist/customize/sections/view/account-secret-resources-panel.js +48 -7
  37. package/dist/customize/sections/view/agent-editor-basics-fields.js +1 -1
  38. package/dist/customize/sections/view/gateway/gateway-logs.d.ts +1 -1
  39. package/dist/customize/sections/view/git-view.js +1 -1
  40. package/dist/customize/sections/view/permission-editor.js +1 -1
  41. package/dist/customize/sections/view/secret-delivery.d.ts +9 -2
  42. package/dist/customize/sections/view/secret-delivery.js +14 -4
  43. package/dist/customize/sections/view/secrets-view.js +21 -5
  44. package/dist/customize/sections/view/subscription-usage.d.ts +3 -32
  45. package/dist/customize/sections/view/subscription-usage.js +2 -86
  46. package/dist/customize/shared/entity/entity-modal.js +8 -10
  47. package/dist/customize/triggers/schedule/schedule-builder.js +1 -1
  48. package/dist/customize/triggers/schedule/schedule-copy.js +4 -0
  49. package/dist/customize/triggers/schedule/schedule-detail-sheet.js +14 -3
  50. package/dist/customize/triggers/schedule/then-fields.d.ts +3 -1
  51. package/dist/customize/triggers/schedule/then-fields.js +8 -4
  52. package/dist/customize/triggers/schedule/trigger-composer.js +1 -1
  53. package/dist/customize/triggers/schedule/trigger-list.d.ts +3 -1
  54. package/dist/customize/triggers/schedule/trigger-list.js +18 -2
  55. package/dist/customize/triggers/schedule/trigger-runs-logic.js +4 -2
  56. package/dist/customize/triggers/schedule/trigger-runs-panel.js +4 -1
  57. package/dist/files/project/components/drive-toolbar.d.ts +1 -1
  58. package/dist/files/project/components/drive-toolbar.js +1 -1
  59. package/dist/files/project/store/version-store.d.ts +1 -1
  60. package/dist/files/renderers/pptx-renderer.js +5 -20
  61. package/dist/files/renderers/presentation/FullScreenPresentationViewer.d.ts +3 -2
  62. package/dist/files/renderers/presentation/FullScreenPresentationViewer.js +23 -304
  63. package/dist/files/renderers/presentation/presentation-export-menu.d.ts +14 -0
  64. package/dist/files/renderers/presentation/presentation-export-menu.js +44 -0
  65. package/dist/files/renderers/presentation/presentation-utils.d.ts +1 -0
  66. package/dist/files/renderers/presentation/presentation-utils.js +4 -0
  67. package/dist/files/renderers/presentation/slide-iframe.d.ts +23 -0
  68. package/dist/files/renderers/presentation/slide-iframe.js +61 -0
  69. package/dist/files/renderers/presentation/use-presentation-metadata.d.ts +39 -0
  70. package/dist/files/renderers/presentation/use-presentation-metadata.js +137 -0
  71. package/dist/files/renderers/presentation/use-slide-navigation.d.ts +17 -0
  72. package/dist/files/renderers/presentation/use-slide-navigation.js +82 -0
  73. package/dist/files/renderers/shared/scroll-area-compat.d.ts +6 -6
  74. package/dist/files/renderers/shared/scroll-area-compat.js +7 -9
  75. package/dist/files/renderers/shared/select-compat.js +3 -7
  76. package/dist/files/renderers/shared/use-stage-fit-scale.d.ts +19 -0
  77. package/dist/files/renderers/shared/use-stage-fit-scale.js +41 -0
  78. package/dist/files/renderers/show-content-renderer.js +16 -11
  79. package/dist/files/renderers/xlsx/xlsx-renderer.d.ts +4 -13
  80. package/dist/files/renderers/xlsx/xlsx-renderer.js +6 -63
  81. package/dist/files/renderers/xlsx/xlsx-viewer.d.ts +4 -2
  82. package/dist/files/renderers/xlsx/xlsx-viewer.js +28 -34
  83. package/dist/files/viewer/file-content-renderer.js +1 -4
  84. package/dist/files/viewer/file-preview-modal.d.ts +10 -11
  85. package/dist/files/viewer/file-preview-modal.js +17 -18
  86. package/dist/files/viewer/use-file-content-state.js +10 -9
  87. package/dist/i18n/en.d.ts +51 -0
  88. package/dist/i18n/en.js +58 -7
  89. package/dist/index.js +1 -1
  90. package/dist/internal/account-hub/account-hub-location.js +2 -2
  91. package/dist/internal/account-hub/use-account-members.d.ts +28 -1
  92. package/dist/internal/account-hub/use-account-members.js +27 -10
  93. package/dist/internal/chrome/use-chrome-offered.d.ts +2 -1
  94. package/dist/internal/chrome/use-chrome-offered.js +4 -2
  95. package/dist/internal/components/agent-mark.d.ts +1 -8
  96. package/dist/internal/components/agent-mark.js +2 -19
  97. package/dist/internal/hooks/connectors/use-finish-sign-in.d.ts +13 -0
  98. package/dist/internal/hooks/connectors/use-finish-sign-in.js +33 -0
  99. package/dist/internal/hooks/connectors/use-pipedream-connect-member.js +6 -1
  100. package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +6 -1
  101. package/dist/internal/lib/error-handler.js +33 -0
  102. package/dist/internal/lib/navigation/modified-click.js +2 -2
  103. package/dist/internal/lib/pixel-mark.d.ts +3 -20
  104. package/dist/internal/lib/pixel-mark.js +3 -34
  105. package/dist/internal/lib/trigger-clock.d.ts +7 -2
  106. package/dist/internal/lib/trigger-clock.js +17 -3
  107. package/dist/internal/stores/active-space-store.d.ts +1 -1
  108. package/dist/internal/stores/browser-recents-store.d.ts +1 -1
  109. package/dist/internal/stores/current-account-store.d.ts +1 -1
  110. package/dist/internal/stores/first-chat-store.d.ts +1 -1
  111. package/dist/internal/stores/mobile-app-promo-store.d.ts +1 -1
  112. package/dist/internal/stores/session-browser-store.d.ts +1 -1
  113. package/dist/internal/stores/session-expanded-store.d.ts +1 -1
  114. package/dist/internal/stores/session-filter-store.d.ts +1 -1
  115. package/dist/internal/stores/session-history-view-store.d.ts +1 -1
  116. package/dist/internal/stores/session-hover-store.d.ts +1 -1
  117. package/dist/internal/stores/session-hover-store.js +1 -1
  118. package/dist/internal/stores/session-panel-memory-store.d.ts +1 -1
  119. package/dist/internal/stores/sound-store.d.ts +1 -1
  120. package/dist/internal/stores/tab-store.d.ts +1 -1
  121. package/dist/internal/stores/user-preferences-store.d.ts +1 -1
  122. package/dist/internal/stores/web-notification-store.d.ts +1 -1
  123. package/dist/lib/base-ui-compat.d.ts +149 -0
  124. package/dist/lib/base-ui-compat.js +339 -0
  125. package/dist/lib/portal-container.d.ts +3 -7
  126. package/dist/lib/portal-container.js +5 -3
  127. package/dist/lib/z-stack.d.ts +9 -5
  128. package/dist/lib/z-stack.js +17 -7
  129. package/dist/primitives/accordion.d.ts +36 -5
  130. package/dist/primitives/accordion.js +41 -8
  131. package/dist/primitives/alert-dialog.d.ts +33 -11
  132. package/dist/primitives/alert-dialog.js +41 -19
  133. package/dist/primitives/avatar.d.ts +5 -2
  134. package/dist/primitives/avatar.js +3 -3
  135. package/dist/primitives/badge.js +1 -1
  136. package/dist/primitives/breadcrumb.js +1 -1
  137. package/dist/primitives/button-group.js +3 -3
  138. package/dist/primitives/button.js +1 -1
  139. package/dist/primitives/checkbox.d.ts +14 -5
  140. package/dist/primitives/checkbox.js +24 -9
  141. package/dist/primitives/collapsible.d.ts +16 -4
  142. package/dist/primitives/collapsible.js +18 -7
  143. package/dist/primitives/command-core.d.ts +121 -0
  144. package/dist/primitives/command-core.js +642 -0
  145. package/dist/primitives/command.d.ts +38 -4
  146. package/dist/primitives/command.js +22 -13
  147. package/dist/primitives/context-menu.d.ts +61 -31
  148. package/dist/primitives/context-menu.js +40 -53
  149. package/dist/primitives/dialog.d.ts +48 -10
  150. package/dist/primitives/dialog.js +48 -19
  151. package/dist/primitives/disclosure.d.ts +1 -1
  152. package/dist/primitives/disclosure.js +2 -2
  153. package/dist/primitives/drawer.d.ts +28 -9
  154. package/dist/primitives/drawer.js +42 -18
  155. package/dist/primitives/dropdown-menu.d.ts +55 -33
  156. package/dist/primitives/dropdown-menu.js +46 -82
  157. package/dist/primitives/faded-scroll-area.js +2 -1
  158. package/dist/primitives/hint.js +3 -3
  159. package/dist/primitives/hover-card.d.ts +17 -5
  160. package/dist/primitives/hover-card.js +45 -8
  161. package/dist/primitives/item.js +2 -2
  162. package/dist/primitives/label.d.ts +5 -2
  163. package/dist/primitives/label.js +10 -3
  164. package/dist/primitives/menu-base.d.ts +150 -0
  165. package/dist/primitives/menu-base.js +171 -0
  166. package/dist/primitives/menu-recipe.d.ts +1 -1
  167. package/dist/primitives/menu-recipe.js +2 -7
  168. package/dist/primitives/modal.d.ts +19 -52
  169. package/dist/primitives/modal.js +24 -28
  170. package/dist/primitives/navigation-menu.d.ts +36 -11
  171. package/dist/primitives/navigation-menu.js +31 -12
  172. package/dist/primitives/popover.d.ts +31 -6
  173. package/dist/primitives/popover.js +79 -12
  174. package/dist/primitives/preview-image.d.ts +18 -7
  175. package/dist/primitives/preview-image.js +14 -11
  176. package/dist/primitives/progress.d.ts +4 -2
  177. package/dist/primitives/progress.js +4 -3
  178. package/dist/primitives/project-icon-picker.js +2 -2
  179. package/dist/primitives/radio-group.d.ts +28 -5
  180. package/dist/primitives/radio-group.js +18 -10
  181. package/dist/primitives/scroll-area.d.ts +2 -2
  182. package/dist/primitives/scroll-area.js +8 -3
  183. package/dist/primitives/select.d.ts +55 -12
  184. package/dist/primitives/select.js +93 -36
  185. package/dist/primitives/separator.d.ts +6 -2
  186. package/dist/primitives/separator.js +10 -2
  187. package/dist/primitives/sheet.d.ts +17 -10
  188. package/dist/primitives/sheet.js +19 -22
  189. package/dist/primitives/sidebar-menu-primitives.js +8 -8
  190. package/dist/primitives/slider-native.d.ts +2 -2
  191. package/dist/primitives/slider-native.js +11 -9
  192. package/dist/primitives/slider.d.ts +24 -6
  193. package/dist/primitives/slider.js +26 -24
  194. package/dist/primitives/slot.d.ts +6 -0
  195. package/dist/primitives/slot.js +7 -0
  196. package/dist/primitives/split-sheet.js +1 -1
  197. package/dist/primitives/stepper.js +1 -1
  198. package/dist/primitives/switch.d.ts +16 -3
  199. package/dist/primitives/switch.js +7 -6
  200. package/dist/primitives/tabs.d.ts +36 -20
  201. package/dist/primitives/tabs.js +131 -102
  202. package/dist/primitives/toggle.d.ts +16 -3
  203. package/dist/primitives/toggle.js +8 -3
  204. package/dist/primitives/tooltip.d.ts +24 -5
  205. package/dist/primitives/tooltip.js +32 -10
  206. package/dist/primitives/type-to-confirm-dialog.d.ts +1 -1
  207. package/dist/primitives/type-to-confirm-dialog.js +1 -1
  208. package/dist/session/composer/animated-placeholder.js +1 -1
  209. package/dist/session/composer/chat-input/chat-input-control.js +3 -3
  210. package/dist/session/composer/editor/composer-editor.js +1 -1
  211. package/dist/session/composer/menus/menu-shell.d.ts +1 -1
  212. package/dist/session/composer/menus/menu-shell.js +1 -1
  213. package/dist/session/composer/menus/mount.js +1 -1
  214. package/dist/session/composer/reasoning-effort-selector.js +1 -1
  215. package/dist/session/header/session-site-header.js +2 -2
  216. package/dist/session/header/subagent-hover-card.js +2 -2
  217. package/dist/session/media/image-preview.js +1 -1
  218. package/dist/session/models/model-connection-gate.js +16 -3
  219. package/dist/session/models/model-picker-panel.js +6 -2
  220. package/dist/session/models/model-selector.d.ts +1 -1
  221. package/dist/session/models/model-selector.js +18 -12
  222. package/dist/session/models/provider-key-action.d.ts +10 -0
  223. package/dist/session/models/provider-key-action.js +35 -0
  224. package/dist/session/models/provider-key-slot.d.ts +9 -0
  225. package/dist/session/models/provider-key-slot.js +19 -0
  226. package/dist/session/models/subscription-switcher.d.ts +37 -0
  227. package/dist/session/models/subscription-switcher.js +97 -0
  228. package/dist/session/models/subscription-windows.d.ts +40 -0
  229. package/dist/session/models/subscription-windows.js +86 -0
  230. package/dist/session/overrides/session-overrides-control.js +3 -3
  231. package/dist/session/panel/diff-dialog.js +1 -1
  232. package/dist/session/panel/easy/detail-view.js +3 -3
  233. package/dist/session/panel/mobile-tool-drawer.js +2 -2
  234. package/dist/session/panel/panel-fallback.js +1 -1
  235. package/dist/session/panel/session-files-explorer.d.ts +1 -1
  236. package/dist/session/panel/session-files-explorer.js +1 -1
  237. package/dist/session/prompts/session-connect-prompt.d.ts +40 -0
  238. package/dist/session/prompts/session-connect-prompt.js +126 -0
  239. package/dist/session/status/session-error-banner.d.ts +1 -1
  240. package/dist/session/status/session-error-banner.js +12 -4
  241. package/dist/session/thread/session-chat.js +9 -4
  242. package/dist/session/thread/session-context-message-explorer.js +1 -1
  243. package/dist/session/thread/transcript.js +31 -7
  244. package/dist/session/thread/turn-share.js +3 -4
  245. package/dist/session/tool/shared/show-helpers.js +1 -1
  246. package/dist/session/turn/message-time-label.js +1 -1
  247. package/dist/styles.css +1 -1
  248. package/dist/test-utils/intl.d.ts +51 -0
  249. package/dist/workspace/projects/modal/project-icon-field.js +9 -23
  250. package/dist/workspace/review/review-center.js +1 -1
  251. package/dist/workspace/sessions/session-row.js +1 -1
  252. package/dist/workspace/sidebar/project-session-list.js +2 -2
  253. package/dist/workspace/sidebar/session-brief-hover-card.d.ts +1 -1
  254. package/dist/workspace/sidebar/session-brief-hover-card.js +3 -3
  255. package/dist/workspace/sidebar/session-title.d.ts +2 -2
  256. package/dist/workspace/sidebar/session-title.js +2 -2
  257. package/dist/workspace/sidebar/workspace-menu-section.js +1 -1
  258. package/dist/workspace/spaces/space-links.js +1 -1
  259. package/dist/workspace/spaces/space-threads-tab.js +1 -1
  260. package/package.json +16 -35
  261. package/skills/kortix-ui/SKILL.md +1 -1
  262. package/skills/kortix-ui/references/custom-dashboard.md +1 -1
@@ -0,0 +1,86 @@
1
+ /** Warn at 80%, turn red at 95%, and distinguish a provider-enforced limit. */
2
+ export function usageTone(window, limited) {
3
+ if (window.used_percent >= 100 || (limited && window.used_percent >= 90))
4
+ return 'limited';
5
+ if (window.used_percent >= 95)
6
+ return 'critical';
7
+ return window.used_percent >= 80 ? 'near' : 'ok';
8
+ }
9
+ /**
10
+ * Windows that never stop the login's model calls: code review, paid extra
11
+ * usage, and one model's own limit (ChatGPT `model_*`, Claude `seven_day_opus`,
12
+ * `7d_sonnet`). Claude's OAuth-apps window stays blocking. The server's twin
13
+ * is `isBlockingWindow` in packages/llm-gateway/src/usage/subscription-usage.ts.
14
+ */
15
+ export function isBlockingWindow(id) {
16
+ return !/^(?:code_review|extra_usage|model_|seven_day_(?!oauth_apps$)|7d_(?!oauth_apps$))/.test(id);
17
+ }
18
+ /** The model name of a model-specific weekly window (`seven_day_opus` → `Opus`), or null. */
19
+ export function weeklyModel(id) {
20
+ const model = /^(?:seven_day|7d)_([a-z]+)$/.exec(id)?.[1];
21
+ return model ? model[0].toUpperCase() + model.slice(1) : null;
22
+ }
23
+ const title = (value) => value.replaceAll('_', ' ').replace(/^./, (first) => first.toUpperCase());
24
+ /** A model limit's id fragment read back as its name: `gpt_5_3_codex_spark` → `GPT-5.3 Codex Spark`. */
25
+ export function modelName(slug) {
26
+ const words = [];
27
+ for (const token of slug.split('_').filter(Boolean)) {
28
+ const last = words.at(-1);
29
+ if (/^\d+$/.test(token) && last && /\d$/.test(last))
30
+ words[words.length - 1] = `${last}.${token}`;
31
+ else
32
+ words.push(token === 'gpt' ? 'GPT' : /^\d/.test(token) ? token : token[0].toUpperCase() + token.slice(1));
33
+ }
34
+ return words.join(' ').replace(/^GPT (\d)/, 'GPT-$1');
35
+ }
36
+ /** A window's name: `5-hour`, `Weekly`, `Weekly · Opus`, `Code review · Weekly`, `Extra usage`. */
37
+ export function windowLabel(id, t, options = {}) {
38
+ if (id === 'five_hour')
39
+ return t('fiveHour');
40
+ // Beside `Weekly · Opus`, the plain weekly window is the one every model shares.
41
+ if (id === 'weekly')
42
+ return options.modelWeekly ? t('weeklyAll') : t('weekly');
43
+ if (id === 'extra_usage')
44
+ return t('extraUsage');
45
+ if (id === 'seven_day_oauth_apps' || id === '7d_oauth_apps')
46
+ return t('weeklyModel', { model: t('apps') });
47
+ const model = weeklyModel(id);
48
+ if (model)
49
+ return t('weeklyModel', { model });
50
+ const scoped = /^(code_review|model_[a-z0-9_]+?)_(five_hour|weekly|primary|secondary)$/.exec(id);
51
+ if (scoped) {
52
+ const scope = scoped[1] === 'code_review' ? t('codeReview') : modelName(scoped[1].slice('model_'.length));
53
+ const span = scoped[2] === 'five_hour' ? t('fiveHour') : scoped[2] === 'weekly' ? t('weekly') : null;
54
+ return span ? `${scope} · ${span}` : scope;
55
+ }
56
+ return title(id);
57
+ }
58
+ /**
59
+ * `person@example.test · Pro`: who the login signs in as. The email is left out
60
+ * when the label already shows it; null when the provider says nothing.
61
+ */
62
+ export function accountLine(account, label) {
63
+ if (!account)
64
+ return null;
65
+ const email = account.email && !label.toLowerCase().includes(account.email.toLowerCase()) ? account.email : null;
66
+ const plan = account.plan ? account.plan[0].toUpperCase() + account.plan.slice(1) : null;
67
+ return [email, plan].filter(Boolean).join(' · ') || null;
68
+ }
69
+ /** The windows still in force: a window whose reset passed no longer limits anything. */
70
+ export function currentWindows(usage, now) {
71
+ return usage.windows.filter((window) => !window.resets_at || Date.parse(window.resets_at) > now);
72
+ }
73
+ /** A login that cannot take a model call now, and when that ends (null: unknown). */
74
+ export function loginLimit(usage, now) {
75
+ if (!usage)
76
+ return { limited: false, until: null };
77
+ const blocking = currentWindows(usage, now).filter((window) => isBlockingWindow(window.id));
78
+ const full = blocking.filter((window) => window.used_percent >= 100);
79
+ // A rejection whose window already reset is history, not a limit.
80
+ const rejected = usage.limited && blocking.length === usage.windows.filter((window) => isBlockingWindow(window.id)).length;
81
+ if (!full.length && !rejected)
82
+ return { limited: false, until: null };
83
+ const resets = (full.length ? full : blocking).map((window) => window.resets_at).filter((at) => Boolean(at));
84
+ // Capacity is back only when the LAST full window resets.
85
+ return { limited: true, until: resets.length ? resets.reduce((a, b) => (Date.parse(a) > Date.parse(b) ? a : b)) : null };
86
+ }
@@ -31,7 +31,7 @@ export function SessionOverridesControlContent({ rows, disabled = false, saving
31
31
  const focused = rows.find((row) => row.id === focusedId) ?? rows[0];
32
32
  const controlsDisabled = disabled || saving;
33
33
  return (_jsxs("div", {
34
- // Radix reports how much room it actually has; without this the panel is
34
+ // The positioner reports how much room it actually has; without this the panel is
35
35
  // taller than the gap above the composer on a short or narrow viewport and
36
36
  // its first row slides off the top of the screen.
37
37
  className: "flex h-[28rem] max-h-[var(--radix-popover-content-available-height,28rem)] flex-col overflow-hidden", children: [_jsxs("div", { className: "border-border flex min-h-0 flex-1 flex-col sm:flex-row", children: [_jsx("ul", { className: "border-border flex shrink-0 gap-0.5 overflow-x-auto border-b p-1.5 sm:w-48 sm:flex-col sm:overflow-y-auto sm:border-r sm:border-b-0", "aria-label": t('sessionOverrides'), children: rows.map((row) => {
@@ -61,11 +61,11 @@ export function SessionOverridesControl({ onSave, ...contentProps }) {
61
61
  setOpen(next); }, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { type: "button", variant: "ghost", size: "icon", disabled: contentProps.saving, "aria-label": t('sessionOverrides'), className: "text-muted-foreground hover:text-foreground data-[state=open]:text-foreground hit-area-3", children: _jsx(GearSixIcon, { className: "size-4 shrink-0" }) }) }), _jsx(PopoverContent, { "aria-label": t('sessionOverrides'), onEscapeKeyDown: (event) => { if (contentProps.saving)
62
62
  event.preventDefault(); }, side: "top", align: "end", sideOffset: 8, collisionPadding: 12, className: "w-[min(620px,calc(100vw-2rem))] overflow-hidden p-0",
63
63
  // The model, agent and effort editors are themselves popovers rendered
64
- // into their own portal. Radix sees that portal as "outside", so an
64
+ // into their own portal. The popover sees that portal as "outside", so an
65
65
  // unguarded interaction there closes THIS panel under the user's cursor.
66
66
  onInteractOutside: (event) => {
67
67
  const target = event.target;
68
- if (contentProps.saving || target?.closest('[data-radix-popper-content-wrapper]'))
68
+ if (contentProps.saving || target?.closest('[data-kortix-floating]'))
69
69
  event.preventDefault();
70
70
  }, children: _jsx(SessionOverridesControlContent, { ...contentProps, onSave: saveAndClose }) })] }));
71
71
  }
@@ -4,7 +4,7 @@ import { useTranslations } from '../../i18n/index.js';
4
4
  import { Modal, ModalContent, ModalTitle } from '../../primitives/modal.js';
5
5
  import { SessionDiffViewer } from './session-diff-viewer.js';
6
6
  import { cn } from '../../lib/utils.js';
7
- import { VisuallyHidden } from '@radix-ui/react-visually-hidden';
7
+ import { VisuallyHidden } from '../../lib/base-ui-compat.js';
8
8
  import { useState } from 'react';
9
9
  export function DiffDialog({ sessionId, open, onOpenChange }) {
10
10
  const tHardcodedUi = useTranslations('hardcodedUi');
@@ -46,7 +46,7 @@ const CARD_FRAME = 'bg-popover border-border absolute inset-y-3 right-3 left-3 f
46
46
  * The prev/next row, shared by the desktop card and the mobile drawer so the
47
47
  * two never drift. Both pin it as a slim bar under the scrollable body —
48
48
  * `shrink-0` so it's always in view, never scrolled away with the content —
49
- * because horizontal swipe is out on mobile: vaul already owns the drawer's
49
+ * because horizontal swipe is out on mobile: the drawer already owns its
50
50
  * vertical gesture, and layering a horizontal recognizer inside it is a
51
51
  * conflict trap. The buttons carry mobile instead.
52
52
  */
@@ -73,7 +73,7 @@ const FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), selec
73
73
  * carries all three: a focused-element listener would miss most of the
74
74
  * detail's body, since that body can put focus anywhere — a code block, an
75
75
  * iframe's surrounding chrome, a button — same reasoning as the reference
76
- * browser chrome this pages next to. Desktop-only because mobile is a vaul
76
+ * browser chrome this pages next to. Desktop-only because mobile is a
77
77
  * drawer, which already owns Escape/swipe-down itself; a second listener
78
78
  * there would double-fire.
79
79
  */
@@ -246,7 +246,7 @@ export function DetailLayer({ detail, onBack, isMobile, persistentLayer, childre
246
246
  const restoreFocusRef = useRef(null);
247
247
  const wasOpenRef = useRef(false);
248
248
  // Desktop only — mobile has no keyboard to speak of, and the drawer's own
249
- // buttons (plus vaul's own Escape/swipe handling) carry it instead (see
249
+ // buttons (plus the drawer's own Escape/swipe handling) carry it instead (see
250
250
  // `DetailNav`'s comment).
251
251
  useDetailKeyboard(detail, isMobile, onBack, detailRef);
252
252
  // Once-true latch: the persistent layer costs nothing until it is first
@@ -13,8 +13,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  *
14
14
  * Bodies are the same self-contained surfaces Advanced mode's panel tabs
15
15
  * mount (`SessionTerminalPanel`, `BrowserPanel`, `SessionFilesExplorer`,
16
- * `SessionAuditPanel`), so both panel modes get identical tools here. vaul
17
- * unmounts the content on close, so the terminal reconnects per open — the
16
+ * `SessionAuditPanel`), so both panel modes get identical tools here. The
17
+ * drawer unmounts the content on close, so the terminal reconnects per open — the
18
18
  * tradeoff every mobile drawer in this feature already accepts.
19
19
  */
20
20
  import { Drawer, DrawerContent, DrawerHeader, DrawerTitle } from '../../primitives/drawer.js';
@@ -14,7 +14,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
14
14
  *
15
15
  * It renders nothing while a side panel is mounted. See `panel-fallback-store.ts`.
16
16
  */
17
- import { VisuallyHidden } from '@radix-ui/react-visually-hidden';
17
+ import { VisuallyHidden } from '../../lib/base-ui-compat.js';
18
18
  import { lazy, Suspense, useEffect } from 'react';
19
19
  import { FilePreviewHost } from '../../files/file-preview-host.js';
20
20
  import { useTranslations } from '../../i18n/index.js';
@@ -6,7 +6,7 @@ export type { SessionPanelMode };
6
6
  * • All files — the Drive-style explorer pointed at the live sandbox.
7
7
  * • Changes — the diff for everything this session changed.
8
8
  *
9
- * It is a plain Radix `Tabs`. It used to be a hand-rolled tablist in a
9
+ * It is a plain `Tabs`. It used to be a hand-rolled tablist in a
10
10
  * `session-version-header.tsx` that reimplemented what `tabs.tsx` already
11
11
  * does — roving `tabIndex`, arrow/Home/End key handling, an absolutely
12
12
  * positioned underline `<span>`, and `panelId`/`sessionVersionTabId` threaded
@@ -23,7 +23,7 @@ import { useEffect, useRef, useState } from 'react';
23
23
  * • All files — the Drive-style explorer pointed at the live sandbox.
24
24
  * • Changes — the diff for everything this session changed.
25
25
  *
26
- * It is a plain Radix `Tabs`. It used to be a hand-rolled tablist in a
26
+ * It is a plain `Tabs`. It used to be a hand-rolled tablist in a
27
27
  * `session-version-header.tsx` that reimplemented what `tabs.tsx` already
28
28
  * does — roving `tabIndex`, arrow/Home/End key handling, an absolutely
29
29
  * positioned underline `<span>`, and `panelId`/`sessionVersionTabId` threaded
@@ -0,0 +1,40 @@
1
+ /**
2
+ * In-session Connect card, docked above the composer beside
3
+ * `SessionApprovalPrompt` and `SessionAccessPrompt`.
4
+ *
5
+ * An agent runs `kortix connectors connect <app>` and stops: the sign-in it
6
+ * started is a raw provider link, and nothing in Kortix finished the
7
+ * connection when the person came back (2026-11-11). The API records which
8
+ * session asked on the account row (`requesting_session_id`); this card reads
9
+ * those rows (`listSessionConnectRequests`) and finishes each one through
10
+ * `connectionSignInSteps`: the window opens inside the click, the first request
11
+ * records a sign-in that already finished at the provider, and only an
12
+ * unfinished one goes to a new sign-in page. Finalize tells the session that
13
+ * asked, so the agent continues on its own.
14
+ *
15
+ * Shown: every request still to sign in, and each one that connected while
16
+ * this page was open ("Connected as …"). A request that was connected before
17
+ * the page loaded is history and stays hidden.
18
+ */
19
+ import { type SessionConnectRequest } from '@kortix/sdk';
20
+ /** Stable id of one request: its account row, or the connector on an older server. */
21
+ export declare function sessionConnectRequestKey(request: SessionConnectRequest): string;
22
+ /**
23
+ * The requests on screen: every pending one, plus those that connected after
24
+ * `seenPending` first saw them pending. Pure; exported for tests.
25
+ */
26
+ export declare function sessionConnectRequestsOnScreen(requests: readonly SessionConnectRequest[], seenPending: ReadonlySet<string>): SessionConnectRequest[];
27
+ export declare function SessionConnectPrompt({ projectId, sessionId, busy, onDockedChange, }: {
28
+ projectId: string;
29
+ sessionId: string;
30
+ /** The agent is running: poll faster, and read again when it stops. */
31
+ busy: boolean;
32
+ /** True while a card is on screen: the composer docks onto it. */
33
+ onDockedChange?: (docked: boolean) => void;
34
+ }): import("react").JSX.Element | null;
35
+ /** The card itself: one row per request. */
36
+ export declare function SessionConnectNotice({ requests, projectId, onSettled, }: {
37
+ requests: readonly SessionConnectRequest[];
38
+ projectId: string;
39
+ onSettled: () => void;
40
+ }): import("react").JSX.Element;
@@ -0,0 +1,126 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /**
4
+ * In-session Connect card, docked above the composer beside
5
+ * `SessionApprovalPrompt` and `SessionAccessPrompt`.
6
+ *
7
+ * An agent runs `kortix connectors connect <app>` and stops: the sign-in it
8
+ * started is a raw provider link, and nothing in Kortix finished the
9
+ * connection when the person came back (2026-11-11). The API records which
10
+ * session asked on the account row (`requesting_session_id`); this card reads
11
+ * those rows (`listSessionConnectRequests`) and finishes each one through
12
+ * `connectionSignInSteps`: the window opens inside the click, the first request
13
+ * records a sign-in that already finished at the provider, and only an
14
+ * unfinished one goes to a new sign-in page. Finalize tells the session that
15
+ * asked, so the agent continues on its own.
16
+ *
17
+ * Shown: every request still to sign in, and each one that connected while
18
+ * this page was open ("Connected as …"). A request that was connected before
19
+ * the page loaded is history and stays hidden.
20
+ */
21
+ import { connectionSignInSteps, listSessionConnectRequests, } from '@kortix/sdk';
22
+ import { CheckIcon, PlugsConnectedIcon } from '@phosphor-icons/react';
23
+ import { useQuery } from '@tanstack/react-query';
24
+ import { useEffect, useRef, useState } from 'react';
25
+ import { useTranslations } from '../../i18n/index.js';
26
+ import { cn } from '../../lib/utils.js';
27
+ import { runConnectLinkFlow } from '../../internal/hooks/connectors/use-connect-link.js';
28
+ import { ConnectorAppMark } from '../../markdown/setup-links/connector-handshake.js';
29
+ import { Button } from '../../primitives/button.js';
30
+ import Loading from '../../primitives/loading.js';
31
+ import { errorToast } from '../../primitives/toast.js';
32
+ /** While the agent runs, a new request can land at any moment. */
33
+ const BUSY_POLL_MS = 8_000;
34
+ /** A card whose sign-in the person may finish in another tab. */
35
+ const PENDING_POLL_MS = 10_000;
36
+ /** Stable id of one request: its account row, or the connector on an older server. */
37
+ export function sessionConnectRequestKey(request) {
38
+ return request.connection_id ?? request.slug;
39
+ }
40
+ /**
41
+ * The requests on screen: every pending one, plus those that connected after
42
+ * `seenPending` first saw them pending. Pure; exported for tests.
43
+ */
44
+ export function sessionConnectRequestsOnScreen(requests, seenPending) {
45
+ return requests.filter((request) => !request.connected || seenPending.has(sessionConnectRequestKey(request)));
46
+ }
47
+ export function SessionConnectPrompt({ projectId, sessionId, busy, onDockedChange, }) {
48
+ const seenPending = useRef(new Set());
49
+ const query = useQuery({
50
+ queryKey: ['session-connect-requests', projectId, sessionId],
51
+ queryFn: () => listSessionConnectRequests(projectId, sessionId),
52
+ enabled: Boolean(projectId && sessionId),
53
+ staleTime: 2_000,
54
+ retry: false,
55
+ refetchOnWindowFocus: true,
56
+ refetchInterval: (state) => busy
57
+ ? BUSY_POLL_MS
58
+ : (state.state.data ?? []).some((request) => !request.connected)
59
+ ? PENDING_POLL_MS
60
+ : false,
61
+ });
62
+ const { refetch } = query;
63
+ // The agent stops right after it starts a sign-in: read once more then.
64
+ const wasBusy = useRef(busy);
65
+ useEffect(() => {
66
+ if (wasBusy.current && !busy)
67
+ void refetch();
68
+ wasBusy.current = busy;
69
+ }, [busy, refetch]);
70
+ const requests = query.data ?? [];
71
+ for (const request of requests) {
72
+ if (!request.connected)
73
+ seenPending.current.add(sessionConnectRequestKey(request));
74
+ }
75
+ const shown = sessionConnectRequestsOnScreen(requests, seenPending.current);
76
+ const docked = shown.length > 0;
77
+ useEffect(() => {
78
+ onDockedChange?.(docked);
79
+ }, [docked, onDockedChange]);
80
+ useEffect(() => () => onDockedChange?.(false), [onDockedChange]);
81
+ if (!docked)
82
+ return null;
83
+ return (_jsx(SessionConnectNotice, { requests: shown, projectId: projectId, onSettled: () => void refetch() }));
84
+ }
85
+ /** The card itself: one row per request. */
86
+ export function SessionConnectNotice({ requests, projectId, onSettled, }) {
87
+ const t = useTranslations('connectSignIn');
88
+ const allConnected = requests.every((request) => request.connected);
89
+ return (
90
+ // `w-full`, or the composer's `items-center` strip shrinks this to its content width.
91
+ _jsxs("div", { className: "relative isolate z-10 w-full", "data-testid": "session-connect-prompt", children: [_jsxs("div", { className: "text-muted-foreground flex min-h-6 items-center gap-1.5 px-3 py-1 text-xs", children: [_jsx(PlugsConnectedIcon, { className: cn('size-3.5 shrink-0', allConnected ? 'text-kortix-green' : 'text-kortix-orange') }), _jsx("span", { className: "min-w-0 truncate", children: allConnected ? t('signInFinished') : t('cardHeadline') })] }), _jsx("ul", { className: "flex flex-col gap-1 px-3 pt-0.5 pb-2.5", children: requests.map((request) => (_jsx(SessionConnectRow, { request: request, projectId: projectId, onSettled: onSettled }, sessionConnectRequestKey(request)))) })] }));
92
+ }
93
+ function SessionConnectRow({ request, projectId, onSettled, }) {
94
+ const t = useTranslations('connectSignIn');
95
+ const [phase, setPhase] = useState('idle');
96
+ const name = request.name?.trim() || request.app || request.slug;
97
+ const shared = request.owner_type === 'project';
98
+ const connect = async () => {
99
+ if (!request.connection_id)
100
+ return;
101
+ setPhase('waiting');
102
+ try {
103
+ const steps = connectionSignInSteps(projectId, request.slug, {
104
+ connection_id: request.connection_id,
105
+ owner_type: request.owner_type ?? 'member',
106
+ });
107
+ await runConnectLinkFlow(steps.start, steps.finalize);
108
+ }
109
+ catch (error) {
110
+ errorToast(error instanceof Error && error.message ? error.message : t('cardFailed', { app: name }));
111
+ }
112
+ finally {
113
+ setPhase('idle');
114
+ onSettled();
115
+ }
116
+ };
117
+ return (_jsxs("li", { className: "border-border flex min-w-0 items-center gap-3 rounded-sm border px-3 py-2", "data-testid": "session-connect-row", "data-connected": request.connected || undefined, children: [_jsx(ConnectorAppMark, { name: name, slug: request.slug, iconUrl: `https://logos.composio.dev/api/${encodeURIComponent(request.app || request.slug)}`, size: "md" }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "text-foreground truncate text-sm font-medium", children: t('cardTitle', { app: name }) }), _jsx("p", { className: "text-muted-foreground truncate text-xs", children: request.connected
118
+ ? request.connected_as
119
+ ? t('connectedAs', { account: request.connected_as })
120
+ : t('connected')
121
+ : phase === 'waiting'
122
+ ? t('signingIn', { app: name })
123
+ : shared
124
+ ? t('cardShared')
125
+ : t('cardPrivate') })] }), request.connected ? (_jsx(CheckIcon, { weight: "bold", className: "text-kortix-green size-4 shrink-0", "aria-label": t('connected') })) : (_jsxs(Button, { type: "button", size: "sm", className: "shrink-0", disabled: phase === 'waiting' || !request.connection_id, onClick: () => void connect(), children: [phase === 'waiting' ? _jsx(Loading, { className: "size-4 shrink-0" }) : null, t('connect')] }))] }));
126
+ }
@@ -1,6 +1,6 @@
1
1
  import { type GatewayErrorDetails } from '@kortix/sdk';
2
2
  import { type KortixSendError } from '@kortix/sdk/react';
3
- type TurnErrorGatewayDetails = Pick<GatewayErrorDetails, 'provider' | 'code' | 'suggestion' | 'requestId' | 'attemptFailures' | 'requestedModel' | 'resolvedModel'>;
3
+ type TurnErrorGatewayDetails = Pick<GatewayErrorDetails, 'provider' | 'code' | 'suggestion' | 'requestId' | 'attemptFailures' | 'requestedModel' | 'resolvedModel' | 'upstreamStatus'>;
4
4
  /**
5
5
  * Which row a plain-text turn error renders, and whether it opens. The one
6
6
  * decision `TurnErrorDisplay` makes for `errorText`, exported so the debug page
@@ -7,6 +7,8 @@ import { chatGptConnectionAction } from '../models/chatgpt-connection-action.js'
7
7
  import { ChatGptConnectionSlot } from '../models/chatgpt-connection-button.js';
8
8
  import { ClaudeConnectionSlot, claudeConnectionAction } from '../models/claude-connection-slot.js';
9
9
  import { AskOwnerForCreditsButton } from '../models/ask-owner-for-credits-button.js';
10
+ import { providerKeyFix } from '../models/provider-key-action.js';
11
+ import { ProviderKeySlot } from '../models/provider-key-slot.js';
10
12
  import { Button } from '../../primitives/button.js';
11
13
  import { ChainOfThoughtStep } from '../../primitives/chain-of-thought.js';
12
14
  import { DisclosureContent, DisclosureTrigger } from '../../primitives/disclosure.js';
@@ -162,7 +164,7 @@ function GatewayAttemptFailureList({ details }) {
162
164
  * a billing card through `error.kind`; that path is not described here.)
163
165
  */
164
166
  export function describeTurnErrorRow({ text, gateway, raw, }) {
165
- if (isInsufficientCreditsError(text) || isUsageLimitError(text)) {
167
+ if (!providerKeyFix(gateway) && (isInsufficientCreditsError(text) || isUsageLimitError(text))) {
166
168
  return { kind: 'billing-card', expandable: false };
167
169
  }
168
170
  const hasMeta = Boolean(gateway?.provider || gateway?.code || gateway?.requestId);
@@ -252,14 +254,19 @@ export function TurnErrorDisplay({ errorText, errorDetails, errorRaw, defaultDet
252
254
  }
253
255
  return _jsx(InsufficientCreditsCard, { errorText: text, className: className });
254
256
  }
257
+ // A provider key the person fixes in Models (none, refused, expired, or a
258
+ // provider account with no funds). Decided before the credits sniff: an
259
+ // OpenRouter "Insufficient credits" is the provider's account, not Kortix
260
+ // credits, and the Kortix top-up card would not fix it.
261
+ const providerFix = providerKeyFix(gateway);
255
262
  // Insufficient credits → actionable card with buy/auto-topup buttons.
256
263
  // Also covers turn-level errors passed as plain `errorText`, which never
257
264
  // go through `classifySendError`.
258
- if (isInsufficientCreditsError(text)) {
265
+ if (!providerFix && isInsufficientCreditsError(text)) {
259
266
  return _jsx(InsufficientCreditsCard, { errorText: text, className: className });
260
267
  }
261
268
  // Free-tier / subscription / budget limit → actionable upgrade card
262
- if (isUsageLimitError(text)) {
269
+ if (!providerFix && isUsageLimitError(text)) {
263
270
  return _jsx(UsageLimitCard, { errorText: text, className: className });
264
271
  }
265
272
  // A member's own ChatGPT login expired or is missing: the fix is theirs to
@@ -268,7 +275,8 @@ export function TurnErrorDisplay({ errorText, errorDetails, errorRaw, defaultDet
268
275
  // The same for the member's own Claude subscription (Claude models run on it).
269
276
  const claude = chatGpt ? null : claudeConnectionAction(text);
270
277
  // Real errors → a checkpoint row in the activity lane, not a boxed alert.
271
- return (_jsx(TurnErrorCheckpoint, { text: text, gateway: gateway, raw: errorRaw, defaultOpen: defaultDetailsOpen, action: chatGpt ? _jsx(ChatGptConnectionSlot, { action: chatGpt }) : claude ? _jsx(ClaudeConnectionSlot, { action: claude }) : undefined, modelOptions: modelOptions, className: className }));
278
+ return (_jsx(TurnErrorCheckpoint, { text: text, gateway: gateway, raw: errorRaw, defaultOpen: defaultDetailsOpen, action: chatGpt ? _jsx(ChatGptConnectionSlot, { action: chatGpt }) : claude ? _jsx(ClaudeConnectionSlot, { action: claude })
279
+ : providerFix ? _jsx(ProviderKeySlot, { providerId: providerFix.providerId }) : undefined, modelOptions: modelOptions, className: className }));
272
280
  }
273
281
  export function SessionRetryDisplay({ message, attempt, secondsLeft, details, className, }) {
274
282
  if (!message)
@@ -5,6 +5,7 @@ import { uiRoutes } from '../../lib/routes.js';
5
5
  import { isQuestionTool } from '@kortix/sdk';
6
6
  import { SessionAccessPrompt } from '../prompts/session-access-prompt.js';
7
7
  import { SessionApprovalPrompt } from '../prompts/session-approval-prompt.js';
8
+ import { SessionConnectPrompt } from '../prompts/session-connect-prompt.js';
8
9
  import { childSessionHref } from '../tool/tools/session-spawn-urls.js';
9
10
  import { SessionPermissionPrompt } from '../prompts/session-permission-prompt.js';
10
11
  import { useSessionWallpaperLayer } from '../panel/session-wallpaper-layer.js';
@@ -1496,6 +1497,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
1496
1497
  const [approvalDocked, setApprovalDocked] = useState(false);
1497
1498
  // My Kortix asking to give a colleague access docks the same way.
1498
1499
  const [accessDocked, setAccessDocked] = useState(false);
1500
+ // A connector sign-in the agent started docks the same way (`SessionConnectPrompt`).
1501
+ const [connectDocked, setConnectDocked] = useState(false);
1499
1502
  const questionPromptTimerRef = useRef(null);
1500
1503
  useEffect(() => {
1501
1504
  const nextQuestion = activePendingQuestion;
@@ -3039,7 +3042,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3039
3042
  // real consumed-signal is the `@`/`/` menu having been open at capture
3040
3043
  // time. shouldCountEscape (esc-to-stop.ts) owns the decision.
3041
3044
  const active = document.activeElement;
3042
- const focusInOverlay = active?.closest('[role="dialog"],[role="alertdialog"],[role="menu"],[data-radix-popper-content-wrapper]') != null;
3045
+ const focusInOverlay = active?.closest('[role="dialog"],[role="alertdialog"],[role="menu"],[data-kortix-floating]') != null;
3043
3046
  const fromComposerEditor = e.target instanceof Element && e.target.closest(COMPOSER_EDITOR_SELECTOR) !== null;
3044
3047
  if (!shouldCountEscape({
3045
3048
  fromComposerEditor,
@@ -3458,11 +3461,13 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3458
3461
  effectiveBusy,
3459
3462
  canStop,
3460
3463
  ]);
3461
- const chatInputSlot = useMemo(() => (_jsxs(_Fragment, { children: [_jsx(SessionApprovalPrompt, { onDockedChange: setApprovalDocked }), _jsx(SessionAccessPrompt, { projectId: projectId ?? '', asks: accessAsks, onDockedChange: setAccessDocked }), _jsx(SessionPermissionPrompt, { sessionId: sessionId, agentName: sessionScopeAgentName, permissions: pendingPermissions, onReply: handlePermissionReply }), renderedQuestion ? (_jsx("div", { className: cn('w-full overflow-hidden transition-[max-height,opacity,transform] ease-in-out', questionPromptVisible
3464
+ const chatInputSlot = useMemo(() => (_jsxs(_Fragment, { children: [_jsx(SessionApprovalPrompt, { onDockedChange: setApprovalDocked }), _jsx(SessionAccessPrompt, { projectId: projectId ?? '', asks: accessAsks, onDockedChange: setAccessDocked }), projectId && projectSessionId ? (_jsx(SessionConnectPrompt, { projectId: projectId, sessionId: projectSessionId, busy: effectiveBusy, onDockedChange: setConnectDocked })) : null, _jsx(SessionPermissionPrompt, { sessionId: sessionId, agentName: sessionScopeAgentName, permissions: pendingPermissions, onReply: handlePermissionReply }), renderedQuestion ? (_jsx("div", { className: cn('w-full overflow-hidden transition-[max-height,opacity,transform] ease-in-out', questionPromptVisible
3462
3465
  ? 'duration-slow max-h-130 translate-y-0 opacity-100'
3463
3466
  : 'duration-slow pointer-events-none max-h-0 -translate-y-1 opacity-0'), children: _jsx(QuestionPrompt, { ref: questionPromptRef, request: renderedQuestion, onReply: handleQuestionReply, onReject: handleQuestionReject, onActionChange: handleQuestionActionChange }, renderedQuestion.id) })) : null] })), [
3464
3467
  projectId,
3465
3468
  accessAsks,
3469
+ effectiveBusy,
3470
+ projectSessionId,
3466
3471
  sessionId,
3467
3472
  sessionScopeAgentName,
3468
3473
  pendingPermissions,
@@ -3723,7 +3728,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3723
3728
  }
3724
3729
  return (
3725
3730
  // A read-only view (the sub-session modal) offers no fix inside a tool card.
3726
- _jsx(ReadOnlySessionContext.Provider, { value: !!readOnly, children: _jsx(AgentActivateContext.Provider, { value: agentActivate, children: _jsx(SessionPromptContext.Provider, { value: readOnly ? null : sendSessionPrompt, children: _jsx(ProjectFilesProvider, { value: { projectId: projectId ?? '', ref: outcomesBaseRef, defaultBranch: outcomesBaseRef }, children: _jsxs(ComposerDropZone, { className: cn('relative flex h-full flex-col',
3731
+ _jsx(ReadOnlySessionContext.Provider, { value: !!readOnly, children: _jsx(AgentActivateContext.Provider, { value: agentActivate, children: _jsx(SessionPromptContext.Provider, { value: readOnly ? null : sendSessionPrompt, children: _jsx(ProjectFilesProvider, { value: { projectId: projectId ?? '', ref: outcomesBaseRef, defaultBranch: outcomesBaseRef }, children: _jsxs(ComposerDropZone, { className: cn('relative flex h-full flex-col', 'pb-[env(safe-area-inset-bottom)]', // audit:allow device safe-area inset, not a spacing step — the composer column lifts above the home indicator in the installed PWA; desktop reports a 0px inset
3727
3732
  // Transparent in the welcome state so the root-level full-bleed wallpaper
3728
3733
  // (portaled into SessionLayout) reads through; solid once real content
3729
3734
  // takes over. Same base color either way, so non-welcome is unchanged.
@@ -3999,7 +4004,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
3999
4004
  // Same dead-prompt guard as questions: only lock while the agent is
4000
4005
  // actually paused on the decision (isBusy), so a stale card can't
4001
4006
  // swallow the composer on an idle session.
4002
- lockForApproval: runtimePermissionLocksComposer(livePermissions.length, isBusy), onCustomAnswer: handleCustomAnswer, questionButtonLabel: renderedQuestion ? questionAction.label : null, questionActive: !!renderedQuestion || approvalDocked || accessDocked, questionCanAct: questionAction.canAct, onQuestionAction: handleQuestionAction, aboveSlot: chatAboveSlot, inputSlot: chatInputSlot, toolbarSlot: chatToolbarSlot, underbarSlot: chatUnderbarSlot,
4007
+ lockForApproval: runtimePermissionLocksComposer(livePermissions.length, isBusy), onCustomAnswer: handleCustomAnswer, questionButtonLabel: renderedQuestion ? questionAction.label : null, questionActive: !!renderedQuestion || approvalDocked || accessDocked || connectDocked, questionCanAct: questionAction.canAct, onQuestionAction: handleQuestionAction, aboveSlot: chatAboveSlot, inputSlot: chatInputSlot, toolbarSlot: chatToolbarSlot, underbarSlot: chatUnderbarSlot,
4003
4008
  // The shell can now render on a cached transcript alone, i.e. before
4004
4009
  // the sandbox answers — so sending has to be gated separately from
4005
4010
  // reading. See sessionComposerReadiness.
@@ -71,7 +71,7 @@ export function CopyAllButton({ value, copyLabel, copiedLabel, }) {
71
71
  // ============================================================================
72
72
  // Raw message accordion item
73
73
  // ============================================================================
74
- /** Stringifies only while its accordion item is open — Radix unmounts closed content. */
74
+ /** Stringifies only while its accordion item is open — the accordion unmounts closed content. */
75
75
  function RawMessageJson({ value }) {
76
76
  const json = useMemo(() => JSON.stringify(value, null, 2), [value]);
77
77
  return (_jsxs("div", { className: "relative", children: [_jsx("pre", { className: "bg-muted/40 max-h-[400px] overflow-x-auto overflow-y-auto rounded-md p-3 font-mono text-xs break-all whitespace-pre-wrap select-text", children: json }), _jsx("div", { className: "absolute top-2 right-2", children: _jsx(CopyButton, { code: json, size: "sm" }) })] }));
@@ -1039,12 +1039,12 @@ function TurnSessionReport({ report }) {
1039
1039
  /** The user side of a turn: the report card, the system-pill line, and the
1040
1040
  * user bubble (hidden for notification-only turns). */
1041
1041
  function TurnUserBlock(props) {
1042
- const { userContent } = props;
1042
+ const { userContent, noticeInWork } = props;
1043
1043
  const { sessionReport, noticeBatch, subagentNotice, peerMessage, parkedAnswer, systemMessages, hasVisibleUserContent } = userContent;
1044
1044
  // P5.6: the note a partial restore left for the agent is a notice, not a person's prompt.
1045
1045
  if (isSessionLogRestoreNote(props.turn.user))
1046
1046
  return _jsx(RestoreNoteMarker, {});
1047
- return (_jsxs(_Fragment, { children: [noticeBatch ? (_jsx(NoticeBatchGroup, { items: noticeBatch })) : subagentNotice ? (_jsx(SubagentNoticeRow, { notice: subagentNotice })) : peerMessage ? (_jsx(PeerMessageRow, { info: peerMessage })) : parkedAnswer ? (_jsx(ParkedAnswerRow, { answer: parkedAnswer })) : (sessionReport && _jsx(TurnSessionReport, { report: sessionReport })), !hasVisibleUserContent && !sessionReport && !noticeBatch && !peerMessage && !parkedAnswer && systemMessages.length > 0 && (_jsx(SystemMessageIndicator, { messages: systemMessages })), hasVisibleUserContent && _jsx(TurnUserBubble, { ...props })] }));
1047
+ return (_jsxs(_Fragment, { children: [!noticeInWork && (noticeBatch ? (_jsx(NoticeBatchGroup, { items: noticeBatch })) : subagentNotice ? (_jsx(SubagentNoticeRow, { notice: subagentNotice })) : peerMessage ? (_jsx(PeerMessageRow, { info: peerMessage })) : parkedAnswer ? (_jsx(ParkedAnswerRow, { answer: parkedAnswer })) : (sessionReport && _jsx(TurnSessionReport, { report: sessionReport }))), !hasVisibleUserContent && !sessionReport && !noticeBatch && !peerMessage && !parkedAnswer && systemMessages.length > 0 && (_jsx(SystemMessageIndicator, { messages: systemMessages })), hasVisibleUserContent && _jsx(TurnUserBubble, { ...props })] }));
1048
1048
  }
1049
1049
  /** The user message bubble — dimmed while the prompt waits in the queue. */
1050
1050
  function TurnUserBubble(props) {
@@ -1065,13 +1065,21 @@ const NO_RECOVERED_CALLS = new Set();
1065
1065
  /** The assistant's part tree: bursts, standalone deliverables, and prose
1066
1066
  * between them, under one live-context provider. */
1067
1067
  function TurnToolBlocks(props) {
1068
- const { turn, sessionId, permissions, onPermissionReply, disableToolNavigation, model, segments, conversationDensity, fold, durationMs, } = props;
1068
+ const { turn, sessionId, permissions, onPermissionReply, disableToolNavigation, model, segments, conversationDensity, fold, durationMs, workNotice, } = props;
1069
1069
  const { working, hasSteps, hasReasoning } = model;
1070
1070
  // Every settled turn folds, live or reloaded (the T3 Code rule): one turn
1071
1071
  // reads one way. A turn the reader touched while it worked (opened or closed
1072
1072
  // a row) settles with its "Worked for" row open, so nothing they were
1073
1073
  // reading disappears under them.
1074
1074
  const split = useMemo(() => (fold && !working ? splitSessionLogTurnWork(segments.filter(segmentRendersSomething), { working }) : null), [fold, segments, working]);
1075
+ // A settled turn whose prompt is another agent's notice folds the notice
1076
+ // row into this work fold with the work it led to (KRTX-4732): the parent's
1077
+ // answer below is the only top-level message, and the row stays reachable
1078
+ // by opening the row. A turn with no work of its own still gets the fold,
1079
+ // so the exchange never becomes unreachable. In the inline mode (text plus
1080
+ // an answered question, no fold row) the row renders visible above the
1081
+ // answer instead — the gate below keeps the block mounted for it.
1082
+ const noticeFold = !!workNotice && fold && !working;
1075
1083
  const workSegments = useMemo(() => new Set(split?.work ?? []), [split]);
1076
1084
  const touchedLive = useRef(false);
1077
1085
  const markTouched = useCallback(() => {
@@ -1120,13 +1128,13 @@ function TurnToolBlocks(props) {
1120
1128
  return null;
1121
1129
  return (_jsx(TurnSegment, { segment: segment, isTrailing: segment === segments[segments.length - 1], working: working, openText: model.openText, hasSteps: hasSteps, sessionId: sessionId, permissions: permissions, onPermissionReply: onPermissionReply, disableNavigation: disableToolNavigation, conversationDensity: conversationDensity }, key));
1122
1130
  };
1123
- return (_jsx(_Fragment, { children: (working || hasSteps || hasReasoning) && turn.assistant.length > 0 && (
1131
+ return (_jsx(_Fragment, { children: (working || hasSteps || hasReasoning || noticeFold || !!workNotice) && (turn.assistant.length > 0 || !!workNotice) && (
1124
1132
  // Every tool row below — the bursts' rows and the standalone ones —
1125
1133
  // reads this to tell a call that has not spoken YET from one that never
1126
1134
  // will. Provided here rather than per-row because `working` is a fact
1127
1135
  // about the TURN, and this block is the turn's whole part tree.
1128
1136
  // See `TurnLiveContext`.
1129
- _jsx(TurnLiveContext.Provider, { value: working, children: _jsx(RecoveredCallsContext.Provider, { value: recovered, children: _jsx(ImageGenPathsContext.Provider, { value: imageGenPaths, children: _jsx(ImageGenDigestsContext.Provider, { value: imageGenDigests, children: _jsx(ImageGenRunsContext.Provider, { value: imageGenRuns, children: _jsx(InTranscriptTurnContext.Provider, { value: true, children: _jsx(WorkTouchContext.Provider, { value: markTouched, children: _jsxs("div", { className: "flex flex-col gap-3", onClickCapture: onClickCapture, children: [split && (_jsx(TurnWorkAccordion, { durationMs: durationMs, open: workOpen, onToggle: toggleWork, contentId: workContentId }, "turn-work")), segments.map((segment) => {
1137
+ _jsx(TurnLiveContext.Provider, { value: working, children: _jsx(RecoveredCallsContext.Provider, { value: recovered, children: _jsx(ImageGenPathsContext.Provider, { value: imageGenPaths, children: _jsx(ImageGenDigestsContext.Provider, { value: imageGenDigests, children: _jsx(ImageGenRunsContext.Provider, { value: imageGenRuns, children: _jsx(InTranscriptTurnContext.Provider, { value: true, children: _jsx(WorkTouchContext.Provider, { value: markTouched, children: _jsxs("div", { className: "flex flex-col gap-3", onClickCapture: onClickCapture, children: [(split || noticeFold) && (_jsx(TurnWorkAccordion, { durationMs: durationMs, open: workOpen, onToggle: toggleWork, contentId: workContentId }, "turn-work")), workNotice && (!noticeFold || workMounted) && (_jsx("div", { id: workContentId, hidden: !!(split || noticeFold) && !workOpen, className: "min-w-0", children: _jsx(WorkFoldContext.Provider, { value: !working, children: workNotice }) }, "turn-notice")), segments.map((segment) => {
1130
1138
  const isWork = workSegments.has(segment);
1131
1139
  if (isWork && !workMounted)
1132
1140
  return null;
@@ -1134,7 +1142,7 @@ function TurnToolBlocks(props) {
1134
1142
  if (!node)
1135
1143
  return null;
1136
1144
  const hidden = isWork && !workOpen;
1137
- return (_jsx("div", { id: isWork && segment === split?.work[0] ? workContentId : undefined, hidden: hidden, className: "min-w-0", children: _jsx(WorkFoldContext.Provider, { value: isWork, children: node }) }, node.key));
1145
+ return (_jsx("div", { id: !workNotice && isWork && segment === split?.work[0] ? workContentId : undefined, hidden: hidden, className: "min-w-0", children: _jsx(WorkFoldContext.Provider, { value: isWork, children: node }) }, node.key));
1138
1146
  })] }) }) }) }) }) }) }) })) }));
1139
1147
  }
1140
1148
  /** One segment of the turn's steps section: a burst, a show group, a
@@ -1427,6 +1435,22 @@ function SessionTurnImpl(props) {
1427
1435
  const errors = useTurnErrorState({ turn, turnOutcome });
1428
1436
  const answered = useAnsweredQuestionState({ turn, questions, sessionId, blocks: model.blocks, hasSteps: model.hasSteps });
1429
1437
  const userContent = useTurnUserContent({ turn, commandMessages, commands });
1438
+ // A turn whose prompt is another agent's notice (a sub-agent's report, a
1439
+ // teammate's update) folds that row into its work fold (KRTX-4732): the
1440
+ // parent's answer is the only top-level message. A settled turn with no
1441
+ // answer at all keeps the row at the top level, where it stays reachable;
1442
+ // the main transcript only — space threads hide notices already.
1443
+ const workNotice = rows
1444
+ ? undefined
1445
+ : isAgentNoticeTurn(turn) && (model.working || turn.assistant.length > 0)
1446
+ ? userContent.noticeBatch
1447
+ ? _jsx(NoticeBatchGroup, { items: userContent.noticeBatch })
1448
+ : userContent.subagentNotice
1449
+ ? _jsx(SubagentNoticeRow, { notice: userContent.subagentNotice })
1450
+ : userContent.peerMessage
1451
+ ? _jsx(PeerMessageRow, { info: userContent.peerMessage })
1452
+ : undefined
1453
+ : undefined;
1430
1454
  const status = useTurnLiveStatus({ turn, blocks: model.blocks, agentWorking: model.agentWorking });
1431
1455
  const retry = useTurnRetryState({ sessionStatus, isWorkingTurn });
1432
1456
  const meta = useTurnSettledMeta({ working: model.working, turn });
@@ -1529,7 +1553,7 @@ function SessionTurnImpl(props) {
1529
1553
  // The segments are already the message's: nothing is left to fold.
1530
1554
  fold: !messagesOnly && !answered.shouldUseInlineContent, durationMs: meta.turnDurationMs })), _jsx(TurnAssistantBlock, { ...props, model: model, answered: answered, userContent: userContent, tHardcodedUi: tHardcodedUi })] }), messagesOnly && !model.working && errors.turnErrorIsAbort && model.response.trim() === '' && shownSegments.length === 0 ? (_jsx("p", { className: "text-muted-foreground text-sm", children: tTurnRows('stopped') })) : null, _jsx(TurnFooter, { ...props, hideActionBar: true, quietBusy: messagesOnly, model: model, errors: errors, answered: answered, status: status, retry: retry, meta: meta, tHardcodedUi: tHardcodedUi, connectProviderOpen: connectProviderOpen, onConnectProviderOpenChange: setConnectProviderOpen }), messagesOnly && !model.working ? (_jsx(TurnMessageWork, { ...props, model: model, segments: segments, shown: shownSegments, userContent: userContent, conversationDensity: conversationDensity, front: rows.front === true })) : null] }) })) : null] }));
1531
1555
  }
1532
- return (_jsxs("div", { className: "group/turn text-factor-[2] space-y-2.5", children: [_jsx(TurnUserBlock, { ...props, model: model, queueTone: queueTone, userContent: userContent }), props.isFirstTurn ? afterFirstPrompt : null, _jsx(TurnFallbackRows, { working: model.working, events: props.servedModel?.fallbacks }), _jsxs(GenuiTelemetryContext.Provider, { value: genuiTelemetry, children: [_jsx(TurnToolBlocks, { ...props, model: model, segments: segments, conversationDensity: conversationDensity, fold: !answered.shouldUseInlineContent, durationMs: meta.turnDurationMs }), _jsx(TurnAssistantBlock, { ...props, model: model, answered: answered, userContent: userContent, tHardcodedUi: tHardcodedUi })] }), _jsx(TurnFooter, { ...props, model: model, errors: errors, answered: answered, status: status, retry: retry, meta: meta, tHardcodedUi: tHardcodedUi, connectProviderOpen: connectProviderOpen, onConnectProviderOpenChange: setConnectProviderOpen })] }));
1556
+ return (_jsxs("div", { className: "group/turn text-factor-[2] space-y-2.5", children: [_jsx(TurnUserBlock, { ...props, model: model, queueTone: queueTone, userContent: userContent, noticeInWork: !!workNotice }), props.isFirstTurn ? afterFirstPrompt : null, _jsx(TurnFallbackRows, { working: model.working, events: props.servedModel?.fallbacks }), _jsxs(GenuiTelemetryContext.Provider, { value: genuiTelemetry, children: [_jsx(TurnToolBlocks, { ...props, model: model, segments: segments, conversationDensity: conversationDensity, fold: !answered.shouldUseInlineContent, durationMs: meta.turnDurationMs, workNotice: workNotice }), _jsx(TurnAssistantBlock, { ...props, model: model, answered: answered, userContent: userContent, tHardcodedUi: tHardcodedUi })] }), _jsx(TurnFooter, { ...props, model: model, errors: errors, answered: answered, status: status, retry: retry, meta: meta, tHardcodedUi: tHardcodedUi, connectProviderOpen: connectProviderOpen, onConnectProviderOpenChange: setConnectProviderOpen })] }));
1533
1557
  }
1534
1558
  /**
1535
1559
  * The boundary that stops the transcript re-rendering with the stream.