@midscene/core 1.0.1-beta-20251209112631.0 → 1.0.1-beta-20251211124955.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.
@@ -23,13 +23,16 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
23
23
  dryMode: boolean;
24
24
  onTaskStartTip?: OnTaskStartTip;
25
25
  taskCache?: TaskCache;
26
- onDumpUpdate?: (dump: string) => void;
26
+ private dumpUpdateListeners;
27
+ get onDumpUpdate(): ((dump: string, executionDump?: ExecutionDump) => void) | undefined;
28
+ set onDumpUpdate(callback: ((dump: string, executionDump?: ExecutionDump) => void) | undefined);
27
29
  destroyed: boolean;
28
30
  modelConfigManager: ModelConfigManager;
29
31
  /**
30
32
  * Frozen page context for consistent AI operations
31
33
  */
32
34
  private frozenUIContext?;
35
+ private get aiActContext();
33
36
  /**
34
37
  * Flag to track if VL model warning has been shown
35
38
  */
@@ -57,7 +60,11 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
57
60
  getActionSpace(): Promise<DeviceAction[]>;
58
61
  getUIContext(action?: ServiceAction): Promise<UIContext>;
59
62
  _snapshotContext(): Promise<UIContext>;
63
+ /**
64
+ * @deprecated Use {@link setAIActContext} instead.
65
+ */
60
66
  setAIActionContext(prompt: string): Promise<void>;
67
+ setAIActContext(prompt: string): Promise<void>;
61
68
  resetDump(): GroupedActionDump;
62
69
  appendExecutionDump(execution: ExecutionDump, runner?: TaskRunner): void;
63
70
  dumpDataString(): string;
@@ -139,6 +146,21 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
139
146
  result: Record<string, any>;
140
147
  }>;
141
148
  evaluateJavaScript(script: string): Promise<any>;
149
+ /**
150
+ * Add a dump update listener
151
+ * @param listener Listener function
152
+ * @returns A remove function that can be called to remove this listener
153
+ */
154
+ addDumpUpdateListener(listener: (dump: string, executionDump?: ExecutionDump) => void): () => void;
155
+ /**
156
+ * Remove a dump update listener
157
+ * @param listener The listener function to remove
158
+ */
159
+ removeDumpUpdateListener(listener: (dump: string, executionDump?: ExecutionDump) => void): void;
160
+ /**
161
+ * Clear all dump update listeners
162
+ */
163
+ clearDumpUpdateListeners(): void;
142
164
  destroy(): Promise<void>;
143
165
  recordToReport(title?: string, opt?: {
144
166
  content: string;
@@ -46,7 +46,7 @@ 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, backgroundKnowledge?: string, cacheable?: boolean, replanningCycleLimitOverride?: number, imagesIncludeCount?: number): Promise<ExecutionResult<{
49
+ action(userPrompt: string, modelConfigForPlanning: IModelConfig, modelConfigForDefaultIntent: IModelConfig, includeBboxInPlanning: boolean, aiActContext?: string, cacheable?: boolean, replanningCycleLimitOverride?: number, imagesIncludeCount?: number): Promise<ExecutionResult<{
50
50
  yamlFlow?: MidsceneYamlFlowItem[];
51
51
  } | undefined>>;
52
52
  private createTypeQueryTask;
@@ -274,7 +274,7 @@ export interface ExecutionDump extends DumpMeta {
274
274
  name: string;
275
275
  description?: string;
276
276
  tasks: ExecutionTask[];
277
- aiActionContext?: string;
277
+ aiActContext?: string;
278
278
  }
279
279
  export type ExecutionTaskInsightLocateParam = PlanningLocateParam;
280
280
  export interface ExecutionTaskInsightLocateOutput {
@@ -304,7 +304,7 @@ export type ExecutionTaskLogApply<LogParam = {
304
304
  export type ExecutionTaskLog = ExecutionTask<ExecutionTaskLogApply>;
305
305
  export type ExecutionTaskPlanningApply = ExecutionTaskApply<'Planning', {
306
306
  userInstruction: string;
307
- aiActionContext?: string;
307
+ aiActContext?: string;
308
308
  }, PlanningAIResponse>;
309
309
  export type ExecutionTaskPlanning = ExecutionTask<ExecutionTaskPlanningApply>;
310
310
  export type ExecutionTaskPlanningLocateParam = PlanningLocateParam;
@@ -399,6 +399,7 @@ export interface AgentOpt {
399
399
  generateReport?: boolean;
400
400
  autoPrintReportMsg?: boolean;
401
401
  onTaskStartTip?: OnTaskStartTip;
402
+ aiActContext?: string;
402
403
  aiActionContext?: string;
403
404
  reportFileName?: string;
404
405
  modelConfig?: TModelConfig;
@@ -67,7 +67,7 @@ export interface MidsceneYamlTask {
67
67
  * strategy: "read-write"
68
68
  * ```
69
69
  */
70
- export type MidsceneYamlScriptAgentOpt = Pick<AgentOpt, 'testId' | 'groupName' | 'groupDescription' | 'generateReport' | 'autoPrintReportMsg' | 'reportFileName' | 'replanningCycleLimit' | 'aiActionContext' | 'cache'>;
70
+ export type MidsceneYamlScriptAgentOpt = Pick<AgentOpt, 'testId' | 'groupName' | 'groupDescription' | 'generateReport' | 'autoPrintReportMsg' | 'reportFileName' | 'replanningCycleLimit' | 'aiActContext' | 'aiActionContext' | 'cache'>;
71
71
  export interface MidsceneYamlScriptConfig {
72
72
  output?: string;
73
73
  unstableLogContent?: boolean | string;
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-20251209112631.0",
4
+ "version": "1.0.1-beta-20251211124955.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-20251209112631.0"
92
+ "@midscene/shared": "1.0.1-beta-20251211124955.0"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@rslib/core": "^0.18.3",