@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,130 @@
|
|
|
1
|
+
import type { LogLine, NodeExecutionSample, NodeRunState, PublishedArtifact, WorkflowDefinition, WorkflowRun } from '../src/engine/index.js';
|
|
2
|
+
import type { ApiTree, OpSummary } from './apiStore.js';
|
|
3
|
+
export type { ApiTree, FolderNode, ApiNode, OpSummary } from './apiStore.js';
|
|
4
|
+
/** SSE-shaped events emitted on GET /runs/:id/events — mirrors server/runRegistry.ts RunEvent. */
|
|
5
|
+
export type RunEvent = {
|
|
6
|
+
type: 'nodeState';
|
|
7
|
+
nodeId: string;
|
|
8
|
+
state: NodeRunState;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'log';
|
|
11
|
+
line: LogLine;
|
|
12
|
+
} | {
|
|
13
|
+
type: 'finished';
|
|
14
|
+
run: WorkflowRun;
|
|
15
|
+
};
|
|
16
|
+
/** Thrown when the runner cannot be reached at all (connection refused, DNS, etc). */
|
|
17
|
+
export declare class RunnerUnreachableError extends Error {
|
|
18
|
+
constructor(cause?: unknown);
|
|
19
|
+
}
|
|
20
|
+
export declare function health(): Promise<{
|
|
21
|
+
status: string;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function listWorkflows(): Promise<WorkflowDefinition[]>;
|
|
24
|
+
/** Fetches a single flow by id from the full workflow list (no single-flow GET endpoint). */
|
|
25
|
+
export declare function getWorkflow(id: string): Promise<WorkflowDefinition | undefined>;
|
|
26
|
+
export interface NodeMeta {
|
|
27
|
+
type: string;
|
|
28
|
+
label?: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
category?: string;
|
|
31
|
+
traceKind?: string;
|
|
32
|
+
effects?: string;
|
|
33
|
+
inputSchema?: unknown;
|
|
34
|
+
outputSchema?: unknown;
|
|
35
|
+
source?: string;
|
|
36
|
+
}
|
|
37
|
+
/** The runner's LIVE node registry (built-ins + the project's registerNodes),
|
|
38
|
+
* so the CLI sees the same nodes execution does — not a project-blind local
|
|
39
|
+
* createDefaultRegistry(). */
|
|
40
|
+
export declare function listNodes(): Promise<NodeMeta[]>;
|
|
41
|
+
/** Validate a flow against the runner's live registry (built-ins + project nodes). */
|
|
42
|
+
export declare function validateOperation(flow: WorkflowDefinition): Promise<{
|
|
43
|
+
valid: boolean;
|
|
44
|
+
issues: unknown[];
|
|
45
|
+
}>;
|
|
46
|
+
export declare function saveWorkflow(flow: WorkflowDefinition): Promise<void>;
|
|
47
|
+
/** One summary per operation with its on-disk `path` (id === path) and `http`
|
|
48
|
+
* trigger metadata (undefined for internal sub-flows). Sourced from the
|
|
49
|
+
* `operations[]` array of `GET /workflows`. */
|
|
50
|
+
export declare function listOperations(): Promise<OpSummary[]>;
|
|
51
|
+
/** Builds the API tree (apis → folders → operations) client-side from the flat
|
|
52
|
+
* `operations[]` summaries, splitting each op's `path` into [api, …folders, op].
|
|
53
|
+
* Mirrors the server's `ApiStore.tree()` so no extra runner route is needed. */
|
|
54
|
+
export declare function apiTree(): Promise<ApiTree>;
|
|
55
|
+
/** Result of a create-operation attempt: `ok: false` always carries a message
|
|
56
|
+
* (e.g. a 409 collision) so a creation failure is never silent. */
|
|
57
|
+
export interface CreateOperationResult {
|
|
58
|
+
ok: boolean;
|
|
59
|
+
error?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Creates a brand-new operation at an explicit `apis/` path via
|
|
63
|
+
* `POST /operations { flow, path }`. The runner enforces `flow.id === path` and
|
|
64
|
+
* 409s if an operation already exists at that path (never overwrites — that's
|
|
65
|
+
* `saveWorkflow`/PUT). Mirrors `src/store/serverRunner.ts createOperationOnServer`.
|
|
66
|
+
*/
|
|
67
|
+
/** Delete an operation by id (its apis-tree path). id is URL-encoded so slash
|
|
68
|
+
* ids match the /workflows/:id route. Returns ok:false with a message on 404. */
|
|
69
|
+
export declare function deleteOperation(id: string): Promise<CreateOperationResult>;
|
|
70
|
+
export declare function createOperation(flow: WorkflowDefinition, path: string): Promise<CreateOperationResult>;
|
|
71
|
+
export interface StartRunOptions {
|
|
72
|
+
/** A flow to run under dev semantics (mutually exclusive with `artifact`). */
|
|
73
|
+
flow?: WorkflowDefinition;
|
|
74
|
+
/** A sealed artifact to run under production semantics (mutually exclusive with `flow`). */
|
|
75
|
+
artifact?: PublishedArtifact;
|
|
76
|
+
/** Pinned node outputs; ignored/rejected by the runner in production. */
|
|
77
|
+
pins?: Record<string, unknown>;
|
|
78
|
+
/** The invocation payload, exposed to nodes as ctx.runInput. */
|
|
79
|
+
input?: Record<string, unknown>;
|
|
80
|
+
/** Explicit env override; artifact runs always force 'production' regardless. */
|
|
81
|
+
env?: 'dev' | 'production';
|
|
82
|
+
/** Named environment to run against (from emberflow.environments.json); omitted → runner default. */
|
|
83
|
+
environment?: string;
|
|
84
|
+
/** Explicit safe-mode override; omitted → environment's default (protected ⇒ true). */
|
|
85
|
+
safeMode?: boolean;
|
|
86
|
+
/** Required to equal `environment` when explicitly disabling safe mode on a protected environment. */
|
|
87
|
+
confirm?: string;
|
|
88
|
+
}
|
|
89
|
+
export declare function startRun(opts: StartRunOptions): Promise<string>;
|
|
90
|
+
export interface EnvironmentSummary {
|
|
91
|
+
name: string;
|
|
92
|
+
protected: boolean;
|
|
93
|
+
varKeys: string[];
|
|
94
|
+
secretKeys: string[];
|
|
95
|
+
auth?: {
|
|
96
|
+
configured: boolean;
|
|
97
|
+
authenticated: boolean;
|
|
98
|
+
secretRef?: string;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export declare function listEnvironments(): Promise<{
|
|
102
|
+
defaultEnvironment: string;
|
|
103
|
+
environments: EnvironmentSummary[];
|
|
104
|
+
}>;
|
|
105
|
+
/** Performs the named environment's configured login, storing the captured
|
|
106
|
+
* credential runner-side. Never returns the secret value — only whether the
|
|
107
|
+
* login succeeded and which secret it landed in. */
|
|
108
|
+
export declare function loginEnvironment(name: string): Promise<{
|
|
109
|
+
authenticated: boolean;
|
|
110
|
+
secretRef: string;
|
|
111
|
+
}>;
|
|
112
|
+
/** Sets (or, when `auth` is `null`, clears) an environment's auth config via
|
|
113
|
+
* `PUT /environments/:name/auth`. Never sends secret values — `auth` carries
|
|
114
|
+
* only refs/names (attach.secretRef, login.request.bodyRef). 204 on success. */
|
|
115
|
+
export declare function setEnvironmentAuth(name: string, auth: unknown): Promise<void>;
|
|
116
|
+
/** Flips whether mounted HTTP endpoints execute for real or answer from
|
|
117
|
+
* scenario expectations (mock), via `POST /serving`. 204 on success; a
|
|
118
|
+
* bogus mode is rejected by the runner (surfaced via request()'s error path). */
|
|
119
|
+
export declare function setServingMode(mode: 'real' | 'mock'): Promise<void>;
|
|
120
|
+
export declare function samples(nodeId: string): Promise<NodeExecutionSample[]>;
|
|
121
|
+
/**
|
|
122
|
+
* Opens the run's SSE stream and collects events until `finished`.
|
|
123
|
+
* Parses the stream by hand: messages are separated by a blank line, each
|
|
124
|
+
* made of `event:`/`data:` lines; lines starting with `:` are heartbeat
|
|
125
|
+
* comments and are ignored.
|
|
126
|
+
*/
|
|
127
|
+
export declare function waitForRun(runId: string): Promise<{
|
|
128
|
+
run: WorkflowRun;
|
|
129
|
+
logs: LogLine[];
|
|
130
|
+
}>;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
const DEFAULT_BASE_URL = 'http://127.0.0.1:8092';
|
|
2
|
+
function baseUrl() {
|
|
3
|
+
return process.env.EMBERFLOW_RUNNER_URL ?? DEFAULT_BASE_URL;
|
|
4
|
+
}
|
|
5
|
+
/** Thrown when the runner cannot be reached at all (connection refused, DNS, etc). */
|
|
6
|
+
export class RunnerUnreachableError extends Error {
|
|
7
|
+
constructor(cause) {
|
|
8
|
+
super(`runner unreachable at ${baseUrl()} — is \`npm run server\` running?`);
|
|
9
|
+
this.name = 'RunnerUnreachableError';
|
|
10
|
+
this.cause = cause;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
async function request(path, init) {
|
|
14
|
+
let res;
|
|
15
|
+
try {
|
|
16
|
+
res = await fetch(`${baseUrl()}${path}`, init);
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
throw new RunnerUnreachableError(err);
|
|
20
|
+
}
|
|
21
|
+
if (!res.ok) {
|
|
22
|
+
let message = `${res.status} ${res.statusText}`;
|
|
23
|
+
try {
|
|
24
|
+
const body = (await res.json());
|
|
25
|
+
if (body && typeof body.error === 'string')
|
|
26
|
+
message = body.error;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
/* body wasn't JSON — keep the status text */
|
|
30
|
+
}
|
|
31
|
+
throw new Error(message);
|
|
32
|
+
}
|
|
33
|
+
if (res.status === 204)
|
|
34
|
+
return undefined;
|
|
35
|
+
return (await res.json());
|
|
36
|
+
}
|
|
37
|
+
export async function health() {
|
|
38
|
+
return request('/healthz');
|
|
39
|
+
}
|
|
40
|
+
export async function listWorkflows() {
|
|
41
|
+
const { flows } = await request('/workflows');
|
|
42
|
+
return flows;
|
|
43
|
+
}
|
|
44
|
+
/** Fetches a single flow by id from the full workflow list (no single-flow GET endpoint). */
|
|
45
|
+
export async function getWorkflow(id) {
|
|
46
|
+
const flows = await listWorkflows();
|
|
47
|
+
return flows.find((f) => f.id === id);
|
|
48
|
+
}
|
|
49
|
+
/** The runner's LIVE node registry (built-ins + the project's registerNodes),
|
|
50
|
+
* so the CLI sees the same nodes execution does — not a project-blind local
|
|
51
|
+
* createDefaultRegistry(). */
|
|
52
|
+
export async function listNodes() {
|
|
53
|
+
const { nodes } = await request('/nodes');
|
|
54
|
+
return nodes;
|
|
55
|
+
}
|
|
56
|
+
/** Validate a flow against the runner's live registry (built-ins + project nodes). */
|
|
57
|
+
export async function validateOperation(flow) {
|
|
58
|
+
return request('/validate', {
|
|
59
|
+
method: 'POST',
|
|
60
|
+
headers: { 'Content-Type': 'application/json' },
|
|
61
|
+
body: JSON.stringify({ flow }),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export async function saveWorkflow(flow) {
|
|
65
|
+
await request(`/workflows/${encodeURIComponent(flow.id)}`, {
|
|
66
|
+
method: 'PUT',
|
|
67
|
+
headers: { 'Content-Type': 'application/json' },
|
|
68
|
+
body: JSON.stringify(flow),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/** One summary per operation with its on-disk `path` (id === path) and `http`
|
|
72
|
+
* trigger metadata (undefined for internal sub-flows). Sourced from the
|
|
73
|
+
* `operations[]` array of `GET /workflows`. */
|
|
74
|
+
export async function listOperations() {
|
|
75
|
+
const { operations } = await request('/workflows');
|
|
76
|
+
return operations;
|
|
77
|
+
}
|
|
78
|
+
/** Builds the API tree (apis → folders → operations) client-side from the flat
|
|
79
|
+
* `operations[]` summaries, splitting each op's `path` into [api, …folders, op].
|
|
80
|
+
* Mirrors the server's `ApiStore.tree()` so no extra runner route is needed. */
|
|
81
|
+
export async function apiTree() {
|
|
82
|
+
const ops = await listOperations();
|
|
83
|
+
const apis = new Map();
|
|
84
|
+
const folderAt = (parent, name) => {
|
|
85
|
+
let f = parent.folders.find((x) => x.name === name);
|
|
86
|
+
if (!f) {
|
|
87
|
+
f = { name, folders: [], operations: [] };
|
|
88
|
+
parent.folders.push(f);
|
|
89
|
+
}
|
|
90
|
+
return f;
|
|
91
|
+
};
|
|
92
|
+
for (const op of ops) {
|
|
93
|
+
const parts = op.path.split('/'); // [api, ...folders, opName]
|
|
94
|
+
const apiName = parts[0];
|
|
95
|
+
let api = apis.get(apiName);
|
|
96
|
+
if (!api) {
|
|
97
|
+
api = { name: apiName, folders: [], operations: [] };
|
|
98
|
+
apis.set(apiName, api);
|
|
99
|
+
}
|
|
100
|
+
let container = api;
|
|
101
|
+
for (const fp of parts.slice(1, -1))
|
|
102
|
+
container = folderAt(container, fp);
|
|
103
|
+
container.operations.push(op);
|
|
104
|
+
}
|
|
105
|
+
return { apis: [...apis.values()] };
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Creates a brand-new operation at an explicit `apis/` path via
|
|
109
|
+
* `POST /operations { flow, path }`. The runner enforces `flow.id === path` and
|
|
110
|
+
* 409s if an operation already exists at that path (never overwrites — that's
|
|
111
|
+
* `saveWorkflow`/PUT). Mirrors `src/store/serverRunner.ts createOperationOnServer`.
|
|
112
|
+
*/
|
|
113
|
+
/** Delete an operation by id (its apis-tree path). id is URL-encoded so slash
|
|
114
|
+
* ids match the /workflows/:id route. Returns ok:false with a message on 404. */
|
|
115
|
+
export async function deleteOperation(id) {
|
|
116
|
+
let res;
|
|
117
|
+
try {
|
|
118
|
+
res = await fetch(`${baseUrl()}/workflows/${encodeURIComponent(id)}`, { method: 'DELETE' });
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
throw new RunnerUnreachableError(err);
|
|
122
|
+
}
|
|
123
|
+
if (res.status === 204 || res.ok)
|
|
124
|
+
return { ok: true };
|
|
125
|
+
const body = (await res.json().catch(() => undefined));
|
|
126
|
+
return { ok: false, error: body?.error ?? `Delete failed with status ${res.status}` };
|
|
127
|
+
}
|
|
128
|
+
export async function createOperation(flow, path) {
|
|
129
|
+
let res;
|
|
130
|
+
try {
|
|
131
|
+
res = await fetch(`${baseUrl()}/operations`, {
|
|
132
|
+
method: 'POST',
|
|
133
|
+
headers: { 'Content-Type': 'application/json' },
|
|
134
|
+
body: JSON.stringify({ flow, path }),
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
throw new RunnerUnreachableError(err);
|
|
139
|
+
}
|
|
140
|
+
if (res.ok)
|
|
141
|
+
return { ok: true };
|
|
142
|
+
const body = (await res.json().catch(() => undefined));
|
|
143
|
+
return { ok: false, error: body?.error ?? `Request failed with status ${res.status}` };
|
|
144
|
+
}
|
|
145
|
+
export async function startRun(opts) {
|
|
146
|
+
const { flow, artifact, pins, input, env, environment, safeMode, confirm } = opts;
|
|
147
|
+
const { runId } = await request('/runs', {
|
|
148
|
+
method: 'POST',
|
|
149
|
+
headers: { 'Content-Type': 'application/json' },
|
|
150
|
+
body: JSON.stringify({ flow, artifact, mode: 'run', pins, input, env, environment, safeMode, confirm }),
|
|
151
|
+
});
|
|
152
|
+
return runId;
|
|
153
|
+
}
|
|
154
|
+
export async function listEnvironments() {
|
|
155
|
+
return request('/environments');
|
|
156
|
+
}
|
|
157
|
+
/** Performs the named environment's configured login, storing the captured
|
|
158
|
+
* credential runner-side. Never returns the secret value — only whether the
|
|
159
|
+
* login succeeded and which secret it landed in. */
|
|
160
|
+
export async function loginEnvironment(name) {
|
|
161
|
+
return request(`/environments/${encodeURIComponent(name)}/login`, { method: 'POST' });
|
|
162
|
+
}
|
|
163
|
+
/** Sets (or, when `auth` is `null`, clears) an environment's auth config via
|
|
164
|
+
* `PUT /environments/:name/auth`. Never sends secret values — `auth` carries
|
|
165
|
+
* only refs/names (attach.secretRef, login.request.bodyRef). 204 on success. */
|
|
166
|
+
export async function setEnvironmentAuth(name, auth) {
|
|
167
|
+
await request(`/environments/${encodeURIComponent(name)}/auth`, {
|
|
168
|
+
method: 'PUT',
|
|
169
|
+
headers: { 'Content-Type': 'application/json' },
|
|
170
|
+
body: JSON.stringify(auth),
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/** Flips whether mounted HTTP endpoints execute for real or answer from
|
|
174
|
+
* scenario expectations (mock), via `POST /serving`. 204 on success; a
|
|
175
|
+
* bogus mode is rejected by the runner (surfaced via request()'s error path). */
|
|
176
|
+
export async function setServingMode(mode) {
|
|
177
|
+
await request('/serving', {
|
|
178
|
+
method: 'POST',
|
|
179
|
+
headers: { 'Content-Type': 'application/json' },
|
|
180
|
+
body: JSON.stringify({ mode }),
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
export async function samples(nodeId) {
|
|
184
|
+
const { samples: results } = await request(`/samples?nodeId=${encodeURIComponent(nodeId)}`);
|
|
185
|
+
return results;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Opens the run's SSE stream and collects events until `finished`.
|
|
189
|
+
* Parses the stream by hand: messages are separated by a blank line, each
|
|
190
|
+
* made of `event:`/`data:` lines; lines starting with `:` are heartbeat
|
|
191
|
+
* comments and are ignored.
|
|
192
|
+
*/
|
|
193
|
+
export async function waitForRun(runId) {
|
|
194
|
+
let res;
|
|
195
|
+
try {
|
|
196
|
+
res = await fetch(`${baseUrl()}/runs/${encodeURIComponent(runId)}/events`);
|
|
197
|
+
}
|
|
198
|
+
catch (err) {
|
|
199
|
+
throw new RunnerUnreachableError(err);
|
|
200
|
+
}
|
|
201
|
+
if (!res.ok || !res.body) {
|
|
202
|
+
throw new Error(`Failed to open event stream for run ${runId}: ${res.status} ${res.statusText}`);
|
|
203
|
+
}
|
|
204
|
+
const reader = res.body.getReader();
|
|
205
|
+
const decoder = new TextDecoder();
|
|
206
|
+
let buffer = '';
|
|
207
|
+
const logs = [];
|
|
208
|
+
let finalRun;
|
|
209
|
+
const processMessage = (raw) => {
|
|
210
|
+
const dataLines = [];
|
|
211
|
+
for (const line of raw.split('\n')) {
|
|
212
|
+
if (line.length === 0 || line.startsWith(':'))
|
|
213
|
+
continue;
|
|
214
|
+
if (line.startsWith('data:'))
|
|
215
|
+
dataLines.push(line.slice(5).trimStart());
|
|
216
|
+
}
|
|
217
|
+
if (dataLines.length === 0)
|
|
218
|
+
return;
|
|
219
|
+
const event = JSON.parse(dataLines.join('\n'));
|
|
220
|
+
if (event.type === 'log')
|
|
221
|
+
logs.push(event.line);
|
|
222
|
+
else if (event.type === 'finished')
|
|
223
|
+
finalRun = event.run;
|
|
224
|
+
};
|
|
225
|
+
try {
|
|
226
|
+
while (!finalRun) {
|
|
227
|
+
const { done, value } = await reader.read();
|
|
228
|
+
if (done)
|
|
229
|
+
break;
|
|
230
|
+
buffer += decoder.decode(value, { stream: true });
|
|
231
|
+
let sepIndex;
|
|
232
|
+
while ((sepIndex = buffer.indexOf('\n\n')) !== -1) {
|
|
233
|
+
const raw = buffer.slice(0, sepIndex);
|
|
234
|
+
buffer = buffer.slice(sepIndex + 2);
|
|
235
|
+
processMessage(raw);
|
|
236
|
+
if (finalRun)
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
finally {
|
|
242
|
+
reader.cancel().catch(() => { });
|
|
243
|
+
}
|
|
244
|
+
if (!finalRun)
|
|
245
|
+
throw new Error(`Run ${runId} stream ended before a "finished" event was received`);
|
|
246
|
+
return { run: finalRun, logs };
|
|
247
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/** Describes how the runner authenticates studio runs against an environment. */
|
|
2
|
+
export interface EnvAuth {
|
|
3
|
+
attach: {
|
|
4
|
+
as: 'cookie' | 'header';
|
|
5
|
+
name: string;
|
|
6
|
+
secretRef: string;
|
|
7
|
+
prefix?: string;
|
|
8
|
+
};
|
|
9
|
+
login?: {
|
|
10
|
+
request: {
|
|
11
|
+
method: string;
|
|
12
|
+
url: string;
|
|
13
|
+
headers?: Record<string, string>;
|
|
14
|
+
bodyRef?: string;
|
|
15
|
+
};
|
|
16
|
+
capture: {
|
|
17
|
+
from: 'set-cookie';
|
|
18
|
+
cookieName?: string;
|
|
19
|
+
} | {
|
|
20
|
+
from: 'json';
|
|
21
|
+
path: string;
|
|
22
|
+
} | {
|
|
23
|
+
from: 'header';
|
|
24
|
+
name: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** A named value-set the runner injects into a run. */
|
|
29
|
+
export interface EnvironmentDefinition {
|
|
30
|
+
/** Non-secret values (API base URLs, seed ids, flags) — visible in UI/logs. */
|
|
31
|
+
vars: Record<string, string>;
|
|
32
|
+
/**
|
|
33
|
+
* Resolved secret map (KEY -> value) as seen by the runtime. Values live in
|
|
34
|
+
* `emberflow.secrets.json` (never in `emberflow.environments.json`, which
|
|
35
|
+
* carries only the list of key NAMES). A key that is declared but has no
|
|
36
|
+
* value in the secrets file resolves to '' so `requireSecret` still throws a
|
|
37
|
+
* helpful "missing secret" error. Masked everywhere: keys visible, values
|
|
38
|
+
* never shown.
|
|
39
|
+
*/
|
|
40
|
+
secrets: Record<string, string>;
|
|
41
|
+
/** Marks environments where mistakes are expensive (e.g. prod). Forces safe mode by default. */
|
|
42
|
+
protected?: boolean;
|
|
43
|
+
/** Optional studio-run auth injection config. Absent means no auth injection (backward compatible). */
|
|
44
|
+
auth?: EnvAuth;
|
|
45
|
+
}
|
|
46
|
+
export interface EnvironmentsFile {
|
|
47
|
+
defaultEnvironment: string;
|
|
48
|
+
environments: Record<string, EnvironmentDefinition>;
|
|
49
|
+
/** True when the project deliberately configured environments (an
|
|
50
|
+
* emberflow.environments.json exists, or legacy secrets were found) —
|
|
51
|
+
* false when the loader synthesized the bare "local" fallback. Drives the
|
|
52
|
+
* default serving mode: an unconfigured project boots in mock. */
|
|
53
|
+
configured: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface RunSafetyRequest {
|
|
56
|
+
safeMode?: boolean;
|
|
57
|
+
confirm?: string;
|
|
58
|
+
}
|
|
59
|
+
export type RunSafetyResolution = {
|
|
60
|
+
ok: true;
|
|
61
|
+
safeMode: boolean;
|
|
62
|
+
} | {
|
|
63
|
+
ok: false;
|
|
64
|
+
error: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Resolves the effective `safeMode` for a run against a given environment.
|
|
68
|
+
*
|
|
69
|
+
* - Omitted `safeMode` defaults to the environment's protection: `true` when
|
|
70
|
+
* `protected`, `false` otherwise.
|
|
71
|
+
* - Explicitly requesting `safeMode: false` on a protected environment is
|
|
72
|
+
* refused unless `confirm` matches the environment name exactly.
|
|
73
|
+
* - Any other explicit request (including `safeMode: true` on any env, or
|
|
74
|
+
* `safeMode: false` on a non-protected env) is honored as-is.
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveRunSafety(envName: string, env: EnvironmentDefinition, request: RunSafetyRequest): RunSafetyResolution;
|
|
77
|
+
export declare function loadEnvironments(cwd: string): EnvironmentsFile;
|
|
78
|
+
/**
|
|
79
|
+
* Sets a single secret's VALUE in `emberflow.secrets.json` (0600) and ensures
|
|
80
|
+
* its key NAME is listed on the environment in `emberflow.environments.json`,
|
|
81
|
+
* both at `cwd`. The value never touches environments.json. Throws if the
|
|
82
|
+
* environments file is missing/malformed or the environment name is unknown.
|
|
83
|
+
* Concurrent calls are serialized so two in-flight writes never clobber each other.
|
|
84
|
+
*/
|
|
85
|
+
export declare function setEnvironmentSecret(cwd: string, envName: string, key: string, value: string): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Sets (or, when `auth` is `null`, clears) an environment's `auth` config in
|
|
88
|
+
* `emberflow.environments.json` at `cwd` and persists the change. Validates
|
|
89
|
+
* the auth shape before writing. Throws if the environments file is
|
|
90
|
+
* missing/malformed, the environment name is unknown, or `auth` is invalid.
|
|
91
|
+
* Preserves the environment's other fields (secrets, vars, protected,
|
|
92
|
+
* unknown fields). Shares the write queue with `setEnvironmentSecret` so
|
|
93
|
+
* concurrent writers can't clobber each other.
|
|
94
|
+
*/
|
|
95
|
+
export declare function setEnvironmentAuth(cwd: string, envName: string, auth: EnvAuth | null): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Removes a single secret from an environment: drops its key NAME from
|
|
98
|
+
* `emberflow.environments.json` and its VALUE from `emberflow.secrets.json`,
|
|
99
|
+
* both at `cwd`. Missing key resolves without error. Throws if the environments
|
|
100
|
+
* file is missing/malformed or the environment name is unknown. Shares the
|
|
101
|
+
* write queue with the other writers.
|
|
102
|
+
*/
|
|
103
|
+
export declare function deleteEnvironmentSecret(cwd: string, envName: string, key: string): Promise<void>;
|