@parallelworks/ui 0.76.0 → 0.78.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/README.md +30 -5
- package/dist/access/AccessDrawer.d.ts +28 -7
- package/dist/access/AccessDrawer.js +216 -35
- package/dist/access/AccessList.d.ts +19 -1
- package/dist/access/AccessList.js +220 -9
- package/dist/access/GrantView.d.ts +3 -1
- package/dist/access/GrantView.js +17 -4
- package/dist/access/PrincipalPicker.js +5 -5
- package/dist/access/focus.js +1 -1
- package/dist/access/index.d.ts +2 -2
- package/dist/access/index.js +2 -2
- package/dist/access/strings.d.ts +18 -0
- package/dist/access/strings.js +20 -2
- package/dist/access/types.d.ts +26 -0
- package/dist/ai/adapter/types.d.ts +1 -0
- package/dist/ai/components/AllocationSelector.js +1 -1
- package/dist/ai/components/AttachmentManager.js +5 -5
- package/dist/ai/components/AttachmentUpload.js +2 -2
- package/dist/ai/components/BranchNavigator.js +1 -1
- package/dist/ai/components/ChatActivity.d.ts +2 -0
- package/dist/ai/components/ChatActivity.js +31 -0
- package/dist/ai/components/ChatEmptyState.js +3 -3
- package/dist/ai/components/ChatInput.js +3 -5
- package/dist/ai/components/ChatLayout.js +1 -1
- package/dist/ai/components/ChatMessage.js +1 -1
- package/dist/ai/components/ChatMessageList.js +2 -2
- package/dist/ai/components/ChatSidebar.js +3 -3
- package/dist/ai/components/ChatThread.js +4 -4
- package/dist/ai/components/ComposerAddMenu.js +9 -20
- package/dist/ai/components/ModelSelector.js +3 -3
- package/dist/ai/components/PastedText.js +5 -5
- package/dist/ai/components/SessionView.js +5 -2
- package/dist/ai/components/ShareDialog.js +3 -3
- package/dist/ai/components/SlashMenu.d.ts +31 -4
- package/dist/ai/components/SlashMenu.js +36 -63
- package/dist/ai/components/agent/ActivityLine.js +1 -1
- package/dist/ai/components/agent/AgentMessageParts.d.ts +1 -1
- package/dist/ai/components/agent/AgentMessageParts.js +44 -18
- package/dist/ai/components/conversationActions.js +3 -3
- package/dist/ai/core/ChatProvider.js +11 -2
- package/dist/ai/core/config.d.ts +10 -1
- package/dist/ai/core/config.js +1 -1
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/strings.d.ts +2 -0
- package/dist/ai/strings.js +2 -1
- package/dist/ai/types.d.ts +3 -0
- package/dist/ai/ui/ConversationSidebar.js +3 -3
- package/dist/ai/ui/sidebar.js +3 -3
- package/dist/assets/yaml.worker-DOBV2lND.js +884 -0
- package/dist/components/ActionMenu.d.ts +38 -9
- package/dist/components/ActionMenu.js +48 -22
- package/dist/components/Avatar.d.ts +66 -6
- package/dist/components/Avatar.js +130 -18
- package/dist/components/Breadcrumbs.d.ts +4 -0
- package/dist/components/Breadcrumbs.js +26 -10
- package/dist/components/Button.d.ts +3 -2
- package/dist/components/Button.js +11 -1
- package/dist/components/Callout.d.ts +3 -2
- package/dist/components/Callout.js +3 -2
- package/dist/components/Card.d.ts +33 -9
- package/dist/components/Card.js +24 -8
- package/dist/components/Checkbox.d.ts +3 -1
- package/dist/components/Checkbox.js +4 -2
- package/dist/components/ColorInput.js +1 -1
- package/dist/components/Combobox.d.ts +23 -0
- package/dist/components/Combobox.js +252 -86
- package/dist/components/ConfirmModal.d.ts +26 -2
- package/dist/components/ConfirmModal.js +81 -15
- package/dist/components/ContextMenu.d.ts +29 -2
- package/dist/components/ContextMenu.js +60 -8
- package/dist/components/CopyButton.d.ts +21 -8
- package/dist/components/CopyButton.js +29 -9
- package/dist/components/CreateModal.d.ts +16 -4
- package/dist/components/CreateModal.js +27 -16
- package/dist/components/DatePicker.d.ts +31 -1
- package/dist/components/DatePicker.js +178 -47
- package/dist/components/DescriptionList.d.ts +13 -3
- package/dist/components/DescriptionList.js +43 -11
- package/dist/components/Disclosure.d.ts +10 -2
- package/dist/components/Disclosure.js +18 -7
- package/dist/components/Drawer.js +5 -5
- package/dist/components/EmptyState.d.ts +12 -4
- package/dist/components/EmptyState.js +18 -10
- package/dist/components/ErrorPage.d.ts +40 -0
- package/dist/components/ErrorPage.js +101 -0
- package/dist/components/ExternalLink.d.ts +4 -1
- package/dist/components/ExternalLink.js +4 -5
- package/dist/components/Field.d.ts +21 -6
- package/dist/components/Field.js +32 -16
- package/dist/components/FileButton.d.ts +19 -0
- package/dist/components/FileButton.js +32 -0
- package/dist/components/HoverCard.d.ts +26 -6
- package/dist/components/HoverCard.js +11 -5
- package/dist/components/IconButton.js +4 -2
- package/dist/components/InfoTip.js +3 -3
- package/dist/components/Input.d.ts +33 -3
- package/dist/components/Input.js +149 -14
- package/dist/components/Kbd.d.ts +40 -0
- package/dist/components/Kbd.js +168 -0
- package/dist/components/Listbox.d.ts +103 -0
- package/dist/components/Listbox.js +190 -0
- package/dist/components/Loader.d.ts +8 -2
- package/dist/components/Loader.js +16 -1
- package/dist/components/Markdown.js +1 -1
- package/dist/components/MarkdownImpl.js +1 -1
- package/dist/components/Menu.d.ts +20 -2
- package/dist/components/Menu.js +48 -19
- package/dist/components/MenuEntries.d.ts +38 -2
- package/dist/components/MenuEntries.js +266 -39
- package/dist/components/Meter.d.ts +50 -11
- package/dist/components/Meter.js +71 -21
- package/dist/components/Modal.d.ts +9 -3
- package/dist/components/Modal.js +68 -29
- package/dist/components/OneTimeCodeInput.js +1 -1
- package/dist/components/PageHeader.js +111 -7
- package/dist/components/PageHeaderAction.d.ts +8 -3
- package/dist/components/PageHeaderAction.js +122 -34
- package/dist/components/Pagination.d.ts +13 -1
- package/dist/components/Pagination.js +90 -19
- package/dist/components/Popover.d.ts +13 -2
- package/dist/components/Popover.js +20 -21
- package/dist/components/Provider.d.ts +140 -3
- package/dist/components/Provider.js +142 -12
- package/dist/components/RefreshButton.d.ts +13 -6
- package/dist/components/RefreshButton.js +17 -9
- package/dist/components/RunStatusIcon.d.ts +16 -7
- package/dist/components/RunStatusIcon.js +21 -8
- package/dist/components/Section.d.ts +11 -4
- package/dist/components/Section.js +33 -22
- package/dist/components/SegmentedControl.d.ts +16 -3
- package/dist/components/SegmentedControl.js +7 -3
- package/dist/components/Select.d.ts +19 -3
- package/dist/components/Select.js +114 -68
- package/dist/components/SelectionCopy.d.ts +10 -0
- package/dist/components/SelectionCopy.js +105 -0
- package/dist/components/SettingModeOption.js +1 -1
- package/dist/components/SettingsCard.js +1 -1
- package/dist/components/Skeleton.js +1 -1
- package/dist/components/StatusBadge.d.ts +55 -10
- package/dist/components/StatusBadge.js +91 -15
- package/dist/components/StickyBar.js +1 -1
- package/dist/components/Table.d.ts +22 -4
- package/dist/components/Table.js +46 -24
- package/dist/components/Tabs.d.ts +9 -4
- package/dist/components/Tabs.js +9 -4
- package/dist/components/Tag.d.ts +49 -0
- package/dist/components/Tag.js +199 -0
- package/dist/components/ThemeEditor.js +1 -1
- package/dist/components/Toast.js +1 -1
- package/dist/components/ToggleGroup.d.ts +4 -1
- package/dist/components/ToggleGroup.js +30 -13
- package/dist/components/Tooltip.d.ts +9 -3
- package/dist/components/Tooltip.js +55 -39
- package/dist/components/buttonClasses.d.ts +5 -2
- package/dist/components/buttonClasses.js +11 -10
- package/dist/components/chart.d.ts +69 -0
- package/dist/components/chart.js +145 -0
- package/dist/components/comboboxItems.d.ts +7 -1
- package/dist/components/comboboxItems.js +6 -2
- package/dist/components/dismiss.d.ts +5 -1
- package/dist/components/dismiss.js +6 -2
- package/dist/components/floating.d.ts +4 -4
- package/dist/components/floating.js +5 -5
- package/dist/components/headerActionsFit.d.ts +37 -0
- package/dist/components/headerActionsFit.js +81 -0
- package/dist/components/pageHeaderStore.d.ts +3 -0
- package/dist/components/pageHeaderStore.js +3 -0
- package/dist/components/pathBreaks.js +2 -2
- package/dist/components/popupContainer.d.ts +17 -0
- package/dist/components/popupContainer.js +69 -0
- package/dist/components/relativeTime.d.ts +21 -10
- package/dist/components/relativeTime.js +50 -22
- package/dist/components/segmented.d.ts +18 -4
- package/dist/components/segmented.js +48 -6
- package/dist/components/typedDate.d.ts +5 -0
- package/dist/components/typedDate.js +50 -0
- package/dist/components/useClosingValue.d.ts +4 -0
- package/dist/components/useClosingValue.js +12 -0
- package/dist/components/useCopy.d.ts +6 -0
- package/dist/components/useCopy.js +3 -3
- package/dist/components/useNarrow.d.ts +2 -0
- package/dist/components/useNarrow.js +16 -0
- package/dist/editor/Editor.js +1 -1
- package/dist/editor/FormCodePanel.js +1 -1
- package/dist/editor/Monaco.js +1 -1
- package/dist/editor/workers.js +1 -1
- package/dist/file-explorer/FileExplorer.js +16 -15
- package/dist/file-explorer/FileExplorerContext.js +2 -2
- package/dist/file-explorer/FilePreview/Viewer.js +3 -3
- package/dist/file-explorer/FilePreview/index.js +2 -2
- package/dist/file-explorer/FileRowsWindow.js +3 -3
- package/dist/file-explorer/FileTable.js +1 -1
- package/dist/file-explorer/LoadMoreRow.js +1 -1
- package/dist/file-explorer/TreeView.js +5 -5
- package/dist/file-explorer/helpers.js +2 -2
- package/dist/file-explorer/toasts.js +2 -2
- package/dist/form/Fields/CheckboxGroupField.js +1 -1
- package/dist/form/Fields/DropdownField.js +1 -1
- package/dist/form/Fields/DurationField.js +2 -2
- package/dist/form/Fields/MultiDropdownField.js +1 -1
- package/dist/form/Fields/NumberField.js +1 -1
- package/dist/form/Fields/ObjectField.js +1 -1
- package/dist/form/Fields/RangeField.js +1 -1
- package/dist/form/Fields/StringField.js +1 -1
- package/dist/form/Form.js +3 -3
- package/dist/form/FormLayout.js +1 -1
- package/dist/form/Wizard/WizardContainer.js +1 -1
- package/dist/form/Wizard/WizardNavigation.js +1 -1
- package/dist/form/Wizard/WizardStepContent.js +1 -1
- package/dist/form/fieldRegistry.js +1 -1
- package/dist/form/formEditing.js +1 -1
- package/dist/format.d.ts +17 -7
- package/dist/format.js +39 -16
- package/dist/graph/AnnotationBanner.js +2 -2
- package/dist/graph/Connectors.js +5 -5
- package/dist/graph/DependencyGraph.js +10 -9
- package/dist/graph/GraphEditor.js +4 -4
- package/dist/graph/GraphEditorDialogs.js +13 -12
- package/dist/graph/GraphNode.js +1 -1
- package/dist/graph/InputDialog.js +5 -5
- package/dist/graph/InputsEditor.js +7 -7
- package/dist/graph/MatrixGroup.js +2 -2
- package/dist/graph/ProblemsButton.js +3 -3
- package/dist/graph/Reveal.js +1 -1
- package/dist/graph/RunWarningsList.js +1 -1
- package/dist/graph/ShortcutsButton.js +25 -8
- package/dist/graph/StepSummaries.js +1 -1
- package/dist/graph/TreeView.js +2 -2
- package/dist/graph/WorkflowSettingsDialog.js +3 -3
- package/dist/graph/editorFields.js +3 -3
- package/dist/graph/editorPrimitives.js +1 -1
- package/dist/graph/editorRows.js +5 -5
- package/dist/graph/fieldProblems.js +2 -2
- package/dist/graph/inputRefs.js +7 -6
- package/dist/graph/stepWith.js +2 -2
- package/dist/index.d.ts +30 -21
- package/dist/index.js +20 -12
- package/dist/list/ActionToolbar.d.ts +4 -0
- package/dist/list/ActionToolbar.js +35 -12
- package/dist/list/ListFilterBar.d.ts +42 -0
- package/dist/list/ListFilterBar.js +789 -0
- package/dist/list/ListPage.d.ts +42 -4
- package/dist/list/ListPage.js +56 -22
- package/dist/list/ListTable.d.ts +27 -3
- package/dist/list/ListTable.js +48 -23
- package/dist/list/ListToolbar.d.ts +31 -0
- package/dist/list/ListToolbar.js +43 -0
- package/dist/list/ListViewControls.d.ts +8 -4
- package/dist/list/ListViewControls.js +22 -14
- package/dist/list/UserHoverCard.d.ts +8 -2
- package/dist/list/UserHoverCard.js +26 -13
- package/dist/list/filterModel.d.ts +122 -0
- package/dist/list/filterModel.js +308 -0
- package/dist/list/index.d.ts +6 -2
- package/dist/list/index.js +6 -2
- package/dist/list/listSearch.d.ts +1 -1
- package/dist/list/listSearch.js +8 -4
- package/dist/list/listView.d.ts +24 -2
- package/dist/list/listView.js +47 -45
- package/dist/list/rowMenu.d.ts +10 -5
- package/dist/list/rowMenu.js +17 -7
- package/dist/list/useListFilters.d.ts +68 -0
- package/dist/list/useListFilters.js +252 -0
- package/dist/logviewer/LogViewer.js +4 -4
- package/dist/styles/theme.css +94 -0
- package/dist/styles.css +1 -1
- package/package.json +11 -11
- package/dist/assets/yaml.worker-k9AdOqzf.js +0 -1441
- package/dist/components/fullscreen.d.ts +0 -4
- package/dist/components/fullscreen.js +0 -18
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { toolHeaderFor } from "../agent/toolfmt.js";
|
|
2
|
+
import { useChatConfig } from "../core/config.js";
|
|
3
|
+
import { useChat, useChatStream } from "../core/ChatProvider.js";
|
|
4
|
+
import ActivityLine from "./agent/ActivityLine.js";
|
|
5
|
+
import { useEffect, useState } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { DateTime } from "luxon";
|
|
8
|
+
//#region src/ai/components/ChatActivity.tsx
|
|
9
|
+
/** An agent session's working line for the provider's reply, naming its current step. */
|
|
10
|
+
function ChatActivity() {
|
|
11
|
+
const { isStreaming, tools } = useChat();
|
|
12
|
+
const { streamingParts } = useChatStream();
|
|
13
|
+
const { strings } = useChatConfig();
|
|
14
|
+
const [startedAt, setStartedAt] = useState(null);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
setStartedAt(isStreaming ? DateTime.now().toUTC().toISO() : null);
|
|
17
|
+
}, [isStreaming]);
|
|
18
|
+
if (!isStreaming) return null;
|
|
19
|
+
const waiting = streamingParts.some((p) => p.kind === "approval" && !p.resolved);
|
|
20
|
+
const running = streamingParts.findLast((p) => p.kind === "tool_call" && p.status === "running");
|
|
21
|
+
let word;
|
|
22
|
+
if (waiting) word = strings.activity.waitingForAnswer;
|
|
23
|
+
else if (running?.kind === "tool_call") word = tools.find((t) => t.id === running.name)?.label ?? toolHeaderFor(running.name).label;
|
|
24
|
+
return /* @__PURE__ */ jsx(ActivityLine, {
|
|
25
|
+
testId: "chat-activity",
|
|
26
|
+
startedAt,
|
|
27
|
+
word
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { ChatActivity as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AddIcon, CloudIcon } from "../../icons.js";
|
|
2
|
-
import { keyedByContent } from "../../components/keys.js";
|
|
3
2
|
import { useStrings } from "../../components/Provider.js";
|
|
3
|
+
import { keyedByContent } from "../../components/keys.js";
|
|
4
4
|
import { Button } from "../../components/Button.js";
|
|
5
5
|
import { Callout } from "../../components/Callout.js";
|
|
6
6
|
import { useChatConfig } from "../core/config.js";
|
|
@@ -13,8 +13,8 @@ import DragOverlay from "./DragOverlay.js";
|
|
|
13
13
|
import ChatInput from "./ChatInput.js";
|
|
14
14
|
import ChatStage, { StageList } from "./ChatStage.js";
|
|
15
15
|
import ProviderIssueBanner from "./ProviderIssueBanner.js";
|
|
16
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
17
16
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
17
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
18
18
|
//#region src/ai/components/ChatEmptyState.tsx
|
|
19
19
|
function pickRandom(arr, count) {
|
|
20
20
|
return [...arr].sort(() => Math.random() - .5).slice(0, count);
|
|
@@ -132,7 +132,7 @@ function ChatEmptyState({ targetSession }) {
|
|
|
132
132
|
disabled: isLoading || isLoadingModels || models.length === 0,
|
|
133
133
|
placeholder: isLoadingModels ? tInput.placeholderLoading : hasLoadedModels && models.length === 0 ? tInput.placeholderNoProviders : tInput.placeholder,
|
|
134
134
|
settingsLeft: /* @__PURE__ */ jsx(ConnectToolsLink, {}),
|
|
135
|
-
settingsRight: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ComposerUsage, { children: slots.composerUsage }), /* @__PURE__ */ jsx(ComposerControls, { targetSession })] })
|
|
135
|
+
settingsRight: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ComposerUsage, { children: slots.composerUsage }), /* @__PURE__ */ jsx(ComposerControls, { targetSession })] })
|
|
136
136
|
}),
|
|
137
137
|
prompts.length > 0 && !(hasLoadedModels && models.length === 0) && /* @__PURE__ */ jsx(StageList, { children: keyedByContent(prompts, (p) => p).map(({ key, item: prompt }) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("button", {
|
|
138
138
|
type: "button",
|
|
@@ -11,8 +11,8 @@ import DragOverlay from "./DragOverlay.js";
|
|
|
11
11
|
import { PasteFileCard } from "./PastedText.js";
|
|
12
12
|
import { SlashMenu, useSlashMenu } from "./SlashMenu.js";
|
|
13
13
|
import { usePasteCards } from "./usePasteCards.js";
|
|
14
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
14
|
import { useCallback, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
15
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
16
16
|
//#region src/ai/components/ChatInput.tsx
|
|
17
17
|
/** An optional box that is still empty should not wear the filled look of
|
|
18
18
|
* one waiting to send something. */
|
|
@@ -230,9 +230,7 @@ function ChatInput({ onSend, disabled = false, placeholder, conversationId, onEd
|
|
|
230
230
|
className: "relative",
|
|
231
231
|
children: [slash && slashMenu.open && /* @__PURE__ */ jsx(SlashMenu, {
|
|
232
232
|
label: slash.label,
|
|
233
|
-
|
|
234
|
-
matches: slashMenu.matches,
|
|
235
|
-
active: slashMenu.active,
|
|
233
|
+
menu: slashMenu,
|
|
236
234
|
onChoose: (name) => {
|
|
237
235
|
slashMenu.choose(name);
|
|
238
236
|
textareaRef.current?.focus();
|
|
@@ -290,7 +288,7 @@ function ChatInput({ onSend, disabled = false, placeholder, conversationId, onEd
|
|
|
290
288
|
]
|
|
291
289
|
})]
|
|
292
290
|
}),
|
|
293
|
-
(settingsLeft || uploadedCount > 0) && /* @__PURE__ */ jsx(ComposerSettings, { left: /* @__PURE__ */ jsxs(Fragment, { children: [settingsLeft, uploadedCount > 0 && /* @__PURE__ */ jsx("span", {
|
|
291
|
+
(settingsLeft || uploadedCount > 0) && /* @__PURE__ */ jsx(ComposerSettings, { left: /* @__PURE__ */ jsxs(Fragment$1, { children: [settingsLeft, uploadedCount > 0 && /* @__PURE__ */ jsx("span", {
|
|
294
292
|
className: "text-[11px] theme-muted-text",
|
|
295
293
|
children: t.filesAttached(uploadedCount)
|
|
296
294
|
})] }) }),
|
|
@@ -5,8 +5,8 @@ import { useChat } from "../core/ChatProvider.js";
|
|
|
5
5
|
import { KeyboardShortcutsProvider } from "../core/KeyboardShortcutsProvider.js";
|
|
6
6
|
import { SidebarToggle } from "../ui/sidebar.js";
|
|
7
7
|
import ChatSidebar from "./ChatSidebar.js";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { useLayoutEffect, useRef, useState } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/ai/components/ChatLayout.tsx
|
|
11
11
|
/** The list at its default width beside the narrowest thread that still
|
|
12
12
|
* reads comfortably; narrower than that, 'auto' moves the list to a drawer. */
|
|
@@ -17,8 +17,8 @@ import BranchNavigator from "./BranchNavigator.js";
|
|
|
17
17
|
import { UserMessageText } from "./PastedText.js";
|
|
18
18
|
import { replyText } from "../core/useKeyboardShortcuts.js";
|
|
19
19
|
import MessageAttachments from "./MessageAttachments.js";
|
|
20
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
20
|
import { memo, useEffect, useRef, useState } from "react";
|
|
21
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
22
|
import { DateTime } from "luxon";
|
|
23
23
|
//#region src/ai/components/ChatMessage.tsx
|
|
24
24
|
/** A message action: the chat's square, tinted from the ink on hover. */
|
|
@@ -9,8 +9,8 @@ import Markdown from "../ui/Markdown.js";
|
|
|
9
9
|
import { Reasoning, ReasoningBody } from "./Reasoning.js";
|
|
10
10
|
import AgentMessageParts from "./agent/AgentMessageParts.js";
|
|
11
11
|
import ChatMessage_default from "./ChatMessage.js";
|
|
12
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
12
|
import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
13
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
//#region src/ai/components/ChatMessageList.tsx
|
|
15
15
|
function ChatMessageList({ messages, allMessages, streamingMessage: streamingMessageProp, queuedMessages, onRemoveQueued, canRemoveQueued, queueDelivery = "afterReply", editingMessageId, showAuthor, currentUsername, onNavigateBranch, onEditMessage, onSaveEdit, onCancelEdit, onRegenerateMessage, onRetryMessage, onOpenReasoning, onApprovalAnswer, inputElement, isStreaming: isStreamingProp, flush, label, footer, workingIndicator = true }) {
|
|
16
16
|
const { adapter, isStreaming: providerStreaming } = useChat();
|
|
@@ -268,7 +268,7 @@ function ChatMessageList({ messages, allMessages, streamingMessage: streamingMes
|
|
|
268
268
|
children: [
|
|
269
269
|
removable ? /* @__PURE__ */ jsx(ClockIcon, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(CheckIcon, { className: "h-3 w-3" }),
|
|
270
270
|
/* @__PURE__ */ jsx("span", { children: status }),
|
|
271
|
-
onRemoveQueued && removable && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
271
|
+
onRemoveQueued && removable && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
272
272
|
"aria-hidden": "true",
|
|
273
273
|
children: "·"
|
|
274
274
|
}), /* @__PURE__ */ jsx("button", {
|
|
@@ -10,8 +10,8 @@ import { FOCUS_SIDEBAR_SEARCH_EVENT } from "../core/events.js";
|
|
|
10
10
|
import { SidebarEmpty, SidebarRow, SidebarRowBody } from "../ui/sidebar.js";
|
|
11
11
|
import { ConversationSidebar } from "../ui/ConversationSidebar.js";
|
|
12
12
|
import { groupConversationsByDate, useConversationActions } from "./conversationActions.js";
|
|
13
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
13
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
14
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
//#region src/ai/components/ChatSidebar.tsx
|
|
16
16
|
function ConversationRow({ conv, isCurrent, menuItems, openMenu, onOpen }) {
|
|
17
17
|
const { LinkComponent, strings } = useChatConfig();
|
|
@@ -122,7 +122,7 @@ function ChatSidebar({ actions = true, top }) {
|
|
|
122
122
|
current: filteredConversations.find((conv) => conv.id === activeConversationId),
|
|
123
123
|
onSelect: (conv) => navigation.toConversation(conv.id)
|
|
124
124
|
},
|
|
125
|
-
top: (top || actions) && /* @__PURE__ */ jsxs(Fragment, { children: [top?.({ collapsed: sidebarCollapsed }), actions && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
125
|
+
top: (top || actions) && /* @__PURE__ */ jsxs(Fragment$1, { children: [top?.({ collapsed: sidebarCollapsed }), actions && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
|
|
126
126
|
className: "flex flex-col gap-0.5 px-2 pt-2 pb-1",
|
|
127
127
|
children: [/* @__PURE__ */ jsxs(LinkComponent, {
|
|
128
128
|
target: { kind: "newChat" },
|
|
@@ -155,7 +155,7 @@ function ChatSidebar({ actions = true, top }) {
|
|
|
155
155
|
})] })] }),
|
|
156
156
|
footer: /* @__PURE__ */ jsx(ManageProvidersLink, {})
|
|
157
157
|
});
|
|
158
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [(drawer || sidebar !== "hidden") && list, overlays] });
|
|
158
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [(drawer || sidebar !== "hidden") && list, overlays] });
|
|
159
159
|
}
|
|
160
160
|
//#endregion
|
|
161
161
|
export { ChatSidebar as default };
|
|
@@ -5,8 +5,8 @@ import { ComposerControls, ComposerUsage, ConnectToolsLink } from "./ComposerChr
|
|
|
5
5
|
import ProviderIssueBanner from "./ProviderIssueBanner.js";
|
|
6
6
|
import { ShareButton, ToolResultsSharedNote } from "./ShareDialog.js";
|
|
7
7
|
import SessionView from "./SessionView.js";
|
|
8
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
//#region src/ai/components/ChatThread.tsx
|
|
11
11
|
function ChatThread({ conversationId }) {
|
|
12
12
|
const { adapter, currentUser, currentConversation, loadConversation, loadProviders, sendMessage, retryMessage, answerToolApproval, tools, isLoadingConversation, navigateToBranch, queuedMessages, removeQueuedMessage } = useChat();
|
|
@@ -57,12 +57,12 @@ function ChatThread({ conversationId }) {
|
|
|
57
57
|
currentUsername: currentUser.username,
|
|
58
58
|
loading: isLoadingConversation && !currentConversation,
|
|
59
59
|
dropFiles: !!adapter.attachments,
|
|
60
|
-
banners: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(BlockedGroupBanner, {}), /* @__PURE__ */ jsx(ProviderIssueBanner, {})] }),
|
|
60
|
+
banners: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(BlockedGroupBanner, {}), /* @__PURE__ */ jsx(ProviderIssueBanner, {})] }),
|
|
61
61
|
composer: {
|
|
62
62
|
disabled: isLoadingConversation || !canWrite,
|
|
63
63
|
...canWrite ? {} : { placeholder: strings.thread.viewOnly },
|
|
64
|
-
settingsLeft: /* @__PURE__ */ jsxs(Fragment, { children: [currentConversation && currentConversation.isOwner !== false ? /* @__PURE__ */ jsx(ShareButton, { conversationId }) : tools.length > 0 && /* @__PURE__ */ jsx(ToolResultsSharedNote, {}), /* @__PURE__ */ jsx(ConnectToolsLink, {})] }),
|
|
65
|
-
settingsRight: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ComposerUsage, { children: slots.composerUsage }), /* @__PURE__ */ jsx(ComposerControls, {})] })
|
|
64
|
+
settingsLeft: /* @__PURE__ */ jsxs(Fragment$1, { children: [currentConversation && currentConversation.isOwner !== false ? /* @__PURE__ */ jsx(ShareButton, { conversationId }) : tools.length > 0 && /* @__PURE__ */ jsx(ToolResultsSharedNote, {}), /* @__PURE__ */ jsx(ConnectToolsLink, {})] }),
|
|
65
|
+
settingsRight: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ComposerUsage, { children: slots.composerUsage }), /* @__PURE__ */ jsx(ComposerControls, {})] })
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
}
|
|
@@ -3,6 +3,7 @@ import { AddIcon, AttachmentIcon, ConnectIcon, ToolsIcon } from "../../icons.js"
|
|
|
3
3
|
import { panelItemClassName } from "../../components/floating.js";
|
|
4
4
|
import { MenuItem, MenuLinkItem, MenuPopup, MenuSeparator, MenuSubmenuTrigger } from "../../components/Menu.js";
|
|
5
5
|
import { useQueryMatch } from "../../components/search.js";
|
|
6
|
+
import { useNarrow } from "../../components/useNarrow.js";
|
|
6
7
|
import { Button } from "../../components/Button.js";
|
|
7
8
|
import { Modal } from "../../components/Modal.js";
|
|
8
9
|
import { Switch } from "../../components/Switch.js";
|
|
@@ -10,20 +11,8 @@ import { SearchInput } from "../../components/SearchInput.js";
|
|
|
10
11
|
import { useChatConfig } from "../core/config.js";
|
|
11
12
|
import { useChat } from "../core/ChatProvider.js";
|
|
12
13
|
import { Menu } from "@base-ui/react/menu";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
var NARROW = "(max-width: 639px)";
|
|
16
|
-
function subscribeNarrow(onChange) {
|
|
17
|
-
if (typeof window === "undefined" || typeof window.matchMedia !== "function") return () => {};
|
|
18
|
-
const media = window.matchMedia(NARROW);
|
|
19
|
-
media.addEventListener("change", onChange);
|
|
20
|
-
return () => media.removeEventListener("change", onChange);
|
|
21
|
-
}
|
|
22
|
-
var isNarrow = () => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(NARROW).matches;
|
|
23
|
-
/** A phone has no room beside the menu for a submenu, and no hover to open one. */
|
|
24
|
-
function useNarrow() {
|
|
25
|
-
return useSyncExternalStore(subscribeNarrow, isNarrow, () => false);
|
|
26
|
-
}
|
|
14
|
+
import { useId, useState } from "react";
|
|
15
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
27
16
|
function PlusButton({ open, label, hint, className, ...props }) {
|
|
28
17
|
const name = hint ? `${label} · ${hint}` : label;
|
|
29
18
|
return /* @__PURE__ */ jsxs("button", {
|
|
@@ -162,7 +151,7 @@ function ToolsModal({ open, onClose, listed }) {
|
|
|
162
151
|
size: "md",
|
|
163
152
|
title: t.tools,
|
|
164
153
|
description: t.toolsDescription,
|
|
165
|
-
footer: /* @__PURE__ */ jsxs(Fragment, { children: [footerStart, /* @__PURE__ */ jsx(Button, {
|
|
154
|
+
footer: /* @__PURE__ */ jsxs(Fragment$1, { children: [footerStart, /* @__PURE__ */ jsx(Button, {
|
|
166
155
|
variant: "primary",
|
|
167
156
|
onClick: close,
|
|
168
157
|
children: t.done
|
|
@@ -222,7 +211,7 @@ function ComposerAddMenu({ attachmentsOpen, onToggleAttachments, disabled, withT
|
|
|
222
211
|
const many = listed.length > 6;
|
|
223
212
|
const connect = extraLinks.connectTools;
|
|
224
213
|
const label = onToggleAttachments ? t.label : t.tools;
|
|
225
|
-
if (many && !onToggleAttachments) return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(PlusButton, {
|
|
214
|
+
if (many && !onToggleAttachments) return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(PlusButton, {
|
|
226
215
|
open: false,
|
|
227
216
|
"aria-haspopup": "dialog",
|
|
228
217
|
disabled,
|
|
@@ -254,9 +243,9 @@ function ComposerAddMenu({ attachmentsOpen, onToggleAttachments, disabled, withT
|
|
|
254
243
|
] }), /* @__PURE__ */ jsxs(MenuPopup, {
|
|
255
244
|
side: "inline-end",
|
|
256
245
|
className: "w-72",
|
|
257
|
-
children: [/* @__PURE__ */ jsx(ToolsList, { listed }), connect && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuSeparator, {}), /* @__PURE__ */ jsx(ConnectToolsRow, { href: connect })] })]
|
|
246
|
+
children: [/* @__PURE__ */ jsx(ToolsList, { listed }), connect && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(MenuSeparator, {}), /* @__PURE__ */ jsx(ConnectToolsRow, { href: connect })] })]
|
|
258
247
|
})] }) : null;
|
|
259
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
|
|
248
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
|
|
260
249
|
disabled,
|
|
261
250
|
render: /* @__PURE__ */ jsx(PlusButton, {
|
|
262
251
|
open: attachmentsOpen,
|
|
@@ -270,10 +259,10 @@ function ComposerAddMenu({ attachmentsOpen, onToggleAttachments, disabled, withT
|
|
|
270
259
|
children: [onToggleAttachments && /* @__PURE__ */ jsxs(MenuItem, {
|
|
271
260
|
onClick: onToggleAttachments,
|
|
272
261
|
children: [/* @__PURE__ */ jsx(AttachmentIcon, { className: "h-4 w-4 shrink-0 theme-muted-text" }), t.addFiles]
|
|
273
|
-
}), toolsEntry ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
262
|
+
}), toolsEntry ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
274
263
|
onToggleAttachments && /* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
275
264
|
/* @__PURE__ */ jsx(ToolsList, { listed }),
|
|
276
|
-
connect && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuSeparator, {}), /* @__PURE__ */ jsx(ConnectToolsRow, { href: connect })] })
|
|
265
|
+
connect && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(MenuSeparator, {}), /* @__PURE__ */ jsx(ConnectToolsRow, { href: connect })] })
|
|
277
266
|
] })]
|
|
278
267
|
})] }), many && /* @__PURE__ */ jsx(ToolsModal, {
|
|
279
268
|
open: modalOpen,
|
|
@@ -6,8 +6,8 @@ import { useChatConfig } from "../core/config.js";
|
|
|
6
6
|
import { issueDetail, issueLabel, providerIssueFor } from "../core/providerIssues.js";
|
|
7
7
|
import { useChat } from "../core/ChatProvider.js";
|
|
8
8
|
import { chipClassName } from "../ui/chip.js";
|
|
9
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
9
|
import { useMemo } from "react";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
//#region src/ai/components/ModelSelector.tsx
|
|
12
12
|
var ORG_OWNER = "org";
|
|
13
13
|
/** Who registered a provider: the provider list's owner when the adapter
|
|
@@ -20,7 +20,7 @@ function providerOwner(info, model) {
|
|
|
20
20
|
function CspIcon({ cspKind, className }) {
|
|
21
21
|
const { slots } = useChatConfig();
|
|
22
22
|
const custom = slots.providerIcon?.(cspKind, className);
|
|
23
|
-
if (custom) return /* @__PURE__ */ jsx(Fragment, { children: custom });
|
|
23
|
+
if (custom) return /* @__PURE__ */ jsx(Fragment$1, { children: custom });
|
|
24
24
|
return /* @__PURE__ */ jsx(CloudIcon, { className: cx("theme-muted-text", className) });
|
|
25
25
|
}
|
|
26
26
|
function getProviderKeyFromModelId(modelId) {
|
|
@@ -135,7 +135,7 @@ function ModelSelector({ targetSession, model }) {
|
|
|
135
135
|
trigger: /* @__PURE__ */ jsxs("button", {
|
|
136
136
|
type: "button",
|
|
137
137
|
className: chipClassName,
|
|
138
|
-
children: [selected ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
138
|
+
children: [selected ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
139
139
|
/* @__PURE__ */ jsx("span", {
|
|
140
140
|
className: "truncate font-medium theme-text",
|
|
141
141
|
children: getModelLabel(selected)
|
|
@@ -6,8 +6,8 @@ import { useChatConfig } from "../core/config.js";
|
|
|
6
6
|
import Markdown from "../ui/Markdown.js";
|
|
7
7
|
import { fencePaste } from "../core/pasteLanguage.js";
|
|
8
8
|
import { splitPastes } from "../core/pastes.js";
|
|
9
|
-
import { Fragment
|
|
10
|
-
import { Fragment as Fragment$1 } from "react";
|
|
9
|
+
import { Fragment } from "react";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
//#region src/ai/components/PastedText.tsx
|
|
12
12
|
/** A paste sent, or about to be sent, as its saved file. */
|
|
13
13
|
function PasteFileCard({ id, lines, bytes, saving = false, error, onRemove }) {
|
|
@@ -49,16 +49,16 @@ function PasteFileCard({ id, lines, bytes, saving = false, error, onRemove }) {
|
|
|
49
49
|
* it reads as, one sent as its file as a card. The blank lines the composer puts around a
|
|
50
50
|
* paste would stack on the block's own spacing, so they are dropped. */
|
|
51
51
|
function UserMessageText({ content, pastes }) {
|
|
52
|
-
if (!pastes?.length) return /* @__PURE__ */ jsx(Fragment, { children: content });
|
|
52
|
+
if (!pastes?.length) return /* @__PURE__ */ jsx(Fragment$1, { children: content });
|
|
53
53
|
const segments = splitPastes(content, pastes);
|
|
54
54
|
const shows = (seg) => typeof seg !== "string" || seg.trim() !== "";
|
|
55
55
|
const blockSpacing = (i) => cx(segments.slice(0, i).some(shows) ? "mt-2.5" : "mt-0", segments.slice(i + 1).some(shows) ? "mb-2.5" : "mb-0");
|
|
56
|
-
return /* @__PURE__ */ jsx(Fragment, { children: segments.map((segment, i) => {
|
|
56
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: segments.map((segment, i) => {
|
|
57
57
|
if (typeof segment === "string") {
|
|
58
58
|
let text = segment;
|
|
59
59
|
if (i > 0) text = text.replace(/^\n+/, "");
|
|
60
60
|
if (i < segments.length - 1) text = text.replace(/\n+$/, "");
|
|
61
|
-
return text ? /* @__PURE__ */ jsx(Fragment
|
|
61
|
+
return text ? /* @__PURE__ */ jsx(Fragment, { children: text }, i) : null;
|
|
62
62
|
}
|
|
63
63
|
if (segment.inline && segment.text !== void 0) return /* @__PURE__ */ jsx("span", {
|
|
64
64
|
className: cx("chat-paste-code block", blockSpacing(i)),
|
|
@@ -4,8 +4,9 @@ import DragOverlay from "./DragOverlay.js";
|
|
|
4
4
|
import ChatInput from "./ChatInput.js";
|
|
5
5
|
import { escapeClosesLayer } from "../core/useKeyboardShortcuts.js";
|
|
6
6
|
import ChatMessageList from "./ChatMessageList.js";
|
|
7
|
-
import
|
|
7
|
+
import ChatActivity from "./ChatActivity.js";
|
|
8
8
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
//#region src/ai/components/SessionView.tsx
|
|
10
11
|
/** One conversation or agent session: its transcript, with the composer at
|
|
11
12
|
* the foot of the scrolling column. The host binds its own data and actions;
|
|
@@ -36,9 +37,11 @@ function SessionView({ sessionKey, messages, allMessages, streamingMessage, queu
|
|
|
36
37
|
inputRef.current?.addFiles(files);
|
|
37
38
|
}, []);
|
|
38
39
|
const { isDragging, dragHandlers } = useDragDrop({ onFilesDropped });
|
|
40
|
+
const activity = composer?.activity ?? (!turn && running ? /* @__PURE__ */ jsx(ChatActivity, {}) : void 0);
|
|
39
41
|
const input = /* @__PURE__ */ jsx(ChatInput, {
|
|
40
42
|
ref: inputRef,
|
|
41
43
|
...composer,
|
|
44
|
+
activity,
|
|
42
45
|
onSend,
|
|
43
46
|
conversationId: sessionKey,
|
|
44
47
|
disabled: loading || !!composer?.disabled,
|
|
@@ -87,7 +90,7 @@ function SessionView({ sessionKey, messages, allMessages, streamingMessage, queu
|
|
|
87
90
|
...footer ? { footer } : {},
|
|
88
91
|
...label ? { label } : {},
|
|
89
92
|
...flush ? { flush } : {},
|
|
90
|
-
|
|
93
|
+
workingIndicator: workingIndicator ?? !activity,
|
|
91
94
|
inputElement: input
|
|
92
95
|
}),
|
|
93
96
|
error && input
|
|
@@ -9,8 +9,8 @@ import { ConfirmModal } from "../../components/ConfirmModal.js";
|
|
|
9
9
|
import { Select } from "../../components/Select.js";
|
|
10
10
|
import { useChatConfig } from "../core/config.js";
|
|
11
11
|
import { useChat } from "../core/ChatProvider.js";
|
|
12
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
12
|
import { useCallback, useEffect, useState, useTransition } from "react";
|
|
13
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
//#region src/ai/components/ShareDialog.tsx
|
|
15
15
|
function isTeamPermission(p) {
|
|
16
16
|
return !!p.team && !p.entireOrganization;
|
|
@@ -150,7 +150,7 @@ function ShareDialog({ conversationId, isOpen, onClose }) {
|
|
|
150
150
|
size: 24,
|
|
151
151
|
label: common.loading
|
|
152
152
|
})
|
|
153
|
-
}) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
153
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
154
154
|
/* @__PURE__ */ jsxs("div", {
|
|
155
155
|
className: "border theme-border rounded-lg p-3",
|
|
156
156
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
@@ -253,7 +253,7 @@ function ShareButton({ conversationId, disabled = false }) {
|
|
|
253
253
|
const [isOpen, setIsOpen] = useState(false);
|
|
254
254
|
const shared = useShared(conversationId, tools.length > 0 && !isOpen);
|
|
255
255
|
if (!adapter.sharing) return null;
|
|
256
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
256
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
257
257
|
/* @__PURE__ */ jsxs("button", {
|
|
258
258
|
type: "button",
|
|
259
259
|
onClick: () => setIsOpen(true),
|
|
@@ -27,11 +27,38 @@ export declare function useSlashMenu(input: string, config: SlashMenuConfig | un
|
|
|
27
27
|
'aria-controls': string | undefined;
|
|
28
28
|
'aria-activedescendant': string | undefined;
|
|
29
29
|
};
|
|
30
|
+
list: {
|
|
31
|
+
active: number;
|
|
32
|
+
setActive: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
33
|
+
handleKey: (event: globalThis.KeyboardEvent | KeyboardEvent<Element>) => boolean;
|
|
34
|
+
listId: string;
|
|
35
|
+
hostProps: {
|
|
36
|
+
'aria-autocomplete': 'list';
|
|
37
|
+
'aria-controls': string | undefined;
|
|
38
|
+
'aria-activedescendant': string | undefined;
|
|
39
|
+
};
|
|
40
|
+
listProps: {
|
|
41
|
+
id: string;
|
|
42
|
+
role: 'listbox';
|
|
43
|
+
};
|
|
44
|
+
optionProps: (index: number) => {
|
|
45
|
+
id: string;
|
|
46
|
+
role: 'option';
|
|
47
|
+
tabIndex: number;
|
|
48
|
+
'aria-selected': boolean;
|
|
49
|
+
'aria-disabled': true | undefined;
|
|
50
|
+
'data-highlighted': true | undefined;
|
|
51
|
+
'data-disabled': true | undefined;
|
|
52
|
+
onMouseDown: (event: {
|
|
53
|
+
preventDefault: () => void;
|
|
54
|
+
}) => void;
|
|
55
|
+
onMouseMove: () => void;
|
|
56
|
+
onClick: () => void;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
30
59
|
};
|
|
31
|
-
export declare function SlashMenu({ label,
|
|
60
|
+
export declare function SlashMenu({ label, menu, onChoose, }: {
|
|
32
61
|
label: string;
|
|
33
|
-
|
|
34
|
-
matches: SlashCommandOption[];
|
|
35
|
-
active: number;
|
|
62
|
+
menu: ReturnType<typeof useSlashMenu>;
|
|
36
63
|
onChoose: (name: string) => void;
|
|
37
64
|
}): import("react").JSX.Element;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ListboxOption, ListboxPanel, useListboxNavigation } from "../../components/Listbox.js";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { useEffect, useId, useState } from "react";
|
|
5
4
|
//#region src/ai/components/SlashMenu.tsx
|
|
6
5
|
var MAX_SHOWN = 8;
|
|
7
6
|
var TYPING_NAME = /^\/([\w:-]*)$/;
|
|
@@ -16,8 +15,6 @@ function slashMatches(input, commands) {
|
|
|
16
15
|
* from a multi-line composer, so the textarea stays a textbox that points at the list:
|
|
17
16
|
* spread `inputProps` on it. */
|
|
18
17
|
function useSlashMenu(input, config, setInput) {
|
|
19
|
-
const listId = useId();
|
|
20
|
-
const [active, setActive] = useState(0);
|
|
21
18
|
const [dismissed, setDismissed] = useState(false);
|
|
22
19
|
const matches = config ? slashMatches(input, config.commands) : [];
|
|
23
20
|
const exact = matches.length === 1 && `/${matches[0]?.name}` === input;
|
|
@@ -27,80 +24,56 @@ function useSlashMenu(input, config, setInput) {
|
|
|
27
24
|
useEffect(() => {
|
|
28
25
|
if (startsCommand) onOpen?.();
|
|
29
26
|
}, [startsCommand, onOpen]);
|
|
27
|
+
const choose = (name) => setInput(`/${name} `);
|
|
28
|
+
const list = useListboxNavigation({
|
|
29
|
+
items: matches,
|
|
30
|
+
open,
|
|
31
|
+
onChoose: (command) => choose(command.name),
|
|
32
|
+
onDismiss: () => setDismissed(true)
|
|
33
|
+
});
|
|
30
34
|
const query = TYPING_NAME.exec(input)?.[1] ?? null;
|
|
31
35
|
const [shownQuery, setShownQuery] = useState(query);
|
|
32
36
|
if (query !== shownQuery) {
|
|
33
37
|
setShownQuery(query);
|
|
34
|
-
setActive(0);
|
|
38
|
+
list.setActive(0);
|
|
35
39
|
setDismissed(false);
|
|
36
40
|
}
|
|
37
|
-
const choose = (name) => setInput(`/${name} `);
|
|
38
|
-
const shown = Math.min(active, matches.length - 1);
|
|
39
41
|
/** True when the key belonged to the menu. */
|
|
40
|
-
const handleKey = (e) =>
|
|
41
|
-
if (!open) return false;
|
|
42
|
-
switch (e.key) {
|
|
43
|
-
case "ArrowDown":
|
|
44
|
-
setActive((i) => (i + 1) % matches.length);
|
|
45
|
-
break;
|
|
46
|
-
case "ArrowUp":
|
|
47
|
-
setActive((i) => (i - 1 + matches.length) % matches.length);
|
|
48
|
-
break;
|
|
49
|
-
case "Tab":
|
|
50
|
-
case "Enter": {
|
|
51
|
-
if (e.shiftKey) return false;
|
|
52
|
-
const pick = matches[shown];
|
|
53
|
-
if (!pick) return false;
|
|
54
|
-
choose(pick.name);
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
case "Escape":
|
|
58
|
-
setDismissed(true);
|
|
59
|
-
break;
|
|
60
|
-
default: return false;
|
|
61
|
-
}
|
|
62
|
-
e.preventDefault();
|
|
63
|
-
return true;
|
|
64
|
-
};
|
|
42
|
+
const handleKey = (e) => list.handleKey(e);
|
|
65
43
|
return {
|
|
66
44
|
open,
|
|
67
45
|
matches,
|
|
68
|
-
active:
|
|
46
|
+
active: list.active,
|
|
69
47
|
choose,
|
|
70
48
|
handleKey,
|
|
71
|
-
listId,
|
|
72
|
-
inputProps:
|
|
73
|
-
|
|
74
|
-
"aria-controls": open ? listId : void 0,
|
|
75
|
-
"aria-activedescendant": open ? optionId(listId, shown) : void 0
|
|
76
|
-
}
|
|
49
|
+
listId: list.listId,
|
|
50
|
+
inputProps: list.hostProps,
|
|
51
|
+
list
|
|
77
52
|
};
|
|
78
53
|
}
|
|
79
|
-
|
|
80
|
-
function SlashMenu({ label, listId, matches, active, onChoose }) {
|
|
54
|
+
function SlashMenu({ label, menu, onChoose }) {
|
|
81
55
|
return /* @__PURE__ */ jsx("div", {
|
|
82
|
-
id: listId,
|
|
83
|
-
role: "listbox",
|
|
84
|
-
"aria-label": label,
|
|
85
56
|
"data-testid": "slash-menu",
|
|
86
|
-
className:
|
|
87
|
-
children:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
57
|
+
className: "absolute bottom-full left-0 right-0 z-20 mb-2",
|
|
58
|
+
children: /* @__PURE__ */ jsx(ListboxPanel, {
|
|
59
|
+
listProps: menu.list.listProps,
|
|
60
|
+
"aria-label": label,
|
|
61
|
+
children: menu.matches.map((c, i) => {
|
|
62
|
+
const option = menu.list.optionProps(i);
|
|
63
|
+
return /* @__PURE__ */ jsx(ListboxOption, {
|
|
64
|
+
option: {
|
|
65
|
+
...option,
|
|
66
|
+
onClick: () => onChoose(c.name)
|
|
67
|
+
},
|
|
68
|
+
inline: true,
|
|
69
|
+
label: /* @__PURE__ */ jsxs("span", {
|
|
70
|
+
className: "font-mono",
|
|
71
|
+
children: ["/", c.name]
|
|
72
|
+
}),
|
|
73
|
+
description: c.description
|
|
74
|
+
}, c.name);
|
|
75
|
+
})
|
|
76
|
+
})
|
|
104
77
|
});
|
|
105
78
|
}
|
|
106
79
|
//#endregion
|
|
@@ -4,8 +4,8 @@ import { Loader } from "../../../components/Loader.js";
|
|
|
4
4
|
import { formatCount, formatDuration } from "../../../format.js";
|
|
5
5
|
import { useElapsed } from "../../../components/relativeTime.js";
|
|
6
6
|
import { useChatConfig } from "../../core/config.js";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import { useEffect, useRef, useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
//#region src/ai/components/agent/ActivityLine.tsx
|
|
10
10
|
function randomIndex() {
|
|
11
11
|
return Math.floor(Math.random() * 1e6);
|
|
@@ -20,7 +20,7 @@ type RenderItem = {
|
|
|
20
20
|
kind: 'rollup';
|
|
21
21
|
members: RunMember[];
|
|
22
22
|
};
|
|
23
|
-
export declare function buildRenderItems(parts: MessagePart[]): RenderItem[];
|
|
23
|
+
export declare function buildRenderItems(parts: MessagePart[], hostDrawn?: (toolName: string) => boolean): RenderItem[];
|
|
24
24
|
export default function AgentMessageParts({ message, isStreaming, onApprovalAnswer, }: {
|
|
25
25
|
message: PartRendererProps['message'];
|
|
26
26
|
isStreaming?: boolean;
|