@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/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkYP5EQR3Ojs = require('./chunk-YP5EQR3O.js');
3
+ var _chunkQKX52XS3js = require('./chunk-QKX52XS3.js');
4
4
 
5
5
 
6
6
 
@@ -11,7 +11,7 @@ var _chunkYP5EQR3Ojs = require('./chunk-YP5EQR3O.js');
11
11
 
12
12
 
13
13
 
14
- var _chunkQT5OZCDNjs = require('./chunk-QT5OZCDN.js');
14
+ var _chunkH3KP5MGBjs = require('./chunk-H3KP5MGB.js');
15
15
 
16
16
  // src/ai-model/action-executor.ts
17
17
 
@@ -171,7 +171,7 @@ ${_optionalChain([this, 'access', _7 => _7.latestErrorTask, 'call', _8 => _8(),
171
171
  }
172
172
  }
173
173
  const dumpData = {
174
- sdkVersion: _chunkYP5EQR3Ojs.getVersion.call(void 0, ),
174
+ sdkVersion: _chunkQKX52XS3js.getVersion.call(void 0, ),
175
175
  model_name: _env.getAIConfig.call(void 0, _env.MIDSCENE_MODEL_NAME) || "",
176
176
  model_description: modelDescription,
177
177
  logTime: Date.now(),
@@ -219,7 +219,7 @@ var _logger = require('@midscene/shared/logger');
219
219
 
220
220
  function emitInsightDump(data, dumpSubscriber) {
221
221
  const baseData = {
222
- sdkVersion: _chunkYP5EQR3Ojs.getVersion.call(void 0, ),
222
+ sdkVersion: _chunkQKX52XS3js.getVersion.call(void 0, ),
223
223
  logTime: Date.now(),
224
224
  model_name: _env.getAIConfig.call(void 0, _env.MIDSCENE_MODEL_NAME) || ""
225
225
  };
@@ -235,7 +235,7 @@ function emitInsightDump(data, dumpSubscriber) {
235
235
  var debug = _logger.getDebug.call(void 0, "ai:insight");
236
236
  var Insight = class {
237
237
  constructor(context, opt) {
238
- this.aiVendorFn = _chunkQT5OZCDNjs.callAiFn;
238
+ this.aiVendorFn = _chunkH3KP5MGBjs.callAiFn;
239
239
  _utils.assert.call(void 0, context, "context is required for Insight");
240
240
  if (typeof context === "function") {
241
241
  this.contextRetrieverFn = context;
@@ -278,7 +278,7 @@ var Insight = class {
278
278
  let searchAreaUsage = void 0;
279
279
  let searchAreaResponse = void 0;
280
280
  if (searchAreaPrompt) {
281
- searchAreaResponse = await _chunkQT5OZCDNjs.AiLocateSection.call(void 0, {
281
+ searchAreaResponse = await _chunkH3KP5MGBjs.AiLocateSection.call(void 0, {
282
282
  context,
283
283
  sectionDescription: searchAreaPrompt
284
284
  });
@@ -291,7 +291,7 @@ var Insight = class {
291
291
  searchArea = searchAreaResponse.rect;
292
292
  }
293
293
  const startTime = Date.now();
294
- const { parseResult, rect, elementById, rawResponse, usage } = await _chunkQT5OZCDNjs.AiLocateElement.call(void 0, {
294
+ const { parseResult, rect, elementById, rawResponse, usage } = await _chunkH3KP5MGBjs.AiLocateElement.call(void 0, {
295
295
  callAI: callAI || this.aiVendorFn,
296
296
  context,
297
297
  targetElementDescription: queryPrompt,
@@ -379,7 +379,7 @@ ${parseResult.errors.join("\n")}`;
379
379
  this.onceDumpUpdatedFn = void 0;
380
380
  const context = await this.contextRetrieverFn("extract");
381
381
  const startTime = Date.now();
382
- const { parseResult, usage } = await _chunkQT5OZCDNjs.AiExtractElementInfo.call(void 0, {
382
+ const { parseResult, usage } = await _chunkH3KP5MGBjs.AiExtractElementInfo.call(void 0, {
383
383
  context,
384
384
  dataQuery: dataDemand,
385
385
  extractOption: opt
@@ -431,7 +431,7 @@ ${parseResult.errors.join("\n")}`;
431
431
  this.onceDumpUpdatedFn = void 0;
432
432
  const context = await this.contextRetrieverFn("assert");
433
433
  const startTime = Date.now();
434
- const assertResult = await _chunkQT5OZCDNjs.AiAssert.call(void 0, {
434
+ const assertResult = await _chunkH3KP5MGBjs.AiAssert.call(void 0, {
435
435
  assertion,
436
436
  context
437
437
  });
@@ -485,7 +485,7 @@ ${parseResult.errors.join("\n")}`;
485
485
  borderThickness: 3
486
486
  });
487
487
  if (_optionalChain([opt, 'optionalAccess', _22 => _22.deepThink])) {
488
- const searchArea = _chunkQT5OZCDNjs.expandSearchArea.call(void 0, targetRect, context.size);
488
+ const searchArea = _chunkH3KP5MGBjs.expandSearchArea.call(void 0, targetRect, context.size);
489
489
  debug("describe: set searchArea", searchArea);
490
490
  imagePayload = await _img.cropByRect.call(void 0,
491
491
  imagePayload,
@@ -508,7 +508,7 @@ ${parseResult.errors.join("\n")}`;
508
508
  ]
509
509
  }
510
510
  ];
511
- const callAIFn = this.aiVendorFn || _chunkQT5OZCDNjs.callToGetJSONObject;
511
+ const callAIFn = this.aiVendorFn || _chunkH3KP5MGBjs.callToGetJSONObject;
512
512
  const res = await callAIFn(msgs, 4 /* DESCRIBE_ELEMENT */);
513
513
  const { content } = res;
514
514
  _utils.assert.call(void 0, !content.error, `describe failed: ${content.error}`);
@@ -531,6 +531,6 @@ var src_default = Insight;
531
531
 
532
532
 
533
533
 
534
- exports.AiAssert = _chunkQT5OZCDNjs.AiAssert; exports.AiLocateElement = _chunkQT5OZCDNjs.AiLocateElement; exports.Executor = Executor; exports.Insight = Insight; exports.MIDSCENE_MODEL_NAME = _env.MIDSCENE_MODEL_NAME; exports.default = src_default; exports.describeUserPage = _chunkQT5OZCDNjs.describeUserPage; exports.getAIConfig = _env.getAIConfig; exports.getVersion = _chunkYP5EQR3Ojs.getVersion; exports.plan = _chunkQT5OZCDNjs.plan;
534
+ exports.AiAssert = _chunkH3KP5MGBjs.AiAssert; exports.AiLocateElement = _chunkH3KP5MGBjs.AiLocateElement; exports.Executor = Executor; exports.Insight = Insight; exports.MIDSCENE_MODEL_NAME = _env.MIDSCENE_MODEL_NAME; exports.default = src_default; exports.describeUserPage = _chunkH3KP5MGBjs.describeUserPage; exports.getAIConfig = _env.getAIConfig; exports.getVersion = _chunkQKX52XS3js.getVersion; exports.plan = _chunkH3KP5MGBjs.plan;
535
535
 
536
536
  //# sourceMappingURL=index.js.map
@@ -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/lib/utils.js CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
 
14
14
 
15
- var _chunkYP5EQR3Ojs = require('./chunk-YP5EQR3O.js');
15
+ var _chunkQKX52XS3js = require('./chunk-QKX52XS3.js');
16
16
 
17
17
 
18
18
 
@@ -27,4 +27,4 @@ var _chunkYP5EQR3Ojs = require('./chunk-YP5EQR3O.js');
27
27
 
28
28
 
29
29
 
30
- exports.getTmpDir = _chunkYP5EQR3Ojs.getTmpDir; exports.getTmpFile = _chunkYP5EQR3Ojs.getTmpFile; exports.getVersion = _chunkYP5EQR3Ojs.getVersion; exports.groupedActionDumpFileExt = _chunkYP5EQR3Ojs.groupedActionDumpFileExt; exports.insertScriptBeforeClosingHtml = _chunkYP5EQR3Ojs.insertScriptBeforeClosingHtml; exports.overlapped = _chunkYP5EQR3Ojs.overlapped; exports.replacerForPageObject = _chunkYP5EQR3Ojs.replacerForPageObject; exports.reportHTMLContent = _chunkYP5EQR3Ojs.reportHTMLContent; exports.sleep = _chunkYP5EQR3Ojs.sleep; exports.stringifyDumpData = _chunkYP5EQR3Ojs.stringifyDumpData; exports.uploadTestInfoToServer = _chunkYP5EQR3Ojs.uploadTestInfoToServer; exports.writeDumpReport = _chunkYP5EQR3Ojs.writeDumpReport; exports.writeLogFile = _chunkYP5EQR3Ojs.writeLogFile;
30
+ exports.getTmpDir = _chunkQKX52XS3js.getTmpDir; exports.getTmpFile = _chunkQKX52XS3js.getTmpFile; exports.getVersion = _chunkQKX52XS3js.getVersion; exports.groupedActionDumpFileExt = _chunkQKX52XS3js.groupedActionDumpFileExt; exports.insertScriptBeforeClosingHtml = _chunkQKX52XS3js.insertScriptBeforeClosingHtml; exports.overlapped = _chunkQKX52XS3js.overlapped; exports.replacerForPageObject = _chunkQKX52XS3js.replacerForPageObject; exports.reportHTMLContent = _chunkQKX52XS3js.reportHTMLContent; exports.sleep = _chunkQKX52XS3js.sleep; exports.stringifyDumpData = _chunkQKX52XS3js.stringifyDumpData; exports.uploadTestInfoToServer = _chunkQKX52XS3js.uploadTestInfoToServer; exports.writeDumpReport = _chunkQKX52XS3js.writeDumpReport; exports.writeLogFile = _chunkQKX52XS3js.writeLogFile;
@@ -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 };
@@ -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';
@@ -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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@midscene/core",
3
3
  "description": "Automate browser actions, extract data, and perform assertions using AI. It offers JavaScript SDK, Chrome extension, and support for scripting in YAML. See https://midscenejs.com/ for details.",
4
- "version": "0.21.3",
4
+ "version": "0.21.4-beta-20250714025212.0",
5
5
  "repository": "https://github.com/web-infra-dev/midscene",
6
6
  "homepage": "https://midscenejs.com/",
7
7
  "jsnext:source": "./src/index.ts",
@@ -44,8 +44,8 @@
44
44
  "langsmith": "0.3.7",
45
45
  "openai": "4.81.0",
46
46
  "socks-proxy-agent": "8.0.4",
47
- "@midscene/recorder": "0.21.3",
48
- "@midscene/shared": "0.21.3"
47
+ "@midscene/shared": "0.21.4-beta-20250714025212.0",
48
+ "@midscene/recorder": "0.21.4-beta-20250714025212.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@modern-js/module-tools": "2.60.6",