@midscene/core 0.8.18 → 0.9.1-beta-20250110041124.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/lib/index.js CHANGED
@@ -5577,7 +5577,7 @@ function stringifyDumpData(data, indents) {
5577
5577
  return JSON.stringify(data, replacerForPageObject, indents);
5578
5578
  }
5579
5579
  function getVersion() {
5580
- return "0.8.18";
5580
+ return "0.9.1-beta-20250110041124.0";
5581
5581
  }
5582
5582
 
5583
5583
  // src/action/executor.ts
@@ -1,8 +1,8 @@
1
- import { g as AIUsageInfo } from './types-7702c41a.js';
1
+ import { g as AIUsageInfo } from './types-05c1f241.js';
2
2
  import { ChatCompletionMessageParam } from 'openai/resources';
3
3
  export { ChatCompletionMessageParam } from 'openai/resources';
4
- import { A as AIActionType } from './automation-82a83ef4.js';
5
- export { f as AiAssert, e as AiExtractElementInfo, b as AiInspectElement, c as callAiFn, d as describeUserPage, p as plan, t as transformElementPositionToId } from './automation-82a83ef4.js';
4
+ import { A as AIActionType } from './automation-81d96430.js';
5
+ export { f as AiAssert, e as AiExtractElementInfo, b as AiInspectElement, c as callAiFn, d as describeUserPage, p as plan, t as transformElementPositionToId } from './automation-81d96430.js';
6
6
 
