@midscene/core 0.8.3 → 0.8.5-beta-20241122072506.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/ai-model.js +102 -51
- package/dist/lib/index.js +110 -53
- package/dist/lib/types/ai-model.d.ts +2 -2
- package/dist/lib/types/{index-690c2a06.d.ts → index-152b8346.d.ts} +1 -1
- package/dist/lib/types/index.d.ts +5 -5
- package/dist/lib/types/{types-29994b1b.d.ts → types-0d8eeece.d.ts} +3 -1
- package/dist/lib/types/utils.d.ts +3 -3
- package/dist/lib/utils.js +9 -4
- package/package.json +2 -2
- package/report/index.html +2 -2
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { r as ReportDumpWithAttributes, R as Rect } from './types-
|
|
1
|
+
import { r as ReportDumpWithAttributes, R as Rect } from './types-0d8eeece.js';
|
|
2
2
|
import 'openai/resources';
|
|
3
3
|
|
|
4
4
|
declare const insightDumpFileExt = "insight-dump.json";
|
|
5
5
|
declare const groupedActionDumpFileExt = "web-dump.json";
|
|
6
6
|
declare function getLogDir(): string;
|
|
7
7
|
declare function setLogDir(dir: string): void;
|
|
8
|
-
declare function getLogDirByType(type: 'dump' | 'cache' | 'report'): string;
|
|
8
|
+
declare function getLogDirByType(type: 'dump' | 'cache' | 'report' | 'tmp'): string;
|
|
9
9
|
declare function reportHTMLContent(dumpData: string | ReportDumpWithAttributes[]): string;
|
|
10
10
|
declare function writeDumpReport(fileName: string, dumpData: string | ReportDumpWithAttributes[]): string | null;
|
|
11
11
|
declare function writeLogFile(opts: {
|
|
12
12
|
fileName: string;
|
|
13
13
|
fileExt: string;
|
|
14
14
|
fileContent: string;
|
|
15
|
-
type: 'dump' | 'cache' | 'report';
|
|
15
|
+
type: 'dump' | 'cache' | 'report' | 'tmp';
|
|
16
16
|
generateReport?: boolean;
|
|
17
17
|
}): string | null;
|
|
18
18
|
declare function getTmpDir(): string | null;
|
package/dist/lib/utils.js
CHANGED
|
@@ -214,6 +214,7 @@ function writeLogFile(opts) {
|
|
|
214
214
|
# Midscene.js dump files
|
|
215
215
|
${logDirName}/report
|
|
216
216
|
${logDirName}/dump
|
|
217
|
+
${logDirName}/tmp
|
|
217
218
|
`,
|
|
218
219
|
"utf-8"
|
|
219
220
|
);
|
|
@@ -272,7 +273,7 @@ function stringifyDumpData(data, indents) {
|
|
|
272
273
|
return JSON.stringify(data, replacerForPageObject, indents);
|
|
273
274
|
}
|
|
274
275
|
function getVersion() {
|
|
275
|
-
return "0.8.
|
|
276
|
+
return "0.8.5-beta-20241122072506.0";
|
|
276
277
|
}
|
|
277
278
|
function debugLog(...message) {
|
|
278
279
|
const debugMode = getAIConfig(MIDSCENE_DEBUG_MODE);
|
|
@@ -285,19 +286,22 @@ function uploadTestInfoToServer({
|
|
|
285
286
|
testUrl
|
|
286
287
|
}) {
|
|
287
288
|
let repoUrl = "";
|
|
289
|
+
let userEmail = "";
|
|
288
290
|
const extraConfigString = getAIConfig(MIDSCENE_OPENAI_INIT_CONFIG_JSON);
|
|
289
291
|
const extraConfig = extraConfigString ? JSON.parse(extraConfigString) : {};
|
|
290
292
|
const serverUrl = extraConfig == null ? void 0 : extraConfig.REPORT_SERVER_URL;
|
|
291
293
|
try {
|
|
292
294
|
repoUrl = (0, import_node_child_process.execSync)("git config --get remote.origin.url").toString().trim();
|
|
295
|
+
userEmail = (0, import_node_child_process.execSync)("git config --get user.email").toString().trim();
|
|
293
296
|
} catch (error) {
|
|
294
|
-
debugLog("Failed to get git
|
|
297
|
+
debugLog("Failed to get git info:", error);
|
|
295
298
|
}
|
|
296
299
|
if (serverUrl && (repoUrl && repoUrl !== lastReportedRepoUrl || !repoUrl && testUrl)) {
|
|
297
300
|
debugLog("Uploading test info to server", {
|
|
298
301
|
serverUrl,
|
|
299
302
|
repoUrl,
|
|
300
|
-
testUrl
|
|
303
|
+
testUrl,
|
|
304
|
+
userEmail
|
|
301
305
|
});
|
|
302
306
|
fetch(serverUrl, {
|
|
303
307
|
method: "POST",
|
|
@@ -306,7 +310,8 @@ function uploadTestInfoToServer({
|
|
|
306
310
|
},
|
|
307
311
|
body: JSON.stringify({
|
|
308
312
|
repo_url: repoUrl,
|
|
309
|
-
test_url: testUrl
|
|
313
|
+
test_url: testUrl,
|
|
314
|
+
user_email: userEmail
|
|
310
315
|
})
|
|
311
316
|
}).then((response) => response.json()).then((data) => {
|
|
312
317
|
debugLog("Successfully uploaded test info to server:", data);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/core",
|
|
3
3
|
"description": "An AI-powered automation SDK can control the page, perform assertions, and extract data in JSON format using natural language. See https://midscenejs.com/ for details.",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.5-beta-20241122072506.0",
|
|
5
5
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
6
6
|
"homepage": "https://midscenejs.com/",
|
|
7
7
|
"jsnext:source": "./src/index.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"openai": "4.57.1",
|
|
36
36
|
"optional": "0.1.4",
|
|
37
|
-
"@midscene/shared": "0.8.
|
|
37
|
+
"@midscene/shared": "0.8.5-beta-20241122072506.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@modern-js/module-tools": "2.60.6",
|