@midscene/core 0.21.4-beta-20250711063424.0 → 0.21.4-beta-20250715053831.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 (32) hide show
  1. package/dist/es/ai-model.d.ts +36 -24
  2. package/dist/es/ai-model.js +5 -1
  3. package/dist/es/{chunk-QT5OZCDN.js → chunk-NQHZHZRA.js} +408 -224
  4. package/dist/es/chunk-NQHZHZRA.js.map +1 -0
  5. package/dist/es/{chunk-2CMOAEAS.js → chunk-NSQ46QDR.js} +3 -3
  6. package/dist/es/index.d.ts +4 -4
  7. package/dist/es/index.js +2 -2
  8. package/dist/es/{llm-planning-fe687364.d.ts → llm-planning-b342ff86.d.ts} +1 -1
  9. package/dist/es/{types-b0b4c68e.d.ts → types-05553e39.d.ts} +32 -1
  10. package/dist/es/utils.d.ts +1 -1
  11. package/dist/es/utils.js +1 -1
  12. package/dist/lib/ai-model.d.ts +36 -24
  13. package/dist/lib/ai-model.js +6 -2
  14. package/dist/lib/{chunk-QT5OZCDN.js → chunk-NQHZHZRA.js} +417 -233
  15. package/dist/lib/chunk-NQHZHZRA.js.map +1 -0
  16. package/dist/lib/{chunk-2CMOAEAS.js → chunk-NSQ46QDR.js} +3 -3
  17. package/dist/lib/index.d.ts +4 -4
  18. package/dist/lib/index.js +12 -12
  19. package/dist/lib/{llm-planning-fe687364.d.ts → llm-planning-b342ff86.d.ts} +1 -1
  20. package/dist/lib/{types-b0b4c68e.d.ts → types-05553e39.d.ts} +32 -1
  21. package/dist/lib/utils.d.ts +1 -1
  22. package/dist/lib/utils.js +2 -2
  23. package/dist/types/ai-model.d.ts +36 -24
  24. package/dist/types/index.d.ts +4 -4
  25. package/dist/types/{llm-planning-fe687364.d.ts → llm-planning-b342ff86.d.ts} +1 -1
  26. package/dist/types/{types-b0b4c68e.d.ts → types-05553e39.d.ts} +32 -1
  27. package/dist/types/utils.d.ts +1 -1
  28. package/package.json +3 -3
  29. package/dist/es/chunk-QT5OZCDN.js.map +0 -1
  30. package/dist/lib/chunk-QT5OZCDN.js.map +0 -1
  31. /package/dist/es/{chunk-2CMOAEAS.js.map → chunk-NSQ46QDR.js.map} +0 -0
  32. /package/dist/lib/{chunk-2CMOAEAS.js.map → chunk-NSQ46QDR.js.map} +0 -0
@@ -1,18 +1,21 @@
1
- import { l as AIUsageInfo, T as PlanningAction, j as MidsceneYamlFlowItem } from './types-b0b4c68e.js';
1
+ import { ax as StreamingCallback, l as AIUsageInfo, aw as StreamingCodeGenerationOptions, az as StreamingAIResponse, T as PlanningAction, j as MidsceneYamlFlowItem } from './types-05553e39.js';
2
2
  import OpenAI from 'openai';
3
3
  import { ChatCompletionMessageParam } from 'openai/resources';
4
4
  export { ChatCompletionMessageParam } from 'openai/resources';
5
- import { b as AIActionType } from './llm-planning-fe687364.js';
6
- export { a as AiAssert, f as AiExtractElementInfo, A as AiLocateElement, g as AiLocateSection, h as adaptBboxToRect, c as callAiFn, d as describeUserPage, e as elementByPositionWithElementInfo, p as plan } from './llm-planning-fe687364.js';
5
+ import { b as AIActionType } from './llm-planning-b342ff86.js';
6
+ export { a as AiAssert, f as AiExtractElementInfo, A as AiLocateElement, g as AiLocateSection, h as adaptBboxToRect, c as callAiFn, d as describeUserPage, e as elementByPositionWithElementInfo, p as plan } from './llm-planning-b342ff86.js';
7
7
  import { vlLocateMode } from '@midscene/shared/env';
8
- import { ChromeRecordedEvent as ChromeRecordedEvent$1 } from '@midscene/recorder';
9
8
  import { actionParser } from '@ui-tars/action-parser';
10
9
  import { Size } from '@midscene/shared/types';
11
10
  import '@midscene/shared/constants';
12
11
 