7
7
  declare function callToGetJSONObject<T>(messages: ChatCompletionMessageParam[], AIActionTypeValue: AIActionType): Promise<{
8
8
  content: T;
@@ -1,4 +1,4 @@
1
- import { g as AIUsageInfo, B as BaseElement, U as UIContext, l as AIElementResponse, A as AISingleElementResponse, u as ElementById, m as AISectionParseResponse, n as AIAssertionResponse, z as PlanningAIResponse } from './types-7702c41a.js';
1
+ import { g as AIUsageInfo, B as BaseElement, U as UIContext, l as AIElementResponse, A as AISingleElementResponse, u as ElementById, m as AISectionParseResponse, n as AIAssertionResponse, z as PlanningAIResponse } from './types-05c1f241.js';
2
2
  import { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam } from 'openai/resources';
3
3
 
4
4
  type AIArgs = [
@@ -1,8 +1,8 @@
1
- import { E as ExecutionTask, a as ExecutionTaskProgressOptions, b as ExecutionTaskApply, c as ExecutionDump, B as BaseElement, U as UIContext, I as InsightAction, D as DumpSubscriber, d as InsightOptions, e as InsightTaskInfo, A as AISingleElementResponse, f as InsightAssertionResponse } from './types-7702c41a.js';
2
- export { n as AIAssertionResponse, k as AIElementIdResponse, l as AIElementResponse, h as AIResponseFormat, m as AISectionParseResponse, i as AISingleElementResponseById, j as AISingleElementResponseByPosition, g as AIUsageInfo, w as AgentAssertOpt, v as AgentWaitForOpt, W as BaseAgentParserOpt, C as CallAIFn, V as Color, q as DumpMeta, u as ElementById, o as EnsureObject, Z as ExecutionRecorderItem, af as ExecutionTaskAction, ae as ExecutionTaskActionApply, ad as ExecutionTaskInsightAssertion, ac as ExecutionTaskInsightAssertionApply, ab as ExecutionTaskInsightAssertionParam, a4 as ExecutionTaskInsightDumpLog, a6 as ExecutionTaskInsightLocate, a5 as ExecutionTaskInsightLocateApply, a3 as ExecutionTaskInsightLocateOutput, a2 as ExecutionTaskInsightLocateParam, aa as ExecutionTaskInsightQuery, a9 as ExecutionTaskInsightQueryApply, a8 as ExecutionTaskInsightQueryOutput, a7 as ExecutionTaskInsightQueryParam, ah as ExecutionTaskPlanning, ag as ExecutionTaskPlanningApply, a1 as ExecutionTaskReturn, _ as ExecutionTaskType, $ as ExecutorContext, ai as GroupedActionDump, s as InsightDump, p as InsightExtractParam, L as LiteUISection, t as PartialInsightDumpFromSDK, z as PlanningAIResponse, y as PlanningAction, N as PlanningActionParamAssert, Q as PlanningActionParamError, J as PlanningActionParamHover, K as PlanningActionParamInputOrKeyPress, G as PlanningActionParamPlan, M as PlanningActionParamScroll, O as PlanningActionParamSleep, H as PlanningActionParamTap, T as PlanningActionParamWaitFor, F as PlanningFurtherPlan, x as PlanningLocateParam, Y as PlaywrightParserOpt, P as Point, X as PuppeteerParserOpt, R as Rect, r as ReportDumpWithAttributes, S as Size, a0 as TaskCacheInfo } from './types-7702c41a.js';
1
+ import { E as ExecutionTask, a as ExecutionTaskProgressOptions, b as ExecutionTaskApply, c as ExecutionDump, B as BaseElement, U as UIContext, I as InsightAction, D as DumpSubscriber, d as InsightOptions, e as InsightTaskInfo, A as AISingleElementResponse, f as InsightAssertionResponse } from './types-05c1f241.js';
2
+ export { n as AIAssertionResponse, k as AIElementIdResponse, l as AIElementResponse, h as AIResponseFormat, m as AISectionParseResponse, i as AISingleElementResponseById, j as AISingleElementResponseByPosition, g as AIUsageInfo, w as AgentAssertOpt, v as AgentWaitForOpt, X as BaseAgentParserOpt, C as CallAIFn, W as Color, q as DumpMeta, u as ElementById, o as EnsureObject, _ as ExecutionRecorderItem, ag as ExecutionTaskAction, af as ExecutionTaskActionApply, ae as ExecutionTaskInsightAssertion, ad as ExecutionTaskInsightAssertionApply, ac as ExecutionTaskInsightAssertionParam, a5 as ExecutionTaskInsightDumpLog, a7 as ExecutionTaskInsightLocate, a6 as ExecutionTaskInsightLocateApply, a4 as ExecutionTaskInsightLocateOutput, a3 as ExecutionTaskInsightLocateParam, ab as ExecutionTaskInsightQuery, aa as ExecutionTaskInsightQueryApply, a9 as ExecutionTaskInsightQueryOutput, a8 as ExecutionTaskInsightQueryParam, ai as ExecutionTaskPlanning, ah as ExecutionTaskPlanningApply, a2 as ExecutionTaskReturn, $ as ExecutionTaskType, a0 as ExecutorContext, aj as GroupedActionDump, s as InsightDump, p as InsightExtractParam, L as LiteUISection, O as OnTaskStartTip, t as PartialInsightDumpFromSDK, z as PlanningAIResponse, y as PlanningAction, N as PlanningActionParamAssert, T as PlanningActionParamError, J as PlanningActionParamHover, K as PlanningActionParamInputOrKeyPress, G as PlanningActionParamPlan, M as PlanningActionParamScroll, Q as PlanningActionParamSleep, H as PlanningActionParamTap, V as PlanningActionParamWaitFor, F as PlanningFurtherPlan, x as PlanningLocateParam, Z as PlaywrightParserOpt, P as Point, Y as PuppeteerParserOpt, R as Rect, r as ReportDumpWithAttributes, S as Size, a1 as TaskCacheInfo } from './types-05c1f241.js';
3
3
  export { allAIConfig, getAIConfig, overrideAIConfig } from './env.js';
4
- import { c as callAiFn, r as retrieveElement, a as retrieveSection } from './automation-82a83ef4.js';
5
- export { p as plan, t as transformElementPositionToId } from './automation-82a83ef4.js';
4
+ import { c as callAiFn, r as retrieveElement, a as retrieveSection } from './automation-81d96430.js';
5
+ export { p as plan, t as transformElementPositionToId } from './automation-81d96430.js';
6
6
  export { getLogDirByType, getVersion, setLogDir } from './utils.js';
7
7
  import 'openai/resources';
8
8
 
@@ -14,20 +14,26 @@ interface MidsceneYamlScript {
14
14
  interface MidsceneYamlTask {
15
15
  name: string;
16
16
  flow: MidsceneYamlFlowItem[];
17
+ continueOnError?: boolean;
17
18
  }
18
19
 
19
20
  interface MidsceneYamlScriptEnv {
21
+ serve?: string;
20
22
  url: string;
23
+
24
+ // puppeteer only
21
25
  userAgent?: string;
22
26
  viewportWidth?: number;
23
27
  viewportHeight?: number;
24
28
  viewportScale?: number;
25
- serve?: string;
26
29
  waitForNetworkIdle?: {
27
30
  timeout?: number; // ms, 30000 for default, set to 0 to disable
28
31
  continueOnNetworkIdleError?: boolean; // should continue if failed to wait for network idle, true for default
29
32
  };
30
33
  cookie?: string;
34
+
35
+ // bridge mode only
36
+ bridgeMode?: 'newTabWithUrl' | 'currentTab';
31
37
  output?: string;
32
38
  }
33
39
 
@@ -144,6 +144,7 @@ type InsightAssertionResponse = AIAssertionResponse;
144
144
  /**
145
145
  * agent
146
146
  */
147
+ type OnTaskStartTip = (tip: string) => Promise<void> | void;
147
148
  interface AgentWaitForOpt {
148
149
  checkIntervalMs?: number;
149
150
  timeoutMs?: number;
@@ -300,4 +301,4 @@ interface GroupedActionDump {
300
301
  executions: ExecutionDump[];
301
302
  }
302
303
 
303
- export { type ExecutorContext as $, type AISingleElementResponse as A, BaseElement as B, type CallAIFn as C, type DumpSubscriber as D, type ExecutionTask as E, type PlanningFurtherPlan as F, type PlanningActionParamPlan as G, type PlanningActionParamTap as H, type InsightAction as I, type PlanningActionParamHover as J, type PlanningActionParamInputOrKeyPress as K, type LiteUISection as L, type PlanningActionParamScroll as M, type PlanningActionParamAssert as N, type PlanningActionParamSleep as O, type Point as P, type PlanningActionParamError as Q, type Rect as R, type Size as S, type PlanningActionParamWaitFor as T, UIContext as U, type Color as V, type BaseAgentParserOpt as W, type PuppeteerParserOpt as X, type PlaywrightParserOpt as Y, type ExecutionRecorderItem as Z, type ExecutionTaskType as _, type ExecutionTaskProgressOptions as a, type TaskCacheInfo as a0, type ExecutionTaskReturn as a1, type ExecutionTaskInsightLocateParam as a2, type ExecutionTaskInsightLocateOutput as a3, type ExecutionTaskInsightDumpLog as a4, type ExecutionTaskInsightLocateApply as a5, type ExecutionTaskInsightLocate as a6, type ExecutionTaskInsightQueryParam as a7, type ExecutionTaskInsightQueryOutput as a8, type ExecutionTaskInsightQueryApply as a9, type ExecutionTaskInsightQuery as aa, type ExecutionTaskInsightAssertionParam as ab, type ExecutionTaskInsightAssertionApply as ac, type ExecutionTaskInsightAssertion as ad, type ExecutionTaskActionApply as ae, type ExecutionTaskAction as af, type ExecutionTaskPlanningApply as ag, type ExecutionTaskPlanning as ah, type GroupedActionDump as ai, type ExecutionTaskApply as b, type ExecutionDump as c, type InsightOptions as d, type InsightTaskInfo as e, type InsightAssertionResponse as f, type AIUsageInfo as g, AIResponseFormat as h, type AISingleElementResponseById as i, type AISingleElementResponseByPosition as j, type AIElementIdResponse as k, type AIElementResponse as l, type AISectionParseResponse as m, type AIAssertionResponse as n, type EnsureObject as o, type InsightExtractParam as p, type DumpMeta as q, type ReportDumpWithAttributes as r, type InsightDump as s, type PartialInsightDumpFromSDK as t, type ElementById as u, type AgentWaitForOpt as v, type AgentAssertOpt as w, type PlanningLocateParam as x, type PlanningAction as y, type PlanningAIResponse as z };
304
+ export { type ExecutionTaskType as $, type AISingleElementResponse as A, BaseElement as B, type CallAIFn as C, type DumpSubscriber as D, type ExecutionTask as E, type PlanningFurtherPlan as F, type PlanningActionParamPlan as G, type PlanningActionParamTap as H, type InsightAction as I, type PlanningActionParamHover as J, type PlanningActionParamInputOrKeyPress as K, type LiteUISection as L, type PlanningActionParamScroll as M, type PlanningActionParamAssert as N, type OnTaskStartTip as O, type Point as P, type PlanningActionParamSleep as Q, type Rect as R, type Size as S, type PlanningActionParamError as T, UIContext as U, type PlanningActionParamWaitFor as V, type Color as W, type BaseAgentParserOpt as X, type PuppeteerParserOpt as Y, type PlaywrightParserOpt as Z, type ExecutionRecorderItem as _, type ExecutionTaskProgressOptions as a, type ExecutorContext as a0, type TaskCacheInfo as a1, type ExecutionTaskReturn as a2, type ExecutionTaskInsightLocateParam as a3, type ExecutionTaskInsightLocateOutput as a4, type ExecutionTaskInsightDumpLog as a5, type ExecutionTaskInsightLocateApply as a6, type ExecutionTaskInsightLocate as a7, type ExecutionTaskInsightQueryParam as a8, type ExecutionTaskInsightQueryOutput as a9, type ExecutionTaskInsightQueryApply as aa, type ExecutionTaskInsightQuery as ab, type ExecutionTaskInsightAssertionParam as ac, type ExecutionTaskInsightAssertionApply as ad, type ExecutionTaskInsightAssertion as ae, type ExecutionTaskActionApply as af, type ExecutionTaskAction as ag, type ExecutionTaskPlanningApply as ah, type ExecutionTaskPlanning as ai, type GroupedActionDump as aj, type ExecutionTaskApply as b, type ExecutionDump as c, type InsightOptions as d, type InsightTaskInfo as e, type InsightAssertionResponse as f, type AIUsageInfo as g, AIResponseFormat as h, type AISingleElementResponseById as i, type AISingleElementResponseByPosition as j, type AIElementIdResponse as k, type AIElementResponse as l, type AISectionParseResponse as m, type AIAssertionResponse as n, type EnsureObject as o, type InsightExtractParam as p, type DumpMeta as q, type ReportDumpWithAttributes as r, type InsightDump as s, type PartialInsightDumpFromSDK as t, type ElementById as u, type AgentWaitForOpt as v, type AgentAssertOpt as w, type PlanningLocateParam as x, type PlanningAction as y, type PlanningAIResponse as z };
@@ -1,4 +1,4 @@
1
- import { r as ReportDumpWithAttributes, R as Rect } from './types-7702c41a.js';
1
+ import { r as ReportDumpWithAttributes, R as Rect } from './types-05c1f241.js';
2
2
  import 'openai/resources';
3
3
 
4
4
  declare const insightDumpFileExt = "insight-dump.json";
package/dist/lib/utils.js CHANGED
@@ -303,7 +303,7 @@ function stringifyDumpData(data, indents) {
303
303
  return JSON.stringify(data, replacerForPageObject, indents);
304
304
  }
305
305
  function getVersion() {
306
- return "0.8.18";
306
+ return "0.9.1-beta-20250110041124.0";
307
307
  }
308
308
  function debugLog(...message) {
309
309
  const debugMode = getAIConfig(MIDSCENE_DEBUG_MODE);
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": "0.8.18",
4
+ "version": "0.9.1-beta-20250110041124.0",
5
5
  "repository": "https://github.com/web-infra-dev/midscene",
6
6
  "homepage": "https://midscenejs.com/",
7
7
  "jsnext:source": "./src/index.ts",
@@ -41,7 +41,7 @@
41
41
  "@langchain/core": "0.3.26",
42
42
  "socks-proxy-agent": "8.0.4",
43
43
  "openai": "4.57.1",
44
- "@midscene/shared": "0.8.18"
44
+ "@midscene/shared": "0.9.1-beta-20250110041124.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@modern-js/module-tools": "2.60.6",