@adecore/agents-react 0.53.3 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/AgentIcon.js +1 -1
- package/dist/agents/AgentModelLabel.js +1 -1
- package/dist/agents/accounts.js +1 -1
- package/dist/chat/attachments.js +1 -1
- package/dist/chat/forks.js +1 -1
- package/dist/chat/logic/limit.js +1 -1
- package/dist/chat/logic/scrubber.js +1 -1
- package/dist/chat/logic/selection-switch.d.ts +6 -0
- package/dist/chat/logic/selection-switch.js +42 -0
- package/dist/chat/logic/timeline-target.d.ts +1 -1
- package/dist/chat/logic/timeline.d.ts +6 -1
- package/dist/chat/logic/timeline.js +16 -2
- package/dist/chat/logic/tool-looks.js +1 -1
- package/dist/chat/logic/tools.js +1 -1
- package/dist/chat/logic/workflow.js +1 -1
- package/dist/chat/preferences.js +1 -1
- package/dist/chat/runtime-modes.js +1 -1
- package/dist/chat/send-key.js +1 -1
- package/dist/chat/stash.js +2 -2
- package/dist/chat/subagent-list.js +1 -1
- package/dist/chat/ui/AccountPill.js +3 -3
- package/dist/chat/ui/BookmarkMarker.js +6 -6
- package/dist/chat/ui/BookmarkSubmenu.js +5 -5
- package/dist/chat/ui/ChatActivity.js +15 -14
- package/dist/chat/ui/CodeBlock.js +9 -7
- package/dist/chat/ui/Composer.js +13 -13
- package/dist/chat/ui/ComposerInput.d.ts +1 -1
- package/dist/chat/ui/ComposerInput.js +35 -18
- package/dist/chat/ui/DiffPool.js +1 -1
- package/dist/chat/ui/EditDiff.js +2 -2
- package/dist/chat/ui/GoalDock.js +5 -5
- package/dist/chat/ui/ImageView.js +4 -4
- package/dist/chat/ui/LimitState.js +12 -12
- package/dist/chat/ui/Markdown.d.ts +1 -1
- package/dist/chat/ui/Markdown.js +11 -10
- package/dist/chat/ui/MermaidBlock.js +7 -6
- package/dist/chat/ui/MessageActions.js +7 -7
- package/dist/chat/ui/ModelMarks.js +2 -2
- package/dist/chat/ui/Pickers.d.ts +1 -1
- package/dist/chat/ui/Pickers.js +32 -27
- package/dist/chat/ui/PromptComposer.d.ts +1 -1
- package/dist/chat/ui/PromptComposer.js +5 -5
- package/dist/chat/ui/PromptEditor.js +3 -3
- package/dist/chat/ui/QuoteButton.js +2 -2
- package/dist/chat/ui/ReferenceChip.js +3 -3
- package/dist/chat/ui/ReferenceTrail.js +2 -2
- package/dist/chat/ui/ResumeCompactionDock.js +3 -3
- package/dist/chat/ui/RunSettings.js +11 -11
- package/dist/chat/ui/Scrubber.js +4 -4
- package/dist/chat/ui/SessionLine.js +2 -2
- package/dist/chat/ui/ShellCommand.d.ts +1 -1
- package/dist/chat/ui/ShellCommand.js +2 -2
- package/dist/chat/ui/SubagentControls.js +3 -3
- package/dist/chat/ui/SubagentInfo.js +5 -5
- package/dist/chat/ui/SubagentStopButton.js +2 -2
- package/dist/chat/ui/SubagentTimeline.js +18 -16
- package/dist/chat/ui/Timeline.js +231 -145
- package/dist/chat/ui/TimelineMenu.js +7 -7
- package/dist/chat/ui/UnifiedDiff.js +2 -2
- package/dist/chat/ui/VisualDialogs.js +1 -1
- package/dist/chat/ui/VisualFrame.js +4 -4
- package/dist/chat/ui/WorkflowAgentLine.d.ts +1 -1
- package/dist/chat/ui/WorkflowAgentLine.js +3 -3
- package/dist/chat/ui/chip-clipboard.d.ts +1 -1
- package/dist/chat/ui/composer/ComposerControls.d.ts +1 -1
- package/dist/chat/ui/composer/ComposerControls.js +4 -4
- package/dist/chat/ui/composer/ComposerMenu.js +5 -4
- package/dist/chat/ui/composer/DraftParts.js +2 -2
- package/dist/chat/ui/composer/QueuedMessages.js +2 -2
- package/dist/chat/ui/composer/chip-paste.d.ts +1 -1
- package/dist/chat/ui/composer/chips.d.ts +1 -1
- package/dist/chat/ui/composer/chips.js +2 -2
- package/dist/chat/ui/composer/key-handler.js +1 -1
- package/dist/chat/ui/composer/placeholder.js +1 -1
- package/dist/chat/ui/composer/use-composer-menus.d.ts +1 -1
- package/dist/chat/ui/composer/use-composer-menus.js +1 -1
- package/dist/chat/ui/composer/use-composer-submit.d.ts +1 -1
- package/dist/chat/ui/composer/use-draft-files.d.ts +2 -2
- package/dist/chat/ui/composer/use-draft-files.js +1 -1
- package/dist/chat/ui/composer/use-effort-stepper.js +1 -1
- package/dist/chat/ui/composer/use-prompt-menus.d.ts +2 -2
- package/dist/chat/ui/composer/use-prompt-menus.js +1 -1
- package/dist/chat/ui/diff/ApprovalReview.js +2 -2
- package/dist/chat/ui/diff/DiffOmitted.js +1 -1
- package/dist/chat/ui/diff/DiffStack.js +2 -2
- package/dist/chat/ui/diff/EditorEditDiff.d.ts +1 -1
- package/dist/chat/ui/diff/EditorEditDiff.js +5 -5
- package/dist/chat/ui/diff/EditorPatchDiff.d.ts +1 -1
- package/dist/chat/ui/diff/EditorPatchDiff.js +1 -1
- package/dist/chat/ui/diff/LegacyEditDiff.js +47 -31
- package/dist/chat/ui/diff/LegacyUnifiedDiff.js +93 -69
- package/dist/chat/ui/diff/RawDiff.js +54 -35
- package/dist/chat/ui/diff/syntax-runtime.d.ts +1 -1
- package/dist/chat/ui/highlighter.d.ts +1 -1
- package/dist/chat/ui/highlighter.js +1 -1
- package/dist/chat/ui/icons.js +1 -1
- package/dist/chat/ui/intelligent-ui/UiBlockFrame.d.ts +1 -1
- package/dist/chat/ui/intelligent-ui/UiBlockFrame.js +4 -4
- package/dist/chat/ui/intelligent-ui/UiFallbackPart.js +2 -2
- package/dist/chat/ui/intelligent-ui/UiReply.d.ts +2 -2
- package/dist/chat/ui/intelligent-ui/UiReply.js +8 -8
- package/dist/chat/ui/intelligent-ui/node-text.d.ts +1 -1
- package/dist/chat/ui/intelligent-ui/render-context.d.ts +1 -1
- package/dist/chat/ui/intelligent-ui/renderers/chart.js +28 -15
- package/dist/chat/ui/intelligent-ui/renderers/choices.js +4 -4
- package/dist/chat/ui/intelligent-ui/renderers/content.js +6 -6
- package/dist/chat/ui/intelligent-ui/renderers/data.js +104 -87
- package/dist/chat/ui/intelligent-ui/renderers/inputs.js +3 -3
- package/dist/chat/ui/intelligent-ui/renderers/links.js +2 -2
- package/dist/chat/ui/intelligent-ui/renderers/map-view.js +4 -4
- package/dist/chat/ui/intelligent-ui/renderers/map.js +3 -3
- package/dist/chat/ui/intelligent-ui/renderers/structure.js +2 -2
- package/dist/chat/ui/intelligent-ui/renderers/text.js +5 -5
- package/dist/chat/ui/intelligent-ui/tones.d.ts +1 -1
- package/dist/chat/ui/intelligent-ui/use-ui-links.d.ts +1 -1
- package/dist/chat/ui/intelligent-ui/use-ui-links.js +2 -2
- package/dist/chat/ui/intelligent-ui/use-ui-queries.js +1 -1
- package/dist/chat/ui/reference-icons.d.ts +1 -1
- package/dist/chat/ui/reference-icons.js +2 -2
- package/dist/chat/ui/reply-context.d.ts +1 -1
- package/dist/chat/ui/rows/ForksRow.js +3 -3
- package/dist/chat/ui/rows/GeneratedImageRow.js +5 -5
- package/dist/chat/ui/rows/MessageRows.d.ts +6 -1
- package/dist/chat/ui/rows/MessageRows.js +151 -22
- package/dist/chat/ui/rows/Rows.js +39 -21
- package/dist/chat/ui/rows/SubagentRow.js +16 -16
- package/dist/chat/ui/rows/TaskRow.js +3 -3
- package/dist/chat/ui/rows/VisualRow.js +2 -2
- package/dist/chat/ui/rows/WorkRows.d.ts +2 -2
- package/dist/chat/ui/rows/WorkRows.js +37 -25
- package/dist/chat/ui/rows/WorkflowRow.js +8 -8
- package/dist/chat/ui/use-diff-source-tokens.js +1 -1
- package/dist/chat/ui/visual-theme.d.ts +1 -1
- package/dist/chat/ui/visual-theme.js +2 -2
- package/dist/chat/workflow-list.js +1 -1
- package/dist/host.d.ts +4 -4
- package/dist/host.js +1 -1
- package/dist/lazy.js +1 -1
- package/dist/locales/en/agent-chat.d.ts +4 -0
- package/dist/locales/en/agent-chat.js +4 -0
- package/dist/locales/nl/agent-chat.d.ts +4 -0
- package/dist/locales/nl/agent-chat.js +4 -0
- package/dist/port-transport.js +1 -1
- package/dist/prompts/logic/subjects.d.ts +1 -1
- package/dist/prompts/ui/ApprovalBody.js +16 -7
- package/dist/prompts/ui/PromptActions.js +2 -2
- package/dist/prompts/ui/PromptCard.js +5 -4
- package/dist/prompts/ui/PromptView.js +1 -1
- package/dist/prompts/ui/QuestionBody.js +4 -4
- package/dist/providers/AccountDetail.js +4 -4
- package/dist/providers/AccountOrderList.js +2 -2
- package/dist/providers/AccountVariables.js +3 -3
- package/dist/providers/AddAccountForm.js +6 -6
- package/dist/providers/CliDetail.js +8 -8
- package/dist/providers/InstallPage.js +3 -3
- package/dist/providers/ProviderList.js +2 -2
- package/dist/providers/ProvidersPane.d.ts +1 -1
- package/dist/providers/ProvidersPane.js +5 -5
- package/dist/providers/install-steps.d.ts +1 -1
- package/dist/settings/sections.d.ts +2 -2
- package/dist/state/chats.js +1 -1
- package/dist/state/usage.js +2 -2
- package/dist/theme.css +4 -4
- package/dist/transport.d.ts +1 -1
- package/dist/usage/LimitsList.js +4 -4
- package/dist/usage/UsageBreakdown.js +5 -5
- package/dist/usage/UsageChart.js +1 -1
- package/dist/usage/UsageDialog.js +1 -1
- package/dist/usage/UsageLimits.js +6 -6
- package/dist/usage/UsageLimitsCard.js +2 -2
- package/dist/usage/UsagePage.js +200 -189
- package/dist/usage/UsagePane.js +2 -2
- package/dist/usage/UsageSummary.js +1 -1
- package/dist/usage/UsageTiles.js +1 -1
- package/dist/usage/limit-groups.js +2 -2
- package/dist/usage/summary.js +1 -1
- package/package.json +9 -8
- package/src/agents/AgentIcon.tsx +1 -1
- package/src/agents/AgentModelLabel.tsx +2 -2
- package/src/agents/ProviderLogo.tsx +1 -1
- package/src/agents/accounts.ts +1 -1
- package/src/agents/option-words.ts +1 -1
- package/src/chat/attachments.ts +1 -1
- package/src/chat/bookmarks.ts +1 -1
- package/src/chat/drafts.ts +1 -1
- package/src/chat/forks.ts +1 -1
- package/src/chat/logic/fork.ts +1 -1
- package/src/chat/logic/limit.ts +1 -1
- package/src/chat/logic/scrubber.ts +1 -1
- package/src/chat/logic/selection-switch.ts +47 -0
- package/src/chat/logic/timeline-copy.ts +1 -1
- package/src/chat/logic/timeline-target.ts +1 -1
- package/src/chat/logic/timeline.ts +28 -4
- package/src/chat/logic/tool-looks.ts +1 -1
- package/src/chat/logic/tools.ts +1 -1
- package/src/chat/logic/workflow.ts +1 -1
- package/src/chat/pending-prompts.ts +1 -1
- package/src/chat/preferences.ts +1 -1
- package/src/chat/reading-width.ts +1 -1
- package/src/chat/runtime-modes.ts +1 -1
- package/src/chat/send-key.ts +1 -1
- package/src/chat/stash.ts +2 -2
- package/src/chat/subagent-conversation.ts +1 -1
- package/src/chat/subagent-list.ts +1 -1
- package/src/chat/subagent-view.ts +1 -1
- package/src/chat/thumbnails.ts +1 -1
- package/src/chat/ui/AccountPill.tsx +4 -4
- package/src/chat/ui/BookmarkMarker.tsx +6 -6
- package/src/chat/ui/BookmarkSubmenu.tsx +5 -5
- package/src/chat/ui/ChatActivity.tsx +15 -15
- package/src/chat/ui/CodeBlock.tsx +10 -8
- package/src/chat/ui/Composer.tsx +13 -13
- package/src/chat/ui/ComposerInput.tsx +10 -2
- package/src/chat/ui/DiffPool.tsx +1 -1
- package/src/chat/ui/EditDiff.tsx +3 -4
- package/src/chat/ui/GoalDock.tsx +6 -6
- package/src/chat/ui/ImageView.tsx +4 -4
- package/src/chat/ui/LimitState.tsx +13 -13
- package/src/chat/ui/Markdown.tsx +12 -12
- package/src/chat/ui/MermaidBlock.tsx +6 -6
- package/src/chat/ui/MessageActions.tsx +7 -7
- package/src/chat/ui/ModelMarks.tsx +2 -2
- package/src/chat/ui/Pickers.tsx +10 -10
- package/src/chat/ui/PromptComposer.tsx +6 -6
- package/src/chat/ui/PromptEditor.tsx +4 -4
- package/src/chat/ui/QuoteButton.tsx +2 -2
- package/src/chat/ui/ReferenceChip.tsx +3 -3
- package/src/chat/ui/ReferenceTrail.tsx +2 -2
- package/src/chat/ui/ResumeCompactionDock.tsx +3 -3
- package/src/chat/ui/RunSettings.tsx +13 -13
- package/src/chat/ui/Scrubber.tsx +4 -4
- package/src/chat/ui/SessionLine.tsx +2 -2
- package/src/chat/ui/ShellCommand.tsx +2 -2
- package/src/chat/ui/SubagentControls.tsx +3 -3
- package/src/chat/ui/SubagentInfo.tsx +5 -5
- package/src/chat/ui/SubagentStopButton.tsx +3 -3
- package/src/chat/ui/SubagentTimeline.tsx +20 -17
- package/src/chat/ui/Timeline.tsx +232 -143
- package/src/chat/ui/TimelineMenu.tsx +7 -7
- package/src/chat/ui/UnifiedDiff.tsx +3 -3
- package/src/chat/ui/VisualDialogs.tsx +2 -2
- package/src/chat/ui/VisualFrame.tsx +4 -4
- package/src/chat/ui/WorkflowAgentLine.tsx +4 -4
- package/src/chat/ui/chip-clipboard.ts +1 -1
- package/src/chat/ui/composer/ComposerControls.tsx +4 -4
- package/src/chat/ui/composer/ComposerMenu.tsx +6 -6
- package/src/chat/ui/composer/DraftParts.tsx +2 -2
- package/src/chat/ui/composer/QueuedMessages.tsx +2 -2
- package/src/chat/ui/composer/chip-paste.ts +1 -1
- package/src/chat/ui/composer/chips.ts +2 -2
- package/src/chat/ui/composer/key-handler.ts +2 -2
- package/src/chat/ui/composer/placeholder.ts +1 -1
- package/src/chat/ui/composer/use-chat-controls.ts +1 -1
- package/src/chat/ui/composer/use-compaction-offer.ts +1 -1
- package/src/chat/ui/composer/use-composer-menus.ts +2 -2
- package/src/chat/ui/composer/use-composer-submit.ts +2 -2
- package/src/chat/ui/composer/use-draft-files.ts +3 -3
- package/src/chat/ui/composer/use-effort-stepper.ts +2 -2
- package/src/chat/ui/composer/use-pending-requests.ts +1 -1
- package/src/chat/ui/composer/use-prompt-menus.ts +3 -3
- package/src/chat/ui/composer/use-take-back.ts +1 -1
- package/src/chat/ui/diff/ApprovalReview.tsx +3 -3
- package/src/chat/ui/diff/DiffOmitted.tsx +1 -1
- package/src/chat/ui/diff/DiffStack.tsx +2 -2
- package/src/chat/ui/diff/EditorEditDiff.tsx +5 -5
- package/src/chat/ui/diff/EditorPatchDiff.tsx +1 -1
- package/src/chat/ui/diff/LegacyDiffPool.tsx +1 -1
- package/src/chat/ui/diff/LegacyEditDiff.tsx +18 -9
- package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +24 -13
- package/src/chat/ui/diff/RawDiff.tsx +8 -5
- package/src/chat/ui/diff/syntax-runtime.ts +1 -1
- package/src/chat/ui/highlighter.ts +1 -1
- package/src/chat/ui/icons.tsx +2 -2
- package/src/chat/ui/intelligent-ui/UiBlockFrame.tsx +5 -5
- package/src/chat/ui/intelligent-ui/UiFallbackPart.tsx +2 -2
- package/src/chat/ui/intelligent-ui/UiReply.tsx +18 -18
- package/src/chat/ui/intelligent-ui/node-text.ts +1 -1
- package/src/chat/ui/intelligent-ui/render-context.ts +1 -1
- package/src/chat/ui/intelligent-ui/renderers/chart.tsx +15 -7
- package/src/chat/ui/intelligent-ui/renderers/choices.tsx +4 -4
- package/src/chat/ui/intelligent-ui/renderers/content.tsx +7 -7
- package/src/chat/ui/intelligent-ui/renderers/data.tsx +8 -7
- package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +3 -3
- package/src/chat/ui/intelligent-ui/renderers/links.tsx +4 -4
- package/src/chat/ui/intelligent-ui/renderers/map-view.tsx +4 -4
- package/src/chat/ui/intelligent-ui/renderers/map.tsx +5 -5
- package/src/chat/ui/intelligent-ui/renderers/structure.tsx +3 -3
- package/src/chat/ui/intelligent-ui/renderers/text.tsx +5 -5
- package/src/chat/ui/intelligent-ui/tones.ts +1 -1
- package/src/chat/ui/intelligent-ui/use-ui-links.ts +2 -2
- package/src/chat/ui/intelligent-ui/use-ui-queries.ts +1 -1
- package/src/chat/ui/reference-icons.ts +2 -2
- package/src/chat/ui/reply-context.ts +1 -1
- package/src/chat/ui/rows/ForksRow.tsx +3 -3
- package/src/chat/ui/rows/GeneratedImageRow.tsx +7 -7
- package/src/chat/ui/rows/MessageRows.tsx +57 -33
- package/src/chat/ui/rows/RowContainer.tsx +1 -1
- package/src/chat/ui/rows/Rows.tsx +7 -4
- package/src/chat/ui/rows/SubagentRow.tsx +16 -16
- package/src/chat/ui/rows/TaskRow.tsx +4 -4
- package/src/chat/ui/rows/VisualRow.tsx +2 -2
- package/src/chat/ui/rows/WorkRows.tsx +44 -32
- package/src/chat/ui/rows/WorkflowRow.tsx +9 -9
- package/src/chat/ui/rows/row-rhythm.ts +1 -1
- package/src/chat/ui/use-diff-source-tokens.ts +1 -1
- package/src/chat/ui/visual-theme.ts +2 -2
- package/src/chat/workflow-list.ts +1 -1
- package/src/host.ts +6 -6
- package/src/lazy.tsx +1 -1
- package/src/locales/en/agent-chat.ts +4 -0
- package/src/locales/nl/agent-chat.ts +4 -0
- package/src/port-transport.ts +1 -1
- package/src/prompts/logic/subjects.ts +1 -1
- package/src/prompts/ui/ApprovalBody.tsx +19 -9
- package/src/prompts/ui/PromptActions.tsx +2 -2
- package/src/prompts/ui/PromptCard.tsx +4 -4
- package/src/prompts/ui/PromptView.tsx +1 -1
- package/src/prompts/ui/QuestionBody.tsx +5 -5
- package/src/providers/AccountDetail.tsx +5 -5
- package/src/providers/AccountOrderList.tsx +2 -2
- package/src/providers/AccountVariables.tsx +4 -4
- package/src/providers/AddAccountForm.tsx +7 -7
- package/src/providers/CliDetail.tsx +9 -9
- package/src/providers/InstallPage.tsx +4 -4
- package/src/providers/ProviderList.tsx +4 -4
- package/src/providers/ProvidersPane.tsx +7 -7
- package/src/providers/account-actions.ts +1 -1
- package/src/providers/install-steps.ts +1 -1
- package/src/providers/parts.tsx +1 -1
- package/src/providers/provider-abilities.ts +1 -1
- package/src/providers/provider-groups.ts +1 -1
- package/src/providers/variables.ts +1 -1
- package/src/settings/sections.ts +2 -2
- package/src/state/chats.ts +2 -2
- package/src/state/provider-accounts.ts +1 -1
- package/src/state/providers.ts +1 -1
- package/src/state/usage.ts +2 -2
- package/src/theme.css +4 -4
- package/src/transport.ts +1 -1
- package/src/usage/LimitsList.tsx +5 -5
- package/src/usage/UsageBreakdown.tsx +6 -6
- package/src/usage/UsageChart.tsx +2 -2
- package/src/usage/UsageDialog.tsx +2 -2
- package/src/usage/UsageLimits.tsx +7 -7
- package/src/usage/UsageLimitsCard.tsx +2 -2
- package/src/usage/UsagePage.tsx +5 -5
- package/src/usage/UsagePane.tsx +2 -2
- package/src/usage/UsageSummary.tsx +2 -2
- package/src/usage/UsageTiles.tsx +1 -1
- package/src/usage/limit-groups.ts +2 -2
- package/src/usage/limits.ts +1 -1
- package/src/usage/summary.ts +1 -1
- package/dist/chat/logic/json.d.ts +0 -1
- package/dist/chat/logic/json.js +0 -4
- package/src/chat/logic/json.ts +0 -4
|
@@ -1,26 +1,26 @@
|
|
|
1
|
+
import { EmptyState, ContextMenu, Icon, ScrollArea } from '@adecore/ui';
|
|
2
|
+
import { Bot, LoaderCircle } from 'lucide-react';
|
|
1
3
|
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
2
4
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import {
|
|
5
|
+
import { useChatHost } from '../../host';
|
|
6
|
+
import { useHostHidesToolCalls } from '../../host-hooks';
|
|
7
|
+
import { useChatScope } from '../../scope';
|
|
8
|
+
import { useChatRow } from '../../state/chats';
|
|
4
9
|
import { deriveTimelineRows } from '../logic/timeline';
|
|
10
|
+
import { EMPTY_TARGET, readTimelineTarget, type TimelineTarget } from '../logic/timeline-target';
|
|
11
|
+
import { useChatPreferences } from '../preferences';
|
|
12
|
+
import { readingWidthStyle } from '../reading-width';
|
|
5
13
|
import { INITIAL_CONVERSATION, SubagentConversation, type SubagentConversationState } from '../subagent-conversation';
|
|
6
14
|
import { useSubagentSupport } from '../subagent-support';
|
|
7
|
-
import { firstRowInView, restoreAnchor, wantsEarlier, type ReadingAnchor } from '../timeline-scroll';
|
|
8
|
-
import { EMPTY_TARGET, readTimelineTarget, type TimelineTarget } from '../logic/timeline-target';
|
|
9
15
|
import { openBelow, useSubagentTrail, type SubagentStep } from '../subagent-view';
|
|
10
|
-
import {
|
|
16
|
+
import { firstRowInView, restoreAnchor, wantsEarlier, type ReadingAnchor } from '../timeline-scroll';
|
|
17
|
+
import { FileLinkContext } from './file-links';
|
|
11
18
|
import { ReplyContext } from './reply-context';
|
|
19
|
+
import { FOLLOW_THRESHOLD_PX, rowRhythm } from './rows/row-rhythm';
|
|
20
|
+
import { Row } from './rows/Rows';
|
|
12
21
|
import { SubagentInfo } from './SubagentInfo';
|
|
13
22
|
import { TimelineMenuPopup } from './TimelineMenu';
|
|
14
|
-
import { FOLLOW_THRESHOLD_PX, rowRhythm } from './rows/row-rhythm';
|
|
15
23
|
import { useToggleSet } from './useToggleSet';
|
|
16
|
-
import { FileLinkContext } from './file-links';
|
|
17
|
-
import { useChatRow } from '../../state/chats';
|
|
18
|
-
import { useChatPreferences } from '../preferences';
|
|
19
|
-
import { readingWidthStyle } from '../reading-width';
|
|
20
|
-
import { useChatHost } from '../../host';
|
|
21
|
-
import { useHostHidesToolCalls } from '../../host-hooks';
|
|
22
|
-
import { useChatScope } from '../../scope';
|
|
23
|
-
import { EmptyState, ContextMenu, Icon } from '@adecore/ui';
|
|
24
24
|
|
|
25
25
|
const NO_TURNS = new Set<string>();
|
|
26
26
|
|
|
@@ -155,11 +155,14 @@ export function SubagentTimeline({
|
|
|
155
155
|
{state.status === 'ready' && (
|
|
156
156
|
<FileLinkContext.Provider value={state.context?.cwd ?? cwd}>
|
|
157
157
|
<ReplyContext.Provider value={state.context ?? { provider: state.source === 'codex-thread' ? 'codex' : 'claude' }}>
|
|
158
|
-
<
|
|
159
|
-
|
|
158
|
+
<ScrollArea
|
|
159
|
+
// Like the main thread: wide code and diffs scroll in their own box.
|
|
160
|
+
axis="y"
|
|
161
|
+
viewportRef={scrollRef}
|
|
160
162
|
data-file-cwd={state.context?.cwd ?? cwd ?? ''}
|
|
161
163
|
data-file-scope-id={scope.id}
|
|
162
|
-
className="
|
|
164
|
+
className="grow"
|
|
165
|
+
viewportClassName="chat-thread relative px-4 pt-4 pb-3"
|
|
163
166
|
// The thread keeps its reader in place itself when a page goes in above.
|
|
164
167
|
style={{ overflowAnchor: 'none' }}
|
|
165
168
|
onScroll={(event) => {
|
|
@@ -203,7 +206,7 @@ export function SubagentTimeline({
|
|
|
203
206
|
</ContextMenu.Trigger>
|
|
204
207
|
<TimelineMenuPopup target={target} thread={threadRef} />
|
|
205
208
|
</ContextMenu.Root>
|
|
206
|
-
</
|
|
209
|
+
</ScrollArea>
|
|
207
210
|
</ReplyContext.Provider>
|
|
208
211
|
</FileLinkContext.Provider>
|
|
209
212
|
)}
|
package/src/chat/ui/Timeline.tsx
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type { ChatBookmark } from '@adecore/agent-contracts';
|
|
2
|
+
import { ContextMenu, EmptyState, ErrorBoundary, Icon, ScrollArea, SectionLabel } from '@adecore/ui';
|
|
3
|
+
import { defaultRangeExtractor, useVirtualizer, type Virtualizer } from '@tanstack/react-virtual';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { LoaderCircle } from 'lucide-react';
|
|
1
6
|
import {
|
|
2
7
|
type CSSProperties,
|
|
3
8
|
memo,
|
|
@@ -12,29 +17,15 @@ import {
|
|
|
12
17
|
type ReactNode
|
|
13
18
|
} from 'react';
|
|
14
19
|
import { useTranslation } from 'react-i18next';
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
20
|
+
import { AgentIcon } from '../../agents/AgentIcon';
|
|
21
|
+
import { useModelName } from '../../agents/model-name';
|
|
22
|
+
import { useChatHost, type TimelineFindOptions } from '../../host';
|
|
23
|
+
import { useHostContextSources, useHostHidesFolder, useHostHidesToolCalls, useHostThreadCards, useHostTimelineFind, useHostWelcome } from '../../host-hooks';
|
|
24
|
+
import { useChatScope } from '../../scope';
|
|
25
|
+
import { useChatRow, useChats } from '../../state/chats';
|
|
19
26
|
import { useForkedTurns } from '../forks';
|
|
20
27
|
import { bookmarkRows } from '../logic/bookmarks';
|
|
21
|
-
import {
|
|
22
|
-
import { timedRowsOf, withTimedRows } from '../logic/thread-cards';
|
|
23
|
-
import { openFromMain, useSubagentTrail, type SubagentStep } from '../subagent-view';
|
|
24
|
-
import {
|
|
25
|
-
registerItemJumper,
|
|
26
|
-
registerMessageStepper,
|
|
27
|
-
registerTimeline,
|
|
28
|
-
registerTurnJumper,
|
|
29
|
-
setTimelineAtEnd,
|
|
30
|
-
wantsEarlier,
|
|
31
|
-
type ItemJumpOptions,
|
|
32
|
-
type ReadingAnchor,
|
|
33
|
-
type TurnTarget
|
|
34
|
-
} from '../timeline-scroll';
|
|
35
|
-
import { useTimelineFlash } from '../timeline-flash';
|
|
36
|
-
import { useChatPreferences } from '../preferences';
|
|
37
|
-
import { readingMeasure, readingWidthStyle } from '../reading-width';
|
|
28
|
+
import { forkRefusal } from '../logic/fork';
|
|
38
29
|
import {
|
|
39
30
|
SCRUBBER_MIN_TICKS,
|
|
40
31
|
STRIP_INSET_PX,
|
|
@@ -48,6 +39,8 @@ import {
|
|
|
48
39
|
ticksWithHits,
|
|
49
40
|
EARLIER_ROW
|
|
50
41
|
} from '../logic/scrubber';
|
|
42
|
+
import { timedRowsOf, withTimedRows } from '../logic/thread-cards';
|
|
43
|
+
import { deriveTimelineRows, findSubagentBranch, type TimelineRow } from '../logic/timeline';
|
|
51
44
|
import {
|
|
52
45
|
EMPTY_TARGET,
|
|
53
46
|
readTimelineTarget,
|
|
@@ -57,32 +50,41 @@ import {
|
|
|
57
50
|
type TimelineTarget,
|
|
58
51
|
type UiReplyTarget
|
|
59
52
|
} from '../logic/timeline-target';
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
53
|
+
import { useChatPreferences } from '../preferences';
|
|
54
|
+
import { readingMeasure, readingWidthStyle } from '../reading-width';
|
|
55
|
+
import { openFromMain, useSubagentTrail, type SubagentStep } from '../subagent-view';
|
|
56
|
+
import { useTimelineFlash } from '../timeline-flash';
|
|
57
|
+
import {
|
|
58
|
+
registerItemJumper,
|
|
59
|
+
registerMessageStepper,
|
|
60
|
+
registerTimeline,
|
|
61
|
+
registerTurnJumper,
|
|
62
|
+
setTimelineAtEnd,
|
|
63
|
+
wantsEarlier,
|
|
64
|
+
type ItemJumpOptions,
|
|
65
|
+
type ReadingAnchor,
|
|
66
|
+
type TurnTarget
|
|
67
|
+
} from '../timeline-scroll';
|
|
63
68
|
import { BookmarkMarker } from './BookmarkMarker';
|
|
69
|
+
import { FileLinkContext } from './file-links';
|
|
70
|
+
import { FindRevealContext } from './find-reveal';
|
|
64
71
|
import { MessageActions } from './MessageActions';
|
|
72
|
+
import { QuoteTakerContext, type QuoteTaker } from './quote-selection';
|
|
73
|
+
import { QuoteButton } from './QuoteButton';
|
|
74
|
+
import { UiReplyNavigationContext } from './reply-context';
|
|
75
|
+
import { ReplyHeader } from './rows/MessageRows';
|
|
76
|
+
import { FOLLOW_THRESHOLD_PX, replyHeader } from './rows/row-rhythm';
|
|
77
|
+
import { RowContainer } from './rows/RowContainer';
|
|
78
|
+
import { Row, type RowProps } from './rows/Rows';
|
|
65
79
|
import { Scrubber, type CardChat } from './Scrubber';
|
|
66
80
|
import { TimelineMenuPopup } from './TimelineMenu';
|
|
67
|
-
import { VisualDialogs } from './VisualDialogs';
|
|
68
|
-
import { FOLLOW_THRESHOLD_PX, replyHeader } from './rows/row-rhythm';
|
|
69
|
-
import { QuoteButton } from './QuoteButton';
|
|
70
|
-
import { QuoteTakerContext, type QuoteTaker } from './quote-selection';
|
|
71
81
|
import { useToggleSet } from './useToggleSet';
|
|
82
|
+
import { VisualDialogs } from './VisualDialogs';
|
|
72
83
|
import { WelcomeGreeting } from './Welcome';
|
|
73
|
-
import { Row, type RowProps } from './rows/Rows';
|
|
74
|
-
import { RowContainer } from './rows/RowContainer';
|
|
75
|
-
import { ReplyHeader } from './rows/MessageRows';
|
|
76
|
-
import { useChatRow, useChats } from '../../state/chats';
|
|
77
|
-
import { useChatHost, type TimelineFindOptions } from '../../host';
|
|
78
|
-
import { useChatScope } from '../../scope';
|
|
79
|
-
import { FileLinkContext } from './file-links';
|
|
80
|
-
import { AgentIcon } from '../../agents/AgentIcon';
|
|
81
|
-
import { useModelName } from '../../agents/model-name';
|
|
82
|
-
import { ContextMenu, EmptyState, ErrorBoundary, Icon, SectionLabel } from '@adecore/ui';
|
|
83
|
-
import { useHostContextSources, useHostHidesFolder, useHostHidesToolCalls, useHostThreadCards, useHostTimelineFind, useHostWelcome } from '../../host-hooks';
|
|
84
84
|
|
|
85
85
|
const ESTIMATED_ROW_PX = 56;
|
|
86
|
+
// A wheel that counts in lines rather than pixels moves this far per line.
|
|
87
|
+
const WHEEL_LINE_PX = 16;
|
|
86
88
|
// How long a jump waits for a thread that is still loading before it calls the item missing.
|
|
87
89
|
const JUMP_THREAD_WAIT_MS = 8000;
|
|
88
90
|
|
|
@@ -92,6 +94,34 @@ function showRowAtTop(virtualizer: Virtualizer<HTMLDivElement, Element>, followR
|
|
|
92
94
|
virtualizer.scrollToIndex(index, { align: 'start' });
|
|
93
95
|
}
|
|
94
96
|
|
|
97
|
+
/* What of the composer's height covers the thread: all of it while it fits, none in a welcome or once it fills the frame. */
|
|
98
|
+
function coveredBy(composerHeight: number, frameHeight: number, welcome: boolean): number {
|
|
99
|
+
return !welcome && composerHeight < frameHeight - FOLLOW_THRESHOLD_PX ? composerHeight : 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Whether a wheel over `target` moves a scroller between it and `boundary`, such as a long draft. */
|
|
103
|
+
function scrollsWithin(target: Element, boundary: Element, deltaX: number, deltaY: number): boolean {
|
|
104
|
+
for (let element: Element | null = target; element !== null; element = element.parentElement) {
|
|
105
|
+
const { overflowX, overflowY } = getComputedStyle(element);
|
|
106
|
+
const scrollsY = (overflowY === 'auto' || overflowY === 'scroll') && element.scrollHeight > element.clientHeight;
|
|
107
|
+
const scrollsX = (overflowX === 'auto' || overflowX === 'scroll') && element.scrollWidth > element.clientWidth;
|
|
108
|
+
|
|
109
|
+
if (scrollsY && (deltaY < 0 ? element.scrollTop > 0 : deltaY > 0 && element.scrollTop + element.clientHeight < element.scrollHeight)) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (scrollsX && (deltaX < 0 ? element.scrollLeft > 0 : deltaX > 0 && element.scrollLeft + element.clientWidth < element.scrollWidth)) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (element === boundary) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
|
|
95
125
|
/*
|
|
96
126
|
* A thread before its first message: which model answers, what the lines into this node let it read,
|
|
97
127
|
* and the folder it works in, so a first question can lean on all three.
|
|
@@ -250,6 +280,7 @@ export function Timeline({
|
|
|
250
280
|
const { trail, show } = useSubagentTrail(chatId);
|
|
251
281
|
const frameRef = useRef<HTMLDivElement>(null);
|
|
252
282
|
const composerRef = useRef<HTMLDivElement>(null);
|
|
283
|
+
const spacerRef = useRef<HTMLDivElement>(null);
|
|
253
284
|
const [composerHeight, setComposerHeight] = useState(0);
|
|
254
285
|
const [frame, setFrame] = useState({ width: 0, height: 0, column: false });
|
|
255
286
|
const [loadingEarlier, setLoadingEarlier] = useState(false);
|
|
@@ -363,6 +394,9 @@ export function Timeline({
|
|
|
363
394
|
return () => observer.disconnect();
|
|
364
395
|
}, []);
|
|
365
396
|
|
|
397
|
+
const coverRef = useRef({ frameHeight: frame.height, welcome });
|
|
398
|
+
coverRef.current = { frameHeight: frame.height, welcome };
|
|
399
|
+
|
|
366
400
|
useLayoutEffect(() => {
|
|
367
401
|
const element = composerRef.current;
|
|
368
402
|
|
|
@@ -370,7 +404,24 @@ export function Timeline({
|
|
|
370
404
|
return;
|
|
371
405
|
}
|
|
372
406
|
|
|
373
|
-
|
|
407
|
+
// The composer lies outside the scroller, so the space under the thread follows its height here,
|
|
408
|
+
// before the page paints, and the end with it; the state is drawn only after that paint.
|
|
409
|
+
const measure = () => {
|
|
410
|
+
const height = element.offsetHeight;
|
|
411
|
+
const spacer = spacerRef.current;
|
|
412
|
+
const scroller = scrollRef.current;
|
|
413
|
+
|
|
414
|
+
if (spacer !== null && scroller !== null) {
|
|
415
|
+
spacer.style.height = `${coveredBy(height, coverRef.current.frameHeight, coverRef.current.welcome)}px`;
|
|
416
|
+
|
|
417
|
+
if (followRef.current) {
|
|
418
|
+
scroller.scrollTop = scroller.scrollHeight;
|
|
419
|
+
scrollGeometry.current = { top: scroller.scrollTop, height: scroller.scrollHeight, viewport: scroller.clientHeight };
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
setComposerHeight(height);
|
|
424
|
+
};
|
|
374
425
|
|
|
375
426
|
const observer = new ResizeObserver(measure);
|
|
376
427
|
observer.observe(element);
|
|
@@ -379,9 +430,9 @@ export function Timeline({
|
|
|
379
430
|
return () => observer.disconnect();
|
|
380
431
|
}, []);
|
|
381
432
|
|
|
382
|
-
//
|
|
383
|
-
const
|
|
384
|
-
const
|
|
433
|
+
// A composer that would leave too little of the thread covers the frame and scrolls by itself.
|
|
434
|
+
const coveredHeight = coveredBy(composerHeight, frame.height, welcome);
|
|
435
|
+
const fillsFrame = !welcome && coveredHeight === 0 && composerHeight > 0;
|
|
385
436
|
const coveredHeightRef = useRef(coveredHeight);
|
|
386
437
|
coveredHeightRef.current = coveredHeight;
|
|
387
438
|
|
|
@@ -481,15 +532,15 @@ export function Timeline({
|
|
|
481
532
|
return;
|
|
482
533
|
}
|
|
483
534
|
|
|
484
|
-
// The
|
|
535
|
+
// The space under the thread is the composer's height, so that height is part of this end position.
|
|
485
536
|
element.scrollTop = element.scrollHeight;
|
|
486
537
|
scrollGeometry.current = { top: element.scrollTop, height: element.scrollHeight, viewport: element.clientHeight };
|
|
487
538
|
}, [rows.length, totalSize, composerHeight, frame.height]);
|
|
488
539
|
|
|
489
540
|
/*
|
|
490
|
-
* A
|
|
491
|
-
*
|
|
492
|
-
*
|
|
541
|
+
* A row measured again after the first paint is seen by an observer before the page paints, but the
|
|
542
|
+
* state it sets is drawn after that paint. The end is pinned here as well, so the page never paints
|
|
543
|
+
* the thread with its end out of view.
|
|
493
544
|
*/
|
|
494
545
|
useLayoutEffect(() => {
|
|
495
546
|
const content = contentRef.current;
|
|
@@ -895,110 +946,148 @@ export function Timeline({
|
|
|
895
946
|
data-file-scope-id={scope.id}
|
|
896
947
|
>
|
|
897
948
|
{searching && chatFind.bar}
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
949
|
+
{/* A welcome centers the greeting and the composer as one group. The composer keeps its
|
|
950
|
+
place in the tree, so the first message does not mount it again. */}
|
|
951
|
+
<div className={clsx('relative flex min-h-0 grow flex-col', welcome && 'justify-center')}>
|
|
952
|
+
<ContextMenu.Root>
|
|
953
|
+
<ScrollArea
|
|
954
|
+
// Only down: wide content such as code and diffs scrolls in its own box, so a thread never moves sideways.
|
|
955
|
+
axis="y"
|
|
956
|
+
viewportRef={scrollRef}
|
|
957
|
+
className={clsx(!welcome && 'grow')}
|
|
958
|
+
viewportClassName="chat-scroll"
|
|
959
|
+
coveredBottom={coveredHeight}
|
|
960
|
+
// The thread keeps its reader in place itself when a page goes in above.
|
|
961
|
+
style={{ overflowAnchor: 'none' }}
|
|
962
|
+
onScrollCapture={(e) => {
|
|
963
|
+
const el = e.currentTarget;
|
|
964
|
+
// Capture the reader's movement before virtualization remeasures rows and shifts the scroll offset.
|
|
965
|
+
const previous = scrollGeometry.current;
|
|
966
|
+
const layoutChanged = previous.height !== el.scrollHeight || previous.viewport !== el.clientHeight;
|
|
967
|
+
const atEnd = el.scrollHeight - el.scrollTop - el.clientHeight < FOLLOW_THRESHOLD_PX;
|
|
968
|
+
|
|
969
|
+
if (!layoutChanged && el.scrollTop < previous.top) {
|
|
970
|
+
followRef.current = false;
|
|
971
|
+
} else if (atEnd) {
|
|
972
|
+
followRef.current = true;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
scrollGeometry.current = { top: el.scrollTop, height: el.scrollHeight, viewport: el.clientHeight };
|
|
976
|
+
setTimelineAtEnd(chatId, followRef.current);
|
|
918
977
|
|
|
919
|
-
|
|
920
|
-
|
|
978
|
+
if (wantsEarlier(el)) {
|
|
979
|
+
loadEarlier();
|
|
980
|
+
}
|
|
921
981
|
|
|
922
|
-
|
|
923
|
-
|
|
982
|
+
followStrip(el);
|
|
983
|
+
}}
|
|
984
|
+
>
|
|
985
|
+
<div ref={contentRef} className="relative flex min-h-full flex-col">
|
|
986
|
+
<ContextMenu.Trigger
|
|
987
|
+
ref={threadRef}
|
|
988
|
+
className={clsx('chat-thread flex flex-col px-4 pt-4', !welcome && 'grow')}
|
|
989
|
+
style={
|
|
990
|
+
{
|
|
991
|
+
paddingLeft,
|
|
992
|
+
'--chat-wide-inset': `${2 * (showsScrubber ? STRIP_CLEARANCE_PX : paddingLeft) - paddingLeft}px`
|
|
993
|
+
} as CSSProperties
|
|
994
|
+
}
|
|
995
|
+
inert={overlay ? true : undefined}
|
|
996
|
+
onContextMenu={(e) =>
|
|
997
|
+
setTarget(readTimelineTarget(e.target as HTMLElement, threadRef.current, withCurrentText(rows, fullItems())))
|
|
998
|
+
}
|
|
999
|
+
>
|
|
1000
|
+
{loadingHistory ? (
|
|
1001
|
+
<div className="flex grow items-center justify-center gap-2 text-sm text-text-muted" role="status">
|
|
1002
|
+
<Icon icon={LoaderCircle} size={16} className="animate-spin" />
|
|
1003
|
+
<span>{t('timeline.loading')}</span>
|
|
1004
|
+
</div>
|
|
1005
|
+
) : welcome ? (
|
|
1006
|
+
<WelcomeGreeting chatId={chatId} />
|
|
1007
|
+
) : empty ? (
|
|
1008
|
+
<EmptyThread chatId={chatId} />
|
|
1009
|
+
) : (
|
|
1010
|
+
<div
|
|
1011
|
+
className="relative w-full shrink-0"
|
|
1012
|
+
style={{ height: totalSize, visibility: initialLayout ? 'hidden' : undefined }}
|
|
1013
|
+
>
|
|
1014
|
+
<UiReplyNavigationContext.Provider value={uiNavigation}>
|
|
1015
|
+
<FindRevealContext.Provider value={chatFind.reveal}>
|
|
1016
|
+
{virtualRows.map((virtualRow) => {
|
|
1017
|
+
const row = rows[virtualRow.index]!;
|
|
1018
|
+
|
|
1019
|
+
return (
|
|
1020
|
+
<ThreadRow
|
|
1021
|
+
key={row.id}
|
|
1022
|
+
row={row}
|
|
1023
|
+
previous={virtualRow.index > 0 ? rows[virtualRow.index - 1]! : null}
|
|
1024
|
+
index={virtualRow.index}
|
|
1025
|
+
top={virtualRow.start}
|
|
1026
|
+
measure={virtualizer.measureElement}
|
|
1027
|
+
chatId={chatId}
|
|
1028
|
+
flashNonce={flash !== null && flashedRow === row.id ? flash.nonce : null}
|
|
1029
|
+
bookmark={marks.get(row.id) ?? null}
|
|
1030
|
+
toggleGroup={groups.toggle}
|
|
1031
|
+
toggleTurn={turns.toggle}
|
|
1032
|
+
toggleSubagent={subagents.toggle}
|
|
1033
|
+
openSubagent={openSubagent}
|
|
1034
|
+
openConversation={openConversation}
|
|
1035
|
+
/>
|
|
1036
|
+
);
|
|
1037
|
+
})}
|
|
1038
|
+
</FindRevealContext.Provider>
|
|
1039
|
+
</UiReplyNavigationContext.Provider>
|
|
1040
|
+
</div>
|
|
1041
|
+
)}
|
|
1042
|
+
</ContextMenu.Trigger>
|
|
1043
|
+
<QuoteButton thread={threadRef} frame={contentRef} taker={quoteTakerRef} />
|
|
1044
|
+
<div ref={spacerRef} className="shrink-0" style={{ height: coveredHeight }} aria-hidden />
|
|
1045
|
+
</div>
|
|
1046
|
+
</ScrollArea>
|
|
1047
|
+
<TimelineMenuPopup target={target} thread={threadRef} chatId={onMainAgent ? chatId : null} column={frame.column} />
|
|
1048
|
+
</ContextMenu.Root>
|
|
1049
|
+
{/*
|
|
1050
|
+
* Over the thread rather than in its scroller, so the thread bounces at its end and the
|
|
1051
|
+
* composer stays put. Its own stacking layer keeps the composer under the strip and the overlay.
|
|
1052
|
+
*/}
|
|
1053
|
+
<div
|
|
1054
|
+
className="isolate shrink-0"
|
|
1055
|
+
style={
|
|
1056
|
+
welcome
|
|
1057
|
+
? { position: 'relative' }
|
|
1058
|
+
: fillsFrame
|
|
1059
|
+
? { position: 'absolute', inset: 0, overflowY: 'auto' }
|
|
1060
|
+
: { position: 'absolute', insetInline: 0, bottom: 0 }
|
|
1061
|
+
}
|
|
1062
|
+
onWheel={(e) => {
|
|
1063
|
+
const scroller = scrollRef.current;
|
|
1064
|
+
|
|
1065
|
+
// A wheel over the composer moves the thread it lies over, as it did inside the scroller.
|
|
1066
|
+
if (
|
|
1067
|
+
scroller === null ||
|
|
1068
|
+
coveredHeight === 0 ||
|
|
1069
|
+
e.ctrlKey ||
|
|
1070
|
+
scrollsWithin(e.target as Element, e.currentTarget, e.deltaX, e.deltaY)
|
|
1071
|
+
) {
|
|
1072
|
+
return;
|
|
924
1073
|
}
|
|
925
1074
|
|
|
926
|
-
|
|
1075
|
+
const unit = e.deltaMode === 1 ? WHEEL_LINE_PX : e.deltaMode === 2 ? scroller.clientHeight : 1;
|
|
1076
|
+
scroller.scrollTop += e.deltaY * unit;
|
|
1077
|
+
scroller.scrollLeft += e.deltaX * unit;
|
|
927
1078
|
}}
|
|
928
1079
|
>
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
paddingLeft,
|
|
938
|
-
'--chat-wide-inset': `${2 * (showsScrubber ? STRIP_CLEARANCE_PX : paddingLeft) - paddingLeft}px`
|
|
939
|
-
} as CSSProperties
|
|
940
|
-
}
|
|
941
|
-
inert={overlay ? true : undefined}
|
|
942
|
-
onContextMenu={(e) =>
|
|
943
|
-
setTarget(readTimelineTarget(e.target as HTMLElement, threadRef.current, withCurrentText(rows, fullItems())))
|
|
944
|
-
}
|
|
945
|
-
>
|
|
946
|
-
{loadingHistory ? (
|
|
947
|
-
<div className="flex grow items-center justify-center gap-2 text-sm text-text-muted" role="status">
|
|
948
|
-
<Icon icon={LoaderCircle} size={16} className="animate-spin" />
|
|
949
|
-
<span>{t('timeline.loading')}</span>
|
|
950
|
-
</div>
|
|
951
|
-
) : welcome ? (
|
|
952
|
-
<WelcomeGreeting chatId={chatId} />
|
|
953
|
-
) : empty ? (
|
|
954
|
-
<EmptyThread chatId={chatId} />
|
|
955
|
-
) : (
|
|
956
|
-
<div className="relative w-full shrink-0" style={{ height: totalSize, visibility: initialLayout ? 'hidden' : undefined }}>
|
|
957
|
-
<UiReplyNavigationContext.Provider value={uiNavigation}>
|
|
958
|
-
<FindRevealContext.Provider value={chatFind.reveal}>
|
|
959
|
-
{virtualRows.map((virtualRow) => {
|
|
960
|
-
const row = rows[virtualRow.index]!;
|
|
961
|
-
|
|
962
|
-
return (
|
|
963
|
-
<ThreadRow
|
|
964
|
-
key={row.id}
|
|
965
|
-
row={row}
|
|
966
|
-
previous={virtualRow.index > 0 ? rows[virtualRow.index - 1]! : null}
|
|
967
|
-
index={virtualRow.index}
|
|
968
|
-
top={virtualRow.start}
|
|
969
|
-
measure={virtualizer.measureElement}
|
|
970
|
-
chatId={chatId}
|
|
971
|
-
flashNonce={flash !== null && flashedRow === row.id ? flash.nonce : null}
|
|
972
|
-
bookmark={marks.get(row.id) ?? null}
|
|
973
|
-
toggleGroup={groups.toggle}
|
|
974
|
-
toggleTurn={turns.toggle}
|
|
975
|
-
toggleSubagent={subagents.toggle}
|
|
976
|
-
openSubagent={openSubagent}
|
|
977
|
-
openConversation={openConversation}
|
|
978
|
-
/>
|
|
979
|
-
);
|
|
980
|
-
})}
|
|
981
|
-
</FindRevealContext.Provider>
|
|
982
|
-
</UiReplyNavigationContext.Provider>
|
|
983
|
-
</div>
|
|
984
|
-
)}
|
|
985
|
-
</ContextMenu.Trigger>
|
|
986
|
-
<QuoteButton thread={threadRef} frame={contentRef} taker={quoteTakerRef} />
|
|
987
|
-
<div
|
|
988
|
-
ref={composerRef}
|
|
989
|
-
// The card is translucent so the thread shows through it, but the pb-3 strip under it must stay opaque.
|
|
990
|
-
className={clsx(
|
|
991
|
-
'relative z-10 shrink-0',
|
|
992
|
-
composer && 'px-3 pb-3 pt-3 bg-[linear-gradient(to_bottom,transparent_calc(100%-12px),var(--surface)_calc(100%-12px))]'
|
|
993
|
-
)}
|
|
994
|
-
style={{ position: stickyComposer ? 'sticky' : 'relative', bottom: 0 }}
|
|
995
|
-
>
|
|
996
|
-
<QuoteTakerContext.Provider value={registerQuoteTaker}>{composer}</QuoteTakerContext.Provider>
|
|
997
|
-
</div>
|
|
1080
|
+
<div
|
|
1081
|
+
ref={composerRef}
|
|
1082
|
+
// The card is translucent so the thread shows through it, but the pb-3 strip under it must stay opaque.
|
|
1083
|
+
className={clsx(
|
|
1084
|
+
composer && 'px-3 pb-3 pt-3 bg-[linear-gradient(to_bottom,transparent_calc(100%-12px),var(--surface)_calc(100%-12px))]'
|
|
1085
|
+
)}
|
|
1086
|
+
>
|
|
1087
|
+
<QuoteTakerContext.Provider value={registerQuoteTaker}>{composer}</QuoteTakerContext.Provider>
|
|
998
1088
|
</div>
|
|
999
1089
|
</div>
|
|
1000
|
-
|
|
1001
|
-
</ContextMenu.Root>
|
|
1090
|
+
</div>
|
|
1002
1091
|
{drawsVisuals && <VisualDialogs chatId={chatId} />}
|
|
1003
1092
|
{loadingEarlier && !overlay && (
|
|
1004
1093
|
<div className="pointer-events-none absolute inset-x-0 top-3 z-10 flex justify-center" role="status">
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
+
import { ContextMenu, copyText, DisabledReason, EDIT_SHORTCUTS, Icon, Kbd, selectAllWithin } from '@adecore/ui';
|
|
2
|
+
import { BookmarkPlus, BookmarkX, Braces, Copy, Eye, FileText, GitFork, MessageSquare, MoveHorizontal, Pencil, Scan } from 'lucide-react';
|
|
1
3
|
import type { RefObject } from 'react';
|
|
2
4
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import {
|
|
5
|
+
import { useChatHost } from '../../host';
|
|
6
|
+
import { useChatScope } from '../../scope';
|
|
7
|
+
import { useChatRow } from '../../state/chats';
|
|
4
8
|
import { placeBookmark, removeBookmark, useBookmarkNaming } from '../bookmarks';
|
|
5
|
-
import { rememberReadingWidth, useChatPreferences } from '../preferences';
|
|
6
|
-
import { CHAT_READING_WIDTHS, readingWidthLabel, type ChatReadingWidth } from '../reading-width';
|
|
7
9
|
import { forkRefusal, turnIdOfRow } from '../logic/fork';
|
|
8
10
|
import { markdownOf, messageTextOf } from '../logic/timeline-copy';
|
|
9
11
|
import type { TimelineTarget } from '../logic/timeline-target';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { useChatRow } from '../../state/chats';
|
|
12
|
+
import { rememberReadingWidth, useChatPreferences } from '../preferences';
|
|
13
|
+
import { CHAT_READING_WIDTHS, readingWidthLabel, type ChatReadingWidth } from '../reading-width';
|
|
13
14
|
import { copyWithChips, rowClipboardChips } from './chip-clipboard';
|
|
14
15
|
import { useFileLinkCwd, useFileLinkScopeId, useOpenFileLink } from './file-links';
|
|
15
16
|
import { useReferenceLookup } from './thread-references';
|
|
16
|
-
import { ContextMenu, copyText, DisabledReason, EDIT_SHORTCUTS, Icon, Kbd, selectAllWithin } from '@adecore/ui';
|
|
17
17
|
|
|
18
18
|
/* The menu behind a right-click in a thread, mostly for copying: a whole message, a code block or an answer's markdown. */
|
|
19
19
|
export function TimelineMenuPopup({
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { LazyBoundary } from '@adecore/ui';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { useChatHost } from '../../host';
|
|
3
4
|
import { lazyNamed } from '../../lazy';
|
|
5
|
+
import type { UnifiedDiffProps } from './diff/diff-props';
|
|
4
6
|
import { diffSourceBudget, legacyDiffBudget, patchSourceBudget } from './diff/diff-source-budget';
|
|
7
|
+
import { DiffFallbackBoundary } from './diff/DiffFallbackBoundary';
|
|
5
8
|
import { DiffOmitted } from './diff/DiffOmitted';
|
|
6
9
|
import { DiffUnavailable } from './diff/DiffUnavailable';
|
|
7
10
|
import { RawDiff } from './diff/RawDiff';
|
|
8
|
-
import { DiffFallbackBoundary } from './diff/DiffFallbackBoundary';
|
|
9
|
-
import { useChatHost } from '../../host';
|
|
10
|
-
import type { UnifiedDiffProps } from './diff/diff-props';
|
|
11
11
|
|
|
12
12
|
const LegacyUnifiedDiff = lazyNamed(() => import('./diff/LegacyUnifiedDiff'), 'default', { prefetch: false });
|
|
13
13
|
const EditorPatchDiff = lazyNamed(() => import('./diff/EditorPatchDiff'), 'default');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
1
|
import type { ChatVisual } from '@adecore/agent-contracts';
|
|
4
2
|
import { CloseButton, Dialog, ErrorBoundary, PromptDialog } from '@adecore/ui';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { useChatScope } from '../../scope';
|
|
6
6
|
import { useChatRow } from '../../state/chats';
|
|
7
7
|
import { useVisualDialog } from '../visuals';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
1
|
import { VISUAL_LIMITS, visualThemeFragment, type ChatVisual, type VisualAppearance, type VisualTheme } from '@adecore/agent-contracts/visual';
|
|
5
2
|
import { Spinner, useMeasuredWidth } from '@adecore/ui';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
6
|
import { useChatHost } from '../../host';
|
|
7
7
|
import { useChatScope } from '../../scope';
|
|
8
|
-
import { DEFAULT_HEIGHT_PX, initialVisualContentHeight, rememberVisualHeight } from '../logic/visual-height';
|
|
9
8
|
import { imageDocumentForDisplay } from '../image-display';
|
|
9
|
+
import { DEFAULT_HEIGHT_PX, initialVisualContentHeight, rememberVisualHeight } from '../logic/visual-height';
|
|
10
10
|
import { VisualBridge } from '../visual-bridge';
|
|
11
11
|
import { VisualViewportController } from '../visual-viewport';
|
|
12
12
|
import { useVisualTheme } from './visual-theme';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import clsx from 'clsx';
|
|
2
|
-
import type { Ref } from 'react';
|
|
3
|
-
import { Bot, ChevronRight, X } from 'lucide-react';
|
|
4
1
|
import { workflowAgentRef, type AgentKind } from '@adecore/agent-contracts';
|
|
5
|
-
import { formatElapsedShort } from '@adecore/ui/format';
|
|
6
2
|
import { Icon, useTickingText } from '@adecore/ui';
|
|
3
|
+
import { formatElapsedShort } from '@adecore/ui/format';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { Bot, ChevronRight, X } from 'lucide-react';
|
|
6
|
+
import type { Ref } from 'react';
|
|
7
7
|
import { AgentIcon } from '../../agents/AgentIcon';
|
|
8
8
|
import { workflowAgentPreview, workflowAgentTime, type WorkflowAgentState, type WorkflowAgentView } from '../logic/workflow';
|
|
9
9
|
import type { SubagentStep } from '../subagent-view';
|