@midscene/core 1.15.2-beta-20261012123219.0 → 1.15.2
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/action-readiness.mjs +6 -3
- package/dist/es/agent/action-readiness.mjs.map +1 -1
- package/dist/es/agent/agent.mjs +4 -2
- package/dist/es/agent/agent.mjs.map +1 -1
- package/dist/es/agent/execution-session.mjs.map +1 -1
- package/dist/es/agent/task-builder.mjs +35 -16
- package/dist/es/agent/task-builder.mjs.map +1 -1
- package/dist/es/agent/tasks.mjs +35 -12
- package/dist/es/agent/tasks.mjs.map +1 -1
- package/dist/es/agent/utils.mjs +1 -1
- package/dist/es/device/index.mjs +7 -6
- package/dist/es/device/index.mjs.map +1 -1
- package/dist/es/report-generator.mjs +30 -14
- package/dist/es/report-generator.mjs.map +1 -1
- package/dist/es/report-html-template.mjs +1 -1
- package/dist/es/report.mjs +121 -44
- package/dist/es/report.mjs.map +1 -1
- package/dist/es/service/index.mjs.map +1 -1
- package/dist/es/task-runner.mjs +22 -12
- package/dist/es/task-runner.mjs.map +1 -1
- package/dist/es/test-run-report.mjs.map +1 -1
- package/dist/es/test-runner/engine/case-runner.mjs +1 -1
- package/dist/es/test-runner/engine/case-runner.mjs.map +1 -1
- package/dist/es/test-runner/engine/document-runtime.mjs +42 -12
- package/dist/es/test-runner/engine/document-runtime.mjs.map +1 -1
- package/dist/es/test-runner/engine/execute-step.mjs +130 -12
- package/dist/es/test-runner/engine/execute-step.mjs.map +1 -1
- package/dist/es/test-runner/engine/index.mjs +1 -0
- package/dist/es/test-runner/engine/project-runtime.mjs +14 -5
- package/dist/es/test-runner/engine/project-runtime.mjs.map +1 -1
- package/dist/es/test-runner/engine/resource-operations.mjs +286 -35
- package/dist/es/test-runner/engine/resource-operations.mjs.map +1 -1
- package/dist/es/test-runner/engine/result-metadata.mjs +21 -0
- package/dist/es/test-runner/engine/result-metadata.mjs.map +1 -0
- package/dist/es/test-runner/engine/run-collected-case.mjs +30 -9
- package/dist/es/test-runner/engine/run-collected-case.mjs.map +1 -1
- package/dist/es/test-runner/engine/run-workflow-document.mjs +57 -10
- package/dist/es/test-runner/engine/run-workflow-document.mjs.map +1 -1
- package/dist/es/test-runner/errors.mjs +26 -13
- package/dist/es/test-runner/errors.mjs.map +1 -1
- package/dist/es/test-runner/execution-record.mjs +2 -0
- package/dist/es/test-runner/execution-record.mjs.map +1 -1
- package/dist/es/test-runner/index.mjs +3 -0
- package/dist/es/test-runner/reporting/agent-report.mjs +2 -7
- package/dist/es/test-runner/reporting/agent-report.mjs.map +1 -1
- package/dist/es/test-runner/reporting/merge-report.mjs +207 -6
- package/dist/es/test-runner/reporting/merge-report.mjs.map +1 -1
- package/dist/es/test-runner/reporting/metrics.mjs +77 -0
- package/dist/es/test-runner/reporting/metrics.mjs.map +1 -0
- package/dist/es/test-runner/reporting/sanitize.mjs +92 -16
- package/dist/es/test-runner/reporting/sanitize.mjs.map +1 -1
- package/dist/es/test-runner/reporting/test-plan.mjs +56 -0
- package/dist/es/test-runner/reporting/test-plan.mjs.map +1 -0
- package/dist/es/test-runner/reporting/test-run-report.mjs +208 -21
- package/dist/es/test-runner/reporting/test-run-report.mjs.map +1 -1
- package/dist/es/types.mjs.map +1 -1
- package/dist/es/utils.mjs +1 -1
- package/dist/es/yaml/legacy-yaml-runtime.mjs +3 -3
- package/dist/es/yaml/legacy-yaml-runtime.mjs.map +1 -1
- package/dist/lib/agent/action-readiness.js +6 -3
- package/dist/lib/agent/action-readiness.js.map +1 -1
- package/dist/lib/agent/agent.js +4 -2
- package/dist/lib/agent/agent.js.map +1 -1
- package/dist/lib/agent/execution-session.js.map +1 -1
- package/dist/lib/agent/task-builder.js +42 -23
- package/dist/lib/agent/task-builder.js.map +1 -1
- package/dist/lib/agent/tasks.js +35 -12
- package/dist/lib/agent/tasks.js.map +1 -1
- package/dist/lib/agent/utils.js +1 -1
- package/dist/lib/device/index.js +7 -6
- package/dist/lib/device/index.js.map +1 -1
- package/dist/lib/report-generator.js +30 -14
- package/dist/lib/report-generator.js.map +1 -1
- package/dist/lib/report-html-template.js +1 -1
- package/dist/lib/report.js +121 -44
- package/dist/lib/report.js.map +1 -1
- package/dist/lib/service/index.js.map +1 -1
- package/dist/lib/task-runner.js +22 -12
- package/dist/lib/task-runner.js.map +1 -1
- package/dist/lib/test-run-report.js.map +1 -1
- package/dist/lib/test-runner/engine/case-runner.js +1 -1
- package/dist/lib/test-runner/engine/case-runner.js.map +1 -1
- package/dist/lib/test-runner/engine/document-runtime.js +41 -11
- package/dist/lib/test-runner/engine/document-runtime.js.map +1 -1
- package/dist/lib/test-runner/engine/execute-step.js +131 -10
- package/dist/lib/test-runner/engine/execute-step.js.map +1 -1
- package/dist/lib/test-runner/engine/index.js +9 -2
- package/dist/lib/test-runner/engine/index.js.map +1 -1
- package/dist/lib/test-runner/engine/project-runtime.js +13 -4
- package/dist/lib/test-runner/engine/project-runtime.js.map +1 -1
- package/dist/lib/test-runner/engine/resource-operations.js +319 -38
- package/dist/lib/test-runner/engine/resource-operations.js.map +1 -1
- package/dist/lib/test-runner/engine/result-metadata.js +58 -0
- package/dist/lib/test-runner/engine/result-metadata.js.map +1 -0
- package/dist/lib/test-runner/engine/run-collected-case.js +29 -8
- package/dist/lib/test-runner/engine/run-collected-case.js.map +1 -1
- package/dist/lib/test-runner/engine/run-workflow-document.js +57 -10
- package/dist/lib/test-runner/engine/run-workflow-document.js.map +1 -1
- package/dist/lib/test-runner/errors.js +42 -23
- package/dist/lib/test-runner/errors.js.map +1 -1
- package/dist/lib/test-runner/execution-record.js +2 -0
- package/dist/lib/test-runner/execution-record.js.map +1 -1
- package/dist/lib/test-runner/index.js +88 -16
- package/dist/lib/test-runner/index.js.map +1 -1
- package/dist/lib/test-runner/node/index.js +2 -2
- package/dist/lib/test-runner/reporting/agent-report.js +2 -7
- package/dist/lib/test-runner/reporting/agent-report.js.map +1 -1
- package/dist/lib/test-runner/reporting/merge-report.js +207 -6
- package/dist/lib/test-runner/reporting/merge-report.js.map +1 -1
- package/dist/lib/test-runner/reporting/metrics.js +114 -0
- package/dist/lib/test-runner/reporting/metrics.js.map +1 -0
- package/dist/lib/test-runner/reporting/sanitize.js +94 -15
- package/dist/lib/test-runner/reporting/sanitize.js.map +1 -1
- package/dist/lib/test-runner/reporting/test-plan.js +90 -0
- package/dist/lib/test-runner/reporting/test-plan.js.map +1 -0
- package/dist/lib/test-runner/reporting/test-run-report.js +208 -21
- package/dist/lib/test-runner/reporting/test-run-report.js.map +1 -1
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/lib/yaml/legacy-yaml-runtime.js +2 -2
- package/dist/lib/yaml/legacy-yaml-runtime.js.map +1 -1
- package/dist/types/agent/action-readiness.d.ts +1 -1
- package/dist/types/agent/action-readiness.d.ts.map +1 -1
- package/dist/types/agent/agent.d.ts +1 -1
- package/dist/types/agent/agent.d.ts.map +1 -1
- package/dist/types/agent/execution-session.d.ts +1 -1
- package/dist/types/agent/execution-session.d.ts.map +1 -1
- package/dist/types/agent/task-builder.d.ts +4 -2
- package/dist/types/agent/task-builder.d.ts.map +1 -1
- package/dist/types/agent/tasks.d.ts +3 -0
- package/dist/types/agent/tasks.d.ts.map +1 -1
- package/dist/types/device/index.d.ts +3 -3
- package/dist/types/device/index.d.ts.map +1 -1
- package/dist/types/report-generator.d.ts +4 -2
- package/dist/types/report-generator.d.ts.map +1 -1
- package/dist/types/report.d.ts.map +1 -1
- package/dist/types/service/index.d.ts +2 -2
- package/dist/types/service/index.d.ts.map +1 -1
- package/dist/types/task-runner.d.ts +1 -1
- package/dist/types/task-runner.d.ts.map +1 -1
- package/dist/types/test-run-report.d.ts +157 -8
- package/dist/types/test-run-report.d.ts.map +1 -1
- package/dist/types/test-runner/engine/document-runtime.d.ts.map +1 -1
- package/dist/types/test-runner/engine/execute-step.d.ts +1 -0
- package/dist/types/test-runner/engine/execute-step.d.ts.map +1 -1
- package/dist/types/test-runner/engine/index.d.ts +1 -0
- package/dist/types/test-runner/engine/index.d.ts.map +1 -1
- package/dist/types/test-runner/engine/project-runtime.d.ts.map +1 -1
- package/dist/types/test-runner/engine/resource-operations.d.ts +41 -3
- package/dist/types/test-runner/engine/resource-operations.d.ts.map +1 -1
- package/dist/types/test-runner/engine/result-metadata.d.ts +18 -0
- package/dist/types/test-runner/engine/result-metadata.d.ts.map +1 -0
- package/dist/types/test-runner/engine/run-collected-case.d.ts.map +1 -1
- package/dist/types/test-runner/engine/run-workflow-document.d.ts.map +1 -1
- package/dist/types/test-runner/engine/types.d.ts +47 -8
- package/dist/types/test-runner/engine/types.d.ts.map +1 -1
- package/dist/types/test-runner/errors.d.ts +7 -0
- package/dist/types/test-runner/errors.d.ts.map +1 -1
- package/dist/types/test-runner/execution-record.d.ts.map +1 -1
- package/dist/types/test-runner/index.d.ts +2 -0
- package/dist/types/test-runner/index.d.ts.map +1 -1
- package/dist/types/test-runner/node/types.d.ts +9 -1
- package/dist/types/test-runner/node/types.d.ts.map +1 -1
- package/dist/types/test-runner/parser/types.d.ts +5 -0
- package/dist/types/test-runner/parser/types.d.ts.map +1 -1
- package/dist/types/test-runner/reporting/agent-report.d.ts.map +1 -1
- package/dist/types/test-runner/reporting/merge-report.d.ts +1 -1
- package/dist/types/test-runner/reporting/merge-report.d.ts.map +1 -1
- package/dist/types/test-runner/reporting/metrics.d.ts +7 -0
- package/dist/types/test-runner/reporting/metrics.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/sanitize.d.ts +1 -0
- package/dist/types/test-runner/reporting/sanitize.d.ts.map +1 -1
- package/dist/types/test-runner/reporting/test-plan.d.ts +8 -0
- package/dist/types/test-runner/reporting/test-plan.d.ts.map +1 -0
- package/dist/types/test-runner/reporting/test-run-report.d.ts.map +1 -1
- package/dist/types/test-runner/reporting/types.d.ts +6 -1
- package/dist/types/test-runner/reporting/types.d.ts.map +1 -1
- package/dist/types/types.d.ts +3 -1
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -24,6 +24,7 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
isReportSecretKey: ()=>isReportSecretKey,
|
|
27
28
|
sanitizeReportError: ()=>sanitizeReportError,
|
|
28
29
|
sanitizeReportText: ()=>sanitizeReportText,
|
|
29
30
|
sanitizeReportValue: ()=>sanitizeReportValue
|
|
@@ -44,7 +45,7 @@ const normalizedSecretKeys = [
|
|
|
44
45
|
'apikey'
|
|
45
46
|
];
|
|
46
47
|
const normalizedKey = (key)=>key.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
47
|
-
const
|
|
48
|
+
const isReportSecretKey = (key)=>{
|
|
48
49
|
const normalized = normalizedKey(key);
|
|
49
50
|
return normalizedSecretKeys.some((secret)=>normalized.includes(secret));
|
|
50
51
|
};
|
|
@@ -136,7 +137,7 @@ function sanitizeReportValue(value) {
|
|
|
136
137
|
for (const key of keys.slice(0, MAX_OBJECT_KEYS)){
|
|
137
138
|
const childPath = objectPath(path, key);
|
|
138
139
|
if (!consume(childPath, key)) break;
|
|
139
|
-
if (
|
|
140
|
+
if (isReportSecretKey(key)) {
|
|
140
141
|
output[key] = '[REDACTED]';
|
|
141
142
|
redactedPaths.add(childPath);
|
|
142
143
|
} else output[key] = visit(current[key], childPath, depth + 1);
|
|
@@ -169,28 +170,106 @@ function sanitizeReportValue(value) {
|
|
|
169
170
|
};
|
|
170
171
|
}
|
|
171
172
|
function sanitizeReportError(error) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
173
|
+
const messageText = (value)=>sanitizeReportText(value.replace(/\bBearer\s+[A-Za-z0-9._~+/=-]+/gi, 'Bearer [REDACTED]').replace(/(https?:\/\/)[^\s/@]+:[^\s/@]+@/gi, '$1[REDACTED]@').replace(/(["']?\b(?:password|passwd|secret|token|authorization|cookie|api[_-]?key)\b["']?\s*[:=]\s*)(?:\[REDACTED\]|"[^"]*"|'[^']*'|[^\s,;}\]]+)/gi, '$1[REDACTED]'));
|
|
174
|
+
const ancestors = new WeakSet();
|
|
175
|
+
let remainingBytes = MAX_SERIALIZED_BYTES - 1024;
|
|
176
|
+
let nodes = 0;
|
|
177
|
+
const shortened = ()=>({
|
|
178
|
+
format: 'midscene-error',
|
|
179
|
+
name: 'Error',
|
|
180
|
+
message: '[Truncated: error cause chain]',
|
|
181
|
+
truncated: true
|
|
182
|
+
});
|
|
183
|
+
const visit = (current, depth)=>{
|
|
184
|
+
if (depth >= MAX_DEPTH || nodes++ >= 25 || remainingBytes < 4096) return shortened();
|
|
185
|
+
if ('object' != typeof current || null === current) return {
|
|
186
|
+
format: 'midscene-error',
|
|
187
|
+
name: 'Error',
|
|
188
|
+
message: messageText(String(current))
|
|
189
|
+
};
|
|
190
|
+
if (ancestors.has(current)) return shortened();
|
|
191
|
+
ancestors.add(current);
|
|
192
|
+
const source = current;
|
|
193
|
+
const result = {
|
|
194
|
+
format: 'midscene-error',
|
|
195
|
+
...true === source.truncated ? {
|
|
196
|
+
truncated: true
|
|
179
197
|
} : {},
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
198
|
+
name: 'string' == typeof source.name ? sanitizeReportText(source.name, 200) : 'Error',
|
|
199
|
+
message: messageText('string' == typeof source.message ? source.message : String(current)),
|
|
200
|
+
...'string' == typeof source.code ? {
|
|
201
|
+
code: sanitizeReportText(source.code, 200)
|
|
202
|
+
} : {}
|
|
183
203
|
};
|
|
184
|
-
|
|
204
|
+
remainingBytes -= stringByteLength(JSON.stringify(result)) + 128;
|
|
205
|
+
if (void 0 !== source.details) {
|
|
206
|
+
const encodedDetails = 'midscene-error' === source.format && 'object' == typeof source.details && null !== source.details && 'value' in source.details ? source.details : void 0;
|
|
207
|
+
const details = sanitizeReportValue(encodedDetails ? encodedDetails.value : source.details);
|
|
208
|
+
for (const field of [
|
|
209
|
+
'redactedPaths',
|
|
210
|
+
'truncatedPaths'
|
|
211
|
+
]){
|
|
212
|
+
const paths = encodedDetails?.[field];
|
|
213
|
+
if (Array.isArray(paths)) details[field] = [
|
|
214
|
+
...new Set([
|
|
215
|
+
...details[field] ?? [],
|
|
216
|
+
...paths.filter((path)=>'string' == typeof path).slice(0, 50).map((path)=>sanitizeReportText(path))
|
|
217
|
+
])
|
|
218
|
+
];
|
|
219
|
+
}
|
|
220
|
+
const bytes = stringByteLength(JSON.stringify(details));
|
|
221
|
+
if (bytes < remainingBytes - 4096) {
|
|
222
|
+
result.details = details;
|
|
223
|
+
remainingBytes -= bytes;
|
|
224
|
+
} else {
|
|
225
|
+
result.details = {
|
|
226
|
+
value: '[Truncated: error details size limit]',
|
|
227
|
+
truncatedPaths: [
|
|
228
|
+
'$'
|
|
229
|
+
]
|
|
230
|
+
};
|
|
231
|
+
result.truncated = true;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (void 0 !== source.cause) result.cause = visit(source.cause, depth + 1);
|
|
235
|
+
if (Array.isArray(source.errors)) {
|
|
236
|
+
result.errors = [];
|
|
237
|
+
for (const item of source.errors.slice(0, 10)){
|
|
238
|
+
if (nodes >= 25 || remainingBytes < 4096) {
|
|
239
|
+
result.truncated = true;
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
result.errors.push(visit(item, depth + 1));
|
|
243
|
+
}
|
|
244
|
+
if (result.errors.length < source.errors.length) result.truncated = true;
|
|
245
|
+
}
|
|
246
|
+
ancestors.delete(current);
|
|
247
|
+
return result;
|
|
248
|
+
};
|
|
249
|
+
const result = visit(error, 0);
|
|
250
|
+
if (stringByteLength(JSON.stringify(result)) <= MAX_SERIALIZED_BYTES) return result;
|
|
185
251
|
return {
|
|
186
|
-
|
|
187
|
-
|
|
252
|
+
format: 'midscene-error',
|
|
253
|
+
name: result.name,
|
|
254
|
+
message: result.message,
|
|
255
|
+
...result.code ? {
|
|
256
|
+
code: result.code
|
|
257
|
+
} : {},
|
|
258
|
+
truncated: true,
|
|
259
|
+
cause: {
|
|
260
|
+
format: 'midscene-error',
|
|
261
|
+
name: 'Error',
|
|
262
|
+
message: '[Truncated: serialized error exceeded 64 KiB]',
|
|
263
|
+
truncated: true
|
|
264
|
+
}
|
|
188
265
|
};
|
|
189
266
|
}
|
|
267
|
+
exports.isReportSecretKey = __webpack_exports__.isReportSecretKey;
|
|
190
268
|
exports.sanitizeReportError = __webpack_exports__.sanitizeReportError;
|
|
191
269
|
exports.sanitizeReportText = __webpack_exports__.sanitizeReportText;
|
|
192
270
|
exports.sanitizeReportValue = __webpack_exports__.sanitizeReportValue;
|
|
193
271
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
272
|
+
"isReportSecretKey",
|
|
194
273
|
"sanitizeReportError",
|
|
195
274
|
"sanitizeReportText",
|
|
196
275
|
"sanitizeReportValue"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-runner/reporting/sanitize.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../src/test-runner/reporting/sanitize.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type {\n TestRunReportError,\n TestRunReportValue,\n} from '../../test-run-report';\n\nconst MAX_DEPTH = 6;\nconst MAX_STRING_LENGTH = 2_000;\nconst MAX_ARRAY_ITEMS = 50;\nconst MAX_OBJECT_KEYS = 50;\nconst MAX_SERIALIZED_BYTES = 64 * 1024;\nconst TRUNCATED_VALUE = '[Truncated: display value exceeded 64 KiB]';\n\nconst normalizedSecretKeys = [\n 'password',\n 'passwd',\n 'secret',\n 'token',\n 'authorization',\n 'cookie',\n 'apikey',\n];\n\nconst normalizedKey = (key: string): string =>\n key.toLowerCase().replace(/[^a-z0-9]/g, '');\n\nconst isSecretKey = (key: string): boolean => {\n const normalized = normalizedKey(key);\n return normalizedSecretKeys.some((secret) => normalized.includes(secret));\n};\n\nconst objectPath = (parent: string, key: string): string =>\n /^[A-Za-z_$][\\w$]*$/.test(key)\n ? `${parent}.${key}`\n : `${parent}[${JSON.stringify(key)}]`;\n\nconst stringByteLength = (value: string): number =>\n new TextEncoder().encode(value).byteLength;\n\nexport function sanitizeReportText(\n value: string,\n maximumLength = MAX_STRING_LENGTH,\n): string {\n return value.length <= maximumLength\n ? value\n : `${value.slice(0, maximumLength)}… [truncated]`;\n}\n\n/** Convert arbitrary Node input/output to a bounded, JSON-safe display value. */\nexport function sanitizeReportValue(value: unknown): TestRunReportValue {\n const truncatedPaths = new Set<string>();\n const redactedPaths = new Set<string>();\n const ancestors = new WeakSet<object>();\n let remainingBytes = MAX_SERIALIZED_BYTES;\n\n const consume = (path: string, text: string): boolean => {\n remainingBytes -= stringByteLength(text);\n if (remainingBytes >= 0) return true;\n truncatedPaths.add(path);\n return false;\n };\n\n const visit = (current: unknown, path: string, depth: number): unknown => {\n if (remainingBytes <= 0) {\n truncatedPaths.add(path);\n return '[Truncated: size limit]';\n }\n if (current === null || typeof current === 'boolean') {\n consume(path, String(current));\n return current;\n }\n if (typeof current === 'string') {\n if (current.length > MAX_STRING_LENGTH) {\n truncatedPaths.add(path);\n const shortened = `${current.slice(0, MAX_STRING_LENGTH)}… [truncated]`;\n consume(path, shortened);\n return shortened;\n }\n consume(path, current);\n return current;\n }\n if (typeof current === 'number') {\n if (Number.isFinite(current)) {\n consume(path, String(current));\n return current;\n }\n truncatedPaths.add(path);\n return `[Unsupported number: ${String(current)}]`;\n }\n if (typeof current === 'bigint') {\n truncatedPaths.add(path);\n return `[Unsupported bigint: ${String(current)}]`;\n }\n if (\n current === undefined ||\n typeof current === 'function' ||\n typeof current === 'symbol'\n ) {\n truncatedPaths.add(path);\n return `[Unsupported ${typeof current}]`;\n }\n if (depth >= MAX_DEPTH) {\n truncatedPaths.add(path);\n return '[Truncated: maximum depth]';\n }\n\n if (current instanceof Date) {\n const date = Number.isNaN(current.getTime())\n ? '[Invalid Date]'\n : current.toISOString();\n consume(path, date);\n return date;\n }\n if (ancestors.has(current)) {\n truncatedPaths.add(path);\n return '[Unsupported circular value]';\n }\n\n if (Array.isArray(current)) {\n ancestors.add(current);\n const output: unknown[] = [];\n const itemCount = Math.min(current.length, MAX_ARRAY_ITEMS);\n for (let index = 0; index < itemCount; index += 1) {\n if (remainingBytes <= 0) break;\n output.push(visit(current[index], `${path}[${index}]`, depth + 1));\n }\n if (current.length > output.length) truncatedPaths.add(path);\n ancestors.delete(current);\n return output;\n }\n\n const prototype = Object.getPrototypeOf(current);\n if (prototype !== Object.prototype && prototype !== null) {\n truncatedPaths.add(path);\n const constructorName =\n (current as { constructor?: { name?: string } }).constructor?.name ??\n 'object';\n return `[Unsupported object: ${constructorName}]`;\n }\n\n ancestors.add(current);\n const output: Record<string, unknown> = {};\n const keys = Object.keys(current as Record<string, unknown>);\n for (const key of keys.slice(0, MAX_OBJECT_KEYS)) {\n const childPath = objectPath(path, key);\n if (!consume(childPath, key)) break;\n if (isSecretKey(key)) {\n output[key] = '[REDACTED]';\n redactedPaths.add(childPath);\n } else {\n output[key] = visit(\n (current as Record<string, unknown>)[key],\n childPath,\n depth + 1,\n );\n }\n if (remainingBytes <= 0) break;\n }\n if (keys.length > Object.keys(output).length) truncatedPaths.add(path);\n ancestors.delete(current);\n return output;\n };\n\n const sanitized = visit(value, '$', 0);\n const serialized = JSON.stringify(sanitized);\n if (\n serialized === undefined ||\n stringByteLength(serialized) > MAX_SERIALIZED_BYTES\n ) {\n return { value: TRUNCATED_VALUE, truncatedPaths: ['$'] };\n }\n\n return {\n value: sanitized,\n ...(truncatedPaths.size > 0 ? { truncatedPaths: [...truncatedPaths] } : {}),\n ...(redactedPaths.size > 0 ? { redactedPaths: [...redactedPaths] } : {}),\n };\n}\n\nexport function sanitizeReportError(error: unknown): TestRunReportError {\n if (\n error instanceof Error ||\n (typeof error === 'object' &&\n error !== null &&\n typeof (error as { message?: unknown }).message === 'string')\n ) {\n const workflowLike = error as {\n name?: string;\n message: string;\n code?: unknown;\n details?: unknown;\n };\n return {\n name: sanitizeReportText(workflowLike.name || 'Error', 200),\n message: sanitizeReportText(workflowLike.message || String(error)),\n ...(typeof workflowLike.code === 'string'\n ? { code: sanitizeReportText(workflowLike.code, 200) }\n : {}),\n ...(workflowLike.details === undefined\n ? {}\n : { details: sanitizeReportValue(workflowLike.details) }),\n };\n }\n\n return {\n name: 'Error',\n message: sanitizeReportText(String(error)),\n };\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","MAX_DEPTH","MAX_STRING_LENGTH","MAX_ARRAY_ITEMS","MAX_OBJECT_KEYS","MAX_SERIALIZED_BYTES","TRUNCATED_VALUE","normalizedSecretKeys","normalizedKey","isSecretKey","normalized","secret","objectPath","parent","JSON","stringByteLength","value","TextEncoder","sanitizeReportText","maximumLength","sanitizeReportValue","truncatedPaths","Set","redactedPaths","ancestors","WeakSet","remainingBytes","consume","path","text","visit","current","depth","String","shortened","Number","undefined","Date","date","Array","output","itemCount","Math","index","prototype","constructorName","keys","childPath","sanitized","serialized","sanitizeReportError","error","Error","workflowLike"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAA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oBAAoBiC,aAAa,OAAO;YAAE,CAAC;QAC5D;IACF;IAEA,OAAO;QACL,MAAM;QACN,SAASnC,mBAAmBe,OAAOkB;IACrC;AACF"}
|
|
1
|
+
{"version":3,"file":"test-runner/reporting/sanitize.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../src/test-runner/reporting/sanitize.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type {\n TestRunReportError,\n TestRunReportValue,\n} from '../../test-run-report';\n\nconst MAX_DEPTH = 6;\nconst MAX_STRING_LENGTH = 2_000;\nconst MAX_ARRAY_ITEMS = 50;\nconst MAX_OBJECT_KEYS = 50;\nconst MAX_SERIALIZED_BYTES = 64 * 1024;\nconst TRUNCATED_VALUE = '[Truncated: display value exceeded 64 KiB]';\n\nconst normalizedSecretKeys = [\n 'password',\n 'passwd',\n 'secret',\n 'token',\n 'authorization',\n 'cookie',\n 'apikey',\n];\n\nconst normalizedKey = (key: string): string =>\n key.toLowerCase().replace(/[^a-z0-9]/g, '');\n\nexport const isReportSecretKey = (key: string): boolean => {\n const normalized = normalizedKey(key);\n return normalizedSecretKeys.some((secret) => normalized.includes(secret));\n};\n\nconst objectPath = (parent: string, key: string): string =>\n /^[A-Za-z_$][\\w$]*$/.test(key)\n ? `${parent}.${key}`\n : `${parent}[${JSON.stringify(key)}]`;\n\nconst stringByteLength = (value: string): number =>\n new TextEncoder().encode(value).byteLength;\n\nexport function sanitizeReportText(\n value: string,\n maximumLength = MAX_STRING_LENGTH,\n): string {\n return value.length <= maximumLength\n ? value\n : `${value.slice(0, maximumLength)}… [truncated]`;\n}\n\n/** Convert arbitrary Node input/output to a bounded, JSON-safe display value. */\nexport function sanitizeReportValue(value: unknown): TestRunReportValue {\n const truncatedPaths = new Set<string>();\n const redactedPaths = new Set<string>();\n const ancestors = new WeakSet<object>();\n let remainingBytes = MAX_SERIALIZED_BYTES;\n\n const consume = (path: string, text: string): boolean => {\n remainingBytes -= stringByteLength(text);\n if (remainingBytes >= 0) return true;\n truncatedPaths.add(path);\n return false;\n };\n\n const visit = (current: unknown, path: string, depth: number): unknown => {\n if (remainingBytes <= 0) {\n truncatedPaths.add(path);\n return '[Truncated: size limit]';\n }\n if (current === null || typeof current === 'boolean') {\n consume(path, String(current));\n return current;\n }\n if (typeof current === 'string') {\n if (current.length > MAX_STRING_LENGTH) {\n truncatedPaths.add(path);\n const shortened = `${current.slice(0, MAX_STRING_LENGTH)}… [truncated]`;\n consume(path, shortened);\n return shortened;\n }\n consume(path, current);\n return current;\n }\n if (typeof current === 'number') {\n if (Number.isFinite(current)) {\n consume(path, String(current));\n return current;\n }\n truncatedPaths.add(path);\n return `[Unsupported number: ${String(current)}]`;\n }\n if (typeof current === 'bigint') {\n truncatedPaths.add(path);\n return `[Unsupported bigint: ${String(current)}]`;\n }\n if (\n current === undefined ||\n typeof current === 'function' ||\n typeof current === 'symbol'\n ) {\n truncatedPaths.add(path);\n return `[Unsupported ${typeof current}]`;\n }\n if (depth >= MAX_DEPTH) {\n truncatedPaths.add(path);\n return '[Truncated: maximum depth]';\n }\n\n if (current instanceof Date) {\n const date = Number.isNaN(current.getTime())\n ? '[Invalid Date]'\n : current.toISOString();\n consume(path, date);\n return date;\n }\n if (ancestors.has(current)) {\n truncatedPaths.add(path);\n return '[Unsupported circular value]';\n }\n\n if (Array.isArray(current)) {\n ancestors.add(current);\n const output: unknown[] = [];\n const itemCount = Math.min(current.length, MAX_ARRAY_ITEMS);\n for (let index = 0; index < itemCount; index += 1) {\n if (remainingBytes <= 0) break;\n output.push(visit(current[index], `${path}[${index}]`, depth + 1));\n }\n if (current.length > output.length) truncatedPaths.add(path);\n ancestors.delete(current);\n return output;\n }\n\n const prototype = Object.getPrototypeOf(current);\n if (prototype !== Object.prototype && prototype !== null) {\n truncatedPaths.add(path);\n const constructorName =\n (current as { constructor?: { name?: string } }).constructor?.name ??\n 'object';\n return `[Unsupported object: ${constructorName}]`;\n }\n\n ancestors.add(current);\n const output: Record<string, unknown> = {};\n const keys = Object.keys(current as Record<string, unknown>);\n for (const key of keys.slice(0, MAX_OBJECT_KEYS)) {\n const childPath = objectPath(path, key);\n if (!consume(childPath, key)) break;\n if (isReportSecretKey(key)) {\n output[key] = '[REDACTED]';\n redactedPaths.add(childPath);\n } else {\n output[key] = visit(\n (current as Record<string, unknown>)[key],\n childPath,\n depth + 1,\n );\n }\n if (remainingBytes <= 0) break;\n }\n if (keys.length > Object.keys(output).length) truncatedPaths.add(path);\n ancestors.delete(current);\n return output;\n };\n\n const sanitized = visit(value, '$', 0);\n const serialized = JSON.stringify(sanitized);\n if (\n serialized === undefined ||\n stringByteLength(serialized) > MAX_SERIALIZED_BYTES\n ) {\n return { value: TRUNCATED_VALUE, truncatedPaths: ['$'] };\n }\n\n return {\n value: sanitized,\n ...(truncatedPaths.size > 0 ? { truncatedPaths: [...truncatedPaths] } : {}),\n ...(redactedPaths.size > 0 ? { redactedPaths: [...redactedPaths] } : {}),\n };\n}\n\nexport function sanitizeReportError(error: unknown): TestRunReportError {\n const messageText = (value: string) =>\n sanitizeReportText(\n value\n .replace(/\\bBearer\\s+[A-Za-z0-9._~+/=-]+/gi, 'Bearer [REDACTED]')\n .replace(/(https?:\\/\\/)[^\\s/@]+:[^\\s/@]+@/gi, '$1[REDACTED]@')\n .replace(\n /([\"']?\\b(?:password|passwd|secret|token|authorization|cookie|api[_-]?key)\\b[\"']?\\s*[:=]\\s*)(?:\\[REDACTED\\]|\"[^\"]*\"|'[^']*'|[^\\s,;}\\]]+)/gi,\n '$1[REDACTED]',\n ),\n );\n const ancestors = new WeakSet<object>();\n let remainingBytes = MAX_SERIALIZED_BYTES - 1024;\n let nodes = 0;\n const shortened = (): TestRunReportError => ({\n format: 'midscene-error',\n name: 'Error',\n message: '[Truncated: error cause chain]',\n truncated: true,\n });\n const visit = (current: unknown, depth: number): TestRunReportError => {\n if (depth >= MAX_DEPTH || nodes++ >= 25 || remainingBytes < 4096)\n return shortened();\n if (typeof current !== 'object' || current === null)\n return {\n format: 'midscene-error',\n name: 'Error',\n message: messageText(String(current)),\n };\n if (ancestors.has(current)) return shortened();\n ancestors.add(current);\n const source = current as {\n format?: unknown;\n truncated?: unknown;\n name?: unknown;\n message?: unknown;\n code?: unknown;\n details?: unknown;\n cause?: unknown;\n errors?: unknown;\n };\n const result: TestRunReportError = {\n format: 'midscene-error',\n ...(source.truncated === true ? { truncated: true } : {}),\n name:\n typeof source.name === 'string'\n ? sanitizeReportText(source.name, 200)\n : 'Error',\n message: messageText(\n typeof source.message === 'string' ? source.message : String(current),\n ),\n ...(typeof source.code === 'string'\n ? { code: sanitizeReportText(source.code, 200) }\n : {}),\n };\n remainingBytes -= stringByteLength(JSON.stringify(result)) + 128;\n if (source.details !== undefined) {\n // Current encoded errors may cross JSON/worker boundaries more than\n // once. An explicit format marker keeps detail values from nesting.\n const encodedDetails =\n source.format === 'midscene-error' &&\n typeof source.details === 'object' &&\n source.details !== null &&\n 'value' in source.details\n ? (source.details as TestRunReportValue)\n : undefined;\n const details = sanitizeReportValue(\n encodedDetails ? encodedDetails.value : source.details,\n );\n for (const field of ['redactedPaths', 'truncatedPaths'] as const) {\n const paths = encodedDetails?.[field];\n if (Array.isArray(paths))\n details[field] = [\n ...new Set([\n ...(details[field] ?? []),\n ...paths\n .filter((path): path is string => typeof path === 'string')\n .slice(0, 50)\n .map((path) => sanitizeReportText(path)),\n ]),\n ];\n }\n const bytes = stringByteLength(JSON.stringify(details));\n if (bytes < remainingBytes - 4096) {\n result.details = details;\n remainingBytes -= bytes;\n } else {\n result.details = {\n value: '[Truncated: error details size limit]',\n truncatedPaths: ['$'],\n };\n result.truncated = true;\n }\n }\n if (source.cause !== undefined)\n result.cause = visit(source.cause, depth + 1);\n if (Array.isArray(source.errors)) {\n result.errors = [];\n for (const item of source.errors.slice(0, 10)) {\n if (nodes >= 25 || remainingBytes < 4096) {\n result.truncated = true;\n break;\n }\n result.errors.push(visit(item, depth + 1));\n }\n if (result.errors.length < source.errors.length) result.truncated = true;\n }\n ancestors.delete(current);\n return result;\n };\n const result = visit(error, 0);\n if (stringByteLength(JSON.stringify(result)) <= MAX_SERIALIZED_BYTES)\n return result;\n return {\n format: 'midscene-error',\n name: result.name,\n message: result.message,\n ...(result.code ? { code: result.code } : {}),\n truncated: true,\n cause: {\n format: 'midscene-error',\n name: 'Error',\n message: '[Truncated: serialized error exceeded 64 KiB]',\n truncated: true,\n },\n };\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","MAX_DEPTH","MAX_STRING_LENGTH","MAX_ARRAY_ITEMS","MAX_OBJECT_KEYS","MAX_SERIALIZED_BYTES","TRUNCATED_VALUE","normalizedSecretKeys","normalizedKey","isReportSecretKey","normalized","secret","objectPath","parent","JSON","stringByteLength","value","TextEncoder","sanitizeReportText","maximumLength","sanitizeReportValue","truncatedPaths","Set","redactedPaths","ancestors","WeakSet","remainingBytes","consume","path","text","visit","current","depth","String","shortened","Number","undefined","Date","date","Array","output","itemCount","Math","index","prototype","constructorName","keys","childPath","sanitized","serialized","sanitizeReportError","error","messageText","nodes","source","result","encodedDetails","details","field","paths","bytes","item"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAA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;AACF"}
|
|
@@ -0,0 +1,90 @@
|
|
|
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 ('undefined' != 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
|
+
buildTestRunReportPlan: ()=>buildTestRunReportPlan
|
|
28
|
+
});
|
|
29
|
+
const external_sanitize_js_namespaceObject = require("./sanitize.js");
|
|
30
|
+
function buildTestRunReportPlan(document, options = {}) {
|
|
31
|
+
const selected = new Set(options.selectedCaseIds ?? document.cases.map((c)=>c.caseId));
|
|
32
|
+
const steps = (items, phase, owner)=>items.map((step, stepIndex)=>{
|
|
33
|
+
const input = step.templateInput ?? step.input;
|
|
34
|
+
const candidate = input.prompt ?? input.script ?? input.scenario ?? input.title;
|
|
35
|
+
const title = 'string' == typeof candidate ? candidate : candidate && 'object' == typeof candidate && 'prompt' in candidate && 'string' == typeof candidate.prompt ? candidate.prompt : void 0;
|
|
36
|
+
return {
|
|
37
|
+
id: `${document.documentId}:${owner}:${phase}:${stepIndex}`,
|
|
38
|
+
phase,
|
|
39
|
+
stepIndex,
|
|
40
|
+
node: step.node,
|
|
41
|
+
...title ? {
|
|
42
|
+
title: (0, external_sanitize_js_namespaceObject.sanitizeReportText)(title, 240)
|
|
43
|
+
} : {},
|
|
44
|
+
input: (0, external_sanitize_js_namespaceObject.sanitizeReportValue)(input),
|
|
45
|
+
inputMode: step.templateInput ? 'template' : 'resolved',
|
|
46
|
+
...(step.meta.timeoutMs ?? options.defaultTimeoutMs) === void 0 ? {} : {
|
|
47
|
+
timeoutMs: step.meta.timeoutMs ?? options.defaultTimeoutMs
|
|
48
|
+
},
|
|
49
|
+
continueOnError: step.meta.continueOnError
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
const cases = document.cases.map((item)=>({
|
|
53
|
+
caseId: item.caseId,
|
|
54
|
+
name: item.definition.name,
|
|
55
|
+
caseIndex: item.caseIndex,
|
|
56
|
+
selected: selected.has(item.caseId),
|
|
57
|
+
tags: [
|
|
58
|
+
...item.definition.tags ?? []
|
|
59
|
+
],
|
|
60
|
+
...item.definition.onFailure ? {
|
|
61
|
+
onFailure: item.definition.onFailure
|
|
62
|
+
} : {},
|
|
63
|
+
beforeEach: steps(document.lifecycle.beforeEach, 'beforeEach', item.caseId),
|
|
64
|
+
steps: steps(item.definition.steps, 'steps', item.caseId),
|
|
65
|
+
afterEach: steps(document.lifecycle.afterEach, 'afterEach', item.caseId)
|
|
66
|
+
}));
|
|
67
|
+
return {
|
|
68
|
+
documentId: document.documentId,
|
|
69
|
+
sourcePath: document.sourcePath,
|
|
70
|
+
...document.sourceYaml ? {
|
|
71
|
+
sourceYaml: structuredClone(document.sourceYaml)
|
|
72
|
+
} : {},
|
|
73
|
+
retry: options.retry ?? {
|
|
74
|
+
scope: 'case',
|
|
75
|
+
count: 0
|
|
76
|
+
},
|
|
77
|
+
beforeAll: steps(document.lifecycle.beforeAll, 'beforeAll', 'document'),
|
|
78
|
+
cases,
|
|
79
|
+
afterAll: steps(document.lifecycle.afterAll, 'afterAll', 'document')
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
exports.buildTestRunReportPlan = __webpack_exports__.buildTestRunReportPlan;
|
|
83
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
84
|
+
"buildTestRunReportPlan"
|
|
85
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
86
|
+
Object.defineProperty(exports, '__esModule', {
|
|
87
|
+
value: true
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=test-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-runner/reporting/test-plan.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../src/test-runner/reporting/test-plan.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type {\n TestRunReportCasePlan,\n TestRunReportDocumentPlan,\n TestRunReportPlannedStep,\n TestRunReportStepPhase,\n} from '../../test-run-report';\nimport type {\n CollectedWorkflowDocument,\n NormalizedStep,\n} from '../parser/types';\nimport { sanitizeReportText, sanitizeReportValue } from './sanitize';\n\nexport function buildTestRunReportPlan(\n document: CollectedWorkflowDocument,\n options: {\n selectedCaseIds?: readonly string[];\n defaultTimeoutMs?: number;\n retry?: TestRunReportDocumentPlan['retry'];\n } = {},\n): TestRunReportDocumentPlan {\n const selected = new Set(\n options.selectedCaseIds ?? document.cases.map((c) => c.caseId),\n );\n const steps = (\n items: readonly NormalizedStep[],\n phase: TestRunReportStepPhase,\n owner: string,\n ): TestRunReportPlannedStep[] =>\n items.map((step, stepIndex) => {\n const input = step.templateInput ?? step.input;\n const candidate =\n input.prompt ?? input.script ?? input.scenario ?? input.title;\n const title =\n typeof candidate === 'string'\n ? candidate\n : candidate &&\n typeof candidate === 'object' &&\n 'prompt' in candidate &&\n typeof candidate.prompt === 'string'\n ? candidate.prompt\n : undefined;\n return {\n id: `${document.documentId}:${owner}:${phase}:${stepIndex}`,\n phase,\n stepIndex,\n node: step.node,\n ...(title ? { title: sanitizeReportText(title, 240) } : {}),\n input: sanitizeReportValue(input),\n inputMode: step.templateInput ? 'template' : 'resolved',\n ...((step.meta.timeoutMs ?? options.defaultTimeoutMs) === undefined\n ? {}\n : { timeoutMs: step.meta.timeoutMs ?? options.defaultTimeoutMs }),\n continueOnError: step.meta.continueOnError,\n };\n });\n const cases: TestRunReportCasePlan[] = document.cases.map((item) => ({\n caseId: item.caseId,\n name: item.definition.name,\n caseIndex: item.caseIndex,\n selected: selected.has(item.caseId),\n tags: [...(item.definition.tags ?? [])],\n ...(item.definition.onFailure\n ? { onFailure: item.definition.onFailure }\n : {}),\n beforeEach: steps(document.lifecycle.beforeEach, 'beforeEach', item.caseId),\n steps: steps(item.definition.steps, 'steps', item.caseId),\n afterEach: steps(document.lifecycle.afterEach, 'afterEach', item.caseId),\n }));\n return {\n documentId: document.documentId,\n sourcePath: document.sourcePath,\n ...(document.sourceYaml\n ? { sourceYaml: structuredClone(document.sourceYaml) }\n : {}),\n retry: options.retry ?? { scope: 'case', count: 0 },\n beforeAll: steps(document.lifecycle.beforeAll, 'beforeAll', 'document'),\n cases,\n afterAll: steps(document.lifecycle.afterAll, 'afterAll', 'document'),\n };\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","buildTestRunReportPlan","document","options","selected","Set","c","steps","items","phase","owner","step","stepIndex","input","candidate","title","undefined","sanitizeReportText","sanitizeReportValue","cases","item","structuredClone"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;ACMO,SAASI,uBACdC,QAAmC,EACnCC,UAII,CAAC,CAAC;IAEN,MAAMC,WAAW,IAAIC,IACnBF,QAAQ,eAAe,IAAID,SAAS,KAAK,CAAC,GAAG,CAAC,CAACI,IAAMA,EAAE,MAAM;IAE/D,MAAMC,QAAQ,CACZC,OACAC,OACAC,QAEAF,MAAM,GAAG,CAAC,CAACG,MAAMC;YACf,MAAMC,QAAQF,KAAK,aAAa,IAAIA,KAAK,KAAK;YAC9C,MAAMG,YACJD,MAAM,MAAM,IAAIA,MAAM,MAAM,IAAIA,MAAM,QAAQ,IAAIA,MAAM,KAAK;YAC/D,MAAME,QACJ,AAAqB,YAArB,OAAOD,YACHA,YACAA,aACE,AAAqB,YAArB,OAAOA,aACP,YAAYA,aACZ,AAA4B,YAA5B,OAAOA,UAAU,MAAM,GACvBA,UAAU,MAAM,GAChBE;YACR,OAAO;gBACL,IAAI,GAAGd,SAAS,UA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