@midscene/core 1.16.0 → 1.16.1
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/agent-options.mjs +36 -0
- package/dist/es/agent/agent-options.mjs.map +1 -0
- package/dist/es/agent/agent-report-manager.mjs +323 -0
- package/dist/es/agent/agent-report-manager.mjs.map +1 -0
- package/dist/es/agent/agent.mjs +112 -228
- package/dist/es/agent/agent.mjs.map +1 -1
- package/dist/es/agent/cache-config.mjs +21 -1
- package/dist/es/agent/cache-config.mjs.map +1 -1
- package/dist/es/agent/tasks.mjs +3 -1
- package/dist/es/agent/tasks.mjs.map +1 -1
- package/dist/es/agent/utils.mjs +1 -1
- package/dist/es/report-generator.mjs +73 -33
- package/dist/es/report-generator.mjs.map +1 -1
- package/dist/es/report-html-template.mjs +1 -1
- package/dist/es/test-runner/engine/document-runtime.mjs +30 -24
- package/dist/es/test-runner/engine/document-runtime.mjs.map +1 -1
- package/dist/es/test-runner/engine/project-runtime.mjs +17 -11
- package/dist/es/test-runner/engine/project-runtime.mjs.map +1 -1
- package/dist/es/test-runner/engine/resource-operations.mjs +33 -8
- package/dist/es/test-runner/engine/resource-operations.mjs.map +1 -1
- package/dist/es/test-runner/engine/run-collected-case.mjs +1 -0
- package/dist/es/test-runner/engine/run-collected-case.mjs.map +1 -1
- package/dist/es/test-runner/engine/run-workflow-document.mjs +3 -0
- package/dist/es/test-runner/engine/run-workflow-document.mjs.map +1 -1
- package/dist/es/test-runner/engine/setup-timeout.mjs +37 -0
- package/dist/es/test-runner/engine/setup-timeout.mjs.map +1 -0
- package/dist/es/utils.mjs +1 -1
- package/dist/es/yaml/execution-session.mjs +2 -1
- package/dist/es/yaml/execution-session.mjs.map +1 -1
- package/dist/es/yaml/legacy-yaml-report.mjs +1 -1
- package/dist/es/yaml/legacy-yaml-report.mjs.map +1 -1
- package/dist/es/yaml/player.mjs +17 -3
- package/dist/es/yaml/player.mjs.map +1 -1
- package/dist/lib/agent/agent-options.js +73 -0
- package/dist/lib/agent/agent-options.js.map +1 -0
- package/dist/lib/agent/agent-report-manager.js +357 -0
- package/dist/lib/agent/agent-report-manager.js.map +1 -0
- package/dist/lib/agent/agent.js +110 -226
- package/dist/lib/agent/agent.js.map +1 -1
- package/dist/lib/agent/cache-config.js +23 -0
- package/dist/lib/agent/cache-config.js.map +1 -1
- package/dist/lib/agent/tasks.js +3 -1
- package/dist/lib/agent/tasks.js.map +1 -1
- package/dist/lib/agent/utils.js +1 -1
- package/dist/lib/report-generator.js +73 -33
- package/dist/lib/report-generator.js.map +1 -1
- package/dist/lib/report-html-template.js +1 -1
- package/dist/lib/test-runner/engine/document-runtime.js +30 -24
- package/dist/lib/test-runner/engine/document-runtime.js.map +1 -1
- package/dist/lib/test-runner/engine/project-runtime.js +17 -11
- package/dist/lib/test-runner/engine/project-runtime.js.map +1 -1
- package/dist/lib/test-runner/engine/resource-operations.js +36 -8
- package/dist/lib/test-runner/engine/resource-operations.js.map +1 -1
- package/dist/lib/test-runner/engine/run-collected-case.js +1 -0
- package/dist/lib/test-runner/engine/run-collected-case.js.map +1 -1
- package/dist/lib/test-runner/engine/run-workflow-document.js +3 -0
- package/dist/lib/test-runner/engine/run-workflow-document.js.map +1 -1
- package/dist/lib/test-runner/engine/setup-timeout.js +71 -0
- package/dist/lib/test-runner/engine/setup-timeout.js.map +1 -0
- package/dist/lib/utils.js +1 -1
- package/dist/lib/yaml/execution-session.js +4 -0
- package/dist/lib/yaml/execution-session.js.map +1 -1
- package/dist/lib/yaml/legacy-yaml-report.js +1 -1
- package/dist/lib/yaml/legacy-yaml-report.js.map +1 -1
- package/dist/lib/yaml/player.js +16 -2
- package/dist/lib/yaml/player.js.map +1 -1
- package/dist/types/agent/agent-options.d.ts +4 -0
- package/dist/types/agent/agent-options.d.ts.map +1 -0
- package/dist/types/agent/agent-report-manager.d.ts +92 -0
- package/dist/types/agent/agent-report-manager.d.ts.map +1 -0
- package/dist/types/agent/agent.d.ts +31 -24
- package/dist/types/agent/agent.d.ts.map +1 -1
- package/dist/types/agent/cache-config.d.ts +10 -0
- package/dist/types/agent/cache-config.d.ts.map +1 -1
- package/dist/types/agent/tasks.d.ts +1 -0
- package/dist/types/agent/tasks.d.ts.map +1 -1
- package/dist/types/report-generator.d.ts +5 -1
- package/dist/types/report-generator.d.ts.map +1 -1
- package/dist/types/test-runner/engine/document-runtime.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 +5 -0
- package/dist/types/test-runner/engine/resource-operations.d.ts.map +1 -1
- 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/setup-timeout.d.ts +3 -0
- package/dist/types/test-runner/engine/setup-timeout.d.ts.map +1 -0
- package/dist/types/test-runner/engine/types.d.ts +7 -0
- package/dist/types/test-runner/engine/types.d.ts.map +1 -1
- package/dist/types/test-runner/project.d.ts +22 -0
- package/dist/types/test-runner/project.d.ts.map +1 -1
- package/dist/types/yaml/execution-session.d.ts +2 -0
- package/dist/types/yaml/execution-session.d.ts.map +1 -1
- package/dist/types/yaml/player.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml/legacy-yaml-report.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../src/yaml/legacy-yaml-report.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 { basename } from 'node:path';\nimport type { Agent } from '@/agent/agent';\nimport type { MidsceneYamlScript } from '@/types';\nimport { ifInBrowser, ifInWorker } from '@midscene/shared/utils';\nimport { ReportGenerator } from '../report-generator';\nimport type { WorkflowExecutionRecord } from '../test-runner';\nimport { executionRecordsToReportInput } from '../test-runner/reporting/execution-record';\nimport { getVersion } from '../utils';\nimport { isYamlReportEnabled } from './report-policy';\n\ninterface PublishLegacyYamlReportOptions {\n agent: Agent | null;\n record: WorkflowExecutionRecord;\n runId: string;\n script: MidsceneYamlScript;\n scriptPath?: string;\n fallbackReportFileName?: string;\n}\n\nexport interface PublishedLegacyYamlReport {\n record: WorkflowExecutionRecord;\n reportFile?: string | null;\n}\n\n/** Report publication is a host projection, not a ScriptPlayer state concern. */\nexport async function publishLegacyYamlReport(\n options: PublishLegacyYamlReportOptions,\n): Promise<PublishedLegacyYamlReport> {\n const { agent, runId } = options;\n let record = options.record;\n if (agent) {\n const reportFile =\n (await agent._writeYamlExecutionReport?.(record)) ?? agent.reportFile;\n const source = await agent._createReportSource?.(runId);\n if (source) record = Object.freeze({ ...record, reportSources: [source] });\n return { record, reportFile };\n }\n if (ifInBrowser || ifInWorker || !isYamlReportEnabled(options.script))\n return { record };\n\n const generator = ReportGenerator.create(\n options.fallbackReportFileName ??\n options.script.agent?.reportFileName ??\n options.script.agent?.testId ??\n (options.scriptPath\n ? basename(options.scriptPath).replace(/\\.ya?ml$/i, '')\n : `script-${runId}`),\n options.script.agent ?? {},\n );\n const reportFile = await generator.writeRunnerReport?.(\n executionRecordsToReportInput([record], { runId }),\n runId,\n {\n groupName: 'YAML execution',\n sdkVersion: getVersion(),\n modelBriefs: [],\n },\n );\n
|
|
1
|
+
{"version":3,"file":"yaml/legacy-yaml-report.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../src/yaml/legacy-yaml-report.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 { basename } from 'node:path';\nimport type { Agent } from '@/agent/agent';\nimport type { MidsceneYamlScript } from '@/types';\nimport { ifInBrowser, ifInWorker } from '@midscene/shared/utils';\nimport { ReportGenerator } from '../report-generator';\nimport type { WorkflowExecutionRecord } from '../test-runner';\nimport { executionRecordsToReportInput } from '../test-runner/reporting/execution-record';\nimport { getVersion } from '../utils';\nimport { isYamlReportEnabled } from './report-policy';\n\ninterface PublishLegacyYamlReportOptions {\n agent: Agent | null;\n record: WorkflowExecutionRecord;\n runId: string;\n script: MidsceneYamlScript;\n scriptPath?: string;\n fallbackReportFileName?: string;\n}\n\nexport interface PublishedLegacyYamlReport {\n record: WorkflowExecutionRecord;\n reportFile?: string | null;\n}\n\n/** Report publication is a host projection, not a ScriptPlayer state concern. */\nexport async function publishLegacyYamlReport(\n options: PublishLegacyYamlReportOptions,\n): Promise<PublishedLegacyYamlReport> {\n const { agent, runId } = options;\n let record = options.record;\n if (agent) {\n const reportFile =\n (await agent._writeYamlExecutionReport?.(record)) ?? agent.reportFile;\n const source = await agent._createReportSource?.(runId);\n if (source) record = Object.freeze({ ...record, reportSources: [source] });\n return { record, reportFile };\n }\n if (ifInBrowser || ifInWorker || !isYamlReportEnabled(options.script))\n return { record };\n\n const generator = ReportGenerator.create(\n options.fallbackReportFileName ??\n options.script.agent?.reportFileName ??\n options.script.agent?.testId ??\n (options.scriptPath\n ? basename(options.scriptPath).replace(/\\.ya?ml$/i, '')\n : `script-${runId}`),\n options.script.agent ?? {},\n );\n const reportFile = await generator.writeRunnerReport?.(\n executionRecordsToReportInput([record], { runId }),\n runId,\n {\n groupName: 'YAML execution',\n sdkVersion: getVersion(),\n modelBriefs: [],\n },\n );\n const source = await generator.createSourceSnapshot?.(runId);\n await generator.finalize();\n if (source) record = Object.freeze({ ...record, reportSources: [source] });\n return { record, reportFile };\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","publishLegacyYamlReport","options","agent","runId","record","reportFile","source","ifInBrowser","ifInWorker","isYamlReportEnabled","generator","ReportGenerator","basename","executionRecordsToReportInput","getVersion"],"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;;;;;;;;;;;;;ACmBO,eAAeI,wBACpBC,OAAuC;IAEvC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGF;IACzB,IAAIG,SAASH,QAAQ,MAAM;IAC3B,IAAIC,OAAO;QACT,MAAMG,aACH,MAAMH,MAAM,yBAAyB,GAAGE,WAAYF,MAAM,UAAU;QACvE,MAAMI,SAAS,MAAMJ,MAAM,mBAAmB,GAAGC;QACjD,IAAIG,QAAQF,SAASR,OAAO,MAAM,CAAC;YAAE,GAAGQ,MAAM;YAAE,eAAe;gBAACE;aAAO;QAAC;QACxE,OAAO;YAAEF;YAAQC;QAAW;IAC9B;IACA,IAAIE,sBAAAA,WAAWA,IAAIC,sBAAAA,UAAUA,IAAI,CAACC,AAAAA,IAAAA,0CAAAA,mBAAAA,AAAAA,EAAoBR,QAAQ,MAAM,GAClE,OAAO;QAAEG;IAAO;IAElB,MAAMM,YAAYC,6CAAAA,eAAAA,CAAAA,MAAsB,CACtCV,QAAQ,sBAAsB,IAC5BA,QAAQ,MAAM,CAAC,KAAK,EAAE,kBACtBA,QAAQ,MAAM,CAAC,KAAK,EAAE,UACrBA,CAAAA,QAAQ,UAAU,GACfW,AAAAA,IAAAA,mCAAAA,QAAAA,AAAAA,EAASX,QAAQ,UAAU,EAAE,OAAO,CAAC,aAAa,MAClD,CAAC,OAAO,EAAEE,OAAM,GACtBF,QAAQ,MAAM,CAAC,KAAK,IAAI,CAAC;IAE3B,MAAMI,aAAa,MAAMK,UAAU,iBAAiB,GAClDG,AAAAA,IAAAA,oCAAAA,6BAAAA,AAAAA,EAA8B;QAACT;KAAO,EAAE;QAAED;IAAM,IAChDA,OACA;QACE,WAAW;QACX,YAAYW,AAAAA,IAAAA,kCAAAA,UAAAA,AAAAA;QACZ,aAAa,EAAE;IACjB;IAEF,MAAMR,SAAS,MAAMI,UAAU,oBAAoB,GAAGP;IACtD,MAAMO,UAAU,QAAQ;IACxB,IAAIJ,QAAQF,SAASR,OAAO,MAAM,CAAC;QAAE,GAAGQ,MAAM;QAAE,eAAe;YAACE;SAAO;IAAC;IACxE,OAAO;QAAEF;QAAQC;IAAW;AAC9B"}
|
package/dist/lib/yaml/player.js
CHANGED
|
@@ -169,11 +169,11 @@ class ScriptPlayer {
|
|
|
169
169
|
try {
|
|
170
170
|
const { agent: newAgent, freeFn: newFreeFn } = await this.setupAgent(platform);
|
|
171
171
|
agent = newAgent;
|
|
172
|
-
|
|
172
|
+
session = (0, external_execution_session_js_namespaceObject.enterYamlExecution)(agent);
|
|
173
173
|
freeFn = [
|
|
174
174
|
...newFreeFn || []
|
|
175
175
|
];
|
|
176
|
-
|
|
176
|
+
agent._prepareForTestRunner?.();
|
|
177
177
|
signal = this.abortSignal ?? (0, external_execution_session_js_namespaceObject.currentYamlSignal)(agent);
|
|
178
178
|
signal?.throwIfAborted();
|
|
179
179
|
this.actionSpace = await agent.getActionSpace();
|
|
@@ -295,6 +295,20 @@ class ScriptPlayer {
|
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
297
|
session?.finish(state.executionRecord);
|
|
298
|
+
if (agent?.destroyed && !(0, external_execution_session_js_namespaceObject.hasActiveYamlExecution)(agent)) try {
|
|
299
|
+
await agent.finalizeReport();
|
|
300
|
+
} catch (error) {
|
|
301
|
+
reportError = reportError ? new AggregateError([
|
|
302
|
+
reportError,
|
|
303
|
+
error
|
|
304
|
+
], 'YAML report publication failed') : error;
|
|
305
|
+
this.setPlayerStatus('error', reportError);
|
|
306
|
+
state.executionRecord = Object.freeze({
|
|
307
|
+
...state.executionRecord,
|
|
308
|
+
status: 'failed',
|
|
309
|
+
reportError
|
|
310
|
+
});
|
|
311
|
+
}
|
|
298
312
|
if (reportError) {
|
|
299
313
|
const errors = [
|
|
300
314
|
setupError,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml/player.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../src/yaml/player.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 { mkdir, writeFile } from 'node:fs/promises';\nimport { basename, dirname, join, resolve } from 'node:path';\nimport { isActionReadinessError } from '@/agent/action-readiness';\nimport type { Agent } from '@/agent/agent';\nimport type {\n DeviceAction,\n FreeFn,\n MidsceneYamlScript,\n MidsceneYamlScriptEnv,\n ScriptPlayerStatusValue,\n ScriptPlayerTaskStatus,\n} from '@/types';\nimport { getMidsceneRunSubDir } from '@midscene/shared/common';\nimport { getDebug } from '@midscene/shared/logger';\nimport { assert, ifInBrowser, ifInWorker, uuid } from '@midscene/shared/utils';\nimport type { WorkflowDocumentExecutionResult } from '../test-runner';\nimport {\n WorkflowExecutionFailure,\n WorkflowPublicationError,\n} from '../test-runner/engine/execution-failure';\nimport { cleanupResources } from '../test-runner/engine/resource-operations';\nimport { runFreeFnCleanup } from './cleanup';\nimport {\n YamlExecutionOwnershipError,\n currentYamlSignal,\n enterYamlExecution,\n runInYamlExecutionContext,\n} from './execution-session';\nimport { createLegacyYamlExecutionRecord } from './legacy-yaml-execution-record';\nimport { publishLegacyYamlReport } from './legacy-yaml-report';\nimport {\n createLegacyYamlRuntime,\n legacyYamlOutcomeError,\n} from './legacy-yaml-runtime';\nimport {\n getLegacyYamlPlayerState,\n initializeLegacyYamlPlayerState,\n} from './player-state';\nimport { collectLegacyYamlDocument } from './test-runner-compat';\nimport { resolveWebTarget, resolveYamlOutputConfig } from './utils';\n\nconst debug = getDebug('yaml-player');\n\n/**\n * Compatibility facade for the legacy YAML API.\n *\n * Execution is delegated to the shared Runner kernel through\n * createLegacyYamlRuntime(). This class keeps the mutable status, result,\n * progress, output, and setup/cleanup behavior exposed by the old API.\n */\nexport class ScriptPlayer<T extends MidsceneYamlScriptEnv> {\n public currentTaskIndex?: number;\n public taskStatusList: ScriptPlayerTaskStatus[] = [];\n public status: ScriptPlayerStatusValue = 'init';\n public reportFile?: string | null;\n public result: Record<string, any>;\n private unnamedResultIndex = 0;\n private publicationErrors: WorkflowPublicationError[] = [];\n public output?: string | null;\n public unstableLogContent?: string | null;\n public errorInSetup?: Error;\n private interfaceAgent: Agent | null = null;\n public agentStatusTip?: string;\n public target?: MidsceneYamlScriptEnv;\n private actionSpace: DeviceAction[] = [];\n private scriptPath?: string;\n\n constructor(\n private script: MidsceneYamlScript,\n private setupAgent: (platform: T) => Promise<{\n agent: Agent;\n freeFn: FreeFn[];\n }>,\n public onTaskStatusChange?: (taskStatus: ScriptPlayerTaskStatus) => void,\n scriptPath?: string,\n private readonly abortSignal?: AbortSignal,\n ) {\n this.scriptPath = scriptPath;\n // Collection validates syntax but defers old task/Step errors until execution.\n collectLegacyYamlDocument(script, scriptPath);\n initializeLegacyYamlPlayerState(this);\n this.result = {};\n\n this.target =\n resolveWebTarget(script)?.target ||\n script.android ||\n script.ios ||\n script.harmony ||\n script.computer ||\n script.config;\n const outputConfig = resolveYamlOutputConfig(script);\n\n if (ifInBrowser || ifInWorker) {\n this.output = undefined;\n debug('output is undefined in browser or worker');\n } else if (outputConfig.output) {\n this.output = resolve(process.cwd(), outputConfig.output);\n debug('setting output by config.output', this.output);\n } else {\n const scriptName = this.scriptPath\n ? basename(this.scriptPath, '.yaml').replace(/\\.(ya?ml)$/i, '')\n : 'script';\n this.output = join(\n getMidsceneRunSubDir('output'),\n `${scriptName}-${uuid()}.json`,\n );\n debug('setting output by script path', this.output);\n }\n\n if (ifInBrowser || ifInWorker) {\n this.unstableLogContent = undefined;\n } else if (typeof outputConfig.unstableLogContent === 'string') {\n this.unstableLogContent = resolve(\n process.cwd(),\n outputConfig.unstableLogContent,\n );\n } else if (outputConfig.unstableLogContent === true) {\n this.unstableLogContent = join(\n getMidsceneRunSubDir('output'),\n 'unstableLogContent.json',\n );\n }\n\n this.taskStatusList = (script.tasks || []).map((task, taskIndex) => ({\n ...task,\n index: taskIndex,\n status: 'init',\n totalSteps: task.flow?.length || 0,\n }));\n }\n\n private setResult(key: string | undefined, value: any) {\n const keyToUse = key || this.unnamedResultIndex++;\n if (this.result[keyToUse]) {\n getDebug('yaml-player', { console: true })(\n `result key ${keyToUse} already exists, will overwrite`,\n );\n }\n this.result[keyToUse] = value;\n\n return this.flushResult();\n }\n\n private setPlayerStatus(status: ScriptPlayerStatusValue, error?: Error) {\n this.status = status;\n this.errorInSetup = error;\n }\n\n private notifyCurrentTaskStatusChange(taskIndex?: number) {\n const taskIndexToNotify =\n typeof taskIndex === 'number' ? taskIndex : this.currentTaskIndex;\n\n if (typeof taskIndexToNotify !== 'number') return;\n\n const taskStatus = this.taskStatusList[taskIndexToNotify];\n this.onTaskStatusChange?.(taskStatus);\n }\n\n private async setTaskStatus(\n index: number,\n statusValue: ScriptPlayerStatusValue,\n error?: Error,\n ) {\n this.taskStatusList[index].status = statusValue;\n if (error) this.taskStatusList[index].error = error;\n this.notifyCurrentTaskStatusChange(index);\n }\n\n private setTaskIndex(taskIndex: number) {\n this.currentTaskIndex = taskIndex;\n }\n\n private async flushResult() {\n if (this.output) {\n const output = resolve(process.cwd(), this.output);\n await this.publish(output, async () => {\n const outputDir = dirname(output);\n await mkdir(outputDir, { recursive: true });\n await writeFile(\n output,\n JSON.stringify(this.result || {}, undefined, 2),\n );\n });\n }\n }\n\n private async flushUnstableLogContent() {\n if (this.unstableLogContent) {\n const content = this.interfaceAgent?._unstableLogContent();\n const filePath = resolve(process.cwd(), this.unstableLogContent);\n await this.publish(filePath, async () => {\n const outputDir = dirname(filePath);\n await mkdir(outputDir, { recursive: true });\n await writeFile(filePath, JSON.stringify(content, null, 2));\n });\n }\n }\n\n private async publish(path: string, write: () => Promise<void>) {\n try {\n await write();\n } catch (cause) {\n const error = new WorkflowPublicationError('write-result', path, cause);\n this.publicationErrors.push(error);\n throw error;\n }\n }\n\n private createRuntime(agent: Agent) {\n return createLegacyYamlRuntime({\n agent,\n actionSpace: this.actionSpace,\n sourcePath: this.scriptPath,\n setResult: (key, value) => this.setResult(key, value),\n });\n }\n\n async playTask(taskStatus: ScriptPlayerTaskStatus, agent: Agent) {\n const { flow } = taskStatus;\n assert(flow, 'missing flow in task');\n const statusIndex = this.taskStatusList.indexOf(taskStatus);\n const declaredIndex = (\n taskStatus as ScriptPlayerTaskStatus & {\n index?: unknown;\n }\n ).index;\n const taskIndex =\n statusIndex >= 0\n ? statusIndex\n : typeof declaredIndex === 'number' && Number.isInteger(declaredIndex)\n ? declaredIndex\n : 0;\n\n const state = getLegacyYamlPlayerState(this);\n state.executionResult = await this.createRuntime(agent).runTask(\n taskStatus,\n taskIndex,\n {\n signal: this.abortSignal ?? currentYamlSignal(agent),\n onStepStart: (info) => {\n if (info.scope === 'case' && info.case.phase === 'steps') {\n taskStatus.currentStep = info.case.stepIndex;\n }\n },\n },\n );\n\n const outcome = state.executionResult.cases[0];\n if (!outcome || outcome.status === 'not-run') {\n throw new Error(`Task \"${taskStatus.name}\" did not run.`);\n }\n if (outcome.status === 'failed') throw legacyYamlOutcomeError(outcome);\n\n this.reportFile = agent.reportFile;\n await this.flushUnstableLogContent();\n }\n\n async run() {\n return runInYamlExecutionContext(() => this.runInContext());\n }\n\n private async runInContext() {\n const startedAt = new Date();\n const runId = uuid();\n const state = getLegacyYamlPlayerState(this);\n state.executionResult = undefined;\n state.executionRecord = undefined;\n this.publicationErrors = [];\n const { android, ios, harmony, computer } = this.script;\n const webEnv = resolveWebTarget(this.script)?.target;\n const androidEnv = android;\n const iosEnv = ios;\n const harmonyEnv = harmony;\n const computerEnv = computer;\n const platform =\n webEnv || androidEnv || iosEnv || harmonyEnv || computerEnv;\n\n this.setPlayerStatus('running');\n\n let agent: Agent | null = null;\n let freeFn: FreeFn[] = [];\n let setupError: unknown;\n let executionError: unknown;\n let cleanupError: unknown;\n let signal: AbortSignal | undefined;\n let session: ReturnType<typeof enterYamlExecution> | undefined;\n try {\n const { agent: newAgent, freeFn: newFreeFn } = await this.setupAgent(\n platform as T,\n );\n // Register ownership immediately: discovering actions can fail too.\n agent = newAgent;\n agent._prepareForTestRunner?.();\n freeFn = [...(newFreeFn || [])];\n session = enterYamlExecution(agent);\n signal = this.abortSignal ?? currentYamlSignal(agent);\n signal?.throwIfAborted();\n this.actionSpace = await agent.getActionSpace();\n const originalOnTaskStartTip = agent.onTaskStartTip;\n agent.onTaskStartTip = (tip) => {\n if (this.status === 'running') this.agentStatusTip = tip;\n originalOnTaskStartTip?.(tip);\n };\n freeFn.push({\n name: 'restore-agent-onTaskStartTip',\n fn: () => {\n if (agent) agent.onTaskStartTip = originalOnTaskStartTip;\n },\n });\n } catch (error) {\n // A rejected borrower must not close or publish into another run's Agent.\n if (error instanceof YamlExecutionOwnershipError) throw error;\n setupError = error;\n this.setPlayerStatus('error', error as Error);\n }\n this.interfaceAgent = agent;\n\n const document = collectLegacyYamlDocument(\n this.script,\n this.scriptPath ?? '<inline-yaml>',\n this.actionSpace,\n );\n const runtime =\n agent && !setupError ? this.createRuntime(agent) : undefined;\n try {\n if (runtime && agent) {\n state.executionResult = await runtime.runScript(this.script, {\n document,\n signal,\n createDocumentRunId: () => runId,\n onCaseStart: (collectedCase) => {\n const taskIndex = collectedCase.caseIndex;\n this.setTaskIndex(taskIndex);\n return this.setTaskStatus(taskIndex, 'running');\n },\n onStepStart: (info) => {\n if (info.scope !== 'case' || info.case.phase !== 'steps') return;\n const taskStatus = this.taskStatusList[info.case.caseIndex];\n if (taskStatus) taskStatus.currentStep = info.case.stepIndex;\n },\n onCaseOutcome: async (outcome) => {\n if (outcome.status === 'not-run') return;\n const taskIndex = outcome.caseIndex;\n const taskStatus = this.taskStatusList[taskIndex];\n assert(taskStatus, `missing YAML task at index ${taskIndex}`);\n\n this.reportFile = agent?.reportFile;\n if (outcome.status === 'success') {\n await this.setTaskStatus(taskIndex, 'done');\n await this.flushUnstableLogContent();\n return;\n }\n\n const error = legacyYamlOutcomeError(outcome);\n await this.setTaskStatus(taskIndex, 'error', error);\n },\n });\n const stoppedOnFailure = state.executionResult.cases.some(\n (outcome) =>\n outcome.status === 'failed' &&\n (!this.taskStatusList[outcome.caseIndex]?.continueOnError ||\n isActionReadinessError(legacyYamlOutcomeError(outcome))),\n );\n this.setPlayerStatus(\n stoppedOnFailure || signal?.aborted ? 'error' : 'done',\n );\n }\n } catch (error) {\n executionError = error;\n if (error instanceof WorkflowExecutionFailure)\n state.executionResult = error.result as WorkflowDocumentExecutionResult;\n this.setPlayerStatus('error', error as Error);\n }\n\n this.reportFile = agent?.reportFile;\n this.agentStatusTip = '';\n\n try {\n // A timeout settles the Runner before an uncooperative device action.\n // Never dispose its Agent while that action is still using it.\n if (session?.isRoot && agent) {\n await cleanupResources([agent], () => runFreeFnCleanup(freeFn), {\n owner: this,\n signal,\n onDeferredError: (error) =>\n getDebug('yaml-player', { console: true })(\n `Deferred YAML cleanup failed: ${String(error)}`,\n ),\n });\n } else await runFreeFnCleanup(freeFn);\n } catch (error) {\n cleanupError = error;\n this.setPlayerStatus(\n 'error',\n (setupError ?? executionError ?? error) as Error,\n );\n }\n\n const endedAt = new Date();\n const cleanupErrors =\n cleanupError instanceof AggregateError\n ? cleanupError.errors\n : cleanupError === undefined\n ? []\n : [cleanupError];\n state.executionRecord = createLegacyYamlExecutionRecord({\n runId,\n attemptIndex: 0,\n script: this.script,\n document,\n startedAt,\n endedAt,\n execution: state.executionResult,\n setupError,\n executionError,\n cleanupErrors,\n aborted: signal?.aborted ?? false,\n publicationErrors: this.publicationErrors,\n outputs: this.result,\n reportFile: agent?.reportFile,\n children: session?.children,\n });\n let reportError: unknown;\n if (!session || session.isRoot) {\n try {\n const published = await publishLegacyYamlReport({\n agent,\n record: state.executionRecord,\n runId,\n script: this.script,\n scriptPath: this.scriptPath,\n fallbackReportFileName: state.fallbackReportFileName,\n });\n this.reportFile = published.reportFile;\n state.executionRecord = published.record;\n } catch (error) {\n reportError = error;\n this.setPlayerStatus(\n 'error',\n (setupError ?? executionError ?? cleanupError ?? error) as Error,\n );\n state.executionRecord = Object.freeze({\n ...state.executionRecord,\n status: 'failed',\n reportError: error,\n });\n }\n }\n session?.finish(state.executionRecord);\n if (reportError) {\n const errors = [\n setupError,\n executionError,\n ...cleanupErrors,\n reportError,\n ].filter((error) => error !== undefined);\n throw errors.length === 1\n ? reportError\n : new AggregateError(\n errors,\n 'YAML execution/report finalization failed',\n );\n }\n if (executionError && cleanupError) {\n throw new AggregateError(\n [executionError, ...cleanupErrors],\n 'YAML execution and cleanup failed',\n );\n }\n if (executionError) throw executionError;\n if (cleanupError) throw cleanupError;\n }\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","debug","getDebug","ScriptPlayer","value","keyToUse","status","error","taskIndex","taskIndexToNotify","taskStatus","index","statusValue","output","resolve","process","outputDir","dirname","mkdir","writeFile","JSON","undefined","content","filePath","path","write","cause","WorkflowPublicationError","agent","createLegacyYamlRuntime","flow","assert","statusIndex","declaredIndex","Number","state","getLegacyYamlPlayerState","currentYamlSignal","info","outcome","Error","legacyYamlOutcomeError","runInYamlExecutionContext","startedAt","Date","runId","uuid","android","ios","harmony","computer","webEnv","resolveWebTarget","androidEnv","iosEnv","harmonyEnv","computerEnv","platform","freeFn","setupError","executionError","cleanupError","signal","session","newAgent","newFreeFn","enterYamlExecution","originalOnTaskStartTip","tip","YamlExecutionOwnershipError","document","collectLegacyYamlDocument","runtime","collectedCase","stoppedOnFailure","isActionReadinessError","WorkflowExecutionFailure","cleanupResources","runFreeFnCleanup","String","endedAt","cleanupErrors","AggregateError","createLegacyYamlExecutionRecord","reportError","published","publishLegacyYamlReport","errors","script","setupAgent","onTaskStatusChange","scriptPath","abortSignal","initializeLegacyYamlPlayerState","outputConfig","resolveYamlOutputConfig","ifInBrowser","ifInWorker","scriptName","basename","join","getMidsceneRunSubDir","task"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oB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BC,AAAAA,IAAAA,mCAAAA,QAAAA,AAAAA,EAAS,IAAI,CAAC,UAAU,EAAE,SAAS,OAAO,CAAC,eAAe,MAC1D;YACJ,IAAI,CAAC,MAAM,GAAGC,AAAAA,IAAAA,mCAAAA,IAAAA,AAAAA,EACZC,AAAAA,IAAAA,uBAAAA,oBAAAA,AAAAA,EAAqB,WACrB,GAAGH,WAAW,CAAC,EAAEpD,AAAAA,IAAAA,sBAAAA,IAAAA,AAAAA,IAAO,KAAK,CAAC;YAEhC7C,MAAM,iCAAiC,IAAI,CAAC,MAAM;QACpD;QAEA,IAAI+F,sBAAAA,WAAWA,IAAIC,sBAAAA,UAAUA,EAC3B,IAAI,CAAC,kBAAkB,GAAG5E;aACrB,IAAI,AAA2C,YAA3C,OAAOyE,aAAa,kBAAkB,EAC/C,IAAI,CAAC,kBAAkB,GAAGhF,AAAAA,IAAAA,mCAAAA,OAAAA,AAAAA,EACxBC,QAAQ,GAAG,IACX+E,aAAa,kBAAkB;aAE5B,IAAIA,AAAoC,SAApCA,aAAa,kBAAkB,EACxC,IAAI,CAAC,kBAAkB,GAAGM,AAAAA,IAAAA,mCAAAA,IAAAA,AAAAA,EACxBC,AAAAA,IAAAA,uBAAAA,oBAAAA,AAAAA,EAAqB,WACrB;QAIJ,IAAI,CAAC,cAAc,GAAIb,AAAAA,CAAAA,OAAO,KAAK,IAAI,EAAC,EAAG,GAAG,CAAC,CAACc,MAAM9F,YAAe;gBACnE,GAAG8F,IAAI;gBACP,OAAO9F;gBACP,QAAQ;gBACR,YAAY8F,KAAK,IAAI,EAAE,UAAU;YACnC;IACF;AAuVF"}
|
|
1
|
+
{"version":3,"file":"yaml/player.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../src/yaml/player.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 { mkdir, writeFile } from 'node:fs/promises';\nimport { basename, dirname, join, resolve } from 'node:path';\nimport { isActionReadinessError } from '@/agent/action-readiness';\nimport type { Agent } from '@/agent/agent';\nimport type {\n DeviceAction,\n FreeFn,\n MidsceneYamlScript,\n MidsceneYamlScriptEnv,\n ScriptPlayerStatusValue,\n ScriptPlayerTaskStatus,\n} from '@/types';\nimport { getMidsceneRunSubDir } from '@midscene/shared/common';\nimport { getDebug } from '@midscene/shared/logger';\nimport { assert, ifInBrowser, ifInWorker, uuid } from '@midscene/shared/utils';\nimport type { WorkflowDocumentExecutionResult } from '../test-runner';\nimport {\n WorkflowExecutionFailure,\n WorkflowPublicationError,\n} from '../test-runner/engine/execution-failure';\nimport { cleanupResources } from '../test-runner/engine/resource-operations';\nimport { runFreeFnCleanup } from './cleanup';\nimport {\n YamlExecutionOwnershipError,\n currentYamlSignal,\n enterYamlExecution,\n hasActiveYamlExecution,\n runInYamlExecutionContext,\n} from './execution-session';\nimport { createLegacyYamlExecutionRecord } from './legacy-yaml-execution-record';\nimport { publishLegacyYamlReport } from './legacy-yaml-report';\nimport {\n createLegacyYamlRuntime,\n legacyYamlOutcomeError,\n} from './legacy-yaml-runtime';\nimport {\n getLegacyYamlPlayerState,\n initializeLegacyYamlPlayerState,\n} from './player-state';\nimport { collectLegacyYamlDocument } from './test-runner-compat';\nimport { resolveWebTarget, resolveYamlOutputConfig } from './utils';\n\nconst debug = getDebug('yaml-player');\n\n/**\n * Compatibility facade for the legacy YAML API.\n *\n * Execution is delegated to the shared Runner kernel through\n * createLegacyYamlRuntime(). This class keeps the mutable status, result,\n * progress, output, and setup/cleanup behavior exposed by the old API.\n */\nexport class ScriptPlayer<T extends MidsceneYamlScriptEnv> {\n public currentTaskIndex?: number;\n public taskStatusList: ScriptPlayerTaskStatus[] = [];\n public status: ScriptPlayerStatusValue = 'init';\n public reportFile?: string | null;\n public result: Record<string, any>;\n private unnamedResultIndex = 0;\n private publicationErrors: WorkflowPublicationError[] = [];\n public output?: string | null;\n public unstableLogContent?: string | null;\n public errorInSetup?: Error;\n private interfaceAgent: Agent | null = null;\n public agentStatusTip?: string;\n public target?: MidsceneYamlScriptEnv;\n private actionSpace: DeviceAction[] = [];\n private scriptPath?: string;\n\n constructor(\n private script: MidsceneYamlScript,\n private setupAgent: (platform: T) => Promise<{\n agent: Agent;\n freeFn: FreeFn[];\n }>,\n public onTaskStatusChange?: (taskStatus: ScriptPlayerTaskStatus) => void,\n scriptPath?: string,\n private readonly abortSignal?: AbortSignal,\n ) {\n this.scriptPath = scriptPath;\n // Collection validates syntax but defers old task/Step errors until execution.\n collectLegacyYamlDocument(script, scriptPath);\n initializeLegacyYamlPlayerState(this);\n this.result = {};\n\n this.target =\n resolveWebTarget(script)?.target ||\n script.android ||\n script.ios ||\n script.harmony ||\n script.computer ||\n script.config;\n const outputConfig = resolveYamlOutputConfig(script);\n\n if (ifInBrowser || ifInWorker) {\n this.output = undefined;\n debug('output is undefined in browser or worker');\n } else if (outputConfig.output) {\n this.output = resolve(process.cwd(), outputConfig.output);\n debug('setting output by config.output', this.output);\n } else {\n const scriptName = this.scriptPath\n ? basename(this.scriptPath, '.yaml').replace(/\\.(ya?ml)$/i, '')\n : 'script';\n this.output = join(\n getMidsceneRunSubDir('output'),\n `${scriptName}-${uuid()}.json`,\n );\n debug('setting output by script path', this.output);\n }\n\n if (ifInBrowser || ifInWorker) {\n this.unstableLogContent = undefined;\n } else if (typeof outputConfig.unstableLogContent === 'string') {\n this.unstableLogContent = resolve(\n process.cwd(),\n outputConfig.unstableLogContent,\n );\n } else if (outputConfig.unstableLogContent === true) {\n this.unstableLogContent = join(\n getMidsceneRunSubDir('output'),\n 'unstableLogContent.json',\n );\n }\n\n this.taskStatusList = (script.tasks || []).map((task, taskIndex) => ({\n ...task,\n index: taskIndex,\n status: 'init',\n totalSteps: task.flow?.length || 0,\n }));\n }\n\n private setResult(key: string | undefined, value: any) {\n const keyToUse = key || this.unnamedResultIndex++;\n if (this.result[keyToUse]) {\n getDebug('yaml-player', { console: true })(\n `result key ${keyToUse} already exists, will overwrite`,\n );\n }\n this.result[keyToUse] = value;\n\n return this.flushResult();\n }\n\n private setPlayerStatus(status: ScriptPlayerStatusValue, error?: Error) {\n this.status = status;\n this.errorInSetup = error;\n }\n\n private notifyCurrentTaskStatusChange(taskIndex?: number) {\n const taskIndexToNotify =\n typeof taskIndex === 'number' ? taskIndex : this.currentTaskIndex;\n\n if (typeof taskIndexToNotify !== 'number') return;\n\n const taskStatus = this.taskStatusList[taskIndexToNotify];\n this.onTaskStatusChange?.(taskStatus);\n }\n\n private async setTaskStatus(\n index: number,\n statusValue: ScriptPlayerStatusValue,\n error?: Error,\n ) {\n this.taskStatusList[index].status = statusValue;\n if (error) this.taskStatusList[index].error = error;\n this.notifyCurrentTaskStatusChange(index);\n }\n\n private setTaskIndex(taskIndex: number) {\n this.currentTaskIndex = taskIndex;\n }\n\n private async flushResult() {\n if (this.output) {\n const output = resolve(process.cwd(), this.output);\n await this.publish(output, async () => {\n const outputDir = dirname(output);\n await mkdir(outputDir, { recursive: true });\n await writeFile(\n output,\n JSON.stringify(this.result || {}, undefined, 2),\n );\n });\n }\n }\n\n private async flushUnstableLogContent() {\n if (this.unstableLogContent) {\n const content = this.interfaceAgent?._unstableLogContent();\n const filePath = resolve(process.cwd(), this.unstableLogContent);\n await this.publish(filePath, async () => {\n const outputDir = dirname(filePath);\n await mkdir(outputDir, { recursive: true });\n await writeFile(filePath, JSON.stringify(content, null, 2));\n });\n }\n }\n\n private async publish(path: string, write: () => Promise<void>) {\n try {\n await write();\n } catch (cause) {\n const error = new WorkflowPublicationError('write-result', path, cause);\n this.publicationErrors.push(error);\n throw error;\n }\n }\n\n private createRuntime(agent: Agent) {\n return createLegacyYamlRuntime({\n agent,\n actionSpace: this.actionSpace,\n sourcePath: this.scriptPath,\n setResult: (key, value) => this.setResult(key, value),\n });\n }\n\n async playTask(taskStatus: ScriptPlayerTaskStatus, agent: Agent) {\n const { flow } = taskStatus;\n assert(flow, 'missing flow in task');\n const statusIndex = this.taskStatusList.indexOf(taskStatus);\n const declaredIndex = (\n taskStatus as ScriptPlayerTaskStatus & {\n index?: unknown;\n }\n ).index;\n const taskIndex =\n statusIndex >= 0\n ? statusIndex\n : typeof declaredIndex === 'number' && Number.isInteger(declaredIndex)\n ? declaredIndex\n : 0;\n\n const state = getLegacyYamlPlayerState(this);\n state.executionResult = await this.createRuntime(agent).runTask(\n taskStatus,\n taskIndex,\n {\n signal: this.abortSignal ?? currentYamlSignal(agent),\n onStepStart: (info) => {\n if (info.scope === 'case' && info.case.phase === 'steps') {\n taskStatus.currentStep = info.case.stepIndex;\n }\n },\n },\n );\n\n const outcome = state.executionResult.cases[0];\n if (!outcome || outcome.status === 'not-run') {\n throw new Error(`Task \"${taskStatus.name}\" did not run.`);\n }\n if (outcome.status === 'failed') throw legacyYamlOutcomeError(outcome);\n\n this.reportFile = agent.reportFile;\n await this.flushUnstableLogContent();\n }\n\n async run() {\n return runInYamlExecutionContext(() => this.runInContext());\n }\n\n private async runInContext() {\n const startedAt = new Date();\n const runId = uuid();\n const state = getLegacyYamlPlayerState(this);\n state.executionResult = undefined;\n state.executionRecord = undefined;\n this.publicationErrors = [];\n const { android, ios, harmony, computer } = this.script;\n const webEnv = resolveWebTarget(this.script)?.target;\n const androidEnv = android;\n const iosEnv = ios;\n const harmonyEnv = harmony;\n const computerEnv = computer;\n const platform =\n webEnv || androidEnv || iosEnv || harmonyEnv || computerEnv;\n\n this.setPlayerStatus('running');\n\n let agent: Agent | null = null;\n let freeFn: FreeFn[] = [];\n let setupError: unknown;\n let executionError: unknown;\n let cleanupError: unknown;\n let signal: AbortSignal | undefined;\n let session: ReturnType<typeof enterYamlExecution> | undefined;\n try {\n const { agent: newAgent, freeFn: newFreeFn } = await this.setupAgent(\n platform as T,\n );\n // Register ownership immediately: discovering actions can fail too.\n agent = newAgent;\n session = enterYamlExecution(agent);\n freeFn = [...(newFreeFn || [])];\n agent._prepareForTestRunner?.();\n signal = this.abortSignal ?? currentYamlSignal(agent);\n signal?.throwIfAborted();\n this.actionSpace = await agent.getActionSpace();\n const originalOnTaskStartTip = agent.onTaskStartTip;\n agent.onTaskStartTip = (tip) => {\n if (this.status === 'running') this.agentStatusTip = tip;\n originalOnTaskStartTip?.(tip);\n };\n freeFn.push({\n name: 'restore-agent-onTaskStartTip',\n fn: () => {\n if (agent) agent.onTaskStartTip = originalOnTaskStartTip;\n },\n });\n } catch (error) {\n // A rejected borrower must not close or publish into another run's Agent.\n if (error instanceof YamlExecutionOwnershipError) throw error;\n setupError = error;\n this.setPlayerStatus('error', error as Error);\n }\n this.interfaceAgent = agent;\n\n const document = collectLegacyYamlDocument(\n this.script,\n this.scriptPath ?? '<inline-yaml>',\n this.actionSpace,\n );\n const runtime =\n agent && !setupError ? this.createRuntime(agent) : undefined;\n try {\n if (runtime && agent) {\n state.executionResult = await runtime.runScript(this.script, {\n document,\n signal,\n createDocumentRunId: () => runId,\n onCaseStart: (collectedCase) => {\n const taskIndex = collectedCase.caseIndex;\n this.setTaskIndex(taskIndex);\n return this.setTaskStatus(taskIndex, 'running');\n },\n onStepStart: (info) => {\n if (info.scope !== 'case' || info.case.phase !== 'steps') return;\n const taskStatus = this.taskStatusList[info.case.caseIndex];\n if (taskStatus) taskStatus.currentStep = info.case.stepIndex;\n },\n onCaseOutcome: async (outcome) => {\n if (outcome.status === 'not-run') return;\n const taskIndex = outcome.caseIndex;\n const taskStatus = this.taskStatusList[taskIndex];\n assert(taskStatus, `missing YAML task at index ${taskIndex}`);\n\n this.reportFile = agent?.reportFile;\n if (outcome.status === 'success') {\n await this.setTaskStatus(taskIndex, 'done');\n await this.flushUnstableLogContent();\n return;\n }\n\n const error = legacyYamlOutcomeError(outcome);\n await this.setTaskStatus(taskIndex, 'error', error);\n },\n });\n const stoppedOnFailure = state.executionResult.cases.some(\n (outcome) =>\n outcome.status === 'failed' &&\n (!this.taskStatusList[outcome.caseIndex]?.continueOnError ||\n isActionReadinessError(legacyYamlOutcomeError(outcome))),\n );\n this.setPlayerStatus(\n stoppedOnFailure || signal?.aborted ? 'error' : 'done',\n );\n }\n } catch (error) {\n executionError = error;\n if (error instanceof WorkflowExecutionFailure)\n state.executionResult = error.result as WorkflowDocumentExecutionResult;\n this.setPlayerStatus('error', error as Error);\n }\n\n this.reportFile = agent?.reportFile;\n this.agentStatusTip = '';\n\n try {\n // A timeout settles the Runner before an uncooperative device action.\n // Never dispose its Agent while that action is still using it.\n if (session?.isRoot && agent) {\n await cleanupResources([agent], () => runFreeFnCleanup(freeFn), {\n owner: this,\n signal,\n onDeferredError: (error) =>\n getDebug('yaml-player', { console: true })(\n `Deferred YAML cleanup failed: ${String(error)}`,\n ),\n });\n } else await runFreeFnCleanup(freeFn);\n } catch (error) {\n cleanupError = error;\n this.setPlayerStatus(\n 'error',\n (setupError ?? executionError ?? error) as Error,\n );\n }\n\n const endedAt = new Date();\n const cleanupErrors =\n cleanupError instanceof AggregateError\n ? cleanupError.errors\n : cleanupError === undefined\n ? []\n : [cleanupError];\n state.executionRecord = createLegacyYamlExecutionRecord({\n runId,\n attemptIndex: 0,\n script: this.script,\n document,\n startedAt,\n endedAt,\n execution: state.executionResult,\n setupError,\n executionError,\n cleanupErrors,\n aborted: signal?.aborted ?? false,\n publicationErrors: this.publicationErrors,\n outputs: this.result,\n reportFile: agent?.reportFile,\n children: session?.children,\n });\n let reportError: unknown;\n if (!session || session.isRoot) {\n try {\n const published = await publishLegacyYamlReport({\n agent,\n record: state.executionRecord,\n runId,\n script: this.script,\n scriptPath: this.scriptPath,\n fallbackReportFileName: state.fallbackReportFileName,\n });\n this.reportFile = published.reportFile;\n state.executionRecord = published.record;\n } catch (error) {\n reportError = error;\n this.setPlayerStatus(\n 'error',\n (setupError ?? executionError ?? cleanupError ?? error) as Error,\n );\n state.executionRecord = Object.freeze({\n ...state.executionRecord,\n status: 'failed',\n reportError: error,\n });\n }\n }\n session?.finish(state.executionRecord);\n // destroy() defers report finalization while YAML owns the Agent. Publish\n // cleanup outcomes and source snapshots before releasing its executions.\n if (agent?.destroyed && !hasActiveYamlExecution(agent)) {\n try {\n await agent.finalizeReport();\n } catch (error) {\n reportError = reportError\n ? new AggregateError(\n [reportError, error],\n 'YAML report publication failed',\n )\n : error;\n this.setPlayerStatus('error', reportError as Error);\n state.executionRecord = Object.freeze({\n ...state.executionRecord,\n status: 'failed',\n reportError,\n });\n }\n }\n if (reportError) {\n const errors = [\n setupError,\n executionError,\n ...cleanupErrors,\n reportError,\n ].filter((error) => error !== undefined);\n throw errors.length === 1\n ? reportError\n : new AggregateError(\n errors,\n 'YAML execution/report finalization failed',\n );\n }\n if (executionError && cleanupError) {\n throw new AggregateError(\n [executionError, ...cleanupErrors],\n 'YAML execution and cleanup failed',\n );\n }\n if (executionError) throw executionError;\n if (cleanupError) throw cleanupError;\n }\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","debug","getDebug","ScriptPlayer","value","keyToUse","status","error","taskIndex","taskIndexToNotify","taskStatus","index","statusValue","output","resolve","process","outputDir","dirname","mkdir","writeFile","JSON","undefined","content","filePath","path","write","cause","WorkflowPublicationError","agent","createLegacyYamlRuntime","flow","assert","statusIndex","declaredIndex","Number","state","getLegacyYamlPlayerState","currentYamlSignal","info","outcome","Error","legacyYamlOutcomeError","runInYamlExecutionContext","startedAt","Date","runId","uuid","android","ios","harmony","computer","webEnv","resolveWebTarget","androidEnv","iosEnv","harmonyEnv","computerEnv","platform","freeFn","setupError","executionError","cleanupError","signal","session","newAgent","newFreeFn","enterYamlExecution","originalOnTaskStartTip","tip","YamlExecutionOwnershipError","document","collectLegacyYamlDocument","runtime","collectedCase","stoppedOnFailure","isActionReadinessError","WorkflowExecutionFailure","cleanupResources","runFreeFnCleanup","String","endedAt","cleanupErrors","AggregateError","createLegacyYamlExecutionRecord","reportError","published","publishLegacyYamlReport","hasActiveYamlExecution","errors","script","setupAgent","onTaskStatusChange","scriptPath","abortSignal","initializeLegacyYamlPlayerState","outputConfig","resolveYamlOutputConfig","ifInBrowser","ifInWorker","scriptName","basename","join","getMidsceneRunSubDir","task"],"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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACoCA,MAAMI,QAAQC,AAAAA,IAAAA,uBAAAA,QAAAA,AAAAA,EAAS;AAShB,MAAMC;IAiFH,UAAUP,GAAuB,EAAEQ,KAAU,EAAE;QACrD,MAAMC,WAAWT,OAAO,IAAI,CAAC,kBAAkB;QAC/C,IAAI,IAAI,CAAC,MAAM,CAACS,SAAS,EACvBH,AAAAA,IAAAA,uBAAAA,QAAAA,AAAAA,EAAS,eAAe;YAAE,SAAS;QAAK,GACtC,CAAC,WAAW,EAAEG,SAAS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C,kBAAkB,GAAG7E;aACrB,IAAI,AAA2C,YAA3C,OAAO0E,aAAa,kBAAkB,EAC/C,IAAI,CAAC,kBAAkB,GAAGjF,AAAAA,IAAAA,mCAAAA,OAAAA,AAAAA,EACxBC,QAAQ,GAAG,IACXgF,aAAa,kBAAkB;aAE5B,IAAIA,AAAoC,SAApCA,aAAa,kBAAkB,EACxC,IAAI,CAAC,kBAAkB,GAAGM,AAAAA,IAAAA,mCAAAA,IAAAA,AAAAA,EACxBC,AAAAA,IAAAA,uBAAAA,oBAAAA,AAAAA,EAAqB,WACrB;QAIJ,IAAI,CAAC,cAAc,GAAIb,AAAAA,CAAAA,OAAO,KAAK,IAAI,EAAC,EAAG,GAAG,CAAC,CAACc,MAAM/F,YAAe;gBACnE,GAAG+F,IAAI;gBACP,OAAO/F;gBACP,QAAQ;gBACR,YAAY+F,KAAK,IAAI,EAAE,UAAU;YACnC;IACF;AA2WF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-options.d.ts","sourceRoot":"","sources":["../../../src/agent/agent-options.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE1D,wBAAgB,iBAAiB,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAa3D;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAC9B,IAAI,CAoDN"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type IReportGenerator } from '../report-generator';
|
|
2
|
+
import type { TaskRunner } from '../task-runner';
|
|
3
|
+
import type { WorkflowExecutionRecord } from '../test-runner/execution-record';
|
|
4
|
+
import { type AgentOpt, type ExecutionDump, ReportActionDump } from '../types';
|
|
5
|
+
type ReportOptions = Pick<AgentOpt, 'groupName' | 'groupDescription' | 'generateReport' | 'persistExecutionDump' | 'outputFormat' | 'autoPrintReportMsg' | 'reportAttributes' | 'reportFileName' | 'testId'>;
|
|
6
|
+
interface AgentReportContext {
|
|
7
|
+
getOptions(): ReportOptions;
|
|
8
|
+
getDeviceType(): ReportActionDump['deviceType'];
|
|
9
|
+
isDestroyed(): boolean;
|
|
10
|
+
isExternallyBusy(): boolean;
|
|
11
|
+
}
|
|
12
|
+
interface AgentReportState {
|
|
13
|
+
dump: ReportActionDump;
|
|
14
|
+
file?: string | null;
|
|
15
|
+
fileName?: string;
|
|
16
|
+
generator: IReportGenerator;
|
|
17
|
+
finalization?: Promise<string | undefined>;
|
|
18
|
+
lastExecution?: ExecutionDump;
|
|
19
|
+
executionIndexByRunner: WeakMap<TaskRunner, number>;
|
|
20
|
+
yamlScopeId: string;
|
|
21
|
+
yamlRecords: WorkflowExecutionRecord[];
|
|
22
|
+
activeOperations: Set<Promise<unknown>>;
|
|
23
|
+
}
|
|
24
|
+
/** Owns report state and persistence; execution and device ownership stay with Agent. */
|
|
25
|
+
export declare class AgentReportManager {
|
|
26
|
+
private readonly context;
|
|
27
|
+
private reportState;
|
|
28
|
+
private reportReset?;
|
|
29
|
+
private readonly reportByRunner;
|
|
30
|
+
private dumpUpdateListeners;
|
|
31
|
+
constructor(context: AgentReportContext);
|
|
32
|
+
private get opts();
|
|
33
|
+
get dump(): ReportActionDump;
|
|
34
|
+
set dump(value: ReportActionDump);
|
|
35
|
+
get reportFile(): string | null | undefined;
|
|
36
|
+
set reportFile(value: string | null | undefined);
|
|
37
|
+
get reportFileName(): string | undefined;
|
|
38
|
+
set reportFileName(value: string | undefined);
|
|
39
|
+
/** @internal Runner snapshots retain immutable data and shared image files. */
|
|
40
|
+
_prepareForTestRunner(): void;
|
|
41
|
+
_createReportSource(scopeId: string, executionIds?: readonly string[]): Promise<import("../test-runner").WorkflowReportSource | undefined>;
|
|
42
|
+
/** @internal The Agent owns one report stream across root YAML invocations. */
|
|
43
|
+
_writeYamlExecutionReport(record: WorkflowExecutionRecord): Promise<string | undefined>;
|
|
44
|
+
private buildYamlReportInput;
|
|
45
|
+
private createEmptyDump;
|
|
46
|
+
private createReportState;
|
|
47
|
+
private clearDumpInMemory;
|
|
48
|
+
private assertReportIdle;
|
|
49
|
+
assertReportWritable(): AgentReportState;
|
|
50
|
+
withReportOperation<T>(operation: () => Promise<T>): Promise<T>;
|
|
51
|
+
/**
|
|
52
|
+
* Finalize the preceding report and reset execution records for a new report.
|
|
53
|
+
* Historical artifacts are retained; this Agent and its device stay connected.
|
|
54
|
+
* Await this method before executing again. Concurrent resets share one reset.
|
|
55
|
+
*/
|
|
56
|
+
resetDump(): Promise<ReportActionDump>;
|
|
57
|
+
/**
|
|
58
|
+
* Seal the current report and release its in-memory records without
|
|
59
|
+
* disconnecting the device. Export in-memory data before calling this method.
|
|
60
|
+
* Repeated calls return the same result and never rewrite published artifacts.
|
|
61
|
+
*/
|
|
62
|
+
finalizeReport(): Promise<string | undefined>;
|
|
63
|
+
appendExecutionDump(execution: ExecutionDump, runner?: TaskRunner): void;
|
|
64
|
+
dumpDataString(opt?: {
|
|
65
|
+
inlineScreenshots?: boolean;
|
|
66
|
+
}): string;
|
|
67
|
+
reportHTMLString(getDumpString: () => string): string;
|
|
68
|
+
writeOutActionDumps(executionDump?: ExecutionDump): void;
|
|
69
|
+
/** Persist current report data without disposing this Agent or its device. */
|
|
70
|
+
flushReport(): Promise<string | undefined>;
|
|
71
|
+
private getReportMeta;
|
|
72
|
+
get onDumpUpdate(): ((dump: string, executionDump?: ExecutionDump) => void) | undefined;
|
|
73
|
+
set onDumpUpdate(callback: ((dump: string, executionDump?: ExecutionDump) => void) | undefined);
|
|
74
|
+
addDumpUpdateListener(listener: (dump: string, executionDump?: ExecutionDump) => void): () => void;
|
|
75
|
+
/**
|
|
76
|
+
* Remove a dump update listener
|
|
77
|
+
* @param listener The listener function to remove
|
|
78
|
+
*/
|
|
79
|
+
removeDumpUpdateListener(listener: (dump: string, executionDump?: ExecutionDump) => void): void;
|
|
80
|
+
/**
|
|
81
|
+
* Clear all dump update listeners
|
|
82
|
+
*/
|
|
83
|
+
clearDumpUpdateListeners(): void;
|
|
84
|
+
notifyDumpUpdateListeners(executionDump?: ExecutionDump): void;
|
|
85
|
+
bindRunner(runner: TaskRunner): void;
|
|
86
|
+
assertRunnerCurrent(runner: TaskRunner): void;
|
|
87
|
+
flushPendingWrites(): Promise<void>;
|
|
88
|
+
waitForOperations(): Promise<void>;
|
|
89
|
+
waitForReset(): Promise<void>;
|
|
90
|
+
}
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=agent-report-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-report-manager.d.ts","sourceRoot":"","sources":["../../../src/agent/agent-report-manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,gBAAgB,EAAmB,MAAM,qBAAqB,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAG/E,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,gBAAgB,EAEjB,MAAM,UAAU,CAAC;AAMlB,KAAK,aAAa,GAAG,IAAI,CACvB,QAAQ,EACN,WAAW,GACX,kBAAkB,GAClB,gBAAgB,GAChB,sBAAsB,GACtB,cAAc,GACd,oBAAoB,GACpB,kBAAkB,GAClB,gBAAgB,GAChB,QAAQ,CACX,CAAC;AAEF,UAAU,kBAAkB;IAC1B,UAAU,IAAI,aAAa,CAAC;IAC5B,aAAa,IAAI,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAChD,WAAW,IAAI,OAAO,CAAC;IACvB,gBAAgB,IAAI,OAAO,CAAC;CAC7B;AAED,UAAU,gBAAgB;IACxB,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IA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AIhC,yBAAyB,CAAC,aAAa,CAAC,EAAE,aAAa;IAWvD,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAIpC,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAQvC,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAMlC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;CAGpC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TUserPrompt } from '../ai-model/index';
|
|
2
2
|
import Service from '../service/index';
|
|
3
3
|
import type { WorkflowExecutionRecord } from '../test-runner/execution-record';
|
|
4
|
-
import { type ActionParam, type ActionReturn, type AgentAIContextKey, type AgentAssertResult, type AgentOpt, type AgentProgressListener, type AgentWaitForOpt, type AiActEffort, type AssertOptions, type DeepThinkOption, type DeviceAction, ExecutionDump, type InsightAPI, type LocateOption, type LocateResultElement, type OnTaskStartTip, type QueryOptions, type RecordToReportOptions, type Rect, ReportActionDump, type ScrollParam, type ServiceAction, type ServiceExtractParam, type UIContext } from '../types';
|
|
4
|
+
import { type ActionParam, type ActionReturn, type AgentAIContextKey, type AgentAssertResult, type AgentOpt, type AgentProgressListener, type AgentWaitForOpt, type AiActEffort, type AssertOptions, type DeepThinkOption, type DeviceAction, ExecutionDump, type InsightAPI, type LocateOption, type LocateResultElement, type OnTaskStartTip, type QueryOptions, type RecordToReportOptions, type Rect, type ReportActionDump, type ScrollParam, type ServiceAction, type ServiceExtractParam, type UIContext } from '../types';
|
|
5
5
|
import type { AbstractInterface, InputStrategy } from '../device';
|
|
6
6
|
import type { TaskRunner } from '../task-runner';
|
|
7
7
|
import { ModelConfigManager } from '@midscene/shared/env';
|
|
@@ -41,17 +41,18 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
|
|
|
41
41
|
static getTestRunnerNodeDefinitions(): readonly AgentTestRunnerNodeDefinition[];
|
|
42
42
|
interface: InterfaceType;
|
|
43
43
|
service: Service;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
private reportManager;
|
|
45
|
+
get dump(): ReportActionDump;
|
|
46
|
+
set dump(value: ReportActionDump);
|
|
47
|
+
get reportFile(): string | null | undefined;
|
|
48
|
+
set reportFile(value: string | null | undefined);
|
|
49
|
+
get reportFileName(): string | undefined;
|
|
50
|
+
set reportFileName(value: string | undefined);
|
|
49
51
|
/** @internal Runner snapshots retain immutable data and shared image files. */
|
|
50
52
|
_prepareForTestRunner(): void;
|
|
51
53
|
_createReportSource(scopeId: string, executionIds?: readonly string[]): Promise<import("../test-runner").WorkflowReportSource | undefined>;
|
|
52
54
|
/** @internal The Agent owns one report stream across root YAML invocations. */
|
|
53
55
|
_writeYamlExecutionReport(record: WorkflowExecutionRecord): Promise<string | undefined>;
|
|
54
|
-
private buildYamlReportInput;
|
|
55
56
|
taskExecutor: TaskExecutor;
|
|
56
57
|
opts: AgentOpt;
|
|
57
58
|
/**
|
|
@@ -63,7 +64,6 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
|
|
|
63
64
|
private readonly metricsCollector;
|
|
64
65
|
private usageCallCounter;
|
|
65
66
|
private readonly countedUsageKeys;
|
|
66
|
-
private dumpUpdateListeners;
|
|
67
67
|
private readonly progressBus;
|
|
68
68
|
get onDumpUpdate(): ((dump: string, executionDump?: ExecutionDump) => void) | undefined;
|
|
69
69
|
set onDumpUpdate(callback: ((dump: string, executionDump?: ExecutionDump) => void) | undefined);
|
|
@@ -84,11 +84,9 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
|
|
|
84
84
|
private get aiContexts();
|
|
85
85
|
private resolveUserContext;
|
|
86
86
|
private withContext;
|
|
87
|
-
private executionDumpIndexByRunner;
|
|
88
87
|
private fullActionSpace;
|
|
89
88
|
private activeFileChooserAccepter?;
|
|
90
89
|
private activeFileChooserAllowedDir?;
|
|
91
|
-
private reportGenerator;
|
|
92
90
|
get page(): InterfaceType;
|
|
93
91
|
/**
|
|
94
92
|
* Fails fast for non-web interfaces when the model family is missing.
|
|
@@ -160,7 +158,20 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
|
|
|
160
158
|
* `default`.
|
|
161
159
|
*/
|
|
162
160
|
setAIContext(target: AgentAIContextKey, context: string | undefined): void;
|
|
163
|
-
|
|
161
|
+
private assertReportWritable;
|
|
162
|
+
private withReportOperation;
|
|
163
|
+
/**
|
|
164
|
+
* Finalize the preceding report and reset execution records for a new report.
|
|
165
|
+
* Historical artifacts are retained; this Agent and its device stay connected.
|
|
166
|
+
* Await this method before executing again. Concurrent resets share one reset.
|
|
167
|
+
*/
|
|
168
|
+
resetDump(): Promise<ReportActionDump>;
|
|
169
|
+
/**
|
|
170
|
+
* Seal the current report and release its in-memory records without
|
|
171
|
+
* disconnecting the device. Export in-memory data before calling this method.
|
|
172
|
+
* Repeated calls return the same result and never rewrite published artifacts.
|
|
173
|
+
*/
|
|
174
|
+
finalizeReport(): Promise<string | undefined>;
|
|
164
175
|
appendExecutionDump(execution: ExecutionDump, runner?: TaskRunner): void;
|
|
165
176
|
/**
|
|
166
177
|
* Fold any not-yet-counted task usage from an execution dump into the
|
|
@@ -179,15 +190,14 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
|
|
|
179
190
|
reportHTMLString(opt?: {
|
|
180
191
|
inlineScreenshots?: boolean;
|
|
181
192
|
}): string;
|
|
182
|
-
private lastExecutionDump?;
|
|
183
193
|
writeOutActionDumps(executionDump?: ExecutionDump): void;
|
|
184
194
|
/** Persist current report data without disposing this Agent or its device. */
|
|
185
195
|
flushReport(): Promise<string | undefined>;
|
|
186
|
-
private getReportMeta;
|
|
187
196
|
private callbackOnTaskStartTip;
|
|
188
197
|
wrapActionInActionSpace<T extends DeviceAction>(name: string): (param: ActionParam<T>) => Promise<ActionReturn<T>>;
|
|
189
198
|
callActionInActionSpace<T = any>(type: string, opt?: T, // and all other action params
|
|
190
199
|
abortSignal?: AbortSignal): Promise<any>;
|
|
200
|
+
private executeActionInActionSpace;
|
|
191
201
|
aiTap(locatePrompt: TUserPrompt, opt?: LocateOption & {
|
|
192
202
|
fileChooserAccept?: string | string[];
|
|
193
203
|
}): Promise<void>;
|
|
@@ -223,7 +233,9 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
|
|
|
223
233
|
}): Promise<void>;
|
|
224
234
|
aiClearInput(locatePrompt: TUserPrompt, opt?: LocateOption): Promise<void>;
|
|
225
235
|
aiAct(taskPrompt: TUserPrompt, opt?: AiActOptions): Promise<string | undefined>;
|
|
236
|
+
private executeAiAct;
|
|
226
237
|
runMarkdown(markdownPath: string, opt?: AiActOptions): Promise<string | undefined>;
|
|
238
|
+
private executeMarkdown;
|
|
227
239
|
runGherkinScenario(scenarioText: string, opt?: RunGherkinScenarioOptions): Promise<void>;
|
|
228
240
|
/**
|
|
229
241
|
* @deprecated Use {@link Agent.aiAct} instead.
|
|
@@ -242,6 +254,7 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
|
|
|
242
254
|
aiLocate(prompt: TUserPrompt, opt?: LocateOption): Promise<Pick<LocateResultElement, "center" | "dpr"> & {
|
|
243
255
|
rect: Rect;
|
|
244
256
|
}>;
|
|
257
|
+
private executeLocate;
|
|
245
258
|
aiAssert(assertion: TUserPrompt, msg?: string, opt?: AssertOptions): Promise<AgentAssertResult | undefined>;
|
|
246
259
|
aiWaitFor(assertion: TUserPrompt, opt?: AgentWaitForOpt): Promise<void>;
|
|
247
260
|
ai(...args: Parameters<typeof this.aiAct>): Promise<string | undefined>;
|
|
@@ -250,6 +263,7 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
|
|
|
250
263
|
}): Promise<{
|
|
251
264
|
result: Record<string, any>;
|
|
252
265
|
}>;
|
|
266
|
+
private executeYaml;
|
|
253
267
|
evaluateJavaScript(script: string): Promise<any>;
|
|
254
268
|
/**
|
|
255
269
|
* Add a dump update listener
|
|
@@ -257,14 +271,9 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
|
|
|
257
271
|
* @returns A remove function that can be called to remove this listener
|
|
258
272
|
*/
|
|
259
273
|
addDumpUpdateListener(listener: (dump: string, executionDump?: ExecutionDump) => void): () => void;
|
|
260
|
-
/**
|
|
261
|
-
* Remove a dump update listener
|
|
262
|
-
* @param listener The listener function to remove
|
|
263
|
-
*/
|
|
274
|
+
/** Remove a dump update listener. */
|
|
264
275
|
removeDumpUpdateListener(listener: (dump: string, executionDump?: ExecutionDump) => void): void;
|
|
265
|
-
/**
|
|
266
|
-
* Clear all dump update listeners
|
|
267
|
-
*/
|
|
276
|
+
/** Clear all dump update listeners. */
|
|
268
277
|
clearDumpUpdateListeners(): void;
|
|
269
278
|
/**
|
|
270
279
|
* Subscribe to the generic agent progress bus. The listener receives every
|
|
@@ -296,12 +305,14 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
|
|
|
296
305
|
abortSignal?: AbortSignal;
|
|
297
306
|
}): Promise<void>;
|
|
298
307
|
recordToReport(title?: string, opt?: RecordToReportOptions): Promise<void>;
|
|
308
|
+
private writeRecordToReport;
|
|
299
309
|
recordErrorToReport(title: string, opt: {
|
|
300
310
|
/** Any thrown value; normalized before it is stored in the report. */
|
|
301
311
|
error: unknown;
|
|
302
312
|
content?: string;
|
|
303
313
|
screenshotBase64?: string;
|
|
304
314
|
}): Promise<void>;
|
|
315
|
+
private writeErrorToReport;
|
|
305
316
|
/**
|
|
306
317
|
* @deprecated Use {@link Agent.recordToReport} instead.
|
|
307
318
|
*/
|
|
@@ -322,10 +333,6 @@ export declare class Agent<InterfaceType extends AbstractInterface = AbstractInt
|
|
|
322
333
|
* Unfreezes the page context, allowing AI operations to calculate context dynamically
|
|
323
334
|
*/
|
|
324
335
|
unfreezePageContext(): Promise<void>;
|
|
325
|
-
/**
|
|
326
|
-
* Process cache configuration and return normalized cache settings
|
|
327
|
-
*/
|
|
328
|
-
private processCacheConfig;
|
|
329
336
|
private normalizeFileInput;
|
|
330
337
|
/**
|
|
331
338
|
* Manually flush cache to file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/agent/agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/agent/agent.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,OAAO,MAAM,kBAAkB,CAAC;AAKvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAI/E,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAEtB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,WAAW,EAEhB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,aAAa,EAIb,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EAEnB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAE1B,KAAK,IAAI,EACT,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EAExB,KAAK,SAAS,EACf,MAAM,UAAU,CAAC;AAoBlB,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAOhD,OAAO,EAIL,kBAAkB,EAInB,MAAM,sBAAsB,CAAC;AAa9B,OAAO,EAAoB,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAIxE,OAAO,EACL,KAAK,yBAAyB,EAE/B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAE,MAAM,cAA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,CAAC,EAAE,qBAAqB;YAIlD,mBAAmB;IAuF3B,mBAAmB,CACvB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE;QACH,sEAAsE;QACtE,KAAK,EAAE,OAAO,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B;YAKW,kBAAkB;IAmDhC;;OAEG;IACG,aAAa,CACjB,KAAK,CAAC,EAAE,MAAM,EACd,GAAG,CAAC,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;KACjB;IAKH,mBAAmB;;;;;IASnB;;;OAGG;IACG,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IASxC;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAM1C,OAAO,CAAC,kBAAkB;IAK1B;;;;OAIG;IACG,UAAU,CAAC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAOrE;AAED,eAAO,MAAM,WAAW,GACtB,mBAAmB,iBAAiB,EACpC,OAAO,QAAQ,6BAGhB,CAAC"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import type { AgentOpt } from '../types';
|
|
2
2
|
export declare function validateAgentCacheInput(cache: AgentOpt['cache']): void;
|
|
3
|
+
/**
|
|
4
|
+
* Process cache configuration and return normalized cache settings
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizeAgentCacheConfig(opts: AgentOpt): {
|
|
7
|
+
id: string;
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
readOnly: boolean;
|
|
10
|
+
writeOnly: boolean;
|
|
11
|
+
cacheDir?: string;
|
|
12
|
+
} | null;
|
|
3
13
|
//# sourceMappingURL=cache-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-config.d.ts","sourceRoot":"","sources":["../../../src/agent/cache-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"cache-config.d.ts","sourceRoot":"","sources":["../../../src/agent/cache-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAe,MAAM,UAAU,CAAC;AAkBtD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,CA0CtE;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,QAAQ,GAAG;IACzD,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,IAAI,CA2BP"}
|
|
@@ -16,6 +16,7 @@ interface ExecutionResult<OutputType = any> {
|
|
|
16
16
|
runner: TaskRunner;
|
|
17
17
|
}
|
|
18
18
|
interface TaskExecutorHooks {
|
|
19
|
+
onExecutionCreated?: (runner: TaskRunner) => void;
|
|
19
20
|
onSnapshotChange?: (runner: TaskRunner, error?: TaskExecutionError) => Promise<void> | void;
|
|
20
21
|
onProgress?: AgentProgressPublisher;
|
|
21
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../../src/agent/tasks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAIjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,iBAAiB,EAAqB,MAAM,UAAU,CAAC;AACrE,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAEV,UAAU,EAEX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAA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M,CAAC;KACjB,GACD,SAAS,CACZ,CACF;IAkBD;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,+BAA+B;YAsBzB,SAAS;IAsbvB,OAAO,CAAC,mBAAmB;IA8IrB,wBAAwB,CAAC,CAAC,EAC9B,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,EAC1D,MAAM,EAAE,mBAAmB,EAC3B,YAAY,EAAE,YAAY,EAC1B,GAAG,CAAC,EAAE,oBAAoB,EAC1B,gBAAgB,CAAC,EAAE,iBAAiB,EACpC,gBAAgB,CAAC,EAAE;QACjB,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,SAAS,CAAC,EAAE,SAAS,CAAC;KACvB,GACA,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IA8CxB,OAAO,CACX,SAAS,EAAE,WAAW,EACtB,GAAG,EAAE,0BAA0B,EAC/B,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;CAuFlC;AACD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kCAAkC,CAChD,IAAI,EAAE,aAAa,EACnB,SAAS,EAAE,SAAS,GAAG,SAAS,GAC/B,IAAI,CAyBN"}
|
|
@@ -53,7 +53,8 @@ export declare class ReportGenerator implements IReportGenerator {
|
|
|
53
53
|
private reportAttributes;
|
|
54
54
|
private agentCommentWritten;
|
|
55
55
|
private writeQueue;
|
|
56
|
-
private
|
|
56
|
+
private finalization?;
|
|
57
|
+
private sourcePublications;
|
|
57
58
|
constructor(options: {
|
|
58
59
|
reportPath: string;
|
|
59
60
|
screenshotMode: ScreenshotMode;
|
|
@@ -71,6 +72,8 @@ export declare class ReportGenerator implements IReportGenerator {
|
|
|
71
72
|
onExecutionUpdate(execution: ExecutionDump, reportMeta: ReportMeta, attributes?: ReportAttributes): void;
|
|
72
73
|
flush(): Promise<void>;
|
|
73
74
|
finalize(): Promise<string | undefined>;
|
|
75
|
+
private finishPublication;
|
|
76
|
+
private assertOpen;
|
|
74
77
|
getReportPath(): string | undefined;
|
|
75
78
|
writeRunnerReport(input: RunReportInput, scopeId: string, meta: ReportMeta): Promise<string>;
|
|
76
79
|
enableSourceSnapshots(): void;
|
|
@@ -102,6 +105,7 @@ export declare class ReportGenerator implements IReportGenerator {
|
|
|
102
105
|
private appendAgentReportComment;
|
|
103
106
|
private getExecutionLogKey;
|
|
104
107
|
private getExecutionCommentKey;
|
|
108
|
+
private get executionDumpDir();
|
|
105
109
|
private persistExecutionDumpToFile;
|
|
106
110
|
}
|
|
107
111
|
//# sourceMappingURL=report-generator.d.ts.map
|