vzcode 3.2.0 → 3.4.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-BSFvLn9Z.js +387 -0
- package/dist/assets/App-DbKY-mb6.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-Acvr-XWK.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/SplitPaneResizeContext.tsx +94 -11
- package/src/client/VZCodeContext/types.ts +6 -0
- package/src/client/VZCodeContext/useVZCodeState.ts +2 -0
- package/src/client/VZResizer/index.tsx +25 -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 +424 -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/components/styles.scss +14 -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/README.md
CHANGED
|
@@ -4,43 +4,93 @@ VZCode offers a multiplayer code editing environment that caters to a real-time
|
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
|
+
## Documentation map
|
|
8
|
+
|
|
9
|
+
- **Getting started:** [Usage](#usage) and [Development](#development) below. The `package.json` scripts provide `npm run dev`, `npm run test-interactive`, `npm test`, `npm run typecheck`, and `npm run lint`.
|
|
10
|
+
- **Using the editor in other applications:** [Embedding the Visual Editor](#embedding-the-visual-editor-in-a-host-application).
|
|
11
|
+
- **Contributing:** [CONTRIBUTING.md](CONTRIBUTING.md), [AGENTS.md](AGENTS.md) and the [issue tracker](https://github.com/vizhub-studio/vzcode/issues).
|
|
12
|
+
- **Status:** The npm CLI runs the local browser editor by default. Tauri desktop builds are optional and experimental; see [Usage](#usage).
|
|
13
|
+
|
|
7
14
|
## Table of Contents
|
|
8
15
|
|
|
16
|
+
- [Documentation map](#documentation-map)
|
|
9
17
|
- [Usage](#usage)
|
|
10
18
|
- [Development](#development)
|
|
11
19
|
- [Features](#features)
|
|
20
|
+
- [Keyboard Shortcuts](#keyboard-shortcuts)
|
|
12
21
|
- [Use Cases](#use-cases)
|
|
22
|
+
- [Optional integrations](#optional-integrations)
|
|
23
|
+
- [Desktop application](#desktop-application)
|
|
24
|
+
- [Embedding the Visual Editor in a host application](#embedding-the-visual-editor-in-a-host-application)
|
|
13
25
|
- [Visual Editor](#visual-editor)
|
|
14
26
|
- [Stack](#stack)
|
|
15
27
|
- [Goals](#goals)
|
|
16
28
|
- [Prior Work](#prior-work)
|
|
17
|
-
- [Milestones](#milestones)
|
|
18
|
-
- [Team](#team)
|
|
19
29
|
- [Spaces](#spaces)
|
|
30
|
+
- [Embedded editor styling](#embedded-editor-styling)
|
|
20
31
|
|
|
21
32
|
## Usage
|
|
22
33
|
|
|
23
|
-
|
|
34
|
+
Install the npm package and open an existing local project:
|
|
24
35
|
|
|
25
|
-
```
|
|
36
|
+
```bash
|
|
26
37
|
npm install -g vzcode
|
|
38
|
+
vzcode ./my-project
|
|
27
39
|
```
|
|
28
40
|
|
|
29
|
-
|
|
41
|
+
The browser editor starts at `http://127.0.0.1:3030` and edits files inside
|
|
42
|
+
that directory. The server runs until you press `Ctrl+C`. No separately
|
|
43
|
+
installed desktop application, account, or AI provider is required.
|
|
30
44
|
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
CLI options:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
vzcode . --port=4000 # Choose a local HTTP/WebSocket port
|
|
49
|
+
vzcode . --no-open # Start without opening a browser
|
|
50
|
+
vzcode . --browser # Explicit alias for the default mode
|
|
51
|
+
vzcode . --desktop # Optional, requires a locally built Tauri app
|
|
52
|
+
vzcode --help
|
|
33
53
|
```
|
|
34
54
|
|
|
35
|
-
|
|
55
|
+
For a project-local installation, use `npm install --save-dev vzcode` and
|
|
56
|
+
`npx vzcode .`. The CLI listens on `127.0.0.1` only. On startup, VZCode
|
|
57
|
+
prints and opens a **private editor URL** containing a per-process capability
|
|
58
|
+
token in its fragment (`#vzcode-token=...`). The browser exchanges this for
|
|
59
|
+
an HttpOnly session cookie; later reloads use the cookie. Use the exact
|
|
60
|
+
link printed by the CLI when connecting another local browser tab.
|
|
61
|
+
|
|
62
|
+
The token grants full editing access to every file in that workspace;
|
|
63
|
+
do not share the link or expose it in screenshots or logs. Sessions are
|
|
64
|
+
in-memory and end when the server process exits. Remote deployment remains
|
|
65
|
+
unsupported: do **not** expose the port through a proxy or tunnel until
|
|
66
|
+
TLS, host configuration, network access controls, and authorization have
|
|
67
|
+
been reviewed. See [Security](docs/SECURITY.md).
|
|
68
|
+
|
|
69
|
+
VZCode monitors its workspace for external changes (e.g. Git, formatters,
|
|
70
|
+
other editors), using filesystem notifications and periodic recursive
|
|
71
|
+
scans. Non-conflicting changes appear in the collaborative editor; concurrent
|
|
72
|
+
changes to the same file **pause autosave** until you explicitly choose
|
|
73
|
+
**Load disk version** or **Overwrite disk with editor** in the conflict
|
|
74
|
+
banner. The latter intentionally replaces the disk version. New and renamed
|
|
75
|
+
files are detected, including nested directories. See
|
|
76
|
+
[Filesystem synchronization](docs/FILESYSTEM_SYNC.md) for details and limits.
|
|
77
|
+
|
|
78
|
+
To validate the distributable from a source checkout, build and smoke-test
|
|
79
|
+
the exact packed npm artifact:
|
|
36
80
|
|
|
37
|
-
|
|
81
|
+
```bash
|
|
82
|
+
npm ci
|
|
83
|
+
npm run build-release
|
|
84
|
+
npm run test:package
|
|
85
|
+
```
|
|
38
86
|
|
|
39
|
-
|
|
87
|
+
The package smoke test installs the tarball into a temporary directory and
|
|
88
|
+
checks HTTP assets, ShareDB/WebSocket editing, disk persistence, and
|
|
89
|
+
shutdown. It requires npm registry access to install package dependencies.
|
|
40
90
|
|
|
41
91
|
## Development
|
|
42
92
|
|
|
43
|
-
- **Backlog & Issues**: Use
|
|
93
|
+
- **Backlog & Issues**: Use the [repository issue tracker](https://github.com/vizhub-studio/vzcode/issues) and [pull requests](https://github.com/vizhub-studio/vzcode/pulls). Historical organization project-board links are not the maintained onboarding entry point.
|
|
44
94
|
|
|
45
95
|
- **Local Setup**:
|
|
46
96
|
|
|
@@ -50,33 +100,63 @@ npm install
|
|
|
50
100
|
npm run test-interactive
|
|
51
101
|
```
|
|
52
102
|
|
|
53
|
-
|
|
103
|
+
This starts the editor server with the sample `playground` workspace on port
|
|
104
|
+
3030 and opens it in a browser. For local client development with hot reloading,
|
|
105
|
+
run the development command instead:
|
|
54
106
|
|
|
55
|
-
```
|
|
56
|
-
npm
|
|
107
|
+
```bash
|
|
108
|
+
npm run dev
|
|
57
109
|
```
|
|
58
110
|
|
|
59
|
-
|
|
111
|
+
`npm run dev` starts both the backend and Vite. Vite serves the client at
|
|
112
|
+
http://localhost:5173 and proxies requests to the backend on port 3030; do not
|
|
113
|
+
start it alongside a separate `npm run test-interactive` server. On Windows,
|
|
114
|
+
install the platform-specific Rollup package if npm reports that it is missing:
|
|
60
115
|
|
|
61
116
|
```bash
|
|
62
|
-
npm
|
|
117
|
+
npm install @rollup/rollup-win32-x64-msvc
|
|
63
118
|
```
|
|
64
119
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
You can also use [npm link](https://docs.npmjs.com/cli/v8/commands/npm-link) to set up the `vzcode` NPM package in another project to point to your clone of the repository. This can be useful when testing out how `vzcode` functions as a dependency.
|
|
120
|
+
You can use [npm link](https://docs.npmjs.com/cli/v8/commands/npm-link) to test
|
|
121
|
+
the package from another project.
|
|
68
122
|
|
|
69
123
|
## Features
|
|
70
124
|
|
|
71
|
-
- Browser-based
|
|
72
|
-
|
|
73
|
-
- Real-time
|
|
74
|
-
- File
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
|
|
79
|
-
-
|
|
125
|
+
- Browser-based editor with syntax highlighting, completion, diagnostics,
|
|
126
|
+
formatting, and common VS Code key bindings
|
|
127
|
+
- Real-time collaborative editing with participant cursors and presence
|
|
128
|
+
- File and nested-directory browsing, tabs, file search, and create, rename,
|
|
129
|
+
and delete operations
|
|
130
|
+
- Text editing and image preview
|
|
131
|
+
- Code execution in a preview pane; run actions format the active file and
|
|
132
|
+
refresh the preview
|
|
133
|
+
- Interactive widgets for editing numbers (Alt+drag) and colors (Alt+click)
|
|
134
|
+
- Debounced auto-save, with throttled saves while interacting with widgets
|
|
135
|
+
- AI chat for code editing, streaming responses, and change diffs; AI requires
|
|
136
|
+
a configured provider
|
|
137
|
+
- A Visual Editor panel for configurable widgets backed by `config.json`
|
|
138
|
+
- Editor settings for theme, font, font size, and collaboration username; the
|
|
139
|
+
editor includes ten themes
|
|
140
|
+
- Optional LiveKit voice chat and speech-to-text input (see
|
|
141
|
+
[Optional integrations](#optional-integrations))
|
|
142
|
+
- A Tauri desktop application when built with the desktop toolchain
|
|
143
|
+
|
|
144
|
+
## Keyboard Shortcuts
|
|
145
|
+
|
|
146
|
+
- `Ctrl+S` or `Shift+Enter`: format the active file and run the code
|
|
147
|
+
- `Ctrl+Shift+E`: open Files
|
|
148
|
+
- `Ctrl+Shift+F`: open Search
|
|
149
|
+
- `Ctrl+Shift+K`: open Keyboard Shortcuts
|
|
150
|
+
- `Ctrl+Shift+S` or `Ctrl+,`: open Editor Settings
|
|
151
|
+
- `Ctrl+Shift+N`: open the create-file dialog
|
|
152
|
+
- `Ctrl+Shift+D`: open the create-directory dialog
|
|
153
|
+
- `Ctrl+Shift+A`: toggle automatic following of another participant
|
|
154
|
+
- `Alt+N`: open the create-file dialog
|
|
155
|
+
- `Alt+W`: close the active tab
|
|
156
|
+
- `Alt+PageUp` / `Alt+PageDown`: switch to the previous/next tab
|
|
157
|
+
- `Ctrl+click` an identifier: jump to its closest definition
|
|
158
|
+
|
|
159
|
+
The Keyboard Shortcuts panel in the editor lists additional shortcuts.
|
|
80
160
|
|
|
81
161
|
## Use Cases
|
|
82
162
|
|
|
@@ -99,7 +179,7 @@ You can also use [npm link](https://docs.npmjs.com/cli/v8/commands/npm-link) to
|
|
|
99
179
|
"edit": "vzcode"
|
|
100
180
|
},
|
|
101
181
|
"dependencies": {
|
|
102
|
-
"vzcode": "^
|
|
182
|
+
"vzcode": "^3.2.0"
|
|
103
183
|
}
|
|
104
184
|
}
|
|
105
185
|
```
|
|
@@ -108,18 +188,34 @@ You can also use [npm link](https://docs.npmjs.com/cli/v8/commands/npm-link) to
|
|
|
108
188
|
|
|
109
189
|
For example, as the editor of [Vite D3 Template](https://github.com/curran/vite-d3-template), which showcases the throttled auto-save behavior of VZCode while using the interactive widgets in the context of editing files served by the Vite dev server which supports hot reloading.
|
|
110
190
|
|
|
111
|
-
- **
|
|
112
|
-
|
|
191
|
+
- **Staging Site Editor (Experimental)**:
|
|
192
|
+
Use VZCode on a persistent server, making code changes with multiplayer mode remotely, reflecting instantly on a staging site.
|
|
113
193
|
|
|
114
|
-
|
|
115
|
-
vzcode
|
|
116
|
-
ngrok http 3030
|
|
117
|
-
```
|
|
194
|
+
## Optional integrations
|
|
118
195
|
|
|
119
|
-
|
|
196
|
+
To configure AI chat, copy `.env.example` to `.env` and set
|
|
197
|
+
`VZCODE_EDIT_WITH_AI_API_KEY`. The optional
|
|
198
|
+
`VZCODE_EDIT_WITH_AI_MODEL_NAME` selects a model, and
|
|
199
|
+
`VZCODE_EDIT_WITH_AI_BASE_URL` can point to an OpenAI-compatible endpoint.
|
|
200
|
+
Prompts and project context are sent to the configured provider.
|
|
120
201
|
|
|
121
|
-
|
|
122
|
-
|
|
202
|
+
Set these variables in the client build environment to enable optional voice
|
|
203
|
+
features:
|
|
204
|
+
|
|
205
|
+
- `VITE_ENABLE_LIVEKIT=true` enables LiveKit voice chat. Configure
|
|
206
|
+
`VITE_LIVEKIT_URL`, `LIVEKIT_API_KEY`, and `LIVEKIT_API_SECRET` for your
|
|
207
|
+
LiveKit deployment.
|
|
208
|
+
- `VITE_ENABLE_VOICE_INPUT=true` enables speech-to-text in AI chat. Availability
|
|
209
|
+
depends on browser speech-recognition support and microphone permissions.
|
|
210
|
+
|
|
211
|
+
## Desktop application
|
|
212
|
+
|
|
213
|
+
The desktop wrapper uses Tauri and is experimental. With Rust and the
|
|
214
|
+
platform's Tauri prerequisites installed, run `npm run tauri:dev` for
|
|
215
|
+
development or `npm run tauri:build` to build it. Use `vzcode --desktop`
|
|
216
|
+
from the source checkout to launch a locally built binary. Desktop binaries
|
|
217
|
+
are **not** included in the npm package; use the default browser mode for
|
|
218
|
+
an npm installation.
|
|
123
219
|
|
|
124
220
|
## Embedding the Visual Editor in a host application
|
|
125
221
|
|
|
@@ -196,16 +292,65 @@ The `visualEditorWidgets` array defines the interactive controls that will be av
|
|
|
196
292
|
- `"checkbox"` - A checkbox for boolean values
|
|
197
293
|
- `"textInput"` - A text input field for string values
|
|
198
294
|
- `"dropdown"` - A dropdown selector with predefined options
|
|
199
|
-
- `"color"` - A
|
|
295
|
+
- `"color"` - A swatch, native color selector, HEX input, presets and optional advanced HCL sliders
|
|
296
|
+
- `"segmented"` - A compact button group for string options
|
|
200
297
|
- **label**: Human-readable label displayed in the UI
|
|
201
298
|
- **property**: The configuration property to modify (supports nested properties using dot notation like `"margin.left"`)
|
|
202
299
|
- **min**: Minimum value (required for `slider` widgets)
|
|
203
300
|
- **max**: Maximum value (required for `slider` widgets)
|
|
204
301
|
- **step**: Step increment for `slider` widgets (optional, defaults to 1 if not specified)
|
|
205
|
-
- **options**: Array of string options (required for `dropdown` widgets)
|
|
302
|
+
- **options**: Array of string options (required for `dropdown` and `segmented` widgets)
|
|
303
|
+
- **section**: Optional collapsible property group (defaults to `"Appearance"`)
|
|
304
|
+
- **description**: Optional short help below the control
|
|
305
|
+
- **unit**: Optional numeric unit suffix such as `"px"` or `"%"`
|
|
306
|
+
- **defaultValue**: Optional value of the same type as the config property; shows a per-control Reset action
|
|
206
307
|
|
|
207
308
|
Every widget's `property` must resolve to an **existing** value in `config.json` (dot-separated paths such as `margin.left` are supported, but arrays and prototype keys are not editable). Match the value to the widget: finite number for `slider`, boolean for `checkbox`, string for `textInput`, one of `options` for `dropdown`, and a valid, opaque CSS color for `color`. Invalid widget values or paths show the host-configurable `invalid-widgets` empty state rather than rendering broken controls.
|
|
208
309
|
|
|
310
|
+
### Grouped Visual Properties example
|
|
311
|
+
|
|
312
|
+
Existing `config.json` widgets work without changes. To opt into named sections and reset controls:
|
|
313
|
+
|
|
314
|
+
```json
|
|
315
|
+
{
|
|
316
|
+
"pointRadius": 8,
|
|
317
|
+
"markColor": "#6366f1",
|
|
318
|
+
"markShape": "Circle",
|
|
319
|
+
"visualEditorWidgets": [
|
|
320
|
+
{
|
|
321
|
+
"type": "slider",
|
|
322
|
+
"property": "pointRadius",
|
|
323
|
+
"label": "Point radius",
|
|
324
|
+
"min": 1,
|
|
325
|
+
"max": 30,
|
|
326
|
+
"step": 1,
|
|
327
|
+
"unit": "px",
|
|
328
|
+
"section": "Marks",
|
|
329
|
+
"defaultValue": 8
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"type": "color",
|
|
333
|
+
"property": "markColor",
|
|
334
|
+
"label": "Mark color",
|
|
335
|
+
"section": "Colors",
|
|
336
|
+
"defaultValue": "#6366f1"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"type": "segmented",
|
|
340
|
+
"property": "markShape",
|
|
341
|
+
"label": "Shape",
|
|
342
|
+
"options": ["Circle", "Square", "Diamond"],
|
|
343
|
+
"section": "Marks",
|
|
344
|
+
"defaultValue": "Circle"
|
|
345
|
+
}
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
Rapid slider, color and text edits are coalesced at a short interval before
|
|
351
|
+
writing `config.json` via ShareDB. The live preview continues to receive
|
|
352
|
+
configuration patches without rebuilding its iframe.
|
|
353
|
+
|
|
209
354
|
### Setting Up Your Visualization
|
|
210
355
|
|
|
211
356
|
To make your visualization work with the visual editor, you need to:
|