@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.
- package/dist/_vendor/kortix-shared.js +1 -4
- package/dist/customize/sections/view/review-center-connected.js +64 -71
- package/dist/customize/sections/view/secret-delivery.d.ts +11 -20
- package/dist/customize/sections/view/secret-delivery.js +20 -29
- package/dist/customize/sections/view/secrets-view.js +9 -24
- package/dist/customize/settings/rail-copy-context.d.ts +2 -0
- package/dist/customize/settings/rail-copy-context.js +2 -0
- package/dist/customize/settings/tabs/chrome-connections-tab.js +1 -1
- package/dist/files/renderers/show-content-renderer.js +3 -1
- package/dist/i18n/en.d.ts +130 -22
- package/dist/i18n/en.js +142 -34
- package/dist/i18n/ui-catalog/product-catalog-translation-keys.generated.js +2 -0
- package/dist/internal/auth/auth-card-shell.d.ts +24 -3
- package/dist/internal/auth/auth-card-shell.js +15 -8
- package/dist/internal/auth/auth-primitives.d.ts +15 -2
- package/dist/internal/auth/auth-primitives.js +22 -5
- package/dist/internal/chrome/chrome-connect.d.ts +3 -5
- package/dist/internal/chrome/chrome-connect.js +7 -10
- package/dist/internal/chrome/extension.d.ts +1 -8
- package/dist/internal/chrome/extension.js +1 -8
- package/dist/internal/chrome/use-chrome-offered.d.ts +6 -12
- package/dist/internal/chrome/use-chrome-offered.js +13 -15
- package/dist/internal/components/agent-mark.d.ts +2 -1
- package/dist/internal/components/agent-mark.js +14 -3
- package/dist/internal/hooks/use-review-session-summary.d.ts +1 -1
- package/dist/internal/hooks/use-review-session-summary.js +1 -1
- package/dist/internal/layout/project-nav-row.d.ts +3 -1
- package/dist/internal/layout/project-nav-row.js +2 -2
- package/dist/internal/layout/project-page-header.js +5 -4
- package/dist/internal/stores/user-preferences-store.d.ts +17 -0
- package/dist/internal/stores/user-preferences-store.js +5 -0
- package/dist/markdown/setup-links/secret-intake-form.d.ts +4 -1
- package/dist/markdown/setup-links/secret-intake-form.js +60 -16
- package/dist/markdown/setup-links/setup-link-button.js +6 -1
- package/dist/primitives/color-picker.d.ts +19 -0
- package/dist/primitives/color-picker.js +27 -0
- package/dist/primitives/faded-scroll-area.js +4 -0
- package/dist/primitives/glyph-picker.d.ts +11 -0
- package/dist/primitives/glyph-picker.js +10 -6
- package/dist/primitives/gradient-wallpaper-gl.d.ts +61 -0
- package/dist/primitives/gradient-wallpaper-gl.js +446 -0
- package/dist/primitives/gradient-wallpaper.d.ts +20 -0
- package/dist/primitives/gradient-wallpaper.js +242 -0
- package/dist/primitives/resizable.d.ts +1 -1
- package/dist/session/agents/agent-hover-card.d.ts +26 -0
- package/dist/session/agents/agent-hover-card.js +70 -0
- package/dist/session/agents/agent-strip.js +33 -7
- package/dist/session/agents/agent-surface.d.ts +26 -1
- package/dist/session/agents/agent-surface.js +57 -6
- package/dist/session/agents/held-messages.js +2 -2
- package/dist/session/agents/subagent-dialog-content.js +2 -2
- package/dist/session/composer/ComposerCard.js +4 -4
- package/dist/session/composer/composer-toolbar.d.ts +8 -1
- package/dist/session/composer/composer-toolbar.js +2 -2
- package/dist/session/composer/dictation/dictation-control.d.ts +10 -0
- package/dist/session/composer/dictation/dictation-control.js +28 -0
- package/dist/session/composer/dictation/dictation-state.d.ts +26 -0
- package/dist/session/composer/dictation/dictation-state.js +71 -0
- package/dist/session/composer/dictation/recorder.d.ts +30 -0
- package/dist/session/composer/dictation/recorder.js +129 -0
- package/dist/session/composer/dictation/use-composer-dictation.d.ts +25 -0
- package/dist/session/composer/dictation/use-composer-dictation.js +218 -0
- package/dist/session/composer/queued-prompt-list.js +5 -1
- package/dist/session/panel/easy/apps-card.js +3 -10
- package/dist/session/panel/easy/background-tasks-card.d.ts +23 -0
- package/dist/session/panel/easy/background-tasks-card.js +119 -0
- package/dist/session/panel/easy/change-requests-card.js +1 -1
- package/dist/session/panel/easy/changes-card.js +4 -6
- package/dist/session/panel/easy/context-card.js +8 -9
- package/dist/session/panel/easy/context-meter.d.ts +2 -0
- package/dist/session/panel/easy/context-meter.js +18 -4
- package/dist/session/panel/easy/detail-view.js +7 -4
- package/dist/session/panel/easy/easy-panel-logic.d.ts +4 -15
- package/dist/session/panel/easy/easy-panel-logic.js +4 -17
- package/dist/session/panel/easy/easy-panel.js +5 -4
- package/dist/session/panel/easy/outputs-card.d.ts +1 -13
- package/dist/session/panel/easy/outputs-card.js +14 -40
- package/dist/session/panel/easy/panel-card.d.ts +13 -40
- package/dist/session/panel/easy/panel-card.js +17 -55
- package/dist/session/panel/easy/plan-card.js +4 -7
- package/dist/session/panel/model-switch-event.d.ts +2 -2
- package/dist/session/panel/model-switch-event.js +13 -9
- package/dist/session/panel/session-panel-provider.d.ts +2 -1
- package/dist/session/panel/session-panel-provider.js +3 -3
- package/dist/session/panel/shared/collect-tool-parts.js +2 -2
- package/dist/session/panel/shared/derive-panels.js +14 -1
- package/dist/session/panel/shared/use-panel-handoffs.d.ts +0 -1
- package/dist/session/panel/shared/use-panel-handoffs.js +26 -17
- package/dist/session/thread/chat-minimap.js +7 -1
- package/dist/session/thread/session-body.js +1 -1
- package/dist/session/thread/session-chat.js +59 -15
- package/dist/session/tool/shared/infrastructure-contexts.d.ts +7 -0
- package/dist/session/tool/shared/infrastructure-contexts.js +9 -0
- package/dist/session/tool/shared/infrastructure-row-header.js +4 -1
- package/dist/session/tool/shared/infrastructure-rows.js +19 -19
- package/dist/session/tool/show-group-renderer.d.ts +5 -5
- package/dist/session/tool/show-group-renderer.js +7 -4
- package/dist/session/tool/tool-part-renderer.js +25 -9
- package/dist/session/tool/tool-renderers.d.ts +1 -1
- package/dist/session/tool/tool-renderers.js +1 -1
- package/dist/session/tool/tools/bash-tool.js +3 -2
- package/dist/session/tool/tools/codemode-tool.d.ts +15 -0
- package/dist/session/tool/tools/codemode-tool.js +54 -2
- package/dist/session/tool/tools/kortix-action-tool.d.ts +1 -0
- package/dist/session/tool/tools/kortix-action-tool.js +19 -8
- package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +8 -1
- package/dist/session/tool/tools/multi-agent-tool-bodies.js +76 -10
- package/dist/session/tool/tools/task-tool.js +17 -5
- package/dist/session/turn/peer-message-row.d.ts +3 -0
- package/dist/session/turn/peer-message-row.js +8 -2
- package/dist/session/turn/subagent-notice-row.js +5 -3
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +130 -22
- package/dist/theme/index.d.ts +2 -1
- package/dist/theme/index.js +2 -1
- package/dist/theme/wallpaper-gradients.d.ts +106 -0
- package/dist/theme/wallpaper-gradients.js +347 -0
- package/dist/theme/wallpapers.d.ts +23 -3
- package/dist/theme/wallpapers.js +53 -29
- package/dist/workspace/admin/project-admin-dashboard.js +1 -1
- package/dist/workspace/layout/project-home.js +1 -1
- package/dist/workspace/new/use-create-workspace.d.ts +5 -3
- package/dist/workspace/new/use-create-workspace.js +1 -1
- package/dist/workspace/projects/modal/project-icon-field.d.ts +3 -1
- package/dist/workspace/projects/modal/project-icon-field.js +3 -3
- package/dist/workspace/review/review-center.d.ts +9 -1
- package/dist/workspace/review/review-center.js +107 -14
- package/dist/workspace/review/review-detail.d.ts +19 -0
- package/dist/workspace/review/review-detail.js +18 -3
- package/dist/workspace/review/review-swipe-deck.d.ts +27 -0
- package/dist/workspace/review/review-swipe-deck.js +304 -0
- package/dist/workspace/review/review-swipe.d.ts +17 -0
- package/dist/workspace/review/review-swipe.js +10 -0
- package/dist/workspace/session-spaces/space-picker.js +3 -3
- package/dist/workspace/setup/setup-banner-snooze.d.ts +10 -0
- package/dist/workspace/setup/setup-banner-snooze.js +44 -0
- package/dist/workspace/setup/setup-banner.js +19 -36
- package/dist/workspace/setup/setup-steps.d.ts +0 -5
- package/dist/workspace/setup/setup-steps.js +0 -7
- package/dist/workspace/setup/workspace-setup-modal.d.ts +39 -0
- package/dist/workspace/setup/workspace-setup-modal.js +202 -0
- package/dist/workspace/sidebar/footer/project-review-nav.d.ts +13 -0
- package/dist/workspace/sidebar/footer/project-review-nav.js +29 -0
- package/dist/workspace/sidebar/project-nav-items.d.ts +3 -1
- package/dist/workspace/sidebar/project-nav-items.js +24 -5
- package/dist/workspace/sidebar/project-session-list.js +2 -1
- package/dist/workspace/sidebar/project-sidebar.js +6 -5
- package/dist/workspace/sidebar/project-spaces-nav.js +3 -10
- package/dist/workspace/sidebar/sidebar-more-group.js +1 -1
- package/package.json +14 -10
- package/skills/kortix-ui/SKILL.md +1 -1
- package/skills/kortix-ui/references/modules.md +3 -1
- package/dist/primitives/toast-clearance.d.ts +0 -36
- package/dist/primitives/toast-clearance.js +0 -94
- package/dist/workspace/setup/workspace-setup-page.d.ts +0 -10
- package/dist/workspace/setup/workspace-setup-page.js +0 -91
|
@@ -21,7 +21,8 @@ import { looksLikeHtml, parseWebSearchOutput, wsDomain, } from '@kortix/sdk';
|
|
|
21
21
|
import { getToolPrimaryArg, normalizeName } from '../../tool/tool-meta.js';
|
|
22
22
|
import { extractReadableHtml } from '../../../_vendor/kortix-shared.js';
|
|
23
23
|
import { contextLabelForTool, createArtifactKind, familyForTool, narrationToolName as humanizeToolName, } from '@kortix/sdk';
|
|
24
|
-
import { imageGenView, toolCallMetadata, toolKind } from '@kortix/sdk';
|
|
24
|
+
import { imageGenView, parseReachable, toolCallMetadata, toolKind } from '@kortix/sdk';
|
|
25
|
+
import { multiAgentTool, parseKortixToolResult } from '../../tool/tools/kortix-tool-card.js';
|
|
25
26
|
function filePathOf(call) {
|
|
26
27
|
const input = inputOf(call);
|
|
27
28
|
const p = input.filePath ?? input.file_path ?? input.path;
|
|
@@ -59,6 +60,11 @@ function inputOf(call) {
|
|
|
59
60
|
? input
|
|
60
61
|
: {};
|
|
61
62
|
}
|
|
63
|
+
/** A `list_agents` call that answered with no agent besides the asking session. */
|
|
64
|
+
function foundNoAgents(call) {
|
|
65
|
+
const result = parseKortixToolResult(rawOutputOf(call), call.name);
|
|
66
|
+
return (parseReachable(result?.data)?.length ?? 0) === 0;
|
|
67
|
+
}
|
|
62
68
|
/** A completed call's output text as the tool returned it, without the
|
|
63
69
|
* bash-only tag stripping `partOutput` (tool/shared/infrastructure.tsx) does —
|
|
64
70
|
* image_gen/presentation_gen output is a flat JSON payload, never bash's
|
|
@@ -483,6 +489,13 @@ export function deriveContext(calls) {
|
|
|
483
489
|
const family = familyForTool(call.name);
|
|
484
490
|
if (family === 'hidden')
|
|
485
491
|
continue; // context-engine bookkeeping — never shown
|
|
492
|
+
// A question the agent asked the user is not something it looked at: the
|
|
493
|
+
// chat already shows it, with the answer.
|
|
494
|
+
if (toolKind(call.name) === 'question')
|
|
495
|
+
continue;
|
|
496
|
+
// A check for other agents that found none says nothing: no row.
|
|
497
|
+
if (multiAgentTool(call.name) === 'list_agents' && foundNoAgents(call))
|
|
498
|
+
continue;
|
|
486
499
|
if (toolKind(call.name) === 'read') {
|
|
487
500
|
const path = filePathOf(call) ?? getToolPrimaryArg(call);
|
|
488
501
|
if (!path || seenFiles.has(path))
|
|
@@ -2,7 +2,6 @@ import type { SessionPanelValue } from '../session-panel-provider.js';
|
|
|
2
2
|
import type { usePanelDerivations } from './use-panel-derivations.js';
|
|
3
3
|
type Handoffs = Pick<SessionPanelValue, 'sessionId' | 'projectId' | 'projectSessionId' | 'detail' | 'handleOpenOutput' | 'openDetail' | 'closeDetail' | 'openTerminal' | 'openAudit' | 'openReminders' | 'openDesktop' | 'openBrowser' | 'openFiles'> & Pick<ReturnType<typeof usePanelDerivations>, 'isRunning' | 'outcome' | 'apps' | 'files' | 'steps' | 'calls'>;
|
|
4
4
|
export declare function usePanelHandoffs({ sessionId, projectId, projectSessionId, isRunning, outcome, apps, files, steps, calls, detail, handleOpenOutput, openDetail, closeDetail, openTerminal, openAudit, openReminders, openDesktop, openBrowser, openFiles, }: Handoffs): {
|
|
5
|
-
outputsDefaultOpen: boolean;
|
|
6
5
|
pendingQuickView: {
|
|
7
6
|
sessionId: string;
|
|
8
7
|
view: import("../../../internal/stores/kortix-computer-store.js").QuickView;
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef
|
|
3
|
-
import { narrationToolName } from '@kortix/sdk';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
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';
|
|
7
7
|
import { useSessionBrowserStore } from '../../../internal/stores/session-browser-store.js';
|
|
8
|
-
import { pathOutput,
|
|
8
|
+
import { pathOutput, shouldAutoOpenPayoff, stepForCallId } from '../easy/easy-panel-logic.js';
|
|
9
9
|
import { StepDetailBody } from '../easy/step-detail-body.js';
|
|
10
10
|
import { StepIcon } from '../easy/step-icon.js';
|
|
11
11
|
import { selectPrimaryDeliverable } from './output-priority.js';
|
|
12
12
|
export function usePanelHandoffs({ sessionId, projectId, projectSessionId, isRunning, outcome, apps, files, steps, calls, detail, handleOpenOutput, openDetail, closeDetail, openTerminal, openAudit, openReminders, openDesktop, openBrowser, openFiles, }) {
|
|
13
|
-
// Auto-expand Outputs the moment a run finishes with something to show —
|
|
14
|
-
// never on every render of an already-finished (or still-running) run, and
|
|
15
|
-
// never on a failed one: a pile of half-written files is not a celebration.
|
|
16
|
-
const wasRunningRef = useRef(isRunning);
|
|
17
|
-
const [outputsDefaultOpen, setOutputsDefaultOpen] = useState(false);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (outcome === 'succeeded' &&
|
|
20
|
-
shouldAutoExpandOutputs(wasRunningRef.current, isRunning, files.length)) {
|
|
21
|
-
setOutputsDefaultOpen(true);
|
|
22
|
-
}
|
|
23
|
-
wasRunningRef.current = isRunning;
|
|
24
|
-
}, [isRunning, files.length, outcome]);
|
|
25
13
|
// Payoff (W2): present the primary deliverable exactly once, at the finish,
|
|
26
14
|
// and only when the user hasn't taken the wheel themselves this run.
|
|
27
15
|
//
|
|
@@ -116,11 +104,31 @@ export function usePanelHandoffs({ sessionId, projectId, projectSessionId, isRun
|
|
|
116
104
|
*/
|
|
117
105
|
const focusedToolCallId = useFocusedToolCallId();
|
|
118
106
|
const clearFocusedToolCall = useClearFocusedToolCall();
|
|
107
|
+
// The detail a `show` call opened, by key and call id. A detail holds its calls as
|
|
108
|
+
// they were when it opened, so a show opened while running and then failed would
|
|
109
|
+
// keep showing it; once the call leaves `calls` (a failed show presents nothing),
|
|
110
|
+
// its detail closes.
|
|
111
|
+
const openedShowRef = useRef(null);
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
const opened = openedShowRef.current;
|
|
114
|
+
if (!opened || detail?.key !== opened.key)
|
|
115
|
+
return;
|
|
116
|
+
if (calls.some((c) => c.call_id === opened.callId))
|
|
117
|
+
return;
|
|
118
|
+
openedShowRef.current = null;
|
|
119
|
+
closeDetail();
|
|
120
|
+
}, [calls, detail, closeDetail]);
|
|
119
121
|
useEffect(() => {
|
|
120
122
|
if (!focusedToolCallId)
|
|
121
123
|
return;
|
|
124
|
+
const focused = calls.find((c) => c.call_id === focusedToolCallId);
|
|
125
|
+
const focusedName = normalizeActivityToolName(focused?.name);
|
|
126
|
+
const rememberShow = (key) => {
|
|
127
|
+
openedShowRef.current = focusedName === 'show' || focusedName === 'show_user' ? { key, callId: focusedToolCallId } : null;
|
|
128
|
+
};
|
|
122
129
|
const step = stepForCallId(steps, focusedToolCallId);
|
|
123
130
|
if (step) {
|
|
131
|
+
rememberShow(`step:${step.id}:${focusedToolCallId}`);
|
|
124
132
|
openDetail({
|
|
125
133
|
// The call id is part of the key on purpose: a step is a GROUP, and
|
|
126
134
|
// two clicks on different commands inside it produce the same
|
|
@@ -142,9 +150,10 @@ export function usePanelHandoffs({ sessionId, projectId, projectSessionId, isRun
|
|
|
142
150
|
// before this effect ran), so open the call ITSELF instead of leaving a
|
|
143
151
|
// blank panel. The focus stays armed until a detail exists, so a lagging
|
|
144
152
|
// derivation lands on it rather than eating the click.
|
|
145
|
-
const call =
|
|
153
|
+
const call = focused;
|
|
146
154
|
if (!call)
|
|
147
155
|
return;
|
|
156
|
+
rememberShow(`tool:${focusedToolCallId}`);
|
|
148
157
|
openDetail({
|
|
149
158
|
key: `tool:${focusedToolCallId}`,
|
|
150
159
|
title: narrationToolName(call.name),
|
|
@@ -212,5 +221,5 @@ export function usePanelHandoffs({ sessionId, projectId, projectSessionId, isRun
|
|
|
212
221
|
openBrowser,
|
|
213
222
|
openFiles,
|
|
214
223
|
]);
|
|
215
|
-
return {
|
|
224
|
+
return { pendingQuickView };
|
|
216
225
|
}
|
|
@@ -130,7 +130,13 @@ export function ChatMinimap({ turns, scrollRef, contentRef }) {
|
|
|
130
130
|
// Focus opens the card and magnifies the dash, but a keyboard
|
|
131
131
|
// user still needs a ring they can locate — it goes on the ROW,
|
|
132
132
|
// because a ring around a 3px dash is unreadable.
|
|
133
|
-
className: cn('hit-area-x-5 last:hit-area-b-3 first:hit-area-t-3 flex cursor-pointer items-center justify-start rounded-sm px-0.5', 'focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none'), onPointerEnter: () => focusRow(row), onFocus: () => focusRow(row), onBlur: () => focusRow(null),
|
|
133
|
+
className: cn('hit-area-x-5 last:hit-area-b-3 first:hit-area-t-3 flex cursor-pointer items-center justify-start rounded-sm px-0.5', 'focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none'), onPointerEnter: () => focusRow(row), onFocus: () => focusRow(row), onBlur: () => focusRow(null),
|
|
134
|
+
// The jump shows the message itself, so its preview closes: a preview left
|
|
135
|
+
// over the transcript hid the very text the reader jumped to.
|
|
136
|
+
onClick: () => {
|
|
137
|
+
handleJump(item.id);
|
|
138
|
+
focusRow(null);
|
|
139
|
+
}, children: _jsx("span", { "aria-hidden": true, style: {
|
|
134
140
|
width: dashWidth(distance),
|
|
135
141
|
height: DASH_THICKNESS,
|
|
136
142
|
opacity: dashOpacity(distance),
|
|
@@ -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",
|
|
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
|
}
|
|
@@ -1447,9 +1447,27 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1447
1447
|
}));
|
|
1448
1448
|
return parked.length ? [...livePermissions, ...parked] : livePermissions;
|
|
1449
1449
|
}, [livePermissions, parkedAsks, sessionId]);
|
|
1450
|
+
// A question the person answered or dismissed stays hidden for this mount,
|
|
1451
|
+
// even while a source still lists it: the live list can keep a replied
|
|
1452
|
+
// question for minutes (until the turn moves on), and the parked-asks poll
|
|
1453
|
+
// lags the answer. A card that came back would show nothing, because the
|
|
1454
|
+
// prompt hides itself once replied, and its collapsed wrapper left an empty
|
|
1455
|
+
// strip above the composer. A reply that fails releases the id, and the card
|
|
1456
|
+
// comes back as a fresh, answerable one (`questionRetries` remounts it).
|
|
1450
1457
|
const suppressedQuestionIdsRef = useRef(new Map());
|
|
1451
|
-
|
|
1458
|
+
// Retries per question: a failed reply remounts only its own card.
|
|
1459
|
+
const [questionRetries, setQuestionRetries] = useState({});
|
|
1460
|
+
// A ref write renders nothing: the tick makes the question lists re-read the
|
|
1461
|
+
// map, so a hidden card leaves at once instead of after the reply lands.
|
|
1462
|
+
const [suppressTick, setSuppressTick] = useState(0);
|
|
1463
|
+
const suppressQuestionFor = useCallback((requestId, ms = Number.POSITIVE_INFINITY) => {
|
|
1452
1464
|
suppressedQuestionIdsRef.current.set(requestId, Date.now() + ms);
|
|
1465
|
+
setSuppressTick((n) => n + 1);
|
|
1466
|
+
}, []);
|
|
1467
|
+
const releaseQuestion = useCallback((requestId) => {
|
|
1468
|
+
suppressedQuestionIdsRef.current.delete(requestId);
|
|
1469
|
+
setSuppressTick((n) => n + 1);
|
|
1470
|
+
setQuestionRetries((retries) => ({ ...retries, [requestId]: (retries[requestId] ?? 0) + 1 }));
|
|
1453
1471
|
}, []);
|
|
1454
1472
|
const isQuestionSuppressed = useCallback((requestId) => {
|
|
1455
1473
|
const expiresAt = suppressedQuestionIdsRef.current.get(requestId);
|
|
@@ -1462,14 +1480,18 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1462
1480
|
return true;
|
|
1463
1481
|
}, []);
|
|
1464
1482
|
const liveQuestions = useMemo(() => (sessionState?.questions ??
|
|
1465
|
-
Object.values(allQuestions).filter((q) => q.sessionID === sessionId)).filter((q) => !isQuestionSuppressed(q.id)),
|
|
1483
|
+
Object.values(allQuestions).filter((q) => q.sessionID === sessionId)).filter((q) => !isQuestionSuppressed(q.id)),
|
|
1484
|
+
// `suppressTick` re-reads the suppression map when a card hides or returns.
|
|
1485
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1486
|
+
[sessionState?.questions, allQuestions, sessionId, isQuestionSuppressed, suppressTick]);
|
|
1466
1487
|
const pendingQuestions = useMemo(() => {
|
|
1467
1488
|
const live = new Set(liveQuestions.map((q) => q.id));
|
|
1468
1489
|
const parked = parkedAsks
|
|
1469
1490
|
.filter((ask) => ask.kind === 'question' && ask.question && !live.has(ask.request_id) && !isQuestionSuppressed(ask.request_id))
|
|
1470
1491
|
.map((ask) => ({ id: ask.request_id, sessionID: sessionId, questions: ask.question.questions }));
|
|
1471
1492
|
return parked.length ? [...liveQuestions, ...parked] : liveQuestions;
|
|
1472
|
-
|
|
1493
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1494
|
+
}, [liveQuestions, parkedAsks, sessionId, isQuestionSuppressed, suppressTick]);
|
|
1473
1495
|
/**
|
|
1474
1496
|
* The runtime is parked on an answer only the user can give.
|
|
1475
1497
|
*
|
|
@@ -1542,12 +1564,13 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1542
1564
|
// stayed open (KRTX-4450). A question in neither list is one just answered,
|
|
1543
1565
|
// held only for its fade-out: unlocked, so text typed into the fade is a
|
|
1544
1566
|
// message, never a swallowed answer.
|
|
1567
|
+
// From the filtered list: a question hidden after its answer (still in the
|
|
1568
|
+
// asks cache while the reply lands) must not take the next message.
|
|
1545
1569
|
const questionLock = useMemo(() => {
|
|
1546
1570
|
if (!renderedQuestion)
|
|
1547
1571
|
return false;
|
|
1548
|
-
return
|
|
1549
|
-
|
|
1550
|
-
}, [renderedQuestion, liveQuestions, parkedAskIdByRequest]);
|
|
1572
|
+
return pendingQuestions.some((q) => q.id === renderedQuestion.id);
|
|
1573
|
+
}, [renderedQuestion, pendingQuestions]);
|
|
1551
1574
|
// Transcript-placed waiting entries share the turn renderer. The inbox marks their IDs as
|
|
1552
1575
|
// pending until delivery; a client-minted wire ID does not place a message.
|
|
1553
1576
|
// Each is the user message `sessionLogPromptMessage` mints for its prompt.
|
|
@@ -2090,24 +2113,34 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2090
2113
|
// answer against the tool part's ID.
|
|
2091
2114
|
const questionReq = sessionState?.questions.find((question) => question.id === requestId) ??
|
|
2092
2115
|
useRuntimePendingStore.getState().questions[requestId];
|
|
2116
|
+
// Hide the card at once; the question leaves the store only once the
|
|
2117
|
+
// answer lands. A failed reply then needs no restore (which could bring
|
|
2118
|
+
// back a question the runtime did answer): releasing the hide is enough.
|
|
2093
2119
|
suppressQuestionFor(requestId);
|
|
2094
|
-
// Optimistically remove the question so the textarea shows immediately
|
|
2095
|
-
removeQuestion(requestId);
|
|
2096
2120
|
const parkedAskId = liveQuestions.some((q) => q.id === requestId) ? undefined : parkedAskIdByRequest.get(requestId);
|
|
2097
2121
|
if (parkedAskId) {
|
|
2098
2122
|
// Parked: the answer reaches the agent as a message that quotes the question.
|
|
2099
|
-
|
|
2123
|
+
// Awaited per request: a second decision must not replace this one's outcome.
|
|
2124
|
+
try {
|
|
2125
|
+
await answerParkedAsk.mutateAsync({ askId: parkedAskId, answer: { answers } });
|
|
2126
|
+
removeQuestion(requestId);
|
|
2127
|
+
}
|
|
2128
|
+
catch {
|
|
2129
|
+
releaseQuestion(requestId);
|
|
2130
|
+
}
|
|
2100
2131
|
return;
|
|
2101
2132
|
}
|
|
2102
2133
|
// Save the answers in the optimistic cache keyed by the question call's
|
|
2103
2134
|
// block id. This cache survives updates that may overwrite the call
|
|
2104
2135
|
// before the server includes its answers; the transcript's answered
|
|
2105
2136
|
// questions read from it as a fallback.
|
|
2137
|
+
let cachedBlockId = null;
|
|
2106
2138
|
if (questionReq?.tool?.messageID) {
|
|
2107
2139
|
const { messageID, callID } = questionReq.tool;
|
|
2108
2140
|
const message = threadRef.current?.messages.find((m) => m.message_id === messageID);
|
|
2109
2141
|
const match = message?.blocks.find((b) => b.type === 'tool_call' && isQuestionTool(b.name) && b.call_id === callID);
|
|
2110
2142
|
if (match?.type === 'tool_call') {
|
|
2143
|
+
cachedBlockId = match.id;
|
|
2111
2144
|
optimisticAnswersCache.set(match.id, {
|
|
2112
2145
|
answers,
|
|
2113
2146
|
input: match.input && typeof match.input === 'object'
|
|
@@ -2121,11 +2154,16 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2121
2154
|
await sessionState.answerQuestion(requestId, answers);
|
|
2122
2155
|
else
|
|
2123
2156
|
await replyToQuestion(requestId, answers);
|
|
2157
|
+
removeQuestion(requestId);
|
|
2124
2158
|
}
|
|
2125
2159
|
catch {
|
|
2126
|
-
//
|
|
2160
|
+
// The answer did not land: the card comes back, fresh, if the question
|
|
2161
|
+
// is still open. The cached answer goes: the transcript must not show it.
|
|
2162
|
+
if (cachedBlockId)
|
|
2163
|
+
optimisticAnswersCache.delete(cachedBlockId);
|
|
2164
|
+
releaseQuestion(requestId);
|
|
2127
2165
|
}
|
|
2128
|
-
}, [sessionState, removeQuestion, suppressQuestionFor, liveQuestions, parkedAskIdByRequest, answerParkedAsk]);
|
|
2166
|
+
}, [sessionState, removeQuestion, suppressQuestionFor, releaseQuestion, liveQuestions, parkedAskIdByRequest, answerParkedAsk]);
|
|
2129
2167
|
const handleQuestionReject = useCallback(async (requestId) => {
|
|
2130
2168
|
suppressQuestionFor(requestId);
|
|
2131
2169
|
// Optimistically remove the question so the textarea shows immediately
|
|
@@ -2133,7 +2171,12 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2133
2171
|
const parkedAskId = liveQuestions.some((q) => q.id === requestId) ? undefined : parkedAskIdByRequest.get(requestId);
|
|
2134
2172
|
if (parkedAskId) {
|
|
2135
2173
|
// Dismissing a parked question closes it; nothing runs, so nothing is stopped.
|
|
2136
|
-
|
|
2174
|
+
try {
|
|
2175
|
+
await answerParkedAsk.mutateAsync({ askId: parkedAskId, answer: { dismiss: true } });
|
|
2176
|
+
}
|
|
2177
|
+
catch {
|
|
2178
|
+
releaseQuestion(requestId);
|
|
2179
|
+
}
|
|
2137
2180
|
return;
|
|
2138
2181
|
}
|
|
2139
2182
|
try {
|
|
@@ -2143,7 +2186,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2143
2186
|
await rejectQuestion(requestId);
|
|
2144
2187
|
}
|
|
2145
2188
|
catch {
|
|
2146
|
-
// ignore —
|
|
2189
|
+
// ignore — the cancel below ends the turn the question holds
|
|
2147
2190
|
}
|
|
2148
2191
|
// Also abort the session so the "The operation was aborted." banner
|
|
2149
2192
|
// appears. Routed through `issueSessionCancel` (T10) so this
|
|
@@ -2155,7 +2198,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2155
2198
|
else if (!abortSession.isPending) {
|
|
2156
2199
|
issueSessionCancel();
|
|
2157
2200
|
}
|
|
2158
|
-
}, [sessionState, removeQuestion, abortSession, suppressQuestionFor, issueSessionCancel]);
|
|
2201
|
+
}, [sessionState, removeQuestion, abortSession, suppressQuestionFor, releaseQuestion, liveQuestions, parkedAskIdByRequest, answerParkedAsk, issueSessionCancel]);
|
|
2159
2202
|
// A compaction turn of any state (`turn.compaction`), so a failed attempt's
|
|
2160
2203
|
// turn suppresses the optimistic "Compacting…" marker instead of leaving it
|
|
2161
2204
|
// shimmering beside the failure row.
|
|
@@ -3501,7 +3544,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3501
3544
|
]);
|
|
3502
3545
|
const chatInputSlot = useMemo(() => (_jsxs(_Fragment, { children: [_jsx(SessionApprovalPrompt, { onDockedChange: setApprovalDocked }), _jsx(SessionAccessPrompt, { projectId: projectId ?? '', asks: accessAsks, onDockedChange: setAccessDocked }), _jsx(SessionPermissionPrompt, { sessionId: sessionId, agentName: sessionScopeAgentName, permissions: pendingPermissions, onReply: handlePermissionReply }), renderedQuestion ? (_jsx("div", { className: cn('w-full overflow-hidden transition-[max-height,opacity,transform] ease-in-out', questionPromptVisible
|
|
3503
3546
|
? 'duration-slow max-h-130 translate-y-0 opacity-100'
|
|
3504
|
-
: 'duration-slow pointer-events-none max-h-0 -translate-y-1 opacity-0'), children: _jsx(QuestionPrompt, { ref: questionPromptRef, request: renderedQuestion, onReply: handleQuestionReply, onReject: handleQuestionReject, onActionChange: handleQuestionActionChange }, renderedQuestion.id) })) : null] })), [
|
|
3547
|
+
: 'duration-slow pointer-events-none max-h-0 -translate-y-1 opacity-0'), children: _jsx(QuestionPrompt, { ref: questionPromptRef, request: renderedQuestion, onReply: handleQuestionReply, onReject: handleQuestionReject, onActionChange: handleQuestionActionChange }, `${renderedQuestion.id}:${questionRetries[renderedQuestion.id] ?? 0}`) })) : null] })), [
|
|
3505
3548
|
projectId,
|
|
3506
3549
|
accessAsks,
|
|
3507
3550
|
sessionId,
|
|
@@ -3509,6 +3552,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3509
3552
|
pendingPermissions,
|
|
3510
3553
|
handlePermissionReply,
|
|
3511
3554
|
renderedQuestion,
|
|
3555
|
+
questionRetries,
|
|
3512
3556
|
questionPromptVisible,
|
|
3513
3557
|
handleQuestionReply,
|
|
3514
3558
|
handleQuestionReject,
|
|
@@ -90,11 +90,18 @@ export declare const ImageGenRunsContext: import("react").Context<ReadonlyMap<st
|
|
|
90
90
|
*/
|
|
91
91
|
export declare const InTranscriptTurnContext: import("react").Context<boolean>;
|
|
92
92
|
export declare const ToolDurationContext: import("react").Context<number | undefined>;
|
|
93
|
+
/** When the call started (ISO), for rows that show a time. */
|
|
94
|
+
export declare const ToolStartedAtContext: import("react").Context<string | undefined>;
|
|
93
95
|
/**
|
|
94
96
|
* True in a read-only session view (the sub-session modal): a tool card shows
|
|
95
97
|
* what happened and offers no fix (connect a model, reconnect ChatGPT).
|
|
96
98
|
*/
|
|
97
99
|
export declare const ReadOnlySessionContext: import("react").Context<boolean>;
|
|
100
|
+
/**
|
|
101
|
+
* A failed `show` presented nothing, so no surface draws it (2026-11-16). Of failed
|
|
102
|
+
* calls, `isInvisibleActivityPart` names only that one: every other failure stays.
|
|
103
|
+
*/
|
|
104
|
+
export declare function isUnpresentedFailure(call: ToolCallBlock): boolean;
|
|
98
105
|
export declare function shouldShowToolPartInActionsPanel(call: ToolCallBlock): boolean;
|
|
99
106
|
export declare const ToolActivateContext: import("react").Context<((callID: string) => void) | null>;
|
|
100
107
|
export declare const BoundActivateContext: import("react").Context<(() => void) | null>;
|
|
@@ -94,6 +94,8 @@ export const ImageGenRunsContext = createContext(new Map());
|
|
|
94
94
|
*/
|
|
95
95
|
export const InTranscriptTurnContext = createContext(false);
|
|
96
96
|
export const ToolDurationContext = createContext(undefined);
|
|
97
|
+
/** When the call started (ISO), for rows that show a time. */
|
|
98
|
+
export const ToolStartedAtContext = createContext(undefined);
|
|
97
99
|
/**
|
|
98
100
|
* True in a read-only session view (the sub-session modal): a tool card shows
|
|
99
101
|
* what happened and offers no fix (connect a model, reconnect ChatGPT).
|
|
@@ -116,6 +118,13 @@ const MEMORY_LOOKUP_TOOL_NAMES = new Set([
|
|
|
116
118
|
'oc-mem_search',
|
|
117
119
|
'oc-mem-search',
|
|
118
120
|
]);
|
|
121
|
+
/**
|
|
122
|
+
* A failed `show` presented nothing, so no surface draws it (2026-11-16). Of failed
|
|
123
|
+
* calls, `isInvisibleActivityPart` names only that one: every other failure stays.
|
|
124
|
+
*/
|
|
125
|
+
export function isUnpresentedFailure(call) {
|
|
126
|
+
return call.status === 'error' && isInvisibleActivityPart(call);
|
|
127
|
+
}
|
|
119
128
|
export function shouldShowToolPartInActionsPanel(call) {
|
|
120
129
|
if (MEMORY_LOOKUP_TOOL_NAMES.has(call.name))
|
|
121
130
|
return false;
|
|
@@ -119,7 +119,10 @@ export function PanelRowTitle({ trigger, running, onSubtitleClick, }) {
|
|
|
119
119
|
// Same read, same reason as the inline row — one behaviour, two surfaces.
|
|
120
120
|
const open = useToolOpen();
|
|
121
121
|
const subtitle = open && trigger.hideSubtitleWhenOpen ? undefined : trigger.subtitle;
|
|
122
|
-
return (_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2 overflow-hidden", children: [running ? (_jsx(TextShimmer, { className: cn(PANEL_TITLE_CLASS, 'text-sm
|
|
122
|
+
return (_jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2 overflow-hidden", children: [running ? (_jsx(TextShimmer, { className: cn(PANEL_TITLE_CLASS, 'text-sm'), children: trigger.title || 'Working' })) : (
|
|
123
|
+
// The verb is meta ink when a value follows it: the value is what the
|
|
124
|
+
// reader scans for. Alone, the title is the row's name.
|
|
125
|
+
_jsx("span", { className: cn('text-sm', subtitle ? 'text-muted-foreground' : 'text-foreground', PANEL_TITLE_CLASS), children: trigger.title })), subtitle && (_jsx("span", { className: cn('text-foreground min-w-0 truncate font-mono text-xs', onSubtitleClick &&
|
|
123
126
|
'hover:text-foreground cursor-pointer underline-offset-2 hover:underline'), role: onSubtitleClick ? 'button' : undefined, tabIndex: onSubtitleClick ? 0 : undefined, title: subtitle, onKeyDown: onSubtitleClick
|
|
124
127
|
? (e) => {
|
|
125
128
|
if (e.key !== 'Enter' && e.key !== ' ')
|
|
@@ -19,14 +19,11 @@ import { isTriggerTitle } from './infrastructure-parts.js';
|
|
|
19
19
|
* A row inverts it: the detail opens as a list of one-line summaries, and the
|
|
20
20
|
* reader expands the one they came for.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* denser, plainer thing that rotates its chevron in CSS. Same vocabulary, not
|
|
28
|
-
* the same component. No rail, no connector, no per-row header: the gap between
|
|
29
|
-
* rows is the whole rhythm.
|
|
22
|
+
* Each call is its own card (`bg-popover rounded-md border`), and the list
|
|
23
|
+
* spaces the cards apart (`ToolParts`, `gap-2`). The caret points down once a
|
|
24
|
+
* card is open, and the body opens under one hairline inside the card. The
|
|
25
|
+
* verb ("Ran command") is meta ink; the value it acted on (the command, the
|
|
26
|
+
* path, the query) is the bright text.
|
|
30
27
|
*
|
|
31
28
|
* Interaction is gated on having a body — a childless call has nothing to
|
|
32
29
|
* disclose, so it gets no chevron, no `role="button"`, and no cursor change
|
|
@@ -40,17 +37,20 @@ function PanelToolRow({ icon, trigger, children, running, badge, outcome, onSubt
|
|
|
40
37
|
// call leads with the verdict on both surfaces or the two disagree about what
|
|
41
38
|
// happened. See {@link ToolOutcomeIcon}.
|
|
42
39
|
const leading = outcome === 'ok' ? icon : _jsx(ToolOutcomeIcon, { outcome: outcome });
|
|
43
|
-
const row = (_jsxs("div", { className: cn(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
const row = (_jsxs("div", { className: cn(
|
|
41
|
+
// `items-start` + one-line slots (`h-[1lh]`): every glyph sits on the
|
|
42
|
+
// first line, so a two-line row (an agent and its task) keeps its
|
|
43
|
+
// icon, state and caret beside the name, not between the lines.
|
|
44
|
+
'flex min-h-10 w-full items-start gap-2.5 px-3 py-2.5 text-left text-sm', hasBody && 'transition-colors duration-(--duration-fast)', hasBody && !locked && 'hover:bg-hover cursor-pointer'), children: [leading && (_jsx("span", { className: "text-muted-foreground flex h-[1lh] w-4 shrink-0 items-center justify-center [&>svg]:size-4", children: leading })), isTriggerTitle(trigger) ? (_jsx(PanelRowTitle, { trigger: trigger, running: running, onSubtitleClick: onSubtitleClick })) : (
|
|
45
|
+
// `overflow-hidden` CLIPS an over-long node at the badge rather than
|
|
46
|
+
// pushing the chevron off the card; the row is one line.
|
|
47
|
+
// A row, not a block: a node trigger is flex children (a lead word, an
|
|
48
|
+
// agent chip, a subtitle), and a block stacked them one per line.
|
|
49
|
+
_jsx("div", { className: "[&>span:first-child>svg]:text-muted-foreground text-foreground flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden text-sm font-medium whitespace-nowrap [&>span:first-child>svg]:size-4", children: trigger })), badge && (_jsx("span", { className: "text-muted-foreground flex h-[1lh] shrink-0 items-center font-mono text-xs whitespace-nowrap tabular-nums", children: badge })), action && _jsx("span", { className: "flex h-[1lh] shrink-0 items-center", children: action }), hasBody && (_jsx("span", { className: "flex h-[1lh] shrink-0 items-center", children: _jsx(CaretRightIcon, { "aria-hidden": true,
|
|
50
|
+
// CSS, not `motion` — the rotation is a 150ms state change on one
|
|
51
|
+
// property, and every row on the pane would otherwise carry a
|
|
52
|
+
// motion component. `motion-reduce` snaps it instead.
|
|
53
|
+
className: cn('text-muted-foreground size-4 shrink-0 transition-transform motion-reduce:transition-none', open && 'rotate-90') }) }))] }));
|
|
54
54
|
return (_jsxs(Disclosure, { open: open, onOpenChange: onOpenChange, className: "bg-popover border-border overflow-hidden rounded-md border", children: [hasBody ? _jsx(DisclosureTrigger, { children: row }) : row, hasBody && (_jsx(DisclosureContent, { children: _jsx("div", { className: cn('border-border border-t px-3 py-3 text-sm', className), children: children }) }))] }));
|
|
55
55
|
}
|
|
56
56
|
// Inline row that acts as a plain button (fires `onClick`, no disclosure).
|
|
@@ -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
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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,16 +5,17 @@ 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, ToolStartedAtContext, 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
|
+
import { parseErrorContent } from './shared/error-and-connector.js';
|
|
11
12
|
import { replyToInlinePermission } from './inline-permission-reply.js';
|
|
12
13
|
import { errorToast } from '../../primitives/toast.js';
|
|
13
14
|
import { cn } from '../../lib/utils.js';
|
|
14
|
-
import { partError, partMetadata, partStreamingInput } from './shared/infrastructure-parts.js';
|
|
15
|
+
import { firstMeaningfulLine, partError, partMetadata, partStreamingInput } from './shared/infrastructure-parts.js';
|
|
15
16
|
import { kortixCardTool, parseKortixToolResult } from './tools/kortix-tool-card.js';
|
|
16
17
|
import { isWorkflowTool, parseWorkflowRun } from './tools/workflow-run.js';
|
|
17
|
-
import { PERMISSION_LABELS,
|
|
18
|
+
import { PERMISSION_LABELS, shouldShowToolPart, } from '../../internal/session-types/index.js';
|
|
18
19
|
import { sessionLogCallStatus, sessionLogOpenCall, toolCallConnectorSignIns, toolKind, } from '@kortix/sdk';
|
|
19
20
|
import { useTranslations } from '../../i18n/index.js';
|
|
20
21
|
import { memo, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
|
@@ -42,6 +43,7 @@ function PermissionPromptInline({ permission, onReply }) {
|
|
|
42
43
|
}
|
|
43
44
|
function ToolPartRendererImpl({ call: given, sessionId, permission, question, onPermissionReply, onQuestionReply, onQuestionReject, defaultOpen, disableNavigation = false, }) {
|
|
44
45
|
const tI18nComplete = useTranslations('hardcodedUi.i18nComplete');
|
|
46
|
+
const tAgent = useTranslations('tools.agent');
|
|
45
47
|
// One open block per call object (`sessionLogOpenCall` caches it), so the memos
|
|
46
48
|
// below and the renderers' own memos hold while the call is unchanged.
|
|
47
49
|
const call = sessionLogOpenCall(given);
|
|
@@ -78,6 +80,8 @@ function ToolPartRendererImpl({ call: given, sessionId, permission, question, on
|
|
|
78
80
|
// The SDK's verdict on tools that never render (a todo read, context bookkeeping).
|
|
79
81
|
if (!shouldShowToolPart(call))
|
|
80
82
|
return null;
|
|
83
|
+
if (isUnpresentedFailure(call))
|
|
84
|
+
return null;
|
|
81
85
|
// A failed `task` dispatch is still a dispatch. OpenCode keeps the child
|
|
82
86
|
// session alive through the failure (its id rides the part's
|
|
83
87
|
// `state.metadata.sessionId`, or the `task_id:` sentence in the error), so
|
|
@@ -86,11 +90,11 @@ function ToolPartRendererImpl({ call: given, sessionId, permission, question, on
|
|
|
86
90
|
// below left the child thread unopenable from the session UI, which is
|
|
87
91
|
// exactly what a failed subagent looked like to a reader (KRTX-1746).
|
|
88
92
|
// TaskTool draws `state.error` itself, so the failure reason stays on the
|
|
89
|
-
// row too.
|
|
90
|
-
//
|
|
91
|
-
//
|
|
93
|
+
// row too. A call that failed before any child existed takes the same route:
|
|
94
|
+
// the agent row names the agent it tried to start (`market-scout`) and says
|
|
95
|
+
// why, where the generic card said only "Agent failed".
|
|
92
96
|
const errorStr = partError(call);
|
|
93
|
-
const childBearingTaskError = errorStr !== undefined && toolKind(call.name) === 'task'
|
|
97
|
+
const childBearingTaskError = errorStr !== undefined && toolKind(call.name) === 'task';
|
|
94
98
|
// A failed codemode script keeps its partial output and the calls it made before
|
|
95
99
|
// the failure: its own row draws them, with the error. The image card draws its
|
|
96
100
|
// failure (with the Connect ChatGPT action) and a stop in place of the image.
|
|
@@ -121,7 +125,11 @@ function ToolPartRendererImpl({ call: given, sessionId, permission, question, on
|
|
|
121
125
|
// showing it.
|
|
122
126
|
return (_jsx(BoundActivateContext.Provider, { value: boundActivate, children: _jsx(ToolOutcomeContext.Provider, { value: outcome, children: _jsx(ToolDurationContext.Provider, { value: toolDurationMs, children: _jsx(BasicTool, { trigger: {
|
|
123
127
|
title: display,
|
|
124
|
-
|
|
128
|
+
// "failed · The project policy denies this workflow call.": the
|
|
129
|
+
// reason is the one thing the reader opens the row for.
|
|
130
|
+
subtitle: POLICY_DENIED.test(errorStr.trim())
|
|
131
|
+
? tAgent('policyBlocked')
|
|
132
|
+
: [tI18nComplete.raw('text5d28a90f4498'), errorReason(errorStr)].filter(Boolean).join(' · '),
|
|
125
133
|
args: server ? [server] : undefined,
|
|
126
134
|
}, badge: "error", defaultOpen: defaultOpen, forceOpen: !!permission || !!question, locked: !!permission || !!question, children: _jsx(ToolError, { error: errorStr, toolName: call.name }) }) }) }) }));
|
|
127
135
|
}
|
|
@@ -148,7 +156,7 @@ function ToolPartRendererImpl({ call: given, sessionId, permission, question, on
|
|
|
148
156
|
// whole class of call permanently closed and unopenable on the panel — the
|
|
149
157
|
// one surface where a single call IS the view.
|
|
150
158
|
_jsx(GenericTool, { call: call, defaultOpen: defaultOpen, forceOpen: forceOpen, locked: isLocked }));
|
|
151
|
-
return (_jsx(ToolNavigationContext.Provider, { value: !disableNavigation, children: _jsx(ToolRunningContext.Provider, { value: isRunning, children: _jsx(ToolOutcomeContext.Provider, { value: outcome, children: _jsx(ToolDurationContext.Provider, { value: toolDurationMs, children: _jsx(StalePendingContext.Provider, { value: isStalePending, children: _jsx(BoundActivateContext.Provider, { value: boundActivate, children: _jsxs("div", { className: cn('relative', fillsPanel && 'h-full'), children: [toolElement, signIns.length > 0 && _jsx(SessionConnectCard, { calls: signIns, className: "mt-1.5" }), permission && onPermissionReply && (_jsx("div", { className: "mt-1.5", children: _jsx(PermissionPromptInline, { permission: permission, onReply: onPermissionReply }) })), question && onQuestionReply && onQuestionReject && (_jsx("div", { className: "mt-1.5", children: _jsx(QuestionPrompt, { request: question, onReply: onQuestionReply, onReject: onQuestionReject }) }))] }) }) }) }) }) }) }));
|
|
159
|
+
return (_jsx(ToolNavigationContext.Provider, { value: !disableNavigation, children: _jsx(ToolRunningContext.Provider, { value: isRunning, children: _jsx(ToolOutcomeContext.Provider, { value: outcome, children: _jsx(ToolDurationContext.Provider, { value: toolDurationMs, children: _jsx(ToolStartedAtContext.Provider, { value: call.started_at, children: _jsx(StalePendingContext.Provider, { value: isStalePending, children: _jsx(BoundActivateContext.Provider, { value: boundActivate, children: _jsxs("div", { className: cn('relative', fillsPanel && 'h-full'), children: [toolElement, signIns.length > 0 && _jsx(SessionConnectCard, { calls: signIns, className: "mt-1.5" }), permission && onPermissionReply && (_jsx("div", { className: "mt-1.5", children: _jsx(PermissionPromptInline, { permission: permission, onReply: onPermissionReply }) })), question && onQuestionReply && onQuestionReject && (_jsx("div", { className: "mt-1.5", children: _jsx(QuestionPrompt, { request: question, onReply: onQuestionReply, onReject: onQuestionReject }) }))] }) }) }) }) }) }) }) }));
|
|
152
160
|
}
|
|
153
161
|
/**
|
|
154
162
|
* The tools whose rows are an agent's work: they open in place, never in the side panel.
|
|
@@ -184,3 +192,11 @@ function ToolPartRendererGuard(props) {
|
|
|
184
192
|
}
|
|
185
193
|
export const ToolPartRenderer = memo(ToolPartRendererGuard);
|
|
186
194
|
ToolPartRenderer.displayName = 'ToolPartRenderer';
|
|
195
|
+
/** The runtime's policy refusal (`decide` in pi `runtime.ts`): a block, not a failure. */
|
|
196
|
+
const POLICY_DENIED = /^The project policy denies this [\w./-]+ call\.?$/;
|
|
197
|
+
/** One short line that says why a call failed: a JSON or traceback error reads as its summary. */
|
|
198
|
+
function errorReason(error) {
|
|
199
|
+
const { summary } = parseErrorContent(error);
|
|
200
|
+
const line = firstMeaningfulLine(summary || error, 140);
|
|
201
|
+
return /^[[{]$/.test(line) ? '' : line;
|
|
202
|
+
}
|
|
@@ -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';
|