@midscene/core 0.21.3 → 0.21.4-beta-20250714025212.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-H3KP5MGB.js} +407 -219
  4. package/dist/es/chunk-H3KP5MGB.js.map +1 -0
  5. package/dist/es/{chunk-YP5EQR3O.js → chunk-QKX52XS3.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-H3KP5MGB.js} +421 -233
  15. package/dist/lib/chunk-H3KP5MGB.js.map +1 -0
  16. package/dist/lib/{chunk-YP5EQR3O.js → chunk-QKX52XS3.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-YP5EQR3O.js.map → chunk-QKX52XS3.js.map} +0 -0
  32. /package/dist/lib/{chunk-YP5EQR3O.js.map → chunk-QKX52XS3.js.map} +0 -0
@@ -1,7 +1,7 @@
1
- import { E as ExecutionTask, a as ExecutionTaskProgressOptions, b as ExecutionTaskApply, c as ExecutionDump, U as UIContext, I as InsightAction, D as DumpSubscriber, d as InsightTaskInfo, e as InsightOptions, f as DetailedLocateParam, L as LocateResult, g as InsightExtractOption, h as InsightAssertionResponse, A as AIDescribeElementResponse } from './types-b0b4c68e.js';
2
- export { v as AIAssertionResponse, t as AIDataExtractionResponse, r as AIElementCoordinatesResponse, q as AIElementLocatorResponse, s as AIElementResponse, m as AIResponseFormat, u as AISectionLocatorResponse, p as AISingleElementResponse, n as AISingleElementResponseById, o as AISingleElementResponseByPosition, l as AIUsageInfo, Q as AgentAssertOpt, y as AgentDescribeElementAtPointResult, N as AgentWaitForOpt, a4 as BaseAgentParserOpt, C as CallAIFn, a3 as Color, G as DumpMeta, K as ElementById, z as EnsureObject, a7 as ExecutionRecorderItem, ap as ExecutionTaskAction, ao as ExecutionTaskActionApply, aa as ExecutionTaskHitBy, an as ExecutionTaskInsightAssertion, am as ExecutionTaskInsightAssertionApply, al as ExecutionTaskInsightAssertionParam, ae as ExecutionTaskInsightDumpLog, ag as ExecutionTaskInsightLocate, af as ExecutionTaskInsightLocateApply, ad as ExecutionTaskInsightLocateOutput, ac as ExecutionTaskInsightLocateParam, ak as ExecutionTaskInsightQuery, aj as ExecutionTaskInsightQueryApply, ai as ExecutionTaskInsightQueryOutput, ah as ExecutionTaskInsightQueryParam, ar as ExecutionTaskLog, aq as ExecutionTaskLogApply, at as ExecutionTaskPlanning, as as ExecutionTaskPlanningApply, ab as ExecutionTaskReturn, a8 as ExecutionTaskType, a9 as ExecutorContext, aU as FreeFn, au as GroupedActionDump, H as InsightDump, B as InsightExtractParam, J as LiteUISection, aw as LocateOption, F as LocateResultElement, x as LocateValidatorResult, w as LocatorValidatorOption, j as MidsceneYamlFlowItem, aD as MidsceneYamlFlowItemAIAction, aI as MidsceneYamlFlowItemAIAsk, aE as MidsceneYamlFlowItemAIAssert, aJ as MidsceneYamlFlowItemAIBoolean, aN as MidsceneYamlFlowItemAIHover, aO as MidsceneYamlFlowItemAIInput, aP as MidsceneYamlFlowItemAIKeyboardPress, aK as MidsceneYamlFlowItemAILocate, aG as MidsceneYamlFlowItemAINumber, aF as MidsceneYamlFlowItemAIQuery, k as MidsceneYamlFlowItemAIRightClick, aQ as MidsceneYamlFlowItemAIScroll, aH as MidsceneYamlFlowItemAIString, aM as MidsceneYamlFlowItemAITap, aL as MidsceneYamlFlowItemAIWaitFor, aR as MidsceneYamlFlowItemEvaluateJavaScript, aT as MidsceneYamlFlowItemLogScreenshot, aS as MidsceneYamlFlowItemSleep, M as MidsceneYamlScript, aB as MidsceneYamlScriptAndroidEnv, aC as MidsceneYamlScriptEnv, az as MidsceneYamlScriptEnvBase, aA as MidsceneYamlScriptWebEnv, i as MidsceneYamlTask, O as OnTaskStartTip, av as PageType, P as PartialInsightDumpFromSDK, V as PlanningAIResponse, T as PlanningAction, $ as PlanningActionParamAssert, a1 as PlanningActionParamError, X as PlanningActionParamHover, Z as PlanningActionParamInputOrKeyPress, Y as PlanningActionParamRightClick, _ as PlanningActionParamScroll, a0 as PlanningActionParamSleep, W as PlanningActionParamTap, a2 as PlanningActionParamWaitFor, S as PlanningLocateParam, a6 as PlaywrightParserOpt, a5 as PuppeteerParserOpt, ax as ReferenceImage, R as ReportDumpWithAttributes, aW as ScriptPlayerStatusValue, aV as ScriptPlayerTaskStatus, ay as scrollParam } from './types-b0b4c68e.js';
3
- import { c as callAiFn } from './llm-planning-fe687364.js';
4
- export { a as AiAssert, A as AiLocateElement, d as describeUserPage, p as plan } from './llm-planning-fe687364.js';
1
+ import { E as ExecutionTask, a as ExecutionTaskProgressOptions, b as ExecutionTaskApply, c as ExecutionDump, U as UIContext, I as InsightAction, D as DumpSubscriber, d as InsightTaskInfo, e as InsightOptions, f as DetailedLocateParam, L as LocateResult, g as InsightExtractOption, h as InsightAssertionResponse, A as AIDescribeElementResponse } from './types-05553e39.js';
2
+ export { v as AIAssertionResponse, t as AIDataExtractionResponse, r as AIElementCoordinatesResponse, q as AIElementLocatorResponse, s as AIElementResponse, m as AIResponseFormat, u as AISectionLocatorResponse, p as AISingleElementResponse, n as AISingleElementResponseById, o as AISingleElementResponseByPosition, l as AIUsageInfo, Q as AgentAssertOpt, y as AgentDescribeElementAtPointResult, N as AgentWaitForOpt, a4 as BaseAgentParserOpt, C as CallAIFn, ay as CodeGenerationChunk, a3 as Color, G as DumpMeta, K as ElementById, z as EnsureObject, a7 as ExecutionRecorderItem, ap as ExecutionTaskAction, ao as ExecutionTaskActionApply, aa as ExecutionTaskHitBy, an as ExecutionTaskInsightAssertion, am as ExecutionTaskInsightAssertionApply, al as ExecutionTaskInsightAssertionParam, ae as ExecutionTaskInsightDumpLog, ag as ExecutionTaskInsightLocate, af as ExecutionTaskInsightLocateApply, ad as ExecutionTaskInsightLocateOutput, ac as ExecutionTaskInsightLocateParam, ak as ExecutionTaskInsightQuery, aj as ExecutionTaskInsightQueryApply, ai as ExecutionTaskInsightQueryOutput, ah as ExecutionTaskInsightQueryParam, ar as ExecutionTaskLog, aq as ExecutionTaskLogApply, at as ExecutionTaskPlanning, as as ExecutionTaskPlanningApply, ab as ExecutionTaskReturn, a8 as ExecutionTaskType, a9 as ExecutorContext, aY as FreeFn, au as GroupedActionDump, H as InsightDump, B as InsightExtractParam, J as LiteUISection, aA as LocateOption, F as LocateResultElement, x as LocateValidatorResult, w as LocatorValidatorOption, j as MidsceneYamlFlowItem, aH as MidsceneYamlFlowItemAIAction, aM as MidsceneYamlFlowItemAIAsk, aI as MidsceneYamlFlowItemAIAssert, aN as MidsceneYamlFlowItemAIBoolean, aR as MidsceneYamlFlowItemAIHover, aS as MidsceneYamlFlowItemAIInput, aT as MidsceneYamlFlowItemAIKeyboardPress, aO as MidsceneYamlFlowItemAILocate, aK as MidsceneYamlFlowItemAINumber, aJ as MidsceneYamlFlowItemAIQuery, k as MidsceneYamlFlowItemAIRightClick, aU as MidsceneYamlFlowItemAIScroll, aL as MidsceneYamlFlowItemAIString, aQ as MidsceneYamlFlowItemAITap, aP as MidsceneYamlFlowItemAIWaitFor, aV as MidsceneYamlFlowItemEvaluateJavaScript, aX as MidsceneYamlFlowItemLogScreenshot, aW as MidsceneYamlFlowItemSleep, M as MidsceneYamlScript, aF as MidsceneYamlScriptAndroidEnv, aG as MidsceneYamlScriptEnv, aD as MidsceneYamlScriptEnvBase, aE as MidsceneYamlScriptWebEnv, i as MidsceneYamlTask, O as OnTaskStartTip, av as PageType, P as PartialInsightDumpFromSDK, V as PlanningAIResponse, T as PlanningAction, $ as PlanningActionParamAssert, a1 as PlanningActionParamError, X as PlanningActionParamHover, Z as PlanningActionParamInputOrKeyPress, Y as PlanningActionParamRightClick, _ as PlanningActionParamScroll, a0 as PlanningActionParamSleep, W as PlanningActionParamTap, a2 as PlanningActionParamWaitFor, S as PlanningLocateParam, a6 as PlaywrightParserOpt, a5 as PuppeteerParserOpt, aB as ReferenceImage, R as ReportDumpWithAttributes, a_ as ScriptPlayerStatusValue, aZ as ScriptPlayerTaskStatus, az as StreamingAIResponse, ax as StreamingCallback, aw as StreamingCodeGenerationOptions, aC as scrollParam } from './types-05553e39.js';
3
+ import { c as callAiFn } from './llm-planning-b342ff86.js';
4
+ export { a as AiAssert, A as AiLocateElement, d as describeUserPage, p as plan } from './llm-planning-b342ff86.js';
5
5
  import { BaseElement, Rect } from '@midscene/shared/types';
