@xdelivered/emberflow 0.2.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/LICENSE +21 -0
- package/README.md +153 -0
- package/bin/commands.test.ts +185 -0
- package/bin/commands.ts +306 -0
- package/bin/emberflow.mjs +38 -0
- package/bin/init.test.ts +165 -0
- package/bin/init.ts +297 -0
- package/bin/runtime.mjs +105 -0
- package/bin/runtime.test.ts +167 -0
- package/bin/skillTargets.test.ts +108 -0
- package/bin/skillTargets.ts +36 -0
- package/bin/skillTemplates.test.ts +37 -0
- package/bin/tsconfig.json +23 -0
- package/dist/bin/commands.d.ts +24 -0
- package/dist/bin/commands.js +252 -0
- package/dist/bin/init.d.ts +17 -0
- package/dist/bin/init.js +241 -0
- package/dist/bin/runtime.d.mts +39 -0
- package/dist/bin/runtime.mjs +96 -0
- package/dist/bin/skillTargets.d.ts +13 -0
- package/dist/bin/skillTargets.js +22 -0
- package/dist/server/agents/claudeAdapter.d.ts +8 -0
- package/dist/server/agents/claudeAdapter.js +190 -0
- package/dist/server/agents/claudeParse.d.ts +2 -0
- package/dist/server/agents/claudeParse.js +162 -0
- package/dist/server/agents/codexAdapter.d.ts +13 -0
- package/dist/server/agents/codexAdapter.js +174 -0
- package/dist/server/agents/codexParse.d.ts +2 -0
- package/dist/server/agents/codexParse.js +74 -0
- package/dist/server/agents/detect.d.ts +23 -0
- package/dist/server/agents/detect.js +35 -0
- package/dist/server/agents/gitScope.d.ts +24 -0
- package/dist/server/agents/gitScope.js +95 -0
- package/dist/server/agents/modelRejectionHint.d.ts +8 -0
- package/dist/server/agents/modelRejectionHint.js +12 -0
- package/dist/server/agents/prompt.d.ts +79 -0
- package/dist/server/agents/prompt.js +364 -0
- package/dist/server/agents/runManager.d.ts +90 -0
- package/dist/server/agents/runManager.js +259 -0
- package/dist/server/agents/types.d.ts +15 -0
- package/dist/server/agents/types.js +1 -0
- package/dist/server/apiStore.d.ts +60 -0
- package/dist/server/apiStore.js +249 -0
- package/dist/server/auth/enforce.d.ts +1 -0
- package/dist/server/auth/enforce.js +6 -0
- package/dist/server/auth/types.d.ts +1 -0
- package/dist/server/auth/types.js +1 -0
- package/dist/server/auth/verifiers.d.ts +1 -0
- package/dist/server/auth/verifiers.js +4 -0
- package/dist/server/authAttach.d.ts +19 -0
- package/dist/server/authAttach.js +79 -0
- package/dist/server/cli.d.ts +7 -0
- package/dist/server/cli.js +804 -0
- package/dist/server/client.d.ts +130 -0
- package/dist/server/client.js +247 -0
- package/dist/server/environments.d.ts +103 -0
- package/dist/server/environments.js +486 -0
- package/dist/server/flowStore.d.ts +37 -0
- package/dist/server/flowStore.js +117 -0
- package/dist/server/httpOperations.d.ts +32 -0
- package/dist/server/httpOperations.js +62 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1022 -0
- package/dist/server/infrastructure.d.ts +51 -0
- package/dist/server/infrastructure.js +116 -0
- package/dist/server/login.d.ts +21 -0
- package/dist/server/login.js +44 -0
- package/dist/server/mcp.d.ts +1 -0
- package/dist/server/mcp.js +182 -0
- package/dist/server/migrateFlows.d.ts +8 -0
- package/dist/server/migrateFlows.js +25 -0
- package/dist/server/mockHandler.d.ts +15 -0
- package/dist/server/mockHandler.js +35 -0
- package/dist/server/nodesPayload.d.ts +14 -0
- package/dist/server/nodesPayload.js +14 -0
- package/dist/server/normalizeFlow.d.ts +21 -0
- package/dist/server/normalizeFlow.js +48 -0
- package/dist/server/openBrowser.d.ts +8 -0
- package/dist/server/openBrowser.js +16 -0
- package/dist/server/operationResult.d.ts +12 -0
- package/dist/server/operationResult.js +26 -0
- package/dist/server/pathGuard.d.ts +1 -0
- package/dist/server/pathGuard.js +16 -0
- package/dist/server/pathSafety.d.ts +20 -0
- package/dist/server/pathSafety.js +35 -0
- package/dist/server/projectConfig.d.ts +47 -0
- package/dist/server/projectConfig.js +61 -0
- package/dist/server/projectMode.d.ts +26 -0
- package/dist/server/projectMode.js +44 -0
- package/dist/server/redact.d.ts +6 -0
- package/dist/server/redact.js +37 -0
- package/dist/server/runRegistry.d.ts +84 -0
- package/dist/server/runRegistry.js +200 -0
- package/dist/server/runtime/RuntimeAdapter.d.ts +22 -0
- package/dist/server/runtime/RuntimeAdapter.js +1 -0
- package/dist/server/runtime/expressAdapter.d.ts +19 -0
- package/dist/server/runtime/expressAdapter.js +56 -0
- package/dist/server/scenarioTest.d.ts +14 -0
- package/dist/server/scenarioTest.js +66 -0
- package/dist/server/subflowRunner.d.ts +32 -0
- package/dist/server/subflowRunner.js +72 -0
- package/dist/server/testRunner.d.ts +70 -0
- package/dist/server/testRunner.js +151 -0
- package/dist/src/config.d.ts +3 -0
- package/dist/src/config.js +2 -0
- package/dist/src/engine/authVerify.d.ts +33 -0
- package/dist/src/engine/authVerify.js +63 -0
- package/dist/src/engine/diagnostics.d.ts +62 -0
- package/dist/src/engine/diagnostics.js +148 -0
- package/dist/src/engine/executor.d.ts +151 -0
- package/dist/src/engine/executor.js +684 -0
- package/dist/src/engine/httpError.d.ts +7 -0
- package/dist/src/engine/httpError.js +14 -0
- package/dist/src/engine/index.d.ts +11 -0
- package/dist/src/engine/index.js +11 -0
- package/dist/src/engine/output.d.ts +11 -0
- package/dist/src/engine/output.js +20 -0
- package/dist/src/engine/publish.d.ts +30 -0
- package/dist/src/engine/publish.js +95 -0
- package/dist/src/engine/registry.d.ts +34 -0
- package/dist/src/engine/registry.js +67 -0
- package/dist/src/engine/scenarios.d.ts +12 -0
- package/dist/src/engine/scenarios.js +19 -0
- package/dist/src/engine/schemaCheck.d.ts +4 -0
- package/dist/src/engine/schemaCheck.js +34 -0
- package/dist/src/engine/trace.d.ts +12 -0
- package/dist/src/engine/trace.js +12 -0
- package/dist/src/engine/types.d.ts +308 -0
- package/dist/src/engine/types.js +1 -0
- package/dist/src/engine/validation.d.ts +26 -0
- package/dist/src/engine/validation.js +318 -0
- package/dist/src/flows/anomaly-flows.d.ts +23 -0
- package/dist/src/flows/anomaly-flows.js +151 -0
- package/dist/src/flows/city-sweep-flow.d.ts +10 -0
- package/dist/src/flows/city-sweep-flow.js +127 -0
- package/dist/src/flows/login-flow.d.ts +13 -0
- package/dist/src/flows/login-flow.js +145 -0
- package/dist/src/flows/pradar-flows.d.ts +5 -0
- package/dist/src/flows/pradar-flows.js +375 -0
- package/dist/src/flows/weather-flow.d.ts +12 -0
- package/dist/src/flows/weather-flow.js +150 -0
- package/dist/src/lib/pathParams.d.ts +3 -0
- package/dist/src/lib/pathParams.js +6 -0
- package/dist/src/nodes/anomaly.d.ts +2 -0
- package/dist/src/nodes/anomaly.js +556 -0
- package/dist/src/nodes/flow-control.d.ts +7 -0
- package/dist/src/nodes/flow-control.js +270 -0
- package/dist/src/nodes/index.d.ts +3 -0
- package/dist/src/nodes/index.js +20 -0
- package/dist/src/nodes/login.d.ts +7 -0
- package/dist/src/nodes/login.js +158 -0
- package/dist/src/nodes/loops.d.ts +11 -0
- package/dist/src/nodes/loops.js +60 -0
- package/dist/src/nodes/pradar/index.d.ts +7 -0
- package/dist/src/nodes/pradar/index.js +9 -0
- package/dist/src/nodes/pradar/logic.d.ts +189 -0
- package/dist/src/nodes/pradar/logic.js +370 -0
- package/dist/src/nodes/pradar/nodes.d.ts +42 -0
- package/dist/src/nodes/pradar/nodes.js +801 -0
- package/dist/src/nodes/requireAuth.d.ts +20 -0
- package/dist/src/nodes/requireAuth.js +48 -0
- package/dist/src/nodes/response.d.ts +8 -0
- package/dist/src/nodes/response.js +33 -0
- package/dist/src/nodes/weather.d.ts +33 -0
- package/dist/src/nodes/weather.js +260 -0
- package/package.json +92 -0
- package/server/agentRoute.test.ts +157 -0
- package/server/agents/__fixtures__/fake-claude-writer.mjs +23 -0
- package/server/agents/__fixtures__/fake-claude.mjs +55 -0
- package/server/agents/__fixtures__/fake-codex-writer.mjs +27 -0
- package/server/agents/__fixtures__/fake-codex.mjs +52 -0
- package/server/agents/__fixtures__/fake-version-empty.mjs +3 -0
- package/server/agents/__fixtures__/fake-version-fail.mjs +4 -0
- package/server/agents/__fixtures__/fake-version-garbage.mjs +4 -0
- package/server/agents/__fixtures__/fake-version-good.mjs +4 -0
- package/server/agents/__fixtures__/fake-version-hang.mjs +3 -0
- package/server/agents/claudeAdapter.test.ts +127 -0
- package/server/agents/claudeAdapter.ts +212 -0
- package/server/agents/claudeParse.ts +193 -0
- package/server/agents/codexAdapter.test.ts +125 -0
- package/server/agents/codexAdapter.ts +198 -0
- package/server/agents/codexParse.test.ts +58 -0
- package/server/agents/codexParse.ts +126 -0
- package/server/agents/detect.test.ts +65 -0
- package/server/agents/detect.ts +43 -0
- package/server/agents/gitScope.test.ts +129 -0
- package/server/agents/gitScope.ts +110 -0
- package/server/agents/modelRejectionHint.test.ts +30 -0
- package/server/agents/modelRejectionHint.ts +14 -0
- package/server/agents/prompt.test.ts +613 -0
- package/server/agents/prompt.ts +527 -0
- package/server/agents/runManager.test.ts +251 -0
- package/server/agents/runManager.ts +286 -0
- package/server/agents/types.ts +17 -0
- package/server/apiMount.test.ts +591 -0
- package/server/apiStore.test.ts +324 -0
- package/server/apiStore.ts +241 -0
- package/server/auth/enforce.test.ts +61 -0
- package/server/auth/enforce.ts +6 -0
- package/server/auth/types.ts +5 -0
- package/server/auth/verifiers.test.ts +37 -0
- package/server/auth/verifiers.ts +9 -0
- package/server/authAttach.test.ts +175 -0
- package/server/authAttach.ts +99 -0
- package/server/cli.ts +847 -0
- package/server/cliAuth.test.ts +229 -0
- package/server/cliCreate.test.ts +131 -0
- package/server/cliDoctor.test.ts +326 -0
- package/server/cliTest.test.ts +735 -0
- package/server/client.ts +314 -0
- package/server/demoProject.test.ts +29 -0
- package/server/diagnosticsRoute.test.ts +169 -0
- package/server/environments.test.ts +620 -0
- package/server/environments.ts +603 -0
- package/server/environmentsRoute.test.ts +385 -0
- package/server/errorWorkflow.test.ts +205 -0
- package/server/flowStore.test.ts +84 -0
- package/server/flowStore.ts +125 -0
- package/server/httpOperations.test.ts +377 -0
- package/server/httpOperations.ts +96 -0
- package/server/index.ts +1111 -0
- package/server/infrastructure.test.ts +154 -0
- package/server/infrastructure.ts +161 -0
- package/server/infrastructureRoute.test.ts +105 -0
- package/server/login.test.ts +153 -0
- package/server/login.ts +67 -0
- package/server/mcp.ts +278 -0
- package/server/migrateFlows.test.ts +55 -0
- package/server/migrateFlows.ts +23 -0
- package/server/mockHandler.test.ts +138 -0
- package/server/mockHandler.ts +52 -0
- package/server/mockRun.test.ts +367 -0
- package/server/mockServe.test.ts +467 -0
- package/server/nodesPayload.test.ts +29 -0
- package/server/nodesPayload.ts +26 -0
- package/server/normalizeFlow.test.ts +80 -0
- package/server/normalizeFlow.ts +59 -0
- package/server/openBrowser.test.ts +20 -0
- package/server/openBrowser.ts +22 -0
- package/server/operationResult.test.ts +67 -0
- package/server/operationResult.ts +27 -0
- package/server/pathGuard.test.ts +19 -0
- package/server/pathGuard.ts +12 -0
- package/server/pathSafety.test.ts +38 -0
- package/server/pathSafety.ts +33 -0
- package/server/projectConfig.test.ts +67 -0
- package/server/projectConfig.ts +101 -0
- package/server/projectMode.test.ts +106 -0
- package/server/projectMode.ts +59 -0
- package/server/redact.test.ts +88 -0
- package/server/redact.ts +35 -0
- package/server/redactEgress.test.ts +281 -0
- package/server/runRegistry.ts +270 -0
- package/server/runsAuth.test.ts +119 -0
- package/server/runtime/RuntimeAdapter.ts +24 -0
- package/server/runtime/expressAdapter.test.ts +38 -0
- package/server/runtime/expressAdapter.ts +70 -0
- package/server/scenarioTest.test.ts +148 -0
- package/server/scenarioTest.ts +88 -0
- package/server/setupStatus.test.ts +127 -0
- package/server/subflowRunner.ts +104 -0
- package/server/testRunner.ts +216 -0
- package/server/tsconfig.json +20 -0
- package/server/workflowTestRoute.test.ts +297 -0
- package/src/App.tsx +233 -0
- package/src/components/AgentConsole.tsx +461 -0
- package/src/components/BranchRulesEditor.tsx +156 -0
- package/src/components/CreateModal.tsx +275 -0
- package/src/components/Dock.tsx +487 -0
- package/src/components/EnvironmentDialog.tsx +569 -0
- package/src/components/EnvironmentPicker.tsx +357 -0
- package/src/components/EnvironmentsDialog.tsx +144 -0
- package/src/components/ExecutionPager.tsx +67 -0
- package/src/components/InfraPanel.test.tsx +103 -0
- package/src/components/InfraPanel.tsx +171 -0
- package/src/components/Inspector.tsx +1182 -0
- package/src/components/Json.tsx +50 -0
- package/src/components/JsonModal.tsx +52 -0
- package/src/components/LogMessage.tsx +61 -0
- package/src/components/NodeRunModal.tsx +213 -0
- package/src/components/RunLogPanel.tsx +397 -0
- package/src/components/RunbookView.tsx +1085 -0
- package/src/components/Scenarios.tsx +476 -0
- package/src/components/SettingsDialog.tsx +229 -0
- package/src/components/Sidebar.tsx +436 -0
- package/src/components/StatusBar.tsx +302 -0
- package/src/components/Toolbar.tsx +663 -0
- package/src/components/WelcomeDialog.test.tsx +107 -0
- package/src/components/WelcomeDialog.tsx +412 -0
- package/src/components/agentMarkdown.test.tsx +91 -0
- package/src/components/agentMarkdown.tsx +158 -0
- package/src/components/ui/badge.tsx +31 -0
- package/src/components/ui/button.tsx +46 -0
- package/src/components/ui/combobox.tsx +114 -0
- package/src/components/ui/command.tsx +82 -0
- package/src/components/ui/dialog.tsx +73 -0
- package/src/components/ui/input.tsx +20 -0
- package/src/components/ui/popover.tsx +32 -0
- package/src/components/ui/resizable.tsx +44 -0
- package/src/components/ui/tabs.tsx +36 -0
- package/src/config.ts +4 -0
- package/src/engine/authVerify.ts +81 -0
- package/src/engine/diagnostics.test.ts +437 -0
- package/src/engine/diagnostics.ts +211 -0
- package/src/engine/executor.test.ts +1339 -0
- package/src/engine/executor.ts +840 -0
- package/src/engine/httpError.test.ts +12 -0
- package/src/engine/httpError.ts +16 -0
- package/src/engine/index.ts +11 -0
- package/src/engine/output.ts +21 -0
- package/src/engine/publish.test.ts +176 -0
- package/src/engine/publish.ts +127 -0
- package/src/engine/registry.test.ts +64 -0
- package/src/engine/registry.ts +80 -0
- package/src/engine/scenarios.test.ts +55 -0
- package/src/engine/scenarios.ts +29 -0
- package/src/engine/schemaCheck.test.ts +21 -0
- package/src/engine/schemaCheck.ts +35 -0
- package/src/engine/trace.test.ts +19 -0
- package/src/engine/trace.ts +23 -0
- package/src/engine/types.test.ts +22 -0
- package/src/engine/types.ts +316 -0
- package/src/engine/validation.test.ts +314 -0
- package/src/engine/validation.ts +354 -0
- package/src/flows/anomaly-flows.test.ts +81 -0
- package/src/flows/anomaly-flows.ts +202 -0
- package/src/flows/city-sweep-flow.ts +131 -0
- package/src/flows/flows.test.ts +30 -0
- package/src/flows/login-flow.ts +150 -0
- package/src/flows/pradar-flows.test.ts +204 -0
- package/src/flows/pradar-flows.ts +419 -0
- package/src/flows/weather-flow.ts +154 -0
- package/src/globals.css +147 -0
- package/src/lib/pathParams.test.ts +24 -0
- package/src/lib/pathParams.ts +6 -0
- package/src/lib/registerLens.test.ts +79 -0
- package/src/lib/registerLens.ts +59 -0
- package/src/lib/runbookModel.test.ts +61 -0
- package/src/lib/runbookModel.ts +290 -0
- package/src/lib/runbookProjection.test.ts +417 -0
- package/src/lib/runbookProjection.ts +254 -0
- package/src/lib/useTailAnchor.ts +53 -0
- package/src/lib/utils.ts +7 -0
- package/src/main.tsx +13 -0
- package/src/nodes/anomaly.test.ts +98 -0
- package/src/nodes/anomaly.ts +637 -0
- package/src/nodes/effects-scan.test.ts +44 -0
- package/src/nodes/flow-control.test.ts +280 -0
- package/src/nodes/flow-control.ts +305 -0
- package/src/nodes/index.ts +22 -0
- package/src/nodes/login.test.ts +81 -0
- package/src/nodes/login.ts +186 -0
- package/src/nodes/loops.ts +69 -0
- package/src/nodes/pradar/index.ts +11 -0
- package/src/nodes/pradar/logic.test.ts +288 -0
- package/src/nodes/pradar/logic.ts +582 -0
- package/src/nodes/pradar/nodes.test.ts +146 -0
- package/src/nodes/pradar/nodes.ts +955 -0
- package/src/nodes/requireAuth.test.ts +75 -0
- package/src/nodes/requireAuth.ts +55 -0
- package/src/nodes/response.test.ts +33 -0
- package/src/nodes/response.ts +39 -0
- package/src/nodes/traceDetail.test.ts +39 -0
- package/src/nodes/weather.test.ts +65 -0
- package/src/nodes/weather.ts +306 -0
- package/src/store/agentClient.test.ts +103 -0
- package/src/store/agentClient.ts +131 -0
- package/src/store/apiTree.test.ts +17 -0
- package/src/store/apiTree.ts +73 -0
- package/src/store/builderStore.test.ts +1234 -0
- package/src/store/builderStore.ts +1879 -0
- package/src/store/infraClient.ts +63 -0
- package/src/store/nodeMeta.test.ts +24 -0
- package/src/store/nodeMeta.ts +21 -0
- package/src/store/persistence.test.ts +15 -0
- package/src/store/persistence.ts +54 -0
- package/src/store/serverRunner.ts +381 -0
- package/src/store/setupClient.ts +57 -0
- package/studio-dist/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
- package/studio-dist/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
- package/studio-dist/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
- package/studio-dist/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
- package/studio-dist/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
- package/studio-dist/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
- package/studio-dist/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
- package/studio-dist/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
- package/studio-dist/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/studio-dist/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/studio-dist/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- package/studio-dist/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/studio-dist/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
- package/studio-dist/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
- package/studio-dist/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
- package/studio-dist/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
- package/studio-dist/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
- package/studio-dist/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
- package/studio-dist/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
- package/studio-dist/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
- package/studio-dist/assets/index-DNJwW-hM.css +1 -0
- package/studio-dist/assets/index-O26dKRjW.js +65 -0
- package/studio-dist/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/studio-dist/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/studio-dist/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/studio-dist/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/studio-dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/studio-dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/studio-dist/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/studio-dist/favicon.svg +1 -0
- package/studio-dist/icons.svg +24 -0
- package/studio-dist/index.html +14 -0
- package/templates/skills/emberflow-basics/SKILL.md +316 -0
- package/templates/skills/emberflow-model-process/SKILL.md +209 -0
- package/templates/skills/emberflow-new-workflow/SKILL.md +211 -0
- package/templates/skills/emberflow-review-workflow/SKILL.md +148 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { parsePathParams } from '../lib/pathParams.js';
|
|
2
|
+
function paramDefaultsOf(inputNode) {
|
|
3
|
+
const defaults = inputNode.config?.defaults;
|
|
4
|
+
const params = defaults && typeof defaults === 'object' && !Array.isArray(defaults)
|
|
5
|
+
? defaults.params
|
|
6
|
+
: undefined;
|
|
7
|
+
return params && typeof params === 'object' && !Array.isArray(params) ? params : undefined;
|
|
8
|
+
}
|
|
9
|
+
/** Diagnose an operation (a flow with an `http` trigger, plus its scenarios)
|
|
10
|
+
* for issues a studio user or the `emberflow doctor` CLI should surface
|
|
11
|
+
* before relying on the operation. Deterministic order: all
|
|
12
|
+
* `missing-param-default` (path order), then all `param-no-real-scenario`
|
|
13
|
+
* (path order), then `no-expects`, then `missing-node-mock` (extras order),
|
|
14
|
+
* then `inputmap-schema-mismatch` (node order), then `simulated-commit`
|
|
15
|
+
* (node order), then `language-drift` (at most one, project-level). */
|
|
16
|
+
export function diagnoseOperation(flow, scenarios, extras) {
|
|
17
|
+
const diagnostics = [];
|
|
18
|
+
const scenarioList = scenarios ?? [];
|
|
19
|
+
const path = flow.http?.path;
|
|
20
|
+
const params = path ? parsePathParams(path) : [];
|
|
21
|
+
// No Input node means nothing can map `params` into a node — there is
|
|
22
|
+
// nothing to guard and nowhere to put a default, so skip entirely (mirrors
|
|
23
|
+
// missingPathParams' guard semantics).
|
|
24
|
+
const inputNode = params.length > 0 ? flow.nodes.find((n) => n.type === 'Input') : undefined;
|
|
25
|
+
if (inputNode) {
|
|
26
|
+
const paramDefaults = paramDefaultsOf(inputNode);
|
|
27
|
+
for (const name of params) {
|
|
28
|
+
const hasDefault = paramDefaults ? paramDefaults[name] !== undefined : false;
|
|
29
|
+
if (!hasDefault) {
|
|
30
|
+
diagnostics.push({
|
|
31
|
+
severity: 'warning',
|
|
32
|
+
code: 'missing-param-default',
|
|
33
|
+
message: `Path param ":${name}" has no default — plain Run would reach nodes with params.${name} undefined. Add a value (even "") under the Input node's defaults.params, or run a scenario.`,
|
|
34
|
+
nodeId: inputNode.id,
|
|
35
|
+
param: name,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
for (const name of params) {
|
|
40
|
+
const suppliesRealValue = scenarioList.some((s) => {
|
|
41
|
+
const scenarioParams = s.input?.params;
|
|
42
|
+
const value = scenarioParams?.[name];
|
|
43
|
+
return typeof value === 'string' ? value !== '' : value !== undefined;
|
|
44
|
+
});
|
|
45
|
+
if (!suppliesRealValue) {
|
|
46
|
+
diagnostics.push({
|
|
47
|
+
severity: 'info',
|
|
48
|
+
code: 'param-no-real-scenario',
|
|
49
|
+
message: `No scenario supplies a real value for path param ":${name}" — add a scenario with input.params.${name} set to exercise this path.`,
|
|
50
|
+
nodeId: inputNode.id,
|
|
51
|
+
param: name,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const hasExpect = scenarioList.some((s) => s.expect !== undefined);
|
|
57
|
+
if (!hasExpect) {
|
|
58
|
+
diagnostics.push({
|
|
59
|
+
severity: 'info',
|
|
60
|
+
code: 'no-expects',
|
|
61
|
+
message: 'This operation has no scenario with an expect — nothing verifies its behavior automatically. Add expect to at least one scenario.',
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const infraNodes = extras?.infraNodes ?? [];
|
|
65
|
+
const opMocks = extras?.opMocks ?? flow.mocks ?? {};
|
|
66
|
+
for (const { id, traceKind } of infraNodes) {
|
|
67
|
+
if (Object.prototype.hasOwnProperty.call(opMocks, id))
|
|
68
|
+
continue;
|
|
69
|
+
const node = flow.nodes.find((n) => n.id === id);
|
|
70
|
+
diagnostics.push({
|
|
71
|
+
severity: 'info',
|
|
72
|
+
code: 'missing-node-mock',
|
|
73
|
+
message: `"${node?.label ?? id}" touches infrastructure (${traceKind}) but has no mock — plain (no-scenario) Mock runs will fail at it. Cover with AI writes mocks, or add one under "mocks" in the scenarios file.`,
|
|
74
|
+
nodeId: id,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// inputmap-schema-mismatch: an inputMap entry reads a field the source node
|
|
78
|
+
// never declares. Catches wiring that only breaks in a REAL run — a mocked
|
|
79
|
+
// source node hides it, but the live node returns a differently-shaped output.
|
|
80
|
+
// Only fires when the source node's type is registered AND its outputSchema
|
|
81
|
+
// declares fields (present in extras.outputFieldsByNode).
|
|
82
|
+
const outputFieldsByNode = extras?.outputFieldsByNode;
|
|
83
|
+
if (outputFieldsByNode) {
|
|
84
|
+
for (const node of flow.nodes) {
|
|
85
|
+
if (!node.inputMap)
|
|
86
|
+
continue;
|
|
87
|
+
for (const [field, mapping] of Object.entries(node.inputMap)) {
|
|
88
|
+
const declared = outputFieldsByNode[mapping.sourceNodeId];
|
|
89
|
+
if (!declared)
|
|
90
|
+
continue; // source unregistered or has no declared output fields
|
|
91
|
+
// '$' means the whole output — nothing to check. Ignore a leading '$'.
|
|
92
|
+
const raw = mapping.sourceField;
|
|
93
|
+
if (raw === '$' || raw === '')
|
|
94
|
+
continue;
|
|
95
|
+
const firstSegment = raw.replace(/^\$\.?/, '').split('.')[0];
|
|
96
|
+
if (firstSegment === '' || firstSegment === '$')
|
|
97
|
+
continue;
|
|
98
|
+
if (!declared.includes(firstSegment)) {
|
|
99
|
+
diagnostics.push({
|
|
100
|
+
severity: 'warning',
|
|
101
|
+
code: 'inputmap-schema-mismatch',
|
|
102
|
+
message: `"${node.label ?? node.id}".${field} reads "${raw}" from ${mapping.sourceNodeId}, but "${firstSegment}" is not a declared output field of that node (declares: ${declared.join(', ') || 'none'}). A real run may return undefined here even if a mock hides it.`,
|
|
103
|
+
nodeId: node.id,
|
|
104
|
+
param: field,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// simulated-commit: a mutation node whose implementation source still
|
|
111
|
+
// contains the `[SIMULATED]` marker — the forbidden anti-pattern of a
|
|
112
|
+
// commit branch that logs and returns success instead of performing (or
|
|
113
|
+
// throwing on) the real side effect. Each flagged node instance gets its
|
|
114
|
+
// own warning; a node type used twice is not deduped, since each instance
|
|
115
|
+
// is an independent op-level risk. Only fires for nodes present in
|
|
116
|
+
// extras.mutationSourcesByNode — see that field's doc comment for the
|
|
117
|
+
// registered/mutation/function-source gating the caller performs.
|
|
118
|
+
const mutationSourcesByNode = extras?.mutationSourcesByNode;
|
|
119
|
+
if (mutationSourcesByNode) {
|
|
120
|
+
for (const node of flow.nodes) {
|
|
121
|
+
const source = mutationSourcesByNode[node.id];
|
|
122
|
+
if (source === undefined || !source.includes('[SIMULATED]'))
|
|
123
|
+
continue;
|
|
124
|
+
diagnostics.push({
|
|
125
|
+
severity: 'warning',
|
|
126
|
+
code: 'simulated-commit',
|
|
127
|
+
message: `mutation node "${node.id}" (${node.type}) has a simulated commit path — the commit branch must perform the real side effect or throw naming the missing secretRef`,
|
|
128
|
+
nodeId: node.id,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// language-drift: the project's declared `language:` field disagrees with
|
|
133
|
+
// its own config file's extension. Only fires when the caller passed
|
|
134
|
+
// extras.languageDrift — which callers only do when the field was EXPLICIT
|
|
135
|
+
// and contradicts the extension (see that field's doc comment); an
|
|
136
|
+
// inferred language always agrees with the extension by construction, so
|
|
137
|
+
// there's nothing to detect in that case.
|
|
138
|
+
const languageDrift = extras?.languageDrift;
|
|
139
|
+
if (languageDrift) {
|
|
140
|
+
const { projectLanguage, configPathExtension } = languageDrift;
|
|
141
|
+
diagnostics.push({
|
|
142
|
+
severity: 'info',
|
|
143
|
+
code: 'language-drift',
|
|
144
|
+
message: `Project config declares language: "${projectLanguage}" but the config file itself is "${configPathExtension}" — align the "language" field with the config file's extension, or rename the file, so agents and tooling author in the right language.`,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
return diagnostics;
|
|
148
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { LogLine, NodeRunState, SubflowResult, WorkflowDefinition, WorkflowRun } from './types.js';
|
|
2
|
+
import type { NodeRegistry } from './registry.js';
|
|
3
|
+
import type { TraceSink } from './trace.js';
|
|
4
|
+
export declare function getByPath(obj: unknown, path: string): unknown;
|
|
5
|
+
/**
|
|
6
|
+
* Enriches a "reading property of undefined/null" TypeError message with the
|
|
7
|
+
* node's resolved input keys, so the recorded error points at what the node
|
|
8
|
+
* actually received instead of just the raw JS engine message. Every other
|
|
9
|
+
* message passes through byte-identical.
|
|
10
|
+
*/
|
|
11
|
+
export declare function explainUndefinedRead(message: string, input: Record<string, unknown>): string;
|
|
12
|
+
export interface ExecutorEvents {
|
|
13
|
+
onNodeStateChange?: (nodeId: string, state: NodeRunState) => void;
|
|
14
|
+
onLog?: (line: LogLine) => void;
|
|
15
|
+
onRunFinished?: (run: WorkflowRun) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface StartRunOptions {
|
|
18
|
+
flow: WorkflowDefinition;
|
|
19
|
+
registry: NodeRegistry;
|
|
20
|
+
trace?: TraceSink;
|
|
21
|
+
events?: ExecutorEvents;
|
|
22
|
+
now?: () => string;
|
|
23
|
+
newId?: () => string;
|
|
24
|
+
secrets?: Record<string, string>;
|
|
25
|
+
/** Non-secret environment values, exposed as ctx.vars and used to resolve {"$env": NAME}. */
|
|
26
|
+
vars?: Record<string, string>;
|
|
27
|
+
/** When true, mutation nodes dry-run their side effects; recorded on the run. */
|
|
28
|
+
safeMode?: boolean;
|
|
29
|
+
/** The environment name this run points at; recorded on the run. */
|
|
30
|
+
environment?: string;
|
|
31
|
+
/** nodeId -> pinned output. Pinned nodes skip execution and tracing. */
|
|
32
|
+
pins?: Record<string, unknown>;
|
|
33
|
+
/**
|
|
34
|
+
* When true, runs in Mock mode: nodes with a canned output in `mocks` return
|
|
35
|
+
* it verbatim without invoking their implementation or the retry loop; nodes
|
|
36
|
+
* that would touch infrastructure (`traceKind` 'db'/'http'/'llm') and have no
|
|
37
|
+
* mock fail loud (a normal node failure — respects `optional`, halts like any
|
|
38
|
+
* error). Pure/compute nodes (`traceKind` 'compute' or absent) always execute
|
|
39
|
+
* their real implementation, mocked or not. Defaults false; when false,
|
|
40
|
+
* `mocks` is ignored entirely (Live behavior is byte-identical to today).
|
|
41
|
+
*/
|
|
42
|
+
mockRun?: boolean;
|
|
43
|
+
/** nodeId -> canned output, consulted only when `mockRun` is true. See `mockRun`. */
|
|
44
|
+
mocks?: Record<string, unknown>;
|
|
45
|
+
/** The invocation payload, exposed to nodes as ctx.runInput. */
|
|
46
|
+
input?: Record<string, unknown>;
|
|
47
|
+
/**
|
|
48
|
+
* Host-provided runner for Subflow nodes: given a workflow id + input, runs
|
|
49
|
+
* that child flow to completion and returns its collected output. The
|
|
50
|
+
* executor injects the calling node's id (for log prefixing / cycle context);
|
|
51
|
+
* the host owns workflow lookup and the recursion/cycle guard. Absent when
|
|
52
|
+
* the host can't resolve other workflows.
|
|
53
|
+
*/
|
|
54
|
+
subflowRunner?: (workflowId: string, input: Record<string, unknown>, callerNodeId: string) => Promise<SubflowResult>;
|
|
55
|
+
}
|
|
56
|
+
export declare class FlowRun {
|
|
57
|
+
readonly run: WorkflowRun;
|
|
58
|
+
private readonly flow;
|
|
59
|
+
private readonly registry;
|
|
60
|
+
private readonly trace?;
|
|
61
|
+
private readonly events;
|
|
62
|
+
private readonly now;
|
|
63
|
+
private readonly newId;
|
|
64
|
+
private readonly secrets;
|
|
65
|
+
private readonly vars;
|
|
66
|
+
private readonly environment?;
|
|
67
|
+
private readonly safeMode;
|
|
68
|
+
private readonly runInput;
|
|
69
|
+
private readonly pins;
|
|
70
|
+
private readonly mockRun;
|
|
71
|
+
private readonly mocks;
|
|
72
|
+
private readonly subflowRunner?;
|
|
73
|
+
private readonly order;
|
|
74
|
+
private readonly outputs;
|
|
75
|
+
private readonly skippedNodes;
|
|
76
|
+
private readonly branchTaken;
|
|
77
|
+
private readonly regionByForEach;
|
|
78
|
+
/** Nodes a completed loop region already executed; the main cursor consumes them silently. */
|
|
79
|
+
private readonly loopExecuted;
|
|
80
|
+
private activeLoop?;
|
|
81
|
+
private cursor;
|
|
82
|
+
/** Run-wide execution counter — numbers every node execution in the log. */
|
|
83
|
+
private execSeq;
|
|
84
|
+
constructor(opts: StartRunOptions);
|
|
85
|
+
step(): Promise<boolean>;
|
|
86
|
+
/**
|
|
87
|
+
* Runs one node's implementation (or reuses its pin) end to end: resolve
|
|
88
|
+
* config/input, execute, record state + trace, handle failure. Shared by
|
|
89
|
+
* the main cursor and by loop-body execution, which additionally tags the
|
|
90
|
+
* resulting NodeRunState with the current iteration.
|
|
91
|
+
*/
|
|
92
|
+
private executeNode;
|
|
93
|
+
/** First step on a reachable ForEach: resolve items, chunk, and start (or short-circuit) the region. */
|
|
94
|
+
private startLoop;
|
|
95
|
+
/**
|
|
96
|
+
* Sets the ForEach's per-iteration output and resets body branch-skip
|
|
97
|
+
* state. Also clears each body id's prior-iteration output: without this,
|
|
98
|
+
* a body node that a branch skips this iteration would still resolve
|
|
99
|
+
* downstream inputMap reads to whatever it produced last iteration, since
|
|
100
|
+
* `outputs` is otherwise only ever overwritten (never cleared) by execution.
|
|
101
|
+
*/
|
|
102
|
+
private beginIteration;
|
|
103
|
+
/** One step of an in-progress region: a body node, an iteration advance, or the final Collect. */
|
|
104
|
+
private stepLoop;
|
|
105
|
+
/** Resolves Collect's `value` input against the current iteration's body outputs. */
|
|
106
|
+
private resolveCollectValue;
|
|
107
|
+
/**
|
|
108
|
+
* Executes Collect once with the accumulated results and hands the region's
|
|
109
|
+
* nodes to `loopExecuted` so the main cursor consumes them silently — it
|
|
110
|
+
* must NOT jump past the Collect, because topo order can interleave
|
|
111
|
+
* parallel non-region nodes between the ForEach and the Collect.
|
|
112
|
+
*/
|
|
113
|
+
private finishLoop;
|
|
114
|
+
/** Remember a node's taken branch when its output carries `$branch`. */
|
|
115
|
+
private captureBranch;
|
|
116
|
+
/**
|
|
117
|
+
* A node is reachable if it has no incoming edges, or at least one incoming
|
|
118
|
+
* edge from a non-skipped, executed source whose branch (if the edge names
|
|
119
|
+
* one via sourceHandle) was taken.
|
|
120
|
+
*/
|
|
121
|
+
private isReachable;
|
|
122
|
+
private epilogue;
|
|
123
|
+
runToEnd(): Promise<WorkflowRun>;
|
|
124
|
+
cancel(): void;
|
|
125
|
+
/**
|
|
126
|
+
* Resolve {"$secret": NAME} and {"$env": NAME} config values; a missing
|
|
127
|
+
* secret/var fails the node. `$secret` is only recognized at a config
|
|
128
|
+
* value's top level (matching today's behavior — secrets are never nested
|
|
129
|
+
* inside larger config structures). `$env` is resolved deeply, the same
|
|
130
|
+
* walk used for the run-input payload, so refs nested in objects/arrays
|
|
131
|
+
* (e.g. an Input node's `config.defaults`) resolve too.
|
|
132
|
+
*/
|
|
133
|
+
private resolveConfig;
|
|
134
|
+
private resolveInput;
|
|
135
|
+
/**
|
|
136
|
+
* A lenient variant of `resolveInput` for nodes whose implementation never
|
|
137
|
+
* runs (mocked, or an infra node with no mock, in a mock run): resolves
|
|
138
|
+
* only `inputMap`-sourced fields (other nodes' already-computed outputs,
|
|
139
|
+
* which can never carry a `$secret`/`$env` ref). Skips the config-sourced
|
|
140
|
+
* fields `resolveInput` also merges in — those come from `resolveConfig`,
|
|
141
|
+
* which this path deliberately never calls, since that is exactly what
|
|
142
|
+
* could throw (e.g. `Missing secret`) for a node this run will never
|
|
143
|
+
* actually execute.
|
|
144
|
+
*/
|
|
145
|
+
private resolveInputLenient;
|
|
146
|
+
private finish;
|
|
147
|
+
private setNodeState;
|
|
148
|
+
private emitLog;
|
|
149
|
+
private recordSample;
|
|
150
|
+
}
|
|
151
|
+
export declare function startRun(opts: StartRunOptions): FlowRun;
|