vzcode 2.35.0 → 2.36.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.
Files changed (44) hide show
  1. package/dist/assets/buildWorker-BZlya278.js +687 -0
  2. package/dist/assets/index-Cj-ERpBu.css +1 -0
  3. package/dist/assets/index-DD7vzp4U.js +364 -0
  4. package/dist/assets/{worker-D8p1JlHW.js → worker-1oQYaz-F.js} +251 -251
  5. package/dist/assets/worker-BfgPD8zR.js +125 -0
  6. package/dist/assets/{worker-k7HZ3t-V.js → worker-CoJaqtpi.js} +12 -12
  7. package/dist/index.html +2 -2
  8. package/dist/ot.js +180 -2
  9. package/dist/server/createServer.js +281 -0
  10. package/dist/server/index.js +6 -269
  11. package/package.json +14 -3
  12. package/src/client/CodeEditor/getOrCreateEditor.tsx +0 -14
  13. package/src/client/VZSidebar/AIChatWrapper.tsx +85 -0
  14. package/src/client/VZSidebar/VisualEditor/VisualEditor.tsx +13 -9
  15. package/src/client/VZSidebar/VisualEditor/colorUtils.ts +14 -0
  16. package/src/client/VZSidebar/index.tsx +2 -2
  17. package/src/client/useOpenDirectories.ts +0 -1
  18. package/src/llm-streaming-server/README.md +5 -3
  19. package/src/llm-streaming-ui/README.md +44 -42
  20. package/src/llm-streaming-ui/components/ChatInput.tsx +6 -19
  21. package/src/llm-streaming-ui/components/DiffView.tsx +6 -24
  22. package/src/llm-streaming-ui/components/FileEditingIndicator.tsx +1 -1
  23. package/src/llm-streaming-ui/components/Message.tsx +11 -27
  24. package/src/llm-streaming-ui/components/MessageList.tsx +15 -29
  25. package/src/llm-streaming-ui/components/Spinner.scss +37 -0
  26. package/src/llm-streaming-ui/components/Spinner.tsx +59 -0
  27. package/src/llm-streaming-ui/components/bootstrap.ts +16 -0
  28. package/src/llm-streaming-ui/components/icons.tsx +68 -0
  29. package/src/llm-streaming-ui/components/index.tsx +34 -30
  30. package/src/llm-streaming-ui/index.ts +13 -0
  31. package/src/llm-streaming-ui/props.ts +137 -0
  32. package/src/ot.ts +221 -4
  33. package/src/server/createServer.ts +413 -0
  34. package/src/server/index.ts +8 -333
  35. package/dist/assets/buildWorker-DylWm2VX.js +0 -687
  36. package/dist/assets/index-Dyt9tpmu.css +0 -1
  37. package/dist/assets/index-rg2Zvfo_.js +0 -364
  38. package/dist/assets/worker-b9bkZkXK.js +0 -116
  39. package/src/client/AIAssist/AIAssistCodeMirrorKeyMap.ts +0 -42
  40. package/src/client/AIAssist/generateFilesContext.ts +0 -25
  41. package/src/client/AIAssist/index.ts +0 -2
  42. package/src/client/CodeEditor/InteractiveWidgets/highlightWidgets.ts +0 -79
  43. /package/src/{client → llm-streaming-ui}/hooks/useAutoScroll.ts +0 -0
  44. /package/src/{client → llm-streaming-ui}/utils/scrollUtils.ts +0 -0
@@ -4,17 +4,23 @@ Client-side React UI components for displaying streaming AI edits and chat.
4
4
 
5
5
  ## Overview
6
6
 
7
- This module is being extracted from VZCode's AI chat interface to become a standalone, reusable React component library. It provides client-side UI functionality for:
7
+ This module is a standalone, reusable React component library extracted
8
+ from VZCode's AI chat interface. It provides client-side UI for:
8
9
 
9
10
  - **AI Chat Interface**: Main chat container component
10
- - **Message Display**: Rendering user and AI messages with streaming support
11
+ - **Message Display**: Rendering user and assistant messages with streaming support
11
12
  - **Diff Visualization**: Showing code changes with syntax highlighting
