@wallarm-org/design-system 3.2.0 → 3.3.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/components/AnimatedBackground/blur/BlurBackground.d.ts +6 -0
- package/dist/components/AnimatedBackground/blur/BlurBackground.js +176 -76
- package/dist/components/AnimatedBackground/blur/index.d.ts +1 -1
- package/dist/components/AnimatedBackground/index.d.ts +1 -1
- package/dist/components/ApprovalCard/ApprovalCard.d.ts +13 -0
- package/dist/components/ApprovalCard/ApprovalCard.js +249 -0
- package/dist/components/ApprovalCard/ApprovalCardActions.d.ts +6 -0
- package/dist/components/ApprovalCard/ApprovalCardActions.js +50 -0
- package/dist/components/ApprovalCard/ApprovalCardContent.d.ts +6 -0
- package/dist/components/ApprovalCard/ApprovalCardContent.js +50 -0
- package/dist/components/ApprovalCard/classes.d.ts +10 -0
- package/dist/components/ApprovalCard/classes.js +26 -0
- package/dist/components/ApprovalCard/index.d.ts +3 -0
- package/dist/components/ApprovalCard/index.js +3 -0
- package/dist/components/AssistantMessage/AssistantMessage.d.ts +12 -0
- package/dist/components/AssistantMessage/AssistantMessage.js +66 -0
- package/dist/components/AssistantMessage/AssistantMessageContent.d.ts +10 -0
- package/dist/components/AssistantMessage/AssistantMessageContent.js +50 -0
- package/dist/components/AssistantMessage/AssistantMessageError.d.ts +13 -0
- package/dist/components/AssistantMessage/AssistantMessageError.js +93 -0
- package/dist/components/AssistantMessage/AssistantMessageLoader.d.ts +13 -0
- package/dist/components/AssistantMessage/AssistantMessageLoader.js +88 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdown.d.ts +71 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdown.js +278 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownCodeBlock.d.ts +17 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownCodeBlock.js +94 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownInlineCode.d.ts +10 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownInlineCode.js +59 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownLink.d.ts +14 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownLink.js +65 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownTable.d.ts +7 -0
- package/dist/components/AssistantMessage/AssistantMessageMarkdownTable.js +70 -0
- package/dist/components/AssistantMessage/classes.d.ts +38 -0
- package/dist/components/AssistantMessage/classes.js +46 -0
- package/dist/components/AssistantMessage/index.d.ts +9 -0
- package/dist/components/AssistantMessage/index.js +9 -0
- package/dist/components/AssistantMessage/lib/markdown.d.ts +20 -0
- package/dist/components/AssistantMessage/lib/markdown.js +51 -0
- package/dist/components/ChainOfThought/ChainOfThought.d.ts +10 -0
- package/dist/components/ChainOfThought/ChainOfThought.js +66 -0
- package/dist/components/ChainOfThought/ChainOfThoughtStep.d.ts +31 -0
- package/dist/components/ChainOfThought/ChainOfThoughtStep.js +312 -0
- package/dist/components/ChainOfThought/classes.d.ts +20 -0
- package/dist/components/ChainOfThought/classes.js +84 -0
- package/dist/components/ChainOfThought/index.d.ts +2 -0
- package/dist/components/ChainOfThought/index.js +2 -0
- package/dist/components/Chat/Chat.d.ts +12 -0
- package/dist/components/Chat/Chat.js +90 -0
- package/dist/components/Chat/ChatBody.d.ts +12 -0
- package/dist/components/Chat/ChatBody.js +52 -0
- package/dist/components/Chat/ChatFooter.d.ts +7 -0
- package/dist/components/Chat/ChatFooter.js +50 -0
- package/dist/components/Chat/ChatGreeting.d.ts +8 -0
- package/dist/components/Chat/ChatGreeting.js +94 -0
- package/dist/components/Chat/ChatHeader.d.ts +6 -0
- package/dist/components/Chat/ChatHeader.js +50 -0
- package/dist/components/Chat/ChatHeaderActions.d.ts +7 -0
- package/dist/components/Chat/ChatHeaderActions.js +50 -0
- package/dist/components/Chat/ChatHeaderTitle.d.ts +12 -0
- package/dist/components/Chat/ChatHeaderTitle.js +99 -0
- package/dist/components/Chat/ChatSuggestion.d.ts +7 -0
- package/dist/components/Chat/ChatSuggestion.js +56 -0
- package/dist/components/Chat/ChatSuggestions.d.ts +14 -0
- package/dist/components/Chat/ChatSuggestions.js +111 -0
- package/dist/components/Chat/ChatSuggestionsContext.d.ts +7 -0
- package/dist/components/Chat/ChatSuggestionsContext.js +7 -0
- package/dist/components/Chat/ChatTrigger.d.ts +13 -0
- package/dist/components/Chat/ChatTrigger.js +101 -0
- package/dist/components/Chat/classes.d.ts +17 -0
- package/dist/components/Chat/classes.js +44 -0
- package/dist/components/Chat/index.d.ts +10 -0
- package/dist/components/Chat/index.js +10 -0
- package/dist/components/ChatInput/ChatInput.d.ts +30 -0
- package/dist/components/ChatInput/ChatInput.js +230 -0
- package/dist/components/ChatInput/ChatInputContext.d.ts +11 -0
- package/dist/components/ChatInput/ChatInputContext.js +8 -0
- package/dist/components/ChatInput/ChatInputSubmit.d.ts +10 -0
- package/dist/components/ChatInput/ChatInputSubmit.js +175 -0
- package/dist/components/ChatInput/ChatInputTextarea.d.ts +6 -0
- package/dist/components/ChatInput/ChatInputTextarea.js +155 -0
- package/dist/components/ChatInput/classes.d.ts +9 -0
- package/dist/components/ChatInput/classes.js +22 -0
- package/dist/components/ChatInput/index.d.ts +3 -0
- package/dist/components/ChatInput/index.js +3 -0
- package/dist/components/ChatPermissions/ChatPermissions.d.ts +12 -0
- package/dist/components/ChatPermissions/ChatPermissions.js +66 -0
- package/dist/components/ChatPermissions/ChatPermissionsContent.d.ts +7 -0
- package/dist/components/ChatPermissions/ChatPermissionsContent.js +73 -0
- package/dist/components/ChatPermissions/ChatPermissionsContext.d.ts +7 -0
- package/dist/components/ChatPermissions/ChatPermissionsContext.js +8 -0
- package/dist/components/ChatPermissions/ChatPermissionsItem.d.ts +17 -0
- package/dist/components/ChatPermissions/ChatPermissionsItem.js +115 -0
- package/dist/components/ChatPermissions/ChatPermissionsTrigger.d.ts +6 -0
- package/dist/components/ChatPermissions/ChatPermissionsTrigger.js +110 -0
- package/dist/components/ChatPermissions/classes.d.ts +3 -0
- package/dist/components/ChatPermissions/classes.js +5 -0
- package/dist/components/ChatPermissions/index.d.ts +4 -0
- package/dist/components/ChatPermissions/index.js +4 -0
- package/dist/components/Conversation/Conversation.d.ts +19 -0
- package/dist/components/Conversation/Conversation.js +102 -0
- package/dist/components/Conversation/ConversationContent.d.ts +11 -0
- package/dist/components/Conversation/ConversationContent.js +103 -0
- package/dist/components/Conversation/ConversationContext.d.ts +14 -0
- package/dist/components/Conversation/ConversationContext.js +8 -0
- package/dist/components/Conversation/ConversationEmptyState.d.ts +15 -0
- package/dist/components/Conversation/ConversationEmptyState.js +70 -0
- package/dist/components/Conversation/ConversationScrollButton.d.ts +13 -0
- package/dist/components/Conversation/ConversationScrollButton.js +138 -0
- package/dist/components/Conversation/classes.d.ts +13 -0
- package/dist/components/Conversation/classes.js +8 -0
- package/dist/components/Conversation/index.d.ts +4 -0
- package/dist/components/Conversation/index.js +4 -0
- package/dist/components/Conversation/useStickToBottom.d.ts +9 -0
- package/dist/components/Conversation/useStickToBottom.js +203 -0
- package/dist/components/MessageActions/MessageAction.d.ts +18 -0
- package/dist/components/MessageActions/MessageAction.js +109 -0
- package/dist/components/MessageActions/MessageActions.d.ts +12 -0
- package/dist/components/MessageActions/MessageActions.js +74 -0
- package/dist/components/MessageActions/MessageTimestamp.d.ts +7 -0
- package/dist/components/MessageActions/MessageTimestamp.js +50 -0
- package/dist/components/MessageActions/classes.d.ts +5 -0
- package/dist/components/MessageActions/classes.js +15 -0
- package/dist/components/MessageActions/index.d.ts +3 -0
- package/dist/components/MessageActions/index.js +3 -0
- package/dist/components/Popover/PopoverContent.d.ts +2 -1
- package/dist/components/Popover/PopoverContent.js +42 -39
- package/dist/components/UserMessage/UserMessage.d.ts +10 -0
- package/dist/components/UserMessage/UserMessage.js +66 -0
- package/dist/components/UserMessage/UserMessageBubble.d.ts +16 -0
- package/dist/components/UserMessage/UserMessageBubble.js +175 -0
- package/dist/components/UserMessage/UserMessageContext.d.ts +9 -0
- package/dist/components/UserMessage/UserMessageContext.js +4 -0
- package/dist/components/UserMessage/UserMessageShowMore.d.ts +15 -0
- package/dist/components/UserMessage/UserMessageShowMore.js +87 -0
- package/dist/components/UserMessage/classes.d.ts +11 -0
- package/dist/components/UserMessage/classes.js +32 -0
- package/dist/components/UserMessage/index.d.ts +3 -0
- package/dist/components/UserMessage/index.js +3 -0
- package/dist/components/WallyAssistant/WallyAssistant.d.ts +56 -0
- package/dist/components/WallyAssistant/WallyAssistant.js +541 -0
- package/dist/components/WallyAssistant/index.d.ts +10 -0
- package/dist/components/WallyAssistant/index.js +8 -0
- package/dist/components/WallyAssistant/model/deriveChatState.d.ts +33 -0
- package/dist/components/WallyAssistant/model/deriveChatState.js +54 -0
- package/dist/components/WallyAssistant/model/labels.d.ts +43 -0
- package/dist/components/WallyAssistant/model/labels.js +33 -0
- package/dist/components/WallyAssistant/model/model.d.ts +184 -0
- package/dist/components/WallyAssistant/model/model.js +0 -0
- package/dist/components/WallyAssistant/views/ApprovalCardView.d.ts +20 -0
- package/dist/components/WallyAssistant/views/ApprovalCardView.js +274 -0
- package/dist/components/WallyAssistant/views/ChainOfThoughtView.d.ts +18 -0
- package/dist/components/WallyAssistant/views/ChainOfThoughtView.js +301 -0
- package/dist/components/WallyAssistant/views/ChatMessageView.d.ts +15 -0
- package/dist/components/WallyAssistant/views/ChatMessageView.js +372 -0
- package/dist/components/WallyAssistant/views/ChatPartView.d.ts +16 -0
- package/dist/components/WallyAssistant/views/ChatPartView.js +171 -0
- package/dist/components/WallyAssistant/views/ChatViewContext.d.ts +98 -0
- package/dist/components/WallyAssistant/views/ChatViewContext.js +44 -0
- package/dist/components/WallyAssistant/views/ChatViewProvider.d.ts +18 -0
- package/dist/components/WallyAssistant/views/ChatViewProvider.js +96 -0
- package/dist/components/WallyAssistant/views/stepIcons.d.ts +8 -0
- package/dist/components/WallyAssistant/views/stepIcons.js +47 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/metadata/components.json +30786 -15960
- package/dist/theme/components/animated-background.css +6 -1
- package/dist/theme/index.css +1 -0
- package/dist/theme/utilities/shimmer-text.css +27 -0
- package/package.json +3 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type FC, type ReactNode, type Ref } from 'react';
|
|
2
|
+
import { type ChatProps } from '../Chat/index.js';
|
|
3
|
+
import type { ChatContextItem, ChatMessage, ChatStatus, ChatSuggestionItem, ChatToolPermission } from './model/model.js';
|
|
4
|
+
import type { ChatViewConfig } from './views/ChatViewContext.js';
|
|
5
|
+
/** DOM attribute names WallyAssistant keeps for its own props (now or later); they never reach the root. */
|
|
6
|
+
export type WallyAssistantReservedProps = 'children' | 'onSubmit' | 'onCopy' | 'title' | 'defaultValue' | 'onError';
|
|
7
|
+
/** WallyAssistant's own props (everything that isn't a `Chat` root attribute). */
|
|
8
|
+
export interface WallyAssistantOwnProps extends Omit<ChatViewConfig, 'status'> {
|
|
9
|
+
messages: readonly ChatMessage[];
|
|
10
|
+
/** Default 'ready'. */
|
|
11
|
+
status?: ChatStatus;
|
|
12
|
+
suggestions?: readonly ChatSuggestionItem[];
|
|
13
|
+
permissions?: readonly ChatToolPermission[];
|
|
14
|
+
context?: readonly ChatContextItem[];
|
|
15
|
+
value?: string;
|
|
16
|
+
onValueChange?: (value: string) => void;
|
|
17
|
+
/** Disables the textarea, Send and the suggestion pills (e.g. `!agent.isReady`). */
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** Focus management, e.g. focus the input after a thread switch. */
|
|
20
|
+
textareaRef?: Ref<HTMLTextAreaElement>;
|
|
21
|
+
/** Trimmed text. Not called when empty, while running, while an approval is pending, or when disabled. */
|
|
22
|
+
onSubmit: (text: string) => void;
|
|
23
|
+
/** Stop button, and Esc in the textarea while running (also inside a Drawer/Dialog: ChatInput
|
|
24
|
+
* claims that Esc from the layer, so no host recipe is needed). */
|
|
25
|
+
onStop?: () => void;
|
|
26
|
+
/** Default: onSubmit(suggestion.prompt ?? suggestion.label). */
|
|
27
|
+
onSuggestionSelect?: (suggestion: ChatSuggestionItem) => void;
|
|
28
|
+
/** Absent, or no permissions → no permissions button in the input. */
|
|
29
|
+
onPermissionChange?: (permission: ChatToolPermission, allowed: boolean) => void;
|
|
30
|
+
/** Absent → context chips aren't removable. */
|
|
31
|
+
onContextRemove?: (item: ChatContextItem) => void;
|
|
32
|
+
header?: ReactNode;
|
|
33
|
+
/** ChatHeaderTitle children, e.g. a thread Select (Figma Variant2). */
|
|
34
|
+
headerTitle?: ReactNode;
|
|
35
|
+
/** New chat, history, close: your Buttons, so analytics land on them. */
|
|
36
|
+
headerActions?: ReactNode;
|
|
37
|
+
/** Replaces the greeting and its pills (e.g. a history-loading state). */
|
|
38
|
+
emptyState?: ReactNode;
|
|
39
|
+
/** Top of ChatFooter, above the suggestions (banners). */
|
|
40
|
+
footerStart?: ReactNode;
|
|
41
|
+
/** Extra toolbar items in the input, between permissions and Send. */
|
|
42
|
+
inputTools?: ReactNode;
|
|
43
|
+
/** Replaces the whole ChatInput composition (you wire value and submit yourself). */
|
|
44
|
+
input?: ReactNode;
|
|
45
|
+
}
|
|
46
|
+
export interface WallyAssistantProps extends Omit<ChatProps, WallyAssistantReservedProps>, WallyAssistantOwnProps {
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The closed Wally panel (Figma 2:42): data and callbacks in, the whole chat out. Built only from
|
|
50
|
+
* exported pieces — `ChatViewProvider`, `deriveChatState`, `Chat*`, `Conversation*`,
|
|
51
|
+
* `ChatMessageView`, `ChatPartView`, `ChatInput*` — so a custom layout can reuse every rule.
|
|
52
|
+
* Send stays blocked while the last message has a pending approval; a resolved card stays docked
|
|
53
|
+
* until the next message. Code blocks highlight with a lazy Prism adapter unless an outer
|
|
54
|
+
* `CodeSnippetAdapterProvider` supplies one (that one wins).
|
|
55
|
+
*/
|
|
56
|
+
export declare const WallyAssistant: FC<WallyAssistantProps>;
|
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { Quote } from "../../icons/index.js";
|
|
5
|
+
import { TestIdProvider, useTestId } from "../../utils/testId.js";
|
|
6
|
+
import { Badge } from "../Badge/index.js";
|
|
7
|
+
import { Chat, ChatFooter, ChatHeader, ChatHeaderActions, ChatHeaderTitle, ChatSuggestion, ChatSuggestions } from "../Chat/index.js";
|
|
8
|
+
import { ChatInput, ChatInputSubmit, ChatInputTextarea } from "../ChatInput/index.js";
|
|
9
|
+
import { ChatPermissions, ChatPermissionsContent, ChatPermissionsItem, ChatPermissionsTrigger } from "../ChatPermissions/index.js";
|
|
10
|
+
import { loadPrismAdapter, plainAdapter, useAdapter } from "../CodeSnippet/index.js";
|
|
11
|
+
import { AdapterContext } from "../CodeSnippet/CodeSnippetContext.js";
|
|
12
|
+
import { Conversation, ConversationContent, ConversationEmptyState, ConversationScrollButton } from "../Conversation/index.js";
|
|
13
|
+
import { Separator } from "../Separator/index.js";
|
|
14
|
+
import { TagClose } from "../Tag/index.js";
|
|
15
|
+
import { deriveChatState } from "./model/deriveChatState.js";
|
|
16
|
+
import { DEFAULT_CHAT_LABELS } from "./model/labels.js";
|
|
17
|
+
import { ChatMessageView } from "./views/ChatMessageView.js";
|
|
18
|
+
import { ChatPartView } from "./views/ChatPartView.js";
|
|
19
|
+
import { ChatViewProvider } from "./views/ChatViewProvider.js";
|
|
20
|
+
import { resolveIcon } from "./views/stepIcons.js";
|
|
21
|
+
const Pill = (t0)=>{
|
|
22
|
+
const $ = c(5);
|
|
23
|
+
const { index, item, disabled, onSelect } = t0;
|
|
24
|
+
const t1 = useTestId(`suggestion-${index}`);
|
|
25
|
+
let t2;
|
|
26
|
+
if ($[0] !== disabled || $[1] !== item.label || $[2] !== onSelect || $[3] !== t1) {
|
|
27
|
+
t2 = /*#__PURE__*/ jsx(ChatSuggestion, {
|
|
28
|
+
"data-testid": t1,
|
|
29
|
+
disabled: disabled,
|
|
30
|
+
onClick: onSelect,
|
|
31
|
+
children: item.label
|
|
32
|
+
});
|
|
33
|
+
$[0] = disabled;
|
|
34
|
+
$[1] = item.label;
|
|
35
|
+
$[2] = onSelect;
|
|
36
|
+
$[3] = t1;
|
|
37
|
+
$[4] = t2;
|
|
38
|
+
} else t2 = $[4];
|
|
39
|
+
return t2;
|
|
40
|
+
};
|
|
41
|
+
const ContextChip = (t0)=>{
|
|
42
|
+
const $ = c(14);
|
|
43
|
+
const { index, item, icons, label, onRemove } = t0;
|
|
44
|
+
const chipId = useTestId(`context-${index}`);
|
|
45
|
+
let t1;
|
|
46
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
47
|
+
t1 = /*#__PURE__*/ jsx(Quote, {});
|
|
48
|
+
$[0] = t1;
|
|
49
|
+
} else t1 = $[0];
|
|
50
|
+
let t2;
|
|
51
|
+
if ($[1] !== icons || $[2] !== item.icon) {
|
|
52
|
+
t2 = resolveIcon(item.icon, icons, t1);
|
|
53
|
+
$[1] = icons;
|
|
54
|
+
$[2] = item.icon;
|
|
55
|
+
$[3] = t2;
|
|
56
|
+
} else t2 = $[3];
|
|
57
|
+
let t3;
|
|
58
|
+
if ($[4] !== chipId || $[5] !== item || $[6] !== label || $[7] !== onRemove) {
|
|
59
|
+
t3 = false !== item.removable && onRemove && /*#__PURE__*/ jsx(TestIdProvider, {
|
|
60
|
+
value: chipId,
|
|
61
|
+
children: /*#__PURE__*/ jsx(TagClose, {
|
|
62
|
+
"aria-label": label,
|
|
63
|
+
className: "rounded-4 focus-visible:ring-3 focus-visible:ring-focus-primary",
|
|
64
|
+
onClick: ()=>onRemove(item)
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
$[4] = chipId;
|
|
68
|
+
$[5] = item;
|
|
69
|
+
$[6] = label;
|
|
70
|
+
$[7] = onRemove;
|
|
71
|
+
$[8] = t3;
|
|
72
|
+
} else t3 = $[8];
|
|
73
|
+
let t4;
|
|
74
|
+
if ($[9] !== chipId || $[10] !== item.label || $[11] !== t2 || $[12] !== t3) {
|
|
75
|
+
t4 = /*#__PURE__*/ jsxs(Badge, {
|
|
76
|
+
type: "secondary",
|
|
77
|
+
color: "blue",
|
|
78
|
+
"data-testid": chipId,
|
|
79
|
+
children: [
|
|
80
|
+
t2,
|
|
81
|
+
item.label,
|
|
82
|
+
t3
|
|
83
|
+
]
|
|
84
|
+
});
|
|
85
|
+
$[9] = chipId;
|
|
86
|
+
$[10] = item.label;
|
|
87
|
+
$[11] = t2;
|
|
88
|
+
$[12] = t3;
|
|
89
|
+
$[13] = t4;
|
|
90
|
+
} else t4 = $[13];
|
|
91
|
+
return t4;
|
|
92
|
+
};
|
|
93
|
+
const PermissionItem = (t0)=>{
|
|
94
|
+
const $ = c(10);
|
|
95
|
+
const { index, item, onChange } = t0;
|
|
96
|
+
const t1 = useTestId(`item-${index}`);
|
|
97
|
+
let t2;
|
|
98
|
+
if ($[0] !== item || $[1] !== onChange) {
|
|
99
|
+
t2 = (t3)=>{
|
|
100
|
+
const { checked } = t3;
|
|
101
|
+
return onChange(item, checked);
|
|
102
|
+
};
|
|
103
|
+
$[0] = item;
|
|
104
|
+
$[1] = onChange;
|
|
105
|
+
$[2] = t2;
|
|
106
|
+
} else t2 = $[2];
|
|
107
|
+
let t3;
|
|
108
|
+
if ($[3] !== item.allowed || $[4] !== item.description || $[5] !== item.id || $[6] !== item.title || $[7] !== t1 || $[8] !== t2) {
|
|
109
|
+
t3 = /*#__PURE__*/ jsx(ChatPermissionsItem, {
|
|
110
|
+
"data-testid": t1,
|
|
111
|
+
name: item.id,
|
|
112
|
+
title: item.title,
|
|
113
|
+
description: item.description,
|
|
114
|
+
checked: item.allowed,
|
|
115
|
+
onCheckedChange: t2
|
|
116
|
+
});
|
|
117
|
+
$[3] = item.allowed;
|
|
118
|
+
$[4] = item.description;
|
|
119
|
+
$[5] = item.id;
|
|
120
|
+
$[6] = item.title;
|
|
121
|
+
$[7] = t1;
|
|
122
|
+
$[8] = t2;
|
|
123
|
+
$[9] = t3;
|
|
124
|
+
} else t3 = $[9];
|
|
125
|
+
return t3;
|
|
126
|
+
};
|
|
127
|
+
const PermissionsMenu = (t0)=>{
|
|
128
|
+
const $ = c(26);
|
|
129
|
+
const { items, labels, onChange } = t0;
|
|
130
|
+
let t1;
|
|
131
|
+
if ($[0] !== items || $[1] !== onChange) {
|
|
132
|
+
t1 = (p)=>/*#__PURE__*/ jsx(PermissionItem, {
|
|
133
|
+
index: items.indexOf(p),
|
|
134
|
+
item: p,
|
|
135
|
+
onChange: onChange
|
|
136
|
+
}, p.id);
|
|
137
|
+
$[0] = items;
|
|
138
|
+
$[1] = onChange;
|
|
139
|
+
$[2] = t1;
|
|
140
|
+
} else t1 = $[2];
|
|
141
|
+
const row = t1;
|
|
142
|
+
let T0;
|
|
143
|
+
let T1;
|
|
144
|
+
let t2;
|
|
145
|
+
let t3;
|
|
146
|
+
let t4;
|
|
147
|
+
let t5;
|
|
148
|
+
let t6;
|
|
149
|
+
if ($[3] !== items || $[4] !== labels.permissions || $[5] !== labels.permissionsHeading || $[6] !== row) {
|
|
150
|
+
const allowed = items.filter(_temp);
|
|
151
|
+
const others = items.filter(_temp2);
|
|
152
|
+
T1 = ChatPermissions;
|
|
153
|
+
if ($[14] !== labels.permissions) {
|
|
154
|
+
t6 = /*#__PURE__*/ jsx(ChatPermissionsTrigger, {
|
|
155
|
+
"aria-label": labels.permissions
|
|
156
|
+
});
|
|
157
|
+
$[14] = labels.permissions;
|
|
158
|
+
$[15] = t6;
|
|
159
|
+
} else t6 = $[15];
|
|
160
|
+
T0 = ChatPermissionsContent;
|
|
161
|
+
t2 = labels.permissionsHeading;
|
|
162
|
+
t3 = allowed.map(row);
|
|
163
|
+
t4 = allowed.length > 0 && others.length > 0 && /*#__PURE__*/ jsx(Separator, {
|
|
164
|
+
spacing: 4
|
|
165
|
+
});
|
|
166
|
+
t5 = others.map(row);
|
|
167
|
+
$[3] = items;
|
|
168
|
+
$[4] = labels.permissions;
|
|
169
|
+
$[5] = labels.permissionsHeading;
|
|
170
|
+
$[6] = row;
|
|
171
|
+
$[7] = T0;
|
|
172
|
+
$[8] = T1;
|
|
173
|
+
$[9] = t2;
|
|
174
|
+
$[10] = t3;
|
|
175
|
+
$[11] = t4;
|
|
176
|
+
$[12] = t5;
|
|
177
|
+
$[13] = t6;
|
|
178
|
+
} else {
|
|
179
|
+
T0 = $[7];
|
|
180
|
+
T1 = $[8];
|
|
181
|
+
t2 = $[9];
|
|
182
|
+
t3 = $[10];
|
|
183
|
+
t4 = $[11];
|
|
184
|
+
t5 = $[12];
|
|
185
|
+
t6 = $[13];
|
|
186
|
+
}
|
|
187
|
+
let t7;
|
|
188
|
+
if ($[16] !== T0 || $[17] !== t2 || $[18] !== t3 || $[19] !== t4 || $[20] !== t5) {
|
|
189
|
+
t7 = /*#__PURE__*/ jsxs(T0, {
|
|
190
|
+
label: t2,
|
|
191
|
+
children: [
|
|
192
|
+
t3,
|
|
193
|
+
t4,
|
|
194
|
+
t5
|
|
195
|
+
]
|
|
196
|
+
});
|
|
197
|
+
$[16] = T0;
|
|
198
|
+
$[17] = t2;
|
|
199
|
+
$[18] = t3;
|
|
200
|
+
$[19] = t4;
|
|
201
|
+
$[20] = t5;
|
|
202
|
+
$[21] = t7;
|
|
203
|
+
} else t7 = $[21];
|
|
204
|
+
let t8;
|
|
205
|
+
if ($[22] !== T1 || $[23] !== t6 || $[24] !== t7) {
|
|
206
|
+
t8 = /*#__PURE__*/ jsxs(T1, {
|
|
207
|
+
children: [
|
|
208
|
+
t6,
|
|
209
|
+
t7
|
|
210
|
+
]
|
|
211
|
+
});
|
|
212
|
+
$[22] = T1;
|
|
213
|
+
$[23] = t6;
|
|
214
|
+
$[24] = t7;
|
|
215
|
+
$[25] = t8;
|
|
216
|
+
} else t8 = $[25];
|
|
217
|
+
return t8;
|
|
218
|
+
};
|
|
219
|
+
let prism;
|
|
220
|
+
const LAZY_PRISM = {
|
|
221
|
+
adapter: {
|
|
222
|
+
name: "prism",
|
|
223
|
+
highlight: async (code, language)=>{
|
|
224
|
+
if ("text" === language) return plainAdapter.highlight(code, language);
|
|
225
|
+
prism ??= await loadPrismAdapter();
|
|
226
|
+
return prism.highlight(code, language);
|
|
227
|
+
},
|
|
228
|
+
getSupportedLanguages: ()=>prism?.getSupportedLanguages() ?? []
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
const WallyAssistant = (t0)=>{
|
|
232
|
+
const $ = c(50);
|
|
233
|
+
let background;
|
|
234
|
+
let context;
|
|
235
|
+
let disabled;
|
|
236
|
+
let emptyState;
|
|
237
|
+
let footerStart;
|
|
238
|
+
let formatTimestamp;
|
|
239
|
+
let header;
|
|
240
|
+
let headerActions;
|
|
241
|
+
let headerTitle;
|
|
242
|
+
let icons;
|
|
243
|
+
let input;
|
|
244
|
+
let inputTools;
|
|
245
|
+
let labelsProp;
|
|
246
|
+
let markdown;
|
|
247
|
+
let messages;
|
|
248
|
+
let onApprovalRespond;
|
|
249
|
+
let onContextRemove;
|
|
250
|
+
let onCopy;
|
|
251
|
+
let onFeedback;
|
|
252
|
+
let onPermissionChange;
|
|
253
|
+
let onRetry;
|
|
254
|
+
let onStop;
|
|
255
|
+
let onSubmit;
|
|
256
|
+
let onSuggestionSelect;
|
|
257
|
+
let onValueChange;
|
|
258
|
+
let permissions;
|
|
259
|
+
let renderMessageActions;
|
|
260
|
+
let renderPart;
|
|
261
|
+
let renderStepContent;
|
|
262
|
+
let rest;
|
|
263
|
+
let suggestions;
|
|
264
|
+
let t1;
|
|
265
|
+
let t2;
|
|
266
|
+
let textareaRef;
|
|
267
|
+
let value;
|
|
268
|
+
if ($[0] !== t0) {
|
|
269
|
+
({ messages, status: t1, suggestions, permissions, context, value, onValueChange, disabled, textareaRef, onSubmit, onStop, onSuggestionSelect, onPermissionChange, onContextRemove, header, headerTitle, headerActions, emptyState, footerStart, inputTools, input, labels: labelsProp, icons, markdown, formatTimestamp, approvalPlacement: t2, renderPart, renderStepContent, renderMessageActions, onApprovalRespond, onFeedback, onCopy, onRetry, background, ...rest } = t0);
|
|
270
|
+
$[0] = t0;
|
|
271
|
+
$[1] = background;
|
|
272
|
+
$[2] = context;
|
|
273
|
+
$[3] = disabled;
|
|
274
|
+
$[4] = emptyState;
|
|
275
|
+
$[5] = footerStart;
|
|
276
|
+
$[6] = formatTimestamp;
|
|
277
|
+
$[7] = header;
|
|
278
|
+
$[8] = headerActions;
|
|
279
|
+
$[9] = headerTitle;
|
|
280
|
+
$[10] = icons;
|
|
281
|
+
$[11] = input;
|
|
282
|
+
$[12] = inputTools;
|
|
283
|
+
$[13] = labelsProp;
|
|
284
|
+
$[14] = markdown;
|
|
285
|
+
$[15] = messages;
|
|
286
|
+
$[16] = onApprovalRespond;
|
|
287
|
+
$[17] = onContextRemove;
|
|
288
|
+
$[18] = onCopy;
|
|
289
|
+
$[19] = onFeedback;
|
|
290
|
+
$[20] = onPermissionChange;
|
|
291
|
+
$[21] = onRetry;
|
|
292
|
+
$[22] = onStop;
|
|
293
|
+
$[23] = onSubmit;
|
|
294
|
+
$[24] = onSuggestionSelect;
|
|
295
|
+
$[25] = onValueChange;
|
|
296
|
+
$[26] = permissions;
|
|
297
|
+
$[27] = renderMessageActions;
|
|
298
|
+
$[28] = renderPart;
|
|
299
|
+
$[29] = renderStepContent;
|
|
300
|
+
$[30] = rest;
|
|
301
|
+
$[31] = suggestions;
|
|
302
|
+
$[32] = t1;
|
|
303
|
+
$[33] = t2;
|
|
304
|
+
$[34] = textareaRef;
|
|
305
|
+
$[35] = value;
|
|
306
|
+
} else {
|
|
307
|
+
background = $[1];
|
|
308
|
+
context = $[2];
|
|
309
|
+
disabled = $[3];
|
|
310
|
+
emptyState = $[4];
|
|
311
|
+
footerStart = $[5];
|
|
312
|
+
formatTimestamp = $[6];
|
|
313
|
+
header = $[7];
|
|
314
|
+
headerActions = $[8];
|
|
315
|
+
headerTitle = $[9];
|
|
316
|
+
icons = $[10];
|
|
317
|
+
input = $[11];
|
|
318
|
+
inputTools = $[12];
|
|
319
|
+
labelsProp = $[13];
|
|
320
|
+
markdown = $[14];
|
|
321
|
+
messages = $[15];
|
|
322
|
+
onApprovalRespond = $[16];
|
|
323
|
+
onContextRemove = $[17];
|
|
324
|
+
onCopy = $[18];
|
|
325
|
+
onFeedback = $[19];
|
|
326
|
+
onPermissionChange = $[20];
|
|
327
|
+
onRetry = $[21];
|
|
328
|
+
onStop = $[22];
|
|
329
|
+
onSubmit = $[23];
|
|
330
|
+
onSuggestionSelect = $[24];
|
|
331
|
+
onValueChange = $[25];
|
|
332
|
+
permissions = $[26];
|
|
333
|
+
renderMessageActions = $[27];
|
|
334
|
+
renderPart = $[28];
|
|
335
|
+
renderStepContent = $[29];
|
|
336
|
+
rest = $[30];
|
|
337
|
+
suggestions = $[31];
|
|
338
|
+
t1 = $[32];
|
|
339
|
+
t2 = $[33];
|
|
340
|
+
textareaRef = $[34];
|
|
341
|
+
value = $[35];
|
|
342
|
+
}
|
|
343
|
+
const status = void 0 === t1 ? "ready" : t1;
|
|
344
|
+
const approvalPlacement = void 0 === t2 ? "docked" : t2;
|
|
345
|
+
const [innerDraft, setInnerDraft] = useState("");
|
|
346
|
+
const labels = {
|
|
347
|
+
...DEFAULT_CHAT_LABELS,
|
|
348
|
+
...labelsProp
|
|
349
|
+
};
|
|
350
|
+
const state = deriveChatState(messages, status, approvalPlacement);
|
|
351
|
+
const lastRow = state.rows[state.rows.length - 1];
|
|
352
|
+
const draft = value ?? innerDraft;
|
|
353
|
+
const footerRef = useRef(null);
|
|
354
|
+
const outerAdapter = useAdapter();
|
|
355
|
+
const dockFocus = useRef(false);
|
|
356
|
+
let t3;
|
|
357
|
+
if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
|
|
358
|
+
t3 = ()=>{
|
|
359
|
+
if (!dockFocus.current) return;
|
|
360
|
+
const active = document.activeElement;
|
|
361
|
+
if (active && active !== document.body) return;
|
|
362
|
+
dockFocus.current = false;
|
|
363
|
+
footerRef.current?.querySelector('[data-slot="approval-card"] button:not(:disabled)')?.focus({
|
|
364
|
+
preventScroll: true
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
$[36] = t3;
|
|
368
|
+
} else t3 = $[36];
|
|
369
|
+
useEffect(t3);
|
|
370
|
+
let t4;
|
|
371
|
+
if ($[37] !== onValueChange || $[38] !== value) {
|
|
372
|
+
t4 = (next)=>{
|
|
373
|
+
if (void 0 === value) setInnerDraft(next);
|
|
374
|
+
onValueChange?.(next);
|
|
375
|
+
};
|
|
376
|
+
$[37] = onValueChange;
|
|
377
|
+
$[38] = value;
|
|
378
|
+
$[39] = t4;
|
|
379
|
+
} else t4 = $[39];
|
|
380
|
+
const setDraft = t4;
|
|
381
|
+
const submit = (text)=>{
|
|
382
|
+
const trimmed = text.trim();
|
|
383
|
+
if (!trimmed || disabled || state.running || state.awaitingApproval) return;
|
|
384
|
+
onSubmit(trimmed);
|
|
385
|
+
if (void 0 === value) setInnerDraft("");
|
|
386
|
+
};
|
|
387
|
+
const pills = (placement)=>suggestions?.length ? /*#__PURE__*/ jsx(ChatSuggestions, {
|
|
388
|
+
placement: placement,
|
|
389
|
+
label: labels.suggestions,
|
|
390
|
+
children: suggestions.map((s, i)=>/*#__PURE__*/ jsx(Pill, {
|
|
391
|
+
index: i,
|
|
392
|
+
item: s,
|
|
393
|
+
disabled: disabled,
|
|
394
|
+
onSelect: ()=>onSuggestionSelect ? onSuggestionSelect(s) : submit(s.prompt ?? s.label)
|
|
395
|
+
}, s.id))
|
|
396
|
+
}) : null;
|
|
397
|
+
const T0 = ChatFooter;
|
|
398
|
+
let t5;
|
|
399
|
+
let t6;
|
|
400
|
+
if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
|
|
401
|
+
t5 = (e)=>{
|
|
402
|
+
dockFocus.current = e.target instanceof Element && !!e.target.closest('[data-slot="approval-card"]');
|
|
403
|
+
};
|
|
404
|
+
t6 = (e_0)=>{
|
|
405
|
+
if (!e_0.currentTarget.contains(e_0.relatedTarget)) dockFocus.current = false;
|
|
406
|
+
};
|
|
407
|
+
$[40] = t5;
|
|
408
|
+
$[41] = t6;
|
|
409
|
+
} else {
|
|
410
|
+
t5 = $[40];
|
|
411
|
+
t6 = $[41];
|
|
412
|
+
}
|
|
413
|
+
const t7 = !state.empty && !state.running && !state.awaitingApproval && pills("footer");
|
|
414
|
+
const t8 = lastRow && state.dockedApprovals.map((a)=>/*#__PURE__*/ jsx(ChatPartView, {
|
|
415
|
+
part: a,
|
|
416
|
+
message: lastRow,
|
|
417
|
+
isLast: true,
|
|
418
|
+
placement: "docked"
|
|
419
|
+
}, a.id));
|
|
420
|
+
const t9 = void 0 !== input ? input : /*#__PURE__*/ jsxs(ChatInput, {
|
|
421
|
+
value: draft,
|
|
422
|
+
onValueChange: setDraft,
|
|
423
|
+
onSubmit: submit,
|
|
424
|
+
onStop: onStop,
|
|
425
|
+
isRunning: state.running,
|
|
426
|
+
disabled: disabled,
|
|
427
|
+
disclaimer: labels.disclaimer,
|
|
428
|
+
context: context?.length ? context.map((item, i_1)=>/*#__PURE__*/ jsx(ContextChip, {
|
|
429
|
+
index: i_1,
|
|
430
|
+
item: item,
|
|
431
|
+
icons: icons,
|
|
432
|
+
label: labels.removeContext(item.label),
|
|
433
|
+
onRemove: onContextRemove
|
|
434
|
+
}, item.id)) : void 0,
|
|
435
|
+
children: [
|
|
436
|
+
/*#__PURE__*/ jsx(ChatInputTextarea, {
|
|
437
|
+
ref: textareaRef,
|
|
438
|
+
placeholder: labels.placeholder,
|
|
439
|
+
"aria-label": labels.input
|
|
440
|
+
}),
|
|
441
|
+
permissions?.length && onPermissionChange ? /*#__PURE__*/ jsx(PermissionsMenu, {
|
|
442
|
+
items: permissions,
|
|
443
|
+
labels: labels,
|
|
444
|
+
onChange: onPermissionChange
|
|
445
|
+
}) : null,
|
|
446
|
+
inputTools,
|
|
447
|
+
/*#__PURE__*/ jsx(ChatInputSubmit, {
|
|
448
|
+
sendLabel: labels.send,
|
|
449
|
+
stopLabel: labels.stop,
|
|
450
|
+
disabled: state.awaitingApproval && !state.running
|
|
451
|
+
})
|
|
452
|
+
]
|
|
453
|
+
});
|
|
454
|
+
let t10;
|
|
455
|
+
if ($[42] !== T0 || $[43] !== footerStart || $[44] !== t5 || $[45] !== t6 || $[46] !== t7 || $[47] !== t8 || $[48] !== t9) {
|
|
456
|
+
t10 = /*#__PURE__*/ jsxs(T0, {
|
|
457
|
+
ref: footerRef,
|
|
458
|
+
onFocus: t5,
|
|
459
|
+
onBlur: t6,
|
|
460
|
+
children: [
|
|
461
|
+
footerStart,
|
|
462
|
+
t7,
|
|
463
|
+
t8,
|
|
464
|
+
t9
|
|
465
|
+
]
|
|
466
|
+
});
|
|
467
|
+
$[42] = T0;
|
|
468
|
+
$[43] = footerStart;
|
|
469
|
+
$[44] = t5;
|
|
470
|
+
$[45] = t6;
|
|
471
|
+
$[46] = t7;
|
|
472
|
+
$[47] = t8;
|
|
473
|
+
$[48] = t9;
|
|
474
|
+
$[49] = t10;
|
|
475
|
+
} else t10 = $[49];
|
|
476
|
+
return /*#__PURE__*/ jsx(ChatViewProvider, {
|
|
477
|
+
status: status,
|
|
478
|
+
labels: labelsProp,
|
|
479
|
+
icons: icons,
|
|
480
|
+
markdown: markdown,
|
|
481
|
+
formatTimestamp: formatTimestamp,
|
|
482
|
+
approvalPlacement: approvalPlacement,
|
|
483
|
+
renderPart: renderPart,
|
|
484
|
+
renderStepContent: renderStepContent,
|
|
485
|
+
renderMessageActions: renderMessageActions,
|
|
486
|
+
onApprovalRespond: onApprovalRespond,
|
|
487
|
+
onFeedback: onFeedback,
|
|
488
|
+
onCopy: onCopy,
|
|
489
|
+
onRetry: onRetry,
|
|
490
|
+
children: /*#__PURE__*/ jsx(AdapterContext, {
|
|
491
|
+
value: outerAdapter ?? LAZY_PRISM,
|
|
492
|
+
children: /*#__PURE__*/ jsxs(Chat, {
|
|
493
|
+
"aria-label": labels.region,
|
|
494
|
+
...rest,
|
|
495
|
+
background: background ?? (state.empty ? "strong" : "subtle"),
|
|
496
|
+
children: [
|
|
497
|
+
void 0 !== header ? header : /*#__PURE__*/ jsxs(ChatHeader, {
|
|
498
|
+
children: [
|
|
499
|
+
/*#__PURE__*/ jsx(ChatHeaderTitle, {
|
|
500
|
+
label: labels.title,
|
|
501
|
+
children: headerTitle
|
|
502
|
+
}),
|
|
503
|
+
null != headerActions && /*#__PURE__*/ jsx(ChatHeaderActions, {
|
|
504
|
+
children: headerActions
|
|
505
|
+
})
|
|
506
|
+
]
|
|
507
|
+
}),
|
|
508
|
+
/*#__PURE__*/ jsxs(Conversation, {
|
|
509
|
+
autoScrollKey: state.lastUserMessageId,
|
|
510
|
+
children: [
|
|
511
|
+
/*#__PURE__*/ jsx(ConversationContent, {
|
|
512
|
+
"aria-label": labels.log,
|
|
513
|
+
"aria-busy": state.busy,
|
|
514
|
+
children: state.empty ? void 0 !== emptyState ? emptyState : /*#__PURE__*/ jsx(ConversationEmptyState, {
|
|
515
|
+
title: labels.greeting,
|
|
516
|
+
children: pills("greeting")
|
|
517
|
+
}) : state.rows.map((m, i_0)=>/*#__PURE__*/ jsx(ChatMessageView, {
|
|
518
|
+
message: m,
|
|
519
|
+
index: i_0,
|
|
520
|
+
isLast: i_0 === state.rows.length - 1
|
|
521
|
+
}, m.id))
|
|
522
|
+
}),
|
|
523
|
+
/*#__PURE__*/ jsx(ConversationScrollButton, {
|
|
524
|
+
label: labels.scrollToBottom
|
|
525
|
+
})
|
|
526
|
+
]
|
|
527
|
+
}),
|
|
528
|
+
t10
|
|
529
|
+
]
|
|
530
|
+
})
|
|
531
|
+
})
|
|
532
|
+
});
|
|
533
|
+
};
|
|
534
|
+
WallyAssistant.displayName = "WallyAssistant";
|
|
535
|
+
function _temp(p_0) {
|
|
536
|
+
return p_0.allowed;
|
|
537
|
+
}
|
|
538
|
+
function _temp2(p_1) {
|
|
539
|
+
return !p_1.allowed;
|
|
540
|
+
}
|
|
541
|
+
export { WallyAssistant };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { type ChatViewState, copyTextOf, deriveChatState } from './model/deriveChatState.js';
|
|
2
|
+
export { type ChatLabels, DEFAULT_CHAT_LABELS } from './model/labels.js';
|
|
3
|
+
export type { ChatApprovalOption, ChatApprovalOptionKind, ChatApprovalPart, ChatApprovalResponse, ChatApprovalStatus, ChatAssistantMessage, ChatAssistantPart, ChatChainOfThoughtPart, ChatContextItem, ChatCustomPart, ChatErrorPart, ChatFeedback, ChatIconKey, ChatId, ChatMessage, ChatMeta, ChatOpen, ChatPart, ChatSnapshot, ChatStatus, ChatStep, ChatStepKind, ChatStepStatus, ChatSuggestionItem, ChatTextPart, ChatToolPermission, ChatUserMessage, ChatUserPart, } from './model/model.js';
|
|
4
|
+
export { ApprovalCardView, type ApprovalCardViewProps } from './views/ApprovalCardView.js';
|
|
5
|
+
export { ChainOfThoughtView, type ChainOfThoughtViewProps } from './views/ChainOfThoughtView.js';
|
|
6
|
+
export { ChatMessageView, type ChatMessageViewProps } from './views/ChatMessageView.js';
|
|
7
|
+
export { ChatPartView, type ChatPartViewProps } from './views/ChatPartView.js';
|
|
8
|
+
export type { ChatMarkdownProps, ChatMessageActionNodes, ChatPartRenderContext, ChatStepRenderContext, ChatViewConfig, } from './views/ChatViewContext.js';
|
|
9
|
+
export { ChatViewProvider, type ChatViewProviderProps } from './views/ChatViewProvider.js';
|
|
10
|
+
export { WallyAssistant, type WallyAssistantProps } from './WallyAssistant.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { copyTextOf, deriveChatState } from "./model/deriveChatState.js";
|
|
2
|
+
export { DEFAULT_CHAT_LABELS } from "./model/labels.js";
|
|
3
|
+
export { ApprovalCardView } from "./views/ApprovalCardView.js";
|
|
4
|
+
export { ChainOfThoughtView } from "./views/ChainOfThoughtView.js";
|
|
5
|
+
export { ChatMessageView } from "./views/ChatMessageView.js";
|
|
6
|
+
export { ChatPartView } from "./views/ChatPartView.js";
|
|
7
|
+
export { ChatViewProvider } from "./views/ChatViewProvider.js";
|
|
8
|
+
export { WallyAssistant } from "./WallyAssistant.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ChatApprovalPart, ChatId, ChatMessage, ChatStatus, ChatStep, ChatStepStatus } from './model.js';
|
|
2
|
+
export interface ChatViewState {
|
|
3
|
+
/** `messages`, plus an empty reply `{ role: 'assistant', id: `${lastUserMessageId}:reply`, parts: [] }` while
|
|
4
|
+
* running and the last message is the user's (the loading row; the same id as the recommended mapper reply). */
|
|
5
|
+
rows: readonly ChatMessage[];
|
|
6
|
+
/** `messages.length === 0`. */
|
|
7
|
+
empty: boolean;
|
|
8
|
+
/** `status` is 'submitted' or 'streaming'. */
|
|
9
|
+
running: boolean;
|
|
10
|
+
/** The last row has a pending approval part. */
|
|
11
|
+
awaitingApproval: boolean;
|
|
12
|
+
/** `running && !awaitingApproval` → `aria-busy`. */
|
|
13
|
+
busy: boolean;
|
|
14
|
+
/** → Conversation `autoScrollKey`. */
|
|
15
|
+
lastUserMessageId?: ChatId;
|
|
16
|
+
/** Placement 'docked' only (§7.5). Render each with
|
|
17
|
+
* `<ChatPartView part message={rows.at(-1)} isLast placement='docked' />`. */
|
|
18
|
+
dockedApprovals: readonly ChatApprovalPart[];
|
|
19
|
+
}
|
|
20
|
+
/** 'submitted' | 'streaming'. Unknown statuses behave like 'ready'. */
|
|
21
|
+
export declare const isRunningStatus: (status: ChatStatus | undefined) => boolean;
|
|
22
|
+
/** The step's own status is pending, running or awaiting-approval. */
|
|
23
|
+
export declare const isLiveStepStatus: (status: ChatStepStatus) => boolean;
|
|
24
|
+
/** The step or any nested step is live (§7.3). */
|
|
25
|
+
export declare const isLiveStep: (step: ChatStep) => boolean;
|
|
26
|
+
export declare const hasPendingApproval: (message: ChatMessage | undefined) => boolean;
|
|
27
|
+
/** The last row's pending approvals; when none is pending, its last approval (decision 11). */
|
|
28
|
+
export declare const getDockedApprovals: (lastRow: ChatMessage | undefined) => readonly ChatApprovalPart[];
|
|
29
|
+
/** What Copy copies: `copyText`, or the non-empty text parts joined by a blank line. */
|
|
30
|
+
export declare const copyTextOf: (message: ChatMessage) => string;
|
|
31
|
+
/** Every derived rule of the chat, in one pure function shared by WallyAssistant and custom layouts (§7.1).
|
|
32
|
+
* `approvalPlacement` must match the `ChatViewProvider`'s, or a docked approval renders twice or never. */
|
|
33
|
+
export declare function deriveChatState(messages: readonly ChatMessage[], status?: ChatStatus, approvalPlacement?: 'docked' | 'inline'): ChatViewState;
|