13
- declare function call(messages: ChatCompletionMessageParam[], AIActionTypeValue: AIActionType, responseFormat?: OpenAI.ChatCompletionCreateParams['response_format'] | OpenAI.ResponseFormatJSONObject): Promise<{
12
+ declare function call(messages: ChatCompletionMessageParam[], AIActionTypeValue: AIActionType, responseFormat?: OpenAI.ChatCompletionCreateParams['response_format'] | OpenAI.ResponseFormatJSONObject, options?: {
13
+ stream?: boolean;
14
+ onChunk?: StreamingCallback;
15
+ }): Promise<{
14
16
  content: string;
15
17
  usage?: AIUsageInfo;
18
+ isStreamed: boolean;
16
19
  }>;
17
20
  declare function callToGetJSONObject<T>(messages: ChatCompletionMessageParam[], AIActionTypeValue: AIActionType): Promise<{
18
21
  content: T;
@@ -21,19 +24,6 @@ declare function callToGetJSONObject<T>(messages: ChatCompletionMessageParam[],
21
24
 
22
25
  declare function systemPromptToLocateElement(vlMode: ReturnType<typeof vlLocateMode>): string;
23
26
 
24
- interface PlaywrightGenerationOptions {
25
- testName?: string;
26
- includeScreenshots?: boolean;
27
- includeTimestamps?: boolean;
28
- maxScreenshots?: number;
29
- description?: string;
30
- viewportSize?: {
31
- width: number;
32
- height: number;
33
- };
34
- waitForNetworkIdle?: boolean;
35
- waitForNetworkIdleTimeout?: number;
36
- }
37
27
  interface ChromeRecordedEvent {
38
28
  type: string;
39
29
  timestamp: number;
@@ -47,21 +37,43 @@ interface ChromeRecordedEvent {
47
37
  screenshotAfter?: string;
48
38
  screenshotWithBox?: string;
49
39
  }
40
+ interface YamlGenerationOptions {
41
+ testName?: string;
42
+ includeTimestamps?: boolean;
43
+ maxScreenshots?: number;
44
+ description?: string;
45
+ }
50
46
  /**
51
- * Generates Playwright test code from recorded events
47
+ * Generates YAML test configuration from recorded events using AI
52
48
  */
53
- declare const generatePlaywrightTest: (events: ChromeRecordedEvent[], options?: PlaywrightGenerationOptions) => Promise<string>;
49
+ declare const generateYamlTest: (events: ChromeRecordedEvent[], options?: YamlGenerationOptions) => Promise<string>;
50
+ /**
51
+ * Generates YAML test configuration from recorded events using AI with streaming support
52
+ */
53
+ declare const generateYamlTestStream: (events: ChromeRecordedEvent[], options?: YamlGenerationOptions & StreamingCodeGenerationOptions) => Promise<StreamingAIResponse>;
54
54
 
55
- interface YamlGenerationOptions {
55
+ interface PlaywrightGenerationOptions {
56
56
  testName?: string;
57
+ includeScreenshots?: boolean;
57
58
  includeTimestamps?: boolean;
58
59
  maxScreenshots?: number;
59
60
  description?: string;
61
+ viewportSize?: {
62
+ width: number;
63
+ height: number;
64
+ };
65
+ waitForNetworkIdle?: boolean;
66
+ waitForNetworkIdleTimeout?: number;
60
67
  }
68
+
61
69
  /**
62
- * Generates YAML test configuration from recorded events using AI
70
+ * Generates Playwright test code from recorded events
71
+ */
72
+ declare const generatePlaywrightTest: (events: ChromeRecordedEvent[], options?: PlaywrightGenerationOptions) => Promise<string>;
73
+ /**
74
+ * Generates Playwright test code from recorded events with streaming support
63
75
  */
64
- declare const generateYamlTest: (events: ChromeRecordedEvent$1[], options?: YamlGenerationOptions) => Promise<string>;
76
+ declare const generatePlaywrightTestStream: (events: ChromeRecordedEvent[], options?: PlaywrightGenerationOptions & StreamingCodeGenerationOptions) => Promise<StreamingAIResponse>;
65
77
 
66
78
  declare function vlmPlanning(options: {
67
79
  userInstruction: string;
@@ -78,4 +90,4 @@ declare function vlmPlanning(options: {
78
90
  }>;
79
91
  declare function resizeImageForUiTars(imageBase64: string, size: Size): Promise<string>;
80
92
 
81
- export { AIActionType, call as callAi, callToGetJSONObject, generatePlaywrightTest, generateYamlTest, resizeImageForUiTars, systemPromptToLocateElement, vlmPlanning };
93
+ export { AIActionType, call as callAi, callToGetJSONObject, generatePlaywrightTest, generatePlaywrightTestStream, generateYamlTest, generateYamlTestStream, resizeImageForUiTars, systemPromptToLocateElement, vlmPlanning };
@@ -11,12 +11,14 @@ import {
11
11
  describeUserPage,
12
12
  elementByPositionWithElementInfo,
13
13
  generatePlaywrightTest,
14
+ generatePlaywrightTestStream,
14
15
  generateYamlTest,
16
+ generateYamlTestStream,
15
17
  plan,
16
18
  resizeImageForUiTars,
17
19
  systemPromptToLocateElement,
18
20
  vlmPlanning
19
- } from "./chunk-QT5OZCDN.js";
21
+ } from "./chunk-NQHZHZRA.js";
20
22
  export {
21
23
  AIActionType,
22
24
  AiAssert,
@@ -30,7 +32,9 @@ export {
30
32
  describeUserPage,
31
33
  elementByPositionWithElementInfo,
32
34
  generatePlaywrightTest,
35
+ generatePlaywrightTestStream,
33
36
  generateYamlTest,
37
+ generateYamlTestStream,
34
38
  plan,
35
39
  resizeImageForUiTars,
36
40
  systemPromptToLocateElement,