6
6
  export { BaseElement, ElementTreeNode, Point, Rect, Size } from '@midscene/shared/types';
7
7
  export { getVersion } from './utils.js';
package/dist/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getVersion
3
- } from "./chunk-YP5EQR3O.js";
3
+ } from "./chunk-QKX52XS3.js";
4
4
  import {
5
5
  AiAssert,
6
6
  AiExtractElementInfo,
@@ -11,7 +11,7 @@ import {
11
11
  describeUserPage,
12
12
  expandSearchArea,
13
13
  plan
14
- } from "./chunk-QT5OZCDN.js";
14
+ } from "./chunk-H3KP5MGB.js";
15
15
 
16
16
  // src/ai-model/action-executor.ts
17
17
  import {
@@ -1,4 +1,4 @@
1
- import { l as AIUsageInfo, U as UIContext, ax as ReferenceImage, q as AIElementLocatorResponse, K as ElementById, g as InsightExtractOption, t as AIDataExtractionResponse, v as AIAssertionResponse, av as PageType, V as PlanningAIResponse } from './types-b0b4c68e.js';
1
+ import { l as AIUsageInfo, U as UIContext, aB as ReferenceImage, q as AIElementLocatorResponse, K as ElementById, g as InsightExtractOption, t as AIDataExtractionResponse, v as AIAssertionResponse, av as PageType, V as PlanningAIResponse } from './types-05553e39.js';
2
2
  import { Rect, ElementTreeNode, BaseElement } from '@midscene/shared/types';
3
3
  import { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam } from 'openai/resources';
4
4
 
@@ -467,5 +467,36 @@ interface GroupedActionDump {
467
467
  executions: ExecutionDump[];
468
468
  }
469
469
  type PageType = 'puppeteer' | 'playwright' | 'static' | 'chrome-extension-proxy' | 'android';
470
+ interface StreamingCodeGenerationOptions {
471
+ /** Whether to enable streaming output */
472
+ stream?: boolean;
473
+ /** Callback function to handle streaming chunks */
474
+ onChunk?: StreamingCallback;
475
+ /** Callback function to handle streaming completion */
476
+ onComplete?: (finalCode: string) => void;
477
+ /** Callback function to handle streaming errors */
478
+ onError?: (error: Error) => void;
479
+ }
480
+ type StreamingCallback = (chunk: CodeGenerationChunk) => void;
481
+ interface CodeGenerationChunk {
482
+ /** The incremental content chunk */
483
+ content: string;
484
+ /** The reasoning content */
485
+ reasoning_content: string;
486
+ /** The accumulated content so far */
487
+ accumulated: string;
488
+ /** Whether this is the final chunk */
489
+ isComplete: boolean;
490
+ /** Token usage information if available */
491
+ usage?: AIUsageInfo;
492
+ }
493
+ interface StreamingAIResponse {
494
+ /** The final accumulated content */
495
+ content: string;
496
+ /** Token usage information */
497
+ usage?: AIUsageInfo;
498
+ /** Whether the response was streamed */
499
+ isStreamed: boolean;
500
+ }
470
501
 
471
- export { type PlanningActionParamAssert as $, type AIDescribeElementResponse as A, type InsightExtractParam as B, type CallAIFn as C, type DumpSubscriber as D, type ExecutionTask as E, type LocateResultElement as F, type DumpMeta as G, type InsightDump as H, type InsightAction as I, type LiteUISection as J, type ElementById as K, type LocateResult as L, type MidsceneYamlScript as M, type AgentWaitForOpt as N, type OnTaskStartTip as O, type PartialInsightDumpFromSDK as P, type AgentAssertOpt as Q, type ReportDumpWithAttributes as R, type PlanningLocateParam as S, type PlanningAction as T, UIContext as U, type PlanningAIResponse as V, type PlanningActionParamTap as W, type PlanningActionParamHover as X, type PlanningActionParamRightClick as Y, type PlanningActionParamInputOrKeyPress as Z, type PlanningActionParamScroll as _, type ExecutionTaskProgressOptions as a, type PlanningActionParamSleep as a0, type PlanningActionParamError as a1, type PlanningActionParamWaitFor as a2, type Color as a3, type BaseAgentParserOpt as a4, type PuppeteerParserOpt as a5, type PlaywrightParserOpt as a6, type ExecutionRecorderItem as a7, type ExecutionTaskType as a8, type ExecutorContext as a9, type MidsceneYamlScriptWebEnv as aA, type MidsceneYamlScriptAndroidEnv as aB, type MidsceneYamlScriptEnv as aC, type MidsceneYamlFlowItemAIAction as aD, type MidsceneYamlFlowItemAIAssert as aE, type MidsceneYamlFlowItemAIQuery as aF, type MidsceneYamlFlowItemAINumber as aG, type MidsceneYamlFlowItemAIString as aH, type MidsceneYamlFlowItemAIAsk as aI, type MidsceneYamlFlowItemAIBoolean as aJ, type MidsceneYamlFlowItemAILocate as aK, type MidsceneYamlFlowItemAIWaitFor as aL, type MidsceneYamlFlowItemAITap as aM, type MidsceneYamlFlowItemAIHover as aN, type MidsceneYamlFlowItemAIInput as aO, type MidsceneYamlFlowItemAIKeyboardPress as aP, type MidsceneYamlFlowItemAIScroll as aQ, type MidsceneYamlFlowItemEvaluateJavaScript as aR, type MidsceneYamlFlowItemSleep as aS, type MidsceneYamlFlowItemLogScreenshot as aT, type FreeFn as aU, type ScriptPlayerTaskStatus as aV, type ScriptPlayerStatusValue as aW, type ExecutionTaskHitBy as aa, type ExecutionTaskReturn as ab, type ExecutionTaskInsightLocateParam as ac, type ExecutionTaskInsightLocateOutput as ad, type ExecutionTaskInsightDumpLog as ae, type ExecutionTaskInsightLocateApply as af, type ExecutionTaskInsightLocate as ag, type ExecutionTaskInsightQueryParam as ah, type ExecutionTaskInsightQueryOutput as ai, type ExecutionTaskInsightQueryApply as aj, type ExecutionTaskInsightQuery as ak, type ExecutionTaskInsightAssertionParam as al, type ExecutionTaskInsightAssertionApply as am, type ExecutionTaskInsightAssertion as an, type ExecutionTaskActionApply as ao, type ExecutionTaskAction as ap, type ExecutionTaskLogApply as aq, type ExecutionTaskLog as ar, type ExecutionTaskPlanningApply as as, type ExecutionTaskPlanning as at, type GroupedActionDump as au, type PageType as av, type LocateOption as aw, type ReferenceImage as ax, type scrollParam as ay, type MidsceneYamlScriptEnvBase as az, type ExecutionTaskApply as b, type ExecutionDump as c, type InsightTaskInfo as d, type InsightOptions as e, type DetailedLocateParam as f, type InsightExtractOption as g, type InsightAssertionResponse as h, type MidsceneYamlTask as i, type MidsceneYamlFlowItem as j, type MidsceneYamlFlowItemAIRightClick as k, type AIUsageInfo as l, AIResponseFormat as m, type AISingleElementResponseById as n, type AISingleElementResponseByPosition as o, type AISingleElementResponse as p, type AIElementLocatorResponse as q, type AIElementCoordinatesResponse as r, type AIElementResponse as s, type AIDataExtractionResponse as t, type AISectionLocatorResponse as u, type AIAssertionResponse as v, type LocatorValidatorOption as w, type LocateValidatorResult as x, type AgentDescribeElementAtPointResult as y, type EnsureObject as z };
502
+ export { type PlanningActionParamAssert as $, type AIDescribeElementResponse as A, type InsightExtractParam as B, type CallAIFn as C, type DumpSubscriber as D, type ExecutionTask as E, type LocateResultElement as F, type DumpMeta as G, type InsightDump as H, type InsightAction as I, type LiteUISection as J, type ElementById as K, type LocateResult as L, type MidsceneYamlScript as M, type AgentWaitForOpt as N, type OnTaskStartTip as O, type PartialInsightDumpFromSDK as P, type AgentAssertOpt as Q, type ReportDumpWithAttributes as R, type PlanningLocateParam as S, type PlanningAction as T, UIContext as U, type PlanningAIResponse as V, type PlanningActionParamTap as W, type PlanningActionParamHover as X, type PlanningActionParamRightClick as Y, type PlanningActionParamInputOrKeyPress as Z, type PlanningActionParamScroll as _, type ExecutionTaskProgressOptions as a, type PlanningActionParamSleep as a0, type PlanningActionParamError as a1, type PlanningActionParamWaitFor as a2, type Color as a3, type BaseAgentParserOpt as a4, type PuppeteerParserOpt as a5, type PlaywrightParserOpt as a6, type ExecutionRecorderItem as a7, type ExecutionTaskType as a8, type ExecutorContext as a9, type LocateOption as aA, type ReferenceImage as aB, type scrollParam as aC, type MidsceneYamlScriptEnvBase as aD, type MidsceneYamlScriptWebEnv as aE, type MidsceneYamlScriptAndroidEnv as aF, type MidsceneYamlScriptEnv as aG, type MidsceneYamlFlowItemAIAction as aH, type MidsceneYamlFlowItemAIAssert as aI, type MidsceneYamlFlowItemAIQuery as aJ, type MidsceneYamlFlowItemAINumber as aK, type MidsceneYamlFlowItemAIString as aL, type MidsceneYamlFlowItemAIAsk as aM, type MidsceneYamlFlowItemAIBoolean as aN, type MidsceneYamlFlowItemAILocate as aO, type MidsceneYamlFlowItemAIWaitFor as aP, type MidsceneYamlFlowItemAITap as aQ, type MidsceneYamlFlowItemAIHover as aR, type MidsceneYamlFlowItemAIInput as aS, type MidsceneYamlFlowItemAIKeyboardPress as aT, type MidsceneYamlFlowItemAIScroll as aU, type MidsceneYamlFlowItemEvaluateJavaScript as aV, type MidsceneYamlFlowItemSleep as aW, type MidsceneYamlFlowItemLogScreenshot as aX, type FreeFn as aY, type ScriptPlayerTaskStatus as aZ, type ScriptPlayerStatusValue as a_, type ExecutionTaskHitBy as aa, type ExecutionTaskReturn as ab, type ExecutionTaskInsightLocateParam as ac, type ExecutionTaskInsightLocateOutput as ad, type ExecutionTaskInsightDumpLog as ae, type ExecutionTaskInsightLocateApply as af, type ExecutionTaskInsightLocate as ag, type ExecutionTaskInsightQueryParam as ah, type ExecutionTaskInsightQueryOutput as ai, type ExecutionTaskInsightQueryApply as aj, type ExecutionTaskInsightQuery as ak, type ExecutionTaskInsightAssertionParam as al, type ExecutionTaskInsightAssertionApply as am, type ExecutionTaskInsightAssertion as an, type ExecutionTaskActionApply as ao, type ExecutionTaskAction as ap, type ExecutionTaskLogApply as aq, type ExecutionTaskLog as ar, type ExecutionTaskPlanningApply as as, type ExecutionTaskPlanning as at, type GroupedActionDump as au, type PageType as av, type StreamingCodeGenerationOptions as aw, type StreamingCallback as ax, type CodeGenerationChunk as ay, type StreamingAIResponse as az, type ExecutionTaskApply as b, type ExecutionDump as c, type InsightTaskInfo as d, type InsightOptions as e, type DetailedLocateParam as f, type InsightExtractOption as g, type InsightAssertionResponse as h, type MidsceneYamlTask as i, type MidsceneYamlFlowItem as j, type MidsceneYamlFlowItemAIRightClick as k, type AIUsageInfo as l, AIResponseFormat as m, type AISingleElementResponseById as n, type AISingleElementResponseByPosition as o, type AISingleElementResponse as p, type AIElementLocatorResponse as q, type AIElementCoordinatesResponse as r, type AIElementResponse as s, type AIDataExtractionResponse as t, type AISectionLocatorResponse as u, type AIAssertionResponse as v, type LocatorValidatorOption as w, type LocateValidatorResult as x, type AgentDescribeElementAtPointResult as y, type EnsureObject as z };
@@ -1,4 +1,4 @@
1
- import { R as ReportDumpWithAttributes } from './types-b0b4c68e.js';
1
+ import { R as ReportDumpWithAttributes } from './types-05553e39.js';
2
2
  import { Rect } from '@midscene/shared/types';
3
3
  import '@midscene/shared/constants';
4
4
  import 'openai/resources';
package/dist/es/utils.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  uploadTestInfoToServer,
13
13
  writeDumpReport,
14
14
  writeLogFile
15
- } from "./chunk-YP5EQR3O.js";
15
+ } from "./chunk-QKX52XS3.js";
16
16
  export {
17
17
  getTmpDir,
18
18
  getTmpFile,
@@ -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 };
@@ -16,9 +16,9 @@
16
16
 
