vzcode 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/README.md +185 -40
- package/dist/assets/App-C9mRI7eH.js +387 -0
- package/dist/assets/App-CxiKy3Rs.css +1 -0
- package/dist/assets/bindings_wasm_bg-IWNG_AjZ.wasm +0 -0
- package/dist/assets/buildWorker-N5tFTOqM.js +794 -0
- package/dist/assets/index-COLyIkCc.js +43 -0
- package/dist/assets/index-CZT-v4sH.css +1 -0
- package/dist/assets/rolldown-runtime-COiEfhsA.js +1 -0
- package/dist/assets/worker-BpV7Ustv.js +223 -0
- package/dist/assets/worker-CLeezw6h.js +458 -0
- package/dist/assets/worker-DaSIYBQX.js +327 -0
- package/dist/cli.js +170 -99
- package/dist/index.html +3 -2
- package/dist/server/accessControl.js +104 -0
- package/dist/server/computeInitialDocument.js +4 -1
- package/dist/server/createServer.js +356 -104
- package/dist/server/index.js +4 -3
- package/dist/server/workspaceSecurity.js +115 -0
- package/dist/server/workspaceSync.js +141 -0
- package/package.json +74 -72
- package/src/cli.ts +203 -182
- package/src/client/App/index.tsx +2 -0
- package/src/client/App/usePending.ts +3 -1
- package/src/client/RunCodeWidget/index.tsx +1 -0
- package/src/client/VZCodeContext/types.ts +6 -0
- package/src/client/VZCodeContext/useVZCodeState.ts +2 -0
- package/src/client/VZSidebar/AIChatWrapper.tsx +2 -0
- package/src/client/VZSidebar/VisualEditor/CheckboxWidget.tsx +22 -30
- package/src/client/VZSidebar/VisualEditor/ColorWidget.tsx +198 -126
- package/src/client/VZSidebar/VisualEditor/DropdownWidget.tsx +25 -67
- package/src/client/VZSidebar/VisualEditor/PropertySection.tsx +41 -0
- package/src/client/VZSidebar/VisualEditor/SegmentedWidget.tsx +34 -0
- package/src/client/VZSidebar/VisualEditor/SliderWidget.tsx +60 -12
- package/src/client/VZSidebar/VisualEditor/VisualEditor.tsx +31 -393
- package/src/client/VZSidebar/VisualEditor/VisualEditorControls.tsx +478 -0
- package/src/client/VZSidebar/VisualEditor/colorUtils.ts +12 -0
- package/src/client/VZSidebar/VisualEditor/status.ts +47 -0
- package/src/client/VZSidebar/VisualEditor/updateConfig.ts +51 -24
- package/src/client/VZSidebar/VisualEditor/utils.ts +1 -1
- package/src/client/VZSidebar/styles.scss +420 -0
- package/src/client/WorkspaceConflictBanner.tsx +120 -0
- package/src/client/index.ts +2 -0
- package/src/client/main.jsx +54 -12
- package/src/llm-streaming-server/README.md +4 -16
- package/src/llm-streaming-ui/README.md +41 -2
- package/src/llm-streaming-ui/components/ChatInput.tsx +65 -13
- package/src/llm-streaming-ui/components/index.tsx +2 -0
- package/src/llm-streaming-ui/hooks/useAutoScroll.ts +1 -1
- package/src/llm-streaming-ui/index.ts +1 -0
- package/src/llm-streaming-ui/props.ts +26 -2
- package/src/server/accessControl.ts +151 -0
- package/src/server/computeInitialDocument.ts +6 -2
- package/src/server/createServer.ts +487 -138
- package/src/server/index.ts +4 -5
- package/src/server/workspaceSecurity.ts +160 -0
- package/src/server/workspaceSync.ts +203 -0
- package/src/types.ts +29 -27
- package/dist/assets/bindings_wasm_bg-9w8E-TmY.wasm +0 -0
- package/dist/assets/buildWorker-BZlya278.js +0 -687
- package/dist/assets/index-B7NRhsN6.js +0 -356
- package/dist/assets/index-D1V1AKed.css +0 -1
- package/dist/assets/worker-1oQYaz-F.js +0 -342
- package/dist/assets/worker-BfgPD8zR.js +0 -125
- package/dist/assets/worker-CoJaqtpi.js +0 -436
package/src/cli.ts
CHANGED
|
@@ -1,205 +1,226 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { spawn } from 'child_process';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
'
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
'vzcode',
|
|
61
|
-
),
|
|
62
|
-
path.join(
|
|
63
|
-
__dirname,
|
|
64
|
-
'..',
|
|
65
|
-
'src-tauri',
|
|
66
|
-
'target',
|
|
67
|
-
'release',
|
|
68
|
-
'vzcode.app',
|
|
69
|
-
'Contents',
|
|
70
|
-
'MacOS',
|
|
71
|
-
'vzcode',
|
|
72
|
-
),
|
|
73
|
-
];
|
|
3
|
+
import { spawn } from 'node:child_process';
|
|
4
|
+
import fs from 'node:fs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import open from 'open';
|
|
8
|
+
import { createVZCodeServer } from './server/createServer.js';
|
|
9
|
+
|
|
10
|
+
const DEFAULT_PORT = 3030;
|
|
11
|
+
const HOST = '127.0.0.1';
|
|
12
|
+
const __dirname = path.dirname(
|
|
13
|
+
fileURLToPath(import.meta.url),
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
type CLIOptions = {
|
|
17
|
+
directory: string;
|
|
18
|
+
port: number;
|
|
19
|
+
openBrowser: boolean;
|
|
20
|
+
desktop: boolean;
|
|
21
|
+
help: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const usage = [
|
|
25
|
+
'VZCode - Multiplayer Code Editor',
|
|
26
|
+
'',
|
|
27
|
+
'Usage: vzcode [directory] [options]',
|
|
28
|
+
'',
|
|
29
|
+
'Starts the browser editor for a local workspace (defaults to ".").',
|
|
30
|
+
'',
|
|
31
|
+
'Options:',
|
|
32
|
+
' --help, -h Show this help message',
|
|
33
|
+
' --browser Use the browser editor (the default)',
|
|
34
|
+
' --desktop Launch a locally built Tauri application (experimental)',
|
|
35
|
+
' --no-open Start the server without opening a browser',
|
|
36
|
+
' --port=<port> HTTP/WebSocket port (default: 3030)',
|
|
37
|
+
' --port <port> Equivalent to --port=<port>',
|
|
38
|
+
'',
|
|
39
|
+
'Examples:',
|
|
40
|
+
' vzcode .',
|
|
41
|
+
' vzcode ./my-project --port=4000',
|
|
42
|
+
' vzcode --no-open',
|
|
43
|
+
'',
|
|
44
|
+
'VZCode listens on 127.0.0.1 only. Do not expose its unauthenticated',
|
|
45
|
+
'workspace editing server to untrusted networks.',
|
|
46
|
+
].join('\n');
|
|
47
|
+
|
|
48
|
+
function parsePort(value: string): number {
|
|
49
|
+
if (!/^\d+$/.test(value)) {
|
|
50
|
+
throw new Error('Invalid port: ' + value);
|
|
51
|
+
}
|
|
52
|
+
const port = Number(value);
|
|
53
|
+
if (!Number.isSafeInteger(port) || port > 65535) {
|
|
54
|
+
throw new Error(
|
|
55
|
+
'Port must be between 0 and 65535: ' + value,
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return port;
|
|
59
|
+
}
|
|
74
60
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
61
|
+
function parseOptions(args: string[]): CLIOptions {
|
|
62
|
+
const options: CLIOptions = {
|
|
63
|
+
directory: '.',
|
|
64
|
+
port: DEFAULT_PORT,
|
|
65
|
+
openBrowser: true,
|
|
66
|
+
desktop: false,
|
|
67
|
+
help: false,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
let hasDirectory = false;
|
|
71
|
+
for (let i = 0; i < args.length; i++) {
|
|
72
|
+
const arg = args[i];
|
|
73
|
+
|
|
74
|
+
if (arg === '--help' || arg === '-h') {
|
|
75
|
+
options.help = true;
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (arg === '--browser') {
|
|
79
|
+
continue;
|
|
78
80
|
}
|
|
81
|
+
if (arg === '--desktop') {
|
|
82
|
+
options.desktop = true;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (arg === '--no-open') {
|
|
86
|
+
options.openBrowser = false;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (arg === '--port' || arg.startsWith('--port=')) {
|
|
90
|
+
const value =
|
|
91
|
+
arg === '--port'
|
|
92
|
+
? args[++i]
|
|
93
|
+
: arg.slice('--port='.length);
|
|
94
|
+
if (value === undefined) {
|
|
95
|
+
throw new Error('Missing value for --port');
|
|
96
|
+
}
|
|
97
|
+
options.port = parsePort(value);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (arg.startsWith('-')) {
|
|
101
|
+
throw new Error('Unknown option: ' + arg);
|
|
102
|
+
}
|
|
103
|
+
if (hasDirectory) {
|
|
104
|
+
throw new Error(
|
|
105
|
+
'Provide at most one workspace directory',
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
options.directory = arg;
|
|
109
|
+
hasDirectory = true;
|
|
79
110
|
}
|
|
80
111
|
|
|
81
|
-
return
|
|
112
|
+
return options;
|
|
82
113
|
}
|
|
83
114
|
|
|
84
|
-
//
|
|
85
|
-
|
|
86
|
-
|
|
115
|
+
// The npm package intentionally does not include a desktop executable.
|
|
116
|
+
// This path is available only after building Tauri in a source checkout.
|
|
117
|
+
function findDesktopApp(): string | null {
|
|
118
|
+
const root = path.resolve(__dirname, '..');
|
|
119
|
+
const candidates = [
|
|
120
|
+
'src-tauri/target/debug/vzcode',
|
|
121
|
+
'src-tauri/target/debug/vzcode.exe',
|
|
122
|
+
'src-tauri/target/release/vzcode',
|
|
123
|
+
'src-tauri/target/release/vzcode.exe',
|
|
124
|
+
'src-tauri/target/debug/vzcode.app/Contents/MacOS/vzcode',
|
|
125
|
+
'src-tauri/target/release/vzcode.app/Contents/MacOS/vzcode',
|
|
126
|
+
];
|
|
127
|
+
return (
|
|
128
|
+
candidates
|
|
129
|
+
.map((candidate) => path.join(root, candidate))
|
|
130
|
+
.find((candidate) => fs.existsSync(candidate)) ?? null
|
|
131
|
+
);
|
|
132
|
+
}
|
|
87
133
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
);
|
|
92
|
-
console.error(
|
|
93
|
-
'Falling back to launching browser version...',
|
|
94
|
-
);
|
|
95
|
-
launchBrowserVersion(workingDirectory);
|
|
134
|
+
async function main(): Promise<void> {
|
|
135
|
+
const options = parseOptions(process.argv.slice(2));
|
|
136
|
+
if (options.help) {
|
|
137
|
+
console.log(usage);
|
|
96
138
|
return;
|
|
97
139
|
}
|
|
98
140
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const child = spawn(tauriBinary, [], {
|
|
109
|
-
cwd: workingDirectory,
|
|
110
|
-
stdio: 'inherit',
|
|
111
|
-
detached: true,
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
// Allow the parent process to exit while keeping the child running
|
|
115
|
-
child.unref();
|
|
116
|
-
}, 2000);
|
|
117
|
-
}
|
|
141
|
+
const directory = path.resolve(options.directory);
|
|
142
|
+
if (
|
|
143
|
+
!fs.existsSync(directory) ||
|
|
144
|
+
!fs.statSync(directory).isDirectory()
|
|
145
|
+
) {
|
|
146
|
+
throw new Error(
|
|
147
|
+
'Workspace is not a directory: ' + directory,
|
|
148
|
+
);
|
|
149
|
+
}
|
|
118
150
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
'index.js',
|
|
128
|
-
);
|
|
129
|
-
const serverChild = spawn('node', [serverPath], {
|
|
130
|
-
cwd: workingDirectory,
|
|
131
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
132
|
-
detached: true,
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
// Don't block on the server process
|
|
136
|
-
serverChild.unref();
|
|
137
|
-
|
|
138
|
-
// Log server output for debugging
|
|
139
|
-
if (serverChild.stdout) {
|
|
140
|
-
serverChild.stdout.on('data', (data) => {
|
|
141
|
-
console.log('Server:', data.toString());
|
|
142
|
-
});
|
|
151
|
+
const desktopBinary = options.desktop
|
|
152
|
+
? findDesktopApp()
|
|
153
|
+
: null;
|
|
154
|
+
if (options.desktop && !desktopBinary) {
|
|
155
|
+
throw new Error(
|
|
156
|
+
'Tauri application not found. Build it with npm run tauri:build, ' +
|
|
157
|
+
'or omit --desktop to use the browser editor.',
|
|
158
|
+
);
|
|
143
159
|
}
|
|
144
160
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
161
|
+
const server = createVZCodeServer({ cwd: directory });
|
|
162
|
+
await server.ready;
|
|
163
|
+
let actualPort: number;
|
|
164
|
+
try {
|
|
165
|
+
// Local-only until authenticated remote collaboration exists.
|
|
166
|
+
actualPort = await server.listen(options.port, HOST);
|
|
167
|
+
} catch (error) {
|
|
168
|
+
await server.close();
|
|
169
|
+
throw error;
|
|
149
170
|
}
|
|
150
|
-
}
|
|
151
171
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
// and we're already in the correct working directory
|
|
172
|
+
const url = 'http://' + HOST + ':' + actualPort;
|
|
173
|
+
console.log('Workspace: ' + directory);
|
|
174
|
+
const accessUrl =
|
|
175
|
+
url + '/#vzcode-token=' + server.accessToken;
|
|
176
|
+
console.log('Editor is live at ' + accessUrl);
|
|
158
177
|
console.log(
|
|
159
|
-
|
|
178
|
+
'Keep this private link secret; it grants workspace editing access.',
|
|
160
179
|
);
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
console.log(' --help, -h Show this help message');
|
|
177
|
-
console.log(
|
|
178
|
-
' --browser Force browser version instead of desktop app',
|
|
179
|
-
);
|
|
180
|
-
console.log(
|
|
181
|
-
' --port=<port> Specify port for server (default: 3030)',
|
|
182
|
-
);
|
|
183
|
-
console.log('');
|
|
184
|
-
console.log('Examples:');
|
|
185
|
-
console.log(
|
|
186
|
-
' vzcode # Launch desktop app in current directory',
|
|
187
|
-
);
|
|
188
|
-
console.log(
|
|
189
|
-
' vzcode --browser # Launch browser version',
|
|
190
|
-
);
|
|
191
|
-
console.log(
|
|
192
|
-
' vzcode --port=4000 # Start server on port 4000',
|
|
193
|
-
);
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
180
|
+
console.log('Press Ctrl+C to stop VZCode.');
|
|
181
|
+
|
|
182
|
+
let closing = false;
|
|
183
|
+
const shutdown = async () => {
|
|
184
|
+
if (closing) return;
|
|
185
|
+
closing = true;
|
|
186
|
+
try {
|
|
187
|
+
await server.close();
|
|
188
|
+
} catch (error) {
|
|
189
|
+
console.error('Failed to stop VZCode:', error);
|
|
190
|
+
process.exitCode = 1;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
process.once('SIGINT', () => void shutdown());
|
|
194
|
+
process.once('SIGTERM', () => void shutdown());
|
|
196
195
|
|
|
197
|
-
if (
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
196
|
+
if (desktopBinary) {
|
|
197
|
+
const child = spawn(desktopBinary, [], {
|
|
198
|
+
cwd: directory,
|
|
199
|
+
stdio: 'inherit',
|
|
200
|
+
});
|
|
201
|
+
child.once('error', (error) => {
|
|
202
|
+
console.error(
|
|
203
|
+
'Unable to launch the desktop app:',
|
|
204
|
+
error,
|
|
205
|
+
);
|
|
206
|
+
process.exitCode = 1;
|
|
207
|
+
void shutdown();
|
|
208
|
+
});
|
|
209
|
+
child.once('exit', () => void shutdown());
|
|
210
|
+
} else if (options.openBrowser) {
|
|
211
|
+
try {
|
|
212
|
+
await open(accessUrl);
|
|
213
|
+
} catch (error) {
|
|
214
|
+
console.warn(
|
|
215
|
+
'Could not open a browser automatically. Visit ' +
|
|
216
|
+
url,
|
|
217
|
+
error,
|
|
218
|
+
);
|
|
219
|
+
}
|
|
201
220
|
}
|
|
202
221
|
}
|
|
203
222
|
|
|
204
|
-
|
|
205
|
-
|
|
223
|
+
main().catch((error) => {
|
|
224
|
+
console.error('VZCode: ' + (error.message ?? error));
|
|
225
|
+
process.exitCode = 1;
|
|
226
|
+
});
|
package/src/client/App/index.tsx
CHANGED
|
@@ -19,6 +19,7 @@ import { VZLeft } from '../VZLeft';
|
|
|
19
19
|
import { VZMiddle } from '../VZMiddle';
|
|
20
20
|
import { VZResizer } from '../VZResizer';
|
|
21
21
|
import { VZRight } from '../VZRight';
|
|
22
|
+
import { WorkspaceConflictBanner } from '../WorkspaceConflictBanner';
|
|
22
23
|
import {
|
|
23
24
|
useInitialUsername,
|
|
24
25
|
usePersistUsername,
|
|
@@ -111,6 +112,7 @@ function App() {
|
|
|
111
112
|
// only mounted when explicitly enabled.
|
|
112
113
|
const appContent = (
|
|
113
114
|
<>
|
|
115
|
+
<WorkspaceConflictBanner />
|
|
114
116
|
<div className="app">
|
|
115
117
|
<VZLeft />
|
|
116
118
|
<VZMiddle
|
|
@@ -14,7 +14,9 @@ const runDelay = 1000;
|
|
|
14
14
|
export const usePending = (
|
|
15
15
|
shareDBDoc: ShareDBDoc<VizContent>,
|
|
16
16
|
) => {
|
|
17
|
-
const lastOpTimerRef = useRef<NodeJS.Timeout>(
|
|
17
|
+
const lastOpTimerRef = useRef<NodeJS.Timeout | undefined>(
|
|
18
|
+
undefined,
|
|
19
|
+
);
|
|
18
20
|
|
|
19
21
|
// TODO rename this to isPending,
|
|
20
22
|
// and also rename connected to isConnected.
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from '../../types';
|
|
16
16
|
import { VizFiles, VizContent } from '@vizhub/viz-types';
|
|
17
17
|
import { ThemeLabel } from '../themes';
|
|
18
|
+
import type { ChatVoiceInputRenderer } from '../../llm-streaming-ui/props';
|
|
18
19
|
import { EditorCache } from '../useEditorCache';
|
|
19
20
|
|
|
20
21
|
// The type of the object provided by this context.
|
|
@@ -213,6 +214,9 @@ export type VZCodeContextValue = {
|
|
|
213
214
|
) => Promise<any>;
|
|
214
215
|
}) => React.ReactNode;
|
|
215
216
|
|
|
217
|
+
/** Optional host-owned microphone beside the AI Chat Send button. */
|
|
218
|
+
renderChatVoiceInput?: ChatVoiceInputRenderer;
|
|
219
|
+
|
|
216
220
|
// Feature flags
|
|
217
221
|
enableMinimalEditFlow: boolean;
|
|
218
222
|
|
|
@@ -268,6 +272,8 @@ export interface VZCodeProviderProps {
|
|
|
268
272
|
options?: Record<string, string>,
|
|
269
273
|
) => Promise<any>;
|
|
270
274
|
}) => React.ReactNode;
|
|
275
|
+
/** Host-owned chat voice input, independent of the legacy VZCode voice flag. */
|
|
276
|
+
renderChatVoiceInput?: ChatVoiceInputRenderer;
|
|
271
277
|
iframeRef?: React.MutableRefObject<HTMLIFrameElement>;
|
|
272
278
|
handleChatError?: (
|
|
273
279
|
error: string,
|
|
@@ -53,6 +53,7 @@ export const useVZCodeState = ({
|
|
|
53
53
|
clearStoredAIPrompt,
|
|
54
54
|
getStoredAIPrompt,
|
|
55
55
|
additionalWidgets,
|
|
56
|
+
renderChatVoiceInput,
|
|
56
57
|
iframeRef: externalIframeRef,
|
|
57
58
|
handleChatError,
|
|
58
59
|
onAIChatMessageSubmitted,
|
|
@@ -510,6 +511,7 @@ export const useVZCodeState = ({
|
|
|
510
511
|
|
|
511
512
|
// Additional widgets that can be rendered in AI chat messages
|
|
512
513
|
additionalWidgets,
|
|
514
|
+
renderChatVoiceInput,
|
|
513
515
|
|
|
514
516
|
// Feature flags
|
|
515
517
|
enableMinimalEditFlow,
|
|
@@ -35,6 +35,7 @@ export const AIChatWrapper = () => {
|
|
|
35
35
|
resetMessageHistoryNavigation,
|
|
36
36
|
enableMinimalEditFlow,
|
|
37
37
|
additionalWidgets,
|
|
38
|
+
renderChatVoiceInput,
|
|
38
39
|
openTab,
|
|
39
40
|
setIsAIChatOpen,
|
|
40
41
|
} = useContext(VZCodeContext);
|
|
@@ -79,6 +80,7 @@ export const AIChatWrapper = () => {
|
|
|
79
80
|
enableDiffView={enableDiffView}
|
|
80
81
|
enableAskMode={enableAskMode}
|
|
81
82
|
enableVoiceInput={enableVoiceInput}
|
|
83
|
+
renderChatVoiceInput={renderChatVoiceInput}
|
|
82
84
|
enableMinimalEditFlow={enableMinimalEditFlow}
|
|
83
85
|
/>
|
|
84
86
|
);
|
|
@@ -11,36 +11,28 @@ interface CheckboxWidgetProps {
|
|
|
11
11
|
|
|
12
12
|
export const CheckboxWidget: React.FC<
|
|
13
13
|
CheckboxWidgetProps
|
|
14
|
-
> = ({ property, label, currentValue, onChange }) =>
|
|
15
|
-
|
|
16
|
-
<div className="
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
onChange={onChange}
|
|
14
|
+
> = ({ property, label, currentValue, onChange }) => (
|
|
15
|
+
<div className="visual-editor-checkbox">
|
|
16
|
+
<div className="checkbox-header">
|
|
17
|
+
<label htmlFor={property} className="checkbox-label">
|
|
18
|
+
{label}
|
|
19
|
+
</label>
|
|
20
|
+
</div>
|
|
21
|
+
<div className="checkbox-container">
|
|
22
|
+
<input
|
|
23
|
+
type="checkbox"
|
|
24
|
+
id={property}
|
|
25
|
+
className="checkbox-input"
|
|
26
|
+
role="switch"
|
|
27
|
+
aria-checked={currentValue}
|
|
28
|
+
checked={currentValue}
|
|
29
|
+
onChange={onChange}
|
|
30
|
+
/>
|
|
31
|
+
<div className="checkbox-visual" aria-hidden="true">
|
|
32
|
+
<div
|
|
33
|
+
className={`checkbox-indicator ${currentValue ? 'checked' : ''}`}
|
|
35
34
|
/>
|
|
36
|
-
<div className="checkbox-visual">
|
|
37
|
-
<div
|
|
38
|
-
className={`checkbox-indicator ${
|
|
39
|
-
currentValue ? 'checked' : ''
|
|
40
|
-
}`}
|
|
41
|
-
/>
|
|
42
|
-
</div>
|
|
43
35
|
</div>
|
|
44
36
|
</div>
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
</div>
|
|
38
|
+
);
|