@midscene/core 0.18.1-beta-20250611082446.0 → 0.18.1

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 (36) hide show
  1. package/dist/es/ai-model.d.ts +52 -4
  2. package/dist/es/ai-model.js +9 -1
  3. package/dist/es/{chunk-D4ZWVRRG.js → chunk-A7OTPIZJ.js} +19 -6
  4. package/dist/es/chunk-A7OTPIZJ.js.map +1 -0
  5. package/dist/es/{chunk-X2UALJ3B.js → chunk-EYIL4AHP.js} +353 -3
  6. package/dist/es/chunk-EYIL4AHP.js.map +1 -0
  7. package/dist/es/index.d.ts +4 -4
  8. package/dist/es/index.js +19 -26
  9. package/dist/es/index.js.map +1 -1
  10. package/dist/es/{llm-planning-453ffce5.d.ts → llm-planning-a951deb9.d.ts} +2 -2
  11. package/dist/es/{types-00c9086f.d.ts → types-dce56c26.d.ts} +6 -6
  12. package/dist/es/utils.d.ts +1 -1
  13. package/dist/es/utils.js +1 -1
  14. package/dist/lib/ai-model.d.ts +52 -4
  15. package/dist/lib/ai-model.js +10 -2
  16. package/dist/lib/{chunk-D4ZWVRRG.js → chunk-A7OTPIZJ.js} +18 -5
  17. package/dist/lib/chunk-A7OTPIZJ.js.map +1 -0
  18. package/dist/lib/{chunk-X2UALJ3B.js → chunk-EYIL4AHP.js} +371 -21
  19. package/dist/lib/chunk-EYIL4AHP.js.map +1 -0
  20. package/dist/lib/index.d.ts +4 -4
  21. package/dist/lib/index.js +37 -44
  22. package/dist/lib/index.js.map +1 -1
  23. package/dist/lib/{llm-planning-453ffce5.d.ts → llm-planning-a951deb9.d.ts} +2 -2
  24. package/dist/{types/types-00c9086f.d.ts → lib/types-dce56c26.d.ts} +6 -6
  25. package/dist/lib/utils.d.ts +1 -1
  26. package/dist/lib/utils.js +2 -2
  27. package/dist/types/ai-model.d.ts +52 -4
  28. package/dist/types/index.d.ts +4 -4
  29. package/dist/types/{llm-planning-453ffce5.d.ts → llm-planning-a951deb9.d.ts} +2 -2
  30. package/dist/{lib/types-00c9086f.d.ts → types/types-dce56c26.d.ts} +6 -6
  31. package/dist/types/utils.d.ts +1 -1
  32. package/package.json +4 -3
  33. package/dist/es/chunk-D4ZWVRRG.js.map +0 -1
  34. package/dist/es/chunk-X2UALJ3B.js.map +0 -1
  35. package/dist/lib/chunk-D4ZWVRRG.js.map +0 -1
  36. package/dist/lib/chunk-X2UALJ3B.js.map +0 -1
@@ -1,13 +1,19 @@
1
- import { l as AIUsageInfo, T as PlanningAction, j as MidsceneYamlFlowItem } from './types-00c9086f.js';
1
+ import { l as AIUsageInfo, T as PlanningAction, j as MidsceneYamlFlowItem } from './types-dce56c26.js';
2
+ import OpenAI from 'openai';
2
3
  import { ChatCompletionMessageParam } from 'openai/resources';
3
4
  export { ChatCompletionMessageParam } from 'openai/resources';
4
- import { b as AIActionType } from './llm-planning-453ffce5.js';
5
- 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-453ffce5.js';
5
+ import { b as AIActionType } from './llm-planning-a951deb9.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-a951deb9.js';
6
7
  import { vlLocateMode } from '@midscene/shared/env';
8
+ import { ChromeRecordedEvent as ChromeRecordedEvent$1 } from '@midscene/recorder';
7
9
  import { actionParser } from '@ui-tars/action-parser';
8
10
  import { Size } from '@midscene/shared/types';
9
11
  import '@midscene/shared/constants';
