vzcode 1.30.1 → 1.31.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 (31) hide show
  1. package/dist/assets/{index-BOiH3_fC.js → index-D01yzCWj.js} +88 -88
  2. package/dist/assets/{index-zzK6rRiK.css → index-DTtcN2MP.css} +1 -1
  3. package/dist/index.html +2 -2
  4. package/package.json +7 -8
  5. package/src/client/AIAssist/startAIAssist.ts +0 -24
  6. package/src/client/App/index.tsx +11 -7
  7. package/src/client/CodeEditor/getOrCreateEditor.ts +0 -52
  8. package/src/client/CodeEditor/index.tsx +0 -6
  9. package/src/client/RunCodeWidget/index.tsx +0 -2
  10. package/src/client/VZCodeContext.tsx +8 -25
  11. package/src/client/VZMiddle.tsx +0 -5
  12. package/src/client/VZSidebar/index.tsx +18 -11
  13. package/src/client/VZSidebar/styles.scss +27 -7
  14. package/src/client/VZSidebar/useDragAndDrop.tsx +237 -35
  15. package/src/client/main.jsx +0 -2
  16. package/src/client/useFileCRUD.ts +0 -2
  17. package/src/server/featureFlags.js +2 -6
  18. package/src/server/setupEnv.js +0 -10
  19. package/dist/assets/index-Dd8gk_1S.js +0 -447
  20. package/src/client/CodeEditor/typeScriptCompletions.ts +0 -134
  21. package/src/client/CodeEditor/typeScriptLinter.ts +0 -47
  22. package/src/client/useTypeScript/index.ts +0 -48
  23. package/src/client/useTypeScript/worker/constants.ts +0 -94
  24. package/src/client/useTypeScript/worker/getTSFileName.ts +0 -4
  25. package/src/client/useTypeScript/worker/handleMessageAutocompleteRequest.ts +0 -63
  26. package/src/client/useTypeScript/worker/handleMessageLintRequest.ts +0 -84
  27. package/src/client/useTypeScript/worker/handleMessageTranspileRequest.ts +0 -20
  28. package/src/client/useTypeScript/worker/handleMessageUpdateContent.ts +0 -42
  29. package/src/client/useTypeScript/worker/index.ts +0 -110
  30. package/src/client/useTypeScript/worker/isTS.ts +0 -3
  31. package/src/client/useTypeScript/worker/requestTypes.ts +0 -31
package/dist/index.html CHANGED
@@ -20,8 +20,8 @@
20
20
  href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap"
21
21
  rel="stylesheet"
22
22
  />
23
- <script type="module" crossorigin src="/assets/index-BOiH3_fC.js"></script>
24
- <link rel="stylesheet" crossorigin href="/assets/index-zzK6rRiK.css">
23
+ <script type="module" crossorigin src="/assets/index-D01yzCWj.js"></script>
24
+ <link rel="stylesheet" crossorigin href="/assets/index-DTtcN2MP.css">
25
25
  </head>
26
26
  <body>
27
27
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vzcode",
3
- "version": "1.30.1",
3
+ "version": "1.31.0",
4
4
  "description": "Multiplayer code editor system",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -13,7 +13,7 @@
13
13
  "test": "vitest run",
14
14
  "test-interactive": "cd test/sampleDirectories/kitchenSink && node ../../../src/server/index.js",
15
15
  "prettier": "prettier {*.*,**/*.*} --write",
16
- "tsc": "tsc --noEmit",
16
+ "typecheck": "tsc --noEmit",
17
17
  "dev": "cross-env EDITOR_PORT=5173 concurrently \"npm run test-interactive\" \"vite\"",
18
18
  "build": "vite build",
19
19
  "build-release": "vite build --mode release",
@@ -114,7 +114,7 @@
114
114
  "@codemirror/theme-one-dark": "^6.1.2",
115
115
  "@codemirror/view": "^6.36.5",
116
116
  "@langchain/core": "^0.3.43",
117
- "@langchain/openai": "^0.5.2",
117
+ "@langchain/openai": "^0.5.4",
118
118
  "@lezer/highlight": "^1.2.1",
