@midscene/core 1.0.1-beta-20251208085324.0 → 1.0.1-beta-20251208112226.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.
@@ -1,6 +1,6 @@
1
1
  import type { AbstractInterface } from '../device';
2
2
  import type Service from '../service';
3
- import type { DetailedLocateParam, ExecutionTaskActionApply, ExecutionTaskApply, PlanningAction, PlanningActionParamSleep, PlanningLocateParam } from '../types';
3
+ import type { DetailedLocateParam, DeviceAction, ExecutionTaskActionApply, ExecutionTaskApply, PlanningAction, PlanningActionParamSleep, PlanningLocateParam } from '../types';
4
4
  import type { IModelConfig } from '@midscene/shared/env';
5
5
  import type { TaskCache } from './task-cache';
6
6
  export declare function locatePlanForLocate(param: string | DetailedLocateParam): PlanningAction<PlanningLocateParam>;
@@ -8,6 +8,7 @@ interface TaskBuilderDeps {
8
8
  interfaceInstance: AbstractInterface;
9
9
  service: Service;
10
10
  taskCache?: TaskCache;
11
+ actionSpace: DeviceAction[];
11
12
  }
12
13
  interface BuildOptions {
13
14
  cacheable?: boolean;
@@ -17,7 +18,8 @@ export declare class TaskBuilder {
17
18
  private readonly interface;
18
19
  private readonly service;
19
20
  private readonly taskCache?;
20
- constructor({ interfaceInstance, service, taskCache }: TaskBuilderDeps);
21
+ private readonly actionSpace;
22
+ constructor({ interfaceInstance, service, taskCache, actionSpace, }: TaskBuilderDeps);
21
23
  build(plans: PlanningAction[], modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig, options?: BuildOptions): Promise<{
22
24
  tasks: ExecutionTaskApply[];
23
25
  }>;
@@ -3,7 +3,7 @@ import type { AbstractInterface } from '../device';
3
3
  import type Service from '../service';
4
4
  import type { TaskRunner } from '../task-runner';
5
5
  import { TaskExecutionError } from '../task-runner';
6
- import type { ExecutionTaskApply, ExecutionTaskProgressOptions, MidsceneYamlFlowItem, PlanningAction, PlanningActionParamSleep, PlanningActionParamWaitFor, ServiceExtractOption, ServiceExtractParam } from '../types';
6
+ import type { ExecutionTaskApply, ExecutionTaskProgressOptions, MidsceneYamlFlowItem, PlanningAction, PlanningActionParamSleep, PlanningActionParamWaitFor, ServiceExtractOption, ServiceExtractParam, DeviceAction } from '../types';
7
7
  import type { IModelConfig } from '@midscene/shared/env';
8
8
  import type { TaskCache } from './task-cache';
9
9
  export { locatePlanForLocate } from './task-builder';
@@ -20,6 +20,7 @@ export declare class TaskExecutor {
20
20
  interface: AbstractInterface;
21
21
  service: Service;
22
22
  taskCache?: TaskCache;
23
+ private readonly providedActionSpace;
23
24
  private readonly taskBuilder;
24
25
  private conversationHistory;
25
26
  onTaskStartCallback?: ExecutionTaskProgressOptions['onTaskStart'];
@@ -31,8 +32,10 @@ export declare class TaskExecutor {
31
32
  onTaskStart?: ExecutionTaskProgressOptions['onTaskStart'];
32
33
  replanningCycleLimit?: number;
33
34
  hooks?: TaskExecutorHooks;
35
+ actionSpace: DeviceAction[];
34
36
  });
35
37
  private createExecutionSession;
38
+ private getActionSpace;
36
39
  convertPlanToExecutable(plans: PlanningAction[], modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig, options?: {
37
40
  cacheable?: boolean;
38
41
  subTask?: boolean;
@@ -7,7 +7,7 @@ export declare abstract class AbstractInterface {
7
7
  abstract interfaceType: string;
8
8
  abstract screenshotBase64(): Promise<string>;
9
9
  abstract size(): Promise<Size>;
10
- abstract actionSpace(): DeviceAction[] | Promise<DeviceAction[]>;
10
+ abstract actionSpace(): DeviceAction[];
11
11
  abstract cacheFeatureForRect?(rect: Rect, options?: {
12
12
  targetDescription?: string;
13
13
  modelConfig?: IModelConfig;
@@ -2153,14 +2153,22 @@ export type ActionClearInputParam = {
2153
2153
  export declare const defineActionClearInput: (call: (param: ActionClearInputParam) => Promise<void>) => DeviceAction<ActionClearInputParam>;
2154
2154
  export declare const actionAssertParamSchema: z.ZodObject<{
2155
2155
  condition: z.ZodString;
2156
+ thought: z.ZodString;
2157
+ result: z.ZodBoolean;
2156
2158
  }, "strip", z.ZodTypeAny, {
2157
2159
  condition: string;
2160
+ thought: string;
2161
+ result: boolean;
2158
2162
  }, {
2159
2163
  condition: string;
2164
+ thought: string;
2165
+ result: boolean;
2160
2166
  }>;
2161
2167
  export type ActionAssertParam = {
2162
2168
  condition: string;
2169
+ thought: string;
2170
+ result: boolean;
2163
2171
  };
2164
- export declare const defineActionAssert: (call: (param: ActionAssertParam) => Promise<void>) => DeviceAction<ActionAssertParam>;
2172
+ export declare const defineActionAssert: () => DeviceAction<ActionAssertParam>;
2165
2173
  export type { DeviceAction } from '../types';
2166
2174
  export type { AndroidDeviceOpt, AndroidDeviceInputOpt, IOSDeviceOpt, IOSDeviceInputOpt, } from './device-options';
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.0.1-beta-20251208085324.0",
4
+ "version": "1.0.1-beta-20251208112226.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
  "js-yaml": "4.1.0",
91
91
  "zod": "3.24.3",
92
- "@midscene/shared": "1.0.1-beta-20251208085324.0"
92
+ "@midscene/shared": "1.0.1-beta-20251208112226.0"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@rslib/core": "^0.18.2",