@kortix/ui 0.16.3 → 0.16.5

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 (156) hide show
  1. package/dist/_vendor/kortix-shared.js +1 -4
  2. package/dist/customize/sections/view/review-center-connected.js +64 -71
  3. package/dist/customize/sections/view/secret-delivery.d.ts +11 -20
  4. package/dist/customize/sections/view/secret-delivery.js +20 -29
  5. package/dist/customize/sections/view/secrets-view.js +9 -24
  6. package/dist/customize/settings/rail-copy-context.d.ts +2 -0
  7. package/dist/customize/settings/rail-copy-context.js +2 -0
  8. package/dist/customize/settings/tabs/chrome-connections-tab.js +1 -1
  9. package/dist/files/renderers/show-content-renderer.js +3 -1
  10. package/dist/i18n/en.d.ts +130 -22
  11. package/dist/i18n/en.js +142 -34
  12. package/dist/i18n/ui-catalog/product-catalog-translation-keys.generated.js +2 -0
  13. package/dist/internal/auth/auth-card-shell.d.ts +24 -3
  14. package/dist/internal/auth/auth-card-shell.js +15 -8
  15. package/dist/internal/auth/auth-primitives.d.ts +15 -2
  16. package/dist/internal/auth/auth-primitives.js +22 -5
  17. package/dist/internal/chrome/chrome-connect.d.ts +3 -5
  18. package/dist/internal/chrome/chrome-connect.js +7 -10
  19. package/dist/internal/chrome/extension.d.ts +1 -8
  20. package/dist/internal/chrome/extension.js +1 -8
  21. package/dist/internal/chrome/use-chrome-offered.d.ts +6 -12
  22. package/dist/internal/chrome/use-chrome-offered.js +13 -15
  23. package/dist/internal/components/agent-mark.d.ts +2 -1
  24. package/dist/internal/components/agent-mark.js +14 -3
  25. package/dist/internal/hooks/use-review-session-summary.d.ts +1 -1
  26. package/dist/internal/hooks/use-review-session-summary.js +1 -1
  27. package/dist/internal/layout/project-nav-row.d.ts +3 -1
  28. package/dist/internal/layout/project-nav-row.js +2 -2
  29. package/dist/internal/layout/project-page-header.js +5 -4
  30. package/dist/internal/stores/user-preferences-store.d.ts +17 -0
  31. package/dist/internal/stores/user-preferences-store.js +5 -0
  32. package/dist/markdown/setup-links/secret-intake-form.d.ts +4 -1
  33. package/dist/markdown/setup-links/secret-intake-form.js +60 -16
  34. package/dist/markdown/setup-links/setup-link-button.js +6 -1
  35. package/dist/primitives/color-picker.d.ts +19 -0
  36. package/dist/primitives/color-picker.js +27 -0
  37. package/dist/primitives/faded-scroll-area.js +4 -0
  38. package/dist/primitives/glyph-picker.d.ts +11 -0
  39. package/dist/primitives/glyph-picker.js +10 -6
  40. package/dist/primitives/gradient-wallpaper-gl.d.ts +61 -0
  41. package/dist/primitives/gradient-wallpaper-gl.js +446 -0
  42. package/dist/primitives/gradient-wallpaper.d.ts +20 -0
  43. package/dist/primitives/gradient-wallpaper.js +242 -0
  44. package/dist/primitives/resizable.d.ts +1 -1
  45. package/dist/session/agents/agent-hover-card.d.ts +26 -0
  46. package/dist/session/agents/agent-hover-card.js +70 -0
  47. package/dist/session/agents/agent-strip.js +33 -7
  48. package/dist/session/agents/agent-surface.d.ts +26 -1
  49. package/dist/session/agents/agent-surface.js +57 -6
  50. package/dist/session/agents/held-messages.js +2 -2
  51. package/dist/session/agents/subagent-dialog-content.js +2 -2
  52. package/dist/session/composer/ComposerCard.js +4 -4
  53. package/dist/session/composer/composer-toolbar.d.ts +8 -1
  54. package/dist/session/composer/composer-toolbar.js +2 -2
  55. package/dist/session/composer/dictation/dictation-control.d.ts +10 -0
  56. package/dist/session/composer/dictation/dictation-control.js +28 -0
  57. package/dist/session/composer/dictation/dictation-state.d.ts +26 -0
  58. package/dist/session/composer/dictation/dictation-state.js +71 -0
  59. package/dist/session/composer/dictation/recorder.d.ts +30 -0
  60. package/dist/session/composer/dictation/recorder.js +129 -0
  61. package/dist/session/composer/dictation/use-composer-dictation.d.ts +25 -0
  62. package/dist/session/composer/dictation/use-composer-dictation.js +218 -0
  63. package/dist/session/composer/queued-prompt-list.js +5 -1
  64. package/dist/session/panel/easy/apps-card.js +3 -10
  65. package/dist/session/panel/easy/background-tasks-card.d.ts +23 -0
  66. package/dist/session/panel/easy/background-tasks-card.js +119 -0
  67. package/dist/session/panel/easy/change-requests-card.js +1 -1
  68. package/dist/session/panel/easy/changes-card.js +4 -6
  69. package/dist/session/panel/easy/context-card.js +8 -9
  70. package/dist/session/panel/easy/context-meter.d.ts +2 -0
  71. package/dist/session/panel/easy/context-meter.js +18 -4
  72. package/dist/session/panel/easy/detail-view.js +7 -4
  73. package/dist/session/panel/easy/easy-panel-logic.d.ts +4 -15
  74. package/dist/session/panel/easy/easy-panel-logic.js +4 -17
  75. package/dist/session/panel/easy/easy-panel.js +5 -4
  76. package/dist/session/panel/easy/outputs-card.d.ts +1 -13
  77. package/dist/session/panel/easy/outputs-card.js +14 -40
  78. package/dist/session/panel/easy/panel-card.d.ts +13 -40
  79. package/dist/session/panel/easy/panel-card.js +17 -55
  80. package/dist/session/panel/easy/plan-card.js +4 -7
  81. package/dist/session/panel/model-switch-event.d.ts +2 -2
  82. package/dist/session/panel/model-switch-event.js +13 -9
  83. package/dist/session/panel/session-panel-provider.d.ts +2 -1
  84. package/dist/session/panel/session-panel-provider.js +3 -3
  85. package/dist/session/panel/shared/collect-tool-parts.js +2 -2
  86. package/dist/session/panel/shared/derive-panels.js +14 -1
  87. package/dist/session/panel/shared/use-panel-handoffs.d.ts +0 -1
  88. package/dist/session/panel/shared/use-panel-handoffs.js +26 -17
  89. package/dist/session/thread/chat-minimap.js +7 -1
  90. package/dist/session/thread/session-body.js +1 -1
  91. package/dist/session/thread/session-chat.js +59 -15
  92. package/dist/session/tool/shared/infrastructure-contexts.d.ts +7 -0
  93. package/dist/session/tool/shared/infrastructure-contexts.js +9 -0
  94. package/dist/session/tool/shared/infrastructure-row-header.js +4 -1
  95. package/dist/session/tool/shared/infrastructure-rows.js +19 -19
  96. package/dist/session/tool/show-group-renderer.d.ts +5 -5
  97. package/dist/session/tool/show-group-renderer.js +7 -4
  98. package/dist/session/tool/tool-part-renderer.js +25 -9
  99. package/dist/session/tool/tool-renderers.d.ts +1 -1
  100. package/dist/session/tool/tool-renderers.js +1 -1
  101. package/dist/session/tool/tools/bash-tool.js +3 -2
  102. package/dist/session/tool/tools/codemode-tool.d.ts +15 -0
  103. package/dist/session/tool/tools/codemode-tool.js +54 -2
  104. package/dist/session/tool/tools/kortix-action-tool.d.ts +1 -0
  105. package/dist/session/tool/tools/kortix-action-tool.js +19 -8
  106. package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +8 -1
  107. package/dist/session/tool/tools/multi-agent-tool-bodies.js +76 -10
  108. package/dist/session/tool/tools/task-tool.js +17 -5
  109. package/dist/session/turn/peer-message-row.d.ts +3 -0
  110. package/dist/session/turn/peer-message-row.js +8 -2
  111. package/dist/session/turn/subagent-notice-row.js +5 -3
  112. package/dist/styles.css +1 -1
  113. package/dist/test-utils/intl.d.ts +130 -22
  114. package/dist/theme/index.d.ts +2 -1
  115. package/dist/theme/index.js +2 -1
  116. package/dist/theme/wallpaper-gradients.d.ts +106 -0
  117. package/dist/theme/wallpaper-gradients.js +347 -0
  118. package/dist/theme/wallpapers.d.ts +23 -3
  119. package/dist/theme/wallpapers.js +53 -29
  120. package/dist/workspace/admin/project-admin-dashboard.js +1 -1
  121. package/dist/workspace/layout/project-home.js +1 -1
  122. package/dist/workspace/new/use-create-workspace.d.ts +5 -3
  123. package/dist/workspace/new/use-create-workspace.js +1 -1
  124. package/dist/workspace/projects/modal/project-icon-field.d.ts +3 -1
  125. package/dist/workspace/projects/modal/project-icon-field.js +3 -3
  126. package/dist/workspace/review/review-center.d.ts +9 -1
  127. package/dist/workspace/review/review-center.js +107 -14
  128. package/dist/workspace/review/review-detail.d.ts +19 -0
  129. package/dist/workspace/review/review-detail.js +18 -3
  130. package/dist/workspace/review/review-swipe-deck.d.ts +27 -0
  131. package/dist/workspace/review/review-swipe-deck.js +304 -0
  132. package/dist/workspace/review/review-swipe.d.ts +17 -0
  133. package/dist/workspace/review/review-swipe.js +10 -0
  134. package/dist/workspace/session-spaces/space-picker.js +3 -3
  135. package/dist/workspace/setup/setup-banner-snooze.d.ts +10 -0
  136. package/dist/workspace/setup/setup-banner-snooze.js +44 -0
  137. package/dist/workspace/setup/setup-banner.js +19 -36
  138. package/dist/workspace/setup/setup-steps.d.ts +0 -5
  139. package/dist/workspace/setup/setup-steps.js +0 -7
  140. package/dist/workspace/setup/workspace-setup-modal.d.ts +39 -0
  141. package/dist/workspace/setup/workspace-setup-modal.js +202 -0
  142. package/dist/workspace/sidebar/footer/project-review-nav.d.ts +13 -0
  143. package/dist/workspace/sidebar/footer/project-review-nav.js +29 -0
  144. package/dist/workspace/sidebar/project-nav-items.d.ts +3 -1
  145. package/dist/workspace/sidebar/project-nav-items.js +24 -5
  146. package/dist/workspace/sidebar/project-session-list.js +2 -1
  147. package/dist/workspace/sidebar/project-sidebar.js +6 -5
  148. package/dist/workspace/sidebar/project-spaces-nav.js +3 -10
  149. package/dist/workspace/sidebar/sidebar-more-group.js +1 -1
  150. package/package.json +14 -10
  151. package/skills/kortix-ui/SKILL.md +1 -1
  152. package/skills/kortix-ui/references/modules.md +3 -1
  153. package/dist/primitives/toast-clearance.d.ts +0 -36
  154. package/dist/primitives/toast-clearance.js +0 -94
  155. package/dist/workspace/setup/workspace-setup-page.d.ts +0 -10
  156. package/dist/workspace/setup/workspace-setup-page.js +0 -91
