@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
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type Dispatch, type RefObject, type SetStateAction } from 'react';
|
|
2
|
+
import type { EditorState } from '@codemirror/state';
|
|
3
|
+
import type { ChatSkill } from '@adecore/agent-contracts';
|
|
4
|
+
import { type Referable, type Referables } from '../../chat-references.js';
|
|
5
|
+
import type { ChatDraft } from '../../drafts.js';
|
|
6
|
+
import { type MentionQuery, type TextRange } from '../../mentions.js';
|
|
7
|
+
import type { ComposerInputHandle } from '../ComposerInput.js';
|
|
8
|
+
export type PromptDraft = Pick<ChatDraft, 'text' | 'mentions' | 'skills' | 'chats' | 'references' | 'referenceNames'>;
|
|
9
|
+
export interface PromptDraftBox<D extends PromptDraft> {
|
|
10
|
+
draft: D;
|
|
11
|
+
setDraft: Dispatch<SetStateAction<D>>;
|
|
12
|
+
setText(next: string, mentions?: string[], skills?: string[]): void;
|
|
13
|
+
}
|
|
14
|
+
export interface ComposerCommand {
|
|
15
|
+
name: string;
|
|
16
|
+
hint: string;
|
|
17
|
+
local: boolean;
|
|
18
|
+
skill: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface PromptMenusInput<D extends PromptDraft> {
|
|
21
|
+
draft: PromptDraftBox<D>;
|
|
22
|
+
inputRef: RefObject<ComposerInputHandle | null>;
|
|
23
|
+
cwd: string | null;
|
|
24
|
+
skills: readonly ChatSkill[];
|
|
25
|
+
slashCommands: readonly string[];
|
|
26
|
+
localCommands?: readonly string[];
|
|
27
|
+
goals: boolean;
|
|
28
|
+
providerName: string | undefined;
|
|
29
|
+
referables: Referables;
|
|
30
|
+
ownId?: string;
|
|
31
|
+
label: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function usePromptMenus<D extends PromptDraft>({ draft: { draft, setDraft, setText }, inputRef, cwd, skills, slashCommands, localCommands, goals, providerName, referables, ownId, label }: PromptMenusInput<D>): {
|
|
34
|
+
listId: string;
|
|
35
|
+
activeIndex: number;
|
|
36
|
+
inputAria: Record<string, string>;
|
|
37
|
+
menuOpen: boolean;
|
|
38
|
+
hasSkills: boolean;
|
|
39
|
+
skillNames: string[];
|
|
40
|
+
commandQuery: string | null;
|
|
41
|
+
commands: ComposerCommand[];
|
|
42
|
+
commandMenuOpen: boolean;
|
|
43
|
+
skillMatches: {
|
|
44
|
+
name: string;
|
|
45
|
+
description: string;
|
|
46
|
+
source: "plugin" | "project" | "user";
|
|
47
|
+
}[];
|
|
48
|
+
skillMenuOpen: boolean;
|
|
49
|
+
mention: MentionQuery | null;
|
|
50
|
+
mentionMenuOpen: boolean;
|
|
51
|
+
mentionCount: number;
|
|
52
|
+
files: string[];
|
|
53
|
+
referenceMenuOpen: boolean;
|
|
54
|
+
referenceMatches: Referable[];
|
|
55
|
+
referables: Referables;
|
|
56
|
+
referenceChips: {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
kind: import("../../index.js").ReferableKind | null;
|
|
60
|
+
}[];
|
|
61
|
+
setMenuIndex: Dispatch<SetStateAction<number>>;
|
|
62
|
+
trackTriggers: (value: string, selection: TextRange, state: EditorState) => void;
|
|
63
|
+
close: () => void;
|
|
64
|
+
chooseMention: (path: string) => void;
|
|
65
|
+
chooseMentionAt: (index: number) => void;
|
|
66
|
+
chooseReference: (item: Referable) => void;
|
|
67
|
+
chooseReferenceAt: (index: number) => void;
|
|
68
|
+
chooseSkill: (name: string) => void;
|
|
69
|
+
pickCommand: (command: ComposerCommand, index: number) => void;
|
|
70
|
+
completeCommand: (command: ComposerCommand) => void;
|
|
71
|
+
moveInMenu: (key: string, count: number) => boolean;
|
|
72
|
+
};
|
|
73
|
+
export type PromptMenus = ReturnType<typeof usePromptMenus>;
|
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useEffect, useId, useState } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { ensureSyntaxTree, syntaxTree } from '@codemirror/language';
|
|
5
|
+
import { useChatHost } from '../../../host.js';
|
|
6
|
+
import { useChatScope } from '../../../scope.js';
|
|
7
|
+
import { referenceSuggestions, referenceTokens } from '../../chat-references.js';
|
|
8
|
+
import { usableSlashCommands } from '../../guards.js';
|
|
9
|
+
import { chipRanges, findMentionQuery, findReferenceQuery, findSkillQuery, insertMention, insertReference, insertSkill, mentionPick, NO_MENTION_SEARCH, queryOutsideChips } from '../../mentions.js';
|
|
10
|
+
import { inCode } from './keys.js';
|
|
11
|
+
import { clampMenuIndex, composerMenuAria } from './menu-aria.js';
|
|
12
|
+
const SEARCH_DEBOUNCE_MS = 80;
|
|
13
|
+
// What fits above the box without turning the picker into a file tree.
|
|
14
|
+
const MENTION_RESULTS = 8;
|
|
15
|
+
const REFERENCE_RESULTS = 8;
|
|
16
|
+
const NO_COMMANDS = [];
|
|
17
|
+
function sameQuery(left, right) {
|
|
18
|
+
return left?.start === right?.start && left?.query === right?.query;
|
|
19
|
+
}
|
|
20
|
+
/*
|
|
21
|
+
* The pickers over a prompt: `/` for a command, `$` for a skill, `@` for a file and `#` for a view,
|
|
22
|
+
* a node or a chat. One is open at a time, and the arrow keys and the editor's ARIA attributes
|
|
23
|
+
* follow that one.
|
|
24
|
+
*/
|
|
25
|
+
export function usePromptMenus(t0) {
|
|
26
|
+
const $ = _c(102);
|
|
27
|
+
const {
|
|
28
|
+
draft: t1,
|
|
29
|
+
inputRef,
|
|
30
|
+
cwd,
|
|
31
|
+
skills,
|
|
32
|
+
slashCommands,
|
|
33
|
+
localCommands: t2,
|
|
34
|
+
goals,
|
|
35
|
+
providerName,
|
|
36
|
+
referables,
|
|
37
|
+
ownId,
|
|
38
|
+
label
|
|
39
|
+
} = t0;
|
|
40
|
+
const {
|
|
41
|
+
draft,
|
|
42
|
+
setDraft,
|
|
43
|
+
setText
|
|
44
|
+
} = t1;
|
|
45
|
+
const localCommands = t2 === undefined ? NO_COMMANDS : t2;
|
|
46
|
+
const {
|
|
47
|
+
t
|
|
48
|
+
} = useTranslation("agent-chat");
|
|
49
|
+
const scope = useChatScope();
|
|
50
|
+
const {
|
|
51
|
+
searchFiles
|
|
52
|
+
} = useChatHost();
|
|
53
|
+
const [menuIndex, setMenuIndex] = useState(0);
|
|
54
|
+
const [mention, setMention] = useState(null);
|
|
55
|
+
const [referenceQuery, setReferenceQuery] = useState(null);
|
|
56
|
+
const [skillQuery, setSkillQuery] = useState(null);
|
|
57
|
+
const [searched, setSearched] = useState(NO_MENTION_SEARCH);
|
|
58
|
+
const text = draft.text;
|
|
59
|
+
let t3;
|
|
60
|
+
let t4;
|
|
61
|
+
if ($[0] !== cwd || $[1] !== mention || $[2] !== scope || $[3] !== searchFiles) {
|
|
62
|
+
t3 = () => {
|
|
63
|
+
if (mention === null || cwd === null) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
let stale = false;
|
|
67
|
+
const search = () => {
|
|
68
|
+
if (searchFiles === null) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
searchFiles(scope.id, cwd, mention.query, MENTION_RESULTS).then(files => {
|
|
72
|
+
if (!stale) {
|
|
73
|
+
setSearched({
|
|
74
|
+
query: mention.query,
|
|
75
|
+
files
|
|
76
|
+
});
|
|
77
|
+
setMenuIndex(0);
|
|
78
|
+
}
|
|
79
|
+
}).catch(_temp);
|
|
80
|
+
};
|
|
81
|
+
if (mention.query === "") {
|
|
82
|
+
search();
|
|
83
|
+
return () => {
|
|
84
|
+
stale = true;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const timer = setTimeout(search, SEARCH_DEBOUNCE_MS);
|
|
88
|
+
return () => {
|
|
89
|
+
stale = true;
|
|
90
|
+
clearTimeout(timer);
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
t4 = [scope, cwd, mention, searchFiles];
|
|
94
|
+
$[0] = cwd;
|
|
95
|
+
$[1] = mention;
|
|
96
|
+
$[2] = scope;
|
|
97
|
+
$[3] = searchFiles;
|
|
98
|
+
$[4] = t3;
|
|
99
|
+
$[5] = t4;
|
|
100
|
+
} else {
|
|
101
|
+
t3 = $[4];
|
|
102
|
+
t4 = $[5];
|
|
103
|
+
}
|
|
104
|
+
useEffect(t3, t4);
|
|
105
|
+
let commandQuery;
|
|
106
|
+
let t5;
|
|
107
|
+
if ($[6] !== goals || $[7] !== localCommands || $[8] !== providerName || $[9] !== skills || $[10] !== slashCommands || $[11] !== t || $[12] !== text) {
|
|
108
|
+
commandQuery = text.startsWith("/") && !text.includes("\n") ? text.slice(1).trim().toLowerCase() : null;
|
|
109
|
+
let t6;
|
|
110
|
+
if ($[15] !== goals || $[16] !== localCommands || $[17] !== providerName || $[18] !== skills || $[19] !== slashCommands || $[20] !== t) {
|
|
111
|
+
t6 = query => {
|
|
112
|
+
const known = new Set(skills.map(_temp2));
|
|
113
|
+
const own = localCommands.map(name => ({
|
|
114
|
+
name,
|
|
115
|
+
hint: t(`composer.commands.${name}`),
|
|
116
|
+
local: true,
|
|
117
|
+
skill: false
|
|
118
|
+
}));
|
|
119
|
+
const goal = goals ? [{
|
|
120
|
+
name: "goal",
|
|
121
|
+
hint: t("composer.commands.goal"),
|
|
122
|
+
local: false,
|
|
123
|
+
skill: false
|
|
124
|
+
}] : [];
|
|
125
|
+
const cli = usableSlashCommands([...slashCommands]).filter(name_0 => !localCommands.includes(name_0) && (!goals || name_0 !== "goal")).map(name_1 => ({
|
|
126
|
+
name: name_1,
|
|
127
|
+
hint: known.has(name_1) ? t("composer.commands.skill") : t("composer.commands.cli", {
|
|
128
|
+
cli: providerName ?? t("composer.commands.anyCli")
|
|
129
|
+
}),
|
|
130
|
+
local: false,
|
|
131
|
+
skill: known.has(name_1)
|
|
132
|
+
}));
|
|
133
|
+
return [...own, ...goal, ...cli].filter(command => command.name.startsWith(query)).slice(0, 8);
|
|
134
|
+
};
|
|
135
|
+
$[15] = goals;
|
|
136
|
+
$[16] = localCommands;
|
|
137
|
+
$[17] = providerName;
|
|
138
|
+
$[18] = skills;
|
|
139
|
+
$[19] = slashCommands;
|
|
140
|
+
$[20] = t;
|
|
141
|
+
$[21] = t6;
|
|
142
|
+
} else {
|
|
143
|
+
t6 = $[21];
|
|
144
|
+
}
|
|
145
|
+
const commandsOf = t6;
|
|
146
|
+
t5 = commandQuery === null ? [] : commandsOf(commandQuery);
|
|
147
|
+
$[6] = goals;
|
|
148
|
+
$[7] = localCommands;
|
|
149
|
+
$[8] = providerName;
|
|
150
|
+
$[9] = skills;
|
|
151
|
+
$[10] = slashCommands;
|
|
152
|
+
$[11] = t;
|
|
153
|
+
$[12] = text;
|
|
154
|
+
$[13] = commandQuery;
|
|
155
|
+
$[14] = t5;
|
|
156
|
+
} else {
|
|
157
|
+
commandQuery = $[13];
|
|
158
|
+
t5 = $[14];
|
|
159
|
+
}
|
|
160
|
+
const commands = t5;
|
|
161
|
+
const skillMatches = skillQuery === null ? [] : skills.filter(skill_0 => skill_0.name.toLowerCase().includes(skillQuery.query.toLowerCase())).slice(0, 8);
|
|
162
|
+
const commandMenuOpen = commandQuery !== null && commands.length > 0;
|
|
163
|
+
const skillMenuOpen = !commandMenuOpen && skillQuery !== null && skillMatches.length > 0;
|
|
164
|
+
const mentionMenuOpen = !commandMenuOpen && !skillMenuOpen && mention !== null;
|
|
165
|
+
const files_0 = mention === null ? [] : searched.files;
|
|
166
|
+
const mentionCount = files_0.length;
|
|
167
|
+
let t6;
|
|
168
|
+
if ($[22] !== referables.chatsOnly) {
|
|
169
|
+
t6 = item => !referables.chatsOnly || item.kind === "chat";
|
|
170
|
+
$[22] = referables.chatsOnly;
|
|
171
|
+
$[23] = t6;
|
|
172
|
+
} else {
|
|
173
|
+
t6 = $[23];
|
|
174
|
+
}
|
|
175
|
+
const offersReferences = referables.items.some(t6);
|
|
176
|
+
const referenceMenuOpen = !commandMenuOpen && !skillMenuOpen && !mentionMenuOpen && referenceQuery !== null && offersReferences;
|
|
177
|
+
const excluded = ownId === undefined ? [...draft.chats, ...draft.references] : [ownId, ...draft.chats, ...draft.references];
|
|
178
|
+
const referenceMatches = referenceMenuOpen ? referenceSuggestions(referables, referenceQuery.query, excluded, REFERENCE_RESULTS) : [];
|
|
179
|
+
let t7;
|
|
180
|
+
if ($[24] !== draft.chats || $[25] !== draft.referenceNames || $[26] !== draft.references || $[27] !== referables.items) {
|
|
181
|
+
let t8;
|
|
182
|
+
if ($[29] !== referables.items) {
|
|
183
|
+
t8 = token => ({
|
|
184
|
+
...token,
|
|
185
|
+
kind: referables.items.find(item_0 => item_0.id === token.id)?.kind ?? null
|
|
186
|
+
});
|
|
187
|
+
$[29] = referables.items;
|
|
188
|
+
$[30] = t8;
|
|
189
|
+
} else {
|
|
190
|
+
t8 = $[30];
|
|
191
|
+
}
|
|
192
|
+
t7 = referenceTokens([...draft.chats, ...draft.references], referables.items, draft.referenceNames).map(t8);
|
|
193
|
+
$[24] = draft.chats;
|
|
194
|
+
$[25] = draft.referenceNames;
|
|
195
|
+
$[26] = draft.references;
|
|
196
|
+
$[27] = referables.items;
|
|
197
|
+
$[28] = t7;
|
|
198
|
+
} else {
|
|
199
|
+
t7 = $[28];
|
|
200
|
+
}
|
|
201
|
+
const referenceChips = t7;
|
|
202
|
+
const listId = useId();
|
|
203
|
+
const menuOpen = commandMenuOpen || skillMenuOpen || mentionMenuOpen || referenceMenuOpen;
|
|
204
|
+
const menuCount = commandMenuOpen ? commands.length : skillMenuOpen ? skillMatches.length : mentionMenuOpen ? mentionCount : referenceMatches.length;
|
|
205
|
+
const activeIndex = clampMenuIndex(menuIndex, menuCount);
|
|
206
|
+
const inputAria = composerMenuAria({
|
|
207
|
+
label,
|
|
208
|
+
listId,
|
|
209
|
+
open: menuOpen,
|
|
210
|
+
activeIndex,
|
|
211
|
+
count: menuCount
|
|
212
|
+
});
|
|
213
|
+
let t8;
|
|
214
|
+
if ($[31] !== cwd || $[32] !== draft.mentions || $[33] !== draft.skills || $[34] !== referenceChips) {
|
|
215
|
+
t8 = (value, selection, state) => {
|
|
216
|
+
const empty = selection.from === selection.to;
|
|
217
|
+
const tree = empty ? ensureSyntaxTree(state, selection.from, 50) ?? syntaxTree(state) : null;
|
|
218
|
+
const caret = tree !== null && !inCode(tree, value, selection.from) ? selection.from : null;
|
|
219
|
+
const chips = caret === null ? [] : chipRanges(value, draft.mentions, draft.skills, [], referenceChips);
|
|
220
|
+
const skill_1 = caret === null ? null : queryOutsideChips(findSkillQuery(value, caret), chips);
|
|
221
|
+
setSkillQuery(current => sameQuery(current, skill_1) ? current : skill_1);
|
|
222
|
+
const next = caret === null || cwd === null ? null : queryOutsideChips(findMentionQuery(value, caret), chips);
|
|
223
|
+
setMention(current_0 => sameQuery(current_0, next) ? current_0 : next);
|
|
224
|
+
const reference = caret === null ? null : queryOutsideChips(findReferenceQuery(value, caret), chips);
|
|
225
|
+
setReferenceQuery(current_1 => sameQuery(current_1, reference) ? current_1 : reference);
|
|
226
|
+
};
|
|
227
|
+
$[31] = cwd;
|
|
228
|
+
$[32] = draft.mentions;
|
|
229
|
+
$[33] = draft.skills;
|
|
230
|
+
$[34] = referenceChips;
|
|
231
|
+
$[35] = t8;
|
|
232
|
+
} else {
|
|
233
|
+
t8 = $[35];
|
|
234
|
+
}
|
|
235
|
+
const trackTriggers = t8;
|
|
236
|
+
let t9;
|
|
237
|
+
if ($[36] !== inputRef) {
|
|
238
|
+
t9 = caret_0 => {
|
|
239
|
+
requestAnimationFrame(() => inputRef.current?.setCaret(caret_0));
|
|
240
|
+
};
|
|
241
|
+
$[36] = inputRef;
|
|
242
|
+
$[37] = t9;
|
|
243
|
+
} else {
|
|
244
|
+
t9 = $[37];
|
|
245
|
+
}
|
|
246
|
+
const moveCaret = t9;
|
|
247
|
+
let t10;
|
|
248
|
+
if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
|
|
249
|
+
t10 = () => {
|
|
250
|
+
setMention(null);
|
|
251
|
+
setSkillQuery(null);
|
|
252
|
+
setReferenceQuery(null);
|
|
253
|
+
};
|
|
254
|
+
$[38] = t10;
|
|
255
|
+
} else {
|
|
256
|
+
t10 = $[38];
|
|
257
|
+
}
|
|
258
|
+
const close = t10;
|
|
259
|
+
let t11;
|
|
260
|
+
if ($[39] !== draft.mentions || $[40] !== mention || $[41] !== moveCaret || $[42] !== setText || $[43] !== text) {
|
|
261
|
+
t11 = path => {
|
|
262
|
+
if (!mention) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
const result = insertMention(text, mention, path);
|
|
266
|
+
setText(result.text, draft.mentions.includes(path) ? draft.mentions : [...draft.mentions, path]);
|
|
267
|
+
setMention(null);
|
|
268
|
+
moveCaret(result.caret);
|
|
269
|
+
};
|
|
270
|
+
$[39] = draft.mentions;
|
|
271
|
+
$[40] = mention;
|
|
272
|
+
$[41] = moveCaret;
|
|
273
|
+
$[42] = setText;
|
|
274
|
+
$[43] = text;
|
|
275
|
+
$[44] = t11;
|
|
276
|
+
} else {
|
|
277
|
+
t11 = $[44];
|
|
278
|
+
}
|
|
279
|
+
const chooseMention = t11;
|
|
280
|
+
let t12;
|
|
281
|
+
if ($[45] !== chooseMention || $[46] !== mention || $[47] !== searched) {
|
|
282
|
+
t12 = index => {
|
|
283
|
+
const path_0 = mention === null ? null : mentionPick(index, searched, mention.query);
|
|
284
|
+
if (path_0 !== null) {
|
|
285
|
+
chooseMention(path_0);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
$[45] = chooseMention;
|
|
289
|
+
$[46] = mention;
|
|
290
|
+
$[47] = searched;
|
|
291
|
+
$[48] = t12;
|
|
292
|
+
} else {
|
|
293
|
+
t12 = $[48];
|
|
294
|
+
}
|
|
295
|
+
const chooseMentionAt = t12;
|
|
296
|
+
let t13;
|
|
297
|
+
if ($[49] !== moveCaret || $[50] !== referenceQuery || $[51] !== setDraft || $[52] !== text) {
|
|
298
|
+
t13 = item_1 => {
|
|
299
|
+
if (!referenceQuery) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
const result_0 = insertReference(text, referenceQuery, item_1.name);
|
|
303
|
+
const chat = item_1.kind === "chat";
|
|
304
|
+
const add = ids => ids.includes(item_1.id) ? ids : [...ids, item_1.id];
|
|
305
|
+
setDraft(current_2 => ({
|
|
306
|
+
...current_2,
|
|
307
|
+
text: result_0.text,
|
|
308
|
+
chats: chat ? add(current_2.chats) : current_2.chats,
|
|
309
|
+
references: chat ? current_2.references : add(current_2.references),
|
|
310
|
+
referenceNames: {
|
|
311
|
+
...current_2.referenceNames,
|
|
312
|
+
[item_1.id]: item_1.name
|
|
313
|
+
}
|
|
314
|
+
}));
|
|
315
|
+
setReferenceQuery(null);
|
|
316
|
+
moveCaret(result_0.caret);
|
|
317
|
+
};
|
|
318
|
+
$[49] = moveCaret;
|
|
319
|
+
$[50] = referenceQuery;
|
|
320
|
+
$[51] = setDraft;
|
|
321
|
+
$[52] = text;
|
|
322
|
+
$[53] = t13;
|
|
323
|
+
} else {
|
|
324
|
+
t13 = $[53];
|
|
325
|
+
}
|
|
326
|
+
const chooseReference = t13;
|
|
327
|
+
let t14;
|
|
328
|
+
if ($[54] !== chooseReference || $[55] !== referenceMatches) {
|
|
329
|
+
t14 = index_0 => {
|
|
330
|
+
const item_2 = referenceMatches[index_0] ?? referenceMatches[0];
|
|
331
|
+
if (item_2 !== undefined) {
|
|
332
|
+
chooseReference(item_2);
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
$[54] = chooseReference;
|
|
336
|
+
$[55] = referenceMatches;
|
|
337
|
+
$[56] = t14;
|
|
338
|
+
} else {
|
|
339
|
+
t14 = $[56];
|
|
340
|
+
}
|
|
341
|
+
const chooseReferenceAt = t14;
|
|
342
|
+
let t15;
|
|
343
|
+
if ($[57] !== draft.mentions || $[58] !== draft.skills || $[59] !== moveCaret || $[60] !== setText || $[61] !== skillQuery || $[62] !== text) {
|
|
344
|
+
t15 = name_2 => {
|
|
345
|
+
const result_1 = skillQuery ? insertSkill(text, skillQuery, name_2) : {
|
|
346
|
+
text: `$${name_2} `,
|
|
347
|
+
caret: name_2.length + 2
|
|
348
|
+
};
|
|
349
|
+
setText(result_1.text, draft.mentions, draft.skills.includes(name_2) ? draft.skills : [...draft.skills, name_2]);
|
|
350
|
+
setSkillQuery(null);
|
|
351
|
+
moveCaret(result_1.caret);
|
|
352
|
+
};
|
|
353
|
+
$[57] = draft.mentions;
|
|
354
|
+
$[58] = draft.skills;
|
|
355
|
+
$[59] = moveCaret;
|
|
356
|
+
$[60] = setText;
|
|
357
|
+
$[61] = skillQuery;
|
|
358
|
+
$[62] = text;
|
|
359
|
+
$[63] = t15;
|
|
360
|
+
} else {
|
|
361
|
+
t15 = $[63];
|
|
362
|
+
}
|
|
363
|
+
const chooseSkill = t15;
|
|
364
|
+
let t16;
|
|
365
|
+
if ($[64] !== chooseSkill || $[65] !== inputRef || $[66] !== setText) {
|
|
366
|
+
t16 = (command_0, index_1) => {
|
|
367
|
+
setMenuIndex(index_1);
|
|
368
|
+
if (command_0.skill) {
|
|
369
|
+
chooseSkill(command_0.name);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
setText(`/${command_0.name}`);
|
|
373
|
+
inputRef.current?.focus();
|
|
374
|
+
};
|
|
375
|
+
$[64] = chooseSkill;
|
|
376
|
+
$[65] = inputRef;
|
|
377
|
+
$[66] = setText;
|
|
378
|
+
$[67] = t16;
|
|
379
|
+
} else {
|
|
380
|
+
t16 = $[67];
|
|
381
|
+
}
|
|
382
|
+
const pickCommand = t16;
|
|
383
|
+
let t17;
|
|
384
|
+
if ($[68] !== chooseSkill || $[69] !== setText) {
|
|
385
|
+
t17 = command_1 => {
|
|
386
|
+
if (command_1.skill) {
|
|
387
|
+
chooseSkill(command_1.name);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
setText(`/${command_1.name} `);
|
|
391
|
+
};
|
|
392
|
+
$[68] = chooseSkill;
|
|
393
|
+
$[69] = setText;
|
|
394
|
+
$[70] = t17;
|
|
395
|
+
} else {
|
|
396
|
+
t17 = $[70];
|
|
397
|
+
}
|
|
398
|
+
const completeCommand = t17;
|
|
399
|
+
let t18;
|
|
400
|
+
if ($[71] === Symbol.for("react.memo_cache_sentinel")) {
|
|
401
|
+
t18 = (key, count) => {
|
|
402
|
+
if (key === "ArrowDown") {
|
|
403
|
+
setMenuIndex(i => (i + 1) % count);
|
|
404
|
+
return true;
|
|
405
|
+
}
|
|
406
|
+
if (key === "ArrowUp") {
|
|
407
|
+
setMenuIndex(i_0 => (i_0 - 1 + count) % count);
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
|
+
return false;
|
|
411
|
+
};
|
|
412
|
+
$[71] = t18;
|
|
413
|
+
} else {
|
|
414
|
+
t18 = $[71];
|
|
415
|
+
}
|
|
416
|
+
const moveInMenu = t18;
|
|
417
|
+
const t19 = skills.length > 0;
|
|
418
|
+
let t20;
|
|
419
|
+
if ($[72] !== skills) {
|
|
420
|
+
t20 = skills.map(_temp3);
|
|
421
|
+
$[72] = skills;
|
|
422
|
+
$[73] = t20;
|
|
423
|
+
} else {
|
|
424
|
+
t20 = $[73];
|
|
425
|
+
}
|
|
426
|
+
let t21;
|
|
427
|
+
if ($[74] !== activeIndex || $[75] !== chooseMention || $[76] !== chooseMentionAt || $[77] !== chooseReference || $[78] !== chooseReferenceAt || $[79] !== chooseSkill || $[80] !== commandMenuOpen || $[81] !== commandQuery || $[82] !== commands || $[83] !== completeCommand || $[84] !== files_0 || $[85] !== inputAria || $[86] !== listId || $[87] !== mention || $[88] !== mentionCount || $[89] !== mentionMenuOpen || $[90] !== menuOpen || $[91] !== pickCommand || $[92] !== referables || $[93] !== referenceChips || $[94] !== referenceMatches || $[95] !== referenceMenuOpen || $[96] !== skillMatches || $[97] !== skillMenuOpen || $[98] !== t19 || $[99] !== t20 || $[100] !== trackTriggers) {
|
|
428
|
+
t21 = {
|
|
429
|
+
listId,
|
|
430
|
+
activeIndex,
|
|
431
|
+
inputAria,
|
|
432
|
+
menuOpen,
|
|
433
|
+
hasSkills: t19,
|
|
434
|
+
skillNames: t20,
|
|
435
|
+
commandQuery,
|
|
436
|
+
commands,
|
|
437
|
+
commandMenuOpen,
|
|
438
|
+
skillMatches,
|
|
439
|
+
skillMenuOpen,
|
|
440
|
+
mention,
|
|
441
|
+
mentionMenuOpen,
|
|
442
|
+
mentionCount,
|
|
443
|
+
files: files_0,
|
|
444
|
+
referenceMenuOpen,
|
|
445
|
+
referenceMatches,
|
|
446
|
+
referables,
|
|
447
|
+
referenceChips,
|
|
448
|
+
setMenuIndex,
|
|
449
|
+
trackTriggers,
|
|
450
|
+
close,
|
|
451
|
+
chooseMention,
|
|
452
|
+
chooseMentionAt,
|
|
453
|
+
chooseReference,
|
|
454
|
+
chooseReferenceAt,
|
|
455
|
+
chooseSkill,
|
|
456
|
+
pickCommand,
|
|
457
|
+
completeCommand,
|
|
458
|
+
moveInMenu
|
|
459
|
+
};
|
|
460
|
+
$[74] = activeIndex;
|
|
461
|
+
$[75] = chooseMention;
|
|
462
|
+
$[76] = chooseMentionAt;
|
|
463
|
+
$[77] = chooseReference;
|
|
464
|
+
$[78] = chooseReferenceAt;
|
|
465
|
+
$[79] = chooseSkill;
|
|
466
|
+
$[80] = commandMenuOpen;
|
|
467
|
+
$[81] = commandQuery;
|
|
468
|
+
$[82] = commands;
|
|
469
|
+
$[83] = completeCommand;
|
|
470
|
+
$[84] = files_0;
|
|
471
|
+
$[85] = inputAria;
|
|
472
|
+
$[86] = listId;
|
|
473
|
+
$[87] = mention;
|
|
474
|
+
$[88] = mentionCount;
|
|
475
|
+
$[89] = mentionMenuOpen;
|
|
476
|
+
$[90] = menuOpen;
|
|
477
|
+
$[91] = pickCommand;
|
|
478
|
+
$[92] = referables;
|
|
479
|
+
$[93] = referenceChips;
|
|
480
|
+
$[94] = referenceMatches;
|
|
481
|
+
$[95] = referenceMenuOpen;
|
|
482
|
+
$[96] = skillMatches;
|
|
483
|
+
$[97] = skillMenuOpen;
|
|
484
|
+
$[98] = t19;
|
|
485
|
+
$[99] = t20;
|
|
486
|
+
$[100] = trackTriggers;
|
|
487
|
+
$[101] = t21;
|
|
488
|
+
} else {
|
|
489
|
+
t21 = $[101];
|
|
490
|
+
}
|
|
491
|
+
return t21;
|
|
492
|
+
}
|
|
493
|
+
function _temp3(skill_2) {
|
|
494
|
+
return skill_2.name;
|
|
495
|
+
}
|
|
496
|
+
function _temp2(skill) {
|
|
497
|
+
return skill.name;
|
|
498
|
+
}
|
|
499
|
+
function _temp() {}
|
|
@@ -2,7 +2,7 @@ import { useState } from 'react';
|
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { useChatHost } from '../../../host.js';
|
|
4
4
|
import { useChatScope } from '../../../scope.js';
|
|
5
|
-
import { errorCode } from '../../../transport.js';
|
|
5
|
+
import { errorCode, errorMessage } from '../../../transport.js';
|
|
6
6
|
import { useChatActions } from '../../actions.js';
|
|
7
7
|
import { readStoredAttachments } from '../../attachments.js';
|
|
8
8
|
import { takeBackIntoDraft } from '../../drafts.js';
|
|
@@ -35,7 +35,7 @@ export function useTakeBack({
|
|
|
35
35
|
host.notify({
|
|
36
36
|
kind: 'error',
|
|
37
37
|
title: t('composer.queue.editFailed'),
|
|
38
|
-
description:
|
|
38
|
+
description: errorMessage(e)
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
41
|
const readFiles = async () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useState } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { Button } from '@adecore/ui';
|
|
5
5
|
import { formatNumber } from '@adecore/ui/format';
|
|
@@ -18,10 +18,4 @@ export declare function codeHighlighter(source?: () => Promise<Highlighter>): Co
|
|
|
18
18
|
export declare function useCodeHighlighter(): CodeHighlighter;
|
|
19
19
|
export declare function loadLanguage(lang: string): Promise<void>;
|
|
20
20
|
export declare function loadTheme(theme: string, custom: ChatHost['code']['custom']): Promise<void>;
|
|
21
|
-
export declare function readyHighlighter(langs: Iterable<string>, theme: string): Highlighter | null;
|
|
22
|
-
export declare function loadedLanguage(lang: string): string;
|
|
23
|
-
export declare function tokenizerFor(lang: string, theme: string): {
|
|
24
|
-
tokenize: Tokenize<GrammarState>;
|
|
25
|
-
fg: string | undefined;
|
|
26
|
-
} | null;
|
|
27
21
|
export declare function tokenStyle(token: CodeToken): CSSProperties | undefined;
|
|
@@ -149,18 +149,6 @@ export function loadLanguage(lang) {
|
|
|
149
149
|
export function loadTheme(theme, custom) {
|
|
150
150
|
return codeHighlighter().loadTheme(theme, custom);
|
|
151
151
|
}
|
|
152
|
-
/* The web bundle's highlighter once every one of `langs` and `theme` is in, or null while one is still on its way. */
|
|
153
|
-
export function readyHighlighter(langs, theme) {
|
|
154
|
-
return codeHighlighter().ready(langs, theme);
|
|
155
|
-
}
|
|
156
|
-
/* The language the web bundle draws `lang` in: the bundled grammar, or plain text. Only meaningful once a load settled. */
|
|
157
|
-
export function loadedLanguage(lang) {
|
|
158
|
-
return codeHighlighter().language(lang);
|
|
159
|
-
}
|
|
160
|
-
/* The web bundle's tokenizer for a language in a theme, or null while shiki, the grammar or the theme is still on its way. */
|
|
161
|
-
export function tokenizerFor(lang, theme) {
|
|
162
|
-
return codeHighlighter().tokenizer(lang, theme);
|
|
163
|
-
}
|
|
164
152
|
/* The inline style of one token; undefined when it only has the surrounding color. */
|
|
165
153
|
export function tokenStyle(token) {
|
|
166
154
|
const style = token.fontStyle ?? 0;
|
package/dist/chat/ui/icons.d.ts
CHANGED
package/dist/chat/ui/icons.js
CHANGED
|
@@ -3,9 +3,6 @@ import { toolEntry } from '../logic/tool-catalog.js';
|
|
|
3
3
|
import { Icon } from '@adecore/ui';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
const SIZE = 12;
|
|
6
|
-
/* A pending dock draws its mark a step up from the lines of a transcript, at the size a sidebar
|
|
7
|
-
row uses, because it is a thing to answer rather than a thing to read past. */
|
|
8
|
-
export const DOCK_ICON_SIZE = 14;
|
|
9
6
|
/* The gutter every row in the thread opens with: 16 wide, on the line box of its first row of text,
|
|
10
7
|
so the mark of a tool call, a note and a fold all sit in one column and their labels start at the
|
|
11
8
|
same x. The same box the menu rows and the toasts use. */
|
package/dist/chat/ui/index.d.ts
CHANGED
|
@@ -13,6 +13,9 @@ export { ImageThumb, type ImageThumbProps } from './ImageView.js';
|
|
|
13
13
|
export { LimitDock, LimitPill } from './LimitState.js';
|
|
14
14
|
export { ReplyMarkdown, MessageMarkdown, Markdown } from './Markdown.js';
|
|
15
15
|
export { ModelPicker } from './Pickers.js';
|
|
16
|
+
export { PromptEditor } from './PromptEditor.js';
|
|
17
|
+
export { promptPicks } from './composer/prompt-picks.js';
|
|
18
|
+
export type { PromptDraft } from './composer/use-prompt-menus.js';
|
|
16
19
|
export { ResumeCompactionDock } from './ResumeCompactionDock.js';
|
|
17
20
|
export { SubagentTitleCrumb, SubagentBreadcrumb } from './SubagentControls.js';
|
|
18
21
|
export { SubagentInfo } from './SubagentInfo.js';
|
package/dist/chat/ui/index.js
CHANGED
|
@@ -14,6 +14,8 @@ export { ImageThumb } from './ImageView.js';
|
|
|
14
14
|
export { LimitDock, LimitPill } from './LimitState.js';
|
|
15
15
|
export { ReplyMarkdown, MessageMarkdown, Markdown } from './Markdown.js';
|
|
16
16
|
export { ModelPicker } from './Pickers.js';
|
|
17
|
+
export { PromptEditor } from './PromptEditor.js';
|
|
18
|
+
export { promptPicks } from './composer/prompt-picks.js';
|
|
17
19
|
export { ResumeCompactionDock } from './ResumeCompactionDock.js';
|
|
18
20
|
export { SubagentTitleCrumb, SubagentBreadcrumb } from './SubagentControls.js';
|
|
19
21
|
export { SubagentInfo } from './SubagentInfo.js';
|
|
@@ -786,11 +786,8 @@ function Writing() {
|
|
|
786
786
|
return t1;
|
|
787
787
|
}
|
|
788
788
|
/*
|
|
789
|
-
* A reply
|
|
790
|
-
*
|
|
791
|
-
* it says it is being written and fades in once it is done. Only a row that saw the reply being
|
|
792
|
-
* written fades anything: an old reply scrolled back into view just stands there. A `#Name` it
|
|
793
|
-
* spells for a view, node or chat of the project is a chip that opens it.
|
|
789
|
+
* A reply, streamed a word, a block or the whole of it at a time. Only a row that saw the reply being
|
|
790
|
+
* written fades anything in: an old reply scrolled back into view just stands there.
|
|
794
791
|
*/
|
|
795
792
|
export function AssistantRow(t0) {
|
|
796
793
|
const $ = _c(67);
|