@midscene/web 0.22.1 → 0.22.2-beta-20250721085213.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.js +12 -7
- package/dist/es/agent.js.map +1 -1
- package/dist/es/bridge-mode-browser.js +3 -3
- package/dist/es/bridge-mode-browser.js.map +1 -1
- package/dist/es/bridge-mode.js +14 -9
- package/dist/es/bridge-mode.js.map +1 -1
- package/dist/es/chrome-extension.js +13 -8
- package/dist/es/chrome-extension.js.map +1 -1
- package/dist/es/index.js +12 -7
- package/dist/es/index.js.map +1 -1
- package/dist/es/midscene-playground.js +12 -7
- package/dist/es/midscene-playground.js.map +1 -1
- package/dist/es/playground.js +12 -7
- package/dist/es/playground.js.map +1 -1
- package/dist/es/playwright.js +12 -7
- package/dist/es/playwright.js.map +1 -1
- package/dist/es/puppeteer-agent-launcher.js +48 -31
- package/dist/es/puppeteer-agent-launcher.js.map +1 -1
- package/dist/es/puppeteer.js +12 -7
- package/dist/es/puppeteer.js.map +1 -1
- package/dist/es/yaml.js +12 -6
- package/dist/es/yaml.js.map +1 -1
- package/dist/lib/agent.js +11 -6
- package/dist/lib/agent.js.map +1 -1
- package/dist/lib/bridge-mode-browser.js +3 -3
- package/dist/lib/bridge-mode-browser.js.map +1 -1
- package/dist/lib/bridge-mode.js +13 -8
- package/dist/lib/bridge-mode.js.map +1 -1
- package/dist/lib/chrome-extension.js +12 -7
- package/dist/lib/chrome-extension.js.map +1 -1
- package/dist/lib/index.js +11 -6
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/midscene-playground.js +11 -6
- package/dist/lib/midscene-playground.js.map +1 -1
- package/dist/lib/playground.js +11 -6
- package/dist/lib/playground.js.map +1 -1
- package/dist/lib/playwright.js +11 -6
- package/dist/lib/playwright.js.map +1 -1
- package/dist/lib/puppeteer-agent-launcher.js +47 -30
- package/dist/lib/puppeteer-agent-launcher.js.map +1 -1
- package/dist/lib/puppeteer.js +11 -6
- package/dist/lib/puppeteer.js.map +1 -1
- package/dist/lib/yaml.js +12 -5
- package/dist/lib/yaml.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/puppeteer-agent-launcher.d.ts +3 -2
- package/dist/types/{utils-ca32cc55.d.ts → utils-9ef53160.d.ts} +4 -2
- package/dist/types/yaml.d.ts +1 -1
- package/package.json +4 -3
package/dist/es/agent.js
CHANGED
|
@@ -6,11 +6,11 @@ import yaml4 from "js-yaml";
|
|
|
6
6
|
|
|
7
7
|
// src/yaml/player.ts
|
|
8
8
|
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
9
|
-
import { dirname, join, resolve } from "path";
|
|
9
|
+
import { basename, dirname, join, resolve } from "path";
|
|
10
10
|
import { assert, ifInBrowser } from "@midscene/shared/utils";
|
|
11
11
|
import { getMidsceneRunSubDir } from "@midscene/shared/common";
|
|
12
12
|
var ScriptPlayer = class {
|
|
13
|
-
constructor(script, setupAgent, onTaskStatusChange) {
|
|
13
|
+
constructor(script, setupAgent, onTaskStatusChange, scriptPath) {
|
|
14
14
|
this.script = script;
|
|
15
15
|
this.setupAgent = setupAgent;
|
|
16
16
|
this.onTaskStatusChange = onTaskStatusChange;
|
|
@@ -18,6 +18,7 @@ var ScriptPlayer = class {
|
|
|
18
18
|
this.status = "init";
|
|
19
19
|
this.unnamedResultIndex = 0;
|
|
20
20
|
this.pageAgent = null;
|
|
21
|
+
this.scriptPath = scriptPath;
|
|
21
22
|
this.result = {};
|
|
22
23
|
this.target = script.target || script.web || script.android;
|
|
23
24
|
if (ifInBrowser) {
|
|
@@ -25,7 +26,11 @@ var ScriptPlayer = class {
|
|
|
25
26
|
} else if (this.target?.output) {
|
|
26
27
|
this.output = resolve(process.cwd(), this.target.output);
|
|
27
28
|
} else {
|
|
28
|
-
this.
|
|
29
|
+
const scriptName = this.scriptPath ? basename(this.scriptPath, ".yaml").replace(/\.(ya?ml)$/i, "") : "script";
|
|
30
|
+
this.output = join(
|
|
31
|
+
getMidsceneRunSubDir("output"),
|
|
32
|
+
`${scriptName}-${Date.now()}.json`
|
|
33
|
+
);
|
|
29
34
|
}
|
|
30
35
|
if (ifInBrowser) {
|
|
31
36
|
this.unstableLogContent = void 0;
|
|
@@ -80,13 +85,13 @@ var ScriptPlayer = class {
|
|
|
80
85
|
this.currentTaskIndex = taskIndex;
|
|
81
86
|
}
|
|
82
87
|
flushResult() {
|
|
83
|
-
if (
|
|
88
|
+
if (this.output) {
|
|
84
89
|
const output = resolve(process.cwd(), this.output);
|
|
85
90
|
const outputDir = dirname(output);
|
|
86
91
|
if (!existsSync(outputDir)) {
|
|
87
92
|
mkdirSync(outputDir, { recursive: true });
|
|
88
93
|
}
|
|
89
|
-
writeFileSync(output, JSON.stringify(this.result, void 0, 2));
|
|
94
|
+
writeFileSync(output, JSON.stringify(this.result || {}, void 0, 2));
|
|
90
95
|
}
|
|
91
96
|
}
|
|
92
97
|
flushUnstableLogContent() {
|
|
@@ -318,7 +323,7 @@ var ScriptPlayer = class {
|
|
|
318
323
|
break;
|
|
319
324
|
}
|
|
320
325
|
}
|
|
321
|
-
this.reportFile = agent
|
|
326
|
+
this.reportFile = agent?.reportFile;
|
|
322
327
|
taskIndex++;
|
|
323
328
|
}
|
|
324
329
|
if (errorFlag) {
|
|
@@ -554,7 +559,7 @@ import yaml3 from "js-yaml";
|
|
|
554
559
|
import semver from "semver";
|
|
555
560
|
|
|
556
561
|
// package.json
|
|
557
|
-
var version = "0.22.
|
|
562
|
+
var version = "0.22.2-beta-20250721085213.0";
|
|
558
563
|
|
|
559
564
|
// src/common/task-cache.ts
|
|
560
565
|
var debug = getDebug("cache");
|