12
13
  - **Status Indicators**: Displaying AI thinking/reasoning and file editing status
13
14
  - **Voice Input**: Speech recognition for voice-based chat input
14
15
 
15
- ## Current Status
16
+ ## Status
16
17
 
17
- ⚠️ **Work in Progress**: This is Phase 1 of the extraction plan. The files have been copied to this directory and imports have been updated, but the components are not yet decoupled from VZCode.
18
+ The library is **decoupled** from VZCode. It does **not** import from
19
+ `src/client` and contains no reference to `VZCodeContext`. All
20
+ application state and callbacks are supplied via props.
21
+
22
+ VZCode binds those props using the `AIChatWrapper` component in
23
+ `src/client/VZSidebar/AIChatWrapper.tsx`.
18
24
 
19
25
  ## Components
20
26
 
@@ -36,68 +42,64 @@ This module is being extracted from VZCode's AI chat interface to become a stand
36
42
  - `TypingIndicator.tsx` - Animated typing/loading indicator
37
43
  - `ThinkingScratchpad.tsx` - AI reasoning/thinking display
38
44
  - `JumpToLatestButton.tsx` - Button to scroll to latest message
45
+ - `Spinner.tsx` - Animated loading spinner
39
46
 
40
47
  ### Hooks
41
48
 
42
49
  - `useSpeechRecognition.ts` - Voice input functionality
50
+ - `hooks/useAutoScroll.ts` - Auto-scroll behavior for the message list
51
+
52
+ ### Support Modules
53
+
54
+ - `components/bootstrap.ts` - react-bootstrap component wrappers
55
+ - `components/icons.tsx` - Self-contained microphone icons
56
+ - `utils/scrollUtils.ts` - Diff scrolling and accessibility helpers
57
+ - `props.ts` - Public prop and callback types
43
58
 
44
59
  ### Styles
45
60
 
46
- - `styles.scss` - Main component styles
47
- - `DiffView.scss` - Diff viewer styles
61
+ - `components/styles.scss` - Main component styles
62
+ - `components/DiffView.scss` - Diff viewer styles
63
+ - `components/Spinner.scss` - Spinner styles
48
64
 
49
65
  ## Dependencies
50
66
 
51
- Currently depends on:
52
-
53
67
  - React and React hooks
54
- - VZCode context: `../../client/VZCodeContext`
55
- - VZCode types: `../../types.js`
56
- - VZCode utilities: `../../client/hooks/*`, `../../utils/*`
57
- - Bootstrap components
68
+ - react-bootstrap
58
69
  - diff2html for diff rendering
59
70
  - react-markdown for message rendering
