@kortix/ui 0.16.2 → 0.16.4

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 (67) hide show
  1. package/dist/_vendor/kortix-shared.js +1 -4
  2. package/dist/customize/settings/rail-copy-context.d.ts +2 -0
  3. package/dist/customize/settings/rail-copy-context.js +2 -0
  4. package/dist/customize/settings/tabs/chrome-connections-tab.js +1 -1
  5. package/dist/files/renderers/show-content-renderer.js +3 -1
  6. package/dist/i18n/en.d.ts +14 -9
  7. package/dist/i18n/en.js +15 -10
  8. package/dist/internal/chrome/chrome-connect.d.ts +3 -5
  9. package/dist/internal/chrome/chrome-connect.js +7 -10
  10. package/dist/internal/chrome/extension.d.ts +1 -8
  11. package/dist/internal/chrome/extension.js +1 -8
  12. package/dist/internal/chrome/use-chrome-offered.d.ts +6 -12
  13. package/dist/internal/chrome/use-chrome-offered.js +13 -15
  14. package/dist/internal/layout/project-page-header.js +5 -4
  15. package/dist/internal/stores/user-preferences-store.d.ts +17 -0
  16. package/dist/internal/stores/user-preferences-store.js +5 -0
  17. package/dist/primitives/color-picker.d.ts +19 -0
  18. package/dist/primitives/color-picker.js +27 -0
  19. package/dist/primitives/faded-scroll-area.js +4 -0
  20. package/dist/primitives/glyph-picker.d.ts +11 -0
  21. package/dist/primitives/glyph-picker.js +10 -6
  22. package/dist/primitives/gradient-wallpaper-gl.d.ts +61 -0
  23. package/dist/primitives/gradient-wallpaper-gl.js +446 -0
  24. package/dist/primitives/gradient-wallpaper.d.ts +20 -0
  25. package/dist/primitives/gradient-wallpaper.js +242 -0
  26. package/dist/primitives/resizable.d.ts +1 -1
  27. package/dist/session/composer/ComposerCard.js +0 -3
  28. package/dist/session/panel/easy/detail-view.js +3 -2
  29. package/dist/session/panel/shared/collect-tool-parts.js +2 -2
  30. package/dist/session/panel/shared/use-panel-handoffs.js +23 -2
  31. package/dist/session/thread/session-body.js +1 -1
  32. package/dist/session/tool/shared/infrastructure-contexts.d.ts +5 -0
  33. package/dist/session/tool/shared/infrastructure-contexts.js +7 -0
  34. package/dist/session/tool/show-group-renderer.d.ts +5 -5
  35. package/dist/session/tool/show-group-renderer.js +7 -4
  36. package/dist/session/tool/tool-part-renderer.js +3 -1
  37. package/dist/session/tool/tool-renderers.d.ts +1 -1
  38. package/dist/session/tool/tool-renderers.js +1 -1
  39. package/dist/styles.css +1 -1
  40. package/dist/test-utils/intl.d.ts +14 -9
  41. package/dist/theme/index.d.ts +2 -1
  42. package/dist/theme/index.js +2 -1
  43. package/dist/theme/wallpaper-gradients.d.ts +106 -0
  44. package/dist/theme/wallpaper-gradients.js +347 -0
  45. package/dist/theme/wallpapers.d.ts +23 -3
  46. package/dist/theme/wallpapers.js +53 -29
  47. package/dist/workspace/admin/project-admin-dashboard.js +1 -1
  48. package/dist/workspace/layout/project-home.js +1 -1
  49. package/dist/workspace/new/use-create-workspace.d.ts +5 -3
  50. package/dist/workspace/new/use-create-workspace.js +1 -1
  51. package/dist/workspace/session-spaces/space-picker.js +3 -3
  52. package/dist/workspace/setup/setup-banner-snooze.d.ts +10 -0
  53. package/dist/workspace/setup/setup-banner-snooze.js +44 -0
  54. package/dist/workspace/setup/setup-banner.js +19 -36
  55. package/dist/workspace/setup/setup-steps.d.ts +0 -5
  56. package/dist/workspace/setup/setup-steps.js +0 -7
  57. package/dist/workspace/setup/workspace-setup-modal.d.ts +39 -0
  58. package/dist/workspace/setup/workspace-setup-modal.js +202 -0
  59. package/dist/workspace/sidebar/project-session-list.js +2 -1
  60. package/dist/workspace/sidebar/project-sidebar.js +6 -5
  61. package/package.json +14 -10
  62. package/skills/kortix-ui/SKILL.md +1 -1
  63. package/skills/kortix-ui/references/modules.md +3 -1
  64. package/dist/primitives/toast-clearance.d.ts +0 -36
  65. package/dist/primitives/toast-clearance.js +0 -94
  66. package/dist/workspace/setup/workspace-setup-page.d.ts +0 -10
  67. 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;