10
12
 
13
+ declare function call(messages: ChatCompletionMessageParam[], AIActionTypeValue: AIActionType, responseFormat?: OpenAI.ChatCompletionCreateParams['response_format'] | OpenAI.ResponseFormatJSONObject): Promise<{
14
+ content: string;
15
+ usage?: AIUsageInfo;
16
+ }>;
11
17
  declare function callToGetJSONObject<T>(messages: ChatCompletionMessageParam[], AIActionTypeValue: AIActionType): Promise<{
12
18
  content: T;
13
19
  usage?: AIUsageInfo;
@@ -15,6 +21,48 @@ declare function callToGetJSONObject<T>(messages: ChatCompletionMessageParam[],
15
21
 
16
22
  declare function systemPromptToLocateElement(vlMode: ReturnType<typeof vlLocateMode>): string;
17
23
 
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
+ interface ChromeRecordedEvent {
38
+ type: string;
39
+ timestamp: number;
40
+ url?: string;
41
+ title?: string;
42
+ elementDescription?: string;
43
+ value?: string;
44
+ pageInfo?: any;
45
+ elementRect?: any;
46
+ screenshotBefore?: string;
47
+ screenshotAfter?: string;
48
+ screenshotWithBox?: string;
49
+ }
50
+ /**
51
+ * Generates Playwright test code from recorded events
52
+ */
53
+ declare const generatePlaywrightTest: (events: ChromeRecordedEvent[], options?: PlaywrightGenerationOptions) => Promise<string>;
54
+
55
+ interface YamlGenerationOptions {
56
+ testName?: string;
57
+ includeTimestamps?: boolean;
58
+ maxScreenshots?: number;
59
+ description?: string;
60
+ }
61
+ /**
62
+ * Generates YAML test configuration from recorded events using AI
63
+ */
64
+ declare const generateYamlTest: (events: ChromeRecordedEvent$1[], options?: YamlGenerationOptions) => Promise<string>;
65
+
18
66
  declare function vlmPlanning(options: {
19
67
  userInstruction: string;
20
68
  conversationHistory: ChatCompletionMessageParam[];
@@ -30,4 +78,4 @@ declare function vlmPlanning(options: {
30
78
  }>;
31
79
  declare function resizeImageForUiTars(imageBase64: string, size: Size): Promise<string>;
32
80
 
33
- export { callToGetJSONObject, resizeImageForUiTars, systemPromptToLocateElement, vlmPlanning };
81
+ export { AIActionType, call as callAi, callToGetJSONObject, generatePlaywrightTest, generateYamlTest, resizeImageForUiTars, systemPromptToLocateElement, vlmPlanning };
@@ -1,28 +1,36 @@
1
1
  import {
2
+ AIActionType,
2
3
  AiAssert,
3
4
  AiExtractElementInfo,
4
5
  AiLocateElement,
5
6
  AiLocateSection,
6
7
  adaptBboxToRect,
8
+ call,
7
9
  callAiFn,
8
10
  callToGetJSONObject,
9
11
  describeUserPage,
10
12
  elementByPositionWithElementInfo,
13
+ generatePlaywrightTest,
14
+ generateYamlTest,
11
15
  plan,
12
16
  resizeImageForUiTars,
13
17
  systemPromptToLocateElement,
14
18
  vlmPlanning
15
- } from "./chunk-X2UALJ3B.js";
19
+ } from "./chunk-EYIL4AHP.js";
16
20
  export {
21
+ AIActionType,
17
22
  AiAssert,
18
23
  AiExtractElementInfo,
19
24
  AiLocateElement,
20
25
  AiLocateSection,
21
26
  adaptBboxToRect,
27
+ call as callAi,
22
28
  callAiFn,
23
29
  callToGetJSONObject,
24
30
  describeUserPage,
25
31
  elementByPositionWithElementInfo,
32
+ generatePlaywrightTest,
33
+ generateYamlTest,
26
34
  plan,
27
35
  resizeImageForUiTars,
28
36
  systemPromptToLocateElement,