60
-
61
- ## Future Plans
62
-
63
- This module will eventually be:
64
-
65
- 1. Decoupled from VZCode-specific context and utilities
66
- 2. Published as `@vizhub/llm-streaming-ui` on npm
67
- 3. Made themeable and customizable
68
- 4. Provided with Storybook documentation
69
- 5. Fully typed with exported TypeScript interfaces
70
-
71
- See the [main issue](https://github.com/vizhub-core/vzcode/issues/XXX) for the full extraction plan.
71
+ - `@vizhub/viz-types` for chat/content types
72
+ - Shared, framework-agnostic VZCode utilities: `../types.js`
73
+ and `../utils/fileDiff`
72
74
 
73
75
  ## Usage (Current)
74
76
 
75
- Currently, this module is imported by `src/client/VZSidebar/index.tsx`:
77
+ `src/client/VZSidebar/index.tsx` renders `AIChatWrapper`, which passes
78
+ `VZCodeContext` state and callbacks into the standalone `AIChat`:
76
79
 
77
80
  ```typescript
78
- import { AIChat } from '../../llm-streaming-ui/components/index.js';
81
+ import { AIChat } from '../../llm-streaming-ui';
79
82
  ```
80
83
 
81
- The AIChat component expects VZCode context to be available and receives props like:
84
+ ```tsx
85
+ <AIChat
86
+ content={content}
87
+ aiChatMode={aiChatMode}
88
+ handleSendMessage={handleSendMessage}
89
+ // ...chat state, callbacks, feature flags
90
+ />
91
+ ```
82
92
 
83
- - Chat state from VZCodeContext
84
- - Message sending handlers
85
- - Auto-scroll configuration
93
+ See `AIChatProps` in `props.ts` for the full contract.
86
94
 
87
95
  ## Contributing
88
96
 
89
- As this module is being extracted, please:
90
-
91
- - Keep changes minimal and focused
92
- - Maintain backward compatibility with VZCode
93
- - Update component tests when modifying functionality
94
- - Consider future consumers when adding new dependencies
95
- - Document component props and behavior
97
+ - Keep the library free of imports from `src/client`
98
+ - Prefer props over context for all host interaction
99
+ - Add or update tests when changing behavior
100
+ - Document new props and side effects
96
101
 
97
102
  ## Theming
98
103
 
99
- The components currently use VZCode's theming system via SCSS variables. Future versions will provide:
100
-
101
- - CSS custom properties for theming
102
- - Light/dark theme presets
103
- - Customizable component styling
104
+ The components currently use VZCode's theming system via SCSS variables.
105
+ Future versions will provide CSS custom properties and theme presets.
@@ -9,20 +9,17 @@ import {
9
9
  Button,
10
10
  ButtonGroup,
11
11
  ToggleButton,
12
- } from '../../client/bootstrap';
13
- import {
14
- enableAskMode,
15
- enableVoiceInput,
16
- } from '../../client/featureFlags';
12
+ } from './bootstrap';
17
13
  import { useSpeechRecognition } from './useSpeechRecognition';
18
- import { MicSVG, MicOffSVG } from '../../client/Icons';
14
+ import { MicSVG, MicOffSVG } from './icons';
15
+ import type { ChatInputProps } from '../props';
19
16
 
20
17
  /**
21
18
  * Microphone toggle for voice typing. Purely presentational: the
22
19
  * speech recognition state lives in `ChatInputComponent`, and is only
23
20
  * ever instantiated when the user actually toggles the button.
24
21
  *
25
- * Rendered only when `enableVoiceInput` is set. See `featureFlags`.
22
+ * Rendered only when `enableVoiceInput` is set. See `props`.
26
23
  */
