@midscene/core 1.4.9 → 1.5.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/task-builder.mjs +12 -4
- package/dist/es/agent/task-builder.mjs.map +1 -1
- package/dist/es/agent/utils.mjs +1 -1
- package/dist/es/ai-model/conversation-history.mjs +19 -0
- package/dist/es/ai-model/conversation-history.mjs.map +1 -1
- package/dist/es/ai-model/llm-planning.mjs +23 -7
- package/dist/es/ai-model/llm-planning.mjs.map +1 -1
- package/dist/es/ai-model/prompt/llm-planning.mjs +239 -25
- package/dist/es/ai-model/prompt/llm-planning.mjs.map +1 -1
- package/dist/es/device/index.mjs.map +1 -1
- package/dist/es/task-runner.mjs +5 -0
- package/dist/es/task-runner.mjs.map +1 -1
- package/dist/es/task-timing.mjs +12 -0
- package/dist/es/task-timing.mjs.map +1 -0
- package/dist/es/types.mjs.map +1 -1
- package/dist/es/utils.mjs +2 -2
- package/dist/lib/agent/task-builder.js +12 -4
- package/dist/lib/agent/task-builder.js.map +1 -1
- package/dist/lib/agent/utils.js +1 -1
- package/dist/lib/ai-model/conversation-history.js +19 -0
- package/dist/lib/ai-model/conversation-history.js.map +1 -1
- package/dist/lib/ai-model/llm-planning.js +22 -6
- package/dist/lib/ai-model/llm-planning.js.map +1 -1
- package/dist/lib/ai-model/prompt/llm-planning.js +239 -25
- package/dist/lib/ai-model/prompt/llm-planning.js.map +1 -1
- package/dist/lib/device/index.js.map +1 -1
- package/dist/lib/task-runner.js +5 -0
- package/dist/lib/task-runner.js.map +1 -1
- package/dist/lib/task-timing.js +46 -0
- package/dist/lib/task-timing.js.map +1 -0
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/utils.js +2 -2
- package/dist/types/ai-model/conversation-history.d.ts +8 -0
- package/dist/types/ai-model/prompt/llm-planning.d.ts +2 -2
- package/dist/types/device/device-options.d.ts +18 -0
- package/dist/types/device/index.d.ts +1 -1
- package/dist/types/task-timing.d.ts +8 -0
- package/dist/types/types.d.ts +10 -0
- package/package.json +2 -2
|
@@ -28,6 +28,14 @@ export declare class ConversationHistory {
|
|
|
28
28
|
* Automatically marks the first pending goal as running.
|
|
29
29
|
*/
|
|
30
30
|
setSubGoals(subGoals: SubGoal[]): void;
|
|
31
|
+
/**
|
|
32
|
+
* Merge sub-goals from update-plan-content.
|
|
33
|
+
* Preserves existing descriptions when incoming description is empty.
|
|
34
|
+
*
|
|
35
|
+
* This handles compact XML updates like:
|
|
36
|
+
* <sub-goal index="1" status="finished" />
|
|
37
|
+
*/
|
|
38
|
+
mergeSubGoals(subGoals: SubGoal[]): void;
|
|
31
39
|
/**
|
|
32
40
|
* Update a single sub-goal by index.
|
|
33
41
|
* Clears logs if status or description actually changes.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { DeviceAction } from '../../types';
|
|
2
2
|
import type { TModelFamily } from '@midscene/shared/env';
|
|
3
3
|
export declare const descriptionForAction: (action: DeviceAction<any>, locatorSchemaTypeDescription: string) => string;
|
|
4
|
-
export declare function systemPromptToTaskPlanning({ actionSpace, modelFamily, includeBbox, includeThought,
|
|
4
|
+
export declare function systemPromptToTaskPlanning({ actionSpace, modelFamily, includeBbox, includeThought, includeSubGoals, }: {
|
|
5
5
|
actionSpace: DeviceAction<any>[];
|
|
6
6
|
modelFamily: TModelFamily | undefined;
|
|
7
7
|
includeBbox: boolean;
|
|
8
8
|
includeThought?: boolean;
|
|
9
|
-
|
|
9
|
+
includeSubGoals?: boolean;
|
|
10
10
|
}): Promise<string>;
|
|
@@ -122,3 +122,21 @@ export type IOSDeviceOpt = {
|
|
|
122
122
|
/** WDA MJPEG server port for real-time screen streaming (default: 9100) */
|
|
123
123
|
wdaMjpegPort?: number;
|
|
124
124
|
} & IOSDeviceInputOpt;
|
|
125
|
+
/**
|
|
126
|
+
* HarmonyOS device input options
|
|
127
|
+
*/
|
|
128
|
+
export type HarmonyDeviceInputOpt = {
|
|
129
|
+
/** Automatically dismiss the keyboard after input is completed */
|
|
130
|
+
autoDismissKeyboard?: boolean;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* HarmonyOS device options
|
|
134
|
+
*/
|
|
135
|
+
export type HarmonyDeviceOpt = {
|
|
136
|
+
/** Path to the HDC executable */
|
|
137
|
+
hdcPath?: string;
|
|
138
|
+
/** Custom device actions to register */
|
|
139
|
+
customActions?: DeviceAction<any>[];
|
|
140
|
+
/** Screenshot resize scale factor */
|
|
141
|
+
screenshotResizeScale?: number;
|
|
142
|
+
} & HarmonyDeviceInputOpt;
|
|
@@ -2247,4 +2247,4 @@ export type ActionSleepParam = {
|
|
|
2247
2247
|
};
|
|
2248
2248
|
export declare const defineActionSleep: () => DeviceAction<ActionSleepParam>;
|
|
2249
2249
|
export type { DeviceAction } from '../types';
|
|
2250
|
-
export type { AndroidDeviceOpt, AndroidDeviceInputOpt, IOSDeviceOpt, IOSDeviceInputOpt, } from './device-options';
|
|
2250
|
+
export type { AndroidDeviceOpt, AndroidDeviceInputOpt, IOSDeviceOpt, IOSDeviceInputOpt, HarmonyDeviceOpt, HarmonyDeviceInputOpt, } from './device-options';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ExecutionTask } from './types';
|
|
2
|
+
type ExecutionTaskTiming = NonNullable<ExecutionTask['timing']>;
|
|
3
|
+
type NumericTimingField = {
|
|
4
|
+
[K in keyof ExecutionTaskTiming]-?: ExecutionTaskTiming[K] extends number | undefined ? K : never;
|
|
5
|
+
}[keyof ExecutionTaskTiming];
|
|
6
|
+
export type TimingSettableField = Exclude<NumericTimingField, 'start' | 'end' | 'cost'>;
|
|
7
|
+
export declare function setTimingFieldOnce(timing: ExecutionTaskTiming | undefined, field: TimingSettableField): void;
|
|
8
|
+
export {};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -287,6 +287,16 @@ export type ExecutionTask<E extends ExecutionTaskApply<any, any, any> = Executio
|
|
|
287
287
|
errorStack?: string;
|
|
288
288
|
timing?: {
|
|
289
289
|
start: number;
|
|
290
|
+
getUiContextStart?: number;
|
|
291
|
+
getUiContextEnd?: number;
|
|
292
|
+
beforeInvokeActionHookStart?: number;
|
|
293
|
+
beforeInvokeActionHookEnd?: number;
|
|
294
|
+
callActionStart?: number;
|
|
295
|
+
callActionEnd?: number;
|
|
296
|
+
afterInvokeActionHookStart?: number;
|
|
297
|
+
afterInvokeActionHookEnd?: number;
|
|
298
|
+
captureAfterCallingSnapshotStart?: number;
|
|
299
|
+
captureAfterCallingSnapshotEnd?: number;
|
|
290
300
|
end?: number;
|
|
291
301
|
cost?: number;
|
|
292
302
|
};
|
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.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
6
6
|
"homepage": "https://midscenejs.com/",
|
|
7
7
|
"main": "./dist/lib/index.js",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"semver": "7.5.2",
|
|
90
90
|
"undici": "^6.0.0",
|
|
91
91
|
"zod": "3.24.3",
|
|
92
|
-
"@midscene/shared": "1.
|
|
92
|
+
"@midscene/shared": "1.5.0"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@rslib/core": "^0.18.3",
|