@kortix/ui 0.15.9 → 0.15.11
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 +467 -2
- package/dist/_vendor/shared/app-config.d.ts +6 -30
- package/dist/_vendor/shared/channel-descriptors.d.ts +0 -34
- package/dist/_vendor/shared/channel-header.d.ts +2 -1
- package/dist/_vendor/shared/connector-sections.d.ts +0 -25
- package/dist/_vendor/shared/file-tags.d.ts +2 -1
- package/dist/_vendor/shared/index.d.ts +1 -0
- package/dist/_vendor/shared/pasted-content.d.ts +0 -4
- package/dist/_vendor/shared/pixel-mark.d.ts +0 -17
- package/dist/_vendor/shared/project-glyphs.d.ts +0 -1
- 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/customize/agents/agent-model-view.d.ts +11 -1
- package/dist/customize/agents/agent-model-view.js +12 -1
- package/dist/customize/agents/agent-page.js +19 -6
- package/dist/customize/agents/agent-tabs.d.ts +2 -0
- package/dist/customize/agents/agent-tabs.js +2 -0
- package/dist/customize/connectors/connectors-page.js +1 -1
- package/dist/customize/connectors/detail/connector-page.js +9 -4
- package/dist/customize/connectors/detail/connector-triggers.js +1 -1
- package/dist/customize/connectors/install/use-install.js +1 -1
- package/dist/customize/connectors/use-agent-access.d.ts +1 -0
- package/dist/customize/providers/provider-accordion.js +5 -5
- package/dist/customize/providers/provider-connect.d.ts +3 -3
- package/dist/customize/providers/provider-connect.js +8 -16
- package/dist/customize/providers/provider-sheet.js +4 -4
- package/dist/customize/sections/component/teams-byo-wizard.js +4 -1
- 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/view/review-center-connected.js +7 -3
- package/dist/customize/settings/tabs/workspace-keys.js +53 -11
- package/dist/customize/shared/feature-gate-screen.js +1 -1
- package/dist/customize/triggers/runtime-triggers.js +13 -2
- package/dist/customize/triggers/schedule/event-account-picker.js +1 -1
- package/dist/customize/triggers/schedule/event-trigger-copy.js +1 -1
- package/dist/customize/triggers/schedule/schedule-detail-sheet.js +5 -4
- package/dist/customize/triggers/schedule/then-fields.d.ts +5 -1
- package/dist/customize/triggers/schedule/then-fields.js +23 -3
- package/dist/customize/triggers/schedule/trigger-callouts.js +1 -1
- package/dist/customize/triggers/schedule/trigger-composer-logic.d.ts +27 -0
- package/dist/customize/triggers/schedule/trigger-composer-logic.js +51 -5
- package/dist/customize/triggers/schedule/trigger-composer.js +19 -13
- package/dist/customize/triggers/schedule/trigger-edit-logic.js +25 -5
- package/dist/customize/triggers/schedule/trigger-filter.d.ts +10 -3
- package/dist/customize/triggers/schedule/trigger-filter.js +7 -6
- package/dist/customize/triggers/schedule/trigger-readonly.js +1 -1
- package/dist/customize/triggers/schedule/trigger-runs-panel.js +1 -1
- package/dist/customize/triggers/schedule/use-event-app-connect.js +2 -1
- package/dist/customize/triggers/schedule/when-event.js +1 -1
- package/dist/customize/triggers/schedule/when-schedule.d.ts +5 -1
- package/dist/customize/triggers/schedule/when-schedule.js +16 -1
- package/dist/customize/triggers/schedule-view.js +4 -2
- package/dist/i18n/en.d.ts +56 -7
- package/dist/i18n/en.js +65 -16
- package/dist/internal/billing/compute-pricing.d.ts +7 -1
- package/dist/internal/billing/compute-pricing.js +7 -1
- 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.js +1 -1
- package/dist/internal/hooks/connectors/use-pipedream-connect-member.js +1 -1
- package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +1 -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/layout/project-settings-nav.d.ts +17 -0
- package/dist/internal/layout/project-settings-nav.js +24 -0
- package/dist/internal/lib/browser-noise/rules/injected-scripts.js +2 -2
- package/dist/internal/lib/capability-tab-routes.d.ts +8 -0
- package/dist/internal/lib/capability-tab-routes.js +11 -0
- package/dist/internal/notifications/notification-inbox.d.ts +4 -10
- package/dist/internal/notifications/notification-inbox.js +8 -9
- package/dist/internal/stores/composer-prefill-store.d.ts +7 -0
- package/dist/internal/stores/composer-prefill-store.js +1 -0
- 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/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/actions/session-label.js +2 -2
- package/dist/session/agents/agent-strip.d.ts +10 -5
- package/dist/session/agents/agent-strip.js +40 -12
- package/dist/session/agents/held-messages.d.ts +6 -2
- package/dist/session/agents/held-messages.js +6 -3
- package/dist/session/composer/ComposerCard.js +8 -3
- package/dist/session/composer/agent-selector.d.ts +2 -0
- package/dist/session/composer/agent-selector.js +5 -0
- 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 +3 -1
- package/dist/session/composer/composer-chat-input.js +2 -2
- package/dist/session/composer/composer-logic.d.ts +7 -0
- package/dist/session/composer/composer-logic.js +18 -0
- package/dist/session/composer/composer-reset.d.ts +8 -14
- package/dist/session/composer/composer-toolbar.d.ts +3 -1
- package/dist/session/composer/composer-toolbar.js +3 -3
- package/dist/session/composer/composer.d.ts +9 -0
- package/dist/session/composer/composer.js +22 -11
- 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 +13 -7
- package/dist/session/composer/hooks/use-composer-focus.js +4 -2
- package/dist/session/header/session-site-header.d.ts +3 -1
- package/dist/session/header/session-site-header.js +3 -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/connect-model-step.d.ts +29 -0
- package/dist/session/models/connect-model-step.js +50 -0
- package/dist/session/models/model-connection-gate.d.ts +2 -1
- package/dist/session/models/model-connection-gate.js +6 -3
- 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-selector.d.ts +1 -1
- package/dist/session/models/model-selector.js +9 -6
- package/dist/session/models/subscription-offer.d.ts +4 -0
- package/dist/session/models/subscription-offer.js +11 -3
- package/dist/session/models/use-workspace-model-gate.d.ts +11 -0
- package/dist/session/models/use-workspace-model-gate.js +62 -0
- package/dist/session/models/workspace-model-gate.d.ts +46 -0
- package/dist/session/models/workspace-model-gate.js +66 -0
- 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-card.d.ts +63 -0
- package/dist/session/prompts/{session-connect-prompt.js → session-connect-card.js} +53 -42
- package/dist/session/status/provisioning-failure.d.ts +23 -2
- package/dist/session/status/provisioning-failure.js +53 -3
- 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 +317 -298
- package/dist/session/thread/transcript.d.ts +19 -2
- package/dist/session/thread/transcript.js +93 -25
- package/dist/session/tool/tool-part-renderer.js +7 -2
- package/dist/session/tool/tools/bash-tool.d.ts +3 -52
- package/dist/session/tool/tools/bash-tool.js +3 -86
- package/dist/session/tool/tools/kortix-action-tool.js +10 -2
- 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-viewport.d.ts +66 -10
- package/dist/session/turn/turn-viewport.js +92 -12
- package/dist/session/turn/turn-work-accordion.d.ts +3 -1
- package/dist/session/turn/turn-work-accordion.js +2 -2
- package/dist/session/turn/user-message.js +7 -5
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +56 -7
- package/dist/workspace/admin/project-admin-dashboard.js +2 -4
- package/dist/workspace/home/existing-repo-setup-prompt.d.ts +5 -8
- package/dist/workspace/home/existing-repo-setup-prompt.js +16 -42
- package/dist/workspace/home/first-chat.d.ts +7 -1
- package/dist/workspace/home/first-chat.js +12 -5
- package/dist/workspace/home/no-agent-home.d.ts +3 -1
- package/dist/workspace/home/no-agent-home.js +2 -2
- 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 +17 -16
- 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/session-grouping.d.ts +1 -1
- package/dist/workspace/sidebar/session-grouping.js +1 -1
- package/dist/workspace/sidebar/workspace-menu-model.d.ts +3 -5
- package/dist/workspace/sidebar/workspace-menu-model.js +1 -1
- package/dist/workspace/spaces/space-details-panel.js +2 -2
- package/dist/workspace/spaces/space-triggers.js +2 -2
- package/dist/workspace/spaces/space-view.js +11 -5
- package/package.json +15 -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
- package/dist/session/prompts/session-connect-prompt.d.ts +0 -40
|
@@ -5,7 +5,7 @@ import { uiRoutes } from '../../lib/routes.js';
|
|
|
5
5
|
import { isQuestionTool } from '@kortix/sdk';
|
|
6
6
|
import { SessionAccessPrompt } from '../prompts/session-access-prompt.js';
|
|
7
7
|
import { SessionApprovalPrompt } from '../prompts/session-approval-prompt.js';
|
|
8
|
-
import {
|
|
8
|
+
import { SessionConnectRequestsProvider } from '../prompts/session-connect-card.js';
|
|
9
9
|
import { childSessionHref } from '../tool/tools/session-spawn-urls.js';
|
|
10
10
|
import { SessionPermissionPrompt } from '../prompts/session-permission-prompt.js';
|
|
11
11
|
import { useSessionWallpaperLayer } from '../panel/session-wallpaper-layer.js';
|
|
@@ -118,6 +118,7 @@ import { HELD_COMMAND_ROW_PREFIX, canReleaseHeldCommand, heldCommandRows, } from
|
|
|
118
118
|
import { useSessionHistoryViewStore } from '../../internal/stores/session-history-view-store.js';
|
|
119
119
|
import { downloadBlob } from '../../internal/lib/utils/download.js';
|
|
120
120
|
import { RestoreNotice, hasOutOfContext } from './session-history.js';
|
|
121
|
+
import { useAgentRunLayout } from './agent-run-props.js';
|
|
121
122
|
import { TranscriptTurnRow, isAgentNoticeTurn, strandedPromptIds, optimisticAnswersCache, promptTexts, resolveTurnError, } from './transcript.js';
|
|
122
123
|
export { SessionReportCard, deriveTurnErrorAbortState, deriveTurnErrorPresentation } from './transcript.js';
|
|
123
124
|
// ============================================================================
|
|
@@ -1257,7 +1258,9 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1257
1258
|
const messageCount = messages?.length ?? 0;
|
|
1258
1259
|
const { scrollRef, contentRef, spacerElRef, showScrollButton, scrollToBottom, smoothScrollToAbsoluteBottom, anchorTurn, startAtTop, } = useAutoScroll({
|
|
1259
1260
|
hasContent: messageCount > 0,
|
|
1260
|
-
|
|
1261
|
+
// Pin the newest prompt while it runs. Settled history needs only the
|
|
1262
|
+
// bottom gap, so short conversations reveal their earlier turns.
|
|
1263
|
+
room: !transcriptRows && effectiveBusy,
|
|
1261
1264
|
});
|
|
1262
1265
|
// Cmd/Ctrl+P prints the WHOLE conversation. The shortcut is intercepted
|
|
1263
1266
|
// because neither half of what printing needs can be done in CSS: the
|
|
@@ -1497,8 +1500,6 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1497
1500
|
const [approvalDocked, setApprovalDocked] = useState(false);
|
|
1498
1501
|
// My Kortix asking to give a colleague access docks the same way.
|
|
1499
1502
|
const [accessDocked, setAccessDocked] = useState(false);
|
|
1500
|
-
// A connector sign-in the agent started docks the same way (`SessionConnectPrompt`).
|
|
1501
|
-
const [connectDocked, setConnectDocked] = useState(false);
|
|
1502
1503
|
const questionPromptTimerRef = useRef(null);
|
|
1503
1504
|
useEffect(() => {
|
|
1504
1505
|
const nextQuestion = activePendingQuestion;
|
|
@@ -1987,6 +1988,10 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1987
1988
|
// Turns whose prompt is another agent's notice: the work continues across
|
|
1988
1989
|
// them, so they sit a continuation's distance below the turn above.
|
|
1989
1990
|
const agentNoticeTurnIds = useMemo(() => new Set(turns.filter((turn) => isAgentNoticeTurn(turn)).map((turn) => turn.id)), [turns]);
|
|
1991
|
+
// A person's agents report back as one unit: the reports and work of a run fold into one row
|
|
1992
|
+
// on its last turn, and every answer stays in view under it (KRTX-4732). The main transcript
|
|
1993
|
+
// only: a messages-only thread already hides notices.
|
|
1994
|
+
const agentRunLayout = useAgentRunLayout(turns, transcriptRows);
|
|
1990
1995
|
const turnRenderKeys = useMemo(() => {
|
|
1991
1996
|
const keys = new Map();
|
|
1992
1997
|
const used = new Set();
|
|
@@ -2485,8 +2490,11 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2485
2490
|
const inboxRowExists = async () => {
|
|
2486
2491
|
if (!projectId || !projectSessionId)
|
|
2487
2492
|
return false;
|
|
2488
|
-
const { prompts } = await listSessionPrompts(projectId, projectSessionId);
|
|
2489
|
-
|
|
2493
|
+
const { prompts, sent } = await listSessionPrompts(projectId, projectSessionId);
|
|
2494
|
+
// A delivered prompt leaves `prompts` and is listed in `sent` until the
|
|
2495
|
+
// session log holds it, under the wire id this send minted.
|
|
2496
|
+
const delivered = (sent ?? []).some((row) => row.message_id === messageID || row.wire_message_id === messageID);
|
|
2497
|
+
return delivered || inboxHoldsLivePrompt(prompts, clientMessageId);
|
|
2490
2498
|
};
|
|
2491
2499
|
const deliver = async (detached) => {
|
|
2492
2500
|
// A detached send (uploads, or an earlier send of this session still
|
|
@@ -2693,6 +2701,16 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2693
2701
|
return { ok: true };
|
|
2694
2702
|
}
|
|
2695
2703
|
catch (cause) {
|
|
2704
|
+
// A lost ACK does not refuse a prompt the inbox already holds.
|
|
2705
|
+
// Resolve that verdict before the composer can restore its draft:
|
|
2706
|
+
// recoverFromSendFailure checks asynchronously and returns an error now.
|
|
2707
|
+
if (!keepsPainted && (await inboxRowExists().catch(() => false))) {
|
|
2708
|
+
acceptSendReceipt(messageID);
|
|
2709
|
+
attachments?.release();
|
|
2710
|
+
if (!paintTranscript)
|
|
2711
|
+
useQueuedDraftStore.getState().markPosted(sessionId, clientMessageId);
|
|
2712
|
+
return { ok: true };
|
|
2713
|
+
}
|
|
2696
2714
|
// A kept send is settled below: its painted message stays.
|
|
2697
2715
|
if (keepsPainted)
|
|
2698
2716
|
return { ok: false, cause, error: null };
|
|
@@ -3419,7 +3437,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3419
3437
|
// The agents this session started, as one line in the composer's under-row
|
|
3420
3438
|
// (Claude Code's agent panel). It reads its own lists and never holds the composer.
|
|
3421
3439
|
const agentsLineCompact = !!transcriptRows && !isPhone;
|
|
3422
|
-
const chatUnderbarSlot = useMemo(() => _jsx(AgentsLine, { projectId: projectId, sessionId: projectSessionId, compact: agentsLineCompact }), [projectId, projectSessionId, agentsLineCompact]);
|
|
3440
|
+
const chatUnderbarSlot = useMemo(() => (_jsx(AgentsLine, { projectId: projectId, sessionId: projectSessionId, compact: agentsLineCompact, live: isServerBusy })), [projectId, projectSessionId, agentsLineCompact, isServerBusy]);
|
|
3423
3441
|
// A space's thread lists only the queue's live messages in its card: failed
|
|
3424
3442
|
// ones and a Stop hold read as calm lines (`ChatQueueLines`), reports wait behind Resume.
|
|
3425
3443
|
const calmRest = useMemo(() => [...queueRows.rows, ...heldCommandRows(heldCommands)].filter((row) => row.state !== 'failed' && !row.synthetic), [queueRows.rows, heldCommands]);
|
|
@@ -3461,13 +3479,11 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3461
3479
|
effectiveBusy,
|
|
3462
3480
|
canStop,
|
|
3463
3481
|
]);
|
|
3464
|
-
const chatInputSlot = useMemo(() => (_jsxs(_Fragment, { children: [_jsx(SessionApprovalPrompt, { onDockedChange: setApprovalDocked }), _jsx(SessionAccessPrompt, { projectId: projectId ?? '', asks: accessAsks, onDockedChange: setAccessDocked }),
|
|
3482
|
+
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
|
|
3465
3483
|
? 'duration-slow max-h-130 translate-y-0 opacity-100'
|
|
3466
3484
|
: '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] })), [
|
|
3467
3485
|
projectId,
|
|
3468
3486
|
accessAsks,
|
|
3469
|
-
effectiveBusy,
|
|
3470
|
-
projectSessionId,
|
|
3471
3487
|
sessionId,
|
|
3472
3488
|
sessionScopeAgentName,
|
|
3473
3489
|
pendingPermissions,
|
|
@@ -3728,296 +3744,299 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3728
3744
|
}
|
|
3729
3745
|
return (
|
|
3730
3746
|
// A read-only view (the sub-session modal) offers no fix inside a tool card.
|
|
3731
|
-
_jsx(ReadOnlySessionContext.Provider, { value: !!readOnly, children: _jsx(AgentActivateContext.Provider, { value: agentActivate, children: _jsx(SessionPromptContext.Provider, { value: readOnly ? null : sendSessionPrompt, children: _jsx(ProjectFilesProvider, { value: { projectId: projectId ?? '', ref: outcomesBaseRef, defaultBranch: outcomesBaseRef }, children: _jsxs(ComposerDropZone, { className: cn('relative flex h-full flex-col', 'pb-[env(safe-area-inset-bottom)]', // audit:allow device safe-area inset, not a spacing step — the composer column lifts above the home indicator in the installed PWA; desktop reports a 0px inset
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
(
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
//
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
: '
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
// A thread a space's chat opened by itself does not take the focus (`ComposerAutoFocusContext`).
|
|
3968
|
-
, {
|
|
3747
|
+
_jsx(ReadOnlySessionContext.Provider, { value: !!readOnly, children: _jsx(SessionConnectRequestsProvider, { projectId: readOnly ? null : projectId, sessionId: projectSessionId, busy: effectiveBusy, children: _jsx(AgentActivateContext.Provider, { value: agentActivate, children: _jsx(SessionPromptContext.Provider, { value: readOnly ? null : sendSessionPrompt, children: _jsx(ProjectFilesProvider, { value: { projectId: projectId ?? '', ref: outcomesBaseRef, defaultBranch: outcomesBaseRef }, children: _jsxs(ComposerDropZone, { className: cn('relative flex h-full flex-col', 'pb-[env(safe-area-inset-bottom)]', // audit:allow device safe-area inset, not a spacing step — the composer column lifts above the home indicator in the installed PWA; desktop reports a 0px inset
|
|
3748
|
+
// Transparent in the welcome state so the root-level full-bleed wallpaper
|
|
3749
|
+
// (portaled into SessionLayout) reads through; solid once real content
|
|
3750
|
+
// takes over. Same base color either way, so non-welcome is unchanged.
|
|
3751
|
+
shouldShowWelcomeOverlay || transparent ? 'bg-transparent' : 'bg-background'), "data-testid": "session-chat", children: [isPreparingPrint && (_jsxs("div", { "data-print-hide": true, role: "status", className: "bg-popover text-muted-foreground fixed bottom-6 left-1/2 z-50 flex -translate-x-1/2 items-center gap-2 rounded-lg border px-4 py-2 text-xs shadow-lg", children: [_jsx(Loading, { className: "size-3.5 shrink-0" }), tHardcodedUi.raw('i18nComplete.text7dac2ca010fe')] })), wallpaperLayer
|
|
3752
|
+
? welcomeWallpaper && createPortal(welcomeWallpaper, wallpaperLayer)
|
|
3753
|
+
: welcomeWallpaper, !hideHeader && (_jsx(SessionSiteHeader, { sessionId: sessionId, sessionTitle: session?.title || 'Untitled', leadingAction: headerLeadingAction, parent: parentCrumb, live: isServerBusy })), _jsx(ModelSwitchHistory, { history: projectSessionRow?.metadata?.model_switches, current: projectSessionRow?.metadata?.model }), _jsx(SessionContextModal, { open: contextModalOpen, onOpenChange: setContextModalOpen,
|
|
3754
|
+
// A chat with no `useSession` source: the raw explorer lists the
|
|
3755
|
+
// rows `useSessionSync` read for it.
|
|
3756
|
+
detachedRows: sessionState ? undefined : hookMessages, source: sessionState ?? DETACHED_SESSION_MESSAGES, session: session, sessionRow: projectSessionRow, providers: providers, allSessions: allSessions, servedModel: sessionServedModel, billedCost: sessionBilledCost(modelUsage) }), _jsx(CompactModal, { sessionId: sessionId, open: compactModalOpen, onOpenChange: setCompactModalOpen }), _jsx(ChangeRequestDetailDialog, { crId: openCrId, onClose: () => setOpenCrId(null), onOpenChangeRequest: setOpenCrId }), _jsxs(SessionBodyRow, { actionPanel: !hideHeader && !readOnly, children: [isNotFound ? (_jsxs("div", { className: "flex min-h-0 flex-1 flex-col items-center justify-center gap-3 px-6 text-center", children: [_jsx("div", { className: "text-muted-foreground text-sm", children: tHardcodedUi.raw('componentsSessionSessionChat.line5821JsxTextThisSessionIsNotAccessibleRightNow') }), _jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { href: "/", prefetch: true, onClick: () => {
|
|
3757
|
+
try {
|
|
3758
|
+
if (sessionId)
|
|
3759
|
+
useTabStore.getState().closeTab?.(sessionId);
|
|
3760
|
+
}
|
|
3761
|
+
catch { }
|
|
3762
|
+
}, children: tHardcodedUi.raw('componentsSessionSessionChat.line5833JsxTextGoToHome') }) })] })) : (_jsxs("div", { ref: chatAreaRef, className: "relative z-10 min-h-0 flex-1", children: [_jsx("div", { ref: scrollContainerCallbackRef, className: cn(
|
|
3763
|
+
// overflow-anchor:none — this scroll area does ALL of its own
|
|
3764
|
+
// anchoring (useAutoScroll's spacer + RAF follow, the send-path
|
|
3765
|
+
// turn anchor, and the history-prepend content-space restore in
|
|
3766
|
+
// session-history-scroll.ts). The browser's native scroll
|
|
3767
|
+
// anchoring (default `overflow-anchor: auto`) tries to
|
|
3768
|
+
// compensate for the SAME prepends independently, and the two
|
|
3769
|
+
// corrections stacking is the other half of the scroll-up
|
|
3770
|
+
// teleport: ours restores the reader's position, then the
|
|
3771
|
+
// native one nudges it again.
|
|
3772
|
+
'scrollbar-hide relative z-10 h-full flex-1 overflow-y-auto [scroll-behavior:auto] [overflow-anchor:none]', shouldShowWelcomeOverlay || transparent ? 'bg-transparent' : 'bg-background'), onMouseUp: handleChatMouseUp, onMouseDown: handleChatMouseDown, onScroll: handleChatScroll, children: _jsxs("div", { ref: contentRef, role: "log",
|
|
3773
|
+
// Width and gutters live in `SESSION_TRANSCRIPT_CLASS`: the
|
|
3774
|
+
// instant shell draws this same column and the two crossfade
|
|
3775
|
+
// into each other, so a difference here is a sideways jump on
|
|
3776
|
+
// screen, not a style opinion. See session-body.tsx.
|
|
3777
|
+
//
|
|
3778
|
+
// No bottom padding, there or here: the space under the last
|
|
3779
|
+
// message is the auto-scroll spacer's job alone. The `pb-32`
|
|
3780
|
+
// that used to sit here stacked 128px of dead space on top of
|
|
3781
|
+
// it — the "extra inset at the bottom of the session".
|
|
3782
|
+
// Rows run edge to edge: each row owns its gutters and its hover fill.
|
|
3783
|
+
className: transcriptRows ? 'w-full min-w-0 pt-4' : SESSION_TRANSCRIPT_CLASS, children: [_jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx(SessionPrintHeader, { title: session?.title || 'Untitled', agentName: composerAgentName }), (hasOlder || showOlderLoading) && (_jsxs("div", { className: "mb-6 flex flex-col items-center gap-2", children: [hasOlder && (_jsx("div", { ref: olderSentinelRef, "aria-hidden": true, className: "h-px w-full" })), showOlderLoading && (_jsxs("div", { role: "status", className: "text-muted-foreground flex items-center gap-2 py-1 text-xs", children: [_jsx(Loading, { className: "size-3.5 shrink-0" }), tHardcodedUi.raw('i18nComplete.text85bf890776a7')] })), !showOlderLoading &&
|
|
3784
|
+
!olderPullFailed &&
|
|
3785
|
+
olderAutoloadExhausted({ hasOlder, autoLoadedPages }) && (_jsx(Button, { type: "button", variant: "outline-ghost", size: "sm", onClick: () => void handleLoadOlder(), children: tHardcodedUi.raw('i18nComplete.textf17671d83db0') })), olderPullFailed && !showOlderLoading && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-muted-foreground text-xs", children: tHardcodedUi.raw('i18nComplete.textb03a0041ce33') }), _jsx(Button, { type: "button", variant: "outline-ghost", size: "sm", onClick: () => void handleLoadOlder(), children: tHardcodedUi.raw('i18nComplete.text942087cc2d41') })] }))] })), restoreNotice && !restoreDismissed && (_jsx(RestoreNotice, { notice: restoreNotice, onDismiss: () => dismissRestore(historyKey, restoreNotice.generation) })), _jsx(SessionOutcomesProvider, { projectSessionId: projectSessionId, turnSpans: turnSpans, busy: effectiveBusy, onOpen: handleOpenOutcome, onJump: handleJumpToOutcome, jumping: jumpingToOutcome, children: _jsxs(ToolActivateContext.Provider, { value: toolActivate, children: [showFirstPromptPreview &&
|
|
3786
|
+
firstPromptSource &&
|
|
3787
|
+
queuedSyntheticMessages.length === 0 &&
|
|
3788
|
+
rowsContext && (
|
|
3789
|
+
// A channel thread draws the stand-in as rows, the same
|
|
3790
|
+
// rows its boot body drew (`ThreadBootRows`).
|
|
3791
|
+
_jsx(PendingPromptRows, { text: buildOptimisticPromptTextWithUploads(firstPromptSource.text, firstPromptSource.files), author: rowsContext.owner, sessionId: sessionId, busy: turns.length === 0 && (lastTurnWorking || promptInbox.prompts.some(isFirstPromptRow)) })), showFirstPromptPreview &&
|
|
3792
|
+
firstPromptSource &&
|
|
3793
|
+
queuedSyntheticMessages.length === 0 &&
|
|
3794
|
+
!rowsContext && (_jsx(OptimisticTurn, { text: buildOptimisticPromptTextWithUploads(firstPromptSource.text, firstPromptSource.files),
|
|
3795
|
+
// Preserve a real failed-send status through the
|
|
3796
|
+
// boot-shell handover without inventing upload progress.
|
|
3797
|
+
// A first prompt held on its uploads carries its own.
|
|
3798
|
+
uploadStatus: firstPromptSource.uploadStatus ?? firstPromptUploadStatus, agentNames: agentNames, onFileClick: openFileInComputer, sessionId: sessionId,
|
|
3799
|
+
// The first item of the conversation, like turn 0, which has no
|
|
3800
|
+
// top margin. `first:mt-0` misses here: the list opens with a
|
|
3801
|
+
// zero-height <header>, so the stand-in sat 44px lower than turn 0
|
|
3802
|
+
// and every swap between the two jumped the bubble (KRTX-2931).
|
|
3803
|
+
className: "mt-0",
|
|
3804
|
+
// An undelivered first prompt is a turn about to start, as the
|
|
3805
|
+
// shell above this chat shows it: busy from the first frame,
|
|
3806
|
+
// before the working projection has read the inbox (KRTX-2931).
|
|
3807
|
+
busy: turns.length === 0 && (lastTurnWorking || promptInbox.prompts.some(isFirstPromptRow)) })), turns.map((turn, turnIndex) => {
|
|
3808
|
+
// Check if this turn is a compaction summary — and
|
|
3809
|
+
// whether it actually PRODUCED one. A failed/aborted
|
|
3810
|
+
// attempt (compaction-flagged, no content, not the
|
|
3811
|
+
// working turn) renders as one slim row, draws no
|
|
3812
|
+
// divider, and stacks tight against a neighbouring
|
|
3813
|
+
// failed attempt.
|
|
3814
|
+
const compaction = turn.compaction;
|
|
3815
|
+
const hasCompaction = compaction !== null;
|
|
3816
|
+
const isTurnWorking = turn.live;
|
|
3817
|
+
// `inFlight` (message state) alongside the projection:
|
|
3818
|
+
// classifying by projection alone flipped a streaming
|
|
3819
|
+
// compaction to "failed" for the frames where the two
|
|
3820
|
+
// disagree, popping the divider in and out — a layout
|
|
3821
|
+
// bounce right where the reader is looking.
|
|
3822
|
+
const isFailedCompaction = compaction !== null &&
|
|
3823
|
+
!compaction.hasContent &&
|
|
3824
|
+
!compaction.inFlight &&
|
|
3825
|
+
!isTurnWorking;
|
|
3826
|
+
// Retries collapse to ONE visible row, GLOBALLY: a
|
|
3827
|
+
// failed attempt with ANY later compaction turn (a
|
|
3828
|
+
// retry, or the one that finally landed) is history —
|
|
3829
|
+
// it keeps its TurnViewport (stable keys, scroll
|
|
3830
|
+
// anchors) but renders no content, and an empty
|
|
3831
|
+
// TurnViewport costs 0px (turn-viewport.tsx RULE 2).
|
|
3832
|
+
// Adjacency was not enough: attempts whose error landed
|
|
3833
|
+
// on a plain assistant message used to interleave as
|
|
3834
|
+
// unclassified turns, breaking every consecutive run.
|
|
3835
|
+
const suppressedFailedCompaction = isFailedCompaction && turnIndex < lastCompactionTurnIndex;
|
|
3836
|
+
// Notification-only early-return removed: it rendered the
|
|
3837
|
+
// user's pty_* card but skipped the turn's replies,
|
|
3838
|
+
// hiding every subsequent assistant response in that turn.
|
|
3839
|
+
// Fall through to the normal turn renderer instead.
|
|
3840
|
+
const confirmedActive = turnIsConfirmedActive({
|
|
3841
|
+
isTurnWorking,
|
|
3842
|
+
turnId: turn.id,
|
|
3843
|
+
activeTurnId,
|
|
3844
|
+
pendingDelivery: !!working.pendingDelivery,
|
|
3845
|
+
});
|
|
3846
|
+
const pendingPrompt = !confirmedActive && turn.assistant.length === 0
|
|
3847
|
+
? pendingPromptsByMessageId.get(turn.id)
|
|
3848
|
+
: undefined;
|
|
3849
|
+
// A queued prompt is not in the runtime transcript yet;
|
|
3850
|
+
// its author still shows (`authorForTurn`).
|
|
3851
|
+
const promptAuthorId = pendingPromptsByMessageId.get(turn.id)?.author_user_id;
|
|
3852
|
+
const turnAuthor = authorForTurn(transcriptAuthors, messageAuthors, turn.id, pendingPrompt?.wire_message_id) ??
|
|
3853
|
+
participantAuthor(sessionParticipants, promptAuthorId) ??
|
|
3854
|
+
(sentHereIds.current.has(turn.id) ||
|
|
3855
|
+
sentHereIds.current.has(turnRenderKeys.get(turn.id) ?? '') ||
|
|
3856
|
+
(viewerId !== undefined && promptAuthorId === viewerId) ||
|
|
3857
|
+
// The first prompt of a session the viewer started,
|
|
3858
|
+
// sent from another surface (project home), before
|
|
3859
|
+
// the first authors read lands.
|
|
3860
|
+
(messageAuthorsLoading &&
|
|
3861
|
+
viewerId !== undefined &&
|
|
3862
|
+
projectSessionRow?.created_by === viewerId &&
|
|
3863
|
+
turn.id === userMessageIds[0])
|
|
3864
|
+
? viewerAsAuthor
|
|
3865
|
+
: undefined);
|
|
3866
|
+
return (_jsx(TranscriptTurnRow
|
|
3867
|
+
// ONE element per prompt: keyed by the id the
|
|
3868
|
+
// bubble was FIRST painted under, so the swap to a
|
|
3869
|
+
// re-minted echo id re-renders this node instead
|
|
3870
|
+
// of mounting a new one (opacity keeps animating,
|
|
3871
|
+
// hover state survives, nothing jumps).
|
|
3872
|
+
, { turnId: turn.id, modelOptions: modelOptions,
|
|
3873
|
+
// An absorbed run turn keeps its viewport (keys, scroll
|
|
3874
|
+
// anchors) and draws nothing: its anchor folds it.
|
|
3875
|
+
suppressed: suppressedFailedCompaction || agentRunLayout.absorbed.has(turn.id), ...agentRunLayout.propsOf(turn.id), continuedWith: harnessSwitches.get(turn.id)?.harness, fullTextState: loaded.state[turn.id] ?? 'idle', onLoadFullText: loadFullTexts, showBusyRow: showFallbackBusyRow &&
|
|
3876
|
+
fallbackBusyRowTurnId === turn.id,
|
|
3877
|
+
// Queued bubbles STACK: a pending turn right after
|
|
3878
|
+
// another pending turn sits close to it, like a
|
|
3879
|
+
// list of what is waiting — not a turn's width
|
|
3880
|
+
// apart as if each had been answered in between.
|
|
3881
|
+
// (Failed compaction rows need no stacking rule any
|
|
3882
|
+
// more — at most one is visible at a time.)
|
|
3883
|
+
viewportClassName: turnIndex === 0 || transcriptRows
|
|
3884
|
+
? ''
|
|
3885
|
+
: // A compaction, the work after it and another agent's notice continue the turn above.
|
|
3886
|
+
turn.compaction || turn.continues || agentNoticeTurnIds.has(turn.id)
|
|
3887
|
+
? 'mt-6'
|
|
3888
|
+
: lastTurnWorking &&
|
|
3889
|
+
pendingTurnIds.has(turn.id) &&
|
|
3890
|
+
pendingTurnIds.has(turns[turnIndex - 1].id)
|
|
3891
|
+
? 'mt-3'
|
|
3892
|
+
: 'mt-12', turn: turn, author: turnAuthor,
|
|
3893
|
+
// Reserve the sender row while the authors load,
|
|
3894
|
+
// for a queued prompt whose sender is known, and
|
|
3895
|
+
// for a live message until its author resolves.
|
|
3896
|
+
showAuthor: !!turnAuthor ||
|
|
3897
|
+
messageAuthorsLoading ||
|
|
3898
|
+
!!promptAuthorId ||
|
|
3899
|
+
(loadedUserIds?.sessionId === sessionId &&
|
|
3900
|
+
!loadedUserIds.ids.has(turn.id) &&
|
|
3901
|
+
authorsGaveUp !== missingAuthors), stoppedBy: stoppedByName(messageAuthors, turn.id, viewerId), servedModel: servedModelOfTurn(modelUsage, turn.id, turns[turnIndex - 1]?.id), turnOutcome: turnOutcome, isLast: turn.id === lastUserMessageId, ownsPlan: turn.id === planAnchorId, sessionId: sessionId, projectId: projectId, projectSessionId: projectSessionId, sessionStatus: sessionStatus, permissions: pendingPermissions, questions: pendingQuestions, agentNames: agentNames, isFirstTurn: turnIndex === 0,
|
|
3902
|
+
// Handed over only once the stand-in has stepped
|
|
3903
|
+
// aside — while it is up it draws these itself.
|
|
3904
|
+
pendingText: turnIndex === 0 ? firstTurnHandover?.text : undefined, pendingAttachments: sentAttachmentsForTurn({
|
|
3905
|
+
sentByMessage: sentAttachmentsByMessage,
|
|
3906
|
+
messageId: turn.id,
|
|
3907
|
+
originId: optimisticOriginOf(sessionId, turn.id),
|
|
3908
|
+
isFirstTurn: turnIndex === 0,
|
|
3909
|
+
firstTurnHandover: firstTurnHandover?.attachments,
|
|
3910
|
+
firstTurnSent: firstPromptAttachments(projectSessionId),
|
|
3911
|
+
queuedRowAttachments: inboxRowsByMessageId.get(turn.id)?.attachments,
|
|
3912
|
+
}), uploadStatus: heldSendFailures?.[turn.id]
|
|
3913
|
+
? {
|
|
3914
|
+
state: 'failed',
|
|
3915
|
+
message: heldSendFailures[turn.id].message,
|
|
3916
|
+
onRetry: () => retryHeldSend(sessionId, turn.id, resendHeldSend, (error) => classifySessionError(error).message),
|
|
3917
|
+
}
|
|
3918
|
+
: turnIndex === 0 && firstTurnHandover?.attachments.length
|
|
3919
|
+
? firstPromptUploadStatus
|
|
3920
|
+
: undefined, sessionWorking: lastTurnWorking, isWorkingTurn: turn.live, suppressBusyIndicator: suppressWorkingTurnBusy, awaitingUser: awaitingUserInput,
|
|
3921
|
+
// An idle send stays in the inbox until delivery,
|
|
3922
|
+
// but nothing runs ahead of it: queued only while
|
|
3923
|
+
// it waits behind a turn (`turnRendersQueued`).
|
|
3924
|
+
// The first turn, with no turn working, has
|
|
3925
|
+
// nothing ahead of it: a session's first prompt is
|
|
3926
|
+
// starting, not queued, while the computer comes up
|
|
3927
|
+
// and before the turn layer marks it queued or live.
|
|
3928
|
+
pending: turnIndex === 0 && workingTurn.workingTurnId === null && !confirmedActive
|
|
3929
|
+
? pendingPrompt?.state === 'waiting' || pendingPrompt?.state === 'failed'
|
|
3930
|
+
: turnRendersQueued({
|
|
3931
|
+
turnId: turn.id,
|
|
3932
|
+
resolution: workingTurn,
|
|
3933
|
+
sessionWorking: lastTurnWorking,
|
|
3934
|
+
confirmedActive,
|
|
3935
|
+
inboxPrompt: pendingPrompt,
|
|
3936
|
+
}), pendingPrompt: pendingPrompt, onRetryQueued: stableRetryQueued, onRemoveQueued: stableRemoveQueued, queuedPromptViewer: queuedPromptViewer, interruptedBeforeRun: interruptedTurnIds.has(turn.id), isCompaction: hasCompaction, onOpenCompactionSummary: panel ? stableOpenCompactionSummary : undefined, onOpenPastedContent: panel ? stableOpenPastedContent : undefined, providers: providers, commandMessages: commandMessagesRef.current, commands: commands, disableToolNavigation: disableToolNavigation, onPermissionReply: stablePermissionReply, onRewind: stableRewind, editingText: rewindTarget?.messageId === turn.id
|
|
3937
|
+
? rewindTarget.text
|
|
3938
|
+
: null, editPending: editSendPending || !!sessionState?.rewindPending, onEditCancel: stableEditCancel, onEditSend: stableEditSend, rewindDisabled: !!readOnly ||
|
|
3939
|
+
(rewindable !== null && !rewindable.has(turn.id)) ||
|
|
3940
|
+
!runtimeCanRewind ||
|
|
3941
|
+
!sessionState ||
|
|
3942
|
+
isBusy ||
|
|
3943
|
+
sessionState.rewindPending ||
|
|
3944
|
+
// The runtime is not idle while queued prompts
|
|
3945
|
+
// are still on their way to it — a rewind mid-
|
|
3946
|
+
// delivery fails downstream with "Session is
|
|
3947
|
+
// busy" (measured); refuse it up front instead.
|
|
3948
|
+
promptInbox.prompts.length > 0 }, turnRenderKeys.get(turn.id)));
|
|
3949
|
+
})] }) }), isOptimisticCompacting && !hasCompactionTurn && (_jsx("div", { className: turns.length > 0 ? 'mt-12' : 'mt-2', children: _jsx(CompactionMarker, { running: true }) })), [
|
|
3950
|
+
...(turnOutcome.recent_failures ?? []),
|
|
3951
|
+
...(turnOutcome.last_ended?.end_reason === 'failed' &&
|
|
3952
|
+
!turnOutcome.recent_failures?.some((failure) => failure.message_id === turnOutcome.last_ended?.message_id)
|
|
3953
|
+
? [turnOutcome.last_ended]
|
|
3954
|
+
: []),
|
|
3955
|
+
].filter((failure) => !isAbortError(failure.error) &&
|
|
3956
|
+
!failureShownByTurn(failure, turns) &&
|
|
3957
|
+
!failureSupersededByTurn(failure, turns) &&
|
|
3958
|
+
(!failure.error?.message || failure.error.message !== commandError?.message)).map((failure) => {
|
|
3959
|
+
const messageId = failure.message_id ?? 'persisted-turn-failure';
|
|
3960
|
+
// Use the SDK's settle window for a cause that may arrive
|
|
3961
|
+
// one frame later, including an unnamed failed last turn.
|
|
3962
|
+
const notice = turnEndNotice({
|
|
3963
|
+
...turnOutcome,
|
|
3964
|
+
recent_failures: [{ ...failure, message_id: messageId, error: failure.error ?? null }],
|
|
3965
|
+
}, messageId, { hasError: false, isAbort: false });
|
|
3966
|
+
return notice ? (_jsx(TurnErrorDisplay, { errorText: notice.kind === 'unexplained'
|
|
3967
|
+
? tHardcodedUi.raw('i18nComplete.text73112526c03a')
|
|
3968
|
+
: persistedFailureText(failure.error), className: "mt-2" }, messageId)) : null;
|
|
3969
|
+
}), commandError && (_jsx(TurnErrorDisplay, { error: commandError, isAbort: isAbortError(commandError.cause), modelOptions: modelOptions, className: "mt-2" })), showFallbackBusyRow && fallbackBusyRowTurnId === null && (rowsContext ? (
|
|
3970
|
+
// A channel thread waits in the agent's answer row.
|
|
3971
|
+
_jsx(AgentBusyRow, { sessionId: sessionId })) : (_jsx(SessionBusyIndicator, { sessionId: sessionId,
|
|
3972
|
+
// Matches the stand-in's row spacing under a bubble
|
|
3973
|
+
// (`OptimisticTurn`), so the crossfade into the real
|
|
3974
|
+
// transcript does not move it. Nothing above it when
|
|
3975
|
+
// the transcript is empty, so no margin there.
|
|
3976
|
+
className: turns.length === 0 ? undefined : 'mt-6' })))] }), _jsx("div", { ref: spacerElRef, "data-scroll-spacer": true })] }) }), selectionPopup && (_jsx("div", { "data-reply-popup": true, className: "absolute z-50", style: {
|
|
3977
|
+
left: `${selectionPopup.x}px`,
|
|
3978
|
+
top: `${selectionPopup.y}px`,
|
|
3979
|
+
transform: 'translate(-50%, -100%)',
|
|
3980
|
+
}, children: _jsxs(Button, { onClick: handleSelectionReply, size: "sm", className: "animate-in fade-in-0 zoom-in-95 duration-normal origin-bottom px-3 text-xs ease-out has-[>svg]:px-3", children: [tHardcodedUi.raw('i18nComplete.textc253f451bdd5'), _jsx(ArrowBendUpLeftIcon, { className: "size-4 shrink-0" })] }) })), transcriptRows ? null : (_jsx(ChatMinimap, { turns: turns, scrollRef: scrollRef, contentRef: contentRef })), _jsx("div", { className: cn('absolute inset-x-0 bottom-4 z-20 flex justify-center', !showScrollButton && 'pointer-events-none'), children: _jsx(Button, { variant: "outline", size: "icon-md", "aria-hidden": !showScrollButton, tabIndex: showScrollButton ? undefined : -1, className: cn('hit-area-2 bg-background hover:bg-muted rounded-full', 'transition-[opacity,scale] ease-[cubic-bezier(0.23,1,0.32,1)] active:scale-[0.96] motion-reduce:scale-100 motion-reduce:transition-opacity', showScrollButton
|
|
3981
|
+
? 'duration-normal scale-100 opacity-100'
|
|
3982
|
+
: 'duration-fast scale-[0.97] opacity-0'), onClick: smoothScrollToAbsoluteBottom, children: _jsx(CaretDownIcon, { className: "size-4" }) }) })] })), readOnly && inputReplacement ? (_jsx("div", { className: cn(COMPOSER_SHELL_CLASS, 'pb-4'), children: inputReplacement })) : null, !readOnly && (_jsxs(_Fragment, { children: [_jsx(SessionChatInput
|
|
3969
3983
|
// `undefined`, not `true`, once released: the composer's own
|
|
3970
3984
|
// viewport rule (>= 640px) still decides, so this never forces
|
|
3971
3985
|
// focus onto a phone keyboard.
|
|
3972
3986
|
// A thread a space's chat opened by itself does not take the focus (`ComposerAutoFocusContext`).
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
//
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
3987
|
+
, {
|
|
3988
|
+
// `undefined`, not `true`, once released: the composer's own
|
|
3989
|
+
// viewport rule (>= 640px) still decides, so this never forces
|
|
3990
|
+
// focus onto a phone keyboard.
|
|
3991
|
+
// A thread a space's chat opened by itself does not take the focus (`ComposerAutoFocusContext`).
|
|
3992
|
+
autoFocus: deferComposerFocus || !composerAutoFocus ? false : undefined, onSend: async (text, files, mentions, attachments, placement) => {
|
|
3993
|
+
if (await queueEdit.save(text))
|
|
3994
|
+
return;
|
|
3995
|
+
// Enter or Cmd/Ctrl+Enter while a turn runs steers it (one delivery mode).
|
|
3996
|
+
await handleSend(text, files, mentions, attachments, composerSendDelivery(placement ?? 'transcript', isBusyRef.current));
|
|
3997
|
+
}, prefill: composerPrefill, onPrefillApplied: (id) => {
|
|
3998
|
+
useSessionComposerPrefillStore.getState().clearPrefill(sessionId, id);
|
|
3999
|
+
},
|
|
4000
|
+
// Up from the first row takes the queue back; the placeholder
|
|
4001
|
+
// says so while there is something to take.
|
|
4002
|
+
onArrowUpAtStart: () => queueEdit.takeBack(),
|
|
4003
|
+
// A host placeholder ("Reply…") is static: the rotating tips would replace it.
|
|
4004
|
+
hint: canTakeBackQueue ? tHardcodedUi.raw('i18nComplete.text03a01dd53ffa') : composerPlaceholder,
|
|
4005
|
+
// Editing a queued message: the send saves it back into the
|
|
4006
|
+
// queue, so the control says Submit, never Stop.
|
|
4007
|
+
submitLabel: queueEdit.editing ? tQueue('submitEdit') : null, draftScope: composerDraftScope, draftActive: !deferComposerFocus, attachRequestId: attachRequestId, isBusy: isBusy,
|
|
4008
|
+
// The ONE projection, not the 300 ms busy fade: it is what
|
|
4009
|
+
// decides whether a `/` command may be dispatched, and a fade
|
|
4010
|
+
// timer that has already lapsed would let one abort a live turn.
|
|
4011
|
+
// `effectiveBusy` folds in optimistic compaction (not a turn, so
|
|
4012
|
+
// not in `working`) and the retrying-turn predicate, so this
|
|
4013
|
+
// site reads one value instead of re-OR-ing a term onto it.
|
|
4014
|
+
sessionWorking: effectiveBusy,
|
|
4015
|
+
// Gates `/` COMMANDS only. A prompt typed at a sleeping box is
|
|
4016
|
+
// an inbox row and goes out when the box answers; a command has
|
|
4017
|
+
// no row, and `runCommand` swallows it silently until the
|
|
4018
|
+
// runtime is switched.
|
|
4019
|
+
runtimeReady: runtimeReady, rewind: composerRewind, onStop: handleStop, canStop: canStop, escCount: escCount, agents: local.agent.list, selectedAgent: composerAgentName, onAgentChange: handleAgentChange, noAccessibleAgents: noAccessibleAgents, commands: chatCommands, commandsResolved: agentCommands !== undefined, slashFiles: chatSlashFiles, onOpenPastedContent: panel ? stableOpenPastedContent : undefined, onCommand: handleCommand, onHoldCommand: handleHoldCommand, models: local.model.list, selectedModel: local.model.currentKey ?? null, onModelChange: handleModelChange, modelDefaultControls: chatModelDefaultControls, inheritedModel: inheritedModelFor(local.model, composerAgentName), variants: local.model.variant.list, selectedVariant: local.model.variant.current ?? null, onVariantChange: handleVariantChange, messages: messages, sessionId: sessionId, projectId: projectId, providers: providers, modelRequired: true, modelsLoading: providersLoading, onContextClick: handleContextClick, onCompactClick: runtimeCanCompact ? handleCompactClick : undefined, quoteRequests: quoteRequests, onQuoteRequestsApplied: handleQuoteRequestsApplied,
|
|
4020
|
+
// Locks while the docked question is answerable — a live
|
|
4021
|
+
// question or a parked ask — see `questionLock` above.
|
|
4022
|
+
lockForQuestion: questionLock,
|
|
4023
|
+
// Same dead-prompt guard as questions: only lock while the agent is
|
|
4024
|
+
// actually paused on the decision (isBusy), so a stale card can't
|
|
4025
|
+
// swallow the composer on an idle session.
|
|
4026
|
+
lockForApproval: runtimePermissionLocksComposer(livePermissions.length, isBusy), onCustomAnswer: handleCustomAnswer, questionButtonLabel: renderedQuestion ? questionAction.label : null, questionActive: !!renderedQuestion || approvalDocked || accessDocked, questionCanAct: questionAction.canAct, onQuestionAction: handleQuestionAction, aboveSlot: chatAboveSlot, inputSlot: chatInputSlot, toolbarSlot: chatToolbarSlot, underbarSlot: chatUnderbarSlot,
|
|
4027
|
+
// The shell can now render on a cached transcript alone, i.e. before
|
|
4028
|
+
// the sandbox answers — so sending has to be gated separately from
|
|
4029
|
+
// reading. See sessionComposerReadiness.
|
|
4030
|
+
notice: hostNotice(composerReadiness.notice, rowsContext?.notices),
|
|
4031
|
+
// Inside the thread panel's bordered box, as the channel composer.
|
|
4032
|
+
// A phone keeps the row under the card; a 720px desktop window does not.
|
|
4033
|
+
underbarPlacement: transcriptRows && !isPhone ? 'inline' : undefined,
|
|
4034
|
+
// The panel's toolbar is narrow: the agent is its tile, the model keeps its name.
|
|
4035
|
+
agentPickerCompact: transcriptRows && !isPhone,
|
|
4036
|
+
// A thread panel's rows run `px-5`, and the channel composer
|
|
4037
|
+
// beside it sits `pb-4` off the window's bottom edge: the same
|
|
4038
|
+
// margins, so the two boxes line up.
|
|
4039
|
+
parentClassName: transcriptRows ? 'max-w-none px-5 pb-4' : undefined, call: composerCall, onNoticeRetry: composerReadiness.notice && composerReadiness.retryable
|
|
4040
|
+
? requestRuntimeReconnect
|
|
4041
|
+
: undefined }), _jsx("div", { className: cn(COMPOSER_SHELL_CLASS, 'pb-3 empty:hidden', transcriptRows && 'max-w-none px-5'), children: _jsx(HeldMessages, { projectId: projectId, sessionId: projectSessionId, live: isServerBusy }) })] }))] })] }) }) }) }) }) }));
|
|
4023
4042
|
}
|