27
24
  const VoiceInputButton = ({
28
25
  isSpeaking,
@@ -54,18 +51,6 @@ const VoiceInputButton = ({
54
51
  );
55
52
  };
56
53
 
57
- interface ChatInputProps {
58
- aiChatMessage: string;
59
- setAIChatMessage: (message: string) => void;
60
- onSendMessage: () => void;
61
- focused: boolean;
62
- aiChatMode: 'ask' | 'edit';
63
- setAIChatMode: (mode: 'ask' | 'edit') => void;
64
- navigateMessageHistoryUp: () => void;
65
- navigateMessageHistoryDown: () => void;
66
- resetMessageHistoryNavigation: () => void;
67
- }
68
-
69
54
  const ChatInputComponent = ({
70
55
  aiChatMessage,
71
56
  setAIChatMessage,
@@ -76,6 +61,8 @@ const ChatInputComponent = ({
76
61
  navigateMessageHistoryUp,
77
62
  navigateMessageHistoryDown,
78
63
  resetMessageHistoryNavigation,
64
+ enableAskMode = false,
65
+ enableVoiceInput = false,
79
66
  }: ChatInputProps) => {
80
67
  const inputRef = useRef<HTMLTextAreaElement>(null);
81
68
 
@@ -1,12 +1,10 @@
1
1
  import React, {
2
- useContext,
3
2
  useEffect,
4
3
  useRef,
5
4
  forwardRef,
6
5
  useImperativeHandle,
7
6
  } from 'react';
8
7
  import {
9
- UnifiedFilesDiff,
10
8
  parseUnifiedDiffStats,
11
9
  combineUnifiedDiffs,
12
10
  isFileDeletion,
@@ -15,17 +13,12 @@ import {
15
13
  import * as Diff2Html from 'diff2html';
16
14
  import 'diff2html/bundles/css/diff2html.min.css';
17
15
  import './DiffView.scss';
18
- import { VZCodeContext } from '../../client/VZCodeContext';
19
16
  import {
20
17
  scrollToFirstDiff,
21
18
  getHeaderOffset,
22
19
  announceDiffSummary,
23
- } from '../../client/utils/scrollUtils';
24
- import { getFileId } from '@vizhub/viz-utils';
25
-
26
- interface DiffViewProps {
27
- diffData: UnifiedFilesDiff;
28
- }
20
+ } from '../utils/scrollUtils';
21
+ import type { DiffViewProps } from '../props';
29
22
 
30
23
  // Methods that can be called on DiffView from parent components
31
24
  export interface DiffViewRef {
@@ -38,9 +31,7 @@ export interface DiffViewRef {
38
31
  export const DiffView = forwardRef<
39
32
  DiffViewRef,
40
33
  DiffViewProps
41
- >(({ diffData }, ref) => {
42
- const { content, openTab, setIsAIChatOpen } =
43
- useContext(VZCodeContext);
34
+ >(({ diffData, onOpenFile }, ref) => {
44
35
  const diffContainerRef = useRef<HTMLDivElement>(null);
45
36
 
46
37
  const allDiffs = Object.values(diffData).filter(
@@ -124,19 +115,10 @@ export const DiffView = forwardRef<
124
115
  event.preventDefault();
125
116
  event.stopPropagation();
126
117
 
127
- console.log('File name clicked');
128
-
129
118
  const fileName = target.textContent?.trim();
130
119
 
131
- console.log('Clicked file name:', fileName);
132
- if (fileName && content) {
133
- const fileId = getFileId(content, fileName);
134
-
135
- if (fileId) {
136
- // Open the file tab and switch to files view
137
- openTab({ fileId, isTransient: false });
138
- setIsAIChatOpen(false);
139
- }
120
+ if (fileName && onOpenFile) {
121
+ onOpenFile(fileName);
140
122
  }
141
123
  }
142
124
  };
@@ -167,7 +149,7 @@ export const DiffView = forwardRef<
167
149
  );
168
150
  });
169
151
  };
170
- }, [diffHtml, content, openTab, setIsAIChatOpen]);
152
+ }, [diffHtml, onOpenFile]);
171
153
 
172
154
  if (allDiffs.length === 0) {
173
155
  return null;
@@ -1,4 +1,4 @@
1
- import { Spinner } from '../../client/AIAssist/Spinner';
1
+ import { Spinner } from './Spinner';
2
2
 
3
3
  interface AIEditingStatusIndicatorProps {
4
4
  status: string;
@@ -1,31 +1,10 @@
1
- import React, {
2
- useMemo,
3
- useContext,
4
- forwardRef,
5
- } from 'react';
1
+ import React, { useMemo, forwardRef } from 'react';
6
2
  import { timestampToDate } from '@vizhub/viz-utils';
7
3
  import Markdown from 'react-markdown';
8
4
  import remarkGfm from 'remark-gfm';
9
- import { StreamingEvent } from '../../types.js';
10
5
  import { IndividualFileDiff } from './IndividualFileDiff';
11
- import { VZCodeContext } from '../../client/VZCodeContext';
12
6
  import { DiffView, DiffViewRef } from './DiffView';
13
- import { UnifiedFilesDiff } from '../../utils/fileDiff';
14
- import { enableDiffView } from '../../client/featureFlags';
15
-
16
- interface MessageProps {
17
- id: string;
18
- role: 'user' | 'assistant';
19
- content?: string; // For non-streaming messages
20
- timestamp: number;
21
- events?: StreamingEvent[]; // For streaming messages
22
- isActive?: boolean; // Is this the currently streaming message?
23
- chatId?: string;
24
- showAdditionalWidgets?: boolean;
25
- isStreaming?: boolean;
26
- diffData?: UnifiedFilesDiff;
27
- model?: string; // The LLM model used for this message (assistant only)
28
- }
7
+ import type { MessageProps } from '../props';
29
8
 
30
9
  export const Message = forwardRef<
31
10
  DiffViewRef,
@@ -45,12 +24,13 @@ export const Message = forwardRef<
45
24
  isStreaming = false,
46
25
  diffData,
47
26
  model,
27
+ additionalWidgets,
28
+ handleSendMessage,
29
+ enableDiffView = true,
30
+ onOpenFile,
48
31
  },
49
32
  ref,
50
33
  ) => {
51
- const { additionalWidgets, handleSendMessage } =
52
- useContext(VZCodeContext);
53
-
54
34
  // Memoize date formatting to avoid repeated computation
55
35
  const formattedTime = useMemo(() => {
56
36
  return timestampToDate(timestamp).toLocaleTimeString(
@@ -86,7 +66,11 @@ export const Message = forwardRef<
86
66
  {enableDiffView &&
87
67
  diffData &&
88
68
  Object.keys(diffData).length > 0 && (
89
- <DiffView diffData={diffData} ref={ref} />
69
+ <DiffView
70
+ diffData={diffData}
71
+ ref={ref}
72
+ onOpenFile={onOpenFile}
73
+ />
90
74
  )}
91
75
 
92
76
  {/* Render events in order for streaming messages */}
@@ -1,49 +1,31 @@
1
- import {
2
- useRef,
3
- useEffect,
4
- memo,
5
- useState,
6
- useContext,
7
- } from 'react';
1
+ import { useRef, useEffect, memo, useState } from 'react';
8
2
  import { Message } from './Message';
9
3
  import { TypingIndicator } from './TypingIndicator';
10
4
  import { ThinkingScratchpad } from './ThinkingScratchpad';
11
5
  import { AIEditingStatusIndicator } from './FileEditingIndicator';
12
- import { VizChatMessage } from '@vizhub/viz-types';
13
6
  import { ExtendedVizChatMessage } from '../../types.js';
14
7
  import { DiffViewRef } from './DiffView.js';
15
- import { VZCodeContext } from '../../client/VZCodeContext';
8
+ import type { MessageListProps } from '../props';
16
9
 
17
10
  const MessageListComponent = ({
18
11
  messages,
19
12
  isLoading,
20
- chatId, // Add chatId prop
21
- aiScratchpad, // Add aiScratchpad prop
22
- currentStatus, // Add current status prop
23
- model, // Add model prop
13
+ chatId,
14
+ aiScratchpad,
15
+ currentStatus,
16
+ model,
24
17
  onNewEvent,
25
18
  onJumpToLatest,
26
19
  beforeRender,
27
20
  afterRender,
28
- }: {
29
- messages: VizChatMessage[];
30
- isLoading: boolean;
31
- chatId?: string; // Add chatId to the type
32
- aiScratchpad?: string; // Add aiScratchpad to the type
33
- currentStatus?: string; // Add current status to the type
34
- model?: string; // Add model to the type
35
- onNewEvent: (targetElement?: HTMLElement) => void;
36
- onJumpToLatest: (targetElement?: HTMLElement) => void;
37
- beforeRender: () => number;
38
- afterRender: (prevScrollHeight: number) => void;
39
- }) => {
21
+ additionalWidgets,
22
+ handleSendMessage,
23
+ enableDiffView,
24
+ onOpenFile,
25
+ }: MessageListProps) => {
40
26
  const messagesEndRef = useRef<HTMLDivElement>(null);
41
27
  const diffViewRef = useRef<DiffViewRef>(null);
42
28
 
43
- // Get additional widgets from context
44
- const { additionalWidgets, handleSendMessage } =
45
- useContext(VZCodeContext);
46
-
47
29
  // Track previous loading state to detect when AI generation completes
48
30
  const [prevIsLoading, setPrevIsLoading] =
49
31
  useState(isLoading);
@@ -197,6 +179,10 @@ const MessageListComponent = ({
197
179
  model={
198
180
  msg.role === 'assistant' ? model : undefined
199
181
  }
182
+ additionalWidgets={additionalWidgets}
183
+ handleSendMessage={handleSendMessage}
184
+ enableDiffView={enableDiffView}
185
+ onOpenFile={onOpenFile}
200
186
  ref={
201
187
  isLastMessage && (msg as any).diffData
202
188
  ? diffViewRef
@@ -0,0 +1,37 @@
1
+ .vh-spinner {
2
+ display: flex;
3
+ height: 100%;
4
+ flex-direction: column;
5
+ align-items: center;
6
+ justify-content: center;
7
+ overflow: hidden;
8
+ }
9
+
10
+ /* Fade in after a delay */
11
+ .vh-spinner.fade-in svg {
12
+ animation: 1s linear 0s normal forwards 1
13
+ llm-spinner-fadein;
14
+ }
15
+
16
+ @keyframes llm-spinner-fadein {
17
+ 0% {
18
+ opacity: 0;
19
+ }
20
+ 50% {
21
+ opacity: 0;
22
+ }
23
+ 100% {
24
+ opacity: 1;
25
+ }
26
+ }
27
+
28
+ /* Infinite rotation */
29
+ .vh-spinner-dots {
30
+ animation: llm-spinner-rotate 3s linear infinite;
31
+ }
32
+
33
+ @keyframes llm-spinner-rotate {
34
+ to {
35
+ transform: rotate(360deg);
36
+ }
37
+ }
@@ -0,0 +1,59 @@
1
+ // From https://github.com/vizhub-core/vizhub/commit/6ca078935b9771dc6e05a6065bcfd522a4724dcf
2
+ import { useEffect, useState } from 'react';
3
+ import './Spinner.scss';
4
+
5
+ // Hardcoded dot positions to avoid runtime computation.
6
+ const dots = [
7
+ { x: 40, y: 0, r: 4 },
8
+ { x: 28.28, y: 28.28, r: 4.85 },
9
+ { x: 0, y: 40, r: 5.71 },
10
+ { x: -28.29, y: 28.28, r: 6.57 },
11
+ { x: -40, y: 0, r: 7.42 },
12
+ { x: -28.29, y: -28.29, r: 8.28 },
13
+ { x: -0.01, y: -40, r: 9.14 },
14
+ { x: 28.28, y: -28.29, r: 10 },
15
+ ];
16
+
17
+ export const Spinner = ({
18
+ height = 40,
19
+ fill = 'currentcolor',
20
+ fadeIn = true,
21
+ }: {
22
+ height?: number;
23
+ fill?: string;
24
+ fadeIn?: boolean;
25
+ }) => {
26
+ const [show, setShow] = useState(false);
27
+
28
+ // Avoid SSR of all the SVG elements.
29
+ useEffect(() => {
30
+ setShow(true);
31
+ }, []);
32
+
33
+ return (
34
+ show && (
35
+ <div
36
+ className={`vh-spinner${fadeIn ? ' fade-in' : ''}`}
37
+ >
38
+ <svg
39
+ height={height}
40
+ viewBox="0 0 100 100"
41
+ style={{ opacity: 1 }}
42
+ >
43
+ <g transform="translate(50, 50)" fill={fill}>
44
+ <g className="vh-spinner-dots">
45
+ {dots.map(({ x, y, r }, i) => (
46
+ <circle
47
+ key={i}
48
+ cx={x}
49
+ cy={y}
50
+ r={r}
51
+ ></circle>
52
+ ))}
53
+ </g>
54
+ </g>
55
+ </svg>
56
+ </div>
57
+ )
58
+ );
59
+ };
@@ -0,0 +1,16 @@
1
+ // A central place where the LLM streaming UI imports what it needs from
2
+ // react-bootstrap. This strange-looking way of importing makes it work
3
+ // with Vite's SSR build: otherwise we get
4
+ // `Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import`.
5
+ import Form from 'react-bootstrap/cjs/Form.js';
6
+ import Button from 'react-bootstrap/cjs/Button.js';
7
+ import ButtonGroup from 'react-bootstrap/cjs/ButtonGroup.js';
8
+ import ToggleButton from 'react-bootstrap/cjs/ToggleButton.js';
9
+
10
+ // Pull in custom CSS from vizhub-ui.
11
+ import 'vizhub-ui/dist/vizhub-ui.css';
12
+
13
+ // Pull in Bootstrap Icons CSS.
14
+ import 'bootstrap-icons/font/bootstrap-icons.css';
15
+
16
+ export { Form, Button, ButtonGroup, ToggleButton };
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Self-contained presentational icons used by the LLM streaming UI.
3
+ *
4
+ * These are intentionally duplicated (rather than imported from a host
5
+ * application) so the components stay usable as a standalone library.
6
+ * Hosts can override them via the `icons` prop where supported.
7
+ */
8
+
9
+ export const MicSVG = () => (
10
+ <svg
11
+ fill="#000000"
12
+ height="24"
13
+ width="24"
14
+ stroke="currentColor"
15
+ version="1.1"
16
+ xmlns="http://www.w3.org/2000/svg"
17
+ viewBox="0 0 512 512"
18
+ enableBackground="new 0 0 512 512"
19
+ >
20
+ <g>
21
+ <g>
22
+ <path
23
+ fill="currentColor"
24
+ d="m439.5,236c0-11.3-9.1-20.4-20.4-20.4s-20.4,9.1-20.4,20.4c0,70-64,126.9-142.7,126.9-78.7,0-142.7-56.9-142.7-126.9 0-11.3-9.1-20.4-20.4-20.4s-20.4,9.1-20.4,20.4c0,86.2 71.5,157.4 163.1,166.7v57.5h-23.6c-11.3,0-20.4,9.1-20.4,20.4 0,11.3 9.1,20.4 20.4,20.4h88c11.3,0 20.4-9.1 20.4-20.4 0-11.3-9.1-20.4-20.4-20.4h-23.6v-57.5c91.6-9.3 163.1-80.5 163.1-166.7z"
25
+ />
26
+ <path
27
+ fill="currentColor"
28
+ d="m256,323.5c51,0 92.3-41.3 92.3-92.3v-127.9c0-51-41.3-92.3-92.3-92.3s-92.3,41.3-92.3,92.3v127.9c0,51 41.3,92.3 92.3,92.3zm-52.3-220.2c0-28.8 23.5-52.3 52.3-52.3s52.3,23.5 52.3,52.3v127.9c0,28.8-23.5,52.3-52.3,52.3s-52.3-23.5-52.3-52.3v-127.9z"
29
+ />
30
+ </g>
31
+ </g>
32
+ </svg>
33
+ );
34
+
35
+ export const MicOffSVG = () => (
36
+ <svg
37
+ fill="#000000"
38
+ height="24"
39
+ width="24"
40
+ stroke="currentColor"
41
+ version="1.1"
42
+ xmlns="http://www.w3.org/2000/svg"
43
+ viewBox="0 0 512 512"
44
+ enableBackground="new 0 0 512 512"
45
+ >
46
+ <g>
47
+ <g>
48
+ <path
49
+ fill="currentColor"
50
+ d="m439.5,236c0-11.3-9.1-20.4-20.4-20.4s-20.4,9.1-20.4,20.4c0,70-64,126.9-142.7,126.9-78.7,0-142.7-56.9-142.7-126.9 0-11.3-9.1-20.4-20.4-20.4s-20.4,9.1-20.4,20.4c0,86.2 71.5,157.4 163.1,166.7v57.5h-23.6c-11.3,0-20.4,9.1-20.4,20.4 0,11.3 9.1,20.4 20.4,20.4h88c11.3,0 20.4-9.1 20.4-20.4 0-11.3-9.1-20.4-20.4-20.4h-23.6v-57.5c91.6-9.3 163.1-80.5 163.1-166.7z"
51
+ />
52
+ <path
53
+ fill="currentColor"
54
+ d="m256,323.5c51,0 92.3-41.3 92.3-92.3v-127.9c0-51-41.3-92.3-92.3-92.3s-92.3,41.3-92.3,92.3v127.9c0,51 41.3,92.3 92.3,92.3zm-52.3-220.2c0-28.8 23.5-52.3 52.3-52.3s52.3,23.5 52.3,52.3v127.9c0,28.8-23.5,52.3-52.3,52.3s-52.3-23.5-52.3-52.3v-127.9z"
55
+ />
56
+ <line
57
+ x1="100"
58
+ y1="100"
59
+ x2="412"
60
+ y2="412"
61
+ stroke="currentColor"
62
+ strokeWidth="40"
63
+ strokeLinecap="round"
64
+ />
65
+ </g>
66
+ </g>
67
+ </svg>
68
+ );
@@ -1,15 +1,10 @@
1
- import {
2
- useContext,
3
- useMemo,
4
- useEffect,
5
- useCallback,
6
- } from 'react';
7
- import { VZCodeContext } from '../../client/VZCodeContext';
1
+ import { useMemo, useEffect, useCallback } from 'react';
8
2
  import { MessageList } from './MessageList';
9
3
  import { ChatInput } from './ChatInput';
10
4
  import { ExtendedVizChat } from '../../types.js';
11
- import { useAutoScroll } from '../../client/hooks/useAutoScroll';
5
+ import { useAutoScroll } from '../hooks/useAutoScroll';
12
6
  import { JumpToLatestButton } from './JumpToLatestButton';
7
+ import type { AIChatProps } from '../props';
13
8
  import './styles.scss';
14
9
 
15
10
  const DEBUG = false;
@@ -47,27 +42,30 @@ const ChatList = ({
47
42
  );
48
43
  };
49
44
 
50
- export const AIChat = () => {
51
- const {
52
- aiChatFocused,
53
- content,
54
- aiChatMode,
55
- aiChatMessage,
56
- currentChatId,
57
- selectedChatId,
58
- setSelectedChatId,
59
- aiErrorMessage,
60
- setAIChatMode,
61
- getStoredAIPrompt,
62
- setAIChatMessage,
63
- handleSendMessage,
64
- setAIErrorMessage,
65
- navigateMessageHistoryUp,
66
- navigateMessageHistoryDown,
67
- resetMessageHistoryNavigation,
68
- enableMinimalEditFlow,
69
- } = useContext(VZCodeContext);
70
-
45
+ export const AIChat = ({
46
+ aiChatFocused,
47
+ content,
48
+ aiChatMode,
49
+ aiChatMessage,
50
+ currentChatId,
51
+ selectedChatId,
52
+ setSelectedChatId,
53
+ aiErrorMessage,
54
+ setAIChatMode,
55
+ getStoredAIPrompt,
56
+ setAIChatMessage,
57
+ handleSendMessage,
58
+ setAIErrorMessage,
59
+ navigateMessageHistoryUp,
60
+ navigateMessageHistoryDown,
61
+ resetMessageHistoryNavigation,
62
+ enableMinimalEditFlow = false,
63
+ additionalWidgets,
64
+ enableDiffView = true,
65
+ enableAskMode = false,
66
+ enableVoiceInput = false,
67
+ onOpenFile,
68
+ }: AIChatProps) => {
71
69
  // Use the new simplified auto-scroll hook
72
70
  const {
73
71
  containerRef: messagesContainerRef,
@@ -336,6 +334,10 @@ export const AIChat = () => {
336
334
  onJumpToLatest={onJumpToLatest}
337
335
  beforeRender={beforeRender}
338
336
  afterRender={afterRender}
337
+ additionalWidgets={additionalWidgets}
338
+ handleSendMessage={handleSendMessage}
339
+ enableDiffView={enableDiffView}
340
+ onOpenFile={onOpenFile}
339
341
  />
340
342
  )}
341
343
  {aiErrorMessage && (
@@ -369,9 +371,11 @@ export const AIChat = () => {
369
371
  aiChatMessage={aiChatMessage}
370
372
  setAIChatMessage={setAIChatMessage}
371
373
  onSendMessage={handleSendMessageWithSelection}
372
- focused={aiChatFocused}
374
+ focused={aiChatFocused ?? false}
373
375
  aiChatMode={aiChatMode}
374
376
  setAIChatMode={setAIChatMode}
377
+ enableAskMode={enableAskMode}
378
+ enableVoiceInput={enableVoiceInput}
375
379
  navigateMessageHistoryUp={
376
380
  navigateMessageHistoryUp
377
381
  }