@decaf-ts/as-graph 0.2.0 → 0.4.0
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 +160 -2
- package/dist/as-graph.cjs +1 -1
- package/dist/as-graph.cjs.map +1 -1
- package/dist/as-graph.js +1 -1
- package/dist/as-graph.js.map +1 -1
- package/lib/cjs/dagster/DagsterGraphEventBridge.cjs +344 -0
- package/lib/cjs/dagster/DagsterGraphEventBridge.cjs.map +1 -0
- package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs +789 -0
- package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs.map +1 -0
- package/lib/cjs/dagster/DagsterResultMapper.cjs +56 -0
- package/lib/cjs/dagster/DagsterResultMapper.cjs.map +1 -0
- package/lib/cjs/dagster/DagsterTypes.cjs +4 -0
- package/lib/cjs/dagster/DagsterTypes.cjs.map +1 -0
- package/lib/cjs/dagster/capabilities.cjs +102 -0
- package/lib/cjs/dagster/capabilities.cjs.map +1 -0
- package/lib/cjs/dagster/constants.cjs +92 -0
- package/lib/cjs/dagster/constants.cjs.map +1 -0
- package/lib/cjs/dagster/index.cjs +32 -0
- package/lib/cjs/dagster/index.cjs.map +1 -0
- package/lib/cjs/engine/constants.cjs +6 -1
- package/lib/cjs/engine/constants.cjs.map +1 -1
- package/lib/cjs/engine/execution/GraphCodeMode.cjs +137 -0
- package/lib/cjs/engine/execution/GraphCodeMode.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphExecutionBackend.cjs +89 -0
- package/lib/cjs/engine/execution/GraphExecutionBackend.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphExecutionBackendRegistry.cjs +107 -0
- package/lib/cjs/engine/execution/GraphExecutionBackendRegistry.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphExecutionEngine.cjs +250 -733
- package/lib/cjs/engine/execution/GraphExecutionEngine.cjs.map +1 -1
- package/lib/cjs/engine/execution/LocalGraphExecutionBackend.cjs +804 -0
- package/lib/cjs/engine/execution/LocalGraphExecutionBackend.cjs.map +1 -0
- package/lib/cjs/engine/execution/index.cjs +4 -0
- package/lib/cjs/engine/execution/index.cjs.map +1 -1
- package/lib/cjs/engine/index.cjs +5 -0
- package/lib/cjs/engine/index.cjs.map +1 -1
- package/lib/cjs/engine/loops/ConditionEvaluator.cjs +116 -0
- package/lib/cjs/engine/loops/ConditionEvaluator.cjs.map +1 -0
- package/lib/cjs/engine/loops/GraphConditionEvaluator.cjs +25 -2
- package/lib/cjs/engine/loops/GraphConditionEvaluator.cjs.map +1 -1
- package/lib/cjs/engine/loops/index.cjs +1 -0
- package/lib/cjs/engine/loops/index.cjs.map +1 -1
- package/lib/cjs/engine/runs/GraphRunService.cjs +121 -3
- package/lib/cjs/engine/runs/GraphRunService.cjs.map +1 -1
- package/lib/cjs/engine/runs/InMemoryGraphRunStore.cjs +33 -0
- package/lib/cjs/engine/runs/InMemoryGraphRunStore.cjs.map +1 -1
- package/lib/cjs/engine/runs/ownership.cjs +100 -11
- package/lib/cjs/engine/runs/ownership.cjs.map +1 -1
- package/lib/cjs/engine/services/GraphRunModelService.cjs +16 -0
- package/lib/cjs/engine/services/GraphRunModelService.cjs.map +1 -1
- package/lib/cjs/engine/services/GraphWorkflowService.cjs +153 -16
- package/lib/cjs/engine/services/GraphWorkflowService.cjs.map +1 -1
- package/lib/cjs/mastra/MastraCapabilities.cjs +171 -0
- package/lib/cjs/mastra/MastraCapabilities.cjs.map +1 -0
- package/lib/cjs/mastra/MastraConditionBridge.cjs +39 -0
- package/lib/cjs/mastra/MastraConditionBridge.cjs.map +1 -0
- package/lib/cjs/mastra/MastraEventBridge.cjs +486 -0
- package/lib/cjs/mastra/MastraEventBridge.cjs.map +1 -0
- package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs +351 -0
- package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs.map +1 -0
- package/lib/cjs/mastra/MastraResumeGuard.cjs +127 -0
- package/lib/cjs/mastra/MastraResumeGuard.cjs.map +1 -0
- package/lib/cjs/mastra/MastraSchemaConverter.cjs +124 -0
- package/lib/cjs/mastra/MastraSchemaConverter.cjs.map +1 -0
- package/lib/cjs/mastra/MastraWorkflowCompiler.cjs +461 -0
- package/lib/cjs/mastra/MastraWorkflowCompiler.cjs.map +1 -0
- package/lib/cjs/mastra/MastraWorkflowManager.cjs +401 -0
- package/lib/cjs/mastra/MastraWorkflowManager.cjs.map +1 -0
- package/lib/cjs/mastra/index.cjs +35 -0
- package/lib/cjs/mastra/index.cjs.map +1 -0
- package/lib/cjs/mastra/types.cjs +34 -0
- package/lib/cjs/mastra/types.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphEngineCapabilityManifest.cjs +136 -0
- package/lib/cjs/nest/graph/GraphEngineCapabilityManifest.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphEngineCapabilityService.cjs +140 -0
- package/lib/cjs/nest/graph/GraphEngineCapabilityService.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphEngineController.cjs +227 -0
- package/lib/cjs/nest/graph/GraphEngineController.cjs.map +1 -0
- package/lib/cjs/nest/graph/GraphExecutionModule.cjs +30 -2
- package/lib/cjs/nest/graph/GraphExecutionModule.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphRunController.cjs +208 -28
- package/lib/cjs/nest/graph/GraphRunController.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphWorkflowController.cjs +97 -14
- package/lib/cjs/nest/graph/GraphWorkflowController.cjs.map +1 -1
- package/lib/cjs/nest/graph/index.cjs +3 -0
- package/lib/cjs/nest/graph/index.cjs.map +1 -1
- package/lib/cjs/nest/graph/main.cjs +54 -0
- package/lib/cjs/nest/graph/main.cjs.map +1 -0
- package/lib/cjs/nest/graph/servingDates.cjs +53 -0
- package/lib/cjs/nest/graph/servingDates.cjs.map +1 -0
- package/lib/cjs/nest/graph/servingErrors.cjs +68 -0
- package/lib/cjs/nest/graph/servingErrors.cjs.map +1 -0
- package/lib/cjs/node/flow/if/node.cjs +27 -9
- package/lib/cjs/node/flow/if/node.cjs.map +1 -1
- package/lib/cjs/node/flow/loop/until/node.cjs +5 -2
- package/lib/cjs/node/flow/loop/until/node.cjs.map +1 -1
- package/lib/cjs/node/flow/loop/while/node.cjs +8 -2
- package/lib/cjs/node/flow/loop/while/node.cjs.map +1 -1
- package/lib/cjs/node/flow/switch/node.cjs +2 -37
- package/lib/cjs/node/flow/switch/node.cjs.map +1 -1
- package/lib/cjs/node/utility/code/node.cjs +11 -3
- package/lib/cjs/node/utility/code/node.cjs.map +1 -1
- package/lib/cjs/ram/GraphRunStore.cjs +14 -0
- package/lib/cjs/ram/GraphRunStore.cjs.map +1 -1
- package/lib/cjs/shared/graph/catalog/GraphManifestCompiler.cjs +2 -3
- package/lib/cjs/shared/graph/catalog/GraphManifestCompiler.cjs.map +1 -1
- package/lib/cjs/shared/graph/constants.cjs +8 -0
- package/lib/cjs/shared/graph/constants.cjs.map +1 -1
- package/lib/cjs/shared/graph/index.cjs +2 -1
- package/lib/cjs/shared/graph/index.cjs.map +1 -1
- package/lib/cjs/shared/graph/layout/GraphWorkflowLayout.cjs +146 -0
- package/lib/cjs/shared/graph/layout/GraphWorkflowLayout.cjs.map +1 -0
- package/lib/cjs/shared/graph/layout/index.cjs +23 -0
- package/lib/cjs/shared/graph/layout/index.cjs.map +1 -0
- package/lib/cjs/shared/graph/layout/layout-options.cjs +93 -0
- package/lib/cjs/shared/graph/layout/layout-options.cjs.map +1 -0
- package/lib/cjs/shared/ui/index.cjs +8 -10
- package/lib/cjs/shared/ui/index.cjs.map +1 -1
- package/lib/esm/dagster/DagsterGraphEventBridge.js +339 -0
- package/lib/esm/dagster/DagsterGraphEventBridge.js.map +1 -0
- package/lib/esm/dagster/DagsterGraphExecutionBackend.js +781 -0
- package/lib/esm/dagster/DagsterGraphExecutionBackend.js.map +1 -0
- package/lib/esm/dagster/DagsterResultMapper.js +51 -0
- package/lib/esm/dagster/DagsterResultMapper.js.map +1 -0
- package/lib/esm/dagster/DagsterTypes.js +2 -0
- package/lib/esm/dagster/DagsterTypes.js.map +1 -0
- package/lib/esm/dagster/capabilities.js +97 -0
- package/lib/esm/dagster/capabilities.js.map +1 -0
- package/lib/esm/dagster/constants.js +88 -0
- package/lib/esm/dagster/constants.js.map +1 -0
- package/lib/esm/dagster/index.js +15 -0
- package/lib/esm/dagster/index.js.map +1 -0
- package/lib/esm/engine/constants.js +5 -0
- package/lib/esm/engine/constants.js.map +1 -1
- package/lib/esm/engine/execution/GraphCodeMode.js +132 -0
- package/lib/esm/engine/execution/GraphCodeMode.js.map +1 -0
- package/lib/esm/engine/execution/GraphExecutionBackend.js +83 -0
- package/lib/esm/engine/execution/GraphExecutionBackend.js.map +1 -0
- package/lib/esm/engine/execution/GraphExecutionBackendRegistry.js +102 -0
- package/lib/esm/engine/execution/GraphExecutionBackendRegistry.js.map +1 -0
- package/lib/esm/engine/execution/GraphExecutionEngine.js +232 -716
- package/lib/esm/engine/execution/GraphExecutionEngine.js.map +1 -1
- package/lib/esm/engine/execution/LocalGraphExecutionBackend.js +799 -0
- package/lib/esm/engine/execution/LocalGraphExecutionBackend.js.map +1 -0
- package/lib/esm/engine/execution/index.js +4 -0
- package/lib/esm/engine/execution/index.js.map +1 -1
- package/lib/esm/engine/index.js +5 -0
- package/lib/esm/engine/index.js.map +1 -1
- package/lib/esm/engine/loops/ConditionEvaluator.js +108 -0
- package/lib/esm/engine/loops/ConditionEvaluator.js.map +1 -0
- package/lib/esm/engine/loops/GraphConditionEvaluator.js +25 -2
- package/lib/esm/engine/loops/GraphConditionEvaluator.js.map +1 -1
- package/lib/esm/engine/loops/index.js +1 -0
- package/lib/esm/engine/loops/index.js.map +1 -1
- package/lib/esm/engine/runs/GraphRunService.js +123 -5
- package/lib/esm/engine/runs/GraphRunService.js.map +1 -1
- package/lib/esm/engine/runs/InMemoryGraphRunStore.js +33 -0
- package/lib/esm/engine/runs/InMemoryGraphRunStore.js.map +1 -1
- package/lib/esm/engine/runs/ownership.js +97 -11
- package/lib/esm/engine/runs/ownership.js.map +1 -1
- package/lib/esm/engine/services/GraphRunModelService.js +16 -0
- package/lib/esm/engine/services/GraphRunModelService.js.map +1 -1
- package/lib/esm/engine/services/GraphWorkflowService.js +155 -18
- package/lib/esm/engine/services/GraphWorkflowService.js.map +1 -1
- package/lib/esm/mastra/MastraCapabilities.js +164 -0
- package/lib/esm/mastra/MastraCapabilities.js.map +1 -0
- package/lib/esm/mastra/MastraConditionBridge.js +34 -0
- package/lib/esm/mastra/MastraConditionBridge.js.map +1 -0
- package/lib/esm/mastra/MastraEventBridge.js +481 -0
- package/lib/esm/mastra/MastraEventBridge.js.map +1 -0
- package/lib/esm/mastra/MastraGraphExecutionBackend.js +346 -0
- package/lib/esm/mastra/MastraGraphExecutionBackend.js.map +1 -0
- package/lib/esm/mastra/MastraResumeGuard.js +123 -0
- package/lib/esm/mastra/MastraResumeGuard.js.map +1 -0
- package/lib/esm/mastra/MastraSchemaConverter.js +119 -0
- package/lib/esm/mastra/MastraSchemaConverter.js.map +1 -0
- package/lib/esm/mastra/MastraWorkflowCompiler.js +456 -0
- package/lib/esm/mastra/MastraWorkflowCompiler.js.map +1 -0
- package/lib/esm/mastra/MastraWorkflowManager.js +396 -0
- package/lib/esm/mastra/MastraWorkflowManager.js.map +1 -0
- package/lib/esm/mastra/index.js +18 -0
- package/lib/esm/mastra/index.js.map +1 -0
- package/lib/esm/mastra/types.js +30 -0
- package/lib/esm/mastra/types.js.map +1 -0
- package/lib/esm/nest/graph/GraphEngineCapabilityManifest.js +129 -0
- package/lib/esm/nest/graph/GraphEngineCapabilityManifest.js.map +1 -0
- package/lib/esm/nest/graph/GraphEngineCapabilityService.js +131 -0
- package/lib/esm/nest/graph/GraphEngineCapabilityService.js.map +1 -0
- package/lib/esm/nest/graph/GraphEngineController.js +218 -0
- package/lib/esm/nest/graph/GraphEngineController.js.map +1 -0
- package/lib/esm/nest/graph/GraphExecutionModule.js +30 -2
- package/lib/esm/nest/graph/GraphExecutionModule.js.map +1 -1
- package/lib/esm/nest/graph/GraphRunController.js +209 -29
- package/lib/esm/nest/graph/GraphRunController.js.map +1 -1
- package/lib/esm/nest/graph/GraphWorkflowController.js +98 -15
- package/lib/esm/nest/graph/GraphWorkflowController.js.map +1 -1
- package/lib/esm/nest/graph/index.js +3 -0
- package/lib/esm/nest/graph/index.js.map +1 -1
- package/lib/esm/nest/graph/main.js +51 -0
- package/lib/esm/nest/graph/main.js.map +1 -0
- package/lib/esm/nest/graph/servingDates.js +49 -0
- package/lib/esm/nest/graph/servingDates.js.map +1 -0
- package/lib/esm/nest/graph/servingErrors.js +63 -0
- package/lib/esm/nest/graph/servingErrors.js.map +1 -0
- package/lib/esm/node/flow/if/node.js +27 -9
- package/lib/esm/node/flow/if/node.js.map +1 -1
- package/lib/esm/node/flow/loop/until/node.js +5 -2
- package/lib/esm/node/flow/loop/until/node.js.map +1 -1
- package/lib/esm/node/flow/loop/while/node.js +8 -2
- package/lib/esm/node/flow/loop/while/node.js.map +1 -1
- package/lib/esm/node/flow/switch/node.js +2 -37
- package/lib/esm/node/flow/switch/node.js.map +1 -1
- package/lib/esm/node/utility/code/node.js +11 -3
- package/lib/esm/node/utility/code/node.js.map +1 -1
- package/lib/esm/ram/GraphRunStore.js +14 -0
- package/lib/esm/ram/GraphRunStore.js.map +1 -1
- package/lib/esm/shared/graph/GraphExecutionStateMapper.js.map +1 -1
- package/lib/esm/shared/graph/catalog/GraphManifestCompiler.js +2 -3
- package/lib/esm/shared/graph/catalog/GraphManifestCompiler.js.map +1 -1
- package/lib/esm/shared/graph/constants.js +8 -0
- package/lib/esm/shared/graph/constants.js.map +1 -1
- package/lib/esm/shared/graph/document/GraphFlowBuilder.js.map +1 -1
- package/lib/esm/shared/graph/index.js +2 -1
- package/lib/esm/shared/graph/index.js.map +1 -1
- package/lib/esm/shared/graph/layout/GraphWorkflowLayout.js +107 -0
- package/lib/esm/shared/graph/layout/GraphWorkflowLayout.js.map +1 -0
- package/lib/esm/shared/graph/layout/index.js +6 -0
- package/lib/esm/shared/graph/layout/index.js.map +1 -0
- package/lib/esm/shared/graph/layout/layout-options.js +96 -0
- package/lib/esm/shared/graph/layout/layout-options.js.map +1 -0
- package/lib/esm/shared/ui/index.js +8 -10
- package/lib/esm/shared/ui/index.js.map +1 -1
- package/lib/types/dagster/DagsterGraphEventBridge.d.cts +142 -0
- package/lib/types/dagster/DagsterGraphEventBridge.d.mts +142 -0
- package/lib/types/dagster/DagsterGraphExecutionBackend.d.cts +323 -0
- package/lib/types/dagster/DagsterGraphExecutionBackend.d.mts +323 -0
- package/lib/types/dagster/DagsterResultMapper.d.cts +50 -0
- package/lib/types/dagster/DagsterResultMapper.d.mts +50 -0
- package/lib/types/dagster/DagsterTypes.d.cts +355 -0
- package/lib/types/dagster/DagsterTypes.d.mts +355 -0
- package/lib/types/dagster/capabilities.d.cts +34 -0
- package/lib/types/dagster/capabilities.d.mts +34 -0
- package/lib/types/dagster/constants.d.cts +87 -0
- package/lib/types/dagster/constants.d.mts +87 -0
- package/lib/types/dagster/index.d.cts +14 -0
- package/lib/types/dagster/index.d.mts +14 -0
- package/lib/types/engine/constants.d.cts +5 -0
- package/lib/types/engine/constants.d.mts +5 -0
- package/lib/types/engine/execution/GraphCodeMode.d.cts +52 -0
- package/lib/types/engine/execution/GraphCodeMode.d.mts +52 -0
- package/lib/types/engine/execution/GraphExecutionBackend.d.cts +306 -0
- package/lib/types/engine/execution/GraphExecutionBackend.d.mts +306 -0
- package/lib/types/engine/execution/GraphExecutionBackendRegistry.d.cts +59 -0
- package/lib/types/engine/execution/GraphExecutionBackendRegistry.d.mts +59 -0
- package/lib/types/engine/execution/GraphExecutionEngine.d.cts +116 -135
- package/lib/types/engine/execution/GraphExecutionEngine.d.mts +116 -135
- package/lib/types/engine/execution/LocalGraphExecutionBackend.d.cts +232 -0
- package/lib/types/engine/execution/LocalGraphExecutionBackend.d.mts +232 -0
- package/lib/types/engine/execution/index.d.cts +4 -0
- package/lib/types/engine/execution/index.d.mts +4 -0
- package/lib/types/engine/index.d.cts +5 -0
- package/lib/types/engine/index.d.mts +5 -0
- package/lib/types/engine/loops/ConditionEvaluator.d.cts +87 -0
- package/lib/types/engine/loops/ConditionEvaluator.d.mts +87 -0
- package/lib/types/engine/loops/GraphConditionEvaluator.d.cts +27 -7
- package/lib/types/engine/loops/GraphConditionEvaluator.d.mts +27 -7
- package/lib/types/engine/loops/index.d.cts +1 -0
- package/lib/types/engine/loops/index.d.mts +1 -0
- package/lib/types/engine/runs/GraphRunService.d.cts +60 -1
- package/lib/types/engine/runs/GraphRunService.d.mts +60 -1
- package/lib/types/engine/runs/InMemoryGraphRunStore.d.cts +29 -0
- package/lib/types/engine/runs/InMemoryGraphRunStore.d.mts +29 -0
- package/lib/types/engine/runs/ownership.d.cts +89 -4
- package/lib/types/engine/runs/ownership.d.mts +89 -4
- package/lib/types/engine/runs/types.d.cts +12 -1
- package/lib/types/engine/runs/types.d.mts +12 -1
- package/lib/types/engine/services/GraphRunModelService.d.cts +13 -0
- package/lib/types/engine/services/GraphRunModelService.d.mts +13 -0
- package/lib/types/engine/services/GraphWorkflowService.d.cts +74 -2
- package/lib/types/engine/services/GraphWorkflowService.d.mts +74 -2
- package/lib/types/engine/types.d.cts +11 -4
- package/lib/types/engine/types.d.mts +11 -4
- package/lib/types/mastra/MastraCapabilities.d.cts +91 -0
- package/lib/types/mastra/MastraCapabilities.d.mts +91 -0
- package/lib/types/mastra/MastraConditionBridge.d.cts +38 -0
- package/lib/types/mastra/MastraConditionBridge.d.mts +38 -0
- package/lib/types/mastra/MastraEventBridge.d.cts +189 -0
- package/lib/types/mastra/MastraEventBridge.d.mts +189 -0
- package/lib/types/mastra/MastraGraphExecutionBackend.d.cts +119 -0
- package/lib/types/mastra/MastraGraphExecutionBackend.d.mts +119 -0
- package/lib/types/mastra/MastraResumeGuard.d.cts +58 -0
- package/lib/types/mastra/MastraResumeGuard.d.mts +58 -0
- package/lib/types/mastra/MastraSchemaConverter.d.cts +39 -0
- package/lib/types/mastra/MastraSchemaConverter.d.mts +39 -0
- package/lib/types/mastra/MastraWorkflowCompiler.d.cts +218 -0
- package/lib/types/mastra/MastraWorkflowCompiler.d.mts +218 -0
- package/lib/types/mastra/MastraWorkflowManager.d.cts +220 -0
- package/lib/types/mastra/MastraWorkflowManager.d.mts +220 -0
- package/lib/types/mastra/index.d.cts +17 -0
- package/lib/types/mastra/index.d.mts +17 -0
- package/lib/types/mastra/types.d.cts +222 -0
- package/lib/types/mastra/types.d.mts +222 -0
- package/lib/types/nest/graph/GraphEngineCapabilityManifest.d.cts +87 -0
- package/lib/types/nest/graph/GraphEngineCapabilityManifest.d.mts +87 -0
- package/lib/types/nest/graph/GraphEngineCapabilityService.d.cts +98 -0
- package/lib/types/nest/graph/GraphEngineCapabilityService.d.mts +98 -0
- package/lib/types/nest/graph/GraphEngineController.d.cts +74 -0
- package/lib/types/nest/graph/GraphEngineController.d.mts +74 -0
- package/lib/types/nest/graph/GraphExecutionModule.d.cts +14 -1
- package/lib/types/nest/graph/GraphExecutionModule.d.mts +14 -1
- package/lib/types/nest/graph/GraphRunController.d.cts +69 -14
- package/lib/types/nest/graph/GraphRunController.d.mts +69 -14
- package/lib/types/nest/graph/GraphWorkflowController.d.cts +50 -17
- package/lib/types/nest/graph/GraphWorkflowController.d.mts +50 -17
- package/lib/types/nest/graph/index.d.cts +3 -0
- package/lib/types/nest/graph/index.d.mts +3 -0
- package/lib/types/nest/graph/main.d.cts +1 -0
- package/lib/types/nest/graph/main.d.mts +1 -0
- package/lib/types/nest/graph/servingDates.d.cts +35 -0
- package/lib/types/nest/graph/servingDates.d.mts +35 -0
- package/lib/types/nest/graph/servingErrors.d.cts +44 -0
- package/lib/types/nest/graph/servingErrors.d.mts +44 -0
- package/lib/types/node/flow/if/node.d.cts +20 -8
- package/lib/types/node/flow/if/node.d.mts +20 -8
- package/lib/types/node/flow/loop/until/node.d.cts +4 -1
- package/lib/types/node/flow/loop/until/node.d.mts +4 -1
- package/lib/types/node/flow/loop/while/node.d.cts +4 -1
- package/lib/types/node/flow/loop/while/node.d.mts +4 -1
- package/lib/types/node/utility/code/node.d.cts +1 -1
- package/lib/types/node/utility/code/node.d.mts +1 -1
- package/lib/types/ram/GraphRunStore.d.cts +12 -0
- package/lib/types/ram/GraphRunStore.d.mts +12 -0
- package/lib/types/shared/graph/GraphExecutionStateMapper.d.cts +5 -5
- package/lib/types/shared/graph/GraphExecutionStateMapper.d.mts +5 -5
- package/lib/types/shared/graph/constants.d.cts +8 -0
- package/lib/types/shared/graph/constants.d.mts +8 -0
- package/lib/types/shared/graph/document/GraphFlowBuilder.d.cts +5 -5
- package/lib/types/shared/graph/document/GraphFlowBuilder.d.mts +5 -5
- package/lib/types/shared/graph/index.d.cts +2 -1
- package/lib/types/shared/graph/index.d.mts +2 -1
- package/lib/types/shared/graph/layout/GraphWorkflowLayout.d.cts +49 -0
- package/lib/types/shared/graph/layout/GraphWorkflowLayout.d.mts +49 -0
- package/lib/types/shared/graph/layout/index.d.cts +5 -0
- package/lib/types/shared/graph/layout/index.d.mts +5 -0
- package/lib/types/shared/graph/layout/layout-options.d.cts +46 -0
- package/lib/types/shared/graph/layout/layout-options.d.mts +46 -0
- package/lib/types/shared/graph/types.d.cts +12 -4
- package/lib/types/shared/graph/types.d.mts +12 -4
- package/lib/types/shared/ui/index.d.cts +8 -10
- package/lib/types/shared/ui/index.d.mts +8 -10
- package/package.json +49 -6
- package/lib/cjs/shared/ui/GraphNodeView.cjs +0 -114
- package/lib/cjs/shared/ui/GraphNodeView.cjs.map +0 -1
- package/lib/cjs/shared/ui/GraphRunView.cjs +0 -96
- package/lib/cjs/shared/ui/GraphRunView.cjs.map +0 -1
- package/lib/cjs/shared/ui/GraphWorkflowView.cjs +0 -78
- package/lib/cjs/shared/ui/GraphWorkflowView.cjs.map +0 -1
- package/lib/cjs/shared/ui/types.cjs +0 -4
- package/lib/cjs/shared/ui/types.cjs.map +0 -1
- package/lib/esm/shared/ui/GraphNodeView.js +0 -107
- package/lib/esm/shared/ui/GraphNodeView.js.map +0 -1
- package/lib/esm/shared/ui/GraphRunView.js +0 -90
- package/lib/esm/shared/ui/GraphRunView.js.map +0 -1
- package/lib/esm/shared/ui/GraphWorkflowView.js +0 -72
- package/lib/esm/shared/ui/GraphWorkflowView.js.map +0 -1
- package/lib/esm/shared/ui/types.js +0 -2
- package/lib/esm/shared/ui/types.js.map +0 -1
- package/lib/types/shared/ui/GraphNodeView.d.cts +0 -48
- package/lib/types/shared/ui/GraphNodeView.d.mts +0 -48
- package/lib/types/shared/ui/GraphRunView.d.cts +0 -88
- package/lib/types/shared/ui/GraphRunView.d.mts +0 -88
- package/lib/types/shared/ui/GraphWorkflowView.d.cts +0 -18
- package/lib/types/shared/ui/GraphWorkflowView.d.mts +0 -18
- package/lib/types/shared/ui/types.d.cts +0 -200
- package/lib/types/shared/ui/types.d.mts +0 -200
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { GraphExecutionError } from "./../engine/errors/GraphExecutionError.js";
|
|
2
|
+
import { graphRunDocumentFingerprint } from "./../engine/runs/GraphRunFingerprint.js";
|
|
3
|
+
import { canAccessGraphResource } from "./../engine/runs/ownership.js";
|
|
4
|
+
import { graphWorkflowOwnerOf } from "./../engine/services/GraphWorkflowService.js";
|
|
5
|
+
import { MastraWorkflowCompiler } from "./MastraWorkflowCompiler.js";
|
|
6
|
+
import { GRAPH_MASTRA_MANAGEMENT_UNAVAILABLE, GRAPH_MASTRA_PERSIST_NOT_SUPPORTED, GRAPH_MASTRA_SERIALIZE_NOT_SUPPORTED, GRAPH_MASTRA_WORKFLOW_FORBIDDEN, GRAPH_MASTRA_WORKFLOW_NOT_FOUND, } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Structural check for a Decaf execution {@link Context} inside a
|
|
9
|
+
* {@link MaybeContextualArg} argument list. Mirrors `@decaf-ts/core`'s own
|
|
10
|
+
* realm-safe duck-typing (multiple linked core builds defeat `instanceof`).
|
|
11
|
+
*
|
|
12
|
+
* @param value - A candidate argument.
|
|
13
|
+
* @returns `true` when the value is a Decaf execution context.
|
|
14
|
+
*/
|
|
15
|
+
function isMastraManagerContextLike(value) {
|
|
16
|
+
if (!value || typeof value !== "object")
|
|
17
|
+
return false;
|
|
18
|
+
const candidate = value;
|
|
19
|
+
return (typeof candidate.get === "function" &&
|
|
20
|
+
typeof candidate.accumulate === "function" &&
|
|
21
|
+
typeof candidate.override === "function" &&
|
|
22
|
+
typeof candidate.toOverrides === "function" &&
|
|
23
|
+
candidate.cache !== undefined);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Resolves the caller owner from the forwarded contextual arguments, matching the
|
|
27
|
+
* backend's C23 resolution. The trailing context, when present, carries the
|
|
28
|
+
* authenticated principal resolved with {@link graphWorkflowOwnerOf}.
|
|
29
|
+
*
|
|
30
|
+
* @param args - The forwarded contextual arguments.
|
|
31
|
+
* @returns The caller owner, or `undefined` for owner-less callers.
|
|
32
|
+
*/
|
|
33
|
+
function mastraManagerCallerOwnerOf(args) {
|
|
34
|
+
for (let index = args.length - 1; index >= 0; index -= 1) {
|
|
35
|
+
const candidate = args[index];
|
|
36
|
+
if (isMastraManagerContextLike(candidate)) {
|
|
37
|
+
return graphWorkflowOwnerOf(candidate);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Management surface over real `@mastra/core` workflows (SAA-346). Holds only the
|
|
44
|
+
* wired runtime reference and the canonical-document compiler; it never constructs a
|
|
45
|
+
* Mastra primitive itself and never synthesizes a method the pinned library does not
|
|
46
|
+
* expose. Every method validates the runtime surface it needs first and fails
|
|
47
|
+
* closed with {@link GRAPH_MASTRA_MANAGEMENT_UNAVAILABLE} otherwise.
|
|
48
|
+
*/
|
|
49
|
+
export class MastraWorkflowManager {
|
|
50
|
+
/**
|
|
51
|
+
* @param options - The wired runtime and optional shared compiler.
|
|
52
|
+
*/
|
|
53
|
+
constructor(options = {}) {
|
|
54
|
+
this.options = options;
|
|
55
|
+
/** Canonical document revision (fingerprint) by managed workflow id. */
|
|
56
|
+
this.revisions = new Map();
|
|
57
|
+
/**
|
|
58
|
+
* Wrapper-managed provenance: the owner recorded when the wrapper created or
|
|
59
|
+
* updated a workflow. An id absent from this map is not wrapper-managed, so a
|
|
60
|
+
* host `origin: "code"` registration is protected from overwrite/delete (C3).
|
|
61
|
+
*/
|
|
62
|
+
this.owners = new Map();
|
|
63
|
+
/** Standalone compiler used when the host does not inject one. */
|
|
64
|
+
this.fallbackCompiler = new MastraWorkflowCompiler();
|
|
65
|
+
}
|
|
66
|
+
/** The wired real `@mastra/core` runtime, when any. */
|
|
67
|
+
get runtime() {
|
|
68
|
+
return this.options.runtime;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Registers a workflow translated from a canonical document on the real Mastra
|
|
72
|
+
* instance (real `addWorkflow`). This is the honest "create" operation: the
|
|
73
|
+
* pinned library registers live, it does not persist a translated code-step
|
|
74
|
+
* definition (see {@link persist}).
|
|
75
|
+
*
|
|
76
|
+
* @param document - The canonical document to translate and register.
|
|
77
|
+
* @returns The managed workflow descriptor.
|
|
78
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_MANAGEMENT_UNAVAILABLE}
|
|
79
|
+
* when the runtime exposes no `addWorkflow`.
|
|
80
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_UNSUPPORTED_KIND} when the
|
|
81
|
+
* document cannot be translated.
|
|
82
|
+
*/
|
|
83
|
+
async create(document, ...args) {
|
|
84
|
+
const runtime = this.requireRuntime("addWorkflow");
|
|
85
|
+
const owner = mastraManagerCallerOwnerOf(args);
|
|
86
|
+
this.assertWritableProvenance(runtime, document.id);
|
|
87
|
+
const compiled = this.compilerOf().compile(document);
|
|
88
|
+
this.revisions.set(document.id, compiled.fingerprint);
|
|
89
|
+
this.owners.set(document.id, owner);
|
|
90
|
+
runtime.addWorkflow?.(compiled.workflow, document.id);
|
|
91
|
+
return this.describe(document.id);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Edits a managed workflow by recompiling the updated canonical document and
|
|
95
|
+
* replacing the live registration (real `removeWorkflow` then `addWorkflow`). The
|
|
96
|
+
* pinned library documents `removeWorkflow` as the update/delete path so a
|
|
97
|
+
* subsequent save can re-register the same id cleanly.
|
|
98
|
+
*
|
|
99
|
+
* @param document - The updated canonical document.
|
|
100
|
+
* @returns The managed workflow descriptor with its new revision.
|
|
101
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_MANAGEMENT_UNAVAILABLE}
|
|
102
|
+
* when the runtime exposes no `addWorkflow`/`removeWorkflow`.
|
|
103
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_WORKFLOW_NOT_FOUND} when
|
|
104
|
+
* no workflow is registered under the document id.
|
|
105
|
+
*/
|
|
106
|
+
async update(document, ...args) {
|
|
107
|
+
const runtime = this.requireRuntime("addWorkflow", "removeWorkflow");
|
|
108
|
+
const owner = mastraManagerCallerOwnerOf(args);
|
|
109
|
+
this.assertWritableProvenance(runtime, document.id);
|
|
110
|
+
this.assertOwnerAccess(document.id, owner);
|
|
111
|
+
const compiled = this.compilerOf().compile(document);
|
|
112
|
+
const removed = runtime.removeWorkflow?.(document.id) === true;
|
|
113
|
+
if (!removed) {
|
|
114
|
+
throw new GraphExecutionError(`Mastra runtime has no managed workflow '${document.id}' to update`, GRAPH_MASTRA_WORKFLOW_NOT_FOUND, { workflowId: document.id });
|
|
115
|
+
}
|
|
116
|
+
this.revisions.set(document.id, compiled.fingerprint);
|
|
117
|
+
this.owners.set(document.id, owner);
|
|
118
|
+
runtime.addWorkflow?.(compiled.workflow, document.id);
|
|
119
|
+
return this.describe(document.id);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Deletes a managed workflow from the live Mastra registry (real
|
|
123
|
+
* `removeWorkflow`).
|
|
124
|
+
*
|
|
125
|
+
* @param workflowId - The managed workflow id to remove.
|
|
126
|
+
* @returns `true` when a workflow was removed.
|
|
127
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_MANAGEMENT_UNAVAILABLE}
|
|
128
|
+
* when the runtime exposes no `removeWorkflow`.
|
|
129
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_WORKFLOW_NOT_FOUND} when no
|
|
130
|
+
* workflow is registered under the id.
|
|
131
|
+
*/
|
|
132
|
+
async delete(workflowId, ...args) {
|
|
133
|
+
const runtime = this.requireRuntime("removeWorkflow");
|
|
134
|
+
const owner = mastraManagerCallerOwnerOf(args);
|
|
135
|
+
this.assertWritableProvenance(runtime, workflowId);
|
|
136
|
+
this.assertOwnerAccess(workflowId, owner);
|
|
137
|
+
const removed = runtime.removeWorkflow?.(workflowId) === true;
|
|
138
|
+
if (!removed) {
|
|
139
|
+
throw new GraphExecutionError(`Mastra runtime has no managed workflow '${workflowId}' to delete`, GRAPH_MASTRA_WORKFLOW_NOT_FOUND, { workflowId });
|
|
140
|
+
}
|
|
141
|
+
this.revisions.delete(workflowId);
|
|
142
|
+
this.owners.delete(workflowId);
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Lists the managed workflows registered on the real Mastra instance (real
|
|
147
|
+
* `listWorkflows`).
|
|
148
|
+
*
|
|
149
|
+
* @returns The managed workflow descriptors, in registry order.
|
|
150
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_MANAGEMENT_UNAVAILABLE}
|
|
151
|
+
* when the runtime exposes no `listWorkflows`.
|
|
152
|
+
*/
|
|
153
|
+
async list() {
|
|
154
|
+
const runtime = this.requireRuntime("listWorkflows");
|
|
155
|
+
const registered = runtime.listWorkflows?.() ?? {};
|
|
156
|
+
return Object.entries(registered).map(([id, workflow]) => this.describeWorkflow(id, workflow));
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Reads one managed workflow registered on the real Mastra instance (real
|
|
160
|
+
* `getWorkflow`).
|
|
161
|
+
*
|
|
162
|
+
* @param workflowId - The managed workflow id to read.
|
|
163
|
+
* @returns The managed workflow descriptor.
|
|
164
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_MANAGEMENT_UNAVAILABLE}
|
|
165
|
+
* when the runtime exposes no `getWorkflow`.
|
|
166
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_WORKFLOW_NOT_FOUND} when no
|
|
167
|
+
* workflow is registered under the id.
|
|
168
|
+
*/
|
|
169
|
+
async get(workflowId) {
|
|
170
|
+
const runtime = this.requireRuntime("getWorkflow");
|
|
171
|
+
const workflow = this.registeredWorkflow(runtime, workflowId);
|
|
172
|
+
return this.describeWorkflow(workflowId, workflow);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Serializes a managed workflow through the real Mastra
|
|
176
|
+
* `Workflow.serializedStepGraph` surface.
|
|
177
|
+
*
|
|
178
|
+
* @param workflowId - The managed workflow id to serialize.
|
|
179
|
+
* @returns The JSON-safe serialized workflow.
|
|
180
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_MANAGEMENT_UNAVAILABLE}
|
|
181
|
+
* when the runtime exposes no `getWorkflow`.
|
|
182
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_WORKFLOW_NOT_FOUND} when no
|
|
183
|
+
* workflow is registered under the id.
|
|
184
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_SERIALIZE_NOT_SUPPORTED}
|
|
185
|
+
* when the registered workflow exposes no serializable step graph.
|
|
186
|
+
*/
|
|
187
|
+
async serialize(workflowId) {
|
|
188
|
+
const runtime = this.requireRuntime("getWorkflow");
|
|
189
|
+
const workflow = this.registeredWorkflow(runtime, workflowId);
|
|
190
|
+
const steps = workflow
|
|
191
|
+
.serializedStepGraph;
|
|
192
|
+
if (!Array.isArray(steps)) {
|
|
193
|
+
throw new GraphExecutionError(`Mastra workflow '${workflowId}' exposes no serialized step graph`, GRAPH_MASTRA_SERIALIZE_NOT_SUPPORTED, { workflowId });
|
|
194
|
+
}
|
|
195
|
+
const revision = this.revisions.get(workflowId);
|
|
196
|
+
return {
|
|
197
|
+
id: workflowId,
|
|
198
|
+
...(revision !== undefined ? { revision } : {}),
|
|
199
|
+
steps,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* The canonical document revision (fingerprint) the wrapper tracks for a
|
|
204
|
+
* document. Mastra has no native workflow version, so this is the honest
|
|
205
|
+
* `EXTENSION-POINT` revision identity: it is computed from the canonical
|
|
206
|
+
* document alone and requires no runtime.
|
|
207
|
+
*
|
|
208
|
+
* @param document - The canonical document to fingerprint.
|
|
209
|
+
* @returns The stable revision fingerprint.
|
|
210
|
+
*/
|
|
211
|
+
revision(document) {
|
|
212
|
+
return graphRunDocumentFingerprint(document);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Persists a translated workflow to Mastra storage. The pinned real
|
|
216
|
+
* `Mastra.addDynamicWorkflow` persists only agent/tool-referenced steps, while
|
|
217
|
+
* the canonical translation emits host code steps, so this operation is
|
|
218
|
+
* `NOT-SUPPORTED` and fails closed rather than faking a persisted definition.
|
|
219
|
+
*
|
|
220
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_PERSIST_NOT_SUPPORTED}
|
|
221
|
+
* always.
|
|
222
|
+
*/
|
|
223
|
+
async persist() {
|
|
224
|
+
throw new GraphExecutionError("Mastra addDynamicWorkflow persists only agent/tool-referenced steps; the canonical translation emits host code steps", GRAPH_MASTRA_PERSIST_NOT_SUPPORTED);
|
|
225
|
+
}
|
|
226
|
+
/** The compiler the surface translates canonical documents with. */
|
|
227
|
+
compilerOf() {
|
|
228
|
+
return this.options.compiler ?? this.fallbackCompiler;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Resolves the wired runtime after asserting it exposes every required real
|
|
232
|
+
* Mastra method.
|
|
233
|
+
*
|
|
234
|
+
* @param methods - The real method names the operation needs.
|
|
235
|
+
* @returns The wired runtime.
|
|
236
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_MANAGEMENT_UNAVAILABLE}
|
|
237
|
+
* when the runtime is unwired or omits a required method.
|
|
238
|
+
*/
|
|
239
|
+
requireRuntime(...methods) {
|
|
240
|
+
const runtime = this.options.runtime;
|
|
241
|
+
if (!runtime || typeof runtime !== "object") {
|
|
242
|
+
throw new GraphExecutionError("Mastra runtime is not wired; workflow management is unavailable", GRAPH_MASTRA_MANAGEMENT_UNAVAILABLE);
|
|
243
|
+
}
|
|
244
|
+
const candidate = runtime;
|
|
245
|
+
for (const method of methods) {
|
|
246
|
+
if (typeof candidate[method] !== "function") {
|
|
247
|
+
throw new GraphExecutionError(`Mastra runtime exposes no '${method}' method; workflow management is unavailable`, GRAPH_MASTRA_MANAGEMENT_UNAVAILABLE, { method });
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return runtime;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Fails closed when a management mutation targets a workflow the wrapper did not
|
|
254
|
+
* create (C3 complete mediation). A wrapper-managed id is writable; any
|
|
255
|
+
* pre-existing registration — including a host `origin: "code"` workflow — is
|
|
256
|
+
* protected from overwrite/delete, and an existing workflow whose provenance
|
|
257
|
+
* cannot be determined is refused rather than mutated.
|
|
258
|
+
*
|
|
259
|
+
* @param runtime - The validated runtime.
|
|
260
|
+
* @param workflowId - The managed workflow id.
|
|
261
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_WORKFLOW_FORBIDDEN} when the
|
|
262
|
+
* workflow is not wrapper-managed.
|
|
263
|
+
*/
|
|
264
|
+
assertWritableProvenance(runtime, workflowId) {
|
|
265
|
+
if (this.revisions.has(workflowId))
|
|
266
|
+
return;
|
|
267
|
+
const origin = this.originOf(runtime, workflowId);
|
|
268
|
+
if (origin !== undefined) {
|
|
269
|
+
throw new GraphExecutionError(`Mastra workflow '${workflowId}' is a host registration (origin '${origin}'); the wrapper only manages workflows it created`, GRAPH_MASTRA_WORKFLOW_FORBIDDEN, { workflowId, origin });
|
|
270
|
+
}
|
|
271
|
+
if (this.registered(runtime, workflowId)) {
|
|
272
|
+
throw new GraphExecutionError(`Mastra workflow '${workflowId}' exists but is not wrapper-managed; refusing to modify a foreign registration`, GRAPH_MASTRA_WORKFLOW_FORBIDDEN, { workflowId });
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Enforces the C23 ownership predicate on a wrapper-managed workflow before a
|
|
277
|
+
* management mutation, mirroring the backend's `canAccessGraphResource`
|
|
278
|
+
* enforcement. Owner-less workflows stay writable by every caller.
|
|
279
|
+
*
|
|
280
|
+
* @param workflowId - The managed workflow id.
|
|
281
|
+
* @param callerOwner - The caller owner resolved from the context.
|
|
282
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_WORKFLOW_FORBIDDEN} when the
|
|
283
|
+
* caller may not write the workflow.
|
|
284
|
+
*/
|
|
285
|
+
assertOwnerAccess(workflowId, callerOwner) {
|
|
286
|
+
const owner = this.owners.get(workflowId);
|
|
287
|
+
if (!canAccessGraphResource({ owner }, callerOwner)) {
|
|
288
|
+
throw new GraphExecutionError(`Mastra workflow '${workflowId}' is not writable by the caller`, GRAPH_MASTRA_WORKFLOW_FORBIDDEN, { workflowId });
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Reads how the runtime reports a workflow's registration origin.
|
|
293
|
+
*
|
|
294
|
+
* @param runtime - The validated runtime.
|
|
295
|
+
* @param workflowId - The workflow id.
|
|
296
|
+
* @returns The origin, or `undefined` when the runtime reports none.
|
|
297
|
+
*/
|
|
298
|
+
originOf(runtime, workflowId) {
|
|
299
|
+
if (typeof runtime.getWorkflowOrigin !== "function")
|
|
300
|
+
return undefined;
|
|
301
|
+
try {
|
|
302
|
+
return runtime.getWorkflowOrigin(workflowId);
|
|
303
|
+
}
|
|
304
|
+
catch {
|
|
305
|
+
return undefined;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Whether the runtime already has a workflow registered under the id.
|
|
310
|
+
*
|
|
311
|
+
* @param runtime - The validated runtime.
|
|
312
|
+
* @param workflowId - The workflow id.
|
|
313
|
+
* @returns `true` when a workflow is registered under the id.
|
|
314
|
+
*/
|
|
315
|
+
registered(runtime, workflowId) {
|
|
316
|
+
if (typeof runtime.getWorkflow !== "function")
|
|
317
|
+
return false;
|
|
318
|
+
try {
|
|
319
|
+
const workflow = runtime.getWorkflow(workflowId);
|
|
320
|
+
return workflow !== undefined && workflow !== null;
|
|
321
|
+
}
|
|
322
|
+
catch {
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Reads a registered workflow, mapping the real not-found failure onto the
|
|
328
|
+
* canonical error code.
|
|
329
|
+
*
|
|
330
|
+
* @param runtime - The validated runtime.
|
|
331
|
+
* @param workflowId - The managed workflow id to read.
|
|
332
|
+
* @returns The registered workflow object.
|
|
333
|
+
* @throws {GraphExecutionError} {@link GRAPH_MASTRA_WORKFLOW_NOT_FOUND} when no
|
|
334
|
+
* workflow is registered under the id.
|
|
335
|
+
*/
|
|
336
|
+
registeredWorkflow(runtime, workflowId) {
|
|
337
|
+
let workflow;
|
|
338
|
+
try {
|
|
339
|
+
workflow = runtime.getWorkflow?.(workflowId);
|
|
340
|
+
}
|
|
341
|
+
catch {
|
|
342
|
+
workflow = undefined;
|
|
343
|
+
}
|
|
344
|
+
if (workflow === undefined || workflow === null) {
|
|
345
|
+
throw new GraphExecutionError(`Mastra runtime has no managed workflow '${workflowId}'`, GRAPH_MASTRA_WORKFLOW_NOT_FOUND, { workflowId });
|
|
346
|
+
}
|
|
347
|
+
return workflow;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Builds a managed workflow descriptor, reading the real registration origin
|
|
351
|
+
* and the wrapper-tracked revision when available.
|
|
352
|
+
*
|
|
353
|
+
* @param workflowId - The managed workflow id.
|
|
354
|
+
* @param workflow - The registered workflow object.
|
|
355
|
+
* @returns The managed workflow descriptor.
|
|
356
|
+
*/
|
|
357
|
+
describeWorkflow(workflowId, workflow) {
|
|
358
|
+
const name = workflow?.name;
|
|
359
|
+
let origin;
|
|
360
|
+
const runtime = this.options.runtime;
|
|
361
|
+
try {
|
|
362
|
+
origin = runtime?.getWorkflowOrigin?.(workflowId);
|
|
363
|
+
}
|
|
364
|
+
catch {
|
|
365
|
+
origin = undefined;
|
|
366
|
+
}
|
|
367
|
+
const revision = this.revisions.get(workflowId);
|
|
368
|
+
return {
|
|
369
|
+
id: workflowId,
|
|
370
|
+
...(typeof name === "string" ? { name } : {}),
|
|
371
|
+
...(origin ? { origin } : {}),
|
|
372
|
+
...(revision !== undefined ? { revision } : {}),
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Builds a descriptor for a workflow the wrapper has just registered or
|
|
377
|
+
* updated.
|
|
378
|
+
*
|
|
379
|
+
* @param workflowId - The managed workflow id.
|
|
380
|
+
* @returns The managed workflow descriptor.
|
|
381
|
+
*/
|
|
382
|
+
describe(workflowId) {
|
|
383
|
+
const runtime = this.options.runtime;
|
|
384
|
+
let workflow;
|
|
385
|
+
if (typeof runtime?.getWorkflow === "function") {
|
|
386
|
+
try {
|
|
387
|
+
workflow = runtime.getWorkflow(workflowId);
|
|
388
|
+
}
|
|
389
|
+
catch {
|
|
390
|
+
workflow = undefined;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return this.describeWorkflow(workflowId, workflow);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
//# sourceMappingURL=MastraWorkflowManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MastraWorkflowManager.js","sourceRoot":"","sources":["../../../src/mastra/MastraWorkflowManager.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,mBAAmB,EAAE,kDAA6C;AAC3E,OAAO,EAAE,2BAA2B,EAA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YACP,MAAM,GAAG,SAAS,CAAC;QACrB,CAAC;QACD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAChD,OAAO;YACL,EAAE,EAAE,UAAU;YACd,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7C,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7B,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChD,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACK,QAAQ,CAAC,UAAkB;QACjC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAEhB,CAAC;QACd,IAAI,QAAiB,CAAC;QACtB,IAAI,OAAO,OAAO,EAAE,WAAW,KAAK,UAAU,EAAE,CAAC;YAC/C,IAAI,CAAC;gBACH,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YAC7C,CAAC;YAAC,MAAM,CAAC;gBACP,QAAQ,GAAG,SAAS,CAAC;YACvB,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACrD,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module as-graph/mastra
|
|
3
|
+
* @summary Mastra graph execution backend barrel (SAA-196).
|
|
4
|
+
* @description Public surface of the `@decaf-ts/as-graph/mastra` entrypoint:
|
|
5
|
+
* the Mastra execution backend, the workflow compiler, the event bridge, the
|
|
6
|
+
* condition bridge, the schema converter, the resume guard, the capability
|
|
7
|
+
* table, and the shared types/ports.
|
|
8
|
+
*/
|
|
9
|
+
export * from "./types.js";
|
|
10
|
+
export * from "./MastraCapabilities.js";
|
|
11
|
+
export * from "./MastraSchemaConverter.js";
|
|
12
|
+
export * from "./MastraConditionBridge.js";
|
|
13
|
+
export * from "./MastraEventBridge.js";
|
|
14
|
+
export * from "./MastraWorkflowCompiler.js";
|
|
15
|
+
export * from "./MastraWorkflowManager.js";
|
|
16
|
+
export * from "./MastraResumeGuard.js";
|
|
17
|
+
export * from "./MastraGraphExecutionBackend.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mastra/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,2BAAwB;AACxB,wCAAqC;AACrC,2CAAwC;AACxC,2CAAwC;AACxC,uCAAoC;AACpC,4CAAyC;AACzC,2CAAwC;AACxC,uCAAoC;AACpC,iDAA8C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** The flavour id the Mastra backend registers under in the backend registry. */
|
|
2
|
+
export const MASTRA_BACKEND_FLAVOUR = "mastra";
|
|
3
|
+
/** A document node kind the Mastra translator cannot represent. */
|
|
4
|
+
export const GRAPH_MASTRA_UNSUPPORTED_KIND = "GRAPH_MASTRA_UNSUPPORTED_KIND";
|
|
5
|
+
/** A suspendable step declared a missing or degraded resume schema. */
|
|
6
|
+
export const GRAPH_MASTRA_RESUME_SCHEMA_UNSAFE = "GRAPH_MASTRA_RESUME_SCHEMA_UNSAFE";
|
|
7
|
+
/** A resume request failed validation (size, JSON safety, schema, or step). */
|
|
8
|
+
export const GRAPH_MASTRA_RESUME_INVALID = "GRAPH_MASTRA_RESUME_INVALID";
|
|
9
|
+
/** The resume step or iteration index is not allowlisted by the document. */
|
|
10
|
+
export const GRAPH_MASTRA_RESUME_STEP_UNKNOWN = "GRAPH_MASTRA_RESUME_STEP_UNKNOWN";
|
|
11
|
+
/** The Mastra snapshot is not a suspended run of the current document. */
|
|
12
|
+
export const GRAPH_MASTRA_RESUME_STATE_INVALID = "GRAPH_MASTRA_RESUME_STATE_INVALID";
|
|
13
|
+
/** The document translation emitted non-JSON-safe Mastra config. */
|
|
14
|
+
export const GRAPH_MASTRA_TRANSLATION_JSON_UNSAFE = "GRAPH_MASTRA_TRANSLATION_JSON_UNSAFE";
|
|
15
|
+
/** No Mastra agent is available for an agent-backed node. */
|
|
16
|
+
export const GRAPH_MASTRA_AGENT_UNAVAILABLE = "GRAPH_MASTRA_AGENT_UNAVAILABLE";
|
|
17
|
+
/** The wired Mastra runtime exposes no workflow-management surface. */
|
|
18
|
+
export const GRAPH_MASTRA_MANAGEMENT_UNAVAILABLE = "GRAPH_MASTRA_MANAGEMENT_UNAVAILABLE";
|
|
19
|
+
/** A managed workflow id has no workflow registered on the runtime. */
|
|
20
|
+
export const GRAPH_MASTRA_WORKFLOW_NOT_FOUND = "GRAPH_MASTRA_WORKFLOW_NOT_FOUND";
|
|
21
|
+
/** Persisting a translated workflow to Mastra storage is not supported. */
|
|
22
|
+
export const GRAPH_MASTRA_PERSIST_NOT_SUPPORTED = "GRAPH_MASTRA_PERSIST_NOT_SUPPORTED";
|
|
23
|
+
/** A registered workflow exposes no serializable step graph. */
|
|
24
|
+
export const GRAPH_MASTRA_SERIALIZE_NOT_SUPPORTED = "GRAPH_MASTRA_SERIALIZE_NOT_SUPPORTED";
|
|
25
|
+
/**
|
|
26
|
+
* A management mutation targeted a workflow the caller may not write, or a host
|
|
27
|
+
* registration the wrapper did not create (C3 complete-mediation guard).
|
|
28
|
+
*/
|
|
29
|
+
export const GRAPH_MASTRA_WORKFLOW_FORBIDDEN = "GRAPH_MASTRA_WORKFLOW_FORBIDDEN";
|
|
30
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/mastra/types.ts"],"names":[],"mappings":"AAuBA,iFAAiF;AACjF,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAE/C,mEAAmE;AACnE,MAAM,CAAC,MAAM,6BAA6B,GAAG,+BAA+B,CAAC;AAC7E,uEAAuE;AACvE,MAAM,CAAC,MAAM,iCAAiC,GAC5C,mCAAmC,CAAC;AACtC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,2BAA2B,GAAG,6BAA6B,CAAC;AACzE,6EAA6E;AAC7E,MAAM,CAAC,MAAM,gCAAgC,GAC3C,kCAAkC,CAAC;AACrC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,iCAAiC,GAC5C,mCAAmC,CAAC;AACtC,oEAAoE;AACpE,MAAM,CAAC,MAAM,oCAAoC,GAC/C,sCAAsC,CAAC;AACzC,6DAA6D;AAC7D,MAAM,CAAC,MAAM,8BAA8B,GACzC,gCAAgC,CAAC;AACnC,uEAAuE;AACvE,MAAM,CAAC,MAAM,mCAAmC,GAC9C,qCAAqC,CAAC;AACxC,uEAAuE;AACvE,MAAM,CAAC,MAAM,+BAA+B,GAC1C,iCAAiC,CAAC;AACpC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,kCAAkC,GAC7C,oCAAoC,CAAC;AACvC,gEAAgE;AAChE,MAAM,CAAC,MAAM,oCAAoC,GAC/C,sCAAsC,CAAC;AACzC;;;GAGG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAC1C,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { resolveGraphBackendCapabilities } from "./../../engine/execution/GraphExecutionBackend.js";
|
|
2
|
+
import { GraphExecutionBackendRegistry } from "./../../engine/execution/GraphExecutionBackendRegistry.js";
|
|
3
|
+
import { GRAPH_LOCAL_EXECUTION_BACKEND } from "./../../engine/constants.js";
|
|
4
|
+
import { DAGSTER_CAPABILITY_TABLE } from "./../../dagster/capabilities.js";
|
|
5
|
+
import { DAGSTER_BACKEND_FLAVOUR, DAGSTER_PINNED_VERSION, } from "./../../dagster/constants.js";
|
|
6
|
+
import { MASTRA_FEATURE_CAPABILITIES } from "./../../mastra/MastraCapabilities.js";
|
|
7
|
+
import { MASTRA_BACKEND_FLAVOUR } from "./../../mastra/types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Pinned `@mastra/core` engine version. Kept here because the Mastra wrapper
|
|
10
|
+
* exports only its feature table, not a version constant; the value mirrors the
|
|
11
|
+
* `@mastra/core` dependency pin in `as-graph/package.json` (`1.74.0`).
|
|
12
|
+
*/
|
|
13
|
+
export const MASTRA_PINNED_VERSION = "1.74.0";
|
|
14
|
+
/**
|
|
15
|
+
* Normalizes a wrapper capability verdict onto the C20 three-value vocabulary.
|
|
16
|
+
* `PARTIAL` is deliberately downgraded to `NOT_SUPPORTED` (fail-closed): a
|
|
17
|
+
* partially-supported feature must never be advertised as a usable toggle.
|
|
18
|
+
*
|
|
19
|
+
* @param verdict - The wrapper table verdict string.
|
|
20
|
+
* @returns The normalized C20 verdict.
|
|
21
|
+
*/
|
|
22
|
+
export function toGraphEngineFeatureVerdict(verdict) {
|
|
23
|
+
const normalized = verdict.trim().toUpperCase().replace(/[-\s]+/g, "_");
|
|
24
|
+
if (normalized === "SUPPORTED")
|
|
25
|
+
return "SUPPORTED";
|
|
26
|
+
if (normalized === "EXTENSION_POINT")
|
|
27
|
+
return "EXTENSION_POINT";
|
|
28
|
+
return "NOT_SUPPORTED";
|
|
29
|
+
}
|
|
30
|
+
/** The Dagster feature rows, derived from the exported capability table. */
|
|
31
|
+
const DAGSTER_ENGINE_FEATURES = DAGSTER_CAPABILITY_TABLE.map((row) => ({
|
|
32
|
+
feature: row.feature,
|
|
33
|
+
verdict: toGraphEngineFeatureVerdict(row.verdict),
|
|
34
|
+
...(row.detail !== undefined ? { detail: row.detail } : {}),
|
|
35
|
+
}));
|
|
36
|
+
/** The Mastra feature rows, derived from the exported capability table. */
|
|
37
|
+
const MASTRA_ENGINE_FEATURES = MASTRA_FEATURE_CAPABILITIES.map((row) => ({
|
|
38
|
+
feature: row.feature,
|
|
39
|
+
verdict: toGraphEngineFeatureVerdict(row.verdict),
|
|
40
|
+
...(row.detail !== undefined ? { detail: row.detail } : {}),
|
|
41
|
+
}));
|
|
42
|
+
/**
|
|
43
|
+
* Derives the local engine's feature rows from the engine-agnostic
|
|
44
|
+
* {@link GraphBackendCapabilities} the built-in backend exposes, so the manifest
|
|
45
|
+
* never hand-maintains a separate local table.
|
|
46
|
+
*
|
|
47
|
+
* @param capabilities - The active backend's effective capability metadata.
|
|
48
|
+
* @returns The normalized feature rows for the local engine.
|
|
49
|
+
*/
|
|
50
|
+
export function localEngineFeatures(capabilities) {
|
|
51
|
+
return [
|
|
52
|
+
{
|
|
53
|
+
feature: "codeMode",
|
|
54
|
+
verdict: capabilities.codeMode === "hostSide" ? "SUPPORTED" : "NOT_SUPPORTED",
|
|
55
|
+
detail: "Host-side sandbox execution.",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
feature: "workflowList",
|
|
59
|
+
verdict: capabilities.workflows.list === "supported"
|
|
60
|
+
? "SUPPORTED"
|
|
61
|
+
: "NOT_SUPPORTED",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
feature: "workflowLookup",
|
|
65
|
+
verdict: capabilities.workflows.get === "supported"
|
|
66
|
+
? "SUPPORTED"
|
|
67
|
+
: "NOT_SUPPORTED",
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The allowlisted engine capability sources, keyed by backend flavour. An engine
|
|
73
|
+
* absent from this map is never advertised (C21: engine selection is by
|
|
74
|
+
* allowlisted ids only), even when a backend is registered under its flavour.
|
|
75
|
+
*/
|
|
76
|
+
const BUILT_IN_ENGINE_CAPABILITY_SOURCES = {
|
|
77
|
+
[GRAPH_LOCAL_EXECUTION_BACKEND]: {
|
|
78
|
+
engineId: GRAPH_LOCAL_EXECUTION_BACKEND,
|
|
79
|
+
displayName: "Local (built-in)",
|
|
80
|
+
pinnedEngineVersion: "built-in",
|
|
81
|
+
features: (backend) => localEngineFeatures(resolveGraphBackendCapabilities(backend)),
|
|
82
|
+
},
|
|
83
|
+
[DAGSTER_BACKEND_FLAVOUR]: {
|
|
84
|
+
engineId: DAGSTER_BACKEND_FLAVOUR,
|
|
85
|
+
displayName: "Dagster",
|
|
86
|
+
pinnedEngineVersion: DAGSTER_PINNED_VERSION,
|
|
87
|
+
features: () => DAGSTER_ENGINE_FEATURES,
|
|
88
|
+
},
|
|
89
|
+
[MASTRA_BACKEND_FLAVOUR]: {
|
|
90
|
+
engineId: MASTRA_BACKEND_FLAVOUR,
|
|
91
|
+
displayName: "Mastra",
|
|
92
|
+
pinnedEngineVersion: MASTRA_PINNED_VERSION,
|
|
93
|
+
features: () => MASTRA_ENGINE_FEATURES,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Builds the capability manifest from the registered backends, statically at boot.
|
|
98
|
+
* Only allowlisted flavours are advertised; the descriptors' `local` flag is read
|
|
99
|
+
* from the registered backend, and no remote engine is ever probed. The returned
|
|
100
|
+
* object is a fresh snapshot so a caller cannot mutate the served manifest.
|
|
101
|
+
*
|
|
102
|
+
* @param registered - The registered flavour/backend entries.
|
|
103
|
+
* @param defaultEngineId - Optional host-preferred default engine id.
|
|
104
|
+
* @returns The C20 capability manifest.
|
|
105
|
+
*/
|
|
106
|
+
export function buildGraphEngineCapabilityManifest(registered, defaultEngineId) {
|
|
107
|
+
const engines = [];
|
|
108
|
+
for (const { flavour, backend } of registered) {
|
|
109
|
+
const source = BUILT_IN_ENGINE_CAPABILITY_SOURCES[flavour];
|
|
110
|
+
if (!source)
|
|
111
|
+
continue;
|
|
112
|
+
engines.push({
|
|
113
|
+
engineId: source.engineId,
|
|
114
|
+
displayName: source.displayName,
|
|
115
|
+
local: backend.local === true,
|
|
116
|
+
pinnedEngineVersion: source.pinnedEngineVersion,
|
|
117
|
+
capabilities: source.features(backend).map((row) => ({ ...row })),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const ids = new Set(engines.map((engine) => engine.engineId));
|
|
121
|
+
const currentFlavour = GraphExecutionBackendRegistry.currentFlavour;
|
|
122
|
+
const resolvedDefault = defaultEngineId && ids.has(defaultEngineId)
|
|
123
|
+
? defaultEngineId
|
|
124
|
+
: ids.has(currentFlavour)
|
|
125
|
+
? currentFlavour
|
|
126
|
+
: (engines[0]?.engineId ?? currentFlavour);
|
|
127
|
+
return { engines, defaultEngineId: resolvedDefault };
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=GraphEngineCapabilityManifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GraphEngineCapabilityManifest.js","sourceRoot":"","sources":["../../../../src/nest/graph/GraphEngineCapabilityManifest.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,+BAA+B,EAAE,0DAAqD;AAC/F,OAAO,EAAE,6BAA6B,EAAE,kEAA6D;AACrG,OAAO,EAAE,6BAA6B,EAAE,oCAA+B;AACvE,OAAO,EAAE,wBAAwB,EAAE,wCAAmC;AACtE,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GACvB,qCAAgC;AACjC,OAAO,EAAE,2BAA2B,EAAE,6CAAwC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,gCAA2B;AA6C5D;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,UAAU,2BAA2B,CACzC,OAAe;IAEf,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACxE,IAAI,UAAU,KAAK,WAAW;QAAE,OAAO,WAAW,CAAC;IACnD,IAAI,UAAU,KAAK,iBAAiB;QAAE,OAAO,iBAAiB,CAAC;IAC/D,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,4EAA4E;AAC5E,MAAM,uBAAuB,GAC3B,wBAAwB,CAAC,GAAG,CAAC,CAAC,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