@godscene/core 1.7.11
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/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/es/agent/agent.mjs +767 -0
- package/dist/es/agent/common.mjs +0 -0
- package/dist/es/agent/execution-session.mjs +39 -0
- package/dist/es/agent/index.mjs +6 -0
- package/dist/es/agent/task-builder.mjs +343 -0
- package/dist/es/agent/task-cache.mjs +212 -0
- package/dist/es/agent/tasks.mjs +428 -0
- package/dist/es/agent/ui-utils.mjs +101 -0
- package/dist/es/agent/utils.mjs +167 -0
- package/dist/es/ai-model/auto-glm/actions.mjs +237 -0
- package/dist/es/ai-model/auto-glm/index.mjs +6 -0
- package/dist/es/ai-model/auto-glm/parser.mjs +237 -0
- package/dist/es/ai-model/auto-glm/planning.mjs +69 -0
- package/dist/es/ai-model/auto-glm/prompt.mjs +220 -0
- package/dist/es/ai-model/auto-glm/util.mjs +7 -0
- package/dist/es/ai-model/connectivity.mjs +136 -0
- package/dist/es/ai-model/conversation-history.mjs +193 -0
- package/dist/es/ai-model/index.mjs +12 -0
- package/dist/es/ai-model/inspect.mjs +395 -0
- package/dist/es/ai-model/llm-planning.mjs +231 -0
- package/dist/es/ai-model/prompt/common.mjs +5 -0
- package/dist/es/ai-model/prompt/describe.mjs +64 -0
- package/dist/es/ai-model/prompt/extraction.mjs +129 -0
- package/dist/es/ai-model/prompt/llm-locator.mjs +49 -0
- package/dist/es/ai-model/prompt/llm-planning.mjs +584 -0
- package/dist/es/ai-model/prompt/llm-section-locator.mjs +42 -0
- package/dist/es/ai-model/prompt/order-sensitive-judge.mjs +33 -0
- package/dist/es/ai-model/prompt/playwright-generator.mjs +115 -0
- package/dist/es/ai-model/prompt/ui-tars-planning.mjs +34 -0
- package/dist/es/ai-model/prompt/util.mjs +57 -0
- package/dist/es/ai-model/prompt/yaml-generator.mjs +201 -0
- package/dist/es/ai-model/service-caller/codex-app-server.mjs +573 -0
- package/dist/es/ai-model/service-caller/image-detail.mjs +4 -0
- package/dist/es/ai-model/service-caller/index.mjs +648 -0
- package/dist/es/ai-model/service-caller/request-timeout.mjs +47 -0
- package/dist/es/ai-model/ui-tars-planning.mjs +247 -0
- package/dist/es/common.mjs +382 -0
- package/dist/es/device/device-options.mjs +0 -0
- package/dist/es/device/index.mjs +340 -0
- package/dist/es/dump/html-utils.mjs +290 -0
- package/dist/es/dump/index.mjs +3 -0
- package/dist/es/dump/screenshot-restoration.mjs +30 -0
- package/dist/es/dump/screenshot-store.mjs +125 -0
- package/dist/es/index.mjs +17 -0
- package/dist/es/report-cli.mjs +149 -0
- package/dist/es/report-generator.mjs +203 -0
- package/dist/es/report-markdown.mjs +216 -0
- package/dist/es/report.mjs +287 -0
- package/dist/es/screenshot-item.mjs +120 -0
- package/dist/es/service/index.mjs +272 -0
- package/dist/es/service/utils.mjs +13 -0
- package/dist/es/skill/index.mjs +35 -0
- package/dist/es/task-runner.mjs +261 -0
- package/dist/es/task-timing.mjs +10 -0
- package/dist/es/tree.mjs +11 -0
- package/dist/es/types.mjs +202 -0
- package/dist/es/utils.mjs +232 -0
- package/dist/es/yaml/builder.mjs +11 -0
- package/dist/es/yaml/index.mjs +4 -0
- package/dist/es/yaml/player.mjs +425 -0
- package/dist/es/yaml/utils.mjs +100 -0
- package/dist/es/yaml.mjs +0 -0
- package/dist/lib/agent/agent.js +815 -0
- package/dist/lib/agent/common.js +5 -0
- package/dist/lib/agent/execution-session.js +73 -0
- package/dist/lib/agent/index.js +76 -0
- package/dist/lib/agent/task-builder.js +380 -0
- package/dist/lib/agent/task-cache.js +264 -0
- package/dist/lib/agent/tasks.js +471 -0
- package/dist/lib/agent/ui-utils.js +153 -0
- package/dist/lib/agent/utils.js +238 -0
- package/dist/lib/ai-model/auto-glm/actions.js +271 -0
- package/dist/lib/ai-model/auto-glm/index.js +64 -0
- package/dist/lib/ai-model/auto-glm/parser.js +280 -0
- package/dist/lib/ai-model/auto-glm/planning.js +103 -0
- package/dist/lib/ai-model/auto-glm/prompt.js +257 -0
- package/dist/lib/ai-model/auto-glm/util.js +44 -0
- package/dist/lib/ai-model/connectivity.js +180 -0
- package/dist/lib/ai-model/conversation-history.js +227 -0
- package/dist/lib/ai-model/index.js +127 -0
- package/dist/lib/ai-model/inspect.js +441 -0
- package/dist/lib/ai-model/llm-planning.js +268 -0
- package/dist/lib/ai-model/prompt/common.js +39 -0
- package/dist/lib/ai-model/prompt/describe.js +98 -0
- package/dist/lib/ai-model/prompt/extraction.js +169 -0
- package/dist/lib/ai-model/prompt/llm-locator.js +86 -0
- package/dist/lib/ai-model/prompt/llm-planning.js +621 -0
- package/dist/lib/ai-model/prompt/llm-section-locator.js +79 -0
- package/dist/lib/ai-model/prompt/order-sensitive-judge.js +70 -0
- package/dist/lib/ai-model/prompt/playwright-generator.js +176 -0
- package/dist/lib/ai-model/prompt/ui-tars-planning.js +71 -0
- package/dist/lib/ai-model/prompt/util.js +103 -0
- package/dist/lib/ai-model/prompt/yaml-generator.js +262 -0
- package/dist/lib/ai-model/service-caller/codex-app-server.js +622 -0
- package/dist/lib/ai-model/service-caller/image-detail.js +38 -0
- package/dist/lib/ai-model/service-caller/index.js +716 -0
- package/dist/lib/ai-model/service-caller/request-timeout.js +93 -0
- package/dist/lib/ai-model/ui-tars-planning.js +281 -0
- package/dist/lib/common.js +491 -0
- package/dist/lib/device/device-options.js +18 -0
- package/dist/lib/device/index.js +467 -0
- package/dist/lib/dump/html-utils.js +366 -0
- package/dist/lib/dump/index.js +58 -0
- package/dist/lib/dump/screenshot-restoration.js +64 -0
- package/dist/lib/dump/screenshot-store.js +165 -0
- package/dist/lib/index.js +184 -0
- package/dist/lib/report-cli.js +189 -0
- package/dist/lib/report-generator.js +244 -0
- package/dist/lib/report-markdown.js +253 -0
- package/dist/lib/report.js +333 -0
- package/dist/lib/screenshot-item.js +154 -0
- package/dist/lib/service/index.js +306 -0
- package/dist/lib/service/utils.js +47 -0
- package/dist/lib/skill/index.js +69 -0
- package/dist/lib/task-runner.js +298 -0
- package/dist/lib/task-timing.js +44 -0
- package/dist/lib/tree.js +51 -0
- package/dist/lib/types.js +298 -0
- package/dist/lib/utils.js +314 -0
- package/dist/lib/yaml/builder.js +55 -0
- package/dist/lib/yaml/index.js +79 -0
- package/dist/lib/yaml/player.js +459 -0
- package/dist/lib/yaml/utils.js +153 -0
- package/dist/lib/yaml.js +18 -0
- package/dist/types/agent/agent.d.ts +220 -0
- package/dist/types/agent/common.d.ts +0 -0
- package/dist/types/agent/execution-session.d.ts +36 -0
- package/dist/types/agent/index.d.ts +9 -0
- package/dist/types/agent/task-builder.d.ts +34 -0
- package/dist/types/agent/task-cache.d.ts +49 -0
- package/dist/types/agent/tasks.d.ts +70 -0
- package/dist/types/agent/ui-utils.d.ts +14 -0
- package/dist/types/agent/utils.d.ts +25 -0
- package/dist/types/ai-model/auto-glm/actions.d.ts +78 -0
- package/dist/types/ai-model/auto-glm/index.d.ts +6 -0
- package/dist/types/ai-model/auto-glm/parser.d.ts +18 -0
- package/dist/types/ai-model/auto-glm/planning.d.ts +12 -0
- package/dist/types/ai-model/auto-glm/prompt.d.ts +27 -0
- package/dist/types/ai-model/auto-glm/util.d.ts +13 -0
- package/dist/types/ai-model/connectivity.d.ts +20 -0
- package/dist/types/ai-model/conversation-history.d.ts +105 -0
- package/dist/types/ai-model/index.d.ts +16 -0
- package/dist/types/ai-model/inspect.d.ts +67 -0
- package/dist/types/ai-model/llm-planning.d.ts +19 -0
- package/dist/types/ai-model/prompt/common.d.ts +2 -0
- package/dist/types/ai-model/prompt/describe.d.ts +1 -0
- package/dist/types/ai-model/prompt/extraction.d.ts +7 -0
- package/dist/types/ai-model/prompt/llm-locator.d.ts +3 -0
- package/dist/types/ai-model/prompt/llm-planning.d.ts +10 -0
- package/dist/types/ai-model/prompt/llm-section-locator.d.ts +3 -0
- package/dist/types/ai-model/prompt/order-sensitive-judge.d.ts +2 -0
- package/dist/types/ai-model/prompt/playwright-generator.d.ts +26 -0
- package/dist/types/ai-model/prompt/ui-tars-planning.d.ts +2 -0
- package/dist/types/ai-model/prompt/util.d.ts +33 -0
- package/dist/types/ai-model/prompt/yaml-generator.d.ts +102 -0
- package/dist/types/ai-model/service-caller/codex-app-server.d.ts +42 -0
- package/dist/types/ai-model/service-caller/image-detail.d.ts +2 -0
- package/dist/types/ai-model/service-caller/index.d.ts +60 -0
- package/dist/types/ai-model/service-caller/request-timeout.d.ts +32 -0
- package/dist/types/ai-model/ui-tars-planning.d.ts +72 -0
- package/dist/types/common.d.ts +288 -0
- package/dist/types/device/device-options.d.ts +155 -0
- package/dist/types/device/index.d.ts +2565 -0
- package/dist/types/dump/html-utils.d.ts +75 -0
- package/dist/types/dump/index.d.ts +5 -0
- package/dist/types/dump/screenshot-restoration.d.ts +8 -0
- package/dist/types/dump/screenshot-store.d.ts +49 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/report-cli.d.ts +36 -0
- package/dist/types/report-generator.d.ts +88 -0
- package/dist/types/report-markdown.d.ts +24 -0
- package/dist/types/report.d.ts +52 -0
- package/dist/types/screenshot-item.d.ts +67 -0
- package/dist/types/service/index.d.ts +24 -0
- package/dist/types/service/utils.d.ts +2 -0
- package/dist/types/skill/index.d.ts +25 -0
- package/dist/types/task-runner.d.ts +50 -0
- package/dist/types/task-timing.d.ts +8 -0
- package/dist/types/tree.d.ts +4 -0
- package/dist/types/types.d.ts +684 -0
- package/dist/types/utils.d.ts +45 -0
- package/dist/types/yaml/builder.d.ts +2 -0
- package/dist/types/yaml/index.d.ts +4 -0
- package/dist/types/yaml/player.d.ts +34 -0
- package/dist/types/yaml/utils.d.ts +9 -0
- package/dist/types/yaml.d.ts +215 -0
- package/package.json +130 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
plan: ()=>external_ai_model_index_js_namespaceObject.plan,
|
|
37
|
+
TUserPromptSchema: ()=>external_ai_model_index_js_namespaceObject.TUserPromptSchema,
|
|
38
|
+
MIDSCENE_MODEL_NAME: ()=>env_namespaceObject.MIDSCENE_MODEL_NAME,
|
|
39
|
+
reportToMarkdown: ()=>external_report_markdown_js_namespaceObject.reportToMarkdown,
|
|
40
|
+
runConnectivityTest: ()=>external_ai_model_index_js_namespaceObject.runConnectivityTest,
|
|
41
|
+
collectDedupedExecutions: ()=>external_report_js_namespaceObject.collectDedupedExecutions,
|
|
42
|
+
generateImageScriptTag: ()=>external_dump_index_js_namespaceObject.generateImageScriptTag,
|
|
43
|
+
restoreImageReferences: ()=>external_dump_index_js_namespaceObject.restoreImageReferences,
|
|
44
|
+
splitReportHtmlByExecution: ()=>external_report_js_namespaceObject.splitReportHtmlByExecution,
|
|
45
|
+
parseDumpScriptAttributes: ()=>external_dump_index_js_namespaceObject.parseDumpScriptAttributes,
|
|
46
|
+
z: ()=>external_zod_namespaceObject.z,
|
|
47
|
+
generateDumpScriptTag: ()=>external_dump_index_js_namespaceObject.generateDumpScriptTag,
|
|
48
|
+
SizeSchema: ()=>external_ai_model_index_js_namespaceObject.SizeSchema,
|
|
49
|
+
default: ()=>src,
|
|
50
|
+
getVersion: ()=>external_utils_js_namespaceObject.getVersion,
|
|
51
|
+
getMidsceneLocationSchema: ()=>external_ai_model_index_js_namespaceObject.getMidsceneLocationSchema,
|
|
52
|
+
parseDumpScript: ()=>external_dump_index_js_namespaceObject.parseDumpScript,
|
|
53
|
+
ServiceError: ()=>external_types_js_namespaceObject.ServiceError,
|
|
54
|
+
parseImageScripts: ()=>external_dump_index_js_namespaceObject.parseImageScripts,
|
|
55
|
+
PointSchema: ()=>external_ai_model_index_js_namespaceObject.PointSchema,
|
|
56
|
+
RectSchema: ()=>external_ai_model_index_js_namespaceObject.RectSchema,
|
|
57
|
+
Agent: ()=>external_agent_index_js_namespaceObject.Agent,
|
|
58
|
+
nullReportGenerator: ()=>external_report_generator_js_namespaceObject.nullReportGenerator,
|
|
59
|
+
ScreenshotStore: ()=>screenshot_store_js_namespaceObject.ScreenshotStore,
|
|
60
|
+
ReportMergingTool: ()=>external_report_js_namespaceObject.ReportMergingTool,
|
|
61
|
+
Service: ()=>index_js_default(),
|
|
62
|
+
AiLocateElement: ()=>external_ai_model_index_js_namespaceObject.AiLocateElement,
|
|
63
|
+
createReportCliCommands: ()=>external_report_cli_js_namespaceObject.createReportCliCommands,
|
|
64
|
+
ScreenshotItem: ()=>external_screenshot_item_js_namespaceObject.ScreenshotItem,
|
|
65
|
+
createAgent: ()=>external_agent_index_js_namespaceObject.createAgent,
|
|
66
|
+
ExecutionDump: ()=>external_types_js_namespaceObject.ExecutionDump,
|
|
67
|
+
dedupeExecutionsKeepLatest: ()=>external_report_js_namespaceObject.dedupeExecutionsKeepLatest,
|
|
68
|
+
ReportGenerator: ()=>external_report_generator_js_namespaceObject.ReportGenerator,
|
|
69
|
+
escapeContent: ()=>external_dump_index_js_namespaceObject.escapeContent,
|
|
70
|
+
TaskRunner: ()=>external_task_runner_js_namespaceObject.TaskRunner,
|
|
71
|
+
ReportActionDump: ()=>external_types_js_namespaceObject.ReportActionDump,
|
|
72
|
+
GroupedActionDump: ()=>external_types_js_namespaceObject.GroupedActionDump,
|
|
73
|
+
TMultimodalPromptSchema: ()=>external_ai_model_index_js_namespaceObject.TMultimodalPromptSchema,
|
|
74
|
+
reportFileToMarkdown: ()=>external_report_cli_js_namespaceObject.reportFileToMarkdown,
|
|
75
|
+
executionToMarkdown: ()=>external_report_markdown_js_namespaceObject.executionToMarkdown,
|
|
76
|
+
splitReportFile: ()=>external_report_cli_js_namespaceObject.splitReportFile,
|
|
77
|
+
unescapeContent: ()=>external_dump_index_js_namespaceObject.unescapeContent
|
|
78
|
+
});
|
|
79
|
+
const external_zod_namespaceObject = require("zod");
|
|
80
|
+
const index_js_namespaceObject = require("./service/index.js");
|
|
81
|
+
var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
|
|
82
|
+
const external_task_runner_js_namespaceObject = require("./task-runner.js");
|
|
83
|
+
const external_utils_js_namespaceObject = require("./utils.js");
|
|
84
|
+
const external_ai_model_index_js_namespaceObject = require("./ai-model/index.js");
|
|
85
|
+
const env_namespaceObject = require("@godscene/shared/env");
|
|
86
|
+
const external_types_js_namespaceObject = require("./types.js");
|
|
87
|
+
const external_agent_index_js_namespaceObject = require("./agent/index.js");
|
|
88
|
+
const external_dump_index_js_namespaceObject = require("./dump/index.js");
|
|
89
|
+
const external_report_generator_js_namespaceObject = require("./report-generator.js");
|
|
90
|
+
const external_report_js_namespaceObject = require("./report.js");
|
|
91
|
+
const external_report_cli_js_namespaceObject = require("./report-cli.js");
|
|
92
|
+
const external_screenshot_item_js_namespaceObject = require("./screenshot-item.js");
|
|
93
|
+
const screenshot_store_js_namespaceObject = require("./dump/screenshot-store.js");
|
|
94
|
+
const external_report_markdown_js_namespaceObject = require("./report-markdown.js");
|
|
95
|
+
const src = index_js_default();
|
|
96
|
+
exports.Agent = __webpack_exports__.Agent;
|
|
97
|
+
exports.AiLocateElement = __webpack_exports__.AiLocateElement;
|
|
98
|
+
exports.ExecutionDump = __webpack_exports__.ExecutionDump;
|
|
99
|
+
exports.GroupedActionDump = __webpack_exports__.GroupedActionDump;
|
|
100
|
+
exports.MIDSCENE_MODEL_NAME = __webpack_exports__.MIDSCENE_MODEL_NAME;
|
|
101
|
+
exports.PointSchema = __webpack_exports__.PointSchema;
|
|
102
|
+
exports.RectSchema = __webpack_exports__.RectSchema;
|
|
103
|
+
exports.ReportActionDump = __webpack_exports__.ReportActionDump;
|
|
104
|
+
exports.ReportGenerator = __webpack_exports__.ReportGenerator;
|
|
105
|
+
exports.ReportMergingTool = __webpack_exports__.ReportMergingTool;
|
|
106
|
+
exports.ScreenshotItem = __webpack_exports__.ScreenshotItem;
|
|
107
|
+
exports.ScreenshotStore = __webpack_exports__.ScreenshotStore;
|
|
108
|
+
exports.Service = __webpack_exports__.Service;
|
|
109
|
+
exports.ServiceError = __webpack_exports__.ServiceError;
|
|
110
|
+
exports.SizeSchema = __webpack_exports__.SizeSchema;
|
|
111
|
+
exports.TMultimodalPromptSchema = __webpack_exports__.TMultimodalPromptSchema;
|
|
112
|
+
exports.TUserPromptSchema = __webpack_exports__.TUserPromptSchema;
|
|
113
|
+
exports.TaskRunner = __webpack_exports__.TaskRunner;
|
|
114
|
+
exports.collectDedupedExecutions = __webpack_exports__.collectDedupedExecutions;
|
|
115
|
+
exports.createAgent = __webpack_exports__.createAgent;
|
|
116
|
+
exports.createReportCliCommands = __webpack_exports__.createReportCliCommands;
|
|
117
|
+
exports.dedupeExecutionsKeepLatest = __webpack_exports__.dedupeExecutionsKeepLatest;
|
|
118
|
+
exports["default"] = __webpack_exports__["default"];
|
|
119
|
+
exports.escapeContent = __webpack_exports__.escapeContent;
|
|
120
|
+
exports.executionToMarkdown = __webpack_exports__.executionToMarkdown;
|
|
121
|
+
exports.generateDumpScriptTag = __webpack_exports__.generateDumpScriptTag;
|
|
122
|
+
exports.generateImageScriptTag = __webpack_exports__.generateImageScriptTag;
|
|
123
|
+
exports.getMidsceneLocationSchema = __webpack_exports__.getMidsceneLocationSchema;
|
|
124
|
+
exports.getVersion = __webpack_exports__.getVersion;
|
|
125
|
+
exports.nullReportGenerator = __webpack_exports__.nullReportGenerator;
|
|
126
|
+
exports.parseDumpScript = __webpack_exports__.parseDumpScript;
|
|
127
|
+
exports.parseDumpScriptAttributes = __webpack_exports__.parseDumpScriptAttributes;
|
|
128
|
+
exports.parseImageScripts = __webpack_exports__.parseImageScripts;
|
|
129
|
+
exports.plan = __webpack_exports__.plan;
|
|
130
|
+
exports.reportFileToMarkdown = __webpack_exports__.reportFileToMarkdown;
|
|
131
|
+
exports.reportToMarkdown = __webpack_exports__.reportToMarkdown;
|
|
132
|
+
exports.restoreImageReferences = __webpack_exports__.restoreImageReferences;
|
|
133
|
+
exports.runConnectivityTest = __webpack_exports__.runConnectivityTest;
|
|
134
|
+
exports.splitReportFile = __webpack_exports__.splitReportFile;
|
|
135
|
+
exports.splitReportHtmlByExecution = __webpack_exports__.splitReportHtmlByExecution;
|
|
136
|
+
exports.unescapeContent = __webpack_exports__.unescapeContent;
|
|
137
|
+
exports.z = __webpack_exports__.z;
|
|
138
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
139
|
+
"Agent",
|
|
140
|
+
"AiLocateElement",
|
|
141
|
+
"ExecutionDump",
|
|
142
|
+
"GroupedActionDump",
|
|
143
|
+
"MIDSCENE_MODEL_NAME",
|
|
144
|
+
"PointSchema",
|
|
145
|
+
"RectSchema",
|
|
146
|
+
"ReportActionDump",
|
|
147
|
+
"ReportGenerator",
|
|
148
|
+
"ReportMergingTool",
|
|
149
|
+
"ScreenshotItem",
|
|
150
|
+
"ScreenshotStore",
|
|
151
|
+
"Service",
|
|
152
|
+
"ServiceError",
|
|
153
|
+
"SizeSchema",
|
|
154
|
+
"TMultimodalPromptSchema",
|
|
155
|
+
"TUserPromptSchema",
|
|
156
|
+
"TaskRunner",
|
|
157
|
+
"collectDedupedExecutions",
|
|
158
|
+
"createAgent",
|
|
159
|
+
"createReportCliCommands",
|
|
160
|
+
"dedupeExecutionsKeepLatest",
|
|
161
|
+
"default",
|
|
162
|
+
"escapeContent",
|
|
163
|
+
"executionToMarkdown",
|
|
164
|
+
"generateDumpScriptTag",
|
|
165
|
+
"generateImageScriptTag",
|
|
166
|
+
"getMidsceneLocationSchema",
|
|
167
|
+
"getVersion",
|
|
168
|
+
"nullReportGenerator",
|
|
169
|
+
"parseDumpScript",
|
|
170
|
+
"parseDumpScriptAttributes",
|
|
171
|
+
"parseImageScripts",
|
|
172
|
+
"plan",
|
|
173
|
+
"reportFileToMarkdown",
|
|
174
|
+
"reportToMarkdown",
|
|
175
|
+
"restoreImageReferences",
|
|
176
|
+
"runConnectivityTest",
|
|
177
|
+
"splitReportFile",
|
|
178
|
+
"splitReportHtmlByExecution",
|
|
179
|
+
"unescapeContent",
|
|
180
|
+
"z"
|
|
181
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
182
|
+
Object.defineProperty(exports, '__esModule', {
|
|
183
|
+
value: true
|
|
184
|
+
});
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
reportFileToMarkdown: ()=>reportFileToMarkdown,
|
|
28
|
+
createReportCliCommands: ()=>createReportCliCommands,
|
|
29
|
+
splitReportFile: ()=>splitReportFile
|
|
30
|
+
});
|
|
31
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
32
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
33
|
+
const external_zod_namespaceObject = require("zod");
|
|
34
|
+
const screenshot_store_js_namespaceObject = require("./dump/screenshot-store.js");
|
|
35
|
+
const external_report_js_namespaceObject = require("./report.js");
|
|
36
|
+
const external_report_markdown_js_namespaceObject = require("./report-markdown.js");
|
|
37
|
+
const external_types_js_namespaceObject = require("./types.js");
|
|
38
|
+
function writeAttachmentFromReport(attachment, opts) {
|
|
39
|
+
const { suggestedFileName, id, mimeType } = attachment;
|
|
40
|
+
if (opts.writtenFiles.has(suggestedFileName)) return;
|
|
41
|
+
const absolutePath = external_node_path_namespaceObject.join(opts.screenshotsDir, suggestedFileName);
|
|
42
|
+
const outputRelativePath = `./screenshots/${suggestedFileName}`;
|
|
43
|
+
const sourceRef = attachment.filePath !== outputRelativePath ? {
|
|
44
|
+
type: 'midscene_screenshot_ref',
|
|
45
|
+
id,
|
|
46
|
+
capturedAt: 0,
|
|
47
|
+
mimeType: mimeType || 'image/png',
|
|
48
|
+
storage: 'file',
|
|
49
|
+
path: attachment.filePath
|
|
50
|
+
} : null;
|
|
51
|
+
const resolved = (0, screenshot_store_js_namespaceObject.resolveScreenshotSource)(sourceRef, {
|
|
52
|
+
reportPath: opts.htmlPath,
|
|
53
|
+
fallbackId: id,
|
|
54
|
+
fallbackMimeType: mimeType || 'image/png'
|
|
55
|
+
});
|
|
56
|
+
if ('data-uri' === resolved.type) {
|
|
57
|
+
const rawBase64 = resolved.dataUri.replace(/^data:image\/[a-zA-Z+]+;base64,/, '');
|
|
58
|
+
(0, external_node_fs_namespaceObject.writeFileSync)(absolutePath, Buffer.from(rawBase64, 'base64'));
|
|
59
|
+
opts.writtenFiles.add(suggestedFileName);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!(0, external_node_fs_namespaceObject.existsSync)(resolved.filePath)) throw new Error(`Cannot resolve screenshot "${id}" for markdown attachment from ${opts.htmlPath}`);
|
|
63
|
+
(0, external_node_fs_namespaceObject.copyFileSync)(resolved.filePath, absolutePath);
|
|
64
|
+
opts.writtenFiles.add(suggestedFileName);
|
|
65
|
+
}
|
|
66
|
+
async function markdownFromReport(htmlPath, outputDir) {
|
|
67
|
+
const screenshotsDir = external_node_path_namespaceObject.join(outputDir, 'screenshots');
|
|
68
|
+
(0, external_node_fs_namespaceObject.mkdirSync)(outputDir, {
|
|
69
|
+
recursive: true
|
|
70
|
+
});
|
|
71
|
+
(0, external_node_fs_namespaceObject.mkdirSync)(screenshotsDir, {
|
|
72
|
+
recursive: true
|
|
73
|
+
});
|
|
74
|
+
const { baseDump, executions } = (0, external_report_js_namespaceObject.collectDedupedExecutions)(htmlPath);
|
|
75
|
+
const mergedReport = new external_types_js_namespaceObject.ReportActionDump({
|
|
76
|
+
sdkVersion: baseDump.sdkVersion,
|
|
77
|
+
groupName: baseDump.groupName,
|
|
78
|
+
groupDescription: baseDump.groupDescription,
|
|
79
|
+
modelBriefs: baseDump.modelBriefs,
|
|
80
|
+
deviceType: baseDump.deviceType,
|
|
81
|
+
executions
|
|
82
|
+
});
|
|
83
|
+
const result = (0, external_report_markdown_js_namespaceObject.reportToMarkdown)(mergedReport);
|
|
84
|
+
const markdownFiles = [];
|
|
85
|
+
const writtenScreenshots = new Set();
|
|
86
|
+
const mdPath = external_node_path_namespaceObject.join(outputDir, 'report.md');
|
|
87
|
+
(0, external_node_fs_namespaceObject.writeFileSync)(mdPath, result.markdown, 'utf-8');
|
|
88
|
+
markdownFiles.push(mdPath);
|
|
89
|
+
for (const attachment of result.attachments)writeAttachmentFromReport(attachment, {
|
|
90
|
+
htmlPath,
|
|
91
|
+
screenshotsDir,
|
|
92
|
+
writtenFiles: writtenScreenshots
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
markdownFiles,
|
|
96
|
+
screenshotFiles: Array.from(writtenScreenshots).sort().map((f)=>external_node_path_namespaceObject.join(screenshotsDir, f))
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function resolveReportHtmlPath(htmlPath) {
|
|
100
|
+
const normalizedPath = external_node_path_namespaceObject.resolve(htmlPath);
|
|
101
|
+
if (!(0, external_node_fs_namespaceObject.existsSync)(normalizedPath)) throw new Error(`report-tool: --htmlPath does not exist: ${htmlPath}`);
|
|
102
|
+
const stats = (0, external_node_fs_namespaceObject.statSync)(normalizedPath);
|
|
103
|
+
if (!stats.isDirectory()) return normalizedPath;
|
|
104
|
+
const indexHtmlPath = external_node_path_namespaceObject.join(normalizedPath, 'index.html');
|
|
105
|
+
if (!(0, external_node_fs_namespaceObject.existsSync)(indexHtmlPath)) throw new Error(`report-tool: "${htmlPath}" is not an HTML report file, and no index.html was found under this directory.`);
|
|
106
|
+
return indexHtmlPath;
|
|
107
|
+
}
|
|
108
|
+
function splitReportFile(options) {
|
|
109
|
+
const { htmlPath, outputDir } = options;
|
|
110
|
+
if (!htmlPath) throw new Error('splitReportFile: htmlPath is required');
|
|
111
|
+
if (!outputDir) throw new Error('splitReportFile: outputDir is required');
|
|
112
|
+
const resolvedHtmlPath = resolveReportHtmlPath(htmlPath);
|
|
113
|
+
return (0, external_report_js_namespaceObject.splitReportHtmlByExecution)({
|
|
114
|
+
htmlPath: resolvedHtmlPath,
|
|
115
|
+
outputDir
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
async function reportFileToMarkdown(options) {
|
|
119
|
+
const { htmlPath, outputDir } = options;
|
|
120
|
+
if (!htmlPath) throw new Error('reportFileToMarkdown: htmlPath is required');
|
|
121
|
+
if (!outputDir) throw new Error('reportFileToMarkdown: outputDir is required');
|
|
122
|
+
const resolvedHtmlPath = resolveReportHtmlPath(htmlPath);
|
|
123
|
+
return markdownFromReport(resolvedHtmlPath, outputDir);
|
|
124
|
+
}
|
|
125
|
+
const reportCommandDefinition = {
|
|
126
|
+
name: 'report-tool',
|
|
127
|
+
description: 'Transform Midscene report artifacts, including splitting executions and converting to markdown.',
|
|
128
|
+
schema: {
|
|
129
|
+
action: external_zod_namespaceObject.z["enum"]([
|
|
130
|
+
'split',
|
|
131
|
+
'to-markdown'
|
|
132
|
+
]).optional().describe('Report action to run. Supports: split, to-markdown. Defaults to split.'),
|
|
133
|
+
htmlPath: external_zod_namespaceObject.z.string().optional().describe('Input report HTML path (e.g. ./report/index.html)'),
|
|
134
|
+
outputDir: external_zod_namespaceObject.z.string().optional().describe('Output directory for generated report artifacts')
|
|
135
|
+
},
|
|
136
|
+
handler: async (args)=>{
|
|
137
|
+
const { action = 'split', htmlPath, outputDir } = args;
|
|
138
|
+
if ('split' !== action && 'to-markdown' !== action) throw new Error(`report-tool: unsupported --action value "${action}". Currently supported: split, to-markdown`);
|
|
139
|
+
if (!htmlPath) throw new Error('report-tool: --htmlPath is required');
|
|
140
|
+
if (!outputDir) throw new Error('report-tool: --outputDir is required');
|
|
141
|
+
if ('to-markdown' === action) {
|
|
142
|
+
const result = await reportFileToMarkdown({
|
|
143
|
+
htmlPath,
|
|
144
|
+
outputDir
|
|
145
|
+
});
|
|
146
|
+
return {
|
|
147
|
+
isError: false,
|
|
148
|
+
content: [
|
|
149
|
+
{
|
|
150
|
+
type: 'text',
|
|
151
|
+
text: `Markdown export completed. Generated ${result.markdownFiles.length} markdown file(s) and ${result.screenshotFiles.length} screenshot(s). Output path: ${outputDir}`
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const result = splitReportFile({
|
|
157
|
+
htmlPath,
|
|
158
|
+
outputDir
|
|
159
|
+
});
|
|
160
|
+
return {
|
|
161
|
+
isError: false,
|
|
162
|
+
content: [
|
|
163
|
+
{
|
|
164
|
+
type: 'text',
|
|
165
|
+
text: `Report split completed. Generated ${result.executionJsonFiles.length} execution JSON files and ${result.screenshotFiles.length} screenshots. Output path: ${outputDir}`
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
function createReportCliCommands() {
|
|
172
|
+
return [
|
|
173
|
+
{
|
|
174
|
+
name: 'report-tool',
|
|
175
|
+
def: reportCommandDefinition
|
|
176
|
+
}
|
|
177
|
+
];
|
|
178
|
+
}
|
|
179
|
+
exports.createReportCliCommands = __webpack_exports__.createReportCliCommands;
|
|
180
|
+
exports.reportFileToMarkdown = __webpack_exports__.reportFileToMarkdown;
|
|
181
|
+
exports.splitReportFile = __webpack_exports__.splitReportFile;
|
|
182
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
183
|
+
"createReportCliCommands",
|
|
184
|
+
"reportFileToMarkdown",
|
|
185
|
+
"splitReportFile"
|
|
186
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
187
|
+
Object.defineProperty(exports, '__esModule', {
|
|
188
|
+
value: true
|
|
189
|
+
});
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ReportGenerator: ()=>ReportGenerator,
|
|
28
|
+
assertReportGenerationOptions: ()=>assertReportGenerationOptions,
|
|
29
|
+
nullReportGenerator: ()=>nullReportGenerator
|
|
30
|
+
});
|
|
31
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
32
|
+
const promises_namespaceObject = require("node:fs/promises");
|
|
33
|
+
const external_node_path_namespaceObject = require("node:path");
|
|
34
|
+
const common_namespaceObject = require("@godscene/shared/common");
|
|
35
|
+
const env_namespaceObject = require("@godscene/shared/env");
|
|
36
|
+
const utils_namespaceObject = require("@godscene/shared/utils");
|
|
37
|
+
const html_utils_js_namespaceObject = require("./dump/html-utils.js");
|
|
38
|
+
const screenshot_store_js_namespaceObject = require("./dump/screenshot-store.js");
|
|
39
|
+
const external_types_js_namespaceObject = require("./types.js");
|
|
40
|
+
const external_utils_js_namespaceObject = require("./utils.js");
|
|
41
|
+
function _define_property(obj, key, value) {
|
|
42
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
43
|
+
value: value,
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true
|
|
47
|
+
});
|
|
48
|
+
else obj[key] = value;
|
|
49
|
+
return obj;
|
|
50
|
+
}
|
|
51
|
+
const nullReportGenerator = {
|
|
52
|
+
onExecutionUpdate: ()=>{},
|
|
53
|
+
flush: async ()=>{},
|
|
54
|
+
finalize: async ()=>void 0,
|
|
55
|
+
getReportPath: ()=>void 0
|
|
56
|
+
};
|
|
57
|
+
function assertReportGenerationOptions(opts) {
|
|
58
|
+
if (false === opts.generateReport && true === opts.persistExecutionDump) throw new Error('persistExecutionDump cannot be true when generateReport is false');
|
|
59
|
+
}
|
|
60
|
+
class ReportGenerator {
|
|
61
|
+
static create(reportFileName, opts) {
|
|
62
|
+
assertReportGenerationOptions(opts);
|
|
63
|
+
if (false === opts.generateReport) return nullReportGenerator;
|
|
64
|
+
if (utils_namespaceObject.ifInBrowser) return nullReportGenerator;
|
|
65
|
+
validateReportFileName(reportFileName);
|
|
66
|
+
const reportRootDir = (0, common_namespaceObject.getMidsceneRunSubDir)('report');
|
|
67
|
+
const outputDir = (0, external_node_path_namespaceObject.join)(reportRootDir, reportFileName);
|
|
68
|
+
const reportPath = 'html-and-external-assets' === opts.outputFormat ? (0, external_node_path_namespaceObject.join)(outputDir, 'index.html') : (0, external_node_path_namespaceObject.join)(reportRootDir, ensureHtmlFileName(reportFileName));
|
|
69
|
+
return new ReportGenerator({
|
|
70
|
+
reportPath,
|
|
71
|
+
screenshotMode: 'html-and-external-assets' === opts.outputFormat ? 'directory' : 'inline',
|
|
72
|
+
persistExecutionDump: opts.persistExecutionDump,
|
|
73
|
+
autoPrint: opts.autoPrintReportMsg,
|
|
74
|
+
reuseExistingReport: opts.reuseExistingReport
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
onExecutionUpdate(execution, reportMeta, attributes) {
|
|
78
|
+
this.lastExecution = execution;
|
|
79
|
+
this.lastReportMeta = reportMeta;
|
|
80
|
+
this.mergeReportAttributes(attributes);
|
|
81
|
+
this.writeQueue = this.writeQueue.then(async ()=>{
|
|
82
|
+
if (this.destroyed) return;
|
|
83
|
+
await this.doWriteExecution(execution, reportMeta);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
async flush() {
|
|
87
|
+
await this.writeQueue;
|
|
88
|
+
}
|
|
89
|
+
async finalize() {
|
|
90
|
+
if (this.lastExecution && this.lastReportMeta) this.onExecutionUpdate(this.lastExecution, this.lastReportMeta);
|
|
91
|
+
await this.flush();
|
|
92
|
+
this.destroyed = true;
|
|
93
|
+
if (!this.initialized) return;
|
|
94
|
+
this.printReportPath('finalized');
|
|
95
|
+
return this.reportPath;
|
|
96
|
+
}
|
|
97
|
+
getReportPath() {
|
|
98
|
+
return this.reportPath;
|
|
99
|
+
}
|
|
100
|
+
printReportPath(verb) {
|
|
101
|
+
if (!this.autoPrint || !this.reportPath) return;
|
|
102
|
+
if (env_namespaceObject.globalConfigManager.getEnvConfigInBoolean(env_namespaceObject.MIDSCENE_REPORT_QUIET)) return;
|
|
103
|
+
if ('directory' === this.screenshotMode) (0, utils_namespaceObject.logMsg)(`Midscene - report ${verb}: npx serve ${(0, external_node_path_namespaceObject.dirname)(this.reportPath)}`);
|
|
104
|
+
else (0, utils_namespaceObject.logMsg)(`Midscene - report ${verb}: ${this.reportPath}`);
|
|
105
|
+
}
|
|
106
|
+
async doWriteExecution(execution, reportMeta) {
|
|
107
|
+
const singleDump = this.wrapAsReportDump(execution, reportMeta);
|
|
108
|
+
if ('inline' === this.screenshotMode) await this.writeInlineExecution(execution, singleDump);
|
|
109
|
+
else await this.writeDirectoryExecution(execution, singleDump);
|
|
110
|
+
if (this.shouldPersistExecutionDump) await this.persistExecutionDumpToFile(execution, singleDump);
|
|
111
|
+
if (!this.firstWriteDone) {
|
|
112
|
+
this.firstWriteDone = true;
|
|
113
|
+
this.printReportPath('generated');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
mergeReportAttributes(attributes) {
|
|
117
|
+
if (!attributes) return;
|
|
118
|
+
for (const [key, value] of Object.entries(attributes))if (null != value) this.reportAttributes[key] = String(value);
|
|
119
|
+
}
|
|
120
|
+
hydrateStateFromExistingReport() {
|
|
121
|
+
if (!(0, external_node_fs_namespaceObject.existsSync)(this.reportPath)) return;
|
|
122
|
+
this.initialized = true;
|
|
123
|
+
if (!this.shouldPersistExecutionDump) return;
|
|
124
|
+
const reportDir = (0, external_node_path_namespaceObject.dirname)(this.reportPath);
|
|
125
|
+
const existingExecutionIndices = (0, external_node_fs_namespaceObject.readdirSync)(reportDir).map((name)=>/^(\d+)\.execution\.json$/.exec(name)?.[1]).filter((index)=>Boolean(index)).map((index)=>Number.parseInt(index, 10)).filter((index)=>Number.isFinite(index));
|
|
126
|
+
if (existingExecutionIndices.length > 0) this.executionLogIndex = Math.max(...existingExecutionIndices);
|
|
127
|
+
}
|
|
128
|
+
getDumpScriptAttributes() {
|
|
129
|
+
return {
|
|
130
|
+
'data-group-id': this.reportStreamId,
|
|
131
|
+
...this.reportAttributes
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
wrapAsReportDump(execution, reportMeta) {
|
|
135
|
+
return new external_types_js_namespaceObject.ReportActionDump({
|
|
136
|
+
sdkVersion: reportMeta.sdkVersion,
|
|
137
|
+
groupName: reportMeta.groupName,
|
|
138
|
+
groupDescription: reportMeta.groupDescription,
|
|
139
|
+
modelBriefs: reportMeta.modelBriefs,
|
|
140
|
+
deviceType: reportMeta.deviceType,
|
|
141
|
+
executions: [
|
|
142
|
+
execution
|
|
143
|
+
]
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
async writeInlineExecution(execution, singleDump) {
|
|
147
|
+
const dir = (0, external_node_path_namespaceObject.dirname)(this.reportPath);
|
|
148
|
+
if (!(0, external_node_fs_namespaceObject.existsSync)(dir)) (0, external_node_fs_namespaceObject.mkdirSync)(dir, {
|
|
149
|
+
recursive: true
|
|
150
|
+
});
|
|
151
|
+
if (!this.initialized) {
|
|
152
|
+
await (0, promises_namespaceObject.writeFile)(this.reportPath, (0, external_utils_js_namespaceObject.getReportTpl)());
|
|
153
|
+
this.initialized = true;
|
|
154
|
+
}
|
|
155
|
+
for (const screenshot of execution.collectScreenshots())await this.screenshotStore.persist(screenshot);
|
|
156
|
+
const serialized = singleDump.serialize();
|
|
157
|
+
await (0, promises_namespaceObject.appendFile)(this.reportPath, `\n${(0, html_utils_js_namespaceObject.generateDumpScriptTag)(serialized, this.getDumpScriptAttributes())}`);
|
|
158
|
+
}
|
|
159
|
+
async writeDirectoryExecution(execution, singleDump) {
|
|
160
|
+
const dir = (0, external_node_path_namespaceObject.dirname)(this.reportPath);
|
|
161
|
+
if (!(0, external_node_fs_namespaceObject.existsSync)(dir)) (0, external_node_fs_namespaceObject.mkdirSync)(dir, {
|
|
162
|
+
recursive: true
|
|
163
|
+
});
|
|
164
|
+
for (const screenshot of execution.collectScreenshots())await this.screenshotStore.persist(screenshot);
|
|
165
|
+
const serialized = singleDump.serialize();
|
|
166
|
+
if (!this.initialized) {
|
|
167
|
+
await (0, promises_namespaceObject.writeFile)(this.reportPath, `${(0, external_utils_js_namespaceObject.getReportTpl)()}${(0, html_utils_js_namespaceObject.getBaseUrlFixScript)()}`);
|
|
168
|
+
this.initialized = true;
|
|
169
|
+
}
|
|
170
|
+
await (0, promises_namespaceObject.appendFile)(this.reportPath, `\n${(0, html_utils_js_namespaceObject.generateDumpScriptTag)(serialized, this.getDumpScriptAttributes())}`);
|
|
171
|
+
}
|
|
172
|
+
getExecutionLogKey(execution) {
|
|
173
|
+
if (!execution.id) throw new Error('ReportGenerator: execution.id is required for persisting execution dumps');
|
|
174
|
+
return `id:${execution.id}`;
|
|
175
|
+
}
|
|
176
|
+
async persistExecutionDumpToFile(execution, singleDump) {
|
|
177
|
+
const dir = (0, external_node_path_namespaceObject.dirname)(this.reportPath);
|
|
178
|
+
if (!(0, external_node_fs_namespaceObject.existsSync)(dir)) (0, external_node_fs_namespaceObject.mkdirSync)(dir, {
|
|
179
|
+
recursive: true
|
|
180
|
+
});
|
|
181
|
+
const executionLogKey = this.getExecutionLogKey(execution);
|
|
182
|
+
let fileIndex = this.executionLogFileIndexByExecutionKey.get(executionLogKey);
|
|
183
|
+
if (!fileIndex) {
|
|
184
|
+
this.executionLogIndex += 1;
|
|
185
|
+
fileIndex = this.executionLogIndex;
|
|
186
|
+
this.executionLogFileIndexByExecutionKey.set(executionLogKey, fileIndex);
|
|
187
|
+
}
|
|
188
|
+
const fileName = `${fileIndex}.execution.json`;
|
|
189
|
+
const filePath = (0, external_node_path_namespaceObject.join)((0, external_node_path_namespaceObject.dirname)(this.reportPath), fileName);
|
|
190
|
+
await (0, promises_namespaceObject.writeFile)(filePath, singleDump.serialize(2), 'utf-8');
|
|
191
|
+
}
|
|
192
|
+
constructor(options){
|
|
193
|
+
_define_property(this, "reportPath", void 0);
|
|
194
|
+
_define_property(this, "screenshotMode", void 0);
|
|
195
|
+
_define_property(this, "shouldPersistExecutionDump", void 0);
|
|
196
|
+
_define_property(this, "autoPrint", void 0);
|
|
197
|
+
_define_property(this, "firstWriteDone", false);
|
|
198
|
+
_define_property(this, "executionLogIndex", 0);
|
|
199
|
+
_define_property(this, "executionLogFileIndexByExecutionKey", new Map());
|
|
200
|
+
_define_property(this, "reportStreamId", void 0);
|
|
201
|
+
_define_property(this, "screenshotStore", void 0);
|
|
202
|
+
_define_property(this, "initialized", false);
|
|
203
|
+
_define_property(this, "lastExecution", void 0);
|
|
204
|
+
_define_property(this, "lastReportMeta", void 0);
|
|
205
|
+
_define_property(this, "reportAttributes", {});
|
|
206
|
+
_define_property(this, "writeQueue", Promise.resolve());
|
|
207
|
+
_define_property(this, "destroyed", false);
|
|
208
|
+
this.reportPath = options.reportPath;
|
|
209
|
+
this.screenshotMode = options.screenshotMode;
|
|
210
|
+
this.shouldPersistExecutionDump = options.persistExecutionDump ?? false;
|
|
211
|
+
this.autoPrint = options.autoPrint ?? true;
|
|
212
|
+
this.reportStreamId = (0, utils_namespaceObject.uuid)();
|
|
213
|
+
this.screenshotStore = new screenshot_store_js_namespaceObject.ScreenshotStore({
|
|
214
|
+
mode: 'inline' === this.screenshotMode ? 'inline' : 'directory',
|
|
215
|
+
reportPath: this.reportPath,
|
|
216
|
+
screenshotsDir: (0, external_node_path_namespaceObject.join)((0, external_node_path_namespaceObject.dirname)(this.reportPath), 'screenshots'),
|
|
217
|
+
writeInlineImage: async (id, base64)=>{
|
|
218
|
+
await (0, promises_namespaceObject.appendFile)(this.reportPath, `\n${(0, html_utils_js_namespaceObject.generateImageScriptTag)(id, base64)}`);
|
|
219
|
+
},
|
|
220
|
+
alsoWriteFileCopy: this.shouldPersistExecutionDump
|
|
221
|
+
});
|
|
222
|
+
if (options.reuseExistingReport) this.hydrateStateFromExistingReport();
|
|
223
|
+
this.printReportPath('will be generated at');
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function ensureHtmlFileName(reportFileName) {
|
|
227
|
+
return reportFileName.endsWith('.html') ? reportFileName : `${reportFileName}.html`;
|
|
228
|
+
}
|
|
229
|
+
function validateReportFileName(reportFileName) {
|
|
230
|
+
if (!reportFileName?.trim()) throw new Error('reportFileName must be a non-empty string');
|
|
231
|
+
if (/[\\/]/.test(reportFileName)) throw new Error('reportFileName must not contain path separators (`/` or `\\\\`)');
|
|
232
|
+
if (/[:*?"<>|]/.test(reportFileName)) throw new Error('reportFileName contains illegal filename characters: : * ? " < > |');
|
|
233
|
+
}
|
|
234
|
+
exports.ReportGenerator = __webpack_exports__.ReportGenerator;
|
|
235
|
+
exports.assertReportGenerationOptions = __webpack_exports__.assertReportGenerationOptions;
|
|
236
|
+
exports.nullReportGenerator = __webpack_exports__.nullReportGenerator;
|
|
237
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
238
|
+
"ReportGenerator",
|
|
239
|
+
"assertReportGenerationOptions",
|
|
240
|
+
"nullReportGenerator"
|
|
241
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
242
|
+
Object.defineProperty(exports, '__esModule', {
|
|
243
|
+
value: true
|
|
244
|
+
});
|