@parallelworks/ui 0.67.0 → 0.69.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.
@@ -0,0 +1,99 @@
1
+ import { useChat } from "../core/ChatProvider.js";
2
+ import useDragDrop from "../core/useDragDrop.js";
3
+ import DragOverlay from "./DragOverlay.js";
4
+ import ChatInput from "./ChatInput.js";
5
+ import { escapeClosesLayer } from "../core/useKeyboardShortcuts.js";
6
+ import ChatMessageList from "./ChatMessageList.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { useCallback, useEffect, useRef, useState } from "react";
9
+ //#region src/ai/components/SessionView.tsx
10
+ /** One conversation or agent session: its transcript, with the composer at
11
+ * the foot of the scrolling column. The host binds its own data and actions;
12
+ * what it leaves out (editing, regenerating, branches) the view leaves out. */
13
+ function SessionView({ sessionKey, messages, allMessages, streamingMessage, queuedMessages, onRemoveQueued, canRemoveQueued, queueDelivery, turn, onSend, onEdit, onRegenerate, onRetry, onNavigateBranch, onApprovalAnswer, showAuthor, currentUsername, banners, error, loading = false, dropFiles = false, footer, label, flush, workingIndicator, composer }) {
14
+ const inputRef = useRef(null);
15
+ const [editingId, setEditingId] = useState(null);
16
+ const { isStreaming: providerStreaming, stopStreaming } = useChat();
17
+ const running = turn ? turn.running : providerStreaming;
18
+ const stop = turn ? turn.onStop : stopStreaming;
19
+ useEffect(() => {
20
+ if (!running) return;
21
+ const onKeyDown = (e) => {
22
+ if (e.key === "Escape" && !e.defaultPrevented && !escapeClosesLayer(e.target)) stop();
23
+ };
24
+ window.addEventListener("keydown", onKeyDown);
25
+ return () => window.removeEventListener("keydown", onKeyDown);
26
+ }, [running, stop]);
27
+ const editable = (id) => messages.find((m) => m.id === id && m.role === "user");
28
+ const startEdit = useCallback((id) => {
29
+ if (messages.some((m) => m.id === id && m.role === "user")) setEditingId(id);
30
+ }, [messages]);
31
+ const editLast = useCallback(() => {
32
+ const last = messages.findLast((m) => m.role === "user");
33
+ if (last) setEditingId(last.id);
34
+ }, [messages]);
35
+ const onFilesDropped = useCallback((files) => {
36
+ inputRef.current?.addFiles(files);
37
+ }, []);
38
+ const { isDragging, dragHandlers } = useDragDrop({ onFilesDropped });
39
+ const input = /* @__PURE__ */ jsx(ChatInput, {
40
+ ref: inputRef,
41
+ ...composer,
42
+ onSend,
43
+ conversationId: sessionKey,
44
+ disabled: loading || !!composer?.disabled,
45
+ ...turn ? { turn } : {},
46
+ ...onEdit ? { onEditLastMessage: editLast } : {}
47
+ });
48
+ if (loading && !error) return /* @__PURE__ */ jsxs("div", {
49
+ className: "flex h-full flex-col bg-(--theme-panel-bg)",
50
+ children: [
51
+ banners,
52
+ /* @__PURE__ */ jsx("div", { className: "flex-1" }),
53
+ input
54
+ ]
55
+ });
56
+ return /* @__PURE__ */ jsx("div", {
57
+ className: "relative flex h-full bg-(--theme-panel-bg)",
58
+ children: /* @__PURE__ */ jsxs("div", {
59
+ className: "flex min-w-0 flex-1 flex-col",
60
+ ...dropFiles ? dragHandlers : {},
61
+ children: [
62
+ isDragging && dropFiles && /* @__PURE__ */ jsx(DragOverlay, { className: "rounded-lg" }),
63
+ banners,
64
+ error ?? /* @__PURE__ */ jsx(ChatMessageList, {
65
+ messages,
66
+ allMessages: allMessages ?? messages,
67
+ ...streamingMessage !== void 0 ? { streamingMessage } : {},
68
+ ...queuedMessages ? { queuedMessages } : {},
69
+ ...onRemoveQueued ? { onRemoveQueued } : {},
70
+ ...canRemoveQueued ? { canRemoveQueued } : {},
71
+ ...queueDelivery ? { queueDelivery } : {},
72
+ ...turn ? { isStreaming: turn.running } : {},
73
+ editingMessageId: editingId,
74
+ ...showAuthor !== void 0 ? { showAuthor } : {},
75
+ ...currentUsername ? { currentUsername } : {},
76
+ ...onNavigateBranch ? { onNavigateBranch } : {},
77
+ onEditMessage: onEdit ? startEdit : void 0,
78
+ onSaveEdit: (id, content) => {
79
+ const message = editable(id);
80
+ if (message && onEdit) onEdit(message, content);
81
+ setEditingId(null);
82
+ },
83
+ onCancelEdit: () => setEditingId(null),
84
+ onRegenerateMessage: onRegenerate,
85
+ onRetryMessage: onRetry,
86
+ ...onApprovalAnswer ? { onApprovalAnswer } : {},
87
+ ...footer ? { footer } : {},
88
+ ...label ? { label } : {},
89
+ ...flush ? { flush } : {},
90
+ ...workingIndicator !== void 0 ? { workingIndicator } : {},
91
+ inputElement: input
92
+ }),
93
+ error && input
94
+ ]
95
+ })
96
+ });
97
+ }
98
+ //#endregion
99
+ export { SessionView as default };
@@ -44,10 +44,6 @@ function useKeyboardShortcuts(options = {}) {
44
44
  if (!enabled) return;
45
45
  const handleKeyDown = (e) => {
46
46
  const cmdKey = isMac() ? e.metaKey : e.ctrlKey;
47
- if (e.key === "Escape") {
48
- if (!escapeClosesLayer(e.target)) handleStopGeneration();
49
- return;
50
- }
51
47
  if (cmdKey && e.shiftKey && e.key === "O") {
52
48
  e.preventDefault();
53
49
  handleNewConversation();
@@ -69,8 +65,7 @@ function useKeyboardShortcuts(options = {}) {
69
65
  }, [
70
66
  enabled,
71
67
  handleNewConversation,
72
- handleCopyLastResponse,
73
- handleStopGeneration
68
+ handleCopyLastResponse
74
69
  ]);
75
70
  return {
76
71
  getLastUserMessage,
@@ -21,6 +21,7 @@ export { type ConversationGroupKey, groupConversationsByDate, useConversationAct
21
21
  export { default as DragOverlay } from './components/DragOverlay.js';
22
22
  export { default as ModelSelector, getProviderKeyFromModelId, } from './components/ModelSelector.js';
23
23
  export { default as ProviderIssueBanner } from './components/ProviderIssueBanner.js';
24
+ export { default as SessionView, type SessionViewProps } from './components/SessionView.js';
24
25
  export { default as ShareDialog, ShareButton, } from './components/ShareDialog.js';
25
26
  export { type SlashCommandOption, type SlashMenuConfig, slashMatches, } from './components/SlashMenu.js';
26
27
  export type { ComposerPastes, PasteUploadResult, } from './components/usePasteCards.js';
package/dist/ai/index.js CHANGED
@@ -43,6 +43,7 @@ import ChatSidebar from "./components/ChatSidebar.js";
43
43
  import ChatLayout, { CHAT_COLUMN_SCOPE, ConversationLayout, DRAWER_BELOW_PX } from "./components/ChatLayout.js";
44
44
  import ChatMessage_default from "./components/ChatMessage.js";
45
45
  import ChatMessageList from "./components/ChatMessageList.js";
46
+ import SessionView from "./components/SessionView.js";
46
47
  import ChatThread from "./components/ChatThread.js";
47
48
  import { NoticeBar, NoticeCard, OutputCard } from "./ui/Notice.js";
48
- export { AGENT_COLOR_NAMES, ActivityLine, AgentMessageParts, AllocationSelector, ApprovalBlock, AttachmentManager, AttachmentUpload, BlockedGroupBanner, BranchNavigator, CHAT_COLUMN_SCOPE, ChatAdapterError, ChatEmptyState, ChatInput, ChatLayout, ChatMessageList, ChatMessage_default as ChatMessageView, ChatProvider, ChatSidebar, ChatStage, ChatThread, ComposerContext, ComposerControls, ComposerSettings, ComposerUsage, ConnectToolsLink, ConversationLayout, ConversationSidebar, DEFAULT_PERMISSION_MODE, DRAWER_BELOW_PX, DragOverlay, FOCUS_SIDEBAR_SEARCH_EVENT, INTERRUPTED_NOTICE, KeyboardShortcutsProvider, MAX_EDIT_DIFF_LINES, MAX_WRITE_DIFF_LINES, ManageProvidersLink, ModelSelector, NAMED_PERMISSION_MODES, NoticeBar, NoticeCard, OutputCard, PermissionPicker, ProviderIssueBanner, RenameDialog, ShareButton, ShareDialog, SidebarGroupHeading, SidebarPanel, SidebarRailItem, SidebarRow, SidebarRowTitle, SidebarToggle, agentColorHex, agentTypeLabel, applyPartDelta, askQuestionFromArgs, bashExitCode, chatReducer, clampPermissionMode, classifyPseudoUserMessage, clip, computeEditDiff, computeWriteRows, defaultChatStrings, defaultToolStrings, editSummary, finalizeParts, firstNonEmptyLine, fullToolArgs, getGreeting, getProviderKeyFromModelId, groupConversationsByDate, hiddenTranscriptTool, initialState, interruptionNotice, isEditDiffTool, isGroupableTool, isMac, isNamedPermissionMode, isOrgModel, languageForPath, lineDelta, parseEditArgs, parseSubagentNotice, pasteInlineMaxBytes, permissionModesUpTo, planFromArgs, providerIssueFor, resolveChatConfig, resultFailed, rollupSentence, sanitizeLabel, sanitizePanelText, sidebarDrawerProps, slashMatches, subagentDeliveryLine, summarizeToolArgs, taskCallFromArgs, thinkingHeading, tokenizeDiffLines, toolHeaderFor, toolSummary, useChat, useChatConfig, useChatStream, useConversationActions, useDragDrop, useKeyboardShortcuts, useRowDialogs, wordEmphasisRanges };
49
+ export { AGENT_COLOR_NAMES, ActivityLine, AgentMessageParts, AllocationSelector, ApprovalBlock, AttachmentManager, AttachmentUpload, BlockedGroupBanner, BranchNavigator, CHAT_COLUMN_SCOPE, ChatAdapterError, ChatEmptyState, ChatInput, ChatLayout, ChatMessageList, ChatMessage_default as ChatMessageView, ChatProvider, ChatSidebar, ChatStage, ChatThread, ComposerContext, ComposerControls, ComposerSettings, ComposerUsage, ConnectToolsLink, ConversationLayout, ConversationSidebar, DEFAULT_PERMISSION_MODE, DRAWER_BELOW_PX, DragOverlay, FOCUS_SIDEBAR_SEARCH_EVENT, INTERRUPTED_NOTICE, KeyboardShortcutsProvider, MAX_EDIT_DIFF_LINES, MAX_WRITE_DIFF_LINES, ManageProvidersLink, ModelSelector, NAMED_PERMISSION_MODES, NoticeBar, NoticeCard, OutputCard, PermissionPicker, ProviderIssueBanner, RenameDialog, SessionView, ShareButton, ShareDialog, SidebarGroupHeading, SidebarPanel, SidebarRailItem, SidebarRow, SidebarRowTitle, SidebarToggle, agentColorHex, agentTypeLabel, applyPartDelta, askQuestionFromArgs, bashExitCode, chatReducer, clampPermissionMode, classifyPseudoUserMessage, clip, computeEditDiff, computeWriteRows, defaultChatStrings, defaultToolStrings, editSummary, finalizeParts, firstNonEmptyLine, fullToolArgs, getGreeting, getProviderKeyFromModelId, groupConversationsByDate, hiddenTranscriptTool, initialState, interruptionNotice, isEditDiffTool, isGroupableTool, isMac, isNamedPermissionMode, isOrgModel, languageForPath, lineDelta, parseEditArgs, parseSubagentNotice, pasteInlineMaxBytes, permissionModesUpTo, planFromArgs, providerIssueFor, resolveChatConfig, resultFailed, rollupSentence, sanitizeLabel, sanitizePanelText, sidebarDrawerProps, slashMatches, subagentDeliveryLine, summarizeToolArgs, taskCallFromArgs, thinkingHeading, tokenizeDiffLines, toolHeaderFor, toolSummary, useChat, useChatConfig, useChatStream, useConversationActions, useDragDrop, useKeyboardShortcuts, useRowDialogs, wordEmphasisRanges };
@@ -1,3 +1,10 @@
1
+ /** A turn setting a session owns, shown in place of the chat's own selection. */
2
+ export interface BoundSetting {
3
+ value: string | null | undefined;
4
+ onChange: (value: string) => void;
5
+ /** The session cannot take a change right now, such as while it is unreachable. */
6
+ disabled?: boolean | undefined;
7
+ }
1
8
  export interface ChatUser {
2
9
  id: string;
3
10
  username: string;
package/dist/icons.d.ts CHANGED
@@ -14,6 +14,7 @@ export declare const AddIcon: IconType;
14
14
  export declare const AddProjectIcon: IconType;
15
15
  export declare const AddUserIcon: IconType;
16
16
  export declare const AgentIcon: IconType;
17
+ export declare const AiProviderIcon: IconType;
17
18
  export declare const AllocationIcon: IconType;
18
19
  export declare const APIIcon: IconType;
19
20
  export declare const ArchiveIcon: IconType;
@@ -24,6 +25,7 @@ export declare const ArrowUpIcon: IconType;
24
25
  export declare const ArticleIcon: IconType;
25
26
  export declare const AttachmentIcon: IconType;
26
27
  export declare const AuthenticationIcon: IconType;
28
+ export declare const BannerIcon: IconType;
27
29
  export declare const BillingIcon: IconType;
28
30
  export declare const BriefcaseIcon: IconType;
29
31
  export declare const BucketIcon: IconType;
@@ -46,21 +48,27 @@ export declare const ClipboardCheckIcon: IconType;
46
48
  export declare const ClockIcon: IconType;
47
49
  export declare const CloseIcon: IconType;
48
50
  export declare const CloudIcon: IconType;
51
+ export declare const CloudNetworkIcon: IconType;
49
52
  export declare const ClusterIcon: IconType;
50
53
  export declare const CodeIcon: IconType;
51
54
  export declare const CollapseIcon: IconType;
52
55
  export declare const ColumnsIcon: IconType;
56
+ export declare const CommandShellIcon: IconType;
53
57
  export declare const CommentIcon: IconType;
54
58
  export declare const CommitIcon: IconType;
55
59
  export declare const ComputeIcon: IconType;
60
+ export declare const ConfigIcon: IconType;
56
61
  export declare const ConnectIcon: IconType;
57
62
  export declare const ContractIcon: IconType;
58
63
  export declare const CopyIcon: IconType;
59
64
  export declare const CustomizeIcon: IconType;
65
+ export declare const DefinitionIcon: IconType;
66
+ export declare const DeprovisionIcon: IconType;
60
67
  export declare const DesktopIcon: IconType;
61
68
  export declare const DestroyIcon: IconType;
62
69
  export declare const DeviceIcon: IconType;
63
70
  export declare const DirectoryIcon: IconType;
71
+ export declare const DirectorySyncIcon: IconType;
64
72
  export declare const DisableCostIcon: IconType;
65
73
  export declare const DisableUserIcon: IconType;
66
74
  export declare const DisconnectIcon: IconType;
@@ -128,14 +136,15 @@ export declare const JobIcon: IconType;
128
136
  export declare const JsonIcon: IconType;
129
137
  export declare const KeyboardIcon: IconType;
130
138
  export declare const KeyIcon: IconType;
131
- export declare const KubernetesNamespaceIcon: IconType;
132
139
  export declare const LanguageIcon: IconType;
133
140
  export declare const LegalIcon: IconType;
134
141
  export declare const LibraryIcon: IconType;
135
142
  export declare const LicenseIcon: IconType;
136
143
  export declare const LinkIcon: IconType;
137
144
  export declare const ListViewIcon: IconType;
145
+ export declare const LoadingIcon: IconType;
138
146
  export declare const LockIcon: IconType;
147
+ export declare const LogsIcon: IconType;
139
148
  export declare const MachineImageIcon: IconType;
140
149
  export declare const MailFailedIcon: IconType;
141
150
  export declare const MailIcon: IconType;
@@ -154,6 +163,7 @@ export declare const MoonIcon: IconType;
154
163
  export declare const MoreIcon: IconType;
155
164
  export declare const MusicIcon: IconType;
156
165
  export declare const MuteIcon: IconType;
166
+ export declare const NamespaceIcon: IconType;
157
167
  export declare const NavigationIcon: IconType;
158
168
  export declare const NetworkInterfaceIcon: IconType;
159
169
  export declare const NetworkShareIcon: IconType;
@@ -175,25 +185,32 @@ export declare const PieChartIcon: IconType;
175
185
  export declare const PinFilledIcon: IconType;
176
186
  export declare const PinIcon: IconType;
177
187
  export declare const PowerIcon: IconType;
178
- export declare const PowershellIcon: IconType;
179
188
  export declare const PreviewIcon: IconType;
180
189
  export declare const PrintIcon: IconType;
181
190
  export declare const ProjectIcon: IconType;
191
+ export declare const ProvisionIcon: IconType;
182
192
  export declare const PublishIcon: IconType;
183
193
  export declare const PullRequestIcon: IconType;
184
194
  export declare const QRCodeIcon: IconType;
185
195
  export declare const QueueIcon: IconType;
196
+ export declare const QuickActionIcon: IconType;
186
197
  export declare const QuotaIcon: IconType;
187
198
  export declare const RedoIcon: IconType;
188
199
  export declare const RefreshIcon: IconType;
200
+ export declare const ReleaseIcon: IconType;
189
201
  export declare const RemoveIcon: IconType;
190
202
  export declare const RemoveUserIcon: IconType;
191
203
  export declare const RenameIcon: IconType;
192
204
  export declare const RenewIcon: IconType;
205
+ export declare const ReportIcon: IconType;
206
+ export declare const ResetIcon: IconType;
193
207
  export declare const ResetLayoutIcon: IconType;
194
208
  export declare const ResourceGroupIcon: IconType;
195
209
  export declare const ResourceIcon: IconType;
210
+ export declare const RestartIcon: IconType;
211
+ export declare const RestoreIcon: IconType;
196
212
  export declare const RetryIcon: IconType;
213
+ export declare const RevokeIcon: IconType;
197
214
  export declare const RoleIcon: IconType;
198
215
  export declare const RollbackIcon: IconType;
199
216
  export declare const RunningIcon: IconType;
@@ -207,6 +224,7 @@ export declare const SendIcon: IconType;
207
224
  export declare const ServiceIcon: IconType;
208
225
  export declare const SessionIcon: IconType;
209
226
  export declare const SettingsIcon: IconType;
227
+ export declare const SharedIcon: IconType;
210
228
  export declare const ShareIcon: IconType;
211
229
  export declare const ShieldIcon: IconType;
212
230
  export declare const ShieldOffIcon: IconType;
@@ -237,6 +255,7 @@ export declare const TagIcon: IconType;
237
255
  export declare const TerminalIcon: IconType;
238
256
  export declare const ThinkingIcon: IconType;
239
257
  export declare const TodoIcon: IconType;
258
+ export declare const TokenIcon: IconType;
240
259
  export declare const ToolsIcon: IconType;
241
260
  export declare const TrashIcon: IconType;
242
261
  export declare const TunnelIcon: IconType;
@@ -244,15 +263,26 @@ export declare const UndoIcon: IconType;
244
263
  export declare const UnfavoriteIcon: IconType;
245
264
  export declare const UnlinkIcon: IconType;
246
265
  export declare const UnmuteIcon: IconType;
266
+ export declare const UnsplitIcon: IconType;
247
267
  export declare const UploadIcon: IconType;
248
268
  export declare const UserIcon: IconType;
249
269
  export declare const UsersIcon: IconType;
250
270
  export declare const UserWorkspaceIcon: IconType;
271
+ export declare const VariableIcon: IconType;
251
272
  export declare const VideoIcon: IconType;
252
273
  export declare const WarningIcon: IconType;
253
274
  export declare const WebhookIcon: IconType;
254
- export declare const ZapIcon: IconType;
275
+ export declare const WorkerIcon: IconType;
276
+ export declare const WorkflowIcon: IconType;
277
+ export declare const WorkloadIcon: IconType;
278
+ export declare const WorkspaceMountIcon: IconType;
255
279
  export declare const ZipIcon: IconType;
256
280
  export declare const ZoomInIcon: IconType;
257
281
  export declare const ZoomOutIcon: IconType;
258
282
  export { ErrorCheckmark, SuccessCheckmark } from './components/StatusIcons.js';
283
+ /** @deprecated Renamed NamespaceIcon, which says what it means. */
284
+ export declare const KubernetesNamespaceIcon: IconType;
285
+ /** @deprecated Renamed CommandShellIcon, which says what it means. */
286
+ export declare const PowershellIcon: IconType;
287
+ /** @deprecated Renamed QuickActionIcon, which says what it means. */
288
+ export declare const ZapIcon: IconType;