@@ -0,0 +1,242 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { memo, useEffect, useRef } from 'react';
4
+ import { createGradientRenderer, drawGradientStill, pixelScale, } from './gradient-wallpaper-gl.js';
5
+ import { DEFAULT_WALLPAPER_OPACITY, gradientColors, } from '../theme/wallpaper-gradients.js';
6
+ import { useWallpaperTheme } from './wallpaper-shaders.js';
7
+ /** 30 fps. The motion is a slow drift: a higher rate shows nothing more. */
8
+ const FRAME_MS = 1000 / 30;
9
+ /** Shader time units per second. One sway of a band takes about 80 s. */
10
+ const SPEED = 0.05;
11
+ /** A picker thumbnail's canvas: the composition of a 960×540 page. */
12
+ const STILL_WIDTH = 480;
13
+ const STILL_HEIGHT = 270;
14
+ function drawParams(config, isDark) {
15
+ return {
16
+ pattern: config.pattern,
17
+ finish: config.finish,
18
+ colors: gradientColors(config, isDark),
19
+ calm: config.calm,
20
+ anchor: config.anchor,
21
+ };
22
+ }
23
+ /** Where each pattern keeps its color, for the fallback's one soft glow. */
24
+ const FALLBACK_AT = {
25
+ bloom: '100% 100%',
26
+ beam: '90% 0%',
27
+ sheet: '0% 0%',
28
+ bands: '50% 110%',
29
+ horizon: '50% 100%',
30
+ arc: '50% 100%',
31
+ mesh: '0% 100%',
32
+ clouds: '50% 110%',
33
+ };
34
+ /**
35
+ * What paints when WebGL is unavailable or would run on the CPU: one static
36
+ * glow through the whole palette, core color at the center. No canvas, no
37
+ * frames.
38
+ */
39
+ function fallbackBackground(params) {
40
+ const at = (params.pattern === 'bloom' || params.pattern === 'sheet') && params.anchor
41
+ ? `${params.anchor[0] * 100}% ${params.anchor[1] * 100}%`
42
+ : FALLBACK_AT[params.pattern];
43
+ // The palette runs edge to core, the glow runs core to edge. `59` is 35%
44
+ // alpha on a six-digit hex color. The stops spread over the first 55%.
45
+ const stops = [...params.colors]
46
+ .reverse()
47
+ .map((color, index, all) => `${color}59 ${Math.round((index / all.length) * 55)}%`);
48
+ return `radial-gradient(ellipse 70% 60% at ${at}, ${stops.join(', ')}, transparent 70%)`;
49
+ }
50
+ /**
51
+ * A full-bleed gradient wallpaper on one small WebGL canvas.
52
+ *
53
+ * Nothing here goes through React state per frame. The loop writes one
54
+ * uniform and issues one draw call. It stops while the canvas is off screen,
55
+ * and reduced motion draws a single still frame. See
56
+ * `primitives/gradient-wallpaper-gl.ts` for the frame budget.
57
+ */
58
+ export const GradientWallpaper = memo(function GradientWallpaper({ config, }) {
59
+ const { isDark, reduceMotion } = useWallpaperTheme();
60
+ const hostRef = useRef(null);
61
+ const canvasRef = useRef(null);
62
+ const paramsRef = useRef(drawParams(config, isDark));
63
+ const reduceMotionRef = useRef(reduceMotion);
64
+ /** Set by the mount effect: applies new parameters or a new motion setting. */
65
+ const applyRef = useRef(() => { });
66
+ useEffect(() => {
67
+ paramsRef.current = drawParams(config, isDark);
68
+ reduceMotionRef.current = reduceMotion;
69
+ applyRef.current();
70
+ }, [config, isDark, reduceMotion]);
71
+ // Mount only. The renderer, the observers and the context listeners live
72
+ // as long as the canvas; parameters and the motion setting arrive by ref.
73
+ useEffect(() => {
74
+ const host = hostRef.current;
75
+ const canvas = canvasRef.current;
76
+ if (!host || !canvas)
77
+ return;
78
+ let renderer = createGradientRenderer(canvas);
79
+ let raf = 0;
80
+ let still = 0;
81
+ let lastFrame = 0;
82
+ let deadline = 0;
83
+ let clock = 0;
84
+ let onScreen = true;
85
+ // The canvas is behind what it should show: set while off screen.
86
+ let stale = false;
87
+ const moving = () => !reduceMotionRef.current;
88
+ const paint = () => {
89
+ stale = false;
90
+ if (renderer) {
91
+ host.style.background = '';
92
+ renderer.draw(paramsRef.current, clock * SPEED);
93
+ }
94
+ else {
95
+ host.style.background = fallbackBackground(paramsRef.current);
96
+ }
97
+ };
98
+ // The one way a change outside the loop reaches the canvas. A running
99
+ // loop draws the new parameters on its next frame, inside the 30 fps cap.
100
+ // A still canvas draws once in the next frame, however many changes
101
+ // arrive before it. An off-screen canvas draws nothing until it returns.
102
+ const requestPaint = () => {
103
+ if (raf)
104
+ return;
105
+ if (!onScreen) {
106
+ stale = true;
107
+ return;
108
+ }
109
+ still ||= requestAnimationFrame(() => {
110
+ still = 0;
111
+ // The canvas can leave the screen between the request and the frame.
112
+ if (onScreen)
113
+ paint();
114
+ else
115
+ stale = true;
116
+ });
117
+ };
118
+ const resize = () => {
119
+ const scale = pixelScale(host.clientWidth, host.clientHeight);
120
+ const width = Math.max(1, Math.round(host.clientWidth / scale));
121
+ const height = Math.max(1, Math.round(host.clientHeight / scale));
122
+ // An exact multiple of the canvas size, so every canvas pixel maps to
123
+ // the same number of device pixels and the dither grid stays even.
124
+ canvas.style.width = `${width * scale}px`;
125
+ canvas.style.height = `${height * scale}px`;
126
+ if (canvas.width === width && canvas.height === height)
127
+ return;
128
+ canvas.width = width;
129
+ canvas.height = height;
130
+ // Setting the size clears the canvas: paint before the browser does.
131
+ if (onScreen)
132
+ paint();
133
+ else
134
+ stale = true;
135
+ };
136
+ // Draws on a 33.3 ms deadline that advances by one period per draw, so
137
+ // the rate is 30 fps on any display: 60 Hz draws every second frame, and
138
+ // 100 Hz alternates between every third and every fourth. 2 ms of slack
139
+ // absorbs the jitter in rAF timestamps.
140
+ const frame = (now) => {
141
+ raf = requestAnimationFrame(frame);
142
+ if (now < deadline - 2)
143
+ return;
144
+ // A long gap (a background tab) must not jump the composition.
145
+ if (lastFrame > 0)
146
+ clock += Math.min(now - lastFrame, 100) / 1000;
147
+ lastFrame = now;
148
+ // Keep the cadence. After a start or a stall the next slot is already
149
+ // past: count one full period from now, or the next rAF draws again.
150
+ const next = deadline + FRAME_MS;
151
+ deadline = next > now - 2 ? next : now + FRAME_MS;
152
+ paint();
153
+ };
154
+ // Starts or stops the loop for the current visibility, motion setting
155
+ // and context state.
156
+ const sync = () => {
157
+ cancelAnimationFrame(raf);
158
+ raf = 0;
159
+ lastFrame = 0;
160
+ deadline = 0;
161
+ if (moving() && onScreen && renderer)
162
+ raf = requestAnimationFrame(frame);
163
+ else if (onScreen && stale)
164
+ requestPaint();
165
+ };
166
+ // New parameters keep a running loop and its timestamp: restarting it
167
+ // on every change would let a color drag draw at the display's rate.
168
+ applyRef.current = () => {
169
+ const shouldRun = moving() && onScreen && renderer !== null;
170
+ if (shouldRun !== (raf !== 0))
171
+ sync();
172
+ requestPaint();
173
+ };
174
+ resize();
175
+ paint();
176
+ sync();
177
+ const resizeObserver = new ResizeObserver(resize);
178
+ resizeObserver.observe(host);
179
+ const intersectionObserver = new IntersectionObserver(([entry]) => {
180
+ onScreen = entry?.isIntersecting ?? true;
181
+ sync();
182
+ });
183
+ intersectionObserver.observe(host);
184
+ const onLost = (event) => {
185
+ event.preventDefault();
186
+ renderer = null;
187
+ sync();
188
+ // With no renderer this paints the CSS fallback.
189
+ paint();
190
+ };
191
+ const onRestored = () => {
192
+ renderer = createGradientRenderer(canvas);
193
+ paint();
194
+ sync();
195
+ };
196
+ canvas.addEventListener('webglcontextlost', onLost);
197
+ canvas.addEventListener('webglcontextrestored', onRestored);
198
+ return () => {
199
+ cancelAnimationFrame(raf);
200
+ cancelAnimationFrame(still);
201
+ resizeObserver.disconnect();
202
+ intersectionObserver.disconnect();
203
+ canvas.removeEventListener('webglcontextlost', onLost);
204
+ canvas.removeEventListener('webglcontextrestored', onRestored);
205
+ applyRef.current = () => { };
206
+ renderer?.destroy();
207
+ };
208
+ }, []);
209
+ return (_jsx("div", { ref: hostRef, className: "pointer-events-none absolute inset-0 overflow-hidden", style: { opacity: config.opacity ?? DEFAULT_WALLPAPER_OPACITY }, "aria-hidden": "true", children: _jsx("canvas", { ref: canvasRef, className: "absolute top-0 left-0", style: { imageRendering: config.finish === 'dither' ? 'pixelated' : 'auto' } }) }));
210
+ });
211
+ /**
212
+ * A still of a gradient wallpaper for the settings picker: a 2D canvas that
213
+ * receives one frame from the shared context. Without WebGL it shows the same
214
+ * CSS fallback as the wallpaper.
215
+ */
216
+ export function GradientWallpaperStill({ config }) {
217
+ const { isDark } = useWallpaperTheme();
218
+ const canvasRef = useRef(null);
219
+ // Keyed by what the shader draws, not by object identity: a settings
220
+ // change elsewhere rebuilds every config object, and opacity is CSS.
221
+ const params = drawParams(config, isDark);
222
+ const drawKey = JSON.stringify(params);
223
+ // Drawn in the frame after commit. A color drag changes `config` many
224
+ // times per frame, and only the last change draws.
225
+ useEffect(() => {
226
+ const frame = requestAnimationFrame(() => {
227
+ const canvas = canvasRef.current;
228
+ if (!canvas)
229
+ return;
230
+ const params = JSON.parse(drawKey);
231
+ if (drawGradientStill(params, canvas)) {
232
+ canvas.style.background = '';
233
+ return;
234
+ }
235
+ // Clear the last frame, or it would sit over the fallback.
236
+ canvas.getContext('2d')?.clearRect(0, 0, canvas.width, canvas.height);
237
+ canvas.style.background = fallbackBackground(params);
238
+ });
239
+ return () => cancelAnimationFrame(frame);
240
+ }, [drawKey]);
241
+ return (_jsx("canvas", { ref: canvasRef, width: STILL_WIDTH, height: STILL_HEIGHT, className: "absolute inset-0 h-full w-full object-cover select-none", style: { opacity: config.opacity ?? DEFAULT_WALLPAPER_OPACITY } }));
242
+ }
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import * as ResizablePrimitive from 'react-resizable-panels';
3
3
  declare function ResizablePanelGroup({ className, ...props }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>): React.JSX.Element;
