@adecore/agents-react 0.0.1 → 0.17.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +110 -0
- package/README.md +53 -0
- package/dist/agents/AccountDot.d.ts +4 -0
- package/dist/agents/AccountDot.js +8 -0
- package/dist/agents/AgentIcon.d.ts +6 -0
- package/dist/agents/AgentIcon.js +20 -0
- package/dist/agents/ModelOptionControl.d.ts +15 -0
- package/dist/agents/ModelOptionControl.js +33 -0
- package/dist/agents/ProviderLogo.d.ts +8 -0
- package/dist/agents/ProviderLogo.js +8 -0
- package/dist/agents/account-limits.d.ts +7 -0
- package/dist/agents/account-limits.js +40 -0
- package/dist/agents/accounts.d.ts +22 -0
- package/dist/agents/accounts.js +113 -0
- package/dist/agents/model-name.d.ts +12 -0
- package/dist/agents/model-name.js +56 -0
- package/dist/agents/model-options.d.ts +5 -0
- package/dist/agents/model-options.js +15 -0
- package/dist/agents/provider-paths.d.ts +2 -0
- package/dist/agents/provider-paths.js +8 -0
- package/dist/agents/status-look.d.ts +13 -0
- package/dist/agents/status-look.js +24 -0
- package/dist/chat/account-choice.d.ts +11 -0
- package/dist/chat/account-choice.js +30 -0
- package/dist/chat/actions.d.ts +6 -0
- package/dist/chat/actions.js +68 -0
- package/dist/chat/activity.d.ts +5 -0
- package/dist/chat/activity.js +6 -0
- package/dist/chat/attachments.d.ts +23 -0
- package/dist/chat/attachments.js +86 -0
- package/dist/chat/bookmarks.d.ts +14 -0
- package/dist/chat/bookmarks.js +73 -0
- package/dist/chat/chat-client.d.ts +55 -0
- package/dist/chat/chat-client.js +279 -0
- package/dist/chat/chat-references.d.ts +5 -0
- package/dist/chat/chat-references.js +5 -0
- package/dist/chat/drafts.d.ts +29 -0
- package/dist/chat/drafts.js +116 -0
- package/dist/chat/forks.d.ts +2 -0
- package/dist/chat/forks.js +28 -0
- package/dist/chat/guards.d.ts +12 -0
- package/dist/chat/guards.js +69 -0
- package/dist/chat/logic/ansi.d.ts +13 -0
- package/dist/chat/logic/ansi.js +185 -0
- package/dist/chat/logic/answers.d.ts +1 -0
- package/dist/chat/logic/answers.js +8 -0
- package/dist/chat/logic/bookmarks.d.ts +5 -0
- package/dist/chat/logic/bookmarks.js +33 -0
- package/dist/chat/logic/context-usage.d.ts +12 -0
- package/dist/chat/logic/context-usage.js +21 -0
- package/dist/chat/logic/fork.d.ts +45 -0
- package/dist/chat/logic/fork.js +148 -0
- package/dist/chat/logic/handback.d.ts +2 -0
- package/dist/chat/logic/handback.js +8 -0
- package/dist/chat/logic/json.d.ts +1 -0
- package/dist/chat/logic/json.js +4 -0
- package/dist/chat/logic/limit.d.ts +7 -0
- package/dist/chat/logic/limit.js +34 -0
- package/dist/chat/logic/resume-compaction.d.ts +14 -0
- package/dist/chat/logic/resume-compaction.js +47 -0
- package/dist/chat/logic/scrubber.d.ts +50 -0
- package/dist/chat/logic/scrubber.js +220 -0
- package/dist/chat/logic/thread-cards.d.ts +3 -0
- package/dist/chat/logic/thread-cards.js +59 -0
- package/dist/chat/logic/timeline-copy.d.ts +4 -0
- package/dist/chat/logic/timeline-copy.js +59 -0
- package/dist/chat/logic/timeline-target.d.ts +12 -0
- package/dist/chat/logic/timeline-target.js +34 -0
- package/dist/chat/logic/timeline.d.ts +115 -0
- package/dist/chat/logic/timeline.js +343 -0
- package/dist/chat/logic/tool-catalog.d.ts +10 -0
- package/dist/chat/logic/tool-catalog.js +44 -0
- package/dist/chat/logic/tools.d.ts +15 -0
- package/dist/chat/logic/tools.js +82 -0
- package/dist/chat/logic/welcome.d.ts +2 -0
- package/dist/chat/logic/welcome.js +10 -0
- package/dist/chat/logic/workflow.d.ts +14 -0
- package/dist/chat/logic/workflow.js +47 -0
- package/dist/chat/mentions.d.ts +65 -0
- package/dist/chat/mentions.js +184 -0
- package/dist/chat/persisted-json.d.ts +5 -0
- package/dist/chat/persisted-json.js +58 -0
- package/dist/chat/preferences.d.ts +27 -0
- package/dist/chat/preferences.js +139 -0
- package/dist/chat/quote.d.ts +2 -0
- package/dist/chat/quote.js +25 -0
- package/dist/chat/recent-messages.d.ts +17 -0
- package/dist/chat/recent-messages.js +36 -0
- package/dist/chat/resume-compaction-dismissals.d.ts +3 -0
- package/dist/chat/resume-compaction-dismissals.js +14 -0
- package/dist/chat/runtime-modes.d.ts +4 -0
- package/dist/chat/runtime-modes.js +15 -0
- package/dist/chat/stash.d.ts +24 -0
- package/dist/chat/stash.js +91 -0
- package/dist/chat/subagent-conversation.d.ts +41 -0
- package/dist/chat/subagent-conversation.js +167 -0
- package/dist/chat/subagent-list.d.ts +19 -0
- package/dist/chat/subagent-list.js +106 -0
- package/dist/chat/subagent-support.d.ts +6 -0
- package/dist/chat/subagent-support.js +14 -0
- package/dist/chat/subagent-view.d.ts +35 -0
- package/dist/chat/subagent-view.js +96 -0
- package/dist/chat/thumbnails.d.ts +10 -0
- package/dist/chat/thumbnails.js +89 -0
- package/dist/chat/timeline-flash.d.ts +12 -0
- package/dist/chat/timeline-flash.js +16 -0
- package/dist/chat/timeline-scroll.d.ts +27 -0
- package/dist/chat/timeline-scroll.js +152 -0
- package/dist/chat/ui/AccountPill.d.ts +3 -0
- package/dist/chat/ui/AccountPill.js +23 -0
- package/dist/chat/ui/AnsiOutput.d.ts +5 -0
- package/dist/chat/ui/AnsiOutput.js +9 -0
- package/dist/chat/ui/BookmarkMarker.d.ts +8 -0
- package/dist/chat/ui/BookmarkMarker.js +57 -0
- package/dist/chat/ui/BookmarkSubmenu.d.ts +3 -0
- package/dist/chat/ui/BookmarkSubmenu.js +33 -0
- package/dist/chat/ui/ChatActivity.d.ts +7 -0
- package/dist/chat/ui/ChatActivity.js +84 -0
- package/dist/chat/ui/ChatReferenceChip.d.ts +4 -0
- package/dist/chat/ui/ChatReferenceChip.js +16 -0
- package/dist/chat/ui/CodeBlock.d.ts +4 -0
- package/dist/chat/ui/CodeBlock.js +132 -0
- package/dist/chat/ui/Composer.d.ts +15 -0
- package/dist/chat/ui/Composer.js +856 -0
- package/dist/chat/ui/ComposerInput.d.ts +29 -0
- package/dist/chat/ui/ComposerInput.js +127 -0
- package/dist/chat/ui/DiffPool.d.ts +5 -0
- package/dist/chat/ui/DiffPool.js +26 -0
- package/dist/chat/ui/EditDiff.d.ts +4 -0
- package/dist/chat/ui/EditDiff.js +21 -0
- package/dist/chat/ui/FadingWords.d.ts +3 -0
- package/dist/chat/ui/FadingWords.js +5 -0
- package/dist/chat/ui/ImageView.d.ts +6 -0
- package/dist/chat/ui/ImageView.js +81 -0
- package/dist/chat/ui/LimitState.d.ts +8 -0
- package/dist/chat/ui/LimitState.js +112 -0
- package/dist/chat/ui/Markdown.d.ts +18 -0
- package/dist/chat/ui/Markdown.js +159 -0
- package/dist/chat/ui/MessageActions.d.ts +9 -0
- package/dist/chat/ui/MessageActions.js +53 -0
- package/dist/chat/ui/Pickers.d.ts +21 -0
- package/dist/chat/ui/Pickers.js +111 -0
- package/dist/chat/ui/PromptComposer.d.ts +13 -0
- package/dist/chat/ui/PromptComposer.js +56 -0
- package/dist/chat/ui/QuoteButton.d.ts +7 -0
- package/dist/chat/ui/QuoteButton.js +74 -0
- package/dist/chat/ui/ResumeCompactionDock.d.ts +5 -0
- package/dist/chat/ui/ResumeCompactionDock.js +14 -0
- package/dist/chat/ui/RunSettings.d.ts +28 -0
- package/dist/chat/ui/RunSettings.js +153 -0
- package/dist/chat/ui/Scrubber.d.ts +17 -0
- package/dist/chat/ui/Scrubber.js +118 -0
- package/dist/chat/ui/SubagentControls.d.ts +11 -0
- package/dist/chat/ui/SubagentControls.js +36 -0
- package/dist/chat/ui/SubagentInfo.d.ts +4 -0
- package/dist/chat/ui/SubagentInfo.js +34 -0
- package/dist/chat/ui/SubagentStopButton.d.ts +7 -0
- package/dist/chat/ui/SubagentStopButton.js +34 -0
- package/dist/chat/ui/SubagentTimeline.d.ts +4 -0
- package/dist/chat/ui/SubagentTimeline.js +107 -0
- package/dist/chat/ui/Timeline.d.ts +6 -0
- package/dist/chat/ui/Timeline.js +424 -0
- package/dist/chat/ui/TimelineMenu.d.ts +12 -0
- package/dist/chat/ui/TimelineMenu.js +54 -0
- package/dist/chat/ui/UnifiedDiff.d.ts +11 -0
- package/dist/chat/ui/UnifiedDiff.js +66 -0
- package/dist/chat/ui/UploadThumb.d.ts +4 -0
- package/dist/chat/ui/UploadThumb.js +11 -0
- package/dist/chat/ui/Welcome.d.ts +4 -0
- package/dist/chat/ui/Welcome.js +16 -0
- package/dist/chat/ui/chips.d.ts +4 -0
- package/dist/chat/ui/chips.js +11 -0
- package/dist/chat/ui/code-lines.d.ts +18 -0
- package/dist/chat/ui/code-lines.js +46 -0
- package/dist/chat/ui/code-streaming.d.ts +1 -0
- package/dist/chat/ui/code-streaming.js +3 -0
- package/dist/chat/ui/code-theme.d.ts +3 -0
- package/dist/chat/ui/code-theme.js +12 -0
- package/dist/chat/ui/composer/chips.d.ts +6 -0
- package/dist/chat/ui/composer/chips.js +31 -0
- package/dist/chat/ui/composer/editor.d.ts +11 -0
- package/dist/chat/ui/composer/editor.js +98 -0
- package/dist/chat/ui/composer/insert.d.ts +2 -0
- package/dist/chat/ui/composer/insert.js +19 -0
- package/dist/chat/ui/composer/keys.d.ts +30 -0
- package/dist/chat/ui/composer/keys.js +100 -0
- package/dist/chat/ui/diff-theme.d.ts +2 -0
- package/dist/chat/ui/diff-theme.js +20 -0
- package/dist/chat/ui/file-links.d.ts +5 -0
- package/dist/chat/ui/file-links.js +20 -0
- package/dist/chat/ui/find-reveal.d.ts +7 -0
- package/dist/chat/ui/find-reveal.js +13 -0
- package/dist/chat/ui/full-diff.d.ts +6 -0
- package/dist/chat/ui/full-diff.js +19 -0
- package/dist/chat/ui/icons.d.ts +4 -0
- package/dist/chat/ui/icons.js +20 -0
- package/dist/chat/ui/markdown-blocks.d.ts +6 -0
- package/dist/chat/ui/markdown-blocks.js +103 -0
- package/dist/chat/ui/quote-selection.d.ts +3 -0
- package/dist/chat/ui/quote-selection.js +46 -0
- package/dist/chat/ui/rehype-chips.d.ts +23 -0
- package/dist/chat/ui/rehype-chips.js +32 -0
- package/dist/chat/ui/rehype-fade.d.ts +23 -0
- package/dist/chat/ui/rehype-fade.js +36 -0
- package/dist/chat/ui/remark-html-as-text.d.ts +8 -0
- package/dist/chat/ui/remark-html-as-text.js +26 -0
- package/dist/chat/ui/reply-context.d.ts +5 -0
- package/dist/chat/ui/reply-context.js +2 -0
- package/dist/chat/ui/reveal.d.ts +13 -0
- package/dist/chat/ui/reveal.js +114 -0
- package/dist/chat/ui/rows/ForksRow.d.ts +4 -0
- package/dist/chat/ui/rows/ForksRow.js +38 -0
- package/dist/chat/ui/rows/MessageRows.d.ts +40 -0
- package/dist/chat/ui/rows/MessageRows.js +204 -0
- package/dist/chat/ui/rows/Rows.d.ts +12 -0
- package/dist/chat/ui/rows/Rows.js +61 -0
- package/dist/chat/ui/rows/SubagentRow.d.ts +17 -0
- package/dist/chat/ui/rows/SubagentRow.js +101 -0
- package/dist/chat/ui/rows/TaskRow.d.ts +8 -0
- package/dist/chat/ui/rows/TaskRow.js +63 -0
- package/dist/chat/ui/rows/WorkRows.d.ts +47 -0
- package/dist/chat/ui/rows/WorkRows.js +168 -0
- package/dist/chat/ui/rows/WorkflowRow.d.ts +8 -0
- package/dist/chat/ui/rows/WorkflowRow.js +48 -0
- package/dist/chat/ui/rows/row-rhythm.d.ts +6 -0
- package/dist/chat/ui/rows/row-rhythm.js +34 -0
- package/dist/chat/ui/useToggleSet.d.ts +6 -0
- package/dist/chat/ui/useToggleSet.js +25 -0
- package/dist/host.d.ts +195 -0
- package/dist/host.js +55 -0
- package/dist/lazy.d.ts +6 -0
- package/dist/lazy.js +57 -0
- package/dist/locales/en/agent-chat.json +446 -0
- package/dist/locales/en/agent-prompts.json +42 -0
- package/dist/locales/en/agent-providers.json +131 -0
- package/dist/locales/en/agent-usage.json +131 -0
- package/dist/locales/nl/agent-chat.json +446 -0
- package/dist/locales/nl/agent-prompts.json +42 -0
- package/dist/locales/nl/agent-providers.json +131 -0
- package/dist/locales/nl/agent-usage.json +131 -0
- package/dist/locales.d.ts +5 -0
- package/dist/locales.js +20 -0
- package/dist/mounted-registry.d.ts +7 -0
- package/dist/mounted-registry.js +39 -0
- package/dist/port-transport.d.ts +6 -0
- package/dist/port-transport.js +129 -0
- package/dist/prompts/logic/focus.d.ts +2 -0
- package/dist/prompts/logic/focus.js +23 -0
- package/dist/prompts/logic/keys.d.ts +42 -0
- package/dist/prompts/logic/keys.js +94 -0
- package/dist/prompts/logic/prompts.d.ts +34 -0
- package/dist/prompts/logic/prompts.fixtures.d.ts +5 -0
- package/dist/prompts/logic/prompts.fixtures.js +79 -0
- package/dist/prompts/logic/prompts.js +32 -0
- package/dist/prompts/logic/subjects.d.ts +50 -0
- package/dist/prompts/logic/subjects.js +63 -0
- package/dist/prompts/logic/useFocusAfterAnswer.d.ts +6 -0
- package/dist/prompts/logic/useFocusAfterAnswer.js +28 -0
- package/dist/prompts/logic/usePromptSession.d.ts +24 -0
- package/dist/prompts/logic/usePromptSession.js +87 -0
- package/dist/prompts/ui/ApprovalBody.d.ts +13 -0
- package/dist/prompts/ui/ApprovalBody.js +34 -0
- package/dist/prompts/ui/PromptActions.d.ts +27 -0
- package/dist/prompts/ui/PromptActions.js +18 -0
- package/dist/prompts/ui/PromptCard.d.ts +16 -0
- package/dist/prompts/ui/PromptCard.js +50 -0
- package/dist/prompts/ui/PromptView.d.ts +2 -0
- package/dist/prompts/ui/PromptView.js +47 -0
- package/dist/prompts/ui/QuestionBody.d.ts +9 -0
- package/dist/prompts/ui/QuestionBody.js +87 -0
- package/dist/providers/AccountColors.d.ts +5 -0
- package/dist/providers/AccountColors.js +8 -0
- package/dist/providers/AccountDetail.d.ts +12 -0
- package/dist/providers/AccountDetail.js +69 -0
- package/dist/providers/AccountVariables.d.ts +8 -0
- package/dist/providers/AccountVariables.js +43 -0
- package/dist/providers/AddAccountForm.d.ts +10 -0
- package/dist/providers/AddAccountForm.js +54 -0
- package/dist/providers/CliDetail.d.ts +12 -0
- package/dist/providers/CliDetail.js +54 -0
- package/dist/providers/ProvidersPane.d.ts +9 -0
- package/dist/providers/ProvidersPane.js +86 -0
- package/dist/providers/account-actions.d.ts +7 -0
- package/dist/providers/account-actions.js +57 -0
- package/dist/providers/parts.d.ts +9 -0
- package/dist/providers/parts.js +18 -0
- package/dist/providers/provider-abilities.d.ts +2 -0
- package/dist/providers/provider-abilities.js +7 -0
- package/dist/providers/variables.d.ts +13 -0
- package/dist/providers/variables.js +63 -0
- package/dist/scope.d.ts +11 -0
- package/dist/scope.js +10 -0
- package/dist/settings/sections.d.ts +13 -0
- package/dist/settings/sections.js +32 -0
- package/dist/state/chats.d.ts +44 -0
- package/dist/state/chats.js +199 -0
- package/dist/state/provider-accounts.d.ts +17 -0
- package/dist/state/provider-accounts.js +67 -0
- package/dist/state/providers.d.ts +17 -0
- package/dist/state/providers.js +33 -0
- package/dist/state/usage.d.ts +44 -0
- package/dist/state/usage.js +121 -0
- package/dist/storage.d.ts +20 -0
- package/dist/storage.js +89 -0
- package/dist/theme.css +196 -0
- package/dist/transport.d.ts +24 -0
- package/dist/transport.js +18 -0
- package/dist/ui/PlainTextarea.d.ts +2 -0
- package/dist/ui/PlainTextarea.js +5 -0
- package/dist/usage/LimitsList.d.ts +18 -0
- package/dist/usage/LimitsList.js +73 -0
- package/dist/usage/UsageBreakdown.d.ts +9 -0
- package/dist/usage/UsageBreakdown.js +67 -0
- package/dist/usage/UsageChart.d.ts +10 -0
- package/dist/usage/UsageChart.js +47 -0
- package/dist/usage/UsageDialog.d.ts +6 -0
- package/dist/usage/UsageDialog.js +12 -0
- package/dist/usage/UsageLimits.d.ts +1 -0
- package/dist/usage/UsageLimits.js +57 -0
- package/dist/usage/UsageLimitsCard.d.ts +4 -0
- package/dist/usage/UsageLimitsCard.js +26 -0
- package/dist/usage/UsagePage.d.ts +7 -0
- package/dist/usage/UsagePage.js +154 -0
- package/dist/usage/UsagePane.d.ts +3 -0
- package/dist/usage/UsagePane.js +21 -0
- package/dist/usage/UsageSummary.d.ts +12 -0
- package/dist/usage/UsageSummary.js +15 -0
- package/dist/usage/UsageTiles.d.ts +7 -0
- package/dist/usage/UsageTiles.js +19 -0
- package/dist/usage/format.d.ts +13 -0
- package/dist/usage/format.js +55 -0
- package/dist/usage/limit-groups.d.ts +22 -0
- package/dist/usage/limit-groups.js +86 -0
- package/dist/usage/limits.d.ts +4 -0
- package/dist/usage/limits.js +58 -0
- package/dist/usage/money.d.ts +1 -0
- package/dist/usage/money.js +13 -0
- package/dist/usage/summary.d.ts +34 -0
- package/dist/usage/summary.js +94 -0
- package/package.json +895 -3
- package/src/agents/AccountDot.tsx +14 -0
- package/src/agents/AgentIcon.tsx +26 -0
- package/src/agents/ModelOptionControl.tsx +68 -0
- package/src/agents/ProviderLogo.tsx +20 -0
- package/src/agents/account-limits.ts +61 -0
- package/src/agents/accounts.ts +137 -0
- package/src/agents/model-name.ts +70 -0
- package/src/agents/model-options.ts +21 -0
- package/src/agents/provider-paths.ts +10 -0
- package/src/agents/status-look.ts +43 -0
- package/src/chat/account-choice.ts +44 -0
- package/src/chat/actions.ts +72 -0
- package/src/chat/activity.ts +8 -0
- package/src/chat/attachments.ts +118 -0
- package/src/chat/bookmarks.ts +87 -0
- package/src/chat/chat-client.ts +345 -0
- package/src/chat/chat-references.ts +11 -0
- package/src/chat/drafts.ts +165 -0
- package/src/chat/forks.ts +33 -0
- package/src/chat/guards.ts +84 -0
- package/src/chat/logic/ansi.ts +206 -0
- package/src/chat/logic/answers.ts +8 -0
- package/src/chat/logic/bookmarks.ts +42 -0
- package/src/chat/logic/context-usage.ts +36 -0
- package/src/chat/logic/fork.ts +200 -0
- package/src/chat/logic/handback.ts +10 -0
- package/src/chat/logic/json.ts +4 -0
- package/src/chat/logic/limit.ts +46 -0
- package/src/chat/logic/resume-compaction.ts +71 -0
- package/src/chat/logic/scrubber.ts +289 -0
- package/src/chat/logic/thread-cards.ts +64 -0
- package/src/chat/logic/timeline-copy.ts +65 -0
- package/src/chat/logic/timeline-target.ts +52 -0
- package/src/chat/logic/timeline.ts +419 -0
- package/src/chat/logic/tool-catalog.ts +62 -0
- package/src/chat/logic/tools.ts +102 -0
- package/src/chat/logic/welcome.ts +13 -0
- package/src/chat/logic/workflow.ts +66 -0
- package/src/chat/mentions.ts +232 -0
- package/src/chat/persisted-json.ts +67 -0
- package/src/chat/preferences.ts +179 -0
- package/src/chat/quote.ts +26 -0
- package/src/chat/recent-messages.ts +59 -0
- package/src/chat/resume-compaction-dismissals.ts +17 -0
- package/src/chat/runtime-modes.ts +18 -0
- package/src/chat/stash.ts +122 -0
- package/src/chat/subagent-conversation.ts +203 -0
- package/src/chat/subagent-list.ts +141 -0
- package/src/chat/subagent-support.ts +21 -0
- package/src/chat/subagent-view.ts +137 -0
- package/src/chat/thumbnails.ts +108 -0
- package/src/chat/timeline-flash.ts +33 -0
- package/src/chat/timeline-scroll.ts +199 -0
- package/src/chat/ui/AccountPill.tsx +31 -0
- package/src/chat/ui/AnsiOutput.tsx +18 -0
- package/src/chat/ui/BookmarkMarker.tsx +108 -0
- package/src/chat/ui/BookmarkSubmenu.tsx +53 -0
- package/src/chat/ui/ChatActivity.tsx +198 -0
- package/src/chat/ui/ChatReferenceChip.tsx +28 -0
- package/src/chat/ui/CodeBlock.tsx +175 -0
- package/src/chat/ui/Composer.tsx +1326 -0
- package/src/chat/ui/ComposerInput.tsx +187 -0
- package/src/chat/ui/DiffPool.tsx +36 -0
- package/src/chat/ui/EditDiff.tsx +30 -0
- package/src/chat/ui/FadingWords.tsx +18 -0
- package/src/chat/ui/ImageView.tsx +159 -0
- package/src/chat/ui/LimitState.tsx +165 -0
- package/src/chat/ui/Markdown.tsx +258 -0
- package/src/chat/ui/MessageActions.tsx +88 -0
- package/src/chat/ui/Pickers.tsx +272 -0
- package/src/chat/ui/PromptComposer.tsx +119 -0
- package/src/chat/ui/QuoteButton.tsx +103 -0
- package/src/chat/ui/ResumeCompactionDock.tsx +28 -0
- package/src/chat/ui/RunSettings.tsx +546 -0
- package/src/chat/ui/Scrubber.tsx +265 -0
- package/src/chat/ui/SubagentControls.tsx +66 -0
- package/src/chat/ui/SubagentInfo.tsx +67 -0
- package/src/chat/ui/SubagentStopButton.tsx +45 -0
- package/src/chat/ui/SubagentTimeline.tsx +170 -0
- package/src/chat/ui/Timeline.tsx +628 -0
- package/src/chat/ui/TimelineMenu.tsx +124 -0
- package/src/chat/ui/UnifiedDiff.tsx +99 -0
- package/src/chat/ui/UploadThumb.tsx +13 -0
- package/src/chat/ui/Welcome.tsx +22 -0
- package/src/chat/ui/chips.ts +15 -0
- package/src/chat/ui/code-lines.ts +60 -0
- package/src/chat/ui/code-streaming.ts +4 -0
- package/src/chat/ui/code-theme.ts +15 -0
- package/src/chat/ui/composer/chips.ts +43 -0
- package/src/chat/ui/composer/editor.ts +118 -0
- package/src/chat/ui/composer/insert.ts +22 -0
- package/src/chat/ui/composer/keys.ts +144 -0
- package/src/chat/ui/diff-theme.ts +23 -0
- package/src/chat/ui/file-links.ts +24 -0
- package/src/chat/ui/find-reveal.ts +23 -0
- package/src/chat/ui/full-diff.ts +25 -0
- package/src/chat/ui/icons.tsx +24 -0
- package/src/chat/ui/markdown-blocks.ts +123 -0
- package/src/chat/ui/quote-selection.ts +53 -0
- package/src/chat/ui/rehype-chips.ts +62 -0
- package/src/chat/ui/rehype-fade.ts +64 -0
- package/src/chat/ui/remark-html-as-text.ts +36 -0
- package/src/chat/ui/reply-context.ts +4 -0
- package/src/chat/ui/reveal.ts +135 -0
- package/src/chat/ui/rows/ForksRow.tsx +79 -0
- package/src/chat/ui/rows/MessageRows.tsx +415 -0
- package/src/chat/ui/rows/Rows.tsx +81 -0
- package/src/chat/ui/rows/SubagentRow.tsx +209 -0
- package/src/chat/ui/rows/TaskRow.tsx +91 -0
- package/src/chat/ui/rows/WorkRows.tsx +445 -0
- package/src/chat/ui/rows/WorkflowRow.tsx +120 -0
- package/src/chat/ui/rows/row-rhythm.ts +37 -0
- package/src/chat/ui/useToggleSet.ts +39 -0
- package/src/host.ts +324 -0
- package/src/lazy.tsx +64 -0
- package/src/locales/en/agent-chat.json +446 -0
- package/src/locales/en/agent-prompts.json +42 -0
- package/src/locales/en/agent-providers.json +131 -0
- package/src/locales/en/agent-usage.json +131 -0
- package/src/locales/nl/agent-chat.json +446 -0
- package/src/locales/nl/agent-prompts.json +42 -0
- package/src/locales/nl/agent-providers.json +131 -0
- package/src/locales/nl/agent-usage.json +131 -0
- package/src/locales.ts +33 -0
- package/src/mounted-registry.ts +45 -0
- package/src/port-transport.ts +146 -0
- package/src/prompts/logic/focus.ts +25 -0
- package/src/prompts/logic/keys.ts +116 -0
- package/src/prompts/logic/prompts.fixtures.ts +84 -0
- package/src/prompts/logic/prompts.ts +58 -0
- package/src/prompts/logic/subjects.ts +122 -0
- package/src/prompts/logic/useFocusAfterAnswer.ts +38 -0
- package/src/prompts/logic/usePromptSession.ts +114 -0
- package/src/prompts/ui/ApprovalBody.tsx +109 -0
- package/src/prompts/ui/PromptActions.tsx +109 -0
- package/src/prompts/ui/PromptCard.tsx +101 -0
- package/src/prompts/ui/PromptView.tsx +111 -0
- package/src/prompts/ui/QuestionBody.tsx +174 -0
- package/src/providers/AccountColors.tsx +8 -0
- package/src/providers/AccountDetail.tsx +209 -0
- package/src/providers/AccountVariables.tsx +126 -0
- package/src/providers/AddAccountForm.tsx +121 -0
- package/src/providers/CliDetail.tsx +157 -0
- package/src/providers/ProvidersPane.tsx +236 -0
- package/src/providers/account-actions.ts +67 -0
- package/src/providers/parts.tsx +25 -0
- package/src/providers/provider-abilities.ts +9 -0
- package/src/providers/variables.ts +87 -0
- package/src/scope.ts +30 -0
- package/src/settings/sections.ts +47 -0
- package/src/state/chats.ts +279 -0
- package/src/state/provider-accounts.ts +87 -0
- package/src/state/providers.ts +50 -0
- package/src/state/usage.ts +196 -0
- package/src/storage.ts +113 -0
- package/src/theme.css +196 -0
- package/src/transport.ts +50 -0
- package/src/ui/PlainTextarea.tsx +6 -0
- package/src/usage/LimitsList.tsx +232 -0
- package/src/usage/UsageBreakdown.tsx +210 -0
- package/src/usage/UsageChart.tsx +113 -0
- package/src/usage/UsageDialog.tsx +20 -0
- package/src/usage/UsageLimits.tsx +145 -0
- package/src/usage/UsageLimitsCard.tsx +36 -0
- package/src/usage/UsagePage.tsx +276 -0
- package/src/usage/UsagePane.tsx +52 -0
- package/src/usage/UsageSummary.tsx +50 -0
- package/src/usage/UsageTiles.tsx +34 -0
- package/src/usage/format.ts +71 -0
- package/src/usage/limit-groups.ts +119 -0
- package/src/usage/limits.ts +71 -0
- package/src/usage/money.ts +14 -0
- package/src/usage/summary.ts +137 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useTranslation } from 'react-i18next';
|
|
2
|
+
import { ErrorBoundary } from '@adecore/ui';
|
|
3
|
+
import type { ThreadCard } from '../../../host';
|
|
4
|
+
import type { TimelineRow } from '../../logic/timeline';
|
|
5
|
+
import type { SubagentStep } from '../../subagent-view';
|
|
6
|
+
import { AgentTurnRow, ApprovalHistoryRow, AssistantRow, CompactionRow, NoteRow, QuestionHistoryRow, ReportRow, ThinkingRow, UserRow } from './MessageRows';
|
|
7
|
+
import { ForksRow } from './ForksRow';
|
|
8
|
+
import { SubagentBranchRow } from './SubagentRow';
|
|
9
|
+
import { WorkflowRow } from './WorkflowRow';
|
|
10
|
+
import { ChangedFilesRow, TurnFoldRow, WorkGroupRow, WorkLiveRow, WorkRow, WorkingRow } from './WorkRows';
|
|
11
|
+
|
|
12
|
+
export interface RowProps {
|
|
13
|
+
row: TimelineRow;
|
|
14
|
+
chatId: string;
|
|
15
|
+
toggleGroup(id: string): void;
|
|
16
|
+
toggleTurn(id: string): void;
|
|
17
|
+
toggleSubagent(id: string): void;
|
|
18
|
+
openSubagent(toolUseId: string): void;
|
|
19
|
+
/* Opens the whole conversation of a subagent or a workflow's agent in the thread's place; absent where there is nowhere to open it. */
|
|
20
|
+
openConversation?(step: SubagentStep): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Its own component, so a card that throws while it renders is caught by the boundary around it. */
|
|
24
|
+
function AppCardBody({ card }: { card: ThreadCard }) {
|
|
25
|
+
return card.render();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function AppCardRow({ card }: { card: ThreadCard }) {
|
|
29
|
+
const { t } = useTranslation('agent-chat');
|
|
30
|
+
return (
|
|
31
|
+
<ErrorBoundary label={t('timeline.cardFailed')} resetKeys={[card]} compact className="relative rounded-lg">
|
|
32
|
+
<AppCardBody card={card} />
|
|
33
|
+
</ErrorBoundary>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* One row of a thread, the chat's own or a subagent's read back, drawn the same way in both. */
|
|
38
|
+
export function Row({ row, chatId, toggleGroup, toggleTurn, toggleSubagent, openSubagent, openConversation }: RowProps) {
|
|
39
|
+
switch (row.kind) {
|
|
40
|
+
case 'user':
|
|
41
|
+
return <UserRow chatId={chatId} item={row.item} />;
|
|
42
|
+
case 'turn-start': {
|
|
43
|
+
const toolUseId = row.turn.taskToolUseId;
|
|
44
|
+
return <AgentTurnRow label={row.label} onOpen={toolUseId ? () => openSubagent(toolUseId) : undefined} />;
|
|
45
|
+
}
|
|
46
|
+
case 'assistant':
|
|
47
|
+
return <AssistantRow chatId={chatId} item={row.item} />;
|
|
48
|
+
case 'report':
|
|
49
|
+
return <ReportRow id={row.id} text={row.text} />;
|
|
50
|
+
case 'thinking':
|
|
51
|
+
return <ThinkingRow chatId={chatId} item={row.item} />;
|
|
52
|
+
case 'work':
|
|
53
|
+
return <WorkRow tool={row.tool} />;
|
|
54
|
+
case 'work-live':
|
|
55
|
+
return <WorkLiveRow chatId={chatId} tool={row.tool} />;
|
|
56
|
+
case 'workflow':
|
|
57
|
+
return <WorkflowRow chatId={chatId} tool={row.tool} workflow={row.workflow} onOpenAgent={openConversation} />;
|
|
58
|
+
case 'work-group':
|
|
59
|
+
return <WorkGroupRow tools={row.tools} summary={row.summary} expanded={row.expanded} onToggle={() => toggleGroup(row.id)} />;
|
|
60
|
+
case 'subagent':
|
|
61
|
+
return <SubagentBranchRow chatId={chatId} branch={row} onToggle={toggleSubagent} onOpenConversation={openConversation} />;
|
|
62
|
+
case 'turn-fold':
|
|
63
|
+
return <TurnFoldRow turn={row.turn} label={row.label} work={row.work} expanded={row.expanded} onToggle={() => toggleTurn(row.turn.id)} />;
|
|
64
|
+
case 'forks':
|
|
65
|
+
return <ForksRow chatId={chatId} turnId={row.turnId} />;
|
|
66
|
+
case 'changed-files':
|
|
67
|
+
return <ChangedFilesRow chatId={chatId} turnId={row.turnId} tools={row.tools} diff={row.diff} checkpoint={row.checkpoint} />;
|
|
68
|
+
case 'approval':
|
|
69
|
+
return <ApprovalHistoryRow item={row.item} />;
|
|
70
|
+
case 'question':
|
|
71
|
+
return <QuestionHistoryRow item={row.item} />;
|
|
72
|
+
case 'note':
|
|
73
|
+
return <NoteRow id={row.id} level={row.level} text={row.text} from={row.from} />;
|
|
74
|
+
case 'compaction':
|
|
75
|
+
return <CompactionRow preTokens={row.preTokens} />;
|
|
76
|
+
case 'working':
|
|
77
|
+
return <WorkingRow startedAt={row.startedAt} />;
|
|
78
|
+
case 'app-card':
|
|
79
|
+
return <AppCardRow card={row.card} />;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Bot, ChevronDown } from 'lucide-react';
|
|
5
|
+
import type { ChatAssistantItem, ChatItem, ChatSubagentItem } from '@adecore/agent-contracts';
|
|
6
|
+
import type { SubagentBranch } from '../../logic/timeline';
|
|
7
|
+
import { formatElapsedShort } from '@adecore/ui/format';
|
|
8
|
+
import { Icon, useNow } from '@adecore/ui';
|
|
9
|
+
import { useOpenForFind } from '../find-reveal';
|
|
10
|
+
import { Markdown } from '../Markdown';
|
|
11
|
+
import { TaskRow } from './TaskRow';
|
|
12
|
+
import { RunningFor, ToggleLine, WorkLiveRow, WorkRow } from './WorkRows';
|
|
13
|
+
import { entryTimeOf, statusWordOf, taskIdOf } from '../../subagent-list';
|
|
14
|
+
import { useSubagentSupport } from '../../subagent-support';
|
|
15
|
+
import { canOpenSubagent, crumbOf, type SubagentStep } from '../../subagent-view';
|
|
16
|
+
import { chatHost, type SubagentTask } from '../../../host';
|
|
17
|
+
import { useChatScope } from '../../../scope';
|
|
18
|
+
import { useCurrentItem } from '../../../state/chats';
|
|
19
|
+
|
|
20
|
+
// The work of a long-running agent scrolls inside its row instead of pushing the thread away.
|
|
21
|
+
const CHILDREN_MAX_PX = 320;
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* One step a sub-agent took, inside its parent's row. The thread's own `Row` draws the same kinds,
|
|
25
|
+
* but off a timeline it has already grouped and folded, and it writes an answer at the size of a
|
|
26
|
+
* message; here every step is a line and the text is the aside under it.
|
|
27
|
+
*/
|
|
28
|
+
function ChildRow({ chatId, item }: { chatId: string; item: ChatItem }) {
|
|
29
|
+
if (item.kind === 'tool') {
|
|
30
|
+
return item.state === 'running' ? <WorkLiveRow chatId={chatId} tool={item} /> : <WorkRow tool={item} />;
|
|
31
|
+
}
|
|
32
|
+
if (item.kind === 'assistant') {
|
|
33
|
+
return <ChildText chatId={chatId} item={item} />;
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function ChildText({ chatId, item: derived }: { chatId: string; item: ChatAssistantItem }) {
|
|
39
|
+
const item = useCurrentItem(chatId, derived);
|
|
40
|
+
return (
|
|
41
|
+
<div className="-mx-1 px-1 pb-2 text-xs text-text-muted select-text">
|
|
42
|
+
<Markdown text={item.text} />
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function StatusPill({ item, task }: { item: ChatSubagentItem; task: SubagentTask | null }) {
|
|
48
|
+
const { t } = useTranslation('agent-chat');
|
|
49
|
+
const paused = statusWordOf(item, task) === 'paused';
|
|
50
|
+
const now = useNow(60_000, paused);
|
|
51
|
+
if (paused) {
|
|
52
|
+
return <span className="shrink-0 text-xs text-text-faint tabular-nums">{entryTimeOf(item, task, now)}</span>;
|
|
53
|
+
}
|
|
54
|
+
if (item.status === 'running') {
|
|
55
|
+
return <RunningFor startedAt={item.startedAt} />;
|
|
56
|
+
}
|
|
57
|
+
const failed = item.status === 'failed';
|
|
58
|
+
const duration = item.finishedAt === null ? null : formatElapsedShort(item.finishedAt - item.startedAt);
|
|
59
|
+
const outcome = failed ? 'failed' : 'done';
|
|
60
|
+
return (
|
|
61
|
+
<span className={clsx('shrink-0 text-xs tabular-nums', failed ? 'text-status-error' : 'text-text-faint')}>
|
|
62
|
+
{duration === null ? t(`common.status.${outcome}`) : t(`rows.subagent.${outcome}In`, { duration })}
|
|
63
|
+
</span>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* What the sub-agent did, live: its own tool calls and the text it wrote, as ordinary rows. */
|
|
68
|
+
function SubagentWork({ chatId, item, work }: { chatId: string; item: ChatSubagentItem; work: ChatItem[] }) {
|
|
69
|
+
const { t } = useTranslation('agent-chat');
|
|
70
|
+
const scroller = useRef<HTMLDivElement>(null);
|
|
71
|
+
const running = item.status === 'running';
|
|
72
|
+
useLayoutEffect(() => {
|
|
73
|
+
// While it works, the newest line is the one worth seeing.
|
|
74
|
+
if (running && scroller.current) {
|
|
75
|
+
scroller.current.scrollTop = scroller.current.scrollHeight;
|
|
76
|
+
}
|
|
77
|
+
}, [work.length, running]);
|
|
78
|
+
if (work.length === 0) {
|
|
79
|
+
// A line inside a chat row, where the centered block of an EmptyState would outweigh the row itself.
|
|
80
|
+
return <div className="ml-6 pb-1 text-xs text-text-faint">{t('rows.subagent.nothingYet')}</div>;
|
|
81
|
+
}
|
|
82
|
+
return (
|
|
83
|
+
<div ref={scroller} className="ml-6 overflow-y-auto" style={{ maxHeight: CHILDREN_MAX_PX }}>
|
|
84
|
+
{item.itemsTruncated && <div className="pb-1 text-xs text-text-faint">{t('rows.subagent.truncated')}</div>}
|
|
85
|
+
{work.map((child) => (
|
|
86
|
+
<ChildRow key={child.id} chatId={chatId} item={child} />
|
|
87
|
+
))}
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* The report the sub-agent handed back, behind a fold: the row is about the work, this is the answer. */
|
|
93
|
+
function SubagentResult({ itemId, result }: { itemId: string; result: string }) {
|
|
94
|
+
const { t } = useTranslation('agent-chat');
|
|
95
|
+
const [open, setOpen] = useState(false);
|
|
96
|
+
useOpenForFind(itemId, 'output', setOpen);
|
|
97
|
+
return (
|
|
98
|
+
<div className="ml-6 pb-1">
|
|
99
|
+
<button className="flex items-center gap-1.5 text-xs text-text-muted hover:text-text" onClick={() => setOpen((o) => !o)}>
|
|
100
|
+
<Icon icon={ChevronDown} size={12} className={clsx('transition-transform', open && 'rotate-180')} />
|
|
101
|
+
{open ? t('rows.subagent.hideResult') : t('rows.subagent.showResult')}
|
|
102
|
+
</button>
|
|
103
|
+
{open && (
|
|
104
|
+
<div data-find-field="output" className="mt-1 rounded-md border border-border bg-surface-raised px-3 py-2 select-text">
|
|
105
|
+
<Markdown text={result} />
|
|
106
|
+
</div>
|
|
107
|
+
)}
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/*
|
|
113
|
+
* One agent the agent delegated to. The line says what it is doing and for how long; pressing it
|
|
114
|
+
* opens the whole conversation in the thread's place, and where there is none to open it folds out
|
|
115
|
+
* the work the thread kept and, once it settled, the report it wrote.
|
|
116
|
+
*/
|
|
117
|
+
export function SubagentRow({
|
|
118
|
+
chatId,
|
|
119
|
+
item,
|
|
120
|
+
work,
|
|
121
|
+
expanded,
|
|
122
|
+
onToggle,
|
|
123
|
+
onOpenConversation
|
|
124
|
+
}: {
|
|
125
|
+
chatId: string;
|
|
126
|
+
item: ChatSubagentItem;
|
|
127
|
+
work: ChatItem[];
|
|
128
|
+
expanded: boolean;
|
|
129
|
+
onToggle(): void;
|
|
130
|
+
/* Opens everything it did in the thread's place, for a surface that has somewhere to open it. */
|
|
131
|
+
onOpenConversation?(): void;
|
|
132
|
+
}) {
|
|
133
|
+
const { t } = useTranslation('agent-chat');
|
|
134
|
+
const { id } = useChatScope();
|
|
135
|
+
const taskId = taskIdOf(item);
|
|
136
|
+
const task = chatHost().tasks.useTask(id, taskId);
|
|
137
|
+
// A task paused on its child's limit is still a running row on the wire, but nothing is at work.
|
|
138
|
+
const running = item.status === 'running' && statusWordOf(item, task) !== 'paused';
|
|
139
|
+
const detail = item.description || item.summary || item.subagentType || '';
|
|
140
|
+
// A row that carries no pointer on a host that already said no has nothing to open.
|
|
141
|
+
const refused = useSubagentSupport((s) => s.unsupported[id] === true);
|
|
142
|
+
const press = onOpenConversation !== undefined && canOpenSubagent(item, refused) ? onOpenConversation : onToggle;
|
|
143
|
+
return (
|
|
144
|
+
<div data-find-item={item.id}>
|
|
145
|
+
{item.origin === 'ruimte' ? (
|
|
146
|
+
<TaskRow item={item} task={task} open={expanded} onPress={press} />
|
|
147
|
+
) : (
|
|
148
|
+
<ToggleLine
|
|
149
|
+
icon={<Icon icon={Bot} size={12} />}
|
|
150
|
+
label={t('rows.subagent.label')}
|
|
151
|
+
detail={detail}
|
|
152
|
+
open={expanded}
|
|
153
|
+
onToggle={press}
|
|
154
|
+
failed={item.status === 'failed'}
|
|
155
|
+
live={running}
|
|
156
|
+
trailing={
|
|
157
|
+
<>
|
|
158
|
+
{item.background && <span className="shrink-0 text-xs text-text-faint">{t('rows.subagent.background')}</span>}
|
|
159
|
+
{running && item.lastTool && <span className="shrink-0 text-xs text-text-faint">{item.lastTool}</span>}
|
|
160
|
+
<StatusPill item={item} task={task} />
|
|
161
|
+
</>
|
|
162
|
+
}
|
|
163
|
+
/>
|
|
164
|
+
)}
|
|
165
|
+
{expanded && (
|
|
166
|
+
<div className="mb-1">
|
|
167
|
+
<SubagentWork chatId={chatId} item={item} work={work} />
|
|
168
|
+
{item.result !== null && <SubagentResult itemId={item.id} result={item.result} />}
|
|
169
|
+
</div>
|
|
170
|
+
)}
|
|
171
|
+
</div>
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/*
|
|
176
|
+
* A sub-agent's row with the agents it opened in turn under it. Those stay in sight whether its own
|
|
177
|
+
* work is folded or not, since opening the parent shows its conversation and not theirs.
|
|
178
|
+
*/
|
|
179
|
+
export function SubagentBranchRow({
|
|
180
|
+
chatId,
|
|
181
|
+
branch,
|
|
182
|
+
onToggle,
|
|
183
|
+
onOpenConversation
|
|
184
|
+
}: {
|
|
185
|
+
chatId: string;
|
|
186
|
+
branch: SubagentBranch;
|
|
187
|
+
onToggle(id: string): void;
|
|
188
|
+
onOpenConversation?(step: SubagentStep): void;
|
|
189
|
+
}) {
|
|
190
|
+
return (
|
|
191
|
+
<>
|
|
192
|
+
<SubagentRow
|
|
193
|
+
chatId={chatId}
|
|
194
|
+
item={branch.item}
|
|
195
|
+
work={branch.children}
|
|
196
|
+
expanded={branch.expanded}
|
|
197
|
+
onToggle={() => onToggle(branch.id)}
|
|
198
|
+
onOpenConversation={onOpenConversation ? () => onOpenConversation(crumbOf(branch.item)) : undefined}
|
|
199
|
+
/>
|
|
200
|
+
{branch.nested.length > 0 && (
|
|
201
|
+
<div className="ml-6">
|
|
202
|
+
{branch.nested.map((child) => (
|
|
203
|
+
<SubagentBranchRow key={child.id} chatId={chatId} branch={child} onToggle={onToggle} onOpenConversation={onOpenConversation} />
|
|
204
|
+
))}
|
|
205
|
+
</div>
|
|
206
|
+
)}
|
|
207
|
+
</>
|
|
208
|
+
);
|
|
209
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Bot, ChevronRight } from 'lucide-react';
|
|
4
|
+
import type { ChatSubagentItem } from '@adecore/agent-contracts';
|
|
5
|
+
import { formatElapsedShort, formatMoment } from '@adecore/ui/format';
|
|
6
|
+
import { Icon, useNow, useTickingText } from '@adecore/ui';
|
|
7
|
+
import { AgentIcon } from '../../../agents/AgentIcon';
|
|
8
|
+
import { modelName, shortModelName } from '../../../agents/model-name';
|
|
9
|
+
import type { SubagentTask } from '../../../host';
|
|
10
|
+
import { useChatScope } from '../../../scope';
|
|
11
|
+
import { useChats } from '../../../state/chats';
|
|
12
|
+
import { useProviders } from '../../../state/providers';
|
|
13
|
+
import { taskRowStateOf, type TaskRowState } from '../../subagent-list';
|
|
14
|
+
|
|
15
|
+
const DOT: Record<TaskRowState, string> = {
|
|
16
|
+
running: 'bg-status-running',
|
|
17
|
+
waiting: 'bg-status-needs-you',
|
|
18
|
+
paused: 'bg-text-faint',
|
|
19
|
+
done: 'bg-status-idle',
|
|
20
|
+
failed: 'bg-status-error',
|
|
21
|
+
cancelled: 'bg-text-faint'
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const STATE_TONE: Record<TaskRowState, string> = {
|
|
25
|
+
running: 'text-text-muted chat-live-text',
|
|
26
|
+
waiting: 'text-status-needs-you',
|
|
27
|
+
paused: 'text-text-faint',
|
|
28
|
+
done: 'text-text-faint',
|
|
29
|
+
failed: 'text-status-error',
|
|
30
|
+
cancelled: 'text-text-faint'
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
function Elapsed({ startedAt }: { startedAt: number }) {
|
|
34
|
+
const ref = useTickingText(() => formatElapsedShort(Date.now() - startedAt));
|
|
35
|
+
return <span ref={ref} className="shrink-0 text-xs text-text-faint tabular-nums" />;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function StateLine({ state, task }: { state: TaskRowState; task: SubagentTask | null }) {
|
|
39
|
+
const { t } = useTranslation('agent-chat');
|
|
40
|
+
const until = state === 'paused' ? task?.paused?.until : undefined;
|
|
41
|
+
const now = useNow(60_000, until === undefined);
|
|
42
|
+
return (
|
|
43
|
+
<span className={clsx('truncate text-xs', STATE_TONE[state])}>
|
|
44
|
+
{until === undefined ? t(`rows.task.${state}`) : t('rows.task.pausedUntil', { time: formatMoment(until, now) })}
|
|
45
|
+
</span>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
* The row of a task given to another node: that agent's mark and model, what the task is about and
|
|
51
|
+
* where it stands, read from the status every client gets of the child's chat. A child without one,
|
|
52
|
+
* a terminal or a node that is gone, keeps the task's own words.
|
|
53
|
+
*/
|
|
54
|
+
export function TaskRow({ item, task, open, onPress }: { item: ChatSubagentItem; task: SubagentTask | null; open: boolean; onPress(): void }) {
|
|
55
|
+
const { t } = useTranslation('agent-chat');
|
|
56
|
+
const { keyOf } = useChatScope();
|
|
57
|
+
const child = useChats((s) => (item.childId === undefined ? undefined : s.statusByKey[keyOf(item.childId)]?.info));
|
|
58
|
+
const provider = child?.provider;
|
|
59
|
+
const slug = child?.model ?? child?.selection.model ?? null;
|
|
60
|
+
const model = useProviders((s) => {
|
|
61
|
+
if (slug === null) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const models = s.providers.find((entry) => entry.kind === provider)?.models;
|
|
65
|
+
return shortModelName(modelName(slug, models), models);
|
|
66
|
+
});
|
|
67
|
+
const state = taskRowStateOf(item, task, child);
|
|
68
|
+
const title = item.description || t('rows.subagent.task');
|
|
69
|
+
const startedAt = task?.createdAt ?? item.startedAt;
|
|
70
|
+
const finishedAt = task === null ? item.finishedAt : (task.settledAt ?? item.finishedAt);
|
|
71
|
+
const settled = state === 'done' || state === 'failed' || state === 'cancelled';
|
|
72
|
+
return (
|
|
73
|
+
<button className="-mx-1 mb-0.5 flex w-[calc(100%+8px)] items-center gap-2.5 rounded-md px-1 py-1 text-left hover:bg-surface-hover" onClick={onPress}>
|
|
74
|
+
<span className="relative grid size-7 shrink-0 place-items-center rounded-full bg-surface-raised text-text">
|
|
75
|
+
{provider === undefined ? <Icon icon={Bot} size={14} /> : <AgentIcon kind={provider} size={14} />}
|
|
76
|
+
<span className={clsx('absolute -right-0.5 -bottom-0.5 size-2.5 rounded-full ring-2 ring-surface', DOT[state])} />
|
|
77
|
+
</span>
|
|
78
|
+
<span className="flex min-w-0 grow flex-col">
|
|
79
|
+
<span data-find-field="summary" className="truncate text-xs font-medium text-text">
|
|
80
|
+
{model === null ? title : t('rows.task.named', { model, title })}
|
|
81
|
+
</span>
|
|
82
|
+
<StateLine state={state} task={task} />
|
|
83
|
+
</span>
|
|
84
|
+
{(state === 'running' || state === 'waiting') && startedAt > 0 && <Elapsed startedAt={startedAt} />}
|
|
85
|
+
{settled && startedAt > 0 && finishedAt !== null && finishedAt >= startedAt && (
|
|
86
|
+
<span className="shrink-0 text-xs text-text-faint tabular-nums">{formatElapsedShort(finishedAt - startedAt)}</span>
|
|
87
|
+
)}
|
|
88
|
+
<Icon icon={ChevronRight} size={12} className={clsx('shrink-0 text-text-faint transition-transform', open && 'rotate-90')} />
|
|
89
|
+
</button>
|
|
90
|
+
);
|
|
91
|
+
}
|