17
17
 
18
18
 
19
- var _chunkQT5OZCDNjs = require('./chunk-QT5OZCDN.js');
20
19
 
21
20
 
21
+ var _chunkH3KP5MGBjs = require('./chunk-H3KP5MGB.js');
22
22
 
23
23
 
24
24
 
@@ -35,4 +35,8 @@ var _chunkQT5OZCDNjs = require('./chunk-QT5OZCDN.js');
35
35
 
36
36
 
37
37
 
38
- exports.AIActionType = _chunkQT5OZCDNjs.AIActionType; exports.AiAssert = _chunkQT5OZCDNjs.AiAssert; exports.AiExtractElementInfo = _chunkQT5OZCDNjs.AiExtractElementInfo; exports.AiLocateElement = _chunkQT5OZCDNjs.AiLocateElement; exports.AiLocateSection = _chunkQT5OZCDNjs.AiLocateSection; exports.adaptBboxToRect = _chunkQT5OZCDNjs.adaptBboxToRect; exports.callAi = _chunkQT5OZCDNjs.call; exports.callAiFn = _chunkQT5OZCDNjs.callAiFn; exports.callToGetJSONObject = _chunkQT5OZCDNjs.callToGetJSONObject; exports.describeUserPage = _chunkQT5OZCDNjs.describeUserPage; exports.elementByPositionWithElementInfo = _chunkQT5OZCDNjs.elementByPositionWithElementInfo; exports.generatePlaywrightTest = _chunkQT5OZCDNjs.generatePlaywrightTest; exports.generateYamlTest = _chunkQT5OZCDNjs.generateYamlTest; exports.plan = _chunkQT5OZCDNjs.plan; exports.resizeImageForUiTars = _chunkQT5OZCDNjs.resizeImageForUiTars; exports.systemPromptToLocateElement = _chunkQT5OZCDNjs.systemPromptToLocateElement; exports.vlmPlanning = _chunkQT5OZCDNjs.vlmPlanning;
38
+
39
+
40
+
41
+
42
+ exports.AIActionType = _chunkH3KP5MGBjs.AIActionType; exports.AiAssert = _chunkH3KP5MGBjs.AiAssert; exports.AiExtractElementInfo = _chunkH3KP5MGBjs.AiExtractElementInfo; exports.AiLocateElement = _chunkH3KP5MGBjs.AiLocateElement; exports.AiLocateSection = _chunkH3KP5MGBjs.AiLocateSection; exports.adaptBboxToRect = _chunkH3KP5MGBjs.adaptBboxToRect; exports.callAi = _chunkH3KP5MGBjs.call; exports.callAiFn = _chunkH3KP5MGBjs.callAiFn; exports.callToGetJSONObject = _chunkH3KP5MGBjs.callToGetJSONObject; exports.describeUserPage = _chunkH3KP5MGBjs.describeUserPage; exports.elementByPositionWithElementInfo = _chunkH3KP5MGBjs.elementByPositionWithElementInfo; exports.generatePlaywrightTest = _chunkH3KP5MGBjs.generatePlaywrightTest; exports.generatePlaywrightTestStream = _chunkH3KP5MGBjs.generatePlaywrightTestStream; exports.generateYamlTest = _chunkH3KP5MGBjs.generateYamlTest; exports.generateYamlTestStream = _chunkH3KP5MGBjs.generateYamlTestStream; exports.plan = _chunkH3KP5MGBjs.plan; exports.resizeImageForUiTars = _chunkH3KP5MGBjs.resizeImageForUiTars; exports.systemPromptToLocateElement = _chunkH3KP5MGBjs.systemPromptToLocateElement; exports.vlmPlanning = _chunkH3KP5MGBjs.vlmPlanning;