4
- declare const ResizablePanel: React.ForwardRefExoticComponent<Omit<Omit<React.HTMLAttributes<HTMLElement | HTMLSpanElement | HTMLAnchorElement | HTMLImageElement | HTMLButtonElement | HTMLFormElement | HTMLDivElement | HTMLParagraphElement | HTMLInputElement | HTMLTextAreaElement | HTMLLabelElement | HTMLObjectElement | HTMLMetaElement | HTMLMapElement | HTMLLinkElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLLegendElement | HTMLLIElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPreElement | HTMLProgressElement | HTMLSlotElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLStyleElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement>, "id" | "onResize"> & {
4
+ declare const ResizablePanel: React.ForwardRefExoticComponent<Omit<Omit<React.HTMLAttributes<HTMLElement | HTMLSpanElement | HTMLAnchorElement | HTMLImageElement | HTMLButtonElement | HTMLFormElement | HTMLDivElement | HTMLParagraphElement | HTMLInputElement | HTMLTextAreaElement | HTMLLabelElement | HTMLObjectElement | HTMLMapElement | HTMLMetaElement | HTMLLinkElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDialogElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLLegendElement | HTMLLIElement | HTMLMeterElement | HTMLOListElement | HTMLOptGroupElement | HTMLOptionElement | HTMLOutputElement | HTMLPreElement | HTMLProgressElement | HTMLSlotElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLStyleElement | HTMLTableElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTimeElement | HTMLTitleElement | HTMLTableRowElement | HTMLTrackElement | HTMLUListElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement>, "id" | "onResize"> & {
5
5
  className?: string;
6
6
  collapsedSize?: number | undefined;
7
7
  collapsible?: boolean | undefined;
@@ -0,0 +1,26 @@
1
+ import { type ReactElement } from 'react';
2
+ export declare function AgentHoverCard({ sessionId, name, className, children, }: {
3
+ sessionId: string;
4
+ name: string;
5
+ /** The trigger box: it takes the chip's place in the row, so it takes its flex. */
6
+ className?: string;
7
+ children: ReactElement;
8
+ }): import("react").JSX.Element;
9
+ /** What an inline agent's card shows: it has no session, so the row's own facts. */
10
+ export interface AgentInlineDetail {
11
+ state?: string;
12
+ task?: string;
13
+ model?: string | null;
14
+ /** One line on where it ran, or why it never did. */
15
+ note?: string;
16
+ }
17
+ /**
18
+ * The hover card of an agent that ran inside this session (pi `session: "same"`):
19
+ * the same card without the session line, and a note saying where it ran.
20
+ */
21
+ export declare function AgentInlineHoverCard({ name, detail, className, children, }: {
22
+ name: string;
23
+ detail: AgentInlineDetail;
24
+ className?: string;
25
+ children: ReactElement;
26
+ }): import("react").JSX.Element;
@@ -0,0 +1,70 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { ArrowUpRightIcon } from '@phosphor-icons/react';
4
+ import { useProjectSession } from '@kortix/sdk/react';
5
+ import { useEffect, useRef, useState } from 'react';
6
+ import { useTranslations } from '../../i18n/index.js';
7
+ import { CopyButton } from '../../markdown/copy-button.js';
8
+ import { useProjectSessionHref } from '../../internal/lib/navigation/session-href.js';
9
+ import { HoverCard, HoverCardContent, HoverCardTrigger } from '../../primitives/hover-card.js';
10
+ import { useSessionIds } from '../../providers/session-ids.js';
11
+ import { agentRowOf } from './agent-model.js';
12
+ import { agentDisplayName } from '../../internal/components/agent-mark.js';
13
+ import { cn } from '../../lib/utils.js';
14
+ /**
15
+ * What an agent chip says on hover: who the agent is, how it is doing, the
16
+ * model it runs on, and its session — the id to copy and a link that opens it
17
+ * in a new tab. Only an agent with a session of its own gets the card; an
18
+ * inline run (pi `session: "same"`) has nothing to open.
19
+ */
20
+ /**
21
+ * A hover card that mounts on first hover. A transcript holds dozens of agent
22
+ * rows; each idle row stays a plain span, and only the one a pointer reaches
23
+ * pays for the floating layer.
24
+ */
25
+ function LazyAgentCard({ className, card, children }) {
26
+ const [armed, setArmed] = useState(false);
27
+ const [open, setOpen] = useState(false);
28
+ const timer = useRef(undefined);
29
+ useEffect(() => () => clearTimeout(timer.current), []);
30
+ const trigger = (_jsx("span", { "data-slot": "agent-hover-trigger", className: cn('flex min-w-0', className), onPointerEnter: () => {
31
+ if (armed)
32
+ return;
33
+ setArmed(true);
34
+ // The first hover opens after the same delay a mounted card waits.
35
+ timer.current = setTimeout(() => setOpen(true), OPEN_DELAY);
36
+ }, onPointerLeave: () => clearTimeout(timer.current), children: children }));
37
+ if (!armed)
38
+ return trigger;
39
+ return (_jsxs(HoverCard, { open: open, onOpenChange: setOpen, openDelay: OPEN_DELAY, closeDelay: 120, children: [_jsx(HoverCardTrigger, { asChild: true, children: trigger }), _jsx(HoverCardContent, { side: "top", align: "start", sideOffset: 6, animated: false, className: "w-72 p-0",
40
+ // The card is portaled, but React still bubbles its events to the row: a click
41
+ // on Copy or the link must not also open the row.
42
+ onClick: (event) => event.stopPropagation(), onPointerDown: (event) => event.stopPropagation(), children: card(open) })] }));
43
+ }
44
+ const OPEN_DELAY = 350;
45
+ export function AgentHoverCard({ sessionId, name, className, children, }) {
46
+ return (_jsx(LazyAgentCard, { className: className, card: (open) => (open ? _jsx(AgentCardBody, { sessionId: sessionId, name: name }) : null), children: children }));
47
+ }
48
+ function AgentCardBody({ sessionId, name }) {
49
+ const t = useTranslations('tools.agent');
50
+ const ids = useSessionIds();
51
+ const href = useProjectSessionHref()(sessionId);
52
+ const row = useProjectSession(ids.projectId, sessionId, { enabled: !!ids.projectId });
53
+ const session = row.data ?? null;
54
+ const agent = session ? agentRowOf(session) : null;
55
+ const model = session?.model?.split('/').pop() ?? null;
56
+ const line = agent?.line ?? null;
57
+ return (_jsxs("div", { className: "flex flex-col gap-2 px-3 py-2.5 text-sm", "data-slot": "agent-hover-card", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("p", { className: "text-foreground min-w-0 flex-1 truncate font-medium", children: name }), agent && _jsx("span", { className: "text-muted-foreground shrink-0 text-xs", children: t(`state.${agent.state}`) })] }), line && _jsx("p", { className: "text-muted-foreground line-clamp-2 text-xs", children: line }), _jsxs("dl", { className: "text-muted-foreground grid grid-cols-[auto_1fr] items-center gap-x-3 gap-y-1 text-xs", children: [agent?.agent && agent.named && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t('card.runsAs') }), _jsx("dd", { className: "text-foreground min-w-0 truncate", children: agentDisplayName(agent.agent) })] })), model && (_jsxs(_Fragment, { children: [_jsx("dt", { children: t('card.model') }), _jsx("dd", { className: "text-foreground min-w-0 truncate", children: model })] })), _jsx("dt", { children: t('card.session') }), _jsxs("dd", { className: "flex min-w-0 items-center gap-1", children: [_jsx("span", { className: "text-foreground min-w-0 truncate font-mono tabular-nums", title: sessionId, children: sessionId.slice(0, 8) }), _jsx(CopyButton, { code: sessionId, label: t('card.copyId'), size: "sm", hintSide: "top" })] })] }), href && (_jsxs("a", { href: href, target: "_blank", rel: "noreferrer", className: "text-muted-foreground hover:text-foreground focus-visible:text-foreground flex w-fit items-center gap-1 text-xs", children: [t('card.openNewTab'), _jsx(ArrowUpRightIcon, { "aria-hidden": true, className: "size-3" })] }))] }));
58
+ }
59
+ /**
60
+ * The hover card of an agent that ran inside this session (pi `session: "same"`):
61
+ * the same card without the session line, and a note saying where it ran.
62
+ */
63
+ export function AgentInlineHoverCard({ name, detail, className, children, }) {
64
+ return (_jsx(LazyAgentCard, { className: className, card: () => _jsx(InlineCardBody, { name: name, detail: detail }), children: children }));
65
+ }
66
+ function InlineCardBody({ name, detail }) {
67
+ const t = useTranslations('tools.agent');
68
+ const model = detail.model?.split('/').pop() ?? null;
69
+ return (_jsxs("div", { className: "flex flex-col gap-2 px-3 py-2.5 text-sm", "data-slot": "agent-hover-card", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("p", { className: "text-foreground min-w-0 flex-1 truncate font-medium", children: name }), detail.state && _jsx("span", { className: "text-muted-foreground shrink-0 text-xs", children: detail.state })] }), detail.task && _jsx("p", { className: "text-muted-foreground line-clamp-2 text-xs", children: detail.task }), model && (_jsxs("dl", { className: "text-muted-foreground grid grid-cols-[auto_1fr] items-center gap-x-3 gap-y-1 text-xs", children: [_jsx("dt", { children: t('card.model') }), _jsx("dd", { className: "text-foreground min-w-0 truncate", children: model })] })), detail.note && _jsx("p", { className: "text-muted-foreground text-xs", children: detail.note })] }));
70
+ }
@@ -8,6 +8,7 @@ import Loading from '../../primitives/loading.js';
8
8
  import { Popover, PopoverContent, PopoverTrigger } from '../../primitives/popover.js';
