@kortix/ui 0.15.8 → 0.15.10
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 +75 -1
- package/dist/_vendor/shared/index.d.ts +1 -0
- package/dist/_vendor/shared/session/attachment-tile.d.ts +32 -0
- package/dist/_vendor/shared/session/stop-refusal.d.ts +15 -0
- package/dist/_vendor/shared/session/tool-row-text.d.ts +58 -0
- package/dist/_vendor/shared/session-delivery.d.ts +2 -0
- package/dist/access/access/access-dialog-share.js +12 -6
- package/dist/access/access/share-selection.d.ts +9 -0
- package/dist/access/access/share-selection.js +64 -0
- package/dist/customize/connectors/connector-identity.js +3 -3
- package/dist/customize/connectors/connectors-page.js +1 -1
- package/dist/customize/connectors/detail/app-page.js +2 -2
- package/dist/customize/connectors/detail/connector-accounts.d.ts +3 -1
- package/dist/customize/connectors/detail/connector-accounts.js +2 -2
- package/dist/customize/connectors/detail/connector-notice-view.d.ts +4 -0
- package/dist/customize/connectors/detail/connector-notice-view.js +4 -0
- package/dist/customize/connectors/detail/connector-notice.d.ts +31 -4
- package/dist/customize/connectors/detail/connector-notice.js +23 -4
- package/dist/customize/connectors/detail/connector-page.js +35 -10
- package/dist/customize/connectors/detail/connector-status.d.ts +12 -1
- package/dist/customize/connectors/detail/connector-status.js +11 -0
- package/dist/customize/connectors/detail/status-badge.d.ts +3 -3
- package/dist/customize/connectors/detail/status-badge.js +2 -1
- package/dist/customize/connectors/detail/use-connector-detail.js +10 -2
- package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.d.ts +13 -0
- package/dist/customize/connectors/detail/use-mcp-oauth-sign-in.js +29 -0
- package/dist/customize/connectors/install/use-install.js +1 -1
- package/dist/customize/providers/provider-accordion.js +9 -8
- package/dist/customize/providers/provider-connect.d.ts +3 -3
- package/dist/customize/providers/provider-connect.js +10 -16
- package/dist/customize/providers/provider-sheet.js +13 -8
- package/dist/customize/sections/component/email-connect-form.js +4 -2
- package/dist/customize/sections/connector-connection-form.d.ts +0 -1
- package/dist/customize/sections/connector-connection-form.js +0 -9
- package/dist/customize/sections/connectors-view.d.ts +4 -1
- package/dist/customize/sections/connectors-view.js +42 -7
- package/dist/customize/sections/view/account-secret-resources-panel.d.ts +15 -0
- package/dist/customize/sections/view/account-secret-resources-panel.js +44 -5
- package/dist/customize/sections/view/review-center-connected.js +7 -3
- package/dist/customize/sections/view/secret-delivery.d.ts +9 -2
- package/dist/customize/sections/view/secret-delivery.js +14 -4
- package/dist/customize/sections/view/secrets-view.js +21 -5
- package/dist/customize/settings/tabs/workspace-keys.js +53 -11
- package/dist/customize/shared/feature-gate-screen.js +1 -1
- package/dist/customize/triggers/schedule/event-account-picker.js +1 -1
- package/dist/customize/triggers/schedule/schedule-builder.js +1 -1
- package/dist/customize/triggers/schedule/schedule-copy.js +4 -0
- package/dist/customize/triggers/schedule/schedule-detail-sheet.js +14 -3
- package/dist/customize/triggers/schedule/then-fields.d.ts +3 -1
- package/dist/customize/triggers/schedule/then-fields.js +8 -4
- package/dist/customize/triggers/schedule/trigger-composer.js +1 -1
- package/dist/customize/triggers/schedule/trigger-list.d.ts +3 -1
- package/dist/customize/triggers/schedule/trigger-list.js +18 -2
- package/dist/customize/triggers/schedule/trigger-runs-logic.js +4 -2
- package/dist/customize/triggers/schedule/trigger-runs-panel.js +4 -1
- package/dist/customize/triggers/schedule/use-event-app-connect.js +2 -1
- package/dist/files/renderers/pptx-renderer.js +5 -20
- package/dist/files/renderers/presentation/FullScreenPresentationViewer.d.ts +3 -2
- package/dist/files/renderers/presentation/FullScreenPresentationViewer.js +23 -304
- package/dist/files/renderers/presentation/presentation-export-menu.d.ts +14 -0
- package/dist/files/renderers/presentation/presentation-export-menu.js +44 -0
- package/dist/files/renderers/presentation/presentation-utils.d.ts +1 -0
- package/dist/files/renderers/presentation/presentation-utils.js +4 -0
- package/dist/files/renderers/presentation/slide-iframe.d.ts +23 -0
- package/dist/files/renderers/presentation/slide-iframe.js +61 -0
- package/dist/files/renderers/presentation/use-presentation-metadata.d.ts +39 -0
- package/dist/files/renderers/presentation/use-presentation-metadata.js +137 -0
- package/dist/files/renderers/presentation/use-slide-navigation.d.ts +17 -0
- package/dist/files/renderers/presentation/use-slide-navigation.js +82 -0
- package/dist/files/renderers/shared/use-stage-fit-scale.d.ts +19 -0
- package/dist/files/renderers/shared/use-stage-fit-scale.js +41 -0
- package/dist/files/renderers/show-content-renderer.js +16 -11
- package/dist/files/renderers/xlsx/xlsx-renderer.d.ts +4 -13
- package/dist/files/renderers/xlsx/xlsx-renderer.js +6 -63
- package/dist/files/renderers/xlsx/xlsx-viewer.d.ts +4 -2
- package/dist/files/renderers/xlsx/xlsx-viewer.js +28 -34
- package/dist/files/viewer/file-content-renderer.js +1 -4
- package/dist/files/viewer/use-file-content-state.js +10 -9
- package/dist/i18n/en.d.ts +55 -7
- package/dist/i18n/en.js +59 -11
- package/dist/internal/billing/compute-pricing.d.ts +7 -1
- package/dist/internal/billing/compute-pricing.js +7 -1
- package/dist/internal/chrome/use-chrome-offered.d.ts +2 -1
- package/dist/internal/chrome/use-chrome-offered.js +4 -2
- package/dist/internal/hooks/connectors/invalidate-connections.d.ts +10 -0
- package/dist/internal/hooks/connectors/invalidate-connections.js +18 -0
- package/dist/internal/hooks/connectors/use-finish-sign-in.d.ts +13 -0
- package/dist/internal/hooks/connectors/use-finish-sign-in.js +33 -0
- package/dist/internal/hooks/connectors/use-pipedream-connect-member.js +6 -1
- package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +6 -1
- package/dist/internal/hooks/projects/use-new-project-session.d.ts +2 -0
- package/dist/internal/hooks/projects/use-new-project-session.js +4 -1
- 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/lib/browser-noise/rules/injected-scripts.js +2 -2
- package/dist/internal/lib/error-handler.js +33 -0
- package/dist/internal/lib/trigger-clock.d.ts +7 -2
- package/dist/internal/lib/trigger-clock.js +17 -3
- package/dist/internal/notifications/notification-inbox.d.ts +4 -10
- package/dist/internal/notifications/notification-inbox.js +8 -9
- package/dist/internal/stores/connector-gate-store.d.ts +3 -1
- package/dist/internal/stores/connector-gate-store.js +13 -3
- package/dist/internal/stores/upgrade-dialog-store.d.ts +4 -0
- package/dist/internal/stores/upgrade-dialog-store.js +2 -0
- package/dist/lib/routes.d.ts +4 -11
- package/dist/lib/routes.js +3 -5
- package/dist/lib/z-stack.d.ts +5 -1
- package/dist/lib/z-stack.js +12 -2
- package/dist/markdown/unified-markdown-utils.d.ts +7 -0
- package/dist/markdown/unified-markdown-utils.js +19 -0
- package/dist/markdown/unified-markdown.js +16 -3
- package/dist/primitives/alert-dialog.js +1 -1
- package/dist/primitives/dialog.js +3 -1
- package/dist/primitives/drawer.js +1 -1
- package/dist/primitives/modal.js +1 -1
- package/dist/primitives/preview-image.js +1 -1
- package/dist/primitives/sheet.js +1 -1
- package/dist/session/composer/ComposerCard.js +4 -2
- package/dist/session/composer/attachment-tile.d.ts +2 -26
- package/dist/session/composer/attachment-tile.js +3 -47
- package/dist/session/composer/composer-chat-input.d.ts +2 -1
- package/dist/session/composer/composer-chat-input.js +2 -2
- package/dist/session/composer/composer.d.ts +2 -0
- package/dist/session/composer/composer.js +5 -8
- package/dist/session/composer/draft/home-composer-focus-handoff.d.ts +7 -0
- package/dist/session/composer/draft/home-composer-focus-handoff.js +94 -0
- package/dist/session/composer/draft/use-composer-draft.d.ts +3 -1
- package/dist/session/composer/draft/use-composer-draft.js +22 -2
- package/dist/session/composer/editor/composer-editor.d.ts +4 -2
- package/dist/session/composer/editor/composer-editor.js +7 -3
- package/dist/session/composer/hooks/use-composer-focus.js +4 -2
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.js +1 -0
- package/dist/session/models/chatgpt-connection-button.js +5 -9
- package/dist/session/models/model-connection-gate.d.ts +2 -1
- package/dist/session/models/model-connection-gate.js +21 -5
- package/dist/session/models/model-connection-layout.d.ts +2 -0
- package/dist/session/models/model-connection-layout.js +4 -0
- package/dist/session/models/model-picker-panel.js +6 -2
- package/dist/session/models/model-selector.d.ts +1 -1
- package/dist/session/models/model-selector.js +9 -6
- package/dist/session/models/provider-key-action.d.ts +10 -0
- package/dist/session/models/provider-key-action.js +35 -0
- package/dist/session/models/provider-key-slot.d.ts +9 -0
- package/dist/session/models/provider-key-slot.js +19 -0
- package/dist/session/models/subscription-offer.d.ts +4 -0
- package/dist/session/models/subscription-offer.js +11 -3
- package/dist/session/overrides/session-overrides-toolbar.js +2 -4
- package/dist/session/prompts/ask-deck.d.ts +5 -1
- package/dist/session/prompts/ask-deck.js +15 -3
- package/dist/session/prompts/question-labels.d.ts +16 -0
- package/dist/session/prompts/question-labels.js +34 -0
- package/dist/session/prompts/question-prompt.js +6 -6
- package/dist/session/prompts/session-connect-prompt.d.ts +40 -0
- package/dist/session/prompts/session-connect-prompt.js +126 -0
- package/dist/session/status/provisioning-failure.d.ts +23 -2
- package/dist/session/status/provisioning-failure.js +53 -3
- package/dist/session/status/session-error-banner.d.ts +1 -1
- package/dist/session/status/session-error-banner.js +12 -4
- package/dist/session/status/stop-refusal.d.ts +6 -12
- package/dist/session/status/stop-refusal.js +6 -19
- package/dist/session/thread/agent-run-props.d.ts +19 -0
- package/dist/session/thread/agent-run-props.js +54 -0
- package/dist/session/thread/session-chat.js +34 -6
- package/dist/session/thread/transcript.d.ts +17 -1
- package/dist/session/thread/transcript.js +104 -16
- package/dist/session/tool/tools/bash-tool.d.ts +3 -52
- package/dist/session/tool/tools/bash-tool.js +3 -86
- package/dist/session/turn/answer-streaming.d.ts +21 -0
- package/dist/session/turn/answer-streaming.js +34 -0
- package/dist/session/turn/queued-prompt-bubbles.d.ts +5 -0
- package/dist/session/turn/queued-prompt-bubbles.js +12 -0
- package/dist/session/turn/turn-work-accordion.d.ts +3 -1
- package/dist/session/turn/turn-work-accordion.js +2 -2
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +55 -7
- package/dist/workspace/home/first-chat.d.ts +7 -1
- package/dist/workspace/home/first-chat.js +12 -5
- package/dist/workspace/inbox/workspace-inbox.d.ts +6 -16
- package/dist/workspace/inbox/workspace-inbox.js +9 -51
- package/dist/workspace/layout/project-home.js +5 -11
- package/dist/workspace/layout/use-project-home-send.d.ts +2 -0
- package/dist/workspace/layout/use-project-home-send.js +29 -15
- package/dist/workspace/new/advanced-fields.d.ts +4 -1
- package/dist/workspace/new/advanced-fields.js +2 -2
- package/dist/workspace/new/workspace-name.d.ts +9 -0
- package/dist/workspace/new/workspace-name.js +20 -0
- package/dist/workspace/projects/session-starter.d.ts +6 -4
- package/dist/workspace/projects/session-starter.js +8 -14
- package/dist/workspace/review/review-center.d.ts +6 -2
- package/dist/workspace/review/review-center.js +45 -25
- package/dist/workspace/sidebar/workspace-menu-model.d.ts +3 -5
- package/dist/workspace/sidebar/workspace-menu-model.js +1 -1
- package/package.json +3 -7
- package/skills/kortix-ui/references/modules.md +1 -1
- package/dist/customize/connectors/invalidate-connections.d.ts +0 -2
- package/dist/customize/connectors/invalidate-connections.js +0 -4
- package/dist/internal/notifications/use-inbox-summary.d.ts +0 -17
- package/dist/internal/notifications/use-inbox-summary.js +0 -28
|
@@ -8,13 +8,14 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
8
8
|
// answered-question cards and notification turns. `session-chat.tsx`
|
|
9
9
|
// re-exports the public names.
|
|
10
10
|
// ============================================================================
|
|
11
|
+
import { STALE_RUNTIME_DELIVERY_ERROR } from '../../_vendor/kortix-shared.js';
|
|
11
12
|
import { isQuestionTool } from '@kortix/sdk';
|
|
12
13
|
import { UnifiedMarkdown } from '../../markdown/unified-markdown.js';
|
|
13
14
|
import { detectCommandFromText } from './detect-command.js';
|
|
14
15
|
import { GenuiTelemetryContext } from '../../markdown/genui/block-telemetry.js';
|
|
15
16
|
import { copyGenuiText } from '../../markdown/genui/to-markdown.js';
|
|
16
17
|
import { useLocale, useTranslations } from '../../i18n/index.js';
|
|
17
|
-
import { isSessionLogRestoreNote, sessionLogActivityText, sessionLogAnsweredQuestionCall, sessionLogBurstSteps, sessionLogOpenCall, sessionLogTurnSegments, sessionPromptActions, splitSessionLogTurnWork, isNoGroupActivityTool, toolCallMetadata, toolKind, } from '@kortix/sdk';
|
|
18
|
+
import { isSessionLogRestoreNote, sessionLogActivityText, sessionLogAnsweredQuestionCall, sessionLogBurstSteps, sessionLogOpenCall, sessionLogTurnSegments, sessionPromptActions, splitSessionLogTurnWork, sessionLogAgentRunLabel, isNoGroupActivityTool, toolCallMetadata, toolKind, } from '@kortix/sdk';
|
|
18
19
|
import { WarningIcon as AlertTriangle, CheckCircleIcon as CheckCircle, CheckIcon, CaretDownIcon as ChevronDown, ArrowSquareOutIcon as ExternalLink, StopCircleIcon, } from '@phosphor-icons/react';
|
|
19
20
|
import { AnimatePresence, m } from 'motion/react';
|
|
20
21
|
import { memo, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
@@ -35,7 +36,7 @@ import { CompactionFailedRow, CompactionMarker, compactionReset } from '../turn/
|
|
|
35
36
|
import { ExpandableOutput } from '../turn/expandable-output.js';
|
|
36
37
|
import { isPlanWriteTool } from '../turn/plan-anchor.js';
|
|
37
38
|
import { TurnFallbackRows } from '../turn/fallback-row.js';
|
|
38
|
-
import { QUEUED_BUBBLE_OPACITY_CLASS, queuedBubbleTone, QueuedPromptFailure, QueuedPromptProgress, } from '../turn/queued-prompt-bubbles.js';
|
|
39
|
+
import { QUEUED_BUBBLE_OPACITY_CLASS, queuedBubbleTone, QueuedPromptFailure, QueuedPromptProgress, QueuedPromptRecovery, } from '../turn/queued-prompt-bubbles.js';
|
|
39
40
|
import { ShowGroupRenderer } from '../tool/show-group-renderer.js';
|
|
40
41
|
import { statusElapsedFrame } from '../turn/status-elapsed.js';
|
|
41
42
|
import { ThrottledMarkdown } from '../turn/throttled-markdown.js';
|
|
@@ -46,6 +47,7 @@ import { TurnOutcomes } from '../outcomes/turn-outcomes.js';
|
|
|
46
47
|
import { SessionRetryDisplay, TurnErrorDisplay } from '../status/session-error-banner.js';
|
|
47
48
|
import { showTurnBusyIndicator } from '@kortix/sdk';
|
|
48
49
|
import { SessionBusyIndicator } from '../status/session-busy-indicator.js';
|
|
50
|
+
import { useAnswerStreaming } from '../turn/answer-streaming.js';
|
|
49
51
|
import { SessionTurnMeta } from './session-turn-meta.js';
|
|
50
52
|
import { TurnShareButton } from './turn-share.js';
|
|
51
53
|
import { sessionTurnDurationMs, sessionTurnEndedAt, sessionTurnSpan, } from './session-turn-meta-rows.js';
|
|
@@ -236,6 +238,29 @@ export function deriveTurnErrorPresentation(input) {
|
|
|
236
238
|
};
|
|
237
239
|
}
|
|
238
240
|
}
|
|
241
|
+
/** A `send_message` call: the agent relaying between colleagues. Inside a run it is noise. */
|
|
242
|
+
function isRelayCall(block) {
|
|
243
|
+
return block.type === 'tool_call' && block.name.toLowerCase().replace(/[^a-z]/g, '') === 'sendmessage';
|
|
244
|
+
}
|
|
245
|
+
/** The segments without the relay calls (`isRelayCall`); the same array when there is none. */
|
|
246
|
+
function withoutRelayCalls(segments) {
|
|
247
|
+
let changed = false;
|
|
248
|
+
const kept = segments.flatMap((segment) => {
|
|
249
|
+
if (segment.kind === 'standalone' && isRelayCall(segment.block)) {
|
|
250
|
+
changed = true;
|
|
251
|
+
return [];
|
|
252
|
+
}
|
|
253
|
+
if (segment.kind === 'burst') {
|
|
254
|
+
const blocks = segment.blocks.filter((block) => !isRelayCall(block));
|
|
255
|
+
if (blocks.length !== segment.blocks.length) {
|
|
256
|
+
changed = true;
|
|
257
|
+
return blocks.length ? [{ ...segment, blocks }] : [];
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return [segment];
|
|
261
|
+
});
|
|
262
|
+
return changed ? kept : segments;
|
|
263
|
+
}
|
|
239
264
|
/**
|
|
240
265
|
* The worker-run result row shown above a turn — an entity row in the design
|
|
241
266
|
* system's sense, not a tinted banner: the surface stays neutral and the status
|
|
@@ -1039,22 +1064,22 @@ function TurnSessionReport({ report }) {
|
|
|
1039
1064
|
/** The user side of a turn: the report card, the system-pill line, and the
|
|
1040
1065
|
* user bubble (hidden for notification-only turns). */
|
|
1041
1066
|
function TurnUserBlock(props) {
|
|
1042
|
-
const { userContent } = props;
|
|
1067
|
+
const { userContent, noticeInWork } = props;
|
|
1043
1068
|
const { sessionReport, noticeBatch, subagentNotice, peerMessage, parkedAnswer, systemMessages, hasVisibleUserContent } = userContent;
|
|
1044
1069
|
// P5.6: the note a partial restore left for the agent is a notice, not a person's prompt.
|
|
1045
1070
|
if (isSessionLogRestoreNote(props.turn.user))
|
|
1046
1071
|
return _jsx(RestoreNoteMarker, {});
|
|
1047
|
-
return (_jsxs(_Fragment, { children: [noticeBatch ? (_jsx(NoticeBatchGroup, { items: noticeBatch })) : subagentNotice ? (_jsx(SubagentNoticeRow, { notice: subagentNotice })) : peerMessage ? (_jsx(PeerMessageRow, { info: peerMessage })) : parkedAnswer ? (_jsx(ParkedAnswerRow, { answer: parkedAnswer })) : (sessionReport && _jsx(TurnSessionReport, { report: sessionReport })), !hasVisibleUserContent && !sessionReport && !noticeBatch && !peerMessage && !parkedAnswer && systemMessages.length > 0 && (_jsx(SystemMessageIndicator, { messages: systemMessages })), hasVisibleUserContent && _jsx(TurnUserBubble, { ...props })] }));
|
|
1072
|
+
return (_jsxs(_Fragment, { children: [!noticeInWork && (noticeBatch ? (_jsx(NoticeBatchGroup, { items: noticeBatch })) : subagentNotice ? (_jsx(SubagentNoticeRow, { notice: subagentNotice })) : peerMessage ? (_jsx(PeerMessageRow, { info: peerMessage })) : parkedAnswer ? (_jsx(ParkedAnswerRow, { answer: parkedAnswer })) : (sessionReport && _jsx(TurnSessionReport, { report: sessionReport }))), !hasVisibleUserContent && !sessionReport && !noticeBatch && !peerMessage && !parkedAnswer && systemMessages.length > 0 && (_jsx(SystemMessageIndicator, { messages: systemMessages })), hasVisibleUserContent && _jsx(TurnUserBubble, { ...props })] }));
|
|
1048
1073
|
}
|
|
1049
1074
|
/** The user message bubble — dimmed while the prompt waits in the queue. */
|
|
1050
1075
|
function TurnUserBubble(props) {
|
|
1051
1076
|
const { hasVisibleUserContent } = props.userContent;
|
|
1052
|
-
const { turn, author, showAuthor, pending, pendingPrompt, interruptedBeforeRun, pendingAttachments, uploadStatus, pendingText, agentNames, commandMessages, commands, sessionId, ownsPlan, onRewind, rewindDisabled, editingText, editPending, onEditCancel, onEditSend, onRetryQueued, onRemoveQueued, queuedPromptViewer, onOpenPastedContent, } = props;
|
|
1077
|
+
const { turn, author, showAuthor, pending, pendingPrompt, interruptedBeforeRun, pendingAttachments, uploadStatus, pendingText, agentNames, commandMessages, commands, sessionId, projectId, ownsPlan, onRewind, rewindDisabled, editingText, editPending, onEditCancel, onEditSend, onRetryQueued, onRemoveQueued, queuedPromptViewer, onOpenPastedContent, } = props;
|
|
1053
1078
|
const { queueState, queuedStatus } = props.queueTone;
|
|
1054
1079
|
const promptActions = pendingPrompt && queuedPromptViewer
|
|
1055
1080
|
? sessionPromptActions(pendingPrompt, queuedPromptViewer)
|
|
1056
1081
|
: { own: true, removable: true };
|
|
1057
|
-
return (_jsx(_Fragment, { children: hasVisibleUserContent && (_jsx("div", { "data-turn-pending": pending || interruptedBeforeRun || undefined, "data-turn-queue-state": pendingPrompt?.state ?? queueState ?? undefined, "data-pending-prompt-id": pendingPrompt?.prompt_id, "data-queue-tone": queuedBubbleTone(queuedStatus), className: cn((pending || interruptedBeforeRun) && QUEUED_BUBBLE_OPACITY_CLASS), children: _jsx(UserMessage, { message: turn.user, author: author, showAuthor: showAuthor, pendingAttachments: pendingAttachments, uploadStatus: uploadStatus, pendingText: pendingText, agentNames: agentNames, commandInfo: commandMessages?.get(turn.id), commands: commands, sessionId: sessionId, ownsPlan: ownsPlan, onRewind: onRewind, rewindDisabled: rewindDisabled || pending || interruptedBeforeRun, editingText: editingText, editPending: editPending, onEditCancel: onEditCancel, onEditSend: onEditSend, onOpenPastedContent: onOpenPastedContent, deliveryStatus: queuedStatus === 'failed' ? (_jsx(QueuedPromptFailure, { lastError: pendingPrompt?.last_error, onRetry: pendingPrompt && onRetryQueued && promptActions.own
|
|
1082
|
+
return (_jsx(_Fragment, { children: hasVisibleUserContent && (_jsx("div", { "data-turn-pending": pending || interruptedBeforeRun || undefined, "data-turn-queue-state": pendingPrompt?.state ?? queueState ?? undefined, "data-pending-prompt-id": pendingPrompt?.prompt_id, "data-queue-tone": queuedBubbleTone(queuedStatus), className: cn((pending || interruptedBeforeRun) && QUEUED_BUBBLE_OPACITY_CLASS), children: _jsx(UserMessage, { message: turn.user, author: author, showAuthor: showAuthor, pendingAttachments: pendingAttachments, uploadStatus: uploadStatus, pendingText: pendingText, agentNames: agentNames, commandInfo: commandMessages?.get(turn.id), commands: commands, sessionId: sessionId, ownsPlan: ownsPlan, onRewind: onRewind, rewindDisabled: rewindDisabled || pending || interruptedBeforeRun, editingText: editingText, editPending: editPending, onEditCancel: onEditCancel, onEditSend: onEditSend, onOpenPastedContent: onOpenPastedContent, deliveryStatus: pendingPrompt?.last_error === STALE_RUNTIME_DELIVERY_ERROR ? (_jsx(QueuedPromptRecovery, { projectId: projectId, onRemove: onRemoveQueued && promptActions.removable ? () => onRemoveQueued(pendingPrompt.prompt_id) : undefined })) : queuedStatus === 'failed' ? (_jsx(QueuedPromptFailure, { lastError: pendingPrompt?.last_error, onRetry: pendingPrompt && onRetryQueued && promptActions.own
|
|
1058
1083
|
? () => onRetryQueued(pendingPrompt.prompt_id)
|
|
1059
1084
|
: undefined, onRemove: pendingPrompt && onRemoveQueued && promptActions.removable
|
|
1060
1085
|
? () => onRemoveQueued(pendingPrompt.prompt_id)
|
|
@@ -1065,13 +1090,27 @@ const NO_RECOVERED_CALLS = new Set();
|
|
|
1065
1090
|
/** The assistant's part tree: bursts, standalone deliverables, and prose
|
|
1066
1091
|
* between them, under one live-context provider. */
|
|
1067
1092
|
function TurnToolBlocks(props) {
|
|
1068
|
-
const { turn, sessionId, permissions, onPermissionReply, disableToolNavigation, model, segments, conversationDensity, fold, durationMs, } = props;
|
|
1093
|
+
const { turn, sessionId, permissions, onPermissionReply, disableToolNavigation, model, segments, conversationDensity, fold, durationMs, workNotice, runContent, runLabel, foldStartedWork, part, } = props;
|
|
1069
1094
|
const { working, hasSteps, hasReasoning } = model;
|
|
1070
1095
|
// Every settled turn folds, live or reloaded (the T3 Code rule): one turn
|
|
1071
1096
|
// reads one way. A turn the reader touched while it worked (opened or closed
|
|
1072
1097
|
// a row) settles with its "Worked for" row open, so nothing they were
|
|
1073
1098
|
// reading disappears under them.
|
|
1074
|
-
const split = useMemo(() => (fold && !working ? splitSessionLogTurnWork(segments.filter(segmentRendersSomething), { working }) : null), [fold, segments, working]);
|
|
1099
|
+
const split = useMemo(() => (fold && !working ? splitSessionLogTurnWork(segments.filter(segmentRendersSomething), { working, foldStartedWork }) : null), [fold, segments, working, foldStartedWork]);
|
|
1100
|
+
// A settled turn whose prompt is another agent's notice folds the notice
|
|
1101
|
+
// row into this work fold with the work it led to (KRTX-4732): the parent's
|
|
1102
|
+
// answer below is the only top-level message, and the row stays reachable
|
|
1103
|
+
// by opening the row. A turn with no work of its own still gets the fold,
|
|
1104
|
+
// so the exchange never becomes unreachable. In the inline mode (text plus
|
|
1105
|
+
// an answered question, no fold row) the row renders visible above the
|
|
1106
|
+
// answer instead — the gate below keeps the block mounted for it.
|
|
1107
|
+
// The run's other turns fold here too (KRTX-4732); while the turn still works, the run's
|
|
1108
|
+
// row already stands, closed, over the reports that came before.
|
|
1109
|
+
const noticeFold = (!!workNotice || !!runContent) && fold && !working;
|
|
1110
|
+
// A turn whose only work started agents has no steps, but its agent rows are what the
|
|
1111
|
+
// person tracks: they draw (and fold once every agent reported, `foldStartedWork`).
|
|
1112
|
+
const startedWork = useMemo(() => segments.some((segment) => segment.kind === 'standalone' && toolKind(segment.block.name) === 'task'), [segments]);
|
|
1113
|
+
const foldRow = !part && (!!split || noticeFold || (!!runContent && working));
|
|
1075
1114
|
const workSegments = useMemo(() => new Set(split?.work ?? []), [split]);
|
|
1076
1115
|
const touchedLive = useRef(false);
|
|
1077
1116
|
const markTouched = useCallback(() => {
|
|
@@ -1120,21 +1159,25 @@ function TurnToolBlocks(props) {
|
|
|
1120
1159
|
return null;
|
|
1121
1160
|
return (_jsx(TurnSegment, { segment: segment, isTrailing: segment === segments[segments.length - 1], working: working, openText: model.openText, hasSteps: hasSteps, sessionId: sessionId, permissions: permissions, onPermissionReply: onPermissionReply, disableNavigation: disableToolNavigation, conversationDensity: conversationDensity }, key));
|
|
1122
1161
|
};
|
|
1123
|
-
return (_jsx(_Fragment, { children: (working || hasSteps || hasReasoning) && turn.assistant.length > 0 && (
|
|
1162
|
+
return (_jsx(_Fragment, { children: (working || hasSteps || hasReasoning || startedWork || noticeFold || !!workNotice || !!runContent) && (turn.assistant.length > 0 || !!workNotice || !!runContent) && (
|
|
1124
1163
|
// Every tool row below — the bursts' rows and the standalone ones —
|
|
1125
1164
|
// reads this to tell a call that has not spoken YET from one that never
|
|
1126
1165
|
// will. Provided here rather than per-row because `working` is a fact
|
|
1127
1166
|
// about the TURN, and this block is the turn's whole part tree.
|
|
1128
1167
|
// See `TurnLiveContext`.
|
|
1129
|
-
_jsx(TurnLiveContext.Provider, { value: working, children: _jsx(RecoveredCallsContext.Provider, { value: recovered, children: _jsx(ImageGenPathsContext.Provider, { value: imageGenPaths, children: _jsx(ImageGenDigestsContext.Provider, { value: imageGenDigests, children: _jsx(ImageGenRunsContext.Provider, { value: imageGenRuns, children: _jsx(InTranscriptTurnContext.Provider, { value: true, children: _jsx(WorkTouchContext.Provider, { value: markTouched, children: _jsxs("div", { className: "flex flex-col gap-3", onClickCapture: onClickCapture, children: [
|
|
1168
|
+
_jsx(TurnLiveContext.Provider, { value: working, children: _jsx(RecoveredCallsContext.Provider, { value: recovered, children: _jsx(ImageGenPathsContext.Provider, { value: imageGenPaths, children: _jsx(ImageGenDigestsContext.Provider, { value: imageGenDigests, children: _jsx(ImageGenRunsContext.Provider, { value: imageGenRuns, children: _jsx(InTranscriptTurnContext.Provider, { value: true, children: _jsx(WorkTouchContext.Provider, { value: markTouched, children: _jsxs("div", { className: "flex flex-col gap-3", onClickCapture: onClickCapture, children: [foldRow && (_jsx(TurnWorkAccordion, { label: runLabel, durationMs: durationMs, open: workOpen, onToggle: toggleWork, contentId: workContentId }, "turn-work")), runContent && workMounted && (_jsx("div", { id: workContentId, hidden: !workOpen, "data-testid": "agent-run-fold", className: "flex min-w-0 flex-col gap-3", children: _jsx(WorkFoldContext.Provider, { value: true, children: runContent }) }, "turn-run")), workNotice && (!noticeFold || workMounted) && (_jsx("div", { id: runContent ? undefined : workContentId, hidden: !!(split || noticeFold) && !workOpen, className: "min-w-0", children: _jsx(WorkFoldContext.Provider, { value: !working, children: workNotice }) }, "turn-notice")), segments.map((segment) => {
|
|
1130
1169
|
const isWork = workSegments.has(segment);
|
|
1131
|
-
if (
|
|
1170
|
+
if (part === 'answer' && isWork)
|
|
1171
|
+
return null;
|
|
1172
|
+
if (part === 'work' && split && !isWork)
|
|
1173
|
+
return null;
|
|
1174
|
+
if (isWork && !workMounted && !part)
|
|
1132
1175
|
return null;
|
|
1133
1176
|
const node = renderSegment(segment);
|
|
1134
1177
|
if (!node)
|
|
1135
1178
|
return null;
|
|
1136
|
-
const hidden = isWork && !workOpen;
|
|
1137
|
-
return (_jsx("div", { id: isWork && segment === split?.work[0] ? workContentId : undefined, hidden: hidden, className: "min-w-0", children: _jsx(WorkFoldContext.Provider, { value: isWork, children: node }) }, node.key));
|
|
1179
|
+
const hidden = !part && isWork && !workOpen;
|
|
1180
|
+
return (_jsx("div", { id: !workNotice && !runContent && isWork && segment === split?.work[0] ? workContentId : undefined, hidden: hidden, className: "min-w-0", children: _jsx(WorkFoldContext.Provider, { value: isWork, children: node }) }, node.key));
|
|
1138
1181
|
})] }) }) }) }) }) }) }) })) }));
|
|
1139
1182
|
}
|
|
1140
1183
|
/** One segment of the turn's steps section: a burst, a show group, a
|
|
@@ -1304,7 +1347,7 @@ function TurnFooter(props) {
|
|
|
1304
1347
|
const { statusPhrase, statusElapsedLabel } = status;
|
|
1305
1348
|
const { retryInfo, retryMessage, retrySecondsLeft } = retry;
|
|
1306
1349
|
const { turnEndedAt, turnDurationMs, costInfo } = meta;
|
|
1307
|
-
return (_jsxs(_Fragment, { children: [_jsx(TurnBusyRow, { ...props, working: working, turnError: turnError, tHardcodedUi: tHardcodedUi, hasText: model.response.trim() !== '' }), turnErrorRow.text && !turn.autoRetry?.continued && (
|
|
1350
|
+
return (_jsxs(_Fragment, { children: [_jsx(TurnBusyRow, { ...props, working: working, turnError: turnError, tHardcodedUi: tHardcodedUi, hasText: model.response.trim() !== '', openText: model.openText?.block.text }), turnErrorRow.text && !turn.autoRetry?.continued && (
|
|
1308
1351
|
// A space's thread (messages only): one calm line with Retry; a stop has its own "Stopped" line.
|
|
1309
1352
|
props.quietBusy ? (turnErrorRow.isAbort ? null : (_jsx(TurnFailedLine, { projectId: projectId, projectSessionId: projectSessionId, turn: turn, errorText: turnErrorRow.text }))) : (_jsx(TurnErrorDisplay, { errorText: turnErrorRow.text, errorDetails: turnErrorRowDetails, errorRaw: turnErrorRaw, isAbort: turnErrorRow.isAbort, modelOptions: modelOptions }))), turnErrorRow.text && !turnErrorRow.isAbort && !turn.autoRetry?.continued && !!turn.autoRetry?.retries && (_jsx(TurnAutoRetryNote, { count: turn.autoRetry.retries })), !working && !turn.autoRetry?.continued && (stoppedBy || errors.turnErrorIsAbort) && _jsx(TurnStoppedBy, { name: stoppedBy ?? undefined }), !working && _jsx(TurnOutcomes, { turnKey: turn.id }), !working && !props.hideActionBar && hasCopyableResponse(response, answered.inlineContentParts) && (_jsx(TurnActionBar, { response: response, inlineContentParts: answered.inlineContentParts, turnEndedAt: turnEndedAt, turnDurationMs: turnDurationMs, costInfo: costInfo, servedModel: servedModel, tHardcodedUi: tHardcodedUi,
|
|
1310
1353
|
// A continuation turn's id names a compaction marker, not a user
|
|
@@ -1343,7 +1386,10 @@ function TurnBusyRow(props) {
|
|
|
1343
1386
|
const tTurn = useTranslations('sessionUi.turn');
|
|
1344
1387
|
// The thread's computer is not up yet: the wait is a start, not work.
|
|
1345
1388
|
const runtimeReady = useRuntimeReady();
|
|
1346
|
-
|
|
1389
|
+
// The words streaming in are the busy signal: no "Gathering thoughts..." row
|
|
1390
|
+
// glued under them. It returns when the block closes or the text goes quiet.
|
|
1391
|
+
const answerStreaming = useAnswerStreaming(props.openText);
|
|
1392
|
+
return (_jsx(_Fragment, { children: !(answerStreaming && !quietBusy && !retryInfo) && showTurnBusyIndicator({
|
|
1347
1393
|
working: working && !suppressBusyIndicator,
|
|
1348
1394
|
hasError: !!turnError,
|
|
1349
1395
|
isRetrying: !!retryInfo,
|
|
@@ -1427,6 +1473,24 @@ function SessionTurnImpl(props) {
|
|
|
1427
1473
|
const errors = useTurnErrorState({ turn, turnOutcome });
|
|
1428
1474
|
const answered = useAnsweredQuestionState({ turn, questions, sessionId, blocks: model.blocks, hasSteps: model.hasSteps });
|
|
1429
1475
|
const userContent = useTurnUserContent({ turn, commandMessages, commands });
|
|
1476
|
+
// A turn whose prompt is another agent's notice (a sub-agent's report, a
|
|
1477
|
+
// teammate's update) folds that row into its work fold (KRTX-4732): the
|
|
1478
|
+
// parent's answer is the only top-level message. A settled turn with no
|
|
1479
|
+
// answer at all keeps the row at the top level, where it stays reachable;
|
|
1480
|
+
// the main transcript only — space threads hide notices already.
|
|
1481
|
+
const noticeRow = userContent.noticeBatch
|
|
1482
|
+
? _jsx(NoticeBatchGroup, { items: userContent.noticeBatch })
|
|
1483
|
+
: userContent.subagentNotice
|
|
1484
|
+
? _jsx(SubagentNoticeRow, { notice: userContent.subagentNotice })
|
|
1485
|
+
: userContent.peerMessage
|
|
1486
|
+
? _jsx(PeerMessageRow, { info: userContent.peerMessage })
|
|
1487
|
+
: undefined;
|
|
1488
|
+
// A run's anchor folds its own notice too, answered or not: the run's row keeps it reachable.
|
|
1489
|
+
const workNotice = rows
|
|
1490
|
+
? undefined
|
|
1491
|
+
: isAgentNoticeTurn(turn) && (model.working || turn.assistant.length > 0 || !!props.agentRun)
|
|
1492
|
+
? noticeRow
|
|
1493
|
+
: undefined;
|
|
1430
1494
|
const status = useTurnLiveStatus({ turn, blocks: model.blocks, agentWorking: model.agentWorking });
|
|
1431
1495
|
const retry = useTurnRetryState({ sessionStatus, isWorkingTurn });
|
|
1432
1496
|
const meta = useTurnSettledMeta({ working: model.working, turn });
|
|
@@ -1437,6 +1501,19 @@ function SessionTurnImpl(props) {
|
|
|
1437
1501
|
permissions,
|
|
1438
1502
|
sessionId,
|
|
1439
1503
|
});
|
|
1504
|
+
// Inside an agent run, the agent's relays between colleagues (`send_message`) are noise:
|
|
1505
|
+
// the reports say what happened (KRTX-4732).
|
|
1506
|
+
const inRun = !!props.agentRun || !!props.runMember;
|
|
1507
|
+
const turnSegments = useMemo(() => (inRun ? withoutRelayCalls(segments) : segments), [inRun, segments]);
|
|
1508
|
+
const { runTurns, agentRun } = props;
|
|
1509
|
+
// The run's other turns, drawn by the anchor, each as a run member: its work in the fold,
|
|
1510
|
+
// its answer under the run row. Each member is a memoized row: a render of the anchor costs a
|
|
1511
|
+
// shallow prop compare per member.
|
|
1512
|
+
const runMembers = (part) => agentRun && runTurns?.length
|
|
1513
|
+
? runTurns.map((member) => (_jsx(SessionTurn, { ...props, turn: member, runMember: part, agentRun: undefined, runTurns: undefined, foldStartedWork: false, isWorkingTurn: false, pending: false, pendingPrompt: undefined, interruptedBeforeRun: false, isFirstTurn: false, isLast: false, ownsPlan: false }, member.id)))
|
|
1514
|
+
: null;
|
|
1515
|
+
const runContent = runMembers('work');
|
|
1516
|
+
const runAnswers = runMembers('answer');
|
|
1440
1517
|
// A compaction turn's message-state — `inFlight` (the marker still
|
|
1441
1518
|
// streams its summary) is the half of "is this compaction running" the
|
|
1442
1519
|
// working projection cannot see, because it deliberately knows nothing
|
|
@@ -1447,6 +1524,17 @@ function SessionTurnImpl(props) {
|
|
|
1447
1524
|
const genuiModel = turn.assistant.at(-1)?.model?.model;
|
|
1448
1525
|
const genuiScope = turn.id;
|
|
1449
1526
|
const genuiTelemetry = useMemo(() => ({ scope: genuiScope, ...(genuiModel ? { model: genuiModel } : {}) }), [genuiScope, genuiModel]);
|
|
1527
|
+
// A run member (KRTX-4732): its report and the work it led to, in the anchor's fold...
|
|
1528
|
+
if (props.runMember === 'work') {
|
|
1529
|
+
return (_jsxs("div", { "data-testid": "agent-run-member", className: "flex min-w-0 flex-col gap-3", children: [noticeRow, _jsx(GenuiTelemetryContext.Provider, { value: genuiTelemetry, children: _jsx(TurnToolBlocks, { ...props, model: model, segments: turnSegments, conversationDensity: conversationDensity, fold: !answered.shouldUseInlineContent, durationMs: null, part: "work" }) })] }));
|
|
1530
|
+
}
|
|
1531
|
+
// ...and its answer, with its error or stop row and its outcomes, under the run row. A silent
|
|
1532
|
+
// report draws only the outcomes it left (a change request), which hide themselves when none.
|
|
1533
|
+
if (props.runMember === 'answer') {
|
|
1534
|
+
if (!turn.response && !turn.error && turn.status !== 'aborted')
|
|
1535
|
+
return _jsx(TurnOutcomes, { turnKey: turn.id });
|
|
1536
|
+
return (_jsxs("div", { "data-testid": "agent-run-answer", className: "space-y-2.5", children: [_jsxs(GenuiTelemetryContext.Provider, { value: genuiTelemetry, children: [_jsx(TurnToolBlocks, { ...props, model: model, segments: turnSegments, conversationDensity: conversationDensity, fold: !answered.shouldUseInlineContent, durationMs: null, part: "answer" }), _jsx(TurnAssistantBlock, { ...props, model: model, answered: answered, userContent: userContent, tHardcodedUi: tHardcodedUi })] }), _jsx(TurnFooter, { ...props, model: model, errors: errors, answered: answered, status: status, retry: retry, meta: meta, tHardcodedUi: tHardcodedUi, connectProviderOpen: connectProviderOpen, onConnectProviderOpenChange: setConnectProviderOpen })] }));
|
|
1537
|
+
}
|
|
1450
1538
|
// Shell mode: a synthetic prompt answered by one bare `bash` call.
|
|
1451
1539
|
if (turn.shell) {
|
|
1452
1540
|
return (_jsx(TurnShellMode, { ...props, call: sessionLogOpenCall(turn.shell), working: model.working, errors: errors, connectProviderOpen: connectProviderOpen, onConnectProviderOpenChange: setConnectProviderOpen }));
|
|
@@ -1529,7 +1617,7 @@ function SessionTurnImpl(props) {
|
|
|
1529
1617
|
// The segments are already the message's: nothing is left to fold.
|
|
1530
1618
|
fold: !messagesOnly && !answered.shouldUseInlineContent, durationMs: meta.turnDurationMs })), _jsx(TurnAssistantBlock, { ...props, model: model, answered: answered, userContent: userContent, tHardcodedUi: tHardcodedUi })] }), messagesOnly && !model.working && errors.turnErrorIsAbort && model.response.trim() === '' && shownSegments.length === 0 ? (_jsx("p", { className: "text-muted-foreground text-sm", children: tTurnRows('stopped') })) : null, _jsx(TurnFooter, { ...props, hideActionBar: true, quietBusy: messagesOnly, model: model, errors: errors, answered: answered, status: status, retry: retry, meta: meta, tHardcodedUi: tHardcodedUi, connectProviderOpen: connectProviderOpen, onConnectProviderOpenChange: setConnectProviderOpen }), messagesOnly && !model.working ? (_jsx(TurnMessageWork, { ...props, model: model, segments: segments, shown: shownSegments, userContent: userContent, conversationDensity: conversationDensity, front: rows.front === true })) : null] }) })) : null] }));
|
|
1531
1619
|
}
|
|
1532
|
-
return (_jsxs("div", { className: "group/turn text-factor-[2] space-y-2.5", children: [_jsx(TurnUserBlock, { ...props, model: model, queueTone: queueTone, userContent: userContent }), props.isFirstTurn ? afterFirstPrompt : null, _jsx(TurnFallbackRows, { working: model.working, events: props.servedModel?.fallbacks }), _jsxs(GenuiTelemetryContext.Provider, { value: genuiTelemetry, children: [_jsx(TurnToolBlocks, { ...props, model: model, segments:
|
|
1620
|
+
return (_jsxs("div", { className: "group/turn text-factor-[2] space-y-2.5", children: [_jsx(TurnUserBlock, { ...props, model: model, queueTone: queueTone, userContent: userContent, noticeInWork: !!workNotice }), props.isFirstTurn ? afterFirstPrompt : null, _jsx(TurnFallbackRows, { working: model.working, events: props.servedModel?.fallbacks }), _jsxs(GenuiTelemetryContext.Provider, { value: genuiTelemetry, children: [_jsx(TurnToolBlocks, { ...props, model: model, segments: turnSegments, conversationDensity: conversationDensity, fold: !answered.shouldUseInlineContent, durationMs: meta.turnDurationMs, workNotice: workNotice, runContent: runContent, runLabel: agentRun ? sessionLogAgentRunLabel(agentRun) : undefined, foldStartedWork: props.foldStartedWork }), runAnswers, _jsx(TurnAssistantBlock, { ...props, model: model, answered: answered, userContent: userContent, tHardcodedUi: tHardcodedUi })] }), _jsx(TurnFooter, { ...props, model: model, errors: errors, answered: answered, status: status, retry: retry, meta: meta, tHardcodedUi: tHardcodedUi, connectProviderOpen: connectProviderOpen, onConnectProviderOpenChange: setConnectProviderOpen })] }));
|
|
1533
1621
|
}
|
|
1534
1622
|
/**
|
|
1535
1623
|
* The boundary that stops the transcript re-rendering with the stream.
|
|
@@ -1,54 +1,5 @@
|
|
|
1
1
|
import type { ToolProps } from '../shared/types.js';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* The bash tool's input carries a `description` — the one-line summary the
|
|
6
|
-
* model writes for its own call ("Install the workspace dependencies"). The
|
|
7
|
-
* SDK already reads it as this tool's subtitle (`core/turns/parts.ts`, case
|
|
8
|
-
* `'bash'`), so the row promotes a source it had been dropping rather than
|
|
9
|
-
* inventing one. A reader scanning a turn wants to know what a command was
|
|
10
|
-
* FOR, and `pnpm -w install --frozen-lockfile` answers that only if they read
|
|
11
|
-
* shell.
|
|
12
|
-
*
|
|
13
|
-
* Three rules, in order:
|
|
14
|
-
* - A failure keeps its verdict. "Command failed" is the one thing a friendly
|
|
15
|
-
* summary must never soften, so it outranks any description.
|
|
16
|
-
* - No description → exactly today's "Ran command". Nothing is ever derived
|
|
17
|
-
* from the command text: a classifier answering "Installed dependencies" to
|
|
18
|
-
* `npm i` would put a claim in the model's mouth that it never made.
|
|
19
|
-
* - Sentence case only lifts a lower-case opener. Lowering the rest would turn
|
|
20
|
-
* "Run CI on the release branch" into "Run ci on the release branch".
|
|
21
|
-
*/
|
|
22
|
-
export declare function bashRowTitle(description: unknown, failed: boolean): string;
|
|
23
|
-
/**
|
|
24
|
-
* The command as the reader should see it: leading indent stripped, blank
|
|
25
|
-
* edges dropped.
|
|
26
|
-
*
|
|
27
|
-
* Commands arrive with incidental leading whitespace — a model quoting a
|
|
28
|
-
* command out of indented YAML/JSON sends ` agent-browser open …`. The
|
|
29
|
-
* trigger row hides it (a `truncate` span collapses spaces under normal
|
|
30
|
-
* white-space), but the card's `whitespace-pre-wrap` pane renders it verbatim,
|
|
31
|
-
* so the first line sits two characters deeper than its own wrapped
|
|
32
|
-
* continuation and the output below — an inverse hanging indent that reads as
|
|
33
|
-
* broken padding.
|
|
34
|
-
*
|
|
35
|
-
* Two rules, because a one-line command and a script are different documents:
|
|
36
|
-
*
|
|
37
|
-
* - **One line has no structure to protect**, so every leading blank is noise
|
|
38
|
-
* and all of it goes. This is the case a common-indent rule cannot be
|
|
39
|
-
* trusted with alone: it only strips what it can MEASURE, and the measure
|
|
40
|
-
* used to be `[ \t]` — so a command indented with a non-breaking space (or
|
|
41
|
-
* any other Unicode space; agents paste these out of rendered docs and
|
|
42
|
-
* spreadsheets) kept its indent and drew exactly the misalignment above.
|
|
43
|
-
* - **A script keeps its shape**: the COMMON indent goes, never a per-line
|
|
44
|
-
* trim, so nesting survives. Heredocs survive by construction — a non-`<<-`
|
|
45
|
-
* heredoc needs its terminator at column 0, which pins the common indent to
|
|
46
|
-
* 0 and makes this a no-op exactly where indentation is load-bearing.
|
|
47
|
-
*
|
|
48
|
-
* `[^\S\r\n]` is "whitespace that is not a line break", so both rules count
|
|
49
|
-
* every horizontal space character the Unicode table has, not just the two on
|
|
50
|
-
* a US keyboard. The trailing trim also stops a final `\n` from counting as a
|
|
51
|
-
* phantom `+1` line in the trigger.
|
|
52
|
-
*/
|
|
53
|
-
export declare function dedentCommand(raw: string): string;
|
|
2
|
+
import { bashRowTitle, dedentCommand } from '../../../_vendor/shared/session/tool-row-text.js';
|
|
3
|
+
/** The row-title and dedent rules live once in `@kortix/shared/session/tool-row-text`. */
|
|
4
|
+
export { bashRowTitle, dedentCommand };
|
|
54
5
|
export declare function BashTool({ call, defaultOpen, forceOpen, locked }: ToolProps): import("react").JSX.Element;
|
|
@@ -11,98 +11,15 @@ import { CopyButton } from '../../../markdown/copy-button.js';
|
|
|
11
11
|
import { formatBashOutput, InlineSessionMessagesList, parseSessionMessagesOutput, parseSessionMetadataOutput, SessionMetadataList, } from '../shared/session-helpers.js';
|
|
12
12
|
import { hasStructuredContent, normalizeToolOutput, parseStructuredOutput, } from '../../../internal/lib/utils/structured-output.js';
|
|
13
13
|
import { shellExitCode, stripAnsi } from '../../../internal/session-types/index.js';
|
|
14
|
+
import { bashRowTitle, dedentCommand } from '../../../_vendor/kortix-shared.js';
|
|
14
15
|
import { TerminalIcon } from '@phosphor-icons/react';
|
|
15
16
|
import { toolKind } from '@kortix/sdk';
|
|
16
17
|
import { useContext, useMemo } from 'react';
|
|
17
18
|
import { ChannelBrandMark } from '../../turn/channel-brand.js';
|
|
18
19
|
import { channelSendText, parseChannelSendCommand } from './channel-send.js';
|
|
19
20
|
import { ChannelSendCard, channelSendTitle } from './channel-send-card.js';
|
|
20
|
-
/** The row
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* The words a settled row leads with.
|
|
24
|
-
*
|
|
25
|
-
* The bash tool's input carries a `description` — the one-line summary the
|
|
26
|
-
* model writes for its own call ("Install the workspace dependencies"). The
|
|
27
|
-
* SDK already reads it as this tool's subtitle (`core/turns/parts.ts`, case
|
|
28
|
-
* `'bash'`), so the row promotes a source it had been dropping rather than
|
|
29
|
-
* inventing one. A reader scanning a turn wants to know what a command was
|
|
30
|
-
* FOR, and `pnpm -w install --frozen-lockfile` answers that only if they read
|
|
31
|
-
* shell.
|
|
32
|
-
*
|
|
33
|
-
* Three rules, in order:
|
|
34
|
-
* - A failure keeps its verdict. "Command failed" is the one thing a friendly
|
|
35
|
-
* summary must never soften, so it outranks any description.
|
|
36
|
-
* - No description → exactly today's "Ran command". Nothing is ever derived
|
|
37
|
-
* from the command text: a classifier answering "Installed dependencies" to
|
|
38
|
-
* `npm i` would put a claim in the model's mouth that it never made.
|
|
39
|
-
* - Sentence case only lifts a lower-case opener. Lowering the rest would turn
|
|
40
|
-
* "Run CI on the release branch" into "Run ci on the release branch".
|
|
41
|
-
*/
|
|
42
|
-
export function bashRowTitle(description, failed) {
|
|
43
|
-
if (failed)
|
|
44
|
-
return 'Command failed';
|
|
45
|
-
// Collapsed, because a description arrives as free text and may carry a
|
|
46
|
-
// newline; a trigger row renders it on one line either way.
|
|
47
|
-
const summary = typeof description === 'string' ? description.replace(/\s+/g, ' ').trim() : '';
|
|
48
|
-
if (!summary)
|
|
49
|
-
return 'Ran command';
|
|
50
|
-
const cased = /^[a-z]/.test(summary) ? summary[0].toUpperCase() + summary.slice(1) : summary;
|
|
51
|
-
if (cased.length <= TITLE_MAX)
|
|
52
|
-
return cased;
|
|
53
|
-
// Trim the tail before the ellipsis. `truncate` in `lib/utils/string` cuts on
|
|
54
|
-
// the character count alone, which strands a space in front of the ellipsis
|
|
55
|
-
// whenever the cut lands just after a word.
|
|
56
|
-
return `${cased.slice(0, TITLE_MAX).trimEnd()}…`;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* The command as the reader should see it: leading indent stripped, blank
|
|
60
|
-
* edges dropped.
|
|
61
|
-
*
|
|
62
|
-
* Commands arrive with incidental leading whitespace — a model quoting a
|
|
63
|
-
* command out of indented YAML/JSON sends ` agent-browser open …`. The
|
|
64
|
-
* trigger row hides it (a `truncate` span collapses spaces under normal
|
|
65
|
-
* white-space), but the card's `whitespace-pre-wrap` pane renders it verbatim,
|
|
66
|
-
* so the first line sits two characters deeper than its own wrapped
|
|
67
|
-
* continuation and the output below — an inverse hanging indent that reads as
|
|
68
|
-
* broken padding.
|
|
69
|
-
*
|
|
70
|
-
* Two rules, because a one-line command and a script are different documents:
|
|
71
|
-
*
|
|
72
|
-
* - **One line has no structure to protect**, so every leading blank is noise
|
|
73
|
-
* and all of it goes. This is the case a common-indent rule cannot be
|
|
74
|
-
* trusted with alone: it only strips what it can MEASURE, and the measure
|
|
75
|
-
* used to be `[ \t]` — so a command indented with a non-breaking space (or
|
|
76
|
-
* any other Unicode space; agents paste these out of rendered docs and
|
|
77
|
-
* spreadsheets) kept its indent and drew exactly the misalignment above.
|
|
78
|
-
* - **A script keeps its shape**: the COMMON indent goes, never a per-line
|
|
79
|
-
* trim, so nesting survives. Heredocs survive by construction — a non-`<<-`
|
|
80
|
-
* heredoc needs its terminator at column 0, which pins the common indent to
|
|
81
|
-
* 0 and makes this a no-op exactly where indentation is load-bearing.
|
|
82
|
-
*
|
|
83
|
-
* `[^\S\r\n]` is "whitespace that is not a line break", so both rules count
|
|
84
|
-
* every horizontal space character the Unicode table has, not just the two on
|
|
85
|
-
* a US keyboard. The trailing trim also stops a final `\n` from counting as a
|
|
86
|
-
* phantom `+1` line in the trigger.
|
|
87
|
-
*/
|
|
88
|
-
export function dedentCommand(raw) {
|
|
89
|
-
const text = raw.replace(/^[\r\n]+/, '').trimEnd();
|
|
90
|
-
if (!text)
|
|
91
|
-
return '';
|
|
92
|
-
const lines = text.split('\n');
|
|
93
|
-
// One line: strip the lot. `trimEnd` above already took the other end.
|
|
94
|
-
if (lines.length === 1)
|
|
95
|
-
return lines[0].replace(/^[^\S\r\n]+/, '');
|
|
96
|
-
let min = Infinity;
|
|
97
|
-
for (const line of lines) {
|
|
98
|
-
if (!line.trim())
|
|
99
|
-
continue;
|
|
100
|
-
min = Math.min(min, /^[^\S\r\n]*/.exec(line)[0].length);
|
|
101
|
-
}
|
|
102
|
-
if (!min || min === Infinity)
|
|
103
|
-
return text;
|
|
104
|
-
return lines.map((line) => line.slice(min)).join('\n');
|
|
105
|
-
}
|
|
21
|
+
/** The row-title and dedent rules live once in `@kortix/shared/session/tool-row-text`. */
|
|
22
|
+
export { bashRowTitle, dedentCommand };
|
|
106
23
|
/**
|
|
107
24
|
* The command, syntax-highlighted, with its output beneath a hairline.
|
|
108
25
|
*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long the open text block may go without growing before the busy row
|
|
3
|
+
* returns. Text deltas arrive well under a second apart. A longer silence
|
|
4
|
+
* means the model moved on: the harness shows a tool call only once it runs
|
|
5
|
+
* (`tool_execution_start`), so while a large call's arguments stream the open
|
|
6
|
+
* text block is still the last block and no longer grows.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ANSWER_QUIET_AFTER_MS = 3000;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the answer's open text block is still being written.
|
|
11
|
+
*
|
|
12
|
+
* While the words arrive they are the busy signal, so the turn's busy row
|
|
13
|
+
* ("Gathering thoughts...") stays hidden instead of sitting glued under the
|
|
14
|
+
* streaming text. The row comes back when the block closes (a tool call or
|
|
15
|
+
* the next step starts), and when the text stops growing for `quietMs`: a
|
|
16
|
+
* stream that went silent must not look like a finished answer.
|
|
17
|
+
*
|
|
18
|
+
* `text` is the open block's text (`openTextBlock`), `undefined` when no
|
|
19
|
+
* block is open.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useAnswerStreaming(text: string | undefined, quietMs?: number): boolean;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* How long the open text block may go without growing before the busy row
|
|
4
|
+
* returns. Text deltas arrive well under a second apart. A longer silence
|
|
5
|
+
* means the model moved on: the harness shows a tool call only once it runs
|
|
6
|
+
* (`tool_execution_start`), so while a large call's arguments stream the open
|
|
7
|
+
* text block is still the last block and no longer grows.
|
|
8
|
+
*/
|
|
9
|
+
export const ANSWER_QUIET_AFTER_MS = 3_000;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the answer's open text block is still being written.
|
|
12
|
+
*
|
|
13
|
+
* While the words arrive they are the busy signal, so the turn's busy row
|
|
14
|
+
* ("Gathering thoughts...") stays hidden instead of sitting glued under the
|
|
15
|
+
* streaming text. The row comes back when the block closes (a tool call or
|
|
16
|
+
* the next step starts), and when the text stops growing for `quietMs`: a
|
|
17
|
+
* stream that went silent must not look like a finished answer.
|
|
18
|
+
*
|
|
19
|
+
* `text` is the open block's text (`openTextBlock`), `undefined` when no
|
|
20
|
+
* block is open.
|
|
21
|
+
*/
|
|
22
|
+
export function useAnswerStreaming(text, quietMs = ANSWER_QUIET_AFTER_MS) {
|
|
23
|
+
const hasText = !!text?.trim();
|
|
24
|
+
// The text that last went silent for `quietMs`. Any growth makes it stale,
|
|
25
|
+
// so the row hides again without a reset in the effect.
|
|
26
|
+
const [quietText, setQuietText] = useState(null);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!hasText)
|
|
29
|
+
return;
|
|
30
|
+
const timer = setTimeout(() => setQuietText(text), quietMs);
|
|
31
|
+
return () => clearTimeout(timer);
|
|
32
|
+
}, [text, hasText, quietMs]);
|
|
33
|
+
return hasText && quietText !== text;
|
|
34
|
+
}
|
|
@@ -20,4 +20,9 @@ export declare function QueuedPromptFailure({ lastError, onRetry, onRemove, }: {
|
|
|
20
20
|
onRetry?: () => void;
|
|
21
21
|
onRemove?: () => void;
|
|
22
22
|
}): import("react").JSX.Element;
|
|
23
|
+
/** A failed callback path requires a new computer, not a retry on the old one. */
|
|
24
|
+
export declare function QueuedPromptRecovery({ projectId, onRemove }: {
|
|
25
|
+
projectId?: string;
|
|
26
|
+
onRemove?: () => void;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
23
28
|
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { newSessionHref } from '../../lib/routes.js';
|
|
4
|
+
import { UiLink } from '../../providers/ui-provider.js';
|
|
3
5
|
import { Button } from '../../primitives/button.js';
|
|
6
|
+
import { ButtonGroup } from '../../primitives/button-group.js';
|
|
4
7
|
import { InlineMeta } from '../../primitives/inline-meta.js';
|
|
5
8
|
import { useTranslations } from '../../i18n/index.js';
|
|
6
9
|
/** Pending text stays legible while the active turn continues above it. */
|
|
@@ -25,3 +28,12 @@ export function QueuedPromptFailure({ lastError, onRetry, onRemove, }) {
|
|
|
25
28
|
const common = useTranslations('common');
|
|
26
29
|
return (_jsx(InlineMeta, { children: _jsxs("span", { "data-queued-status": "failed", className: "flex items-center gap-1", children: [_jsxs("span", { className: "text-kortix-red", role: "status", title: lastError ?? undefined, children: [copy.raw('textcd5f943d5863'), lastError ? ` — ${lastError}` : ''] }), onRetry && (_jsx(Button, { type: "button", variant: "ghost", size: "xs", onClick: onRetry, children: copy.raw('text942087cc2d41') })), onRemove && (_jsx(Button, { type: "button", variant: "ghost", size: "xs", onClick: onRemove, children: common('remove') }))] }) }));
|
|
27
30
|
}
|
|
31
|
+
/** A failed callback path requires a new computer, not a retry on the old one. */
|
|
32
|
+
export function QueuedPromptRecovery({ projectId, onRemove }) {
|
|
33
|
+
const sidebar = useTranslations('sidebar');
|
|
34
|
+
const turn = useTranslations('sessionUi.turn');
|
|
35
|
+
const common = useTranslations('common');
|
|
36
|
+
const newSession = projectId ? (_jsx(Button, { variant: "ghost", size: "xs", asChild: true, children: _jsx(UiLink, { href: newSessionHref(projectId), children: sidebar('newSession') }) })) : null;
|
|
37
|
+
const remove = onRemove ? (_jsx(Button, { type: "button", variant: "ghost", size: "xs", onClick: onRemove, children: common('remove') })) : null;
|
|
38
|
+
return (_jsxs("div", { "data-queued-status": "failed", className: "flex flex-col items-end gap-1", children: [_jsx("span", { role: "status", className: "text-kortix-red text-xs", children: turn('computerDisconnected') }), newSession && remove ? _jsxs(ButtonGroup, { children: [newSession, remove] }) : newSession ?? remove] }));
|
|
39
|
+
}
|
|
@@ -9,7 +9,9 @@ export declare const WorkFoldContext: import("react").Context<boolean>;
|
|
|
9
9
|
* the reader touched while it worked settles with its row open.
|
|
10
10
|
*/
|
|
11
11
|
export declare const WorkTouchContext: import("react").Context<(() => void) | null>;
|
|
12
|
-
export declare function TurnWorkAccordion({ durationMs, open, onToggle, contentId, }: {
|
|
12
|
+
export declare function TurnWorkAccordion({ label, durationMs, open, onToggle, contentId, }: {
|
|
13
|
+
/** The row's words in place of "Worked for …": an agent run's (`sessionLogAgentRunLabel`). */
|
|
14
|
+
label?: string;
|
|
13
15
|
/** `sessionTurnDurationMs(turn)`; `null` reads "Worked". */
|
|
14
16
|
durationMs: number | null;
|
|
15
17
|
open: boolean;
|
|
@@ -27,6 +27,6 @@ export const WorkFoldContext = createContext(false);
|
|
|
27
27
|
* the reader touched while it worked settles with its row open.
|
|
28
28
|
*/
|
|
29
29
|
export const WorkTouchContext = createContext(null);
|
|
30
|
-
export function TurnWorkAccordion({ durationMs, open, onToggle, contentId, }) {
|
|
31
|
-
return (_jsx("div", { className: cn('flex items-center', open && 'border-border/60 border-b pb-2'), children: _jsxs("button", { type: "button", "aria-expanded": open, "aria-controls": open ? contentId : undefined, onClick: onToggle, className: cn('group/work text-muted-foreground/70 hover:text-muted-foreground flex min-w-0 cursor-pointer items-center gap-2', 'focus-visible:ring-ring/50 rounded-sm text-left text-sm transition-colors select-none focus-visible:ring-2 focus-visible:outline-none'), children: [_jsx("span", { className: "min-w-0 truncate tabular-nums", children: workedForLabel(durationMs) }), _jsx(CaretRightIcon, { "aria-hidden": true, className: cn('text-muted-foreground/40 group-hover/work:text-muted-foreground/70 size-3.5 flex-none transition-[transform,color]', open && 'rotate-90') })] }) }));
|
|
30
|
+
export function TurnWorkAccordion({ label, durationMs, open, onToggle, contentId, }) {
|
|
31
|
+
return (_jsx("div", { className: cn('flex items-center', open && 'border-border/60 border-b pb-2'), children: _jsxs("button", { type: "button", "aria-expanded": open, "aria-controls": open ? contentId : undefined, onClick: onToggle, className: cn('group/work text-muted-foreground/70 hover:text-muted-foreground flex min-w-0 cursor-pointer items-center gap-2', 'focus-visible:ring-ring/50 rounded-sm text-left text-sm transition-colors select-none focus-visible:ring-2 focus-visible:outline-none'), children: [_jsx("span", { className: "min-w-0 truncate tabular-nums", children: label ?? workedForLabel(durationMs) }), _jsx(CaretRightIcon, { "aria-hidden": true, className: cn('text-muted-foreground/40 group-hover/work:text-muted-foreground/70 size-3.5 flex-none transition-[transform,color]', open && 'rotate-90') })] }) }));
|
|
32
32
|
}
|