@adecore/agents-react 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/AgentModelLabel.d.ts +10 -0
- package/dist/agents/AgentModelLabel.js +98 -0
- package/dist/agents/model-name.js +2 -1
- package/dist/agents/provider-paths.d.ts +2 -1
- package/dist/agents/provider-paths.js +7 -3
- package/dist/chat/account-choice.js +57 -28
- package/dist/chat/bookmarks.js +2 -1
- package/dist/chat/drafts.d.ts +0 -1
- package/dist/chat/drafts.js +9 -28
- package/dist/chat/logic/picker-entries.js +2 -8
- package/dist/chat/logic/resume-compaction.js +2 -5
- package/dist/chat/logic/timeline-copy.js +2 -8
- package/dist/chat/logic/timeline.js +9 -10
- package/dist/chat/logic/workflow.js +2 -4
- package/dist/chat/subagent-conversation.js +2 -1
- package/dist/chat/ui/Composer.js +385 -360
- package/dist/chat/ui/GoalDock.js +2 -1
- package/dist/chat/ui/LimitState.js +4 -6
- package/dist/chat/ui/Pickers.d.ts +2 -1
- package/dist/chat/ui/Pickers.js +126 -123
- package/dist/chat/ui/PromptEditor.d.ts +19 -0
- package/dist/chat/ui/PromptEditor.js +115 -0
- package/dist/chat/ui/Timeline.d.ts +2 -1
- package/dist/chat/ui/Timeline.js +13 -1
- package/dist/chat/ui/composer/ComposerControls.d.ts +3 -0
- package/dist/chat/ui/composer/ComposerControls.js +235 -38
- package/dist/chat/ui/composer/key-handler.d.ts +1 -1
- package/dist/chat/ui/composer/key-handler.js +3 -11
- package/dist/chat/ui/composer/prompt-picks.d.ts +4 -0
- package/dist/chat/ui/composer/prompt-picks.js +14 -0
- package/dist/chat/ui/composer/use-composer-menus.d.ts +4 -49
- package/dist/chat/ui/composer/use-composer-menus.js +65 -519
- package/dist/chat/ui/composer/use-continuable-turn.js +0 -1
- package/dist/chat/ui/composer/use-notice.js +2 -1
- package/dist/chat/ui/composer/use-prompt-history.js +1 -1
- package/dist/chat/ui/composer/use-prompt-menus.d.ts +73 -0
- package/dist/chat/ui/composer/use-prompt-menus.js +499 -0
- package/dist/chat/ui/composer/use-take-back.js +2 -2
- package/dist/chat/ui/diff/ApprovalReview.js +1 -1
- package/dist/chat/ui/highlighter.d.ts +0 -6
- package/dist/chat/ui/highlighter.js +0 -12
- package/dist/chat/ui/icons.d.ts +0 -1
- package/dist/chat/ui/icons.js +0 -3
- package/dist/chat/ui/index.d.ts +3 -0
- package/dist/chat/ui/index.js +2 -0
- package/dist/chat/ui/rows/MessageRows.js +2 -5
- package/dist/chat/ui/rows/row-rhythm.js +2 -5
- package/dist/chat/ui/theme-watch.js +3 -7
- package/dist/host-hooks.d.ts +2 -1
- package/dist/host-hooks.js +6 -0
- package/dist/host.d.ts +17 -1
- package/dist/index.d.ts +1 -1
- package/dist/locales/en/agent-chat.d.ts +1 -0
- package/dist/locales/en/agent-chat.js +1 -0
- package/dist/locales/nl/agent-chat.d.ts +1 -0
- package/dist/locales/nl/agent-chat.js +1 -0
- package/dist/prompts/logic/usePromptSession.js +2 -1
- package/dist/providers/AddAccountForm.js +2 -1
- package/dist/providers/CliDetail.js +104 -130
- package/dist/providers/account-actions.js +6 -9
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.js +1 -0
- package/dist/state/chats.d.ts +1 -0
- package/dist/state/chats.js +6 -11
- package/dist/state/provider-accounts.d.ts +1 -1
- package/dist/state/provider-accounts.js +2 -8
- package/dist/theme.css +3 -0
- package/dist/transport.d.ts +2 -0
- package/dist/transport.js +14 -0
- package/dist/usage/ChartLogo.d.ts +5 -0
- package/dist/usage/ChartLogo.js +48 -0
- package/dist/usage/LimitsList.js +6 -16
- package/dist/usage/UsageBreakdown.js +17 -40
- package/dist/usage/UsageLimits.js +183 -211
- package/dist/usage/UsagePage.js +3 -17
- package/dist/usage/UsageSummary.js +4 -9
- package/dist/usage/limits.js +16 -31
- package/dist/usage/summary.d.ts +1 -1
- package/dist/usage/summary.js +3 -5
- package/package.json +26 -26
- package/src/agents/AccountDot.tsx +1 -0
- package/src/agents/AgentIcon.tsx +2 -0
- package/src/agents/AgentModelLabel.tsx +38 -0
- package/src/agents/ModelOptionControl.tsx +8 -0
- package/src/agents/account-limits.ts +3 -0
- package/src/agents/accounts.ts +12 -0
- package/src/agents/model-name.ts +13 -1
- package/src/agents/model-options.ts +2 -0
- package/src/agents/model-requirement.ts +4 -0
- package/src/agents/option-words.ts +2 -0
- package/src/agents/provider-paths.ts +8 -3
- package/src/agents/status-look.ts +1 -0
- package/src/chat/account-choice.ts +25 -19
- package/src/chat/actions.ts +5 -0
- package/src/chat/attachments.ts +8 -0
- package/src/chat/bookmarks.ts +13 -1
- package/src/chat/chat-client.ts +63 -0
- package/src/chat/chat-references.ts +3 -0
- package/src/chat/composer-effort.ts +5 -0
- package/src/chat/composer-send.ts +4 -0
- package/src/chat/drafts.ts +21 -17
- package/src/chat/forks.ts +4 -0
- package/src/chat/guards.ts +2 -0
- package/src/chat/index.ts +7 -0
- package/src/chat/logic/ansi.ts +47 -0
- package/src/chat/logic/bookmarks.ts +7 -0
- package/src/chat/logic/command-looks.ts +29 -0
- package/src/chat/logic/context-usage.ts +3 -0
- package/src/chat/logic/continue-after-stop.ts +5 -0
- package/src/chat/logic/effort.ts +4 -0
- package/src/chat/logic/embedded-code.ts +63 -0
- package/src/chat/logic/fork.ts +22 -0
- package/src/chat/logic/generated-image.ts +7 -0
- package/src/chat/logic/goal.ts +7 -0
- package/src/chat/logic/handback.ts +2 -0
- package/src/chat/logic/limit.ts +8 -0
- package/src/chat/logic/picker-entries.ts +16 -4
- package/src/chat/logic/resume-compaction.ts +22 -5
- package/src/chat/logic/scrubber.ts +38 -5
- package/src/chat/logic/thought.ts +5 -0
- package/src/chat/logic/thread-cards.ts +6 -0
- package/src/chat/logic/timeline-copy.ts +4 -9
- package/src/chat/logic/timeline-target.ts +15 -0
- package/src/chat/logic/timeline.ts +113 -10
- package/src/chat/logic/tools.ts +30 -0
- package/src/chat/logic/visual-height.ts +5 -0
- package/src/chat/logic/visual-viewport.ts +1 -0
- package/src/chat/logic/welcome.ts +3 -0
- package/src/chat/logic/workflow.ts +26 -7
- package/src/chat/mentions.ts +56 -0
- package/src/chat/pending-prompts.ts +16 -0
- package/src/chat/persisted-json.ts +15 -0
- package/src/chat/preferences.ts +16 -0
- package/src/chat/prompt-hold.ts +2 -0
- package/src/chat/quote.ts +7 -0
- package/src/chat/reading-width.ts +1 -0
- package/src/chat/recent-messages.ts +5 -0
- package/src/chat/resume-compaction-dismissals.ts +1 -0
- package/src/chat/stash.ts +12 -0
- package/src/chat/subagent-conversation.ts +24 -4
- package/src/chat/subagent-list.ts +14 -0
- package/src/chat/subagent-support.ts +1 -0
- package/src/chat/subagent-view.ts +9 -0
- package/src/chat/thumbnails.ts +14 -0
- package/src/chat/timeline-flash.ts +2 -0
- package/src/chat/timeline-scroll.ts +23 -0
- package/src/chat/ui/AccountPill.tsx +4 -0
- package/src/chat/ui/AnsiOutput.tsx +1 -0
- package/src/chat/ui/BookmarkMarker.tsx +5 -0
- package/src/chat/ui/BookmarkSubmenu.tsx +1 -0
- package/src/chat/ui/ChatActivity.tsx +13 -0
- package/src/chat/ui/CodeBlock.tsx +8 -0
- package/src/chat/ui/Composer.tsx +27 -3
- package/src/chat/ui/ComposerInput.tsx +22 -0
- package/src/chat/ui/DiffPool.tsx +3 -0
- package/src/chat/ui/EditDiff.tsx +5 -0
- package/src/chat/ui/GoalDock.tsx +13 -1
- package/src/chat/ui/ImageView.tsx +11 -0
- package/src/chat/ui/LimitState.tsx +23 -6
- package/src/chat/ui/Markdown.tsx +41 -0
- package/src/chat/ui/MermaidBlock.tsx +16 -0
- package/src/chat/ui/MessageActions.tsx +8 -0
- package/src/chat/ui/ModelMarks.tsx +1 -0
- package/src/chat/ui/Pickers.tsx +30 -1
- package/src/chat/ui/PromptComposer.tsx +2 -0
- package/src/chat/ui/PromptEditor.tsx +136 -0
- package/src/chat/ui/QuoteButton.tsx +12 -0
- package/src/chat/ui/ReferenceChip.tsx +3 -0
- package/src/chat/ui/ResumeCompactionDock.tsx +1 -0
- package/src/chat/ui/RowTime.tsx +1 -0
- package/src/chat/ui/RunSettings.tsx +38 -0
- package/src/chat/ui/Scrubber.tsx +14 -0
- package/src/chat/ui/SessionLine.tsx +1 -0
- package/src/chat/ui/ShellCommand.tsx +32 -0
- package/src/chat/ui/SubagentControls.tsx +7 -0
- package/src/chat/ui/SubagentInfo.tsx +1 -0
- package/src/chat/ui/SubagentStopButton.tsx +6 -0
- package/src/chat/ui/SubagentTimeline.tsx +10 -0
- package/src/chat/ui/Timeline.tsx +141 -1
- package/src/chat/ui/TimelineMenu.tsx +5 -0
- package/src/chat/ui/UnifiedDiff.tsx +6 -0
- package/src/chat/ui/UploadThumb.tsx +2 -0
- package/src/chat/ui/VisualDialogs.tsx +3 -0
- package/src/chat/ui/VisualFrame.tsx +15 -0
- package/src/chat/ui/Welcome.tsx +1 -0
- package/src/chat/ui/chip-clipboard.ts +20 -0
- package/src/chat/ui/code-lines.ts +14 -0
- package/src/chat/ui/code-theme.ts +1 -0
- package/src/chat/ui/composer/ComposerControls.tsx +70 -15
- package/src/chat/ui/composer/ComposerMenu.tsx +12 -0
- package/src/chat/ui/composer/DraftParts.tsx +2 -0
- package/src/chat/ui/composer/QueuedMessages.tsx +4 -0
- package/src/chat/ui/composer/chip-paste.ts +16 -0
- package/src/chat/ui/composer/chips.ts +6 -0
- package/src/chat/ui/composer/editor.ts +9 -0
- package/src/chat/ui/composer/insert.ts +2 -0
- package/src/chat/ui/composer/key-handler.ts +42 -9
- package/src/chat/ui/composer/keys.ts +23 -0
- package/src/chat/ui/composer/placeholder.ts +6 -0
- package/src/chat/ui/composer/prompt-picks.ts +18 -0
- package/src/chat/ui/composer/surface.ts +5 -0
- package/src/chat/ui/composer/use-chat-controls.ts +13 -0
- package/src/chat/ui/composer/use-compaction-offer.ts +3 -0
- package/src/chat/ui/composer/use-composer-menus.ts +20 -275
- package/src/chat/ui/composer/use-composer-submit.ts +27 -0
- package/src/chat/ui/composer/use-continuable-turn.ts +3 -5
- package/src/chat/ui/composer/use-draft-files.ts +24 -0
- package/src/chat/ui/composer/use-effort-stepper.ts +8 -0
- package/src/chat/ui/composer/use-notice.ts +4 -1
- package/src/chat/ui/composer/use-pending-requests.ts +3 -0
- package/src/chat/ui/composer/use-prompt-history.ts +20 -11
- package/src/chat/ui/composer/use-prompt-hold.ts +3 -0
- package/src/chat/ui/composer/use-prompt-menus.ts +361 -0
- package/src/chat/ui/composer/use-take-back.ts +20 -2
- package/src/chat/ui/diff/ApprovalReview.tsx +18 -15
- package/src/chat/ui/diff/DiffFallbackBoundary.tsx +1 -0
- package/src/chat/ui/diff/DiffOmitted.tsx +1 -0
- package/src/chat/ui/diff/DiffStack.tsx +2 -0
- package/src/chat/ui/diff/DiffUnavailable.tsx +1 -0
- package/src/chat/ui/diff/EditorEditDiff.tsx +13 -0
- package/src/chat/ui/diff/EditorPatchDiff.tsx +4 -0
- package/src/chat/ui/diff/LegacyDiffPool.tsx +2 -0
- package/src/chat/ui/diff/LegacyEditDiff.tsx +2 -0
- package/src/chat/ui/diff/LegacyUnifiedDiff.tsx +8 -0
- package/src/chat/ui/diff/RawDiff.tsx +1 -0
- package/src/chat/ui/diff/ReviewDiff.tsx +1 -0
- package/src/chat/ui/diff/diff-source-budget.ts +8 -0
- package/src/chat/ui/diff/editor-edit-model.ts +4 -0
- package/src/chat/ui/diff/review-plan.ts +9 -0
- package/src/chat/ui/diff/review-settle.ts +1 -0
- package/src/chat/ui/diff/syntax-runtime.ts +52 -0
- package/src/chat/ui/diff/use-review-stack.ts +9 -0
- package/src/chat/ui/diff-syntax.ts +12 -0
- package/src/chat/ui/diff-theme.ts +2 -0
- package/src/chat/ui/file-links.ts +2 -0
- package/src/chat/ui/find-reveal.ts +1 -0
- package/src/chat/ui/full-diff.ts +1 -0
- package/src/chat/ui/highlighter.ts +29 -15
- package/src/chat/ui/icons.tsx +2 -4
- package/src/chat/ui/index.ts +7 -0
- package/src/chat/ui/intelligent-ui/UiBlockFrame.tsx +25 -0
- package/src/chat/ui/intelligent-ui/UiFallbackPart.tsx +1 -0
- package/src/chat/ui/intelligent-ui/UiReply.tsx +63 -0
- package/src/chat/ui/intelligent-ui/block-local.ts +5 -0
- package/src/chat/ui/intelligent-ui/chart-data.ts +15 -0
- package/src/chat/ui/intelligent-ui/node-text.ts +17 -0
- package/src/chat/ui/intelligent-ui/renderers/binding.ts +1 -0
- package/src/chat/ui/intelligent-ui/renderers/chart.tsx +31 -0
- package/src/chat/ui/intelligent-ui/renderers/choices.tsx +4 -0
- package/src/chat/ui/intelligent-ui/renderers/content.tsx +18 -0
- package/src/chat/ui/intelligent-ui/renderers/data.tsx +11 -0
- package/src/chat/ui/intelligent-ui/renderers/inputs.tsx +13 -0
- package/src/chat/ui/intelligent-ui/renderers/links.tsx +9 -0
- package/src/chat/ui/intelligent-ui/renderers/map-slots.ts +15 -0
- package/src/chat/ui/intelligent-ui/renderers/map-style.ts +15 -0
- package/src/chat/ui/intelligent-ui/renderers/map-view.tsx +48 -0
- package/src/chat/ui/intelligent-ui/renderers/map.tsx +20 -0
- package/src/chat/ui/intelligent-ui/renderers/place-point.ts +3 -0
- package/src/chat/ui/intelligent-ui/renderers/structure.tsx +3 -0
- package/src/chat/ui/intelligent-ui/renderers/text.tsx +8 -0
- package/src/chat/ui/intelligent-ui/reply-parts.ts +5 -0
- package/src/chat/ui/intelligent-ui/table-data.ts +17 -0
- package/src/chat/ui/intelligent-ui/use-in-view.ts +4 -0
- package/src/chat/ui/intelligent-ui/use-later.ts +4 -0
- package/src/chat/ui/intelligent-ui/use-truncated.ts +5 -0
- package/src/chat/ui/intelligent-ui/use-ui-links.ts +29 -0
- package/src/chat/ui/intelligent-ui/use-ui-queries.ts +60 -0
- package/src/chat/ui/markdown-blocks.ts +64 -0
- package/src/chat/ui/mermaid.ts +4 -0
- package/src/chat/ui/quote-selection.ts +10 -0
- package/src/chat/ui/rehype-chips.ts +5 -0
- package/src/chat/ui/rehype-fade.ts +2 -0
- package/src/chat/ui/remark-html-as-text.ts +5 -0
- package/src/chat/ui/reveal.ts +18 -0
- package/src/chat/ui/rows/ForksRow.tsx +5 -0
- package/src/chat/ui/rows/GeneratedImageRow.tsx +10 -0
- package/src/chat/ui/rows/MessageRows.tsx +29 -5
- package/src/chat/ui/rows/RowContainer.tsx +1 -0
- package/src/chat/ui/rows/Rows.tsx +2 -0
- package/src/chat/ui/rows/SubagentRow.tsx +13 -0
- package/src/chat/ui/rows/TaskRow.tsx +7 -0
- package/src/chat/ui/rows/VisualRow.tsx +4 -0
- package/src/chat/ui/rows/WorkRows.tsx +46 -0
- package/src/chat/ui/rows/WorkflowRow.tsx +10 -0
- package/src/chat/ui/rows/row-rhythm.ts +7 -5
- package/src/chat/ui/theme-watch.ts +8 -7
- package/src/chat/ui/thread-references.ts +7 -0
- package/src/chat/ui/use-diff-source-tokens.ts +8 -0
- package/src/chat/ui/useToggleSet.ts +3 -0
- package/src/chat/ui/visual-theme.ts +30 -0
- package/src/chat/visual-bridge.ts +23 -0
- package/src/chat/visual-viewport.ts +12 -0
- package/src/host-hooks.ts +15 -5
- package/src/host.ts +29 -1
- package/src/index.ts +5 -0
- package/src/lazy.tsx +9 -0
- package/src/locales/en/agent-chat.ts +1 -0
- package/src/locales/nl/agent-chat.ts +1 -0
- package/src/mounted-registry.ts +4 -0
- package/src/port-transport.ts +32 -0
- package/src/prompts/index.ts +2 -0
- package/src/prompts/logic/focus.ts +5 -0
- package/src/prompts/logic/keys.ts +12 -0
- package/src/prompts/logic/prompts.ts +8 -0
- package/src/prompts/logic/subjects.ts +8 -0
- package/src/prompts/logic/useFocusAfterAnswer.ts +2 -0
- package/src/prompts/logic/usePromptSession.ts +13 -1
- package/src/prompts/ui/ApprovalBody.tsx +2 -0
- package/src/prompts/ui/PromptActions.tsx +2 -0
- package/src/prompts/ui/PromptCard.tsx +6 -0
- package/src/prompts/ui/PromptView.tsx +6 -0
- package/src/prompts/ui/QuestionBody.tsx +11 -0
- package/src/providers/AccountColors.tsx +1 -0
- package/src/providers/AccountDetail.tsx +7 -0
- package/src/providers/AccountVariables.tsx +2 -0
- package/src/providers/AddAccountForm.tsx +5 -1
- package/src/providers/CliDetail.tsx +6 -5
- package/src/providers/InstallPage.tsx +11 -0
- package/src/providers/ProviderList.tsx +3 -0
- package/src/providers/ProvidersPane.tsx +18 -0
- package/src/providers/account-actions.ts +10 -8
- package/src/providers/index.ts +1 -0
- package/src/providers/install-steps.ts +3 -0
- package/src/providers/pane-target.ts +5 -0
- package/src/providers/provider-abilities.ts +1 -0
- package/src/providers/provider-groups.ts +6 -0
- package/src/providers/variables.ts +12 -0
- package/src/scope.ts +2 -0
- package/src/state/chats.ts +61 -14
- package/src/state/index.ts +2 -0
- package/src/state/provider-accounts.ts +7 -9
- package/src/state/providers.ts +1 -0
- package/src/state/usage.ts +6 -0
- package/src/storage.ts +18 -0
- package/src/testing/prompts.ts +5 -0
- package/src/theme.css +3 -0
- package/src/transport.ts +18 -0
- package/src/usage/ChartLogo.tsx +12 -0
- package/src/usage/LimitsList.tsx +7 -8
- package/src/usage/UsageBreakdown.tsx +11 -4
- package/src/usage/UsageChart.tsx +5 -0
- package/src/usage/UsageLimits.tsx +10 -7
- package/src/usage/UsageLimitsCard.tsx +2 -0
- package/src/usage/UsagePage.tsx +16 -19
- package/src/usage/UsageSummary.tsx +4 -5
- package/src/usage/UsageTiles.tsx +2 -0
- package/src/usage/format.ts +7 -0
- package/src/usage/limit-groups.ts +14 -0
- package/src/usage/limits.ts +11 -13
- package/src/usage/money.ts +1 -0
- package/src/usage/summary.ts +15 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type Ref } from 'react';
|
|
2
2
|
import type { ChatInfo } from '@adecore/agent-contracts';
|
|
3
3
|
import { type Shortcut } from '@adecore/ui';
|
|
4
|
+
import { type ComposerSendAction, type ComposerSendDraft } from '../../../host.js';
|
|
4
5
|
import type { StashedPrompt } from '../../stash.js';
|
|
5
6
|
import type { ChatControls } from './use-chat-controls.js';
|
|
6
7
|
interface SendProps {
|
|
@@ -10,6 +11,8 @@ interface SendProps {
|
|
|
10
11
|
kbd: Shortcut;
|
|
11
12
|
onSend(alternate: boolean): void;
|
|
12
13
|
onContinue: (() => void) | null;
|
|
14
|
+
actions: readonly ComposerSendAction[];
|
|
15
|
+
draft: ComposerSendDraft;
|
|
13
16
|
}
|
|
14
17
|
interface ComposerControlsProps {
|
|
15
18
|
chatId: string;
|
|
@@ -1,19 +1,225 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import { useRef } from 'react';
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { ArrowUp, ChevronDown, Play, Plus, Square } from 'lucide-react';
|
|
6
|
+
import { Button, ErrorBoundary, Icon, Menu, Tooltip } from '@adecore/ui';
|
|
6
7
|
import { useChatHost } from '../../../host.js';
|
|
7
8
|
import { useChatScope } from '../../../scope.js';
|
|
8
9
|
import { useProviders } from '../../../state/providers.js';
|
|
9
10
|
import { useAccountChoice } from '../../account-choice.js';
|
|
10
11
|
import { composerStopLabel } from '../../subagent-list.js';
|
|
12
|
+
import { HostMenuItems } from '../HostMenuItems.js';
|
|
11
13
|
import { StashPicker } from '../Pickers.js';
|
|
12
14
|
import { RunSettings } from '../RunSettings.js';
|
|
13
|
-
/* The
|
|
15
|
+
/* The send button, split with a chevron that opens the host's send actions when it has any. */
|
|
14
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
function SendButton(t0) {
|
|
18
|
+
const $ = _c(38);
|
|
19
|
+
const {
|
|
20
|
+
send,
|
|
21
|
+
writable
|
|
22
|
+
} = t0;
|
|
23
|
+
const {
|
|
24
|
+
t
|
|
25
|
+
} = useTranslation("agent-chat");
|
|
26
|
+
const [box, setBox] = useState(null);
|
|
27
|
+
const split = send.actions.length > 0;
|
|
28
|
+
const t1 = send.label;
|
|
29
|
+
const t2 = send.kbd;
|
|
30
|
+
const t3 = split ? "focus-visible:-outline-offset-2" : "rounded-full";
|
|
31
|
+
let t4;
|
|
32
|
+
if ($[0] !== t3) {
|
|
33
|
+
t4 = clsx("flex h-9 w-9 shrink-0 items-center justify-center bg-accent text-accent-text hover:brightness-90 disabled:opacity-50 disabled:hover:brightness-100", t3);
|
|
34
|
+
$[0] = t3;
|
|
35
|
+
$[1] = t4;
|
|
36
|
+
} else {
|
|
37
|
+
t4 = $[1];
|
|
38
|
+
}
|
|
39
|
+
let t5;
|
|
40
|
+
if ($[2] !== send) {
|
|
41
|
+
t5 = event => send.onSend(event.altKey);
|
|
42
|
+
$[2] = send;
|
|
43
|
+
$[3] = t5;
|
|
44
|
+
} else {
|
|
45
|
+
t5 = $[3];
|
|
46
|
+
}
|
|
47
|
+
let t6;
|
|
48
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
49
|
+
t6 = /*#__PURE__*/_jsx(Icon, {
|
|
50
|
+
icon: ArrowUp,
|
|
51
|
+
size: 16
|
|
52
|
+
});
|
|
53
|
+
$[4] = t6;
|
|
54
|
+
} else {
|
|
55
|
+
t6 = $[4];
|
|
56
|
+
}
|
|
57
|
+
let t7;
|
|
58
|
+
if ($[5] !== send.disabled || $[6] !== t4 || $[7] !== t5) {
|
|
59
|
+
t7 = /*#__PURE__*/_jsx("button", {
|
|
60
|
+
className: t4,
|
|
61
|
+
disabled: send.disabled,
|
|
62
|
+
onClick: t5,
|
|
63
|
+
children: t6
|
|
64
|
+
});
|
|
65
|
+
$[5] = send.disabled;
|
|
66
|
+
$[6] = t4;
|
|
67
|
+
$[7] = t5;
|
|
68
|
+
$[8] = t7;
|
|
69
|
+
} else {
|
|
70
|
+
t7 = $[8];
|
|
71
|
+
}
|
|
72
|
+
let t8;
|
|
73
|
+
if ($[9] !== send.kbd || $[10] !== send.label || $[11] !== t7) {
|
|
74
|
+
t8 = /*#__PURE__*/_jsx(Tooltip, {
|
|
75
|
+
label: t1,
|
|
76
|
+
kbd: t2,
|
|
77
|
+
name: true,
|
|
78
|
+
children: t7
|
|
79
|
+
});
|
|
80
|
+
$[9] = send.kbd;
|
|
81
|
+
$[10] = send.label;
|
|
82
|
+
$[11] = t7;
|
|
83
|
+
$[12] = t8;
|
|
84
|
+
} else {
|
|
85
|
+
t8 = $[12];
|
|
86
|
+
}
|
|
87
|
+
const button = t8;
|
|
88
|
+
if (!split) {
|
|
89
|
+
return button;
|
|
90
|
+
}
|
|
91
|
+
const {
|
|
92
|
+
draft
|
|
93
|
+
} = send;
|
|
94
|
+
let t9;
|
|
95
|
+
if ($[13] !== t) {
|
|
96
|
+
t9 = t("composer.sendActions");
|
|
97
|
+
$[13] = t;
|
|
98
|
+
$[14] = t9;
|
|
99
|
+
} else {
|
|
100
|
+
t9 = $[14];
|
|
101
|
+
}
|
|
102
|
+
let t10;
|
|
103
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
104
|
+
t10 = /*#__PURE__*/_jsx("button", {
|
|
105
|
+
type: "button",
|
|
106
|
+
className: "relative flex h-9 w-6 shrink-0 items-center justify-center bg-accent text-accent-text before:absolute before:inset-y-0 before:left-0 before:my-auto before:h-4 before:w-px before:bg-current/30 before:content-[\"\"] hover:brightness-90 focus-visible:-outline-offset-2 disabled:opacity-50 disabled:hover:brightness-100"
|
|
107
|
+
});
|
|
108
|
+
$[15] = t10;
|
|
109
|
+
} else {
|
|
110
|
+
t10 = $[15];
|
|
111
|
+
}
|
|
112
|
+
const t11 = !writable;
|
|
113
|
+
let t12;
|
|
114
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
115
|
+
t12 = /*#__PURE__*/_jsx(Icon, {
|
|
116
|
+
icon: ChevronDown,
|
|
117
|
+
size: 14
|
|
118
|
+
});
|
|
119
|
+
$[16] = t12;
|
|
120
|
+
} else {
|
|
121
|
+
t12 = $[16];
|
|
122
|
+
}
|
|
123
|
+
let t13;
|
|
124
|
+
if ($[17] !== t11) {
|
|
125
|
+
t13 = /*#__PURE__*/_jsx(Menu.Trigger, {
|
|
126
|
+
render: t10,
|
|
127
|
+
disabled: t11,
|
|
128
|
+
children: t12
|
|
129
|
+
});
|
|
130
|
+
$[17] = t11;
|
|
131
|
+
$[18] = t13;
|
|
132
|
+
} else {
|
|
133
|
+
t13 = $[18];
|
|
134
|
+
}
|
|
135
|
+
let t14;
|
|
136
|
+
if ($[19] !== t13 || $[20] !== t9) {
|
|
137
|
+
t14 = /*#__PURE__*/_jsx(Tooltip, {
|
|
138
|
+
label: t9,
|
|
139
|
+
name: true,
|
|
140
|
+
children: t13
|
|
141
|
+
});
|
|
142
|
+
$[19] = t13;
|
|
143
|
+
$[20] = t9;
|
|
144
|
+
$[21] = t14;
|
|
145
|
+
} else {
|
|
146
|
+
t14 = $[21];
|
|
147
|
+
}
|
|
148
|
+
let t15;
|
|
149
|
+
if ($[22] !== draft || $[23] !== send.actions) {
|
|
150
|
+
let t16;
|
|
151
|
+
if ($[25] !== draft) {
|
|
152
|
+
t16 = action => ({
|
|
153
|
+
...action,
|
|
154
|
+
run: () => action.run(draft)
|
|
155
|
+
});
|
|
156
|
+
$[25] = draft;
|
|
157
|
+
$[26] = t16;
|
|
158
|
+
} else {
|
|
159
|
+
t16 = $[26];
|
|
160
|
+
}
|
|
161
|
+
t15 = send.actions.map(t16);
|
|
162
|
+
$[22] = draft;
|
|
163
|
+
$[23] = send.actions;
|
|
164
|
+
$[24] = t15;
|
|
165
|
+
} else {
|
|
166
|
+
t15 = $[24];
|
|
167
|
+
}
|
|
168
|
+
let t16;
|
|
169
|
+
if ($[27] !== t15) {
|
|
170
|
+
t16 = /*#__PURE__*/_jsx(HostMenuItems, {
|
|
171
|
+
actions: t15
|
|
172
|
+
});
|
|
173
|
+
$[27] = t15;
|
|
174
|
+
$[28] = t16;
|
|
175
|
+
} else {
|
|
176
|
+
t16 = $[28];
|
|
177
|
+
}
|
|
178
|
+
let t17;
|
|
179
|
+
if ($[29] !== box || $[30] !== t16) {
|
|
180
|
+
t17 = /*#__PURE__*/_jsx(Menu.Popup, {
|
|
181
|
+
anchor: box,
|
|
182
|
+
side: "top",
|
|
183
|
+
sideOffset: 8,
|
|
184
|
+
align: "end",
|
|
185
|
+
className: "min-w-48",
|
|
186
|
+
children: t16
|
|
187
|
+
});
|
|
188
|
+
$[29] = box;
|
|
189
|
+
$[30] = t16;
|
|
190
|
+
$[31] = t17;
|
|
191
|
+
} else {
|
|
192
|
+
t17 = $[31];
|
|
193
|
+
}
|
|
194
|
+
let t18;
|
|
195
|
+
if ($[32] !== t14 || $[33] !== t17) {
|
|
196
|
+
t18 = /*#__PURE__*/_jsxs(Menu.Root, {
|
|
197
|
+
children: [t14, t17]
|
|
198
|
+
});
|
|
199
|
+
$[32] = t14;
|
|
200
|
+
$[33] = t17;
|
|
201
|
+
$[34] = t18;
|
|
202
|
+
} else {
|
|
203
|
+
t18 = $[34];
|
|
204
|
+
}
|
|
205
|
+
let t19;
|
|
206
|
+
if ($[35] !== button || $[36] !== t18) {
|
|
207
|
+
t19 = /*#__PURE__*/_jsxs("div", {
|
|
208
|
+
ref: setBox,
|
|
209
|
+
className: "flex h-9 shrink-0 overflow-clip rounded-full",
|
|
210
|
+
children: [button, t18]
|
|
211
|
+
});
|
|
212
|
+
$[35] = button;
|
|
213
|
+
$[36] = t18;
|
|
214
|
+
$[37] = t19;
|
|
215
|
+
} else {
|
|
216
|
+
t19 = $[37];
|
|
217
|
+
}
|
|
218
|
+
return t19;
|
|
219
|
+
}
|
|
220
|
+
/* The row under the box: attach, the chat's settings, the stash, the app's own control, and stop and send. */
|
|
15
221
|
export function ComposerControls(t0) {
|
|
16
|
-
const $ = _c(
|
|
222
|
+
const $ = _c(76);
|
|
17
223
|
const {
|
|
18
224
|
chatId,
|
|
19
225
|
info,
|
|
@@ -282,55 +488,46 @@ export function ComposerControls(t0) {
|
|
|
282
488
|
t16 = $[60];
|
|
283
489
|
}
|
|
284
490
|
let t17;
|
|
285
|
-
if ($[61] !== send) {
|
|
286
|
-
t17 = send.onContinue === null && send.visible && /*#__PURE__*/_jsx(
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
name: true,
|
|
290
|
-
children: /*#__PURE__*/_jsx("button", {
|
|
291
|
-
className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-accent text-accent-text hover:brightness-90 disabled:opacity-50 disabled:hover:brightness-100",
|
|
292
|
-
disabled: send.disabled,
|
|
293
|
-
onClick: event_0 => send.onSend(event_0.altKey),
|
|
294
|
-
children: /*#__PURE__*/_jsx(Icon, {
|
|
295
|
-
icon: ArrowUp,
|
|
296
|
-
size: 16
|
|
297
|
-
})
|
|
298
|
-
})
|
|
491
|
+
if ($[61] !== send || $[62] !== writable) {
|
|
492
|
+
t17 = send.onContinue === null && send.visible && /*#__PURE__*/_jsx(SendButton, {
|
|
493
|
+
send: send,
|
|
494
|
+
writable: writable
|
|
299
495
|
});
|
|
300
496
|
$[61] = send;
|
|
301
|
-
$[62] =
|
|
497
|
+
$[62] = writable;
|
|
498
|
+
$[63] = t17;
|
|
302
499
|
} else {
|
|
303
|
-
t17 = $[
|
|
500
|
+
t17 = $[63];
|
|
304
501
|
}
|
|
305
502
|
let t18;
|
|
306
|
-
if ($[
|
|
503
|
+
if ($[64] !== t14 || $[65] !== t15 || $[66] !== t16 || $[67] !== t17) {
|
|
307
504
|
t18 = /*#__PURE__*/_jsxs("div", {
|
|
308
505
|
className: "flex h-9 shrink-0 items-center gap-0.5 rounded-full bg-surface-hover",
|
|
309
506
|
children: [t14, t15, t16, t17]
|
|
310
507
|
});
|
|
311
|
-
$[
|
|
312
|
-
$[
|
|
313
|
-
$[
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
508
|
+
$[64] = t14;
|
|
509
|
+
$[65] = t15;
|
|
510
|
+
$[66] = t16;
|
|
511
|
+
$[67] = t17;
|
|
512
|
+
$[68] = t18;
|
|
316
513
|
} else {
|
|
317
|
-
t18 = $[
|
|
514
|
+
t18 = $[68];
|
|
318
515
|
}
|
|
319
516
|
let t19;
|
|
320
|
-
if ($[
|
|
517
|
+
if ($[69] !== t10 || $[70] !== t11 || $[71] !== t12 || $[72] !== t18 || $[73] !== t3 || $[74] !== t4) {
|
|
321
518
|
t19 = /*#__PURE__*/_jsxs("div", {
|
|
322
519
|
className: "flex items-center gap-2 pt-3 pr-3.5 pb-3.5 pl-5 @max-md/composer:gap-1.5 @max-md/composer:p-3 @max-md/composer:pt-2.5",
|
|
323
520
|
children: [t3, t4, t10, t11, t12, t13, t18]
|
|
324
521
|
});
|
|
325
|
-
$[
|
|
326
|
-
$[
|
|
327
|
-
$[
|
|
328
|
-
$[
|
|
329
|
-
$[
|
|
330
|
-
$[
|
|
331
|
-
$[
|
|
332
|
-
} else {
|
|
333
|
-
t19 = $[
|
|
522
|
+
$[69] = t10;
|
|
523
|
+
$[70] = t11;
|
|
524
|
+
$[71] = t12;
|
|
525
|
+
$[72] = t18;
|
|
526
|
+
$[73] = t3;
|
|
527
|
+
$[74] = t4;
|
|
528
|
+
$[75] = t19;
|
|
529
|
+
} else {
|
|
530
|
+
t19 = $[75];
|
|
334
531
|
}
|
|
335
532
|
return t19;
|
|
336
533
|
}
|
|
@@ -13,8 +13,8 @@ interface KeyHandlerInput {
|
|
|
13
13
|
history: PromptHistory;
|
|
14
14
|
noteKey(e: KeyboardEvent): void;
|
|
15
15
|
toggleStash(): void;
|
|
16
|
-
setText(next: string): void;
|
|
17
16
|
submit(how: ComposerSend): void;
|
|
18
17
|
}
|
|
18
|
+
export declare function pickInMenu(e: KeyboardEvent, menus: ComposerMenus): boolean;
|
|
19
19
|
export declare function composerKeyHandler(input: KeyHandlerInput): (e: KeyboardEvent, view: EditorView) => boolean;
|
|
20
20
|
export {};
|
|
@@ -37,10 +37,7 @@ function indentInFence(e, view) {
|
|
|
37
37
|
return true;
|
|
38
38
|
}
|
|
39
39
|
/* The keys an open picker takes: the arrows walk it, and Tab (or Enter, outside the commands) picks. */
|
|
40
|
-
function pickInMenu(e, {
|
|
41
|
-
menus,
|
|
42
|
-
setText
|
|
43
|
-
}) {
|
|
40
|
+
export function pickInMenu(e, menus) {
|
|
44
41
|
const {
|
|
45
42
|
activeIndex
|
|
46
43
|
} = menus;
|
|
@@ -49,12 +46,7 @@ function pickInMenu(e, {
|
|
|
49
46
|
return true;
|
|
50
47
|
}
|
|
51
48
|
if (e.key === 'Tab') {
|
|
52
|
-
|
|
53
|
-
if (chosen.skill) {
|
|
54
|
-
menus.chooseSkill(chosen.name);
|
|
55
|
-
} else {
|
|
56
|
-
setText(`/${chosen.name} `);
|
|
57
|
-
}
|
|
49
|
+
menus.completeCommand(menus.commands[activeIndex]);
|
|
58
50
|
return true;
|
|
59
51
|
}
|
|
60
52
|
}
|
|
@@ -187,7 +179,7 @@ export function composerKeyHandler(input) {
|
|
|
187
179
|
input.toggleStash();
|
|
188
180
|
return true;
|
|
189
181
|
}
|
|
190
|
-
if (pickInMenu(e, input)) {
|
|
182
|
+
if (pickInMenu(e, input.menus)) {
|
|
191
183
|
return true;
|
|
192
184
|
}
|
|
193
185
|
if (e.key === 'Tab' && !e.altKey && !e.metaKey && !e.ctrlKey && indentInFence(e, view)) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ChatSendExtras } from '../../chat-client.js';
|
|
2
|
+
import { type Referables } from '../../chat-references.js';
|
|
3
|
+
import type { PromptDraft } from './use-prompt-menus.js';
|
|
4
|
+
export declare function promptPicks(value: PromptDraft, referables: Referables): Pick<ChatSendExtras, 'mentions' | 'skills' | 'chats' | 'references'>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { referenceTokens } from '../../chat-references.js';
|
|
2
|
+
import { presentMentions, presentReferences, presentSkills } from '../../mentions.js';
|
|
3
|
+
/* What a prompt still holds of what was picked in it, as a send of the composer carries it. */
|
|
4
|
+
export function promptPicks(value, referables) {
|
|
5
|
+
const text = value.text.trim();
|
|
6
|
+
const tokens = referenceTokens([...value.chats, ...value.references], referables.items, value.referenceNames);
|
|
7
|
+
return {
|
|
8
|
+
mentions: presentMentions(text, value.mentions),
|
|
9
|
+
skills: presentSkills(text, value.skills),
|
|
10
|
+
chats: presentReferences(text, value.chats, tokens),
|
|
11
|
+
// A machine that resolves only chats would drop the rest.
|
|
12
|
+
references: referables.chatsOnly ? [] : presentReferences(text, value.references, tokens)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
|
-
import type { EditorState } from '@codemirror/state';
|
|
3
2
|
import type { ChatInfo, ProviderCapabilities } from '@adecore/agent-contracts';
|
|
4
|
-
import { type Referable } from '../../chat-references.js';
|
|
5
|
-
import { type MentionQuery, type TextRange } from '../../mentions.js';
|
|
6
3
|
import type { ComposerInputHandle } from '../ComposerInput.js';
|
|
7
4
|
import type { ComposerDraft } from './use-composer-draft.js';
|
|
5
|
+
import { type PromptMenus } from './use-prompt-menus.js';
|
|
6
|
+
export type { ComposerCommand } from './use-prompt-menus.js';
|
|
8
7
|
export declare const LOCAL_COMMANDS: string[];
|
|
9
|
-
export interface ComposerCommand {
|
|
10
|
-
name: string;
|
|
11
|
-
hint: string;
|
|
12
|
-
local: boolean;
|
|
13
|
-
skill: boolean;
|
|
14
|
-
}
|
|
15
8
|
interface MenusInput {
|
|
16
9
|
chatId: string;
|
|
17
10
|
info: ChatInfo;
|
|
@@ -20,43 +13,5 @@ interface MenusInput {
|
|
|
20
13
|
draft: ComposerDraft;
|
|
21
14
|
inputRef: RefObject<ComposerInputHandle | null>;
|
|
22
15
|
}
|
|
23
|
-
export declare function useComposerMenus({ chatId, info, capabilities, providerName, draft
|
|
24
|
-
|
|
25
|
-
activeIndex: number;
|
|
26
|
-
inputAria: Record<string, string>;
|
|
27
|
-
hasSkills: boolean;
|
|
28
|
-
skillNames: string[];
|
|
29
|
-
commandQuery: string | null;
|
|
30
|
-
commands: ComposerCommand[];
|
|
31
|
-
commandMenuOpen: boolean;
|
|
32
|
-
skillMatches: {
|
|
33
|
-
name: string;
|
|
34
|
-
description: string;
|
|
35
|
-
source: "plugin" | "project" | "user";
|
|
36
|
-
}[];
|
|
37
|
-
skillMenuOpen: boolean;
|
|
38
|
-
mention: MentionQuery | null;
|
|
39
|
-
mentionMenuOpen: boolean;
|
|
40
|
-
mentionCount: number;
|
|
41
|
-
files: string[];
|
|
42
|
-
referenceMenuOpen: boolean;
|
|
43
|
-
referenceMatches: Referable[];
|
|
44
|
-
referables: import("../../index.js").Referables;
|
|
45
|
-
referenceChips: {
|
|
46
|
-
id: string;
|
|
47
|
-
name: string;
|
|
48
|
-
kind: import("../../index.js").ReferableKind | null;
|
|
49
|
-
}[];
|
|
50
|
-
setMenuIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
51
|
-
trackTriggers: (value: string, selection: TextRange, state: EditorState) => void;
|
|
52
|
-
close: () => void;
|
|
53
|
-
chooseMention: (path: string) => void;
|
|
54
|
-
chooseMentionAt: (index: number) => void;
|
|
55
|
-
chooseReference: (item: Referable) => void;
|
|
56
|
-
chooseReferenceAt: (index: number) => void;
|
|
57
|
-
chooseSkill: (name: string) => void;
|
|
58
|
-
pickCommand: (command: ComposerCommand, index: number) => void;
|
|
59
|
-
moveInMenu: (key: string, count: number) => boolean;
|
|
60
|
-
};
|
|
61
|
-
export type ComposerMenus = ReturnType<typeof useComposerMenus>;
|
|
62
|
-
export {};
|
|
16
|
+
export declare function useComposerMenus({ chatId, info, capabilities, providerName, draft, inputRef }: MenusInput): PromptMenus;
|
|
17
|
+
export type ComposerMenus = PromptMenus;
|