@adecore/agents-react 0.62.1 → 0.63.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/AccountDot.js +1 -1
- package/dist/agents/AgentIcon.js +43 -51
- package/dist/agents/accounts.d.ts +3 -6
- package/dist/agents/model-name.d.ts +2 -1
- package/dist/agents/model-requirement.d.ts +2 -1
- package/dist/agents/provider-paths.d.ts +1 -1
- package/dist/agents/status-look.d.ts +3 -2
- package/dist/chat/account-choice.d.ts +2 -1
- package/dist/chat/account-choice.js +2 -1
- package/dist/chat/actions.d.ts +1 -3
- package/dist/chat/actions.js +2 -2
- package/dist/chat/attachments.js +0 -2
- package/dist/chat/bookmarks.d.ts +1 -1
- package/dist/chat/chat-references.d.ts +1 -30
- package/dist/chat/chat-references.js +0 -12
- package/dist/chat/drafts.js +1 -1
- package/dist/chat/forks.js +0 -2
- package/dist/chat/guards.js +0 -1
- package/dist/chat/index.d.ts +20 -24
- package/dist/chat/index.js +6 -6
- package/dist/chat/logic/ansi.d.ts +2 -1
- package/dist/chat/logic/bookmarks.d.ts +1 -1
- package/dist/chat/logic/command-looks.d.ts +4 -3
- package/dist/chat/logic/command-looks.js +0 -2
- package/dist/chat/logic/context-usage.d.ts +2 -2
- package/dist/chat/logic/context-usage.js +1 -1
- package/dist/chat/logic/effort.d.ts +2 -1
- package/dist/chat/logic/embedded-code.d.ts +4 -3
- package/dist/chat/logic/embedded-code.js +0 -1
- package/dist/chat/logic/fork.d.ts +11 -6
- package/dist/chat/logic/fork.js +12 -9
- package/dist/chat/logic/generated-image.d.ts +2 -1
- package/dist/chat/logic/generated-image.js +0 -2
- package/dist/chat/logic/goal.d.ts +2 -1
- package/dist/chat/logic/limit.d.ts +2 -1
- package/dist/chat/logic/picker-entries.d.ts +4 -10
- package/dist/chat/logic/picker-entries.js +2 -13
- package/dist/chat/logic/resume-compaction.js +0 -1
- package/dist/chat/logic/scrubber.d.ts +5 -5
- package/dist/chat/logic/scrubber.js +1 -3
- package/dist/chat/logic/steer.d.ts +2 -0
- package/dist/chat/logic/steer.js +4 -0
- package/dist/chat/logic/thought.js +0 -1
- package/dist/chat/logic/thread-cards.d.ts +4 -4
- package/dist/chat/logic/thread-cards.js +1 -1
- package/dist/chat/logic/timeline-copy.d.ts +1 -1
- package/dist/chat/logic/timeline-copy.js +0 -2
- package/dist/chat/logic/timeline-target.d.ts +4 -3
- package/dist/chat/logic/timeline-target.js +0 -1
- package/dist/chat/logic/timeline.d.ts +3 -133
- package/dist/chat/logic/timeline.js +0 -2
- package/dist/chat/logic/tool-catalog.d.ts +2 -1
- package/dist/chat/logic/tool-looks.d.ts +4 -3
- package/dist/chat/logic/tool-looks.js +0 -1
- package/dist/chat/logic/tools.d.ts +3 -2
- package/dist/chat/logic/tools.js +11 -32
- package/dist/chat/logic/visual-height.js +0 -1
- package/dist/chat/logic/welcome.d.ts +2 -1
- package/dist/chat/logic/workflow.d.ts +3 -2
- package/dist/chat/logic/workflow.js +0 -1
- package/dist/chat/mentions.d.ts +3 -3
- package/dist/chat/mentions.js +1 -2
- package/dist/chat/pending-prompts.d.ts +1 -1
- package/dist/chat/preferences.js +1 -2
- package/dist/chat/prompt-hold.js +0 -1
- package/dist/chat/prompts/index.d.ts +11 -0
- package/dist/{prompts → chat/prompts}/index.js +2 -0
- package/dist/{prompts → chat/prompts}/logic/keys.d.ts +4 -3
- package/dist/{prompts → chat/prompts}/logic/prompts.d.ts +2 -26
- package/dist/{prompts → chat/prompts}/logic/prompts.js +1 -1
- package/dist/{prompts → chat/prompts}/logic/subjects.d.ts +2 -38
- package/dist/{prompts → chat/prompts}/logic/useFocusAfterAnswer.d.ts +2 -1
- package/dist/{prompts → chat/prompts}/logic/usePromptSession.d.ts +2 -2
- package/dist/{prompts → chat/prompts}/logic/usePromptSession.js +2 -1
- package/dist/{prompts → chat/prompts}/ui/ApprovalBody.d.ts +1 -5
- package/dist/{prompts → chat/prompts}/ui/ApprovalBody.js +5 -6
- package/dist/{prompts → chat/prompts}/ui/PromptActions.d.ts +2 -1
- package/dist/{prompts → chat/prompts}/ui/PromptActions.js +0 -1
- package/dist/{prompts → chat/prompts}/ui/PromptCard.d.ts +1 -1
- package/dist/{prompts → chat/prompts}/ui/PromptCard.js +1 -1
- package/dist/{prompts → chat/prompts}/ui/PromptView.d.ts +1 -1
- package/dist/{prompts → chat/prompts}/ui/PromptView.js +4 -2
- package/dist/{prompts → chat/prompts}/ui/QuestionBody.d.ts +1 -1
- package/dist/{prompts → chat/prompts}/ui/QuestionBody.js +2 -2
- package/dist/chat/reading-width.js +2 -1
- package/dist/chat/recent-messages.d.ts +2 -6
- package/dist/chat/recent-messages.js +1 -1
- package/dist/chat/send-key.js +0 -1
- package/dist/chat/stash.d.ts +3 -2
- package/dist/chat/stash.js +1 -1
- package/dist/chat/subagent-conversation.d.ts +0 -1
- package/dist/chat/subagent-conversation.js +1 -1
- package/dist/chat/subagent-list.d.ts +3 -3
- package/dist/chat/subagent-list.js +2 -6
- package/dist/chat/subagent-view.d.ts +1 -1
- package/dist/chat/subagent-view.js +0 -1
- package/dist/chat/tag-suggestions.d.ts +3 -4
- package/dist/chat/tag-suggestions.js +3 -3
- package/dist/chat/thumbnails.d.ts +2 -1
- package/dist/chat/thumbnails.js +0 -1
- package/dist/chat/timeline-flash.d.ts +1 -1
- package/dist/chat/ui/BookmarkMarker.js +1 -1
- package/dist/chat/ui/BookmarkSubmenu.js +2 -2
- package/dist/chat/ui/ChatActivity.js +8 -48
- package/dist/chat/ui/CodeBlock.js +1 -1
- package/dist/chat/ui/Composer.d.ts +1 -1
- package/dist/chat/ui/Composer.js +174 -209
- package/dist/chat/ui/ComposerInput.d.ts +1 -1
- package/dist/chat/ui/ComposerInput.js +1 -1
- package/dist/chat/ui/EditDiff.js +2 -3
- package/dist/chat/ui/GoalDock.js +1 -1
- package/dist/chat/ui/HostMenuItems.d.ts +1 -1
- package/dist/chat/ui/HostMenuItems.js +0 -1
- package/dist/chat/ui/ImageView.d.ts +3 -2
- package/dist/chat/ui/LimitState.js +2 -2
- package/dist/chat/ui/Markdown.d.ts +1 -1
- package/dist/chat/ui/Markdown.js +1 -2
- package/dist/chat/ui/MermaidBlock.js +1 -1
- package/dist/chat/ui/MessageActions.d.ts +1 -1
- package/dist/chat/ui/MessageActions.js +94 -88
- package/dist/chat/ui/Pickers.d.ts +1 -1
- package/dist/chat/ui/Pickers.js +4 -3
- package/dist/chat/ui/PromptComposer.d.ts +1 -1
- package/dist/chat/ui/PromptComposer.js +9 -8
- package/dist/chat/ui/PromptEditor.d.ts +1 -1
- package/dist/chat/ui/PromptEditor.js +1 -1
- package/dist/chat/ui/ReferenceChip.js +1 -1
- package/dist/chat/ui/ReferenceTrail.d.ts +2 -2
- package/dist/chat/ui/RunSettings.js +3 -3
- package/dist/chat/ui/SessionLine.d.ts +1 -1
- package/dist/chat/ui/SessionLine.js +2 -1
- package/dist/chat/ui/ShellCommand.d.ts +1 -1
- package/dist/chat/ui/ShellCommand.js +1 -3
- package/dist/chat/ui/SubagentInfo.js +4 -3
- package/dist/chat/ui/SubagentStopButton.js +1 -1
- package/dist/chat/ui/SubagentTimeline.js +2 -2
- package/dist/chat/ui/Timeline.js +6 -4
- package/dist/chat/ui/TimelineMenu.js +125 -119
- package/dist/chat/ui/UnifiedDiff.js +2 -3
- package/dist/chat/ui/VisualFrame.d.ts +3 -2
- package/dist/chat/ui/VisualFrame.js +1 -1
- package/dist/chat/ui/chip-clipboard.d.ts +1 -2
- package/dist/chat/ui/chip-clipboard.js +1 -1
- package/dist/chat/ui/code-theme.d.ts +1 -1
- package/dist/chat/ui/code-theme.js +2 -2
- package/dist/chat/ui/composer/ComposerControls.d.ts +0 -3
- package/dist/chat/ui/composer/ComposerControls.js +60 -215
- package/dist/chat/ui/composer/ComposerMenu.js +1 -1
- package/dist/chat/ui/composer/ComposerStatusLine.d.ts +1 -1
- package/dist/chat/ui/composer/DraftParts.js +0 -1
- package/dist/chat/ui/composer/chip-paste.d.ts +1 -1
- package/dist/chat/ui/composer/chip-paste.js +0 -1
- package/dist/chat/ui/composer/chips.d.ts +4 -3
- package/dist/chat/ui/composer/chips.js +0 -1
- package/dist/chat/ui/composer/editor.d.ts +2 -1
- package/dist/chat/ui/composer/key-handler.d.ts +1 -1
- package/dist/chat/ui/composer/key-handler.js +0 -1
- package/dist/chat/ui/composer/keys.d.ts +4 -3
- package/dist/chat/ui/composer/keys.js +0 -4
- package/dist/chat/ui/composer/placeholder.js +1 -1
- package/dist/chat/ui/composer/prompt-picks.d.ts +2 -2
- package/dist/chat/ui/composer/prompt-picks.js +1 -0
- package/dist/chat/ui/composer/use-chat-controls.js +2 -2
- package/dist/chat/ui/composer/use-composer-menus.d.ts +0 -1
- package/dist/chat/ui/composer/use-composer-menus.js +2 -2
- package/dist/chat/ui/composer/use-composer-submit.d.ts +1 -1
- package/dist/chat/ui/composer/use-composer-submit.js +1 -1
- package/dist/chat/ui/composer/use-continuable-turn.js +0 -1
- package/dist/chat/ui/composer/use-draft-files.d.ts +1 -1
- package/dist/chat/ui/composer/use-draft-files.js +1 -1
- package/dist/chat/ui/composer/use-pending-requests.d.ts +1 -1
- package/dist/chat/ui/composer/use-prompt-menus.d.ts +6 -5
- package/dist/chat/ui/composer/use-prompt-menus.js +3 -2
- package/dist/chat/ui/composer/use-take-back.js +1 -2
- package/dist/chat/ui/diff/EditorEditDiff.js +1 -1
- package/dist/chat/ui/diff/LegacyDiffPool.js +1 -1
- package/dist/chat/ui/diff/LegacyEditDiff.js +1 -1
- package/dist/chat/ui/diff/LegacyUnifiedDiff.js +1 -1
- package/dist/chat/ui/diff/ReviewDiff.js +1 -2
- package/dist/chat/ui/diff/diff-source-budget.d.ts +0 -7
- package/dist/chat/ui/diff/diff-source-budget.js +1 -1
- package/dist/chat/ui/diff/review-plan.d.ts +2 -2
- package/dist/chat/ui/diff/review-plan.js +1 -1
- package/dist/chat/ui/diff/syntax-runtime.d.ts +1 -1
- package/dist/chat/ui/diff-theme.js +2 -2
- package/dist/chat/ui/file-links.d.ts +1 -1
- package/dist/chat/ui/file-links.js +1 -2
- package/dist/chat/ui/highlighter.d.ts +1 -1
- package/dist/chat/ui/highlighter.js +1 -2
- package/dist/chat/ui/index.d.ts +9 -17
- package/dist/chat/ui/index.js +3 -9
- package/dist/chat/ui/intelligent-ui/UiBlockFrame.d.ts +2 -1
- package/dist/chat/ui/intelligent-ui/UiBlockFrame.js +1 -1
- package/dist/chat/ui/intelligent-ui/UiFallbackPart.d.ts +2 -1
- package/dist/chat/ui/intelligent-ui/UiReply.js +1 -1
- package/dist/chat/ui/intelligent-ui/chart-data.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 +0 -2
- package/dist/chat/ui/intelligent-ui/renderers/choices.js +1 -1
- package/dist/chat/ui/intelligent-ui/renderers/content.d.ts +2 -1
- package/dist/chat/ui/intelligent-ui/renderers/content.js +2 -2
- package/dist/chat/ui/intelligent-ui/renderers/inputs.js +0 -1
- package/dist/chat/ui/intelligent-ui/renderers/links.d.ts +1 -5
- package/dist/chat/ui/intelligent-ui/renderers/links.js +1 -1
- package/dist/chat/ui/intelligent-ui/renderers/map-slots.d.ts +2 -2
- package/dist/chat/ui/intelligent-ui/renderers/map-slots.js +1 -1
- package/dist/chat/ui/intelligent-ui/renderers/map-style.d.ts +3 -8
- package/dist/chat/ui/intelligent-ui/renderers/map-style.js +3 -5
- package/dist/chat/ui/intelligent-ui/renderers/map-view.d.ts +1 -1
- package/dist/chat/ui/intelligent-ui/renderers/map-view.js +2 -2
- package/dist/chat/ui/intelligent-ui/renderers/map.js +3 -4
- package/dist/chat/ui/intelligent-ui/reply-parts.d.ts +2 -1
- package/dist/chat/ui/intelligent-ui/table-data.d.ts +2 -1
- package/dist/chat/ui/intelligent-ui/use-ui-links.js +1 -1
- package/dist/chat/ui/intelligent-ui/use-ui-queries.js +1 -1
- package/dist/chat/ui/markdown-blocks.js +0 -1
- package/dist/chat/ui/named-chip-look.d.ts +1 -1
- package/dist/chat/ui/named-chip-look.js +1 -1
- package/dist/chat/ui/reference-icons.d.ts +2 -2
- package/dist/chat/ui/reference-lookup.d.ts +2 -2
- package/dist/chat/ui/rehype-fade.js +0 -1
- package/dist/chat/ui/reveal.d.ts +2 -3
- package/dist/chat/ui/reveal.js +2 -2
- package/dist/chat/ui/rows/ForksRow.js +1 -1
- package/dist/chat/ui/rows/GeneratedImageRow.js +2 -2
- package/dist/chat/ui/rows/MessageRows.d.ts +1 -1
- package/dist/chat/ui/rows/MessageRows.js +2 -3
- package/dist/chat/ui/rows/RowContainer.d.ts +3 -2
- package/dist/chat/ui/rows/RowContainer.js +1 -1
- package/dist/chat/ui/rows/Rows.d.ts +1 -1
- package/dist/chat/ui/rows/SubagentRow.d.ts +2 -2
- package/dist/chat/ui/rows/SubagentRow.js +6 -6
- package/dist/chat/ui/rows/TaskRow.d.ts +1 -1
- package/dist/chat/ui/rows/VisualRow.js +1 -1
- package/dist/chat/ui/rows/WorkRows.d.ts +3 -2
- package/dist/chat/ui/rows/WorkRows.js +4 -8
- package/dist/chat/ui/rows/WorkflowRow.js +1 -1
- package/dist/chat/ui/rows/row-rhythm.d.ts +1 -1
- package/dist/chat/ui/rows/row-rhythm.js +1 -0
- package/dist/chat/ui/thread-references.d.ts +0 -2
- package/dist/chat/ui/thread-references.js +3 -3
- package/dist/chat/ui/use-diff-source-tokens.js +1 -1
- package/dist/chat/ui/useToggleSet.d.ts +2 -1
- package/dist/chat/ui/visual-theme.js +1 -1
- package/dist/chat/visual-bridge.js +0 -1
- package/dist/chat/waiting-on.js +1 -1
- package/dist/chat/workflow-list.d.ts +2 -1
- package/dist/{chat/chat-client.d.ts → chat-client.d.ts} +2 -2
- package/dist/{chat/chat-client.js → chat-client.js} +2 -2
- package/dist/chat-sink.d.ts +20 -0
- package/dist/chat-sink.js +1 -0
- package/dist/{ui → host}/PlainTextarea.d.ts +1 -1
- package/dist/{host-hooks.d.ts → host/host-hooks.d.ts} +3 -6
- package/dist/{host-hooks.js → host/host-hooks.js} +2 -13
- package/dist/{host.d.ts → host/host.d.ts} +27 -25
- package/dist/{host.js → host/host.js} +65 -32
- package/dist/host/prompts.d.ts +61 -0
- package/dist/host/prompts.js +1 -0
- package/dist/host/references.d.ts +31 -0
- package/dist/host/references.js +12 -0
- package/dist/host/timeline-row.d.ts +133 -0
- package/dist/host/timeline-row.js +1 -0
- package/dist/images.d.ts +1 -1
- package/dist/images.js +1 -1
- package/dist/index.d.ts +3 -5
- package/dist/index.js +1 -3
- package/dist/locales/en/agent-chat.d.ts +1 -1
- package/dist/locales/en/agent-chat.js +1 -1
- package/dist/locales/nl/agent-chat.d.ts +1 -1
- package/dist/locales/nl/agent-chat.js +1 -1
- package/dist/locales.d.ts +1 -1
- package/dist/{chat/persisted-json.d.ts → persisted-json.d.ts} +2 -1
- package/dist/{chat/persisted-json.js → persisted-json.js} +1 -1
- package/dist/providers/AccountColors.js +1 -2
- package/dist/providers/AccountDetail.js +2 -3
- package/dist/providers/AccountVariables.js +1 -1
- package/dist/providers/AddAccountForm.js +1 -1
- package/dist/providers/CliDetail.js +2 -3
- package/dist/providers/InstallPage.js +2 -3
- package/dist/providers/ProviderList.js +0 -1
- package/dist/providers/ProvidersPane.js +2 -3
- package/dist/providers/account-actions.d.ts +2 -3
- package/dist/providers/account-actions.js +1 -1
- package/dist/providers/index.d.ts +2 -4
- package/dist/providers/index.js +1 -1
- package/dist/providers/install-steps.js +0 -1
- package/dist/providers/provider-abilities.d.ts +1 -2
- package/dist/providers/provider-abilities.js +0 -5
- package/dist/providers/variables.js +0 -1
- package/dist/scope.d.ts +1 -1
- package/dist/settings/sections.d.ts +2 -1
- package/dist/state/chats.d.ts +2 -20
- package/dist/state/chats.js +0 -2
- package/dist/state/index.d.ts +4 -3
- package/dist/state/provider-accounts.js +0 -1
- package/dist/state/usage.d.ts +2 -2
- package/dist/state/usage.js +1 -1
- package/dist/storage.d.ts +4 -3
- package/dist/testing/prompts.d.ts +1 -1
- package/dist/usage/ChartLogo.js +0 -1
- package/dist/usage/LimitsList.d.ts +1 -1
- package/dist/usage/LimitsList.js +3 -7
- package/dist/usage/UsageBreakdown.js +1 -5
- package/dist/usage/UsageLimits.js +2 -3
- package/dist/usage/UsagePage.js +3 -3
- package/dist/usage/UsageTiles.js +0 -1
- package/dist/usage/format.d.ts +1 -2
- package/dist/usage/format.js +0 -2
- package/dist/usage/index.d.ts +2 -3
- package/dist/usage/index.js +1 -2
- package/dist/usage/limit-groups.d.ts +0 -1
- package/dist/usage/limit-groups.js +0 -2
- package/dist/usage/limits.js +0 -1
- package/dist/usage/summary.d.ts +3 -2
- package/dist/usage/summary.js +0 -1
- package/package.json +19 -12
- package/src/agents/AccountDot.tsx +1 -1
- package/src/agents/AgentIcon.tsx +2 -2
- package/src/agents/accounts.ts +2 -5
- package/src/agents/model-name.ts +1 -1
- package/src/agents/model-requirement.ts +1 -1
- package/src/agents/provider-paths.ts +1 -1
- package/src/agents/status-look.ts +2 -2
- package/src/chat/account-choice.ts +3 -11
- package/src/chat/actions.ts +2 -2
- package/src/chat/attachments.ts +0 -2
- package/src/chat/bookmarks.ts +1 -1
- package/src/chat/chat-references.ts +1 -64
- package/src/chat/drafts.ts +1 -1
- package/src/chat/forks.ts +0 -2
- package/src/chat/guards.ts +0 -2
- package/src/chat/index.ts +21 -38
- package/src/chat/logic/ansi.ts +1 -1
- package/src/chat/logic/bookmarks.ts +1 -1
- package/src/chat/logic/command-looks.ts +3 -7
- package/src/chat/logic/context-usage.ts +2 -2
- package/src/chat/logic/effort.ts +1 -1
- package/src/chat/logic/embedded-code.ts +3 -7
- package/src/chat/logic/fork.ts +23 -13
- package/src/chat/logic/generated-image.ts +1 -3
- package/src/chat/logic/goal.ts +1 -1
- package/src/chat/logic/limit.ts +1 -1
- package/src/chat/logic/picker-entries.ts +5 -19
- package/src/chat/logic/resume-compaction.ts +0 -1
- package/src/chat/logic/scrubber.ts +6 -9
- package/src/chat/logic/steer.ts +6 -0
- package/src/chat/logic/thought.ts +0 -1
- package/src/chat/logic/thread-cards.ts +4 -4
- package/src/chat/logic/timeline-copy.ts +1 -3
- package/src/chat/logic/timeline-target.ts +3 -6
- package/src/chat/logic/timeline.ts +4 -85
- package/src/chat/logic/tool-catalog.ts +1 -2
- package/src/chat/logic/tool-looks.ts +3 -6
- package/src/chat/logic/tools.ts +6 -25
- package/src/chat/logic/visual-height.ts +0 -1
- package/src/chat/logic/welcome.ts +1 -1
- package/src/chat/logic/workflow.ts +2 -3
- package/src/chat/mentions.ts +3 -5
- package/src/chat/pending-prompts.ts +2 -2
- package/src/chat/preferences.ts +1 -2
- package/src/chat/prompt-hold.ts +0 -1
- package/src/chat/prompts/index.ts +14 -0
- package/src/{prompts → chat/prompts}/logic/keys.ts +3 -3
- package/src/{prompts → chat/prompts}/logic/prompts.ts +3 -24
- package/src/{prompts → chat/prompts}/logic/subjects.ts +3 -42
- package/src/{prompts → chat/prompts}/logic/useFocusAfterAnswer.ts +1 -1
- package/src/{prompts → chat/prompts}/logic/usePromptSession.ts +4 -4
- package/src/{prompts → chat/prompts}/ui/ApprovalBody.tsx +6 -7
- package/src/{prompts → chat/prompts}/ui/PromptActions.tsx +1 -2
- package/src/{prompts → chat/prompts}/ui/PromptCard.tsx +2 -2
- package/src/{prompts → chat/prompts}/ui/PromptView.tsx +6 -4
- package/src/{prompts → chat/prompts}/ui/QuestionBody.tsx +3 -3
- package/src/chat/reading-width.ts +2 -1
- package/src/chat/recent-messages.ts +3 -3
- package/src/chat/send-key.ts +0 -1
- package/src/chat/stash.ts +3 -3
- package/src/chat/subagent-conversation.ts +1 -1
- package/src/chat/subagent-list.ts +4 -9
- package/src/chat/subagent-view.ts +1 -2
- package/src/chat/tag-suggestions.ts +5 -5
- package/src/chat/thumbnails.ts +1 -3
- package/src/chat/timeline-flash.ts +1 -1
- package/src/chat/timeline-scroll.ts +0 -2
- package/src/chat/ui/BookmarkMarker.tsx +1 -1
- package/src/chat/ui/BookmarkSubmenu.tsx +2 -2
- package/src/chat/ui/ChatActivity.tsx +8 -18
- package/src/chat/ui/CodeBlock.tsx +1 -1
- package/src/chat/ui/Composer.tsx +5 -15
- package/src/chat/ui/ComposerInput.tsx +2 -2
- package/src/chat/ui/EditDiff.tsx +2 -3
- package/src/chat/ui/GoalDock.tsx +1 -1
- package/src/chat/ui/HostMenuItems.tsx +1 -2
- package/src/chat/ui/ImageView.tsx +2 -2
- package/src/chat/ui/LimitState.tsx +2 -2
- package/src/chat/ui/Markdown.tsx +1 -2
- package/src/chat/ui/MermaidBlock.tsx +1 -2
- package/src/chat/ui/MessageActions.tsx +5 -3
- package/src/chat/ui/Pickers.tsx +4 -4
- package/src/chat/ui/PromptComposer.tsx +9 -8
- package/src/chat/ui/PromptEditor.tsx +2 -2
- package/src/chat/ui/ReferenceChip.tsx +1 -1
- package/src/chat/ui/ReferenceTrail.tsx +2 -2
- package/src/chat/ui/RunSettings.tsx +4 -2
- package/src/chat/ui/SessionLine.tsx +2 -2
- package/src/chat/ui/ShellCommand.tsx +1 -4
- package/src/chat/ui/SubagentInfo.tsx +4 -3
- package/src/chat/ui/SubagentStopButton.tsx +1 -1
- package/src/chat/ui/SubagentTimeline.tsx +2 -2
- package/src/chat/ui/Timeline.tsx +7 -6
- package/src/chat/ui/TimelineMenu.tsx +4 -2
- package/src/chat/ui/UnifiedDiff.tsx +2 -3
- package/src/chat/ui/VisualFrame.tsx +3 -3
- package/src/chat/ui/chip-clipboard.ts +2 -2
- package/src/chat/ui/code-theme.ts +2 -2
- package/src/chat/ui/composer/ComposerControls.tsx +8 -59
- package/src/chat/ui/composer/ComposerMenu.tsx +2 -2
- package/src/chat/ui/composer/ComposerStatusLine.tsx +1 -1
- package/src/chat/ui/composer/DraftParts.tsx +0 -1
- package/src/chat/ui/composer/chip-paste.ts +1 -2
- package/src/chat/ui/composer/chips.ts +3 -4
- package/src/chat/ui/composer/editor.ts +1 -1
- package/src/chat/ui/composer/key-handler.ts +1 -2
- package/src/chat/ui/composer/keys.ts +3 -8
- package/src/chat/ui/composer/placeholder.ts +1 -1
- package/src/chat/ui/composer/prompt-picks.ts +3 -2
- package/src/chat/ui/composer/use-chat-controls.ts +2 -2
- 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-continuable-turn.ts +0 -1
- package/src/chat/ui/composer/use-draft-files.ts +2 -2
- package/src/chat/ui/composer/use-pending-requests.ts +1 -1
- package/src/chat/ui/composer/use-prompt-menus.ts +6 -9
- package/src/chat/ui/composer/use-take-back.ts +1 -3
- package/src/chat/ui/diff/EditorEditDiff.tsx +1 -1
- package/src/chat/ui/diff/LegacyDiffPool.tsx +1 -1
- package/src/chat/ui/diff/LegacyEditDiff.tsx +1 -1
- package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +1 -1
- package/src/chat/ui/diff/ReviewDiff.tsx +1 -2
- package/src/chat/ui/diff/diff-source-budget.ts +1 -1
- package/src/chat/ui/diff/review-plan.ts +2 -2
- package/src/chat/ui/diff/syntax-runtime.ts +1 -1
- package/src/chat/ui/diff-theme.ts +2 -2
- package/src/chat/ui/file-links.ts +1 -2
- package/src/chat/ui/highlighter.ts +1 -2
- package/src/chat/ui/index.ts +9 -39
- package/src/chat/ui/intelligent-ui/UiBlockFrame.tsx +2 -2
- package/src/chat/ui/intelligent-ui/UiFallbackPart.tsx +1 -1
- package/src/chat/ui/intelligent-ui/UiReply.tsx +1 -1
- package/src/chat/ui/intelligent-ui/chart-data.ts +1 -1
- package/src/chat/ui/intelligent-ui/render-context.ts +1 -1
- package/src/chat/ui/intelligent-ui/renderers/chart.tsx +0 -3
- package/src/chat/ui/intelligent-ui/renderers/choices.tsx +1 -1
- package/src/chat/ui/intelligent-ui/renderers/content.tsx +3 -3
- package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +0 -1
- package/src/chat/ui/intelligent-ui/renderers/links.tsx +1 -1
- package/src/chat/ui/intelligent-ui/renderers/map-slots.ts +2 -2
- package/src/chat/ui/intelligent-ui/renderers/map-style.ts +5 -7
- package/src/chat/ui/intelligent-ui/renderers/map-view.tsx +2 -3
- package/src/chat/ui/intelligent-ui/renderers/map.tsx +3 -4
- package/src/chat/ui/intelligent-ui/reply-parts.ts +1 -1
- package/src/chat/ui/intelligent-ui/table-data.ts +1 -1
- package/src/chat/ui/intelligent-ui/use-ui-links.ts +1 -1
- package/src/chat/ui/intelligent-ui/use-ui-queries.ts +1 -1
- package/src/chat/ui/markdown-blocks.ts +0 -2
- package/src/chat/ui/named-chip-look.ts +1 -1
- package/src/chat/ui/reference-icons.ts +2 -2
- package/src/chat/ui/reference-lookup.ts +2 -2
- package/src/chat/ui/rehype-fade.ts +0 -1
- package/src/chat/ui/reveal.ts +3 -3
- package/src/chat/ui/rows/ForksRow.tsx +1 -1
- package/src/chat/ui/rows/GeneratedImageRow.tsx +2 -2
- package/src/chat/ui/rows/MessageRows.tsx +2 -3
- package/src/chat/ui/rows/RowContainer.tsx +3 -3
- package/src/chat/ui/rows/Rows.tsx +2 -2
- package/src/chat/ui/rows/SubagentRow.tsx +7 -8
- package/src/chat/ui/rows/TaskRow.tsx +1 -1
- package/src/chat/ui/rows/VisualRow.tsx +1 -1
- package/src/chat/ui/rows/WorkRows.tsx +6 -10
- package/src/chat/ui/rows/WorkflowRow.tsx +1 -1
- package/src/chat/ui/rows/row-rhythm.ts +2 -1
- package/src/chat/ui/thread-references.ts +3 -3
- package/src/chat/ui/use-diff-source-tokens.ts +1 -1
- package/src/chat/ui/useToggleSet.ts +1 -1
- package/src/chat/ui/visual-theme.ts +1 -1
- package/src/chat/visual-bridge.ts +0 -2
- package/src/chat/waiting-on.ts +1 -1
- package/src/chat/workflow-list.ts +1 -1
- package/src/{chat/chat-client.ts → chat-client.ts} +3 -3
- package/src/chat-sink.ts +37 -0
- package/src/{ui → host}/PlainTextarea.tsx +1 -1
- package/src/{host-hooks.ts → host/host-hooks.ts} +4 -20
- package/src/{host.ts → host/host.ts} +78 -42
- package/src/host/prompts.ts +62 -0
- package/src/host/references.ts +63 -0
- package/src/host/timeline-row.ts +85 -0
- package/src/images.ts +1 -1
- package/src/index.ts +6 -12
- package/src/locales/en/agent-chat.ts +1 -1
- package/src/locales/nl/agent-chat.ts +1 -1
- package/src/locales.ts +1 -1
- package/src/{chat/persisted-json.ts → persisted-json.ts} +2 -2
- package/src/providers/AccountColors.tsx +1 -2
- package/src/providers/AccountDetail.tsx +2 -4
- package/src/providers/AccountVariables.tsx +1 -1
- package/src/providers/AddAccountForm.tsx +1 -1
- package/src/providers/CliDetail.tsx +2 -3
- package/src/providers/InstallPage.tsx +2 -3
- package/src/providers/ProviderList.tsx +0 -1
- package/src/providers/ProvidersPane.tsx +2 -3
- package/src/providers/account-actions.ts +2 -2
- package/src/providers/index.ts +2 -14
- package/src/providers/install-steps.ts +0 -1
- package/src/providers/provider-abilities.ts +1 -7
- package/src/providers/variables.ts +0 -2
- package/src/scope.ts +1 -1
- package/src/settings/sections.ts +1 -1
- package/src/state/chats.ts +1 -40
- package/src/state/index.ts +4 -22
- package/src/state/provider-accounts.ts +0 -1
- package/src/state/usage.ts +5 -5
- package/src/storage.ts +3 -3
- package/src/testing/prompts.ts +1 -1
- package/src/usage/ChartLogo.tsx +0 -1
- package/src/usage/LimitsList.tsx +3 -11
- package/src/usage/UsageBreakdown.tsx +1 -5
- package/src/usage/UsageLimits.tsx +2 -3
- package/src/usage/UsagePage.tsx +3 -3
- package/src/usage/UsagePane.tsx +2 -2
- package/src/usage/UsageTiles.tsx +0 -1
- package/src/usage/format.ts +1 -6
- package/src/usage/index.ts +2 -3
- package/src/usage/limit-groups.ts +0 -4
- package/src/usage/limits.ts +0 -1
- package/src/usage/summary.ts +2 -5
- package/dist/agents/agent-marks.d.ts +0 -9
- package/dist/agents/agent-marks.js +0 -14
- package/dist/lazy.d.ts +0 -8
- package/dist/lazy.js +0 -63
- package/dist/prompts/index.d.ts +0 -9
- package/src/agents/agent-marks.ts +0 -28
- package/src/lazy.tsx +0 -76
- package/src/prompts/index.ts +0 -22
- /package/dist/{prompts → chat/prompts}/logic/focus.d.ts +0 -0
- /package/dist/{prompts → chat/prompts}/logic/focus.js +0 -0
- /package/dist/{prompts → chat/prompts}/logic/keys.js +0 -0
- /package/dist/{prompts → chat/prompts}/logic/subjects.js +0 -0
- /package/dist/{prompts → chat/prompts}/logic/useFocusAfterAnswer.js +0 -0
- /package/dist/{ui → host}/PlainTextarea.js +0 -0
- /package/src/{prompts → chat/prompts}/logic/focus.ts +0 -0
package/src/chat/logic/fork.ts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import type { AgentKind, ChatForkPayload, ChatInfo, ChatItem, ChatTurnItem, ModelSelection } from '@adecore/agent-contracts';
|
|
1
|
+
import type { AgentKind, ChatForkPayload, ChatInfo, ChatItem, ChatTurnItem, ModelSelection, ProviderInfo } from '@adecore/agent-contracts';
|
|
2
2
|
import i18next from 'i18next';
|
|
3
|
-
import type { TimelineRow } from '
|
|
3
|
+
import type { TimelineRow } from '../../host/timeline-row';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
interface HostProviders {
|
|
6
|
+
readonly providers: readonly ProviderInfo[];
|
|
7
|
+
readonly loaded: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/* Whether a CLI keeps a conversation the host can fork, and go on with in a fork: its `fork` capability. */
|
|
11
|
+
export function canForkWith(provider: Pick<ProviderInfo, 'capabilities'>): boolean {
|
|
12
|
+
return provider.capabilities.fork === true;
|
|
13
|
+
}
|
|
7
14
|
|
|
8
15
|
/* Where a fork goes on after, as the dialog words it. */
|
|
9
|
-
|
|
16
|
+
interface ForkPoint {
|
|
10
17
|
turnId: string;
|
|
11
18
|
number: number;
|
|
12
19
|
total: number;
|
|
@@ -27,14 +34,21 @@ function turnsOf(items: Record<string, ChatItem>, order: readonly string[]): Cha
|
|
|
27
34
|
|
|
28
35
|
/*
|
|
29
36
|
* Why a chat cannot be forked after this turn right now, or null when it can. A turn still running,
|
|
30
|
-
* or any turn in the chat, is a transcript that grows while it would be copied.
|
|
37
|
+
* or any turn in the chat, is a transcript that grows while it would be copied. Until the host named its
|
|
38
|
+
* CLIs, no CLI is known to fork.
|
|
31
39
|
*/
|
|
32
|
-
export function forkRefusal(info: ChatInfo | null, turn: ChatItem | undefined): string | null {
|
|
40
|
+
export function forkRefusal(info: ChatInfo | null, turn: ChatItem | undefined, host: HostProviders): string | null {
|
|
33
41
|
if (info === null || turn?.kind !== 'turn') {
|
|
34
42
|
return i18next.t('agent-chat:fork.refusal.notInConversation');
|
|
35
43
|
}
|
|
36
44
|
|
|
37
|
-
if (!
|
|
45
|
+
if (!host.loaded) {
|
|
46
|
+
return i18next.t('agent-chat:fork.refusal.agentsLoading');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const provider = host.providers.find((entry) => entry.kind === info.provider);
|
|
50
|
+
|
|
51
|
+
if (provider === undefined || !canForkWith(provider)) {
|
|
38
52
|
return i18next.t('agent-chat:fork.refusal.cliCannotFork');
|
|
39
53
|
}
|
|
40
54
|
|
|
@@ -49,7 +63,6 @@ export function forkRefusal(info: ChatInfo | null, turn: ChatItem | undefined):
|
|
|
49
63
|
return null;
|
|
50
64
|
}
|
|
51
65
|
|
|
52
|
-
/* Why a fork cannot write a summary for its original right now, or null when it can. */
|
|
53
66
|
export function summaryRefusal(state: { busy: boolean; originalPresent: boolean }): string | null {
|
|
54
67
|
if (!state.originalPresent) {
|
|
55
68
|
return i18next.t('agent-chat:fork.refusal.originalGone');
|
|
@@ -62,7 +75,6 @@ export function summaryRefusal(state: { busy: boolean; originalPresent: boolean
|
|
|
62
75
|
return null;
|
|
63
76
|
}
|
|
64
77
|
|
|
65
|
-
/* The forks this client knows of that went on after this turn of this chat, in the order it holds them. */
|
|
66
78
|
export function forkIdsAfter(infos: Iterable<ChatInfo>, chatId: string, turnId: string): string[] {
|
|
67
79
|
const ids: string[] = [];
|
|
68
80
|
|
|
@@ -75,7 +87,6 @@ export function forkIdsAfter(infos: Iterable<ChatInfo>, chatId: string, turnId:
|
|
|
75
87
|
return ids;
|
|
76
88
|
}
|
|
77
89
|
|
|
78
|
-
/* The turns of this chat that at least one fork this client knows of went on after. */
|
|
79
90
|
export function forkedTurnIds(infos: Iterable<ChatInfo>, chatId: string): Set<string> {
|
|
80
91
|
const turns = new Set<string>();
|
|
81
92
|
|
|
@@ -170,7 +181,7 @@ export function forkShapes(origin: ForkShape): ForkShape[] {
|
|
|
170
181
|
}
|
|
171
182
|
|
|
172
183
|
/* A worktree the fork works in, on this branch, with or without the files as they were after the turn. */
|
|
173
|
-
|
|
184
|
+
interface ForkWorktreeChoice {
|
|
174
185
|
branch: string;
|
|
175
186
|
filesAfterTurn: boolean;
|
|
176
187
|
}
|
|
@@ -208,7 +219,6 @@ export function forkPayload(input: {
|
|
|
208
219
|
};
|
|
209
220
|
}
|
|
210
221
|
|
|
211
|
-
/* Why a branch cannot be the fork's, or null when it can. */
|
|
212
222
|
export function branchRefusal(branch: string, taken: readonly string[]): string | null {
|
|
213
223
|
const name = branch.trim();
|
|
214
224
|
|
|
@@ -9,7 +9,7 @@ export type GeneratedImageFailure =
|
|
|
9
9
|
| { kind: 'not-image' }
|
|
10
10
|
| { kind: 'too-large'; limit: number };
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
type GeneratedImageView =
|
|
13
13
|
| { state: 'generating' }
|
|
14
14
|
| { state: 'failed'; failure: GeneratedImageFailure }
|
|
15
15
|
| { state: 'ready'; attachment: ChatAttachment; prompt: string | null; transparent: boolean };
|
|
@@ -18,7 +18,6 @@ export function isImageGeneration(tool: ChatToolItem): boolean {
|
|
|
18
18
|
return tool.name === IMAGE_GENERATION_TOOL;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/* What the row of an image generation draws, from the tool call alone. */
|
|
22
21
|
export function generatedImageView(tool: ChatToolItem): GeneratedImageView {
|
|
23
22
|
if (tool.state === 'running') {
|
|
24
23
|
return { state: 'generating' };
|
|
@@ -49,7 +48,6 @@ export function generatedImageView(tool: ChatToolItem): GeneratedImageView {
|
|
|
49
48
|
return { state: 'ready', attachment, prompt: input.revisedPrompt?.trim() || null, transparent: input.transparentBackground === true };
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
/* Width over height, when the attachment carries both. */
|
|
53
51
|
export function attachmentAspect(attachment: ChatAttachment): number | undefined {
|
|
54
52
|
return attachment.width !== undefined && attachment.height !== undefined ? attachment.width / attachment.height : undefined;
|
|
55
53
|
}
|
package/src/chat/logic/goal.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChatGoal, ChatGoalAction, ChatInfo, ProviderCapabilities } from '@adecore/agent-contracts';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface GoalView {
|
|
4
4
|
goal: ChatGoal;
|
|
5
5
|
// What a person may do to it from the row; empty where the CLI or the host offers nothing.
|
|
6
6
|
actions: ChatGoalAction[];
|
package/src/chat/logic/limit.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ChatInfo } from '@adecore/agent-contracts';
|
|
|
2
2
|
import { formatMoment } from '@adecore/ui/format';
|
|
3
3
|
import i18next from 'i18next';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface LimitView {
|
|
6
6
|
/* The state in a word or two with its time, for a pill in a header. */
|
|
7
7
|
pill: string;
|
|
8
8
|
title: string;
|
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AgentKind, ModelInfo, ProviderInfo } from '@adecore/agent-contracts';
|
|
2
2
|
import { nameCollator } from '@adecore/ui/format';
|
|
3
3
|
|
|
4
|
-
/* The providers in the order a picker lists them: the frontier labs, the rest, then the API providers, each by name. */
|
|
5
|
-
export function inPickerOrder<T extends { kind: AgentKind; name: string }>(providers: readonly T[]): T[] {
|
|
6
|
-
const groups = pickerGroupsOf(providers);
|
|
7
|
-
|
|
8
|
-
return [...groups.frontier, ...groups.others, ...groups.api];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/* Whether a separator goes between two providers next to each other in that order: where one group ends. */
|
|
12
|
-
export function separatesGroups(previous: AgentKind | undefined, kind: AgentKind): boolean {
|
|
13
|
-
return previous !== undefined && providerGroupOf(previous) !== providerGroupOf(kind);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
4
|
/*
|
|
17
5
|
* A provider with more live models than this keeps the list short: the model that is picked and the default,
|
|
18
6
|
* with the rest behind one row that opens all of them. A list of three hundred models is not one to scroll.
|
|
19
7
|
*/
|
|
20
|
-
|
|
8
|
+
const COMPACT_MODEL_LIMIT = 8;
|
|
21
9
|
|
|
22
10
|
/* A model row, or a row that folds more models open: one provider's models, or the legacy ones. All of them take a turn in the arrow keys. */
|
|
23
11
|
export type PickerEntry =
|
|
@@ -25,13 +13,12 @@ export type PickerEntry =
|
|
|
25
13
|
| { kind: 'legacy'; count: number }
|
|
26
14
|
| { kind: 'all'; provider: ProviderInfo; count: number; open: boolean };
|
|
27
15
|
|
|
28
|
-
|
|
16
|
+
interface PickerCurrent {
|
|
29
17
|
provider: AgentKind;
|
|
30
18
|
model: string;
|
|
31
19
|
}
|
|
32
20
|
|
|
33
|
-
|
|
34
|
-
export type FavoritesOf = (kind: AgentKind) => ReadonlySet<string>;
|
|
21
|
+
type FavoritesOf = (kind: AgentKind) => ReadonlySet<string>;
|
|
35
22
|
|
|
36
23
|
const NO_FAVORITES: FavoritesOf = () => new Set();
|
|
37
24
|
|
|
@@ -46,7 +33,7 @@ function matches(model: ModelInfo, query: string): boolean {
|
|
|
46
33
|
* By maker, then by name, when the provider says who made its models; a list with no makers keeps the order
|
|
47
34
|
* it came in. A model with no maker goes last, so the ones that have one read as groups.
|
|
48
35
|
*/
|
|
49
|
-
|
|
36
|
+
function modelsByVendor(models: ModelInfo[]): ModelInfo[] {
|
|
50
37
|
if (!models.some((model) => model.vendor !== undefined)) {
|
|
51
38
|
return models;
|
|
52
39
|
}
|
|
@@ -63,7 +50,6 @@ export function modelsByVendor(models: ModelInfo[]): ModelInfo[] {
|
|
|
63
50
|
});
|
|
64
51
|
}
|
|
65
52
|
|
|
66
|
-
/* The starred models first, in the order they came, then the rest by maker. */
|
|
67
53
|
export function favoritesFirst(models: ModelInfo[], favorites: ReadonlySet<string>): ModelInfo[] {
|
|
68
54
|
if (favorites.size === 0) {
|
|
69
55
|
return modelsByVendor(models);
|
|
@@ -86,7 +86,6 @@ export function resumeCompactionDueAt(input: OfferInput): number | null {
|
|
|
86
86
|
return endedAt === null ? null : dueAtOf(input.info, endedAt);
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
/* Whether to offer compacting before the next message. */
|
|
90
89
|
export function resumeCompactionOffer(input: OfferInput & { now: number }): ResumeCompactionOffer | null {
|
|
91
90
|
const turn = offerableTurn(input);
|
|
92
91
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ChatBookmark, ChatItem } from '@adecore/agent-contracts';
|
|
2
|
+
import { type TimelineRow } from '../../host/timeline-row';
|
|
2
3
|
import { DEFAULT_READING_WIDTH, readingMeasure } from '../reading-width';
|
|
3
|
-
import { agentTurnLabel
|
|
4
|
+
import { agentTurnLabel } from './timeline';
|
|
4
5
|
|
|
5
6
|
// The strip of ticks at the left edge of a chat view, as numbers; the component only draws what comes out of here.
|
|
6
7
|
|
|
@@ -117,7 +118,7 @@ export function ticksOf(
|
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
/* One drawn tick: a message, or a run of messages merged once the height has fewer pixels than they need. */
|
|
120
|
-
|
|
121
|
+
interface TickSlot {
|
|
121
122
|
first: number;
|
|
122
123
|
last: number;
|
|
123
124
|
kind: TickKind;
|
|
@@ -125,11 +126,10 @@ export interface TickSlot {
|
|
|
125
126
|
marked: boolean;
|
|
126
127
|
/* Whether a find hit falls under it, which puts a mark of the find's own color beside it. */
|
|
127
128
|
found: boolean;
|
|
128
|
-
/* The top of the tick inside the strip. */
|
|
129
129
|
y: number;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
interface ScrubberLayout {
|
|
133
133
|
top: number;
|
|
134
134
|
pitch: number;
|
|
135
135
|
count: number;
|
|
@@ -186,7 +186,6 @@ export function tickOfRow(ticks: readonly ScrubberTick[], rowIndex: number): num
|
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
/* Per tick, whether any of the rows has a find hit in its stretch. */
|
|
190
189
|
export function ticksWithHits(ticks: readonly ScrubberTick[], hitRows: readonly number[]): boolean[] {
|
|
191
190
|
const found = ticks.map(() => false);
|
|
192
191
|
|
|
@@ -276,12 +275,11 @@ function lastIndexAtOrBelow(length: number, valueAt: (index: number) => number,
|
|
|
276
275
|
|
|
277
276
|
type MessageStarts = Pick<readonly number[], 'length' | 'at'>;
|
|
278
277
|
|
|
279
|
-
/* The last index whose start lies at or above a line, or -1. */
|
|
280
278
|
function lastAtOrAbove(starts: MessageStarts, line: number): number {
|
|
281
279
|
return lastIndexAtOrBelow(starts.length, (index) => starts.at(index)!, line);
|
|
282
280
|
}
|
|
283
281
|
|
|
284
|
-
|
|
282
|
+
interface ReadingPosition {
|
|
285
283
|
/* Where each message's row starts in the thread, in the virtualizer's measurements. */
|
|
286
284
|
starts: MessageStarts;
|
|
287
285
|
scrollTop: number;
|
|
@@ -289,7 +287,7 @@ export interface ReadingPosition {
|
|
|
289
287
|
visibleHeight: number;
|
|
290
288
|
}
|
|
291
289
|
|
|
292
|
-
|
|
290
|
+
interface MessageRange {
|
|
293
291
|
first: number;
|
|
294
292
|
last: number;
|
|
295
293
|
}
|
|
@@ -316,7 +314,6 @@ export function messagesInView({ starts, scrollTop, visibleHeight }: ReadingPosi
|
|
|
316
314
|
return { first, last: Math.max(first, last) };
|
|
317
315
|
}
|
|
318
316
|
|
|
319
|
-
/* Whether a drawn tick covers any of the messages on screen. */
|
|
320
317
|
export function slotInView(slot: TickSlot, range: MessageRange | null): boolean {
|
|
321
318
|
return range !== null && slot.last >= range.first && slot.first <= range.last;
|
|
322
319
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ProviderCapabilities } from '@adecore/agent-contracts';
|
|
2
|
+
|
|
3
|
+
/* Whether a message sent while a turn runs may join it. Undefined while the host has not answered `provider.list`, which steers nothing. */
|
|
4
|
+
export function canSteer(capabilities: ProviderCapabilities | undefined): boolean {
|
|
5
|
+
return capabilities?.steer === true;
|
|
6
|
+
}
|
|
@@ -6,7 +6,6 @@ const LIST_MARKER = /^[ \t]*(?:[-*+]|\d+[.)])[ \t]+/gm;
|
|
|
6
6
|
// A sentence ends on a stop with white space after it, so `a.ts` and `1.5` stay whole.
|
|
7
7
|
const SENTENCE_END = /[.!?]["'”’)\]]*(?=\s)/;
|
|
8
8
|
|
|
9
|
-
/* The thought as one line of plain text: the marks gone and every run of white space one space. */
|
|
10
9
|
export function flattenThought(text: string): string {
|
|
11
10
|
return stripMarkdown(text.replace(LIST_MARKER, '')).replace(/\s+/g, ' ').trim();
|
|
12
11
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ChatVisual } from '@adecore/agent-contracts';
|
|
2
|
-
import type { ThreadCard } from '../../host';
|
|
3
|
-
import type { TimelineRow } from '
|
|
2
|
+
import type { ThreadCard } from '../../host/host';
|
|
3
|
+
import type { TimelineRow } from '../../host/timeline-row';
|
|
4
4
|
|
|
5
5
|
/* A row that belongs to a moment rather than to an item of the thread: an app's card, or a visual an agent published. */
|
|
6
|
-
|
|
6
|
+
interface TimedRow {
|
|
7
7
|
/* In milliseconds on the clock of a chat item's `createdAt`. */
|
|
8
8
|
at: number;
|
|
9
9
|
row: TimelineRow;
|
|
@@ -51,7 +51,7 @@ export function cardRows(cards: readonly ThreadCard[]): TimedRow[] {
|
|
|
51
51
|
* client holds began, while there is a page before it: a visual from before then belongs to that
|
|
52
52
|
* page and waits for it, rather than stacking up at the top of the thread.
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
function visualRows(visuals: readonly ChatVisual[], heldFrom: number | null = null): TimedRow[] {
|
|
55
55
|
return visuals
|
|
56
56
|
.filter((visual) => heldFrom === null || visual.at >= heldFrom)
|
|
57
57
|
.map((visual) => ({ at: visual.at, row: { kind: 'visual', id: `visual-${visual.id}`, visual } }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { TimelineRow } from '../../host/timeline-row';
|
|
1
2
|
import { stripAnsi } from './ansi';
|
|
2
|
-
import type { TimelineRow } from './timeline';
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
* An answer is markdown on the wire and rendered text on screen, so a copy as text undoes the marks the
|
|
@@ -18,14 +18,12 @@ export function stripMarkdown(text: string): string {
|
|
|
18
18
|
.trim();
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/* What a tool call has to show for itself: what it answered, or what it has answered so far. */
|
|
22
21
|
function outputOf(tool: { output: string | null; progress?: { output: string | null } }): string | null {
|
|
23
22
|
const output = tool.output ?? tool.progress?.output ?? null;
|
|
24
23
|
|
|
25
24
|
return output === null ? null : stripAnsi(output);
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
/* The whole item under the pointer as plain text, or null for a row that carries no message. */
|
|
29
27
|
export function messageTextOf(row: TimelineRow): string | null {
|
|
30
28
|
switch (row.kind) {
|
|
31
29
|
case 'user':
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import type { ChatItem, ChatUiChoiceOrigin } from '@adecore/agent-contracts';
|
|
2
2
|
import { selectionWithin } from '@adecore/ui';
|
|
3
|
-
import type { FileRef } from '../../host';
|
|
4
|
-
import type { TimelineRow } from '
|
|
3
|
+
import type { FileRef } from '../../host/host';
|
|
4
|
+
import type { TimelineRow } from '../../host/timeline-row';
|
|
5
5
|
|
|
6
6
|
/* What the right-click landed on, read once when the menu opens. */
|
|
7
7
|
export interface TimelineTarget {
|
|
8
8
|
/* The text selected inside the thread; a selection elsewhere is none of this menu's business. */
|
|
9
9
|
selection: string;
|
|
10
10
|
row: TimelineRow | null;
|
|
11
|
-
/* The code block under the pointer, when the click landed in one. */
|
|
12
11
|
code: string | null;
|
|
13
12
|
/* The file a mention chip, a changed-files row or a link in an answer names. */
|
|
14
13
|
path: string | null;
|
|
15
|
-
/* The line that file reference named, where it named one. */
|
|
16
14
|
line: number | null;
|
|
17
15
|
/* Captured at menu opening, before the rendering scope or cwd can change. */
|
|
18
16
|
file?: { ref: FileRef; cwd: string | null; scopeId: string | null } | null;
|
|
@@ -44,7 +42,6 @@ export function withCurrentText(rows: TimelineRow[], items: Record<string, ChatI
|
|
|
44
42
|
});
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
/* The row a click landed in is the one whose id it sits under; the rest comes from the same walk up. */
|
|
48
45
|
export function readTimelineTarget(element: HTMLElement, scroller: HTMLElement | null, rows: TimelineRow[]): TimelineTarget {
|
|
49
46
|
const id = element.closest<HTMLElement>('[data-item-id]')?.dataset.itemId;
|
|
50
47
|
const file = element.closest<HTMLElement>('[data-file-path]');
|
|
@@ -83,7 +80,7 @@ function positiveInteger(value: string | undefined): number | null {
|
|
|
83
80
|
}
|
|
84
81
|
|
|
85
82
|
export type UiReplyTarget = Pick<ChatUiChoiceOrigin, 'itemId' | 'blockId' | 'revision'>;
|
|
86
|
-
|
|
83
|
+
type UiReplyJump = { kind: 'missing' | 'earlier' } | { kind: 'turn'; turnId: string } | { kind: 'row'; index: number };
|
|
87
84
|
|
|
88
85
|
export function uiReplyJump(
|
|
89
86
|
target: UiReplyTarget,
|
|
@@ -1,89 +1,16 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ChatApprovalItem,
|
|
3
|
-
ChatAssistantItem,
|
|
4
|
-
ChatCheckpointDiff,
|
|
5
|
-
ChatItem,
|
|
6
|
-
ChatNoteMessage,
|
|
7
|
-
ChatQuestionItem,
|
|
8
|
-
ChatSubagentItem,
|
|
9
|
-
ChatThinkingItem,
|
|
10
|
-
ChatToolItem,
|
|
11
|
-
ChatTurnItem,
|
|
12
|
-
ChatUserItem,
|
|
13
|
-
ChatVisual,
|
|
14
|
-
ChatWorkflow,
|
|
15
|
-
ModelSelection
|
|
16
|
-
} from '@adecore/agent-contracts';
|
|
1
|
+
import type { ChatItem, ChatSubagentItem, ChatToolItem, ChatTurnItem, ModelSelection } from '@adecore/agent-contracts';
|
|
17
2
|
import { abortedByMachine } from '@adecore/agent-contracts';
|
|
18
3
|
import { formatElapsedShort } from '@adecore/ui/format';
|
|
19
4
|
import i18next from 'i18next';
|
|
20
|
-
import type { CommandLook,
|
|
21
|
-
import {
|
|
5
|
+
import type { CommandLook, ToolLook } from '../../host/host';
|
|
6
|
+
import type { Look, SubagentBranch, TimelineRow } from '../../host/timeline-row';
|
|
7
|
+
import { lookKey, lookRunOf, sentMessageOf } from './command-looks';
|
|
22
8
|
import { isImageGeneration } from './generated-image';
|
|
23
9
|
import { handbackReportOf } from './handback';
|
|
24
10
|
import { switchesSelection } from './selection-switch';
|
|
25
11
|
import { toolEntry } from './tool-catalog';
|
|
26
12
|
import { hasFileChanges, isFileChange } from './tools';
|
|
27
13
|
|
|
28
|
-
/* A subagent's row: the work the thread kept of it, and the agents it opened in turn, each a row of its own under it. */
|
|
29
|
-
export interface SubagentBranch {
|
|
30
|
-
id: string;
|
|
31
|
-
item: ChatSubagentItem;
|
|
32
|
-
children: ChatItem[];
|
|
33
|
-
nested: SubagentBranch[];
|
|
34
|
-
expanded: boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/*
|
|
38
|
-
* What the thread shows, row by row. Items are what the host knows; rows are what a reader
|
|
39
|
-
* wants: one line per tool call, runs of tool calls folded into a summary, past turns folded
|
|
40
|
-
* behind "Worked for 12s" and what the turn did, and the file changes of a turn gathered into one card.
|
|
41
|
-
*/
|
|
42
|
-
export type TimelineRow =
|
|
43
|
-
| { kind: 'user'; id: string; item: ChatUserItem }
|
|
44
|
-
| { kind: 'turn-start'; id: string; turn: ChatTurnItem; label: string }
|
|
45
|
-
| { kind: 'assistant'; id: string; item: ChatAssistantItem }
|
|
46
|
-
// A subagent's `SubagentHandback` call, drawn as the report it carries rather than as a tool call.
|
|
47
|
-
| { kind: 'report'; id: string; text: string }
|
|
48
|
-
| { kind: 'thinking'; id: string; item: ChatThinkingItem }
|
|
49
|
-
| { kind: 'work'; id: string; tool: ChatToolItem }
|
|
50
|
-
// `look` is set when every call is a run of that look and the summary is its sentence.
|
|
51
|
-
| { kind: 'work-group'; id: string; tools: ChatToolItem[]; summary: string; expanded: boolean; look?: Look }
|
|
52
|
-
| { kind: 'work-live'; id: string; tool: ChatToolItem }
|
|
53
|
-
// The latest thought of a running turn, repeated over the call it led to; `at` is when that call began.
|
|
54
|
-
| { kind: 'live-thought'; id: string; item: ChatThinkingItem; at: number }
|
|
55
|
-
// A Workflow call the machine reports phases and agents for, drawn with them under it.
|
|
56
|
-
| { kind: 'workflow'; id: string; tool: ChatToolItem; workflow: ChatWorkflow }
|
|
57
|
-
| ({ kind: 'subagent' } & SubagentBranch)
|
|
58
|
-
| { kind: 'approval'; id: string; item: ChatApprovalItem }
|
|
59
|
-
| { kind: 'question'; id: string; item: ChatQuestionItem }
|
|
60
|
-
| { kind: 'note'; id: string; level: 'info' | 'warning' | 'error'; text: string; from?: string; said?: true }
|
|
61
|
-
// A message another node sent the chat, drawn as said to it under the name of its sender.
|
|
62
|
-
| { kind: 'message'; id: string; message: ChatNoteMessage; createdAt: number }
|
|
63
|
-
// A message this chat's agent sent another node with a command of a look, drawn as said instead of as its call.
|
|
64
|
-
| { kind: 'sent'; id: string; tool: ChatToolItem; sent: CommandLookSent }
|
|
65
|
-
| { kind: 'compaction'; id: string; preTokens: number | null; postTokens?: number }
|
|
66
|
-
// The turn below ran on another model or effort than the turn before it.
|
|
67
|
-
| { kind: 'selection-switch'; id: string; from: ModelSelection; to: ModelSelection }
|
|
68
|
-
| {
|
|
69
|
-
kind: 'changed-files';
|
|
70
|
-
id: string;
|
|
71
|
-
turnId: string;
|
|
72
|
-
tools: ChatToolItem[];
|
|
73
|
-
diff: ChatCheckpointDiff | null;
|
|
74
|
-
checkpoint: boolean;
|
|
75
|
-
baseMoved?: BaseMoved;
|
|
76
|
-
// Set when `diff` holds back the diffs past its first few, which the host answers whole.
|
|
77
|
-
heldBack?: boolean;
|
|
78
|
-
}
|
|
79
|
-
| { kind: 'turn-fold'; id: string; turn: ChatTurnItem; label: string; work: string[]; hiddenCount: number; expanded: boolean; expandable: boolean }
|
|
80
|
-
| { kind: 'forks'; id: string; turnId: string }
|
|
81
|
-
| { kind: 'working'; id: string; startedAt: number; tool?: ChatToolItem }
|
|
82
|
-
// A card of the app's own (`thread-cards.ts`), never derived from an item.
|
|
83
|
-
| { kind: 'app-card'; id: string; card: ThreadCard }
|
|
84
|
-
// A page an agent published, placed by when it was published (`thread-cards.ts`), never derived from an item.
|
|
85
|
-
| { kind: 'visual'; id: string; visual: ChatVisual };
|
|
86
|
-
|
|
87
14
|
interface TimelineOptions {
|
|
88
15
|
expandedGroups: ReadonlySet<string>;
|
|
89
16
|
expandedTurns: ReadonlySet<string>;
|
|
@@ -407,7 +334,6 @@ function isImageRow(row: TimelineRow): boolean {
|
|
|
407
334
|
return (row.kind === 'work' || row.kind === 'work-live') && isImageGeneration(row.tool);
|
|
408
335
|
}
|
|
409
336
|
|
|
410
|
-
/* Rows for a run of items, in order, with tool runs folded and a subagent's work under its own row. */
|
|
411
337
|
function rowsForItems(items: ChatItem[], options: TimelineOptions, children: Map<string, ChatItem[]>): TimelineRow[] {
|
|
412
338
|
const rows: TimelineRow[] = [];
|
|
413
339
|
const tools: ChatToolItem[] = [];
|
|
@@ -522,12 +448,6 @@ function rowsForItems(items: ChatItem[], options: TimelineOptions, children: Map
|
|
|
522
448
|
return rows;
|
|
523
449
|
}
|
|
524
450
|
|
|
525
|
-
/* The branch the turn started on was not the one it ended on, so its diff also holds what came in with the move. */
|
|
526
|
-
export interface BaseMoved {
|
|
527
|
-
from: string;
|
|
528
|
-
to: string;
|
|
529
|
-
}
|
|
530
|
-
|
|
531
451
|
/* The card of a settled turn: the checkpoint diff when the host took one, else what the tool calls carry. */
|
|
532
452
|
function changedFilesRow(turn: ChatTurnItem, items: ChatItem[]): TimelineRow | null {
|
|
533
453
|
const edits = items.filter(
|
|
@@ -655,7 +575,6 @@ function chunksByTurn(items: ChatItem[]): TurnChunk[] {
|
|
|
655
575
|
return chunks;
|
|
656
576
|
}
|
|
657
577
|
|
|
658
|
-
/* Whether every node whose message opened the turn has that message among the rows right above it. */
|
|
659
578
|
function opensUnderItsMessages(turn: ChatTurnItem, rows: readonly TimelineRow[]): boolean {
|
|
660
579
|
const from = turn.messageFrom ?? [];
|
|
661
580
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Bot, Eye, FolderSearch, Globe, ListTodo, Search, SquarePen, Terminal, Workflow, Zap, type LucideIcon } from 'lucide-react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
export interface ToolEntry {
|
|
3
|
+
interface ToolEntry {
|
|
5
4
|
/* The mark in the gutter of the call's row. */
|
|
6
5
|
icon: LucideIcon;
|
|
7
6
|
/* The input keys that hold the one line saying what the call is about, best first. */
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { ChatToolItem } from '@adecore/agent-contracts';
|
|
2
2
|
import { isRecord } from '@adecore/utils/record';
|
|
3
|
-
import type { ToolLook, ToolLookMatch } from '../../host';
|
|
3
|
+
import type { ToolLook, ToolLookMatch } from '../../host/host';
|
|
4
4
|
import type { CommandLookWord, LookRun } from './command-looks';
|
|
5
5
|
|
|
6
|
-
// A value keeps this many characters of what it says.
|
|
7
6
|
const FOLD_LENGTH = 40;
|
|
8
7
|
// An ACP agent titles a call of an MCP tool with the server and the tool, each agent with a separator of its own.
|
|
9
8
|
const TITLE_SEPARATORS = ['__', '_', '-'];
|
|
@@ -12,18 +11,16 @@ const TOOL_NAME = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
|
12
11
|
const ACP_TOOL_ROW = 'Tool';
|
|
13
12
|
|
|
14
13
|
/* A call of a tool on an MCP server, the same whichever CLI made it. */
|
|
15
|
-
|
|
14
|
+
interface McpCall {
|
|
16
15
|
readonly server: string;
|
|
17
|
-
/* The tool's name on its server, without the server. */
|
|
18
16
|
readonly tool: string;
|
|
19
|
-
/* The arguments the tool got. */
|
|
20
17
|
readonly input: Readonly<Record<string, unknown>>;
|
|
21
18
|
/* What the tool answered, out of any envelope the CLI wraps it in. */
|
|
22
19
|
readonly output: string | null;
|
|
23
20
|
}
|
|
24
21
|
|
|
25
22
|
/* A call of a look's MCP server read as a tool of its own. */
|
|
26
|
-
|
|
23
|
+
interface ToolLookRun extends LookRun {
|
|
27
24
|
readonly look: ToolLook;
|
|
28
25
|
readonly match: ToolLookMatch;
|
|
29
26
|
readonly call: McpCall;
|
package/src/chat/logic/tools.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { toolFileEdit, type ChatFileChange, type ChatToolItem } from '@adecore/agent-contracts';
|
|
2
2
|
import { isRecord } from '@adecore/utils/record';
|
|
3
3
|
import { toolEntry } from './tool-catalog';
|
|
4
4
|
|
|
@@ -49,7 +49,6 @@ export function toolSummary(name: string, input: unknown): string {
|
|
|
49
49
|
return '';
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
// The input keys whose value is a file a call is about.
|
|
53
52
|
const PATH_KEYS = new Set(['file_path', 'notebook_path']);
|
|
54
53
|
|
|
55
54
|
/* Whether the one line of a call is the path of a file, which a row cuts in the middle so the name stays. */
|
|
@@ -65,7 +64,6 @@ export function toolSummaryIsPath(name: string, input: unknown): boolean {
|
|
|
65
64
|
return key !== undefined && PATH_KEYS.has(key);
|
|
66
65
|
}
|
|
67
66
|
|
|
68
|
-
/* The command of a shell call, as it was run; null for any other call or one without a command. */
|
|
69
67
|
export function shellCommand(name: string, input: unknown): string | null {
|
|
70
68
|
if (toolEntry(name)?.shell !== true || !isRecord(input)) {
|
|
71
69
|
return null;
|
|
@@ -77,8 +75,7 @@ export function shellCommand(name: string, input: unknown): string | null {
|
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
/* What a call was asked to do, as the lines its opened row shows. */
|
|
80
|
-
|
|
81
|
-
/* The command of a shell call, whole. */
|
|
78
|
+
interface ToolCallLines {
|
|
82
79
|
readonly command: string | null;
|
|
83
80
|
/* The rest of the input as key and value: a string as it is, anything else as compact JSON. */
|
|
84
81
|
readonly args: ReadonlyArray<readonly [key: string, value: string]>;
|
|
@@ -122,12 +119,10 @@ export function exitCodeOf(output: string): { code: number | null; rest: string
|
|
|
122
119
|
return { code: Number(match[1]), rest: output.slice(match[0].length) };
|
|
123
120
|
}
|
|
124
121
|
|
|
125
|
-
/* Whether an output says anything; whitespace alone does not. */
|
|
126
122
|
export function hasOutput(output: string | null): output is string {
|
|
127
123
|
return output !== null && output.trim() !== '';
|
|
128
124
|
}
|
|
129
125
|
|
|
130
|
-
/* Whether opening a call shows anything: a diff, the input it was given or what it answered. */
|
|
131
126
|
export function hasToolBody(tool: ChatToolItem): boolean {
|
|
132
127
|
if (hasFileChanges(tool) || hasOutput(tool.output)) {
|
|
133
128
|
return true;
|
|
@@ -141,7 +136,6 @@ export function hasToolBody(tool: ChatToolItem): boolean {
|
|
|
141
136
|
// What `GET /fs/file` will serve; a path with another suffix is not worth asking the host about.
|
|
142
137
|
const IMAGE_SUFFIXES = ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.svg'];
|
|
143
138
|
|
|
144
|
-
/* The image file a tool call looked at, so the row can draw it; null for every other call. */
|
|
145
139
|
export function readImagePath(name: string, input: unknown): string | null {
|
|
146
140
|
if (toolEntry(name)?.readsImage !== true) {
|
|
147
141
|
return null;
|
|
@@ -158,27 +152,14 @@ export function readImagePath(name: string, input: unknown): string | null {
|
|
|
158
152
|
return IMAGE_SUFFIXES.some((suffix) => lowered.endsWith(suffix)) ? path : null;
|
|
159
153
|
}
|
|
160
154
|
|
|
161
|
-
/* The before and after text of a file-changing tool call, so the thread can show it as a diff. */
|
|
162
155
|
export function fileChanges(name: string, input: unknown): FileChange[] {
|
|
163
|
-
|
|
164
|
-
return [];
|
|
165
|
-
}
|
|
156
|
+
const edit = toolFileEdit(name, input);
|
|
166
157
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if (name === 'Edit') {
|
|
170
|
-
return [{ path, before: str(input.old_string) ?? '', after: str(input.new_string) ?? '', fragment: true }];
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (name === 'Write') {
|
|
174
|
-
return [{ path, before: '', after: str(input.content) ?? '' }];
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (name === 'MultiEdit' && Array.isArray(input.edits)) {
|
|
178
|
-
return input.edits.filter(isRecord).map((edit) => ({ path, before: str(edit.old_string) ?? '', after: str(edit.new_string) ?? '', fragment: true }));
|
|
158
|
+
if (edit === null) {
|
|
159
|
+
return [];
|
|
179
160
|
}
|
|
180
161
|
|
|
181
|
-
return
|
|
162
|
+
return edit.pieces.map((piece) => (edit.write ? { path: edit.path, ...piece } : { path: edit.path, ...piece, fragment: true }));
|
|
182
163
|
}
|
|
183
164
|
|
|
184
165
|
export function isFileChange(name: string): boolean {
|
|
@@ -18,7 +18,6 @@ function keyOf(visualId: string, width: number): string {
|
|
|
18
18
|
return `${visualId}@${Math.round(width)}`;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/* A height a page reported, held to the visual's own maximum and the limits, in whole pixels. */
|
|
22
21
|
export function clampVisualHeight(visual: Pick<ChatVisual, 'maxHeight'>, height: number): number {
|
|
23
22
|
return Math.min(Math.max(Math.ceil(Math.min(height, visual.maxHeight)), VISUAL_LIMITS.minHeight), VISUAL_LIMITS.maxHeight);
|
|
24
23
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* The part of the day a greeting names, on the local clock; the night runs until five. */
|
|
2
|
-
|
|
2
|
+
type DayPart = 'morning' | 'afternoon' | 'evening' | 'night';
|
|
3
3
|
|
|
4
4
|
export function dayPartOf(now: Date): DayPart {
|
|
5
5
|
const hour = now.getHours();
|