@kortix/ui 0.14.17 → 0.15.0
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/README.md +3 -3
- package/dist/_vendor/kortix-shared.js +993 -74
- package/dist/_vendor/shared/artifact-annotations.d.ts +85 -607
- package/dist/_vendor/shared/artifact-comments.d.ts +53 -489
- package/dist/_vendor/shared/channel-descriptors.d.ts +20 -1
- package/dist/_vendor/shared/channel-message.d.ts +1 -1
- package/dist/_vendor/shared/index.d.ts +0 -1
- package/dist/_vendor/shared/my-kortix-agent.d.ts +1 -1
- package/dist/_vendor/shared/peer-message-prompt.d.ts +7 -1
- package/dist/_vendor/shared/project-glyphs.d.ts +103 -20
- package/dist/_vendor/shared/space-slug.d.ts +3 -4
- package/dist/_vendor/shared/utils/ambiguous-write.d.ts +3 -3
- package/dist/_vendor/shared/webhook-signing.d.ts +3 -1
- package/dist/access/access/access-dialog-share.d.ts +3 -28
- package/dist/access/access/access-dialog-share.js +3 -75
- package/dist/artifacts/artifact-frame.js +26 -2
- package/dist/artifacts/artifact-session.js +6 -2
- package/dist/artifacts/frame-policy.d.ts +2 -9
- package/dist/artifacts/frame-policy.js +2 -25
- package/dist/customize/agents/agent-instructions.d.ts +8 -0
- package/dist/customize/agents/agent-instructions.js +38 -12
- package/dist/customize/agents/agent-overview.d.ts +6 -3
- package/dist/customize/agents/agent-overview.js +8 -2
- package/dist/customize/agents/agent-page-chrome.d.ts +45 -27
- package/dist/customize/agents/agent-page-chrome.js +60 -37
- package/dist/customize/agents/agent-page.js +88 -99
- package/dist/customize/agents/agent-tabs.d.ts +15 -14
- package/dist/customize/agents/agent-tabs.js +19 -16
- package/dist/customize/agents/agents-page.js +9 -7
- package/dist/customize/agents/create-agent-modal.js +1 -1
- package/dist/customize/connectors/connector-filter.d.ts +2 -1
- package/dist/customize/connectors/connector-filter.js +2 -3
- package/dist/customize/connectors/connectors-page.js +15 -24
- package/dist/customize/connectors/detail/account-info.js +1 -1
- package/dist/customize/connectors/detail/connector-status.d.ts +3 -24
- package/dist/customize/connectors/detail/connector-status.js +2 -42
- package/dist/customize/connectors/detail/use-connector-detail.d.ts +2 -6
- package/dist/customize/connectors/detail/use-connector-detail.js +3 -13
- package/dist/customize/connectors/install/install.d.ts +2 -6
- package/dist/customize/connectors/install/install.js +2 -16
- package/dist/customize/connectors/provider-label.d.ts +4 -17
- package/dist/customize/connectors/provider-label.js +4 -37
- package/dist/customize/project-settings/project-admin-sections.d.ts +6 -2
- package/dist/customize/project-settings/project-admin-sections.js +5 -3
- package/dist/customize/project-settings/project-settings-sections.js +1 -1
- package/dist/customize/providers/provider-connect.d.ts +6 -15
- package/dist/customize/providers/provider-connect.js +5 -36
- package/dist/customize/sections/component/channel-access-panel.js +16 -0
- package/dist/customize/sections/component/channel-mocks.d.ts +5 -0
- package/dist/customize/sections/component/channel-mocks.js +14 -2
- package/dist/customize/sections/component/discord-channel-row.d.ts +6 -0
- package/dist/customize/sections/component/discord-channel-row.js +48 -0
- package/dist/customize/sections/connector-connection-form.d.ts +3 -7
- package/dist/customize/sections/connector-connection-form.js +2 -33
- package/dist/customize/sections/connector-oauth2-auto.d.ts +3 -33
- package/dist/customize/sections/connector-oauth2-auto.js +2 -64
- package/dist/customize/sections/gateway-access-tab.js +1 -1
- package/dist/customize/sections/gateway-view.d.ts +6 -5
- package/dist/customize/sections/gateway-view.js +31 -13
- package/dist/customize/sections/llm-provider/constants.d.ts +1 -2
- package/dist/customize/sections/llm-provider/constants.js +1 -2
- package/dist/customize/sections/llm-provider/utils.d.ts +1 -41
- package/dist/customize/sections/llm-provider/utils.js +1 -52
- package/dist/customize/sections/view/account-secret-resources-panel.js +4 -1
- package/dist/customize/sections/view/agent-editor-catalog.js +0 -5
- package/dist/customize/sections/view/channel-settings-patch.js +1 -1
- package/dist/customize/sections/view/channels-view.js +26 -9
- package/dist/customize/sections/view/connector-connections.d.ts +5 -85
- package/dist/customize/sections/view/connector-connections.js +5 -99
- package/dist/customize/sections/view/gateway/gateway-logs.d.ts +42 -3
- package/dist/customize/sections/view/gateway/gateway-logs.js +212 -15
- package/dist/customize/sections/view/gateway/gateway-overview.js +1 -1
- package/dist/customize/sections/view/gateway/gateway-routing.d.ts +3 -3
- package/dist/customize/sections/view/gateway/gateway-routing.js +81 -200
- package/dist/customize/sections/view/gateway/routing-parts.d.ts +101 -0
- package/dist/customize/sections/view/gateway/routing-parts.js +154 -0
- package/dist/customize/sections/view/gateway/routing-sentence-layout.d.ts +2 -0
- package/dist/customize/sections/view/gateway/routing-sentence-layout.js +82 -0
- package/dist/customize/sections/view/git-view.js +2 -2
- package/dist/customize/sections/view/review-center-connected.js +17 -15
- package/dist/customize/sections/view/review-view.d.ts +7 -0
- package/dist/customize/sections/view/review-view.js +11 -0
- package/dist/customize/sections/view/secret-delivery.js +2 -2
- package/dist/customize/sections/view/secrets-view.js +1 -1
- package/dist/customize/sections/view/subscription-usage-tab.d.ts +14 -0
- package/dist/customize/sections/view/subscription-usage-tab.js +122 -0
- package/dist/customize/sections/view/subscription-usage.d.ts +34 -0
- package/dist/customize/sections/view/subscription-usage.js +98 -0
- package/dist/customize/settings/rail.js +2 -2
- package/dist/customize/settings/tabs/experimental-tab.d.ts +2 -2
- package/dist/customize/settings/tabs/experimental-tab.js +5 -5
- package/dist/customize/settings/tabs/general-tab.js +70 -14
- package/dist/customize/shared/capability-library.js +19 -22
- package/dist/customize/shared/catalog/catalog-card.d.ts +9 -4
- package/dist/customize/shared/catalog/catalog-card.js +3 -3
- package/dist/customize/shared/channels-switch-dialog.d.ts +1 -1
- package/dist/customize/shared/channels-switch-dialog.js +1 -1
- package/dist/customize/shared/customize-tab-bar.d.ts +1 -2
- package/dist/customize/shared/customize-tab-bar.js +10 -11
- package/dist/customize/shared/feature-gate-screen.js +1 -1
- package/dist/customize/triggers/schedule/post-to-field.d.ts +1 -1
- package/dist/customize/triggers/schedule/post-to-field.js +2 -2
- package/dist/customize/triggers/schedule/trigger-composer-logic.d.ts +1 -1
- package/dist/files/drives/conflict-marks.d.ts +28 -0
- package/dist/files/drives/conflict-marks.js +39 -0
- package/dist/files/drives/session-drives-chip.js +15 -10
- package/dist/files/project/components/drive-create-dialog.js +3 -3
- package/dist/files/viewer/index.d.ts +1 -1
- package/dist/files/viewer/index.js +1 -1
- package/dist/i18n/en.d.ts +502 -207
- package/dist/i18n/en.js +608 -313
- package/dist/i18n/ui-catalog/remaining-ui-translation-keys.generated.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/account-hub/sections.d.ts +1 -1
- package/dist/internal/branding/branding-provider.d.ts +15 -4
- package/dist/internal/branding/branding-provider.js +12 -7
- package/dist/internal/capture/use-capture-area.d.ts +5 -1
- package/dist/internal/capture/use-capture-area.js +16 -9
- package/dist/internal/connector-logo/connector-logo.js +2 -0
- package/dist/internal/connector-logo/connector-mark-files.js +1 -0
- package/dist/internal/goals/goal-meta.d.ts +50 -3
- package/dist/internal/goals/goal-meta.js +144 -9
- package/dist/internal/hooks/channels/use-channels-installations.d.ts +7 -2
- package/dist/internal/hooks/channels/use-channels-installations.js +31 -1
- package/dist/internal/hooks/connectors/use-add-account.d.ts +3 -9
- package/dist/internal/hooks/connectors/use-add-account.js +3 -18
- package/dist/internal/hooks/connectors/use-connect-link.d.ts +3 -2
- package/dist/internal/hooks/connectors/use-connect-link.js +15 -24
- package/dist/internal/hooks/connectors/use-pipedream-connect-project.d.ts +3 -56
- package/dist/internal/hooks/connectors/use-pipedream-connect-project.js +3 -87
- package/dist/internal/hooks/projects/use-new-project-session.d.ts +9 -16
- package/dist/internal/hooks/projects/use-new-project-session.js +16 -100
- package/dist/internal/hooks/projects/use-project-can-run.d.ts +7 -0
- package/dist/internal/hooks/projects/use-project-can-run.js +12 -5
- package/dist/internal/hooks/projects/use-restart-project-session.d.ts +0 -1
- package/dist/internal/hooks/projects/use-restart-project-session.js +0 -1
- package/dist/internal/hooks/use-notification-center.d.ts +11 -8
- package/dist/internal/hooks/use-notification-center.js +22 -10
- package/dist/internal/icons/discord.d.ts +9 -0
- package/dist/internal/icons/discord.js +9 -0
- package/dist/internal/layout/connect-mcp-modal.js +1 -1
- package/dist/internal/layout/project-capability-nav.js +6 -2
- package/dist/internal/layout/project-page-header.d.ts +3 -1
- package/dist/internal/layout/project-page-header.js +2 -2
- package/dist/internal/lib/account-secret-access.d.ts +1 -41
- package/dist/internal/lib/account-secret-access.js +3 -46
- package/dist/internal/lib/browser-error-noise.d.ts +1 -1
- package/dist/internal/lib/browser-error-noise.js +1 -1
- package/dist/internal/lib/browser-noise/rules/expected-states.d.ts +2 -15
- package/dist/internal/lib/browser-noise/rules/expected-states.js +6 -56
- package/dist/internal/lib/capability-tab-routes.d.ts +3 -3
- package/dist/internal/lib/capability-tab-routes.js +11 -3
- package/dist/internal/lib/error-handler.js +1 -1
- package/dist/internal/lib/llm-providers.d.ts +4 -110
- package/dist/internal/lib/llm-providers.js +5 -102
- package/dist/internal/lib/navigation/message-link.d.ts +32 -0
- package/dist/internal/lib/navigation/message-link.js +51 -0
- package/dist/internal/lib/navigation/session-href.d.ts +11 -0
- package/dist/internal/lib/navigation/session-href.js +20 -0
- package/dist/internal/lib/navigation/session-spawn-urls.d.ts +17 -0
- package/dist/internal/lib/navigation/session-spawn-urls.js +26 -0
- package/dist/internal/lib/space-scope.d.ts +3 -3
- package/dist/internal/lib/space-scope.js +3 -3
- package/dist/internal/lib/use-project-feature-flags.js +11 -9
- package/dist/internal/lib/web-notifications.d.ts +1 -1
- package/dist/internal/lib/web-notifications.js +0 -3
- package/dist/internal/notifications/notification-bell.js +1 -3
- package/dist/internal/notifications/notification-rows.d.ts +2 -2
- package/dist/internal/notifications/notification-rows.js +2 -3
- package/dist/internal/session-types/index.d.ts +5 -7
- package/dist/internal/session-types/index.js +5 -7
- package/dist/internal/stores/active-space-store.d.ts +1 -1
- package/dist/internal/stores/active-space-store.js +1 -1
- package/dist/internal/stores/kortix-computer-store.d.ts +15 -0
- package/dist/internal/stores/kortix-computer-store.js +12 -0
- package/dist/lib/routes.d.ts +17 -7
- package/dist/lib/routes.js +18 -2
- package/dist/markdown/app-link-icons.d.ts +7 -0
- package/dist/markdown/app-link-icons.js +20 -0
- package/dist/markdown/app-links.d.ts +9 -0
- package/dist/markdown/app-links.js +112 -0
- package/dist/markdown/doc-editor/doc-attrs.d.ts +28 -0
- package/dist/markdown/doc-editor/doc-attrs.js +156 -0
- package/dist/markdown/doc-editor/doc-embed.d.ts +6 -0
- package/dist/markdown/doc-editor/doc-embed.js +26 -8
- package/dist/markdown/doc-editor/doc-extensions.d.ts +10 -0
- package/dist/markdown/doc-editor/doc-extensions.js +55 -8
- package/dist/markdown/doc-editor/doc-fidelity.d.ts +72 -0
- package/dist/markdown/doc-editor/doc-fidelity.js +135 -0
- package/dist/markdown/doc-editor/doc-node-view.d.ts +9 -0
- package/dist/markdown/doc-editor/doc-node-view.js +29 -0
- package/dist/markdown/doc-editor/markdown.d.ts +20 -0
- package/dist/markdown/doc-editor/markdown.js +455 -18
- package/dist/markdown/markdown-frontmatter.d.ts +0 -3
- package/dist/markdown/markdown-frontmatter.js +45 -5
- package/dist/markdown/unified-markdown.d.ts +1 -1
- package/dist/markdown/unified-markdown.js +129 -10
- package/dist/primitives/emoji-picker.js +16 -100
- package/dist/primitives/emoji-tint.js +12 -12
- package/dist/primitives/entity-avatar.js +14 -9
- package/dist/primitives/glyph-face.d.ts +19 -12
- package/dist/primitives/glyph-face.js +59 -20
- package/dist/primitives/glyph-paths-source.d.ts +7 -0
- package/dist/primitives/glyph-paths-source.js +14 -6
- package/dist/primitives/glyph-paths.generated.d.ts +1 -1
- package/dist/primitives/glyph-paths.generated.js +947 -204
- package/dist/primitives/glyph-picker.d.ts +6 -10
- package/dist/primitives/glyph-picker.js +147 -98
- package/dist/primitives/glyph-registry.js +1604 -1
- package/dist/primitives/glyph-tint.d.ts +28 -3
- package/dist/primitives/glyph-tint.js +41 -83
- package/dist/primitives/kortix-glyphs.d.ts +32 -0
- package/dist/primitives/kortix-glyphs.js +157 -0
- package/dist/primitives/project-icon-picker.d.ts +8 -1
- package/dist/primitives/project-icon-picker.js +13 -5
- package/dist/primitives/user-avatar.d.ts +8 -1
- package/dist/primitives/user-avatar.js +2 -2
- package/dist/providers/ui-provider.d.ts +1 -8
- package/dist/session/actions/project-session-list-helpers.d.ts +4 -14
- package/dist/session/actions/project-session-list-helpers.js +6 -17
- package/dist/session/actions/session-label.d.ts +5 -9
- package/dist/session/actions/session-label.js +6 -10
- package/dist/session/agents/agent-model.js +4 -0
- package/dist/session/agents/agent-state-mark.d.ts +12 -7
- package/dist/session/agents/agent-state-mark.js +37 -15
- package/dist/session/agents/agent-strip.js +8 -2
- package/dist/session/agents/agent-surface.d.ts +81 -0
- package/dist/session/agents/agent-surface.js +97 -0
- package/dist/session/agents/held-messages.js +7 -4
- package/dist/session/agents/legacy-subagent-chat.js +1 -1
- package/dist/session/agents/session-peek.js +24 -12
- package/dist/session/agents/steer-session.d.ts +2 -0
- package/dist/session/agents/steer-session.js +3 -2
- package/dist/session/agents/subagent-dialog-content.d.ts +30 -1
- package/dist/session/agents/subagent-dialog-content.js +147 -33
- package/dist/session/agents/subagent-view.d.ts +15 -5
- package/dist/session/agents/subagent-view.js +28 -6
- package/dist/session/agents/tasks-panel.js +2 -12
- package/dist/session/agents/workflow-run-controls.d.ts +3 -1
- package/dist/session/agents/workflow-run-controls.js +12 -7
- package/dist/session/composer/ComposerCard.d.ts +7 -1
- package/dist/session/composer/ComposerCard.js +74 -9
- package/dist/session/composer/agent-selector.d.ts +16 -0
- package/dist/session/composer/agent-selector.js +19 -11
- package/dist/session/composer/chat-input/chat-input-control.d.ts +64 -0
- package/dist/session/composer/chat-input/chat-input-control.js +578 -0
- package/dist/session/composer/chat-input/chat-input-overrides.d.ts +76 -0
- package/dist/session/composer/chat-input/chat-input-overrides.js +40 -0
- package/dist/session/composer/chat-input/chat-input-panes.d.ts +56 -0
- package/dist/session/composer/chat-input/chat-input-panes.js +148 -0
- package/dist/session/composer/chat-input/chat-input-summary.d.ts +67 -0
- package/dist/session/composer/chat-input/chat-input-summary.js +67 -0
- package/dist/session/composer/chat-queue-lines.d.ts +20 -0
- package/dist/session/composer/chat-queue-lines.js +20 -0
- package/dist/session/composer/composer-chat-input.d.ts +8 -1
- package/dist/session/composer/composer-chat-input.js +12 -4
- package/dist/session/composer/composer-focus-context.d.ts +7 -0
- package/dist/session/composer/composer-focus-context.js +9 -0
- package/dist/session/composer/composer-toolbar.d.ts +3 -1
- package/dist/session/composer/composer-toolbar.js +3 -3
- package/dist/session/composer/composer-underbar.d.ts +10 -1
- package/dist/session/composer/composer-underbar.js +10 -2
- package/dist/session/composer/composer.d.ts +12 -0
- package/dist/session/composer/composer.js +55 -1
- package/dist/session/composer/editor/composer-editor.d.ts +10 -2
- package/dist/session/composer/editor/composer-editor.js +22 -6
- package/dist/session/composer/editor/first-visual-line.d.ts +2 -0
- package/dist/session/composer/editor/first-visual-line.js +9 -0
- package/dist/session/composer/editor/mention-node.js +2 -0
- package/dist/session/composer/editor/serialize.js +9 -1
- package/dist/session/composer/hooks/use-file-search.d.ts +1 -1
- package/dist/session/composer/hooks/use-file-search.js +1 -1
- package/dist/session/composer/menus/mention-controller.d.ts +3 -11
- package/dist/session/composer/menus/mention-controller.js +56 -16
- package/dist/session/composer/menus/mention-menu.d.ts +7 -2
- package/dist/session/composer/menus/mention-menu.js +17 -9
- package/dist/session/composer/menus/menu-items.d.ts +9 -0
- package/dist/session/composer/menus/space-mentions.d.ts +48 -0
- package/dist/session/composer/menus/space-mentions.js +83 -0
- package/dist/session/composer/prompt-history.d.ts +9 -0
- package/dist/session/composer/prompt-history.js +45 -0
- package/dist/session/composer/queue-projection.d.ts +2 -0
- package/dist/session/composer/queue-projection.js +1 -0
- package/dist/session/composer/queued-prompt-list.js +53 -4
- package/dist/session/composer/reasoning-effort-selector.d.ts +20 -0
- package/dist/session/composer/reasoning-effort-selector.js +3 -3
- package/dist/session/composer/types.d.ts +2 -1
- package/dist/session/header/session-site-header.js +7 -3
- package/dist/session/header/subagent-hover-card.d.ts +7 -4
- package/dist/session/header/subagent-hover-card.js +62 -11
- package/dist/session/list/session-status-mark.d.ts +42 -0
- package/dist/{workspace/sidebar → session/list}/session-status-mark.js +37 -2
- package/dist/session/models/model-selector.d.ts +7 -2
- package/dist/session/models/model-selector.js +39 -31
- package/dist/session/overrides/provider-secret-pool-editor.d.ts +11 -0
- package/dist/session/overrides/provider-secret-pool-editor.js +17 -0
- package/dist/session/overrides/session-overrides-control.d.ts +5 -0
- package/dist/session/overrides/session-overrides-toolbar.js +147 -7
- package/dist/session/panel/model-switch-event.d.ts +8 -0
- package/dist/session/panel/model-switch-event.js +19 -0
- package/dist/session/panel/session-audit-panel.js +3 -2
- package/dist/session/panel/session-desktop.js +5 -1
- package/dist/session/panel/session-panel-provider.js +1 -1
- package/dist/session/panel/shared/use-panel-handoffs.d.ts +2 -2
- package/dist/session/panel/shared/use-panel-handoffs.js +21 -2
- package/dist/session/participants/session-participants.d.ts +7 -5
- package/dist/session/participants/session-participants.js +11 -7
- package/dist/session/prompts/ask-deck.d.ts +21 -0
- package/dist/session/prompts/ask-deck.js +253 -0
- package/dist/session/prompts/session-permission-prompt.d.ts +7 -1
- package/dist/session/prompts/session-permission-prompt.js +3 -3
- package/dist/session/status/provisioning-failure.d.ts +4 -5
- package/dist/session/status/provisioning-failure.js +4 -5
- package/dist/session/status/session-load-state.d.ts +0 -1
- package/dist/session/status/session-load-state.js +2 -4
- package/dist/session/thread/message-parsing.d.ts +0 -1
- package/dist/session/thread/message-parsing.js +0 -1
- package/dist/session/thread/optimistic-turn.js +11 -2
- package/dist/session/thread/session-chat.d.ts +3 -1
- package/dist/session/thread/session-chat.js +498 -301
- package/dist/session/thread/session-context-metrics.d.ts +0 -1
- package/dist/session/thread/session-context-metrics.js +1 -1
- package/dist/session/thread/session-context-sub-sessions.js +3 -1
- package/dist/session/thread/show-work.d.ts +38 -0
- package/dist/session/thread/show-work.js +115 -0
- package/dist/session/thread/thread-boot-rows.d.ts +2 -1
- package/dist/session/thread/thread-boot-rows.js +7 -3
- package/dist/session/thread/transcript-rows.d.ts +36 -0
- package/dist/session/thread/transcript.d.ts +55 -2
- package/dist/session/thread/transcript.js +264 -33
- package/dist/session/thread/typing-indicator.d.ts +21 -0
- package/dist/session/thread/typing-indicator.js +46 -0
- package/dist/session/tool/shared/infrastructure-contexts.d.ts +12 -0
- package/dist/session/tool/shared/infrastructure-contexts.js +6 -0
- package/dist/session/tool/tool-part-renderer.d.ts +2 -0
- package/dist/session/tool/tool-part-renderer.js +16 -2
- package/dist/session/tool/tools/channel-send-card.js +1 -0
- package/dist/session/tool/tools/kortix-action-tool.js +8 -1
- package/dist/session/tool/tools/multi-agent-tool-bodies.d.ts +19 -0
- package/dist/session/tool/tools/multi-agent-tool-bodies.js +34 -13
- package/dist/session/tool/tools/session-spawn-urls.d.ts +1 -16
- package/dist/session/tool/tools/session-spawn-urls.js +4 -26
- package/dist/session/tool/tools/task-tool.d.ts +5 -18
- package/dist/session/tool/tools/task-tool.js +47 -86
- package/dist/session/tool/tools/workflow-progress.d.ts +14 -18
- package/dist/session/tool/tools/workflow-progress.js +24 -179
- package/dist/session/tool/tools/workflow-result-text.d.ts +15 -0
- package/dist/session/tool/tools/workflow-result-text.js +34 -0
- package/dist/session/tool/tools/workflow-run-card.d.ts +35 -0
- package/dist/session/tool/tools/workflow-run-card.js +157 -0
- package/dist/session/tool/tools/workflow-tool.js +45 -58
- package/dist/session/turn/activity-burst.d.ts +2 -2
- package/dist/session/turn/activity-burst.js +11 -5
- package/dist/session/turn/answered-question-step.d.ts +29 -0
- package/dist/session/turn/answered-question-step.js +48 -3
- package/dist/session/turn/channel-brand.js +4 -0
- package/dist/session/turn/message-author.d.ts +13 -8
- package/dist/session/turn/message-author.js +34 -16
- package/dist/session/turn/notice-batch-group.d.ts +4 -4
- package/dist/session/turn/notice-batch-group.js +5 -8
- package/dist/session/turn/peer-message-row.d.ts +15 -0
- package/dist/session/turn/peer-message-row.js +39 -30
- package/dist/session/turn/subagent-notice-row.d.ts +16 -1
- package/dist/session/turn/subagent-notice-row.js +47 -35
- package/dist/session/turn/throttled-markdown.js +4 -1
- package/dist/session/turn/turn-work-accordion.d.ts +10 -3
- package/dist/session/turn/turn-work-accordion.js +18 -11
- package/dist/session/turn/user-message.js +17 -43
- package/dist/session/turn/voice-turn.d.ts +22 -0
- package/dist/session/turn/voice-turn.js +32 -0
- package/dist/session/voice/call-audio.d.ts +32 -0
- package/dist/session/voice/call-audio.js +146 -0
- package/dist/session/voice/call-ring.d.ts +10 -0
- package/dist/session/voice/call-ring.js +52 -0
- package/dist/session/voice/screen-share.d.ts +24 -0
- package/dist/session/voice/screen-share.js +75 -0
- package/dist/session/voice/use-voice-call.d.ts +15 -0
- package/dist/session/voice/use-voice-call.js +217 -0
- package/dist/session/voice/voice-call-card.d.ts +6 -0
- package/dist/session/voice/voice-call-card.js +113 -0
- package/dist/session/voice/voice-call-state.d.ts +99 -0
- package/dist/session/voice/voice-call-state.js +104 -0
- package/dist/session/voice/voice-call-store.d.ts +22 -0
- package/dist/session/voice/voice-call-store.js +10 -0
- package/dist/session/voice/voice-call-url.d.ts +24 -0
- package/dist/session/voice/voice-call-url.js +33 -0
- package/dist/session/voice/voice-call.d.ts +11 -0
- package/dist/session/voice/voice-call.js +51 -0
- package/dist/styles/components.css +33 -0
- package/dist/styles/theme.css +26 -0
- package/dist/styles.css +1 -1
- package/dist/workspace/admin/project-admin-dashboard.d.ts +1 -1
- package/dist/workspace/admin/project-admin-dashboard.js +21 -13
- package/dist/workspace/index.d.ts +3 -2
- package/dist/workspace/index.js +2 -1
- package/dist/workspace/layout/project-home.js +13 -14
- package/dist/workspace/layout/use-project-home-send.d.ts +2 -0
- package/dist/workspace/layout/use-project-home-send.js +5 -3
- package/dist/workspace/memory/company-memory-page.d.ts +1 -1
- package/dist/workspace/memory/company-memory-page.js +1 -1
- package/dist/workspace/new/use-creatable-accounts.js +13 -4
- package/dist/workspace/projects/modal/project-icon-field.js +49 -34
- package/dist/workspace/review/review-center.d.ts +4 -1
- package/dist/workspace/review/review-center.js +6 -3
- package/dist/workspace/sessions/project-sessions-helpers.js +1 -1
- package/dist/workspace/sessions/project-sessions-view.js +1 -1
- package/dist/workspace/sessions/session-row.js +6 -4
- package/dist/workspace/sessions/sessions-toolbar.d.ts +1 -1
- package/dist/workspace/sessions/sessions-toolbar.js +4 -4
- package/dist/workspace/sidebar/footer/project-manifest-issues-alert.d.ts +1 -1
- package/dist/workspace/sidebar/footer/project-manifest-issues-alert.js +4 -3
- package/dist/workspace/sidebar/footer/project-memory-nav.d.ts +1 -1
- package/dist/workspace/sidebar/footer/project-memory-nav.js +1 -1
- package/dist/workspace/sidebar/project-nav-items.js +2 -5
- package/dist/workspace/sidebar/project-session-list.d.ts +7 -1
- package/dist/workspace/sidebar/project-session-list.js +64 -24
- package/dist/workspace/sidebar/project-sidebar.js +10 -7
- package/dist/workspace/sidebar/project-spaces-nav.d.ts +7 -3
- package/dist/workspace/sidebar/project-spaces-nav.js +77 -46
- package/dist/workspace/sidebar/session-brief-hover-card.d.ts +4 -2
- package/dist/workspace/sidebar/session-brief-hover-card.js +47 -28
- package/dist/workspace/sidebar/session-filter-menu.js +1 -0
- package/dist/workspace/sidebar/session-group-sections.js +12 -4
- package/dist/workspace/sidebar/session-grouping.d.ts +4 -0
- package/dist/workspace/sidebar/session-grouping.js +2 -0
- package/dist/workspace/sidebar/session-source-icons.js +2 -0
- package/dist/workspace/sidebar/sidebar-more-group.d.ts +13 -0
- package/dist/workspace/sidebar/sidebar-more-group.js +27 -0
- package/dist/workspace/space/space-blocks.d.ts +3 -1
- package/dist/workspace/space/space-blocks.js +4 -7
- package/dist/workspace/space/space-page.d.ts +4 -6
- package/dist/workspace/space/space-page.js +12 -26
- package/dist/workspace/space/space-tab-panels.d.ts +14 -1
- package/dist/workspace/space/space-tab-panels.js +12 -21
- package/dist/workspace/space/space-templates.d.ts +4 -5
- package/dist/workspace/space/space-templates.js +2 -7
- package/dist/workspace/space/use-space-filter.d.ts +1 -1
- package/dist/workspace/space/use-space-filter.js +1 -1
- package/dist/workspace/spaces/channels-onboarding.d.ts +2 -2
- package/dist/workspace/spaces/channels-onboarding.js +4 -3
- package/dist/workspace/spaces/create-channel-dialog.js +4 -2
- package/dist/workspace/spaces/principal-card.d.ts +71 -0
- package/dist/workspace/spaces/principal-card.js +246 -0
- package/dist/workspace/spaces/space-auto-open.d.ts +8 -0
- package/dist/workspace/spaces/space-auto-open.js +18 -0
- package/dist/workspace/spaces/space-avatar.d.ts +44 -0
- package/dist/workspace/spaces/space-avatar.js +41 -0
- package/dist/workspace/spaces/space-details-panel.d.ts +26 -0
- package/dist/workspace/spaces/space-details-panel.js +119 -0
- package/dist/workspace/spaces/space-identity.d.ts +49 -0
- package/dist/workspace/spaces/space-identity.js +104 -0
- package/dist/workspace/spaces/space-members.js +1 -1
- package/dist/workspace/spaces/space-mention-source.d.ts +12 -0
- package/dist/workspace/spaces/space-mention-source.js +78 -0
- package/dist/workspace/spaces/space-people.d.ts +29 -0
- package/dist/workspace/spaces/space-people.js +87 -0
- package/dist/workspace/spaces/space-roster.d.ts +3 -2
- package/dist/workspace/spaces/space-roster.js +7 -4
- package/dist/workspace/spaces/space-tab-list.d.ts +37 -0
- package/dist/workspace/spaces/space-tab-list.js +82 -0
- package/dist/workspace/spaces/space-tabs.d.ts +74 -0
- package/dist/workspace/spaces/space-tabs.js +199 -0
- package/dist/workspace/spaces/space-threads-tab.js +1 -1
- package/dist/workspace/spaces/space-timeline-view.js +126 -17
- package/dist/workspace/spaces/space-timeline.d.ts +44 -9
- package/dist/workspace/spaces/space-timeline.js +120 -12
- package/dist/workspace/spaces/space-view.d.ts +19 -12
- package/dist/workspace/spaces/space-view.js +201 -67
- package/dist/workspace/spaces/use-personal-space-name.d.ts +2 -0
- package/dist/workspace/spaces/use-personal-space-name.js +10 -0
- package/package.json +17 -13
- package/skills/kortix-ui/SKILL.md +3 -3
- package/skills/kortix-ui/references/custom-dashboard.md +3 -4
- package/skills/kortix-ui/references/modules.md +4 -4
- package/dist/_vendor/shared/room-prompt.d.ts +0 -66
- package/dist/customize/agents/agent-section-rail.d.ts +0 -21
- package/dist/customize/agents/agent-section-rail.js +0 -23
- package/dist/internal/hooks/projects/use-warm-project-session.d.ts +0 -270
- package/dist/internal/hooks/projects/use-warm-project-session.js +0 -362
- package/dist/internal/hooks/projects/warm-session-seed.d.ts +0 -66
- package/dist/internal/hooks/projects/warm-session-seed.js +0 -80
- package/dist/internal/hooks/projects/warm-session-taken-registry.d.ts +0 -61
- package/dist/internal/hooks/projects/warm-session-taken-registry.js +0 -141
- package/dist/workspace/sidebar/footer/project-rooms-nav.d.ts +0 -9
- package/dist/workspace/sidebar/footer/project-rooms-nav.js +0 -32
- package/dist/workspace/sidebar/session-status-mark.d.ts +0 -19
- package/dist/workspace/space/space-room.d.ts +0 -20
- package/dist/workspace/space/space-room.js +0 -27
- /package/dist/{workspace/sidebar → session/list}/session-list-chrome.d.ts +0 -0
- /package/dist/{workspace/sidebar → session/list}/session-list-chrome.js +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ModelSwitchHistory } from '../panel/model-switch-event.js';
|
|
3
4
|
import { uiRoutes } from '../../lib/routes.js';
|
|
4
5
|
import { isQuestionTool } from '@kortix/sdk';
|
|
5
6
|
import { SessionApprovalPrompt } from '../prompts/session-approval-prompt.js';
|
|
@@ -10,18 +11,20 @@ import { useTranslations } from '../../i18n/index.js';
|
|
|
10
11
|
import { errorMessageOf, isDeliveredButDisconnected } from '../../internal/lib/delivered-but-disconnected.js';
|
|
11
12
|
import { useQueuedDraftStore, useQueuedDrafts } from '../composer/stores/queued-draft-store.js';
|
|
12
13
|
import { SESSION_LOG_MINOR, SESSION_LOG_SCHEMA, listSessionPrompts, sessionLogOfV1Rows, sessionLogPromptMessage, sessionLogRetrying, sessionLogTurns, fetchSessionAttachment, sessionLogFullTextPlan, sessionLogHarnessSwitches, sessionLogRestoreNotice, sessionLogWithFullTexts, } from '@kortix/sdk';
|
|
13
|
-
import { useProjectSession, useSessionLogOlder, useSessionLogRecord, useSessionLogThread, useSessionMessageAuthors,
|
|
14
|
+
import { useProjectSession, useSessionLogOlder, useSessionLogRecord, useSessionLogThread, useSessionMessageAuthors, useSessionParticipants, useSessionModelUsage, } from '@kortix/sdk/react';
|
|
14
15
|
import { ArrowBendUpLeftIcon, CaretDownIcon, StackIcon as Layers, } from '@phosphor-icons/react';
|
|
15
16
|
import { jumpToOutcome } from '../outcomes/jump-to-outcome.js';
|
|
16
17
|
import { useIsMobile, useIsPhone } from '../../hooks/use-mobile.js';
|
|
17
|
-
import { useUiLink, useUiPathname, useUiRouter, useUiShallowNavigate, useUiSearchParams, useUiViewerId, } from '../../providers/ui-provider.js';
|
|
18
|
+
import { useUiLink, useUiPathname, useUiRouter, useUiShallowNavigate, useUiSearchParams, useUiViewer, useUiViewerId, } from '../../providers/ui-provider.js';
|
|
18
19
|
import { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
19
20
|
import { TranscriptRowsContext } from './transcript-rows.js';
|
|
20
21
|
import { AgentBusyRow, PendingPromptRows } from './thread-boot-rows.js';
|
|
21
22
|
import { createPortal } from 'react-dom';
|
|
22
|
-
import { AUTHOR_RETRY_DELAYS_MS, authorForTurn, awaitsAgent, missingAuthorKey, resolveTranscriptAuthors, rewindableMessageIds,
|
|
23
|
+
import { AUTHOR_RETRY_DELAYS_MS, authorForTurn, awaitsAgent, missingAuthorKey, participantAuthor, resolveTranscriptAuthors, rewindableMessageIds, stoppedByName, viewerAuthor, } from '../turn/message-author.js';
|
|
23
24
|
import { stopRefusalMessage } from '../status/stop-refusal.js';
|
|
24
25
|
import { QueuedPromptList } from '../composer/queued-prompt-list.js';
|
|
26
|
+
import { ComposerAutoFocusContext } from '../composer/composer-focus-context.js';
|
|
27
|
+
import { ChatQueueLines } from '../composer/chat-queue-lines.js';
|
|
25
28
|
import { runtimePermissionLocksComposer } from '../composer/send-blockers.js';
|
|
26
29
|
import { SessionPrintHeader } from '../print/session-print-header.js';
|
|
27
30
|
import { useSessionPrint } from '../print/use-session-print.js';
|
|
@@ -52,7 +55,11 @@ import { claimFirstTurnRow } from '../composer/inbox-row-claims.js';
|
|
|
52
55
|
import { OptimisticTurn } from './optimistic-turn.js';
|
|
53
56
|
import { inboxHoldsLivePrompt } from '../composer/inbox-live-prompt.js';
|
|
54
57
|
import { SessionOutcomesProvider } from '../outcomes/session-outcomes-provider.js';
|
|
58
|
+
import { deleteMessageLinkParams, readMessageLinkParams, resolveMessageLinkTurn } from '../../internal/lib/navigation/message-link.js';
|
|
59
|
+
/** How long a message link waits for the transcript's turns to mount before it jumps anyway. */
|
|
60
|
+
const MESSAGE_LINK_MOUNT_WAIT_MS = 8_000;
|
|
55
61
|
import { SessionOverridesComposer } from '../overrides/session-overrides-composer.js';
|
|
62
|
+
import { inheritedModelFor } from '../composer/chat-input/chat-input-summary.js';
|
|
56
63
|
import { QuestionPrompt, } from '../prompts/question-prompt.js';
|
|
57
64
|
import { SESSION_TRANSCRIPT_CLASS, SessionBodyRow } from './session-body.js';
|
|
58
65
|
import { SessionContextModal } from './session-context-modal.js';
|
|
@@ -73,6 +80,7 @@ import { ChatMinimap } from './chat-minimap.js';
|
|
|
73
80
|
import { usePlanInChat } from './plan-surface.js';
|
|
74
81
|
import { SessionStartingLoader } from '../status/session-starting-loader.js';
|
|
75
82
|
import { ToolActivateContext } from '../tool/tool-renderers.js';
|
|
83
|
+
import { AgentActivateContext } from '../tool/shared/infrastructure-contexts.js';
|
|
76
84
|
import { ReadOnlySessionContext } from '../tool/shared/infrastructure-contexts.js';
|
|
77
85
|
import { firstPromptAttachments, retainSentAttachmentPreviews, sentAttachmentsForTurn, } from '../composer/sent-attachment-previews.js';
|
|
78
86
|
import { buildOptimisticPromptTextWithUploads, promptFileParts, sentAttachmentsOf, } from '../composer/uploaded-file-refs.js';
|
|
@@ -94,7 +102,7 @@ import { getRetryInfo } from '../../internal/session-types/index.js';
|
|
|
94
102
|
import { useModelPricingLookup } from '../../internal/lib/model-pricing.js';
|
|
95
103
|
import { isAbortError, latestPromptModel, SESSION_NOTICE, turnEndNotice } from '@kortix/sdk';
|
|
96
104
|
import { failureShownByTurn, failureSupersededByTurn, persistedFailureText, } from './persisted-turn-failure.js';
|
|
97
|
-
import { abandonOptimisticSend, applyOptimisticAbort, ascendingId, awaitAbortSettlement, beginOptimisticSend, classifySendError, clearStartStash, formatModelString, formatPromptModel, markOptimisticSendDispatched, markOptimisticSendInboxBacked, mintSessionWireMessageId, readStartStash, recoverFromSendFailure, rejectQuestion, replyToPermission, replyToQuestion, requestRuntimeReconnect, startSessionWithPrompt, useAbortRuntimeSession, useExecuteRuntimeCommand, useProjectConfig, useRuntimeAgents, useProjectSpaces, useRuntimeBootStalled, useRuntimeCommands, useRuntimeConfig, useRuntimeConnectionStore, useRuntimePendingStore, useRuntimePhase, useRuntimeProviders, useRuntimeReady, useRuntimeSession, useRuntimeSessions, useRuntimeSupports, useSessionModelSelection, useSessionPrompts, useSessionStateStore, useSessionSync, useSessionTurnOutcome, useSessionWorking, useSessionWorkingStore, } from '@kortix/sdk/react';
|
|
105
|
+
import { abandonOptimisticSend, applyOptimisticAbort, ascendingId, awaitAbortSettlement, beginOptimisticSend, classifySendError, clearStartStash, formatModelString, formatPromptModel, markOptimisticSendDispatched, markOptimisticSendInboxBacked, mintSessionWireMessageId, readStartStash, recoverFromSendFailure, rejectQuestion, replyToPermission, replyToQuestion, requestRuntimeReconnect, startSessionWithPrompt, useAbortRuntimeSession, useExecuteRuntimeCommand, useProjectConfig, useRuntimeAgents, useProjectSpaces, useRuntimeBootStalled, useRuntimeCommands, useRuntimeConfig, useRuntimeConnectionStore, useRuntimePendingStore, useRuntimePhase, useRuntimeProviders, useRuntimeReady, useRuntimeSession, useRuntimeSessions, useRuntimeSupports, useSessionModelSelection, useSessionPrompts, useSessionStateStore, useSessionSync, useSessionTurnOutcome, useSessionWorking, useSessionWorkingStore, useAnswerSessionAsk, useSessionNeedsYou, } from '@kortix/sdk/react';
|
|
98
106
|
import { useStableCallback } from '../../internal/hooks/use-stable-callback.js';
|
|
99
107
|
import { useReloadForensics } from '../status/reload-forensics.js';
|
|
100
108
|
import { resolveLastTurnWorking, serverHoldsOpenTurn, sessionComposerReadiness, } from '../composer/session-composer-readiness.js';
|
|
@@ -106,7 +114,7 @@ import { HELD_COMMAND_ROW_PREFIX, canReleaseHeldCommand, heldCommandRows, } from
|
|
|
106
114
|
import { useSessionHistoryViewStore } from '../../internal/stores/session-history-view-store.js';
|
|
107
115
|
import { downloadBlob } from '../../internal/lib/utils/download.js';
|
|
108
116
|
import { RestoreNotice, hasOutOfContext } from './session-history.js';
|
|
109
|
-
import { TranscriptTurnRow, strandedPromptIds, optimisticAnswersCache, promptTexts, resolveTurnError, } from './transcript.js';
|
|
117
|
+
import { TranscriptTurnRow, isAgentNoticeTurn, strandedPromptIds, optimisticAnswersCache, promptTexts, resolveTurnError, } from './transcript.js';
|
|
110
118
|
export { SessionReportCard, deriveTurnErrorAbortState, deriveTurnErrorPresentation } from './transcript.js';
|
|
111
119
|
// ============================================================================
|
|
112
120
|
// Sub-Session Breadcrumb
|
|
@@ -185,10 +193,11 @@ function hostNotice(notice, notices) {
|
|
|
185
193
|
const key = Object.keys(SESSION_NOTICE).find((candidate) => SESSION_NOTICE[candidate] === notice);
|
|
186
194
|
return (key && notices[key]) || notice;
|
|
187
195
|
}
|
|
188
|
-
export function SessionChat({ sessionId, projectSessionId, sessionState, projectId, boundAgentName, headerLeadingAction, hideHeader, readOnly, composerPlaceholder, inputReplacement, initialScrollTop, savedHistoryScope, onContentReady, deferComposerFocus, hostQuote, }) {
|
|
196
|
+
export function SessionChat({ sessionId, projectSessionId, sessionState, projectId, boundAgentName, headerLeadingAction, hideHeader, transparent = false, readOnly, composerPlaceholder, inputReplacement, initialScrollTop, savedHistoryScope, onContentReady, deferComposerFocus, hostQuote, }) {
|
|
189
197
|
const tHardcodedUi = useTranslations('hardcodedUi');
|
|
190
198
|
// A channel's thread panel: turns are message rows, full width, end-anchored.
|
|
191
199
|
const rowsContext = useContext(TranscriptRowsContext);
|
|
200
|
+
const composerAutoFocus = useContext(ComposerAutoFocusContext);
|
|
192
201
|
const transcriptRows = rowsContext !== null;
|
|
193
202
|
const isMobile = useIsMobile();
|
|
194
203
|
const isPhone = useIsPhone();
|
|
@@ -228,6 +237,17 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
228
237
|
track('panel_opened', { source: 'chat_tool' });
|
|
229
238
|
}, [sessionId, setSidePanelView, focusToolCall]);
|
|
230
239
|
const toolActivate = readOnly || disableToolNavigation ? null : handleToolActivate;
|
|
240
|
+
// Clicking an agent (a sub-agent row, its finish notice, a workflow agent, the
|
|
241
|
+
// agents line) opens that agent's session in the side panel, beside the chat.
|
|
242
|
+
const focusAgent = useKortixComputerStore((s) => s.focusAgent);
|
|
243
|
+
const handleAgentActivate = useCallback((agent) => {
|
|
244
|
+
const wasOpen = useKortixComputerStore.getState().isSidePanelOpen;
|
|
245
|
+
setSidePanelView(sessionId, 'actions');
|
|
246
|
+
focusAgent(agent);
|
|
247
|
+
if (!wasOpen)
|
|
248
|
+
track('panel_opened', { source: 'chat_agent' });
|
|
249
|
+
}, [sessionId, setSidePanelView, focusAgent]);
|
|
250
|
+
const agentActivate = readOnly || disableToolNavigation ? null : handleAgentActivate;
|
|
231
251
|
// ---- Context modal ----
|
|
232
252
|
const [contextModalOpen, setContextModalOpen] = useState(false);
|
|
233
253
|
// The composer's `/compact` row opens this instance; the header keeps its
|
|
@@ -412,8 +432,15 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
412
432
|
threadRef.current = thread;
|
|
413
433
|
}, [thread]);
|
|
414
434
|
const messagesLoading = syncMessagesLoading;
|
|
415
|
-
// Who wrote each user message
|
|
435
|
+
// Who wrote each user message: every member message shows its sender's
|
|
436
|
+
// avatar from the first frame, one-person session included, so nothing
|
|
437
|
+
// moves when a second person joins.
|
|
416
438
|
const viewerId = useUiViewerId();
|
|
439
|
+
const viewer = useUiViewer();
|
|
440
|
+
const viewerAsAuthor = useMemo(() => viewerAuthor(viewer), [viewer]);
|
|
441
|
+
// Wire ids this tab sent. Their recorded author arrives a moment after the
|
|
442
|
+
// bubble paints, so the viewer's avatar stands in until then.
|
|
443
|
+
const sentHereIds = useRef(new Set());
|
|
417
444
|
const Link = useUiLink();
|
|
418
445
|
// Only a user message adds an author, so only user messages key the refetch.
|
|
419
446
|
const userMessageIds = useMemo(() => (messages ?? []).filter((m) => m.role === 'user').map((m) => m.message_id), [messages]);
|
|
@@ -422,12 +449,18 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
422
449
|
const turnOutcome = useSessionTurnOutcome(projectId ?? '', projectSessionId ?? '');
|
|
423
450
|
// A stop adds no message but does add a name ("Stopped by"): the turn that
|
|
424
451
|
// ended keys the read too, so the stopper shows when that turn ends.
|
|
425
|
-
const { data: messageAuthors, refetch: refetchMessageAuthors } = useSessionMessageAuthors(projectId, projectSessionId, `${newestUserMessageId}|${turnOutcome.last_ended?.turn_token ?? ''}`);
|
|
452
|
+
const { data: messageAuthors, isLoading: messageAuthorsLoading, refetch: refetchMessageAuthors, } = useSessionMessageAuthors(projectId, projectSessionId, `${newestUserMessageId}|${turnOutcome.last_ended?.turn_token ?? ''}`);
|
|
426
453
|
const transcriptAuthors = useMemo(() => resolveTranscriptAuthors(userMessageIds, messageAuthors), [userMessageIds, messageAuthors]);
|
|
427
|
-
//
|
|
428
|
-
//
|
|
454
|
+
// The user messages on screen when this session's first authors read
|
|
455
|
+
// landed. A message after them arrived live: the drain may re-mint its id
|
|
456
|
+
// and the ledger records it a moment later, so its avatar slot is held.
|
|
457
|
+
const [loadedUserIds, setLoadedUserIds] = useState(null);
|
|
458
|
+
if (messageAuthors && loadedUserIds?.sessionId !== sessionId) {
|
|
459
|
+
setLoadedUserIds({ sessionId, ids: new Set(userMessageIds) });
|
|
460
|
+
}
|
|
461
|
+
// Names a queued prompt's sender before the authors read lists it. Same
|
|
462
|
+
// cache as the header.
|
|
429
463
|
const { data: sessionParticipants } = useSessionParticipants(projectId, projectSessionId);
|
|
430
|
-
const groupChat = transcriptAuthors.multiAuthor || !!sessionParticipants?.multi_user;
|
|
431
464
|
// Project sessions use the server-side project agent roster. A sub-agent's
|
|
432
465
|
// chat has no projectId, but runs inside the parent scope's project: its
|
|
433
466
|
// roster is that project's. Only a chat with neither falls back to the
|
|
@@ -460,14 +493,19 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
460
493
|
...promptInbox.prompts.flatMap((prompt) => [prompt.message_id, prompt.wire_message_id ?? '']),
|
|
461
494
|
]);
|
|
462
495
|
const authorRetry = useRef({ key: '', count: 0 });
|
|
496
|
+
// The missing set the retries gave up on: a live message still unattributed
|
|
497
|
+
// then stops holding its avatar slot.
|
|
498
|
+
const [authorsGaveUp, setAuthorsGaveUp] = useState('');
|
|
463
499
|
useEffect(() => {
|
|
464
500
|
if (!missingAuthors)
|
|
465
501
|
return;
|
|
466
502
|
if (authorRetry.current.key !== missingAuthors)
|
|
467
503
|
authorRetry.current = { key: missingAuthors, count: 0 };
|
|
468
504
|
const delay = AUTHOR_RETRY_DELAYS_MS[authorRetry.current.count];
|
|
469
|
-
if (delay === undefined)
|
|
505
|
+
if (delay === undefined) {
|
|
506
|
+
setAuthorsGaveUp(missingAuthors);
|
|
470
507
|
return;
|
|
508
|
+
}
|
|
471
509
|
const timer = setTimeout(() => {
|
|
472
510
|
authorRetry.current.count += 1;
|
|
473
511
|
void refetchMessageAuthors();
|
|
@@ -1344,8 +1382,30 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1344
1382
|
// ---- Pending permissions & questions ----
|
|
1345
1383
|
const allPermissions = useRuntimePendingStore((s) => s.permissions);
|
|
1346
1384
|
const allQuestions = useRuntimePendingStore((s) => s.questions);
|
|
1347
|
-
const
|
|
1385
|
+
const livePermissions = useMemo(() => sessionState?.permissions ??
|
|
1348
1386
|
Object.values(allPermissions).filter((p) => p.sessionID === sessionId), [sessionState?.permissions, allPermissions, sessionId]);
|
|
1387
|
+
// Asks that parked: nobody answered live, the agent went on, and the ask
|
|
1388
|
+
// waits server-side (Review, "Needs you"). They render with the same cards
|
|
1389
|
+
// and are decided through the asks API, which resumes the session that
|
|
1390
|
+
// asked (a hidden worker's asks show here too). Live asks keep their cards.
|
|
1391
|
+
const parkedAsks = useSessionNeedsYou(projectId ?? '', projectSessionId ?? '', {
|
|
1392
|
+
enabled: Boolean(projectId && projectSessionId),
|
|
1393
|
+
}).asks;
|
|
1394
|
+
const parkedAskIdByRequest = useMemo(() => new Map(parkedAsks.filter((ask) => ask.kind !== 'approval').map((ask) => [ask.request_id, ask.id])), [parkedAsks]);
|
|
1395
|
+
const pendingPermissions = useMemo(() => {
|
|
1396
|
+
const live = new Set(livePermissions.map((p) => p.id));
|
|
1397
|
+
const parked = parkedAsks
|
|
1398
|
+
.filter((ask) => ask.kind === 'permission' && ask.permission && !live.has(ask.request_id))
|
|
1399
|
+
.map((ask) => ({
|
|
1400
|
+
id: ask.request_id,
|
|
1401
|
+
sessionID: sessionId,
|
|
1402
|
+
permission: ask.permission.permission,
|
|
1403
|
+
patterns: ask.permission.patterns,
|
|
1404
|
+
metadata: ask.permission.args && typeof ask.permission.args === 'object' ? ask.permission.args : {},
|
|
1405
|
+
always: ['*'],
|
|
1406
|
+
}));
|
|
1407
|
+
return parked.length ? [...livePermissions, ...parked] : livePermissions;
|
|
1408
|
+
}, [livePermissions, parkedAsks, sessionId]);
|
|
1349
1409
|
const suppressedQuestionIdsRef = useRef(new Map());
|
|
1350
1410
|
const suppressQuestionFor = useCallback((requestId, ms = 15000) => {
|
|
1351
1411
|
suppressedQuestionIdsRef.current.set(requestId, Date.now() + ms);
|
|
@@ -1360,8 +1420,15 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1360
1420
|
}
|
|
1361
1421
|
return true;
|
|
1362
1422
|
}, []);
|
|
1363
|
-
const
|
|
1423
|
+
const liveQuestions = useMemo(() => (sessionState?.questions ??
|
|
1364
1424
|
Object.values(allQuestions).filter((q) => q.sessionID === sessionId)).filter((q) => !isQuestionSuppressed(q.id)), [sessionState?.questions, allQuestions, sessionId, isQuestionSuppressed]);
|
|
1425
|
+
const pendingQuestions = useMemo(() => {
|
|
1426
|
+
const live = new Set(liveQuestions.map((q) => q.id));
|
|
1427
|
+
const parked = parkedAsks
|
|
1428
|
+
.filter((ask) => ask.kind === 'question' && ask.question && !live.has(ask.request_id) && !isQuestionSuppressed(ask.request_id))
|
|
1429
|
+
.map((ask) => ({ id: ask.request_id, sessionID: sessionId, questions: ask.question.questions }));
|
|
1430
|
+
return parked.length ? [...liveQuestions, ...parked] : liveQuestions;
|
|
1431
|
+
}, [liveQuestions, parkedAsks, sessionId, isQuestionSuppressed]);
|
|
1365
1432
|
/**
|
|
1366
1433
|
* The runtime is parked on an answer only the user can give.
|
|
1367
1434
|
*
|
|
@@ -1377,7 +1444,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1377
1444
|
* come back the instant the agent is running again, not a third of a second
|
|
1378
1445
|
* later.
|
|
1379
1446
|
*/
|
|
1380
|
-
|
|
1447
|
+
// Live asks only: a parked ask no longer holds the turn.
|
|
1448
|
+
const awaitingUserInput = liveQuestions.length > 0 || livePermissions.length > 0;
|
|
1381
1449
|
const QUESTION_PROMPT_ANIMATION_MS = 320;
|
|
1382
1450
|
const activePendingQuestion = pendingQuestions[0] ?? null;
|
|
1383
1451
|
// A new question docks over the bottom of the transcript, and answering it
|
|
@@ -1867,6 +1935,9 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1867
1935
|
* 1.5k "two children with the same key" errors in one churn). The origin
|
|
1868
1936
|
* key goes to the FIRST claimant; any other turn falls back to its own id.
|
|
1869
1937
|
*/
|
|
1938
|
+
// Turns whose prompt is another agent's notice: the work continues across
|
|
1939
|
+
// them, so they sit a continuation's distance below the turn above.
|
|
1940
|
+
const agentNoticeTurnIds = useMemo(() => new Set(turns.filter((turn) => isAgentNoticeTurn(turn)).map((turn) => turn.id)), [turns]);
|
|
1870
1941
|
const turnRenderKeys = useMemo(() => {
|
|
1871
1942
|
const keys = new Map();
|
|
1872
1943
|
const used = new Set();
|
|
@@ -1932,7 +2003,15 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1932
2003
|
// ---- Permission/question reply handlers ----
|
|
1933
2004
|
const removePermission = useRuntimePendingStore((s) => s.removePermission);
|
|
1934
2005
|
const removeQuestion = useRuntimePendingStore((s) => s.removeQuestion);
|
|
2006
|
+
const answerParkedAsk = useAnswerSessionAsk(projectId ?? '');
|
|
1935
2007
|
const handlePermissionReply = useCallback(async (requestId, reply) => {
|
|
2008
|
+
// A parked ask: the call no longer waits, so the decision goes through
|
|
2009
|
+
// the asks API (it reaches the agent as a message).
|
|
2010
|
+
const parkedAskId = livePermissions.some((p) => p.id === requestId) ? undefined : parkedAskIdByRequest.get(requestId);
|
|
2011
|
+
if (parkedAskId) {
|
|
2012
|
+
await answerParkedAsk.mutateAsync({ askId: parkedAskId, answer: { reply } });
|
|
2013
|
+
return;
|
|
2014
|
+
}
|
|
1936
2015
|
// No optimistic remove: only drop the card once the runtime accepted the
|
|
1937
2016
|
// reply — a failed reply must stay answerable. Rethrow so callers
|
|
1938
2017
|
// (prompt buttons) reset their busy state and surface the error.
|
|
@@ -1943,7 +2022,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1943
2022
|
await replyToPermission(requestId, reply);
|
|
1944
2023
|
removePermission(requestId);
|
|
1945
2024
|
}
|
|
1946
|
-
}, [sessionState, removePermission]);
|
|
2025
|
+
}, [sessionState, removePermission, livePermissions, parkedAskIdByRequest, answerParkedAsk]);
|
|
1947
2026
|
const handleQuestionReply = useCallback(async (requestId, answers) => {
|
|
1948
2027
|
// Snapshot the question BEFORE removing it so we can cache the
|
|
1949
2028
|
// answer against the tool part's ID.
|
|
@@ -1952,6 +2031,12 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1952
2031
|
suppressQuestionFor(requestId);
|
|
1953
2032
|
// Optimistically remove the question so the textarea shows immediately
|
|
1954
2033
|
removeQuestion(requestId);
|
|
2034
|
+
const parkedAskId = liveQuestions.some((q) => q.id === requestId) ? undefined : parkedAskIdByRequest.get(requestId);
|
|
2035
|
+
if (parkedAskId) {
|
|
2036
|
+
// Parked: the answer reaches the agent as a message that quotes the question.
|
|
2037
|
+
answerParkedAsk.mutate({ askId: parkedAskId, answer: { answers } });
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
1955
2040
|
// Save the answers in the optimistic cache keyed by the question call's
|
|
1956
2041
|
// block id. This cache survives updates that may overwrite the call
|
|
1957
2042
|
// before the server includes its answers; the transcript's answered
|
|
@@ -1978,11 +2063,17 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1978
2063
|
catch {
|
|
1979
2064
|
// ignore — SSE "question.replied" event will also remove it
|
|
1980
2065
|
}
|
|
1981
|
-
}, [sessionState, removeQuestion, suppressQuestionFor]);
|
|
2066
|
+
}, [sessionState, removeQuestion, suppressQuestionFor, liveQuestions, parkedAskIdByRequest, answerParkedAsk]);
|
|
1982
2067
|
const handleQuestionReject = useCallback(async (requestId) => {
|
|
1983
2068
|
suppressQuestionFor(requestId);
|
|
1984
2069
|
// Optimistically remove the question so the textarea shows immediately
|
|
1985
2070
|
removeQuestion(requestId);
|
|
2071
|
+
const parkedAskId = liveQuestions.some((q) => q.id === requestId) ? undefined : parkedAskIdByRequest.get(requestId);
|
|
2072
|
+
if (parkedAskId) {
|
|
2073
|
+
// Dismissing a parked question closes it; nothing runs, so nothing is stopped.
|
|
2074
|
+
answerParkedAsk.mutate({ askId: parkedAskId, answer: { dismiss: true } });
|
|
2075
|
+
return;
|
|
2076
|
+
}
|
|
1986
2077
|
try {
|
|
1987
2078
|
if (sessionState)
|
|
1988
2079
|
await sessionState.rejectQuestion(requestId);
|
|
@@ -2045,7 +2136,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2045
2136
|
useEffect(() => {
|
|
2046
2137
|
outcomeJumpRef.current = { sessionId, hasOlder, isLoadingOlder, loadOlder };
|
|
2047
2138
|
}, [sessionId, hasOlder, isLoadingOlder, loadOlder]);
|
|
2048
|
-
|
|
2139
|
+
// `quiet`: a jump the reader did not click (a `?m=` link) fails silently, without the change-request toasts.
|
|
2140
|
+
const handleJumpToOutcome = useCallback(async (resolveTurn, createdAt, quiet = false) => {
|
|
2049
2141
|
if (jumpingToOutcome)
|
|
2050
2142
|
return;
|
|
2051
2143
|
setJumpingToOutcome(true);
|
|
@@ -2062,9 +2154,12 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2062
2154
|
settle,
|
|
2063
2155
|
},
|
|
2064
2156
|
resolve: () => outcomeJumpRef.current.sessionId === currentSession ? resolveTurn() : undefined,
|
|
2065
|
-
loadError: () =>
|
|
2157
|
+
loadError: () => {
|
|
2158
|
+
if (!quiet)
|
|
2159
|
+
errorToast(tChangeRequests('loadError'));
|
|
2160
|
+
},
|
|
2066
2161
|
unavailable: () => {
|
|
2067
|
-
if (outcomeJumpRef.current.sessionId === currentSession)
|
|
2162
|
+
if (!quiet && outcomeJumpRef.current.sessionId === currentSession)
|
|
2068
2163
|
errorToast(tChangeRequests('unavailable'));
|
|
2069
2164
|
},
|
|
2070
2165
|
scroll: async (key) => {
|
|
@@ -2094,7 +2189,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2094
2189
|
});
|
|
2095
2190
|
}
|
|
2096
2191
|
catch {
|
|
2097
|
-
|
|
2192
|
+
if (!quiet)
|
|
2193
|
+
errorToast(tChangeRequests('loadError'));
|
|
2098
2194
|
}
|
|
2099
2195
|
finally {
|
|
2100
2196
|
setJumpingToOutcome(false);
|
|
@@ -2182,6 +2278,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2182
2278
|
const clientMessageId = overrides?.clientMessageId ?? ascendingId('msg');
|
|
2183
2279
|
const sentAtMs = Date.now();
|
|
2184
2280
|
const messageID = mintSessionWireMessageId(sessionId, clientMessageId);
|
|
2281
|
+
sentHereIds.current.add(messageID);
|
|
2185
2282
|
// Generate part IDs upfront so the optimistic message and the server
|
|
2186
2283
|
// request use the SAME IDs. When the server echoes parts via
|
|
2187
2284
|
// message.part.updated, the sync store's upsertPart will UPDATE
|
|
@@ -3296,18 +3393,34 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3296
3393
|
// (Claude Code's agent panel). It reads its own lists and never holds the composer.
|
|
3297
3394
|
const agentsLineCompact = !!transcriptRows && !isPhone;
|
|
3298
3395
|
const chatUnderbarSlot = useMemo(() => _jsx(AgentsLine, { projectId: projectId, sessionId: projectSessionId, compact: agentsLineCompact }), [projectId, projectSessionId, agentsLineCompact]);
|
|
3396
|
+
// A space's thread lists only the queue's live messages in its card: failed
|
|
3397
|
+
// ones and a Stop hold read as calm lines (`ChatQueueLines`), reports wait behind Resume.
|
|
3398
|
+
const calmRest = useMemo(() => [...queueRows.rows, ...heldCommandRows(heldCommands)].filter((row) => row.state !== 'failed' && !row.synthetic), [queueRows.rows, heldCommands]);
|
|
3299
3399
|
// The queued messages and the one Resume while a Stop holds the queue: their
|
|
3300
3400
|
// own full-width card above the composer stack, not inside the strip.
|
|
3301
|
-
const chatAboveSlot = useMemo(() => (_jsx(
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3401
|
+
const chatAboveSlot = useMemo(() => (_jsx(_Fragment, { children: rowsContext?.messagesOnly ? (
|
|
3402
|
+
// A space's thread: calm lines ("Not sent · Retry", "Stopped · Resume"), the card only for queued messages.
|
|
3403
|
+
_jsx(ChatQueueLines, { rows: queueRows.rows, heldCount: queueRows.heldCount, resumePending: resumePending, onResume: () => void handleResumeQueue(), onRetry: handleRetryQueuedMessage, children: calmRest.length > 0 ? (_jsx(QueuedPromptList, { rows: calmRest, heldCount: 0, resumePending: resumePending, onResume: () => void handleResumeQueue(), onEdit: (id) => {
|
|
3404
|
+
queueEdit.takeBack(id);
|
|
3405
|
+
}, onRemove: (id) => {
|
|
3406
|
+
if (id.startsWith(HELD_COMMAND_ROW_PREFIX)) {
|
|
3407
|
+
const heldId = id.slice(HELD_COMMAND_ROW_PREFIX.length);
|
|
3408
|
+
setHeldCommands((held) => held.filter((entry) => entry.id !== heldId));
|
|
3409
|
+
return;
|
|
3410
|
+
}
|
|
3411
|
+
void handleRemoveQueuedMessage(id);
|
|
3412
|
+
}, onRetry: handleRetryQueuedMessage, onStopAndSend: effectiveBusy && canStop ? handleStopAndSendQueuedMessage : undefined, editing: queueEdit.editing, onCancelEdit: queueEdit.cancel })) : null })) : (_jsx(QueuedPromptList, { rows: heldCommands.length > 0 ? [...queueRows.rows, ...heldCommandRows(heldCommands)] : queueRows.rows, heldCount: queueRows.heldCount, resumePending: resumePending, onResume: () => void handleResumeQueue(), onEdit: (id) => {
|
|
3413
|
+
queueEdit.takeBack(id);
|
|
3414
|
+
}, onRemove: (id) => {
|
|
3415
|
+
if (id.startsWith(HELD_COMMAND_ROW_PREFIX)) {
|
|
3416
|
+
const heldId = id.slice(HELD_COMMAND_ROW_PREFIX.length);
|
|
3417
|
+
setHeldCommands((held) => held.filter((entry) => entry.id !== heldId));
|
|
3418
|
+
return;
|
|
3419
|
+
}
|
|
3420
|
+
void handleRemoveQueuedMessage(id);
|
|
3421
|
+
}, onRetry: handleRetryQueuedMessage, onStopAndSend: effectiveBusy && canStop ? handleStopAndSendQueuedMessage : undefined, editing: queueEdit.editing, onCancelEdit: queueEdit.cancel })) })), [
|
|
3422
|
+
rowsContext?.messagesOnly,
|
|
3423
|
+
calmRest,
|
|
3311
3424
|
heldCommands,
|
|
3312
3425
|
queueEdit.editing,
|
|
3313
3426
|
queueEdit.cancel,
|
|
@@ -3496,6 +3609,65 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3496
3609
|
if (crParam)
|
|
3497
3610
|
setOpenCrIdState(crParam);
|
|
3498
3611
|
}, [crParam]);
|
|
3612
|
+
// ---- Message link: `?m=<message_id>&at=<ms>` (the gateway request log's "Open in session") ----
|
|
3613
|
+
// Once per link, after the transcript first paints: page back until the turn
|
|
3614
|
+
// is loaded, scroll to it, flash it, then drop `m`/`at` so a reload stays put.
|
|
3615
|
+
const messageLink = readOnly ? null : readMessageLinkParams(searchParams);
|
|
3616
|
+
const messageLinkKey = messageLink ? `${sessionId}|${messageLink.messageId ?? ''}|${messageLink.at ?? ''}` : null;
|
|
3617
|
+
const linkTurnsRef = useRef(turns);
|
|
3618
|
+
useEffect(() => {
|
|
3619
|
+
linkTurnsRef.current = turns;
|
|
3620
|
+
}, [turns]);
|
|
3621
|
+
const jumpedLinkRef = useRef(null);
|
|
3622
|
+
useEffect(() => {
|
|
3623
|
+
if (!messageLink || !messageLinkKey || isDataLoading || turns.length === 0)
|
|
3624
|
+
return;
|
|
3625
|
+
if (jumpedLinkRef.current === messageLinkKey)
|
|
3626
|
+
return;
|
|
3627
|
+
jumpedLinkRef.current = messageLinkKey;
|
|
3628
|
+
const resolve = () => resolveMessageLinkTurn(linkTurnsRef.current, messageLink);
|
|
3629
|
+
// An in-app navigation has the transcript cached: `turns` exist frames before
|
|
3630
|
+
// their `[data-turn-id]` nodes mount, and the first paint scrolls to the
|
|
3631
|
+
// bottom. Jump only once the turns are in the DOM and that scroll has run,
|
|
3632
|
+
// else the scroll finds no node and the link lands at the bottom.
|
|
3633
|
+
let cancelled = false;
|
|
3634
|
+
let jumped = false;
|
|
3635
|
+
const startedAt = Date.now();
|
|
3636
|
+
const jump = () => {
|
|
3637
|
+
jumped = true;
|
|
3638
|
+
// Already on screen: no history to load. Else `at`, or NaN (load it all) for an id alone.
|
|
3639
|
+
const createdAt = resolve() ? Number.MAX_SAFE_INTEGER : (messageLink.at ?? Number.NaN);
|
|
3640
|
+
void handleJumpToOutcome(resolve, createdAt, true).finally(() => {
|
|
3641
|
+
const params = new URLSearchParams(searchParams?.toString());
|
|
3642
|
+
deleteMessageLinkParams(params);
|
|
3643
|
+
const qs = params.toString();
|
|
3644
|
+
shallowNavigate(qs ? `${pathname}?${qs}` : pathname, { replace: true });
|
|
3645
|
+
});
|
|
3646
|
+
};
|
|
3647
|
+
const waitForTurns = () => {
|
|
3648
|
+
if (cancelled)
|
|
3649
|
+
return;
|
|
3650
|
+
const mounted = !!contentRef.current?.querySelector('[data-turn-id]');
|
|
3651
|
+
if (!mounted && Date.now() - startedAt < MESSAGE_LINK_MOUNT_WAIT_MS) {
|
|
3652
|
+
window.setTimeout(waitForTurns, 100);
|
|
3653
|
+
return;
|
|
3654
|
+
}
|
|
3655
|
+
// Two frames: the first paint's bottom scroll lands before the jump, never after it.
|
|
3656
|
+
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
3657
|
+
if (!cancelled)
|
|
3658
|
+
jump();
|
|
3659
|
+
}));
|
|
3660
|
+
};
|
|
3661
|
+
waitForTurns();
|
|
3662
|
+
return () => {
|
|
3663
|
+
cancelled = true;
|
|
3664
|
+
// A wait cancelled before it jumped runs again on the next pass; a jump in flight is not repeated.
|
|
3665
|
+
if (!jumped && jumpedLinkRef.current === messageLinkKey)
|
|
3666
|
+
jumpedLinkRef.current = null;
|
|
3667
|
+
};
|
|
3668
|
+
// `messageLinkKey` stands for `messageLink`, which is a new object every render.
|
|
3669
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3670
|
+
}, [messageLinkKey, isDataLoading, turns.length, handleJumpToOutcome, searchParams, pathname, shallowNavigate, contentRef]);
|
|
3499
3671
|
const handleOpenOutcome = useCallback((outcome) => {
|
|
3500
3672
|
// Change requests are the only kind a turn produces. `external` exists on
|
|
3501
3673
|
// the union for `setup-links/setup-link-button.tsx`, which renders this
|
|
@@ -3519,281 +3691,306 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3519
3691
|
// an eternal loader. Only with nothing to paint: once any message is on
|
|
3520
3692
|
// screen, staleness is repaired in the background instead.
|
|
3521
3693
|
if (transcriptFreshness === 'error' && !hasMessages) {
|
|
3522
|
-
return (_jsx("div", { className:
|
|
3694
|
+
return (_jsx("div", { className: cn('relative flex h-full flex-col', !transparent && 'bg-background'), "data-testid": "session-chat", children: _jsxs("div", { className: "flex flex-1 flex-col items-center justify-center gap-3 p-6", "data-testid": "session-transcript-error", children: [_jsx("p", { className: "text-muted-foreground text-sm", children: tHardcodedUi.raw('i18nComplete.text8d0cef2d3405') }), _jsx(Button, { variant: "outline", size: "sm", onClick: () => retryTranscript(), children: tHardcodedUi.raw('i18nComplete.text942087cc2d41') })] }) }));
|
|
3523
3695
|
}
|
|
3524
|
-
return (_jsx("div", { className:
|
|
3696
|
+
return (_jsx("div", { className: cn('relative flex h-full flex-col', !transparent && 'bg-background'), "data-testid": "session-chat", children: _jsx(SessionStartingLoader, { projectId: projectId, sessionId: projectSessionId }) }));
|
|
3525
3697
|
}
|
|
3526
3698
|
return (
|
|
3527
3699
|
// A read-only view (the sub-session modal) offers no fix inside a tool card.
|
|
3528
|
-
_jsx(ReadOnlySessionContext.Provider, { value: !!readOnly, 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',
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
//
|
|
3700
|
-
//
|
|
3701
|
-
//
|
|
3702
|
-
//
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3700
|
+
_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',
|
|
3701
|
+
// Transparent in the welcome state so the root-level full-bleed wallpaper
|
|
3702
|
+
// (portaled into SessionLayout) reads through; solid once real content
|
|
3703
|
+
// takes over. Same base color either way, so non-welcome is unchanged.
|
|
3704
|
+
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
|
|
3705
|
+
? welcomeWallpaper && createPortal(welcomeWallpaper, wallpaperLayer)
|
|
3706
|
+
: welcomeWallpaper, !hideHeader && (_jsx(SessionSiteHeader, { sessionId: sessionId, sessionTitle: session?.title || 'Untitled', leadingAction: headerLeadingAction, parent: parentCrumb })), _jsx(ModelSwitchHistory, { history: projectSessionRow?.metadata?.model_switches, current: projectSessionRow?.metadata?.model }), _jsx(SessionContextModal, { open: contextModalOpen, onOpenChange: setContextModalOpen,
|
|
3707
|
+
// A chat with no `useSession` source: the raw explorer lists the
|
|
3708
|
+
// rows `useSessionSync` read for it.
|
|
3709
|
+
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: () => {
|
|
3710
|
+
try {
|
|
3711
|
+
if (sessionId)
|
|
3712
|
+
useTabStore.getState().closeTab?.(sessionId);
|
|
3713
|
+
}
|
|
3714
|
+
catch { }
|
|
3715
|
+
}, 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(
|
|
3716
|
+
// overflow-anchor:none — this scroll area does ALL of its own
|
|
3717
|
+
// anchoring (useAutoScroll's spacer + RAF follow, the send-path
|
|
3718
|
+
// turn anchor, and the history-prepend content-space restore in
|
|
3719
|
+
// session-history-scroll.ts). The browser's native scroll
|
|
3720
|
+
// anchoring (default `overflow-anchor: auto`) tries to
|
|
3721
|
+
// compensate for the SAME prepends independently, and the two
|
|
3722
|
+
// corrections stacking is the other half of the scroll-up
|
|
3723
|
+
// teleport: ours restores the reader's position, then the
|
|
3724
|
+
// native one nudges it again.
|
|
3725
|
+
'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",
|
|
3726
|
+
// Width and gutters live in `SESSION_TRANSCRIPT_CLASS`: the
|
|
3727
|
+
// instant shell draws this same column and the two crossfade
|
|
3728
|
+
// into each other, so a difference here is a sideways jump on
|
|
3729
|
+
// screen, not a style opinion. See session-body.tsx.
|
|
3730
|
+
//
|
|
3731
|
+
// No bottom padding, there or here: the space under the last
|
|
3732
|
+
// message is the auto-scroll spacer's job alone. The `pb-32`
|
|
3733
|
+
// that used to sit here stacked 128px of dead space on top of
|
|
3734
|
+
// it — the "extra inset at the bottom of the session".
|
|
3735
|
+
// Rows run edge to edge: each row owns its gutters and its hover fill.
|
|
3736
|
+
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 &&
|
|
3737
|
+
!olderPullFailed &&
|
|
3738
|
+
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 &&
|
|
3739
|
+
firstPromptSource &&
|
|
3740
|
+
queuedSyntheticMessages.length === 0 &&
|
|
3741
|
+
rowsContext && (
|
|
3742
|
+
// A channel thread draws the stand-in as rows, the same
|
|
3743
|
+
// rows its boot body drew (`ThreadBootRows`).
|
|
3744
|
+
_jsx(PendingPromptRows, { text: buildOptimisticPromptTextWithUploads(firstPromptSource.text, firstPromptSource.files), author: rowsContext.owner, sessionId: sessionId, busy: turns.length === 0 && (lastTurnWorking || promptInbox.prompts.some(isFirstPromptRow)) })), showFirstPromptPreview &&
|
|
3745
|
+
firstPromptSource &&
|
|
3746
|
+
queuedSyntheticMessages.length === 0 &&
|
|
3747
|
+
!rowsContext && (_jsx(OptimisticTurn, { text: buildOptimisticPromptTextWithUploads(firstPromptSource.text, firstPromptSource.files),
|
|
3748
|
+
// Preserve a real failed-send status through the
|
|
3749
|
+
// boot-shell handover without inventing upload progress.
|
|
3750
|
+
// A first prompt held on its uploads carries its own.
|
|
3751
|
+
uploadStatus: firstPromptSource.uploadStatus ?? firstPromptUploadStatus, agentNames: agentNames, onFileClick: openFileInComputer, sessionId: sessionId,
|
|
3752
|
+
// The first item of the conversation, like turn 0, which has no
|
|
3753
|
+
// top margin. `first:mt-0` misses here: the list opens with a
|
|
3754
|
+
// zero-height <header>, so the stand-in sat 44px lower than turn 0
|
|
3755
|
+
// and every swap between the two jumped the bubble (KRTX-2931).
|
|
3756
|
+
className: "mt-0",
|
|
3757
|
+
// An undelivered first prompt is a turn about to start, as the
|
|
3758
|
+
// shell above this chat shows it: busy from the first frame,
|
|
3759
|
+
// before the working projection has read the inbox (KRTX-2931).
|
|
3760
|
+
busy: turns.length === 0 && (lastTurnWorking || promptInbox.prompts.some(isFirstPromptRow)) })), turns.map((turn, turnIndex) => {
|
|
3761
|
+
// Check if this turn is a compaction summary — and
|
|
3762
|
+
// whether it actually PRODUCED one. A failed/aborted
|
|
3763
|
+
// attempt (compaction-flagged, no content, not the
|
|
3764
|
+
// working turn) renders as one slim row, draws no
|
|
3765
|
+
// divider, and stacks tight against a neighbouring
|
|
3766
|
+
// failed attempt.
|
|
3767
|
+
const compaction = turn.compaction;
|
|
3768
|
+
const hasCompaction = compaction !== null;
|
|
3769
|
+
const isTurnWorking = turn.live;
|
|
3770
|
+
// `inFlight` (message state) alongside the projection:
|
|
3771
|
+
// classifying by projection alone flipped a streaming
|
|
3772
|
+
// compaction to "failed" for the frames where the two
|
|
3773
|
+
// disagree, popping the divider in and out — a layout
|
|
3774
|
+
// bounce right where the reader is looking.
|
|
3775
|
+
const isFailedCompaction = compaction !== null &&
|
|
3776
|
+
!compaction.hasContent &&
|
|
3777
|
+
!compaction.inFlight &&
|
|
3778
|
+
!isTurnWorking;
|
|
3779
|
+
// Retries collapse to ONE visible row, GLOBALLY: a
|
|
3780
|
+
// failed attempt with ANY later compaction turn (a
|
|
3781
|
+
// retry, or the one that finally landed) is history —
|
|
3782
|
+
// it keeps its TurnViewport (stable keys, scroll
|
|
3783
|
+
// anchors) but renders no content, and an empty
|
|
3784
|
+
// TurnViewport costs 0px (turn-viewport.tsx RULE 2).
|
|
3785
|
+
// Adjacency was not enough: attempts whose error landed
|
|
3786
|
+
// on a plain assistant message used to interleave as
|
|
3787
|
+
// unclassified turns, breaking every consecutive run.
|
|
3788
|
+
const suppressedFailedCompaction = isFailedCompaction && turnIndex < lastCompactionTurnIndex;
|
|
3789
|
+
// Notification-only early-return removed: it rendered the
|
|
3790
|
+
// user's pty_* card but skipped the turn's replies,
|
|
3791
|
+
// hiding every subsequent assistant response in that turn.
|
|
3792
|
+
// Fall through to the normal turn renderer instead.
|
|
3793
|
+
const confirmedActive = turnIsConfirmedActive({
|
|
3794
|
+
isTurnWorking,
|
|
3795
|
+
turnId: turn.id,
|
|
3796
|
+
activeTurnId,
|
|
3797
|
+
pendingDelivery: !!working.pendingDelivery,
|
|
3798
|
+
});
|
|
3799
|
+
const pendingPrompt = !confirmedActive && turn.assistant.length === 0
|
|
3800
|
+
? pendingPromptsByMessageId.get(turn.id)
|
|
3801
|
+
: undefined;
|
|
3802
|
+
// A queued prompt is not in the runtime transcript yet;
|
|
3803
|
+
// its author still shows (`authorForTurn`).
|
|
3804
|
+
const promptAuthorId = pendingPromptsByMessageId.get(turn.id)?.author_user_id;
|
|
3805
|
+
const turnAuthor = authorForTurn(transcriptAuthors, messageAuthors, turn.id, pendingPrompt?.wire_message_id) ??
|
|
3806
|
+
participantAuthor(sessionParticipants, promptAuthorId) ??
|
|
3807
|
+
(sentHereIds.current.has(turn.id) ||
|
|
3808
|
+
sentHereIds.current.has(turnRenderKeys.get(turn.id) ?? '') ||
|
|
3809
|
+
(viewerId !== undefined && promptAuthorId === viewerId) ||
|
|
3810
|
+
// The first prompt of a session the viewer started,
|
|
3811
|
+
// sent from another surface (project home), before
|
|
3812
|
+
// the first authors read lands.
|
|
3813
|
+
(messageAuthorsLoading &&
|
|
3814
|
+
viewerId !== undefined &&
|
|
3815
|
+
projectSessionRow?.created_by === viewerId &&
|
|
3816
|
+
turn.id === userMessageIds[0])
|
|
3817
|
+
? viewerAsAuthor
|
|
3818
|
+
: undefined);
|
|
3819
|
+
return (_jsx(TranscriptTurnRow
|
|
3820
|
+
// ONE element per prompt: keyed by the id the
|
|
3821
|
+
// bubble was FIRST painted under, so the swap to a
|
|
3822
|
+
// re-minted echo id re-renders this node instead
|
|
3823
|
+
// of mounting a new one (opacity keeps animating,
|
|
3824
|
+
// hover state survives, nothing jumps).
|
|
3825
|
+
, { turnId: turn.id, modelOptions: modelOptions, suppressed: suppressedFailedCompaction, continuedWith: harnessSwitches.get(turn.id)?.harness, fullTextState: loaded.state[turn.id] ?? 'idle', onLoadFullText: loadFullTexts, showBusyRow: showFallbackBusyRow &&
|
|
3826
|
+
fallbackBusyRowTurnId === turn.id,
|
|
3827
|
+
// Queued bubbles STACK: a pending turn right after
|
|
3828
|
+
// another pending turn sits close to it, like a
|
|
3829
|
+
// list of what is waiting — not a turn's width
|
|
3830
|
+
// apart as if each had been answered in between.
|
|
3831
|
+
// (Failed compaction rows need no stacking rule any
|
|
3832
|
+
// more — at most one is visible at a time.)
|
|
3833
|
+
viewportClassName: turnIndex === 0 || transcriptRows
|
|
3834
|
+
? ''
|
|
3835
|
+
: // A compaction, the work after it and another agent's notice continue the turn above.
|
|
3836
|
+
turn.compaction || turn.continues || agentNoticeTurnIds.has(turn.id)
|
|
3837
|
+
? 'mt-6'
|
|
3838
|
+
: lastTurnWorking &&
|
|
3839
|
+
pendingTurnIds.has(turn.id) &&
|
|
3840
|
+
pendingTurnIds.has(turns[turnIndex - 1].id)
|
|
3841
|
+
? 'mt-3'
|
|
3842
|
+
: 'mt-12', turn: turn, author: turnAuthor,
|
|
3843
|
+
// Reserve the sender row while the authors load,
|
|
3844
|
+
// for a queued prompt whose sender is known, and
|
|
3845
|
+
// for a live message until its author resolves.
|
|
3846
|
+
showAuthor: !!turnAuthor ||
|
|
3847
|
+
messageAuthorsLoading ||
|
|
3848
|
+
!!promptAuthorId ||
|
|
3849
|
+
(loadedUserIds?.sessionId === sessionId &&
|
|
3850
|
+
!loadedUserIds.ids.has(turn.id) &&
|
|
3851
|
+
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,
|
|
3852
|
+
// Handed over only once the stand-in has stepped
|
|
3853
|
+
// aside — while it is up it draws these itself.
|
|
3854
|
+
pendingText: turnIndex === 0 ? firstTurnHandover?.text : undefined, pendingAttachments: sentAttachmentsForTurn({
|
|
3855
|
+
sentByMessage: sentAttachmentsByMessage,
|
|
3856
|
+
messageId: turn.id,
|
|
3857
|
+
originId: optimisticOriginOf(sessionId, turn.id),
|
|
3858
|
+
isFirstTurn: turnIndex === 0,
|
|
3859
|
+
firstTurnHandover: firstTurnHandover?.attachments,
|
|
3860
|
+
firstTurnSent: firstPromptAttachments(projectSessionId),
|
|
3861
|
+
queuedRowAttachments: inboxRowsByMessageId.get(turn.id)?.attachments,
|
|
3862
|
+
}), uploadStatus: heldSendFailures?.[turn.id]
|
|
3863
|
+
? {
|
|
3864
|
+
state: 'failed',
|
|
3865
|
+
message: heldSendFailures[turn.id].message,
|
|
3866
|
+
onRetry: () => retryHeldSend(sessionId, turn.id, resendHeldSend, (error) => classifySessionError(error).message),
|
|
3867
|
+
}
|
|
3868
|
+
: turnIndex === 0 && firstTurnHandover?.attachments.length
|
|
3869
|
+
? firstPromptUploadStatus
|
|
3870
|
+
: undefined, sessionWorking: lastTurnWorking, isWorkingTurn: turn.live, suppressBusyIndicator: suppressWorkingTurnBusy, awaitingUser: awaitingUserInput,
|
|
3871
|
+
// An idle send stays in the inbox until delivery,
|
|
3872
|
+
// but nothing runs ahead of it: queued only while
|
|
3873
|
+
// it waits behind a turn (`turnRendersQueued`).
|
|
3874
|
+
// The first turn, with no turn working, has
|
|
3875
|
+
// nothing ahead of it: a session's first prompt is
|
|
3876
|
+
// starting, not queued, while the computer comes up
|
|
3877
|
+
// and before the turn layer marks it queued or live.
|
|
3878
|
+
pending: turnIndex === 0 && workingTurn.workingTurnId === null && !confirmedActive
|
|
3879
|
+
? pendingPrompt?.state === 'waiting' || pendingPrompt?.state === 'failed'
|
|
3880
|
+
: turnRendersQueued({
|
|
3881
|
+
turnId: turn.id,
|
|
3882
|
+
resolution: workingTurn,
|
|
3883
|
+
sessionWorking: lastTurnWorking,
|
|
3884
|
+
confirmedActive,
|
|
3885
|
+
inboxPrompt: pendingPrompt,
|
|
3886
|
+
}), 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
|
|
3887
|
+
? rewindTarget.text
|
|
3888
|
+
: null, editPending: editSendPending || !!sessionState?.rewindPending, onEditCancel: stableEditCancel, onEditSend: stableEditSend, rewindDisabled: !!readOnly ||
|
|
3889
|
+
(rewindable !== null && !rewindable.has(turn.id)) ||
|
|
3890
|
+
!runtimeCanRewind ||
|
|
3891
|
+
!sessionState ||
|
|
3892
|
+
isBusy ||
|
|
3893
|
+
sessionState.rewindPending ||
|
|
3894
|
+
// The runtime is not idle while queued prompts
|
|
3895
|
+
// are still on their way to it — a rewind mid-
|
|
3896
|
+
// delivery fails downstream with "Session is
|
|
3897
|
+
// busy" (measured); refuse it up front instead.
|
|
3898
|
+
promptInbox.prompts.length > 0 }, turnRenderKeys.get(turn.id)));
|
|
3899
|
+
})] }) }), isOptimisticCompacting && !hasCompactionTurn && (_jsx("div", { className: turns.length > 0 ? 'mt-12' : 'mt-2', children: _jsx(CompactionMarker, { running: true }) })), [
|
|
3900
|
+
...(turnOutcome.recent_failures ?? []),
|
|
3901
|
+
...(turnOutcome.last_ended?.end_reason === 'failed' &&
|
|
3902
|
+
!turnOutcome.recent_failures?.some((failure) => failure.message_id === turnOutcome.last_ended?.message_id)
|
|
3903
|
+
? [turnOutcome.last_ended]
|
|
3904
|
+
: []),
|
|
3905
|
+
].filter((failure) => !isAbortError(failure.error) &&
|
|
3906
|
+
!failureShownByTurn(failure, turns) &&
|
|
3907
|
+
!failureSupersededByTurn(failure, turns) &&
|
|
3908
|
+
(!failure.error?.message || failure.error.message !== commandError?.message)).map((failure) => {
|
|
3909
|
+
const messageId = failure.message_id ?? 'persisted-turn-failure';
|
|
3910
|
+
// Use the SDK's settle window for a cause that may arrive
|
|
3911
|
+
// one frame later, including an unnamed failed last turn.
|
|
3912
|
+
const notice = turnEndNotice({
|
|
3913
|
+
...turnOutcome,
|
|
3914
|
+
recent_failures: [{ ...failure, message_id: messageId, error: failure.error ?? null }],
|
|
3915
|
+
}, messageId, { hasError: false, isAbort: false });
|
|
3916
|
+
return notice ? (_jsx(TurnErrorDisplay, { errorText: notice.kind === 'unexplained'
|
|
3917
|
+
? tHardcodedUi.raw('i18nComplete.text73112526c03a')
|
|
3918
|
+
: persistedFailureText(failure.error), className: "mt-2" }, messageId)) : null;
|
|
3919
|
+
}), commandError && (_jsx(TurnErrorDisplay, { error: commandError, isAbort: isAbortError(commandError.cause), modelOptions: modelOptions, className: "mt-2" })), showFallbackBusyRow && fallbackBusyRowTurnId === null && (rowsContext ? (
|
|
3920
|
+
// A channel thread waits in the agent's answer row.
|
|
3921
|
+
_jsx(AgentBusyRow, { sessionId: sessionId })) : (_jsx(SessionBusyIndicator, { sessionId: sessionId,
|
|
3922
|
+
// Matches the stand-in's row spacing under a bubble
|
|
3923
|
+
// (`OptimisticTurn`), so the crossfade into the real
|
|
3924
|
+
// transcript does not move it. Nothing above it when
|
|
3925
|
+
// the transcript is empty, so no margin there.
|
|
3926
|
+
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: {
|
|
3927
|
+
left: `${selectionPopup.x}px`,
|
|
3928
|
+
top: `${selectionPopup.y}px`,
|
|
3929
|
+
transform: 'translate(-50%, -100%)',
|
|
3930
|
+
}, 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
|
|
3931
|
+
? 'duration-normal scale-100 opacity-100'
|
|
3932
|
+
: '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
|
|
3742
3933
|
// `undefined`, not `true`, once released: the composer's own
|
|
3743
3934
|
// viewport rule (>= 640px) still decides, so this never forces
|
|
3744
3935
|
// focus onto a phone keyboard.
|
|
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
|
-
:
|
|
3936
|
+
// A thread a space's chat opened by itself does not take the focus (`ComposerAutoFocusContext`).
|
|
3937
|
+
, {
|
|
3938
|
+
// `undefined`, not `true`, once released: the composer's own
|
|
3939
|
+
// viewport rule (>= 640px) still decides, so this never forces
|
|
3940
|
+
// focus onto a phone keyboard.
|
|
3941
|
+
// A thread a space's chat opened by itself does not take the focus (`ComposerAutoFocusContext`).
|
|
3942
|
+
autoFocus: deferComposerFocus || !composerAutoFocus ? false : undefined, onSend: async (text, files, mentions, attachments, placement) => {
|
|
3943
|
+
if (await queueEdit.save(text))
|
|
3944
|
+
return;
|
|
3945
|
+
// Enter while a turn runs steers it (D9.1); Cmd/Ctrl+Enter is Queue List.
|
|
3946
|
+
await handleSend(text, files, mentions, attachments, composerSendDelivery(placement ?? 'transcript', isBusyRef.current));
|
|
3947
|
+
}, prefill: composerPrefill, onPrefillApplied: (id) => {
|
|
3948
|
+
useSessionComposerPrefillStore.getState().clearPrefill(sessionId, id);
|
|
3949
|
+
},
|
|
3950
|
+
// Up from the first row takes the queue back; the placeholder
|
|
3951
|
+
// says so while there is something to take.
|
|
3952
|
+
onArrowUpAtStart: () => queueEdit.takeBack(),
|
|
3953
|
+
// A host placeholder ("Reply…") is static: the rotating tips would replace it.
|
|
3954
|
+
hint: canTakeBackQueue ? tHardcodedUi.raw('i18nComplete.text03a01dd53ffa') : composerPlaceholder,
|
|
3955
|
+
// Editing a queued message: the send saves it back into the
|
|
3956
|
+
// queue, so the control says Submit, never Stop.
|
|
3957
|
+
submitLabel: queueEdit.editing ? tQueue('submitEdit') : null, draftScope: composerDraftScope, draftActive: !deferComposerFocus, attachRequestId: attachRequestId, isBusy: isBusy,
|
|
3958
|
+
// The ONE projection, not the 300 ms busy fade: it is what
|
|
3959
|
+
// decides whether a `/` command may be dispatched, and a fade
|
|
3960
|
+
// timer that has already lapsed would let one abort a live turn.
|
|
3961
|
+
// `effectiveBusy` folds in optimistic compaction (not a turn, so
|
|
3962
|
+
// not in `working`) and the retrying-turn predicate, so this
|
|
3963
|
+
// site reads one value instead of re-OR-ing a term onto it.
|
|
3964
|
+
sessionWorking: effectiveBusy,
|
|
3965
|
+
// Gates `/` COMMANDS only. A prompt typed at a sleeping box is
|
|
3966
|
+
// an inbox row and goes out when the box answers; a command has
|
|
3967
|
+
// no row, and `runCommand` swallows it silently until the
|
|
3968
|
+
// runtime is switched.
|
|
3969
|
+
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,
|
|
3970
|
+
// Only lock the input into question-answer mode while the session is
|
|
3971
|
+
// actually busy (a live question keeps the run busy). If a question
|
|
3972
|
+
// chip is ever showing while the session is idle — e.g. a dead /
|
|
3973
|
+
// abandoned question the agent left behind — the input stays unlocked
|
|
3974
|
+
// so a typed message is sent to the agent instead of being swallowed
|
|
3975
|
+
// as a custom answer.
|
|
3976
|
+
lockForQuestion: !!renderedQuestion && isBusy,
|
|
3977
|
+
// Same dead-prompt guard as questions: only lock while the agent is
|
|
3978
|
+
// actually paused on the decision (isBusy), so a stale card can't
|
|
3979
|
+
// swallow the composer on an idle session.
|
|
3980
|
+
lockForApproval: runtimePermissionLocksComposer(livePermissions.length, isBusy), onCustomAnswer: handleCustomAnswer, questionButtonLabel: renderedQuestion ? questionAction.label : null, questionActive: !!renderedQuestion || approvalDocked, questionCanAct: questionAction.canAct, onQuestionAction: handleQuestionAction, aboveSlot: chatAboveSlot, inputSlot: chatInputSlot, toolbarSlot: chatToolbarSlot, underbarSlot: chatUnderbarSlot,
|
|
3981
|
+
// The shell can now render on a cached transcript alone, i.e. before
|
|
3982
|
+
// the sandbox answers — so sending has to be gated separately from
|
|
3983
|
+
// reading. See sessionComposerReadiness.
|
|
3984
|
+
notice: hostNotice(composerReadiness.notice, rowsContext?.notices),
|
|
3985
|
+
// Inside the thread panel's bordered box, as the channel composer.
|
|
3986
|
+
// A phone keeps the row under the card; a 720px desktop window does not.
|
|
3987
|
+
underbarPlacement: transcriptRows && !isPhone ? 'inline' : undefined,
|
|
3988
|
+
// The panel's toolbar is narrow: the agent is its tile, the model keeps its name.
|
|
3989
|
+
agentPickerCompact: transcriptRows && !isPhone,
|
|
3990
|
+
// A thread panel's rows run `px-5`, and the channel composer
|
|
3991
|
+
// beside it sits `pb-4` off the window's bottom edge: the same
|
|
3992
|
+
// margins, so the two boxes line up.
|
|
3993
|
+
parentClassName: transcriptRows ? 'max-w-none px-5 pb-4' : undefined, onNoticeRetry: composerReadiness.notice && composerReadiness.retryable
|
|
3994
|
+
? requestRuntimeReconnect
|
|
3995
|
+
: 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 }) })] }))] })] }) }) }) }) }));
|
|
3799
3996
|
}
|