@midscene/core 0.25.4-beta-20250808064529.0 → 0.25.4-beta-20250811113343.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.
- package/dist/es/ai-model.d.ts +3 -3
- package/dist/es/ai-model.js +1 -1
- package/dist/es/{chunk-I5LBWOQA.js → chunk-5IZMFZPA.js} +247 -254
- package/dist/es/chunk-5IZMFZPA.js.map +1 -0
- package/dist/es/{chunk-UIEDQYHD.js → chunk-H5PRBRMX.js} +3 -3
- package/dist/es/index.d.ts +4 -4
- package/dist/es/index.js +2 -2
- package/dist/es/{llm-planning-92cec090.d.ts → llm-planning-374b74b8.d.ts} +2 -1
- package/dist/es/{types-b4a208c6.d.ts → types-16cd9f75.d.ts} +10 -1
- package/dist/es/utils.d.ts +1 -1
- package/dist/es/utils.js +1 -1
- package/dist/lib/ai-model.d.ts +3 -3
- package/dist/lib/ai-model.js +2 -2
- package/dist/lib/{chunk-I5LBWOQA.js → chunk-5IZMFZPA.js} +236 -243
- package/dist/lib/chunk-5IZMFZPA.js.map +1 -0
- package/dist/lib/{chunk-UIEDQYHD.js → chunk-H5PRBRMX.js} +3 -3
- package/dist/lib/index.d.ts +4 -4
- package/dist/lib/index.js +12 -12
- package/dist/lib/{llm-planning-92cec090.d.ts → llm-planning-374b74b8.d.ts} +2 -1
- package/dist/{types/types-b4a208c6.d.ts → lib/types-16cd9f75.d.ts} +10 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +2 -2
- package/dist/types/ai-model.d.ts +3 -3
- package/dist/types/index.d.ts +4 -4
- package/dist/types/{llm-planning-92cec090.d.ts → llm-planning-374b74b8.d.ts} +2 -1
- package/dist/{lib/types-b4a208c6.d.ts → types/types-16cd9f75.d.ts} +10 -1
- package/dist/types/utils.d.ts +1 -1
- package/package.json +3 -3
- package/dist/es/chunk-I5LBWOQA.js.map +0 -1
- package/dist/lib/chunk-I5LBWOQA.js.map +0 -1
- /package/dist/es/{chunk-UIEDQYHD.js.map → chunk-H5PRBRMX.js.map} +0 -0
- /package/dist/lib/{chunk-UIEDQYHD.js.map → chunk-H5PRBRMX.js.map} +0 -0
package/dist/lib/index.d.ts
CHANGED
|
@@ -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 InsightExtractParam, h as InsightExtractOption, T as TMultimodalPrompt, A as AIUsageInfo, i as TUserPrompt, j as InsightAssertionResponse, k as AIDescribeElementResponse } from './types-
|
|
2
|
-
export { z as AIAssertionResponse, x as AIDataExtractionResponse, v as AIElementCoordinatesResponse, u as AIElementLocatorResponse, w as AIElementResponse, q as AIResponseFormat, y as AISectionLocatorResponse, t as AISingleElementResponse, r as AISingleElementResponseById, s as AISingleElementResponseByPosition, W as AgentAssertOpt, F as AgentDescribeElementAtPointResult, V as AgentWaitForOpt, aa as BaseAgentParserOpt, G as CallAIFn, aE as CodeGenerationChunk, a9 as Color, K as DumpMeta, Q as ElementById, H as EnsureObject, ad as ExecutionRecorderItem, av as ExecutionTaskAction, au as ExecutionTaskActionApply, ag as ExecutionTaskHitBy, at as ExecutionTaskInsightAssertion, as as ExecutionTaskInsightAssertionApply, ar as ExecutionTaskInsightAssertionParam, ak as ExecutionTaskInsightDumpLog, am as ExecutionTaskInsightLocate, al as ExecutionTaskInsightLocateApply, aj as ExecutionTaskInsightLocateOutput, ai as ExecutionTaskInsightLocateParam, aq as ExecutionTaskInsightQuery, ap as ExecutionTaskInsightQueryApply, ao as ExecutionTaskInsightQueryOutput, an as ExecutionTaskInsightQueryParam, ax as ExecutionTaskLog, aw as ExecutionTaskLogApply, az as ExecutionTaskPlanning, ay as ExecutionTaskPlanningApply, ah as ExecutionTaskReturn, ae as ExecutionTaskType, af as ExecutorContext,
|
|
3
|
-
import { c as callAiFn } from './llm-planning-
|
|
4
|
-
export { a as AiAssert, A as AiLocateElement, d as describeUserPage, p as plan } from './llm-planning-
|
|
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 InsightExtractParam, h as InsightExtractOption, T as TMultimodalPrompt, A as AIUsageInfo, i as TUserPrompt, j as InsightAssertionResponse, k as AIDescribeElementResponse } from './types-16cd9f75.js';
|
|
2
|
+
export { z as AIAssertionResponse, x as AIDataExtractionResponse, v as AIElementCoordinatesResponse, u as AIElementLocatorResponse, w as AIElementResponse, q as AIResponseFormat, y as AISectionLocatorResponse, t as AISingleElementResponse, r as AISingleElementResponseById, s as AISingleElementResponseByPosition, W as AgentAssertOpt, F as AgentDescribeElementAtPointResult, V as AgentWaitForOpt, aa as BaseAgentParserOpt, G as CallAIFn, aE as CodeGenerationChunk, a9 as Color, aG as DeviceAction, K as DumpMeta, Q as ElementById, H as EnsureObject, ad as ExecutionRecorderItem, av as ExecutionTaskAction, au as ExecutionTaskActionApply, ag as ExecutionTaskHitBy, at as ExecutionTaskInsightAssertion, as as ExecutionTaskInsightAssertionApply, ar as ExecutionTaskInsightAssertionParam, ak as ExecutionTaskInsightDumpLog, am as ExecutionTaskInsightLocate, al as ExecutionTaskInsightLocateApply, aj as ExecutionTaskInsightLocateOutput, ai as ExecutionTaskInsightLocateParam, aq as ExecutionTaskInsightQuery, ap as ExecutionTaskInsightQueryApply, ao as ExecutionTaskInsightQueryOutput, an as ExecutionTaskInsightQueryParam, ax as ExecutionTaskLog, aw as ExecutionTaskLogApply, az as ExecutionTaskPlanning, ay as ExecutionTaskPlanningApply, ah as ExecutionTaskReturn, ae as ExecutionTaskType, af as ExecutorContext, b2 as FreeFn, aA as GroupedActionDump, N as InsightDump, O as LiteUISection, p as LocateOption, J as LocateResultElement, C as LocateValidatorResult, B as LocatorValidatorOption, b5 as MidsceneYamlConfig, b6 as MidsceneYamlConfigOutput, o as MidsceneYamlConfigResult, m as MidsceneYamlFlowItem, aN as MidsceneYamlFlowItemAIAction, aS as MidsceneYamlFlowItemAIAsk, aO as MidsceneYamlFlowItemAIAssert, aT as MidsceneYamlFlowItemAIBoolean, aX as MidsceneYamlFlowItemAIHover, aY as MidsceneYamlFlowItemAIInput, aZ as MidsceneYamlFlowItemAIKeyboardPress, aU as MidsceneYamlFlowItemAILocate, aQ as MidsceneYamlFlowItemAINumber, aP as MidsceneYamlFlowItemAIQuery, n as MidsceneYamlFlowItemAIRightClick, a_ as MidsceneYamlFlowItemAIScroll, aR as MidsceneYamlFlowItemAIString, aW as MidsceneYamlFlowItemAITap, aV as MidsceneYamlFlowItemAIWaitFor, a$ as MidsceneYamlFlowItemEvaluateJavaScript, b1 as MidsceneYamlFlowItemLogScreenshot, b0 as MidsceneYamlFlowItemSleep, M as MidsceneYamlScript, aL as MidsceneYamlScriptAndroidEnv, aM as MidsceneYamlScriptEnv, aJ as MidsceneYamlScriptEnvBase, aK as MidsceneYamlScriptWebEnv, l as MidsceneYamlTask, S as OnTaskStartTip, aB as PageType, P as PartialInsightDumpFromSDK, Z as PlanningAIResponse, Y as PlanningAction, a7 as PlanningActionParamAndroidLongPress, a8 as PlanningActionParamAndroidPull, a3 as PlanningActionParamAssert, a5 as PlanningActionParamError, $ as PlanningActionParamHover, a1 as PlanningActionParamInputOrKeyPress, a0 as PlanningActionParamRightClick, a2 as PlanningActionParamScroll, a4 as PlanningActionParamSleep, _ as PlanningActionParamTap, a6 as PlanningActionParamWaitFor, X as PlanningLocateParam, ac as PlaywrightParserOpt, ab as PuppeteerParserOpt, aH as ReferenceImage, R as ReportDumpWithAttributes, b4 as ScriptPlayerStatusValue, b3 as ScriptPlayerTaskStatus, aF as StreamingAIResponse, aD as StreamingCallback, aC as StreamingCodeGenerationOptions, aI as scrollParam } from './types-16cd9f75.js';
|
|
3
|
+
import { c as callAiFn } from './llm-planning-374b74b8.js';
|
|
4
|
+
export { a as AiAssert, A as AiLocateElement, d as describeUserPage, p as plan } from './llm-planning-374b74b8.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
|
|
3
|
+
var _chunkH5PRBRMXjs = require('./chunk-H5PRBRMX.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ var _chunkUIEDQYHDjs = require('./chunk-UIEDQYHD.js');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunk5IZMFZPAjs = require('./chunk-5IZMFZPA.js');
|
|
15
15
|
|
|
16
16
|
// src/ai-model/action-executor.ts
|
|
17
17
|
|
|
@@ -176,7 +176,7 @@ ${_optionalChain([this, 'access', _7 => _7.latestErrorTask, 'call', _8 => _8(),
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
const dumpData = {
|
|
179
|
-
sdkVersion:
|
|
179
|
+
sdkVersion: _chunkH5PRBRMXjs.getVersion.call(void 0, ),
|
|
180
180
|
model_name: _env.getAIConfig.call(void 0, _env.MIDSCENE_MODEL_NAME) || "",
|
|
181
181
|
model_description: modelDescription,
|
|
182
182
|
logTime: Date.now(),
|
|
@@ -248,7 +248,7 @@ var _logger = require('@midscene/shared/logger');
|
|
|
248
248
|
|
|
249
249
|
function emitInsightDump(data, dumpSubscriber) {
|
|
250
250
|
const baseData = {
|
|
251
|
-
sdkVersion:
|
|
251
|
+
sdkVersion: _chunkH5PRBRMXjs.getVersion.call(void 0, ),
|
|
252
252
|
logTime: Date.now(),
|
|
253
253
|
model_name: _env.getAIConfig.call(void 0, _env.MIDSCENE_MODEL_NAME) || ""
|
|
254
254
|
};
|
|
@@ -264,7 +264,7 @@ function emitInsightDump(data, dumpSubscriber) {
|
|
|
264
264
|
var debug = _logger.getDebug.call(void 0, "ai:insight");
|
|
265
265
|
var Insight = class {
|
|
266
266
|
constructor(context, opt) {
|
|
267
|
-
this.aiVendorFn =
|
|
267
|
+
this.aiVendorFn = _chunk5IZMFZPAjs.callAiFn;
|
|
268
268
|
_utils.assert.call(void 0, context, "context is required for Insight");
|
|
269
269
|
if (typeof context === "function") {
|
|
270
270
|
this.contextRetrieverFn = context;
|
|
@@ -307,7 +307,7 @@ var Insight = class {
|
|
|
307
307
|
let searchAreaUsage = void 0;
|
|
308
308
|
let searchAreaResponse = void 0;
|
|
309
309
|
if (searchAreaPrompt) {
|
|
310
|
-
searchAreaResponse = await
|
|
310
|
+
searchAreaResponse = await _chunk5IZMFZPAjs.AiLocateSection.call(void 0, {
|
|
311
311
|
context,
|
|
312
312
|
sectionDescription: searchAreaPrompt
|
|
313
313
|
});
|
|
@@ -327,7 +327,7 @@ var Insight = class {
|
|
|
327
327
|
rawResponse,
|
|
328
328
|
usage,
|
|
329
329
|
isOrderSensitive
|
|
330
|
-
} = await
|
|
330
|
+
} = await _chunk5IZMFZPAjs.AiLocateElement.call(void 0, {
|
|
331
331
|
callAI: callAI || this.aiVendorFn,
|
|
332
332
|
context,
|
|
333
333
|
targetElementDescription: queryPrompt,
|
|
@@ -416,7 +416,7 @@ ${parseResult.errors.join("\n")}`;
|
|
|
416
416
|
this.onceDumpUpdatedFn = void 0;
|
|
417
417
|
const context = await this.contextRetrieverFn("extract");
|
|
418
418
|
const startTime = Date.now();
|
|
419
|
-
const { parseResult, usage } = await
|
|
419
|
+
const { parseResult, usage } = await _chunk5IZMFZPAjs.AiExtractElementInfo.call(void 0, {
|
|
420
420
|
context,
|
|
421
421
|
dataQuery: dataDemand,
|
|
422
422
|
multimodalPrompt,
|
|
@@ -465,7 +465,7 @@ ${parseResult.errors.join("\n")}`;
|
|
|
465
465
|
this.onceDumpUpdatedFn = void 0;
|
|
466
466
|
const context = await this.contextRetrieverFn("assert");
|
|
467
467
|
const startTime = Date.now();
|
|
468
|
-
const assertResult = await
|
|
468
|
+
const assertResult = await _chunk5IZMFZPAjs.AiAssert.call(void 0, {
|
|
469
469
|
assertion,
|
|
470
470
|
context
|
|
471
471
|
});
|
|
@@ -519,7 +519,7 @@ ${parseResult.errors.join("\n")}`;
|
|
|
519
519
|
borderThickness: 3
|
|
520
520
|
});
|
|
521
521
|
if (_optionalChain([opt, 'optionalAccess', _22 => _22.deepThink])) {
|
|
522
|
-
const searchArea =
|
|
522
|
+
const searchArea = _chunk5IZMFZPAjs.expandSearchArea.call(void 0, targetRect, context.size);
|
|
523
523
|
debug("describe: set searchArea", searchArea);
|
|
524
524
|
imagePayload = await _img.cropByRect.call(void 0,
|
|
525
525
|
imagePayload,
|
|
@@ -542,7 +542,7 @@ ${parseResult.errors.join("\n")}`;
|
|
|
542
542
|
]
|
|
543
543
|
}
|
|
544
544
|
];
|
|
545
|
-
const callAIFn = this.aiVendorFn ||
|
|
545
|
+
const callAIFn = this.aiVendorFn || _chunk5IZMFZPAjs.callToGetJSONObject;
|
|
546
546
|
const res = await callAIFn(msgs, 4 /* DESCRIBE_ELEMENT */);
|
|
547
547
|
const { content } = res;
|
|
548
548
|
_utils.assert.call(void 0, !content.error, `describe failed: ${content.error}`);
|
|
@@ -565,6 +565,6 @@ var src_default = Insight;
|
|
|
565
565
|
|
|
566
566
|
|
|
567
567
|
|
|
568
|
-
exports.AiAssert =
|
|
568
|
+
exports.AiAssert = _chunk5IZMFZPAjs.AiAssert; exports.AiLocateElement = _chunk5IZMFZPAjs.AiLocateElement; exports.Executor = Executor; exports.Insight = Insight; exports.MIDSCENE_MODEL_NAME = _env.MIDSCENE_MODEL_NAME; exports.default = src_default; exports.describeUserPage = _chunk5IZMFZPAjs.describeUserPage; exports.getAIConfig = _env.getAIConfig; exports.getVersion = _chunkH5PRBRMXjs.getVersion; exports.plan = _chunk5IZMFZPAjs.plan;
|
|
569
569
|
|
|
570
570
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AIUsageInfo, U as UIContext, i as TUserPrompt,
|
|
1
|
+
import { A as AIUsageInfo, U as UIContext, i as TUserPrompt, aH as ReferenceImage, u as AIElementLocatorResponse, Q as ElementById, T as TMultimodalPrompt, h as InsightExtractOption, x as AIDataExtractionResponse, z as AIAssertionResponse, aB as PageType, aG as DeviceAction, Z as PlanningAIResponse } from './types-16cd9f75.js';
|
|
2
2
|
import { Rect, ElementTreeNode, BaseElement } from '@midscene/shared/types';
|
|
3
3
|
import { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam } from 'openai/resources';
|
|
4
4
|
|
|
@@ -97,6 +97,7 @@ declare function AiAssert<ElementType extends BaseElement = BaseElement>(options
|
|
|
97
97
|
declare function plan(userInstruction: string, opts: {
|
|
98
98
|
context: UIContext;
|
|
99
99
|
pageType: PageType;
|
|
100
|
+
actionSpace: DeviceAction[];
|
|
100
101
|
callAI?: typeof callAiFn<PlanningAIResponse>;
|
|
101
102
|
log?: string;
|
|
102
103
|
actionContext?: string;
|
|
@@ -564,5 +564,14 @@ type TMultimodalPrompt = {
|
|
|
564
564
|
type TUserPrompt = string | ({
|
|
565
565
|
prompt: string;
|
|
566
566
|
} & Partial<TMultimodalPrompt>);
|
|
567
|
+
interface DeviceAction<ParamType = any> {
|
|
568
|
+
name: string;
|
|
569
|
+
description?: string;
|
|
570
|
+
paramSchema?: string;
|
|
571
|
+
paramDescription?: string;
|
|
572
|
+
location?: 'required' | 'optional' | false;
|
|
573
|
+
whatToLocate?: string;
|
|
574
|
+
call: (param: ParamType) => Promise<void> | void;
|
|
575
|
+
}
|
|
567
576
|
|
|
568
|
-
export { type PlanningActionParamHover as $, type AIUsageInfo as A, type LocatorValidatorOption as B, type LocateValidatorResult as C, type DumpSubscriber as D, type ExecutionTask as E, type AgentDescribeElementAtPointResult as F, type CallAIFn as G, type EnsureObject as H, type InsightAction as I, type LocateResultElement as J, type DumpMeta as K, type LocateResult as L, type MidsceneYamlScript as M, type InsightDump as N, type LiteUISection as O, type PartialInsightDumpFromSDK as P, type ElementById as Q, type ReportDumpWithAttributes as R, type OnTaskStartTip as S, type TMultimodalPrompt as T, UIContext as U, type AgentWaitForOpt as V, type AgentAssertOpt as W, type PlanningLocateParam as X, type PlanningAction as Y, type PlanningAIResponse as Z, type PlanningActionParamTap as _, type ExecutionTaskProgressOptions as a, type
|
|
577
|
+
export { type PlanningActionParamHover as $, type AIUsageInfo as A, type LocatorValidatorOption as B, type LocateValidatorResult as C, type DumpSubscriber as D, type ExecutionTask as E, type AgentDescribeElementAtPointResult as F, type CallAIFn as G, type EnsureObject as H, type InsightAction as I, type LocateResultElement as J, type DumpMeta as K, type LocateResult as L, type MidsceneYamlScript as M, type InsightDump as N, type LiteUISection as O, type PartialInsightDumpFromSDK as P, type ElementById as Q, type ReportDumpWithAttributes as R, type OnTaskStartTip as S, type TMultimodalPrompt as T, UIContext as U, type AgentWaitForOpt as V, type AgentAssertOpt as W, type PlanningLocateParam as X, type PlanningAction as Y, type PlanningAIResponse as Z, type PlanningActionParamTap as _, type ExecutionTaskProgressOptions as a, type MidsceneYamlFlowItemEvaluateJavaScript as a$, type PlanningActionParamRightClick as a0, type PlanningActionParamInputOrKeyPress as a1, type PlanningActionParamScroll as a2, type PlanningActionParamAssert as a3, type PlanningActionParamSleep as a4, type PlanningActionParamError as a5, type PlanningActionParamWaitFor as a6, type PlanningActionParamAndroidLongPress as a7, type PlanningActionParamAndroidPull as a8, type Color as a9, type GroupedActionDump as aA, type PageType as aB, type StreamingCodeGenerationOptions as aC, type StreamingCallback as aD, type CodeGenerationChunk as aE, type StreamingAIResponse as aF, type DeviceAction as aG, type ReferenceImage as aH, type scrollParam as aI, type MidsceneYamlScriptEnvBase as aJ, type MidsceneYamlScriptWebEnv as aK, type MidsceneYamlScriptAndroidEnv as aL, type MidsceneYamlScriptEnv as aM, type MidsceneYamlFlowItemAIAction as aN, type MidsceneYamlFlowItemAIAssert as aO, type MidsceneYamlFlowItemAIQuery as aP, type MidsceneYamlFlowItemAINumber as aQ, type MidsceneYamlFlowItemAIString as aR, type MidsceneYamlFlowItemAIAsk as aS, type MidsceneYamlFlowItemAIBoolean as aT, type MidsceneYamlFlowItemAILocate as aU, type MidsceneYamlFlowItemAIWaitFor as aV, type MidsceneYamlFlowItemAITap as aW, type MidsceneYamlFlowItemAIHover as aX, type MidsceneYamlFlowItemAIInput as aY, type MidsceneYamlFlowItemAIKeyboardPress as aZ, type MidsceneYamlFlowItemAIScroll as a_, type BaseAgentParserOpt as aa, type PuppeteerParserOpt as ab, type PlaywrightParserOpt as ac, type ExecutionRecorderItem as ad, type ExecutionTaskType as ae, type ExecutorContext as af, type ExecutionTaskHitBy as ag, type ExecutionTaskReturn as ah, type ExecutionTaskInsightLocateParam as ai, type ExecutionTaskInsightLocateOutput as aj, type ExecutionTaskInsightDumpLog as ak, type ExecutionTaskInsightLocateApply as al, type ExecutionTaskInsightLocate as am, type ExecutionTaskInsightQueryParam as an, type ExecutionTaskInsightQueryOutput as ao, type ExecutionTaskInsightQueryApply as ap, type ExecutionTaskInsightQuery as aq, type ExecutionTaskInsightAssertionParam as ar, type ExecutionTaskInsightAssertionApply as as, type ExecutionTaskInsightAssertion as at, type ExecutionTaskActionApply as au, type ExecutionTaskAction as av, type ExecutionTaskLogApply as aw, type ExecutionTaskLog as ax, type ExecutionTaskPlanningApply as ay, type ExecutionTaskPlanning as az, type ExecutionTaskApply as b, type MidsceneYamlFlowItemSleep as b0, type MidsceneYamlFlowItemLogScreenshot as b1, type FreeFn as b2, type ScriptPlayerTaskStatus as b3, type ScriptPlayerStatusValue as b4, type MidsceneYamlConfig as b5, type MidsceneYamlConfigOutput as b6, type ExecutionDump as c, type InsightTaskInfo as d, type InsightOptions as e, type DetailedLocateParam as f, type InsightExtractParam as g, type InsightExtractOption as h, type TUserPrompt as i, type InsightAssertionResponse as j, type AIDescribeElementResponse as k, type MidsceneYamlTask as l, type MidsceneYamlFlowItem as m, type MidsceneYamlFlowItemAIRightClick as n, type MidsceneYamlConfigResult as o, type LocateOption as p, AIResponseFormat as q, type AISingleElementResponseById as r, type AISingleElementResponseByPosition as s, type AISingleElementResponse as t, type AIElementLocatorResponse as u, type AIElementCoordinatesResponse as v, type AIElementResponse as w, type AIDataExtractionResponse as x, type AISectionLocatorResponse as y, type AIAssertionResponse as z };
|
package/dist/lib/utils.d.ts
CHANGED
package/dist/lib/utils.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkH5PRBRMXjs = require('./chunk-H5PRBRMX.js');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -27,4 +27,4 @@ var _chunkUIEDQYHDjs = require('./chunk-UIEDQYHD.js');
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
exports.getTmpDir =
|
|
30
|
+
exports.getTmpDir = _chunkH5PRBRMXjs.getTmpDir; exports.getTmpFile = _chunkH5PRBRMXjs.getTmpFile; exports.getVersion = _chunkH5PRBRMXjs.getVersion; exports.groupedActionDumpFileExt = _chunkH5PRBRMXjs.groupedActionDumpFileExt; exports.insertScriptBeforeClosingHtml = _chunkH5PRBRMXjs.insertScriptBeforeClosingHtml; exports.overlapped = _chunkH5PRBRMXjs.overlapped; exports.replacerForPageObject = _chunkH5PRBRMXjs.replacerForPageObject; exports.reportHTMLContent = _chunkH5PRBRMXjs.reportHTMLContent; exports.sleep = _chunkH5PRBRMXjs.sleep; exports.stringifyDumpData = _chunkH5PRBRMXjs.stringifyDumpData; exports.uploadTestInfoToServer = _chunkH5PRBRMXjs.uploadTestInfoToServer; exports.writeDumpReport = _chunkH5PRBRMXjs.writeDumpReport; exports.writeLogFile = _chunkH5PRBRMXjs.writeLogFile;
|
package/dist/types/ai-model.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { aD as StreamingCallback, A as AIUsageInfo, aC as StreamingCodeGenerationOptions, aF as StreamingAIResponse, Y as PlanningAction, m as MidsceneYamlFlowItem } from './types-
|
|
1
|
+
import { aD as StreamingCallback, A as AIUsageInfo, aC as StreamingCodeGenerationOptions, aF as StreamingAIResponse, Y as PlanningAction, m as MidsceneYamlFlowItem } from './types-16cd9f75.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, e as AIArgs } from './llm-planning-
|
|
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-
|
|
5
|
+
import { b as AIActionType, e as AIArgs } from './llm-planning-374b74b8.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-374b74b8.js';
|
|
7
7
|
import { vlLocateMode } from '@midscene/shared/env';
|
|
8
8
|
import { actionParser } from '@ui-tars/action-parser';
|
|
9
9
|
import { Size } from '@midscene/shared/types';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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 InsightExtractParam, h as InsightExtractOption, T as TMultimodalPrompt, A as AIUsageInfo, i as TUserPrompt, j as InsightAssertionResponse, k as AIDescribeElementResponse } from './types-
|
|
2
|
-
export { z as AIAssertionResponse, x as AIDataExtractionResponse, v as AIElementCoordinatesResponse, u as AIElementLocatorResponse, w as AIElementResponse, q as AIResponseFormat, y as AISectionLocatorResponse, t as AISingleElementResponse, r as AISingleElementResponseById, s as AISingleElementResponseByPosition, W as AgentAssertOpt, F as AgentDescribeElementAtPointResult, V as AgentWaitForOpt, aa as BaseAgentParserOpt, G as CallAIFn, aE as CodeGenerationChunk, a9 as Color, K as DumpMeta, Q as ElementById, H as EnsureObject, ad as ExecutionRecorderItem, av as ExecutionTaskAction, au as ExecutionTaskActionApply, ag as ExecutionTaskHitBy, at as ExecutionTaskInsightAssertion, as as ExecutionTaskInsightAssertionApply, ar as ExecutionTaskInsightAssertionParam, ak as ExecutionTaskInsightDumpLog, am as ExecutionTaskInsightLocate, al as ExecutionTaskInsightLocateApply, aj as ExecutionTaskInsightLocateOutput, ai as ExecutionTaskInsightLocateParam, aq as ExecutionTaskInsightQuery, ap as ExecutionTaskInsightQueryApply, ao as ExecutionTaskInsightQueryOutput, an as ExecutionTaskInsightQueryParam, ax as ExecutionTaskLog, aw as ExecutionTaskLogApply, az as ExecutionTaskPlanning, ay as ExecutionTaskPlanningApply, ah as ExecutionTaskReturn, ae as ExecutionTaskType, af as ExecutorContext,
|
|
3
|
-
import { c as callAiFn } from './llm-planning-
|
|
4
|
-
export { a as AiAssert, A as AiLocateElement, d as describeUserPage, p as plan } from './llm-planning-
|
|
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 InsightExtractParam, h as InsightExtractOption, T as TMultimodalPrompt, A as AIUsageInfo, i as TUserPrompt, j as InsightAssertionResponse, k as AIDescribeElementResponse } from './types-16cd9f75.js';
|
|
2
|
+
export { z as AIAssertionResponse, x as AIDataExtractionResponse, v as AIElementCoordinatesResponse, u as AIElementLocatorResponse, w as AIElementResponse, q as AIResponseFormat, y as AISectionLocatorResponse, t as AISingleElementResponse, r as AISingleElementResponseById, s as AISingleElementResponseByPosition, W as AgentAssertOpt, F as AgentDescribeElementAtPointResult, V as AgentWaitForOpt, aa as BaseAgentParserOpt, G as CallAIFn, aE as CodeGenerationChunk, a9 as Color, aG as DeviceAction, K as DumpMeta, Q as ElementById, H as EnsureObject, ad as ExecutionRecorderItem, av as ExecutionTaskAction, au as ExecutionTaskActionApply, ag as ExecutionTaskHitBy, at as ExecutionTaskInsightAssertion, as as ExecutionTaskInsightAssertionApply, ar as ExecutionTaskInsightAssertionParam, ak as ExecutionTaskInsightDumpLog, am as ExecutionTaskInsightLocate, al as ExecutionTaskInsightLocateApply, aj as ExecutionTaskInsightLocateOutput, ai as ExecutionTaskInsightLocateParam, aq as ExecutionTaskInsightQuery, ap as ExecutionTaskInsightQueryApply, ao as ExecutionTaskInsightQueryOutput, an as ExecutionTaskInsightQueryParam, ax as ExecutionTaskLog, aw as ExecutionTaskLogApply, az as ExecutionTaskPlanning, ay as ExecutionTaskPlanningApply, ah as ExecutionTaskReturn, ae as ExecutionTaskType, af as ExecutorContext, b2 as FreeFn, aA as GroupedActionDump, N as InsightDump, O as LiteUISection, p as LocateOption, J as LocateResultElement, C as LocateValidatorResult, B as LocatorValidatorOption, b5 as MidsceneYamlConfig, b6 as MidsceneYamlConfigOutput, o as MidsceneYamlConfigResult, m as MidsceneYamlFlowItem, aN as MidsceneYamlFlowItemAIAction, aS as MidsceneYamlFlowItemAIAsk, aO as MidsceneYamlFlowItemAIAssert, aT as MidsceneYamlFlowItemAIBoolean, aX as MidsceneYamlFlowItemAIHover, aY as MidsceneYamlFlowItemAIInput, aZ as MidsceneYamlFlowItemAIKeyboardPress, aU as MidsceneYamlFlowItemAILocate, aQ as MidsceneYamlFlowItemAINumber, aP as MidsceneYamlFlowItemAIQuery, n as MidsceneYamlFlowItemAIRightClick, a_ as MidsceneYamlFlowItemAIScroll, aR as MidsceneYamlFlowItemAIString, aW as MidsceneYamlFlowItemAITap, aV as MidsceneYamlFlowItemAIWaitFor, a$ as MidsceneYamlFlowItemEvaluateJavaScript, b1 as MidsceneYamlFlowItemLogScreenshot, b0 as MidsceneYamlFlowItemSleep, M as MidsceneYamlScript, aL as MidsceneYamlScriptAndroidEnv, aM as MidsceneYamlScriptEnv, aJ as MidsceneYamlScriptEnvBase, aK as MidsceneYamlScriptWebEnv, l as MidsceneYamlTask, S as OnTaskStartTip, aB as PageType, P as PartialInsightDumpFromSDK, Z as PlanningAIResponse, Y as PlanningAction, a7 as PlanningActionParamAndroidLongPress, a8 as PlanningActionParamAndroidPull, a3 as PlanningActionParamAssert, a5 as PlanningActionParamError, $ as PlanningActionParamHover, a1 as PlanningActionParamInputOrKeyPress, a0 as PlanningActionParamRightClick, a2 as PlanningActionParamScroll, a4 as PlanningActionParamSleep, _ as PlanningActionParamTap, a6 as PlanningActionParamWaitFor, X as PlanningLocateParam, ac as PlaywrightParserOpt, ab as PuppeteerParserOpt, aH as ReferenceImage, R as ReportDumpWithAttributes, b4 as ScriptPlayerStatusValue, b3 as ScriptPlayerTaskStatus, aF as StreamingAIResponse, aD as StreamingCallback, aC as StreamingCodeGenerationOptions, aI as scrollParam } from './types-16cd9f75.js';
|
|
3
|
+
import { c as callAiFn } from './llm-planning-374b74b8.js';
|
|
4
|
+
export { a as AiAssert, A as AiLocateElement, d as describeUserPage, p as plan } from './llm-planning-374b74b8.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 { A as AIUsageInfo, U as UIContext, i as TUserPrompt,
|
|
1
|
+
import { A as AIUsageInfo, U as UIContext, i as TUserPrompt, aH as ReferenceImage, u as AIElementLocatorResponse, Q as ElementById, T as TMultimodalPrompt, h as InsightExtractOption, x as AIDataExtractionResponse, z as AIAssertionResponse, aB as PageType, aG as DeviceAction, Z as PlanningAIResponse } from './types-16cd9f75.js';
|
|
2
2
|
import { Rect, ElementTreeNode, BaseElement } from '@midscene/shared/types';
|
|
3
3
|
import { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam } from 'openai/resources';
|
|
4
4
|
|
|
@@ -97,6 +97,7 @@ declare function AiAssert<ElementType extends BaseElement = BaseElement>(options
|
|
|
97
97
|
declare function plan(userInstruction: string, opts: {
|
|
98
98
|
context: UIContext;
|
|
99
99
|
pageType: PageType;
|
|
100
|
+
actionSpace: DeviceAction[];
|
|
100
101
|
callAI?: typeof callAiFn<PlanningAIResponse>;
|
|
101
102
|
log?: string;
|
|
102
103
|
actionContext?: string;
|
|
@@ -564,5 +564,14 @@ type TMultimodalPrompt = {
|
|
|
564
564
|
type TUserPrompt = string | ({
|
|
565
565
|
prompt: string;
|
|
566
566
|
} & Partial<TMultimodalPrompt>);
|
|
567
|
+
interface DeviceAction<ParamType = any> {
|
|
568
|
+
name: string;
|
|
569
|
+
description?: string;
|
|
570
|
+
paramSchema?: string;
|
|
571
|
+
paramDescription?: string;
|
|
572
|
+
location?: 'required' | 'optional' | false;
|
|
573
|
+
whatToLocate?: string;
|
|
574
|
+
call: (param: ParamType) => Promise<void> | void;
|
|
575
|
+
}
|
|
567
576
|
|
|
568
|
-
export { type PlanningActionParamHover as $, type AIUsageInfo as A, type LocatorValidatorOption as B, type LocateValidatorResult as C, type DumpSubscriber as D, type ExecutionTask as E, type AgentDescribeElementAtPointResult as F, type CallAIFn as G, type EnsureObject as H, type InsightAction as I, type LocateResultElement as J, type DumpMeta as K, type LocateResult as L, type MidsceneYamlScript as M, type InsightDump as N, type LiteUISection as O, type PartialInsightDumpFromSDK as P, type ElementById as Q, type ReportDumpWithAttributes as R, type OnTaskStartTip as S, type TMultimodalPrompt as T, UIContext as U, type AgentWaitForOpt as V, type AgentAssertOpt as W, type PlanningLocateParam as X, type PlanningAction as Y, type PlanningAIResponse as Z, type PlanningActionParamTap as _, type ExecutionTaskProgressOptions as a, type
|
|
577
|
+
export { type PlanningActionParamHover as $, type AIUsageInfo as A, type LocatorValidatorOption as B, type LocateValidatorResult as C, type DumpSubscriber as D, type ExecutionTask as E, type AgentDescribeElementAtPointResult as F, type CallAIFn as G, type EnsureObject as H, type InsightAction as I, type LocateResultElement as J, type DumpMeta as K, type LocateResult as L, type MidsceneYamlScript as M, type InsightDump as N, type LiteUISection as O, type PartialInsightDumpFromSDK as P, type ElementById as Q, type ReportDumpWithAttributes as R, type OnTaskStartTip as S, type TMultimodalPrompt as T, UIContext as U, type AgentWaitForOpt as V, type AgentAssertOpt as W, type PlanningLocateParam as X, type PlanningAction as Y, type PlanningAIResponse as Z, type PlanningActionParamTap as _, type ExecutionTaskProgressOptions as a, type MidsceneYamlFlowItemEvaluateJavaScript as a$, type PlanningActionParamRightClick as a0, type PlanningActionParamInputOrKeyPress as a1, type PlanningActionParamScroll as a2, type PlanningActionParamAssert as a3, type PlanningActionParamSleep as a4, type PlanningActionParamError as a5, type PlanningActionParamWaitFor as a6, type PlanningActionParamAndroidLongPress as a7, type PlanningActionParamAndroidPull as a8, type Color as a9, type GroupedActionDump as aA, type PageType as aB, type StreamingCodeGenerationOptions as aC, type StreamingCallback as aD, type CodeGenerationChunk as aE, type StreamingAIResponse as aF, type DeviceAction as aG, type ReferenceImage as aH, type scrollParam as aI, type MidsceneYamlScriptEnvBase as aJ, type MidsceneYamlScriptWebEnv as aK, type MidsceneYamlScriptAndroidEnv as aL, type MidsceneYamlScriptEnv as aM, type MidsceneYamlFlowItemAIAction as aN, type MidsceneYamlFlowItemAIAssert as aO, type MidsceneYamlFlowItemAIQuery as aP, type MidsceneYamlFlowItemAINumber as aQ, type MidsceneYamlFlowItemAIString as aR, type MidsceneYamlFlowItemAIAsk as aS, type MidsceneYamlFlowItemAIBoolean as aT, type MidsceneYamlFlowItemAILocate as aU, type MidsceneYamlFlowItemAIWaitFor as aV, type MidsceneYamlFlowItemAITap as aW, type MidsceneYamlFlowItemAIHover as aX, type MidsceneYamlFlowItemAIInput as aY, type MidsceneYamlFlowItemAIKeyboardPress as aZ, type MidsceneYamlFlowItemAIScroll as a_, type BaseAgentParserOpt as aa, type PuppeteerParserOpt as ab, type PlaywrightParserOpt as ac, type ExecutionRecorderItem as ad, type ExecutionTaskType as ae, type ExecutorContext as af, type ExecutionTaskHitBy as ag, type ExecutionTaskReturn as ah, type ExecutionTaskInsightLocateParam as ai, type ExecutionTaskInsightLocateOutput as aj, type ExecutionTaskInsightDumpLog as ak, type ExecutionTaskInsightLocateApply as al, type ExecutionTaskInsightLocate as am, type ExecutionTaskInsightQueryParam as an, type ExecutionTaskInsightQueryOutput as ao, type ExecutionTaskInsightQueryApply as ap, type ExecutionTaskInsightQuery as aq, type ExecutionTaskInsightAssertionParam as ar, type ExecutionTaskInsightAssertionApply as as, type ExecutionTaskInsightAssertion as at, type ExecutionTaskActionApply as au, type ExecutionTaskAction as av, type ExecutionTaskLogApply as aw, type ExecutionTaskLog as ax, type ExecutionTaskPlanningApply as ay, type ExecutionTaskPlanning as az, type ExecutionTaskApply as b, type MidsceneYamlFlowItemSleep as b0, type MidsceneYamlFlowItemLogScreenshot as b1, type FreeFn as b2, type ScriptPlayerTaskStatus as b3, type ScriptPlayerStatusValue as b4, type MidsceneYamlConfig as b5, type MidsceneYamlConfigOutput as b6, type ExecutionDump as c, type InsightTaskInfo as d, type InsightOptions as e, type DetailedLocateParam as f, type InsightExtractParam as g, type InsightExtractOption as h, type TUserPrompt as i, type InsightAssertionResponse as j, type AIDescribeElementResponse as k, type MidsceneYamlTask as l, type MidsceneYamlFlowItem as m, type MidsceneYamlFlowItemAIRightClick as n, type MidsceneYamlConfigResult as o, type LocateOption as p, AIResponseFormat as q, type AISingleElementResponseById as r, type AISingleElementResponseByPosition as s, type AISingleElementResponse as t, type AIElementLocatorResponse as u, type AIElementCoordinatesResponse as v, type AIElementResponse as w, type AIDataExtractionResponse as x, type AISectionLocatorResponse as y, type AIAssertionResponse as z };
|
package/dist/types/utils.d.ts
CHANGED
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.25.4-beta-
|
|
4
|
+
"version": "0.25.4-beta-20250811113343.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.25.4-beta-
|
|
48
|
-
"@midscene/shared": "0.25.4-beta-
|
|
47
|
+
"@midscene/recorder": "0.25.4-beta-20250811113343.0",
|
|
48
|
+
"@midscene/shared": "0.25.4-beta-20250811113343.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@modern-js/module-tools": "2.60.6",
|