@midscene/core 1.15.4-beta-20261013083552.0 → 1.15.4

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.
Files changed (36) hide show
  1. package/dist/es/agent/index.mjs +2 -2
  2. package/dist/es/agent/tasks.mjs +1 -1
  3. package/dist/es/agent/tasks.mjs.map +1 -1
  4. package/dist/es/agent/test-runner-nodes.mjs +5 -14
  5. package/dist/es/agent/test-runner-nodes.mjs.map +1 -1
  6. package/dist/es/agent/utils.mjs +1 -1
  7. package/dist/es/report-html-template.mjs +1 -1
  8. package/dist/es/test-run-report.mjs.map +1 -1
  9. package/dist/es/test-runner/reporting/test-run-report.mjs +1 -41
  10. package/dist/es/test-runner/reporting/test-run-report.mjs.map +1 -1
  11. package/dist/es/utils.mjs +1 -1
  12. package/dist/lib/agent/index.js +0 -3
  13. package/dist/lib/agent/tasks.js +1 -1
  14. package/dist/lib/agent/tasks.js.map +1 -1
  15. package/dist/lib/agent/test-runner-nodes.js +19 -31
  16. package/dist/lib/agent/test-runner-nodes.js.map +1 -1
  17. package/dist/lib/agent/utils.js +1 -1
  18. package/dist/lib/report-html-template.js +1 -1
  19. package/dist/lib/test-run-report.js.map +1 -1
  20. package/dist/lib/test-runner/reporting/test-run-report.js +1 -41
  21. package/dist/lib/test-runner/reporting/test-run-report.js.map +1 -1
  22. package/dist/lib/utils.js +1 -1
  23. package/dist/types/agent/index.d.ts +2 -2
  24. package/dist/types/agent/index.d.ts.map +1 -1
  25. package/dist/types/agent/test-runner-nodes.d.ts +0 -8
  26. package/dist/types/agent/test-runner-nodes.d.ts.map +1 -1
  27. package/dist/types/test-run-report.d.ts +0 -19
  28. package/dist/types/test-run-report.d.ts.map +1 -1
  29. package/dist/types/test-runner/engine/types.d.ts +1 -1
  30. package/dist/types/test-runner/engine/types.d.ts.map +1 -1
  31. package/dist/types/test-runner/parser/types.d.ts +0 -4
  32. package/dist/types/test-runner/parser/types.d.ts.map +1 -1
  33. package/dist/types/test-runner/reporting/test-run-report.d.ts.map +1 -1
  34. package/dist/types/test-runner/reporting/types.d.ts +1 -6
  35. package/dist/types/test-runner/reporting/types.d.ts.map +1 -1
  36. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"test-run-report.mjs","sources":["../../src/test-run-report.ts"],"sourcesContent":["export const TEST_RUN_REPORT_SCRIPT_TYPE = 'midscene_test_run_dump';\n\nexport type TestRunReportRunStatus = 'success' | 'failed';\nexport type TestRunReportCaseStatus = TestRunReportRunStatus | 'not-run';\nexport type TestRunReportStepPhase =\n | 'beforeAll'\n | 'beforeEach'\n | 'steps'\n | 'afterEach'\n | 'afterAll';\n\n/**\n * A JSON-safe value prepared for display in a Midscene Test report.\n *\n * Paths use JSONPath-like notation rooted at `$`. The path arrays are kept\n * beside the value so the UI never presents redacted or truncated data as if\n * it were complete.\n */\nexport interface TestRunReportValue {\n value: unknown;\n truncatedPaths?: string[];\n redactedPaths?: string[];\n}\n\nexport interface TestRunReportError {\n format?: 'midscene-error';\n name: string;\n message: string;\n code?: string;\n details?: TestRunReportValue;\n cause?: TestRunReportError;\n errors?: TestRunReportError[];\n truncated?: boolean;\n}\n\nexport interface TestRunReportOperationReference {\n operationId: string;\n scopeId?: string;\n stepId?: string;\n node?: string;\n}\n\n/** Immutable observation; late completion remains in the operation journal. */\nexport interface TestRunReportCleanup {\n status: 'not-required' | 'completed' | 'pending' | 'failed';\n capturedAt: string;\n operationId?: string;\n blockingOperations?: TestRunReportOperationReference[];\n error?: TestRunReportError;\n}\n\nexport interface TestRunReportRetryDecision {\n scope: 'case' | 'document';\n retryCount: number;\n attemptIndex: number;\n decision: 'retry' | 'stop';\n reason:\n | 'passed'\n | 'attempt-failed'\n | 'budget-exhausted'\n | 'cleanup-pending'\n | 'cleanup-failed'\n | 'operation-pending'\n | 'fatal-error'\n | 'interrupted'\n | 'bail'\n | 'infrastructure-error';\n}\n\nexport interface TestRunReportPhaseResult {\n status: 'success' | 'failed' | 'not-run' | 'not-required';\n plannedStepCount: number;\n executedStepCount: number;\n}\n\nexport interface TestRunReportHostError {\n phase:\n | 'setup'\n | 'execution'\n | 'cleanup'\n | 'report'\n | 'publication'\n | 'observer';\n error: TestRunReportError;\n}\n\nexport interface TestRunReportDiagnostic {\n level: 'warning' | 'error';\n code:\n | 'agent-detail-unresolved'\n | 'agent-detail-unavailable'\n | 'large-report'\n | 'run-infrastructure-error'\n | 'agent-source-unavailable'\n | 'source-without-executions';\n message: string;\n scopeId?: string;\n executionId?: string;\n sourcePaths?: string[];\n stepId?: string;\n error?: TestRunReportError;\n}\n\nexport interface TestRunReportMetrics {\n modelCallCount: number;\n modelTimeMs: number;\n promptTokens: number;\n cachedInputTokens: number;\n completionTokens: number;\n totalTokens: number;\n collection?: {\n status: 'complete' | 'partial' | 'unknown';\n expectedExecutionCount: number;\n capturedExecutionCount: number;\n reasons: string[];\n fields?: Record<\n 'modelCallCount' | 'modelTimeMs' | 'totalTokens',\n 'complete' | 'partial' | 'unknown'\n >;\n };\n}\n\nexport interface TestRunReportSnapshotCollection {\n status: 'complete' | 'partial';\n /** Native dump cutoff before I/O; observation time for partial live sources. */\n capturedAt: string;\n reason?: string;\n}\n\nexport interface TestRunReportAgentDetail {\n reportId: string;\n executionId: string;\n}\n\n/** Operation facts are independent of Agent dump IDs and report snapshots. */\nexport interface TestRunReportOperationEvent {\n operationId: string;\n operationKind: 'node' | 'resource' | 'acquisition' | 'cleanup' | 'readiness';\n kind:\n | 'started'\n | 'cancel-requested'\n | 'settled'\n | 'runner-returned'\n | 'cleanup-deferred';\n at: string;\n stepId?: string;\n scopeId?: string;\n node?: string;\n status?: 'success' | 'failed' | 'not-run';\n /** True only when the actual operation has not settled at Runner return. */\n pending?: boolean;\n error?: TestRunReportError;\n blockingOperations?: TestRunReportOperationReference[];\n}\n\nexport interface TestRunReportPlannedStep {\n id: string;\n phase: TestRunReportStepPhase;\n stepIndex: number;\n node: string;\n title?: string;\n input: TestRunReportValue;\n inputMode: 'template' | 'resolved';\n timeoutMs?: number;\n continueOnError: boolean;\n}\n\nexport interface TestRunReportCasePlan {\n caseId: string;\n name: string;\n caseIndex: number;\n selected: boolean;\n tags: string[];\n onFailure?: 'continue' | 'stop-document';\n beforeEach: TestRunReportPlannedStep[];\n steps: TestRunReportPlannedStep[];\n afterEach: TestRunReportPlannedStep[];\n}\n\n/** A safe snapshot collected before resource acquisition, independent of attempts. */\nexport interface TestRunReportDocumentPlan {\n documentId: string;\n sourcePath: string;\n sourceYaml?: TestRunReportValue;\n retry: { scope: 'case' | 'document'; count: number };\n beforeAll: TestRunReportPlannedStep[];\n cases: TestRunReportCasePlan[];\n afterAll: TestRunReportPlannedStep[];\n}\n\ninterface TestRunReportStepBase {\n id: string;\n planStepId?: string;\n phase: TestRunReportStepPhase;\n stepIndex: number;\n node: string;\n title?: string;\n continuedAfterError: boolean;\n /** Time spent waiting for a cancelled operation before this Step started. */\n waitForPreviousOperationMs?: number;\n input?: TestRunReportValue;\n output?: {\n summary?: string;\n data?: TestRunReportValue;\n };\n error?: TestRunReportError;\n agentDetails?: TestRunReportAgentDetail[];\n agentDetailDiagnostic?: string;\n /** Usage survives even when screenshots or execution detail storage fails. */\n metrics?: TestRunReportMetrics;\n evidenceCollection?: {\n status: 'complete' | 'partial' | 'unknown';\n /** The missing source also prevented independent usage recovery. */\n modelUsageUnavailable?: boolean;\n capturedAt?: string;\n errors?: TestRunReportError[];\n };\n operations?: { capturedAt: string; events: TestRunReportOperationEvent[] };\n}\n\nexport type TestRunReportStep = TestRunReportStepBase &\n (\n | {\n status: TestRunReportRunStatus;\n startedAt: string;\n endedAt: string;\n durationMs: number;\n notRunReason?: never;\n blockedBy?: never;\n }\n | {\n status: 'not-run';\n notRunReason: string;\n blockedBy?: string;\n startedAt?: never;\n endedAt?: never;\n durationMs?: never;\n }\n );\n\nexport interface TestRunReportAttempt {\n attemptId: string;\n attemptIndex: number;\n status: TestRunReportRunStatus;\n executionStatus?: TestRunReportCaseStatus;\n phases?: Partial<Record<TestRunReportStepPhase, TestRunReportPhaseResult>>;\n cleanup?: TestRunReportCleanup;\n pendingOperations?: TestRunReportOperationReference[];\n retryDecision?: TestRunReportRetryDecision;\n startedAt: string;\n endedAt: string;\n durationMs: number;\n beforeEach: TestRunReportStep[];\n steps: TestRunReportStep[];\n afterEach: TestRunReportStep[];\n teardownErrors?: TestRunReportError[];\n hostErrors?: TestRunReportHostError[];\n /** Report groups available for scope-level fallback browsing. */\n scopeReportIds?: string[];\n}\n\nexport interface TestRunReportArtifact {\n name: string;\n uri: string;\n mediaType?: string;\n}\n\nexport interface TestRunReportCaseExecution {\n executor: string;\n resources: string[];\n attempts?: number;\n failure?: {\n kind: 'provision' | 'transport' | 'cleanup' | 'report' | 'unknown';\n message: string;\n retryable: boolean;\n };\n lifecycle?: TestRunReportProjectLifecycle;\n artifacts?: TestRunReportArtifact[];\n metadata?: Record<string, string | number | boolean | null>;\n}\n\nexport interface TestRunReportCase {\n plan?: TestRunReportCasePlan;\n caseId: string;\n name: string;\n caseIndex: number;\n status: TestRunReportCaseStatus;\n notRunReason?: string;\n attempts: TestRunReportAttempt[];\n execution?: TestRunReportCaseExecution;\n}\n\nexport interface TestRunReportDocument {\n plan?: TestRunReportDocumentPlan;\n documentId: string;\n /** Logical file identity when separate invocations need distinct UI IDs. */\n logicalDocumentId?: string;\n documentRunId?: string;\n attemptIndex?: number;\n sourcePath: string;\n status: TestRunReportRunStatus;\n executionStatus?: TestRunReportCaseStatus;\n phases?: Partial<Record<TestRunReportStepPhase, TestRunReportPhaseResult>>;\n cleanup?: TestRunReportCleanup;\n pendingOperations?: TestRunReportOperationReference[];\n retryDecision?: TestRunReportRetryDecision;\n startedAt?: string;\n endedAt?: string;\n durationMs?: number;\n beforeAll: TestRunReportStep[];\n cases: TestRunReportCase[];\n afterAll: TestRunReportStep[];\n teardownErrors?: TestRunReportError[];\n hostErrors?: TestRunReportHostError[];\n /** Report groups available for scope-level fallback browsing. */\n scopeReportIds?: string[];\n /** Whole-file invocation history; Cases aggregate their own attempts. */\n attempts?: Omit<TestRunReportDocument, 'cases' | 'attempts'>[];\n}\n\nexport interface TestRunReportCollectionError {\n sourcePath: string;\n error: TestRunReportError;\n}\n\nexport interface TestRunReportProjectLifecycle {\n status: TestRunReportRunStatus;\n startedAt: string;\n endedAt: string;\n durationMs: number;\n setupError?: TestRunReportError;\n teardownErrors?: TestRunReportError[];\n cleanup?: TestRunReportCleanup;\n pendingOperations?: TestRunReportOperationReference[];\n}\n\nexport interface TestRunReportProject {\n plans?: readonly TestRunReportDocumentPlan[];\n projectId: string;\n name: string;\n /** Display identity, also supports legacy custom interface adapters. */\n platform?: string;\n status: TestRunReportRunStatus;\n retry: number;\n lifecycle?: TestRunReportProjectLifecycle;\n documents: TestRunReportDocument[];\n collectionErrors: TestRunReportCollectionError[];\n}\n\nexport interface TestRunReportSummary {\n total: number;\n passed: number;\n failed: number;\n notRun: number;\n filtered: number;\n collectionErrors: number;\n documentFailures: number;\n projectFailures: number;\n}\n\nexport interface TestRunReportDump {\n schemaVersion: 1;\n kind: 'test-runner';\n runId: string;\n status: TestRunReportRunStatus;\n startedAt: string;\n endedAt: string;\n durationMs: number;\n summary: TestRunReportSummary;\n metrics: TestRunReportMetrics;\n executionMetrics?: Record<string, TestRunReportMetrics>;\n projects: TestRunReportProject[];\n diagnostics?: TestRunReportDiagnostic[];\n operationLogs?: { path: string; snapshotAt: string }[];\n}\n\nexport interface TestRunReportSource {\n /** Resource/report scope that owns this Midscene Agent source. */\n scopeId: string;\n /** Absolute path identifying the Midscene Agent report. */\n sourcePath: string;\n /** Current Agent dump JSON; when present, HTML is not parsed for execution data. */\n dumpPath?: string;\n collection?: TestRunReportSnapshotCollection;\n}\n\nexport interface IndexedTestRunReportSource {\n reportId: string;\n scopeId: string;\n sourcePath: string;\n executionIds: string[];\n collection?: TestRunReportSnapshotCollection;\n}\n\nexport interface TestRunReportSourceIndex {\n sources: IndexedTestRunReportSource[];\n metrics: TestRunReportMetrics;\n executionMetrics?: Record<string, TestRunReportMetrics>;\n /** Usage from readable sources, before applying source-availability diagnostics. */\n capturedMetrics?: TestRunReportMetrics;\n diagnostics?: TestRunReportDiagnostic[];\n}\n\nexport interface AssembleTestRunReportOptions {\n outputDir: string;\n /** File or directory name without an extension. */\n reportFileName: string;\n sources: readonly TestRunReportSource[];\n buildRunnerDump(index: TestRunReportSourceIndex): TestRunReportDump;\n overwrite?: boolean;\n}\n"],"names":["TEST_RUN_REPORT_SCRIPT_TYPE"],"mappings":"AAAO,MAAMA,8BAA8B"}