9
9
  import { Tabs, TabsContent, TabsList, TabsTrigger } from '../../primitives/tabs.js';
10
10
  import { errorToast } from '../../primitives/toast.js';
11
+ import { FadedScrollArea } from '../../primitives/faded-scroll-area.js';
11
12
  import { useTranslations } from '../../i18n/index.js';
12
13
  import { agentDisplayName } from '../../internal/components/agent-mark.js';
13
14
  import { cn } from '../../lib/utils.js';
@@ -23,6 +24,7 @@ import { RunProgressRing } from '../tool/tools/workflow-progress.js';
23
24
  import { WorkflowRunRows } from '../tool/tools/workflow-run-card.js';
24
25
  import { isActive, lineSummary, shortElapsed, stripGroups, } from './agent-model.js';
25
26
  import { TasksPanel } from './tasks-panel.js';
27
+ import { AgentChip } from './agent-surface.js';
26
28
  import { isLargeRun, LargeRunBadge, useLiveWorkflowRun, useRestartAgent, useStopAgent, WorkflowRunControls, } from './workflow-run-controls.js';
27
29
  /**
28
30
  * The agents line: one muted control in the composer's under-row, right of the
@@ -128,13 +130,34 @@ export function AgentsPanel({ projectId, sessionId, agents, team, runs, tasks, o
128
130
  const t = useTranslations('multiAgent.strip');
129
131
  const anyWorking = live && [...agents, ...team].some((row) => row.state === 'working');
130
132
  const now = useNow(1_000, anyWorking);
131
- const sections = [agents.length > 0, team.length > 0, runs.length > 0].filter(Boolean).length;
132
133
  const renderRows = (list, teammate) => (_jsx("ul", { children: list.map((row) => (_jsx(AgentLineRow, { row: row, teammate: teammate, now: now, stopping: stopping.has(row.sessionId), onOpen: () => onOpen({ sessionId: row.sessionId, title: row.handle }), onStop: () => onStop(row) }, row.sessionId))) }));
133
- const list = (_jsxs("div", { className: "max-h-96 overflow-y-auto p-1", children: [agents.length > 0 && (_jsxs("section", { "aria-label": t('label'), children: [sections > 1 && _jsx(GroupLabel, { children: t('label') }), renderRows(agents, false)] })), team.length > 0 && (_jsxs("section", { "aria-label": t('team'), children: [_jsx(GroupLabel, { children: t('team') }), renderRows(team, true)] })), runs.length > 0 && (_jsxs("section", { "aria-label": t('workflowsGroup'), children: [_jsx(GroupLabel, { children: t('workflowsGroup') }), _jsx("ul", { children: runs.map((run) => (_jsx(WorkflowLineRow, { projectId: projectId, sessionId: sessionId, run: run, onOpen: onOpen }, run.runId || run.title))) })] }))] }));
134
+ const people = [...agents, ...team];
135
+ // The summary stays put; the rows scroll under it, faded at the edges.
136
+ const list = (_jsxs("div", { className: "flex max-h-96 min-h-0 flex-col p-1", children: [people.length > 0 && _jsx(AgentsSummary, { rows: people }), _jsxs(FadedScrollArea, { fadeColor: "from-popover", fadeSize: "6", rootClassName: "h-auto", className: "overscroll-contain", children: [agents.length > 0 && (_jsxs("section", { "aria-label": t('label'), children: [team.length > 0 && _jsx(GroupLabel, { children: t('label') }), renderRows(agents, false)] })), team.length > 0 && (_jsxs("section", { "aria-label": t('team'), children: [_jsx(GroupLabel, { children: t('team') }), renderRows(team, true)] })), runs.length > 0 && (_jsxs("section", { "aria-label": t('workflowsGroup'), children: [_jsx(GroupLabel, { children: t('workflowsGroup') }), _jsx("ul", { children: runs.map((run) => (_jsx(WorkflowLineRow, { projectId: projectId, sessionId: sessionId, run: run, onOpen: onOpen }, run.runId || run.title))) })] }))] })] }));
134
137
  if (tasks === null)
135
138
  return list;
136
139
  const openTasks = tasks.filter((task) => task.status !== 'completed').length;
137
- return (_jsxs(Tabs, { defaultValue: "agents", className: "gap-0", children: [_jsx(TabsContent, { value: "agents", children: list }), _jsx(TabsContent, { value: "tasks", className: "max-h-96 overflow-y-auto p-1", children: _jsx(TasksPanel, { tasks: tasks }) }), _jsx("div", { className: "border-t p-1", children: _jsxs(TabsList, { size: "xs", animate: "none", className: "w-full", children: [_jsx(TabsTrigger, { value: "agents", children: t('label') }), _jsxs(TabsTrigger, { value: "tasks", className: "gap-1.5", children: [t('tasks'), openTasks > 0 && _jsx(CountBadge, { count: openTasks })] })] }) })] }));
140
+ return (_jsxs(Tabs, { defaultValue: "agents", className: "gap-0", children: [_jsx(TabsContent, { value: "agents", children: list }), _jsx(TabsContent, { value: "tasks", className: "flex max-h-96 min-h-0 flex-col p-1", children: _jsx(FadedScrollArea, { fadeColor: "from-popover", fadeSize: "6", rootClassName: "h-auto", className: "overscroll-contain", children: _jsx(TasksPanel, { tasks: tasks }) }) }), _jsx("div", { className: "border-t p-1", children: _jsxs(TabsList, { size: "xs", animate: "none", className: "w-full", children: [_jsx(TabsTrigger, { value: "agents", children: t('label') }), _jsxs(TabsTrigger, { value: "tasks", className: "gap-1.5", children: [t('tasks'), openTasks > 0 && _jsx(CountBadge, { count: openTasks })] })] }) })] }));
141
+ }
142
+ /** The order and colour of each state in the summary: what needs the person first. */
143
+ const SUMMARY = [
144
+ { state: 'needs_input', color: 'var(--kortix-blue)' },
145
+ { state: 'failed', color: 'var(--kortix-red)' },
146
+ { state: 'working', color: 'var(--kortix-green)' },
147
+ { state: 'completed', color: 'var(--kortix-green)' },
148
+ { state: 'stopped', color: 'var(--muted-foreground)' },
149
+ ];
150
+ /** `idle` reads as done: it counts with `completed`. */
151
+ const summaryState = (state) => (state === 'idle' ? 'completed' : state);
152
+ /**
153
+ * How the session's colleagues are doing, in one glance: the count, each state's
154
+ * count, and a bar split by state. Done is the green ring's colour at a lighter
155
+ * weight, so working and done read apart.
156
+ */
157
+ function AgentsSummary({ rows }) {
158
+ const t = useTranslations('multiAgent.strip');
159
+ const counts = SUMMARY.map((item) => ({ ...item, count: rows.filter((row) => summaryState(row.state) === item.state).length })).filter((item) => item.count > 0);
160
+ return (_jsxs("div", { "data-slot": "agents-summary", className: "flex flex-col gap-2 px-2 pt-1.5 pb-2.5", children: [_jsxs("div", { className: "flex min-w-0 items-baseline justify-between gap-3", children: [_jsx("span", { className: "text-foreground text-sm", children: t('agents', { count: rows.length }) }), _jsx("span", { className: "text-muted-foreground truncate text-xs", children: counts.map((item) => t('stateCount', { count: item.count, state: t(`state.${item.state}`) })).join(' · ') })] }), _jsx("div", { "aria-hidden": true, className: "flex h-1 gap-0.5 overflow-hidden rounded-full", children: counts.map((item) => (_jsx("span", { className: cn('h-full', item.state === 'completed' && 'opacity-50'), style: { flexGrow: item.count, backgroundColor: item.color } }, item.state))) })] }));
138
161
  }
