@lvce-editor/test-worker 13.16.0 → 13.18.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/api.d.ts CHANGED
@@ -58,6 +58,10 @@ export interface DroppedFileHandle {
58
58
  readonly id: number;
59
59
  }
60
60
 
61
+ export interface MockResponseOptions {
62
+ readonly text: string;
63
+ }
64
+
61
65
  export interface MockOpenAiResponseOptions {
62
66
  readonly status: number;
63
67
  readonly value: any;
@@ -145,6 +149,7 @@ interface Chat {
145
149
  readonly handleClickNew: () => Promise<void>;
146
150
  readonly handleClickSessionDebug: () => Promise<void>;
147
151
  readonly handleClickSettings: () => Promise<void>;
152
+ readonly handleContextMenuChatImageAttachment: (id: string, x: number, y: number) => Promise<void>;
148
153
  readonly handleDropFiles: (file: DroppedFileHandle) => Promise<void>;
149
154
  readonly handleInput: (text: string) => Promise<void>;
150
155
  readonly handleInputCopy: () => Promise<void>;
@@ -167,6 +172,7 @@ interface Chat {
167
172
  readonly openGitBranchPicker: () => Promise<void>;
168
173
  readonly openMockSession: (sessionId: string, messages: readonly any[]) => Promise<void>;
169
174
  readonly openModelPicker: () => Promise<void>;
175
+ readonly registerMockResponse: (options: MockResponseOptions) => Promise<void>;
170
176
  readonly rerender: () => Promise<void>;
171
177
  readonly reset: () => Promise<void>;
172
178
  readonly selectIndex: (index: number) => Promise<void>;
@@ -362,6 +368,7 @@ interface Explorer {
362
368
  readonly handleDragOver: (x: number, y: number) => Promise<void>;
363
369
  readonly handleDragOverIndex: (index: number) => Promise<void>;
364
370
  readonly handleDrop: (x: number, y: number, fileIds: readonly number[], fileList: FileList | readonly File[]) => Promise<void>;
371
+ readonly handleDropIndex: (fileHandles: readonly FileSystemHandle[], files: readonly any[], paths: readonly string[], index: number) => Promise<void>;
365
372
  readonly handleEscape: () => Promise<void>;
366
373
  readonly handleInputBlur: () => Promise<void>;
367
374
  readonly handlePaste: () => Promise<void>;
@@ -427,7 +434,7 @@ interface ExtensionSearch {
427
434
  }
428
435
 
429
436
  interface FileSystem {
430
- readonly addFileHandle: (file: File) => Promise<void>;
437
+ readonly addFileHandle: (file: File | FileSystemHandle) => Promise<void>;
431
438
  readonly chmod: (uri: string, permissions: any) => Promise<void>;
432
439
  readonly createDroppedFileHandle: () => Promise<DroppedFileHandle>;
433
440
  readonly createExecutable: (content: string) => Promise<string>;
@@ -503,6 +510,11 @@ interface KeyBoard {
503
510
  readonly press: (key: string) => Promise<void>;
504
511
  }
505
512
 
513
+ interface Layout {
514
+ readonly handleWorkspaceRefresh: () => Promise<void>;
515
+ readonly showSideBar: () => Promise<void>;
516
+ }
517
+
506
518
  interface LanguageModels {
507
519
  readonly addModel: () => Promise<void>;
508
520
  readonly clearFilterInput: () => Promise<void>;
@@ -759,6 +771,7 @@ export interface TestApi {
759
771
  readonly IframeInspector: IframeInspector
760
772
  readonly KeyBindingsEditor: KeyBindingsEditor
761
773
  readonly KeyBoard: KeyBoard
774
+ readonly Layout: Layout
762
775
  readonly LanguageModels: LanguageModels
763
776
  readonly Main: Main
764
777
  readonly Open: Open
@@ -1812,6 +1812,9 @@ const mockOpenApiStreamPushChunk = async chunk => {
1812
1812
  const openMockSession = async (sessionId, messages) => {
1813
1813
  await invoke$1('Chat.openMockSession', sessionId, messages);
1814
1814
  };
1815
+ const registerMockResponse = async options => {
1816
+ await invoke$1('Chat.registerMockResponse', options);
1817
+ };
1815
1818
  const handleSubmit = async () => {
1816
1819
  await invoke$1('Chat.handleSubmit');
1817
1820
  };
@@ -1854,6 +1857,9 @@ const openModelPicker = async () => {
1854
1857
  const handleClickDelete = async () => {
1855
1858
  await invoke$1('Chat.handleClickDelete');
1856
1859
  };
1860
+ const handleContextMenuChatImageAttachment = async (id, x, y) => {
1861
+ await invoke$1('Chat.handleContextMenuChatImageAttachment', id, x, y);
1862
+ };
1857
1863
  const setAddContextButtonEnabled = async enabled => {
1858
1864
  await invoke$1('Chat.setAddContextButtonEnabled', enabled);
1859
1865
  };
@@ -1917,6 +1923,7 @@ const Chat = {
1917
1923
  handleClickNew,
1918
1924
  handleClickSessionDebug,
1919
1925
  handleClickSettings,
1926
+ handleContextMenuChatImageAttachment,
1920
1927
  handleDropFiles,
1921
1928
  handleInput: handleInput$7,
1922
1929
  handleInputCopy: handleInputCopy$1,
@@ -1939,6 +1946,7 @@ const Chat = {
1939
1946
  openGitBranchPicker,
1940
1947
  openMockSession,
1941
1948
  openModelPicker,
1949
+ registerMockResponse,
1942
1950
  rerender,
1943
1951
  reset,
1944
1952
  selectIndex: selectIndex$7,
@@ -2627,6 +2635,9 @@ const handleBlur = async () => {
2627
2635
  const handleEscape = async () => {
2628
2636
  await invoke$1('Explorer.handleEscape');
2629
2637
  };
2638
+ const handleDropIndex = async (fileHandles, files, paths, index) => {
2639
+ await invoke$1('Explorer.handleDropIndex', fileHandles, files, paths, index);
2640
+ };
2630
2641
  const handleInputBlur = async () => {
2631
2642
  await invoke$1('Explorer.handleInputBlur');
2632
2643
  };
@@ -2760,6 +2771,7 @@ const Explorer = {
2760
2771
  handleDragOver,
2761
2772
  handleDragOverIndex,
2762
2773
  handleDrop,
2774
+ handleDropIndex,
2763
2775
  handleEscape,
2764
2776
  handleInputBlur,
2765
2777
  handlePaste,
@@ -3394,6 +3406,18 @@ const KeyBoard = {
3394
3406
  press
3395
3407
  };
3396
3408
 
3409
+ const showSideBar = async () => {
3410
+ await execute$1('Layout.showSideBar');
3411
+ };
3412
+ const handleWorkspaceRefresh = async () => {
3413
+ await invoke$1('Layout.handleWorkspaceRefresh');
3414
+ };
3415
+
3416
+ const Layout = {
3417
+ handleWorkspaceRefresh,
3418
+ showSideBar
3419
+ };
3420
+
3397
3421
  const open$4 = async () => {
3398
3422
  await invoke$1('Main.openUri', 'language-models:///1');
3399
3423
  };
@@ -4326,6 +4350,7 @@ const createApi = (platform, assetDir) => {
4326
4350
  KeyBindingsEditor,
4327
4351
  KeyBoard,
4328
4352
  LanguageModels,
4353
+ Layout,
4329
4354
  Locator: createLocator,
4330
4355
  Main,
4331
4356
  Open,
@@ -4506,14 +4531,20 @@ const execute = async (href, platform, assetDir) => {
4506
4531
  setUrl(scriptUrl); // TODO avoid side effect
4507
4532
  // 2. import that script
4508
4533
  const module = await importTest(scriptUrl);
4509
- if (module.mockRpc) {
4510
- setMockRpc(module.mockRpc);
4511
- }
4512
- if (module.test) {
4513
- if (module.skip) {
4514
- await skipTest(module.name);
4534
+ const {
4535
+ mockRpc,
4536
+ name,
4537
+ skip,
4538
+ test
4539
+ } = module;
4540
+ if (mockRpc) {
4541
+ setMockRpc(mockRpc);
4542
+ }
4543
+ if (test) {
4544
+ if (skip) {
4545
+ await skipTest(name);
4515
4546
  } else {
4516
- await executeTest(module.name, module.test, globals);
4547
+ await executeTest(name, test, globals);
4517
4548
  }
4518
4549
  }
4519
4550
  // TODO maybe setup file watcher earlier, to not miss events?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/test-worker",
3
- "version": "13.16.0",
3
+ "version": "13.18.0",
4
4
  "description": "Test Worker",
5
5
  "repository": {
6
6
  "type": "git",