@kortix/ui 0.14.19 → 0.15.1
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 +1 -1
- package/dist/_vendor/kortix-shared.js +1188 -202
- package/dist/_vendor/shared/artifact-annotations.d.ts +85 -607
- package/dist/_vendor/shared/artifact-comments.d.ts +53 -489
- package/dist/_vendor/shared/code-language.d.ts +2 -2
- package/dist/_vendor/shared/html.d.ts +7 -0
- package/dist/_vendor/shared/index.d.ts +1 -1
- package/dist/_vendor/shared/peer-message-prompt.d.ts +7 -1
- package/dist/_vendor/shared/pixel-mark.d.ts +28 -0
- package/dist/_vendor/shared/project-glyphs.d.ts +103 -20
- package/dist/_vendor/shared/runtime-versions.d.ts +2 -6
- package/dist/_vendor/shared/tool-output/media-path.d.ts +1 -6
- package/dist/_vendor/shared/tool-output/scan.d.ts +2 -0
- package/dist/_vendor/shared/utils/string.d.ts +6 -0
- 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 +8 -3
- package/dist/artifacts/frame-policy.d.ts +2 -9
- package/dist/artifacts/frame-policy.js +2 -25
- package/dist/customize/agents/agent-page.js +5 -5
- package/dist/customize/agents/agent-status.js +1 -1
- package/dist/customize/agents/agents-page.js +4 -4
- 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/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/connectors/use-agent-access.d.ts +3 -3
- package/dist/customize/providers/provider-connect.d.ts +6 -15
- package/dist/customize/providers/provider-connect.js +5 -36
- 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/connectors-view.js +50 -37
- 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/chatgpt-subscription-connect.js +21 -18
- 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/device-grant.d.ts +15 -0
- package/dist/customize/sections/llm-provider/device-grant.js +27 -0
- 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/agent-editor.d.ts +2 -2
- package/dist/customize/sections/view/agent-editor.js +2 -2
- package/dist/customize/sections/view/channel-settings-patch.js +1 -1
- package/dist/customize/sections/view/channels-view.js +8 -8
- 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/review-center-connected.js +54 -21
- 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.d.ts +4 -5
- package/dist/customize/sections/view/secret-delivery.js +6 -5
- 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/tabs/experimental-tab.js +3 -3
- package/dist/customize/settings/tabs/general-tab.js +65 -10
- 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/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/customize/triggers/schedule/trigger-runs-logic.d.ts +6 -0
- package/dist/customize/triggers/schedule/trigger-runs-logic.js +13 -0
- package/dist/customize/triggers/schedule/trigger-runs-panel.js +9 -2
- 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/api/runtime-files.d.ts +2 -2
- package/dist/files/project/api/runtime-files.js +2 -2
- package/dist/files/project/components/drive-explorer.js +1 -1
- package/dist/files/project/components/drive-grid-view.js +0 -1
- package/dist/files/project/components/drive-list-view.js +0 -1
- package/dist/files/project/components/file-explorer-page.js +1 -1
- package/dist/files/project/hooks/index.d.ts +1 -1
- package/dist/files/project/hooks/index.js +1 -1
- package/dist/files/project/hooks/use-server-health.d.ts +1 -1
- package/dist/files/project/hooks/use-server-health.js +1 -1
- package/dist/files/project/search/workspace-search-service.d.ts +1 -1
- package/dist/files/project/search/workspace-search-service.js +1 -1
- package/dist/files/runtime/hooks/index.d.ts +1 -1
- package/dist/files/runtime/hooks/index.js +1 -1
- package/dist/files/runtime/hooks/server-health-state.d.ts +2 -2
- package/dist/files/runtime/hooks/server-health-state.js +2 -2
- package/dist/files/runtime/hooks/system-dir.js +2 -2
- package/dist/files/runtime/hooks/use-file-content.d.ts +1 -1
- package/dist/files/runtime/hooks/use-file-content.js +1 -1
- package/dist/files/runtime/hooks/use-file-list.d.ts +1 -1
- package/dist/files/runtime/hooks/use-file-list.js +3 -3
- package/dist/files/runtime/hooks/use-server-health.d.ts +2 -2
- package/dist/files/runtime/hooks/use-server-health.js +3 -3
- package/dist/files/runtime/hooks/use-workspace-search.d.ts +1 -2
- package/dist/files/runtime/hooks/use-workspace-search.js +0 -1
- package/dist/files/runtime/index.d.ts +2 -2
- package/dist/files/runtime/index.js +2 -2
- package/dist/files/runtime/path-utils.d.ts +1 -1
- package/dist/files/runtime/path-utils.js +1 -1
- package/dist/files/runtime/sandbox-explorer-source.d.ts +1 -1
- package/dist/files/runtime/sandbox-explorer-source.js +1 -1
- package/dist/files/runtime/sandbox-file-explorer.d.ts +1 -1
- package/dist/files/runtime/sandbox-file-explorer.js +2 -2
- package/dist/files/tree/components/file-tree-item.js +0 -1
- package/dist/files/tree/hooks/use-file-events.d.ts +1 -1
- package/dist/files/tree/hooks/use-file-events.js +1 -1
- package/dist/files/viewer/index.d.ts +1 -1
- package/dist/files/viewer/index.js +1 -1
- package/dist/i18n/en.d.ts +513 -203
- package/dist/i18n/en.js +610 -300
- 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/capture/use-capture-area.d.ts +5 -1
- package/dist/internal/capture/use-capture-area.js +16 -9
- package/dist/internal/files/file-read-retry.js +1 -1
- package/dist/internal/files/types.d.ts +2 -2
- package/dist/internal/files/types.js +2 -2
- package/dist/internal/goals/goal-meta.d.ts +76 -10
- package/dist/internal/goals/goal-meta.js +191 -14
- 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 +3 -2
- package/dist/internal/hooks/projects/use-new-project-session.js +4 -3
- 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/layout/nav-hover-card.d.ts +1 -1
- package/dist/internal/layout/nav-hover-card.js +1 -1
- package/dist/internal/layout/project-capability-nav.d.ts +1 -1
- package/dist/internal/layout/project-capability-nav.js +7 -3
- 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 +2 -2
- package/dist/internal/lib/browser-error-noise.js +2 -2
- 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/browser-noise/rules/injected-scripts.js +18 -0
- package/dist/internal/lib/browser-noise/rules/old-browsers.d.ts +1 -0
- package/dist/internal/lib/browser-noise/rules/old-browsers.js +1 -1
- package/dist/internal/lib/browser-noise/rules/rejections.d.ts +0 -9
- package/dist/internal/lib/browser-noise/rules/rejections.js +0 -14
- 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/delivered-but-disconnected.js +3 -5
- package/dist/internal/lib/error-handler.js +8 -3
- 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/pixel-mark.d.ts +4 -17
- package/dist/internal/lib/pixel-mark.js +5 -148
- package/dist/internal/lib/sounds.d.ts +4 -4
- package/dist/internal/lib/sounds.js +4 -4
- 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 +9 -7
- 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/composer-prefill-store.js +4 -1
- package/dist/internal/stores/kortix-computer-store.d.ts +15 -0
- package/dist/internal/stores/kortix-computer-store.js +12 -0
- package/dist/internal/stores/sound-store.d.ts +4 -4
- package/dist/internal/stores/sound-store.js +10 -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/code/shiki-highlighter.js +14 -5
- 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/file-links.js +12 -3
- package/dist/markdown/markdown-frontmatter.d.ts +6 -6
- package/dist/markdown/markdown-frontmatter.js +3 -3
- package/dist/markdown/unified-markdown.d.ts +1 -1
- package/dist/markdown/unified-markdown.js +129 -10
- package/dist/primitives/button.js +2 -1
- 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.js +1 -1
- 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.d.ts +1 -5
- package/dist/session/agents/held-messages.js +8 -25
- 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/ComposerAboveCard.d.ts +4 -1
- package/dist/session/composer/ComposerAboveCard.js +2 -2
- 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 +9 -2
- package/dist/session/composer/composer-chat-input.js +14 -6
- 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 +71 -2
- 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 +16 -16
- package/dist/session/composer/hooks/use-file-search.js +17 -17
- package/dist/session/composer/menus/mention-controller.d.ts +3 -11
- package/dist/session/composer/menus/mention-controller.js +54 -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 +58 -0
- package/dist/session/composer/menus/space-mentions.js +99 -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/composer/use-instant-session-send.js +2 -2
- package/dist/session/header/session-goal-indicator.js +4 -4
- 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/easy/plan-card.d.ts +2 -2
- package/dist/session/panel/easy/plan-card.js +2 -2
- 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 +11 -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/panel/use-session-panel-state.js +2 -2
- 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/sandbox-loading-boundary.js +2 -2
- package/dist/session/status/session-load-state.d.ts +0 -1
- package/dist/session/status/session-load-state.js +2 -4
- package/dist/session/status/session-terminal-state.d.ts +47 -0
- package/dist/session/status/session-terminal-state.js +56 -0
- package/dist/session/thread/message-parsing.d.ts +0 -1
- package/dist/session/thread/message-parsing.js +0 -1
- package/dist/session/thread/plan-surface.d.ts +1 -1
- package/dist/session/thread/plan-surface.js +1 -1
- package/dist/session/thread/session-chat.d.ts +4 -2
- package/dist/session/thread/session-chat.js +547 -409
- 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/stop-sequence.d.ts +51 -0
- package/dist/session/thread/stop-sequence.js +55 -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 +48 -4
- package/dist/session/thread/transcript.js +228 -36
- 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/apply-patch-tool.d.ts +1 -1
- package/dist/session/tool/tools/apply-patch-tool.js +1 -1
- 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 +35 -14
- package/dist/session/tool/tools/multi-agent-tools.js +1 -1
- package/dist/session/tool/tools/pty-kill-tool.d.ts +1 -1
- package/dist/session/tool/tools/pty-kill-tool.js +1 -1
- package/dist/session/tool/tools/pty-read-tool.d.ts +2 -2
- package/dist/session/tool/tools/pty-read-tool.js +2 -2
- package/dist/session/tool/tools/pty-spawn-tool.d.ts +1 -1
- package/dist/session/tool/tools/pty-spawn-tool.js +1 -1
- package/dist/session/tool/tools/pty-write-tool.d.ts +1 -1
- package/dist/session/tool/tools/pty-write-tool.js +1 -1
- 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/todo-write-tool.d.ts +1 -1
- package/dist/session/tool/tools/todo-write-tool.js +1 -1
- 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/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 +14 -8
- package/dist/session/turn/peer-message-row.js +38 -64
- package/dist/session/turn/plan-anchor.d.ts +3 -3
- package/dist/session/turn/plan-anchor.js +3 -3
- package/dist/session/turn/plan-card.d.ts +7 -7
- package/dist/session/turn/plan-card.js +7 -7
- 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 +16 -42
- package/dist/session/turn/voice-turn.d.ts +22 -0
- package/dist/session/turn/voice-turn.js +32 -0
- package/dist/session/voice/call-ring.d.ts +10 -0
- package/dist/session/voice/call-ring.js +52 -0
- package/dist/session/voice/use-voice-call.d.ts +4 -4
- package/dist/session/voice/use-voice-call.js +6 -9
- 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 +3 -0
- package/dist/session/voice/voice-call-state.js +2 -1
- package/dist/session/voice/voice-call-store.d.ts +16 -6
- package/dist/session/voice/voice-call-store.js +5 -5
- package/dist/session/voice/voice-call.d.ts +4 -8
- package/dist/session/voice/voice-call.js +33 -36
- package/dist/styles/components.css +33 -0
- package/dist/styles/theme.css +26 -0
- package/dist/styles.css +1 -1
- package/dist/terminal/terminal-card-gate.d.ts +6 -3
- package/dist/terminal/terminal-card-gate.js +21 -4
- package/dist/workspace/admin/project-admin-dashboard.d.ts +1 -1
- package/dist/workspace/admin/project-admin-dashboard.js +12 -9
- package/dist/workspace/index.d.ts +3 -2
- package/dist/workspace/index.js +2 -1
- 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 +12 -3
- package/dist/workspace/review/review-center.js +50 -16
- package/dist/workspace/review/review-reducer.d.ts +7 -0
- package/dist/workspace/review/review-reducer.js +11 -0
- 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-artifacts-nav.d.ts +6 -1
- package/dist/workspace/sidebar/footer/project-artifacts-nav.js +47 -4
- 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 +13 -17
- package/dist/workspace/sidebar/project-session-list.d.ts +7 -1
- package/dist/workspace/sidebar/project-session-list.js +63 -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-group-sections.js +12 -4
- 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 +10 -24
- 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 +73 -0
- package/dist/workspace/spaces/principal-card.js +246 -0
- package/dist/workspace/spaces/space-agent-ask.d.ts +14 -0
- package/dist/workspace/spaces/space-agent-ask.js +36 -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-dialog.js +1 -1
- package/dist/workspace/spaces/space-details-panel.d.ts +27 -0
- package/dist/workspace/spaces/space-details-panel.js +173 -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 +13 -0
- package/dist/workspace/spaces/space-mention-source.js +71 -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 +203 -68
- 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 +11 -7
- package/skills/kortix-ui/SKILL.md +1 -1
- package/skills/kortix-ui/references/custom-dashboard.md +2 -3
- package/skills/kortix-ui/references/modules.md +4 -4
- package/dist/_vendor/shared/room-prompt.d.ts +0 -66
- package/dist/session/tool/tools/multi-agent-tool-data.d.ts +0 -63
- package/dist/session/tool/tools/multi-agent-tool-data.js +0 -118
- package/dist/session/voice/voice-call-bar.d.ts +0 -4
- package/dist/session/voice/voice-call-bar.js +0 -39
- 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';
|
|
@@ -21,7 +22,10 @@ import { AgentBusyRow, PendingPromptRows } from './thread-boot-rows.js';
|
|
|
21
22
|
import { createPortal } from 'react-dom';
|
|
22
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';
|
|
25
|
+
import { createStopLatch, runStopSequence, stopLeftTurnRunning } from './stop-sequence.js';
|
|
24
26
|
import { QueuedPromptList } from '../composer/queued-prompt-list.js';
|
|
27
|
+
import { ComposerAutoFocusContext } from '../composer/composer-focus-context.js';
|
|
28
|
+
import { ChatQueueLines } from '../composer/chat-queue-lines.js';
|
|
25
29
|
import { runtimePermissionLocksComposer } from '../composer/send-blockers.js';
|
|
26
30
|
import { SessionPrintHeader } from '../print/session-print-header.js';
|
|
27
31
|
import { useSessionPrint } from '../print/use-session-print.js';
|
|
@@ -48,12 +52,15 @@ import { sessionSlashFiles } from '../composer/menus/slash-files.js';
|
|
|
48
52
|
import { resolveFirstPromptHandover, transcriptCarriesFirstPrompt, } from './first-prompt-handover.js';
|
|
49
53
|
import { CompactModal } from '../header/compact-modal.js';
|
|
50
54
|
import { SessionSiteHeader } from '../header/session-site-header.js';
|
|
51
|
-
import { VoiceCallSlot } from '../voice/voice-call.js';
|
|
52
55
|
import { claimFirstTurnRow } from '../composer/inbox-row-claims.js';
|
|
53
56
|
import { OptimisticTurn } from './optimistic-turn.js';
|
|
54
57
|
import { inboxHoldsLivePrompt } from '../composer/inbox-live-prompt.js';
|
|
55
58
|
import { SessionOutcomesProvider } from '../outcomes/session-outcomes-provider.js';
|
|
59
|
+
import { deleteMessageLinkParams, readMessageLinkParams, resolveMessageLinkTurn } from '../../internal/lib/navigation/message-link.js';
|
|
60
|
+
/** How long a message link waits for the transcript's turns to mount before it jumps anyway. */
|
|
61
|
+
const MESSAGE_LINK_MOUNT_WAIT_MS = 8_000;
|
|
56
62
|
import { SessionOverridesComposer } from '../overrides/session-overrides-composer.js';
|
|
63
|
+
import { inheritedModelFor } from '../composer/chat-input/chat-input-summary.js';
|
|
57
64
|
import { QuestionPrompt, } from '../prompts/question-prompt.js';
|
|
58
65
|
import { SESSION_TRANSCRIPT_CLASS, SessionBodyRow } from './session-body.js';
|
|
59
66
|
import { SessionContextModal } from './session-context-modal.js';
|
|
@@ -74,6 +81,7 @@ import { ChatMinimap } from './chat-minimap.js';
|
|
|
74
81
|
import { usePlanInChat } from './plan-surface.js';
|
|
75
82
|
import { SessionStartingLoader } from '../status/session-starting-loader.js';
|
|
76
83
|
import { ToolActivateContext } from '../tool/tool-renderers.js';
|
|
84
|
+
import { AgentActivateContext } from '../tool/shared/infrastructure-contexts.js';
|
|
77
85
|
import { ReadOnlySessionContext } from '../tool/shared/infrastructure-contexts.js';
|
|
78
86
|
import { firstPromptAttachments, retainSentAttachmentPreviews, sentAttachmentsForTurn, } from '../composer/sent-attachment-previews.js';
|
|
79
87
|
import { buildOptimisticPromptTextWithUploads, promptFileParts, sentAttachmentsOf, } from '../composer/uploaded-file-refs.js';
|
|
@@ -95,7 +103,7 @@ import { getRetryInfo } from '../../internal/session-types/index.js';
|
|
|
95
103
|
import { useModelPricingLookup } from '../../internal/lib/model-pricing.js';
|
|
96
104
|
import { isAbortError, latestPromptModel, SESSION_NOTICE, turnEndNotice } from '@kortix/sdk';
|
|
97
105
|
import { failureShownByTurn, failureSupersededByTurn, persistedFailureText, } from './persisted-turn-failure.js';
|
|
98
|
-
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';
|
|
106
|
+
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';
|
|
99
107
|
import { useStableCallback } from '../../internal/hooks/use-stable-callback.js';
|
|
100
108
|
import { useReloadForensics } from '../status/reload-forensics.js';
|
|
101
109
|
import { resolveLastTurnWorking, serverHoldsOpenTurn, sessionComposerReadiness, } from '../composer/session-composer-readiness.js';
|
|
@@ -186,10 +194,11 @@ function hostNotice(notice, notices) {
|
|
|
186
194
|
const key = Object.keys(SESSION_NOTICE).find((candidate) => SESSION_NOTICE[candidate] === notice);
|
|
187
195
|
return (key && notices[key]) || notice;
|
|
188
196
|
}
|
|
189
|
-
export function SessionChat({ sessionId, projectSessionId, sessionState, projectId, boundAgentName, headerLeadingAction, hideHeader, readOnly, composerPlaceholder, inputReplacement, initialScrollTop, savedHistoryScope, onContentReady, deferComposerFocus, hostQuote, }) {
|
|
197
|
+
export function SessionChat({ sessionId, projectSessionId, sessionState, projectId, boundAgentName, headerLeadingAction, hideHeader, transparent = false, readOnly, composerPlaceholder, inputReplacement, initialScrollTop, savedHistoryScope, onContentReady, deferComposerFocus, hostQuote, }) {
|
|
190
198
|
const tHardcodedUi = useTranslations('hardcodedUi');
|
|
191
199
|
// A channel's thread panel: turns are message rows, full width, end-anchored.
|
|
192
200
|
const rowsContext = useContext(TranscriptRowsContext);
|
|
201
|
+
const composerAutoFocus = useContext(ComposerAutoFocusContext);
|
|
193
202
|
const transcriptRows = rowsContext !== null;
|
|
194
203
|
const isMobile = useIsMobile();
|
|
195
204
|
const isPhone = useIsPhone();
|
|
@@ -229,6 +238,17 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
229
238
|
track('panel_opened', { source: 'chat_tool' });
|
|
230
239
|
}, [sessionId, setSidePanelView, focusToolCall]);
|
|
231
240
|
const toolActivate = readOnly || disableToolNavigation ? null : handleToolActivate;
|
|
241
|
+
// Clicking an agent (a sub-agent row, its finish notice, a workflow agent, the
|
|
242
|
+
// agents line) opens that agent's session in the side panel, beside the chat.
|
|
243
|
+
const focusAgent = useKortixComputerStore((s) => s.focusAgent);
|
|
244
|
+
const handleAgentActivate = useCallback((agent) => {
|
|
245
|
+
const wasOpen = useKortixComputerStore.getState().isSidePanelOpen;
|
|
246
|
+
setSidePanelView(sessionId, 'actions');
|
|
247
|
+
focusAgent(agent);
|
|
248
|
+
if (!wasOpen)
|
|
249
|
+
track('panel_opened', { source: 'chat_agent' });
|
|
250
|
+
}, [sessionId, setSidePanelView, focusAgent]);
|
|
251
|
+
const agentActivate = readOnly || disableToolNavigation ? null : handleAgentActivate;
|
|
232
252
|
// ---- Context modal ----
|
|
233
253
|
const [contextModalOpen, setContextModalOpen] = useState(false);
|
|
234
254
|
// The composer's `/compact` row opens this instance; the header keeps its
|
|
@@ -519,9 +539,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
519
539
|
*/
|
|
520
540
|
const issueSessionCancel = useCallback(() => {
|
|
521
541
|
// The stop's own receipt, taken before the cancel goes out and settled
|
|
522
|
-
// when it is acknowledged. `
|
|
523
|
-
//
|
|
524
|
-
// back still shows the turn, because the cancel needs ~1.6s to reach the
|
|
542
|
+
// when it is acknowledged. A `/turn` read issued inside the abort round
|
|
543
|
+
// trip still shows the turn, because the cancel needs ~1.6s to reach the
|
|
525
544
|
// daemon. Without this the composer flipped Send back to Stop ~120ms after
|
|
526
545
|
// the click and stayed there for the whole abort. See `AbortReceipt`.
|
|
527
546
|
useSessionWorkingStore.getState().noteAbortReceipt(projectSessionId ?? '', Date.now());
|
|
@@ -551,7 +570,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
551
570
|
const { data: projectSpaces } = useProjectSpaces(projectId, {
|
|
552
571
|
enabled: !!projectId && !!projectSessionRow?.space_id,
|
|
553
572
|
});
|
|
554
|
-
const threadChannelAgents = useMemo(() => channelRunnableAgents(projectSpaces?.find((space) => space.space_id === projectSessionRow?.space_id), projectConfig?.default_agent
|
|
573
|
+
const threadChannelAgents = useMemo(() => channelRunnableAgents(projectSpaces?.find((space) => space.space_id === projectSessionRow?.space_id), projectConfig?.default_agent), [projectSpaces, projectSessionRow?.space_id, projectConfig?.default_agent]);
|
|
555
574
|
const agents = useMemo(() => withChannelAgents(rosterAgents, threadChannelAgents), [rosterAgents, threadChannelAgents]);
|
|
556
575
|
// Edit-and-rewind only on the viewer's own message with nobody else's after it.
|
|
557
576
|
const rewindable = useMemo(() => rewindableMessageIds(userMessageIds, transcriptAuthors.byMessage, viewerId, projectSessionRow?.created_by), [userMessageIds, transcriptAuthors.byMessage, viewerId, projectSessionRow?.created_by]);
|
|
@@ -565,7 +584,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
565
584
|
config,
|
|
566
585
|
sessionId,
|
|
567
586
|
boundAgentName,
|
|
568
|
-
defaultAgentName: projectConfig?.default_agent
|
|
587
|
+
defaultAgentName: projectConfig?.default_agent,
|
|
569
588
|
projectSession: projectSessionRow,
|
|
570
589
|
lastPromptModel: latestPromptModel(messages),
|
|
571
590
|
});
|
|
@@ -581,7 +600,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
581
600
|
const composerAgent = resolveComposerAgent({
|
|
582
601
|
agents,
|
|
583
602
|
boundAgent: boundAgentName,
|
|
584
|
-
defaultAgent: projectConfig?.default_agent
|
|
603
|
+
defaultAgent: projectConfig?.default_agent,
|
|
585
604
|
selectedAgent: local.agent.current?.name ?? null,
|
|
586
605
|
});
|
|
587
606
|
const composerAgentName = composerAgent.selected;
|
|
@@ -770,7 +789,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
770
789
|
// every other session of the same agent, and was skipped whenever the
|
|
771
790
|
// account had a default model.
|
|
772
791
|
// A NEW user bubble in the transcript is a queue row that just landed —
|
|
773
|
-
//
|
|
792
|
+
// the runtime persisted a forwarded prompt. Re-read the inbox NOW so the row
|
|
774
793
|
// leaves the strip in the same beat its bubble appears, instead of on the
|
|
775
794
|
// next poll: the two were visible together for up to a poll interval.
|
|
776
795
|
const newestUserBubbleId = lastUserMessage?.message_id;
|
|
@@ -822,7 +841,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
822
841
|
// and send" — a send queues behind the turn.
|
|
823
842
|
const canStop = sessionState?.canStop ?? true;
|
|
824
843
|
// The one transcript-derived gate that survives, and the only one that
|
|
825
|
-
// carries proof: during a provider 429
|
|
844
|
+
// carries proof: during a provider 429 the runtime stamps `info.error` with
|
|
826
845
|
// `data.isRetryable === true` and keeps writing the SAME assistant message,
|
|
827
846
|
// while the status frame this tab holds can read non-busy for all of it. The
|
|
828
847
|
// projection cannot substitute — a frame stamped after the last `/turn` read
|
|
@@ -860,18 +879,30 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
860
879
|
// Short visual fade (300ms) — matches the reference's 260ms delay-hide.
|
|
861
880
|
// Goes true immediately, stays visible briefly after going idle so the
|
|
862
881
|
// UI doesn't flicker between agentic steps. NOT a 2s debounce.
|
|
863
|
-
const [
|
|
882
|
+
const [debouncedBusy, setDebouncedBusy] = useState(effectiveBusy);
|
|
864
883
|
const busyTimerRef = useRef(undefined);
|
|
865
884
|
useEffect(() => {
|
|
866
885
|
if (effectiveBusy) {
|
|
867
886
|
clearTimeout(busyTimerRef.current);
|
|
868
|
-
|
|
887
|
+
setDebouncedBusy(true);
|
|
869
888
|
}
|
|
870
889
|
else {
|
|
871
|
-
busyTimerRef.current = setTimeout(() =>
|
|
890
|
+
busyTimerRef.current = setTimeout(() => setDebouncedBusy(false), 300);
|
|
872
891
|
}
|
|
873
892
|
return () => clearTimeout(busyTimerRef.current);
|
|
874
893
|
}, [effectiveBusy]);
|
|
894
|
+
// A Stop the server refused, or never confirmed (`timed-out`, `failed`).
|
|
895
|
+
// The abort receipt can hold `effectiveBusy` false for up to
|
|
896
|
+
// OPTIMISTIC_ABORT_MAX_MS while the turn runs, and Stop and Esc×3 are gated
|
|
897
|
+
// on `isBusy`. So the Stop control stays while the server still reports an
|
|
898
|
+
// open turn (`serverOpenTurnToken`), and clears when it reports none.
|
|
899
|
+
const [stopUnconfirmed, setStopUnconfirmed] = useState(false);
|
|
900
|
+
const serverHoldsTurn = working.serverOpenTurnToken !== null;
|
|
901
|
+
useEffect(() => {
|
|
902
|
+
if (stopUnconfirmed && !serverHoldsTurn)
|
|
903
|
+
setStopUnconfirmed(false);
|
|
904
|
+
}, [stopUnconfirmed, serverHoldsTurn]);
|
|
905
|
+
const isBusy = debouncedBusy || (stopUnconfirmed && serverHoldsTurn);
|
|
875
906
|
// Read by `handleSend` for its ANCHORING decision only (a send into a running
|
|
876
907
|
// turn must not yank the viewport). Refs, not the values: `handleSend` is a stable callback
|
|
877
908
|
// that a dozen surfaces hold, and adding busy state to its deps would rebuild
|
|
@@ -1147,7 +1178,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1147
1178
|
undoLabel: tHardcodedUi.raw('i18nComplete.texta737e54996f8'),
|
|
1148
1179
|
// The SAME `clientMessageId`, so an undo re-creates ONE row and a
|
|
1149
1180
|
// double-click cannot create two. A FRESH wire id, because
|
|
1150
|
-
//
|
|
1181
|
+
// the runtime orders by id and the original one was minted before the
|
|
1151
1182
|
// turn that has been writing higher ids since. The parts and
|
|
1152
1183
|
// overrides are the ORIGINALS, straight from the delete's own
|
|
1153
1184
|
// response — see `createQueueUndoAction`.
|
|
@@ -1363,8 +1394,30 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1363
1394
|
// ---- Pending permissions & questions ----
|
|
1364
1395
|
const allPermissions = useRuntimePendingStore((s) => s.permissions);
|
|
1365
1396
|
const allQuestions = useRuntimePendingStore((s) => s.questions);
|
|
1366
|
-
const
|
|
1397
|
+
const livePermissions = useMemo(() => sessionState?.permissions ??
|
|
1367
1398
|
Object.values(allPermissions).filter((p) => p.sessionID === sessionId), [sessionState?.permissions, allPermissions, sessionId]);
|
|
1399
|
+
// Asks that parked: nobody answered live, the agent went on, and the ask
|
|
1400
|
+
// waits server-side (Review, "Needs you"). They render with the same cards
|
|
1401
|
+
// and are decided through the asks API, which resumes the session that
|
|
1402
|
+
// asked (a hidden worker's asks show here too). Live asks keep their cards.
|
|
1403
|
+
const parkedAsks = useSessionNeedsYou(projectId ?? '', projectSessionId ?? '', {
|
|
1404
|
+
enabled: Boolean(projectId && projectSessionId),
|
|
1405
|
+
}).asks;
|
|
1406
|
+
const parkedAskIdByRequest = useMemo(() => new Map(parkedAsks.filter((ask) => ask.kind !== 'approval').map((ask) => [ask.request_id, ask.id])), [parkedAsks]);
|
|
1407
|
+
const pendingPermissions = useMemo(() => {
|
|
1408
|
+
const live = new Set(livePermissions.map((p) => p.id));
|
|
1409
|
+
const parked = parkedAsks
|
|
1410
|
+
.filter((ask) => ask.kind === 'permission' && ask.permission && !live.has(ask.request_id))
|
|
1411
|
+
.map((ask) => ({
|
|
1412
|
+
id: ask.request_id,
|
|
1413
|
+
sessionID: sessionId,
|
|
1414
|
+
permission: ask.permission.permission,
|
|
1415
|
+
patterns: ask.permission.patterns,
|
|
1416
|
+
metadata: ask.permission.args && typeof ask.permission.args === 'object' ? ask.permission.args : {},
|
|
1417
|
+
always: ['*'],
|
|
1418
|
+
}));
|
|
1419
|
+
return parked.length ? [...livePermissions, ...parked] : livePermissions;
|
|
1420
|
+
}, [livePermissions, parkedAsks, sessionId]);
|
|
1368
1421
|
const suppressedQuestionIdsRef = useRef(new Map());
|
|
1369
1422
|
const suppressQuestionFor = useCallback((requestId, ms = 15000) => {
|
|
1370
1423
|
suppressedQuestionIdsRef.current.set(requestId, Date.now() + ms);
|
|
@@ -1379,12 +1432,19 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1379
1432
|
}
|
|
1380
1433
|
return true;
|
|
1381
1434
|
}, []);
|
|
1382
|
-
const
|
|
1435
|
+
const liveQuestions = useMemo(() => (sessionState?.questions ??
|
|
1383
1436
|
Object.values(allQuestions).filter((q) => q.sessionID === sessionId)).filter((q) => !isQuestionSuppressed(q.id)), [sessionState?.questions, allQuestions, sessionId, isQuestionSuppressed]);
|
|
1437
|
+
const pendingQuestions = useMemo(() => {
|
|
1438
|
+
const live = new Set(liveQuestions.map((q) => q.id));
|
|
1439
|
+
const parked = parkedAsks
|
|
1440
|
+
.filter((ask) => ask.kind === 'question' && ask.question && !live.has(ask.request_id) && !isQuestionSuppressed(ask.request_id))
|
|
1441
|
+
.map((ask) => ({ id: ask.request_id, sessionID: sessionId, questions: ask.question.questions }));
|
|
1442
|
+
return parked.length ? [...liveQuestions, ...parked] : liveQuestions;
|
|
1443
|
+
}, [liveQuestions, parkedAsks, sessionId, isQuestionSuppressed]);
|
|
1384
1444
|
/**
|
|
1385
1445
|
* The runtime is parked on an answer only the user can give.
|
|
1386
1446
|
*
|
|
1387
|
-
* Both lists are already session-scoped above. Either one means
|
|
1447
|
+
* Both lists are already session-scoped above. Either one means the runtime has
|
|
1388
1448
|
* stopped inside the turn and is blocked on a reply — the `question` tool, or
|
|
1389
1449
|
* a tool asking for permission — so the turn row stays `active` and every
|
|
1390
1450
|
* observer keeps reporting `working` with nothing to bound it but the reader.
|
|
@@ -1396,7 +1456,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1396
1456
|
* come back the instant the agent is running again, not a third of a second
|
|
1397
1457
|
* later.
|
|
1398
1458
|
*/
|
|
1399
|
-
|
|
1459
|
+
// Live asks only: a parked ask no longer holds the turn.
|
|
1460
|
+
const awaitingUserInput = liveQuestions.length > 0 || livePermissions.length > 0;
|
|
1400
1461
|
const QUESTION_PROMPT_ANIMATION_MS = 320;
|
|
1401
1462
|
const activePendingQuestion = pendingQuestions[0] ?? null;
|
|
1402
1463
|
// A new question docks over the bottom of the transcript, and answering it
|
|
@@ -1954,7 +2015,15 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1954
2015
|
// ---- Permission/question reply handlers ----
|
|
1955
2016
|
const removePermission = useRuntimePendingStore((s) => s.removePermission);
|
|
1956
2017
|
const removeQuestion = useRuntimePendingStore((s) => s.removeQuestion);
|
|
2018
|
+
const answerParkedAsk = useAnswerSessionAsk(projectId ?? '');
|
|
1957
2019
|
const handlePermissionReply = useCallback(async (requestId, reply) => {
|
|
2020
|
+
// A parked ask: the call no longer waits, so the decision goes through
|
|
2021
|
+
// the asks API (it reaches the agent as a message).
|
|
2022
|
+
const parkedAskId = livePermissions.some((p) => p.id === requestId) ? undefined : parkedAskIdByRequest.get(requestId);
|
|
2023
|
+
if (parkedAskId) {
|
|
2024
|
+
await answerParkedAsk.mutateAsync({ askId: parkedAskId, answer: { reply } });
|
|
2025
|
+
return;
|
|
2026
|
+
}
|
|
1958
2027
|
// No optimistic remove: only drop the card once the runtime accepted the
|
|
1959
2028
|
// reply — a failed reply must stay answerable. Rethrow so callers
|
|
1960
2029
|
// (prompt buttons) reset their busy state and surface the error.
|
|
@@ -1965,7 +2034,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1965
2034
|
await replyToPermission(requestId, reply);
|
|
1966
2035
|
removePermission(requestId);
|
|
1967
2036
|
}
|
|
1968
|
-
}, [sessionState, removePermission]);
|
|
2037
|
+
}, [sessionState, removePermission, livePermissions, parkedAskIdByRequest, answerParkedAsk]);
|
|
1969
2038
|
const handleQuestionReply = useCallback(async (requestId, answers) => {
|
|
1970
2039
|
// Snapshot the question BEFORE removing it so we can cache the
|
|
1971
2040
|
// answer against the tool part's ID.
|
|
@@ -1974,6 +2043,12 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
1974
2043
|
suppressQuestionFor(requestId);
|
|
1975
2044
|
// Optimistically remove the question so the textarea shows immediately
|
|
1976
2045
|
removeQuestion(requestId);
|
|
2046
|
+
const parkedAskId = liveQuestions.some((q) => q.id === requestId) ? undefined : parkedAskIdByRequest.get(requestId);
|
|
2047
|
+
if (parkedAskId) {
|
|
2048
|
+
// Parked: the answer reaches the agent as a message that quotes the question.
|
|
2049
|
+
answerParkedAsk.mutate({ askId: parkedAskId, answer: { answers } });
|
|
2050
|
+
return;
|
|
2051
|
+
}
|
|
1977
2052
|
// Save the answers in the optimistic cache keyed by the question call's
|
|
1978
2053
|
// block id. This cache survives updates that may overwrite the call
|
|
1979
2054
|
// before the server includes its answers; the transcript's answered
|
|
@@ -2000,11 +2075,17 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2000
2075
|
catch {
|
|
2001
2076
|
// ignore — SSE "question.replied" event will also remove it
|
|
2002
2077
|
}
|
|
2003
|
-
}, [sessionState, removeQuestion, suppressQuestionFor]);
|
|
2078
|
+
}, [sessionState, removeQuestion, suppressQuestionFor, liveQuestions, parkedAskIdByRequest, answerParkedAsk]);
|
|
2004
2079
|
const handleQuestionReject = useCallback(async (requestId) => {
|
|
2005
2080
|
suppressQuestionFor(requestId);
|
|
2006
2081
|
// Optimistically remove the question so the textarea shows immediately
|
|
2007
2082
|
removeQuestion(requestId);
|
|
2083
|
+
const parkedAskId = liveQuestions.some((q) => q.id === requestId) ? undefined : parkedAskIdByRequest.get(requestId);
|
|
2084
|
+
if (parkedAskId) {
|
|
2085
|
+
// Dismissing a parked question closes it; nothing runs, so nothing is stopped.
|
|
2086
|
+
answerParkedAsk.mutate({ askId: parkedAskId, answer: { dismiss: true } });
|
|
2087
|
+
return;
|
|
2088
|
+
}
|
|
2008
2089
|
try {
|
|
2009
2090
|
if (sessionState)
|
|
2010
2091
|
await sessionState.rejectQuestion(requestId);
|
|
@@ -2067,7 +2148,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2067
2148
|
useEffect(() => {
|
|
2068
2149
|
outcomeJumpRef.current = { sessionId, hasOlder, isLoadingOlder, loadOlder };
|
|
2069
2150
|
}, [sessionId, hasOlder, isLoadingOlder, loadOlder]);
|
|
2070
|
-
|
|
2151
|
+
// `quiet`: a jump the reader did not click (a `?m=` link) fails silently, without the change-request toasts.
|
|
2152
|
+
const handleJumpToOutcome = useCallback(async (resolveTurn, createdAt, quiet = false) => {
|
|
2071
2153
|
if (jumpingToOutcome)
|
|
2072
2154
|
return;
|
|
2073
2155
|
setJumpingToOutcome(true);
|
|
@@ -2084,9 +2166,12 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2084
2166
|
settle,
|
|
2085
2167
|
},
|
|
2086
2168
|
resolve: () => outcomeJumpRef.current.sessionId === currentSession ? resolveTurn() : undefined,
|
|
2087
|
-
loadError: () =>
|
|
2169
|
+
loadError: () => {
|
|
2170
|
+
if (!quiet)
|
|
2171
|
+
errorToast(tChangeRequests('loadError'));
|
|
2172
|
+
},
|
|
2088
2173
|
unavailable: () => {
|
|
2089
|
-
if (outcomeJumpRef.current.sessionId === currentSession)
|
|
2174
|
+
if (!quiet && outcomeJumpRef.current.sessionId === currentSession)
|
|
2090
2175
|
errorToast(tChangeRequests('unavailable'));
|
|
2091
2176
|
},
|
|
2092
2177
|
scroll: async (key) => {
|
|
@@ -2116,7 +2201,8 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2116
2201
|
});
|
|
2117
2202
|
}
|
|
2118
2203
|
catch {
|
|
2119
|
-
|
|
2204
|
+
if (!quiet)
|
|
2205
|
+
errorToast(tChangeRequests('loadError'));
|
|
2120
2206
|
}
|
|
2121
2207
|
finally {
|
|
2122
2208
|
setJumpingToOutcome(false);
|
|
@@ -2130,7 +2216,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2130
2216
|
// ============================================================================
|
|
2131
2217
|
// Billing: DISABLED — billing is handled server-side by the LLM gateway
|
|
2132
2218
|
// (it deducts credits per LLM call).
|
|
2133
|
-
// This frontend useEffect was causing double-billing once
|
|
2219
|
+
// This frontend useEffect was causing double-billing once the runtime config
|
|
2134
2220
|
// got cost config and step-finish.cost became non-zero.
|
|
2135
2221
|
// ============================================================================
|
|
2136
2222
|
// No composer-draft side effect any more: the old flow prefilled the
|
|
@@ -2454,13 +2540,13 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2454
2540
|
// actual response body still arrives via the sync store.
|
|
2455
2541
|
//
|
|
2456
2542
|
// Don't send part IDs. `ascendingId` encodes the HIGH bits of the id
|
|
2457
|
-
// clock where
|
|
2543
|
+
// clock where the wire id encodes the LOW 48 (see the warning on it in the
|
|
2458
2544
|
// SDK), so a client id of that shape sorts before EVERY server id: the
|
|
2459
2545
|
// server's "has this prompt already been answered?" ordering check reads
|
|
2460
2546
|
// a stale assistant reply as the answer and the turn never runs.
|
|
2461
2547
|
//
|
|
2462
2548
|
// The `messageID` is a different matter and IS sent — by the SDK, not
|
|
2463
|
-
// from here. `
|
|
2549
|
+
// from here. `promptRuntimeMessage` mints it in the Kortix message id
|
|
2464
2550
|
// format and places it above everything already in this session's
|
|
2465
2551
|
// transcript, which is what makes it safe; without one, two identical
|
|
2466
2552
|
// prompts inside 60s hash to a single proxy delivery and the second is
|
|
@@ -2505,7 +2591,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2505
2591
|
const selectedModel = sendOpts?.model ? sendOpts.model : null;
|
|
2506
2592
|
// THE ONE SEND PATH: the server-side prompt inbox.
|
|
2507
2593
|
//
|
|
2508
|
-
// This used to POST straight into the sandbox's
|
|
2594
|
+
// This used to POST straight into the sandbox's runtime server, and
|
|
2509
2595
|
// anything the user typed while the agent was busy went into a browser
|
|
2510
2596
|
// queue instead — which meant a closed tab, a second device, or a crash
|
|
2511
2597
|
// lost it silently, and two tabs on one session disagreed about what was
|
|
@@ -2515,7 +2601,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2515
2601
|
// guess whether a turn is in flight.
|
|
2516
2602
|
//
|
|
2517
2603
|
// The WIRE id is minted here, by the SDK, and never by the control plane:
|
|
2518
|
-
//
|
|
2604
|
+
// The runtime resolves "has this prompt already been answered?" by id ORDER,
|
|
2519
2605
|
// and only this process holds the transcript to place one against. It is
|
|
2520
2606
|
// `messageID` above. `clientMessageId` is only the inbox idempotency key.
|
|
2521
2607
|
// The prompt is out of this tab's hands the moment the row lands, so the
|
|
@@ -2537,9 +2623,9 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2537
2623
|
// the two, and the server orders racing sends by THIS.
|
|
2538
2624
|
clientSentAtMs: sentAtMs,
|
|
2539
2625
|
overrides: {
|
|
2540
|
-
// Pass the session's directory so
|
|
2541
|
-
// agents
|
|
2542
|
-
//
|
|
2626
|
+
// Pass the session's directory so the runtime resolves project-scoped
|
|
2627
|
+
// agents and applies them when the user picked a project agent
|
|
2628
|
+
// from the picker.
|
|
2543
2629
|
...(session?.directory ? { directory: session.directory } : {}),
|
|
2544
2630
|
...(selectedAgent ? { agent: selectedAgent } : {}),
|
|
2545
2631
|
...(selectedModel ? { model: formatPromptModel(selectedModel) } : {}),
|
|
@@ -2573,7 +2659,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2573
2659
|
if (keepsPainted)
|
|
2574
2660
|
return { ok: false, cause, error: null };
|
|
2575
2661
|
// Ask the INBOX, not the runtime. This prompt's home is a durable
|
|
2576
|
-
// control-plane row;
|
|
2662
|
+
// control-plane row; the runtime's transcript cannot see it until the
|
|
2577
2663
|
// admission gate delivers it, so a rehydrate always reports it
|
|
2578
2664
|
// missing and the recovery used to delete the bubble on that answer —
|
|
2579
2665
|
// while the row was already running. Reported from a live self-host:
|
|
@@ -2663,7 +2749,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2663
2749
|
// "Changes" side panel's "Ask agent to open a change request" button) can
|
|
2664
2750
|
// drive the agent through the SAME robust path the input uses — optimistic
|
|
2665
2751
|
// message, SSE wiring, error propagation — instead of copying a prompt to the
|
|
2666
|
-
// clipboard. Keyed by the
|
|
2752
|
+
// clipboard. Keyed by the runtime chat session id (`sessionId`).
|
|
2667
2753
|
const registerSender = useChatSendStore((s) => s.registerSender);
|
|
2668
2754
|
const unregisterSender = useChatSendStore((s) => s.unregisterSender);
|
|
2669
2755
|
useEffect(() => {
|
|
@@ -2774,82 +2860,59 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
2774
2860
|
setEditSendPending(false);
|
|
2775
2861
|
}
|
|
2776
2862
|
}, [sessionState, promptInbox.prompts, promptInbox.remove, handleSend, tHardcodedUi]);
|
|
2863
|
+
// One Stop = one inbox hold + one abort. `runStopSequence` (stop-sequence.ts)
|
|
2864
|
+
// owns the order: with `sessionState` the SDK's `cancel()` holds the inbox
|
|
2865
|
+
// and aborts; without it the host holds, then aborts. `stopLatch` is the
|
|
2866
|
+
// synchronous double-Stop guard: a click, then Esc×3, then a click sends one
|
|
2867
|
+
// stop, not three. It stays closed until the abort settles.
|
|
2868
|
+
const [stopLatch] = useState(createStopLatch);
|
|
2777
2869
|
const handleStop = useCallback(async () => {
|
|
2778
|
-
|
|
2779
|
-
if (abortSession.isPending) {
|
|
2780
|
-
console.log(`[handleStop] Ignoring - abort already in flight for session ${sessionId}`);
|
|
2870
|
+
if (stopLatch.inFlight)
|
|
2781
2871
|
return;
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
// does not own or manage the session. The abort would be refused for
|
|
2825
|
-
// the same reason, so none goes out; the run goes on.
|
|
2826
|
-
refusal = stopRefusalMessage(error);
|
|
2827
|
-
if (refusal)
|
|
2828
|
-
return;
|
|
2829
|
-
// Caught, never rethrown: a failed hold must not also cost the user
|
|
2830
|
-
// their abort. The cost of that path is the one this ordering removes —
|
|
2831
|
-
// a stopped prompt can still come back a reaper pass later.
|
|
2832
|
-
//
|
|
2833
|
-
// SURFACED, not swallowed. A failed hold means the queue is NOT paused,
|
|
2834
|
-
// so a prompt the user pressed Stop to get ahead of can still be
|
|
2835
|
-
// delivered a reaper pass later — silently. The user has to know the
|
|
2836
|
-
// stop did not also pause the queue, and that pressing Stop again (or
|
|
2837
|
-
// Resume/Send-now) is how they recover.
|
|
2838
|
-
console.warn('[session-chat] failed to hold the prompt inbox on stop', error);
|
|
2839
|
-
errorToast(tHardcodedUi.raw('i18nComplete.text57a524b52549'), {
|
|
2840
|
-
description: tHardcodedUi.raw('i18nComplete.text45eca4a01ff2'),
|
|
2841
|
-
});
|
|
2842
|
-
}),
|
|
2843
|
-
new Promise((resolve) => setTimeout(resolve, STOP_HOLD_DEADLINE_MS)),
|
|
2844
|
-
]);
|
|
2845
|
-
if (refusal) {
|
|
2846
|
-
errorToast(refusal);
|
|
2847
|
-
setIsBusy(isBusyRef.current);
|
|
2848
|
-
return;
|
|
2849
|
-
}
|
|
2850
|
-
issueSessionCancel();
|
|
2872
|
+
await stopLatch.run(async () => {
|
|
2873
|
+
// Stop means stop: a held command would otherwise start a new turn the
|
|
2874
|
+
// moment this one ends.
|
|
2875
|
+
setHeldCommands([]);
|
|
2876
|
+
// The composer reads idle at once; `stopUnconfirmed` brings Stop back
|
|
2877
|
+
// if the server never confirms the abort.
|
|
2878
|
+
clearTimeout(busyTimerRef.current);
|
|
2879
|
+
setDebouncedBusy(false);
|
|
2880
|
+
setStopUnconfirmed(false);
|
|
2881
|
+
// Why the hold goes out before the abort, and why it is bounded: a
|
|
2882
|
+
// prompt admitted mid-turn is already on the wire, the abort drops the
|
|
2883
|
+
// runtime's queue, and the reaper redelivers it unless the hold marked
|
|
2884
|
+
// it stop-paused first. A stalled hold must not delay the abort by more
|
|
2885
|
+
// than STOP_HOLD_DEADLINE_MS.
|
|
2886
|
+
const outcome = await runStopSequence({
|
|
2887
|
+
...(sessionState ? { sdkCancel: issueSessionCancel } : {}),
|
|
2888
|
+
holdInbox: () => promptInbox.hold(true),
|
|
2889
|
+
fallbackCancel: issueSessionCancel,
|
|
2890
|
+
paintOptimisticAbort: () => {
|
|
2891
|
+
// "Interrupted" on the newest assistant message, before the
|
|
2892
|
+
// round trip. The SDK path paints it inside `cancel()`.
|
|
2893
|
+
applyOptimisticAbort(sessionId);
|
|
2894
|
+
clearSendReceipt();
|
|
2895
|
+
},
|
|
2896
|
+
refusalOf: stopRefusalMessage,
|
|
2897
|
+
onHoldFailed: (error) => {
|
|
2898
|
+
// The queue is NOT paused: a prompt the user stopped to get ahead
|
|
2899
|
+
// of can still go out. Say so; Stop again or Resume recovers.
|
|
2900
|
+
console.warn('[session-chat] failed to hold the prompt inbox on stop', error);
|
|
2901
|
+
errorToast(tHardcodedUi.raw('i18nComplete.text57a524b52549'), {
|
|
2902
|
+
description: tHardcodedUi.raw('i18nComplete.text45eca4a01ff2'),
|
|
2903
|
+
});
|
|
2904
|
+
},
|
|
2905
|
+
holdDeadlineMs: STOP_HOLD_DEADLINE_MS,
|
|
2906
|
+
});
|
|
2907
|
+
if (outcome.kind === 'refused')
|
|
2908
|
+
errorToast(outcome.message);
|
|
2909
|
+
// A refused, failed or timed-out stop leaves the turn running: keep
|
|
2910
|
+
// Stop and Esc×3 on screen while the server still holds the turn.
|
|
2911
|
+
if (stopLeftTurnRunning(outcome))
|
|
2912
|
+
setStopUnconfirmed(true);
|
|
2913
|
+
});
|
|
2851
2914
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2852
|
-
}, [sessionId,
|
|
2915
|
+
}, [sessionId, sessionState, stopLatch, issueSessionCancel, promptInbox.hold]);
|
|
2853
2916
|
// Release the Stop hold for the WHOLE queue at once. `hold(false)` un-pauses
|
|
2854
2917
|
// every held row on the server (shared across tabs), and the hook clears the
|
|
2855
2918
|
// paused state on the click (`releaseHeldPrompts`). `resumePending` disables
|
|
@@ -3045,7 +3108,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3045
3108
|
const handleCommandError = (err) => {
|
|
3046
3109
|
// A command that was DELIVERED and then lost its connection is not a
|
|
3047
3110
|
// failed command. `/command` blocks for the whole turn, so both proxy
|
|
3048
|
-
// hops routinely stop waiting while
|
|
3111
|
+
// hops routinely stop waiting while the runtime is still working — and the
|
|
3049
3112
|
// request was already on the wire when they did. Clearing the session
|
|
3050
3113
|
// to `idle` and painting an error here told the user their message had
|
|
3051
3114
|
// not sent while the agent was actively answering it, and invited the
|
|
@@ -3231,7 +3294,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3231
3294
|
/**
|
|
3232
3295
|
* Where this session's unsent draft is persisted.
|
|
3233
3296
|
*
|
|
3234
|
-
* `projectSessionId` — the KORTIX session id — not the
|
|
3297
|
+
* `projectSessionId` — the KORTIX session id — not the runtime `sessionId`:
|
|
3235
3298
|
* it is the id the boot shell also keys on, so a draft typed in the instant
|
|
3236
3299
|
* shell is still there after the crossfade into this component, and it is
|
|
3237
3300
|
* the same id every other per-session handoff store uses
|
|
@@ -3319,10 +3382,14 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3319
3382
|
// (Claude Code's agent panel). It reads its own lists and never holds the composer.
|
|
3320
3383
|
const agentsLineCompact = !!transcriptRows && !isPhone;
|
|
3321
3384
|
const chatUnderbarSlot = useMemo(() => _jsx(AgentsLine, { projectId: projectId, sessionId: projectSessionId, compact: agentsLineCompact }), [projectId, projectSessionId, agentsLineCompact]);
|
|
3385
|
+
// A space's thread lists only the queue's live messages in its card: failed
|
|
3386
|
+
// ones and a Stop hold read as calm lines (`ChatQueueLines`), reports wait behind Resume.
|
|
3387
|
+
const calmRest = useMemo(() => [...queueRows.rows, ...heldCommandRows(heldCommands)].filter((row) => row.state !== 'failed' && !row.synthetic), [queueRows.rows, heldCommands]);
|
|
3322
3388
|
// The queued messages and the one Resume while a Stop holds the queue: their
|
|
3323
|
-
// own full-width card above the composer stack, not inside the strip.
|
|
3324
|
-
|
|
3325
|
-
|
|
3389
|
+
// own full-width card above the composer stack, not inside the strip.
|
|
3390
|
+
const chatAboveSlot = useMemo(() => (_jsx(_Fragment, { children: rowsContext?.messagesOnly ? (
|
|
3391
|
+
// A space's thread: calm lines ("Not sent · Retry", "Stopped · Resume"), the card only for queued messages.
|
|
3392
|
+
_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) => {
|
|
3326
3393
|
queueEdit.takeBack(id);
|
|
3327
3394
|
}, onRemove: (id) => {
|
|
3328
3395
|
if (id.startsWith(HELD_COMMAND_ROW_PREFIX)) {
|
|
@@ -3331,8 +3398,18 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3331
3398
|
return;
|
|
3332
3399
|
}
|
|
3333
3400
|
void handleRemoveQueuedMessage(id);
|
|
3334
|
-
}, onRetry: handleRetryQueuedMessage, onStopAndSend: effectiveBusy && canStop ? handleStopAndSendQueuedMessage : undefined, editing: queueEdit.editing, onCancelEdit: queueEdit.cancel })
|
|
3335
|
-
|
|
3401
|
+
}, 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) => {
|
|
3402
|
+
queueEdit.takeBack(id);
|
|
3403
|
+
}, onRemove: (id) => {
|
|
3404
|
+
if (id.startsWith(HELD_COMMAND_ROW_PREFIX)) {
|
|
3405
|
+
const heldId = id.slice(HELD_COMMAND_ROW_PREFIX.length);
|
|
3406
|
+
setHeldCommands((held) => held.filter((entry) => entry.id !== heldId));
|
|
3407
|
+
return;
|
|
3408
|
+
}
|
|
3409
|
+
void handleRemoveQueuedMessage(id);
|
|
3410
|
+
}, onRetry: handleRetryQueuedMessage, onStopAndSend: effectiveBusy && canStop ? handleStopAndSendQueuedMessage : undefined, editing: queueEdit.editing, onCancelEdit: queueEdit.cancel })) })), [
|
|
3411
|
+
rowsContext?.messagesOnly,
|
|
3412
|
+
calmRest,
|
|
3336
3413
|
heldCommands,
|
|
3337
3414
|
queueEdit.editing,
|
|
3338
3415
|
queueEdit.cancel,
|
|
@@ -3408,7 +3485,7 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3408
3485
|
// `SessionComposerReadiness`.
|
|
3409
3486
|
const runtimePhase = useRuntimePhase();
|
|
3410
3487
|
// Covers the one gap `unreachable` can't: a sandbox proxy that keeps
|
|
3411
|
-
// answering with a 503 (
|
|
3488
|
+
// answering with a 503 (a runtime wedged mid-boot) resets the probe's
|
|
3412
3489
|
// failure counter every tick, so `unreachable` never fires no matter how
|
|
3413
3490
|
// long it stays wedged. See `useRuntimeBootStalled`.
|
|
3414
3491
|
const runtimeStalled = useRuntimeBootStalled();
|
|
@@ -3521,6 +3598,65 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3521
3598
|
if (crParam)
|
|
3522
3599
|
setOpenCrIdState(crParam);
|
|
3523
3600
|
}, [crParam]);
|
|
3601
|
+
// ---- Message link: `?m=<message_id>&at=<ms>` (the gateway request log's "Open in session") ----
|
|
3602
|
+
// Once per link, after the transcript first paints: page back until the turn
|
|
3603
|
+
// is loaded, scroll to it, flash it, then drop `m`/`at` so a reload stays put.
|
|
3604
|
+
const messageLink = readOnly ? null : readMessageLinkParams(searchParams);
|
|
3605
|
+
const messageLinkKey = messageLink ? `${sessionId}|${messageLink.messageId ?? ''}|${messageLink.at ?? ''}` : null;
|
|
3606
|
+
const linkTurnsRef = useRef(turns);
|
|
3607
|
+
useEffect(() => {
|
|
3608
|
+
linkTurnsRef.current = turns;
|
|
3609
|
+
}, [turns]);
|
|
3610
|
+
const jumpedLinkRef = useRef(null);
|
|
3611
|
+
useEffect(() => {
|
|
3612
|
+
if (!messageLink || !messageLinkKey || isDataLoading || turns.length === 0)
|
|
3613
|
+
return;
|
|
3614
|
+
if (jumpedLinkRef.current === messageLinkKey)
|
|
3615
|
+
return;
|
|
3616
|
+
jumpedLinkRef.current = messageLinkKey;
|
|
3617
|
+
const resolve = () => resolveMessageLinkTurn(linkTurnsRef.current, messageLink);
|
|
3618
|
+
// An in-app navigation has the transcript cached: `turns` exist frames before
|
|
3619
|
+
// their `[data-turn-id]` nodes mount, and the first paint scrolls to the
|
|
3620
|
+
// bottom. Jump only once the turns are in the DOM and that scroll has run,
|
|
3621
|
+
// else the scroll finds no node and the link lands at the bottom.
|
|
3622
|
+
let cancelled = false;
|
|
3623
|
+
let jumped = false;
|
|
3624
|
+
const startedAt = Date.now();
|
|
3625
|
+
const jump = () => {
|
|
3626
|
+
jumped = true;
|
|
3627
|
+
// Already on screen: no history to load. Else `at`, or NaN (load it all) for an id alone.
|
|
3628
|
+
const createdAt = resolve() ? Number.MAX_SAFE_INTEGER : (messageLink.at ?? Number.NaN);
|
|
3629
|
+
void handleJumpToOutcome(resolve, createdAt, true).finally(() => {
|
|
3630
|
+
const params = new URLSearchParams(searchParams?.toString());
|
|
3631
|
+
deleteMessageLinkParams(params);
|
|
3632
|
+
const qs = params.toString();
|
|
3633
|
+
shallowNavigate(qs ? `${pathname}?${qs}` : pathname, { replace: true });
|
|
3634
|
+
});
|
|
3635
|
+
};
|
|
3636
|
+
const waitForTurns = () => {
|
|
3637
|
+
if (cancelled)
|
|
3638
|
+
return;
|
|
3639
|
+
const mounted = !!contentRef.current?.querySelector('[data-turn-id]');
|
|
3640
|
+
if (!mounted && Date.now() - startedAt < MESSAGE_LINK_MOUNT_WAIT_MS) {
|
|
3641
|
+
window.setTimeout(waitForTurns, 100);
|
|
3642
|
+
return;
|
|
3643
|
+
}
|
|
3644
|
+
// Two frames: the first paint's bottom scroll lands before the jump, never after it.
|
|
3645
|
+
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
3646
|
+
if (!cancelled)
|
|
3647
|
+
jump();
|
|
3648
|
+
}));
|
|
3649
|
+
};
|
|
3650
|
+
waitForTurns();
|
|
3651
|
+
return () => {
|
|
3652
|
+
cancelled = true;
|
|
3653
|
+
// A wait cancelled before it jumped runs again on the next pass; a jump in flight is not repeated.
|
|
3654
|
+
if (!jumped && jumpedLinkRef.current === messageLinkKey)
|
|
3655
|
+
jumpedLinkRef.current = null;
|
|
3656
|
+
};
|
|
3657
|
+
// `messageLinkKey` stands for `messageLink`, which is a new object every render.
|
|
3658
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3659
|
+
}, [messageLinkKey, isDataLoading, turns.length, handleJumpToOutcome, searchParams, pathname, shallowNavigate, contentRef]);
|
|
3524
3660
|
const handleOpenOutcome = useCallback((outcome) => {
|
|
3525
3661
|
// Change requests are the only kind a turn produces. `external` exists on
|
|
3526
3662
|
// the union for `setup-links/setup-link-button.tsx`, which renders this
|
|
@@ -3544,304 +3680,306 @@ export function SessionChat({ sessionId, projectSessionId, sessionState, project
|
|
|
3544
3680
|
// an eternal loader. Only with nothing to paint: once any message is on
|
|
3545
3681
|
// screen, staleness is repaired in the background instead.
|
|
3546
3682
|
if (transcriptFreshness === 'error' && !hasMessages) {
|
|
3547
|
-
return (_jsx("div", { className:
|
|
3683
|
+
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') })] }) }));
|
|
3548
3684
|
}
|
|
3549
|
-
return (_jsx("div", { className:
|
|
3685
|
+
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 }) }));
|
|
3550
3686
|
}
|
|
3551
3687
|
return (
|
|
3552
3688
|
// A read-only view (the sub-session modal) offers no fix inside a tool card.
|
|
3553
|
-
_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',
|
|
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
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
// `undefined`, not `true`, once released: the composer's own
|
|
3787
|
-
// viewport rule (>= 640px) still decides, so this never forces
|
|
3788
|
-
// focus onto a phone keyboard.
|
|
3789
|
-
, {
|
|
3689
|
+
_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',
|
|
3690
|
+
// Transparent in the welcome state so the root-level full-bleed wallpaper
|
|
3691
|
+
// (portaled into SessionLayout) reads through; solid once real content
|
|
3692
|
+
// takes over. Same base color either way, so non-welcome is unchanged.
|
|
3693
|
+
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
|
|
3694
|
+
? welcomeWallpaper && createPortal(welcomeWallpaper, wallpaperLayer)
|
|
3695
|
+
: 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,
|
|
3696
|
+
// A chat with no `useSession` source: the raw explorer lists the
|
|
3697
|
+
// rows `useSessionSync` read for it.
|
|
3698
|
+
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: () => {
|
|
3699
|
+
try {
|
|
3700
|
+
if (sessionId)
|
|
3701
|
+
useTabStore.getState().closeTab?.(sessionId);
|
|
3702
|
+
}
|
|
3703
|
+
catch { }
|
|
3704
|
+
}, 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(
|
|
3705
|
+
// overflow-anchor:none — this scroll area does ALL of its own
|
|
3706
|
+
// anchoring (useAutoScroll's spacer + RAF follow, the send-path
|
|
3707
|
+
// turn anchor, and the history-prepend content-space restore in
|
|
3708
|
+
// session-history-scroll.ts). The browser's native scroll
|
|
3709
|
+
// anchoring (default `overflow-anchor: auto`) tries to
|
|
3710
|
+
// compensate for the SAME prepends independently, and the two
|
|
3711
|
+
// corrections stacking is the other half of the scroll-up
|
|
3712
|
+
// teleport: ours restores the reader's position, then the
|
|
3713
|
+
// native one nudges it again.
|
|
3714
|
+
'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",
|
|
3715
|
+
// Width and gutters live in `SESSION_TRANSCRIPT_CLASS`: the
|
|
3716
|
+
// instant shell draws this same column and the two crossfade
|
|
3717
|
+
// into each other, so a difference here is a sideways jump on
|
|
3718
|
+
// screen, not a style opinion. See session-body.tsx.
|
|
3719
|
+
//
|
|
3720
|
+
// No bottom padding, there or here: the space under the last
|
|
3721
|
+
// message is the auto-scroll spacer's job alone. The `pb-32`
|
|
3722
|
+
// that used to sit here stacked 128px of dead space on top of
|
|
3723
|
+
// it — the "extra inset at the bottom of the session".
|
|
3724
|
+
// Rows run edge to edge: each row owns its gutters and its hover fill.
|
|
3725
|
+
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 &&
|
|
3726
|
+
!olderPullFailed &&
|
|
3727
|
+
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 &&
|
|
3728
|
+
firstPromptSource &&
|
|
3729
|
+
queuedSyntheticMessages.length === 0 &&
|
|
3730
|
+
rowsContext && (
|
|
3731
|
+
// A channel thread draws the stand-in as rows, the same
|
|
3732
|
+
// rows its boot body drew (`ThreadBootRows`).
|
|
3733
|
+
_jsx(PendingPromptRows, { text: buildOptimisticPromptTextWithUploads(firstPromptSource.text, firstPromptSource.files), author: rowsContext.owner, sessionId: sessionId, busy: turns.length === 0 && (lastTurnWorking || promptInbox.prompts.some(isFirstPromptRow)) })), showFirstPromptPreview &&
|
|
3734
|
+
firstPromptSource &&
|
|
3735
|
+
queuedSyntheticMessages.length === 0 &&
|
|
3736
|
+
!rowsContext && (_jsx(OptimisticTurn, { text: buildOptimisticPromptTextWithUploads(firstPromptSource.text, firstPromptSource.files),
|
|
3737
|
+
// Preserve a real failed-send status through the
|
|
3738
|
+
// boot-shell handover without inventing upload progress.
|
|
3739
|
+
// A first prompt held on its uploads carries its own.
|
|
3740
|
+
uploadStatus: firstPromptSource.uploadStatus ?? firstPromptUploadStatus, agentNames: agentNames, onFileClick: openFileInComputer, sessionId: sessionId,
|
|
3741
|
+
// The first item of the conversation, like turn 0, which has no
|
|
3742
|
+
// top margin. `first:mt-0` misses here: the list opens with a
|
|
3743
|
+
// zero-height <header>, so the stand-in sat 44px lower than turn 0
|
|
3744
|
+
// and every swap between the two jumped the bubble (KRTX-2931).
|
|
3745
|
+
className: "mt-0",
|
|
3746
|
+
// An undelivered first prompt is a turn about to start, as the
|
|
3747
|
+
// shell above this chat shows it: busy from the first frame,
|
|
3748
|
+
// before the working projection has read the inbox (KRTX-2931).
|
|
3749
|
+
busy: turns.length === 0 && (lastTurnWorking || promptInbox.prompts.some(isFirstPromptRow)) })), turns.map((turn, turnIndex) => {
|
|
3750
|
+
// Check if this turn is a compaction summary — and
|
|
3751
|
+
// whether it actually PRODUCED one. A failed/aborted
|
|
3752
|
+
// attempt (compaction-flagged, no content, not the
|
|
3753
|
+
// working turn) renders as one slim row, draws no
|
|
3754
|
+
// divider, and stacks tight against a neighbouring
|
|
3755
|
+
// failed attempt.
|
|
3756
|
+
const compaction = turn.compaction;
|
|
3757
|
+
const hasCompaction = compaction !== null;
|
|
3758
|
+
const isTurnWorking = turn.live;
|
|
3759
|
+
// `inFlight` (message state) alongside the projection:
|
|
3760
|
+
// classifying by projection alone flipped a streaming
|
|
3761
|
+
// compaction to "failed" for the frames where the two
|
|
3762
|
+
// disagree, popping the divider in and out — a layout
|
|
3763
|
+
// bounce right where the reader is looking.
|
|
3764
|
+
const isFailedCompaction = compaction !== null &&
|
|
3765
|
+
!compaction.hasContent &&
|
|
3766
|
+
!compaction.inFlight &&
|
|
3767
|
+
!isTurnWorking;
|
|
3768
|
+
// Retries collapse to ONE visible row, GLOBALLY: a
|
|
3769
|
+
// failed attempt with ANY later compaction turn (a
|
|
3770
|
+
// retry, or the one that finally landed) is history —
|
|
3771
|
+
// it keeps its TurnViewport (stable keys, scroll
|
|
3772
|
+
// anchors) but renders no content, and an empty
|
|
3773
|
+
// TurnViewport costs 0px (turn-viewport.tsx RULE 2).
|
|
3774
|
+
// Adjacency was not enough: attempts whose error landed
|
|
3775
|
+
// on a plain assistant message used to interleave as
|
|
3776
|
+
// unclassified turns, breaking every consecutive run.
|
|
3777
|
+
const suppressedFailedCompaction = isFailedCompaction && turnIndex < lastCompactionTurnIndex;
|
|
3778
|
+
// Notification-only early-return removed: it rendered the
|
|
3779
|
+
// user's pty_* card but skipped the turn's replies,
|
|
3780
|
+
// hiding every subsequent assistant response in that turn.
|
|
3781
|
+
// Fall through to the normal turn renderer instead.
|
|
3782
|
+
const confirmedActive = turnIsConfirmedActive({
|
|
3783
|
+
isTurnWorking,
|
|
3784
|
+
turnId: turn.id,
|
|
3785
|
+
activeTurnId,
|
|
3786
|
+
pendingDelivery: !!working.pendingDelivery,
|
|
3787
|
+
});
|
|
3788
|
+
const pendingPrompt = !confirmedActive && turn.assistant.length === 0
|
|
3789
|
+
? pendingPromptsByMessageId.get(turn.id)
|
|
3790
|
+
: undefined;
|
|
3791
|
+
// A queued prompt is not in the runtime transcript yet;
|
|
3792
|
+
// its author still shows (`authorForTurn`).
|
|
3793
|
+
const promptAuthorId = pendingPromptsByMessageId.get(turn.id)?.author_user_id;
|
|
3794
|
+
const turnAuthor = authorForTurn(transcriptAuthors, messageAuthors, turn.id, pendingPrompt?.wire_message_id) ??
|
|
3795
|
+
participantAuthor(sessionParticipants, promptAuthorId) ??
|
|
3796
|
+
(sentHereIds.current.has(turn.id) ||
|
|
3797
|
+
sentHereIds.current.has(turnRenderKeys.get(turn.id) ?? '') ||
|
|
3798
|
+
(viewerId !== undefined && promptAuthorId === viewerId) ||
|
|
3799
|
+
// The first prompt of a session the viewer started,
|
|
3800
|
+
// sent from another surface (project home), before
|
|
3801
|
+
// the first authors read lands.
|
|
3802
|
+
(messageAuthorsLoading &&
|
|
3803
|
+
viewerId !== undefined &&
|
|
3804
|
+
projectSessionRow?.created_by === viewerId &&
|
|
3805
|
+
turn.id === userMessageIds[0])
|
|
3806
|
+
? viewerAsAuthor
|
|
3807
|
+
: undefined);
|
|
3808
|
+
return (_jsx(TranscriptTurnRow
|
|
3809
|
+
// ONE element per prompt: keyed by the id the
|
|
3810
|
+
// bubble was FIRST painted under, so the swap to a
|
|
3811
|
+
// re-minted echo id re-renders this node instead
|
|
3812
|
+
// of mounting a new one (opacity keeps animating,
|
|
3813
|
+
// hover state survives, nothing jumps).
|
|
3814
|
+
, { turnId: turn.id, modelOptions: modelOptions, suppressed: suppressedFailedCompaction, continuedWith: harnessSwitches.get(turn.id)?.harness, fullTextState: loaded.state[turn.id] ?? 'idle', onLoadFullText: loadFullTexts, showBusyRow: showFallbackBusyRow &&
|
|
3815
|
+
fallbackBusyRowTurnId === turn.id,
|
|
3816
|
+
// Queued bubbles STACK: a pending turn right after
|
|
3817
|
+
// another pending turn sits close to it, like a
|
|
3818
|
+
// list of what is waiting — not a turn's width
|
|
3819
|
+
// apart as if each had been answered in between.
|
|
3820
|
+
// (Failed compaction rows need no stacking rule any
|
|
3821
|
+
// more — at most one is visible at a time.)
|
|
3822
|
+
viewportClassName: turnIndex === 0 || transcriptRows
|
|
3823
|
+
? ''
|
|
3824
|
+
: // A compaction, the work after it and another agent's notice continue the turn above.
|
|
3825
|
+
turn.compaction || turn.continues || agentNoticeTurnIds.has(turn.id)
|
|
3826
|
+
? 'mt-6'
|
|
3827
|
+
: lastTurnWorking &&
|
|
3828
|
+
pendingTurnIds.has(turn.id) &&
|
|
3829
|
+
pendingTurnIds.has(turns[turnIndex - 1].id)
|
|
3830
|
+
? 'mt-3'
|
|
3831
|
+
: 'mt-12', turn: turn, author: turnAuthor,
|
|
3832
|
+
// Reserve the sender row while the authors load,
|
|
3833
|
+
// for a queued prompt whose sender is known, and
|
|
3834
|
+
// for a live message until its author resolves.
|
|
3835
|
+
showAuthor: !!turnAuthor ||
|
|
3836
|
+
messageAuthorsLoading ||
|
|
3837
|
+
!!promptAuthorId ||
|
|
3838
|
+
(loadedUserIds?.sessionId === sessionId &&
|
|
3839
|
+
!loadedUserIds.ids.has(turn.id) &&
|
|
3840
|
+
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,
|
|
3841
|
+
// Handed over only once the stand-in has stepped
|
|
3842
|
+
// aside — while it is up it draws these itself.
|
|
3843
|
+
pendingText: turnIndex === 0 ? firstTurnHandover?.text : undefined, pendingAttachments: sentAttachmentsForTurn({
|
|
3844
|
+
sentByMessage: sentAttachmentsByMessage,
|
|
3845
|
+
messageId: turn.id,
|
|
3846
|
+
originId: optimisticOriginOf(sessionId, turn.id),
|
|
3847
|
+
isFirstTurn: turnIndex === 0,
|
|
3848
|
+
firstTurnHandover: firstTurnHandover?.attachments,
|
|
3849
|
+
firstTurnSent: firstPromptAttachments(projectSessionId),
|
|
3850
|
+
queuedRowAttachments: inboxRowsByMessageId.get(turn.id)?.attachments,
|
|
3851
|
+
}), uploadStatus: heldSendFailures?.[turn.id]
|
|
3852
|
+
? {
|
|
3853
|
+
state: 'failed',
|
|
3854
|
+
message: heldSendFailures[turn.id].message,
|
|
3855
|
+
onRetry: () => retryHeldSend(sessionId, turn.id, resendHeldSend, (error) => classifySessionError(error).message),
|
|
3856
|
+
}
|
|
3857
|
+
: turnIndex === 0 && firstTurnHandover?.attachments.length
|
|
3858
|
+
? firstPromptUploadStatus
|
|
3859
|
+
: undefined, sessionWorking: lastTurnWorking, isWorkingTurn: turn.live, suppressBusyIndicator: suppressWorkingTurnBusy, awaitingUser: awaitingUserInput,
|
|
3860
|
+
// An idle send stays in the inbox until delivery,
|
|
3861
|
+
// but nothing runs ahead of it: queued only while
|
|
3862
|
+
// it waits behind a turn (`turnRendersQueued`).
|
|
3863
|
+
// The first turn, with no turn working, has
|
|
3864
|
+
// nothing ahead of it: a session's first prompt is
|
|
3865
|
+
// starting, not queued, while the computer comes up
|
|
3866
|
+
// and before the turn layer marks it queued or live.
|
|
3867
|
+
pending: turnIndex === 0 && workingTurn.workingTurnId === null && !confirmedActive
|
|
3868
|
+
? pendingPrompt?.state === 'waiting' || pendingPrompt?.state === 'failed'
|
|
3869
|
+
: turnRendersQueued({
|
|
3870
|
+
turnId: turn.id,
|
|
3871
|
+
resolution: workingTurn,
|
|
3872
|
+
sessionWorking: lastTurnWorking,
|
|
3873
|
+
confirmedActive,
|
|
3874
|
+
inboxPrompt: pendingPrompt,
|
|
3875
|
+
}), 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
|
|
3876
|
+
? rewindTarget.text
|
|
3877
|
+
: null, editPending: editSendPending || !!sessionState?.rewindPending, onEditCancel: stableEditCancel, onEditSend: stableEditSend, rewindDisabled: !!readOnly ||
|
|
3878
|
+
(rewindable !== null && !rewindable.has(turn.id)) ||
|
|
3879
|
+
!runtimeCanRewind ||
|
|
3880
|
+
!sessionState ||
|
|
3881
|
+
isBusy ||
|
|
3882
|
+
sessionState.rewindPending ||
|
|
3883
|
+
// The runtime is not idle while queued prompts
|
|
3884
|
+
// are still on their way to it — a rewind mid-
|
|
3885
|
+
// delivery fails downstream with "Session is
|
|
3886
|
+
// busy" (measured); refuse it up front instead.
|
|
3887
|
+
promptInbox.prompts.length > 0 }, turnRenderKeys.get(turn.id)));
|
|
3888
|
+
})] }) }), isOptimisticCompacting && !hasCompactionTurn && (_jsx("div", { className: turns.length > 0 ? 'mt-12' : 'mt-2', children: _jsx(CompactionMarker, { running: true }) })), [
|
|
3889
|
+
...(turnOutcome.recent_failures ?? []),
|
|
3890
|
+
...(turnOutcome.last_ended?.end_reason === 'failed' &&
|
|
3891
|
+
!turnOutcome.recent_failures?.some((failure) => failure.message_id === turnOutcome.last_ended?.message_id)
|
|
3892
|
+
? [turnOutcome.last_ended]
|
|
3893
|
+
: []),
|
|
3894
|
+
].filter((failure) => !isAbortError(failure.error) &&
|
|
3895
|
+
!failureShownByTurn(failure, turns) &&
|
|
3896
|
+
!failureSupersededByTurn(failure, turns) &&
|
|
3897
|
+
(!failure.error?.message || failure.error.message !== commandError?.message)).map((failure) => {
|
|
3898
|
+
const messageId = failure.message_id ?? 'persisted-turn-failure';
|
|
3899
|
+
// Use the SDK's settle window for a cause that may arrive
|
|
3900
|
+
// one frame later, including an unnamed failed last turn.
|
|
3901
|
+
const notice = turnEndNotice({
|
|
3902
|
+
...turnOutcome,
|
|
3903
|
+
recent_failures: [{ ...failure, message_id: messageId, error: failure.error ?? null }],
|
|
3904
|
+
}, messageId, { hasError: false, isAbort: false });
|
|
3905
|
+
return notice ? (_jsx(TurnErrorDisplay, { errorText: notice.kind === 'unexplained'
|
|
3906
|
+
? tHardcodedUi.raw('i18nComplete.text73112526c03a')
|
|
3907
|
+
: persistedFailureText(failure.error), className: "mt-2" }, messageId)) : null;
|
|
3908
|
+
}), commandError && (_jsx(TurnErrorDisplay, { error: commandError, isAbort: isAbortError(commandError.cause), modelOptions: modelOptions, className: "mt-2" })), showFallbackBusyRow && fallbackBusyRowTurnId === null && (rowsContext ? (
|
|
3909
|
+
// A channel thread waits in the agent's answer row.
|
|
3910
|
+
_jsx(AgentBusyRow, { sessionId: sessionId })) : (_jsx(SessionBusyIndicator, { sessionId: sessionId,
|
|
3911
|
+
// Matches the stand-in's row spacing under a bubble
|
|
3912
|
+
// (`OptimisticTurn`), so the crossfade into the real
|
|
3913
|
+
// transcript does not move it. Nothing above it when
|
|
3914
|
+
// the transcript is empty, so no margin there.
|
|
3915
|
+
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: {
|
|
3916
|
+
left: `${selectionPopup.x}px`,
|
|
3917
|
+
top: `${selectionPopup.y}px`,
|
|
3918
|
+
transform: 'translate(-50%, -100%)',
|
|
3919
|
+
}, 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
|
|
3920
|
+
? 'duration-normal scale-100 opacity-100'
|
|
3921
|
+
: '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
|
|
3790
3922
|
// `undefined`, not `true`, once released: the composer's own
|
|
3791
3923
|
// viewport rule (>= 640px) still decides, so this never forces
|
|
3792
3924
|
// focus onto a phone keyboard.
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
//
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
:
|
|
3925
|
+
// A thread a space's chat opened by itself does not take the focus (`ComposerAutoFocusContext`).
|
|
3926
|
+
, {
|
|
3927
|
+
// `undefined`, not `true`, once released: the composer's own
|
|
3928
|
+
// viewport rule (>= 640px) still decides, so this never forces
|
|
3929
|
+
// focus onto a phone keyboard.
|
|
3930
|
+
// A thread a space's chat opened by itself does not take the focus (`ComposerAutoFocusContext`).
|
|
3931
|
+
autoFocus: deferComposerFocus || !composerAutoFocus ? false : undefined, onSend: async (text, files, mentions, attachments, placement) => {
|
|
3932
|
+
if (await queueEdit.save(text))
|
|
3933
|
+
return;
|
|
3934
|
+
// Enter while a turn runs steers it (D9.1); Cmd/Ctrl+Enter is Queue List.
|
|
3935
|
+
await handleSend(text, files, mentions, attachments, composerSendDelivery(placement ?? 'transcript', isBusyRef.current));
|
|
3936
|
+
}, prefill: composerPrefill, onPrefillApplied: (id) => {
|
|
3937
|
+
useSessionComposerPrefillStore.getState().clearPrefill(sessionId, id);
|
|
3938
|
+
},
|
|
3939
|
+
// Up from the first row takes the queue back; the placeholder
|
|
3940
|
+
// says so while there is something to take.
|
|
3941
|
+
onArrowUpAtStart: () => queueEdit.takeBack(),
|
|
3942
|
+
// A host placeholder ("Reply…") is static: the rotating tips would replace it.
|
|
3943
|
+
hint: canTakeBackQueue ? tHardcodedUi.raw('i18nComplete.text03a01dd53ffa') : composerPlaceholder,
|
|
3944
|
+
// Editing a queued message: the send saves it back into the
|
|
3945
|
+
// queue, so the control says Submit, never Stop.
|
|
3946
|
+
submitLabel: queueEdit.editing ? tQueue('submitEdit') : null, draftScope: composerDraftScope, draftActive: !deferComposerFocus, attachRequestId: attachRequestId, isBusy: isBusy,
|
|
3947
|
+
// The ONE projection, not the 300 ms busy fade: it is what
|
|
3948
|
+
// decides whether a `/` command may be dispatched, and a fade
|
|
3949
|
+
// timer that has already lapsed would let one abort a live turn.
|
|
3950
|
+
// `effectiveBusy` folds in optimistic compaction (not a turn, so
|
|
3951
|
+
// not in `working`) and the retrying-turn predicate, so this
|
|
3952
|
+
// site reads one value instead of re-OR-ing a term onto it.
|
|
3953
|
+
sessionWorking: effectiveBusy,
|
|
3954
|
+
// Gates `/` COMMANDS only. A prompt typed at a sleeping box is
|
|
3955
|
+
// an inbox row and goes out when the box answers; a command has
|
|
3956
|
+
// no row, and `runCommand` swallows it silently until the
|
|
3957
|
+
// runtime is switched.
|
|
3958
|
+
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,
|
|
3959
|
+
// Only lock the input into question-answer mode while the session is
|
|
3960
|
+
// actually busy (a live question keeps the run busy). If a question
|
|
3961
|
+
// chip is ever showing while the session is idle — e.g. a dead /
|
|
3962
|
+
// abandoned question the agent left behind — the input stays unlocked
|
|
3963
|
+
// so a typed message is sent to the agent instead of being swallowed
|
|
3964
|
+
// as a custom answer.
|
|
3965
|
+
lockForQuestion: !!renderedQuestion && isBusy,
|
|
3966
|
+
// Same dead-prompt guard as questions: only lock while the agent is
|
|
3967
|
+
// actually paused on the decision (isBusy), so a stale card can't
|
|
3968
|
+
// swallow the composer on an idle session.
|
|
3969
|
+
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,
|
|
3970
|
+
// The shell can now render on a cached transcript alone, i.e. before
|
|
3971
|
+
// the sandbox answers — so sending has to be gated separately from
|
|
3972
|
+
// reading. See sessionComposerReadiness.
|
|
3973
|
+
notice: hostNotice(composerReadiness.notice, rowsContext?.notices),
|
|
3974
|
+
// Inside the thread panel's bordered box, as the channel composer.
|
|
3975
|
+
// A phone keeps the row under the card; a 720px desktop window does not.
|
|
3976
|
+
underbarPlacement: transcriptRows && !isPhone ? 'inline' : undefined,
|
|
3977
|
+
// The panel's toolbar is narrow: the agent is its tile, the model keeps its name.
|
|
3978
|
+
agentPickerCompact: transcriptRows && !isPhone,
|
|
3979
|
+
// A thread panel's rows run `px-5`, and the channel composer
|
|
3980
|
+
// beside it sits `pb-4` off the window's bottom edge: the same
|
|
3981
|
+
// margins, so the two boxes line up.
|
|
3982
|
+
parentClassName: transcriptRows ? 'max-w-none px-5 pb-4' : undefined, onNoticeRetry: composerReadiness.notice && composerReadiness.retryable
|
|
3983
|
+
? requestRuntimeReconnect
|
|
3984
|
+
: 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 }) })] }))] })] }) }) }) }) }));
|
|
3847
3985
|
}
|