@midscene/core 0.26.3-beta-20250813113027.0 → 0.26.3-beta-20250813113828.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.mjs.map +1 -1
- package/dist/es/index.mjs +1 -1
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/utils.mjs +2 -2
- package/dist/lib/ai-model.js.map +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/utils.js +2 -2
- package/dist/types/ai-model.d.ts +5 -96
- package/dist/types/index.d.ts +26 -16
- package/package.json +3 -3
package/dist/types/ai-model.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { ChatCompletionMessageParam } from 'openai/resources/index';
|
|
|
4
4
|
import type { ChatCompletionSystemMessageParam } from 'openai/resources/index';
|
|
5
5
|
import type { ChatCompletionUserMessageParam } from 'openai/resources/index';
|
|
6
6
|
import { ElementTreeNode } from '@midscene/shared/types';
|
|
7
|
-
import type { NodeType } from '@midscene/shared/constants';
|
|
8
7
|
import OpenAI from 'openai';
|
|
9
8
|
import { Rect } from '@midscene/shared/types';
|
|
10
9
|
import { Size } from '@midscene/shared/types';
|
|
@@ -207,7 +206,7 @@ declare interface DeviceAction<ParamType = any> {
|
|
|
207
206
|
paramDescription?: string;
|
|
208
207
|
location?: 'required' | 'optional' | false;
|
|
209
208
|
whatToLocate?: string; // what to locate if location is required or optional
|
|
210
|
-
call: (
|
|
209
|
+
call: (param: ParamType) => Promise<void> | void;
|
|
211
210
|
}
|
|
212
211
|
|
|
213
212
|
declare type ElementById = (id: string) => BaseElement | null;
|
|
@@ -220,85 +219,6 @@ export declare function elementByPositionWithElementInfo(treeRoot: ElementTreeNo
|
|
|
220
219
|
filterPositionElements?: boolean;
|
|
221
220
|
}): BaseElement | undefined;
|
|
222
221
|
|
|
223
|
-
declare interface ExecutionRecorderItem {
|
|
224
|
-
type: 'screenshot';
|
|
225
|
-
ts: number;
|
|
226
|
-
screenshot?: string;
|
|
227
|
-
timing?: string;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
declare type ExecutionTask<
|
|
231
|
-
E extends ExecutionTaskApply<any, any, any> = ExecutionTaskApply<
|
|
232
|
-
any,
|
|
233
|
-
any,
|
|
234
|
-
any
|
|
235
|
-
>,
|
|
236
|
-
> = E &
|
|
237
|
-
ExecutionTaskReturn<
|
|
238
|
-
E extends ExecutionTaskApply<any, any, infer TaskOutput, any>
|
|
239
|
-
? TaskOutput
|
|
240
|
-
: unknown,
|
|
241
|
-
E extends ExecutionTaskApply<any, any, any, infer TaskLog>
|
|
242
|
-
? TaskLog
|
|
243
|
-
: unknown
|
|
244
|
-
> & {
|
|
245
|
-
status: 'pending' | 'running' | 'finished' | 'failed' | 'cancelled';
|
|
246
|
-
error?: Error;
|
|
247
|
-
errorMessage?: string;
|
|
248
|
-
errorStack?: string;
|
|
249
|
-
timing?: {
|
|
250
|
-
start: number;
|
|
251
|
-
end?: number;
|
|
252
|
-
cost?: number;
|
|
253
|
-
};
|
|
254
|
-
usage?: AIUsageInfo;
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
declare interface ExecutionTaskApply<
|
|
258
|
-
Type extends ExecutionTaskType = any,
|
|
259
|
-
TaskParam = any,
|
|
260
|
-
TaskOutput = any,
|
|
261
|
-
TaskLog = any,
|
|
262
|
-
> {
|
|
263
|
-
type: Type;
|
|
264
|
-
subType?: string;
|
|
265
|
-
param?: TaskParam;
|
|
266
|
-
thought?: string;
|
|
267
|
-
locate?: PlanningLocateParam | null;
|
|
268
|
-
pageContext?: UIContext;
|
|
269
|
-
executor: (
|
|
270
|
-
param: TaskParam,
|
|
271
|
-
context: ExecutorContext,
|
|
272
|
-
) => // biome-ignore lint/suspicious/noConfusingVoidType: <explanation>
|
|
273
|
-
| Promise<ExecutionTaskReturn<TaskOutput, TaskLog> | undefined | void>
|
|
274
|
-
| undefined
|
|
275
|
-
| void;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
declare interface ExecutionTaskHitBy {
|
|
279
|
-
from: string;
|
|
280
|
-
context: Record<string, any>;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
declare interface ExecutionTaskReturn<TaskOutput = unknown, TaskLog = unknown> {
|
|
284
|
-
output?: TaskOutput;
|
|
285
|
-
log?: TaskLog;
|
|
286
|
-
recorder?: ExecutionRecorderItem[];
|
|
287
|
-
hitBy?: ExecutionTaskHitBy;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
declare type ExecutionTaskType =
|
|
291
|
-
| 'Planning'
|
|
292
|
-
| 'Insight'
|
|
293
|
-
| 'Action'
|
|
294
|
-
| 'Assertion'
|
|
295
|
-
| 'Log';
|
|
296
|
-
|
|
297
|
-
declare interface ExecutorContext {
|
|
298
|
-
task: ExecutionTask;
|
|
299
|
-
element?: LocateResultElement | null;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
222
|
/**
|
|
303
223
|
* Generates Playwright test code from recorded events
|
|
304
224
|
*/
|
|
@@ -332,19 +252,6 @@ declare interface LocateOption {
|
|
|
332
252
|
pageContext?: UIContext<BaseElement>;
|
|
333
253
|
}
|
|
334
254
|
|
|
335
|
-
declare type LocateResultElement = {
|
|
336
|
-
id: string;
|
|
337
|
-
indexId?: number;
|
|
338
|
-
center: [number, number];
|
|
339
|
-
rect: Rect;
|
|
340
|
-
xpaths: string[];
|
|
341
|
-
attributes: {
|
|
342
|
-
nodeType: NodeType;
|
|
343
|
-
[key: string]: string;
|
|
344
|
-
};
|
|
345
|
-
isOrderSensitive?: boolean;
|
|
346
|
-
};
|
|
347
|
-
|
|
348
255
|
declare type MidsceneYamlFlowItem =
|
|
349
256
|
| MidsceneYamlFlowItemAIAction
|
|
350
257
|
| MidsceneYamlFlowItemAIAssert
|
|
@@ -396,7 +303,7 @@ declare interface MidsceneYamlFlowItemAIRightClick extends LocateOption {
|
|
|
396
303
|
|
|
397
304
|
declare interface MidsceneYamlFlowItemAIScroll
|
|
398
305
|
extends LocateOption,
|
|
399
|
-
|
|
306
|
+
PlanningActionParamScroll {
|
|
400
307
|
aiScroll: null;
|
|
401
308
|
locate?: TUserPrompt; // which area to scroll, optional
|
|
402
309
|
}
|
|
@@ -460,6 +367,8 @@ declare interface PlanningAction<ParamType = any> {
|
|
|
460
367
|
locate?: PlanningLocateParam | null;
|
|
461
368
|
}
|
|
462
369
|
|
|
370
|
+
declare type PlanningActionParamScroll = scrollParam;
|
|
371
|
+
|
|
463
372
|
declare interface PlanningAIResponse {
|
|
464
373
|
action?: PlanningAction; // this is the qwen mode
|
|
465
374
|
actions?: PlanningAction[];
|
|
@@ -504,7 +413,7 @@ declare interface ReferenceImage {
|
|
|
504
413
|
|
|
505
414
|
export declare function resizeImageForUiTars(imageBase64: string, size: Size): Promise<string>;
|
|
506
415
|
|
|
507
|
-
declare interface
|
|
416
|
+
declare interface scrollParam {
|
|
508
417
|
direction: 'down' | 'up' | 'right' | 'left';
|
|
509
418
|
scrollType: 'once' | 'untilBottom' | 'untilTop' | 'untilRight' | 'untilLeft';
|
|
510
419
|
distance?: null | number; // distance in px
|
package/dist/types/index.d.ts
CHANGED
|
@@ -208,16 +208,6 @@ declare type AIUsageInfo_2 = Record<string, any> & {
|
|
|
208
208
|
time_cost: number | undefined;
|
|
209
209
|
};
|
|
210
210
|
|
|
211
|
-
export declare interface AndroidLongPressParam {
|
|
212
|
-
duration?: number;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
export declare interface AndroidPullParam {
|
|
216
|
-
direction: 'up' | 'down';
|
|
217
|
-
distance?: number;
|
|
218
|
-
duration?: number;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
211
|
export declare interface BaseAgentParserOpt {
|
|
222
212
|
selector?: string;
|
|
223
213
|
ignoreMarker?: boolean;
|
|
@@ -318,7 +308,7 @@ export declare interface DeviceAction<ParamType = any> {
|
|
|
318
308
|
paramDescription?: string;
|
|
319
309
|
location?: 'required' | 'optional' | false;
|
|
320
310
|
whatToLocate?: string;
|
|
321
|
-
call: (
|
|
311
|
+
call: (param: ParamType) => Promise<void> | void;
|
|
322
312
|
}
|
|
323
313
|
|
|
324
314
|
declare interface DeviceAction_2<ParamType = any> {
|
|
@@ -328,7 +318,7 @@ declare interface DeviceAction_2<ParamType = any> {
|
|
|
328
318
|
paramDescription?: string;
|
|
329
319
|
location?: 'required' | 'optional' | false;
|
|
330
320
|
whatToLocate?: string; // what to locate if location is required or optional
|
|
331
|
-
call: (
|
|
321
|
+
call: (param: ParamType) => Promise<void> | void;
|
|
332
322
|
}
|
|
333
323
|
|
|
334
324
|
export declare interface DumpMeta {
|
|
@@ -918,14 +908,14 @@ declare interface MidsceneYamlFlowItemAIRightClick_2 extends LocateOption_2 {
|
|
|
918
908
|
aiRightClick: TUserPrompt_2;
|
|
919
909
|
}
|
|
920
910
|
|
|
921
|
-
export declare interface MidsceneYamlFlowItemAIScroll extends LocateOption,
|
|
911
|
+
export declare interface MidsceneYamlFlowItemAIScroll extends LocateOption, PlanningActionParamScroll {
|
|
922
912
|
aiScroll: null;
|
|
923
913
|
locate?: TUserPrompt;
|
|
924
914
|
}
|
|
925
915
|
|
|
926
916
|
declare interface MidsceneYamlFlowItemAIScroll_2
|
|
927
917
|
extends LocateOption_2,
|
|
928
|
-
|
|
918
|
+
PlanningActionParamScroll_2 {
|
|
929
919
|
aiScroll: null;
|
|
930
920
|
locate?: TUserPrompt_2; // which area to scroll, optional
|
|
931
921
|
}
|
|
@@ -1077,6 +1067,22 @@ declare interface PlanningAction_2<ParamType = any> {
|
|
|
1077
1067
|
locate?: PlanningLocateParam_2 | null;
|
|
1078
1068
|
}
|
|
1079
1069
|
|
|
1070
|
+
export declare interface PlanningActionParamAndroidLongPress {
|
|
1071
|
+
x: number;
|
|
1072
|
+
y: number;
|
|
1073
|
+
duration?: number;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
export declare interface PlanningActionParamAndroidPull {
|
|
1077
|
+
direction: 'up' | 'down';
|
|
1078
|
+
startPoint?: {
|
|
1079
|
+
x: number;
|
|
1080
|
+
y: number;
|
|
1081
|
+
};
|
|
1082
|
+
distance?: number;
|
|
1083
|
+
duration?: number;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1080
1086
|
export declare interface PlanningActionParamAssert {
|
|
1081
1087
|
assertion: TUserPrompt;
|
|
1082
1088
|
}
|
|
@@ -1094,6 +1100,10 @@ export declare interface PlanningActionParamInputOrKeyPress {
|
|
|
1094
1100
|
|
|
1095
1101
|
export declare type PlanningActionParamRightClick = null;
|
|
1096
1102
|
|
|
1103
|
+
export declare type PlanningActionParamScroll = scrollParam;
|
|
1104
|
+
|
|
1105
|
+
declare type PlanningActionParamScroll_2 = scrollParam_2;
|
|
1106
|
+
|
|
1097
1107
|
export declare interface PlanningActionParamSleep {
|
|
1098
1108
|
timeMs: number;
|
|
1099
1109
|
}
|
|
@@ -1183,13 +1193,13 @@ export declare interface ScriptPlayerTaskStatus extends MidsceneYamlTask {
|
|
|
1183
1193
|
error?: Error;
|
|
1184
1194
|
}
|
|
1185
1195
|
|
|
1186
|
-
export declare interface
|
|
1196
|
+
export declare interface scrollParam {
|
|
1187
1197
|
direction: 'down' | 'up' | 'right' | 'left';
|
|
1188
1198
|
scrollType: 'once' | 'untilBottom' | 'untilTop' | 'untilRight' | 'untilLeft';
|
|
1189
1199
|
distance?: null | number;
|
|
1190
1200
|
}
|
|
1191
1201
|
|
|
1192
|
-
declare interface
|
|
1202
|
+
declare interface scrollParam_2 {
|
|
1193
1203
|
direction: 'down' | 'up' | 'right' | 'left';
|
|
1194
1204
|
scrollType: 'once' | 'untilBottom' | 'untilTop' | 'untilRight' | 'untilLeft';
|
|
1195
1205
|
distance?: null | number; // distance in px
|
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.26.3-beta-
|
|
4
|
+
"version": "0.26.3-beta-20250813113828.0",
|
|
5
5
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
6
6
|
"homepage": "https://midscenejs.com/",
|
|
7
7
|
"main": "./dist/lib/index.js",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"langsmith": "0.3.7",
|
|
61
61
|
"openai": "4.81.0",
|
|
62
62
|
"socks-proxy-agent": "8.0.4",
|
|
63
|
-
"@midscene/
|
|
64
|
-
"@midscene/
|
|
63
|
+
"@midscene/recorder": "0.26.3-beta-20250813113828.0",
|
|
64
|
+
"@midscene/shared": "0.26.3-beta-20250813113828.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@microsoft/api-extractor": "^7.52.10",
|