@qontinui/shared-types 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +128 -128
- package/dist/{Region.d-BbpFAWF4.d.cts → Region.d-DtT3UphX.d.cts} +81 -81
- package/dist/{Region.d-BbpFAWF4.d.ts → Region.d-DtT3UphX.d.ts} +81 -81
- package/dist/{TaskRunFindingActionType.d-B4VmmbB6.d.cts → TaskRunFindingActionType.d-CNIWogcU.d.cts} +53 -53
- package/dist/{TaskRunFindingActionType.d-B4VmmbB6.d.ts → TaskRunFindingActionType.d-CNIWogcU.d.ts} +53 -53
- package/dist/accessibility.cjs.map +1 -1
- package/dist/accessibility.d.cts +379 -379
- package/dist/accessibility.d.ts +379 -379
- package/dist/chat.cjs.map +1 -1
- package/dist/{chunk-ZK5MJEGT.js → chunk-CTBDIP7K.js} +1 -1
- package/dist/chunk-CTBDIP7K.js.map +1 -0
- package/dist/{chunk-YXD4WCYQ.js → chunk-ZUZ3OLOH.js} +1 -1
- package/dist/chunk-ZUZ3OLOH.js.map +1 -0
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +105 -105
- package/dist/config.d.ts +105 -105
- package/dist/constraints.cjs.map +1 -1
- package/dist/constraints.d.cts +372 -372
- package/dist/constraints.d.ts +372 -372
- package/dist/execution.cjs.map +1 -1
- package/dist/execution.d.cts +869 -869
- package/dist/execution.d.ts +869 -869
- package/dist/execution.js +1 -1
- package/dist/geometry.cjs.map +1 -1
- package/dist/geometry.d.cts +81 -81
- package/dist/geometry.d.ts +81 -81
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +589 -589
- package/dist/index.d.ts +589 -589
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/library.cjs.map +1 -1
- package/dist/rag.cjs.map +1 -1
- package/dist/rag.d.cts +579 -579
- package/dist/rag.d.ts +579 -579
- package/dist/runner.cjs.map +1 -1
- package/dist/runner.d.cts +147 -147
- package/dist/runner.d.ts +147 -147
- package/dist/scheduler.cjs.map +1 -1
- package/dist/scheduler.d.cts +692 -692
- package/dist/scheduler.d.ts +692 -692
- package/dist/state-machine.cjs.map +1 -1
- package/dist/state-machine.d.cts +1128 -1128
- package/dist/state-machine.d.ts +1128 -1128
- package/dist/targets.cjs.map +1 -1
- package/dist/targets.d.cts +270 -270
- package/dist/targets.d.ts +270 -270
- package/dist/task-run.cjs.map +1 -1
- package/dist/task-run.d.cts +1431 -1431
- package/dist/task-run.d.ts +1431 -1431
- package/dist/tauri-events.cjs.map +1 -1
- package/dist/tauri-events.d.cts +315 -202
- package/dist/tauri-events.d.ts +315 -202
- package/dist/tree-events.cjs.map +1 -1
- package/dist/tree-events.d.cts +483 -483
- package/dist/tree-events.d.ts +483 -483
- package/dist/ui-bridge-ir.cjs +37 -0
- package/dist/ui-bridge-ir.cjs.map +1 -1
- package/dist/ui-bridge-ir.d.cts +90 -1
- package/dist/ui-bridge-ir.d.ts +90 -1
- package/dist/ui-bridge-ir.js +37 -0
- package/dist/ui-bridge-ir.js.map +1 -1
- package/dist/workflow.cjs.map +1 -1
- package/dist/workflow.d.cts +1634 -1634
- package/dist/workflow.d.ts +1634 -1634
- package/dist/workflow.js +1 -1
- package/package.json +141 -141
- package/src/accessibility/_api.ts +17 -17
- package/src/accessibility/index.ts +1 -1
- package/src/canvas/index.ts +319 -319
- package/src/chat/_api.ts +23 -23
- package/src/chat/index.ts +1 -1
- package/src/config/_api.ts +13 -13
- package/src/config/index.ts +1 -1
- package/src/constraints/_api.ts +17 -17
- package/src/constraints/index.ts +1 -1
- package/src/discovery.ts +188 -188
- package/src/execution/_api.ts +483 -483
- package/src/execution/index.ts +1 -1
- package/src/generated/A11yAction.d.ts +11 -11
- package/src/generated/AccessibilityBackend.d.ts +12 -12
- package/src/generated/AccessibilityBounds.d.ts +17 -17
- package/src/generated/AccessibilityNode.d.ts +73 -73
- package/src/generated/AccessibilityRole.d.ts +93 -93
- package/src/generated/AccessibilityRoleCriterion.d.ts +13 -13
- package/src/generated/AccessibilitySelector.d.ts +76 -76
- package/src/generated/AccessibilitySnapshot.d.ts +43 -43
- package/src/generated/AccessibilityState.d.ts +67 -67
- package/src/generated/ActionExecutionBatch.d.ts +23 -23
- package/src/generated/ActionExecutionBatchResponse.d.ts +24 -24
- package/src/generated/ActionExecutionCreate.d.ts +124 -124
- package/src/generated/ActionExecutionListResponse.d.ts +20 -20
- package/src/generated/ActionExecutionResponse.d.ts +24 -24
- package/src/generated/ActionReliabilityStats.d.ts +54 -54
- package/src/generated/ActionResponse.d.ts +45 -45
- package/src/generated/ActionStatus.d.ts +11 -11
- package/src/generated/ActionType.d.ts +41 -41
- package/src/generated/ActiveStatesResult.d.ts +32 -32
- package/src/generated/AgenticPhaseOutput.d.ts +50 -50
- package/src/generated/AgenticStatus.d.ts +11 -11
- package/src/generated/AiWorkflow.d.ts +76 -76
- package/src/generated/ApiAssertion.d.ts +35 -35
- package/src/generated/ApiAssertionOperator.d.ts +11 -11
- package/src/generated/ApiAssertionType.d.ts +11 -11
- package/src/generated/ApiContentType.d.ts +11 -11
- package/src/generated/ApiVariableExtraction.d.ts +24 -24
- package/src/generated/AvailableTransitionsResult.d.ts +34 -34
- package/src/generated/BaseStepFields.d.ts +72 -72
- package/src/generated/BatchComputeEmbeddingRequest.d.ts +27 -27
- package/src/generated/BatchComputeEmbeddingResponse.d.ts +23 -23
- package/src/generated/BatchEmbeddingResult.d.ts +23 -23
- package/src/generated/BetweenIterations.d.ts +35 -35
- package/src/generated/BoundingBox.d.ts +18 -18
- package/src/generated/BuildPhaseConfig.d.ts +24 -24
- package/src/generated/BuiltinOverrideProposal.d.ts +27 -27
- package/src/generated/CanonicalStep.d.ts +60 -60
- package/src/generated/CatchUpPolicy.d.ts +12 -12
- package/src/generated/Category.d.ts +24 -24
- package/src/generated/CheckIssueDetail.d.ts +40 -40
- package/src/generated/CheckType.d.ts +21 -21
- package/src/generated/CodeExecutionStep.d.ts +88 -88
- package/src/generated/CommandMode.d.ts +11 -11
- package/src/generated/CommandStep.d.ts +183 -183
- package/src/generated/CommandStepPhase.d.ts +11 -11
- package/src/generated/ComponentActionInfo.d.ts +24 -24
- package/src/generated/ComponentActionRequest.d.ts +22 -22
- package/src/generated/ComputeEmbeddingRequest.d.ts +24 -24
- package/src/generated/ComputeEmbeddingResponse.d.ts +38 -38
- package/src/generated/ComputeTextEmbeddingRequest.d.ts +20 -20
- package/src/generated/ComputeTextEmbeddingResponse.d.ts +32 -32
- package/src/generated/ConditionScheduleConfig.d.ts +17 -17
- package/src/generated/ConditionStatus.d.ts +29 -29
- package/src/generated/Confidence.d.ts +11 -11
- package/src/generated/ConfidenceLevel.d.ts +11 -11
- package/src/generated/Constraint.d.ts +33 -33
- package/src/generated/ConstraintCheck.d.ts +64 -64
- package/src/generated/ConstraintProposal.d.ts +37 -37
- package/src/generated/ConstraintResult.d.ts +32 -32
- package/src/generated/ConstraintSeverity.d.ts +16 -16
- package/src/generated/ConstraintViolation.d.ts +24 -24
- package/src/generated/Context.d.ts +50 -50
- package/src/generated/ContextAutoInclude.d.ts +34 -34
- package/src/generated/CoordinateSystem.d.ts +12 -12
- package/src/generated/Coordinates.d.ts +33 -33
- package/src/generated/CostTrendDataPoint.d.ts +36 -36
- package/src/generated/CostTrendResponse.d.ts +41 -41
- package/src/generated/CoverageData.d.ts +52 -52
- package/src/generated/CreateMcpCallInput.d.ts +59 -59
- package/src/generated/CreateMcpServerInput.d.ts +48 -48
- package/src/generated/CreateOlConfigRequest.d.ts +27 -27
- package/src/generated/CreateScheduledTaskRequest.d.ts +63 -63
- package/src/generated/CreateTaskRunRequest.d.ts +51 -51
- package/src/generated/CriterionOverride.d.ts +39 -39
- package/src/generated/CriterionType.d.ts +11 -11
- package/src/generated/DagApprovalStep.d.ts +80 -80
- package/src/generated/DagCancelStep.d.ts +76 -76
- package/src/generated/DagLoopStep.d.ts +80 -80
- package/src/generated/DecomposerConfig.d.ts +31 -31
- package/src/generated/DiagnosePhaseConfig.d.ts +34 -34
- package/src/generated/DiagnosticResult.d.ts +40 -40
- package/src/generated/DiscoveredElement.d.ts +48 -48
- package/src/generated/DiscoveredState.d.ts +49 -49
- package/src/generated/DiscoveredStateImage.d.ts +56 -56
- package/src/generated/DiscoveredTransition.d.ts +44 -44
- package/src/generated/DiscoveryBoundingBox.d.ts +32 -32
- package/src/generated/DiscoveryRequest.d.ts +40 -40
- package/src/generated/DiscoveryResponse.d.ts +32 -32
- package/src/generated/DiscoverySourceType.d.ts +14 -14
- package/src/generated/DiscoveryStrategy.d.ts +13 -13
- package/src/generated/DiscoveryTransitionTrigger.d.ts +38 -38
- package/src/generated/DisplayNode.d.ts +45 -45
- package/src/generated/DomainAssignment.d.ts +50 -50
- package/src/generated/DomainKnowledge.d.ts +29 -29
- package/src/generated/DomainVerificationResult.d.ts +36 -36
- package/src/generated/ElementActionRequest.d.ts +28 -28
- package/src/generated/ElementBbox.d.ts +36 -36
- package/src/generated/ElementIdentifier.d.ts +40 -40
- package/src/generated/ElementRect.d.ts +48 -48
- package/src/generated/ElementState.d.ts +47 -47
- package/src/generated/ElementType.d.ts +45 -45
- package/src/generated/EmbeddedElement.d.ts +36 -36
- package/src/generated/EmbeddingItem.d.ts +49 -49
- package/src/generated/EmbeddingListResponse.d.ts +22 -22
- package/src/generated/EmbeddingResultItem.d.ts +29 -29
- package/src/generated/EmbeddingResultsRequest.d.ts +19 -19
- package/src/generated/EmbeddingResultsResponse.d.ts +17 -17
- package/src/generated/ErrorType.d.ts +18 -18
- package/src/generated/ExecutePlaybookStep.d.ts +84 -84
- package/src/generated/ExecutionActionType.d.ts +40 -40
- package/src/generated/ExecutionIssueBatch.d.ts +19 -19
- package/src/generated/ExecutionIssueBatchResponse.d.ts +24 -24
- package/src/generated/ExecutionIssueCreate.d.ts +57 -57
- package/src/generated/ExecutionIssueDetail.d.ts +89 -89
- package/src/generated/ExecutionIssueListResponse.d.ts +26 -26
- package/src/generated/ExecutionIssueResponse.d.ts +24 -24
- package/src/generated/ExecutionIssueUpdate.d.ts +31 -31
- package/src/generated/ExecutionMatchLocation.d.ts +31 -31
- package/src/generated/ExecutionRunComplete.d.ts +34 -34
- package/src/generated/ExecutionRunCompleteResponse.d.ts +38 -38
- package/src/generated/ExecutionRunCreate.d.ts +40 -40
- package/src/generated/ExecutionRunDetail.d.ts +76 -76
- package/src/generated/ExecutionRunListResponse.d.ts +22 -22
- package/src/generated/ExecutionRunResponse.d.ts +41 -41
- package/src/generated/ExecutionScreenshotCreate.d.ts +59 -59
- package/src/generated/ExecutionScreenshotResponse.d.ts +36 -36
- package/src/generated/ExecutionStats.d.ts +56 -56
- package/src/generated/ExecutionStep.d.ts +78 -78
- package/src/generated/ExecutionTreeResponse.d.ts +42 -42
- package/src/generated/ExecutionTrendDataPoint.d.ts +36 -36
- package/src/generated/ExecutionTrendResponse.d.ts +46 -46
- package/src/generated/ExitCheckResult.d.ts +20 -20
- package/src/generated/ExitStrategy.d.ts +27 -27
- package/src/generated/ExportResult.d.ts +30 -30
- package/src/generated/ExtendIterationsRequest.d.ts +20 -20
- package/src/generated/FileChange.d.ts +20 -20
- package/src/generated/Finding.d.ts +40 -40
- package/src/generated/FindingActionType.d.ts +13 -13
- package/src/generated/FindingBatchCreate.d.ts +27 -27
- package/src/generated/FindingCategory.d.ts +25 -25
- package/src/generated/FindingCodeContext.d.ts +31 -31
- package/src/generated/FindingCreate.d.ts +52 -52
- package/src/generated/FindingDetail.d.ts +78 -78
- package/src/generated/FindingListResponse.d.ts +40 -40
- package/src/generated/FindingOutput.d.ts +36 -36
- package/src/generated/FindingSeverity.d.ts +14 -14
- package/src/generated/FindingStatus.d.ts +15 -15
- package/src/generated/FindingSummary.d.ts +53 -53
- package/src/generated/FindingUpdate.d.ts +33 -33
- package/src/generated/FindingUserInput.d.ts +27 -27
- package/src/generated/FindingsSummary.d.ts +47 -47
- package/src/generated/FullRunnerStep.d.ts +144 -144
- package/src/generated/GUIElementChunk.d.ts +151 -151
- package/src/generated/GateEvaluationResult.d.ts +36 -36
- package/src/generated/HealthCheckUrl.d.ts +35 -35
- package/src/generated/HistoricalActionQuery.d.ts +42 -42
- package/src/generated/HistoricalActionResult.d.ts +57 -57
- package/src/generated/HttpConfig.d.ts +27 -27
- package/src/generated/HttpMethod.d.ts +13 -13
- package/src/generated/IdleCondition.d.ts +17 -17
- package/src/generated/ImplementFixesConfig.d.ts +25 -25
- package/src/generated/IndividualCheckResult.d.ts +50 -50
- package/src/generated/InitialStateRef.d.ts +23 -23
- package/src/generated/InitialStatesSource.d.ts +18 -18
- package/src/generated/IssueSeverity.d.ts +11 -11
- package/src/generated/IssueSource.d.ts +11 -11
- package/src/generated/IssueStatus.d.ts +11 -11
- package/src/generated/IssueType.d.ts +21 -21
- package/src/generated/IterationResult.d.ts +65 -65
- package/src/generated/IterationVerificationResults.d.ts +53 -53
- package/src/generated/JobItem.d.ts +31 -31
- package/src/generated/JobListResponse.d.ts +20 -20
- package/src/generated/JobStatus.d.ts +11 -11
- package/src/generated/JobSummary.d.ts +30 -30
- package/src/generated/LLMCostSummary.d.ts +38 -38
- package/src/generated/LLMMetrics.d.ts +42 -42
- package/src/generated/LogSourceSelection.d.ts +25 -25
- package/src/generated/LoopInstanceStatus.d.ts +28 -28
- package/src/generated/LoopPhase.d.ts +26 -26
- package/src/generated/MatchAdjustment.d.ts +23 -23
- package/src/generated/MatchLocation.d.ts +22 -22
- package/src/generated/MatchMethod.d.ts +11 -11
- package/src/generated/McpCallRecord.d.ts +35 -35
- package/src/generated/McpCallsResult.d.ts +44 -44
- package/src/generated/McpConnectionRef.d.ts +25 -25
- package/src/generated/McpServerConfig.d.ts +77 -77
- package/src/generated/McpServerStatus.d.ts +42 -42
- package/src/generated/McpToolCallResult.d.ts +38 -38
- package/src/generated/McpToolInfo.d.ts +23 -23
- package/src/generated/McpToolInputSchema.d.ts +34 -34
- package/src/generated/McpTransport.d.ts +15 -15
- package/src/generated/ModelCostBreakdown.d.ts +36 -36
- package/src/generated/ModelOverrideConfig.d.ts +47 -47
- package/src/generated/Monitor.d.ts +48 -48
- package/src/generated/MonitorPosition.d.ts +13 -13
- package/src/generated/MouseButton.d.ts +13 -13
- package/src/generated/MultiLoopConfig.d.ts +32 -32
- package/src/generated/MultiLoopEntry.d.ts +32 -32
- package/src/generated/MultiLoopStatus.d.ts +37 -37
- package/src/generated/NativeAccessibilityStep.d.ts +121 -121
- package/src/generated/NavigationResult.d.ts +40 -40
- package/src/generated/NewConstraintProposal.d.ts +20 -20
- package/src/generated/NextTaskInfo.d.ts +24 -24
- package/src/generated/NodeMetadata.d.ts +47 -47
- package/src/generated/NodeStatus.d.ts +11 -11
- package/src/generated/NodeType.d.ts +11 -11
- package/src/generated/OcrEngine.d.ts +11 -11
- package/src/generated/OlConfig.d.ts +48 -48
- package/src/generated/OrchestrationLoopConfig.d.ts +87 -87
- package/src/generated/OrchestrationLoopStatus.d.ts +59 -59
- package/src/generated/Outcome.d.ts +15 -15
- package/src/generated/OutputLine.d.ts +23 -23
- package/src/generated/OutputStream.d.ts +11 -11
- package/src/generated/OverrideCollection.d.ts +18 -18
- package/src/generated/Pagination.d.ts +28 -28
- package/src/generated/ParserType.d.ts +17 -17
- package/src/generated/PathElement.d.ts +17 -17
- package/src/generated/PathfindingRequest.d.ts +24 -24
- package/src/generated/PathfindingResult.d.ts +30 -30
- package/src/generated/PathfindingStep.d.ts +36 -36
- package/src/generated/PatternOptions.d.ts +32 -32
- package/src/generated/PipelineConfig.d.ts +31 -31
- package/src/generated/PlaybackFrameRequest.d.ts +21 -21
- package/src/generated/PlaywrightExecutionMode.d.ts +11 -11
- package/src/generated/Point.d.ts +20 -20
- package/src/generated/PollingConfig.d.ts +14 -14
- package/src/generated/ProcessConfig.d.ts +96 -96
- package/src/generated/ProcessState.d.ts +15 -15
- package/src/generated/ProcessStatus.d.ts +41 -41
- package/src/generated/PromptStep.d.ts +92 -92
- package/src/generated/PromptStepPhase.d.ts +13 -13
- package/src/generated/RAGDashboardStats.d.ts +26 -26
- package/src/generated/RagCompletionEvent.d.ts +25 -25
- package/src/generated/RagProcessingStatus.d.ts +11 -11
- package/src/generated/RagProgressEvent.d.ts +27 -27
- package/src/generated/ReadConfigResponse.d.ts +20 -20
- package/src/generated/ReflectionFixOutput.d.ts +20 -20
- package/src/generated/Region.d.ts +39 -39
- package/src/generated/RepositoryInactiveCondition.d.ts +24 -24
- package/src/generated/RepositoryWatch.d.ts +20 -20
- package/src/generated/ResolvedInitialStates.d.ts +29 -29
- package/src/generated/ResolvedInitialStatesResult.d.ts +40 -40
- package/src/generated/ResourceLimits.d.ts +33 -33
- package/src/generated/RestartProcessStep.d.ts +88 -88
- package/src/generated/RetryPolicy.d.ts +24 -24
- package/src/generated/RetrySpec.d.ts +24 -24
- package/src/generated/RoleCriterion.d.ts +14 -14
- package/src/generated/RootCauseCategory.d.ts +18 -18
- package/src/generated/RoutingRule.d.ts +38 -38
- package/src/generated/RunPromptRequest.d.ts +56 -56
- package/src/generated/RunPromptResponse.d.ts +50 -50
- package/src/generated/RunPromptResponseData.d.ts +20 -20
- package/src/generated/RunStatus.d.ts +11 -11
- package/src/generated/RunType.d.ts +11 -11
- package/src/generated/Runner.d.ts +81 -81
- package/src/generated/RunnerCrash.d.ts +32 -32
- package/src/generated/RunnerFinding.d.ts +48 -48
- package/src/generated/RunnerFindingCodeContext.d.ts +20 -20
- package/src/generated/RunnerFindingUserInput.d.ts +19 -19
- package/src/generated/RunnerMetadata.d.ts +42 -42
- package/src/generated/RunnerStatus.d.ts +12 -12
- package/src/generated/RunnerUiError.d.ts +28 -28
- package/src/generated/RuntimeData.d.ts +40 -40
- package/src/generated/SaveWorkflowArtifactStep.d.ts +80 -80
- package/src/generated/ScheduleConditions.d.ts +29 -29
- package/src/generated/ScheduleExpression.d.ts +39 -39
- package/src/generated/ScheduledTask.d.ts +104 -104
- package/src/generated/ScheduledTaskStatus.d.ts +19 -19
- package/src/generated/ScheduledTaskType.d.ts +126 -126
- package/src/generated/SchedulerSettings.d.ts +28 -28
- package/src/generated/SchedulerStatus.d.ts +31 -31
- package/src/generated/ScreenshotAnnotation.d.ts +39 -39
- package/src/generated/ScreenshotAnnotationShape.d.ts +11 -11
- package/src/generated/ScreenshotType.d.ts +11 -11
- package/src/generated/ScrollDirection.d.ts +13 -13
- package/src/generated/SearchOptions.d.ts +33 -33
- package/src/generated/SearchResultItem.d.ts +19 -19
- package/src/generated/SearchStrategy.d.ts +14 -14
- package/src/generated/SemanticSearchRequest.d.ts +26 -26
- package/src/generated/SemanticSearchResponse.d.ts +21 -21
- package/src/generated/StageCondition.d.ts +37 -37
- package/src/generated/StageInput.d.ts +27 -27
- package/src/generated/StageOutput.d.ts +20 -20
- package/src/generated/StageTransition.d.ts +30 -30
- package/src/generated/StallDetectorConfig.d.ts +31 -31
- package/src/generated/StandardActionType.d.ts +40 -40
- package/src/generated/StateContext.d.ts +17 -17
- package/src/generated/StateDiscoveryResult.d.ts +104 -104
- package/src/generated/StateDiscoveryResultCreate.d.ts +65 -65
- package/src/generated/StateDiscoveryResultListResponse.d.ts +23 -23
- package/src/generated/StateDiscoveryResultSummary.d.ts +57 -57
- package/src/generated/StateDiscoveryResultUpdate.d.ts +47 -47
- package/src/generated/StateFilterItem.d.ts +18 -18
- package/src/generated/StateMachineConfig.d.ts +45 -45
- package/src/generated/StateMachineConfigCreate.d.ts +20 -20
- package/src/generated/StateMachineConfigFull.d.ts +67 -67
- package/src/generated/StateMachineConfigUpdate.d.ts +20 -20
- package/src/generated/StateMachineExport.d.ts +64 -64
- package/src/generated/StateMachineExportFormat.d.ts +39 -39
- package/src/generated/StateMachineImport.d.ts +25 -25
- package/src/generated/StateMachineState.d.ts +71 -71
- package/src/generated/StateMachineStateCreate.d.ts +52 -52
- package/src/generated/StateMachineStateUpdate.d.ts +48 -48
- package/src/generated/StateMachineTransition.d.ts +75 -75
- package/src/generated/StateMachineTransitionCreate.d.ts +53 -53
- package/src/generated/StateMachineTransitionUpdate.d.ts +53 -53
- package/src/generated/StateNodeData.d.ts +71 -71
- package/src/generated/StatesResponse.d.ts +19 -19
- package/src/generated/StdioConfig.d.ts +34 -34
- package/src/generated/StepExecutionConfig.d.ts +37 -37
- package/src/generated/StructuredFinding.d.ts +32 -32
- package/src/generated/StructuredOverride.d.ts +24 -24
- package/src/generated/StructuredSignal.d.ts +20 -20
- package/src/generated/SuccessCriterion.d.ts +57 -57
- package/src/generated/SummarizationConfig.d.ts +35 -35
- package/src/generated/TargetConfig.d.ts +108 -108
- package/src/generated/TaskCompletionResult.d.ts +90 -90
- package/src/generated/TaskExecutionRecord.d.ts +61 -61
- package/src/generated/TaskRun.d.ts +88 -88
- package/src/generated/TaskRunBackend.d.ts +86 -86
- package/src/generated/TaskRunBackendDetail.d.ts +99 -99
- package/src/generated/TaskRunCreate.d.ts +62 -62
- package/src/generated/TaskRunFilters.d.ts +38 -38
- package/src/generated/TaskRunFinding.d.ts +100 -100
- package/src/generated/TaskRunFindingActionType.d.ts +11 -11
- package/src/generated/TaskRunFindingCategory.d.ts +24 -24
- package/src/generated/TaskRunFindingCreate.d.ts +79 -79
- package/src/generated/TaskRunFindingFilters.d.ts +28 -28
- package/src/generated/TaskRunFindingSeverity.d.ts +11 -11
- package/src/generated/TaskRunFindingStatus.d.ts +11 -11
- package/src/generated/TaskRunFindingSummary.d.ts +34 -34
- package/src/generated/TaskRunFindingUpdate.d.ts +34 -34
- package/src/generated/TaskRunFindingsListResponse.d.ts +24 -24
- package/src/generated/TaskRunListResponse.d.ts +21 -21
- package/src/generated/TaskRunSession.d.ts +40 -40
- package/src/generated/TaskRunStatus.d.ts +11 -11
- package/src/generated/TaskRunUpdate.d.ts +47 -47
- package/src/generated/TaskType.d.ts +11 -11
- package/src/generated/TerminalExitEvent.d.ts +26 -26
- package/src/generated/TerminalInfo.d.ts +69 -69
- package/src/generated/TerminalOutputEvent.d.ts +29 -29
- package/src/generated/TestType.d.ts +11 -11
- package/src/generated/TextMatchType.d.ts +11 -11
- package/src/generated/TextSearchOptions.d.ts +30 -30
- package/src/generated/Ticket.d.ts +53 -53
- package/src/generated/TicketComment.d.ts +28 -28
- package/src/generated/TicketProviderConfig.d.ts +55 -55
- package/src/generated/TicketSource.d.ts +17 -17
- package/src/generated/TicketState.d.ts +15 -15
- package/src/generated/TimingInfo.d.ts +23 -23
- package/src/generated/TopMatch.d.ts +17 -17
- package/src/generated/TransitionAction.d.ts +93 -93
- package/src/generated/TransitionActionValue.d.ts +14 -14
- package/src/generated/TransitionEdgeData.d.ts +46 -46
- package/src/generated/TransitionExecutionResult.d.ts +30 -30
- package/src/generated/TransitionInfo.d.ts +29 -29
- package/src/generated/TransitionTriggerType.d.ts +13 -13
- package/src/generated/TreeEvent.d.ts +47 -47
- package/src/generated/TreeEventCreate.d.ts +30 -30
- package/src/generated/TreeEventListResponse.d.ts +30 -30
- package/src/generated/TreeEventResponse.d.ts +47 -47
- package/src/generated/TreeEventType.d.ts +20 -20
- package/src/generated/TreeNode.d.ts +54 -54
- package/src/generated/UIBridgeCapturedToast.d.ts +22 -22
- package/src/generated/UIBridgeComponent.d.ts +45 -45
- package/src/generated/UIBridgeElement.d.ts +62 -62
- package/src/generated/UIBridgeModalInfo.d.ts +40 -40
- package/src/generated/UIBridgeModalStack.d.ts +19 -19
- package/src/generated/UIBridgeSnapshot.d.ts +67 -67
- package/src/generated/UIBridgeToastContext.d.ts +17 -17
- package/src/generated/UIBridgeUndoContext.d.ts +19 -19
- package/src/generated/UiBridgeAction.d.ts +18 -18
- package/src/generated/UiBridgeAssertType.d.ts +11 -11
- package/src/generated/UiBridgeComparisonMode.d.ts +11 -11
- package/src/generated/UiBridgeDesignAuditStep.d.ts +76 -76
- package/src/generated/UiBridgeRequestEnvelope.d.ts +45 -0
- package/src/generated/UiBridgeResponseEnvelope.d.ts +66 -0
- package/src/generated/UiBridgeSeverity.d.ts +11 -11
- package/src/generated/UiBridgeStep.d.ts +127 -127
- package/src/generated/UiBridgeStepPhase.d.ts +14 -14
- package/src/generated/UiBridgeVisualAssertionStep.d.ts +97 -97
- package/src/generated/UnifiedStep.d.ts +57 -57
- package/src/generated/UnifiedWorkflow.d.ts +411 -411
- package/src/generated/UpdateMcpServerInput.d.ts +28 -28
- package/src/generated/UpdateOlConfigRequest.d.ts +32 -32
- package/src/generated/UpdateScheduledTaskRequest.d.ts +71 -71
- package/src/generated/ValidateConfigRequest.d.ts +16 -16
- package/src/generated/ValidateConfigResponse.d.ts +28 -28
- package/src/generated/VectorSearchResult.d.ts +48 -48
- package/src/generated/VerificationAgentContext.d.ts +25 -25
- package/src/generated/VerificationCategoryKind.d.ts +19 -19
- package/src/generated/VerificationMethod.d.ts +20 -20
- package/src/generated/VerificationPhaseResult.d.ts +63 -63
- package/src/generated/VerificationPlan.d.ts +43 -43
- package/src/generated/VerificationResult.d.ts +44 -44
- package/src/generated/VerificationResultResponse.d.ts +65 -65
- package/src/generated/VerificationResultsListResponse.d.ts +41 -41
- package/src/generated/VerificationStepDetails.d.ts +55 -55
- package/src/generated/VerificationStepResult.d.ts +68 -68
- package/src/generated/VgaAction.d.ts +61 -61
- package/src/generated/VgaActionKind.d.ts +14 -14
- package/src/generated/VgaAutomateStep.d.ts +110 -110
- package/src/generated/VirtualDesktop.d.ts +23 -23
- package/src/generated/VisualAssertionType.d.ts +11 -11
- package/src/generated/VisualComparisonResult.d.ts +40 -40
- package/src/generated/WaitOptions.d.ts +35 -35
- package/src/generated/WorkerCoordinationMessage.d.ts +93 -93
- package/src/generated/WorkerDomain.d.ts +29 -29
- package/src/generated/WorkerInstance.d.ts +62 -62
- package/src/generated/WorkerOutput.d.ts +53 -53
- package/src/generated/WorkerSignal.d.ts +48 -48
- package/src/generated/WorkerStatus.d.ts +11 -11
- package/src/generated/WorkflowArchitecture.d.ts +16 -16
- package/src/generated/WorkflowFixupMode.d.ts +11 -11
- package/src/generated/WorkflowFixupStep.d.ts +85 -85
- package/src/generated/WorkflowInfo.d.ts +28 -28
- package/src/generated/WorkflowMetadata.d.ts +44 -44
- package/src/generated/WorkflowRefStep.d.ts +94 -94
- package/src/generated/WorkflowStage.d.ts +126 -126
- package/src/generated/WorkflowStep.d.ts +80 -80
- package/src/generated/WorkflowStepPhase.d.ts +11 -11
- package/src/generated/WriteConfigRequest.d.ts +20 -20
- package/src/generated/WriteConfigResponse.d.ts +24 -24
- package/src/generated/index.ts +2 -0
- package/src/geometry/_api.ts +16 -16
- package/src/geometry/index.ts +1 -1
- package/src/index.ts +73 -73
- package/src/known-issues/index.ts +179 -179
- package/src/library/_api.ts +326 -326
- package/src/library/index.ts +1 -1
- package/src/rag/_api.ts +47 -47
- package/src/rag/index.ts +1 -1
- package/src/render-log.ts +371 -371
- package/src/runner/_api.ts +14 -14
- package/src/runner/index.ts +1 -1
- package/src/scheduler/_api.ts +21 -21
- package/src/scheduler/index.ts +1 -1
- package/src/state-machine/_api.ts +145 -145
- package/src/state-machine/index.ts +1 -1
- package/src/targets/_api.ts +47 -47
- package/src/targets/index.ts +1 -1
- package/src/task-run/_api.ts +108 -108
- package/src/task-run/index.ts +1 -1
- package/src/tauri-events/_api.ts +90 -76
- package/src/tauri-events/index.ts +1 -1
- package/src/tree-events/_api.ts +42 -42
- package/src/tree-events/index.ts +1 -1
- package/src/ui-bridge-ir/__tests__/projection.test.ts +1029 -1029
- package/src/ui-bridge-ir/adapter.ts +220 -220
- package/src/ui-bridge-ir/document.ts +114 -105
- package/src/ui-bridge-ir/element-criteria.ts +48 -48
- package/src/ui-bridge-ir/group.ts +84 -0
- package/src/ui-bridge-ir/index.ts +24 -23
- package/src/ui-bridge-ir/ir.schema.json +293 -235
- package/src/ui-bridge-ir/primitives.ts +102 -102
- package/src/ui-bridge-ir/projection.ts +921 -863
- package/src/ui-bridge-ir/state.ts +90 -90
- package/src/ui-bridge-ir/transition.ts +92 -92
- package/src/workflow/_api.ts +474 -474
- package/src/workflow/action-plan.ts +208 -208
- package/src/workflow/index.ts +1 -1
- package/src/workflow/skill.ts +152 -152
- package/dist/chunk-YXD4WCYQ.js.map +0 -1
- package/dist/chunk-ZK5MJEGT.js.map +0 -1
package/dist/ui-bridge-ir.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ui-bridge-ir/adapter.ts","../src/ui-bridge-ir/projection.ts"],"sourcesContent":["/**\r\n * IR -> WorkflowConfig adapter.\r\n *\r\n * Single point of translation between authoring-time IR (with provenance,\r\n * metadata, effect, crossRefs, visualRefs) and the runtime/storage shape\r\n * that ui-bridge-auto consumes. See ADR-001 (decision #6 / #7) for the\r\n * boundary rationale.\r\n *\r\n * The output is intentionally typed structurally — this module has no\r\n * runtime dependency on ui-bridge-auto. ui-bridge-auto's own tests verify\r\n * end-to-end compatibility with `engine.defineStates(...)` /\r\n * `engine.defineTransitions(...)` (see\r\n * `ui-bridge-auto/src/__tests__/spike-ir-contract.test.ts`).\r\n */\r\n\r\nimport type { IRElementCriteria } from \"./element-criteria\";\r\nimport type { IRDocument } from \"./document\";\r\nimport type { IRState, IRStateCondition } from \"./state\";\r\nimport type { IRTransition, IRTransitionAction, IRWaitSpec } from \"./transition\";\r\n\r\n// ---------------------------------------------------------------------------\r\n// Output shapes — structural mirrors of ui-bridge-auto's WorkflowConfig.\r\n// Kept in sync via ui-bridge-auto's regression test, NOT compile-time\r\n// imports (qontinui-schemas has no runtime deps by design).\r\n// ---------------------------------------------------------------------------\r\n\r\n/** Mirrors `StateConfig` from ui-bridge-auto/src/config/workflow.ts:47. */\r\nexport interface AdaptedState {\r\n id: string;\r\n name: string;\r\n description?: string;\r\n requiredElements: IRElementCriteria[];\r\n excludedElements?: IRElementCriteria[];\r\n conditions?: IRStateCondition[];\r\n isInitial?: boolean;\r\n isTerminal?: boolean;\r\n blocking?: boolean;\r\n group?: string;\r\n pathCost?: number;\r\n}\r\n\r\n/**\r\n * Mirrors the runtime `TransitionDefinition` shape from\r\n * ui-bridge-auto/src/state/state-machine.ts:40.\r\n *\r\n * Note: ui-bridge-auto has two related Transition shapes — the storage shape\r\n * (`TransitionConfig` in config/workflow.ts:54, with action field named\r\n * `type`) and the runtime engine shape (`TransitionDefinition` in\r\n * state-machine.ts:40, with action field named `action`). The runtime engine\r\n * is what consumers actually pass adapter output into via\r\n * `engine.defineTransitions(...)`, so the adapter targets the runtime shape.\r\n */\r\nexport interface AdaptedTransition {\r\n id: string;\r\n name: string;\r\n description?: string;\r\n fromStates: string[];\r\n activateStates: string[];\r\n /** Adapter normalizes IR's optional `exitStates` to a required array. */\r\n exitStates: string[];\r\n actions: AdaptedTransitionAction[];\r\n pathCost?: number;\r\n bidirectional?: boolean;\r\n}\r\n\r\n/**\r\n * Mirrors the runtime `TransitionAction` from\r\n * ui-bridge-auto/src/state/state-machine.ts:55.\r\n *\r\n * The IR uses `type` for the action verb (matching the storage-shape\r\n * convention); the adapter renames it to `action` for the runtime engine.\r\n *\r\n * `waitAfter` is narrower than `IRWaitSpec` — the runtime engine accepts\r\n * only a subset of wait types and a subset of fields. The adapter drops\r\n * IR-only wait variants (e.g., `state`, `condition`) and IR-only fields\r\n * (e.g., `property`, `quietPeriodMs`). Authors can still express richer\r\n * waits in the IR; they just don't survive the runtime contract.\r\n */\r\nexport interface AdaptedWaitAfter {\r\n type: \"idle\" | \"element\" | \"time\" | \"vanish\" | \"change\" | \"stable\";\r\n query?: IRElementCriteria;\r\n ms?: number;\r\n timeout?: number;\r\n}\r\n\r\nexport interface AdaptedTransitionAction {\r\n /** Action verb — renamed from IR's `type` to match the runtime contract. */\r\n action: string;\r\n target: IRElementCriteria;\r\n params?: Record<string, unknown>;\r\n waitAfter?: AdaptedWaitAfter;\r\n}\r\n\r\n/** Mirrors `WorkflowConfig` from ui-bridge-auto/src/config/workflow.ts:67. */\r\nexport interface AdaptedWorkflowConfig {\r\n id: string;\r\n name: string;\r\n description?: string;\r\n version?: string;\r\n states: AdaptedState[];\r\n transitions: AdaptedTransition[];\r\n initialState?: string;\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Adapter implementation\r\n// ---------------------------------------------------------------------------\r\n\r\nconst SUPPORTED_IR_VERSIONS = new Set<string>([\"1.0\"]);\r\n\r\n/**\r\n * Convert an IR state declaration into the runtime/storage state shape.\r\n * Strips IR-only fields (metadata, provenance, elementIds,\r\n * incomingTransitions, crossRefs, visualRefs).\r\n */\r\nexport function adaptIRState(state: IRState): AdaptedState {\r\n const out: AdaptedState = {\r\n id: state.id,\r\n name: state.name,\r\n requiredElements: state.requiredElements,\r\n };\r\n if (state.description !== undefined) out.description = state.description;\r\n if (state.excludedElements !== undefined) out.excludedElements = state.excludedElements;\r\n if (state.conditions !== undefined) out.conditions = state.conditions;\r\n if (state.isInitial !== undefined) out.isInitial = state.isInitial;\r\n if (state.isTerminal !== undefined) out.isTerminal = state.isTerminal;\r\n if (state.blocking !== undefined) out.blocking = state.blocking;\r\n if (state.group !== undefined) out.group = state.group;\r\n if (state.pathCost !== undefined) out.pathCost = state.pathCost;\r\n return out;\r\n}\r\n\r\n/**\r\n * Wait types the runtime engine accepts. IR-authored waits with other types\r\n * (e.g., `state`, `condition`) are dropped from the adapter output.\r\n */\r\nconst RUNTIME_WAIT_TYPES = new Set<AdaptedWaitAfter[\"type\"]>([\r\n \"idle\",\r\n \"element\",\r\n \"time\",\r\n \"vanish\",\r\n \"change\",\r\n \"stable\",\r\n]);\r\n\r\nfunction adaptIRWaitAfter(wait: IRWaitSpec): AdaptedWaitAfter | undefined {\r\n if (!RUNTIME_WAIT_TYPES.has(wait.type as AdaptedWaitAfter[\"type\"])) {\r\n // IR-authored wait is richer than runtime supports — drop it.\r\n // Runtime defaults (default idle behaviour) take over.\r\n return undefined;\r\n }\r\n const out: AdaptedWaitAfter = { type: wait.type as AdaptedWaitAfter[\"type\"] };\r\n if (wait.query !== undefined) out.query = wait.query;\r\n if (wait.ms !== undefined) out.ms = wait.ms;\r\n if (wait.timeout !== undefined) out.timeout = wait.timeout;\r\n return out;\r\n}\r\n\r\n/**\r\n * Convert an IR transition action into the runtime action shape.\r\n * Renames IR's `type` to runtime's `action`; narrows `waitAfter` to the\r\n * runtime-accepted subset.\r\n */\r\nexport function adaptIRTransitionAction(action: IRTransitionAction): AdaptedTransitionAction {\r\n const out: AdaptedTransitionAction = {\r\n action: action.type,\r\n target: action.target,\r\n };\r\n if (action.params !== undefined) out.params = action.params;\r\n if (action.waitAfter !== undefined) {\r\n const adaptedWait = adaptIRWaitAfter(action.waitAfter);\r\n if (adaptedWait !== undefined) out.waitAfter = adaptedWait;\r\n }\r\n return out;\r\n}\r\n\r\n/**\r\n * Convert an IR transition declaration into the runtime/storage transition\r\n * shape. Strips IR-only fields (effect, metadata, provenance, crossRefs)\r\n * and defaults `exitStates` to `[]` when omitted.\r\n */\r\nexport function adaptIRTransition(transition: IRTransition): AdaptedTransition {\r\n const out: AdaptedTransition = {\r\n id: transition.id,\r\n name: transition.name,\r\n fromStates: transition.fromStates,\r\n activateStates: transition.activateStates,\r\n exitStates: transition.exitStates ?? [],\r\n actions: transition.actions.map(adaptIRTransitionAction),\r\n };\r\n if (transition.description !== undefined) out.description = transition.description;\r\n if (transition.pathCost !== undefined) out.pathCost = transition.pathCost;\r\n if (transition.bidirectional !== undefined) out.bidirectional = transition.bidirectional;\r\n return out;\r\n}\r\n\r\n/**\r\n * Convert a top-level IR document into the runtime `WorkflowConfig` shape.\r\n *\r\n * Throws on unknown IR versions to fail loudly rather than silently emit\r\n * stale shapes.\r\n */\r\nexport function adaptIRDocumentToWorkflowConfig(doc: IRDocument): AdaptedWorkflowConfig {\r\n if (!SUPPORTED_IR_VERSIONS.has(doc.version)) {\r\n throw new Error(\r\n `adaptIRDocumentToWorkflowConfig: unsupported IR version \"${doc.version}\". ` +\r\n `Supported: ${Array.from(SUPPORTED_IR_VERSIONS).join(\", \")}`,\r\n );\r\n }\r\n\r\n const out: AdaptedWorkflowConfig = {\r\n id: doc.id,\r\n name: doc.name,\r\n states: doc.states.map(adaptIRState),\r\n transitions: doc.transitions.map(adaptIRTransition),\r\n };\r\n if (doc.description !== undefined) out.description = doc.description;\r\n if (doc.initialState !== undefined) out.initialState = doc.initialState;\r\n return out;\r\n}\r\n","/**\r\n * IR -> Bundled-Page Legacy Spec projection.\r\n *\r\n * Single point of translation between authoring-time IR (`IRDocument`) and the\r\n * legacy `*.spec.uibridge.json` shape that existing tooling still consumes\r\n * (`/update-spec`, runner spec drift / verify, error monitor curator,\r\n * spec experimentation, AI session). See ADR-001 (decision #6 / #7) for the\r\n * boundary rationale; section 2 of the UI Bridge redesign for the projection's\r\n * role in keeping legacy consumers working through the migration.\r\n *\r\n * The projection is a PURE FUNCTION — same input always produces byte-identical\r\n * output. Keys within objects are sorted lexicographically, arrays preserve\r\n * input order, and no timestamps / random IDs are introduced. Downstream tests\r\n * may hash the JSON output for byte-stable assertions.\r\n *\r\n * ---------------------------------------------------------------------------\r\n * Mapping rules (worked example below)\r\n * ---------------------------------------------------------------------------\r\n *\r\n * IRDocument LegacySpec\r\n * ---------- ----------\r\n * doc.id -> metadata.component\r\n * doc.metadata?.purpose ?? doc.id -> metadata.component (purpose wins if present)\r\n * doc.description ?? doc.name -> description\r\n * doc.metadata?.tags -> metadata.tags\r\n *\r\n * For each IRState:\r\n * state -> one entry in groups[]\r\n * state.id -> group.id\r\n * state.name -> group.name\r\n * state.description ??\r\n * state.metadata?.description -> group.description\r\n * \"element-presence\" -> group.category (default)\r\n * state.provenance?.source ??\r\n * \"ai-generated\" -> group.source\r\n *\r\n * For each requiredElement of state:\r\n * (state, criteria, index) -> one assertion in group.assertions[]\r\n * \"${state.id}-elem-${index}\" -> assertion.id\r\n * state.metadata?.description ?? -> assertion.description\r\n * \"Required element ${index} ...\"\r\n * \"element-presence\" -> assertion.category\r\n * \"critical\" -> assertion.severity\r\n * \"exists\" -> assertion.assertionType\r\n * {\r\n * type: \"search\",\r\n * criteria: convert(criteria), -> assertion.target\r\n * label: \"Required element ...\"\r\n * }\r\n * \"ai-generated\" -> assertion.source\r\n * false -> assertion.reviewed\r\n * true -> assertion.enabled\r\n *\r\n * If state has zero requiredElements, the projected `group.assertions[]`\r\n * is the empty array — legacy specs ship architecture-only groups with\r\n * empty assertions, and the inverse projection's identity round-trip\r\n * depends on preserving that emptiness. (Earlier versions emitted a\r\n * placeholder assertion here, which silently grew the assertion count\r\n * during round-trip and tripped `check-spec-pairing`.)\r\n *\r\n * Each IRState -> one entry in stateMachine.states[]\r\n * state.id -> sm-state.id\r\n * state.name -> sm-state.name\r\n * state.description ?? \"\" -> sm-state.description\r\n * state.requiredElements (converted) -> sm-state.elements\r\n * state.isInitial ??\r\n * (state.id === doc.initialState) -> sm-state.isInitial\r\n * transitions originating from state -> sm-state.transitions\r\n *\r\n * For each IRTransition:\r\n * For each fromState in transition.fromStates:\r\n * transition -> one entry in\r\n * stateMachine.states[fromState].transitions[]\r\n * transition.id -> sm-transition.id\r\n * transition.name -> sm-transition.name\r\n * transition.activateStates -> sm-transition.activateStates\r\n * transition.exitStates ?? [] -> sm-transition.deactivateStates\r\n * (exitStates.length === 0) -> sm-transition.staysVisible\r\n *\r\n * For each action in transition.actions:\r\n * action.type -> process[].action (rename type -> action)\r\n * action.target -> process[].target (criteria converted)\r\n * action.waitAfter -> process[].waitAfter (passed through)\r\n *\r\n * Element-criteria conversion (IRElementCriteria -> legacy criteria):\r\n * text -> textContent\r\n * ariaLabel -> accessibleName\r\n * attributes -> dataAttributes\r\n * (others — role, textContains, id — pass through unchanged)\r\n *\r\n * ---------------------------------------------------------------------------\r\n * Worked example\r\n * ---------------------------------------------------------------------------\r\n *\r\n * const ir: IRDocument = {\r\n * version: \"1.0\",\r\n * id: \"active\",\r\n * name: \"Active Dashboard\",\r\n * description: \"Real-time monitoring hub\",\r\n * metadata: { tags: [\"monitoring\", \"tier-1\"] },\r\n * states: [\r\n * {\r\n * id: \"running\",\r\n * name: \"Running\",\r\n * description: \"Workflow executing\",\r\n * requiredElements: [{ role: \"button\", text: \"Stop\" }],\r\n * isInitial: false,\r\n * },\r\n * ],\r\n * transitions: [\r\n * {\r\n * id: \"running-to-idle\",\r\n * name: \"Stop\",\r\n * fromStates: [\"running\"],\r\n * activateStates: [\"idle\"],\r\n * exitStates: [\"running\"],\r\n * actions: [\r\n * {\r\n * type: \"click\",\r\n * target: { role: \"button\", text: \"Stop\" },\r\n * waitAfter: { type: \"idle\", timeout: 3000 },\r\n * },\r\n * ],\r\n * },\r\n * ],\r\n * initialState: \"idle\",\r\n * };\r\n *\r\n * projectIRToBundledPage(ir, \"Notes from author\")\r\n * // -> {\r\n * // version: \"1.0.0\",\r\n * // description: \"Real-time monitoring hub\\n\\nNotes from author\",\r\n * // groups: [{\r\n * // id: \"running\",\r\n * // name: \"Running\",\r\n * // description: \"Workflow executing\",\r\n * // category: \"element-presence\",\r\n * // assertions: [{\r\n * // id: \"running-elem-0\",\r\n * // description: \"Required element 0 for state Running\",\r\n * // category: \"element-presence\",\r\n * // severity: \"critical\",\r\n * // assertionType: \"exists\",\r\n * // target: {\r\n * // type: \"search\",\r\n * // criteria: { role: \"button\", textContent: \"Stop\" },\r\n * // label: \"Required element for Running\",\r\n * // },\r\n * // source: \"ai-generated\",\r\n * // reviewed: false,\r\n * // enabled: true,\r\n * // }],\r\n * // source: \"ai-generated\",\r\n * // }],\r\n * // stateMachine: {\r\n * // states: [{\r\n * // id: \"running\",\r\n * // name: \"Running\",\r\n * // description: \"Workflow executing\",\r\n * // elements: [{ role: \"button\", textContent: \"Stop\" }],\r\n * // isInitial: false,\r\n * // transitions: [{\r\n * // id: \"running-to-idle\",\r\n * // name: \"Stop\",\r\n * // activateStates: [\"idle\"],\r\n * // deactivateStates: [\"running\"],\r\n * // staysVisible: false,\r\n * // process: [{\r\n * // action: \"click\",\r\n * // target: { role: \"button\", textContent: \"Stop\" },\r\n * // waitAfter: { type: \"idle\", timeout: 3000 },\r\n * // }],\r\n * // }],\r\n * // }],\r\n * // },\r\n * // metadata: { component: \"active\", tags: [\"monitoring\", \"tier-1\"] },\r\n * // }\r\n */\r\n\r\nimport type { IRElementCriteria } from \"./element-criteria\";\r\nimport type { IRDocument } from \"./document\";\r\nimport type { IRState } from \"./state\";\r\nimport type { IRTransition, IRTransitionAction, IRWaitSpec } from \"./transition\";\r\n\r\n/**\r\n * Projection version. Bump on shape changes that consumers must adapt to.\r\n * Independent from `IRVersion` because the legacy spec shape and the IR shape\r\n * evolve on different cadences.\r\n */\r\nexport const projectionVersion = \"1.0\";\r\n\r\n// ---------------------------------------------------------------------------\r\n// Legacy spec shapes — derived from active.spec.uibridge.json (the reference\r\n// the projection's output must structurally match).\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Legacy element-criteria shape (after conversion from `IRElementCriteria`).\r\n *\r\n * The differences from `IRElementCriteria`:\r\n * - `text` -> `textContent`\r\n * - `ariaLabel` -> `accessibleName` (when IR has no explicit `accessibleName`)\r\n * - `attributes` -> `dataAttributes`\r\n *\r\n * Other fields (`role`, `tagName`, `textContains`, `accessibleName`, `id`)\r\n * pass through unchanged. Index signature stays open for legacy fields the\r\n * IR doesn't yet model.\r\n */\r\nexport interface LegacyCriteria {\r\n role?: string;\r\n tagName?: string;\r\n textContent?: string;\r\n textContains?: string;\r\n accessibleName?: string;\r\n id?: string;\r\n dataAttributes?: Record<string, string>;\r\n [key: string]: unknown;\r\n}\r\n\r\n/**\r\n * Legacy assertion target. Always `type: \"search\"` for the projection — the\r\n * legacy schema also supports point/region targets, but the IR doesn't\r\n * express those.\r\n */\r\nexport interface LegacyAssertionTarget {\r\n type: \"search\";\r\n criteria: LegacyCriteria;\r\n label: string;\r\n}\r\n\r\n/**\r\n * Legacy assertion. Mirrors the shape used by `groups[].assertions[]` in\r\n * `*.spec.uibridge.json`.\r\n */\r\nexport interface LegacyAssertion {\r\n id: string;\r\n description: string;\r\n category: string;\r\n severity: \"critical\" | \"warning\" | \"info\";\r\n assertionType: string;\r\n target: LegacyAssertionTarget;\r\n source: string;\r\n reviewed: boolean;\r\n enabled: boolean;\r\n precondition?: string;\r\n}\r\n\r\n/**\r\n * Legacy group. One per IR state.\r\n */\r\nexport interface LegacyGroup {\r\n id: string;\r\n name: string;\r\n description: string;\r\n category: string;\r\n assertions: LegacyAssertion[];\r\n source: string;\r\n}\r\n\r\n/**\r\n * Process step within a transition. Note `action` (not `type`) — matches the\r\n * runtime engine's `TransitionAction` shape.\r\n */\r\nexport interface LegacyProcessStep {\r\n action: string;\r\n target: LegacyCriteria;\r\n waitAfter?: IRWaitSpec;\r\n}\r\n\r\n/**\r\n * Legacy state-machine transition.\r\n */\r\nexport interface LegacyTransition {\r\n id: string;\r\n name: string;\r\n activateStates: string[];\r\n deactivateStates: string[];\r\n staysVisible: boolean;\r\n process: LegacyProcessStep[];\r\n}\r\n\r\n/**\r\n * Legacy state-machine state.\r\n */\r\nexport interface LegacyStateMachineState {\r\n id: string;\r\n name: string;\r\n description: string;\r\n elements: LegacyCriteria[];\r\n isInitial: boolean;\r\n transitions: LegacyTransition[];\r\n}\r\n\r\n/**\r\n * Legacy state-machine block.\r\n */\r\nexport interface LegacyStateMachine {\r\n states: LegacyStateMachineState[];\r\n}\r\n\r\n/**\r\n * Legacy spec metadata block. The projection writes a deterministic subset;\r\n * downstream tooling may layer additional keys on hand-authored specs.\r\n */\r\nexport interface LegacyMetadata {\r\n component: string;\r\n tags?: string[];\r\n [key: string]: unknown;\r\n}\r\n\r\n/**\r\n * Top-level legacy spec shape.\r\n */\r\nexport interface LegacySpec {\r\n version: string;\r\n description: string;\r\n groups: LegacyGroup[];\r\n stateMachine: LegacyStateMachine;\r\n metadata: LegacyMetadata;\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Internal helpers\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Recursively sort object keys lexicographically. Arrays preserve input order\r\n * (ordering is meaningful for groups / assertions / transitions).\r\n *\r\n * Used as the final stage of every projected output to guarantee byte-stable\r\n * JSON serialization downstream.\r\n */\r\nfunction sortKeys<T>(value: T): T {\r\n if (Array.isArray(value)) {\r\n return value.map(sortKeys) as unknown as T;\r\n }\r\n if (value !== null && typeof value === \"object\") {\r\n const sorted: Record<string, unknown> = {};\r\n const keys = Object.keys(value as Record<string, unknown>).sort();\r\n for (const key of keys) {\r\n sorted[key] = sortKeys((value as Record<string, unknown>)[key]);\r\n }\r\n return sorted as unknown as T;\r\n }\r\n return value;\r\n}\r\n\r\n/**\r\n * Convert IR element criteria to legacy criteria. Renames `text` ->\r\n * `textContent`, `attributes` -> `dataAttributes`. `accessibleName` (or\r\n * `ariaLabel` as a fallback) maps to legacy `accessibleName`. `tagName`,\r\n * `role`, `textContains`, `id` pass through unchanged.\r\n */\r\nfunction convertCriteria(criteria: IRElementCriteria): LegacyCriteria {\r\n const out: LegacyCriteria = {};\r\n if (criteria.role !== undefined) out.role = criteria.role;\r\n if (criteria.tagName !== undefined) out.tagName = criteria.tagName;\r\n if (criteria.text !== undefined) out.textContent = criteria.text;\r\n if (criteria.textContains !== undefined) out.textContains = criteria.textContains;\r\n // Prefer explicit `accessibleName` when present; fall back to `ariaLabel`\r\n // for IR documents authored against the section-1 shape.\r\n if (criteria.accessibleName !== undefined) {\r\n out.accessibleName = criteria.accessibleName;\r\n } else if (criteria.ariaLabel !== undefined) {\r\n out.accessibleName = criteria.ariaLabel;\r\n }\r\n if (criteria.id !== undefined) out.id = criteria.id;\r\n if (criteria.attributes !== undefined) out.dataAttributes = criteria.attributes;\r\n return out;\r\n}\r\n\r\n/**\r\n * Build a single legacy assertion from a state + index + criteria.\r\n *\r\n * Always produces one assertion per requiredElement; the caller is responsible\r\n * for iterating `state.requiredElements`. Empty `requiredElements` produces an\r\n * empty `assertions[]` — legitimate legacy specs (e.g. architecture-only\r\n * groups in `graphql-infrastructure`, `activity-timeline`, `opik-integration`,\r\n * `watchers`) ship with empty `assertions[]`, and the inverse projection\r\n * round-trip must preserve that emptiness or `check-spec-pairing` flags an\r\n * assertion-count drift.\r\n */\r\nfunction buildAssertion(\r\n state: IRState,\r\n index: number,\r\n criteria: IRElementCriteria,\r\n): LegacyAssertion {\r\n const description =\r\n state.metadata?.description ?? `Required element ${index} for state ${state.name}`;\r\n const targetCriteria: LegacyCriteria = convertCriteria(criteria);\r\n const assertion: LegacyAssertion = {\r\n id: `${state.id}-elem-${index}`,\r\n description,\r\n category: \"element-presence\",\r\n severity: \"critical\",\r\n assertionType: \"exists\",\r\n target: {\r\n type: \"search\",\r\n criteria: targetCriteria,\r\n label: `Required element for ${state.name}`,\r\n },\r\n source: \"ai-generated\",\r\n reviewed: false,\r\n enabled: true,\r\n };\r\n if (state.precondition !== undefined) {\r\n assertion.precondition = state.precondition;\r\n }\r\n return assertion;\r\n}\r\n\r\n/**\r\n * Build the legacy `groups[]` entry for one IR state. Emits exactly one\r\n * assertion per `requiredElement`; states with zero requiredElements project\r\n * to a group with an empty `assertions[]` array. Legacy consumers (runner\r\n * spec drift / verify, error monitor curator, AI session) tolerate empty\r\n * groups — multiple shipping legacy specs already use them for\r\n * architecture-only / documentation-only groups.\r\n */\r\nfunction buildGroup(state: IRState): LegacyGroup {\r\n const elems = state.requiredElements ?? [];\r\n const assertions: LegacyAssertion[] = elems.map((c, i) =>\r\n buildAssertion(state, i, c),\r\n );\r\n return {\r\n id: state.id,\r\n name: state.name,\r\n description: state.description ?? state.metadata?.description ?? \"\",\r\n category: \"element-presence\",\r\n assertions,\r\n source: state.provenance?.source ?? \"ai-generated\",\r\n };\r\n}\r\n\r\n/**\r\n * Convert an IR transition action into the legacy `process[]` step shape.\r\n * Renames IR's `type` to legacy `action` (matches the runtime engine\r\n * convention — same as the IR -> WorkflowConfig adapter does for runtime).\r\n */\r\nfunction buildProcessStep(action: IRTransitionAction): LegacyProcessStep {\r\n const out: LegacyProcessStep = {\r\n action: action.type,\r\n target: convertCriteria(action.target),\r\n };\r\n if (action.waitAfter !== undefined) out.waitAfter = action.waitAfter;\r\n return out;\r\n}\r\n\r\n/**\r\n * Convert one IR transition into the legacy state-machine transition shape.\r\n * Each fromState gets its own copy in the projected output (legacy specs put\r\n * the transition under each originating state's `transitions[]`).\r\n */\r\nfunction buildTransition(transition: IRTransition): LegacyTransition {\r\n const exitStates = transition.exitStates ?? [];\r\n return {\r\n id: transition.id,\r\n name: transition.name,\r\n activateStates: transition.activateStates,\r\n deactivateStates: exitStates,\r\n // Modal-style transitions (no exit states) stay visible behind the\r\n // activated state. Otherwise the originating state(s) deactivate, so the\r\n // page no longer shows them.\r\n staysVisible: exitStates.length === 0,\r\n process: transition.actions.map(buildProcessStep),\r\n };\r\n}\r\n\r\n/**\r\n * Build the legacy `stateMachine.states[]` entry for one IR state. Includes\r\n * any transitions that originate from this state (i.e. where state.id is in\r\n * transition.fromStates).\r\n */\r\nfunction buildStateMachineState(\r\n state: IRState,\r\n transitions: IRTransition[],\r\n doc: IRDocument,\r\n): LegacyStateMachineState {\r\n const outgoing = transitions\r\n .filter((t) => t.fromStates.includes(state.id))\r\n .map(buildTransition);\r\n const isInitial =\r\n state.isInitial !== undefined ? state.isInitial : state.id === doc.initialState;\r\n return {\r\n id: state.id,\r\n name: state.name,\r\n description: state.description ?? \"\",\r\n elements: (state.requiredElements ?? []).map(convertCriteria),\r\n isInitial,\r\n transitions: outgoing,\r\n };\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Public entry point\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Project an IR document into the legacy bundled-page spec shape.\r\n *\r\n * Pure / deterministic: same input always produces structurally identical\r\n * output (and byte-identical when JSON-serialized via the standard\r\n * `JSON.stringify` ordering). Arrays preserve input order; object keys are\r\n * sorted lexicographically.\r\n *\r\n * @param doc The IR document to project.\r\n * @param notes Optional human-authored notes (carried in the page's\r\n * `notes.md` companion file). Appended to `description` as a\r\n * separate paragraph (separator: two newlines).\r\n */\r\nexport function projectIRToBundledPage(doc: IRDocument, notes?: string): LegacySpec {\r\n const baseDescription = doc.description ?? doc.name;\r\n const description =\r\n notes !== undefined && notes.length > 0\r\n ? `${baseDescription}\\n\\n${notes}`\r\n : baseDescription;\r\n\r\n const component = doc.metadata?.purpose ?? doc.id;\r\n const metadata: LegacyMetadata = { component };\r\n if (doc.metadata?.tags !== undefined) metadata.tags = doc.metadata.tags;\r\n\r\n const groups: LegacyGroup[] = doc.states.map(buildGroup);\r\n const smStates: LegacyStateMachineState[] = doc.states.map((s) =>\r\n buildStateMachineState(s, doc.transitions, doc),\r\n );\r\n\r\n const spec: LegacySpec = {\r\n version: \"1.0.0\",\r\n description,\r\n groups,\r\n stateMachine: { states: smStates },\r\n metadata,\r\n };\r\n\r\n return sortKeys(spec);\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Inverse projection — Legacy spec -> IR document\r\n// ---------------------------------------------------------------------------\r\n\r\n/**\r\n * Options for the inverse projection.\r\n *\r\n * - `docId` — explicit IRDocument.id override. Falls back to\r\n * `legacy.metadata.component` (or `fallbackName` if absent).\r\n * - `fallbackName` — used when `legacy.metadata.component` is missing AND no\r\n * `docId` was supplied.\r\n */\r\nexport interface ProjectLegacyToIROptions {\r\n docId?: string;\r\n fallbackName?: string;\r\n}\r\n\r\n/**\r\n * Best-effort field-by-field invert of `LegacyCriteria` back into\r\n * `IRElementCriteria`.\r\n *\r\n * Rename map (the structural inverse of `convertCriteria`):\r\n * textContent -> text\r\n * accessibleName -> accessibleName (passes through; the forward direction\r\n * collapses ariaLabel into accessibleName,\r\n * so we cannot reliably distinguish them\r\n * on the inverse — pick accessibleName).\r\n * dataAttributes -> attributes\r\n * role / tagName / textContains / id pass through unchanged.\r\n *\r\n * Unknown legacy keys are dropped (lossy, but documented). Document-level\r\n * unknown criteria are rare; if they show up we'll surface them in Phase A4.\r\n */\r\nfunction invertCriteria(criteria: LegacyCriteria | undefined): IRElementCriteria {\r\n if (criteria === undefined || criteria === null) return {};\r\n const out: IRElementCriteria = {};\r\n if (criteria.role !== undefined) out.role = criteria.role;\r\n if (criteria.tagName !== undefined) out.tagName = criteria.tagName;\r\n if (criteria.textContent !== undefined) out.text = criteria.textContent;\r\n if (criteria.textContains !== undefined) out.textContains = criteria.textContains;\r\n if (criteria.accessibleName !== undefined) out.accessibleName = criteria.accessibleName;\r\n if (criteria.id !== undefined) out.id = criteria.id;\r\n if (criteria.dataAttributes !== undefined) out.attributes = criteria.dataAttributes;\r\n return out;\r\n}\r\n\r\n/**\r\n * Pick the first non-empty `precondition` across a group's assertions. Legacy\r\n * groups carry preconditions on individual assertions; IR carries it on the\r\n * state. If multiple distinct preconditions exist we keep the first\r\n * (deterministic, mirrors input ordering) — Phase A4 review will surface\r\n * conflicts for hand-fix.\r\n */\r\nfunction firstPrecondition(group: LegacyGroup): string | undefined {\r\n for (const a of group.assertions) {\r\n if (a.precondition !== undefined && a.precondition.length > 0) {\r\n return a.precondition;\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\n/**\r\n * Build an `IRState` from one legacy group + its corresponding state-machine\r\n * state (when present).\r\n *\r\n * IMPORTANT: `requiredElements` is sourced from the GROUP's assertion criteria\r\n * (one criteria per assertion, in input order), NOT from `smState.elements`.\r\n * This preserves the round-trip identity for the assertion-count check —\r\n * legacy specs sometimes carry an SM block whose `elements[]` is a coarse\r\n * page-state fingerprint (1-2 entries) while the group has many assertions.\r\n * Using `smState.elements` would silently collapse those into one\r\n * requiredElement per state, then the forward direction would emit only one\r\n * assertion per group.\r\n *\r\n * `smState` (when present and matched by id) contributes:\r\n * - `name` override (legacy `smState.name` is human-readable; group.name is\r\n * also human-readable but may differ — prefer smState's name since the\r\n * forward direction's `buildStateMachineState` echoes `state.name` to\r\n * `smState.name`).\r\n * - `description` fallback (when group.description is empty).\r\n * - `isInitial` (the only place this lives in legacy specs).\r\n */\r\nfunction buildIRState(\r\n group: LegacyGroup,\r\n smState: LegacyStateMachineState | undefined,\r\n): IRState {\r\n // Always one requiredElement per assertion so the forward projection emits\r\n // the same number of assertions on the round-trip.\r\n const requiredElements: IRElementCriteria[] = group.assertions.map((a) =>\r\n invertCriteria(a.target?.criteria),\r\n );\r\n\r\n const description =\r\n group.description !== undefined && group.description.length > 0\r\n ? group.description\r\n : smState?.description;\r\n const precondition = firstPrecondition(group);\r\n\r\n const state: IRState = {\r\n id: group.id,\r\n name: smState?.name ?? group.name,\r\n requiredElements,\r\n };\r\n if (description !== undefined && description.length > 0) {\r\n state.description = description;\r\n }\r\n if (smState?.isInitial === true) {\r\n state.isInitial = true;\r\n } else if (smState?.isInitial === false) {\r\n state.isInitial = false;\r\n }\r\n if (precondition !== undefined) {\r\n state.precondition = precondition;\r\n }\r\n state.provenance = { source: \"migrated\" };\r\n return state;\r\n}\r\n\r\n/**\r\n * Convert one legacy `process[]` step back into `IRTransitionAction`. Renames\r\n * `action` -> `type`. Legacy specs occasionally omit a target on no-op steps;\r\n * we coerce to an empty criteria object in that case.\r\n */\r\nfunction invertProcessStep(step: LegacyProcessStep): IRTransitionAction {\r\n const out: IRTransitionAction = {\r\n type: step.action,\r\n target: invertCriteria(step.target),\r\n };\r\n if (step.waitAfter !== undefined) out.waitAfter = step.waitAfter;\r\n return out;\r\n}\r\n\r\n/**\r\n * Collapse duplicate transitions across multiple originating states. The\r\n * forward projection emits the same transition under EACH `fromState`'s\r\n * `transitions[]` entry; the inverse must merge them back into ONE\r\n * `IRTransition` whose `fromStates` lists every originator.\r\n *\r\n * Same-id transitions are assumed to be byte-identical except for the\r\n * (implicit) originating state. If they differ in `process[]` /\r\n * `activateStates` / `deactivateStates`, we keep the first occurrence and\r\n * append the additional fromState. (Genuine divergence here is a defect to\r\n * surface in Phase A4 review.)\r\n */\r\nfunction buildIRTransitions(stateMachine: LegacyStateMachine | undefined): IRTransition[] {\r\n if (stateMachine === undefined || !Array.isArray(stateMachine.states)) return [];\r\n const byId = new Map<string, IRTransition>();\r\n // Preserve insertion order — first state's transitions come first.\r\n const order: string[] = [];\r\n\r\n for (const smState of stateMachine.states) {\r\n const transitions = Array.isArray(smState.transitions) ? smState.transitions : [];\r\n for (const t of transitions) {\r\n const existing = byId.get(t.id);\r\n if (existing !== undefined) {\r\n if (!existing.fromStates.includes(smState.id)) {\r\n existing.fromStates.push(smState.id);\r\n }\r\n continue;\r\n }\r\n const ir: IRTransition = {\r\n id: t.id,\r\n name: t.name,\r\n fromStates: [smState.id],\r\n activateStates: Array.isArray(t.activateStates) ? [...t.activateStates] : [],\r\n actions: Array.isArray(t.process) ? t.process.map(invertProcessStep) : [],\r\n };\r\n // The forward direction maps `exitStates` -> `deactivateStates`; preserve\r\n // the field whenever it's present in legacy form (even if empty array)\r\n // so modal-style transitions (staysVisible: true, deactivateStates: [])\r\n // round-trip predictably.\r\n if (Array.isArray(t.deactivateStates)) {\r\n ir.exitStates = [...t.deactivateStates];\r\n }\r\n ir.provenance = { source: \"migrated\" };\r\n byId.set(t.id, ir);\r\n order.push(t.id);\r\n }\r\n }\r\n\r\n return order.map((id) => byId.get(id)!);\r\n}\r\n\r\n/**\r\n * Project a legacy bundled-page spec back into IR.\r\n *\r\n * Pure / deterministic: same input always produces structurally identical\r\n * output. Collapses transition duplicates (forward emits one copy per\r\n * `fromState`), preserves group/assertion ordering, and tags every node with\r\n * `provenance.source = \"migrated\"` so downstream tooling can distinguish\r\n * migrated content from hand-authored.\r\n *\r\n * The mapping is the structural inverse of `projectIRToBundledPage`:\r\n *\r\n * LegacySpec IRDocument\r\n * ---------- ----------\r\n * metadata.component -> id (or opts.docId override)\r\n * metadata.tags -> metadata.tags\r\n * description -> description (kept verbatim;\r\n * authored notes appended via\r\n * forward `notes` arg are not\r\n * stripped — that round-trip is\r\n * best-effort and Phase A4 will\r\n * split them back out)\r\n *\r\n * groups[] -> states[] (one per group)\r\n * group.id / name / description -> state.id / name / description\r\n * assertion.target.criteria -> state.requiredElements[i] (or,\r\n * preferred, smState.elements when\r\n * the stateMachine block is present)\r\n * first-found assertion.precondition -> state.precondition\r\n *\r\n * stateMachine.states[] -> contributes isInitial + elements\r\n * smState.transitions[] -> transitions[] (deduped by id)\r\n * transition.activateStates -> transition.activateStates\r\n * transition.deactivateStates -> transition.exitStates\r\n * transition.process[] -> transition.actions[]\r\n * step.action -> action.type\r\n * step.target -> action.target (criteria inverted)\r\n * step.waitAfter -> action.waitAfter\r\n *\r\n * Documented losses (acceptable for Phase A2):\r\n * - Legacy assertion ids (`{stateId}-elem-{i}`) are NOT preserved across the\r\n * round-trip — the forward direction regenerates them from index, so any\r\n * hand-edited ids are lost. See Phase A4.\r\n * - Legacy `assertionType` / `severity` / `category` / `source` per\r\n * assertion are reduced to defaults on round-trip.\r\n * - Legacy `expected` / `assertionType: \"count\"` and `notExists` semantics\r\n * are not modeled in IR — the assertion's criteria still survive (as a\r\n * state requiredElement) but the assertion-flavor metadata is dropped.\r\n * - Legacy `testing` block + extra metadata keys outside `component` /\r\n * `tags` are ignored. Authors keep them via the legacy spec file directly\r\n * during Phase A2 — they will move into IR companion files in Phase A4.\r\n * - The forward `notes` argument's appended paragraph is currently kept\r\n * in `description`; Phase A4 will split it back out into a dedicated\r\n * companion file.\r\n *\r\n * @param legacy The legacy spec to invert.\r\n * @param opts Optional doc-level overrides.\r\n */\r\nexport function projectLegacyToIR(\r\n legacy: LegacySpec,\r\n opts?: ProjectLegacyToIROptions,\r\n): IRDocument {\r\n const component =\r\n opts?.docId ??\r\n legacy.metadata?.component ??\r\n opts?.fallbackName ??\r\n \"legacy-spec\";\r\n const name = legacy.metadata?.component ?? opts?.fallbackName ?? component;\r\n\r\n // Index state-machine states by id for quick lookup when building IR states\r\n // out of groups. Older specs may not have a stateMachine block.\r\n const smByGroupId = new Map<string, LegacyStateMachineState>();\r\n if (legacy.stateMachine !== undefined && Array.isArray(legacy.stateMachine.states)) {\r\n for (const s of legacy.stateMachine.states) {\r\n smByGroupId.set(s.id, s);\r\n }\r\n }\r\n\r\n const groups = Array.isArray(legacy.groups) ? legacy.groups : [];\r\n const states: IRState[] = groups.map((group) =>\r\n buildIRState(group, smByGroupId.get(group.id)),\r\n );\r\n\r\n // NOTE: Some legacy specs declare `stateMachine.states[]` whose ids do NOT\r\n // correspond to any `groups[]` entry (e.g., page-level states like\r\n // `wrappers-installed-tab` vs assertion-category groups like\r\n // `page-structure`). The IR's group-state mapping is 1:1 with groups by\r\n // construction (the forward projection emits one group per IR state), so\r\n // these orphan SM states cannot survive the round-trip cleanly. They are\r\n // dropped here as a documented loss — Phase A4 will revisit by either\r\n // (a) introducing a separate IR concept for \"page state\" vs\r\n // \"assertion group\", or (b) hand-merging the legacy specs so groups and\r\n // SM states share ids.\r\n // Transitions originating from orphan SM states are likewise omitted from\r\n // IR (their fromStates would dangle). We filter them below.\r\n const groupIds = new Set(groups.map((g) => g.id));\r\n\r\n // Build transitions only from SM states whose ids appear in groups[]. Any\r\n // transition with a fromState that isn't a known group is dropped — the\r\n // forward direction would have nowhere to emit it.\r\n let filteredStateMachine: LegacyStateMachine | undefined = legacy.stateMachine;\r\n if (\r\n legacy.stateMachine !== undefined &&\r\n Array.isArray(legacy.stateMachine.states) &&\r\n legacy.stateMachine.states.some((s) => !groupIds.has(s.id))\r\n ) {\r\n filteredStateMachine = {\r\n states: legacy.stateMachine.states.filter((s) => groupIds.has(s.id)),\r\n };\r\n }\r\n const transitions = buildIRTransitions(filteredStateMachine);\r\n\r\n // Initial state: first state with isInitial:true wins (mirrors how the\r\n // forward direction picks the document's `initialState`). Only consider\r\n // SM states that correspond to a group (so initialState references a real\r\n // IR state).\r\n let initialState: string | undefined;\r\n if (legacy.stateMachine !== undefined && Array.isArray(legacy.stateMachine.states)) {\r\n const initial = legacy.stateMachine.states.find(\r\n (s) => s.isInitial === true && groupIds.has(s.id),\r\n );\r\n if (initial !== undefined) initialState = initial.id;\r\n }\r\n\r\n const doc: IRDocument = {\r\n version: \"1.0\",\r\n id: component,\r\n name,\r\n states,\r\n transitions,\r\n provenance: { source: \"migrated\" },\r\n };\r\n if (legacy.description !== undefined && legacy.description.length > 0) {\r\n doc.description = legacy.description;\r\n }\r\n if (legacy.metadata !== undefined && legacy.metadata.tags !== undefined) {\r\n doc.metadata = { tags: legacy.metadata.tags };\r\n }\r\n if (initialState !== undefined) {\r\n doc.initialState = initialState;\r\n }\r\n return doc;\r\n}\r\n"],"mappings":";AA4GA,IAAM,wBAAwB,oBAAI,IAAY,CAAC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I,EAAE,EAAE,CAAC,GAC1D;AACA,2BAAuB;AAAA,MACrB,QAAQ,OAAO,aAAa,OAAO,OAAO,CAAC,MAAM,SAAS,IAAI,EAAE,EAAE,CAAC;AAAA,IACrE;AAAA,EACF;AACA,QAAM,cAAc,mBAAmB,oBAAoB;AAM3D,MAAI;AACJ,MAAI,OAAO,iBAAiB,UAAa,MAAM,QAAQ,OAAO,aAAa,MAAM,GAAG;AAClF,UAAM,UAAU,OAAO,aAAa,OAAO;AAAA,MACzC,CAAC,MAAM,EAAE,cAAc,QAAQ,SAAS,IAAI,EAAE,EAAE;AAAA,IAClD;AACA,QAAI,YAAY,OAAW,gBAAe,QAAQ;AAAA,EACpD;AAEA,QAAM,MAAkB;AAAA,IACtB,SAAS;AAAA,IACT,IAAI;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY,EAAE,QAAQ,WAAW;AAAA,EACnC;AACA,MAAI,OAAO,gBAAgB,UAAa,OAAO,YAAY,SAAS,GAAG;AACrE,QAAI,cAAc,OAAO;AAAA,EAC3B;AACA,MAAI,OAAO,aAAa,UAAa,OAAO,SAAS,SAAS,QAAW;AACvE,QAAI,WAAW,EAAE,MAAM,OAAO,SAAS,KAAK;AAAA,EAC9C;AACA,MAAI,iBAAiB,QAAW;AAC9B,QAAI,eAAe;AAAA,EACrB;AACA,SAAO;AACT;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/ui-bridge-ir/adapter.ts","../src/ui-bridge-ir/projection.ts"],"sourcesContent":["/**\n * IR -> WorkflowConfig adapter.\n *\n * Single point of translation between authoring-time IR (with provenance,\n * metadata, effect, crossRefs, visualRefs) and the runtime/storage shape\n * that ui-bridge-auto consumes. See ADR-001 (decision #6 / #7) for the\n * boundary rationale.\n *\n * The output is intentionally typed structurally — this module has no\n * runtime dependency on ui-bridge-auto. ui-bridge-auto's own tests verify\n * end-to-end compatibility with `engine.defineStates(...)` /\n * `engine.defineTransitions(...)` (see\n * `ui-bridge-auto/src/__tests__/spike-ir-contract.test.ts`).\n */\n\nimport type { IRElementCriteria } from \"./element-criteria\";\nimport type { IRDocument } from \"./document\";\nimport type { IRState, IRStateCondition } from \"./state\";\nimport type { IRTransition, IRTransitionAction, IRWaitSpec } from \"./transition\";\n\n// ---------------------------------------------------------------------------\n// Output shapes — structural mirrors of ui-bridge-auto's WorkflowConfig.\n// Kept in sync via ui-bridge-auto's regression test, NOT compile-time\n// imports (qontinui-schemas has no runtime deps by design).\n// ---------------------------------------------------------------------------\n\n/** Mirrors `StateConfig` from ui-bridge-auto/src/config/workflow.ts:47. */\nexport interface AdaptedState {\n id: string;\n name: string;\n description?: string;\n requiredElements: IRElementCriteria[];\n excludedElements?: IRElementCriteria[];\n conditions?: IRStateCondition[];\n isInitial?: boolean;\n isTerminal?: boolean;\n blocking?: boolean;\n group?: string;\n pathCost?: number;\n}\n\n/**\n * Mirrors the runtime `TransitionDefinition` shape from\n * ui-bridge-auto/src/state/state-machine.ts:40.\n *\n * Note: ui-bridge-auto has two related Transition shapes — the storage shape\n * (`TransitionConfig` in config/workflow.ts:54, with action field named\n * `type`) and the runtime engine shape (`TransitionDefinition` in\n * state-machine.ts:40, with action field named `action`). The runtime engine\n * is what consumers actually pass adapter output into via\n * `engine.defineTransitions(...)`, so the adapter targets the runtime shape.\n */\nexport interface AdaptedTransition {\n id: string;\n name: string;\n description?: string;\n fromStates: string[];\n activateStates: string[];\n /** Adapter normalizes IR's optional `exitStates` to a required array. */\n exitStates: string[];\n actions: AdaptedTransitionAction[];\n pathCost?: number;\n bidirectional?: boolean;\n}\n\n/**\n * Mirrors the runtime `TransitionAction` from\n * ui-bridge-auto/src/state/state-machine.ts:55.\n *\n * The IR uses `type` for the action verb (matching the storage-shape\n * convention); the adapter renames it to `action` for the runtime engine.\n *\n * `waitAfter` is narrower than `IRWaitSpec` — the runtime engine accepts\n * only a subset of wait types and a subset of fields. The adapter drops\n * IR-only wait variants (e.g., `state`, `condition`) and IR-only fields\n * (e.g., `property`, `quietPeriodMs`). Authors can still express richer\n * waits in the IR; they just don't survive the runtime contract.\n */\nexport interface AdaptedWaitAfter {\n type: \"idle\" | \"element\" | \"time\" | \"vanish\" | \"change\" | \"stable\";\n query?: IRElementCriteria;\n ms?: number;\n timeout?: number;\n}\n\nexport interface AdaptedTransitionAction {\n /** Action verb — renamed from IR's `type` to match the runtime contract. */\n action: string;\n target: IRElementCriteria;\n params?: Record<string, unknown>;\n waitAfter?: AdaptedWaitAfter;\n}\n\n/** Mirrors `WorkflowConfig` from ui-bridge-auto/src/config/workflow.ts:67. */\nexport interface AdaptedWorkflowConfig {\n id: string;\n name: string;\n description?: string;\n version?: string;\n states: AdaptedState[];\n transitions: AdaptedTransition[];\n initialState?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Adapter implementation\n// ---------------------------------------------------------------------------\n\nconst SUPPORTED_IR_VERSIONS = new Set<string>([\"1.0\"]);\n\n/**\n * Convert an IR state declaration into the runtime/storage state shape.\n * Strips IR-only fields (metadata, provenance, elementIds,\n * incomingTransitions, crossRefs, visualRefs).\n */\nexport function adaptIRState(state: IRState): AdaptedState {\n const out: AdaptedState = {\n id: state.id,\n name: state.name,\n requiredElements: state.requiredElements,\n };\n if (state.description !== undefined) out.description = state.description;\n if (state.excludedElements !== undefined) out.excludedElements = state.excludedElements;\n if (state.conditions !== undefined) out.conditions = state.conditions;\n if (state.isInitial !== undefined) out.isInitial = state.isInitial;\n if (state.isTerminal !== undefined) out.isTerminal = state.isTerminal;\n if (state.blocking !== undefined) out.blocking = state.blocking;\n if (state.group !== undefined) out.group = state.group;\n if (state.pathCost !== undefined) out.pathCost = state.pathCost;\n return out;\n}\n\n/**\n * Wait types the runtime engine accepts. IR-authored waits with other types\n * (e.g., `state`, `condition`) are dropped from the adapter output.\n */\nconst RUNTIME_WAIT_TYPES = new Set<AdaptedWaitAfter[\"type\"]>([\n \"idle\",\n \"element\",\n \"time\",\n \"vanish\",\n \"change\",\n \"stable\",\n]);\n\nfunction adaptIRWaitAfter(wait: IRWaitSpec): AdaptedWaitAfter | undefined {\n if (!RUNTIME_WAIT_TYPES.has(wait.type as AdaptedWaitAfter[\"type\"])) {\n // IR-authored wait is richer than runtime supports — drop it.\n // Runtime defaults (default idle behaviour) take over.\n return undefined;\n }\n const out: AdaptedWaitAfter = { type: wait.type as AdaptedWaitAfter[\"type\"] };\n if (wait.query !== undefined) out.query = wait.query;\n if (wait.ms !== undefined) out.ms = wait.ms;\n if (wait.timeout !== undefined) out.timeout = wait.timeout;\n return out;\n}\n\n/**\n * Convert an IR transition action into the runtime action shape.\n * Renames IR's `type` to runtime's `action`; narrows `waitAfter` to the\n * runtime-accepted subset.\n */\nexport function adaptIRTransitionAction(action: IRTransitionAction): AdaptedTransitionAction {\n const out: AdaptedTransitionAction = {\n action: action.type,\n target: action.target,\n };\n if (action.params !== undefined) out.params = action.params;\n if (action.waitAfter !== undefined) {\n const adaptedWait = adaptIRWaitAfter(action.waitAfter);\n if (adaptedWait !== undefined) out.waitAfter = adaptedWait;\n }\n return out;\n}\n\n/**\n * Convert an IR transition declaration into the runtime/storage transition\n * shape. Strips IR-only fields (effect, metadata, provenance, crossRefs)\n * and defaults `exitStates` to `[]` when omitted.\n */\nexport function adaptIRTransition(transition: IRTransition): AdaptedTransition {\n const out: AdaptedTransition = {\n id: transition.id,\n name: transition.name,\n fromStates: transition.fromStates,\n activateStates: transition.activateStates,\n exitStates: transition.exitStates ?? [],\n actions: transition.actions.map(adaptIRTransitionAction),\n };\n if (transition.description !== undefined) out.description = transition.description;\n if (transition.pathCost !== undefined) out.pathCost = transition.pathCost;\n if (transition.bidirectional !== undefined) out.bidirectional = transition.bidirectional;\n return out;\n}\n\n/**\n * Convert a top-level IR document into the runtime `WorkflowConfig` shape.\n *\n * Throws on unknown IR versions to fail loudly rather than silently emit\n * stale shapes.\n */\nexport function adaptIRDocumentToWorkflowConfig(doc: IRDocument): AdaptedWorkflowConfig {\n if (!SUPPORTED_IR_VERSIONS.has(doc.version)) {\n throw new Error(\n `adaptIRDocumentToWorkflowConfig: unsupported IR version \"${doc.version}\". ` +\n `Supported: ${Array.from(SUPPORTED_IR_VERSIONS).join(\", \")}`,\n );\n }\n\n const out: AdaptedWorkflowConfig = {\n id: doc.id,\n name: doc.name,\n states: doc.states.map(adaptIRState),\n transitions: doc.transitions.map(adaptIRTransition),\n };\n if (doc.description !== undefined) out.description = doc.description;\n if (doc.initialState !== undefined) out.initialState = doc.initialState;\n return out;\n}\n","/**\n * IR -> Bundled-Page Legacy Spec projection.\n *\n * Single point of translation between authoring-time IR (`IRDocument`) and the\n * legacy `*.spec.uibridge.json` shape that existing tooling still consumes\n * (`/update-spec`, runner spec drift / verify, error monitor curator,\n * spec experimentation, AI session). See ADR-001 (decision #6 / #7) for the\n * boundary rationale; section 2 of the UI Bridge redesign for the projection's\n * role in keeping legacy consumers working through the migration.\n *\n * The projection is a PURE FUNCTION — same input always produces byte-identical\n * output. Keys within objects are sorted lexicographically, arrays preserve\n * input order, and no timestamps / random IDs are introduced. Downstream tests\n * may hash the JSON output for byte-stable assertions.\n *\n * ---------------------------------------------------------------------------\n * Mapping rules (worked example below)\n * ---------------------------------------------------------------------------\n *\n * IRDocument LegacySpec\n * ---------- ----------\n * doc.id -> metadata.component\n * doc.metadata?.purpose ?? doc.id -> metadata.component (purpose wins if present)\n * doc.description ?? doc.name -> description\n * doc.metadata?.tags -> metadata.tags\n *\n * For each IRState:\n * state -> one entry in groups[]\n * state.id -> group.id\n * state.name -> group.name\n * state.description ??\n * state.metadata?.description -> group.description\n * \"element-presence\" -> group.category (default)\n * state.provenance?.source ??\n * \"ai-generated\" -> group.source\n *\n * For each requiredElement of state:\n * (state, criteria, index) -> one assertion in group.assertions[]\n * \"${state.id}-elem-${index}\" -> assertion.id\n * state.metadata?.description ?? -> assertion.description\n * \"Required element ${index} ...\"\n * \"element-presence\" -> assertion.category\n * \"critical\" -> assertion.severity\n * \"exists\" -> assertion.assertionType\n * {\n * type: \"search\",\n * criteria: convert(criteria), -> assertion.target\n * label: \"Required element ...\"\n * }\n * \"ai-generated\" -> assertion.source\n * false -> assertion.reviewed\n * true -> assertion.enabled\n *\n * If state has zero requiredElements, the projected `group.assertions[]`\n * is the empty array — legacy specs ship architecture-only groups with\n * empty assertions, and the inverse projection's identity round-trip\n * depends on preserving that emptiness. (Earlier versions emitted a\n * placeholder assertion here, which silently grew the assertion count\n * during round-trip and tripped `check-spec-pairing`.)\n *\n * Each IRState -> one entry in stateMachine.states[]\n * state.id -> sm-state.id\n * state.name -> sm-state.name\n * state.description ?? \"\" -> sm-state.description\n * state.requiredElements (converted) -> sm-state.elements\n * state.isInitial ??\n * (state.id === doc.initialState) -> sm-state.isInitial\n * transitions originating from state -> sm-state.transitions\n *\n * For each IRTransition:\n * For each fromState in transition.fromStates:\n * transition -> one entry in\n * stateMachine.states[fromState].transitions[]\n * transition.id -> sm-transition.id\n * transition.name -> sm-transition.name\n * transition.activateStates -> sm-transition.activateStates\n * transition.exitStates ?? [] -> sm-transition.deactivateStates\n * (exitStates.length === 0) -> sm-transition.staysVisible\n *\n * For each action in transition.actions:\n * action.type -> process[].action (rename type -> action)\n * action.target -> process[].target (criteria converted)\n * action.waitAfter -> process[].waitAfter (passed through)\n *\n * Element-criteria conversion (IRElementCriteria -> legacy criteria):\n * text -> textContent\n * ariaLabel -> accessibleName\n * attributes -> dataAttributes\n * (others — role, textContains, id — pass through unchanged)\n *\n * ---------------------------------------------------------------------------\n * Worked example\n * ---------------------------------------------------------------------------\n *\n * const ir: IRDocument = {\n * version: \"1.0\",\n * id: \"active\",\n * name: \"Active Dashboard\",\n * description: \"Real-time monitoring hub\",\n * metadata: { tags: [\"monitoring\", \"tier-1\"] },\n * states: [\n * {\n * id: \"running\",\n * name: \"Running\",\n * description: \"Workflow executing\",\n * requiredElements: [{ role: \"button\", text: \"Stop\" }],\n * isInitial: false,\n * },\n * ],\n * transitions: [\n * {\n * id: \"running-to-idle\",\n * name: \"Stop\",\n * fromStates: [\"running\"],\n * activateStates: [\"idle\"],\n * exitStates: [\"running\"],\n * actions: [\n * {\n * type: \"click\",\n * target: { role: \"button\", text: \"Stop\" },\n * waitAfter: { type: \"idle\", timeout: 3000 },\n * },\n * ],\n * },\n * ],\n * initialState: \"idle\",\n * };\n *\n * projectIRToBundledPage(ir, \"Notes from author\")\n * // -> {\n * // version: \"1.0.0\",\n * // description: \"Real-time monitoring hub\\n\\nNotes from author\",\n * // groups: [{\n * // id: \"running\",\n * // name: \"Running\",\n * // description: \"Workflow executing\",\n * // category: \"element-presence\",\n * // assertions: [{\n * // id: \"running-elem-0\",\n * // description: \"Required element 0 for state Running\",\n * // category: \"element-presence\",\n * // severity: \"critical\",\n * // assertionType: \"exists\",\n * // target: {\n * // type: \"search\",\n * // criteria: { role: \"button\", textContent: \"Stop\" },\n * // label: \"Required element for Running\",\n * // },\n * // source: \"ai-generated\",\n * // reviewed: false,\n * // enabled: true,\n * // }],\n * // source: \"ai-generated\",\n * // }],\n * // stateMachine: {\n * // states: [{\n * // id: \"running\",\n * // name: \"Running\",\n * // description: \"Workflow executing\",\n * // elements: [{ role: \"button\", textContent: \"Stop\" }],\n * // isInitial: false,\n * // transitions: [{\n * // id: \"running-to-idle\",\n * // name: \"Stop\",\n * // activateStates: [\"idle\"],\n * // deactivateStates: [\"running\"],\n * // staysVisible: false,\n * // process: [{\n * // action: \"click\",\n * // target: { role: \"button\", textContent: \"Stop\" },\n * // waitAfter: { type: \"idle\", timeout: 3000 },\n * // }],\n * // }],\n * // }],\n * // },\n * // metadata: { component: \"active\", tags: [\"monitoring\", \"tier-1\"] },\n * // }\n */\n\nimport type { IRElementCriteria } from \"./element-criteria\";\nimport type { IRDocument } from \"./document\";\nimport type { IRAssertion, IRGroup } from \"./group\";\nimport type { IRState } from \"./state\";\nimport type { IRTransition, IRTransitionAction, IRWaitSpec } from \"./transition\";\n\n/**\n * Projection version. Bump on shape changes that consumers must adapt to.\n * Independent from `IRVersion` because the legacy spec shape and the IR shape\n * evolve on different cadences.\n */\nexport const projectionVersion = \"1.0\";\n\n// ---------------------------------------------------------------------------\n// Legacy spec shapes — derived from active.spec.uibridge.json (the reference\n// the projection's output must structurally match).\n// ---------------------------------------------------------------------------\n\n/**\n * Legacy element-criteria shape (after conversion from `IRElementCriteria`).\n *\n * The differences from `IRElementCriteria`:\n * - `text` -> `textContent`\n * - `ariaLabel` -> `accessibleName` (when IR has no explicit `accessibleName`)\n * - `attributes` -> `dataAttributes`\n *\n * Other fields (`role`, `tagName`, `textContains`, `accessibleName`, `id`)\n * pass through unchanged. Index signature stays open for legacy fields the\n * IR doesn't yet model.\n */\nexport interface LegacyCriteria {\n role?: string;\n tagName?: string;\n textContent?: string;\n textContains?: string;\n accessibleName?: string;\n id?: string;\n dataAttributes?: Record<string, string>;\n [key: string]: unknown;\n}\n\n/**\n * Legacy assertion target. Always `type: \"search\"` for the projection — the\n * legacy schema also supports point/region targets, but the IR doesn't\n * express those.\n */\nexport interface LegacyAssertionTarget {\n type: \"search\";\n criteria: LegacyCriteria;\n label: string;\n}\n\n/**\n * Legacy assertion. Mirrors the shape used by `groups[].assertions[]` in\n * `*.spec.uibridge.json`.\n */\nexport interface LegacyAssertion {\n id: string;\n description: string;\n category: string;\n severity: \"critical\" | \"warning\" | \"info\";\n assertionType: string;\n target: LegacyAssertionTarget;\n source: string;\n reviewed: boolean;\n enabled: boolean;\n precondition?: string;\n}\n\n/**\n * Legacy group. One per IR state.\n */\nexport interface LegacyGroup {\n id: string;\n name: string;\n description: string;\n category: string;\n assertions: LegacyAssertion[];\n source: string;\n}\n\n/**\n * Process step within a transition. Note `action` (not `type`) — matches the\n * runtime engine's `TransitionAction` shape.\n */\nexport interface LegacyProcessStep {\n action: string;\n target: LegacyCriteria;\n waitAfter?: IRWaitSpec;\n}\n\n/**\n * Legacy state-machine transition.\n */\nexport interface LegacyTransition {\n id: string;\n name: string;\n activateStates: string[];\n deactivateStates: string[];\n staysVisible: boolean;\n process: LegacyProcessStep[];\n}\n\n/**\n * Legacy state-machine state.\n */\nexport interface LegacyStateMachineState {\n id: string;\n name: string;\n description: string;\n elements: LegacyCriteria[];\n isInitial: boolean;\n transitions: LegacyTransition[];\n}\n\n/**\n * Legacy state-machine block.\n */\nexport interface LegacyStateMachine {\n states: LegacyStateMachineState[];\n}\n\n/**\n * Legacy spec metadata block. The projection writes a deterministic subset;\n * downstream tooling may layer additional keys on hand-authored specs.\n */\nexport interface LegacyMetadata {\n component: string;\n tags?: string[];\n [key: string]: unknown;\n}\n\n/**\n * Top-level legacy spec shape.\n */\nexport interface LegacySpec {\n version: string;\n description: string;\n groups: LegacyGroup[];\n stateMachine: LegacyStateMachine;\n metadata: LegacyMetadata;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Recursively sort object keys lexicographically. Arrays preserve input order\n * (ordering is meaningful for groups / assertions / transitions).\n *\n * Used as the final stage of every projected output to guarantee byte-stable\n * JSON serialization downstream.\n */\nfunction sortKeys<T>(value: T): T {\n if (Array.isArray(value)) {\n return value.map(sortKeys) as unknown as T;\n }\n if (value !== null && typeof value === \"object\") {\n const sorted: Record<string, unknown> = {};\n const keys = Object.keys(value as Record<string, unknown>).sort();\n for (const key of keys) {\n sorted[key] = sortKeys((value as Record<string, unknown>)[key]);\n }\n return sorted as unknown as T;\n }\n return value;\n}\n\n/**\n * Convert IR element criteria to legacy criteria. Renames `text` ->\n * `textContent`, `attributes` -> `dataAttributes`. `accessibleName` (or\n * `ariaLabel` as a fallback) maps to legacy `accessibleName`. `tagName`,\n * `role`, `textContains`, `id` pass through unchanged.\n */\nfunction convertCriteria(criteria: IRElementCriteria): LegacyCriteria {\n const out: LegacyCriteria = {};\n if (criteria.role !== undefined) out.role = criteria.role;\n if (criteria.tagName !== undefined) out.tagName = criteria.tagName;\n if (criteria.text !== undefined) out.textContent = criteria.text;\n if (criteria.textContains !== undefined) out.textContains = criteria.textContains;\n // Prefer explicit `accessibleName` when present; fall back to `ariaLabel`\n // for IR documents authored against the section-1 shape.\n if (criteria.accessibleName !== undefined) {\n out.accessibleName = criteria.accessibleName;\n } else if (criteria.ariaLabel !== undefined) {\n out.accessibleName = criteria.ariaLabel;\n }\n if (criteria.id !== undefined) out.id = criteria.id;\n if (criteria.attributes !== undefined) out.dataAttributes = criteria.attributes;\n return out;\n}\n\n/**\n * Build a single legacy assertion from a state + index + criteria.\n *\n * Always produces one assertion per requiredElement; the caller is responsible\n * for iterating `state.requiredElements`. Empty `requiredElements` produces an\n * empty `assertions[]` — legitimate legacy specs (e.g. architecture-only\n * groups in `graphql-infrastructure`, `activity-timeline`, `opik-integration`,\n * `watchers`) ship with empty `assertions[]`, and the inverse projection\n * round-trip must preserve that emptiness or `check-spec-pairing` flags an\n * assertion-count drift.\n */\nfunction buildAssertion(\n state: IRState,\n index: number,\n criteria: IRElementCriteria,\n): LegacyAssertion {\n const description =\n state.metadata?.description ?? `Required element ${index} for state ${state.name}`;\n const targetCriteria: LegacyCriteria = convertCriteria(criteria);\n const assertion: LegacyAssertion = {\n id: `${state.id}-elem-${index}`,\n description,\n category: \"element-presence\",\n severity: \"critical\",\n assertionType: \"exists\",\n target: {\n type: \"search\",\n criteria: targetCriteria,\n label: `Required element for ${state.name}`,\n },\n source: \"ai-generated\",\n reviewed: false,\n enabled: true,\n };\n if (state.precondition !== undefined) {\n assertion.precondition = state.precondition;\n }\n return assertion;\n}\n\n/**\n * Build the legacy `groups[]` entry for one IR state. Emits exactly one\n * assertion per `requiredElement`; states with zero requiredElements project\n * to a group with an empty `assertions[]` array. Legacy consumers (runner\n * spec drift / verify, error monitor curator, AI session) tolerate empty\n * groups — multiple shipping legacy specs already use them for\n * architecture-only / documentation-only groups.\n */\nfunction buildGroup(state: IRState): LegacyGroup {\n const elems = state.requiredElements ?? [];\n const assertions: LegacyAssertion[] = elems.map((c, i) =>\n buildAssertion(state, i, c),\n );\n return {\n id: state.id,\n name: state.name,\n description: state.description ?? state.metadata?.description ?? \"\",\n category: \"element-presence\",\n assertions,\n source: state.provenance?.source ?? \"ai-generated\",\n };\n}\n\n/**\n * Convert an `IRAssertion` (IR-side, free-form criteria) into a `LegacyAssertion`.\n * The shapes are near-identical; the only meaningful difference is that the\n * IR-side `target.criteria` is `Record<string, unknown>` while the legacy\n * shape is `LegacyCriteria` (a typed but extensible record). We pass the\n * criteria object through verbatim — the open `[key: string]: unknown` index\n * signature on `LegacyCriteria` accepts any record shape.\n */\nfunction synthesizedAssertionToLegacy(assertion: IRAssertion): LegacyAssertion {\n const target: LegacyAssertionTarget = {\n type: \"search\",\n criteria: assertion.target.criteria as LegacyCriteria,\n label: assertion.target.label,\n };\n const out: LegacyAssertion = {\n id: assertion.id,\n description: assertion.description,\n category: assertion.category,\n severity: assertion.severity as LegacyAssertion[\"severity\"],\n assertionType: assertion.assertionType,\n target,\n source: assertion.source,\n reviewed: assertion.reviewed,\n enabled: assertion.enabled,\n };\n if (assertion.precondition !== undefined) {\n out.precondition = assertion.precondition;\n }\n return out;\n}\n\n/**\n * Convert a synthesized `IRGroup` into a `LegacyGroup`. Mirrors the legacy\n * shape one-to-one (modulo the free-form criteria pass-through described in\n * `synthesizedAssertionToLegacy`). The synthesized group always carries a\n * `source` (synthesis emits `\"ai-generated\"`); fall back to `\"ai-generated\"`\n * for hand-written IR documents that omit it.\n */\nfunction synthesizedGroupToLegacy(group: IRGroup): LegacyGroup {\n return {\n id: group.id,\n name: group.name,\n description: group.description,\n category: group.category,\n assertions: group.assertions.map(synthesizedAssertionToLegacy),\n source: group.source ?? \"ai-generated\",\n };\n}\n\n/**\n * Convert an IR transition action into the legacy `process[]` step shape.\n * Renames IR's `type` to legacy `action` (matches the runtime engine\n * convention — same as the IR -> WorkflowConfig adapter does for runtime).\n */\nfunction buildProcessStep(action: IRTransitionAction): LegacyProcessStep {\n const out: LegacyProcessStep = {\n action: action.type,\n target: convertCriteria(action.target),\n };\n if (action.waitAfter !== undefined) out.waitAfter = action.waitAfter;\n return out;\n}\n\n/**\n * Convert one IR transition into the legacy state-machine transition shape.\n * Each fromState gets its own copy in the projected output (legacy specs put\n * the transition under each originating state's `transitions[]`).\n */\nfunction buildTransition(transition: IRTransition): LegacyTransition {\n const exitStates = transition.exitStates ?? [];\n return {\n id: transition.id,\n name: transition.name,\n activateStates: transition.activateStates,\n deactivateStates: exitStates,\n // Modal-style transitions (no exit states) stay visible behind the\n // activated state. Otherwise the originating state(s) deactivate, so the\n // page no longer shows them.\n staysVisible: exitStates.length === 0,\n process: transition.actions.map(buildProcessStep),\n };\n}\n\n/**\n * Build the legacy `stateMachine.states[]` entry for one IR state. Includes\n * any transitions that originate from this state (i.e. where state.id is in\n * transition.fromStates).\n */\nfunction buildStateMachineState(\n state: IRState,\n transitions: IRTransition[],\n doc: IRDocument,\n): LegacyStateMachineState {\n const outgoing = transitions\n .filter((t) => t.fromStates.includes(state.id))\n .map(buildTransition);\n const isInitial =\n state.isInitial !== undefined ? state.isInitial : state.id === doc.initialState;\n return {\n id: state.id,\n name: state.name,\n description: state.description ?? \"\",\n elements: (state.requiredElements ?? []).map(convertCriteria),\n isInitial,\n transitions: outgoing,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Public entry point\n// ---------------------------------------------------------------------------\n\n/**\n * Project an IR document into the legacy bundled-page spec shape.\n *\n * Pure / deterministic: same input always produces structurally identical\n * output (and byte-identical when JSON-serialized via the standard\n * `JSON.stringify` ordering). Arrays preserve input order; object keys are\n * sorted lexicographically.\n *\n * @param doc The IR document to project.\n * @param notes Optional human-authored notes (carried in the page's\n * `notes.md` companion file). Appended to `description` as a\n * separate paragraph (separator: two newlines).\n */\nexport function projectIRToBundledPage(doc: IRDocument, notes?: string): LegacySpec {\n const baseDescription = doc.description ?? doc.name;\n const description =\n notes !== undefined && notes.length > 0\n ? `${baseDescription}\\n\\n${notes}`\n : baseDescription;\n\n const component = doc.metadata?.purpose ?? doc.id;\n const metadata: LegacyMetadata = { component };\n if (doc.metadata?.tags !== undefined) metadata.tags = doc.metadata.tags;\n\n const groups: LegacyGroup[] = doc.states.map(buildGroup);\n if (doc.synthesizedGroups !== undefined) {\n // Append synthesis-produced groups AFTER state-derived ones, in declared\n // order. Byte-stable output (see file header) requires this exact ordering\n // — anything else breaks `check-spec-pairing` style hashes.\n for (const g of doc.synthesizedGroups) {\n groups.push(synthesizedGroupToLegacy(g));\n }\n }\n const smStates: LegacyStateMachineState[] = doc.states.map((s) =>\n buildStateMachineState(s, doc.transitions, doc),\n );\n\n const spec: LegacySpec = {\n version: \"1.0.0\",\n description,\n groups,\n stateMachine: { states: smStates },\n metadata,\n };\n\n return sortKeys(spec);\n}\n\n// ---------------------------------------------------------------------------\n// Inverse projection — Legacy spec -> IR document\n// ---------------------------------------------------------------------------\n\n/**\n * Options for the inverse projection.\n *\n * - `docId` — explicit IRDocument.id override. Falls back to\n * `legacy.metadata.component` (or `fallbackName` if absent).\n * - `fallbackName` — used when `legacy.metadata.component` is missing AND no\n * `docId` was supplied.\n */\nexport interface ProjectLegacyToIROptions {\n docId?: string;\n fallbackName?: string;\n}\n\n/**\n * Best-effort field-by-field invert of `LegacyCriteria` back into\n * `IRElementCriteria`.\n *\n * Rename map (the structural inverse of `convertCriteria`):\n * textContent -> text\n * accessibleName -> accessibleName (passes through; the forward direction\n * collapses ariaLabel into accessibleName,\n * so we cannot reliably distinguish them\n * on the inverse — pick accessibleName).\n * dataAttributes -> attributes\n * role / tagName / textContains / id pass through unchanged.\n *\n * Unknown legacy keys are dropped (lossy, but documented). Document-level\n * unknown criteria are rare; if they show up we'll surface them in Phase A4.\n */\nfunction invertCriteria(criteria: LegacyCriteria | undefined): IRElementCriteria {\n if (criteria === undefined || criteria === null) return {};\n const out: IRElementCriteria = {};\n if (criteria.role !== undefined) out.role = criteria.role;\n if (criteria.tagName !== undefined) out.tagName = criteria.tagName;\n if (criteria.textContent !== undefined) out.text = criteria.textContent;\n if (criteria.textContains !== undefined) out.textContains = criteria.textContains;\n if (criteria.accessibleName !== undefined) out.accessibleName = criteria.accessibleName;\n if (criteria.id !== undefined) out.id = criteria.id;\n if (criteria.dataAttributes !== undefined) out.attributes = criteria.dataAttributes;\n return out;\n}\n\n/**\n * Pick the first non-empty `precondition` across a group's assertions. Legacy\n * groups carry preconditions on individual assertions; IR carries it on the\n * state. If multiple distinct preconditions exist we keep the first\n * (deterministic, mirrors input ordering) — Phase A4 review will surface\n * conflicts for hand-fix.\n */\nfunction firstPrecondition(group: LegacyGroup): string | undefined {\n for (const a of group.assertions) {\n if (a.precondition !== undefined && a.precondition.length > 0) {\n return a.precondition;\n }\n }\n return undefined;\n}\n\n/**\n * Build an `IRState` from one legacy group + its corresponding state-machine\n * state (when present).\n *\n * IMPORTANT: `requiredElements` is sourced from the GROUP's assertion criteria\n * (one criteria per assertion, in input order), NOT from `smState.elements`.\n * This preserves the round-trip identity for the assertion-count check —\n * legacy specs sometimes carry an SM block whose `elements[]` is a coarse\n * page-state fingerprint (1-2 entries) while the group has many assertions.\n * Using `smState.elements` would silently collapse those into one\n * requiredElement per state, then the forward direction would emit only one\n * assertion per group.\n *\n * `smState` (when present and matched by id) contributes:\n * - `name` override (legacy `smState.name` is human-readable; group.name is\n * also human-readable but may differ — prefer smState's name since the\n * forward direction's `buildStateMachineState` echoes `state.name` to\n * `smState.name`).\n * - `description` fallback (when group.description is empty).\n * - `isInitial` (the only place this lives in legacy specs).\n */\nfunction buildIRState(\n group: LegacyGroup,\n smState: LegacyStateMachineState | undefined,\n): IRState {\n // Always one requiredElement per assertion so the forward projection emits\n // the same number of assertions on the round-trip.\n const requiredElements: IRElementCriteria[] = group.assertions.map((a) =>\n invertCriteria(a.target?.criteria),\n );\n\n const description =\n group.description !== undefined && group.description.length > 0\n ? group.description\n : smState?.description;\n const precondition = firstPrecondition(group);\n\n const state: IRState = {\n id: group.id,\n name: smState?.name ?? group.name,\n requiredElements,\n };\n if (description !== undefined && description.length > 0) {\n state.description = description;\n }\n if (smState?.isInitial === true) {\n state.isInitial = true;\n } else if (smState?.isInitial === false) {\n state.isInitial = false;\n }\n if (precondition !== undefined) {\n state.precondition = precondition;\n }\n state.provenance = { source: \"migrated\" };\n return state;\n}\n\n/**\n * Convert one legacy `process[]` step back into `IRTransitionAction`. Renames\n * `action` -> `type`. Legacy specs occasionally omit a target on no-op steps;\n * we coerce to an empty criteria object in that case.\n */\nfunction invertProcessStep(step: LegacyProcessStep): IRTransitionAction {\n const out: IRTransitionAction = {\n type: step.action,\n target: invertCriteria(step.target),\n };\n if (step.waitAfter !== undefined) out.waitAfter = step.waitAfter;\n return out;\n}\n\n/**\n * Collapse duplicate transitions across multiple originating states. The\n * forward projection emits the same transition under EACH `fromState`'s\n * `transitions[]` entry; the inverse must merge them back into ONE\n * `IRTransition` whose `fromStates` lists every originator.\n *\n * Same-id transitions are assumed to be byte-identical except for the\n * (implicit) originating state. If they differ in `process[]` /\n * `activateStates` / `deactivateStates`, we keep the first occurrence and\n * append the additional fromState. (Genuine divergence here is a defect to\n * surface in Phase A4 review.)\n */\nfunction buildIRTransitions(stateMachine: LegacyStateMachine | undefined): IRTransition[] {\n if (stateMachine === undefined || !Array.isArray(stateMachine.states)) return [];\n const byId = new Map<string, IRTransition>();\n // Preserve insertion order — first state's transitions come first.\n const order: string[] = [];\n\n for (const smState of stateMachine.states) {\n const transitions = Array.isArray(smState.transitions) ? smState.transitions : [];\n for (const t of transitions) {\n const existing = byId.get(t.id);\n if (existing !== undefined) {\n if (!existing.fromStates.includes(smState.id)) {\n existing.fromStates.push(smState.id);\n }\n continue;\n }\n const ir: IRTransition = {\n id: t.id,\n name: t.name,\n fromStates: [smState.id],\n activateStates: Array.isArray(t.activateStates) ? [...t.activateStates] : [],\n actions: Array.isArray(t.process) ? t.process.map(invertProcessStep) : [],\n };\n // The forward direction maps `exitStates` -> `deactivateStates`; preserve\n // the field whenever it's present in legacy form (even if empty array)\n // so modal-style transitions (staysVisible: true, deactivateStates: [])\n // round-trip predictably.\n if (Array.isArray(t.deactivateStates)) {\n ir.exitStates = [...t.deactivateStates];\n }\n ir.provenance = { source: \"migrated\" };\n byId.set(t.id, ir);\n order.push(t.id);\n }\n }\n\n return order.map((id) => byId.get(id)!);\n}\n\n/**\n * Project a legacy bundled-page spec back into IR.\n *\n * Pure / deterministic: same input always produces structurally identical\n * output. Collapses transition duplicates (forward emits one copy per\n * `fromState`), preserves group/assertion ordering, and tags every node with\n * `provenance.source = \"migrated\"` so downstream tooling can distinguish\n * migrated content from hand-authored.\n *\n * The mapping is the structural inverse of `projectIRToBundledPage`:\n *\n * LegacySpec IRDocument\n * ---------- ----------\n * metadata.component -> id (or opts.docId override)\n * metadata.tags -> metadata.tags\n * description -> description (kept verbatim;\n * authored notes appended via\n * forward `notes` arg are not\n * stripped — that round-trip is\n * best-effort and Phase A4 will\n * split them back out)\n *\n * groups[] -> states[] (one per group)\n * group.id / name / description -> state.id / name / description\n * assertion.target.criteria -> state.requiredElements[i] (or,\n * preferred, smState.elements when\n * the stateMachine block is present)\n * first-found assertion.precondition -> state.precondition\n *\n * stateMachine.states[] -> contributes isInitial + elements\n * smState.transitions[] -> transitions[] (deduped by id)\n * transition.activateStates -> transition.activateStates\n * transition.deactivateStates -> transition.exitStates\n * transition.process[] -> transition.actions[]\n * step.action -> action.type\n * step.target -> action.target (criteria inverted)\n * step.waitAfter -> action.waitAfter\n *\n * Documented losses (acceptable for Phase A2):\n * - Legacy assertion ids (`{stateId}-elem-{i}`) are NOT preserved across the\n * round-trip — the forward direction regenerates them from index, so any\n * hand-edited ids are lost. See Phase A4.\n * - Legacy `assertionType` / `severity` / `category` / `source` per\n * assertion are reduced to defaults on round-trip.\n * - Legacy `expected` / `assertionType: \"count\"` and `notExists` semantics\n * are not modeled in IR — the assertion's criteria still survive (as a\n * state requiredElement) but the assertion-flavor metadata is dropped.\n * - Legacy `testing` block + extra metadata keys outside `component` /\n * `tags` are ignored. Authors keep them via the legacy spec file directly\n * during Phase A2 — they will move into IR companion files in Phase A4.\n * - The forward `notes` argument's appended paragraph is currently kept\n * in `description`; Phase A4 will split it back out into a dedicated\n * companion file.\n *\n * @param legacy The legacy spec to invert.\n * @param opts Optional doc-level overrides.\n */\nexport function projectLegacyToIR(\n legacy: LegacySpec,\n opts?: ProjectLegacyToIROptions,\n): IRDocument {\n const component =\n opts?.docId ??\n legacy.metadata?.component ??\n opts?.fallbackName ??\n \"legacy-spec\";\n const name = legacy.metadata?.component ?? opts?.fallbackName ?? component;\n\n // Index state-machine states by id for quick lookup when building IR states\n // out of groups. Older specs may not have a stateMachine block.\n const smByGroupId = new Map<string, LegacyStateMachineState>();\n if (legacy.stateMachine !== undefined && Array.isArray(legacy.stateMachine.states)) {\n for (const s of legacy.stateMachine.states) {\n smByGroupId.set(s.id, s);\n }\n }\n\n const groups = Array.isArray(legacy.groups) ? legacy.groups : [];\n const states: IRState[] = groups.map((group) =>\n buildIRState(group, smByGroupId.get(group.id)),\n );\n\n // NOTE: Some legacy specs declare `stateMachine.states[]` whose ids do NOT\n // correspond to any `groups[]` entry (e.g., page-level states like\n // `wrappers-installed-tab` vs assertion-category groups like\n // `page-structure`). The IR's group-state mapping is 1:1 with groups by\n // construction (the forward projection emits one group per IR state), so\n // these orphan SM states cannot survive the round-trip cleanly. They are\n // dropped here as a documented loss — Phase A4 will revisit by either\n // (a) introducing a separate IR concept for \"page state\" vs\n // \"assertion group\", or (b) hand-merging the legacy specs so groups and\n // SM states share ids.\n // Transitions originating from orphan SM states are likewise omitted from\n // IR (their fromStates would dangle). We filter them below.\n const groupIds = new Set(groups.map((g) => g.id));\n\n // Build transitions only from SM states whose ids appear in groups[]. Any\n // transition with a fromState that isn't a known group is dropped — the\n // forward direction would have nowhere to emit it.\n let filteredStateMachine: LegacyStateMachine | undefined = legacy.stateMachine;\n if (\n legacy.stateMachine !== undefined &&\n Array.isArray(legacy.stateMachine.states) &&\n legacy.stateMachine.states.some((s) => !groupIds.has(s.id))\n ) {\n filteredStateMachine = {\n states: legacy.stateMachine.states.filter((s) => groupIds.has(s.id)),\n };\n }\n const transitions = buildIRTransitions(filteredStateMachine);\n\n // Initial state: first state with isInitial:true wins (mirrors how the\n // forward direction picks the document's `initialState`). Only consider\n // SM states that correspond to a group (so initialState references a real\n // IR state).\n let initialState: string | undefined;\n if (legacy.stateMachine !== undefined && Array.isArray(legacy.stateMachine.states)) {\n const initial = legacy.stateMachine.states.find(\n (s) => s.isInitial === true && groupIds.has(s.id),\n );\n if (initial !== undefined) initialState = initial.id;\n }\n\n const doc: IRDocument = {\n version: \"1.0\",\n id: component,\n name,\n states,\n transitions,\n provenance: { source: \"migrated\" },\n };\n if (legacy.description !== undefined && legacy.description.length > 0) {\n doc.description = legacy.description;\n }\n if (legacy.metadata !== undefined && legacy.metadata.tags !== undefined) {\n doc.metadata = { tags: legacy.metadata.tags };\n }\n if (initialState !== undefined) {\n doc.initialState = initialState;\n }\n return doc;\n}\n"],"mappings":";AA4GA,IAAM,wBAAwB,oBAAI,IAAY,CAAC,KAAK,CAAC;AAO9C,SAAS,aAAa,OAA8B;AACzD,QAAM,MAAoB;AAAA,IACxB,IAAI,MAAM;AAAA,IACV,MAAM,MAAM;AAAA,IACZ,kBAAkB,MAAM;AAAA,EAC1B;AACA,MAAI,MAAM,gBAAgB,OAAW,KAAI,cAAc,MAAM;AAC7D,MAAI,MAAM,qBAAqB,OAAW,KAAI,mBAAmB,MAAM;AACvE,MAAI,MAAM,eAAe,OAAW,KAAI,aAAa,MAAM;AAC3D,MAAI,MAAM,cAAc,OAAW,KAAI,YAAY,MAAM;AACzD,MAAI,MAAM,eAAe,OAAW,KAAI,aAAa,MAAM;AAC3D,MAAI,MAAM,aAAa,OAAW,KAAI,WAAW,MAAM;AACvD,MAAI,MAAM,UAAU,OAAW,KAAI,QAAQ,MAAM;AACjD,MAAI,MAAM,aAAa,OAAW,KAAI,WAAW,MAAM;AACvD,SAAO;AACT;AAMA,IAAM,qBAAqB,oBAAI,IAA8B;AAAA,EAC3D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,SAAS,iBAAiB,MAAgD;AACxE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,OAAO,iBAAiB,UACxB,MAAM,QAAQ,OAAO,aAAa,MAAM,KACxC,OAAO,aAAa,OAAO,KAAK,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC,GAC1D;AACA,2BAAuB;AAAA,MACrB,QAAQ,OAAO,aAAa,OAAO,OAAO,CAAC,MAAM,SAAS,IAAI,EAAE,EAAE,CAAC;AAAA,IACrE;AAAA,EACF;AACA,QAAM,cAAc,mBAAmB,oBAAoB;AAM3D,MAAI;AACJ,MAAI,OAAO,iBAAiB,UAAa,MAAM,QAAQ,OAAO,aAAa,MAAM,GAAG;AAClF,UAAM,UAAU,OAAO,aAAa,OAAO;AAAA,MACzC,CAAC,MAAM,EAAE,cAAc,QAAQ,SAAS,IAAI,EAAE,EAAE;AAAA,IAClD;AACA,QAAI,YAAY,OAAW,gBAAe,QAAQ;AAAA,EACpD;AAEA,QAAM,MAAkB;AAAA,IACtB,SAAS;AAAA,IACT,IAAI;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY,EAAE,QAAQ,WAAW;AAAA,EACnC;AACA,MAAI,OAAO,gBAAgB,UAAa,OAAO,YAAY,SAAS,GAAG;AACrE,QAAI,cAAc,OAAO;AAAA,EAC3B;AACA,MAAI,OAAO,aAAa,UAAa,OAAO,SAAS,SAAS,QAAW;AACvE,QAAI,WAAW,EAAE,MAAM,OAAO,SAAS,KAAK;AAAA,EAC9C;AACA,MAAI,iBAAiB,QAAW;AAC9B,QAAI,eAAe;AAAA,EACrB;AACA,SAAO;AACT;","names":[]}
|
package/dist/workflow.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/workflow/index.ts","../src/workflow/_api.ts"],"sourcesContent":["export * from \"./_api\";\r\n","/**\r\n * Workflow Types\r\n *\r\n * Canonical type definitions for the unified Workflow Builder system.\r\n * Shared across qontinui-runner and qontinui-web.\r\n *\r\n * All automation is organized into four phases: Setup, Verification, Agentic, Completion.\r\n *\r\n * Execution Order:\r\n * Setup (once) -> [Verification <-> Agentic]* -> Completion (once)\r\n *\r\n * Step Types (4 core types):\r\n * command - Shell commands, checks, check groups, tests\r\n * ui_bridge - UI Bridge SDK interactions (navigate, execute, assert, snapshot)\r\n * prompt - AI task instructions\r\n * workflow - Run a saved workflow inline (composition)\r\n */\r\n\r\n// =============================================================================\r\n// Generated frame types — source of truth is qontinui-schemas/rust/src/workflow.rs\r\n// These are produced by the schemars -> JSON Schema -> json-schema-to-typescript\r\n// pipeline. Do NOT redeclare them here; re-export from ../generated/*.\r\n//\r\n// Step arrays on UnifiedWorkflow / WorkflowStage are typed as `unknown[]` by\r\n// the generator. Typed step arrays are part of the Wave 4 step migration and\r\n// remain hand-authored below (BaseStep, CommandStep, PromptStep, UiBridgeStep,\r\n// WorkflowStep, and the per-phase aliases).\r\n// =============================================================================\r\n\r\nexport type { LogSourceSelection } from \"../generated/LogSourceSelection\";\r\nexport type { HealthCheckUrl } from \"../generated/HealthCheckUrl\";\r\nexport type { RoutingRule } from \"../generated/RoutingRule\";\r\nexport type { ModelOverrideConfig } from \"../generated/ModelOverrideConfig\";\r\nexport type { StageCondition } from \"../generated/StageCondition\";\r\nexport type { RetryPolicy } from \"../generated/RetryPolicy\";\r\nexport type { StageOutput } from \"../generated/StageOutput\";\r\nexport type { StageInput } from \"../generated/StageInput\";\r\nexport type { WorkflowStage } from \"../generated/WorkflowStage\";\r\nexport type { UnifiedWorkflow } from \"../generated/UnifiedWorkflow\";\r\nexport type { WorkflowArchitecture } from \"../generated/WorkflowArchitecture\";\r\n\r\nexport type { BaseStepFields } from \"../generated/BaseStepFields\";\r\nexport type { RetrySpec } from \"../generated/RetrySpec\";\r\n\r\n// Step DTOs (generated from qontinui-types::workflow_step)\r\nexport type { CommandStep } from \"../generated/CommandStep\";\r\nexport type { PromptStep } from \"../generated/PromptStep\";\r\nexport type { UiBridgeStep } from \"../generated/UiBridgeStep\";\r\nexport type { WorkflowStep } from \"../generated/WorkflowStep\";\r\nexport type { UnifiedStep } from \"../generated/UnifiedStep\";\r\nexport type { CanonicalStep } from \"../generated/CanonicalStep\";\r\nexport type { HttpMethod } from \"../generated/HttpMethod\";\r\nexport type { ApiContentType } from \"../generated/ApiContentType\";\r\nexport type { ApiAssertion } from \"../generated/ApiAssertion\";\r\nexport type { ApiVariableExtraction } from \"../generated/ApiVariableExtraction\";\r\nexport type { TestType } from \"../generated/TestType\";\r\nexport type { PlaywrightExecutionMode } from \"../generated/PlaywrightExecutionMode\";\r\nexport type { CheckType } from \"../generated/CheckType\";\r\nexport type { CommandMode } from \"../generated/CommandMode\";\r\nexport type { UiBridgeAction } from \"../generated/UiBridgeAction\";\r\nexport type { VerificationCategoryKind } from \"../generated/VerificationCategoryKind\";\r\n\r\n// ModelOverrides is a hand-authored convenience alias: the generated\r\n// UnifiedWorkflow / WorkflowStage type `model_overrides` as an open\r\n// `{ [k: string]: ModelOverrideConfig }`, but downstream code prefers a\r\n// named type with known phase keys. Keep as a local alias over the generated\r\n// per-phase config.\r\nimport type { ModelOverrideConfig as _ModelOverrideConfig } from \"../generated/ModelOverrideConfig\";\r\n\r\nexport type ModelOverrides = {\r\n setup?: _ModelOverrideConfig;\r\n agentic?: _ModelOverrideConfig;\r\n completion?: _ModelOverrideConfig;\r\n verification?: _ModelOverrideConfig;\r\n investigation?: _ModelOverrideConfig;\r\n summary?: _ModelOverrideConfig;\r\n generation?: _ModelOverrideConfig;\r\n};\r\n\r\n// =============================================================================\r\n// Phases\r\n// =============================================================================\r\n\r\nexport type WorkflowPhase = \"setup\" | \"verification\" | \"agentic\" | \"completion\";\r\n\r\n// =============================================================================\r\n// Skill Types (re-exported from ./skill)\r\n// =============================================================================\r\n\r\nexport type {\r\n SkillCategory,\r\n SkillAuthor,\r\n SkillParameterOption,\r\n SkillParameter,\r\n SingleStepTemplate,\r\n MultiStepTemplate,\r\n CompositionTemplate,\r\n SkillRef,\r\n SkillTemplate,\r\n SkillDefinition,\r\n SkillOrigin,\r\n SkillExportManifest,\r\n SkillExport,\r\n SkillImportResult,\r\n} from \"./skill\";\r\n\r\nexport type {\r\n PlannedActionType,\r\n ElementTarget,\r\n PlannedAction,\r\n ActionPlan,\r\n PlannedActionResult,\r\n ActionPlanResult,\r\n ActionPlanExecuteRequest,\r\n} from \"./action-plan\";\r\n\r\n// =============================================================================\r\n// Step Types — generated from qontinui-types::workflow_step\r\n//\r\n// The four canonical step variants (CommandStep, PromptStep, UiBridgeStep,\r\n// WorkflowStep) and their helper unions (HttpMethod, ApiContentType, …) are\r\n// re-exported at the top of this file from ../generated/*. The remaining\r\n// hand-authored types in this section are TS-only sugar: a `BaseStep` alias\r\n// for consumers that still want a name for the shared-fields subset, a\r\n// `StepTypeName` literal that includes non-canonical runner-side variants\r\n// (e.g. native_accessibility) for UI listings, and the phase-alias types.\r\n//\r\n// Phase narrowing is TS-only sugar — not a wire concern. The generator emits\r\n// a narrow `phase` field on each variant; these aliases just group the four\r\n// variants by the phase that can carry them.\r\n// =============================================================================\r\n\r\nimport type { CommandStep as _CommandStep } from \"../generated/CommandStep\";\r\nimport type { PromptStep as _PromptStep } from \"../generated/PromptStep\";\r\nimport type { UiBridgeStep as _UiBridgeStep } from \"../generated/UiBridgeStep\";\r\nimport type { WorkflowStep as _WorkflowStep } from \"../generated/WorkflowStep\";\r\n\r\n/**\r\n * Shared-fields subset carried by every canonical step variant.\r\n *\r\n * Alias for the generated `BaseStepFields` so downstream code can still\r\n * reference `BaseStep` by name. Source of truth:\r\n * `qontinui-types::workflow_step::BaseStepFields`.\r\n */\r\nimport type { BaseStepFields as _BaseStepFields } from \"../generated/BaseStepFields\";\r\nexport type BaseStep = _BaseStepFields;\r\n\r\n// =============================================================================\r\n// Step Type Names\r\n// =============================================================================\r\n\r\n// Includes runner-side non-canonical variants (e.g. `native_accessibility`)\r\n// that appear in the UI listing but are not part of the `UnifiedStep` DTO.\r\nexport type StepTypeName = \"command\" | \"ui_bridge\" | \"prompt\" | \"workflow\" | \"native_accessibility\";\r\n\r\n// =============================================================================\r\n// Phase-alias types (TS-only sugar over the generated UnifiedStep)\r\n// =============================================================================\r\n\r\nexport type SetupStep = _CommandStep | _PromptStep | _UiBridgeStep | _WorkflowStep;\r\nexport type VerificationStep = _CommandStep | _PromptStep | _UiBridgeStep | _WorkflowStep;\r\nexport type AgenticStep = _PromptStep;\r\nexport type CompletionStep = _CommandStep | _PromptStep | _UiBridgeStep | _WorkflowStep;\r\n\r\n// =============================================================================\r\n// Verification Categories\r\n// =============================================================================\r\n\r\n// Alias for the generated `VerificationCategoryKind` union. Source of truth:\r\n// `qontinui-types::workflow_step::VerificationCategoryKind`. `VerificationCategoryKind`\r\n// itself is re-exported earlier in this file.\r\nimport type { VerificationCategoryKind as _VerificationCategoryKind } from \"../generated/VerificationCategoryKind\";\r\nexport type VerificationCategory = _VerificationCategoryKind;\r\n\r\n// =============================================================================\r\n// Dependency Graph\r\n// =============================================================================\r\n\r\nexport interface DependencyNode {\r\n id: string;\r\n label: string;\r\n type: string;\r\n phase: WorkflowPhase;\r\n is_referenced: boolean;\r\n cost_category?: string;\r\n}\r\n\r\nexport interface DependencyEdge {\r\n source: string;\r\n target: string;\r\n label?: string;\r\n edge_type: \"explicit_depends_on\" | \"implicit_reference\" | \"setup_provides\";\r\n}\r\n\r\nexport interface DependencyGraph {\r\n nodes: DependencyNode[];\r\n edges: DependencyEdge[];\r\n}\r\n\r\n// =============================================================================\r\n// Cost Annotations\r\n// =============================================================================\r\n\r\nexport type CostCategory =\r\n | \"network\"\r\n | \"ai_call\"\r\n | \"setup\"\r\n | \"ui_interaction\";\r\n\r\nexport interface StepCost {\r\n step_id: string;\r\n name: string;\r\n estimated_ms: number;\r\n category: CostCategory;\r\n has_side_effects: boolean;\r\n}\r\n\r\nexport interface CostAnnotations {\r\n steps: StepCost[];\r\n total_estimated_ms: number;\r\n}\r\n\r\n// =============================================================================\r\n// Quality Report\r\n// =============================================================================\r\n\r\nexport type QualityFindingSeverity = \"critical\" | \"warning\" | \"info\";\r\n\r\nexport type QualityFindingCategory =\r\n | \"verification_gap\"\r\n | \"missing_criterion\"\r\n | \"unnecessary_step\"\r\n | \"weak_retry\"\r\n | \"required_flag_violation\"\r\n | \"retry_inconsistency\"\r\n | \"data_contract_violation\"\r\n | \"false_positive_risk\";\r\n\r\nexport interface QualityFinding {\r\n finding_id: string;\r\n step_id?: string;\r\n severity: QualityFindingSeverity;\r\n category: QualityFindingCategory;\r\n description: string;\r\n suggested_fix?: string;\r\n}\r\n\r\nexport interface CoverageMatrix {\r\n criteria_to_steps: Record<string, string[]>;\r\n steps_to_criteria: Record<string, string[]>;\r\n uncovered_criteria: string[];\r\n unlinked_steps: string[];\r\n}\r\n\r\nexport interface QualityReport {\r\n findings: QualityFinding[];\r\n score: number;\r\n pass: boolean;\r\n coverage_matrix?: CoverageMatrix;\r\n}\r\n\r\n// =============================================================================\r\n// Export/Import Types\r\n// =============================================================================\r\n\r\nimport type { UnifiedWorkflow as _UnifiedWorkflow } from \"../generated/UnifiedWorkflow\";\r\n\r\nexport interface WorkflowExportManifest {\r\n version: string;\r\n exported_at: string;\r\n app_version: string;\r\n content_type: \"unified_workflow\";\r\n}\r\n\r\nexport interface WorkflowExport {\r\n manifest: WorkflowExportManifest;\r\n workflow: _UnifiedWorkflow;\r\n}\r\n\r\nexport interface WorkflowImportResult {\r\n workflow: _UnifiedWorkflow;\r\n overwritten: boolean;\r\n original_id: string | null;\r\n}\r\n\r\n// =============================================================================\r\n// Feature Detection\r\n// =============================================================================\r\n\r\nexport interface WorkflowFeatures {\r\n hasSetup: boolean;\r\n hasVerification: boolean;\r\n hasAgentic: boolean;\r\n hasCompletion: boolean;\r\n hasUiBridge: boolean;\r\n showIterationSettings: boolean;\r\n hasAiPrompts: boolean;\r\n}\r\n\r\n// =============================================================================\r\n// Step Type Display Info\r\n// =============================================================================\r\n\r\nexport interface StepTypeInfo {\r\n type: string;\r\n label: string;\r\n description: string;\r\n icon: string;\r\n color: string;\r\n phase: WorkflowPhase;\r\n}\r\n\r\n// =============================================================================\r\n// Step Type Constants\r\n// =============================================================================\r\n\r\nexport const STEP_TYPES: Record<WorkflowPhase, StepTypeInfo[]> = {\r\n setup: [\r\n {\r\n type: \"command\",\r\n label: \"Command\",\r\n description: \"Run shell commands, checks, or tests\",\r\n icon: \"Terminal\",\r\n color: \"gray\",\r\n phase: \"setup\",\r\n },\r\n {\r\n type: \"ui_bridge\",\r\n label: \"UI Bridge\",\r\n description: \"Interact with UI via UI Bridge SDK\",\r\n icon: \"Monitor\",\r\n color: \"emerald\",\r\n phase: \"setup\",\r\n },\r\n {\r\n type: \"prompt\",\r\n label: \"AI Task\",\r\n description: \"AI-driven task\",\r\n icon: \"Bot\",\r\n color: \"violet\",\r\n phase: \"setup\",\r\n },\r\n {\r\n type: \"workflow\",\r\n label: \"Workflow\",\r\n description: \"Run a saved workflow\",\r\n icon: \"Workflow\",\r\n color: \"blue\",\r\n phase: \"setup\",\r\n },\r\n ],\r\n verification: [\r\n {\r\n type: \"command\",\r\n label: \"Command\",\r\n description: \"Run commands, checks, or tests for verification\",\r\n icon: \"Terminal\",\r\n color: \"gray\",\r\n phase: \"verification\",\r\n },\r\n {\r\n type: \"ui_bridge\",\r\n label: \"UI Bridge\",\r\n description: \"Verify UI state via UI Bridge\",\r\n icon: \"Monitor\",\r\n color: \"emerald\",\r\n phase: \"verification\",\r\n },\r\n {\r\n type: \"prompt\",\r\n label: \"AI Verification\",\r\n description: \"AI-evaluated criteria\",\r\n icon: \"Bot\",\r\n color: \"violet\",\r\n phase: \"verification\",\r\n },\r\n {\r\n type: \"workflow\",\r\n label: \"Workflow\",\r\n description: \"Run a saved workflow for verification\",\r\n icon: \"Workflow\",\r\n color: \"blue\",\r\n phase: \"verification\",\r\n },\r\n {\r\n type: \"native_accessibility\",\r\n label: \"Native Accessibility\",\r\n description: \"Run a native accessibility audit using OS-level APIs\",\r\n icon: \"Accessibility\",\r\n color: \"teal\",\r\n phase: \"verification\",\r\n },\r\n ],\r\n agentic: [\r\n {\r\n type: \"prompt\",\r\n label: \"Prompt\",\r\n description: \"AI task instructions\",\r\n icon: \"MessageSquare\",\r\n color: \"amber\",\r\n phase: \"agentic\",\r\n },\r\n ],\r\n completion: [\r\n {\r\n type: \"command\",\r\n label: \"Command\",\r\n description: \"Run cleanup commands or final tests\",\r\n icon: \"Terminal\",\r\n color: \"gray\",\r\n phase: \"completion\",\r\n },\r\n {\r\n type: \"ui_bridge\",\r\n label: \"UI Bridge\",\r\n description: \"Final UI interactions\",\r\n icon: \"Monitor\",\r\n color: \"emerald\",\r\n phase: \"completion\",\r\n },\r\n {\r\n type: \"prompt\",\r\n label: \"AI Completion\",\r\n description: \"Final AI actions\",\r\n icon: \"Bot\",\r\n color: \"violet\",\r\n phase: \"completion\",\r\n },\r\n {\r\n type: \"workflow\",\r\n label: \"Workflow\",\r\n description: \"Run a saved workflow as a completion step\",\r\n icon: \"Workflow\",\r\n color: \"blue\",\r\n phase: \"completion\",\r\n },\r\n ],\r\n};\r\n\r\n// =============================================================================\r\n// Phase Display Info\r\n// =============================================================================\r\n\r\nexport const PHASE_INFO: Record<\r\n WorkflowPhase,\r\n { label: string; description: string; color: string }\r\n> = {\r\n setup: {\r\n label: \"Setup\",\r\n description: \"Runs once at the beginning\",\r\n color: \"blue\",\r\n },\r\n verification: {\r\n label: \"Verification\",\r\n description: \"Checks success criteria, loops with agentic\",\r\n color: \"green\",\r\n },\r\n agentic: {\r\n label: \"Agentic\",\r\n description: \"AI work, iterates until verification passes\",\r\n color: \"amber\",\r\n },\r\n completion: {\r\n label: \"Completion\",\r\n description: \"Runs once after the loop exits\",\r\n color: \"purple\",\r\n },\r\n};\r\n\r\n// =============================================================================\r\n// Summary Step Constants\r\n// =============================================================================\r\n\r\nexport const DEFAULT_SUMMARY_PROMPT = `Write a one-paragraph summary of all the tasks completed in this workflow. Include what was accomplished, whether the stated goal was achieved, any issues encountered and how they were resolved, and remaining work if the goal was not fully achieved. Be concise but comprehensive.`;\r\n"],"mappings":";;;;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IACT;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,YAAY;AAAA,IACV;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,EACF;AACF;AAMO,IAAM,aAGT;AAAA,EACF,OAAO;AAAA,IACL,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,EACT;AAAA,EACA,cAAc;AAAA,IACZ,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,EACT;AAAA,EACA,SAAS;AAAA,IACP,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,EACT;AAAA,EACA,YAAY;AAAA,IACV,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,EACT;AACF;AAMO,IAAM,yBAAyB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/workflow/index.ts","../src/workflow/_api.ts"],"sourcesContent":["export * from \"./_api\";\n","/**\n * Workflow Types\n *\n * Canonical type definitions for the unified Workflow Builder system.\n * Shared across qontinui-runner and qontinui-web.\n *\n * All automation is organized into four phases: Setup, Verification, Agentic, Completion.\n *\n * Execution Order:\n * Setup (once) -> [Verification <-> Agentic]* -> Completion (once)\n *\n * Step Types (4 core types):\n * command - Shell commands, checks, check groups, tests\n * ui_bridge - UI Bridge SDK interactions (navigate, execute, assert, snapshot)\n * prompt - AI task instructions\n * workflow - Run a saved workflow inline (composition)\n */\n\n// =============================================================================\n// Generated frame types — source of truth is qontinui-schemas/rust/src/workflow.rs\n// These are produced by the schemars -> JSON Schema -> json-schema-to-typescript\n// pipeline. Do NOT redeclare them here; re-export from ../generated/*.\n//\n// Step arrays on UnifiedWorkflow / WorkflowStage are typed as `unknown[]` by\n// the generator. Typed step arrays are part of the Wave 4 step migration and\n// remain hand-authored below (BaseStep, CommandStep, PromptStep, UiBridgeStep,\n// WorkflowStep, and the per-phase aliases).\n// =============================================================================\n\nexport type { LogSourceSelection } from \"../generated/LogSourceSelection\";\nexport type { HealthCheckUrl } from \"../generated/HealthCheckUrl\";\nexport type { RoutingRule } from \"../generated/RoutingRule\";\nexport type { ModelOverrideConfig } from \"../generated/ModelOverrideConfig\";\nexport type { StageCondition } from \"../generated/StageCondition\";\nexport type { RetryPolicy } from \"../generated/RetryPolicy\";\nexport type { StageOutput } from \"../generated/StageOutput\";\nexport type { StageInput } from \"../generated/StageInput\";\nexport type { WorkflowStage } from \"../generated/WorkflowStage\";\nexport type { UnifiedWorkflow } from \"../generated/UnifiedWorkflow\";\nexport type { WorkflowArchitecture } from \"../generated/WorkflowArchitecture\";\n\nexport type { BaseStepFields } from \"../generated/BaseStepFields\";\nexport type { RetrySpec } from \"../generated/RetrySpec\";\n\n// Step DTOs (generated from qontinui-types::workflow_step)\nexport type { CommandStep } from \"../generated/CommandStep\";\nexport type { PromptStep } from \"../generated/PromptStep\";\nexport type { UiBridgeStep } from \"../generated/UiBridgeStep\";\nexport type { WorkflowStep } from \"../generated/WorkflowStep\";\nexport type { UnifiedStep } from \"../generated/UnifiedStep\";\nexport type { CanonicalStep } from \"../generated/CanonicalStep\";\nexport type { HttpMethod } from \"../generated/HttpMethod\";\nexport type { ApiContentType } from \"../generated/ApiContentType\";\nexport type { ApiAssertion } from \"../generated/ApiAssertion\";\nexport type { ApiVariableExtraction } from \"../generated/ApiVariableExtraction\";\nexport type { TestType } from \"../generated/TestType\";\nexport type { PlaywrightExecutionMode } from \"../generated/PlaywrightExecutionMode\";\nexport type { CheckType } from \"../generated/CheckType\";\nexport type { CommandMode } from \"../generated/CommandMode\";\nexport type { UiBridgeAction } from \"../generated/UiBridgeAction\";\nexport type { VerificationCategoryKind } from \"../generated/VerificationCategoryKind\";\n\n// ModelOverrides is a hand-authored convenience alias: the generated\n// UnifiedWorkflow / WorkflowStage type `model_overrides` as an open\n// `{ [k: string]: ModelOverrideConfig }`, but downstream code prefers a\n// named type with known phase keys. Keep as a local alias over the generated\n// per-phase config.\nimport type { ModelOverrideConfig as _ModelOverrideConfig } from \"../generated/ModelOverrideConfig\";\n\nexport type ModelOverrides = {\n setup?: _ModelOverrideConfig;\n agentic?: _ModelOverrideConfig;\n completion?: _ModelOverrideConfig;\n verification?: _ModelOverrideConfig;\n investigation?: _ModelOverrideConfig;\n summary?: _ModelOverrideConfig;\n generation?: _ModelOverrideConfig;\n};\n\n// =============================================================================\n// Phases\n// =============================================================================\n\nexport type WorkflowPhase = \"setup\" | \"verification\" | \"agentic\" | \"completion\";\n\n// =============================================================================\n// Skill Types (re-exported from ./skill)\n// =============================================================================\n\nexport type {\n SkillCategory,\n SkillAuthor,\n SkillParameterOption,\n SkillParameter,\n SingleStepTemplate,\n MultiStepTemplate,\n CompositionTemplate,\n SkillRef,\n SkillTemplate,\n SkillDefinition,\n SkillOrigin,\n SkillExportManifest,\n SkillExport,\n SkillImportResult,\n} from \"./skill\";\n\nexport type {\n PlannedActionType,\n ElementTarget,\n PlannedAction,\n ActionPlan,\n PlannedActionResult,\n ActionPlanResult,\n ActionPlanExecuteRequest,\n} from \"./action-plan\";\n\n// =============================================================================\n// Step Types — generated from qontinui-types::workflow_step\n//\n// The four canonical step variants (CommandStep, PromptStep, UiBridgeStep,\n// WorkflowStep) and their helper unions (HttpMethod, ApiContentType, …) are\n// re-exported at the top of this file from ../generated/*. The remaining\n// hand-authored types in this section are TS-only sugar: a `BaseStep` alias\n// for consumers that still want a name for the shared-fields subset, a\n// `StepTypeName` literal that includes non-canonical runner-side variants\n// (e.g. native_accessibility) for UI listings, and the phase-alias types.\n//\n// Phase narrowing is TS-only sugar — not a wire concern. The generator emits\n// a narrow `phase` field on each variant; these aliases just group the four\n// variants by the phase that can carry them.\n// =============================================================================\n\nimport type { CommandStep as _CommandStep } from \"../generated/CommandStep\";\nimport type { PromptStep as _PromptStep } from \"../generated/PromptStep\";\nimport type { UiBridgeStep as _UiBridgeStep } from \"../generated/UiBridgeStep\";\nimport type { WorkflowStep as _WorkflowStep } from \"../generated/WorkflowStep\";\n\n/**\n * Shared-fields subset carried by every canonical step variant.\n *\n * Alias for the generated `BaseStepFields` so downstream code can still\n * reference `BaseStep` by name. Source of truth:\n * `qontinui-types::workflow_step::BaseStepFields`.\n */\nimport type { BaseStepFields as _BaseStepFields } from \"../generated/BaseStepFields\";\nexport type BaseStep = _BaseStepFields;\n\n// =============================================================================\n// Step Type Names\n// =============================================================================\n\n// Includes runner-side non-canonical variants (e.g. `native_accessibility`)\n// that appear in the UI listing but are not part of the `UnifiedStep` DTO.\nexport type StepTypeName = \"command\" | \"ui_bridge\" | \"prompt\" | \"workflow\" | \"native_accessibility\";\n\n// =============================================================================\n// Phase-alias types (TS-only sugar over the generated UnifiedStep)\n// =============================================================================\n\nexport type SetupStep = _CommandStep | _PromptStep | _UiBridgeStep | _WorkflowStep;\nexport type VerificationStep = _CommandStep | _PromptStep | _UiBridgeStep | _WorkflowStep;\nexport type AgenticStep = _PromptStep;\nexport type CompletionStep = _CommandStep | _PromptStep | _UiBridgeStep | _WorkflowStep;\n\n// =============================================================================\n// Verification Categories\n// =============================================================================\n\n// Alias for the generated `VerificationCategoryKind` union. Source of truth:\n// `qontinui-types::workflow_step::VerificationCategoryKind`. `VerificationCategoryKind`\n// itself is re-exported earlier in this file.\nimport type { VerificationCategoryKind as _VerificationCategoryKind } from \"../generated/VerificationCategoryKind\";\nexport type VerificationCategory = _VerificationCategoryKind;\n\n// =============================================================================\n// Dependency Graph\n// =============================================================================\n\nexport interface DependencyNode {\n id: string;\n label: string;\n type: string;\n phase: WorkflowPhase;\n is_referenced: boolean;\n cost_category?: string;\n}\n\nexport interface DependencyEdge {\n source: string;\n target: string;\n label?: string;\n edge_type: \"explicit_depends_on\" | \"implicit_reference\" | \"setup_provides\";\n}\n\nexport interface DependencyGraph {\n nodes: DependencyNode[];\n edges: DependencyEdge[];\n}\n\n// =============================================================================\n// Cost Annotations\n// =============================================================================\n\nexport type CostCategory =\n | \"network\"\n | \"ai_call\"\n | \"setup\"\n | \"ui_interaction\";\n\nexport interface StepCost {\n step_id: string;\n name: string;\n estimated_ms: number;\n category: CostCategory;\n has_side_effects: boolean;\n}\n\nexport interface CostAnnotations {\n steps: StepCost[];\n total_estimated_ms: number;\n}\n\n// =============================================================================\n// Quality Report\n// =============================================================================\n\nexport type QualityFindingSeverity = \"critical\" | \"warning\" | \"info\";\n\nexport type QualityFindingCategory =\n | \"verification_gap\"\n | \"missing_criterion\"\n | \"unnecessary_step\"\n | \"weak_retry\"\n | \"required_flag_violation\"\n | \"retry_inconsistency\"\n | \"data_contract_violation\"\n | \"false_positive_risk\";\n\nexport interface QualityFinding {\n finding_id: string;\n step_id?: string;\n severity: QualityFindingSeverity;\n category: QualityFindingCategory;\n description: string;\n suggested_fix?: string;\n}\n\nexport interface CoverageMatrix {\n criteria_to_steps: Record<string, string[]>;\n steps_to_criteria: Record<string, string[]>;\n uncovered_criteria: string[];\n unlinked_steps: string[];\n}\n\nexport interface QualityReport {\n findings: QualityFinding[];\n score: number;\n pass: boolean;\n coverage_matrix?: CoverageMatrix;\n}\n\n// =============================================================================\n// Export/Import Types\n// =============================================================================\n\nimport type { UnifiedWorkflow as _UnifiedWorkflow } from \"../generated/UnifiedWorkflow\";\n\nexport interface WorkflowExportManifest {\n version: string;\n exported_at: string;\n app_version: string;\n content_type: \"unified_workflow\";\n}\n\nexport interface WorkflowExport {\n manifest: WorkflowExportManifest;\n workflow: _UnifiedWorkflow;\n}\n\nexport interface WorkflowImportResult {\n workflow: _UnifiedWorkflow;\n overwritten: boolean;\n original_id: string | null;\n}\n\n// =============================================================================\n// Feature Detection\n// =============================================================================\n\nexport interface WorkflowFeatures {\n hasSetup: boolean;\n hasVerification: boolean;\n hasAgentic: boolean;\n hasCompletion: boolean;\n hasUiBridge: boolean;\n showIterationSettings: boolean;\n hasAiPrompts: boolean;\n}\n\n// =============================================================================\n// Step Type Display Info\n// =============================================================================\n\nexport interface StepTypeInfo {\n type: string;\n label: string;\n description: string;\n icon: string;\n color: string;\n phase: WorkflowPhase;\n}\n\n// =============================================================================\n// Step Type Constants\n// =============================================================================\n\nexport const STEP_TYPES: Record<WorkflowPhase, StepTypeInfo[]> = {\n setup: [\n {\n type: \"command\",\n label: \"Command\",\n description: \"Run shell commands, checks, or tests\",\n icon: \"Terminal\",\n color: \"gray\",\n phase: \"setup\",\n },\n {\n type: \"ui_bridge\",\n label: \"UI Bridge\",\n description: \"Interact with UI via UI Bridge SDK\",\n icon: \"Monitor\",\n color: \"emerald\",\n phase: \"setup\",\n },\n {\n type: \"prompt\",\n label: \"AI Task\",\n description: \"AI-driven task\",\n icon: \"Bot\",\n color: \"violet\",\n phase: \"setup\",\n },\n {\n type: \"workflow\",\n label: \"Workflow\",\n description: \"Run a saved workflow\",\n icon: \"Workflow\",\n color: \"blue\",\n phase: \"setup\",\n },\n ],\n verification: [\n {\n type: \"command\",\n label: \"Command\",\n description: \"Run commands, checks, or tests for verification\",\n icon: \"Terminal\",\n color: \"gray\",\n phase: \"verification\",\n },\n {\n type: \"ui_bridge\",\n label: \"UI Bridge\",\n description: \"Verify UI state via UI Bridge\",\n icon: \"Monitor\",\n color: \"emerald\",\n phase: \"verification\",\n },\n {\n type: \"prompt\",\n label: \"AI Verification\",\n description: \"AI-evaluated criteria\",\n icon: \"Bot\",\n color: \"violet\",\n phase: \"verification\",\n },\n {\n type: \"workflow\",\n label: \"Workflow\",\n description: \"Run a saved workflow for verification\",\n icon: \"Workflow\",\n color: \"blue\",\n phase: \"verification\",\n },\n {\n type: \"native_accessibility\",\n label: \"Native Accessibility\",\n description: \"Run a native accessibility audit using OS-level APIs\",\n icon: \"Accessibility\",\n color: \"teal\",\n phase: \"verification\",\n },\n ],\n agentic: [\n {\n type: \"prompt\",\n label: \"Prompt\",\n description: \"AI task instructions\",\n icon: \"MessageSquare\",\n color: \"amber\",\n phase: \"agentic\",\n },\n ],\n completion: [\n {\n type: \"command\",\n label: \"Command\",\n description: \"Run cleanup commands or final tests\",\n icon: \"Terminal\",\n color: \"gray\",\n phase: \"completion\",\n },\n {\n type: \"ui_bridge\",\n label: \"UI Bridge\",\n description: \"Final UI interactions\",\n icon: \"Monitor\",\n color: \"emerald\",\n phase: \"completion\",\n },\n {\n type: \"prompt\",\n label: \"AI Completion\",\n description: \"Final AI actions\",\n icon: \"Bot\",\n color: \"violet\",\n phase: \"completion\",\n },\n {\n type: \"workflow\",\n label: \"Workflow\",\n description: \"Run a saved workflow as a completion step\",\n icon: \"Workflow\",\n color: \"blue\",\n phase: \"completion\",\n },\n ],\n};\n\n// =============================================================================\n// Phase Display Info\n// =============================================================================\n\nexport const PHASE_INFO: Record<\n WorkflowPhase,\n { label: string; description: string; color: string }\n> = {\n setup: {\n label: \"Setup\",\n description: \"Runs once at the beginning\",\n color: \"blue\",\n },\n verification: {\n label: \"Verification\",\n description: \"Checks success criteria, loops with agentic\",\n color: \"green\",\n },\n agentic: {\n label: \"Agentic\",\n description: \"AI work, iterates until verification passes\",\n color: \"amber\",\n },\n completion: {\n label: \"Completion\",\n description: \"Runs once after the loop exits\",\n color: \"purple\",\n },\n};\n\n// =============================================================================\n// Summary Step Constants\n// =============================================================================\n\nexport const DEFAULT_SUMMARY_PROMPT = `Write a one-paragraph summary of all the tasks completed in this workflow. Include what was accomplished, whether the stated goal was achieved, any issues encountered and how they were resolved, and remaining work if the goal was not fully achieved. Be concise but comprehensive.`;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC4TO,IAAM,aAAoD;AAAA,EAC/D,OAAO;AAAA,IACL;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA,cAAc;AAAA,IACZ;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,IACA;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,MACb,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OA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