139
162
  function GroupLabel({ children }) {
140
163
  return _jsx("div", { className: "text-muted-foreground px-2 pt-1.5 pb-0.5 text-xs font-medium", children: children });
@@ -150,11 +173,14 @@ function rowState(row, now, t) {
150
173
  }
151
174
  function AgentLineRow({ row, teammate, now, stopping, onOpen, onStop, }) {
152
175
  const t = useTranslations('multiAgent.strip');
153
- // The result, or what it waits for: one line on hover, never inline.
176
+ // The result, or what it waits for: the row's second line, before "runs as".
154
177
  const detail = row.state === 'needs_input' ? (row.line ?? t(`attention.${row.attention ?? 'question'}`)) : row.line;
155
- const handle = (_jsx("span", { className: "text-foreground min-w-0 truncate font-medium", title: teammate ? undefined : row.handle, children: row.handle }));
156
- const state = (_jsx("span", { className: "text-muted-foreground shrink-0 tabular-nums", children: rowState(row, now, t) }));
157
- return (_jsxs("li", { "data-testid": "agents-line-row", "data-agent-row": row.sessionId, className: "group/row hover:bg-hover focus-within:bg-hover flex min-w-0 items-center gap-1 rounded-sm", children: [_jsxs("div", { onClick: onOpen, className: "flex min-w-0 flex-1 cursor-pointer items-center gap-2 py-1.5 pl-2 text-xs", children: [_jsx(AgentStateMark, { state: row.state }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "flex min-w-0 items-baseline gap-2", children: [teammate ? (_jsx(Hint, { label: t('teamRole'), side: "top", children: handle })) : (handle), detail ? (_jsx(Hint, { label: _jsx("span", { className: "block max-w-72 truncate", children: detail }), side: "top", children: state })) : (state)] }), row.named && row.agent && (_jsx("p", { className: "text-muted-foreground truncate", children: t('runsAs', { agent: agentDisplayName(row.agent) }) }))] })] }), _jsxs("div", { className: cn(ROW_ACTIONS, 'pr-1', stopping && 'opacity-100'), children: [_jsx(Hint, { label: t('openAgent', { name: row.handle }), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": t('openAgent', { name: row.handle }), onClick: onOpen, className: "text-muted-foreground hover:text-foreground", children: _jsx(ArrowUpRightIcon, { className: "size-3.5 shrink-0" }) }) }), stopping ? (_jsx("span", { className: "flex size-6 items-center justify-center", children: _jsx(Loading, { className: "text-muted-foreground size-3" }) })) : isActive(row.state) ? (_jsx(Hint, { label: t('stopHint'), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": t('stopAgent', { name: row.handle }), onClick: onStop, className: "text-muted-foreground hover:text-foreground", children: _jsx(SquareIcon, { weight: "fill", className: "size-2.5" }) }) })) : null] })] }));
178
+ const chip = _jsx(AgentChip, { handle: row.handle, name: row.handle, className: "max-w-none min-w-0 shrink" });
179
+ const stateWord = rowState(row, now, t);
180
+ const sub = [detail, row.named && row.agent ? t('runsAs', { agent: agentDisplayName(row.agent) }) : null].filter(Boolean).join(' · ');
181
+ return (_jsxs("li", { "data-testid": "agents-line-row", "data-agent-row": row.sessionId, className: "group/row hover:bg-hover focus-within:bg-hover flex min-w-0 items-start rounded-md", children: [_jsxs("div", { onClick: onOpen, className: "flex min-w-0 flex-1 cursor-pointer flex-col gap-1 py-2 pl-2", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [teammate ? (_jsx(Hint, { label: t('teamRole'), side: "top", children: chip })) : (chip), _jsx("span", { className: "flex-1" }), _jsx("span", { "data-slot": "agent-row-state", className: cn('shrink-0 text-xs tabular-nums',
182
+ // Red text reads at 6:1; the blue token is under 4.5:1 at 12px, so "needs you" stays in ink.
183
+ row.state === 'failed' ? 'text-kortix-red' : row.state === 'needs_input' ? 'text-foreground' : 'text-muted-foreground'), children: stateWord })] }), sub && _jsx("p", { className: "text-muted-foreground truncate pl-0.5 text-xs", children: sub })] }), _jsxs("div", { className: cn(ROW_ACTIONS, 'pt-1.5 pr-1 pl-1', stopping && 'opacity-100'), children: [_jsx(Hint, { label: t('openAgent', { name: row.handle }), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": t('openAgent', { name: row.handle }), onClick: onOpen, className: "text-muted-foreground hover:text-foreground", children: _jsx(ArrowUpRightIcon, { className: "size-3.5 shrink-0" }) }) }), stopping ? (_jsx("span", { className: "flex size-6 items-center justify-center", children: _jsx(Loading, { className: "text-muted-foreground size-3" }) })) : isActive(row.state) ? (_jsx(Hint, { label: t('stopHint'), side: "top", children: _jsx(Button, { type: "button", variant: "ghost", size: "icon-xs", "aria-label": t('stopAgent', { name: row.handle }), onClick: onStop, className: "text-muted-foreground hover:text-foreground", children: _jsx(SquareIcon, { weight: "fill", className: "size-2.5" }) }) })) : null] })] }));
158
184
  }
159
185
  const RUN_STATE = {
160
186
  running: 'working',
@@ -1,5 +1,6 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import type { SessionDisplayStatus } from '../actions/session-label.js';
3
+ import { type AgentInlineDetail } from './agent-hover-card.js';
3
4
  /**
4
5
  * The parts every MyKortix agent surface in the chat is drawn from. An agent
5
6
  * call, an agent's finish, a message to or from another agent and a workflow
@@ -24,13 +25,37 @@ export declare function SmallGlyph({ status, label }: {
24
25
  status: SessionDisplayStatus;
25
26
  label?: string;
26
27
  }): import("react").JSX.Element;
28
+ /**
29
+ * An agent as one chip: its pixel mark and its name in a full-round pill. The
30
+ * fill is the agent's colour (the mark's ink) at a medium tint, so every agent
31
+ * reads as its own colour, grey ones included; the name stays in the
32
+ * foreground ink. Every agent name on a MyKortix surface is this chip.
33
+ * A chip that leads a row starts on the row's left edge, where every other
34
+ * row's icon starts; that row draws no separate face.
35
+ */
36
+ export declare function AgentChip({ handle, name, className, plain, }: {
37
+ handle: string;
38
+ name: ReactNode;
39
+ className?: string;
40
+ /** Mark and name only, no pill: for a header that already has its own surface. */
41
+ plain?: boolean;
42
+ }): import("react").JSX.Element;
27
43
  /**
28
44
  * The title and subtitle of an agent row. The title is a handle or a name, so it
29
45
  * yields past `max-w-40` and the subtitle (what the agent works on) keeps its room.
46
+ * With `handle`, the title is the agent itself: it renders as its chip, after
47
+ * `lead` when the row says something before the name ("To").
30
48
  */
31
- export declare function AgentTrigger({ title, subtitle }: {
49
+ export declare function AgentTrigger({ title, subtitle, handle, lead, trail, sessionId, detail, }: {
32
50
  title: string;
33
51
  subtitle?: string | null;
52
+ handle?: string;
53
+ lead?: string;
54
+ trail?: string;
55
+ /** The agent's own session: its chip then opens a hover card with the id and a link. */
56
+ sessionId?: string | null;
57
+ /** An agent without a session of its own: its chip's hover card shows these facts. */
58
+ detail?: AgentInlineDetail;
34
59
  }): import("react").JSX.Element;
35
60
  /**
36
61
  * The right edge of an agent row: the state glyph and its word, muted. A row
@@ -1,13 +1,17 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { ArrowUpRightIcon, CaretRightIcon } from '@phosphor-icons/react';
4
+ import { SolidCheckIcon } from '../../internal/icons/solid-check-icon.js';
4
5
  import { useContext, useId, useState } from 'react';
5
6
  import { useTranslations } from '../../i18n/index.js';
6
7
  import { AgentMarkGlyph, agentMarkTileClass, agentMarkVars } from '../../internal/components/agent-mark.js';
7
8
  import { cn } from '../../lib/utils.js';
8
9
  import { SessionStatusMark } from '../list/session-status-mark.js';
9
10
  import { TextShimmer } from '../../primitives/text-shimmer.js';
10
- import { BoundActivateContext, ToolOutcomeContext, ToolRunningContext, useToolOpen } from '../tool/shared/infrastructure-contexts.js';
11
+ import { Hint } from '../../primitives/hint.js';
12
+ import { BoundActivateContext, ToolOutcomeContext, ToolRunningContext, ToolStartedAtContext, useToolOpen } from '../tool/shared/infrastructure-contexts.js';
13
+ import { ToolSurfaceContext } from '../tool/shared/surface.js';
14
+ import { AgentHoverCard, AgentInlineHoverCard } from './agent-hover-card.js';
11
15
  /**
12
16
  * The parts every MyKortix agent surface in the chat is drawn from. An agent
13
17
  * call, an agent's finish, a message to or from another agent and a workflow
@@ -33,14 +37,48 @@ export function AgentFace({ handle, className }) {
33
37
  export function SmallGlyph({ status, label }) {
34
38
  return (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, className: "flex size-3.5 shrink-0 items-center justify-center [&>svg]:size-3.5", children: _jsx(SessionStatusMark, { status: status, waitingOn: "answer" }) }), label && _jsx("span", { className: "sr-only", children: label })] }));
35
39
  }
40
+ /**
41
+ * An agent as one chip: its pixel mark and its name in a full-round pill. The
42
+ * fill is the agent's colour (the mark's ink) at a medium tint, so every agent
43
+ * reads as its own colour, grey ones included; the name stays in the
44
+ * foreground ink. Every agent name on a MyKortix surface is this chip.
45
+ * A chip that leads a row starts on the row's left edge, where every other
46
+ * row's icon starts; that row draws no separate face.
47
+ */
48
+ export function AgentChip({ handle, name, className, plain = false, }) {
49
+ const slug = agentSlug(handle);
50
+ return (_jsxs("span", { "data-tone": "agent", "data-slot": "agent-chip", style: { ...agentMarkVars(slug), ...(plain ? {} : { backgroundColor: 'color-mix(in oklab, var(--mark-ink) 14%, transparent)' }) }, className: cn('text-foreground flex h-6 max-w-44 min-w-0 shrink-0 items-center gap-1.5 text-sm', !plain && 'rounded-full pr-2.5 pl-1.5', className), children: [_jsx("span", { className: "flex w-3.5 shrink-0 justify-center", children: _jsx(AgentMarkGlyph, { slug: slug, size: 14, trim: true }) }), _jsx("span", { className: "min-w-0 truncate", title: typeof name === 'string' ? name : undefined, children: name })] }));
51
+ }
52
+ /** A Kortix session id. An inline run's pi thread id (`ses_pi…`) has no session to open. */
53
+ const PROJECT_SESSION_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
36
54
  /**
37
55
  * The title and subtitle of an agent row. The title is a handle or a name, so it
38
56
  * yields past `max-w-40` and the subtitle (what the agent works on) keeps its room.
57
+ * With `handle`, the title is the agent itself: it renders as its chip, after
58
+ * `lead` when the row says something before the name ("To").
39
59
  */
40
- export function AgentTrigger({ title, subtitle }) {
60
+ export function AgentTrigger({ title, subtitle, handle, lead, trail, sessionId, detail, }) {
41
61
  const running = useContext(ToolRunningContext);
42
- return (_jsxs(_Fragment, { children: [_jsx("span", { className: "text-foreground max-w-40 min-w-0 shrink-0 truncate text-sm", title: title, children: title }), subtitle &&
43
- (running ? (_jsx(TextShimmer, { className: "min-w-0 flex-1 truncate text-sm", children: subtitle })) : (_jsx("span", { className: "text-muted-foreground min-w-0 flex-1 truncate text-sm", title: subtitle, children: subtitle })))] }));
62
+ // The side panel is narrow: the name keeps its own line and what the agent
63
+ // works on reads below it, so neither is cut to a few letters.
64
+ const panel = useContext(ToolSurfaceContext) === 'panel';
65
+ const startedAt = useContext(ToolStartedAtContext);
66
+ const clock = panel && startedAt ? new Date(startedAt).toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' }) : null;
67
+ // In the chat a role name ("Bike delivery operations researcher") keeps its words; the
68
+ // subtitle yields first. The narrow panel lets the chip shrink instead.
69
+ // The panel names the agent by its mark and name, no tinted pill.
70
+ const chip = handle ? _jsx(AgentChip, { handle: handle, name: title, plain: panel, className: panel ? 'max-w-none shrink' : 'max-w-64' }) : null;
71
+ const name = chip ? (sessionId && PROJECT_SESSION_ID.test(sessionId) ? (_jsx(AgentHoverCard, { sessionId: sessionId, name: title, className: panel ? 'shrink' : 'shrink-0', children: chip })) : detail ? (_jsx(AgentInlineHoverCard, { name: title, detail: detail, className: panel ? 'shrink' : 'shrink-0', children: chip })) : (chip)) : (_jsx("span", { className: "text-foreground max-w-40 min-w-0 shrink-0 truncate text-sm", title: title, children: title }));
72
+ const leadWord = lead && _jsx("span", { className: "text-foreground shrink-0 text-sm", children: `${lead} ` });
73
+ const trailWord = trail && _jsx("span", { className: "text-foreground shrink-0 text-sm", children: ` ${trail}` });
74
+ const sub = subtitle &&
75
+ (running ? (_jsx(TextShimmer, { className: "min-w-0 flex-1 truncate text-sm", children: subtitle })) : (_jsx("span", { className: "text-muted-foreground min-w-0 flex-1 truncate text-sm font-normal", title: subtitle, children: subtitle })));
76
+ if (panel) {
77
+ // To whom, then what, then when on the right edge. The message reads in
78
+ // full up to two lines, on the name's edge (past the 14px mark and its gap).
79
+ return (_jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [leadWord, name, trailWord, clock && _jsx("span", { className: "text-muted-foreground ml-auto shrink-0 pl-2 text-xs font-normal tabular-nums", children: clock })] }), subtitle && (_jsx("p", { className: cn('text-muted-foreground line-clamp-2 text-sm font-normal whitespace-normal', chip && 'pl-5'), title: subtitle, children: subtitle }))] }));
80
+ }
81
+ return (_jsxs(_Fragment, { children: [leadWord, name, trailWord, sub] }));
44
82
  }
45
83
  /**
46
84
  * The right edge of an agent row: the state glyph and its word, muted. A row
@@ -48,6 +86,15 @@ export function AgentTrigger({ title, subtitle }) {
48
86
  */
49
87
  export function AgentStatus({ status, label, time, opens = false, }) {
50
88
  const open = useToolOpen();
89
+ // The side panel is narrow and its row draws its own disclosure caret: there
90
+ // the state is the glyph alone, its word a hint (and read aloud), so the
91
+ // agent's task keeps the width.
92
+ if (useContext(ToolSurfaceContext) === 'panel') {
93
+ // Done and working read from the glyph alone. Every other state (failed,
94
+ // refused, expired, needs you) shares a glyph with others, so its word stays.
95
+ const glyphOnly = status === 'done' || status === 'running';
96
+ return (_jsx(Hint, { label: time ? `${label} · ${time}` : label, side: "left", children: _jsxs("span", { "data-agent-status": status, className: "text-muted-foreground flex shrink-0 items-center gap-1.5 pl-1 text-xs", children: [status === 'done' ? (_jsxs(_Fragment, { children: [_jsx(SolidCheckIcon, { "aria-hidden": true, className: "size-3.5 shrink-0" }), _jsx("span", { className: "sr-only", children: label })] })) : (status && _jsx(SmallGlyph, { status: status, label: glyphOnly ? label : undefined })), (!glyphOnly || !status) && _jsx("span", { className: "whitespace-nowrap", children: label })] }) }));
97
+ }
51
98
  return (_jsxs("span", { "data-agent-status": status, className: "text-muted-foreground flex shrink-0 items-center gap-1.5 pl-3 text-xs", children: [status && _jsx(SmallGlyph, { status: status }), _jsx("span", { className: "whitespace-nowrap", children: label }), time && _jsx("span", { className: "tabular-nums", children: time }), _jsx(CaretRightIcon, { "aria-hidden": true, "data-slot": opens ? 'agent-row-caret' : undefined, className: cn('size-3 shrink-0 transition-transform duration-(--duration-fast) motion-reduce:transition-none', !opens && 'invisible', open && 'rotate-90') })] }));
52
99
  }
53
100
  /**
@@ -55,7 +102,11 @@ export function AgentStatus({ status, label, time, opens = false, }) {
55
102
  * of the 16px face), its text on the title's left edge, at the chat's reading size.
56
103
  */
57
104
  export function AgentRowBody({ children, className }) {
58
- return (_jsx("div", { className: cn('border-border ml-2 flex min-w-0 flex-col gap-2.5 border-l py-1 pl-3 text-sm', className), children: children }));
105
+ // The side panel's card already frames the body: no rail there.
106
+ const panel = useContext(ToolSurfaceContext) === 'panel';
107
+ return (
108
+ // In the panel the body starts on the message column, under the name.
109
+ _jsx("div", { className: cn('flex min-w-0 flex-col gap-2.5 text-sm', panel ? 'py-0.5 pl-5' : 'border-border ml-2 border-l py-1 pl-3', className), children: children }));
59
110
  }
60
111
  /**
61
112
  * The agent rows own their disclosure: a click opens the row in place. The chat
@@ -93,5 +144,5 @@ export function taskGlyphStatus(status) {
93
144
  }
94
145
  /** Who owns a task or sent a message: the agent's face and its handle. */
95
146
  export function AgentHandle({ handle }) {
96
- return (_jsxs("span", { className: "text-muted-foreground flex max-w-36 min-w-0 shrink-0 items-center gap-1.5", children: [_jsx(AgentFace, { handle: handle }), _jsxs("span", { className: "min-w-0 truncate", children: ["@", handle] })] }));
147
+ return (_jsx(AgentChip, { handle: handle, name: `@${handle}`, className: "max-w-36" }));
97
148
  }
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Button } from '../../primitives/button.js';
4
4
  import { errorToast } from '../../primitives/toast.js';
5
5
  import { useTranslations } from '../../i18n/index.js';
6
- import { AgentFace, AgentStatus } from './agent-surface.js';
6
+ import { AgentChip, AgentStatus } from './agent-surface.js';
7
7
  import { peerHandleLabel } from '../../_vendor/kortix-shared.js';
8
8
  import { heldMessages } from '@kortix/sdk';
9
9
  import { usePeerMessages } from '@kortix/sdk/react';
@@ -14,7 +14,7 @@ export function HeldMessageCard({ message, pending, onApprove, onDeny }) {
14
14
  const shutdown = message.type === 'shutdown_request';
15
15
  // A decision, so a card: who, what it would deliver, and the two answers. The rest of the
16
16
  // agent surfaces are rows; this one waits on the person.
17
- return (_jsxs("div", { "data-held-message": message.id, "data-testid": "held-message-card", className: "border-border bg-background flex min-w-0 gap-1.5 rounded-lg border p-3 text-sm", children: [_jsx("span", { className: "flex h-5 shrink-0 items-center", children: _jsx(AgentFace, { handle: handle }) }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2.5", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1", children: [_jsx("span", { className: "text-foreground max-w-40 min-w-0 truncate font-medium", title: name, children: name }), _jsx("span", { className: "text-muted-foreground min-w-0 flex-1", children: shutdown ? t('asksStop') : t('wantsToSend') }), _jsx(AgentStatus, { status: "needs-you", label: t('needsApproval') })] }), message.summary?.trim() && _jsx("p", { className: "text-muted-foreground", children: message.summary.trim() }), _jsx("p", { "data-slot": "held-message-body", className: "text-foreground max-h-60 overflow-y-auto whitespace-pre-wrap wrap-anywhere", children: message.message.trim() }), _jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("span", { className: "text-muted-foreground min-w-0 flex-1 truncate text-xs", children: t('expires') }), _jsx(Button, { type: "button", size: "xs", variant: "secondary", disabled: pending !== null, "aria-busy": pending === 'deny', onClick: onDeny, children: t('deny') }), _jsx(Button, { type: "button", size: "xs", disabled: pending !== null, "aria-busy": pending === 'approve', onClick: onApprove, children: t('approve') })] })] })] }));
17
+ return (_jsx("div", { "data-held-message": message.id, "data-testid": "held-message-card", className: "border-border bg-background flex min-w-0 gap-1.5 rounded-lg border p-3 text-sm", children: _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2.5", children: [_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-1.5 gap-y-1", children: [_jsx(AgentChip, { handle: handle, name: name }), _jsx("span", { className: "text-muted-foreground min-w-0 flex-1", children: shutdown ? t('asksStop') : t('wantsToSend') }), _jsx(AgentStatus, { status: "needs-you", label: t('needsApproval') })] }), message.summary?.trim() && _jsx("p", { className: "text-muted-foreground", children: message.summary.trim() }), _jsx("p", { "data-slot": "held-message-body", className: "text-foreground max-h-60 overflow-y-auto whitespace-pre-wrap wrap-anywhere", children: message.message.trim() }), _jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("span", { className: "text-muted-foreground min-w-0 flex-1 truncate text-xs", children: t('expires') }), _jsx(Button, { type: "button", size: "xs", variant: "secondary", disabled: pending !== null, "aria-busy": pending === 'deny', onClick: onDeny, children: t('deny') }), _jsx(Button, { type: "button", size: "xs", disabled: pending !== null, "aria-busy": pending === 'approve', onClick: onApprove, children: t('approve') })] })] }) }));
18
18
  }
19
19
  /** The held messages of `usePeerMessages(…, 'in')`, one card each; nothing when none waits. */
20
20
  export function HeldMessageList({ messages, approve, deny, }) {