vzcode 1.40.0 → 1.42.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 (35) hide show
  1. package/dist/assets/bindings_wasm_bg-BQfW5T_2.wasm +0 -0
  2. package/dist/assets/buildWorker-B-vXZ9gA.js +579 -0
  3. package/dist/assets/{index-DKLiE98a.css → index-CP9o_hN5.css} +1 -1
  4. package/dist/assets/index-kPLgjbcb.js +329 -0
  5. package/dist/index.html +2 -2
  6. package/package.json +17 -16
  7. package/src/client/App/style.scss +2 -2
  8. package/src/client/CodeEditor/getOrCreateEditor.ts +2 -5
  9. package/src/client/CodeEditor/index.tsx +1 -1
  10. package/src/client/CodeEditor/json1PresenceDisplay.ts +40 -12
  11. package/src/client/VZRight.tsx +68 -6
  12. package/src/client/VZSidebar/AIChat/ChatInput.tsx +17 -5
  13. package/src/client/VZSidebar/AIChat/Message.tsx +21 -8
  14. package/src/client/VZSidebar/AIChat/MessageList.tsx +29 -31
  15. package/src/client/VZSidebar/AIChat/StreamingMessage.tsx +6 -1
  16. package/src/client/VZSidebar/AIChat/TypingIndicator.tsx +7 -1
  17. package/src/client/VZSidebar/AIChat/index.tsx +22 -9
  18. package/src/client/VZSidebar/aiCopyPaste.ts +8 -1
  19. package/src/client/VZSidebar/index.tsx +10 -8
  20. package/src/client/buildWorker.ts +3 -0
  21. package/src/client/vzReducer/searchReducer.test.ts +250 -0
  22. package/src/client/vzReducer/searchReducer.ts +3 -1
  23. package/src/{ot.js → ot.ts} +11 -0
  24. package/src/runCode.ts +4 -23
  25. package/src/server/aiChatHandler/aiEditing.ts +10 -7
  26. package/src/server/aiChatHandler/chatOperations.ts +144 -58
  27. package/src/server/aiChatHandler/errorHandling.ts +1 -1
  28. package/src/server/aiChatHandler/index.ts +8 -2
  29. package/src/server/aiChatHandler/llmStreaming.ts +83 -44
  30. package/src/submitOperation.ts +1 -1
  31. package/dist/assets/index-ubSLcdJf.js +0 -327
  32. package/src/client/diff.js +0 -12
  33. package/src/runCode.js +0 -48
  34. package/src/submitOperation.js +0 -16
  35. /package/src/{randomId.js → randomId.ts} +0 -0
@@ -1,12 +0,0 @@
1
- import jsondiff from 'json0-ot-diff';
2
- import diffMatchPatch from 'diff-match-patch';
3
- import { json1Presence, textUnicode } from '../ot.js';
4
-
5
- export const diff = (a, b) =>
6
- jsondiff(
7
- a,
8
- b,
9
- diffMatchPatch,
10
- json1Presence,
11
- textUnicode,
12
- );
package/src/runCode.js DELETED
@@ -1,48 +0,0 @@
1
- import { createSubmitOperation } from './submitOperation.js';
2
- // TODO migrate the server-side code to use TypeScript,
3
- // and delete this file once the migration is complete (use src/runCode.ts instead).
4
- /**
5
- * Creates a runCode function that triggers code execution by flashing `isInteracting` to `true`.
6
- * This works for both client-side (with submitOperation) and server-side (with ShareDB document).
7
- */
8
- export const createRunCodeFunction = (
9
- submitOperationOrDoc,
10
- ) => {
11
- return () => {
12
- let submitOperation;
13
-
14
- // Check if this is a client-side submitOperation or server-side ShareDB document
15
- if (typeof submitOperationOrDoc === 'function') {
16
- // Client-side: already a submitOperation function
17
- submitOperation = submitOperationOrDoc;
18
- } else {
19
- // Server-side: create submitOperation from ShareDB document
20
- submitOperation = createSubmitOperation(
21
- submitOperationOrDoc,
22
- );
23
- }
24
-
25
- // Use the unified submitOperation approach for both client and server
26
- submitOperation((content) => ({
27
- ...content,
28
- isInteracting: true,
29
- }));
30
-
31
- setTimeout(() => {
32
- submitOperation((content) => ({
33
- ...content,
34
- isInteracting: false,
35
- }));
36
- }, 0);
37
- };
38
- };
39
-
40
- /**
41
- * Creates a runCodeRef object compatible with React refs.
42
- * This is useful for maintaining compatibility with existing code that expects a ref.
43
- */
44
- export const createRunCodeRef = (submitOperationOrDoc) => {
45
- return {
46
- current: createRunCodeFunction(submitOperationOrDoc),
47
- };
48
- };
@@ -1,16 +0,0 @@
1
- import { diff } from './client/diff.js';
2
- // TODO migrate the server-side code to use TypeScript,
3
- // and delete this file once the migration is complete (use src/submitOperation.ts instead).
4
- /**
5
- * Creates a submitOperation function that can be used to submit diff-based operations to ShareDB.
6
- * This is the core logic extracted from useSubmitOperation for reuse across client and server.
7
- */
8
- export const createSubmitOperation = (shareDBDoc) => {
9
- return (next) => {
10
- const data = shareDBDoc.data;
11
- const op = diff(data, next(data));
12
- if (op && shareDBDoc) {
13
- shareDBDoc.submitOp(op);
14
- }
15
- };
16
- };
File without changes