@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,7 @@
|
|
|
1
|
+
/** A typed error a node can throw to control the HTTP status/body of its operation. */
|
|
2
|
+
export declare class HttpError extends Error {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
readonly body?: unknown;
|
|
5
|
+
constructor(status: number, body?: unknown);
|
|
6
|
+
}
|
|
7
|
+
export declare function isHttpError(e: unknown): e is HttpError;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** A typed error a node can throw to control the HTTP status/body of its operation. */
|
|
2
|
+
export class HttpError extends Error {
|
|
3
|
+
status;
|
|
4
|
+
body;
|
|
5
|
+
constructor(status, body) {
|
|
6
|
+
super(`HTTP ${status}`);
|
|
7
|
+
this.name = 'HttpError';
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.body = body;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export function isHttpError(e) {
|
|
13
|
+
return e instanceof HttpError;
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './registry.js';
|
|
3
|
+
export * from './validation.js';
|
|
4
|
+
export * from './trace.js';
|
|
5
|
+
export * from './executor.js';
|
|
6
|
+
export * from './output.js';
|
|
7
|
+
export * from './publish.js';
|
|
8
|
+
export * from './scenarios.js';
|
|
9
|
+
export * from './httpError.js';
|
|
10
|
+
export * from './schemaCheck.js';
|
|
11
|
+
export * from './authVerify.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './registry.js';
|
|
3
|
+
export * from './validation.js';
|
|
4
|
+
export * from './trace.js';
|
|
5
|
+
export * from './executor.js';
|
|
6
|
+
export * from './output.js';
|
|
7
|
+
export * from './publish.js';
|
|
8
|
+
export * from './scenarios.js';
|
|
9
|
+
export * from './httpError.js';
|
|
10
|
+
export * from './schemaCheck.js';
|
|
11
|
+
export * from './authVerify.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WorkflowDefinition, WorkflowRun } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The output a finished run surfaces: the data collected by its Result nodes —
|
|
4
|
+
* exactly what the Dock's Output tab shows. A run with a single Result that
|
|
5
|
+
* produced output yields that output directly; multiple Results are keyed by
|
|
6
|
+
* node label; a run whose Result nodes were all skipped (or has none) yields
|
|
7
|
+
* undefined. Used to derive a Subflow node's return value on both hosts
|
|
8
|
+
* (browser store and server run registry), so subflow output follows the same
|
|
9
|
+
* convention users already see for a run.
|
|
10
|
+
*/
|
|
11
|
+
export declare function runOutput(run: WorkflowRun, flow: WorkflowDefinition): unknown;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The output a finished run surfaces: the data collected by its Result nodes —
|
|
3
|
+
* exactly what the Dock's Output tab shows. A run with a single Result that
|
|
4
|
+
* produced output yields that output directly; multiple Results are keyed by
|
|
5
|
+
* node label; a run whose Result nodes were all skipped (or has none) yields
|
|
6
|
+
* undefined. Used to derive a Subflow node's return value on both hosts
|
|
7
|
+
* (browser store and server run registry), so subflow output follows the same
|
|
8
|
+
* convention users already see for a run.
|
|
9
|
+
*/
|
|
10
|
+
export function runOutput(run, flow) {
|
|
11
|
+
const produced = flow.nodes.filter((n) => n.type === 'Result' && run.nodeStates[n.id]?.output !== undefined);
|
|
12
|
+
if (produced.length === 0)
|
|
13
|
+
return undefined;
|
|
14
|
+
if (produced.length === 1)
|
|
15
|
+
return run.nodeStates[produced[0].id].output;
|
|
16
|
+
const out = {};
|
|
17
|
+
for (const n of produced)
|
|
18
|
+
out[n.label] = run.nodeStates[n.id].output;
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { FieldDefinition, NodeImplementation, WorkflowDefinition } from './types.js';
|
|
2
|
+
import type { NodeRegistry } from './registry.js';
|
|
3
|
+
/**
|
|
4
|
+
* A sealed, executable flow artifact. Carries the flow, the input schema lifted
|
|
5
|
+
* from its Input node, and a SHA-256 hash of every node type's implementation
|
|
6
|
+
* so the runner can refuse to execute a flow whose code has drifted.
|
|
7
|
+
*/
|
|
8
|
+
export interface PublishedArtifact {
|
|
9
|
+
$artifact: 'emberflow/v1';
|
|
10
|
+
publishedAt: string;
|
|
11
|
+
inputSchema: FieldDefinition[];
|
|
12
|
+
/** node TYPE -> sha256 hex of implementation.toString() */
|
|
13
|
+
nodeHashes: Record<string, string>;
|
|
14
|
+
flow: WorkflowDefinition;
|
|
15
|
+
}
|
|
16
|
+
/** SHA-256 hex of an implementation's source text (WebCrypto — browser + Node). */
|
|
17
|
+
export declare function hashImplementation(impl: NodeImplementation): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Seal a flow into a PublishedArtifact: validate (error-severity issues throw),
|
|
20
|
+
* strip pins, lift the input schema, and hash each node type's implementation.
|
|
21
|
+
*/
|
|
22
|
+
export declare function publishFlow(flow: WorkflowDefinition, registry: NodeRegistry, now?: () => string): Promise<PublishedArtifact>;
|
|
23
|
+
/**
|
|
24
|
+
* Verify every node hash in an artifact against a live registry. Returns the
|
|
25
|
+
* list of drifted (hash mismatch) or unknown (unregistered) node types; an
|
|
26
|
+
* empty list means the artifact is safe to execute on this registry.
|
|
27
|
+
*/
|
|
28
|
+
export declare function verifyArtifact(artifact: PublishedArtifact, registry: NodeRegistry): Promise<string[]>;
|
|
29
|
+
/** Structural type guard for a PublishedArtifact envelope. */
|
|
30
|
+
export declare function isArtifact(value: unknown): value is PublishedArtifact;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { validateFlow } from './validation.js';
|
|
2
|
+
const ARTIFACT_TAG = 'emberflow/v1';
|
|
3
|
+
/** SHA-256 hex of an implementation's source text (WebCrypto — browser + Node). */
|
|
4
|
+
export async function hashImplementation(impl) {
|
|
5
|
+
const bytes = new TextEncoder().encode(impl.toString());
|
|
6
|
+
const digest = await crypto.subtle.digest('SHA-256', bytes);
|
|
7
|
+
return [...new Uint8Array(digest)].map((b) => b.toString(16).padStart(2, '0')).join('');
|
|
8
|
+
}
|
|
9
|
+
/** Distinct node types used by a flow, in first-seen order. */
|
|
10
|
+
function distinctTypes(flow) {
|
|
11
|
+
const seen = [];
|
|
12
|
+
for (const node of flow.nodes) {
|
|
13
|
+
if (!seen.includes(node.type))
|
|
14
|
+
seen.push(node.type);
|
|
15
|
+
}
|
|
16
|
+
return seen;
|
|
17
|
+
}
|
|
18
|
+
/** Lift the declared input schema from the flow's first Input node (or []). */
|
|
19
|
+
function liftInputSchema(flow) {
|
|
20
|
+
const input = flow.nodes.find((n) => n.type === 'Input');
|
|
21
|
+
const fields = input?.config?.fields;
|
|
22
|
+
if (!Array.isArray(fields))
|
|
23
|
+
return [];
|
|
24
|
+
return fields.filter((f) => f !== null && typeof f === 'object' && typeof f.name === 'string');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Deep-copy a flow and strip dev-only fixtures: metadata.pinnedOutput from
|
|
28
|
+
* every node, and top-level scenarios. Both are authoring aids that have no
|
|
29
|
+
* business shipping in a published artifact.
|
|
30
|
+
*/
|
|
31
|
+
function sealFlow(flow) {
|
|
32
|
+
const copy = structuredClone(flow);
|
|
33
|
+
for (const node of copy.nodes) {
|
|
34
|
+
if (!node.metadata)
|
|
35
|
+
continue;
|
|
36
|
+
delete node.metadata.pinnedOutput;
|
|
37
|
+
if (Object.keys(node.metadata).length === 0)
|
|
38
|
+
delete node.metadata;
|
|
39
|
+
}
|
|
40
|
+
delete copy.scenarios;
|
|
41
|
+
return copy;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Seal a flow into a PublishedArtifact: validate (error-severity issues throw),
|
|
45
|
+
* strip pins, lift the input schema, and hash each node type's implementation.
|
|
46
|
+
*/
|
|
47
|
+
export async function publishFlow(flow, registry, now = () => new Date().toISOString()) {
|
|
48
|
+
const errors = validateFlow(flow, registry).filter((i) => i.severity === 'error');
|
|
49
|
+
if (errors.length > 0) {
|
|
50
|
+
throw new Error(`Cannot publish: ${errors.map((i) => i.message).join('; ')}`);
|
|
51
|
+
}
|
|
52
|
+
const sealed = sealFlow(flow);
|
|
53
|
+
const nodeHashes = {};
|
|
54
|
+
for (const type of distinctTypes(sealed)) {
|
|
55
|
+
nodeHashes[type] = await hashImplementation(registry.get(type).implementation);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
$artifact: ARTIFACT_TAG,
|
|
59
|
+
publishedAt: now(),
|
|
60
|
+
inputSchema: liftInputSchema(sealed),
|
|
61
|
+
nodeHashes,
|
|
62
|
+
flow: sealed,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Verify every node hash in an artifact against a live registry. Returns the
|
|
67
|
+
* list of drifted (hash mismatch) or unknown (unregistered) node types; an
|
|
68
|
+
* empty list means the artifact is safe to execute on this registry.
|
|
69
|
+
*/
|
|
70
|
+
export async function verifyArtifact(artifact, registry) {
|
|
71
|
+
const bad = [];
|
|
72
|
+
for (const [type, expected] of Object.entries(artifact.nodeHashes)) {
|
|
73
|
+
if (!registry.has(type)) {
|
|
74
|
+
bad.push(type);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const actual = await hashImplementation(registry.get(type).implementation);
|
|
78
|
+
if (actual !== expected)
|
|
79
|
+
bad.push(type);
|
|
80
|
+
}
|
|
81
|
+
return bad;
|
|
82
|
+
}
|
|
83
|
+
/** Structural type guard for a PublishedArtifact envelope. */
|
|
84
|
+
export function isArtifact(value) {
|
|
85
|
+
if (value === null || typeof value !== 'object')
|
|
86
|
+
return false;
|
|
87
|
+
const v = value;
|
|
88
|
+
return (v.$artifact === ARTIFACT_TAG &&
|
|
89
|
+
typeof v.publishedAt === 'string' &&
|
|
90
|
+
Array.isArray(v.inputSchema) &&
|
|
91
|
+
v.nodeHashes !== null &&
|
|
92
|
+
typeof v.nodeHashes === 'object' &&
|
|
93
|
+
v.flow !== null &&
|
|
94
|
+
typeof v.flow === 'object');
|
|
95
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { NodeDefinition, NodeImplementation } from './types.js';
|
|
2
|
+
export interface RegisteredNode {
|
|
3
|
+
definition: NodeDefinition;
|
|
4
|
+
implementation: NodeImplementation;
|
|
5
|
+
}
|
|
6
|
+
export declare class NodeRegistry {
|
|
7
|
+
nodes: Map<string, RegisteredNode>;
|
|
8
|
+
sources: Map<string, string>;
|
|
9
|
+
register(definition: NodeDefinition, implementation: NodeImplementation): void;
|
|
10
|
+
get(type: string): RegisteredNode;
|
|
11
|
+
has(type: string): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Replace this registry's contents with another's, in place. Keeps this
|
|
14
|
+
* object's identity, so references held elsewhere (RunRegistry's execution
|
|
15
|
+
* registry, request-handler closures) immediately see the new node set. Used
|
|
16
|
+
* by the project-config hot-reload to pick up agent-authored nodes without a
|
|
17
|
+
* process restart (which would kill in-flight agent runs).
|
|
18
|
+
*/
|
|
19
|
+
adopt(other: NodeRegistry): void;
|
|
20
|
+
list(): NodeDefinition[];
|
|
21
|
+
/**
|
|
22
|
+
* Register a definition-only node (metadata fetched from the runner). Its
|
|
23
|
+
* implementation is a stub that fails loudly if browser-executed — such
|
|
24
|
+
* nodes run on the server. Never overwrites a real registration.
|
|
25
|
+
*/
|
|
26
|
+
registerDefinition(definition: NodeDefinition, source?: string): void;
|
|
27
|
+
/** Source text for display: stored source for definition-only nodes, else the impl's toString(). */
|
|
28
|
+
getSource(type: string): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* A fresh registry instance sharing this one's node + source maps — a new
|
|
31
|
+
* top-level reference (so store subscribers re-render) without copying node data.
|
|
32
|
+
*/
|
|
33
|
+
withSameNodes(): NodeRegistry;
|
|
34
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export class NodeRegistry {
|
|
2
|
+
nodes = new Map();
|
|
3
|
+
sources = new Map();
|
|
4
|
+
register(definition, implementation) {
|
|
5
|
+
if (this.nodes.has(definition.type)) {
|
|
6
|
+
throw new Error(`Node type already registered: ${definition.type}`);
|
|
7
|
+
}
|
|
8
|
+
this.nodes.set(definition.type, { definition, implementation });
|
|
9
|
+
}
|
|
10
|
+
get(type) {
|
|
11
|
+
const node = this.nodes.get(type);
|
|
12
|
+
if (!node)
|
|
13
|
+
throw new Error(`Unknown node type: ${type}`);
|
|
14
|
+
return node;
|
|
15
|
+
}
|
|
16
|
+
has(type) {
|
|
17
|
+
return this.nodes.has(type);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Replace this registry's contents with another's, in place. Keeps this
|
|
21
|
+
* object's identity, so references held elsewhere (RunRegistry's execution
|
|
22
|
+
* registry, request-handler closures) immediately see the new node set. Used
|
|
23
|
+
* by the project-config hot-reload to pick up agent-authored nodes without a
|
|
24
|
+
* process restart (which would kill in-flight agent runs).
|
|
25
|
+
*/
|
|
26
|
+
adopt(other) {
|
|
27
|
+
this.nodes = other.nodes;
|
|
28
|
+
this.sources = other.sources;
|
|
29
|
+
}
|
|
30
|
+
list() {
|
|
31
|
+
return [...this.nodes.values()].map((n) => n.definition);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Register a definition-only node (metadata fetched from the runner). Its
|
|
35
|
+
* implementation is a stub that fails loudly if browser-executed — such
|
|
36
|
+
* nodes run on the server. Never overwrites a real registration.
|
|
37
|
+
*/
|
|
38
|
+
registerDefinition(definition, source) {
|
|
39
|
+
if (this.nodes.has(definition.type))
|
|
40
|
+
return;
|
|
41
|
+
this.nodes.set(definition.type, {
|
|
42
|
+
definition,
|
|
43
|
+
implementation: async () => {
|
|
44
|
+
throw new Error(`${definition.type} runs on the server — start the runner or switch execution to Server mode`);
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
if (source !== undefined)
|
|
48
|
+
this.sources.set(definition.type, source);
|
|
49
|
+
}
|
|
50
|
+
/** Source text for display: stored source for definition-only nodes, else the impl's toString(). */
|
|
51
|
+
getSource(type) {
|
|
52
|
+
if (this.sources.has(type))
|
|
53
|
+
return this.sources.get(type);
|
|
54
|
+
const node = this.nodes.get(type);
|
|
55
|
+
return node ? node.implementation.toString() : undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A fresh registry instance sharing this one's node + source maps — a new
|
|
59
|
+
* top-level reference (so store subscribers re-render) without copying node data.
|
|
60
|
+
*/
|
|
61
|
+
withSameNodes() {
|
|
62
|
+
const next = new NodeRegistry();
|
|
63
|
+
next.nodes = this.nodes;
|
|
64
|
+
next.sources = this.sources;
|
|
65
|
+
return next;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ScenarioDefinition, WorkflowDefinition } from './types.js';
|
|
2
|
+
/** Find a scenario by name (exact) or id. Returns undefined when absent. */
|
|
3
|
+
export declare function findScenario(flow: WorkflowDefinition, nameOrId: string): ScenarioDefinition | undefined;
|
|
4
|
+
/** Names of a flow's scenarios, for error messages. */
|
|
5
|
+
export declare function scenarioNames(flow: WorkflowDefinition): string[];
|
|
6
|
+
/** Merge an op's flow-level `mocks` with a scenario's `mocks` (scenario wins
|
|
7
|
+
* per nodeId) into the map an executor mock run consults. ONE merge shared
|
|
8
|
+
* by both places that start a mock run: the live serving path
|
|
9
|
+
* (server/index.ts POST /runs, when servingMode === 'mock') and the CLI test
|
|
10
|
+
* runner's `--mock` flag (server/testRunner.ts) — so mock semantics can't
|
|
11
|
+
* drift between "serve mock" and "test mock". */
|
|
12
|
+
export declare function mergeMocks(flow: WorkflowDefinition, scenario?: ScenarioDefinition): Record<string, unknown>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Find a scenario by name (exact) or id. Returns undefined when absent. */
|
|
2
|
+
export function findScenario(flow, nameOrId) {
|
|
3
|
+
return flow.scenarios?.find((s) => s.name === nameOrId || s.id === nameOrId);
|
|
4
|
+
}
|
|
5
|
+
/** Names of a flow's scenarios, for error messages. */
|
|
6
|
+
export function scenarioNames(flow) {
|
|
7
|
+
return (flow.scenarios ?? []).map((s) => s.name);
|
|
8
|
+
}
|
|
9
|
+
/** Merge an op's flow-level `mocks` with a scenario's `mocks` (scenario wins
|
|
10
|
+
* per nodeId) into the map an executor mock run consults. ONE merge shared
|
|
11
|
+
* by both places that start a mock run: the live serving path
|
|
12
|
+
* (server/index.ts POST /runs, when servingMode === 'mock') and the CLI test
|
|
13
|
+
* runner's `--mock` flag (server/testRunner.ts) — so mock semantics can't
|
|
14
|
+
* drift between "serve mock" and "test mock". */
|
|
15
|
+
export function mergeMocks(flow, scenario) {
|
|
16
|
+
const opMocks = (flow.mocks ?? {});
|
|
17
|
+
const scenarioMocks = (scenario?.mocks ?? {});
|
|
18
|
+
return { ...opMocks, ...scenarioMocks };
|
|
19
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Minimal subset validator: object type, required keys, per-property primitive
|
|
2
|
+
* type. Returns null when valid, else the first error message. Unknown schema
|
|
3
|
+
* shapes impose no constraint (valid) — extend as real schemas demand. */
|
|
4
|
+
export declare function validateAgainstSchema(schema: unknown, value: unknown): string | null;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const typeOfValue = (v) => {
|
|
2
|
+
if (v === null)
|
|
3
|
+
return 'null';
|
|
4
|
+
if (v === undefined)
|
|
5
|
+
return 'undefined';
|
|
6
|
+
if (Array.isArray(v))
|
|
7
|
+
return 'array';
|
|
8
|
+
return typeof v;
|
|
9
|
+
};
|
|
10
|
+
/** Minimal subset validator: object type, required keys, per-property primitive
|
|
11
|
+
* type. Returns null when valid, else the first error message. Unknown schema
|
|
12
|
+
* shapes impose no constraint (valid) — extend as real schemas demand. */
|
|
13
|
+
export function validateAgainstSchema(schema, value) {
|
|
14
|
+
if (!schema || typeof schema !== 'object')
|
|
15
|
+
return null;
|
|
16
|
+
const s = schema;
|
|
17
|
+
if (s.type === 'object') {
|
|
18
|
+
if (typeOfValue(value) !== 'object')
|
|
19
|
+
return 'expected an object';
|
|
20
|
+
const obj = value;
|
|
21
|
+
for (const key of s.required ?? []) {
|
|
22
|
+
if (!(key in obj) || obj[key] === undefined)
|
|
23
|
+
return `missing required field: ${key}`;
|
|
24
|
+
}
|
|
25
|
+
for (const [key, spec] of Object.entries(s.properties ?? {})) {
|
|
26
|
+
if (obj[key] === undefined)
|
|
27
|
+
continue;
|
|
28
|
+
if (spec.type && typeOfValue(obj[key]) !== spec.type) {
|
|
29
|
+
return `field ${key} must be a ${spec.type}`;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NodeExecutionSample } from './types.js';
|
|
2
|
+
export interface TraceSink {
|
|
3
|
+
record(sample: NodeExecutionSample): void;
|
|
4
|
+
samplesFor(nodeId: string): NodeExecutionSample[];
|
|
5
|
+
all(): NodeExecutionSample[];
|
|
6
|
+
}
|
|
7
|
+
export declare class InMemoryTraceSink implements TraceSink {
|
|
8
|
+
private samples;
|
|
9
|
+
record(sample: NodeExecutionSample): void;
|
|
10
|
+
samplesFor(nodeId: string): NodeExecutionSample[];
|
|
11
|
+
all(): NodeExecutionSample[];
|
|
12
|
+
}
|