@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,34 @@
|
|
|
1
|
+
import type { ChatApprovalItem, ChatQuestionItem, ChatQuestion } from '@adecore/agent-contracts';
|
|
2
|
+
export type PendingPrompt = ChatApprovalItem | ChatQuestionItem;
|
|
3
|
+
export type PromptAction = {
|
|
4
|
+
kind: 'approve';
|
|
5
|
+
decision: 'allow' | 'allow-always' | 'deny';
|
|
6
|
+
message?: string;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'answer';
|
|
9
|
+
answers: Record<string, string>;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'dismiss';
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'choose';
|
|
14
|
+
choiceId: string;
|
|
15
|
+
};
|
|
16
|
+
export interface PromptAnswer {
|
|
17
|
+
choices: string[];
|
|
18
|
+
text: string;
|
|
19
|
+
custom: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface PromptDraft {
|
|
22
|
+
index: number;
|
|
23
|
+
answers: Record<string, PromptAnswer>;
|
|
24
|
+
reason: string;
|
|
25
|
+
showReason: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare function emptyPromptDraft(): PromptDraft;
|
|
28
|
+
export declare function answerValue(answer: PromptAnswer): string;
|
|
29
|
+
export declare function questionAnswer(draft: PromptDraft, question: ChatQuestion): PromptAnswer;
|
|
30
|
+
export declare function pickPromptChoice(answer: PromptAnswer, question: ChatQuestion, label: string): PromptAnswer;
|
|
31
|
+
export declare function isBlockingPrompt(item: PendingPrompt): boolean;
|
|
32
|
+
export declare function orderPrompts<T>(prompts: readonly T[], blocking: (prompt: T) => boolean, createdAt: (prompt: T) => number): T[];
|
|
33
|
+
export declare function nextPrompt(items: readonly PendingPrompt[], activeId: string | null): PendingPrompt | null;
|
|
34
|
+
export declare function promptAnswers(item: ChatQuestionItem, draft: PromptDraft): Record<string, string> | null;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const endpoints = {
|
|
2
|
+
id: 'endpoints',
|
|
3
|
+
header: 'Shared backoff',
|
|
4
|
+
question: 'Which endpoints should share the backoff?',
|
|
5
|
+
multiSelect: false,
|
|
6
|
+
choices: [
|
|
7
|
+
{ label: 'All three', description: 'Chat, files and terminal' },
|
|
8
|
+
{ label: 'Only chat and files', description: 'Keep terminal retries separate' }
|
|
9
|
+
]
|
|
10
|
+
};
|
|
11
|
+
const checks = {
|
|
12
|
+
id: 'checks',
|
|
13
|
+
header: 'Validation',
|
|
14
|
+
question: 'Which checks should run before the change is ready?',
|
|
15
|
+
multiSelect: true,
|
|
16
|
+
choices: [
|
|
17
|
+
{ label: 'Type check', description: 'Check all workspaces' },
|
|
18
|
+
{ label: 'Unit tests', description: 'Run the targeted tests' },
|
|
19
|
+
{ label: 'Build', description: 'Verify the production bundle' }
|
|
20
|
+
]
|
|
21
|
+
};
|
|
22
|
+
const notes = { id: 'notes', header: 'Instructions', question: 'What else should the agent keep in mind?', multiSelect: false, choices: [] };
|
|
23
|
+
function base(id) {
|
|
24
|
+
return { id: `preview-${id}`, requestId: `preview-${id}`, createdAt: 0, turnId: null };
|
|
25
|
+
}
|
|
26
|
+
function question(id, questions, async = false) {
|
|
27
|
+
return {
|
|
28
|
+
...base(id),
|
|
29
|
+
kind: 'question',
|
|
30
|
+
questions,
|
|
31
|
+
answers: null,
|
|
32
|
+
state: 'pending',
|
|
33
|
+
async
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function approval(long = false) {
|
|
37
|
+
return {
|
|
38
|
+
...base(long ? 'long' : 'edit'),
|
|
39
|
+
kind: 'approval',
|
|
40
|
+
toolUseId: null,
|
|
41
|
+
toolName: 'Edit',
|
|
42
|
+
description: 'Replace the reconnect loop with the shared backoff and export it for the three endpoints.',
|
|
43
|
+
input: {
|
|
44
|
+
file_path: 'src/transport/pool.ts',
|
|
45
|
+
old_string: 'const retries = 10;',
|
|
46
|
+
new_string: 'const retries = 5;\nexport const backoff = createBackoff({ max: retries });' +
|
|
47
|
+
(long ? '\n' + Array.from({ length: 90 }, (_, i) => `// Context line ${i + 1}`).join('\n') : '')
|
|
48
|
+
},
|
|
49
|
+
canAllowAlways: false,
|
|
50
|
+
decision: 'pending'
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// These never enter the chat store or the transport; the preview owns their lifetime.
|
|
54
|
+
export const PROMPT_SAMPLES = [
|
|
55
|
+
{ label: 'Permission · File edit', items: [approval()] },
|
|
56
|
+
{
|
|
57
|
+
label: 'Permission · Command',
|
|
58
|
+
items: [
|
|
59
|
+
{
|
|
60
|
+
...base('command'),
|
|
61
|
+
kind: 'approval',
|
|
62
|
+
toolName: 'Bash',
|
|
63
|
+
toolUseId: null,
|
|
64
|
+
input: { command: 'bun run check && bun test', cwd: '/projects/ruimte' },
|
|
65
|
+
description: "Run the project's validation checks before continuing.",
|
|
66
|
+
canAllowAlways: true,
|
|
67
|
+
allowAlways: { label: 'Allow for this session', description: 'Allow commands in this session until it ends.' },
|
|
68
|
+
decision: 'pending'
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{ label: 'Permission · Long diff', items: [approval(true)] },
|
|
73
|
+
{ label: 'Question · Single choice', items: [question('single', [endpoints])] },
|
|
74
|
+
{ label: 'Question · Multiple choices', items: [question('multiple', [checks])] },
|
|
75
|
+
{ label: 'Question · Written answer', items: [question('written', [notes])] },
|
|
76
|
+
{ label: 'Question · Three questions', items: [question('questions', [endpoints, checks, notes])] },
|
|
77
|
+
{ label: 'Question · Optional', items: [question('optional', [endpoints], true)] },
|
|
78
|
+
{ label: 'Several requests', items: [question('optional', [endpoints], true), approval(), question('single', [endpoints])] }
|
|
79
|
+
];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { toggleChoice } from '../../chat/logic/answers.js';
|
|
2
|
+
export function emptyPromptDraft() {
|
|
3
|
+
return { index: 0, answers: {}, reason: '', showReason: false };
|
|
4
|
+
}
|
|
5
|
+
export function answerValue(answer) {
|
|
6
|
+
return answer.custom ? answer.text.trim() : answer.choices.join(', ');
|
|
7
|
+
}
|
|
8
|
+
export function questionAnswer(draft, question) {
|
|
9
|
+
return draft.answers[question.id] ?? { choices: [], text: '', custom: question.choices.length === 0 };
|
|
10
|
+
}
|
|
11
|
+
export function pickPromptChoice(answer, question, label) {
|
|
12
|
+
return { ...answer, custom: false, choices: question.multiSelect ? toggleChoice(answer.choices, label) : [label] };
|
|
13
|
+
}
|
|
14
|
+
/* An optional question never stands in front of a request that holds the agent up. */
|
|
15
|
+
export function isBlockingPrompt(item) {
|
|
16
|
+
return item.kind === 'approval' || !item.async;
|
|
17
|
+
}
|
|
18
|
+
/* Blocking prompts first and optional ones after, each oldest first. The chat and a canvas's stack both follow it. */
|
|
19
|
+
export function orderPrompts(prompts, blocking, createdAt) {
|
|
20
|
+
return [...prompts].sort((a, b) => Number(blocking(b)) - Number(blocking(a)) || createdAt(a) - createdAt(b));
|
|
21
|
+
}
|
|
22
|
+
export function nextPrompt(items, activeId) {
|
|
23
|
+
const active = items.find((item) => item.requestId === activeId);
|
|
24
|
+
if (active) {
|
|
25
|
+
return active;
|
|
26
|
+
}
|
|
27
|
+
return orderPrompts(items, isBlockingPrompt, (item) => item.createdAt)[0] ?? null;
|
|
28
|
+
}
|
|
29
|
+
export function promptAnswers(item, draft) {
|
|
30
|
+
const answers = Object.fromEntries(item.questions.map((question) => [question.id, answerValue(questionAnswer(draft, question))]));
|
|
31
|
+
return Object.values(answers).every((answer) => answer !== '') ? answers : null;
|
|
32
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type PendingPrompt, type PromptAction, type PromptDraft } from './prompts.js';
|
|
3
|
+
export interface HostPrompt {
|
|
4
|
+
id: string;
|
|
5
|
+
createdAt: number;
|
|
6
|
+
blocking: boolean;
|
|
7
|
+
asks: 'approval' | 'question';
|
|
8
|
+
data: unknown;
|
|
9
|
+
}
|
|
10
|
+
export type PromptSubject = {
|
|
11
|
+
kind: 'chat';
|
|
12
|
+
nodeId: string;
|
|
13
|
+
item: PendingPrompt;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'host';
|
|
16
|
+
nodeId: string;
|
|
17
|
+
prompt: HostPrompt;
|
|
18
|
+
};
|
|
19
|
+
export interface ChatPromptClients {
|
|
20
|
+
approve(chatId: string, requestId: string, decision: 'allow' | 'allow-always' | 'deny', message?: string): Promise<void>;
|
|
21
|
+
answer(chatId: string, requestId: string, answers: Record<string, string>): Promise<void>;
|
|
22
|
+
dismiss(chatId: string, itemId: string): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export interface PromptViewProps {
|
|
25
|
+
subject: PromptSubject;
|
|
26
|
+
draft: PromptDraft;
|
|
27
|
+
onDraft(draft: PromptDraft): void;
|
|
28
|
+
onAction(action: PromptAction): void;
|
|
29
|
+
more: number;
|
|
30
|
+
hasDraft: boolean;
|
|
31
|
+
denyReason: boolean;
|
|
32
|
+
disabled: boolean;
|
|
33
|
+
sending: boolean;
|
|
34
|
+
error: string | null;
|
|
35
|
+
top?: ReactNode;
|
|
36
|
+
onReveal?: () => void;
|
|
37
|
+
}
|
|
38
|
+
export interface ApprovalButtonSpec {
|
|
39
|
+
id: string;
|
|
40
|
+
label: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
primary: boolean;
|
|
43
|
+
lasting?: boolean;
|
|
44
|
+
action: PromptAction;
|
|
45
|
+
}
|
|
46
|
+
export declare function promptIdOf(subject: PromptSubject): string;
|
|
47
|
+
export declare function promptCreatedAt(subject: PromptSubject): number;
|
|
48
|
+
export declare function isBlockingSubject(subject: PromptSubject): boolean;
|
|
49
|
+
export declare function approvalButtons(subject: PromptSubject, reason: string): ApprovalButtonSpec[];
|
|
50
|
+
export declare function answerPrompt(subject: PromptSubject, action: PromptAction, chat: ChatPromptClients | null): Promise<void>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import i18next from 'i18next';
|
|
2
|
+
import { chatHost } from '../../host.js';
|
|
3
|
+
import { isBlockingPrompt } from './prompts.js';
|
|
4
|
+
/* Unique across the chats of a surface and the app's own prompts, and stable while the prompt waits. */
|
|
5
|
+
export function promptIdOf(subject) {
|
|
6
|
+
return subject.kind === 'chat' ? `agent-chat:${subject.nodeId}:${subject.item.requestId}` : subject.prompt.id;
|
|
7
|
+
}
|
|
8
|
+
export function promptCreatedAt(subject) {
|
|
9
|
+
return subject.kind === 'chat' ? subject.item.createdAt : subject.prompt.createdAt;
|
|
10
|
+
}
|
|
11
|
+
/* Only a chat's optional question does not hold anything up; the app says so of its own. */
|
|
12
|
+
export function isBlockingSubject(subject) {
|
|
13
|
+
return subject.kind === 'chat' ? isBlockingPrompt(subject.item) : subject.prompt.blocking;
|
|
14
|
+
}
|
|
15
|
+
/* The buttons of a chat's permission request in the order it draws them: a remembered rule, Deny, then Allow as the primary. */
|
|
16
|
+
export function approvalButtons(subject, reason) {
|
|
17
|
+
if (subject.kind !== 'chat' || subject.item.kind !== 'approval') {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
const { item } = subject;
|
|
21
|
+
const message = reason.trim();
|
|
22
|
+
return [
|
|
23
|
+
...(item.canAllowAlways && item.allowAlways
|
|
24
|
+
? [
|
|
25
|
+
{
|
|
26
|
+
id: 'allow-always',
|
|
27
|
+
label: item.allowAlways.label,
|
|
28
|
+
description: item.allowAlways.description,
|
|
29
|
+
primary: false,
|
|
30
|
+
lasting: true,
|
|
31
|
+
action: { kind: 'approve', decision: 'allow-always' }
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
: []),
|
|
35
|
+
{
|
|
36
|
+
id: 'deny',
|
|
37
|
+
label: i18next.t('agent-prompts:approval.deny'),
|
|
38
|
+
primary: false,
|
|
39
|
+
action: { kind: 'approve', decision: 'deny', ...(message ? { message } : {}) }
|
|
40
|
+
},
|
|
41
|
+
{ id: 'allow', label: i18next.t('agent-prompts:approval.allow'), primary: true, action: { kind: 'approve', decision: 'allow' } }
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
/* Sends a card's action as the request its subject is answered with. A refusal comes back as an error for the card to show. */
|
|
45
|
+
export async function answerPrompt(subject, action, chat) {
|
|
46
|
+
if (subject.kind === 'host') {
|
|
47
|
+
return chatHost().prompts.answer(subject.prompt, action);
|
|
48
|
+
}
|
|
49
|
+
if (chat === null) {
|
|
50
|
+
throw new Error(i18next.t('agent-prompts:error.notConnected'));
|
|
51
|
+
}
|
|
52
|
+
const { item, nodeId } = subject;
|
|
53
|
+
if (action.kind === 'approve') {
|
|
54
|
+
return chat.approve(nodeId, item.requestId, action.decision, action.message);
|
|
55
|
+
}
|
|
56
|
+
if (action.kind === 'answer') {
|
|
57
|
+
return chat.answer(nodeId, item.requestId, action.answers);
|
|
58
|
+
}
|
|
59
|
+
if (action.kind === 'dismiss') {
|
|
60
|
+
return chat.dismiss(nodeId, item.id);
|
|
61
|
+
}
|
|
62
|
+
throw new Error(i18next.t('agent-prompts:error.noChoices'));
|
|
63
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { focusPromptStart } from './focus.js';
|
|
3
|
+
/*
|
|
4
|
+
* The keyboard stays with the prompts it was answering: on where the card that comes next is answered, or
|
|
5
|
+
* wherever `onEmpty` puts it once none is left. A card answered with the keyboard elsewhere takes nothing.
|
|
6
|
+
*/
|
|
7
|
+
export function useFocusAfterAnswer(activeId, container, onEmpty) {
|
|
8
|
+
const pending = useRef(false);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!pending.current) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
pending.current = false;
|
|
14
|
+
if (!focusPromptStart(container.current)) {
|
|
15
|
+
onEmpty();
|
|
16
|
+
}
|
|
17
|
+
// Only a change of the front card is news; a new `onEmpty` each render is not.
|
|
18
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
|
19
|
+
}, [activeId]);
|
|
20
|
+
return {
|
|
21
|
+
hold: () => {
|
|
22
|
+
pending.current = container.current?.contains(document.activeElement) === true;
|
|
23
|
+
},
|
|
24
|
+
release: () => {
|
|
25
|
+
pending.current = false;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type MouseEvent } from 'react';
|
|
2
|
+
import { type PromptDraft } from './prompts.js';
|
|
3
|
+
interface PromptSessionOptions<T> {
|
|
4
|
+
prompts: readonly T[];
|
|
5
|
+
idOf(prompt: T): string;
|
|
6
|
+
pick(waiting: readonly T[], activeId: string | null, activeIndex: number): T | null;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface PromptSession<T> {
|
|
10
|
+
active: T | null;
|
|
11
|
+
activeId: string | null;
|
|
12
|
+
index: number;
|
|
13
|
+
waiting: readonly T[];
|
|
14
|
+
setActive(id: string): void;
|
|
15
|
+
draftOf(id: string): PromptDraft;
|
|
16
|
+
setDraft(id: string, draft: PromptDraft): void;
|
|
17
|
+
sending: boolean;
|
|
18
|
+
errorOf(id: string): string | null;
|
|
19
|
+
act(prompt: T, send: () => Promise<void>): Promise<'sent' | 'failed' | 'busy'>;
|
|
20
|
+
onPointerDownCapture(): void;
|
|
21
|
+
onClickCapture(event: MouseEvent): void;
|
|
22
|
+
}
|
|
23
|
+
export declare function usePromptSession<T>({ prompts, idOf, pick, disabled }: PromptSessionOptions<T>): PromptSession<T>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useRef, useState } from 'react';
|
|
2
|
+
import { emptyPromptDraft } from './prompts.js';
|
|
3
|
+
/*
|
|
4
|
+
* What answering a row of prompts needs besides the prompts: a draft per request that survives
|
|
5
|
+
* paging, one send at a time, the error of the request that failed, and the requests answered here
|
|
6
|
+
* that the machine has not taken off yet.
|
|
7
|
+
*/
|
|
8
|
+
export function usePromptSession({ prompts, idOf, pick, disabled }) {
|
|
9
|
+
const [activeId, setActiveId] = useState(null);
|
|
10
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
11
|
+
const [completed, setCompleted] = useState([]);
|
|
12
|
+
const [drafts, setDrafts] = useState({});
|
|
13
|
+
const [sending, setSending] = useState(false);
|
|
14
|
+
const [error, setError] = useState(null);
|
|
15
|
+
const busy = useRef(false);
|
|
16
|
+
const pressedRequest = useRef(null);
|
|
17
|
+
const stillCompleted = completed.filter((id) => prompts.some((prompt) => idOf(prompt) === id));
|
|
18
|
+
if (stillCompleted.length !== completed.length) {
|
|
19
|
+
setCompleted(stillCompleted);
|
|
20
|
+
}
|
|
21
|
+
const waiting = prompts.filter((prompt) => !completed.includes(idOf(prompt)));
|
|
22
|
+
const active = pick(waiting, activeId, activeIndex);
|
|
23
|
+
const activeKey = active === null ? null : idOf(active);
|
|
24
|
+
const index = active === null ? 0 : waiting.indexOf(active);
|
|
25
|
+
if (index !== activeIndex) {
|
|
26
|
+
setActiveIndex(index);
|
|
27
|
+
}
|
|
28
|
+
if (activeKey !== activeId) {
|
|
29
|
+
setActiveId(activeKey);
|
|
30
|
+
setError(null);
|
|
31
|
+
}
|
|
32
|
+
const finish = (id) => {
|
|
33
|
+
setCompleted((current) => [...current, id]);
|
|
34
|
+
setDrafts((current) => {
|
|
35
|
+
const next = { ...current };
|
|
36
|
+
delete next[id];
|
|
37
|
+
return next;
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const act = async (prompt, send) => {
|
|
41
|
+
if (busy.current || disabled) {
|
|
42
|
+
return 'busy';
|
|
43
|
+
}
|
|
44
|
+
const id = idOf(prompt);
|
|
45
|
+
busy.current = true;
|
|
46
|
+
setSending(true);
|
|
47
|
+
setError(null);
|
|
48
|
+
try {
|
|
49
|
+
await send();
|
|
50
|
+
finish(id);
|
|
51
|
+
return 'sent';
|
|
52
|
+
}
|
|
53
|
+
catch (cause) {
|
|
54
|
+
setError({ id, message: cause instanceof Error ? cause.message : String(cause) });
|
|
55
|
+
return 'failed';
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
busy.current = false;
|
|
59
|
+
setSending(false);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
active,
|
|
64
|
+
activeId: activeKey,
|
|
65
|
+
index,
|
|
66
|
+
waiting,
|
|
67
|
+
setActive: (id) => {
|
|
68
|
+
setActiveId(id);
|
|
69
|
+
setError(null);
|
|
70
|
+
},
|
|
71
|
+
draftOf: (id) => drafts[id] ?? emptyPromptDraft(),
|
|
72
|
+
setDraft: (id, draft) => setDrafts((current) => ({ ...current, [id]: draft })),
|
|
73
|
+
sending,
|
|
74
|
+
errorOf: (id) => (error?.id === id ? error.message : null),
|
|
75
|
+
act,
|
|
76
|
+
onPointerDownCapture: () => {
|
|
77
|
+
pressedRequest.current = activeKey;
|
|
78
|
+
},
|
|
79
|
+
onClickCapture: (event) => {
|
|
80
|
+
// A press that began on Send cannot become Allow when a request arrives underneath it.
|
|
81
|
+
if (event.detail > 0 && event.target.closest('.prompt-card') && pressedRequest.current !== activeKey) {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
event.stopPropagation();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChatApprovalItem } from '@adecore/agent-contracts';
|
|
2
|
+
import type { PromptDraft } from '../logic/prompts.js';
|
|
3
|
+
export declare function CommandBox({ command, cwd }: {
|
|
4
|
+
command: string;
|
|
5
|
+
cwd?: string;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
export declare function ApprovalBody({ item, draft, onDraft, denyReason, locked }: {
|
|
8
|
+
item: ChatApprovalItem;
|
|
9
|
+
draft: PromptDraft;
|
|
10
|
+
onDraft(draft: PromptDraft): void;
|
|
11
|
+
denyReason: boolean;
|
|
12
|
+
locked: boolean;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense, useState } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { approvalChanges, fileChanges } from '../../chat/logic/tools.js';
|
|
6
|
+
import { chatHost } from '../../host.js';
|
|
7
|
+
import { lazyNamed } from '../../lazy.js';
|
|
8
|
+
import { isPrimaryKey } from '../logic/keys.js';
|
|
9
|
+
import { Button, TextMenu } from '@adecore/ui';
|
|
10
|
+
const EditDiff = lazyNamed(() => import('../../chat/ui/EditDiff.js'), 'default');
|
|
11
|
+
const UnifiedDiff = lazyNamed(() => import('../../chat/ui/UnifiedDiff.js'), 'default');
|
|
12
|
+
/* A command in the sunken box a person reads before allowing it, with the folder it runs in when that is known. */
|
|
13
|
+
export function CommandBox({ command, cwd }) {
|
|
14
|
+
return (_jsxs(TextMenu, { className: "rounded-xl bg-surface-sunken p-3", children: [cwd !== undefined && _jsx("p", { className: "mb-2 break-all font-mono text-xs text-text-muted select-text", children: cwd }), _jsx("pre", { className: "whitespace-pre-wrap break-words font-mono text-code text-text select-text", children: command })] }));
|
|
15
|
+
}
|
|
16
|
+
function ApprovalDetails({ item }) {
|
|
17
|
+
const { t } = useTranslation('agent-prompts');
|
|
18
|
+
const [expanded, setExpanded] = useState(false);
|
|
19
|
+
const patches = approvalChanges(item.input);
|
|
20
|
+
const edits = patches.length ? [] : fileChanges(item.toolName, item.input);
|
|
21
|
+
const input = typeof item.input === 'object' && item.input !== null ? item.input : {};
|
|
22
|
+
return (_jsxs(_Fragment, { children: [item.description && _jsx("p", { className: "text-sm text-text-muted", children: item.description }), patches.length + edits.length > 1 && (_jsx("p", { className: "text-xs text-text-muted", children: t('approval.allChanges', { count: patches.length + edits.length }) })), patches.length + edits.length > 0 ? (_jsxs("div", { className: "overflow-hidden rounded-xl bg-surface-sunken", children: [_jsx("div", { className: clsx('overflow-auto', !expanded && 'max-h-44'), children: _jsxs(Suspense, { fallback: _jsx("p", { className: "p-3 text-xs text-text-muted", children: t('approval.loadingDiff') }), children: [patches.map((change, i) => (_jsx(UnifiedDiff, { change: change }, i))), edits.map((change, i) => (_jsx(EditDiff, { change: change }, i)))] }) }), _jsx("div", { className: "flex items-center border-t border-border p-1", children: _jsx(Button, { size: "sm", "aria-expanded": expanded, onClick: () => setExpanded(!expanded), children: expanded ? t('approval.collapseDiff') : t('approval.viewDiff') }) })] })) : typeof input.command === 'string' ? (_jsx(CommandBox, { command: input.command, cwd: typeof input.cwd === 'string' ? input.cwd : undefined })) : (_jsxs("details", { children: [_jsx("summary", { className: "flex h-7 cursor-pointer items-center text-xs text-text-muted", children: t('approval.details') }), _jsx(TextMenu, { children: _jsx("pre", { className: "max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-surface-sunken p-3 font-mono text-code text-text select-text", children: JSON.stringify(item.input, null, 2) }) })] }))] }));
|
|
23
|
+
}
|
|
24
|
+
/* A chat's permission request: the diff, the command or the raw input, and the reason a Deny may carry. */
|
|
25
|
+
export function ApprovalBody({ item, draft, onDraft, denyReason, locked }) {
|
|
26
|
+
const { t } = useTranslation('agent-prompts');
|
|
27
|
+
const AnswerField = chatHost().dictation.Textarea;
|
|
28
|
+
return (_jsxs(_Fragment, { children: [_jsx(ApprovalDetails, { item: item }), denyReason && draft.showReason && (_jsx(AnswerField, { className: "field min-h-16 text-sm", autoFocus: true, "aria-label": t('approval.reasonLabel'), placeholder: t('approval.reasonPlaceholder'), disabled: locked, value: draft.reason, onChange: (e) => onDraft({ ...draft, reason: e.target.value }), onKeyDown: (e) => {
|
|
29
|
+
// Mod+Enter presses Allow everywhere else in the card, which is the opposite of what a reason for declining is typed for.
|
|
30
|
+
if (isPrimaryKey(e.nativeEvent, chatHost().isApplePlatform())) {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
}
|
|
33
|
+
} }))] }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
export declare function PromptPrimary(props: ButtonHTMLAttributes<HTMLButtonElement>): import("react").JSX.Element;
|
|
3
|
+
export interface ApprovalButton {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
primary: boolean;
|
|
8
|
+
lasting?: boolean;
|
|
9
|
+
onPress(): void;
|
|
10
|
+
}
|
|
11
|
+
export declare function ApprovalActions({ buttons, onAddReason, locked, sending }: {
|
|
12
|
+
buttons: readonly ApprovalButton[];
|
|
13
|
+
onAddReason?: () => void;
|
|
14
|
+
locked: boolean;
|
|
15
|
+
sending: boolean;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
export declare function QuestionActions({ index, dismissable, last, ready, locked, sending, onPrevious, onDismiss, onCommit }: {
|
|
18
|
+
index: number;
|
|
19
|
+
dismissable: boolean;
|
|
20
|
+
last: boolean;
|
|
21
|
+
ready: boolean;
|
|
22
|
+
locked: boolean;
|
|
23
|
+
sending: boolean;
|
|
24
|
+
onPrevious(): void;
|
|
25
|
+
onDismiss(): void;
|
|
26
|
+
onCommit(): void;
|
|
27
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { ArrowUp, CircleCheck } from 'lucide-react';
|
|
4
|
+
import { Button, Icon } from '@adecore/ui';
|
|
5
|
+
/* The one button Mod+Enter presses and ArrowDown from the heading lands on, when the body has nothing to choose. */
|
|
6
|
+
export function PromptPrimary(props) {
|
|
7
|
+
return _jsx(Button, { variant: "inverse", size: "sm", "data-prompt-primary": true, ...props });
|
|
8
|
+
}
|
|
9
|
+
/* The buttons of a permission request, in the order a chat draws them: the quieter ones first, Allow last. */
|
|
10
|
+
export function ApprovalActions({ buttons, onAddReason, locked, sending }) {
|
|
11
|
+
const { t } = useTranslation('agent-prompts');
|
|
12
|
+
return (_jsxs(_Fragment, { children: [onAddReason && (_jsx(Button, { size: "sm", disabled: locked, onClick: onAddReason, children: t('approval.addReason') })), _jsx("div", { className: "ml-auto flex flex-wrap items-center justify-end gap-1.5", children: buttons.map((button) => button.primary ? (_jsxs(PromptPrimary, { disabled: locked, onClick: button.onPress, children: [_jsx(Icon, { icon: CircleCheck, size: 16 }), sending ? t('sending') : button.label] }, button.id)) : (_jsx(Button, { size: "sm", disabled: locked, "aria-description": button.description, "data-prompt-lasting": button.lasting ? '' : undefined, onClick: button.onPress, children: button.label }, button.id))) })] }));
|
|
13
|
+
}
|
|
14
|
+
/* The buttons of a question: back through its questions, dismissing an optional one, and Next until the last becomes Answer. */
|
|
15
|
+
export function QuestionActions({ index, dismissable, last, ready, locked, sending, onPrevious, onDismiss, onCommit }) {
|
|
16
|
+
const { t } = useTranslation(['agent-prompts', 'agent-chat']);
|
|
17
|
+
return (_jsxs(_Fragment, { children: [index > 0 && (_jsx(Button, { size: "sm", disabled: sending, onClick: onPrevious, children: t('question.previous') })), dismissable && index === 0 && (_jsx(Button, { size: "sm", disabled: locked, onClick: onDismiss, children: t('agent-chat:common.action.dismiss') })), _jsx("span", { className: "grow" }), _jsxs(PromptPrimary, { disabled: locked || !ready, onClick: onCommit, children: [sending ? t('sending') : last ? t('question.answer') : t('question.next'), _jsx(Icon, { icon: ArrowUp, size: 16 })] })] }));
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export declare const PROMPT_SURFACE = "flex flex-col overflow-hidden rounded-2xl border border-border bg-[color-mix(in_srgb,var(--surface-raised)_92%,transparent)] shadow-float backdrop-blur-[14px]";
|
|
3
|
+
export type PromptCardKind = 'approval' | 'question' | 'waiting';
|
|
4
|
+
interface PromptCardProps {
|
|
5
|
+
kind: PromptCardKind;
|
|
6
|
+
heading: ReactNode;
|
|
7
|
+
meta?: ReactNode;
|
|
8
|
+
top?: ReactNode;
|
|
9
|
+
actions: ReactNode;
|
|
10
|
+
busy: boolean;
|
|
11
|
+
notice: string | null;
|
|
12
|
+
error: string | null;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare function PromptCard({ kind, heading, meta, top, actions, busy, notice, error, children }: PromptCardProps): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { Hand, MessageCircleQuestionMark } from 'lucide-react';
|
|
4
|
+
import { chatHost } from '../../host.js';
|
|
5
|
+
import { headingKey, isPrimaryKey, staysInCard, stepIndex, toolbarKey } from '../logic/keys.js';
|
|
6
|
+
import { Icon } from '@adecore/ui';
|
|
7
|
+
/* The raised glass a chat's composer is made of, for a card that stands on its own over a canvas. */
|
|
8
|
+
export const PROMPT_SURFACE = 'flex flex-col overflow-hidden rounded-2xl border border-border bg-[color-mix(in_srgb,var(--surface-raised)_92%,transparent)] shadow-float backdrop-blur-[14px]';
|
|
9
|
+
const ICONS = { approval: Hand, question: MessageCircleQuestionMark, waiting: MessageCircleQuestionMark };
|
|
10
|
+
/*
|
|
11
|
+
* The keys every card shares: Mod+Enter, entering from the heading and the action row. The body handles
|
|
12
|
+
* its own keys first and says so with `preventDefault`.
|
|
13
|
+
*/
|
|
14
|
+
function onCardKeyDown(event) {
|
|
15
|
+
const card = event.currentTarget;
|
|
16
|
+
const target = event.target instanceof HTMLElement ? event.target : null;
|
|
17
|
+
if (!event.defaultPrevented) {
|
|
18
|
+
if (isPrimaryKey(event.nativeEvent, chatHost().isApplePlatform())) {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
// A click on the button itself, so a disabled Next or Answer stays as disabled as it looks.
|
|
21
|
+
card.querySelector('[data-prompt-primary]:not(:disabled)')?.click();
|
|
22
|
+
}
|
|
23
|
+
else if (target?.classList.contains('prompt-heading') && headingKey(event.nativeEvent)) {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
card.querySelector('[data-prompt-entry]:not(:disabled), [data-prompt-primary]:not(:disabled)')?.focus();
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const toolbar = target?.closest('[role="toolbar"]');
|
|
29
|
+
const step = toolbar ? toolbarKey(event.nativeEvent) : null;
|
|
30
|
+
if (toolbar && step !== null) {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
const buttons = [...toolbar.querySelectorAll('button:not(:disabled)')];
|
|
33
|
+
const current = buttons.findIndex((button) => button.contains(target));
|
|
34
|
+
buttons[stepIndex(current, buttons.length, step)]?.focus();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (event.defaultPrevented || staysInCard(event.nativeEvent)) {
|
|
39
|
+
event.stopPropagation();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/* What every prompt looks like, whatever asked it: in a chat's composer and in a canvas's stack. */
|
|
43
|
+
export function PromptCard({ kind, heading, meta, top, actions, busy, notice, error, children }) {
|
|
44
|
+
const { t } = useTranslation('agent-prompts');
|
|
45
|
+
const card = (_jsxs("div", { className: "prompt-card flex min-h-0 flex-col gap-2 p-3", role: "group", "aria-label": t(`card.${kind}`), "aria-busy": busy, onKeyDown: onCardKeyDown, children: [_jsx("div", { className: "-m-1.5 max-h-[min(50dvh,480px)] overflow-auto overscroll-contain p-1.5", children: _jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex items-start gap-2", children: [_jsx(Icon, { icon: ICONS[kind], size: 16, className: "mt-[3px] shrink-0 text-status-needs-you" }), _jsx("h3", { tabIndex: -1, className: "prompt-heading min-w-0 break-words text-sm font-semibold text-text outline-offset-4", children: heading })] }), meta && _jsx("div", { className: "flex flex-wrap gap-x-3 gap-y-1 text-xs text-text-muted", children: meta }), children, notice && _jsx("p", { className: "text-xs text-text-muted", children: notice }), error && (_jsx("p", { role: "alert", className: "text-xs text-status-error", children: error }))] }) }), _jsx("div", { role: "toolbar", "aria-label": t('toolbar'), className: "flex flex-wrap items-center gap-1.5", children: actions })] }));
|
|
46
|
+
if (top === undefined) {
|
|
47
|
+
return card;
|
|
48
|
+
}
|
|
49
|
+
return (_jsxs("div", { className: "flex min-h-0 flex-col", children: [top, card] }));
|
|
50
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { type PromptViewProps } from '../logic/subjects.js';
|
|
2
|
+
export declare function PromptView(props: PromptViewProps): string | number | bigint | boolean | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | Iterable<import("react").ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { toolSummary } from '../../chat/logic/tools.js';
|
|
4
|
+
import { chatHost } from '../../host.js';
|
|
5
|
+
import { answerValue, promptAnswers, questionAnswer } from '../logic/prompts.js';
|
|
6
|
+
import { approvalButtons } from '../logic/subjects.js';
|
|
7
|
+
import { ApprovalBody } from './ApprovalBody.js';
|
|
8
|
+
import { ApprovalActions, QuestionActions } from './PromptActions.js';
|
|
9
|
+
import { PromptCard } from './PromptCard.js';
|
|
10
|
+
import { QuestionBody } from './QuestionBody.js';
|
|
11
|
+
/* A permission request or question, answered in place: a chat's, or one of the app's own that it draws itself. */
|
|
12
|
+
export function PromptView(props) {
|
|
13
|
+
const { subject, draft, onDraft, onAction, more, hasDraft, denyReason, disabled, sending, error, top } = props;
|
|
14
|
+
const { t } = useTranslation('agent-prompts');
|
|
15
|
+
const locked = sending || disabled;
|
|
16
|
+
const notice = disabled ? t('error.notConnected') : null;
|
|
17
|
+
const buttons = approvalButtons(subject, draft.reason).map(({ action, ...button }) => ({ ...button, onPress: () => onAction(action) }));
|
|
18
|
+
if (subject.kind === 'host') {
|
|
19
|
+
return chatHost().prompts.render(subject.prompt, props);
|
|
20
|
+
}
|
|
21
|
+
const { item } = subject;
|
|
22
|
+
const question = item.kind === 'question' ? item.questions[Math.min(draft.index, item.questions.length - 1)] : null;
|
|
23
|
+
const answer = question ? questionAnswer(draft, question) : null;
|
|
24
|
+
const last = item.kind === 'question' && draft.index === item.questions.length - 1;
|
|
25
|
+
// Whether Next or Answer may go with this draft. The keys ask it as well as the button.
|
|
26
|
+
const readyWith = (next) => item.kind === 'question' && !!question && !!answerValue(questionAnswer(next, question)) && !(last && !promptAnswers(item, next));
|
|
27
|
+
const commit = (next) => {
|
|
28
|
+
if (item.kind !== 'question' || locked || !readyWith(next)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (!last) {
|
|
32
|
+
onDraft({ ...next, index: next.index + 1 });
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const answers = promptAnswers(item, next);
|
|
36
|
+
if (answers) {
|
|
37
|
+
onAction({ kind: 'answer', answers });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const multiple = item.kind === 'question' && item.questions.length > 1;
|
|
42
|
+
const meta = more > 0 || hasDraft || multiple ? (_jsxs(_Fragment, { children: [more > 0 && _jsx("span", { className: "tabular-nums", children: t('meta.waiting', { count: more + 1 }) }), multiple && _jsx("span", { className: "tabular-nums", children: t('meta.question', { index: draft.index + 1, total: item.questions.length }) }), hasDraft && _jsx("span", { children: t('meta.draftSaved') })] })) : null;
|
|
43
|
+
if (item.kind === 'approval') {
|
|
44
|
+
return (_jsx(PromptCard, { kind: "approval", heading: `${item.toolName === 'Bash' ? t('approval.runCommand') : item.toolName} ${item.toolName === 'Bash' ? '' : toolSummary(item.toolName, item.input)}`, meta: meta, top: top, busy: sending, notice: notice, error: error, actions: _jsx(ApprovalActions, { buttons: buttons, onAddReason: denyReason && !draft.showReason ? () => onDraft({ ...draft, showReason: true }) : undefined, locked: locked, sending: sending }), children: _jsx(ApprovalBody, { item: item, draft: draft, onDraft: onDraft, denyReason: denyReason, locked: locked }) }));
|
|
45
|
+
}
|
|
46
|
+
return (_jsx(PromptCard, { kind: "question", heading: question?.question, meta: meta, top: top, busy: sending, notice: notice, error: error, actions: _jsx(QuestionActions, { index: draft.index, dismissable: item.async === true, last: last, ready: readyWith(draft), locked: locked, sending: sending, onPrevious: () => onDraft({ ...draft, index: draft.index - 1 }), onDismiss: () => onAction({ kind: 'dismiss' }), onCommit: () => commit(draft) }), children: question && answer && (_jsx(QuestionBody, { question: question, answer: answer, onAnswer: (next) => onDraft({ ...draft, answers: { ...draft.answers, [question.id]: next } }), onCommit: (next) => commit({ ...draft, answers: { ...draft.answers, [question.id]: next } }), locked: locked })) }));
|
|
47
|
+
}
|