@@ -3,7 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { cn } from '../../lib/utils.js';
4
4
  import { WarningIcon } from '@phosphor-icons/react';
5
5
  import { lazy, Suspense, useContext, useEffect, useMemo, useRef, useState } from 'react';
6
- import { useToastClearance } from '../../primitives/toast-clearance.js';
7
6
  import { SpaceMentionContext } from './menus/space-mentions.js';
8
7
  import { useFeatureFlag } from '@kortix/sdk/react';
9
8
  import { ModelConnectionLayoutContext } from '../models/model-connection-layout.js';
@@ -30,8 +29,6 @@ export function ComposerCard({ tHardcodedUi, isDragOver, handleDragEnter, handle
30
29
  agents = EMPTY_AGENTS, commands = EMPTY_COMMANDS, slashFiles = EMPTY_SLASH_FILES, models = EMPTY_MODELS, notice = null, disabled = false, lockForQuestion = false, lockForApproval = false, questionButtonLabel = null, questionActive = false, submitLabel = null, questionCanAct = true, escCount = 0, isBusy = false, isSending = false, onStop, stopDisabled = false, canStop = true, modelsLoading = false, modelRequired = false, onModelChange, modelDefaultControls, inheritedModel, providers, variants = EMPTY_VARIANTS, selectedVariant = null, onVariantChange, projectId, toolbarSlot, underbarSlot, rewind, selectedAgent = null, onAgentChange, noAccessibleAgents = false, agentLocked = false, onContextClick, messages, underbarPlacement = 'below', agentPickerCompact = false, slashMenuPlacement = 'above', cardClassName, call, inline = false, hideAgentPicker = false, }) {
31
30
  const connectionsAbove = useContext(ModelConnectionLayoutContext) === 'above';
32
31
  const cardRef = useRef(null);
33
- // A composer docked at the window bottom keeps toasts above its Send/Stop button.
34
- useToastClearance(cardRef, slashMenuPlacement === 'above');
35
32
  const { attachAccept, modelPickerEnabled } = useUiHostConfig();
36
33
  const inlineUnderbar = underbarPlacement === 'inline';
37
34
  // `inline`: one row while the text fits a line. Once it wraps, or anything is
@@ -29,7 +29,7 @@ import { CaretLeftIcon as ChevronLeft, CaretRightIcon as ChevronRight, } from '@
29
29
  import { AnimatePresence, m } from 'motion/react';
30
30
  import { useReducedMotion } from '../../../internal/hooks/use-reduced-motion.js';
31
31
  import { useEffect, useRef, useState, } from 'react';
32
- import { ToolPartRenderer, ToolSurfaceContext } from '../../tool/tool-renderers.js';
32
+ import { isUnpresentedFailure, ToolPartRenderer, ToolSurfaceContext } from '../../tool/tool-renderers.js';
33
33
  import { PanelWidthButton } from '../../../files/viewer/viewer-actions.js';
34
34
  import { DOCKED_LAYER_CLASS, SESSION_BAR_CLASS } from '../../../internal/layout/panel-chrome.js';
35
35
  import { CloseButton, DetailSidebarToggle } from '../../../files/viewer/viewer-chrome.js';
@@ -376,7 +376,8 @@ export function collapseSnapshots(calls) {
376
376
  /** The real tool views for a set of calls — the escape hatch's payload. */
377
377
  export function ToolParts({ calls, sessionId, summary, }) {
378
378
  const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
379
- const visible = collapseSnapshots(calls);
379
+ // A failed `show` presented nothing: no row, no failure banner, no full-height slot.
380
+ const visible = collapseSnapshots(calls).filter((call) => !isUnpresentedFailure(call));
380
381
  // A step's own icon already went red for this (StepIcon, ContextCard) — but
381
382
  // that glance lives on the panel's home, one screen back. Once the user has
382
383
  // actually opened the failed step, the detail must say so too, not just show
@@ -1,6 +1,6 @@
1
1
  import { shouldShowToolPart } from '../../../internal/session-types/index.js';
2
2
  import { sessionLogOpenCall } from '@kortix/sdk';
3
- import { shouldShowToolPartInActionsPanel } from '../../tool/tool-renderers.js';
3
+ import { isUnpresentedFailure, shouldShowToolPartInActionsPanel } from '../../tool/tool-renderers.js';
4
4
  /**
5
5
  * Flatten a thread's messages into the ordered list of tool calls worth
6
6
  * showing — the same set the chat transcript renders. Every message counts,
@@ -48,7 +48,7 @@ export function collectAllToolCalls(messages) {
48
48
  if (block.type !== 'tool_call')
49
49
  continue;
50
50
  const call = sessionLogOpenCall(block);
51
- if (shouldShowToolPart(call))
51
+ if (shouldShowToolPart(call) && !isUnpresentedFailure(call))
52
52
  calls.push(call);
53
53
  }
54
54
  }
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from 'react';
3
- import { narrationToolName } from '@kortix/sdk';
3
+ import { narrationToolName, normalizeActivityToolName } from '@kortix/sdk';
4
4
  import { useClearFocusedToolCall, useFocusedAgent, useFocusedToolCallId, useKortixComputerStore } from '../../../internal/stores/kortix-computer-store.js';
5
5
  import { SubagentPanel } from '../../agents/subagent-view.js';
6
6
  import { DetailSidebarToggle, ToolParts } from '../easy/detail-view.js';
@@ -116,11 +116,31 @@ export function usePanelHandoffs({ sessionId, projectId, projectSessionId, isRun
116
116
  */
117
117
  const focusedToolCallId = useFocusedToolCallId();
118
118
  const clearFocusedToolCall = useClearFocusedToolCall();
119
+ // The detail a `show` call opened, by key and call id. A detail holds its calls as
120
+ // they were when it opened, so a show opened while running and then failed would
121
+ // keep showing it; once the call leaves `calls` (a failed show presents nothing),
122
+ // its detail closes.
123
+ const openedShowRef = useRef(null);
124
+ useEffect(() => {
125
+ const opened = openedShowRef.current;
126
+ if (!opened || detail?.key !== opened.key)
127
+ return;
128
+ if (calls.some((c) => c.call_id === opened.callId))
129
+ return;
130
+ openedShowRef.current = null;
131
+ closeDetail();
132
+ }, [calls, detail, closeDetail]);
119
133
  useEffect(() => {
120
134
  if (!focusedToolCallId)
121
135
  return;
136
+ const focused = calls.find((c) => c.call_id === focusedToolCallId);
137
+ const focusedName = normalizeActivityToolName(focused?.name);
138
+ const rememberShow = (key) => {
139
+ openedShowRef.current = focusedName === 'show' || focusedName === 'show_user' ? { key, callId: focusedToolCallId } : null;
140
+ };
122
141
  const step = stepForCallId(steps, focusedToolCallId);
123
142
  if (step) {
143
+ rememberShow(`step:${step.id}:${focusedToolCallId}`);
124
144
  openDetail({
125
145
  // The call id is part of the key on purpose: a step is a GROUP, and
126
146
  // two clicks on different commands inside it produce the same
@@ -142,9 +162,10 @@ export function usePanelHandoffs({ sessionId, projectId, projectSessionId, isRun
142
162
  // before this effect ran), so open the call ITSELF instead of leaving a
143
163
  // blank panel. The focus stays armed until a detail exists, so a lagging
144
164
  // derivation lands on it rather than eating the click.
145
- const call = calls.find((c) => c.call_id === focusedToolCallId);
165
+ const call = focused;
146
166
  if (!call)
147
167
  return;
168
+ rememberShow(`tool:${focusedToolCallId}`);
148
169
  openDetail({
149
170
  key: `tool:${focusedToolCallId}`,
150
171
  title: narrationToolName(call.name),
@@ -49,5 +49,5 @@ export function SessionBodyRow({ children, actionPanel = true, transient = false
49
49
  return (
50
50
  // `@container/session-body`: the action panel caps its width at half of
51
51
  // this row (`50cqw`), so the chat always keeps the other half.
52
- _jsxs("div", { className: "@container/session-body flex min-h-0 flex-1 overflow-hidden", children: [_jsx("div", { className: "relative flex min-w-0 flex-1 flex-col", "data-toast-anchor": "", children: children }), actionPanel && _jsx(SessionActionPanelColumn, { hotkey: !transient })] }));
52
+ _jsxs("div", { className: "@container/session-body flex min-h-0 flex-1 overflow-hidden", children: [_jsx("div", { className: "relative flex min-w-0 flex-1 flex-col", children: children }), actionPanel && _jsx(SessionActionPanelColumn, { hotkey: !transient })] }));
53
53
  }
@@ -95,6 +95,11 @@ export declare const ToolDurationContext: import("react").Context<number | undef
95
95
  * what happened and offers no fix (connect a model, reconnect ChatGPT).
96
96
  */
97
97
  export declare const ReadOnlySessionContext: import("react").Context<boolean>;
98
+ /**
99
+ * A failed `show` presented nothing, so no surface draws it (2026-11-16). Of failed
100
+ * calls, `isInvisibleActivityPart` names only that one: every other failure stays.
101
+ */
102
+ export declare function isUnpresentedFailure(call: ToolCallBlock): boolean;
98
103
  export declare function shouldShowToolPartInActionsPanel(call: ToolCallBlock): boolean;
99
104
  export declare const ToolActivateContext: import("react").Context<((callID: string) => void) | null>;
100
105
  export declare const BoundActivateContext: import("react").Context<(() => void) | null>;
@@ -116,6 +116,13 @@ const MEMORY_LOOKUP_TOOL_NAMES = new Set([
116
116
  'oc-mem_search',
117
117
  'oc-mem-search',
118
118
  ]);
119
+ /**
120
+ * A failed `show` presented nothing, so no surface draws it (2026-11-16). Of failed
121
+ * calls, `isInvisibleActivityPart` names only that one: every other failure stays.
122
+ */
123
+ export function isUnpresentedFailure(call) {
124
+ return call.status === 'error' && isInvisibleActivityPart(call);
125
+ }
119
126
  export function shouldShowToolPartInActionsPanel(call) {
120
127
  if (MEMORY_LOOKUP_TOOL_NAMES.has(call.name))
121
128
  return false;
@@ -5,15 +5,15 @@ import { type ToolCallBlock } from '@kortix/sdk';
5
5
  * through the ordinary `ToolPartRenderer` → `ShowTool` path. N single calls and
6
6
  * one N-item call render the same card.
7
7
  *
8
- * The merged call keeps the FIRST call's `id` and `call_id`. The segment that
9
- * was a lone `show` a moment ago renders under the same key, so the card is
10
- * not re-mounted when the next call joins it, and "Open" still targets a real
11
- * call.
8
+ * The merged call keeps the FIRST call's `id`: the segment that was a lone
9
+ * `show` a moment ago renders under the same key, so the card is not
10
+ * re-mounted when the next call joins it. Its `call_id` is the first call that
11
+ * did not fail, so "Open" targets what was shown, never a failed attempt.
12
12
  */
13
13
  declare function ShowGroupRendererImpl({ calls, sessionId, disableNavigation, }: {
14
14
  calls: ToolCallBlock[];
15
15
  sessionId?: string;
16
16
  disableNavigation?: boolean;
17
- }): import("react").JSX.Element;
17
+ }): import("react").JSX.Element | null;
18
18
  export declare const ShowGroupRenderer: import("react").MemoExoticComponent<typeof ShowGroupRendererImpl>;
19
19
  export {};
@@ -9,13 +9,16 @@ import { memo, useMemo } from 'react';
9
9
  * through the ordinary `ToolPartRenderer` → `ShowTool` path. N single calls and
10
10
  * one N-item call render the same card.
11
11
  *
12
- * The merged call keeps the FIRST call's `id` and `call_id`. The segment that
13
- * was a lone `show` a moment ago renders under the same key, so the card is
14
- * not re-mounted when the next call joins it, and "Open" still targets a real
15
- * call.
12
+ * The merged call keeps the FIRST call's `id`: the segment that was a lone
13
+ * `show` a moment ago renders under the same key, so the card is not
14
+ * re-mounted when the next call joins it. Its `call_id` is the first call that
15
+ * did not fail, so "Open" targets what was shown, never a failed attempt.
16
16
  */
17
17
  function ShowGroupRendererImpl({ calls, sessionId, disableNavigation, }) {
18
18
  const merged = useMemo(() => sessionLogShowGroupCall(calls), [calls]);
19
+ // Every call failed: a failed show presents nothing, so the card is not drawn.
20
+ if (calls.every((call) => call.status === 'error'))
21
+ return null;
19
22
  return _jsx(ToolPartRenderer, { call: merged, sessionId: sessionId, disableNavigation: disableNavigation });
20
23
  }
21
24
  export const ShowGroupRenderer = memo(ShowGroupRendererImpl);
@@ -5,7 +5,7 @@ import { STATUS_TEXT } from '../../primitives/status.js';
5
5
  import { QuestionPrompt } from '../prompts/question-prompt.js';
6
6
  import { SessionConnectCard } from '../prompts/session-connect-card.js';
7
7
  import { GenericTool } from './generic-tool.js';
8
- import { BasicTool, BoundActivateContext, partOutcome, StalePendingContext, ToolActivateContext, ToolDurationContext, ToolNavigationContext, ToolOutcomeContext, ToolRunningContext, ToolSurfaceContext, TurnLiveContext, } from './shared/infrastructure.js';
8
+ import { BasicTool, BoundActivateContext, partOutcome, StalePendingContext, ToolActivateContext, ToolDurationContext, ToolNavigationContext, ToolOutcomeContext, ToolRunningContext, ToolSurfaceContext, TurnLiveContext, isUnpresentedFailure, } from './shared/infrastructure.js';
9
9
  import { ToolRegistry } from './shared/registry.js';
10
10
  import { ToolError } from './tool-error.js';
11
11
  import { replyToInlinePermission } from './inline-permission-reply.js';
@@ -78,6 +78,8 @@ function ToolPartRendererImpl({ call: given, sessionId, permission, question, on
78
78
  // The SDK's verdict on tools that never render (a todo read, context bookkeeping).
79
79
  if (!shouldShowToolPart(call))
80
80
  return null;
81
+ if (isUnpresentedFailure(call))
82
+ return null;
81
83
  // A failed `task` dispatch is still a dispatch. OpenCode keeps the child
82
84
  // session alive through the failure (its id rides the part's
83
85
  // `state.metadata.sessionId`, or the `task_id:` sentence in the error), so
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Session tool renderers — public barrel.
3
3
  */
4
- export { BasicTool, ToolActivateContext, ToolSurfaceContext, TurnLiveContext, shouldShowToolPartInActionsPanel, type ToolSurface, } from './shared/infrastructure.js';
4
+ export { BasicTool, ToolActivateContext, ToolSurfaceContext, TurnLiveContext, isUnpresentedFailure, shouldShowToolPartInActionsPanel, type ToolSurface, } from './shared/infrastructure.js';
5
5
  export { GenericTool } from './generic-tool.js';
6
6
  export { ToolRegistry } from './shared/registry.js';
7
7
  export { ToolError } from './tool-error.js';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Session tool renderers — public barrel.
3
3
  */
4
- export { BasicTool, ToolActivateContext, ToolSurfaceContext, TurnLiveContext, shouldShowToolPartInActionsPanel, } from './shared/infrastructure.js';
4
+ export { BasicTool, ToolActivateContext, ToolSurfaceContext, TurnLiveContext, isUnpresentedFailure, shouldShowToolPartInActionsPanel, } from './shared/infrastructure.js';
5
5
  export { GenericTool } from './generic-tool.js';
6
6
  export { ToolRegistry } from './shared/registry.js';
7
7
  export { ToolError } from './tool-error.js';