vzcode 2.26.0 → 2.28.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/dist/assets/{index-CkFweu5-.js → index-CTdYkAQU.js} +153 -153
- package/dist/assets/worker-D8p1JlHW.js +342 -0
- package/dist/index.html +1 -1
- package/dist/ot.js +6 -1
- package/package.json +14 -14
- package/src/client/CodeEditor/getOrCreateEditor.tsx +1 -2
- package/src/client/VZCodeContext/useVZCodeState.ts +33 -2
- package/src/client/VZSidebar/aiCopyPaste.ts +18 -21
- package/src/ot.ts +13 -1
- package/src/types.ts +5 -4
- package/dist/assets/worker-VPLhQVba.js +0 -330
package/dist/index.html
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
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-
|
|
23
|
+
<script type="module" crossorigin src="/assets/index-CTdYkAQU.js"></script>
|
|
24
24
|
<link rel="stylesheet" crossorigin href="/assets/index-Dyt9tpmu.css">
|
|
25
25
|
</head>
|
|
26
26
|
<body>
|
package/dist/ot.js
CHANGED
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
// Localized to one file so it's easy to change it in future.
|
|
4
4
|
import OTJSON1Presence from 'sharedb-client-browser/dist/ot-json1-presence-umd.cjs';
|
|
5
5
|
import jsondiff from 'json0-ot-diff';
|
|
6
|
-
import
|
|
6
|
+
import { diff_match_patch as DiffMatchPatch, DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL, } from '@dmsnell/diff-match-patch';
|
|
7
|
+
// Attach the constants to the class as static properties for compatibility with json0-ot-diff
|
|
8
|
+
DiffMatchPatch.DIFF_DELETE = DIFF_DELETE;
|
|
9
|
+
DiffMatchPatch.DIFF_INSERT = DIFF_INSERT;
|
|
10
|
+
DiffMatchPatch.DIFF_EQUAL = DIFF_EQUAL;
|
|
11
|
+
const diffMatchPatch = DiffMatchPatch;
|
|
7
12
|
export const { json1Presence, textUnicode } = OTJSON1Presence;
|
|
8
13
|
// The OT type used throughout the codebase.
|
|
9
14
|
export const otType = json1Presence.type;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vzcode",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.28.0",
|
|
4
4
|
"description": "Multiplayer code editor system",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -120,10 +120,10 @@
|
|
|
120
120
|
"@codemirror/state": "^6.5.2",
|
|
121
121
|
"@codemirror/theme-one-dark": "^6.1.3",
|
|
122
122
|
"@codemirror/view": "^6.38.8",
|
|
123
|
-
"@langchain/core": "^1.1.
|
|
123
|
+
"@langchain/core": "^1.1.4",
|
|
124
124
|
"@langchain/openai": "^1.1.3",
|
|
125
125
|
"@lezer/highlight": "^1.2.3",
|
|
126
|
-
"@livekit/components-react": "^2.9.
|
|
126
|
+
"@livekit/components-react": "^2.9.17",
|
|
127
127
|
"@replit/codemirror-indentation-markers": "^6.5.3",
|
|
128
128
|
"@replit/codemirror-interact": "^6.3.1",
|
|
129
129
|
"@replit/codemirror-lang-svelte": "^6.0.0",
|
|
@@ -153,18 +153,18 @@
|
|
|
153
153
|
"d3-array": "^3.2.4",
|
|
154
154
|
"d3-color": "^3.1.0",
|
|
155
155
|
"diff": "^8.0.2",
|
|
156
|
-
"diff-match-patch": "^1.0
|
|
156
|
+
"@dmsnell/diff-match-patch": "^1.1.0",
|
|
157
157
|
"diff2html": "^3.4.52",
|
|
158
158
|
"dotenv": "^17.2.3",
|
|
159
159
|
"editcodewithai": "^2.4.0",
|
|
160
160
|
"eslint-linter-browserify": "^9.39.1",
|
|
161
|
-
"express": "^5.1
|
|
161
|
+
"express": "^5.2.1",
|
|
162
162
|
"ignore": "^7.0.5",
|
|
163
163
|
"json0-ot-diff": "^1.1.2",
|
|
164
164
|
"jszip": "^3.10.1",
|
|
165
165
|
"livekit-server-sdk": "^2.14.2",
|
|
166
166
|
"llm-code-format": "^3.1.0",
|
|
167
|
-
"lucide-react": "^0.
|
|
167
|
+
"lucide-react": "^0.556.0",
|
|
168
168
|
"npm": "^11.6.4",
|
|
169
169
|
"open": "^11.0.0",
|
|
170
170
|
"prettier-plugin-svelte": "^3.4.0",
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
"react-bootstrap": "^2.10.10",
|
|
173
173
|
"react-dom": "^18",
|
|
174
174
|
"react-markdown": "^10.1.0",
|
|
175
|
-
"react-router-dom": "^7.
|
|
175
|
+
"react-router-dom": "^7.10.1",
|
|
176
176
|
"remark-gfm": "^4.0.1",
|
|
177
177
|
"sharedb": "^5.2.2",
|
|
178
178
|
"sharedb-client-browser": "^5.2.2",
|
|
@@ -182,12 +182,12 @@
|
|
|
182
182
|
},
|
|
183
183
|
"devDependencies": {
|
|
184
184
|
"@eslint/js": "^9.39.1",
|
|
185
|
-
"@tauri-apps/cli": "^2.9.
|
|
185
|
+
"@tauri-apps/cli": "^2.9.5",
|
|
186
186
|
"@types/d3-color": "^3.1.3",
|
|
187
187
|
"@types/react": "^18",
|
|
188
188
|
"@types/react-dom": "^18",
|
|
189
|
-
"@typescript-eslint/eslint-plugin": "^8.48.
|
|
190
|
-
"@typescript-eslint/parser": "^8.48.
|
|
189
|
+
"@typescript-eslint/eslint-plugin": "^8.48.1",
|
|
190
|
+
"@typescript-eslint/parser": "^8.48.1",
|
|
191
191
|
"@vitejs/plugin-react": "^5.1.1",
|
|
192
192
|
"concurrently": "^9.2.1",
|
|
193
193
|
"cross-env": "^10.1.0",
|
|
@@ -197,13 +197,13 @@
|
|
|
197
197
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
198
198
|
"globals": "^16.5.0",
|
|
199
199
|
"npm-check-updates": "^19.1.2",
|
|
200
|
-
"prettier": "^3.
|
|
200
|
+
"prettier": "^3.7.4",
|
|
201
201
|
"sass": "^1.94.2",
|
|
202
202
|
"ts-node": "^10.9.2",
|
|
203
|
-
"tsx": "^4.
|
|
203
|
+
"tsx": "^4.21.0",
|
|
204
204
|
"typescript": "^5.9.3",
|
|
205
|
-
"vite": "^7.2.
|
|
206
|
-
"vitest": "^4.0.
|
|
205
|
+
"vite": "^7.2.6",
|
|
206
|
+
"vitest": "^4.0.15"
|
|
207
207
|
},
|
|
208
208
|
"optionalDependencies": {
|
|
209
209
|
"@rollup/rollup-darwin-arm64": "^4.53.3",
|
|
@@ -162,8 +162,7 @@ const getAtPath = (obj, path) => {
|
|
|
162
162
|
};
|
|
163
163
|
|
|
164
164
|
// Extend the EditorCacheValue type to include the compartments and the updateRainbowBrackets method
|
|
165
|
-
interface ExtendedEditorCacheValue
|
|
166
|
-
extends EditorCacheValue {
|
|
165
|
+
interface ExtendedEditorCacheValue extends EditorCacheValue {
|
|
167
166
|
themeCompartment: Compartment;
|
|
168
167
|
languageCompartment: Compartment;
|
|
169
168
|
rainbowBracketsCompartment: Compartment;
|
|
@@ -273,7 +273,10 @@ export const useVZCodeState = ({
|
|
|
273
273
|
const DEBUG = false;
|
|
274
274
|
|
|
275
275
|
// Compute isLoading based on the current chat's aiStatus
|
|
276
|
-
|
|
276
|
+
// Chat ID changes with each new user message (but not for retry/undo)
|
|
277
|
+
const [currentChatId, setCurrentChatId] = useState(() =>
|
|
278
|
+
uuidv4(),
|
|
279
|
+
);
|
|
277
280
|
const [selectedChatId, setSelectedChatId] = useState<
|
|
278
281
|
string | null
|
|
279
282
|
>(null);
|
|
@@ -385,6 +388,34 @@ export const useVZCodeState = ({
|
|
|
385
388
|
|
|
386
389
|
setAIErrorMessage(null); // Clear any previous errors
|
|
387
390
|
|
|
391
|
+
// Generate new chat ID only for fresh user messages
|
|
392
|
+
// Keep existing chat ID for retries (Try Harder) and undos
|
|
393
|
+
const isRetryOrUndo =
|
|
394
|
+
options?.isRetry === 'true' ||
|
|
395
|
+
options?.isUndo === 'true';
|
|
396
|
+
|
|
397
|
+
let chatIdForRequest: string;
|
|
398
|
+
if (isRetryOrUndo) {
|
|
399
|
+
// Use existing chat ID for retry/undo operations
|
|
400
|
+
chatIdForRequest = activeChatId;
|
|
401
|
+
DEBUG &&
|
|
402
|
+
console.log(
|
|
403
|
+
'Using existing chatId for retry/undo:',
|
|
404
|
+
chatIdForRequest,
|
|
405
|
+
);
|
|
406
|
+
} else {
|
|
407
|
+
// Generate NEW chat ID for fresh user message
|
|
408
|
+
const newChatId = uuidv4();
|
|
409
|
+
setCurrentChatId(newChatId);
|
|
410
|
+
setSelectedChatId(newChatId);
|
|
411
|
+
chatIdForRequest = newChatId;
|
|
412
|
+
DEBUG &&
|
|
413
|
+
console.log(
|
|
414
|
+
'Generated new chatId for fresh message:',
|
|
415
|
+
chatIdForRequest,
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
|
|
388
419
|
// Call backend endpoint for AI response
|
|
389
420
|
try {
|
|
390
421
|
const response = await fetch(aiChatEndpoint, {
|
|
@@ -395,7 +426,7 @@ export const useVZCodeState = ({
|
|
|
395
426
|
body: JSON.stringify({
|
|
396
427
|
...aiChatOptions,
|
|
397
428
|
content: messageContent.trim(),
|
|
398
|
-
chatId:
|
|
429
|
+
chatId: chatIdForRequest,
|
|
399
430
|
mode: aiChatMode,
|
|
400
431
|
...options,
|
|
401
432
|
}),
|
|
@@ -3,14 +3,11 @@ import {
|
|
|
3
3
|
parseMarkdownFiles,
|
|
4
4
|
} from 'llm-code-format';
|
|
5
5
|
import {
|
|
6
|
-
FORMAT_INSTRUCTIONS,
|
|
7
6
|
mergeFileChanges,
|
|
7
|
+
prepareFilesForPrompt,
|
|
8
8
|
} from 'editcodewithai';
|
|
9
9
|
import { VizFiles } from '@vizhub/viz-types';
|
|
10
|
-
import {
|
|
11
|
-
generateRunId,
|
|
12
|
-
vizFilesToFileCollection,
|
|
13
|
-
} from '@vizhub/viz-utils';
|
|
10
|
+
import { generateRunId } from '@vizhub/viz-utils';
|
|
14
11
|
import JSZip from 'jszip';
|
|
15
12
|
|
|
16
13
|
export const createAICopyPasteHandlers = (
|
|
@@ -32,17 +29,25 @@ export const createAICopyPasteHandlers = (
|
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
// Apply truncation logic to reduce token usage
|
|
33
|
+
const { files: truncatedFiles, imageFiles } =
|
|
34
|
+
prepareFilesForPrompt(files);
|
|
37
35
|
|
|
38
|
-
// Format files for
|
|
36
|
+
// Format truncated files for markdown
|
|
39
37
|
const formattedFiles =
|
|
40
|
-
formatMarkdownFiles(
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
formatMarkdownFiles(truncatedFiles);
|
|
39
|
+
|
|
40
|
+
// Add metadata about skipped image files
|
|
41
|
+
let finalContent = formattedFiles;
|
|
42
|
+
if (imageFiles.length > 0) {
|
|
43
|
+
finalContent +=
|
|
44
|
+
'\n\n<!-- Image files (not included): ' +
|
|
45
|
+
imageFiles.join(', ') +
|
|
46
|
+
' -->';
|
|
47
|
+
}
|
|
43
48
|
|
|
44
49
|
// Copy to clipboard
|
|
45
|
-
await navigator.clipboard.writeText(
|
|
50
|
+
await navigator.clipboard.writeText(finalContent);
|
|
46
51
|
|
|
47
52
|
// Show success feedback
|
|
48
53
|
setCopyButtonText('Copied!');
|
|
@@ -84,16 +89,8 @@ export const createAICopyPasteHandlers = (
|
|
|
84
89
|
return;
|
|
85
90
|
}
|
|
86
91
|
|
|
87
|
-
// Preprocess to remove formatting instructions section to avoid creating extra files
|
|
88
|
-
const preprocessed = normalized
|
|
89
|
-
.split('## Formatting Instructions')[0]
|
|
90
|
-
.trim();
|
|
91
|
-
|
|
92
92
|
// Parse the markdown files format
|
|
93
|
-
const parsed = parseMarkdownFiles(
|
|
94
|
-
preprocessed,
|
|
95
|
-
'bold',
|
|
96
|
-
);
|
|
93
|
+
const parsed = parseMarkdownFiles(normalized, 'bold');
|
|
97
94
|
|
|
98
95
|
if (
|
|
99
96
|
parsed.files &&
|
package/src/ot.ts
CHANGED
|
@@ -3,7 +3,19 @@
|
|
|
3
3
|
// Localized to one file so it's easy to change it in future.
|
|
4
4
|
import OTJSON1Presence from 'sharedb-client-browser/dist/ot-json1-presence-umd.cjs';
|
|
5
5
|
import jsondiff from 'json0-ot-diff';
|
|
6
|
-
import
|
|
6
|
+
import {
|
|
7
|
+
diff_match_patch as DiffMatchPatch,
|
|
8
|
+
DIFF_DELETE,
|
|
9
|
+
DIFF_INSERT,
|
|
10
|
+
DIFF_EQUAL,
|
|
11
|
+
} from '@dmsnell/diff-match-patch';
|
|
12
|
+
|
|
13
|
+
// Attach the constants to the class as static properties for compatibility with json0-ot-diff
|
|
14
|
+
DiffMatchPatch.DIFF_DELETE = DIFF_DELETE;
|
|
15
|
+
DiffMatchPatch.DIFF_INSERT = DIFF_INSERT;
|
|
16
|
+
DiffMatchPatch.DIFF_EQUAL = DIFF_EQUAL;
|
|
17
|
+
|
|
18
|
+
const diffMatchPatch = DiffMatchPatch;
|
|
7
19
|
|
|
8
20
|
export const { json1Presence, textUnicode } =
|
|
9
21
|
OTJSON1Presence;
|
package/src/types.ts
CHANGED
|
@@ -265,16 +265,17 @@ export interface ExtendedVizChat extends VizChat {
|
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
// Extended VizChatMessage with progressive rendering support
|
|
268
|
-
export interface ExtendedVizChatMessage
|
|
269
|
-
extends VizChatMessage {
|
|
268
|
+
export interface ExtendedVizChatMessage extends VizChatMessage {
|
|
270
269
|
streamingEvents?: StreamingEvent[];
|
|
271
270
|
isProgressive?: boolean; // Flag to indicate this message uses progressive rendering
|
|
272
271
|
isComplete?: boolean; // Flag to indicate if streaming is complete
|
|
273
272
|
}
|
|
274
273
|
|
|
275
274
|
// Extended VizContent that uses our extended chat types
|
|
276
|
-
export interface ExtendedVizContent
|
|
277
|
-
|
|
275
|
+
export interface ExtendedVizContent extends Omit<
|
|
276
|
+
VizContent,
|
|
277
|
+
'chats'
|
|
278
|
+
> {
|
|
278
279
|
chats?: { [chatId: VizChatId]: ExtendedVizChat };
|
|
279
280
|
}
|
|
280
281
|
|