@midscene/core 0.26.2-beta-20250812091127.0 → 0.26.3-beta-20250813021342.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 (47) hide show
  1. package/dist/es/ai-model.mjs +2502 -0
  2. package/dist/es/ai-model.mjs.map +1 -0
  3. package/dist/es/index.mjs +2362 -0
  4. package/dist/es/index.mjs.map +1 -0
  5. package/dist/es/tree.mjs +2 -0
  6. package/dist/es/utils.mjs +188 -0
  7. package/dist/es/{chunk-WXNDYUNG.js.map → utils.mjs.map} +1 -1
  8. package/dist/lib/ai-model.js +2581 -3
  9. package/dist/lib/ai-model.js.map +1 -0
  10. package/dist/lib/index.js +2375 -493
  11. package/dist/lib/index.js.map +1 -1
  12. package/dist/lib/tree.js +42 -11
  13. package/dist/lib/tree.js.map +1 -1
  14. package/dist/lib/utils.js +257 -29
  15. package/dist/lib/utils.js.map +1 -0
  16. package/dist/types/ai-model.d.ts +505 -99
  17. package/dist/types/index.d.ts +1299 -53
  18. package/dist/types/tree.d.ts +11 -1
  19. package/dist/types/utils.d.ts +47 -33
  20. package/package.json +28 -12
  21. package/dist/es/ai-model.d.ts +0 -99
  22. package/dist/es/ai-model.js +0 -44
  23. package/dist/es/chunk-DDYIQHOA.js +0 -2883
  24. package/dist/es/chunk-DDYIQHOA.js.map +0 -1
  25. package/dist/es/chunk-WXNDYUNG.js +0 -265
  26. package/dist/es/index.d.ts +0 -53
  27. package/dist/es/index.js +0 -570
  28. package/dist/es/index.js.map +0 -1
  29. package/dist/es/llm-planning-4e0c16fe.d.ts +0 -106
  30. package/dist/es/tree.d.ts +0 -1
  31. package/dist/es/tree.js +0 -13
  32. package/dist/es/tree.js.map +0 -1
  33. package/dist/es/types-8a6be57c.d.ts +0 -577
  34. package/dist/es/utils.d.ts +0 -33
  35. package/dist/es/utils.js +0 -30
  36. package/dist/lib/ai-model.d.ts +0 -99
  37. package/dist/lib/chunk-DDYIQHOA.js +0 -2883
  38. package/dist/lib/chunk-DDYIQHOA.js.map +0 -1
  39. package/dist/lib/chunk-WXNDYUNG.js +0 -265
  40. package/dist/lib/chunk-WXNDYUNG.js.map +0 -1
  41. package/dist/lib/index.d.ts +0 -53
  42. package/dist/lib/llm-planning-4e0c16fe.d.ts +0 -106
  43. package/dist/lib/tree.d.ts +0 -1
  44. package/dist/lib/types-8a6be57c.d.ts +0 -577
  45. package/dist/lib/utils.d.ts +0 -33
  46. package/dist/types/llm-planning-4e0c16fe.d.ts +0 -106
  47. package/dist/types/types-8a6be57c.d.ts +0 -577