1
+ {"version":3,"file":"test-run-report.mjs","sources":["../../src/test-run-report.ts"],"sourcesContent":["export const TEST_RUN_REPORT_SCRIPT_TYPE = 'midscene_test_run_dump';\n\nexport type TestRunReportRunStatus = 'success' | 'failed';\nexport type TestRunReportCaseStatus = TestRunReportRunStatus | 'not-run';\nexport type TestRunReportStepPhase =\n | 'beforeAll'\n | 'beforeEach'\n | 'steps'\n | 'afterEach'\n | 'afterAll';\n\n/**\n * A JSON-safe value prepared for display in a Midscene Test report.\n *\n * Paths use JSONPath-like notation rooted at `$`. The path arrays are kept\n * beside the value so the UI never presents redacted or truncated data as if\n * it were complete.\n */\nexport interface TestRunReportValue {\n value: unknown;\n truncatedPaths?: string[];\n redactedPaths?: string[];\n}\n\nexport interface TestRunReportError {\n format?: 'midscene-error';\n name: string;\n message: string;\n code?: string;\n details?: TestRunReportValue;\n cause?: TestRunReportError;\n errors?: TestRunReportError[];\n truncated?: boolean;\n}\n\nexport interface TestRunReportOperationReference {\n operationId: string;\n scopeId?: string;\n stepId?: string;\n node?: string;\n}\n\n/** Immutable observation; late completion remains in the operation journal. */\nexport interface TestRunReportCleanup {\n status: 'not-required' | 'completed' | 'pending' | 'failed';\n capturedAt: string;\n operationId?: string;\n blockingOperations?: TestRunReportOperationReference[];\n error?: TestRunReportError;\n}\n\nexport interface TestRunReportRetryDecision {\n scope: 'case' | 'document';\n retryCount: number;\n attemptIndex: number;\n decision: 'retry' | 'stop';\n reason:\n | 'passed'\n | 'attempt-failed'\n | 'budget-exhausted'\n | 'cleanup-pending'\n | 'cleanup-failed'\n | 'operation-pending'\n | 'fatal-error'\n | 'interrupted'\n | 'bail'\n | 'infrastructure-error';\n}\n\nexport interface TestRunReportPhaseResult {\n status: 'success' | 'failed' | 'not-run' | 'not-required';\n plannedStepCount: number;\n executedStepCount: number;\n}\n\nexport interface TestRunReportHostError {\n phase:\n | 'setup'\n | 'execution'\n | 'cleanup'\n | 'report'\n | 'publication'\n | 'observer';\n error: TestRunReportError;\n}\n\nexport interface TestRunReportDiagnostic {\n level: 'warning' | 'error';\n code:\n | 'agent-detail-unresolved'\n | 'agent-detail-unavailable'\n | 'large-report'\n | 'run-infrastructure-error'\n | 'agent-source-unavailable'\n | 'source-without-executions';\n message: string;\n scopeId?: string;\n executionId?: string;\n sourcePaths?: string[];\n stepId?: string;\n error?: TestRunReportError;\n}\n\nexport interface TestRunReportMetrics {\n modelCallCount: number;\n modelTimeMs: number;\n promptTokens: number;\n cachedInputTokens: number;\n completionTokens: number;\n totalTokens: number;\n collection?: {\n status: 'complete' | 'partial' | 'unknown';\n expectedExecutionCount: number;\n capturedExecutionCount: number;\n reasons: string[];\n fields?: Record<\n 'modelCallCount' | 'modelTimeMs' | 'totalTokens',\n 'complete' | 'partial' | 'unknown'\n >;\n };\n}\n\nexport interface TestRunReportSnapshotCollection {\n status: 'complete' | 'partial';\n /** Native dump cutoff before I/O; observation time for partial live sources. */\n capturedAt: string;\n reason?: string;\n}\n\nexport interface TestRunReportAgentDetail {\n reportId: string;\n executionId: string;\n}\n\n/** Operation facts are independent of Agent dump IDs and report snapshots. */\nexport interface TestRunReportOperationEvent {\n operationId: string;\n operationKind: 'node' | 'resource' | 'acquisition' | 'cleanup' | 'readiness';\n kind:\n | 'started'\n | 'cancel-requested'\n | 'settled'\n | 'runner-returned'\n | 'cleanup-deferred';\n at: string;\n stepId?: string;\n scopeId?: string;\n node?: string;\n status?: 'success' | 'failed' | 'not-run';\n /** True only when the actual operation has not settled at Runner return. */\n pending?: boolean;\n error?: TestRunReportError;\n blockingOperations?: TestRunReportOperationReference[];\n}\n\nexport interface TestRunReportPlannedStep {\n id: string;\n phase: TestRunReportStepPhase;\n stepIndex: number;\n node: string;\n title?: string;\n input: TestRunReportValue;\n inputMode: 'template' | 'resolved';\n timeoutMs?: number;\n continueOnError: boolean;\n}\n\nexport interface TestRunReportCasePlan {\n caseId: string;\n name: string;\n caseIndex: number;\n selected: boolean;\n tags: string[];\n onFailure?: 'continue' | 'stop-document';\n beforeEach: TestRunReportPlannedStep[];\n steps: TestRunReportPlannedStep[];\n afterEach: TestRunReportPlannedStep[];\n}\n\n/** A safe snapshot collected before resource acquisition, independent of attempts. */\nexport interface TestRunReportDocumentPlan {\n documentId: string;\n sourcePath: string;\n sourceYaml?: TestRunReportValue;\n retry: { scope: 'case' | 'document'; count: number };\n beforeAll: TestRunReportPlannedStep[];\n cases: TestRunReportCasePlan[];\n afterAll: TestRunReportPlannedStep[];\n}\n\ninterface TestRunReportStepBase {\n id: string;\n planStepId?: string;\n phase: TestRunReportStepPhase;\n stepIndex: number;\n node: string;\n title?: string;\n continuedAfterError: boolean;\n /** Time spent waiting for a cancelled operation before this Step started. */\n waitForPreviousOperationMs?: number;\n input?: TestRunReportValue;\n output?: {\n summary?: string;\n data?: TestRunReportValue;\n };\n error?: TestRunReportError;\n agentDetails?: TestRunReportAgentDetail[];\n agentDetailDiagnostic?: string;\n /** Usage survives even when screenshots or execution detail storage fails. */\n metrics?: TestRunReportMetrics;\n evidenceCollection?: {\n status: 'complete' | 'partial' | 'unknown';\n /** The missing source also prevented independent usage recovery. */\n modelUsageUnavailable?: boolean;\n capturedAt?: string;\n errors?: TestRunReportError[];\n };\n operations?: { capturedAt: string; events: TestRunReportOperationEvent[] };\n}\n\nexport type TestRunReportStep = TestRunReportStepBase &\n (\n | {\n status: TestRunReportRunStatus;\n startedAt: string;\n endedAt: string;\n durationMs: number;\n notRunReason?: never;\n blockedBy?: never;\n }\n | {\n status: 'not-run';\n notRunReason: string;\n blockedBy?: string;\n startedAt?: never;\n endedAt?: never;\n durationMs?: never;\n }\n );\n\nexport interface TestRunReportAttempt {\n attemptId: string;\n attemptIndex: number;\n status: TestRunReportRunStatus;\n executionStatus?: TestRunReportCaseStatus;\n phases?: Partial<Record<TestRunReportStepPhase, TestRunReportPhaseResult>>;\n cleanup?: TestRunReportCleanup;\n pendingOperations?: TestRunReportOperationReference[];\n retryDecision?: TestRunReportRetryDecision;\n startedAt: string;\n endedAt: string;\n durationMs: number;\n beforeEach: TestRunReportStep[];\n steps: TestRunReportStep[];\n afterEach: TestRunReportStep[];\n teardownErrors?: TestRunReportError[];\n hostErrors?: TestRunReportHostError[];\n /** Report groups available for scope-level fallback browsing. */\n scopeReportIds?: string[];\n}\n\nexport interface TestRunReportCase {\n plan?: TestRunReportCasePlan;\n caseId: string;\n name: string;\n caseIndex: number;\n status: TestRunReportCaseStatus;\n notRunReason?: string;\n attempts: TestRunReportAttempt[];\n}\n\nexport interface TestRunReportDocument {\n plan?: TestRunReportDocumentPlan;\n documentId: string;\n /** Logical file identity when separate invocations need distinct UI IDs. */\n logicalDocumentId?: string;\n documentRunId?: string;\n attemptIndex?: number;\n sourcePath: string;\n status: TestRunReportRunStatus;\n executionStatus?: TestRunReportCaseStatus;\n phases?: Partial<Record<TestRunReportStepPhase, TestRunReportPhaseResult>>;\n cleanup?: TestRunReportCleanup;\n pendingOperations?: TestRunReportOperationReference[];\n retryDecision?: TestRunReportRetryDecision;\n startedAt?: string;\n endedAt?: string;\n durationMs?: number;\n beforeAll: TestRunReportStep[];\n cases: TestRunReportCase[];\n afterAll: TestRunReportStep[];\n teardownErrors?: TestRunReportError[];\n hostErrors?: TestRunReportHostError[];\n /** Report groups available for scope-level fallback browsing. */\n scopeReportIds?: string[];\n /** Whole-file invocation history; Cases aggregate their own attempts. */\n attempts?: Omit<TestRunReportDocument, 'cases' | 'attempts'>[];\n}\n\nexport interface TestRunReportCollectionError {\n sourcePath: string;\n error: TestRunReportError;\n}\n\nexport interface TestRunReportProjectLifecycle {\n status: TestRunReportRunStatus;\n startedAt: string;\n endedAt: string;\n durationMs: number;\n setupError?: TestRunReportError;\n teardownErrors?: TestRunReportError[];\n cleanup?: TestRunReportCleanup;\n pendingOperations?: TestRunReportOperationReference[];\n}\n\nexport interface TestRunReportProject {\n plans?: readonly TestRunReportDocumentPlan[];\n projectId: string;\n name: string;\n /** Display identity, also supports legacy custom interface adapters. */\n platform?: string;\n status: TestRunReportRunStatus;\n retry: number;\n lifecycle?: TestRunReportProjectLifecycle;\n documents: TestRunReportDocument[];\n collectionErrors: TestRunReportCollectionError[];\n}\n\nexport interface TestRunReportSummary {\n total: number;\n passed: number;\n failed: number;\n notRun: number;\n filtered: number;\n collectionErrors: number;\n documentFailures: number;\n projectFailures: number;\n}\n\nexport interface TestRunReportDump {\n schemaVersion: 1;\n kind: 'test-runner';\n runId: string;\n status: TestRunReportRunStatus;\n startedAt: string;\n endedAt: string;\n durationMs: number;\n summary: TestRunReportSummary;\n metrics: TestRunReportMetrics;\n executionMetrics?: Record<string, TestRunReportMetrics>;\n projects: TestRunReportProject[];\n diagnostics?: TestRunReportDiagnostic[];\n operationLogs?: { path: string; snapshotAt: string }[];\n}\n\nexport interface TestRunReportSource {\n /** Resource/report scope that owns this Midscene Agent source. */\n scopeId: string;\n /** Absolute path identifying the Midscene Agent report. */\n sourcePath: string;\n /** Current Agent dump JSON; when present, HTML is not parsed for execution data. */\n dumpPath?: string;\n collection?: TestRunReportSnapshotCollection;\n}\n\nexport interface IndexedTestRunReportSource {\n reportId: string;\n scopeId: string;\n sourcePath: string;\n executionIds: string[];\n collection?: TestRunReportSnapshotCollection;\n}\n\nexport interface TestRunReportSourceIndex {\n sources: IndexedTestRunReportSource[];\n metrics: TestRunReportMetrics;\n executionMetrics?: Record<string, TestRunReportMetrics>;\n /** Usage from readable sources, before applying source-availability diagnostics. */\n capturedMetrics?: TestRunReportMetrics;\n diagnostics?: TestRunReportDiagnostic[];\n}\n\nexport interface AssembleTestRunReportOptions {\n outputDir: string;\n /** File or directory name without an extension. */\n reportFileName: string;\n sources: readonly TestRunReportSource[];\n buildRunnerDump(index: TestRunReportSourceIndex): TestRunReportDump;\n overwrite?: boolean;\n}\n"],"names":["TEST_RUN_REPORT_SCRIPT_TYPE"],"mappings":"AAAO,MAAMA,8BAA8B"}
@@ -243,47 +243,7 @@ const buildCase = (outcome, context, plan)=>({
243
243
  } : {},
244
244
  attempts: (outcome.attempts ?? (outcome.run ? [
245
245
  outcome.run
246
- ] : [])).map((attempt)=>buildAttempt(attempt, context, plan)),
247
- ...outcome.execution ? {
248
- execution: {
249
- executor: outcome.execution.executor,
250
- resources: [
251
- ...outcome.execution.resources
252
- ],
253
- ...void 0 === outcome.execution.attempts ? {} : {
254
- attempts: outcome.execution.attempts
255
- },
256
- ...outcome.execution.failure ? {
257
- failure: {
258
- ...outcome.execution.failure
259
- }
260
- } : {},
261
- ...outcome.execution.lifecycle ? {
262
- lifecycle: {
263
- status: outcome.execution.lifecycle.status,
264
- startedAt: outcome.execution.lifecycle.startedAt,
265
- endedAt: outcome.execution.lifecycle.endedAt,
266
- durationMs: outcome.execution.lifecycle.durationMs,
267
- ...outcome.execution.lifecycle.setupError ? {
268
- setupError: sanitizeReportError(outcome.execution.lifecycle.setupError)
269
- } : {},
270
- ...outcome.execution.lifecycle.teardownErrors?.length ? {
271
- teardownErrors: outcome.execution.lifecycle.teardownErrors.map(sanitizeReportError)
272
- } : {}
273
- }
274
- } : {},
275
- ...outcome.execution.artifacts ? {
276
- artifacts: outcome.execution.artifacts.map((artifact)=>({
277
- ...artifact
278
- }))
279
- } : {},
280
- ...outcome.execution.metadata ? {
281
- metadata: {
282
- ...outcome.execution.metadata
283
- }
284
- } : {}
285
- }
286
- } : {}
246
+ ] : [])).map((attempt)=>buildAttempt(attempt, context, plan))
287
247
  });