119
119
  "@livekit/components-react": "^2.9.0",
120
120
  "@replit/codemirror-indentation-markers": "^6.5.3",
@@ -122,7 +122,6 @@
122
122
  "@replit/codemirror-lang-svelte": "^6.0.0",
123
123
  "@replit/codemirror-vscode-keymap": "^6.0.2",
124
124
  "@teamwork/websocket-json-stream": "^2.0.0",
125
- "@typescript/vfs": "^1.6.1",
126
125
  "@uiw/codemirror-theme-abcdef": "^4.23.10",
127
126
  "@uiw/codemirror-theme-dracula": "^4.23.10",
128
127
  "@uiw/codemirror-theme-eclipse": "^4.23.10",
@@ -132,7 +131,7 @@
132
131
  "@uiw/codemirror-theme-okaidia": "^4.23.10",
133
132
  "@uiw/codemirror-theme-xcode": "^4.23.10",
134
133
  "@uiw/codemirror-themes": "^4.23.10",
135
- "@vizhub/viz-types": "^0.0.2",
134
+ "@vizhub/viz-types": "^0.1.0",
136
135
  "body-parser": "^2.2.0",
137
136
  "codemirror": "^6.0.1",
138
137
  "codemirror-copilot": "^0.0.7",
@@ -152,7 +151,7 @@
152
151
  "react": "^18",
153
152
  "react-bootstrap": "^2.10.9",
154
153
  "react-dom": "^18",
155
- "react-router-dom": "^7.4.1",
154
+ "react-router-dom": "^7.5.0",
156
155
  "sharedb": "^5.2.1",
157
156
  "sharedb-client-browser": "^5.1.1",
158
157
  "uuid": "^11.1.0",
@@ -167,8 +166,8 @@
167
166
  "cross-env": "^7.0.3",
168
167
  "npm-check-updates": "^17.1.16",
169
168
  "prettier": "^3.5.3",
170
- "sass": "^1.86.2",
171
- "typescript": "^5.8.2",
169
+ "sass": "^1.86.3",
170
+ "typescript": "^5.8.3",
172
171
  "vite": "^6.2.5",
173
172
  "vitest": "^3.1.1"
174
173
  },
