@midscene/core 1.1.1-beta-20260107032519.0 → 1.1.1-beta-20260108085624.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/agent/agent.mjs +60 -38
- package/dist/es/agent/agent.mjs.map +1 -1
- package/dist/es/agent/tasks.mjs +24 -5
- package/dist/es/agent/tasks.mjs.map +1 -1
- package/dist/es/agent/utils.mjs +1 -1
- package/dist/es/ai-model/inspect.mjs +1 -1
- package/dist/es/ai-model/inspect.mjs.map +1 -1
- package/dist/es/common.mjs +1 -1
- package/dist/es/common.mjs.map +1 -1
- package/dist/es/device/index.mjs +1 -1
- package/dist/es/device/index.mjs.map +1 -1
- package/dist/es/types.mjs.map +1 -1
- package/dist/es/utils.mjs +2 -2
- package/dist/lib/agent/agent.js +59 -37
- package/dist/lib/agent/agent.js.map +1 -1
- package/dist/lib/agent/tasks.js +29 -7
- package/dist/lib/agent/tasks.js.map +1 -1
- package/dist/lib/agent/utils.js +1 -1
- package/dist/lib/ai-model/inspect.js +1 -1
- package/dist/lib/ai-model/inspect.js.map +1 -1
- package/dist/lib/common.js +1 -1
- package/dist/lib/common.js.map +1 -1
- package/dist/lib/device/index.js +1 -1
- package/dist/lib/device/index.js.map +1 -1
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/utils.js +2 -2
- package/dist/types/agent/agent.d.ts +6 -1
- package/dist/types/agent/tasks.d.ts +3 -1
- package/dist/types/device/index.d.ts +7 -0
- package/dist/types/types.d.ts +0 -7
- package/dist/types/yaml.d.ts +1 -0
- package/package.json +6 -6
|
@@ -7,6 +7,7 @@ import { TaskCache } from './task-cache';
|
|
|
7
7
|
import { TaskExecutor } from './tasks';
|
|
8
8
|
export type AiActOptions = {
|
|
9
9
|
cacheable?: boolean;
|
|
10
|
+
fileChooserAccept?: string | string[];
|
|
10
11
|
deepThink?: DeepThinkOption;
|
|
11
12
|
};
|
|
12
13
|
export declare class Agent<InterfaceType extends AbstractInterface = AbstractInterface> {
|
|
@@ -73,7 +74,9 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
|
|
|
73
74
|
private callbackOnTaskStartTip;
|
|
74
75
|
wrapActionInActionSpace<T extends DeviceAction>(name: string): (param: ActionParam<T>) => Promise<ActionReturn<T>>;
|
|
75
76
|
callActionInActionSpace<T = any>(type: string, opt?: T): Promise<any>;
|
|
76
|
-
aiTap(locatePrompt: TUserPrompt, opt?: LocateOption
|
|
77
|
+
aiTap(locatePrompt: TUserPrompt, opt?: LocateOption & {
|
|
78
|
+
fileChooserAccept?: string | string[];
|
|
79
|
+
}): Promise<any>;
|
|
77
80
|
aiRightClick(locatePrompt: TUserPrompt, opt?: LocateOption): Promise<any>;
|
|
78
81
|
aiDoubleClick(locatePrompt: TUserPrompt, opt?: LocateOption): Promise<any>;
|
|
79
82
|
aiHover(locatePrompt: TUserPrompt, opt?: LocateOption): Promise<any>;
|
|
@@ -189,6 +192,8 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
|
|
|
189
192
|
* Process cache configuration and return normalized cache settings
|
|
190
193
|
*/
|
|
191
194
|
private processCacheConfig;
|
|
195
|
+
private normalizeFilePaths;
|
|
196
|
+
private normalizeFileInput;
|
|
192
197
|
/**
|
|
193
198
|
* Manually flush cache to file
|
|
194
199
|
* @param options - Optional configuration
|
|
@@ -46,12 +46,14 @@ export declare class TaskExecutor {
|
|
|
46
46
|
runner: TaskRunner;
|
|
47
47
|
}>;
|
|
48
48
|
runPlans(title: string, plans: PlanningAction[], modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig): Promise<ExecutionResult>;
|
|
49
|
-
action(userPrompt: string, modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig, includeBboxInPlanning: boolean, aiActContext?: string, cacheable?: boolean, replanningCycleLimitOverride?: number, imagesIncludeCount?: number, deepThink?: DeepThinkOption): Promise<ExecutionResult<{
|
|
49
|
+
action(userPrompt: string, modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig, includeBboxInPlanning: boolean, aiActContext?: string, cacheable?: boolean, replanningCycleLimitOverride?: number, imagesIncludeCount?: number, deepThink?: DeepThinkOption, fileChooserAccept?: string[]): Promise<ExecutionResult<{
|
|
50
50
|
yamlFlow?: MidsceneYamlFlowItem[];
|
|
51
51
|
} | undefined>>;
|
|
52
|
+
private runAction;
|
|
52
53
|
private createTypeQueryTask;
|
|
53
54
|
createTypeQueryExecution<T>(type: 'Query' | 'Boolean' | 'Number' | 'String' | 'Assert', demand: ServiceExtractParam, modelConfig: IModelConfig, opt?: ServiceExtractOption, multimodalPrompt?: TMultimodalPrompt): Promise<ExecutionResult<T>>;
|
|
54
55
|
private sleepPlan;
|
|
55
56
|
taskForSleep(timeMs: number, _modelConfig: IModelConfig): Promise<import("../types").ExecutionTaskActionApply<PlanningActionParamSleep>>;
|
|
56
57
|
waitFor(assertion: TUserPrompt, opt: PlanningActionParamWaitFor, modelConfig: IModelConfig): Promise<ExecutionResult<void>>;
|
|
57
58
|
}
|
|
59
|
+
export declare function withFileChooser<T>(interfaceInstance: AbstractInterface, fileChooserAccept: string[] | undefined, action: () => Promise<T>): Promise<T>;
|
|
@@ -3,6 +3,9 @@ import type { IModelConfig } from '@midscene/shared/env';
|
|
|
3
3
|
import type { ElementNode } from '@midscene/shared/extractor';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import type { ElementCacheFeature, Rect, Size, UIContext } from '../types';
|
|
6
|
+
export interface FileChooserHandler {
|
|
7
|
+
accept(files: string[]): Promise<void>;
|
|
8
|
+
}
|
|
6
9
|
export declare abstract class AbstractInterface {
|
|
7
10
|
abstract interfaceType: string;
|
|
8
11
|
abstract screenshotBase64(): Promise<string>;
|
|
@@ -17,6 +20,10 @@ export declare abstract class AbstractInterface {
|
|
|
17
20
|
abstract describe?(): string;
|
|
18
21
|
abstract beforeInvokeAction?(actionName: string, param: any): Promise<void>;
|
|
19
22
|
abstract afterInvokeAction?(actionName: string, param: any): Promise<void>;
|
|
23
|
+
registerFileChooserListener?(handler: (chooser: FileChooserHandler) => Promise<void>): Promise<{
|
|
24
|
+
dispose: () => void;
|
|
25
|
+
getError: () => Error | undefined;
|
|
26
|
+
}>;
|
|
20
27
|
abstract getElementsNodeTree?: () => Promise<ElementNode>;
|
|
21
28
|
abstract url?: () => string | Promise<string>;
|
|
22
29
|
abstract evaluateJavaScript?<T = any>(script: string): Promise<T>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -25,12 +25,6 @@ export declare enum AIResponseFormat {
|
|
|
25
25
|
JSON = "json_object",
|
|
26
26
|
TEXT = "text"
|
|
27
27
|
}
|
|
28
|
-
export type AISingleElementResponseById = {
|
|
29
|
-
id: string;
|
|
30
|
-
reason?: string;
|
|
31
|
-
text?: string;
|
|
32
|
-
xpaths?: string[];
|
|
33
|
-
};
|
|
34
28
|
export type AISingleElementResponseByPosition = {
|
|
35
29
|
position?: {
|
|
36
30
|
x: number;
|
|
@@ -40,7 +34,6 @@ export type AISingleElementResponseByPosition = {
|
|
|
40
34
|
reason: string;
|
|
41
35
|
text: string;
|
|
42
36
|
};
|
|
43
|
-
export type AISingleElementResponse = AISingleElementResponseById;
|
|
44
37
|
export interface AIElementCoordinatesResponse {
|
|
45
38
|
bbox: [number, number, number, number];
|
|
46
39
|
errors?: string[];
|
package/dist/types/yaml.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": "1.1.1-beta-
|
|
4
|
+
"version": "1.1.1-beta-20260108085624.0",
|
|
5
5
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
6
6
|
"homepage": "https://midscenejs.com/",
|
|
7
7
|
"main": "./dist/lib/index.js",
|
|
@@ -83,19 +83,19 @@
|
|
|
83
83
|
"dayjs": "^1.11.11",
|
|
84
84
|
"dotenv": "^16.4.5",
|
|
85
85
|
"fetch-socks": "^1.3.0",
|
|
86
|
-
"
|
|
87
|
-
"undici": "^6.0.0",
|
|
86
|
+
"js-yaml": "4.1.0",
|
|
88
87
|
"jsonrepair": "3.12.0",
|
|
88
|
+
"openai": "6.3.0",
|
|
89
89
|
"semver": "7.5.2",
|
|
90
|
-
"
|
|
90
|
+
"undici": "^6.0.0",
|
|
91
91
|
"zod": "3.24.3",
|
|
92
|
-
"@midscene/shared": "1.1.1-beta-
|
|
92
|
+
"@midscene/shared": "1.1.1-beta-20260108085624.0"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@rslib/core": "^0.18.3",
|
|
96
|
+
"@types/js-yaml": "4.0.9",
|
|
96
97
|
"@types/node": "^18.0.0",
|
|
97
98
|
"@types/node-fetch": "2.6.11",
|
|
98
|
-
"@types/js-yaml": "4.0.9",
|
|
99
99
|
"@types/semver": "7.7.0",
|
|
100
100
|
"typescript": "^5.8.3",
|
|
101
101
|
"vitest": "3.0.5"
|