288
248
  const documentReportScope = (document)=>document.reportScopeId ?? document.documentRunId;
289
249
  const buildDocument = (documentId, document, cases, context, plan)=>{
@@ -1 +1 @@
1
- {"version":3,"file":"test-runner/reporting/test-run-report.mjs","sources":["../../../../src/test-runner/reporting/test-run-report.ts"],"sourcesContent":["import type {\n IndexedTestRunReportSource,\n TestRunReportAgentDetail,\n TestRunReportAttempt,\n TestRunReportCase,\n TestRunReportCasePlan,\n TestRunReportDiagnostic,\n TestRunReportDocument,\n TestRunReportDocumentPlan,\n TestRunReportDump,\n TestRunReportMetrics,\n TestRunReportPlannedStep,\n TestRunReportProject,\n TestRunReportSource,\n TestRunReportSourceIndex,\n TestRunReportStep,\n} from '../../test-run-report';\nimport type {\n CaseRunResult,\n StepRunResult,\n WorkflowDocumentRunResult,\n} from '../engine/types';\nimport { sumTestRunReportMetrics } from './metrics';\nimport {\n sanitizeReportError,\n sanitizeReportText,\n sanitizeReportValue,\n} from './sanitize';\nimport type { RunReportCaseInput, RunReportInput } from './types';\n\nconst exactMidsceneDetailNodes = new Set([\n 'aiAct',\n 'aiAssert',\n 'recordToReport',\n]);\n\ninterface ManifestBuildContext {\n diagnostics: TestRunReportDiagnostic[];\n sourcesByScope: Map<string, IndexedTestRunReportSource[]>;\n detailsByScopeAndExecution: Map<string, TestRunReportAgentDetail>;\n tracedScopeByExecution: Map<string, string>;\n expectedExecutions: Set<string>;\n capturedExecutions: Set<string>;\n executionMetrics: Map<string, TestRunReportMetrics>;\n missingMetrics: Set<string>;\n tracedScopes: Set<string>;\n}\n\nconst scopedExecutionKey = (scopeId: string, executionId: string): string =>\n `${scopeId}\\u0000${executionId}`;\n\nconst reportSourcesForScope = (\n context: ManifestBuildContext,\n scopeId: string,\n): IndexedTestRunReportSource[] => context.sourcesByScope.get(scopeId) ?? [];\n\nconst addDiagnostic = (\n context: ManifestBuildContext,\n diagnostic: TestRunReportDiagnostic,\n): void => {\n context.diagnostics.push(diagnostic);\n};\n\nconst buildStep = (\n step: StepRunResult,\n scopeId: string,\n context: ManifestBuildContext,\n executionId: string,\n plan?: TestRunReportPlannedStep,\n): TestRunReportStep => {\n const stepId = `${executionId}:${step.phase}:${step.stepIndex}`;\n if (step.status === 'not-run')\n return {\n id: stepId,\n ...(plan ? { planStepId: plan.id, title: plan.title } : {}),\n phase: step.phase,\n stepIndex: step.stepIndex,\n node: step.node,\n status: 'not-run',\n notRunReason: sanitizeReportText(step.notRunReason),\n ...(step.blockedBy ? { blockedBy: step.blockedBy } : {}),\n continuedAfterError: step.continuedAfterError,\n ...(step.waitForPreviousOperationMs\n ? { waitForPreviousOperationMs: step.waitForPreviousOperationMs }\n : {}),\n input: sanitizeReportValue(step.input),\n ...(step.error ? { error: sanitizeReportError(step.error) } : {}),\n ...(step.operations\n ? {\n operations: {\n ...step.operations,\n events: [...step.operations.events],\n },\n }\n : {}),\n };\n const details: TestRunReportAgentDetail[] = [];\n const unresolvedExecutionIds: string[] = [];\n const usage: TestRunReportMetrics[] = [];\n const missingUsage: string[] = [];\n for (const trace of step.report?.traces ?? []) {\n context.tracedScopes.add(scopeId);\n const metrics =\n context.executionMetrics.get(trace.executionId) ?? trace.metrics;\n if (metrics) {\n context.executionMetrics.set(trace.executionId, metrics);\n usage.push(metrics);\n }\n context.expectedExecutions.add(\n scopedExecutionKey(scopeId, trace.executionId),\n );\n const previousScope = context.tracedScopeByExecution.get(trace.executionId);\n if (previousScope && previousScope !== scopeId) {\n throw new Error(\n `Agent execution ${trace.executionId} was traced by multiple test scopes (${previousScope}, ${scopeId}).`,\n );\n }\n context.tracedScopeByExecution.set(trace.executionId, scopeId);\n const detail = context.detailsByScopeAndExecution.get(\n scopedExecutionKey(scopeId, trace.executionId),\n );\n if (detail) {\n details.push(detail);\n context.capturedExecutions.add(\n scopedExecutionKey(scopeId, trace.executionId),\n );\n } else {\n unresolvedExecutionIds.push(trace.executionId);\n if (!metrics) {\n const reason = `Model usage is unavailable for execution ${trace.executionId}.`;\n missingUsage.push(reason);\n context.missingMetrics.add(reason);\n }\n }\n }\n\n let agentDetailDiagnostic: string | undefined;\n if (unresolvedExecutionIds.length > 0) {\n agentDetailDiagnostic = `Agent detail could not be resolved for ${unresolvedExecutionIds.join(', ')}.`;\n const sources = reportSourcesForScope(context, scopeId);\n for (const executionId of unresolvedExecutionIds) {\n addDiagnostic(context, {\n level: 'warning',\n code: 'agent-detail-unresolved',\n message: `Agent detail could not be resolved for execution ${executionId} in test scope ${scopeId}.`,\n scopeId,\n executionId,\n stepId,\n ...(sources.length > 0\n ? { sourcePaths: sources.map((source) => source.sourcePath) }\n : {}),\n });\n }\n } else if (details.length === 0 && exactMidsceneDetailNodes.has(step.node)) {\n agentDetailDiagnostic =\n 'This Agent did not expose a stable execution reference for the Step.';\n addDiagnostic(context, {\n level: 'warning',\n code: 'agent-detail-unavailable',\n message: `No stable Agent execution reference was captured for ${step.node} in test scope ${scopeId}.`,\n scopeId,\n stepId,\n ...(reportSourcesForScope(context, scopeId).length > 0\n ? {\n sourcePaths: reportSourcesForScope(context, scopeId).map(\n (source) => source.sourcePath,\n ),\n }\n : {}),\n });\n }\n\n const collectionErrors =\n step.report?.collectionErrors?.map(sanitizeReportError) ?? [];\n for (const error of collectionErrors) {\n addDiagnostic(context, {\n level: 'warning',\n code: 'agent-source-unavailable',\n scopeId,\n stepId,\n error,\n message: `Report collection for ${step.node}: ${error.message}`,\n });\n }\n const snapshots =\n step.report?.sources?.flatMap((source) =>\n source.collection ? [source.collection] : [],\n ) ?? [];\n const evidenceCollection =\n snapshots.length ||\n collectionErrors.length ||\n details.length ||\n unresolvedExecutionIds.length\n ? {\n status: (collectionErrors.length ||\n unresolvedExecutionIds.length ||\n snapshots.some((snapshot) => snapshot.status === 'partial')\n ? details.length\n ? 'partial'\n : 'unknown'\n : 'complete') as 'complete' | 'partial' | 'unknown',\n ...(snapshots.length\n ? {\n capturedAt: snapshots\n .map((snapshot) => snapshot.capturedAt)\n .sort()\n .at(-1),\n }\n : {}),\n ...(collectionErrors.length ? { errors: collectionErrors } : {}),\n }\n : undefined;\n // A missing link does not invalidate usage already captured independently.\n if (\n !step.report?.traces.length &&\n collectionErrors.length &&\n !details.length\n ) {\n const reason = `Model usage could not be collected for step ${stepId}.`;\n missingUsage.push(reason);\n context.missingMetrics.add(reason);\n }\n\n const input = step.input as Record<string, unknown> | undefined;\n const candidateTitle =\n input?.prompt ?? input?.script ?? input?.scenario ?? input?.title;\n const prompt =\n typeof candidateTitle === 'string'\n ? candidateTitle\n : typeof candidateTitle === 'object' &&\n candidateTitle !== null &&\n 'prompt' in candidateTitle &&\n typeof candidateTitle.prompt === 'string'\n ? candidateTitle.prompt\n : undefined;\n return {\n id: stepId,\n ...(plan ? { planStepId: plan.id } : {}),\n phase: step.phase,\n stepIndex: step.stepIndex,\n node: step.node,\n ...(prompt ? { title: sanitizeReportText(prompt, 240) } : {}),\n status: step.status,\n continuedAfterError: step.continuedAfterError,\n ...(step.waitForPreviousOperationMs\n ? { waitForPreviousOperationMs: step.waitForPreviousOperationMs }\n : {}),\n startedAt: step.startedAt,\n endedAt: step.endedAt,\n durationMs: step.durationMs,\n ...(step.operations\n ? {\n operations: {\n ...step.operations,\n events: [...step.operations.events],\n },\n }\n : {}),\n input: sanitizeReportValue(step.input),\n ...(step.output\n ? {\n output: {\n ...(step.output.summary === undefined\n ? {}\n : { summary: sanitizeReportText(step.output.summary) }),\n ...(step.output.data === undefined\n ? {}\n : { data: sanitizeReportValue(step.output.data) }),\n },\n }\n : {}),\n ...(step.error ? { error: sanitizeReportError(step.error) } : {}),\n ...(details.length > 0 ? { agentDetails: details } : {}),\n ...(agentDetailDiagnostic ? { agentDetailDiagnostic } : {}),\n ...(usage.length || missingUsage.length\n ? { metrics: sumTestRunReportMetrics(usage, missingUsage) }\n : {}),\n ...(evidenceCollection\n ? {\n evidenceCollection: {\n ...evidenceCollection,\n ...(missingUsage.length ? { modelUsageUnavailable: true } : {}),\n },\n }\n : {}),\n };\n};\n\nconst attemptReportScope = (attempt: CaseRunResult): string =>\n attempt.reportScopeId ?? attempt.runId;\n\nconst buildAttempt = (\n attempt: CaseRunResult,\n context: ManifestBuildContext,\n plan?: TestRunReportCasePlan,\n): TestRunReportAttempt => {\n const scopeId = attemptReportScope(attempt);\n return {\n attemptId: attempt.runId,\n attemptIndex: attempt.attemptIndex,\n status: attempt.status,\n ...(attempt.executionStatus\n ? { executionStatus: attempt.executionStatus }\n : {}),\n ...(attempt.phases ? { phases: attempt.phases } : {}),\n ...(attempt.cleanup ? { cleanup: attempt.cleanup } : {}),\n ...(attempt.pendingOperations\n ? { pendingOperations: attempt.pendingOperations }\n : {}),\n ...(attempt.retryDecision ? { retryDecision: attempt.retryDecision } : {}),\n startedAt: attempt.startedAt,\n endedAt: attempt.endedAt,\n durationMs: attempt.durationMs,\n beforeEach: attempt.beforeEach.map((step) =>\n buildStep(\n step,\n scopeId,\n context,\n attempt.runId,\n plan?.beforeEach[step.stepIndex],\n ),\n ),\n steps: attempt.steps.map((step) =>\n buildStep(\n step,\n scopeId,\n context,\n attempt.runId,\n plan?.steps[step.stepIndex],\n ),\n ),\n afterEach: attempt.afterEach.map((step) =>\n buildStep(\n step,\n scopeId,\n context,\n attempt.runId,\n plan?.afterEach[step.stepIndex],\n ),\n ),\n ...(attempt.executionErrors?.length\n ? {\n hostErrors: attempt.executionErrors.map((error) => ({\n phase: 'execution' as const,\n error: sanitizeReportError(error),\n })),\n }\n : {}),\n ...(attempt.teardownErrors?.length\n ? { teardownErrors: attempt.teardownErrors.map(sanitizeReportError) }\n : {}),\n ...(reportSourcesForScope(context, scopeId).length > 0\n ? {\n scopeReportIds: reportSourcesForScope(context, scopeId).map(\n (source) => source.reportId,\n ),\n }\n : {}),\n };\n};\n\nconst buildCase = (\n outcome: RunReportCaseInput,\n context: ManifestBuildContext,\n plan?: TestRunReportCasePlan,\n): TestRunReportCase => ({\n ...(plan ? { plan } : {}),\n caseId: outcome.caseId,\n name: outcome.name,\n caseIndex: outcome.caseIndex,\n status: outcome.status,\n ...(outcome.notRunReason ? { notRunReason: outcome.notRunReason } : {}),\n attempts: (outcome.attempts ?? (outcome.run ? [outcome.run] : [])).map(\n (attempt) => buildAttempt(attempt, context, plan),\n ),\n ...(outcome.execution\n ? {\n execution: {\n executor: outcome.execution.executor,\n resources: [...outcome.execution.resources],\n ...(outcome.execution.attempts === undefined\n ? {}\n : { attempts: outcome.execution.attempts }),\n ...(outcome.execution.failure\n ? { failure: { ...outcome.execution.failure } }\n : {}),\n ...(outcome.execution.lifecycle\n ? {\n lifecycle: {\n status: outcome.execution.lifecycle.status,\n startedAt: outcome.execution.lifecycle.startedAt,\n endedAt: outcome.execution.lifecycle.endedAt,\n durationMs: outcome.execution.lifecycle.durationMs,\n ...(outcome.execution.lifecycle.setupError\n ? {\n setupError: sanitizeReportError(\n outcome.execution.lifecycle.setupError,\n ),\n }\n : {}),\n ...(outcome.execution.lifecycle.teardownErrors?.length\n ? {\n teardownErrors:\n outcome.execution.lifecycle.teardownErrors.map(\n sanitizeReportError,\n ),\n }\n : {}),\n },\n }\n : {}),\n ...(outcome.execution.artifacts\n ? {\n artifacts: outcome.execution.artifacts.map((artifact) => ({\n ...artifact,\n })),\n }\n : {}),\n ...(outcome.execution.metadata\n ? { metadata: { ...outcome.execution.metadata } }\n : {}),\n },\n }\n : {}),\n});\n\nconst documentReportScope = (document: WorkflowDocumentRunResult): string =>\n document.reportScopeId ?? document.documentRunId;\n\nconst buildDocument = (\n documentId: string,\n document: WorkflowDocumentRunResult | undefined,\n cases: readonly RunReportCaseInput[],\n context: ManifestBuildContext,\n plan?: TestRunReportDocumentPlan,\n): TestRunReportDocument => {\n plan ??= document?.plan;\n const sourcePath =\n document?.sourcePath ?? cases[0]?.sourcePath ?? '<unknown>';\n const status =\n document?.status ??\n (cases.some((item) => item.status !== 'success') ? 'failed' : 'success');\n const scopeId = document ? documentReportScope(document) : undefined;\n return {\n documentId,\n ...(plan ? { plan } : {}),\n ...(document\n ? {\n logicalDocumentId: document.documentId,\n documentRunId: document.documentRunId,\n ...(document.attemptIndex === undefined\n ? {}\n : { attemptIndex: document.attemptIndex }),\n }\n : {}),\n sourcePath,\n status,\n ...(document?.executionStatus\n ? { executionStatus: document.executionStatus }\n : {}),\n ...(document?.phases ? { phases: document.phases } : {}),\n ...(document?.cleanup ? { cleanup: document.cleanup } : {}),\n ...(document?.pendingOperations\n ? { pendingOperations: document.pendingOperations }\n : {}),\n ...(document?.retryDecision\n ? { retryDecision: document.retryDecision }\n : {}),\n ...(document\n ? {\n startedAt: document.startedAt,\n endedAt: document.endedAt,\n durationMs: document.durationMs,\n }\n : {}),\n beforeAll: (document?.beforeAll ?? []).map((step) =>\n buildStep(\n step,\n scopeId!,\n context,\n document!.documentRunId,\n plan?.beforeAll[step.stepIndex],\n ),\n ),\n cases: cases.map((outcome) =>\n buildCase(\n outcome,\n context,\n plan?.cases.find((item) => item.caseId === outcome.caseId),\n ),\n ),\n afterAll: (document?.afterAll ?? []).map((step) =>\n buildStep(\n step,\n scopeId!,\n context,\n document!.documentRunId,\n plan?.afterAll[step.stepIndex],\n ),\n ),\n ...(document?.hostErrors?.length || document?.executionErrors?.length\n ? {\n hostErrors: [\n ...(document?.hostErrors ?? []),\n ...(document?.executionErrors ?? []).map((error) => ({\n phase: 'execution' as const,\n error,\n })),\n ].map(({ phase, error }) => ({\n phase,\n error: sanitizeReportError(error),\n })),\n }\n : {}),\n ...(document?.teardownErrors?.length\n ? { teardownErrors: document.teardownErrors.map(sanitizeReportError) }\n : {}),\n ...(scopeId && reportSourcesForScope(context, scopeId).length > 0\n ? {\n scopeReportIds: reportSourcesForScope(context, scopeId).map(\n (source) => source.reportId,\n ),\n }\n : {}),\n };\n};\n\nconst buildProject = (\n project: RunReportInput['projects'][number],\n context: ManifestBuildContext,\n): TestRunReportProject => {\n const documentCount = new Map<string, number>();\n for (const document of project.documents) {\n documentCount.set(\n document.documentId,\n (documentCount.get(document.documentId) ?? 0) + 1,\n );\n }\n for (const outcome of project.cases) {\n if (\n (documentCount.get(outcome.documentId) ?? 0) > 1 &&\n !outcome.documentRunId\n ) {\n throw new Error(\n `Case ${outcome.caseId} must identify its documentRunId when a document has multiple attempts.`,\n );\n }\n }\n // A new attemptIndex 0 begins a distinct invocation of the same file. Only\n // whole-file retries belong to one logical document and its Case history.\n const groups: WorkflowDocumentRunResult[][] = [];\n const currentGroup = new Map<string, WorkflowDocumentRunResult[]>();\n for (const document of project.documents) {\n let group = currentGroup.get(document.documentId);\n if (!group || !document.attemptIndex) {\n group = [];\n groups.push(group);\n currentGroup.set(document.documentId, group);\n }\n group.push(document);\n }\n const documents = groups.map((group) => {\n const first = group[0];\n const last = group.at(-1)!;\n const documentId =\n groups.filter((item) => item[0].documentId === first.documentId).length >\n 1\n ? `${first.documentId}:${first.documentRunId}`\n : first.documentId;\n const outcomes = new Map<string, RunReportCaseInput>();\n for (const document of group) {\n for (const outcome of project.cases.filter(\n (item) =>\n item.documentId === document.documentId &&\n (!item.documentRunId ||\n item.documentRunId === document.documentRunId),\n )) {\n const previous = outcomes.get(outcome.caseId);\n outcomes.set(outcome.caseId, {\n ...outcome,\n attempts: [\n ...(previous?.attempts ?? []),\n ...(outcome.attempts ?? (outcome.run ? [outcome.run] : [])).map(\n (attempt) => ({\n ...attempt,\n attemptIndex: document.attemptIndex ?? attempt.attemptIndex,\n }),\n ),\n ],\n });\n }\n }\n const result = buildDocument(\n documentId,\n last,\n [...outcomes.values()],\n context,\n project.plans?.find((plan) => plan.documentId === last.documentId),\n );\n if (group.length > 1) {\n result.startedAt = first.startedAt;\n result.durationMs = Math.max(\n 0,\n Date.parse(last.endedAt) - Date.parse(first.startedAt),\n );\n result.attempts = group.map((document) => {\n const { cases: _cases, ...attempt } = buildDocument(\n documentId,\n document,\n [],\n context,\n project.plans?.find(\n (plan) => plan.documentId === document.documentId,\n ),\n );\n return attempt;\n });\n }\n return result;\n });\n // Collection/setup failures can have Cases but no started document runtime.\n for (const documentId of new Set(\n project.cases.map((outcome) => outcome.documentId),\n )) {\n if (!documentCount.has(documentId)) {\n documents.push(\n buildDocument(\n documentId,\n undefined,\n project.cases.filter((outcome) => outcome.documentId === documentId),\n context,\n project.plans?.find((plan) => plan.documentId === documentId),\n ),\n );\n }\n }\n\n return {\n ...(project.plans ? { plans: project.plans } : {}),\n projectId: project.projectId,\n name: project.name,\n ...(project.platform?.trim() ? { platform: project.platform.trim() } : {}),\n status: project.status,\n retry: project.retry,\n ...(project.lifecycle\n ? {\n lifecycle: {\n status: project.lifecycle.status,\n startedAt: project.lifecycle.startedAt,\n endedAt: project.lifecycle.endedAt,\n durationMs: project.lifecycle.durationMs,\n ...(project.lifecycle.cleanup\n ? { cleanup: project.lifecycle.cleanup }\n : {}),\n ...(project.lifecycle.pendingOperations\n ? { pendingOperations: project.lifecycle.pendingOperations }\n : {}),\n ...(project.lifecycle.setupError\n ? {\n setupError: sanitizeReportError(project.lifecycle.setupError),\n }\n : {}),\n ...(project.lifecycle.teardownErrors?.length\n ? {\n teardownErrors:\n project.lifecycle.teardownErrors.map(sanitizeReportError),\n }\n : {}),\n },\n }\n : {}),\n documents,\n collectionErrors: project.collectionErrors.map((collectionError) => ({\n sourcePath: collectionError.sourcePath,\n error: sanitizeReportError(collectionError.error),\n })),\n };\n};\n\nexport function collectTestRunReportSources(\n result: RunReportInput,\n): TestRunReportSource[] {\n const sources: TestRunReportSource[] = [];\n for (const project of result.projects) {\n for (const document of project.documents) {\n for (const source of document.reportSources ?? [])\n sources.push({ ...source, scopeId: documentReportScope(document) });\n for (const sourcePath of (document.reportPaths ?? []).filter(\n (path) =>\n !document.reportSources?.some((source) => source.sourcePath === path),\n )) {\n sources.push({\n scopeId: documentReportScope(document),\n sourcePath,\n });\n }\n }\n for (const outcome of project.cases) {\n for (const attempt of outcome.attempts ??\n (outcome.run ? [outcome.run] : [])) {\n for (const source of attempt.reportSources ?? [])\n sources.push({ ...source, scopeId: attemptReportScope(attempt) });\n for (const sourcePath of (attempt.reportPaths ?? []).filter(\n (path) =>\n !attempt.reportSources?.some(\n (source) => source.sourcePath === path,\n ),\n )) {\n sources.push({ scopeId: attemptReportScope(attempt), sourcePath });\n }\n }\n }\n }\n return sources;\n}\n\nexport function buildTestRunReportDump(\n result: RunReportInput,\n index: TestRunReportSourceIndex,\n): TestRunReportDump {\n const sourcesByScope = new Map<string, IndexedTestRunReportSource[]>();\n const detailsByScopeAndExecution = new Map<\n string,\n TestRunReportAgentDetail\n >();\n for (const source of index.sources) {\n const scopeSources = sourcesByScope.get(source.scopeId) ?? [];\n scopeSources.push(source);\n sourcesByScope.set(source.scopeId, scopeSources);\n for (const executionId of source.executionIds) {\n detailsByScopeAndExecution.set(\n scopedExecutionKey(source.scopeId, executionId),\n { reportId: source.reportId, executionId },\n );\n }\n }\n const context: ManifestBuildContext = {\n diagnostics: (index.diagnostics ?? []).map((diagnostic) => ({\n ...diagnostic,\n message: sanitizeReportText(diagnostic.message),\n })),\n sourcesByScope,\n detailsByScopeAndExecution,\n tracedScopeByExecution: new Map(),\n expectedExecutions: new Set(),\n capturedExecutions: new Set(),\n executionMetrics: new Map(Object.entries(index.executionMetrics ?? {})),\n missingMetrics: new Set(),\n tracedScopes: new Set(),\n };\n for (const error of result.errors ?? []) {\n addDiagnostic(context, {\n level: 'error',\n code: 'run-infrastructure-error',\n message: sanitizeReportError(error).message,\n error: sanitizeReportError(error),\n });\n }\n for (const source of index.sources) {\n if (source.executionIds.length === 0) {\n addDiagnostic(context, {\n level: 'warning',\n code: 'source-without-executions',\n message: `Agent report contains no executions: ${source.sourcePath}`,\n scopeId: source.scopeId,\n sourcePaths: [source.sourcePath],\n });\n }\n }\n\n const projects = result.projects.map((project) =>\n buildProject(project, context),\n );\n for (const diagnostic of index.diagnostics ?? [])\n if (\n diagnostic.code === 'agent-source-unavailable' &&\n (!diagnostic.scopeId || !context.tracedScopes.has(diagnostic.scopeId))\n )\n context.missingMetrics.add(diagnostic.message);\n const metrics = sumTestRunReportMetrics(\n [\n ...(index.sources.length ||\n (!index.executionMetrics &&\n (index.metrics.modelCallCount || index.metrics.collection))\n ? [index.capturedMetrics ?? index.metrics]\n : []),\n ...[...context.executionMetrics.entries()]\n .filter(([id]) => !index.executionMetrics?.[id])\n .map(([, value]) => value),\n ],\n [...context.missingMetrics],\n );\n return {\n schemaVersion: 1,\n kind: 'test-runner',\n runId: result.runId,\n ...(result.operationLog\n ? { operationLogs: [{ ...result.operationLog }] }\n : {}),\n status: result.status,\n startedAt: result.startedAt,\n endedAt: result.endedAt,\n durationMs: result.durationMs,\n summary: { ...result.summary },\n metrics: {\n ...metrics,\n collection: {\n ...metrics.collection!,\n expectedExecutionCount: context.expectedExecutions.size,\n capturedExecutionCount: context.capturedExecutions.size,\n },\n },\n ...(index.executionMetrics || context.executionMetrics.size\n ? { executionMetrics: Object.fromEntries(context.executionMetrics) }\n : {}),\n projects,\n ...(context.diagnostics.length > 0\n ? { diagnostics: context.diagnostics }\n : {}),\n };\n}\n"],"names":["exactMidsceneDetailNodes","Set","scopedExecutionKey","scopeId","executionId","reportSourcesForScope","context","addDiagnostic","diagnostic","buildStep","step","plan","stepId","sanitizeReportText","sanitizeReportValue","sanitizeReportError","details","unresolvedExecutionIds","usage","missingUsage","trace","metrics","previousScope","Error","detail","reason","agentDetailDiagnostic","sources","source","collectionErrors","error","snapshots","evidenceCollection","snapshot","undefined","input","candidateTitle","prompt","sumTestRunReportMetrics","attemptReportScope","attempt","buildAttempt","buildCase","outcome","artifact","documentReportScope","document","buildDocument","documentId","cases","sourcePath","status","item","phase","buildProject","project","documentCount","Map","groups","currentGroup","group","documents","first","last","outcomes","previous","result","Math","Date","_cases","collectionError","collectTestRunReportSources","path","buildTestRunReportDump","index","sourcesByScope","detailsByScopeAndExecution","scopeSources","Object","projects","id","value"],"mappings":";;AA8BA,MAAMA,2BAA2B,IAAIC,IAAI;IACvC;IACA;IACA;CACD;AAcD,MAAMC,qBAAqB,CAACC,SAAiBC,cAC3C,GAAGD,QAAQ,MAAM,EAAEC,aAAa;AAElC,MAAMC,wBAAwB,CAC5BC,SACAH,UACiCG,QAAQ,cAAc,CAAC,GAAG,CAACH,YAAY,EAAE;AAE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C,CAAC,CAAC;QACN,QAAQA,OAAO,MAAM;QACrB,WAAWA,OAAO,SAAS;QAC3B,SAASA,OAAO,OAAO;QACvB,YAAYA,OAAO,UAAU;QAC7B,SAAS;YAAE,GAAGA,OAAO,OAAO;QAAC;QAC7B,SAAS;YACP,GAAG7C,OAAO;YACV,YAAY;gBACV,GAAGA,QAAQ,UAAU;gBACrB,wBAAwBf,QAAQ,kBAAkB,CAAC,IAAI;gBACvD,wBAAwBA,QAAQ,kBAAkB,CAAC,IAAI;YACzD;QACF;QACA,GAAIoE,MAAM,gBAAgB,IAAIpE,QAAQ,gBAAgB,CAAC,IAAI,GACvD;YAAE,kBAAkBwE,OAAO,WAAW,CAACxE,QAAQ,gBAAgB;QAAE,IACjE,CAAC,CAAC;QACNyE;QACA,GAAIzE,QAAQ,WAAW,CAAC,MAAM,GAAG,IAC7B;YAAE,aAAaA,QAAQ,WAAW;QAAC,IACnC,CAAC,CAAC;IACR;AACF"}
1
+ {"version":3,"file":"test-runner/reporting/test-run-report.mjs","sources":["../../../../src/test-runner/reporting/test-run-report.ts"],"sourcesContent":["import type {\n IndexedTestRunReportSource,\n TestRunReportAgentDetail,\n TestRunReportAttempt,\n TestRunReportCase,\n TestRunReportCasePlan,\n TestRunReportDiagnostic,\n TestRunReportDocument,\n TestRunReportDocumentPlan,\n TestRunReportDump,\n TestRunReportMetrics,\n TestRunReportPlannedStep,\n TestRunReportProject,\n TestRunReportSource,\n TestRunReportSourceIndex,\n TestRunReportStep,\n} from '../../test-run-report';\nimport type {\n CaseRunResult,\n StepRunResult,\n WorkflowDocumentRunResult,\n} from '../engine/types';\nimport { sumTestRunReportMetrics } from './metrics';\nimport {\n sanitizeReportError,\n sanitizeReportText,\n sanitizeReportValue,\n} from './sanitize';\nimport type { RunReportCaseInput, RunReportInput } from './types';\n\nconst exactMidsceneDetailNodes = new Set([\n 'aiAct',\n 'aiAssert',\n 'recordToReport',\n]);\n\ninterface ManifestBuildContext {\n diagnostics: TestRunReportDiagnostic[];\n sourcesByScope: Map<string, IndexedTestRunReportSource[]>;\n detailsByScopeAndExecution: Map<string, TestRunReportAgentDetail>;\n tracedScopeByExecution: Map<string, string>;\n expectedExecutions: Set<string>;\n capturedExecutions: Set<string>;\n executionMetrics: Map<string, TestRunReportMetrics>;\n missingMetrics: Set<string>;\n tracedScopes: Set<string>;\n}\n\nconst scopedExecutionKey = (scopeId: string, executionId: string): string =>\n `${scopeId}\\u0000${executionId}`;\n\nconst reportSourcesForScope = (\n context: ManifestBuildContext,\n scopeId: string,\n): IndexedTestRunReportSource[] => context.sourcesByScope.get(scopeId) ?? [];\n\nconst addDiagnostic = (\n context: ManifestBuildContext,\n diagnostic: TestRunReportDiagnostic,\n): void => {\n context.diagnostics.push(diagnostic);\n};\n\nconst buildStep = (\n step: StepRunResult,\n scopeId: string,\n context: ManifestBuildContext,\n executionId: string,\n plan?: TestRunReportPlannedStep,\n): TestRunReportStep => {\n const stepId = `${executionId}:${step.phase}:${step.stepIndex}`;\n if (step.status === 'not-run')\n return {\n id: stepId,\n ...(plan ? { planStepId: plan.id, title: plan.title } : {}),\n phase: step.phase,\n stepIndex: step.stepIndex,\n node: step.node,\n status: 'not-run',\n notRunReason: sanitizeReportText(step.notRunReason),\n ...(step.blockedBy ? { blockedBy: step.blockedBy } : {}),\n continuedAfterError: step.continuedAfterError,\n ...(step.waitForPreviousOperationMs\n ? { waitForPreviousOperationMs: step.waitForPreviousOperationMs }\n : {}),\n input: sanitizeReportValue(step.input),\n ...(step.error ? { error: sanitizeReportError(step.error) } : {}),\n ...(step.operations\n ? {\n operations: {\n ...step.operations,\n events: [...step.operations.events],\n },\n }\n : {}),\n };\n const details: TestRunReportAgentDetail[] = [];\n const unresolvedExecutionIds: string[] = [];\n const usage: TestRunReportMetrics[] = [];\n const missingUsage: string[] = [];\n for (const trace of step.report?.traces ?? []) {\n context.tracedScopes.add(scopeId);\n const metrics =\n context.executionMetrics.get(trace.executionId) ?? trace.metrics;\n if (metrics) {\n context.executionMetrics.set(trace.executionId, metrics);\n usage.push(metrics);\n }\n context.expectedExecutions.add(\n scopedExecutionKey(scopeId, trace.executionId),\n );\n const previousScope = context.tracedScopeByExecution.get(trace.executionId);\n if (previousScope && previousScope !== scopeId) {\n throw new Error(\n `Agent execution ${trace.executionId} was traced by multiple test scopes (${previousScope}, ${scopeId}).`,\n );\n }\n context.tracedScopeByExecution.set(trace.executionId, scopeId);\n const detail = context.detailsByScopeAndExecution.get(\n scopedExecutionKey(scopeId, trace.executionId),\n );\n if (detail) {\n details.push(detail);\n context.capturedExecutions.add(\n scopedExecutionKey(scopeId, trace.executionId),\n );\n } else {\n unresolvedExecutionIds.push(trace.executionId);\n if (!metrics) {\n const reason = `Model usage is unavailable for execution ${trace.executionId}.`;\n missingUsage.push(reason);\n context.missingMetrics.add(reason);\n }\n }\n }\n\n let agentDetailDiagnostic: string | undefined;\n if (unresolvedExecutionIds.length > 0) {\n agentDetailDiagnostic = `Agent detail could not be resolved for ${unresolvedExecutionIds.join(', ')}.`;\n const sources = reportSourcesForScope(context, scopeId);\n for (const executionId of unresolvedExecutionIds) {\n addDiagnostic(context, {\n level: 'warning',\n code: 'agent-detail-unresolved',\n message: `Agent detail could not be resolved for execution ${executionId} in test scope ${scopeId}.`,\n scopeId,\n executionId,\n stepId,\n ...(sources.length > 0\n ? { sourcePaths: sources.map((source) => source.sourcePath) }\n : {}),\n });\n }\n } else if (details.length === 0 && exactMidsceneDetailNodes.has(step.node)) {\n agentDetailDiagnostic =\n 'This Agent did not expose a stable execution reference for the Step.';\n addDiagnostic(context, {\n level: 'warning',\n code: 'agent-detail-unavailable',\n message: `No stable Agent execution reference was captured for ${step.node} in test scope ${scopeId}.`,\n scopeId,\n stepId,\n ...(reportSourcesForScope(context, scopeId).length > 0\n ? {\n sourcePaths: reportSourcesForScope(context, scopeId).map(\n (source) => source.sourcePath,\n ),\n }\n : {}),\n });\n }\n\n const collectionErrors =\n step.report?.collectionErrors?.map(sanitizeReportError) ?? [];\n for (const error of collectionErrors) {\n addDiagnostic(context, {\n level: 'warning',\n code: 'agent-source-unavailable',\n scopeId,\n stepId,\n error,\n message: `Report collection for ${step.node}: ${error.message}`,\n });\n }\n const snapshots =\n step.report?.sources?.flatMap((source) =>\n source.collection ? [source.collection] : [],\n ) ?? [];\n const evidenceCollection =\n snapshots.length ||\n collectionErrors.length ||\n details.length ||\n unresolvedExecutionIds.length\n ? {\n status: (collectionErrors.length ||\n unresolvedExecutionIds.length ||\n snapshots.some((snapshot) => snapshot.status === 'partial')\n ? details.length\n ? 'partial'\n : 'unknown'\n : 'complete') as 'complete' | 'partial' | 'unknown',\n ...(snapshots.length\n ? {\n capturedAt: snapshots\n .map((snapshot) => snapshot.capturedAt)\n .sort()\n .at(-1),\n }\n : {}),\n ...(collectionErrors.length ? { errors: collectionErrors } : {}),\n }\n : undefined;\n // A missing link does not invalidate usage already captured independently.\n if (\n !step.report?.traces.length &&\n collectionErrors.length &&\n !details.length\n ) {\n const reason = `Model usage could not be collected for step ${stepId}.`;\n missingUsage.push(reason);\n context.missingMetrics.add(reason);\n }\n\n const input = step.input as Record<string, unknown> | undefined;\n const candidateTitle =\n input?.prompt ?? input?.script ?? input?.scenario ?? input?.title;\n const prompt =\n typeof candidateTitle === 'string'\n ? candidateTitle\n : typeof candidateTitle === 'object' &&\n candidateTitle !== null &&\n 'prompt' in candidateTitle &&\n typeof candidateTitle.prompt === 'string'\n ? candidateTitle.prompt\n : undefined;\n return {\n id: stepId,\n ...(plan ? { planStepId: plan.id } : {}),\n phase: step.phase,\n stepIndex: step.stepIndex,\n node: step.node,\n ...(prompt ? { title: sanitizeReportText(prompt, 240) } : {}),\n status: step.status,\n continuedAfterError: step.continuedAfterError,\n ...(step.waitForPreviousOperationMs\n ? { waitForPreviousOperationMs: step.waitForPreviousOperationMs }\n : {}),\n startedAt: step.startedAt,\n endedAt: step.endedAt,\n durationMs: step.durationMs,\n ...(step.operations\n ? {\n operations: {\n ...step.operations,\n events: [...step.operations.events],\n },\n }\n : {}),\n input: sanitizeReportValue(step.input),\n ...(step.output\n ? {\n output: {\n ...(step.output.summary === undefined\n ? {}\n : { summary: sanitizeReportText(step.output.summary) }),\n ...(step.output.data === undefined\n ? {}\n : { data: sanitizeReportValue(step.output.data) }),\n },\n }\n : {}),\n ...(step.error ? { error: sanitizeReportError(step.error) } : {}),\n ...(details.length > 0 ? { agentDetails: details } : {}),\n ...(agentDetailDiagnostic ? { agentDetailDiagnostic } : {}),\n ...(usage.length || missingUsage.length\n ? { metrics: sumTestRunReportMetrics(usage, missingUsage) }\n : {}),\n ...(evidenceCollection\n ? {\n evidenceCollection: {\n ...evidenceCollection,\n ...(missingUsage.length ? { modelUsageUnavailable: true } : {}),\n },\n }\n : {}),\n };\n};\n\nconst attemptReportScope = (attempt: CaseRunResult): string =>\n attempt.reportScopeId ?? attempt.runId;\n\nconst buildAttempt = (\n attempt: CaseRunResult,\n context: ManifestBuildContext,\n plan?: TestRunReportCasePlan,\n): TestRunReportAttempt => {\n const scopeId = attemptReportScope(attempt);\n return {\n attemptId: attempt.runId,\n attemptIndex: attempt.attemptIndex,\n status: attempt.status,\n ...(attempt.executionStatus\n ? { executionStatus: attempt.executionStatus }\n : {}),\n ...(attempt.phases ? { phases: attempt.phases } : {}),\n ...(attempt.cleanup ? { cleanup: attempt.cleanup } : {}),\n ...(attempt.pendingOperations\n ? { pendingOperations: attempt.pendingOperations }\n : {}),\n ...(attempt.retryDecision ? { retryDecision: attempt.retryDecision } : {}),\n startedAt: attempt.startedAt,\n endedAt: attempt.endedAt,\n durationMs: attempt.durationMs,\n beforeEach: attempt.beforeEach.map((step) =>\n buildStep(\n step,\n scopeId,\n context,\n attempt.runId,\n plan?.beforeEach[step.stepIndex],\n ),\n ),\n steps: attempt.steps.map((step) =>\n buildStep(\n step,\n scopeId,\n context,\n attempt.runId,\n plan?.steps[step.stepIndex],\n ),\n ),\n afterEach: attempt.afterEach.map((step) =>\n buildStep(\n step,\n scopeId,\n context,\n attempt.runId,\n plan?.afterEach[step.stepIndex],\n ),\n ),\n ...(attempt.executionErrors?.length\n ? {\n hostErrors: attempt.executionErrors.map((error) => ({\n phase: 'execution' as const,\n error: sanitizeReportError(error),\n })),\n }\n : {}),\n ...(attempt.teardownErrors?.length\n ? { teardownErrors: attempt.teardownErrors.map(sanitizeReportError) }\n : {}),\n ...(reportSourcesForScope(context, scopeId).length > 0\n ? {\n scopeReportIds: reportSourcesForScope(context, scopeId).map(\n (source) => source.reportId,\n ),\n }\n : {}),\n };\n};\n\nconst buildCase = (\n outcome: RunReportCaseInput,\n context: ManifestBuildContext,\n plan?: TestRunReportCasePlan,\n): TestRunReportCase => ({\n ...(plan ? { plan } : {}),\n caseId: outcome.caseId,\n name: outcome.name,\n caseIndex: outcome.caseIndex,\n status: outcome.status,\n ...(outcome.notRunReason ? { notRunReason: outcome.notRunReason } : {}),\n attempts: (outcome.attempts ?? (outcome.run ? [outcome.run] : [])).map(\n (attempt) => buildAttempt(attempt, context, plan),\n ),\n});\n\nconst documentReportScope = (document: WorkflowDocumentRunResult): string =>\n document.reportScopeId ?? document.documentRunId;\n\nconst buildDocument = (\n documentId: string,\n document: WorkflowDocumentRunResult | undefined,\n cases: readonly RunReportCaseInput[],\n context: ManifestBuildContext,\n plan?: TestRunReportDocumentPlan,\n): TestRunReportDocument => {\n plan ??= document?.plan;\n const sourcePath =\n document?.sourcePath ?? cases[0]?.sourcePath ?? '<unknown>';\n const status =\n document?.status ??\n (cases.some((item) => item.status !== 'success') ? 'failed' : 'success');\n const scopeId = document ? documentReportScope(document) : undefined;\n return {\n documentId,\n ...(plan ? { plan } : {}),\n ...(document\n ? {\n logicalDocumentId: document.documentId,\n documentRunId: document.documentRunId,\n ...(document.attemptIndex === undefined\n ? {}\n : { attemptIndex: document.attemptIndex }),\n }\n : {}),\n sourcePath,\n status,\n ...(document?.executionStatus\n ? { executionStatus: document.executionStatus }\n : {}),\n ...(document?.phases ? { phases: document.phases } : {}),\n ...(document?.cleanup ? { cleanup: document.cleanup } : {}),\n ...(document?.pendingOperations\n ? { pendingOperations: document.pendingOperations }\n : {}),\n ...(document?.retryDecision\n ? { retryDecision: document.retryDecision }\n : {}),\n ...(document\n ? {\n startedAt: document.startedAt,\n endedAt: document.endedAt,\n durationMs: document.durationMs,\n }\n : {}),\n beforeAll: (document?.beforeAll ?? []).map((step) =>\n buildStep(\n step,\n scopeId!,\n context,\n document!.documentRunId,\n plan?.beforeAll[step.stepIndex],\n ),\n ),\n cases: cases.map((outcome) =>\n buildCase(\n outcome,\n context,\n plan?.cases.find((item) => item.caseId === outcome.caseId),\n ),\n ),\n afterAll: (document?.afterAll ?? []).map((step) =>\n buildStep(\n step,\n scopeId!,\n context,\n document!.documentRunId,\n plan?.afterAll[step.stepIndex],\n ),\n ),\n ...(document?.hostErrors?.length || document?.executionErrors?.length\n ? {\n hostErrors: [\n ...(document?.hostErrors ?? []),\n ...(document?.executionErrors ?? []).map((error) => ({\n phase: 'execution' as const,\n error,\n })),\n ].map(({ phase, error }) => ({\n phase,\n error: sanitizeReportError(error),\n })),\n }\n : {}),\n ...(document?.teardownErrors?.length\n ? { teardownErrors: document.teardownErrors.map(sanitizeReportError) }\n : {}),\n ...(scopeId && reportSourcesForScope(context, scopeId).length > 0\n ? {\n scopeReportIds: reportSourcesForScope(context, scopeId).map(\n (source) => source.reportId,\n ),\n }\n : {}),\n };\n};\n\nconst buildProject = (\n project: RunReportInput['projects'][number],\n context: ManifestBuildContext,\n): TestRunReportProject => {\n const documentCount = new Map<string, number>();\n for (const document of project.documents) {\n documentCount.set(\n document.documentId,\n (documentCount.get(document.documentId) ?? 0) + 1,\n );\n }\n for (const outcome of project.cases) {\n if (\n (documentCount.get(outcome.documentId) ?? 0) > 1 &&\n !outcome.documentRunId\n ) {\n throw new Error(\n `Case ${outcome.caseId} must identify its documentRunId when a document has multiple attempts.`,\n );\n }\n }\n // A new attemptIndex 0 begins a distinct invocation of the same file. Only\n // whole-file retries belong to one logical document and its Case history.\n const groups: WorkflowDocumentRunResult[][] = [];\n const currentGroup = new Map<string, WorkflowDocumentRunResult[]>();\n for (const document of project.documents) {\n let group = currentGroup.get(document.documentId);\n if (!group || !document.attemptIndex) {\n group = [];\n groups.push(group);\n currentGroup.set(document.documentId, group);\n }\n group.push(document);\n }\n const documents = groups.map((group) => {\n const first = group[0];\n const last = group.at(-1)!;\n const documentId =\n groups.filter((item) => item[0].documentId === first.documentId).length >\n 1\n ? `${first.documentId}:${first.documentRunId}`\n : first.documentId;\n const outcomes = new Map<string, RunReportCaseInput>();\n for (const document of group) {\n for (const outcome of project.cases.filter(\n (item) =>\n item.documentId === document.documentId &&\n (!item.documentRunId ||\n item.documentRunId === document.documentRunId),\n )) {\n const previous = outcomes.get(outcome.caseId);\n outcomes.set(outcome.caseId, {\n ...outcome,\n attempts: [\n ...(previous?.attempts ?? []),\n ...(outcome.attempts ?? (outcome.run ? [outcome.run] : [])).map(\n (attempt) => ({\n ...attempt,\n attemptIndex: document.attemptIndex ?? attempt.attemptIndex,\n }),\n ),\n ],\n });\n }\n }\n const result = buildDocument(\n documentId,\n last,\n [...outcomes.values()],\n context,\n project.plans?.find((plan) => plan.documentId === last.documentId),\n );\n if (group.length > 1) {\n result.startedAt = first.startedAt;\n result.durationMs = Math.max(\n 0,\n Date.parse(last.endedAt) - Date.parse(first.startedAt),\n );\n result.attempts = group.map((document) => {\n const { cases: _cases, ...attempt } = buildDocument(\n documentId,\n document,\n [],\n context,\n project.plans?.find(\n (plan) => plan.documentId === document.documentId,\n ),\n );\n return attempt;\n });\n }\n return result;\n });\n // Collection/setup failures can have Cases but no started document runtime.\n for (const documentId of new Set(\n project.cases.map((outcome) => outcome.documentId),\n )) {\n if (!documentCount.has(documentId)) {\n documents.push(\n buildDocument(\n documentId,\n undefined,\n project.cases.filter((outcome) => outcome.documentId === documentId),\n context,\n project.plans?.find((plan) => plan.documentId === documentId),\n ),\n );\n }\n }\n\n return {\n ...(project.plans ? { plans: project.plans } : {}),\n projectId: project.projectId,\n name: project.name,\n ...(project.platform?.trim() ? { platform: project.platform.trim() } : {}),\n status: project.status,\n retry: project.retry,\n ...(project.lifecycle\n ? {\n lifecycle: {\n status: project.lifecycle.status,\n startedAt: project.lifecycle.startedAt,\n endedAt: project.lifecycle.endedAt,\n durationMs: project.lifecycle.durationMs,\n ...(project.lifecycle.cleanup\n ? { cleanup: project.lifecycle.cleanup }\n : {}),\n ...(project.lifecycle.pendingOperations\n ? { pendingOperations: project.lifecycle.pendingOperations }\n : {}),\n ...(project.lifecycle.setupError\n ? {\n setupError: sanitizeReportError(project.lifecycle.setupError),\n }\n : {}),\n ...(project.lifecycle.teardownErrors?.length\n ? {\n teardownErrors:\n project.lifecycle.teardownErrors.map(sanitizeReportError),\n }\n : {}),\n },\n }\n : {}),\n documents,\n collectionErrors: project.collectionErrors.map((collectionError) => ({\n sourcePath: collectionError.sourcePath,\n error: sanitizeReportError(collectionError.error),\n })),\n };\n};\n\nexport function collectTestRunReportSources(\n result: RunReportInput,\n): TestRunReportSource[] {\n const sources: TestRunReportSource[] = [];\n for (const project of result.projects) {\n for (const document of project.documents) {\n for (const source of document.reportSources ?? [])\n sources.push({ ...source, scopeId: documentReportScope(document) });\n for (const sourcePath of (document.reportPaths ?? []).filter(\n (path) =>\n !document.reportSources?.some((source) => source.sourcePath === path),\n )) {\n sources.push({\n scopeId: documentReportScope(document),\n sourcePath,\n });\n }\n }\n for (const outcome of project.cases) {\n for (const attempt of outcome.attempts ??\n (outcome.run ? [outcome.run] : [])) {\n for (const source of attempt.reportSources ?? [])\n sources.push({ ...source, scopeId: attemptReportScope(attempt) });\n for (const sourcePath of (attempt.reportPaths ?? []).filter(\n (path) =>\n !attempt.reportSources?.some(\n (source) => source.sourcePath === path,\n ),\n )) {\n sources.push({ scopeId: attemptReportScope(attempt), sourcePath });\n }\n }\n }\n }\n return sources;\n}\n\nexport function buildTestRunReportDump(\n result: RunReportInput,\n index: TestRunReportSourceIndex,\n): TestRunReportDump {\n const sourcesByScope = new Map<string, IndexedTestRunReportSource[]>();\n const detailsByScopeAndExecution = new Map<\n string,\n TestRunReportAgentDetail\n >();\n for (const source of index.sources) {\n const scopeSources = sourcesByScope.get(source.scopeId) ?? [];\n scopeSources.push(source);\n sourcesByScope.set(source.scopeId, scopeSources);\n for (const executionId of source.executionIds) {\n detailsByScopeAndExecution.set(\n scopedExecutionKey(source.scopeId, executionId),\n { reportId: source.reportId, executionId },\n );\n }\n }\n const context: ManifestBuildContext = {\n diagnostics: (index.diagnostics ?? []).map((diagnostic) => ({\n ...diagnostic,\n message: sanitizeReportText(diagnostic.message),\n })),\n sourcesByScope,\n detailsByScopeAndExecution,\n tracedScopeByExecution: new Map(),\n expectedExecutions: new Set(),\n capturedExecutions: new Set(),\n executionMetrics: new Map(Object.entries(index.executionMetrics ?? {})),\n missingMetrics: new Set(),\n tracedScopes: new Set(),\n };\n for (const error of result.errors ?? []) {\n addDiagnostic(context, {\n level: 'error',\n code: 'run-infrastructure-error',\n message: sanitizeReportError(error).message,\n error: sanitizeReportError(error),\n });\n }\n for (const source of index.sources) {\n if (source.executionIds.length === 0) {\n addDiagnostic(context, {\n level: 'warning',\n code: 'source-without-executions',\n message: `Agent report contains no executions: ${source.sourcePath}`,\n scopeId: source.scopeId,\n sourcePaths: [source.sourcePath],\n });\n }\n }\n\n const projects = result.projects.map((project) =>\n buildProject(project, context),\n );\n for (const diagnostic of index.diagnostics ?? [])\n if (\n diagnostic.code === 'agent-source-unavailable' &&\n (!diagnostic.scopeId || !context.tracedScopes.has(diagnostic.scopeId))\n )\n context.missingMetrics.add(diagnostic.message);\n const metrics = sumTestRunReportMetrics(\n [\n ...(index.sources.length ||\n (!index.executionMetrics &&\n (index.metrics.modelCallCount || index.metrics.collection))\n ? [index.capturedMetrics ?? index.metrics]\n : []),\n ...[...context.executionMetrics.entries()]\n .filter(([id]) => !index.executionMetrics?.[id])\n .map(([, value]) => value),\n ],\n [...context.missingMetrics],\n );\n return {\n schemaVersion: 1,\n kind: 'test-runner',\n runId: result.runId,\n ...(result.operationLog\n ? { operationLogs: [{ ...result.operationLog }] }\n : {}),\n status: result.status,\n startedAt: result.startedAt,\n endedAt: result.endedAt,\n durationMs: result.durationMs,\n summary: { ...result.summary },\n metrics: {\n ...metrics,\n collection: {\n ...metrics.collection!,\n expectedExecutionCount: context.expectedExecutions.size,\n capturedExecutionCount: context.capturedExecutions.size,\n },\n },\n ...(index.executionMetrics || context.executionMetrics.size\n ? { executionMetrics: Object.fromEntries(context.executionMetrics) }\n : {}),\n projects,\n ...(context.diagnostics.length > 0\n ? { diagnostics: context.diagnostics }\n : {}),\n };\n}\n"],"names":["exactMidsceneDetailNodes","Set","scopedExecutionKey","scopeId","executionId","reportSourcesForScope","context","addDiagnostic","diagnostic","buildStep","step","plan","stepId","sanitizeReportText","sanitizeReportValue","sanitizeReportError","details","unresolvedExecutionIds","usage","missingUsage","trace","metrics","previousScope","Error","detail","reason","agentDetailDiagnostic","sources","source","collectionErrors","error","snapshots","evidenceCollection","snapshot","undefined","input","candidateTitle","prompt","sumTestRunReportMetrics","attemptReportScope","attempt","buildAttempt","buildCase","outcome","documentReportScope","document","buildDocument","documentId","cases","sourcePath","status","item","phase","buildProject","project","documentCount","Map","groups","currentGroup","group","documents","first","last","outcomes","previous","result","Math","Date","_cases","collectionError","collectTestRunReportSources","path","buildTestRunReportDump","index","sourcesByScope","detailsByScopeAndExecution","scopeSources","Object","projects","id","value"],"mappings":";;AA8BA,MAAMA,2BAA2B,IAAIC,IAAI;IACvC;IACA;IACA;CACD;AAcD,MAAMC,qBAAqB,CAACC,SAAiBC,cAC3C,GAAGD,QAAQ,MAAM,EAAEC,aAAa;AAElC,MAAMC,wBAAwB,CAC5BC,SACAH,UACiCG,QAAQ,cAAc,CAAC,GAAG,CAACH,YAAY,EAAE;AAE5E,MAAMI,gBAAgB,CACpBD,SACAE;IAEAF,QAAQ,WAAW,CAAC,IAAI,CAACE;AAC3B;AAEA,MAAMC,YAAY,CAChBC,MACAP,SACAG,SACAF,aACAO;IA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AU;gBACrB,wBAAwBf,QAAQ,kBAAkB,CAAC,IAAI;gBACvD,wBAAwBA,QAAQ,kBAAkB,CAAC,IAAI;YACzD;QACF;QACA,GAAImE,MAAM,gBAAgB,IAAInE,QAAQ,gBAAgB,CAAC,IAAI,GACvD;YAAE,kBAAkBuE,OAAO,WAAW,CAACvE,QAAQ,gBAAgB;QAAE,IACjE,CAAC,CAAC;QACNwE;QACA,GAAIxE,QAAQ,WAAW,CAAC,MAAM,GAAG,IAC7B;YAAE,aAAaA,QAAQ,WAAW;QAAC,IACnC,CAAC,CAAC;IACR;AACF"}
package/dist/es/utils.mjs CHANGED
@@ -184,7 +184,7 @@ function stringifyDumpData(data, indents) {
184
184
  return JSON.stringify(data, replacerForPageObject, indents);
185
185
  }
186
186
  function getVersion() {
187
- return "1.15.4-beta-20261013083552.0";
187
+ return "1.15.4";
188
188
  }
189
189
  function debugLog(...message) {
190
190
  const debugMode = process.env[MIDSCENE_DEBUG_MODE];
@@ -39,7 +39,6 @@ __webpack_require__.d(__webpack_exports__, {
39
39
  actionInputSchema: ()=>external_test_runner_nodes_js_namespaceObject.actionInputSchema,
40
40
  aiAssertInputSchema: ()=>external_test_runner_nodes_js_namespaceObject.aiAssertInputSchema,
41
41
  structuredUserPromptInputSchema: ()=>external_test_runner_nodes_js_namespaceObject.structuredUserPromptInputSchema,
42
- aiWaitForOptionsInputSchema: ()=>external_test_runner_nodes_js_namespaceObject.aiWaitForOptionsInputSchema,
43
42
  taskTitleStr: ()=>external_ui_utils_js_namespaceObject.taskTitleStr,
44
43
  extractInsightParam: ()=>external_ui_utils_js_namespaceObject.extractInsightParam,
45
44
  cacheFileExt: ()=>external_task_cache_js_namespaceObject.cacheFileExt,
@@ -90,7 +89,6 @@ exports.aiQueryInputSchema = __webpack_exports__.aiQueryInputSchema;
90
89
  exports.aiScrollInputSchema = __webpack_exports__.aiScrollInputSchema;
91
90
  exports.aiTapInputSchema = __webpack_exports__.aiTapInputSchema;
92
91
  exports.aiWaitForInputSchema = __webpack_exports__.aiWaitForInputSchema;
93
- exports.aiWaitForOptionsInputSchema = __webpack_exports__.aiWaitForOptionsInputSchema;
94
92
  exports.cacheFileExt = __webpack_exports__.cacheFileExt;
95
93
  exports.commonAgentTestRunnerNodeDefinitions = __webpack_exports__.commonAgentTestRunnerNodeDefinitions;
96
94
  exports.commonContextParser = __webpack_exports__.commonContextParser;
@@ -132,7 +130,6 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
132
130
  "aiScrollInputSchema",
133
131
  "aiTapInputSchema",
134
132
  "aiWaitForInputSchema",
135
- "aiWaitForOptionsInputSchema",
136
133
  "cacheFileExt",
137
134
  "commonAgentTestRunnerNodeDefinitions",
138
135
  "commonContextParser",
@@ -454,7 +454,7 @@ class TaskExecutor {
454
454
  this.invalidateFailedCacheHitLocates(runner, taskCountBeforeRun);
455
455
  ++replanCount;
456
456
  if (replanCount > replanningCycleLimit) {
457
- const errorMsg = `Replanned ${replanningCycleLimit} times, exceeding the limit. Please configure a larger value for replanningCycleLimit (or use MIDSCENE_REPLANNING_CYCLE_LIMIT) to handle more complex tasks.`;
457
+ const errorMsg = `Task stopped: the planning cycle limit (${replanningCycleLimit}) has been reached. This limit prevents the model from getting stuck in an endless planning loop. If your task requires more planning cycles, increase replanningCycleLimit or set the environment variable MIDSCENE_REPLANNING_CYCLE_LIMIT to a higher value. See https://midscenejs.com/zh/reference/#common for details.`;
458
458
  return appendFailedPlan(errorMsg, planIndex);
459
459
  }
460
460
  if (!conversationHistory.pendingFeedbackMessage) {