@@ -1,99 +0,0 @@
1
- import { aD as StreamingCallback, A as AIUsageInfo, aC as StreamingCodeGenerationOptions, aF as StreamingAIResponse, Y as PlanningAction, m as MidsceneYamlFlowItem } from './types-8a6be57c.js';
2
- import OpenAI from 'openai';
3
- import { ChatCompletionMessageParam } from 'openai/resources';
4
- export { ChatCompletionMessageParam } from 'openai/resources';
5
- import { b as AIActionType, e as AIArgs } from './llm-planning-4e0c16fe.js';
6
- export { a as AiAssert, g as AiExtractElementInfo, A as AiLocateElement, h as AiLocateSection, i as adaptBboxToRect, c as callAiFn, d as describeUserPage, f as elementByPositionWithElementInfo, p as plan } from './llm-planning-4e0c16fe.js';
7
- import { vlLocateMode } from '@midscene/shared/env';
8
- import { actionParser } from '@ui-tars/action-parser';
9
- import { Size } from '@midscene/shared/types';
10
- import '@midscene/shared/constants';
11
-
12
- declare function call(messages: ChatCompletionMessageParam[], AIActionTypeValue: AIActionType, responseFormat?: OpenAI.ChatCompletionCreateParams['response_format'] | OpenAI.ResponseFormatJSONObject, options?: {
13
- stream?: boolean;
14
- onChunk?: StreamingCallback;
15
- }): Promise<{
16
- content: string;
17
- usage?: AIUsageInfo;
18
- isStreamed: boolean;
19
- }>;
20
- declare function callToGetJSONObject<T>(messages: ChatCompletionMessageParam[], AIActionTypeValue: AIActionType): Promise<{
21
- content: T;
22
- usage?: AIUsageInfo;
23
- }>;
24
- declare function callAiFnWithStringResponse<T>(msgs: AIArgs, AIActionTypeValue: AIActionType): Promise<{
25
- content: string;
26
- usage?: AIUsageInfo;
27
- }>;
28
-
29
- declare function systemPromptToLocateElement(vlMode: ReturnType<typeof vlLocateMode>): string;
30
-
31
- interface ChromeRecordedEvent {
32
- type: string;
33
- timestamp: number;
34
- url?: string;
35
- title?: string;
36
- elementDescription?: string;
37
- value?: string;
38
- pageInfo?: any;
39
- elementRect?: any;
40
- screenshotBefore?: string;
41
- screenshotAfter?: string;
42
- screenshotWithBox?: string;
43
- }
44
- interface YamlGenerationOptions {
45
- testName?: string;
46
- includeTimestamps?: boolean;
47
- maxScreenshots?: number;
48
- description?: string;
49
- }
50
- /**
51
- * Generates YAML test configuration from recorded events using AI
52
- */
53
- declare const generateYamlTest: (events: ChromeRecordedEvent[], options?: YamlGenerationOptions) => Promise<string>;
54
- /**
55
- * Generates YAML test configuration from recorded events using AI with streaming support
56
- */
57
- declare const generateYamlTestStream: (events: ChromeRecordedEvent[], options?: YamlGenerationOptions & StreamingCodeGenerationOptions) => Promise<StreamingAIResponse>;
58
-
59
- interface PlaywrightGenerationOptions {
60
- testName?: string;
61
- includeScreenshots?: boolean;
62
- includeTimestamps?: boolean;
63
- maxScreenshots?: number;
64
- description?: string;
65
- viewportSize?: {
66
- width: number;
67
- height: number;
68
- };
69
- waitForNetworkIdle?: boolean;
70
- waitForNetworkIdleTimeout?: number;
71
- }
72
-
73
- /**
74
- * Generates Playwright test code from recorded events
75
- */
76
- declare const generatePlaywrightTest: (events: ChromeRecordedEvent[], options?: PlaywrightGenerationOptions) => Promise<string>;
77
- /**
78
- * Generates Playwright test code from recorded events with streaming support
79
- */
80
- declare const generatePlaywrightTestStream: (events: ChromeRecordedEvent[], options?: PlaywrightGenerationOptions & StreamingCodeGenerationOptions) => Promise<StreamingAIResponse>;
81
-
82
- declare function vlmPlanning(options: {
83
- userInstruction: string;
84
- conversationHistory: ChatCompletionMessageParam[];
85
- size: {
86
- width: number;
87
- height: number;
88
- };
89
- }): Promise<{
90
- actions: PlanningAction<any>[];
91
- actionsFromModel: ReturnType<typeof actionParser>['parsed'];
92
- action_summary: string;
93
- yamlFlow?: MidsceneYamlFlowItem[];
94
- usage?: AIUsageInfo;
95
- rawResponse?: string;
96
- }>;
97
- declare function resizeImageForUiTars(imageBase64: string, size: Size): Promise<string>;
98
-
99
- export { AIActionType, AIArgs, call as callAi, callAiFnWithStringResponse, callToGetJSONObject, generatePlaywrightTest, generatePlaywrightTestStream, generateYamlTest, generateYamlTestStream, resizeImageForUiTars, systemPromptToLocateElement, vlmPlanning };