vzcode 3.1.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/CodeEditor/style.scss +18 -11
- package/src/client/RunCodeWidget/index.tsx +1 -0
- package/src/client/TabList/Tab.tsx +13 -5
- package/src/client/TabList/style.scss +32 -5
- package/src/client/VZCodeContext/types.ts +6 -0
- package/src/client/VZCodeContext/useVZCodeState.ts +2 -0
- package/src/client/VZResizer/styles.scss +1 -1
- package/src/client/VZSidebar/AIChatWrapper.tsx +2 -0
- package/src/client/VZSidebar/DeleteConfirmationModal.tsx +1 -1
- package/src/client/VZSidebar/Item.tsx +8 -4
- 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/index.tsx +55 -23
- package/src/client/VZSidebar/styles.scss +426 -6
- package/src/client/WorkspaceConflictBanner.tsx +120 -0
- package/src/client/index.ts +2 -0
- package/src/client/main.jsx +54 -12
- package/src/client/ui.scss +156 -4
- package/src/client/ui.tsx +1 -1
- 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/components/styles.scss +46 -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-5qf102c2.css +0 -1
- package/dist/assets/index-dSJDl5x9.js +0 -356
- 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/server/index.ts
CHANGED
|
@@ -16,7 +16,7 @@ function getPortFromArgs(defaultPort = 3030) {
|
|
|
16
16
|
// Server port.
|
|
17
17
|
const port = getPortFromArgs();
|
|
18
18
|
|
|
19
|
-
const { ready, listen } = createVZCodeServer();
|
|
19
|
+
const { ready, listen, accessToken } = createVZCodeServer();
|
|
20
20
|
|
|
21
21
|
ready.catch((error) => {
|
|
22
22
|
console.error(
|
|
@@ -30,8 +30,7 @@ listen(port).then((actualPort) => {
|
|
|
30
30
|
// variable (for development) or the default port.
|
|
31
31
|
const livePort = process.env.EDITOR_PORT || actualPort;
|
|
32
32
|
console.log(`EDITOR_PORT: ${process.env.EDITOR_PORT}`);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
);
|
|
36
|
-
open(`http://localhost:${livePort}`);
|
|
33
|
+
const accessUrl = `http://localhost:${livePort}/#vzcode-token=${accessToken}`;
|
|
34
|
+
console.log(`Editor is live at ${accessUrl}`);
|
|
35
|
+
open(accessUrl);
|
|
37
36
|
});
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
export class UnsafeWorkspacePathError extends Error {
|
|
5
|
+
constructor(name: string) {
|
|
6
|
+
super('Unsafe workspace path: ' + name);
|
|
7
|
+
this.name = 'UnsafeWorkspacePathError';
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const createWorkspacePathResolver = (
|
|
12
|
+
root: string,
|
|
13
|
+
) => {
|
|
14
|
+
// A symlink in the initial workspace argument is acceptable; all names
|
|
15
|
+
// are validated against the resolved real root thereafter.
|
|
16
|
+
const realRoot = fs.realpathSync(root);
|
|
17
|
+
|
|
18
|
+
const resolve = (name: string): string => {
|
|
19
|
+
if (
|
|
20
|
+
typeof name !== 'string' ||
|
|
21
|
+
name.length === 0 ||
|
|
22
|
+
name.includes('\0') ||
|
|
23
|
+
name.includes('\\') ||
|
|
24
|
+
path.posix.isAbsolute(name) ||
|
|
25
|
+
path.win32.isAbsolute(name) ||
|
|
26
|
+
/^[A-Za-z]:/.test(name)
|
|
27
|
+
) {
|
|
28
|
+
throw new UnsafeWorkspacePathError(String(name));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const withoutTrailingSlash = name.endsWith('/')
|
|
32
|
+
? name.slice(0, -1)
|
|
33
|
+
: name;
|
|
34
|
+
const segments = withoutTrailingSlash.split('/');
|
|
35
|
+
if (
|
|
36
|
+
segments.length === 0 ||
|
|
37
|
+
segments.some(
|
|
38
|
+
(segment) =>
|
|
39
|
+
!segment ||
|
|
40
|
+
segment === '.' ||
|
|
41
|
+
segment === '..' ||
|
|
42
|
+
/[:\x00-\x1f]/.test(segment) ||
|
|
43
|
+
(process.platform === 'win32' &&
|
|
44
|
+
(/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\..*)?$/i.test(
|
|
45
|
+
segment,
|
|
46
|
+
) ||
|
|
47
|
+
/[. ]$/.test(segment))),
|
|
48
|
+
)
|
|
49
|
+
) {
|
|
50
|
+
throw new UnsafeWorkspacePathError(name);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let current = realRoot;
|
|
54
|
+
for (let index = 0; index < segments.length; index++) {
|
|
55
|
+
current = path.join(current, segments[index]);
|
|
56
|
+
// lstat does not follow symlinks. Reject a symlink in any
|
|
57
|
+
// existing parent or the leaf before using filesystem APIs.
|
|
58
|
+
try {
|
|
59
|
+
const stat = fs.lstatSync(current);
|
|
60
|
+
if (
|
|
61
|
+
stat.isSymbolicLink() ||
|
|
62
|
+
(index < segments.length - 1 &&
|
|
63
|
+
!stat.isDirectory())
|
|
64
|
+
) {
|
|
65
|
+
throw new UnsafeWorkspacePathError(name);
|
|
66
|
+
}
|
|
67
|
+
} catch (error: any) {
|
|
68
|
+
if (error?.code !== 'ENOENT') throw error;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return current;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const validateFiles = (files: unknown) => {
|
|
75
|
+
if (
|
|
76
|
+
!files ||
|
|
77
|
+
typeof files !== 'object' ||
|
|
78
|
+
Array.isArray(files)
|
|
79
|
+
) {
|
|
80
|
+
throw new UnsafeWorkspacePathError(
|
|
81
|
+
'invalid file collection',
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
const names = new Set<string>();
|
|
85
|
+
for (const [id, file] of Object.entries(files)) {
|
|
86
|
+
if (
|
|
87
|
+
['__proto__', 'prototype', 'constructor'].includes(
|
|
88
|
+
id,
|
|
89
|
+
)
|
|
90
|
+
) {
|
|
91
|
+
throw new UnsafeWorkspacePathError(
|
|
92
|
+
'unsafe file identifier',
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
if (
|
|
96
|
+
!file ||
|
|
97
|
+
typeof file !== 'object' ||
|
|
98
|
+
Array.isArray(file)
|
|
99
|
+
) {
|
|
100
|
+
throw new UnsafeWorkspacePathError(
|
|
101
|
+
'invalid file entry',
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
const entry = file as {
|
|
105
|
+
name?: unknown;
|
|
106
|
+
text?: unknown;
|
|
107
|
+
};
|
|
108
|
+
if (
|
|
109
|
+
typeof entry.name !== 'string' ||
|
|
110
|
+
(entry.text !== null &&
|
|
111
|
+
typeof entry.text !== 'string')
|
|
112
|
+
) {
|
|
113
|
+
throw new UnsafeWorkspacePathError(
|
|
114
|
+
'invalid file entry',
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
resolve(entry.name);
|
|
118
|
+
if (
|
|
119
|
+
(entry.name.endsWith('/') && entry.text !== null) ||
|
|
120
|
+
(!entry.name.endsWith('/') &&
|
|
121
|
+
typeof entry.text !== 'string')
|
|
122
|
+
) {
|
|
123
|
+
throw new UnsafeWorkspacePathError(entry.name);
|
|
124
|
+
}
|
|
125
|
+
const normalized = entry.name.replace(/\/$/, '');
|
|
126
|
+
if (names.has(normalized)) {
|
|
127
|
+
throw new UnsafeWorkspacePathError(entry.name);
|
|
128
|
+
}
|
|
129
|
+
names.add(normalized);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
// O_NOFOLLOW protects against replacing the leaf with a symlink
|
|
134
|
+
// between validation and opening the file. Parent-directory swaps
|
|
135
|
+
// still require OS-level sandboxing for race-free protection.
|
|
136
|
+
const writeFile = (
|
|
137
|
+
name: string,
|
|
138
|
+
content: string | Buffer,
|
|
139
|
+
) => {
|
|
140
|
+
const destination = resolve(name);
|
|
141
|
+
const flags =
|
|
142
|
+
fs.constants.O_WRONLY |
|
|
143
|
+
fs.constants.O_CREAT |
|
|
144
|
+
fs.constants.O_TRUNC |
|
|
145
|
+
(fs.constants.O_NOFOLLOW ?? 0);
|
|
146
|
+
const fd = fs.openSync(destination, flags, 0o666);
|
|
147
|
+
try {
|
|
148
|
+
fs.writeFileSync(fd, content);
|
|
149
|
+
} finally {
|
|
150
|
+
fs.closeSync(fd);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
return {
|
|
155
|
+
root: realRoot,
|
|
156
|
+
resolve,
|
|
157
|
+
validateFiles,
|
|
158
|
+
writeFile,
|
|
159
|
+
};
|
|
160
|
+
};
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import { computeInitialDocument } from './computeInitialDocument.js';
|
|
3
|
+
import { randomId } from '../randomId.js';
|
|
4
|
+
import { createWorkspacePathResolver } from './workspaceSecurity.js';
|
|
5
|
+
|
|
6
|
+
export type WorkspaceFile = {
|
|
7
|
+
name: string;
|
|
8
|
+
text: string | null;
|
|
9
|
+
};
|
|
10
|
+
export type WorkspaceFiles = Record<string, WorkspaceFile>;
|
|
11
|
+
|
|
12
|
+
export type DiskFile = WorkspaceFile & {
|
|
13
|
+
/** Stable within a filesystem, used to recognize external renames. */
|
|
14
|
+
identity?: string;
|
|
15
|
+
};
|
|
16
|
+
export type DiskFiles = Map<string, DiskFile>;
|
|
17
|
+
|
|
18
|
+
export const sameFile = (
|
|
19
|
+
a: WorkspaceFile | undefined,
|
|
20
|
+
b: WorkspaceFile | undefined,
|
|
21
|
+
): boolean =>
|
|
22
|
+
(!a && !b) ||
|
|
23
|
+
(!!a && !!b && a.name === b.name && a.text === b.text);
|
|
24
|
+
|
|
25
|
+
export const copyFiles = (
|
|
26
|
+
files: WorkspaceFiles,
|
|
27
|
+
): WorkspaceFiles =>
|
|
28
|
+
Object.fromEntries(
|
|
29
|
+
Object.entries(files).map(([id, file]) => [
|
|
30
|
+
id,
|
|
31
|
+
{ name: file.name, text: file.text },
|
|
32
|
+
]),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const diskFile = (entry: DiskFile): WorkspaceFile => ({
|
|
36
|
+
name: entry.name,
|
|
37
|
+
text: entry.text,
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Use the same ignore rules and symlink exclusions as initial startup.
|
|
42
|
+
* The repeated scan is also a portable fallback for nested directories on
|
|
43
|
+
* platforms without recursive fs.watch support.
|
|
44
|
+
*/
|
|
45
|
+
export const readWorkspaceDisk = (
|
|
46
|
+
root: string,
|
|
47
|
+
): DiskFiles => {
|
|
48
|
+
const workspace = createWorkspacePathResolver(root);
|
|
49
|
+
const snapshot = computeInitialDocument({
|
|
50
|
+
fullPath: workspace.root,
|
|
51
|
+
});
|
|
52
|
+
const files: DiskFiles = new Map();
|
|
53
|
+
for (const file of Object.values(
|
|
54
|
+
snapshot.files,
|
|
55
|
+
) as WorkspaceFile[]) {
|
|
56
|
+
const stat = fs.lstatSync(workspace.resolve(file.name));
|
|
57
|
+
if (stat.isSymbolicLink()) continue;
|
|
58
|
+
const identity =
|
|
59
|
+
stat.ino > 0
|
|
60
|
+
? String(stat.dev) + ':' + String(stat.ino)
|
|
61
|
+
: undefined;
|
|
62
|
+
files.set(file.name, {
|
|
63
|
+
name: file.name,
|
|
64
|
+
text: file.text,
|
|
65
|
+
identity,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return files;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** Check content and paths, rather than timestamps that can be coarse. */
|
|
72
|
+
export const diskMatchesBaseline = (
|
|
73
|
+
baseline: WorkspaceFiles,
|
|
74
|
+
disk: DiskFiles,
|
|
75
|
+
): boolean => {
|
|
76
|
+
if (Object.keys(baseline).length !== disk.size) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
for (const file of Object.values(baseline)) {
|
|
80
|
+
const onDisk = disk.get(file.name);
|
|
81
|
+
if (!onDisk || !sameFile(file, onDisk)) return false;
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export type Reconciliation = {
|
|
87
|
+
files: WorkspaceFiles;
|
|
88
|
+
baseline: WorkspaceFiles;
|
|
89
|
+
identities: Record<string, string | undefined>;
|
|
90
|
+
conflicts: string[];
|
|
91
|
+
changed: boolean;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Three-way merge: previous saved disk state, live collaborative document,
|
|
96
|
+
* and the new filesystem snapshot. Only apply an external change when the
|
|
97
|
+
* matching editor entry has not changed locally. Conflicts stay unsaved.
|
|
98
|
+
* The caller must publish files+conflicts as ONE OT change.
|
|
99
|
+
*/
|
|
100
|
+
export const reconcileDisk = ({
|
|
101
|
+
baseline,
|
|
102
|
+
current,
|
|
103
|
+
disk,
|
|
104
|
+
identities,
|
|
105
|
+
makeId = randomId,
|
|
106
|
+
}: {
|
|
107
|
+
baseline: WorkspaceFiles;
|
|
108
|
+
current: WorkspaceFiles;
|
|
109
|
+
disk: DiskFiles;
|
|
110
|
+
identities: Record<string, string | undefined>;
|
|
111
|
+
makeId?: () => string;
|
|
112
|
+
}): Reconciliation => {
|
|
113
|
+
const files = copyFiles(current);
|
|
114
|
+
const nextBaseline = copyFiles(baseline);
|
|
115
|
+
const nextIdentities = { ...identities };
|
|
116
|
+
const conflicts = new Set<string>();
|
|
117
|
+
const unclaimed = new Set(disk.keys());
|
|
118
|
+
|
|
119
|
+
const byIdentity = new Map<string, DiskFile[]>();
|
|
120
|
+
for (const file of disk.values()) {
|
|
121
|
+
if (!file.identity) continue;
|
|
122
|
+
const matches = byIdentity.get(file.identity) ?? [];
|
|
123
|
+
matches.push(file);
|
|
124
|
+
byIdentity.set(file.identity, matches);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
for (const [id, saved] of Object.entries(baseline)) {
|
|
128
|
+
let observed = disk.get(saved.name);
|
|
129
|
+
// Only recognize a rename by an unambiguous filesystem identity.
|
|
130
|
+
if (!observed && identities[id]) {
|
|
131
|
+
const matches = (
|
|
132
|
+
byIdentity.get(identities[id]) ?? []
|
|
133
|
+
).filter((file) => unclaimed.has(file.name));
|
|
134
|
+
if (matches.length === 1) observed = matches[0];
|
|
135
|
+
}
|
|
136
|
+
if (observed) unclaimed.delete(observed.name);
|
|
137
|
+
const remoteChanged = !sameFile(saved, observed);
|
|
138
|
+
const localChanged = !sameFile(saved, current[id]);
|
|
139
|
+
|
|
140
|
+
if (
|
|
141
|
+
remoteChanged &&
|
|
142
|
+
localChanged &&
|
|
143
|
+
!sameFile(current[id], observed)
|
|
144
|
+
) {
|
|
145
|
+
conflicts.add(saved.name);
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (remoteChanged) {
|
|
149
|
+
if (observed) {
|
|
150
|
+
files[id] = diskFile(observed);
|
|
151
|
+
nextBaseline[id] = diskFile(observed);
|
|
152
|
+
nextIdentities[id] = observed.identity;
|
|
153
|
+
} else {
|
|
154
|
+
delete files[id];
|
|
155
|
+
delete nextBaseline[id];
|
|
156
|
+
delete nextIdentities[id];
|
|
157
|
+
}
|
|
158
|
+
} else if (observed) {
|
|
159
|
+
nextIdentities[id] = observed.identity;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// New disk entries are imported, while simultaneous creation of a
|
|
164
|
+
// same-name file in the editor is treated as a conflict.
|
|
165
|
+
for (const name of unclaimed) {
|
|
166
|
+
const observed = disk.get(name)!;
|
|
167
|
+
const editorEntry = Object.entries(files).find(
|
|
168
|
+
([, file]) => file.name === name,
|
|
169
|
+
);
|
|
170
|
+
if (editorEntry) {
|
|
171
|
+
const [id, editorFile] = editorEntry;
|
|
172
|
+
if (!baseline[id] && sameFile(editorFile, observed)) {
|
|
173
|
+
nextBaseline[id] = diskFile(observed);
|
|
174
|
+
nextIdentities[id] = observed.identity;
|
|
175
|
+
} else {
|
|
176
|
+
conflicts.add(name);
|
|
177
|
+
}
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
let id = makeId();
|
|
181
|
+
while (files[id] || nextBaseline[id]) {
|
|
182
|
+
id = makeId();
|
|
183
|
+
}
|
|
184
|
+
files[id] = diskFile(observed);
|
|
185
|
+
nextBaseline[id] = diskFile(observed);
|
|
186
|
+
nextIdentities[id] = observed.identity;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const changed =
|
|
190
|
+
Object.keys(files).length !==
|
|
191
|
+
Object.keys(current).length ||
|
|
192
|
+
Object.entries(files).some(
|
|
193
|
+
([id, file]) => !sameFile(file, current[id]),
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
files,
|
|
198
|
+
baseline: nextBaseline,
|
|
199
|
+
identities: nextIdentities,
|
|
200
|
+
conflicts: Array.from(conflicts).sort(),
|
|
201
|
+
changed,
|
|
202
|
+
};
|
|
203
|
+
};
|
package/src/types.ts
CHANGED
|
@@ -46,9 +46,7 @@ export type SearchMatch = Array<{
|
|
|
46
46
|
text: string;
|
|
47
47
|
}>;
|
|
48
48
|
export type SearchFileVisibility =
|
|
49
|
-
| '
|
|
50
|
-
| 'flattened'
|
|
51
|
-
| 'closed';
|
|
49
|
+
'open' | 'flattened' | 'closed';
|
|
52
50
|
export type SearchResult = { [id: string]: SearchFile };
|
|
53
51
|
|
|
54
52
|
export interface SearchFile {
|
|
@@ -199,28 +197,34 @@ export type SubmitOperation = (
|
|
|
199
197
|
) => void;
|
|
200
198
|
|
|
201
199
|
// A value that has the capacity to be changed in the visual editor
|
|
200
|
+
export type VisualEditorWidgetMetadata = {
|
|
201
|
+
property: string;
|
|
202
|
+
label: string;
|
|
203
|
+
/** Display grouping; old configs default to Appearance. */
|
|
204
|
+
section?: string;
|
|
205
|
+
/** Supporting help beneath a property control. */
|
|
206
|
+
description?: string;
|
|
207
|
+
/** Display-only suffix for numeric widgets, e.g. px or %. */
|
|
208
|
+
unit?: string;
|
|
209
|
+
/** Optional reset target; type must match the actual property. */
|
|
210
|
+
defaultValue?: string | number | boolean;
|
|
211
|
+
};
|
|
212
|
+
|
|
202
213
|
export type VisualEditorConfigEntry =
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
type: '
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
| {
|
|
218
|
-
type: 'dropdown';
|
|
219
|
-
property: string;
|
|
220
|
-
label: string;
|
|
221
|
-
options: string[];
|
|
222
|
-
}
|
|
223
|
-
| { type: 'color'; property: string; label: string };
|
|
214
|
+
VisualEditorWidgetMetadata &
|
|
215
|
+
(
|
|
216
|
+
| {
|
|
217
|
+
type: 'slider';
|
|
218
|
+
min: number;
|
|
219
|
+
max: number;
|
|
220
|
+
step?: number;
|
|
221
|
+
}
|
|
222
|
+
| { type: 'checkbox' }
|
|
223
|
+
| { type: 'textInput' }
|
|
224
|
+
| { type: 'dropdown'; options: string[] }
|
|
225
|
+
| { type: 'color' }
|
|
226
|
+
| { type: 'segmented'; options: string[] }
|
|
227
|
+
);
|
|
224
228
|
|
|
225
229
|
// ============================================================================
|
|
226
230
|
// AI Chat Streaming Types
|
|
@@ -308,9 +312,7 @@ export interface StreamingChatMessage {
|
|
|
308
312
|
|
|
309
313
|
/** Embedding hosts can choose which sidebar VZCode opens initially. */
|
|
310
314
|
export type VZInitialSidebarView =
|
|
311
|
-
|
|
312
|
-
| 'files'
|
|
313
|
-
| 'visual';
|
|
315
|
+
'ai-chat' | 'files' | 'visual';
|
|
314
316
|
|
|
315
317
|
/** Reason a visualization cannot yet render visual-editor controls. */
|
|
316
318
|
export type VisualEditorEmptyReason =
|
|
Binary file
|