@midscene/core 1.9.7 → 1.9.8-beta-20260618091332.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 { TUserPrompt } from '../ai-model/index';
2
2
  import Service from '../service/index';
3
- import { type ActionParam, type ActionReturn, type AgentAssertOpt, type AgentDescribeElementAtPointResult, type AgentOpt, type AgentWaitForOpt, type DeepThinkOption, type DeviceAction, ExecutionDump, type LocateOption, type LocateResultElement, type LocateValidatorResult, type LocatorValidatorOption, type OnTaskStartTip, ReportActionDump, type ScrollParam, type ServiceAction, type ServiceExtractOption, type ServiceExtractParam, type Size, type UIContext } from '../types';
3
+ import { type ActionParam, type ActionReturn, type AgentAssertOpt, type AgentDescribeElementAtPointResult, type AgentOpt, type AgentWaitForOpt, type DeepThinkOption, type DeviceAction, ExecutionDump, type LocateOption, type LocateResultElement, type LocateValidatorResult, type LocatorValidatorOption, type OnTaskStartTip, type RecordToReportOptions, ReportActionDump, type ScrollParam, type ServiceAction, type ServiceExtractOption, type ServiceExtractParam, type Size, type UIContext } from '../types';
4
4
  import type { AbstractInterface } from '../device';
5
5
  import type { TaskRunner } from '../task-runner';
6
6
  import { ModelConfigManager } from '@midscene/shared/env';
@@ -200,10 +200,7 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
200
200
  clearDumpUpdateListeners(): void;
201
201
  private notifyDumpUpdateListeners;
202
202
  destroy(): Promise<void>;
203
- recordToReport(title?: string, opt?: {
204
- content?: string;
205
- screenshotBase64?: string;
206
- }): Promise<void>;
203
+ recordToReport(title?: string, opt?: RecordToReportOptions): Promise<void>;
207
204
  recordErrorToReport(title: string, opt: {
208
205
  error: Error;
209
206
  content?: string;
@@ -6,4 +6,5 @@ export { type LocateCache, type PlanningCache, TaskCache } from './task-cache';
6
6
  export { cacheFileExt } from './task-cache';
7
7
  export { TaskExecutor } from './tasks';
8
8
  export type { AgentOpt } from '../types';
9
+ export type { RecordToReportOptions, RecordToReportScreenshot } from '../types';
9
10
  export type { AiActOptions, DescribeElementAtPointOptions, DescribeElementCoordinateSpace, } from './agent';
@@ -0,0 +1,2 @@
1
+ import type { RecordToReportScreenshot } from '../types';
2
+ export declare function normalizeRecordToReportScreenshot(screenshot: RecordToReportScreenshot, index: number): RecordToReportScreenshot;
@@ -1,7 +1,8 @@
1
1
  import type { TMultimodalPrompt, TUserPrompt } from '../common';
2
2
  import type { AbstractInterface } from '../device';
3
- import type { ElementCacheFeature, LocateResultElement, PixelBbox, PlanningLocateParam, PlanningLocateParamWithLocatedPixelBbox, Rect, Size, UIContext } from '../types';
3
+ import type { ElementCacheFeature, LocateResultElement, PixelBbox, PlanningLocateParam, PlanningLocateParamWithLocatedPixelBbox, Rect, ScrollParam, Size, UIContext } from '../types';
4
4
  import type { TaskCache } from './task-cache';
5
+ export declare const normalizeScrollType: (scrollType: string | undefined) => ScrollParam["scrollType"] | undefined;
5
6
  export declare function commonContextParser(interfaceInstance: AbstractInterface, _opt: {
6
7
  uploadServerUrl?: string;
7
8
  screenshotShrinkFactor?: number;
@@ -10,7 +10,7 @@ export { z };
10
10
  export default Service;
11
11
  export { TaskRunner, Service, getVersion };
12
12
  export type { MidsceneYamlScript, MidsceneYamlTask, MidsceneYamlFlowItem, MidsceneYamlConfigResult, MidsceneYamlConfig, MidsceneYamlScriptWebEnv, MidsceneYamlScriptAndroidEnv, MidsceneYamlScriptIOSEnv, MidsceneYamlScriptEnv, LocateOption, DetailedLocateParam, } from './yaml';
13
- export { Agent, type AgentOpt, type AiActOptions, createAgent } from './agent';
13
+ export { Agent, type AgentOpt, type AiActOptions, createAgent, } from './agent';
14
14
  export { restoreImageReferences, escapeContent, unescapeContent, parseImageScripts, parseDumpScript, parseDumpScriptAttributes, generateImageScriptTag, generateDumpScriptTag, } from './dump';
15
15
  export { getTaskSearchArea, getTaskServiceDump, } from './dump/task-service-dump';
16
16
  export type { IReportGenerator } from './report-generator';
@@ -291,8 +291,27 @@ export interface ExecutionRecorderItem {
291
291
  type: 'screenshot';
292
292
  ts: number;
293
293
  screenshot?: ScreenshotItem;
294
+ description?: string;
294
295
  timing?: string;
295
296
  }
297
+ export interface RecordToReportScreenshot {
298
+ /**
299
+ * PNG/JPEG data URI, or raw PNG base64 body.
300
+ */
301
+ base64: string;
302
+ description?: string;
303
+ }
304
+ export interface RecordToReportOptions {
305
+ content?: string;
306
+ /**
307
+ * @deprecated Use `screenshots: [{ base64 }]` instead.
308
+ */
309
+ screenshotBase64?: string;
310
+ /**
311
+ * Custom screenshots to display under a single report entry.
312
+ */
313
+ screenshots?: RecordToReportScreenshot[];
314
+ }
296
315
  export type ExecutionTaskType = 'Planning' | 'Insight' | 'Action Space' | 'Log';
297
316
  export interface ExecutorContext {
298
317
  task: ExecutionTask;
@@ -109,6 +109,19 @@ export interface MidsceneYamlScriptWebEnv extends MidsceneYamlScriptConfig, Mids
109
109
  */
110
110
  extraHTTPHeaders?: Record<string, string>;
111
111
  forceSameTabNavigation?: boolean;
112
+ /**
113
+ * Chrome download directory (Puppeteer only, not supported in bridge mode).
114
+ *
115
+ * Relative paths are resolved from the current working directory.
116
+ *
117
+ * @example
118
+ * ```yaml
119
+ * web:
120
+ * url: https://example.com
121
+ * downloadPath: ./downloads
122
+ * ```
123
+ */
124
+ downloadPath?: string;
112
125
  /**
113
126
  * Custom Chrome launch arguments (Puppeteer only, not supported in bridge mode).
114
127
  *
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.9.7",
4
+ "version": "1.9.8-beta-20260618091332.0",
5
5
  "repository": "https://github.com/web-infra-dev/midscene",
6
6
  "homepage": "https://midscenejs.com/",
7
7
  "main": "./dist/lib/index.js",
@@ -107,7 +107,7 @@
107
107
  "semver": "7.5.2",
108
108
  "undici": "^6.0.0",
109
109
  "zod": "^3.25.1",
110
- "@midscene/shared": "1.9.7"
110
+ "@midscene/shared": "1.9.8-beta-20260618091332.0"
111
111
  },
112
112
  "devDependencies": {
113
113
  "@rslib/core": "^0.18.3",