@midscene/core 0.10.4 → 0.10.5
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
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkPXCWOGELjs = require('./chunk-PXCWOGEL.js');
|
|
13
13
|
require('./chunk-JP3JBDZS.js');
|
|
14
14
|
require('./chunk-YSQDPG26.js');
|
|
15
15
|
|
|
@@ -23,4 +23,4 @@ require('./chunk-YSQDPG26.js');
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
exports.AiAssert =
|
|
26
|
+
exports.AiAssert = _chunkPXCWOGELjs.AiAssert; exports.AiExtractElementInfo = _chunkPXCWOGELjs.AiExtractElementInfo; exports.AiInspectElement = _chunkPXCWOGELjs.AiInspectElement; exports.callAiFn = _chunkPXCWOGELjs.callAiFn; exports.callToGetJSONObject = _chunkPXCWOGELjs.callToGetJSONObject; exports.describeUserPage = _chunkPXCWOGELjs.describeUserPage; exports.plan = _chunkPXCWOGELjs.plan; exports.systemPromptToLocateElement = _chunkPXCWOGELjs.systemPromptToLocateElement; exports.transformElementPositionToId = _chunkPXCWOGELjs.transformElementPositionToId; exports.vlmPlanning = _chunkPXCWOGELjs.vlmPlanning;
|
|
@@ -188,7 +188,7 @@ function stringifyDumpData(data, indents) {
|
|
|
188
188
|
return JSON.stringify(data, replacerForPageObject, indents);
|
|
189
189
|
}
|
|
190
190
|
function getVersion() {
|
|
191
|
-
return "0.10.
|
|
191
|
+
return "0.10.5";
|
|
192
192
|
}
|
|
193
193
|
function debugLog(...message) {
|
|
194
194
|
const debugMode = _chunkJP3JBDZSjs.getAIConfig.call(void 0, _chunkJP3JBDZSjs.MIDSCENE_DEBUG_MODE);
|
|
@@ -1910,9 +1910,32 @@ var planSchema = {
|
|
|
1910
1910
|
description: 'Type of action, like "Tap", "Hover", etc.'
|
|
1911
1911
|
},
|
|
1912
1912
|
param: {
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1913
|
+
anyOf: [
|
|
1914
|
+
{ type: "null" },
|
|
1915
|
+
{
|
|
1916
|
+
type: "object",
|
|
1917
|
+
properties: { value: { type: ["string", "number"] } },
|
|
1918
|
+
required: ["value"],
|
|
1919
|
+
additionalProperties: false
|
|
1920
|
+
},
|
|
1921
|
+
{
|
|
1922
|
+
type: "object",
|
|
1923
|
+
properties: { timeMs: { type: ["number", "string"] } },
|
|
1924
|
+
required: ["timeMs"],
|
|
1925
|
+
additionalProperties: false
|
|
1926
|
+
},
|
|
1927
|
+
{
|
|
1928
|
+
type: "object",
|
|
1929
|
+
properties: {
|
|
1930
|
+
direction: { type: "string" },
|
|
1931
|
+
scrollType: { type: "string" },
|
|
1932
|
+
distance: { type: ["number", "string", "null"] }
|
|
1933
|
+
},
|
|
1934
|
+
required: ["direction", "scrollType", "distance"],
|
|
1935
|
+
additionalProperties: false
|
|
1936
|
+
}
|
|
1937
|
+
],
|
|
1938
|
+
description: "Parameter of the action, can be null ONLY when the type field is Tap or Hover"
|
|
1916
1939
|
},
|
|
1917
1940
|
locate: {
|
|
1918
1941
|
type: ["object", "null"],
|
package/dist/lib/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunk2NXWA3SVjs = require('./chunk-2NXWA3SV.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -17,7 +17,7 @@ var _chunkE7CN2CEKjs = require('./chunk-E7CN2CEK.js');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkPXCWOGELjs = require('./chunk-PXCWOGEL.js');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
@@ -169,7 +169,7 @@ ${(_b = this.latestErrorTask()) == null ? void 0 : _b.errorStack}`
|
|
|
169
169
|
}
|
|
170
170
|
dump() {
|
|
171
171
|
const dumpData = {
|
|
172
|
-
sdkVersion:
|
|
172
|
+
sdkVersion: _chunk2NXWA3SVjs.getVersion.call(void 0, ),
|
|
173
173
|
model_name: _chunkJP3JBDZSjs.getAIConfig.call(void 0, _chunkJP3JBDZSjs.MIDSCENE_MODEL_NAME) || "",
|
|
174
174
|
logTime: Date.now(),
|
|
175
175
|
name: this.name,
|
|
@@ -192,14 +192,14 @@ var logFileName = "";
|
|
|
192
192
|
var logContent = [];
|
|
193
193
|
var logIdIndexMap = {};
|
|
194
194
|
var { pid } = process;
|
|
195
|
-
var logFileExt =
|
|
195
|
+
var logFileExt = _chunk2NXWA3SVjs.insightDumpFileExt;
|
|
196
196
|
var ifInBrowser = typeof window !== "undefined";
|
|
197
197
|
function writeInsightDump(data, logId, dumpSubscriber) {
|
|
198
|
-
const logDir =
|
|
198
|
+
const logDir = _chunk2NXWA3SVjs.getLogDir.call(void 0, );
|
|
199
199
|
_assert2.default.call(void 0, logDir, "logDir should be set before writing dump file");
|
|
200
200
|
const id = logId || _utils.uuid.call(void 0, );
|
|
201
201
|
const baseData = {
|
|
202
|
-
sdkVersion:
|
|
202
|
+
sdkVersion: _chunk2NXWA3SVjs.getVersion.call(void 0, ),
|
|
203
203
|
logTime: Date.now(),
|
|
204
204
|
model_name: _chunkJP3JBDZSjs.getAIConfig.call(void 0, _chunkJP3JBDZSjs.MIDSCENE_MODEL_NAME) || "",
|
|
205
205
|
model_description: _chunkJP3JBDZSjs.getAIConfig.call(void 0, _chunkJP3JBDZSjs.MIDSCENE_USE_VLM_UI_TARS) ? "vlm-ui-tars enabled" : ""
|
|
@@ -210,7 +210,7 @@ function writeInsightDump(data, logId, dumpSubscriber) {
|
|
|
210
210
|
...data
|
|
211
211
|
};
|
|
212
212
|
dumpSubscriber == null ? void 0 : dumpSubscriber(finalData);
|
|
213
|
-
const dataString =
|
|
213
|
+
const dataString = _chunk2NXWA3SVjs.stringifyDumpData.call(void 0, finalData, 2);
|
|
214
214
|
if (typeof logIdIndexMap[id] === "number") {
|
|
215
215
|
logContent[logIdIndexMap[id]] = dataString;
|
|
216
216
|
} else {
|
|
@@ -224,7 +224,7 @@ function writeInsightDump(data, logId, dumpSubscriber) {
|
|
|
224
224
|
logFileName = `${pid}_${baseData.logTime}-${Math.random()}`;
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
|
|
227
|
+
_chunk2NXWA3SVjs.writeLogFile.call(void 0, {
|
|
228
228
|
fileName: logFileName,
|
|
229
229
|
fileExt: logFileExt,
|
|
230
230
|
fileContent: `[
|
|
@@ -239,7 +239,7 @@ ${logContent.join(",\n")}
|
|
|
239
239
|
// src/insight/index.ts
|
|
240
240
|
var Insight = class {
|
|
241
241
|
constructor(context, opt) {
|
|
242
|
-
this.aiVendorFn =
|
|
242
|
+
this.aiVendorFn = _chunkPXCWOGELjs.callAiFn;
|
|
243
243
|
_assert2.default.call(void 0, context, "context is required for Insight");
|
|
244
244
|
if (typeof context === "function") {
|
|
245
245
|
this.contextRetrieverFn = context;
|
|
@@ -265,7 +265,7 @@ var Insight = class {
|
|
|
265
265
|
this.onceDumpUpdatedFn = void 0;
|
|
266
266
|
const context = await this.contextRetrieverFn("locate");
|
|
267
267
|
const startTime = Date.now();
|
|
268
|
-
const { parseResult, elementById, rawResponse, usage } = await
|
|
268
|
+
const { parseResult, elementById, rawResponse, usage } = await _chunkPXCWOGELjs.AiInspectElement.call(void 0, {
|
|
269
269
|
callAI: callAI || this.aiVendorFn,
|
|
270
270
|
context,
|
|
271
271
|
multi: Boolean(multi),
|
|
@@ -348,7 +348,7 @@ ${parseResult.errors.join("\n")}`;
|
|
|
348
348
|
this.onceDumpUpdatedFn = void 0;
|
|
349
349
|
const context = await this.contextRetrieverFn("extract");
|
|
350
350
|
const startTime = Date.now();
|
|
351
|
-
const { parseResult, elementById } = await
|
|
351
|
+
const { parseResult, elementById } = await _chunkPXCWOGELjs.AiExtractElementInfo.call(void 0, {
|
|
352
352
|
context,
|
|
353
353
|
dataQuery: dataDemand
|
|
354
354
|
});
|
|
@@ -402,7 +402,7 @@ ${parseResult.errors.join("\n")}`;
|
|
|
402
402
|
this.onceDumpUpdatedFn = void 0;
|
|
403
403
|
const context = await this.contextRetrieverFn("assert");
|
|
404
404
|
const startTime = Date.now();
|
|
405
|
-
const assertResult = await
|
|
405
|
+
const assertResult = await _chunkPXCWOGELjs.AiAssert.call(void 0, {
|
|
406
406
|
assertion,
|
|
407
407
|
context
|
|
408
408
|
});
|
|
@@ -450,4 +450,4 @@ var src_default = Insight;
|
|
|
450
450
|
|
|
451
451
|
|
|
452
452
|
|
|
453
|
-
exports.AIResponseFormat =
|
|
453
|
+
exports.AIResponseFormat = _chunkPXCWOGELjs.AIResponseFormat; exports.BaseElement = _chunkPXCWOGELjs.BaseElement; exports.Executor = Executor; exports.Insight = Insight; exports.UIContext = _chunkPXCWOGELjs.UIContext; exports.default = src_default; exports.getLogDirByType = _chunk2NXWA3SVjs.getLogDirByType; exports.getVersion = _chunk2NXWA3SVjs.getVersion; exports.plan = _chunkPXCWOGELjs.plan; exports.setLogDir = _chunk2NXWA3SVjs.setLogDir; exports.transformElementPositionToId = _chunkPXCWOGELjs.transformElementPositionToId;
|
package/dist/lib/utils.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunk2NXWA3SVjs = require('./chunk-2NXWA3SV.js');
|
|
20
20
|
require('./chunk-JP3JBDZS.js');
|
|
21
21
|
require('./chunk-YSQDPG26.js');
|
|
22
22
|
|
|
@@ -37,4 +37,4 @@ require('./chunk-YSQDPG26.js');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
exports.getLogDir =
|
|
40
|
+
exports.getLogDir = _chunk2NXWA3SVjs.getLogDir; exports.getLogDirByType = _chunk2NXWA3SVjs.getLogDirByType; exports.getTmpDir = _chunk2NXWA3SVjs.getTmpDir; exports.getTmpFile = _chunk2NXWA3SVjs.getTmpFile; exports.getVersion = _chunk2NXWA3SVjs.getVersion; exports.groupedActionDumpFileExt = _chunk2NXWA3SVjs.groupedActionDumpFileExt; exports.insightDumpFileExt = _chunk2NXWA3SVjs.insightDumpFileExt; exports.overlapped = _chunk2NXWA3SVjs.overlapped; exports.replaceStringWithFirstAppearance = _chunk2NXWA3SVjs.replaceStringWithFirstAppearance; exports.replacerForPageObject = _chunk2NXWA3SVjs.replacerForPageObject; exports.reportHTMLContent = _chunk2NXWA3SVjs.reportHTMLContent; exports.setLogDir = _chunk2NXWA3SVjs.setLogDir; exports.sleep = _chunk2NXWA3SVjs.sleep; exports.stringifyDumpData = _chunk2NXWA3SVjs.stringifyDumpData; exports.uploadTestInfoToServer = _chunk2NXWA3SVjs.uploadTestInfoToServer; exports.writeDumpReport = _chunk2NXWA3SVjs.writeDumpReport; exports.writeLogFile = _chunk2NXWA3SVjs.writeLogFile;
|
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.10.
|
|
4
|
+
"version": "0.10.5",
|
|
5
5
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
6
6
|
"homepage": "https://midscenejs.com/",
|
|
7
7
|
"jsnext:source": "./src/index.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@langchain/core": "0.3.26",
|
|
43
43
|
"socks-proxy-agent": "8.0.4",
|
|
44
44
|
"openai": "4.81.0",
|
|
45
|
-
"@midscene/shared": "0.10.
|
|
45
|
+
"@midscene/shared": "0.10.5"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@modern-js/module-tools": "2.60.6",
|