@@ -70,30 +70,6 @@ export const startAIAssist = async ({
70
70
  .join('\n\n');
71
71
  }
72
72
 
73
- if (debug) {
74
- // console.log('[startAIAssist] sending HTTP request:');
75
- // console.log(
76
- // '[startAIAssist] aiAssistEndpoint:',
77
- // aiAssistEndpoint,
78
- // );
79
- // console.log(
80
- // '[startAIAssist] aiAssistOptions:',
81
- // aiAssistOptions,
82
- // );
83
- console.log(
84
- '[startAIAssist] inputText:\n`' + inputText + '`',
85
- );
86
- // console.log('[startAIAssist] fileId:', fileId);
87
- // console.log(
88
- // '[startAIAssist] insertionCursor:',
89
- // insertionCursor,
90
- // );
91
- // console.log(
92
- // '[startAIAssist] aiStreamId:',
93
- // aiStreamId,
94
- // );
95
- }
96
-
97
73
  const response = await fetch(aiAssistEndpoint, {
98
74
  method: 'POST',
99
75
  headers: {
@@ -19,7 +19,6 @@ import { VZLeft } from '../VZLeft';
19
19
  import { VZMiddle } from '../VZMiddle';
20
20
  import { VZResizer } from '../VZResizer';
21
21
  import { VZRight } from '../VZRight';
22
- import TypeScriptWorker from '../useTypeScript/worker?worker';
23
22
  import {
24
23
  useInitialUsername,
25
24
  usePersistUsername,
@@ -30,9 +29,6 @@ import { useShareDB } from './useShareDB';
30
29
  // Instantiate the Prettier worker.
31
30
  const prettierWorker = new PrettierWorker();
32
31
 
33
- // Instantiate the TypeScript worker.
34
- const typeScriptWorker = new TypeScriptWorker();
35
-
36
32
  // Register our custom JSON1 OT type that supports presence.
37
33
  // See https://github.com/vizhub-core/json1-presence
38
34
  ShareDBClient.types.register(json1Presence.type);
@@ -93,6 +89,14 @@ function App() {
93
89
  // so that multiple browser windows are not required.
94
90
  const enableRightPanel = true;
95
91
 
92
+ // TODO: enable this when the AI copilot is ready
93
+ // Currently it's glitchy and frustrating to use.
94
+ // It appears to be bugs in the upstream CodeMirror copilot code.
95
+ // Ghost text appears after just moving the cursor, not typing.
96
+ // It's hard to figure out how to dismiss it.
97
+ // Clicking on it accepts it but should not.
98
+ const enableCopilot = false;
99
+
96
100
  return (
97
101
  <SplitPaneResizeProvider>
98
102
  <VZCodeProvider
@@ -102,7 +106,6 @@ function App() {
102
106
  localPresence={localPresence}
103
107
  docPresence={docPresence}
104
108
  prettierWorker={prettierWorker}
105
- typeScriptWorker={typeScriptWorker}
106
109
  initialUsername={initialUsername}
107
110
  connected={connected}
108
111
  pending={pending}
@@ -123,8 +126,9 @@ function App() {
123
126
  <div className="app">
124
127
  <VZLeft />
125
128
  <VZMiddle
126
- allowGlobals={true}
127
- aiCopilotEndpoint={'/ai-copilot'}
129
+ aiCopilotEndpoint={
130
+ enableCopilot ? '/ai-copilot' : null
131
+ }
128
132
  />
129
133
  {enableRightPanel ? <VZRight /> : null}
130
134
  <VZResizer side="left" />
@@ -38,8 +38,6 @@ import {
38
38
  EditorCacheValue,
39
39
  } from '../useEditorCache';
40
40
  import { ThemeLabel, themeOptionsByLabel } from '../themes';
41
- import { typeScriptCompletions } from './typeScriptCompletions';
42
- import { typeScriptLinter } from './typeScriptLinter';
43
41
  import { keymap } from '@codemirror/view';
44
42
  import { basicSetup } from './basicSetup';
45
43
  import { InteractRule } from '@replit/codemirror-interact';
@@ -48,14 +46,6 @@ import { cssLanguage } from '@codemirror/lang-css';
48
46
  import { javascriptLanguage } from '@codemirror/lang-javascript';
49
47
  import { copilot } from './Copilot';
50
48
 
51
- // Feature flag to enable TypeScript completions & TypeScript Linter.
52
- // This is disabled by default because it's buggy and glitchy.
53
- // It's overly aggressive and shows warnings where it should not.
54
- // Path forward:
55
- // * Remove this entire TypeScript linter implementation
56
- // * Use val-town/codemirror-ts: https://github.com/vizhub-core/vzcode/issues/844
57
- const enableTypeScriptLinter = false;
58
-
59
49
  const DEBUG = false;
60
50
 
61
51
  // Enables TypeScript +JSX support in CodeMirror.
@@ -132,9 +122,7 @@ export const getOrCreateEditor = ({
132
122
  onInteract,
133
123
  editorCache,
134
124
  usernameRef,
135
- typeScriptWorker,
136
125
  customInteractRules,
137
- allowGlobals,
138
126
  enableAutoFollowRef,
139
127
  openTab,
140
128
  aiCopilotEndpoint,
@@ -167,9 +155,7 @@ export const getOrCreateEditor = ({
167
155
  editorCache: EditorCache;
168
156
  usernameRef: React.MutableRefObject<Username>;
169
157
  aiAssistEndpoint?: string;
170
- typeScriptWorker: Worker;
171
158
  customInteractRules?: Array<InteractRule>;
172
- allowGlobals: boolean;
173
159
 
174
160
  // Ref to a boolean that determines whether to
175
161
  // enable auto-following the cursors of remote users.
@@ -333,44 +319,6 @@ export const getOrCreateEditor = ({
333
319
  // }),
334
320
  // );
335
321
 
336
- // Add the extension that provides TypeScript completions.
337
- // only add this if it's TS-compatible (.js, .jsx, .ts, .tsx)
338
- const isTypeScript =
339
- fileExtension === 'js' ||
340
- fileExtension === 'jsx' ||
341
- fileExtension === 'ts' ||
342
- fileExtension === 'tsx';
343
-
344
- extensions.push(
345
- autocompletion(
346
- isTypeScript
347
- ? {
348
- override: [
349
- typeScriptCompletions({
350
- typeScriptWorker,
351
- fileName: name,
352
- }),
353
- ],
354
- }
355
- : undefined,
356
- ),
357
- );
358
-
359
- if (shareDBDoc && enableTypeScriptLinter) {
360
- extensions.push(
361
- linter(
362
- typeScriptLinter({
363
- typeScriptWorker,
364
- fileName: name,
365
- shareDBDoc,
366
- fileId,
367
- allowGlobals,
368
- }) as unknown as () => Diagnostic[],
369
- //Needs the unknown because we are returning a Promise<Diagnostic>
370
- ),
371
- );
372
- }
373
-
374
322
  // Add the extension that provides indentation markers.
375
323
  extensions.push(
376
324
  indentationMarkers({
@@ -18,11 +18,9 @@ const filesPath = ['files'];
18
18
 
19
19
  export const CodeEditor = ({
20
20
  customInteractRules,
21
- allowGlobals,
22
21
  aiCopilotEndpoint,
23
22
  }: {
24
23
  customInteractRules?: Array<InteractRule>;
25
- allowGlobals: boolean;
26
24
  aiCopilotEndpoint?: string;
27
25
  }) => {
28
26
  const {
@@ -36,7 +34,6 @@ export const CodeEditor = ({
36
34
  editorCache,
37
35
  editorWantsFocus,
38
36
  editorNoLongerWantsFocus,
39
- typeScriptWorker,
40
37
  theme,
41
38
  codeEditorRef,
42
39
  enableAutoFollow,
@@ -96,9 +93,7 @@ export const CodeEditor = ({
96
93
  onInteract,
97
94
  editorCache,
98
95
  usernameRef,
99
- typeScriptWorker,
100
96
  customInteractRules,
101
- allowGlobals,
102
97
  enableAutoFollowRef,
103
98
  openTab,
104
99
  aiCopilotEndpoint,
@@ -113,7 +108,6 @@ export const CodeEditor = ({
113
108
  onInteract,
114
109
  editorCache,
115
110
  usernameRef,
116
- typeScriptWorker,
117
111
  aiCopilotEndpoint,
118
112
  ],
119
113
  );
@@ -48,8 +48,6 @@ export const RunCodeWidget = ({
48
48
  }, [runCodeRef, runPrettierRef]);
49
49
 
50
50
  const handleSplitEditor = useCallback(() => {
51
- console.log('Split Editor');
52
- console.log(splitCurrentPane);
53
51
  splitCurrentPane();
54
52
  }, [splitCurrentPane]);
55
53
 
@@ -34,7 +34,6 @@ import { useKeyboardShortcuts } from './useKeyboardShortcuts';
34
34
  import { useOpenDirectories } from './useOpenDirectories';
35
35
  import { usePrettier } from './usePrettier';
36
36
  import { useRunCode } from './useRunCode';
37
- import { useTypeScript } from './useTypeScript';
38
37
  import { useURLSync } from './useURLSync';
39
38
  import { createInitialState, vzReducer } from './vzReducer';
40
39
  import { findPane } from './vzReducer/findPane';
@@ -110,8 +109,6 @@ export type VZCodeContextValue = {
110
109
 
111
110
  errorMessage: string | null;
112
111
 
113
- typeScriptWorker: Worker | null;
114
-
115
112
  search: SearchResults;
116
113
  isSearchOpen: boolean;
117
114
  setIsSearchOpen: (isSearchOpen: boolean) => void;
@@ -185,7 +182,6 @@ export const VZCodeProvider = ({
185
182
  localPresence,
186
183
  docPresence,
187
184
  prettierWorker,
188
- typeScriptWorker,
189
185
  initialUsername,
190
186
  children,
191
187
  codeError = null,
@@ -204,18 +200,17 @@ export const VZCodeProvider = ({
204
200
  localPresence: any;
205
201
  docPresence: any;
206
202
  prettierWorker: Worker;
207
- typeScriptWorker: Worker;
208
203
  initialUsername: Username;
209
204
  children: React.ReactNode;
210
205
  codeError?: string | null;
211
- connected: boolean;
212
- pending: boolean;
213
- liveKitToken: string | undefined;
214
- setLiveKitToken: (state: string) => void;
215
- liveKitRoomName: string | undefined;
216
- setLiveKitRoom: (state: string) => void;
217
- liveKitConnection: boolean;
218
- setLiveKitConnection: (state: boolean) => void;
206
+ connected?: boolean;
207
+ pending?: boolean;
208
+ liveKitToken?: string | undefined;
209
+ setLiveKitToken?: (state: string) => void;
210
+ liveKitRoomName?: string | undefined;
211
+ setLiveKitRoom?: (state: string) => void;
212
+ liveKitConnection?: boolean;
213
+ setLiveKitConnection?: (state: boolean) => void;
219
214
  }) => {
220
215
  // Auto-run Pretter after local changes.
221
216
  const { prettierError, runPrettierRef } = usePrettier({
@@ -240,16 +235,6 @@ export const VZCodeProvider = ({
240
235
  ? prettierError
241
236
  : codeError;
242
237
 
243
- // Set up the TypeScript Language Server worker.
244
- // This acts as a central "brain" for features powered
245
- // by the TypeScript Language Server including:
246
- // * Completions
247
- // * Linting
248
- useTypeScript({
249
- content,
250
- typeScriptWorker,
251
- });
252
-
253
238
  // Set up the reducer that manages much of the application state.
254
239
  // See https://react.dev/reference/react/useReducer
255
240
  const [state, dispatch] = useReducer(
@@ -473,8 +458,6 @@ export const VZCodeProvider = ({
473
458
 
474
459
  errorMessage,
475
460
 
476
- typeScriptWorker,
477
-
478
461
  isCreateFileModalOpen,
479
462
  handleOpenCreateFileModal,
480
463
  handleCloseCreateFileModal,
@@ -17,7 +17,6 @@ const PaneView = ({
17
17
  pane,
18
18
  content,
19
19
  customInteractRules,
20
- allowGlobals,
21
20
  enableAIAssist,
22
21
  aiAssistEndpoint,
23
22
  aiAssistOptions,
@@ -49,7 +48,6 @@ const PaneView = ({
49
48
  {isClient && content && pane.activeFileId && (
50
49
  <CodeEditor
51
50
  customInteractRules={customInteractRules}
52
- allowGlobals={allowGlobals}
53
51
  aiCopilotEndpoint={aiCopilotEndpoint}
54
52
  />
55
53
  )}
@@ -86,7 +84,6 @@ export const VZMiddle = ({
86
84
  aiAssistClickOverride,
87
85
  aiCopilotEndpoint,
88
86
  customInteractRules,
89
- allowGlobals = false,
90
87
  }: {
91
88
  enableAIAssist?: boolean;
92
89
  aiAssistEndpoint?: string;
@@ -95,7 +92,6 @@ export const VZMiddle = ({
95
92
  aiAssistClickOverride?: () => void;
96
93
  aiCopilotEndpoint?: string;
97
94
  customInteractRules?: Array<InteractRule>;
98
- allowGlobals?: boolean;
99
95
  }) => {
100
96
  const { codeEditorWidth } = useContext(
101
97
  SplitPaneResizeContext,
@@ -126,7 +122,6 @@ export const VZMiddle = ({
126
122
  pane={pane}
127
123
  content={content}
128
124
  customInteractRules={customInteractRules}
129
- allowGlobals={allowGlobals}
130
125
  enableAIAssist={enableAIAssist}
131
126
  aiAssistEndpoint={aiAssistEndpoint}
132
127
  aiAssistOptions={aiAssistOptions}
@@ -32,9 +32,9 @@ import { SplitPaneResizeContext } from '../SplitPaneResizeContext';
32
32
  import { VZCodeContext } from '../VZCodeContext';
33
33
  import { Listing } from './Listing';
34
34
  import { Search } from './Search';
35
- import './styles.scss';
36
35
  import { useDragAndDrop } from './useDragAndDrop';
37
36
  import { enableLiveKit } from '../featureFlags';
37
+ import './styles.scss';
38
38
 
39
39
  // TODO turn this UI back on when we are actually detecting
40
40
  // the connection status.
@@ -252,10 +252,6 @@ export const VZSidebar = ({
252
252
  <div
253
253
  className="vz-sidebar"
254
254
  style={{ width: sidebarWidth + 'px' }}
255
- onDragEnter={handleDragEnter}
256
- onDragOver={handleDragOver}
257
- onDragLeave={handleDragLeave}
258
- onDrop={handleDrop}
259
255
  >
260
256
  <div
261
257
  className="full-box"
@@ -426,10 +422,6 @@ export const VZSidebar = ({
426
422
  id="mic-icon"
427
423
  className="icon-button icon-button-dark"
428
424
  onClick={() => {
429
- console.log(
430
- 'clicking',
431
- liveKitConnection,
432
- );
433
425
  setVoiceChatModalOpen(true);
434
426
  }}
435
427
  >
@@ -438,11 +430,23 @@ export const VZSidebar = ({
438
430
  </OverlayTrigger>
439
431
  )}
440
432
  </div>
441
- <div className="files" id="sidebar-view-container">
433
+ <div
434
+ className="files"
435
+ id="sidebar-view-container"
436
+ onDragEnter={handleDragEnter}
437
+ onDragOver={handleDragOver}
438
+ onDragLeave={handleDragLeave}
439
+ onDrop={handleDrop}
440
+ >
442
441
  {!isSearchOpen ? (
443
442
  <div className="sidebar-files">
444
443
  {isDragOver ? (
445
- <div className="empty">
444
+ <div className="empty drag-over">
445
+ <div className="empty-text">
446
+ It looks like you don't have any files
447
+ yet! Click the "Create file" button
448
+ above to create your first file.
449
+ </div>
446
450
  <div className="empty-text">
447
451
  Drop files here!
448
452
  </div>
@@ -470,6 +474,9 @@ export const VZSidebar = ({
470
474
  yet! Click the "Create file" button
471
475
  above to create your first file.
472
476
  </div>
477
+ <div className="empty-text">
478
+ Drop files here!
479
+ </div>
473
480
  </div>
474
481
  )}
475
482
  </div>
@@ -228,21 +228,41 @@
228
228
  flex: 1;
229
229
  flex-direction: column;
230
230
  align-items: center;
231
- justify-content: space-evenly;
231
+ justify-content: center;
232
232
  margin: 10px;
233
233
  padding: 20px;
234
- border: 1px dashed rgba(255, 255, 255, 0.5); /* White dashed outline */
234
+ border: 1px dashed rgba(255, 255, 255, 0.5);
235
235
  border-radius: 10px;
236
-
237
- /*
238
- * This fixes some issues where the drop zone for files
239
- * was flickering when dragging files over the sidebar.
240
- */
236
+ min-height: 200px;
237
+ position: relative;
241
238
  pointer-events: none;
242
239
 
243
240
  .empty-text {
244
241
  font-size: 16px;
245
242
  font-weight: 500;
243
+ pointer-events: none;
244
+ position: absolute;
245
+ text-align: center;
246
+ left: 50%;
247
+ top: 50%;
248
+ transform: translate(-50%, -50%);
249
+ width: 80%;
250
+ opacity: 1;
251
+ transition: opacity 0.2s ease;
252
+
253
+ &:not(:first-child) {
254
+ opacity: 0;
255
+ }
256
+ }
257
+
258
+ &.drag-over {
259
+ .empty-text {
260
+ opacity: 0;
261
+
262
+ &:last-child {
263
+ opacity: 1;
264
+ }
265
+ }
246
266
  }
247
267
  }
248
268